Remove invalid GTK accelerator keys
This commit is contained in:
parent
891053792f
commit
f3edad2761
110
src/gtk/menu.cpp
110
src/gtk/menu.cpp
@ -1041,30 +1041,11 @@ static wxString GetGtkHotKey( const wxMenuItem& item )
|
||||
int code = accel->GetKeyCode();
|
||||
switch ( code )
|
||||
{
|
||||
case WXK_F1:
|
||||
case WXK_F2:
|
||||
case WXK_F3:
|
||||
case WXK_F4:
|
||||
case WXK_F5:
|
||||
case WXK_F6:
|
||||
case WXK_F7:
|
||||
case WXK_F8:
|
||||
case WXK_F9:
|
||||
case WXK_F10:
|
||||
case WXK_F11:
|
||||
case WXK_F12:
|
||||
case WXK_F13:
|
||||
case WXK_F14:
|
||||
case WXK_F15:
|
||||
case WXK_F16:
|
||||
case WXK_F17:
|
||||
case WXK_F18:
|
||||
case WXK_F19:
|
||||
case WXK_F20:
|
||||
case WXK_F21:
|
||||
case WXK_F22:
|
||||
case WXK_F23:
|
||||
case WXK_F24:
|
||||
case WXK_F1: case WXK_F2: case WXK_F3: case WXK_F4: case WXK_F5:
|
||||
case WXK_F6: case WXK_F7: case WXK_F8: case WXK_F9: case WXK_F10:
|
||||
case WXK_F11: case WXK_F12: case WXK_F13: case WXK_F14: case WXK_F15:
|
||||
case WXK_F16: case WXK_F17: case WXK_F18: case WXK_F19: case WXK_F20:
|
||||
case WXK_F21: case WXK_F22: case WXK_F23: case WXK_F24:
|
||||
hotkey += wxString::Format(wxT("F%d"), code - WXK_F1 + 1);
|
||||
break;
|
||||
|
||||
@ -1107,9 +1088,6 @@ static wxString GetGtkHotKey( const wxMenuItem& item )
|
||||
case WXK_BACK:
|
||||
hotkey << wxT("BackSpace" );
|
||||
break;
|
||||
case WXK_TAB:
|
||||
hotkey << wxT("Tab" );
|
||||
break;
|
||||
case WXK_ESCAPE:
|
||||
hotkey << wxT("Escape" );
|
||||
break;
|
||||
@ -1119,21 +1097,6 @@ static wxString GetGtkHotKey( const wxMenuItem& item )
|
||||
case WXK_MULTIPLY:
|
||||
hotkey << wxT("multiply" );
|
||||
break;
|
||||
case WXK_ADD:
|
||||
hotkey << wxT("Add" );
|
||||
break;
|
||||
case WXK_SEPARATOR:
|
||||
hotkey << wxT("Separator" );
|
||||
break;
|
||||
case WXK_SUBTRACT:
|
||||
hotkey << wxT("Subtract" );
|
||||
break;
|
||||
case WXK_DECIMAL:
|
||||
hotkey << wxT("Decimal" );
|
||||
break;
|
||||
case WXK_DIVIDE:
|
||||
hotkey << wxT("Divide" );
|
||||
break;
|
||||
case WXK_CANCEL:
|
||||
hotkey << wxT("Cancel" );
|
||||
break;
|
||||
@ -1146,9 +1109,6 @@ static wxString GetGtkHotKey( const wxMenuItem& item )
|
||||
case WXK_PAUSE:
|
||||
hotkey << wxT("Pause" );
|
||||
break;
|
||||
case WXK_CAPITAL:
|
||||
hotkey << wxT("Capital" );
|
||||
break;
|
||||
case WXK_SELECT:
|
||||
hotkey << wxT("Select" );
|
||||
break;
|
||||
@ -1158,18 +1118,12 @@ static wxString GetGtkHotKey( const wxMenuItem& item )
|
||||
case WXK_EXECUTE:
|
||||
hotkey << wxT("Execute" );
|
||||
break;
|
||||
case WXK_SNAPSHOT:
|
||||
hotkey << wxT("Snapshot" );
|
||||
break;
|
||||
case WXK_HELP:
|
||||
hotkey << wxT("Help" );
|
||||
break;
|
||||
case WXK_NUMLOCK:
|
||||
hotkey << wxT("Num_Lock" );
|
||||
break;
|
||||
case WXK_SCROLL:
|
||||
hotkey << wxT("Scroll_Lock" );
|
||||
break;
|
||||
case WXK_NUMPAD_INSERT:
|
||||
hotkey << wxT("KP_Insert" );
|
||||
break;
|
||||
@ -1239,7 +1193,8 @@ static wxString GetGtkHotKey( const wxMenuItem& item )
|
||||
break;
|
||||
case WXK_NUMPAD0: case WXK_NUMPAD1: case WXK_NUMPAD2:
|
||||
case WXK_NUMPAD3: case WXK_NUMPAD4: case WXK_NUMPAD5:
|
||||
case WXK_NUMPAD6: case WXK_NUMPAD7: case WXK_NUMPAD8: case WXK_NUMPAD9:
|
||||
case WXK_NUMPAD6: case WXK_NUMPAD7: case WXK_NUMPAD8:
|
||||
case WXK_NUMPAD9:
|
||||
hotkey += wxString::Format(wxT("KP_%d"), code - WXK_NUMPAD0);
|
||||
break;
|
||||
case WXK_WINDOWS_LEFT:
|
||||
@ -1251,20 +1206,45 @@ static wxString GetGtkHotKey( const wxMenuItem& item )
|
||||
case WXK_WINDOWS_MENU:
|
||||
hotkey << wxT("Menu" );
|
||||
break;
|
||||
case WXK_COMMAND:
|
||||
hotkey << wxT("Command" );
|
||||
|
||||
/*
|
||||
The following keycodes have been shown not to work as accelerator
|
||||
keys on GTK (see https://trac.wxwidgets.org/ticket/10049)
|
||||
*/
|
||||
case WXK_COMMAND: // Same as WXK_CONTROL
|
||||
case WXK_SCROLL: // Scroll lock
|
||||
case WXK_CAPITAL: // Caps lock
|
||||
case WXK_TAB:
|
||||
case WXK_SHIFT:
|
||||
case WXK_ALT:
|
||||
|
||||
/*
|
||||
The following keycodes do not map clearly into a GTK keycode,
|
||||
so they are not included in the accelerator mapping:
|
||||
*/
|
||||
case WXK_ADD:
|
||||
case WXK_SEPARATOR:
|
||||
case WXK_SUBTRACT:
|
||||
case WXK_DECIMAL:
|
||||
case WXK_DIVIDE:
|
||||
case WXK_SNAPSHOT:
|
||||
|
||||
/*
|
||||
The following special codes do not map into GTK keycodes,
|
||||
see gdk/keynames.txt
|
||||
*/
|
||||
case WXK_SPECIAL1: case WXK_SPECIAL2: case WXK_SPECIAL3:
|
||||
case WXK_SPECIAL4: case WXK_SPECIAL5: case WXK_SPECIAL6:
|
||||
case WXK_SPECIAL7: case WXK_SPECIAL8: case WXK_SPECIAL9:
|
||||
case WXK_SPECIAL10: case WXK_SPECIAL11: case WXK_SPECIAL12:
|
||||
case WXK_SPECIAL13: case WXK_SPECIAL14: case WXK_SPECIAL15:
|
||||
case WXK_SPECIAL16: case WXK_SPECIAL17: case WXK_SPECIAL18:
|
||||
case WXK_SPECIAL19: case WXK_SPECIAL20:
|
||||
wxFAIL_MSG( wxT("Unsupported keyboard accelerator key") );
|
||||
break;
|
||||
/* These probably wouldn't work as there is no SpecialX in gdk/keynames.txt
|
||||
case WXK_SPECIAL1: case WXK_SPECIAL2: case WXK_SPECIAL3: case WXK_SPECIAL4:
|
||||
case WXK_SPECIAL5: case WXK_SPECIAL6: case WXK_SPECIAL7: case WXK_SPECIAL8:
|
||||
case WXK_SPECIAL9: case WXK_SPECIAL10: case WXK_SPECIAL11: case WXK_SPECIAL12:
|
||||
case WXK_SPECIAL13: case WXK_SPECIAL14: case WXK_SPECIAL15: case WXK_SPECIAL16:
|
||||
case WXK_SPECIAL17: case WXK_SPECIAL18: case WXK_SPECIAL19: case WXK_SPECIAL20:
|
||||
hotkey += wxString::Format(wxT("Special%d"), code - WXK_SPECIAL1 + 1);
|
||||
break;
|
||||
*/
|
||||
// if there are any other keys wxAcceleratorEntry::Create() may
|
||||
// return, we should process them here
|
||||
|
||||
// if there are any other keys wxAcceleratorEntry::Create() may
|
||||
// return, we should process them here
|
||||
|
||||
default:
|
||||
if ( code < 127 )
|
||||
|
@ -632,6 +632,10 @@ namespace
|
||||
{ wxACCEL_SHIFT, "Shift", false },
|
||||
{ wxACCEL_ALT, "Alt", false }
|
||||
};
|
||||
/*
|
||||
The keys marked as skip below are not supported as accelerator
|
||||
keys on GTK.
|
||||
*/
|
||||
std::vector<key> specialKeys =
|
||||
{
|
||||
{ WXK_F1, "WXK_F1", false },
|
||||
@ -670,7 +674,7 @@ namespace
|
||||
{ WXK_END, "WXK_END", false },
|
||||
{ WXK_RETURN, "WXK_RETURN", false },
|
||||
{ WXK_BACK, "WXK_BACK", false },
|
||||
{ WXK_TAB, "WXK_TAB", false },
|
||||
{ WXK_TAB, "WXK_TAB", true },
|
||||
{ WXK_ESCAPE, "WXK_ESCAPE", false },
|
||||
{ WXK_SPACE, "WXK_SPACE", false },
|
||||
{ WXK_MULTIPLY, "WXK_MULTIPLY", false },
|
||||
@ -690,7 +694,7 @@ namespace
|
||||
{ WXK_SNAPSHOT, "WXK_SNAPSHOT", true },
|
||||
{ WXK_HELP, "WXK_HELP", false },
|
||||
{ WXK_NUMLOCK, "WXK_NUMLOCK", false },
|
||||
{ WXK_SCROLL, "WXK_SCROLL", false },
|
||||
{ WXK_SCROLL, "WXK_SCROLL", true },
|
||||
{ WXK_NUMPAD_INSERT, "WXK_NUMPAD_INSERT", false },
|
||||
{ WXK_NUMPAD_DELETE, "WXK_NUMPAD_DELETE", false },
|
||||
{ WXK_NUMPAD_SPACE, "WXK_NUMPAD_SPACE", false },
|
||||
|
Loading…
Reference in New Issue
Block a user