|
|
@ -436,15 +436,9 @@ struct key { |
|
|
|
#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0]) |
|
|
|
#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0]) |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
window_handle_key(void *data, struct wl_input_device *input_device, |
|
|
|
window_update_modifiers(struct window *window, uint32_t key, uint32_t state) |
|
|
|
uint32_t key, uint32_t state) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
struct window *window = data; |
|
|
|
|
|
|
|
uint32_t mod = 0; |
|
|
|
uint32_t mod = 0; |
|
|
|
uint32_t unicode = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (window->keyboard_device != input_device) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (key) { |
|
|
|
switch (key) { |
|
|
|
case KEY_LEFTSHIFT: |
|
|
|
case KEY_LEFTSHIFT: |
|
|
@ -459,7 +453,26 @@ window_handle_key(void *data, struct wl_input_device *input_device, |
|
|
|
case KEY_RIGHTALT: |
|
|
|
case KEY_RIGHTALT: |
|
|
|
mod = WINDOW_MODIFIER_ALT; |
|
|
|
mod = WINDOW_MODIFIER_ALT; |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (state) |
|
|
|
|
|
|
|
window->modifiers |= mod; |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
window->modifiers &= ~mod; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
|
|
|
window_handle_key(void *data, struct wl_input_device *input_device, |
|
|
|
|
|
|
|
uint32_t key, uint32_t state) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
struct window *window = data; |
|
|
|
|
|
|
|
uint32_t unicode = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (window->keyboard_device != input_device) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
window_update_modifiers(window, key, state); |
|
|
|
|
|
|
|
|
|
|
|
if (key < ARRAY_LENGTH(evdev_keymap)) { |
|
|
|
if (key < ARRAY_LENGTH(evdev_keymap)) { |
|
|
|
if (window->modifiers & WINDOW_MODIFIER_CONTROL) |
|
|
|
if (window->modifiers & WINDOW_MODIFIER_CONTROL) |
|
|
|
unicode = evdev_keymap[key].code[2]; |
|
|
|
unicode = evdev_keymap[key].code[2]; |
|
|
@ -468,13 +481,6 @@ window_handle_key(void *data, struct wl_input_device *input_device, |
|
|
|
else |
|
|
|
else |
|
|
|
unicode = evdev_keymap[key].code[0]; |
|
|
|
unicode = evdev_keymap[key].code[0]; |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (state) |
|
|
|
|
|
|
|
window->modifiers |= mod; |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
window->modifiers &= ~mod; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (window->key_handler) |
|
|
|
if (window->key_handler) |
|
|
|
(*window->key_handler)(window, key, unicode, |
|
|
|
(*window->key_handler)(window, key, unicode, |
|
|
@ -495,6 +501,7 @@ window_handle_keyboard_focus(void *data, |
|
|
|
struct wl_array *keys) |
|
|
|
struct wl_array *keys) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct window *window = data; |
|
|
|
struct window *window = data; |
|
|
|
|
|
|
|
uint32_t *k, *end; |
|
|
|
|
|
|
|
|
|
|
|
if (window->keyboard_device == input_device && surface != window->surface) |
|
|
|
if (window->keyboard_device == input_device && surface != window->surface) |
|
|
|
window->keyboard_device = NULL; |
|
|
|
window->keyboard_device = NULL; |
|
|
@ -503,6 +510,14 @@ window_handle_keyboard_focus(void *data, |
|
|
|
else |
|
|
|
else |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (window->keyboard_device) { |
|
|
|
|
|
|
|
end = keys->data + keys->size; |
|
|
|
|
|
|
|
for (k = keys->data; k < end; k++) |
|
|
|
|
|
|
|
window_update_modifiers(window, *k, 1); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
window->modifiers = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (window->keyboard_focus_handler) |
|
|
|
if (window->keyboard_focus_handler) |
|
|
|
(*window->keyboard_focus_handler)(window, |
|
|
|
(*window->keyboard_focus_handler)(window, |
|
|
|
window->keyboard_device, |
|
|
|
window->keyboard_device, |
|
|
|