A couple of questions about widget positions



Hi all. Thanks to those who answered my previous question about event loops.

I have a couple of questions regarding the retrieval of the positions of
widgets prior to widget realization. I can do this with widget size, but
can't figure out how to do it with position.

e.g.
Requisition r;
GtkWidget* button;
button = gtk_button_new_with_label("Testing");
/* I can set and get size... */
gtk_widget_set_usize(button, 500, 500);
gtk_widget_size_request(button, &r);
printf("Button size before realization: %dx%d\n", r.width, r.height);
/* ... and I can set position... */
gtk_widget_set_uposition(button, 100, 100);
/* ... but how do I get it? */
printf("Button position before realization: ?\n");

I realize the position may not be exact, just as the size is only a request,
but since I can set it, I must be able to get it somehow as well. If the
requisition contained an x and y in addition to width and height, I'd be 
home free.

I also need to be able to do the same for GtkWindows, which seem to be a
little different. I set the position the same way, but need the deskrelative
origin instead of just 0@0.


My second question deals with GtkWindows and their position on the
screen. gdk_window_deskrelative_origin returns the origin of the shell's
internal window, which does not include any decorations that the window
manager adds to the window. However, gtk_widget_set_uposition(window, x, y)
appears to set the origin of the decorations, not of the internal window.
So how can I GET the current position of the bounding window relative to
the origin of the desktop, including all window manager decorations?

Thanks in advance for any help.

james



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