Require Qt 5.4
REVIEW: 122617
This commit is contained in:
parent
230f8dea24
commit
caf99f83d5
6 changed files with 1 additions and 96 deletions
|
@ -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} )
|
||||
|
|
|
@ -47,16 +47,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <QOpenGLFramebufferObject>
|
||||
#include <QPainter>
|
||||
#include <QQuickItem>
|
||||
|
||||
#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 <QQuickRenderControl>
|
||||
#endif
|
||||
#include <QQuickWindow>
|
||||
#include <QQmlComponent>
|
||||
#include <QQmlContext>
|
||||
|
@ -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<QQuickItem*>());
|
||||
visualParent.value<QQuickItem*>()->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;
|
||||
|
|
|
@ -21,7 +21,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <KDecoration2/Decoration>
|
||||
#include <QElapsedTimer>
|
||||
#include <QVariant>
|
||||
#include <QMutex>
|
||||
#include <KCModule>
|
||||
|
||||
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<QOpenGLFramebufferObject> m_fbo;
|
||||
QImage m_buffer;
|
||||
QScopedPointer<QWindow> m_decorationWindow;
|
||||
QPointer<QQuickWindow> 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<QTimer> m_updateTimer;
|
||||
QScopedPointer<QOpenGLContext> m_context;
|
||||
|
|
|
@ -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<QByteArray> 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<SwapEventFilter>(window, glxWindow);
|
||||
glXSelectEvent(display(), glxWindow, GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue