diff options
author | Drew DeVault <sir@cmpwn.com> | 2016-09-01 08:34:52 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2016-09-01 08:34:52 -0400 |
commit | 38ca94e0ed2fe33ab71076680e9f70409a2e4115 (patch) | |
tree | 1f07ca668671a5f135648095c82dfe029a72798d /sway/focus.c | |
parent | Reorganize includes (diff) | |
download | sway-38ca94e0ed2fe33ab71076680e9f70409a2e4115.tar.gz sway-38ca94e0ed2fe33ab71076680e9f70409a2e4115.tar.zst sway-38ca94e0ed2fe33ab71076680e9f70409a2e4115.zip |
Tweak how swaylock surfaces are handled
Fixes #875
Diffstat (limited to 'sway/focus.c')
-rw-r--r-- | sway/focus.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/sway/focus.c b/sway/focus.c index 9207260d..02e61ac2 100644 --- a/sway/focus.c +++ b/sway/focus.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include "sway/workspace.h" | 3 | #include "sway/workspace.h" |
4 | #include "sway/layout.h" | 4 | #include "sway/layout.h" |
5 | #include "sway/config.h" | 5 | #include "sway/config.h" |
6 | #include "sway/extensions.h" | ||
6 | #include "sway/input_state.h" | 7 | #include "sway/input_state.h" |
7 | #include "sway/ipc-server.h" | 8 | #include "sway/ipc-server.h" |
8 | #include "sway/border.h" | 9 | #include "sway/border.h" |
@@ -88,7 +89,6 @@ swayc_t *get_focused_container(swayc_t *parent) { | |||
88 | if (!parent) { | 89 | if (!parent) { |
89 | return swayc_active_workspace(); | 90 | return swayc_active_workspace(); |
90 | } | 91 | } |
91 | // get focused container | ||
92 | while (!parent->is_focused && parent->focused) { | 92 | while (!parent->is_focused && parent->focused) { |
93 | parent = parent->focused; | 93 | parent = parent->focused; |
94 | } | 94 | } |
@@ -132,24 +132,24 @@ bool set_focused_container(swayc_t *c) { | |||
132 | p->is_focused = false; | 132 | p->is_focused = false; |
133 | } | 133 | } |
134 | 134 | ||
135 | // get new focused view and set focus to it. | ||
136 | if (!(wlc_view_get_type(p->handle) & WLC_BIT_POPUP)) { | 135 | if (!(wlc_view_get_type(p->handle) & WLC_BIT_POPUP)) { |
137 | // unactivate previous focus | ||
138 | if (focused->type == C_VIEW) { | 136 | if (focused->type == C_VIEW) { |
139 | wlc_view_set_state(focused->handle, WLC_BIT_ACTIVATED, false); | 137 | wlc_view_set_state(focused->handle, WLC_BIT_ACTIVATED, false); |
140 | } | 138 | } |
141 | update_container_border(focused); | 139 | update_container_border(focused); |
142 | // activate current focus | ||
143 | if (c->type == C_VIEW) { | 140 | if (c->type == C_VIEW) { |
144 | wlc_view_set_state(c->handle, WLC_BIT_ACTIVATED, true); | 141 | wlc_view_set_state(c->handle, WLC_BIT_ACTIVATED, true); |
145 | } | 142 | } |
146 | // set focus | 143 | if (!desktop_shell.is_locked) { |
147 | wlc_view_focus(c->handle); | 144 | // If the system is locked, we do everything _but_ actually setting |
145 | // focus. This includes making our internals think that this view is | ||
146 | // focused. | ||
147 | wlc_view_focus(c->handle); | ||
148 | } | ||
148 | if (c->parent->layout != L_TABBED && c->parent->layout != L_STACKED) { | 149 | if (c->parent->layout != L_TABBED && c->parent->layout != L_STACKED) { |
149 | update_container_border(c); | 150 | update_container_border(c); |
150 | } | 151 | } |
151 | 152 | ||
152 | // rearrange if parent container is tabbed/stacked | ||
153 | swayc_t *parent = swayc_tabbed_stacked_ancestor(c); | 153 | swayc_t *parent = swayc_tabbed_stacked_ancestor(c); |
154 | if (parent != NULL) { | 154 | if (parent != NULL) { |
155 | arrange_backgrounds(); | 155 | arrange_backgrounds(); |
@@ -174,7 +174,6 @@ bool set_focused_container_for(swayc_t *a, swayc_t *c) { | |||
174 | return false; | 174 | return false; |
175 | } | 175 | } |
176 | swayc_t *find = c; | 176 | swayc_t *find = c; |
177 | // Ensure that a is an ancestor of c | ||
178 | while (find != a && (find = find->parent)) { | 177 | while (find != a && (find = find->parent)) { |
179 | if (find == &root_container) { | 178 | if (find == &root_container) { |
180 | return false; | 179 | return false; |