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

(cherry picked from commit 745bc8ab38)
(cherry picked from commit a28a2be524)
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 void send_nsevent (NSEventType type, NSEvent *e);
static void send_nsevent(NSEvent *e);
/* Quartz mode initialization routine. This is often dynamically loaded
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_x = YES;
if(darwinAppKitModMask & [e modifierFlags]) {
[super sendEvent:e];
return;
}
switch (type) {
switch ([e type]) {
case NSLeftMouseDown: case NSRightMouseDown: case NSOtherMouseDown:
case NSLeftMouseUp: case NSRightMouseUp: case NSOtherMouseUp:
if ([e window] != nil) {
@ -227,12 +222,15 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
break;
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;
/* No kit window is focused, so send it to X. */
for_appkit = NO;
if (type == NSKeyDown) {
if ([e type] == NSKeyDown) {
/* Before that though, see if there are any global
shortcuts bound to it. */
@ -247,6 +245,9 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
|| [e keyCode] == 53 /*Esc*/)) {
swallow_up = 0;
for_x = NO;
#ifdef DARWIN_DDX_MISSING
DarwinSendDDXEvent(kXquartzToggleFullscreen, 0);
#endif
}
} else {
/* 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;
}
}
} else for_x = NO;
} else {
for_x = NO;
}
break;
case NSFlagsChanged:
/* For the l33t X users who remap modifier keys to normal keysyms. */
if (!_x_active) for_x = NO;
/* Don't tell X11 about modifiers changing while it's not active */
if (!_x_active)
for_x = NO;
break;
case NSAppKitDefined:
@ -298,7 +302,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
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 {
@ -843,7 +847,7 @@ convert_flags (unsigned int nsflags) {
extern int darwin_modifier_flags; // darwinEvents.c
static void send_nsevent (NSEventType type, NSEvent *e) {
static void send_nsevent(NSEvent *e) {
NSRect screen;
NSPoint location;
NSWindow *window;
@ -876,7 +880,7 @@ static void send_nsevent (NSEventType type, NSEvent *e) {
if(darwin_modifier_flags != [e modifierFlags])
DarwinUpdateModKeys([e modifierFlags]);
switch (type) {
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;
@ -888,7 +892,7 @@ static void send_nsevent (NSEventType type, NSEvent *e) {
case NSOtherMouseDragged: ev_button=2; ev_type=MotionNotify; goto check_subtype;
case NSRightMouseDragged: ev_button=3; ev_type=MotionNotify; goto check_subtype;
check_subtype:
check_subtype:
if ([e subtype] != NSTabletPointEventSubtype)
goto handle_mouse;
// fall through to get tablet data
@ -897,10 +901,8 @@ check_subtype:
pressure = [e pressure];
tilt_x = [e tilt].x;
tilt_y = [e tilt].y;
goto handle_mouse;
// fall through to normal mouse handling
handle_mouse:
handle_mouse:
DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y,
pressure, tilt_x, tilt_y);
break;
@ -916,7 +918,7 @@ handle_mouse:
break;
case NSKeyDown: case NSKeyUp:
DarwinSendKeyboardEvents((type == NSKeyDown)?KeyPress:KeyRelease, [e keyCode]);
DarwinSendKeyboardEvents(([e type] == NSKeyDown) ? KeyPress : KeyRelease, [e keyCode]);
break;
default: break; /* for gcc */