diff options
Diffstat (limited to 'include/sway')
-rw-r--r-- | include/sway/commands.h | 9 | ||||
-rw-r--r-- | include/sway/config.h | 19 | ||||
-rw-r--r-- | include/sway/criteria.h | 5 | ||||
-rw-r--r-- | include/sway/debug.h | 8 | ||||
-rw-r--r-- | include/sway/desktop.h | 4 | ||||
-rw-r--r-- | include/sway/desktop/idle_inhibit_v1.h | 28 | ||||
-rw-r--r-- | include/sway/desktop/transaction.h | 33 | ||||
-rw-r--r-- | include/sway/input/cursor.h | 4 | ||||
-rw-r--r-- | include/sway/input/seat.h | 43 | ||||
-rw-r--r-- | include/sway/ipc-server.h | 4 | ||||
-rw-r--r-- | include/sway/output.h | 43 | ||||
-rw-r--r-- | include/sway/scratchpad.h | 26 | ||||
-rw-r--r-- | include/sway/server.h | 11 | ||||
-rw-r--r-- | include/sway/tree/arrange.h | 22 | ||||
-rw-r--r-- | include/sway/tree/container.h | 38 | ||||
-rw-r--r-- | include/sway/tree/layout.h | 11 | ||||
-rw-r--r-- | include/sway/tree/view.h | 20 | ||||
-rw-r--r-- | include/sway/tree/workspace.h | 3 |
18 files changed, 255 insertions, 76 deletions
diff --git a/include/sway/commands.h b/include/sway/commands.h index 7ca0bda8..f53d335a 100644 --- a/include/sway/commands.h +++ b/include/sway/commands.h | |||
@@ -79,7 +79,7 @@ void free_cmd_results(struct cmd_results *results); | |||
79 | * | 79 | * |
80 | * Free the JSON string later on. | 80 | * Free the JSON string later on. |
81 | */ | 81 | */ |
82 | const char *cmd_results_to_json(struct cmd_results *results); | 82 | char *cmd_results_to_json(struct cmd_results *results); |
83 | 83 | ||
84 | struct cmd_results *add_color(const char *name, | 84 | struct cmd_results *add_color(const char *name, |
85 | char *buffer, const char *color); | 85 | char *buffer, const char *color); |
@@ -95,7 +95,6 @@ sway_cmd cmd_client_unfocused; | |||
95 | sway_cmd cmd_client_urgent; | 95 | sway_cmd cmd_client_urgent; |
96 | sway_cmd cmd_client_placeholder; | 96 | sway_cmd cmd_client_placeholder; |
97 | sway_cmd cmd_client_background; | 97 | sway_cmd cmd_client_background; |
98 | sway_cmd cmd_clipboard; | ||
99 | sway_cmd cmd_commands; | 98 | sway_cmd cmd_commands; |
100 | sway_cmd cmd_debuglog; | 99 | sway_cmd cmd_debuglog; |
101 | sway_cmd cmd_default_border; | 100 | sway_cmd cmd_default_border; |
@@ -107,13 +106,14 @@ sway_cmd cmd_exit; | |||
107 | sway_cmd cmd_floating; | 106 | sway_cmd cmd_floating; |
108 | sway_cmd cmd_floating_maximum_size; | 107 | sway_cmd cmd_floating_maximum_size; |
109 | sway_cmd cmd_floating_minimum_size; | 108 | sway_cmd cmd_floating_minimum_size; |
110 | sway_cmd cmd_floating_mod; | 109 | sway_cmd cmd_floating_modifier; |
111 | sway_cmd cmd_floating_scroll; | 110 | sway_cmd cmd_floating_scroll; |
112 | sway_cmd cmd_focus; | 111 | sway_cmd cmd_focus; |
113 | sway_cmd cmd_focus_follows_mouse; | 112 | sway_cmd cmd_focus_follows_mouse; |
114 | sway_cmd cmd_focus_wrapping; | 113 | sway_cmd cmd_focus_wrapping; |
115 | sway_cmd cmd_font; | 114 | sway_cmd cmd_font; |
116 | sway_cmd cmd_for_window; | 115 | sway_cmd cmd_for_window; |
116 | sway_cmd cmd_force_display_urgency_hint; | ||
117 | sway_cmd cmd_force_focus_wrapping; | 117 | sway_cmd cmd_force_focus_wrapping; |
118 | sway_cmd cmd_fullscreen; | 118 | sway_cmd cmd_fullscreen; |
119 | sway_cmd cmd_gaps; | 119 | sway_cmd cmd_gaps; |
@@ -153,6 +153,7 @@ sway_cmd cmd_swaybg_command; | |||
153 | sway_cmd cmd_swap; | 153 | sway_cmd cmd_swap; |
154 | sway_cmd cmd_title_format; | 154 | sway_cmd cmd_title_format; |
155 | sway_cmd cmd_unmark; | 155 | sway_cmd cmd_unmark; |
156 | sway_cmd cmd_urgent; | ||
156 | sway_cmd cmd_workspace; | 157 | sway_cmd cmd_workspace; |
157 | sway_cmd cmd_ws_auto_back_and_forth; | 158 | sway_cmd cmd_ws_auto_back_and_forth; |
158 | sway_cmd cmd_workspace_layout; | 159 | sway_cmd cmd_workspace_layout; |
@@ -208,8 +209,10 @@ sway_cmd input_cmd_natural_scroll; | |||
208 | sway_cmd input_cmd_pointer_accel; | 209 | sway_cmd input_cmd_pointer_accel; |
209 | sway_cmd input_cmd_repeat_delay; | 210 | sway_cmd input_cmd_repeat_delay; |
210 | sway_cmd input_cmd_repeat_rate; | 211 | sway_cmd input_cmd_repeat_rate; |
212 | sway_cmd input_cmd_scroll_button; | ||
211 | sway_cmd input_cmd_scroll_method; | 213 | sway_cmd input_cmd_scroll_method; |
212 | sway_cmd input_cmd_tap; | 214 | sway_cmd input_cmd_tap; |
215 | sway_cmd input_cmd_tap_button_map; | ||
213 | sway_cmd input_cmd_xkb_layout; | 216 | sway_cmd input_cmd_xkb_layout; |
214 | sway_cmd input_cmd_xkb_model; | 217 | sway_cmd input_cmd_xkb_model; |
215 | sway_cmd input_cmd_xkb_options; | 218 | sway_cmd input_cmd_xkb_options; |
diff --git a/include/sway/config.h b/include/sway/config.h index 9b583323..9d2e1bf9 100644 --- a/include/sway/config.h +++ b/include/sway/config.h | |||
@@ -49,6 +49,7 @@ struct sway_mode { | |||
49 | char *name; | 49 | char *name; |
50 | list_t *keysym_bindings; | 50 | list_t *keysym_bindings; |
51 | list_t *keycode_bindings; | 51 | list_t *keycode_bindings; |
52 | bool pango; | ||
52 | }; | 53 | }; |
53 | 54 | ||
54 | struct input_config_mapped_from_region { | 55 | struct input_config_mapped_from_region { |
@@ -73,9 +74,11 @@ struct input_config { | |||
73 | float pointer_accel; | 74 | float pointer_accel; |
74 | int repeat_delay; | 75 | int repeat_delay; |
75 | int repeat_rate; | 76 | int repeat_rate; |
77 | int scroll_button; | ||
76 | int scroll_method; | 78 | int scroll_method; |
77 | int send_events; | 79 | int send_events; |
78 | int tap; | 80 | int tap; |
81 | int tap_button_map; | ||
79 | 82 | ||
80 | char *xkb_layout; | 83 | char *xkb_layout; |
81 | char *xkb_model; | 84 | char *xkb_model; |
@@ -263,11 +266,10 @@ enum ipc_feature { | |||
263 | IPC_FEATURE_EVENT_WINDOW = 2048, | 266 | IPC_FEATURE_EVENT_WINDOW = 2048, |
264 | IPC_FEATURE_EVENT_BINDING = 4096, | 267 | IPC_FEATURE_EVENT_BINDING = 4096, |
265 | IPC_FEATURE_EVENT_INPUT = 8192, | 268 | IPC_FEATURE_EVENT_INPUT = 8192, |
266 | IPC_FEATURE_GET_CLIPBOARD = 16384, | 269 | IPC_FEATURE_GET_SEATS = 16384, |
267 | IPC_FEATURE_GET_SEATS = 32768, | ||
268 | 270 | ||
269 | IPC_FEATURE_ALL_COMMANDS = | 271 | IPC_FEATURE_ALL_COMMANDS = |
270 | 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 | 16384 | 32768, | 272 | 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 | 16384, |
271 | IPC_FEATURE_ALL_EVENTS = 256 | 512 | 1024 | 2048 | 4096 | 8192, | 273 | IPC_FEATURE_ALL_EVENTS = 256 | 512 | 1024 | 2048 | 4096 | 8192, |
272 | 274 | ||
273 | IPC_FEATURE_ALL = IPC_FEATURE_ALL_COMMANDS | IPC_FEATURE_ALL_EVENTS, | 275 | IPC_FEATURE_ALL = IPC_FEATURE_ALL_COMMANDS | IPC_FEATURE_ALL_EVENTS, |
@@ -314,6 +316,7 @@ struct sway_config { | |||
314 | char *font; | 316 | char *font; |
315 | size_t font_height; | 317 | size_t font_height; |
316 | bool pango_markup; | 318 | bool pango_markup; |
319 | size_t urgent_timeout; | ||
317 | 320 | ||
318 | // Flags | 321 | // Flags |
319 | bool focus_follows_mouse; | 322 | bool focus_follows_mouse; |
@@ -332,6 +335,7 @@ struct sway_config { | |||
332 | int gaps_outer; | 335 | int gaps_outer; |
333 | 336 | ||
334 | list_t *config_chain; | 337 | list_t *config_chain; |
338 | const char *current_config_path; | ||
335 | const char *current_config; | 339 | const char *current_config; |
336 | 340 | ||
337 | enum sway_container_border border; | 341 | enum sway_container_border border; |
@@ -447,8 +451,14 @@ void merge_output_config(struct output_config *dst, struct output_config *src); | |||
447 | void apply_output_config(struct output_config *oc, | 451 | void apply_output_config(struct output_config *oc, |
448 | struct sway_container *output); | 452 | struct sway_container *output); |
449 | 453 | ||
454 | struct output_config *store_output_config(struct output_config *oc); | ||
455 | |||
456 | void apply_output_config_to_outputs(struct output_config *oc); | ||
457 | |||
450 | void free_output_config(struct output_config *oc); | 458 | void free_output_config(struct output_config *oc); |
451 | 459 | ||
460 | void create_default_output_configs(void); | ||
461 | |||
452 | int workspace_output_cmp_workspace(const void *a, const void *b); | 462 | int workspace_output_cmp_workspace(const void *a, const void *b); |
453 | 463 | ||
454 | int sway_binding_cmp(const void *a, const void *b); | 464 | int sway_binding_cmp(const void *a, const void *b); |
@@ -484,7 +494,4 @@ void config_update_font_height(bool recalculate); | |||
484 | /* Global config singleton. */ | 494 | /* Global config singleton. */ |
485 | extern struct sway_config *config; | 495 | extern struct sway_config *config; |
486 | 496 | ||
487 | /* Config file currently being read */ | ||
488 | extern const char *current_config_path; | ||
489 | |||
490 | #endif | 497 | #endif |
diff --git a/include/sway/criteria.h b/include/sway/criteria.h index bd3ca0ac..6a8337c5 100644 --- a/include/sway/criteria.h +++ b/include/sway/criteria.h | |||
@@ -6,9 +6,10 @@ | |||
6 | #include "tree/view.h" | 6 | #include "tree/view.h" |
7 | 7 | ||
8 | enum criteria_type { | 8 | enum criteria_type { |
9 | CT_COMMAND = 1 << 0, | 9 | CT_COMMAND = 1 << 0, |
10 | CT_ASSIGN_OUTPUT = 1 << 1, | 10 | CT_ASSIGN_OUTPUT = 1 << 1, |
11 | CT_ASSIGN_WORKSPACE = 1 << 2, | 11 | CT_ASSIGN_WORKSPACE = 1 << 2, |
12 | CT_NO_FOCUS = 1 << 3, | ||
12 | }; | 13 | }; |
13 | 14 | ||
14 | struct criteria { | 15 | struct criteria { |
diff --git a/include/sway/debug.h b/include/sway/debug.h index 2430d319..38d4eccd 100644 --- a/include/sway/debug.h +++ b/include/sway/debug.h | |||
@@ -1,7 +1,15 @@ | |||
1 | #ifndef SWAY_DEBUG_H | 1 | #ifndef SWAY_DEBUG_H |
2 | #define SWAY_DEBUG_H | 2 | #define SWAY_DEBUG_H |
3 | 3 | ||
4 | // Tree | ||
4 | extern bool enable_debug_tree; | 5 | extern bool enable_debug_tree; |
5 | void update_debug_tree(); | 6 | void update_debug_tree(); |
6 | 7 | ||
8 | // Damage | ||
9 | extern const char *damage_debug; | ||
10 | |||
11 | // Transactions | ||
12 | extern int txn_timeout_ms; | ||
13 | extern bool txn_debug; | ||
14 | |||
7 | #endif | 15 | #endif |
diff --git a/include/sway/desktop.h b/include/sway/desktop.h index f1ad759a..348fb187 100644 --- a/include/sway/desktop.h +++ b/include/sway/desktop.h | |||
@@ -1,4 +1,8 @@ | |||
1 | #include <wlr/types/wlr_surface.h> | 1 | #include <wlr/types/wlr_surface.h> |
2 | 2 | ||
3 | struct sway_container; | ||
4 | |||
3 | void desktop_damage_surface(struct wlr_surface *surface, double lx, double ly, | 5 | void desktop_damage_surface(struct wlr_surface *surface, double lx, double ly, |
4 | bool whole); | 6 | bool whole); |
7 | |||
8 | void desktop_damage_whole_container(struct sway_container *con); | ||
diff --git a/include/sway/desktop/idle_inhibit_v1.h b/include/sway/desktop/idle_inhibit_v1.h new file mode 100644 index 00000000..e5ed8a3d --- /dev/null +++ b/include/sway/desktop/idle_inhibit_v1.h | |||
@@ -0,0 +1,28 @@ | |||
1 | #ifndef _SWAY_DESKTOP_IDLE_INHIBIT_V1_H | ||
2 | #define _SWAY_DESKTOP_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 | |||
7 | struct sway_idle_inhibit_manager_v1 { | ||
8 | struct wlr_idle_inhibit_manager_v1 *wlr_manager; | ||
9 | struct wl_listener new_idle_inhibitor_v1; | ||
10 | struct wl_list inhibitors; | ||
11 | |||
12 | struct wlr_idle *idle; | ||
13 | }; | ||
14 | |||
15 | struct sway_idle_inhibitor_v1 { | ||
16 | struct sway_idle_inhibit_manager_v1 *manager; | ||
17 | struct sway_view *view; | ||
18 | |||
19 | struct wl_list link; | ||
20 | struct wl_listener destroy; | ||
21 | }; | ||
22 | |||
23 | void idle_inhibit_v1_check_active( | ||
24 | struct sway_idle_inhibit_manager_v1 *manager); | ||
25 | |||
26 | struct sway_idle_inhibit_manager_v1 *sway_idle_inhibit_manager_v1_create( | ||
27 | struct wl_display *wl_display, struct wlr_idle *idle); | ||
28 | #endif | ||
diff --git a/include/sway/desktop/transaction.h b/include/sway/desktop/transaction.h index 7ab80eb8..cee4afed 100644 --- a/include/sway/desktop/transaction.h +++ b/include/sway/desktop/transaction.h | |||
@@ -6,34 +6,25 @@ | |||
6 | /** | 6 | /** |
7 | * Transactions enable us to perform atomic layout updates. | 7 | * Transactions enable us to perform atomic layout updates. |
8 | * | 8 | * |
9 | * When we want to make adjustments to the layout, we create a transaction. | 9 | * A transaction contains a list of containers and their new state. |
10 | * A transaction contains a list of affected containers and their new state. | ||
11 | * A state might contain a new size, or new border settings, or new parent/child | 10 | * A state might contain a new size, or new border settings, or new parent/child |
12 | * relationships. | 11 | * relationships. |
13 | * | 12 | * |
14 | * Calling transaction_commit() makes sway notify of all the affected clients | 13 | * Committing a transaction makes sway notify of all the affected clients with |
15 | * with their new sizes. We then wait for all the views to respond with their | 14 | * their new sizes. We then wait for all the views to respond with their new |
16 | * new surface sizes. When all are ready, or when a timeout has passed, we apply | 15 | * surface sizes. When all are ready, or when a timeout has passed, we apply the |
17 | * the updates all at the same time. | 16 | * updates all at the same time. |
18 | */ | 17 | * |
19 | 18 | * When we want to make adjustments to the layout, we change the pending state | |
20 | struct sway_transaction; | 19 | * in containers, mark them as dirty and call transaction_commit_dirty(). This |
21 | 20 | * create and commits a transaction from the dirty containers. | |
22 | /** | ||
23 | * Create a new transaction. | ||
24 | */ | ||
25 | struct sway_transaction *transaction_create(void); | ||
26 | |||
27 | /** | ||
28 | * Add a container's pending state to the transaction. | ||
29 | */ | 21 | */ |
30 | void transaction_add_container(struct sway_transaction *transaction, | ||
31 | struct sway_container *container); | ||
32 | 22 | ||
33 | /** | 23 | /** |
34 | * Submit a transaction to the client views for configuration. | 24 | * Find all dirty containers, create and commit a transaction containing them, |
25 | * and unmark them as dirty. | ||
35 | */ | 26 | */ |
36 | void transaction_commit(struct sway_transaction *transaction); | 27 | void transaction_commit_dirty(void); |
37 | 28 | ||
38 | /** | 29 | /** |
39 | * Notify the transaction system that a view is ready for the new layout. | 30 | * Notify the transaction system that a view is ready for the new layout. |
diff --git a/include/sway/input/cursor.h b/include/sway/input/cursor.h index 5dd109ca..b0a3a7c5 100644 --- a/include/sway/input/cursor.h +++ b/include/sway/input/cursor.h | |||
@@ -11,6 +11,7 @@ struct sway_cursor { | |||
11 | } previous; | 11 | } previous; |
12 | struct wlr_xcursor_manager *xcursor_manager; | 12 | struct wlr_xcursor_manager *xcursor_manager; |
13 | 13 | ||
14 | const char *image; | ||
14 | struct wl_client *image_client; | 15 | struct wl_client *image_client; |
15 | 16 | ||
16 | struct wl_listener motion; | 17 | struct wl_listener motion; |
@@ -37,4 +38,7 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec, | |||
37 | void dispatch_cursor_button(struct sway_cursor *cursor, uint32_t time_msec, | 38 | void dispatch_cursor_button(struct sway_cursor *cursor, uint32_t time_msec, |
38 | uint32_t button, enum wlr_button_state state); | 39 | uint32_t button, enum wlr_button_state state); |
39 | 40 | ||
41 | void cursor_set_image(struct sway_cursor *cursor, const char *image, | ||
42 | struct wl_client *client); | ||
43 | |||
40 | #endif | 44 | #endif |
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h index 0e440701..ab25788f 100644 --- a/include/sway/input/seat.h +++ b/include/sway/input/seat.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <wlr/types/wlr_layer_shell.h> | 4 | #include <wlr/types/wlr_layer_shell.h> |
5 | #include <wlr/types/wlr_seat.h> | 5 | #include <wlr/types/wlr_seat.h> |
6 | #include <wlr/util/edges.h> | ||
6 | #include "sway/input/input-manager.h" | 7 | #include "sway/input/input-manager.h" |
7 | 8 | ||
8 | struct sway_seat_device { | 9 | struct sway_seat_device { |
@@ -52,6 +53,24 @@ struct sway_seat { | |||
52 | int32_t touch_id; | 53 | int32_t touch_id; |
53 | double touch_x, touch_y; | 54 | double touch_x, touch_y; |
54 | 55 | ||
56 | // Operations (drag and resize) | ||
57 | enum { | ||
58 | OP_NONE, | ||
59 | OP_MOVE, | ||
60 | OP_RESIZE, | ||
61 | } operation; | ||
62 | |||
63 | struct sway_container *op_container; | ||
64 | enum wlr_edges op_resize_edge; | ||
65 | uint32_t op_button; | ||
66 | bool op_resize_preserve_ratio; | ||
67 | double op_ref_lx, op_ref_ly; // cursor's x/y at start of op | ||
68 | double op_ref_width, op_ref_height; // container's size at start of op | ||
69 | double op_ref_con_lx, op_ref_con_ly; // container's x/y at start of op | ||
70 | |||
71 | uint32_t last_button; | ||
72 | uint32_t last_button_serial; | ||
73 | |||
55 | struct wl_listener focus_destroy; | 74 | struct wl_listener focus_destroy; |
56 | struct wl_listener new_container; | 75 | struct wl_listener new_container; |
57 | struct wl_listener new_drag_icon; | 76 | struct wl_listener new_drag_icon; |
@@ -83,7 +102,7 @@ void seat_set_focus_warp(struct sway_seat *seat, | |||
83 | struct sway_container *container, bool warp); | 102 | struct sway_container *container, bool warp); |
84 | 103 | ||
85 | void seat_set_focus_surface(struct sway_seat *seat, | 104 | void seat_set_focus_surface(struct sway_seat *seat, |
86 | struct wlr_surface *surface); | 105 | struct wlr_surface *surface, bool unfocus); |
87 | 106 | ||
88 | void seat_set_focus_layer(struct sway_seat *seat, | 107 | void seat_set_focus_layer(struct sway_seat *seat, |
89 | struct wlr_layer_surface *layer); | 108 | struct wlr_layer_surface *layer); |
@@ -119,17 +138,6 @@ struct sway_container *seat_get_active_child(struct sway_seat *seat, | |||
119 | struct sway_container *container); | 138 | struct sway_container *container); |
120 | 139 | ||
121 | /** | 140 | /** |
122 | * Return the immediate child of container which was most recently focused, with | ||
123 | * fallback to selecting the child in the parent's `current` (rendered) children | ||
124 | * list. | ||
125 | * | ||
126 | * This is useful for when a tabbed container and its children are destroyed but | ||
127 | * still being rendered, and we have to render an appropriate child. | ||
128 | */ | ||
129 | struct sway_container *seat_get_active_current_child(struct sway_seat *seat, | ||
130 | struct sway_container *container); | ||
131 | |||
132 | /** | ||
133 | * Iterate over the focus-inactive children of the container calling the | 141 | * Iterate over the focus-inactive children of the container calling the |
134 | * function on each. | 142 | * function on each. |
135 | */ | 143 | */ |
@@ -145,4 +153,15 @@ bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface); | |||
145 | 153 | ||
146 | void drag_icon_update_position(struct sway_drag_icon *icon); | 154 | void drag_icon_update_position(struct sway_drag_icon *icon); |
147 | 155 | ||
156 | void seat_begin_move(struct sway_seat *seat, struct sway_container *con, | ||
157 | uint32_t button); | ||
158 | |||
159 | void seat_begin_resize(struct sway_seat *seat, struct sway_container *con, | ||
160 | uint32_t button, enum wlr_edges edge); | ||
161 | |||
162 | void seat_end_mouse_operation(struct sway_seat *seat); | ||
163 | |||
164 | void seat_pointer_notify_button(struct sway_seat *seat, uint32_t time_msec, | ||
165 | uint32_t button, enum wlr_button_state state); | ||
166 | |||
148 | #endif | 167 | #endif |
diff --git a/include/sway/ipc-server.h b/include/sway/ipc-server.h index dd16a175..6469f097 100644 --- a/include/sway/ipc-server.h +++ b/include/sway/ipc-server.h | |||
@@ -9,14 +9,12 @@ struct sway_server; | |||
9 | 9 | ||
10 | void ipc_init(struct sway_server *server); | 10 | void ipc_init(struct sway_server *server); |
11 | 11 | ||
12 | void ipc_terminate(void); | ||
13 | |||
14 | struct sockaddr_un *ipc_user_sockaddr(void); | 12 | struct sockaddr_un *ipc_user_sockaddr(void); |
15 | 13 | ||
16 | void ipc_event_workspace(struct sway_container *old, | 14 | void ipc_event_workspace(struct sway_container *old, |
17 | struct sway_container *new, const char *change); | 15 | struct sway_container *new, const char *change); |
18 | void ipc_event_window(struct sway_container *window, const char *change); | 16 | void ipc_event_window(struct sway_container *window, const char *change); |
19 | void ipc_event_barconfig_update(struct bar_config *bar); | 17 | void ipc_event_barconfig_update(struct bar_config *bar); |
20 | void ipc_event_mode(const char *mode); | 18 | void ipc_event_mode(const char *mode, bool pango); |
21 | 19 | ||
22 | #endif | 20 | #endif |
diff --git a/include/sway/output.h b/include/sway/output.h index 19fc5e99..b6cda83c 100644 --- a/include/sway/output.h +++ b/include/sway/output.h | |||
@@ -38,6 +38,16 @@ struct sway_output { | |||
38 | } events; | 38 | } events; |
39 | }; | 39 | }; |
40 | 40 | ||
41 | /** | ||
42 | * Contains a surface's root geometry information. For instance, when rendering | ||
43 | * a popup, this will contain the parent view's position and size. | ||
44 | */ | ||
45 | struct root_geometry { | ||
46 | double x, y; | ||
47 | int width, height; | ||
48 | float rotation; | ||
49 | }; | ||
50 | |||
41 | void output_damage_whole(struct sway_output *output); | 51 | void output_damage_whole(struct sway_output *output); |
42 | 52 | ||
43 | void output_damage_surface(struct sway_output *output, double ox, double oy, | 53 | void output_damage_surface(struct sway_output *output, double ox, double oy, |
@@ -54,4 +64,37 @@ void output_damage_whole_container(struct sway_output *output, | |||
54 | struct sway_container *output_by_name(const char *name); | 64 | struct sway_container *output_by_name(const char *name); |
55 | 65 | ||
56 | void output_enable(struct sway_output *output); | 66 | void output_enable(struct sway_output *output); |
67 | |||
68 | bool output_has_opaque_lockscreen(struct sway_output *output, | ||
69 | struct sway_seat *seat); | ||
70 | |||
71 | struct sway_container *output_get_active_workspace(struct sway_output *output); | ||
72 | |||
73 | void output_render(struct sway_output *output, struct timespec *when, | ||
74 | pixman_region32_t *damage); | ||
75 | |||
76 | bool output_get_surface_box(struct root_geometry *geo, | ||
77 | struct sway_output *output, struct wlr_surface *surface, int sx, int sy, | ||
78 | struct wlr_box *surface_box); | ||
79 | |||
80 | void output_surface_for_each_surface(struct wlr_surface *surface, | ||
81 | double ox, double oy, struct root_geometry *geo, | ||
82 | wlr_surface_iterator_func_t iterator, void *user_data); | ||
83 | |||
84 | void output_view_for_each_surface(struct sway_view *view, | ||
85 | struct sway_output *output, struct root_geometry *geo, | ||
86 | wlr_surface_iterator_func_t iterator, void *user_data); | ||
87 | |||
88 | void output_layer_for_each_surface(struct wl_list *layer_surfaces, | ||
89 | struct root_geometry *geo, wlr_surface_iterator_func_t iterator, | ||
90 | void *user_data); | ||
91 | |||
92 | void output_unmanaged_for_each_surface(struct wl_list *unmanaged, | ||
93 | struct sway_output *output, struct root_geometry *geo, | ||
94 | wlr_surface_iterator_func_t iterator, void *user_data); | ||
95 | |||
96 | void output_drag_icons_for_each_surface(struct wl_list *drag_icons, | ||
97 | struct sway_output *output, struct root_geometry *geo, | ||
98 | wlr_surface_iterator_func_t iterator, void *user_data); | ||
99 | |||
57 | #endif | 100 | #endif |
diff --git a/include/sway/scratchpad.h b/include/sway/scratchpad.h new file mode 100644 index 00000000..5af5256f --- /dev/null +++ b/include/sway/scratchpad.h | |||
@@ -0,0 +1,26 @@ | |||
1 | #ifndef _SWAY_SCRATCHPAD_H | ||
2 | #define _SWAY_SCRATCHPAD_H | ||
3 | |||
4 | #include "tree/container.h" | ||
5 | |||
6 | /** | ||
7 | * Move a container to the scratchpad. | ||
8 | */ | ||
9 | void scratchpad_add_container(struct sway_container *con); | ||
10 | |||
11 | /** | ||
12 | * Remove a container from the scratchpad. | ||
13 | */ | ||
14 | void scratchpad_remove_container(struct sway_container *con); | ||
15 | |||
16 | /** | ||
17 | * Show or hide the next container on the scratchpad. | ||
18 | */ | ||
19 | void scratchpad_toggle_auto(void); | ||
20 | |||
21 | /** | ||
22 | * Show or hide a specific container on the scratchpad. | ||
23 | */ | ||
24 | void scratchpad_toggle_container(struct sway_container *con); | ||
25 | |||
26 | #endif | ||
diff --git a/include/sway/server.h b/include/sway/server.h index 1e1aa3cc..70bde6d4 100644 --- a/include/sway/server.h +++ b/include/sway/server.h | |||
@@ -23,12 +23,14 @@ struct sway_server { | |||
23 | 23 | ||
24 | struct wlr_compositor *compositor; | 24 | struct wlr_compositor *compositor; |
25 | struct wlr_data_device_manager *data_device_manager; | 25 | struct wlr_data_device_manager *data_device_manager; |
26 | struct wlr_idle *idle; | ||
27 | 26 | ||
28 | struct sway_input_manager *input; | 27 | struct sway_input_manager *input; |
29 | 28 | ||
30 | struct wl_listener new_output; | 29 | struct wl_listener new_output; |
31 | 30 | ||
31 | struct wlr_idle *idle; | ||
32 | struct sway_idle_inhibit_manager_v1 *idle_inhibit_manager_v1; | ||
33 | |||
32 | struct wlr_layer_shell *layer_shell; | 34 | struct wlr_layer_shell *layer_shell; |
33 | struct wl_listener layer_shell_surface; | 35 | struct wl_listener layer_shell_surface; |
34 | 36 | ||
@@ -45,10 +47,7 @@ struct sway_server { | |||
45 | bool debug_txn_timings; | 47 | bool debug_txn_timings; |
46 | 48 | ||
47 | list_t *transactions; | 49 | list_t *transactions; |
48 | 50 | list_t *dirty_containers; | |
49 | // When a view is being destroyed and is waiting for a transaction to | ||
50 | // complete it will be stored here. | ||
51 | list_t *destroying_containers; | ||
52 | }; | 51 | }; |
53 | 52 | ||
54 | struct sway_server server; | 53 | struct sway_server server; |
@@ -57,10 +56,12 @@ struct sway_server server; | |||
57 | bool server_privileged_prepare(struct sway_server *server); | 56 | bool server_privileged_prepare(struct sway_server *server); |
58 | bool server_init(struct sway_server *server); | 57 | bool server_init(struct sway_server *server); |
59 | void server_fini(struct sway_server *server); | 58 | void server_fini(struct sway_server *server); |
59 | bool server_start_backend(struct sway_server *server); | ||
60 | void server_run(struct sway_server *server); | 60 | void server_run(struct sway_server *server); |
61 | 61 | ||
62 | void handle_new_output(struct wl_listener *listener, void *data); | 62 | void handle_new_output(struct wl_listener *listener, void *data); |
63 | 63 | ||
64 | void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data); | ||
64 | void handle_layer_shell_surface(struct wl_listener *listener, void *data); | 65 | void handle_layer_shell_surface(struct wl_listener *listener, void *data); |
65 | void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data); | 66 | void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data); |
66 | void handle_xdg_shell_surface(struct wl_listener *listener, void *data); | 67 | void handle_xdg_shell_surface(struct wl_listener *listener, void *data); |
diff --git a/include/sway/tree/arrange.h b/include/sway/tree/arrange.h index 58235642..d6abcc81 100644 --- a/include/sway/tree/arrange.h +++ b/include/sway/tree/arrange.h | |||
@@ -11,26 +11,8 @@ void remove_gaps(struct sway_container *c); | |||
11 | void add_gaps(struct sway_container *c); | 11 | void add_gaps(struct sway_container *c); |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * Arrange layout for all the children of the given container, and add them to | 14 | * Arrange layout for all the children of the given container. |
15 | * the given transaction. | ||
16 | * | ||
17 | * Use this function if you need to arrange multiple sections of the tree in one | ||
18 | * transaction. | ||
19 | * | ||
20 | * You must set the desired state of the container before calling | ||
21 | * arrange_windows, then don't change any state-tracked properties in the | ||
22 | * container until you've called transaction_commit. | ||
23 | */ | 15 | */ |
24 | void arrange_windows(struct sway_container *container, | 16 | void arrange_windows(struct sway_container *container); |
25 | struct sway_transaction *transaction); | ||
26 | |||
27 | /** | ||
28 | * Arrange layout for the given container and commit the transaction. | ||
29 | * | ||
30 | * This function is a wrapper around arrange_windows, and handles creating and | ||
31 | * committing the transaction for you. Use this function if you're only doing | ||
32 | * one arrange operation. | ||
33 | */ | ||
34 | void arrange_and_commit(struct sway_container *container); | ||
35 | 17 | ||
36 | #endif | 18 | #endif |
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index 728daa84..2a4be18c 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h | |||
@@ -68,6 +68,9 @@ struct sway_container_state { | |||
68 | struct sway_container *parent; | 68 | struct sway_container *parent; |
69 | list_t *children; | 69 | list_t *children; |
70 | 70 | ||
71 | struct sway_container *focused_inactive_child; | ||
72 | bool focused; | ||
73 | |||
71 | // View properties | 74 | // View properties |
72 | double view_x, view_y; | 75 | double view_x, view_y; |
73 | double view_width, view_height; | 76 | double view_width, view_height; |
@@ -132,6 +135,11 @@ struct sway_container { | |||
132 | 135 | ||
133 | struct sway_container *parent; | 136 | struct sway_container *parent; |
134 | 137 | ||
138 | // Indicates that the container is a scratchpad container. | ||
139 | // Both hidden and visible scratchpad containers have scratchpad=true. | ||
140 | // Hidden scratchpad containers have a NULL parent. | ||
141 | bool scratchpad; | ||
142 | |||
135 | float alpha; | 143 | float alpha; |
136 | 144 | ||
137 | struct wlr_texture *title_focused; | 145 | struct wlr_texture *title_focused; |
@@ -144,6 +152,10 @@ struct sway_container { | |||
144 | 152 | ||
145 | bool destroying; | 153 | bool destroying; |
146 | 154 | ||
155 | // If true, indicates that the container has pending state that differs from | ||
156 | // the current. | ||
157 | bool dirty; | ||
158 | |||
147 | struct { | 159 | struct { |
148 | struct wl_signal destroy; | 160 | struct wl_signal destroy; |
149 | // Raised after the tree updates, but before arrange_windows | 161 | // Raised after the tree updates, but before arrange_windows |
@@ -297,4 +309,30 @@ bool container_is_floating(struct sway_container *container); | |||
297 | */ | 309 | */ |
298 | void container_get_box(struct sway_container *container, struct wlr_box *box); | 310 | void container_get_box(struct sway_container *container, struct wlr_box *box); |
299 | 311 | ||
312 | /** | ||
313 | * Move a floating container by the specified amount. | ||
314 | */ | ||
315 | void container_floating_translate(struct sway_container *con, | ||
316 | double x_amount, double y_amount); | ||
317 | |||
318 | /** | ||
319 | * Move a floating container to a new layout-local position. | ||
320 | */ | ||
321 | void container_floating_move_to(struct sway_container *con, | ||
322 | double lx, double ly); | ||
323 | |||
324 | /** | ||
325 | * Mark a container as dirty if it isn't already. Dirty containers will be | ||
326 | * included in the next transaction then unmarked as dirty. | ||
327 | */ | ||
328 | void container_set_dirty(struct sway_container *container); | ||
329 | |||
330 | bool container_has_urgent_child(struct sway_container *container); | ||
331 | |||
332 | /** | ||
333 | * If the container is involved in a drag or resize operation via a mouse, this | ||
334 | * ends the operation. | ||
335 | */ | ||
336 | void container_end_mouse_operation(struct sway_container *container); | ||
337 | |||
300 | #endif | 338 | #endif |
diff --git a/include/sway/tree/layout.h b/include/sway/tree/layout.h index ba265623..7d7da2d7 100644 --- a/include/sway/tree/layout.h +++ b/include/sway/tree/layout.h | |||
@@ -14,10 +14,11 @@ enum movement_direction { | |||
14 | }; | 14 | }; |
15 | 15 | ||
16 | enum resize_edge { | 16 | enum resize_edge { |
17 | RESIZE_EDGE_LEFT, | 17 | RESIZE_EDGE_NONE = 0, |
18 | RESIZE_EDGE_RIGHT, | 18 | RESIZE_EDGE_LEFT = 1, |
19 | RESIZE_EDGE_TOP, | 19 | RESIZE_EDGE_RIGHT = 2, |
20 | RESIZE_EDGE_BOTTOM, | 20 | RESIZE_EDGE_TOP = 4, |
21 | RESIZE_EDGE_BOTTOM = 8, | ||
21 | }; | 22 | }; |
22 | 23 | ||
23 | struct sway_container; | 24 | struct sway_container; |
@@ -34,6 +35,8 @@ struct sway_root { | |||
34 | 35 | ||
35 | struct wl_list outputs; // sway_output::link | 36 | struct wl_list outputs; // sway_output::link |
36 | 37 | ||
38 | list_t *scratchpad; // struct sway_container | ||
39 | |||
37 | struct { | 40 | struct { |
38 | struct wl_signal new_container; | 41 | struct wl_signal new_container; |
39 | } events; | 42 | } events; |
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index 7dc8ac46..3bdfe252 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h | |||
@@ -26,6 +26,8 @@ enum sway_view_prop { | |||
26 | }; | 26 | }; |
27 | 27 | ||
28 | struct sway_view_impl { | 28 | struct sway_view_impl { |
29 | void (*get_constraints)(struct sway_view *view, double *min_width, | ||
30 | double *max_width, double *min_height, double *max_height); | ||
29 | const char *(*get_string_prop)(struct sway_view *view, | 31 | const char *(*get_string_prop)(struct sway_view *view, |
30 | enum sway_view_prop prop); | 32 | enum sway_view_prop prop); |
31 | uint32_t (*get_int_prop)(struct sway_view *view, enum sway_view_prop prop); | 33 | uint32_t (*get_int_prop)(struct sway_view *view, enum sway_view_prop prop); |
@@ -35,6 +37,7 @@ struct sway_view_impl { | |||
35 | void (*set_tiled)(struct sway_view *view, bool tiled); | 37 | void (*set_tiled)(struct sway_view *view, bool tiled); |
36 | void (*set_fullscreen)(struct sway_view *view, bool fullscreen); | 38 | void (*set_fullscreen)(struct sway_view *view, bool fullscreen); |
37 | bool (*wants_floating)(struct sway_view *view); | 39 | bool (*wants_floating)(struct sway_view *view); |
40 | bool (*has_client_side_decorations)(struct sway_view *view); | ||
38 | void (*for_each_surface)(struct sway_view *view, | 41 | void (*for_each_surface)(struct sway_view *view, |
39 | wlr_surface_iterator_func_t iterator, void *user_data); | 42 | wlr_surface_iterator_func_t iterator, void *user_data); |
40 | void (*close)(struct sway_view *view); | 43 | void (*close)(struct sway_view *view); |
@@ -68,6 +71,11 @@ struct sway_view { | |||
68 | bool border_bottom; | 71 | bool border_bottom; |
69 | bool border_left; | 72 | bool border_left; |
70 | bool border_right; | 73 | bool border_right; |
74 | bool using_csd; | ||
75 | |||
76 | struct timespec urgent; | ||
77 | bool allow_request_urgent; | ||
78 | struct wl_event_source *urgent_timer; | ||
71 | 79 | ||
72 | bool destroying; | 80 | bool destroying; |
73 | 81 | ||
@@ -102,6 +110,8 @@ struct sway_xdg_shell_v6_view { | |||
102 | struct wl_listener request_resize; | 110 | struct wl_listener request_resize; |
103 | struct wl_listener request_maximize; | 111 | struct wl_listener request_maximize; |
104 | struct wl_listener request_fullscreen; | 112 | struct wl_listener request_fullscreen; |
113 | struct wl_listener set_title; | ||
114 | struct wl_listener set_app_id; | ||
105 | struct wl_listener new_popup; | 115 | struct wl_listener new_popup; |
106 | struct wl_listener map; | 116 | struct wl_listener map; |
107 | struct wl_listener unmap; | 117 | struct wl_listener unmap; |
@@ -116,6 +126,8 @@ struct sway_xdg_shell_view { | |||
116 | struct wl_listener request_resize; | 126 | struct wl_listener request_resize; |
117 | struct wl_listener request_maximize; | 127 | struct wl_listener request_maximize; |
118 | struct wl_listener request_fullscreen; | 128 | struct wl_listener request_fullscreen; |
129 | struct wl_listener set_title; | ||
130 | struct wl_listener set_app_id; | ||
119 | struct wl_listener new_popup; | 131 | struct wl_listener new_popup; |
120 | struct wl_listener map; | 132 | struct wl_listener map; |
121 | struct wl_listener unmap; | 133 | struct wl_listener unmap; |
@@ -134,6 +146,7 @@ struct sway_xwayland_view { | |||
134 | struct wl_listener set_title; | 146 | struct wl_listener set_title; |
135 | struct wl_listener set_class; | 147 | struct wl_listener set_class; |
136 | struct wl_listener set_window_type; | 148 | struct wl_listener set_window_type; |
149 | struct wl_listener set_hints; | ||
137 | struct wl_listener map; | 150 | struct wl_listener map; |
138 | struct wl_listener unmap; | 151 | struct wl_listener unmap; |
139 | struct wl_listener destroy; | 152 | struct wl_listener destroy; |
@@ -208,6 +221,9 @@ uint32_t view_get_window_type(struct sway_view *view); | |||
208 | 221 | ||
209 | const char *view_get_shell(struct sway_view *view); | 222 | const char *view_get_shell(struct sway_view *view); |
210 | 223 | ||
224 | void view_get_constraints(struct sway_view *view, double *min_width, | ||
225 | double *max_width, double *min_height, double *max_height); | ||
226 | |||
211 | uint32_t view_configure(struct sway_view *view, double lx, double ly, int width, | 227 | uint32_t view_configure(struct sway_view *view, double lx, double ly, int width, |
212 | int height); | 228 | int height); |
213 | 229 | ||
@@ -304,4 +320,8 @@ void view_update_marks_textures(struct sway_view *view); | |||
304 | */ | 320 | */ |
305 | bool view_is_visible(struct sway_view *view); | 321 | bool view_is_visible(struct sway_view *view); |
306 | 322 | ||
323 | void view_set_urgent(struct sway_view *view, bool enable); | ||
324 | |||
325 | bool view_is_urgent(struct sway_view *view); | ||
326 | |||
307 | #endif | 327 | #endif |
diff --git a/include/sway/tree/workspace.h b/include/sway/tree/workspace.h index d84e4a02..ff66da6b 100644 --- a/include/sway/tree/workspace.h +++ b/include/sway/tree/workspace.h | |||
@@ -10,6 +10,7 @@ struct sway_workspace { | |||
10 | struct sway_view *fullscreen; | 10 | struct sway_view *fullscreen; |
11 | struct sway_container *floating; | 11 | struct sway_container *floating; |
12 | list_t *output_priority; | 12 | list_t *output_priority; |
13 | bool urgent; | ||
13 | }; | 14 | }; |
14 | 15 | ||
15 | extern char *prev_workspace_name; | 16 | extern char *prev_workspace_name; |
@@ -47,4 +48,6 @@ struct sway_container *workspace_for_pid(pid_t pid); | |||
47 | 48 | ||
48 | void workspace_record_pid(pid_t pid); | 49 | void workspace_record_pid(pid_t pid); |
49 | 50 | ||
51 | void workspace_detect_urgent(struct sway_container *workspace); | ||
52 | |||
50 | #endif | 53 | #endif |