From 9384ea655c2513105ec2a633b28c3c9fc44744ac Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Sun, 1 Apr 2007 03:38:34 +0000 Subject: [PATCH] Patch from Matthias to add support for the _NET_WM_USER_TIME_WINDOW EWMH 2007-03-31 Elijah Newren * gdk/x11/gdkwindow-x11.c (setup_toplevel_window, gdk_x11_window_set_user_time): Patch from Matthias to add support for the _NET_WM_USER_TIME_WINDOW EWMH protocol; see #354213. WARNING: This patch will make metacity <= 2.18.0 freeze on workspace switch. This is due to a weird problem that should only affect window managers using gdk in-process for decoration drawing and which make an unsafe assumption relating to doing so (i.e. it should only affect metacity). Upgrade your version of metacity if you hit this bug. svn path=/trunk/; revision=17574 --- ChangeLog | 14 ++++++++++++++ gdk/x11/gdkwindow-x11.c | 22 +++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index cd0da1c29a..7df72a3599 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2007-03-31 Elijah Newren + + * gdk/x11/gdkwindow-x11.c (setup_toplevel_window, + gdk_x11_window_set_user_time): + Patch from Matthias to add support for the + _NET_WM_USER_TIME_WINDOW EWMH protocol; see #354213. + + WARNING: This patch will make metacity <= 2.18.0 freeze on + workspace switch. This is due to a weird problem that should only + affect window managers using gdk in-process for decoration drawing + and which make an unsafe assumption relating to doing so (i.e. it + should only affect metacity). Upgrade your version of metacity if + you hit this bug. + 2007-03-29 Michael Natterer Don't close menus on clicks on their border area (bug #423761). diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index c0226a6815..533387fc6f 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -614,6 +614,12 @@ setup_toplevel_window (GdkWindow *window, XA_WINDOW, 32, PropModeReplace, (guchar *) &GDK_DISPLAY_X11 (screen_x11->display)->leader_window, 1); + if (toplevel->focus_window != None) + XChangeProperty (xdisplay, xid, + gdk_x11_get_xatom_by_name_for_display (screen_x11->display, "_NET_WM_USER_TIME_WINDOW"), + XA_WINDOW, 32, PropModeReplace, + (guchar *) &toplevel->focus_window, 1); + if (!obj->focus_on_map) gdk_x11_window_set_user_time (window, 0); else if (GDK_DISPLAY_X11 (screen_x11->display)->user_time != 0) @@ -4256,6 +4262,7 @@ gdk_x11_window_set_user_time (GdkWindow *window, GdkDisplayX11 *display_x11; GdkToplevelX11 *toplevel; glong timestamp_long = (glong)timestamp; + Window xid; g_return_if_fail (GDK_IS_WINDOW (window)); @@ -4266,7 +4273,20 @@ gdk_x11_window_set_user_time (GdkWindow *window, display_x11 = GDK_DISPLAY_X11 (display); toplevel = _gdk_x11_window_get_toplevel (window); - XChangeProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window), + if (!toplevel) + { + g_warning ("gdk_window_set_user_time called on non-toplevel\n"); + return; + } + + if (toplevel->focus_window != None && + gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window), + gdk_atom_intern_static_string ("_NET_WM_USER_TIME_WINDOW"))) + xid = toplevel->focus_window; + else + xid = GDK_WINDOW_XID (window); + + XChangeProperty (GDK_DISPLAY_XDISPLAY (display), xid, gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_USER_TIME"), XA_CARDINAL, 32, PropModeReplace, (guchar *)×tamp_long, 1);