[Xfce4-commits] [xfce/xfwm4] 01/02: Extended XSync counter

noreply at xfce.org noreply at xfce.org
Sun Dec 28 21:17:12 CET 2014


This is an automated email from the git hooks/post-receive script.

olivier pushed a commit to branch master
in repository xfce/xfwm4.

commit 6c947cd691036fb562a8e9c02b966c96aece17e7
Author: Olivier Fourdan <fourdan at xfce.org>
Date:   Fri Dec 26 14:17:25 2014 +0100

    Extended XSync counter
    
    Add partial support for extended XSync counter as described
    by Owen here:
    
    http://fishsoup.net/misc/wm-spec-synchronization.html
    
    Unfortunately, xfwm4's XSync implementation does not work too
    well with some apps (e.g. gnome-terminal) when the compositor
    is disabled, some apps do not seem to update the counter as
    expected and the alarm is not triggered, causing a timeout.
    
    I am not even sure supporting the extended XSync counter makes
    much sense without a compositor so it's not too much of a trouble.
    
    To limit the effect of the freeze until the timeout fires up,
    reduce the limit to 500 ms.
    
    Signed-off-by: Olivier Fourdan <fourdan at xfce.org>
---
 src/client.c     |  100 +++++++++++++++----------
 src/client.h     |    6 +-
 src/events.c     |   22 ++----
 src/moveresize.c |   41 +++++------
 src/xsync.c      |  216 ++++++++++++++++++++++++++++++++----------------------
 src/xsync.h      |   14 ++--
 6 files changed, 225 insertions(+), 174 deletions(-)

diff --git a/src/client.c b/src/client.c
index 3b0a568..a93cdcc 100644
--- a/src/client.c
+++ b/src/client.c
@@ -80,6 +80,7 @@
     PropertyChangeMask
 
 #define CLIENT_EVENT_MASK \
+    SubstructureNotifyMask|\
     StructureNotifyMask|\
     FocusChangeMask|\
     PropertyChangeMask
@@ -633,6 +634,7 @@ clientConfigureWindows (Client *c, XWindowChanges * wc, unsigned long mask, unsi
         change_values.height = c->height;
         XConfigureWindow (display_info->dpy, c->window, change_mask_client, &change_values);
     }
+
     if (WIN_RESIZED)
     {
         compositorResizeWindow (display_info, c->frame, frameX (c), frameY (c), frameWidth (c), frameHeight (c));
@@ -640,9 +642,33 @@ clientConfigureWindows (Client *c, XWindowChanges * wc, unsigned long mask, unsi
 }
 
 void
-clientConfigure (Client *c, XWindowChanges * wc, unsigned long mask, unsigned short flags)
+clientSendConfigureNotify (Client *c)
 {
     XConfigureEvent ce;
+
+    g_return_if_fail (c != NULL);
+    g_return_if_fail (c->window != None);
+
+    DBG ("Sending ConfigureNotify");
+    ce.type = ConfigureNotify;
+    ce.display = clientGetXDisplay (c);
+    ce.send_event = TRUE;
+    ce.event = c->window;
+    ce.window = c->window;
+    ce.x = c->x;
+    ce.y = c->y;
+    ce.width = c->width;
+    ce.height = c->height;
+    ce.border_width = 0;
+    ce.above = None;
+    ce.override_redirect = FALSE;
+    XSendEvent (clientGetXDisplay (c), c->window, TRUE,
+                StructureNotifyMask, (XEvent *) & ce);
+}
+
+void
+clientConfigure (Client *c, XWindowChanges * wc, unsigned long mask, unsigned short flags)
+{
     int px, py, pwidth, pheight;
 
     g_return_if_fail (c != NULL);
@@ -784,26 +810,26 @@ clientConfigure (Client *c, XWindowChanges * wc, unsigned long mask, unsigned sh
     if ((WIN_MOVED) || (flags & CFG_NOTIFY) ||
         ((flags & CFG_REQUEST) && !(WIN_MOVED || WIN_RESIZED)))
     {
-        DBG ("Sending ConfigureNotify");
-        ce.type = ConfigureNotify;
-        ce.display = clientGetXDisplay (c);
-        ce.event = c->window;
-        ce.window = c->window;
-        ce.x = c->x;
-        ce.y = c->y;
-        ce.width = c->width;
-        ce.height = c->height;
-        ce.border_width = 0;
-        ce.above = c->frame;
-        ce.override_redirect = FALSE;
-        XSendEvent (clientGetXDisplay (c), c->window, FALSE,
-                    StructureNotifyMask, (XEvent *) & ce);
+        clientSendConfigureNotify (c);
     }
 #undef WIN_MOVED
 #undef WIN_RESIZED
 }
 
 void
+clientReconfigure (Client *c)
+{
+    XWindowChanges wc;
+
+    TRACE ("entering clientReconfigure");
+    wc.x = c->x;
+    wc.y = c->y;
+    wc.width = c->width;
+    wc.height = c->height;
+    clientConfigure (c, &wc, CWX | CWY | CWWidth | CWHeight, NO_CFG_FLAG);
+}
+
+void
 clientMoveResizeWindow (Client *c, XWindowChanges * wc, unsigned long mask)
 {
     ScreenInfo *screen_info;
@@ -1256,14 +1282,6 @@ clientFree (Client *c)
     {
         clientRemoveNetWMPing (c);
     }
-    if (c->name)
-    {
-        g_free (c->name);
-    }
-    if (c->hostname)
-    {
-        g_free (c->hostname);
-    }
 #ifdef HAVE_XSYNC
     if (c->xsync_alarm != None)
     {
@@ -1280,6 +1298,14 @@ clientFree (Client *c)
         g_free (c->startup_id);
     }
 #endif /* HAVE_LIBSTARTUP_NOTIFICATION */
+    if (c->name)
+    {
+        g_free (c->name);
+    }
+    if (c->hostname)
+    {
+        g_free (c->hostname);
+    }
     if (c->size)
     {
         XFree (c->size);
@@ -1594,22 +1620,6 @@ clientFrame (DisplayInfo *display_info, Window w, gboolean recapture)
     c->startup_id = NULL;
 #endif /* HAVE_LIBSTARTUP_NOTIFICATION */
 
-#ifdef HAVE_XSYNC
-    c->xsync_waiting = FALSE;
-    c->xsync_enabled = FALSE;
-    c->xsync_counter = None;
-    c->xsync_alarm = None;
-    c->xsync_timeout_id = 0;
-    if (display_info->have_xsync)
-    {
-        getXSyncCounter (display_info, c->window, &c->xsync_counter);
-        if ((c->xsync_counter) && clientCreateXSyncAlarm (c))
-        {
-            c->xsync_enabled = TRUE;
-        }
-    }
-#endif /* HAVE_XSYNC */
-
     clientGetWMNormalHints (c, FALSE);
 
     c->size->x = c->x;
@@ -1921,6 +1931,18 @@ clientFrame (DisplayInfo *display_info, Window w, gboolean recapture)
                                                  frameRight (c), frameBottom (c));
     clientSetNetState (c);
 
+#ifdef HAVE_XSYNC
+    c->xsync_waiting = FALSE;
+    c->xsync_enabled = FALSE;
+    c->xsync_counter = None;
+    c->xsync_alarm = None;
+    c->xsync_timeout_id = 0;
+    if (display_info->have_xsync)
+    {
+        clientGetXSyncCounter (c);
+    }
+#endif /* HAVE_XSYNC */
+
     /* Window is reparented now, so we can safely release the grab
      * on the server
      */
diff --git a/src/client.h b/src/client.h
index fcd676e..dd48d42 100644
--- a/src/client.h
+++ b/src/client.h
@@ -101,7 +101,7 @@
 #endif
 
 #ifndef CLIENT_XSYNC_TIMEOUT
-#define CLIENT_XSYNC_TIMEOUT            1000 /* ms */
+#define CLIENT_XSYNC_TIMEOUT            500  /* ms */
 #endif
 
 #ifndef CLIENT_BLINK_TIMEOUT
@@ -340,9 +340,11 @@ struct _Client
     XSyncAlarm  xsync_alarm;
     XSyncCounter xsync_counter;
     XSyncValue xsync_value;
+    XSyncValue next_xsync_value;
     guint xsync_timeout_id;
     gboolean xsync_waiting;
     gboolean xsync_enabled;
+    gboolean xsync_extended_counter;
 #endif /* HAVE_XSYNC */
 };
 
@@ -363,10 +365,12 @@ void                     clientAdjustCoordGravity               (Client *,
                                                                  int,
                                                                  unsigned long *,
                                                                  XWindowChanges *);
+void                     clientSendConfigureNotify              (Client *);
 void                     clientConfigure                        (Client *,
                                                                  XWindowChanges *,
                                                                  unsigned long,
                                                                  unsigned short);
+void                     clientReconfigure                      (Client *);
 void                     clientMoveResizeWindow                 (Client *,
                                                                  XWindowChanges *,
                                                                  unsigned long);
diff --git a/src/events.c b/src/events.c
index bfdd77c..52db068 100644
--- a/src/events.c
+++ b/src/events.c
@@ -1925,8 +1925,8 @@ handlePropertyNotify (DisplayInfo *display_info, XPropertyEvent * ev)
 #ifdef HAVE_XSYNC
         else if (ev->atom == display_info->atoms[NET_WM_SYNC_REQUEST_COUNTER])
         {
-            getXSyncCounter (display_info, c->window, &c->xsync_counter);
-            TRACE ("Window 0x%lx has NET_WM_SYNC_REQUEST_COUNTER set to 0x%lx", c->window, c->xsync_counter);
+            TRACE ("Window 0x%lx has received NET_WM_SYNC_REQUEST_COUNTER", c->window);
+            clientGetXSyncCounter (c);
         }
 #endif /* HAVE_XSYNC */
 
@@ -2214,20 +2214,14 @@ handleXSyncAlarmNotify (DisplayInfo *display_info, XSyncAlarmNotifyEvent * ev)
     Client *c;
 
     TRACE ("entering handleXSyncAlarmNotify");
-
-    if (!display_info->have_xsync)
-    {
-        return EVENT_FILTER_REMOVE;
-    }
-
-    c = myDisplayGetClientFromXSyncAlarm (display_info, ev->alarm);
-    if (c)
+    if (display_info->have_xsync)
     {
-        c->xsync_waiting = FALSE;
-        c->xsync_value = ev->counter_value;
-        clientXSyncClearTimeout (c);
+        c = myDisplayGetClientFromXSyncAlarm (display_info, ev->alarm);
+        if (c)
+        {
+            clientXSyncUpdateValue (c, ev->counter_value);
+        }
     }
-
     return EVENT_FILTER_REMOVE;
 }
 #endif /* HAVE_XSYNC */
diff --git a/src/moveresize.c b/src/moveresize.c
index af1900d..0067743 100644
--- a/src/moveresize.c
+++ b/src/moveresize.c
@@ -1249,7 +1249,7 @@ clientChangeHandle(MoveResizeData *passdata, int handle)
 }
 
 static void
-clientResizeConfigure (Client *c, int px, int py, int pw, int ph)
+clientResizeConfigure (Client *c, int pw, int ph)
 {
     ScreenInfo *screen_info;
     DisplayInfo *display_info;
@@ -1258,24 +1258,24 @@ clientResizeConfigure (Client *c, int px, int py, int pw, int ph)
     screen_info = c->screen_info;
     display_info = screen_info->display_info;
 
-#ifdef HAVE_XSYNC
-    if (c->xsync_waiting)
+    if (pw == c->width && ph == c->height)
     {
+        /* Not a resize */
         return;
     }
-    else
+#ifdef HAVE_XSYNC
+    if (!c->xsync_waiting)
     {
         if ((display_info->have_xsync) && (c->xsync_enabled) && (c->xsync_counter))
         {
             clientXSyncRequest (c);
         }
+        else
+        {
 #endif /* HAVE_XSYNC */
-        wc.x = c->x;
-        wc.y = c->y;
-        wc.width = c->width;
-        wc.height = c->height;
-        clientConfigure (c, &wc, CWX | CWY | CWWidth | CWHeight, NO_CFG_FLAG);
+            clientReconfigure (c);
 #ifdef HAVE_XSYNC
+        }
     }
 #endif /* HAVE_XSYNC */
 }
@@ -1447,7 +1447,7 @@ clientResizeEventFilter (XEvent * xevent, gpointer data)
             }
             else
             {
-                clientResizeConfigure (c, prev_x, prev_y, prev_width, prev_height);
+                clientResizeConfigure (c, prev_width, prev_height);
             }
         }
         else if (passdata->use_keys)
@@ -1590,7 +1590,7 @@ clientResizeEventFilter (XEvent * xevent, gpointer data)
         }
         else
         {
-            clientResizeConfigure (c, prev_x, prev_y, prev_width, prev_height);
+            clientResizeConfigure (c, prev_width, prev_height);
         }
     }
     else if (xevent->type == ButtonRelease)
@@ -1627,7 +1627,6 @@ clientResize (Client * c, int handle, XEvent * ev)
 {
     ScreenInfo *screen_info;
     DisplayInfo *display_info;
-    XWindowChanges wc;
     MoveResizeData passdata;
     int w_orig, h_orig;
     Cursor cursor;
@@ -1724,10 +1723,6 @@ clientResize (Client * c, int handle, XEvent * ev)
         poswinShow (passdata.poswin);
     }
 
-#ifdef HAVE_XSYNC
-    clientXSyncEnable (c);
-#endif /* HAVE_XSYNC */
-
     /* Set window translucent while resizing */
     if ((screen_info->params->resize_opacity < 100) &&
         !(screen_info->params->box_resize) &&
@@ -1739,6 +1734,10 @@ clientResize (Client * c, int handle, XEvent * ev)
     /* Clear any previously saved pos flag from screen resize */
     FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_SAVED_POS);
 
+#ifdef HAVE_XSYNC
+    clientCreateXSyncAlarm (c);
+#endif /* HAVE_XSYNC */
+
     FLAG_SET (c->xfwm_flags, XFWM_FLAG_MOVING_RESIZING);
     TRACE ("entering resize loop");
     eventFilterPush (display_info->xfilter, clientResizeEventFilter, &passdata);
@@ -1764,16 +1763,12 @@ clientResize (Client * c, int handle, XEvent * ev)
         clientRemoveMaximizeFlag (c);
     }
 
-    wc.x = c->x;
-    wc.y = c->y;
-    wc.width = c->width;
-    wc.height = c->height;
-    clientConfigure (c, &wc, CWX | CWY | CWHeight | CWWidth, NO_CFG_FLAG);
 #ifdef HAVE_XSYNC
-    clientXSyncClearTimeout (c);
-    c->xsync_waiting = FALSE;
+    clientDestroyXSyncAlarm (c);
 #endif /* HAVE_XSYNC */
 
+    clientReconfigure (c);
+
     if (!passdata.released)
     {
         /* If this is a drag-resize, wait for the button to be released.
diff --git a/src/xsync.c b/src/xsync.c
index b11f200..18a3979 100644
--- a/src/xsync.c
+++ b/src/xsync.c
@@ -16,7 +16,7 @@
         MA 02110-1301, USA.
 
 
-        xfwm4    - (c) 2002-2011 Olivier Fourdan
+        xfwm4    - (c) 2002-2014 Olivier Fourdan
 
  */
 
@@ -27,58 +27,20 @@
 #include "xsync.h"
 
 #ifdef HAVE_XSYNC
-gboolean
-getXSyncCounter (DisplayInfo *display_info, Window window, XSyncCounter *counter)
-{
-    long val;
-
-    g_return_val_if_fail (window != None, FALSE);
-    g_return_val_if_fail (counter != NULL, FALSE);
-    TRACE ("entering getXSyncCounter");
-
-    val = 0;
-    if (getHint (display_info, window, NET_WM_SYNC_REQUEST_COUNTER, &val))
-    {
-        *counter = (XSyncCounter) val;
-        return TRUE;
-    }
 
-    return FALSE;
-}
-
-void
-sendXSyncRequest (DisplayInfo *display_info, Window window, XSyncValue value)
-{
-    XClientMessageEvent xev;
-
-    g_return_if_fail (window != None);
-    TRACE ("entering sendXSyncRequest");
-
-    xev.type = ClientMessage;
-    xev.window = window;
-    xev.message_type = display_info->atoms[WM_PROTOCOLS];
-    xev.format = 32;
-    xev.data.l[0] = (long) display_info->atoms[NET_WM_SYNC_REQUEST];
-    xev.data.l[1] = (long) myDisplayGetCurrentTime (display_info);
-    xev.data.l[2] = (long) XSyncValueLow32 (value);
-    xev.data.l[3] = (long) XSyncValueHigh32 (value);
-    xev.data.l[4] = (long) 0L;
-    XSendEvent (display_info->dpy, window, FALSE, NoEventMask, (XEvent *) &xev);
-}
+/* See http://fishsoup.net/misc/wm-spec-synchronization.html */
+#ifndef XSYNC_VALUE_INCREMENT
+#define XSYNC_VALUE_INCREMENT 240
+#endif
 
-void
-clientIncrementXSyncValue (Client *c)
+static void
+addToXSyncValue (XSyncValue *value, gint i)
 {
     XSyncValue add;
     int overflow;
 
-    g_return_if_fail (c != NULL);
-    g_return_if_fail (c->xsync_counter != None);
-
-    TRACE ("entering clientIncrementXSyncValue");
-
-    XSyncIntToValue (&add, 1);
-    XSyncValueAdd (&c->xsync_value, c->xsync_value, add, &overflow);
+    XSyncIntToValue (&add, i);
+    XSyncValueAdd (value, *value, add, &overflow);
 }
 
 gboolean
@@ -86,7 +48,8 @@ clientCreateXSyncAlarm (Client *c)
 {
     ScreenInfo *screen_info;
     DisplayInfo *display_info;
-    XSyncAlarmAttributes values;
+    XSyncValue current_value, next_value;
+    XSyncAlarmAttributes attrs;
 
     g_return_val_if_fail (c != NULL, FALSE);
     g_return_val_if_fail (c->xsync_counter != None, FALSE);
@@ -96,16 +59,35 @@ clientCreateXSyncAlarm (Client *c)
     screen_info = c->screen_info;
     display_info = screen_info->display_info;
 
-    XSyncIntToValue (&c->xsync_value, 0);
-    XSyncSetCounter (display_info->dpy, c->xsync_counter, c->xsync_value);
-    XSyncIntToValue (&values.trigger.wait_value, 1);
-    XSyncIntToValue (&values.delta, 1);
+    clientDestroyXSyncAlarm (c);
+    if (c->xsync_extended_counter)
+    {
+        /* Get the counter value from the client, if not, bail out... */
+        if (!XSyncQueryCounter(display_info->dpy, c->xsync_counter, &c->xsync_value))
+        {
+            c->xsync_extended_counter = None;
+            return FALSE;
+        }
+    }
+    else
+    {
+        XSyncIntToValue (&c->xsync_value, 0);
+        XSyncSetCounter (display_info->dpy, c->xsync_counter, c->xsync_value);
+    }
 
-    values.trigger.counter = c->xsync_counter;
-    values.trigger.value_type = XSyncAbsolute;
-    values.trigger.test_type = XSyncPositiveComparison;
-    values.events = True;
+    c->next_xsync_value = c->xsync_value;
+    if (!c->xsync_extended_counter ||
+        (XSyncValueLow32(c->next_xsync_value) % 2 == 0))
+    {
+        addToXSyncValue (&c->next_xsync_value, 1);
+    }
 
+    attrs.trigger.counter = c->xsync_counter;
+    XSyncIntToValue (&attrs.delta, 1);
+    XSyncIntToValue (&attrs.trigger.wait_value, 1);
+    attrs.trigger.value_type = XSyncRelative;
+    attrs.trigger.test_type = XSyncPositiveComparison;
+    attrs.events = TRUE;
     c->xsync_alarm = XSyncCreateAlarm (display_info->dpy,
                                        XSyncCACounter |
                                        XSyncCADelta |
@@ -113,7 +95,7 @@ clientCreateXSyncAlarm (Client *c)
                                        XSyncCATestType |
                                        XSyncCAValue |
                                        XSyncCAValueType,
-                                       &values);
+                                       &attrs);
     return (c->xsync_alarm != None);
 }
 
@@ -124,15 +106,61 @@ clientDestroyXSyncAlarm (Client *c)
     DisplayInfo *display_info;
 
     g_return_if_fail (c != NULL);
-    g_return_if_fail (c->xsync_alarm != None);
-
     TRACE ("entering clientDestroyXSyncAlarm");
 
+    clientXSyncClearTimeout (c);
+    if (c->xsync_alarm != None)
+    {
+        screen_info = c->screen_info;
+        display_info = screen_info->display_info;
+
+        XSyncDestroyAlarm (display_info->dpy, c->xsync_alarm);
+        c->xsync_alarm = None;
+    }
+}
+
+gboolean
+clientGetXSyncCounter (Client * c)
+{
+    ScreenInfo *screen_info;
+    DisplayInfo *display_info;
+    gulong *data;
+    int nitems;
+
+    g_return_val_if_fail (c != NULL, FALSE);
+    TRACE ("entering clientGetXSyncCounter");
+
     screen_info = c->screen_info;
     display_info = screen_info->display_info;
 
-    XSyncDestroyAlarm (display_info->dpy, c->xsync_alarm);
-    c->xsync_alarm = None;
+    data = NULL;
+    if (getCardinalList (display_info, c->window, NET_WM_SYNC_REQUEST_COUNTER, &data, &nitems))
+    {
+        switch (nitems)
+        {
+            case 0:
+                c->xsync_extended_counter = FALSE;
+                c->xsync_enabled = FALSE;
+                break;
+            case 1:
+                c->xsync_counter = (XSyncCounter) data[0];
+                c->xsync_extended_counter = FALSE;
+                c->xsync_enabled = TRUE;
+                break;
+            default:
+                c->xsync_counter = (XSyncCounter) data[1];
+                c->xsync_extended_counter = TRUE;
+                c->xsync_enabled = TRUE;
+                break;
+        }
+    }
+
+    if (data)
+    {
+        XFree (data);
+    }
+
+    return c->xsync_enabled;
 }
 
 void
@@ -142,6 +170,9 @@ clientXSyncClearTimeout (Client * c)
 
     TRACE ("entering clientXSyncClearTimeout");
 
+    c->xsync_waiting = FALSE;
+    clientReconfigure (c);
+
     if (c->xsync_timeout_id)
     {
         g_source_remove (c->xsync_timeout_id);
@@ -153,23 +184,17 @@ static gboolean
 clientXSyncTimeout (gpointer data)
 {
     Client *c;
-    XWindowChanges wc;
 
     TRACE ("entering clientXSyncTimeout");
 
     c = (Client *) data;
     if (c)
     {
-        TRACE ("XSync timeout for client \"%s\" (0x%lx)", c->name, c->window);
+        g_warning ("XSync timeout for client \"%s\" (0x%lx)", c->name, c->window);
         clientXSyncClearTimeout (c);
-        c->xsync_waiting = FALSE;
-        c->xsync_enabled = FALSE;
 
-        wc.x = c->x;
-        wc.y = c->y;
-        wc.width = c->width;
-        wc.height = c->height;
-        clientConfigure (c, &wc, CWX | CWY | CWWidth | CWHeight, NO_CFG_FLAG);
+        /* Disable XSync for this client */
+        c->xsync_enabled = FALSE;
     }
     return (FALSE);
 }
@@ -193,42 +218,57 @@ clientXSyncRequest (Client * c)
 {
     ScreenInfo *screen_info;
     DisplayInfo *display_info;
+    XSyncValue next_value;
+    XClientMessageEvent xev;
 
     g_return_if_fail (c != NULL);
     g_return_if_fail (c->window != None);
 
     TRACE ("entering clientXSyncRequest");
 
+    if (c->xsync_waiting)
+    {
+        return;
+    }
+
     screen_info = c->screen_info;
     display_info = screen_info->display_info;
 
-    clientIncrementXSyncValue (c);
-    sendXSyncRequest (display_info, c->window, c->xsync_value);
+    next_value = c->next_xsync_value;
+    addToXSyncValue (&next_value, XSYNC_VALUE_INCREMENT);
+    c->next_xsync_value = next_value;
+
+    xev.type = ClientMessage;
+    xev.window = c->window;
+    xev.message_type = display_info->atoms[WM_PROTOCOLS];
+    xev.format = 32;
+    xev.data.l[0] = (long) display_info->atoms[NET_WM_SYNC_REQUEST];
+    xev.data.l[1] = (long) myDisplayGetCurrentTime (display_info);
+    xev.data.l[2] = (long) XSyncValueLow32 (next_value);
+    xev.data.l[3] = (long) XSyncValueHigh32 (next_value);
+    xev.data.l[4] = (long) (c->xsync_extended_counter ? 1 : 0);
+    XSendEvent (display_info->dpy, c->window, FALSE, NoEventMask, (XEvent *) &xev);
+
     clientXSyncResetTimeout (c);
     c->xsync_waiting = TRUE;
 }
 
-gboolean
-clientXSyncEnable (Client * c)
+void
+clientXSyncUpdateValue (Client *c, XSyncValue value)
 {
-    ScreenInfo *screen_info;
-    DisplayInfo *display_info;
-
-    g_return_val_if_fail (c != NULL, FALSE);
-
-    TRACE ("entering clientXSyncEnable");
-
-    screen_info = c->screen_info;
-    display_info = screen_info->display_info;
+    g_return_if_fail (c != NULL);
+    TRACE ("entering clientXSyncUpdateValue");
 
-    c->xsync_enabled = FALSE;
-    if (display_info->have_xsync)
+    c->xsync_value = value;
+    if (c->xsync_extended_counter)
     {
-        if ((c->xsync_counter) && (c->xsync_alarm))
+        if (XSyncValueLow32(c->xsync_value) % 2 == 0)
         {
-            c->xsync_enabled = TRUE;
+            addToXSyncValue (&value, 1);
         }
     }
-    return (c->xsync_enabled);
+    c->next_xsync_value = value;
+    clientXSyncClearTimeout (c);
 }
+
 #endif /* HAVE_XSYNC */
diff --git a/src/xsync.h b/src/xsync.h
index a6ff878..574403f 100644
--- a/src/xsync.h
+++ b/src/xsync.h
@@ -17,7 +17,7 @@
 
 
         oroborus - (c) 2001 Ken Lynch
-        xfwm4    - (c) 2002-2011 Olivier Fourdan
+        xfwm4    - (c) 2002-2014 Olivier Fourdan
 
  */
 
@@ -45,18 +45,14 @@
 #define INC_XSYNC_H
 
 #ifdef HAVE_XSYNC
-gboolean                 getXSyncCounter                        (DisplayInfo *,
-                                                                 Window,
-                                                                 XSyncCounter *);
-void                     sendXSyncRequest                       (DisplayInfo *,
-                                                                 Window,
-                                                                 XSyncValue);
-void                     clientIncrementXSyncValue              (Client *);
 gboolean                 clientCreateXSyncAlarm                 (Client *);
 void                     clientDestroyXSyncAlarm                (Client *);
+gboolean                 clientGetXSyncCounter                  (Client *);
 void                     clientXSyncClearTimeout                (Client *);
 void                     clientXSyncRequest                     (Client *);
-gboolean                 clientXSyncEnable                      (Client *);
+void                     clientXSyncUpdateValue                 (Client *,
+                                                                 XSyncValue);
+
 #endif /* HAVE_XSYNC */
 
 #endif /* INC_XSYNC_H */

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list