[MPlayer-dev-eng] [PATCH] double click support on Mac OSX

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sat Aug 18 08:40:13 CEST 2007


Hello,
On Sat, Aug 18, 2007 at 08:09:36AM +0200, Reimar D?ffinger wrote:
> On Sat, Aug 18, 2007 at 11:56:05AM +0800, Ulion wrote:
> > I found vo driver on mac osx does not send all necessary mouse events,
> > that caused lack of support for double click events, here's the patch.
> > 
> > 1. send mouse down events correctly so mplayer can detect double click
> > correctly.
> > 2. send mouse up events, to release corresponding mouse down events.
> > 3. detect up to 10 buttons up and down events.
> 
> Ideally separate things should be done in separate patches (esp. the
> purely cosmetic renaming of the MouseEvent function into
> MouseDownEvent - couldn't you just add a parameter that decides between
> up and down?).
> But more importantly, you should use
> MOUSE_BTN0 + ...
> instead of
> MOUSE_BASE + ...

If it works (could not even test compilation), attached patch might be a
better way for 1. + 2.

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libvo/vo_macosx.m
===================================================================
--- libvo/vo_macosx.m	(revision 24059)
+++ libvo/vo_macosx.m	(working copy)
@@ -952,16 +952,31 @@
 	[self mouseEvent: theEvent];
 }
 
+- (void) mouseUp: (NSEvent *) theEvent
+{
+	[self mouseEvent: theEvent];
+}
+
 - (void) rightMouseDown: (NSEvent *) theEvent
 {
 	[self mouseEvent: theEvent];
 }
 
+- (void) rightMouseUp: (NSEvent *) theEvent
+{
+	[self mouseEvent: theEvent];
+}
+
 - (void) otherMouseDown: (NSEvent *) theEvent
 {
 	[self mouseEvent: theEvent];
 }
 
+- (void) otherMouseUp: (NSEvent *) theEvent
+{
+	[self mouseEvent: theEvent];
+}
+
 - (void) scrollWheel: (NSEvent *) theEvent
 {
 	if([theEvent deltaY] > 0)
@@ -972,11 +987,16 @@
 
 - (void) mouseEvent: (NSEvent *) theEvent
 {
+	int flags = 0;
+	if ([theEvent type] == NSLeftMouseDown ||
+	    [theEvent type] == NSRightMouseDown ||
+	    [theEvent type] == NSOtherMouseDown)
+		flags = MP_KEY_DOWN;
 	switch( [theEvent buttonNumber] )
 	{ 
-		case 0: mplayer_put_key(MOUSE_BTN0);break;
-		case 1: mplayer_put_key(MOUSE_BTN1);break;
-		case 2: mplayer_put_key(MOUSE_BTN2);break;
+		case 0: mplayer_put_key(MOUSE_BTN0 | flags);break;
+		case 1: mplayer_put_key(MOUSE_BTN1 | flags);break;
+		case 2: mplayer_put_key(MOUSE_BTN2 | flags);break;
 	}
 }
 


More information about the MPlayer-dev-eng mailing list