aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/sway/container.h10
-rw-r--r--include/sway/input/seat.h21
-rw-r--r--include/sway/layout.h20
-rw-r--r--include/sway/workspace.h10
4 files changed, 51 insertions, 10 deletions
diff --git a/include/sway/container.h b/include/sway/container.h
index 0c66932d..48363be6 100644
--- a/include/sway/container.h
+++ b/include/sway/container.h
@@ -106,10 +106,6 @@ struct sway_container {
* The parent of this container. NULL for the root container.
*/
struct sway_container *parent;
- /**
- * Which of this container's children has focus.
- */
- struct sway_container *focused;
/**
* Number of master views in auto layouts.
@@ -162,4 +158,10 @@ void container_map(swayc_t *container,
swayc_t *swayc_at(swayc_t *parent, double lx, double ly,
struct wlr_surface **surface, double *sx, double *sy);
+/**
+ * Apply the function for each child of the container breadth first.
+ */
+void container_for_each_bfs(swayc_t *con, void (*f)(swayc_t *con, void *data),
+ void *data);
+
#endif
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h
index b21cbccb..f9244f43 100644
--- a/include/sway/input/seat.h
+++ b/include/sway/input/seat.h
@@ -12,14 +12,26 @@ struct sway_seat_device {
struct wl_list link; // sway_seat::devices
};
+struct sway_seat_container {
+ struct sway_seat *seat;
+ swayc_t *container;
+
+ struct wl_list link; // sway_seat::focus_stack
+
+ struct wl_listener destroy;
+};
+
struct sway_seat {
struct wlr_seat *wlr_seat;
struct seat_config *config;
struct sway_cursor *cursor;
struct sway_input_manager *input;
- swayc_t *focus;
+
+ bool has_focus;
+ struct wl_list focus_stack; // list of containers in focus order
struct wl_listener focus_destroy;
+ struct wl_listener new_container;
struct wl_list devices; // sway_seat_device::link
@@ -44,6 +56,13 @@ void sway_seat_configure_xcursor(struct sway_seat *seat);
void sway_seat_set_focus(struct sway_seat *seat, swayc_t *container);
+swayc_t *sway_seat_get_focus(struct sway_seat *seat);
+
+swayc_t *sway_seat_get_focus_inactive(struct sway_seat *seat, swayc_t *container);
+
+swayc_t *sway_seat_get_focus_by_type(struct sway_seat *seat,
+ enum swayc_types type);
+
void sway_seat_set_config(struct sway_seat *seat, struct seat_config *seat_config);
#endif
diff --git a/include/sway/layout.h b/include/sway/layout.h
index af561453..e82c4442 100644
--- a/include/sway/layout.h
+++ b/include/sway/layout.h
@@ -2,6 +2,19 @@
#define _SWAY_LAYOUT_H
#include <wlr/types/wlr_output_layout.h>
+#include "sway/container.h"
+
+enum movement_direction {
+ MOVE_LEFT,
+ MOVE_RIGHT,
+ MOVE_UP,
+ MOVE_DOWN,
+ MOVE_PARENT,
+ MOVE_CHILD,
+ MOVE_NEXT,
+ MOVE_PREV,
+ MOVE_FIRST
+};
struct sway_container;
@@ -11,13 +24,20 @@ struct sway_root {
struct wl_listener output_layout_change;
struct wl_list unmanaged_views; // sway_view::unmanaged_view_link
+
+ struct {
+ struct wl_signal new_container;
+ } events;
};
void init_layout(void);
void add_child(struct sway_container *parent, struct sway_container *child);
+swayc_t *add_sibling(swayc_t *parent, swayc_t *child);
struct sway_container *remove_child(struct sway_container *child);
enum swayc_layouts default_layout(struct sway_container *output);
void sort_workspaces(struct sway_container *output);
void arrange_windows(struct sway_container *container, double width, double height);
+swayc_t *get_swayc_in_direction(swayc_t *container,
+ struct sway_seat *seat, enum movement_direction dir);
#endif
diff --git a/include/sway/workspace.h b/include/sway/workspace.h
index 30bbdaa8..ca6f9bdb 100644
--- a/include/sway/workspace.h
+++ b/include/sway/workspace.h
@@ -1,7 +1,7 @@
#ifndef _SWAY_WORKSPACE_H
#define _SWAY_WORKSPACE_H
-struct sway_container;
+#include <sway/container.h>
extern char *prev_workspace_name;
@@ -12,9 +12,9 @@ bool workspace_switch(swayc_t *workspace);
struct sway_container *workspace_by_number(const char* name);
swayc_t *workspace_by_name(const char*);
-struct sway_container *workspace_output_next(struct sway_container *current);
-struct sway_container *workspace_next(struct sway_container *current);
-struct sway_container *workspace_output_prev(struct sway_container *current);
-struct sway_container *workspace_prev(struct sway_container *current);
+struct sway_container *workspace_output_next(swayc_t *current);
+struct sway_container *workspace_next(swayc_t *current);
+struct sway_container *workspace_output_prev(swayc_t *current);
+struct sway_container *workspace_prev(swayc_t *current);
#endif