forked from AuroraMiddleware/gtk
GDK W32: Cache multiple keyboard layouts simultaneously
This changes the group/level semantic. Previously W32 backend used "group 0/1" to denote "AltGr OFF/ON" and "level 0/1" to denote "Shift is OFF/ON". Now "group" means "keyboard layout" and there can be up to 255 groups, while AltGr and Shift are combined into a single level enum that takes values between 0 and 4. Unlike X, W32 doesn't do effective group overriding, meaning that it will never tell the caller that a different group was actually used (even for universal keys, such as Enter), because key symbol table is completely fabricated and there's no point in trying to save a few of kilobytes of RAM by not duplicating universal key records for all groups. Also contains many whitespace changes (tab elimination, fixed indentation) and cleanup (axed a few global variables, these are now accessed via the default keymap). https://bugzilla.gnome.org/show_bug.cgi?id=768722
This commit is contained in:
parent
60f3c02080
commit
52c7e07948
@ -904,10 +904,12 @@ gdk_keyval_to_unicode (guint keyval)
|
||||
return keyval & 0x00ffffff;
|
||||
|
||||
#if defined(GDK_WINDOWING_WIN32)
|
||||
if (GDK_IS_WIN32_DISPLAY (gdk_display_get_default ()))
|
||||
if (GDK_IS_WIN32_DISPLAY (gdk_display_get_default ()) &&
|
||||
keyval == 0xffae)
|
||||
{
|
||||
if (keyval == 0xffae)
|
||||
return (guint32) _gdk_win32_keymap_get_decimal_mark ();
|
||||
GdkWin32Keymap *keymap = GDK_WIN32_KEYMAP (gdk_keymap_get_default ());
|
||||
|
||||
return (guint32) _gdk_win32_keymap_get_decimal_mark (keymap);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -505,6 +505,8 @@ static void
|
||||
build_key_event_state (GdkEvent *event,
|
||||
BYTE *key_state)
|
||||
{
|
||||
GdkWin32Keymap *keymap;
|
||||
|
||||
event->key.state = 0;
|
||||
|
||||
if (key_state[VK_SHIFT] & 0x80)
|
||||
@ -524,11 +526,13 @@ build_key_event_state (GdkEvent *event,
|
||||
if (key_state[VK_XBUTTON2] & 0x80)
|
||||
event->key.state |= GDK_BUTTON5_MASK;
|
||||
|
||||
if (_gdk_keyboard_has_altgr &&
|
||||
keymap = GDK_WIN32_KEYMAP (_gdk_win32_display_get_keymap (_gdk_display));
|
||||
event->key.group = _gdk_win32_keymap_get_active_group (keymap);
|
||||
|
||||
if (_gdk_win32_keymap_has_altgr (keymap) &&
|
||||
(key_state[VK_LCONTROL] & 0x80) &&
|
||||
(key_state[VK_RMENU] & 0x80))
|
||||
{
|
||||
event->key.group = 1;
|
||||
event->key.state |= GDK_MOD2_MASK;
|
||||
if (key_state[VK_RCONTROL] & 0x80)
|
||||
event->key.state |= GDK_CONTROL_MASK;
|
||||
@ -537,7 +541,6 @@ build_key_event_state (GdkEvent *event,
|
||||
}
|
||||
else
|
||||
{
|
||||
event->key.group = 0;
|
||||
if (key_state[VK_CONTROL] & 0x80)
|
||||
event->key.state |= GDK_CONTROL_MASK;
|
||||
if (key_state[VK_MENU] & 0x80)
|
||||
@ -2224,6 +2227,7 @@ gdk_event_translate (MSG *msg,
|
||||
{
|
||||
case WM_INPUTLANGCHANGE:
|
||||
_gdk_input_locale = (HKL) msg->lParam;
|
||||
_gdk_win32_keymap_set_active_layout (GDK_WIN32_KEYMAP (_gdk_win32_display_get_keymap (_gdk_display)), _gdk_input_locale);
|
||||
_gdk_input_locale_is_ime = ImmIsIME (_gdk_input_locale);
|
||||
GetLocaleInfo (MAKELCID (LOWORD (_gdk_input_locale), SORT_DEFAULT),
|
||||
LOCALE_IDEFAULTANSICODEPAGE,
|
||||
@ -2391,7 +2395,7 @@ gdk_event_translate (MSG *msg,
|
||||
}
|
||||
}
|
||||
else if (msg->wParam == VK_SHIFT &&
|
||||
LOBYTE (HIWORD (msg->lParam)) == _scancode_rshift)
|
||||
LOBYTE (HIWORD (msg->lParam)) == _gdk_win32_keymap_get_rshift_scancode (GDK_WIN32_KEYMAP (_gdk_win32_display_get_keymap (_gdk_display))))
|
||||
event->key.hardware_keycode = VK_RSHIFT;
|
||||
|
||||
/* g_print ("ctrl:%02x lctrl:%02x rctrl:%02x alt:%02x lalt:%02x ralt:%02x\n", key_state[VK_CONTROL], key_state[VK_LCONTROL], key_state[VK_RCONTROL], key_state[VK_MENU], key_state[VK_LMENU], key_state[VK_RMENU]); */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -89,6 +89,7 @@ _gdk_win32_windowing_init (void)
|
||||
_gdk_app_hmodule = GetModuleHandle (NULL);
|
||||
_gdk_display_hdc = CreateDC ("DISPLAY", NULL, NULL, NULL);
|
||||
_gdk_input_locale = GetKeyboardLayout (0);
|
||||
_gdk_win32_keymap_set_active_layout (GDK_WIN32_KEYMAP (_gdk_win32_display_get_keymap (_gdk_display)), _gdk_input_locale);
|
||||
_gdk_input_locale_is_ime = ImmIsIME (_gdk_input_locale);
|
||||
GetLocaleInfo (MAKELCID (LOWORD (_gdk_input_locale), SORT_DEFAULT),
|
||||
LOCALE_IDEFAULTANSICODEPAGE,
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include <gdk/win32/gdkwindow-win32.h>
|
||||
#include <gdk/win32/gdkwin32display.h>
|
||||
#include <gdk/win32/gdkwin32screen.h>
|
||||
#include <gdk/win32/gdkwin32keys.h>
|
||||
|
||||
#include "gdkinternals.h"
|
||||
|
||||
@ -290,8 +291,6 @@ extern gboolean _gdk_input_locale_is_ime;
|
||||
extern UINT _gdk_input_codepage;
|
||||
|
||||
extern guint _gdk_keymap_serial;
|
||||
extern gboolean _gdk_keyboard_has_altgr;
|
||||
extern guint _scancode_rshift;
|
||||
|
||||
/* GdkAtoms: properties, targets and types */
|
||||
extern GdkAtom _gdk_selection;
|
||||
@ -474,6 +473,13 @@ gint _gdk_win32_display_text_property_to_utf8_list (GdkDisplay *display,
|
||||
gchar ***list);
|
||||
gchar *_gdk_win32_display_utf8_to_string_target (GdkDisplay *display, const gchar *str);
|
||||
|
||||
gboolean _gdk_win32_keymap_has_altgr (GdkWin32Keymap *keymap);
|
||||
guint8 _gdk_win32_keymap_get_active_group (GdkWin32Keymap *keymap);
|
||||
guint8 _gdk_win32_keymap_get_rshift_scancode (GdkWin32Keymap *keymap);
|
||||
void _gdk_win32_keymap_set_active_layout (GdkWin32Keymap *keymap,
|
||||
HKL hkl);
|
||||
|
||||
|
||||
GdkKeymap *_gdk_win32_display_get_keymap (GdkDisplay *display);
|
||||
|
||||
void _gdk_win32_display_create_window_impl (GdkDisplay *display,
|
||||
@ -534,7 +540,7 @@ void _gdk_win32_append_event (GdkEvent *event);
|
||||
void _gdk_win32_emit_configure_event (GdkWindow *window);
|
||||
|
||||
|
||||
guint32 _gdk_win32_keymap_get_decimal_mark (void);
|
||||
guint32 _gdk_win32_keymap_get_decimal_mark (GdkWin32Keymap *keymap);
|
||||
|
||||
void _gdk_win32_window_handle_aerosnap (GdkWindow *window,
|
||||
GdkWin32AeroSnapCombo combo);
|
||||
|
Loading…
Reference in New Issue
Block a user