Chase wlroots: convert to try_from

Chases: 711a1a3ed42150fdbc716e80719d482006075f69
xdg-shell: convert to try_from

Chases: f9bd416d4156942ce3951a6c5cf9f81a3cf4a3dd
layer-shell-v1: convert to try_from

Chases: fbf5982e3838ee28b5345e98832f6956c402b225
xwayland/xwm: introduce wlr_xwayland_surface_try_from_wlr_surface()
This commit is contained in:
John Lindgren 2023-02-03 14:53:26 -05:00 committed by Johan Malm
parent d0b24f73d7
commit b5220a723e
9 changed files with 27 additions and 33 deletions

View file

@ -34,20 +34,16 @@ view_from_wlr_surface(struct wlr_surface *surface)
* - find a way to get rid of xdg/xwayland-specific stuff
* - look up root/toplevel surface if passed a subsurface?
*/
if (wlr_surface_is_xdg_surface(surface)) {
struct wlr_xdg_surface *xdg_surface =
wlr_xdg_surface_from_wlr_surface(surface);
if (xdg_surface) {
return xdg_surface->data;
}
struct wlr_xdg_surface *xdg_surface =
wlr_xdg_surface_try_from_wlr_surface(surface);
if (xdg_surface) {
return xdg_surface->data;
}
#if HAVE_XWAYLAND
if (wlr_surface_is_xwayland_surface(surface)) {
struct wlr_xwayland_surface *xsurface =
wlr_xwayland_surface_from_wlr_surface(surface);
if (xsurface) {
return xsurface->data;
}
struct wlr_xwayland_surface *xsurface =
wlr_xwayland_surface_try_from_wlr_surface(surface);
if (xsurface) {
return xsurface->data;
}
#endif
return NULL;