aboutsummaryrefslogtreecommitdiff
path: root/tinywl
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2023-02-01 20:12:49 +0100
committerSimon Ser <contact@emersion.fr>2023-02-01 20:12:49 +0100
commit711a1a3ed42150fdbc716e80719d482006075f69 (patch)
treecb6715f30608362eac2408a6061e338eba31f657 /tinywl
parent03412e9aaba3f2bedacbeeef53469f13d6b6b277 (diff)
xdg-shell: convert to try_from
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/884
Diffstat (limited to 'tinywl')
-rw-r--r--tinywl/tinywl.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/tinywl/tinywl.c b/tinywl/tinywl.c
index d3ff2d09..45b41877 100644
--- a/tinywl/tinywl.c
+++ b/tinywl/tinywl.c
@@ -119,9 +119,9 @@ 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.
* stop displaying a caret.
*/
- struct wlr_xdg_surface *previous = wlr_xdg_surface_from_wlr_surface(
- seat->keyboard_state.focused_surface);
- assert(previous->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
+ struct wlr_xdg_surface *previous =
+ wlr_xdg_surface_try_from_wlr_surface(seat->keyboard_state.focused_surface);
+ assert(previous != NULL && previous->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
wlr_xdg_toplevel_set_activated(previous->toplevel, false);
}
struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat);
@@ -773,8 +773,9 @@ static void server_new_xdg_surface(struct wl_listener *listener, void *data) {
* we always set the user data field of xdg_surfaces to the corresponding
* scene node. */
if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP) {
- struct wlr_xdg_surface *parent = wlr_xdg_surface_from_wlr_surface(
- xdg_surface->popup->parent);
+ struct wlr_xdg_surface *parent =
+ wlr_xdg_surface_try_from_wlr_surface(xdg_surface->popup->parent);
+ assert(parent != NULL);
struct wlr_scene_tree *parent_tree = parent->data;
xdg_surface->data = wlr_scene_xdg_surface_create(
parent_tree, xdg_surface);