Changeset View
Changeset View
Standalone View
Standalone View
shell/panelview.cpp
Show First 20 Lines • Show All 71 Lines • ▼ Show 20 Line(s) | 70 | if (targetScreen) { | |||
---|---|---|---|---|---|
72 | setScreenToFollow(targetScreen); | 72 | setScreenToFollow(targetScreen); | ||
73 | setScreen(targetScreen); | 73 | setScreen(targetScreen); | ||
74 | } | 74 | } | ||
75 | setResizeMode(QuickViewSharedEngine::SizeRootObjectToView); | 75 | setResizeMode(QuickViewSharedEngine::SizeRootObjectToView); | ||
76 | setClearBeforeRendering(true); | 76 | setClearBeforeRendering(true); | ||
77 | setColor(QColor(Qt::transparent)); | 77 | setColor(QColor(Qt::transparent)); | ||
78 | setFlags(Qt::FramelessWindowHint|Qt::WindowDoesNotAcceptFocus); | 78 | setFlags(Qt::FramelessWindowHint|Qt::WindowDoesNotAcceptFocus); | ||
79 | 79 | | |||
80 | connect(&m_theme, &Plasma::Theme::themeChanged, this, &PanelView::themeChanged); | 80 | connect(&m_theme, &Plasma::Theme::themeChanged, this, &PanelView::updateMask); | ||
81 | connect(this, SIGNAL(backgroundHintsChanged()), this, SLOT(themeChanged())); | 81 | connect(this, &PanelView::backgroundHintsChanged, this, &PanelView::updateMask); | ||
82 | // TODO: add finished/componentComplete signal to QuickViewSharedEngine, | 82 | // TODO: add finished/componentComplete signal to QuickViewSharedEngine, | ||
83 | // so we exactly know when rootobject is available | 83 | // so we exactly know when rootobject is available | ||
84 | connect(this, &QuickViewSharedEngine::statusChanged, | 84 | connect(this, &QuickViewSharedEngine::statusChanged, | ||
85 | this, &PanelView::handleQmlStatusChange); | 85 | this, &PanelView::handleQmlStatusChange); | ||
86 | 86 | | |||
87 | m_positionPaneltimer.setSingleShot(true); | 87 | m_positionPaneltimer.setSingleShot(true); | ||
88 | m_positionPaneltimer.setInterval(150); | 88 | m_positionPaneltimer.setInterval(150); | ||
89 | connect(&m_positionPaneltimer, &QTimer::timeout, this, &PanelView::restore); | 89 | connect(&m_positionPaneltimer, &QTimer::timeout, this, &PanelView::restore); | ||
▲ Show 20 Lines • Show All 651 Lines • ▼ Show 20 Line(s) | |||||
741 | #if PLASMA_VERSION < QT_VERSION_CHECK(5,59,0) | 741 | #if PLASMA_VERSION < QT_VERSION_CHECK(5,59,0) | ||
742 | updateMask(); | 742 | updateMask(); | ||
743 | #endif | 743 | #endif | ||
744 | } | 744 | } | ||
745 | 745 | | |||
746 | void PanelView::integrateScreen() | 746 | void PanelView::integrateScreen() | ||
747 | { | 747 | { | ||
748 | connect(m_screenToFollow.data(), &QScreen::geometryChanged, this, &PanelView::restore); | 748 | connect(m_screenToFollow.data(), &QScreen::geometryChanged, this, &PanelView::restore); | ||
749 | themeChanged(); | 749 | updateMask(); | ||
750 | KWindowSystem::setOnAllDesktops(winId(), true); | 750 | KWindowSystem::setOnAllDesktops(winId(), true); | ||
751 | KWindowSystem::setType(winId(), NET::Dock); | 751 | KWindowSystem::setType(winId(), NET::Dock); | ||
752 | if (m_shellSurface) { | 752 | if (m_shellSurface) { | ||
753 | m_shellSurface->setRole(KWayland::Client::PlasmaShellSurface::Role::Panel); | 753 | m_shellSurface->setRole(KWayland::Client::PlasmaShellSurface::Role::Panel); | ||
754 | m_shellSurface->setSkipTaskbar(true); | 754 | m_shellSurface->setSkipTaskbar(true); | ||
755 | } | 755 | } | ||
756 | setVisibilityMode(m_visibilityMode); | 756 | setVisibilityMode(m_visibilityMode); | ||
757 | 757 | | |||
▲ Show 20 Lines • Show All 197 Lines • ▼ Show 20 Line(s) | 948 | { | |||
955 | QRectF containmentRect(containmentItem->mapToScene(QPoint(0,0)), QSizeF(containmentItem->width(), containmentItem->height())); | 955 | QRectF containmentRect(containmentItem->mapToScene(QPoint(0,0)), QSizeF(containmentItem->width(), containmentItem->height())); | ||
956 | 956 | | |||
957 | return QPointF(qBound(containmentRect.left() + 2, point.x(), containmentRect.right() - 2), | 957 | return QPointF(qBound(containmentRect.left() + 2, point.x(), containmentRect.right() - 2), | ||
958 | qBound(containmentRect.top() + 2, point.y(), containmentRect.bottom() - 2)); | 958 | qBound(containmentRect.top() + 2, point.y(), containmentRect.bottom() - 2)); | ||
959 | } | 959 | } | ||
960 | 960 | | |||
961 | void PanelView::updateMask() | 961 | void PanelView::updateMask() | ||
962 | { | 962 | { | ||
963 | if (m_backgroundHints == Plasma::Types::NoBackground) { | ||||
964 | KWindowEffects::enableBlurBehind(winId(), false); | ||||
965 | KWindowEffects::enableBackgroundContrast(winId(), false); | ||||
966 | } else { | ||||
963 | QRegion mask; | 967 | QRegion mask; | ||
964 | 968 | | |||
965 | QQuickItem *rootObject = this->rootObject(); | 969 | QQuickItem *rootObject = this->rootObject(); | ||
966 | if (rootObject) { | 970 | if (rootObject) { | ||
967 | const QVariant maskProperty = rootObject->property("panelMask"); | 971 | const QVariant maskProperty = rootObject->property("panelMask"); | ||
968 | if (static_cast<QMetaType::Type>(maskProperty.type()) == QMetaType::QRegion) { | 972 | if (static_cast<QMetaType::Type>(maskProperty.type()) == QMetaType::QRegion) { | ||
969 | mask = maskProperty.value<QRegion>(); | 973 | mask = maskProperty.value<QRegion>(); | ||
970 | } | 974 | } | ||
971 | } | 975 | } | ||
972 | 976 | | |||
977 | KWindowEffects::enableBlurBehind(winId(), m_theme.blurBehindEnabled(), mask); | ||||
978 | KWindowEffects::enableBackgroundContrast(winId(), m_theme.backgroundContrastEnabled(), | ||||
979 | m_theme.backgroundContrast(), | ||||
980 | m_theme.backgroundIntensity(), | ||||
981 | m_theme.backgroundSaturation(), | ||||
982 | mask); | ||||
983 | | ||||
984 | if (KWindowSystem::compositingActive()) { | ||||
985 | setMask(QRegion()); | ||||
986 | } else { | ||||
973 | setMask(mask); | 987 | setMask(mask); | ||
974 | } | 988 | } | ||
989 | } | ||||
990 | } | ||||
975 | 991 | | |||
976 | bool PanelView::canSetStrut() const | 992 | bool PanelView::canSetStrut() const | ||
977 | { | 993 | { | ||
978 | #if HAVE_X11 | 994 | #if HAVE_X11 | ||
979 | if (!KWindowSystem::isPlatformX11()) { | 995 | if (!KWindowSystem::isPlatformX11()) { | ||
980 | return true; | 996 | return true; | ||
981 | } | 997 | } | ||
982 | // read the wm name, need to do this every time which means a roundtrip unfortunately | 998 | // read the wm name, need to do this every time which means a roundtrip unfortunately | ||
▲ Show 20 Lines • Show All 124 Lines • ▼ Show 20 Line(s) | 1116 | KWindowSystem::setExtendedStrut(winId(), strut.left_width, | |||
1107 | strut.top_start, | 1123 | strut.top_start, | ||
1108 | strut.top_end, | 1124 | strut.top_end, | ||
1109 | strut.bottom_width, | 1125 | strut.bottom_width, | ||
1110 | strut.bottom_start, | 1126 | strut.bottom_start, | ||
1111 | strut.bottom_end); | 1127 | strut.bottom_end); | ||
1112 | 1128 | | |||
1113 | } | 1129 | } | ||
1114 | 1130 | | |||
1115 | void PanelView::themeChanged() | | |||
1116 | { | | |||
1117 | if (m_backgroundHints == Plasma::Types::NoBackground) { | | |||
1118 | KWindowEffects::enableBlurBehind(winId(), false); | | |||
1119 | KWindowEffects::enableBackgroundContrast(winId(), false); | | |||
1120 | } else { | | |||
1121 | KWindowEffects::enableBlurBehind(winId(), m_theme.blurBehindEnabled()); | | |||
1122 | KWindowEffects::enableBackgroundContrast(winId(), m_theme.backgroundContrastEnabled(), | | |||
1123 | m_theme.backgroundContrast(), | | |||
1124 | m_theme.backgroundIntensity(), | | |||
1125 | m_theme.backgroundSaturation()); | | |||
1126 | } | | |||
1127 | | ||||
1128 | #if PLASMA_VERSION < QT_VERSION_CHECK(5,59,0) | | |||
1129 | updateMask(); | | |||
1130 | #endif | | |||
1131 | } | | |||
1132 | | ||||
1133 | void PanelView::containmentChanged() | 1131 | void PanelView::containmentChanged() | ||
1134 | { | 1132 | { | ||
1135 | restore(); | 1133 | restore(); | ||
1136 | connect(containment(), &Plasma::Containment::userConfiguringChanged, this, [this](bool configuring){ | 1134 | connect(containment(), &Plasma::Containment::userConfiguringChanged, this, [this](bool configuring){ | ||
1137 | if (configuring) { | 1135 | if (configuring) { | ||
1138 | showTemporarily(); | 1136 | showTemporarily(); | ||
1139 | } else { | 1137 | } else { | ||
1140 | m_unhideTimer.start(); | 1138 | m_unhideTimer.start(); | ||
▲ Show 20 Lines • Show All 151 Lines • Show Last 20 Lines |