diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-10-18 21:20:00 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-10-20 13:11:43 +1000 |
commit | c006717910e5f30ca65645f701541dfa176c1392 (patch) | |
tree | c64452b7f2fe6ab481ad90c424cb14bcb0328eda /include/sway | |
parent | 5b8257b88f703f48466f3b917f1ceaee7c457355 (diff) | |
download | sway-c006717910e5f30ca65645f701541dfa176c1392.tar.xz |
Minor refactor of input manager
The input manager is a singleton object. Passing the sway_input_manager
argument to each of its functions is unnecessary, while removing the
argument makes it obvious to the caller that it's a singleton. This
patch removes the argument and makes the input manager use server.input
instead.
On a similar note:
* sway_input_manager.server is removed in favour of using the server
global.
* seat.input is removed because it can get it from server.input.
Due to a circular dependency, creating seat0 is now done directly in
server_init rather than in input_manager_create. This is because
creating seats must be done after server.input is set.
Lastly, it now stores the default seat name using a constant and removes
a second reference to seat0 (in input_manager_get_default_seat).
Diffstat (limited to 'include/sway')
-rw-r--r-- | include/sway/input/input-manager.h | 29 | ||||
-rw-r--r-- | include/sway/input/seat.h | 4 |
2 files changed, 9 insertions, 24 deletions
diff --git a/include/sway/input/input-manager.h b/include/sway/input/input-manager.h index b7073006..219aa9ba 100644 --- a/include/sway/input/input-manager.h +++ b/include/sway/input/input-manager.h @@ -7,12 +7,6 @@ #include "sway/config.h" #include "list.h" -/** - * The global singleton input manager - * TODO: make me not a global - */ -extern struct sway_input_manager *input_manager; - struct sway_input_device { char *identifier; struct wlr_input_device *wlr_device; @@ -21,7 +15,6 @@ struct sway_input_device { }; struct sway_input_manager { - struct sway_server *server; struct wl_list devices; struct wl_list seats; @@ -36,30 +29,24 @@ struct sway_input_manager { struct sway_input_manager *input_manager_create(struct sway_server *server); -bool input_manager_has_focus(struct sway_input_manager *input, - struct sway_node *node); +bool input_manager_has_focus(struct sway_node *node); -void input_manager_set_focus(struct sway_input_manager *input, - struct sway_node *node); +void input_manager_set_focus(struct sway_node *node); -void input_manager_configure_xcursor(struct sway_input_manager *input); +void input_manager_configure_xcursor(void); -void input_manager_apply_input_config(struct sway_input_manager *input, - struct input_config *input_config); +void input_manager_apply_input_config(struct input_config *input_config); -void input_manager_apply_seat_config(struct sway_input_manager *input, - struct seat_config *seat_config); +void input_manager_apply_seat_config(struct seat_config *seat_config); -struct sway_seat *input_manager_get_default_seat( - struct sway_input_manager *input); +struct sway_seat *input_manager_get_default_seat(void); -struct sway_seat *input_manager_get_seat(struct sway_input_manager *input, - const char *seat_name); +struct sway_seat *input_manager_get_seat(const char *seat_name); /** * Gets the last seat the user interacted with */ -struct sway_seat *input_manager_current_seat(struct sway_input_manager *input); +struct sway_seat *input_manager_current_seat(void); struct input_config *input_device_get_config(struct sway_input_device *device); diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h index e9f553f3..ef65810c 100644 --- a/include/sway/input/seat.h +++ b/include/sway/input/seat.h @@ -47,7 +47,6 @@ enum sway_seat_operation { struct sway_seat { struct wlr_seat *wlr_seat; struct sway_cursor *cursor; - struct sway_input_manager *input; bool has_focus; struct wl_list focus_stack; // list of containers in focus order @@ -89,8 +88,7 @@ struct sway_seat { struct wl_list link; // input_manager::seats }; -struct sway_seat *seat_create(struct sway_input_manager *input, - const char *seat_name); +struct sway_seat *seat_create(const char *seat_name); void seat_destroy(struct sway_seat *seat); |