diff --git a/ChangeLog b/ChangeLog index 538c2599a0..06fe82a47e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-11-08 Michael Natterer + + * gdk/gdk.symbols + * gdk/gdkwindow.h + * gdk/x11/gdkwindow-x11.c: added gdk_window_get_type_hint() (patch + extracted from maemo-gtk). Fixes bug #320872. + 2005-11-07 Matthias Clasen * gtk/gtkfilechooserdefault.c (shortcuts_reorder): Don't diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 538c2599a0..06fe82a47e 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +2005-11-08 Michael Natterer + + * gdk/gdk.symbols + * gdk/gdkwindow.h + * gdk/x11/gdkwindow-x11.c: added gdk_window_get_type_hint() (patch + extracted from maemo-gtk). Fixes bug #320872. + 2005-11-07 Matthias Clasen * gtk/gtkfilechooserdefault.c (shortcuts_reorder): Don't diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols index 3335349d28..068ea03095 100644 --- a/gdk/gdk.symbols +++ b/gdk/gdk.symbols @@ -706,6 +706,7 @@ gdk_window_focus gdk_window_set_hints gdk_window_get_deskrelative_origin #endif +gdk_window_get_type_hint gdk_window_set_type_hint gdk_window_set_modal_hint gdk_window_set_skip_taskbar_hint diff --git a/gdk/gdkwindow.h b/gdk/gdkwindow.h index 60d2f0b5c7..e7570ab78c 100644 --- a/gdk/gdkwindow.h +++ b/gdk/gdkwindow.h @@ -436,8 +436,10 @@ void gdk_window_set_hints (GdkWindow *window, gint max_height, gint flags); #endif -void gdk_window_set_type_hint (GdkWindow *window, - GdkWindowTypeHint hint); +void gdk_window_set_type_hint (GdkWindow *window, + GdkWindowTypeHint hint); +GdkWindowTypeHint gdk_window_get_type_hint (GdkWindow *window); + void gdk_window_set_modal_hint (GdkWindow *window, gboolean modal); diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index 30722fe133..1831b73de8 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -2273,6 +2273,69 @@ gdk_window_set_type_hint (GdkWindow *window, (guchar *)&atom, 1); } +/** + * gdk_window_get_type_hint: + * @window: A toplevel #GdkWindow + * + * This function returns the type hint set for a window. + * + * Return value: The type hint set for @window + * + * Since: 2.10 + **/ +GdkWindowTypeHint +gdk_window_get_type_hint (GdkWindow *window) +{ + GdkDisplay *display; + GdkWindowTypeHint type; + Atom type_return; + gint format_return; + gulong nitems_return; + gulong bytes_after_return; + guchar *data = NULL; + + g_return_val_if_fail (GDK_IS_WINDOW (window), GDK_WINDOW_TYPE_HINT_NORMAL); + + if (GDK_WINDOW_DESTROYED (window)) + return GDK_WINDOW_TYPE_HINT_NORMAL; + + type = GDK_WINDOW_TYPE_HINT_NORMAL; + + display = gdk_drawable_get_display (window); + + if (XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window), + gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE"), + 0, G_MAXLONG, False, XA_ATOM, &type_return, + &format_return, &nitems_return, &bytes_after_return, + &data) == Success) + { + if ((type_return == XA_ATOM) && (format_return == 32) && + (data) && (nitems_return == 1)) + { + Atom atom = (Atom) *data; + + if (atom == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_DIALOG")) + type = GDK_WINDOW_TYPE_HINT_DIALOG; + else if (atom == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_MENU")) + type = GDK_WINDOW_TYPE_HINT_MENU; + else if (atom == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_TOOLBAR")) + type = GDK_WINDOW_TYPE_HINT_TOOLBAR; + else if (atom == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_UTILITY")) + type = GDK_WINDOW_TYPE_HINT_UTILITY; + else if (atom == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_SPLASH")) + type = GDK_WINDOW_TYPE_HINT_SPLASHSCREEN; + else if (atom == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_DOCK")) + type = GDK_WINDOW_TYPE_HINT_DOCK; + else if (atom == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_DESKTOP")) + type = GDK_WINDOW_TYPE_HINT_DESKTOP; + } + + if (type_return != None && data != NULL) + XFree (data); + } + + return type; +} static void gdk_wmspec_change_state (gboolean add,