summaryrefslogtreecommitdiffstats
path: root/client/x11
diff options
context:
space:
mode:
authorArnon Gilboa <agilboa@redhat.com>2009-11-17 16:44:50 +0200
committerYaniv Kamay <ykamay@redhat.com>2010-01-03 17:37:05 +0200
commit18270e02353786a64e01a303ac4db5fa05e05eeb (patch)
tree96b8c03442b5dc18c70e08525dbc9f8eef2dad09 /client/x11
parentba04ac69c680389b8aa225c2ecac0d9fe9b7f0ff (diff)
downloadspice-18270e02353786a64e01a303ac4db5fa05e05eeb.tar.gz
spice-18270e02353786a64e01a303ac4db5fa05e05eeb.tar.xz
spice-18270e02353786a64e01a303ac4db5fa05e05eeb.zip
spice: on toggle_full_screen, generate on_key_down if shift is still pressed
Diffstat (limited to 'client/x11')
-rw-r--r--client/x11/platform.cpp25
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,