aboutsummaryrefslogtreecommitdiff
path: root/include/sway/input
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-02-24 23:29:08 +0100
committerGitHub <noreply@github.com>2018-02-24 23:29:08 +0100
commit583c30dbe3e3249ec1b753fddbfa982db56dce31 (patch)
treece07d65ab79287280f1f5468e2e62eb5cbef4089 /include/sway/input
parentb28602aa7425cf435150e6008624429737e037d3 (diff)
parent1cca3965f395f624f698cc162946c6cbd6b10673 (diff)
downloadsway-583c30dbe3e3249ec1b753fddbfa982db56dce31.tar.xz
Merge pull request #1585 from acrisci/focus-overhaul
focus overhaul
Diffstat (limited to 'include/sway/input')
-rw-r--r--include/sway/input/input-manager.h5
-rw-r--r--include/sway/input/seat.h30
2 files changed, 32 insertions, 3 deletions
diff --git a/include/sway/input/input-manager.h b/include/sway/input/input-manager.h
index 66ace262..eab7dc90 100644
--- a/include/sway/input/input-manager.h
+++ b/include/sway/input/input-manager.h
@@ -16,14 +16,15 @@ struct sway_input_device {
struct wlr_input_device *wlr_device;
struct input_config *config;
struct wl_list link;
+ struct wl_listener device_destroy;
};
struct sway_input_manager {
- struct wl_listener input_add;
- struct wl_listener input_remove;
struct sway_server *server;
struct wl_list devices;
struct wl_list seats;
+
+ struct wl_listener new_input;
};
struct sway_input_manager *sway_input_manager_create(
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h
index b21cbccb..1d55bec7 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,22 @@ 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);
+
+/**
+ * Return the last container to be focused for the seat (or the most recently
+ * opened if no container has received focused) that is a child of the given
+ * container. The focus-inactive container of the root window is the focused
+ * container for the seat (if the seat does have focus). This function can be
+ * used to determine what container gets focused next if the focused container
+ * is destroyed, or focus moves to a container with children and we need to
+ * descend into the next leaf in focus order.
+ */
+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