forked from AuroraMiddleware/gtk
Make window manager tracking work better
We were getting the new wm name with a 15 second delay, due to some race. Reported in bug 593644.
This commit is contained in:
parent
079cc21956
commit
5c14089225
@ -1033,28 +1033,31 @@ gdk_event_translate (GdkDisplay *display,
|
||||
}
|
||||
}
|
||||
|
||||
if (screen_x11 && screen_x11->wmspec_check_window != None &&
|
||||
xwindow == screen_x11->wmspec_check_window)
|
||||
{
|
||||
if (xevent->type == DestroyNotify)
|
||||
{
|
||||
int i, n;
|
||||
|
||||
n = gdk_display_get_n_screens (display);
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
screen = gdk_display_get_screen (display, i);
|
||||
screen_x11 = GDK_SCREEN_X11 (screen);
|
||||
|
||||
if (screen_x11->wmspec_check_window == xwindow)
|
||||
{
|
||||
screen_x11->wmspec_check_window = None;
|
||||
screen_x11->last_wmspec_check_time = 0;
|
||||
g_free (screen_x11->window_manager_name);
|
||||
screen_x11->window_manager_name = g_strdup ("unknown");
|
||||
|
||||
/* careful, reentrancy */
|
||||
_gdk_x11_screen_window_manager_changed (GDK_SCREEN (screen_x11));
|
||||
}
|
||||
_gdk_x11_screen_window_manager_changed (screen);
|
||||
|
||||
/* Eat events on this window unless someone had wrapped
|
||||
* it as a foreign window
|
||||
*/
|
||||
if (window == NULL)
|
||||
{
|
||||
return_val = FALSE;
|
||||
retval = FALSE;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (window &&
|
||||
(xevent->xany.type == MotionNotify ||
|
||||
@ -2629,6 +2632,7 @@ fetch_net_wm_check_window (GdkScreen *screen)
|
||||
guchar *data;
|
||||
Window *xwindow;
|
||||
GTimeVal tv;
|
||||
gint error;
|
||||
|
||||
screen_x11 = GDK_SCREEN_X11 (screen);
|
||||
display = screen_x11->display;
|
||||
@ -2643,7 +2647,7 @@ fetch_net_wm_check_window (GdkScreen *screen)
|
||||
screen_x11->last_wmspec_check_time = tv.tv_sec;
|
||||
|
||||
data = NULL;
|
||||
XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), screen_x11->xroot_window,
|
||||
XGetWindowProperty (screen_x11->xdisplay, screen_x11->xroot_window,
|
||||
gdk_x11_get_xatom_by_name_for_display (display, "_NET_SUPPORTING_WM_CHECK"),
|
||||
0, G_MAXLONG, False, XA_WINDOW, &type, &format,
|
||||
&n_items, &bytes_after, &data);
|
||||
@ -2669,7 +2673,8 @@ fetch_net_wm_check_window (GdkScreen *screen)
|
||||
XSelectInput (screen_x11->xdisplay, *xwindow, StructureNotifyMask);
|
||||
gdk_display_sync (display);
|
||||
|
||||
if (gdk_error_trap_pop () == Success)
|
||||
error = gdk_error_trap_pop ();
|
||||
if (!error)
|
||||
{
|
||||
screen_x11->wmspec_check_window = *xwindow;
|
||||
screen_x11->need_refetch_net_supported = TRUE;
|
||||
@ -2678,6 +2683,11 @@ fetch_net_wm_check_window (GdkScreen *screen)
|
||||
/* Careful, reentrancy */
|
||||
_gdk_x11_screen_window_manager_changed (GDK_SCREEN (screen_x11));
|
||||
}
|
||||
else if (error == BadWindow)
|
||||
{
|
||||
/* Leftover property, try again immediately, new wm may be starting up */
|
||||
screen_x11->last_wmspec_check_time = 0;
|
||||
}
|
||||
|
||||
XFree (xwindow);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user