diff options
author | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-08-20 09:56:06 -0700 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-08-20 10:00:20 -0700 |
commit | be06961312e2111778bfd97b2c8a927acc61f43d (patch) | |
tree | 9f0f0617aa02d51b353b2909fb155315ddc6f0b6 /hw/xquartz/X11Application.m | |
parent | 436b659091dd17bb3e316377ba31f5d2a5dfa12e (diff) |
XQuartz: More input fixes
stuck-modifier fixes (capslock)
3button-emulation now doesn't send the modifier key with the click
Added other options to fake_button2 and fake_button3 defaults options:
({l,r}{control,alt,command,shift})
(cherry picked from commit 8fb6a1cf44c35a20dfb0c05c9824f94898f88da7)
(cherry picked from commit ae9c1b3cfb3874b4d1251681c24bda91c398bcab)
Diffstat (limited to 'hw/xquartz/X11Application.m')
-rw-r--r-- | hw/xquartz/X11Application.m | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index 5a1f0e835..5ba22dbb0 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -833,6 +833,8 @@ convert_flags (unsigned int nsflags) { return xflags; } +extern int darwin_modifier_flags; // darwinEvents.c + static void send_nsevent (NSEventType type, NSEvent *e) { NSRect screen; NSPoint location; @@ -859,26 +861,34 @@ static void send_nsevent (NSEventType type, NSEvent *e) { tilt_x = 0; tilt_y = 0; + /* We don't receive modifier key events while out of focus, and 3button + * emulation mucks this up, so we need to check our modifier flag state + * on every event... ugg + */ + if(darwin_modifier_flags != [e modifierFlags]) + DarwinUpdateModKeys([e modifierFlags]); + switch (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 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: - pressure = [e pressure]; - tilt_x = [e tilt].x; - tilt_y = [e tilt].y; + pressure = [e pressure]; + tilt_x = [e tilt].x; + tilt_y = [e tilt].y; goto handle_mouse; // fall through to normal mouse handling @@ -901,9 +911,6 @@ handle_mouse: DarwinSendKeyboardEvents((type == NSKeyDown)?KeyPress:KeyRelease, [e keyCode]); break; - case NSFlagsChanged: - DarwinUpdateModKeys([e modifierFlags]); - break; - default: break; /* for gcc */ + default: break; /* for gcc */ } } |