aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/sway/config.h35
-rw-r--r--include/sway/criteria.h3
-rw-r--r--include/sway/input/cursor.h6
-rw-r--r--include/sway/server.h10
-rw-r--r--include/sway/tree/layout.h4
-rw-r--r--include/sway/tree/view.h16
-rw-r--r--include/sway/tree/workspace.h4
-rw-r--r--include/util.h8
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 @@
#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;
};
@@ -146,12 +160,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 +310,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 +320,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 +396,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.
@@ -482,6 +487,8 @@ 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();
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 @@
#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/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 @@
#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;
@@ -29,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);
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/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 @@
#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,
@@ -27,8 +28,9 @@ 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;
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 @@
#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,7 +27,9 @@ 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 {
@@ -90,7 +97,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;
};
@@ -133,7 +142,7 @@ struct sway_xdg_shell_view {
struct wl_listener unmap;
struct wl_listener destroy;
};
-
+#ifdef HAVE_XWAYLAND
struct sway_xwayland_view {
struct sway_view view;
@@ -165,7 +174,7 @@ struct sway_xwayland_unmanaged {
struct wl_listener unmap;
struct wl_listener destroy;
};
-
+#endif
struct sway_view_child;
struct sway_view_child_impl {
@@ -281,9 +290,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);
/**
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,
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
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);
uint32_t parse_color(const char *color);
/**
+ * Given a string that represents a boolean, return the boolean value. This
+ * function also takes in the current boolean value to support toggling. If
+ * toggling is not desired, pass in true for current so that toggling values
+ * get parsed as not true.
+ */
+bool parse_boolean(const char *boolean, bool current);
+
+/**
* Given a path string, recurseively resolves any symlinks to their targets
* (which may be a file, directory) and returns the result.
* argument is returned. Caller must free the returned buffer.