Mercurial > mplayer.hg
annotate libvo/osx_common.c @ 29531:6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
Also get rid of our own defines for the keycodes and instead use the
predefined ones from Carbon.
author | reimar |
---|---|
date | Fri, 28 Aug 2009 12:54:33 +0000 |
parents | |
children | 99b8d8d5c2d4 |
rev | line source |
---|---|
29531
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
1 // only to get keycode definitions from HIToolbox/Events.h |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
2 #include "config.h" |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
3 |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
4 #include <Carbon/Carbon.h> |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
5 #include "osx_common.h" |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
6 #include "video_out.h" |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
7 #include "osdep/keycodes.h" |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
8 |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
9 static const struct keymap keymap[] = { |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
10 // special keys |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
11 {0x34, KEY_ENTER}, // Enter key on some iBooks? |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
12 {kVK_Return, KEY_ENTER}, |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
13 {kVK_Escape, KEY_ESC}, |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
14 {kVK_Delete, KEY_BACKSPACE}, {kVK_Option, KEY_BACKSPACE}, {kVK_Control, KEY_BACKSPACE}, {kVK_Shift, KEY_BACKSPACE}, |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
15 {kVK_Tab, KEY_TAB}, |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
16 |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
17 // cursor keys |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
18 {kVK_UpArrow, KEY_UP}, {kVK_DownArrow, KEY_DOWN}, {kVK_LeftArrow, KEY_LEFT}, {kVK_RightArrow, KEY_RIGHT}, |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
19 |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
20 // navigation block |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
21 {kVK_Help, KEY_INSERT}, {kVK_ForwardDelete, KEY_DELETE}, {kVK_Home, KEY_HOME}, |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
22 {kVK_End, KEY_END}, {kVK_PageUp, KEY_PAGE_UP}, {kVK_PageUp, KEY_PAGE_DOWN}, |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
23 |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
24 // F-keys |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
25 {kVK_F1, KEY_F + 1}, {kVK_F2, KEY_F + 2}, {kVK_F3, KEY_F + 3}, {kVK_F4, KEY_F + 4}, |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
26 {kVK_F5, KEY_F + 5}, {kVK_F6, KEY_F + 6}, {kVK_F7, KEY_F + 7}, {kVK_F8, KEY_F + 8}, |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
27 {kVK_F9, KEY_F + 9}, {kVK_F10, KEY_F + 10}, {kVK_F11, KEY_F + 11}, {kVK_F12, KEY_F + 12}, |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
28 |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
29 // numpad |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
30 {kVK_ANSI_KeypadPlus, '+'}, {kVK_ANSI_KeypadMinus, '-'}, {kVK_ANSI_KeypadMultiply, '*'}, |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
31 {kVK_ANSI_KeypadDivide, '/'}, {kVK_ANSI_KeypadEnter, KEY_KPENTER}, {kVK_ANSI_KeypadDecimal, KEY_KPDEC}, |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
32 {kVK_ANSI_Keypad0, KEY_KP0}, {kVK_ANSI_Keypad1, KEY_KP1}, {kVK_ANSI_Keypad2, KEY_KP2}, {kVK_ANSI_Keypad3, KEY_KP3}, |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
33 {kVK_ANSI_Keypad4, KEY_KP4}, {kVK_ANSI_Keypad5, KEY_KP5}, {kVK_ANSI_Keypad6, KEY_KP6}, {kVK_ANSI_Keypad7, KEY_KP7}, |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
34 {kVK_ANSI_Keypad8, KEY_KP8}, {kVK_ANSI_Keypad9, KEY_KP9}, |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
35 |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
36 {0, 0} |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
37 }; |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
38 |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
39 int convert_key(unsigned key, unsigned charcode) |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
40 { |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
41 int mpkey = lookup_keymap_table(keymap, key); |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
42 if (mpkey) |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
43 return mpkey; |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
44 return charcode; |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
45 } |