Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h events.c ewins.h icccm.c mod-misc.c 


Log Message:
Shuffle _NET_WM_SYNC_REQUEST support stuff around (still not active).

===================================================================
RCS file: /cvs/e/e16/e/src/E.h,v
retrieving revision 1.560
retrieving revision 1.561
diff -u -3 -r1.560 -r1.561
--- E.h 24 Jul 2006 21:10:58 -0000      1.560
+++ E.h 23 Aug 2006 19:06:21 -0000      1.561
@@ -389,6 +389,7 @@
       char                argb_internal_clients;
       char                argb_clients;
       char                argb_clients_inherit_attr;
+      char                use_sync;
    } testing;
    int                 deskmode;
    char                animate_shading;
@@ -425,6 +426,9 @@
 #ifdef HAS_XINERAMA
       char                xinerama_active;
 #endif
+#if USE_XSYNC
+      XID                 server_time;
+#endif
    } display;
    struct
    {
@@ -652,6 +656,7 @@
 #define EDBUG_TYPE_EVENTS       142
 #define EDBUG_TYPE_ICONBOX      143
 #define EDBUG_TYPE_VERBOSE      144
+#define EDBUG_TYPE_SYNC         145
 
 int                 EventDebug(unsigned int type);
 void                EventDebugSet(unsigned int type, int value);
===================================================================
RCS file: /cvs/e/e16/e/src/events.c,v
retrieving revision 1.125
retrieving revision 1.126
diff -u -3 -r1.125 -r1.126
--- events.c    7 Aug 2006 23:19:17 -0000       1.125
+++ events.c    23 Aug 2006 19:06:21 -0000      1.126
@@ -88,23 +88,27 @@
 static void
 ExtInitSync(int available)
 {
+   int                 i, num;
+   XSyncSystemCounter *xssc;
+
    if (!available)
       return;
 
-   if (EventDebug(EDBUG_TYPE_VERBOSE))
+   xssc = XSyncListSystemCounters(disp, &num);
+   for (i = 0; i < num; i++)
      {
-       int                 i, num;
-       XSyncSystemCounter *xssc;
-
-       xssc = XSyncListSystemCounters(disp, &num);
-       for (i = 0; i < num; i++)
-         {
-            Eprintf(" Sync counter %2d: %10s %#lx %#x:%#x\n", i,
-                    xssc[i].name, xssc[i].counter,
-                    XSyncValueHigh32(xssc[i].resolution),
-                    XSyncValueLow32(xssc[i].resolution));
-         }
+       if (!strcmp(xssc[i].name, "SERVERTIME"))
+          Mode.display.server_time = xssc[i].counter;
+       if (EventDebug(EDBUG_TYPE_SYNC))
+          Eprintf(" Sync counter %2d: %10s %#lx %#x:%#x\n", i,
+                  xssc[i].name, xssc[i].counter,
+                  XSyncValueHigh32(xssc[i].resolution),
+                  XSyncValueLow32(xssc[i].resolution));
      }
+   XSyncFreeSystemCounterList(xssc);
+
+   if (Mode.display.server_time == None)
+      Conf.testing.use_sync = 0;
 }
 #endif
 
===================================================================
RCS file: /cvs/e/e16/e/src/ewins.h,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -3 -r1.55 -r1.56
--- ewins.h     7 Aug 2006 20:26:05 -0000       1.55
+++ ewins.h     23 Aug 2006 19:06:21 -0000      1.56
@@ -391,6 +391,12 @@
 EWin              **EwinListTransients(const EWin * ewin, int *num, int group);
 EWin              **EwinListTransientFor(const EWin * ewin, int *num);
 
+/* icccm.c (for now) */
+#if USE_XSYNC
+int                 EwinSyncRequestSend(EWin * ewin);
+void                EwinSyncRequestWait(EWin * ewin);
+#endif
+
 /* session.c */
 void                SessionGetInfo(EWin * ewin, Atom atom_change);
 
===================================================================
RCS file: /cvs/e/e16/e/src/icccm.c,v
retrieving revision 1.128
retrieving revision 1.129
diff -u -3 -r1.128 -r1.129
--- icccm.c     9 Aug 2006 02:45:02 -0000       1.128
+++ icccm.c     23 Aug 2006 19:06:21 -0000      1.129
@@ -29,11 +29,10 @@
 #include "session.h"
 #include "xwin.h"
 #if USE_XSYNC
+#include "timers.h"
 #include <X11/extensions/sync.h>
 #endif
 
-#undef USE_XSYNC               /* No - Not sure this is safe */
-
 static void         ICCCM_SetIconSizes(void);
 
 void
@@ -264,24 +263,6 @@
    if (EwinIsInternal(ewin))
       return;
 
-#if USE_XSYNC
-   if (ewin->ewmh.sync_request_enable && !EServerIsGrabbed())
-     {
-       long long           count;
-
-       count = ++ewin->ewmh.sync_request_count;
-
-       if (count == 0)
-          ewin->ewmh.sync_request_count = ++count;
-       ecore_x_client_message32_send(EwinGetClientXwin(ewin),
-                                     ECORE_X_ATOM_WM_PROTOCOLS,
-                                     StructureNotifyMask,
-                                     ECORE_X_ATOM_NET_WM_SYNC_REQUEST,
-                                     Mode.events.time,
-                                     count & 0xffffffff, count >> 32, 0);
-     }
-#endif
-
    ev.type = ConfigureNotify;
    ev.xconfigure.display = disp;
    ev.xconfigure.event = EwinGetClientXwin(ewin);
@@ -306,24 +287,6 @@
    ev.xconfigure.above = EoGetXwin(ewin);
    ev.xconfigure.override_redirect = False;
    XSendEvent(disp, EwinGetClientXwin(ewin), False, StructureNotifyMask, &ev);
-
-#if USE_XSYNC
-   if (ewin->ewmh.sync_request_enable && !EServerIsGrabbed())
-     {
-       XSyncWaitCondition  xswc[1];
-
-       xswc[0].trigger.counter = ewin->ewmh.sync_request_counter;
-       xswc[0].trigger.value_type = XSyncAbsolute;
-       XSyncIntsToValue(&xswc[0].trigger.wait_value,
-                        ewin->ewmh.sync_request_count & 0xffffffff,
-                        ewin->ewmh.sync_request_count >> 32);
-       xswc[0].trigger.test_type = XSyncPositiveComparison;
-       XSyncIntsToValue(&xswc[0].event_threshold, 0, 0);
-       Eprintf("Sync t=%#lx c=%llx\n", xswc[0].trigger.counter,
-               ewin->ewmh.sync_request_count);
-       XSyncAwait(disp, xswc, 1);
-     }
-#endif
 }
 
 void
@@ -807,3 +770,60 @@
    ICCCM_Cmap(ewin);
    ICCCM_GetGeoms(ewin, atom_change);
 }
+
+#if USE_XSYNC
+int
+EwinSyncRequestSend(EWin * ewin)
+{
+   long long           count;
+
+   if (!Conf.testing.use_sync || !ewin->ewmh.sync_request_enable ||
+       EServerIsGrabbed())
+      return 0;
+
+   count = ++ewin->ewmh.sync_request_count;
+
+   if (count == 0)
+      ewin->ewmh.sync_request_count = ++count;
+   ecore_x_client_message32_send(EwinGetClientXwin(ewin),
+                                ECORE_X_ATOM_WM_PROTOCOLS,
+                                StructureNotifyMask,
+                                ECORE_X_ATOM_NET_WM_SYNC_REQUEST,
+                                Mode.events.time,
+                                count & 0xffffffff, count >> 32, 0);
+
+   return 1;
+}
+
+void
+EwinSyncRequestWait(EWin * ewin)
+{
+   XSyncWaitCondition  xswc[2];
+   double              t;
+
+   if (!Conf.testing.use_sync || !ewin->ewmh.sync_request_enable ||
+       EServerIsGrabbed())
+      return;
+
+   xswc[0].trigger.counter = ewin->ewmh.sync_request_counter;
+   xswc[0].trigger.value_type = XSyncAbsolute;
+   XSyncIntsToValue(&xswc[0].trigger.wait_value,
+                   ewin->ewmh.sync_request_count & 0xffffffff,
+                   ewin->ewmh.sync_request_count >> 32);
+   xswc[0].trigger.test_type = XSyncPositiveComparison;
+   XSyncIntsToValue(&xswc[0].event_threshold, 0, 0);
+
+   xswc[1].trigger.counter = Mode.display.server_time;
+   xswc[1].trigger.value_type = XSyncRelative;
+   XSyncIntsToValue(&xswc[1].trigger.wait_value, 1000, 0);     /* 1 sec */
+   xswc[1].trigger.test_type = XSyncPositiveComparison;
+   XSyncIntsToValue(&xswc[1].event_threshold, 0, 0);
+
+   t = GetTime();
+   XSyncAwait(disp, xswc, 2);
+   if (EventDebug(EDBUG_TYPE_SYNC))
+      Eprintf("Sync t=%#lx c=%llx: Delay=%8.6lf us\n",
+             xswc[0].trigger.counter, ewin->ewmh.sync_request_count,
+             GetTime() - t);
+}
+#endif /* USE_XSYNC */
===================================================================
RCS file: /cvs/e/e16/e/src/mod-misc.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -3 -r1.40 -r1.41
--- mod-misc.c  20 Aug 2006 19:30:55 -0000      1.40
+++ mod-misc.c  23 Aug 2006 19:06:21 -0000      1.41
@@ -156,6 +156,7 @@
    CFG_ITEM_BOOL(Conf, testing.argb_internal_clients, 0),
    CFG_ITEM_BOOL(Conf, testing.argb_clients, 0),
    CFG_ITEM_BOOL(Conf, testing.argb_clients_inherit_attr, 0),
+   CFG_ITEM_BOOL(Conf, testing.use_sync, 1),
 
    CFG_ITEM_INT(Conf, deskmode, MODE_NONE),
    CFG_ITEM_BOOL(Conf, animate_shading, 1),



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to