diff --git a/include/focus.h b/include/focus.h index 4fbfcd9..94743fa 100644 --- a/include/focus.h +++ b/include/focus.h @@ -6,7 +6,5 @@ void focus_toplevel(struct absinthe_toplevel *toplevel); struct absinthe_toplevel *focus_get_topmost(struct absinthe_server *server); -void focus_after_unmap(struct absinthe_toplevel *toplevel); - -void focus_next(struct absinthe_server *server, bool tiled); -void focus_prev(struct absinthe_server *server, bool tiled); +void focus_next(struct absinthe_server *server); +void focus_prev(struct absinthe_server *server); diff --git a/src/absinthe-toplevel-handlers.c b/src/absinthe-toplevel-handlers.c index 95d3ffb..874f53f 100644 --- a/src/absinthe-toplevel-handlers.c +++ b/src/absinthe-toplevel-handlers.c @@ -67,13 +67,11 @@ void absinthe_toplevel_unmap(struct wl_listener *listener, void *data) toplevel->server->seat->keyboard_state.focused_surface = NULL; } - if (toplevel->output == toplevel->server->focused_output && toplevel->tiled) - focus_after_unmap(toplevel); - wl_list_remove(&toplevel->link); wl_list_remove(&toplevel->flink); layout_arrange(toplevel->output); + focus_toplevel(focus_get_topmost(toplevel->server)); wlr_scene_node_destroy(&toplevel->scene_tree->node); } diff --git a/src/focus.c b/src/focus.c index 88d6e0d..5b16b3e 100644 --- a/src/focus.c +++ b/src/focus.c @@ -63,23 +63,7 @@ struct absinthe_toplevel *focus_get_topmost(struct absinthe_server *server) return NULL; } -void focus_after_unmap(struct absinthe_toplevel *toplevel) -{ - struct absinthe_toplevel *temp; - size_t i = 0; - wl_list_for_each(temp, &toplevel->server->toplevels, link) - { - if (toplevel == temp && i == 0) { - focus_next(toplevel->server, true); - return; - } - ++i; - } - - focus_prev(toplevel->server, true); -} - -void focus_next(struct absinthe_server *server, bool tiled) +void focus_next(struct absinthe_server *server) { struct absinthe_toplevel *toplevel = focus_get_topmost(server); if (!toplevel) @@ -90,18 +74,12 @@ void focus_next(struct absinthe_server *server, bool tiled) { if (&next->link == &toplevel->server->toplevels) continue; - if (tiled && !next->tiled) - continue; break; } - if (tiled && !next->tiled) { - wlr_log(WLR_ERROR, "No tiled"); - return; - } focus_toplevel(next); } -void focus_prev(struct absinthe_server *server, bool tiled) +void focus_prev(struct absinthe_server *server) { struct absinthe_toplevel *toplevel = focus_get_topmost(server); if (!toplevel) @@ -112,13 +90,7 @@ void focus_prev(struct absinthe_server *server, bool tiled) { if (&prev->link == &toplevel->server->toplevels) continue; - if (tiled && !prev->tiled) - continue; break; } - if (tiled && !prev->tiled) { - wlr_log(WLR_ERROR, "No tiled"); - return; - } focus_toplevel(prev); } diff --git a/src/keyboard.c b/src/keyboard.c index 0601461..2e9eaad 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -39,10 +39,10 @@ static bool keyboard_handle_keybind(struct absinthe_server *server, xkb_keysym_t !server->focused_toplevel->fullscreen); break; case XKB_KEY_j: - focus_next(server, false); + focus_next(server); break; case XKB_KEY_k: - focus_prev(server, false); + focus_prev(server); break; case XKB_KEY_h: if (server->focused_output && server->focused_output->main_stack_width > 0.15) {