aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2016-09-18 06:30:55 +0900
committerGitHub <noreply@github.com>2016-09-18 06:30:55 +0900
commita7eeb48aace8d88f9c809eee5df93d6cefbb372f (patch)
tree8d64bd01413c08c5250085e8666cb4bef75efc97 /sway
parent75f82808e2e5e4950d436ff6d30a58ac9fabd599 (diff)
parente18b7cdfa920d536e4911a7ccbc2d6da5ae759f4 (diff)
Merge pull request #906 from zandrmartin/global-focus-pointer
add global `current_focus` pointer
Diffstat (limited to 'sway')
-rw-r--r--sway/focus.c4
-rw-r--r--sway/layout.c2
2 files changed, 6 insertions, 0 deletions
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) {
// dispatch a window event
ipc_event_window(c, "focus");
}
+
+ // update the global pointer
+ current_focus = c;
+
// update container focus from here to root, making necessary changes along
// the way
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 @@
#include "log.h"
swayc_t root_container;
+swayc_t *current_focus;
list_t *scratchpad;
int min_sane_h = 60;
@@ -27,6 +28,7 @@ void init_layout(void) {
root_container.children = create_list();
root_container.handle = -1;
root_container.visible = true;
+ current_focus = &root_container;
scratchpad = create_list();
}