commit 874f009866abaf8ca43ed4cd88a69d22a3fbfc5a
parent b1984133a9addcdae70fb4ac58af2f387fcc3707
Author: Tony Crisci <tony@dubstepdish.com>
Date: Thu, 29 Mar 2018 12:15:31 -0400
move tree includes to their own directory
Diffstat:
33 files changed, 380 insertions(+), 401 deletions(-)
diff --git a/include/sway/config.h b/include/sway/config.h
@@ -10,8 +10,8 @@
#include <xkbcommon/xkbcommon.h>
#include <time.h>
#include "list.h"
-#include "layout.h"
-#include "container.h"
+#include "tree/layout.h"
+#include "tree/container.h"
/**
* Describes a variable created via the `set` command.
diff --git a/include/sway/container.h b/include/sway/container.h
@@ -1,169 +0,0 @@
-#ifndef _SWAY_CONTAINER_H
-#define _SWAY_CONTAINER_H
-#include <stdint.h>
-#include <sys/types.h>
-#include <wlr/types/wlr_box.h>
-#include <wlr/types/wlr_surface.h>
-#include "list.h"
-
-typedef struct sway_container swayc_t;
-
-extern swayc_t root_container;
-
-struct sway_view;
-struct sway_seat;
-
-/**
- * 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). */
-
- 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 */
-};
-
-struct sway_root;
-struct sway_output;
-struct sway_view;
-
-/**
- * Stores information about a container.
- *
- * The tree is made of these. Views are containers that cannot have children.
- */
-struct sway_container {
- union {
- // TODO: Encapsulate state for other node types as well like C_CONTAINER
- struct sway_root *sway_root; // C_ROOT
- struct sway_output *sway_output; // C_OUTPUT
- struct sway_view *sway_view; // C_VIEW
- };
-
- /**
- * A unique ID to identify this container. Primarily used in the
- * get_tree JSON output.
- */
- size_t id;
-
- char *name;
-
- enum swayc_types type;
- enum swayc_layouts layout;
- enum swayc_layouts prev_layout;
- enum swayc_layouts workspace_layout;
-
- /**
- * The coordinates that this view appear at, relative to the output they
- * are located on (output containers have absolute coordinates).
- */
- double x, y;
-
- /**
- * Width and height of this container, without borders or gaps.
- */
- double width, height;
-
- list_t *children;
-
- /**
- * The parent of this container. NULL for the root container.
- */
- struct sway_container *parent;
-
- /**
- * 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;
-
- struct {
- struct wl_signal destroy;
- } events;
-};
-
-void swayc_descendants_of_type(swayc_t *root, enum swayc_types type,
- void (*func)(swayc_t *item, void *data), void *data);
-
-swayc_t *new_output(struct sway_output *sway_output);
-swayc_t *new_workspace(swayc_t *output, const char *name);
-swayc_t *new_view(swayc_t *sibling, struct sway_view *sway_view);
-
-swayc_t *destroy_output(swayc_t *output);
-swayc_t *destroy_view(swayc_t *view);
-
-swayc_t *next_view_sibling(struct sway_seat *seat);
-
-/**
- * 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 type);
-/**
- * Maps a container's children over a function.
- */
-void container_map(swayc_t *container,
- void (*f)(swayc_t *view, void *data), void *data);
-
-swayc_t *swayc_at(swayc_t *parent, double lx, double ly,
- struct wlr_surface **surface, double *sx, double *sy);
-
-/**
- * Apply the function for each child of the container breadth first.
- */
-void container_for_each_bfs(swayc_t *con, void (*f)(swayc_t *con, void *data),
- void *data);
-
-swayc_t *swayc_change_layout(swayc_t *container, enum swayc_layouts layout);
-
-#endif
diff --git a/include/sway/criteria.h b/include/sway/criteria.h
@@ -1,7 +1,7 @@
#ifndef _SWAY_CRITERIA_H
#define _SWAY_CRITERIA_H
-#include "container.h"
+#include "tree/container.h"
#include "list.h"
/**
diff --git a/include/sway/ipc-json.h b/include/sway/ipc-json.h
@@ -1,7 +1,7 @@
#ifndef _SWAY_IPC_JSON_H
#define _SWAY_IPC_JSON_H
#include <json-c/json.h>
-#include "sway/container.h"
+#include "sway/tree/container.h"
#include "sway/input/input-manager.h"
json_object *ipc_json_get_version();
diff --git a/include/sway/ipc-server.h b/include/sway/ipc-server.h
@@ -1,13 +1,15 @@
#ifndef _SWAY_IPC_SERVER_H
#define _SWAY_IPC_SERVER_H
#include <sys/socket.h>
-#include "sway/container.h"
+#include "sway/tree/container.h"
#include "ipc.h"
struct sway_server;
void ipc_init(struct sway_server *server);
+
void ipc_terminate(void);
+
struct sockaddr_un *ipc_user_sockaddr(void);
void ipc_event_window(swayc_t *window, const char *change);
diff --git a/include/sway/layout.h b/include/sway/layout.h
@@ -1,43 +0,0 @@
-#ifndef _SWAY_LAYOUT_H
-#define _SWAY_LAYOUT_H
-
-#include <wlr/types/wlr_output_layout.h>
-#include "sway/container.h"
-
-enum movement_direction {
- MOVE_LEFT,
- MOVE_RIGHT,
- MOVE_UP,
- MOVE_DOWN,
- MOVE_PARENT,
- MOVE_CHILD,
- MOVE_NEXT,
- MOVE_PREV,
- MOVE_FIRST
-};
-
-struct sway_container;
-
-struct sway_root {
- struct wlr_output_layout *output_layout;
-
- struct wl_listener output_layout_change;
-
- struct wl_list unmanaged_views; // sway_view::unmanaged_view_link
-
- struct {
- struct wl_signal new_container;
- } events;
-};
-
-void init_layout(void);
-void add_child(struct sway_container *parent, struct sway_container *child);
-swayc_t *add_sibling(swayc_t *parent, swayc_t *child);
-struct sway_container *remove_child(struct sway_container *child);
-enum swayc_layouts default_layout(struct sway_container *output);
-void sort_workspaces(struct sway_container *output);
-void arrange_windows(struct sway_container *container, double width, double height);
-swayc_t *get_swayc_in_direction(swayc_t *container,
- struct sway_seat *seat, enum movement_direction dir);
-
-#endif
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h
@@ -0,0 +1,136 @@
+#ifndef _SWAY_CONTAINER_H
+#define _SWAY_CONTAINER_H
+#include <stdint.h>
+#include <sys/types.h>
+#include <wlr/types/wlr_box.h>
+#include <wlr/types/wlr_surface.h>
+#include "list.h"
+
+typedef struct sway_container swayc_t;
+
+extern swayc_t root_container;
+
+struct sway_view;
+struct sway_seat;
+
+/**
+ * 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,
+ C_OUTPUT,
+ C_WORKSPACE,
+ C_CONTAINER,
+ C_VIEW,
+
+ C_TYPES,
+};
+
+enum swayc_layouts {
+ L_NONE,
+ L_HORIZ,
+ L_VERT,
+ L_STACKED,
+ L_TABBED,
+ L_FLOATING,
+
+ // Keep last
+ L_LAYOUTS,
+};
+
+enum swayc_border_types {
+ B_NONE,
+ B_PIXEL,
+ B_NORMAL,
+};
+
+struct sway_root;
+struct sway_output;
+struct sway_view;
+
+struct sway_container {
+ union {
+ // TODO: Encapsulate state for other node types as well like C_CONTAINER
+ struct sway_root *sway_root;
+ struct sway_output *sway_output;
+ struct sway_view *sway_view;
+ };
+
+ /**
+ * A unique ID to identify this container. Primarily used in the
+ * get_tree JSON output.
+ */
+ size_t id;
+
+ char *name;
+
+ enum swayc_types type;
+ enum swayc_layouts layout;
+ enum swayc_layouts prev_layout;
+ enum swayc_layouts workspace_layout;
+
+ // TODO convert to layout coordinates
+ double x, y;
+
+ // does not include borders or gaps.
+ double width, height;
+
+ list_t *children;
+
+ struct sway_container *parent;
+
+ list_t *marks; // list of char*
+
+ struct {
+ struct wl_signal destroy;
+ } events;
+};
+
+void swayc_descendants_of_type(swayc_t *root, enum swayc_types type,
+ void (*func)(swayc_t *item, void *data), void *data);
+
+// TODO only one container create function and pass the type?
+swayc_t *new_output(struct sway_output *sway_output);
+
+swayc_t *new_workspace(swayc_t *output, const char *name);
+
+swayc_t *new_view(swayc_t *sibling, struct sway_view *sway_view);
+
+swayc_t *destroy_output(swayc_t *output);
+swayc_t *destroy_view(swayc_t *view);
+
+swayc_t *next_view_sibling(struct sway_seat *seat);
+
+/**
+ * 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 type);
+
+/**
+ * Maps a container's children over a function.
+ */
+void container_map(swayc_t *container,
+ void (*f)(swayc_t *view, void *data), void *data);
+
+swayc_t *swayc_at(swayc_t *parent, double lx, double ly,
+ struct wlr_surface **surface, double *sx, double *sy);
+
+/**
+ * Apply the function for each child of the container breadth first.
+ */
+void container_for_each_bfs(swayc_t *con, void (*f)(swayc_t *con, void *data),
+ void *data);
+
+swayc_t *swayc_change_layout(swayc_t *container, enum swayc_layouts layout);
+
+#endif
diff --git a/include/sway/tree/layout.h b/include/sway/tree/layout.h
@@ -0,0 +1,51 @@
+#ifndef _SWAY_LAYOUT_H
+#define _SWAY_LAYOUT_H
+
+#include <wlr/types/wlr_output_layout.h>
+#include "sway/tree/container.h"
+
+enum movement_direction {
+ MOVE_LEFT,
+ MOVE_RIGHT,
+ MOVE_UP,
+ MOVE_DOWN,
+ MOVE_PARENT,
+ MOVE_CHILD,
+ MOVE_NEXT,
+ MOVE_PREV,
+ MOVE_FIRST
+};
+
+struct sway_container;
+
+struct sway_root {
+ struct wlr_output_layout *output_layout;
+
+ struct wl_listener output_layout_change;
+
+ struct wl_list unmanaged_views; // sway_view::unmanaged_view_link
+
+ struct {
+ struct wl_signal new_container;
+ } events;
+};
+
+void init_layout(void);
+
+void add_child(struct sway_container *parent, struct sway_container *child);
+
+swayc_t *add_sibling(swayc_t *parent, swayc_t *child);
+
+struct sway_container *remove_child(struct sway_container *child);
+
+enum swayc_layouts default_layout(struct sway_container *output);
+
+void sort_workspaces(struct sway_container *output);
+
+void arrange_windows(struct sway_container *container,
+ double width, double height);
+
+swayc_t *get_swayc_in_direction(swayc_t *container,
+ struct sway_seat *seat, enum movement_direction dir);
+
+#endif
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h
@@ -0,0 +1,116 @@
+#ifndef _SWAY_VIEW_H
+#define _SWAY_VIEW_H
+#include <wayland-server.h>
+#include <wlr/types/wlr_surface.h>
+#include <wlr/types/wlr_xdg_shell_v6.h>
+#include <wlr/xwayland.h>
+
+struct sway_container;
+struct sway_view;
+
+struct sway_xdg_surface_v6 {
+ struct sway_view *view;
+
+ struct wl_listener commit;
+ struct wl_listener request_move;
+ struct wl_listener request_resize;
+ struct wl_listener request_maximize;
+ struct wl_listener destroy;
+
+ int pending_width, pending_height;
+};
+
+struct sway_xwayland_surface {
+ struct sway_view *view;
+
+ struct wl_listener commit;
+ struct wl_listener request_move;
+ struct wl_listener request_resize;
+ struct wl_listener request_maximize;
+ struct wl_listener request_configure;
+ struct wl_listener unmap_notify;
+ struct wl_listener map_notify;
+ struct wl_listener destroy;
+
+ int pending_width, pending_height;
+};
+
+struct sway_wl_shell_surface {
+ struct sway_view *view;
+
+ struct wl_listener commit;
+ struct wl_listener request_move;
+ struct wl_listener request_resize;
+ struct wl_listener request_maximize;
+ struct wl_listener destroy;
+
+ int pending_width, pending_height;
+};
+
+enum sway_view_type {
+ SWAY_WL_SHELL_VIEW,
+ SWAY_XDG_SHELL_V6_VIEW,
+ SWAY_XWAYLAND_VIEW,
+ // Keep last
+ SWAY_VIEW_TYPES,
+};
+
+enum sway_view_prop {
+ VIEW_PROP_TITLE,
+ VIEW_PROP_APP_ID,
+ VIEW_PROP_CLASS,
+ VIEW_PROP_INSTANCE,
+};
+
+struct sway_view {
+ enum sway_view_type type;
+ struct sway_container *swayc;
+ struct wlr_surface *surface;
+ int width, height;
+
+ union {
+ struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6;
+ struct wlr_xwayland_surface *wlr_xwayland_surface;
+ struct wlr_wl_shell_surface *wlr_wl_shell_surface;
+ };
+
+ union {
+ struct sway_xdg_surface_v6 *sway_xdg_surface_v6;
+ struct sway_xwayland_surface *sway_xwayland_surface;
+ struct sway_wl_shell_surface *sway_wl_shell_surface;
+ };
+
+ struct {
+ const char *(*get_prop)(struct sway_view *view,
+ enum sway_view_prop prop);
+ void (*set_size)(struct sway_view *view,
+ int width, int height);
+ void (*set_position)(struct sway_view *view,
+ double ox, double oy);
+ void (*set_activated)(struct sway_view *view, bool activated);
+ void (*close)(struct sway_view *view);
+ } iface;
+
+ // only used for unmanaged views (shell specific)
+ struct wl_list unmanaged_view_link; // sway_root::unmanaged views
+};
+
+const char *view_get_title(struct sway_view *view);
+
+const char *view_get_app_id(struct sway_view *view);
+
+const char *view_get_class(struct sway_view *view);
+
+const char *view_get_instance(struct sway_view *view);
+
+void view_set_size(struct sway_view *view, int width, int height);
+
+void view_set_position(struct sway_view *view, double ox, double oy);
+
+void view_set_activated(struct sway_view *view, bool activated);
+
+void view_close(struct sway_view *view);
+
+void view_update_outputs(struct sway_view *view, const struct wlr_box *before);
+
+#endif
diff --git a/include/sway/tree/workspace.h b/include/sway/tree/workspace.h
@@ -0,0 +1,26 @@
+#ifndef _SWAY_WORKSPACE_H
+#define _SWAY_WORKSPACE_H
+
+#include "sway/tree/container.h"
+
+extern char *prev_workspace_name;
+
+char *workspace_next_name(const char *output_name);
+
+swayc_t *workspace_create(const char *name);
+
+bool workspace_switch(swayc_t *workspace);
+
+struct sway_container *workspace_by_number(const char* name);
+
+swayc_t *workspace_by_name(const char*);
+
+struct sway_container *workspace_output_next(swayc_t *current);
+
+struct sway_container *workspace_next(swayc_t *current);
+
+struct sway_container *workspace_output_prev(swayc_t *current);
+
+struct sway_container *workspace_prev(swayc_t *current);
+
+#endif
diff --git a/include/sway/view.h b/include/sway/view.h
@@ -1,120 +0,0 @@
-#ifndef _SWAY_VIEW_H
-#define _SWAY_VIEW_H
-#include <wayland-server.h>
-#include <wlr/types/wlr_surface.h>
-#include <wlr/types/wlr_xdg_shell_v6.h>
-#include <wlr/xwayland.h>
-
-struct sway_container;
-struct sway_view;
-
-struct sway_xdg_surface_v6 {
- struct sway_view *view;
-
- struct wl_listener commit;
- struct wl_listener request_move;
- struct wl_listener request_resize;
- struct wl_listener request_maximize;
- struct wl_listener destroy;
-
- int pending_width, pending_height;
-};
-
-struct sway_xwayland_surface {
- struct sway_view *view;
-
- struct wl_listener commit;
- struct wl_listener request_move;
- struct wl_listener request_resize;
- struct wl_listener request_maximize;
- struct wl_listener request_configure;
- struct wl_listener unmap_notify;
- struct wl_listener map_notify;
- struct wl_listener destroy;
-
- int pending_width, pending_height;
-};
-
-struct sway_wl_shell_surface {
- struct sway_view *view;
-
- struct wl_listener commit;
- struct wl_listener request_move;
- struct wl_listener request_resize;
- struct wl_listener request_maximize;
- struct wl_listener destroy;
-
- int pending_width, pending_height;
-};
-
-enum sway_view_type {
- SWAY_WL_SHELL_VIEW,
- SWAY_XDG_SHELL_V6_VIEW,
- SWAY_XWAYLAND_VIEW,
- // Keep last
- SWAY_VIEW_TYPES,
-};
-
-enum sway_view_prop {
- VIEW_PROP_TITLE,
- VIEW_PROP_APP_ID,
- VIEW_PROP_CLASS,
- VIEW_PROP_INSTANCE,
-};
-
-/**
- * sway_view is a state container for surfaces that are arranged in the sway
- * tree (shell surfaces).
- */
-struct sway_view {
- enum sway_view_type type;
- struct sway_container *swayc;
- struct wlr_surface *surface;
- int width, height;
-
- union {
- struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6;
- struct wlr_xwayland_surface *wlr_xwayland_surface;
- struct wlr_wl_shell_surface *wlr_wl_shell_surface;
- };
-
- union {
- struct sway_xdg_surface_v6 *sway_xdg_surface_v6;
- struct sway_xwayland_surface *sway_xwayland_surface;
- struct sway_wl_shell_surface *sway_wl_shell_surface;
- };
-
- struct {
- const char *(*get_prop)(struct sway_view *view,
- enum sway_view_prop prop);
- void (*set_size)(struct sway_view *view,
- int width, int height);
- void (*set_position)(struct sway_view *view,
- double ox, double oy);
- void (*set_activated)(struct sway_view *view, bool activated);
- void (*close)(struct sway_view *view);
- } iface;
-
- // only used for unmanaged views (shell specific)
- struct wl_list unmanaged_view_link; // sway_root::unmanaged views
-};
-
-const char *view_get_title(struct sway_view *view);
-
-const char *view_get_app_id(struct sway_view *view);
-
-const char *view_get_class(struct sway_view *view);
-
-const char *view_get_instance(struct sway_view *view);
-
-void view_set_size(struct sway_view *view, int width, int height);
-
-void view_set_position(struct sway_view *view, double ox, double oy);
-
-void view_set_activated(struct sway_view *view, bool activated);
-
-void view_close(struct sway_view *view);
-
-void view_update_outputs(struct sway_view *view, const struct wlr_box *before);
-
-#endif
diff --git a/include/sway/workspace.h b/include/sway/workspace.h
@@ -1,20 +0,0 @@
-#ifndef _SWAY_WORKSPACE_H
-#define _SWAY_WORKSPACE_H
-
-#include "sway/container.h"
-
-extern char *prev_workspace_name;
-
-char *workspace_next_name(const char *output_name);
-swayc_t *workspace_create(const char *name);
-bool workspace_switch(swayc_t *workspace);
-
-struct sway_container *workspace_by_number(const char* name);
-swayc_t *workspace_by_name(const char*);
-
-struct sway_container *workspace_output_next(swayc_t *current);
-struct sway_container *workspace_next(swayc_t *current);
-struct sway_container *workspace_output_prev(swayc_t *current);
-struct sway_container *workspace_prev(swayc_t *current);
-
-#endif
diff --git a/sway/commands/exec_always.c b/sway/commands/exec_always.c
@@ -6,8 +6,8 @@
#include <unistd.h>
#include "sway/commands.h"
#include "sway/config.h"
-#include "sway/container.h"
-#include "sway/workspace.h"
+#include "sway/tree/container.h"
+#include "sway/tree/workspace.h"
#include "log.h"
#include "stringop.h"
diff --git a/sway/commands/focus.c b/sway/commands/focus.c
@@ -3,10 +3,11 @@
#include "log.h"
#include "sway/input/input-manager.h"
#include "sway/input/seat.h"
-#include "sway/view.h"
+#include "sway/tree/view.h"
#include "sway/commands.h"
-static bool parse_movement_direction(const char *name, enum movement_direction *out) {
+static bool parse_movement_direction(const char *name,
+ enum movement_direction *out) {
if (strcasecmp(name, "left") == 0) {
*out = MOVE_LEFT;
} else if (strcasecmp(name, "right") == 0) {
diff --git a/sway/commands/kill.c b/sway/commands/kill.c
@@ -2,7 +2,7 @@
#include "log.h"
#include "sway/input/input-manager.h"
#include "sway/input/seat.h"
-#include "sway/view.h"
+#include "sway/tree/view.h"
#include "sway/commands.h"
struct cmd_results *cmd_kill(int argc, char **argv) {
diff --git a/sway/commands/layout.c b/sway/commands/layout.c
@@ -1,8 +1,8 @@
#include <string.h>
#include <strings.h>
#include "sway/commands.h"
-#include "sway/container.h"
-#include "sway/layout.h"
+#include "sway/tree/container.h"
+#include "sway/tree/layout.h"
#include "log.h"
struct cmd_results *cmd_layout(int argc, char **argv) {
diff --git a/sway/commands/reload.c b/sway/commands/reload.c
@@ -1,6 +1,6 @@
#include "sway/commands.h"
#include "sway/config.h"
-#include "sway/layout.h"
+#include "sway/tree/layout.h"
struct cmd_results *cmd_reload(int argc, char **argv) {
struct cmd_results *error = NULL;
diff --git a/sway/commands/workspace.c b/sway/commands/workspace.c
@@ -4,7 +4,7 @@
#include "sway/commands.h"
#include "sway/config.h"
#include "sway/input/seat.h"
-#include "sway/workspace.h"
+#include "sway/tree/workspace.h"
#include "list.h"
#include "log.h"
#include "stringop.h"
diff --git a/sway/config.c b/sway/config.c
@@ -24,7 +24,7 @@
#include "sway/input/seat.h"
#include "sway/commands.h"
#include "sway/config.h"
-#include "sway/layout.h"
+#include "sway/tree/layout.h"
#include "readline.h"
#include "stringop.h"
#include "list.h"
diff --git a/sway/criteria.c b/sway/criteria.c
@@ -4,9 +4,9 @@
#include <stdbool.h>
#include <pcre.h>
#include "sway/criteria.h"
-#include "sway/container.h"
+#include "sway/tree/container.h"
#include "sway/config.h"
-#include "sway/view.h"
+#include "sway/tree/view.h"
#include "stringop.h"
#include "list.h"
#include "log.h"
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c
@@ -7,7 +7,7 @@
#include <wlr/types/wlr_output.h>
#include <wlr/util/log.h>
#include "sway/layers.h"
-#include "sway/layout.h"
+#include "sway/tree/layout.h"
#include "sway/output.h"
#include "sway/server.h"
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
@@ -11,14 +11,14 @@
#include <wlr/types/wlr_surface.h>
#include <wlr/types/wlr_wl_shell.h>
#include "log.h"
-#include "sway/container.h"
+#include "sway/tree/container.h"
#include "sway/input/input-manager.h"
#include "sway/input/seat.h"
#include "sway/layers.h"
-#include "sway/layout.h"
+#include "sway/tree/layout.h"
#include "sway/output.h"
#include "sway/server.h"
-#include "sway/view.h"
+#include "sway/tree/view.h"
/**
* Rotate a child's position relative to a parent. The parent size is (pw, ph),
diff --git a/sway/desktop/wl_shell.c b/sway/desktop/wl_shell.c
@@ -3,10 +3,10 @@
#include <stdlib.h>
#include <wayland-server.h>
#include <wlr/types/wlr_wl_shell.h>
-#include "sway/container.h"
-#include "sway/layout.h"
+#include "sway/tree/container.h"
+#include "sway/tree/layout.h"
#include "sway/server.h"
-#include "sway/view.h"
+#include "sway/tree/view.h"
#include "sway/input/seat.h"
#include "sway/input/input-manager.h"
#include "log.h"
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c
@@ -3,10 +3,10 @@
#include <stdlib.h>
#include <wayland-server.h>
#include <wlr/types/wlr_xdg_shell_v6.h>
-#include "sway/container.h"
-#include "sway/layout.h"
+#include "sway/tree/container.h"
+#include "sway/tree/layout.h"
#include "sway/server.h"
-#include "sway/view.h"
+#include "sway/tree/view.h"
#include "sway/input/seat.h"
#include "sway/input/input-manager.h"
#include "log.h"
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
@@ -5,10 +5,10 @@
#include <wlr/xwayland.h>
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_output.h>
-#include "sway/container.h"
-#include "sway/layout.h"
+#include "sway/tree/container.h"
+#include "sway/tree/layout.h"
#include "sway/server.h"
-#include "sway/view.h"
+#include "sway/tree/view.h"
#include "sway/output.h"
#include "sway/input/seat.h"
#include "sway/input/input-manager.h"
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
@@ -7,7 +7,7 @@
#include <wlr/types/wlr_cursor.h>
#include <wlr/types/wlr_xcursor_manager.h>
#include "sway/input/cursor.h"
-#include "sway/view.h"
+#include "sway/tree/view.h"
#include "list.h"
#include "log.h"
diff --git a/sway/input/seat.c b/sway/input/seat.c
@@ -1,13 +1,13 @@
#define _XOPEN_SOURCE 700
#include <wlr/types/wlr_cursor.h>
#include <wlr/types/wlr_xcursor_manager.h>
-#include "sway/container.h"
+#include "sway/tree/container.h"
#include "sway/input/seat.h"
#include "sway/input/cursor.h"
#include "sway/input/input-manager.h"
#include "sway/input/keyboard.h"
#include "sway/output.h"
-#include "sway/view.h"
+#include "sway/tree/view.h"
#include "log.h"
static void seat_device_destroy(struct sway_seat_device *seat_device) {
diff --git a/sway/ipc-json.c b/sway/ipc-json.c
@@ -3,7 +3,7 @@
#include <ctype.h>
#include "log.h"
#include "sway/ipc-json.h"
-#include "sway/container.h"
+#include "sway/tree/container.h"
#include "sway/output.h"
#include "sway/input/input-manager.h"
#include "sway/input/seat.h"
diff --git a/sway/main.c b/sway/main.c
@@ -18,7 +18,7 @@
#include <wlr/util/log.h>
#include "sway/config.h"
#include "sway/server.h"
-#include "sway/layout.h"
+#include "sway/tree/layout.h"
#include "sway/ipc-server.h"
#include "ipc-client.h"
#include "readline.h"
diff --git a/sway/tree/container.c b/sway/tree/container.c
@@ -7,14 +7,14 @@
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_wl_shell.h>
#include "sway/config.h"
-#include "sway/container.h"
+#include "sway/tree/container.h"
#include "sway/input/input-manager.h"
#include "sway/input/seat.h"
-#include "sway/layout.h"
+#include "sway/tree/layout.h"
#include "sway/output.h"
#include "sway/server.h"
-#include "sway/view.h"
-#include "sway/workspace.h"
+#include "sway/tree/view.h"
+#include "sway/tree/workspace.h"
#include "sway/ipc-server.h"
#include "log.h"
@@ -82,8 +82,6 @@ static swayc_t *new_swayc(enum swayc_types type) {
c->layout = L_NONE;
c->workspace_layout = L_NONE;
c->type = type;
- c->nb_master = 1;
- c->nb_slave_groups = 1;
if (type != C_VIEW) {
c->children = create_list();
}
diff --git a/sway/tree/layout.c b/sway/tree/layout.c
@@ -6,10 +6,10 @@
#include <string.h>
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_output_layout.h>
-#include "sway/container.h"
-#include "sway/layout.h"
+#include "sway/tree/container.h"
+#include "sway/tree/layout.h"
#include "sway/output.h"
-#include "sway/view.h"
+#include "sway/tree/view.h"
#include "sway/input/seat.h"
#include "list.h"
#include "log.h"
diff --git a/sway/tree/view.c b/sway/tree/view.c
@@ -1,8 +1,8 @@
#include <wayland-server.h>
#include <wlr/types/wlr_output_layout.h>
-#include "sway/container.h"
-#include "sway/layout.h"
-#include "sway/view.h"
+#include "sway/tree/container.h"
+#include "sway/tree/layout.h"
+#include "sway/tree/view.h"
const char *view_get_title(struct sway_view *view) {
if (view->iface.get_prop) {
@@ -45,6 +45,7 @@ void view_set_size(struct sway_view *view, int width, int height) {
}
}
+// TODO make view coordinates
void view_set_position(struct sway_view *view, double ox, double oy) {
if (view->iface.set_position) {
struct wlr_box box = {
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c
@@ -3,10 +3,10 @@
#include <stdlib.h>
#include <stdio.h>
#include <strings.h>
-#include "sway/container.h"
+#include "sway/tree/container.h"
#include "sway/input/input-manager.h"
#include "sway/input/seat.h"
-#include "sway/workspace.h"
+#include "sway/tree/workspace.h"
#include "log.h"
#include "util.h"