wxKeyCode: add WXK_LAUNCH_[0-9A-F] for gtk bindings

X11 defines Xf86Launch[0-9a-f], which are then also defined as
GDK_KEY_Launch[0-9A-F].

Unfortunately, keys which are not mapped are just plain ignored and the
application is then not able to receive these keyboard events at all.

The original PR https://github.com/wxWidgets/wxWidgets/pull/157 mapped
only LaunchA/B to WXK_LAUNCH_APP1/2, this patch adds the whole range of
keys and keeps LAUNCH_A/B as aliases for WXK_LAUNCH_APP1/2
This commit is contained in:
Dominique Martinet 2021-11-01 16:10:00 +09:00
parent 9cc0c9a082
commit 61d835d8b3
4 changed files with 97 additions and 4 deletions

View File

@ -2434,7 +2434,25 @@ enum wxKeyCode
WXK_MEDIA_PLAY_PAUSE,
WXK_LAUNCH_MAIL,
WXK_LAUNCH_APP1,
WXK_LAUNCH_APP2
WXK_LAUNCH_APP2,
WXK_LAUNCH_0,
WXK_LAUNCH_1,
WXK_LAUNCH_2,
WXK_LAUNCH_3,
WXK_LAUNCH_4,
WXK_LAUNCH_5,
WXK_LAUNCH_6,
WXK_LAUNCH_7,
WXK_LAUNCH_8,
WXK_LAUNCH_9,
/* Alias for backwards compatibility with old gtk bindings,
* then continue from LAUNCH_9 */
WXK_LAUNCH_A = WXK_LAUNCH_APP1,
WXK_LAUNCH_B = WXK_LAUNCH_APP2,
WXK_LAUNCH_C = WXK_LAUNCH_9 + 1,
WXK_LAUNCH_D,
WXK_LAUNCH_E,
WXK_LAUNCH_F
};
/* This enum contains bit mask constants used in wxKeyEvent */

View File

@ -1080,7 +1080,25 @@ enum wxKeyCode
WXK_MEDIA_PLAY_PAUSE,
WXK_LAUNCH_MAIL,
WXK_LAUNCH_APP1,
WXK_LAUNCH_APP2
WXK_LAUNCH_APP2,
WXK_LAUNCH_0,
WXK_LAUNCH_1,
WXK_LAUNCH_2,
WXK_LAUNCH_3,
WXK_LAUNCH_4,
WXK_LAUNCH_5,
WXK_LAUNCH_6,
WXK_LAUNCH_7,
WXK_LAUNCH_8,
WXK_LAUNCH_9,
/* Alias for backwards compatibility with old gtk bindings,
* then continue from LAUNCH_9 */
WXK_LAUNCH_A = WXK_LAUNCH_APP1,
WXK_LAUNCH_B = WXK_LAUNCH_APP2,
WXK_LAUNCH_C = WXK_LAUNCH_9 + 1,
WXK_LAUNCH_D,
WXK_LAUNCH_E,
WXK_LAUNCH_F
};
/**

View File

@ -493,6 +493,21 @@ const char* GetVirtualKeyCodeName(int keycode)
WXK_(LAUNCH_MAIL)
WXK_(LAUNCH_APP1)
WXK_(LAUNCH_APP2)
WXK_(LAUNCH_0)
WXK_(LAUNCH_1)
WXK_(LAUNCH_2)
WXK_(LAUNCH_3)
WXK_(LAUNCH_4)
WXK_(LAUNCH_5)
WXK_(LAUNCH_6)
WXK_(LAUNCH_7)
WXK_(LAUNCH_8)
WXK_(LAUNCH_9)
// skip A/B which are duplicate cases of APP1/2
WXK_(LAUNCH_C)
WXK_(LAUNCH_D)
WXK_(LAUNCH_E)
WXK_(LAUNCH_F)
#undef WXK_
default:

View File

@ -870,11 +870,53 @@ static long wxTranslateKeySymToWXKey(KeySym keysym, bool isChar)
case GDK_KEY_Mail:
key_code = WXK_LAUNCH_MAIL;
break;
case GDK_KEY_Launch0:
key_code = WXK_LAUNCH_0;
break;
case GDK_KEY_Launch1:
key_code = WXK_LAUNCH_1;
break;
case GDK_KEY_Launch2:
key_code = WXK_LAUNCH_2;
break;
case GDK_KEY_Launch3:
key_code = WXK_LAUNCH_3;
break;
case GDK_KEY_Launch4:
key_code = WXK_LAUNCH_4;
break;
case GDK_KEY_Launch5:
key_code = WXK_LAUNCH_5;
break;
case GDK_KEY_Launch6:
key_code = WXK_LAUNCH_6;
break;
case GDK_KEY_Launch7:
key_code = WXK_LAUNCH_7;
break;
case GDK_KEY_Launch8:
key_code = WXK_LAUNCH_8;
break;
case GDK_KEY_Launch9:
key_code = WXK_LAUNCH_9;
break;
case GDK_KEY_LaunchA:
key_code = WXK_LAUNCH_APP1;
key_code = WXK_LAUNCH_A;
break;
case GDK_KEY_LaunchB:
key_code = WXK_LAUNCH_APP2;
key_code = WXK_LAUNCH_B;
break;
case GDK_KEY_LaunchC:
key_code = WXK_LAUNCH_C;
break;
case GDK_KEY_LaunchD:
key_code = WXK_LAUNCH_D;
break;
case GDK_KEY_LaunchE:
key_code = WXK_LAUNCH_E;
break;
case GDK_KEY_LaunchF:
key_code = WXK_LAUNCH_F;
break;
#endif // GTK_CHECK_VERSION(2,18,0)