diff options
Diffstat (limited to 'include/sway')
-rw-r--r-- | include/sway/commands.h | 22 | ||||
-rw-r--r-- | include/sway/config.h | 39 | ||||
-rw-r--r-- | include/sway/input/cursor.h | 37 | ||||
-rw-r--r-- | include/sway/input/input-manager.h | 10 | ||||
-rw-r--r-- | include/sway/input/seat.h | 88 | ||||
-rw-r--r-- | include/sway/output.h | 12 | ||||
-rw-r--r-- | include/sway/tree/container.h | 8 | ||||
-rw-r--r-- | include/sway/tree/view.h | 7 |
8 files changed, 173 insertions, 50 deletions
diff --git a/include/sway/commands.h b/include/sway/commands.h index 32925369..5d45d78b 100644 --- a/include/sway/commands.h +++ b/include/sway/commands.h | |||
@@ -56,7 +56,7 @@ struct cmd_handler *find_handler(char *line, struct cmd_handler *cmd_handlers, | |||
56 | * all matching containers. Otherwise, it'll run on the `con` container. If | 56 | * all matching containers. Otherwise, it'll run on the `con` container. If |
57 | * `con` is NULL then it'll run on the currently focused container. | 57 | * `con` is NULL then it'll run on the currently focused container. |
58 | */ | 58 | */ |
59 | struct cmd_results *execute_command(char *command, struct sway_seat *seat, | 59 | list_t *execute_command(char *command, struct sway_seat *seat, |
60 | struct sway_container *con); | 60 | struct sway_container *con); |
61 | /** | 61 | /** |
62 | * Parse and handles a command during config file loading. | 62 | * Parse and handles a command during config file loading. |
@@ -82,11 +82,11 @@ struct cmd_results *cmd_results_new(enum cmd_status status, const char* input, c | |||
82 | */ | 82 | */ |
83 | void free_cmd_results(struct cmd_results *results); | 83 | void free_cmd_results(struct cmd_results *results); |
84 | /** | 84 | /** |
85 | * Serializes cmd_results to a JSON string. | 85 | * Serializes a list of cmd_results to a JSON string. |
86 | * | 86 | * |
87 | * Free the JSON string later on. | 87 | * Free the JSON string later on. |
88 | */ | 88 | */ |
89 | char *cmd_results_to_json(struct cmd_results *results); | 89 | char *cmd_results_to_json(list_t *res_list); |
90 | 90 | ||
91 | struct cmd_results *add_color(const char *name, | 91 | struct cmd_results *add_color(const char *name, |
92 | char *buffer, const char *color); | 92 | char *buffer, const char *color); |
@@ -172,7 +172,11 @@ sway_cmd cmd_swaybg_command; | |||
172 | sway_cmd cmd_swaynag_command; | 172 | sway_cmd cmd_swaynag_command; |
173 | sway_cmd cmd_swap; | 173 | sway_cmd cmd_swap; |
174 | sway_cmd cmd_tiling_drag; | 174 | sway_cmd cmd_tiling_drag; |
175 | sway_cmd cmd_tiling_drag_threshold; | ||
176 | sway_cmd cmd_title_align; | ||
175 | sway_cmd cmd_title_format; | 177 | sway_cmd cmd_title_format; |
178 | sway_cmd cmd_titlebar_border_thickness; | ||
179 | sway_cmd cmd_titlebar_padding; | ||
176 | sway_cmd cmd_unmark; | 180 | sway_cmd cmd_unmark; |
177 | sway_cmd cmd_urgent; | 181 | sway_cmd cmd_urgent; |
178 | sway_cmd cmd_workspace; | 182 | sway_cmd cmd_workspace; |
@@ -180,12 +184,12 @@ sway_cmd cmd_workspace_layout; | |||
180 | sway_cmd cmd_ws_auto_back_and_forth; | 184 | sway_cmd cmd_ws_auto_back_and_forth; |
181 | sway_cmd cmd_xwayland; | 185 | sway_cmd cmd_xwayland; |
182 | 186 | ||
183 | sway_cmd bar_cmd_activate_button; | 187 | sway_cmd bar_cmd_bindcode; |
184 | sway_cmd bar_cmd_binding_mode_indicator; | 188 | sway_cmd bar_cmd_binding_mode_indicator; |
185 | sway_cmd bar_cmd_bindsym; | 189 | sway_cmd bar_cmd_bindsym; |
186 | sway_cmd bar_cmd_colors; | 190 | sway_cmd bar_cmd_colors; |
187 | sway_cmd bar_cmd_context_button; | ||
188 | sway_cmd bar_cmd_font; | 191 | sway_cmd bar_cmd_font; |
192 | sway_cmd bar_cmd_gaps; | ||
189 | sway_cmd bar_cmd_mode; | 193 | sway_cmd bar_cmd_mode; |
190 | sway_cmd bar_cmd_modifier; | 194 | sway_cmd bar_cmd_modifier; |
191 | sway_cmd bar_cmd_output; | 195 | sway_cmd bar_cmd_output; |
@@ -194,12 +198,15 @@ sway_cmd bar_cmd_hidden_state; | |||
194 | sway_cmd bar_cmd_icon_theme; | 198 | sway_cmd bar_cmd_icon_theme; |
195 | sway_cmd bar_cmd_id; | 199 | sway_cmd bar_cmd_id; |
196 | sway_cmd bar_cmd_position; | 200 | sway_cmd bar_cmd_position; |
197 | sway_cmd bar_cmd_secondary_button; | ||
198 | sway_cmd bar_cmd_separator_symbol; | 201 | sway_cmd bar_cmd_separator_symbol; |
199 | sway_cmd bar_cmd_status_command; | 202 | sway_cmd bar_cmd_status_command; |
203 | sway_cmd bar_cmd_status_edge_padding; | ||
204 | sway_cmd bar_cmd_status_padding; | ||
200 | sway_cmd bar_cmd_pango_markup; | 205 | sway_cmd bar_cmd_pango_markup; |
201 | sway_cmd bar_cmd_strip_workspace_numbers; | 206 | sway_cmd bar_cmd_strip_workspace_numbers; |
207 | sway_cmd bar_cmd_strip_workspace_name; | ||
202 | sway_cmd bar_cmd_swaybar_command; | 208 | sway_cmd bar_cmd_swaybar_command; |
209 | sway_cmd bar_cmd_tray_bindsym; | ||
203 | sway_cmd bar_cmd_tray_output; | 210 | sway_cmd bar_cmd_tray_output; |
204 | sway_cmd bar_cmd_tray_padding; | 211 | sway_cmd bar_cmd_tray_padding; |
205 | sway_cmd bar_cmd_wrap_scroll; | 212 | sway_cmd bar_cmd_wrap_scroll; |
@@ -255,8 +262,9 @@ sway_cmd output_cmd_scale; | |||
255 | sway_cmd output_cmd_transform; | 262 | sway_cmd output_cmd_transform; |
256 | 263 | ||
257 | sway_cmd seat_cmd_attach; | 264 | sway_cmd seat_cmd_attach; |
258 | sway_cmd seat_cmd_fallback; | ||
259 | sway_cmd seat_cmd_cursor; | 265 | sway_cmd seat_cmd_cursor; |
266 | sway_cmd seat_cmd_fallback; | ||
267 | sway_cmd seat_cmd_hide_cursor; | ||
260 | 268 | ||
261 | sway_cmd cmd_ipc_cmd; | 269 | sway_cmd cmd_ipc_cmd; |
262 | sway_cmd cmd_ipc_events; | 270 | sway_cmd cmd_ipc_events; |
diff --git a/include/sway/config.h b/include/sway/config.h index c44533ee..96fe899b 100644 --- a/include/sway/config.h +++ b/include/sway/config.h | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <time.h> | 6 | #include <time.h> |
7 | #include <wlr/types/wlr_box.h> | 7 | #include <wlr/types/wlr_box.h> |
8 | #include <xkbcommon/xkbcommon.h> | 8 | #include <xkbcommon/xkbcommon.h> |
9 | #include "../include/config.h" | ||
9 | #include "list.h" | 10 | #include "list.h" |
10 | #include "swaynag.h" | 11 | #include "swaynag.h" |
11 | #include "tree/container.h" | 12 | #include "tree/container.h" |
@@ -26,7 +27,8 @@ struct sway_variable { | |||
26 | enum binding_input_type { | 27 | enum binding_input_type { |
27 | BINDING_KEYCODE, | 28 | BINDING_KEYCODE, |
28 | BINDING_KEYSYM, | 29 | BINDING_KEYSYM, |
29 | BINDING_MOUSE, | 30 | BINDING_MOUSECODE, |
31 | BINDING_MOUSESYM, | ||
30 | }; | 32 | }; |
31 | 33 | ||
32 | enum binding_flags { | 34 | enum binding_flags { |
@@ -140,6 +142,7 @@ struct seat_config { | |||
140 | char *name; | 142 | char *name; |
141 | int fallback; // -1 means not set | 143 | int fallback; // -1 means not set |
142 | list_t *attachments; // list of seat_attachment configs | 144 | list_t *attachments; // list of seat_attachment configs |
145 | int hide_cursor_timeout; | ||
143 | }; | 146 | }; |
144 | 147 | ||
145 | enum config_dpms { | 148 | enum config_dpms { |
@@ -224,9 +227,13 @@ struct bar_config { | |||
224 | bool wrap_scroll; | 227 | bool wrap_scroll; |
225 | char *separator_symbol; | 228 | char *separator_symbol; |
226 | bool strip_workspace_numbers; | 229 | bool strip_workspace_numbers; |
230 | bool strip_workspace_name; | ||
227 | bool binding_mode_indicator; | 231 | bool binding_mode_indicator; |
228 | bool verbose; | 232 | bool verbose; |
233 | struct side_gaps gaps; | ||
229 | pid_t pid; | 234 | pid_t pid; |
235 | int status_padding; | ||
236 | int status_edge_padding; | ||
230 | struct { | 237 | struct { |
231 | char *background; | 238 | char *background; |
232 | char *statusline; | 239 | char *statusline; |
@@ -250,6 +257,13 @@ struct bar_config { | |||
250 | char *binding_mode_bg; | 257 | char *binding_mode_bg; |
251 | char *binding_mode_text; | 258 | char *binding_mode_text; |
252 | } colors; | 259 | } colors; |
260 | |||
261 | #if HAVE_TRAY | ||
262 | char *icon_theme; | ||
263 | const char *tray_bindings[10]; // mouse buttons 0-9 | ||
264 | list_t *tray_outputs; // char * | ||
265 | int tray_padding; | ||
266 | #endif | ||
253 | }; | 267 | }; |
254 | 268 | ||
255 | struct bar_binding { | 269 | struct bar_binding { |
@@ -356,6 +370,12 @@ enum mouse_warping_mode { | |||
356 | WARP_CONTAINER | 370 | WARP_CONTAINER |
357 | }; | 371 | }; |
358 | 372 | ||
373 | enum alignment { | ||
374 | ALIGN_LEFT, | ||
375 | ALIGN_CENTER, | ||
376 | ALIGN_RIGHT | ||
377 | }; | ||
378 | |||
359 | /** | 379 | /** |
360 | * The configuration struct. The result of loading a config file. | 380 | * The configuration struct. The result of loading a config file. |
361 | */ | 381 | */ |
@@ -390,6 +410,9 @@ struct sway_config { | |||
390 | size_t font_height; | 410 | size_t font_height; |
391 | size_t font_baseline; | 411 | size_t font_baseline; |
392 | bool pango_markup; | 412 | bool pango_markup; |
413 | int titlebar_border_thickness; | ||
414 | int titlebar_h_padding; | ||
415 | int titlebar_v_padding; | ||
393 | size_t urgent_timeout; | 416 | size_t urgent_timeout; |
394 | enum sway_fowa focus_on_window_activation; | 417 | enum sway_fowa focus_on_window_activation; |
395 | enum sway_popup_during_fullscreen popup_during_fullscreen; | 418 | enum sway_popup_during_fullscreen popup_during_fullscreen; |
@@ -406,7 +429,10 @@ struct sway_config { | |||
406 | bool validating; | 429 | bool validating; |
407 | bool auto_back_and_forth; | 430 | bool auto_back_and_forth; |
408 | bool show_marks; | 431 | bool show_marks; |
432 | enum alignment title_align; | ||
433 | |||
409 | bool tiling_drag; | 434 | bool tiling_drag; |
435 | int tiling_drag_threshold; | ||
410 | 436 | ||
411 | bool smart_gaps; | 437 | bool smart_gaps; |
412 | int gaps_inner; | 438 | int gaps_inner; |
@@ -415,6 +441,8 @@ struct sway_config { | |||
415 | list_t *config_chain; | 441 | list_t *config_chain; |
416 | const char *current_config_path; | 442 | const char *current_config_path; |
417 | const char *current_config; | 443 | const char *current_config; |
444 | int current_config_line_number; | ||
445 | char *current_config_line; | ||
418 | 446 | ||
419 | enum sway_container_border border; | 447 | enum sway_container_border border; |
420 | enum sway_container_border floating_border; | 448 | enum sway_container_border floating_border; |
@@ -480,6 +508,11 @@ bool read_config(FILE *file, struct sway_config *config, | |||
480 | struct swaynag_instance *swaynag); | 508 | struct swaynag_instance *swaynag); |
481 | 509 | ||
482 | /** | 510 | /** |
511 | * Adds a warning entry to the swaynag instance used for errors. | ||
512 | */ | ||
513 | void config_add_swaynag_warning(char *fmt, ...); | ||
514 | |||
515 | /** | ||
483 | * Free config struct | 516 | * Free config struct |
484 | */ | 517 | */ |
485 | void free_config(struct sway_config *config); | 518 | void free_config(struct sway_config *config); |
@@ -516,7 +549,7 @@ struct seat_attachment_config *seat_attachment_config_new(void); | |||
516 | struct seat_attachment_config *seat_config_get_attachment( | 549 | struct seat_attachment_config *seat_config_get_attachment( |
517 | struct seat_config *seat_config, char *identifier); | 550 | struct seat_config *seat_config, char *identifier); |
518 | 551 | ||
519 | void apply_seat_config(struct seat_config *seat); | 552 | struct seat_config *store_seat_config(struct seat_config *seat); |
520 | 553 | ||
521 | int output_name_cmp(const void *item, const void *data); | 554 | int output_name_cmp(const void *item, const void *data); |
522 | 555 | ||
@@ -535,8 +568,6 @@ void apply_output_config_to_outputs(struct output_config *oc); | |||
535 | 568 | ||
536 | void free_output_config(struct output_config *oc); | 569 | void free_output_config(struct output_config *oc); |
537 | 570 | ||
538 | void create_default_output_configs(void); | ||
539 | |||
540 | int workspace_output_cmp_workspace(const void *a, const void *b); | 571 | int workspace_output_cmp_workspace(const void *a, const void *b); |
541 | 572 | ||
542 | int sway_binding_cmp(const void *a, const void *b); | 573 | int sway_binding_cmp(const void *a, const void *b); |
diff --git a/include/sway/input/cursor.h b/include/sway/input/cursor.h index 50ac453b..77aa0ea1 100644 --- a/include/sway/input/cursor.h +++ b/include/sway/input/cursor.h | |||
@@ -1,10 +1,17 @@ | |||
1 | #ifndef _SWAY_INPUT_CURSOR_H | 1 | #ifndef _SWAY_INPUT_CURSOR_H |
2 | #define _SWAY_INPUT_CURSOR_H | 2 | #define _SWAY_INPUT_CURSOR_H |
3 | #include <stdbool.h> | ||
3 | #include <stdint.h> | 4 | #include <stdint.h> |
5 | #include <wlr/types/wlr_surface.h> | ||
4 | #include "sway/input/seat.h" | 6 | #include "sway/input/seat.h" |
5 | 7 | ||
6 | #define SWAY_CURSOR_PRESSED_BUTTONS_CAP 32 | 8 | #define SWAY_CURSOR_PRESSED_BUTTONS_CAP 32 |
7 | 9 | ||
10 | #define SWAY_SCROLL_UP KEY_MAX + 1 | ||
11 | #define SWAY_SCROLL_DOWN KEY_MAX + 2 | ||
12 | #define SWAY_SCROLL_LEFT KEY_MAX + 3 | ||
13 | #define SWAY_SCROLL_RIGHT KEY_MAX + 4 | ||
14 | |||
8 | struct sway_cursor { | 15 | struct sway_cursor { |
9 | struct sway_seat *seat; | 16 | struct sway_seat *seat; |
10 | struct wlr_cursor *cursor; | 17 | struct wlr_cursor *cursor; |
@@ -16,6 +23,8 @@ struct sway_cursor { | |||
16 | 23 | ||
17 | const char *image; | 24 | const char *image; |
18 | struct wl_client *image_client; | 25 | struct wl_client *image_client; |
26 | struct wlr_surface *image_surface; | ||
27 | int hotspot_x, hotspot_y; | ||
19 | 28 | ||
20 | struct wl_listener motion; | 29 | struct wl_listener motion; |
21 | struct wl_listener motion_absolute; | 30 | struct wl_listener motion_absolute; |
@@ -33,11 +42,20 @@ struct sway_cursor { | |||
33 | 42 | ||
34 | struct wl_listener request_set_cursor; | 43 | struct wl_listener request_set_cursor; |
35 | 44 | ||
45 | struct wl_event_source *hide_source; | ||
46 | bool hidden; | ||
47 | |||
36 | // Mouse binding state | 48 | // Mouse binding state |
37 | uint32_t pressed_buttons[SWAY_CURSOR_PRESSED_BUTTONS_CAP]; | 49 | uint32_t pressed_buttons[SWAY_CURSOR_PRESSED_BUTTONS_CAP]; |
38 | size_t pressed_button_count; | 50 | size_t pressed_button_count; |
39 | }; | 51 | }; |
40 | 52 | ||
53 | struct sway_node; | ||
54 | |||
55 | struct sway_node *node_at_coords( | ||
56 | struct sway_seat *seat, double lx, double ly, | ||
57 | struct wlr_surface **surface, double *sx, double *sy); | ||
58 | |||
41 | void sway_cursor_destroy(struct sway_cursor *cursor); | 59 | void sway_cursor_destroy(struct sway_cursor *cursor); |
42 | struct sway_cursor *sway_cursor_create(struct sway_seat *seat); | 60 | struct sway_cursor *sway_cursor_create(struct sway_seat *seat); |
43 | 61 | ||
@@ -48,6 +66,10 @@ struct sway_cursor *sway_cursor_create(struct sway_seat *seat); | |||
48 | */ | 66 | */ |
49 | void cursor_rebase(struct sway_cursor *cursor); | 67 | void cursor_rebase(struct sway_cursor *cursor); |
50 | 68 | ||
69 | void cursor_handle_activity(struct sway_cursor *cursor); | ||
70 | void cursor_unhide(struct sway_cursor *cursor); | ||
71 | int cursor_get_timeout(struct sway_cursor *cursor); | ||
72 | |||
51 | /** | 73 | /** |
52 | * Like cursor_rebase, but also allows focus to change when the cursor enters a | 74 | * Like cursor_rebase, but also allows focus to change when the cursor enters a |
53 | * new container. | 75 | * new container. |
@@ -58,12 +80,27 @@ void dispatch_cursor_button(struct sway_cursor *cursor, | |||
58 | struct wlr_input_device *device, uint32_t time_msec, uint32_t button, | 80 | struct wlr_input_device *device, uint32_t time_msec, uint32_t button, |
59 | enum wlr_button_state state); | 81 | enum wlr_button_state state); |
60 | 82 | ||
83 | void dispatch_cursor_axis(struct sway_cursor *cursor, | ||
84 | struct wlr_event_pointer_axis *event); | ||
85 | |||
61 | void cursor_set_image(struct sway_cursor *cursor, const char *image, | 86 | void cursor_set_image(struct sway_cursor *cursor, const char *image, |
62 | struct wl_client *client); | 87 | struct wl_client *client); |
63 | 88 | ||
89 | void cursor_set_image_surface(struct sway_cursor *cursor, | ||
90 | struct wlr_surface *surface, int32_t hotspot_x, int32_t hotspot_y, | ||
91 | struct wl_client *client); | ||
92 | |||
64 | void cursor_warp_to_container(struct sway_cursor *cursor, | 93 | void cursor_warp_to_container(struct sway_cursor *cursor, |
65 | struct sway_container *container); | 94 | struct sway_container *container); |
66 | 95 | ||
67 | void cursor_warp_to_workspace(struct sway_cursor *cursor, | 96 | void cursor_warp_to_workspace(struct sway_cursor *cursor, |
68 | struct sway_workspace *workspace); | 97 | struct sway_workspace *workspace); |
98 | |||
99 | uint32_t get_mouse_bindsym(const char *name, char **error); | ||
100 | |||
101 | uint32_t get_mouse_bindcode(const char *name, char **error); | ||
102 | |||
103 | // Considers both bindsym and bindcode | ||
104 | uint32_t get_mouse_button(const char *name, char **error); | ||
105 | |||
69 | #endif | 106 | #endif |
diff --git a/include/sway/input/input-manager.h b/include/sway/input/input-manager.h index 219aa9ba..8e8bf1f2 100644 --- a/include/sway/input/input-manager.h +++ b/include/sway/input/input-manager.h | |||
@@ -37,6 +37,10 @@ void input_manager_configure_xcursor(void); | |||
37 | 37 | ||
38 | void input_manager_apply_input_config(struct input_config *input_config); | 38 | void input_manager_apply_input_config(struct input_config *input_config); |
39 | 39 | ||
40 | void input_manager_reset_input(struct sway_input_device *input_device); | ||
41 | |||
42 | void input_manager_reset_all_inputs(); | ||
43 | |||
40 | void input_manager_apply_seat_config(struct seat_config *seat_config); | 44 | void input_manager_apply_seat_config(struct seat_config *seat_config); |
41 | 45 | ||
42 | struct sway_seat *input_manager_get_default_seat(void); | 46 | struct sway_seat *input_manager_get_default_seat(void); |
@@ -44,6 +48,12 @@ struct sway_seat *input_manager_get_default_seat(void); | |||
44 | struct sway_seat *input_manager_get_seat(const char *seat_name); | 48 | struct sway_seat *input_manager_get_seat(const char *seat_name); |
45 | 49 | ||
46 | /** | 50 | /** |
51 | * If none of the seat configs have a fallback setting (either true or false), | ||
52 | * create the default seat (if needed) and set it as the fallback | ||
53 | */ | ||
54 | void input_manager_verify_fallback_seat(void); | ||
55 | |||
56 | /** | ||
47 | * Gets the last seat the user interacted with | 57 | * Gets the last seat the user interacted with |
48 | */ | 58 | */ |
49 | struct sway_seat *input_manager_current_seat(void); | 59 | struct sway_seat *input_manager_current_seat(void); |
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h index bef2af77..d2f14895 100644 --- a/include/sway/input/seat.h +++ b/include/sway/input/seat.h | |||
@@ -6,6 +6,17 @@ | |||
6 | #include <wlr/util/edges.h> | 6 | #include <wlr/util/edges.h> |
7 | #include "sway/input/input-manager.h" | 7 | #include "sway/input/input-manager.h" |
8 | 8 | ||
9 | struct sway_seat; | ||
10 | |||
11 | struct sway_seatop_impl { | ||
12 | void (*motion)(struct sway_seat *seat, uint32_t time_msec); | ||
13 | void (*finish)(struct sway_seat *seat); | ||
14 | void (*abort)(struct sway_seat *seat); | ||
15 | void (*unref)(struct sway_seat *seat, struct sway_container *con); | ||
16 | void (*render)(struct sway_seat *seat, struct sway_output *output, | ||
17 | pixman_region32_t *damage); | ||
18 | }; | ||
19 | |||
9 | struct sway_seat_device { | 20 | struct sway_seat_device { |
10 | struct sway_seat *sway_seat; | 21 | struct sway_seat *sway_seat; |
11 | struct sway_input_device *input_device; | 22 | struct sway_input_device *input_device; |
@@ -35,15 +46,6 @@ struct sway_drag_icon { | |||
35 | struct wl_listener destroy; | 46 | struct wl_listener destroy; |
36 | }; | 47 | }; |
37 | 48 | ||
38 | enum sway_seat_operation { | ||
39 | OP_NONE, | ||
40 | OP_DOWN, | ||
41 | OP_MOVE_FLOATING, | ||
42 | OP_MOVE_TILING, | ||
43 | OP_RESIZE_FLOATING, | ||
44 | OP_RESIZE_TILING, | ||
45 | }; | ||
46 | |||
47 | struct sway_seat { | 49 | struct sway_seat { |
48 | struct wlr_seat *wlr_seat; | 50 | struct wlr_seat *wlr_seat; |
49 | struct sway_cursor *cursor; | 51 | struct sway_cursor *cursor; |
@@ -63,19 +65,10 @@ struct sway_seat { | |||
63 | int32_t touch_id; | 65 | int32_t touch_id; |
64 | double touch_x, touch_y; | 66 | double touch_x, touch_y; |
65 | 67 | ||
66 | // Operations (drag and resize) | 68 | // Seat operations (drag and resize) |
67 | enum sway_seat_operation operation; | 69 | const struct sway_seatop_impl *seatop_impl; |
68 | struct sway_container *op_container; | 70 | void *seatop_data; |
69 | struct sway_node *op_target_node; // target for tiling move | 71 | uint32_t seatop_button; |
70 | enum wlr_edges op_target_edge; | ||
71 | struct wlr_box op_drop_box; | ||
72 | enum wlr_edges op_resize_edge; | ||
73 | uint32_t op_button; | ||
74 | bool op_resize_preserve_ratio; | ||
75 | double op_ref_lx, op_ref_ly; // cursor's x/y at start of op | ||
76 | double op_ref_width, op_ref_height; // container's size at start of op | ||
77 | double op_ref_con_lx, op_ref_con_ly; // container's x/y at start of op | ||
78 | bool op_moved; // if the mouse moved during a down op | ||
79 | 72 | ||
80 | uint32_t last_button; | 73 | uint32_t last_button; |
81 | uint32_t last_button_serial; | 74 | uint32_t last_button_serial; |
@@ -99,6 +92,9 @@ void seat_add_device(struct sway_seat *seat, | |||
99 | void seat_configure_device(struct sway_seat *seat, | 92 | void seat_configure_device(struct sway_seat *seat, |
100 | struct sway_input_device *device); | 93 | struct sway_input_device *device); |
101 | 94 | ||
95 | void seat_reset_device(struct sway_seat *seat, | ||
96 | struct sway_input_device *input_device); | ||
97 | |||
102 | void seat_remove_device(struct sway_seat *seat, | 98 | void seat_remove_device(struct sway_seat *seat, |
103 | struct sway_input_device *device); | 99 | struct sway_input_device *device); |
104 | 100 | ||
@@ -174,33 +170,65 @@ void seat_apply_config(struct sway_seat *seat, struct seat_config *seat_config); | |||
174 | 170 | ||
175 | struct seat_config *seat_get_config(struct sway_seat *seat); | 171 | struct seat_config *seat_get_config(struct sway_seat *seat); |
176 | 172 | ||
173 | struct seat_config *seat_get_config_by_name(const char *name); | ||
174 | |||
177 | bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface); | 175 | bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface); |
178 | 176 | ||
179 | void drag_icon_update_position(struct sway_drag_icon *icon); | 177 | void drag_icon_update_position(struct sway_drag_icon *icon); |
180 | 178 | ||
181 | void seat_begin_down(struct sway_seat *seat, struct sway_container *con, | 179 | void seatop_begin_down(struct sway_seat *seat, |
182 | uint32_t button, double sx, double sy); | 180 | struct sway_container *con, uint32_t button, int sx, int sy); |
183 | 181 | ||
184 | void seat_begin_move_floating(struct sway_seat *seat, | 182 | void seatop_begin_move_floating(struct sway_seat *seat, |
185 | struct sway_container *con, uint32_t button); | 183 | struct sway_container *con, uint32_t button); |
186 | 184 | ||
187 | void seat_begin_move_tiling(struct sway_seat *seat, | 185 | void seatop_begin_move_tiling_threshold(struct sway_seat *seat, |
188 | struct sway_container *con, uint32_t button); | 186 | struct sway_container *con, uint32_t button); |
189 | 187 | ||
190 | void seat_begin_resize_floating(struct sway_seat *seat, | 188 | void seatop_begin_move_tiling(struct sway_seat *seat, |
189 | struct sway_container *con, uint32_t button); | ||
190 | |||
191 | void seatop_begin_resize_floating(struct sway_seat *seat, | ||
191 | struct sway_container *con, uint32_t button, enum wlr_edges edge); | 192 | struct sway_container *con, uint32_t button, enum wlr_edges edge); |
192 | 193 | ||
193 | void seat_begin_resize_tiling(struct sway_seat *seat, | 194 | void seatop_begin_resize_tiling(struct sway_seat *seat, |
194 | struct sway_container *con, uint32_t button, enum wlr_edges edge); | 195 | struct sway_container *con, uint32_t button, enum wlr_edges edge); |
195 | 196 | ||
196 | struct sway_container *seat_get_focus_inactive_floating(struct sway_seat *seat, | 197 | struct sway_container *seat_get_focus_inactive_floating(struct sway_seat *seat, |
197 | struct sway_workspace *workspace); | 198 | struct sway_workspace *workspace); |
198 | 199 | ||
199 | void seat_end_mouse_operation(struct sway_seat *seat); | ||
200 | |||
201 | void seat_pointer_notify_button(struct sway_seat *seat, uint32_t time_msec, | 200 | void seat_pointer_notify_button(struct sway_seat *seat, uint32_t time_msec, |
202 | uint32_t button, enum wlr_button_state state); | 201 | uint32_t button, enum wlr_button_state state); |
203 | 202 | ||
204 | void seat_consider_warp_to_focus(struct sway_seat *seat); | 203 | void seat_consider_warp_to_focus(struct sway_seat *seat); |
205 | 204 | ||
205 | bool seat_doing_seatop(struct sway_seat *seat); | ||
206 | |||
207 | void seatop_motion(struct sway_seat *seat, uint32_t time_msec); | ||
208 | |||
209 | /** | ||
210 | * End a seatop and apply the affects. | ||
211 | */ | ||
212 | void seatop_finish(struct sway_seat *seat); | ||
213 | |||
214 | /** | ||
215 | * End a seatop without applying the affects. | ||
216 | */ | ||
217 | void seatop_abort(struct sway_seat *seat); | ||
218 | |||
219 | /** | ||
220 | * Instructs the seatop implementation to drop any references to the given | ||
221 | * container (eg. because the container is destroying). | ||
222 | * The seatop may choose to abort itself in response to this. | ||
223 | */ | ||
224 | void seatop_unref(struct sway_seat *seat, struct sway_container *con); | ||
225 | |||
226 | /** | ||
227 | * Instructs a seatop to render anything that it needs to render | ||
228 | * (eg. dropzone for move-tiling) | ||
229 | */ | ||
230 | void seatop_render(struct sway_seat *seat, struct sway_output *output, | ||
231 | pixman_region32_t *damage); | ||
232 | |||
233 | |||
206 | #endif | 234 | #endif |
diff --git a/include/sway/output.h b/include/sway/output.h index 43c1ab96..bdf9614d 100644 --- a/include/sway/output.h +++ b/include/sway/output.h | |||
@@ -84,9 +84,7 @@ void output_damage_box(struct sway_output *output, struct wlr_box *box); | |||
84 | void output_damage_whole_container(struct sway_output *output, | 84 | void output_damage_whole_container(struct sway_output *output, |
85 | struct sway_container *con); | 85 | struct sway_container *con); |
86 | 86 | ||
87 | struct sway_output *output_by_name(const char *name); | 87 | struct sway_output *output_by_name_or_id(const char *name_or_id); |
88 | |||
89 | struct sway_output *output_by_identifier(const char *identifier); | ||
90 | 88 | ||
91 | void output_sort_workspaces(struct sway_output *output); | 89 | void output_sort_workspaces(struct sway_output *output); |
92 | 90 | ||
@@ -148,4 +146,12 @@ enum sway_container_layout output_get_default_layout( | |||
148 | 146 | ||
149 | void output_add_listeners(struct sway_output *output); | 147 | void output_add_listeners(struct sway_output *output); |
150 | 148 | ||
149 | void render_rect(struct wlr_output *wlr_output, | ||
150 | pixman_region32_t *output_damage, const struct wlr_box *_box, | ||
151 | float color[static 4]); | ||
152 | |||
153 | void premultiply_alpha(float color[4], float opacity); | ||
154 | |||
155 | void scale_box(struct wlr_box *box, float scale); | ||
156 | |||
151 | #endif | 157 | #endif |
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index f907aad2..9a432cb2 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h | |||
@@ -10,12 +10,6 @@ | |||
10 | struct sway_view; | 10 | struct sway_view; |
11 | struct sway_seat; | 11 | struct sway_seat; |
12 | 12 | ||
13 | #define TITLEBAR_BORDER_THICKNESS 1 | ||
14 | |||
15 | // Padding includes titlebar border | ||
16 | #define TITLEBAR_H_PADDING 3 | ||
17 | #define TITLEBAR_V_PADDING 4 | ||
18 | |||
19 | enum sway_container_layout { | 13 | enum sway_container_layout { |
20 | L_NONE, | 14 | L_NONE, |
21 | L_HORIZ, | 15 | L_HORIZ, |
@@ -339,4 +333,6 @@ void container_add_mark(struct sway_container *container, char *mark); | |||
339 | 333 | ||
340 | void container_update_marks_textures(struct sway_container *container); | 334 | void container_update_marks_textures(struct sway_container *container); |
341 | 335 | ||
336 | void container_raise_floating(struct sway_container *con); | ||
337 | |||
342 | #endif | 338 | #endif |
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index 4716c688..5cc9777b 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h | |||
@@ -195,6 +195,7 @@ struct sway_view_child { | |||
195 | 195 | ||
196 | struct sway_view *view; | 196 | struct sway_view *view; |
197 | struct wlr_surface *surface; | 197 | struct wlr_surface *surface; |
198 | bool mapped; | ||
198 | 199 | ||
199 | struct wl_listener surface_commit; | 200 | struct wl_listener surface_commit; |
200 | struct wl_listener surface_new_subsurface; | 201 | struct wl_listener surface_new_subsurface; |
@@ -203,6 +204,12 @@ struct sway_view_child { | |||
203 | struct wl_listener surface_destroy; | 204 | struct wl_listener surface_destroy; |
204 | }; | 205 | }; |
205 | 206 | ||
207 | struct sway_subsurface { | ||
208 | struct sway_view_child child; | ||
209 | |||
210 | struct wl_listener destroy; | ||
211 | }; | ||
212 | |||
206 | struct sway_xdg_popup_v6 { | 213 | struct sway_xdg_popup_v6 { |
207 | struct sway_view_child child; | 214 | struct sway_view_child child; |
208 | 215 | ||