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 | |
parent | Reorganize includes (diff) | |
download | sway-38ca94e0ed2fe33ab71076680e9f70409a2e4115.tar.gz sway-38ca94e0ed2fe33ab71076680e9f70409a2e4115.tar.zst sway-38ca94e0ed2fe33ab71076680e9f70409a2e4115.zip |
Tweak how swaylock surfaces are handled
Fixes #875
-rw-r--r-- | sway/extensions.c | 14 | ||||
-rw-r--r-- | sway/focus.c | 15 |
2 files changed, 11 insertions, 18 deletions
diff --git a/sway/extensions.c b/sway/extensions.c index 70ec537d..60cd8d41 100644 --- a/sway/extensions.c +++ b/sway/extensions.c | |||
@@ -119,27 +119,21 @@ static void set_lock_surface(struct wl_client *client, struct wl_resource *resou | |||
119 | if (!swayc_is_child_of(view, workspace)) { | 119 | if (!swayc_is_child_of(view, workspace)) { |
120 | move_container_to(view, workspace); | 120 | move_container_to(view, workspace); |
121 | } | 121 | } |
122 | // make the view floating so it doesn't rearrange other | 122 | // make the view floating so it doesn't rearrange other siblings. |
123 | // siblings. | ||
124 | if (!view->is_floating) { | 123 | if (!view->is_floating) { |
125 | // Remove view from its current location | ||
126 | destroy_container(remove_child(view)); | 124 | destroy_container(remove_child(view)); |
127 | // and move it into workspace floating | ||
128 | add_floating(workspace, view); | 125 | add_floating(workspace, view); |
129 | } | 126 | } |
130 | wlc_view_set_state(view->handle, WLC_BIT_FULLSCREEN, true); | 127 | wlc_view_set_state(view->handle, WLC_BIT_FULLSCREEN, true); |
131 | workspace->fullscreen = view; | 128 | wlc_view_bring_to_front(view->handle); |
132 | ipc_event_window(view, "fullscreen_mode"); | 129 | wlc_view_focus(view->handle); |
133 | desktop_shell.is_locked = true; | 130 | desktop_shell.is_locked = true; |
134 | // reset input state | ||
135 | input_init(); | 131 | input_init(); |
136 | // set focus if the lockscreen is spawned on the currently | 132 | arrange_windows(workspace, -1, -1); |
137 | // active output | ||
138 | swayc_t *focus_output = swayc_active_output(); | 133 | swayc_t *focus_output = swayc_active_output(); |
139 | if (focus_output == output) { | 134 | if (focus_output == output) { |
140 | set_focused_container(view); | 135 | set_focused_container(view); |
141 | } | 136 | } |
142 | arrange_windows(workspace, -1, -1); | ||
143 | list_add(desktop_shell.lock_surfaces, surface); | 137 | list_add(desktop_shell.lock_surfaces, surface); |
144 | wl_resource_set_destructor(surface, lock_surface_destructor); | 138 | wl_resource_set_destructor(surface, lock_surface_destructor); |
145 | } else { | 139 | } else { |
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; |