XQuartz: Cleaned up mouse event translation a bit more.

(cherry picked from commit c286f2a718)
This commit is contained in:
Jeremy Huddleston 2008-08-22 01:11:33 -07:00
parent 1b42f55000
commit ac936525af

View File

@ -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;
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;