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 724951 - gdk_window_get_state() returns old value after unmaximize
gdk_window_get_state() returns old value after unmaximize
Status: RESOLVED NOTABUG
Product: gtk+
Classification: Platform
Component: .General
3.10.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2014-02-22 12:49 UTC by Jakob Unterwurzacher
Modified: 2014-03-21 22:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gdk_window_get_state() test app (857 bytes, text/plain)
2014-02-22 12:49 UTC, Jakob Unterwurzacher
Details

Description Jakob Unterwurzacher 2014-02-22 12:49:47 UTC
Created attachment 269990 [details]
gdk_window_get_state() test app

It looks like the first call to gdk_window_get_state() returns the old value after an unmaximize.

The simple testcase (attached) registers a callback and prints out window state and size. We geht:

# Normal window
state = 0x80, width = 200, height = 200
# Maximize
state = 0x184, width = 1920, height = 1014
# Unmaximize
state = 0x184, width = 200, height = 200
# Move window
state = 0x80, width = 200, height = 200

Decode:
    0x80 == GDK_WINDOW_STATE_FOCUSED
   0x184 == GDK_WINDOW_STATE_FOCUSED | GDK_WINDOW_STATE_MAXIMIZED |
            GDK_WINDOW_STATE_TILED

Downstream user is Geary, where this behavoir makes Geary fail to restore the correct window state when the user unmaximizes, then closes the window.
Comment 1 Matthias Clasen 2014-02-23 15:42:51 UTC
I would recommend using window-state-event instead of configure for this kind of tracking.
Comment 2 Jakob Unterwurzacher 2014-03-21 22:32:37 UTC
Thanks for the suggestion. This works.
Calling gdk_window_get_state() from within the callback is probably just a bad idea.