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 586664 - GDK_WINDOW_STATE_ICONIFIED on X
GDK_WINDOW_STATE_ICONIFIED on X
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: X11
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2009-06-22 17:59 UTC by Owen Taylor
Modified: 2012-03-02 19:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to base iconfication around _NET_WM_STATE_HIDDEN (6.16 KB, patch)
2009-08-04 12:44 UTC, Tomas Frydrych
none Details | Review
Updated path using _NET_WM_STATE_ICONIFIED instead of _NET_WM_STATE_HIDDEN (6.50 KB, patch)
2009-08-05 08:59 UTC, Tomas Frydrych
none Details | Review
Updated patch using HIDDEN, and for gtk3 (6.54 KB, patch)
2012-02-21 16:37 UTC, Mikael Magnusson
none Details | Review
same, but for gtk2 (6.45 KB, patch)
2012-02-21 17:08 UTC, Mikael Magnusson
none Details | Review
Updated patch using HIDDEN, no #if 0, for gtk3, actually compiles (6.54 KB, patch)
2012-03-02 19:00 UTC, Mikael Magnusson
accepted-commit_now Details | Review
same, but for gtk2 (fixed) (6.45 KB, patch)
2012-03-02 19:01 UTC, Mikael Magnusson
accepted-commit_now Details | Review

Description Owen Taylor 2009-06-22 17:59:06 UTC
GDK termines whether the window is iconified the classic ICCCM way - a window is iconified if it's not withdrawn and the window manager has unmapped it.

However, this concept of "iconic" doesn't correspond well to the end user concept of minimized. It:

 - Fails with window managers that unmap windows on other works, in particular with Metacity, since windows on other desktops will be minimized.

 - Fails with window managers that don't unmap minimized windows (like Mutter). While not unmapping such windows is possibly not 100% compliant with the ICCCM, it allows showing previews of minimized windows.

A practical consequence of this is that (with the first class of window managers) the state-saving code in gtk_window_unmap() will cause a window that is on a desktop other than the current one to be minimized when it is mapped again. (See also bug 586311)

_NET_WM_STATE_HIDDEN in the _NET_WM_STATE property corresponds much more exactly to the user-concept, and we probably should be using it instead when we have a wm-spec supporting window manager.

(Metacity confuses things by setting _NET_WM_STATE_HIDDEN for shaded windows as well, but I don't think GTK+ should worry about that. It probably just needs to be fixed in Metacity.)
Comment 1 Tomas Frydrych 2009-08-04 12:44:18 UTC
Created attachment 139861 [details] [review]
Patch to base iconfication around _NET_WM_STATE_HIDDEN

Attached is a tentative patch to change the iconfication behaviour along the lines suggested in the original bug report. This is my first foray into the gdk internals, so there is a good chance, this patch misses things or does not do them optimally; treat it as a proof of concept. As far as I can tell this fixes the problem of not being able to deiconify windows in mutter (with patch from http://bugzilla.gnome.org/show_bug.cgi?id=590726 applied), while iconification continues to work as with regular metacity.
Comment 2 Tomas Frydrych 2009-08-05 08:59:15 UTC
Created attachment 139925 [details] [review]
Updated path using _NET_WM_STATE_ICONIFIED instead of _NET_WM_STATE_HIDDEN

I am attaching an updated patch which replaces the use of the _NET_WM_STATE_HIDDEN property with a new _NET_WM_STATE_ICONIFIED (which, would need to be formally added to the EWMH specification). The primary reason for this is to avoid any potential legacy issues, since having a new value allows client applications to check whether the running Window Manager supports this mechanism or not.
Comment 3 Matthias Clasen 2009-08-07 03:14:02 UTC
I think I'd rather avoid confusing things further by introducing yet another mechanism. As Owen proposed initially, lets just use NET_WM_STATE_HIDDEN when it is supported and use traditional ICCCM iconified behaviour  otherwise.
Comment 4 Mikael Magnusson 2011-01-14 02:05:59 UTC
Hi, could this (the HIDDEN version) be included in gtk+ soon? It is causing practical problems with GIMP in reparenting window managers, particularly openbox. It wants to hide the toolbox when all image windows are iconified and gets confused when you go to another desktop. It is especially amusing when you try to move the toolbox to another desktop, for example with a file manager or a browser, to drag a file onto it, and it simply disappears.
Comment 5 Matthias Clasen 2012-02-21 15:36:49 UTC
Somebody needs to update the patch to use HIDDEN instead of ICONIFIED, and the patch will have to be updated to the current codebase.
Comment 6 Mikael Magnusson 2012-02-21 16:37:49 UTC
Created attachment 208151 [details] [review]
Updated patch using HIDDEN, and for gtk3

Here's the updated version using HIDDEN again and no #if 0, for gtk3.
Comment 7 Mikael Magnusson 2012-02-21 17:08:58 UTC
Created attachment 208154 [details] [review]
same, but for gtk2

And this is the same patch but for gtk2.
Comment 8 Mikael Magnusson 2012-03-02 19:00:21 UTC
Created attachment 208869 [details] [review]
Updated patch using HIDDEN, no #if 0, for gtk3, actually compiles

I should probably have tested it before uploading, missed that a variable had been renamed, and changing one _iconified to _hidden. I tested it with the gtk3-port branch of gimp, and it actually works too :).
Comment 9 Mikael Magnusson 2012-03-02 19:01:11 UTC
Created attachment 208870 [details] [review]
same, but for gtk2 (fixed)

Same fix as previous upload, also tested and works.
Comment 10 Matthias Clasen 2012-03-02 19:02:51 UTC
Review of attachment 208869 [details] [review]:

Looks ok
Comment 11 Matthias Clasen 2012-03-02 19:03:11 UTC
Review of attachment 208870 [details] [review]:

Looks good
Comment 12 Matthias Clasen 2012-03-02 19:03:29 UTC
Thanks for the testing
Comment 13 Mikael Magnusson 2012-03-02 19:44:19 UTC
committed in master and gtk-2-24:

commit 1c970036648bffd5d58499bb7c8e2439b84d4397                                              
Author: Mikael Magnusson <mikachu@gmail.com>
Date:   Tue Feb 21 17:14:16 2012 +0100

    Iconification using _NET_WM_STATE_HIDDEN hint if supported by WM

    If the Window Manager supports the _NET_WM_STATE_HIDDEN, we use it to use
    the _NET_WM_STATE protocol when de-iconifying windows (iconification is
    unchanged, via XIconifyWindow). Additionally, we no longer interpret all
    UnmapNotify events for our window as the result of iconification.

    (Based on patch by Tomas Frydrych <tf@linux.intel.com>)

 gdk/x11/gdkdisplay-x11.c |   49 +++++++++++++++++++++++++++++++++++----------
 gdk/x11/gdkwindow-x11.c  |   17 ++++++++++++++++
 gdk/x11/gdkwindow-x11.h  |    1 +
 3 files changed, 56 insertions(+), 11 deletions(-)