basic configuration

This commit is contained in:
Tony Crisci 2017-12-14 11:11:56 -05:00
parent c173d30b92
commit 92fef27eaa
15 changed files with 543 additions and 174 deletions

View file

@ -17,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,
@ -42,6 +43,7 @@ enum expected_args {
};
void input_cmd_apply(struct input_config *input);
void seat_cmd_apply(struct seat_config *seat);
struct cmd_results *checkarg(int argc, const char *name,
enum expected_args type, int val);
@ -111,6 +113,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;
@ -193,6 +196,8 @@ sway_cmd input_cmd_pointer_accel;
sway_cmd input_cmd_scroll_method;
sway_cmd input_cmd_tap;
sway_cmd seat_cmd_attach;
sway_cmd cmd_ipc_cmd;
sway_cmd cmd_ipc_events;
sway_cmd cmd_ipc_event_cmd;

View file

@ -69,7 +69,22 @@ struct input_config {
bool capturable;
struct wlr_box region;
char *seat;
};
/**
* 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;
list_t *attachments; // list of seat_attachment configs
};
/**
@ -260,6 +275,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 +374,16 @@ 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);
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);
int output_name_cmp(const void *item, const void *data);
void merge_output_config(struct output_config *dst, struct output_config *src);
/** Sets up a WLC output handle based on a given output_config.

View file

@ -6,6 +6,7 @@
#include "list.h"
extern struct input_config *current_input_config;
extern struct seat_config *current_seat_config;
/**
* The global singleton input manager
@ -17,7 +18,6 @@ struct sway_input_device {
char *identifier;
struct wlr_input_device *wlr_device;
struct input_config *config;
struct sway_keyboard *keyboard; // managed by the seat
struct wl_list link;
};
@ -40,7 +40,10 @@ void sway_input_manager_set_focus(struct sway_input_manager *input,
void sway_input_manager_configure_xcursor(struct sway_input_manager *input);
void sway_input_manager_apply_config(struct sway_input_manager *input,
struct input_config *config);
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

View file

@ -1,15 +1,18 @@
#include "sway/input/seat.h"
struct sway_keyboard {
struct sway_seat *seat;
struct sway_input_device *device;
struct sway_seat_device *seat_device;
struct wl_list link; // sway_seat::keyboards
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_input_device *device);
struct sway_seat_device *device);
void sway_keyboard_configure(struct sway_keyboard *keyboard);
void sway_keyboard_destroy(struct sway_keyboard *keyboard);

View file

@ -4,16 +4,25 @@
#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 *seat;
struct wlr_seat *wlr_seat;
struct seat_config *config;
struct sway_cursor *cursor;
struct sway_input_manager *input;
swayc_t *focus;
list_t *devices;
struct wl_listener focus_destroy;
struct wl_list devices; // sway_seat_device::link
struct wl_list link; // input_manager::seats
};
@ -23,6 +32,9 @@ struct sway_seat *sway_seat_create(struct sway_input_manager *input,
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);
@ -30,4 +42,6 @@ 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