2017-12-16 13:33:22 +00:00
|
|
|
#ifndef _SWAY_INPUT_SEAT_H
|
|
|
|
#define _SWAY_INPUT_SEAT_H
|
2017-12-07 14:58:32 +00:00
|
|
|
|
2018-04-03 01:07:46 +00:00
|
|
|
#include <wlr/types/wlr_layer_shell.h>
|
2017-12-07 14:58:32 +00:00
|
|
|
#include <wlr/types/wlr_seat.h>
|
2017-12-08 13:07:47 +00:00
|
|
|
#include "sway/input/input-manager.h"
|
2017-12-07 14:58:32 +00:00
|
|
|
|
2017-12-14 16:11:56 +00:00
|
|
|
struct sway_seat_device {
|
|
|
|
struct sway_seat *sway_seat;
|
|
|
|
struct sway_input_device *input_device;
|
|
|
|
struct sway_keyboard *keyboard;
|
|
|
|
struct wl_list link; // sway_seat::devices
|
|
|
|
};
|
|
|
|
|
2018-02-04 18:39:10 +00:00
|
|
|
struct sway_seat_container {
|
|
|
|
struct sway_seat *seat;
|
2018-03-30 03:41:33 +00:00
|
|
|
struct sway_container *container;
|
2018-02-04 18:39:10 +00:00
|
|
|
|
|
|
|
struct wl_list link; // sway_seat::focus_stack
|
|
|
|
|
|
|
|
struct wl_listener destroy;
|
|
|
|
};
|
|
|
|
|
2017-12-07 14:58:32 +00:00
|
|
|
struct sway_seat {
|
2017-12-14 16:11:56 +00:00
|
|
|
struct wlr_seat *wlr_seat;
|
2017-12-08 12:22:26 +00:00
|
|
|
struct sway_cursor *cursor;
|
2017-12-10 16:11:47 +00:00
|
|
|
struct sway_input_manager *input;
|
2018-02-04 18:39:10 +00:00
|
|
|
|
|
|
|
bool has_focus;
|
|
|
|
struct wl_list focus_stack; // list of containers in focus order
|
2017-12-10 16:11:47 +00:00
|
|
|
|
2018-04-03 01:07:46 +00:00
|
|
|
// If the focused layer is set, views cannot receive keyboard focus
|
|
|
|
struct wlr_layer_surface *focused_layer;
|
|
|
|
|
2017-12-10 16:11:47 +00:00
|
|
|
struct wl_listener focus_destroy;
|
2018-02-04 18:39:10 +00:00
|
|
|
struct wl_listener new_container;
|
2017-12-07 14:58:32 +00:00
|
|
|
|
2017-12-14 16:11:56 +00:00
|
|
|
struct wl_list devices; // sway_seat_device::link
|
|
|
|
|
2017-12-12 13:29:37 +00:00
|
|
|
struct wl_list link; // input_manager::seats
|
2017-12-10 20:49:54 +00:00
|
|
|
};
|
|
|
|
|
2018-04-02 12:45:37 +00:00
|
|
|
struct sway_seat *seat_create(struct sway_input_manager *input,
|
2017-12-07 14:58:32 +00:00
|
|
|
const char *seat_name);
|
|
|
|
|
2018-04-02 12:45:37 +00:00
|
|
|
void seat_destroy(struct sway_seat *seat);
|
2018-01-16 20:16:04 +00:00
|
|
|
|
2018-04-02 12:45:37 +00:00
|
|
|
void seat_add_device(struct sway_seat *seat,
|
2017-12-12 13:29:37 +00:00
|
|
|
struct sway_input_device *device);
|
2017-12-07 14:58:32 +00:00
|
|
|
|
2018-04-02 12:45:37 +00:00
|
|
|
void seat_configure_device(struct sway_seat *seat,
|
2017-12-14 16:11:56 +00:00
|
|
|
struct sway_input_device *device);
|
|
|
|
|
2018-04-02 12:45:37 +00:00
|
|
|
void seat_remove_device(struct sway_seat *seat,
|
2017-12-12 13:29:37 +00:00
|
|
|
struct sway_input_device *device);
|
2017-12-07 14:58:32 +00:00
|
|
|
|
2018-04-02 12:45:37 +00:00
|
|
|
void seat_configure_xcursor(struct sway_seat *seat);
|
2017-12-09 16:51:28 +00:00
|
|
|
|
2018-04-02 12:45:37 +00:00
|
|
|
void seat_set_focus(struct sway_seat *seat, struct sway_container *container);
|
2017-12-10 16:11:47 +00:00
|
|
|
|
2018-04-02 12:45:37 +00:00
|
|
|
void seat_set_focus_warp(struct sway_seat *seat,
|
2018-03-31 19:13:27 +00:00
|
|
|
struct sway_container *container, bool warp);
|
|
|
|
|
2018-04-03 01:07:46 +00:00
|
|
|
void seat_set_focus_layer(struct sway_seat *seat,
|
|
|
|
struct wlr_layer_surface *layer);
|
|
|
|
|
2018-04-02 12:45:37 +00:00
|
|
|
struct sway_container *seat_get_focus(struct sway_seat *seat);
|
2018-02-07 23:17:57 +00:00
|
|
|
|
2018-02-21 00:01:02 +00:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2018-04-02 12:45:37 +00:00
|
|
|
struct sway_container *seat_get_focus_inactive(struct sway_seat *seat,
|
2018-03-30 03:41:33 +00:00
|
|
|
struct sway_container *container);
|
2018-02-04 18:39:10 +00:00
|
|
|
|
2018-04-02 12:45:37 +00:00
|
|
|
struct sway_container *seat_get_focus_by_type(struct sway_seat *seat,
|
2018-03-31 04:44:17 +00:00
|
|
|
struct sway_container *container, enum sway_container_type type);
|
2018-02-14 19:30:27 +00:00
|
|
|
|
2018-04-02 14:37:31 +00:00
|
|
|
void seat_apply_config(struct sway_seat *seat, struct seat_config *seat_config);
|
|
|
|
|
|
|
|
struct seat_config *seat_get_config(struct sway_seat *seat);
|
2017-12-14 16:11:56 +00:00
|
|
|
|
2017-12-07 14:58:32 +00:00
|
|
|
#endif
|