xserver: Branch 'xorg-server-1.4-apple' - 4 commits

Ben Byer bbyer at kemper.freedesktop.org
Mon Mar 31 17:48:54 PDT 2008


 hw/xquartz/darwin.h       |    2 -
 hw/xquartz/darwinEvents.c |   60 +++++++++++++++++++++-------------------------
 hw/xquartz/darwinEvents.h |    2 +
 3 files changed, 31 insertions(+), 33 deletions(-)

New commits:
commit 7983e574afdd803e21d08bef0fde3cdd32503b24
Author: bushing <bushing at gmail.com>
Date:   Mon Mar 31 17:48:09 2008 -0700

    gut darwinEQEnqueue, and make it just call mieqEnqueue (for the moment)

diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index e9ad234..9c8efa0 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -199,7 +199,11 @@ void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int neven
   int i;
 
   DEBUG_LOG("DarwinEventHandler(%d, %p, %p, %d)\n", screenNum, xe, dev, nevents);
-  for (i=0; i<nevents; i++) QuartzProcessEvent(&xe[i]);
+  for (i=0; i<nevents; i++) {
+    if (xe[i].u.u.type == kXquartzDeactivate)
+      DarwinReleaseModifiers();
+    QuartzProcessEvent(&xe[i]);
+  }
 }
 
 Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) { 
@@ -242,40 +246,10 @@ Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) {
  * This should be deprecated in favor of miEQEnqueue -- BB
  */
 void DarwinEQEnqueue(const xEventPtr e) {
-    HWEventQueueType oldtail, newtail;
-
-    oldtail = darwinEventQueue.tail;
-
-    // mieqEnqueue() collapses successive motion events into one event.
-    // This is difficult to do in a thread-safe way and rarely useful.
-
-    newtail = oldtail + 1;
-    if (newtail == QUEUE_SIZE) newtail = 0;
-    /* Toss events which come in late */
-    if (newtail == darwinEventQueue.head) return;
-
-    darwinEventQueue.events[oldtail].event = *e;
-
-    /*
-     * Make sure that event times don't go backwards - this
-     * is "unnecessary", but very useful
-     */
-    if (e->u.keyButtonPointer.time < darwinEventQueue.lastEventTime &&
-        darwinEventQueue.lastEventTime - e->u.keyButtonPointer.time < 10000)
-    {
-        darwinEventQueue.events[oldtail].event.u.keyButtonPointer.time =
-        darwinEventQueue.lastEventTime;
-    }
-    darwinEventQueue.events[oldtail].pScreen = darwinEventQueue.pEnqueueScreen;
-
-    // Update the tail after the event is prepared
-    darwinEventQueue.tail = newtail;
-
-    // Signal there is an event ready to handle
-    DarwinPokeEQ();
+  mieqEnqueue(NULL, e);
+  DarwinPokeEQ();
 }
 
-
 /*
  * DarwinEQPointerPost
  *  Post a pointer event. Used by the mipointer.c routines.
commit 735ab1e84e272b6354758f9acdfe7d2110eee03a
Author: bushing <bushing at gmail.com>
Date:   Mon Mar 31 17:08:45 2008 -0700

    add prototype for DarwinEventHandler

diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index de3541d..e9ad234 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -204,8 +204,6 @@ void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int neven
 
 Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) { 
 
-  void mieqSetHandler(int event, mieqHandler handler);
-
     darwinEvents = (xEvent *)malloc(sizeof(xEvent) * GetMaximumEventsNum());
     mieqInit();
     mieqSetHandler(kXquartzActivate, DarwinEventHandler);
diff --git a/hw/xquartz/darwinEvents.h b/hw/xquartz/darwinEvents.h
index 4960614..1d8e92a 100644
--- a/hw/xquartz/darwinEvents.h
+++ b/hw/xquartz/darwinEvents.h
@@ -41,4 +41,6 @@ void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y,
 			    float pressure, float tilt_x, float tilt_y);
 void DarwinUpdateModKeys(int flags);
 
+void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, 
+			int nevents);
 #endif  /* _DARWIN_EVENTS_H */
commit b4afbb93efd8c44bd0939c9596f781e55685f927
Author: bushing <bushing at gmail.com>
Date:   Mon Mar 31 16:30:16 2008 -0700

    add logging of current thread ID to DEBUG_LOG macro

diff --git a/hw/xquartz/darwin.h b/hw/xquartz/darwin.h
index ce104cf..5b3bc75 100644
--- a/hw/xquartz/darwin.h
+++ b/hw/xquartz/darwin.h
@@ -125,7 +125,7 @@ enum {
 #ifdef ENABLE_DEBUG_LOG
 extern FILE *debug_log_fp;
 #define DEBUG_LOG_NAME "x11-debug.txt"
-#define DEBUG_LOG(msg, args...) if (debug_log_fp) fprintf(debug_log_fp, "%s:%s:%d " msg, __FILE__, __FUNCTION__, __LINE__, ##args ); fflush(debug_log_fp);
+#define DEBUG_LOG(msg, args...) if (debug_log_fp) fprintf(debug_log_fp, "%x:%s:%s:%d " msg, pthread_self(), __FILE__, __FUNCTION__, __LINE__, ##args ); fflush(debug_log_fp);
 #else
 #define DEBUG_LOG(msg, args...) 
 #endif
commit 2c46a5266055e4fd69e0c2332a396b44b171b9e1
Author: bushing <bushing at gmail.com>
Date:   Mon Mar 31 16:24:01 2008 -0700

    Begin to move all of our Xquartz DDX-specific event handlers
    to miEQ, in preparation to remove the DDX-specific code entirely.

diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index d6d9ba5..de3541d 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -195,10 +195,34 @@ static void DarwinSimulateMouseClick(
     DarwinUpdateModifiers(KeyPress, modifierMask);
 }
 
+void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) {
+  int i;
+
+  DEBUG_LOG("DarwinEventHandler(%d, %p, %p, %d)\n", screenNum, xe, dev, nevents);
+  for (i=0; i<nevents; i++) QuartzProcessEvent(&xe[i]);
+}
 
 Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) { 
+
+  void mieqSetHandler(int event, mieqHandler handler);
+
     darwinEvents = (xEvent *)malloc(sizeof(xEvent) * GetMaximumEventsNum());
     mieqInit();
+    mieqSetHandler(kXquartzActivate, DarwinEventHandler);
+    mieqSetHandler(kXquartzDeactivate, DarwinEventHandler);
+    mieqSetHandler(kXquartzSetRootClip, DarwinEventHandler);
+    mieqSetHandler(kXquartzQuit, DarwinEventHandler);
+    mieqSetHandler(kXquartzReadPasteboard, DarwinEventHandler);
+    mieqSetHandler(kXquartzWritePasteboard, DarwinEventHandler);
+    mieqSetHandler(kXquartzToggleFullscreen, DarwinEventHandler);
+    mieqSetHandler(kXquartzSetRootless, DarwinEventHandler);
+    mieqSetHandler(kXquartzSpaceChanged, DarwinEventHandler);
+    mieqSetHandler(kXquartzControllerNotify, DarwinEventHandler);
+    mieqSetHandler(kXquartzPasteboardNotify, DarwinEventHandler);
+    mieqSetHandler(kXquartzDisplayChanged, DarwinEventHandler);
+    mieqSetHandler(kXquartzWindowState, DarwinEventHandler);
+    mieqSetHandler(kXquartzWindowMoved, DarwinEventHandler);
+
     darwinEventQueue.head = darwinEventQueue.tail = 0;
     darwinEventQueue.lastEventTime = GetTimeInMillis ();
     darwinEventQueue.pKbd = pKbd;


More information about the xorg-commit mailing list