diff options
author | Arnon Gilboa <agilboa@redhat.com> | 2009-11-17 16:44:50 +0200 |
---|---|---|
committer | Yaniv Kamay <ykamay@redhat.com> | 2009-11-18 13:25:06 +0200 |
commit | 8b36ed546068bd365c1345f937f3b26cd2b7d0d4 (patch) | |
tree | 388631161080e88d28b9ef7b0282706447061505 /client/x11/platform.cpp | |
parent | 6ff080c0f8b4df4c6113855f59c894605bdcc45c (diff) | |
download | spice-8b36ed546068bd365c1345f937f3b26cd2b7d0d4.tar.gz spice-8b36ed546068bd365c1345f937f3b26cd2b7d0d4.tar.xz spice-8b36ed546068bd365c1345f937f3b26cd2b7d0d4.zip |
spice: on toggle_full_screen, generate on_key_down if shift is still pressed
Diffstat (limited to 'client/x11/platform.cpp')
-rw-r--r-- | client/x11/platform.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp index 8288f555..10d621ba 100644 --- a/client/x11/platform.cpp +++ b/client/x11/platform.cpp @@ -2148,7 +2148,7 @@ void Platform::set_process_loop(ProcessLoop& main_process_loop) main_loop->add_file(*x_event_handler); } -uint32_t Platform::get_keyboard_modifiers() +uint32_t Platform::get_keyboard_lock_modifiers() { XKeyboardState keyboard_state; uint32_t modifiers = 0; @@ -2195,9 +2195,9 @@ static void set_keyboard_led(XLed led, int set) } } -void Platform::set_keyboard_modifiers(uint32_t modifiers) +void Platform::set_keyboard_lock_modifiers(uint32_t modifiers) { - uint32_t now = get_keyboard_modifiers(); + uint32_t now = get_keyboard_lock_modifiers(); if ((now & CAPS_LOCK_MODIFIER) != (modifiers & CAPS_LOCK_MODIFIER)) { set_keyboard_led(X11_CAPS_LOCK_LED, !!(modifiers & CAPS_LOCK_MODIFIER)); @@ -2210,6 +2210,25 @@ void Platform::set_keyboard_modifiers(uint32_t modifiers) } } +uint32_t key_bit(char* keymap, int key, uint32_t bit) +{ + KeyCode key_code = XKeysymToKeycode(x_display, key); + return (((keymap[key_code >> 3] >> (key_code & 7)) & 1) ? bit : 0); +} + +uint32_t Platform::get_keyboard_modifiers() +{ + char keymap[32]; + + XQueryKeymap(x_display, keymap); + return key_bit(keymap, XK_Shift_L, L_SHIFT_MODIFIER) | + key_bit(keymap, XK_Shift_R, R_SHIFT_MODIFIER) | + key_bit(keymap, XK_Control_L, L_CTRL_MODIFIER) | + key_bit(keymap, XK_Control_R, R_CTRL_MODIFIER) | + key_bit(keymap, XK_Alt_L, L_ALT_MODIFIER) | + key_bit(keymap, XK_Alt_R, R_ALT_MODIFIER); +} + WaveRecordAbstract* Platform::create_recorder(RecordClient& client, uint32_t sampels_per_sec, uint32_t bits_per_sample, |