summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLibravatar Half-Shot <half-shot@molrams.com>2015-08-20 21:32:08 +0100
committerLibravatar Half-Shot <half-shot@molrams.com>2015-08-20 21:32:08 +0100
commit5a9ba261bca4ca709ec7a14d2019b55d9ce06994 (patch)
treefe1a924cf8055b2b722566db6ab98295dcf08ce7 /include
parentBasic left right move command implemented. (diff)
parentMerge pull request #104 from minus7/ipc-get-messages (diff)
downloadsway-5a9ba261bca4ca709ec7a14d2019b55d9ce06994.tar.gz
sway-5a9ba261bca4ca709ec7a14d2019b55d9ce06994.tar.zst
sway-5a9ba261bca4ca709ec7a14d2019b55d9ce06994.zip
Merge branch 'master' of https://github.com/SirCmpwn/sway
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 {
41 bool active; 41 bool active;
42 bool failed; 42 bool failed;
43 bool reloading; 43 bool reloading;
44
45 int gaps_inner;
46 int gaps_outer;
44}; 47};
45 48
46bool load_config(void); 49bool load_config(const char *file);
47bool read_config(FILE *file, bool is_active); 50bool read_config(FILE *file, bool is_active);
48char *do_var_replacement(struct sway_config *config, char *str); 51char *do_var_replacement(struct sway_config *config, char *str);
49 52
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{
11 C_WORKSPACE, 11 C_WORKSPACE,
12 C_CONTAINER, 12 C_CONTAINER,
13 C_VIEW, 13 C_VIEW,
14 //Keep last 14 // Keep last
15 C_TYPES, 15 C_TYPES,
16}; 16};
17 17
@@ -23,7 +23,7 @@ enum swayc_layouts{
23 L_STACKED, 23 L_STACKED,
24 L_TABBED, 24 L_TABBED,
25 L_FLOATING, 25 L_FLOATING,
26 //Keep last 26 // Keep last
27 L_LAYOUTS, 27 L_LAYOUTS,
28}; 28};
29 29
@@ -45,10 +45,10 @@ struct sway_container {
45 bool is_floating; 45 bool is_floating;
46 bool is_focused; 46 bool is_focused;
47 47
48 int weight;
49
50 char *name; 48 char *name;
51 49
50 int gaps;
51
52 list_t *children; 52 list_t *children;
53 list_t *floating; 53 list_t *floating;
54 54
@@ -56,6 +56,7 @@ struct sway_container {
56 struct sway_container *focused; 56 struct sway_container *focused;
57}; 57};
58 58
59// Container Creation
59 60
60swayc_t *new_output(wlc_handle handle); 61swayc_t *new_output(wlc_handle handle);
61swayc_t *new_workspace(swayc_t *output, const char *name); 62swayc_t *new_workspace(swayc_t *output, const char *name);
@@ -66,18 +67,29 @@ swayc_t *new_view(swayc_t *sibling, wlc_handle handle);
66// Creates view as a new floating view which is in the active workspace 67// Creates view as a new floating view which is in the active workspace
67swayc_t *new_floating_view(wlc_handle handle); 68swayc_t *new_floating_view(wlc_handle handle);
68 69
70// Container Destroying
69 71
70swayc_t *destroy_output(swayc_t *output); 72swayc_t *destroy_output(swayc_t *output);
71// Destroys workspace if empty and returns parent pointer, else returns NULL 73// Destroys workspace if empty and returns parent pointer, else returns NULL
72swayc_t *destroy_workspace(swayc_t *workspace); 74swayc_t *destroy_workspace(swayc_t *workspace);
75// Destroyes container and all parent container if they are empty, returns
76// topmost non-empty parent. returns NULL otherwise
73swayc_t *destroy_container(swayc_t *container); 77swayc_t *destroy_container(swayc_t *container);
78// Destroys view and all empty parent containers. return topmost non-empty
79// parent
74swayc_t *destroy_view(swayc_t *view); 80swayc_t *destroy_view(swayc_t *view);
75 81
82// Container Lookup
83
84swayc_t *swayc_parent_by_type(swayc_t *container, enum swayc_types);
85swayc_t *swayc_parent_by_layout(swayc_t *container, enum swayc_layouts);
86
76swayc_t *find_container(swayc_t *container, bool (*test)(swayc_t *view, void *data), void *data); 87swayc_t *find_container(swayc_t *container, bool (*test)(swayc_t *view, void *data), void *data);
77void container_map(swayc_t *, void (*f)(swayc_t *, void *), void *); 88void container_map(swayc_t *, void (*f)(swayc_t *, void *), void *);
78 89
79 90
80// Mappings 91// Mappings
81void set_view_visibility(swayc_t *view, void *data); 92void set_view_visibility(swayc_t *view, void *data);
93void reset_gaps(swayc_t *view, void *data);
82 94
83#endif 95#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 @@
1#ifndef _SWAY_FOCUS_H 1#ifndef _SWAY_FOCUS_H
2#define _SWAY_FOCUS_H 2#define _SWAY_FOCUS_H
3#include "container.h"
4
5enum movement_direction { 3enum movement_direction {
6 MOVE_LEFT, 4 MOVE_LEFT,
7 MOVE_RIGHT, 5 MOVE_RIGHT,
@@ -10,6 +8,8 @@ enum movement_direction {
10 MOVE_PARENT 8 MOVE_PARENT
11}; 9};
12 10
11#include "container.h"
12
13// focused_container - the container found by following the `focused` pointer 13// focused_container - the container found by following the `focused` pointer
14// from a given container to a container with `is_focused` boolean set 14// from a given container to a container with `is_focused` boolean set
15// --- 15// ---
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 @@
1#ifndef _SWAY_KEY_STATE_H
2#define _SWAY_KEY_STATE_H
3#include <stdbool.h>
4#include <stdint.h>
5#include "container.h"
6
7/* Keyboard state */
8
9typedef uint32_t keycode;
10
11// returns true if key has been pressed, otherwise false
12bool check_key(keycode key);
13
14// sets a key as pressed
15void press_key(keycode key);
16
17// unsets a key as pressed
18void release_key(keycode key);
19
20/* Pointer state */
21
22enum pointer_values {
23 M_LEFT_CLICK = 272,
24 M_RIGHT_CLICK = 273,
25 M_SCROLL_CLICK = 274,
26 M_SCROLL_UP = 275,
27 M_SCROLL_DOWN = 276,
28};
29
30extern struct pointer_state {
31 bool l_held;
32 bool r_held;
33 struct pointer_floating {
34 bool drag;
35 bool resize;
36 } floating;
37 struct pointer_lock {
38 bool left;
39 bool right;
40 bool top;
41 bool bottom;
42 } lock;
43} pointer_state;
44
45void start_floating(swayc_t *view);
46void reset_floating(swayc_t *view);
47
48#endif
49
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 @@
1#ifndef _SWAY_IPC_H
2#define _SWAY_IPC_H
3
4enum ipc_command_type {
5 IPC_COMMAND = 0,
6 IPC_GET_WORKSPACES = 1,
7 IPC_SUBSCRIBE = 2,
8 IPC_GET_OUTPUTS = 3,
9 IPC_GET_TREE = 4,
10 IPC_GET_MARKS = 5,
11 IPC_GET_BAR_CONFIG = 6,
12 IPC_GET_VERSION = 7,
13};
14
15void ipc_init(void);
16void ipc_terminate(void);
17
18#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 @@
4#include <wlc/wlc.h> 4#include <wlc/wlc.h>
5#include "list.h" 5#include "list.h"
6#include "container.h" 6#include "container.h"
7#include "focus.h"
7 8
8extern swayc_t root_container; 9extern swayc_t root_container;
9 10
10void init_layout(void); 11void init_layout(void);
11 12
12void add_child(swayc_t *parent, swayc_t *child); 13void add_child(swayc_t *parent, swayc_t *child);
14void add_floating(swayc_t *ws, swayc_t *child);
13// Returns parent container which needs to be rearranged. 15// Returns parent container which needs to be rearranged.
14swayc_t *add_sibling(swayc_t *sibling, swayc_t *child); 16swayc_t *add_sibling(swayc_t *sibling, swayc_t *child);
15swayc_t *replace_child(swayc_t *child, swayc_t *new_child); 17swayc_t *replace_child(swayc_t *child, swayc_t *new_child);
@@ -28,5 +30,6 @@ void focus_view_for(swayc_t *ancestor, swayc_t *container);
28 30
29swayc_t *get_focused_container(swayc_t *parent); 31swayc_t *get_focused_container(swayc_t *parent);
30swayc_t *get_swayc_for_handle(wlc_handle handle, swayc_t *parent); 32swayc_t *get_swayc_for_handle(wlc_handle handle, swayc_t *parent);
33swayc_t *get_swayc_in_direction(swayc_t *container, enum movement_direction dir);
31 34
32#endif 35#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 @@
1#ifndef _SWAY_LOG_H 1#ifndef _SWAY_LOG_H
2#define _SWAY_LOG_H 2#define _SWAY_LOG_H
3#include <stdbool.h>
4#include "container.h"
3 5
4typedef enum { 6typedef enum {
5 L_SILENT = 0, 7 L_SILENT = 0,
@@ -10,7 +12,10 @@ typedef enum {
10 12
11void init_log(int verbosity); 13void init_log(int verbosity);
12void sway_log_colors(int mode); 14void sway_log_colors(int mode);
13void sway_log(int verbosity, char* format, ...) __attribute__((format(printf,2,3))); 15void sway_log(int verbosity, const char* format, ...) __attribute__((format(printf,2,3)));
14void sway_abort(char* format, ...)__attribute__((format(printf,1,2))); 16void sway_log_errno(int verbosity, char* format, ...) __attribute__((format(printf,2,3)));
17void sway_abort(const char* format, ...) __attribute__((format(printf,1,2)));
18bool sway_assert(bool condition, const char* format, ...) __attribute__((format(printf,2,3)));
15 19
20void layout_log(const swayc_t *c, int depth);
16#endif 21#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);
10char *code_strstr(const char *haystack, const char *needle); 10char *code_strstr(const char *haystack, const char *needle);
11int unescape_string(char *string); 11int unescape_string(char *string);
12char *join_args(char **argv, int argc); 12char *join_args(char **argv, int argc);
13char *join_list(list_t *list, char *separator);
13 14
14#endif 15#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 @@
1#ifndef _SWAY_SWAY_H
2#define _SWAY_SWAY_H
3
4void sway_terminate(void);
5
6#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();
15void workspace_next(); 15void workspace_next();
16void workspace_output_prev(); 16void workspace_output_prev();
17void workspace_prev(); 17void workspace_prev();
18void layout_log(const swayc_t *c, int depth);
19 18
20#endif 19#endif