diff options
Diffstat (limited to 'include')
28 files changed, 204 insertions, 127 deletions
diff --git a/include/background-image.h b/include/background-image.h index 15935ffd..a97ef375 100644 --- a/include/background-image.h +++ b/include/background-image.h | |||
@@ -1,6 +1,6 @@ | |||
1 | #ifndef _SWAY_BACKGROUND_IMAGE_H | 1 | #ifndef _SWAY_BACKGROUND_IMAGE_H |
2 | #define _SWAY_BACKGROUND_IMAGE_H | 2 | #define _SWAY_BACKGROUND_IMAGE_H |
3 | #include "cairo.h" | 3 | #include "cairo_util.h" |
4 | 4 | ||
5 | enum background_mode { | 5 | enum background_mode { |
6 | BACKGROUND_MODE_STRETCH, | 6 | BACKGROUND_MODE_STRETCH, |
diff --git a/include/cairo.h b/include/cairo_util.h index c1275db2..dc049c6d 100644 --- a/include/cairo.h +++ b/include/cairo_util.h | |||
@@ -1,8 +1,8 @@ | |||
1 | #ifndef _SWAY_CAIRO_H | 1 | #ifndef _SWAY_CAIRO_UTIL_H |
2 | #define _SWAY_CAIRO_H | 2 | #define _SWAY_CAIRO_UTIL_H |
3 | #include "config.h" | 3 | #include "config.h" |
4 | #include <stdint.h> | 4 | #include <stdint.h> |
5 | #include <cairo/cairo.h> | 5 | #include <cairo.h> |
6 | #include <wayland-client-protocol.h> | 6 | #include <wayland-client-protocol.h> |
7 | 7 | ||
8 | void cairo_set_source_u32(cairo_t *cairo, uint32_t color); | 8 | void cairo_set_source_u32(cairo_t *cairo, uint32_t color); |
diff --git a/include/ipc-client.h b/include/ipc-client.h index d3895023..9c5712d7 100644 --- a/include/ipc-client.h +++ b/include/ipc-client.h | |||
@@ -1,6 +1,9 @@ | |||
1 | #ifndef _SWAY_IPC_CLIENT_H | 1 | #ifndef _SWAY_IPC_CLIENT_H |
2 | #define _SWAY_IPC_CLIENT_H | 2 | #define _SWAY_IPC_CLIENT_H |
3 | 3 | ||
4 | // arbitrary number, it's probably sufficient, higher number = more memory usage | ||
5 | #define JSON_MAX_DEPTH 512 | ||
6 | |||
4 | #include <stdbool.h> | 7 | #include <stdbool.h> |
5 | #include <stdint.h> | 8 | #include <stdint.h> |
6 | #include <sys/time.h> | 9 | #include <sys/time.h> |
diff --git a/include/pango.h b/include/pango.h index 6ab83c16..93affc23 100644 --- a/include/pango.h +++ b/include/pango.h | |||
@@ -3,7 +3,7 @@ | |||
3 | #include <stdarg.h> | 3 | #include <stdarg.h> |
4 | #include <stdbool.h> | 4 | #include <stdbool.h> |
5 | #include <stdint.h> | 5 | #include <stdint.h> |
6 | #include <cairo/cairo.h> | 6 | #include <cairo.h> |
7 | #include <pango/pangocairo.h> | 7 | #include <pango/pangocairo.h> |
8 | 8 | ||
9 | /** | 9 | /** |
@@ -17,7 +17,8 @@ PangoLayout *get_pango_layout(cairo_t *cairo, const char *font, | |||
17 | const char *text, double scale, bool markup); | 17 | const char *text, double scale, bool markup); |
18 | void get_text_size(cairo_t *cairo, const char *font, int *width, int *height, | 18 | void get_text_size(cairo_t *cairo, const char *font, int *width, int *height, |
19 | int *baseline, double scale, bool markup, const char *fmt, ...); | 19 | int *baseline, double scale, bool markup, const char *fmt, ...); |
20 | void pango_printf(cairo_t *cairo, const char *font, | 20 | void get_text_metrics(const char *font, int *height, int *baseline); |
21 | void render_text(cairo_t *cairo, const char *font, | ||
21 | double scale, bool markup, const char *fmt, ...); | 22 | double scale, bool markup, const char *fmt, ...); |
22 | 23 | ||
23 | #endif | 24 | #endif |
diff --git a/include/pool-buffer.h b/include/pool-buffer.h index 54f5be06..b7a95afe 100644 --- a/include/pool-buffer.h +++ b/include/pool-buffer.h | |||
@@ -1,6 +1,6 @@ | |||
1 | #ifndef _SWAY_BUFFERS_H | 1 | #ifndef _SWAY_BUFFERS_H |
2 | #define _SWAY_BUFFERS_H | 2 | #define _SWAY_BUFFERS_H |
3 | #include <cairo/cairo.h> | 3 | #include <cairo.h> |
4 | #include <pango/pangocairo.h> | 4 | #include <pango/pangocairo.h> |
5 | #include <stdbool.h> | 5 | #include <stdbool.h> |
6 | #include <stdint.h> | 6 | #include <stdint.h> |
diff --git a/include/sway/commands.h b/include/sway/commands.h index 964b3661..2746ef28 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 | */ |
@@ -112,6 +112,7 @@ sway_cmd cmd_border; | |||
112 | sway_cmd cmd_client_noop; | 112 | sway_cmd cmd_client_noop; |
113 | sway_cmd cmd_client_focused; | 113 | sway_cmd cmd_client_focused; |
114 | sway_cmd cmd_client_focused_inactive; | 114 | sway_cmd cmd_client_focused_inactive; |
115 | sway_cmd cmd_client_focused_tab_title; | ||
115 | sway_cmd cmd_client_unfocused; | 116 | sway_cmd cmd_client_unfocused; |
116 | sway_cmd cmd_client_urgent; | 117 | sway_cmd cmd_client_urgent; |
117 | sway_cmd cmd_client_placeholder; | 118 | sway_cmd cmd_client_placeholder; |
@@ -282,7 +283,9 @@ sway_cmd output_cmd_dpms; | |||
282 | sway_cmd output_cmd_enable; | 283 | sway_cmd output_cmd_enable; |
283 | sway_cmd output_cmd_max_render_time; | 284 | sway_cmd output_cmd_max_render_time; |
284 | sway_cmd output_cmd_mode; | 285 | sway_cmd output_cmd_mode; |
286 | sway_cmd output_cmd_modeline; | ||
285 | sway_cmd output_cmd_position; | 287 | sway_cmd output_cmd_position; |
288 | sway_cmd output_cmd_render_bit_depth; | ||
286 | sway_cmd output_cmd_scale; | 289 | sway_cmd output_cmd_scale; |
287 | sway_cmd output_cmd_scale_filter; | 290 | sway_cmd output_cmd_scale_filter; |
288 | sway_cmd output_cmd_subpixel; | 291 | sway_cmd output_cmd_subpixel; |
diff --git a/include/sway/config.h b/include/sway/config.h index 59f22ae2..2e24c3ae 100644 --- a/include/sway/config.h +++ b/include/sway/config.h | |||
@@ -5,9 +5,10 @@ | |||
5 | #include <string.h> | 5 | #include <string.h> |
6 | #include <time.h> | 6 | #include <time.h> |
7 | #include <wlr/interfaces/wlr_switch.h> | 7 | #include <wlr/interfaces/wlr_switch.h> |
8 | #include <wlr/types/wlr_box.h> | ||
9 | #include <wlr/types/wlr_tablet_tool.h> | 8 | #include <wlr/types/wlr_tablet_tool.h> |
9 | #include <wlr/util/box.h> | ||
10 | #include <xkbcommon/xkbcommon.h> | 10 | #include <xkbcommon/xkbcommon.h> |
11 | #include <xf86drmMode.h> | ||
11 | #include "../include/config.h" | 12 | #include "../include/config.h" |
12 | #include "list.h" | 13 | #include "list.h" |
13 | #include "swaynag.h" | 14 | #include "swaynag.h" |
@@ -47,7 +48,7 @@ enum binding_flags { | |||
47 | }; | 48 | }; |
48 | 49 | ||
49 | /** | 50 | /** |
50 | * A key binding and an associated command. | 51 | * A key (or mouse) binding and an associated command. |
51 | */ | 52 | */ |
52 | struct sway_binding { | 53 | struct sway_binding { |
53 | enum binding_input_type type; | 54 | enum binding_input_type type; |
@@ -61,12 +62,10 @@ struct sway_binding { | |||
61 | char *command; | 62 | char *command; |
62 | }; | 63 | }; |
63 | 64 | ||
64 | /** | 65 | enum sway_switch_trigger { |
65 | * A mouse binding and an associated command. | 66 | SWAY_SWITCH_TRIGGER_OFF, |
66 | */ | 67 | SWAY_SWITCH_TRIGGER_ON, |
67 | struct sway_mouse_binding { | 68 | SWAY_SWITCH_TRIGGER_TOGGLE, |
68 | uint32_t button; | ||
69 | char *command; | ||
70 | }; | 69 | }; |
71 | 70 | ||
72 | /** | 71 | /** |
@@ -74,7 +73,7 @@ struct sway_mouse_binding { | |||
74 | */ | 73 | */ |
75 | struct sway_switch_binding { | 74 | struct sway_switch_binding { |
76 | enum wlr_switch_type type; | 75 | enum wlr_switch_type type; |
77 | enum wlr_switch_state state; | 76 | enum sway_switch_trigger trigger; |
78 | uint32_t flags; | 77 | uint32_t flags; |
79 | char *command; | 78 | char *command; |
80 | }; | 79 | }; |
@@ -246,6 +245,12 @@ enum scale_filter_mode { | |||
246 | SCALE_FILTER_SMART, | 245 | SCALE_FILTER_SMART, |
247 | }; | 246 | }; |
248 | 247 | ||
248 | enum render_bit_depth { | ||
249 | RENDER_BIT_DEPTH_DEFAULT, // the default is currently 8 | ||
250 | RENDER_BIT_DEPTH_8, | ||
251 | RENDER_BIT_DEPTH_10, | ||
252 | }; | ||
253 | |||
249 | /** | 254 | /** |
250 | * Size and position configuration for a particular output. | 255 | * Size and position configuration for a particular output. |
251 | * | 256 | * |
@@ -257,6 +262,7 @@ struct output_config { | |||
257 | int width, height; | 262 | int width, height; |
258 | float refresh_rate; | 263 | float refresh_rate; |
259 | int custom_mode; | 264 | int custom_mode; |
265 | drmModeModeInfo drm_mode; | ||
260 | int x, y; | 266 | int x, y; |
261 | float scale; | 267 | float scale; |
262 | enum scale_filter_mode scale_filter; | 268 | enum scale_filter_mode scale_filter; |
@@ -264,6 +270,7 @@ struct output_config { | |||
264 | enum wl_output_subpixel subpixel; | 270 | enum wl_output_subpixel subpixel; |
265 | int max_render_time; // In milliseconds | 271 | int max_render_time; // In milliseconds |
266 | int adaptive_sync; | 272 | int adaptive_sync; |
273 | enum render_bit_depth render_bit_depth; | ||
267 | 274 | ||
268 | char *background; | 275 | char *background; |
269 | char *background_option; | 276 | char *background_option; |
@@ -281,6 +288,12 @@ struct side_gaps { | |||
281 | int left; | 288 | int left; |
282 | }; | 289 | }; |
283 | 290 | ||
291 | enum smart_gaps_mode { | ||
292 | SMART_GAPS_OFF, | ||
293 | SMART_GAPS_ON, | ||
294 | SMART_GAPS_INVERSE_OUTER, | ||
295 | }; | ||
296 | |||
284 | /** | 297 | /** |
285 | * Stores configuration for a workspace, regardless of whether the workspace | 298 | * Stores configuration for a workspace, regardless of whether the workspace |
286 | * exists. | 299 | * exists. |
@@ -292,6 +305,12 @@ struct workspace_config { | |||
292 | struct side_gaps gaps_outer; | 305 | struct side_gaps gaps_outer; |
293 | }; | 306 | }; |
294 | 307 | ||
308 | enum pango_markup_config { | ||
309 | PANGO_MARKUP_DISABLED = false, | ||
310 | PANGO_MARKUP_ENABLED = true, | ||
311 | PANGO_MARKUP_DEFAULT // The default is font dependent ("pango:" prefix) | ||
312 | }; | ||
313 | |||
295 | struct bar_config { | 314 | struct bar_config { |
296 | char *swaybar_command; | 315 | char *swaybar_command; |
297 | struct wl_client *client; | 316 | struct wl_client *client; |
@@ -323,7 +342,7 @@ struct bar_config { | |||
323 | char *position; | 342 | char *position; |
324 | list_t *bindings; | 343 | list_t *bindings; |
325 | char *status_command; | 344 | char *status_command; |
326 | bool pango_markup; | 345 | enum pango_markup_config pango_markup; |
327 | char *font; | 346 | char *font; |
328 | int height; // -1 not defined | 347 | int height; // -1 not defined |
329 | bool workspace_buttons; | 348 | bool workspace_buttons; |
@@ -410,14 +429,6 @@ enum sway_popup_during_fullscreen { | |||
410 | POPUP_LEAVE, | 429 | POPUP_LEAVE, |
411 | }; | 430 | }; |
412 | 431 | ||
413 | enum command_context { | ||
414 | CONTEXT_CONFIG = 1 << 0, | ||
415 | CONTEXT_BINDING = 1 << 1, | ||
416 | CONTEXT_IPC = 1 << 2, | ||
417 | CONTEXT_CRITERIA = 1 << 3, | ||
418 | CONTEXT_ALL = 0xFFFFFFFF, | ||
419 | }; | ||
420 | |||
421 | enum focus_follows_mouse_mode { | 432 | enum focus_follows_mouse_mode { |
422 | FOLLOWS_NO, | 433 | FOLLOWS_NO, |
423 | FOLLOWS_YES, | 434 | FOLLOWS_YES, |
@@ -480,8 +491,8 @@ struct sway_config { | |||
480 | enum sway_container_layout default_orientation; | 491 | enum sway_container_layout default_orientation; |
481 | enum sway_container_layout default_layout; | 492 | enum sway_container_layout default_layout; |
482 | char *font; | 493 | char *font; |
483 | size_t font_height; | 494 | int font_height; |
484 | size_t font_baseline; | 495 | int font_baseline; |
485 | bool pango_markup; | 496 | bool pango_markup; |
486 | int titlebar_border_thickness; | 497 | int titlebar_border_thickness; |
487 | int titlebar_h_padding; | 498 | int titlebar_h_padding; |
@@ -512,7 +523,7 @@ struct sway_config { | |||
512 | bool tiling_drag; | 523 | bool tiling_drag; |
513 | int tiling_drag_threshold; | 524 | int tiling_drag_threshold; |
514 | 525 | ||
515 | bool smart_gaps; | 526 | enum smart_gaps_mode smart_gaps; |
516 | int gaps_inner; | 527 | int gaps_inner; |
517 | struct side_gaps gaps_outer; | 528 | struct side_gaps gaps_outer; |
518 | 529 | ||
@@ -535,12 +546,15 @@ struct sway_config { | |||
535 | struct { | 546 | struct { |
536 | struct border_colors focused; | 547 | struct border_colors focused; |
537 | struct border_colors focused_inactive; | 548 | struct border_colors focused_inactive; |
549 | struct border_colors focused_tab_title; | ||
538 | struct border_colors unfocused; | 550 | struct border_colors unfocused; |
539 | struct border_colors urgent; | 551 | struct border_colors urgent; |
540 | struct border_colors placeholder; | 552 | struct border_colors placeholder; |
541 | float background[4]; | 553 | float background[4]; |
542 | } border_colors; | 554 | } border_colors; |
543 | 555 | ||
556 | bool has_focused_tab_title; | ||
557 | |||
544 | // floating view | 558 | // floating view |
545 | int32_t floating_maximum_width; | 559 | int32_t floating_maximum_width; |
546 | int32_t floating_maximum_height; | 560 | int32_t floating_maximum_height; |
@@ -559,7 +573,7 @@ struct sway_config { | |||
559 | struct sway_node *node; | 573 | struct sway_node *node; |
560 | struct sway_container *container; | 574 | struct sway_container *container; |
561 | struct sway_workspace *workspace; | 575 | struct sway_workspace *workspace; |
562 | bool using_criteria; | 576 | bool node_overridden; // True if the node is selected by means other than focus |
563 | struct { | 577 | struct { |
564 | int argc; | 578 | int argc; |
565 | char **argv; | 579 | char **argv; |
@@ -690,14 +704,13 @@ void free_bar_binding(struct bar_binding *binding); | |||
690 | void free_workspace_config(struct workspace_config *wsc); | 704 | void free_workspace_config(struct workspace_config *wsc); |
691 | 705 | ||
692 | /** | 706 | /** |
693 | * Updates the value of config->font_height based on the max title height | 707 | * Updates the value of config->font_height based on the metrics for title's |
694 | * reported by each container. If recalculate is true, the containers will | 708 | * font as reported by pango. |
695 | * recalculate their heights before reporting. | 709 | * |
696 | * | ||
697 | * If the height has changed, all containers will be rearranged to take on the | 710 | * If the height has changed, all containers will be rearranged to take on the |
698 | * new size. | 711 | * new size. |
699 | */ | 712 | */ |
700 | void config_update_font_height(bool recalculate); | 713 | void config_update_font_height(void); |
701 | 714 | ||
702 | /** | 715 | /** |
703 | * Convert bindsym into bindcode using the first configured layout. | 716 | * Convert bindsym into bindcode using the first configured layout. |
diff --git a/include/sway/criteria.h b/include/sway/criteria.h index ad8610cd..59f57f94 100644 --- a/include/sway/criteria.h +++ b/include/sway/criteria.h | |||
@@ -1,7 +1,8 @@ | |||
1 | #ifndef _SWAY_CRITERIA_H | 1 | #ifndef _SWAY_CRITERIA_H |
2 | #define _SWAY_CRITERIA_H | 2 | #define _SWAY_CRITERIA_H |
3 | 3 | ||
4 | #include <pcre.h> | 4 | #define PCRE2_CODE_UNIT_WIDTH 8 |
5 | #include <pcre2.h> | ||
5 | #include "config.h" | 6 | #include "config.h" |
6 | #include "list.h" | 7 | #include "list.h" |
7 | #include "tree/view.h" | 8 | #include "tree/view.h" |
@@ -15,13 +16,13 @@ enum criteria_type { | |||
15 | }; | 16 | }; |
16 | 17 | ||
17 | enum pattern_type { | 18 | enum pattern_type { |
18 | PATTERN_PCRE, | 19 | PATTERN_PCRE2, |
19 | PATTERN_FOCUSED, | 20 | PATTERN_FOCUSED, |
20 | }; | 21 | }; |
21 | 22 | ||
22 | struct pattern { | 23 | struct pattern { |
23 | enum pattern_type match_type; | 24 | enum pattern_type match_type; |
24 | pcre *regex; | 25 | pcre2_code *regex; |
25 | }; | 26 | }; |
26 | 27 | ||
27 | struct criteria { | 28 | struct criteria { |
diff --git a/include/sway/desktop.h b/include/sway/desktop.h index c969a76b..7f2f5b3e 100644 --- a/include/sway/desktop.h +++ b/include/sway/desktop.h | |||
@@ -1,4 +1,4 @@ | |||
1 | #include <wlr/types/wlr_surface.h> | 1 | #include <wlr/types/wlr_compositor.h> |
2 | 2 | ||
3 | struct sway_container; | 3 | struct sway_container; |
4 | struct sway_view; | 4 | struct sway_view; |
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/cursor.h b/include/sway/input/cursor.h index 6a38190b..3a71a35f 100644 --- a/include/sway/input/cursor.h +++ b/include/sway/input/cursor.h | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <stdint.h> | 4 | #include <stdint.h> |
5 | #include <wlr/types/wlr_pointer_constraints_v1.h> | 5 | #include <wlr/types/wlr_pointer_constraints_v1.h> |
6 | #include <wlr/types/wlr_pointer_gestures_v1.h> | 6 | #include <wlr/types/wlr_pointer_gestures_v1.h> |
7 | #include <wlr/types/wlr_surface.h> | 7 | #include <wlr/types/wlr_compositor.h> |
8 | #include "sway/input/seat.h" | 8 | #include "sway/input/seat.h" |
9 | #include "config.h" | 9 | #include "config.h" |
10 | 10 | ||
@@ -42,6 +42,8 @@ struct sway_cursor { | |||
42 | struct wl_listener swipe_begin; | 42 | struct wl_listener swipe_begin; |
43 | struct wl_listener swipe_update; | 43 | struct wl_listener swipe_update; |
44 | struct wl_listener swipe_end; | 44 | struct wl_listener swipe_end; |
45 | struct wl_listener hold_begin; | ||
46 | struct wl_listener hold_end; | ||
45 | 47 | ||
46 | struct wl_listener motion; | 48 | struct wl_listener motion; |
47 | struct wl_listener motion_absolute; | 49 | struct wl_listener motion_absolute; |
@@ -52,7 +54,9 @@ struct sway_cursor { | |||
52 | struct wl_listener touch_down; | 54 | struct wl_listener touch_down; |
53 | struct wl_listener touch_up; | 55 | struct wl_listener touch_up; |
54 | struct wl_listener touch_motion; | 56 | struct wl_listener touch_motion; |
57 | struct wl_listener touch_frame; | ||
55 | bool simulating_pointer_from_touch; | 58 | bool simulating_pointer_from_touch; |
59 | bool pointer_touch_up; | ||
56 | int32_t pointer_touch_id; | 60 | int32_t pointer_touch_id; |
57 | 61 | ||
58 | struct wl_listener tool_axis; | 62 | struct wl_listener tool_axis; |
@@ -108,7 +112,7 @@ void dispatch_cursor_button(struct sway_cursor *cursor, | |||
108 | enum wlr_button_state state); | 112 | enum wlr_button_state state); |
109 | 113 | ||
110 | void dispatch_cursor_axis(struct sway_cursor *cursor, | 114 | void dispatch_cursor_axis(struct sway_cursor *cursor, |
111 | struct wlr_event_pointer_axis *event); | 115 | struct wlr_pointer_axis_event *event); |
112 | 116 | ||
113 | void cursor_set_image(struct sway_cursor *cursor, const char *image, | 117 | void cursor_set_image(struct sway_cursor *cursor, const char *image, |
114 | struct wl_client *client); | 118 | struct wl_client *client); |
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/seat.h b/include/sway/input/seat.h index 4118df66..47726159 100644 --- a/include/sway/input/seat.h +++ b/include/sway/input/seat.h | |||
@@ -18,7 +18,7 @@ struct sway_seatop_impl { | |||
18 | enum wlr_button_state state); | 18 | enum wlr_button_state state); |
19 | void (*pointer_motion)(struct sway_seat *seat, uint32_t time_msec); | 19 | void (*pointer_motion)(struct sway_seat *seat, uint32_t time_msec); |
20 | void (*pointer_axis)(struct sway_seat *seat, | 20 | void (*pointer_axis)(struct sway_seat *seat, |
21 | struct wlr_event_pointer_axis *event); | 21 | struct wlr_pointer_axis_event *event); |
22 | void (*rebase)(struct sway_seat *seat, uint32_t time_msec); | 22 | void (*rebase)(struct sway_seat *seat, uint32_t time_msec); |
23 | void (*tablet_tool_motion)(struct sway_seat *seat, | 23 | void (*tablet_tool_motion)(struct sway_seat *seat, |
24 | struct sway_tablet_tool *tool, uint32_t time_msec); | 24 | struct sway_tablet_tool *tool, uint32_t time_msec); |
@@ -185,6 +185,10 @@ struct sway_workspace *seat_get_last_known_workspace(struct sway_seat *seat); | |||
185 | 185 | ||
186 | struct sway_container *seat_get_focused_container(struct sway_seat *seat); | 186 | struct sway_container *seat_get_focused_container(struct sway_seat *seat); |
187 | 187 | ||
188 | // Force focus to a particular surface that is not part of the workspace | ||
189 | // hierarchy (used for lockscreen) | ||
190 | void sway_force_focus(struct wlr_surface *surface); | ||
191 | |||
188 | /** | 192 | /** |
189 | * Return the last container to be focused for the seat (or the most recently | 193 | * Return the last container to be focused for the seat (or the most recently |
190 | * opened if no container has received focused) that is a child of the given | 194 | * opened if no container has received focused) that is a child of the given |
@@ -239,7 +243,10 @@ enum wlr_edges find_resize_edge(struct sway_container *cont, | |||
239 | void seatop_begin_default(struct sway_seat *seat); | 243 | void seatop_begin_default(struct sway_seat *seat); |
240 | 244 | ||
241 | void seatop_begin_down(struct sway_seat *seat, struct sway_container *con, | 245 | void seatop_begin_down(struct sway_seat *seat, struct sway_container *con, |
242 | uint32_t time_msec, int sx, int sy); | 246 | uint32_t time_msec, double sx, double sy); |
247 | |||
248 | void seatop_begin_down_on_surface(struct sway_seat *seat, | ||
249 | struct wlr_surface *surface, uint32_t time_msec, double sx, double sy); | ||
243 | 250 | ||
244 | void seatop_begin_move_floating(struct sway_seat *seat, | 251 | void seatop_begin_move_floating(struct sway_seat *seat, |
245 | struct sway_container *con); | 252 | struct sway_container *con); |
@@ -271,7 +278,7 @@ void seatop_button(struct sway_seat *seat, uint32_t time_msec, | |||
271 | void seatop_pointer_motion(struct sway_seat *seat, uint32_t time_msec); | 278 | void seatop_pointer_motion(struct sway_seat *seat, uint32_t time_msec); |
272 | 279 | ||
273 | void seatop_pointer_axis(struct sway_seat *seat, | 280 | void seatop_pointer_axis(struct sway_seat *seat, |
274 | struct wlr_event_pointer_axis *event); | 281 | struct wlr_pointer_axis_event *event); |
275 | 282 | ||
276 | void seatop_tablet_tool_tip(struct sway_seat *seat, | 283 | void seatop_tablet_tool_tip(struct sway_seat *seat, |
277 | struct sway_tablet_tool *tool, uint32_t time_msec, | 284 | struct sway_tablet_tool *tool, uint32_t time_msec, |
diff --git a/include/sway/input/text_input.h b/include/sway/input/text_input.h index 6cf9bdb3..c70fd935 100644 --- a/include/sway/input/text_input.h +++ b/include/sway/input/text_input.h | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
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_surface.h> | 6 | #include <wlr/types/wlr_compositor.h> |
7 | #include "sway/input/seat.h" | 7 | #include "sway/input/seat.h" |
8 | 8 | ||
9 | /** | 9 | /** |
@@ -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/layers.h b/include/sway/layers.h index 457634c2..f8508493 100644 --- a/include/sway/layers.h +++ b/include/sway/layers.h | |||
@@ -1,8 +1,7 @@ | |||
1 | #ifndef _SWAY_LAYERS_H | 1 | #ifndef _SWAY_LAYERS_H |
2 | #define _SWAY_LAYERS_H | 2 | #define _SWAY_LAYERS_H |
3 | #include <stdbool.h> | 3 | #include <stdbool.h> |
4 | #include <wlr/types/wlr_box.h> | 4 | #include <wlr/types/wlr_compositor.h> |
5 | #include <wlr/types/wlr_surface.h> | ||
6 | #include <wlr/types/wlr_layer_shell_v1.h> | 5 | #include <wlr/types/wlr_layer_shell_v1.h> |
7 | 6 | ||
8 | enum layer_parent { | 7 | enum layer_parent { |
@@ -23,7 +22,11 @@ struct sway_layer_surface { | |||
23 | struct wl_listener new_subsurface; | 22 | struct wl_listener new_subsurface; |
24 | 23 | ||
25 | struct wlr_box geo; | 24 | struct wlr_box geo; |
25 | bool mapped; | ||
26 | struct wlr_box extent; | ||
26 | enum zwlr_layer_shell_v1_layer layer; | 27 | enum zwlr_layer_shell_v1_layer layer; |
28 | |||
29 | struct wl_list subsurfaces; | ||
27 | }; | 30 | }; |
28 | 31 | ||
29 | struct sway_layer_popup { | 32 | struct sway_layer_popup { |
@@ -43,6 +46,7 @@ struct sway_layer_popup { | |||
43 | struct sway_layer_subsurface { | 46 | struct sway_layer_subsurface { |
44 | struct wlr_subsurface *wlr_subsurface; | 47 | struct wlr_subsurface *wlr_subsurface; |
45 | struct sway_layer_surface *layer_surface; | 48 | struct sway_layer_surface *layer_surface; |
49 | struct wl_list link; | ||
46 | 50 | ||
47 | struct wl_listener map; | 51 | struct wl_listener map; |
48 | struct wl_listener unmap; | 52 | struct wl_listener unmap; |
diff --git a/include/sway/output.h b/include/sway/output.h index 96986700..26b9709f 100644 --- a/include/sway/output.h +++ b/include/sway/output.h | |||
@@ -3,7 +3,6 @@ | |||
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_box.h> | ||
7 | #include <wlr/types/wlr_output.h> | 6 | #include <wlr/types/wlr_output.h> |
8 | #include "config.h" | 7 | #include "config.h" |
9 | #include "sway/tree/node.h" | 8 | #include "sway/tree/node.h" |
@@ -49,7 +48,7 @@ struct sway_output { | |||
49 | struct wl_listener damage_frame; | 48 | struct wl_listener damage_frame; |
50 | 49 | ||
51 | struct { | 50 | struct { |
52 | struct wl_signal destroy; | 51 | struct wl_signal disable; |
53 | } events; | 52 | } events; |
54 | 53 | ||
55 | struct timespec last_presentation; | 54 | struct timespec last_presentation; |
@@ -72,8 +71,8 @@ struct sway_output *output_get_in_direction(struct sway_output *reference, | |||
72 | void output_add_workspace(struct sway_output *output, | 71 | void output_add_workspace(struct sway_output *output, |
73 | struct sway_workspace *workspace); | 72 | struct sway_workspace *workspace); |
74 | 73 | ||
75 | typedef void (*sway_surface_iterator_func_t)(struct sway_output *output, struct sway_view *view, | 74 | typedef void (*sway_surface_iterator_func_t)(struct sway_output *output, |
76 | struct wlr_surface *surface, struct wlr_box *box, float rotation, | 75 | struct sway_view *view, struct wlr_surface *surface, struct wlr_box *box, |
77 | void *user_data); | 76 | void *user_data); |
78 | 77 | ||
79 | void output_damage_whole(struct sway_output *output); | 78 | void output_damage_whole(struct sway_output *output); |
diff --git a/include/sway/server.h b/include/sway/server.h index 0f5e3ab2..3d59ca56 100644 --- a/include/sway/server.h +++ b/include/sway/server.h | |||
@@ -4,16 +4,19 @@ | |||
4 | #include <wayland-server-core.h> | 4 | #include <wayland-server-core.h> |
5 | #include <wlr/backend.h> | 5 | #include <wlr/backend.h> |
6 | #include <wlr/backend/session.h> | 6 | #include <wlr/backend/session.h> |
7 | #include <wlr/render/allocator.h> | ||
7 | #include <wlr/render/wlr_renderer.h> | 8 | #include <wlr/render/wlr_renderer.h> |
8 | #include <wlr/types/wlr_compositor.h> | 9 | #include <wlr/types/wlr_compositor.h> |
9 | #include <wlr/types/wlr_data_device.h> | 10 | #include <wlr/types/wlr_data_device.h> |
10 | #include <wlr/types/wlr_input_method_v2.h> | 11 | #include <wlr/types/wlr_input_method_v2.h> |
11 | #include <wlr/types/wlr_foreign_toplevel_management_v1.h> | 12 | #include <wlr/types/wlr_foreign_toplevel_management_v1.h> |
13 | #include <wlr/types/wlr_drm_lease_v1.h> | ||
12 | #include <wlr/types/wlr_layer_shell_v1.h> | 14 | #include <wlr/types/wlr_layer_shell_v1.h> |
13 | #include <wlr/types/wlr_output_management_v1.h> | 15 | #include <wlr/types/wlr_output_management_v1.h> |
14 | #include <wlr/types/wlr_output_power_management_v1.h> | 16 | #include <wlr/types/wlr_output_power_management_v1.h> |
15 | #include <wlr/types/wlr_presentation_time.h> | 17 | #include <wlr/types/wlr_presentation_time.h> |
16 | #include <wlr/types/wlr_relative_pointer_v1.h> | 18 | #include <wlr/types/wlr_relative_pointer_v1.h> |
19 | #include <wlr/types/wlr_session_lock_v1.h> | ||
17 | #include <wlr/types/wlr_server_decoration.h> | 20 | #include <wlr/types/wlr_server_decoration.h> |
18 | #include <wlr/types/wlr_text_input_v3.h> | 21 | #include <wlr/types/wlr_text_input_v3.h> |
19 | #include <wlr/types/wlr_xdg_shell.h> | 22 | #include <wlr/types/wlr_xdg_shell.h> |
@@ -23,19 +26,24 @@ | |||
23 | #include "sway/xwayland.h" | 26 | #include "sway/xwayland.h" |
24 | #endif | 27 | #endif |
25 | 28 | ||
29 | struct sway_transaction; | ||
30 | |||
26 | struct sway_server { | 31 | struct sway_server { |
27 | struct wl_display *wl_display; | 32 | struct wl_display *wl_display; |
28 | struct wl_event_loop *wl_event_loop; | 33 | struct wl_event_loop *wl_event_loop; |
29 | const char *socket; | 34 | const char *socket; |
30 | 35 | ||
31 | struct wlr_backend *backend; | 36 | struct wlr_backend *backend; |
32 | struct wlr_backend *noop_backend; | ||
33 | // secondary headless backend used for creating virtual outputs on-the-fly | 37 | // secondary headless backend used for creating virtual outputs on-the-fly |
34 | struct wlr_backend *headless_backend; | 38 | struct wlr_backend *headless_backend; |
39 | struct wlr_renderer *renderer; | ||
40 | struct wlr_allocator *allocator; | ||
35 | 41 | ||
36 | struct wlr_compositor *compositor; | 42 | struct wlr_compositor *compositor; |
37 | struct wl_listener compositor_new_surface; | 43 | struct wl_listener compositor_new_surface; |
38 | 44 | ||
45 | struct wlr_linux_dmabuf_v1 *linux_dmabuf_v1; | ||
46 | |||
39 | struct wlr_data_device_manager *data_device_manager; | 47 | struct wlr_data_device_manager *data_device_manager; |
40 | 48 | ||
41 | struct sway_input_manager *input; | 49 | struct sway_input_manager *input; |
@@ -70,6 +78,9 @@ struct sway_server { | |||
70 | struct wl_listener xdg_decoration; | 78 | struct wl_listener xdg_decoration; |
71 | struct wl_list xdg_decorations; // sway_xdg_decoration::link | 79 | struct wl_list xdg_decorations; // sway_xdg_decoration::link |
72 | 80 | ||
81 | struct wlr_drm_lease_v1_manager *drm_lease_manager; | ||
82 | struct wl_listener drm_lease_request; | ||
83 | |||
73 | struct wlr_presentation *presentation; | 84 | struct wlr_presentation *presentation; |
74 | 85 | ||
75 | struct wlr_pointer_constraints_v1 *pointer_constraints; | 86 | struct wlr_pointer_constraints_v1 *pointer_constraints; |
@@ -79,14 +90,44 @@ struct sway_server { | |||
79 | struct wl_listener output_manager_apply; | 90 | struct wl_listener output_manager_apply; |
80 | struct wl_listener output_manager_test; | 91 | struct wl_listener output_manager_test; |
81 | 92 | ||
93 | struct { | ||
94 | bool locked; | ||
95 | struct wlr_session_lock_manager_v1 *manager; | ||
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; | ||
103 | struct wl_listener manager_destroy; | ||
104 | } session_lock; | ||
105 | |||
82 | struct wlr_output_power_manager_v1 *output_power_manager_v1; | 106 | struct wlr_output_power_manager_v1 *output_power_manager_v1; |
83 | struct wl_listener output_power_manager_set_mode; | 107 | struct wl_listener output_power_manager_set_mode; |
84 | struct wlr_input_method_manager_v2 *input_method; | 108 | struct wlr_input_method_manager_v2 *input_method; |
85 | struct wlr_text_input_manager_v3 *text_input; | 109 | struct wlr_text_input_manager_v3 *text_input; |
86 | struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager; | 110 | struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager; |
87 | 111 | ||
112 | struct wlr_xdg_activation_v1 *xdg_activation_v1; | ||
113 | struct wl_listener xdg_activation_v1_request_activate; | ||
114 | |||
115 | // The timeout for transactions, after which a transaction is applied | ||
116 | // regardless of readiness. | ||
88 | size_t txn_timeout_ms; | 117 | size_t txn_timeout_ms; |
89 | list_t *transactions; | 118 | |
119 | // Stores a transaction after it has been committed, but is waiting for | ||
120 | // views to ack the new dimensions before being applied. A queued | ||
121 | // transaction is frozen and must not have new instructions added to it. | ||
122 | struct sway_transaction *queued_transaction; | ||
123 | |||
124 | // Stores a pending transaction that will be committed once the existing | ||
125 | // queued transaction is applied and freed. The pending transaction can be | ||
126 | // updated with new instructions as needed. | ||
127 | struct sway_transaction *pending_transaction; | ||
128 | |||
129 | // Stores the nodes that have been marked as "dirty" and will be put into | ||
130 | // the pending transaction. | ||
90 | list_t *dirty_nodes; | 131 | list_t *dirty_nodes; |
91 | }; | 132 | }; |
92 | 133 | ||
@@ -96,6 +137,7 @@ struct sway_debug { | |||
96 | bool noatomic; // Ignore atomic layout updates | 137 | bool noatomic; // Ignore atomic layout updates |
97 | bool txn_timings; // Log verbose messages about transactions | 138 | bool txn_timings; // Log verbose messages about transactions |
98 | bool txn_wait; // Always wait for the timeout before applying | 139 | bool txn_wait; // Always wait for the timeout before applying |
140 | bool noscanout; // Disable direct scan-out | ||
99 | 141 | ||
100 | enum { | 142 | enum { |
101 | DAMAGE_DEFAULT, // Default behaviour | 143 | DAMAGE_DEFAULT, // Default behaviour |
@@ -113,11 +155,14 @@ void server_fini(struct sway_server *server); | |||
113 | bool server_start(struct sway_server *server); | 155 | bool server_start(struct sway_server *server); |
114 | void server_run(struct sway_server *server); | 156 | void server_run(struct sway_server *server); |
115 | 157 | ||
158 | void restore_nofile_limit(void); | ||
159 | |||
116 | void handle_compositor_new_surface(struct wl_listener *listener, void *data); | 160 | void handle_compositor_new_surface(struct wl_listener *listener, void *data); |
117 | void handle_new_output(struct wl_listener *listener, void *data); | 161 | void handle_new_output(struct wl_listener *listener, void *data); |
118 | 162 | ||
119 | void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data); | 163 | void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data); |
120 | void handle_layer_shell_surface(struct wl_listener *listener, void *data); | 164 | void handle_layer_shell_surface(struct wl_listener *listener, void *data); |
165 | void sway_session_lock_init(void); | ||
121 | void handle_xdg_shell_surface(struct wl_listener *listener, void *data); | 166 | void handle_xdg_shell_surface(struct wl_listener *listener, void *data); |
122 | #if HAVE_XWAYLAND | 167 | #if HAVE_XWAYLAND |
123 | void handle_xwayland_surface(struct wl_listener *listener, void *data); | 168 | void handle_xwayland_surface(struct wl_listener *listener, void *data); |
@@ -125,5 +170,9 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data); | |||
125 | void handle_server_decoration(struct wl_listener *listener, void *data); | 170 | void handle_server_decoration(struct wl_listener *listener, void *data); |
126 | void handle_xdg_decoration(struct wl_listener *listener, void *data); | 171 | void handle_xdg_decoration(struct wl_listener *listener, void *data); |
127 | void handle_pointer_constraint(struct wl_listener *listener, void *data); | 172 | void handle_pointer_constraint(struct wl_listener *listener, void *data); |
173 | void xdg_activation_v1_handle_request_activate(struct wl_listener *listener, | ||
174 | void *data); | ||
175 | |||
176 | void set_rr_scheduling(void); | ||
128 | 177 | ||
129 | #endif | 178 | #endif |
diff --git a/include/sway/surface.h b/include/sway/surface.h index 4da96c02..fb1cd775 100644 --- a/include/sway/surface.h +++ b/include/sway/surface.h | |||
@@ -1,6 +1,6 @@ | |||
1 | #ifndef _SWAY_SURFACE_H | 1 | #ifndef _SWAY_SURFACE_H |
2 | #define _SWAY_SURFACE_H | 2 | #define _SWAY_SURFACE_H |
3 | #include <wlr/types/wlr_surface.h> | 3 | #include <wlr/types/wlr_compositor.h> |
4 | 4 | ||
5 | struct sway_surface { | 5 | struct sway_surface { |
6 | struct wlr_surface *wlr_surface; | 6 | struct wlr_surface *wlr_surface; |
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index 7e9df59f..751612e2 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h | |||
@@ -2,8 +2,7 @@ | |||
2 | #define _SWAY_CONTAINER_H | 2 | #define _SWAY_CONTAINER_H |
3 | #include <stdint.h> | 3 | #include <stdint.h> |
4 | #include <sys/types.h> | 4 | #include <sys/types.h> |
5 | #include <wlr/types/wlr_box.h> | 5 | #include <wlr/types/wlr_compositor.h> |
6 | #include <wlr/types/wlr_surface.h> | ||
7 | #include "list.h" | 6 | #include "list.h" |
8 | #include "sway/tree/node.h" | 7 | #include "sway/tree/node.h" |
9 | 8 | ||
@@ -46,9 +45,9 @@ struct sway_container_state { | |||
46 | 45 | ||
47 | enum sway_fullscreen_mode fullscreen_mode; | 46 | enum sway_fullscreen_mode fullscreen_mode; |
48 | 47 | ||
49 | struct sway_workspace *workspace; | 48 | struct sway_workspace *workspace; // NULL when hidden in the scratchpad |
50 | struct sway_container *parent; | 49 | struct sway_container *parent; // NULL if container in root of workspace |
51 | list_t *children; | 50 | list_t *children; // struct sway_container |
52 | 51 | ||
53 | struct sway_container *focused_inactive_child; | 52 | struct sway_container *focused_inactive_child; |
54 | bool focused; | 53 | bool focused; |
@@ -60,6 +59,7 @@ struct sway_container_state { | |||
60 | bool border_left; | 59 | bool border_left; |
61 | bool border_right; | 60 | bool border_right; |
62 | 61 | ||
62 | // These are in layout coordinates. | ||
63 | double content_x, content_y; | 63 | double content_x, content_y; |
64 | double content_width, content_height; | 64 | double content_width, content_height; |
65 | }; | 65 | }; |
@@ -68,14 +68,12 @@ struct sway_container { | |||
68 | struct sway_node node; | 68 | struct sway_node node; |
69 | struct sway_view *view; | 69 | struct sway_view *view; |
70 | 70 | ||
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; | 71 | struct sway_container_state current; |
72 | struct sway_container_state pending; | ||
74 | 73 | ||
75 | char *title; // The view's title (unformatted) | 74 | char *title; // The view's title (unformatted) |
76 | char *formatted_title; // The title displayed in the title bar | 75 | char *formatted_title; // The title displayed in the title bar |
77 | 76 | ||
78 | enum sway_container_layout layout; | ||
79 | enum sway_container_layout prev_split_layout; | 77 | enum sway_container_layout prev_split_layout; |
80 | 78 | ||
81 | // Whether stickiness has been enabled on this container. Use | 79 | // Whether stickiness has been enabled on this container. Use |
@@ -86,11 +84,13 @@ struct sway_container { | |||
86 | // For C_ROOT, this has no meaning | 84 | // For C_ROOT, this has no meaning |
87 | // For other types, this is the position in layout coordinates | 85 | // For other types, this is the position in layout coordinates |
88 | // Includes borders | 86 | // Includes borders |
89 | double x, y; | ||
90 | double width, height; | ||
91 | double saved_x, saved_y; | 87 | double saved_x, saved_y; |
92 | double saved_width, saved_height; | 88 | double saved_width, saved_height; |
93 | 89 | ||
90 | // Used when the view changes to CSD unexpectedly. This will be a non-B_CSD | ||
91 | // border which we use to restore when the view returns to SSD. | ||
92 | enum sway_container_border saved_border; | ||
93 | |||
94 | // The share of the space of parent container this container occupies | 94 | // The share of the space of parent container this container occupies |
95 | double width_fraction; | 95 | double width_fraction; |
96 | double height_fraction; | 96 | double height_fraction; |
@@ -100,33 +100,11 @@ struct sway_container { | |||
100 | double child_total_width; | 100 | double child_total_width; |
101 | double child_total_height; | 101 | double child_total_height; |
102 | 102 | ||
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 | 103 | // 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. | 104 | // refuses to resize to the content dimensions then it can be smaller. |
109 | // These are in layout coordinates. | 105 | // These are in layout coordinates. |
110 | double surface_x, surface_y; | 106 | double surface_x, surface_y; |
111 | 107 | ||
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 | 108 | // Outputs currently being intersected |
131 | list_t *outputs; // struct sway_output | 109 | list_t *outputs; // struct sway_output |
132 | 110 | ||
@@ -139,14 +117,14 @@ struct sway_container { | |||
139 | 117 | ||
140 | struct wlr_texture *title_focused; | 118 | struct wlr_texture *title_focused; |
141 | struct wlr_texture *title_focused_inactive; | 119 | struct wlr_texture *title_focused_inactive; |
120 | struct wlr_texture *title_focused_tab_title; | ||
142 | struct wlr_texture *title_unfocused; | 121 | struct wlr_texture *title_unfocused; |
143 | struct wlr_texture *title_urgent; | 122 | struct wlr_texture *title_urgent; |
144 | size_t title_height; | ||
145 | size_t title_baseline; | ||
146 | 123 | ||
147 | list_t *marks; // char * | 124 | list_t *marks; // char * |
148 | struct wlr_texture *marks_focused; | 125 | struct wlr_texture *marks_focused; |
149 | struct wlr_texture *marks_focused_inactive; | 126 | struct wlr_texture *marks_focused_inactive; |
127 | struct wlr_texture *marks_focused_tab_title; | ||
150 | struct wlr_texture *marks_unfocused; | 128 | struct wlr_texture *marks_unfocused; |
151 | struct wlr_texture *marks_urgent; | 129 | struct wlr_texture *marks_urgent; |
152 | 130 | ||
@@ -185,6 +163,11 @@ void container_for_each_child(struct sway_container *container, | |||
185 | void (*f)(struct sway_container *container, void *data), void *data); | 163 | void (*f)(struct sway_container *container, void *data), void *data); |
186 | 164 | ||
187 | /** | 165 | /** |
166 | * Returns the fullscreen container obstructing this container if it exists. | ||
167 | */ | ||
168 | struct sway_container *container_obstructing_fullscreen_container(struct sway_container *container); | ||
169 | |||
170 | /** | ||
188 | * Returns true if the given container is an ancestor of this container. | 171 | * Returns true if the given container is an ancestor of this container. |
189 | */ | 172 | */ |
190 | bool container_has_ancestor(struct sway_container *container, | 173 | bool container_has_ancestor(struct sway_container *container, |
@@ -200,11 +183,6 @@ struct sway_container *container_flatten(struct sway_container *container); | |||
200 | 183 | ||
201 | void container_update_title_textures(struct sway_container *container); | 184 | void container_update_title_textures(struct sway_container *container); |
202 | 185 | ||
203 | /** | ||
204 | * Calculate the container's title_height property. | ||
205 | */ | ||
206 | void container_calculate_title_height(struct sway_container *container); | ||
207 | |||
208 | size_t container_build_representation(enum sway_container_layout layout, | 186 | size_t container_build_representation(enum sway_container_layout layout, |
209 | list_t *children, char *buffer); | 187 | list_t *children, char *buffer); |
210 | 188 | ||
@@ -231,10 +209,17 @@ void container_set_geometry_from_content(struct sway_container *con); | |||
231 | /** | 209 | /** |
232 | * Determine if the given container is itself floating. | 210 | * Determine if the given container is itself floating. |
233 | * This will return false for any descendants of a floating container. | 211 | * This will return false for any descendants of a floating container. |
212 | * | ||
213 | * Uses pending container state. | ||
234 | */ | 214 | */ |
235 | bool container_is_floating(struct sway_container *container); | 215 | bool container_is_floating(struct sway_container *container); |
236 | 216 | ||
237 | /** | 217 | /** |
218 | * Same as above, but for current container state. | ||
219 | */ | ||
220 | bool container_is_current_floating(struct sway_container *container); | ||
221 | |||
222 | /** | ||
238 | * Get a container's box in layout coordinates. | 223 | * Get a container's box in layout coordinates. |
239 | */ | 224 | */ |
240 | 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); |
@@ -299,6 +284,7 @@ bool container_is_fullscreen_or_child(struct sway_container *container); | |||
299 | /** | 284 | /** |
300 | * Return the output which will be used for scale purposes. | 285 | * Return the output which will be used for scale purposes. |
301 | * This is the most recently entered output. | 286 | * This is the most recently entered output. |
287 | * If the container is not on any output, return NULL. | ||
302 | */ | 288 | */ |
303 | struct sway_output *container_get_effective_output(struct sway_container *con); | 289 | struct sway_output *container_get_effective_output(struct sway_container *con); |
304 | 290 | ||
@@ -378,7 +364,7 @@ bool container_is_sticky_or_child(struct sway_container *con); | |||
378 | * This will destroy pairs of redundant H/V splits | 364 | * This will destroy pairs of redundant H/V splits |
379 | * e.g. H[V[H[app app]] app] -> H[app app app] | 365 | * e.g. H[V[H[app app]] app] -> H[app app app] |
380 | * The middle "V[H[" are eliminated by a call to container_squash | 366 | * The middle "V[H[" are eliminated by a call to container_squash |
381 | * on the V[ con. It's grandchildren are added to it's parent. | 367 | * on the V[ con. It's grandchildren are added to its parent. |
382 | * | 368 | * |
383 | * This function is roughly equivalent to i3's tree_flatten here: | 369 | * This function is roughly equivalent to i3's tree_flatten here: |
384 | * https://github.com/i3/i3/blob/1f0c628cde40cf87371481041b7197344e0417c6/src/tree.c#L651 | 370 | * https://github.com/i3/i3/blob/1f0c628cde40cf87371481041b7197344e0417c6/src/tree.c#L651 |
diff --git a/include/sway/tree/root.h b/include/sway/tree/root.h index e8f4d573..5d4a2f2d 100644 --- a/include/sway/tree/root.h +++ b/include/sway/tree/root.h | |||
@@ -31,7 +31,7 @@ struct sway_root { | |||
31 | list_t *scratchpad; // struct sway_container | 31 | list_t *scratchpad; // struct sway_container |
32 | 32 | ||
33 | // For when there's no connected outputs | 33 | // For when there's no connected outputs |
34 | struct sway_output *noop_output; | 34 | struct sway_output *fallback_output; |
35 | 35 | ||
36 | struct sway_container *fullscreen_global; | 36 | struct sway_container *fullscreen_global; |
37 | 37 | ||
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index e071e6c9..95708a04 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h | |||
@@ -1,7 +1,7 @@ | |||
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/types/wlr_surface.h> | 4 | #include <wlr/types/wlr_compositor.h> |
5 | #include "config.h" | 5 | #include "config.h" |
6 | #if HAVE_XWAYLAND | 6 | #if HAVE_XWAYLAND |
7 | #include <wlr/xwayland.h> | 7 | #include <wlr/xwayland.h> |
@@ -108,11 +108,10 @@ struct sway_view { | |||
108 | list_t *executed_criteria; // struct criteria * | 108 | list_t *executed_criteria; // struct criteria * |
109 | 109 | ||
110 | union { | 110 | union { |
111 | struct wlr_xdg_surface *wlr_xdg_surface; | 111 | struct wlr_xdg_toplevel *wlr_xdg_toplevel; |
112 | #if HAVE_XWAYLAND | 112 | #if HAVE_XWAYLAND |
113 | struct wlr_xwayland_surface *wlr_xwayland_surface; | 113 | struct wlr_xwayland_surface *wlr_xwayland_surface; |
114 | #endif | 114 | #endif |
115 | struct wlr_wl_shell_surface *wlr_wl_shell_surface; | ||
116 | }; | 115 | }; |
117 | 116 | ||
118 | struct { | 117 | struct { |
@@ -132,7 +131,6 @@ struct sway_xdg_shell_view { | |||
132 | struct wl_listener commit; | 131 | struct wl_listener commit; |
133 | struct wl_listener request_move; | 132 | struct wl_listener request_move; |
134 | struct wl_listener request_resize; | 133 | struct wl_listener request_resize; |
135 | struct wl_listener request_maximize; | ||
136 | struct wl_listener request_fullscreen; | 134 | struct wl_listener request_fullscreen; |
137 | struct wl_listener set_title; | 135 | struct wl_listener set_title; |
138 | struct wl_listener set_app_id; | 136 | struct wl_listener set_app_id; |
@@ -171,6 +169,7 @@ struct sway_xwayland_unmanaged { | |||
171 | 169 | ||
172 | int lx, ly; | 170 | int lx, ly; |
173 | 171 | ||
172 | struct wl_listener request_activate; | ||
174 | struct wl_listener request_configure; | 173 | struct wl_listener request_configure; |
175 | struct wl_listener request_fullscreen; | 174 | struct wl_listener request_fullscreen; |
176 | struct wl_listener commit; | 175 | struct wl_listener commit; |
@@ -184,7 +183,7 @@ struct sway_xwayland_unmanaged { | |||
184 | struct sway_view_child; | 183 | struct sway_view_child; |
185 | 184 | ||
186 | struct sway_view_child_impl { | 185 | struct sway_view_child_impl { |
187 | void (*get_root_coords)(struct sway_view_child *child, int *sx, int *sy); | 186 | void (*get_view_coords)(struct sway_view_child *child, int *sx, int *sy); |
188 | void (*destroy)(struct sway_view_child *child); | 187 | void (*destroy)(struct sway_view_child *child); |
189 | }; | 188 | }; |
190 | 189 | ||
@@ -218,7 +217,7 @@ struct sway_subsurface { | |||
218 | struct sway_xdg_popup { | 217 | struct sway_xdg_popup { |
219 | struct sway_view_child child; | 218 | struct sway_view_child child; |
220 | 219 | ||
221 | struct wlr_xdg_surface *wlr_xdg_surface; | 220 | struct wlr_xdg_popup *wlr_xdg_popup; |
222 | 221 | ||
223 | struct wl_listener new_popup; | 222 | struct wl_listener new_popup; |
224 | struct wl_listener destroy; | 223 | struct wl_listener destroy; |
@@ -311,12 +310,22 @@ void view_destroy(struct sway_view *view); | |||
311 | 310 | ||
312 | void view_begin_destroy(struct sway_view *view); | 311 | void view_begin_destroy(struct sway_view *view); |
313 | 312 | ||
313 | /** | ||
314 | * Map a view, ie. make it visible in the tree. | ||
315 | * | ||
316 | * `fullscreen` should be set to true (and optionally `fullscreen_output` | ||
317 | * should be populated) if the view should be made fullscreen immediately. | ||
318 | * | ||
319 | * `decoration` should be set to true if the client prefers CSD. The client's | ||
320 | * preference may be ignored. | ||
321 | */ | ||
314 | void view_map(struct sway_view *view, struct wlr_surface *wlr_surface, | 322 | void view_map(struct sway_view *view, struct wlr_surface *wlr_surface, |
315 | bool fullscreen, struct wlr_output *fullscreen_output, bool decoration); | 323 | bool fullscreen, struct wlr_output *fullscreen_output, bool decoration); |
316 | 324 | ||
317 | void view_unmap(struct sway_view *view); | 325 | void view_unmap(struct sway_view *view); |
318 | 326 | ||
319 | void view_update_size(struct sway_view *view, int width, int height); | 327 | void view_update_size(struct sway_view *view); |
328 | void view_center_surface(struct sway_view *view); | ||
320 | 329 | ||
321 | void view_child_init(struct sway_view_child *child, | 330 | void view_child_init(struct sway_view_child *child, |
322 | const struct sway_view_child_impl *impl, struct sway_view *view, | 331 | 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..b3d93a81 100644 --- a/include/sway/tree/workspace.h +++ b/include/sway/tree/workspace.h | |||
@@ -60,20 +60,20 @@ 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 | ||
68 | struct sway_workspace *workspace_by_name(const char*); | 70 | struct sway_workspace *workspace_by_name(const char*); |
69 | 71 | ||
70 | struct sway_workspace *workspace_output_next( | 72 | struct sway_workspace *workspace_output_next(struct sway_workspace *current); |
71 | struct sway_workspace *current, bool create); | ||
72 | 73 | ||
73 | struct sway_workspace *workspace_next(struct sway_workspace *current); | 74 | struct sway_workspace *workspace_next(struct sway_workspace *current); |
74 | 75 | ||
75 | struct sway_workspace *workspace_output_prev( | 76 | struct sway_workspace *workspace_output_prev(struct sway_workspace *current); |
76 | struct sway_workspace *current, bool create); | ||
77 | 77 | ||
78 | struct sway_workspace *workspace_prev(struct sway_workspace *current); | 78 | struct sway_workspace *workspace_prev(struct sway_workspace *current); |
79 | 79 | ||
diff --git a/include/swaybar/bar.h b/include/swaybar/bar.h index 545a66a8..3ad0bdf3 100644 --- a/include/swaybar/bar.h +++ b/include/swaybar/bar.h | |||
@@ -58,7 +58,6 @@ struct swaybar_output { | |||
58 | struct zxdg_output_v1 *xdg_output; | 58 | struct zxdg_output_v1 *xdg_output; |
59 | struct wl_surface *surface; | 59 | struct wl_surface *surface; |
60 | struct zwlr_layer_surface_v1 *layer_surface; | 60 | struct zwlr_layer_surface_v1 *layer_surface; |
61 | struct wl_region *input_region; | ||
62 | uint32_t wl_name; | 61 | uint32_t wl_name; |
63 | 62 | ||
64 | struct wl_list workspaces; // swaybar_workspace::link | 63 | struct wl_list workspaces; // swaybar_workspace::link |
diff --git a/include/swaybar/i3bar.h b/include/swaybar/i3bar.h index df8cdd09..1aec6d6c 100644 --- a/include/swaybar/i3bar.h +++ b/include/swaybar/i3bar.h | |||
@@ -19,6 +19,7 @@ struct i3bar_block { | |||
19 | // Airblader features | 19 | // Airblader features |
20 | uint32_t background; | 20 | uint32_t background; |
21 | uint32_t border; | 21 | uint32_t border; |
22 | bool border_set; | ||
22 | int border_top; | 23 | int border_top; |
23 | int border_bottom; | 24 | int border_bottom; |
24 | int border_left; | 25 | int border_left; |
diff --git a/include/swaynag/swaynag.h b/include/swaynag/swaynag.h index 9e39e716..2d68b6c9 100644 --- a/include/swaynag/swaynag.h +++ b/include/swaynag/swaynag.h | |||
@@ -5,7 +5,6 @@ | |||
5 | #include "list.h" | 5 | #include "list.h" |
6 | #include "pool-buffer.h" | 6 | #include "pool-buffer.h" |
7 | #include "swaynag/types.h" | 7 | #include "swaynag/types.h" |
8 | #include "xdg-output-unstable-v1-client-protocol.h" | ||
9 | 8 | ||
10 | #define SWAYNAG_MAX_HEIGHT 500 | 9 | #define SWAYNAG_MAX_HEIGHT 500 |
11 | 10 | ||
@@ -68,20 +67,18 @@ struct swaynag_details { | |||
68 | int offset; | 67 | int offset; |
69 | int visible_lines; | 68 | int visible_lines; |
70 | int total_lines; | 69 | int total_lines; |
71 | struct swaynag_button *button_details; | 70 | struct swaynag_button button_details; |
72 | struct swaynag_button button_up; | 71 | struct swaynag_button button_up; |
73 | struct swaynag_button button_down; | 72 | struct swaynag_button button_down; |
74 | }; | 73 | }; |
75 | 74 | ||
76 | struct swaynag { | 75 | struct swaynag { |
77 | bool run_display; | 76 | bool run_display; |
78 | int querying_outputs; | ||
79 | 77 | ||
80 | struct wl_display *display; | 78 | struct wl_display *display; |
81 | struct wl_compositor *compositor; | 79 | struct wl_compositor *compositor; |
82 | struct wl_seat *seat; | 80 | struct wl_seat *seat; |
83 | struct wl_shm *shm; | 81 | struct wl_shm *shm; |
84 | struct zxdg_output_manager_v1 *xdg_output_manager; | ||
85 | struct wl_list outputs; // swaynag_output::link | 82 | struct wl_list outputs; // swaynag_output::link |
86 | struct wl_list seats; // swaynag_seat::link | 83 | struct wl_list seats; // swaynag_seat::link |
87 | struct swaynag_output *output; | 84 | struct swaynag_output *output; |
diff --git a/include/swaynag/types.h b/include/swaynag/types.h index 24da9418..3c3b2754 100644 --- a/include/swaynag/types.h +++ b/include/swaynag/types.h | |||
@@ -7,6 +7,7 @@ struct swaynag_type { | |||
7 | char *font; | 7 | char *font; |
8 | char *output; | 8 | char *output; |
9 | uint32_t anchors; | 9 | uint32_t anchors; |
10 | int32_t layer; // enum zwlr_layer_shell_v1_layer or -1 if unset | ||
10 | 11 | ||
11 | // Colors | 12 | // Colors |
12 | uint32_t button_text; | 13 | uint32_t button_text; |
diff --git a/include/util.h b/include/util.h index c80da1cb..f887d489 100644 --- a/include/util.h +++ b/include/util.h | |||
@@ -30,12 +30,6 @@ int parse_movement_amount(int argc, char **argv, | |||
30 | struct movement_amount *amount); | 30 | struct movement_amount *amount); |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * Get the current time, in milliseconds. | ||
34 | */ | ||
35 | |||
36 | uint32_t get_current_time_msec(void); | ||
37 | |||
38 | /** | ||
39 | * Wrap i into the range [0, max] | 33 | * Wrap i into the range [0, max] |
40 | */ | 34 | */ |
41 | int wrap(int i, int max); | 35 | int wrap(int i, int max); |