diff options
author | Simon Ser <contact@emersion.fr> | 2023-02-01 20:24:40 +0100 |
---|---|---|
committer | Kirill Primak <vyivel@eclair.cafe> | 2023-02-02 14:53:15 +0300 |
commit | 9959e6b8dc9b7fbfcccd516e38bc50681f38e275 (patch) | |
tree | 8a59226530bc87f2299ee9934f99618ab089af81 /sway/tree/view.c | |
parent | root: free non_desktop_outputs list on root_destroy (diff) | |
download | sway-9959e6b8dc9b7fbfcccd516e38bc50681f38e275.tar.gz sway-9959e6b8dc9b7fbfcccd516e38bc50681f38e275.tar.zst sway-9959e6b8dc9b7fbfcccd516e38bc50681f38e275.zip |
Convert to *_try_from_wlr_surface()
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3991
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r-- | sway/tree/view.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c index db902562..ec0ad4af 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -951,7 +951,7 @@ static void subsurface_get_view_coords(struct sway_view_child *child, | |||
951 | *sx = *sy = 0; | 951 | *sx = *sy = 0; |
952 | } | 952 | } |
953 | struct wlr_subsurface *subsurface = | 953 | struct wlr_subsurface *subsurface = |
954 | wlr_subsurface_from_wlr_surface(surface); | 954 | wlr_subsurface_try_from_wlr_surface(surface); |
955 | *sx += subsurface->current.x; | 955 | *sx += subsurface->current.x; |
956 | *sy += subsurface->current.y; | 956 | *sy += subsurface->current.y; |
957 | } | 957 | } |
@@ -1187,12 +1187,8 @@ void view_child_destroy(struct sway_view_child *child) { | |||
1187 | } | 1187 | } |
1188 | 1188 | ||
1189 | struct sway_view *view_from_wlr_surface(struct wlr_surface *wlr_surface) { | 1189 | struct sway_view *view_from_wlr_surface(struct wlr_surface *wlr_surface) { |
1190 | if (wlr_surface_is_xdg_surface(wlr_surface)) { | 1190 | struct wlr_xdg_surface *xdg_surface; |
1191 | struct wlr_xdg_surface *xdg_surface = | 1191 | if ((xdg_surface = wlr_xdg_surface_try_from_wlr_surface(wlr_surface))) { |
1192 | wlr_xdg_surface_from_wlr_surface(wlr_surface); | ||
1193 | if (xdg_surface == NULL) { | ||
1194 | return NULL; | ||
1195 | } | ||
1196 | return view_from_wlr_xdg_surface(xdg_surface); | 1192 | return view_from_wlr_xdg_surface(xdg_surface); |
1197 | } | 1193 | } |
1198 | #if HAVE_XWAYLAND | 1194 | #if HAVE_XWAYLAND |
@@ -1201,15 +1197,11 @@ struct sway_view *view_from_wlr_surface(struct wlr_surface *wlr_surface) { | |||
1201 | return view_from_wlr_xwayland_surface(xsurface); | 1197 | return view_from_wlr_xwayland_surface(xsurface); |
1202 | } | 1198 | } |
1203 | #endif | 1199 | #endif |
1204 | if (wlr_surface_is_subsurface(wlr_surface)) { | 1200 | struct wlr_subsurface *subsurface; |
1205 | struct wlr_subsurface *subsurface = | 1201 | if ((subsurface = wlr_subsurface_try_from_wlr_surface(wlr_surface))) { |
1206 | wlr_subsurface_from_wlr_surface(wlr_surface); | ||
1207 | if (subsurface == NULL) { | ||
1208 | return NULL; | ||
1209 | } | ||
1210 | return view_from_wlr_surface(subsurface->parent); | 1202 | return view_from_wlr_surface(subsurface->parent); |
1211 | } | 1203 | } |
1212 | if (wlr_surface_is_layer_surface(wlr_surface)) { | 1204 | if (wlr_layer_surface_v1_try_from_wlr_surface(wlr_surface) != NULL) { |
1213 | return NULL; | 1205 | return NULL; |
1214 | } | 1206 | } |
1215 | 1207 | ||