From b7a2db5c71b9ee885197d4d6a1c4833971fb6df8 Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Mon, 8 Jan 2024 00:52:35 +0100 Subject: [PATCH] Drop qt framebuffer It works by grabbing the QDesktopWidget, which doesn't work in Qt6 since there is no QDesktopWidget. In practice it only really works on xcb anyway, for which we have a dedicated plugin --- framebuffers/CMakeLists.txt | 2 - framebuffers/qt/CMakeLists.txt | 33 ------ framebuffers/qt/qt.json | 6 -- framebuffers/qt/qtframebuffer.cpp | 128 ------------------------ framebuffers/qt/qtframebuffer.h | 47 --------- framebuffers/qt/qtframebufferplugin.cpp | 41 -------- framebuffers/qt/qtframebufferplugin.h | 45 --------- 7 files changed, 302 deletions(-) delete mode 100644 framebuffers/qt/CMakeLists.txt delete mode 100644 framebuffers/qt/qt.json delete mode 100644 framebuffers/qt/qtframebuffer.cpp delete mode 100644 framebuffers/qt/qtframebuffer.h delete mode 100644 framebuffers/qt/qtframebufferplugin.cpp delete mode 100644 framebuffers/qt/qtframebufferplugin.h diff --git a/framebuffers/CMakeLists.txt b/framebuffers/CMakeLists.txt index c86208f4..facb1d35 100644 --- a/framebuffers/CMakeLists.txt +++ b/framebuffers/CMakeLists.txt @@ -1,5 +1,3 @@ -add_subdirectory (qt) - if (${XCB_DAMAGE_FOUND} AND ${XCB_SHM_FOUND} AND ${XCB_IMAGE_FOUND}) add_subdirectory (xcb) endif() diff --git a/framebuffers/qt/CMakeLists.txt b/framebuffers/qt/CMakeLists.txt deleted file mode 100644 index 215e5a2c..00000000 --- a/framebuffers/qt/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -include_directories (${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR} -) - -set (krfb_framebuffer_qt_SRCS - qtframebuffer.cpp - qtframebufferplugin.cpp -) - -ecm_qt_declare_logging_category(krfb_framebuffer_qt_SRCS - HEADER krfb_fb_qt_debug.h - IDENTIFIER KRFB_FB_QT - CATEGORY_NAME krfb.framebuffer.qt - DESCRIPTION "KRFB Qt framebuffer plugin" - EXPORT KRFB -) - -add_library(krfb_framebuffer_qt - MODULE - ${krfb_framebuffer_qt_SRCS} -) - -target_link_libraries (krfb_framebuffer_qt - Qt5::Core - Qt5::Gui - KF5::CoreAddons - krfbprivate -) - -set_target_properties(krfb_framebuffer_qt PROPERTIES OUTPUT_NAME qt) -install (TARGETS krfb_framebuffer_qt - DESTINATION ${KDE_INSTALL_PLUGINDIR}/krfb/framebuffer -) diff --git a/framebuffers/qt/qt.json b/framebuffers/qt/qt.json deleted file mode 100644 index 2463513d..00000000 --- a/framebuffers/qt/qt.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "X-KDE-OnlyShowOnQtPlatforms": [ - "xcb" - ] -} - diff --git a/framebuffers/qt/qtframebuffer.cpp b/framebuffers/qt/qtframebuffer.cpp deleted file mode 100644 index 514d1fff..00000000 --- a/framebuffers/qt/qtframebuffer.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2007 Alessandro Praduroux - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. -*/ - -#include "qtframebuffer.h" - -#include -#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(); - if (screen) { - primaryScreen = screen; - fbImage = screen->grabWindow(win).toImage(); - fb = new char[fbImage.sizeInBytes()]; - } else { - fb = nullptr; - primaryScreen = nullptr; - } - - t = new QTimer(this); - connect(t, &QTimer::timeout, this, &QtFrameBuffer::updateFrameBuffer); -} - - -QtFrameBuffer::~QtFrameBuffer() -{ - if (fb) - delete [] fb; - fb = nullptr; -} - -int QtFrameBuffer::depth() -{ - return fbImage.depth(); -} - -int QtFrameBuffer::height() -{ - return fbImage.height(); -} - -int QtFrameBuffer::width() -{ - return fbImage.width(); -} - -void QtFrameBuffer::getServerFormat(rfbPixelFormat &format) -{ - format.bitsPerPixel = 32; - format.depth = 32; - format.trueColour = true; - - format.bigEndian = false; - format.redShift = 16; - format.greenShift = 8; - format.blueShift = 0; - format.redMax = 0xff; - format.greenMax = 0xff; - format.blueMax = 0xff; -} - -void QtFrameBuffer::updateFrameBuffer() -{ - if (!fb || !primaryScreen) return; - QImage img = primaryScreen->grabWindow(win).toImage(); -#if 0 // This is actually slower than updating the whole desktop... - QSize imgSize = img.size(); - - - // verify what part of the image need to be marked as changed - // fbImage is the previous version of the image, - // img is the current one - - QImage map(imgSize, QImage::Format_Mono); - map.fill(0); - - for (int x = 0; x < imgSize.width(); x++) { - for (int y = 0; y < imgSize.height(); y++) { - if (img.pixel(x, y) != fbImage.pixel(x, y)) { - map.setPixel(x, y, 1); - } - } - } - - QRegion r(QBitmap::fromImage(map)); - tiles = tiles + r.rects(); - -#else - tiles.append(img.rect()); -#endif - - memcpy(fb, img.bits(), static_cast(img.sizeInBytes())); - fbImage = img; - -} - -int QtFrameBuffer::paddedWidth() -{ - return fbImage.width() * 4; -} - -void QtFrameBuffer::startMonitor() -{ - t->start(UPDATE_TIME); -} - -void QtFrameBuffer::stopMonitor() -{ - t->stop(); -} - diff --git a/framebuffers/qt/qtframebuffer.h b/framebuffers/qt/qtframebuffer.h deleted file mode 100644 index 018e7030..00000000 --- a/framebuffers/qt/qtframebuffer.h +++ /dev/null @@ -1,47 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2007 Alessandro Praduroux - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. -*/ - -#ifndef KRFB_FRAMEBUFFER_QT_QTFRAMEBUFFER_H -#define KRFB_FRAMEBUFFER_QT_QTFRAMEBUFFER_H - -#include -#include "framebuffer.h" - -class QTimer; -class QScreen; -/** - @author Alessandro Praduroux -*/ -class QtFrameBuffer : public FrameBuffer -{ - Q_OBJECT -public: - explicit QtFrameBuffer(QObject *parent = nullptr); - - ~QtFrameBuffer() override; - - int depth() override; - int height() override; - int width() override; - int paddedWidth() override; - void getServerFormat(rfbPixelFormat &format) override; - void startMonitor() override; - void stopMonitor() override; - -public Q_SLOTS: - void updateFrameBuffer(); - -private: - WId win; - QImage fbImage; - QTimer *t; - QScreen *primaryScreen; -}; - -#endif diff --git a/framebuffers/qt/qtframebufferplugin.cpp b/framebuffers/qt/qtframebufferplugin.cpp deleted file mode 100644 index d5700dee..00000000 --- a/framebuffers/qt/qtframebufferplugin.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2009 Collabora Ltd - @author George Goldberg - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "qtframebufferplugin.h" - -#include "qtframebuffer.h" - -#include - -K_PLUGIN_CLASS_WITH_JSON(QtFrameBufferPlugin, "qt.json") - -QtFrameBufferPlugin::QtFrameBufferPlugin(QObject *parent, const QVariantList &args) - : FrameBufferPlugin(parent, args) -{ -} - -FrameBuffer *QtFrameBufferPlugin::frameBuffer(const QVariantMap &args) -{ - Q_UNUSED(args); - return new QtFrameBuffer; -} - -#include "qtframebufferplugin.moc" - diff --git a/framebuffers/qt/qtframebufferplugin.h b/framebuffers/qt/qtframebufferplugin.h deleted file mode 100644 index 15954652..00000000 --- a/framebuffers/qt/qtframebufferplugin.h +++ /dev/null @@ -1,45 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2009 Collabora Ltd - @author George Goldberg - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef KRFB_FRAMEBUFFER_QT_QTFRAMEBUFFERPLUGIN_H -#define KRFB_FRAMEBUFFER_QT_QTFRAMEBUFFERPLUGIN_H - -#include "framebufferplugin.h" - -#include - -class FrameBuffer; - -class QtFrameBufferPlugin : public FrameBufferPlugin -{ - Q_OBJECT - -public: - QtFrameBufferPlugin(QObject *parent, const QVariantList &args); - - FrameBuffer *frameBuffer(const QVariantMap &args) override; - -private: - Q_DISABLE_COPY(QtFrameBufferPlugin) -}; - - -#endif // Header guard -