GNOME Bugzilla – Bug 586664
GDK_WINDOW_STATE_ICONIFIED on X
Last modified: 2012-03-02 19:44:19 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.)
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.
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.
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.
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.
Somebody needs to update the patch to use HIDDEN instead of ICONIFIED, and the patch will have to be updated to the current codebase.
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.
Created attachment 208154 [details] [review] same, but for gtk2 And this is the same patch but for gtk2.
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 :).
Created attachment 208870 [details] [review] same, but for gtk2 (fixed) Same fix as previous upload, also tested and works.
Review of attachment 208869 [details] [review]: Looks ok
Review of attachment 208870 [details] [review]: Looks good
Thanks for the testing
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(-)