From caf99f83d5199d2bef9155667a2ff2dbe9425b7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Wed, 18 Feb 2015 10:04:06 +0100 Subject: [PATCH] Require Qt 5.4 REVIEW: 122617 --- CMakeLists.txt | 2 +- clients/aurorae/src/aurorae.cpp | 73 -------------------------------- clients/aurorae/src/aurorae.h | 5 --- glxbackend.cpp | 9 ---- libkwineffects/kwingltexture.cpp | 2 - workspace.cpp | 6 --- 6 files changed, 1 insertion(+), 96 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6dbfcc961f..81e3fc2416 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ set(PROJECT_VERSION "5.2.90") set(PROJECT_VERSION_MAJOR 5) cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) -set(QT_MIN_VERSION "5.3.0") +set(QT_MIN_VERSION "5.4.0") set(KF5_MIN_VERSION "5.3.0") set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH} ) diff --git a/clients/aurorae/src/aurorae.cpp b/clients/aurorae/src/aurorae.cpp index e24687d9cd..4ce2ee8bfc 100644 --- a/clients/aurorae/src/aurorae.cpp +++ b/clients/aurorae/src/aurorae.cpp @@ -47,16 +47,7 @@ along with this program. If not, see . #include #include #include - -#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)) -#define HAVE_RENDER_CONTROL 1 -#else -#define HAVE_RENDER_CONTROL 0 -#endif - -#if HAVE_RENDER_CONTROL #include -#endif #include #include #include @@ -265,7 +256,6 @@ Decoration::Decoration(QObject *parent, const QVariantList &args) , m_extendedBorders(nullptr) , m_padding(nullptr) , m_themeName(s_defaultTheme) - , m_mutex(QMutex::Recursive) { m_themeName = findTheme(args); Helper::instance().ref(); @@ -274,7 +264,6 @@ Decoration::Decoration(QObject *parent, const QVariantList &args) Decoration::~Decoration() { Helper::instance().unref(); -#if HAVE_RENDER_CONTROL if (m_context) { m_context->makeCurrent(m_offscreenSurface.data()); @@ -285,7 +274,6 @@ Decoration::~Decoration() m_context->doneCurrent(); } -#endif } void Decoration::init() @@ -293,19 +281,6 @@ void Decoration::init() KDecoration2::Decoration::init(); auto s = settings(); connect(s.data(), &KDecoration2::DecorationSettings::reconfigured, this, &Decoration::configChanged); - // recreate scene when compositing gets disabled, TODO: remove with rendercontrol -#if !HAVE_RENDER_CONTROL - if (!m_recreateNonCompositedConnection) { - m_recreateNonCompositedConnection = connect(s.data(), &KDecoration2::DecorationSettings::alphaChannelSupportedChanged, - this, [this](bool alpha) { - if (!alpha && m_item) { - m_item->deleteLater(); - m_decorationWindow.reset(); - init(); - } - }); - } -#endif QQmlContext *context = new QQmlContext(Helper::instance().rootContext(), this); context->setContextProperty(QStringLiteral("decoration"), this); @@ -346,7 +321,6 @@ void Decoration::init() m_item->setParentItem(visualParent.value()); visualParent.value()->setProperty("drawBackground", false); } else { -#if HAVE_RENDER_CONTROL // first create the context QSurfaceFormat format; format.setDepthBufferSize(16); @@ -405,40 +379,6 @@ void Decoration::init() m_context->makeCurrent(m_offscreenSurface.data()); m_renderControl->initialize(m_context.data()); m_context->doneCurrent(); -#else - // we need a QQuickWindow till we depend on Qt 5.4 - m_decorationWindow.reset(QWindow::fromWinId(client().data()->decorationId())); - m_view = new QQuickWindow(m_decorationWindow.data()); - m_view->setFlags(Qt::WindowDoesNotAcceptFocus | Qt::WindowTransparentForInput); - m_view->setColor(Qt::transparent); - connect(m_view.data(), &QQuickWindow::beforeRendering, [this]() { - if (!settings()->isAlphaChannelSupported()) { - // directly render to QQuickWindow - m_fbo.reset(); - return; - } - if (m_fbo.isNull() || m_fbo->size() != m_view->size()) { - m_fbo.reset(new QOpenGLFramebufferObject(m_view->size(), QOpenGLFramebufferObject::CombinedDepthStencil)); - if (!m_fbo->isValid()) { - qCWarning(AURORAE) << "Creating FBO as render target failed"; - m_fbo.reset(); - return; - } - } - m_view->setRenderTarget(m_fbo.data()); - }); - connect(m_view.data(), &QQuickWindow::afterRendering, [this] { - if (!m_fbo) { - return; - } - QMutexLocker locker(&m_mutex); - m_buffer = m_fbo->toImage(); - }); - connect(s.data(), &KDecoration2::DecorationSettings::alphaChannelSupportedChanged, - m_view.data(), &QQuickWindow::update); - connect(m_view.data(), &QQuickWindow::afterRendering, this, [this] { update(); }, Qt::QueuedConnection); - m_item->setParentItem(m_view->contentItem()); -#endif } setupBorders(m_item); if (m_extendedBorders) { @@ -454,19 +394,12 @@ void Decoration::init() connect(client().data(), &KDecoration2::DecoratedClient::maximizedChanged, this, &Decoration::updateBorders, Qt::QueuedConnection); updateBorders(); if (!m_view.isNull()) { -#if !HAVE_RENDER_CONTROL - m_view->setVisible(true); -#endif auto resizeWindow = [this] { QRect rect(QPoint(0, 0), size()); if (m_padding && !client().data()->isMaximized()) { rect = rect.adjusted(-m_padding->left(), -m_padding->top(), m_padding->right(), m_padding->bottom()); } m_view->setGeometry(rect); -#if !HAVE_RENDER_CONTROL - m_view->lower(); - m_view->update(); -#endif }; connect(this, &Decoration::bordersChanged, this, resizeWindow); connect(client().data(), &KDecoration2::DecoratedClient::widthChanged, this, resizeWindow); @@ -513,12 +446,6 @@ void Decoration::updateBorders() void Decoration::paint(QPainter *painter, const QRect &repaintRegion) { Q_UNUSED(repaintRegion) -#if !HAVE_RENDER_CONTROL - if (!settings()->isAlphaChannelSupported()) { - return; - } - QMutexLocker locker(&m_mutex); -#endif painter->fillRect(rect(), Qt::transparent); QRectF r(QPointF(0, 0), m_buffer.size()); bool updateShadow = false; diff --git a/clients/aurorae/src/aurorae.h b/clients/aurorae/src/aurorae.h index f6ef39ba2d..3b551488b5 100644 --- a/clients/aurorae/src/aurorae.h +++ b/clients/aurorae/src/aurorae.h @@ -21,7 +21,6 @@ along with this program. If not, see . #include #include #include -#include #include class QOffscreenSurface; @@ -32,7 +31,6 @@ class QQmlEngine; class QQuickItem; class QQuickRenderControl; class QQuickWindow; -class QWindow; class KConfigLoader; @@ -81,7 +79,6 @@ private: QMouseEvent translatedMouseEvent(QMouseEvent *orig); QScopedPointer m_fbo; QImage m_buffer; - QScopedPointer m_decorationWindow; QPointer m_view; QQuickItem *m_item; KWin::Borders *m_borders; @@ -89,8 +86,6 @@ private: KWin::Borders *m_extendedBorders; KWin::Borders *m_padding; QString m_themeName; - QMutex m_mutex; - QMetaObject::Connection m_recreateNonCompositedConnection; QQuickRenderControl *m_renderControl = nullptr; QScopedPointer m_updateTimer; QScopedPointer m_context; diff --git a/glxbackend.cpp b/glxbackend.cpp index c97fbee474..adbc5e1b27 100644 --- a/glxbackend.cpp +++ b/glxbackend.cpp @@ -187,15 +187,6 @@ void GlxBackend::init() m_haveINTELSwapEvent = hasGLExtension(QByteArrayLiteral("GLX_INTEL_swap_event")) && qgetenv("KWIN_USE_INTEL_SWAP_EVENT") == QByteArrayLiteral("1"); - if (m_haveINTELSwapEvent) { - const QList tokens = QByteArray(qVersion()).split('.'); - uint32_t version = tokens[0].toInt() << 16 | tokens[1].toInt() << 8 | tokens[2].toInt(); - - // Qt 5.3 doesn't forward swap events to the native event filter - if (version < 0x00050400) - m_haveINTELSwapEvent = false; - } - if (m_haveINTELSwapEvent) { m_swapEventFilter = std::make_unique(window, glxWindow); glXSelectEvent(display(), glxWindow, GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK); diff --git a/libkwineffects/kwingltexture.cpp b/libkwineffects/kwingltexture.cpp index 06c2ed8246..a27719332a 100644 --- a/libkwineffects/kwingltexture.cpp +++ b/libkwineffects/kwingltexture.cpp @@ -121,12 +121,10 @@ GLTexture::GLTexture(const QImage& image, GLenum target) { GL_RGB8, GL_RGBA, GL_UNSIGNED_BYTE }, // QImage::Format_RGBX8888 { 0, 0, 0 }, // QImage::Format_RGBA8888 { GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE }, // QImage::Format_RGBA8888_Premultiplied -#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) { GL_RGB10, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV }, // QImage::Format_BGR30 { GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV }, // QImage::Format_A2BGR30_Premultiplied { GL_RGB10, GL_BGRA, GL_UNSIGNED_INT_2_10_10_10_REV }, // QImage::Format_RGB30 { GL_RGB10_A2, GL_BGRA, GL_UNSIGNED_INT_2_10_10_10_REV }, // QImage::Format_A2RGB30_Premultiplied -#endif }; QImage im; diff --git a/workspace.cpp b/workspace.cpp index dcf4479f58..7fbe16a10a 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -184,12 +184,6 @@ Workspace::Workspace(bool restore) // Select windowmanager privileges selectWmInputEventMask(); -#if QT_VERSION < 0x050302 - // WORKAROUND: QXcbScreen before 5.3.2 overrides them, see bug #335926, QTBUG-39648 - // TODO once we depend on Qt 5.4 remove it - connect(qApp, SIGNAL(screenAdded(QScreen*)), this, SLOT(selectWmInputEventMask())); -#endif - ScreenEdges::create(this); // VirtualDesktopManager needs to be created prior to init shortcuts