diff options
author | Ryan Dwyer <[email protected]> | 2018-10-18 21:20:00 +1000 |
---|---|---|
committer | Ryan Dwyer <[email protected]> | 2018-10-20 13:11:43 +1000 |
commit | c006717910e5f30ca65645f701541dfa176c1392 (patch) | |
tree | c64452b7f2fe6ab481ad90c424cb14bcb0328eda /sway/tree/container.c | |
parent | 5b8257b88f703f48466f3b917f1ceaee7c457355 (diff) |
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 'sway/tree/container.c')
-rw-r--r-- | sway/tree/container.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index edab7a17..b41e8dd4 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -200,7 +200,7 @@ static struct sway_container *container_at_tabbed(struct sway_node *parent, if (ly < box.y || ly > box.y + box.height) { return NULL; } - struct sway_seat *seat = input_manager_current_seat(input_manager); + struct sway_seat *seat = input_manager_current_seat(); list_t *children = node_get_children(parent); if (!children->length) { return NULL; @@ -234,7 +234,7 @@ static struct sway_container *container_at_stacked(struct sway_node *parent, if (ly < box.y || ly > box.y + box.height) { return NULL; } - struct sway_seat *seat = input_manager_current_seat(input_manager); + struct sway_seat *seat = input_manager_current_seat(); list_t *children = node_get_children(parent); // Title bars @@ -358,7 +358,7 @@ struct sway_container *container_at(struct sway_workspace *workspace, struct wlr_surface **surface, double *sx, double *sy) { struct sway_container *c; - struct sway_seat *seat = input_manager_current_seat(input_manager); + struct sway_seat *seat = input_manager_current_seat(); struct sway_container *focus = seat_get_focused_container(seat); bool is_floating = focus && container_is_floating_or_child(focus); // Focused view's popups @@ -651,7 +651,7 @@ void container_set_floating(struct sway_container *container, bool enable) { return; } - struct sway_seat *seat = input_manager_current_seat(input_manager); + struct sway_seat *seat = input_manager_current_seat(); struct sway_workspace *workspace = container->workspace; if (enable) { @@ -843,7 +843,7 @@ bool container_has_urgent_child(struct sway_container *container) { void container_end_mouse_operation(struct sway_container *container) { struct sway_seat *seat; - wl_list_for_each(seat, &input_manager->seats, link) { + wl_list_for_each(seat, &server.input->seats, link) { if (seat->op_container == container) { seat->op_target_node = NULL; // ensure tiling move doesn't apply seat_end_mouse_operation(seat); @@ -890,7 +890,7 @@ void container_set_fullscreen(struct sway_container *container, bool enable) { struct sway_seat *seat; struct sway_workspace *focus_ws; - wl_list_for_each(seat, &input_manager->seats, link) { + wl_list_for_each(seat, &server.input->seats, link) { focus_ws = seat_get_focused_workspace(seat); if (focus_ws) { if (focus_ws == workspace) { @@ -1033,7 +1033,7 @@ void container_add_gaps(struct sway_container *c) { struct sway_view *view = c->view; if (!view) { struct sway_seat *seat = - input_manager_get_default_seat(input_manager); + input_manager_get_default_seat(); struct sway_container *focus = seat_get_focus_inactive_view(seat, &c->node); view = focus ? focus->view : NULL; @@ -1187,7 +1187,7 @@ void container_replace(struct sway_container *container, struct sway_container *container_split(struct sway_container *child, enum sway_container_layout layout) { - struct sway_seat *seat = input_manager_get_default_seat(input_manager); + struct sway_seat *seat = input_manager_get_default_seat(); bool set_focus = (seat_get_focus(seat) == &child->node); struct sway_container *cont = container_create(NULL); |