xserver: Branch 'xorg-server-1.4-apple' - 2 commits
Jeremy Huddleston
jeremyhu at kemper.freedesktop.org
Mon Nov 26 13:08:29 PST 2007
GL/apple/Makefile.am | 22 -
configure.ac | 2
hw/darwin/Makefile.am | 53 ---
hw/darwin/apple/Makefile.am | 23 +
hw/darwin/darwinEvents.c | 533 ++++++++++++-----------------------
hw/darwin/launcher/Makefile.am | 18 +
hw/darwin/quartz/Makefile.am | 6
hw/darwin/quartz/xpr/Makefile.am | 4
miext/rootless/Makefile.am | 19 -
miext/rootless/accel/Makefile.am | 25 -
miext/rootless/safeAlpha/Makefile.am | 13
11 files changed, 285 insertions(+), 433 deletions(-)
New commits:
commit e4933212e1a1e15b37b0d68e733ee91bb406db7a
Author: Jeremy Huddleston <jeremy at yuffie.local>
Date: Mon Nov 26 13:05:48 2007 -0800
Darwin: Switched to expirimental darwinEvents.c from master
diff --git a/hw/darwin/darwinEvents.c b/hw/darwin/darwinEvents.c
index 4201e0e..629fb2c 100644
--- a/hw/darwin/darwinEvents.c
+++ b/hw/darwin/darwinEvents.c
@@ -1,9 +1,9 @@
/*
- * Darwin event queue and event handling
- */
-/*
-Copyright (c) 2002-2004 Torrey T. Lyons. All Rights Reserved.
+Darwin event queue and event handling
+
+Copyright 2007 Apple Inc.
Copyright 2004 Kaleb S. KEITHLEY. All Rights Reserved.
+Copyright (c) 2002-2004 Torrey T. Lyons. All Rights Reserved.
This file is based on mieq.c by Keith Packard,
which contains the following copyright:
@@ -41,6 +41,7 @@ in this Software without prior written authorization from The Open Group.
#include "mi.h"
#include "scrnintstr.h"
#include "mipointer.h"
+
#include "darwin.h"
#include "darwinKeyboard.h"
@@ -60,6 +61,10 @@ typedef struct _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 */
@@ -71,8 +76,24 @@ typedef struct _EventQueue {
} EventQueueRec, *EventQueuePtr;
static EventQueueRec darwinEventQueue;
-extern darwinKeyboardInfo keyInfo;
-#define KeyPressed(k) (((DeviceIntPtr)darwinEventQueue.pKbd)->key->down[k >> 3] & (1 << (k & 7)))
+xEvent *darwinEvents;
+
+/*
+ * DarwinPressModifierMask
+ * Press or release the given modifier key, specified by its mask.
+ */
+static void DarwinPressModifierMask(
+ int pressed,
+ int mask) // one of NX_*MASK constants
+{
+ int key = DarwinModifierNXMaskToNXKey(mask);
+
+ if (key != -1) {
+ int keycode = DarwinModifierNXKeyToNXKeycode(key, 0);
+ if (keycode != 0)
+ DarwinSendKeyboardEvents(pressed, keycode);
+ }
+}
#ifdef NX_DEVICELCTLKEYMASK
#define CONTROL_MASK(flags) (flags & (NX_DEVICELCTLKEYMASK|NX_DEVICERCTLKEYMASK))
@@ -98,132 +119,32 @@ extern darwinKeyboardInfo keyInfo;
#define ALTERNATE_MASK(flags) (NX_ALTERNATEMASK)
#endif /* NX_DEVICELALTKEYMASK */
-#define KEYBOARD_MASK (NX_COMMANDMASK | NX_CONTROLMASK | NX_ALTERNATEMASK | NX_SHIFTMASK | \
- NX_SECONDARYFNMASK | NX_ALPHASHIFTMASK | NX_NUMERICPADMASK | \
- NX_HELPMASK | NX_DEVICELCTLKEYMASK | NX_DEVICELSHIFTKEYMASK | \
- NX_DEVICERSHIFTKEYMASK | NX_DEVICELCMDKEYMASK | NX_DEVICERCMDKEYMASK | \
- NX_DEVICELALTKEYMASK | NX_DEVICERALTKEYMASK | NX_DEVICERCTLKEYMASK)
-
-char * decode_event_flags(unsigned int modifiers) {
- char buf[1024];
- buf[0]='\0';
- if (modifiers & NX_DEVICELCTLKEYMASK) strcat(buf, "NX_DEVICELCTLKEYMASK | ");
- if (modifiers & NX_DEVICELSHIFTKEYMASK) strcat(buf, "NX_DEVICELSHIFTKEYMASK | ");
- if (modifiers & NX_DEVICERSHIFTKEYMASK) strcat(buf, "NX_DEVICERSHIFTKEYMASK | ");
- if (modifiers & NX_DEVICELCMDKEYMASK) strcat(buf, "NX_DEVICELCMDKEYMASK | ");
- if (modifiers & NX_DEVICERCMDKEYMASK) strcat(buf, "NX_DEVICERCMDKEYMASK | ");
- if (modifiers & NX_DEVICELALTKEYMASK) strcat(buf, "NX_DEVICELALTKEYMASK | ");
- if (modifiers & NX_DEVICERALTKEYMASK) strcat(buf, "NX_DEVICERALTKEYMASK | ");
- if (modifiers & NX_DEVICERCTLKEYMASK) strcat(buf, "NX_DEVICERCTLKEYMASK | ");
-
- if (modifiers & NX_ALPHASHIFTMASK) strcat(buf, "NX_ALPHASHIFTMASK | ");
- if (modifiers & NX_SHIFTMASK) strcat(buf, "NX_SHIFTMASK | ");
- if (modifiers & NX_CONTROLMASK) strcat(buf, "NX_CONTROLMASK | ");
- if (modifiers & NX_ALTERNATEMASK) strcat(buf, "NX_ALTERNATEMASK | ");
- if (modifiers & NX_COMMANDMASK) strcat(buf, "NX_COMMANDMASK | ");
- if (modifiers & NX_NUMERICPADMASK) strcat(buf, "NX_NUMERICPADMASK | ");
- if (modifiers & NX_HELPMASK) strcat(buf, "NX_HELPMASK | ");
- if (modifiers & NX_SECONDARYFNMASK) strcat(buf, "NX_SECONDARYFNMASK | ");
-
- if (modifiers & NX_STYLUSPROXIMITYMASK) strcat(buf, "NX_STYLUSPROXIMITYMASK | ");
- if (modifiers & NX_NONCOALSESCEDMASK) strcat(buf, "NX_NONCOALSESCEDMASK | ");
- if (modifiers & NX_NULLEVENTMASK) strcat(buf, "NX_NULLEVENTMASK | ");
- // if (modifiers & NX_LMOUSEDOWNMASK) strcat(buf, "NX_LMOUSEDOWNMASK | ");
- // if (modifiers & NX_LMOUSEUPMASK) strcat(buf, "NX_LMOUSEUPMASK | ");
- // if (modifiers & NX_RMOUSEDOWNMASK) strcat(buf, "NX_RMOUSEDOWNMASK | ");
- // if (modifiers & NX_RMOUSEUPMASK) strcat(buf, "NX_RMOUSEUPMASK | ");
- // if (modifiers & NX_OMOUSEDOWNMASK) strcat(buf, "NX_OMOUSEDOWNMASK | ");
- // if (modifiers & NX_OMOUSEUPMASK) strcat(buf, "NX_OMOUSEUPMASK | ");
- // if (modifiers & NX_MOUSEMOVEDMASK) strcat(buf, "NX_MOUSEMOVEDMASK | ");
- // if (modifiers & NX_LMOUSEDRAGGEDMASK) strcat(buf, "NX_LMOUSEDRAGGEDMASK | ");
- //if (modifiers & NX_RMOUSEDRAGGEDMASK) strcat(buf, "NX_RMOUSEDRAGGEDMASK | ");
- //if (modifiers & NX_OMOUSEDRAGGEDMASK) strcat(buf, "NX_OMOUSEDRAGGEDMASK | ");
- //if (modifiers & NX_MOUSEENTEREDMASK) strcat(buf, "NX_MOUSEENTEREDMASK | ");
- //if (modifiers & NX_MOUSEEXITEDMASK) strcat(buf, "NX_MOUSEEXITEDMASK | ");
- if (modifiers & NX_KEYDOWNMASK) strcat(buf, "NX_KEYDOWNMASK | ");
- if (modifiers & NX_KEYUPMASK) strcat(buf, "NX_KEYUPMASK | ");
- if (modifiers & NX_FLAGSCHANGEDMASK) strcat(buf, "NX_FLAGSCHANGEDMASK | ");
- if (modifiers & NX_KITDEFINEDMASK) strcat(buf, "NX_KITDEFINEDMASK | ");
- if (modifiers & NX_SYSDEFINEDMASK) strcat(buf, "NX_SYSDEFINEDMASK | ");
- if (modifiers & NX_APPDEFINEDMASK) strcat(buf, "NX_APPDEFINEDMASK | ");
-
- if (strlen(buf) < 5) strcpy(buf, "(empty)");
- else buf[strlen(buf)-3]='\0';
- return strdup(buf);
-}
-
-char * get_keysym_name(int ks) {
- switch(ks) {
- case XK_Alt_L: return "XK_Alt_L";
- case XK_Alt_R: return "XK_Alt_R";
- case XK_Meta_L: return "XK_Meta_L";
- case XK_Meta_R: return "XK_Meta_R";
- case XK_Control_L: return "XK_Control_L";
- case XK_Control_R: return "XK_Control_R";
- case XK_Shift_L: return "XK_Shift_L";
- case XK_Shift_R: return "XK_Shift_R";
- case XK_Mode_switch: return "XK_Mode_switch";
- case XK_Caps_Lock: return "XK_Caps_Lock";
- }
- return "???";
-}
-
-/*
- * DarwinPressModifierMask
- * Press or release the given modifier key, specified by its mask.
- */
-static void DarwinPressModifierMask(
- xEvent *xe, // must already have type, time and mouse location
- int mask) // one of NX_*MASK constants
-{
- int key, keycode;
- key = DarwinModifierNXMaskToNXKey(mask);
- if (key == -1) {
- ErrorF("DarwinPressModifierMask: can't find key for mask %x\n", mask);
- return;
- }
- keycode = DarwinModifierNXKeyToNXKeycode(key, 0);
- if (keycode == 0) {
- ErrorF("DarwinPressModifierMask: can't find keycode for mask %x\n", mask);
- return;
- }
-
- DEBUG_LOG("%x: %s %s\n", mask, xe->u.u.type==KeyPress?"pressing":"releasing",
- decode_event_flags(mask));
-
- xe->u.u.detail = keycode + MIN_KEYCODE;
- (*darwinEventQueue.pKbd->processInputProc)(xe,
- (DeviceIntPtr)darwinEventQueue.pKbd, 1);
-}
-
/*
* DarwinUpdateModifiers
* Send events to update the modifier state.
*/
static void DarwinUpdateModifiers(
- xEvent *xe, // event template with time and mouse position set
int pressed, // KeyPress or KeyRelease
- unsigned int flags ) // modifier flags that have changed
+ int flags ) // modifier flags that have changed
{
- int i;
- DEBUG_LOG("DarwinUpdateModifiers(%p, %d, %x, %s)\n", xe, pressed, flags, decode_event_flags(flags));
- xe->u.u.type = pressed;
- /* If we have "device specific" flags -- meaning, left or right -- then strip out the generic flag */
- if (flags & (NX_DEVICELCTLKEYMASK | NX_DEVICERCTLKEYMASK)) flags &= ~NX_CONTROLMASK;
- if (flags & (NX_DEVICELALTKEYMASK | NX_DEVICERALTKEYMASK)) flags &= ~NX_ALTERNATEMASK;
- if (flags & (NX_DEVICELCMDKEYMASK | NX_DEVICERCMDKEYMASK)) flags &= ~NX_COMMANDMASK;
- if (flags & (NX_DEVICELSHIFTKEYMASK | NX_DEVICERSHIFTKEYMASK)) flags &= ~NX_SHIFTMASK;
- if (flags == NX_ALPHASHIFTMASK) {
- // Alpha shift only sees KeyDown when enabled and KeyUp when disabled,
- // but X11 wants to see a up/down pair to enable, and again to disable
- xe->u.u.type = KeyPress;
- DarwinPressModifierMask(xe, NX_ALPHASHIFTMASK);
- xe->u.u.type = KeyRelease;
- DarwinPressModifierMask(xe, NX_ALPHASHIFTMASK);
- flags &= ~NX_ALPHASHIFTMASK;
- }
- for(i=0; i < (sizeof(flags)*8); i++)
- if (flags & (1 << i)) DarwinPressModifierMask(xe, flags & (1 << i));
+ if (flags & NX_ALPHASHIFTMASK) {
+ DarwinPressModifierMask(pressed, NX_ALPHASHIFTMASK);
+ }
+ if (flags & NX_COMMANDMASK) {
+ DarwinPressModifierMask(pressed, COMMAND_MASK(flags));
+ }
+ if (flags & NX_CONTROLMASK) {
+ DarwinPressModifierMask(pressed, CONTROL_MASK(flags));
+ }
+ if (flags & NX_ALTERNATEMASK) {
+ DarwinPressModifierMask(pressed, ALTERNATE_MASK(flags));
+ }
+ if (flags & NX_SHIFTMASK) {
+ DarwinPressModifierMask(pressed, SHIFT_MASK(flags));
+ }
+ if (flags & NX_SECONDARYFNMASK) {
+ DarwinPressModifierMask(pressed, NX_SECONDARYFNMASK);
+ }
}
/*
@@ -232,39 +153,8 @@ static void DarwinUpdateModifiers(
* is deactivated (kXDarwinDeactivate) to prevent modifiers from getting stuck if they
* are held down during a "context" switch -- otherwise, we would miss the KeyUp.
*/
-void DarwinReleaseModifiers(void) {
- KeySym *map = NULL;
- xEvent ke;
- int i = 0;
-
- DEBUG_LOG("DarwinReleaseModifiers(%p)\n", &keyInfo.keyMap);
-
- for (i = MIN_KEYCODE, map =keyInfo.keyMap;
- i < MAX_KEYCODE;
- i++, map += GLYPHS_PER_KEY) {
- if (KeyPressed(i)) {
- switch (*map) {
- /* Don't release the lock keys */
- case XK_Caps_Lock:
- case XK_Shift_Lock:
- case XK_Num_Lock:
- case XK_Scroll_Lock:
- case XK_Kana_Lock:
- break;
- default:
- DEBUG_LOG("DarwinReleaseModifiers: releasing key %d (%s)\n", i, get_keysym_name(*map));
- ke.u.keyButtonPointer.time = GetTimeInMillis();
- ke.u.keyButtonPointer.rootX = 0;
- ke.u.keyButtonPointer.rootY = 0;
- ke.u.u.type = KeyRelease;
- ke.u.u.detail = i;
- (*darwinEventQueue.pKbd->processInputProc)(&ke,
- (DeviceIntPtr)darwinEventQueue.pKbd, 1);
- break;
- }
- }
- }
- ProcessInputEvents();
+static void DarwinReleaseModifiers(void) {
+ DarwinUpdateModifiers(KeyRelease, COMMAND_MASK(-1) | CONTROL_MASK(-1) | ALTERNATE_MASK(-1) | SHIFT_MASK(-1));
}
/*
@@ -279,38 +169,36 @@ void DarwinReleaseModifiers(void) {
* simulate a button 2 press instead of Command-button 2.
*/
static void DarwinSimulateMouseClick(
- xEvent *xe, // event template with time and
- // mouse position filled in
+ int pointer_x,
+ int pointer_y,
int whichButton, // mouse button to be pressed
int modifierMask) // modifiers used for the fake click
{
- DEBUG_LOG("DarwinSimulateMouseClick(%p, %d, %x)\n", xe, whichButton, modifierMask);
// first fool X into forgetting about the keys
// for some reason, it's not enough to tell X we released the Command key --
// it has to be the *left* Command key.
if (modifierMask & NX_COMMANDMASK) modifierMask |=NX_DEVICELCMDKEYMASK ;
- DarwinUpdateModifiers(xe, KeyRelease, modifierMask);
+ DarwinUpdateModifiers(KeyRelease, modifierMask);
// push the mouse button
- xe->u.u.type = ButtonPress;
- xe->u.u.detail = whichButton;
- (*darwinEventQueue.pPtr->processInputProc)
- (xe, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
+ DarwinSendPointerEvents(ButtonPress, whichButton, pointer_x, pointer_y);
+ DarwinSendPointerEvents(ButtonRelease, whichButton, pointer_x, pointer_y);
+
+ // restore old modifiers
+ DarwinUpdateModifiers(KeyPress, modifierMask);
}
-Bool
-DarwinEQInit(
- DevicePtr pKbd,
- DevicePtr pPtr)
-{
+Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) {
+ darwinEvents = (xEvent *)malloc(sizeof(xEvent) * GetMaximumEventsNum());
+ mieqInit();
darwinEventQueue.head = darwinEventQueue.tail = 0;
darwinEventQueue.lastEventTime = GetTimeInMillis ();
darwinEventQueue.pKbd = pKbd;
darwinEventQueue.pPtr = pPtr;
darwinEventQueue.pEnqueueScreen = screenInfo.screens[0];
darwinEventQueue.pDequeueScreen = darwinEventQueue.pEnqueueScreen;
- SetInputCheck (&darwinEventQueue.head, &darwinEventQueue.tail);
+ SetInputCheck(&input_check_zero, &input_check_flag);
return TRUE;
}
@@ -321,11 +209,10 @@ DarwinEQInit(
* 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 xEvent *e)
-{
+void DarwinEQEnqueue(const xEvent *e) {
HWEventQueueType oldtail, newtail;
char byte = 0;
@@ -335,13 +222,12 @@ DarwinEQEnqueue(
// This is difficult to do in a thread-safe way and rarely useful.
newtail = oldtail + 1;
- if (newtail == QUEUE_SIZE)
- newtail = 0;
+ if (newtail == QUEUE_SIZE) newtail = 0;
/* Toss events which come in late */
- if (newtail == darwinEventQueue.head)
- return;
+ 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
@@ -358,7 +244,7 @@ DarwinEQEnqueue(
darwinEventQueue.tail = newtail;
// Signal there is an event ready to handle
- write(darwinEventWriteFD, &byte, 1);
+ DarwinPokeEQ();
}
@@ -366,20 +252,13 @@ DarwinEQEnqueue(
* DarwinEQPointerPost
* Post a pointer event. Used by the mipointer.c routines.
*/
-void
-DarwinEQPointerPost(
- xEvent *e)
-{
+void DarwinEQPointerPost(xEvent *e) {
(*darwinEventQueue.pPtr->processInputProc)
(e, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
}
-void
-DarwinEQSwitchScreen(
- ScreenPtr pScreen,
- Bool fromDIX)
-{
+void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX) {
darwinEventQueue.pEnqueueScreen = pScreen;
if (fromDIX)
darwinEventQueue.pDequeueScreen = pScreen;
@@ -390,21 +269,21 @@ DarwinEQSwitchScreen(
* ProcessInputEvents
* Read and process events from the event queue until it is empty.
*/
-void ProcessInputEvents(void)
-{
+void ProcessInputEvents(void) {
EventRec *e;
int x, y;
xEvent xe;
static int old_flags = 0; // last known modifier state
// button number and modifier mask of currently pressed fake button
- static int darwinFakeMouseButtonDown = 0;
- static int darwinFakeMouseButtonMask = 0;
+ input_check_flag=0;
+
+ // ErrorF("calling mieqProcessInputEvents\n");
+ mieqProcessInputEvents();
// Empty the signaling pipe
x = sizeof(xe);
- while (x == sizeof(xe)) {
+ while (x == sizeof(xe))
x = read(darwinEventReadFD, &xe, sizeof(xe));
- }
while (darwinEventQueue.head != darwinEventQueue.tail)
{
@@ -420,10 +299,16 @@ void ProcessInputEvents(void)
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
- /*
- * Assumption - screen switching can only occur on motion events
- */
if (e->pScreen != darwinEventQueue.pDequeueScreen)
{
darwinEventQueue.pDequeueScreen = e->pScreen;
@@ -441,164 +326,39 @@ void ProcessInputEvents(void)
darwinEventQueue.head = 0;
else
++darwinEventQueue.head;
- switch (xe.u.u.type)
- {
+ switch (xe.u.u.type) {
case KeyPress:
- if (old_flags == 0
- && darwinSyncKeymap && darwinKeymapFile == NULL)
- {
- /* See if keymap has changed. */
-
- static unsigned int last_seed;
- unsigned int this_seed;
-
- this_seed = DarwinModeSystemKeymapSeed();
- if (this_seed != last_seed)
- {
- last_seed = this_seed;
- DarwinKeyboardReload(darwinKeyboard);
- }
- }
- /* fall through */
-
case KeyRelease:
- xe.u.u.detail += MIN_KEYCODE;
- (*darwinEventQueue.pKbd->processInputProc)
- (&xe, (DeviceIntPtr)darwinEventQueue.pKbd, 1);
- break;
+ ErrorF("Unexpected Keyboard event in DarwinProcessInputEvents\n");
+ break;
case ButtonPress:
- miPointerAbsoluteCursor(xe.u.keyButtonPointer.rootX,
- xe.u.keyButtonPointer.rootY,
- xe.u.keyButtonPointer.time);
- if (darwinFakeButtons && xe.u.u.detail == 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(&xe, 2, darwinFakeMouse2Mask);
- darwinFakeMouseButtonDown = 2;
- darwinFakeMouseButtonMask = darwinFakeMouse2Mask;
- break;
- }
- else if ((old_flags & darwinFakeMouse3Mask) ==
- darwinFakeMouse3Mask)
- {
- DarwinSimulateMouseClick(&xe, 3, darwinFakeMouse3Mask);
- darwinFakeMouseButtonDown = 3;
- darwinFakeMouseButtonMask = darwinFakeMouse3Mask;
- break;
- }
- }
- (*darwinEventQueue.pPtr->processInputProc)
- (&xe, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
+ ErrorF("Unexpected ButtonPress event in DarwinProcessInputEvents\n");
break;
case ButtonRelease:
- miPointerAbsoluteCursor(xe.u.keyButtonPointer.rootX,
- xe.u.keyButtonPointer.rootY,
- xe.u.keyButtonPointer.time);
- if (darwinFakeButtons && xe.u.u.detail == 1 &&
- darwinFakeMouseButtonDown)
- {
- // If last mousedown was a fake click, don't check for
- // mouse modifiers here. The user may have released the
- // modifiers before the mouse button.
- xe.u.u.detail = darwinFakeMouseButtonDown;
- darwinFakeMouseButtonDown = 0;
- (*darwinEventQueue.pPtr->processInputProc)
- (&xe, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
-
- // Bring modifiers back up to date
- DarwinUpdateModifiers(&xe, KeyPress,
- darwinFakeMouseButtonMask & old_flags);
- darwinFakeMouseButtonMask = 0;
- } else {
- (*darwinEventQueue.pPtr->processInputProc)
- (&xe, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
- }
+ ErrorF("Unexpected ButtonRelease event in DarwinProcessInputEvents\n");
break;
case MotionNotify:
- miPointerAbsoluteCursor(xe.u.keyButtonPointer.rootX,
- xe.u.keyButtonPointer.rootY,
- xe.u.keyButtonPointer.time);
+ ErrorF("Unexpected ButtonRelease event in DarwinProcessInputEvents\n");
break;
case kXDarwinUpdateModifiers:
- {
- // Update modifier state.
- // Any amount of modifiers may have changed.
- unsigned int flags = xe.u.clientMessage.u.l.longs0 & ~NX_NONCOALSESCEDMASK; // ignore that one
- DEBUG_LOG("kxDarwinUpdateModifiers(%x, %x, %s)\n", old_flags, flags, decode_event_flags(flags));
- // DEBUG_LOG("Ignoring these flags: %x %s\n", flags & ~KEYBOARD_MASK, decode_event_flags(flags & ~KEYBOARD_MASK));
- flags &= KEYBOARD_MASK;
- if (old_flags & ~flags) DarwinUpdateModifiers(&xe, KeyRelease,
- old_flags & ~flags);
- if (~old_flags & flags) DarwinUpdateModifiers(&xe, KeyPress,
- ~old_flags & flags);
- old_flags = flags;
- break;
- }
+ ErrorF("Unexpected ButtonRelease event in DarwinProcessInputEvents\n");
+ break;
case kXDarwinUpdateButtons:
- {
- long hwDelta = xe.u.clientMessage.u.l.longs0;
- long hwButtons = xe.u.clientMessage.u.l.longs1;
- int i;
-
- for (i = 1; i < 5; i++) {
- if (hwDelta & (1 << i)) {
- // IOKit and X have different numbering for the
- // middle and right mouse buttons.
- if (i == 1) {
- xe.u.u.detail = 3;
- } else if (i == 2) {
- xe.u.u.detail = 2;
- } else {
- xe.u.u.detail = i + 1;
- }
- if (hwButtons & (1 << i)) {
- xe.u.u.type = ButtonPress;
- } else {
- xe.u.u.type = ButtonRelease;
- }
- (*darwinEventQueue.pPtr->processInputProc)
- (&xe, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
- }
- }
- break;
- }
+ ErrorF("Unexpected XDarwinScrollWheel event in DarwinProcessInputEvents\n");
+ break;
- case kXDarwinScrollWheel:
- {
- short count = xe.u.clientMessage.u.s.shorts0;
-
- if (count > 0) {
- xe.u.u.detail = SCROLLWHEELUPFAKE;
- } else {
- xe.u.u.detail = SCROLLWHEELDOWNFAKE;
- count = -count;
- }
-
- for (; count; --count) {
- xe.u.u.type = ButtonPress;
- (*darwinEventQueue.pPtr->processInputProc)
- (&xe, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
- xe.u.u.type = ButtonRelease;
- (*darwinEventQueue.pPtr->processInputProc)
- (&xe, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
- }
- break;
- }
+ case kXDarwinScrollWheel:
+ ErrorF("Unexpected XDarwinScrollWheel event in DarwinProcessInputEvents\n");
+ break;
- case kXDarwinDeactivate:
- DEBUG_LOG("kxDarwinDeactivate\n");
- DarwinReleaseModifiers();
- old_flags=0;
- // fall through
+ case kXDarwinDeactivate:
+ DarwinReleaseModifiers();
+ // fall through
default:
// Check for mode specific event
DarwinModeProcessEvent(&xe);
@@ -606,5 +366,96 @@ void ProcessInputEvents(void)
}
}
- miPointerUpdate();
+ // miPointerUpdate();
+}
+
+/* Sends a null byte down darwinEventWriteFD, which will cause the
+ Dispatch() event loop to check out event queue */
+void DarwinPokeEQ(void) {
+ char nullbyte=0;
+ input_check_flag++;
+ // <daniels> bushing: oh, i ... er ... christ.
+ write(darwinEventWriteFD, &nullbyte, 1);
+}
+
+void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y) {
+ static int darwinFakeMouseButtonDown = 0;
+ static int darwinFakeMouseButtonMask = 0;
+ int i, num_events;
+ int valuators[2] = {pointer_x, pointer_y};
+ 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);
+ darwinFakeMouseButtonDown = 2;
+ darwinFakeMouseButtonMask = darwinFakeMouse2Mask;
+ } else if ((old_flags & darwinFakeMouse3Mask) == darwinFakeMouse3Mask) {
+ DarwinSimulateMouseClick(pointer_x, pointer_y, 3, darwinFakeMouse3Mask);
+ darwinFakeMouseButtonDown = 3;
+ darwinFakeMouseButtonMask = darwinFakeMouse3Mask;
+ }
+ }
+ if (ev_type == ButtonRelease && darwinFakeButtons && darwinFakeMouseButtonDown) {
+ // If last mousedown was a fake click, don't check for
+ // mouse modifiers here. The user may have released the
+ // modifiers before the mouse button.
+ ev_button = darwinFakeMouseButtonDown;
+ darwinFakeMouseButtonDown = 0;
+ // Bring modifiers back up to date
+ DarwinUpdateModifiers(KeyPress, darwinFakeMouseButtonMask & old_flags);
+ darwinFakeMouseButtonMask = 0;
+ }
+
+ num_events = GetPointerEvents(darwinEvents, darwinPointer, ev_type, ev_button,
+ POINTER_ABSOLUTE, 0, 2, valuators);
+
+ for(i=0; i<num_events; i++) mieqEnqueue (darwinPointer,&darwinEvents[i]);
+ DarwinPokeEQ();
+}
+
+void DarwinSendKeyboardEvents(int ev_type, int keycode) {
+ int i, num_events;
+ if (old_flags == 0 && darwinSyncKeymap && darwinKeymapFile == NULL) {
+ /* See if keymap has changed. */
+
+ static unsigned int last_seed;
+ unsigned int this_seed;
+
+ this_seed = DarwinModeSystemKeymapSeed();
+ if (this_seed != last_seed) {
+ last_seed = this_seed;
+ DarwinKeyboardReload(darwinKeyboard);
+ }
+ }
+
+ num_events = GetKeyboardEvents(darwinEvents, darwinKeyboard, ev_type, keycode + MIN_KEYCODE);
+ for(i=0; i<num_events; i++) mieqEnqueue(darwinKeyboard,&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) {
+ int i;
+ int ev_button = count > 0.0f ? 4 : 5;
+ int valuators[2] = {pointer_x, pointer_y};
+
+ 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);
+ for(i=0; i<num_events; i++) mieqEnqueue(darwinPointer,&darwinEvents[i]);
+ num_events = GetPointerEvents(darwinEvents, darwinPointer, ButtonRelease, ev_button,
+ POINTER_ABSOLUTE, 0, 2, valuators);
+ for(i=0; i<num_events; i++) mieqEnqueue(darwinPointer,&darwinEvents[i]);
+ }
+ DarwinPokeEQ();
+}
+
+/* Send the appropriate KeyPress/KeyRelease events to GetKeyboardEvents to
+ reflect changing modifier flags (alt, control, meta, etc) */
+void DarwinUpdateModKeys(int flags) {
+ DarwinUpdateModifiers(KeyRelease, old_flags & ~flags);
+ DarwinUpdateModifiers(KeyPress, ~old_flags & flags);
+ old_flags = flags;
}
commit 9c6d8a035b712b219833653ac637b89703a9b0c3
Author: Jeremy Huddleston <jeremy at yuffie.local>
Date: Mon Nov 26 13:04:57 2007 -0800
Darwin,Rootless: Makefile cleanup
diff --git a/GL/apple/Makefile.am b/GL/apple/Makefile.am
index 411dfdf..f1e02cc 100644
--- a/GL/apple/Makefile.am
+++ b/GL/apple/Makefile.am
@@ -1,12 +1,14 @@
-AM_CFLAGS = -I$(top_srcdir) \
- -I$(top_srcdir)/GL/glx \
- -I$(top_srcdir)/GL/include \
- -I$(top_srcdir)/GL/mesa/glapi \
- -I$(top_srcdir)/hw/darwin/quartz \
- -I$(top_srcdir)/hw/darwin/quartz/xpr \
- -I$(top_srcdir)/miext/damage \
- $(PIXMAN_CFLAGS)
+AM_CFLAGS = $(DIX_CFLAGS)
+AM_CPPFLAGS = \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/GL/glx \
+ -I$(top_srcdir)/GL/include \
+ -I$(top_srcdir)/GL/mesa/glapi \
+ -I$(top_srcdir)/hw/darwin/quartz \
+ -I$(top_srcdir)/hw/darwin/quartz/xpr \
+ -I$(top_srcdir)/miext/damage
noinst_LIBRARIES = libCGLcore.a
-libCGLcore_a_SOURCES = indirect.c \
- $(top_srcdir)/hw/dmx/glxProxy/compsize.c
+libCGLcore_a_SOURCES = \
+ indirect.c \
+ $(top_srcdir)/hw/dmx/glxProxy/compsize.c
diff --git a/configure.ac b/configure.ac
index 2cad021..c7d78d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2151,6 +2151,8 @@ hw/xgl/glxext/module/Makefile
hw/xnest/Makefile
hw/xwin/Makefile
hw/darwin/Makefile
+hw/darwin/apple/Makefile
+hw/darwin/launcher/Makefile
hw/darwin/quartz/Makefile
hw/darwin/quartz/xpr/Makefile
hw/darwin/utils/Makefile
diff --git a/hw/darwin/Makefile.am b/hw/darwin/Makefile.am
index 62cbecf..1faedcb 100644
--- a/hw/darwin/Makefile.am
+++ b/hw/darwin/Makefile.am
@@ -1,11 +1,16 @@
-AM_CFLAGS = $(XORG_CFLAGS) $(DIX_CFLAGS)
-AM_CPPFLAGS = $(XORG_INCS) \
+AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
+AM_CPPFLAGS = \
-DINXQUARTZ \
-DUSE_NEW_CLUT \
-DXFree86Server \
-I$(top_srcdir)/miext/rootless
-SUBDIRS = quartz utils
+if X11APP
+X11APP_SUBDIRS = apple launcher
+endif
+
+SUBDIRS = quartz utils $(X11APP_SUBDIRS)
+DIST_SUBDIRS = quartz utils apple launcher
bin_PROGRAMS = Xquartz
man1_MANS = Xquartz.man
@@ -26,7 +31,6 @@ Xquartz_LDADD = \
./quartz/libXquartz.a \
./quartz/xpr/libxpr.a \
$(top_builddir)/dix/dixfonts.lo \
- $(top_builddir)/config/libconfig.a \
$(top_builddir)/dix/libdix.la \
$(top_builddir)/os/libos.la \
$(top_builddir)/dix/libxpstubs.la \
@@ -60,47 +64,8 @@ Xquartz_LDFLAGS = \
-Wl,-framework,CoreAudio \
-Wl,-framework,IOKit
-if X11APP
-bin_SCRIPTS = x11app x11launcher
-
-x11app:
- cd apple && xcodebuild CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" ARCHS="$(X11APP_ARCHS)"
-
-x11launcher:
- cd launcher && xcodebuild CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" ARCHS="$(X11APP_ARCHS)"
-
-x11app-install:
- cd apple && xcodebuild install DSTROOT=$(DESTDIR) INSTALL_PATH=$(prefix) DEPLOYMENT_LOCATION=YES SKIP_INSTALL=NO ARCHS="$(X11APP_ARCHS)"
-
-x11launcher-install:
- cd launcher && xcodebuild install DSTROOT=$(DESTDIR) INSTALL_PATH=$(APPLE_APPLICATIONS_DIR) DEPLOYMENT_LOCATION=YES SKIP_INSTALL=NO ARCHS="$(X11APP_ARCHS)"
-
-x11app-clean:
- rm -rf apple/build
-
-x11launcher-clean:
- rm -rf launcher/build
-
-install-data-hook: x11app-install x11launcher-install
-clean-local: x11app-clean x11launcher-clean
-
-endif
-
EXTRA_DIST = \
Xquartz.man \
darwinClut8.h \
darwin.h \
- darwinKeyboard.h \
- apple/Info.plist \
- apple/X11.icns \
- apple/bundle-main.c \
- apple/English.lproj/InfoPlist.strings \
- apple/English.lproj/Localizable.strings \
- apple/English.lproj/main.nib/classes.nib \
- apple/English.lproj/main.nib/info.nib \
- apple/English.lproj/main.nib/keyedobjects.nib \
- apple/X11.xcodeproj/project.pbxproj \
- launcher/bundle-main.c \
- launcher/Info.plist \
- launcher/X11.icns \
- launcher/X11.xcodeproj/project.pbxproj
+ darwinKeyboard.h
diff --git a/hw/darwin/apple/Makefile.am b/hw/darwin/apple/Makefile.am
new file mode 100644
index 0000000..02a2c25
--- /dev/null
+++ b/hw/darwin/apple/Makefile.am
@@ -0,0 +1,23 @@
+bin_SCRIPTS = x11app
+
+.PHONY: x11app
+
+x11app:
+ xcodebuild CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" ARCHS="$(X11APP_ARCHS)"
+
+install-data-hook:
+ xcodebuild install DSTROOT=$(DESTDIR) INSTALL_PATH=$(prefix) DEPLOYMENT_LOCATION=YES SKIP_INSTALL=NO ARCHS="$(X11APP_ARCHS)"
+
+clean-local:
+ rm -rf build
+
+EXTRA_DIST = \
+ Info.plist \
+ X11.icns \
+ bundle-main.c \
+ English.lproj/InfoPlist.strings \
+ English.lproj/Localizable.strings \
+ English.lproj/main.nib/classes.nib \
+ English.lproj/main.nib/info.nib \
+ English.lproj/main.nib/keyedobjects.nib \
+ X11.xcodeproj/project.pbxproj
diff --git a/hw/darwin/launcher/Makefile.am b/hw/darwin/launcher/Makefile.am
new file mode 100644
index 0000000..f2d9ede
--- /dev/null
+++ b/hw/darwin/launcher/Makefile.am
@@ -0,0 +1,18 @@
+bin_SCRIPTS = x11launcher
+
+.PHONY: x11launcher
+
+x11launcher:
+ xcodebuild CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" ARCHS="$(X11APP_ARCHS)"
+
+install-data-hook:
+ cd launcher && xcodebuild install DSTROOT=$(DESTDIR) INSTALL_PATH=$(APPLE_APPLICATIONS_DIR) DEPLOYMENT_LOCATION=YES SKIP_INSTALL=NO ARCHS="$(X11APP_ARCHS)"
+
+clean-local:
+ rm -rf build
+
+EXTRA_DIST = \
+ bundle-main.c \
+ Info.plist \
+ X11.icns \
+ X11.xcodeproj/project.pbxproj
diff --git a/hw/darwin/quartz/Makefile.am b/hw/darwin/quartz/Makefile.am
index 54e6c30..fe66429 100644
--- a/hw/darwin/quartz/Makefile.am
+++ b/hw/darwin/quartz/Makefile.am
@@ -1,8 +1,8 @@
noinst_LIBRARIES = libXQuartz.a
-AM_CFLAGS = $(XORG_CFLAGS) $(DIX_CFLAGS)
-AM_OBJCFLAGS = $(XORG_CFLAGS) $(DIX_CFLAGS)
-AM_CPPFLAGS = $(XORG_INCS) \
+AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
+AM_OBJCFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
+AM_CPPFLAGS = \
-DHAS_KL_API \
-I$(srcdir) -I$(srcdir)/.. \
-I$(top_srcdir)/miext/rootless
diff --git a/hw/darwin/quartz/xpr/Makefile.am b/hw/darwin/quartz/xpr/Makefile.am
index 4fe6e23..f610f73 100644
--- a/hw/darwin/quartz/xpr/Makefile.am
+++ b/hw/darwin/quartz/xpr/Makefile.am
@@ -1,6 +1,6 @@
noinst_LIBRARIES = libxpr.a
-AM_CFLAGS = $(XORG_CFLAGS) $(DIX_CFLAGS)
-AM_CPPFLAGS = $(XORG_INCS) \
+AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
+AM_CPPFLAGS = \
-DHAVE_XORG_CONFIG_H \
-I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../.. \
-I$(top_srcdir)/miext \
diff --git a/miext/rootless/Makefile.am b/miext/rootless/Makefile.am
index 8dae6d2..aa8528e 100644
--- a/miext/rootless/Makefile.am
+++ b/miext/rootless/Makefile.am
@@ -1,22 +1,19 @@
-AM_CFLAGS = \
- $(DIX_CFLAGS) \
- $(XORG_CFLAGS)
-
-INCLUDES = -I$(top_srcdir)/hw/xfree86/os-support
+AM_CFLAGS = $(DIX_CFLAGS) $(XSERVER_CFLAGS)
+AM_CPPFLAGS = -I$(top_srcdir)/hw/xfree86/os-support
SUBDIRS = safeAlpha accel
noinst_LTLIBRARIES = librootless.la
librootless_la_SOURCES = \
rootlessCommon.c \
- rootlessCommon.h \
- rootlessConfig.h \
rootlessGC.c \
- rootless.h \
rootlessScreen.c \
rootlessValTree.c \
- rootlessWindow.c \
- rootlessWindow.h
+ rootlessWindow.c
EXTRA_DIST = \
- README.txt
+ README.txt \
+ rootless.h \
+ rootlessCommon.h \
+ rootlessConfig.h \
+ rootlessWindow.h
diff --git a/miext/rootless/accel/Makefile.am b/miext/rootless/accel/Makefile.am
index c49d5fb..ca41653 100644
--- a/miext/rootless/accel/Makefile.am
+++ b/miext/rootless/accel/Makefile.am
@@ -1,18 +1,15 @@
-AM_CFLAGS = \
- $(DIX_CFLAGS) \
- $(XORG_CFLAGS)
-
-INCLUDES = -I$(srcdir)/.. -I$(top_srcdir)/hw/xfree86/os-support
-
+AM_CFLAGS = $(DIX_CFLAGS) $(XSERVER_CFLAGS)
+AM_CPPFLAGS = -I$(srcdir)/.. -I$(top_srcdir)/hw/xfree86/os-support
noinst_LTLIBRARIES = librlAccel.la
-librlAccel_la_SOURCES = rlAccel.c \
- rlBlt.c \
- rlCopy.c \
- rlFill.c \
- rlFillRect.c \
- rlFillSpans.c \
- rlGlyph.c \
- rlSolid.c
+librlAccel_la_SOURCES = \
+ rlAccel.c \
+ rlBlt.c \
+ rlCopy.c \
+ rlFill.c \
+ rlFillRect.c \
+ rlFillSpans.c \
+ rlGlyph.c \
+ rlSolid.c
EXTRA_DIST = rlAccel.h
diff --git a/miext/rootless/safeAlpha/Makefile.am b/miext/rootless/safeAlpha/Makefile.am
index 7592c18..d264393 100644
--- a/miext/rootless/safeAlpha/Makefile.am
+++ b/miext/rootless/safeAlpha/Makefile.am
@@ -1,12 +1,9 @@
-AM_CFLAGS = \
- $(DIX_CFLAGS) \
- $(XORG_CFLAGS)
-
-INCLUDES = -I$(srcdir)/.. -I$(top_srcdir)/hw/xfree86/os-support
-
+AM_CFLAGS = $(DIX_CFLAGS) $(XSERVER_CFLAGS)
+AM_CPPFLAGS = -I$(srcdir)/.. -I$(top_srcdir)/hw/xfree86/os-support
noinst_LTLIBRARIES = libsafeAlpha.la
-libsafeAlpha_la_SOURCES = safeAlphaPicture.c \
- safeAlphaWindow.c
+libsafeAlpha_la_SOURCES = \
+ safeAlphaPicture.c \
+ safeAlphaWindow.c
EXTRA_DIST = safeAlpha.h
More information about the xorg-commit
mailing list