diff options
-rw-r--r-- | include/sway/container.h | 21 | ||||
-rw-r--r-- | sway/focus.c | 4 | ||||
-rw-r--r-- | sway/layout.c | 2 |
3 files changed, 17 insertions, 10 deletions
diff --git a/include/sway/container.h b/include/sway/container.h index 4dd7f3a0..215c0b07 100644 --- a/include/sway/container.h +++ b/include/sway/container.h | |||
@@ -8,6 +8,7 @@ | |||
8 | typedef struct sway_container swayc_t; | 8 | typedef struct sway_container swayc_t; |
9 | 9 | ||
10 | extern swayc_t root_container; | 10 | extern swayc_t root_container; |
11 | extern swayc_t *current_focus; | ||
11 | 12 | ||
12 | /** | 13 | /** |
13 | * Different kinds of containers. | 14 | * Different kinds of containers. |
@@ -16,11 +17,11 @@ extern swayc_t root_container; | |||
16 | * it on this list. | 17 | * it on this list. |
17 | */ | 18 | */ |
18 | enum swayc_types { | 19 | enum swayc_types { |
19 | C_ROOT, /**< The root container. Only one of these ever exists. */ | 20 | C_ROOT, /**< The root container. Only one of these ever exists. */ |
20 | C_OUTPUT, /**< An output (aka monitor, head, etc). */ | 21 | C_OUTPUT, /**< An output (aka monitor, head, etc). */ |
21 | C_WORKSPACE, /**< A workspace. */ | 22 | C_WORKSPACE, /**< A workspace. */ |
22 | C_CONTAINER, /**< A manually created container. */ | 23 | C_CONTAINER, /**< A manually created container. */ |
23 | C_VIEW, /**< A view (aka window). */ | 24 | C_VIEW, /**< A view (aka window). */ |
24 | // Keep last | 25 | // Keep last |
25 | C_TYPES, | 26 | C_TYPES, |
26 | }; | 27 | }; |
@@ -29,20 +30,20 @@ enum swayc_types { | |||
29 | * Different ways to arrange a container. | 30 | * Different ways to arrange a container. |
30 | */ | 31 | */ |
31 | enum swayc_layouts { | 32 | enum swayc_layouts { |
32 | L_NONE, /**< Used for containers that have no layout (views, root) */ | 33 | L_NONE, /**< Used for containers that have no layout (views, root) */ |
33 | L_HORIZ, | 34 | L_HORIZ, |
34 | L_VERT, | 35 | L_VERT, |
35 | L_STACKED, | 36 | L_STACKED, |
36 | L_TABBED, | 37 | L_TABBED, |
37 | L_FLOATING, /**< A psuedo-container, removed from the tree, to hold floating windows */ | 38 | L_FLOATING, /**< A psuedo-container, removed from the tree, to hold floating windows */ |
38 | // Keep last | 39 | // Keep last |
39 | L_LAYOUTS, | 40 | L_LAYOUTS, |
40 | }; | 41 | }; |
41 | 42 | ||
42 | enum swayc_border_types { | 43 | enum swayc_border_types { |
43 | B_NONE, /**< No border */ | 44 | B_NONE, /**< No border */ |
44 | B_PIXEL, /**< 1px border */ | 45 | B_PIXEL, /**< 1px border */ |
45 | B_NORMAL /**< Normal border with title bar */ | 46 | B_NORMAL /**< Normal border with title bar */ |
46 | }; | 47 | }; |
47 | 48 | ||
48 | /** | 49 | /** |
diff --git a/sway/focus.c b/sway/focus.c index 02e61ac2..b94dcbc7 100644 --- a/sway/focus.c +++ b/sway/focus.c | |||
@@ -120,6 +120,10 @@ bool set_focused_container(swayc_t *c) { | |||
120 | // dispatch a window event | 120 | // dispatch a window event |
121 | ipc_event_window(c, "focus"); | 121 | ipc_event_window(c, "focus"); |
122 | } | 122 | } |
123 | |||
124 | // update the global pointer | ||
125 | current_focus = c; | ||
126 | |||
123 | // update container focus from here to root, making necessary changes along | 127 | // update container focus from here to root, making necessary changes along |
124 | // the way | 128 | // the way |
125 | swayc_t *p = c; | 129 | swayc_t *p = c; |
diff --git a/sway/layout.c b/sway/layout.c index 2d29340e..7802c412 100644 --- a/sway/layout.c +++ b/sway/layout.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include "log.h" | 15 | #include "log.h" |
16 | 16 | ||
17 | swayc_t root_container; | 17 | swayc_t root_container; |
18 | swayc_t *current_focus; | ||
18 | list_t *scratchpad; | 19 | list_t *scratchpad; |
19 | 20 | ||
20 | int min_sane_h = 60; | 21 | int min_sane_h = 60; |
@@ -27,6 +28,7 @@ void init_layout(void) { | |||
27 | root_container.children = create_list(); | 28 | root_container.children = create_list(); |
28 | root_container.handle = -1; | 29 | root_container.handle = -1; |
29 | root_container.visible = true; | 30 | root_container.visible = true; |
31 | current_focus = &root_container; | ||
30 | scratchpad = create_list(); | 32 | scratchpad = create_list(); |
31 | } | 33 | } |
32 | 34 | ||