screen: Fetch the COW window up-front

XGetCompositeOverlayWindow is a round trip to the X server. We shouldn't
be doing it on every MapWindow.
This commit is contained in:
Jasper St. Pierre 2014-07-10 14:03:03 -04:00
parent 1749a85e96
commit 463b50e746
4 changed files with 7 additions and 2 deletions

View File

@ -157,7 +157,7 @@ get_output_window (MetaCompositor *compositor)
unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 }; unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits }; XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits };
output = XCompositeGetOverlayWindow (xdisplay, DefaultRootWindow (xdisplay)); output = compositor->display->screen->composite_overlay_window;
XISetMask (mask.mask, XI_KeyPress); XISetMask (mask.mask, XI_KeyPress);
XISetMask (mask.mask, XI_KeyRelease); XISetMask (mask.mask, XI_KeyRelease);

View File

@ -119,6 +119,8 @@ struct _MetaScreen
* and restack them below a guard window. When using a compositor * and restack them below a guard window. When using a compositor
* this allows us to provide live previews of unmapped windows */ * this allows us to provide live previews of unmapped windows */
Window guard_window; Window guard_window;
Window composite_overlay_window;
}; };
struct _MetaScreenClass struct _MetaScreenClass

View File

@ -45,6 +45,7 @@
#include "meta-cursor-tracker-private.h" #include "meta-cursor-tracker-private.h"
#include <X11/extensions/Xinerama.h> #include <X11/extensions/Xinerama.h>
#include <X11/extensions/Xcomposite.h>
#include <X11/Xatom.h> #include <X11/Xatom.h>
#include <locale.h> #include <locale.h>
@ -700,6 +701,8 @@ meta_screen_new (MetaDisplay *display,
screen->starting_corner = META_SCREEN_TOPLEFT; screen->starting_corner = META_SCREEN_TOPLEFT;
screen->guard_window = None; screen->guard_window = None;
screen->composite_overlay_window = XCompositeGetOverlayWindow (xdisplay, xroot);
reload_monitor_infos (screen); reload_monitor_infos (screen);
meta_screen_set_cursor (screen, META_CURSOR_DEFAULT); meta_screen_set_cursor (screen, META_CURSOR_DEFAULT);

View File

@ -2942,7 +2942,7 @@ is_our_xwindow (MetaDisplay *display,
if (xwindow == screen->guard_window) if (xwindow == screen->guard_window)
return TRUE; return TRUE;
if (xwindow == XCompositeGetOverlayWindow (display->xdisplay, screen->xroot)) if (xwindow == screen->composite_overlay_window)
return TRUE; return TRUE;
/* Any windows created via meta_create_offscreen_window */ /* Any windows created via meta_create_offscreen_window */