aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2018-03-29 12:15:31 -0400
committerTony Crisci <tony@dubstepdish.com>2018-03-29 14:21:42 -0400
commit874f009866abaf8ca43ed4cd88a69d22a3fbfc5a (patch)
tree05dff1efd73807aded434527ed1774250314116e /include
parentb1984133a9addcdae70fb4ac58af2f387fcc3707 (diff)
move tree includes to their own directory
Diffstat (limited to 'include')
-rw-r--r--include/sway/config.h4
-rw-r--r--include/sway/criteria.h2
-rw-r--r--include/sway/ipc-json.h2
-rw-r--r--include/sway/ipc-server.h4
-rw-r--r--include/sway/tree/container.h (renamed from include/sway/container.h)75
-rw-r--r--include/sway/tree/layout.h (renamed from include/sway/layout.h)12
-rw-r--r--include/sway/tree/view.h (renamed from include/sway/view.h)4
-rw-r--r--include/sway/tree/workspace.h (renamed from include/sway/workspace.h)8
8 files changed, 45 insertions, 66 deletions
diff --git a/include/sway/config.h b/include/sway/config.h
index 48a8b0ab..48ebba3b 100644
--- 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/criteria.h b/include/sway/criteria.h
index 9b4b4bef..431cfa3a 100644
--- 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
index eef5a018..76b7d45b 100644
--- 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
index bcf1c433..db690b6e 100644
--- 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/container.h b/include/sway/tree/container.h
index f200a1a2..5a2ae349 100644
--- a/include/sway/container.h
+++ b/include/sway/tree/container.h
@@ -20,60 +20,43 @@ struct sway_seat;
* 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_ROOT,
+ C_OUTPUT,
+ C_WORKSPACE,
+ C_CONTAINER,
+ C_VIEW,
C_TYPES,
};
-/**
- * Different ways to arrange a container.
- */
enum swayc_layouts {
- L_NONE, /**< Used for containers that have no layout (views, root) */
+ L_NONE,
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,
+ L_FLOATING,
// Keep last
L_LAYOUTS,
};
enum swayc_border_types {
- B_NONE, /**< No border */
- B_PIXEL, /**< 1px border */
- B_NORMAL, /**< Normal border with title bar */
+ B_NONE,
+ B_PIXEL,
+ B_NORMAL,
};
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
+ struct sway_root *sway_root;
+ struct sway_output *sway_output;
+ struct sway_view *sway_view;
};
/**
@@ -89,38 +72,17 @@ struct sway_container {
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).
- */
+ // TODO convert to layout coordinates
double x, y;
- /**
- * Width and height of this container, without borders or gaps.
- */
+ // does not include 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;
+ list_t *marks; // list of char*
struct {
struct wl_signal destroy;
@@ -130,8 +92,11 @@ struct sway_container {
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);
@@ -145,10 +110,12 @@ swayc_t *next_view_sibling(struct sway_seat *seat);
*/
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.
*/
diff --git a/include/sway/layout.h b/include/sway/tree/layout.h
index e82c4442..39b7fb24 100644
--- a/include/sway/layout.h
+++ b/include/sway/tree/layout.h
@@ -2,7 +2,7 @@
#define _SWAY_LAYOUT_H
#include <wlr/types/wlr_output_layout.h>
-#include "sway/container.h"
+#include "sway/tree/container.h"
enum movement_direction {
MOVE_LEFT,
@@ -31,12 +31,20 @@ struct sway_root {
};
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);
+
+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);
diff --git a/include/sway/view.h b/include/sway/tree/view.h
index b2886211..e5f53f4e 100644
--- a/include/sway/view.h
+++ b/include/sway/tree/view.h
@@ -62,10 +62,6 @@ enum sway_view_prop {
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;
diff --git a/include/sway/workspace.h b/include/sway/tree/workspace.h
index fee54255..c8ce40d1 100644
--- a/include/sway/workspace.h
+++ b/include/sway/tree/workspace.h
@@ -1,20 +1,26 @@
#ifndef _SWAY_WORKSPACE_H
#define _SWAY_WORKSPACE_H
-#include "sway/container.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