aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/sway/config.h29
-rw-r--r--include/sway/desktop/launcher.h4
-rw-r--r--include/sway/desktop/transaction.h3
-rw-r--r--include/sway/input/cursor.h2
-rw-r--r--include/sway/input/input-manager.h3
-rw-r--r--include/sway/input/seat.h7
-rw-r--r--include/sway/input/text_input.h3
-rw-r--r--include/sway/input/text_input_popup.h20
-rw-r--r--include/sway/layers.h5
-rw-r--r--include/sway/output.h2
-rw-r--r--include/sway/server.h19
-rw-r--r--include/sway/tree/view.h17
12 files changed, 83 insertions, 31 deletions
diff --git a/include/sway/config.h b/include/sway/config.h
index f9da1967..5ccc3e77 100644
--- a/include/sway/config.h
+++ b/include/sway/config.h
@@ -292,6 +292,14 @@ struct output_config {
292}; 292};
293 293
294/** 294/**
295 * An output config pre-matched to an output
296 */
297struct matched_output_config {
298 struct sway_output *output;
299 struct output_config *config;
300};
301
302/**
295 * Stores size of gaps for each side 303 * Stores size of gaps for each side
296 */ 304 */
297struct side_gaps { 305struct side_gaps {
@@ -680,20 +688,25 @@ const char *sway_output_scale_filter_to_string(enum scale_filter_mode scale_filt
680 688
681struct output_config *new_output_config(const char *name); 689struct output_config *new_output_config(const char *name);
682 690
683void merge_output_config(struct output_config *dst, struct output_config *src); 691bool apply_output_configs(struct matched_output_config *configs,
692 size_t configs_len, bool test_only, bool degrade_to_off);
684 693
685bool apply_output_config(struct output_config *oc, struct sway_output *output); 694void apply_all_output_configs(void);
686 695
687bool test_output_config(struct output_config *oc, struct sway_output *output); 696void sort_output_configs_by_priority(struct matched_output_config *configs,
697 size_t configs_len);
688 698
689struct output_config *store_output_config(struct output_config *oc); 699/**
700 * store_output_config stores a new output config. An output may be matched by
701 * three different config types, in order of precedence: Identifier, name and
702 * wildcard. When storing a config type of lower precedence, assume that the
703 * user wants the config to take immediate effect by superseding (clearing) the
704 * same values from higher presedence configuration.
705 */
706void store_output_config(struct output_config *oc);
690 707
691struct output_config *find_output_config(struct sway_output *output); 708struct output_config *find_output_config(struct sway_output *output);
692 709
693void apply_output_config_to_outputs(struct output_config *oc);
694
695void reset_outputs(void);
696
697void free_output_config(struct output_config *oc); 710void free_output_config(struct output_config *oc);
698 711
699bool spawn_swaybg(void); 712bool spawn_swaybg(void);
diff --git a/include/sway/desktop/launcher.h b/include/sway/desktop/launcher.h
index b7716e82..412068a9 100644
--- a/include/sway/desktop/launcher.h
+++ b/include/sway/desktop/launcher.h
@@ -3,14 +3,18 @@
3 3
4#include <stdlib.h> 4#include <stdlib.h>
5#include <wayland-server-core.h> 5#include <wayland-server-core.h>
6#include "sway/input/seat.h"
6 7
7struct launcher_ctx { 8struct launcher_ctx {
8 pid_t pid; 9 pid_t pid;
9 char *fallback_name; 10 char *fallback_name;
10 struct wlr_xdg_activation_token_v1 *token; 11 struct wlr_xdg_activation_token_v1 *token;
11 struct wl_listener token_destroy; 12 struct wl_listener token_destroy;
13 struct sway_seat *seat;
14 struct wl_listener seat_destroy;
12 15
13 bool activated; 16 bool activated;
17 bool had_focused_surface;
14 18
15 struct sway_node *node; 19 struct sway_node *node;
16 struct wl_listener node_destroy; 20 struct wl_listener node_destroy;
diff --git a/include/sway/desktop/transaction.h b/include/sway/desktop/transaction.h
index 17d41fa3..dd7edb7a 100644
--- a/include/sway/desktop/transaction.h
+++ b/include/sway/desktop/transaction.h
@@ -2,6 +2,7 @@
2#define _SWAY_TRANSACTION_H 2#define _SWAY_TRANSACTION_H
3#include <stdint.h> 3#include <stdint.h>
4#include <stdbool.h> 4#include <stdbool.h>
5#include <wlr/types/wlr_scene.h>
5 6
6/** 7/**
7 * Transactions enable us to perform atomic layout updates. 8 * Transactions enable us to perform atomic layout updates.
@@ -58,4 +59,6 @@ bool transaction_notify_view_ready_by_serial(struct sway_view *view,
58bool transaction_notify_view_ready_by_geometry(struct sway_view *view, 59bool transaction_notify_view_ready_by_geometry(struct sway_view *view,
59 double x, double y, int width, int height); 60 double x, double y, int width, int height);
60 61
62void arrange_popups(struct wlr_scene_tree *popups);
63
61#endif 64#endif
diff --git a/include/sway/input/cursor.h b/include/sway/input/cursor.h
index 1e21c66f..527d0350 100644
--- a/include/sway/input/cursor.h
+++ b/include/sway/input/cursor.h
@@ -114,7 +114,7 @@ void pointer_motion(struct sway_cursor *cursor, uint32_t time_msec,
114 114
115void dispatch_cursor_button(struct sway_cursor *cursor, 115void dispatch_cursor_button(struct sway_cursor *cursor,
116 struct wlr_input_device *device, uint32_t time_msec, uint32_t button, 116 struct wlr_input_device *device, uint32_t time_msec, uint32_t button,
117 enum wlr_button_state state); 117 enum wl_pointer_button_state state);
118 118
119void dispatch_cursor_axis(struct sway_cursor *cursor, 119void dispatch_cursor_axis(struct sway_cursor *cursor,
120 struct wlr_pointer_axis_event *event); 120 struct wlr_pointer_axis_event *event);
diff --git a/include/sway/input/input-manager.h b/include/sway/input/input-manager.h
index 145edd4b..45c75199 100644
--- a/include/sway/input/input-manager.h
+++ b/include/sway/input/input-manager.h
@@ -4,6 +4,7 @@
4#include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h> 4#include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h>
5#include <wlr/types/wlr_virtual_keyboard_v1.h> 5#include <wlr/types/wlr_virtual_keyboard_v1.h>
6#include <wlr/types/wlr_virtual_pointer_v1.h> 6#include <wlr/types/wlr_virtual_pointer_v1.h>
7#include <wlr/types/wlr_transient_seat_v1.h>
7#include "sway/server.h" 8#include "sway/server.h"
8#include "sway/config.h" 9#include "sway/config.h"
9#include "list.h" 10#include "list.h"
@@ -24,6 +25,7 @@ struct sway_input_manager {
24 struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard; 25 struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard;
25 struct wlr_virtual_pointer_manager_v1 *virtual_pointer; 26 struct wlr_virtual_pointer_manager_v1 *virtual_pointer;
26 struct wlr_pointer_gestures_v1 *pointer_gestures; 27 struct wlr_pointer_gestures_v1 *pointer_gestures;
28 struct wlr_transient_seat_manager_v1 *transient_seat_manager;
27 29
28 struct wl_listener new_input; 30 struct wl_listener new_input;
29 struct wl_listener inhibit_activate; 31 struct wl_listener inhibit_activate;
@@ -31,6 +33,7 @@ struct sway_input_manager {
31 struct wl_listener keyboard_shortcuts_inhibit_new_inhibitor; 33 struct wl_listener keyboard_shortcuts_inhibit_new_inhibitor;
32 struct wl_listener virtual_keyboard_new; 34 struct wl_listener virtual_keyboard_new;
33 struct wl_listener virtual_pointer_new; 35 struct wl_listener virtual_pointer_new;
36 struct wl_listener transient_seat_create;
34}; 37};
35 38
36struct sway_input_manager *input_manager_create(struct sway_server *server); 39struct sway_input_manager *input_manager_create(struct sway_server *server);
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h
index e5aa8478..428f9679 100644
--- a/include/sway/input/seat.h
+++ b/include/sway/input/seat.h
@@ -17,7 +17,7 @@ struct sway_seat;
17struct sway_seatop_impl { 17struct sway_seatop_impl {
18 void (*button)(struct sway_seat *seat, uint32_t time_msec, 18 void (*button)(struct sway_seat *seat, uint32_t time_msec,
19 struct wlr_input_device *device, uint32_t button, 19 struct wlr_input_device *device, uint32_t button,
20 enum wlr_button_state state); 20 enum wl_pointer_button_state state);
21 void (*pointer_motion)(struct sway_seat *seat, uint32_t time_msec); 21 void (*pointer_motion)(struct sway_seat *seat, uint32_t time_msec);
22 void (*pointer_axis)(struct sway_seat *seat, 22 void (*pointer_axis)(struct sway_seat *seat,
23 struct wlr_pointer_axis_event *event); 23 struct wlr_pointer_axis_event *event);
@@ -124,6 +124,7 @@ struct sway_seat {
124 struct wl_listener start_drag; 124 struct wl_listener start_drag;
125 struct wl_listener request_set_selection; 125 struct wl_listener request_set_selection;
126 struct wl_listener request_set_primary_selection; 126 struct wl_listener request_set_primary_selection;
127 struct wl_listener destroy;
127 128
128 struct wl_list devices; // sway_seat_device::link 129 struct wl_list devices; // sway_seat_device::link
129 struct wl_list keyboard_groups; // sway_keyboard_group::link 130 struct wl_list keyboard_groups; // sway_keyboard_group::link
@@ -286,13 +287,13 @@ struct sway_container *seat_get_focus_inactive_floating(struct sway_seat *seat,
286 struct sway_workspace *workspace); 287 struct sway_workspace *workspace);
287 288
288void seat_pointer_notify_button(struct sway_seat *seat, uint32_t time_msec, 289void seat_pointer_notify_button(struct sway_seat *seat, uint32_t time_msec,
289 uint32_t button, enum wlr_button_state state); 290 uint32_t button, enum wl_pointer_button_state state);
290 291
291void seat_consider_warp_to_focus(struct sway_seat *seat); 292void seat_consider_warp_to_focus(struct sway_seat *seat);
292 293
293void seatop_button(struct sway_seat *seat, uint32_t time_msec, 294void seatop_button(struct sway_seat *seat, uint32_t time_msec,
294 struct wlr_input_device *device, uint32_t button, 295 struct wlr_input_device *device, uint32_t button,
295 enum wlr_button_state state); 296 enum wl_pointer_button_state state);
296 297
297void seatop_pointer_motion(struct sway_seat *seat, uint32_t time_msec); 298void seatop_pointer_motion(struct sway_seat *seat, uint32_t time_msec);
298 299
diff --git a/include/sway/input/text_input.h b/include/sway/input/text_input.h
index 214e61d1..1993f928 100644
--- a/include/sway/input/text_input.h
+++ b/include/sway/input/text_input.h
@@ -21,18 +21,21 @@ struct sway_input_method_relay {
21 struct sway_seat *seat; 21 struct sway_seat *seat;
22 22
23 struct wl_list text_inputs; // sway_text_input::link 23 struct wl_list text_inputs; // sway_text_input::link
24 struct wl_list input_popups; // sway_input_popup::link
24 struct wlr_input_method_v2 *input_method; // doesn't have to be present 25 struct wlr_input_method_v2 *input_method; // doesn't have to be present
25 26
26 struct wl_listener text_input_new; 27 struct wl_listener text_input_new;
27 28
28 struct wl_listener input_method_new; 29 struct wl_listener input_method_new;
29 struct wl_listener input_method_commit; 30 struct wl_listener input_method_commit;
31 struct wl_listener input_method_new_popup_surface;
30 struct wl_listener input_method_grab_keyboard; 32 struct wl_listener input_method_grab_keyboard;
31 struct wl_listener input_method_destroy; 33 struct wl_listener input_method_destroy;
32 34
33 struct wl_listener input_method_keyboard_grab_destroy; 35 struct wl_listener input_method_keyboard_grab_destroy;
34}; 36};
35 37
38
36struct sway_text_input { 39struct sway_text_input {
37 struct sway_input_method_relay *relay; 40 struct sway_input_method_relay *relay;
38 41
diff --git a/include/sway/input/text_input_popup.h b/include/sway/input/text_input_popup.h
new file mode 100644
index 00000000..e5f6ab8b
--- /dev/null
+++ b/include/sway/input/text_input_popup.h
@@ -0,0 +1,20 @@
1#ifndef _SWAY_INPUT_TEXT_INPUT_POPUP_H
2#define _SWAY_INPUT_TEXT_INPUT_POPUP_H
3
4#include "sway/tree/view.h"
5
6struct sway_input_popup {
7 struct sway_input_method_relay *relay;
8
9 struct wlr_scene_tree *scene_tree;
10 struct sway_popup_desc desc;
11 struct wlr_input_popup_surface_v2 *popup_surface;
12
13 struct wl_list link;
14
15 struct wl_listener popup_destroy;
16 struct wl_listener popup_surface_commit;
17
18 struct wl_listener focused_surface_unmap;
19};
20#endif
diff --git a/include/sway/layers.h b/include/sway/layers.h
index a7afb900..fd6384e0 100644
--- a/include/sway/layers.h
+++ b/include/sway/layers.h
@@ -3,6 +3,7 @@
3#include <stdbool.h> 3#include <stdbool.h>
4#include <wlr/types/wlr_compositor.h> 4#include <wlr/types/wlr_compositor.h>
5#include <wlr/types/wlr_layer_shell_v1.h> 5#include <wlr/types/wlr_layer_shell_v1.h>
6#include "sway/tree/view.h"
6 7
7struct sway_layer_surface { 8struct sway_layer_surface {
8 struct wl_listener map; 9 struct wl_listener map;
@@ -14,10 +15,12 @@ struct sway_layer_surface {
14 15
15 bool mapped; 16 bool mapped;
16 17
18 struct wlr_scene_tree *popups;
19 struct sway_popup_desc desc;
20
17 struct sway_output *output; 21 struct sway_output *output;
18 struct wlr_scene_layer_surface_v1 *scene; 22 struct wlr_scene_layer_surface_v1 *scene;
19 struct wlr_scene_tree *tree; 23 struct wlr_scene_tree *tree;
20 struct wlr_scene_tree *popups;
21 struct wlr_layer_surface_v1 *layer_surface; 24 struct wlr_layer_surface_v1 *layer_surface;
22}; 25};
23 26
diff --git a/include/sway/output.h b/include/sway/output.h
index 30595f54..d546d488 100644
--- a/include/sway/output.h
+++ b/include/sway/output.h
@@ -50,7 +50,7 @@ struct sway_output {
50 enum wl_output_subpixel detected_subpixel; 50 enum wl_output_subpixel detected_subpixel;
51 enum scale_filter_mode scale_filter; 51 enum scale_filter_mode scale_filter;
52 52
53 bool enabling, enabled; 53 bool enabled;
54 list_t *workspaces; 54 list_t *workspaces;
55 55
56 struct sway_output_state current; 56 struct sway_output_state current;
diff --git a/include/sway/server.h b/include/sway/server.h
index adb62cda..c71851f6 100644
--- a/include/sway/server.h
+++ b/include/sway/server.h
@@ -2,23 +2,6 @@
2#define _SWAY_SERVER_H 2#define _SWAY_SERVER_H
3#include <stdbool.h> 3#include <stdbool.h>
4#include <wayland-server-core.h> 4#include <wayland-server-core.h>
5#include <wlr/backend.h>
6#include <wlr/render/allocator.h>
7#include <wlr/render/wlr_renderer.h>
8#include <wlr/types/wlr_compositor.h>
9#include <wlr/types/wlr_data_device.h>
10#include <wlr/types/wlr_input_method_v2.h>
11#include <wlr/types/wlr_foreign_toplevel_management_v1.h>
12#include <wlr/types/wlr_drm_lease_v1.h>
13#include <wlr/types/wlr_layer_shell_v1.h>
14#include <wlr/types/wlr_output_management_v1.h>
15#include <wlr/types/wlr_output_power_management_v1.h>
16#include <wlr/types/wlr_presentation_time.h>
17#include <wlr/types/wlr_relative_pointer_v1.h>
18#include <wlr/types/wlr_session_lock_v1.h>
19#include <wlr/types/wlr_server_decoration.h>
20#include <wlr/types/wlr_text_input_v3.h>
21#include <wlr/types/wlr_xdg_shell.h>
22#include "config.h" 5#include "config.h"
23#include "list.h" 6#include "list.h"
24#include "sway/desktop/idle_inhibit_v1.h" 7#include "sway/desktop/idle_inhibit_v1.h"
@@ -63,6 +46,7 @@ struct sway_server {
63 46
64 struct wl_listener new_output; 47 struct wl_listener new_output;
65 struct wl_listener output_layout_change; 48 struct wl_listener output_layout_change;
49 struct wl_listener renderer_lost;
66 50
67 struct wlr_idle_notifier_v1 *idle_notifier_v1; 51 struct wlr_idle_notifier_v1 *idle_notifier_v1;
68 struct sway_idle_inhibit_manager_v1 idle_inhibit_manager_v1; 52 struct sway_idle_inhibit_manager_v1 idle_inhibit_manager_v1;
@@ -116,6 +100,7 @@ struct sway_server {
116 struct wl_listener output_power_manager_set_mode; 100 struct wl_listener output_power_manager_set_mode;
117 struct wlr_input_method_manager_v2 *input_method; 101 struct wlr_input_method_manager_v2 *input_method;
118 struct wlr_text_input_manager_v3 *text_input; 102 struct wlr_text_input_manager_v3 *text_input;
103 struct wlr_ext_foreign_toplevel_list_v1 *foreign_toplevel_list;
119 struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager; 104 struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager;
120 struct wlr_content_type_manager_v1 *content_type_manager_v1; 105 struct wlr_content_type_manager_v1 *content_type_manager_v1;
121 struct wlr_data_control_manager_v1 *data_control_manager_v1; 106 struct wlr_data_control_manager_v1 *data_control_manager_v1;
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h
index 3e5a9bfe..7faacdcc 100644
--- a/include/sway/tree/view.h
+++ b/include/sway/tree/view.h
@@ -84,6 +84,8 @@ struct sway_view {
84 // transaction state. Updated on every commit. 84 // transaction state. Updated on every commit.
85 struct wlr_box geometry; 85 struct wlr_box geometry;
86 86
87 struct wlr_ext_foreign_toplevel_handle_v1 *ext_foreign_toplevel;
88
87 struct wlr_foreign_toplevel_handle_v1 *foreign_toplevel; 89 struct wlr_foreign_toplevel_handle_v1 *foreign_toplevel;
88 struct wl_listener foreign_activate_request; 90 struct wl_listener foreign_activate_request;
89 struct wl_listener foreign_fullscreen_request; 91 struct wl_listener foreign_fullscreen_request;
@@ -174,6 +176,11 @@ struct sway_xwayland_unmanaged {
174}; 176};
175#endif 177#endif
176 178
179struct sway_popup_desc {
180 struct wlr_scene_node *relative;
181 struct sway_view *view;
182};
183
177struct sway_xdg_popup { 184struct sway_xdg_popup {
178 struct sway_view *view; 185 struct sway_view *view;
179 186
@@ -181,8 +188,11 @@ struct sway_xdg_popup {
181 struct wlr_scene_tree *xdg_surface_tree; 188 struct wlr_scene_tree *xdg_surface_tree;
182 struct wlr_xdg_popup *wlr_xdg_popup; 189 struct wlr_xdg_popup *wlr_xdg_popup;
183 190
191 struct sway_popup_desc desc;
192
184 struct wl_listener surface_commit; 193 struct wl_listener surface_commit;
185 struct wl_listener new_popup; 194 struct wl_listener new_popup;
195 struct wl_listener reposition;
186 struct wl_listener destroy; 196 struct wl_listener destroy;
187}; 197};
188 198
@@ -233,6 +243,11 @@ void view_set_activated(struct sway_view *view, bool activated);
233 */ 243 */
234void view_request_activate(struct sway_view *view, struct sway_seat *seat); 244void view_request_activate(struct sway_view *view, struct sway_seat *seat);
235 245
246/*
247 * Called when the view requests urgent state
248 */
249void view_request_urgent(struct sway_view *view);
250
236/** 251/**
237 * If possible, instructs the client to change their decoration mode. 252 * If possible, instructs the client to change their decoration mode.
238 */ 253 */
@@ -284,6 +299,8 @@ struct sway_view *view_from_wlr_xwayland_surface(
284#endif 299#endif
285struct sway_view *view_from_wlr_surface(struct wlr_surface *surface); 300struct sway_view *view_from_wlr_surface(struct wlr_surface *surface);
286 301
302void view_update_app_id(struct sway_view *view);
303
287/** 304/**
288 * Re-read the view's title property and update any relevant title bars. 305 * Re-read the view's title property and update any relevant title bars.
289 * The force argument makes it recreate the title bars even if the title hasn't 306 * The force argument makes it recreate the title bars even if the title hasn't