xserver: Branch 'master' - 6 commits
Jeremy Huddleston
jeremyhu at kemper.freedesktop.org
Tue Aug 26 20:19:53 PDT 2008
hw/xquartz/X11Application.m | 85 ++++++++++++++++++----------------
hw/xquartz/darwinEvents.c | 2
hw/xquartz/mach-startup/bundle-main.c | 27 +++++++++-
hw/xquartz/quartzKeyboard.c | 3 -
4 files changed, 72 insertions(+), 45 deletions(-)
New commits:
commit 3350770bd6d90fefa1133ac738c1d4eae2d568a6
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Tue Aug 26 19:13:56 2008 -0700
XQuartz: Use new Xplugin API to determine if a keypress event corresponds to an OS-X hotkey that we should dispatch to Appkit.
(cherry picked from commit e7658e745f8a3eaf5cec9f54a8a1b7e5a7708e09)
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 135fac3..707a67f 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -47,6 +47,8 @@
#include <mach/mach.h>
#include <unistd.h>
+#include <Xplugin.h>
+
#define DEFAULTS_FILE "/usr/X11/lib/X11/xserver/Xquartz.plist"
#ifndef XSERVER_VERSION
@@ -222,34 +224,40 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
break;
case NSKeyDown: case NSKeyUp:
- if(darwinAppKitModMask & [e modifierFlags]) {
- /* Override to force sending to Appkit */
- for_x = NO;
- } else if (_x_active) {
+
+ if(_x_active) {
static int swallow_up;
- /* No kit window is focused, so send it to X. */
- for_appkit = NO;
- if ([e type] == NSKeyDown) {
+ if([e type] == NSKeyDown) {
/* Before that though, see if there are any global
shortcuts bound to it. */
-
- if (X11EnableKeyEquivalents
- && [[self mainMenu] performKeyEquivalent:e]) {
+
+ if(darwinAppKitModMask & [e modifierFlags]) {
+ /* Override to force sending to Appkit */
swallow_up = [e keyCode];
for_x = NO;
- } else if (!quartzEnableRootless
- && ([e modifierFlags] & ALL_KEY_MASKS)
- == (NSCommandKeyMask | NSAlternateKeyMask)
- && ([e keyCode] == 0 /*a*/
- || [e keyCode] == 53 /*Esc*/)) {
- swallow_up = 0;
+#if 0
+ } else if(!quartzEnableRootless
+ && ([e modifierFlags] & ALL_KEY_MASKS) == (NSCommandKeyMask | NSAlternateKeyMask)
+ && ([e keyCode] == 0 /*a*/ || [e keyCode] == 53 /*Esc*/)) {
+ swallow_up = [e keyCode];
for_x = NO;
-#ifdef DARWIN_DDX_MISSING
DarwinSendDDXEvent(kXquartzToggleFullscreen, 0);
#endif
+ } else if(X11EnableKeyEquivalents &&
+#if XPLUGIN_VERSION >= 4
+ xp_is_symbolic_hotkey_event([e eventRef])) {
+#else
+ [[self mainMenu] performKeyEquivalent:e]) {
+ for_appkit = NO;
+#endif
+ swallow_up = [e keyCode];
+ for_x = NO;
+ } else {
+ /* No kit window is focused, so send it to X. */
+ for_appkit = NO;
}
- } else {
+ } else { /* KeyUp */
/* If we saw a key equivalent on the down, don't pass
the up through to X. */
@@ -258,7 +266,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
for_x = NO;
}
}
- } else {
+ } else { /* !_x_active */
for_x = NO;
}
break;
commit 7930ea9116f232a3762f0085e5ca65e06d1142fc
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Mon Aug 25 22:10:46 2008 -0700
XQuartz: Made a note to come back to the xinitrc race condition in the 1.5 branch when we move up to it.
(cherry picked from commit 54a882dcbdccef3f3eb4e6398e13c88185a8986c)
diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index 21a72d9..0eb45d1 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -41,6 +41,8 @@
#include <sys/socket.h>
#include <sys/un.h>
+#include <sys/time.h>
+
#include <mach/mach.h>
#include <mach/mach_error.h>
#include <servers/bootstrap.h>
@@ -167,10 +169,29 @@ static void accept_fd_handoff(int connected_fd) {
}
#ifndef XQUARTZ_EXPORTS_LAUNCHD_FD
- fprintf(stderr, "X11.app: Received new DISPLAY fd: %d ... sleeping to allow xinitrc to catchup.\n", launchd_fd);
+ /* TODO: Clean up this race better... giving xinitrc time to run... need to wait for 1.5 branch:
+ *
+ * From ajax:
+ * There's already an internal callback chain for setting selection [in 1.5]
+ * ownership. See the CallSelectionCallback at the bottom of
+ * ProcSetSelectionOwner, and xfixes/select.c for an example of how to hook
+ * into it.
+ */
- /* TODO: Clean up this race better... givint xinitrc time to run. */
- sleep(2);
+#if 0
+ struct timeval start, now;
+ gettimeofday(&start, NULL);
+ gettimeofday(&now, NULL);
+ while((now.tv_sec - start.tv_sec) * 1000000 + (now.tv_usec - start.tv_usec) < 2000000) {
+ unsigned usec = 3000001 - ((now.tv_sec - start.tv_sec) * 1000000 + (now.tv_usec - start.tv_usec));
+ fprintf(stderr, "X11.app: Received new DISPLAY fd: %d ... sleeping to allow xinitrc to catchup (%u).\n", launchd_fd, usec);
+ usleep(usec);
+ gettimeofday(&now, NULL);
+ }
+#else
+ fprintf(stderr, "X11.app: Received new DISPLAY fd: %d ... sleeping to allow xinitrc to catchup.\n", launchd_fd);
+ sleep(3);
+#endif
#endif
fprintf(stderr, "X11.app Handing off fd to server thread via DarwinListenOnOpenFD(%d)\n", launchd_fd);
commit dc1171df5baa0c4aa366ff2b07af5b8eb44dae12
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Fri Aug 22 01:12:37 2008 -0700
XQuartz: Fixed bogus args to debug ErrorF
(cherry picked from commit f0351c2b80f30ae31f041798b84139141fc3d5a5)
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index cb4a214..15953e3 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -148,7 +148,7 @@ static void DarwinPressModifierKey(int pressed, int key) {
int keycode = DarwinModifierNXKeyToNXKeycode(key, 0);
if (keycode == 0) {
- ErrorF("DarwinPressModifierKey bad keycode: key=%d\n", pressed == KeyPress ? "press" : "release", key, keycode);
+ ErrorF("DarwinPressModifierKey bad keycode: key=%d\n", key);
return;
}
commit ac936525afe46bad329387232f8d48e77f6a4175
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Fri Aug 22 01:11:33 2008 -0700
XQuartz: Cleaned up mouse event translation a bit more.
(cherry picked from commit c286f2a718fdaf6ad10249b59abb20731da8d904)
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index b53f733..135fac3 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -895,29 +895,25 @@ static void send_nsevent(NSEvent *e) {
DarwinUpdateModKeys([e modifierFlags]);
switch ([e type]) {
- case NSMouseMoved: ev_button=0; ev_type=MotionNotify; goto check_subtype;
- case NSLeftMouseDown: ev_button=1; ev_type=ButtonPress; goto check_subtype;
- case NSOtherMouseDown: ev_button=2; ev_type=ButtonPress; goto check_subtype;
- case NSRightMouseDown: ev_button=3; ev_type=ButtonPress; goto check_subtype;
- case NSLeftMouseUp: ev_button=1; ev_type=ButtonRelease; goto check_subtype;
- case NSOtherMouseUp: ev_button=2; ev_type=ButtonRelease; goto check_subtype;
- case NSRightMouseUp: ev_button=3; ev_type=ButtonRelease; goto check_subtype;
- case NSLeftMouseDragged: ev_button=1; ev_type=MotionNotify; goto check_subtype;
- case NSOtherMouseDragged: ev_button=2; ev_type=MotionNotify; goto check_subtype;
- case NSRightMouseDragged: ev_button=3; ev_type=MotionNotify; goto check_subtype;
-
- check_subtype:
- if ([e subtype] != NSTabletPointEventSubtype)
- goto handle_mouse;
- // fall through to get tablet data
-
- case NSTabletPoint:
- ev_type = MotionNotify;
- pressure = [e pressure];
- tilt_x = [e tilt].x;
- tilt_y = [e tilt].y;
- // fall through to normal mouse handling
+ case NSLeftMouseDown: ev_button=1; ev_type=ButtonPress; goto handle_mouse;
+ case NSOtherMouseDown: ev_button=2; ev_type=ButtonPress; goto handle_mouse;
+ case NSRightMouseDown: ev_button=3; ev_type=ButtonPress; goto handle_mouse;
+ case NSLeftMouseUp: ev_button=1; ev_type=ButtonRelease; goto handle_mouse;
+ case NSOtherMouseUp: ev_button=2; ev_type=ButtonRelease; goto handle_mouse;
+ case NSRightMouseUp: ev_button=3; ev_type=ButtonRelease; goto handle_mouse;
+ 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 NSMouseMoved: ev_button=0; ev_type=MotionNotify; goto handle_mouse;
+ case NSTabletPoint: ev_button=0; ev_type=MotionNotify; goto handle_mouse;
+
handle_mouse:
+ if ([e type] == NSTabletPoint || [e subtype] == NSTabletPointEventSubtype) {
+ pressure = [e pressure];
+ tilt_x = [e tilt].x;
+ tilt_y = [e tilt].y;
+ }
+
DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y,
pressure, tilt_x, tilt_y);
break;
commit 1b42f550001c11c93d5a2144df98a5c687c010c2
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Fri Aug 22 00:45:12 2008 -0700
Xquartz: Added missing ev_type for NSTabletPoint event.
(cherry picked from commit 07548f13947a212dcc020d52fe0ad679255121e2)
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index eeffd8c..b53f733 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -912,6 +912,7 @@ static void send_nsevent(NSEvent *e) {
// fall through to get tablet data
case NSTabletPoint:
+ ev_type = MotionNotify;
pressure = [e pressure];
tilt_x = [e tilt].x;
tilt_y = [e tilt].y;
commit 13a89f19208cf998808ff2896b7711310768f94c
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Wed Aug 20 10:21:23 2008 -0700
XQuartz: Added more explanation to debug keylayout spew to cut down on report-spam.
(cherry picked from commit fcdc9f8b5abd724d75f53d48fdadbed9859e9e79)
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 629d15d..aebc941 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -1191,7 +1191,7 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
#if !defined(__x86_64__) && !defined(__ppc64__)
if (chr_data == NULL) {
- ErrorF("X11.app: Error detected in determining keyboard layout. Please report this error at http://xquartz.macosforge.org\n");
+ ErrorF("X11.app: Error detected in determining keyboard layout. If you are using an Apple-provided keyboard layout, please report this error at http://xquartz.macosforge.org and http://bugreport.apple.com\n");
ErrorF("X11.app: Debug Info: keyboard_type=%u, currentKeyLayoutRef=%p, currentKeyLayoutDataRef=%p, chr_data=%p\n",
(unsigned)keyboard_type, currentKeyLayoutRef, currentKeyLayoutDataRef, chr_data);
@@ -1205,6 +1205,7 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
if (chr_data == NULL) {
ErrorF("X11.app: Debug Info: kKLuchrData fallback failed, trying kKLKCHRData.\n");
+ ErrorF("If you are using a 3rd party keyboard layout, please see http://xquartz.macosforge.org/trac/ticket/154\n");
KLGetKeyboardLayoutProperty (key_layout, kKLKCHRData, &chr_data);
is_uchr = 0;
num_keycodes = 128;
More information about the xorg-commit
mailing list