aboutsummaryrefslogtreecommitdiff
path: root/sway/input/seat.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-03-30 00:00:23 -0400
committerGitHub <noreply@github.com>2018-03-30 00:00:23 -0400
commit7162b9bea4d66d61376ad3605e23e2d83bb95201 (patch)
tree6f7a3121f15503a923c1ce53bf2bee368c6149a6 /sway/input/seat.c
parent472e81f35d689d67cda241acafda91c688d61046 (diff)
parent8f490d7d2dbadfe85dcf3dcd972471e86671442a (diff)
Merge pull request #1654 from acrisci/refactor-2-electric-boogaloo
Revert "Merge pull request #1653 from swaywm/revert-1647-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 648e7914..aa0b1d50 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/container.h"
+#include "sway/tree/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/view.h"
+#include "sway/tree/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;
- swayc_t *con = seat_con->container;
+ struct sway_container *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);
- swayc_t *next = sway_seat_get_focus_inactive(seat, con->parent);
+ struct sway_container *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, swayc_t *con) {
+ struct sway_seat *seat, struct sway_container *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);
- swayc_t *con = data;
+ struct sway_container *con = data;
seat_container_from_container(seat, con);
}
-static void collect_focus_iter(swayc_t *con, void *data) {
+static void collect_focus_iter(struct sway_container *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_bfs(&root_container, collect_focus_iter, seat);
+ container_for_each_descendant_dfs(&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);
- swayc_t *focus = sway_seat_get_focus(seat);
+ struct sway_container *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) {
- swayc_t *output_container = root_container.children->items[i];
+ struct sway_container *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, swayc_t *container) {
- swayc_t *last_focus = sway_seat_get_focus(seat);
+void sway_seat_set_focus(struct sway_seat *seat, struct sway_container *container) {
+ struct sway_container *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, swayc_t *container) {
seat->has_focus = (container != NULL);
}
-swayc_t *sway_seat_get_focus_inactive(struct sway_seat *seat, swayc_t *container) {
+struct sway_container *sway_seat_get_focus_inactive(struct sway_seat *seat, struct sway_container *container) {
struct sway_seat_container *current = NULL;
- swayc_t *parent = NULL;
+ struct sway_container *parent = NULL;
wl_list_for_each(current, &seat->focus_stack, link) {
parent = current->container->parent;
@@ -351,21 +351,21 @@ swayc_t *sway_seat_get_focus_inactive(struct sway_seat *seat, swayc_t *container
return NULL;
}
-swayc_t *sway_seat_get_focus(struct sway_seat *seat) {
+struct sway_container *sway_seat_get_focus(struct sway_seat *seat) {
if (!seat->has_focus) {
return NULL;
}
return 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);
+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);
if (focus->type == type) {
return focus;
}
- return swayc_parent_by_type(focus, type);
+ return container_parent(focus, type);
}
void sway_seat_set_config(struct sway_seat *seat,