XQuartz: Just cleaned up formatting of event processing code... no "meat" changed...

(cherry picked from commit 745bc8ab387d6794f47d8b9dca33b4c81f6dd39c)
(cherry picked from commit a28a2be52478a1557a363140f7bd70ececf144dc)
This commit is contained in:
Jeremy Huddleston 2008-08-20 09:58:48 -07:00
parent ed42108920
commit bdc277c9b3

View File

@ -77,7 +77,7 @@ struct message_struct {
static mach_port_t _port; static mach_port_t _port;
static void send_nsevent (NSEventType type, NSEvent *e); static void send_nsevent(NSEvent *e);
/* Quartz mode initialization routine. This is often dynamically loaded /* Quartz mode initialization routine. This is often dynamically loaded
but is statically linked into this X server. */ but is statically linked into this X server. */
@ -201,12 +201,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
for_appkit = YES; for_appkit = YES;
for_x = YES; for_x = YES;
if(darwinAppKitModMask & [e modifierFlags]) { switch ([e type]) {
[super sendEvent:e];
return;
}
switch (type) {
case NSLeftMouseDown: case NSRightMouseDown: case NSOtherMouseDown: case NSLeftMouseDown: case NSRightMouseDown: case NSOtherMouseDown:
case NSLeftMouseUp: case NSRightMouseUp: case NSOtherMouseUp: case NSLeftMouseUp: case NSRightMouseUp: case NSOtherMouseUp:
if ([e window] != nil) { if ([e window] != nil) {
@ -227,12 +222,15 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
break; break;
case NSKeyDown: case NSKeyUp: case NSKeyDown: case NSKeyUp:
if (_x_active) { if(darwinAppKitModMask & [e modifierFlags]) {
/* Override to force sending to Appkit */
for_x = NO;
} else if (_x_active) {
static int swallow_up; static int swallow_up;
/* No kit window is focused, so send it to X. */ /* No kit window is focused, so send it to X. */
for_appkit = NO; for_appkit = NO;
if (type == NSKeyDown) { if ([e type] == NSKeyDown) {
/* Before that though, see if there are any global /* Before that though, see if there are any global
shortcuts bound to it. */ shortcuts bound to it. */
@ -247,6 +245,9 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
|| [e keyCode] == 53 /*Esc*/)) { || [e keyCode] == 53 /*Esc*/)) {
swallow_up = 0; swallow_up = 0;
for_x = NO; for_x = NO;
#ifdef DARWIN_DDX_MISSING
DarwinSendDDXEvent(kXquartzToggleFullscreen, 0);
#endif
} }
} else { } else {
/* If we saw a key equivalent on the down, don't pass /* If we saw a key equivalent on the down, don't pass
@ -257,12 +258,15 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
for_x = NO; for_x = NO;
} }
} }
} else for_x = NO; } else {
for_x = NO;
}
break; break;
case NSFlagsChanged: case NSFlagsChanged:
/* For the l33t X users who remap modifier keys to normal keysyms. */ /* Don't tell X11 about modifiers changing while it's not active */
if (!_x_active) for_x = NO; if (!_x_active)
for_x = NO;
break; break;
case NSAppKitDefined: case NSAppKitDefined:
@ -298,7 +302,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
if (for_appkit) [super sendEvent:e]; if (for_appkit) [super sendEvent:e];
if (for_x) send_nsevent (type, e); if (for_x) send_nsevent(e);
} }
- (void) set_window_menu:(NSArray *)list { - (void) set_window_menu:(NSArray *)list {
@ -843,7 +847,7 @@ convert_flags (unsigned int nsflags) {
extern int darwin_modifier_flags; // darwinEvents.c extern int darwin_modifier_flags; // darwinEvents.c
static void send_nsevent (NSEventType type, NSEvent *e) { static void send_nsevent(NSEvent *e) {
NSRect screen; NSRect screen;
NSPoint location; NSPoint location;
NSWindow *window; NSWindow *window;
@ -876,7 +880,7 @@ static void send_nsevent (NSEventType type, NSEvent *e) {
if(darwin_modifier_flags != [e modifierFlags]) if(darwin_modifier_flags != [e modifierFlags])
DarwinUpdateModKeys([e modifierFlags]); DarwinUpdateModKeys([e modifierFlags]);
switch (type) { switch ([e type]) {
case NSMouseMoved: ev_button=0; ev_type=MotionNotify; goto check_subtype; case NSMouseMoved: ev_button=0; ev_type=MotionNotify; goto check_subtype;
case NSLeftMouseDown: ev_button=1; ev_type=ButtonPress; 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 NSOtherMouseDown: ev_button=2; ev_type=ButtonPress; goto check_subtype;
@ -897,9 +901,7 @@ check_subtype:
pressure = [e pressure]; pressure = [e pressure];
tilt_x = [e tilt].x; tilt_x = [e tilt].x;
tilt_y = [e tilt].y; tilt_y = [e tilt].y;
goto handle_mouse;
// fall through to normal mouse handling // fall through to normal mouse handling
handle_mouse: handle_mouse:
DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y, DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y,
pressure, tilt_x, tilt_y); pressure, tilt_x, tilt_y);
@ -916,7 +918,7 @@ handle_mouse:
break; break;
case NSKeyDown: case NSKeyUp: case NSKeyDown: case NSKeyUp:
DarwinSendKeyboardEvents((type == NSKeyDown)?KeyPress:KeyRelease, [e keyCode]); DarwinSendKeyboardEvents(([e type] == NSKeyDown) ? KeyPress : KeyRelease, [e keyCode]);
break; break;
default: break; /* for gcc */ default: break; /* for gcc */