diff options
Diffstat (limited to 'sway/input')
-rw-r--r-- | sway/input/cursor.c | 26 | ||||
-rw-r--r-- | sway/input/keyboard.c | 5 |
2 files changed, 31 insertions, 0 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index e47410a5..b168afc5 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c | |||
@@ -253,6 +253,32 @@ int cursor_get_timeout(struct sway_cursor *cursor) { | |||
253 | return timeout; | 253 | return timeout; |
254 | } | 254 | } |
255 | 255 | ||
256 | void cursor_notify_key_press(struct sway_cursor *cursor) { | ||
257 | if (cursor->hidden) { | ||
258 | return; | ||
259 | } | ||
260 | |||
261 | if (cursor->hide_when_typing == HIDE_WHEN_TYPING_DEFAULT) { | ||
262 | // No cached value, need to lookup in the seat_config | ||
263 | const struct seat_config *seat_config = seat_get_config(cursor->seat); | ||
264 | if (!seat_config) { | ||
265 | seat_config = seat_get_config_by_name("*"); | ||
266 | if (!seat_config) { | ||
267 | return; | ||
268 | } | ||
269 | } | ||
270 | cursor->hide_when_typing = seat_config->hide_cursor_when_typing; | ||
271 | // The default is currently disabled | ||
272 | if (cursor->hide_when_typing == HIDE_WHEN_TYPING_DEFAULT) { | ||
273 | cursor->hide_when_typing = HIDE_WHEN_TYPING_DISABLE; | ||
274 | } | ||
275 | } | ||
276 | |||
277 | if (cursor->hide_when_typing == HIDE_WHEN_TYPING_ENABLE) { | ||
278 | cursor_hide(cursor); | ||
279 | } | ||
280 | } | ||
281 | |||
256 | static enum sway_input_idle_source idle_source_from_device( | 282 | static enum sway_input_idle_source idle_source_from_device( |
257 | struct wlr_input_device *device) { | 283 | struct wlr_input_device *device) { |
258 | switch (device->type) { | 284 | switch (device->type) { |
diff --git a/sway/input/keyboard.c b/sway/input/keyboard.c index 541fc90d..ae30e83a 100644 --- a/sway/input/keyboard.c +++ b/sway/input/keyboard.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include "sway/input/input-manager.h" | 13 | #include "sway/input/input-manager.h" |
14 | #include "sway/input/keyboard.h" | 14 | #include "sway/input/keyboard.h" |
15 | #include "sway/input/seat.h" | 15 | #include "sway/input/seat.h" |
16 | #include "sway/input/cursor.h" | ||
16 | #include "sway/ipc-server.h" | 17 | #include "sway/ipc-server.h" |
17 | #include "log.h" | 18 | #include "log.h" |
18 | 19 | ||
@@ -392,6 +393,10 @@ static void handle_key_event(struct sway_keyboard *keyboard, | |||
392 | keyboard_shortcuts_inhibitor_get_for_focused_surface(seat); | 393 | keyboard_shortcuts_inhibitor_get_for_focused_surface(seat); |
393 | bool shortcuts_inhibited = sway_inhibitor && sway_inhibitor->inhibitor->active; | 394 | bool shortcuts_inhibited = sway_inhibitor && sway_inhibitor->inhibitor->active; |
394 | 395 | ||
396 | if (event->state == WLR_KEY_PRESSED) { | ||
397 | cursor_notify_key_press(seat->cursor); | ||
398 | } | ||
399 | |||
395 | // Identify new keycode, raw keysym(s), and translated keysym(s) | 400 | // Identify new keycode, raw keysym(s), and translated keysym(s) |
396 | struct key_info keyinfo; | 401 | struct key_info keyinfo; |
397 | update_keyboard_state(keyboard, event->keycode, event->state, &keyinfo); | 402 | update_keyboard_state(keyboard, event->keycode, event->state, &keyinfo); |