Make sure wayland object destructors are called
Always at least call the generated "interface"_destroy method which does destroy the proxy. For not already wrapped classes a small template is introduced to pass a function that is called in the destructor. Fixes: QTBUG-111576 Change-Id: I373463710764958ddea42ef0f7dc010c427b2ce8 Reviewed-by: David Edmundson <davidedmundson@kde.org> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
parent
2d4b077534
commit
c15b219108
@ -18,6 +18,12 @@ QWaylandWlShellIntegration::QWaylandWlShellIntegration() : QWaylandShellIntegrat
|
|||||||
<< "by setting the environment variable QT_WAYLAND_SHELL_INTEGRATION";
|
<< "by setting the environment variable QT_WAYLAND_SHELL_INTEGRATION";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QWaylandWlShellIntegration::~QWaylandWlShellIntegration()
|
||||||
|
{
|
||||||
|
if (object())
|
||||||
|
wl_shell_destroy(object());
|
||||||
|
}
|
||||||
|
|
||||||
QWaylandShellSurface *QWaylandWlShellIntegration::createShellSurface(QWaylandWindow *window)
|
QWaylandShellSurface *QWaylandWlShellIntegration::createShellSurface(QWaylandWindow *window)
|
||||||
{
|
{
|
||||||
return new QWaylandWlShellSurface(get_shell_surface(window->wlSurface()), window);
|
return new QWaylandWlShellSurface(get_shell_surface(window->wlSurface()), window);
|
||||||
|
@ -29,6 +29,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandWlShellIntegration
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QWaylandWlShellIntegration();
|
QWaylandWlShellIntegration();
|
||||||
|
~QWaylandWlShellIntegration();
|
||||||
QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override;
|
QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override;
|
||||||
void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override;
|
void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override;
|
||||||
|
|
||||||
|
@ -43,6 +43,10 @@ QWaylandXdgActivationV1::requestXdgActivationToken(QWaylandDisplay *display,
|
|||||||
return provider;
|
return provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QWaylandXdgActivationTokenV1::~QWaylandXdgActivationTokenV1()
|
||||||
|
{
|
||||||
|
destroy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -33,6 +33,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandXdgActivationTokenV1
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
~QWaylandXdgActivationTokenV1() override;
|
||||||
void xdg_activation_token_v1_done(const QString &token) override { Q_EMIT done(token); }
|
void xdg_activation_token_v1_done(const QString &token) override { Q_EMIT done(token); }
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
|
@ -43,6 +43,8 @@ QWaylandDataDevice::~QWaylandDataDevice()
|
|||||||
{
|
{
|
||||||
if (version() >= WL_DATA_DEVICE_RELEASE_SINCE_VERSION)
|
if (version() >= WL_DATA_DEVICE_RELEASE_SINCE_VERSION)
|
||||||
release();
|
release();
|
||||||
|
else
|
||||||
|
wl_data_device_destroy(object());
|
||||||
}
|
}
|
||||||
|
|
||||||
QWaylandDataOffer *QWaylandDataDevice::selectionOffer() const
|
QWaylandDataOffer *QWaylandDataDevice::selectionOffer() const
|
||||||
|
@ -260,14 +260,14 @@ Q_LOGGING_CATEGORY(lcQpaWayland, "qt.qpa.wayland"); // for general (uncategorize
|
|||||||
|
|
||||||
struct wl_surface *QWaylandDisplay::createSurface(void *handle)
|
struct wl_surface *QWaylandDisplay::createSurface(void *handle)
|
||||||
{
|
{
|
||||||
struct wl_surface *surface = mCompositor.create_surface();
|
struct wl_surface *surface = mGlobals.compositor->create_surface();
|
||||||
wl_surface_set_user_data(surface, handle);
|
wl_surface_set_user_data(surface, handle);
|
||||||
return surface;
|
return surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ::wl_region *QWaylandDisplay::createRegion(const QRegion &qregion)
|
struct ::wl_region *QWaylandDisplay::createRegion(const QRegion &qregion)
|
||||||
{
|
{
|
||||||
struct ::wl_region *region = mCompositor.create_region();
|
struct ::wl_region *region = mGlobals.compositor->create_region();
|
||||||
|
|
||||||
for (const QRect &rect : qregion)
|
for (const QRect &rect : qregion)
|
||||||
wl_region_add(region, rect.x(), rect.y(), rect.width(), rect.height());
|
wl_region_add(region, rect.x(), rect.y(), rect.width(), rect.height());
|
||||||
@ -371,8 +371,12 @@ QWaylandDisplay::~QWaylandDisplay(void)
|
|||||||
if (m_frameEventQueue)
|
if (m_frameEventQueue)
|
||||||
wl_event_queue_destroy(m_frameEventQueue);
|
wl_event_queue_destroy(m_frameEventQueue);
|
||||||
|
|
||||||
|
// Reset the globals manually since they need to be destroyed before the wl_display
|
||||||
mGlobals = {};
|
mGlobals = {};
|
||||||
|
|
||||||
|
if (object())
|
||||||
|
wl_registry_destroy(object());
|
||||||
|
|
||||||
if (mDisplay)
|
if (mDisplay)
|
||||||
wl_display_disconnect(mDisplay);
|
wl_display_disconnect(mDisplay);
|
||||||
}
|
}
|
||||||
@ -425,8 +429,6 @@ void QWaylandDisplay::reconnect()
|
|||||||
QWindowSystemInterface::handleScreenRemoved(screen);
|
QWindowSystemInterface::handleScreenRemoved(screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
// mCompositor
|
|
||||||
mShm.reset();
|
|
||||||
mCursorThemes.clear();
|
mCursorThemes.clear();
|
||||||
mCursor.reset();
|
mCursor.reset();
|
||||||
|
|
||||||
@ -602,6 +604,16 @@ void QWaylandDisplay::handleScreenInitialized(QWaylandScreen *screen)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T, auto f>
|
||||||
|
struct WithDestructor : public T
|
||||||
|
{
|
||||||
|
using T::T;
|
||||||
|
~WithDestructor()
|
||||||
|
{
|
||||||
|
f(this->object());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uint32_t version)
|
void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uint32_t version)
|
||||||
{
|
{
|
||||||
struct ::wl_registry *registry = object();
|
struct ::wl_registry *registry = object();
|
||||||
@ -614,9 +626,11 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
|
|||||||
if (interface == QLatin1String(QtWayland::wl_output::interface()->name)) {
|
if (interface == QLatin1String(QtWayland::wl_output::interface()->name)) {
|
||||||
mWaitingScreens << mWaylandIntegration->createPlatformScreen(this, version, id);
|
mWaitingScreens << mWaylandIntegration->createPlatformScreen(this, version, id);
|
||||||
} else if (interface == QLatin1String(QtWayland::wl_compositor::interface()->name)) {
|
} else if (interface == QLatin1String(QtWayland::wl_compositor::interface()->name)) {
|
||||||
mCompositor.init(registry, id, qMin((int)version, 6));
|
mGlobals.compositor.reset(
|
||||||
|
new WithDestructor<QtWayland::wl_compositor, wl_compositor_destroy>(
|
||||||
|
registry, id, qMin((int)version, 6)));
|
||||||
} else if (interface == QLatin1String(QWaylandShm::interface()->name)) {
|
} else if (interface == QLatin1String(QWaylandShm::interface()->name)) {
|
||||||
mShm.reset(new QWaylandShm(this, version, id));
|
mGlobals.shm.reset(new QWaylandShm(this, version, id));
|
||||||
} else if (interface == QLatin1String(QWaylandInputDevice::interface()->name)) {
|
} else if (interface == QLatin1String(QWaylandInputDevice::interface()->name)) {
|
||||||
QWaylandInputDevice *inputDevice = mWaylandIntegration->createInputDevice(this, version, id);
|
QWaylandInputDevice *inputDevice = mWaylandIntegration->createInputDevice(this, version, id);
|
||||||
mInputDevices.append(inputDevice);
|
mInputDevices.append(inputDevice);
|
||||||
@ -625,9 +639,13 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
|
|||||||
mGlobals.dndSelectionHandler.reset(new QWaylandDataDeviceManager(this, version, id));
|
mGlobals.dndSelectionHandler.reset(new QWaylandDataDeviceManager(this, version, id));
|
||||||
#endif
|
#endif
|
||||||
} else if (interface == QLatin1String(QtWayland::qt_surface_extension::interface()->name)) {
|
} else if (interface == QLatin1String(QtWayland::qt_surface_extension::interface()->name)) {
|
||||||
mGlobals.surfaceExtension.reset(new QtWayland::qt_surface_extension(registry, id, 1));
|
mGlobals.surfaceExtension.reset(
|
||||||
|
new WithDestructor<QtWayland::qt_surface_extension, qt_surface_extension_destroy>(
|
||||||
|
registry, id, 1));
|
||||||
} else if (interface == QLatin1String(QtWayland::wl_subcompositor::interface()->name)) {
|
} else if (interface == QLatin1String(QtWayland::wl_subcompositor::interface()->name)) {
|
||||||
mGlobals.subCompositor.reset(new QtWayland::wl_subcompositor(registry, id, 1));
|
mGlobals.subCompositor.reset(
|
||||||
|
new WithDestructor<QtWayland::wl_subcompositor, wl_subcompositor_destroy>(registry,
|
||||||
|
id, 1));
|
||||||
} else if (interface == QLatin1String(QWaylandTouchExtension::interface()->name)) {
|
} else if (interface == QLatin1String(QWaylandTouchExtension::interface()->name)) {
|
||||||
mGlobals.touchExtension.reset(new QWaylandTouchExtension(this, id));
|
mGlobals.touchExtension.reset(new QWaylandTouchExtension(this, id));
|
||||||
} else if (interface == QLatin1String(QWaylandQtKeyExtension::interface()->name)) {
|
} else if (interface == QLatin1String(QWaylandQtKeyExtension::interface()->name)) {
|
||||||
@ -658,7 +676,8 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
|
|||||||
}
|
}
|
||||||
|
|
||||||
mGlobals.textInputMethodManager.reset(
|
mGlobals.textInputMethodManager.reset(
|
||||||
new QtWayland::qt_text_input_method_manager_v1(registry, id, 1));
|
new WithDestructor<QtWayland::qt_text_input_method_manager_v1,
|
||||||
|
qt_text_input_method_manager_v1_destroy>(registry, id, 1));
|
||||||
for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices))
|
for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices))
|
||||||
inputDevice->setTextInputMethod(new QWaylandTextInputMethod(
|
inputDevice->setTextInputMethod(new QWaylandTextInputMethod(
|
||||||
this,
|
this,
|
||||||
@ -678,7 +697,8 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
|
|||||||
}
|
}
|
||||||
|
|
||||||
mGlobals.textInputManagerv1.reset(
|
mGlobals.textInputManagerv1.reset(
|
||||||
new QtWayland::zwp_text_input_manager_v1(registry, id, 1));
|
new WithDestructor<QtWayland::zwp_text_input_manager_v1,
|
||||||
|
zwp_text_input_manager_v1_destroy>(registry, id, 1));
|
||||||
for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) {
|
for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) {
|
||||||
auto textInput =
|
auto textInput =
|
||||||
new QWaylandTextInputv1(this, mGlobals.textInputManagerv1->create_text_input());
|
new QWaylandTextInputv1(this, mGlobals.textInputManagerv1->create_text_input());
|
||||||
@ -700,7 +720,8 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
|
|||||||
}
|
}
|
||||||
|
|
||||||
mGlobals.textInputManagerv2.reset(
|
mGlobals.textInputManagerv2.reset(
|
||||||
new QtWayland::zwp_text_input_manager_v2(registry, id, 1));
|
new WithDestructor<QtWayland::zwp_text_input_manager_v2,
|
||||||
|
zwp_text_input_manager_v2_destroy>(registry, id, 1));
|
||||||
for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices))
|
for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices))
|
||||||
inputDevice->setTextInput(new QWaylandTextInputv2(
|
inputDevice->setTextInput(new QWaylandTextInputv2(
|
||||||
this, mGlobals.textInputManagerv2->get_text_input(inputDevice->wl_seat())));
|
this, mGlobals.textInputManagerv2->get_text_input(inputDevice->wl_seat())));
|
||||||
@ -715,9 +736,9 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
|
|||||||
for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices))
|
for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices))
|
||||||
inputDevice->setTextInputMethod(nullptr);
|
inputDevice->setTextInputMethod(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
mGlobals.textInputManagerv3.reset(
|
mGlobals.textInputManagerv3.reset(
|
||||||
new QtWayland::zwp_text_input_manager_v3(registry, id, 1));
|
new WithDestructor<QtWayland::zwp_text_input_manager_v3,
|
||||||
|
zwp_text_input_manager_v3_destroy>(registry, id, 1));
|
||||||
for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices))
|
for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices))
|
||||||
inputDevice->setTextInput(new QWaylandTextInputv3(
|
inputDevice->setTextInput(new QWaylandTextInputv3(
|
||||||
this, mGlobals.textInputManagerv3->get_text_input(inputDevice->wl_seat())));
|
this, mGlobals.textInputManagerv3->get_text_input(inputDevice->wl_seat())));
|
||||||
@ -738,16 +759,21 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
|
|||||||
screen->initXdgOutput(xdgOutputManager());
|
screen->initXdgOutput(xdgOutputManager());
|
||||||
} else if (interface == QLatin1String(QtWayland::wp_fractional_scale_manager_v1::interface()->name)) {
|
} else if (interface == QLatin1String(QtWayland::wp_fractional_scale_manager_v1::interface()->name)) {
|
||||||
mGlobals.fractionalScaleManager.reset(
|
mGlobals.fractionalScaleManager.reset(
|
||||||
new QtWayland::wp_fractional_scale_manager_v1(registry, id, 1));
|
new WithDestructor<QtWayland::wp_fractional_scale_manager_v1,
|
||||||
|
wp_fractional_scale_manager_v1_destroy>(registry, id, 1));
|
||||||
} else if (interface == QLatin1String("wp_viewporter")) {
|
} else if (interface == QLatin1String("wp_viewporter")) {
|
||||||
mGlobals.viewporter.reset(new QtWayland::wp_viewporter(registry, id, qMin(1u, version)));
|
mGlobals.viewporter.reset(
|
||||||
|
new WithDestructor<QtWayland::wp_viewporter, wp_viewporter_destroy>(
|
||||||
|
registry, id, qMin(1u, version)));
|
||||||
} else if (interface == QLatin1String(QtWayland::wp_cursor_shape_manager_v1::interface()->name)) {
|
} else if (interface == QLatin1String(QtWayland::wp_cursor_shape_manager_v1::interface()->name)) {
|
||||||
mGlobals.cursorShapeManager.reset(
|
mGlobals.cursorShapeManager.reset(new WithDestructor<QtWayland::wp_cursor_shape_manager_v1,
|
||||||
new QtWayland::wp_cursor_shape_manager_v1(registry, id, std::min(1u, version)));
|
wp_cursor_shape_manager_v1_destroy>(
|
||||||
|
registry, id, std::min(1u, version)));
|
||||||
} else if (
|
} else if (
|
||||||
interface == QLatin1String(QtWayland::qt_toplevel_drag_manager_v1::interface()->name)) {
|
interface == QLatin1String(QtWayland::qt_toplevel_drag_manager_v1::interface()->name)) {
|
||||||
mGlobals.xdgToplevelDragManager.reset(
|
mGlobals.xdgToplevelDragManager.reset(
|
||||||
new QtWayland::qt_toplevel_drag_manager_v1(registry, id, 1));
|
new WithDestructor<QtWayland::qt_toplevel_drag_manager_v1,
|
||||||
|
qt_toplevel_drag_manager_v1_destroy>(registry, id, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
mRegistryGlobals.append(RegistryGlobal(id, interface, version, registry));
|
mRegistryGlobals.append(RegistryGlobal(id, interface, version, registry));
|
||||||
|
@ -128,8 +128,10 @@ public:
|
|||||||
struct wl_display *wl_display() const { return mDisplay; }
|
struct wl_display *wl_display() const { return mDisplay; }
|
||||||
struct ::wl_registry *wl_registry() { return object(); }
|
struct ::wl_registry *wl_registry() { return object(); }
|
||||||
|
|
||||||
const struct wl_compositor *wl_compositor() const { return mCompositor.object(); }
|
QtWayland::wl_compositor *compositor()
|
||||||
QtWayland::wl_compositor *compositor() { return &mCompositor; }
|
{
|
||||||
|
return mGlobals.compositor.get();
|
||||||
|
}
|
||||||
|
|
||||||
QList<QWaylandInputDevice *> inputDevices() const { return mInputDevices; }
|
QList<QWaylandInputDevice *> inputDevices() const { return mInputDevices; }
|
||||||
QWaylandInputDevice *defaultInputDevice() const;
|
QWaylandInputDevice *defaultInputDevice() const;
|
||||||
@ -225,7 +227,10 @@ public:
|
|||||||
void addRegistryListener(RegistryListener listener, void *data);
|
void addRegistryListener(RegistryListener listener, void *data);
|
||||||
void removeListener(RegistryListener listener, void *data);
|
void removeListener(RegistryListener listener, void *data);
|
||||||
|
|
||||||
QWaylandShm *shm() const { return mShm.data(); }
|
QWaylandShm *shm() const
|
||||||
|
{
|
||||||
|
return mGlobals.shm.get();
|
||||||
|
}
|
||||||
|
|
||||||
void forceRoundTrip();
|
void forceRoundTrip();
|
||||||
|
|
||||||
@ -281,8 +286,6 @@ private:
|
|||||||
std::unique_ptr<EventThread> m_eventThread;
|
std::unique_ptr<EventThread> m_eventThread;
|
||||||
wl_event_queue *m_frameEventQueue = nullptr;
|
wl_event_queue *m_frameEventQueue = nullptr;
|
||||||
QScopedPointer<EventThread> m_frameEventQueueThread;
|
QScopedPointer<EventThread> m_frameEventQueueThread;
|
||||||
QtWayland::wl_compositor mCompositor;
|
|
||||||
QScopedPointer<QWaylandShm> mShm;
|
|
||||||
QList<QWaylandScreen *> mWaitingScreens;
|
QList<QWaylandScreen *> mWaitingScreens;
|
||||||
QList<QWaylandScreen *> mScreens;
|
QList<QWaylandScreen *> mScreens;
|
||||||
QPlatformPlaceholderScreen *mPlaceholderScreen = nullptr;
|
QPlatformPlaceholderScreen *mPlaceholderScreen = nullptr;
|
||||||
@ -313,6 +316,8 @@ private:
|
|||||||
|
|
||||||
struct GlobalHolder
|
struct GlobalHolder
|
||||||
{
|
{
|
||||||
|
std::unique_ptr<QtWayland::wl_compositor> compositor;
|
||||||
|
std::unique_ptr<QWaylandShm> shm;
|
||||||
#if QT_CONFIG(wayland_datadevice)
|
#if QT_CONFIG(wayland_datadevice)
|
||||||
std::unique_ptr<QWaylandDataDeviceManager> dndSelectionHandler;
|
std::unique_ptr<QWaylandDataDeviceManager> dndSelectionHandler;
|
||||||
#endif
|
#endif
|
||||||
|
@ -418,8 +418,13 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can't be in header because dtors for scoped pointers aren't known there.
|
QWaylandInputDevice::~QWaylandInputDevice()
|
||||||
QWaylandInputDevice::~QWaylandInputDevice() = default;
|
{
|
||||||
|
if (version() >= WL_SEAT_RELEASE_SINCE_VERSION)
|
||||||
|
release();
|
||||||
|
else
|
||||||
|
wl_seat_destroy(object());
|
||||||
|
}
|
||||||
|
|
||||||
void QWaylandInputDevice::seat_capabilities(uint32_t caps)
|
void QWaylandInputDevice::seat_capabilities(uint32_t caps)
|
||||||
{
|
{
|
||||||
|
@ -25,6 +25,7 @@ QWaylandTextInputMethod::QWaylandTextInputMethod(QWaylandDisplay *display, struc
|
|||||||
|
|
||||||
QWaylandTextInputMethod::~QWaylandTextInputMethod()
|
QWaylandTextInputMethod::~QWaylandTextInputMethod()
|
||||||
{
|
{
|
||||||
|
qt_text_input_method_v1_destroy(object());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandTextInputMethod::text_input_method_v1_visible_changed(int32_t visible)
|
void QWaylandTextInputMethod::text_input_method_v1_visible_changed(int32_t visible)
|
||||||
|
@ -35,8 +35,10 @@ void *QWaylandNativeInterface::nativeResourceForIntegration(const QByteArray &re
|
|||||||
|
|
||||||
if (lowerCaseResource == "display" || lowerCaseResource == "wl_display" || lowerCaseResource == "nativedisplay")
|
if (lowerCaseResource == "display" || lowerCaseResource == "wl_display" || lowerCaseResource == "nativedisplay")
|
||||||
return m_integration->display()->wl_display();
|
return m_integration->display()->wl_display();
|
||||||
if (lowerCaseResource == "compositor")
|
if (lowerCaseResource == "compositor") {
|
||||||
return const_cast<wl_compositor *>(m_integration->display()->wl_compositor());
|
if (auto compositor = m_integration->display()->compositor())
|
||||||
|
return compositor->object();
|
||||||
|
}
|
||||||
if (lowerCaseResource == "server_buffer_integration")
|
if (lowerCaseResource == "server_buffer_integration")
|
||||||
return m_integration->serverBufferIntegration();
|
return m_integration->serverBufferIntegration();
|
||||||
|
|
||||||
@ -76,7 +78,9 @@ wl_display *QtWaylandClient::QWaylandNativeInterface::display() const
|
|||||||
|
|
||||||
wl_compositor *QtWaylandClient::QWaylandNativeInterface::compositor() const
|
wl_compositor *QtWaylandClient::QWaylandNativeInterface::compositor() const
|
||||||
{
|
{
|
||||||
return const_cast<wl_compositor *>(m_integration->display()->wl_compositor());
|
if (auto compositor = m_integration->display()->compositor())
|
||||||
|
return compositor->object();
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_seat *QtWaylandClient::QWaylandNativeInterface::seat() const
|
wl_seat *QtWaylandClient::QWaylandNativeInterface::seat() const
|
||||||
@ -129,8 +133,10 @@ void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourc
|
|||||||
|
|
||||||
if (lowerCaseResource == "display")
|
if (lowerCaseResource == "display")
|
||||||
return m_integration->display()->wl_display();
|
return m_integration->display()->wl_display();
|
||||||
if (lowerCaseResource == "compositor")
|
if (lowerCaseResource == "compositor") {
|
||||||
return const_cast<wl_compositor *>(m_integration->display()->wl_compositor());
|
if (auto compositor = m_integration->display()->compositor())
|
||||||
|
return compositor->object();
|
||||||
|
}
|
||||||
if (lowerCaseResource == "surface") {
|
if (lowerCaseResource == "surface") {
|
||||||
QWaylandWindow *w = static_cast<QWaylandWindow*>(window->handle());
|
QWaylandWindow *w = static_cast<QWaylandWindow*>(window->handle());
|
||||||
return w ? w->wlSurface() : nullptr;
|
return w ? w->wlSurface() : nullptr;
|
||||||
|
@ -14,6 +14,14 @@ QWaylandPointerGestures::QWaylandPointerGestures(QWaylandDisplay *display, uint
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QWaylandPointerGestures::~QWaylandPointerGestures() noexcept
|
||||||
|
{
|
||||||
|
if (version() >= ZWP_POINTER_GESTURES_V1_RELEASE_SINCE_VERSION)
|
||||||
|
release();
|
||||||
|
else
|
||||||
|
zwp_pointer_gestures_v1_destroy(object());
|
||||||
|
}
|
||||||
|
|
||||||
QWaylandPointerGestureSwipe *
|
QWaylandPointerGestureSwipe *
|
||||||
QWaylandPointerGestures::createPointerGestureSwipe(QWaylandInputDevice *device)
|
QWaylandPointerGestures::createPointerGestureSwipe(QWaylandInputDevice *device)
|
||||||
{
|
{
|
||||||
|
@ -36,6 +36,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandPointerGestures : public QtWayland::zwp_poi
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit QWaylandPointerGestures(QWaylandDisplay *display, uint id, uint version);
|
explicit QWaylandPointerGestures(QWaylandDisplay *display, uint id, uint version);
|
||||||
|
~QWaylandPointerGestures();
|
||||||
|
|
||||||
QWaylandPointerGestureSwipe *createPointerGestureSwipe(QWaylandInputDevice *device);
|
QWaylandPointerGestureSwipe *createPointerGestureSwipe(QWaylandInputDevice *device);
|
||||||
QWaylandPointerGesturePinch *createPointerGesturePinch(QWaylandInputDevice *device);
|
QWaylandPointerGesturePinch *createPointerGesturePinch(QWaylandInputDevice *device);
|
||||||
|
@ -20,6 +20,11 @@ QWaylandPrimarySelectionDeviceManagerV1::QWaylandPrimarySelectionDeviceManagerV1
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QWaylandPrimarySelectionDeviceManagerV1::~QWaylandPrimarySelectionDeviceManagerV1()
|
||||||
|
{
|
||||||
|
destroy();
|
||||||
|
}
|
||||||
|
|
||||||
QWaylandPrimarySelectionDeviceV1 *QWaylandPrimarySelectionDeviceManagerV1::createDevice(QWaylandInputDevice *seat)
|
QWaylandPrimarySelectionDeviceV1 *QWaylandPrimarySelectionDeviceManagerV1::createDevice(QWaylandInputDevice *seat)
|
||||||
{
|
{
|
||||||
return new QWaylandPrimarySelectionDeviceV1(this, seat);
|
return new QWaylandPrimarySelectionDeviceV1(this, seat);
|
||||||
|
@ -37,6 +37,7 @@ class QWaylandPrimarySelectionDeviceManagerV1 : public QtWayland::zwp_primary_se
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit QWaylandPrimarySelectionDeviceManagerV1(QWaylandDisplay *display, uint id, uint version);
|
explicit QWaylandPrimarySelectionDeviceManagerV1(QWaylandDisplay *display, uint id, uint version);
|
||||||
|
~QWaylandPrimarySelectionDeviceManagerV1();
|
||||||
QWaylandPrimarySelectionDeviceV1 *createDevice(QWaylandInputDevice *seat);
|
QWaylandPrimarySelectionDeviceV1 *createDevice(QWaylandInputDevice *seat);
|
||||||
QWaylandDisplay *display() const { return m_display; }
|
QWaylandDisplay *display() const { return m_display; }
|
||||||
|
|
||||||
|
@ -15,6 +15,11 @@ QWaylandQtKeyExtension::QWaylandQtKeyExtension(QWaylandDisplay *display, uint32_
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QWaylandQtKeyExtension::~QWaylandQtKeyExtension()
|
||||||
|
{
|
||||||
|
zqt_key_v1_destroy(object());
|
||||||
|
}
|
||||||
|
|
||||||
void QWaylandQtKeyExtension::zqt_key_v1_key(struct wl_surface *surface,
|
void QWaylandQtKeyExtension::zqt_key_v1_key(struct wl_surface *surface,
|
||||||
uint32_t time,
|
uint32_t time,
|
||||||
uint32_t type,
|
uint32_t type,
|
||||||
|
@ -31,6 +31,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandQtKeyExtension : public QtWayland::zqt_key_
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QWaylandQtKeyExtension(QWaylandDisplay *display, uint32_t id);
|
QWaylandQtKeyExtension(QWaylandDisplay *display, uint32_t id);
|
||||||
|
~QWaylandQtKeyExtension();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWaylandDisplay *m_display = nullptr;
|
QWaylandDisplay *m_display = nullptr;
|
||||||
|
@ -22,6 +22,11 @@ QWaylandXdgOutputManagerV1::QWaylandXdgOutputManagerV1(QWaylandDisplay* display,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QWaylandXdgOutputManagerV1::~QWaylandXdgOutputManagerV1()
|
||||||
|
{
|
||||||
|
destroy();
|
||||||
|
}
|
||||||
|
|
||||||
QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id)
|
QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id)
|
||||||
: QtWayland::wl_output(waylandDisplay->wl_registry(), id, qMin(version, 3))
|
: QtWayland::wl_output(waylandDisplay->wl_registry(), id, qMin(version, 3))
|
||||||
, m_outputId(id)
|
, m_outputId(id)
|
||||||
@ -44,8 +49,10 @@ QWaylandScreen::~QWaylandScreen()
|
|||||||
{
|
{
|
||||||
if (zxdg_output_v1::isInitialized())
|
if (zxdg_output_v1::isInitialized())
|
||||||
zxdg_output_v1::destroy();
|
zxdg_output_v1::destroy();
|
||||||
if (wl_output::isInitialized() && wl_output::version() >= WL_OUTPUT_RELEASE_SINCE_VERSION)
|
if (wl_output::version() >= WL_OUTPUT_RELEASE_SINCE_VERSION)
|
||||||
wl_output::release();
|
wl_output::release();
|
||||||
|
else
|
||||||
|
wl_output_destroy(wl_output::object());
|
||||||
}
|
}
|
||||||
|
|
||||||
uint QWaylandScreen::requiredEvents() const
|
uint QWaylandScreen::requiredEvents() const
|
||||||
|
@ -33,6 +33,7 @@ class QWaylandCursor;
|
|||||||
class Q_WAYLANDCLIENT_EXPORT QWaylandXdgOutputManagerV1 : public QtWayland::zxdg_output_manager_v1 {
|
class Q_WAYLANDCLIENT_EXPORT QWaylandXdgOutputManagerV1 : public QtWayland::zxdg_output_manager_v1 {
|
||||||
public:
|
public:
|
||||||
QWaylandXdgOutputManagerV1(QWaylandDisplay *display, uint id, uint version);
|
QWaylandXdgOutputManagerV1(QWaylandDisplay *display, uint id, uint version);
|
||||||
|
~QWaylandXdgOutputManagerV1();
|
||||||
};
|
};
|
||||||
|
|
||||||
class Q_WAYLANDCLIENT_EXPORT QWaylandScreen : public QPlatformScreen,
|
class Q_WAYLANDCLIENT_EXPORT QWaylandScreen : public QPlatformScreen,
|
||||||
|
@ -16,7 +16,7 @@ QWaylandShm::QWaylandShm(QWaylandDisplay *display, int version, uint32_t id)
|
|||||||
|
|
||||||
QWaylandShm::~QWaylandShm()
|
QWaylandShm::~QWaylandShm()
|
||||||
{
|
{
|
||||||
|
wl_shm_destroy(object());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandShm::shm_format(uint32_t format)
|
void QWaylandShm::shm_format(uint32_t format)
|
||||||
|
@ -20,6 +20,11 @@ QWaylandTabletManagerV2::QWaylandTabletManagerV2(QWaylandDisplay *display, uint
|
|||||||
createTabletSeat(seat);
|
createTabletSeat(seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QWaylandTabletManagerV2::~QWaylandTabletManagerV2()
|
||||||
|
{
|
||||||
|
destroy();
|
||||||
|
}
|
||||||
|
|
||||||
QWaylandTabletSeatV2 *QWaylandTabletManagerV2::createTabletSeat(QWaylandInputDevice *seat)
|
QWaylandTabletSeatV2 *QWaylandTabletManagerV2::createTabletSeat(QWaylandInputDevice *seat)
|
||||||
{
|
{
|
||||||
return new QWaylandTabletSeatV2(this, seat);
|
return new QWaylandTabletSeatV2(this, seat);
|
||||||
|
@ -42,6 +42,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandTabletManagerV2 : public QtWayland::zwp_tab
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit QWaylandTabletManagerV2(QWaylandDisplay *display, uint id, uint version);
|
explicit QWaylandTabletManagerV2(QWaylandDisplay *display, uint id, uint version);
|
||||||
|
~QWaylandTabletManagerV2() override;
|
||||||
QWaylandTabletSeatV2 *createTabletSeat(QWaylandInputDevice *seat);
|
QWaylandTabletSeatV2 *createTabletSeat(QWaylandInputDevice *seat);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ QWaylandTextInputv1::~QWaylandTextInputv1()
|
|||||||
{
|
{
|
||||||
if (m_resetCallback)
|
if (m_resetCallback)
|
||||||
wl_callback_destroy(m_resetCallback);
|
wl_callback_destroy(m_resetCallback);
|
||||||
|
zwp_text_input_v1_destroy(object());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandTextInputv1::reset()
|
void QWaylandTextInputv1::reset()
|
||||||
|
@ -23,6 +23,11 @@ QWaylandTouchExtension::QWaylandTouchExtension(QWaylandDisplay *display, uint32_
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QWaylandTouchExtension::~QWaylandTouchExtension()
|
||||||
|
{
|
||||||
|
qt_touch_extension_destroy(object());
|
||||||
|
}
|
||||||
|
|
||||||
void QWaylandTouchExtension::registerDevice(int caps)
|
void QWaylandTouchExtension::registerDevice(int caps)
|
||||||
{
|
{
|
||||||
// TODO number of touchpoints, actual name and ID
|
// TODO number of touchpoints, actual name and ID
|
||||||
|
@ -32,6 +32,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandTouchExtension : public QtWayland::qt_touch
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QWaylandTouchExtension(QWaylandDisplay *display, uint32_t id);
|
QWaylandTouchExtension(QWaylandDisplay *display, uint32_t id);
|
||||||
|
~QWaylandTouchExtension() override;
|
||||||
|
|
||||||
void touchCanceled();
|
void touchCanceled();
|
||||||
|
|
||||||
|
@ -34,7 +34,6 @@ public:
|
|||||||
QWaylandWindowManagerIntegrationPrivate::QWaylandWindowManagerIntegrationPrivate(QWaylandDisplay *waylandDisplay)
|
QWaylandWindowManagerIntegrationPrivate::QWaylandWindowManagerIntegrationPrivate(QWaylandDisplay *waylandDisplay)
|
||||||
: m_waylandDisplay(waylandDisplay)
|
: m_waylandDisplay(waylandDisplay)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QWaylandWindowManagerIntegration::QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay)
|
QWaylandWindowManagerIntegration::QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay)
|
||||||
@ -45,7 +44,8 @@ QWaylandWindowManagerIntegration::QWaylandWindowManagerIntegration(QWaylandDispl
|
|||||||
|
|
||||||
QWaylandWindowManagerIntegration::~QWaylandWindowManagerIntegration()
|
QWaylandWindowManagerIntegration::~QWaylandWindowManagerIntegration()
|
||||||
{
|
{
|
||||||
|
if (object())
|
||||||
|
qt_windowmanager_destroy(object());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QWaylandWindowManagerIntegration::showIsFullScreen() const
|
bool QWaylandWindowManagerIntegration::showIsFullScreen() const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user