[MPlayer-dev-eng] [PATCH] Use osx_common/convert_key in vo_corevideo.m
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Fri Aug 28 15:09:57 CEST 2009
Hello,
(and crap, I each time write vo_macosx until I remember it was renamed).
Well, anyway this uses the same function as vo_quartz.
The numbers are at least mostly the same (I might have overlooked
something, but I think it actually is 100% the same).
Only compilation was tested, especially "normal" keys and special keys
for which MPlayer has no mapping might need testing.
One "minor" disadvantage is that osx_common needs the Carbon framework
headers (note: the framework itself is _not_ needed, just the headers,
and even there only the HIToolbox, but I have not found a way to only
include HIToolbox/Events.h directly...).
-------------- next part --------------
Index: Makefile
===================================================================
--- Makefile (revision 29573)
+++ Makefile (working copy)
@@ -533,7 +533,7 @@
SRCS_MPLAYER-$(BL) += libvo/vo_bl.c
SRCS_MPLAYER-$(CACA) += libvo/vo_caca.c
SRCS_MPLAYER-$(COREAUDIO) += libao2/ao_coreaudio.c
-SRCS_MPLAYER-$(COREVIDEO) += libvo/vo_corevideo.m
+SRCS_MPLAYER-$(COREVIDEO) += libvo/vo_corevideo.m libvo/osx_common.c
SRCS_MPLAYER-$(DART) += libao2/ao_dart.c
SRCS_MPLAYER-$(DFBMGA) += libvo/vo_dfbmga.c
SRCS_MPLAYER-$(DGA) += libvo/vo_dga.c
Index: libvo/vo_corevideo.m
===================================================================
--- libvo/vo_corevideo.m (revision 29573)
+++ libvo/vo_corevideo.m (working copy)
@@ -47,6 +47,7 @@
#include "input/mouse.h"
#include "osdep/keycodes.h"
+#include "osx_common.h"
//Cocoa
NSDistantObject *mplayerosxProxy;
@@ -993,58 +994,8 @@
*/
- (void) keyDown: (NSEvent *) theEvent
{
- unsigned int key;
-
- switch([theEvent keyCode])
- {
- case 0x34:
- case 0x24: key = KEY_ENTER; break;
- case 0x35: key = KEY_ESC; break;
- case 0x33: key = KEY_BACKSPACE; break;
- case 0x3A: key = KEY_BACKSPACE; break;
- case 0x3B: key = KEY_BACKSPACE; break;
- case 0x38: key = KEY_BACKSPACE; break;
- case 0x7A: key = KEY_F+1; break;
- case 0x78: key = KEY_F+2; break;
- case 0x63: key = KEY_F+3; break;
- case 0x76: key = KEY_F+4; break;
- case 0x60: key = KEY_F+5; break;
- case 0x61: key = KEY_F+6; break;
- case 0x62: key = KEY_F+7; break;
- case 0x64: key = KEY_F+8; break;
- case 0x65: key = KEY_F+9; break;
- case 0x6D: key = KEY_F+10; break;
- case 0x67: key = KEY_F+11; break;
- case 0x6F: key = KEY_F+12; break;
- case 0x72: key = KEY_INSERT; break;
- case 0x75: key = KEY_DELETE; break;
- case 0x73: key = KEY_HOME; break;
- case 0x77: key = KEY_END; break;
- case 0x45: key = '+'; break;
- case 0x4E: key = '-'; break;
- case 0x30: key = KEY_TAB; break;
- case 0x74: key = KEY_PAGE_UP; break;
- case 0x79: key = KEY_PAGE_DOWN; break;
- case 0x7B: key = KEY_LEFT; break;
- case 0x7C: key = KEY_RIGHT; break;
- case 0x7D: key = KEY_DOWN; break;
- case 0x7E: key = KEY_UP; break;
- case 0x43: key = '*'; break;
- case 0x4B: key = '/'; break;
- case 0x4C: key = KEY_KPENTER; break;
- case 0x41: key = KEY_KPDEC; break;
- case 0x52: key = KEY_KP0; break;
- case 0x53: key = KEY_KP1; break;
- case 0x54: key = KEY_KP2; break;
- case 0x55: key = KEY_KP3; break;
- case 0x56: key = KEY_KP4; break;
- case 0x57: key = KEY_KP5; break;
- case 0x58: key = KEY_KP6; break;
- case 0x59: key = KEY_KP7; break;
- case 0x5B: key = KEY_KP8; break;
- case 0x5C: key = KEY_KP9; break;
- default: key = *[[theEvent characters] UTF8String]; break;
- }
+ int key = convert_key([theEvent keyCode], *[[theEvent characters] UTF8String]);
+ if (key != -1)
mplayer_put_key(key);
}
More information about the MPlayer-dev-eng
mailing list