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