diff options
author | Campbell Barton <campbell@blender.org> | 2022-06-30 15:53:35 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-06-30 16:46:57 +0300 |
commit | 58ccd8338e53423e223085094af2d35c76285c30 (patch) | |
tree | 4356c25db8ba4a80854a672cbddac539235aa976 /intern/ghost/intern/GHOST_WindowWayland.h | |
parent | 7c98632289ead480c3d8d28f47815078a4d4c329 (diff) |
GHOST/Wayland: clarify window access from surfaces
It wasn't obvious when direct access or lookups should be used.
Add class methods for direct lookups as well as searching from known
windows when windows are accessed outside Wayland's handlers.
This avoids having to check if the window has been removed in some cases.
Diffstat (limited to 'intern/ghost/intern/GHOST_WindowWayland.h')
-rw-r--r-- | intern/ghost/intern/GHOST_WindowWayland.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/intern/ghost/intern/GHOST_WindowWayland.h b/intern/ghost/intern/GHOST_WindowWayland.h index b5aeecd6204..1d0693ff1f8 100644 --- a/intern/ghost/intern/GHOST_WindowWayland.h +++ b/intern/ghost/intern/GHOST_WindowWayland.h @@ -105,6 +105,18 @@ class GHOST_WindowWayland : public GHOST_Window { struct wl_surface *surface() const; + /** + * Use window find function when the window may have been closed. + * Typically this is needed when accessing surfaces outside WAYLAND handlers. + */ + static const GHOST_WindowWayland *from_surface_find(const wl_surface *surface); + static GHOST_WindowWayland *from_surface_find_mut(const wl_surface *surface); + /** + * Use direct access when from WAYLAND handlers. + */ + static const GHOST_WindowWayland *from_surface(const wl_surface *surface); + static GHOST_WindowWayland *from_surface_mut(wl_surface *surface); + output_t *output_find_by_wl(struct wl_output *output); const std::vector<output_t *> &outputs(); |