From 2dafc46e3d814e02b25e5a2fa2e931f0257402a8 Mon Sep 17 00:00:00 2001 From: Ben Byer Date: Thu, 1 Mar 2007 17:44:39 -0800 Subject: [PATCH] Fixed pointer events in Xquartz -- Keyboard events work, but the keycodes are incorrect. --- 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(-) diff --git a/hw/darwin/apple/X11Application.m b/hw/darwin/apple/X11Application.m index 3982d97b3..0be1e40b5 100644 --- a/hw/darwin/apple/X11Application.m +++ b/hw/darwin/apple/X11Application.m @@ -867,7 +867,8 @@ static void send_nsevent (NSEventType type, NSEvent *e) { 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 type, NSEvent *e) { 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 type, NSEvent *e) { 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 0.0; count = count - 1.0f) { num_events = GetPointerEvents(quartzEvents, darwinPointer, ButtonPress, ev_button, POINTER_ABSOLUTE, 0, 2, valuators); - for(i=0; i bushing: oh, i ... er ... christ. + write(darwinEventWriteFD, &nullbyte, 1); } diff --git a/hw/darwin/quartz/applewm.c b/hw/darwin/quartz/applewm.c index 869f7a92f..cc11cfa4c 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 913ea7252..038b21eff 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 1e618e37d..6ed6a7677 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); \