Commit 8382a78f authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Avoid creating unneeded KWayland::Surface

We obtain a wl_surface from Qt, create a KWayland::Surface from that only to then obtain the raw wl_surface from it

Skip the intermediate step
parent 28e7a115
Pipeline #180307 passed with stage
in 2 minutes and 5 seconds
......@@ -17,6 +17,7 @@
#include <KWayland/Client/seat.h>
#include <KWayland/Client/surface.h>
#include <QGuiApplication>
#include <QPixmap>
#include <QPoint>
#include <QString>
......@@ -24,6 +25,7 @@
#include <private/qwaylanddisplay_p.h>
#include <private/qwaylandinputdevice_p.h>
#include <private/qwaylandwindow_p.h>
#include <qpa/qplatformnativeinterface.h>
using namespace KWayland::Client;
......@@ -55,8 +57,16 @@ void WindowSystem::forceActiveWindow(WId win, long int time)
void WindowSystem::requestToken(QWindow *window, uint32_t serial, const QString &app_id)
{
Surface *surface = Surface::fromWindow(window);
wl_surface *wlSurface = surface ? static_cast<wl_surface *>(*surface) : nullptr;
QPlatformNativeInterface *native = qGuiApp->platformNativeInterface();
if (!native) {
return;
}
window->create();
wl_surface *wlSurface = reinterpret_cast<wl_surface *>(native->nativeResourceForWindow(QByteArrayLiteral("surface"), window));
if (!wlSurface) {
return;
}
WaylandXdgActivationV1 *activation = WaylandIntegration::self()->activation();
if (!activation) {
// Ensure that xdgActivationTokenArrived is always emitted asynchronously
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment