106#if QT_CONFIG(xkbcommon)
107 struct xkb_context *xkbContext()
const {
return mXkbContext.get(); }
110 QList<QWaylandScreen *>
screens()
const {
return mScreens; }
117 struct wl_surface *createSurface(
void *
handle);
118 struct ::wl_region *createRegion(
const QRegion &qregion);
127 QWaylandCursor *waylandCursor();
128 QWaylandCursorTheme *loadCursorTheme(
const QString &
name,
int pixelSize);
138 return mGlobals.compositor.get();
141 QList<QWaylandInputDevice *>
inputDevices()
const {
return mInputDevices; }
144#if QT_CONFIG(wayland_datadevice)
147 return mGlobals.dndSelectionHandler.get();
150#if QT_CONFIG(wayland_client_primary_selection)
151 QWaylandPrimarySelectionDeviceManagerV1 *primarySelectionManager()
const
153 return mGlobals.primarySelectionManager.get();
158 return mGlobals.surfaceExtension.get();
160#if QT_CONFIG(tabletevent)
163 return mGlobals.tabletManager.get();
168 return mGlobals.pointerGestures.get();
172 return mGlobals.touchExtension.get();
176 return mGlobals.textInputMethodManager.get();
180 return mGlobals.textInputManagerv1.get();
184 return mGlobals.textInputManagerv2.get();
188 return mGlobals.textInputManagerv3.get();
192 return mGlobals.hardwareIntegration.get();
196 return mGlobals.xdgOutputManager.get();
200 return mGlobals.fractionalScaleManager.get();
204 return mGlobals.viewporter.get();
208 return mGlobals.cursorShapeManager.get();
212 return mGlobals.xdgToplevelDragManager.get();
220 struct ::wl_registry *registry =
nullptr;
222 :
id(id_),
interface(interface_), version(version_), registry(registry_) { }
226 return mRegistryGlobals;
232 void addRegistryListener(RegistryListener listener,
void *
data);
233 void removeListener(RegistryListener listener,
void *
data);
237 return mGlobals.shm.get();
240 void forceRoundTrip();
242 bool supportsWindowDecoration()
const;
257 bool isKeyboardAvailable()
const;
258 bool isWaylandInputContextRequested()
const;
260 void initEventThread();
263 void blockingReadEvents();
264 void flushRequests();
272 void checkWaylandError();
274 void setupConnection();
275 void handleWaylandSync();
276 void requestWaylandSync();
278 void checkTextInputProtocol();
281 Listener() =
default;
282 Listener(RegistryListener incomingListener,
284 : listener(incomingListener),
data(incomingData)
287 void *
data =
nullptr;
289 struct wl_display *mDisplay =
nullptr;
290 std::unique_ptr<EventThread> m_eventThread;
291 wl_event_queue *m_frameEventQueue =
nullptr;
292 QScopedPointer<EventThread> m_frameEventQueueThread;
293 QList<QWaylandScreen *> mWaitingScreens;
294 QList<QWaylandScreen *> mScreens;
296 QList<QWaylandInputDevice *> mInputDevices;
297 QList<Listener> mRegistryListeners;
298 QWaylandIntegration *mWaylandIntegration =
nullptr;
300 struct WaylandCursorTheme {
303 std::unique_ptr<QWaylandCursorTheme> theme;
305 std::vector<WaylandCursorTheme> mCursorThemes;
307 struct FindExistingCursorThemeResult {
308 std::vector<WaylandCursorTheme>::const_iterator
position;
311 QWaylandCursorTheme *theme() const noexcept
312 {
return found ?
position->theme.get() :
nullptr; }
314 FindExistingCursorThemeResult findExistingCursorTheme(
const QString &
name,
315 int pixelSize)
const noexcept;
316 QScopedPointer<QWaylandCursor> mCursor;
321 std::unique_ptr<QtWayland::wl_compositor>
compositor;
322 std::unique_ptr<QWaylandShm> shm;
323#if QT_CONFIG(wayland_datadevice)
324 std::unique_ptr<QWaylandDataDeviceManager> dndSelectionHandler;
326 std::unique_ptr<QtWayland::qt_surface_extension> surfaceExtension;
327 std::unique_ptr<QtWayland::wl_subcompositor> subCompositor;
328 std::unique_ptr<QWaylandTouchExtension> touchExtension;
329 std::unique_ptr<QWaylandQtKeyExtension> qtKeyExtension;
330#if QT_CONFIG(tabletevent)
331 std::unique_ptr<QWaylandTabletManagerV2> tabletManager;
333 std::unique_ptr<QWaylandPointerGestures> pointerGestures;
334#if QT_CONFIG(wayland_client_primary_selection)
335 std::unique_ptr<QWaylandPrimarySelectionDeviceManagerV1> primarySelectionManager;
337 std::unique_ptr<QtWayland::qt_text_input_method_manager_v1> textInputMethodManager;
338 std::unique_ptr<QtWayland::zwp_text_input_manager_v1> textInputManagerv1;
339 std::unique_ptr<QtWayland::zwp_text_input_manager_v2> textInputManagerv2;
340 std::unique_ptr<QtWayland::zwp_text_input_manager_v3> textInputManagerv3;
341 std::unique_ptr<QWaylandHardwareIntegration> hardwareIntegration;
342 std::unique_ptr<QWaylandXdgOutputManagerV1> xdgOutputManager;
343 std::unique_ptr<QtWayland::wp_viewporter> viewporter;
344 std::unique_ptr<QtWayland::wp_fractional_scale_manager_v1> fractionalScaleManager;
345 std::unique_ptr<QtWayland::wp_cursor_shape_manager_v1> cursorShapeManager;
346 std::unique_ptr<QtWayland::xdg_toplevel_drag_manager_v1> xdgToplevelDragManager;
347 std::unique_ptr<QWaylandWindowManagerIntegration> windowManagerIntegration;
350 int mWritableNotificationFd = -1;
351 QList<RegistryGlobal> mRegistryGlobals;
352 uint32_t mLastInputSerial = 0;
353 QWaylandInputDevice *mLastInputDevice =
nullptr;
354 QPointer<QWaylandWindow> mLastInputWindow;
355 QPointer<QWaylandWindow> mLastKeyboardFocus;
356 QList<QWaylandWindow *> mActiveWindows;
357 struct wl_callback *mSyncCallback =
nullptr;
358 static const wl_callback_listener syncCallbackListener;
359 bool mWaylandTryReconnect =
false;
361 bool mWaylandInputContextRequested = [] () {
366 int mTextInputManagerIndex = INT_MAX;
368 void registry_global(uint32_t
id,
const QString &
interface, uint32_t version)
override;
369 void registry_global_remove(uint32_t
id)
override;
371#if QT_CONFIG(xkbcommon)