aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/config.h5
-rw-r--r--include/container.h20
-rw-r--r--include/focus.h4
-rw-r--r--include/input_state.h49
-rw-r--r--include/ipc.h18
-rw-r--r--include/layout.h3
-rw-r--r--include/log.h9
-rw-r--r--include/stringop.h1
-rw-r--r--include/sway.h6
-rw-r--r--include/workspace.h1
10 files changed, 106 insertions, 10 deletions
diff --git a/include/config.h b/include/config.h
index 9243bf35..c23c3509 100644
--- a/include/config.h
+++ b/include/config.h
@@ -41,9 +41,12 @@ struct sway_config {
bool active;
bool failed;
bool reloading;
+
+ int gaps_inner;
+ int gaps_outer;
};
-bool load_config(void);
+bool load_config(const char *file);
bool read_config(FILE *file, bool is_active);
char *do_var_replacement(struct sway_config *config, char *str);
diff --git a/include/container.h b/include/container.h
index 63529e44..79e023fe 100644
--- a/include/container.h
+++ b/include/container.h
@@ -11,7 +11,7 @@ enum swayc_types{
C_WORKSPACE,
C_CONTAINER,
C_VIEW,
- //Keep last
+ // Keep last
C_TYPES,
};
@@ -23,7 +23,7 @@ enum swayc_layouts{
L_STACKED,
L_TABBED,
L_FLOATING,
- //Keep last
+ // Keep last
L_LAYOUTS,
};
@@ -45,10 +45,10 @@ struct sway_container {
bool is_floating;
bool is_focused;
- int weight;
-
char *name;
+ int gaps;
+
list_t *children;
list_t *floating;
@@ -56,6 +56,7 @@ struct sway_container {
struct sway_container *focused;
};
+// Container Creation
swayc_t *new_output(wlc_handle handle);
swayc_t *new_workspace(swayc_t *output, const char *name);
@@ -66,18 +67,29 @@ swayc_t *new_view(swayc_t *sibling, wlc_handle handle);
// Creates view as a new floating view which is in the active workspace
swayc_t *new_floating_view(wlc_handle handle);
+// Container Destroying
swayc_t *destroy_output(swayc_t *output);
// Destroys workspace if empty and returns parent pointer, else returns NULL
swayc_t *destroy_workspace(swayc_t *workspace);
+// Destroyes container and all parent container if they are empty, returns
+// topmost non-empty parent. returns NULL otherwise
swayc_t *destroy_container(swayc_t *container);
+// Destroys view and all empty parent containers. return topmost non-empty
+// parent
swayc_t *destroy_view(swayc_t *view);
+// Container Lookup
+
+swayc_t *swayc_parent_by_type(swayc_t *container, enum swayc_types);
+swayc_t *swayc_parent_by_layout(swayc_t *container, enum swayc_layouts);
+
swayc_t *find_container(swayc_t *container, bool (*test)(swayc_t *view, void *data), void *data);
void container_map(swayc_t *, void (*f)(swayc_t *, void *), void *);
// Mappings
void set_view_visibility(swayc_t *view, void *data);
+void reset_gaps(swayc_t *view, void *data);
#endif
diff --git a/include/focus.h b/include/focus.h
index 410ed134..383993fa 100644
--- a/include/focus.h
+++ b/include/focus.h
@@ -1,7 +1,5 @@
#ifndef _SWAY_FOCUS_H
#define _SWAY_FOCUS_H
-#include "container.h"
-
enum movement_direction {
MOVE_LEFT,
MOVE_RIGHT,
@@ -10,6 +8,8 @@ enum movement_direction {
MOVE_PARENT
};
+#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
// ---
diff --git a/include/input_state.h b/include/input_state.h
new file mode 100644
index 00000000..782b4b19
--- /dev/null
+++ b/include/input_state.h
@@ -0,0 +1,49 @@
+#ifndef _SWAY_KEY_STATE_H
+#define _SWAY_KEY_STATE_H
+#include <stdbool.h>
+#include <stdint.h>
+#include "container.h"
+
+/* Keyboard state */
+
+typedef uint32_t keycode;
+
+// returns true if key has been pressed, otherwise false
+bool check_key(keycode key);
+
+// sets a key as pressed
+void press_key(keycode key);
+
+// unsets a key as pressed
+void release_key(keycode key);
+
+/* 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,
+};
+
+extern struct pointer_state {
+ bool l_held;
+ bool r_held;
+ struct pointer_floating {
+ bool drag;
+ bool resize;
+ } floating;
+ struct pointer_lock {
+ bool left;
+ bool right;
+ bool top;
+ bool bottom;
+ } lock;
+} pointer_state;
+
+void start_floating(swayc_t *view);
+void reset_floating(swayc_t *view);
+
+#endif
+
diff --git a/include/ipc.h b/include/ipc.h
new file mode 100644
index 00000000..0b6441f6
--- /dev/null
+++ b/include/ipc.h
@@ -0,0 +1,18 @@
+#ifndef _SWAY_IPC_H
+#define _SWAY_IPC_H
+
+enum ipc_command_type {
+ IPC_COMMAND = 0,
+ IPC_GET_WORKSPACES = 1,
+ IPC_SUBSCRIBE = 2,
+ IPC_GET_OUTPUTS = 3,
+ IPC_GET_TREE = 4,
+ IPC_GET_MARKS = 5,
+ IPC_GET_BAR_CONFIG = 6,
+ IPC_GET_VERSION = 7,
+};
+
+void ipc_init(void);
+void ipc_terminate(void);
+
+#endif
diff --git a/include/layout.h b/include/layout.h
index 79241698..c1d7d8b4 100644
--- a/include/layout.h
+++ b/include/layout.h
@@ -4,12 +4,14 @@
#include <wlc/wlc.h>
#include "list.h"
#include "container.h"
+#include "focus.h"
extern swayc_t root_container;
void init_layout(void);
void add_child(swayc_t *parent, swayc_t *child);
+void add_floating(swayc_t *ws, swayc_t *child);
// Returns parent container which needs to be rearranged.
swayc_t *add_sibling(swayc_t *sibling, swayc_t *child);
swayc_t *replace_child(swayc_t *child, swayc_t *new_child);
@@ -28,5 +30,6 @@ void focus_view_for(swayc_t *ancestor, swayc_t *container);
swayc_t *get_focused_container(swayc_t *parent);
swayc_t *get_swayc_for_handle(wlc_handle handle, swayc_t *parent);
+swayc_t *get_swayc_in_direction(swayc_t *container, enum movement_direction dir);
#endif
diff --git a/include/log.h b/include/log.h
index d35b2a54..47a83321 100644
--- a/include/log.h
+++ b/include/log.h
@@ -1,5 +1,7 @@
#ifndef _SWAY_LOG_H
#define _SWAY_LOG_H
+#include <stdbool.h>
+#include "container.h"
typedef enum {
L_SILENT = 0,
@@ -10,7 +12,10 @@ typedef enum {
void init_log(int verbosity);
void sway_log_colors(int mode);
-void sway_log(int verbosity, char* format, ...) __attribute__((format(printf,2,3)));
-void sway_abort(char* format, ...)__attribute__((format(printf,1,2)));
+void sway_log(int verbosity, const char* format, ...) __attribute__((format(printf,2,3)));
+void sway_log_errno(int verbosity, char* format, ...) __attribute__((format(printf,2,3)));
+void sway_abort(const char* format, ...) __attribute__((format(printf,1,2)));
+bool sway_assert(bool condition, const char* format, ...) __attribute__((format(printf,2,3)));
+void layout_log(const swayc_t *c, int depth);
#endif
diff --git a/include/stringop.h b/include/stringop.h
index a5346829..4300f9ed 100644
--- a/include/stringop.h
+++ b/include/stringop.h
@@ -10,5 +10,6 @@ char *code_strchr(const char *string, char delimiter);
char *code_strstr(const char *haystack, const char *needle);
int unescape_string(char *string);
char *join_args(char **argv, int argc);
+char *join_list(list_t *list, char *separator);
#endif
diff --git a/include/sway.h b/include/sway.h
new file mode 100644
index 00000000..6499c81d
--- /dev/null
+++ b/include/sway.h
@@ -0,0 +1,6 @@
+#ifndef _SWAY_SWAY_H
+#define _SWAY_SWAY_H
+
+void sway_terminate(void);
+
+#endif
diff --git a/include/workspace.h b/include/workspace.h
index 8ce39bbd..042a15d9 100644
--- a/include/workspace.h
+++ b/include/workspace.h
@@ -15,6 +15,5 @@ void workspace_output_next();
void workspace_next();
void workspace_output_prev();
void workspace_prev();
-void layout_log(const swayc_t *c, int depth);
#endif