From 96578aa91e9856bfb3e2d26fb7a625ff7c9b79e3 Mon Sep 17 00:00:00 2001 From: Tamir Zahavi-Brunner Date: Mon, 7 Sep 2020 01:44:13 +0300 Subject: hide_cursor: Add an option to hide when typing Add an option for the `hide_cursor` command to hide the cursor when typing, i.e. whenever a key is pressed. --- include/sway/input/cursor.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/sway/input') diff --git a/include/sway/input/cursor.h b/include/sway/input/cursor.h index 4c130faf..ca3c6f4b 100644 --- a/include/sway/input/cursor.h +++ b/include/sway/input/cursor.h @@ -6,6 +6,7 @@ #include #include #include "sway/input/seat.h" +#include "config.h" #define SWAY_CURSOR_PRESSED_BUTTONS_CAP 32 @@ -68,6 +69,10 @@ struct sway_cursor { struct wl_event_source *hide_source; bool hidden; + // This field is just a cache of the field in seat_config in order to avoid + // costly seat_config lookups on every keypress. HIDE_WHEN_TYPING_DEFAULT + // indicates that there is no cached value. + enum seat_config_hide_cursor_when_typing hide_when_typing; size_t pressed_button_count; }; @@ -94,6 +99,7 @@ void cursor_handle_activity(struct sway_cursor *cursor, struct wlr_input_device *device); void cursor_unhide(struct sway_cursor *cursor); int cursor_get_timeout(struct sway_cursor *cursor); +void cursor_notify_key_press(struct sway_cursor *cursor); void dispatch_cursor_button(struct sway_cursor *cursor, struct wlr_input_device *device, uint32_t time_msec, uint32_t button, -- cgit v1.2.3