[mutter] frame: Make sure to XSync before grabbing keybindings



commit 05419b8450346e0669533a6557a876e8110e2a6e
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed May 21 10:07:36 2014 -0400

    frame: Make sure to XSync before grabbing keybindings
    
    Otherwise, the X server might read the backend's connection before
    GTK+'s, meaning that it sees the XIGrabKeycode requests before the
    CreateWindow.
    
    This fixes keybindings on windows not working immediately.
    
    Thanks to Rui Matos <tiagomatos gmail com> and
    Julien Cristau <jcristau debian org> for helping track down the issue.

 src/core/frame.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/core/frame.c b/src/core/frame.c
index fdf55d3..2297b58 100644
--- a/src/core/frame.c
+++ b/src/core/frame.c
@@ -151,10 +151,15 @@ meta_window_ensure_frame (MetaWindow *window)
                              window->frame->xwindow,
                              window->title);
 
+  meta_ui_map_frame (frame->window->screen->ui, frame->xwindow);
+
+  /* Since the backend takes keygrabs on another connection, make sure
+   * to sync the GTK+ connection to ensure that the frame window has
+   * been created on the server at this point. */
+  XSync (window->display->xdisplay, False);
+
   /* Move keybindings to frame instead of window */
   meta_window_grab_keys (window);
-
-  meta_ui_map_frame (frame->window->screen->ui, frame->xwindow);
 }
 
 void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]