diff options
author | 2018-02-10 19:53:50 -0500 | |
---|---|---|
committer | 2018-02-10 19:53:50 -0500 | |
commit | 93084c9cf80901b160e0eb50b72a8e607289a678 (patch) | |
tree | 0b6c6753bb52f8382110e8ab5d9755f4807f4ee7 /sway | |
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')
-rw-r--r-- | sway/desktop/output.c | 7 | ||||
-rw-r--r-- | sway/ipc-json.c | 4 | ||||
-rw-r--r-- | sway/tree/container.c | 1 | ||||
-rw-r--r-- | sway/tree/layout.c | 5 | ||||
-rw-r--r-- | sway/tree/workspace.c | 20 |
5 files changed, 19 insertions, 18 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 6b6d727a..6bbaf938 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -225,7 +225,12 @@ static void output_frame_notify(struct wl_listener *listener, void *data) { | |||
225 | wlr_output_make_current(wlr_output, &buffer_age); | 225 | wlr_output_make_current(wlr_output, &buffer_age); |
226 | wlr_renderer_begin(server->renderer, wlr_output); | 226 | wlr_renderer_begin(server->renderer, wlr_output); |
227 | 227 | ||
228 | swayc_t *workspace = soutput->swayc->focused; | 228 | struct sway_seat *seat = input_manager_current_seat(input_manager); |
229 | swayc_t *focus = sway_seat_get_focus_inactive(seat, soutput->swayc); | ||
230 | swayc_t *workspace = (focus->type == C_WORKSPACE ? | ||
231 | focus : | ||
232 | swayc_parent_by_type(focus, C_WORKSPACE)); | ||
233 | |||
229 | swayc_descendants_of_type(workspace, C_VIEW, output_frame_view, soutput); | 234 | swayc_descendants_of_type(workspace, C_VIEW, output_frame_view, soutput); |
230 | 235 | ||
231 | // render unmanaged views on top | 236 | // render unmanaged views on top |
diff --git a/sway/ipc-json.c b/sway/ipc-json.c index bab9a201..f0afdc9f 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c | |||
@@ -74,8 +74,8 @@ static void ipc_json_describe_output(swayc_t *container, json_object *object) { | |||
74 | json_object_object_add(object, "refresh", json_object_new_int(wlr_output->refresh)); | 74 | json_object_object_add(object, "refresh", json_object_new_int(wlr_output->refresh)); |
75 | json_object_object_add(object, "transform", | 75 | json_object_object_add(object, "transform", |
76 | json_object_new_string(ipc_json_get_output_transform(wlr_output->transform))); | 76 | json_object_new_string(ipc_json_get_output_transform(wlr_output->transform))); |
77 | json_object_object_add(object, "current_workspace", | 77 | // TODO WLR need to set "current_workspace" to the currently focused |
78 | (container->focused) ? json_object_new_string(container->focused->name) : NULL); | 78 | // workspace in a way that makes sense with multiseat |
79 | } | 79 | } |
80 | 80 | ||
81 | static void ipc_json_describe_workspace(swayc_t *workspace, json_object *object) { | 81 | static void ipc_json_describe_workspace(swayc_t *workspace, json_object *object) { |
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) { | |||
151 | char *ws_name = workspace_next_name(output->name); | 151 | char *ws_name = workspace_next_name(output->name); |
152 | wlr_log(L_DEBUG, "Creating default workspace %s", ws_name); | 152 | wlr_log(L_DEBUG, "Creating default workspace %s", ws_name); |
153 | swayc_t *ws = new_workspace(output, ws_name); | 153 | swayc_t *ws = new_workspace(output, ws_name); |
154 | output->focused = ws; | ||
155 | // Set each seat's focus if not already set | 154 | // Set each seat's focus if not already set |
156 | // TODO FOCUS: this is probably stupid, we shouldn't define focus in two | 155 | // TODO FOCUS: this is probably stupid, we shouldn't define focus in two |
157 | // places. We should probably put the active workspace on the sway_output | 156 | // 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) { | |||
84 | int i = index_child(fixed); | 84 | int i = index_child(fixed); |
85 | list_insert(parent->children, i + 1, active); | 85 | list_insert(parent->children, i + 1, active); |
86 | active->parent = parent; | 86 | active->parent = parent; |
87 | // focus new child | ||
88 | parent->focused = active; | ||
89 | return active->parent; | 87 | return active->parent; |
90 | } | 88 | } |
91 | 89 | ||
@@ -96,9 +94,6 @@ void add_child(swayc_t *parent, swayc_t *child) { | |||
96 | list_add(parent->children, child); | 94 | list_add(parent->children, child); |
97 | child->parent = parent; | 95 | child->parent = parent; |
98 | // set focus for this container | 96 | // set focus for this container |
99 | if (!parent->focused) { | ||
100 | parent->focused = child; | ||
101 | } | ||
102 | /* TODO WLR | 97 | /* TODO WLR |
103 | if (parent->type == C_WORKSPACE && child->type == C_VIEW && (parent->workspace_layout == L_TABBED || parent->workspace_layout == L_STACKED)) { | 98 | if (parent->type == C_WORKSPACE && child->type == C_VIEW && (parent->workspace_layout == L_TABBED || parent->workspace_layout == L_STACKED)) { |
104 | child = new_container(child, parent->workspace_layout); | 99 | 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) { | |||
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 | } |