From d0c7f66e950689b70196a890b62b82ff3c66e103 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 29 Mar 2018 23:29:29 -0400 Subject: Revert "Refactor tree" --- sway/input/cursor.c | 10 +++++----- sway/input/input-manager.c | 4 ++-- sway/input/seat.c | 38 +++++++++++++++++++------------------- 3 files changed, 26 insertions(+), 26 deletions(-) (limited to 'sway/input') diff --git a/sway/input/cursor.c b/sway/input/cursor.c index d57ac3e3..8a0d1df5 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -7,7 +7,7 @@ #include #include #include "sway/input/cursor.h" -#include "sway/tree/view.h" +#include "sway/view.h" #include "list.h" #include "log.h" @@ -49,8 +49,8 @@ static void cursor_send_pointer_motion(struct sway_cursor *cursor, } } - struct sway_container *swayc = - container_at(&root_container, cursor->x, cursor->y, &surface, &sx, &sy); + swayc_t *swayc = + swayc_at(&root_container, cursor->x, cursor->y, &surface, &sx, &sy); if (swayc) { wlr_seat_pointer_notify_enter(seat, surface, sx, sy); wlr_seat_pointer_notify_motion(seat, time, sx, sy); @@ -87,8 +87,8 @@ static void handle_cursor_button(struct wl_listener *listener, void *data) { if (event->button == BTN_LEFT) { struct wlr_surface *surface = NULL; double sx, sy; - struct sway_container *swayc = - container_at(&root_container, cursor->x, cursor->y, &surface, &sx, &sy); + swayc_t *swayc = + swayc_at(&root_container, cursor->x, cursor->y, &surface, &sx, &sy); sway_seat_set_focus(cursor->seat, swayc); } diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c index d421a03f..27c2c72e 100644 --- a/sway/input/input-manager.c +++ b/sway/input/input-manager.c @@ -278,7 +278,7 @@ struct sway_input_manager *sway_input_manager_create( } bool sway_input_manager_has_focus(struct sway_input_manager *input, - struct sway_container *container) { + swayc_t *container) { struct sway_seat *seat = NULL; wl_list_for_each(seat, &input->seats, link) { if (sway_seat_get_focus(seat) == container) { @@ -290,7 +290,7 @@ bool sway_input_manager_has_focus(struct sway_input_manager *input, } void sway_input_manager_set_focus(struct sway_input_manager *input, - struct sway_container *container) { + swayc_t *container) { struct sway_seat *seat ; wl_list_for_each(seat, &input->seats, link) { sway_seat_set_focus(seat, container); diff --git a/sway/input/seat.c b/sway/input/seat.c index 76d29b52..648e7914 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -1,13 +1,13 @@ #define _XOPEN_SOURCE 700 #include #include -#include "sway/tree/container.h" +#include "sway/container.h" #include "sway/input/seat.h" #include "sway/input/cursor.h" #include "sway/input/input-manager.h" #include "sway/input/keyboard.h" #include "sway/output.h" -#include "sway/tree/view.h" +#include "sway/view.h" #include "log.h" static void seat_device_destroy(struct sway_seat_device *seat_device) { @@ -37,7 +37,7 @@ static void handle_seat_container_destroy(struct wl_listener *listener, struct sway_seat_container *seat_con = wl_container_of(listener, seat_con, destroy); struct sway_seat *seat = seat_con->seat; - struct sway_container *con = seat_con->container; + swayc_t *con = seat_con->container; bool is_focus = (sway_seat_get_focus(seat) == con); @@ -46,7 +46,7 @@ static void handle_seat_container_destroy(struct wl_listener *listener, if (is_focus) { // pick next focus sway_seat_set_focus(seat, NULL); - struct sway_container *next = sway_seat_get_focus_inactive(seat, con->parent); + swayc_t *next = sway_seat_get_focus_inactive(seat, con->parent); if (next == NULL) { next = con->parent; } @@ -59,7 +59,7 @@ static void handle_seat_container_destroy(struct wl_listener *listener, } static struct sway_seat_container *seat_container_from_container( - struct sway_seat *seat, struct sway_container *con) { + struct sway_seat *seat, swayc_t *con) { if (con->type < C_WORKSPACE) { // these don't get seat containers ever return NULL; @@ -89,11 +89,11 @@ static struct sway_seat_container *seat_container_from_container( static void handle_new_container(struct wl_listener *listener, void *data) { struct sway_seat *seat = wl_container_of(listener, seat, new_container); - struct sway_container *con = data; + swayc_t *con = data; seat_container_from_container(seat, con); } -static void collect_focus_iter(struct sway_container *con, void *data) { +static void collect_focus_iter(swayc_t *con, void *data) { struct sway_seat *seat = data; if (con->type > C_WORKSPACE) { return; @@ -130,7 +130,7 @@ struct sway_seat *sway_seat_create(struct sway_input_manager *input, // init the focus stack wl_list_init(&seat->focus_stack); - container_for_each_descendent(&root_container, collect_focus_iter, seat); + container_for_each_bfs(&root_container, collect_focus_iter, seat); wl_signal_add(&root_container.sway_root->events.new_container, &seat->new_container); @@ -166,7 +166,7 @@ static void seat_configure_keyboard(struct sway_seat *seat, sway_keyboard_configure(seat_device->keyboard); wlr_seat_set_keyboard(seat->wlr_seat, seat_device->input_device->wlr_device); - struct sway_container *focus = sway_seat_get_focus(seat); + swayc_t *focus = sway_seat_get_focus(seat); if (focus && focus->type == C_VIEW) { // force notify reenter to pick up the new configuration wlr_seat_keyboard_clear_focus(seat->wlr_seat); @@ -270,7 +270,7 @@ void sway_seat_configure_xcursor(struct sway_seat *seat) { } for (int i = 0; i < root_container.children->length; ++i) { - struct sway_container *output_container = root_container.children->items[i]; + swayc_t *output_container = root_container.children->items[i]; struct wlr_output *output = output_container->sway_output->wlr_output; bool result = @@ -289,8 +289,8 @@ void sway_seat_configure_xcursor(struct sway_seat *seat) { seat->cursor->cursor->y); } -void sway_seat_set_focus(struct sway_seat *seat, struct sway_container *container) { - struct sway_container *last_focus = sway_seat_get_focus(seat); +void sway_seat_set_focus(struct sway_seat *seat, swayc_t *container) { + swayc_t *last_focus = sway_seat_get_focus(seat); if (container && last_focus == container) { return; @@ -330,9 +330,9 @@ void sway_seat_set_focus(struct sway_seat *seat, struct sway_container *containe seat->has_focus = (container != NULL); } -struct sway_container *sway_seat_get_focus_inactive(struct sway_seat *seat, struct sway_container *container) { +swayc_t *sway_seat_get_focus_inactive(struct sway_seat *seat, swayc_t *container) { struct sway_seat_container *current = NULL; - struct sway_container *parent = NULL; + swayc_t *parent = NULL; wl_list_for_each(current, &seat->focus_stack, link) { parent = current->container->parent; @@ -351,21 +351,21 @@ struct sway_container *sway_seat_get_focus_inactive(struct sway_seat *seat, stru return NULL; } -struct sway_container *sway_seat_get_focus(struct sway_seat *seat) { +swayc_t *sway_seat_get_focus(struct sway_seat *seat) { if (!seat->has_focus) { return NULL; } return sway_seat_get_focus_inactive(seat, &root_container); } -struct sway_container *sway_seat_get_focus_by_type(struct sway_seat *seat, - enum sway_container_type type) { - struct sway_container *focus = sway_seat_get_focus_inactive(seat, &root_container); +swayc_t *sway_seat_get_focus_by_type(struct sway_seat *seat, + enum swayc_types type) { + swayc_t *focus = sway_seat_get_focus_inactive(seat, &root_container); if (focus->type == type) { return focus; } - return container_parent(focus, type); + return swayc_parent_by_type(focus, type); } void sway_seat_set_config(struct sway_seat *seat, -- cgit v1.2.3-54-g00ecf