From c286f2a718fdaf6ad10249b59abb20731da8d904 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Fri, 22 Aug 2008 01:11:33 -0700 Subject: [PATCH] XQuartz: Cleaned up mouse event translation a bit more. --- hw/xquartz/X11Application.m | 38 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index 359dbb10a..5e1e96b83 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -877,29 +877,25 @@ extern int darwin_modifier_flags; // darwinEvents.c 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; + 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; - 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 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;