aboutsummaryrefslogtreecommitdiffhomepage
path: root/libvo/cocoa_common.m
diff options
context:
space:
mode:
authorGravatar Stefano Pigozzi <stefano.pigozzi@gmail.com>2012-02-03 23:50:44 +0100
committerGravatar Uoti Urpala <uau@mplayer2.org>2012-03-25 22:30:37 +0300
commit98d399e2f331a5f85d83fc68611eb2713f24c4ee (patch)
treecc41e62852fe758e54c70df8be221ff6fe047fdb /libvo/cocoa_common.m
parent09beba6e9ec2c59befdfb3b4df9d4683303de880 (diff)
cocoa_common: fix double click handling
The Cocoa framework generates only a NS*MouseDown event when handling the second click of a double click (no NS*MouseUp). If that's the case put mouse up key in mplayer2's fifo when dealing with the MouseDown Cocoa event.
Diffstat (limited to 'libvo/cocoa_common.m')
-rw-r--r--libvo/cocoa_common.m16
1 files changed, 8 insertions, 8 deletions
diff --git a/libvo/cocoa_common.m b/libvo/cocoa_common.m
index 36f5e2471f..007ecd1e02 100644
--- a/libvo/cocoa_common.m
+++ b/libvo/cocoa_common.m
@@ -486,23 +486,23 @@ void create_menu()
- (void) mouseEvent:(NSEvent *)theEvent
{
- if ( [theEvent buttonNumber] >= 0 && [theEvent buttonNumber] <= 9 )
- {
+ if ([theEvent buttonNumber] >= 0 && [theEvent buttonNumber] <= 9) {
int buttonNumber = [theEvent buttonNumber];
// Fix to mplayer defined button order: left, middle, right
- if (buttonNumber == 1)
- buttonNumber = 2;
- else if (buttonNumber == 2)
- buttonNumber = 1;
+ if (buttonNumber == 1) buttonNumber = 2;
+ else if (buttonNumber == 2) buttonNumber = 1;
switch ([theEvent type]) {
case NSLeftMouseDown:
- break;
case NSRightMouseDown:
case NSOtherMouseDown:
mplayer_put_key(l_vo->key_fifo, (MOUSE_BTN0 + buttonNumber) | MP_KEY_DOWN);
+ // Looks like Cocoa doesn't create MouseUp events when we are
+ // 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)
+ mplayer_put_key(l_vo->key_fifo, MOUSE_BTN0 + buttonNumber);
break;
case NSLeftMouseUp:
- break;
case NSRightMouseUp:
case NSOtherMouseUp:
mplayer_put_key(l_vo->key_fifo, MOUSE_BTN0 + buttonNumber);