XQuartz: Formatting cleanup for sendX11NSEvent

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
This commit is contained in:
Jeremy Huddleston 2012-03-25 23:05:43 -07:00
parent 5324557c7b
commit 41a46546e9

View File

@ -1355,22 +1355,23 @@ untrusted_str(NSEvent *e)
} }
#endif #endif
isMouseOrTabletEvent = [e type] == NSLeftMouseDown || [e type] == isMouseOrTabletEvent = [e type] == NSLeftMouseDown ||
NSOtherMouseDown || [e type] == [e type] == NSOtherMouseDown ||
NSRightMouseDown || [e type] == NSRightMouseDown ||
[e type] == NSLeftMouseUp || [e type] == [e type] == NSLeftMouseUp ||
NSOtherMouseUp || [e type] == NSRightMouseUp || [e type] == NSOtherMouseUp ||
[e type] == NSLeftMouseDragged || [e type] == [e type] == NSRightMouseUp ||
NSOtherMouseDragged || [e type] == [e type] == NSLeftMouseDragged ||
NSRightMouseDragged || [e type] == NSOtherMouseDragged ||
[e type] == NSMouseMoved || [e type] == [e type] == NSRightMouseDragged ||
NSTabletPoint || [e type] == NSScrollWheel; [e type] == NSMouseMoved ||
[e type] == NSTabletPoint ||
[e type] == NSScrollWheel;
isTabletEvent = ([e type] == NSTabletPoint) || isTabletEvent = ([e type] == NSTabletPoint) ||
(isMouseOrTabletEvent && (isMouseOrTabletEvent &&
([e subtype] == NSTabletPointEventSubtype || ([e subtype] == NSTabletPointEventSubtype ||
[e subtype] == [e subtype] == NSTabletProximityEventSubtype));
NSTabletProximityEventSubtype));
if (isMouseOrTabletEvent) { if (isMouseOrTabletEvent) {
static NSPoint lastpt; static NSPoint lastpt;
@ -1388,19 +1389,16 @@ untrusted_str(NSEvent *e)
// The deltaXY for middle click events also appear erroneous after fast user switching // The deltaXY for middle click events also appear erroneous after fast user switching
// <rdar://problem/7979468> deltaX and deltaY are incorrect for NSOtherMouseDown and NSOtherMouseUp after FUS // <rdar://problem/7979468> deltaX and deltaY are incorrect for NSOtherMouseDown and NSOtherMouseUp after FUS
// http://xquartz.macosforge.org/trac/ticket/389 // http://xquartz.macosforge.org/trac/ticket/389
hasUntrustedPointerDelta = hasUntrustedPointerDelta || [e type] == hasUntrustedPointerDelta |= [e type] == NSOtherMouseDown ||
NSOtherMouseDown || [e type] == [e type] == NSOtherMouseUp;
NSOtherMouseUp;
// The deltaXY for scroll events correspond to the scroll delta, not the pointer delta // The deltaXY for scroll events correspond to the scroll delta, not the pointer delta
// <rdar://problem/7989690> deltaXY for wheel events are being sent as mouse movement // <rdar://problem/7989690> deltaXY for wheel events are being sent as mouse movement
hasUntrustedPointerDelta = hasUntrustedPointerDelta || [e type] == hasUntrustedPointerDelta |= [e type] == NSScrollWheel;
NSScrollWheel;
#ifdef DEBUG_UNTRUSTED_POINTER_DELTA #ifdef DEBUG_UNTRUSTED_POINTER_DELTA
hasUntrustedPointerDelta = hasUntrustedPointerDelta || [e type] == hasUntrustedPointerDelta |= [e type] == NSLeftMouseDown ||
NSLeftMouseDown || [e type] == [e type] == NSLeftMouseUp;
NSLeftMouseUp;
#endif #endif
if (window != nil) { if (window != nil) {
@ -1446,21 +1444,18 @@ untrusted_str(NSEvent *e)
/* This is to workaround a bug in the VNC server where we sometimes see the L /* This is to workaround a bug in the VNC server where we sometimes see the L
* modifier and sometimes see no "side" * modifier and sometimes see no "side"
*/ */
modifierFlags = modifierFlags = ensure_flag(modifierFlags, NX_CONTROLMASK,
ensure_flag(modifierFlags, NX_CONTROLMASK, NX_DEVICELCTLKEYMASK | NX_DEVICELCTLKEYMASK | NX_DEVICERCTLKEYMASK,
NX_DEVICERCTLKEYMASK, NX_DEVICELCTLKEYMASK);
NX_DEVICELCTLKEYMASK); modifierFlags = ensure_flag(modifierFlags, NX_SHIFTMASK,
modifierFlags = ensure_flag( NX_DEVICELSHIFTKEYMASK | NX_DEVICERSHIFTKEYMASK,
modifierFlags, NX_SHIFTMASK, NX_DEVICELSHIFTKEYMASK | NX_DEVICELSHIFTKEYMASK);
NX_DEVICERSHIFTKEYMASK, NX_DEVICELSHIFTKEYMASK); modifierFlags = ensure_flag(modifierFlags, NX_COMMANDMASK,
modifierFlags = NX_DEVICELCMDKEYMASK | NX_DEVICERCMDKEYMASK,
ensure_flag(modifierFlags, NX_COMMANDMASK, NX_DEVICELCMDKEYMASK | NX_DEVICELCMDKEYMASK);
NX_DEVICERCMDKEYMASK, modifierFlags = ensure_flag(modifierFlags, NX_ALTERNATEMASK,
NX_DEVICELCMDKEYMASK); NX_DEVICELALTKEYMASK | NX_DEVICERALTKEYMASK,
modifierFlags = NX_DEVICELALTKEYMASK);
ensure_flag(modifierFlags, NX_ALTERNATEMASK, NX_DEVICELALTKEYMASK |
NX_DEVICERALTKEYMASK,
NX_DEVICELALTKEYMASK);
#endif #endif
modifierFlags &= darwin_all_modifier_mask; modifierFlags &= darwin_all_modifier_mask;
@ -1560,8 +1555,8 @@ handle_mouse:
return; return;
} }
if ([e type] == NSTabletPoint || [e subtype] == if ([e type] == NSTabletPoint ||
NSTabletPointEventSubtype) { [e subtype] == NSTabletPointEventSubtype) {
pressure = [e pressure]; pressure = [e pressure];
tilt = [e tilt]; tilt = [e tilt];
@ -1608,9 +1603,7 @@ handle_mouse:
} }
DarwinSendPointerEvents(pDev, ev_type, ev_button, location.x, DarwinSendPointerEvents(pDev, ev_type, ev_button, location.x,
location.y, location.y, pressure, tilt.x, tilt.y);
pressure, tilt.x,
tilt.y);
break; break;
@ -1650,9 +1643,8 @@ handle_mouse:
if (!XQuartzServerVisible && noTestExtensions) { if (!XQuartzServerVisible && noTestExtensions) {
bgMouseLocationUpdated = FALSE; bgMouseLocationUpdated = FALSE;
DarwinSendPointerEvents(darwinPointer, MotionNotify, 0, DarwinSendPointerEvents(darwinPointer, MotionNotify, 0,
location.x, location.x, location.y, pressure,
location.y, pressure, tilt.x, tilt.x, tilt.y);
tilt.y);
} }
#endif #endif
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
@ -1684,7 +1676,7 @@ handle_mouse:
if (darwinSyncKeymap) { if (darwinSyncKeymap) {
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
TISInputSourceRef key_layout = TISInputSourceRef key_layout =
TISCopyCurrentKeyboardLayoutInputSource(); TISCopyCurrentKeyboardLayoutInputSource();
TISInputSourceRef clear; TISInputSourceRef clear;
if (CFEqual(key_layout, last_key_layout)) { if (CFEqual(key_layout, last_key_layout)) {