aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/container.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-10-18 21:20:00 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-10-20 13:11:43 +1000
commitc006717910e5f30ca65645f701541dfa176c1392 (patch)
treec64452b7f2fe6ab481ad90c424cb14bcb0328eda /sway/tree/container.c
parentMerge pull request #2872 from RyanDwyer/cursor-rebase (diff)
downloadsway-c006717910e5f30ca65645f701541dfa176c1392.tar.gz
sway-c006717910e5f30ca65645f701541dfa176c1392.tar.zst
sway-c006717910e5f30ca65645f701541dfa176c1392.zip
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.c16
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,
200 if (ly < box.y || ly > box.y + box.height) { 200 if (ly < box.y || ly > box.y + box.height) {
201 return NULL; 201 return NULL;
202 } 202 }
203 struct sway_seat *seat = input_manager_current_seat(input_manager); 203 struct sway_seat *seat = input_manager_current_seat();
204 list_t *children = node_get_children(parent); 204 list_t *children = node_get_children(parent);
205 if (!children->length) { 205 if (!children->length) {
206 return NULL; 206 return NULL;
@@ -234,7 +234,7 @@ static struct sway_container *container_at_stacked(struct sway_node *parent,
234 if (ly < box.y || ly > box.y + box.height) { 234 if (ly < box.y || ly > box.y + box.height) {
235 return NULL; 235 return NULL;
236 } 236 }
237 struct sway_seat *seat = input_manager_current_seat(input_manager); 237 struct sway_seat *seat = input_manager_current_seat();
238 list_t *children = node_get_children(parent); 238 list_t *children = node_get_children(parent);
239 239
240 // Title bars 240 // Title bars
@@ -358,7 +358,7 @@ struct sway_container *container_at(struct sway_workspace *workspace,
358 struct wlr_surface **surface, double *sx, double *sy) { 358 struct wlr_surface **surface, double *sx, double *sy) {
359 struct sway_container *c; 359 struct sway_container *c;
360 360
361 struct sway_seat *seat = input_manager_current_seat(input_manager); 361 struct sway_seat *seat = input_manager_current_seat();
362 struct sway_container *focus = seat_get_focused_container(seat); 362 struct sway_container *focus = seat_get_focused_container(seat);
363 bool is_floating = focus && container_is_floating_or_child(focus); 363 bool is_floating = focus && container_is_floating_or_child(focus);
364 // Focused view's popups 364 // Focused view's popups
@@ -651,7 +651,7 @@ void container_set_floating(struct sway_container *container, bool enable) {
651 return; 651 return;
652 } 652 }
653 653
654 struct sway_seat *seat = input_manager_current_seat(input_manager); 654 struct sway_seat *seat = input_manager_current_seat();
655 struct sway_workspace *workspace = container->workspace; 655 struct sway_workspace *workspace = container->workspace;
656 656
657 if (enable) { 657 if (enable) {
@@ -843,7 +843,7 @@ bool container_has_urgent_child(struct sway_container *container) {
843 843
844void container_end_mouse_operation(struct sway_container *container) { 844void container_end_mouse_operation(struct sway_container *container) {
845 struct sway_seat *seat; 845 struct sway_seat *seat;
846 wl_list_for_each(seat, &input_manager->seats, link) { 846 wl_list_for_each(seat, &server.input->seats, link) {
847 if (seat->op_container == container) { 847 if (seat->op_container == container) {
848 seat->op_target_node = NULL; // ensure tiling move doesn't apply 848 seat->op_target_node = NULL; // ensure tiling move doesn't apply
849 seat_end_mouse_operation(seat); 849 seat_end_mouse_operation(seat);
@@ -890,7 +890,7 @@ void container_set_fullscreen(struct sway_container *container, bool enable) {
890 890
891 struct sway_seat *seat; 891 struct sway_seat *seat;
892 struct sway_workspace *focus_ws; 892 struct sway_workspace *focus_ws;
893 wl_list_for_each(seat, &input_manager->seats, link) { 893 wl_list_for_each(seat, &server.input->seats, link) {
894 focus_ws = seat_get_focused_workspace(seat); 894 focus_ws = seat_get_focused_workspace(seat);
895 if (focus_ws) { 895 if (focus_ws) {
896 if (focus_ws == workspace) { 896 if (focus_ws == workspace) {
@@ -1033,7 +1033,7 @@ void container_add_gaps(struct sway_container *c) {
1033 struct sway_view *view = c->view; 1033 struct sway_view *view = c->view;
1034 if (!view) { 1034 if (!view) {
1035 struct sway_seat *seat = 1035 struct sway_seat *seat =
1036 input_manager_get_default_seat(input_manager); 1036 input_manager_get_default_seat();
1037 struct sway_container *focus = 1037 struct sway_container *focus =
1038 seat_get_focus_inactive_view(seat, &c->node); 1038 seat_get_focus_inactive_view(seat, &c->node);
1039 view = focus ? focus->view : NULL; 1039 view = focus ? focus->view : NULL;
@@ -1187,7 +1187,7 @@ void container_replace(struct sway_container *container,
1187 1187
1188struct sway_container *container_split(struct sway_container *child, 1188struct sway_container *container_split(struct sway_container *child,
1189 enum sway_container_layout layout) { 1189 enum sway_container_layout layout) {
1190 struct sway_seat *seat = input_manager_get_default_seat(input_manager); 1190 struct sway_seat *seat = input_manager_get_default_seat();
1191 bool set_focus = (seat_get_focus(seat) == &child->node); 1191 bool set_focus = (seat_get_focus(seat) == &child->node);
1192 1192
1193 struct sway_container *cont = container_create(NULL); 1193 struct sway_container *cont = container_create(NULL);