From 815414858b918c39fdfb5f7500e2eec5d4946fba Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Sun, 25 Mar 2012 23:05:43 -0700 Subject: XQuartz: Formatting cleanup for sendX11NSEvent Signed-off-by: Jeremy Huddleston (cherry picked from commit 41a46546e92b66fed323b5845dd71a6385feb418) --- hw/xquartz/X11Application.m | 80 ++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 44 deletions(-) (limited to 'hw/xquartz/X11Application.m') diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index b2bc2ba9c..40e8a8250 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -1307,22 +1307,23 @@ untrusted_str(NSEvent *e) } #endif - isMouseOrTabletEvent = [e type] == NSLeftMouseDown || [e type] == - NSOtherMouseDown || [e type] == - NSRightMouseDown || - [e type] == NSLeftMouseUp || [e type] == - NSOtherMouseUp || [e type] == NSRightMouseUp || - [e type] == NSLeftMouseDragged || [e type] == - NSOtherMouseDragged || [e type] == - NSRightMouseDragged || - [e type] == NSMouseMoved || [e type] == - NSTabletPoint || [e type] == NSScrollWheel; + isMouseOrTabletEvent = [e type] == NSLeftMouseDown || + [e type] == NSOtherMouseDown || + [e type] == NSRightMouseDown || + [e type] == NSLeftMouseUp || + [e type] == NSOtherMouseUp || + [e type] == NSRightMouseUp || + [e type] == NSLeftMouseDragged || + [e type] == NSOtherMouseDragged || + [e type] == NSRightMouseDragged || + [e type] == NSMouseMoved || + [e type] == NSTabletPoint || + [e type] == NSScrollWheel; isTabletEvent = ([e type] == NSTabletPoint) || (isMouseOrTabletEvent && ([e subtype] == NSTabletPointEventSubtype || - [e subtype] == - NSTabletProximityEventSubtype)); + [e subtype] == NSTabletProximityEventSubtype)); if (isMouseOrTabletEvent) { static NSPoint lastpt; @@ -1340,19 +1341,16 @@ untrusted_str(NSEvent *e) // The deltaXY for middle click events also appear erroneous after fast user switching // deltaX and deltaY are incorrect for NSOtherMouseDown and NSOtherMouseUp after FUS // http://xquartz.macosforge.org/trac/ticket/389 - hasUntrustedPointerDelta = hasUntrustedPointerDelta || [e type] == - NSOtherMouseDown || [e type] == - NSOtherMouseUp; + hasUntrustedPointerDelta |= [e type] == NSOtherMouseDown || + [e type] == NSOtherMouseUp; // The deltaXY for scroll events correspond to the scroll delta, not the pointer delta // deltaXY for wheel events are being sent as mouse movement - hasUntrustedPointerDelta = hasUntrustedPointerDelta || [e type] == - NSScrollWheel; + hasUntrustedPointerDelta |= [e type] == NSScrollWheel; #ifdef DEBUG_UNTRUSTED_POINTER_DELTA - hasUntrustedPointerDelta = hasUntrustedPointerDelta || [e type] == - NSLeftMouseDown || [e type] == - NSLeftMouseUp; + hasUntrustedPointerDelta |= [e type] == NSLeftMouseDown || + [e type] == NSLeftMouseUp; #endif if (window != nil) { @@ -1398,21 +1396,18 @@ untrusted_str(NSEvent *e) /* This is to workaround a bug in the VNC server where we sometimes see the L * modifier and sometimes see no "side" */ - modifierFlags = - ensure_flag(modifierFlags, NX_CONTROLMASK, NX_DEVICELCTLKEYMASK | - NX_DEVICERCTLKEYMASK, - NX_DEVICELCTLKEYMASK); - modifierFlags = ensure_flag( - modifierFlags, NX_SHIFTMASK, NX_DEVICELSHIFTKEYMASK | - NX_DEVICERSHIFTKEYMASK, NX_DEVICELSHIFTKEYMASK); - modifierFlags = - ensure_flag(modifierFlags, NX_COMMANDMASK, NX_DEVICELCMDKEYMASK | - NX_DEVICERCMDKEYMASK, - NX_DEVICELCMDKEYMASK); - modifierFlags = - ensure_flag(modifierFlags, NX_ALTERNATEMASK, NX_DEVICELALTKEYMASK | - NX_DEVICERALTKEYMASK, - NX_DEVICELALTKEYMASK); + modifierFlags = ensure_flag(modifierFlags, NX_CONTROLMASK, + NX_DEVICELCTLKEYMASK | NX_DEVICERCTLKEYMASK, + NX_DEVICELCTLKEYMASK); + modifierFlags = ensure_flag(modifierFlags, NX_SHIFTMASK, + NX_DEVICELSHIFTKEYMASK | NX_DEVICERSHIFTKEYMASK, + NX_DEVICELSHIFTKEYMASK); + modifierFlags = ensure_flag(modifierFlags, NX_COMMANDMASK, + NX_DEVICELCMDKEYMASK | NX_DEVICERCMDKEYMASK, + NX_DEVICELCMDKEYMASK); + modifierFlags = ensure_flag(modifierFlags, NX_ALTERNATEMASK, + NX_DEVICELALTKEYMASK | NX_DEVICERALTKEYMASK, + NX_DEVICELALTKEYMASK); #endif modifierFlags &= darwin_all_modifier_mask; @@ -1512,8 +1507,8 @@ handle_mouse: return; } - if ([e type] == NSTabletPoint || [e subtype] == - NSTabletPointEventSubtype) { + if ([e type] == NSTabletPoint || + [e subtype] == NSTabletPointEventSubtype) { pressure = [e pressure]; tilt = [e tilt]; @@ -1560,9 +1555,7 @@ handle_mouse: } DarwinSendPointerEvents(pDev, ev_type, ev_button, location.x, - location.y, - pressure, tilt.x, - tilt.y); + location.y, pressure, tilt.x, tilt.y); break; @@ -1602,9 +1595,8 @@ handle_mouse: if (!XQuartzServerVisible && noTestExtensions) { bgMouseLocationUpdated = FALSE; DarwinSendPointerEvents(darwinPointer, MotionNotify, 0, - location.x, - location.y, pressure, tilt.x, - tilt.y); + location.x, location.y, pressure, + tilt.x, tilt.y); } #endif #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 @@ -1636,7 +1628,7 @@ handle_mouse: if (darwinSyncKeymap) { #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 - TISInputSourceRef key_layout = + TISInputSourceRef key_layout = TISCopyCurrentKeyboardLayoutInputSource(); TISInputSourceRef clear; if (CFEqual(key_layout, last_key_layout)) { -- cgit v1.2.3