From 34bf308a9e66f1a2f48630a15b1802afad50ec24 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Fri, 29 Feb 2008 18:00:23 -0500 Subject: dix: Refactoring of selection code to allow for polyinstantiation. Introduces dixLookupSelection() API. Removes NumCurrentSelections from API. --- dix/main.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'dix/main.c') diff --git a/dix/main.c b/dix/main.c index 068dae92e..db4347341 100644 --- a/dix/main.c +++ b/dix/main.c @@ -93,6 +93,7 @@ Equipment Corporation. #include "colormap.h" #include "colormapst.h" #include "cursorstr.h" +#include "selection.h" #include #include "opaque.h" #include "servermd.h" @@ -346,6 +347,7 @@ main(int argc, char *argv[], char *envp[]) InitAtoms(); InitEvents(); + InitSelections(); InitGlyphCaching(); if (!dixResetPrivates()) FatalError("couldn't init private data storage"); -- cgit v1.2.3 From c1be4e3379d8780dff20390939b657ca0973995a Mon Sep 17 00:00:00 2001 From: Ben Byer Date: Mon, 31 Mar 2008 21:04:37 -0700 Subject: shovelling code around ... (cherry picked from commit 2143182ba49195bbb2e9163ea6872fd68e7a4a85) --- dix/main.c | 14 +++++ hw/xquartz/darwinEvents.c | 106 +++++++++++++++++++++++++++++++++++--- hw/xquartz/darwinKeyboard.c | 8 +++ hw/xquartz/quartz.c | 123 +++----------------------------------------- hw/xquartz/quartz.h | 2 +- 5 files changed, 130 insertions(+), 123 deletions(-) (limited to 'dix/main.c') diff --git a/dix/main.c b/dix/main.c index db4347341..8f6507f5c 100644 --- a/dix/main.c +++ b/dix/main.c @@ -113,6 +113,9 @@ Equipment Corporation. #include "dispatch.h" /* InitProcVectors() */ #endif +#include +pthread_key_t threadname_key=0; + #ifdef DPMSExtension #define DPMS_SERVER #include @@ -248,6 +251,17 @@ main(int argc, char *argv[], char *envp[]) char *xauthfile; HWEventQueueType alwaysCheckForInput[2]; + if(threadname_key == 0) ErrorF("pthread_key_create returned %d\n", pthread_key_create(&threadname_key, NULL)); + ErrorF("threadname_key = %d\n", threadname_key); + if(pthread_getspecific(threadname_key) == NULL) { + char *nameptr = malloc(32); + sprintf(nameptr, "main thread %d", random()); + // strcpy(nameptr, "main thread"); + ErrorF("calling: pthread_setspecific(%d, %s)=%d\n", threadname_key, nameptr, pthread_setspecific(threadname_key, nameptr)); + if (pthread_getspecific(threadname_key) != NULL) ErrorF("current thread: %s\n", (char *)pthread_getspecific(threadname_key)); + } else { + if (pthread_getspecific(threadname_key) != NULL) ErrorF("thread was already: %s\n", (char *)pthread_getspecific(threadname_key)); + } display = "0"; InitGlobals(); diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c index 230050f60..28a712dab 100644 --- a/hw/xquartz/darwinEvents.c +++ b/hw/xquartz/darwinEvents.c @@ -52,6 +52,11 @@ in this Software without prior written authorization from The Open Group. #include #include +#define _APPLEWM_SERVER_ +#include "applewmExt.h" +#include + + /* Fake button press/release for scroll wheel move. */ #define SCROLLWHEELUPFAKE 4 #define SCROLLWHEELDOWNFAKE 5 @@ -177,14 +182,103 @@ static void DarwinSimulateMouseClick( DarwinUpdateModifiers(KeyPress, modifierMask); } +/* Generic handler for Xquartz-specifc events. When possible, these should + be moved into their own individual functions and set as handlers using + mieqSetHandler. */ + 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; iu.u.type) { - case kXquartzControllerNotify: - DEBUG_LOG("kXquartzControllerNotify\n"); - AppleWMSendEvent(AppleWMControllerNotify, - AppleWMControllerNotifyMask, - xe->u.clientMessage.u.l.longs0, - xe->u.clientMessage.u.l.longs1); - break; - - case kXquartzPasteboardNotify: - DEBUG_LOG("kXquartzPasteboardNotify\n"); - AppleWMSendEvent(AppleWMPasteboardNotify, - AppleWMPasteboardNotifyMask, - xe->u.clientMessage.u.l.longs0, - xe->u.clientMessage.u.l.longs1); - break; - - case kXquartzActivate: - DEBUG_LOG("kXquartzActivate\n"); - QuartzShow(xe->u.keyButtonPointer.rootX, - xe->u.keyButtonPointer.rootY); - AppleWMSendEvent(AppleWMActivationNotify, - AppleWMActivationNotifyMask, - AppleWMIsActive, 0); - break; - - case kXquartzDeactivate: - DEBUG_LOG("kXquartzDeactivate\n"); - AppleWMSendEvent(AppleWMActivationNotify, - AppleWMActivationNotifyMask, - AppleWMIsInactive, 0); - QuartzHide(); - break; - - case kXquartzDisplayChanged: - DEBUG_LOG("kXquartzDisplayChanged\n"); - QuartzUpdateScreens(); - break; - - case kXquartzWindowState: - DEBUG_LOG("kXquartzWindowState\n"); - RootlessNativeWindowStateChanged(xe->u.clientMessage.u.l.longs0, - xe->u.clientMessage.u.l.longs1); - break; - - case kXquartzWindowMoved: - DEBUG_LOG("kXquartzWindowMoved\n"); - RootlessNativeWindowMoved ((WindowPtr)xe->u.clientMessage.u.l.longs0); - break; - - case kXquartzToggleFullscreen: - DEBUG_LOG("kXquartzToggleFullscreen\n"); -#ifdef DARWIN_DDX_MISSING - if (quartzEnableRootless) QuartzSetFullscreen(!quartzHasRoot); - else if (quartzHasRoot) QuartzHide(); - else QuartzShow(); -#else - // ErrorF("kXquartzToggleFullscreen not implemented\n"); -#endif - break; - - case kXquartzSetRootless: - DEBUG_LOG("kXquartzSetRootless\n"); -#ifdef DARWIN_DDX_MISSING - QuartzSetRootless(xe->u.clientMessage.u.l.longs0); - if (!quartzEnableRootless && !quartzHasRoot) QuartzHide(); -#else - // ErrorF("kXquartzSetRootless not implemented\n"); -#endif - break; - - case kXquartzSetRootClip: - QuartzSetRootClip((BOOL)xe->u.clientMessage.u.l.longs0); - break; - - case kXquartzQuit: - GiveUp(0); - break; - -#if 0 - case kXquartzReadPasteboard: - QuartzReadPasteboard(); - break; - - case kXquartzWritePasteboard: - QuartzWritePasteboard(); - break; -#endif - - case kXquartzBringAllToFront: - DEBUG_LOG("kXquartzBringAllToFront\n"); - RootlessOrderAllWindows(); - break; - - case kXquartzSpaceChanged: - DEBUG_LOG("kXquartzSpaceChanged\n"); - QuartzSpaceChanged(xe->u.clientMessage.u.l.longs0); - break; - default: - ErrorF("Unknown application defined event type %d.\n", xe->u.u.type); - } -} diff --git a/hw/xquartz/quartz.h b/hw/xquartz/quartz.h index fbe308a92..ffe06f9c6 100644 --- a/hw/xquartz/quartz.h +++ b/hw/xquartz/quartz.h @@ -130,5 +130,5 @@ void QuartzInitOutput(int argc,char **argv); void QuartzInitInput(int argc, char **argv); void QuartzGiveUp(void); void QuartzProcessEvent(xEvent *xe); - +void QuartzDisplayChangedHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents); #endif -- cgit v1.2.3