xserver: Branch 'master' - 6 commits
Jeremy Huddleston
jeremyhu at kemper.freedesktop.org
Sat Apr 11 17:26:30 PDT 2009
hw/xquartz/X11Application.m | 32 +++++++++++---------------------
hw/xquartz/darwinEvents.c | 44 +++++++++++++++++++++++++++++---------------
hw/xquartz/darwinEvents.h | 12 ++++++++++--
3 files changed, 50 insertions(+), 38 deletions(-)
New commits:
commit 140463a197fb93d0a4bfad924efc35b860e8cc54
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 80a7bb2605f9b439d6221c0495a629a39177a018
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Sat Apr 11 17:26:07 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 e8ed56c..54d05fb 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -478,7 +478,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].event);
- DarwinPokeEQ();
+ if(num_events > 0) DarwinPokeEQ();
} darwinEvents_unlock();
}
@@ -493,7 +493,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].event);
- DarwinPokeEQ();
+ if(num_events > 0) DarwinPokeEQ();
} darwinEvents_unlock();
}
@@ -521,7 +521,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].event);
- DarwinPokeEQ();
+ if(num_events > 0) DarwinPokeEQ();
} darwinEvents_unlock();
}
commit 6f8f7c78f1b722bc70a0ea8f6340116a1e09e858
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 8522a759c9e78478bb399b91d3a0af2d23ea6766
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 5e55becddccc376ab7338789562ad6d6cd750de9
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 b69ed6a..e8ed56c 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -74,7 +74,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];
@@ -145,7 +147,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,
@@ -154,10 +156,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
@@ -173,11 +177,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);
@@ -309,6 +310,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);
@@ -437,14 +448,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);
}
}
@@ -454,9 +465,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;
@@ -546,9 +557,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 bd1d9179094657865b0606ed0ac835a8b8df3be1
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 7f0ff7e..b69ed6a 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -154,7 +154,7 @@ int darwin_modifier_mask_list[] = {
#else
NX_CONTROLMASK, NX_SHIFTMASK, NX_COMMANDMASK, NX_ALTERNATEMASK,
#endif
- NX_ALPHASHIFTMASK,
+ NX_ALPHASHIFTMASK, NX_SECONDARYFNMASK
0
};
@@ -174,7 +174,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