Re: Getting screen position



muppet wrote:

the Gtk2 docs say
[...]


oops --- i pasted from the webpage in mozilla, and didn't realize the conversion to plaintext would insert the hyperlinks... here's the cleaned-up version:


the Gtk2 docs say

   void        gtk_window_get_position         (GtkWindow  *window,
                                                gint  *root_x,
                                                gint  *root_y);


something like

($x, $y) = $gtk2window->get_position;



it would appear, however, that for Gtk1.2 (the old gtkperl) you need to dip down to Gdk for this:

   void        gdk_window_get_position         (GdkWindow *window,
                                                gint  *x,
                                                gint  *y);


aye --- Gtk::reference says of Gtk::Gdk::Window

$window->get_position ()

Get the position of the window. This function croaks if not called in
list context.



so, basically, you want to do

($x, $y) = $gtkwindow->window->get_position;


note, also, the important "->window" --- this accesses the GdkWindow owned by the GtkWidget. remember that the GdkWindow doesn't exist until the widget has been realize()d or show()n.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]