VTK  9.6.20260201
vtkWaylandHardwareWindow.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
3
15
16#ifndef vtkWaylandHardwareWindow_h
17#define vtkWaylandHardwareWindow_h
18
19#include "vtkHardwareWindow.h"
20#include "vtkRenderingUIModule.h" // For export macro
21
22// Forward declarations for Wayland types to keep the header clean.
23// The actual headers will be included in the .cxx file.
24struct wl_array;
25struct wl_callback;
26struct wl_display;
27struct wl_compositor;
28struct wl_surface;
29struct wl_registry;
30struct wl_seat;
31struct wl_pointer;
32struct wl_shm;
33struct xdg_wm_base;
34struct xdg_surface;
35struct xdg_toplevel;
36struct zxdg_decoration_manager_v1;
37
38VTK_ABI_NAMESPACE_BEGIN
39
40class VTKRENDERINGUI_EXPORT vtkWaylandHardwareWindow : public vtkHardwareWindow
41{
42public:
45 void PrintSelf(ostream& os, vtkIndent indent) override;
46
50 wl_display* GetDisplayId();
51
55 wl_surface* GetWindowId();
56
57 // vtkHardwareWindow overrides
58 void Create() override;
59 void Destroy() override;
60
61 void* GetGenericDisplayId() override;
62 void* GetGenericWindowId() override;
63
65
70 void SetSize(int, int) override;
73
75
79 void SetPosition(int, int) override;
82
86 void SetWindowName(const char*) override;
87
93 void HideCursor() override;
94 void ShowCursor() override;
95
100 void SetCurrentCursor(int) override;
101
102 // Listener callbacks for Wayland events
104 void* data, wl_registry* registry, uint32_t name, const char* interface, uint32_t version);
105 static void RegistryHandleGlobalRemove(void* data, wl_registry* registry, uint32_t name);
106
107 static void XdgWmBaseHandlePing(void* data, xdg_wm_base* xdg_wm_base, uint32_t serial);
108
109 static void XdgSurfaceHandleConfigure(void* data, xdg_surface* xdg_surface, uint32_t serial);
110
112 void* data, xdg_toplevel* xdg_toplevel, int32_t width, int32_t height, wl_array* states);
113 static void XdgToplevelHandleClose(void* data, xdg_toplevel* xdg_toplevel);
114
115 static void FrameHandleDone(void* data, wl_callback* callback, uint32_t time);
116
117 // Request a redraw for the next frame.
119
120protected:
123
124 // Wayland-specific members
125 wl_display* DisplayId = nullptr;
126 wl_registry* Registry = nullptr;
127 wl_compositor* Compositor = nullptr;
128 wl_surface* Surface = nullptr;
129 wl_shm* Shm = nullptr;
130 wl_seat* Seat = nullptr;
131 wl_pointer* Pointer = nullptr;
132 xdg_wm_base* XdgWmBase = nullptr;
133 xdg_surface* XdgSurface = nullptr;
134 xdg_toplevel* XdgToplevel = nullptr;
135 zxdg_decoration_manager_v1* DecorationManager = nullptr;
136
137 bool OwnDisplay = false;
138 bool CursorHidden = false;
139
140 wl_callback* FrameCallback = nullptr;
141 bool RedrawPending = false;
142
143private:
145 void operator=(const vtkWaylandHardwareWindow&) = delete;
146
147 // Internal state to track window configuration
148 bool IsConfigured = false;
149};
150
151VTK_ABI_NAMESPACE_END
152#endif // vtkWaylandHardwareWindow_h
a simple class to control print indentation
Definition vtkIndent.h:108
~vtkWaylandHardwareWindow() override
void Destroy() override
static void RegistryHandleGlobalRemove(void *data, wl_registry *registry, uint32_t name)
void ShowCursor() override
Hide or Show the mouse cursor, it is nice to be able to hide the default cursor if you want VTK to di...
static void XdgWmBaseHandlePing(void *data, xdg_wm_base *xdg_wm_base, uint32_t serial)
static vtkWaylandHardwareWindow * New()
wl_display * GetDisplayId()
Get the Wayland display.
void SetSize(int, int) override
Set the size of the window in pixels.
static void XdgSurfaceHandleConfigure(void *data, xdg_surface *xdg_surface, uint32_t serial)
void SetCurrentCursor(int) override
Change the shape of the cursor.
void Create() override
void * GetGenericWindowId() override
These are window system independent methods that are used to help interface vtkWindow to native windo...
static void XdgToplevelHandleConfigure(void *data, xdg_toplevel *xdg_toplevel, int32_t width, int32_t height, wl_array *states)
static void RegistryHandleGlobal(void *data, wl_registry *registry, uint32_t name, const char *interface, uint32_t version)
static void FrameHandleDone(void *data, wl_callback *callback, uint32_t time)
void * GetGenericDisplayId() override
These are window system independent methods that are used to help interface vtkWindow to native windo...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static void XdgToplevelHandleClose(void *data, xdg_toplevel *xdg_toplevel)
void SetPosition(int, int) override
Set the position of the window.
void SetWindowName(const char *) override
Set the name of the window (the title).
void HideCursor() override
Hide or Show the mouse cursor.
wl_surface * GetWindowId()
Get the Wayland surface.
zxdg_decoration_manager_v1 * DecorationManager
virtual void SetPosition(int x, int y)
Set the position (x and y) of the rendering window in screen coordinates (in pixels).
virtual void SetSize(int width, int height)
Set the size (width and height) of the rendering window in screen coordinates (in pixels).