Re: GDK bug



Wolfgang Sourdeau <wolfgang contre com> writes:
"Carlos" == Carlos Pereira <carlos pehoe civil ist utl pt> writes:

Calling gdk_window_move_resize() in show isn't guaranteed to work at
all. GTK can change it, the window manager can change it. You are
going behind everyone's back, subverting the system, sometimes the
system will notice and decide to put you in line. ;-)

I thought the show signal was emitted after the widget became visible.


No, it is just emitted when you call gtk_widget_show(). The widget is
visible when you get your first expose_event.
 
Is this a toplevel window? If so, use gtk_window_set_default_size()
(to simulate a user-resized size) or gtk_widget_set_usize() (to force
a minimum size).

The problem is that GTK+ has no direct equivalent to get those values
back. I could check the allocation for the dimensions, but what about
the position ?


This is a complicated issue. There is some code I did for GTK 2 that
gives you gtk_window_get_location().

gdk_window_get_origin() will NOT give you the right position to set
back with gtk_window_move_resize() or gtk_widget_set_uposition().

The reason is that the position you set is the top-left corner of the
window manager frame. The position you get is the top-left corner of
your window, inside the window manager frame.

X does not actually support getting the position of the top-left
corner of the WM frame which is what you want, if you want to set the
position back. But we have some bad hacks for GTK 2 to try and guess
at this position.

To get the size, widget->allocation.width, widget->allocation.height
should work just fine, once the window is onscreen.

Havoc




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