GNOME Bugzilla – Bug 169811
configure_event and window-state-event are not emitted consistently on Win32
Last modified: 2011-11-10 18:11:41 UTC
Please describe the problem: I try to save and restore the size of the application on start and stop. This works fine on Linux as the window-state is emitted before the configure event. On the other hand, on Win32 I get a couple of succesize configure events before getting the window-state event. For this reason I can not distinguish the size of the window in normal mode from a full screen or maximized size (sizes that I don't want and don't need to save). Steps to reproduce: Basically you: 1. connect handlers to configure_event and window-state-event for the main window 2. play with the main window by changing its size and state 3. record the order of event emission Actual results: I get different results on win32 from those on Linux. Even more, there is no workarround on Win32 that would allow me to obtain the desired effect. Expected results: I expect the code to behave as on Linux or, at least, the same way on Win32 and on Linux. Does this happen every time? Yes Other information: The problem is described at large at: http://www.daa.com.au/pipermail/pygtk/2005-March/009754.html
Whatever this is, it is certainly not a bug in the bindings. Changing to gtk product.
I don't think GDK can promise that exactly the same events in the same order would be generated on different backends. The events generated and their order is best-effort only. Window state handling is complex enough in the Win32 backend as it is, I wouldn't want to make it even more complex. It seems from the event trace in the references message that no configure event is generated on X11 when a window is switched between normal/maximized/fullscreen/minimized? Is this really so? That presumably would be relatively easy to do in the Win32 backend, too. But until this is fixed (if ever), surely this is something you can work around in your program's logic. The referenced message says: > What I actually need is a way to find out if the window is in normal > state or maximized/minimized/shaded/fullscreen when I get the configure > event Would gdk_window_get_state() work? Or alternatively, retrieve the window size when it is known to be in the normal state using gdk_drawable_get_size()? If you supply a minimal but complete test program (could be in Python, I guess) I can try to make the event generation in this case more X11-like, but no promises.
>It seems from the event trace in the references message that no configure event >is generated on X11 when a window is switched between >normal/maximized/fullscreen/minimized? Is this really so? That would appear to be the case (no "configure_event" on window maximize/restore). I noticed this when trying to figure out why my window was incorrectly remembering the maximized size on Windows but not on Linux. What is even more strange is that there appears to be a configure_event fired when I'm maximizing (apparently, in order to make sure this happens, I need to have triggered a configure_event since the last maximize) but there is no configure_event when I restore(unmaximize). I'm pretty sure that I can work around this as Tor mentioned, but I figured I'd add my 0.02.
I fixed this in the gtk-2-24-win32 branch. Also, i'd like to note that X *does* give configure event on maximize, etc. Its just that the test app only prints configure events gotten with a normal state.