diff options
Diffstat (limited to 'include/sway')
-rw-r--r-- | include/sway/commands.h | 13 | ||||
-rw-r--r-- | include/sway/config.h | 36 | ||||
-rw-r--r-- | include/sway/container.h | 8 | ||||
-rw-r--r-- | include/sway/input/cursor.h | 30 | ||||
-rw-r--r-- | include/sway/input/input-manager.h | 49 | ||||
-rw-r--r-- | include/sway/input/keyboard.h | 22 | ||||
-rw-r--r-- | include/sway/input/seat.h | 47 | ||||
-rw-r--r-- | include/sway/ipc-json.h | 2 | ||||
-rw-r--r-- | include/sway/server.h | 2 |
9 files changed, 207 insertions, 2 deletions
diff --git a/include/sway/commands.h b/include/sway/commands.h index b1f0423d..4ee7af2a 100644 --- a/include/sway/commands.h +++ b/include/sway/commands.h @@ -1,6 +1,8 @@ #ifndef _SWAY_COMMANDS_H #define _SWAY_COMMANDS_H +#include "config.h" + /** * Indicates the result of a command's execution. */ @@ -15,6 +17,7 @@ enum cmd_status { CMD_BLOCK_BAR, CMD_BLOCK_BAR_COLORS, CMD_BLOCK_INPUT, + CMD_BLOCK_SEAT, CMD_BLOCK_COMMANDS, CMD_BLOCK_IPC, CMD_BLOCK_IPC_EVENTS, @@ -107,6 +110,7 @@ sway_cmd cmd_gaps; sway_cmd cmd_hide_edge_borders; sway_cmd cmd_include; sway_cmd cmd_input; +sway_cmd cmd_seat; sway_cmd cmd_ipc; sway_cmd cmd_kill; sway_cmd cmd_layout; @@ -176,6 +180,7 @@ sway_cmd bar_colors_cmd_statusline; sway_cmd bar_colors_cmd_focused_statusline; sway_cmd bar_colors_cmd_urgent_workspace; +sway_cmd input_cmd_seat; sway_cmd input_cmd_accel_profile; sway_cmd input_cmd_click_method; sway_cmd input_cmd_drag_lock; @@ -187,6 +192,14 @@ sway_cmd input_cmd_natural_scroll; sway_cmd input_cmd_pointer_accel; sway_cmd input_cmd_scroll_method; sway_cmd input_cmd_tap; +sway_cmd input_cmd_xkb_layout; +sway_cmd input_cmd_xkb_model; +sway_cmd input_cmd_xkb_options; +sway_cmd input_cmd_xkb_rules; +sway_cmd input_cmd_xkb_variant; + +sway_cmd seat_cmd_fallback; +sway_cmd seat_cmd_attach; sway_cmd cmd_ipc_cmd; sway_cmd cmd_ipc_events; diff --git a/include/sway/config.h b/include/sway/config.h index afff2738..83ded720 100644 --- a/include/sway/config.h +++ b/include/sway/config.h @@ -67,11 +67,34 @@ struct input_config { int send_events; int tap; + char *xkb_layout; + char *xkb_model; + char *xkb_options; + char *xkb_rules; + char *xkb_variant; + bool capturable; struct wlr_box region; }; /** + * Options for misc device configurations that happen in the seat block + */ +struct seat_attachment_config { + char *identifier; + // TODO other things are configured here for some reason +}; + +/** + * Options for multiseat and other misc device configurations + */ +struct seat_config { + char *name; + int fallback; // -1 means not set + list_t *attachments; // list of seat_attachment configs +}; + +/** * Size and position configuration for a particular output. * * This is set via the `output` command. @@ -262,6 +285,7 @@ struct sway_config { list_t *pid_workspaces; list_t *output_configs; list_t *input_configs; + list_t *seat_configs; list_t *criteria; list_t *no_focus; list_t *active_bar_modifiers; @@ -358,9 +382,19 @@ char *do_var_replacement(char *str); struct cmd_results *check_security_config(); int input_identifier_cmp(const void *item, const void *data); +struct input_config *new_input_config(const char* identifier); void merge_input_config(struct input_config *dst, struct input_config *src); -void apply_input_config(struct input_config *ic, struct libinput_device *dev); void free_input_config(struct input_config *ic); +void apply_input_config(struct input_config *input); + +int seat_name_cmp(const void *item, const void *data); +struct seat_config *new_seat_config(const char* name); +void merge_seat_config(struct seat_config *dst, struct seat_config *src); +void free_seat_config(struct seat_config *ic); +struct seat_attachment_config *seat_attachment_config_new(); +struct seat_attachment_config *seat_config_get_attachment( + struct seat_config *seat_config, char *identifier); +void apply_seat_config(struct seat_config *seat); int output_name_cmp(const void *item, const void *data); struct output_config *new_output_config(); diff --git a/include/sway/container.h b/include/sway/container.h index b15e0428..9a5e312b 100644 --- a/include/sway/container.h +++ b/include/sway/container.h @@ -3,6 +3,7 @@ #include <stdint.h> #include <sys/types.h> #include <wlr/types/wlr_box.h> +#include <wlr/types/wlr_surface.h> #include "list.h" typedef struct sway_container swayc_t; @@ -123,6 +124,10 @@ struct sway_container { * Marks applied to the container, list_t of char*. */ list_t *marks; + + struct { + struct wl_signal destroy; + } events; }; void swayc_descendants_of_type(swayc_t *root, enum swayc_types type, @@ -137,4 +142,7 @@ swayc_t *destroy_view(swayc_t *view); swayc_t *swayc_parent_by_type(swayc_t *container, enum swayc_types type); +swayc_t *swayc_at(swayc_t *parent, double lx, double ly, + struct wlr_surface **surface, double *sx, double *sy); + #endif diff --git a/include/sway/input/cursor.h b/include/sway/input/cursor.h new file mode 100644 index 00000000..2f70cf4b --- /dev/null +++ b/include/sway/input/cursor.h @@ -0,0 +1,30 @@ +#ifndef _SWAY_INPUT_CURSOR_H +#define _SWAY_INPUT_CURSOR_H + +#include "sway/input/seat.h" + +struct sway_cursor { + struct sway_seat *seat; + struct wlr_cursor *cursor; + struct wlr_xcursor_manager *xcursor_manager; + + double x, y; + + struct wl_listener motion; + struct wl_listener motion_absolute; + struct wl_listener button; + struct wl_listener axis; + + struct wl_listener touch_down; + struct wl_listener touch_up; + struct wl_listener touch_motion; + + struct wl_listener tool_axis; + struct wl_listener tool_tip; + + struct wl_listener request_set_cursor; +}; + +struct sway_cursor *sway_cursor_create(struct sway_seat *seat); + +#endif diff --git a/include/sway/input/input-manager.h b/include/sway/input/input-manager.h new file mode 100644 index 00000000..53064eed --- /dev/null +++ b/include/sway/input/input-manager.h @@ -0,0 +1,49 @@ +#ifndef _SWAY_INPUT_INPUT_MANAGER_H +#define _SWAY_INPUT_INPUT_MANAGER_H +#include <libinput.h> +#include "sway/server.h" +#include "sway/config.h" +#include "list.h" + +extern struct input_config *current_input_config; +extern struct seat_config *current_seat_config; + +/** + * The global singleton input manager + * TODO: make me not a global + */ +extern struct sway_input_manager *input_manager; + +struct sway_input_device { + char *identifier; + struct wlr_input_device *wlr_device; + struct input_config *config; + struct wl_list link; +}; + +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 sway_input_manager *sway_input_manager_create( + struct sway_server *server); + +bool sway_input_manager_has_focus(struct sway_input_manager *input, + swayc_t *container); + +void sway_input_manager_set_focus(struct sway_input_manager *input, + swayc_t *container); + +void sway_input_manager_configure_xcursor(struct sway_input_manager *input); + +void sway_input_manager_apply_input_config(struct sway_input_manager *input, + struct input_config *input_config); + +void sway_input_manager_apply_seat_config(struct sway_input_manager *input, + struct seat_config *seat_config); + +#endif diff --git a/include/sway/input/keyboard.h b/include/sway/input/keyboard.h new file mode 100644 index 00000000..d9251f4c --- /dev/null +++ b/include/sway/input/keyboard.h @@ -0,0 +1,22 @@ +#ifndef _SWAY_INPUT_KEYBOARD_H +#define _SWAY_INPUT_KEYBOARD_H + +#include "sway/input/seat.h" + +struct sway_keyboard { + struct sway_seat_device *seat_device; + + struct xkb_keymap *keymap; + + struct wl_listener keyboard_key; + struct wl_listener keyboard_modifiers; +}; + +struct sway_keyboard *sway_keyboard_create(struct sway_seat *seat, + struct sway_seat_device *device); + +void sway_keyboard_configure(struct sway_keyboard *keyboard); + +void sway_keyboard_destroy(struct sway_keyboard *keyboard); + +#endif diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h new file mode 100644 index 00000000..d703f94c --- /dev/null +++ b/include/sway/input/seat.h @@ -0,0 +1,47 @@ +#ifndef _SWAY_INPUT_SEAT_H +#define _SWAY_INPUT_SEAT_H + +#include <wlr/types/wlr_seat.h> +#include "sway/input/input-manager.h" + +struct sway_seat_device { + struct sway_seat *sway_seat; + struct sway_input_device *input_device; + struct sway_keyboard *keyboard; + struct seat_attachment_config *attachment_config; + struct wl_list link; // sway_seat::devices +}; + +struct sway_seat { + struct wlr_seat *wlr_seat; + struct seat_config *config; + struct sway_cursor *cursor; + struct sway_input_manager *input; + swayc_t *focus; + + struct wl_listener focus_destroy; + + struct wl_list devices; // sway_seat_device::link + + struct wl_list link; // input_manager::seats +}; + +struct sway_seat *sway_seat_create(struct sway_input_manager *input, + const char *seat_name); + +void sway_seat_add_device(struct sway_seat *seat, + struct sway_input_device *device); + +void sway_seat_configure_device(struct sway_seat *seat, + struct sway_input_device *device); + +void sway_seat_remove_device(struct sway_seat *seat, + struct sway_input_device *device); + +void sway_seat_configure_xcursor(struct sway_seat *seat); + +void sway_seat_set_focus(struct sway_seat *seat, swayc_t *container); + +void sway_seat_set_config(struct sway_seat *seat, struct seat_config *seat_config); + +#endif diff --git a/include/sway/ipc-json.h b/include/sway/ipc-json.h index 9435b664..eef5a018 100644 --- a/include/sway/ipc-json.h +++ b/include/sway/ipc-json.h @@ -2,10 +2,12 @@ #define _SWAY_IPC_JSON_H #include <json-c/json.h> #include "sway/container.h" +#include "sway/input/input-manager.h" json_object *ipc_json_get_version(); json_object *ipc_json_describe_container(swayc_t *c); json_object *ipc_json_describe_container_recursive(swayc_t *c); +json_object *ipc_json_describe_input(struct sway_input_device *device); #endif diff --git a/include/sway/server.h b/include/sway/server.h index 3fa72e84..76a05476 100644 --- a/include/sway/server.h +++ b/include/sway/server.h @@ -22,7 +22,7 @@ struct sway_server { struct wlr_compositor *compositor; struct wlr_data_device_manager *data_device_manager; - struct sway_input *input; + struct sway_input_manager *input; struct wl_listener output_add; struct wl_listener output_remove; |