diff --git a/shell/panelview.h b/shell/panelview.h --- a/shell/panelview.h +++ b/shell/panelview.h @@ -27,6 +27,7 @@ #include "plasmaquick/configview.h" class ShellCorona; +class PanelConfigView; namespace KWayland { @@ -78,13 +79,6 @@ Q_PROPERTY(int distance READ distance WRITE setDistance NOTIFY distanceChanged) /** - * support NoBackground in order to disable blur/contrast effects and remove - * the panel shadows - * @since 5.9 - */ - Q_PROPERTY(Plasma::Types::BackgroundHints backgroundHints WRITE setBackgroundHints READ backgroundHints NOTIFY backgroundHintsChanged) - - /** * The borders that should have a shadow * @since 5.7 */ @@ -138,9 +132,6 @@ int distance() const; void setDistance(int dist); - Plasma::Types::BackgroundHints backgroundHints() const; - void setBackgroundHints(Plasma::Types::BackgroundHints hint); - Plasma::FrameSvg::EnabledBorders enabledBorders() const; VisibilityMode visibilityMode() const; @@ -162,6 +153,8 @@ void setScreenToFollow(QScreen* screen); QScreen* screenToFollow() const; + PanelConfigView *panelConfigView() const; + protected: void resizeEvent(QResizeEvent *ev) override; void showEvent(QShowEvent *event) override; @@ -178,7 +171,6 @@ void maximumLengthChanged(); void minimumLengthChanged(); void distanceChanged(); - void backgroundHintsChanged(); void enabledBordersChanged(); //QWindow does not have a property for screen. Adding this property requires re-implementing the signal @@ -220,7 +212,6 @@ int m_contentLength; int m_distance; int m_thickness; - bool m_initCompleted; Qt::Alignment m_alignment; QPointer m_panelConfigView; ShellCorona *m_corona; @@ -231,7 +222,6 @@ QTimer m_unhideTimer; //only for the mask, not to actually paint Plasma::FrameSvg *m_background; - Plasma::Types::BackgroundHints m_backgroundHints; Plasma::FrameSvg::EnabledBorders m_enabledBorders = Plasma::FrameSvg::AllBorders; KWayland::Client::PlasmaShellSurface *m_shellSurface; QPointer m_lastScreen; diff --git a/shell/panelview.cpp b/shell/panelview.cpp --- a/shell/panelview.cpp +++ b/shell/panelview.cpp @@ -62,9 +62,7 @@ m_corona(corona), m_visibilityMode(NormalPanel), m_background(0), - m_backgroundHints(Plasma::Types::StandardBackground), - m_shellSurface(nullptr), - m_initCompleted(false) + m_shellSurface(nullptr) { if (targetScreen) { setPosition(targetScreen->geometry().center()); @@ -77,11 +75,14 @@ setFlags(Qt::FramelessWindowHint|Qt::WindowDoesNotAcceptFocus); connect(&m_theme, &Plasma::Theme::themeChanged, this, &PanelView::themeChanged); - connect(this, SIGNAL(backgroundHintsChanged()), this, SLOT(themeChanged())); m_positionPaneltimer.setSingleShot(true); m_positionPaneltimer.setInterval(150); - connect(&m_positionPaneltimer, &QTimer::timeout, this, &PanelView::restore); + connect(&m_positionPaneltimer, &QTimer::timeout, + this, [this] () { + restore(); + positionPanel(); + }); m_unhideTimer.setSingleShot(true); m_unhideTimer.setInterval(500); @@ -292,22 +293,6 @@ positionPanel(); } -Plasma::Types::BackgroundHints PanelView::backgroundHints() const -{ - return m_backgroundHints; -} - -void PanelView::setBackgroundHints(Plasma::Types::BackgroundHints hint) -{ - if (m_backgroundHints == hint) { - return; - } - - m_backgroundHints = hint; - - emit backgroundHintsChanged(); -} - Plasma::FrameSvg::EnabledBorders PanelView::enabledBorders() const { return m_enabledBorders; @@ -375,10 +360,6 @@ return; } - if (!m_initCompleted) { - return; - } - KWindowEffects::SlideFromLocation slideLocation = KWindowEffects::NoEdge; switch (containment()->location()) { @@ -484,37 +465,19 @@ void PanelView::resizePanel() { - if (!m_initCompleted) { - return; - } - - QSize targetSize; - QSize targetMinSize; - QSize targetMaxSize; - if (formFactor() == Plasma::Types::Vertical) { const int minSize = qMax(MINSIZE, m_minLength); const int maxSize = qMin(m_maxLength, m_screenToFollow->size().height() - m_offset); - targetMinSize = QSize(thickness(), minSize); - targetMaxSize = QSize(thickness(), maxSize); - targetSize = QSize(thickness(), qBound(minSize, m_contentLength, maxSize)); + setMinimumSize(QSize(thickness(), minSize)); + setMaximumSize(QSize(thickness(), maxSize)); + resize(thickness(), qBound(minSize, m_contentLength, maxSize)); } else { const int minSize = qMax(MINSIZE, m_minLength); const int maxSize = qMin(m_maxLength, m_screenToFollow->size().width() - m_offset); - targetMinSize = QSize(minSize, thickness()); - targetMaxSize = QSize(maxSize, thickness()); - targetSize = QSize(qBound(minSize, m_contentLength, maxSize), thickness()); - } - if (minimumSize() != targetMinSize) { - setMinimumSize(targetMinSize); - } - if (maximumSize() != targetMaxSize) { - setMaximumSize(targetMaxSize); + setMinimumSize(QSize(minSize, thickness())); + setMaximumSize(QSize(maxSize, thickness())); + resize(qBound(minSize, m_contentLength, maxSize), thickness()); } - if (size() != targetSize) { - resize(targetSize); - } - //position will be updated implicitly from resizeEvent } @@ -547,18 +510,13 @@ m_minLength = qBound(MINSIZE, config().readEntry("minLength", side), maxSize); setVisibilityMode((VisibilityMode)config().readEntry("panelVisibility", (int)NormalPanel)); - m_initCompleted = true; resizePanel(); positionPanel(); emit maximumLengthChanged(); emit minimumLengthChanged(); emit offsetChanged(); emit alignmentChanged(); - - //::restore might have been called directly before the timer fires - // at which point we don't still need the timer - m_positionPaneltimer.stop(); } void PanelView::showConfigurationInterface(Plasma::Applet *applet) @@ -669,13 +627,6 @@ KWindowEffects::slideWindow(winId(), slideLocation, -1); } #endif - if (m_shellSurface && m_visibilityMode == PanelView::AutoHide) { - if (enabled) { - m_shellSurface->requestHideAutoHidingPanel(); - } else { - m_shellSurface->requestShowAutoHidingPanel(); - } - } } void PanelView::resizeEvent(QResizeEvent *ev) @@ -719,6 +670,7 @@ void PanelView::showEvent(QShowEvent *event) { + PanelShadows::self()->addWindow(this, enabledBorders()); PlasmaQuick::ContainmentView::showEvent(event); integrateScreen(); @@ -751,6 +703,11 @@ return m_screenToFollow; } +PanelConfigView *PanelView::panelConfigView() const +{ + return qobject_cast(m_panelConfigView.data()); +} + void PanelView::adaptToScreen() { emit screenToFollowChanged(m_screenToFollow); @@ -873,7 +830,6 @@ switch (pe->surfaceEventType()) { case QPlatformSurfaceEvent::SurfaceCreated: setupWaylandIntegration(); - PanelShadows::self()->addWindow(this, enabledBorders()); break; case QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed: delete m_shellSurface; @@ -1074,16 +1030,11 @@ void PanelView::themeChanged() { - if (m_backgroundHints == Plasma::Types::NoBackground) { - KWindowEffects::enableBlurBehind(winId(), false); - KWindowEffects::enableBackgroundContrast(winId(), false); - } else { - KWindowEffects::enableBlurBehind(winId(), true); - KWindowEffects::enableBackgroundContrast(winId(), m_theme.backgroundContrastEnabled(), - m_theme.backgroundContrast(), - m_theme.backgroundIntensity(), - m_theme.backgroundSaturation()); - } + KWindowEffects::enableBlurBehind(winId(), true); + KWindowEffects::enableBackgroundContrast(winId(), m_theme.backgroundContrastEnabled(), + m_theme.backgroundContrast(), + m_theme.backgroundIntensity(), + m_theme.backgroundSaturation()); updateMask(); } @@ -1170,46 +1121,39 @@ { Plasma::FrameSvg::EnabledBorders borders = Plasma::FrameSvg::AllBorders; - if (m_backgroundHints == Plasma::Types::NoBackground) { - borders = Plasma::FrameSvg::NoBorder; - } else { - switch (location()) { - case Plasma::Types::TopEdge: - borders &= ~Plasma::FrameSvg::TopBorder; - break; - case Plasma::Types::LeftEdge: - borders &= ~Plasma::FrameSvg::LeftBorder; - break; - case Plasma::Types::RightEdge: - borders &= ~Plasma::FrameSvg::RightBorder; - break; - case Plasma::Types::BottomEdge: - borders &= ~Plasma::FrameSvg::BottomBorder; - break; - default: - break; - } + switch (location()) { + case Plasma::Types::TopEdge: + borders &= ~Plasma::FrameSvg::TopBorder; + break; + case Plasma::Types::LeftEdge: + borders &= ~Plasma::FrameSvg::LeftBorder; + break; + case Plasma::Types::RightEdge: + borders &= ~Plasma::FrameSvg::RightBorder; + break; + case Plasma::Types::BottomEdge: + borders &= ~Plasma::FrameSvg::BottomBorder; + break; + default: + break; + } - if (x() <= m_screenToFollow->geometry().x()) { - borders &= ~Plasma::FrameSvg::LeftBorder; - } - if (x() + width() >= m_screenToFollow->geometry().x() + m_screenToFollow->geometry().width()) { - borders &= ~Plasma::FrameSvg::RightBorder; - } - if (y() <= m_screenToFollow->geometry().y()) { - borders &= ~Plasma::FrameSvg::TopBorder; - } - if (y() + height() >= m_screenToFollow->geometry().y() + m_screenToFollow->geometry().height()) { - borders &= ~Plasma::FrameSvg::BottomBorder; - } + if (x() <= m_screenToFollow->geometry().x()) { + borders &= ~Plasma::FrameSvg::LeftBorder; + } + if (x() + width() >= m_screenToFollow->geometry().x() + m_screenToFollow->geometry().width()) { + borders &= ~Plasma::FrameSvg::RightBorder; + } + if (y() <= m_screenToFollow->geometry().y()) { + borders &= ~Plasma::FrameSvg::TopBorder; + } + if (y() + height() >= m_screenToFollow->geometry().y() + m_screenToFollow->geometry().height()) { + borders &= ~Plasma::FrameSvg::BottomBorder; } if (m_enabledBorders != borders) { - if (m_backgroundHints == Plasma::Types::NoBackground) { - PanelShadows::self()->removeWindow(this); - } else { - PanelShadows::self()->setEnabledBorders(this, borders); - } + + PanelShadows::self()->setEnabledBorders(this, borders); m_enabledBorders = borders; emit enabledBordersChanged(); diff --git a/shell/shellcorona.cpp b/shell/shellcorona.cpp --- a/shell/shellcorona.cpp +++ b/shell/shellcorona.cpp @@ -65,6 +65,7 @@ #include "shellmanager.h" #include "osd.h" #include "screenpool.h" +#include "waylanddialogfilter.h" #include "plasmashelladaptor.h" #include "debug.h" @@ -204,6 +205,8 @@ connect(m_activityController, &KActivities::Controller::activityRemoved, this, &ShellCorona::activityRemoved); new Osd(this); + + qApp->installEventFilter(this); } ShellCorona::~ShellCorona() @@ -216,6 +219,21 @@ m_panelViews.clear(); } +bool ShellCorona::eventFilter(QObject *watched, QEvent *event) +{ + if (event->type() == QEvent::PlatformSurface && + watched->inherits("PlasmaQuick::Dialog")) { + QPlatformSurfaceEvent *se = static_cast(event); + if (se->surfaceEventType() == QPlatformSurfaceEvent::SurfaceCreated) { + if (KWindowSystem::isPlatformWayland()) { + WaylandDialogFilter::install(qobject_cast(watched), this); + } + } + } + + return QObject::eventFilter(watched, event); +} + KPackage::Package ShellCorona::lookAndFeelPackage() { return m_lookAndFeelPackage; @@ -391,7 +409,7 @@ || cont->location() == Plasma::Types::BottomEdge || cont->location() == Plasma::Types::LeftEdge || cont->location() == Plasma::Types::RightEdge) && - cont->pluginMetaData().pluginId() != QStringLiteral("org.kde.plasma.private.systemtray"); + cont->pluginInfo().pluginName() != QStringLiteral("org.kde.plasma.private.systemtray"); }; auto isDesktop = [] (Plasma::Containment *cont) { @@ -478,7 +496,7 @@ KConfigGroup appletConfig = applet->config(); - appletJson.insert("plugin", applet->pluginMetaData().pluginId()); + appletJson.insert("plugin", applet->pluginInfo().pluginName()); appletJson.insert("config", dumpconfigGroupJS(appletConfig)); appletsJsonArray << appletJson; @@ -545,7 +563,7 @@ QJsonObject appletJson; appletJson.insert("title", applet->title()); - appletJson.insert("plugin", applet->pluginMetaData().pluginId()); + appletJson.insert("plugin", applet->pluginInfo().pluginName()); appletJson.insert("geometry.x", geometry.x() / gridUnit); appletJson.insert("geometry.y", geometry.y() / gridUnit); @@ -958,7 +976,9 @@ QRegion r = view->geometry(); foreach (const PanelView *v, m_panelViews) { - if (v->isVisible() && view->screen() == v->screen() && v->visibilityMode() != PanelView::AutoHide) { + if (v->isVisible() && view->screen() == v->screen() && + ((v->panelConfigView() && v->panelConfigView()->visibilityMode() != PanelView::AutoHide ) || + (!v->panelConfigView() && v->visibilityMode() != PanelView::AutoHide))) { //if the panel is being moved around, we still want to calculate it from the edge r -= v->geometryByDistance(0); } @@ -979,7 +999,9 @@ QRect r = view->geometry(); foreach (PanelView *v, m_panelViews) { - if (v->isVisible() && v->screen() == view->screen() && v->visibilityMode() != PanelView::AutoHide) { + if (v->isVisible() && v->screen() == view->screen() && + ((v->panelConfigView() && v->panelConfigView()->visibilityMode() != PanelView::AutoHide ) || + (!v->panelConfigView() && v->visibilityMode() != PanelView::AutoHide))) { switch (v->location()) { case Plasma::Types::LeftEdge: r.setLeft(r.left() + v->thickness()); @@ -1254,11 +1276,11 @@ void ShellCorona::executeSetupPlasmoidScript(Plasma::Containment *containment, Plasma::Applet *applet) { - if (!applet->pluginMetaData().isValid() || !containment->pluginMetaData().isValid()) { + if (!applet->pluginInfo().isValid() || !containment->pluginInfo().isValid()) { return; } - const QString scriptFile = m_lookAndFeelPackage.filePath("plasmoidsetupscripts", applet->pluginMetaData().pluginId() + ".js"); + const QString scriptFile = m_lookAndFeelPackage.filePath("plasmoidsetupscripts", applet->pluginInfo().pluginName() + ".js"); if (scriptFile.isEmpty()) { return; @@ -1557,7 +1579,7 @@ //if creation failed or invalid plugin, give up if (!newContainment) { return oldContainment; - } else if (!newContainment->pluginMetaData().isValid()) { + } else if (!newContainment->pluginInfo().isValid()) { newContainment->deleteLater(); return oldContainment; } @@ -1992,8 +2014,7 @@ for (auto it = m_panelViews.constBegin(), end = m_panelViews.constEnd(); it != end; ++it) { const auto applets = it.key()->applets(); for (auto applet : applets) { - const auto provides = KPluginMetaData::readStringList(applet->pluginMetaData().rawData(), QStringLiteral("X-Plasma-Provides")); - if (provides.contains(QLatin1String("org.kde.plasma.launchermenu"))) { + if (applet->pluginInfo().property("X-Plasma-Provides").toStringList().contains(QStringLiteral("org.kde.plasma.launchermenu"))) { if (!applet->globalShortcut().isEmpty()) { emit applet->activated(); return;