From 04494dfeb0093ab0ffef6d4d1cbe0283dbd3ee9f Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Thu, 4 Aug 2022 11:57:55 +0200 Subject: [PATCH] Fix broken WId refactoring Actually remove the WId member from the abtract framebuffer class and use the member in xcbframebuffer qtframebuffer also uses the WId so add a member there --- framebuffers/qt/qtframebuffer.cpp | 4 +++- framebuffers/qt/qtframebuffer.h | 1 + framebuffers/xcb/xcb_framebuffer.cpp | 10 +++++----- krfb/framebuffer.h | 1 - 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/framebuffers/qt/qtframebuffer.cpp b/framebuffers/qt/qtframebuffer.cpp index 15b76f20..514d1fff 100644 --- a/framebuffers/qt/qtframebuffer.cpp +++ b/framebuffers/qt/qtframebuffer.cpp @@ -13,7 +13,8 @@ #include #include #include -#include +#include +#include #include @@ -22,6 +23,7 @@ const int UPDATE_TIME = 500; QtFrameBuffer::QtFrameBuffer(QObject *parent) : FrameBuffer(parent) { + win = QApplication::desktop()->winId(); QScreen *screen = QGuiApplication::primaryScreen(); if (screen) { primaryScreen = screen; diff --git a/framebuffers/qt/qtframebuffer.h b/framebuffers/qt/qtframebuffer.h index 07d1a18e..018e7030 100644 --- a/framebuffers/qt/qtframebuffer.h +++ b/framebuffers/qt/qtframebuffer.h @@ -38,6 +38,7 @@ public Q_SLOTS: void updateFrameBuffer(); private: + WId win; QImage fbImage; QTimer *t; QScreen *primaryScreen; diff --git a/framebuffers/xcb/xcb_framebuffer.cpp b/framebuffers/xcb/xcb_framebuffer.cpp index 22e4a1d3..1f793a35 100644 --- a/framebuffers/xcb/xcb_framebuffer.cpp +++ b/framebuffers/xcb/xcb_framebuffer.cpp @@ -180,7 +180,7 @@ XCBFrameBuffer::XCBFrameBuffer(QObject *parent): } d->framebufferImage = xcb_image_get(QX11Info::connection(), - this->win, + d->win, d->area.left(), d->area.top(), d->area.width(), @@ -249,7 +249,7 @@ XCBFrameBuffer::XCBFrameBuffer(QObject *parent): // will return 1 on success (yes!) int shmget_res = xcb_image_shm_get( QX11Info::connection(), - this->win, + d->win, d->updateTile, d->shminfo, d->area.left(), // x @@ -557,7 +557,7 @@ QList XCBFrameBuffer::modifiedTiles() { // translate whe coordinates xcb_shm_get_image_cookie_t sgi_cookie = xcb_shm_get_image( QX11Info::connection(), - this->win, + d->win, d->area.left() + r.left(), d->area.top() + r.top(), r.width(), @@ -612,7 +612,7 @@ QList XCBFrameBuffer::modifiedTiles() { // need function that copies pixels from one image to another xcb_image_t *damagedImage = xcb_image_get( QX11Info::connection(), - this->win, + d->win, r.left(), r.top(), r.width(), @@ -652,7 +652,7 @@ void XCBFrameBuffer::startMonitor() { d->running = true; d->damage = xcb_generate_id(QX11Info::connection()); - xcb_damage_create(QX11Info::connection(), d->damage, this->win, + xcb_damage_create(QX11Info::connection(), d->damage, d->win, XCB_DAMAGE_REPORT_LEVEL_RAW_RECTANGLES); // (currently) we do not call xcb_damage_subtract() EVER, because diff --git a/krfb/framebuffer.h b/krfb/framebuffer.h index dd2df0e5..65771bf6 100644 --- a/krfb/framebuffer.h +++ b/krfb/framebuffer.h @@ -52,7 +52,6 @@ Q_SIGNALS: void frameBufferChanged(); protected: - WId win; char *fb = nullptr; QList tiles;