Mercurial > mplayer.hg
changeset 29533:9c8f8e375823
Reuse the osx_common convert_key function to convert OSX keycodes to MPlayer
keycodes instead of its own switch-case in vo_corevideo.m
author | reimar |
---|---|
date | Fri, 28 Aug 2009 13:29:07 +0000 |
parents | 99b8d8d5c2d4 |
children | 01715e52db6e |
files | Makefile libvo/vo_corevideo.m |
diffstat | 2 files changed, 4 insertions(+), 53 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Fri Aug 28 13:25:30 2009 +0000 +++ b/Makefile Fri Aug 28 13:29:07 2009 +0000 @@ -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
--- a/libvo/vo_corevideo.m Fri Aug 28 13:25:30 2009 +0000 +++ b/libvo/vo_corevideo.m Fri Aug 28 13:29:07 2009 +0000 @@ -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); }