aboutsummaryrefslogtreecommitdiff
path: root/include/sway/old
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-11-18 11:22:02 -0500
committerDrew DeVault <sir@cmpwn.com>2017-11-18 11:22:02 -0500
commit733993a651c71f7e2198d505960d6bbd31e0e107 (patch)
treee51732c5872b624e73355f9e5b3f762101f3cd0d /include/sway/old
parent0c8491f7d0c735299a25f0ab929f5d1e0866b929 (diff)
Move everything to sway/old/
Diffstat (limited to 'include/sway/old')
-rw-r--r--include/sway/old/border.h28
-rw-r--r--include/sway/old/commands.h214
-rw-r--r--include/sway/old/config.h406
-rw-r--r--include/sway/old/container.h362
-rw-r--r--include/sway/old/criteria.h42
-rw-r--r--include/sway/old/focus.h45
-rw-r--r--include/sway/old/input.h24
-rw-r--r--include/sway/old/input_state.h102
-rw-r--r--include/sway/old/ipc-json.h15
-rw-r--r--include/sway/old/ipc-server.h33
-rw-r--r--include/sway/old/layout.h85
-rw-r--r--include/sway/old/output.h36
-rw-r--r--include/sway/old/workspace.h22
13 files changed, 1414 insertions, 0 deletions
diff --git a/include/sway/old/border.h b/include/sway/old/border.h
new file mode 100644
index 00000000..c30c9da3
--- /dev/null
+++ b/include/sway/old/border.h
@@ -0,0 +1,28 @@
+#ifndef _SWAY_BORDER_H
+#define _SWAY_BORDER_H
+#include <wlc/wlc.h>
+#include "container.h"
+
+/**
+ * Border pixel buffer and corresponding geometry.
+ */
+struct border {
+ unsigned char *buffer;
+ struct wlc_geometry geometry;
+};
+
+/**
+ * Clear border buffer.
+ */
+void border_clear(struct border *border);
+
+/**
+ * Recursively update all of the borders within a container.
+ */
+void update_container_border(swayc_t *container);
+
+void render_view_borders(wlc_handle view);
+int get_font_text_height(const char *font);
+bool should_hide_top_border(swayc_t *con, double y);
+
+#endif
diff --git a/include/sway/old/commands.h b/include/sway/old/commands.h
new file mode 100644
index 00000000..660da2c2
--- /dev/null
+++ b/include/sway/old/commands.h
@@ -0,0 +1,214 @@
+#ifndef _SWAY_COMMANDS_H
+#define _SWAY_COMMANDS_H
+#include <stdbool.h>
+#include <json-c/json.h>
+#include <wlc/wlc.h>
+#include "config.h"
+
+// Container that a called command should act upon. Only valid in command functions.
+extern swayc_t *current_container;
+
+/**
+ * Indicates the result of a command's execution.
+ */
+enum cmd_status {
+ CMD_SUCCESS, /**< The command was successful */
+ CMD_FAILURE, /**< The command resulted in an error */
+ CMD_INVALID, /**< Unknown command or parser error */
+ CMD_DEFER, /**< Command execution deferred */
+ // Config Blocks
+ CMD_BLOCK_END,
+ CMD_BLOCK_MODE,
+ CMD_BLOCK_BAR,
+ CMD_BLOCK_BAR_COLORS,
+ CMD_BLOCK_INPUT,
+ CMD_BLOCK_COMMANDS,
+ CMD_BLOCK_IPC,
+ CMD_BLOCK_IPC_EVENTS,
+};
+
+/**
+ * Stores the result of executing a command.
+ */
+struct cmd_results {
+ enum cmd_status status;
+ char *input;
+ /**
+ * Human friendly error message, or NULL on success
+ */
+ char *error;
+};
+
+enum expected_args {
+ EXPECTED_MORE_THAN,
+ EXPECTED_AT_LEAST,
+ EXPECTED_LESS_THAN,
+ EXPECTED_EQUAL_TO
+};
+
+struct cmd_results *checkarg(int argc, const char *name, enum expected_args type, int val);
+struct cmd_results *add_color(const char*, char*, const char*);
+void input_cmd_apply(struct input_config *input);
+void hide_view_in_scratchpad(swayc_t *sp_view);
+
+swayc_t *sp_view;
+int sp_index;
+
+/**
+ * Parse and handles a command.
+ */
+struct cmd_results *handle_command(char *command, enum command_context context);
+/**
+ * Parse and handles a command during config file loading.
+ *
+ * Do not use this under normal conditions.
+ */
+struct cmd_results *config_command(char *command, enum cmd_status block);
+/*
+ * Parses a command policy rule.
+ */
+struct cmd_results *config_commands_command(char *exec);
+
+/**
+ * Allocates a cmd_results object.
+ */
+struct cmd_results *cmd_results_new(enum cmd_status status, const char* input, const char *error, ...);
+/**
+ * Frees a cmd_results object.
+ */
+void free_cmd_results(struct cmd_results *results);
+/**
+ * Serializes cmd_results to a JSON string.
+ *
+ * Free the JSON string later on.
+ */
+const char *cmd_results_to_json(struct cmd_results *results);
+
+void remove_view_from_scratchpad(swayc_t *);
+
+/**
+ * Actual command function signatures for individual .c files in commands/ directory.
+ */
+
+typedef struct cmd_results *sway_cmd(int argc, char **argv);
+
+sway_cmd cmd_assign;
+sway_cmd cmd_bar;
+sway_cmd cmd_bindcode;
+sway_cmd cmd_bindsym;
+sway_cmd cmd_border;
+sway_cmd cmd_client_focused;
+sway_cmd cmd_client_focused_inactive;
+sway_cmd cmd_client_unfocused;
+sway_cmd cmd_client_urgent;
+sway_cmd cmd_client_placeholder;
+sway_cmd cmd_client_background;
+sway_cmd cmd_clipboard;
+sway_cmd cmd_commands;
+sway_cmd cmd_debuglog;
+sway_cmd cmd_default_border;
+sway_cmd cmd_default_floating_border;
+sway_cmd cmd_exec;
+sway_cmd cmd_exec_always;
+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_scroll;
+sway_cmd cmd_focus;
+sway_cmd cmd_focus_follows_mouse;
+sway_cmd cmd_font;
+sway_cmd cmd_for_window;
+sway_cmd cmd_force_focus_wrapping;
+sway_cmd cmd_fullscreen;
+sway_cmd cmd_gaps;
+sway_cmd cmd_hide_edge_borders;
+sway_cmd cmd_include;
+sway_cmd cmd_input;
+sway_cmd cmd_ipc;
+sway_cmd cmd_kill;
+sway_cmd cmd_layout;
+sway_cmd cmd_log_colors;
+sway_cmd cmd_mark;
+sway_cmd cmd_mode;
+sway_cmd cmd_mouse_warping;
+sway_cmd cmd_move;
+sway_cmd cmd_new_float;
+sway_cmd cmd_new_window;
+sway_cmd cmd_no_focus;
+sway_cmd cmd_orientation;
+sway_cmd cmd_output;
+sway_cmd cmd_permit;
+sway_cmd cmd_reject;
+sway_cmd cmd_reload;
+sway_cmd cmd_resize;
+sway_cmd cmd_scratchpad;
+sway_cmd cmd_seamless_mouse;
+sway_cmd cmd_set;
+sway_cmd cmd_show_marks;
+sway_cmd cmd_smart_gaps;
+sway_cmd cmd_split;
+sway_cmd cmd_splith;
+sway_cmd cmd_splitt;
+sway_cmd cmd_splitv;
+sway_cmd cmd_sticky;
+sway_cmd cmd_unmark;
+sway_cmd cmd_workspace;
+sway_cmd cmd_ws_auto_back_and_forth;
+sway_cmd cmd_workspace_layout;
+
+sway_cmd bar_cmd_activate_button;
+sway_cmd bar_cmd_binding_mode_indicator;
+sway_cmd bar_cmd_bindsym;
+sway_cmd bar_cmd_colors;
+sway_cmd bar_cmd_context_button;
+sway_cmd bar_cmd_font;
+sway_cmd bar_cmd_mode;
+sway_cmd bar_cmd_modifier;
+sway_cmd bar_cmd_output;
+sway_cmd bar_cmd_height;
+sway_cmd bar_cmd_hidden_state;
+sway_cmd bar_cmd_icon_theme;
+sway_cmd bar_cmd_id;
+sway_cmd bar_cmd_position;
+sway_cmd bar_cmd_secondary_button;
+sway_cmd bar_cmd_separator_symbol;
+sway_cmd bar_cmd_status_command;
+sway_cmd bar_cmd_pango_markup;
+sway_cmd bar_cmd_strip_workspace_numbers;
+sway_cmd bar_cmd_swaybar_command;
+sway_cmd bar_cmd_tray_output;
+sway_cmd bar_cmd_tray_padding;
+sway_cmd bar_cmd_wrap_scroll;
+sway_cmd bar_cmd_workspace_buttons;
+
+sway_cmd bar_colors_cmd_active_workspace;
+sway_cmd bar_colors_cmd_background;
+sway_cmd bar_colors_cmd_focused_background;
+sway_cmd bar_colors_cmd_binding_mode;
+sway_cmd bar_colors_cmd_focused_workspace;
+sway_cmd bar_colors_cmd_inactive_workspace;
+sway_cmd bar_colors_cmd_separator;
+sway_cmd bar_colors_cmd_focused_separator;
+sway_cmd bar_colors_cmd_statusline;
+sway_cmd bar_colors_cmd_focused_statusline;
+sway_cmd bar_colors_cmd_urgent_workspace;
+
+sway_cmd input_cmd_accel_profile;
+sway_cmd input_cmd_click_method;
+sway_cmd input_cmd_drag_lock;
+sway_cmd input_cmd_dwt;
+sway_cmd input_cmd_events;
+sway_cmd input_cmd_left_handed;
+sway_cmd input_cmd_middle_emulation;
+sway_cmd input_cmd_natural_scroll;
+sway_cmd input_cmd_pointer_accel;
+sway_cmd input_cmd_scroll_method;
+sway_cmd input_cmd_tap;
+
+sway_cmd cmd_ipc_cmd;
+sway_cmd cmd_ipc_events;
+sway_cmd cmd_ipc_event_cmd;
+
+#endif
diff --git a/include/sway/old/config.h b/include/sway/old/config.h
new file mode 100644
index 00000000..a05d5ede
--- /dev/null
+++ b/include/sway/old/config.h
@@ -0,0 +1,406 @@
+#ifndef _SWAY_CONFIG_H
+#define _SWAY_CONFIG_H
+
+#define PID_WORKSPACE_TIMEOUT 60
+
+#include <libinput.h>
+#include <stdint.h>
+#include <wlc/geometry.h>
+#include <wlc/wlc.h>
+#include <xkbcommon/xkbcommon.h>
+#include <time.h>
+#include "wayland-desktop-shell-server-protocol.h"
+#include "list.h"
+#include "layout.h"
+#include "container.h"
+
+/**
+ * Describes a variable created via the `set` command.
+ */
+struct sway_variable {
+ char *name;
+ char *value;
+};
+
+/**
+ * A key binding and an associated command.
+ */
+struct sway_binding {
+ int order;
+ bool release;
+ bool bindcode;
+ list_t *keys;
+ uint32_t modifiers;
+ char *command;
+};
+
+/**
+ * A mouse binding and an associated command.
+ */
+struct sway_mouse_binding {
+ uint32_t button;
+ char *command;
+};
+
+/**
+ * A "mode" of keybindings created via the `mode` command.
+ */
+struct sway_mode {
+ char *name;
+ list_t *bindings;
+};
+
+/**
+ * libinput options for input devices
+ */
+struct input_config {
+ char *identifier;
+
+ int accel_profile;
+ int click_method;
+ int drag_lock;
+ int dwt;
+ int left_handed;
+ int middle_emulation;
+ int natural_scroll;
+ float pointer_accel;
+ int scroll_method;
+ int send_events;
+ int tap;
+
+ bool capturable;
+ struct wlc_geometry region;
+};
+
+/**
+ * Size and position configuration for a particular output.
+ *
+ * This is set via the `output` command.
+ */
+struct output_config {
+ char *name;
+ int enabled;
+ int width, height;
+ int x, y;
+ int scale;
+ char *background;
+ char *background_option;
+};
+
+/**
+ * Maps a workspace name to an output name.
+ *
+ * Set via `workspace <x> output <y>`
+ */
+struct workspace_output {
+ char *output;
+ char *workspace;
+};
+
+struct pid_workspace {
+ pid_t *pid;
+ char *workspace;
+ time_t *time_added;
+};
+
+struct bar_config {
+ /**
+ * One of "dock", "hide", "invisible"
+ *
+ * Always visible in dock mode. Visible only when modifier key is held in hide mode.
+ * Never visible in invisible mode.
+ */
+ char *mode;
+ /**
+ * One of "show" or "hide".
+ *
+ * In "show" mode, it will always be shown on top of the active workspace.
+ */
+ char *hidden_state;
+ /**
+ * Id name used to identify the bar through IPC.
+ *
+ * Defaults to bar-x, where x corresponds to the position of the
+ * embedding bar block in the config file (bar-0, bar-1, ...).
+ */
+ char *id;
+ uint32_t modifier;
+ list_t *outputs;
+ enum desktop_shell_panel_position position;
+ list_t *bindings;
+ char *status_command;
+ bool pango_markup;
+ char *swaybar_command;
+ char *font;
+ int height; // -1 not defined
+
+#ifdef ENABLE_TRAY
+ // Tray
+ char *tray_output;
+ char *icon_theme;
+ uint32_t tray_padding;
+ uint32_t activate_button;
+ uint32_t context_button;
+ uint32_t secondary_button;
+#endif
+
+ bool workspace_buttons;
+ bool wrap_scroll;
+ char *separator_symbol;
+ bool strip_workspace_numbers;
+ bool binding_mode_indicator;
+ bool verbose;
+ pid_t pid;
+ struct {
+ char *background;
+ char *statusline;
+ char *separator;
+ char *focused_background;
+ char *focused_statusline;
+ char *focused_separator;
+ char *focused_workspace_border;
+ char *focused_workspace_bg;
+ char *focused_workspace_text;
+ char *active_workspace_border;
+ char *active_workspace_bg;
+ char *active_workspace_text;
+ char *inactive_workspace_border;
+ char *inactive_workspace_bg;
+ char *inactive_workspace_text;
+ char *urgent_workspace_border;
+ char *urgent_workspace_bg;
+ char *urgent_workspace_text;
+ char *binding_mode_border;
+ char *binding_mode_bg;
+ char *binding_mode_text;
+ } colors;
+};
+
+struct border_colors {
+ uint32_t border;
+ uint32_t background;
+ uint32_t text;
+ uint32_t indicator;
+ uint32_t child_border;
+};
+
+enum edge_border_types {
+ E_NONE, /**< Don't hide edge borders */
+ E_VERTICAL, /**< hide vertical edge borders */
+ E_HORIZONTAL, /**< hide horizontal edge borders */
+ E_BOTH, /**< hide vertical and horizontal edge borders */
+ E_SMART /**< hide both if precisely one window is present in workspace */
+};
+
+enum command_context {
+ CONTEXT_CONFIG = 1,
+ CONTEXT_BINDING = 2,
+ CONTEXT_IPC = 4,
+ CONTEXT_CRITERIA = 8,
+ CONTEXT_ALL = 0xFFFFFFFF,
+};
+
+struct command_policy {
+ char *command;
+ uint32_t context;
+};
+
+enum secure_feature {
+ FEATURE_LOCK = 1,
+ FEATURE_PANEL = 2,
+ FEATURE_BACKGROUND = 4,
+ FEATURE_SCREENSHOT = 8,
+ FEATURE_FULLSCREEN = 16,
+ FEATURE_KEYBOARD = 32,
+ FEATURE_MOUSE = 64,
+};
+
+struct feature_policy {
+ char *program;
+ uint32_t features;
+};
+
+enum ipc_feature {
+ IPC_FEATURE_COMMAND = 1,
+ IPC_FEATURE_GET_WORKSPACES = 2,
+ IPC_FEATURE_GET_OUTPUTS = 4,
+ IPC_FEATURE_GET_TREE = 8,
+ IPC_FEATURE_GET_MARKS = 16,
+ IPC_FEATURE_GET_BAR_CONFIG = 32,
+ IPC_FEATURE_GET_VERSION = 64,
+ IPC_FEATURE_GET_INPUTS = 128,
+ IPC_FEATURE_EVENT_WORKSPACE = 256,
+ IPC_FEATURE_EVENT_OUTPUT = 512,
+ IPC_FEATURE_EVENT_MODE = 1024,
+ IPC_FEATURE_EVENT_WINDOW = 2048,
+ IPC_FEATURE_EVENT_BINDING = 4096,
+ IPC_FEATURE_EVENT_INPUT = 8192,
+ IPC_FEATURE_GET_CLIPBOARD = 16384,
+
+ IPC_FEATURE_ALL_COMMANDS = 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 | 16384,
+ IPC_FEATURE_ALL_EVENTS = 256 | 512 | 1024 | 2048 | 4096 | 8192,
+
+ IPC_FEATURE_ALL = IPC_FEATURE_ALL_COMMANDS | IPC_FEATURE_ALL_EVENTS,
+};
+
+struct ipc_policy {
+ char *program;
+ uint32_t features;
+};
+
+/**
+ * The configuration struct. The result of loading a config file.
+ */
+struct sway_config {
+ list_t *symbols;
+ list_t *modes;
+ 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 *criteria;
+ list_t *no_focus;
+ list_t *active_bar_modifiers;
+ struct sway_mode *current_mode;
+ struct bar_config *current_bar;
+ uint32_t floating_mod;
+ uint32_t dragging_key;
+ uint32_t resizing_key;
+ char *floating_scroll_up_cmd;
+ char *floating_scroll_down_cmd;
+ char *floating_scroll_left_cmd;
+ char *floating_scroll_right_cmd;
+ enum swayc_layouts default_orientation;
+ enum swayc_layouts default_layout;
+ char *font;
+ int font_height;
+
+ // Flags
+ bool focus_follows_mouse;
+ bool mouse_warping;
+ bool force_focus_wrapping;
+ bool active;
+ bool failed;
+ bool reloading;
+ bool reading;
+ bool auto_back_and_forth;
+ bool seamless_mouse;
+ bool show_marks;
+
+ bool edge_gaps;
+ bool smart_gaps;
+ int gaps_inner;
+ int gaps_outer;
+
+ list_t *config_chain;
+ const char *current_config;
+
+ enum swayc_border_types border;
+ enum swayc_border_types floating_border;
+ int border_thickness;
+ int floating_border_thickness;
+ enum edge_border_types hide_edge_borders;
+
+ // border colors
+ struct {
+ struct border_colors focused;
+ struct border_colors focused_inactive;
+ struct border_colors unfocused;
+ struct border_colors urgent;
+ struct border_colors placeholder;
+ uint32_t background;
+ } border_colors;
+
+ // floating view
+ int32_t floating_maximum_width;
+ int32_t floating_maximum_height;
+ int32_t floating_minimum_width;
+ int32_t floating_minimum_height;
+
+ // Security
+ list_t *command_policies;
+ list_t *feature_policies;
+ list_t *ipc_policies;
+};
+
+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.
+ */
+bool load_main_config(const char *path, bool is_active);
+
+/**
+ * Loads an included config. Can only be used after load_main_config.
+ */
+bool load_include_configs(const char *path, struct sway_config *config);
+
+/**
+ * Reads the config from the given FILE.
+ */
+bool read_config(FILE *file, struct sway_config *config);
+
+/**
+ * Free config struct
+ */
+void free_config(struct sway_config *config);
+/**
+ * Does variable replacement for a string based on the config's currently loaded variables.
+ */
+char *do_var_replacement(char *str);
+
+struct cmd_results *check_security_config();
+
+int input_identifier_cmp(const void *item, const void *data);
+void merge_input_config(struct input_config *dst, struct input_config *src);
+void apply_input_config(struct input_config *ic, struct libinput_device *dev);
+void free_input_config(struct input_config *ic);
+
+int output_name_cmp(const void *item, const void *data);
+void merge_output_config(struct output_config *dst, struct output_config *src);
+/** Sets up a WLC output handle based on a given output_config.
+ */
+void apply_output_config(struct output_config *oc, swayc_t *output);
+void free_output_config(struct output_config *oc);
+
+/**
+ * Updates the list of active bar modifiers
+ */
+void update_active_bar_modifiers(void);
+
+int workspace_output_cmp_workspace(const void *a, const void *b);
+
+int sway_binding_cmp(const void *a, const void *b);
+int sway_binding_cmp_qsort(const void *a, const void *b);
+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);
+
+int sway_mouse_binding_cmp(const void *a, const void *b);
+int sway_mouse_binding_cmp_qsort(const void *a, const void *b);
+int sway_mouse_binding_cmp_buttons(const void *a, const void *b);
+void free_sway_mouse_binding(struct sway_mouse_binding *smb);
+
+void load_swaybars();
+void terminate_swaybg(pid_t pid);
+
+/**
+ * Allocate and initialize default bar configuration.
+ */
+struct bar_config *default_bar_config(void);
+
+/**
+ * Global config singleton.
+ */
+extern struct sway_config *config;
+
+/**
+ * Config file currently being read.
+ */
+extern const char *current_config_path;
+
+#endif
diff --git a/include/sway/old/container.h b/include/sway/old/container.h
new file mode 100644
index 00000000..d46ffa63
--- /dev/null
+++ b/include/sway/old/container.h
@@ -0,0 +1,362 @@
+#ifndef _SWAY_CONTAINER_H
+#define _SWAY_CONTAINER_H
+#include <sys/types.h>
+#include <wlc/wlc.h>
+#include <wlr/types/wlr_output.h>
+#include <stdint.h>
+#include "list.h"
+
+typedef struct sway_container swayc_t;
+
+extern swayc_t root_container;
+extern swayc_t *current_focus;
+
+struct sway_view;
+
+/**
+ * Different kinds of containers.
+ *
+ * This enum is in order. A container will never be inside of a container below
+ * it on this list.
+ */
+enum swayc_types {
+ C_ROOT, /**< The root container. Only one of these ever exists. */
+ C_OUTPUT, /**< An output (aka monitor, head, etc). */
+ C_WORKSPACE, /**< A workspace. */
+ C_CONTAINER, /**< A manually created container. */
+ C_VIEW, /**< A view (aka window). */
+ // Keep last
+ C_TYPES,
+};
+
+/**
+ * Different ways to arrange a container.
+ */
+enum swayc_layouts {
+ L_NONE, /**< Used for containers that have no layout (views, root) */
+ L_HORIZ,
+ L_VERT,
+ L_STACKED,
+ L_TABBED,
+ L_FLOATING, /**< A psuedo-container, removed from the tree, to hold floating windows */
+
+ /* Awesome/Monad style auto layouts */
+ L_AUTO_LEFT,
+ L_AUTO_RIGHT,
+ L_AUTO_TOP,
+ L_AUTO_BOTTOM,
+
+ L_AUTO_FIRST = L_AUTO_LEFT,
+ L_AUTO_LAST = L_AUTO_BOTTOM,
+
+ // Keep last
+ L_LAYOUTS,
+};
+
+enum swayc_border_types {
+ B_NONE, /**< No border */
+ B_PIXEL, /**< 1px border */
+ B_NORMAL /**< Normal border with title bar */
+};
+
+/**
+ * Stores information about a container.
+ *
+ * The tree is made of these. Views are containers that cannot have children.
+ */
+struct sway_container {
+ // TODO WLR: reconcile these
+ wlc_handle handle;
+
+ union {
+ struct sway_output *output;
+ struct sway_view *view;
+ } _handle;
+
+ /**
+ * A unique ID to identify this container. Primarily used in the
+ * get_tree JSON output.
+ */
+ size_t id;
+
+ enum swayc_types type;
+ enum swayc_layouts layout;
+ enum swayc_layouts prev_layout;
+ enum swayc_layouts workspace_layout;
+
+ /**
+ * Width and height of this container, without borders or gaps.
+ */
+ double width, height;
+
+ /**
+ * Views may request geometry, which is stored in this and ignored until
+ * the views are floated.
+ */
+ int desired_width, desired_height;
+
+ /**
+ * The coordinates that this view appear at, relative to the output they
+ * are located on (output containers have absolute coordinates).
+ */
+ double x, y;
+
+ /**
+ * Cached geometry used to store view/container geometry when switching
+ * between tabbed/stacked and horizontal/vertical layouts.
+ */
+ struct wlc_geometry cached_geometry;
+
+ /**
+ * False if this view is invisible. It could be in the scratchpad or on a
+ * workspace that is not shown.
+ */
+ bool visible;
+ bool is_floating;
+ bool is_focused;
+ bool sticky; // floating view always visible on its output
+
+ // Attributes that mostly views have.
+ char *name;
+ char *class;
+ char *instance;
+ char *app_id;
+
+ // Used by output containers to keep track of swaybg child processes.
+ pid_t bg_pid;
+
+ int gaps;
+
+ list_t *children;
+ /**
+ * Children of this container that are floated.
+ */
+ list_t *floating;
+ /**
+ * Unmanaged view handles in this container.
+ */
+ list_t *unmanaged;
+
+ /**
+ * The parent of this container. NULL for the root container.
+ */
+ struct sway_container *parent;
+ /**
+ * Which of this container's children has focus.
+ */
+ struct sway_container *focused;
+ /**
+ * If this container's children include a fullscreen view, this is that view.
+ */
+ struct sway_container *fullscreen;
+ /**
+ * If this container is a view, this may be set to the window's decoration
+ * buffer (or NULL).
+ */
+ struct border *border;
+ enum swayc_border_types border_type;
+ struct wlc_geometry border_geometry;
+ struct wlc_geometry title_bar_geometry;
+ struct wlc_geometry actual_geometry;
+ int border_thickness;
+
+ /**
+ * Number of master views in auto layouts.
+ */
+ size_t nb_master;
+
+ /**
+ * Number of slave groups (e.g. columns) in auto layouts.
+ */
+ size_t nb_slave_groups;
+
+ /**
+ * Marks applied to the container, list_t of char*.
+ */
+ list_t *marks;
+};
+
+enum visibility_mask {
+ VISIBLE = true
+} visible;
+
+struct sway_output;
+/**
+ * Allocates a new output container.
+ */
+swayc_t *new_output(struct sway_output *sway_output);
+/**
+ * Allocates a new workspace container.
+ */
+swayc_t *new_workspace(swayc_t *output, const char *name);
+/**
+ * Allocates a new container and places a child into it.
+ *
+ * This is used from the split command, which creates a new container with the
+ * requested layout and replaces the focused container in the tree with the new
+ * one. Then the removed container is added as a child of the new container.
+ */
+swayc_t *new_container(swayc_t *child, enum swayc_layouts layout);
+/**
+ * Allocates a new view container.
+ *
+ * Pass in a sibling view, or a workspace to become this container's parent.
+ */
+swayc_t *new_view(swayc_t *sibling, struct sway_view *view);
+/**
+ * Allocates a new floating view in the active workspace.
+ */
+swayc_t *new_floating_view(wlc_handle handle);
+
+void floating_view_sane_size(swayc_t *view);
+
+/**
+ * Frees an output's container.
+ */
+swayc_t *destroy_output(swayc_t *output);
+/**
+ * Destroys a workspace container and returns the parent pointer, or NULL.
+ */
+swayc_t *destroy_workspace(swayc_t *workspace);
+/**
+ * Destroys a container and all empty parents. Returns the topmost non-empty
+ * parent container, or NULL.
+ */
+swayc_t *destroy_container(swayc_t *container);
+/**
+ * Destroys a view container and all empty parents. Returns the topmost
+ * non-empty parent container, or NULL.
+ */
+swayc_t *destroy_view(swayc_t *view);
+
+/**
+ * Finds a container based on test criteria. Returns the first container that
+ * passes the test.
+ */
+swayc_t *swayc_by_test(swayc_t *container, bool (*test)(swayc_t *view, void *data), void *data);
+/**
+ * Finds a parent container with the given swayc_type.
+ */
+swayc_t *swayc_parent_by_type(swayc_t *container, enum swayc_types);
+/**
+ * Finds a parent with the given swayc_layout.
+ */
+swayc_t *swayc_parent_by_layout(swayc_t *container, enum swayc_layouts);
+/**
+ * Finds the bottom-most focused container of a type.
+ */
+swayc_t *swayc_focus_by_type(swayc_t *container, enum swayc_types);
+/**
+ * Finds the bottom-most focused container of a layout.
+ */
+swayc_t *swayc_focus_by_layout(swayc_t *container, enum swayc_layouts);
+
+/**
+ * Gets the swayc_t associated with a wlc_handle.
+ */
+swayc_t *swayc_by_handle(wlc_handle handle);
+/**
+ * Gets the named swayc_t.
+ */
+swayc_t *swayc_by_name(const char *name);
+/**
+ * Gets the active output's container.
+ */
+swayc_t *swayc_active_output(void);
+/**
+ * Gets the active workspace's container.
+ */
+swayc_t *swayc_active_workspace(void);
+/**
+ * Gets the workspace for the given view container.
+ */
+swayc_t *swayc_active_workspace_for(swayc_t *view);
+/**
+ * Finds the container currently underneath the pointer.
+ */
+swayc_t *container_under_pointer(void);
+/**
+ * Finds the first container following a callback.
+ */
+swayc_t *container_find(swayc_t *container, bool (*f)(swayc_t *, const void *), const void *data);
+
+/**
+ * Returns true if a container is fullscreen.
+ */
+bool swayc_is_fullscreen(swayc_t *view);
+/**
+ * Returns true if this view is focused.
+ */
+bool swayc_is_active(swayc_t *view);
+/**
+ * Returns true if the parent is an ancestor of the child.
+ */
+bool swayc_is_parent_of(swayc_t *parent, swayc_t *child);
+/**
+ * Returns true if the child is a desecendant of the parent.
+ */
+bool swayc_is_child_of(swayc_t *child, swayc_t *parent);
+
+/**
+ * Returns true if this container is an empty workspace.
+ */
+bool swayc_is_empty_workspace(swayc_t *container);
+
+/**
+ * Returns the top most tabbed or stacked parent container. Returns NULL if
+ * view is not in a tabbed/stacked layout.
+ */
+swayc_t *swayc_tabbed_stacked_ancestor(swayc_t *view);
+
+/**
+ * Returns the immediate tabbed or stacked parent container. Returns NULL if
+ * view is not directly in a tabbed/stacked layout.
+ */
+swayc_t *swayc_tabbed_stacked_parent(swayc_t *view);
+
+/**
+ * Returns the gap (padding) of the container.
+ *
+ * This returns the inner gaps for a view, the outer gaps for a workspace, and
+ * 0 otherwise.
+ */
+int swayc_gap(swayc_t *container);
+
+/**
+ * Maps a container's children over a function.
+ */
+void container_map(swayc_t *, void (*f)(swayc_t *, void *), void *);
+
+/**
+ * Set a view as visible or invisible.
+ *
+ * This will perform the required wlc calls as well; it is not sufficient to
+ * simply toggle the boolean in swayc_t.
+ */
+void set_view_visibility(swayc_t *view, void *data);
+/**
+ * Set the gaps value for a view.
+ */
+void set_gaps(swayc_t *view, void *amount);
+/**
+ * Add to the gaps value for a view.
+ */
+void add_gaps(swayc_t *view, void *amount);
+
+/**
+ * Issue wlc calls to make the visibility of a container consistent.
+ */
+void update_visibility(swayc_t *container);
+
+/**
+ * Close all child views of container
+ */
+void close_views(swayc_t *container);
+
+/**
+ * Assign layout to a container. Needed due to workspace container specifics.
+ * Workspace should always have either L_VERT or L_HORIZ layout.
+ */
+swayc_t *swayc_change_layout(swayc_t *container, enum swayc_layouts layout);
+
+#endif
diff --git a/include/sway/old/criteria.h b/include/sway/old/criteria.h
new file mode 100644
index 00000000..c5ed9857
--- /dev/null
+++ b/include/sway/old/criteria.h
@@ -0,0 +1,42 @@
+#ifndef _SWAY_CRITERIA_H
+#define _SWAY_CRITERIA_H
+
+#include "container.h"
+#include "list.h"
+
+/**
+ * Maps criteria (as a list of criteria tokens) to a command list.
+ *
+ * A list of tokens together represent a single criteria string (e.g.
+ * '[class="abc" title="xyz"]' becomes two criteria tokens).
+ *
+ * for_window: Views matching all criteria will have the bound command list
+ * executed on them.
+ *
+ * Set via `for_window <criteria> <cmd list>`.
+ */
+struct criteria {
+ list_t *tokens; // struct crit_token, contains compiled regex.
+ char *crit_raw; // entire criteria string (for logging)
+
+ char *cmdlist;
+};
+
+int criteria_cmp(const void *item, const void *data);
+void free_criteria(struct criteria *crit);
+
+// Pouplate list with crit_tokens extracted from criteria string, returns error
+// string or NULL if successful.
+char *extract_crit_tokens(list_t *tokens, const char *criteria);
+
+// Returns list of criteria that match given container. These criteria have
+// been set with `for_window` commands and have an associated cmdlist.
+list_t *criteria_for(swayc_t *cont);
+
+// Returns a list of all containers that match the given list of tokens.
+list_t *container_for(list_t *tokens);
+
+// Returns true if any criteria in the given list matches this container
+bool criteria_any(swayc_t *cont, list_t *criteria);
+
+#endif
diff --git a/include/sway/old/focus.h b/include/sway/old/focus.h
new file mode 100644
index 00000000..652cdccc
--- /dev/null
+++ b/include/sway/old/focus.h
@@ -0,0 +1,45 @@
+#ifndef _SWAY_FOCUS_H
+#define _SWAY_FOCUS_H
+enum movement_direction {
+ MOVE_LEFT,
+ MOVE_RIGHT,
+ MOVE_UP,
+ MOVE_DOWN,
+ MOVE_PARENT,
+ MOVE_CHILD,
+ MOVE_NEXT,
+ MOVE_PREV,
+ MOVE_FIRST
+};
+
+#include "container.h"
+
+// focused_container - the container found by following the `focused` pointer
+// from a given container to a container with `is_focused` boolean set
+// ---
+// focused_view - the container found by following the `focused` pointer from a
+// given container to a view.
+// ---
+
+swayc_t *get_focused_container(swayc_t *parent);
+swayc_t *get_focused_view(swayc_t *parent);
+swayc_t *get_focused_float(swayc_t *ws);
+
+// a special-case function to get the focused view, regardless
+// of whether it's tiled or floating
+swayc_t *get_focused_view_include_floating(swayc_t *parent);
+
+bool set_focused_container(swayc_t *container);
+bool set_focused_container_for(swayc_t *ancestor, swayc_t *container);
+
+// lock focused container/view. locked by windows with OVERRIDE attribute
+// and unlocked when they are destroyed
+
+extern bool locked_container_focus;
+
+// Prevents wss from being destroyed on focus switch
+extern bool suspend_workspace_cleanup;
+
+bool move_focus(enum movement_direction direction);
+
+#endif
diff --git a/include/sway/old/input.h b/include/sway/old/input.h
new file mode 100644
index 00000000..eb92e470
--- /dev/null
+++ b/include/sway/old/input.h
@@ -0,0 +1,24 @@
+#ifndef _SWAY_INPUT_H
+#define _SWAY_INPUT_H
+#include <libinput.h>
+#include "sway/server.h"
+#include "config.h"
+#include "list.h"
+
+struct sway_input {
+ list_t *input_devices;
+};
+
+struct input_config *new_input_config(const char* identifier);
+
+char* libinput_dev_unique_id(struct libinput_device *dev);
+
+struct sway_input *sway_input_create(struct sway_server *server);
+
+/**
+ * Pointer used when reading input blocked.
+ * Shared so that it can be cleared from commands.c when closing the block
+ */
+extern struct input_config *current_input_config;
+
+#endif
diff --git a/include/sway/old/input_state.h b/include/sway/old/input_state.h
new file mode 100644
index 00000000..fd5a3a25
--- /dev/null
+++ b/include/sway/old/input_state.h
@@ -0,0 +1,102 @@
+#ifndef _SWAY_KEY_STATE_H
+#define _SWAY_KEY_STATE_H
+#include <stdbool.h>
+#include <stdint.h>
+#include "container.h"
+
+/* Keyboard state */
+
+// returns true if key has been pressed, otherwise false
+bool check_key(uint32_t key_sym, uint32_t key_code);
+
+// returns true if key_sym matches latest released key.
+bool check_released_key(uint32_t key_sym);
+
+// sets a key as pressed
+void press_key(uint32_t key_sym, uint32_t key_code);
+
+// unsets a key as pressed
+void release_key(uint32_t key_sym, uint32_t key_code);
+
+
+/* Pointer state */
+
+enum pointer_values {
+ M_LEFT_CLICK = 272,
+ M_RIGHT_CLICK = 273,
+ M_SCROLL_CLICK = 274,
+ M_SCROLL_UP = 275,
+ M_SCROLL_DOWN = 276,
+};
+
+enum pointer_mode {
+ // Target
+ M_FLOATING = 1,
+ M_TILING = 2,
+ // Action
+ M_DRAGGING = 4,
+ M_RESIZING = 8,
+};
+
+struct pointer_button_state {
+ bool held;
+ // state at the point it was pressed
+ int x, y;
+ swayc_t *view;
+};
+
+extern struct pointer_state {
+ // mouse clicks
+ struct pointer_button_state left;
+ struct pointer_button_state right;
+ struct pointer_button_state scroll;
+
+ // change in pointer position
+ struct {
+ int x, y;
+ } delta;
+
+ // view pointer is currently over
+ swayc_t *view;
+
+ // Pointer mode
+ int mode;
+} pointer_state;
+
+enum modifier_state {
+ MOD_STATE_UNCHANGED = 0,
+ MOD_STATE_PRESSED = 1,
+ MOD_STATE_RELEASED = 2
+};
+
+void pointer_position_set(double new_x, double new_y, bool force_focus);
+void center_pointer_on(swayc_t *view);
+
+// on button release unset mode depending on the button.
+// on button press set mode conditionally depending on the button
+void pointer_mode_set(uint32_t button, bool condition);
+
+// Update mode in mouse motion
+void pointer_mode_update(void);
+
+// Reset mode on any keypress;
+void pointer_mode_reset(void);
+
+void input_init(void);
+
+/**
+ * Check if state of mod changed from current state to new_state.
+ *
+ * Returns MOD_STATE_UNCHANGED if the state didn't change, MOD_STATE_PRESSED if
+ * the state changed to pressed and MOD_STATE_RELEASED if the state changed to
+ * released.
+ */
+uint32_t modifier_state_changed(uint32_t new_state, uint32_t mod);
+
+/**
+ * Update the current modifiers state to new_state.
+ */
+void modifiers_state_update(uint32_t new_state);
+
+#endif
+
diff --git a/include/sway/old/ipc-json.h b/include/sway/old/ipc-json.h
new file mode 100644
index 00000000..3a5af0f5
--- /dev/null
+++ b/include/sway/old/ipc-json.h
@@ -0,0 +1,15 @@
+#ifndef _SWAY_IPC_JSON_H
+#define _SWAY_IPC_JSON_H
+
+#include <json-c/json.h>
+#include "config.h"
+#include "container.h"
+
+json_object *ipc_json_get_version();
+json_object *ipc_json_describe_bar_config(struct bar_config *bar);
+json_object *ipc_json_describe_container(swayc_t *c);
+json_object *ipc_json_describe_container_recursive(swayc_t *c);
+json_object *ipc_json_describe_window(swayc_t *c);
+json_object *ipc_json_describe_input(struct libinput_device *device);
+
+#endif
diff --git a/include/sway/old/ipc-server.h b/include/sway/old/ipc-server.h
new file mode 100644
index 00000000..0cc26d99
--- /dev/null
+++ b/include/sway/old/ipc-server.h
@@ -0,0 +1,33 @@
+#ifndef _SWAY_IPC_SERVER_H
+#define _SWAY_IPC_SERVER_H
+#include "container.h"
+#include "config.h"
+#include "ipc.h"
+
+void ipc_init(void);
+void ipc_terminate(void);
+struct sockaddr_un *ipc_user_sockaddr(void);
+
+void ipc_event_workspace(swayc_t *old, swayc_t *new, const char *change);
+void ipc_event_barconfig_update(struct bar_config *bar);
+/**
+ * Send IPC mode event to all listening clients
+ */
+void ipc_event_mode(const char *mode);
+/**
+ * Send IPC window change event
+ */
+void ipc_event_window(swayc_t *window, const char *change);
+/**
+ * Sends an IPC modifier event to all listening clients. The modifier event
+ * includes a key 'change' with the value of state and a key 'modifier' with
+ * the name of that modifier.
+ */
+void ipc_event_modifier(uint32_t modifier, const char *state);
+/**
+ * Send IPC keyboard binding event.
+ */
+void ipc_event_binding_keyboard(struct sway_binding *sb);
+const char *swayc_type_string(enum swayc_types type);
+
+#endif
diff --git a/include/sway/old/layout.h b/include/sway/old/layout.h
new file mode 100644
index 00000000..f0791588
--- /dev/null
+++ b/include/sway/old/layout.h
@@ -0,0 +1,85 @@
+#ifndef _SWAY_LAYOUT_H
+#define _SWAY_LAYOUT_H
+
+#include <wlc/wlc.h>
+#include "log.h"
+#include "list.h"
+#include "container.h"
+#include "focus.h"
+
+extern list_t *scratchpad;
+
+extern int min_sane_w;
+extern int min_sane_h;
+
+// Set initial values for root_container
+void init_layout(void);
+
+// Returns the index of child for its parent
+int index_child(const swayc_t *child);
+
+// Adds child to parent, if parent has no focus, it is set to child
+// parent must be of type C_WORKSPACE or C_CONTAINER
+void add_child(swayc_t *parent, swayc_t *child);
+
+// Adds child to parent at index, if parent has no focus, it is set to child
+// parent must be of type C_WORKSPACE or C_CONTAINER
+void insert_child(swayc_t *parent, swayc_t *child, int index);
+
+// Adds child as floating window to ws, if there is no focus it is set to child.
+// ws must be of type C_WORKSPACE
+void add_floating(swayc_t *ws, swayc_t *child);
+
+// insert child after sibling in parents children.
+swayc_t *add_sibling(swayc_t *sibling, swayc_t *child);
+
+// Replace child with new_child in parents children
+// new_child will inherit childs geometry, childs geometry will be reset
+// if parents focus is on child, it will be changed to new_child
+swayc_t *replace_child(swayc_t *child, swayc_t *new_child);
+
+// Remove child from its parent, if focus is on child, focus will be changed to
+// a sibling, or to a floating window, or NULL
+swayc_t *remove_child(swayc_t *child);
+
+// 2 containers are swapped, they inherit eachothers focus
+void swap_container(swayc_t *a, swayc_t *b);
+
+// 2 Containers geometry are swapped, used with `swap_container`
+void swap_geometry(swayc_t *a, swayc_t *b);
+
+void move_container(swayc_t* container, enum movement_direction direction, int move_amt);
+void move_container_to(swayc_t* container, swayc_t* destination);
+void move_workspace_to(swayc_t* workspace, swayc_t* destination);
+
+// Layout
+/**
+ * Update child container geometries when switching between layouts.
+ */
+void update_layout_geometry(swayc_t *parent, enum swayc_layouts prev_layout);
+void update_geometry(swayc_t *view);
+void arrange_windows(swayc_t *container, double width, double height);
+void arrange_backgrounds(void);
+
+swayc_t *get_focused_container(swayc_t *parent);
+swayc_t *get_swayc_in_direction(swayc_t *container, enum movement_direction dir);
+swayc_t *get_swayc_in_direction_under(swayc_t *container, enum movement_direction dir, swayc_t *limit);
+
+void recursive_resize(swayc_t *container, double amount, enum wlc_resize_edge edge);
+
+void layout_log(const swayc_t *c, int depth);
+void swayc_log(log_importance_t verbosity, swayc_t *cont, const char* format, ...) __attribute__((format(printf,3,4)));
+
+/**
+ * Get default layout.
+ */
+enum swayc_layouts default_layout(swayc_t *output);
+
+bool is_auto_layout(enum swayc_layouts layout);
+int auto_group_start_index(const swayc_t *container, int index);
+int auto_group_end_index(const swayc_t *container, int index);
+size_t auto_group_count(const swayc_t *container);
+size_t auto_group_index(const swayc_t *container, int index);
+bool auto_group_bounds(const swayc_t *container, size_t group_index, int *start, int *end);
+
+#endif
diff --git a/include/sway/old/output.h b/include/sway/old/output.h
new file mode 100644
index 00000000..2a222238
--- /dev/null
+++ b/include/sway/old/output.h
@@ -0,0 +1,36 @@
+#ifndef _SWAY_OUTPUT_H
+#define _SWAY_OUTPUT_H
+#include <time.h>
+#include <wayland-server.h>
+#include <wlr/types/wlr_output.h>
+#include "container.h"
+#include "focus.h"
+
+struct sway_server;
+
+struct sway_output {
+ struct wlr_output *wlr_output;
+ struct wl_listener frame;
+ struct sway_server *server;
+ struct timespec last_frame;
+};
+
+// Position is absolute coordinates on the edge where the adjacent output
+// should be searched for.
+swayc_t *output_by_name(const char* name, const struct wlc_point *abs_pos);
+swayc_t *swayc_opposite_output(enum movement_direction dir, const struct wlc_point *abs_pos);
+swayc_t *swayc_adjacent_output(swayc_t *output, enum movement_direction dir, const struct wlc_point *abs_pos, bool pick_closest);
+
+// Place absolute coordinates for given container into given wlc_point.
+void get_absolute_position(swayc_t *container, struct wlc_point *point);
+
+// Place absolute coordinates for the center point of given container into
+// given wlc_point.
+void get_absolute_center_position(swayc_t *container, struct wlc_point *point);
+
+// stable sort workspaces on this output
+void sort_workspaces(swayc_t *output);
+
+void output_get_scaled_size(wlc_handle handle, struct wlc_size *size);
+
+#endif
diff --git a/include/sway/old/workspace.h b/include/sway/old/workspace.h
new file mode 100644
index 00000000..c268fafa
--- /dev/null
+++ b/include/sway/old/workspace.h
@@ -0,0 +1,22 @@
+#ifndef _SWAY_WORKSPACE_H
+#define _SWAY_WORKSPACE_H
+
+#include <wlc/wlc.h>
+#include <unistd.h>
+#include "list.h"
+#include "layout.h"
+
+extern char *prev_workspace_name;
+
+char *workspace_next_name(const char *output_name);
+swayc_t *workspace_create(const char*);
+swayc_t *workspace_by_name(const char*);
+swayc_t *workspace_by_number(const char*);
+bool workspace_switch(swayc_t*);
+swayc_t *workspace_output_next();
+swayc_t *workspace_next();
+swayc_t *workspace_output_prev();
+swayc_t *workspace_prev();
+swayc_t *workspace_for_pid(pid_t pid);
+
+#endif