diff options
author | emersion <contact@emersion.fr> | 2018-10-20 08:42:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-20 08:42:56 +0200 |
commit | 75ea19c71b08e4b3dd1ad053944724fd91dc04bd (patch) | |
tree | 734b3ad6e6ef44d62ac6bbb1162a8bbb2ca28ae4 /sway/tree | |
parent | fe6aea1d02db7e172cafdaac61d612d0de2dc9d0 (diff) | |
parent | c006717910e5f30ca65645f701541dfa176c1392 (diff) |
Merge pull request #2870 from RyanDwyer/refactor-input-manager
Minor refactor of input manager
Diffstat (limited to 'sway/tree')
-rw-r--r-- | sway/tree/container.c | 16 | ||||
-rw-r--r-- | sway/tree/output.c | 4 | ||||
-rw-r--r-- | sway/tree/root.c | 8 | ||||
-rw-r--r-- | sway/tree/view.c | 16 | ||||
-rw-r--r-- | sway/tree/workspace.c | 10 |
5 files changed, 27 insertions, 27 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); diff --git a/sway/tree/output.c b/sway/tree/output.c index 98041c47..04219b5f 100644 --- a/sway/tree/output.c +++ b/sway/tree/output.c @@ -83,7 +83,7 @@ void output_enable(struct sway_output *output, struct output_config *oc) { struct sway_workspace *ws = workspace_create(output, ws_name); // Set each seat's focus if not already set struct sway_seat *seat = NULL; - wl_list_for_each(seat, &input_manager->seats, link) { + wl_list_for_each(seat, &server.input->seats, link) { if (!seat->has_focus) { seat_set_focus_workspace(seat, ws); } @@ -98,7 +98,7 @@ void output_enable(struct sway_output *output, struct output_config *oc) { } wl_signal_init(&output->events.destroy); - input_manager_configure_xcursor(input_manager); + input_manager_configure_xcursor(); wl_signal_add(&wlr_output->events.mode, &output->mode); wl_signal_add(&wlr_output->events.transform, &output->transform); diff --git a/sway/tree/root.c b/sway/tree/root.c index 6748e9c9..e5eb8f2a 100644 --- a/sway/tree/root.c +++ b/sway/tree/root.c @@ -67,7 +67,7 @@ void root_scratchpad_add_container(struct sway_container *con) { container_set_floating(con, true); container_detach(con); - struct sway_seat *seat = input_manager_current_seat(input_manager); + struct sway_seat *seat = input_manager_current_seat(); if (parent) { arrange_container(parent); seat_set_focus(seat, seat_get_focus_inactive(seat, &parent->node)); @@ -89,7 +89,7 @@ void root_scratchpad_remove_container(struct sway_container *con) { } void root_scratchpad_show(struct sway_container *con) { - struct sway_seat *seat = input_manager_current_seat(input_manager); + struct sway_seat *seat = input_manager_current_seat(); struct sway_workspace *ws = seat_get_focused_workspace(seat); // If the current con or any of its parents are in fullscreen mode, we @@ -127,7 +127,7 @@ void root_scratchpad_show(struct sway_container *con) { } void root_scratchpad_hide(struct sway_container *con) { - struct sway_seat *seat = input_manager_current_seat(input_manager); + struct sway_seat *seat = input_manager_current_seat(); struct sway_node *focus = seat_get_focus(seat); struct sway_workspace *ws = con->workspace; @@ -210,7 +210,7 @@ void root_record_workspace_pid(pid_t pid) { wl_list_init(&pid_workspaces); } - struct sway_seat *seat = input_manager_current_seat(input_manager); + struct sway_seat *seat = input_manager_current_seat(); struct sway_workspace *ws = seat_get_focused_workspace(seat); if (!ws) { wlr_log(WLR_DEBUG, "Bailing out, no workspace"); diff --git a/sway/tree/view.c b/sway/tree/view.c index 43a9d510..85afbb87 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -305,7 +305,7 @@ void view_request_activate(struct sway_view *view) { if (!ws) { // hidden scratchpad container return; } - struct sway_seat *seat = input_manager_current_seat(input_manager); + struct sway_seat *seat = input_manager_current_seat(); switch (config->focus_on_window_activation) { case FOWA_SMART: @@ -443,7 +443,7 @@ void view_execute_criteria(struct sway_view *view) { } static struct sway_workspace *select_workspace(struct sway_view *view) { - struct sway_seat *seat = input_manager_current_seat(input_manager); + struct sway_seat *seat = input_manager_current_seat(); // Check if there's any `assign` criteria for the view list_t *criterias = criteria_for_view(view, @@ -517,7 +517,7 @@ static struct sway_workspace *select_workspace(struct sway_view *view) { } static bool should_focus(struct sway_view *view) { - struct sway_seat *seat = input_manager_current_seat(input_manager); + struct sway_seat *seat = input_manager_current_seat(); struct sway_container *prev_con = seat_get_focused_container(seat); struct sway_workspace *prev_ws = seat_get_focused_workspace(seat); struct sway_workspace *map_ws = view->container->workspace; @@ -551,7 +551,7 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface, } view->surface = wlr_surface; - struct sway_seat *seat = input_manager_current_seat(input_manager); + struct sway_seat *seat = input_manager_current_seat(); struct sway_workspace *ws = select_workspace(view); struct sway_node *node = seat_get_focus_inactive(seat, &ws->node); struct sway_container *target_sibling = node->type == N_CONTAINER ? @@ -616,7 +616,7 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface, } if (should_focus(view)) { - input_manager_set_focus(input_manager, &view->container->node); + input_manager_set_focus(&view->container->node); } } @@ -645,7 +645,7 @@ void view_unmap(struct sway_view *view) { } struct sway_seat *seat; - wl_list_for_each(seat, &input_manager->seats, link) { + wl_list_for_each(seat, &server.input->seats, link) { if (config->mouse_warping == WARP_CONTAINER) { struct sway_node *node = seat_get_focus(seat); if (node && node->type == N_CONTAINER) { @@ -1106,7 +1106,7 @@ bool view_is_visible(struct sway_view *view) { return false; } // Check view isn't in a tabbed or stacked container on an inactive tab - struct sway_seat *seat = input_manager_current_seat(input_manager); + struct sway_seat *seat = input_manager_current_seat(); struct sway_container *con = view->container; while (con) { enum sway_container_layout layout = container_parent_layout(con); @@ -1138,7 +1138,7 @@ void view_set_urgent(struct sway_view *view, bool enable) { return; } if (enable) { - struct sway_seat *seat = input_manager_current_seat(input_manager); + struct sway_seat *seat = input_manager_current_seat(); if (seat_get_focused_container(seat) == view->container) { return; } diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index ed875ebb..fff16515 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c @@ -40,7 +40,7 @@ struct sway_output *workspace_get_initial_output(const char *name) { } } // Otherwise put it on the focused output - struct sway_seat *seat = input_manager_current_seat(input_manager); + struct sway_seat *seat = input_manager_current_seat(); struct sway_workspace *focus = seat_get_focused_workspace(seat); return focus->output; } @@ -295,7 +295,7 @@ static bool _workspace_by_name(struct sway_workspace *ws, void *data) { } struct sway_workspace *workspace_by_name(const char *name) { - struct sway_seat *seat = input_manager_current_seat(input_manager); + struct sway_seat *seat = input_manager_current_seat(); struct sway_workspace *current = seat_get_focused_workspace(seat); if (strcmp(name, "prev") == 0) { @@ -324,7 +324,7 @@ struct sway_workspace *workspace_by_name(const char *name) { */ static struct sway_workspace *workspace_output_prev_next_impl( struct sway_output *output, int dir) { - struct sway_seat *seat = input_manager_current_seat(input_manager); + struct sway_seat *seat = input_manager_current_seat(); struct sway_workspace *workspace = seat_get_focused_workspace(seat); int index = list_find(output->workspaces, workspace); @@ -376,7 +376,7 @@ struct sway_workspace *workspace_prev(struct sway_workspace *current) { bool workspace_switch(struct sway_workspace *workspace, bool no_auto_back_and_forth) { - struct sway_seat *seat = input_manager_current_seat(input_manager); + struct sway_seat *seat = input_manager_current_seat(); struct sway_workspace *active_ws = seat_get_focused_workspace(seat); if (!no_auto_back_and_forth && config->auto_back_and_forth @@ -627,7 +627,7 @@ void workspace_add_gaps(struct sway_workspace *ws) { return; } if (config->smart_gaps) { - struct sway_seat *seat = input_manager_get_default_seat(input_manager); + struct sway_seat *seat = input_manager_get_default_seat(); struct sway_container *focus = seat_get_focus_inactive_tiling(seat, ws); if (focus && !focus->view) { |