From 591d31c970e1e00c53812de2c24bef6546bcf6ae Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Mon, 25 Aug 2014 16:14:38 +0200
Subject: [PATCH] xi2: XSync before getting the client pointer on construction

If the device manager is created and queried for the client pointer at
a very early stage in application lifetime, the device_id returned would
be 0 as the server hasn't apparently decided yet about the client pointer.

For these situations, doing XSync prior to fetching the client pointer
gets the server to device about the client pointer before we query it.

https://bugzilla.gnome.org/show_bug.cgi?id=735388
---
 clutter/x11/clutter-device-manager-xi2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clutter/x11/clutter-device-manager-xi2.c b/clutter/x11/clutter-device-manager-xi2.c
index 5eb64c06d..aef0bd666 100644
--- a/clutter/x11/clutter-device-manager-xi2.c
+++ b/clutter/x11/clutter-device-manager-xi2.c
@@ -1499,6 +1499,7 @@ clutter_device_manager_xi2_constructed (GObject *gobject)
                                             clutter_x11_get_root_window (),
                                             &event_mask);
 
+  XSync (backend_x11->xdpy, False);
   update_client_pointer (manager_xi2);
 
   if (G_OBJECT_CLASS (clutter_device_manager_xi2_parent_class)->constructed)