xserver: Branch 'xorg-server-1.5-apple' - 7 commits
Jeremy Huddleston
jeremyhu at kemper.freedesktop.org
Sat Apr 11 17:27:29 PDT 2009
configure.ac | 6 +++---
hw/xquartz/X11Application.m | 32 +++++++++++---------------------
hw/xquartz/darwinEvents.c | 44 +++++++++++++++++++++++++++++---------------
hw/xquartz/darwinEvents.h | 12 ++++++++++--
4 files changed, 53 insertions(+), 41 deletions(-)
New commits:
commit 2039470154e3da6c830cd681280d2e013bf6c5ec
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Sat Apr 11 17:27:11 2009 -0700
1.5.3-apple6
diff --git a/configure.ac b/configure.ac
index cd79c02..7f8594a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,9 +26,9 @@ dnl
dnl Process this file with autoconf to create configure.
AC_PREREQ(2.57)
-AC_INIT([xorg-server], 1.5.3-apple5, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="5 April 2009"
-REMEMBER_REMEMBER="The Fifth of April"
+AC_INIT([xorg-server], 1.5.3-apple6, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="11 April 2009"
+REMEMBER_REMEMBER="The Eleventh of April"
AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([dist-bzip2 foreign])
AM_MAINTAINER_MODE
commit a3fbdb30b5c35475d8f7bdc6df3dbd5409d41ee6
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Sat Apr 11 16:53:59 2009 -0700
XQuartz: Use correct values for ProximityIn and ProximityOut
This was the other underlying cause of teh 100% CPU tablet issue.
(cherry picked from commit a9cecf34c23fbcd59b56b380c51d31a9fabc3eb7)
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 7bac8db..0445b8e 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -44,6 +44,7 @@
#define _APPLEWM_SERVER_
#include "X11/extensions/applewm.h"
#include "micmap.h"
+#include "exglobals.h"
#include <mach/mach.h>
#include <unistd.h>
@@ -60,9 +61,6 @@ extern BOOL xpbproxy_init (void);
#define XSERVER_VERSION "?"
#endif
-#define ProximityIn 0
-#define ProximityOut 1
-
/* Stuck modifier / button state... force release when we context switch */
static NSEventType keyState[NUM_KEYCODES];
commit 9d8ce0ea766a695f2eda3c46f5001ba3b9673f69
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Sat Apr 11 16:38:02 2009 -0700
XQuartz: Solve the tablet 100% CPU bug
This happened because we put a byte in the fd to wake up dispatch, but we never actually enqueued anything in mieq because the num_events was 0.
(cherry picked from commit c21ca7558d2faf93c61f5feaafd7c878e9e21942)
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 15354bd..aa14d08 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -479,7 +479,7 @@ void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, floa
num_events = GetPointerEvents(darwinEvents, pDev, ev_type, ev_button,
POINTER_ABSOLUTE, 0, pDev==darwinTabletCurrent?5:2, valuators);
for(i=0; i<num_events; i++) mieqEnqueue (pDev, &darwinEvents[i]);
- DarwinPokeEQ();
+ if(num_events > 0) DarwinPokeEQ();
} darwinEvents_unlock();
}
@@ -494,7 +494,7 @@ void DarwinSendKeyboardEvents(int ev_type, int keycode) {
darwinEvents_lock(); {
num_events = GetKeyboardEvents(darwinEvents, darwinKeyboard, ev_type, keycode + MIN_KEYCODE);
for(i=0; i<num_events; i++) mieqEnqueue(darwinKeyboard,&darwinEvents[i]);
- DarwinPokeEQ();
+ if(num_events > 0) DarwinPokeEQ();
} darwinEvents_unlock();
}
@@ -522,7 +522,7 @@ void DarwinSendProximityEvents(int ev_type, float pointer_x, float pointer_y) {
num_events = GetProximityEvents(darwinEvents, pDev, ev_type,
0, 5, valuators);
for(i=0; i<num_events; i++) mieqEnqueue (pDev,&darwinEvents[i]);
- DarwinPokeEQ();
+ if(num_events > 0) DarwinPokeEQ();
} darwinEvents_unlock();
}
commit 35a678ec1553edea4a17529240023fe282ba3966
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Sat Apr 11 16:13:42 2009 -0700
XQuartz: Re-enable background window checking
since that code was not the culprit for the wacom tablet, background 100% CPU bug
(cherry picked from commit fc1dc5d71b2a488a8a94d953dd8e67353161a590)
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 0a36b1d..7bac8db 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -1067,12 +1067,7 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
if(!quartzServerVisible && noTestExtensions) {
if(ev_button == 0) {
-#if 0
-/* Seems this has somehow triggered 100% CPU usage while X11.app is in the
- * background on some obscure HW configurations.
- * http://xquartz.macosforge.org/trac/ticket/241
- */
-//#if defined(XPLUGIN_VERSION) && XPLUGIN_VERSION > 0
+#if defined(XPLUGIN_VERSION) && XPLUGIN_VERSION > 0
/* Older libXplugin (Tiger/"Stock" Leopard) aren't thread safe, so we can't call xp_find_window from the Appkit thread */
xp_window_id wid = 0;
xp_error e;
@@ -1124,8 +1119,7 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
break;
case NSScrollWheel:
-//#if !defined(XPLUGIN_VERSION) || XPLUGIN_VERSION == 0
-#if 1 /* Strange 100% CPU issue, so always enabling. see above */
+#if !defined(XPLUGIN_VERSION) || XPLUGIN_VERSION == 0
/* If we're in the background, we need to send a MotionNotify event
* first, since we aren't getting them on background mouse motion
*/
commit 83c2310b16e4f49c758816f07dfff1acab9c9ebd
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Sat Apr 11 16:12:23 2009 -0700
XQuartz: Only set MotionNotify on activation if it is updated.
(cherry picked from commit ae8077a251ef27381a755d57ff974767bda16148)
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index f27894f..0a36b1d 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -83,6 +83,7 @@ extern int darwinFakeButtons;
* location when we become the foreground application
*/
static NSPoint bgMouseLocation;
+static BOOL bgMouseLocationUpdated = FALSE;
X11Application *X11App;
@@ -192,7 +193,8 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
size_t i;
DEBUG_LOG("state=%d, _x_active=%d, \n", state, _x_active)
if (state) {
- DarwinSendPointerEvents(darwinPointer, MotionNotify, 0, bgMouseLocation.x, bgMouseLocation.y, 0.0, 0.0, 0.0);
+ if(bgMouseLocationUpdated)
+ DarwinSendPointerEvents(darwinPointer, MotionNotify, 0, bgMouseLocation.x, bgMouseLocation.y, 0.0, 0.0, 0.0);
DarwinSendDDXEvent(kXquartzActivate, 0);
if (!_x_active) {
@@ -1087,9 +1089,11 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
#endif
{
bgMouseLocation = location;
+ bgMouseLocationUpdated = TRUE;
return;
}
} else {
+ bgMouseLocationUpdated = FALSE;
DarwinSendPointerEvents(pDev, MotionNotify, 0, location.x,
location.y, pressure, tilt.x, tilt.y);
}
commit 166c4778fc9a0353c3bbb0635949ab32536206dd
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Sat Apr 11 14:23:41 2009 -0700
XQuartz: Make sure the Fn doesn't trigger unneccessary calls to DarwinUpdateModKeys()
(cherry picked from commit 70a18558c6b0a02b633fd8974f002cdf3cdc713e)
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 4417481..f27894f 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -65,7 +65,6 @@ extern BOOL xpbproxy_init (void);
/* Stuck modifier / button state... force release when we context switch */
static NSEventType keyState[NUM_KEYCODES];
-static int modifierFlagsMask;
int X11EnableKeyEquivalents = TRUE, quartzFullscreenMenu = FALSE;
int quartzHasRoot = FALSE, quartzEnableRootless = TRUE;
@@ -207,7 +206,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
}
} else {
- if(darwin_modifier_flags)
+ if(darwin_all_modifier_flags)
DarwinUpdateModKeys(0);
for(i=0; i < NUM_KEYCODES; i++) {
if(keyState[i] == NSKeyDown) {
@@ -880,7 +879,6 @@ environment the next time you start X11?", @"Startup xinitrc dialog");
void X11ApplicationMain (int argc, char **argv, char **envp) {
NSAutoreleasePool *pool;
- int *p;
#ifdef DEBUG
while (access ("/tmp/x11-block", F_OK) == 0) sleep (1);
@@ -925,10 +923,6 @@ void X11ApplicationMain (int argc, char **argv, char **envp) {
fprintf(stderr, "X11ApplicationMain: Could not build a valid keymap.\n");
}
- for(p=darwin_modifier_mask_list, modifierFlagsMask=0; *p; p++) {
- modifierFlagsMask |= *p;
- }
-
/* Tell the server thread that it can proceed */
QuartzInitServer(argc, argv, envp);
@@ -1005,14 +999,14 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
modifierFlags = ensure_flag(modifierFlags, NX_ALTERNATEMASK, NX_DEVICELALTKEYMASK | NX_DEVICERALTKEYMASK, NX_DEVICELALTKEYMASK);
#endif
- modifierFlags &= modifierFlagsMask;
+ modifierFlags &= darwin_all_modifier_mask;
/* We don't receive modifier key events while out of focus, and 3button
* emulation mucks this up, so we need to check our modifier flag state
* on every event... ugg
*/
- if(darwin_modifier_flags != modifierFlags)
+ if(darwin_all_modifier_flags != modifierFlags)
DarwinUpdateModKeys(modifierFlags);
switch ([e type]) {
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index de34273..15354bd 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -75,7 +75,9 @@ in this Software without prior written authorization from The Open Group.
/* FIXME: Abstract this better */
void QuartzModeEQInit(void);
-int darwin_modifier_flags = 0; // last known modifier state
+int darwin_all_modifier_flags = 0; // last known modifier state
+int darwin_all_modifier_mask = 0;
+int darwin_x11_modifier_mask = 0;
#define FD_ADD_MAX 128
static int fd_add[FD_ADD_MAX];
@@ -146,7 +148,7 @@ static void DarwinPressModifierKey(int pressed, int key) {
* Send events to update the modifier state.
*/
-int darwin_modifier_mask_list[] = {
+static int darwin_x11_modifier_mask_list[] = {
#ifdef NX_DEVICELCMDKEYMASK
NX_DEVICELCTLKEYMASK, NX_DEVICERCTLKEYMASK,
NX_DEVICELSHIFTKEYMASK, NX_DEVICERSHIFTKEYMASK,
@@ -155,10 +157,12 @@ int darwin_modifier_mask_list[] = {
#else
NX_CONTROLMASK, NX_SHIFTMASK, NX_COMMANDMASK, NX_ALTERNATEMASK,
#endif
- NX_ALPHASHIFTMASK, NX_SECONDARYFNMASK
+ NX_ALPHASHIFTMASK,
0
};
+static int darwin_all_modifier_mask_additions[] = { NX_SECONDARYFNMASK, };
+
static void DarwinUpdateModifiers(
int pressed, // KeyPress or KeyRelease
int flags ) // modifier flags that have changed
@@ -174,11 +178,8 @@ static void DarwinUpdateModifiers(
DarwinPressModifierKey(KeyRelease, NX_MODIFIERKEY_ALPHALOCK);
}
- for(f=darwin_modifier_mask_list; *f; f++)
- /* NX_ALPHASHIFTMASK is handled above and NX_SECONDARYFNMASK is not
- * mapped to a key (it is just useful for 3button mouse simulation
- */
- if(*f & flags && *f != NX_ALPHASHIFTMASK && *f != NX_SECONDARYFNMASK) {
+ for(f=darwin_x11_modifier_mask_list; *f; f++)
+ if(*f & flags && *f != NX_ALPHASHIFTMASK) {
key = DarwinModifierNXMaskToNXKey(*f);
if(key == -1)
ErrorF("DarwinUpdateModifiers: Unsupported NXMask: 0x%x\n", *f);
@@ -310,6 +311,16 @@ static void kXquartzListenOnOpenFDHandler(int screenNum, xEventPtr xe, DeviceInt
}
Bool DarwinEQInit(void) {
+ int *p;
+
+ for(p=darwin_x11_modifier_mask_list, darwin_all_modifier_mask=0; *p; p++) {
+ darwin_x11_modifier_mask |= *p;
+ }
+
+ for(p=darwin_all_modifier_mask_additions, darwin_all_modifier_mask= darwin_x11_modifier_mask; *p; p++) {
+ darwin_all_modifier_mask |= *p;
+ }
+
mieqInit();
mieqSetHandler(kXquartzReloadKeymap, DarwinKeyboardReloadHandler);
mieqSetHandler(kXquartzActivate, DarwinEventHandler);
@@ -438,14 +449,14 @@ void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, floa
DarwinSendPointerEvents(pDev, ButtonRelease, darwinFakeMouseButtonDown, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
darwinFakeMouseButtonDown=0;
}
- if (darwin_modifier_flags & darwinFakeMouse2Mask) {
+ if (darwin_all_modifier_flags & darwinFakeMouse2Mask) {
ev_button = 2;
darwinFakeMouseButtonDown = 2;
- DarwinUpdateModKeys(darwin_modifier_flags & ~darwinFakeMouse2Mask);
- } else if (darwin_modifier_flags & darwinFakeMouse3Mask) {
+ DarwinUpdateModKeys(darwin_all_modifier_flags & ~darwinFakeMouse2Mask);
+ } else if (darwin_all_modifier_flags & darwinFakeMouse3Mask) {
ev_button = 3;
darwinFakeMouseButtonDown = 3;
- DarwinUpdateModKeys(darwin_modifier_flags & ~darwinFakeMouse3Mask);
+ DarwinUpdateModKeys(darwin_all_modifier_flags & ~darwinFakeMouse3Mask);
}
}
@@ -455,9 +466,9 @@ void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, floa
}
if(darwinFakeMouseButtonDown == 2) {
- DarwinUpdateModKeys(darwin_modifier_flags & ~darwinFakeMouse2Mask);
+ DarwinUpdateModKeys(darwin_all_modifier_flags & ~darwinFakeMouse2Mask);
} else if(darwinFakeMouseButtonDown == 3) {
- DarwinUpdateModKeys(darwin_modifier_flags & ~darwinFakeMouse3Mask);
+ DarwinUpdateModKeys(darwin_all_modifier_flags & ~darwinFakeMouse3Mask);
}
darwinFakeMouseButtonDown = 0;
@@ -547,9 +558,9 @@ void DarwinSendScrollEvents(float count_x, float count_y,
/* Send the appropriate KeyPress/KeyRelease events to GetKeyboardEvents to
reflect changing modifier flags (alt, control, meta, etc) */
void DarwinUpdateModKeys(int flags) {
- DarwinUpdateModifiers(KeyRelease, darwin_modifier_flags & ~flags);
- DarwinUpdateModifiers(KeyPress, ~darwin_modifier_flags & flags);
- darwin_modifier_flags = flags;
+ DarwinUpdateModifiers(KeyRelease, darwin_all_modifier_flags & ~flags & darwin_x11_modifier_mask);
+ DarwinUpdateModifiers(KeyPress, ~darwin_all_modifier_flags & flags & darwin_x11_modifier_mask);
+ darwin_all_modifier_flags = flags;
}
/*
diff --git a/hw/xquartz/darwinEvents.h b/hw/xquartz/darwinEvents.h
index 9ec3bda..1268514 100644
--- a/hw/xquartz/darwinEvents.h
+++ b/hw/xquartz/darwinEvents.h
@@ -78,7 +78,15 @@ enum {
/* Send one of the above events to the server thread. */
void DarwinSendDDXEvent(int type, int argc, ...);
-extern int darwin_modifier_mask_list[];
-extern int darwin_modifier_flags;
+/* A mask of the modifiers that are in our X11 keyboard layout:
+ * (Fn for example is just useful for 3button mouse emulation) */
+extern int darwin_all_modifier_mask;
+
+/* A mask of the modifiers that are in our X11 keyboard layout:
+ * (Fn for example is just useful for 3button mouse emulation) */
+extern int darwin_x11_modifier_mask;
+
+/* The current state of the above listed modifiers */
+extern int darwin_all_modifier_flags;
#endif /* _DARWIN_EVENTS_H */
commit 1bf2708211b1ad6bf927789675a826a8ca14d99c
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Sat Apr 11 13:53:38 2009 -0700
XQuartz: Re-enable Fn as an option for 3button mouse simulation.
Patch from Martin Otte <otte at duke.edu>
(cherry picked from commit b5ec3be6b5449b5d575bc1472fdd1c9cb15cb8be)
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index f663457..de34273 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -155,7 +155,7 @@ int darwin_modifier_mask_list[] = {
#else
NX_CONTROLMASK, NX_SHIFTMASK, NX_COMMANDMASK, NX_ALTERNATEMASK,
#endif
- NX_ALPHASHIFTMASK,
+ NX_ALPHASHIFTMASK, NX_SECONDARYFNMASK
0
};
@@ -175,7 +175,10 @@ static void DarwinUpdateModifiers(
}
for(f=darwin_modifier_mask_list; *f; f++)
- if(*f & flags && *f != NX_ALPHASHIFTMASK) {
+ /* NX_ALPHASHIFTMASK is handled above and NX_SECONDARYFNMASK is not
+ * mapped to a key (it is just useful for 3button mouse simulation
+ */
+ if(*f & flags && *f != NX_ALPHASHIFTMASK && *f != NX_SECONDARYFNMASK) {
key = DarwinModifierNXMaskToNXKey(*f);
if(key == -1)
ErrorF("DarwinUpdateModifiers: Unsupported NXMask: 0x%x\n", *f);
More information about the xorg-commit
mailing list