diff options
Diffstat (limited to 'include/sway')
29 files changed, 517 insertions, 407 deletions
diff --git a/include/sway/commands.h b/include/sway/commands.h index 013a7b82..27058587 100644 --- a/include/sway/commands.h +++ b/include/sway/commands.h | |||
@@ -3,13 +3,14 @@ | |||
3 | 3 | ||
4 | #include <wlr/util/edges.h> | 4 | #include <wlr/util/edges.h> |
5 | #include "config.h" | 5 | #include "config.h" |
6 | #include "stringop.h" | ||
6 | 7 | ||
7 | struct sway_container; | 8 | struct sway_container; |
8 | 9 | ||
9 | typedef struct cmd_results *sway_cmd(int argc, char **argv); | 10 | typedef struct cmd_results *sway_cmd(int argc, char **argv); |
10 | 11 | ||
11 | struct cmd_handler { | 12 | struct cmd_handler { |
12 | char *command; | 13 | const char *command; |
13 | sway_cmd *handle; | 14 | sway_cmd *handle; |
14 | }; | 15 | }; |
15 | 16 | ||
@@ -46,7 +47,7 @@ enum expected_args { | |||
46 | struct cmd_results *checkarg(int argc, const char *name, | 47 | struct cmd_results *checkarg(int argc, const char *name, |
47 | enum expected_args type, int val); | 48 | enum expected_args type, int val); |
48 | 49 | ||
49 | const struct cmd_handler *find_handler(char *line, | 50 | const struct cmd_handler *find_handler(const char *line, |
50 | const struct cmd_handler *cmd_handlers, size_t handlers_size); | 51 | const struct cmd_handler *cmd_handlers, size_t handlers_size); |
51 | 52 | ||
52 | /** | 53 | /** |
@@ -76,7 +77,7 @@ struct cmd_results *config_commands_command(char *exec); | |||
76 | /** | 77 | /** |
77 | * Allocates a cmd_results object. | 78 | * Allocates a cmd_results object. |
78 | */ | 79 | */ |
79 | struct cmd_results *cmd_results_new(enum cmd_status status, const char *error, ...); | 80 | struct cmd_results *cmd_results_new(enum cmd_status status, const char *error, ...) _SWAY_ATTRIB_PRINTF(2, 3); |
80 | /** | 81 | /** |
81 | * Frees a cmd_results object. | 82 | * Frees a cmd_results object. |
82 | */ | 83 | */ |
@@ -159,12 +160,11 @@ sway_cmd cmd_new_float; | |||
159 | sway_cmd cmd_new_window; | 160 | sway_cmd cmd_new_window; |
160 | sway_cmd cmd_nop; | 161 | sway_cmd cmd_nop; |
161 | sway_cmd cmd_opacity; | 162 | sway_cmd cmd_opacity; |
162 | sway_cmd cmd_new_float; | ||
163 | sway_cmd cmd_new_window; | ||
164 | sway_cmd cmd_no_focus; | 163 | sway_cmd cmd_no_focus; |
165 | sway_cmd cmd_output; | 164 | sway_cmd cmd_output; |
166 | sway_cmd cmd_permit; | 165 | sway_cmd cmd_permit; |
167 | sway_cmd cmd_popup_during_fullscreen; | 166 | sway_cmd cmd_popup_during_fullscreen; |
167 | sway_cmd cmd_primary_selection; | ||
168 | sway_cmd cmd_reject; | 168 | sway_cmd cmd_reject; |
169 | sway_cmd cmd_reload; | 169 | sway_cmd cmd_reload; |
170 | sway_cmd cmd_rename; | 170 | sway_cmd cmd_rename; |
@@ -252,6 +252,7 @@ sway_cmd input_cmd_click_method; | |||
252 | sway_cmd input_cmd_drag; | 252 | sway_cmd input_cmd_drag; |
253 | sway_cmd input_cmd_drag_lock; | 253 | sway_cmd input_cmd_drag_lock; |
254 | sway_cmd input_cmd_dwt; | 254 | sway_cmd input_cmd_dwt; |
255 | sway_cmd input_cmd_dwtp; | ||
255 | sway_cmd input_cmd_events; | 256 | sway_cmd input_cmd_events; |
256 | sway_cmd input_cmd_left_handed; | 257 | sway_cmd input_cmd_left_handed; |
257 | sway_cmd input_cmd_map_from_region; | 258 | sway_cmd input_cmd_map_from_region; |
@@ -260,10 +261,12 @@ sway_cmd input_cmd_map_to_region; | |||
260 | sway_cmd input_cmd_middle_emulation; | 261 | sway_cmd input_cmd_middle_emulation; |
261 | sway_cmd input_cmd_natural_scroll; | 262 | sway_cmd input_cmd_natural_scroll; |
262 | sway_cmd input_cmd_pointer_accel; | 263 | sway_cmd input_cmd_pointer_accel; |
264 | sway_cmd input_cmd_rotation_angle; | ||
263 | sway_cmd input_cmd_scroll_factor; | 265 | sway_cmd input_cmd_scroll_factor; |
264 | sway_cmd input_cmd_repeat_delay; | 266 | sway_cmd input_cmd_repeat_delay; |
265 | sway_cmd input_cmd_repeat_rate; | 267 | sway_cmd input_cmd_repeat_rate; |
266 | sway_cmd input_cmd_scroll_button; | 268 | sway_cmd input_cmd_scroll_button; |
269 | sway_cmd input_cmd_scroll_button_lock; | ||
267 | sway_cmd input_cmd_scroll_method; | 270 | sway_cmd input_cmd_scroll_method; |
268 | sway_cmd input_cmd_tap; | 271 | sway_cmd input_cmd_tap; |
269 | sway_cmd input_cmd_tap_button_map; | 272 | sway_cmd input_cmd_tap_button_map; |
@@ -294,6 +297,7 @@ sway_cmd output_cmd_scale_filter; | |||
294 | sway_cmd output_cmd_subpixel; | 297 | sway_cmd output_cmd_subpixel; |
295 | sway_cmd output_cmd_toggle; | 298 | sway_cmd output_cmd_toggle; |
296 | sway_cmd output_cmd_transform; | 299 | sway_cmd output_cmd_transform; |
300 | sway_cmd output_cmd_unplug; | ||
297 | 301 | ||
298 | sway_cmd seat_cmd_attach; | 302 | sway_cmd seat_cmd_attach; |
299 | sway_cmd seat_cmd_cursor; | 303 | sway_cmd seat_cmd_cursor; |
diff --git a/include/sway/config.h b/include/sway/config.h index 68c06846..5ccc3e77 100644 --- a/include/sway/config.h +++ b/include/sway/config.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #include "../include/config.h" | 12 | #include "../include/config.h" |
13 | #include "gesture.h" | 13 | #include "gesture.h" |
14 | #include "list.h" | 14 | #include "list.h" |
15 | #include "stringop.h" | ||
15 | #include "swaynag.h" | 16 | #include "swaynag.h" |
16 | #include "tree/container.h" | 17 | #include "tree/container.h" |
17 | #include "sway/input/tablet.h" | 18 | #include "sway/input/tablet.h" |
@@ -150,14 +151,17 @@ struct input_config { | |||
150 | int drag; | 151 | int drag; |
151 | int drag_lock; | 152 | int drag_lock; |
152 | int dwt; | 153 | int dwt; |
154 | int dwtp; | ||
153 | int left_handed; | 155 | int left_handed; |
154 | int middle_emulation; | 156 | int middle_emulation; |
155 | int natural_scroll; | 157 | int natural_scroll; |
156 | float pointer_accel; | 158 | float pointer_accel; |
159 | float rotation_angle; | ||
157 | float scroll_factor; | 160 | float scroll_factor; |
158 | int repeat_delay; | 161 | int repeat_delay; |
159 | int repeat_rate; | 162 | int repeat_rate; |
160 | int scroll_button; | 163 | int scroll_button; |
164 | int scroll_button_lock; | ||
161 | int scroll_method; | 165 | int scroll_method; |
162 | int send_events; | 166 | int send_events; |
163 | int tap; | 167 | int tap; |
@@ -288,6 +292,14 @@ struct output_config { | |||
288 | }; | 292 | }; |
289 | 293 | ||
290 | /** | 294 | /** |
295 | * An output config pre-matched to an output | ||
296 | */ | ||
297 | struct matched_output_config { | ||
298 | struct sway_output *output; | ||
299 | struct output_config *config; | ||
300 | }; | ||
301 | |||
302 | /** | ||
291 | * Stores size of gaps for each side | 303 | * Stores size of gaps for each side |
292 | */ | 304 | */ |
293 | struct side_gaps { | 305 | struct side_gaps { |
@@ -529,6 +541,7 @@ struct sway_config { | |||
529 | bool auto_back_and_forth; | 541 | bool auto_back_and_forth; |
530 | bool show_marks; | 542 | bool show_marks; |
531 | enum alignment title_align; | 543 | enum alignment title_align; |
544 | bool primary_selection; | ||
532 | 545 | ||
533 | bool tiling_drag; | 546 | bool tiling_drag; |
534 | int tiling_drag_threshold; | 547 | int tiling_drag_threshold; |
@@ -622,7 +635,7 @@ void run_deferred_bindings(void); | |||
622 | /** | 635 | /** |
623 | * Adds a warning entry to the swaynag instance used for errors. | 636 | * Adds a warning entry to the swaynag instance used for errors. |
624 | */ | 637 | */ |
625 | void config_add_swaynag_warning(char *fmt, ...); | 638 | void config_add_swaynag_warning(char *fmt, ...) _SWAY_ATTRIB_PRINTF(1, 2); |
626 | 639 | ||
627 | /** | 640 | /** |
628 | * Free config struct | 641 | * Free config struct |
@@ -675,20 +688,25 @@ const char *sway_output_scale_filter_to_string(enum scale_filter_mode scale_filt | |||
675 | 688 | ||
676 | struct output_config *new_output_config(const char *name); | 689 | struct output_config *new_output_config(const char *name); |
677 | 690 | ||
678 | void merge_output_config(struct output_config *dst, struct output_config *src); | 691 | bool apply_output_configs(struct matched_output_config *configs, |
692 | size_t configs_len, bool test_only, bool degrade_to_off); | ||
679 | 693 | ||
680 | bool apply_output_config(struct output_config *oc, struct sway_output *output); | 694 | void apply_all_output_configs(void); |
681 | 695 | ||
682 | bool test_output_config(struct output_config *oc, struct sway_output *output); | 696 | void sort_output_configs_by_priority(struct matched_output_config *configs, |
697 | size_t configs_len); | ||
683 | 698 | ||
684 | struct output_config *store_output_config(struct output_config *oc); | 699 | /** |
700 | * store_output_config stores a new output config. An output may be matched by | ||
701 | * three different config types, in order of precedence: Identifier, name and | ||
702 | * wildcard. When storing a config type of lower precedence, assume that the | ||
703 | * user wants the config to take immediate effect by superseding (clearing) the | ||
704 | * same values from higher presedence configuration. | ||
705 | */ | ||
706 | void store_output_config(struct output_config *oc); | ||
685 | 707 | ||
686 | struct output_config *find_output_config(struct sway_output *output); | 708 | struct output_config *find_output_config(struct sway_output *output); |
687 | 709 | ||
688 | void apply_output_config_to_outputs(struct output_config *oc); | ||
689 | |||
690 | void reset_outputs(void); | ||
691 | |||
692 | void free_output_config(struct output_config *oc); | 710 | void free_output_config(struct output_config *oc); |
693 | 711 | ||
694 | bool spawn_swaybg(void); | 712 | bool spawn_swaybg(void); |
@@ -718,7 +736,7 @@ void free_workspace_config(struct workspace_config *wsc); | |||
718 | /** | 736 | /** |
719 | * Updates the value of config->font_height based on the metrics for title's | 737 | * Updates the value of config->font_height based on the metrics for title's |
720 | * font as reported by pango. | 738 | * font as reported by pango. |
721 | * | 739 | * |
722 | * If the height has changed, all containers will be rearranged to take on the | 740 | * If the height has changed, all containers will be rearranged to take on the |
723 | * new size. | 741 | * new size. |
724 | */ | 742 | */ |
diff --git a/include/sway/criteria.h b/include/sway/criteria.h index 59f57f94..ae546821 100644 --- a/include/sway/criteria.h +++ b/include/sway/criteria.h | |||
@@ -7,6 +7,10 @@ | |||
7 | #include "list.h" | 7 | #include "list.h" |
8 | #include "tree/view.h" | 8 | #include "tree/view.h" |
9 | 9 | ||
10 | #if WLR_HAS_XWAYLAND | ||
11 | #include "sway/xwayland.h" | ||
12 | #endif | ||
13 | |||
10 | enum criteria_type { | 14 | enum criteria_type { |
11 | CT_COMMAND = 1 << 0, | 15 | CT_COMMAND = 1 << 0, |
12 | CT_ASSIGN_OUTPUT = 1 << 1, | 16 | CT_ASSIGN_OUTPUT = 1 << 1, |
@@ -36,13 +40,14 @@ struct criteria { | |||
36 | struct pattern *app_id; | 40 | struct pattern *app_id; |
37 | struct pattern *con_mark; | 41 | struct pattern *con_mark; |
38 | uint32_t con_id; // internal ID | 42 | uint32_t con_id; // internal ID |
39 | #if HAVE_XWAYLAND | 43 | #if WLR_HAS_XWAYLAND |
40 | struct pattern *class; | 44 | struct pattern *class; |
41 | uint32_t id; // X11 window ID | 45 | uint32_t id; // X11 window ID |
42 | struct pattern *instance; | 46 | struct pattern *instance; |
43 | struct pattern *window_role; | 47 | struct pattern *window_role; |
44 | enum atom_name window_type; | 48 | enum atom_name window_type; |
45 | #endif | 49 | #endif |
50 | bool all; | ||
46 | bool floating; | 51 | bool floating; |
47 | bool tiling; | 52 | bool tiling; |
48 | char urgent; // 'l' for latest or 'o' for oldest | 53 | char urgent; // 'l' for latest or 'o' for oldest |
diff --git a/include/sway/desktop.h b/include/sway/desktop.h deleted file mode 100644 index 7f2f5b3e..00000000 --- a/include/sway/desktop.h +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | #include <wlr/types/wlr_compositor.h> | ||
2 | |||
3 | struct sway_container; | ||
4 | struct sway_view; | ||
5 | |||
6 | void desktop_damage_surface(struct wlr_surface *surface, double lx, double ly, | ||
7 | bool whole); | ||
8 | |||
9 | void desktop_damage_whole_container(struct sway_container *con); | ||
10 | |||
11 | void desktop_damage_box(struct wlr_box *box); | ||
12 | |||
13 | void desktop_damage_view(struct sway_view *view); | ||
diff --git a/include/sway/desktop/idle_inhibit_v1.h b/include/sway/desktop/idle_inhibit_v1.h index 58d54c68..84cc666d 100644 --- a/include/sway/desktop/idle_inhibit_v1.h +++ b/include/sway/desktop/idle_inhibit_v1.h | |||
@@ -1,8 +1,6 @@ | |||
1 | #ifndef _SWAY_DESKTOP_IDLE_INHIBIT_V1_H | 1 | #ifndef _SWAY_DESKTOP_IDLE_INHIBIT_V1_H |
2 | #define _SWAY_DESKTOP_IDLE_INHIBIT_V1_H | 2 | #define _SWAY_DESKTOP_IDLE_INHIBIT_V1_H |
3 | #include <wlr/types/wlr_idle_inhibit_v1.h> | 3 | #include <wlr/types/wlr_idle_inhibit_v1.h> |
4 | #include <wlr/types/wlr_idle.h> | ||
5 | #include "sway/server.h" | ||
6 | 4 | ||
7 | enum sway_idle_inhibit_mode { | 5 | enum sway_idle_inhibit_mode { |
8 | INHIBIT_IDLE_APPLICATION, // Application set inhibitor (when visible) | 6 | INHIBIT_IDLE_APPLICATION, // Application set inhibitor (when visible) |
@@ -16,12 +14,9 @@ struct sway_idle_inhibit_manager_v1 { | |||
16 | struct wlr_idle_inhibit_manager_v1 *wlr_manager; | 14 | struct wlr_idle_inhibit_manager_v1 *wlr_manager; |
17 | struct wl_listener new_idle_inhibitor_v1; | 15 | struct wl_listener new_idle_inhibitor_v1; |
18 | struct wl_list inhibitors; | 16 | struct wl_list inhibitors; |
19 | |||
20 | struct wlr_idle *idle; | ||
21 | }; | 17 | }; |
22 | 18 | ||
23 | struct sway_idle_inhibitor_v1 { | 19 | struct sway_idle_inhibitor_v1 { |
24 | struct sway_idle_inhibit_manager_v1 *manager; | ||
25 | struct wlr_idle_inhibitor_v1 *wlr_inhibitor; | 20 | struct wlr_idle_inhibitor_v1 *wlr_inhibitor; |
26 | struct sway_view *view; | 21 | struct sway_view *view; |
27 | enum sway_idle_inhibit_mode mode; | 22 | enum sway_idle_inhibit_mode mode; |
@@ -33,8 +28,7 @@ struct sway_idle_inhibitor_v1 { | |||
33 | bool sway_idle_inhibit_v1_is_active( | 28 | bool sway_idle_inhibit_v1_is_active( |
34 | struct sway_idle_inhibitor_v1 *inhibitor); | 29 | struct sway_idle_inhibitor_v1 *inhibitor); |
35 | 30 | ||
36 | void sway_idle_inhibit_v1_check_active( | 31 | void sway_idle_inhibit_v1_check_active(void); |
37 | struct sway_idle_inhibit_manager_v1 *manager); | ||
38 | 32 | ||
39 | void sway_idle_inhibit_v1_user_inhibitor_register(struct sway_view *view, | 33 | void sway_idle_inhibit_v1_user_inhibitor_register(struct sway_view *view, |
40 | enum sway_idle_inhibit_mode mode); | 34 | enum sway_idle_inhibit_mode mode); |
@@ -48,6 +42,6 @@ struct sway_idle_inhibitor_v1 *sway_idle_inhibit_v1_application_inhibitor_for_vi | |||
48 | void sway_idle_inhibit_v1_user_inhibitor_destroy( | 42 | void sway_idle_inhibit_v1_user_inhibitor_destroy( |
49 | struct sway_idle_inhibitor_v1 *inhibitor); | 43 | struct sway_idle_inhibitor_v1 *inhibitor); |
50 | 44 | ||
51 | struct sway_idle_inhibit_manager_v1 *sway_idle_inhibit_manager_v1_create( | 45 | bool sway_idle_inhibit_manager_v1_init(void); |
52 | struct wl_display *wl_display, struct wlr_idle *idle); | 46 | |
53 | #endif | 47 | #endif |
diff --git a/include/sway/desktop/launcher.h b/include/sway/desktop/launcher.h new file mode 100644 index 00000000..412068a9 --- /dev/null +++ b/include/sway/desktop/launcher.h | |||
@@ -0,0 +1,40 @@ | |||
1 | #ifndef _SWAY_LAUNCHER_H | ||
2 | #define _SWAY_LAUNCHER_H | ||
3 | |||
4 | #include <stdlib.h> | ||
5 | #include <wayland-server-core.h> | ||
6 | #include "sway/input/seat.h" | ||
7 | |||
8 | struct launcher_ctx { | ||
9 | pid_t pid; | ||
10 | char *fallback_name; | ||
11 | struct wlr_xdg_activation_token_v1 *token; | ||
12 | struct wl_listener token_destroy; | ||
13 | struct sway_seat *seat; | ||
14 | struct wl_listener seat_destroy; | ||
15 | |||
16 | bool activated; | ||
17 | bool had_focused_surface; | ||
18 | |||
19 | struct sway_node *node; | ||
20 | struct wl_listener node_destroy; | ||
21 | |||
22 | struct wl_list link; // sway_server::pending_launcher_ctxs | ||
23 | }; | ||
24 | |||
25 | struct launcher_ctx *launcher_ctx_find_pid(pid_t pid); | ||
26 | |||
27 | struct sway_workspace *launcher_ctx_get_workspace(struct launcher_ctx *ctx); | ||
28 | |||
29 | void launcher_ctx_consume(struct launcher_ctx *ctx); | ||
30 | |||
31 | void launcher_ctx_destroy(struct launcher_ctx *ctx); | ||
32 | |||
33 | struct launcher_ctx *launcher_ctx_create_internal(void); | ||
34 | |||
35 | struct launcher_ctx *launcher_ctx_create( | ||
36 | struct wlr_xdg_activation_token_v1 *token, struct sway_node *node); | ||
37 | |||
38 | const char *launcher_ctx_get_token_name(struct launcher_ctx *ctx); | ||
39 | |||
40 | #endif | ||
diff --git a/include/sway/desktop/transaction.h b/include/sway/desktop/transaction.h index 7dd58ba8..dd7edb7a 100644 --- a/include/sway/desktop/transaction.h +++ b/include/sway/desktop/transaction.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _SWAY_TRANSACTION_H | 1 | #ifndef _SWAY_TRANSACTION_H |
2 | #define _SWAY_TRANSACTION_H | 2 | #define _SWAY_TRANSACTION_H |
3 | #include <stdint.h> | 3 | #include <stdint.h> |
4 | #include <stdbool.h> | ||
5 | #include <wlr/types/wlr_scene.h> | ||
4 | 6 | ||
5 | /** | 7 | /** |
6 | * Transactions enable us to perform atomic layout updates. | 8 | * Transactions enable us to perform atomic layout updates. |
@@ -38,8 +40,11 @@ void transaction_commit_dirty_client(void); | |||
38 | * Notify the transaction system that a view is ready for the new layout. | 40 | * Notify the transaction system that a view is ready for the new layout. |
39 | * | 41 | * |
40 | * When all views in the transaction are ready, the layout will be applied. | 42 | * When all views in the transaction are ready, the layout will be applied. |
43 | * | ||
44 | * A success boolean is returned denoting that this part of the transaction is | ||
45 | * ready. | ||
41 | */ | 46 | */ |
42 | void transaction_notify_view_ready_by_serial(struct sway_view *view, | 47 | bool transaction_notify_view_ready_by_serial(struct sway_view *view, |
43 | uint32_t serial); | 48 | uint32_t serial); |
44 | 49 | ||
45 | /** | 50 | /** |
@@ -47,8 +52,13 @@ void transaction_notify_view_ready_by_serial(struct sway_view *view, | |||
47 | * identifying the instruction by geometry rather than by serial. | 52 | * identifying the instruction by geometry rather than by serial. |
48 | * | 53 | * |
49 | * This is used by xwayland views, as they don't have serials. | 54 | * This is used by xwayland views, as they don't have serials. |
55 | * | ||
56 | * A success boolean is returned denoting that this part of the transaction is | ||
57 | * ready. | ||
50 | */ | 58 | */ |
51 | void transaction_notify_view_ready_by_geometry(struct sway_view *view, | 59 | bool transaction_notify_view_ready_by_geometry(struct sway_view *view, |
52 | double x, double y, int width, int height); | 60 | double x, double y, int width, int height); |
53 | 61 | ||
62 | void arrange_popups(struct wlr_scene_tree *popups); | ||
63 | |||
54 | #endif | 64 | #endif |
diff --git a/include/sway/input/cursor.h b/include/sway/input/cursor.h index 8a2898dd..527d0350 100644 --- a/include/sway/input/cursor.h +++ b/include/sway/input/cursor.h | |||
@@ -35,7 +35,6 @@ struct sway_cursor { | |||
35 | pixman_region32_t confine; // invalid if active_constraint == NULL | 35 | pixman_region32_t confine; // invalid if active_constraint == NULL |
36 | bool active_confine_requires_warp; | 36 | bool active_confine_requires_warp; |
37 | 37 | ||
38 | struct wlr_pointer_gestures_v1 *pointer_gestures; | ||
39 | struct wl_listener hold_begin; | 38 | struct wl_listener hold_begin; |
40 | struct wl_listener hold_end; | 39 | struct wl_listener hold_end; |
41 | struct wl_listener pinch_begin; | 40 | struct wl_listener pinch_begin; |
@@ -53,6 +52,7 @@ struct sway_cursor { | |||
53 | 52 | ||
54 | struct wl_listener touch_down; | 53 | struct wl_listener touch_down; |
55 | struct wl_listener touch_up; | 54 | struct wl_listener touch_up; |
55 | struct wl_listener touch_cancel; | ||
56 | struct wl_listener touch_motion; | 56 | struct wl_listener touch_motion; |
57 | struct wl_listener touch_frame; | 57 | struct wl_listener touch_frame; |
58 | bool simulating_pointer_from_touch; | 58 | bool simulating_pointer_from_touch; |
@@ -64,6 +64,7 @@ struct sway_cursor { | |||
64 | struct wl_listener tool_proximity; | 64 | struct wl_listener tool_proximity; |
65 | struct wl_listener tool_button; | 65 | struct wl_listener tool_button; |
66 | bool simulating_pointer_from_tool_tip; | 66 | bool simulating_pointer_from_tool_tip; |
67 | bool simulating_pointer_from_tool_button; | ||
67 | uint32_t tool_buttons; | 68 | uint32_t tool_buttons; |
68 | 69 | ||
69 | struct wl_listener request_set_cursor; | 70 | struct wl_listener request_set_cursor; |
@@ -107,9 +108,13 @@ void cursor_unhide(struct sway_cursor *cursor); | |||
107 | int cursor_get_timeout(struct sway_cursor *cursor); | 108 | int cursor_get_timeout(struct sway_cursor *cursor); |
108 | void cursor_notify_key_press(struct sway_cursor *cursor); | 109 | void cursor_notify_key_press(struct sway_cursor *cursor); |
109 | 110 | ||
111 | void pointer_motion(struct sway_cursor *cursor, uint32_t time_msec, | ||
112 | struct wlr_input_device *device, double dx, double dy, | ||
113 | double dx_unaccel, double dy_unaccel); | ||
114 | |||
110 | void dispatch_cursor_button(struct sway_cursor *cursor, | 115 | void dispatch_cursor_button(struct sway_cursor *cursor, |
111 | struct wlr_input_device *device, uint32_t time_msec, uint32_t button, | 116 | struct wlr_input_device *device, uint32_t time_msec, uint32_t button, |
112 | enum wlr_button_state state); | 117 | enum wl_pointer_button_state state); |
113 | 118 | ||
114 | void dispatch_cursor_axis(struct sway_cursor *cursor, | 119 | void dispatch_cursor_axis(struct sway_cursor *cursor, |
115 | struct wlr_pointer_axis_event *event); | 120 | struct wlr_pointer_axis_event *event); |
@@ -140,4 +145,6 @@ uint32_t get_mouse_button(const char *name, char **error); | |||
140 | 145 | ||
141 | const char *get_mouse_button_name(uint32_t button); | 146 | const char *get_mouse_button_name(uint32_t button); |
142 | 147 | ||
148 | void handle_request_set_cursor_shape(struct wl_listener *listener, void *data); | ||
149 | |||
143 | #endif | 150 | #endif |
diff --git a/include/sway/input/input-manager.h b/include/sway/input/input-manager.h index c9bd08f0..b014e18f 100644 --- a/include/sway/input/input-manager.h +++ b/include/sway/input/input-manager.h | |||
@@ -1,14 +1,15 @@ | |||
1 | #ifndef _SWAY_INPUT_INPUT_MANAGER_H | 1 | #ifndef _SWAY_INPUT_INPUT_MANAGER_H |
2 | #define _SWAY_INPUT_INPUT_MANAGER_H | 2 | #define _SWAY_INPUT_INPUT_MANAGER_H |
3 | #include <libinput.h> | 3 | #include <libinput.h> |
4 | #include <wlr/types/wlr_input_inhibitor.h> | ||
5 | #include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h> | 4 | #include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h> |
6 | #include <wlr/types/wlr_virtual_keyboard_v1.h> | 5 | #include <wlr/types/wlr_virtual_keyboard_v1.h> |
7 | #include <wlr/types/wlr_virtual_pointer_v1.h> | 6 | #include <wlr/types/wlr_virtual_pointer_v1.h> |
8 | #include "sway/server.h" | 7 | #include <wlr/types/wlr_transient_seat_v1.h> |
9 | #include "sway/config.h" | 8 | #include "sway/config.h" |
10 | #include "list.h" | 9 | #include "list.h" |
11 | 10 | ||
11 | struct sway_server; | ||
12 | |||
12 | struct sway_input_device { | 13 | struct sway_input_device { |
13 | char *identifier; | 14 | char *identifier; |
14 | struct wlr_input_device *wlr_device; | 15 | struct wlr_input_device *wlr_device; |
@@ -21,10 +22,11 @@ struct sway_input_manager { | |||
21 | struct wl_list devices; | 22 | struct wl_list devices; |
22 | struct wl_list seats; | 23 | struct wl_list seats; |
23 | 24 | ||
24 | struct wlr_input_inhibit_manager *inhibit; | ||
25 | struct wlr_keyboard_shortcuts_inhibit_manager_v1 *keyboard_shortcuts_inhibit; | 25 | struct wlr_keyboard_shortcuts_inhibit_manager_v1 *keyboard_shortcuts_inhibit; |
26 | struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard; | 26 | struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard; |
27 | struct wlr_virtual_pointer_manager_v1 *virtual_pointer; | 27 | struct wlr_virtual_pointer_manager_v1 *virtual_pointer; |
28 | struct wlr_pointer_gestures_v1 *pointer_gestures; | ||
29 | struct wlr_transient_seat_manager_v1 *transient_seat_manager; | ||
28 | 30 | ||
29 | struct wl_listener new_input; | 31 | struct wl_listener new_input; |
30 | struct wl_listener inhibit_activate; | 32 | struct wl_listener inhibit_activate; |
@@ -32,6 +34,7 @@ struct sway_input_manager { | |||
32 | struct wl_listener keyboard_shortcuts_inhibit_new_inhibitor; | 34 | struct wl_listener keyboard_shortcuts_inhibit_new_inhibitor; |
33 | struct wl_listener virtual_keyboard_new; | 35 | struct wl_listener virtual_keyboard_new; |
34 | struct wl_listener virtual_pointer_new; | 36 | struct wl_listener virtual_pointer_new; |
37 | struct wl_listener transient_seat_create; | ||
35 | }; | 38 | }; |
36 | 39 | ||
37 | struct sway_input_manager *input_manager_create(struct sway_server *server); | 40 | struct sway_input_manager *input_manager_create(struct sway_server *server); |
@@ -44,7 +47,7 @@ void input_manager_configure_xcursor(void); | |||
44 | 47 | ||
45 | void input_manager_apply_input_config(struct input_config *input_config); | 48 | void input_manager_apply_input_config(struct input_config *input_config); |
46 | 49 | ||
47 | void input_manager_configure_all_inputs(void); | 50 | void input_manager_configure_all_input_mappings(void); |
48 | 51 | ||
49 | void input_manager_reset_input(struct sway_input_device *input_device); | 52 | void input_manager_reset_input(struct sway_input_device *input_device); |
50 | 53 | ||
diff --git a/include/sway/input/libinput.h b/include/sway/input/libinput.h index 890d632e..1f84a8e3 100644 --- a/include/sway/input/libinput.h +++ b/include/sway/input/libinput.h | |||
@@ -2,7 +2,10 @@ | |||
2 | #define _SWAY_INPUT_LIBINPUT_H | 2 | #define _SWAY_INPUT_LIBINPUT_H |
3 | #include "sway/input/input-manager.h" | 3 | #include "sway/input/input-manager.h" |
4 | 4 | ||
5 | void sway_input_configure_libinput_device(struct sway_input_device *device); | 5 | bool sway_input_configure_libinput_device(struct sway_input_device *device); |
6 | |||
7 | void sway_input_configure_libinput_device_send_events( | ||
8 | struct sway_input_device *device); | ||
6 | 9 | ||
7 | void sway_input_reset_libinput_device(struct sway_input_device *device); | 10 | void sway_input_reset_libinput_device(struct sway_input_device *device); |
8 | 11 | ||
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h index c2041742..428f9679 100644 --- a/include/sway/input/seat.h +++ b/include/sway/input/seat.h | |||
@@ -3,7 +3,9 @@ | |||
3 | 3 | ||
4 | #include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h> | 4 | #include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h> |
5 | #include <wlr/types/wlr_layer_shell_v1.h> | 5 | #include <wlr/types/wlr_layer_shell_v1.h> |
6 | #include <wlr/types/wlr_scene.h> | ||
6 | #include <wlr/types/wlr_seat.h> | 7 | #include <wlr/types/wlr_seat.h> |
8 | #include <wlr/types/wlr_touch.h> | ||
7 | #include <wlr/util/edges.h> | 9 | #include <wlr/util/edges.h> |
8 | #include "sway/config.h" | 10 | #include "sway/config.h" |
9 | #include "sway/input/input-manager.h" | 11 | #include "sway/input/input-manager.h" |
@@ -15,7 +17,7 @@ struct sway_seat; | |||
15 | struct sway_seatop_impl { | 17 | struct sway_seatop_impl { |
16 | void (*button)(struct sway_seat *seat, uint32_t time_msec, | 18 | void (*button)(struct sway_seat *seat, uint32_t time_msec, |
17 | struct wlr_input_device *device, uint32_t button, | 19 | struct wlr_input_device *device, uint32_t button, |
18 | enum wlr_button_state state); | 20 | enum wl_pointer_button_state state); |
19 | void (*pointer_motion)(struct sway_seat *seat, uint32_t time_msec); | 21 | void (*pointer_motion)(struct sway_seat *seat, uint32_t time_msec); |
20 | void (*pointer_axis)(struct sway_seat *seat, | 22 | void (*pointer_axis)(struct sway_seat *seat, |
21 | struct wlr_pointer_axis_event *event); | 23 | struct wlr_pointer_axis_event *event); |
@@ -36,14 +38,20 @@ struct sway_seatop_impl { | |||
36 | void (*swipe_end)(struct sway_seat *seat, | 38 | void (*swipe_end)(struct sway_seat *seat, |
37 | struct wlr_pointer_swipe_end_event *event); | 39 | struct wlr_pointer_swipe_end_event *event); |
38 | void (*rebase)(struct sway_seat *seat, uint32_t time_msec); | 40 | void (*rebase)(struct sway_seat *seat, uint32_t time_msec); |
41 | void (*touch_motion)(struct sway_seat *seat, | ||
42 | struct wlr_touch_motion_event *event, double lx, double ly); | ||
43 | void (*touch_up)(struct sway_seat *seat, | ||
44 | struct wlr_touch_up_event *event); | ||
45 | void (*touch_down)(struct sway_seat *seat, | ||
46 | struct wlr_touch_down_event *event, double lx, double ly); | ||
47 | void (*touch_cancel)(struct sway_seat *seat, | ||
48 | struct wlr_touch_cancel_event *event); | ||
39 | void (*tablet_tool_motion)(struct sway_seat *seat, | 49 | void (*tablet_tool_motion)(struct sway_seat *seat, |
40 | struct sway_tablet_tool *tool, uint32_t time_msec); | 50 | struct sway_tablet_tool *tool, uint32_t time_msec); |
41 | void (*tablet_tool_tip)(struct sway_seat *seat, struct sway_tablet_tool *tool, | 51 | void (*tablet_tool_tip)(struct sway_seat *seat, struct sway_tablet_tool *tool, |
42 | uint32_t time_msec, enum wlr_tablet_tool_tip_state state); | 52 | uint32_t time_msec, enum wlr_tablet_tool_tip_state state); |
43 | void (*end)(struct sway_seat *seat); | 53 | void (*end)(struct sway_seat *seat); |
44 | void (*unref)(struct sway_seat *seat, struct sway_container *con); | 54 | void (*unref)(struct sway_seat *seat, struct sway_container *con); |
45 | void (*render)(struct sway_seat *seat, struct sway_output *output, | ||
46 | pixman_region32_t *damage); | ||
47 | bool allow_set_cursor; | 55 | bool allow_set_cursor; |
48 | }; | 56 | }; |
49 | 57 | ||
@@ -66,19 +74,6 @@ struct sway_seat_node { | |||
66 | struct wl_listener destroy; | 74 | struct wl_listener destroy; |
67 | }; | 75 | }; |
68 | 76 | ||
69 | struct sway_drag_icon { | ||
70 | struct sway_seat *seat; | ||
71 | struct wlr_drag_icon *wlr_drag_icon; | ||
72 | struct wl_list link; // sway_root::drag_icons | ||
73 | |||
74 | double x, y; // in layout-local coordinates | ||
75 | |||
76 | struct wl_listener surface_commit; | ||
77 | struct wl_listener map; | ||
78 | struct wl_listener unmap; | ||
79 | struct wl_listener destroy; | ||
80 | }; | ||
81 | |||
82 | struct sway_drag { | 77 | struct sway_drag { |
83 | struct sway_seat *seat; | 78 | struct sway_seat *seat; |
84 | struct wlr_drag *wlr_drag; | 79 | struct wlr_drag *wlr_drag; |
@@ -89,16 +84,23 @@ struct sway_seat { | |||
89 | struct wlr_seat *wlr_seat; | 84 | struct wlr_seat *wlr_seat; |
90 | struct sway_cursor *cursor; | 85 | struct sway_cursor *cursor; |
91 | 86 | ||
87 | // Seat scene tree structure | ||
88 | // - scene_tree | ||
89 | // - drag icons | ||
90 | // - drag icon 1 | ||
91 | // - drag icon 2 | ||
92 | // - seatop specific stuff | ||
93 | struct wlr_scene_tree *scene_tree; | ||
94 | struct wlr_scene_tree *drag_icons; | ||
95 | |||
92 | bool has_focus; | 96 | bool has_focus; |
93 | struct wl_list focus_stack; // list of containers in focus order | 97 | struct wl_list focus_stack; // list of containers in focus order |
94 | struct sway_workspace *workspace; | 98 | struct sway_workspace *workspace; |
95 | char *prev_workspace_name; // for workspace back_and_forth | 99 | char *prev_workspace_name; // for workspace back_and_forth |
96 | 100 | ||
97 | // If the focused layer is set, views cannot receive keyboard focus | ||
98 | struct wlr_layer_surface_v1 *focused_layer; | 101 | struct wlr_layer_surface_v1 *focused_layer; |
99 | 102 | // If the exclusive layer is set, views cannot receive keyboard focus | |
100 | // If exclusive_client is set, no other clients will receive input events | 103 | bool has_exclusive_layer; |
101 | struct wl_client *exclusive_client; | ||
102 | 104 | ||
103 | // Last touch point | 105 | // Last touch point |
104 | int32_t touch_id; | 106 | int32_t touch_id; |
@@ -122,6 +124,7 @@ struct sway_seat { | |||
122 | struct wl_listener start_drag; | 124 | struct wl_listener start_drag; |
123 | struct wl_listener request_set_selection; | 125 | struct wl_listener request_set_selection; |
124 | struct wl_listener request_set_primary_selection; | 126 | struct wl_listener request_set_primary_selection; |
127 | struct wl_listener destroy; | ||
125 | 128 | ||
126 | struct wl_list devices; // sway_seat_device::link | 129 | struct wl_list devices; // sway_seat_device::link |
127 | struct wl_list keyboard_groups; // sway_keyboard_group::link | 130 | struct wl_list keyboard_groups; // sway_keyboard_group::link |
@@ -157,6 +160,9 @@ void seat_add_device(struct sway_seat *seat, | |||
157 | void seat_configure_device(struct sway_seat *seat, | 160 | void seat_configure_device(struct sway_seat *seat, |
158 | struct sway_input_device *device); | 161 | struct sway_input_device *device); |
159 | 162 | ||
163 | void seat_configure_device_mapping(struct sway_seat *seat, | ||
164 | struct sway_input_device *input_device); | ||
165 | |||
160 | void seat_reset_device(struct sway_seat *seat, | 166 | void seat_reset_device(struct sway_seat *seat, |
161 | struct sway_input_device *input_device); | 167 | struct sway_input_device *input_device); |
162 | 168 | ||
@@ -187,8 +193,7 @@ void seat_set_focus_surface(struct sway_seat *seat, | |||
187 | void seat_set_focus_layer(struct sway_seat *seat, | 193 | void seat_set_focus_layer(struct sway_seat *seat, |
188 | struct wlr_layer_surface_v1 *layer); | 194 | struct wlr_layer_surface_v1 *layer); |
189 | 195 | ||
190 | void seat_set_exclusive_client(struct sway_seat *seat, | 196 | void seat_unfocus_unless_client(struct sway_seat *seat, struct wl_client *client); |
191 | struct wl_client *client); | ||
192 | 197 | ||
193 | struct sway_node *seat_get_focus(struct sway_seat *seat); | 198 | struct sway_node *seat_get_focus(struct sway_seat *seat); |
194 | 199 | ||
@@ -201,10 +206,6 @@ struct sway_workspace *seat_get_last_known_workspace(struct sway_seat *seat); | |||
201 | 206 | ||
202 | struct sway_container *seat_get_focused_container(struct sway_seat *seat); | 207 | struct sway_container *seat_get_focused_container(struct sway_seat *seat); |
203 | 208 | ||
204 | // Force focus to a particular surface that is not part of the workspace | ||
205 | // hierarchy (used for lockscreen) | ||
206 | void sway_force_focus(struct wlr_surface *surface); | ||
207 | |||
208 | /** | 209 | /** |
209 | * Return the last container to be focused for the seat (or the most recently | 210 | * Return the last container to be focused for the seat (or the most recently |
210 | * opened if no container has received focused) that is a child of the given | 211 | * opened if no container has received focused) that is a child of the given |
@@ -251,7 +252,7 @@ void seat_idle_notify_activity(struct sway_seat *seat, | |||
251 | 252 | ||
252 | bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface); | 253 | bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface); |
253 | 254 | ||
254 | void drag_icon_update_position(struct sway_drag_icon *icon); | 255 | void drag_icons_update_position(struct sway_seat *seat); |
255 | 256 | ||
256 | enum wlr_edges find_resize_edge(struct sway_container *cont, | 257 | enum wlr_edges find_resize_edge(struct sway_container *cont, |
257 | struct wlr_surface *surface, struct sway_cursor *cursor); | 258 | struct wlr_surface *surface, struct sway_cursor *cursor); |
@@ -259,10 +260,13 @@ enum wlr_edges find_resize_edge(struct sway_container *cont, | |||
259 | void seatop_begin_default(struct sway_seat *seat); | 260 | void seatop_begin_default(struct sway_seat *seat); |
260 | 261 | ||
261 | void seatop_begin_down(struct sway_seat *seat, struct sway_container *con, | 262 | void seatop_begin_down(struct sway_seat *seat, struct sway_container *con, |
262 | uint32_t time_msec, double sx, double sy); | 263 | double sx, double sy); |
263 | 264 | ||
264 | void seatop_begin_down_on_surface(struct sway_seat *seat, | 265 | void seatop_begin_down_on_surface(struct sway_seat *seat, |
265 | struct wlr_surface *surface, uint32_t time_msec, double sx, double sy); | 266 | struct wlr_surface *surface, double sx, double sy); |
267 | |||
268 | void seatop_begin_touch_down(struct sway_seat *seat, struct wlr_surface *surface, | ||
269 | struct wlr_touch_down_event *event, double sx, double sy, double lx, double ly); | ||
266 | 270 | ||
267 | void seatop_begin_move_floating(struct sway_seat *seat, | 271 | void seatop_begin_move_floating(struct sway_seat *seat, |
268 | struct sway_container *con); | 272 | struct sway_container *con); |
@@ -283,13 +287,13 @@ struct sway_container *seat_get_focus_inactive_floating(struct sway_seat *seat, | |||
283 | struct sway_workspace *workspace); | 287 | struct sway_workspace *workspace); |
284 | 288 | ||
285 | void seat_pointer_notify_button(struct sway_seat *seat, uint32_t time_msec, | 289 | void seat_pointer_notify_button(struct sway_seat *seat, uint32_t time_msec, |
286 | uint32_t button, enum wlr_button_state state); | 290 | uint32_t button, enum wl_pointer_button_state state); |
287 | 291 | ||
288 | void seat_consider_warp_to_focus(struct sway_seat *seat); | 292 | void seat_consider_warp_to_focus(struct sway_seat *seat); |
289 | 293 | ||
290 | void seatop_button(struct sway_seat *seat, uint32_t time_msec, | 294 | void seatop_button(struct sway_seat *seat, uint32_t time_msec, |
291 | struct wlr_input_device *device, uint32_t button, | 295 | struct wlr_input_device *device, uint32_t button, |
292 | enum wlr_button_state state); | 296 | enum wl_pointer_button_state state); |
293 | 297 | ||
294 | void seatop_pointer_motion(struct sway_seat *seat, uint32_t time_msec); | 298 | void seatop_pointer_motion(struct sway_seat *seat, uint32_t time_msec); |
295 | 299 | ||
@@ -322,6 +326,18 @@ void seatop_swipe_update(struct sway_seat *seat, | |||
322 | void seatop_swipe_end(struct sway_seat *seat, | 326 | void seatop_swipe_end(struct sway_seat *seat, |
323 | struct wlr_pointer_swipe_end_event *event); | 327 | struct wlr_pointer_swipe_end_event *event); |
324 | 328 | ||
329 | void seatop_touch_motion(struct sway_seat *seat, | ||
330 | struct wlr_touch_motion_event *event, double lx, double ly); | ||
331 | |||
332 | void seatop_touch_up(struct sway_seat *seat, | ||
333 | struct wlr_touch_up_event *event); | ||
334 | |||
335 | void seatop_touch_down(struct sway_seat *seat, | ||
336 | struct wlr_touch_down_event *event, double lx, double ly); | ||
337 | |||
338 | void seatop_touch_cancel(struct sway_seat *seat, | ||
339 | struct wlr_touch_cancel_event *event); | ||
340 | |||
325 | void seatop_rebase(struct sway_seat *seat, uint32_t time_msec); | 341 | void seatop_rebase(struct sway_seat *seat, uint32_t time_msec); |
326 | 342 | ||
327 | /** | 343 | /** |
@@ -336,13 +352,6 @@ void seatop_end(struct sway_seat *seat); | |||
336 | */ | 352 | */ |
337 | void seatop_unref(struct sway_seat *seat, struct sway_container *con); | 353 | void seatop_unref(struct sway_seat *seat, struct sway_container *con); |
338 | 354 | ||
339 | /** | ||
340 | * Instructs a seatop to render anything that it needs to render | ||
341 | * (eg. dropzone for move-tiling) | ||
342 | */ | ||
343 | void seatop_render(struct sway_seat *seat, struct sway_output *output, | ||
344 | pixman_region32_t *damage); | ||
345 | |||
346 | bool seatop_allows_set_cursor(struct sway_seat *seat); | 355 | bool seatop_allows_set_cursor(struct sway_seat *seat); |
347 | 356 | ||
348 | /** | 357 | /** |
diff --git a/include/sway/input/tablet.h b/include/sway/input/tablet.h index c0a5aff7..2fa5db6d 100644 --- a/include/sway/input/tablet.h +++ b/include/sway/input/tablet.h | |||
@@ -63,7 +63,7 @@ void sway_configure_tablet_pad(struct sway_tablet_pad *tablet_pad); | |||
63 | 63 | ||
64 | void sway_tablet_pad_destroy(struct sway_tablet_pad *tablet_pad); | 64 | void sway_tablet_pad_destroy(struct sway_tablet_pad *tablet_pad); |
65 | 65 | ||
66 | void sway_tablet_pad_notify_enter(struct sway_tablet_pad *tablet_pad, | 66 | void sway_tablet_pad_set_focus(struct sway_tablet_pad *tablet_pad, |
67 | struct wlr_surface *surface); | 67 | struct wlr_surface *surface); |
68 | 68 | ||
69 | #endif | 69 | #endif |
diff --git a/include/sway/input/text_input.h b/include/sway/input/text_input.h index c70fd935..1993f928 100644 --- a/include/sway/input/text_input.h +++ b/include/sway/input/text_input.h | |||
@@ -4,12 +4,11 @@ | |||
4 | #include <wlr/types/wlr_text_input_v3.h> | 4 | #include <wlr/types/wlr_text_input_v3.h> |
5 | #include <wlr/types/wlr_input_method_v2.h> | 5 | #include <wlr/types/wlr_input_method_v2.h> |
6 | #include <wlr/types/wlr_compositor.h> | 6 | #include <wlr/types/wlr_compositor.h> |
7 | #include "sway/input/seat.h" | ||
8 | 7 | ||
9 | /** | 8 | /** |
10 | * The relay structure manages the relationship between text-input and | 9 | * The relay structure manages the relationship between text-input and |
11 | * input_method interfaces on a given seat. Multiple text-input interfaces may | 10 | * input_method interfaces on a given seat. Multiple text-input interfaces may |
12 | * be bound to a relay, but at most one will be focused (reveiving events) at | 11 | * be bound to a relay, but at most one will be focused (receiving events) at |
13 | * a time. At most one input-method interface may be bound to the seat. The | 12 | * a time. At most one input-method interface may be bound to the seat. The |
14 | * relay manages life cycle of both sides. When both sides are present and | 13 | * relay manages life cycle of both sides. When both sides are present and |
15 | * focused, the relay passes messages between them. | 14 | * focused, the relay passes messages between them. |
@@ -22,18 +21,21 @@ struct sway_input_method_relay { | |||
22 | struct sway_seat *seat; | 21 | struct sway_seat *seat; |
23 | 22 | ||
24 | struct wl_list text_inputs; // sway_text_input::link | 23 | struct wl_list text_inputs; // sway_text_input::link |
24 | struct wl_list input_popups; // sway_input_popup::link | ||
25 | struct wlr_input_method_v2 *input_method; // doesn't have to be present | 25 | struct wlr_input_method_v2 *input_method; // doesn't have to be present |
26 | 26 | ||
27 | struct wl_listener text_input_new; | 27 | struct wl_listener text_input_new; |
28 | 28 | ||
29 | struct wl_listener input_method_new; | 29 | struct wl_listener input_method_new; |
30 | struct wl_listener input_method_commit; | 30 | struct wl_listener input_method_commit; |
31 | struct wl_listener input_method_new_popup_surface; | ||
31 | struct wl_listener input_method_grab_keyboard; | 32 | struct wl_listener input_method_grab_keyboard; |
32 | struct wl_listener input_method_destroy; | 33 | struct wl_listener input_method_destroy; |
33 | 34 | ||
34 | struct wl_listener input_method_keyboard_grab_destroy; | 35 | struct wl_listener input_method_keyboard_grab_destroy; |
35 | }; | 36 | }; |
36 | 37 | ||
38 | |||
37 | struct sway_text_input { | 39 | struct sway_text_input { |
38 | struct sway_input_method_relay *relay; | 40 | struct sway_input_method_relay *relay; |
39 | 41 | ||
diff --git a/include/sway/input/text_input_popup.h b/include/sway/input/text_input_popup.h new file mode 100644 index 00000000..e5f6ab8b --- /dev/null +++ b/include/sway/input/text_input_popup.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef _SWAY_INPUT_TEXT_INPUT_POPUP_H | ||
2 | #define _SWAY_INPUT_TEXT_INPUT_POPUP_H | ||
3 | |||
4 | #include "sway/tree/view.h" | ||
5 | |||
6 | struct sway_input_popup { | ||
7 | struct sway_input_method_relay *relay; | ||
8 | |||
9 | struct wlr_scene_tree *scene_tree; | ||
10 | struct sway_popup_desc desc; | ||
11 | struct wlr_input_popup_surface_v2 *popup_surface; | ||
12 | |||
13 | struct wl_list link; | ||
14 | |||
15 | struct wl_listener popup_destroy; | ||
16 | struct wl_listener popup_surface_commit; | ||
17 | |||
18 | struct wl_listener focused_surface_unmap; | ||
19 | }; | ||
20 | #endif | ||
diff --git a/include/sway/ipc-json.h b/include/sway/ipc-json.h index 6f4ade1a..bc9f4985 100644 --- a/include/sway/ipc-json.h +++ b/include/sway/ipc-json.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef _SWAY_IPC_JSON_H | 1 | #ifndef _SWAY_IPC_JSON_H |
2 | #define _SWAY_IPC_JSON_H | 2 | #define _SWAY_IPC_JSON_H |
3 | #include <json.h> | 3 | #include <json.h> |
4 | #include "sway/output.h" | ||
4 | #include "sway/tree/container.h" | 5 | #include "sway/tree/container.h" |
5 | #include "sway/input/input-manager.h" | 6 | #include "sway/input/input-manager.h" |
6 | 7 | ||
@@ -9,6 +10,7 @@ json_object *ipc_json_get_version(void); | |||
9 | json_object *ipc_json_get_binding_mode(void); | 10 | json_object *ipc_json_get_binding_mode(void); |
10 | 11 | ||
11 | json_object *ipc_json_describe_disabled_output(struct sway_output *o); | 12 | json_object *ipc_json_describe_disabled_output(struct sway_output *o); |
13 | json_object *ipc_json_describe_non_desktop_output(struct sway_output_non_desktop *o); | ||
12 | json_object *ipc_json_describe_node(struct sway_node *node); | 14 | json_object *ipc_json_describe_node(struct sway_node *node); |
13 | json_object *ipc_json_describe_node_recursive(struct sway_node *node); | 15 | json_object *ipc_json_describe_node_recursive(struct sway_node *node); |
14 | json_object *ipc_json_describe_input(struct sway_input_device *device); | 16 | json_object *ipc_json_describe_input(struct sway_input_device *device); |
diff --git a/include/sway/ipc-server.h b/include/sway/ipc-server.h index bc4f781a..d4c00942 100644 --- a/include/sway/ipc-server.h +++ b/include/sway/ipc-server.h | |||
@@ -21,5 +21,6 @@ void ipc_event_mode(const char *mode, bool pango); | |||
21 | void ipc_event_shutdown(const char *reason); | 21 | void ipc_event_shutdown(const char *reason); |
22 | void ipc_event_binding(struct sway_binding *binding); | 22 | void ipc_event_binding(struct sway_binding *binding); |
23 | void ipc_event_input(const char *change, struct sway_input_device *device); | 23 | void ipc_event_input(const char *change, struct sway_input_device *device); |
24 | void ipc_event_output(void); | ||
24 | 25 | ||
25 | #endif | 26 | #endif |
diff --git a/include/sway/layers.h b/include/sway/layers.h index f8508493..fd6384e0 100644 --- a/include/sway/layers.h +++ b/include/sway/layers.h | |||
@@ -3,61 +3,42 @@ | |||
3 | #include <stdbool.h> | 3 | #include <stdbool.h> |
4 | #include <wlr/types/wlr_compositor.h> | 4 | #include <wlr/types/wlr_compositor.h> |
5 | #include <wlr/types/wlr_layer_shell_v1.h> | 5 | #include <wlr/types/wlr_layer_shell_v1.h> |
6 | 6 | #include "sway/tree/view.h" | |
7 | enum layer_parent { | ||
8 | LAYER_PARENT_LAYER, | ||
9 | LAYER_PARENT_POPUP, | ||
10 | }; | ||
11 | 7 | ||
12 | struct sway_layer_surface { | 8 | struct sway_layer_surface { |
13 | struct wlr_layer_surface_v1 *layer_surface; | ||
14 | struct wl_list link; | ||
15 | |||
16 | struct wl_listener destroy; | ||
17 | struct wl_listener map; | 9 | struct wl_listener map; |
18 | struct wl_listener unmap; | 10 | struct wl_listener unmap; |
19 | struct wl_listener surface_commit; | 11 | struct wl_listener surface_commit; |
20 | struct wl_listener output_destroy; | 12 | struct wl_listener output_destroy; |
13 | struct wl_listener node_destroy; | ||
21 | struct wl_listener new_popup; | 14 | struct wl_listener new_popup; |
22 | struct wl_listener new_subsurface; | ||
23 | 15 | ||
24 | struct wlr_box geo; | ||
25 | bool mapped; | 16 | bool mapped; |
26 | struct wlr_box extent; | ||
27 | enum zwlr_layer_shell_v1_layer layer; | ||
28 | 17 | ||
29 | struct wl_list subsurfaces; | 18 | struct wlr_scene_tree *popups; |
19 | struct sway_popup_desc desc; | ||
20 | |||
21 | struct sway_output *output; | ||
22 | struct wlr_scene_layer_surface_v1 *scene; | ||
23 | struct wlr_scene_tree *tree; | ||
24 | struct wlr_layer_surface_v1 *layer_surface; | ||
30 | }; | 25 | }; |
31 | 26 | ||
32 | struct sway_layer_popup { | 27 | struct sway_layer_popup { |
33 | struct wlr_xdg_popup *wlr_popup; | 28 | struct wlr_xdg_popup *wlr_popup; |
34 | enum layer_parent parent_type; | 29 | struct wlr_scene_tree *scene; |
35 | union { | 30 | struct sway_layer_surface *toplevel; |
36 | struct sway_layer_surface *parent_layer; | ||
37 | struct sway_layer_popup *parent_popup; | ||
38 | }; | ||
39 | struct wl_listener map; | ||
40 | struct wl_listener unmap; | ||
41 | struct wl_listener destroy; | ||
42 | struct wl_listener commit; | ||
43 | struct wl_listener new_popup; | ||
44 | }; | ||
45 | 31 | ||
46 | struct sway_layer_subsurface { | ||
47 | struct wlr_subsurface *wlr_subsurface; | ||
48 | struct sway_layer_surface *layer_surface; | ||
49 | struct wl_list link; | ||
50 | |||
51 | struct wl_listener map; | ||
52 | struct wl_listener unmap; | ||
53 | struct wl_listener destroy; | 32 | struct wl_listener destroy; |
33 | struct wl_listener new_popup; | ||
54 | struct wl_listener commit; | 34 | struct wl_listener commit; |
55 | }; | 35 | }; |
56 | 36 | ||
57 | struct sway_output; | 37 | struct sway_output; |
58 | void arrange_layers(struct sway_output *output); | ||
59 | 38 | ||
60 | struct sway_layer_surface *layer_from_wlr_layer_surface_v1( | 39 | struct wlr_layer_surface_v1 *toplevel_layer_surface_from_surface( |
61 | struct wlr_layer_surface_v1 *layer_surface); | 40 | struct wlr_surface *surface); |
41 | |||
42 | void arrange_layers(struct sway_output *output); | ||
62 | 43 | ||
63 | #endif | 44 | #endif |
diff --git a/include/sway/output.h b/include/sway/output.h index 6d8319bf..d546d488 100644 --- a/include/sway/output.h +++ b/include/sway/output.h | |||
@@ -3,7 +3,9 @@ | |||
3 | #include <time.h> | 3 | #include <time.h> |
4 | #include <unistd.h> | 4 | #include <unistd.h> |
5 | #include <wayland-server-core.h> | 5 | #include <wayland-server-core.h> |
6 | #include <wlr/types/wlr_damage_ring.h> | ||
6 | #include <wlr/types/wlr_output.h> | 7 | #include <wlr/types/wlr_output.h> |
8 | #include <wlr/types/wlr_scene.h> | ||
7 | #include "config.h" | 9 | #include "config.h" |
8 | #include "sway/tree/node.h" | 10 | #include "sway/tree/node.h" |
9 | #include "sway/tree/view.h" | 11 | #include "sway/tree/view.h" |
@@ -18,34 +20,47 @@ struct sway_output_state { | |||
18 | 20 | ||
19 | struct sway_output { | 21 | struct sway_output { |
20 | struct sway_node node; | 22 | struct sway_node node; |
23 | |||
24 | struct { | ||
25 | struct wlr_scene_tree *shell_background; | ||
26 | struct wlr_scene_tree *shell_bottom; | ||
27 | struct wlr_scene_tree *tiling; | ||
28 | struct wlr_scene_tree *fullscreen; | ||
29 | struct wlr_scene_tree *shell_top; | ||
30 | struct wlr_scene_tree *shell_overlay; | ||
31 | struct wlr_scene_tree *session_lock; | ||
32 | } layers; | ||
33 | |||
34 | // when a container is fullscreen, in case the fullscreen surface is | ||
35 | // translucent (can see behind) we must make sure that the background is a | ||
36 | // solid color in order to conform to the wayland protocol. This rect | ||
37 | // ensures that when looking through a surface, all that will be seen | ||
38 | // is black. | ||
39 | struct wlr_scene_rect *fullscreen_background; | ||
40 | |||
21 | struct wlr_output *wlr_output; | 41 | struct wlr_output *wlr_output; |
42 | struct wlr_scene_output *scene_output; | ||
22 | struct sway_server *server; | 43 | struct sway_server *server; |
23 | struct wl_list link; | 44 | struct wl_list link; |
24 | 45 | ||
25 | struct wl_list layers[4]; // sway_layer_surface::link | ||
26 | struct wlr_box usable_area; | 46 | struct wlr_box usable_area; |
27 | 47 | ||
28 | struct timespec last_frame; | ||
29 | struct wlr_output_damage *damage; | ||
30 | |||
31 | int lx, ly; // layout coords | 48 | int lx, ly; // layout coords |
32 | int width, height; // transformed buffer size | 49 | int width, height; // transformed buffer size |
33 | enum wl_output_subpixel detected_subpixel; | 50 | enum wl_output_subpixel detected_subpixel; |
34 | enum scale_filter_mode scale_filter; | 51 | enum scale_filter_mode scale_filter; |
35 | // last applied mode when the output is powered off | ||
36 | struct wlr_output_mode *current_mode; | ||
37 | 52 | ||
38 | bool enabling, enabled; | 53 | bool enabled; |
39 | list_t *workspaces; | 54 | list_t *workspaces; |
40 | 55 | ||
41 | struct sway_output_state current; | 56 | struct sway_output_state current; |
42 | 57 | ||
58 | struct wl_listener layout_destroy; | ||
43 | struct wl_listener destroy; | 59 | struct wl_listener destroy; |
44 | struct wl_listener commit; | 60 | struct wl_listener commit; |
45 | struct wl_listener mode; | ||
46 | struct wl_listener present; | 61 | struct wl_listener present; |
47 | struct wl_listener damage_destroy; | 62 | struct wl_listener frame; |
48 | struct wl_listener damage_frame; | 63 | struct wl_listener request_state; |
49 | 64 | ||
50 | struct { | 65 | struct { |
51 | struct wl_signal disable; | 66 | struct wl_signal disable; |
@@ -55,6 +70,13 @@ struct sway_output { | |||
55 | uint32_t refresh_nsec; | 70 | uint32_t refresh_nsec; |
56 | int max_render_time; // In milliseconds | 71 | int max_render_time; // In milliseconds |
57 | struct wl_event_source *repaint_timer; | 72 | struct wl_event_source *repaint_timer; |
73 | bool gamma_lut_changed; | ||
74 | }; | ||
75 | |||
76 | struct sway_output_non_desktop { | ||
77 | struct wlr_output *wlr_output; | ||
78 | |||
79 | struct wl_listener destroy; | ||
58 | }; | 80 | }; |
59 | 81 | ||
60 | struct sway_output *output_create(struct wlr_output *wlr_output); | 82 | struct sway_output *output_create(struct wlr_output *wlr_output); |
@@ -75,18 +97,8 @@ typedef void (*sway_surface_iterator_func_t)(struct sway_output *output, | |||
75 | struct sway_view *view, struct wlr_surface *surface, struct wlr_box *box, | 97 | struct sway_view *view, struct wlr_surface *surface, struct wlr_box *box, |
76 | void *user_data); | 98 | void *user_data); |
77 | 99 | ||
78 | void output_damage_whole(struct sway_output *output); | 100 | bool output_match_name_or_id(struct sway_output *output, |
79 | 101 | const char *name_or_id); | |
80 | void output_damage_surface(struct sway_output *output, double ox, double oy, | ||
81 | struct wlr_surface *surface, bool whole); | ||
82 | |||
83 | void output_damage_from_view(struct sway_output *output, | ||
84 | struct sway_view *view); | ||
85 | |||
86 | void output_damage_box(struct sway_output *output, struct wlr_box *box); | ||
87 | |||
88 | void output_damage_whole_container(struct sway_output *output, | ||
89 | struct sway_container *con); | ||
90 | 102 | ||
91 | // this ONLY includes the enabled outputs | 103 | // this ONLY includes the enabled outputs |
92 | struct sway_output *output_by_name_or_id(const char *name_or_id); | 104 | struct sway_output *output_by_name_or_id(const char *name_or_id); |
@@ -100,47 +112,8 @@ void output_enable(struct sway_output *output); | |||
100 | 112 | ||
101 | void output_disable(struct sway_output *output); | 113 | void output_disable(struct sway_output *output); |
102 | 114 | ||
103 | bool output_has_opaque_overlay_layer_surface(struct sway_output *output); | ||
104 | |||
105 | struct sway_workspace *output_get_active_workspace(struct sway_output *output); | 115 | struct sway_workspace *output_get_active_workspace(struct sway_output *output); |
106 | 116 | ||
107 | void output_render(struct sway_output *output, struct timespec *when, | ||
108 | pixman_region32_t *damage); | ||
109 | |||
110 | void output_surface_for_each_surface(struct sway_output *output, | ||
111 | struct wlr_surface *surface, double ox, double oy, | ||
112 | sway_surface_iterator_func_t iterator, void *user_data); | ||
113 | |||
114 | void output_view_for_each_surface(struct sway_output *output, | ||
115 | struct sway_view *view, sway_surface_iterator_func_t iterator, | ||
116 | void *user_data); | ||
117 | |||
118 | void output_view_for_each_popup_surface(struct sway_output *output, | ||
119 | struct sway_view *view, sway_surface_iterator_func_t iterator, | ||
120 | void *user_data); | ||
121 | |||
122 | void output_layer_for_each_surface(struct sway_output *output, | ||
123 | struct wl_list *layer_surfaces, sway_surface_iterator_func_t iterator, | ||
124 | void *user_data); | ||
125 | |||
126 | void output_layer_for_each_toplevel_surface(struct sway_output *output, | ||
127 | struct wl_list *layer_surfaces, sway_surface_iterator_func_t iterator, | ||
128 | void *user_data); | ||
129 | |||
130 | void output_layer_for_each_popup_surface(struct sway_output *output, | ||
131 | struct wl_list *layer_surfaces, sway_surface_iterator_func_t iterator, | ||
132 | void *user_data); | ||
133 | |||
134 | #if HAVE_XWAYLAND | ||
135 | void output_unmanaged_for_each_surface(struct sway_output *output, | ||
136 | struct wl_list *unmanaged, sway_surface_iterator_func_t iterator, | ||
137 | void *user_data); | ||
138 | #endif | ||
139 | |||
140 | void output_drag_icons_for_each_surface(struct sway_output *output, | ||
141 | struct wl_list *drag_icons, sway_surface_iterator_func_t iterator, | ||
142 | void *user_data); | ||
143 | |||
144 | void output_for_each_workspace(struct sway_output *output, | 117 | void output_for_each_workspace(struct sway_output *output, |
145 | void (*f)(struct sway_workspace *ws, void *data), void *data); | 118 | void (*f)(struct sway_workspace *ws, void *data), void *data); |
146 | 119 | ||
@@ -158,18 +131,12 @@ void output_get_box(struct sway_output *output, struct wlr_box *box); | |||
158 | enum sway_container_layout output_get_default_layout( | 131 | enum sway_container_layout output_get_default_layout( |
159 | struct sway_output *output); | 132 | struct sway_output *output); |
160 | 133 | ||
161 | void render_rect(struct sway_output *output, | ||
162 | pixman_region32_t *output_damage, const struct wlr_box *_box, | ||
163 | float color[static 4]); | ||
164 | |||
165 | void premultiply_alpha(float color[4], float opacity); | ||
166 | |||
167 | void scale_box(struct wlr_box *box, float scale); | ||
168 | |||
169 | enum wlr_direction opposite_direction(enum wlr_direction d); | 134 | enum wlr_direction opposite_direction(enum wlr_direction d); |
170 | 135 | ||
171 | void handle_output_layout_change(struct wl_listener *listener, void *data); | 136 | void handle_output_layout_change(struct wl_listener *listener, void *data); |
172 | 137 | ||
138 | void handle_gamma_control_set_gamma(struct wl_listener *listener, void *data); | ||
139 | |||
173 | void handle_output_manager_apply(struct wl_listener *listener, void *data); | 140 | void handle_output_manager_apply(struct wl_listener *listener, void *data); |
174 | 141 | ||
175 | void handle_output_manager_test(struct wl_listener *listener, void *data); | 142 | void handle_output_manager_test(struct wl_listener *listener, void *data); |
@@ -177,4 +144,6 @@ void handle_output_manager_test(struct wl_listener *listener, void *data); | |||
177 | void handle_output_power_manager_set_mode(struct wl_listener *listener, | 144 | void handle_output_power_manager_set_mode(struct wl_listener *listener, |
178 | void *data); | 145 | void *data); |
179 | 146 | ||
147 | struct sway_output_non_desktop *output_non_desktop_create(struct wlr_output *wlr_output); | ||
148 | |||
180 | #endif | 149 | #endif |
diff --git a/include/sway/scene_descriptor.h b/include/sway/scene_descriptor.h new file mode 100644 index 00000000..2649d7c2 --- /dev/null +++ b/include/sway/scene_descriptor.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /** | ||
2 | * Across a wayland compositor, there are multiple shells: It can be | ||
3 | * a toplevel, or a layer_shell, or even something more meta like a drag | ||
4 | * icon or highlight indicators when dragging windows around. | ||
5 | * | ||
6 | * This object lets us store values that represent these modes of operation | ||
7 | * and keep track of what object is being represented. | ||
8 | */ | ||
9 | #ifndef _SWAY_SCENE_DESCRIPTOR_H | ||
10 | #define _SWAY_SCENE_DESCRIPTOR_H | ||
11 | #include <wlr/types/wlr_scene.h> | ||
12 | |||
13 | enum sway_scene_descriptor_type { | ||
14 | SWAY_SCENE_DESC_BUFFER_TIMER, | ||
15 | SWAY_SCENE_DESC_NON_INTERACTIVE, | ||
16 | SWAY_SCENE_DESC_CONTAINER, | ||
17 | SWAY_SCENE_DESC_VIEW, | ||
18 | SWAY_SCENE_DESC_LAYER_SHELL, | ||
19 | SWAY_SCENE_DESC_XWAYLAND_UNMANAGED, | ||
20 | SWAY_SCENE_DESC_POPUP, | ||
21 | SWAY_SCENE_DESC_DRAG_ICON, | ||
22 | }; | ||
23 | |||
24 | bool scene_descriptor_assign(struct wlr_scene_node *node, | ||
25 | enum sway_scene_descriptor_type type, void *data); | ||
26 | |||
27 | void *scene_descriptor_try_get(struct wlr_scene_node *node, | ||
28 | enum sway_scene_descriptor_type type); | ||
29 | |||
30 | void scene_descriptor_destroy(struct wlr_scene_node *node, | ||
31 | enum sway_scene_descriptor_type type); | ||
32 | |||
33 | #endif | ||
diff --git a/include/sway/server.h b/include/sway/server.h index 4cce17cc..3a63df34 100644 --- a/include/sway/server.h +++ b/include/sway/server.h | |||
@@ -2,45 +2,41 @@ | |||
2 | #define _SWAY_SERVER_H | 2 | #define _SWAY_SERVER_H |
3 | #include <stdbool.h> | 3 | #include <stdbool.h> |
4 | #include <wayland-server-core.h> | 4 | #include <wayland-server-core.h> |
5 | #include <wlr/backend.h> | ||
6 | #include <wlr/backend/session.h> | ||
7 | #include <wlr/render/allocator.h> | ||
8 | #include <wlr/render/wlr_renderer.h> | ||
9 | #include <wlr/types/wlr_compositor.h> | ||
10 | #include <wlr/types/wlr_data_device.h> | ||
11 | #include <wlr/types/wlr_input_method_v2.h> | ||
12 | #include <wlr/types/wlr_foreign_toplevel_management_v1.h> | ||
13 | #include <wlr/types/wlr_drm_lease_v1.h> | ||
14 | #include <wlr/types/wlr_layer_shell_v1.h> | ||
15 | #include <wlr/types/wlr_output_management_v1.h> | ||
16 | #include <wlr/types/wlr_output_power_management_v1.h> | ||
17 | #include <wlr/types/wlr_presentation_time.h> | ||
18 | #include <wlr/types/wlr_relative_pointer_v1.h> | ||
19 | #include <wlr/types/wlr_session_lock_v1.h> | ||
20 | #include <wlr/types/wlr_server_decoration.h> | ||
21 | #include <wlr/types/wlr_text_input_v3.h> | ||
22 | #include <wlr/types/wlr_xdg_shell.h> | ||
23 | #include "config.h" | 5 | #include "config.h" |
24 | #include "list.h" | 6 | #include "list.h" |
25 | #if HAVE_XWAYLAND | 7 | #include "sway/desktop/idle_inhibit_v1.h" |
8 | #if WLR_HAS_XWAYLAND | ||
26 | #include "sway/xwayland.h" | 9 | #include "sway/xwayland.h" |
27 | #endif | 10 | #endif |
28 | 11 | ||
29 | struct sway_transaction; | 12 | struct sway_transaction; |
30 | 13 | ||
14 | struct sway_session_lock { | ||
15 | struct wlr_session_lock_v1 *lock; | ||
16 | struct wlr_surface *focused; | ||
17 | bool abandoned; | ||
18 | |||
19 | struct wl_list outputs; // struct sway_session_lock_output | ||
20 | |||
21 | // invalid if the session is abandoned | ||
22 | struct wl_listener new_surface; | ||
23 | struct wl_listener unlock; | ||
24 | struct wl_listener destroy; | ||
25 | }; | ||
26 | |||
31 | struct sway_server { | 27 | struct sway_server { |
32 | struct wl_display *wl_display; | 28 | struct wl_display *wl_display; |
33 | struct wl_event_loop *wl_event_loop; | 29 | struct wl_event_loop *wl_event_loop; |
34 | const char *socket; | 30 | const char *socket; |
35 | 31 | ||
36 | struct wlr_backend *backend; | 32 | struct wlr_backend *backend; |
33 | struct wlr_session *session; | ||
37 | // secondary headless backend used for creating virtual outputs on-the-fly | 34 | // secondary headless backend used for creating virtual outputs on-the-fly |
38 | struct wlr_backend *headless_backend; | 35 | struct wlr_backend *headless_backend; |
39 | struct wlr_renderer *renderer; | 36 | struct wlr_renderer *renderer; |
40 | struct wlr_allocator *allocator; | 37 | struct wlr_allocator *allocator; |
41 | 38 | ||
42 | struct wlr_compositor *compositor; | 39 | struct wlr_compositor *compositor; |
43 | struct wl_listener compositor_new_surface; | ||
44 | 40 | ||
45 | struct wlr_linux_dmabuf_v1 *linux_dmabuf_v1; | 41 | struct wlr_linux_dmabuf_v1 *linux_dmabuf_v1; |
46 | 42 | ||
@@ -50,19 +46,20 @@ struct sway_server { | |||
50 | 46 | ||
51 | struct wl_listener new_output; | 47 | struct wl_listener new_output; |
52 | struct wl_listener output_layout_change; | 48 | struct wl_listener output_layout_change; |
49 | struct wl_listener renderer_lost; | ||
53 | 50 | ||
54 | struct wlr_idle *idle; | 51 | struct wlr_idle_notifier_v1 *idle_notifier_v1; |
55 | struct sway_idle_inhibit_manager_v1 *idle_inhibit_manager_v1; | 52 | struct sway_idle_inhibit_manager_v1 idle_inhibit_manager_v1; |
56 | 53 | ||
57 | struct wlr_layer_shell_v1 *layer_shell; | 54 | struct wlr_layer_shell_v1 *layer_shell; |
58 | struct wl_listener layer_shell_surface; | 55 | struct wl_listener layer_shell_surface; |
59 | 56 | ||
60 | struct wlr_xdg_shell *xdg_shell; | 57 | struct wlr_xdg_shell *xdg_shell; |
61 | struct wl_listener xdg_shell_surface; | 58 | struct wl_listener xdg_shell_toplevel; |
62 | 59 | ||
63 | struct wlr_tablet_manager_v2 *tablet_v2; | 60 | struct wlr_tablet_manager_v2 *tablet_v2; |
64 | 61 | ||
65 | #if HAVE_XWAYLAND | 62 | #if WLR_HAS_XWAYLAND |
66 | struct sway_xwayland xwayland; | 63 | struct sway_xwayland xwayland; |
67 | struct wl_listener xwayland_surface; | 64 | struct wl_listener xwayland_surface; |
68 | struct wl_listener xwayland_ready; | 65 | struct wl_listener xwayland_ready; |
@@ -81,24 +78,22 @@ struct sway_server { | |||
81 | struct wlr_drm_lease_v1_manager *drm_lease_manager; | 78 | struct wlr_drm_lease_v1_manager *drm_lease_manager; |
82 | struct wl_listener drm_lease_request; | 79 | struct wl_listener drm_lease_request; |
83 | 80 | ||
84 | struct wlr_presentation *presentation; | ||
85 | |||
86 | struct wlr_pointer_constraints_v1 *pointer_constraints; | 81 | struct wlr_pointer_constraints_v1 *pointer_constraints; |
87 | struct wl_listener pointer_constraint; | 82 | struct wl_listener pointer_constraint; |
88 | 83 | ||
84 | struct wlr_xdg_output_manager_v1 *xdg_output_manager_v1; | ||
85 | |||
89 | struct wlr_output_manager_v1 *output_manager_v1; | 86 | struct wlr_output_manager_v1 *output_manager_v1; |
90 | struct wl_listener output_manager_apply; | 87 | struct wl_listener output_manager_apply; |
91 | struct wl_listener output_manager_test; | 88 | struct wl_listener output_manager_test; |
92 | 89 | ||
90 | struct wlr_gamma_control_manager_v1 *gamma_control_manager_v1; | ||
91 | struct wl_listener gamma_control_set_gamma; | ||
92 | |||
93 | struct { | 93 | struct { |
94 | bool locked; | 94 | struct sway_session_lock *lock; |
95 | struct wlr_session_lock_manager_v1 *manager; | 95 | struct wlr_session_lock_manager_v1 *manager; |
96 | 96 | ||
97 | struct wlr_session_lock_v1 *lock; | ||
98 | struct wl_listener lock_new_surface; | ||
99 | struct wl_listener lock_unlock; | ||
100 | struct wl_listener lock_destroy; | ||
101 | |||
102 | struct wl_listener new_lock; | 97 | struct wl_listener new_lock; |
103 | struct wl_listener manager_destroy; | 98 | struct wl_listener manager_destroy; |
104 | } session_lock; | 99 | } session_lock; |
@@ -107,10 +102,21 @@ struct sway_server { | |||
107 | struct wl_listener output_power_manager_set_mode; | 102 | struct wl_listener output_power_manager_set_mode; |
108 | struct wlr_input_method_manager_v2 *input_method; | 103 | struct wlr_input_method_manager_v2 *input_method; |
109 | struct wlr_text_input_manager_v3 *text_input; | 104 | struct wlr_text_input_manager_v3 *text_input; |
105 | struct wlr_ext_foreign_toplevel_list_v1 *foreign_toplevel_list; | ||
110 | struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager; | 106 | struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager; |
107 | struct wlr_content_type_manager_v1 *content_type_manager_v1; | ||
108 | struct wlr_data_control_manager_v1 *data_control_manager_v1; | ||
109 | struct wlr_screencopy_manager_v1 *screencopy_manager_v1; | ||
110 | struct wlr_export_dmabuf_manager_v1 *export_dmabuf_manager_v1; | ||
111 | struct wlr_security_context_manager_v1 *security_context_manager_v1; | ||
111 | 112 | ||
112 | struct wlr_xdg_activation_v1 *xdg_activation_v1; | 113 | struct wlr_xdg_activation_v1 *xdg_activation_v1; |
113 | struct wl_listener xdg_activation_v1_request_activate; | 114 | struct wl_listener xdg_activation_v1_request_activate; |
115 | struct wl_listener xdg_activation_v1_new_token; | ||
116 | |||
117 | struct wl_listener request_set_cursor_shape; | ||
118 | |||
119 | struct wl_list pending_launcher_ctxs; // launcher_ctx::link | ||
114 | 120 | ||
115 | // The timeout for transactions, after which a transaction is applied | 121 | // The timeout for transactions, after which a transaction is applied |
116 | // regardless of readiness. | 122 | // regardless of readiness. |
@@ -137,17 +143,13 @@ struct sway_debug { | |||
137 | bool noatomic; // Ignore atomic layout updates | 143 | bool noatomic; // Ignore atomic layout updates |
138 | bool txn_timings; // Log verbose messages about transactions | 144 | bool txn_timings; // Log verbose messages about transactions |
139 | bool txn_wait; // Always wait for the timeout before applying | 145 | bool txn_wait; // Always wait for the timeout before applying |
140 | bool noscanout; // Disable direct scan-out | 146 | bool legacy_wl_drm; // Enable the legacy wl_drm interface |
141 | |||
142 | enum { | ||
143 | DAMAGE_DEFAULT, // Default behaviour | ||
144 | DAMAGE_HIGHLIGHT, // Highlight regions of the screen being damaged | ||
145 | DAMAGE_RERENDER, // Render the full output when any damage occurs | ||
146 | } damage; | ||
147 | }; | 147 | }; |
148 | 148 | ||
149 | extern struct sway_debug debug; | 149 | extern struct sway_debug debug; |
150 | 150 | ||
151 | extern bool allow_unsupported_gpu; | ||
152 | |||
151 | bool server_init(struct sway_server *server); | 153 | bool server_init(struct sway_server *server); |
152 | void server_fini(struct sway_server *server); | 154 | void server_fini(struct sway_server *server); |
153 | bool server_start(struct sway_server *server); | 155 | bool server_start(struct sway_server *server); |
@@ -155,14 +157,17 @@ void server_run(struct sway_server *server); | |||
155 | 157 | ||
156 | void restore_nofile_limit(void); | 158 | void restore_nofile_limit(void); |
157 | 159 | ||
158 | void handle_compositor_new_surface(struct wl_listener *listener, void *data); | ||
159 | void handle_new_output(struct wl_listener *listener, void *data); | 160 | void handle_new_output(struct wl_listener *listener, void *data); |
160 | 161 | ||
161 | void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data); | 162 | void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data); |
162 | void handle_layer_shell_surface(struct wl_listener *listener, void *data); | 163 | void handle_layer_shell_surface(struct wl_listener *listener, void *data); |
163 | void sway_session_lock_init(void); | 164 | void sway_session_lock_init(void); |
164 | void handle_xdg_shell_surface(struct wl_listener *listener, void *data); | 165 | void sway_session_lock_add_output(struct sway_session_lock *lock, |
165 | #if HAVE_XWAYLAND | 166 | struct sway_output *output); |
167 | bool sway_session_lock_has_surface(struct sway_session_lock *lock, | ||
168 | struct wlr_surface *surface); | ||
169 | void handle_xdg_shell_toplevel(struct wl_listener *listener, void *data); | ||
170 | #if WLR_HAS_XWAYLAND | ||
166 | void handle_xwayland_surface(struct wl_listener *listener, void *data); | 171 | void handle_xwayland_surface(struct wl_listener *listener, void *data); |
167 | #endif | 172 | #endif |
168 | void handle_server_decoration(struct wl_listener *listener, void *data); | 173 | void handle_server_decoration(struct wl_listener *listener, void *data); |
@@ -170,6 +175,8 @@ void handle_xdg_decoration(struct wl_listener *listener, void *data); | |||
170 | void handle_pointer_constraint(struct wl_listener *listener, void *data); | 175 | void handle_pointer_constraint(struct wl_listener *listener, void *data); |
171 | void xdg_activation_v1_handle_request_activate(struct wl_listener *listener, | 176 | void xdg_activation_v1_handle_request_activate(struct wl_listener *listener, |
172 | void *data); | 177 | void *data); |
178 | void xdg_activation_v1_handle_new_token(struct wl_listener *listener, | ||
179 | void *data); | ||
173 | 180 | ||
174 | void set_rr_scheduling(void); | 181 | void set_rr_scheduling(void); |
175 | 182 | ||
diff --git a/include/sway/surface.h b/include/sway/surface.h deleted file mode 100644 index fb1cd775..00000000 --- a/include/sway/surface.h +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | #ifndef _SWAY_SURFACE_H | ||
2 | #define _SWAY_SURFACE_H | ||
3 | #include <wlr/types/wlr_compositor.h> | ||
4 | |||
5 | struct sway_surface { | ||
6 | struct wlr_surface *wlr_surface; | ||
7 | |||
8 | struct wl_listener destroy; | ||
9 | |||
10 | /** | ||
11 | * This timer can be used for issuing delayed frame done callbacks (for | ||
12 | * example, to improve presentation latency). Its handler is set to a | ||
13 | * function that issues a frame done callback to this surface. | ||
14 | */ | ||
15 | struct wl_event_source *frame_done_timer; | ||
16 | }; | ||
17 | |||
18 | #endif | ||
diff --git a/include/sway/sway_text_node.h b/include/sway/sway_text_node.h new file mode 100644 index 00000000..0d4209bb --- /dev/null +++ b/include/sway/sway_text_node.h | |||
@@ -0,0 +1,28 @@ | |||
1 | #ifndef _SWAY_BUFFER_H | ||
2 | #define _SWAY_BUFFER_H | ||
3 | #include <wlr/types/wlr_scene.h> | ||
4 | |||
5 | struct sway_text_node { | ||
6 | int width; | ||
7 | int max_width; | ||
8 | int height; | ||
9 | int baseline; | ||
10 | bool pango_markup; | ||
11 | float color[4]; | ||
12 | float background[4]; | ||
13 | |||
14 | struct wlr_scene_node *node; | ||
15 | }; | ||
16 | |||
17 | struct sway_text_node *sway_text_node_create(struct wlr_scene_tree *parent, | ||
18 | char *text, float color[4], bool pango_markup); | ||
19 | |||
20 | void sway_text_node_set_color(struct sway_text_node *node, float color[4]); | ||
21 | |||
22 | void sway_text_node_set_text(struct sway_text_node *node, char *text); | ||
23 | |||
24 | void sway_text_node_set_max_width(struct sway_text_node *node, int max_width); | ||
25 | |||
26 | void sway_text_node_set_background(struct sway_text_node *node, float background[4]); | ||
27 | |||
28 | #endif | ||
diff --git a/include/sway/swaynag.h b/include/sway/swaynag.h index 74d9ea18..03bd52c3 100644 --- a/include/sway/swaynag.h +++ b/include/sway/swaynag.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef _SWAY_SWAYNAG_H | 1 | #ifndef _SWAY_SWAYNAG_H |
2 | #define _SWAY_SWAYNAG_H | 2 | #define _SWAY_SWAYNAG_H |
3 | #include <wayland-server-core.h> | 3 | #include <wayland-server-core.h> |
4 | #include "stringop.h" | ||
4 | 5 | ||
5 | struct swaynag_instance { | 6 | struct swaynag_instance { |
6 | struct wl_client *client; | 7 | struct wl_client *client; |
@@ -21,7 +22,7 @@ bool swaynag_spawn(const char *swaynag_command, | |||
21 | // Write a log message to swaynag->fd[1]. This will fail when swaynag->detailed | 22 | // Write a log message to swaynag->fd[1]. This will fail when swaynag->detailed |
22 | // is false. | 23 | // is false. |
23 | void swaynag_log(const char *swaynag_command, struct swaynag_instance *swaynag, | 24 | void swaynag_log(const char *swaynag_command, struct swaynag_instance *swaynag, |
24 | const char *fmt, ...); | 25 | const char *fmt, ...) _SWAY_ATTRIB_PRINTF(3, 4); |
25 | 26 | ||
26 | // If swaynag->detailed, close swaynag->fd[1] so swaynag displays | 27 | // If swaynag->detailed, close swaynag->fd[1] so swaynag displays |
27 | void swaynag_show(struct swaynag_instance *swaynag); | 28 | void swaynag_show(struct swaynag_instance *swaynag); |
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index 751612e2..93f6bfbb 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <stdint.h> | 3 | #include <stdint.h> |
4 | #include <sys/types.h> | 4 | #include <sys/types.h> |
5 | #include <wlr/types/wlr_compositor.h> | 5 | #include <wlr/types/wlr_compositor.h> |
6 | #include <wlr/types/wlr_scene.h> | ||
6 | #include "list.h" | 7 | #include "list.h" |
7 | #include "sway/tree/node.h" | 8 | #include "sway/tree/node.h" |
8 | 9 | ||
@@ -68,11 +69,39 @@ struct sway_container { | |||
68 | struct sway_node node; | 69 | struct sway_node node; |
69 | struct sway_view *view; | 70 | struct sway_view *view; |
70 | 71 | ||
72 | struct wlr_scene_tree *scene_tree; | ||
73 | |||
74 | struct { | ||
75 | struct wlr_scene_tree *tree; | ||
76 | |||
77 | struct wlr_scene_tree *border; | ||
78 | struct wlr_scene_tree *background; | ||
79 | |||
80 | struct sway_text_node *title_text; | ||
81 | struct sway_text_node *marks_text; | ||
82 | } title_bar; | ||
83 | |||
84 | struct { | ||
85 | struct wlr_scene_tree *tree; | ||
86 | |||
87 | struct wlr_scene_rect *top; | ||
88 | struct wlr_scene_rect *bottom; | ||
89 | struct wlr_scene_rect *left; | ||
90 | struct wlr_scene_rect *right; | ||
91 | } border; | ||
92 | |||
93 | struct wlr_scene_tree *content_tree; | ||
94 | struct wlr_scene_buffer *output_handler; | ||
95 | |||
96 | struct wl_listener output_enter; | ||
97 | struct wl_listener output_leave; | ||
98 | |||
71 | struct sway_container_state current; | 99 | struct sway_container_state current; |
72 | struct sway_container_state pending; | 100 | struct sway_container_state pending; |
73 | 101 | ||
74 | char *title; // The view's title (unformatted) | 102 | char *title; // The view's title (unformatted) |
75 | char *formatted_title; // The title displayed in the title bar | 103 | char *formatted_title; // The title displayed in the title bar |
104 | int title_width; | ||
76 | 105 | ||
77 | enum sway_container_layout prev_split_layout; | 106 | enum sway_container_layout prev_split_layout; |
78 | 107 | ||
@@ -100,33 +129,19 @@ struct sway_container { | |||
100 | double child_total_width; | 129 | double child_total_width; |
101 | double child_total_height; | 130 | double child_total_height; |
102 | 131 | ||
103 | // In most cases this is the same as the content x and y, but if the view | ||
104 | // refuses to resize to the content dimensions then it can be smaller. | ||
105 | // These are in layout coordinates. | ||
106 | double surface_x, surface_y; | ||
107 | |||
108 | // Outputs currently being intersected | ||
109 | list_t *outputs; // struct sway_output | ||
110 | |||
111 | // Indicates that the container is a scratchpad container. | 132 | // Indicates that the container is a scratchpad container. |
112 | // Both hidden and visible scratchpad containers have scratchpad=true. | 133 | // Both hidden and visible scratchpad containers have scratchpad=true. |
113 | // Hidden scratchpad containers have a NULL parent. | 134 | // Hidden scratchpad containers have a NULL parent. |
114 | bool scratchpad; | 135 | bool scratchpad; |
115 | 136 | ||
116 | float alpha; | 137 | // Stores last output size and position for adjusting coordinates of |
138 | // scratchpad windows. | ||
139 | // Unused for non-scratchpad windows. | ||
140 | struct wlr_box transform; | ||
117 | 141 | ||
118 | struct wlr_texture *title_focused; | 142 | float alpha; |
119 | struct wlr_texture *title_focused_inactive; | ||
120 | struct wlr_texture *title_focused_tab_title; | ||
121 | struct wlr_texture *title_unfocused; | ||
122 | struct wlr_texture *title_urgent; | ||
123 | 143 | ||
124 | list_t *marks; // char * | 144 | list_t *marks; // char * |
125 | struct wlr_texture *marks_focused; | ||
126 | struct wlr_texture *marks_focused_inactive; | ||
127 | struct wlr_texture *marks_focused_tab_title; | ||
128 | struct wlr_texture *marks_unfocused; | ||
129 | struct wlr_texture *marks_urgent; | ||
130 | 145 | ||
131 | struct { | 146 | struct { |
132 | struct wl_signal destroy; | 147 | struct wl_signal destroy; |
@@ -146,19 +161,6 @@ void container_begin_destroy(struct sway_container *con); | |||
146 | struct sway_container *container_find_child(struct sway_container *container, | 161 | struct sway_container *container_find_child(struct sway_container *container, |
147 | bool (*test)(struct sway_container *view, void *data), void *data); | 162 | bool (*test)(struct sway_container *view, void *data), void *data); |
148 | 163 | ||
149 | /** | ||
150 | * Find a container at the given coordinates. Returns the surface and | ||
151 | * surface-local coordinates of the given layout coordinates if the container | ||
152 | * is a view and the view contains a surface at those coordinates. | ||
153 | */ | ||
154 | struct sway_container *container_at(struct sway_workspace *workspace, | ||
155 | double lx, double ly, struct wlr_surface **surface, | ||
156 | double *sx, double *sy); | ||
157 | |||
158 | struct sway_container *tiling_container_at( | ||
159 | struct sway_node *parent, double lx, double ly, | ||
160 | struct wlr_surface **surface, double *sx, double *sy); | ||
161 | |||
162 | void container_for_each_child(struct sway_container *container, | 164 | void container_for_each_child(struct sway_container *container, |
163 | void (*f)(struct sway_container *container, void *data), void *data); | 165 | void (*f)(struct sway_container *container, void *data), void *data); |
164 | 166 | ||
@@ -175,13 +177,13 @@ bool container_has_ancestor(struct sway_container *container, | |||
175 | 177 | ||
176 | void container_update_textures_recursive(struct sway_container *con); | 178 | void container_update_textures_recursive(struct sway_container *con); |
177 | 179 | ||
178 | void container_damage_whole(struct sway_container *container); | ||
179 | |||
180 | void container_reap_empty(struct sway_container *con); | 180 | void container_reap_empty(struct sway_container *con); |
181 | 181 | ||
182 | struct sway_container *container_flatten(struct sway_container *container); | 182 | struct sway_container *container_flatten(struct sway_container *container); |
183 | 183 | ||
184 | void container_update_title_textures(struct sway_container *container); | 184 | void container_update_title_bar(struct sway_container *container); |
185 | |||
186 | void container_update_marks(struct sway_container *container); | ||
185 | 187 | ||
186 | size_t container_build_representation(enum sway_container_layout layout, | 188 | size_t container_build_representation(enum sway_container_layout layout, |
187 | list_t *children, char *buffer); | 189 | list_t *children, char *buffer); |
@@ -196,6 +198,9 @@ size_t container_titlebar_height(void); | |||
196 | void floating_calculate_constraints(int *min_width, int *max_width, | 198 | void floating_calculate_constraints(int *min_width, int *max_width, |
197 | int *min_height, int *max_height); | 199 | int *min_height, int *max_height); |
198 | 200 | ||
201 | void floating_fix_coordinates(struct sway_container *con, | ||
202 | struct wlr_box *old, struct wlr_box *new); | ||
203 | |||
199 | void container_floating_resize_and_center(struct sway_container *con); | 204 | void container_floating_resize_and_center(struct sway_container *con); |
200 | 205 | ||
201 | void container_floating_set_default_size(struct sway_container *con); | 206 | void container_floating_set_default_size(struct sway_container *con); |
@@ -215,11 +220,6 @@ void container_set_geometry_from_content(struct sway_container *con); | |||
215 | bool container_is_floating(struct sway_container *container); | 220 | bool container_is_floating(struct sway_container *container); |
216 | 221 | ||
217 | /** | 222 | /** |
218 | * Same as above, but for current container state. | ||
219 | */ | ||
220 | bool container_is_current_floating(struct sway_container *container); | ||
221 | |||
222 | /** | ||
223 | * Get a container's box in layout coordinates. | 223 | * Get a container's box in layout coordinates. |
224 | */ | 224 | */ |
225 | void container_get_box(struct sway_container *container, struct wlr_box *box); | 225 | void container_get_box(struct sway_container *container, struct wlr_box *box); |
@@ -281,26 +281,12 @@ bool container_is_floating_or_child(struct sway_container *container); | |||
281 | */ | 281 | */ |
282 | bool container_is_fullscreen_or_child(struct sway_container *container); | 282 | bool container_is_fullscreen_or_child(struct sway_container *container); |
283 | 283 | ||
284 | /** | ||
285 | * Return the output which will be used for scale purposes. | ||
286 | * This is the most recently entered output. | ||
287 | * If the container is not on any output, return NULL. | ||
288 | */ | ||
289 | struct sway_output *container_get_effective_output(struct sway_container *con); | ||
290 | |||
291 | void container_discover_outputs(struct sway_container *con); | ||
292 | |||
293 | enum sway_container_layout container_parent_layout(struct sway_container *con); | 284 | enum sway_container_layout container_parent_layout(struct sway_container *con); |
294 | 285 | ||
295 | enum sway_container_layout container_current_parent_layout( | ||
296 | struct sway_container *con); | ||
297 | |||
298 | list_t *container_get_siblings(struct sway_container *container); | 286 | list_t *container_get_siblings(struct sway_container *container); |
299 | 287 | ||
300 | int container_sibling_index(struct sway_container *child); | 288 | int container_sibling_index(struct sway_container *child); |
301 | 289 | ||
302 | list_t *container_get_current_siblings(struct sway_container *container); | ||
303 | |||
304 | void container_handle_fullscreen_reparent(struct sway_container *con); | 290 | void container_handle_fullscreen_reparent(struct sway_container *con); |
305 | 291 | ||
306 | void container_add_child(struct sway_container *parent, | 292 | void container_add_child(struct sway_container *parent, |
@@ -348,8 +334,6 @@ bool container_has_mark(struct sway_container *container, char *mark); | |||
348 | 334 | ||
349 | void container_add_mark(struct sway_container *container, char *mark); | 335 | void container_add_mark(struct sway_container *container, char *mark); |
350 | 336 | ||
351 | void container_update_marks_textures(struct sway_container *container); | ||
352 | |||
353 | void container_raise_floating(struct sway_container *con); | 337 | void container_raise_floating(struct sway_container *con); |
354 | 338 | ||
355 | bool container_is_scratchpad_hidden(struct sway_container *con); | 339 | bool container_is_scratchpad_hidden(struct sway_container *con); |
@@ -373,4 +357,10 @@ bool container_is_sticky_or_child(struct sway_container *con); | |||
373 | */ | 357 | */ |
374 | int container_squash(struct sway_container *con); | 358 | int container_squash(struct sway_container *con); |
375 | 359 | ||
360 | void container_arrange_title_bar(struct sway_container *con); | ||
361 | |||
362 | void container_update(struct sway_container *con); | ||
363 | |||
364 | void container_update_itself_and_parents(struct sway_container *con); | ||
365 | |||
376 | #endif | 366 | #endif |
diff --git a/include/sway/tree/node.h b/include/sway/tree/node.h index 470ee3b5..e2dbcdf0 100644 --- a/include/sway/tree/node.h +++ b/include/sway/tree/node.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _SWAY_NODE_H | 1 | #ifndef _SWAY_NODE_H |
2 | #define _SWAY_NODE_H | 2 | #define _SWAY_NODE_H |
3 | #include <wayland-server-core.h> | ||
3 | #include <stdbool.h> | 4 | #include <stdbool.h> |
5 | #include <wlr/types/wlr_scene.h> | ||
4 | #include "list.h" | 6 | #include "list.h" |
5 | 7 | ||
6 | #define MIN_SANE_W 100 | 8 | #define MIN_SANE_W 100 |
@@ -74,4 +76,15 @@ list_t *node_get_children(struct sway_node *node); | |||
74 | 76 | ||
75 | bool node_has_ancestor(struct sway_node *node, struct sway_node *ancestor); | 77 | bool node_has_ancestor(struct sway_node *node, struct sway_node *ancestor); |
76 | 78 | ||
79 | // when destroying a sway tree, it's not known which order the tree will be | ||
80 | // destroyed. To prevent freeing of scene_nodes recursing up the tree, | ||
81 | // let's use this helper function to disown them to the staging node. | ||
82 | void scene_node_disown_children(struct wlr_scene_tree *tree); | ||
83 | |||
84 | // a helper function used to allocate tree nodes. If an allocation failure | ||
85 | // occurs a flag is flipped that can be checked later to destroy a parent | ||
86 | // of this scene node preventing memory leaks. | ||
87 | struct wlr_scene_tree *alloc_scene_tree(struct wlr_scene_tree *parent, | ||
88 | bool *failed); | ||
89 | |||
77 | #endif | 90 | #endif |
diff --git a/include/sway/tree/root.h b/include/sway/tree/root.h index 5d4a2f2d..7de0abcd 100644 --- a/include/sway/tree/root.h +++ b/include/sway/tree/root.h | |||
@@ -2,11 +2,12 @@ | |||
2 | #define _SWAY_ROOT_H | 2 | #define _SWAY_ROOT_H |
3 | #include <wayland-server-core.h> | 3 | #include <wayland-server-core.h> |
4 | #include <wayland-util.h> | 4 | #include <wayland-util.h> |
5 | #include <wlr/config.h> | ||
5 | #include <wlr/types/wlr_output_layout.h> | 6 | #include <wlr/types/wlr_output_layout.h> |
7 | #include <wlr/types/wlr_scene.h> | ||
6 | #include <wlr/render/wlr_texture.h> | 8 | #include <wlr/render/wlr_texture.h> |
7 | #include "sway/tree/container.h" | 9 | #include "sway/tree/container.h" |
8 | #include "sway/tree/node.h" | 10 | #include "sway/tree/node.h" |
9 | #include "config.h" | ||
10 | #include "list.h" | 11 | #include "list.h" |
11 | 12 | ||
12 | extern struct sway_root *root; | 13 | extern struct sway_root *root; |
@@ -16,10 +17,44 @@ struct sway_root { | |||
16 | struct wlr_output_layout *output_layout; | 17 | struct wlr_output_layout *output_layout; |
17 | 18 | ||
18 | struct wl_listener output_layout_change; | 19 | struct wl_listener output_layout_change; |
19 | #if HAVE_XWAYLAND | 20 | |
20 | struct wl_list xwayland_unmanaged; // sway_xwayland_unmanaged::link | 21 | // scene node layout: |
22 | // - root | ||
23 | // - staging | ||
24 | // - layer shell stuff | ||
25 | // - tiling | ||
26 | // - floating | ||
27 | // - fullscreen stuff | ||
28 | // - seat stuff | ||
29 | // - ext_session_lock | ||
30 | struct wlr_scene *root_scene; | ||
31 | |||
32 | // since wlr_scene nodes can't be orphaned and must always | ||
33 | // have a parent, use this staging scene_tree so that a | ||
34 | // node always have a valid parent. Nothing in this | ||
35 | // staging node will be visible. | ||
36 | struct wlr_scene_tree *staging; | ||
37 | |||
38 | // tree containing all layers the compositor will render. Cursor handling | ||
39 | // will end up iterating this tree. | ||
40 | struct wlr_scene_tree *layer_tree; | ||
41 | |||
42 | struct { | ||
43 | struct wlr_scene_tree *shell_background; | ||
44 | struct wlr_scene_tree *shell_bottom; | ||
45 | struct wlr_scene_tree *tiling; | ||
46 | struct wlr_scene_tree *floating; | ||
47 | struct wlr_scene_tree *shell_top; | ||
48 | struct wlr_scene_tree *fullscreen; | ||
49 | struct wlr_scene_tree *fullscreen_global; | ||
50 | #if WLR_HAS_XWAYLAND | ||
51 | struct wlr_scene_tree *unmanaged; | ||
21 | #endif | 52 | #endif |
22 | struct wl_list drag_icons; // sway_drag_icon::link | 53 | struct wlr_scene_tree *shell_overlay; |
54 | struct wlr_scene_tree *popup; | ||
55 | struct wlr_scene_tree *seat; | ||
56 | struct wlr_scene_tree *session_lock; | ||
57 | } layers; | ||
23 | 58 | ||
24 | // Includes disabled outputs | 59 | // Includes disabled outputs |
25 | struct wl_list all_outputs; // sway_output::link | 60 | struct wl_list all_outputs; // sway_output::link |
@@ -28,6 +63,7 @@ struct sway_root { | |||
28 | double width, height; | 63 | double width, height; |
29 | 64 | ||
30 | list_t *outputs; // struct sway_output | 65 | list_t *outputs; // struct sway_output |
66 | list_t *non_desktop_outputs; // struct sway_output_non_desktop | ||
31 | list_t *scratchpad; // struct sway_container | 67 | list_t *scratchpad; // struct sway_container |
32 | 68 | ||
33 | // For when there's no connected outputs | 69 | // For when there's no connected outputs |
@@ -40,7 +76,7 @@ struct sway_root { | |||
40 | } events; | 76 | } events; |
41 | }; | 77 | }; |
42 | 78 | ||
43 | struct sway_root *root_create(void); | 79 | struct sway_root *root_create(struct wl_display *display); |
44 | 80 | ||
45 | void root_destroy(struct sway_root *root); | 81 | void root_destroy(struct sway_root *root); |
46 | 82 | ||
@@ -68,12 +104,6 @@ void root_scratchpad_show(struct sway_container *con); | |||
68 | */ | 104 | */ |
69 | void root_scratchpad_hide(struct sway_container *con); | 105 | void root_scratchpad_hide(struct sway_container *con); |
70 | 106 | ||
71 | struct sway_workspace *root_workspace_for_pid(pid_t pid); | ||
72 | |||
73 | void root_record_workspace_pid(pid_t pid); | ||
74 | |||
75 | void root_remove_workspace_pid(pid_t pid); | ||
76 | |||
77 | void root_for_each_workspace(void (*f)(struct sway_workspace *ws, void *data), | 107 | void root_for_each_workspace(void (*f)(struct sway_workspace *ws, void *data), |
78 | void *data); | 108 | void *data); |
79 | 109 | ||
@@ -91,6 +121,4 @@ struct sway_container *root_find_container( | |||
91 | 121 | ||
92 | void root_get_box(struct sway_root *root, struct wlr_box *box); | 122 | void root_get_box(struct sway_root *root, struct wlr_box *box); |
93 | 123 | ||
94 | void root_rename_pid_workspaces(const char *old_name, const char *new_name); | ||
95 | |||
96 | #endif | 124 | #endif |
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index 0dcbf1aa..3ae8cf22 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h | |||
@@ -1,9 +1,11 @@ | |||
1 | #ifndef _SWAY_VIEW_H | 1 | #ifndef _SWAY_VIEW_H |
2 | #define _SWAY_VIEW_H | 2 | #define _SWAY_VIEW_H |
3 | #include <wayland-server-core.h> | 3 | #include <wayland-server-core.h> |
4 | #include <wlr/config.h> | ||
4 | #include <wlr/types/wlr_compositor.h> | 5 | #include <wlr/types/wlr_compositor.h> |
5 | #include "config.h" | 6 | #include <wlr/types/wlr_scene.h> |
6 | #if HAVE_XWAYLAND | 7 | #include "sway/config.h" |
8 | #if WLR_HAS_XWAYLAND | ||
7 | #include <wlr/xwayland.h> | 9 | #include <wlr/xwayland.h> |
8 | #endif | 10 | #endif |
9 | #include "sway/input/input-manager.h" | 11 | #include "sway/input/input-manager.h" |
@@ -14,7 +16,7 @@ struct sway_xdg_decoration; | |||
14 | 16 | ||
15 | enum sway_view_type { | 17 | enum sway_view_type { |
16 | SWAY_VIEW_XDG_SHELL, | 18 | SWAY_VIEW_XDG_SHELL, |
17 | #if HAVE_XWAYLAND | 19 | #if WLR_HAS_XWAYLAND |
18 | SWAY_VIEW_XWAYLAND, | 20 | SWAY_VIEW_XWAYLAND, |
19 | #endif | 21 | #endif |
20 | }; | 22 | }; |
@@ -26,7 +28,7 @@ enum sway_view_prop { | |||
26 | VIEW_PROP_INSTANCE, | 28 | VIEW_PROP_INSTANCE, |
27 | VIEW_PROP_WINDOW_TYPE, | 29 | VIEW_PROP_WINDOW_TYPE, |
28 | VIEW_PROP_WINDOW_ROLE, | 30 | VIEW_PROP_WINDOW_ROLE, |
29 | #if HAVE_XWAYLAND | 31 | #if WLR_HAS_XWAYLAND |
30 | VIEW_PROP_X11_WINDOW_ID, | 32 | VIEW_PROP_X11_WINDOW_ID, |
31 | VIEW_PROP_X11_PARENT_ID, | 33 | VIEW_PROP_X11_PARENT_ID, |
32 | #endif | 34 | #endif |
@@ -45,10 +47,6 @@ struct sway_view_impl { | |||
45 | void (*set_fullscreen)(struct sway_view *view, bool fullscreen); | 47 | void (*set_fullscreen)(struct sway_view *view, bool fullscreen); |
46 | void (*set_resizing)(struct sway_view *view, bool resizing); | 48 | void (*set_resizing)(struct sway_view *view, bool resizing); |
47 | bool (*wants_floating)(struct sway_view *view); | 49 | bool (*wants_floating)(struct sway_view *view); |
48 | void (*for_each_surface)(struct sway_view *view, | ||
49 | wlr_surface_iterator_func_t iterator, void *user_data); | ||
50 | void (*for_each_popup_surface)(struct sway_view *view, | ||
51 | wlr_surface_iterator_func_t iterator, void *user_data); | ||
52 | bool (*is_transient_for)(struct sway_view *child, | 50 | bool (*is_transient_for)(struct sway_view *child, |
53 | struct sway_view *ancestor); | 51 | struct sway_view *ancestor); |
54 | void (*close)(struct sway_view *view); | 52 | void (*close)(struct sway_view *view); |
@@ -56,24 +54,20 @@ struct sway_view_impl { | |||
56 | void (*destroy)(struct sway_view *view); | 54 | void (*destroy)(struct sway_view *view); |
57 | }; | 55 | }; |
58 | 56 | ||
59 | struct sway_saved_buffer { | ||
60 | struct wlr_client_buffer *buffer; | ||
61 | int x, y; | ||
62 | int width, height; | ||
63 | enum wl_output_transform transform; | ||
64 | struct wlr_fbox source_box; | ||
65 | struct wl_list link; // sway_view::saved_buffers | ||
66 | }; | ||
67 | |||
68 | struct sway_view { | 57 | struct sway_view { |
69 | enum sway_view_type type; | 58 | enum sway_view_type type; |
70 | const struct sway_view_impl *impl; | 59 | const struct sway_view_impl *impl; |
71 | 60 | ||
61 | struct wlr_scene_tree *scene_tree; | ||
62 | struct wlr_scene_tree *content_tree; | ||
63 | struct wlr_scene_tree *saved_surface_tree; | ||
64 | |||
72 | struct sway_container *container; // NULL if unmapped and transactions finished | 65 | struct sway_container *container; // NULL if unmapped and transactions finished |
73 | struct wlr_surface *surface; // NULL for unmapped views | 66 | struct wlr_surface *surface; // NULL for unmapped views |
74 | struct sway_xdg_decoration *xdg_decoration; | 67 | struct sway_xdg_decoration *xdg_decoration; |
75 | 68 | ||
76 | pid_t pid; | 69 | pid_t pid; |
70 | struct launcher_ctx *ctx; | ||
77 | 71 | ||
78 | // The size the view would want to be if it weren't tiled. | 72 | // The size the view would want to be if it weren't tiled. |
79 | // Used when changing a view from tiled to floating. | 73 | // Used when changing a view from tiled to floating. |
@@ -87,15 +81,11 @@ struct sway_view { | |||
87 | bool allow_request_urgent; | 81 | bool allow_request_urgent; |
88 | struct wl_event_source *urgent_timer; | 82 | struct wl_event_source *urgent_timer; |
89 | 83 | ||
90 | struct wl_list saved_buffers; // sway_saved_buffer::link | ||
91 | |||
92 | // The geometry for whatever the client is committing, regardless of | 84 | // The geometry for whatever the client is committing, regardless of |
93 | // transaction state. Updated on every commit. | 85 | // transaction state. Updated on every commit. |
94 | struct wlr_box geometry; | 86 | struct wlr_box geometry; |
95 | 87 | ||
96 | // The "old" geometry during a transaction. Used to damage the old location | 88 | struct wlr_ext_foreign_toplevel_handle_v1 *ext_foreign_toplevel; |
97 | // when a transaction is applied. | ||
98 | struct wlr_box saved_geometry; | ||
99 | 89 | ||
100 | struct wlr_foreign_toplevel_handle_v1 *foreign_toplevel; | 90 | struct wlr_foreign_toplevel_handle_v1 *foreign_toplevel; |
101 | struct wl_listener foreign_activate_request; | 91 | struct wl_listener foreign_activate_request; |
@@ -109,7 +99,7 @@ struct sway_view { | |||
109 | 99 | ||
110 | union { | 100 | union { |
111 | struct wlr_xdg_toplevel *wlr_xdg_toplevel; | 101 | struct wlr_xdg_toplevel *wlr_xdg_toplevel; |
112 | #if HAVE_XWAYLAND | 102 | #if WLR_HAS_XWAYLAND |
113 | struct wlr_xwayland_surface *wlr_xwayland_surface; | 103 | struct wlr_xwayland_surface *wlr_xwayland_surface; |
114 | #endif | 104 | #endif |
115 | }; | 105 | }; |
@@ -118,8 +108,6 @@ struct sway_view { | |||
118 | struct wl_signal unmap; | 108 | struct wl_signal unmap; |
119 | } events; | 109 | } events; |
120 | 110 | ||
121 | struct wl_listener surface_new_subsurface; | ||
122 | |||
123 | int max_render_time; // In milliseconds | 111 | int max_render_time; // In milliseconds |
124 | 112 | ||
125 | enum seat_config_shortcuts_inhibit shortcuts_inhibit; | 113 | enum seat_config_shortcuts_inhibit shortcuts_inhibit; |
@@ -140,10 +128,12 @@ struct sway_xdg_shell_view { | |||
140 | struct wl_listener unmap; | 128 | struct wl_listener unmap; |
141 | struct wl_listener destroy; | 129 | struct wl_listener destroy; |
142 | }; | 130 | }; |
143 | #if HAVE_XWAYLAND | 131 | #if WLR_HAS_XWAYLAND |
144 | struct sway_xwayland_view { | 132 | struct sway_xwayland_view { |
145 | struct sway_view view; | 133 | struct sway_view view; |
146 | 134 | ||
135 | struct wlr_scene_tree *surface_tree; | ||
136 | |||
147 | struct wl_listener commit; | 137 | struct wl_listener commit; |
148 | struct wl_listener request_move; | 138 | struct wl_listener request_move; |
149 | struct wl_listener request_resize; | 139 | struct wl_listener request_resize; |
@@ -155,72 +145,55 @@ struct sway_xwayland_view { | |||
155 | struct wl_listener set_title; | 145 | struct wl_listener set_title; |
156 | struct wl_listener set_class; | 146 | struct wl_listener set_class; |
157 | struct wl_listener set_role; | 147 | struct wl_listener set_role; |
148 | struct wl_listener set_startup_id; | ||
158 | struct wl_listener set_window_type; | 149 | struct wl_listener set_window_type; |
159 | struct wl_listener set_hints; | 150 | struct wl_listener set_hints; |
160 | struct wl_listener set_decorations; | 151 | struct wl_listener set_decorations; |
152 | struct wl_listener associate; | ||
153 | struct wl_listener dissociate; | ||
161 | struct wl_listener map; | 154 | struct wl_listener map; |
162 | struct wl_listener unmap; | 155 | struct wl_listener unmap; |
163 | struct wl_listener destroy; | 156 | struct wl_listener destroy; |
164 | struct wl_listener override_redirect; | 157 | struct wl_listener override_redirect; |
158 | |||
159 | struct wl_listener surface_tree_destroy; | ||
165 | }; | 160 | }; |
166 | 161 | ||
167 | struct sway_xwayland_unmanaged { | 162 | struct sway_xwayland_unmanaged { |
168 | struct wlr_xwayland_surface *wlr_xwayland_surface; | 163 | struct wlr_xwayland_surface *wlr_xwayland_surface; |
169 | struct wl_list link; | ||
170 | 164 | ||
171 | int lx, ly; | 165 | struct wlr_scene_surface *surface_scene; |
172 | 166 | ||
173 | struct wl_listener request_activate; | 167 | struct wl_listener request_activate; |
174 | struct wl_listener request_configure; | 168 | struct wl_listener request_configure; |
175 | struct wl_listener request_fullscreen; | 169 | struct wl_listener request_fullscreen; |
176 | struct wl_listener commit; | ||
177 | struct wl_listener set_geometry; | 170 | struct wl_listener set_geometry; |
171 | struct wl_listener associate; | ||
172 | struct wl_listener dissociate; | ||
178 | struct wl_listener map; | 173 | struct wl_listener map; |
179 | struct wl_listener unmap; | 174 | struct wl_listener unmap; |
180 | struct wl_listener destroy; | 175 | struct wl_listener destroy; |
181 | struct wl_listener override_redirect; | 176 | struct wl_listener override_redirect; |
182 | }; | 177 | }; |
183 | #endif | 178 | #endif |
184 | struct sway_view_child; | ||
185 | |||
186 | struct sway_view_child_impl { | ||
187 | void (*get_view_coords)(struct sway_view_child *child, int *sx, int *sy); | ||
188 | void (*destroy)(struct sway_view_child *child); | ||
189 | }; | ||
190 | |||
191 | /** | ||
192 | * A view child is a surface in the view tree, such as a subsurface or a popup. | ||
193 | */ | ||
194 | struct sway_view_child { | ||
195 | const struct sway_view_child_impl *impl; | ||
196 | struct wl_list link; | ||
197 | 179 | ||
180 | struct sway_popup_desc { | ||
181 | struct wlr_scene_node *relative; | ||
198 | struct sway_view *view; | 182 | struct sway_view *view; |
199 | struct sway_view_child *parent; | ||
200 | struct wl_list children; // sway_view_child::link | ||
201 | struct wlr_surface *surface; | ||
202 | bool mapped; | ||
203 | |||
204 | struct wl_listener surface_commit; | ||
205 | struct wl_listener surface_new_subsurface; | ||
206 | struct wl_listener surface_map; | ||
207 | struct wl_listener surface_unmap; | ||
208 | struct wl_listener surface_destroy; | ||
209 | struct wl_listener view_unmap; | ||
210 | }; | ||
211 | |||
212 | struct sway_subsurface { | ||
213 | struct sway_view_child child; | ||
214 | |||
215 | struct wl_listener destroy; | ||
216 | }; | 183 | }; |
217 | 184 | ||
218 | struct sway_xdg_popup { | 185 | struct sway_xdg_popup { |
219 | struct sway_view_child child; | 186 | struct sway_view *view; |
220 | 187 | ||
188 | struct wlr_scene_tree *scene_tree; | ||
189 | struct wlr_scene_tree *xdg_surface_tree; | ||
221 | struct wlr_xdg_popup *wlr_xdg_popup; | 190 | struct wlr_xdg_popup *wlr_xdg_popup; |
222 | 191 | ||
192 | struct sway_popup_desc desc; | ||
193 | |||
194 | struct wl_listener surface_commit; | ||
223 | struct wl_listener new_popup; | 195 | struct wl_listener new_popup; |
196 | struct wl_listener reposition; | ||
224 | struct wl_listener destroy; | 197 | struct wl_listener destroy; |
225 | }; | 198 | }; |
226 | 199 | ||
@@ -269,7 +242,12 @@ void view_set_activated(struct sway_view *view, bool activated); | |||
269 | /** | 242 | /** |
270 | * Called when the view requests to be focused. | 243 | * Called when the view requests to be focused. |
271 | */ | 244 | */ |
272 | void view_request_activate(struct sway_view *view); | 245 | void view_request_activate(struct sway_view *view, struct sway_seat *seat); |
246 | |||
247 | /* | ||
248 | * Called when the view requests urgent state | ||
249 | */ | ||
250 | void view_request_urgent(struct sway_view *view); | ||
273 | 251 | ||
274 | /** | 252 | /** |
275 | * If possible, instructs the client to change their decoration mode. | 253 | * If possible, instructs the client to change their decoration mode. |
@@ -288,23 +266,9 @@ void view_close(struct sway_view *view); | |||
288 | 266 | ||
289 | void view_close_popups(struct sway_view *view); | 267 | void view_close_popups(struct sway_view *view); |
290 | 268 | ||
291 | void view_damage_from(struct sway_view *view); | ||
292 | |||
293 | /** | ||
294 | * Iterate all surfaces of a view (toplevels + popups). | ||
295 | */ | ||
296 | void view_for_each_surface(struct sway_view *view, | ||
297 | wlr_surface_iterator_func_t iterator, void *user_data); | ||
298 | |||
299 | /** | ||
300 | * Iterate all popup surfaces of a view. | ||
301 | */ | ||
302 | void view_for_each_popup_surface(struct sway_view *view, | ||
303 | wlr_surface_iterator_func_t iterator, void *user_data); | ||
304 | |||
305 | // view implementation | 269 | // view implementation |
306 | 270 | ||
307 | void view_init(struct sway_view *view, enum sway_view_type type, | 271 | bool view_init(struct sway_view *view, enum sway_view_type type, |
308 | const struct sway_view_impl *impl); | 272 | const struct sway_view_impl *impl); |
309 | 273 | ||
310 | void view_destroy(struct sway_view *view); | 274 | void view_destroy(struct sway_view *view); |
@@ -326,23 +290,18 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface, | |||
326 | void view_unmap(struct sway_view *view); | 290 | void view_unmap(struct sway_view *view); |
327 | 291 | ||
328 | void view_update_size(struct sway_view *view); | 292 | void view_update_size(struct sway_view *view); |
329 | void view_center_surface(struct sway_view *view); | 293 | void view_center_and_clip_surface(struct sway_view *view); |
330 | |||
331 | void view_child_init(struct sway_view_child *child, | ||
332 | const struct sway_view_child_impl *impl, struct sway_view *view, | ||
333 | struct wlr_surface *surface); | ||
334 | |||
335 | void view_child_destroy(struct sway_view_child *child); | ||
336 | |||
337 | 294 | ||
338 | struct sway_view *view_from_wlr_xdg_surface( | 295 | struct sway_view *view_from_wlr_xdg_surface( |
339 | struct wlr_xdg_surface *xdg_surface); | 296 | struct wlr_xdg_surface *xdg_surface); |
340 | #if HAVE_XWAYLAND | 297 | #if WLR_HAS_XWAYLAND |
341 | struct sway_view *view_from_wlr_xwayland_surface( | 298 | struct sway_view *view_from_wlr_xwayland_surface( |
342 | struct wlr_xwayland_surface *xsurface); | 299 | struct wlr_xwayland_surface *xsurface); |
343 | #endif | 300 | #endif |
344 | struct sway_view *view_from_wlr_surface(struct wlr_surface *surface); | 301 | struct sway_view *view_from_wlr_surface(struct wlr_surface *surface); |
345 | 302 | ||
303 | void view_update_app_id(struct sway_view *view); | ||
304 | |||
346 | /** | 305 | /** |
347 | * Re-read the view's title property and update any relevant title bars. | 306 | * Re-read the view's title property and update any relevant title bars. |
348 | * The force argument makes it recreate the title bars even if the title hasn't | 307 | * The force argument makes it recreate the title bars even if the title hasn't |
@@ -372,4 +331,8 @@ void view_save_buffer(struct sway_view *view); | |||
372 | 331 | ||
373 | bool view_is_transient_for(struct sway_view *child, struct sway_view *ancestor); | 332 | bool view_is_transient_for(struct sway_view *child, struct sway_view *ancestor); |
374 | 333 | ||
334 | void view_assign_ctx(struct sway_view *view, struct launcher_ctx *ctx); | ||
335 | |||
336 | void view_send_frame_done(struct sway_view *view); | ||
337 | |||
375 | #endif | 338 | #endif |
diff --git a/include/sway/tree/workspace.h b/include/sway/tree/workspace.h index b3d93a81..58bde20c 100644 --- a/include/sway/tree/workspace.h +++ b/include/sway/tree/workspace.h | |||
@@ -2,6 +2,8 @@ | |||
2 | #define _SWAY_WORKSPACE_H | 2 | #define _SWAY_WORKSPACE_H |
3 | 3 | ||
4 | #include <stdbool.h> | 4 | #include <stdbool.h> |
5 | #include <wlr/types/wlr_scene.h> | ||
6 | #include "sway/config.h" | ||
5 | #include "sway/tree/container.h" | 7 | #include "sway/tree/container.h" |
6 | #include "sway/tree/node.h" | 8 | #include "sway/tree/node.h" |
7 | 9 | ||
@@ -22,6 +24,12 @@ struct sway_workspace_state { | |||
22 | 24 | ||
23 | struct sway_workspace { | 25 | struct sway_workspace { |
24 | struct sway_node node; | 26 | struct sway_node node; |
27 | |||
28 | struct { | ||
29 | struct wlr_scene_tree *tiling; | ||
30 | struct wlr_scene_tree *fullscreen; | ||
31 | } layers; | ||
32 | |||
25 | struct sway_container *fullscreen; | 33 | struct sway_container *fullscreen; |
26 | 34 | ||
27 | char *name; | 35 | char *name; |
diff --git a/include/sway/xdg_decoration.h b/include/sway/xdg_decoration.h index 8bef4c6d..2388ebcb 100644 --- a/include/sway/xdg_decoration.h +++ b/include/sway/xdg_decoration.h | |||
@@ -16,4 +16,6 @@ struct sway_xdg_decoration { | |||
16 | struct sway_xdg_decoration *xdg_decoration_from_surface( | 16 | struct sway_xdg_decoration *xdg_decoration_from_surface( |
17 | struct wlr_surface *surface); | 17 | struct wlr_surface *surface); |
18 | 18 | ||
19 | void set_xdg_decoration_mode(struct sway_xdg_decoration *deco); | ||
20 | |||
19 | #endif | 21 | #endif |