aboutsummaryrefslogtreecommitdiff
path: root/sway/input/seat.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-03-29 23:29:29 -0400
committerGitHub <noreply@github.com>2018-03-29 23:29:29 -0400
commitd0c7f66e950689b70196a890b62b82ff3c66e103 (patch)
treeb8b52173a9791e3b13a0316ab9d316a80a6adc20 /sway/input/seat.c
parent6b7841b11ff4cd35f54d69dc92029855893e5ce0 (diff)
Revert "Refactor tree"
Diffstat (limited to 'sway/input/seat.c')
-rw-r--r--sway/input/seat.c38
1 files changed, 19 insertions, 19 deletions
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 <wlr/types/wlr_cursor.h>
#include <wlr/types/wlr_xcursor_manager.h>
-#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,