xserver: Branch 'master'

Ben Byer bbyer at kemper.freedesktop.org
Fri Mar 2 03:44:43 EET 2007


 hw/darwin/apple/X11Application.m |   31 ++++++++++++-------------------
 hw/darwin/quartz/applewm.c       |   21 ++++++++++++++++-----
 hw/darwin/quartz/quartz.c        |    6 ++++++
 hw/darwin/quartz/quartzCursor.c  |    2 ++
 4 files changed, 36 insertions(+), 24 deletions(-)

New commits:
diff-tree 2dafc46e3d814e02b25e5a2fa2e931f0257402a8 (from 39ecd6fff4f946deebe310b4b26b171c842db223)
Author: Ben Byer <bbyer at bbyer.apple.com>
Date:   Thu Mar 1 17:44:39 2007 -0800

    Fixed pointer events in Xquartz -- Keyboard events work, but
    the keycodes are incorrect.

diff --git a/hw/darwin/apple/X11Application.m b/hw/darwin/apple/X11Application.m
index 3982d97..0be1e40 100644
--- a/hw/darwin/apple/X11Application.m
+++ b/hw/darwin/apple/X11Application.m
@@ -867,7 +867,8 @@ static void send_nsevent (NSEventType ty
     int valuators[2];
     float count;
     xEvent xe;
-    
+    char nullbyte=0;
+
     bzero(&xe, sizeof(xe));
     input_check_flag++;
 	
@@ -886,10 +887,10 @@ static void send_nsevent (NSEventType ty
       pointer_y = (screen.origin.y + screen.size.height) - location.y;
     }
     
-    ErrorF("send_nsevent: type=%d pointer=(%d,%d)\n", type, pointer_x, pointer_y);
+//    ErrorF("send_nsevent: type=%d pointer=(%d,%d)\n", type, pointer_x, pointer_y);
     
     valuators[0] = pointer_x;
-    valuators[1] = pointer_y;
+    valuators[1] = pointer_y - aquaMenuBarHeight;
     state = convert_flags ([e modifierFlags]);
     
     switch (type) {
@@ -916,12 +917,8 @@ static void send_nsevent (NSEventType ty
       num_events = GetPointerEvents(quartzEvents, darwinPointer, ev_type, ev_button, 
 				    POINTER_ABSOLUTE, 0, 2, valuators);
       
-      ErrorF("GetPointerEvents returned %d events\n", num_events);
-      for(i=0; i<num_events; i++) {
-	ErrorF("qe[%d].u.u.type=%d\n", i, quartzEvents[i].u.u.type);
-//				quartzEvents[i].u.keyButtonPointer.state = state;
+      for(i=0; i<num_events; i++)
 	mieqEnqueue (darwinPointer,&quartzEvents[i]);
-      }
       break;
     case NSScrollWheel: 
       count = [e deltaY];
@@ -929,28 +926,23 @@ static void send_nsevent (NSEventType ty
       for (count = fabs(count); count > 0.0; count = count - 1.0f) {
 	num_events = GetPointerEvents(quartzEvents, darwinPointer, ButtonPress, ev_button, 
 				      POINTER_ABSOLUTE, 0, 2, valuators);
-	for(i=0; i<num_events; i++) {
-//						quartzEvents[i].u.keyButtonPointer.state = state;
+	for(i=0; i<num_events; i++) 
 	  mieqEnqueue(darwinPointer,&quartzEvents[i]);
-	}
 	num_events = GetPointerEvents(quartzEvents, darwinPointer, ButtonRelease, ev_button, 
 				      POINTER_ABSOLUTE, 0, 2, valuators);
-	for(i=0; i<num_events; i++) {
-//						quartzEvents[i].u.keyButtonPointer.state = state;
+	for(i=0; i<num_events; i++)
 	  mieqEnqueue(darwinPointer,&quartzEvents[i]);
-	}
       }
       break;
       
-    case NSKeyDown:
+    case NSKeyDown:  // do we need to translate these keyCodes?
     case NSKeyUp:
       num_events = GetKeyboardEvents(quartzEvents, darwinKeyboard, 
 				     (type == NSKeyDown)?KeyPress:KeyRelease, [e keyCode]);
-      for(i=0; i<num_events; i++) {
-//				quartzEvents[i].u.keyButtonPointer.state = state;
+      for(i=0; i<num_events; i++) 
 	mieqEnqueue(darwinKeyboard,&quartzEvents[i]);
-      }
       break;
+
     case NSFlagsChanged:
       xe.u.u.type = kXDarwinUpdateModifiers;
       xe.u.clientMessage.u.l.longs0 = [e modifierFlags];
@@ -958,5 +950,6 @@ static void send_nsevent (NSEventType ty
       break;
     default: break; /* for gcc */
     }	
-    //	UpdateCurrentTime();
+    //  <daniels> bushing: oh, i ... er ... christ.
+    write(darwinEventWriteFD, &nullbyte, 1);
 }
diff --git a/hw/darwin/quartz/applewm.c b/hw/darwin/quartz/applewm.c
index 869f7a9..cc11cfa 100644
--- a/hw/darwin/quartz/applewm.c
+++ b/hw/darwin/quartz/applewm.c
@@ -446,7 +446,11 @@ ProcAppleWMSetWindowMenu(
         }
     }
 
+#ifdef INXQUARTZ
+    X11ApplicationSetWindowMenu (nitems, items, shortcuts);
+#else
     QuartzSetWindowMenu (nitems, items, shortcuts);
+#endif
 
     free(items);
     free(shortcuts);
@@ -462,10 +466,12 @@ ProcAppleWMSetWindowMenuCheck(
     REQUEST(xAppleWMSetWindowMenuCheckReq);
 
     REQUEST_SIZE_MATCH(xAppleWMSetWindowMenuCheckReq);
-
+#ifdef INXQUARTZ
+    X11ApplicationSetWindowMenuCheck(stuff->index);
+#else
     QuartzMessageMainThread(kQuartzSetWindowMenuCheck, &stuff->index,
                             sizeof(stuff->index));
-
+#endif
     return (client->noClientException);
 }
 
@@ -475,9 +481,11 @@ ProcAppleWMSetFrontProcess(
 )
 {
     REQUEST_SIZE_MATCH(xAppleWMSetFrontProcessReq);
-
+#ifdef INXQUARTZ
+    X11ApplicationSetFrontProcess();
+#else
     QuartzMessageMainThread(kQuartzSetFrontProcess, NULL, 0);
-
+#endif
     return (client->noClientException);
 }
 
@@ -516,9 +524,12 @@ ProcAppleWMSetCanQuit(
     REQUEST(xAppleWMSetCanQuitReq);
 
     REQUEST_SIZE_MATCH(xAppleWMSetCanQuitReq);
-
+#ifdef INXQUARTZ
+    X11ApplicationSetCanQuit(stuff->state);
+#else
     QuartzMessageMainThread(kQuartzSetCanQuit, &stuff->state,
                             sizeof(stuff->state));
+#endif
 
     return (client->noClientException);
 }
diff --git a/hw/darwin/quartz/quartz.c b/hw/darwin/quartz/quartz.c
index 913ea72..038b21e 100644
--- a/hw/darwin/quartz/quartz.c
+++ b/hw/darwin/quartz/quartz.c
@@ -160,7 +160,11 @@ void DarwinModeInitInput(
     int argc,
     char **argv )
 {
+#ifdef INXQUARTZ
+  X11ApplicationServerReady();
+#else
     QuartzMessageMainThread(kQuartzServerStarted, NULL, 0);
+#endif
 
     // Do final display mode specific initialization before handling events
     if (quartzProcs->InitInput)
@@ -274,7 +278,9 @@ static void QuartzHide(void)
         }
     }
     quartzServerVisible = FALSE;
+#ifndef INXQUARTZ
     QuartzMessageMainThread(kQuartzServerHidden, NULL, 0);
+#endif
 }
 
 
diff --git a/hw/darwin/quartz/quartzCursor.c b/hw/darwin/quartz/quartzCursor.c
index 1e618e3..6ed6a76 100644
--- a/hw/darwin/quartz/quartzCursor.c
+++ b/hw/darwin/quartz/quartzCursor.c
@@ -93,7 +93,9 @@ static pthread_cond_t cursorCondition;
         /* Acquire lock and tell the main thread to change cursor */    \
         pthread_mutex_lock(&cursorMutex);                               \
         currentCursor = (CCrsrHandle) (cursorH);                        \
+#ifndef INXQUARTZ
         QuartzMessageMainThread(kQuartzCursorUpdate, NULL, 0);          \
+#endif
                                                                         \
         /* Wait for the main thread to change the cursor */             \
         pthread_cond_wait(&cursorCondition, &cursorMutex);              \



More information about the xorg-commit mailing list