add ECORE_X_SYNC env variable for xlib backend
authorMike Blumenkrantz <m.blumenkran@samsung.com>
Thu, 18 Jul 2013 05:17:40 +0000 (06:17 +0100)
committerMike Blumenkrantz <m.blumenkran@samsung.com>
Thu, 18 Jul 2013 05:17:40 +0000 (06:17 +0100)
27 files changed:
ChangeLog
NEWS
src/lib/ecore_x/Ecore_X.h
src/lib/ecore_x/xlib/ecore_x.c
src/lib/ecore_x/xlib/ecore_x_atoms.c
src/lib/ecore_x/xlib/ecore_x_composite.c
src/lib/ecore_x/xlib/ecore_x_cursor.c
src/lib/ecore_x/xlib/ecore_x_damage.c
src/lib/ecore_x/xlib/ecore_x_dnd.c
src/lib/ecore_x/xlib/ecore_x_drawable.c
src/lib/ecore_x/xlib/ecore_x_e.c
src/lib/ecore_x/xlib/ecore_x_events.c
src/lib/ecore_x/xlib/ecore_x_fixes.c
src/lib/ecore_x/xlib/ecore_x_gc.c
src/lib/ecore_x/xlib/ecore_x_gesture.c
src/lib/ecore_x/xlib/ecore_x_icccm.c
src/lib/ecore_x/xlib/ecore_x_image.c
src/lib/ecore_x/xlib/ecore_x_netwm.c
src/lib/ecore_x/xlib/ecore_x_pixmap.c
src/lib/ecore_x/xlib/ecore_x_private.h
src/lib/ecore_x/xlib/ecore_x_region.c
src/lib/ecore_x/xlib/ecore_x_selection.c
src/lib/ecore_x/xlib/ecore_x_window.c
src/lib/ecore_x/xlib/ecore_x_window_prop.c
src/lib/ecore_x/xlib/ecore_x_window_shape.c
src/lib/ecore_x/xlib/ecore_x_xi2.c
src/lib/ecore_x/xlib/ecore_x_xinerama.c

index a1e9b20..b69c8c2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-07-18  Mike Blumenkrantz
+
+        * Ecore-X: add ECORE_X_SYNC env variable for xlib backend
+
 2013-07-17  Guillaume Friloux
         * Fix ecore_con_server_timeout_set(). It was changing the 
           timeout value, but not the timer.
diff --git a/NEWS b/NEWS
index a55f4f1..d2d6a5e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -84,6 +84,7 @@ Additions:
        ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_DISABLE
      - add error messages for xlib
        ECORE_X_ATOM_XDND_DIRECTSAVE0
+     - add ECORE_X_SYNC env variable for xlib backend
     * Ecore_Wayland:
      - Store global wayland interfaces in a globals list so wayland programs
        can bind to other non-standard wayland protocol extensions.
index ca77664..e0e24ae 100644 (file)
@@ -54,6 +54,9 @@
  * @li @ref Ecore_X_Window_Z_Order_Group
  * @li @ref Ecore_X_Window_Parent_Group
  * @li @ref Ecore_X_Window_Shape
+ *
+ * When using the XLib backend, setting the ECORE_X_SYNC environment variable
+ * will cause X calls to be run synchronously for easier debugging.
  */
 
 typedef unsigned int   Ecore_X_ID;
index fe16255..16377c0 100644 (file)
@@ -50,6 +50,8 @@ static int _ecore_x_event_screensaver_id = 0;
 static int _ecore_x_event_sync_id = 0;
 int _ecore_xlib_log_dom = -1;
 
+Eina_Bool _ecore_xlib_sync = EINA_FALSE;
+
 #ifdef ECORE_XRANDR
 static int _ecore_x_event_randr_id = 0;
 #endif /* ifdef ECORE_XRANDR */
@@ -678,6 +680,7 @@ ecore_x_init(const char *name)
      goto free_event_handlers;
 
    _ecore_x_private_win = ecore_x_window_override_new(0, -77, -777, 123, 456);
+   _ecore_xlib_sync = !!getenv("ECORE_X_SYNC");
 
    return _ecore_x_init_count;
 
@@ -738,6 +741,7 @@ _ecore_x_shutdown(int close_display)
    eina_log_domain_unregister(_ecore_xlib_log_dom);
    _ecore_xlib_log_dom = -1;
    eina_shutdown();
+   _ecore_xlib_sync = EINA_FALSE;
 
    return _ecore_x_init_count;
 }
@@ -993,6 +997,7 @@ ecore_x_kill(Ecore_X_Window win)
 {
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XKillClient(_ecore_x_disp, win);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /**
@@ -1329,6 +1334,7 @@ ecore_x_window_container_manage(Ecore_X_Window win)
    XSelectInput(_ecore_x_disp, win,
                 SubstructureRedirectMask |
                 SubstructureNotifyMask);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -1344,7 +1350,9 @@ ecore_x_window_client_manage(Ecore_X_Window win)
                 StructureNotifyMask |
                 SubstructureNotifyMask
                 );
+   if (_ecore_xlib_sync) ecore_x_sync();
    XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -1354,6 +1362,7 @@ ecore_x_window_sniff(Ecore_X_Window win)
    XSelectInput(_ecore_x_disp, win,
                 PropertyChangeMask |
                 SubstructureNotifyMask);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -1367,7 +1376,9 @@ ecore_x_window_client_sniff(Ecore_X_Window win)
                 VisibilityChangeMask |
                 StructureNotifyMask |
                 SubstructureNotifyMask);
+   if (_ecore_xlib_sync) ecore_x_sync();
    XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI Eina_Bool
@@ -1375,10 +1386,12 @@ ecore_x_window_attributes_get(Ecore_X_Window win,
                               Ecore_X_Window_Attributes *att_ret)
 {
    XWindowAttributes att;
+   Eina_Bool ret;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
-   if (!XGetWindowAttributes(_ecore_x_disp, win, &att))
-     return EINA_FALSE;
+   ret = XGetWindowAttributes(_ecore_x_disp, win, &att);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   if (!ret) return EINA_FALSE;
 
    memset(att_ret, 0, sizeof(Ecore_X_Window_Attributes));
    att_ret->root = att.root;
@@ -1418,6 +1431,7 @@ ecore_x_window_save_set_add(Ecore_X_Window win)
 {
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XAddToSaveSet(_ecore_x_disp, win);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -1425,6 +1439,7 @@ ecore_x_window_save_set_del(Ecore_X_Window win)
 {
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XRemoveFromSaveSet(_ecore_x_disp, win);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI Ecore_X_Window *
@@ -1432,13 +1447,15 @@ ecore_x_window_children_get(Ecore_X_Window win,
                             int *num)
 {
    Ecore_X_Window *windows = NULL;
+   Eina_Bool success;
    Window root_ret = 0, parent_ret = 0, *children_ret = NULL;
    unsigned int children_ret_num = 0;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
-   if (!XQueryTree(_ecore_x_disp, win, &root_ret, &parent_ret, &children_ret,
-                   &children_ret_num))
-     return NULL;
+   success = XQueryTree(_ecore_x_disp, win, &root_ret, &parent_ret, &children_ret,
+                   &children_ret_num);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   if (!success) return NULL;
 
    if (children_ret)
      {
@@ -1463,9 +1480,12 @@ ecore_x_pointer_control_set(int accel_num,
                             int accel_denom,
                             int threshold)
 {
+   Eina_Bool ret;
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
-   return XChangePointerControl(_ecore_x_disp, 1, 1,
-                                accel_num, accel_denom, threshold) ? EINA_TRUE : EINA_FALSE;
+   ret = !!XChangePointerControl(_ecore_x_disp, 1, 1,
+                                accel_num, accel_denom, threshold);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   return ret;
 }
 
 EAPI Eina_Bool
@@ -1473,53 +1493,62 @@ ecore_x_pointer_control_get(int *accel_num,
                             int *accel_denom,
                             int *threshold)
 {
+   Eina_Bool ret;
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
-   return XGetPointerControl(_ecore_x_disp,
-                             accel_num, accel_denom, threshold) ? EINA_TRUE : EINA_FALSE;
+   ret = !!XGetPointerControl(_ecore_x_disp,
+                             accel_num, accel_denom, threshold);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   return ret;
 }
 
 EAPI Eina_Bool
 ecore_x_pointer_mapping_set(unsigned char *map,
                             int nmap)
 {
+   Eina_Bool ret;
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
-   return (XSetPointerMapping(_ecore_x_disp, map, nmap) == MappingSuccess) ? EINA_TRUE : EINA_FALSE;
+   ret = (XSetPointerMapping(_ecore_x_disp, map, nmap) == MappingSuccess);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   return ret;
 }
 
 EAPI Eina_Bool
 ecore_x_pointer_mapping_get(unsigned char *map,
                             int nmap)
 {
+   Eina_Bool ret;
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
-   return XGetPointerMapping(_ecore_x_disp, map, nmap) ? EINA_TRUE : EINA_FALSE;
+   ret = !!XGetPointerMapping(_ecore_x_disp, map, nmap);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   return ret;
 }
 
 EAPI Eina_Bool
 ecore_x_pointer_grab(Ecore_X_Window win)
 {
+   Eina_Bool ret;
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
-   if (XGrabPointer(_ecore_x_disp, win, False,
+   ret = (XGrabPointer(_ecore_x_disp, win, False,
                     ButtonPressMask | ButtonReleaseMask |
                     EnterWindowMask | LeaveWindowMask | PointerMotionMask,
                     GrabModeAsync, GrabModeAsync,
-                    None, None, CurrentTime) == GrabSuccess)
-     return EINA_TRUE;
-
-   return EINA_FALSE;
+                    None, None, CurrentTime) == GrabSuccess);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   return ret;
 }
 
 EAPI Eina_Bool
 ecore_x_pointer_confine_grab(Ecore_X_Window win)
 {
+   Eina_Bool ret;
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
-   if (XGrabPointer(_ecore_x_disp, win, False,
+   ret = (XGrabPointer(_ecore_x_disp, win, False,
                     ButtonPressMask | ButtonReleaseMask |
                     EnterWindowMask | LeaveWindowMask | PointerMotionMask,
                     GrabModeAsync, GrabModeAsync,
-                    win, None, CurrentTime) == GrabSuccess)
-     return EINA_TRUE;
-
-   return EINA_FALSE;
+                    win, None, CurrentTime) == GrabSuccess);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   return ret;
 }
 
 EAPI void
@@ -1527,6 +1556,7 @@ ecore_x_pointer_ungrab(void)
 {
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XUngrabPointer(_ecore_x_disp, CurrentTime);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI Eina_Bool
@@ -1534,20 +1564,23 @@ ecore_x_pointer_warp(Ecore_X_Window win,
                      int x,
                      int y)
 {
+   Eina_Bool ret;
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
-   return XWarpPointer(_ecore_x_disp, None, win, 0, 0, 0, 0, x, y) ? EINA_TRUE : EINA_FALSE;
+   ret = !!XWarpPointer(_ecore_x_disp, None, win, 0, 0, 0, 0, x, y);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   return ret;
 }
 
 EAPI Eina_Bool
 ecore_x_keyboard_grab(Ecore_X_Window win)
 {
+   Eina_Bool ret;
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
-   if (XGrabKeyboard(_ecore_x_disp, win, False,
+   ret = (XGrabKeyboard(_ecore_x_disp, win, False,
                      GrabModeAsync, GrabModeAsync,
-                     CurrentTime) == GrabSuccess)
-     return EINA_TRUE;
-
-   return EINA_FALSE;
+                     CurrentTime) == GrabSuccess);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   return ret;
 }
 
 EAPI void
@@ -1722,7 +1755,10 @@ ecore_x_window_button_ungrab(Ecore_X_Window win,
    locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
    locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
    for (i = 0; i < 8; i++)
-     XUngrabButton(_ecore_x_disp, b, m | locks[i], win);
+     {
+        XUngrabButton(_ecore_x_disp, b, m | locks[i], win);
+        if (_ecore_xlib_sync) ecore_x_sync();
+     }
    _ecore_x_sync_magic_send(1, win);
 }
 
@@ -1770,8 +1806,11 @@ ecore_x_window_key_grab(Ecore_X_Window win,
    locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
    locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
    for (i = 0; i < 8; i++)
-     XGrabKey(_ecore_x_disp, keycode, m | locks[i],
-              win, False, GrabModeSync, GrabModeAsync);
+     {
+        XGrabKey(_ecore_x_disp, keycode, m | locks[i],
+                 win, False, GrabModeSync, GrabModeAsync);
+        if (_ecore_xlib_sync) ecore_x_sync();
+     }
    _ecore_key_grabs_num++;
    t = realloc(_ecore_key_grabs,
                _ecore_key_grabs_num * sizeof(Window));
@@ -1882,6 +1921,7 @@ ecore_x_client_message32_send(Ecore_X_Window win,
                               long d4)
 {
    XEvent xev;
+   Eina_Bool ret;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    xev.xclient.window = win;
@@ -1894,7 +1934,9 @@ ecore_x_client_message32_send(Ecore_X_Window win,
    xev.xclient.data.l[3] = d3;
    xev.xclient.data.l[4] = d4;
 
-   return XSendEvent(_ecore_x_disp, win, False, mask, &xev) ? EINA_TRUE : EINA_FALSE;
+   ret = !!XSendEvent(_ecore_x_disp, win, False, mask, &xev);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   return ret;
 }
 
 /**
@@ -1914,6 +1956,7 @@ ecore_x_client_message8_send(Ecore_X_Window win,
                              int len)
 {
    XEvent xev;
+   Eina_Bool ret;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    xev.xclient.window = win;
@@ -1926,7 +1969,9 @@ ecore_x_client_message8_send(Ecore_X_Window win,
    memcpy(xev.xclient.data.b, data, len);
    memset(xev.xclient.data.b + len, 0, 20 - len);
 
-   return XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev) ? EINA_TRUE : EINA_FALSE;
+   ret = !!XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   return ret;
 }
 
 EAPI Eina_Bool
@@ -1938,6 +1983,7 @@ ecore_x_mouse_move_send(Ecore_X_Window win,
    XWindowAttributes att;
    Window tw;
    int rx, ry;
+   Eina_Bool ret;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XGetWindowAttributes(_ecore_x_disp, win, &att);
@@ -1954,7 +2000,9 @@ ecore_x_mouse_move_send(Ecore_X_Window win,
    xev.xmotion.state = 0;
    xev.xmotion.is_hint = 0;
    xev.xmotion.same_screen = 1;
-   return XSendEvent(_ecore_x_disp, win, True, PointerMotionMask, &xev) ? EINA_TRUE : EINA_FALSE;
+   ret = !!XSendEvent(_ecore_x_disp, win, True, PointerMotionMask, &xev);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   return ret;
 }
 
 EAPI Eina_Bool
@@ -1967,6 +2015,7 @@ ecore_x_mouse_down_send(Ecore_X_Window win,
    XWindowAttributes att;
    Window tw;
    int rx, ry;
+   Eina_Bool ret;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XGetWindowAttributes(_ecore_x_disp, win, &att);
@@ -1983,7 +2032,9 @@ ecore_x_mouse_down_send(Ecore_X_Window win,
    xev.xbutton.state = 1 << b;
    xev.xbutton.button = b;
    xev.xbutton.same_screen = 1;
-   return XSendEvent(_ecore_x_disp, win, True, ButtonPressMask, &xev) ? EINA_TRUE : EINA_FALSE;
+   ret = !!XSendEvent(_ecore_x_disp, win, True, ButtonPressMask, &xev);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   return ret;
 }
 
 EAPI Eina_Bool
@@ -1996,6 +2047,7 @@ ecore_x_mouse_up_send(Ecore_X_Window win,
    XWindowAttributes att;
    Window tw;
    int rx, ry;
+   Eina_Bool ret;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XGetWindowAttributes(_ecore_x_disp, win, &att);
@@ -2012,7 +2064,9 @@ ecore_x_mouse_up_send(Ecore_X_Window win,
    xev.xbutton.state = 0;
    xev.xbutton.button = b;
    xev.xbutton.same_screen = 1;
-   return XSendEvent(_ecore_x_disp, win, True, ButtonReleaseMask, &xev) ? EINA_TRUE : EINA_FALSE;
+   ret = !!XSendEvent(_ecore_x_disp, win, True, ButtonReleaseMask, &xev);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   return ret;
 }
 
 EAPI Eina_Bool
@@ -2024,6 +2078,7 @@ ecore_x_mouse_in_send(Ecore_X_Window win,
    XWindowAttributes att;
    Window tw;
    int rx, ry;
+   Eina_Bool ret;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XGetWindowAttributes(_ecore_x_disp, win, &att);
@@ -2042,7 +2097,9 @@ ecore_x_mouse_in_send(Ecore_X_Window win,
    xev.xcrossing.same_screen = 1;
    xev.xcrossing.focus = 0;
    xev.xcrossing.state = 0;
-   return XSendEvent(_ecore_x_disp, win, True, EnterWindowMask, &xev) ? EINA_TRUE : EINA_FALSE;
+   ret = !!XSendEvent(_ecore_x_disp, win, True, EnterWindowMask, &xev);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   return ret;
 }
 
 EAPI Eina_Bool
@@ -2054,6 +2111,7 @@ ecore_x_mouse_out_send(Ecore_X_Window win,
    XWindowAttributes att;
    Window tw;
    int rx, ry;
+   Eina_Bool ret;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XGetWindowAttributes(_ecore_x_disp, win, &att);
@@ -2072,7 +2130,9 @@ ecore_x_mouse_out_send(Ecore_X_Window win,
    xev.xcrossing.same_screen = 1;
    xev.xcrossing.focus = 0;
    xev.xcrossing.state = 0;
-   return XSendEvent(_ecore_x_disp, win, True, LeaveWindowMask, &xev) ? EINA_TRUE : EINA_FALSE;
+   ret = !!XSendEvent(_ecore_x_disp, win, True, LeaveWindowMask, &xev);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   return ret;
 }
 
 EAPI void
@@ -2080,6 +2140,7 @@ ecore_x_focus_reset(void)
 {
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XSetInputFocus(_ecore_x_disp, PointerRoot, RevertToPointerRoot, CurrentTime);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -2087,6 +2148,7 @@ ecore_x_events_allow_all(void)
 {
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XAllowEvents(_ecore_x_disp, AsyncBoth, CurrentTime);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -2117,6 +2179,7 @@ ecore_x_pointer_xy_get(Ecore_X_Window win,
 
    if (x) *x = wx;
    if (y) *y = wy;
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -2134,6 +2197,7 @@ ecore_x_pointer_root_xy_get(int *x, int *y)
      {
         ret = XQueryPointer(_ecore_x_disp, root[i], &rwin, &cwin,
                             &rx, &ry, &wx, &wy, &mask);
+        if (_ecore_xlib_sync) ecore_x_sync();
         if (ret) break;
      }
 
@@ -2156,7 +2220,10 @@ ecore_x_pointer_root_xy_get(int *x, int *y)
 EAPI unsigned int
 ecore_x_visual_id_get(Ecore_X_Visual visual)
 {
-   return XVisualIDFromVisual(visual);
+   unsigned int vis;
+   vis = XVisualIDFromVisual(visual);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   return vis;
 }
 
 /**
@@ -2172,7 +2239,9 @@ EAPI Ecore_X_Visual
 ecore_x_default_visual_get(Ecore_X_Display *disp,
                            Ecore_X_Screen *screen)
 {
-   return DefaultVisual(disp, ecore_x_screen_index_get(screen));
+   Ecore_X_Visual vis = DefaultVisual(disp, ecore_x_screen_index_get(screen));
+   if (_ecore_xlib_sync) ecore_x_sync();
+   return vis;
 }
 
 /**
@@ -2188,7 +2257,9 @@ EAPI Ecore_X_Colormap
 ecore_x_default_colormap_get(Ecore_X_Display *disp,
                              Ecore_X_Screen *screen)
 {
-   return DefaultColormap(disp, ecore_x_screen_index_get(screen));
+   Ecore_X_Colormap col = DefaultColormap(disp, ecore_x_screen_index_get(screen));
+   if (_ecore_xlib_sync) ecore_x_sync();
+   return col;
 }
 
 /**
@@ -2204,7 +2275,9 @@ EAPI int
 ecore_x_default_depth_get(Ecore_X_Display *disp,
                           Ecore_X_Screen *screen)
 {
-   return DefaultDepth(disp, ecore_x_screen_index_get(screen));
+   int depth = DefaultDepth(disp, ecore_x_screen_index_get(screen));
+   if (_ecore_xlib_sync) ecore_x_sync();
+   return depth;
 }
 
 EAPI void
@@ -2212,6 +2285,7 @@ ecore_x_xkb_select_group(int group)
 {
 #ifdef ECORE_XKB
    XkbLockGroup(_ecore_x_disp, XkbUseCoreKbd, group);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #endif
 }
 
index 93cd9eb..6533f15 100644 (file)
@@ -44,11 +44,14 @@ _ecore_x_atoms_init(void)
 EAPI Ecore_X_Atom
 ecore_x_atom_get(const char *name)
 {
+   Ecore_X_Atom atom;
    if (!_ecore_x_disp)
      return 0;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
-   return XInternAtom(_ecore_x_disp, name, False);
+   atom = XInternAtom(_ecore_x_disp, name, False);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   return atom;
 }
 
 EAPI void
@@ -67,6 +70,7 @@ ecore_x_atoms_get(const char **names,
    XInternAtoms(_ecore_x_disp, (char **)names, num, False, atoms_int);
    for (i = 0; i < num; i++)
      atoms[i] = atoms_int[i];
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI char *
@@ -81,6 +85,7 @@ ecore_x_atom_name_get(Ecore_X_Atom atom)
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
 
    xname = XGetAtomName(_ecore_x_disp, atom);
+   if (_ecore_xlib_sync) ecore_x_sync();
    if (!xname)
      return NULL;
 
index b919db9..913839f 100644 (file)
@@ -17,12 +17,15 @@ _ecore_x_composite_init(void)
 
    if (XCompositeQueryVersion(_ecore_x_disp, &major, &minor))
      {
+        if (_ecore_xlib_sync) ecore_x_sync();
 # ifdef ECORE_XRENDER
         if (XRenderQueryExtension(_ecore_x_disp, &major, &minor))
           {
+             if (_ecore_xlib_sync) ecore_x_sync();
 #  ifdef ECORE_XFIXES
              if (XFixesQueryVersion(_ecore_x_disp, &major, &minor))
                {
+                  if (_ecore_xlib_sync) ecore_x_sync();
                   _composite_available = EINA_TRUE;
                }
 #  endif
@@ -58,6 +61,7 @@ ecore_x_composite_redirect_window(Ecore_X_Window win,
         break;
      }
    XCompositeRedirectWindow(_ecore_x_disp, win, update);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #endif /* ifdef ECORE_XCOMPOSITE */
 }
 
@@ -80,6 +84,7 @@ ecore_x_composite_redirect_subwindows(Ecore_X_Window win,
         break;
      }
    XCompositeRedirectSubwindows(_ecore_x_disp, win, update);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #endif /* ifdef ECORE_XCOMPOSITE */
 }
 
@@ -102,6 +107,7 @@ ecore_x_composite_unredirect_window(Ecore_X_Window win,
         break;
      }
    XCompositeUnredirectWindow(_ecore_x_disp, win, update);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #endif /* ifdef ECORE_XCOMPOSITE */
 }
 
@@ -124,6 +130,7 @@ ecore_x_composite_unredirect_subwindows(Ecore_X_Window win,
         break;
      }
    XCompositeUnredirectSubwindows(_ecore_x_disp, win, update);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #endif /* ifdef ECORE_XCOMPOSITE */
 }
 
@@ -134,6 +141,7 @@ ecore_x_composite_name_window_pixmap_get(Ecore_X_Window win)
 #ifdef ECORE_XCOMPOSITE
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    pixmap = XCompositeNameWindowPixmap(_ecore_x_disp, win);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #endif /* ifdef ECORE_XCOMPOSITE */
    return pixmap;
 }
@@ -143,6 +151,7 @@ ecore_x_composite_window_events_disable(Ecore_X_Window win)
 {
 #ifdef ECORE_XCOMPOSITE
    ecore_x_window_shape_input_rectangle_set(win, -1, -1, 1, 1);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #endif /* ifdef ECORE_XCOMPOSITE */
 }
 
@@ -151,6 +160,7 @@ ecore_x_composite_window_events_enable(Ecore_X_Window win)
 {
 #ifdef ECORE_XCOMPOSITE
    ecore_x_window_shape_input_rectangle_set(win, 0, 0, 65535, 65535);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #endif /* ifdef ECORE_XCOMPOSITE */
 }
 
@@ -160,6 +170,7 @@ ecore_x_composite_render_window_enable(Ecore_X_Window root)
    Ecore_X_Window win = 0;
 #ifdef ECORE_XCOMPOSITE
    win = XCompositeGetOverlayWindow(_ecore_x_disp, root);
+   if (_ecore_xlib_sync) ecore_x_sync();
    ecore_x_composite_window_events_disable(win);
 #endif /* ifdef ECORE_XCOMPOSITE */
    return win;
@@ -171,6 +182,7 @@ ecore_x_composite_render_window_disable(Ecore_X_Window root)
 #ifdef ECORE_XCOMPOSITE
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XCompositeReleaseOverlayWindow(_ecore_x_disp, root);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #endif /* ifdef ECORE_XCOMPOSITE */
 }
 
index a968c56..22f2789 100644 (file)
@@ -28,6 +28,7 @@ ecore_x_cursor_new(Ecore_X_Window win,
         XcursorImage *xci;
 
         xci = XcursorImageCreate(w, h);
+        if (_ecore_xlib_sync) ecore_x_sync();
         if (xci)
           {
              int i;
@@ -47,6 +48,7 @@ ecore_x_cursor_new(Ecore_X_Window win,
 //                 (a << 24) | (r << 16) | (g << 8) | (b);
                }
              c = XcursorImageLoadCursor(_ecore_x_disp, xci);
+             if (_ecore_xlib_sync) ecore_x_sync();
              XcursorImageDestroy(xci);
              return c;
           }
@@ -72,10 +74,13 @@ ecore_x_cursor_new(Ecore_X_Window win,
       };
 
       pmap = XCreatePixmap(_ecore_x_disp, win, w, h, 1);
+      if (_ecore_xlib_sync) ecore_x_sync();
       mask = XCreatePixmap(_ecore_x_disp, win, w, h, 1);
+      if (_ecore_xlib_sync) ecore_x_sync();
       xim = XCreateImage(_ecore_x_disp,
                          DefaultVisual(_ecore_x_disp, 0),
                          1, ZPixmap, 0, NULL, w, h, 32, 0);
+      if (_ecore_xlib_sync) ecore_x_sync();
       xim->data = malloc(xim->bytes_per_line * xim->height);
 
       fr = 0x00; fg = 0x00; fb = 0x00;
@@ -146,11 +151,14 @@ ecore_x_cursor_new(Ecore_X_Window win,
                   v = 0;
 
                 XPutPixel(xim, x, y, v);
+                if (_ecore_xlib_sync) ecore_x_sync();
                 pix++;
              }
         }
       gc = XCreateGC(_ecore_x_disp, pmap, 0, &gcv);
+      if (_ecore_xlib_sync) ecore_x_sync();
       XPutImage(_ecore_x_disp, pmap, gc, xim, 0, 0, 0, 0, w, h);
+      if (_ecore_xlib_sync) ecore_x_sync();
       XFreeGC(_ecore_x_disp, gc);
 
       pix = (unsigned int *)pixels;
@@ -171,7 +179,9 @@ ecore_x_cursor_new(Ecore_X_Window win,
              }
         }
       gc = XCreateGC(_ecore_x_disp, mask, 0, &gcv);
+      if (_ecore_xlib_sync) ecore_x_sync();
       XPutImage(_ecore_x_disp, mask, gc, xim, 0, 0, 0, 0, w, h);
+      if (_ecore_xlib_sync) ecore_x_sync();
       XFreeGC(_ecore_x_disp, gc);
 
       free(xim->data);
@@ -194,6 +204,7 @@ ecore_x_cursor_new(Ecore_X_Window win,
                               pmap, mask,
                               &c1, &c2,
                               hot_x, hot_y);
+      if (_ecore_xlib_sync) ecore_x_sync();
       XFreePixmap(_ecore_x_disp, pmap);
       XFreePixmap(_ecore_x_disp, mask);
       return c;
@@ -207,6 +218,7 @@ ecore_x_cursor_free(Ecore_X_Cursor c)
 {
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XFreeCursor(_ecore_x_disp, c);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /*
@@ -217,9 +229,12 @@ ecore_x_cursor_free(Ecore_X_Cursor c)
 EAPI Ecore_X_Cursor
 ecore_x_cursor_shape_get(int shape)
 {
+   Ecore_X_Cursor cur;
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    /* Shapes are defined in Ecore_X_Cursor.h */
-   return XCreateFontCursor(_ecore_x_disp, shape);
+   cur = XCreateFontCursor(_ecore_x_disp, shape);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   return cur;
 }
 
 EAPI void
@@ -228,6 +243,7 @@ ecore_x_cursor_size_set(int size)
 #ifdef ECORE_XCURSOR
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XcursorSetDefaultSize(_ecore_x_disp, size);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #else /* ifdef ECORE_XCURSOR */
    size = 0;
 #endif /* ifdef ECORE_XCURSOR */
index b094f85..1134fae 100644 (file)
@@ -43,6 +43,7 @@ ecore_x_damage_new(Ecore_X_Drawable d,
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    damage = XDamageCreate(_ecore_x_disp, d, level);
+   if (_ecore_xlib_sync) ecore_x_sync();
    return damage;
 #else /* ifdef ECORE_XDAMAGE */
    return 0;
@@ -66,6 +67,7 @@ ecore_x_damage_subtract(Ecore_X_Damage damage,
 #ifdef ECORE_XDAMAGE
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XDamageSubtract(_ecore_x_disp, damage, repair, parts);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #endif /* ifdef ECORE_XDAMAGE */
 }
 
index f31f09d..5a9c166 100644 (file)
@@ -113,6 +113,7 @@ _ecore_x_dnd_converter_copy(char *target EINA_UNUSED,
                                  &text_prop) == Success)
      {
         int bufsize = strlen((char *)text_prop.value) + 1;
+        if (_ecore_xlib_sync) ecore_x_sync();
         *data_ret = malloc(bufsize);
         if (!*data_ret)
           {
@@ -127,6 +128,7 @@ _ecore_x_dnd_converter_copy(char *target EINA_UNUSED,
      }
    else
      {
+        if (_ecore_xlib_sync) ecore_x_sync();
         free(mystr);
         return EINA_FALSE;
      }
@@ -472,6 +474,7 @@ _ecore_x_dnd_drop(Eina_Bool self)
              xev.xclient.data.l[1] = 0;
              xev.xclient.data.l[2] = _source->time;
              XSendEvent(_ecore_x_disp, _source->dest, False, 0, &xev);
+             if (_ecore_xlib_sync) ecore_x_sync();
              _source->state = ECORE_X_DND_SOURCE_DROPPED;
              status = EINA_TRUE;
           }
@@ -481,6 +484,7 @@ _ecore_x_dnd_drop(Eina_Bool self)
              xev.xclient.data.l[0] = _source->win;
              xev.xclient.data.l[1] = 0;
              XSendEvent(_ecore_x_disp, _source->dest, False, 0, &xev);
+             if (_ecore_xlib_sync) ecore_x_sync();
              _source->state = ECORE_X_DND_SOURCE_IDLE;
           }
      }
@@ -576,6 +580,7 @@ ecore_x_dnd_send_status(Eina_Bool will_accept,
      }
 
    XSendEvent(_ecore_x_disp, _target->source, False, 0, &xev);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -603,6 +608,7 @@ ecore_x_dnd_send_finished(void)
      }
 
    XSendEvent(_ecore_x_disp, _target->source, False, 0, &xev);
+   if (_ecore_xlib_sync) ecore_x_sync();
 
    _target->state = ECORE_X_DND_TARGET_IDLE;
 }
@@ -663,6 +669,7 @@ _ecore_x_dnd_drag(Ecore_X_Window root,
         xev.xclient.data.l[1] = 0;
 
         XSendEvent(_ecore_x_disp, _source->dest, False, 0, &xev);
+        if (_ecore_xlib_sync) ecore_x_sync();
         _source->suppress = 0;
      }
 
@@ -704,6 +711,7 @@ _ecore_x_dnd_drag(Ecore_X_Window root,
                xev.xclient.data.l[i + 2] = types[i];
              XFree(data);
              XSendEvent(_ecore_x_disp, win, False, 0, &xev);
+             if (_ecore_xlib_sync) ecore_x_sync();
              _source->await_status = 0;
              _source->will_accept = 0;
           }
@@ -726,6 +734,7 @@ _ecore_x_dnd_drag(Ecore_X_Window root,
              xev.xclient.data.l[3] = _source->time; /* Version 1 */
              xev.xclient.data.l[4] = _source->action; /* Version 2, Needs to be pre-set */
              XSendEvent(_ecore_x_disp, win, False, 0, &xev);
+             if (_ecore_xlib_sync) ecore_x_sync();
 
              _source->await_status = 1;
           }
index 81815c4..1742c5b 100644 (file)
@@ -52,6 +52,7 @@ ecore_x_drawable_geometry_get(Ecore_X_Drawable d,
 
    if (h)
      *h = (int)ret_h;
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /**
@@ -71,7 +72,7 @@ ecore_x_drawable_border_width_get(Ecore_X_Drawable d)
    if (!XGetGeometry(_ecore_x_disp, d, &dummy_win, &dummy_x, &dummy_y,
                      &dummy_w, &dummy_h, &border_ret, &dummy_depth))
      border_ret = 0;
-
+   if (_ecore_xlib_sync) ecore_x_sync();
    return (int)border_ret;
 }
 
@@ -92,7 +93,7 @@ ecore_x_drawable_depth_get(Ecore_X_Drawable d)
    if (!XGetGeometry(_ecore_x_disp, d, &dummy_win, &dummy_x, &dummy_y,
                      &dummy_w, &dummy_h, &dummy_border, &depth_ret))
      depth_ret = 0;
-
+   if (_ecore_xlib_sync) ecore_x_sync();
    return (int)depth_ret;
 }
 
@@ -115,5 +116,6 @@ ecore_x_drawable_rectangle_fill(Ecore_X_Drawable d,
 {
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XFillRectangle(_ecore_x_disp, d, gc, x, y, width, height);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
index aa6764d..87e8d2f 100644 (file)
@@ -1089,6 +1089,7 @@ ecore_x_e_comp_sync_draw_done_send(Ecore_X_Window root,
    XSendEvent(_ecore_x_disp, root, False,
               SubstructureRedirectMask | SubstructureNotifyMask,
               &xev);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -1117,6 +1118,7 @@ ecore_x_e_comp_sync_draw_size_done_send(Ecore_X_Window root,
    XSendEvent(_ecore_x_disp, root, False,
               SubstructureRedirectMask | SubstructureNotifyMask,
               &xev);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /*
@@ -1440,6 +1442,7 @@ ecore_x_e_window_profile_change_send(Ecore_X_Window  root,
    XSendEvent(_ecore_x_disp, root, False,
               SubstructureRedirectMask | SubstructureNotifyMask,
               &xev);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -1467,6 +1470,7 @@ ecore_x_e_window_profile_change_request_send(Ecore_X_Window win,
    xev.xclient.data.l[4] = 0; // later
 
    XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 
@@ -1498,6 +1502,7 @@ ecore_x_e_window_profile_change_done_send(Ecore_X_Window root,
    XSendEvent(_ecore_x_disp, root, False,
               SubstructureRedirectMask | SubstructureNotifyMask,
               &xev);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -1586,6 +1591,7 @@ ecore_x_e_comp_sync_begin_send(Ecore_X_Window win)
    XSendEvent(_ecore_x_disp, win, False,
               NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask,
               &xev);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -1608,6 +1614,7 @@ ecore_x_e_comp_sync_end_send(Ecore_X_Window win)
    XSendEvent(_ecore_x_disp, win, False,
               NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask,
               &xev);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -1630,6 +1637,7 @@ ecore_x_e_comp_sync_cancel_send(Ecore_X_Window win)
    XSendEvent(_ecore_x_disp, win, False,
               NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask,
               &xev);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -1652,6 +1660,7 @@ ecore_x_e_comp_flush_send(Ecore_X_Window win)
    XSendEvent(_ecore_x_disp, win, False,
               NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask,
               &xev);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -1674,6 +1683,7 @@ ecore_x_e_comp_dump_send(Ecore_X_Window win)
    XSendEvent(_ecore_x_disp, win, False,
               NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask,
               &xev);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
index 1d47442..f44f64f 100644 (file)
@@ -115,8 +115,10 @@ ecore_x_event_mask_set(Ecore_X_Window w,
 
    memset(&attr, 0, sizeof(XWindowAttributes));
    XGetWindowAttributes(_ecore_x_disp, w, &attr);
+   if (_ecore_xlib_sync) ecore_x_sync();
    s_attr.event_mask = mask | attr.your_event_mask;
    XChangeWindowAttributes(_ecore_x_disp, w, CWEventMask, &s_attr);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -132,8 +134,10 @@ ecore_x_event_mask_unset(Ecore_X_Window w,
 
    memset(&attr, 0, sizeof(XWindowAttributes));
    XGetWindowAttributes(_ecore_x_disp, w, &attr);
+   if (_ecore_xlib_sync) ecore_x_sync();
    s_attr.event_mask = attr.your_event_mask & ~mask;
    XChangeWindowAttributes(_ecore_x_disp, w, CWEventMask, &s_attr);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 static void
@@ -1889,6 +1893,7 @@ _ecore_x_event_handle_client_message(XEvent *xevent)
              XSendEvent(_ecore_x_disp, root, False,
                         SubstructureRedirectMask | SubstructureNotifyMask,
                         xevent);
+             if (_ecore_xlib_sync) ecore_x_sync();
           }
      }
    else if ((xevent->xclient.message_type ==
index da0a6c3..b647a90 100644 (file)
@@ -130,6 +130,7 @@ ecore_x_region_new_from_bitmap(Ecore_X_Pixmap bitmap)
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    region = XFixesCreateRegionFromBitmap(_ecore_x_disp, bitmap);
+   if (_ecore_xlib_sync) ecore_x_sync();
    return region;
 #else /* ifdef ECORE_XFIXES */
    return 0;
@@ -145,6 +146,7 @@ ecore_x_region_new_from_window(Ecore_X_Window win,
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    region = XFixesCreateRegionFromWindow(_ecore_x_disp, win, type);
+   if (_ecore_xlib_sync) ecore_x_sync();
    return region;
 #else /* ifdef ECORE_XFIXES */
    return 0;
@@ -159,6 +161,7 @@ ecore_x_region_new_from_gc(Ecore_X_GC gc)
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    region = XFixesCreateRegionFromGC(_ecore_x_disp, gc);
+   if (_ecore_xlib_sync) ecore_x_sync();
    return region;
 #else /* ifdef ECORE_XFIXES */
    return 0;
@@ -173,6 +176,7 @@ ecore_x_region_new_from_picture(Ecore_X_Picture picture)
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    region = XFixesCreateRegionFromPicture(_ecore_x_disp, picture);
+   if (_ecore_xlib_sync) ecore_x_sync();
    return region;
 #else /* ifdef ECORE_XFIXES */
    return 0;
@@ -197,6 +201,7 @@ ecore_x_region_set(Ecore_X_Region region,
    XRectangle *xrect = _ecore_x_rectangle_ecore_to_x(rects, num);
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XFixesSetRegion(_ecore_x_disp, region, xrect, num);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #endif /* ifdef ECORE_XFIXES */
 }
 
@@ -207,6 +212,7 @@ ecore_x_region_copy(Ecore_X_Region dest,
 #ifdef ECORE_XFIXES
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XFixesCopyRegion(_ecore_x_disp, dest, source);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #endif /* ifdef ECORE_XFIXES */
 }
 
@@ -218,6 +224,7 @@ ecore_x_region_combine(Ecore_X_Region dest,
 #ifdef ECORE_XFIXES
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XFixesUnionRegion(_ecore_x_disp, dest, source1, source2);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #endif /* ifdef ECORE_XFIXES */
 }
 
@@ -229,6 +236,7 @@ ecore_x_region_intersect(Ecore_X_Region dest,
 #ifdef ECORE_XFIXES
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XFixesIntersectRegion(_ecore_x_disp, dest, source1, source2);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #endif /* ifdef ECORE_XFIXES */
 }
 
@@ -240,6 +248,7 @@ ecore_x_region_subtract(Ecore_X_Region dest,
 #ifdef ECORE_XFIXES
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XFixesSubtractRegion(_ecore_x_disp, dest, source1, source2);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #endif /* ifdef ECORE_XFIXES */
 }
 
@@ -258,6 +267,7 @@ ecore_x_region_invert(Ecore_X_Region dest,
    xbound = _ecore_x_rectangle_ecore_to_x(bounds, num);
 
    XFixesInvertRegion(_ecore_x_disp, dest, xbound, source);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #endif /* ifdef ECORE_XFIXES */
 }
 
@@ -269,6 +279,7 @@ ecore_x_region_translate(Ecore_X_Region region,
 #ifdef ECORE_XFIXES
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XFixesTranslateRegion(_ecore_x_disp, region, dx, dy);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #endif /* ifdef ECORE_XFIXES */
 }
 
@@ -279,6 +290,7 @@ ecore_x_region_extents(Ecore_X_Region dest,
 #ifdef ECORE_XFIXES
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XFixesRegionExtents(_ecore_x_disp, dest, source);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #endif /* ifdef ECORE_XFIXES */
 }
 
@@ -292,6 +304,7 @@ ecore_x_region_fetch(Ecore_X_Region region,
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    xrect = XFixesFetchRegionAndBounds(_ecore_x_disp, region, num, &xbound);
+   if (_ecore_xlib_sync) ecore_x_sync();
    rects = _ecore_x_rectangle_x_to_ecore(xrect, *num);
    (*bounds).x = xbound.x;
    (*bounds).y = xbound.y;
@@ -314,6 +327,7 @@ ecore_x_region_expand(Ecore_X_Region dest,
 #ifdef ECORE_XFIXES
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XFixesExpandRegion(_ecore_x_disp, dest, source, left, right, top, bottom);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #endif /* ifdef ECORE_XFIXES */
 }
 
@@ -326,6 +340,7 @@ ecore_x_region_gc_clip_set(Ecore_X_Region region,
 #ifdef ECORE_XFIXES
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XFixesSetGCClipRegion(_ecore_x_disp, gc, x_origin, y_origin, region);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #endif /* ifdef ECORE_XFIXES */
 }
 
@@ -344,6 +359,7 @@ ecore_x_region_window_shape_set(Ecore_X_Region region,
                               x_offset,
                               y_offset,
                               region);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #endif /* ifdef ECORE_XFIXES */
 }
 
@@ -360,6 +376,7 @@ ecore_x_region_picture_clip_set(Ecore_X_Region region,
                               x_origin,
                               y_origin,
                               region);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #endif /* ifdef ECORE_XFIXES */
 }
 
index 5396366..6b8168b 100644 (file)
@@ -23,6 +23,7 @@ ecore_x_gc_new(Ecore_X_Drawable draw,
                Ecore_X_GC_Value_Mask value_mask,
                const unsigned int *value_list)
 {
+   Ecore_X_GC gc;
    XGCValues gcv;
    int mask;
    int idx;
@@ -155,7 +156,9 @@ ecore_x_gc_new(Ecore_X_Drawable draw,
           }
      }
 
-   return XCreateGC(_ecore_x_disp, draw, value_mask, &gcv);
+   gc = XCreateGC(_ecore_x_disp, draw, value_mask, &gcv);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   return gc;
 }
 
 /**
@@ -167,5 +170,6 @@ ecore_x_gc_free(Ecore_X_GC gc)
 {
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XFreeGC(_ecore_x_disp, gc);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
index dbde8b0..a8b2b72 100644 (file)
@@ -53,6 +53,7 @@ ecore_x_gesture_events_select(Ecore_X_Window win,
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XGestureSelectEvents(_ecore_x_disp, win, mask);
+   if (_ecore_xlib_sync) ecore_x_sync();
 
    return EINA_TRUE;
 #else /* ifdef ECORE_XGESTURE */
@@ -73,10 +74,8 @@ ecore_x_gesture_events_selected_get(Ecore_X_Window win)
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    if (GestureSuccess != XGestureGetSelectedEvents(_ecore_x_disp, win, &mask))
-     {
-        mask = ECORE_X_GESTURE_EVENT_MASK_NONE;
-        return mask;
-     }
+     mask = ECORE_X_GESTURE_EVENT_MASK_NONE;
+   if (_ecore_xlib_sync) ecore_x_sync();
 
    return mask;
 #else /* ifdef ECORE_XGESTURE */
@@ -91,16 +90,14 @@ ecore_x_gesture_event_grab(Ecore_X_Window win,
                            int num_fingers)
 {
 #ifdef ECORE_XGESTURE
+   Eina_Bool ret;
    if (!_gesture_available)
      return EINA_FALSE;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
-   if (GestureGrabSuccess != XGestureGrabEvent(_ecore_x_disp, win, type, num_fingers, CurrentTime))
-     {
-        return EINA_FALSE;
-     }
-
-   return EINA_TRUE;
+   ret = (GestureGrabSuccess == XGestureGrabEvent(_ecore_x_disp, win, type, num_fingers, CurrentTime));
+   if (_ecore_xlib_sync) ecore_x_sync();
+   return ret;
 #else /* ifdef ECORE_XGESTURE */
    (void) win;
    (void) type;
@@ -116,17 +113,15 @@ ecore_x_gesture_event_ungrab(Ecore_X_Window win,
 {
 #ifdef ECORE_XGESTURE
    Ecore_X_Gesture_Event_Mask mask;
+   Eina_Bool ret;
 
    if (!_gesture_available)
      return EINA_FALSE;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
-   if (GestureUngrabSuccess != XGestureUngrabEvent(_ecore_x_disp, win, type, num_fingers, CurrentTime))
-     {
-        return EINA_FALSE;
-     }
-
-   return EINA_TRUE;
+   ret = (GestureUngrabSuccess == XGestureUngrabEvent(_ecore_x_disp, win, type, num_fingers, CurrentTime));
+   if (_ecore_xlib_sync) ecore_x_sync();
+   return ret;
 #else /* ifdef ECORE_XGESTURE */
    (void) win;
    (void) type;
index e8d34e5..3ca73fb 100644 (file)
@@ -41,6 +41,7 @@ ecore_x_icccm_state_set(Ecore_X_Window win,
    XChangeProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_STATE,
                    ECORE_X_ATOM_WM_STATE, 32, PropModeReplace,
                    (unsigned char *)c, 2);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI Ecore_X_Window_State_Hint
@@ -58,6 +59,7 @@ ecore_x_icccm_state_get(Ecore_X_Window win)
                       0, 0x7fffffff, False, ECORE_X_ATOM_WM_STATE,
                       &type_ret, &format_ret, &num_ret, &bytes_after,
                       &prop_ret);
+   if (_ecore_xlib_sync) ecore_x_sync();
    if ((prop_ret) && (num_ret == 2))
      {
         if (prop_ret[0] == WithdrawnState)
@@ -129,6 +131,7 @@ ecore_x_icccm_move_resize_send(Ecore_X_Window win,
    ev.xconfigure.above = None;
    ev.xconfigure.override_redirect = False;
    XSendEvent(_ecore_x_disp, win, False, StructureNotifyMask, &ev);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -185,6 +188,7 @@ ecore_x_icccm_hints_set(Ecore_X_Window win,
      hints->flags |= XUrgencyHint;
 
    XSetWMHints(_ecore_x_disp, win, hints);
+   if (_ecore_xlib_sync) ecore_x_sync();
    XFree(hints);
 }
 
@@ -223,6 +227,7 @@ ecore_x_icccm_hints_get(Ecore_X_Window win,
      *is_urgent = EINA_FALSE;
 
    hints = XGetWMHints(_ecore_x_disp, win);
+   if (_ecore_xlib_sync) ecore_x_sync();
    if (hints)
      {
         if ((hints->flags & InputHint) && (accepts_focus))
@@ -286,6 +291,7 @@ ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win,
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    if (!XGetWMNormalHints(_ecore_x_disp, win, &hint, &mask))
      memset(&hint, 0, sizeof(XSizeHints));
+   if (_ecore_xlib_sync) ecore_x_sync();
 
    hint.flags = 0;
    if (request_pos)
@@ -335,6 +341,7 @@ ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win,
      }
 
    XSetWMNormalHints(_ecore_x_disp, win, &hint);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI Eina_Bool
@@ -363,7 +370,10 @@ ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    if (!XGetWMNormalHints(_ecore_x_disp, win, &hint, &mask))
-     return EINA_FALSE;
+     {
+        if (_ecore_xlib_sync) ecore_x_sync();
+        return EINA_FALSE;
+     }
 
    if ((hint.flags & USPosition) || ((hint.flags & PPosition)))
      {
@@ -486,15 +496,18 @@ ecore_x_icccm_title_set(Ecore_X_Window win,
      XmbTextListToTextProperty(_ecore_x_disp, list, 1, XStdICCTextStyle,
                                &xprop);
 #endif /* ifdef X_HAVE_UTF8_STRING */
+   if (_ecore_xlib_sync) ecore_x_sync();
    if (ret >= Success)
      {
         XSetWMName(_ecore_x_disp, win, &xprop);
+        if (_ecore_xlib_sync) ecore_x_sync();
         if (xprop.value)
           XFree(xprop.value);
      }
    else if (XStringListToTextProperty(list, 1, &xprop) >= Success)
      {
         XSetWMName(_ecore_x_disp, win, &xprop);
+        if (_ecore_xlib_sync) ecore_x_sync();
         if (xprop.value)
           XFree(xprop.value);
      }
@@ -511,6 +524,7 @@ ecore_x_icccm_title_get(Ecore_X_Window win)
    xprop.value = NULL;
    if (XGetWMName(_ecore_x_disp, win, &xprop) >= Success)
      {
+        if (_ecore_xlib_sync) ecore_x_sync();
         if (xprop.value)
           {
              char **list = NULL;
@@ -530,6 +544,7 @@ ecore_x_icccm_title_get(Ecore_X_Window win)
                   ret = XmbTextPropertyToTextList(_ecore_x_disp, &xprop,
                                                   &list, &num);
 #endif /* ifdef X_HAVE_UTF8_STRING */
+                  if (_ecore_xlib_sync) ecore_x_sync();
 
                   if ((ret == XLocaleNotSupported) ||
                       (ret == XNoMemory) || (ret == XConverterNotFound))
@@ -547,6 +562,10 @@ ecore_x_icccm_title_get(Ecore_X_Window win)
              return t;
           }
      }
+   else
+     {
+        if (_ecore_xlib_sync) ecore_x_sync();
+     }
 
    return NULL;
 }
@@ -567,6 +586,7 @@ ecore_x_icccm_protocol_atoms_set(Ecore_X_Window win,
      XSetWMProtocols(_ecore_x_disp, win, (Atom *)(protos), num);
    else
      XDeleteProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_PROTOCOLS);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /**
@@ -598,7 +618,7 @@ ecore_x_icccm_protocol_set(Ecore_X_Window win,
         protos = NULL;
         protos_count = 0;
      }
-
+   if (_ecore_xlib_sync) ecore_x_sync();
    for (i = 0; i < protos_count; i++)
      {
         if (protos[i] == proto)
@@ -623,6 +643,7 @@ ecore_x_icccm_protocol_set(Ecore_X_Window win,
           new_protos[i] = protos[i];
         new_protos[protos_count] = proto;
         XSetWMProtocols(_ecore_x_disp, win, new_protos, protos_count + 1);
+        if (_ecore_xlib_sync) ecore_x_sync();
         free(new_protos);
      }
    else
@@ -644,6 +665,7 @@ ecore_x_icccm_protocol_set(Ecore_X_Window win,
                   else
                     XDeleteProperty(_ecore_x_disp, win,
                                     ECORE_X_ATOM_WM_PROTOCOLS);
+                  if (_ecore_xlib_sync) ecore_x_sync();
 
                   goto leave;
                }
@@ -678,6 +700,7 @@ ecore_x_icccm_protocol_isset(Ecore_X_Window win,
 
    if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count))
      return EINA_FALSE;
+   if (_ecore_xlib_sync) ecore_x_sync();
 
    for (i = 0; i < protos_count; i++)
      if (protos[i] == proto)
@@ -715,6 +738,7 @@ ecore_x_icccm_name_class_set(Ecore_X_Window win,
    xch->res_name = (char *)n;
    xch->res_class = (char *)c;
    XSetClassHint(_ecore_x_disp, win, xch);
+   if (_ecore_xlib_sync) ecore_x_sync();
    XFree(xch);
 }
 
@@ -755,6 +779,7 @@ ecore_x_icccm_name_class_get(Ecore_X_Window win,
         XFree(xch.res_name);
         XFree(xch.res_class);
      }
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /**
@@ -788,6 +813,7 @@ ecore_x_icccm_command_set(Ecore_X_Window win,
 {
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XSetCommand(_ecore_x_disp, win, argv, argc);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /**
@@ -806,6 +832,7 @@ ecore_x_icccm_command_get(Ecore_X_Window win,
 {
    int i, c;
    char **v;
+   Eina_Bool success;
 
    if (argc)
      *argc = 0;
@@ -814,8 +841,9 @@ ecore_x_icccm_command_get(Ecore_X_Window win,
      *argv = NULL;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
-   if (!XGetCommand(_ecore_x_disp, win, &v, &c))
-     return;
+   success = XGetCommand(_ecore_x_disp, win, &v, &c);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   if (!success) return;
 
    if (c < 1)
      {
@@ -878,15 +906,18 @@ ecore_x_icccm_icon_name_set(Ecore_X_Window win,
    ret = XmbTextListToTextProperty(_ecore_x_disp, list, 1,
                                    XStdICCTextStyle, &xprop);
 #endif /* ifdef X_HAVE_UTF8_STRING */
+   if (_ecore_xlib_sync) ecore_x_sync();
    if (ret >= Success)
      {
         XSetWMIconName(_ecore_x_disp, win, &xprop);
+        if (_ecore_xlib_sync) ecore_x_sync();
         if (xprop.value)
           XFree(xprop.value);
      }
    else if (XStringListToTextProperty(list, 1, &xprop) >= Success)
      {
         XSetWMIconName(_ecore_x_disp, win, &xprop);
+        if (_ecore_xlib_sync) ecore_x_sync();
         if (xprop.value)
           XFree(xprop.value);
      }
@@ -910,6 +941,7 @@ ecore_x_icccm_icon_name_get(Ecore_X_Window win)
    xprop.value = NULL;
    if (XGetWMIconName(_ecore_x_disp, win, &xprop) >= Success)
      {
+        if (_ecore_xlib_sync) ecore_x_sync();
         if (xprop.value)
           {
              char **list = NULL;
@@ -929,6 +961,7 @@ ecore_x_icccm_icon_name_get(Ecore_X_Window win)
                   ret = XmbTextPropertyToTextList(_ecore_x_disp, &xprop,
                                                   &list, &num);
 #endif /* ifdef X_HAVE_UTF8_STRING */
+                  if (_ecore_xlib_sync) ecore_x_sync();
 
                   if ((ret == XLocaleNotSupported) ||
                       (ret == XNoMemory) || (ret == XConverterNotFound))
@@ -949,6 +982,10 @@ ecore_x_icccm_icon_name_get(Ecore_X_Window win)
              return t;
           }
      }
+   else
+     {
+        if (_ecore_xlib_sync) ecore_x_sync();
+     }
 
    return NULL;
 }
@@ -1056,6 +1093,7 @@ ecore_x_icccm_colormap_window_unset(Ecore_X_Window win,
                {
                   XDeleteProperty(_ecore_x_disp,
                                   win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS);
+                  if (_ecore_xlib_sync) ecore_x_sync();
                   if (old_data)
                     XFree(old_data);
 
@@ -1102,6 +1140,7 @@ ecore_x_icccm_transient_for_set(Ecore_X_Window win,
 {
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XSetTransientForHint(_ecore_x_disp, win, forwin);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /**
@@ -1113,6 +1152,7 @@ ecore_x_icccm_transient_for_unset(Ecore_X_Window win)
 {
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XDeleteProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_TRANSIENT_FOR);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /**
@@ -1124,9 +1164,12 @@ EAPI Ecore_X_Window
 ecore_x_icccm_transient_for_get(Ecore_X_Window win)
 {
    Window forwin;
+   Eina_Bool success;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
-   if (XGetTransientForHint(_ecore_x_disp, win, &forwin))
+   success = XGetTransientForHint(_ecore_x_disp, win, &forwin);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   if (success)
      return (Ecore_X_Window)forwin;
    else
      return 0;
@@ -1216,6 +1259,7 @@ ecore_x_icccm_iconic_request_send(Ecore_X_Window win,
 
    XSendEvent(_ecore_x_disp, root, False,
               SubstructureNotifyMask | SubstructureRedirectMask, &xev);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /* FIXME: there are older E hints, gnome hints and mwm hints and new netwm */
index af7417e..a408f16 100644 (file)
@@ -106,6 +106,7 @@ _ecore_x_image_shm_check(void)
                                       DefaultScreen(_ecore_x_disp)),
                          ZPixmap, NULL,
                          &shminfo, 1, 1);
+   if (_ecore_xlib_sync) ecore_x_sync();
    if (!xim)
      {
         _ecore_x_image_shm_can = 0;
@@ -370,11 +371,15 @@ ecore_x_image_put(Ecore_X_Image *im,
         memset(&gcv, 0, sizeof(gcv));
         gcv.subwindow_mode = IncludeInferiors;
         tgc = XCreateGC(_ecore_x_disp, draw, GCSubwindowMode, &gcv);
+        if (_ecore_xlib_sync) ecore_x_sync();
         gc = tgc;
      }
    if (!im->xim) _ecore_x_image_shm_create(im);
    if (im->xim)
-     XShmPutImage(_ecore_x_disp, draw, gc, im->xim, sx, sy, x, y, w, h, False);
+     {
+        XShmPutImage(_ecore_x_disp, draw, gc, im->xim, sx, sy, x, y, w, h, False);
+        if (_ecore_xlib_sync) ecore_x_sync();
+     }
    if (tgc) ecore_x_gc_free(tgc);
 }
 
index 40741a1..b15832d 100644 (file)
@@ -214,6 +214,7 @@ ecore_x_netwm_desk_names_set(Ecore_X_Window root,
      }
 
    _ATOM_SET_UTF8_STRING_LIST(root, ECORE_X_ATOM_NET_DESKTOP_NAMES, buf, len);
+   if (_ecore_xlib_sync) ecore_x_sync();
 
    free(buf);
 }
@@ -370,6 +371,7 @@ ecore_x_netwm_client_active_request(Ecore_X_Window root,
 
    XSendEvent(_ecore_x_disp, root, False,
               SubstructureRedirectMask | SubstructureNotifyMask, &xev);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -1517,6 +1519,7 @@ ecore_x_netwm_ping_send(Ecore_X_Window win)
    xev.xclient.data.l[4] = 0;
 
    XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -1544,6 +1547,7 @@ ecore_x_netwm_sync_request_send(Ecore_X_Window win,
    xev.xclient.data.l[4] = 0;
 
    XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -1579,6 +1583,7 @@ ecore_x_netwm_state_request_send(Ecore_X_Window win,
 
    XSendEvent(_ecore_x_disp, root, False,
               SubstructureNotifyMask | SubstructureRedirectMask, &xev);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -1606,6 +1611,7 @@ ecore_x_netwm_desktop_request_send(Ecore_X_Window win,
 
    XSendEvent(_ecore_x_disp, root, False,
               SubstructureNotifyMask | SubstructureRedirectMask, &xev);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -1633,6 +1639,7 @@ ecore_x_netwm_moveresize_request_send(Ecore_X_Window win,
 
    XSendEvent(_ecore_x_disp, win, False,
               SubstructureNotifyMask | SubstructureRedirectMask, &xev);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 int
@@ -1733,6 +1740,7 @@ _ecore_x_window_prop_string_utf8_set(Ecore_X_Window win,
 {
    XChangeProperty(_ecore_x_disp, win, atom, ECORE_X_ATOM_UTF8_STRING, 8,
                    PropModeReplace, (unsigned char *)str, strlen(str));
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /*
@@ -1753,6 +1761,7 @@ _ecore_x_window_prop_string_utf8_get(Ecore_X_Window win,
    XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False,
                       ECORE_X_ATOM_UTF8_STRING, &type_ret,
                       &format_ret, &num_ret, &bytes_after, &prop_ret);
+   if (_ecore_xlib_sync) ecore_x_sync();
    if (prop_ret && num_ret > 0 && format_ret == 8)
      {
         str = malloc(num_ret + 1);
@@ -2058,6 +2067,7 @@ ecore_x_screen_is_composited(int screen)
    atom = XInternAtom(_ecore_x_disp, buf, True);
    if (atom == None) return EINA_FALSE;
    win = XGetSelectionOwner(_ecore_x_disp, atom);
+   if (_ecore_xlib_sync) ecore_x_sync();
    return (win != None) ? EINA_TRUE : EINA_FALSE;
 }
 
@@ -2073,5 +2083,6 @@ ecore_x_screen_is_composited_set(int screen,
    atom = XInternAtom(_ecore_x_disp, buf, False);
    if (atom == None) return;
    XSetSelectionOwner(_ecore_x_disp, atom, win, _ecore_x_event_last_time);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
index 72fd796..30903c1 100644 (file)
@@ -31,6 +31,7 @@ ecore_x_pixmap_new(Ecore_X_Window win,
                    int h,
                    int dep)
 {
+   Ecore_X_Pixmap pm;
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    if (win == 0)
      win = DefaultRootWindow(_ecore_x_disp);
@@ -38,7 +39,9 @@ ecore_x_pixmap_new(Ecore_X_Window win,
    if (dep == 0)
      dep = DefaultDepth(_ecore_x_disp, DefaultScreen(_ecore_x_disp));
 
-   return XCreatePixmap(_ecore_x_disp, win, w, h, dep);
+   pm = XCreatePixmap(_ecore_x_disp, win, w, h, dep);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   return pm;
 }
 
 /**
@@ -56,6 +59,7 @@ ecore_x_pixmap_free(Ecore_X_Pixmap pmap)
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    if (!pmap) return;
    XFreePixmap(_ecore_x_disp, pmap);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /**
@@ -85,6 +89,7 @@ ecore_x_pixmap_paste(Ecore_X_Pixmap pmap,
 {
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XCopyArea(_ecore_x_disp, pmap, dest, gc, sx, sy, w, h, dx, dy);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /**
@@ -104,8 +109,9 @@ ecore_x_pixmap_geometry_get(Ecore_X_Pixmap pmap,
                             int *h)
 {
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
-   if (pmap)
-     ecore_x_drawable_geometry_get(pmap, x, y, w, h);
+   if (!pmap) return;
+   ecore_x_drawable_geometry_get(pmap, x, y, w, h);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /**
@@ -117,7 +123,10 @@ ecore_x_pixmap_geometry_get(Ecore_X_Pixmap pmap,
 EAPI int
 ecore_x_pixmap_depth_get(Ecore_X_Pixmap pmap)
 {
+   int ret;
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
-   return ecore_x_drawable_depth_get(pmap);
+   ret = ecore_x_drawable_depth_get(pmap);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   return ret;
 }
 
index f962ffb..63a8fbb 100644 (file)
@@ -67,6 +67,7 @@
 #include "Ecore_Input.h"
 
 extern int _ecore_xlib_log_dom;
+extern Eina_Bool _ecore_xlib_sync;
 #ifdef ECORE_XLIB_DEFAULT_LOG_COLOR
 # undef ECORE_XLIB_DEFAULT_LOG_COLOR
 #endif /* ifdef ECORE_XLIB_DEFAULT_LOG_COLOR */
@@ -367,7 +368,7 @@ Ecore_Event_Mouse_Button *_ecore_mouse_button(int event,
 void _ecore_x_modifiers_get(void);
 KeySym _ecore_x_XKeycodeToKeysym(Display *display, KeyCode keycode, int index);
 
-//#define LOGFNS 1
+#define LOGFNS 0
 
 #ifdef LOGFNS
 #include <stdio.h>
index 81d7eea..01f1fa7 100644 (file)
@@ -48,8 +48,11 @@ EAPI Eina_Bool
 ecore_x_xregion_set(Ecore_X_XRegion *region,
                     Ecore_X_GC gc)
 {
+   Eina_Bool ret;
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
-   return XSetRegion(_ecore_x_disp, gc, (Region)region) ? EINA_TRUE : EINA_FALSE;
+   ret = !!XSetRegion(_ecore_x_disp, gc, (Region)region);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   return ret;
 }
 
 EAPI void
index 8e2efa4..e11cf90 100644 (file)
@@ -400,6 +400,7 @@ ecore_x_selection_xdnd_request(Ecore_X_Window w,
    XConvertSelection(_ecore_x_disp, ECORE_X_ATOM_SELECTION_XDND, atom,
                      ECORE_X_ATOM_SELECTION_PROP_XDND, w,
                      _target->time);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
index fbea732..860e2bf 100644 (file)
@@ -83,7 +83,7 @@ ecore_x_window_new(Ecore_X_Window parent,
                        CWBitGravity |
                        CWWinGravity,
                        &attr);
-
+   if (_ecore_xlib_sync) ecore_x_sync();
    if (parent == DefaultRootWindow(_ecore_x_disp))
      ecore_x_window_defaults_set(win);
 
@@ -152,6 +152,7 @@ ecore_x_window_override_new(Ecore_X_Window parent,
                        CWBitGravity |
                        CWWinGravity,
                        &attr);
+   if (_ecore_xlib_sync) ecore_x_sync();
    return win;
 }
 
@@ -204,7 +205,7 @@ ecore_x_window_input_new(Ecore_X_Window parent,
                        CWDontPropagate |
                        CWEventMask,
                        &attr);
-
+   if (_ecore_xlib_sync) ecore_x_sync();
    if (parent == DefaultRootWindow(_ecore_x_disp))
      {
      }
@@ -253,8 +254,9 @@ ecore_x_window_defaults_set(Ecore_X_Window win)
      {
         XSetWMClientMachine(_ecore_x_disp, win, &xprop);
         XFree(xprop.value);
+        if (_ecore_xlib_sync) ecore_x_sync();
      }
-
+   if (_ecore_xlib_sync) ecore_x_sync();
    /*
     * Set _NET_WM_PID
     */
@@ -294,6 +296,7 @@ ecore_x_window_configure(Ecore_X_Window win,
    xwc.stack_mode = stack_mode;
 
    XConfigureWindow(_ecore_x_disp, win, mask, &xwc);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /**
@@ -315,8 +318,9 @@ ecore_x_window_free(Ecore_X_Window win)
     * a smart idea.
     */
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
-   if (win)
-     XDestroyWindow(_ecore_x_disp, win);
+   if (!win) return;
+   XDestroyWindow(_ecore_x_disp, win);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /**
@@ -418,6 +422,7 @@ ecore_x_window_delete_request_send(Ecore_X_Window win)
    xev.xclient.data.l[1] = CurrentTime;
 
    XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /**
@@ -440,6 +445,7 @@ ecore_x_window_show(Ecore_X_Window win)
 {
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XMapWindow(_ecore_x_disp, win);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /**
@@ -484,6 +490,7 @@ ecore_x_window_hide(Ecore_X_Window win)
    xev.xunmap.from_configure = False;
    XSendEvent(_ecore_x_disp, xev.xunmap.event, False,
               SubstructureRedirectMask | SubstructureNotifyMask, &xev);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /**
@@ -511,6 +518,7 @@ ecore_x_window_move(Ecore_X_Window win,
 {
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XMoveWindow(_ecore_x_disp, win, x, y);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /**
@@ -533,6 +541,7 @@ ecore_x_window_resize(Ecore_X_Window win,
      h = 1;
 
    XResizeWindow(_ecore_x_disp, win, w, h);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /**
@@ -559,6 +568,7 @@ ecore_x_window_move_resize(Ecore_X_Window win,
      h = 1;
 
    XMoveResizeWindow(_ecore_x_disp, win, x, y, w, h);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /**
@@ -582,6 +592,7 @@ ecore_x_window_focus(Ecore_X_Window win)
 
 //   XSetInputFocus(_ecore_x_disp, win, RevertToPointerRoot, CurrentTime);
    XSetInputFocus(_ecore_x_disp, win, RevertToParent, CurrentTime);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /**
@@ -600,6 +611,7 @@ ecore_x_window_focus_at_time(Ecore_X_Window win,
 
 //   XSetInputFocus(_ecore_x_disp, win, PointerRoot, t);
    XSetInputFocus(_ecore_x_disp, win, RevertToParent, t);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /**
@@ -636,6 +648,7 @@ ecore_x_window_raise(Ecore_X_Window win)
 {
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XRaiseWindow(_ecore_x_disp, win);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /**
@@ -648,6 +661,7 @@ ecore_x_window_lower(Ecore_X_Window win)
 {
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XLowerWindow(_ecore_x_disp, win);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /**
@@ -676,6 +690,7 @@ ecore_x_window_reparent(Ecore_X_Window win,
      new_parent = DefaultRootWindow(_ecore_x_disp);
 
    XReparentWindow(_ecore_x_disp, win, new_parent, x, y);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /**
@@ -697,6 +712,7 @@ ecore_x_window_size_get(Ecore_X_Window win,
      win = DefaultRootWindow(_ecore_x_disp);
 
    ecore_x_drawable_geometry_get(win, &dummy_x, &dummy_y, w, h);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /**
@@ -727,6 +743,7 @@ ecore_x_window_geometry_get(Ecore_X_Window win,
      win = DefaultRootWindow(_ecore_x_disp);
 
    ecore_x_drawable_geometry_get(win, x, y, w, h);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /**
@@ -738,12 +755,15 @@ ecore_x_window_geometry_get(Ecore_X_Window win,
 EAPI int
 ecore_x_window_border_width_get(Ecore_X_Window win)
 {
+   int w;
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    /* doesn't make sense to call this on a root window */
    if (!win)
      return 0;
 
-   return ecore_x_drawable_border_width_get(win);
+   w = ecore_x_drawable_border_width_get(win);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   return w;
 }
 
 /**
@@ -762,6 +782,7 @@ ecore_x_window_border_width_set(Ecore_X_Window win,
      return;
 
    XSetWindowBorderWidth (_ecore_x_disp, win, width);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /**
@@ -772,8 +793,11 @@ ecore_x_window_border_width_set(Ecore_X_Window win,
 EAPI int
 ecore_x_window_depth_get(Ecore_X_Window win)
 {
+   int d;
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
-   return ecore_x_drawable_depth_get(win);
+   d = ecore_x_drawable_depth_get(win);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   return d;
 }
 
 /**
@@ -798,19 +822,26 @@ ecore_x_window_cursor_show(Ecore_X_Window win,
         XGCValues gcv;
 
         p = XCreatePixmap(_ecore_x_disp, win, 1, 1, 1);
+        if (_ecore_xlib_sync) ecore_x_sync();
         m = XCreatePixmap(_ecore_x_disp, win, 1, 1, 1);
+        if (_ecore_xlib_sync) ecore_x_sync();
         gc = XCreateGC(_ecore_x_disp, m, 0, &gcv);
+        if (_ecore_xlib_sync) ecore_x_sync();
         XSetForeground(_ecore_x_disp, gc, 0);
+        if (_ecore_xlib_sync) ecore_x_sync();
         XDrawPoint(_ecore_x_disp, m, gc, 0, 0);
+        if (_ecore_xlib_sync) ecore_x_sync();
         XFreeGC(_ecore_x_disp, gc);
         c = XCreatePixmapCursor(_ecore_x_disp, p, m, &cl, &cl, 0, 0);
+        if (_ecore_xlib_sync) ecore_x_sync();
         XDefineCursor(_ecore_x_disp, win, c);
         XFreeCursor(_ecore_x_disp, c);
         XFreePixmap(_ecore_x_disp, p);
         XFreePixmap(_ecore_x_disp, m);
-     }
+}
    else
      XDefineCursor(_ecore_x_disp, win, 0);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -822,6 +853,7 @@ ecore_x_window_cursor_set(Ecore_X_Window win,
      XUndefineCursor(_ecore_x_disp, win);
    else
      XDefineCursor(_ecore_x_disp, win, c);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /**
@@ -833,11 +865,14 @@ ecore_x_window_cursor_set(Ecore_X_Window win,
 EAPI int
 ecore_x_window_visible_get(Ecore_X_Window win)
 {
+   Eina_Bool ret;
    XWindowAttributes attr;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
-   return XGetWindowAttributes(_ecore_x_disp, win, &attr) &&
-          (attr.map_state == IsViewable);
+   ret = (XGetWindowAttributes(_ecore_x_disp, win, &attr) &&
+          (attr.map_state == IsViewable));
+   if (_ecore_xlib_sync) ecore_x_sync();
+   return ret;
 }
 
 typedef struct _Shadow Shadow;
@@ -862,12 +897,11 @@ _ecore_x_window_tree_walk(Window win)
    unsigned int num;
    Shadow *s, **sl;
    XWindowAttributes att;
+   Eina_Bool ret;
 
-   if (!XGetWindowAttributes(_ecore_x_disp, win, &att))
-     return NULL;  //   if (att.class == InputOnly) return NULL;
-
-   if (att.map_state != IsViewable)
-     return NULL;
+   ret = (XGetWindowAttributes(_ecore_x_disp, win, &att) && (att.map_state == IsViewable));
+   if (_ecore_xlib_sync) ecore_x_sync();
+   if (!ret) return NULL; //   if (att.class == InputOnly) return NULL;
 
    s = calloc(1, sizeof(Shadow));
    if (!s)
@@ -881,6 +915,7 @@ _ecore_x_window_tree_walk(Window win)
    if (XQueryTree(_ecore_x_disp, s->win, &root_win, &parent_win,
                   &list, &num))
      {
+        if (_ecore_xlib_sync) ecore_x_sync();
         s->children = calloc(1, sizeof(Shadow *) * num);
         if (s->children)
           {
@@ -1417,10 +1452,12 @@ ecore_x_window_parent_get(Ecore_X_Window win)
 {
    Window root, parent, *children = NULL;
    unsigned int num;
+   Eina_Bool success;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
-   if (!XQueryTree(_ecore_x_disp, win, &root, &parent, &children, &num))
-     return 0;
+   success = XQueryTree(_ecore_x_disp, win, &root, &parent, &children, &num);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   if (!success) return 0;
 
    if (children)
      XFree(children);
@@ -1455,6 +1492,7 @@ ecore_x_window_background_color_set(Ecore_X_Window win,
 
    attr.background_pixel = col.pixel;
    XChangeWindowAttributes(_ecore_x_disp, win, CWBackPixel, &attr);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -1466,6 +1504,7 @@ ecore_x_window_gravity_set(Ecore_X_Window win,
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    att.win_gravity = grav;
    XChangeWindowAttributes(_ecore_x_disp, win, CWWinGravity, &att);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -1477,6 +1516,7 @@ ecore_x_window_pixel_gravity_set(Ecore_X_Window win,
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    att.bit_gravity = grav;
    XChangeWindowAttributes(_ecore_x_disp, win, CWBitGravity, &att);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -1485,6 +1525,7 @@ ecore_x_window_pixmap_set(Ecore_X_Window win,
 {
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XSetWindowBackgroundPixmap(_ecore_x_disp, win, pmap);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -1496,6 +1537,7 @@ ecore_x_window_area_clear(Ecore_X_Window win,
 {
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XClearArea(_ecore_x_disp, win, x, y, w, h, False);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -1507,6 +1549,7 @@ ecore_x_window_area_expose(Ecore_X_Window win,
 {
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XClearArea(_ecore_x_disp, win, x, y, w, h, True);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -1518,6 +1561,7 @@ ecore_x_window_override_set(Ecore_X_Window win,
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    att.override_redirect = override;
    XChangeWindowAttributes(_ecore_x_disp, win, CWOverrideRedirect, &att);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 #ifdef ECORE_XRENDER
@@ -1548,6 +1592,7 @@ _ecore_x_window_argb_internal_new(Ecore_X_Window parent,
      {
         /* ewww - round trip */
         XGetWindowAttributes(_ecore_x_disp, parent, &att);
+        if (_ecore_xlib_sync) ecore_x_sync();
         for (i = 0; i < ScreenCount(_ecore_x_disp); i++)
           {
              if (att.screen == ScreenOfDisplay(_ecore_x_disp, i))
@@ -1567,6 +1612,7 @@ _ecore_x_window_argb_internal_new(Ecore_X_Window parent,
                         VisualClassMask,
                         &vi_in,
                         &nvi);
+   if (_ecore_xlib_sync) ecore_x_sync();
    if (!xvi)
      return 0;
 
@@ -1574,6 +1620,7 @@ _ecore_x_window_argb_internal_new(Ecore_X_Window parent,
    for (i = 0; i < nvi; i++)
      {
         fmt = XRenderFindVisualFormat(_ecore_x_disp, xvi[i].visual);
+        if (_ecore_xlib_sync) ecore_x_sync();
         if ((fmt->type == PictTypeDirect) && (fmt->direct.alphaMask))
           {
              vis = xvi[i].visual;
@@ -1621,6 +1668,7 @@ _ecore_x_window_argb_internal_new(Ecore_X_Window parent,
                        CWBitGravity |
                        CWWinGravity,
                        &attr);
+   if (_ecore_xlib_sync) ecore_x_sync();
    XFreeColormap(_ecore_x_disp, attr.colormap);
 
    if (parent == DefaultRootWindow(_ecore_x_disp))
@@ -1637,12 +1685,15 @@ ecore_x_window_argb_get(Ecore_X_Window win)
 #ifdef ECORE_XRENDER
    XWindowAttributes att;
    XRenderPictFormat *fmt;
+   Eina_Bool ret;
 
    att.visual = 0;
-   if (!XGetWindowAttributes(_ecore_x_disp, win, &att))
-     return 0;
+   ret = XGetWindowAttributes(_ecore_x_disp, win, &att);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   if (!ret) return 0;
 
    fmt = XRenderFindVisualFormat(_ecore_x_disp, att.visual);
+   if (_ecore_xlib_sync) ecore_x_sync();
    if (!fmt)
      return 0;
 
index 286cdfc..465a48c 100644 (file)
@@ -41,6 +41,7 @@ ecore_x_window_prop_card32_set(Ecore_X_Window win,
    _ATOM_SET_CARD32(win, atom, v2, num);
    free(v2);
 #endif /* if SIZEOF_INT == SIZEOF_LONG */
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /*
@@ -85,9 +86,9 @@ ecore_x_window_prop_card32_get(Ecore_X_Window win,
         num = len;
      }
 
+   if (_ecore_xlib_sync) ecore_x_sync();
    if (prop_ret)
      XFree(prop_ret);
-
    return num;
 }
 
@@ -136,9 +137,9 @@ ecore_x_window_prop_card32_list_get(Ecore_X_Window win,
         *plst = val;
      }
 
+   if (_ecore_xlib_sync) ecore_x_sync();
    if (prop_ret)
      XFree(prop_ret);
-
    return num;
 }
 
@@ -170,6 +171,7 @@ ecore_x_window_prop_xid_set(Ecore_X_Window win,
                    (unsigned char *)pl, num);
    free(pl);
 #endif /* if SIZEOF_INT == SIZEOF_LONG */
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /*
@@ -193,13 +195,15 @@ ecore_x_window_prop_xid_get(Ecore_X_Window win,
    int format_ret;
    int num;
    unsigned i;
+   Eina_Bool success;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    prop_ret = NULL;
-   if (XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False,
+   success = (XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False,
                           type, &type_ret, &format_ret, &num_ret,
-                          &bytes_after, &prop_ret) != Success)
-     return -1;
+                          &bytes_after, &prop_ret) == Success);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   if (!success) return -1;
 
    if (type_ret != type || format_ret != 32)
      num = -1;
@@ -242,14 +246,16 @@ ecore_x_window_prop_xid_list_get(Ecore_X_Window win,
    Ecore_X_Atom *alst;
    int num;
    unsigned i;
+   Eina_Bool success;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    *val = NULL;
    prop_ret = NULL;
-   if (XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False,
+   success = (XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False,
                           type, &type_ret, &format_ret, &num_ret,
-                          &bytes_after, &prop_ret) != Success)
-     return -1;
+                          &bytes_after, &prop_ret) == Success);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   if (!success) return -1;
 
    if (type_ret != type || format_ret != 32)
      num = -1;
@@ -266,7 +272,6 @@ ecore_x_window_prop_xid_list_get(Ecore_X_Window win,
 
    if (prop_ret)
      XFree(prop_ret);
-
    return num;
 }
 
@@ -352,8 +357,10 @@ ecore_x_window_prop_atom_get(Ecore_X_Window win,
                              Ecore_X_Atom *lst,
                              unsigned int len)
 {
+   int ret;
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
-   return ecore_x_window_prop_xid_get(win, atom, XA_ATOM, lst, len);
+   ret = ecore_x_window_prop_xid_get(win, atom, XA_ATOM, lst, len);
+   return ret;
 }
 
 /*
@@ -369,8 +376,10 @@ ecore_x_window_prop_atom_list_get(Ecore_X_Window win,
                                   Ecore_X_Atom atom,
                                   Ecore_X_Atom **plst)
 {
+   int ret;
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
-   return ecore_x_window_prop_xid_list_get(win, atom, XA_ATOM, plst);
+   ret = ecore_x_window_prop_xid_list_get(win, atom, XA_ATOM, plst);
+   return ret;
 }
 
 /*
@@ -413,8 +422,10 @@ ecore_x_window_prop_window_get(Ecore_X_Window win,
                                Ecore_X_Window *lst,
                                unsigned int len)
 {
+   int ret;
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
-   return ecore_x_window_prop_xid_get(win, atom, XA_WINDOW, lst, len);
+   ret = ecore_x_window_prop_xid_get(win, atom, XA_WINDOW, lst, len);
+   return ret;
 }
 
 /*
@@ -430,8 +441,10 @@ ecore_x_window_prop_window_list_get(Ecore_X_Window win,
                                     Ecore_X_Atom atom,
                                     Ecore_X_Window **plst)
 {
+   int ret;
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
-   return ecore_x_window_prop_xid_list_get(win, atom, XA_WINDOW, plst);
+   ret = ecore_x_window_prop_xid_list_get(win, atom, XA_WINDOW, plst);
+   return ret;
 }
 
 EAPI Ecore_X_Atom
@@ -485,6 +498,7 @@ ecore_x_window_prop_property_set(Ecore_X_Window win,
              free(dat);
           }
      }
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /**
@@ -528,10 +542,9 @@ ecore_x_window_prop_property_get(Ecore_X_Window win,
    ret = XGetWindowProperty(_ecore_x_disp, win, property, 0, LONG_MAX,
                             False, type, &type_ret, &size_ret,
                             &num_ret, &bytes, &prop_ret);
-
+   if (_ecore_xlib_sync) ecore_x_sync();
    if (ret != Success)
      return 0;
-
    if (!num_ret)
      {
         XFree(prop_ret);
@@ -575,6 +588,7 @@ ecore_x_window_prop_property_del(Ecore_X_Window win,
 {
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XDeleteProperty(_ecore_x_disp, win, property);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI Ecore_X_Atom *
@@ -590,6 +604,7 @@ ecore_x_window_prop_list(Ecore_X_Window win,
      *num_ret = 0;
 
    atom_ret = XListProperties(_ecore_x_disp, win, &num);
+   if (_ecore_xlib_sync) ecore_x_sync();
    if (!atom_ret)
      return NULL;
 
@@ -630,6 +645,7 @@ ecore_x_window_prop_string_set(Ecore_X_Window win,
    xtp.encoding = ECORE_X_ATOM_UTF8_STRING;
    xtp.nitems = strlen(str);
    XSetTextProperty(_ecore_x_disp, win, &xtp, type);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /**
@@ -655,6 +671,7 @@ ecore_x_window_prop_string_get(Ecore_X_Window win,
         char **list = NULL;
         Status s;
 
+        if (_ecore_xlib_sync) ecore_x_sync();
         if (xtp.encoding == ECORE_X_ATOM_UTF8_STRING)
           str = strdup((char *)xtp.value);
         else
@@ -666,6 +683,7 @@ ecore_x_window_prop_string_get(Ecore_X_Window win,
              s = XmbTextPropertyToTextList(_ecore_x_disp, &xtp,
                                            &list, &items);
 #endif /* ifdef X_HAVE_UTF8_STRING */
+             if (_ecore_xlib_sync) ecore_x_sync();
              if ((s == XLocaleNotSupported) ||
                  (s == XNoMemory) || (s == XConverterNotFound))
                str = strdup((char *)xtp.value);
@@ -678,7 +696,6 @@ ecore_x_window_prop_string_get(Ecore_X_Window win,
 
         XFree(xtp.value);
      }
-
    return str;
 }
 
@@ -697,7 +714,9 @@ ecore_x_window_prop_protocol_isset(Ecore_X_Window win,
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    proto = _ecore_x_atoms_wm_protocols[protocol];
 
-   if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count))
+   ret = XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   if (!ret)
      return ret;
 
    for (i = 0; i < protos_count; i++)
@@ -708,7 +727,6 @@ ecore_x_window_prop_protocol_isset(Ecore_X_Window win,
        }
 
    XFree(protos);
-
    return ret;
 }
 
@@ -727,9 +745,12 @@ ecore_x_window_prop_protocol_list_get(Ecore_X_Window win,
    Atom *protos = NULL;
    int i, protos_count = 0;
    Ecore_X_WM_Protocol *prot_ret = NULL;
+   Eina_Bool success;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
-   if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count))
+   success = XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count);
+   if (_ecore_xlib_sync) ecore_x_sync();
+   if (!success)
      return NULL;
 
    if ((!protos) || (protos_count <= 0))
index df3e76b..987aa07 100644 (file)
@@ -29,6 +29,7 @@ ecore_x_window_shape_mask_set(Ecore_X_Window win,
 {
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    XShapeCombineMask(_ecore_x_disp, win, ShapeBounding, 0, 0, mask, ShapeSet);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 /**
@@ -45,6 +46,7 @@ ecore_x_window_shape_input_mask_set(Ecore_X_Window win,
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
 #ifdef ShapeInput
    XShapeCombineMask(_ecore_x_disp, win, ShapeInput, 0, 0, mask, ShapeSet);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #else /* ifdef ShapeInput */
    return;
    win = mask = 0;
@@ -64,6 +66,7 @@ ecore_x_window_shape_window_set(Ecore_X_Window win,
                       shape_win,
                       ShapeBounding,
                       ShapeSet);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -80,6 +83,7 @@ ecore_x_window_shape_input_window_set(Ecore_X_Window win,
                       shape_win,
                       ShapeInput,
                       ShapeSet);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #else
    return;
    win = shape_win = 0;
@@ -101,6 +105,7 @@ ecore_x_window_shape_window_set_xy(Ecore_X_Window win,
                       shape_win,
                       ShapeBounding,
                       ShapeSet);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -119,6 +124,7 @@ ecore_x_window_shape_input_window_set_xy(Ecore_X_Window win,
                       shape_win,
                       ShapeInput,
                       ShapeSet);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #else
    return;
    win = shape_win = x = y = 0;
@@ -148,6 +154,7 @@ ecore_x_window_shape_rectangle_set(Ecore_X_Window win,
                            1,
                            ShapeSet,
                            Unsorted);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -174,6 +181,7 @@ ecore_x_window_shape_input_rectangle_set(Ecore_X_Window win,
                            1,
                            ShapeSet,
                            Unsorted);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #else
    return;
    win = x = y = w = h = 0;
@@ -212,6 +220,7 @@ ecore_x_window_shape_rectangles_set(Ecore_X_Window win,
                            num,
                            ShapeSet,
                            Unsorted);
+   if (_ecore_xlib_sync) ecore_x_sync();
    if (rect) free(rect);
 #else
    return;
@@ -251,6 +260,7 @@ ecore_x_window_shape_input_rectangles_set(Ecore_X_Window win,
                            num,
                            ShapeSet,
                            Unsorted);
+   if (_ecore_xlib_sync) ecore_x_sync();
    if (rect) free(rect);
 #else
    return;
@@ -281,6 +291,7 @@ ecore_x_window_shape_rectangle_subtract(Ecore_X_Window win,
                            1,
                            ShapeSubtract,
                            Unsorted);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -307,6 +318,7 @@ ecore_x_window_shape_input_rectangle_subtract(Ecore_X_Window win,
                            1,
                            ShapeSubtract,
                            Unsorted);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #else
    return;
    win = x = y = w = h = 0;
@@ -326,6 +338,7 @@ ecore_x_window_shape_window_add(Ecore_X_Window win,
                       shape_win,
                       ShapeBounding,
                       ShapeUnion);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -343,6 +356,7 @@ ecore_x_window_shape_window_add_xy(Ecore_X_Window win,
                       shape_win,
                       ShapeBounding,
                       ShapeUnion);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -361,6 +375,7 @@ ecore_x_window_shape_input_window_add_xy(Ecore_X_Window win,
                       shape_win,
                       ShapeInput,
                       ShapeUnion);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #else
    return;
    win = shape_win = x = y = 0;
@@ -390,6 +405,7 @@ ecore_x_window_shape_rectangle_add(Ecore_X_Window win,
                            1,
                            ShapeUnion,
                            Unsorted);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -416,6 +432,7 @@ ecore_x_window_shape_input_rectangle_add(Ecore_X_Window win,
                            1,
                            ShapeUnion,
                            Unsorted);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #else
    return;
    win = x = y = w = h = 0;
@@ -445,6 +462,7 @@ ecore_x_window_shape_rectangle_clip(Ecore_X_Window win,
                            1,
                            ShapeIntersect,
                            Unsorted);
+   if (_ecore_xlib_sync) ecore_x_sync();
 }
 
 EAPI void
@@ -471,6 +489,7 @@ ecore_x_window_shape_input_rectangle_clip(Ecore_X_Window win,
                            1,
                            ShapeIntersect,
                            Unsorted);
+   if (_ecore_xlib_sync) ecore_x_sync();
 #else
    return;
    win = x = y = w = h = 0;
@@ -508,6 +527,7 @@ ecore_x_window_shape_rectangles_add(Ecore_X_Window win,
                            num,
                            ShapeUnion,
                            Unsorted);
+   if (_ecore_xlib_sync) ecore_x_sync();
    if (rect) free(rect);
 }
 
@@ -543,6 +563,7 @@ ecore_x_window_shape_input_rectangles_add(Ecore_X_Window win,
                            num,
                            ShapeUnion,
                            Unsorted);
+   if (_ecore_xlib_sync) ecore_x_sync();
    if (rect) free(rect);
 #else
    return;
@@ -560,6 +581,7 @@ ecore_x_window_shape_rectangles_get(Ecore_X_Window win,
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    rect = XShapeGetRectangles(_ecore_x_disp, win, ShapeBounding, &num, &ord);
+   if (_ecore_xlib_sync) ecore_x_sync();
    if (rect)
      {
         if (num < 1)
@@ -599,6 +621,7 @@ ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win,
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
    rect = XShapeGetRectangles(_ecore_x_disp, win, ShapeInput, &num, &ord);
+   if (_ecore_xlib_sync) ecore_x_sync();
    if (rect)
      {
         if (num < 1)
@@ -638,9 +661,11 @@ ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win,
                      &(rects[0].width), &(rects[0].height),
                      &di, &di))
      {
+        if (_ecore_xlib_sync) ecore_x_sync();
         free(rects);
         return NULL;
      }
+      if (_ecore_xlib_sync) ecore_x_sync();
    if (num_ret) *num_ret = 1;
    return rects;
 #endif
@@ -655,5 +680,6 @@ ecore_x_window_shape_events_select(Ecore_X_Window win,
      XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask);
    else
      XShapeSelectInput(_ecore_x_disp, win, 0);
+      if (_ecore_xlib_sync) ecore_x_sync();
 }
 
index 8289688..2a49d0c 100644 (file)
@@ -434,6 +434,7 @@ ecore_x_input_multi_select(Ecore_X_Window win)
              XISetMask(mask, XI_ButtonRelease);
              XISetMask(mask, XI_Motion);
              XISelectEvents(_ecore_x_disp, win, &eventmask, 1);
+             if (_ecore_xlib_sync) ecore_x_sync();
              find = EINA_TRUE;
           }
         else if (dev->use == XISlavePointer)
@@ -485,6 +486,7 @@ ecore_x_input_multi_select(Ecore_X_Window win)
 #endif /* #ifdef ECORE_XI2_2 */
 
                   XISelectEvents(_ecore_x_disp, win, &eventmask, 1);
+                  if (_ecore_xlib_sync) ecore_x_sync();
                   find = EINA_TRUE;
                }
 #ifdef ECORE_XI2_2
@@ -507,6 +509,7 @@ ecore_x_input_multi_select(Ecore_X_Window win)
                        XISetMask(mask, XI_TouchBegin);
                        XISetMask(mask, XI_TouchEnd);
                        XISelectEvents(_ecore_x_disp, win, &eventmask, 1);
+                       if (_ecore_xlib_sync) ecore_x_sync();
 
                        l = eina_inlist_append(l, (Eina_Inlist *)info);
                        _ecore_x_xi2_touch_info_list = l;
@@ -549,6 +552,7 @@ ecore_x_input_raw_select(Ecore_X_Window win)
 #endif
 
    XISelectEvents(_ecore_x_disp, win, &emask, 1);
+   if (_ecore_xlib_sync) ecore_x_sync();
 
    return EINA_TRUE;
 #else
index f49a4d3..4a591f9 100644 (file)
@@ -29,10 +29,13 @@ ecore_x_xinerama_screen_count_get(void)
    _xin_info = NULL;
    if (XineramaQueryExtension(_ecore_x_disp, &event_base, &error_base))
      {
+        if (_ecore_xlib_sync) ecore_x_sync();
         _xin_info = XineramaQueryScreens(_ecore_x_disp, &_xin_scr_num);
+        if (_ecore_xlib_sync) ecore_x_sync();
         if (_xin_info)
           return _xin_scr_num;
      }
+   if (_ecore_xlib_sync) ecore_x_sync();
 
 #endif /* ifdef ECORE_XINERAMA */
    return 0;