xserver: Branch 'xorg-server-1.4-apple' - 19 commits
Ben Byer
bbyer at kemper.freedesktop.org
Mon Mar 31 21:35:25 PDT 2008
Rebased ref, commits from common ancestor:
commit 2143182ba49195bbb2e9163ea6872fd68e7a4a85
Author: Ben Byer <bbyer at apple.com>
Date: Mon Mar 31 21:04:37 2008 -0700
shovelling code around ...
diff --git a/dix/main.c b/dix/main.c
index 8b57e12..590f1a5 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -110,6 +110,9 @@ Equipment Corporation.
#include "dispatch.h" /* InitProcVectors() */
#endif
+#include <pthread.h>
+pthread_key_t threadname_key=0;
+
#ifdef DPMSExtension
#define DPMS_SERVER
#include <X11/extensions/dpms.h>
@@ -252,6 +255,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 230050f..28a712d 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 <unistd.h>
#include <IOKit/hidsystem/IOLLEvent.h>
+#define _APPLEWM_SERVER_
+#include "applewmExt.h"
+#include <X11/extensions/applewm.h>
+
+
/* 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; i<nevents; i++) {
- if (xe[i].u.u.type == kXquartzDeactivate)
- DarwinReleaseModifiers();
- QuartzProcessEvent(&xe[i]);
+ switch(xe[i].u.u.type) {
+ case kXquartzControllerNotify:
+ DEBUG_LOG("kXquartzControllerNotify\n");
+ AppleWMSendEvent(AppleWMControllerNotify,
+ AppleWMControllerNotifyMask,
+ xe[i].u.clientMessage.u.l.longs0,
+ xe[i].u.clientMessage.u.l.longs1);
+ break;
+
+ case kXquartzPasteboardNotify:
+ DEBUG_LOG("kXquartzPasteboardNotify\n");
+ AppleWMSendEvent(AppleWMPasteboardNotify,
+ AppleWMPasteboardNotifyMask,
+ xe[i].u.clientMessage.u.l.longs0,
+ xe[i].u.clientMessage.u.l.longs1);
+ break;
+
+ case kXquartzActivate:
+ DEBUG_LOG("kXquartzActivate\n");
+ QuartzShow(xe[i].u.keyButtonPointer.rootX,
+ xe[i].u.keyButtonPointer.rootY);
+ AppleWMSendEvent(AppleWMActivationNotify,
+ AppleWMActivationNotifyMask,
+ AppleWMIsActive, 0);
+ break;
+
+ case kXquartzDeactivate:
+ DEBUG_LOG("kXquartzDeactivate\n");
+ DarwinReleaseModifiers();
+ AppleWMSendEvent(AppleWMActivationNotify,
+ AppleWMActivationNotifyMask,
+ AppleWMIsInactive, 0);
+ QuartzHide();
+ break;
+
+ case kXquartzWindowState:
+ DEBUG_LOG("kXquartzWindowState\n");
+ RootlessNativeWindowStateChanged(xe[i].u.clientMessage.u.l.longs0,
+ xe[i].u.clientMessage.u.l.longs1);
+ break;
+
+ case kXquartzWindowMoved:
+ DEBUG_LOG("kXquartzWindowMoved\n");
+ RootlessNativeWindowMoved ((WindowPtr)xe[i].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[i].u.clientMessage.u.l.longs0);
+ if (!quartzEnableRootless && !quartzHasRoot) QuartzHide();
+#else
+ // ErrorF("kXquartzSetRootless not implemented\n");
+#endif
+ break;
+
+ case kXquartzSetRootClip:
+ QuartzSetRootClip((BOOL)xe[i].u.clientMessage.u.l.longs0);
+ break;
+
+ case kXquartzQuit:
+ GiveUp(0);
+ break;
+
+ case kXquartzBringAllToFront:
+ DEBUG_LOG("kXquartzBringAllToFront\n");
+ RootlessOrderAllWindows();
+ break;
+
+ case kXquartzSpaceChanged:
+ DEBUG_LOG("kXquartzSpaceChanged\n");
+ QuartzSpaceChanged(xe[i].u.clientMessage.u.l.longs0);
+
+ break;
+ default:
+ ErrorF("Unknown application defined event type %d.\n", xe[i].u.u.type);
+ }
}
}
@@ -199,14 +293,14 @@ Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) {
mieqSetHandler(kXquartzDeactivate, DarwinEventHandler);
mieqSetHandler(kXquartzSetRootClip, DarwinEventHandler);
mieqSetHandler(kXquartzQuit, DarwinEventHandler);
- mieqSetHandler(kXquartzReadPasteboard, DarwinEventHandler);
- mieqSetHandler(kXquartzWritePasteboard, DarwinEventHandler);
+ mieqSetHandler(kXquartzReadPasteboard, QuartzReadPasteboard);
+ mieqSetHandler(kXquartzWritePasteboard, QuartzWritePasteboard);
mieqSetHandler(kXquartzToggleFullscreen, DarwinEventHandler);
mieqSetHandler(kXquartzSetRootless, DarwinEventHandler);
mieqSetHandler(kXquartzSpaceChanged, DarwinEventHandler);
mieqSetHandler(kXquartzControllerNotify, DarwinEventHandler);
mieqSetHandler(kXquartzPasteboardNotify, DarwinEventHandler);
- mieqSetHandler(kXquartzDisplayChanged, DarwinEventHandler);
+ mieqSetHandler(kXquartzDisplayChanged, QuartzDisplayChangedHandler);
mieqSetHandler(kXquartzWindowState, DarwinEventHandler);
mieqSetHandler(kXquartzWindowMoved, DarwinEventHandler);
diff --git a/hw/xquartz/darwinKeyboard.c b/hw/xquartz/darwinKeyboard.c
index b368fe9..472d80d 100644
--- a/hw/xquartz/darwinKeyboard.c
+++ b/hw/xquartz/darwinKeyboard.c
@@ -730,6 +730,14 @@ static void DarwinBuildModifierMaps(darwinKeyboardInfo *info) {
* it to an equivalent X keyboard map and modifier map.
*/
static void DarwinLoadKeyboardMapping(KeySymsRec *keySyms) {
+ void* callstack[128];
+ int i, frames = backtrace(callstack, 128);
+ char** strs = backtrace_symbols(callstack, frames);
+ for (i = 0; i < frames; ++i) {
+ ErrorF("%s\n", strs[i]);
+ }
+ free(strs);
+
memset(keyInfo.keyMap, 0, sizeof(keyInfo.keyMap));
/* TODO: Clean this up
diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index f0093bd..7ab1e15 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -240,17 +240,17 @@ RREditConnectionInfo (ScreenPtr pScreen)
#endif
/*
- * QuartzUpdateScreens
+ * QuartzDisplayChangeHandler
* Adjust for screen arrangement changes.
*/
-static void QuartzUpdateScreens(void)
+void QuartzDisplayChangedHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents)
{
ScreenPtr pScreen;
WindowPtr pRoot;
int x, y, width, height, sx, sy;
xEvent e;
- DEBUG_LOG("QuartzUpdateScreens()\n");
+ DEBUG_LOG("QuartzDisplayChangedHandler()\n");
if (noPseudoramiXExtension || screenInfo.numScreens != 1)
{
/* FIXME: if not using Xinerama, we have multiple screens, and
@@ -316,7 +316,7 @@ static void QuartzUpdateScreens(void)
* Calls mode specific screen resume to restore the X clip regions
* (if needed) and the X server cursor state.
*/
-static void QuartzShow(
+void QuartzShow(
int x, // cursor location
int y )
{
@@ -339,7 +339,7 @@ static void QuartzShow(
* hidden. Calls mode specific screen suspend to set X clip regions to
* prevent drawing (if needed) and restore the Aqua cursor.
*/
-static void QuartzHide(void)
+void QuartzHide(void)
{
int i;
@@ -358,7 +358,7 @@ static void QuartzHide(void)
* QuartzSetRootClip
* Enable or disable rendering to the X screen.
*/
-static void QuartzSetRootClip(
+void QuartzSetRootClip(
BOOL enable)
{
int i;
@@ -377,7 +377,7 @@ static void QuartzSetRootClip(
* QuartzSpaceChanged
* Unmap offscreen windows, map onscreen windows
*/
-static void QuartzSpaceChanged(uint32_t space_id) {
+void QuartzSpaceChanged(uint32_t space_id) {
/* Do something special here, so we don't depend on quartz-wm for spaces to work... */
DEBUG_LOG("Space Changed (%u) ... do something interesting...\n", space_id);
}
@@ -412,112 +412,3 @@ QuartzMessageServerThread(
mieqEnqueue(NULL, &xe);
}
-
-
-/*
- * QuartzProcessEvent
- * Process Quartz specific events.
- */
-void QuartzProcessEvent(xEvent *xe) {
- switch (xe->u.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 fbe308a..ffe06f9 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
commit 6e833e41e2f3a84f7e5164b918737b3975517c12
Author: Ben Byer <bbyer at apple.com>
Date: Mon Mar 31 20:21:24 2008 -0700
fix compilation on systems that don't have
XP_EVENT_SPACE_CHANGED defined
diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c
index 5e14473..4aa654a 100644
--- a/hw/xquartz/xpr/xprScreen.c
+++ b/hw/xquartz/xpr/xprScreen.c
@@ -107,6 +107,7 @@ static void eventHandler(unsigned int type, const void *arg,
DRISurfaceNotify(*(xp_surface_id *) arg, kind);
}
break;
+#ifdef XP_EVENT_SPACE_CHANGED
case XP_EVENT_SPACE_CHANGED:
ErrorF("XP_EVENT_SPACE_CHANGED\n");
if(arg_size == sizeof(uint32_t)) {
@@ -114,6 +115,7 @@ static void eventHandler(unsigned int type, const void *arg,
QuartzMessageServerThread(kXquartzSpaceChanged, 1, space_id);
}
break;
+#endif
default:
ErrorF("Unknown XP_EVENT type (%d) in xprScreen:eventHandler\n", type);
}
@@ -241,9 +243,11 @@ xprDisplayInit(void)
xp_select_events(XP_EVENT_DISPLAY_CHANGED
| XP_EVENT_WINDOW_STATE_CHANGED
| XP_EVENT_WINDOW_MOVED
+#ifdef XP_EVENT_SPACE_CHANGED
+ | XP_EVENT_SPACE_CHANGED
+#endif
| XP_EVENT_SURFACE_CHANGED
- | XP_EVENT_SURFACE_DESTROYED
- | XP_EVENT_SPACE_CHANGED,
+ | XP_EVENT_SURFACE_DESTROYED,
eventHandler, NULL);
AppleDRIExtensionInit();
commit 4aedba5aa727e22316e8ca456f7218bea9ee0313
Author: Ben Byer <bbyer at apple.com>
Date: Mon Mar 31 20:18:58 2008 -0700
just a bit of juggling headers around -- we're preparing
to call our Xquartz-specific event handlers directly
as mieqHandlers
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index ec1d5e0..e397795 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -887,7 +887,7 @@ void AbortDDX( void )
*/
void
-xf86SetRootClip (ScreenPtr pScreen, BOOL enable)
+xf86SetRootClip (ScreenPtr pScreen, int enable)
{
WindowPtr pWin = WindowTable[pScreen->myNum];
WindowPtr pChild;
diff --git a/hw/xquartz/darwin.h b/hw/xquartz/darwin.h
index 5b3bc75..a71941d 100644
--- a/hw/xquartz/darwin.h
+++ b/hw/xquartz/darwin.h
@@ -54,7 +54,7 @@ typedef struct {
void DarwinPrintBanner(void);
int DarwinParseModifierList(const char *constmodifiers);
void DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo);
-void xf86SetRootClip (ScreenPtr pScreen, BOOL enable);
+void xf86SetRootClip (ScreenPtr pScreen, int enable);
#define SCREEN_PRIV(pScreen) \
((DarwinFramebufferPtr)pScreen->devPrivates[darwinScreenIndex].ptr)
diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index afb3776..f0093bd 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -33,6 +33,7 @@
#endif
#include "quartzCommon.h"
+#include "inputstr.h"
#include "quartz.h"
#include "darwin.h"
#include "darwinEvents.h"
@@ -497,6 +498,7 @@ void QuartzProcessEvent(xEvent *xe) {
GiveUp(0);
break;
+#if 0
case kXquartzReadPasteboard:
QuartzReadPasteboard();
break;
@@ -504,6 +506,7 @@ void QuartzProcessEvent(xEvent *xe) {
case kXquartzWritePasteboard:
QuartzWritePasteboard();
break;
+#endif
case kXquartzBringAllToFront:
DEBUG_LOG("kXquartzBringAllToFront\n");
diff --git a/hw/xquartz/quartzCocoa.m b/hw/xquartz/quartzCocoa.m
index 53e3f08..d8f9c69 100644
--- a/hw/xquartz/quartzCocoa.m
+++ b/hw/xquartz/quartzCocoa.m
@@ -37,13 +37,14 @@
#endif
#include "quartzCommon.h"
+#include "inputstr.h"
#include "quartzPasteboard.h"
#define BOOL xBOOL
#include "darwin.h"
-#undef BOOL
#include <Cocoa/Cocoa.h>
+#undef BOOL
#include "pseudoramiX.h"
diff --git a/hw/xquartz/quartzPasteboard.c b/hw/xquartz/quartzPasteboard.c
index 0cecff5..3833572 100644
--- a/hw/xquartz/quartzPasteboard.c
+++ b/hw/xquartz/quartzPasteboard.c
@@ -34,6 +34,8 @@
#include <dix-config.h>
#endif
+#include "misc.h"
+#include "inputstr.h"
#include "quartzPasteboard.h"
#include <X11/Xatom.h>
@@ -81,8 +83,8 @@ static char * QuartzReadCutBuffer(void)
}
// Write X cut buffer to Mac OS X pasteboard
-// Called by ProcessInputEvents() in response to request from X server thread.
-void QuartzWritePasteboard(void)
+// Called by mieqProcessInputEvents() in response to request from X server thread.
+void QuartzWritePasteboard(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents)
{
char *text;
text = QuartzReadCutBuffer();
@@ -95,8 +97,8 @@ void QuartzWritePasteboard(void)
#define strequal(a, b) (0 == strcmp((a), (b)))
// Read Mac OS X pasteboard into X cut buffer
-// Called by ProcessInputEvents() in response to request from X server thread.
-void QuartzReadPasteboard(void)
+// Called by mieqProcessInputEvents() in response to request from X server thread.
+void QuartzReadPasteboard(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents)
{
char *oldText = QuartzReadCutBuffer();
char *text = QuartzReadCocoaPasteboard();
diff --git a/hw/xquartz/quartzPasteboard.h b/hw/xquartz/quartzPasteboard.h
index d6a8ee8..b51cd88 100644
--- a/hw/xquartz/quartzPasteboard.h
+++ b/hw/xquartz/quartzPasteboard.h
@@ -34,11 +34,11 @@
#define _QUARTZPASTEBOARD_H
// Aqua->X
-void QuartzReadPasteboard(void);
+void QuartzReadPasteboard(int, xEventPtr, DeviceIntPtr, int);
char * QuartzReadCocoaPasteboard(void); // caller must free string
// X->Aqua
-void QuartzWritePasteboard(void);
+void QuartzWritePasteboard(int, xEventPtr, DeviceIntPtr, int);
void QuartzWriteCocoaPasteboard(char *text);
#endif /* _QUARTZPASTEBOARD_H */
diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c
index b653a6e..5e14473 100644
--- a/hw/xquartz/xpr/xprScreen.c
+++ b/hw/xquartz/xpr/xprScreen.c
@@ -32,6 +32,7 @@
#endif
#include "quartzCommon.h"
+#include "inputstr.h"
#include "quartz.h"
#include "xpr.h"
#include "pseudoramiX.h"
commit 1e0ec02202eeaffae480048b91bf02140ee29f8a
Author: Ben Byer <bbyer at apple.com>
Date: Mon Mar 31 19:47:28 2008 -0700
nuke DarwinEventQueue
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 5b037d2..230050f 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -56,28 +56,10 @@ in this Software without prior written authorization from The Open Group.
#define SCROLLWHEELUPFAKE 4
#define SCROLLWHEELDOWNFAKE 5
-#define QUEUE_SIZE 256
-
-typedef struct _Event {
- xEvent event;
- ScreenPtr pScreen;
-} EventRec, *EventPtr;
-
int input_check_zero, input_check_flag;
static int old_flags = 0; // last known modifier state
-typedef struct _EventQueue {
- HWEventQueueType head, tail; /* long for SetInputCheck */
- CARD32 lastEventTime; /* to avoid time running backwards */
- Bool lastMotion;
- EventRec events[QUEUE_SIZE]; /* static allocation for signals */
- DevicePtr pKbd, pPtr; /* device pointer, to get funcs */
- ScreenPtr pEnqueueScreen; /* screen events are being delivered to */
- ScreenPtr pDequeueScreen; /* screen events are being dispatched to */
-} EventQueueRec, *EventQueuePtr;
-
-static EventQueueRec darwinEventQueue;
xEvent *darwinEvents = NULL;
/*
@@ -231,21 +213,6 @@ Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) {
return TRUE;
}
-
-/*
- * DarwinEQEnqueue
- * Must be thread safe with ProcessInputEvents.
- * DarwinEQEnqueue - called from event gathering thread
- * ProcessInputEvents - called from X server thread
- * DarwinEQEnqueue should never be called from more than one thread.
- *
- * This should be deprecated in favor of miEQEnqueue -- BB
- */
-void DarwinEQEnqueue(const xEventPtr e) {
- mieqEnqueue(NULL, e);
- DarwinPokeEQ();
-}
-
/*
* ProcessInputEvents
* Read and process events from the event queue until it is empty.
diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index 1f1b9a4..afb3776 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -409,7 +409,7 @@ QuartzMessageServerThread(
va_end (args);
}
- DarwinEQEnqueue(&xe);
+ mieqEnqueue(NULL, &xe);
}
commit c34fce7051b996633291dddc061b696ff737f3fb
Author: Ben Byer <bbyer at apple.com>
Date: Mon Mar 31 19:39:51 2008 -0700
continue with gutting darwinEvents.c
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index b146321..5b037d2 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -78,7 +78,7 @@ typedef struct _EventQueue {
} EventQueueRec, *EventQueuePtr;
static EventQueueRec darwinEventQueue;
-xEvent *darwinEvents;
+xEvent *darwinEvents = NULL;
/*
* DarwinPressModifierMask
@@ -207,8 +207,11 @@ void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int neven
}
Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) {
+ if (!darwinEvents)
+ darwinEvents = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+ if (!darwinEvents)
+ FatalError("Couldn't allocate event buffer\n");
- darwinEvents = (xEvent *)malloc(sizeof(xEvent) * GetMaximumEventsNum());
mieqInit();
mieqSetHandler(kXquartzActivate, DarwinEventHandler);
mieqSetHandler(kXquartzDeactivate, DarwinEventHandler);
@@ -225,13 +228,6 @@ Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) {
mieqSetHandler(kXquartzWindowState, DarwinEventHandler);
mieqSetHandler(kXquartzWindowMoved, DarwinEventHandler);
- darwinEventQueue.head = darwinEventQueue.tail = 0;
- darwinEventQueue.lastEventTime = GetTimeInMillis ();
- darwinEventQueue.pKbd = pKbd;
- darwinEventQueue.pPtr = pPtr;
- darwinEventQueue.pEnqueueScreen = screenInfo.screens[0];
- darwinEventQueue.pDequeueScreen = darwinEventQueue.pEnqueueScreen;
- SetInputCheck(&input_check_zero, &input_check_flag);
return TRUE;
}
@@ -255,8 +251,6 @@ void DarwinEQEnqueue(const xEventPtr e) {
* Read and process events from the event queue until it is empty.
*/
void ProcessInputEvents(void) {
- EventRec *e;
- int x, y;
xEvent xe;
// button number and modifier mask of currently pressed fake button
input_check_flag=0;
@@ -265,92 +259,11 @@ void ProcessInputEvents(void) {
mieqProcessInputEvents();
// Empty the signaling pipe
- x = sizeof(xe);
- while (x == sizeof(xe))
- x = read(darwinEventReadFD, &xe, sizeof(xe));
-
- while (darwinEventQueue.head != darwinEventQueue.tail)
- {
- if (screenIsSaved == SCREEN_SAVER_ON)
- SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset);
-
- e = &darwinEventQueue.events[darwinEventQueue.head];
- xe = e->event;
-
- // Shift from global screen coordinates to coordinates relative to
- // the origin of the current screen.
- xe.u.keyButtonPointer.rootX -= darwinMainScreenX +
- dixScreenOrigins[miPointerCurrentScreen()->myNum].x;
- xe.u.keyButtonPointer.rootY -= darwinMainScreenY +
- dixScreenOrigins[miPointerCurrentScreen()->myNum].y;
-
- /* ErrorF("old rootX = (%d,%d) darwinMainScreen = (%d,%d) dixScreenOrigins[%d]=(%d,%d)\n",
- xe.u.keyButtonPointer.rootX, xe.u.keyButtonPointer.rootY,
- darwinMainScreenX, darwinMainScreenY,
- miPointerCurrentScreen()->myNum,
- dixScreenOrigins[miPointerCurrentScreen()->myNum].x,
- dixScreenOrigins[miPointerCurrentScreen()->myNum].y); */
-
- //Assumption - screen switching can only occur on motion events
-
- if (e->pScreen != darwinEventQueue.pDequeueScreen)
- {
- darwinEventQueue.pDequeueScreen = e->pScreen;
- x = xe.u.keyButtonPointer.rootX;
- y = xe.u.keyButtonPointer.rootY;
- if (darwinEventQueue.head == QUEUE_SIZE - 1)
- darwinEventQueue.head = 0;
- else
- ++darwinEventQueue.head;
- NewCurrentScreen (darwinEventQueue.pDequeueScreen, x, y);
- }
- else
- {
- if (darwinEventQueue.head == QUEUE_SIZE - 1)
- darwinEventQueue.head = 0;
- else
- ++darwinEventQueue.head;
- switch (xe.u.u.type) {
- case KeyPress:
- case KeyRelease:
- ErrorF("Unexpected Keyboard event in DarwinProcessInputEvents\n");
- break;
-
- case ButtonPress:
- ErrorF("Unexpected ButtonPress event in DarwinProcessInputEvents\n");
- break;
-
- case ButtonRelease:
- ErrorF("Unexpected ButtonRelease event in DarwinProcessInputEvents\n");
- break;
-
- case MotionNotify:
- ErrorF("Unexpected MotionNotify event in DarwinProcessInputEvents\n");
- break;
-
- case kXquartzUpdateModifiers:
- ErrorF("Unexpected kXquartzUpdateModifiers event in DarwinProcessInputEvents\n");
- break;
-
- case kXquartzUpdateButtons:
- ErrorF("Unexpected kXquartzUpdateButtons event in DarwinProcessInputEvents\n");
- break;
-
- case kXquartzScrollWheel:
- ErrorF("Unexpected kXquartzScrollWheel event in DarwinProcessInputEvents\n");
- break;
-
- case kXquartzDeactivate:
- DarwinReleaseModifiers();
- // fall through
- default:
- // Check for mode specific event
- QuartzProcessEvent(&xe);
- }
- }
+ int x = sizeof(xe);
+ while (x == sizeof(xe)) {
+ DEBUG_LOG("draining pipe\n");
+ x = read(darwinEventReadFD, &xe, sizeof(xe));
}
-
- // miPointerUpdate();
}
/* Sends a null byte down darwinEventWriteFD, which will cause the
@@ -368,6 +281,10 @@ void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int poin
static int darwinFakeMouseButtonMask = 0;
int i, num_events;
+ if(!darwinEvents) {
+ ErrorF("DarwinSendPointerEvents called before darwinEvents was initialized\n");
+ return;
+ }
/* I can't find a spec for this, but at least GTK expects that tablets are
just like mice, except they have either one or three extra valuators, in this
order:
@@ -421,6 +338,11 @@ void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int poin
void DarwinSendKeyboardEvents(int ev_type, int keycode) {
int i, num_events;
+ if(!darwinEvents) {
+ ErrorF("DarwinSendKeyboardEvents called before darwinEvents was initialized\n");
+ return;
+ }
+
if (old_flags == 0 && darwinSyncKeymap && darwinKeymapFile == NULL) {
/* See if keymap has changed. */
@@ -447,6 +369,11 @@ void DarwinSendProximityEvents(int ev_type, int pointer_x, int pointer_y,
tilt_x * INT32_MAX * 1.0f,
tilt_y * INT32_MAX * 1.0f};
+ if(!darwinEvents) {
+ ErrorF("DarwinSendProximityvents called before darwinEvents was initialized\n");
+ return;
+}
+
num_events = GetProximityEvents(darwinEvents, darwinPointer, ev_type,
0, 5, valuators);
@@ -465,6 +392,11 @@ void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y,
tilt_x * INT32_MAX * 1.0f,
tilt_y * INT32_MAX * 1.0f};
+ if(!darwinEvents) {
+ ErrorF("DarwinSendScrollEvents called before darwinEvents was initialized\n");
+ return;
+ }
+
for (count = fabs(count); count > 0.0; count = count - 1.0f) {
int num_events = GetPointerEvents(darwinEvents, darwinPointer, ButtonPress, ev_button,
POINTER_ABSOLUTE, 0, 5, valuators);
commit bfec44d7b4baf0ad0aae55c8209bc60ac93c5b58
Author: Ben Byer <bbyer at apple.com>
Date: Mon Mar 31 18:26:00 2008 -0700
turns out we weren't actually using these files. oops
diff --git a/hw/xquartz/Makefile.am b/hw/xquartz/Makefile.am
index 99d23eb..0753824 100644
--- a/hw/xquartz/Makefile.am
+++ b/hw/xquartz/Makefile.am
@@ -50,8 +50,6 @@ EXTRA_DIST = \
quartz.h \
quartzAudio.h \
quartzCommon.h \
- quartzCursor.c \
- quartzCursor.h \
quartzForeground.h \
quartzKeyboard.h \
quartzPasteboard.h
diff --git a/hw/xquartz/quartzCursor.c b/hw/xquartz/quartzCursor.c
deleted file mode 100644
index 26ffa77..0000000
--- a/hw/xquartz/quartzCursor.c
+++ /dev/null
@@ -1,654 +0,0 @@
-/**************************************************************
- *
- * Support for using the Quartz Window Manager cursor
- *
- * Copyright (c) 2001-2003 Torrey T. Lyons and Greg Parker.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name(s) of the above copyright
- * holders shall not be used in advertising or otherwise to promote the sale,
- * use or other dealings in this Software without prior written authorization.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "quartzCommon.h"
-#include "quartzCursor.h"
-#include "darwin.h"
-
-#include <pthread.h>
-
-#include "mi.h"
-#include "scrnintstr.h"
-#include "cursorstr.h"
-#include "mipointrst.h"
-#include "globals.h"
-
-// Size of the QuickDraw cursor
-#define CURSORWIDTH 16
-#define CURSORHEIGHT 16
-
-typedef struct {
- int qdCursorMode;
- int qdCursorVisible;
- int useQDCursor;
- QueryBestSizeProcPtr QueryBestSize;
- miPointerSpriteFuncPtr spriteFuncs;
-} QuartzCursorScreenRec, *QuartzCursorScreenPtr;
-
-static int darwinCursorScreenIndex = -1;
-static unsigned long darwinCursorGeneration = 0;
-static CursorPtr quartzLatentCursor = NULL;
-static QD_Cursor gQDArrow; // QuickDraw arrow cursor
-
-// Cursor for the main thread to set (NULL = arrow cursor).
-static CCrsrHandle currentCursor = NULL;
-static pthread_mutex_t cursorMutex;
-static pthread_cond_t cursorCondition;
-
-#define CURSOR_PRIV(pScreen) \
- ((QuartzCursorScreenPtr)pScreen->devPrivates[darwinCursorScreenIndex].ptr)
-
-#define HIDE_QD_CURSOR(pScreen, visible) \
- if (visible) { \
- int ix; \
- for (ix = 0; ix < QUARTZ_PRIV(pScreen)->displayCount; ix++) { \
- CGDisplayHideCursor(QUARTZ_PRIV(pScreen)->displayIDs[ix]); \
- } \
- visible = FALSE; \
- } ((void)0)
-
-#define SHOW_QD_CURSOR(pScreen, visible) \
- { \
- int ix; \
- for (ix = 0; ix < QUARTZ_PRIV(pScreen)->displayCount; ix++) { \
- CGDisplayShowCursor(QUARTZ_PRIV(pScreen)->displayIDs[ix]); \
- } \
- visible = TRUE; \
- } ((void)0)
-
-#define CHANGE_QD_CURSOR(cursorH) \
- if (!quartzServerQuitting) { \
- /* Acquire lock and tell the main thread to change cursor */ \
- pthread_mutex_lock(&cursorMutex); \
- currentCursor = (CCrsrHandle) (cursorH); \
- QuartzMessageMainThread(kQuartzCursorUpdate, NULL, 0); \
- \
- /* Wait for the main thread to change the cursor */ \
- pthread_cond_wait(&cursorCondition, &cursorMutex); \
- pthread_mutex_unlock(&cursorMutex); \
- } ((void)0)
-
-
-/*
- * MakeQDCursor helpers: CTAB_ENTER, interleave
- */
-
-// Add a color entry to a ctab
-#define CTAB_ENTER(ctab, index, r, g, b) \
- ctab->ctTable[index].value = index; \
- ctab->ctTable[index].rgb.red = r; \
- ctab->ctTable[index].rgb.green = g; \
- ctab->ctTable[index].rgb.blue = b
-
-// Make an unsigned short by interleaving the bits of bytes c1 and c2.
-// High bit of c1 is first; low bit of c2 is last.
-// Interleave is a built-in INTERCAL operator.
-static unsigned short
-interleave(
- unsigned char c1,
- unsigned char c2 )
-{
- return
- ((c1 & 0x80) << 8) | ((c2 & 0x80) << 7) |
- ((c1 & 0x40) << 7) | ((c2 & 0x40) << 6) |
- ((c1 & 0x20) << 6) | ((c2 & 0x20) << 5) |
- ((c1 & 0x10) << 5) | ((c2 & 0x10) << 4) |
- ((c1 & 0x08) << 4) | ((c2 & 0x08) << 3) |
- ((c1 & 0x04) << 3) | ((c2 & 0x04) << 2) |
- ((c1 & 0x02) << 2) | ((c2 & 0x02) << 1) |
- ((c1 & 0x01) << 1) | ((c2 & 0x01) << 0) ;
-}
-
-/*
- * MakeQDCursor
- * Make a QuickDraw color cursor from the given X11 cursor.
- * Warning: This code is nasty. Color cursors were meant to be read
- * from resources; constructing the structures programmatically is messy.
- */
-/*
- QuickDraw cursor representation:
- Our color cursor is a 2 bit per pixel pixmap.
- Each pixel's bits are (source<<1 | mask) from the original X cursor pixel.
- The cursor's color table maps the colors like this:
- (2-bit value | X result | colortable | Mac result)
- 00 | transparent | white | transparent (white outside mask)
- 01 | back color | back color | back color
- 10 | undefined | black | invert background (just for fun)
- 11 | fore color | fore color | fore color
-*/
-static CCrsrHandle
-MakeQDCursor(
- CursorPtr pCursor )
-{
- CCrsrHandle result;
- CCrsrPtr curs;
- int i, w, h;
- unsigned short rowMask;
- PixMap *pix;
- ColorTable *ctab;
- unsigned short *image;
-
- result = (CCrsrHandle) NewHandleClear(sizeof(CCrsr));
- if (!result) return NULL;
- HLock((Handle)result);
- curs = *result;
-
- // Initialize CCrsr
- curs->crsrType = 0x8001; // 0x8000 = b&w, 0x8001 = color
- curs->crsrMap = (PixMapHandle) NewHandleClear(sizeof(PixMap));
- if (!curs->crsrMap) goto pixAllocFailed;
- HLock((Handle)curs->crsrMap);
- pix = *curs->crsrMap;
- curs->crsrData = NULL; // raw cursor image data (set below)
- curs->crsrXData = NULL; // QD's processed data
- curs->crsrXValid = 0; // zero means QD must re-process cursor data
- curs->crsrXHandle = NULL; // reserved
- memset(curs->crsr1Data, 0, CURSORWIDTH*CURSORHEIGHT/8); // b&w data
- memset(curs->crsrMask, 0, CURSORWIDTH*CURSORHEIGHT/8); // b&w & color mask
- curs->crsrHotSpot.h = min(CURSORWIDTH, pCursor->bits->xhot); // hot spot
- curs->crsrHotSpot.v = min(CURSORHEIGHT, pCursor->bits->yhot); // hot spot
- curs->crsrXTable = 0; // reserved
- curs->crsrID = GetCTSeed(); // unique ID from Color Manager
-
- // Set the b&w data and mask
- w = min(pCursor->bits->width, CURSORWIDTH);
- h = min(pCursor->bits->height, CURSORHEIGHT);
- rowMask = ~((1 << (CURSORWIDTH - w)) - 1);
- for (i = 0; i < h; i++) {
- curs->crsr1Data[i] = rowMask &
- ((pCursor->bits->source[i*4]<<8) | pCursor->bits->source[i*4+1]);
- curs->crsrMask[i] = rowMask &
- ((pCursor->bits->mask[i*4]<<8) | pCursor->bits->mask[i*4+1]);
- }
-
- // Set the color data and mask
- // crsrMap: defines bit depth and size and colortable only
- pix->rowBytes = (CURSORWIDTH * 2 / 8) | 0x8000; // last bit on means PixMap
- SetRect(&pix->bounds, 0, 0, CURSORWIDTH, CURSORHEIGHT); // see TN 1020
- pix->pixelSize = 2;
- pix->cmpCount = 1;
- pix->cmpSize = 2;
- // pix->pmTable set below
-
- // crsrData is the pixel data. crsrMap's baseAddr is not used.
- curs->crsrData = NewHandleClear(CURSORWIDTH*CURSORHEIGHT * 2 / 8);
- if (!curs->crsrData) goto imageAllocFailed;
- HLock((Handle)curs->crsrData);
- image = (unsigned short *) *curs->crsrData;
- // Pixel data is just 1-bit data and mask interleaved (see above)
- for (i = 0; i < h; i++) {
- unsigned char s, m;
- s = pCursor->bits->source[i*4] & (rowMask >> 8);
- m = pCursor->bits->mask[i*4] & (rowMask >> 8);
- image[2*i] = interleave(s, m);
- s = pCursor->bits->source[i*4+1] & (rowMask & 0x00ff);
- m = pCursor->bits->mask[i*4+1] & (rowMask & 0x00ff);
- image[2*i+1] = interleave(s, m);
- }
-
- // Build the color table (entries described above)
- // NewPixMap allocates a color table handle.
- pix->pmTable = (CTabHandle) NewHandleClear(sizeof(ColorTable) + 3
- * sizeof(ColorSpec));
- if (!pix->pmTable) goto ctabAllocFailed;
- HLock((Handle)pix->pmTable);
- ctab = *pix->pmTable;
- ctab->ctSeed = GetCTSeed();
- ctab->ctFlags = 0;
- ctab->ctSize = 3; // color count - 1
- CTAB_ENTER(ctab, 0, 0xffff, 0xffff, 0xffff);
- CTAB_ENTER(ctab, 1, pCursor->backRed, pCursor->backGreen,
- pCursor->backBlue);
- CTAB_ENTER(ctab, 2, 0x0000, 0x0000, 0x0000);
- CTAB_ENTER(ctab, 3, pCursor->foreRed, pCursor->foreGreen,
- pCursor->foreBlue);
-
- HUnlock((Handle)pix->pmTable); // ctab
- HUnlock((Handle)curs->crsrData); // image data
- HUnlock((Handle)curs->crsrMap); // pix
- HUnlock((Handle)result); // cursor
-
- return result;
-
- // "What we have here is a failure to allocate"
-ctabAllocFailed:
- HUnlock((Handle)curs->crsrData);
- DisposeHandle((Handle)curs->crsrData);
-imageAllocFailed:
- HUnlock((Handle)curs->crsrMap);
- DisposeHandle((Handle)curs->crsrMap);
-pixAllocFailed:
- HUnlock((Handle)result);
- DisposeHandle((Handle)result);
- return NULL;
-}
-
-
-/*
- * FreeQDCursor
- * Destroy a QuickDraw color cursor created with MakeQDCursor().
- * The cursor must not currently be on screen.
- */
-static void FreeQDCursor(CCrsrHandle cursHandle)
-{
- CCrsrPtr curs;
- PixMap *pix;
-
- HLock((Handle)cursHandle);
- curs = *cursHandle;
- HLock((Handle)curs->crsrMap);
- pix = *curs->crsrMap;
- DisposeHandle((Handle)pix->pmTable);
- HUnlock((Handle)curs->crsrMap);
- DisposeHandle((Handle)curs->crsrMap);
- DisposeHandle((Handle)curs->crsrData);
- HUnlock((Handle)cursHandle);
- DisposeHandle((Handle)cursHandle);
-}
-
-
-/*
-===========================================================================
-
- Pointer sprite functions
-
-===========================================================================
-*/
-
-/*
- * QuartzRealizeCursor
- * Convert the X cursor representation to QuickDraw format if possible.
- */
-Bool
-QuartzRealizeCursor(
- ScreenPtr pScreen,
- CursorPtr pCursor )
-{
- CCrsrHandle qdCursor;
- QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
-
- if(!pCursor || !pCursor->bits)
- return FALSE;
-
- // if the cursor is too big we use a software cursor
- if ((pCursor->bits->height > CURSORHEIGHT) ||
- (pCursor->bits->width > CURSORWIDTH) || !ScreenPriv->useQDCursor)
- {
- if (quartzRootless) {
- // rootless can't use a software cursor
- return TRUE;
- } else {
- return (*ScreenPriv->spriteFuncs->RealizeCursor)
- (pScreen, pCursor);
- }
- }
-
- // make new cursor image
- qdCursor = MakeQDCursor(pCursor);
- if (!qdCursor) return FALSE;
-
- // save the result
- pCursor->devPriv[pScreen->myNum] = (pointer) qdCursor;
-
- return TRUE;
-}
-
-
-/*
- * QuartzUnrealizeCursor
- * Free the storage space associated with a realized cursor.
- */
-Bool
-QuartzUnrealizeCursor(
- ScreenPtr pScreen,
- CursorPtr pCursor )
-{
- QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
-
- if ((pCursor->bits->height > CURSORHEIGHT) ||
- (pCursor->bits->width > CURSORWIDTH) || !ScreenPriv->useQDCursor)
- {
- if (quartzRootless) {
- return TRUE;
- } else {
- return (*ScreenPriv->spriteFuncs->UnrealizeCursor)
- (pScreen, pCursor);
- }
- } else {
- CCrsrHandle oldCursor = (CCrsrHandle) pCursor->devPriv[pScreen->myNum];
-
- if (currentCursor != oldCursor) {
- // This should only fail when quitting, in which case we just leak.
- FreeQDCursor(oldCursor);
- }
- pCursor->devPriv[pScreen->myNum] = NULL;
- return TRUE;
- }
-}
-
-
-/*
- * QuartzSetCursor
- * Set the cursor sprite and position.
- * Use QuickDraw cursor if possible.
- */
-static void
-QuartzSetCursor(
- ScreenPtr pScreen,
- CursorPtr pCursor,
- int x,
- int y)
-{
- QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
-
- quartzLatentCursor = pCursor;
-
- // Don't touch Mac OS cursor if X is hidden!
- if (!quartzServerVisible)
- return;
-
- if (!pCursor) {
- // Remove the cursor completely.
- HIDE_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible);
- if (! ScreenPriv->qdCursorMode)
- (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, 0, x, y);
- }
- else if ((pCursor->bits->height <= CURSORHEIGHT) &&
- (pCursor->bits->width <= CURSORWIDTH) && ScreenPriv->useQDCursor)
- {
- // Cursor is small enough to use QuickDraw directly.
- if (! ScreenPriv->qdCursorMode) // remove the X cursor
- (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, 0, x, y);
- ScreenPriv->qdCursorMode = TRUE;
-
- CHANGE_QD_CURSOR(pCursor->devPriv[pScreen->myNum]);
- SHOW_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible);
- }
- else if (quartzRootless) {
- // Rootless can't use a software cursor, so we just use Mac OS arrow.
- CHANGE_QD_CURSOR(NULL);
- SHOW_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible);
- }
- else {
- // Cursor is too big for QuickDraw. Use X software cursor.
- HIDE_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible);
- ScreenPriv->qdCursorMode = FALSE;
- (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, pCursor, x, y);
- }
-}
-
-
-/*
- * QuartzReallySetCursor
- * Set the QuickDraw cursor. Called from the main thread since changing the
- * cursor with QuickDraw is not thread safe on dual processor machines.
- */
-void
-QuartzReallySetCursor()
-{
- pthread_mutex_lock(&cursorMutex);
-
- if (currentCursor) {
- SetCCursor(currentCursor);
- } else {
- SetCursor(&gQDArrow);
- }
-
- pthread_cond_signal(&cursorCondition);
- pthread_mutex_unlock(&cursorMutex);
-}
-
-
-/*
- * QuartzMoveCursor
- * Move the cursor. This is a noop for QuickDraw.
- */
-static void
-QuartzMoveCursor(
- ScreenPtr pScreen,
- int x,
- int y)
-{
- QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
-
- // only the X cursor needs to be explicitly moved
- if (!ScreenPriv->qdCursorMode)
- (*ScreenPriv->spriteFuncs->MoveCursor)(pScreen, x, y);
-}
-
-
-static miPointerSpriteFuncRec quartzSpriteFuncsRec = {
- QuartzRealizeCursor,
- QuartzUnrealizeCursor,
- QuartzSetCursor,
- QuartzMoveCursor
-};
-
-
-/*
-===========================================================================
-
- Pointer screen functions
-
-===========================================================================
-*/
-
-/*
- * QuartzCursorOffScreen
- */
-static Bool QuartzCursorOffScreen(ScreenPtr *pScreen, int *x, int *y)
-{
- return FALSE;
-}
-
-
-/*
- * QuartzCrossScreen
- */
-static void QuartzCrossScreen(ScreenPtr pScreen, Bool entering)
-{
- return;
-}
-
-
-/*
- * QuartzWarpCursor
- * Change the cursor position without generating an event or motion history.
- * The input coordinates (x,y) are in pScreen-local X11 coordinates.
- *
- */
-static void
-QuartzWarpCursor(
- ScreenPtr pScreen,
- int x,
- int y)
-{
- static int neverMoved = TRUE;
-
- if (neverMoved) {
- // Don't move the cursor the first time. This is the jump-to-center
- // initialization, and it's annoying because we may still be in MacOS.
- neverMoved = FALSE;
- return;
- }
-
- if (quartzServerVisible) {
- CGDisplayErr cgErr;
- CGPoint cgPoint;
- // Only need to do this for one display. Any display will do.
- CGDirectDisplayID cgID = QUARTZ_PRIV(pScreen)->displayIDs[0];
- CGRect cgRect = CGDisplayBounds(cgID);
-
- // Convert (x,y) to CoreGraphics screen-local CG coordinates.
- // This is necessary because the X11 screen and CG screen may not
- // coincide. (e.g. X11 screen may be moved to dodge the menu bar)
-
- // Make point in X11 global coordinates
- cgPoint = CGPointMake(x + dixScreenOrigins[pScreen->myNum].x,
- y + dixScreenOrigins[pScreen->myNum].y);
- // Shift to CoreGraphics global screen coordinates
- cgPoint.x += darwinMainScreenX;
- cgPoint.y += darwinMainScreenY;
- // Shift to CoreGraphics screen-local coordinates
- cgPoint.x -= cgRect.origin.x;
- cgPoint.y -= cgRect.origin.y;
-
- cgErr = CGDisplayMoveCursorToPoint(cgID, cgPoint);
- if (cgErr != CGDisplayNoErr) {
- ErrorF("Could not set cursor position with error code 0x%x.\n",
- cgErr);
- }
- }
-
- miPointerWarpCursor(pScreen, x, y);
- miPointerUpdate();
-}
-
-
-static miPointerScreenFuncRec quartzScreenFuncsRec = {
- QuartzCursorOffScreen,
- QuartzCrossScreen,
- QuartzWarpCursor,
- NULL,
- NULL
-};
-
-
-/*
-===========================================================================
-
- Other screen functions
-
-===========================================================================
-*/
-
-/*
- * QuartzCursorQueryBestSize
- * Handle queries for best cursor size
- */
-static void
-QuartzCursorQueryBestSize(
- int class,
- unsigned short *width,
- unsigned short *height,
- ScreenPtr pScreen)
-{
- QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
-
- if (class == CursorShape) {
- *width = CURSORWIDTH;
- *height = CURSORHEIGHT;
- } else {
- (*ScreenPriv->QueryBestSize)(class, width, height, pScreen);
- }
-}
-
-
-/*
- * QuartzInitCursor
- * Initialize cursor support
- */
-Bool
-QuartzInitCursor(
- ScreenPtr pScreen )
-{
- QuartzCursorScreenPtr ScreenPriv;
- miPointerScreenPtr PointPriv;
- DarwinFramebufferPtr dfb = SCREEN_PRIV(pScreen);
-
- // initialize software cursor handling (always needed as backup)
- if (!miDCInitialize(pScreen, &quartzScreenFuncsRec)) {
- return FALSE;
- }
-
- // allocate private storage for this screen's QuickDraw cursor info
- if (darwinCursorGeneration != serverGeneration) {
- if ((darwinCursorScreenIndex = AllocateScreenPrivateIndex()) < 0)
- return FALSE;
- darwinCursorGeneration = serverGeneration;
- }
-
- ScreenPriv = xcalloc( 1, sizeof(QuartzCursorScreenRec) );
- if (!ScreenPriv) return FALSE;
-
- CURSOR_PRIV(pScreen) = ScreenPriv;
-
- // override some screen procedures
- ScreenPriv->QueryBestSize = pScreen->QueryBestSize;
- pScreen->QueryBestSize = QuartzCursorQueryBestSize;
-
- // initialize QuickDraw cursor handling
- GetQDGlobalsArrow(&gQDArrow);
- PointPriv = (miPointerScreenPtr)
- pScreen->devPrivates[miPointerScreenIndex].ptr;
-
- ScreenPriv->spriteFuncs = PointPriv->spriteFuncs;
- PointPriv->spriteFuncs = &quartzSpriteFuncsRec;
-
- if (!quartzRootless)
- ScreenPriv->useQDCursor = QuartzFSUseQDCursor(dfb->colorBitsPerPixel);
- else
- ScreenPriv->useQDCursor = TRUE;
- ScreenPriv->qdCursorMode = TRUE;
- ScreenPriv->qdCursorVisible = TRUE;
-
- // initialize cursor mutex lock
- pthread_mutex_init(&cursorMutex, NULL);
-
- // initialize condition for waiting
- pthread_cond_init(&cursorCondition, NULL);
-
- return TRUE;
-}
-
-
-// X server is hiding. Restore the Aqua cursor.
-void QuartzSuspendXCursor(
- ScreenPtr pScreen )
-{
- QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
-
- CHANGE_QD_CURSOR(NULL);
- SHOW_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible);
-}
-
-
-// X server is showing. Restore the X cursor.
-void QuartzResumeXCursor(
- ScreenPtr pScreen,
- int x,
- int y )
-{
- QuartzSetCursor(pScreen, quartzLatentCursor, x, y);
-}
diff --git a/hw/xquartz/quartzCursor.h b/hw/xquartz/quartzCursor.h
deleted file mode 100644
index 56a0209..0000000
--- a/hw/xquartz/quartzCursor.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * quartzCursor.h
- *
- * External interface for Quartz hardware cursor
- *
- * Copyright (c) 2001 Torrey T. Lyons and Greg Parker.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name(s) of the above copyright
- * holders shall not be used in advertising or otherwise to promote the sale,
- * use or other dealings in this Software without prior written authorization.
- */
-
-#ifndef QUARTZCURSOR_H
-#define QUARTZCURSOR_H
-
-#include "screenint.h"
-
-Bool QuartzInitCursor(ScreenPtr pScreen);
-void QuartzReallySetCursor(void);
-void QuartzSuspendXCursor(ScreenPtr pScreen);
-void QuartzResumeXCursor(ScreenPtr pScreen, int x, int y);
-
-#endif
commit a25704c423598d596fd7f2ed4290d4b860bd5d5f
Author: Ben Byer <bbyer at apple.com>
Date: Mon Mar 31 18:15:18 2008 -0700
remove vestigal DarwinEQPointerPost etc
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 9c8efa0..b146321 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -251,23 +251,6 @@ void DarwinEQEnqueue(const xEventPtr e) {
}
/*
- * DarwinEQPointerPost
- * Post a pointer event. Used by the mipointer.c routines.
- */
-void DarwinEQPointerPost(DeviceIntPtr pdev, xEventPtr e) {
- (*darwinEventQueue.pPtr->processInputProc)
- (e, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
-}
-
-
-void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX) {
- darwinEventQueue.pEnqueueScreen = pScreen;
- if (fromDIX)
- darwinEventQueue.pDequeueScreen = pScreen;
-}
-
-
-/*
* ProcessInputEvents
* Read and process events from the event queue until it is empty.
*/
diff --git a/hw/xquartz/quartzCursor.c b/hw/xquartz/quartzCursor.c
index 6e86acb..26ffa77 100644
--- a/hw/xquartz/quartzCursor.c
+++ b/hw/xquartz/quartzCursor.c
@@ -540,8 +540,8 @@ static miPointerScreenFuncRec quartzScreenFuncsRec = {
QuartzCursorOffScreen,
QuartzCrossScreen,
QuartzWarpCursor,
- DarwinEQPointerPost,
- DarwinEQSwitchScreen
+ NULL,
+ NULL
};
diff --git a/hw/xquartz/xpr/xprCursor.c b/hw/xquartz/xpr/xprCursor.c
index dc7a73e..9e94ed5 100644
--- a/hw/xquartz/xpr/xprCursor.c
+++ b/hw/xquartz/xpr/xprCursor.c
@@ -321,8 +321,8 @@ static miPointerScreenFuncRec quartzScreenFuncsRec = {
QuartzCursorOffScreen,
QuartzCrossScreen,
QuartzWarpCursor,
- DarwinEQPointerPost,
- DarwinEQSwitchScreen
+ NULL,
+ NULL
};
commit a9e081a60ca227c0d96d4613075d97d6b762366a
Author: Ben Byer <bbyer at apple.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 9a03ae33c4f9de830f15eabf3b994882ead7c000
Author: Ben Byer <bbyer at apple.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 5848510cc5a8091b30230ab920d904ca6b159480
Author: Ben Byer <bbyer at apple.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 3f4447b95f73a82b3aa0f7b0d1640aba5fb0d1bc
Author: Ben Byer <bbyer at apple.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;
commit 135eb27bce025b21ca9b1b067377fa31f0f1e1c2
Author: Ben Byer <bbyer at apple.com>
Date: Fri Mar 28 20:47:44 2008 -0700
Add code to track 5 valuators for pointing device, in preparation
for supporting tablet input in Xquartz.
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 8ce42c1..0bed917 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -65,7 +65,7 @@ int X11EnableKeyEquivalents = TRUE;
int quartzHasRoot = FALSE, quartzEnableRootless = TRUE;
extern int darwinFakeButtons, input_check_flag;
-extern Bool enable_stereo;
+extern Bool enable_stereo;
extern xEvent *darwinEvents;
@@ -157,7 +157,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
tem = [infoDict objectForKey:@"CFBundleShortVersionString"];
- [dict setObject:[NSString stringWithFormat:@"Xquartz %@ - (xorg-server %s)", tem, XSERVER_VERSION]
+ [dict setObject:[NSString stringWithFormat:@"XQuartz %@ - (xorg-server %s)", tem, XSERVER_VERSION]
forKey:@"ApplicationVersion"];
[self orderFrontStandardAboutPanelWithOptions: dict];
@@ -505,7 +505,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
if (value != NULL
&& CFGetTypeID (value) == CFNumberGetTypeID ()
- && CFNumberIsFloatType (value))
+ && CFNumberIsFloatType (value))
CFNumberGetValue (value, kCFNumberFloatType, &ret);
else if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ())
ret = CFStringGetDoubleValue (value);
@@ -866,7 +866,9 @@ static void send_nsevent (NSEventType type, NSEvent *e) {
NSRect screen;
NSPoint location;
NSWindow *window;
- int pointer_x, pointer_y, ev_button, ev_type;
+ int pointer_x, pointer_y, ev_button, ev_type;
+ float pressure, tilt_x, tilt_y;
+
// int num_events=0, i=0, state;
// xEvent xe;
@@ -888,6 +890,10 @@ static void send_nsevent (NSEventType type, NSEvent *e) {
pointer_y -= aquaMenuBarHeight;
// state = convert_flags ([e modifierFlags]);
+ pressure = 0; // for tablets
+ tilt_x = 0;
+ tilt_y = 0;
+
switch (type) {
case NSLeftMouseDown: ev_button=1; ev_type=ButtonPress; goto handle_mouse;
case NSOtherMouseDown: ev_button=2; ev_type=ButtonPress; goto handle_mouse;
@@ -898,6 +904,10 @@ static void send_nsevent (NSEventType type, NSEvent *e) {
case NSLeftMouseDragged: ev_button=1; ev_type=MotionNotify; goto handle_mouse;
case NSOtherMouseDragged: ev_button=2; ev_type=MotionNotify; goto handle_mouse;
case NSRightMouseDragged: ev_button=3; ev_type=MotionNotify; goto handle_mouse;
+ case NSTabletPoint:
+ pressure = [e pressure];
+ tilt_x = [e tilt].x;
+ tilt_y = [e tilt].y; // fall through
case NSMouseMoved: ev_button=0; ev_type=MotionNotify; goto handle_mouse;
handle_mouse:
@@ -911,10 +921,14 @@ static void send_nsevent (NSEventType type, NSEvent *e) {
DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y);
} else if (ev_type==ButtonRelease && (button_state & (1 << ev_button)) == 0) break;
*/
- DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y);
+
+ // if ([e subtype] == NSTabletPointEventSubtype) pressure = [e pressure];
+ DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y,
+ pressure, tilt_x, tilt_y);
break;
- case NSScrollWheel:
- DarwinSendScrollEvents([e deltaY], pointer_x, pointer_y);
+ case NSScrollWheel:
+ DarwinSendScrollEvents([e deltaY], pointer_x, pointer_y,
+ pressure, tilt_x, tilt_y);
break;
case NSKeyDown: // do we need to translate these keyCodes?
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 60a9084..d6d9ba5 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -173,6 +173,9 @@ static void DarwinReleaseModifiers(void) {
static void DarwinSimulateMouseClick(
int pointer_x,
int pointer_y,
+ float pressure,
+ float tilt_x,
+ float tilt_y,
int whichButton, // mouse button to be pressed
int modifierMask) // modifiers used for the fake click
{
@@ -183,8 +186,10 @@ static void DarwinSimulateMouseClick(
DarwinUpdateModifiers(KeyRelease, modifierMask);
// push the mouse button
- DarwinSendPointerEvents(ButtonPress, whichButton, pointer_x, pointer_y);
- DarwinSendPointerEvents(ButtonRelease, whichButton, pointer_x, pointer_y);
+ DarwinSendPointerEvents(ButtonPress, whichButton, pointer_x, pointer_y,
+ pressure, tilt_x, tilt_y);
+ DarwinSendPointerEvents(ButtonRelease, whichButton, pointer_x, pointer_y,
+ pressure, tilt_x, tilt_y);
// restore old modifiers
DarwinUpdateModifiers(KeyPress, modifierMask);
@@ -378,22 +383,39 @@ void DarwinPokeEQ(void) {
write(darwinEventWriteFD, &nullbyte, 1);
}
-void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y) {
+void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y,
+ float pressure, float tilt_x, float tilt_y) {
static int darwinFakeMouseButtonDown = 0;
static int darwinFakeMouseButtonMask = 0;
int i, num_events;
- int valuators[2] = {pointer_x, pointer_y};
+
+ /* I can't find a spec for this, but at least GTK expects that tablets are
+ just like mice, except they have either one or three extra valuators, in this
+ order:
+
+ X coord, Y coord, pressure, X tilt, Y tilt
+ Pressure and tilt should be represented natively as floats; unfortunately,
+ we can't do that. Again, GTK seems to record the min/max of each valuator,
+ and then perform scaling back to float itself using that info. Soo.... */
+
+ int valuators[5] = {pointer_x, pointer_y,
+ pressure * INT32_MAX * 1.0f,
+ tilt_x * INT32_MAX * 1.0f,
+ tilt_y * INT32_MAX * 1.0f};
+
if (ev_type == ButtonPress && darwinFakeButtons && ev_button == 1) {
// Mimic multi-button mouse with modifier-clicks
// If both sets of modifiers are pressed,
// button 2 is clicked.
if ((old_flags & darwinFakeMouse2Mask) == darwinFakeMouse2Mask) {
- DarwinSimulateMouseClick(pointer_x, pointer_y, 2, darwinFakeMouse2Mask);
+ DarwinSimulateMouseClick(pointer_x, pointer_y, pressure,
+ tilt_x, tilt_y, 2, darwinFakeMouse2Mask);
darwinFakeMouseButtonDown = 2;
darwinFakeMouseButtonMask = darwinFakeMouse2Mask;
return;
} else if ((old_flags & darwinFakeMouse3Mask) == darwinFakeMouse3Mask) {
- DarwinSimulateMouseClick(pointer_x, pointer_y, 3, darwinFakeMouse3Mask);
+ DarwinSimulateMouseClick(pointer_x, pointer_y, pressure,
+ tilt_x, tilt_y, 3, darwinFakeMouse3Mask);
darwinFakeMouseButtonDown = 3;
darwinFakeMouseButtonMask = darwinFakeMouse3Mask;
return;
@@ -412,7 +434,7 @@ void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int poin
}
num_events = GetPointerEvents(darwinEvents, darwinPointer, ev_type, ev_button,
- POINTER_ABSOLUTE, 0, 2, valuators);
+ POINTER_ABSOLUTE, 0, 5, valuators);
for(i=0; i<num_events; i++) mieqEnqueue (darwinPointer,&darwinEvents[i]);
DarwinPokeEQ();
@@ -438,18 +460,38 @@ void DarwinSendKeyboardEvents(int ev_type, int keycode) {
DarwinPokeEQ();
}
+void DarwinSendProximityEvents(int ev_type, int pointer_x, int pointer_y,
+ float pressure, float tilt_x, float tilt_y) {
+ int i, num_events;
+ int valuators[5] = {pointer_x, pointer_y,
+ pressure * INT32_MAX * 1.0f,
+ tilt_x * INT32_MAX * 1.0f,
+ tilt_y * INT32_MAX * 1.0f};
+
+ num_events = GetProximityEvents(darwinEvents, darwinPointer, ev_type,
+ 0, 5, valuators);
+
+ for(i=0; i<num_events; i++) mieqEnqueue (darwinPointer,&darwinEvents[i]);
+ DarwinPokeEQ();
+}
+
+
/* Send the appropriate number of button 4 / 5 clicks to emulate scroll wheel */
-void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y) {
+void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y,
+ float pressure, float tilt_x, float tilt_y) {
int i;
int ev_button = count > 0.0f ? 4 : 5;
- int valuators[2] = {pointer_x, pointer_y};
+ int valuators[5] = {pointer_x, pointer_y,
+ pressure * INT32_MAX * 1.0f,
+ tilt_x * INT32_MAX * 1.0f,
+ tilt_y * INT32_MAX * 1.0f};
for (count = fabs(count); count > 0.0; count = count - 1.0f) {
int num_events = GetPointerEvents(darwinEvents, darwinPointer, ButtonPress, ev_button,
- POINTER_ABSOLUTE, 0, 2, valuators);
+ POINTER_ABSOLUTE, 0, 5, valuators);
for(i=0; i<num_events; i++) mieqEnqueue(darwinPointer,&darwinEvents[i]);
num_events = GetPointerEvents(darwinEvents, darwinPointer, ButtonRelease, ev_button,
- POINTER_ABSOLUTE, 0, 2, valuators);
+ POINTER_ABSOLUTE, 0, 5, valuators);
for(i=0; i<num_events; i++) mieqEnqueue(darwinPointer,&darwinEvents[i]);
}
DarwinPokeEQ();
diff --git a/hw/xquartz/darwinEvents.h b/hw/xquartz/darwinEvents.h
index 82cc26b..4960614 100644
--- a/hw/xquartz/darwinEvents.h
+++ b/hw/xquartz/darwinEvents.h
@@ -32,9 +32,13 @@ void DarwinEQEnqueue(const xEventPtr e);
void DarwinEQPointerPost(DeviceIntPtr pDev, xEventPtr e);
void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
void DarwinPokeEQ(void);
-void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y);
+void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y,
+ float pressure, float tilt_x, float tilt_y);
+void DarwinSendProximityEvents(int ev_type, int pointer_x, int pointer_y,
+ float pressure, float tilt_x, float tilt_y);
void DarwinSendKeyboardEvents(int ev_type, int keycode);
-void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y);
+void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y,
+ float pressure, float tilt_x, float tilt_y);
void DarwinUpdateModKeys(int flags);
#endif /* _DARWIN_EVENTS_H */
commit a6c8fbc818933bdcf9ba0705ebbaa0a039fe5b7b
Author: Ben Byer <bbyer at apple.com>
Date: Fri Mar 28 18:27:02 2008 -0700
add debug statements so we can see if/when our Xinput stubs are getting called.
diff --git a/hw/xquartz/darwinXinput.c b/hw/xquartz/darwinXinput.c
index 50ba656..59bae6f 100644
--- a/hw/xquartz/darwinXinput.c
+++ b/hw/xquartz/darwinXinput.c
@@ -62,6 +62,7 @@ SOFTWARE.
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "XIstubs.h"
+#include "darwin.h"
/***********************************************************************
*
@@ -79,6 +80,7 @@ SOFTWARE.
void
CloseInputDevice(DeviceIntPtr d, ClientPtr client)
{
+ DEBUG_LOG("CloseInputDevice(%p, %p)\n", d, client);
}
/***********************************************************************
@@ -122,7 +124,7 @@ AddOtherInputDevices(void)
RegisterOtherDevice(dev);
dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success);
************************************************************************/
-
+ DEBUG_LOG("AddOtherInputDevices\n");
}
/***********************************************************************
@@ -150,6 +152,7 @@ AddOtherInputDevices(void)
void
OpenInputDevice(DeviceIntPtr dev, ClientPtr client, int *status)
{
+ DEBUG_LOG("OpenInputDevice(%p, %p, %p)\n", dev, client, status);
}
/****************************************************************************
@@ -167,6 +170,7 @@ OpenInputDevice(DeviceIntPtr dev, ClientPtr client, int *status)
int
SetDeviceMode(ClientPtr client, DeviceIntPtr dev, int mode)
{
+ DEBUG_LOG("SetDeviceMode(%p, %p, %d)\n", client, dev, mode);
return BadMatch;
}
@@ -186,7 +190,9 @@ int
SetDeviceValuators(ClientPtr client, DeviceIntPtr dev,
int *valuators, int first_valuator, int num_valuators)
{
- return BadMatch;
+ DEBUG_LOG("SetDeviceValuators(%p, %p, %p, %d, %d)\n", client,
+ dev, valuators, first_valuator, num_valuators);
+ return BadMatch;
}
/****************************************************************************
@@ -201,6 +207,8 @@ int
ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev,
xDeviceCtl * control)
{
+
+ DEBUG_LOG("ChangeDeviceControl(%p, %p, %p)\n", client, dev, control);
switch (control->control) {
case DEVICE_RESOLUTION:
return (BadMatch);
@@ -225,7 +233,8 @@ ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev,
int
NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev)
{
- return BadValue;
+ DEBUG_LOG("NewInputDeviceRequest(%p, %p)\n", options, pdev);
+ return BadValue;
}
/****************************************************************************
@@ -238,4 +247,5 @@ NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev)
void
DeleteInputDeviceRequest(DeviceIntPtr dev)
{
+ DEBUG_LOG("DeleteInputDeviceRequest(%p)\n", dev);
}
commit 8b5737b3cf54afd01013045622c7af8d8e316507
Author: Ben Byer <bbyer at apple.com>
Date: Fri Mar 28 18:25:03 2008 -0700
Remove calls to InitValuatorAxisStruct -- these are now handled in dix by
InitValuatorDeviceClass.
Add InitProximityClassDeviceStruct call to prepare for tablet support.
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index fa65a79..ec1d5e0 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -353,24 +353,8 @@ static int DarwinMouseProc(
InitPointerDeviceStruct( (DevicePtr)pPointer, map, 5,
GetMotionHistory,
(PtrCtrlProcPtr)NoopDDA,
- GetMotionHistorySize(), 2);
-
-#ifdef XINPUT
- InitValuatorAxisStruct( pPointer,
- 0, // X axis
- 0, // min value
- 16000, // max value (fixme screen size?)
- 1, // resolution (fixme ?)
- 1, // min resolution
- 1 ); // max resolution
- InitValuatorAxisStruct( pPointer,
- 1, // X axis
- 0, // min value
- 16000, // max value (fixme screen size?)
- 1, // resolution (fixme ?)
- 1, // min resolution
- 1 ); // max resolution
-#endif
+ GetMotionHistorySize(), 5);
+ InitProximityClassDeviceStruct( (DevicePtr)pPointer);
break;
case DEVICE_ON:
commit a28b8c23d9fa606c68dd5e5f86af52e19604b245
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Fri Mar 28 17:00:08 2008 -0700
XQuartz: Fixed names of enums to be more consistent
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 2172b3c..8ce42c1 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -157,7 +157,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
tem = [infoDict objectForKey:@"CFBundleShortVersionString"];
- [dict setObject:[NSString stringWithFormat:@"XQuartz %@ - (xorg-server %s)", tem, XSERVER_VERSION]
+ [dict setObject:[NSString stringWithFormat:@"Xquartz %@ - (xorg-server %s)", tem, XSERVER_VERSION]
forKey:@"ApplicationVersion"];
[self orderFrontStandardAboutPanelWithOptions: dict];
@@ -170,7 +170,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
static TSMDocumentID x11_document;
DEBUG_LOG("state=%d, _x_active=%d, \n", state, _x_active)
if (state) {
- QuartzMessageServerThread (kXDarwinActivate, 0);
+ QuartzMessageServerThread (kXquartzActivate, 0);
if (!_x_active) {
if (x11_document == 0 && darwinKeymapFile == NULL) {
@@ -182,7 +182,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
if (x11_document != 0) ActivateTSMDocument (x11_document);
}
} else {
- QuartzMessageServerThread (kXDarwinDeactivate, 0);
+ QuartzMessageServerThread (kXquartzDeactivate, 0);
if (_x_active && x11_document != 0)
DeactivateTSMDocument (x11_document);
@@ -250,7 +250,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
swallow_up = 0;
for_x = NO;
#ifdef DARWIN_DDX_MISSING
- QuartzMessageServerThread (kXDarwinToggleFullscreen, 0);
+ QuartzMessageServerThread (kXquartzToggleFullscreen, 0);
#endif
}
} else {
@@ -658,7 +658,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
/* This will end up at the end of the responder chain. */
- (void) copy:sender {
- QuartzMessageServerThread (kXDarwinPasteboardNotify, 1,
+ QuartzMessageServerThread (kXquartzPasteboardNotify, 1,
AppleWMCopyToPasteboard);
}
diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m
index dfa2074..aa9fa94 100644
--- a/hw/xquartz/X11Controller.m
+++ b/hw/xquartz/X11Controller.m
@@ -103,7 +103,7 @@
{
[NSApp activateIgnoringOtherApps:YES];
- QuartzMessageServerThread (kXDarwinControllerNotify, 2,
+ QuartzMessageServerThread (kXquartzControllerNotify, 2,
AppleWMWindowMenuItem, [sender tag]);
}
@@ -254,7 +254,7 @@
[self remove_window_menu];
[self install_window_menu:list];
- QuartzMessageServerThread (kXDarwinControllerNotify, 1,
+ QuartzMessageServerThread (kXquartzControllerNotify, 1,
AppleWMWindowMenuNotify);
}
@@ -539,20 +539,20 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
- (void) hide_window:sender
{
if ([X11App x_active])
- QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMHideWindow);
+ QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMHideWindow);
else
NSBeep (); /* FIXME: something here */
}
- (IBAction)bring_to_front:sender
{
- QuartzMessageServerThread(kXDarwinControllerNotify, 1, AppleWMBringAllToFront);
+ QuartzMessageServerThread(kXquartzControllerNotify, 1, AppleWMBringAllToFront);
}
- (IBAction)close_window:sender
{
if ([X11App x_active])
- QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMCloseWindow);
+ QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMCloseWindow);
else
[[NSApp keyWindow] performClose:sender];
}
@@ -560,7 +560,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
- (IBAction)minimize_window:sender
{
if ([X11App x_active])
- QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMMinimizeWindow);
+ QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMMinimizeWindow);
else
[[NSApp keyWindow] performMiniaturize:sender];
}
@@ -568,19 +568,19 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
- (IBAction)zoom_window:sender
{
if ([X11App x_active])
- QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMZoomWindow);
+ QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMZoomWindow);
else
[[NSApp keyWindow] performZoom:sender];
}
- (IBAction) next_window:sender
{
- QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMNextWindow);
+ QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMNextWindow);
}
- (IBAction) previous_window:sender
{
- QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMPreviousWindow);
+ QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMPreviousWindow);
}
- (IBAction) enable_fullscreen_changed:sender
@@ -588,7 +588,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
int value = ![enable_fullscreen intValue];
#ifdef DARWIN_DDX_MISSING
- QuartzMessageServerThread (kXDarwinSetRootless, 1, value);
+ QuartzMessageServerThread (kXquartzSetRootless, 1, value);
#endif
[NSApp prefs_set_boolean:@PREFS_ROOTLESS value:value];
@@ -598,7 +598,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
- (IBAction) toggle_fullscreen:sender
{
#ifdef DARWIN_DDX_MISSING
- QuartzMessageServerThread (kXDarwinToggleFullscreen, 0);
+ QuartzMessageServerThread (kXquartzToggleFullscreen, 0);
#endif
}
@@ -661,7 +661,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
- (IBAction) quit:sender
{
- QuartzMessageServerThread (kXDarwinQuit, 0);
+ QuartzMessageServerThread (kXquartzQuit, 0);
}
- (IBAction) x11_help:sender
@@ -684,12 +684,12 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
- (void) applicationDidHide:(NSNotification *)notify
{
- QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMHideAll);
+ QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMHideAll);
}
- (void) applicationDidUnhide:(NSNotification *)notify
{
- QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMShowAll);
+ QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMShowAll);
}
- (NSApplicationTerminateReply) applicationShouldTerminate:sender
@@ -717,7 +717,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
[X11App prefs_synchronize];
/* shutdown the X server, it will exit () for us. */
- QuartzMessageServerThread (kXDarwinQuit, 0);
+ QuartzMessageServerThread (kXquartzQuit, 0);
/* In case it doesn't, exit anyway after a while. */
while (sleep (10) != 0) ;
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 873f709..fa65a79 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -150,7 +150,7 @@ void
DarwinPrintBanner(void)
{
// this should change depending on which specific server we are building
- ErrorF("XQuartz starting:\n");
+ ErrorF("Xquartz starting:\n");
ErrorF("X.org Release 7.2\n"); // This is here to help fink until they fix their packages.
ErrorF("X.Org X Server %s\nBuild Date: %s\n", XSERVER_VERSION, BUILD_DATE );
}
@@ -863,7 +863,7 @@ void ddxUseMsg( void )
*/
void ddxGiveUp( void )
{
- ErrorF( "Quitting XQuartz...\n" );
+ ErrorF( "Quitting Xquartz...\n" );
//if (!quartzRootless)
// quartzProcs->ReleaseScreens();
diff --git a/hw/xquartz/darwin.h b/hw/xquartz/darwin.h
index 0d8e457..ce104cf 100644
--- a/hw/xquartz/darwin.h
+++ b/hw/xquartz/darwin.h
@@ -90,34 +90,34 @@ extern int darwinMainScreenY;
* Special ddx events understood by the X server
*/
enum {
- kXDarwinUpdateModifiers // update all modifier keys
+ kXquartzUpdateModifiers // update all modifier keys
= LASTEvent+1, // (from X.h list of event names)
- kXDarwinUpdateButtons, // update state of mouse buttons 2 and up
- kXDarwinScrollWheel, // scroll wheel event
+ kXquartzUpdateButtons, // update state of mouse buttons 2 and up
+ kXquartzScrollWheel, // scroll wheel event
/*
* Quartz-specific events -- not used in IOKit mode
*/
- kXDarwinActivate, // restore X drawing and cursor
- kXDarwinDeactivate, // clip X drawing and switch to Aqua cursor
- kXDarwinSetRootClip, // enable or disable drawing to the X screen
- kXDarwinQuit, // kill the X server and release the display
- kXDarwinReadPasteboard, // copy Mac OS X pasteboard into X cut buffer
- kXDarwinWritePasteboard, // copy X cut buffer onto Mac OS X pasteboard
- kXDarwinBringAllToFront, // bring all X windows to front
- kXDarwinToggleFullscreen, // Enable/Disable fullscreen mode
- kXDarwinSetRootless, // Set rootless mode
- kXDarwinSpaceChanged, // Spaces changed
+ kXquartzActivate, // restore X drawing and cursor
+ kXquartzDeactivate, // clip X drawing and switch to Aqua cursor
+ kXquartzSetRootClip, // enable or disable drawing to the X screen
+ kXquartzQuit, // kill the X server and release the display
+ kXquartzReadPasteboard, // copy Mac OS X pasteboard into X cut buffer
+ kXquartzWritePasteboard, // copy X cut buffer onto Mac OS X pasteboard
+ kXquartzBringAllToFront, // bring all X windows to front
+ kXquartzToggleFullscreen, // Enable/Disable fullscreen mode
+ kXquartzSetRootless, // Set rootless mode
+ kXquartzSpaceChanged, // Spaces changed
/*
* AppleWM events
*/
- kXDarwinControllerNotify, // send an AppleWMControllerNotify event
- kXDarwinPasteboardNotify, // notify the WM to copy or paste
+ kXquartzControllerNotify, // send an AppleWMControllerNotify event
+ kXquartzPasteboardNotify, // notify the WM to copy or paste
/*
* Xplugin notification events
*/
- kXDarwinDisplayChanged, // display configuration has changed
- kXDarwinWindowState, // window visibility state has changed
- kXDarwinWindowMoved, // window has moved on screen
+ kXquartzDisplayChanged, // display configuration has changed
+ kXquartzWindowState, // window visibility state has changed
+ kXquartzWindowMoved, // window has moved on screen
};
#define ENABLE_DEBUG_LOG 1
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index a183011..60a9084 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -152,7 +152,7 @@ static void DarwinUpdateModifiers(
/*
* DarwinReleaseModifiers
* This hacky function releases all modifier keys. It should be called when X11.app
- * is deactivated (kXDarwinDeactivate) to prevent modifiers from getting stuck if they
+ * is deactivated (kXquartzDeactivate) to prevent modifiers from getting stuck if they
* are held down during a "context" switch -- otherwise, we would miss the KeyUp.
*/
static void DarwinReleaseModifiers(void) {
@@ -341,22 +341,22 @@ void ProcessInputEvents(void) {
break;
case MotionNotify:
- ErrorF("Unexpected ButtonRelease event in DarwinProcessInputEvents\n");
+ ErrorF("Unexpected MotionNotify event in DarwinProcessInputEvents\n");
break;
- case kXDarwinUpdateModifiers:
- ErrorF("Unexpected ButtonRelease event in DarwinProcessInputEvents\n");
+ case kXquartzUpdateModifiers:
+ ErrorF("Unexpected kXquartzUpdateModifiers event in DarwinProcessInputEvents\n");
break;
- case kXDarwinUpdateButtons:
- ErrorF("Unexpected XDarwinScrollWheel event in DarwinProcessInputEvents\n");
+ case kXquartzUpdateButtons:
+ ErrorF("Unexpected kXquartzUpdateButtons event in DarwinProcessInputEvents\n");
break;
- case kXDarwinScrollWheel:
- ErrorF("Unexpected XDarwinScrollWheel event in DarwinProcessInputEvents\n");
+ case kXquartzScrollWheel:
+ ErrorF("Unexpected kXquartzScrollWheel event in DarwinProcessInputEvents\n");
break;
- case kXDarwinDeactivate:
+ case kXquartzDeactivate:
DarwinReleaseModifiers();
// fall through
default:
diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index 46027fd..1f1b9a4 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -419,24 +419,24 @@ QuartzMessageServerThread(
*/
void QuartzProcessEvent(xEvent *xe) {
switch (xe->u.u.type) {
- case kXDarwinControllerNotify:
- DEBUG_LOG("kXDarwinControllerNotify\n");
+ case kXquartzControllerNotify:
+ DEBUG_LOG("kXquartzControllerNotify\n");
AppleWMSendEvent(AppleWMControllerNotify,
AppleWMControllerNotifyMask,
xe->u.clientMessage.u.l.longs0,
xe->u.clientMessage.u.l.longs1);
break;
- case kXDarwinPasteboardNotify:
- DEBUG_LOG("kXDarwinPasteboardNotify\n");
+ case kXquartzPasteboardNotify:
+ DEBUG_LOG("kXquartzPasteboardNotify\n");
AppleWMSendEvent(AppleWMPasteboardNotify,
AppleWMPasteboardNotifyMask,
xe->u.clientMessage.u.l.longs0,
xe->u.clientMessage.u.l.longs1);
break;
- case kXDarwinActivate:
- DEBUG_LOG("kXDarwinActivate\n");
+ case kXquartzActivate:
+ DEBUG_LOG("kXquartzActivate\n");
QuartzShow(xe->u.keyButtonPointer.rootX,
xe->u.keyButtonPointer.rootY);
AppleWMSendEvent(AppleWMActivationNotify,
@@ -444,74 +444,74 @@ void QuartzProcessEvent(xEvent *xe) {
AppleWMIsActive, 0);
break;
- case kXDarwinDeactivate:
- DEBUG_LOG("kXDarwinDeactivate\n");
+ case kXquartzDeactivate:
+ DEBUG_LOG("kXquartzDeactivate\n");
AppleWMSendEvent(AppleWMActivationNotify,
AppleWMActivationNotifyMask,
AppleWMIsInactive, 0);
QuartzHide();
break;
- case kXDarwinDisplayChanged:
- DEBUG_LOG("kXDarwinDisplayChanged\n");
+ case kXquartzDisplayChanged:
+ DEBUG_LOG("kXquartzDisplayChanged\n");
QuartzUpdateScreens();
break;
- case kXDarwinWindowState:
- DEBUG_LOG("kXDarwinWindowState\n");
+ case kXquartzWindowState:
+ DEBUG_LOG("kXquartzWindowState\n");
RootlessNativeWindowStateChanged(xe->u.clientMessage.u.l.longs0,
xe->u.clientMessage.u.l.longs1);
break;
- case kXDarwinWindowMoved:
- DEBUG_LOG("kXDarwinWindowMoved\n");
+ case kXquartzWindowMoved:
+ DEBUG_LOG("kXquartzWindowMoved\n");
RootlessNativeWindowMoved ((WindowPtr)xe->u.clientMessage.u.l.longs0);
break;
- case kXDarwinToggleFullscreen:
- DEBUG_LOG("kXDarwinToggleFullscreen\n");
+ case kXquartzToggleFullscreen:
+ DEBUG_LOG("kXquartzToggleFullscreen\n");
#ifdef DARWIN_DDX_MISSING
if (quartzEnableRootless) QuartzSetFullscreen(!quartzHasRoot);
else if (quartzHasRoot) QuartzHide();
else QuartzShow();
#else
- // ErrorF("kXDarwinToggleFullscreen not implemented\n");
+ // ErrorF("kXquartzToggleFullscreen not implemented\n");
#endif
break;
- case kXDarwinSetRootless:
- DEBUG_LOG("kXDarwinSetRootless\n");
+ case kXquartzSetRootless:
+ DEBUG_LOG("kXquartzSetRootless\n");
#ifdef DARWIN_DDX_MISSING
QuartzSetRootless(xe->u.clientMessage.u.l.longs0);
if (!quartzEnableRootless && !quartzHasRoot) QuartzHide();
#else
- // ErrorF("kXDarwinSetRootless not implemented\n");
+ // ErrorF("kXquartzSetRootless not implemented\n");
#endif
break;
- case kXDarwinSetRootClip:
+ case kXquartzSetRootClip:
QuartzSetRootClip((BOOL)xe->u.clientMessage.u.l.longs0);
break;
- case kXDarwinQuit:
+ case kXquartzQuit:
GiveUp(0);
break;
- case kXDarwinReadPasteboard:
+ case kXquartzReadPasteboard:
QuartzReadPasteboard();
break;
- case kXDarwinWritePasteboard:
+ case kXquartzWritePasteboard:
QuartzWritePasteboard();
break;
- case kXDarwinBringAllToFront:
- DEBUG_LOG("kXDarwinBringAllToFront\n");
+ case kXquartzBringAllToFront:
+ DEBUG_LOG("kXquartzBringAllToFront\n");
RootlessOrderAllWindows();
break;
- case kXDarwinSpaceChanged:
- DEBUG_LOG("kXDarwinSpaceChanged\n");
+ case kXquartzSpaceChanged:
+ DEBUG_LOG("kXquartzSpaceChanged\n");
QuartzSpaceChanged(xe->u.clientMessage.u.l.longs0);
break;
default:
diff --git a/hw/xquartz/quartzKeyboard.h b/hw/xquartz/quartzKeyboard.h
index 0c7e70e..8131b56 100644
--- a/hw/xquartz/quartzKeyboard.h
+++ b/hw/xquartz/quartzKeyboard.h
@@ -45,7 +45,7 @@ typedef struct darwinKeyboardInfo_struct {
unsigned char modifierKeycodes[32][2];
} darwinKeyboardInfo;
-/* These functions need to be implemented by XQuartz, XDarwin, etc. */
+/* These functions need to be implemented by Xquartz, XDarwin, etc. */
void DarwinKeyboardReload(DeviceIntPtr pDev);
Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info);
unsigned int QuartzSystemKeymapSeed(void);
diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c
index 4dc5846..b653a6e 100644
--- a/hw/xquartz/xpr/xprScreen.c
+++ b/hw/xquartz/xpr/xprScreen.c
@@ -67,7 +67,7 @@ static void eventHandler(unsigned int type, const void *arg,
switch (type) {
case XP_EVENT_DISPLAY_CHANGED:
DEBUG_LOG("XP_EVENT_DISPLAY_CHANGED\n");
- QuartzMessageServerThread(kXDarwinDisplayChanged, 0);
+ QuartzMessageServerThread(kXquartzDisplayChanged, 0);
break;
case XP_EVENT_WINDOW_STATE_CHANGED:
@@ -75,7 +75,7 @@ static void eventHandler(unsigned int type, const void *arg,
const xp_window_state_event *ws_arg = arg;
DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: id=%d, state=%d\n", ws_arg->id, ws_arg->state);
- QuartzMessageServerThread(kXDarwinWindowState, 2,
+ QuartzMessageServerThread(kXquartzWindowState, 2,
ws_arg->id, ws_arg->state);
} else {
DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: ignored\n");
@@ -87,7 +87,7 @@ static void eventHandler(unsigned int type, const void *arg,
if (arg_size == sizeof(xp_window_id)) {
xp_window_id id = * (xp_window_id *) arg;
WindowPtr pWin = xprGetXWindow(id);
- QuartzMessageServerThread(kXDarwinWindowMoved, 1, pWin);
+ QuartzMessageServerThread(kXquartzWindowMoved, 1, pWin);
}
break;
@@ -110,7 +110,7 @@ static void eventHandler(unsigned int type, const void *arg,
ErrorF("XP_EVENT_SPACE_CHANGED\n");
if(arg_size == sizeof(uint32_t)) {
uint32_t space_id = *(uint32_t *)arg;
- QuartzMessageServerThread(kXDarwinSpaceChanged, 1, space_id);
+ QuartzMessageServerThread(kXquartzSpaceChanged, 1, space_id);
}
break;
default:
commit cc17ce1b73dadee75ad96ae96757fe8e4ba990de
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Fri Mar 28 16:38:18 2008 -0700
XQuartz: Another Exposé fix: F9 doesn't raise all windows
(cherry picked from commit b9cffa20debae73737c674bf75ab65db1bd74556)
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 1ed87c6..2172b3c 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -318,9 +318,10 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
}
- (void) set_front_process:unused {
- QuartzMessageServerThread(kXDarwinBringAllToFront, 0);
- ProcessSerialNumber psn = { 0, kCurrentProcess };
- SetFrontProcess(&psn);
+ [NSApp activateIgnoringOtherApps:YES];
+
+ if ([self modalWindow] == nil)
+ [self activateX:YES];
}
- (void) set_can_quit:(NSNumber *)state {
commit f57a2f38eee5e0f537e62c495dce1fcebffe3a54
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Tue Mar 25 23:01:02 2008 -0700
XQuartz: Sanity-check the removal of the 256-color option
Fixes the 'one-time-preferences' bug in 2.2.0_rc1
(cherry picked from commit 38cbd13490fc21724e8eef0ec7e1a20a9cc2e39d)
diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m
index a9d2add..dfa2074 100644
--- a/hw/xquartz/X11Controller.m
+++ b/hw/xquartz/X11Controller.m
@@ -649,7 +649,8 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
[depth selectItemAtIndex:[depth indexOfItemWithTag:[NSApp prefs_get_integer:@PREFS_DEPTH default:-1]]];
// TODO: Add 256 color support
- [depth removeItemAtIndex:[depth indexOfItemWithTag:8]];
+ if([depth indexOfItemWithTag:8] != -1)
+ [depth removeItemAtIndex:[depth indexOfItemWithTag:8]];
[enable_fullscreen setIntValue:!quartzEnableRootless];
// TODO: Add fullscreen support
commit de722e2fea70467a1299b728a1bd9028664ec0c9
Author: Ben Byer <bbyer at apple.com>
Date: Tue Mar 25 19:25:00 2008 -0700
xquartz: copy in new stubs from Xi/stubs.c to replace our old
Xinput stubs. Hey, it's a start.
diff --git a/hw/xquartz/darwinXinput.c b/hw/xquartz/darwinXinput.c
index e62ec0a..50ba656 100644
--- a/hw/xquartz/darwinXinput.c
+++ b/hw/xquartz/darwinXinput.c
@@ -1,8 +1,7 @@
-
/*
- * X server support of the XINPUT extension for Darwin
+ * X server support of the XINPUT extension for xquartz
*
- * This is currently a copy of mi/stubs.c, but eventually this
+ * This is currently a copy of Xi/stubs.c, but eventually this
* should include more complete XINPUT support.
*/
@@ -52,100 +51,17 @@ SOFTWARE.
********************************************************/
+#define NEED_EVENTS
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
-#define NEED_EVENTS
#include <X11/X.h>
#include <X11/Xproto.h>
#include "inputstr.h"
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "XIstubs.h"
-#include "chgkbd.h"
-
-/***********************************************************************
- *
- * Caller: ProcXChangeKeyboardDevice
- *
- * This procedure does the implementation-dependent portion of the work
- * needed to change the keyboard device.
- *
- * The X keyboard device has a FocusRec. If the device that has been
- * made into the new X keyboard did not have a FocusRec,
- * ProcXChangeKeyboardDevice will allocate one for it.
- *
- * If you do not want clients to be able to focus the old X keyboard
- * device, call DeleteFocusClassDeviceStruct to free the FocusRec.
- *
- * If you support input devices with keys that you do not want to be
- * used as the X keyboard, you need to check for them here and return
- * a BadDevice error.
- *
- * The default implementation is to do nothing (assume you do want
- * clients to be able to focus the old X keyboard). The commented-out
- * sample code shows what you might do if you don't want the default.
- *
- */
-
-int ChangeKeyboardDevice (DeviceIntPtr old_dev, DeviceIntPtr new_dev) {
- /***********************************************************************
- DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c *
- **********************************************************************/
- return BadMatch;
-}
-
-
-/***********************************************************************
- *
- * Caller: ProcXChangePointerDevice
- *
- * This procedure does the implementation-dependent portion of the work
- * needed to change the pointer device.
- *
- * The X pointer device does not have a FocusRec. If the device that
- * has been made into the new X pointer had a FocusRec,
- * ProcXChangePointerDevice will free it.
- *
- * If you want clients to be able to focus the old pointer device that
- * has now become accessible through the input extension, you need to
- * add a FocusRec to it here.
- *
- * The XChangePointerDevice protocol request also allows the client
- * to choose which axes of the new pointer device are used to move
- * the X cursor in the X- and Y- directions. If the axes are different
- * than the default ones, you need to keep track of that here.
- *
- * If you support input devices with valuators that you do not want to be
- * used as the X pointer, you need to check for them here and return a
- * BadDevice error.
- *
- * The default implementation is to do nothing (assume you don't want
- * clients to be able to focus the old X pointer). The commented-out
- * sample code shows what you might do if you don't want the default.
- *
- */
-
-int
-ChangePointerDevice (
- DeviceIntPtr old_dev,
- DeviceIntPtr new_dev,
- unsigned char x,
- unsigned char y)
- {
- /***********************************************************************
- InitFocusClassDeviceStruct(old_dev); * allow focusing old ptr*
-
- x_axis = x; * keep track of new x-axis*
- y_axis = y; * keep track of new y-axis*
- if (x_axis != 0 || y_axis != 1)
- axes_changed = TRUE; * remember axes have changed*
- else
- axes_changed = FALSE;
- *************************************************************************/
- return BadMatch;
- }
/***********************************************************************
*
@@ -161,11 +77,9 @@ ChangePointerDevice (
*/
void
-CloseInputDevice (d, client)
- DeviceIntPtr d;
- ClientPtr client;
- {
- }
+CloseInputDevice(DeviceIntPtr d, ClientPtr client)
+{
+}
/***********************************************************************
*
@@ -194,8 +108,8 @@ CloseInputDevice (d, client)
*/
void
-AddOtherInputDevices ()
- {
+AddOtherInputDevices(void)
+{
/**********************************************************************
for each uninitialized device, do something like:
@@ -209,7 +123,7 @@ AddOtherInputDevices ()
dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success);
************************************************************************/
- }
+}
/***********************************************************************
*
@@ -234,12 +148,9 @@ AddOtherInputDevices ()
*/
void
-OpenInputDevice (dev, client, status)
- DeviceIntPtr dev;
- ClientPtr client;
- int *status;
- {
- }
+OpenInputDevice(DeviceIntPtr dev, ClientPtr client, int *status)
+{
+}
/****************************************************************************
*
@@ -254,13 +165,10 @@ OpenInputDevice (dev, client, status)
*/
int
-SetDeviceMode (client, dev, mode)
- register ClientPtr client;
- DeviceIntPtr dev;
- int mode;
- {
+SetDeviceMode(ClientPtr client, DeviceIntPtr dev, int mode)
+{
return BadMatch;
- }
+}
/****************************************************************************
*
@@ -275,15 +183,11 @@ SetDeviceMode (client, dev, mode)
*/
int
-SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators)
- register ClientPtr client;
- DeviceIntPtr dev;
- int *valuators;
- int first_valuator;
- int num_valuators;
- {
+SetDeviceValuators(ClientPtr client, DeviceIntPtr dev,
+ int *valuators, int first_valuator, int num_valuators)
+{
return BadMatch;
- }
+}
/****************************************************************************
*
@@ -294,16 +198,44 @@ SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators)
*/
int
-ChangeDeviceControl (client, dev, control)
- register ClientPtr client;
- DeviceIntPtr dev;
- xDeviceCtl *control;
- {
- switch (control->control)
- {
- case DEVICE_RESOLUTION:
- return (BadMatch);
- default:
- return (BadMatch);
- }
+ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev,
+ xDeviceCtl * control)
+{
+ switch (control->control) {
+ case DEVICE_RESOLUTION:
+ return (BadMatch);
+ case DEVICE_ABS_CALIB:
+ case DEVICE_ABS_AREA:
+ return (BadMatch);
+ case DEVICE_CORE:
+ return (BadMatch);
+ default:
+ return (BadMatch);
}
+}
+
+
+/****************************************************************************
+ *
+ * Caller: configAddDevice (and others)
+ *
+ * Add a new device with the specified options.
+ *
+ */
+int
+NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev)
+{
+ return BadValue;
+}
+
+/****************************************************************************
+ *
+ * Caller: configRemoveDevice (and others)
+ *
+ * Remove the specified device previously added.
+ *
+ */
+void
+DeleteInputDeviceRequest(DeviceIntPtr dev)
+{
+}
commit d34ff74c3c0b1561dc891661c306af793d071d77
Author: Ben Byer <bbyer at apple.com>
Date: Mon Mar 24 22:43:10 2008 -0700
prevent "fake mouse clicks" from generating spurious extra events
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index b212e98..a183011 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -391,10 +391,12 @@ void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int poin
DarwinSimulateMouseClick(pointer_x, pointer_y, 2, darwinFakeMouse2Mask);
darwinFakeMouseButtonDown = 2;
darwinFakeMouseButtonMask = darwinFakeMouse2Mask;
+ return;
} else if ((old_flags & darwinFakeMouse3Mask) == darwinFakeMouse3Mask) {
DarwinSimulateMouseClick(pointer_x, pointer_y, 3, darwinFakeMouse3Mask);
darwinFakeMouseButtonDown = 3;
darwinFakeMouseButtonMask = darwinFakeMouse3Mask;
+ return;
}
}
if (ev_type == ButtonRelease && darwinFakeButtons && darwinFakeMouseButtonDown) {
@@ -406,6 +408,7 @@ void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int poin
// Bring modifiers back up to date
DarwinUpdateModifiers(KeyPress, darwinFakeMouseButtonMask & old_flags);
darwinFakeMouseButtonMask = 0;
+ return;
}
num_events = GetPointerEvents(darwinEvents, darwinPointer, ev_type, ev_button,
More information about the xorg-commit
mailing list