summaryrefslogtreecommitdiffstats
path: root/video/out/cocoa_common.m
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-07-01 23:54:59 +0200
committerwm4 <wm4@nowhere>2013-07-02 12:19:16 +0200
commitc4766dc3c6233d3353b79fbd226202e7b8e3fc46 (patch)
treeed8f8b06e53d5130c3a290ac0eadf873eaf0a7ec /video/out/cocoa_common.m
parent2f8dcac28b64cecd537ab1fad366b2c2052c2ead (diff)
downloadmpv-c4766dc3c6233d3353b79fbd226202e7b8e3fc46.tar.bz2
mpv-c4766dc3c6233d3353b79fbd226202e7b8e3fc46.tar.xz
input: require VOs to send key up events, redo input key lookup
Making key up events implicit was sort-of a nice idea, but it's too tricky and unreliable and makes the key lookup code (interpret_keys()) hard to reason about. See e.g. previous commit for subtle bugs and issues this caused. Make key-up events explicit instead. Add key up events to all VOs. Any time MP_KEY_STATE_DOWN is used, the matching key up event must use MP_KEY_STATE_UP. Rewrite the key lookup code. It should be simpler and more robust now. (Even though the LOC increases, because the new code is less "compact".)
Diffstat (limited to 'video/out/cocoa_common.m')
-rw-r--r--video/out/cocoa_common.m4
1 files changed, 2 insertions, 2 deletions
diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m
index 84d8e29b86..dd166e03e1 100644
--- a/video/out/cocoa_common.m
+++ b/video/out/cocoa_common.m
@@ -893,14 +893,14 @@ int vo_cocoa_cgl_color_size(struct vo *vo)
// doing the second click in a double click. Put in the key_fifo
// the key that would be put from the MouseUp handling code.
if([theEvent clickCount] == 2) {
- cocoa_put_key(MP_MOUSE_BTN0 + buttonNumber);
+ cocoa_put_key((MP_MOUSE_BTN0 + buttonNumber) | MP_KEY_STATE_UP);
self.mouseDown = NO;
}
break;
case NSLeftMouseUp:
case NSRightMouseUp:
case NSOtherMouseUp:
- cocoa_put_key(MP_MOUSE_BTN0 + buttonNumber);
+ cocoa_put_key((MP_MOUSE_BTN0 + buttonNumber) | MP_KEY_STATE_UP);
self.mouseDown = NO;
break;
}