aboutsummaryrefslogtreecommitdiff
path: root/sway/tree
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2018-02-10 19:53:50 -0500
committerTony Crisci <tony@dubstepdish.com>2018-02-10 19:53:50 -0500
commit93084c9cf80901b160e0eb50b72a8e607289a678 (patch)
tree0b6c6753bb52f8382110e8ab5d9755f4807f4ee7 /sway/tree
parentce3a1b3922850124c562e56ea9a783b090e969b9 (diff)
remove old focus member
Diffstat (limited to 'sway/tree')
-rw-r--r--sway/tree/container.c1
-rw-r--r--sway/tree/layout.c5
-rw-r--r--sway/tree/workspace.c20
3 files changed, 11 insertions, 15 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index ebf9f98e..d1fb7a79 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -151,7 +151,6 @@ swayc_t *new_output(struct sway_output *sway_output) {
char *ws_name = workspace_next_name(output->name);
wlr_log(L_DEBUG, "Creating default workspace %s", ws_name);
swayc_t *ws = new_workspace(output, ws_name);
- output->focused = ws;
// Set each seat's focus if not already set
// TODO FOCUS: this is probably stupid, we shouldn't define focus in two
// places. We should probably put the active workspace on the sway_output
diff --git a/sway/tree/layout.c b/sway/tree/layout.c
index 16d5cbc5..3651d279 100644
--- a/sway/tree/layout.c
+++ b/sway/tree/layout.c
@@ -84,8 +84,6 @@ swayc_t *add_sibling(swayc_t *fixed, swayc_t *active) {
int i = index_child(fixed);
list_insert(parent->children, i + 1, active);
active->parent = parent;
- // focus new child
- parent->focused = active;
return active->parent;
}
@@ -96,9 +94,6 @@ void add_child(swayc_t *parent, swayc_t *child) {
list_add(parent->children, child);
child->parent = parent;
// set focus for this container
- if (!parent->focused) {
- parent->focused = child;
- }
/* TODO WLR
if (parent->type == C_WORKSPACE && child->type == C_VIEW && (parent->workspace_layout == L_TABBED || parent->workspace_layout == L_STACKED)) {
child = new_container(child, parent->workspace_layout);
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) {
return NULL;
}
+ struct sway_seat *seat = input_manager_current_seat(input_manager);
+ swayc_t *focus = sway_seat_get_focus_inactive(seat, output);
+ swayc_t *workspace = (focus->type == C_WORKSPACE ?
+ focus :
+ swayc_parent_by_type(focus, C_WORKSPACE));
+
int i;
for (i = 0; i < output->children->length; i++) {
- if (output->children->items[i] == output->focused) {
+ if (output->children->items[i] == workspace) {
return output->children->items[
wrap(i + (next ? 1 : -1), output->children->length)];
}
@@ -225,16 +231,12 @@ bool workspace_switch(swayc_t *workspace) {
// TODO: Deal with sticky containers
wlr_log(L_DEBUG, "Switching to workspace %p:%s", workspace, workspace->name);
- // TODO FOCUS: Focus the last view this seat had focused on this workspace
- if (workspace->children->length) {
- // TODO FOCUS: This is really fucking stupid
- sway_seat_set_focus(seat, workspace->children->items[0]);
- } else {
- sway_seat_set_focus(seat, workspace);
+ swayc_t *next = sway_seat_get_focus_inactive(seat, workspace);
+ if (next == NULL) {
+ next = workspace;
}
+ sway_seat_set_focus(seat, next);
swayc_t *output = swayc_parent_by_type(workspace, C_OUTPUT);
- // TODO FOCUS: take a look at this
- output->focused = workspace;
arrange_windows(output, -1, -1);
return true;
}