gtk2: keyboard macro update

This commit is contained in:
Gregory Hainaut 2014-12-07 23:01:51 +01:00
parent ba9e998ff5
commit d1389db2f4
2 changed files with 87 additions and 92 deletions

View File

@ -17,11 +17,6 @@
#include "ConsoleLogger.h"
#include <gdk/gdkkeysyms.h>
#if (GTK_MAJOR_VERSION > 2)
// All those GDK_<key> defines are now GDK_KEY_<key>, as of around Gtk+ 2.22. This include gets brought in automatically until Gtk 3.0,
// But we want to bring it in after that, too, until we're ready to break compatability prior to Gtk+ 2.22.
#include <gdk/gdkkeysyms-compat.h>
#endif
void NTFS_CompressFile( const wxString& file, bool compressStatus ) {}
@ -33,229 +28,229 @@ int TranslateGDKtoWXK( u32 keysym )
switch ( keysym )
{
// Shift, Control and Alt don't generate the CHAR events at all
case GDK_Shift_L:
case GDK_Shift_R:
case GDK_KEY_Shift_L:
case GDK_KEY_Shift_R:
key_code = WXK_SHIFT;
break;
case GDK_Control_L:
case GDK_Control_R:
case GDK_KEY_Control_L:
case GDK_KEY_Control_R:
key_code = WXK_CONTROL;
break;
case GDK_Meta_L:
case GDK_Meta_R:
case GDK_Alt_L:
case GDK_Alt_R:
case GDK_Super_L:
case GDK_Super_R:
case GDK_KEY_Meta_L:
case GDK_KEY_Meta_R:
case GDK_KEY_Alt_L:
case GDK_KEY_Alt_R:
case GDK_KEY_Super_L:
case GDK_KEY_Super_R:
key_code = WXK_ALT;
break;
// neither do the toggle modifies
case GDK_Scroll_Lock:
case GDK_KEY_Scroll_Lock:
key_code = WXK_SCROLL;
break;
case GDK_Caps_Lock:
case GDK_KEY_Caps_Lock:
key_code = WXK_CAPITAL;
break;
case GDK_Num_Lock:
case GDK_KEY_Num_Lock:
key_code = WXK_NUMLOCK;
break;
// various other special keys
case GDK_Menu:
case GDK_KEY_Menu:
key_code = WXK_MENU;
break;
case GDK_Help:
case GDK_KEY_Help:
key_code = WXK_HELP;
break;
case GDK_BackSpace:
case GDK_KEY_BackSpace:
key_code = WXK_BACK;
break;
case GDK_ISO_Left_Tab:
case GDK_Tab:
case GDK_KEY_ISO_Left_Tab:
case GDK_KEY_Tab:
key_code = WXK_TAB;
break;
case GDK_Linefeed:
case GDK_Return:
case GDK_KEY_Linefeed:
case GDK_KEY_Return:
key_code = WXK_RETURN;
break;
case GDK_Clear:
case GDK_KEY_Clear:
key_code = WXK_CLEAR;
break;
case GDK_Pause:
case GDK_KEY_Pause:
key_code = WXK_PAUSE;
break;
case GDK_Select:
case GDK_KEY_Select:
key_code = WXK_SELECT;
break;
case GDK_Print:
case GDK_KEY_Print:
key_code = WXK_PRINT;
break;
case GDK_Execute:
case GDK_KEY_Execute:
key_code = WXK_EXECUTE;
break;
case GDK_Escape:
case GDK_KEY_Escape:
key_code = WXK_ESCAPE;
break;
// cursor and other extended keyboard keys
case GDK_Delete:
case GDK_KEY_Delete:
key_code = WXK_DELETE;
break;
case GDK_Home:
case GDK_KEY_Home:
key_code = WXK_HOME;
break;
case GDK_Left:
case GDK_KEY_Left:
key_code = WXK_LEFT;
break;
case GDK_Up:
case GDK_KEY_Up:
key_code = WXK_UP;
break;
case GDK_Right:
case GDK_KEY_Right:
key_code = WXK_RIGHT;
break;
case GDK_Down:
case GDK_KEY_Down:
key_code = WXK_DOWN;
break;
case GDK_Prior: // == GDK_Page_Up
case GDK_KEY_Prior: // == GDK_KEY_Page_Up
key_code = WXK_PAGEUP;
break;
case GDK_Next: // == GDK_Page_Down
case GDK_KEY_Next: // == GDK_KEY_Page_Down
key_code = WXK_PAGEDOWN;
break;
case GDK_End:
case GDK_KEY_End:
key_code = WXK_END;
break;
case GDK_Begin:
case GDK_KEY_Begin:
key_code = WXK_HOME;
break;
case GDK_Insert:
case GDK_KEY_Insert:
key_code = WXK_INSERT;
break;
// numpad keys
case GDK_KP_0:
case GDK_KP_1:
case GDK_KP_2:
case GDK_KP_3:
case GDK_KP_4:
case GDK_KP_5:
case GDK_KP_6:
case GDK_KP_7:
case GDK_KP_8:
case GDK_KP_9:
key_code = WXK_NUMPAD0 + keysym - GDK_KP_0;
case GDK_KEY_KP_0:
case GDK_KEY_KP_1:
case GDK_KEY_KP_2:
case GDK_KEY_KP_3:
case GDK_KEY_KP_4:
case GDK_KEY_KP_5:
case GDK_KEY_KP_6:
case GDK_KEY_KP_7:
case GDK_KEY_KP_8:
case GDK_KEY_KP_9:
key_code = WXK_NUMPAD0 + keysym - GDK_KEY_KP_0;
break;
case GDK_KP_Space:
case GDK_KEY_KP_Space:
key_code = WXK_NUMPAD_SPACE;
break;
case GDK_KP_Tab:
case GDK_KEY_KP_Tab:
key_code = WXK_NUMPAD_TAB;
break;
case GDK_KP_Enter:
case GDK_KEY_KP_Enter:
key_code = WXK_NUMPAD_ENTER;
break;
case GDK_KP_F1:
case GDK_KEY_KP_F1:
key_code = WXK_NUMPAD_F1;
break;
case GDK_KP_F2:
case GDK_KEY_KP_F2:
key_code = WXK_NUMPAD_F2;
break;
case GDK_KP_F3:
case GDK_KEY_KP_F3:
key_code = WXK_NUMPAD_F3;
break;
case GDK_KP_F4:
case GDK_KEY_KP_F4:
key_code = WXK_NUMPAD_F4;
break;
case GDK_KP_Home:
case GDK_KEY_KP_Home:
key_code = WXK_NUMPAD_HOME;
break;
case GDK_KP_Left:
case GDK_KEY_KP_Left:
key_code = WXK_NUMPAD_LEFT;
break;
case GDK_KP_Up:
case GDK_KEY_KP_Up:
key_code = WXK_NUMPAD_UP;
break;
case GDK_KP_Right:
case GDK_KEY_KP_Right:
key_code = WXK_NUMPAD_RIGHT;
break;
case GDK_KP_Down:
case GDK_KEY_KP_Down:
key_code = WXK_NUMPAD_DOWN;
break;
case GDK_KP_Prior: // == GDK_KP_Page_Up
case GDK_KEY_KP_Prior: // == GDK_KEY_KP_Page_Up
key_code = WXK_NUMPAD_PAGEUP;
break;
case GDK_KP_Next: // == GDK_KP_Page_Down
case GDK_KEY_KP_Next: // == GDK_KEY_KP_Page_Down
key_code = WXK_NUMPAD_PAGEDOWN;
break;
case GDK_KP_End:
case GDK_KEY_KP_End:
key_code = WXK_NUMPAD_END;
break;
case GDK_KP_Begin:
case GDK_KEY_KP_Begin:
key_code = WXK_NUMPAD_BEGIN;
break;
case GDK_KP_Insert:
case GDK_KEY_KP_Insert:
key_code = WXK_NUMPAD_INSERT;
break;
case GDK_KP_Delete:
case GDK_KEY_KP_Delete:
key_code = WXK_NUMPAD_DELETE;
break;
case GDK_KP_Equal:
case GDK_KEY_KP_Equal:
key_code = WXK_NUMPAD_EQUAL;
break;
case GDK_KP_Multiply:
case GDK_KEY_KP_Multiply:
key_code = WXK_NUMPAD_MULTIPLY;
break;
case GDK_KP_Add:
case GDK_KEY_KP_Add:
key_code = WXK_NUMPAD_ADD;
break;
case GDK_KP_Separator:
case GDK_KEY_KP_Separator:
// FIXME: what is this?
//
// Some numeric keyboards have a comma on them. I believe this is the symbol
@ -264,33 +259,33 @@ int TranslateGDKtoWXK( u32 keysym )
key_code = WXK_NUMPAD_SEPARATOR;
break;
case GDK_KP_Subtract:
case GDK_KEY_KP_Subtract:
key_code = WXK_NUMPAD_SUBTRACT;
break;
case GDK_KP_Decimal:
case GDK_KEY_KP_Decimal:
key_code = WXK_NUMPAD_DECIMAL;
break;
case GDK_KP_Divide:
case GDK_KEY_KP_Divide:
key_code = WXK_NUMPAD_DIVIDE;
break;
// function keys
case GDK_F1:
case GDK_F2:
case GDK_F3:
case GDK_F4:
case GDK_F5:
case GDK_F6:
case GDK_F7:
case GDK_F8:
case GDK_F9:
case GDK_F10:
case GDK_F11:
case GDK_F12:
key_code = WXK_F1 + keysym - GDK_F1;
case GDK_KEY_F1:
case GDK_KEY_F2:
case GDK_KEY_F3:
case GDK_KEY_F4:
case GDK_KEY_F5:
case GDK_KEY_F6:
case GDK_KEY_F7:
case GDK_KEY_F8:
case GDK_KEY_F9:
case GDK_KEY_F10:
case GDK_KEY_F11:
case GDK_KEY_F12:
key_code = WXK_F1 + keysym - GDK_KEY_F1;
break;
default:

View File

@ -233,7 +233,7 @@ bool PollX11KeyboardMouseEvent(u32 &pkey)
if (ev != NULL)
{
if (ev->type == GDK_KEY_PRESS) {
pkey = ev->key.keyval != GDK_Escape ? ev->key.keyval : 0;
pkey = ev->key.keyval != GDK_KEY_Escape ? ev->key.keyval : 0;
return true;
} else if(ev->type == GDK_BUTTON_PRESS) {
pkey = ev->button.button;