Skip to content

Commit 1e45a7d

Browse files
committed
Don't re-fetch the previously focused surface in focus_view
1 parent 372987e commit 1e45a7d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/server.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,17 @@
3535
#include "wlr-wrap-end.hpp"
3636

3737
void Server::focus_view(std::shared_ptr<View>&& view, wlr_surface* surface) {
38-
const wlr_surface* prev_surface = seat->wlr->keyboard_state.focused_surface;
38+
wlr_surface* prev_surface = seat->wlr->keyboard_state.focused_surface;
3939
if (prev_surface == surface && surface != nullptr) {
4040
/* Don't re-focus an already focused surface. */
4141
return;
4242
}
4343

4444
if (prev_surface != nullptr) {
45-
wlr_surface* previous = seat->wlr->keyboard_state.focused_surface;
46-
47-
if (const auto* xdg_previous = wlr_xdg_surface_try_from_wlr_surface(previous)) {
45+
if (const auto* xdg_previous = wlr_xdg_surface_try_from_wlr_surface(prev_surface)) {
4846
assert(xdg_previous->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
4947
wlr_xdg_toplevel_set_activated(xdg_previous->toplevel, false);
50-
} else if (auto* xwayland_previous = wlr_xwayland_surface_try_from_wlr_surface(previous)) {
48+
} else if (auto* xwayland_previous = wlr_xwayland_surface_try_from_wlr_surface(prev_surface)) {
5149
wlr_xwayland_surface_activate(xwayland_previous, false);
5250
}
5351
}

0 commit comments

Comments
 (0)