diff options
Diffstat (limited to 'include/sway')
-rw-r--r-- | include/sway/commands.h | 6 | ||||
-rw-r--r-- | include/sway/config.h | 10 | ||||
-rw-r--r-- | include/sway/desktop/idle_inhibit_v1.h | 1 | ||||
-rw-r--r-- | include/sway/desktop/transaction.h | 12 | ||||
-rw-r--r-- | include/sway/input/libinput.h | 2 | ||||
-rw-r--r-- | include/sway/input/text_input.h | 3 | ||||
-rw-r--r-- | include/sway/output.h | 4 | ||||
-rw-r--r-- | include/sway/server.h | 23 | ||||
-rw-r--r-- | include/sway/tree/container.h | 52 | ||||
-rw-r--r-- | include/sway/tree/view.h | 3 | ||||
-rw-r--r-- | include/sway/tree/workspace.h | 6 |
11 files changed, 75 insertions, 47 deletions
diff --git a/include/sway/commands.h b/include/sway/commands.h index 964b3661..29a6bec3 100644 --- a/include/sway/commands.h +++ b/include/sway/commands.h | |||
@@ -46,8 +46,8 @@ enum expected_args { | |||
46 | struct cmd_results *checkarg(int argc, const char *name, | 46 | struct cmd_results *checkarg(int argc, const char *name, |
47 | enum expected_args type, int val); | 47 | enum expected_args type, int val); |
48 | 48 | ||
49 | struct cmd_handler *find_handler(char *line, struct cmd_handler *cmd_handlers, | 49 | const struct cmd_handler *find_handler(char *line, |
50 | size_t handlers_size); | 50 | const struct cmd_handler *cmd_handlers, size_t handlers_size); |
51 | 51 | ||
52 | /** | 52 | /** |
53 | * Parse and executes a command. | 53 | * Parse and executes a command. |
@@ -68,7 +68,7 @@ struct cmd_results *config_command(char *command, char **new_block); | |||
68 | * Parse and handle a sub command | 68 | * Parse and handle a sub command |
69 | */ | 69 | */ |
70 | struct cmd_results *config_subcommand(char **argv, int argc, | 70 | struct cmd_results *config_subcommand(char **argv, int argc, |
71 | struct cmd_handler *handlers, size_t handlers_size); | 71 | const struct cmd_handler *handlers, size_t handlers_size); |
72 | /* | 72 | /* |
73 | * Parses a command policy rule. | 73 | * Parses a command policy rule. |
74 | */ | 74 | */ |
diff --git a/include/sway/config.h b/include/sway/config.h index 59f22ae2..254fbad0 100644 --- a/include/sway/config.h +++ b/include/sway/config.h | |||
@@ -292,6 +292,12 @@ struct workspace_config { | |||
292 | struct side_gaps gaps_outer; | 292 | struct side_gaps gaps_outer; |
293 | }; | 293 | }; |
294 | 294 | ||
295 | enum pango_markup_config { | ||
296 | PANGO_MARKUP_DISABLED = false, | ||
297 | PANGO_MARKUP_ENABLED = true, | ||
298 | PANGO_MARKUP_DEFAULT // The default is font dependent ("pango:" prefix) | ||
299 | }; | ||
300 | |||
295 | struct bar_config { | 301 | struct bar_config { |
296 | char *swaybar_command; | 302 | char *swaybar_command; |
297 | struct wl_client *client; | 303 | struct wl_client *client; |
@@ -323,7 +329,7 @@ struct bar_config { | |||
323 | char *position; | 329 | char *position; |
324 | list_t *bindings; | 330 | list_t *bindings; |
325 | char *status_command; | 331 | char *status_command; |
326 | bool pango_markup; | 332 | enum pango_markup_config pango_markup; |
327 | char *font; | 333 | char *font; |
328 | int height; // -1 not defined | 334 | int height; // -1 not defined |
329 | bool workspace_buttons; | 335 | bool workspace_buttons; |
@@ -559,7 +565,7 @@ struct sway_config { | |||
559 | struct sway_node *node; | 565 | struct sway_node *node; |
560 | struct sway_container *container; | 566 | struct sway_container *container; |
561 | struct sway_workspace *workspace; | 567 | struct sway_workspace *workspace; |
562 | bool using_criteria; | 568 | bool node_overridden; // True if the node is selected by means other than focus |
563 | struct { | 569 | struct { |
564 | int argc; | 570 | int argc; |
565 | char **argv; | 571 | char **argv; |
diff --git a/include/sway/desktop/idle_inhibit_v1.h b/include/sway/desktop/idle_inhibit_v1.h index 0adafdb9..58d54c68 100644 --- a/include/sway/desktop/idle_inhibit_v1.h +++ b/include/sway/desktop/idle_inhibit_v1.h | |||
@@ -22,6 +22,7 @@ struct sway_idle_inhibit_manager_v1 { | |||
22 | 22 | ||
23 | struct sway_idle_inhibitor_v1 { | 23 | struct sway_idle_inhibitor_v1 { |
24 | struct sway_idle_inhibit_manager_v1 *manager; | 24 | struct sway_idle_inhibit_manager_v1 *manager; |
25 | struct wlr_idle_inhibitor_v1 *wlr_inhibitor; | ||
25 | struct sway_view *view; | 26 | struct sway_view *view; |
26 | enum sway_idle_inhibit_mode mode; | 27 | enum sway_idle_inhibit_mode mode; |
27 | 28 | ||
diff --git a/include/sway/desktop/transaction.h b/include/sway/desktop/transaction.h index 175489c5..7dd58ba8 100644 --- a/include/sway/desktop/transaction.h +++ b/include/sway/desktop/transaction.h | |||
@@ -28,6 +28,12 @@ struct sway_view; | |||
28 | */ | 28 | */ |
29 | void transaction_commit_dirty(void); | 29 | void transaction_commit_dirty(void); |
30 | 30 | ||
31 | /* | ||
32 | * Same as transaction_commit_dirty, but signalling that this is a | ||
33 | * client-initiated change has already taken effect. | ||
34 | */ | ||
35 | void transaction_commit_dirty_client(void); | ||
36 | |||
31 | /** | 37 | /** |
32 | * Notify the transaction system that a view is ready for the new layout. | 38 | * Notify the transaction system that a view is ready for the new layout. |
33 | * | 39 | * |
@@ -45,10 +51,4 @@ void transaction_notify_view_ready_by_serial(struct sway_view *view, | |||
45 | void transaction_notify_view_ready_by_geometry(struct sway_view *view, | 51 | void transaction_notify_view_ready_by_geometry(struct sway_view *view, |
46 | double x, double y, int width, int height); | 52 | double x, double y, int width, int height); |
47 | 53 | ||
48 | /** | ||
49 | * Unconditionally notify the transaction system that a view is ready for the | ||
50 | * new layout. | ||
51 | */ | ||
52 | void transaction_notify_view_ready_immediately(struct sway_view *view); | ||
53 | |||
54 | #endif | 54 | #endif |
diff --git a/include/sway/input/libinput.h b/include/sway/input/libinput.h index de019976..890d632e 100644 --- a/include/sway/input/libinput.h +++ b/include/sway/input/libinput.h | |||
@@ -6,4 +6,6 @@ void sway_input_configure_libinput_device(struct sway_input_device *device); | |||
6 | 6 | ||
7 | void sway_input_reset_libinput_device(struct sway_input_device *device); | 7 | void sway_input_reset_libinput_device(struct sway_input_device *device); |
8 | 8 | ||
9 | bool sway_libinput_device_is_builtin(struct sway_input_device *device); | ||
10 | |||
9 | #endif | 11 | #endif |
diff --git a/include/sway/input/text_input.h b/include/sway/input/text_input.h index 6cf9bdb3..37744266 100644 --- a/include/sway/input/text_input.h +++ b/include/sway/input/text_input.h | |||
@@ -28,7 +28,10 @@ struct sway_input_method_relay { | |||
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_grab_keyboard; | ||
31 | struct wl_listener input_method_destroy; | 32 | struct wl_listener input_method_destroy; |
33 | |||
34 | struct wl_listener input_method_keyboard_grab_destroy; | ||
32 | }; | 35 | }; |
33 | 36 | ||
34 | struct sway_text_input { | 37 | struct sway_text_input { |
diff --git a/include/sway/output.h b/include/sway/output.h index 96986700..0ebcc77d 100644 --- a/include/sway/output.h +++ b/include/sway/output.h | |||
@@ -72,8 +72,8 @@ struct sway_output *output_get_in_direction(struct sway_output *reference, | |||
72 | void output_add_workspace(struct sway_output *output, | 72 | void output_add_workspace(struct sway_output *output, |
73 | struct sway_workspace *workspace); | 73 | struct sway_workspace *workspace); |
74 | 74 | ||
75 | typedef void (*sway_surface_iterator_func_t)(struct sway_output *output, struct sway_view *view, | 75 | typedef void (*sway_surface_iterator_func_t)(struct sway_output *output, |
76 | struct wlr_surface *surface, struct wlr_box *box, float rotation, | 76 | struct sway_view *view, struct wlr_surface *surface, struct wlr_box *box, |
77 | void *user_data); | 77 | void *user_data); |
78 | 78 | ||
79 | void output_damage_whole(struct sway_output *output); | 79 | void output_damage_whole(struct sway_output *output); |
diff --git a/include/sway/server.h b/include/sway/server.h index 0f5e3ab2..3a5670d9 100644 --- a/include/sway/server.h +++ b/include/sway/server.h | |||
@@ -23,6 +23,8 @@ | |||
23 | #include "sway/xwayland.h" | 23 | #include "sway/xwayland.h" |
24 | #endif | 24 | #endif |
25 | 25 | ||
26 | struct sway_transaction; | ||
27 | |||
26 | struct sway_server { | 28 | struct sway_server { |
27 | struct wl_display *wl_display; | 29 | struct wl_display *wl_display; |
28 | struct wl_event_loop *wl_event_loop; | 30 | struct wl_event_loop *wl_event_loop; |
@@ -85,8 +87,25 @@ struct sway_server { | |||
85 | struct wlr_text_input_manager_v3 *text_input; | 87 | struct wlr_text_input_manager_v3 *text_input; |
86 | struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager; | 88 | struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager; |
87 | 89 | ||
90 | struct wlr_xdg_activation_v1 *xdg_activation_v1; | ||
91 | struct wl_listener xdg_activation_v1_request_activate; | ||
92 | |||
93 | // The timeout for transactions, after which a transaction is applied | ||
94 | // regardless of readiness. | ||
88 | size_t txn_timeout_ms; | 95 | size_t txn_timeout_ms; |
89 | list_t *transactions; | 96 | |
97 | // Stores a transaction after it has been committed, but is waiting for | ||
98 | // views to ack the new dimensions before being applied. A queued | ||
99 | // transaction is frozen and must not have new instructions added to it. | ||
100 | struct sway_transaction *queued_transaction; | ||
101 | |||
102 | // Stores a pending transaction that will be committed once the existing | ||
103 | // queued transaction is applied and freed. The pending transaction can be | ||
104 | // updated with new instructions as needed. | ||
105 | struct sway_transaction *pending_transaction; | ||
106 | |||
107 | // Stores the nodes that have been marked as "dirty" and will be put into | ||
108 | // the pending transaction. | ||
90 | list_t *dirty_nodes; | 109 | list_t *dirty_nodes; |
91 | }; | 110 | }; |
92 | 111 | ||
@@ -125,5 +144,7 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data); | |||
125 | void handle_server_decoration(struct wl_listener *listener, void *data); | 144 | void handle_server_decoration(struct wl_listener *listener, void *data); |
126 | void handle_xdg_decoration(struct wl_listener *listener, void *data); | 145 | void handle_xdg_decoration(struct wl_listener *listener, void *data); |
127 | void handle_pointer_constraint(struct wl_listener *listener, void *data); | 146 | void handle_pointer_constraint(struct wl_listener *listener, void *data); |
147 | void xdg_activation_v1_handle_request_activate(struct wl_listener *listener, | ||
148 | void *data); | ||
128 | 149 | ||
129 | #endif | 150 | #endif |
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index 7e9df59f..ddb2d683 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h | |||
@@ -46,9 +46,9 @@ struct sway_container_state { | |||
46 | 46 | ||
47 | enum sway_fullscreen_mode fullscreen_mode; | 47 | enum sway_fullscreen_mode fullscreen_mode; |
48 | 48 | ||
49 | struct sway_workspace *workspace; | 49 | struct sway_workspace *workspace; // NULL when hidden in the scratchpad |
50 | struct sway_container *parent; | 50 | struct sway_container *parent; // NULL if container in root of workspace |
51 | list_t *children; | 51 | list_t *children; // struct sway_container |
52 | 52 | ||
53 | struct sway_container *focused_inactive_child; | 53 | struct sway_container *focused_inactive_child; |
54 | bool focused; | 54 | bool focused; |
@@ -60,6 +60,7 @@ struct sway_container_state { | |||
60 | bool border_left; | 60 | bool border_left; |
61 | bool border_right; | 61 | bool border_right; |
62 | 62 | ||
63 | // These are in layout coordinates. | ||
63 | double content_x, content_y; | 64 | double content_x, content_y; |
64 | double content_width, content_height; | 65 | double content_width, content_height; |
65 | }; | 66 | }; |
@@ -68,14 +69,12 @@ 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 | ||
71 | // The pending state is the main container properties, and the current state is in the below struct. | ||
72 | // This means most places of the code can refer to the main variables (pending state) and it'll just work. | ||
73 | struct sway_container_state current; | 72 | struct sway_container_state current; |
73 | struct sway_container_state pending; | ||
74 | 74 | ||
75 | char *title; // The view's title (unformatted) | 75 | char *title; // The view's title (unformatted) |
76 | char *formatted_title; // The title displayed in the title bar | 76 | char *formatted_title; // The title displayed in the title bar |
77 | 77 | ||
78 | enum sway_container_layout layout; | ||
79 | enum sway_container_layout prev_split_layout; | 78 | enum sway_container_layout prev_split_layout; |
80 | 79 | ||
81 | // Whether stickiness has been enabled on this container. Use | 80 | // Whether stickiness has been enabled on this container. Use |
@@ -86,11 +85,13 @@ struct sway_container { | |||
86 | // For C_ROOT, this has no meaning | 85 | // For C_ROOT, this has no meaning |
87 | // For other types, this is the position in layout coordinates | 86 | // For other types, this is the position in layout coordinates |
88 | // Includes borders | 87 | // Includes borders |
89 | double x, y; | ||
90 | double width, height; | ||
91 | double saved_x, saved_y; | 88 | double saved_x, saved_y; |
92 | double saved_width, saved_height; | 89 | double saved_width, saved_height; |
93 | 90 | ||
91 | // Used when the view changes to CSD unexpectedly. This will be a non-B_CSD | ||
92 | // border which we use to restore when the view returns to SSD. | ||
93 | enum sway_container_border saved_border; | ||
94 | |||
94 | // The share of the space of parent container this container occupies | 95 | // The share of the space of parent container this container occupies |
95 | double width_fraction; | 96 | double width_fraction; |
96 | double height_fraction; | 97 | double height_fraction; |
@@ -100,33 +101,11 @@ struct sway_container { | |||
100 | double child_total_width; | 101 | double child_total_width; |
101 | double child_total_height; | 102 | double child_total_height; |
102 | 103 | ||
103 | // These are in layout coordinates. | ||
104 | double content_x, content_y; | ||
105 | int content_width, content_height; | ||
106 | |||
107 | // In most cases this is the same as the content x and y, but if the view | 104 | // In most cases this is the same as the content x and y, but if the view |
108 | // refuses to resize to the content dimensions then it can be smaller. | 105 | // refuses to resize to the content dimensions then it can be smaller. |
109 | // These are in layout coordinates. | 106 | // These are in layout coordinates. |
110 | double surface_x, surface_y; | 107 | double surface_x, surface_y; |
111 | 108 | ||
112 | enum sway_fullscreen_mode fullscreen_mode; | ||
113 | |||
114 | enum sway_container_border border; | ||
115 | |||
116 | // Used when the view changes to CSD unexpectedly. This will be a non-B_CSD | ||
117 | // border which we use to restore when the view returns to SSD. | ||
118 | enum sway_container_border saved_border; | ||
119 | |||
120 | int border_thickness; | ||
121 | bool border_top; | ||
122 | bool border_bottom; | ||
123 | bool border_left; | ||
124 | bool border_right; | ||
125 | |||
126 | struct sway_workspace *workspace; // NULL when hidden in the scratchpad | ||
127 | struct sway_container *parent; // NULL if container in root of workspace | ||
128 | list_t *children; // struct sway_container | ||
129 | |||
130 | // Outputs currently being intersected | 109 | // Outputs currently being intersected |
131 | list_t *outputs; // struct sway_output | 110 | list_t *outputs; // struct sway_output |
132 | 111 | ||
@@ -185,6 +164,11 @@ void container_for_each_child(struct sway_container *container, | |||
185 | void (*f)(struct sway_container *container, void *data), void *data); | 164 | void (*f)(struct sway_container *container, void *data), void *data); |
186 | 165 | ||
187 | /** | 166 | /** |
167 | * Returns the fullscreen container obstructing this container if it exists. | ||
168 | */ | ||
169 | struct sway_container *container_obstructing_fullscreen_container(struct sway_container *container); | ||
170 | |||
171 | /** | ||
188 | * Returns true if the given container is an ancestor of this container. | 172 | * Returns true if the given container is an ancestor of this container. |
189 | */ | 173 | */ |
190 | bool container_has_ancestor(struct sway_container *container, | 174 | bool container_has_ancestor(struct sway_container *container, |
@@ -231,10 +215,17 @@ void container_set_geometry_from_content(struct sway_container *con); | |||
231 | /** | 215 | /** |
232 | * Determine if the given container is itself floating. | 216 | * Determine if the given container is itself floating. |
233 | * This will return false for any descendants of a floating container. | 217 | * This will return false for any descendants of a floating container. |
218 | * | ||
219 | * Uses pending container state. | ||
234 | */ | 220 | */ |
235 | bool container_is_floating(struct sway_container *container); | 221 | bool container_is_floating(struct sway_container *container); |
236 | 222 | ||
237 | /** | 223 | /** |
224 | * Same as above, but for current container state. | ||
225 | */ | ||
226 | bool container_is_current_floating(struct sway_container *container); | ||
227 | |||
228 | /** | ||
238 | * Get a container's box in layout coordinates. | 229 | * Get a container's box in layout coordinates. |
239 | */ | 230 | */ |
240 | void container_get_box(struct sway_container *container, struct wlr_box *box); | 231 | void container_get_box(struct sway_container *container, struct wlr_box *box); |
@@ -299,6 +290,7 @@ bool container_is_fullscreen_or_child(struct sway_container *container); | |||
299 | /** | 290 | /** |
300 | * Return the output which will be used for scale purposes. | 291 | * Return the output which will be used for scale purposes. |
301 | * This is the most recently entered output. | 292 | * This is the most recently entered output. |
293 | * If the container is not on any output, return NULL. | ||
302 | */ | 294 | */ |
303 | struct sway_output *container_get_effective_output(struct sway_container *con); | 295 | struct sway_output *container_get_effective_output(struct sway_container *con); |
304 | 296 | ||
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index e071e6c9..86bd981c 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h | |||
@@ -316,7 +316,8 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface, | |||
316 | 316 | ||
317 | void view_unmap(struct sway_view *view); | 317 | void view_unmap(struct sway_view *view); |
318 | 318 | ||
319 | void view_update_size(struct sway_view *view, int width, int height); | 319 | void view_update_size(struct sway_view *view); |
320 | void view_center_surface(struct sway_view *view); | ||
320 | 321 | ||
321 | void view_child_init(struct sway_view_child *child, | 322 | void view_child_init(struct sway_view_child *child, |
322 | const struct sway_view_child_impl *impl, struct sway_view *view, | 323 | const struct sway_view_child_impl *impl, struct sway_view *view, |
diff --git a/include/sway/tree/workspace.h b/include/sway/tree/workspace.h index fdd92f64..65ba247f 100644 --- a/include/sway/tree/workspace.h +++ b/include/sway/tree/workspace.h | |||
@@ -60,8 +60,10 @@ void workspace_consider_destroy(struct sway_workspace *ws); | |||
60 | 60 | ||
61 | char *workspace_next_name(const char *output_name); | 61 | char *workspace_next_name(const char *output_name); |
62 | 62 | ||
63 | bool workspace_switch(struct sway_workspace *workspace, | 63 | struct sway_workspace *workspace_auto_back_and_forth( |
64 | bool no_auto_back_and_forth); | 64 | struct sway_workspace *workspace); |
65 | |||
66 | bool workspace_switch(struct sway_workspace *workspace); | ||
65 | 67 | ||
66 | struct sway_workspace *workspace_by_number(const char* name); | 68 | struct sway_workspace *workspace_by_number(const char* name); |
67 | 69 | ||