diff options
author | Tony Crisci <tony@dubstepdish.com> | 2018-02-10 19:53:50 -0500 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2018-02-10 19:53:50 -0500 |
commit | 93084c9cf80901b160e0eb50b72a8e607289a678 (patch) | |
tree | 0b6c6753bb52f8382110e8ab5d9755f4807f4ee7 /sway/tree/workspace.c | |
parent | properly pick next focus (diff) | |
download | sway-93084c9cf80901b160e0eb50b72a8e607289a678.tar.gz sway-93084c9cf80901b160e0eb50b72a8e607289a678.tar.zst sway-93084c9cf80901b160e0eb50b72a8e607289a678.zip |
remove old focus member
Diffstat (limited to 'sway/tree/workspace.c')
-rw-r--r-- | sway/tree/workspace.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index 29f07f74..861fda4d 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c | |||
@@ -120,9 +120,15 @@ swayc_t *workspace_output_prev_next_impl(swayc_t *output, bool next) { | |||
120 | return NULL; | 120 | return NULL; |
121 | } | 121 | } |
122 | 122 | ||
123 | struct sway_seat *seat = input_manager_current_seat(input_manager); | ||
124 | swayc_t *focus = sway_seat_get_focus_inactive(seat, output); | ||
125 | swayc_t *workspace = (focus->type == C_WORKSPACE ? | ||
126 | focus : | ||
127 | swayc_parent_by_type(focus, C_WORKSPACE)); | ||
128 | |||
123 | int i; | 129 | int i; |
124 | for (i = 0; i < output->children->length; i++) { | 130 | for (i = 0; i < output->children->length; i++) { |
125 | if (output->children->items[i] == output->focused) { | 131 | if (output->children->items[i] == workspace) { |
126 | return output->children->items[ | 132 | return output->children->items[ |
127 | wrap(i + (next ? 1 : -1), output->children->length)]; | 133 | wrap(i + (next ? 1 : -1), output->children->length)]; |
128 | } | 134 | } |
@@ -225,16 +231,12 @@ bool workspace_switch(swayc_t *workspace) { | |||
225 | // TODO: Deal with sticky containers | 231 | // TODO: Deal with sticky containers |
226 | 232 | ||
227 | wlr_log(L_DEBUG, "Switching to workspace %p:%s", workspace, workspace->name); | 233 | wlr_log(L_DEBUG, "Switching to workspace %p:%s", workspace, workspace->name); |
228 | // TODO FOCUS: Focus the last view this seat had focused on this workspace | 234 | swayc_t *next = sway_seat_get_focus_inactive(seat, workspace); |
229 | if (workspace->children->length) { | 235 | if (next == NULL) { |
230 | // TODO FOCUS: This is really fucking stupid | 236 | next = workspace; |
231 | sway_seat_set_focus(seat, workspace->children->items[0]); | ||
232 | } else { | ||
233 | sway_seat_set_focus(seat, workspace); | ||
234 | } | 237 | } |
238 | sway_seat_set_focus(seat, next); | ||
235 | swayc_t *output = swayc_parent_by_type(workspace, C_OUTPUT); | 239 | swayc_t *output = swayc_parent_by_type(workspace, C_OUTPUT); |
236 | // TODO FOCUS: take a look at this | ||
237 | output->focused = workspace; | ||
238 | arrange_windows(output, -1, -1); | 240 | arrange_windows(output, -1, -1); |
239 | return true; | 241 | return true; |
240 | } | 242 | } |