VTK  9.7.1
vtkWaylandRenderWindowInteractor.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
19 #ifndef vtkWaylandRenderWindowInteractor_h
20 #define vtkWaylandRenderWindowInteractor_h
21 
23 #include "vtkRenderingUIModule.h" // For export macro
24 #include "vtkWaylandHardwareWindow.h" // The hardware window it depends on
25 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
26 
27 // Forward declarations for Wayland and xkbcommon types.
28 struct wl_display;
29 struct wl_registry;
30 struct wl_surface;
31 struct wl_seat;
32 struct wl_pointer;
33 struct wl_keyboard;
34 struct wl_data_device_manager;
35 struct wl_data_device;
36 struct wl_data_offer;
37 struct xkb_context;
38 struct xkb_keymap;
39 struct xkb_state;
40 
41 VTK_ABI_NAMESPACE_BEGIN
42 
43 class vtkWaylandRenderWindowInteractorInternals;
44 
47 {
48 public:
51  void PrintSelf(ostream& os, vtkIndent indent) override;
52 
57  void Initialize() override;
58 
62  void TerminateApp() override;
63 
67  void ProcessEvents() override;
68 
70 
73  void Enable() override;
74  void Disable() override;
76 
77  // These members are accessed by static C-style callbacks and must be public.
78 
79  // Input device objects
80  struct wl_seat* Seat = nullptr;
81  struct wl_pointer* Pointer = nullptr;
82  struct wl_keyboard* Keyboard = nullptr;
83  uint32_t PointerSerial = 0;
84  uint32_t KeyboardSerial = 0;
85 
86  // Keyboard handling via xkbcommon
87  struct xkb_context* XkbContext = nullptr;
88  struct xkb_keymap* XkbKeymap = nullptr;
89  struct xkb_state* XkbState = nullptr;
90 
91 protected:
94 
95  // Wayland connection and window handles, obtained from HardwareWindow
96  struct wl_display* DisplayId = nullptr;
97  struct wl_surface* WindowId = nullptr;
98  struct wl_registry* Registry = nullptr; // Own registry for finding input devices
99 
100  // Drag and drop related (placeholder for future implementation)
101  struct wl_data_device_manager* DataDeviceManager = nullptr;
102  struct wl_data_device* DataDevice = nullptr;
103  struct wl_data_offer* DndDataOffer = nullptr;
104 
105  // Internal state
106  vtkWaylandRenderWindowInteractorInternals* Internal;
107 
109 
112  int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override;
113  int InternalDestroyTimer(int platformTimerId) override;
115 
116  void FireTimers();
117 
121  void StartEventLoop() override;
122 
126  void WaitForEvents();
127 
131  void Finalize();
132 
137  void Render() override;
138 
139  friend class vtkWaylandRenderWindowInteractorInternals;
140 
141 private:
143  void operator=(const vtkWaylandRenderWindowInteractor&) = delete;
144 };
145 
146 VTK_ABI_NAMESPACE_END
147 #endif
virtual void Enable()
Enable/Disable interactions.
virtual int InternalDestroyTimer(int platformTimerId)
Internal methods for creating and destroying timers that must be implemented by subclasses.
virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration)
Internal methods for creating and destroying timers that must be implemented by subclasses.
virtual void Render()
Render the scene.
vtkWaylandRenderWindowInteractorInternals * Internal
virtual void Initialize()
Prepare for handling events and set the Enabled flag to true.
static vtkRenderWindowInteractor * New()
platform-independent render window interaction including picking and frame rate control.
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual void StartEventLoop()
Run the event loop (does not return until TerminateApp is called).
virtual void ProcessEvents()
Process all user-interaction, timer events and return.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void TerminateApp()
This function is called on 'q','e' keypress if exitmethod is not specified and should be overridden b...
#define VTK_MARSHALAUTO
a Wayland event-driven interface for a RenderWindow