diff --git a/framebuffers/qt/CMakeLists.txt b/framebuffers/qt/CMakeLists.txt index 215e5a2c..89923798 100644 --- a/framebuffers/qt/CMakeLists.txt +++ b/framebuffers/qt/CMakeLists.txt @@ -24,6 +24,7 @@ target_link_libraries (krfb_framebuffer_qt Qt5::Core Qt5::Gui KF5::CoreAddons + Qt::GuiPrivate krfbprivate ) diff --git a/framebuffers/qt/qtframebuffer.cpp b/framebuffers/qt/qtframebuffer.cpp index 514d1fff..f3f0d0b0 100644 --- a/framebuffers/qt/qtframebuffer.cpp +++ b/framebuffers/qt/qtframebuffer.cpp @@ -14,18 +14,19 @@ #include #include #include -#include #include - +#include const int UPDATE_TIME = 500; QtFrameBuffer::QtFrameBuffer(QObject *parent) : FrameBuffer(parent) { - win = QApplication::desktop()->winId(); QScreen *screen = QGuiApplication::primaryScreen(); + QPlatformNativeInterface* native = qApp->platformNativeInterface(); + if (screen) { + win = reinterpret_cast(native->nativeResourceForScreen(QByteArrayLiteral("rootwindow"), screen)); primaryScreen = screen; fbImage = screen->grabWindow(win).toImage(); fb = new char[fbImage.sizeInBytes()]; diff --git a/framebuffers/xcb/CMakeLists.txt b/framebuffers/xcb/CMakeLists.txt index e29a148e..4e297ac9 100644 --- a/framebuffers/xcb/CMakeLists.txt +++ b/framebuffers/xcb/CMakeLists.txt @@ -20,6 +20,7 @@ add_library(krfb_framebuffer_xcb MODULE ${krfb_framebuffer_xcb_SRCS}) target_link_libraries (krfb_framebuffer_xcb Qt5::Core Qt5::Gui + Qt::GuiPrivate XCB::XCB XCB::RENDER XCB::SHAPE diff --git a/framebuffers/xcb/xcb_framebuffer.cpp b/framebuffers/xcb/xcb_framebuffer.cpp index 1f793a35..fb7a61cd 100644 --- a/framebuffers/xcb/xcb_framebuffer.cpp +++ b/framebuffers/xcb/xcb_framebuffer.cpp @@ -20,10 +20,10 @@ #include #include -#include #include #include #include +#include class KrfbXCBEventFilter: public QAbstractNativeEventFilter @@ -159,12 +159,13 @@ XCBFrameBuffer::XCBFrameBuffer(QObject *parent): d->area.setRect(0, 0, 0, 0); d->x11EvtFilter = new KrfbXCBEventFilter(this); d->rootScreen = get_xcb_screen(QX11Info::connection(), QX11Info::appScreen()); - d->win = QApplication::desktop()->winId(); this->fb = nullptr; QScreen *primaryScreen = QGuiApplication::primaryScreen(); if (primaryScreen) { + QPlatformNativeInterface* native = qApp->platformNativeInterface(); + d->win = reinterpret_cast(native->nativeResourceForScreen(QByteArrayLiteral("rootwindow"), primaryScreen)); qreal scaleFactor = primaryScreen->devicePixelRatio(); d->area = { primaryScreen->geometry().topLeft() * scaleFactor, primaryScreen->geometry().bottomRight() * scaleFactor };