diff options
author | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-08-22 01:11:33 -0700 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-08-26 20:19:38 -0700 |
commit | ac936525afe46bad329387232f8d48e77f6a4175 (patch) | |
tree | 63bf20e2f6f8c441a3bc9a64393cfbda8222500c | |
parent | 1b42f550001c11c93d5a2144df98a5c687c010c2 (diff) |
XQuartz: Cleaned up mouse event translation a bit more.
(cherry picked from commit c286f2a718fdaf6ad10249b59abb20731da8d904)
-rw-r--r-- | hw/xquartz/X11Application.m | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index b53f733c7..135fac3d1 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -895,29 +895,25 @@ static void send_nsevent(NSEvent *e) { 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; - - 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 + 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; + 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; |