diff options
author | Tony Crisci <tony@dubstepdish.com> | 2018-04-02 16:09:27 -0400 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2018-04-02 16:09:27 -0400 |
commit | d434da563239c43c5fe417ce83b23b417f2ab635 (patch) | |
tree | e154daaf43c42d11c5afb8b7739ae6b52dd01215 /include | |
parent | fix workspace splits (diff) | |
parent | Merge pull request #1699 from acrisci/seat-fixes (diff) | |
download | sway-d434da563239c43c5fe417ce83b23b417f2ab635.tar.gz sway-d434da563239c43c5fe417ce83b23b417f2ab635.tar.zst sway-d434da563239c43c5fe417ce83b23b417f2ab635.zip |
Merge branch 'wlroots' into split-containers
Diffstat (limited to 'include')
-rw-r--r-- | include/sway/config.h | 27 | ||||
-rw-r--r-- | include/sway/input/input-manager.h | 23 | ||||
-rw-r--r-- | include/sway/input/seat.h | 28 | ||||
-rw-r--r-- | include/swaybar/ipc.h | 2 | ||||
-rw-r--r-- | include/swaybar/status_line.h | 53 |
5 files changed, 104 insertions, 29 deletions
diff --git a/include/sway/config.h b/include/sway/config.h index 03b51948..91f772b5 100644 --- a/include/sway/config.h +++ b/include/sway/config.h | |||
@@ -377,6 +377,7 @@ void free_config(struct sway_config *config); | |||
377 | void config_clear_handler_context(struct sway_config *config); | 377 | void config_clear_handler_context(struct sway_config *config); |
378 | 378 | ||
379 | void free_sway_variable(struct sway_variable *var); | 379 | void free_sway_variable(struct sway_variable *var); |
380 | |||
380 | /** | 381 | /** |
381 | * Does variable replacement for a string based on the config's currently loaded variables. | 382 | * Does variable replacement for a string based on the config's currently loaded variables. |
382 | */ | 383 | */ |
@@ -385,44 +386,68 @@ char *do_var_replacement(char *str); | |||
385 | struct cmd_results *check_security_config(); | 386 | struct cmd_results *check_security_config(); |
386 | 387 | ||
387 | int input_identifier_cmp(const void *item, const void *data); | 388 | int input_identifier_cmp(const void *item, const void *data); |
389 | |||
388 | struct input_config *new_input_config(const char* identifier); | 390 | struct input_config *new_input_config(const char* identifier); |
391 | |||
389 | void merge_input_config(struct input_config *dst, struct input_config *src); | 392 | void merge_input_config(struct input_config *dst, struct input_config *src); |
393 | |||
390 | struct input_config *copy_input_config(struct input_config *ic); | 394 | struct input_config *copy_input_config(struct input_config *ic); |
395 | |||
391 | void free_input_config(struct input_config *ic); | 396 | void free_input_config(struct input_config *ic); |
397 | |||
392 | void apply_input_config(struct input_config *input); | 398 | void apply_input_config(struct input_config *input); |
393 | 399 | ||
394 | int seat_name_cmp(const void *item, const void *data); | 400 | int seat_name_cmp(const void *item, const void *data); |
401 | |||
395 | struct seat_config *new_seat_config(const char* name); | 402 | struct seat_config *new_seat_config(const char* name); |
403 | |||
396 | void merge_seat_config(struct seat_config *dst, struct seat_config *src); | 404 | void merge_seat_config(struct seat_config *dst, struct seat_config *src); |
405 | |||
397 | struct seat_config *copy_seat_config(struct seat_config *seat); | 406 | struct seat_config *copy_seat_config(struct seat_config *seat); |
407 | |||
398 | void free_seat_config(struct seat_config *ic); | 408 | void free_seat_config(struct seat_config *ic); |
409 | |||
399 | struct seat_attachment_config *seat_attachment_config_new(); | 410 | struct seat_attachment_config *seat_attachment_config_new(); |
411 | |||
400 | struct seat_attachment_config *seat_config_get_attachment( | 412 | struct seat_attachment_config *seat_config_get_attachment( |
401 | struct seat_config *seat_config, char *identifier); | 413 | struct seat_config *seat_config, char *identifier); |
414 | |||
402 | void apply_seat_config(struct seat_config *seat); | 415 | void apply_seat_config(struct seat_config *seat); |
403 | 416 | ||
404 | int output_name_cmp(const void *item, const void *data); | 417 | int output_name_cmp(const void *item, const void *data); |
418 | |||
405 | void output_get_identifier(char *identifier, size_t len, | 419 | void output_get_identifier(char *identifier, size_t len, |
406 | struct sway_output *output); | 420 | struct sway_output *output); |
421 | |||
407 | struct output_config *new_output_config(const char *name); | 422 | struct output_config *new_output_config(const char *name); |
423 | |||
408 | void merge_output_config(struct output_config *dst, struct output_config *src); | 424 | void merge_output_config(struct output_config *dst, struct output_config *src); |
425 | |||
409 | void apply_output_config(struct output_config *oc, | 426 | void apply_output_config(struct output_config *oc, |
410 | struct sway_container *output); | 427 | struct sway_container *output); |
428 | |||
411 | void free_output_config(struct output_config *oc); | 429 | void free_output_config(struct output_config *oc); |
412 | 430 | ||
413 | int workspace_output_cmp_workspace(const void *a, const void *b); | 431 | int workspace_output_cmp_workspace(const void *a, const void *b); |
414 | 432 | ||
415 | int sway_binding_cmp(const void *a, const void *b); | 433 | int sway_binding_cmp(const void *a, const void *b); |
434 | |||
416 | int sway_binding_cmp_qsort(const void *a, const void *b); | 435 | int sway_binding_cmp_qsort(const void *a, const void *b); |
436 | |||
417 | int sway_binding_cmp_keys(const void *a, const void *b); | 437 | int sway_binding_cmp_keys(const void *a, const void *b); |
438 | |||
418 | void free_sway_binding(struct sway_binding *sb); | 439 | void free_sway_binding(struct sway_binding *sb); |
440 | |||
419 | struct sway_binding *sway_binding_dup(struct sway_binding *sb); | 441 | struct sway_binding *sway_binding_dup(struct sway_binding *sb); |
420 | 442 | ||
421 | /* Bar stuff */ | ||
422 | void load_swaybars(); | 443 | void load_swaybars(); |
444 | |||
423 | void invoke_swaybar(struct bar_config *bar); | 445 | void invoke_swaybar(struct bar_config *bar); |
446 | |||
424 | void terminate_swaybg(pid_t pid); | 447 | void terminate_swaybg(pid_t pid); |
448 | |||
425 | struct bar_config *default_bar_config(void); | 449 | struct bar_config *default_bar_config(void); |
450 | |||
426 | void free_bar_config(struct bar_config *bar); | 451 | void free_bar_config(struct bar_config *bar); |
427 | 452 | ||
428 | /* Global config singleton. */ | 453 | /* Global config singleton. */ |
diff --git a/include/sway/input/input-manager.h b/include/sway/input/input-manager.h index c6c73dba..8e39a4a7 100644 --- a/include/sway/input/input-manager.h +++ b/include/sway/input/input-manager.h | |||
@@ -14,7 +14,6 @@ extern struct sway_input_manager *input_manager; | |||
14 | struct sway_input_device { | 14 | struct sway_input_device { |
15 | char *identifier; | 15 | char *identifier; |
16 | struct wlr_input_device *wlr_device; | 16 | struct wlr_input_device *wlr_device; |
17 | struct input_config *config; | ||
18 | struct wl_list link; | 17 | struct wl_list link; |
19 | struct wl_listener device_destroy; | 18 | struct wl_listener device_destroy; |
20 | }; | 19 | }; |
@@ -27,30 +26,34 @@ struct sway_input_manager { | |||
27 | struct wl_listener new_input; | 26 | struct wl_listener new_input; |
28 | }; | 27 | }; |
29 | 28 | ||
30 | struct sway_input_manager *sway_input_manager_create( | 29 | struct sway_input_manager *input_manager_create(struct sway_server *server); |
31 | struct sway_server *server); | ||
32 | 30 | ||
33 | bool sway_input_manager_has_focus(struct sway_input_manager *input, | 31 | bool input_manager_has_focus(struct sway_input_manager *input, |
34 | struct sway_container *container); | 32 | struct sway_container *container); |
35 | 33 | ||
36 | void sway_input_manager_set_focus(struct sway_input_manager *input, | 34 | void input_manager_set_focus(struct sway_input_manager *input, |
37 | struct sway_container *container); | 35 | struct sway_container *container); |
38 | 36 | ||
39 | void sway_input_manager_configure_xcursor(struct sway_input_manager *input); | 37 | void input_manager_configure_xcursor(struct sway_input_manager *input); |
40 | 38 | ||
41 | void sway_input_manager_apply_input_config(struct sway_input_manager *input, | 39 | void input_manager_apply_input_config(struct sway_input_manager *input, |
42 | struct input_config *input_config); | 40 | struct input_config *input_config); |
43 | 41 | ||
44 | void sway_input_manager_apply_seat_config(struct sway_input_manager *input, | 42 | void input_manager_apply_seat_config(struct sway_input_manager *input, |
45 | struct seat_config *seat_config); | 43 | struct seat_config *seat_config); |
46 | 44 | ||
47 | struct sway_seat *sway_input_manager_get_default_seat( | 45 | struct sway_seat *input_manager_get_default_seat( |
48 | struct sway_input_manager *input); | 46 | struct sway_input_manager *input); |
49 | 47 | ||
50 | struct sway_seat *input_manager_get_seat(struct sway_input_manager *input, | 48 | struct sway_seat *input_manager_get_seat(struct sway_input_manager *input, |
51 | const char *seat_name); | 49 | const char *seat_name); |
52 | 50 | ||
53 | /** Gets the last seat the user interacted with */ | 51 | /** |
52 | * Gets the last seat the user interacted with | ||
53 | */ | ||
54 | struct sway_seat *input_manager_current_seat(struct sway_input_manager *input); | 54 | struct sway_seat *input_manager_current_seat(struct sway_input_manager *input); |
55 | 55 | ||
56 | struct input_config *input_device_get_config(struct sway_input_device *device); | ||
57 | |||
58 | |||
56 | #endif | 59 | #endif |
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h index 38795e14..c780a52b 100644 --- a/include/sway/input/seat.h +++ b/include/sway/input/seat.h | |||
@@ -8,7 +8,6 @@ struct sway_seat_device { | |||
8 | struct sway_seat *sway_seat; | 8 | struct sway_seat *sway_seat; |
9 | struct sway_input_device *input_device; | 9 | struct sway_input_device *input_device; |
10 | struct sway_keyboard *keyboard; | 10 | struct sway_keyboard *keyboard; |
11 | struct seat_attachment_config *attachment_config; | ||
12 | struct wl_list link; // sway_seat::devices | 11 | struct wl_list link; // sway_seat::devices |
13 | }; | 12 | }; |
14 | 13 | ||
@@ -23,7 +22,6 @@ struct sway_seat_container { | |||
23 | 22 | ||
24 | struct sway_seat { | 23 | struct sway_seat { |
25 | struct wlr_seat *wlr_seat; | 24 | struct wlr_seat *wlr_seat; |
26 | struct seat_config *config; | ||
27 | struct sway_cursor *cursor; | 25 | struct sway_cursor *cursor; |
28 | struct sway_input_manager *input; | 26 | struct sway_input_manager *input; |
29 | 27 | ||
@@ -38,28 +36,28 @@ struct sway_seat { | |||
38 | struct wl_list link; // input_manager::seats | 36 | struct wl_list link; // input_manager::seats |
39 | }; | 37 | }; |
40 | 38 | ||
41 | struct sway_seat *sway_seat_create(struct sway_input_manager *input, | 39 | struct sway_seat *seat_create(struct sway_input_manager *input, |
42 | const char *seat_name); | 40 | const char *seat_name); |
43 | 41 | ||
44 | void sway_seat_destroy(struct sway_seat *seat); | 42 | void seat_destroy(struct sway_seat *seat); |
45 | 43 | ||
46 | void sway_seat_add_device(struct sway_seat *seat, | 44 | void seat_add_device(struct sway_seat *seat, |
47 | struct sway_input_device *device); | 45 | struct sway_input_device *device); |
48 | 46 | ||
49 | void sway_seat_configure_device(struct sway_seat *seat, | 47 | void seat_configure_device(struct sway_seat *seat, |
50 | struct sway_input_device *device); | 48 | struct sway_input_device *device); |
51 | 49 | ||
52 | void sway_seat_remove_device(struct sway_seat *seat, | 50 | void seat_remove_device(struct sway_seat *seat, |
53 | struct sway_input_device *device); | 51 | struct sway_input_device *device); |
54 | 52 | ||
55 | void sway_seat_configure_xcursor(struct sway_seat *seat); | 53 | void seat_configure_xcursor(struct sway_seat *seat); |
56 | 54 | ||
57 | void sway_seat_set_focus(struct sway_seat *seat, struct sway_container *container); | 55 | void seat_set_focus(struct sway_seat *seat, struct sway_container *container); |
58 | 56 | ||
59 | void sway_seat_set_focus_warp(struct sway_seat *seat, | 57 | void seat_set_focus_warp(struct sway_seat *seat, |
60 | struct sway_container *container, bool warp); | 58 | struct sway_container *container, bool warp); |
61 | 59 | ||
62 | struct sway_container *sway_seat_get_focus(struct sway_seat *seat); | 60 | struct sway_container *seat_get_focus(struct sway_seat *seat); |
63 | 61 | ||
64 | /** | 62 | /** |
65 | * Return the last container to be focused for the seat (or the most recently | 63 | * Return the last container to be focused for the seat (or the most recently |
@@ -70,12 +68,14 @@ struct sway_container *sway_seat_get_focus(struct sway_seat *seat); | |||
70 | * is destroyed, or focus moves to a container with children and we need to | 68 | * is destroyed, or focus moves to a container with children and we need to |
71 | * descend into the next leaf in focus order. | 69 | * descend into the next leaf in focus order. |
72 | */ | 70 | */ |
73 | struct sway_container *sway_seat_get_focus_inactive(struct sway_seat *seat, | 71 | struct sway_container *seat_get_focus_inactive(struct sway_seat *seat, |
74 | struct sway_container *container); | 72 | struct sway_container *container); |
75 | 73 | ||
76 | struct sway_container *sway_seat_get_focus_by_type(struct sway_seat *seat, | 74 | struct sway_container *seat_get_focus_by_type(struct sway_seat *seat, |
77 | struct sway_container *container, enum sway_container_type type); | 75 | struct sway_container *container, enum sway_container_type type); |
78 | 76 | ||
79 | void sway_seat_set_config(struct sway_seat *seat, struct seat_config *seat_config); | 77 | void seat_apply_config(struct sway_seat *seat, struct seat_config *seat_config); |
78 | |||
79 | struct seat_config *seat_get_config(struct sway_seat *seat); | ||
80 | 80 | ||
81 | #endif | 81 | #endif |
diff --git a/include/swaybar/ipc.h b/include/swaybar/ipc.h index 6ea7c4d6..a1696bcf 100644 --- a/include/swaybar/ipc.h +++ b/include/swaybar/ipc.h | |||
@@ -4,7 +4,7 @@ | |||
4 | #include "swaybar/bar.h" | 4 | #include "swaybar/bar.h" |
5 | 5 | ||
6 | void ipc_initialize(struct swaybar *bar, const char *bar_id); | 6 | void ipc_initialize(struct swaybar *bar, const char *bar_id); |
7 | bool handle_ipc_event(struct swaybar *bar); | 7 | bool handle_ipc_readable(struct swaybar *bar); |
8 | void ipc_get_workspaces(struct swaybar *bar); | 8 | void ipc_get_workspaces(struct swaybar *bar); |
9 | void ipc_send_workspace_command(struct swaybar *bar, const char *ws); | 9 | void ipc_send_workspace_command(struct swaybar *bar, const char *ws); |
10 | 10 | ||
diff --git a/include/swaybar/status_line.h b/include/swaybar/status_line.h index 6c595df0..3538f49c 100644 --- a/include/swaybar/status_line.h +++ b/include/swaybar/status_line.h | |||
@@ -7,10 +7,52 @@ | |||
7 | 7 | ||
8 | enum status_protocol { | 8 | enum status_protocol { |
9 | PROTOCOL_UNDEF, | 9 | PROTOCOL_UNDEF, |
10 | PROTOCOL_ERROR, | ||
10 | PROTOCOL_TEXT, | 11 | PROTOCOL_TEXT, |
11 | PROTOCOL_I3BAR, | 12 | PROTOCOL_I3BAR, |
12 | }; | 13 | }; |
13 | 14 | ||
15 | struct text_protocol_state { | ||
16 | char *buffer; | ||
17 | size_t buffer_size; | ||
18 | }; | ||
19 | |||
20 | enum json_node_type { | ||
21 | JSON_NODE_UNKNOWN, | ||
22 | JSON_NODE_ARRAY, | ||
23 | JSON_NODE_STRING, | ||
24 | }; | ||
25 | |||
26 | struct i3bar_protocol_state { | ||
27 | bool click_events; | ||
28 | char *buffer; | ||
29 | size_t buffer_size; | ||
30 | size_t buffer_index; | ||
31 | const char *current_node; | ||
32 | bool escape; | ||
33 | size_t depth; | ||
34 | enum json_node_type nodes[16]; | ||
35 | }; | ||
36 | |||
37 | struct i3bar_block { | ||
38 | struct wl_list link; | ||
39 | char *full_text, *short_text, *align; | ||
40 | bool urgent; | ||
41 | uint32_t *color; | ||
42 | int min_width; | ||
43 | char *name, *instance; | ||
44 | bool separator; | ||
45 | int separator_block_width; | ||
46 | bool markup; | ||
47 | // Airblader features | ||
48 | uint32_t background; | ||
49 | uint32_t border; | ||
50 | int border_top; | ||
51 | int border_bottom; | ||
52 | int border_left; | ||
53 | int border_right; | ||
54 | }; | ||
55 | |||
14 | struct status_line { | 56 | struct status_line { |
15 | pid_t pid; | 57 | pid_t pid; |
16 | int read_fd, write_fd; | 58 | int read_fd, write_fd; |
@@ -18,13 +60,18 @@ struct status_line { | |||
18 | 60 | ||
19 | enum status_protocol protocol; | 61 | enum status_protocol protocol; |
20 | const char *text; | 62 | const char *text; |
63 | struct wl_list blocks; // i3bar_block::link | ||
21 | 64 | ||
22 | char *buffer; | 65 | struct text_protocol_state text_state; |
23 | size_t buffer_size; | 66 | struct i3bar_protocol_state i3bar_state; |
24 | }; | 67 | }; |
25 | 68 | ||
26 | struct status_line *status_line_init(char *cmd); | 69 | struct status_line *status_line_init(char *cmd); |
70 | void status_error(struct status_line *status, const char *text); | ||
71 | bool status_handle_readable(struct status_line *status); | ||
27 | void status_line_free(struct status_line *status); | 72 | void status_line_free(struct status_line *status); |
28 | bool handle_status_readable(struct status_line *status); | 73 | bool i3bar_handle_readable(struct status_line *status); |
74 | void i3bar_block_send_click(struct status_line *status, | ||
75 | struct i3bar_block *block, int x, int y, uint32_t button); | ||
29 | 76 | ||
30 | #endif | 77 | #endif |