From 85691c519e029b5ed112e06f517d8e900dde19e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Tue, 9 Apr 2013 18:50:19 +0200 Subject: [PATCH 1/3] fix flickable bounds when filtering REVIEW: 105027 BUG: 318096 FIXED-IN: 4.10.3 --- kcmkwin/kwindecoration/kwindecoration.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kcmkwin/kwindecoration/kwindecoration.cpp b/kcmkwin/kwindecoration/kwindecoration.cpp index a42384573d..591a913c40 100644 --- a/kcmkwin/kwindecoration/kwindecoration.cpp +++ b/kcmkwin/kwindecoration/kwindecoration.cpp @@ -157,6 +157,8 @@ void KWinDecorationModule::init() connect(m_ui->configureButtonsButton, SIGNAL(clicked(bool)), this, SLOT(slotConfigureButtons())); connect(m_ui->ghnsButton, SIGNAL(clicked(bool)), SLOT(slotGHNSClicked())); connect(m_ui->searchEdit, SIGNAL(textChanged(QString)), m_proxyModel, SLOT(setFilterFixedString(QString))); + connect(m_ui->searchEdit, SIGNAL(textChanged(QString)), m_ui->decorationList->rootObject(), SLOT(returnToBounds()), Qt::QueuedConnection); + connect(m_ui->searchEdit, SIGNAL(textChanged(QString)), SLOT(updateScrollbarRange()), Qt::QueuedConnection); connect(m_ui->configureDecorationButton, SIGNAL(clicked(bool)), SLOT(slotConfigureDecoration())); m_ui->decorationList->disconnect(m_ui->decorationList->verticalScrollBar()); @@ -527,8 +529,10 @@ void KWinDecorationModule::updatePreviewWidth() void KWinDecorationModule::updateScrollbarRange() { m_ui->decorationList->verticalScrollBar()->blockSignals(true); + const bool atMinimum = m_ui->decorationList->rootObject()->property("atYBeginning").toBool(); const int h = m_ui->decorationList->rootObject()->property("contentHeight").toInt(); - m_ui->decorationList->verticalScrollBar()->setRange(0, h - m_ui->decorationList->height()); + const int y = atMinimum ? m_ui->decorationList->rootObject()->property("contentY").toInt() : 0; + m_ui->decorationList->verticalScrollBar()->setRange(y, y + h - m_ui->decorationList->height()); m_ui->decorationList->verticalScrollBar()->setPageStep(m_ui->decorationList->verticalScrollBar()->maximum()/m_model->rowCount()); m_ui->decorationList->verticalScrollBar()->blockSignals(false); } From c0eab5b8e984d8d0f5001fcc5af8d06d523ac805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Wed, 13 Feb 2013 22:14:29 +0100 Subject: [PATCH 2/3] TabBox: fix plasma theme workaround (tabbox) BUG: 315064 FIXED-IN: 4.10.3 REVIEW: 108947 --- tabbox/declarative.cpp | 31 ++++++++++++++++++++----------- tabbox/qml/ShadowedSvgItem.qml | 15 ++++++++++++--- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/tabbox/declarative.cpp b/tabbox/declarative.cpp index 5beaf1bcf9..f759512c76 100644 --- a/tabbox/declarative.cpp +++ b/tabbox/declarative.cpp @@ -102,17 +102,20 @@ QPixmap ImageProvider::requestPixmap(const QString &id, QSize *size, const QSize return icon; } -static bool compositing() +// WARNING: this code exists to cover a bug in Qt which prevents plasma from detecting the state change +// of the compositor through KWindowSystem. +// once plasma uses (again) a KSelectionWatcher or Qt is fixed in this regard, the code can go. +static QString plasmaThemeVariant() { #ifndef TABBOX_KCM if (!Workspace::self()->compositing() || !effects) { - return false; + return Plasma::Theme::defaultTheme()->currentThemeHasImage("opaque/dialogs/background") ? QLatin1String("opaque/") : QLatin1String(""); } - if (!static_cast(effects)->provides(Effect::Blur)) { - return false; + if (static_cast(effects)->provides(Effect::Blur)) { + return Plasma::Theme::defaultTheme()->currentThemeHasImage("translucent/dialogs/background") ? QLatin1String("translucent/") : QLatin1String(""); } #endif - return Plasma::Theme::defaultTheme()->currentThemeHasImage("translucent/dialogs/background"); + return QLatin1String(""); } DeclarativeView::DeclarativeView(QAbstractItemModel *model, TabBoxConfig::TabBoxMode mode, QWidget *parent) @@ -145,7 +148,7 @@ DeclarativeView::DeclarativeView(QAbstractItemModel *model, TabBoxConfig::TabBox kdeclarative.setupBindings(); qmlRegisterType("org.kde.kwin", 0, 1, "ThumbnailItem"); rootContext()->setContextProperty("viewId", static_cast(winId())); - rootContext()->setContextProperty("compositing", compositing()); + rootContext()->setContextProperty("plasmaThemeVariant", plasmaThemeVariant()); if (m_mode == TabBoxConfig::ClientTabBox) { rootContext()->setContextProperty("clientModel", model); } else if (m_mode == TabBoxConfig::DesktopTabBox) { @@ -188,8 +191,10 @@ void DeclarativeView::showEvent(QShowEvent *event) item->setProperty("currentIndex", tabBox->first().row()); connect(item, SIGNAL(currentIndexChanged(int)), SLOT(currentIndexChanged(int))); } - rootContext()->setContextProperty("compositing", compositing()); + rootContext()->setContextProperty("plasmaThemeVariant", plasmaThemeVariant()); slotUpdateGeometry(); + QResizeEvent re(size(), size()); // to set mask and blurring. + resizeEvent(&re); QGraphicsView::showEvent(event); } @@ -210,11 +215,15 @@ void DeclarativeView::resizeEvent(QResizeEvent *event) m_frame->setImagePath(maskImagePath); m_frame->resizeFrame(QSizeF(maskWidth, maskHeight)); QRegion mask = m_frame->mask().translated(maskLeftMargin, maskTopMargin); - if (compositing()) { - // blur background - Plasma::WindowEffects::enableBlurBehind(winId(), true, mask); +#ifndef TABBOX_KCM + // notice: this covers an issue with plasma detecting the compositing state. see plasmaThemeVariant() + if (Workspace::self()->compositing() && effects) { + // blur background?! + Plasma::WindowEffects::enableBlurBehind(winId(), static_cast(effects)->provides(Effect::Blur), mask); clearMask(); - } else { + } else +#endif + { // do not trim to mask with compositing enabled, otherwise shadows are cropped setMask(mask); } diff --git a/tabbox/qml/ShadowedSvgItem.qml b/tabbox/qml/ShadowedSvgItem.qml index 8bf76c8a2f..ad92cabf17 100644 --- a/tabbox/qml/ShadowedSvgItem.qml +++ b/tabbox/qml/ShadowedSvgItem.qml @@ -32,16 +32,25 @@ Item { property int centerLeftMargin: shadow.margins.left property alias maskImagePath: shadow.imagePath + PlasmaCore.FrameSvg { + id: themeInfo + imagePath: plasmaThemeVariant + "dialogs/background" + // NOTICE: the following plasmaThemeVariant access causes necessary re-evaluation! + property bool hasNewShadows: plasmaThemeVariant != "reEvaluateMe" && hasElementPrefix("shadow") + } + PlasmaCore.FrameSvgItem { id: shadow - imagePath: (compositing ? "translucent" : "opaque") + "/dialogs/background" - prefix: "shadow" + prefix: themeInfo.hasNewShadows ? "shadow" : "" + + imagePath: plasmaThemeVariant + "dialogs/background" anchors.fill: parent + visible: true PlasmaCore.FrameSvgItem { id: background imagePath: shadow.imagePath - visible: false + visible: themeInfo.hasNewShadows anchors { fill: parent leftMargin: shadow.margins.left From 0168f7eacf85a650b5fed59aa13f2a4e0628c230 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B6glund?= Date: Tue, 9 Apr 2013 18:55:21 +0200 Subject: [PATCH 3/3] kwin/glx: Avoid MSAA configs in initDrawableConfigs() This is the same fix that was applied to initBufferConfigs() in commit 6cf057777555a5d0c834de3a0165a62916cf3b40. CCBUG: 315089 --- glxbackend.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/glxbackend.cpp b/glxbackend.cpp index be1149780c..acb564d7b7 100644 --- a/glxbackend.cpp +++ b/glxbackend.cpp @@ -323,11 +323,13 @@ bool GlxBackend::initDrawableConfigs() GLXFBConfig *fbconfigs = glXGetFBConfigs(display(), DefaultScreen(display()), &cnt); for (int i = 0; i <= 32; i++) { - int back, stencil, depth, caveat, alpha, mipmap, rgba; + int back, stencil, depth, caveat, alpha, mipmap, msaa_buffers, msaa_samples, rgba; back = INT_MAX; stencil = INT_MAX; depth = INT_MAX; caveat = INT_MAX; + msaa_buffers = INT_MAX; + msaa_samples = INT_MAX; mipmap = 0; rgba = 0; fbcdrawableinfo[ i ].fbconfig = NULL; @@ -395,12 +397,27 @@ bool GlxBackend::initDrawableConfigs() GLX_CONFIG_CAVEAT, &caveat_value); if (caveat_value > caveat) continue; + + int msaa_buffers_value; + glXGetFBConfigAttrib(display(), fbconfigs[j], GLX_SAMPLE_BUFFERS, + &msaa_buffers_value); + if (msaa_buffers_value > msaa_buffers) + continue; + + int msaa_samples_value; + glXGetFBConfigAttrib(display(), fbconfigs[j], GLX_SAMPLES, + &msaa_samples_value); + if (msaa_samples_value > msaa_samples) + continue; + // ok, config passed all tests, it's the best one so far fbcdrawableinfo[ i ].fbconfig = fbconfigs[ j ]; caveat = caveat_value; back = back_value; stencil = stencil_value; depth = depth_value; + msaa_buffers = msaa_buffers_value; + msaa_samples = msaa_samples_value; mipmap = 0; glXGetFBConfigAttrib(display(), fbconfigs[ j ], GLX_BIND_TO_TEXTURE_TARGETS_EXT, &value);