x11: make all XF86 special keys mappable

Makes all keys documented in XF86keysym.h mappable. This requires the
user to deal with numeric keycodes; no names are queried or exported.

This is an easy way to avoid adding all the hundreds of XF86 keys to
our X11 lookup table and mpv's keycode/name list.

(cherry picked from commit 417869f845)
This commit is contained in:
wm4
2015-02-16 18:12:04 +09:00
committed by Diogo Franco (Kovensky)
parent e3064c3cb7
commit db218a8d25
2 changed files with 13 additions and 1 deletions
+6 -1
View File
@@ -210,8 +210,13 @@
#define MP_AXIS_LEFT (MP_AXIS_BASE+2)
#define MP_AXIS_RIGHT (MP_AXIS_BASE+3)
// Reserved area. Can be used for keys that have no explicit names assigned,
// but should be mappable by the user anyway.
#define MP_KEY_UNKNOWN_RESERVED_START (MP_KEY_BASE+0x10000)
#define MP_KEY_UNKNOWN_RESERVED_LAST (MP_KEY_BASE+0x20000-1)
/* Special keys */
#define MP_KEY_INTERN (MP_KEY_BASE+0x1000)
#define MP_KEY_INTERN (MP_KEY_BASE+0x20000)
#define MP_KEY_CLOSE_WIN (MP_KEY_INTERN+0)
// Generated by input.c (VOs use mp_input_set_mouse_pos())
#define MP_KEY_MOUSE_MOVE ((MP_KEY_INTERN+1)|MP_NO_REPEAT_KEY)
+7
View File
@@ -611,6 +611,13 @@ static int vo_x11_lookupkey(int key)
if (!mpkey)
mpkey = lookup_keymap_table(keymap, key);
// XFree86 keysym range; typically contains obscure "extra" keys
if (!mpkey && key >= 0x10080001 && key <= 0x1008FFFF) {
mpkey = MP_KEY_UNKNOWN_RESERVED_START + (key - 0x10080000);
if (mpkey > MP_KEY_UNKNOWN_RESERVED_LAST)
mpkey = 0;
}
return mpkey;
}