diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/sway/config.h | 35 | ||||
-rw-r--r-- | include/sway/criteria.h | 3 | ||||
-rw-r--r-- | include/sway/input/cursor.h | 6 | ||||
-rw-r--r-- | include/sway/server.h | 10 | ||||
-rw-r--r-- | include/sway/tree/layout.h | 4 | ||||
-rw-r--r-- | include/sway/tree/view.h | 16 | ||||
-rw-r--r-- | include/sway/tree/workspace.h | 4 | ||||
-rw-r--r-- | include/util.h | 8 |
8 files changed, 65 insertions, 21 deletions
diff --git a/include/sway/config.h b/include/sway/config.h index b8da29c5..4a6bb780 100644 --- a/include/sway/config.h +++ b/include/sway/config.h | |||
@@ -1,6 +1,5 @@ | |||
1 | #ifndef _SWAY_CONFIG_H | 1 | #ifndef _SWAY_CONFIG_H |
2 | #define _SWAY_CONFIG_H | 2 | #define _SWAY_CONFIG_H |
3 | #define PID_WORKSPACE_TIMEOUT 60 | ||
4 | #include <libinput.h> | 3 | #include <libinput.h> |
5 | #include <stdint.h> | 4 | #include <stdint.h> |
6 | #include <string.h> | 5 | #include <string.h> |
@@ -22,14 +21,28 @@ struct sway_variable { | |||
22 | char *value; | 21 | char *value; |
23 | }; | 22 | }; |
24 | 23 | ||
24 | |||
25 | enum binding_input_type { | ||
26 | BINDING_KEYCODE, | ||
27 | BINDING_KEYSYM, | ||
28 | BINDING_MOUSE, | ||
29 | }; | ||
30 | |||
31 | enum binding_flags { | ||
32 | BINDING_RELEASE=1, | ||
33 | BINDING_LOCKED=2, // keyboard only | ||
34 | BINDING_BORDER=4, // mouse only; trigger on container border | ||
35 | BINDING_CONTENTS=8, // mouse only; trigger on container contents | ||
36 | BINDING_TITLEBAR=16 // mouse only; trigger on container titlebar | ||
37 | }; | ||
38 | |||
25 | /** | 39 | /** |
26 | * A key binding and an associated command. | 40 | * A key binding and an associated command. |
27 | */ | 41 | */ |
28 | struct sway_binding { | 42 | struct sway_binding { |
43 | enum binding_input_type type; | ||
29 | int order; | 44 | int order; |
30 | bool release; | 45 | uint32_t flags; |
31 | bool locked; | ||
32 | bool bindcode; | ||
33 | list_t *keys; // sorted in ascending order | 46 | list_t *keys; // sorted in ascending order |
34 | uint32_t modifiers; | 47 | uint32_t modifiers; |
35 | char *command; | 48 | char *command; |
@@ -50,6 +63,7 @@ struct sway_mode { | |||
50 | char *name; | 63 | char *name; |
51 | list_t *keysym_bindings; | 64 | list_t *keysym_bindings; |
52 | list_t *keycode_bindings; | 65 | list_t *keycode_bindings; |
66 | list_t *mouse_bindings; | ||
53 | bool pango; | 67 | bool pango; |
54 | }; | 68 | }; |
55 | 69 | ||
@@ -146,12 +160,6 @@ struct workspace_output { | |||
146 | char *workspace; | 160 | char *workspace; |
147 | }; | 161 | }; |
148 | 162 | ||
149 | struct pid_workspace { | ||
150 | pid_t *pid; | ||
151 | char *workspace; | ||
152 | time_t *time_added; | ||
153 | }; | ||
154 | |||
155 | struct bar_config { | 163 | struct bar_config { |
156 | /** | 164 | /** |
157 | * One of "dock", "hide", "invisible" | 165 | * One of "dock", "hide", "invisible" |
@@ -302,7 +310,6 @@ struct sway_config { | |||
302 | list_t *bars; | 310 | list_t *bars; |
303 | list_t *cmd_queue; | 311 | list_t *cmd_queue; |
304 | list_t *workspace_outputs; | 312 | list_t *workspace_outputs; |
305 | list_t *pid_workspaces; | ||
306 | list_t *output_configs; | 313 | list_t *output_configs; |
307 | list_t *input_configs; | 314 | list_t *input_configs; |
308 | list_t *seat_configs; | 315 | list_t *seat_configs; |
@@ -313,6 +320,7 @@ struct sway_config { | |||
313 | struct bar_config *current_bar; | 320 | struct bar_config *current_bar; |
314 | char *swaybg_command; | 321 | char *swaybg_command; |
315 | uint32_t floating_mod; | 322 | uint32_t floating_mod; |
323 | bool floating_mod_inverse; | ||
316 | uint32_t dragging_key; | 324 | uint32_t dragging_key; |
317 | uint32_t resizing_key; | 325 | uint32_t resizing_key; |
318 | char *floating_scroll_up_cmd; | 326 | char *floating_scroll_up_cmd; |
@@ -388,9 +396,6 @@ struct sway_config { | |||
388 | } handler_context; | 396 | } handler_context; |
389 | }; | 397 | }; |
390 | 398 | ||
391 | void pid_workspace_add(struct pid_workspace *pw); | ||
392 | void free_pid_workspace(struct pid_workspace *pw); | ||
393 | |||
394 | /** | 399 | /** |
395 | * Loads the main config from the given path. is_active should be true when | 400 | * Loads the main config from the given path. is_active should be true when |
396 | * reloading the config. | 401 | * reloading the config. |
@@ -482,6 +487,8 @@ void free_sway_binding(struct sway_binding *sb); | |||
482 | 487 | ||
483 | struct sway_binding *sway_binding_dup(struct sway_binding *sb); | 488 | struct sway_binding *sway_binding_dup(struct sway_binding *sb); |
484 | 489 | ||
490 | void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding); | ||
491 | |||
485 | void load_swaybars(); | 492 | void load_swaybars(); |
486 | 493 | ||
487 | void invoke_swaybar(struct bar_config *bar); | 494 | void invoke_swaybar(struct bar_config *bar); |
diff --git a/include/sway/criteria.h b/include/sway/criteria.h index 6a8337c5..b4ff7d49 100644 --- a/include/sway/criteria.h +++ b/include/sway/criteria.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _SWAY_CRITERIA_H | 2 | #define _SWAY_CRITERIA_H |
3 | 3 | ||
4 | #include <pcre.h> | 4 | #include <pcre.h> |
5 | #include "config.h" | ||
5 | #include "list.h" | 6 | #include "list.h" |
6 | #include "tree/view.h" | 7 | #include "tree/view.h" |
7 | 8 | ||
@@ -25,7 +26,9 @@ struct criteria { | |||
25 | pcre *instance; | 26 | pcre *instance; |
26 | pcre *con_mark; | 27 | pcre *con_mark; |
27 | uint32_t con_id; // internal ID | 28 | uint32_t con_id; // internal ID |
29 | #ifdef HAVE_XWAYLAND | ||
28 | uint32_t id; // X11 window ID | 30 | uint32_t id; // X11 window ID |
31 | #endif | ||
29 | pcre *window_role; | 32 | pcre *window_role; |
30 | uint32_t window_type; | 33 | uint32_t window_type; |
31 | bool floating; | 34 | bool floating; |
diff --git a/include/sway/input/cursor.h b/include/sway/input/cursor.h index b0a3a7c5..7ec45120 100644 --- a/include/sway/input/cursor.h +++ b/include/sway/input/cursor.h | |||
@@ -3,6 +3,8 @@ | |||
3 | #include <stdint.h> | 3 | #include <stdint.h> |
4 | #include "sway/input/seat.h" | 4 | #include "sway/input/seat.h" |
5 | 5 | ||
6 | #define SWAY_CURSOR_PRESSED_BUTTONS_CAP 32 | ||
7 | |||
6 | struct sway_cursor { | 8 | struct sway_cursor { |
7 | struct sway_seat *seat; | 9 | struct sway_seat *seat; |
8 | struct wlr_cursor *cursor; | 10 | struct wlr_cursor *cursor; |
@@ -29,6 +31,10 @@ struct sway_cursor { | |||
29 | uint32_t tool_buttons; | 31 | uint32_t tool_buttons; |
30 | 32 | ||
31 | struct wl_listener request_set_cursor; | 33 | struct wl_listener request_set_cursor; |
34 | |||
35 | // Mouse binding state | ||
36 | uint32_t pressed_buttons[SWAY_CURSOR_PRESSED_BUTTONS_CAP]; | ||
37 | size_t pressed_button_count; | ||
32 | }; | 38 | }; |
33 | 39 | ||
34 | void sway_cursor_destroy(struct sway_cursor *cursor); | 40 | void sway_cursor_destroy(struct sway_cursor *cursor); |
diff --git a/include/sway/server.h b/include/sway/server.h index 70bde6d4..a3782f91 100644 --- a/include/sway/server.h +++ b/include/sway/server.h | |||
@@ -12,7 +12,10 @@ | |||
12 | #include <wlr/render/wlr_renderer.h> | 12 | #include <wlr/render/wlr_renderer.h> |
13 | // TODO WLR: make Xwayland optional | 13 | // TODO WLR: make Xwayland optional |
14 | #include "list.h" | 14 | #include "list.h" |
15 | #include "config.h" | ||
16 | #ifdef HAVE_XWAYLAND | ||
15 | #include "sway/xwayland.h" | 17 | #include "sway/xwayland.h" |
18 | #endif | ||
16 | 19 | ||
17 | struct sway_server { | 20 | struct sway_server { |
18 | struct wl_display *wl_display; | 21 | struct wl_display *wl_display; |
@@ -39,11 +42,11 @@ struct sway_server { | |||
39 | 42 | ||
40 | struct wlr_xdg_shell *xdg_shell; | 43 | struct wlr_xdg_shell *xdg_shell; |
41 | struct wl_listener xdg_shell_surface; | 44 | struct wl_listener xdg_shell_surface; |
42 | 45 | #ifdef HAVE_XWAYLAND | |
43 | struct sway_xwayland xwayland; | 46 | struct sway_xwayland xwayland; |
44 | struct wl_listener xwayland_surface; | 47 | struct wl_listener xwayland_surface; |
45 | struct wl_listener xwayland_ready; | 48 | struct wl_listener xwayland_ready; |
46 | 49 | #endif | |
47 | bool debug_txn_timings; | 50 | bool debug_txn_timings; |
48 | 51 | ||
49 | list_t *transactions; | 52 | list_t *transactions; |
@@ -65,6 +68,7 @@ void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data); | |||
65 | void handle_layer_shell_surface(struct wl_listener *listener, void *data); | 68 | void handle_layer_shell_surface(struct wl_listener *listener, void *data); |
66 | void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data); | 69 | void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data); |
67 | void handle_xdg_shell_surface(struct wl_listener *listener, void *data); | 70 | void handle_xdg_shell_surface(struct wl_listener *listener, void *data); |
71 | #ifdef HAVE_XWAYLAND | ||
68 | void handle_xwayland_surface(struct wl_listener *listener, void *data); | 72 | void handle_xwayland_surface(struct wl_listener *listener, void *data); |
69 | 73 | #endif | |
70 | #endif | 74 | #endif |
diff --git a/include/sway/tree/layout.h b/include/sway/tree/layout.h index 7d7da2d7..a4c31bf6 100644 --- a/include/sway/tree/layout.h +++ b/include/sway/tree/layout.h | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <wlr/types/wlr_output_layout.h> | 3 | #include <wlr/types/wlr_output_layout.h> |
4 | #include <wlr/render/wlr_texture.h> | 4 | #include <wlr/render/wlr_texture.h> |
5 | #include "sway/tree/container.h" | 5 | #include "sway/tree/container.h" |
6 | #include "config.h" | ||
6 | 7 | ||
7 | enum movement_direction { | 8 | enum movement_direction { |
8 | MOVE_LEFT, | 9 | MOVE_LEFT, |
@@ -27,8 +28,9 @@ struct sway_root { | |||
27 | struct wlr_output_layout *output_layout; | 28 | struct wlr_output_layout *output_layout; |
28 | 29 | ||
29 | struct wl_listener output_layout_change; | 30 | struct wl_listener output_layout_change; |
30 | 31 | #ifdef HAVE_XWAYLAND | |
31 | struct wl_list xwayland_unmanaged; // sway_xwayland_unmanaged::link | 32 | struct wl_list xwayland_unmanaged; // sway_xwayland_unmanaged::link |
33 | #endif | ||
32 | struct wl_list drag_icons; // sway_drag_icon::link | 34 | struct wl_list drag_icons; // sway_drag_icon::link |
33 | 35 | ||
34 | struct wlr_texture *debug_tree; | 36 | struct wlr_texture *debug_tree; |
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index 3bdfe252..1972447b 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h | |||
@@ -3,7 +3,10 @@ | |||
3 | #include <wayland-server.h> | 3 | #include <wayland-server.h> |
4 | #include <wlr/types/wlr_surface.h> | 4 | #include <wlr/types/wlr_surface.h> |
5 | #include <wlr/types/wlr_xdg_shell_v6.h> | 5 | #include <wlr/types/wlr_xdg_shell_v6.h> |
6 | #include "config.h" | ||
7 | #ifdef HAVE_XWAYLAND | ||
6 | #include <wlr/xwayland.h> | 8 | #include <wlr/xwayland.h> |
9 | #endif | ||
7 | #include "sway/input/input-manager.h" | 10 | #include "sway/input/input-manager.h" |
8 | #include "sway/input/seat.h" | 11 | #include "sway/input/seat.h" |
9 | 12 | ||
@@ -12,7 +15,9 @@ struct sway_container; | |||
12 | enum sway_view_type { | 15 | enum sway_view_type { |
13 | SWAY_VIEW_XDG_SHELL_V6, | 16 | SWAY_VIEW_XDG_SHELL_V6, |
14 | SWAY_VIEW_XDG_SHELL, | 17 | SWAY_VIEW_XDG_SHELL, |
18 | #ifdef HAVE_XWAYLAND | ||
15 | SWAY_VIEW_XWAYLAND, | 19 | SWAY_VIEW_XWAYLAND, |
20 | #endif | ||
16 | }; | 21 | }; |
17 | 22 | ||
18 | enum sway_view_prop { | 23 | enum sway_view_prop { |
@@ -22,7 +27,9 @@ enum sway_view_prop { | |||
22 | VIEW_PROP_INSTANCE, | 27 | VIEW_PROP_INSTANCE, |
23 | VIEW_PROP_WINDOW_TYPE, | 28 | VIEW_PROP_WINDOW_TYPE, |
24 | VIEW_PROP_WINDOW_ROLE, | 29 | VIEW_PROP_WINDOW_ROLE, |
30 | #ifdef HAVE_XWAYLAND | ||
25 | VIEW_PROP_X11_WINDOW_ID, | 31 | VIEW_PROP_X11_WINDOW_ID, |
32 | #endif | ||
26 | }; | 33 | }; |
27 | 34 | ||
28 | struct sway_view_impl { | 35 | struct sway_view_impl { |
@@ -90,7 +97,9 @@ struct sway_view { | |||
90 | union { | 97 | union { |
91 | struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6; | 98 | struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6; |
92 | struct wlr_xdg_surface *wlr_xdg_surface; | 99 | struct wlr_xdg_surface *wlr_xdg_surface; |
100 | #ifdef HAVE_XWAYLAND | ||
93 | struct wlr_xwayland_surface *wlr_xwayland_surface; | 101 | struct wlr_xwayland_surface *wlr_xwayland_surface; |
102 | #endif | ||
94 | struct wlr_wl_shell_surface *wlr_wl_shell_surface; | 103 | struct wlr_wl_shell_surface *wlr_wl_shell_surface; |
95 | }; | 104 | }; |
96 | 105 | ||
@@ -133,7 +142,7 @@ struct sway_xdg_shell_view { | |||
133 | struct wl_listener unmap; | 142 | struct wl_listener unmap; |
134 | struct wl_listener destroy; | 143 | struct wl_listener destroy; |
135 | }; | 144 | }; |
136 | 145 | #ifdef HAVE_XWAYLAND | |
137 | struct sway_xwayland_view { | 146 | struct sway_xwayland_view { |
138 | struct sway_view view; | 147 | struct sway_view view; |
139 | 148 | ||
@@ -165,7 +174,7 @@ struct sway_xwayland_unmanaged { | |||
165 | struct wl_listener unmap; | 174 | struct wl_listener unmap; |
166 | struct wl_listener destroy; | 175 | struct wl_listener destroy; |
167 | }; | 176 | }; |
168 | 177 | #endif | |
169 | struct sway_view_child; | 178 | struct sway_view_child; |
170 | 179 | ||
171 | struct sway_view_child_impl { | 180 | struct sway_view_child_impl { |
@@ -281,9 +290,10 @@ struct sway_view *view_from_wlr_xdg_surface( | |||
281 | struct wlr_xdg_surface *xdg_surface); | 290 | struct wlr_xdg_surface *xdg_surface); |
282 | struct sway_view *view_from_wlr_xdg_surface_v6( | 291 | struct sway_view *view_from_wlr_xdg_surface_v6( |
283 | struct wlr_xdg_surface_v6 *xdg_surface_v6); | 292 | struct wlr_xdg_surface_v6 *xdg_surface_v6); |
293 | #ifdef HAVE_XWAYLAND | ||
284 | struct sway_view *view_from_wlr_xwayland_surface( | 294 | struct sway_view *view_from_wlr_xwayland_surface( |
285 | struct wlr_xwayland_surface *xsurface); | 295 | struct wlr_xwayland_surface *xsurface); |
286 | 296 | #endif | |
287 | struct sway_view *view_from_wlr_surface(struct wlr_surface *surface); | 297 | struct sway_view *view_from_wlr_surface(struct wlr_surface *surface); |
288 | 298 | ||
289 | /** | 299 | /** |
diff --git a/include/sway/tree/workspace.h b/include/sway/tree/workspace.h index bc95317a..ff66da6b 100644 --- a/include/sway/tree/workspace.h +++ b/include/sway/tree/workspace.h | |||
@@ -44,6 +44,10 @@ void workspace_output_add_priority(struct sway_container *workspace, | |||
44 | struct sway_container *workspace_output_get_highest_available( | 44 | struct sway_container *workspace_output_get_highest_available( |
45 | struct sway_container *ws, struct sway_container *exclude); | 45 | struct sway_container *ws, struct sway_container *exclude); |
46 | 46 | ||
47 | struct sway_container *workspace_for_pid(pid_t pid); | ||
48 | |||
49 | void workspace_record_pid(pid_t pid); | ||
50 | |||
47 | void workspace_detect_urgent(struct sway_container *workspace); | 51 | void workspace_detect_urgent(struct sway_container *workspace); |
48 | 52 | ||
49 | #endif | 53 | #endif |
diff --git a/include/util.h b/include/util.h index f68deae8..bda941ce 100644 --- a/include/util.h +++ b/include/util.h | |||
@@ -51,6 +51,14 @@ pid_t get_parent_pid(pid_t pid); | |||
51 | uint32_t parse_color(const char *color); | 51 | uint32_t parse_color(const char *color); |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * Given a string that represents a boolean, return the boolean value. This | ||
55 | * function also takes in the current boolean value to support toggling. If | ||
56 | * toggling is not desired, pass in true for current so that toggling values | ||
57 | * get parsed as not true. | ||
58 | */ | ||
59 | bool parse_boolean(const char *boolean, bool current); | ||
60 | |||
61 | /** | ||
54 | * Given a path string, recurseively resolves any symlinks to their targets | 62 | * Given a path string, recurseively resolves any symlinks to their targets |
55 | * (which may be a file, directory) and returns the result. | 63 | * (which may be a file, directory) and returns the result. |
56 | * argument is returned. Caller must free the returned buffer. | 64 | * argument is returned. Caller must free the returned buffer. |