[Xfce4-commits] r23584 - xfwm4/trunk/src
Olivier Fourdan
olivier at xfce.org
Wed Nov 1 19:02:16 CET 2006
Author: olivier
Date: 2006-11-01 18:02:10 +0000 (Wed, 01 Nov 2006)
New Revision: 23584
Modified:
xfwm4/trunk/src/client.c
xfwm4/trunk/src/client.h
xfwm4/trunk/src/display.c
xfwm4/trunk/src/display.h
xfwm4/trunk/src/events.c
xfwm4/trunk/src/hints.c
xfwm4/trunk/src/hints.h
xfwm4/trunk/src/main.c
Log:
Add support for XSync protocol.
Modified: xfwm4/trunk/src/client.c
===================================================================
--- xfwm4/trunk/src/client.c 2006-11-01 17:08:37 UTC (rev 23583)
+++ xfwm4/trunk/src/client.c 2006-11-01 18:02:10 UTC (rev 23584)
@@ -1063,7 +1063,93 @@
WM_FLAG_CONTEXT_HELP : 0);
}
+#ifdef HAVE_XSYNC
static void
+clientIncrementXSyncValue (Client *c)
+{
+ XSyncValue add;
+ int overflow;
+
+ g_return_if_fail (c != NULL);
+ g_return_if_fail (c->xsync_counter != None);
+
+ XSyncIntToValue (&add, 1);
+ XSyncValueAdd (&c->xsync_value, c->xsync_value, add, &overflow);
+}
+
+static void
+clientCreateXSyncAlarm (Client *c)
+{
+ ScreenInfo *screen_info;
+ DisplayInfo *display_info;
+ XSyncAlarmAttributes values;
+ XSyncValue wait_value;
+
+ g_return_if_fail (c != NULL);
+ g_return_if_fail (c->xsync_counter != None);
+
+ TRACE ("entering clientCreateXSyncAlarm");
+
+ 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);
+
+ values.trigger.counter = c->xsync_counter;
+ values.trigger.value_type = XSyncAbsolute;
+ values.trigger.test_type = XSyncPositiveComparison;
+ values.events = True;
+
+ c->xsync_alarm = XSyncCreateAlarm (display_info->dpy,
+ XSyncCACounter |
+ XSyncCADelta |
+ XSyncCAEvents |
+ XSyncCATestType |
+ XSyncCAValue |
+ XSyncCAValueType,
+ &values);
+}
+
+clientDestroyXSyncAlarm (Client *c)
+{
+ ScreenInfo *screen_info;
+ DisplayInfo *display_info;
+
+ g_return_if_fail (c != NULL);
+ g_return_if_fail (c->xsync_alarm != None);
+
+ TRACE ("entering clientClearXSyncAlarm");
+
+ screen_info = c->screen_info;
+ display_info = screen_info->display_info;
+
+ XSyncDestroyAlarm (display_info->dpy, c->xsync_alarm);
+ c->xsync_alarm = None;
+}
+
+void
+clientXSyncRequest (Client * c)
+{
+ ScreenInfo *screen_info;
+ DisplayInfo *display_info;
+
+ TRACE ("entering clientXSyncRequest");
+ g_return_if_fail (c != NULL);
+ g_return_if_fail (c->window != None);
+
+ screen_info = c->screen_info;
+ display_info = screen_info->display_info;
+
+ clientIncrementXSyncValue (c);
+ sendXSyncRequest (display_info, c->window, c->xsync_value);
+ c->xsync_waiting = TRUE;
+}
+#endif /* HAVE_XSYNC */
+
+static void
clientFree (Client * c)
{
g_return_if_fail (c != NULL);
@@ -1091,6 +1177,12 @@
{
g_free (c->name);
}
+#ifdef HAVE_XSYNC
+ if (c->xsync_alarm != None)
+ {
+ clientDestroyXSyncAlarm (c);
+ }
+#endif /* HAVE_XSYNC */
#ifdef HAVE_LIBSTARTUP_NOTIFICATION
if (c->startup_id)
{
@@ -1428,7 +1520,7 @@
}
TRACE ("No systray found for this screen");
}
-#endif
+#endif /* ENABLE_KDE_SYSTRAY_PROXY */
if (attr.override_redirect)
{
@@ -1468,8 +1560,19 @@
#ifdef HAVE_LIBSTARTUP_NOTIFICATION
c->startup_id = NULL;
-#endif
+#endif /* HAVE_LIBSTARTUP_NOTIFICATION */
+#ifdef HAVE_XSYNC
+ c->xsync_waiting = FALSE;
+ c->xsync_counter = None;
+ getXSyncCounter (display_info, c->window, &c->xsync_counter);
+ c->xsync_alarm = None;
+ if (c->xsync_counter)
+ {
+ clientCreateXSyncAlarm (c);
+ }
+#endif /* HAVE_XSYNC */
+
clientGetWMNormalHints (c, FALSE);
c->size->x = c->x;
@@ -3780,6 +3883,51 @@
}
}
+static clientResizeConfigure (Client *c, int px, int py, int pw, int ph)
+{
+ XWindowChanges wc;
+ unsigned long value_mask;
+
+ value_mask = 0L;
+ if (c->x != px)
+ {
+ value_mask |= CWX;
+ }
+ if (c->y != py)
+ {
+ value_mask |= CWY;
+ }
+ if (c->width != pw)
+ {
+ value_mask |= CWWidth;
+ }
+ if (c->height != ph)
+ {
+ value_mask |= CWHeight;
+ }
+ if (!value_mask)
+ {
+ return;
+ }
+
+#ifdef HAVE_XSYNC
+ if (!c->xsync_waiting)
+ {
+ if ((c->xsync_counter) && (value_mask & (CWWidth | CWHeight)))
+ {
+ clientXSyncRequest (c);
+ }
+#endif /* HAVE_XSYNC */
+ wc.x = c->x;
+ wc.y = c->y;
+ wc.width = c->width;
+ wc.height = c->height;
+ clientConfigure (c, &wc, value_mask, NO_CFG_FLAG);
+#ifdef HAVE_XSYNC
+ }
+#endif /* HAVE_XSYNC */
+}
+
static eventFilterStatus
clientResizeEventFilter (XEvent * xevent, gpointer data)
{
@@ -3789,9 +3937,7 @@
GdkRectangle rect;
MoveResizeData *passdata;
eventFilterStatus status;
- XWindowChanges wc;
- unsigned long configure_flags;
- int prev_y, prev_x, prev_height, prev_width;
+ int prev_x, prev_y, prev_width, prev_height;
int cx, cy, disp_x, disp_y, disp_max_x, disp_max_y;
int frame_x, frame_y, frame_height, frame_width;
int frame_top, frame_left, frame_right, frame_bottom;
@@ -3808,7 +3954,6 @@
display_info = screen_info->display_info;
status = EVENT_FILTER_STOP;
resizing = TRUE;
- configure_flags = 0L;
frame_x = frameX (c);
frame_y = frameY (c);
@@ -3848,6 +3993,12 @@
disp_max_x = rect.x + rect.width;
disp_max_y = rect.y + rect.height;
+ /* Store previous values in case the resize puts the window title off bounds */
+ prev_x = c->x;
+ prev_y = c->y;
+ prev_width = c->width;
+ prev_height = c->height;
+
/* Update the display time */
myDisplayUpdateCurrentTime (display_info, xevent);
@@ -3885,46 +4036,37 @@
{
clientDrawOutline (c);
}
- /* Store previous height in case the resize hides the window behind the curtain */
- prev_width = c->width;
- prev_height = c->height;
if (!FLAG_TEST (c->flags, CLIENT_FLAG_SHADED)
&& (xevent->xkey.keycode == screen_info->params->keys[KEY_MOVE_UP].keycode))
{
c->height = c->height - key_height_inc;
- configure_flags |= CWHeight;
corner = CORNER_COUNT + SIDE_BOTTOM;
}
else if (!FLAG_TEST (c->flags, CLIENT_FLAG_SHADED)
&& (xevent->xkey.keycode == screen_info->params->keys[KEY_MOVE_DOWN].keycode))
{
c->height = c->height + key_height_inc;
- configure_flags |= CWHeight;
corner = CORNER_COUNT + SIDE_BOTTOM;
}
else if (xevent->xkey.keycode == screen_info->params->keys[KEY_MOVE_LEFT].keycode)
{
c->width = c->width - key_width_inc;
- configure_flags |= CWWidth;
corner = CORNER_COUNT + SIDE_RIGHT;
}
else if (xevent->xkey.keycode == screen_info->params->keys[KEY_MOVE_RIGHT].keycode)
{
c->width = c->width + key_width_inc;
- configure_flags |= CWWidth;
corner = CORNER_COUNT + SIDE_RIGHT;
}
if (corner >= 0)
{
clientConstrainRatio (c, c->width, c->height, corner);
- configure_flags |= CWWidth | CWHeight;
}
if (!clientCkeckTitle (c))
{
c->height = prev_height;
c->width = prev_width;
- configure_flags |= CWWidth | CWHeight;
}
else
{
@@ -3932,13 +4074,11 @@
|| (c->x + c->width < screen_info->margins [LEFT] + min_visible))
{
c->width = prev_width;
- configure_flags |= CWWidth;
}
if ((c->y + c->height < disp_y + min_visible)
|| (c->y + c->height < screen_info->margins [TOP] + min_visible))
{
c->height = prev_height;
- configure_flags |= CWHeight;
}
}
if (passdata->poswin)
@@ -3951,11 +4091,7 @@
}
else
{
- wc.x = c->x;
- wc.y = c->y;
- wc.width = c->width;
- wc.height = c->height;
- clientConfigure (c, &wc, configure_flags, NO_CFG_FLAG);
+ clientResizeConfigure (c, prev_x, prev_y, prev_width, prev_height);
}
}
}
@@ -3975,27 +4111,20 @@
if (move_left)
{
c->x += c->width - passdata->cancel_x;
- configure_flags |= CWX;
}
if (move_top)
{
c->y += c->height - passdata->cancel_y;
- configure_flags |= CWY;
}
c->width = passdata->cancel_x;
c->height = passdata->cancel_y;
- configure_flags |= CWWidth | CWHeight;
if (screen_info->params->box_resize)
{
clientDrawOutline (c);
}
else
{
- wc.x = c->x;
- wc.y = c->y;
- wc.width = c->width;
- wc.height = c->height;
- clientConfigure (c, &wc, configure_flags, NO_CFG_FLAG);
+ clientResizeConfigure (c, prev_x, prev_y, prev_width, prev_height);
}
}
else if (passdata->use_keys)
@@ -4030,33 +4159,24 @@
}
passdata->oldw = c->width;
passdata->oldh = c->height;
- /* Store previous values in case the resize puts the window title off bounds */
- prev_x = c->x;
- prev_y = c->y;
- prev_width = c->width;
- prev_height = c->height;
if (move_left)
{
c->width = passdata->ox - (xevent->xmotion.x_root - passdata->mx);
- configure_flags |= CWWidth;
}
else if (move_right)
{
c->width = passdata->ox + (xevent->xmotion.x_root - passdata->mx);
- configure_flags |= CWWidth;
}
if (!FLAG_TEST (c->flags, CLIENT_FLAG_SHADED))
{
if (move_top)
{
c->height = passdata->oy - (xevent->xmotion.y_root - passdata->my);
- configure_flags |= CWHeight;
}
else if (move_bottom)
{
c->height = passdata->oy + (xevent->xmotion.y_root - passdata->my);
- configure_flags |= CWHeight;
}
}
clientConstrainRatio (c, c->width, c->height, passdata->corner);
@@ -4065,13 +4185,11 @@
if (move_left)
{
c->x = c->x - (c->width - passdata->oldw);
- configure_flags |= CWX;
frame_x = frameX (c);
}
if (move_top && !clientCkeckTitle (c))
{
c->x = prev_x;
- configure_flags |= CWX;
c->width = prev_width;
}
@@ -4079,13 +4197,11 @@
if (!FLAG_TEST (c->flags, CLIENT_FLAG_SHADED) && move_top)
{
c->y = c->y - (c->height - passdata->oldh);
- configure_flags |= CWY;
frame_y = frameY (c);
}
if (move_top && !clientCkeckTitle (c))
{
c->y = prev_y;
- configure_flags |= CWY;
c->height = prev_height;
}
if (move_top)
@@ -4096,7 +4212,6 @@
{
c->y = prev_y;
c->height = prev_height;
- configure_flags |= CWY | CWHeight;
}
}
else if (move_bottom)
@@ -4105,7 +4220,6 @@
|| (c->y + c->height < screen_info->margins [TOP] + min_visible))
{
c->height = prev_height;
- configure_flags |= CWHeight;
}
}
if (move_left)
@@ -4116,7 +4230,6 @@
{
c->x = prev_x;
c->width = prev_width;
- configure_flags |= CWX | CWWidth;
}
}
else if (move_right)
@@ -4125,7 +4238,6 @@
|| (c->x + c->width < screen_info->margins [LEFT] + min_visible))
{
c->width = prev_width;
- configure_flags |= CWWidth;
}
}
@@ -4139,11 +4251,7 @@
}
else
{
- wc.x = c->x;
- wc.y = c->y;
- wc.width = c->width;
- wc.height = c->height;
- clientConfigure (c, &wc, configure_flags, NO_CFG_FLAG);
+ clientResizeConfigure (c, prev_x, prev_y, prev_width, prev_height);
}
}
@@ -4295,7 +4403,9 @@
wc.width = c->width;
wc.height = c->height;
clientConfigure (c, &wc, CWX | CWY | CWHeight | CWWidth, CFG_NOTIFY);
-
+#ifdef HAVE_XSYNC
+ c->xsync_waiting = FALSE;
+#endif /* HAVE_XSYNC */
myScreenUngrabKeyboard (screen_info, myDisplayGetCurrentTime (display_info));
if (!passdata.released)
{
Modified: xfwm4/trunk/src/client.h
===================================================================
--- xfwm4/trunk/src/client.h 2006-11-01 17:08:37 UTC (rev 23583)
+++ xfwm4/trunk/src/client.h 2006-11-01 18:02:10 UTC (rev 23584)
@@ -272,6 +272,13 @@
/* Startup notification */
gchar *startup_id;
#endif /* HAVE_LIBSTARTUP_NOTIFICATION */
+
+#ifdef HAVE_XSYNC
+ XSyncAlarm xsync_alarm;
+ XSyncCounter xsync_counter;
+ XSyncValue xsync_value;
+ gboolean xsync_waiting;
+#endif /* HAVE_XSYNC */
};
extern Client *clients;
@@ -332,6 +339,8 @@
#ifdef HAVE_LIBSTARTUP_NOTIFICATION
char *clientGetStartupId (Client *);
#endif /* HAVE_LIBSTARTUP_NOTIFICATION */
+#ifdef HAVE_XSYNC
+void clientXSyncRequest (Client *);
+#endif /* HAVE_XSYNC */
-
#endif /* INC_CLIENT_H */
Modified: xfwm4/trunk/src/display.c
===================================================================
--- xfwm4/trunk/src/display.c 2006-11-01 17:08:37 UTC (rev 23583)
+++ xfwm4/trunk/src/display.c 2006-11-01 18:02:10 UTC (rev 23584)
@@ -130,6 +130,8 @@
"_NET_WM_STATE_STICKY",
"_NET_WM_STRUT",
"_NET_WM_STRUT_PARTIAL",
+ "_NET_WM_SYNC_REQUEST",
+ "_NET_WM_SYNC_REQUEST_COUNTER",
"_NET_WM_USER_TIME",
"_NET_WM_WINDOW_TYPE",
"_NET_WM_WINDOW_TYPE_DESKTOP",
@@ -181,6 +183,9 @@
myDisplayInit (GdkDisplay *gdisplay)
{
DisplayInfo *display;
+#ifdef HAVE_XSYNC
+ int xsync_major, xsync_minor;
+#endif /* HAVE_XSYNC */
int dummy;
display = g_new0 (DisplayInfo, 1);
@@ -214,6 +219,33 @@
display->shape_event_base = 0;
}
+#ifdef HAVE_XSYNC
+ display->have_xsync = FALSE;
+
+ display->xsync_error_base = 0;
+ display->xsync_event_base = 0;
+
+ xsync_major = SYNC_MAJOR_VERSION;
+ xsync_minor = SYNC_MINOR_VERSION;
+
+ if (XSyncQueryExtension (display->dpy,
+ &display->xsync_event_base,
+ &display->xsync_error_base)
+ && XSyncInitialize (display->dpy,
+ &xsync_major,
+ &xsync_minor))
+ {
+ display->have_xsync = TRUE;
+ }
+ else
+ {
+ g_warning ("The display does not support the XSync extension.");
+ display->have_xsync = FALSE;
+ display->xsync_event_base = 0;
+ display->xsync_error_base = 0;
+ }
+#endif /* HAVE_XSYNC */
+
#ifdef HAVE_RENDER
if (XRenderQueryExtension (display->dpy,
&display->render_event_base,
@@ -228,9 +260,9 @@
display->render_event_base = 0;
display->render_error_base = 0;
}
-#else
+#else /* HAVE_RENDER */
display->have_render = FALSE;
-#endif
+#endif /* HAVE_RENDER */
#ifdef HAVE_RANDR
if (XRRQueryExtension (display->dpy,
@@ -246,9 +278,9 @@
display->xrandr_event_base = 0;
display->xrandr_error_base = 0;
}
-#else
+#else /* HAVE_RANDR */
display->have_xrandr = FALSE;
-#endif
+#endif /* HAVE_RANDR */
display->root_cursor =
XCreateFontCursor (display->dpy, CURSOR_ROOT);
@@ -589,8 +621,31 @@
return NULL;
}
-#endif
+#endif /* ENABLE_KDE_SYSTRAY_PROXY */
+#ifdef HAVE_XSYNC
+Client *
+myDisplayGetClientFromXSyncAlarm (DisplayInfo *display, XSyncAlarm alarm)
+{
+ GSList *index;
+
+ g_return_val_if_fail (alarm != None, NULL);
+ g_return_val_if_fail (display != NULL, NULL);
+
+ for (index = display->clients; index; index = g_slist_next (index))
+ {
+ Client *c = (Client *) index->data;
+ if (alarm == c->xsync_alarm)
+ {
+ return (c);
+ }
+ }
+ TRACE ("no client found");
+
+ return NULL;
+}
+#endif /* HAVE_XSYNC */
+
ScreenInfo *
myDisplayGetDefaultScreen (DisplayInfo *display)
{
Modified: xfwm4/trunk/src/display.h
===================================================================
--- xfwm4/trunk/src/display.h 2006-11-01 17:08:37 UTC (rev 23583)
+++ xfwm4/trunk/src/display.h 2006-11-01 18:02:10 UTC (rev 23584)
@@ -32,8 +32,12 @@
#ifdef HAVE_RANDR
#include <X11/extensions/Xrandr.h>
-#endif
+#endif /* HAVE_RANDR */
+#ifdef HAVE_XSYNC
+#include <X11/extensions/sync.h>
+#endif /* HAVE_XSYNC */
+
#ifdef HAVE_COMPOSITOR
#include <X11/extensions/Xcomposite.h>
#include <X11/extensions/Xdamage.h>
@@ -145,6 +149,8 @@
NET_WM_STATE_STICKY,
NET_WM_STRUT,
NET_WM_STRUT_PARTIAL,
+ NET_WM_SYNC_REQUEST,
+ NET_WM_SYNC_REQUEST_COUNTER,
NET_WM_USER_TIME,
NET_WM_WINDOW_TYPE,
NET_WM_WINDOW_TYPE_DESKTOP,
@@ -217,6 +223,7 @@
gboolean have_shape;
gboolean have_render;
gboolean have_xrandr;
+ gboolean have_xsync;
gint shape_event_base;
gint dbl_click_time;
gint xgrabcount;
@@ -230,11 +237,15 @@
#ifdef HAVE_RENDER
gint render_error_base;
gint render_event_base;
-#endif
+#endif /* HAVE_RENDER */
#ifdef HAVE_RANDR
gint xrandr_error_base;
gint xrandr_event_base;
-#endif
+#endif /* HAVE_RANDR */
+#ifdef HAVE_XSYNC
+ gint xsync_event_base;
+ gint xsync_error_base;
+#endif /* HAVE_XSYNC */
#ifdef HAVE_COMPOSITOR
gint composite_error_base;
gint composite_event_base;
@@ -258,48 +269,52 @@
#endif /* HAVE_COMPOSITOR */
};
-DisplayInfo * myDisplayInit (GdkDisplay *);
-DisplayInfo * myDisplayClose (DisplayInfo *);
-gboolean myDisplayHaveShape (DisplayInfo *);
-gboolean myDisplayHaveRender (DisplayInfo *);
-Cursor myDisplayGetCursorBusy (DisplayInfo *);
-Cursor myDisplayGetCursorMove (DisplayInfo *);
-Cursor myDisplayGetCursorRoot (DisplayInfo *);
-Cursor myDisplayGetCursorResize (DisplayInfo *,
- guint);
-void myDisplayGrabServer (DisplayInfo *);
-void myDisplayUngrabServer (DisplayInfo *);
-void myDisplayAddClient (DisplayInfo *,
- Client *);
-void myDisplayRemoveClient (DisplayInfo *,
- Client *);
-Client * myDisplayGetClientFromWindow (DisplayInfo *,
- Window,
- int);
-void myDisplayAddScreen (DisplayInfo *,
- ScreenInfo *);
-void myDisplayRemoveScreen (DisplayInfo *,
- ScreenInfo *);
-ScreenInfo * myDisplayGetScreenFromRoot (DisplayInfo *,
- Window);
-ScreenInfo * myDisplayGetScreenFromNum (DisplayInfo *,
- int);
-Window myDisplayGetRootFromWindow (DisplayInfo *,
- Window w);
-ScreenInfo * myDisplayGetScreenFromWindow (DisplayInfo *,
- Window w);
+DisplayInfo * myDisplayInit (GdkDisplay *);
+DisplayInfo * myDisplayClose (DisplayInfo *);
+gboolean myDisplayHaveShape (DisplayInfo *);
+gboolean myDisplayHaveRender (DisplayInfo *);
+Cursor myDisplayGetCursorBusy (DisplayInfo *);
+Cursor myDisplayGetCursorMove (DisplayInfo *);
+Cursor myDisplayGetCursorRoot (DisplayInfo *);
+Cursor myDisplayGetCursorResize (DisplayInfo *,
+ guint);
+void myDisplayGrabServer (DisplayInfo *);
+void myDisplayUngrabServer (DisplayInfo *);
+void myDisplayAddClient (DisplayInfo *,
+ Client *);
+void myDisplayRemoveClient (DisplayInfo *,
+ Client *);
+Client * myDisplayGetClientFromWindow (DisplayInfo *,
+ Window,
+ int);
+void myDisplayAddScreen (DisplayInfo *,
+ ScreenInfo *);
+void myDisplayRemoveScreen (DisplayInfo *,
+ ScreenInfo *);
+ScreenInfo * myDisplayGetScreenFromRoot (DisplayInfo *,
+ Window);
+ScreenInfo * myDisplayGetScreenFromNum (DisplayInfo *,
+ int);
+Window myDisplayGetRootFromWindow (DisplayInfo *,
+ Window w);
+ScreenInfo * myDisplayGetScreenFromWindow (DisplayInfo *,
+ Window w);
#ifdef ENABLE_KDE_SYSTRAY_PROXY
-ScreenInfo * myDisplayGetScreenFromSystray (DisplayInfo *,
- Window);
-#endif
-ScreenInfo * myDisplayGetDefaultScreen (DisplayInfo *);
-Time myDisplayUpdateCurrentTime (DisplayInfo *,
- XEvent *);
-Time myDisplayGetCurrentTime (DisplayInfo *);
-Time myDisplayGetLastUserTime (DisplayInfo *);
-void myDisplaySetLastUserTime (DisplayInfo *,
- Time);
-gboolean myDisplayTestXrender (DisplayInfo *,
- gdouble);
+ScreenInfo * myDisplayGetScreenFromSystray (DisplayInfo *,
+ Window);
+#endif /* ENABLE_KDE_SYSTRAY_PROXY */
+#ifdef HAVE_XSYNC
+Client * myDisplayGetClientFromXSyncAlarm (DisplayInfo *,
+ XSyncAlarm);
+#endif /* HAVE_XSYNC */
+ScreenInfo * myDisplayGetDefaultScreen (DisplayInfo *);
+Time myDisplayUpdateCurrentTime (DisplayInfo *,
+ XEvent *);
+Time myDisplayGetCurrentTime (DisplayInfo *);
+Time myDisplayGetLastUserTime (DisplayInfo *);
+void myDisplaySetLastUserTime (DisplayInfo *,
+ Time);
+gboolean myDisplayTestXrender (DisplayInfo *,
+ gdouble);
#endif /* INC_DISPLAY_H */
Modified: xfwm4/trunk/src/events.c
===================================================================
--- xfwm4/trunk/src/events.c 2006-11-01 17:08:37 UTC (rev 23583)
+++ xfwm4/trunk/src/events.c 2006-11-01 18:02:10 UTC (rev 23584)
@@ -1912,7 +1912,15 @@
}
getWindowStartupId (display_info, c->window, &c->startup_id);
}
-#endif
+#endif /* HAVE_STARTUP_NOTIFICATION */
+#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);
+ }
+#endif /* HAVE_XSYNC */
+
return;
}
@@ -2219,7 +2227,30 @@
}
}
+#ifdef HAVE_XSYNC
static void
+handleXSyncAlarmNotify (DisplayInfo *display_info, XSyncAlarmNotifyEvent * ev)
+{
+ XWindowChanges wc;
+ Client *c;
+
+ TRACE ("entering handleXSyncAlarmNotify");
+
+ c = myDisplayGetClientFromXSyncAlarm (display_info, ev->alarm);
+ if (c)
+ {
+ c->xsync_waiting = FALSE;
+ c->xsync_value = ev->counter_value;
+ 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);
+ }
+}
+#endif /* HAVE_XSYNC */
+
+static void
handleEvent (DisplayInfo *display_info, XEvent * ev)
{
TRACE ("entering handleEvent");
@@ -2290,6 +2321,12 @@
{
handleShape (display_info, (XShapeEvent *) ev);
}
+#ifdef HAVE_XSYNC
+ if ((display_info->have_xsync) && (ev->type == (display_info->xsync_event_base + XSyncAlarmNotify)))
+ {
+ handleXSyncAlarmNotify (display_info, (XSyncAlarmNotifyEvent *) ev);
+ }
+#endif /* HAVE_XSYNC */
}
if (!gdk_events_pending () && !XPending (display_info->dpy))
{
Modified: xfwm4/trunk/src/hints.c
===================================================================
--- xfwm4/trunk/src/hints.c 2006-11-01 17:08:37 UTC (rev 23583)
+++ xfwm4/trunk/src/hints.c 2006-11-01 18:02:10 UTC (rev 23584)
@@ -442,6 +442,8 @@
atoms[i++] = display_info->atoms[NET_WM_STATE_STICKY];
atoms[i++] = display_info->atoms[NET_WM_STRUT];
atoms[i++] = display_info->atoms[NET_WM_STRUT_PARTIAL];
+ atoms[i++] = display_info->atoms[NET_WM_SYNC_REQUEST];
+ atoms[i++] = display_info->atoms[NET_WM_SYNC_REQUEST_COUNTER];
atoms[i++] = display_info->atoms[NET_WM_USER_TIME];
atoms[i++] = display_info->atoms[NET_WM_WINDOW_TYPE];
atoms[i++] = display_info->atoms[NET_WM_WINDOW_TYPE_DESKTOP];
@@ -456,7 +458,7 @@
#ifdef HAVE_LIBSTARTUP_NOTIFICATION
atoms[i++] = display_info->atoms[NET_STARTUP_ID];
#endif
-
+ g_assert (i < 64);
data[0] = check_win;
XChangeProperty (display_info->dpy, root, display_info->atoms[NET_SUPPORTED],
XA_ATOM, 32, PropModeReplace, (unsigned char *) atoms, i);
@@ -1255,3 +1257,44 @@
return FALSE;
}
#endif
+
+#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 getXSyncCounter");
+
+ xev.type = ClientMessage;
+ xev.window = window;
+ xev.message_type = display_info->atoms[WM_PROTOCOLS];
+ xev.format = 32;
+ xev.data.l[0] = display_info->atoms[NET_WM_SYNC_REQUEST];
+ xev.data.l[1] = CurrentTime;
+ xev.data.l[2] = XSyncValueLow32 (value);
+ xev.data.l[3] = XSyncValueHigh32 (value);
+ xev.data.l[4] = 0;
+ XSendEvent (display_info->dpy, window, FALSE, NoEventMask, (XEvent *) &xev);
+}
+#endif /* HAVE_XSYNC */
Modified: xfwm4/trunk/src/hints.h
===================================================================
--- xfwm4/trunk/src/hints.h 2006-11-01 17:08:37 UTC (rev 23583)
+++ xfwm4/trunk/src/hints.h 2006-11-01 18:02:10 UTC (rev 23584)
@@ -191,4 +191,9 @@
gboolean getWindowStartupId (DisplayInfo *, Window, char **);
#endif
+#ifdef HAVE_XSYNC
+gboolean getXSyncCounter (DisplayInfo *, Window, XSyncCounter *);
+void sendXSyncRequest (DisplayInfo *, Window, XSyncValue);
+#endif /* HAVE_XSYNC */
+
#endif /* INC_HINTS_H */
Modified: xfwm4/trunk/src/main.c
===================================================================
--- xfwm4/trunk/src/main.c 2006-11-01 17:08:37 UTC (rev 23583)
+++ xfwm4/trunk/src/main.c 2006-11-01 18:02:10 UTC (rev 23584)
@@ -285,6 +285,13 @@
g_print ("No\n");
#endif
+ g_print ("\t- XSync support: ");
+#ifdef HAVE_XSYNC
+ g_print ("Yes\n");
+#else
+ g_print ("No\n");
+#endif
+
g_print ("\t- Render support: ");
#ifdef HAVE_RENDER
g_print ("Yes\n");
@@ -305,6 +312,7 @@
#else
g_print ("No\n");
#endif
+
g_print ("\t- KDE systray proxy (deprecated): ");
#ifdef ENABLE_KDE_SYSTRAY_PROXY
g_print ("Yes\n");
More information about the Xfce4-commits
mailing list