mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 04:45:58 +01:00
tinywl: fix crash when previously focused surface is not a toplevel
It can be e.g. a popup. Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3754
This commit is contained in:
parent
319e4125ab
commit
9e5d0f95f8
1 changed files with 4 additions and 5 deletions
|
@ -120,11 +120,10 @@ static void focus_view(struct tinywl_view *view, struct wlr_surface *surface) {
|
||||||
* it no longer has focus and the client will repaint accordingly, e.g.
|
* it no longer has focus and the client will repaint accordingly, e.g.
|
||||||
* stop displaying a caret.
|
* stop displaying a caret.
|
||||||
*/
|
*/
|
||||||
struct wlr_xdg_surface *previous =
|
struct wlr_xdg_toplevel *prev_toplevel =
|
||||||
wlr_xdg_surface_try_from_wlr_surface(seat->keyboard_state.focused_surface);
|
wlr_xdg_toplevel_try_from_wlr_surface(prev_surface);
|
||||||
assert(previous != NULL && previous->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
|
if (prev_toplevel != NULL) {
|
||||||
if (previous->toplevel != NULL) {
|
wlr_xdg_toplevel_set_activated(prev_toplevel, false);
|
||||||
wlr_xdg_toplevel_set_activated(previous->toplevel, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat);
|
struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat);
|
||||||
|
|
Loading…
Reference in a new issue