[MPlayer-cvslog] r25450 - in trunk/libvo: vo_macosx.m vo_quartz.c

ulion subversion at mplayerhq.hu
Tue Dec 18 15:48:31 CET 2007


Author: ulion
Date: Tue Dec 18 15:48:30 2007
New Revision: 25450

Log:
Fix mouse button mapping:
MOUSE_BTN1 is middle buttion, MOUSE_BTN2 is right button.


Modified:
   trunk/libvo/vo_macosx.m
   trunk/libvo/vo_quartz.c

Modified: trunk/libvo/vo_macosx.m
==============================================================================
--- trunk/libvo/vo_macosx.m	(original)
+++ trunk/libvo/vo_macosx.m	Tue Dec 18 15:48:30 2007
@@ -1048,17 +1048,23 @@ static int control(uint32_t request, voi
 {
 	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 == 1)
+			buttonNumber = 2;
 		switch([theEvent type])
 		{
 			case NSLeftMouseDown:
 			case NSRightMouseDown:
 			case NSOtherMouseDown:
-				mplayer_put_key((MOUSE_BTN0 + [theEvent buttonNumber]) | MP_KEY_DOWN);
+				mplayer_put_key((MOUSE_BTN0 + buttonNumber) | MP_KEY_DOWN);
 				break;
 			case NSLeftMouseUp:
 			case NSRightMouseUp:
 			case NSOtherMouseUp:
-				mplayer_put_key(MOUSE_BTN0 + [theEvent buttonNumber]);
+				mplayer_put_key(MOUSE_BTN0 + buttonNumber);
 				break;
 		}
 	}

Modified: trunk/libvo/vo_quartz.c
==============================================================================
--- trunk/libvo/vo_quartz.c	(original)
+++ trunk/libvo/vo_quartz.c	Tue Dec 18 15:48:30 2007
@@ -328,10 +328,10 @@ static OSStatus MouseEventHandler(EventH
 							mplayer_put_key(MOUSE_BTN0);
 							break;
 						case kEventMouseButtonSecondary:
-							mplayer_put_key(MOUSE_BTN1);
+							mplayer_put_key(MOUSE_BTN2);
 							break;
 						case kEventMouseButtonTertiary:
-							mplayer_put_key(MOUSE_BTN2);
+							mplayer_put_key(MOUSE_BTN1);
 							break;
 				
 						default:result = eventNotHandledErr;break;
@@ -358,10 +358,10 @@ static OSStatus MouseEventHandler(EventH
 							mplayer_put_key(MOUSE_BTN0 | MP_KEY_DOWN);
 							break;
 						case kEventMouseButtonSecondary:
-							mplayer_put_key(MOUSE_BTN1 | MP_KEY_DOWN);
+							mplayer_put_key(MOUSE_BTN2 | MP_KEY_DOWN);
 							break;
 						case kEventMouseButtonTertiary:
-							mplayer_put_key(MOUSE_BTN2 | MP_KEY_DOWN);
+							mplayer_put_key(MOUSE_BTN1 | MP_KEY_DOWN);
 							break;
 				
 						default:result = eventNotHandledErr;break;



More information about the MPlayer-cvslog mailing list