After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 169811 - configure_event and window-state-event are not emitted consistently on Win32
configure_event and window-state-event are not emitted consistently on Win32
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Win32
2.5.x
Other Windows
: Normal normal
: ---
Assigned To: gtk-win32 maintainers
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2005-03-10 09:02 UTC by borco
Modified: 2011-11-10 18:11 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description borco 2005-03-10 09:02:00 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
Comment 1 Gustavo Carneiro 2005-06-24 15:24:09 UTC
Whatever this is, it is certainly not a bug in the bindings.  Changing to gtk
product.
Comment 2 Tor Lillqvist 2005-07-26 08:05:56 UTC
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.
Comment 3 Daniel Atallah 2006-05-11 00:45:55 UTC
>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.
Comment 4 Alexander Larsson 2011-10-26 08:24:49 UTC
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.