VTK  9.6.20260516
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#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
22
23// Forward declarations for Wayland types to keep the header clean.
24// The actual headers will be included in the .cxx file.
25struct wl_array;
26struct wl_callback;
27struct wl_display;
28struct wl_compositor;
29struct wl_surface;
30struct wl_registry;
31struct wl_seat;
32struct wl_pointer;
33struct wl_shm;
34struct xdg_wm_base;
35struct xdg_surface;
36struct xdg_toplevel;
37struct zxdg_decoration_manager_v1;
38
39VTK_ABI_NAMESPACE_BEGIN
40
42{
43public:
46 void PrintSelf(ostream& os, vtkIndent indent) override;
47
51 wl_display* GetDisplayId();
52
56 wl_surface* GetWindowId();
57
58 // vtkHardwareWindow overrides
59 void Create() override;
60 void Destroy() override;
61
62 void* GetGenericDisplayId() override;
63 void* GetGenericWindowId() override;
64
66
71 void SetSize(int, int) override;
74
76
80 void SetPosition(int, int) override;
83
87 void SetWindowName(const char*) override;
88
94 void HideCursor() override;
95 void ShowCursor() override;
96
101 void SetCurrentCursor(int) override;
102
103 // Listener callbacks for Wayland events
105 void* data, wl_registry* registry, uint32_t name, const char* interface, uint32_t version);
106 static void RegistryHandleGlobalRemove(void* data, wl_registry* registry, uint32_t name);
107
108 static void XdgWmBaseHandlePing(void* data, xdg_wm_base* xdg_wm_base, uint32_t serial);
109
110 static void XdgSurfaceHandleConfigure(void* data, xdg_surface* xdg_surface, uint32_t serial);
111
113 void* data, xdg_toplevel* xdg_toplevel, int32_t width, int32_t height, wl_array* states);
114 static void XdgToplevelHandleClose(void* data, xdg_toplevel* xdg_toplevel);
115
116 static void FrameHandleDone(void* data, wl_callback* callback, uint32_t time);
117
118 // Request a redraw for the next frame.
120
121protected:
124
125 // Wayland-specific members
126 wl_display* DisplayId = nullptr;
127 wl_registry* Registry = nullptr;
128 wl_compositor* Compositor = nullptr;
129 wl_surface* Surface = nullptr;
130 wl_shm* Shm = nullptr;
131 wl_seat* Seat = nullptr;
132 wl_pointer* Pointer = nullptr;
133 xdg_wm_base* XdgWmBase = nullptr;
134 xdg_surface* XdgSurface = nullptr;
135 xdg_toplevel* XdgToplevel = nullptr;
136 zxdg_decoration_manager_v1* DecorationManager = nullptr;
137
138 bool OwnDisplay = false;
139 bool CursorHidden = false;
140
141 wl_callback* FrameCallback = nullptr;
142 bool RedrawPending = false;
143
144private:
146 void operator=(const vtkWaylandHardwareWindow&) = delete;
147
148 // Internal state to track window configuration
149 bool IsConfigured = false;
150};
151
152VTK_ABI_NAMESPACE_END
153#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).
#define VTK_MARSHALAUTO