Allow translating keys to current keyboard layout.

UI is not refreshed at layout change yet.
This commit is contained in:
Alex Shvartzkop 2024-04-09 19:30:50 +03:00
parent 002503d9bd
commit a679901803
14 changed files with 174 additions and 54 deletions

View File

@ -143,15 +143,15 @@ APPEARANCE_CONTROLS_3D::APPEARANCE_CONTROLS_3D( EDA_3D_VIEWER_FRAME* aParent,
"Use %s+Tab to activate selector.\n"
"Successive Tabs while holding %s down will "
"cycle through presets in the popup." ),
KeyNameFromKeyCode( PRESET_SWITCH_KEY ),
KeyNameFromKeyCode( PRESET_SWITCH_KEY ) ) );
KeyNameFromKeyCode( PRESET_SWITCH_KEY, true ),
KeyNameFromKeyCode( PRESET_SWITCH_KEY, true ) ) );
m_cbViewports->SetToolTip( wxString::Format( _( "Save and restore camera position and zoom.\n"
"Use %s+Tab to activate selector.\n"
"Successive Tabs while holding %s down will "
"cycle through viewports in the popup." ),
KeyNameFromKeyCode( VIEWPORT_SWITCH_KEY ),
KeyNameFromKeyCode( VIEWPORT_SWITCH_KEY ) ) );
KeyNameFromKeyCode( VIEWPORT_SWITCH_KEY, true ),
KeyNameFromKeyCode( VIEWPORT_SWITCH_KEY, true ) ) );
if( screenHeight <= 900 && m_pointSize >= indicatorSize )
m_pointSize = m_pointSize * 8 / 10;
@ -605,7 +605,7 @@ void APPEARANCE_CONTROLS_3D::UpdateLayerCtls()
void APPEARANCE_CONTROLS_3D::rebuildLayerPresetsWidget()
{
m_presetsLabel->SetLabel( wxString::Format( _( "Presets (%s+Tab):" ),
KeyNameFromKeyCode( PRESET_SWITCH_KEY ) ) );
KeyNameFromKeyCode( PRESET_SWITCH_KEY, true ) ) );
m_cbLayerPresets->Clear();
@ -836,7 +836,7 @@ void APPEARANCE_CONTROLS_3D::doApplyLayerPreset( const LAYER_PRESET_3D& aPreset
void APPEARANCE_CONTROLS_3D::rebuildViewportsWidget()
{
m_viewportsLabel->SetLabel( wxString::Format( _( "Viewports (%s+Tab):" ),
KeyNameFromKeyCode( VIEWPORT_SWITCH_KEY ) ) );
KeyNameFromKeyCode( VIEWPORT_SWITCH_KEY, true ) ) );
m_cbViewports->Clear();

View File

@ -87,8 +87,8 @@ PANEL_GRID_SETTINGS::PANEL_GRID_SETTINGS( wxWindow* aParent, UNITS_PROVIDER* aUn
int hk1 = ACTIONS::gridFast1.GetHotKey();
int hk2 = ACTIONS::gridFast2.GetHotKey();
m_grid1HotKey->SetLabel( wxString::Format( wxT( "(%s)" ), KeyNameFromKeyCode( hk1 ) ) );
m_grid2HotKey->SetLabel( wxString::Format( wxT( "(%s)" ), KeyNameFromKeyCode( hk2 ) ) );
m_grid1HotKey->SetLabel( wxString::Format( wxT( "(%s)" ), KeyNameFromKeyCode( hk1, true ) ) );
m_grid2HotKey->SetLabel( wxString::Format( wxT( "(%s)" ), KeyNameFromKeyCode( hk2, true ) ) );
m_addGridButton->SetBitmap( KiBitmapBundle( BITMAPS::small_plus ) );
m_removeGridButton->SetBitmap( KiBitmapBundle( BITMAPS::small_trash ) );

View File

@ -259,8 +259,8 @@ void PANEL_HOTKEYS_EDITOR::dumpHotkeys()
if( hk.m_EditKeycode > 0 )
{
stream << wxT( " | kbd:[" ) << KeyNameFromKeyCode( hk.m_EditKeycode ) << ']'
<< endl;
stream << wxT( " | kbd:[" ) << KeyNameFromKeyCode( hk.m_EditKeycode, false ) << ']'
<< endl; // TODO: localized or not?
}
else
{

View File

@ -169,10 +169,11 @@ static struct hotkey_name_descr hotkeyNameList[] =
* Only some wxWidgets key values are handled for function key ( see hotkeyNameList[] )
*
* @param aKeycode key code (ASCII value, or wxWidgets value for function keys).
* @param aLocalized set to true to translate the key using current keyboard layout instead of US layout.
* @param aIsFound a pointer to a bool to return true if found, or false. an be nullptr default).
* @return the key name in a wxString.
*/
wxString KeyNameFromKeyCode( int aKeycode, bool* aIsFound )
wxString KeyNameFromKeyCode( int aKeycode, bool aLocalized, bool* aIsFound )
{
wxString keyname, modifier, fullkeyname;
int ii;
@ -199,10 +200,26 @@ wxString KeyNameFromKeyCode( int aKeycode, bool* aIsFound )
aKeycode &= ~( MD_CTRL | MD_ALT | MD_SHIFT );
if( (aKeycode > ' ') && (aKeycode < 0x7F ) )
if( ( aKeycode > ' ' ) && ( aKeycode < 0x7F ) )
{
found = true;
keyname.Append( (wxChar)aKeycode );
if( aLocalized )
{
GeckoKeys::CodeNameIndex idx = GeckoKeys::CodeNameIndexFromWXK( aKeycode );
uint32_t scancode = GeckoKeys::ScancodeFromCodeNameIndex( idx );
wchar_t ch = GeckoKeys::CharFromScancode( scancode );
if( ch )
{
found = true;
keyname.Append( ch );
}
}
if( !found )
{
found = true;
keyname.Append( (wxChar) aKeycode );
}
}
else
{
@ -240,7 +257,7 @@ wxString KeyNameFromKeyCode( int aKeycode, bool* aIsFound )
wxString AddHotkeyName( const wxString& aText, int aHotKey, HOTKEY_ACTION_TYPE aStyle )
{
wxString msg = aText;
wxString keyname = KeyNameFromKeyCode( aHotKey );
wxString keyname = KeyNameFromKeyCode( aHotKey, true );
if( !keyname.IsEmpty() )
{
@ -429,9 +446,10 @@ int WriteHotKeyConfig( const std::vector<TOOL_ACTION*>& aActions )
wxTextOutputStream txtStream( outStream, wxEOL_UNIX );
for( const std::pair<const std::string, std::pair<int, int>>& entry : hotkeys )
txtStream << entry.first
<< "\t" << KeyNameFromKeyCode( entry.second.first )
<< "\t" << KeyNameFromKeyCode( entry.second.second ) << endl;
{
txtStream << entry.first << "\t" << KeyNameFromKeyCode( entry.second.first, false ) << "\t"
<< KeyNameFromKeyCode( entry.second.second, false ) << endl;
}
txtStream.Flush();
outStream.Close();

View File

@ -144,8 +144,8 @@ bool ACTION_MANAGER::RunHotKey( int aHotKey ) const
if( key >= 'a' && key <= 'z' )
key = std::toupper( key );
wxLogTrace( kicadTraceToolStack, wxS( "ACTION_MANAGER::RunHotKey Key: %s" ),
KeyNameFromKeyCode( aHotKey ) );
wxLogTrace( kicadTraceToolStack, wxS( "ACTION_MANAGER::RunHotKey Key: %s, Translated: %s" ),
KeyNameFromKeyCode( aHotKey, false ), KeyNameFromKeyCode( aHotKey, true ) );
HOTKEY_LIST::const_iterator it = m_actionHotKeys.find( key | mod );
@ -156,8 +156,9 @@ bool ACTION_MANAGER::RunHotKey( int aHotKey ) const
if( it == m_actionHotKeys.end() )
{
wxLogTrace( kicadTraceToolStack,
wxS( "ACTION_MANAGER::RunHotKey No actions found, searching with key: %s" ),
KeyNameFromKeyCode( key | ( mod & ~MD_SHIFT ) ) );
wxS( "ACTION_MANAGER::RunHotKey No actions found, searching with key: %s, translated: %s" ),
KeyNameFromKeyCode( key | ( mod & ~MD_SHIFT ), false ),
KeyNameFromKeyCode( key | ( mod & ~MD_SHIFT ), true ) );
it = m_actionHotKeys.find( key | ( mod & ~MD_SHIFT ) );
@ -210,10 +211,11 @@ bool ACTION_MANAGER::RunHotKey( int aHotKey ) const
runAction = aCond->enableCondition( sel );
wxLogTrace( kicadTraceToolStack,
wxS( "ACTION_MANAGER::RunHotKey %s context action: %s for hotkey %s" ),
wxS( "ACTION_MANAGER::RunHotKey %s context action: %s for hotkey %s, translated %s" ),
runAction ? wxS( "Running" ) : wxS( "Not running" ),
context->GetName(),
KeyNameFromKeyCode( aHotKey ) );
KeyNameFromKeyCode( aHotKey, false ),
KeyNameFromKeyCode( aHotKey, true ) );
if( runAction )
return m_toolMgr->RunAction( *context );
@ -228,10 +230,11 @@ bool ACTION_MANAGER::RunHotKey( int aHotKey ) const
runAction = aCond->enableCondition( sel );
wxLogTrace( kicadTraceToolStack,
wxS( "ACTION_MANAGER::RunHotKey %s global action: %s for hotkey %s" ),
wxS( "ACTION_MANAGER::RunHotKey %s global action: %s for hotkey %s, translated %s" ),
runAction ? wxS( "Running" ) : wxS( "Not running" ),
act->GetName(),
KeyNameFromKeyCode( aHotKey ) );
KeyNameFromKeyCode( aHotKey, false ),
KeyNameFromKeyCode( aHotKey, true ) );
if( runAction && m_toolMgr->RunAction( *act ) )
return true;
@ -239,8 +242,9 @@ bool ACTION_MANAGER::RunHotKey( int aHotKey ) const
}
wxLogTrace( kicadTraceToolStack,
wxS( "ACTION_MANAGER::RunHotKey No action found for key %s" ),
KeyNameFromKeyCode( aHotKey ) );
wxS( "ACTION_MANAGER::RunHotKey No action found for key %s, translated %s" ),
KeyNameFromKeyCode( aHotKey, false ),
KeyNameFromKeyCode( aHotKey, true ) );
return false;
}

View File

@ -177,7 +177,7 @@ wxString TOOL_ACTION::GetTooltip( bool aIncludeHotkey ) const
wxString tooltip = wxGetTranslation( m_tooltip );
if( aIncludeHotkey && GetHotKey() )
tooltip += wxString::Format( wxT( " (%s)" ), KeyNameFromKeyCode( GetHotKey() ) );
tooltip += wxString::Format( wxT( " (%s)" ), KeyNameFromKeyCode( GetHotKey(), true ) );
return tooltip;
}
@ -189,7 +189,7 @@ wxString TOOL_ACTION::GetButtonTooltip() const
wxString tooltip = GetFriendlyName();
if( GetHotKey() )
tooltip += wxString::Format( wxT( " (%s)" ), KeyNameFromKeyCode( GetHotKey() ) );
tooltip += wxString::Format( wxT( " (%s)" ), KeyNameFromKeyCode( GetHotKey(), true ) );
if( !GetTooltip( false ).IsEmpty() )
tooltip += '\n' + GetTooltip( false );

View File

@ -202,7 +202,7 @@ protected:
if( keycode == WXK_NONE )
return;
m_key_label_1->SetLabel( KeyNameFromKeyCode( keycode ) );
m_key_label_1->SetLabel( KeyNameFromKeyCode( keycode, true ) );
m_event = aEvent;
}
@ -257,7 +257,7 @@ public:
if( normedInfo.Contains( m_normalised_filter_str ) )
return true;
const wxString keyName = KeyNameFromKeyCode( aHotkey.m_EditKeycode );
const wxString keyName = KeyNameFromKeyCode( aHotkey.m_EditKeycode, true );
if( keyName.Upper().Contains( m_normalised_filter_str ) )
return true;
@ -307,8 +307,8 @@ void WIDGET_HOTKEY_LIST::updateFromClientData()
{
const HOTKEY& changed_hk = hkdata->GetChangedHotkey();
wxString label = changed_hk.m_Actions[ 0 ]->GetFriendlyName();
wxString key_text = KeyNameFromKeyCode( changed_hk.m_EditKeycode );
wxString alt_text = KeyNameFromKeyCode( changed_hk.m_EditKeycodeAlt );
wxString key_text = KeyNameFromKeyCode( changed_hk.m_EditKeycode, true );
wxString alt_text = KeyNameFromKeyCode( changed_hk.m_EditKeycodeAlt, true );
wxString description = changed_hk.m_Actions[ 0 ]->GetDescription();
if( label.IsEmpty() )
@ -479,7 +479,7 @@ bool WIDGET_HOTKEY_LIST::resolveKeyConflicts( TOOL_ACTION* aAction, long aKey )
TOOL_ACTION* conflictingAction = conflictingHotKey->m_Actions[ 0 ];
wxString msg = wxString::Format( _( "'%s' is already assigned to '%s' in section '%s'. "
"Are you sure you want to change its assignment?" ),
KeyNameFromKeyCode( aKey ),
KeyNameFromKeyCode( aKey, true ),
conflictingAction->GetFriendlyName(),
HOTKEY_STORE::GetSectionName( conflictingAction ) );

View File

@ -60,9 +60,10 @@ int KeyCodeFromKeyName( const wxString& keyname );
* Return the user friendly key name (ie: "Ctrl+M") from the key code.
*
* @param aKeycode key code (ASCII value, or wxWidgets value for function keys).
* @param aLocalized set to true to translate the key using current keyboard layout instead of US layout.
* @param aIsFound a pointer to a bool to return true if found, or false.
*/
wxString KeyNameFromKeyCode( int aKeycode, bool* aIsFound = nullptr );
wxString KeyNameFromKeyCode( int aKeycode, bool aLocalized, bool* aIsFound = nullptr );
/**
* In menus we can add a hot key, or an accelerator, or sometimes just a comment. Hot keys

View File

@ -1934,7 +1934,7 @@ void ROUTER_TOOL::performDragging( int aMode )
{
wxString hint;
hint.Printf( _( "(%s to commit anyway.)" ),
KeyNameFromKeyCode( MD_CTRL + PSEUDO_WXK_CLICK ) );
KeyNameFromKeyCode( MD_CTRL + PSEUDO_WXK_CLICK, true ) );
ROUTER_STATUS_VIEW_ITEM* statusItem = new ROUTER_STATUS_VIEW_ITEM();
statusItem->SetMessage( _( "Track violates DRC." ) );
@ -2417,7 +2417,7 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
{
wxString hint;
hint.Printf( _( "(%s to commit anyway.)" ),
KeyNameFromKeyCode( MD_CTRL + PSEUDO_WXK_CLICK ) );
KeyNameFromKeyCode( MD_CTRL + PSEUDO_WXK_CLICK, true ) );
ROUTER_STATUS_VIEW_ITEM* statusItem = new ROUTER_STATUS_VIEW_ITEM();
statusItem->SetMessage( _( "Track violates DRC." ) );

View File

@ -760,12 +760,12 @@ void PAD_TOOL::enterPadEditMode()
if( PCB_ACTIONS::explodePad.GetHotKey() == PCB_ACTIONS::recombinePad.GetHotKey() )
{
msg.Printf( _( "Pad Edit Mode. Press %s again to exit." ),
KeyNameFromKeyCode( PCB_ACTIONS::recombinePad.GetHotKey() ) );
KeyNameFromKeyCode( PCB_ACTIONS::recombinePad.GetHotKey(), true ) );
}
else
{
msg.Printf( _( "Pad Edit Mode. Press %s to exit." ),
KeyNameFromKeyCode( PCB_ACTIONS::recombinePad.GetHotKey() ) );
KeyNameFromKeyCode( PCB_ACTIONS::recombinePad.GetHotKey(), true ) );
}
infoBar->RemoveAllButtons();

View File

@ -247,7 +247,7 @@ void PCB_CONTROL::unfilledZoneCheck()
wxString msg;
msg.Printf( _( "Not all zones are filled. Use Edit > Fill All Zones (%s) "
"if you wish to see all fills." ),
KeyNameFromKeyCode( PCB_ACTIONS::zoneFillAll.GetHotKey() ) );
KeyNameFromKeyCode( PCB_ACTIONS::zoneFillAll.GetHotKey(), true ) );
infobar->ShowMessageFor( msg, 5000, wxICON_WARNING );
}

View File

@ -445,15 +445,15 @@ APPEARANCE_CONTROLS::APPEARANCE_CONTROLS( PCB_BASE_FRAME* aParent, wxWindow* aFo
"Use %s+Tab to activate selector.\n"
"Successive Tabs while holding %s down will "
"cycle through presets in the popup." ),
KeyNameFromKeyCode( PRESET_SWITCH_KEY ),
KeyNameFromKeyCode( PRESET_SWITCH_KEY ) ) );
KeyNameFromKeyCode( PRESET_SWITCH_KEY, true ),
KeyNameFromKeyCode( PRESET_SWITCH_KEY, true ) ) );
m_cbViewports->SetToolTip( wxString::Format( _( "Save and restore view location and zoom.\n"
"Use %s+Tab to activate selector.\n"
"Successive Tabs while holding %s down will "
"cycle through viewports in the popup." ),
KeyNameFromKeyCode( VIEWPORT_SWITCH_KEY ),
KeyNameFromKeyCode( VIEWPORT_SWITCH_KEY ) ) );
KeyNameFromKeyCode( VIEWPORT_SWITCH_KEY, true ),
KeyNameFromKeyCode( VIEWPORT_SWITCH_KEY, true ) ) );
createControls();
@ -625,7 +625,7 @@ void APPEARANCE_CONTROLS::createControls()
hotkey = PCB_ACTIONS::highContrastModeCycle.GetHotKey();
if( hotkey )
msg = wxString::Format( _( "Inactive layers (%s):" ), KeyNameFromKeyCode( hotkey ) );
msg = wxString::Format( _( "Inactive layers (%s):" ), KeyNameFromKeyCode( hotkey, true ) );
else
msg = _( "Inactive layers:" );
@ -700,7 +700,7 @@ void APPEARANCE_CONTROLS::createControls()
hotkey = PCB_ACTIONS::netColorModeCycle.GetHotKey();
if( hotkey )
msg = wxString::Format( _( "Net colors (%s):" ), KeyNameFromKeyCode( hotkey ) );
msg = wxString::Format( _( "Net colors (%s):" ), KeyNameFromKeyCode( hotkey, true ) );
else
msg = _( "Net colors:" );
@ -742,7 +742,7 @@ void APPEARANCE_CONTROLS::createControls()
hotkey = PCB_ACTIONS::ratsnestModeCycle.GetHotKey();
if( hotkey )
msg = wxString::Format( _( "Ratsnest display (%s):" ), KeyNameFromKeyCode( hotkey ) );
msg = wxString::Format( _( "Ratsnest display (%s):" ), KeyNameFromKeyCode( hotkey, true ) );
else
msg = _( "Ratsnest display:" );
@ -1798,7 +1798,7 @@ void APPEARANCE_CONTROLS::rebuildLayers()
wxString msg;
if( hotkey )
msg = wxString::Format( _( "Inactive layers (%s):" ), KeyNameFromKeyCode( hotkey ) );
msg = wxString::Format( _( "Inactive layers (%s):" ), KeyNameFromKeyCode( hotkey, true ) );
else
msg = _( "Inactive layers:" );
@ -2507,7 +2507,7 @@ void APPEARANCE_CONTROLS::rebuildNets()
hotkey = PCB_ACTIONS::netColorModeCycle.GetHotKey();
if( hotkey )
msg = wxString::Format( _( "Net colors (%s):" ), KeyNameFromKeyCode( hotkey ) );
msg = wxString::Format( _( "Net colors (%s):" ), KeyNameFromKeyCode( hotkey, true ) );
else
msg = _( "Net colors:" );
@ -2526,7 +2526,7 @@ void APPEARANCE_CONTROLS::rebuildNets()
hotkey = PCB_ACTIONS::ratsnestModeCycle.GetHotKey();
if( hotkey )
msg = wxString::Format( _( "Ratsnest display (%s):" ), KeyNameFromKeyCode( hotkey ) );
msg = wxString::Format( _( "Ratsnest display (%s):" ), KeyNameFromKeyCode( hotkey, true ) );
else
msg = _( "Ratsnest display:" );
@ -2552,7 +2552,7 @@ void APPEARANCE_CONTROLS::rebuildNets()
void APPEARANCE_CONTROLS::rebuildLayerPresetsWidget()
{
m_viewportsLabel->SetLabel( wxString::Format( _( "Presets (%s+Tab):" ),
KeyNameFromKeyCode( PRESET_SWITCH_KEY ) ) );
KeyNameFromKeyCode( PRESET_SWITCH_KEY, true ) ) );
m_cbLayerPresets->Clear();
@ -2851,7 +2851,7 @@ void APPEARANCE_CONTROLS::doApplyLayerPreset( const LAYER_PRESET& aPreset )
void APPEARANCE_CONTROLS::rebuildViewportsWidget()
{
m_viewportsLabel->SetLabel( wxString::Format( _( "Viewports (%s+Tab):" ),
KeyNameFromKeyCode( VIEWPORT_SWITCH_KEY ) ) );
KeyNameFromKeyCode( VIEWPORT_SWITCH_KEY, true ) ) );
m_cbViewports->Clear();

View File

@ -6,6 +6,12 @@
#include <gecko_keys.h>
#include <wx/defs.h>
#if defined( _WIN32 )
#include <Windows.h>
#elif defined(__WXGTK__)
#include "x11/keysym2ucs.h"
#endif
namespace GeckoKeys
{
@ -93,6 +99,21 @@ CodeNameIndex CodeNameIndexFromWXK( int aWXKey )
}
uint32_t ScancodeFromCodeNameIndex( CodeNameIndex aCodeNameIndex )
{
// clang-format off
#define NS_NATIVE_KEY_TO_DOM_CODE_NAME_INDEX(aNativeKey, aCodeNameIndexIt) \
if( aCodeNameIndex == aCodeNameIndexIt) return aNativeKey;
#include "NativeKeyToDOMCodeName.h"
#undef NS_NATIVE_KEY_TO_DOM_CODE_NAME_INDEX
// clang-format on
return WXK_NONE;
}
int WXKFromKeyEvent( uint32_t aRawKeyCode, uint32_t aRawKeyFlags )
{
return WXKFromCodeNameIndex(
@ -100,4 +121,78 @@ int WXKFromKeyEvent( uint32_t aRawKeyCode, uint32_t aRawKeyFlags )
}
int WXKFromScancode( int aScancode )
{
return WXKFromCodeNameIndex( CodeNameIndexFromScanCode( aScancode ) );
}
wchar_t CharFromScancode( uint32_t aScancode )
{
#if defined( _WIN32 )
HKL layout = ::GetKeyboardLayout( 0 );
uint32_t vk = ::MapVirtualKeyExW( aScancode, MAPVK_VSC_TO_VK, layout );
wchar_t ch = ::MapVirtualKeyExW( vk, MAPVK_VK_TO_CHAR, layout );
return ch;
#elif defined( __APPLE__ )
const UCKeyboardLayout* UCKey = GetUCKeyboardLayout();
UInt32 kbType = ::LMGetKbdType();
UInt32 modifiers = 0;
UInt32 deadKeyState = 0;
UniCharCount len = 0;
UniChar chars[5] = { 0 };
OSStatus err = ::UCKeyTranslate( UCKey, aScancode, kUCKeyActionDown, modifiers >> 8, kbType,
kUCKeyTranslateNoDeadKeysMask, &deadKeyState, 5, &len, chars );
return chars[0];
#else
GdkDisplay* disp = gdk_display_get_default();
keymap = gdk_keymap_get_for_display( disp );
GdkKeymapKey* keys = nullptr;
gint count = 0;
gint minGroup = -1;
if( gdk_keymap_get_entries_for_keyval( mGdkKeymap, GDK_a, &keys, &count ) )
{
// find the minimum number group for latin inputtable layout
for( gint i = 0; i < count && minGroup != 0; ++i )
{
if( keys[i].level != 0 && keys[i].level != 1 )
{
continue;
}
if( minGroup >= 0 && keys[i].group > minGroup )
{
continue;
}
minGroup = keys[i].group;
}
g_free( keys );
}
if( minGroup == -1 )
return 0;
guint state = 0;
guint keyval = 0;
gdk_keymap_translate_keyboard_state( keymap, aScancode, GdkModifierType( state ), minGroup,
&keyval, nullptr, nullptr, nullptr );
static const long MAX_UNICODE = 0x10FFFF;
// we're supposedly printable, let's try to convert
long ucs = keysym2ucs( aGdkKeyEvent->keyval );
if( ( ucs != -1 ) && ( ucs < MAX_UNICODE ) )
{
return ucs;
}
// I guess we couldn't convert
return 0;
#endif
}
}

View File

@ -30,7 +30,9 @@ unsigned int ScanCodeFromKeyEvent( uint32_t aRawKeyCode, uint32_t aRawKeyFlags
CodeNameIndex CodeNameIndexFromScanCode( unsigned int aScanCode );
int WXKFromCodeNameIndex( CodeNameIndex aCodeNameIndex );
CodeNameIndex CodeNameIndexFromWXK( int aWXKey );
uint32_t ScancodeFromCodeNameIndex( CodeNameIndex aCodeNameIndex );
int WXKFromKeyEvent( uint32_t aRawKeyCode, uint32_t aRawKeyFlags );
wchar_t CharFromScancode( uint32_t aScancode );
} // namespace GeckoKeys