From 19702c5a40b368d9d39834a373f4745782de16e3 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 28 Jan 2017 15:41:45 +0000 Subject: Proposed fix for [499526180d]: Add support for windows multimedia virtual keys. Patch by ralfixx --- generic/ks_names.h | 7 +++++++ win/tkWinKey.c | 11 +++++++++-- xlib/X11/keysymdef.h | 12 ++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/generic/ks_names.h b/generic/ks_names.h index 22d9fc5..b939a51 100644 --- a/generic/ks_names.h +++ b/generic/ks_names.h @@ -920,3 +920,10 @@ { "hebrew_shin", 0xcf9 }, { "hebrew_taf", 0xcfa }, { "Hebrew_switch", 0xFF7E }, +{ "XF86AudioLowerVolume", 0x1008FF11 }, +{ "XF86AudioMute", 0x1008FF12 }, +{ "XF86AudioRaiseVolume", 0x1008FF13 }, +{ "XF86AudioPlay", 0x1008FF14 }, +{ "XF86AudioStop", 0x1008FF15 }, +{ "XF86AudioPrev", 0x1008FF16 }, +{ "XF86AudioNext", 0x1008FF17 }, diff --git a/win/tkWinKey.c b/win/tkWinKey.c index 1ebf312..357a804 100644 --- a/win/tkWinKey.c +++ b/win/tkWinKey.c @@ -21,7 +21,8 @@ * like a worthwhile improvement to use the table. */ -#define MAX_KEYCODE 145 /* VK_SCROLL is the last entry in our table below */ +#define MAX_KEYCODE 179 /* VK_MEDIA_PLAY_PAUSE is the last entry in our table below */ +/* cf. https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx */ static const KeySym keymap[] = { NoSymbol, NoSymbol, NoSymbol, XK_Cancel, NoSymbol, @@ -53,7 +54,13 @@ static const KeySym keymap[] = { XK_F19, XK_F20, XK_F21, XK_F22, XK_F23, XK_F24, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, XK_Num_Lock, - XK_Scroll_Lock + XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*150 0x96*/ + NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*155 0x9b*/ + NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*160 0xa0*/ + NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*165 0xa5*/ + NoSymbol, NoSymbol, NoSymbol, XK_XF86AudioMute, XK_XF86AudioLowerVolume, /*170 0xaa*/ + XK_XF86AudioRaiseVolume, XK_XF86AudioNext, XK_XF86AudioPrev, XK_XF86AudioStop, XK_XF86AudioPlay /*175 0xaf*/ }; /* diff --git a/xlib/X11/keysymdef.h b/xlib/X11/keysymdef.h index b22d41b..a7c654d 100644 --- a/xlib/X11/keysymdef.h +++ b/xlib/X11/keysymdef.h @@ -1167,3 +1167,15 @@ SOFTWARE. #define XK_Hebrew_switch 0xFF7E /* Alias for mode_switch */ #endif /* XK_HEBREW */ +/* Multimedia keys, defined same as on Linux + * /usr/include/pkg/libxkbcommon/xkbcommon/xkbcommon-keysyms.h + */ + +#define XK_XF86AudioLowerVolume 0x1008FF11 /* Volume control down */ +#define XK_XF86AudioMute 0x1008FF12 /* Mute sound from the system */ +#define XK_XF86AudioRaiseVolume 0x1008FF13 /* Volume control up */ +#define XK_XF86AudioPlay 0x1008FF14 /* Start playing of audio > */ +#define XK_XF86AudioStop 0x1008FF15 /* Stop playing audio */ +#define XK_XF86AudioPrev 0x1008FF16 /* Previous track */ +#define XK_XF86AudioNext 0x1008FF17 /* Next track */ + -- cgit v0.12 From c39e643b30e956481203d8f38e1a396230368a57 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 29 Jan 2017 15:01:36 +0000 Subject: Remove obsolete (and currently wrong) comment in generic/ks_names.h --- generic/ks_names.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/generic/ks_names.h b/generic/ks_names.h index b939a51..af73d3b 100644 --- a/generic/ks_names.h +++ b/generic/ks_names.h @@ -1,6 +1,3 @@ -/* - * This file is generated from $(INCLUDESRC)/keysymdef.h. Do not edit. - */ { "BackSpace", 0xFF08 }, { "Tab", 0xFF09 }, { "Linefeed", 0xFF0A }, -- cgit v0.12 From f802dd59b9fdec91f7178bfb7bcaa2ab2818739c Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 29 Jan 2017 17:11:28 +0000 Subject: Add comment explaining that ks_names.h should be kept in sync with keysymdef.h, and explain why this needs to be done manually. --- generic/ks_names.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/generic/ks_names.h b/generic/ks_names.h index af73d3b..9f49130 100644 --- a/generic/ks_names.h +++ b/generic/ks_names.h @@ -1,3 +1,16 @@ +/* + * This file should be maintained in sync with xlib/X11/keysymdefs.h + * + * Note that this should be done manually only, because in some cases + * keysymdefs.h defines the same integer for multiple keysyms, e.g.: + * + * #define XK_Greek_LAMDA 0x7cb + * #define XK_Greek_LAMBDA 0x7cb + * + * #define XK_Cyrillic_DZHE 0x6bf + * #define XK_Serbian_DZE 0x6bf (deprecated) + * + */ { "BackSpace", 0xFF08 }, { "Tab", 0xFF09 }, { "Linefeed", 0xFF0A }, -- cgit v0.12 From 62ab7985dd7a7e82173c18ca3ff19ba49f152ed8 Mon Sep 17 00:00:00 2001 From: fvogel Date: Mon, 6 Mar 2017 23:23:11 +0000 Subject: Added documentation for the new keysyms --- doc/keysyms.n | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/keysyms.n b/doc/keysyms.n index bf81440..84214ff 100644 --- a/doc/keysyms.n +++ b/doc/keysyms.n @@ -918,6 +918,13 @@ Super_R 65516 0xffec Hyper_L 65517 0xffed Hyper_R 65518 0xffee Delete 65535 0xffff +XF86AudioLowerVolume 269025041 0x1008FF11 +XF86AudioMute 269025042 0x1008FF12 +XF86AudioRaiseVolume 269025043 0x1008FF13 +XF86AudioPlay 269025044 0x1008FF14 +XF86AudioStop 269025045 0x1008FF15 +XF86AudioPrev 269025046 0x1008FF16 +XF86AudioNext 269025047 0x1008FF17 .CE .SH "SEE ALSO" bind(n), event(n) -- cgit v0.12 From 046813684f5fcdd4764db7fc53922266d6eb1586 Mon Sep 17 00:00:00 2001 From: avl Date: Tue, 14 Mar 2017 01:13:36 +0000 Subject: added a remark about some keysyms being valid across platforms... --- doc/keysyms.n | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/keysyms.n b/doc/keysyms.n index 84214ff..512c1a6 100644 --- a/doc/keysyms.n +++ b/doc/keysyms.n @@ -15,7 +15,9 @@ Tk recognizes many keysyms when specifying key bindings (e.g., .QW "\fBbind\fR \fB. \fR" ). The following list enumerates the keysyms that will be recognized by Tk. Note that not all keysyms will -be valid on all platforms. For example, on Unix systems, the presence +be valid on all platforms, and some keysyms are also available on +platforms that have a different native name for that key. +For example, on Unix systems, the presence of a particular keysym is dependant on the configuration of the keyboard modifier map. This list shows keysyms along with their decimal and hexadecimal values. -- cgit v0.12