(Un)focus logic improvements

This commit is contained in:
tiosgz 2022-05-08 10:02:25 +00:00
parent 68dcc824bb
commit 57f5961189
2 changed files with 12 additions and 9 deletions

View file

@ -111,6 +111,13 @@ view_set_hidden(struct kiwmi_view *view, bool hidden)
wlr_scene_node_set_enabled(&view->desktop_surface.tree->node, !hidden); wlr_scene_node_set_enabled(&view->desktop_surface.tree->node, !hidden);
wlr_scene_node_set_enabled( wlr_scene_node_set_enabled(
&view->desktop_surface.popups_tree->node, !hidden); &view->desktop_surface.popups_tree->node, !hidden);
struct kiwmi_server *server =
wl_container_of(view->desktop, server, desktop);
struct kiwmi_seat *seat = server->input.seat;
if (seat->focused_view == view) {
seat->focused_view = NULL;
}
} }
struct kiwmi_view * struct kiwmi_view *

View file

@ -51,6 +51,11 @@ xdg_surface_unmap_notify(struct wl_listener *listener, void *UNUSED(data))
struct kiwmi_server *server = struct kiwmi_server *server =
wl_container_of(view->desktop, server, desktop); wl_container_of(view->desktop, server, desktop);
cursor_refresh_focus(server->input.cursor, NULL, NULL, NULL); cursor_refresh_focus(server->input.cursor, NULL, NULL, NULL);
struct kiwmi_seat *seat = server->input.seat;
if (seat->focused_view == view) {
seat->focused_view = NULL;
}
} }
wl_signal_emit(&view->events.unmap, view); wl_signal_emit(&view->events.unmap, view);
@ -81,15 +86,6 @@ xdg_surface_destroy_notify(struct wl_listener *listener, void *UNUSED(data))
wlr_scene_node_destroy(&view->desktop_surface.tree->node); wlr_scene_node_destroy(&view->desktop_surface.tree->node);
wlr_scene_node_destroy(&view->desktop_surface.popups_tree->node); wlr_scene_node_destroy(&view->desktop_surface.popups_tree->node);
struct kiwmi_desktop *desktop = view->desktop;
struct kiwmi_server *server = wl_container_of(desktop, server, desktop);
struct kiwmi_seat *seat = server->input.seat;
if (seat->focused_view == view) {
seat->focused_view = NULL;
}
cursor_refresh_focus(server->input.cursor, NULL, NULL, NULL);
if (view->decoration) { if (view->decoration) {
view->decoration->view = NULL; view->decoration->view = NULL;
} }