GNOME Bugzilla – Bug 94669
Tool Windows (Gimp Docks) have the wrong type
Last modified: 2003-03-12 17:22:21 UTC
The various windows opened by The Gimp don't have the right type (they aren't true utilities windows). So the window manager doesn't keep them above the drawing windows. metacity-window-demo (in the metacity package) contains examples of different windows types, to which The Gimp should conform.
There are the following possible window types defined in GDK: typedef enum { GDK_WINDOW_ROOT, GDK_WINDOW_TOPLEVEL, GDK_WINDOW_CHILD, GDK_WINDOW_DIALOG, GDK_WINDOW_TEMP, GDK_WINDOW_FOREIGN } GdkWindowType; Additionally the following type hints may be given: typedef enum { GDK_WINDOW_TYPE_HINT_NORMAL, GDK_WINDOW_TYPE_HINT_DIALOG, GDK_WINDOW_TYPE_HINT_MENU, GDK_WINDOW_TYPE_HINT_TOOLBAR } GdkWindowTypeHint; What do you think which type and hint would suit best?
IMHO, all GIMP windows (e.g. the various tool dialogs) should be "utility windows". But you can try and play with metacity-window-demo to find good window types for specific windows. The "utility window" type is a window manager hint, and is implemented like this in GTK+: window = gtk_window_new (GTK_WINDOW_TOPLEVEL); set_gtk_window_type (GTK_WINDOW (window), "_NET_WM_WINDOW_TYPE_UTILITY"); gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (parent_window)); Now I see a problem: all "drawing windows" are potential parents for the dialogs, and a window can only have one parent I believe. The solution I see is make all "utility windows" childs of the current "drawing windows" when the latter becomes active.
Err ... I forgot, the implementation of set_gtk_window_type() ... static void set_gdk_window_type (GdkWindow *window, const char *type) { Atom atoms[2] = { None, None }; atoms[0] = XInternAtom (GDK_WINDOW_XDISPLAY (window), type, False); XChangeProperty (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XWINDOW (window), XInternAtom (GDK_WINDOW_XDISPLAY (window), "_NET_WM_WINDOW_TYPE", False), XA_ATOM, 32, PropModeReplace, (guchar *)atoms, 1); } static void on_realize_set_type (GtkWindow *window, gpointer data) { const char *type; g_return_if_fail (GTK_WIDGET_REALIZED (window)); type = g_object_get_data (G_OBJECT (window), "meta-window-type"); g_return_if_fail (type != NULL); set_gdk_window_type (GTK_WIDGET (window)->window, type); } static void set_gtk_window_type (GtkWindow *window, const char *type) { g_object_set_data (G_OBJECT (window), "meta-window-type", (char*) type); g_signal_handlers_disconnect_by_func (G_OBJECT (window), on_realize_set_type, NULL); g_signal_connect_after (G_OBJECT (window), "realize", G_CALLBACK (on_realize_set_type), NULL); if (GTK_WIDGET_REALIZED (window)) set_gdk_window_type (GTK_WIDGET (window)->window, type); }
You forgot that The GIMP is not X11 specific. We can't include that piece of code since it will only work for X11. I also have the impression that the concept of "utility" windows is specific to the metacity window manager. We are restricted to the functionality provided by GDK. I gave you the enums so that you can choose from the window types that are offered by GDK. I'm sure that you can find another way to configure your window manager so that the dock windows behave according to your preferences. Sawfish for example allows to configure windows according to the window class and name. I propose to have this report closed as WONTFIX.
Well, it shouldn't be Metacity-specific (see http://www.freedesktop.org/standards/wm-spec/1.2/html/x224.html for the spec), but I agree it should be in gdk instead ...
The HEAD branch of GTK+ seems to have support for these window manager hints. If GTK+-2.2 is released early enough for GIMP-1.4 we can easily change this.
2003-03-12 Sven Neumann <sven@gimp.org> * app/widgets/gimpdock.c (gimp_dock_init): set a window type hint of GDK_WINDOW_TYPE_HINT_UTILITY for dock windows (fixes bug #94669). * app/gui/splash.c (splash_create): set a window type hint of GDK_WINDOW_TYPE_HINT_SPLASHSCREEN.
*** Bug 108211 has been marked as a duplicate of this bug. ***