aboutsummaryrefslogtreecommitdiff
path: root/include/sway
diff options
context:
space:
mode:
Diffstat (limited to 'include/sway')
-rw-r--r--include/sway/commands.h4
-rw-r--r--include/sway/config.h38
-rw-r--r--include/sway/criteria.h3
-rw-r--r--include/sway/desktop/transaction.h13
-rw-r--r--include/sway/input/cursor.h10
-rw-r--r--include/sway/input/input-manager.h3
-rw-r--r--include/sway/input/keyboard.h3
-rw-r--r--include/sway/input/seat.h35
-rw-r--r--include/sway/ipc-server.h2
-rw-r--r--include/sway/output.h52
-rw-r--r--include/sway/scratchpad.h26
-rw-r--r--include/sway/server.h10
-rw-r--r--include/sway/tree/container.h66
-rw-r--r--include/sway/tree/layout.h15
-rw-r--r--include/sway/tree/view.h59
-rw-r--r--include/sway/tree/workspace.h6
16 files changed, 254 insertions, 91 deletions
diff --git a/include/sway/commands.h b/include/sway/commands.h
index e71a7228..41858ccc 100644
--- a/include/sway/commands.h
+++ b/include/sway/commands.h
@@ -106,7 +106,7 @@ sway_cmd cmd_exit;
sway_cmd cmd_floating;
sway_cmd cmd_floating_maximum_size;
sway_cmd cmd_floating_minimum_size;
-sway_cmd cmd_floating_mod;
+sway_cmd cmd_floating_modifier;
sway_cmd cmd_floating_scroll;
sway_cmd cmd_focus;
sway_cmd cmd_focus_follows_mouse;
@@ -213,8 +213,10 @@ sway_cmd input_cmd_scroll_button;
sway_cmd input_cmd_scroll_method;
sway_cmd input_cmd_tap;
sway_cmd input_cmd_tap_button_map;
+sway_cmd input_cmd_xkb_capslock;
sway_cmd input_cmd_xkb_layout;
sway_cmd input_cmd_xkb_model;
+sway_cmd input_cmd_xkb_numlock;
sway_cmd input_cmd_xkb_options;
sway_cmd input_cmd_xkb_rules;
sway_cmd input_cmd_xkb_variant;
diff --git a/include/sway/config.h b/include/sway/config.h
index b8da29c5..909b6827 100644
--- a/include/sway/config.h
+++ b/include/sway/config.h
@@ -1,6 +1,5 @@
#ifndef _SWAY_CONFIG_H
#define _SWAY_CONFIG_H
-#define PID_WORKSPACE_TIMEOUT 60
#include <libinput.h>
#include <stdint.h>
#include <string.h>
@@ -22,14 +21,28 @@ struct sway_variable {
char *value;
};
+
+enum binding_input_type {
+ BINDING_KEYCODE,
+ BINDING_KEYSYM,
+ BINDING_MOUSE,
+};
+
+enum binding_flags {
+ BINDING_RELEASE=1,
+ BINDING_LOCKED=2, // keyboard only
+ BINDING_BORDER=4, // mouse only; trigger on container border
+ BINDING_CONTENTS=8, // mouse only; trigger on container contents
+ BINDING_TITLEBAR=16 // mouse only; trigger on container titlebar
+};
+
/**
* A key binding and an associated command.
*/
struct sway_binding {
+ enum binding_input_type type;
int order;
- bool release;
- bool locked;
- bool bindcode;
+ uint32_t flags;
list_t *keys; // sorted in ascending order
uint32_t modifiers;
char *command;
@@ -50,6 +63,7 @@ struct sway_mode {
char *name;
list_t *keysym_bindings;
list_t *keycode_bindings;
+ list_t *mouse_bindings;
bool pango;
};
@@ -87,6 +101,9 @@ struct input_config {
char *xkb_rules;
char *xkb_variant;
+ int xkb_numlock;
+ int xkb_capslock;
+
struct input_config_mapped_from_region *mapped_from_region;
char *mapped_to_output;
@@ -146,12 +163,6 @@ struct workspace_output {
char *workspace;
};
-struct pid_workspace {
- pid_t *pid;
- char *workspace;
- time_t *time_added;
-};
-
struct bar_config {
/**
* One of "dock", "hide", "invisible"
@@ -302,7 +313,6 @@ struct sway_config {
list_t *bars;
list_t *cmd_queue;
list_t *workspace_outputs;
- list_t *pid_workspaces;
list_t *output_configs;
list_t *input_configs;
list_t *seat_configs;
@@ -313,6 +323,7 @@ struct sway_config {
struct bar_config *current_bar;
char *swaybg_command;
uint32_t floating_mod;
+ bool floating_mod_inverse;
uint32_t dragging_key;
uint32_t resizing_key;
char *floating_scroll_up_cmd;
@@ -388,9 +399,6 @@ struct sway_config {
} handler_context;
};
-void pid_workspace_add(struct pid_workspace *pw);
-void free_pid_workspace(struct pid_workspace *pw);
-
/**
* Loads the main config from the given path. is_active should be true when
* reloading the config.
@@ -480,7 +488,7 @@ int sway_binding_cmp_keys(const void *a, const void *b);
void free_sway_binding(struct sway_binding *sb);
-struct sway_binding *sway_binding_dup(struct sway_binding *sb);
+void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding);
void load_swaybars();
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 @@
#define _SWAY_CRITERIA_H
#include <pcre.h>
+#include "config.h"
#include "list.h"
#include "tree/view.h"
@@ -25,7 +26,9 @@ struct criteria {
pcre *instance;
pcre *con_mark;
uint32_t con_id; // internal ID
+#ifdef HAVE_XWAYLAND
uint32_t id; // X11 window ID
+#endif
pcre *window_role;
uint32_t window_type;
bool floating;
diff --git a/include/sway/desktop/transaction.h b/include/sway/desktop/transaction.h
index cee4afed..56361d94 100644
--- a/include/sway/desktop/transaction.h
+++ b/include/sway/desktop/transaction.h
@@ -42,17 +42,4 @@ void transaction_notify_view_ready(struct sway_view *view, uint32_t serial);
void transaction_notify_view_ready_by_size(struct sway_view *view,
int width, int height);
-/**
- * Get the saved texture that should be rendered for a view.
- *
- * The addresses pointed at by the width and height pointers will be populated
- * with the surface's dimensions, which may be different to the texture's
- * dimensions if output scaling is used.
- *
- * This function should only be called if it is known that the view has
- * instructions.
- */
-struct wlr_texture *transaction_get_saved_texture(struct sway_view *view,
- int *width, int *height);
-
#endif
diff --git a/include/sway/input/cursor.h b/include/sway/input/cursor.h
index 5dd109ca..7ec45120 100644
--- a/include/sway/input/cursor.h
+++ b/include/sway/input/cursor.h
@@ -3,6 +3,8 @@
#include <stdint.h>
#include "sway/input/seat.h"
+#define SWAY_CURSOR_PRESSED_BUTTONS_CAP 32
+
struct sway_cursor {
struct sway_seat *seat;
struct wlr_cursor *cursor;
@@ -11,6 +13,7 @@ struct sway_cursor {
} previous;
struct wlr_xcursor_manager *xcursor_manager;
+ const char *image;
struct wl_client *image_client;
struct wl_listener motion;
@@ -28,6 +31,10 @@ struct sway_cursor {
uint32_t tool_buttons;
struct wl_listener request_set_cursor;
+
+ // Mouse binding state
+ uint32_t pressed_buttons[SWAY_CURSOR_PRESSED_BUTTONS_CAP];
+ size_t pressed_button_count;
};
void sway_cursor_destroy(struct sway_cursor *cursor);
@@ -37,4 +44,7 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec,
void dispatch_cursor_button(struct sway_cursor *cursor, uint32_t time_msec,
uint32_t button, enum wlr_button_state state);
+void cursor_set_image(struct sway_cursor *cursor, const char *image,
+ struct wl_client *client);
+
#endif
diff --git a/include/sway/input/input-manager.h b/include/sway/input/input-manager.h
index 89a3ac71..aa2f6f19 100644
--- a/include/sway/input/input-manager.h
+++ b/include/sway/input/input-manager.h
@@ -2,6 +2,7 @@
#define _SWAY_INPUT_INPUT_MANAGER_H
#include <libinput.h>
#include <wlr/types/wlr_input_inhibitor.h>
+#include <wlr/types/wlr_virtual_keyboard_v1.h>
#include "sway/server.h"
#include "sway/config.h"
#include "list.h"
@@ -25,10 +26,12 @@ struct sway_input_manager {
struct wl_list seats;
struct wlr_input_inhibit_manager *inhibit;
+ struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard;
struct wl_listener new_input;
struct wl_listener inhibit_activate;
struct wl_listener inhibit_deactivate;
+ struct wl_listener virtual_keyboard_new;
};
struct sway_input_manager *input_manager_create(struct sway_server *server);
diff --git a/include/sway/input/keyboard.h b/include/sway/input/keyboard.h
index 6713398e..6d28454c 100644
--- a/include/sway/input/keyboard.h
+++ b/include/sway/input/keyboard.h
@@ -38,6 +38,9 @@ struct sway_keyboard {
struct sway_shortcut_state state_keysyms_raw;
struct sway_shortcut_state state_keycodes;
struct sway_binding *held_binding;
+
+ struct wl_event_source *key_repeat_source;
+ struct sway_binding *repeat_binding;
};
struct sway_keyboard *sway_keyboard_create(struct sway_seat *seat,
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h
index eac1626b..92387601 100644
--- a/include/sway/input/seat.h
+++ b/include/sway/input/seat.h
@@ -3,6 +3,7 @@
#include <wlr/types/wlr_layer_shell.h>
#include <wlr/types/wlr_seat.h>
+#include <wlr/util/edges.h>
#include "sway/input/input-manager.h"
struct sway_seat_device {
@@ -52,6 +53,24 @@ struct sway_seat {
int32_t touch_id;
double touch_x, touch_y;
+ // Operations (drag and resize)
+ enum {
+ OP_NONE,
+ OP_MOVE,
+ OP_RESIZE,
+ } operation;
+
+ struct sway_container *op_container;
+ enum wlr_edges op_resize_edge;
+ uint32_t op_button;
+ bool op_resize_preserve_ratio;
+ double op_ref_lx, op_ref_ly; // cursor's x/y at start of op
+ double op_ref_width, op_ref_height; // container's size at start of op
+ double op_ref_con_lx, op_ref_con_ly; // container's x/y at start of op
+
+ uint32_t last_button;
+ uint32_t last_button_serial;
+
struct wl_listener focus_destroy;
struct wl_listener new_container;
struct wl_listener new_drag_icon;
@@ -80,7 +99,7 @@ void seat_configure_xcursor(struct sway_seat *seat);
void seat_set_focus(struct sway_seat *seat, struct sway_container *container);
void seat_set_focus_warp(struct sway_seat *seat,
- struct sway_container *container, bool warp);
+ struct sway_container *container, bool warp, bool notify);
void seat_set_focus_surface(struct sway_seat *seat,
struct wlr_surface *surface, bool unfocus);
@@ -105,6 +124,9 @@ struct sway_container *seat_get_focus(struct sway_seat *seat);
struct sway_container *seat_get_focus_inactive(struct sway_seat *seat,
struct sway_container *container);
+struct sway_container *seat_get_focus_inactive_tiling(struct sway_seat *seat,
+ struct sway_container *container);
+
/**
* Descend into the focus stack to find the focus-inactive view. Useful for
* container placement when they change position in the tree.
@@ -134,4 +156,15 @@ bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface);
void drag_icon_update_position(struct sway_drag_icon *icon);
+void seat_begin_move(struct sway_seat *seat, struct sway_container *con,
+ uint32_t button);
+
+void seat_begin_resize(struct sway_seat *seat, struct sway_container *con,
+ uint32_t button, enum wlr_edges edge);
+
+void seat_end_mouse_operation(struct sway_seat *seat);
+
+void seat_pointer_notify_button(struct sway_seat *seat, uint32_t time_msec,
+ uint32_t button, enum wlr_button_state state);
+
#endif
diff --git a/include/sway/ipc-server.h b/include/sway/ipc-server.h
index 6469f097..4b6d0e25 100644
--- a/include/sway/ipc-server.h
+++ b/include/sway/ipc-server.h
@@ -16,5 +16,7 @@ void ipc_event_workspace(struct sway_container *old,
void ipc_event_window(struct sway_container *window, const char *change);
void ipc_event_barconfig_update(struct bar_config *bar);
void ipc_event_mode(const char *mode, bool pango);
+void ipc_event_shutdown(const char *reason);
+void ipc_event_binding(struct sway_binding *binding);
#endif
diff --git a/include/sway/output.h b/include/sway/output.h
index b6cda83c..80dcd37b 100644
--- a/include/sway/output.h
+++ b/include/sway/output.h
@@ -5,6 +5,7 @@
#include <wayland-server.h>
#include <wlr/types/wlr_box.h>
#include <wlr/types/wlr_output.h>
+#include "config.h"
#include "sway/tree/view.h"
struct sway_server;
@@ -38,15 +39,9 @@ struct sway_output {
} events;
};
-/**
- * Contains a surface's root geometry information. For instance, when rendering
- * a popup, this will contain the parent view's position and size.
- */
-struct root_geometry {
- double x, y;
- int width, height;
- float rotation;
-};
+typedef void (*sway_surface_iterator_func_t)(struct sway_output *output,
+ struct wlr_surface *surface, struct wlr_box *box, float rotation,
+ void *user_data);
void output_damage_whole(struct sway_output *output);
@@ -65,36 +60,37 @@ struct sway_container *output_by_name(const char *name);
void output_enable(struct sway_output *output);
-bool output_has_opaque_lockscreen(struct sway_output *output,
- struct sway_seat *seat);
+bool output_has_opaque_overlay_layer_surface(struct sway_output *output);
struct sway_container *output_get_active_workspace(struct sway_output *output);
void output_render(struct sway_output *output, struct timespec *when,
pixman_region32_t *damage);
-bool output_get_surface_box(struct root_geometry *geo,
- struct sway_output *output, struct wlr_surface *surface, int sx, int sy,
- struct wlr_box *surface_box);
+void output_surface_for_each_surface(struct sway_output *output,
+ struct wlr_surface *surface, double ox, double oy,
+ sway_surface_iterator_func_t iterator, void *user_data);
-void output_surface_for_each_surface(struct wlr_surface *surface,
- double ox, double oy, struct root_geometry *geo,
- wlr_surface_iterator_func_t iterator, void *user_data);
+void output_view_for_each_surface(struct sway_output *output,
+ struct sway_view *view, sway_surface_iterator_func_t iterator,
+ void *user_data);
-void output_view_for_each_surface(struct sway_view *view,
- struct sway_output *output, struct root_geometry *geo,
- wlr_surface_iterator_func_t iterator, void *user_data);
+void output_view_for_each_popup(struct sway_output *output,
+ struct sway_view *view, sway_surface_iterator_func_t iterator,
+ void *user_data);
-void output_layer_for_each_surface(struct wl_list *layer_surfaces,
- struct root_geometry *geo, wlr_surface_iterator_func_t iterator,
+void output_layer_for_each_surface(struct sway_output *output,
+ struct wl_list *layer_surfaces, sway_surface_iterator_func_t iterator,
void *user_data);
-void output_unmanaged_for_each_surface(struct wl_list *unmanaged,
- struct sway_output *output, struct root_geometry *geo,
- wlr_surface_iterator_func_t iterator, void *user_data);
+#ifdef HAVE_XWAYLAND
+void output_unmanaged_for_each_surface(struct sway_output *output,
+ struct wl_list *unmanaged, sway_surface_iterator_func_t iterator,
+ void *user_data);
+#endif
-void output_drag_icons_for_each_surface(struct wl_list *drag_icons,
- struct sway_output *output, struct root_geometry *geo,
- wlr_surface_iterator_func_t iterator, void *user_data);
+void output_drag_icons_for_each_surface(struct sway_output *output,
+ struct wl_list *drag_icons, sway_surface_iterator_func_t iterator,
+ void *user_data);
#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 @@
+#ifndef _SWAY_SCRATCHPAD_H
+#define _SWAY_SCRATCHPAD_H
+
+#include "tree/container.h"
+
+/**
+ * Move a container to the scratchpad.
+ */
+void scratchpad_add_container(struct sway_container *con);
+
+/**
+ * Remove a container from the scratchpad.
+ */
+void scratchpad_remove_container(struct sway_container *con);
+
+/**
+ * Show or hide the next container on the scratchpad.
+ */
+void scratchpad_toggle_auto(void);
+
+/**
+ * Show or hide a specific container on the scratchpad.
+ */
+void scratchpad_toggle_container(struct sway_container *con);
+
+#endif
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 @@
#include <wlr/render/wlr_renderer.h>
// TODO WLR: make Xwayland optional
#include "list.h"
+#include "config.h"
+#ifdef HAVE_XWAYLAND
#include "sway/xwayland.h"
+#endif
struct sway_server {
struct wl_display *wl_display;
@@ -39,11 +42,11 @@ struct sway_server {
struct wlr_xdg_shell *xdg_shell;
struct wl_listener xdg_shell_surface;
-
+#ifdef HAVE_XWAYLAND
struct sway_xwayland xwayland;
struct wl_listener xwayland_surface;
struct wl_listener xwayland_ready;
-
+#endif
bool debug_txn_timings;
list_t *transactions;
@@ -65,6 +68,7 @@ void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data);
void handle_layer_shell_surface(struct wl_listener *listener, void *data);
void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data);
void handle_xdg_shell_surface(struct wl_listener *listener, void *data);
+#ifdef HAVE_XWAYLAND
void handle_xwayland_surface(struct wl_listener *listener, void *data);
-
+#endif
#endif
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h
index ca7a3288..c3942e9e 100644
--- a/include/sway/tree/container.h
+++ b/include/sway/tree/container.h
@@ -60,6 +60,8 @@ struct sway_container_state {
double swayc_x, swayc_y;
double swayc_width, swayc_height;
+ bool is_fullscreen;
+
bool has_gaps;
double current_gaps;
double gaps_inner;
@@ -74,7 +76,6 @@ struct sway_container_state {
// View properties
double view_x, view_y;
double view_width, view_height;
- bool is_fullscreen;
enum sway_container_border border;
int border_thickness;
@@ -84,7 +85,7 @@ struct sway_container_state {
bool border_right;
// Workspace properties
- struct sway_view *ws_fullscreen;
+ struct sway_container *ws_fullscreen;
struct sway_container *ws_floating;
};
@@ -124,6 +125,8 @@ struct sway_container {
double saved_x, saved_y;
double saved_width, saved_height;
+ bool is_fullscreen;
+
// The gaps currently applied to the container.
double current_gaps;
@@ -135,6 +138,11 @@ struct sway_container {
struct sway_container *parent;
+ // Indicates that the container is a scratchpad container.
+ // Both hidden and visible scratchpad containers have scratchpad=true.
+ // Hidden scratchpad containers have a NULL parent.
+ bool scratchpad;
+
float alpha;
struct wlr_texture *title_focused;
@@ -222,16 +230,13 @@ struct sway_container *container_parent(struct sway_container *container,
* surface-local coordinates of the given layout coordinates if the container
* is a view and the view contains a surface at those coordinates.
*/
-struct sway_container *container_at(struct sway_container *container,
- double ox, double oy, struct wlr_surface **surface,
+struct sway_container *container_at(struct sway_container *workspace,
+ double lx, double ly, struct wlr_surface **surface,
double *sx, double *sy);
-/**
- * Same as container_at, but only checks floating views and expects coordinates
- * to be layout coordinates, as that's what floating views use.
- */
-struct sway_container *floating_container_at(double lx, double ly,
- struct wlr_surface **surface, double *sx, double *sy);
+struct sway_container *container_at_view(struct sway_container *view,
+ double lx, double ly, struct wlr_surface **surface,
+ double *sx, double *sy);
/**
* Apply the function for each descendant of the container breadth first.
@@ -262,6 +267,8 @@ int container_count_descendants_of_type(struct sway_container *con,
void container_create_notify(struct sway_container *container);
+void container_update_textures_recursive(struct sway_container *con);
+
void container_damage_whole(struct sway_container *container);
bool container_reap_empty(struct sway_container *con);
@@ -289,6 +296,11 @@ void container_notify_subtree_changed(struct sway_container *container);
*/
size_t container_titlebar_height(void);
+/**
+ * Resize and center the container in its workspace.
+ */
+void container_init_floating(struct sway_container *container);
+
void container_set_floating(struct sway_container *container, bool enable);
void container_set_geometry_from_floating_view(struct sway_container *con);
@@ -305,6 +317,12 @@ bool container_is_floating(struct sway_container *container);
void container_get_box(struct sway_container *container, struct wlr_box *box);
/**
+ * Move a floating container by the specified amount.
+ */
+void container_floating_translate(struct sway_container *con,
+ double x_amount, double y_amount);
+
+/**
* Move a floating container to a new layout-local position.
*/
void container_floating_move_to(struct sway_container *con,
@@ -318,4 +336,32 @@ void container_set_dirty(struct sway_container *container);
bool container_has_urgent_child(struct sway_container *container);
+/**
+ * If the container is involved in a drag or resize operation via a mouse, this
+ * ends the operation.
+ */
+void container_end_mouse_operation(struct sway_container *container);
+
+void container_set_fullscreen(struct sway_container *container, bool enable);
+
+/**
+ * Return true if the container is floating, or a child of a floating split
+ * container.
+ */
+bool container_is_floating_or_child(struct sway_container *container);
+
+/**
+ * Return true if the container is fullscreen, or a child of a fullscreen split
+ * container.
+ */
+bool container_is_fullscreen_or_child(struct sway_container *container);
+
+/**
+ * Wrap the children of parent in a new container. The new container will be the
+ * only child of parent.
+ *
+ * The new container is returned.
+ */
+struct sway_container *container_wrap_children(struct sway_container *parent);
+
#endif
diff --git a/include/sway/tree/layout.h b/include/sway/tree/layout.h
index ba265623..a4c31bf6 100644
--- a/include/sway/tree/layout.h
+++ b/include/sway/tree/layout.h
@@ -3,6 +3,7 @@
#include <wlr/types/wlr_output_layout.h>
#include <wlr/render/wlr_texture.h>
#include "sway/tree/container.h"
+#include "config.h"
enum movement_direction {
MOVE_LEFT,
@@ -14,10 +15,11 @@ enum movement_direction {
};
enum resize_edge {
- RESIZE_EDGE_LEFT,
- RESIZE_EDGE_RIGHT,
- RESIZE_EDGE_TOP,
- RESIZE_EDGE_BOTTOM,
+ RESIZE_EDGE_NONE = 0,
+ RESIZE_EDGE_LEFT = 1,
+ RESIZE_EDGE_RIGHT = 2,
+ RESIZE_EDGE_TOP = 4,
+ RESIZE_EDGE_BOTTOM = 8,
};
struct sway_container;
@@ -26,14 +28,17 @@ struct sway_root {
struct wlr_output_layout *output_layout;
struct wl_listener output_layout_change;
-
+#ifdef HAVE_XWAYLAND
struct wl_list xwayland_unmanaged; // sway_xwayland_unmanaged::link
+#endif
struct wl_list drag_icons; // sway_drag_icon::link
struct wlr_texture *debug_tree;
struct wl_list outputs; // sway_output::link
+ list_t *scratchpad; // struct sway_container
+
struct {
struct wl_signal new_container;
} events;
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h
index 068d92c6..37fd02bc 100644
--- a/include/sway/tree/view.h
+++ b/include/sway/tree/view.h
@@ -3,7 +3,10 @@
#include <wayland-server.h>
#include <wlr/types/wlr_surface.h>
#include <wlr/types/wlr_xdg_shell_v6.h>
+#include "config.h"
+#ifdef HAVE_XWAYLAND
#include <wlr/xwayland.h>
+#endif
#include "sway/input/input-manager.h"
#include "sway/input/seat.h"
@@ -12,7 +15,9 @@ struct sway_container;
enum sway_view_type {
SWAY_VIEW_XDG_SHELL_V6,
SWAY_VIEW_XDG_SHELL,
+#ifdef HAVE_XWAYLAND
SWAY_VIEW_XWAYLAND,
+#endif
};
enum sway_view_prop {
@@ -22,10 +27,14 @@ enum sway_view_prop {
VIEW_PROP_INSTANCE,
VIEW_PROP_WINDOW_TYPE,
VIEW_PROP_WINDOW_ROLE,
+#ifdef HAVE_XWAYLAND
VIEW_PROP_X11_WINDOW_ID,
+#endif
};
struct sway_view_impl {
+ void (*get_constraints)(struct sway_view *view, double *min_width,
+ double *max_width, double *min_height, double *max_height);
const char *(*get_string_prop)(struct sway_view *view,
enum sway_view_prop prop);
uint32_t (*get_int_prop)(struct sway_view *view, enum sway_view_prop prop);
@@ -38,7 +47,10 @@ struct sway_view_impl {
bool (*has_client_side_decorations)(struct sway_view *view);
void (*for_each_surface)(struct sway_view *view,
wlr_surface_iterator_func_t iterator, void *user_data);
+ void (*for_each_popup)(struct sway_view *view,
+ wlr_surface_iterator_func_t iterator, void *user_data);
void (*close)(struct sway_view *view);
+ void (*close_popups)(struct sway_view *view);
void (*destroy)(struct sway_view *view);
};
@@ -60,8 +72,6 @@ struct sway_view {
// Used when changing a view from tiled to floating.
int natural_width, natural_height;
- bool is_fullscreen;
-
char *title_format;
enum sway_container_border border;
int border_thickness;
@@ -75,6 +85,9 @@ struct sway_view {
bool allow_request_urgent;
struct wl_event_source *urgent_timer;
+ struct wlr_buffer *saved_buffer;
+ int saved_buffer_width, saved_buffer_height;
+
bool destroying;
list_t *executed_criteria; // struct criteria *
@@ -88,7 +101,9 @@ struct sway_view {
union {
struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6;
struct wlr_xdg_surface *wlr_xdg_surface;
+#ifdef HAVE_XWAYLAND
struct wlr_xwayland_surface *wlr_xwayland_surface;
+#endif
struct wlr_wl_shell_surface *wlr_wl_shell_surface;
};
@@ -108,6 +123,8 @@ struct sway_xdg_shell_v6_view {
struct wl_listener request_resize;
struct wl_listener request_maximize;
struct wl_listener request_fullscreen;
+ struct wl_listener set_title;
+ struct wl_listener set_app_id;
struct wl_listener new_popup;
struct wl_listener map;
struct wl_listener unmap;
@@ -122,12 +139,14 @@ struct sway_xdg_shell_view {
struct wl_listener request_resize;
struct wl_listener request_maximize;
struct wl_listener request_fullscreen;
+ struct wl_listener set_title;
+ struct wl_listener set_app_id;
struct wl_listener new_popup;
struct wl_listener map;
struct wl_listener unmap;
struct wl_listener destroy;
};
-
+#ifdef HAVE_XWAYLAND
struct sway_xwayland_view {
struct sway_view view;
@@ -159,7 +178,7 @@ struct sway_xwayland_unmanaged {
struct wl_listener unmap;
struct wl_listener destroy;
};
-
+#endif
struct sway_view_child;
struct sway_view_child_impl {
@@ -215,15 +234,13 @@ uint32_t view_get_window_type(struct sway_view *view);
const char *view_get_shell(struct sway_view *view);
+void view_get_constraints(struct sway_view *view, double *min_width,
+ double *max_width, double *min_height, double *max_height);
+
uint32_t view_configure(struct sway_view *view, double lx, double ly, int width,
int height);
/**
- * Center the view in its workspace and build the swayc decorations around it.
- */
-void view_init_floating(struct sway_view *view);
-
-/**
* Configure the view's position and size based on the swayc's position and
* size, taking borders into consideration.
*/
@@ -233,17 +250,24 @@ void view_set_activated(struct sway_view *view, bool activated);
void view_set_tiled(struct sway_view *view, bool tiled);
-void view_set_fullscreen_raw(struct sway_view *view, bool fullscreen);
-
-void view_set_fullscreen(struct sway_view *view, bool fullscreen);
-
void view_close(struct sway_view *view);
+void view_close_popups(struct sway_view *view);
+
void view_damage_from(struct sway_view *view);
+/**
+ * Iterate all surfaces of a view (toplevels + popups).
+ */
void view_for_each_surface(struct sway_view *view,
wlr_surface_iterator_func_t iterator, void *user_data);
+/**
+ * Iterate all popups recursively.
+ */
+void view_for_each_popup(struct sway_view *view,
+ wlr_surface_iterator_func_t iterator, void *user_data);
+
// view implementation
void view_init(struct sway_view *view, enum sway_view_type type,
@@ -272,9 +296,10 @@ struct sway_view *view_from_wlr_xdg_surface(
struct wlr_xdg_surface *xdg_surface);
struct sway_view *view_from_wlr_xdg_surface_v6(
struct wlr_xdg_surface_v6 *xdg_surface_v6);
+#ifdef HAVE_XWAYLAND
struct sway_view *view_from_wlr_xwayland_surface(
struct wlr_xwayland_surface *xsurface);
-
+#endif
struct sway_view *view_from_wlr_surface(struct wlr_surface *surface);
/**
@@ -303,6 +328,8 @@ void view_clear_marks(struct sway_view *view);
bool view_has_mark(struct sway_view *view, char *mark);
+void view_add_mark(struct sway_view *view, char *mark);
+
void view_update_marks_textures(struct sway_view *view);
/**
@@ -315,4 +342,8 @@ void view_set_urgent(struct sway_view *view, bool enable);
bool view_is_urgent(struct sway_view *view);
+void view_remove_saved_buffer(struct sway_view *view);
+
+void view_save_buffer(struct sway_view *view);
+
#endif
diff --git a/include/sway/tree/workspace.h b/include/sway/tree/workspace.h
index bc95317a..5ae0ae3a 100644
--- a/include/sway/tree/workspace.h
+++ b/include/sway/tree/workspace.h
@@ -7,7 +7,7 @@ struct sway_view;
struct sway_workspace {
struct sway_container *swayc;
- struct sway_view *fullscreen;
+ struct sway_container *fullscreen;
struct sway_container *floating;
list_t *output_priority;
bool urgent;
@@ -44,6 +44,10 @@ void workspace_output_add_priority(struct sway_container *workspace,
struct sway_container *workspace_output_get_highest_available(
struct sway_container *ws, struct sway_container *exclude);
+struct sway_container *workspace_for_pid(pid_t pid);
+
+void workspace_record_pid(pid_t pid);
+
void workspace_detect_urgent(struct sway_container *workspace);
#endif