diff options
Diffstat (limited to 'include')
43 files changed, 685 insertions, 430 deletions
diff --git a/include/background-image.h b/include/background-image.h deleted file mode 100644 index a97ef375..00000000 --- a/include/background-image.h +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | #ifndef _SWAY_BACKGROUND_IMAGE_H | ||
2 | #define _SWAY_BACKGROUND_IMAGE_H | ||
3 | #include "cairo_util.h" | ||
4 | |||
5 | enum background_mode { | ||
6 | BACKGROUND_MODE_STRETCH, | ||
7 | BACKGROUND_MODE_FILL, | ||
8 | BACKGROUND_MODE_FIT, | ||
9 | BACKGROUND_MODE_CENTER, | ||
10 | BACKGROUND_MODE_TILE, | ||
11 | BACKGROUND_MODE_SOLID_COLOR, | ||
12 | BACKGROUND_MODE_INVALID, | ||
13 | }; | ||
14 | |||
15 | enum background_mode parse_background_mode(const char *mode); | ||
16 | cairo_surface_t *load_background_image(const char *path); | ||
17 | void render_background_image(cairo_t *cairo, cairo_surface_t *image, | ||
18 | enum background_mode mode, int buffer_width, int buffer_height); | ||
19 | |||
20 | #endif | ||
diff --git a/include/gesture.h b/include/gesture.h new file mode 100644 index 00000000..9c6b0f91 --- /dev/null +++ b/include/gesture.h | |||
@@ -0,0 +1,104 @@ | |||
1 | #ifndef _SWAY_GESTURE_H | ||
2 | #define _SWAY_GESTURE_H | ||
3 | |||
4 | #include <stdbool.h> | ||
5 | #include <stdint.h> | ||
6 | |||
7 | /** | ||
8 | * A gesture type used in binding. | ||
9 | */ | ||
10 | enum gesture_type { | ||
11 | GESTURE_TYPE_NONE = 0, | ||
12 | GESTURE_TYPE_HOLD, | ||
13 | GESTURE_TYPE_PINCH, | ||
14 | GESTURE_TYPE_SWIPE, | ||
15 | }; | ||
16 | |||
17 | // Turns single type enum value to constant string representation. | ||
18 | const char *gesture_type_string(enum gesture_type direction); | ||
19 | |||
20 | // Value to use to accept any finger count | ||
21 | extern const uint8_t GESTURE_FINGERS_ANY; | ||
22 | |||
23 | /** | ||
24 | * A gesture direction used in binding. | ||
25 | */ | ||
26 | enum gesture_direction { | ||
27 | GESTURE_DIRECTION_NONE = 0, | ||
28 | // Directions based on delta x and y | ||
29 | GESTURE_DIRECTION_UP = 1 << 0, | ||
30 | GESTURE_DIRECTION_DOWN = 1 << 1, | ||
31 | GESTURE_DIRECTION_LEFT = 1 << 2, | ||
32 | GESTURE_DIRECTION_RIGHT = 1 << 3, | ||
33 | // Directions based on scale | ||
34 | GESTURE_DIRECTION_INWARD = 1 << 4, | ||
35 | GESTURE_DIRECTION_OUTWARD = 1 << 5, | ||
36 | // Directions based on rotation | ||
37 | GESTURE_DIRECTION_CLOCKWISE = 1 << 6, | ||
38 | GESTURE_DIRECTION_COUNTERCLOCKWISE = 1 << 7, | ||
39 | }; | ||
40 | |||
41 | // Turns single direction enum value to constant string representation. | ||
42 | const char *gesture_direction_string(enum gesture_direction direction); | ||
43 | |||
44 | /** | ||
45 | * Struct representing a pointer gesture | ||
46 | */ | ||
47 | struct gesture { | ||
48 | enum gesture_type type; | ||
49 | uint8_t fingers; | ||
50 | uint32_t directions; | ||
51 | }; | ||
52 | |||
53 | /** | ||
54 | * Parses gesture from <gesture>[:<fingers>][:<directions>] string. | ||
55 | * | ||
56 | * Return NULL on success, otherwise error message string | ||
57 | */ | ||
58 | char *gesture_parse(const char *input, struct gesture *output); | ||
59 | |||
60 | // Turns gesture into string representation | ||
61 | char *gesture_to_string(struct gesture *gesture); | ||
62 | |||
63 | // Check if gesture is of certain type and finger count. | ||
64 | bool gesture_check(struct gesture *target, | ||
65 | enum gesture_type type, uint8_t fingers); | ||
66 | |||
67 | // Check if a gesture target/binding is match by other gesture/input | ||
68 | bool gesture_match(struct gesture *target, | ||
69 | struct gesture *to_match, bool exact); | ||
70 | |||
71 | // Returns true if gesture are exactly the same | ||
72 | bool gesture_equal(struct gesture *a, struct gesture *b); | ||
73 | |||
74 | // Compare distance between two matched target gestures. | ||
75 | int8_t gesture_compare(struct gesture *a, struct gesture *b); | ||
76 | |||
77 | // Small helper struct to track gestures over time | ||
78 | struct gesture_tracker { | ||
79 | enum gesture_type type; | ||
80 | uint8_t fingers; | ||
81 | double dx, dy; | ||
82 | double scale; | ||
83 | double rotation; | ||
84 | }; | ||
85 | |||
86 | // Begin gesture tracking | ||
87 | void gesture_tracker_begin(struct gesture_tracker *tracker, | ||
88 | enum gesture_type type, uint8_t fingers); | ||
89 | |||
90 | // Check if the provides type is currently being tracked | ||
91 | bool gesture_tracker_check(struct gesture_tracker *tracker, | ||
92 | enum gesture_type type); | ||
93 | |||
94 | // Update gesture track with new data point | ||
95 | void gesture_tracker_update(struct gesture_tracker *tracker, double dx, | ||
96 | double dy, double scale, double rotation); | ||
97 | |||
98 | // Reset tracker | ||
99 | void gesture_tracker_cancel(struct gesture_tracker *tracker); | ||
100 | |||
101 | // Reset tracker and return gesture tracked | ||
102 | struct gesture *gesture_tracker_end(struct gesture_tracker *tracker); | ||
103 | |||
104 | #endif | ||
diff --git a/include/pango.h b/include/pango.h index 93affc23..228e39cf 100644 --- a/include/pango.h +++ b/include/pango.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <stdint.h> | 5 | #include <stdint.h> |
6 | #include <cairo.h> | 6 | #include <cairo.h> |
7 | #include <pango/pangocairo.h> | 7 | #include <pango/pangocairo.h> |
8 | #include "stringop.h" | ||
8 | 9 | ||
9 | /** | 10 | /** |
10 | * Utility function which escape characters a & < > ' ". | 11 | * Utility function which escape characters a & < > ' ". |
@@ -13,12 +14,12 @@ | |||
13 | * escaped string to dest if provided. | 14 | * escaped string to dest if provided. |
14 | */ | 15 | */ |
15 | size_t escape_markup_text(const char *src, char *dest); | 16 | size_t escape_markup_text(const char *src, char *dest); |
16 | PangoLayout *get_pango_layout(cairo_t *cairo, const char *font, | 17 | PangoLayout *get_pango_layout(cairo_t *cairo, const PangoFontDescription *desc, |
17 | const char *text, double scale, bool markup); | 18 | const char *text, double scale, bool markup); |
18 | void get_text_size(cairo_t *cairo, const char *font, int *width, int *height, | 19 | void get_text_size(cairo_t *cairo, const PangoFontDescription *desc, int *width, int *height, |
19 | int *baseline, double scale, bool markup, const char *fmt, ...); | 20 | int *baseline, double scale, bool markup, const char *fmt, ...) _SWAY_ATTRIB_PRINTF(8, 9); |
20 | void get_text_metrics(const char *font, int *height, int *baseline); | 21 | void get_text_metrics(const PangoFontDescription *desc, int *height, int *baseline); |
21 | void render_text(cairo_t *cairo, const char *font, | 22 | void render_text(cairo_t *cairo, PangoFontDescription *desc, |
22 | double scale, bool markup, const char *fmt, ...); | 23 | double scale, bool markup, const char *fmt, ...) _SWAY_ATTRIB_PRINTF(5, 6); |
23 | 24 | ||
24 | #endif | 25 | #endif |
diff --git a/include/stringop.h b/include/stringop.h index 8d7089e9..19a50f23 100644 --- a/include/stringop.h +++ b/include/stringop.h | |||
@@ -2,8 +2,15 @@ | |||
2 | #define _SWAY_STRINGOP_H | 2 | #define _SWAY_STRINGOP_H |
3 | 3 | ||
4 | #include <stdbool.h> | 4 | #include <stdbool.h> |
5 | #include <stddef.h> | ||
5 | #include "list.h" | 6 | #include "list.h" |
6 | 7 | ||
8 | #ifdef __GNUC__ | ||
9 | #define _SWAY_ATTRIB_PRINTF(start, end) __attribute__((format(printf, start, end))) | ||
10 | #else | ||
11 | #define _SWAY_ATTRIB_PRINTF(start, end) | ||
12 | #endif | ||
13 | |||
7 | void strip_whitespace(char *str); | 14 | void strip_whitespace(char *str); |
8 | void strip_quotes(char *str); | 15 | void strip_quotes(char *str); |
9 | 16 | ||
@@ -30,4 +37,7 @@ char *argsep(char **stringp, const char *delim, char *matched_delim); | |||
30 | // Expand a path using shell replacements such as $HOME and ~ | 37 | // Expand a path using shell replacements such as $HOME and ~ |
31 | bool expand_path(char **path); | 38 | bool expand_path(char **path); |
32 | 39 | ||
40 | char *vformat_str(const char *fmt, va_list args) _SWAY_ATTRIB_PRINTF(1, 0); | ||
41 | char *format_str(const char *fmt, ...) _SWAY_ATTRIB_PRINTF(1, 2); | ||
42 | |||
33 | #endif | 43 | #endif |
diff --git a/include/sway/commands.h b/include/sway/commands.h index 2746ef28..27058587 100644 --- a/include/sway/commands.h +++ b/include/sway/commands.h | |||
@@ -3,13 +3,14 @@ | |||
3 | 3 | ||
4 | #include <wlr/util/edges.h> | 4 | #include <wlr/util/edges.h> |
5 | #include "config.h" | 5 | #include "config.h" |
6 | #include "stringop.h" | ||
6 | 7 | ||
7 | struct sway_container; | 8 | struct sway_container; |
8 | 9 | ||
9 | typedef struct cmd_results *sway_cmd(int argc, char **argv); | 10 | typedef struct cmd_results *sway_cmd(int argc, char **argv); |
10 | 11 | ||
11 | struct cmd_handler { | 12 | struct cmd_handler { |
12 | char *command; | 13 | const char *command; |
13 | sway_cmd *handle; | 14 | sway_cmd *handle; |
14 | }; | 15 | }; |
15 | 16 | ||
@@ -46,7 +47,7 @@ enum expected_args { | |||
46 | struct cmd_results *checkarg(int argc, const char *name, | 47 | struct cmd_results *checkarg(int argc, const char *name, |
47 | enum expected_args type, int val); | 48 | enum expected_args type, int val); |
48 | 49 | ||
49 | const struct cmd_handler *find_handler(char *line, | 50 | const struct cmd_handler *find_handler(const char *line, |
50 | const struct cmd_handler *cmd_handlers, size_t handlers_size); | 51 | const struct cmd_handler *cmd_handlers, size_t handlers_size); |
51 | 52 | ||
52 | /** | 53 | /** |
@@ -76,7 +77,7 @@ struct cmd_results *config_commands_command(char *exec); | |||
76 | /** | 77 | /** |
77 | * Allocates a cmd_results object. | 78 | * Allocates a cmd_results object. |
78 | */ | 79 | */ |
79 | struct cmd_results *cmd_results_new(enum cmd_status status, const char *error, ...); | 80 | struct cmd_results *cmd_results_new(enum cmd_status status, const char *error, ...) _SWAY_ATTRIB_PRINTF(2, 3); |
80 | /** | 81 | /** |
81 | * Frees a cmd_results object. | 82 | * Frees a cmd_results object. |
82 | */ | 83 | */ |
@@ -106,6 +107,7 @@ sway_cmd cmd_exec_process; | |||
106 | sway_cmd cmd_assign; | 107 | sway_cmd cmd_assign; |
107 | sway_cmd cmd_bar; | 108 | sway_cmd cmd_bar; |
108 | sway_cmd cmd_bindcode; | 109 | sway_cmd cmd_bindcode; |
110 | sway_cmd cmd_bindgesture; | ||
109 | sway_cmd cmd_bindswitch; | 111 | sway_cmd cmd_bindswitch; |
110 | sway_cmd cmd_bindsym; | 112 | sway_cmd cmd_bindsym; |
111 | sway_cmd cmd_border; | 113 | sway_cmd cmd_border; |
@@ -158,12 +160,11 @@ sway_cmd cmd_new_float; | |||
158 | sway_cmd cmd_new_window; | 160 | sway_cmd cmd_new_window; |
159 | sway_cmd cmd_nop; | 161 | sway_cmd cmd_nop; |
160 | sway_cmd cmd_opacity; | 162 | sway_cmd cmd_opacity; |
161 | sway_cmd cmd_new_float; | ||
162 | sway_cmd cmd_new_window; | ||
163 | sway_cmd cmd_no_focus; | 163 | sway_cmd cmd_no_focus; |
164 | sway_cmd cmd_output; | 164 | sway_cmd cmd_output; |
165 | sway_cmd cmd_permit; | 165 | sway_cmd cmd_permit; |
166 | sway_cmd cmd_popup_during_fullscreen; | 166 | sway_cmd cmd_popup_during_fullscreen; |
167 | sway_cmd cmd_primary_selection; | ||
167 | sway_cmd cmd_reject; | 168 | sway_cmd cmd_reject; |
168 | sway_cmd cmd_reload; | 169 | sway_cmd cmd_reload; |
169 | sway_cmd cmd_rename; | 170 | sway_cmd cmd_rename; |
@@ -191,6 +192,7 @@ sway_cmd cmd_titlebar_border_thickness; | |||
191 | sway_cmd cmd_titlebar_padding; | 192 | sway_cmd cmd_titlebar_padding; |
192 | sway_cmd cmd_unbindcode; | 193 | sway_cmd cmd_unbindcode; |
193 | sway_cmd cmd_unbindswitch; | 194 | sway_cmd cmd_unbindswitch; |
195 | sway_cmd cmd_unbindgesture; | ||
194 | sway_cmd cmd_unbindsym; | 196 | sway_cmd cmd_unbindsym; |
195 | sway_cmd cmd_unmark; | 197 | sway_cmd cmd_unmark; |
196 | sway_cmd cmd_urgent; | 198 | sway_cmd cmd_urgent; |
@@ -250,6 +252,7 @@ sway_cmd input_cmd_click_method; | |||
250 | sway_cmd input_cmd_drag; | 252 | sway_cmd input_cmd_drag; |
251 | sway_cmd input_cmd_drag_lock; | 253 | sway_cmd input_cmd_drag_lock; |
252 | sway_cmd input_cmd_dwt; | 254 | sway_cmd input_cmd_dwt; |
255 | sway_cmd input_cmd_dwtp; | ||
253 | sway_cmd input_cmd_events; | 256 | sway_cmd input_cmd_events; |
254 | sway_cmd input_cmd_left_handed; | 257 | sway_cmd input_cmd_left_handed; |
255 | sway_cmd input_cmd_map_from_region; | 258 | sway_cmd input_cmd_map_from_region; |
@@ -258,10 +261,12 @@ sway_cmd input_cmd_map_to_region; | |||
258 | sway_cmd input_cmd_middle_emulation; | 261 | sway_cmd input_cmd_middle_emulation; |
259 | sway_cmd input_cmd_natural_scroll; | 262 | sway_cmd input_cmd_natural_scroll; |
260 | sway_cmd input_cmd_pointer_accel; | 263 | sway_cmd input_cmd_pointer_accel; |
264 | sway_cmd input_cmd_rotation_angle; | ||
261 | sway_cmd input_cmd_scroll_factor; | 265 | sway_cmd input_cmd_scroll_factor; |
262 | sway_cmd input_cmd_repeat_delay; | 266 | sway_cmd input_cmd_repeat_delay; |
263 | sway_cmd input_cmd_repeat_rate; | 267 | sway_cmd input_cmd_repeat_rate; |
264 | sway_cmd input_cmd_scroll_button; | 268 | sway_cmd input_cmd_scroll_button; |
269 | sway_cmd input_cmd_scroll_button_lock; | ||
265 | sway_cmd input_cmd_scroll_method; | 270 | sway_cmd input_cmd_scroll_method; |
266 | sway_cmd input_cmd_tap; | 271 | sway_cmd input_cmd_tap; |
267 | sway_cmd input_cmd_tap_button_map; | 272 | sway_cmd input_cmd_tap_button_map; |
@@ -285,12 +290,14 @@ sway_cmd output_cmd_max_render_time; | |||
285 | sway_cmd output_cmd_mode; | 290 | sway_cmd output_cmd_mode; |
286 | sway_cmd output_cmd_modeline; | 291 | sway_cmd output_cmd_modeline; |
287 | sway_cmd output_cmd_position; | 292 | sway_cmd output_cmd_position; |
293 | sway_cmd output_cmd_power; | ||
288 | sway_cmd output_cmd_render_bit_depth; | 294 | sway_cmd output_cmd_render_bit_depth; |
289 | sway_cmd output_cmd_scale; | 295 | sway_cmd output_cmd_scale; |
290 | sway_cmd output_cmd_scale_filter; | 296 | sway_cmd output_cmd_scale_filter; |
291 | sway_cmd output_cmd_subpixel; | 297 | sway_cmd output_cmd_subpixel; |
292 | sway_cmd output_cmd_toggle; | 298 | sway_cmd output_cmd_toggle; |
293 | sway_cmd output_cmd_transform; | 299 | sway_cmd output_cmd_transform; |
300 | sway_cmd output_cmd_unplug; | ||
294 | 301 | ||
295 | sway_cmd seat_cmd_attach; | 302 | sway_cmd seat_cmd_attach; |
296 | sway_cmd seat_cmd_cursor; | 303 | sway_cmd seat_cmd_cursor; |
diff --git a/include/sway/config.h b/include/sway/config.h index 2e24c3ae..f9da1967 100644 --- a/include/sway/config.h +++ b/include/sway/config.h | |||
@@ -10,12 +10,15 @@ | |||
10 | #include <xkbcommon/xkbcommon.h> | 10 | #include <xkbcommon/xkbcommon.h> |
11 | #include <xf86drmMode.h> | 11 | #include <xf86drmMode.h> |
12 | #include "../include/config.h" | 12 | #include "../include/config.h" |
13 | #include "gesture.h" | ||
13 | #include "list.h" | 14 | #include "list.h" |
15 | #include "stringop.h" | ||
14 | #include "swaynag.h" | 16 | #include "swaynag.h" |
15 | #include "tree/container.h" | 17 | #include "tree/container.h" |
16 | #include "sway/input/tablet.h" | 18 | #include "sway/input/tablet.h" |
17 | #include "sway/tree/root.h" | 19 | #include "sway/tree/root.h" |
18 | #include "wlr-layer-shell-unstable-v1-protocol.h" | 20 | #include "wlr-layer-shell-unstable-v1-protocol.h" |
21 | #include <pango/pangocairo.h> | ||
19 | 22 | ||
20 | // TODO: Refactor this shit | 23 | // TODO: Refactor this shit |
21 | 24 | ||
@@ -32,7 +35,8 @@ enum binding_input_type { | |||
32 | BINDING_KEYSYM, | 35 | BINDING_KEYSYM, |
33 | BINDING_MOUSECODE, | 36 | BINDING_MOUSECODE, |
34 | BINDING_MOUSESYM, | 37 | BINDING_MOUSESYM, |
35 | BINDING_SWITCH | 38 | BINDING_SWITCH, // dummy, only used to call seat_execute_command |
39 | BINDING_GESTURE // dummy, only used to call seat_execute_command | ||
36 | }; | 40 | }; |
37 | 41 | ||
38 | enum binding_flags { | 42 | enum binding_flags { |
@@ -45,6 +49,7 @@ enum binding_flags { | |||
45 | BINDING_RELOAD = 1 << 6, // switch only; (re)trigger binding on reload | 49 | BINDING_RELOAD = 1 << 6, // switch only; (re)trigger binding on reload |
46 | BINDING_INHIBITED = 1 << 7, // keyboard only: ignore shortcut inhibitor | 50 | BINDING_INHIBITED = 1 << 7, // keyboard only: ignore shortcut inhibitor |
47 | BINDING_NOREPEAT = 1 << 8, // keyboard only; do not trigger when repeating a held key | 51 | BINDING_NOREPEAT = 1 << 8, // keyboard only; do not trigger when repeating a held key |
52 | BINDING_EXACT = 1 << 9, // gesture only; only trigger on exact match | ||
48 | }; | 53 | }; |
49 | 54 | ||
50 | /** | 55 | /** |
@@ -79,6 +84,16 @@ struct sway_switch_binding { | |||
79 | }; | 84 | }; |
80 | 85 | ||
81 | /** | 86 | /** |
87 | * A gesture binding and an associated command. | ||
88 | */ | ||
89 | struct sway_gesture_binding { | ||
90 | char *input; | ||
91 | uint32_t flags; | ||
92 | struct gesture gesture; | ||
93 | char *command; | ||
94 | }; | ||
95 | |||
96 | /** | ||
82 | * Focus on window activation. | 97 | * Focus on window activation. |
83 | */ | 98 | */ |
84 | enum sway_fowa { | 99 | enum sway_fowa { |
@@ -97,6 +112,7 @@ struct sway_mode { | |||
97 | list_t *keycode_bindings; | 112 | list_t *keycode_bindings; |
98 | list_t *mouse_bindings; | 113 | list_t *mouse_bindings; |
99 | list_t *switch_bindings; | 114 | list_t *switch_bindings; |
115 | list_t *gesture_bindings; | ||
100 | bool pango; | 116 | bool pango; |
101 | }; | 117 | }; |
102 | 118 | ||
@@ -135,14 +151,17 @@ struct input_config { | |||
135 | int drag; | 151 | int drag; |
136 | int drag_lock; | 152 | int drag_lock; |
137 | int dwt; | 153 | int dwt; |
154 | int dwtp; | ||
138 | int left_handed; | 155 | int left_handed; |
139 | int middle_emulation; | 156 | int middle_emulation; |
140 | int natural_scroll; | 157 | int natural_scroll; |
141 | float pointer_accel; | 158 | float pointer_accel; |
159 | float rotation_angle; | ||
142 | float scroll_factor; | 160 | float scroll_factor; |
143 | int repeat_delay; | 161 | int repeat_delay; |
144 | int repeat_rate; | 162 | int repeat_rate; |
145 | int scroll_button; | 163 | int scroll_button; |
164 | int scroll_button_lock; | ||
146 | int scroll_method; | 165 | int scroll_method; |
147 | int send_events; | 166 | int send_events; |
148 | int tap; | 167 | int tap; |
@@ -232,12 +251,6 @@ struct seat_config { | |||
232 | } xcursor_theme; | 251 | } xcursor_theme; |
233 | }; | 252 | }; |
234 | 253 | ||
235 | enum config_dpms { | ||
236 | DPMS_IGNORE, | ||
237 | DPMS_ON, | ||
238 | DPMS_OFF, | ||
239 | }; | ||
240 | |||
241 | enum scale_filter_mode { | 254 | enum scale_filter_mode { |
242 | SCALE_FILTER_DEFAULT, // the default is currently smart | 255 | SCALE_FILTER_DEFAULT, // the default is currently smart |
243 | SCALE_FILTER_LINEAR, | 256 | SCALE_FILTER_LINEAR, |
@@ -259,6 +272,7 @@ enum render_bit_depth { | |||
259 | struct output_config { | 272 | struct output_config { |
260 | char *name; | 273 | char *name; |
261 | int enabled; | 274 | int enabled; |
275 | int power; | ||
262 | int width, height; | 276 | int width, height; |
263 | float refresh_rate; | 277 | float refresh_rate; |
264 | int custom_mode; | 278 | int custom_mode; |
@@ -275,7 +289,6 @@ struct output_config { | |||
275 | char *background; | 289 | char *background; |
276 | char *background_option; | 290 | char *background_option; |
277 | char *background_fallback; | 291 | char *background_fallback; |
278 | enum config_dpms dpms_state; | ||
279 | }; | 292 | }; |
280 | 293 | ||
281 | /** | 294 | /** |
@@ -490,7 +503,8 @@ struct sway_config { | |||
490 | char *floating_scroll_right_cmd; | 503 | char *floating_scroll_right_cmd; |
491 | enum sway_container_layout default_orientation; | 504 | enum sway_container_layout default_orientation; |
492 | enum sway_container_layout default_layout; | 505 | enum sway_container_layout default_layout; |
493 | char *font; | 506 | char *font; // Used for IPC. |
507 | PangoFontDescription *font_description; // Used internally for rendering and validating. | ||
494 | int font_height; | 508 | int font_height; |
495 | int font_baseline; | 509 | int font_baseline; |
496 | bool pango_markup; | 510 | bool pango_markup; |
@@ -519,6 +533,7 @@ struct sway_config { | |||
519 | bool auto_back_and_forth; | 533 | bool auto_back_and_forth; |
520 | bool show_marks; | 534 | bool show_marks; |
521 | enum alignment title_align; | 535 | enum alignment title_align; |
536 | bool primary_selection; | ||
522 | 537 | ||
523 | bool tiling_drag; | 538 | bool tiling_drag; |
524 | int tiling_drag_threshold; | 539 | int tiling_drag_threshold; |
@@ -612,7 +627,7 @@ void run_deferred_bindings(void); | |||
612 | /** | 627 | /** |
613 | * Adds a warning entry to the swaynag instance used for errors. | 628 | * Adds a warning entry to the swaynag instance used for errors. |
614 | */ | 629 | */ |
615 | void config_add_swaynag_warning(char *fmt, ...); | 630 | void config_add_swaynag_warning(char *fmt, ...) _SWAY_ATTRIB_PRINTF(1, 2); |
616 | 631 | ||
617 | /** | 632 | /** |
618 | * Free config struct | 633 | * Free config struct |
@@ -689,6 +704,8 @@ void free_sway_binding(struct sway_binding *sb); | |||
689 | 704 | ||
690 | void free_switch_binding(struct sway_switch_binding *binding); | 705 | void free_switch_binding(struct sway_switch_binding *binding); |
691 | 706 | ||
707 | void free_gesture_binding(struct sway_gesture_binding *binding); | ||
708 | |||
692 | void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding); | 709 | void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding); |
693 | 710 | ||
694 | void load_swaybar(struct bar_config *bar); | 711 | void load_swaybar(struct bar_config *bar); |
@@ -706,7 +723,7 @@ void free_workspace_config(struct workspace_config *wsc); | |||
706 | /** | 723 | /** |
707 | * Updates the value of config->font_height based on the metrics for title's | 724 | * Updates the value of config->font_height based on the metrics for title's |
708 | * font as reported by pango. | 725 | * font as reported by pango. |
709 | * | 726 | * |
710 | * If the height has changed, all containers will be rearranged to take on the | 727 | * If the height has changed, all containers will be rearranged to take on the |
711 | * new size. | 728 | * new size. |
712 | */ | 729 | */ |
diff --git a/include/sway/criteria.h b/include/sway/criteria.h index 59f57f94..8da345ea 100644 --- a/include/sway/criteria.h +++ b/include/sway/criteria.h | |||
@@ -43,6 +43,7 @@ struct criteria { | |||
43 | struct pattern *window_role; | 43 | struct pattern *window_role; |
44 | enum atom_name window_type; | 44 | enum atom_name window_type; |
45 | #endif | 45 | #endif |
46 | bool all; | ||
46 | bool floating; | 47 | bool floating; |
47 | bool tiling; | 48 | bool tiling; |
48 | char urgent; // 'l' for latest or 'o' for oldest | 49 | char urgent; // 'l' for latest or 'o' for oldest |
diff --git a/include/sway/desktop.h b/include/sway/desktop.h deleted file mode 100644 index 7f2f5b3e..00000000 --- a/include/sway/desktop.h +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | #include <wlr/types/wlr_compositor.h> | ||
2 | |||
3 | struct sway_container; | ||
4 | struct sway_view; | ||
5 | |||
6 | void desktop_damage_surface(struct wlr_surface *surface, double lx, double ly, | ||
7 | bool whole); | ||
8 | |||
9 | void desktop_damage_whole_container(struct sway_container *con); | ||
10 | |||
11 | void desktop_damage_box(struct wlr_box *box); | ||
12 | |||
13 | void desktop_damage_view(struct sway_view *view); | ||
diff --git a/include/sway/desktop/idle_inhibit_v1.h b/include/sway/desktop/idle_inhibit_v1.h index 58d54c68..84cc666d 100644 --- a/include/sway/desktop/idle_inhibit_v1.h +++ b/include/sway/desktop/idle_inhibit_v1.h | |||
@@ -1,8 +1,6 @@ | |||
1 | #ifndef _SWAY_DESKTOP_IDLE_INHIBIT_V1_H | 1 | #ifndef _SWAY_DESKTOP_IDLE_INHIBIT_V1_H |
2 | #define _SWAY_DESKTOP_IDLE_INHIBIT_V1_H | 2 | #define _SWAY_DESKTOP_IDLE_INHIBIT_V1_H |
3 | #include <wlr/types/wlr_idle_inhibit_v1.h> | 3 | #include <wlr/types/wlr_idle_inhibit_v1.h> |
4 | #include <wlr/types/wlr_idle.h> | ||
5 | #include "sway/server.h" | ||
6 | 4 | ||
7 | enum sway_idle_inhibit_mode { | 5 | enum sway_idle_inhibit_mode { |
8 | INHIBIT_IDLE_APPLICATION, // Application set inhibitor (when visible) | 6 | INHIBIT_IDLE_APPLICATION, // Application set inhibitor (when visible) |
@@ -16,12 +14,9 @@ struct sway_idle_inhibit_manager_v1 { | |||
16 | struct wlr_idle_inhibit_manager_v1 *wlr_manager; | 14 | struct wlr_idle_inhibit_manager_v1 *wlr_manager; |
17 | struct wl_listener new_idle_inhibitor_v1; | 15 | struct wl_listener new_idle_inhibitor_v1; |
18 | struct wl_list inhibitors; | 16 | struct wl_list inhibitors; |
19 | |||
20 | struct wlr_idle *idle; | ||
21 | }; | 17 | }; |
22 | 18 | ||
23 | struct sway_idle_inhibitor_v1 { | 19 | struct sway_idle_inhibitor_v1 { |
24 | struct sway_idle_inhibit_manager_v1 *manager; | ||
25 | struct wlr_idle_inhibitor_v1 *wlr_inhibitor; | 20 | struct wlr_idle_inhibitor_v1 *wlr_inhibitor; |
26 | struct sway_view *view; | 21 | struct sway_view *view; |
27 | enum sway_idle_inhibit_mode mode; | 22 | enum sway_idle_inhibit_mode mode; |
@@ -33,8 +28,7 @@ struct sway_idle_inhibitor_v1 { | |||
33 | bool sway_idle_inhibit_v1_is_active( | 28 | bool sway_idle_inhibit_v1_is_active( |
34 | struct sway_idle_inhibitor_v1 *inhibitor); | 29 | struct sway_idle_inhibitor_v1 *inhibitor); |
35 | 30 | ||
36 | void sway_idle_inhibit_v1_check_active( | 31 | void sway_idle_inhibit_v1_check_active(void); |
37 | struct sway_idle_inhibit_manager_v1 *manager); | ||
38 | 32 | ||
39 | void sway_idle_inhibit_v1_user_inhibitor_register(struct sway_view *view, | 33 | void sway_idle_inhibit_v1_user_inhibitor_register(struct sway_view *view, |
40 | enum sway_idle_inhibit_mode mode); | 34 | enum sway_idle_inhibit_mode mode); |
@@ -48,6 +42,6 @@ struct sway_idle_inhibitor_v1 *sway_idle_inhibit_v1_application_inhibitor_for_vi | |||
48 | void sway_idle_inhibit_v1_user_inhibitor_destroy( | 42 | void sway_idle_inhibit_v1_user_inhibitor_destroy( |
49 | struct sway_idle_inhibitor_v1 *inhibitor); | 43 | struct sway_idle_inhibitor_v1 *inhibitor); |
50 | 44 | ||
51 | struct sway_idle_inhibit_manager_v1 *sway_idle_inhibit_manager_v1_create( | 45 | bool sway_idle_inhibit_manager_v1_init(void); |
52 | struct wl_display *wl_display, struct wlr_idle *idle); | 46 | |
53 | #endif | 47 | #endif |
diff --git a/include/sway/desktop/launcher.h b/include/sway/desktop/launcher.h new file mode 100644 index 00000000..412068a9 --- /dev/null +++ b/include/sway/desktop/launcher.h | |||
@@ -0,0 +1,40 @@ | |||
1 | #ifndef _SWAY_LAUNCHER_H | ||
2 | #define _SWAY_LAUNCHER_H | ||
3 | |||
4 | #include <stdlib.h> | ||
5 | #include <wayland-server-core.h> | ||
6 | #include "sway/input/seat.h" | ||
7 | |||
8 | struct launcher_ctx { | ||
9 | pid_t pid; | ||
10 | char *fallback_name; | ||
11 | struct wlr_xdg_activation_token_v1 *token; | ||
12 | struct wl_listener token_destroy; | ||
13 | struct sway_seat *seat; | ||
14 | struct wl_listener seat_destroy; | ||
15 | |||
16 | bool activated; | ||
17 | bool had_focused_surface; | ||
18 | |||
19 | struct sway_node *node; | ||
20 | struct wl_listener node_destroy; | ||
21 | |||
22 | struct wl_list link; // sway_server::pending_launcher_ctxs | ||
23 | }; | ||
24 | |||
25 | struct launcher_ctx *launcher_ctx_find_pid(pid_t pid); | ||
26 | |||
27 | struct sway_workspace *launcher_ctx_get_workspace(struct launcher_ctx *ctx); | ||
28 | |||
29 | void launcher_ctx_consume(struct launcher_ctx *ctx); | ||
30 | |||
31 | void launcher_ctx_destroy(struct launcher_ctx *ctx); | ||
32 | |||
33 | struct launcher_ctx *launcher_ctx_create_internal(void); | ||
34 | |||
35 | struct launcher_ctx *launcher_ctx_create( | ||
36 | struct wlr_xdg_activation_token_v1 *token, struct sway_node *node); | ||
37 | |||
38 | const char *launcher_ctx_get_token_name(struct launcher_ctx *ctx); | ||
39 | |||
40 | #endif | ||
diff --git a/include/sway/desktop/transaction.h b/include/sway/desktop/transaction.h index 7dd58ba8..dd7edb7a 100644 --- a/include/sway/desktop/transaction.h +++ b/include/sway/desktop/transaction.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _SWAY_TRANSACTION_H | 1 | #ifndef _SWAY_TRANSACTION_H |
2 | #define _SWAY_TRANSACTION_H | 2 | #define _SWAY_TRANSACTION_H |
3 | #include <stdint.h> | 3 | #include <stdint.h> |
4 | #include <stdbool.h> | ||
5 | #include <wlr/types/wlr_scene.h> | ||
4 | 6 | ||
5 | /** | 7 | /** |
6 | * Transactions enable us to perform atomic layout updates. | 8 | * Transactions enable us to perform atomic layout updates. |
@@ -38,8 +40,11 @@ void transaction_commit_dirty_client(void); | |||
38 | * Notify the transaction system that a view is ready for the new layout. | 40 | * Notify the transaction system that a view is ready for the new layout. |
39 | * | 41 | * |
40 | * When all views in the transaction are ready, the layout will be applied. | 42 | * When all views in the transaction are ready, the layout will be applied. |
43 | * | ||
44 | * A success boolean is returned denoting that this part of the transaction is | ||
45 | * ready. | ||
41 | */ | 46 | */ |
42 | void transaction_notify_view_ready_by_serial(struct sway_view *view, | 47 | bool transaction_notify_view_ready_by_serial(struct sway_view *view, |
43 | uint32_t serial); | 48 | uint32_t serial); |
44 | 49 | ||
45 | /** | 50 | /** |
@@ -47,8 +52,13 @@ void transaction_notify_view_ready_by_serial(struct sway_view *view, | |||
47 | * identifying the instruction by geometry rather than by serial. | 52 | * identifying the instruction by geometry rather than by serial. |
48 | * | 53 | * |
49 | * This is used by xwayland views, as they don't have serials. | 54 | * This is used by xwayland views, as they don't have serials. |
55 | * | ||
56 | * A success boolean is returned denoting that this part of the transaction is | ||
57 | * ready. | ||
50 | */ | 58 | */ |
51 | void transaction_notify_view_ready_by_geometry(struct sway_view *view, | 59 | bool transaction_notify_view_ready_by_geometry(struct sway_view *view, |
52 | double x, double y, int width, int height); | 60 | double x, double y, int width, int height); |
53 | 61 | ||
62 | void arrange_popups(struct wlr_scene_tree *popups); | ||
63 | |||
54 | #endif | 64 | #endif |
diff --git a/include/sway/input/cursor.h b/include/sway/input/cursor.h index 3a71a35f..527d0350 100644 --- a/include/sway/input/cursor.h +++ b/include/sway/input/cursor.h | |||
@@ -35,15 +35,14 @@ struct sway_cursor { | |||
35 | pixman_region32_t confine; // invalid if active_constraint == NULL | 35 | pixman_region32_t confine; // invalid if active_constraint == NULL |
36 | bool active_confine_requires_warp; | 36 | bool active_confine_requires_warp; |
37 | 37 | ||
38 | struct wlr_pointer_gestures_v1 *pointer_gestures; | 38 | struct wl_listener hold_begin; |
39 | struct wl_listener hold_end; | ||
39 | struct wl_listener pinch_begin; | 40 | struct wl_listener pinch_begin; |
40 | struct wl_listener pinch_update; | 41 | struct wl_listener pinch_update; |
41 | struct wl_listener pinch_end; | 42 | struct wl_listener pinch_end; |
42 | struct wl_listener swipe_begin; | 43 | struct wl_listener swipe_begin; |
43 | struct wl_listener swipe_update; | 44 | struct wl_listener swipe_update; |
44 | struct wl_listener swipe_end; | 45 | struct wl_listener swipe_end; |
45 | struct wl_listener hold_begin; | ||
46 | struct wl_listener hold_end; | ||
47 | 46 | ||
48 | struct wl_listener motion; | 47 | struct wl_listener motion; |
49 | struct wl_listener motion_absolute; | 48 | struct wl_listener motion_absolute; |
@@ -53,6 +52,7 @@ struct sway_cursor { | |||
53 | 52 | ||
54 | struct wl_listener touch_down; | 53 | struct wl_listener touch_down; |
55 | struct wl_listener touch_up; | 54 | struct wl_listener touch_up; |
55 | struct wl_listener touch_cancel; | ||
56 | struct wl_listener touch_motion; | 56 | struct wl_listener touch_motion; |
57 | struct wl_listener touch_frame; | 57 | struct wl_listener touch_frame; |
58 | bool simulating_pointer_from_touch; | 58 | bool simulating_pointer_from_touch; |
@@ -64,6 +64,7 @@ struct sway_cursor { | |||
64 | struct wl_listener tool_proximity; | 64 | struct wl_listener tool_proximity; |
65 | struct wl_listener tool_button; | 65 | struct wl_listener tool_button; |
66 | bool simulating_pointer_from_tool_tip; | 66 | bool simulating_pointer_from_tool_tip; |
67 | bool simulating_pointer_from_tool_button; | ||
67 | uint32_t tool_buttons; | 68 | uint32_t tool_buttons; |
68 | 69 | ||
69 | struct wl_listener request_set_cursor; | 70 | struct wl_listener request_set_cursor; |
@@ -107,9 +108,13 @@ void cursor_unhide(struct sway_cursor *cursor); | |||
107 | int cursor_get_timeout(struct sway_cursor *cursor); | 108 | int cursor_get_timeout(struct sway_cursor *cursor); |
108 | void cursor_notify_key_press(struct sway_cursor *cursor); | 109 | void cursor_notify_key_press(struct sway_cursor *cursor); |
109 | 110 | ||
111 | void pointer_motion(struct sway_cursor *cursor, uint32_t time_msec, | ||
112 | struct wlr_input_device *device, double dx, double dy, | ||
113 | double dx_unaccel, double dy_unaccel); | ||
114 | |||
110 | void dispatch_cursor_button(struct sway_cursor *cursor, | 115 | void dispatch_cursor_button(struct sway_cursor *cursor, |
111 | struct wlr_input_device *device, uint32_t time_msec, uint32_t button, | 116 | struct wlr_input_device *device, uint32_t time_msec, uint32_t button, |
112 | enum wlr_button_state state); | 117 | enum wl_pointer_button_state state); |
113 | 118 | ||
114 | void dispatch_cursor_axis(struct sway_cursor *cursor, | 119 | void dispatch_cursor_axis(struct sway_cursor *cursor, |
115 | struct wlr_pointer_axis_event *event); | 120 | struct wlr_pointer_axis_event *event); |
@@ -140,4 +145,6 @@ uint32_t get_mouse_button(const char *name, char **error); | |||
140 | 145 | ||
141 | const char *get_mouse_button_name(uint32_t button); | 146 | const char *get_mouse_button_name(uint32_t button); |
142 | 147 | ||
148 | void handle_request_set_cursor_shape(struct wl_listener *listener, void *data); | ||
149 | |||
143 | #endif | 150 | #endif |
diff --git a/include/sway/input/input-manager.h b/include/sway/input/input-manager.h index c9bd08f0..45c75199 100644 --- a/include/sway/input/input-manager.h +++ b/include/sway/input/input-manager.h | |||
@@ -1,10 +1,10 @@ | |||
1 | #ifndef _SWAY_INPUT_INPUT_MANAGER_H | 1 | #ifndef _SWAY_INPUT_INPUT_MANAGER_H |
2 | #define _SWAY_INPUT_INPUT_MANAGER_H | 2 | #define _SWAY_INPUT_INPUT_MANAGER_H |
3 | #include <libinput.h> | 3 | #include <libinput.h> |
4 | #include <wlr/types/wlr_input_inhibitor.h> | ||
5 | #include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h> | 4 | #include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h> |
6 | #include <wlr/types/wlr_virtual_keyboard_v1.h> | 5 | #include <wlr/types/wlr_virtual_keyboard_v1.h> |
7 | #include <wlr/types/wlr_virtual_pointer_v1.h> | 6 | #include <wlr/types/wlr_virtual_pointer_v1.h> |
7 | #include <wlr/types/wlr_transient_seat_v1.h> | ||
8 | #include "sway/server.h" | 8 | #include "sway/server.h" |
9 | #include "sway/config.h" | 9 | #include "sway/config.h" |
10 | #include "list.h" | 10 | #include "list.h" |
@@ -21,10 +21,11 @@ struct sway_input_manager { | |||
21 | struct wl_list devices; | 21 | struct wl_list devices; |
22 | struct wl_list seats; | 22 | struct wl_list seats; |
23 | 23 | ||
24 | struct wlr_input_inhibit_manager *inhibit; | ||
25 | struct wlr_keyboard_shortcuts_inhibit_manager_v1 *keyboard_shortcuts_inhibit; | 24 | struct wlr_keyboard_shortcuts_inhibit_manager_v1 *keyboard_shortcuts_inhibit; |
26 | struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard; | 25 | struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard; |
27 | struct wlr_virtual_pointer_manager_v1 *virtual_pointer; | 26 | struct wlr_virtual_pointer_manager_v1 *virtual_pointer; |
27 | struct wlr_pointer_gestures_v1 *pointer_gestures; | ||
28 | struct wlr_transient_seat_manager_v1 *transient_seat_manager; | ||
28 | 29 | ||
29 | struct wl_listener new_input; | 30 | struct wl_listener new_input; |
30 | struct wl_listener inhibit_activate; | 31 | struct wl_listener inhibit_activate; |
@@ -32,6 +33,7 @@ struct sway_input_manager { | |||
32 | struct wl_listener keyboard_shortcuts_inhibit_new_inhibitor; | 33 | struct wl_listener keyboard_shortcuts_inhibit_new_inhibitor; |
33 | struct wl_listener virtual_keyboard_new; | 34 | struct wl_listener virtual_keyboard_new; |
34 | struct wl_listener virtual_pointer_new; | 35 | struct wl_listener virtual_pointer_new; |
36 | struct wl_listener transient_seat_create; | ||
35 | }; | 37 | }; |
36 | 38 | ||
37 | struct sway_input_manager *input_manager_create(struct sway_server *server); | 39 | struct sway_input_manager *input_manager_create(struct sway_server *server); |
@@ -44,7 +46,7 @@ void input_manager_configure_xcursor(void); | |||
44 | 46 | ||
45 | void input_manager_apply_input_config(struct input_config *input_config); | 47 | void input_manager_apply_input_config(struct input_config *input_config); |
46 | 48 | ||
47 | void input_manager_configure_all_inputs(void); | 49 | void input_manager_configure_all_input_mappings(void); |
48 | 50 | ||
49 | void input_manager_reset_input(struct sway_input_device *input_device); | 51 | void input_manager_reset_input(struct sway_input_device *input_device); |
50 | 52 | ||
diff --git a/include/sway/input/keyboard.h b/include/sway/input/keyboard.h index 2c61e5a7..571d9e6f 100644 --- a/include/sway/input/keyboard.h +++ b/include/sway/input/keyboard.h | |||
@@ -50,6 +50,7 @@ struct sway_shortcut_state { | |||
50 | 50 | ||
51 | struct sway_keyboard { | 51 | struct sway_keyboard { |
52 | struct sway_seat_device *seat_device; | 52 | struct sway_seat_device *seat_device; |
53 | struct wlr_keyboard *wlr; | ||
53 | 54 | ||
54 | struct xkb_keymap *keymap; | 55 | struct xkb_keymap *keymap; |
55 | xkb_layout_index_t effective_layout; | 56 | xkb_layout_index_t effective_layout; |
diff --git a/include/sway/input/libinput.h b/include/sway/input/libinput.h index 890d632e..1f84a8e3 100644 --- a/include/sway/input/libinput.h +++ b/include/sway/input/libinput.h | |||
@@ -2,7 +2,10 @@ | |||
2 | #define _SWAY_INPUT_LIBINPUT_H | 2 | #define _SWAY_INPUT_LIBINPUT_H |
3 | #include "sway/input/input-manager.h" | 3 | #include "sway/input/input-manager.h" |
4 | 4 | ||
5 | void sway_input_configure_libinput_device(struct sway_input_device *device); | 5 | bool sway_input_configure_libinput_device(struct sway_input_device *device); |
6 | |||
7 | void sway_input_configure_libinput_device_send_events( | ||
8 | struct sway_input_device *device); | ||
6 | 9 | ||
7 | void sway_input_reset_libinput_device(struct sway_input_device *device); | 10 | void sway_input_reset_libinput_device(struct sway_input_device *device); |
8 | 11 | ||
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h index 47726159..428f9679 100644 --- a/include/sway/input/seat.h +++ b/include/sway/input/seat.h | |||
@@ -3,7 +3,9 @@ | |||
3 | 3 | ||
4 | #include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h> | 4 | #include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h> |
5 | #include <wlr/types/wlr_layer_shell_v1.h> | 5 | #include <wlr/types/wlr_layer_shell_v1.h> |
6 | #include <wlr/types/wlr_scene.h> | ||
6 | #include <wlr/types/wlr_seat.h> | 7 | #include <wlr/types/wlr_seat.h> |
8 | #include <wlr/types/wlr_touch.h> | ||
7 | #include <wlr/util/edges.h> | 9 | #include <wlr/util/edges.h> |
8 | #include "sway/config.h" | 10 | #include "sway/config.h" |
9 | #include "sway/input/input-manager.h" | 11 | #include "sway/input/input-manager.h" |
@@ -15,19 +17,41 @@ struct sway_seat; | |||
15 | struct sway_seatop_impl { | 17 | struct sway_seatop_impl { |
16 | void (*button)(struct sway_seat *seat, uint32_t time_msec, | 18 | void (*button)(struct sway_seat *seat, uint32_t time_msec, |
17 | struct wlr_input_device *device, uint32_t button, | 19 | struct wlr_input_device *device, uint32_t button, |
18 | enum wlr_button_state state); | 20 | enum wl_pointer_button_state state); |
19 | void (*pointer_motion)(struct sway_seat *seat, uint32_t time_msec); | 21 | void (*pointer_motion)(struct sway_seat *seat, uint32_t time_msec); |
20 | void (*pointer_axis)(struct sway_seat *seat, | 22 | void (*pointer_axis)(struct sway_seat *seat, |
21 | struct wlr_pointer_axis_event *event); | 23 | struct wlr_pointer_axis_event *event); |
24 | void (*hold_begin)(struct sway_seat *seat, | ||
25 | struct wlr_pointer_hold_begin_event *event); | ||
26 | void (*hold_end)(struct sway_seat *seat, | ||
27 | struct wlr_pointer_hold_end_event *event); | ||
28 | void (*pinch_begin)(struct sway_seat *seat, | ||
29 | struct wlr_pointer_pinch_begin_event *event); | ||
30 | void (*pinch_update)(struct sway_seat *seat, | ||
31 | struct wlr_pointer_pinch_update_event *event); | ||
32 | void (*pinch_end)(struct sway_seat *seat, | ||
33 | struct wlr_pointer_pinch_end_event *event); | ||
34 | void (*swipe_begin)(struct sway_seat *seat, | ||
35 | struct wlr_pointer_swipe_begin_event *event); | ||
36 | void (*swipe_update)(struct sway_seat *seat, | ||
37 | struct wlr_pointer_swipe_update_event *event); | ||
38 | void (*swipe_end)(struct sway_seat *seat, | ||
39 | struct wlr_pointer_swipe_end_event *event); | ||
22 | void (*rebase)(struct sway_seat *seat, uint32_t time_msec); | 40 | void (*rebase)(struct sway_seat *seat, uint32_t time_msec); |
41 | void (*touch_motion)(struct sway_seat *seat, | ||
42 | struct wlr_touch_motion_event *event, double lx, double ly); | ||
43 | void (*touch_up)(struct sway_seat *seat, | ||
44 | struct wlr_touch_up_event *event); | ||
45 | void (*touch_down)(struct sway_seat *seat, | ||
46 | struct wlr_touch_down_event *event, double lx, double ly); | ||
47 | void (*touch_cancel)(struct sway_seat *seat, | ||
48 | struct wlr_touch_cancel_event *event); | ||
23 | void (*tablet_tool_motion)(struct sway_seat *seat, | 49 | void (*tablet_tool_motion)(struct sway_seat *seat, |
24 | struct sway_tablet_tool *tool, uint32_t time_msec); | 50 | struct sway_tablet_tool *tool, uint32_t time_msec); |
25 | void (*tablet_tool_tip)(struct sway_seat *seat, struct sway_tablet_tool *tool, | 51 | void (*tablet_tool_tip)(struct sway_seat *seat, struct sway_tablet_tool *tool, |
26 | uint32_t time_msec, enum wlr_tablet_tool_tip_state state); | 52 | uint32_t time_msec, enum wlr_tablet_tool_tip_state state); |
27 | void (*end)(struct sway_seat *seat); | 53 | void (*end)(struct sway_seat *seat); |
28 | void (*unref)(struct sway_seat *seat, struct sway_container *con); | 54 | void (*unref)(struct sway_seat *seat, struct sway_container *con); |
29 | void (*render)(struct sway_seat *seat, struct sway_output *output, | ||
30 | pixman_region32_t *damage); | ||
31 | bool allow_set_cursor; | 55 | bool allow_set_cursor; |
32 | }; | 56 | }; |
33 | 57 | ||
@@ -50,19 +74,6 @@ struct sway_seat_node { | |||
50 | struct wl_listener destroy; | 74 | struct wl_listener destroy; |
51 | }; | 75 | }; |
52 | 76 | ||
53 | struct sway_drag_icon { | ||
54 | struct sway_seat *seat; | ||
55 | struct wlr_drag_icon *wlr_drag_icon; | ||
56 | struct wl_list link; // sway_root::drag_icons | ||
57 | |||
58 | double x, y; // in layout-local coordinates | ||
59 | |||
60 | struct wl_listener surface_commit; | ||
61 | struct wl_listener map; | ||
62 | struct wl_listener unmap; | ||
63 | struct wl_listener destroy; | ||
64 | }; | ||
65 | |||
66 | struct sway_drag { | 77 | struct sway_drag { |
67 | struct sway_seat *seat; | 78 | struct sway_seat *seat; |
68 | struct wlr_drag *wlr_drag; | 79 | struct wlr_drag *wlr_drag; |
@@ -73,16 +84,23 @@ struct sway_seat { | |||
73 | struct wlr_seat *wlr_seat; | 84 | struct wlr_seat *wlr_seat; |
74 | struct sway_cursor *cursor; | 85 | struct sway_cursor *cursor; |
75 | 86 | ||
87 | // Seat scene tree structure | ||
88 | // - scene_tree | ||
89 | // - drag icons | ||
90 | // - drag icon 1 | ||
91 | // - drag icon 2 | ||
92 | // - seatop specific stuff | ||
93 | struct wlr_scene_tree *scene_tree; | ||
94 | struct wlr_scene_tree *drag_icons; | ||
95 | |||
76 | bool has_focus; | 96 | bool has_focus; |
77 | struct wl_list focus_stack; // list of containers in focus order | 97 | struct wl_list focus_stack; // list of containers in focus order |
78 | struct sway_workspace *workspace; | 98 | struct sway_workspace *workspace; |
79 | char *prev_workspace_name; // for workspace back_and_forth | 99 | char *prev_workspace_name; // for workspace back_and_forth |
80 | 100 | ||
81 | // If the focused layer is set, views cannot receive keyboard focus | ||
82 | struct wlr_layer_surface_v1 *focused_layer; | 101 | struct wlr_layer_surface_v1 *focused_layer; |
83 | 102 | // If the exclusive layer is set, views cannot receive keyboard focus | |
84 | // If exclusive_client is set, no other clients will receive input events | 103 | bool has_exclusive_layer; |
85 | struct wl_client *exclusive_client; | ||
86 | 104 | ||
87 | // Last touch point | 105 | // Last touch point |
88 | int32_t touch_id; | 106 | int32_t touch_id; |
@@ -106,6 +124,7 @@ struct sway_seat { | |||
106 | struct wl_listener start_drag; | 124 | struct wl_listener start_drag; |
107 | struct wl_listener request_set_selection; | 125 | struct wl_listener request_set_selection; |
108 | struct wl_listener request_set_primary_selection; | 126 | struct wl_listener request_set_primary_selection; |
127 | struct wl_listener destroy; | ||
109 | 128 | ||
110 | struct wl_list devices; // sway_seat_device::link | 129 | struct wl_list devices; // sway_seat_device::link |
111 | struct wl_list keyboard_groups; // sway_keyboard_group::link | 130 | struct wl_list keyboard_groups; // sway_keyboard_group::link |
@@ -141,6 +160,9 @@ void seat_add_device(struct sway_seat *seat, | |||
141 | void seat_configure_device(struct sway_seat *seat, | 160 | void seat_configure_device(struct sway_seat *seat, |
142 | struct sway_input_device *device); | 161 | struct sway_input_device *device); |
143 | 162 | ||
163 | void seat_configure_device_mapping(struct sway_seat *seat, | ||
164 | struct sway_input_device *input_device); | ||
165 | |||
144 | void seat_reset_device(struct sway_seat *seat, | 166 | void seat_reset_device(struct sway_seat *seat, |
145 | struct sway_input_device *input_device); | 167 | struct sway_input_device *input_device); |
146 | 168 | ||
@@ -171,8 +193,7 @@ void seat_set_focus_surface(struct sway_seat *seat, | |||
171 | void seat_set_focus_layer(struct sway_seat *seat, | 193 | void seat_set_focus_layer(struct sway_seat *seat, |
172 | struct wlr_layer_surface_v1 *layer); | 194 | struct wlr_layer_surface_v1 *layer); |
173 | 195 | ||
174 | void seat_set_exclusive_client(struct sway_seat *seat, | 196 | void seat_unfocus_unless_client(struct sway_seat *seat, struct wl_client *client); |
175 | struct wl_client *client); | ||
176 | 197 | ||
177 | struct sway_node *seat_get_focus(struct sway_seat *seat); | 198 | struct sway_node *seat_get_focus(struct sway_seat *seat); |
178 | 199 | ||
@@ -185,10 +206,6 @@ struct sway_workspace *seat_get_last_known_workspace(struct sway_seat *seat); | |||
185 | 206 | ||
186 | struct sway_container *seat_get_focused_container(struct sway_seat *seat); | 207 | struct sway_container *seat_get_focused_container(struct sway_seat *seat); |
187 | 208 | ||
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 | |||
192 | /** | 209 | /** |
193 | * Return the last container to be focused for the seat (or the most recently | 210 | * Return the last container to be focused for the seat (or the most recently |
194 | * opened if no container has received focused) that is a child of the given | 211 | * opened if no container has received focused) that is a child of the given |
@@ -235,7 +252,7 @@ void seat_idle_notify_activity(struct sway_seat *seat, | |||
235 | 252 | ||
236 | bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface); | 253 | bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface); |
237 | 254 | ||
238 | void drag_icon_update_position(struct sway_drag_icon *icon); | 255 | void drag_icons_update_position(struct sway_seat *seat); |
239 | 256 | ||
240 | enum wlr_edges find_resize_edge(struct sway_container *cont, | 257 | enum wlr_edges find_resize_edge(struct sway_container *cont, |
241 | struct wlr_surface *surface, struct sway_cursor *cursor); | 258 | struct wlr_surface *surface, struct sway_cursor *cursor); |
@@ -243,10 +260,13 @@ enum wlr_edges find_resize_edge(struct sway_container *cont, | |||
243 | void seatop_begin_default(struct sway_seat *seat); | 260 | void seatop_begin_default(struct sway_seat *seat); |
244 | 261 | ||
245 | void seatop_begin_down(struct sway_seat *seat, struct sway_container *con, | 262 | void seatop_begin_down(struct sway_seat *seat, struct sway_container *con, |
246 | uint32_t time_msec, double sx, double sy); | 263 | double sx, double sy); |
247 | 264 | ||
248 | void seatop_begin_down_on_surface(struct sway_seat *seat, | 265 | void seatop_begin_down_on_surface(struct sway_seat *seat, |
249 | struct wlr_surface *surface, uint32_t time_msec, double sx, double sy); | 266 | struct wlr_surface *surface, double sx, double sy); |
267 | |||
268 | void seatop_begin_touch_down(struct sway_seat *seat, struct wlr_surface *surface, | ||
269 | struct wlr_touch_down_event *event, double sx, double sy, double lx, double ly); | ||
250 | 270 | ||
251 | void seatop_begin_move_floating(struct sway_seat *seat, | 271 | void seatop_begin_move_floating(struct sway_seat *seat, |
252 | struct sway_container *con); | 272 | struct sway_container *con); |
@@ -267,13 +287,13 @@ struct sway_container *seat_get_focus_inactive_floating(struct sway_seat *seat, | |||
267 | struct sway_workspace *workspace); | 287 | struct sway_workspace *workspace); |
268 | 288 | ||
269 | void seat_pointer_notify_button(struct sway_seat *seat, uint32_t time_msec, | 289 | void seat_pointer_notify_button(struct sway_seat *seat, uint32_t time_msec, |
270 | uint32_t button, enum wlr_button_state state); | 290 | uint32_t button, enum wl_pointer_button_state state); |
271 | 291 | ||
272 | void seat_consider_warp_to_focus(struct sway_seat *seat); | 292 | void seat_consider_warp_to_focus(struct sway_seat *seat); |
273 | 293 | ||
274 | void seatop_button(struct sway_seat *seat, uint32_t time_msec, | 294 | void seatop_button(struct sway_seat *seat, uint32_t time_msec, |
275 | struct wlr_input_device *device, uint32_t button, | 295 | struct wlr_input_device *device, uint32_t button, |
276 | enum wlr_button_state state); | 296 | enum wl_pointer_button_state state); |
277 | 297 | ||
278 | void seatop_pointer_motion(struct sway_seat *seat, uint32_t time_msec); | 298 | void seatop_pointer_motion(struct sway_seat *seat, uint32_t time_msec); |
279 | 299 | ||
@@ -287,6 +307,37 @@ void seatop_tablet_tool_tip(struct sway_seat *seat, | |||
287 | void seatop_tablet_tool_motion(struct sway_seat *seat, | 307 | void seatop_tablet_tool_motion(struct sway_seat *seat, |
288 | struct sway_tablet_tool *tool, uint32_t time_msec); | 308 | struct sway_tablet_tool *tool, uint32_t time_msec); |
289 | 309 | ||
310 | void seatop_hold_begin(struct sway_seat *seat, | ||
311 | struct wlr_pointer_hold_begin_event *event); | ||
312 | void seatop_hold_end(struct sway_seat *seat, | ||
313 | struct wlr_pointer_hold_end_event *event); | ||
314 | |||
315 | void seatop_pinch_begin(struct sway_seat *seat, | ||
316 | struct wlr_pointer_pinch_begin_event *event); | ||
317 | void seatop_pinch_update(struct sway_seat *seat, | ||
318 | struct wlr_pointer_pinch_update_event *event); | ||
319 | void seatop_pinch_end(struct sway_seat *seat, | ||
320 | struct wlr_pointer_pinch_end_event *event); | ||
321 | |||
322 | void seatop_swipe_begin(struct sway_seat *seat, | ||
323 | struct wlr_pointer_swipe_begin_event *event); | ||
324 | void seatop_swipe_update(struct sway_seat *seat, | ||
325 | struct wlr_pointer_swipe_update_event *event); | ||
326 | void seatop_swipe_end(struct sway_seat *seat, | ||
327 | struct wlr_pointer_swipe_end_event *event); | ||
328 | |||
329 | void seatop_touch_motion(struct sway_seat *seat, | ||
330 | struct wlr_touch_motion_event *event, double lx, double ly); | ||
331 | |||
332 | void seatop_touch_up(struct sway_seat *seat, | ||
333 | struct wlr_touch_up_event *event); | ||
334 | |||
335 | void seatop_touch_down(struct sway_seat *seat, | ||
336 | struct wlr_touch_down_event *event, double lx, double ly); | ||
337 | |||
338 | void seatop_touch_cancel(struct sway_seat *seat, | ||
339 | struct wlr_touch_cancel_event *event); | ||
340 | |||
290 | void seatop_rebase(struct sway_seat *seat, uint32_t time_msec); | 341 | void seatop_rebase(struct sway_seat *seat, uint32_t time_msec); |
291 | 342 | ||
292 | /** | 343 | /** |
@@ -301,13 +352,6 @@ void seatop_end(struct sway_seat *seat); | |||
301 | */ | 352 | */ |
302 | void seatop_unref(struct sway_seat *seat, struct sway_container *con); | 353 | void seatop_unref(struct sway_seat *seat, struct sway_container *con); |
303 | 354 | ||
304 | /** | ||
305 | * Instructs a seatop to render anything that it needs to render | ||
306 | * (eg. dropzone for move-tiling) | ||
307 | */ | ||
308 | void seatop_render(struct sway_seat *seat, struct sway_output *output, | ||
309 | pixman_region32_t *damage); | ||
310 | |||
311 | bool seatop_allows_set_cursor(struct sway_seat *seat); | 355 | bool seatop_allows_set_cursor(struct sway_seat *seat); |
312 | 356 | ||
313 | /** | 357 | /** |
diff --git a/include/sway/input/switch.h b/include/sway/input/switch.h index 213b471d..de6787b7 100644 --- a/include/sway/input/switch.h +++ b/include/sway/input/switch.h | |||
@@ -5,6 +5,7 @@ | |||
5 | 5 | ||
6 | struct sway_switch { | 6 | struct sway_switch { |
7 | struct sway_seat_device *seat_device; | 7 | struct sway_seat_device *seat_device; |
8 | struct wlr_switch *wlr; | ||
8 | enum wlr_switch_state state; | 9 | enum wlr_switch_state state; |
9 | enum wlr_switch_type type; | 10 | enum wlr_switch_type type; |
10 | 11 | ||
diff --git a/include/sway/input/tablet.h b/include/sway/input/tablet.h index d7e4c242..2fa5db6d 100644 --- a/include/sway/input/tablet.h +++ b/include/sway/input/tablet.h | |||
@@ -32,6 +32,7 @@ struct sway_tablet_pad { | |||
32 | struct wl_list link; | 32 | struct wl_list link; |
33 | struct sway_seat_device *seat_device; | 33 | struct sway_seat_device *seat_device; |
34 | struct sway_tablet *tablet; | 34 | struct sway_tablet *tablet; |
35 | struct wlr_tablet_pad *wlr; | ||
35 | struct wlr_tablet_v2_tablet_pad *tablet_v2_pad; | 36 | struct wlr_tablet_v2_tablet_pad *tablet_v2_pad; |
36 | 37 | ||
37 | struct wl_listener attach; | 38 | struct wl_listener attach; |
@@ -62,7 +63,7 @@ void sway_configure_tablet_pad(struct sway_tablet_pad *tablet_pad); | |||
62 | 63 | ||
63 | void sway_tablet_pad_destroy(struct sway_tablet_pad *tablet_pad); | 64 | void sway_tablet_pad_destroy(struct sway_tablet_pad *tablet_pad); |
64 | 65 | ||
65 | void sway_tablet_pad_notify_enter(struct sway_tablet_pad *tablet_pad, | 66 | void sway_tablet_pad_set_focus(struct sway_tablet_pad *tablet_pad, |
66 | struct wlr_surface *surface); | 67 | struct wlr_surface *surface); |
67 | 68 | ||
68 | #endif | 69 | #endif |
diff --git a/include/sway/input/text_input.h b/include/sway/input/text_input.h index c70fd935..1993f928 100644 --- a/include/sway/input/text_input.h +++ b/include/sway/input/text_input.h | |||
@@ -4,12 +4,11 @@ | |||
4 | #include <wlr/types/wlr_text_input_v3.h> | 4 | #include <wlr/types/wlr_text_input_v3.h> |
5 | #include <wlr/types/wlr_input_method_v2.h> | 5 | #include <wlr/types/wlr_input_method_v2.h> |
6 | #include <wlr/types/wlr_compositor.h> | 6 | #include <wlr/types/wlr_compositor.h> |
7 | #include "sway/input/seat.h" | ||
8 | 7 | ||
9 | /** | 8 | /** |
10 | * The relay structure manages the relationship between text-input and | 9 | * The relay structure manages the relationship between text-input and |
11 | * input_method interfaces on a given seat. Multiple text-input interfaces may | 10 | * input_method interfaces on a given seat. Multiple text-input interfaces may |
12 | * be bound to a relay, but at most one will be focused (reveiving events) at | 11 | * be bound to a relay, but at most one will be focused (receiving events) at |
13 | * a time. At most one input-method interface may be bound to the seat. The | 12 | * a time. At most one input-method interface may be bound to the seat. The |
14 | * relay manages life cycle of both sides. When both sides are present and | 13 | * relay manages life cycle of both sides. When both sides are present and |
15 | * focused, the relay passes messages between them. | 14 | * focused, the relay passes messages between them. |
@@ -22,18 +21,21 @@ struct sway_input_method_relay { | |||
22 | struct sway_seat *seat; | 21 | struct sway_seat *seat; |
23 | 22 | ||
24 | struct wl_list text_inputs; // sway_text_input::link | 23 | struct wl_list text_inputs; // sway_text_input::link |
24 | struct wl_list input_popups; // sway_input_popup::link | ||
25 | struct wlr_input_method_v2 *input_method; // doesn't have to be present | 25 | struct wlr_input_method_v2 *input_method; // doesn't have to be present |
26 | 26 | ||
27 | struct wl_listener text_input_new; | 27 | struct wl_listener text_input_new; |
28 | 28 | ||
29 | struct wl_listener input_method_new; | 29 | struct wl_listener input_method_new; |
30 | struct wl_listener input_method_commit; | 30 | struct wl_listener input_method_commit; |
31 | struct wl_listener input_method_new_popup_surface; | ||
31 | struct wl_listener input_method_grab_keyboard; | 32 | struct wl_listener input_method_grab_keyboard; |
32 | struct wl_listener input_method_destroy; | 33 | struct wl_listener input_method_destroy; |
33 | 34 | ||
34 | struct wl_listener input_method_keyboard_grab_destroy; | 35 | struct wl_listener input_method_keyboard_grab_destroy; |
35 | }; | 36 | }; |
36 | 37 | ||
38 | |||
37 | struct sway_text_input { | 39 | struct sway_text_input { |
38 | struct sway_input_method_relay *relay; | 40 | struct sway_input_method_relay *relay; |
39 | 41 | ||
diff --git a/include/sway/input/text_input_popup.h b/include/sway/input/text_input_popup.h new file mode 100644 index 00000000..e5f6ab8b --- /dev/null +++ b/include/sway/input/text_input_popup.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef _SWAY_INPUT_TEXT_INPUT_POPUP_H | ||
2 | #define _SWAY_INPUT_TEXT_INPUT_POPUP_H | ||
3 | |||
4 | #include "sway/tree/view.h" | ||
5 | |||
6 | struct sway_input_popup { | ||
7 | struct sway_input_method_relay *relay; | ||
8 | |||
9 | struct wlr_scene_tree *scene_tree; | ||
10 | struct sway_popup_desc desc; | ||
11 | struct wlr_input_popup_surface_v2 *popup_surface; | ||
12 | |||
13 | struct wl_list link; | ||
14 | |||
15 | struct wl_listener popup_destroy; | ||
16 | struct wl_listener popup_surface_commit; | ||
17 | |||
18 | struct wl_listener focused_surface_unmap; | ||
19 | }; | ||
20 | #endif | ||
diff --git a/include/sway/ipc-json.h b/include/sway/ipc-json.h index 6f4ade1a..bc9f4985 100644 --- a/include/sway/ipc-json.h +++ b/include/sway/ipc-json.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef _SWAY_IPC_JSON_H | 1 | #ifndef _SWAY_IPC_JSON_H |
2 | #define _SWAY_IPC_JSON_H | 2 | #define _SWAY_IPC_JSON_H |
3 | #include <json.h> | 3 | #include <json.h> |
4 | #include "sway/output.h" | ||
4 | #include "sway/tree/container.h" | 5 | #include "sway/tree/container.h" |
5 | #include "sway/input/input-manager.h" | 6 | #include "sway/input/input-manager.h" |
6 | 7 | ||
@@ -9,6 +10,7 @@ json_object *ipc_json_get_version(void); | |||
9 | json_object *ipc_json_get_binding_mode(void); | 10 | json_object *ipc_json_get_binding_mode(void); |
10 | 11 | ||
11 | json_object *ipc_json_describe_disabled_output(struct sway_output *o); | 12 | json_object *ipc_json_describe_disabled_output(struct sway_output *o); |
13 | json_object *ipc_json_describe_non_desktop_output(struct sway_output_non_desktop *o); | ||
12 | json_object *ipc_json_describe_node(struct sway_node *node); | 14 | json_object *ipc_json_describe_node(struct sway_node *node); |
13 | json_object *ipc_json_describe_node_recursive(struct sway_node *node); | 15 | json_object *ipc_json_describe_node_recursive(struct sway_node *node); |
14 | json_object *ipc_json_describe_input(struct sway_input_device *device); | 16 | json_object *ipc_json_describe_input(struct sway_input_device *device); |
diff --git a/include/sway/ipc-server.h b/include/sway/ipc-server.h index bc4f781a..d4c00942 100644 --- a/include/sway/ipc-server.h +++ b/include/sway/ipc-server.h | |||
@@ -21,5 +21,6 @@ void ipc_event_mode(const char *mode, bool pango); | |||
21 | void ipc_event_shutdown(const char *reason); | 21 | void ipc_event_shutdown(const char *reason); |
22 | void ipc_event_binding(struct sway_binding *binding); | 22 | void ipc_event_binding(struct sway_binding *binding); |
23 | void ipc_event_input(const char *change, struct sway_input_device *device); | 23 | void ipc_event_input(const char *change, struct sway_input_device *device); |
24 | void ipc_event_output(void); | ||
24 | 25 | ||
25 | #endif | 26 | #endif |
diff --git a/include/sway/layers.h b/include/sway/layers.h index f8508493..fd6384e0 100644 --- a/include/sway/layers.h +++ b/include/sway/layers.h | |||
@@ -3,61 +3,42 @@ | |||
3 | #include <stdbool.h> | 3 | #include <stdbool.h> |
4 | #include <wlr/types/wlr_compositor.h> | 4 | #include <wlr/types/wlr_compositor.h> |
5 | #include <wlr/types/wlr_layer_shell_v1.h> | 5 | #include <wlr/types/wlr_layer_shell_v1.h> |
6 | 6 | #include "sway/tree/view.h" | |
7 | enum layer_parent { | ||
8 | LAYER_PARENT_LAYER, | ||
9 | LAYER_PARENT_POPUP, | ||
10 | }; | ||
11 | 7 | ||
12 | struct sway_layer_surface { | 8 | struct sway_layer_surface { |
13 | struct wlr_layer_surface_v1 *layer_surface; | ||
14 | struct wl_list link; | ||
15 | |||
16 | struct wl_listener destroy; | ||
17 | struct wl_listener map; | 9 | struct wl_listener map; |
18 | struct wl_listener unmap; | 10 | struct wl_listener unmap; |
19 | struct wl_listener surface_commit; | 11 | struct wl_listener surface_commit; |
20 | struct wl_listener output_destroy; | 12 | struct wl_listener output_destroy; |
13 | struct wl_listener node_destroy; | ||
21 | struct wl_listener new_popup; | 14 | struct wl_listener new_popup; |
22 | struct wl_listener new_subsurface; | ||
23 | 15 | ||
24 | struct wlr_box geo; | ||
25 | bool mapped; | 16 | bool mapped; |
26 | struct wlr_box extent; | ||
27 | enum zwlr_layer_shell_v1_layer layer; | ||
28 | 17 | ||
29 | struct wl_list subsurfaces; | 18 | struct wlr_scene_tree *popups; |
19 | struct sway_popup_desc desc; | ||
20 | |||
21 | struct sway_output *output; | ||
22 | struct wlr_scene_layer_surface_v1 *scene; | ||
23 | struct wlr_scene_tree *tree; | ||
24 | struct wlr_layer_surface_v1 *layer_surface; | ||
30 | }; | 25 | }; |
31 | 26 | ||
32 | struct sway_layer_popup { | 27 | struct sway_layer_popup { |
33 | struct wlr_xdg_popup *wlr_popup; | 28 | struct wlr_xdg_popup *wlr_popup; |
34 | enum layer_parent parent_type; | 29 | struct wlr_scene_tree *scene; |
35 | union { | 30 | struct sway_layer_surface *toplevel; |
36 | struct sway_layer_surface *parent_layer; | ||
37 | struct sway_layer_popup *parent_popup; | ||
38 | }; | ||
39 | struct wl_listener map; | ||
40 | struct wl_listener unmap; | ||
41 | struct wl_listener destroy; | ||
42 | struct wl_listener commit; | ||
43 | struct wl_listener new_popup; | ||
44 | }; | ||
45 | 31 | ||
46 | struct sway_layer_subsurface { | ||
47 | struct wlr_subsurface *wlr_subsurface; | ||
48 | struct sway_layer_surface *layer_surface; | ||
49 | struct wl_list link; | ||
50 | |||
51 | struct wl_listener map; | ||
52 | struct wl_listener unmap; | ||
53 | struct wl_listener destroy; | 32 | struct wl_listener destroy; |
33 | struct wl_listener new_popup; | ||
54 | struct wl_listener commit; | 34 | struct wl_listener commit; |
55 | }; | 35 | }; |
56 | 36 | ||
57 | struct sway_output; | 37 | struct sway_output; |
58 | void arrange_layers(struct sway_output *output); | ||
59 | 38 | ||
60 | struct sway_layer_surface *layer_from_wlr_layer_surface_v1( | 39 | struct wlr_layer_surface_v1 *toplevel_layer_surface_from_surface( |
61 | struct wlr_layer_surface_v1 *layer_surface); | 40 | struct wlr_surface *surface); |
41 | |||
42 | void arrange_layers(struct sway_output *output); | ||
62 | 43 | ||
63 | #endif | 44 | #endif |
diff --git a/include/sway/output.h b/include/sway/output.h index 26b9709f..d546d488 100644 --- a/include/sway/output.h +++ b/include/sway/output.h | |||
@@ -3,7 +3,9 @@ | |||
3 | #include <time.h> | 3 | #include <time.h> |
4 | #include <unistd.h> | 4 | #include <unistd.h> |
5 | #include <wayland-server-core.h> | 5 | #include <wayland-server-core.h> |
6 | #include <wlr/types/wlr_damage_ring.h> | ||
6 | #include <wlr/types/wlr_output.h> | 7 | #include <wlr/types/wlr_output.h> |
8 | #include <wlr/types/wlr_scene.h> | ||
7 | #include "config.h" | 9 | #include "config.h" |
8 | #include "sway/tree/node.h" | 10 | #include "sway/tree/node.h" |
9 | #include "sway/tree/view.h" | 11 | #include "sway/tree/view.h" |
@@ -18,34 +20,47 @@ struct sway_output_state { | |||
18 | 20 | ||
19 | struct sway_output { | 21 | struct sway_output { |
20 | struct sway_node node; | 22 | struct sway_node node; |
23 | |||
24 | struct { | ||
25 | struct wlr_scene_tree *shell_background; | ||
26 | struct wlr_scene_tree *shell_bottom; | ||
27 | struct wlr_scene_tree *tiling; | ||
28 | struct wlr_scene_tree *fullscreen; | ||
29 | struct wlr_scene_tree *shell_top; | ||
30 | struct wlr_scene_tree *shell_overlay; | ||
31 | struct wlr_scene_tree *session_lock; | ||
32 | } layers; | ||
33 | |||
34 | // when a container is fullscreen, in case the fullscreen surface is | ||
35 | // translucent (can see behind) we must make sure that the background is a | ||
36 | // solid color in order to conform to the wayland protocol. This rect | ||
37 | // ensures that when looking through a surface, all that will be seen | ||
38 | // is black. | ||
39 | struct wlr_scene_rect *fullscreen_background; | ||
40 | |||
21 | struct wlr_output *wlr_output; | 41 | struct wlr_output *wlr_output; |
42 | struct wlr_scene_output *scene_output; | ||
22 | struct sway_server *server; | 43 | struct sway_server *server; |
23 | struct wl_list link; | 44 | struct wl_list link; |
24 | 45 | ||
25 | struct wl_list layers[4]; // sway_layer_surface::link | ||
26 | struct wlr_box usable_area; | 46 | struct wlr_box usable_area; |
27 | 47 | ||
28 | struct timespec last_frame; | ||
29 | struct wlr_output_damage *damage; | ||
30 | |||
31 | int lx, ly; // layout coords | 48 | int lx, ly; // layout coords |
32 | int width, height; // transformed buffer size | 49 | int width, height; // transformed buffer size |
33 | enum wl_output_subpixel detected_subpixel; | 50 | enum wl_output_subpixel detected_subpixel; |
34 | enum scale_filter_mode scale_filter; | 51 | enum scale_filter_mode scale_filter; |
35 | // last applied mode when the output is DPMS'ed | ||
36 | struct wlr_output_mode *current_mode; | ||
37 | 52 | ||
38 | bool enabling, enabled; | 53 | bool enabled; |
39 | list_t *workspaces; | 54 | list_t *workspaces; |
40 | 55 | ||
41 | struct sway_output_state current; | 56 | struct sway_output_state current; |
42 | 57 | ||
58 | struct wl_listener layout_destroy; | ||
43 | struct wl_listener destroy; | 59 | struct wl_listener destroy; |
44 | struct wl_listener commit; | 60 | struct wl_listener commit; |
45 | struct wl_listener mode; | ||
46 | struct wl_listener present; | 61 | struct wl_listener present; |
47 | struct wl_listener damage_destroy; | 62 | struct wl_listener frame; |
48 | struct wl_listener damage_frame; | 63 | struct wl_listener request_state; |
49 | 64 | ||
50 | struct { | 65 | struct { |
51 | struct wl_signal disable; | 66 | struct wl_signal disable; |
@@ -55,6 +70,13 @@ struct sway_output { | |||
55 | uint32_t refresh_nsec; | 70 | uint32_t refresh_nsec; |
56 | int max_render_time; // In milliseconds | 71 | int max_render_time; // In milliseconds |
57 | struct wl_event_source *repaint_timer; | 72 | struct wl_event_source *repaint_timer; |
73 | bool gamma_lut_changed; | ||
74 | }; | ||
75 | |||
76 | struct sway_output_non_desktop { | ||
77 | struct wlr_output *wlr_output; | ||
78 | |||
79 | struct wl_listener destroy; | ||
58 | }; | 80 | }; |
59 | 81 | ||
60 | struct sway_output *output_create(struct wlr_output *wlr_output); | 82 | struct sway_output *output_create(struct wlr_output *wlr_output); |
@@ -75,18 +97,8 @@ typedef void (*sway_surface_iterator_func_t)(struct sway_output *output, | |||
75 | struct sway_view *view, struct wlr_surface *surface, struct wlr_box *box, | 97 | struct sway_view *view, struct wlr_surface *surface, struct wlr_box *box, |
76 | void *user_data); | 98 | void *user_data); |
77 | 99 | ||
78 | void output_damage_whole(struct sway_output *output); | 100 | bool output_match_name_or_id(struct sway_output *output, |
79 | 101 | const char *name_or_id); | |
80 | void output_damage_surface(struct sway_output *output, double ox, double oy, | ||
81 | struct wlr_surface *surface, bool whole); | ||
82 | |||
83 | void output_damage_from_view(struct sway_output *output, | ||
84 | struct sway_view *view); | ||
85 | |||
86 | void output_damage_box(struct sway_output *output, struct wlr_box *box); | ||
87 | |||
88 | void output_damage_whole_container(struct sway_output *output, | ||
89 | struct sway_container *con); | ||
90 | 102 | ||
91 | // this ONLY includes the enabled outputs | 103 | // this ONLY includes the enabled outputs |
92 | struct sway_output *output_by_name_or_id(const char *name_or_id); | 104 | struct sway_output *output_by_name_or_id(const char *name_or_id); |
@@ -100,47 +112,8 @@ void output_enable(struct sway_output *output); | |||
100 | 112 | ||
101 | void output_disable(struct sway_output *output); | 113 | void output_disable(struct sway_output *output); |
102 | 114 | ||
103 | bool output_has_opaque_overlay_layer_surface(struct sway_output *output); | ||
104 | |||
105 | struct sway_workspace *output_get_active_workspace(struct sway_output *output); | 115 | struct sway_workspace *output_get_active_workspace(struct sway_output *output); |
106 | 116 | ||
107 | void output_render(struct sway_output *output, struct timespec *when, | ||
108 | pixman_region32_t *damage); | ||
109 | |||
110 | void output_surface_for_each_surface(struct sway_output *output, | ||
111 | struct wlr_surface *surface, double ox, double oy, | ||
112 | sway_surface_iterator_func_t iterator, void *user_data); | ||
113 | |||
114 | void output_view_for_each_surface(struct sway_output *output, | ||
115 | struct sway_view *view, sway_surface_iterator_func_t iterator, | ||
116 | void *user_data); | ||
117 | |||
118 | void output_view_for_each_popup_surface(struct sway_output *output, | ||
119 | struct sway_view *view, sway_surface_iterator_func_t iterator, | ||
120 | void *user_data); | ||
121 | |||
122 | void output_layer_for_each_surface(struct sway_output *output, | ||
123 | struct wl_list *layer_surfaces, sway_surface_iterator_func_t iterator, | ||
124 | void *user_data); | ||
125 | |||
126 | void output_layer_for_each_toplevel_surface(struct sway_output *output, | ||
127 | struct wl_list *layer_surfaces, sway_surface_iterator_func_t iterator, | ||
128 | void *user_data); | ||
129 | |||
130 | void output_layer_for_each_popup_surface(struct sway_output *output, | ||
131 | struct wl_list *layer_surfaces, sway_surface_iterator_func_t iterator, | ||
132 | void *user_data); | ||
133 | |||
134 | #if HAVE_XWAYLAND | ||
135 | void output_unmanaged_for_each_surface(struct sway_output *output, | ||
136 | struct wl_list *unmanaged, sway_surface_iterator_func_t iterator, | ||
137 | void *user_data); | ||
138 | #endif | ||
139 | |||
140 | void output_drag_icons_for_each_surface(struct sway_output *output, | ||
141 | struct wl_list *drag_icons, sway_surface_iterator_func_t iterator, | ||
142 | void *user_data); | ||
143 | |||
144 | void output_for_each_workspace(struct sway_output *output, | 117 | void output_for_each_workspace(struct sway_output *output, |
145 | void (*f)(struct sway_workspace *ws, void *data), void *data); | 118 | void (*f)(struct sway_workspace *ws, void *data), void *data); |
146 | 119 | ||
@@ -158,18 +131,12 @@ void output_get_box(struct sway_output *output, struct wlr_box *box); | |||
158 | enum sway_container_layout output_get_default_layout( | 131 | enum sway_container_layout output_get_default_layout( |
159 | struct sway_output *output); | 132 | struct sway_output *output); |
160 | 133 | ||
161 | void render_rect(struct sway_output *output, | ||
162 | pixman_region32_t *output_damage, const struct wlr_box *_box, | ||
163 | float color[static 4]); | ||
164 | |||
165 | void premultiply_alpha(float color[4], float opacity); | ||
166 | |||
167 | void scale_box(struct wlr_box *box, float scale); | ||
168 | |||
169 | enum wlr_direction opposite_direction(enum wlr_direction d); | 134 | enum wlr_direction opposite_direction(enum wlr_direction d); |
170 | 135 | ||
171 | void handle_output_layout_change(struct wl_listener *listener, void *data); | 136 | void handle_output_layout_change(struct wl_listener *listener, void *data); |
172 | 137 | ||
138 | void handle_gamma_control_set_gamma(struct wl_listener *listener, void *data); | ||
139 | |||
173 | void handle_output_manager_apply(struct wl_listener *listener, void *data); | 140 | void handle_output_manager_apply(struct wl_listener *listener, void *data); |
174 | 141 | ||
175 | void handle_output_manager_test(struct wl_listener *listener, void *data); | 142 | void handle_output_manager_test(struct wl_listener *listener, void *data); |
@@ -177,4 +144,6 @@ void handle_output_manager_test(struct wl_listener *listener, void *data); | |||
177 | void handle_output_power_manager_set_mode(struct wl_listener *listener, | 144 | void handle_output_power_manager_set_mode(struct wl_listener *listener, |
178 | void *data); | 145 | void *data); |
179 | 146 | ||
147 | struct sway_output_non_desktop *output_non_desktop_create(struct wlr_output *wlr_output); | ||
148 | |||
180 | #endif | 149 | #endif |
diff --git a/include/sway/scene_descriptor.h b/include/sway/scene_descriptor.h new file mode 100644 index 00000000..2649d7c2 --- /dev/null +++ b/include/sway/scene_descriptor.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /** | ||
2 | * Across a wayland compositor, there are multiple shells: It can be | ||
3 | * a toplevel, or a layer_shell, or even something more meta like a drag | ||
4 | * icon or highlight indicators when dragging windows around. | ||
5 | * | ||
6 | * This object lets us store values that represent these modes of operation | ||
7 | * and keep track of what object is being represented. | ||
8 | */ | ||
9 | #ifndef _SWAY_SCENE_DESCRIPTOR_H | ||
10 | #define _SWAY_SCENE_DESCRIPTOR_H | ||
11 | #include <wlr/types/wlr_scene.h> | ||
12 | |||
13 | enum sway_scene_descriptor_type { | ||
14 | SWAY_SCENE_DESC_BUFFER_TIMER, | ||
15 | SWAY_SCENE_DESC_NON_INTERACTIVE, | ||
16 | SWAY_SCENE_DESC_CONTAINER, | ||
17 | SWAY_SCENE_DESC_VIEW, | ||
18 | SWAY_SCENE_DESC_LAYER_SHELL, | ||
19 | SWAY_SCENE_DESC_XWAYLAND_UNMANAGED, | ||
20 | SWAY_SCENE_DESC_POPUP, | ||
21 | SWAY_SCENE_DESC_DRAG_ICON, | ||
22 | }; | ||
23 | |||
24 | bool scene_descriptor_assign(struct wlr_scene_node *node, | ||
25 | enum sway_scene_descriptor_type type, void *data); | ||
26 | |||
27 | void *scene_descriptor_try_get(struct wlr_scene_node *node, | ||
28 | enum sway_scene_descriptor_type type); | ||
29 | |||
30 | void scene_descriptor_destroy(struct wlr_scene_node *node, | ||
31 | enum sway_scene_descriptor_type type); | ||
32 | |||
33 | #endif | ||
diff --git a/include/sway/server.h b/include/sway/server.h index 3d59ca56..c71851f6 100644 --- a/include/sway/server.h +++ b/include/sway/server.h | |||
@@ -2,45 +2,41 @@ | |||
2 | #define _SWAY_SERVER_H | 2 | #define _SWAY_SERVER_H |
3 | #include <stdbool.h> | 3 | #include <stdbool.h> |
4 | #include <wayland-server-core.h> | 4 | #include <wayland-server-core.h> |
5 | #include <wlr/backend.h> | ||
6 | #include <wlr/backend/session.h> | ||
7 | #include <wlr/render/allocator.h> | ||
8 | #include <wlr/render/wlr_renderer.h> | ||
9 | #include <wlr/types/wlr_compositor.h> | ||
10 | #include <wlr/types/wlr_data_device.h> | ||
11 | #include <wlr/types/wlr_input_method_v2.h> | ||
12 | #include <wlr/types/wlr_foreign_toplevel_management_v1.h> | ||
13 | #include <wlr/types/wlr_drm_lease_v1.h> | ||
14 | #include <wlr/types/wlr_layer_shell_v1.h> | ||
15 | #include <wlr/types/wlr_output_management_v1.h> | ||
16 | #include <wlr/types/wlr_output_power_management_v1.h> | ||
17 | #include <wlr/types/wlr_presentation_time.h> | ||
18 | #include <wlr/types/wlr_relative_pointer_v1.h> | ||
19 | #include <wlr/types/wlr_session_lock_v1.h> | ||
20 | #include <wlr/types/wlr_server_decoration.h> | ||
21 | #include <wlr/types/wlr_text_input_v3.h> | ||
22 | #include <wlr/types/wlr_xdg_shell.h> | ||
23 | #include "config.h" | 5 | #include "config.h" |
24 | #include "list.h" | 6 | #include "list.h" |
7 | #include "sway/desktop/idle_inhibit_v1.h" | ||
25 | #if HAVE_XWAYLAND | 8 | #if HAVE_XWAYLAND |
26 | #include "sway/xwayland.h" | 9 | #include "sway/xwayland.h" |
27 | #endif | 10 | #endif |
28 | 11 | ||
29 | struct sway_transaction; | 12 | struct sway_transaction; |
30 | 13 | ||
14 | struct sway_session_lock { | ||
15 | struct wlr_session_lock_v1 *lock; | ||
16 | struct wlr_surface *focused; | ||
17 | bool abandoned; | ||
18 | |||
19 | struct wl_list outputs; // struct sway_session_lock_output | ||
20 | |||
21 | // invalid if the session is abandoned | ||
22 | struct wl_listener new_surface; | ||
23 | struct wl_listener unlock; | ||
24 | struct wl_listener destroy; | ||
25 | }; | ||
26 | |||
31 | struct sway_server { | 27 | struct sway_server { |
32 | struct wl_display *wl_display; | 28 | struct wl_display *wl_display; |
33 | struct wl_event_loop *wl_event_loop; | 29 | struct wl_event_loop *wl_event_loop; |
34 | const char *socket; | 30 | const char *socket; |
35 | 31 | ||
36 | struct wlr_backend *backend; | 32 | struct wlr_backend *backend; |
33 | struct wlr_session *session; | ||
37 | // secondary headless backend used for creating virtual outputs on-the-fly | 34 | // secondary headless backend used for creating virtual outputs on-the-fly |
38 | struct wlr_backend *headless_backend; | 35 | struct wlr_backend *headless_backend; |
39 | struct wlr_renderer *renderer; | 36 | struct wlr_renderer *renderer; |
40 | struct wlr_allocator *allocator; | 37 | struct wlr_allocator *allocator; |
41 | 38 | ||
42 | struct wlr_compositor *compositor; | 39 | struct wlr_compositor *compositor; |
43 | struct wl_listener compositor_new_surface; | ||
44 | 40 | ||
45 | struct wlr_linux_dmabuf_v1 *linux_dmabuf_v1; | 41 | struct wlr_linux_dmabuf_v1 *linux_dmabuf_v1; |
46 | 42 | ||
@@ -50,15 +46,16 @@ struct sway_server { | |||
50 | 46 | ||
51 | struct wl_listener new_output; | 47 | struct wl_listener new_output; |
52 | struct wl_listener output_layout_change; | 48 | struct wl_listener output_layout_change; |
49 | struct wl_listener renderer_lost; | ||
53 | 50 | ||
54 | struct wlr_idle *idle; | 51 | struct wlr_idle_notifier_v1 *idle_notifier_v1; |
55 | struct sway_idle_inhibit_manager_v1 *idle_inhibit_manager_v1; | 52 | struct sway_idle_inhibit_manager_v1 idle_inhibit_manager_v1; |
56 | 53 | ||
57 | struct wlr_layer_shell_v1 *layer_shell; | 54 | struct wlr_layer_shell_v1 *layer_shell; |
58 | struct wl_listener layer_shell_surface; | 55 | struct wl_listener layer_shell_surface; |
59 | 56 | ||
60 | struct wlr_xdg_shell *xdg_shell; | 57 | struct wlr_xdg_shell *xdg_shell; |
61 | struct wl_listener xdg_shell_surface; | 58 | struct wl_listener xdg_shell_toplevel; |
62 | 59 | ||
63 | struct wlr_tablet_manager_v2 *tablet_v2; | 60 | struct wlr_tablet_manager_v2 *tablet_v2; |
64 | 61 | ||
@@ -81,8 +78,6 @@ struct sway_server { | |||
81 | struct wlr_drm_lease_v1_manager *drm_lease_manager; | 78 | struct wlr_drm_lease_v1_manager *drm_lease_manager; |
82 | struct wl_listener drm_lease_request; | 79 | struct wl_listener drm_lease_request; |
83 | 80 | ||
84 | struct wlr_presentation *presentation; | ||
85 | |||
86 | struct wlr_pointer_constraints_v1 *pointer_constraints; | 81 | struct wlr_pointer_constraints_v1 *pointer_constraints; |
87 | struct wl_listener pointer_constraint; | 82 | struct wl_listener pointer_constraint; |
88 | 83 | ||
@@ -90,15 +85,13 @@ struct sway_server { | |||
90 | struct wl_listener output_manager_apply; | 85 | struct wl_listener output_manager_apply; |
91 | struct wl_listener output_manager_test; | 86 | struct wl_listener output_manager_test; |
92 | 87 | ||
88 | struct wlr_gamma_control_manager_v1 *gamma_control_manager_v1; | ||
89 | struct wl_listener gamma_control_set_gamma; | ||
90 | |||
93 | struct { | 91 | struct { |
94 | bool locked; | 92 | struct sway_session_lock *lock; |
95 | struct wlr_session_lock_manager_v1 *manager; | 93 | struct wlr_session_lock_manager_v1 *manager; |
96 | 94 | ||
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; | 95 | struct wl_listener new_lock; |
103 | struct wl_listener manager_destroy; | 96 | struct wl_listener manager_destroy; |
104 | } session_lock; | 97 | } session_lock; |
@@ -107,10 +100,21 @@ struct sway_server { | |||
107 | struct wl_listener output_power_manager_set_mode; | 100 | struct wl_listener output_power_manager_set_mode; |
108 | struct wlr_input_method_manager_v2 *input_method; | 101 | struct wlr_input_method_manager_v2 *input_method; |
109 | 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; | ||
110 | struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager; | 104 | struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager; |
105 | struct wlr_content_type_manager_v1 *content_type_manager_v1; | ||
106 | struct wlr_data_control_manager_v1 *data_control_manager_v1; | ||
107 | struct wlr_screencopy_manager_v1 *screencopy_manager_v1; | ||
108 | struct wlr_export_dmabuf_manager_v1 *export_dmabuf_manager_v1; | ||
109 | struct wlr_security_context_manager_v1 *security_context_manager_v1; | ||
111 | 110 | ||
112 | struct wlr_xdg_activation_v1 *xdg_activation_v1; | 111 | struct wlr_xdg_activation_v1 *xdg_activation_v1; |
113 | struct wl_listener xdg_activation_v1_request_activate; | 112 | struct wl_listener xdg_activation_v1_request_activate; |
113 | struct wl_listener xdg_activation_v1_new_token; | ||
114 | |||
115 | struct wl_listener request_set_cursor_shape; | ||
116 | |||
117 | struct wl_list pending_launcher_ctxs; // launcher_ctx::link | ||
114 | 118 | ||
115 | // The timeout for transactions, after which a transaction is applied | 119 | // The timeout for transactions, after which a transaction is applied |
116 | // regardless of readiness. | 120 | // regardless of readiness. |
@@ -137,19 +141,13 @@ struct sway_debug { | |||
137 | bool noatomic; // Ignore atomic layout updates | 141 | bool noatomic; // Ignore atomic layout updates |
138 | bool txn_timings; // Log verbose messages about transactions | 142 | bool txn_timings; // Log verbose messages about transactions |
139 | bool txn_wait; // Always wait for the timeout before applying | 143 | bool txn_wait; // Always wait for the timeout before applying |
140 | bool noscanout; // Disable direct scan-out | 144 | bool legacy_wl_drm; // Enable the legacy wl_drm interface |
141 | |||
142 | enum { | ||
143 | DAMAGE_DEFAULT, // Default behaviour | ||
144 | DAMAGE_HIGHLIGHT, // Highlight regions of the screen being damaged | ||
145 | DAMAGE_RERENDER, // Render the full output when any damage occurs | ||
146 | } damage; | ||
147 | }; | 145 | }; |
148 | 146 | ||
149 | extern struct sway_debug debug; | 147 | extern struct sway_debug debug; |
150 | 148 | ||
151 | /* Prepares an unprivileged server_init by performing all privileged operations in advance */ | 149 | extern bool allow_unsupported_gpu; |
152 | bool server_privileged_prepare(struct sway_server *server); | 150 | |
153 | bool server_init(struct sway_server *server); | 151 | bool server_init(struct sway_server *server); |
154 | void server_fini(struct sway_server *server); | 152 | void server_fini(struct sway_server *server); |
155 | bool server_start(struct sway_server *server); | 153 | bool server_start(struct sway_server *server); |
@@ -157,13 +155,16 @@ void server_run(struct sway_server *server); | |||
157 | 155 | ||
158 | void restore_nofile_limit(void); | 156 | void restore_nofile_limit(void); |
159 | 157 | ||
160 | void handle_compositor_new_surface(struct wl_listener *listener, void *data); | ||
161 | void handle_new_output(struct wl_listener *listener, void *data); | 158 | void handle_new_output(struct wl_listener *listener, void *data); |
162 | 159 | ||
163 | void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data); | 160 | void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data); |
164 | void handle_layer_shell_surface(struct wl_listener *listener, void *data); | 161 | void handle_layer_shell_surface(struct wl_listener *listener, void *data); |
165 | void sway_session_lock_init(void); | 162 | void sway_session_lock_init(void); |
166 | void handle_xdg_shell_surface(struct wl_listener *listener, void *data); | 163 | void sway_session_lock_add_output(struct sway_session_lock *lock, |
164 | struct sway_output *output); | ||
165 | bool sway_session_lock_has_surface(struct sway_session_lock *lock, | ||
166 | struct wlr_surface *surface); | ||
167 | void handle_xdg_shell_toplevel(struct wl_listener *listener, void *data); | ||
167 | #if HAVE_XWAYLAND | 168 | #if HAVE_XWAYLAND |
168 | void handle_xwayland_surface(struct wl_listener *listener, void *data); | 169 | void handle_xwayland_surface(struct wl_listener *listener, void *data); |
169 | #endif | 170 | #endif |
@@ -172,6 +173,8 @@ void handle_xdg_decoration(struct wl_listener *listener, void *data); | |||
172 | void handle_pointer_constraint(struct wl_listener *listener, void *data); | 173 | void handle_pointer_constraint(struct wl_listener *listener, void *data); |
173 | void xdg_activation_v1_handle_request_activate(struct wl_listener *listener, | 174 | void xdg_activation_v1_handle_request_activate(struct wl_listener *listener, |
174 | void *data); | 175 | void *data); |
176 | void xdg_activation_v1_handle_new_token(struct wl_listener *listener, | ||
177 | void *data); | ||
175 | 178 | ||
176 | void set_rr_scheduling(void); | 179 | void set_rr_scheduling(void); |
177 | 180 | ||
diff --git a/include/sway/surface.h b/include/sway/surface.h deleted file mode 100644 index fb1cd775..00000000 --- a/include/sway/surface.h +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | #ifndef _SWAY_SURFACE_H | ||
2 | #define _SWAY_SURFACE_H | ||
3 | #include <wlr/types/wlr_compositor.h> | ||
4 | |||
5 | struct sway_surface { | ||
6 | struct wlr_surface *wlr_surface; | ||
7 | |||
8 | struct wl_listener destroy; | ||
9 | |||
10 | /** | ||
11 | * This timer can be used for issuing delayed frame done callbacks (for | ||
12 | * example, to improve presentation latency). Its handler is set to a | ||
13 | * function that issues a frame done callback to this surface. | ||
14 | */ | ||
15 | struct wl_event_source *frame_done_timer; | ||
16 | }; | ||
17 | |||
18 | #endif | ||
diff --git a/include/sway/sway_text_node.h b/include/sway/sway_text_node.h new file mode 100644 index 00000000..0d4209bb --- /dev/null +++ b/include/sway/sway_text_node.h | |||
@@ -0,0 +1,28 @@ | |||
1 | #ifndef _SWAY_BUFFER_H | ||
2 | #define _SWAY_BUFFER_H | ||
3 | #include <wlr/types/wlr_scene.h> | ||
4 | |||
5 | struct sway_text_node { | ||
6 | int width; | ||
7 | int max_width; | ||
8 | int height; | ||
9 | int baseline; | ||
10 | bool pango_markup; | ||
11 | float color[4]; | ||
12 | float background[4]; | ||
13 | |||
14 | struct wlr_scene_node *node; | ||
15 | }; | ||
16 | |||
17 | struct sway_text_node *sway_text_node_create(struct wlr_scene_tree *parent, | ||
18 | char *text, float color[4], bool pango_markup); | ||
19 | |||
20 | void sway_text_node_set_color(struct sway_text_node *node, float color[4]); | ||
21 | |||
22 | void sway_text_node_set_text(struct sway_text_node *node, char *text); | ||
23 | |||
24 | void sway_text_node_set_max_width(struct sway_text_node *node, int max_width); | ||
25 | |||
26 | void sway_text_node_set_background(struct sway_text_node *node, float background[4]); | ||
27 | |||
28 | #endif | ||
diff --git a/include/sway/swaynag.h b/include/sway/swaynag.h index 74d9ea18..03bd52c3 100644 --- a/include/sway/swaynag.h +++ b/include/sway/swaynag.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef _SWAY_SWAYNAG_H | 1 | #ifndef _SWAY_SWAYNAG_H |
2 | #define _SWAY_SWAYNAG_H | 2 | #define _SWAY_SWAYNAG_H |
3 | #include <wayland-server-core.h> | 3 | #include <wayland-server-core.h> |
4 | #include "stringop.h" | ||
4 | 5 | ||
5 | struct swaynag_instance { | 6 | struct swaynag_instance { |
6 | struct wl_client *client; | 7 | struct wl_client *client; |
@@ -21,7 +22,7 @@ bool swaynag_spawn(const char *swaynag_command, | |||
21 | // Write a log message to swaynag->fd[1]. This will fail when swaynag->detailed | 22 | // Write a log message to swaynag->fd[1]. This will fail when swaynag->detailed |
22 | // is false. | 23 | // is false. |
23 | void swaynag_log(const char *swaynag_command, struct swaynag_instance *swaynag, | 24 | void swaynag_log(const char *swaynag_command, struct swaynag_instance *swaynag, |
24 | const char *fmt, ...); | 25 | const char *fmt, ...) _SWAY_ATTRIB_PRINTF(3, 4); |
25 | 26 | ||
26 | // If swaynag->detailed, close swaynag->fd[1] so swaynag displays | 27 | // If swaynag->detailed, close swaynag->fd[1] so swaynag displays |
27 | void swaynag_show(struct swaynag_instance *swaynag); | 28 | void swaynag_show(struct swaynag_instance *swaynag); |
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index 751612e2..93f6bfbb 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <stdint.h> | 3 | #include <stdint.h> |
4 | #include <sys/types.h> | 4 | #include <sys/types.h> |
5 | #include <wlr/types/wlr_compositor.h> | 5 | #include <wlr/types/wlr_compositor.h> |
6 | #include <wlr/types/wlr_scene.h> | ||
6 | #include "list.h" | 7 | #include "list.h" |
7 | #include "sway/tree/node.h" | 8 | #include "sway/tree/node.h" |
8 | 9 | ||
@@ -68,11 +69,39 @@ struct sway_container { | |||
68 | struct sway_node node; | 69 | struct sway_node node; |
69 | struct sway_view *view; | 70 | struct sway_view *view; |
70 | 71 | ||
72 | struct wlr_scene_tree *scene_tree; | ||
73 | |||
74 | struct { | ||
75 | struct wlr_scene_tree *tree; | ||
76 | |||
77 | struct wlr_scene_tree *border; | ||
78 | struct wlr_scene_tree *background; | ||
79 | |||
80 | struct sway_text_node *title_text; | ||
81 | struct sway_text_node *marks_text; | ||
82 | } title_bar; | ||
83 | |||
84 | struct { | ||
85 | struct wlr_scene_tree *tree; | ||
86 | |||
87 | struct wlr_scene_rect *top; | ||
88 | struct wlr_scene_rect *bottom; | ||
89 | struct wlr_scene_rect *left; | ||
90 | struct wlr_scene_rect *right; | ||
91 | } border; | ||
92 | |||
93 | struct wlr_scene_tree *content_tree; | ||
94 | struct wlr_scene_buffer *output_handler; | ||
95 | |||
96 | struct wl_listener output_enter; | ||
97 | struct wl_listener output_leave; | ||
98 | |||
71 | struct sway_container_state current; | 99 | struct sway_container_state current; |
72 | struct sway_container_state pending; | 100 | struct sway_container_state pending; |
73 | 101 | ||
74 | char *title; // The view's title (unformatted) | 102 | char *title; // The view's title (unformatted) |
75 | char *formatted_title; // The title displayed in the title bar | 103 | char *formatted_title; // The title displayed in the title bar |
104 | int title_width; | ||
76 | 105 | ||
77 | enum sway_container_layout prev_split_layout; | 106 | enum sway_container_layout prev_split_layout; |
78 | 107 | ||
@@ -100,33 +129,19 @@ struct sway_container { | |||
100 | double child_total_width; | 129 | double child_total_width; |
101 | double child_total_height; | 130 | double child_total_height; |
102 | 131 | ||
103 | // In most cases this is the same as the content x and y, but if the view | ||
104 | // refuses to resize to the content dimensions then it can be smaller. | ||
105 | // These are in layout coordinates. | ||
106 | double surface_x, surface_y; | ||
107 | |||
108 | // Outputs currently being intersected | ||
109 | list_t *outputs; // struct sway_output | ||
110 | |||
111 | // Indicates that the container is a scratchpad container. | 132 | // Indicates that the container is a scratchpad container. |
112 | // Both hidden and visible scratchpad containers have scratchpad=true. | 133 | // Both hidden and visible scratchpad containers have scratchpad=true. |
113 | // Hidden scratchpad containers have a NULL parent. | 134 | // Hidden scratchpad containers have a NULL parent. |
114 | bool scratchpad; | 135 | bool scratchpad; |
115 | 136 | ||
116 | float alpha; | 137 | // Stores last output size and position for adjusting coordinates of |
138 | // scratchpad windows. | ||
139 | // Unused for non-scratchpad windows. | ||
140 | struct wlr_box transform; | ||
117 | 141 | ||
118 | struct wlr_texture *title_focused; | 142 | float alpha; |
119 | struct wlr_texture *title_focused_inactive; | ||
120 | struct wlr_texture *title_focused_tab_title; | ||
121 | struct wlr_texture *title_unfocused; | ||
122 | struct wlr_texture *title_urgent; | ||
123 | 143 | ||
124 | list_t *marks; // char * | 144 | list_t *marks; // char * |
125 | struct wlr_texture *marks_focused; | ||
126 | struct wlr_texture *marks_focused_inactive; | ||
127 | struct wlr_texture *marks_focused_tab_title; | ||
128 | struct wlr_texture *marks_unfocused; | ||
129 | struct wlr_texture *marks_urgent; | ||
130 | 145 | ||
131 | struct { | 146 | struct { |
132 | struct wl_signal destroy; | 147 | struct wl_signal destroy; |
@@ -146,19 +161,6 @@ void container_begin_destroy(struct sway_container *con); | |||
146 | struct sway_container *container_find_child(struct sway_container *container, | 161 | struct sway_container *container_find_child(struct sway_container *container, |
147 | bool (*test)(struct sway_container *view, void *data), void *data); | 162 | bool (*test)(struct sway_container *view, void *data), void *data); |
148 | 163 | ||
149 | /** | ||
150 | * Find a container at the given coordinates. Returns the surface and | ||
151 | * surface-local coordinates of the given layout coordinates if the container | ||
152 | * is a view and the view contains a surface at those coordinates. | ||
153 | */ | ||
154 | struct sway_container *container_at(struct sway_workspace *workspace, | ||
155 | double lx, double ly, struct wlr_surface **surface, | ||
156 | double *sx, double *sy); | ||
157 | |||
158 | struct sway_container *tiling_container_at( | ||
159 | struct sway_node *parent, double lx, double ly, | ||
160 | struct wlr_surface **surface, double *sx, double *sy); | ||
161 | |||
162 | void container_for_each_child(struct sway_container *container, | 164 | void container_for_each_child(struct sway_container *container, |
163 | void (*f)(struct sway_container *container, void *data), void *data); | 165 | void (*f)(struct sway_container *container, void *data), void *data); |
164 | 166 | ||
@@ -175,13 +177,13 @@ bool container_has_ancestor(struct sway_container *container, | |||
175 | 177 | ||
176 | void container_update_textures_recursive(struct sway_container *con); | 178 | void container_update_textures_recursive(struct sway_container *con); |
177 | 179 | ||
178 | void container_damage_whole(struct sway_container *container); | ||
179 | |||
180 | void container_reap_empty(struct sway_container *con); | 180 | void container_reap_empty(struct sway_container *con); |
181 | 181 | ||
182 | struct sway_container *container_flatten(struct sway_container *container); | 182 | struct sway_container *container_flatten(struct sway_container *container); |
183 | 183 | ||
184 | void container_update_title_textures(struct sway_container *container); | 184 | void container_update_title_bar(struct sway_container *container); |
185 | |||
186 | void container_update_marks(struct sway_container *container); | ||
185 | 187 | ||
186 | size_t container_build_representation(enum sway_container_layout layout, | 188 | size_t container_build_representation(enum sway_container_layout layout, |
187 | list_t *children, char *buffer); | 189 | list_t *children, char *buffer); |
@@ -196,6 +198,9 @@ size_t container_titlebar_height(void); | |||
196 | void floating_calculate_constraints(int *min_width, int *max_width, | 198 | void floating_calculate_constraints(int *min_width, int *max_width, |
197 | int *min_height, int *max_height); | 199 | int *min_height, int *max_height); |
198 | 200 | ||
201 | void floating_fix_coordinates(struct sway_container *con, | ||
202 | struct wlr_box *old, struct wlr_box *new); | ||
203 | |||
199 | void container_floating_resize_and_center(struct sway_container *con); | 204 | void container_floating_resize_and_center(struct sway_container *con); |
200 | 205 | ||
201 | void container_floating_set_default_size(struct sway_container *con); | 206 | void container_floating_set_default_size(struct sway_container *con); |
@@ -215,11 +220,6 @@ void container_set_geometry_from_content(struct sway_container *con); | |||
215 | bool container_is_floating(struct sway_container *container); | 220 | bool container_is_floating(struct sway_container *container); |
216 | 221 | ||
217 | /** | 222 | /** |
218 | * Same as above, but for current container state. | ||
219 | */ | ||
220 | bool container_is_current_floating(struct sway_container *container); | ||
221 | |||
222 | /** | ||
223 | * Get a container's box in layout coordinates. | 223 | * Get a container's box in layout coordinates. |
224 | */ | 224 | */ |
225 | void container_get_box(struct sway_container *container, struct wlr_box *box); | 225 | void container_get_box(struct sway_container *container, struct wlr_box *box); |
@@ -281,26 +281,12 @@ bool container_is_floating_or_child(struct sway_container *container); | |||
281 | */ | 281 | */ |
282 | bool container_is_fullscreen_or_child(struct sway_container *container); | 282 | bool container_is_fullscreen_or_child(struct sway_container *container); |
283 | 283 | ||
284 | /** | ||
285 | * Return the output which will be used for scale purposes. | ||
286 | * This is the most recently entered output. | ||
287 | * If the container is not on any output, return NULL. | ||
288 | */ | ||
289 | struct sway_output *container_get_effective_output(struct sway_container *con); | ||
290 | |||
291 | void container_discover_outputs(struct sway_container *con); | ||
292 | |||
293 | enum sway_container_layout container_parent_layout(struct sway_container *con); | 284 | enum sway_container_layout container_parent_layout(struct sway_container *con); |
294 | 285 | ||
295 | enum sway_container_layout container_current_parent_layout( | ||
296 | struct sway_container *con); | ||
297 | |||
298 | list_t *container_get_siblings(struct sway_container *container); | 286 | list_t *container_get_siblings(struct sway_container *container); |
299 | 287 | ||
300 | int container_sibling_index(struct sway_container *child); | 288 | int container_sibling_index(struct sway_container *child); |
301 | 289 | ||
302 | list_t *container_get_current_siblings(struct sway_container *container); | ||
303 | |||
304 | void container_handle_fullscreen_reparent(struct sway_container *con); | 290 | void container_handle_fullscreen_reparent(struct sway_container *con); |
305 | 291 | ||
306 | void container_add_child(struct sway_container *parent, | 292 | void container_add_child(struct sway_container *parent, |
@@ -348,8 +334,6 @@ bool container_has_mark(struct sway_container *container, char *mark); | |||
348 | 334 | ||
349 | void container_add_mark(struct sway_container *container, char *mark); | 335 | void container_add_mark(struct sway_container *container, char *mark); |
350 | 336 | ||
351 | void container_update_marks_textures(struct sway_container *container); | ||
352 | |||
353 | void container_raise_floating(struct sway_container *con); | 337 | void container_raise_floating(struct sway_container *con); |
354 | 338 | ||
355 | bool container_is_scratchpad_hidden(struct sway_container *con); | 339 | bool container_is_scratchpad_hidden(struct sway_container *con); |
@@ -373,4 +357,10 @@ bool container_is_sticky_or_child(struct sway_container *con); | |||
373 | */ | 357 | */ |
374 | int container_squash(struct sway_container *con); | 358 | int container_squash(struct sway_container *con); |
375 | 359 | ||
360 | void container_arrange_title_bar(struct sway_container *con); | ||
361 | |||
362 | void container_update(struct sway_container *con); | ||
363 | |||
364 | void container_update_itself_and_parents(struct sway_container *con); | ||
365 | |||
376 | #endif | 366 | #endif |
diff --git a/include/sway/tree/node.h b/include/sway/tree/node.h index 470ee3b5..e2dbcdf0 100644 --- a/include/sway/tree/node.h +++ b/include/sway/tree/node.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _SWAY_NODE_H | 1 | #ifndef _SWAY_NODE_H |
2 | #define _SWAY_NODE_H | 2 | #define _SWAY_NODE_H |
3 | #include <wayland-server-core.h> | ||
3 | #include <stdbool.h> | 4 | #include <stdbool.h> |
5 | #include <wlr/types/wlr_scene.h> | ||
4 | #include "list.h" | 6 | #include "list.h" |
5 | 7 | ||
6 | #define MIN_SANE_W 100 | 8 | #define MIN_SANE_W 100 |
@@ -74,4 +76,15 @@ list_t *node_get_children(struct sway_node *node); | |||
74 | 76 | ||
75 | bool node_has_ancestor(struct sway_node *node, struct sway_node *ancestor); | 77 | bool node_has_ancestor(struct sway_node *node, struct sway_node *ancestor); |
76 | 78 | ||
79 | // when destroying a sway tree, it's not known which order the tree will be | ||
80 | // destroyed. To prevent freeing of scene_nodes recursing up the tree, | ||
81 | // let's use this helper function to disown them to the staging node. | ||
82 | void scene_node_disown_children(struct wlr_scene_tree *tree); | ||
83 | |||
84 | // a helper function used to allocate tree nodes. If an allocation failure | ||
85 | // occurs a flag is flipped that can be checked later to destroy a parent | ||
86 | // of this scene node preventing memory leaks. | ||
87 | struct wlr_scene_tree *alloc_scene_tree(struct wlr_scene_tree *parent, | ||
88 | bool *failed); | ||
89 | |||
77 | #endif | 90 | #endif |
diff --git a/include/sway/tree/root.h b/include/sway/tree/root.h index 5d4a2f2d..15df0f55 100644 --- a/include/sway/tree/root.h +++ b/include/sway/tree/root.h | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <wayland-server-core.h> | 3 | #include <wayland-server-core.h> |
4 | #include <wayland-util.h> | 4 | #include <wayland-util.h> |
5 | #include <wlr/types/wlr_output_layout.h> | 5 | #include <wlr/types/wlr_output_layout.h> |
6 | #include <wlr/types/wlr_scene.h> | ||
6 | #include <wlr/render/wlr_texture.h> | 7 | #include <wlr/render/wlr_texture.h> |
7 | #include "sway/tree/container.h" | 8 | #include "sway/tree/container.h" |
8 | #include "sway/tree/node.h" | 9 | #include "sway/tree/node.h" |
@@ -16,10 +17,44 @@ struct sway_root { | |||
16 | struct wlr_output_layout *output_layout; | 17 | struct wlr_output_layout *output_layout; |
17 | 18 | ||
18 | struct wl_listener output_layout_change; | 19 | struct wl_listener output_layout_change; |
20 | |||
21 | // scene node layout: | ||
22 | // - root | ||
23 | // - staging | ||
24 | // - layer shell stuff | ||
25 | // - tiling | ||
26 | // - floating | ||
27 | // - fullscreen stuff | ||
28 | // - seat stuff | ||
29 | // - ext_session_lock | ||
30 | struct wlr_scene *root_scene; | ||
31 | |||
32 | // since wlr_scene nodes can't be orphaned and must always | ||
33 | // have a parent, use this staging scene_tree so that a | ||
34 | // node always have a valid parent. Nothing in this | ||
35 | // staging node will be visible. | ||
36 | struct wlr_scene_tree *staging; | ||
37 | |||
38 | // tree containing all layers the compositor will render. Cursor handling | ||
39 | // will end up iterating this tree. | ||
40 | struct wlr_scene_tree *layer_tree; | ||
41 | |||
42 | struct { | ||
43 | struct wlr_scene_tree *shell_background; | ||
44 | struct wlr_scene_tree *shell_bottom; | ||
45 | struct wlr_scene_tree *tiling; | ||
46 | struct wlr_scene_tree *floating; | ||
47 | struct wlr_scene_tree *shell_top; | ||
48 | struct wlr_scene_tree *fullscreen; | ||
49 | struct wlr_scene_tree *fullscreen_global; | ||
19 | #if HAVE_XWAYLAND | 50 | #if HAVE_XWAYLAND |
20 | struct wl_list xwayland_unmanaged; // sway_xwayland_unmanaged::link | 51 | struct wlr_scene_tree *unmanaged; |
21 | #endif | 52 | #endif |
22 | struct wl_list drag_icons; // sway_drag_icon::link | 53 | struct wlr_scene_tree *shell_overlay; |
54 | struct wlr_scene_tree *popup; | ||
55 | struct wlr_scene_tree *seat; | ||
56 | struct wlr_scene_tree *session_lock; | ||
57 | } layers; | ||
23 | 58 | ||
24 | // Includes disabled outputs | 59 | // Includes disabled outputs |
25 | struct wl_list all_outputs; // sway_output::link | 60 | struct wl_list all_outputs; // sway_output::link |
@@ -28,6 +63,7 @@ struct sway_root { | |||
28 | double width, height; | 63 | double width, height; |
29 | 64 | ||
30 | list_t *outputs; // struct sway_output | 65 | list_t *outputs; // struct sway_output |
66 | list_t *non_desktop_outputs; // struct sway_output_non_desktop | ||
31 | list_t *scratchpad; // struct sway_container | 67 | list_t *scratchpad; // struct sway_container |
32 | 68 | ||
33 | // For when there's no connected outputs | 69 | // For when there's no connected outputs |
@@ -40,7 +76,7 @@ struct sway_root { | |||
40 | } events; | 76 | } events; |
41 | }; | 77 | }; |
42 | 78 | ||
43 | struct sway_root *root_create(void); | 79 | struct sway_root *root_create(struct wl_display *display); |
44 | 80 | ||
45 | void root_destroy(struct sway_root *root); | 81 | void root_destroy(struct sway_root *root); |
46 | 82 | ||
@@ -68,12 +104,6 @@ void root_scratchpad_show(struct sway_container *con); | |||
68 | */ | 104 | */ |
69 | void root_scratchpad_hide(struct sway_container *con); | 105 | void root_scratchpad_hide(struct sway_container *con); |
70 | 106 | ||
71 | struct sway_workspace *root_workspace_for_pid(pid_t pid); | ||
72 | |||
73 | void root_record_workspace_pid(pid_t pid); | ||
74 | |||
75 | void root_remove_workspace_pid(pid_t pid); | ||
76 | |||
77 | void root_for_each_workspace(void (*f)(struct sway_workspace *ws, void *data), | 107 | void root_for_each_workspace(void (*f)(struct sway_workspace *ws, void *data), |
78 | void *data); | 108 | void *data); |
79 | 109 | ||
@@ -91,6 +121,4 @@ struct sway_container *root_find_container( | |||
91 | 121 | ||
92 | void root_get_box(struct sway_root *root, struct wlr_box *box); | 122 | void root_get_box(struct sway_root *root, struct wlr_box *box); |
93 | 123 | ||
94 | void root_rename_pid_workspaces(const char *old_name, const char *new_name); | ||
95 | |||
96 | #endif | 124 | #endif |
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index 95708a04..7faacdcc 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h | |||
@@ -2,7 +2,8 @@ | |||
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_compositor.h> | 4 | #include <wlr/types/wlr_compositor.h> |
5 | #include "config.h" | 5 | #include <wlr/types/wlr_scene.h> |
6 | #include "sway/config.h" | ||
6 | #if HAVE_XWAYLAND | 7 | #if HAVE_XWAYLAND |
7 | #include <wlr/xwayland.h> | 8 | #include <wlr/xwayland.h> |
8 | #endif | 9 | #endif |
@@ -45,10 +46,6 @@ struct sway_view_impl { | |||
45 | void (*set_fullscreen)(struct sway_view *view, bool fullscreen); | 46 | void (*set_fullscreen)(struct sway_view *view, bool fullscreen); |
46 | void (*set_resizing)(struct sway_view *view, bool resizing); | 47 | void (*set_resizing)(struct sway_view *view, bool resizing); |
47 | bool (*wants_floating)(struct sway_view *view); | 48 | bool (*wants_floating)(struct sway_view *view); |
48 | void (*for_each_surface)(struct sway_view *view, | ||
49 | wlr_surface_iterator_func_t iterator, void *user_data); | ||
50 | void (*for_each_popup_surface)(struct sway_view *view, | ||
51 | wlr_surface_iterator_func_t iterator, void *user_data); | ||
52 | bool (*is_transient_for)(struct sway_view *child, | 49 | bool (*is_transient_for)(struct sway_view *child, |
53 | struct sway_view *ancestor); | 50 | struct sway_view *ancestor); |
54 | void (*close)(struct sway_view *view); | 51 | void (*close)(struct sway_view *view); |
@@ -56,24 +53,20 @@ struct sway_view_impl { | |||
56 | void (*destroy)(struct sway_view *view); | 53 | void (*destroy)(struct sway_view *view); |
57 | }; | 54 | }; |
58 | 55 | ||
59 | struct sway_saved_buffer { | ||
60 | struct wlr_client_buffer *buffer; | ||
61 | int x, y; | ||
62 | int width, height; | ||
63 | enum wl_output_transform transform; | ||
64 | struct wlr_fbox source_box; | ||
65 | struct wl_list link; // sway_view::saved_buffers | ||
66 | }; | ||
67 | |||
68 | struct sway_view { | 56 | struct sway_view { |
69 | enum sway_view_type type; | 57 | enum sway_view_type type; |
70 | const struct sway_view_impl *impl; | 58 | const struct sway_view_impl *impl; |
71 | 59 | ||
60 | struct wlr_scene_tree *scene_tree; | ||
61 | struct wlr_scene_tree *content_tree; | ||
62 | struct wlr_scene_tree *saved_surface_tree; | ||
63 | |||
72 | struct sway_container *container; // NULL if unmapped and transactions finished | 64 | struct sway_container *container; // NULL if unmapped and transactions finished |
73 | struct wlr_surface *surface; // NULL for unmapped views | 65 | struct wlr_surface *surface; // NULL for unmapped views |
74 | struct sway_xdg_decoration *xdg_decoration; | 66 | struct sway_xdg_decoration *xdg_decoration; |
75 | 67 | ||
76 | pid_t pid; | 68 | pid_t pid; |
69 | struct launcher_ctx *ctx; | ||
77 | 70 | ||
78 | // The size the view would want to be if it weren't tiled. | 71 | // The size the view would want to be if it weren't tiled. |
79 | // Used when changing a view from tiled to floating. | 72 | // Used when changing a view from tiled to floating. |
@@ -87,15 +80,11 @@ struct sway_view { | |||
87 | bool allow_request_urgent; | 80 | bool allow_request_urgent; |
88 | struct wl_event_source *urgent_timer; | 81 | struct wl_event_source *urgent_timer; |
89 | 82 | ||
90 | struct wl_list saved_buffers; // sway_saved_buffer::link | ||
91 | |||
92 | // The geometry for whatever the client is committing, regardless of | 83 | // The geometry for whatever the client is committing, regardless of |
93 | // transaction state. Updated on every commit. | 84 | // transaction state. Updated on every commit. |
94 | struct wlr_box geometry; | 85 | struct wlr_box geometry; |
95 | 86 | ||
96 | // The "old" geometry during a transaction. Used to damage the old location | 87 | struct wlr_ext_foreign_toplevel_handle_v1 *ext_foreign_toplevel; |
97 | // when a transaction is applied. | ||
98 | struct wlr_box saved_geometry; | ||
99 | 88 | ||
100 | struct wlr_foreign_toplevel_handle_v1 *foreign_toplevel; | 89 | struct wlr_foreign_toplevel_handle_v1 *foreign_toplevel; |
101 | struct wl_listener foreign_activate_request; | 90 | struct wl_listener foreign_activate_request; |
@@ -118,8 +107,6 @@ struct sway_view { | |||
118 | struct wl_signal unmap; | 107 | struct wl_signal unmap; |
119 | } events; | 108 | } events; |
120 | 109 | ||
121 | struct wl_listener surface_new_subsurface; | ||
122 | |||
123 | int max_render_time; // In milliseconds | 110 | int max_render_time; // In milliseconds |
124 | 111 | ||
125 | enum seat_config_shortcuts_inhibit shortcuts_inhibit; | 112 | enum seat_config_shortcuts_inhibit shortcuts_inhibit; |
@@ -131,6 +118,7 @@ struct sway_xdg_shell_view { | |||
131 | struct wl_listener commit; | 118 | struct wl_listener commit; |
132 | struct wl_listener request_move; | 119 | struct wl_listener request_move; |
133 | struct wl_listener request_resize; | 120 | struct wl_listener request_resize; |
121 | struct wl_listener request_maximize; | ||
134 | struct wl_listener request_fullscreen; | 122 | struct wl_listener request_fullscreen; |
135 | struct wl_listener set_title; | 123 | struct wl_listener set_title; |
136 | struct wl_listener set_app_id; | 124 | struct wl_listener set_app_id; |
@@ -143,6 +131,8 @@ struct sway_xdg_shell_view { | |||
143 | struct sway_xwayland_view { | 131 | struct sway_xwayland_view { |
144 | struct sway_view view; | 132 | struct sway_view view; |
145 | 133 | ||
134 | struct wlr_scene_tree *surface_tree; | ||
135 | |||
146 | struct wl_listener commit; | 136 | struct wl_listener commit; |
147 | struct wl_listener request_move; | 137 | struct wl_listener request_move; |
148 | struct wl_listener request_resize; | 138 | struct wl_listener request_resize; |
@@ -154,72 +144,55 @@ struct sway_xwayland_view { | |||
154 | struct wl_listener set_title; | 144 | struct wl_listener set_title; |
155 | struct wl_listener set_class; | 145 | struct wl_listener set_class; |
156 | struct wl_listener set_role; | 146 | struct wl_listener set_role; |
147 | struct wl_listener set_startup_id; | ||
157 | struct wl_listener set_window_type; | 148 | struct wl_listener set_window_type; |
158 | struct wl_listener set_hints; | 149 | struct wl_listener set_hints; |
159 | struct wl_listener set_decorations; | 150 | struct wl_listener set_decorations; |
151 | struct wl_listener associate; | ||
152 | struct wl_listener dissociate; | ||
160 | struct wl_listener map; | 153 | struct wl_listener map; |
161 | struct wl_listener unmap; | 154 | struct wl_listener unmap; |
162 | struct wl_listener destroy; | 155 | struct wl_listener destroy; |
163 | struct wl_listener override_redirect; | 156 | struct wl_listener override_redirect; |
157 | |||
158 | struct wl_listener surface_tree_destroy; | ||
164 | }; | 159 | }; |
165 | 160 | ||
166 | struct sway_xwayland_unmanaged { | 161 | struct sway_xwayland_unmanaged { |
167 | struct wlr_xwayland_surface *wlr_xwayland_surface; | 162 | struct wlr_xwayland_surface *wlr_xwayland_surface; |
168 | struct wl_list link; | ||
169 | 163 | ||
170 | int lx, ly; | 164 | struct wlr_scene_surface *surface_scene; |
171 | 165 | ||
172 | struct wl_listener request_activate; | 166 | struct wl_listener request_activate; |
173 | struct wl_listener request_configure; | 167 | struct wl_listener request_configure; |
174 | struct wl_listener request_fullscreen; | 168 | struct wl_listener request_fullscreen; |
175 | struct wl_listener commit; | ||
176 | struct wl_listener set_geometry; | 169 | struct wl_listener set_geometry; |
170 | struct wl_listener associate; | ||
171 | struct wl_listener dissociate; | ||
177 | struct wl_listener map; | 172 | struct wl_listener map; |
178 | struct wl_listener unmap; | 173 | struct wl_listener unmap; |
179 | struct wl_listener destroy; | 174 | struct wl_listener destroy; |
180 | struct wl_listener override_redirect; | 175 | struct wl_listener override_redirect; |
181 | }; | 176 | }; |
182 | #endif | 177 | #endif |
183 | struct sway_view_child; | ||
184 | |||
185 | struct sway_view_child_impl { | ||
186 | void (*get_view_coords)(struct sway_view_child *child, int *sx, int *sy); | ||
187 | void (*destroy)(struct sway_view_child *child); | ||
188 | }; | ||
189 | |||
190 | /** | ||
191 | * A view child is a surface in the view tree, such as a subsurface or a popup. | ||
192 | */ | ||
193 | struct sway_view_child { | ||
194 | const struct sway_view_child_impl *impl; | ||
195 | struct wl_list link; | ||
196 | 178 | ||
179 | struct sway_popup_desc { | ||
180 | struct wlr_scene_node *relative; | ||
197 | struct sway_view *view; | 181 | struct sway_view *view; |
198 | struct sway_view_child *parent; | ||
199 | struct wl_list children; // sway_view_child::link | ||
200 | struct wlr_surface *surface; | ||
201 | bool mapped; | ||
202 | |||
203 | struct wl_listener surface_commit; | ||
204 | struct wl_listener surface_new_subsurface; | ||
205 | struct wl_listener surface_map; | ||
206 | struct wl_listener surface_unmap; | ||
207 | struct wl_listener surface_destroy; | ||
208 | struct wl_listener view_unmap; | ||
209 | }; | ||
210 | |||
211 | struct sway_subsurface { | ||
212 | struct sway_view_child child; | ||
213 | |||
214 | struct wl_listener destroy; | ||
215 | }; | 182 | }; |
216 | 183 | ||
217 | struct sway_xdg_popup { | 184 | struct sway_xdg_popup { |
218 | struct sway_view_child child; | 185 | struct sway_view *view; |
219 | 186 | ||
187 | struct wlr_scene_tree *scene_tree; | ||
188 | struct wlr_scene_tree *xdg_surface_tree; | ||
220 | struct wlr_xdg_popup *wlr_xdg_popup; | 189 | struct wlr_xdg_popup *wlr_xdg_popup; |
221 | 190 | ||
191 | struct sway_popup_desc desc; | ||
192 | |||
193 | struct wl_listener surface_commit; | ||
222 | struct wl_listener new_popup; | 194 | struct wl_listener new_popup; |
195 | struct wl_listener reposition; | ||
223 | struct wl_listener destroy; | 196 | struct wl_listener destroy; |
224 | }; | 197 | }; |
225 | 198 | ||
@@ -268,7 +241,12 @@ void view_set_activated(struct sway_view *view, bool activated); | |||
268 | /** | 241 | /** |
269 | * Called when the view requests to be focused. | 242 | * Called when the view requests to be focused. |
270 | */ | 243 | */ |
271 | void view_request_activate(struct sway_view *view); | 244 | void view_request_activate(struct sway_view *view, struct sway_seat *seat); |
245 | |||
246 | /* | ||
247 | * Called when the view requests urgent state | ||
248 | */ | ||
249 | void view_request_urgent(struct sway_view *view); | ||
272 | 250 | ||
273 | /** | 251 | /** |
274 | * If possible, instructs the client to change their decoration mode. | 252 | * If possible, instructs the client to change their decoration mode. |
@@ -287,23 +265,9 @@ void view_close(struct sway_view *view); | |||
287 | 265 | ||
288 | void view_close_popups(struct sway_view *view); | 266 | void view_close_popups(struct sway_view *view); |
289 | 267 | ||
290 | void view_damage_from(struct sway_view *view); | ||
291 | |||
292 | /** | ||
293 | * Iterate all surfaces of a view (toplevels + popups). | ||
294 | */ | ||
295 | void view_for_each_surface(struct sway_view *view, | ||
296 | wlr_surface_iterator_func_t iterator, void *user_data); | ||
297 | |||
298 | /** | ||
299 | * Iterate all popup surfaces of a view. | ||
300 | */ | ||
301 | void view_for_each_popup_surface(struct sway_view *view, | ||
302 | wlr_surface_iterator_func_t iterator, void *user_data); | ||
303 | |||
304 | // view implementation | 268 | // view implementation |
305 | 269 | ||
306 | void view_init(struct sway_view *view, enum sway_view_type type, | 270 | bool view_init(struct sway_view *view, enum sway_view_type type, |
307 | const struct sway_view_impl *impl); | 271 | const struct sway_view_impl *impl); |
308 | 272 | ||
309 | void view_destroy(struct sway_view *view); | 273 | void view_destroy(struct sway_view *view); |
@@ -325,14 +289,7 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface, | |||
325 | void view_unmap(struct sway_view *view); | 289 | void view_unmap(struct sway_view *view); |
326 | 290 | ||
327 | void view_update_size(struct sway_view *view); | 291 | void view_update_size(struct sway_view *view); |
328 | void view_center_surface(struct sway_view *view); | 292 | void view_center_and_clip_surface(struct sway_view *view); |
329 | |||
330 | void view_child_init(struct sway_view_child *child, | ||
331 | const struct sway_view_child_impl *impl, struct sway_view *view, | ||
332 | struct wlr_surface *surface); | ||
333 | |||
334 | void view_child_destroy(struct sway_view_child *child); | ||
335 | |||
336 | 293 | ||
337 | struct sway_view *view_from_wlr_xdg_surface( | 294 | struct sway_view *view_from_wlr_xdg_surface( |
338 | struct wlr_xdg_surface *xdg_surface); | 295 | struct wlr_xdg_surface *xdg_surface); |
@@ -342,6 +299,8 @@ struct sway_view *view_from_wlr_xwayland_surface( | |||
342 | #endif | 299 | #endif |
343 | struct sway_view *view_from_wlr_surface(struct wlr_surface *surface); | 300 | struct sway_view *view_from_wlr_surface(struct wlr_surface *surface); |
344 | 301 | ||
302 | void view_update_app_id(struct sway_view *view); | ||
303 | |||
345 | /** | 304 | /** |
346 | * 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. |
347 | * 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 |
@@ -371,4 +330,8 @@ void view_save_buffer(struct sway_view *view); | |||
371 | 330 | ||
372 | bool view_is_transient_for(struct sway_view *child, struct sway_view *ancestor); | 331 | bool view_is_transient_for(struct sway_view *child, struct sway_view *ancestor); |
373 | 332 | ||
333 | void view_assign_ctx(struct sway_view *view, struct launcher_ctx *ctx); | ||
334 | |||
335 | void view_send_frame_done(struct sway_view *view); | ||
336 | |||
374 | #endif | 337 | #endif |
diff --git a/include/sway/tree/workspace.h b/include/sway/tree/workspace.h index b3d93a81..58bde20c 100644 --- a/include/sway/tree/workspace.h +++ b/include/sway/tree/workspace.h | |||
@@ -2,6 +2,8 @@ | |||
2 | #define _SWAY_WORKSPACE_H | 2 | #define _SWAY_WORKSPACE_H |
3 | 3 | ||
4 | #include <stdbool.h> | 4 | #include <stdbool.h> |
5 | #include <wlr/types/wlr_scene.h> | ||
6 | #include "sway/config.h" | ||
5 | #include "sway/tree/container.h" | 7 | #include "sway/tree/container.h" |
6 | #include "sway/tree/node.h" | 8 | #include "sway/tree/node.h" |
7 | 9 | ||
@@ -22,6 +24,12 @@ struct sway_workspace_state { | |||
22 | 24 | ||
23 | struct sway_workspace { | 25 | struct sway_workspace { |
24 | struct sway_node node; | 26 | struct sway_node node; |
27 | |||
28 | struct { | ||
29 | struct wlr_scene_tree *tiling; | ||
30 | struct wlr_scene_tree *fullscreen; | ||
31 | } layers; | ||
32 | |||
25 | struct sway_container *fullscreen; | 33 | struct sway_container *fullscreen; |
26 | 34 | ||
27 | char *name; | 35 | char *name; |
diff --git a/include/sway/xdg_decoration.h b/include/sway/xdg_decoration.h index 8bef4c6d..2388ebcb 100644 --- a/include/sway/xdg_decoration.h +++ b/include/sway/xdg_decoration.h | |||
@@ -16,4 +16,6 @@ struct sway_xdg_decoration { | |||
16 | struct sway_xdg_decoration *xdg_decoration_from_surface( | 16 | struct sway_xdg_decoration *xdg_decoration_from_surface( |
17 | struct wlr_surface *surface); | 17 | struct wlr_surface *surface); |
18 | 18 | ||
19 | void set_xdg_decoration_mode(struct sway_xdg_decoration *deco); | ||
20 | |||
19 | #endif | 21 | #endif |
diff --git a/include/swaybar/bar.h b/include/swaybar/bar.h index 3ad0bdf3..197d2190 100644 --- a/include/swaybar/bar.h +++ b/include/swaybar/bar.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include "config.h" | 4 | #include "config.h" |
5 | #include "input.h" | 5 | #include "input.h" |
6 | #include "pool-buffer.h" | 6 | #include "pool-buffer.h" |
7 | #include "cursor-shape-v1-client-protocol.h" | ||
7 | #include "wlr-layer-shell-unstable-v1-client-protocol.h" | 8 | #include "wlr-layer-shell-unstable-v1-client-protocol.h" |
8 | #include "xdg-output-unstable-v1-client-protocol.h" | 9 | #include "xdg-output-unstable-v1-client-protocol.h" |
9 | 10 | ||
@@ -30,6 +31,7 @@ struct swaybar { | |||
30 | struct wl_compositor *compositor; | 31 | struct wl_compositor *compositor; |
31 | struct zwlr_layer_shell_v1 *layer_shell; | 32 | struct zwlr_layer_shell_v1 *layer_shell; |
32 | struct zxdg_output_manager_v1 *xdg_output_manager; | 33 | struct zxdg_output_manager_v1 *xdg_output_manager; |
34 | struct wp_cursor_shape_manager_v1 *cursor_shape_manager; | ||
33 | struct wl_shm *shm; | 35 | struct wl_shm *shm; |
34 | 36 | ||
35 | struct swaybar_config *config; | 37 | struct swaybar_config *config; |
diff --git a/include/swaybar/config.h b/include/swaybar/config.h index 4cacd21a..361acd99 100644 --- a/include/swaybar/config.h +++ b/include/swaybar/config.h | |||
@@ -6,6 +6,7 @@ | |||
6 | #include "../include/config.h" | 6 | #include "../include/config.h" |
7 | #include "list.h" | 7 | #include "list.h" |
8 | #include "util.h" | 8 | #include "util.h" |
9 | #include <pango/pangocairo.h> | ||
9 | 10 | ||
10 | struct box_colors { | 11 | struct box_colors { |
11 | uint32_t border; | 12 | uint32_t border; |
@@ -28,7 +29,7 @@ struct swaybar_config { | |||
28 | char *status_command; | 29 | char *status_command; |
29 | bool pango_markup; | 30 | bool pango_markup; |
30 | uint32_t position; // zwlr_layer_surface_v1_anchor | 31 | uint32_t position; // zwlr_layer_surface_v1_anchor |
31 | char *font; | 32 | PangoFontDescription *font_description; |
32 | char *sep_symbol; | 33 | char *sep_symbol; |
33 | char *mode; | 34 | char *mode; |
34 | char *hidden_state; | 35 | char *hidden_state; |
diff --git a/include/swaybar/i3bar.h b/include/swaybar/i3bar.h index 1aec6d6c..dced2a6c 100644 --- a/include/swaybar/i3bar.h +++ b/include/swaybar/i3bar.h | |||
@@ -30,6 +30,6 @@ void i3bar_block_unref(struct i3bar_block *block); | |||
30 | bool i3bar_handle_readable(struct status_line *status); | 30 | bool i3bar_handle_readable(struct status_line *status); |
31 | enum hotspot_event_handling i3bar_block_send_click(struct status_line *status, | 31 | enum hotspot_event_handling i3bar_block_send_click(struct status_line *status, |
32 | struct i3bar_block *block, double x, double y, double rx, double ry, | 32 | struct i3bar_block *block, double x, double y, double rx, double ry, |
33 | double w, double h, int scale, uint32_t button); | 33 | double w, double h, int scale, uint32_t button, bool released); |
34 | 34 | ||
35 | #endif | 35 | #endif |
diff --git a/include/swaybar/image.h b/include/swaybar/image.h new file mode 100644 index 00000000..53a210dd --- /dev/null +++ b/include/swaybar/image.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef _SWAYBAR_IMAGE_H | ||
2 | #define _SWAYBAR_IMAGE_H | ||
3 | #include <cairo.h> | ||
4 | |||
5 | cairo_surface_t *load_image(const char *path); | ||
6 | |||
7 | #endif | ||
diff --git a/include/swaybar/input.h b/include/swaybar/input.h index e8735d88..8ea88a69 100644 --- a/include/swaybar/input.h +++ b/include/swaybar/input.h | |||
@@ -49,7 +49,7 @@ struct swaybar_hotspot { | |||
49 | int x, y, width, height; | 49 | int x, y, width, height; |
50 | enum hotspot_event_handling (*callback)(struct swaybar_output *output, | 50 | enum hotspot_event_handling (*callback)(struct swaybar_output *output, |
51 | struct swaybar_hotspot *hotspot, double x, double y, uint32_t button, | 51 | struct swaybar_hotspot *hotspot, double x, double y, uint32_t button, |
52 | void *data); | 52 | bool released, void *data); |
53 | void (*destroy)(void *data); | 53 | void (*destroy)(void *data); |
54 | void *data; | 54 | void *data; |
55 | }; | 55 | }; |
diff --git a/include/swaybar/tray/item.h b/include/swaybar/tray/item.h index c02a5582..73937a0c 100644 --- a/include/swaybar/tray/item.h +++ b/include/swaybar/tray/item.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <cairo.h> | 4 | #include <cairo.h> |
5 | #include <stdbool.h> | 5 | #include <stdbool.h> |
6 | #include <stdint.h> | 6 | #include <stdint.h> |
7 | #include <wayland-util.h> | ||
7 | #include "swaybar/tray/tray.h" | 8 | #include "swaybar/tray/tray.h" |
8 | #include "list.h" | 9 | #include "list.h" |
9 | 10 | ||
diff --git a/include/swaynag/swaynag.h b/include/swaynag/swaynag.h index 2d68b6c9..fb9e9c21 100644 --- a/include/swaynag/swaynag.h +++ b/include/swaynag/swaynag.h | |||
@@ -4,6 +4,8 @@ | |||
4 | #include <strings.h> | 4 | #include <strings.h> |
5 | #include "list.h" | 5 | #include "list.h" |
6 | #include "pool-buffer.h" | 6 | #include "pool-buffer.h" |
7 | #include "cursor-shape-v1-client-protocol.h" | ||
8 | |||
7 | #include "swaynag/types.h" | 9 | #include "swaynag/types.h" |
8 | 10 | ||
9 | #define SWAYNAG_MAX_HEIGHT 500 | 11 | #define SWAYNAG_MAX_HEIGHT 500 |
@@ -58,6 +60,7 @@ struct swaynag_button { | |||
58 | struct swaynag_details { | 60 | struct swaynag_details { |
59 | bool visible; | 61 | bool visible; |
60 | char *message; | 62 | char *message; |
63 | char *details_text; | ||
61 | 64 | ||
62 | int x; | 65 | int x; |
63 | int y; | 66 | int y; |
@@ -67,7 +70,7 @@ struct swaynag_details { | |||
67 | int offset; | 70 | int offset; |
68 | int visible_lines; | 71 | int visible_lines; |
69 | int total_lines; | 72 | int total_lines; |
70 | struct swaynag_button button_details; | 73 | struct swaynag_button *button_details; |
71 | struct swaynag_button button_up; | 74 | struct swaynag_button button_up; |
72 | struct swaynag_button button_down; | 75 | struct swaynag_button button_down; |
73 | }; | 76 | }; |
@@ -84,6 +87,7 @@ struct swaynag { | |||
84 | struct swaynag_output *output; | 87 | struct swaynag_output *output; |
85 | struct zwlr_layer_shell_v1 *layer_shell; | 88 | struct zwlr_layer_shell_v1 *layer_shell; |
86 | struct zwlr_layer_surface_v1 *layer_surface; | 89 | struct zwlr_layer_surface_v1 *layer_surface; |
90 | struct wp_cursor_shape_manager_v1 *cursor_shape_manager; | ||
87 | struct wl_surface *surface; | 91 | struct wl_surface *surface; |
88 | 92 | ||
89 | uint32_t width; | 93 | uint32_t width; |
diff --git a/include/swaynag/types.h b/include/swaynag/types.h index 3c3b2754..9c3c50db 100644 --- a/include/swaynag/types.h +++ b/include/swaynag/types.h | |||
@@ -1,10 +1,14 @@ | |||
1 | #ifndef _SWAYNAG_TYPES_H | 1 | #ifndef _SWAYNAG_TYPES_H |
2 | #define _SWAYNAG_TYPES_H | 2 | #define _SWAYNAG_TYPES_H |
3 | 3 | ||
4 | #include <stdint.h> | ||
5 | #include <pango/pangocairo.h> | ||
6 | #include "list.h" | ||
7 | |||
4 | struct swaynag_type { | 8 | struct swaynag_type { |
5 | char *name; | 9 | char *name; |
6 | 10 | ||
7 | char *font; | 11 | PangoFontDescription *font_description; |
8 | char *output; | 12 | char *output; |
9 | uint32_t anchors; | 13 | uint32_t anchors; |
10 | int32_t layer; // enum zwlr_layer_shell_v1_layer or -1 if unset | 14 | int32_t layer; // enum zwlr_layer_shell_v1_layer or -1 if unset |