Changeset View
Changeset View
Standalone View
Standalone View
shell/panelview.cpp
Show All 31 Lines | |||||
32 | #include <QQmlContext> | 32 | #include <QQmlContext> | ||
33 | #include <QGuiApplication> | 33 | #include <QGuiApplication> | ||
34 | #include <QTimer> | 34 | #include <QTimer> | ||
35 | 35 | | |||
36 | #include <kactioncollection.h> | 36 | #include <kactioncollection.h> | ||
37 | #include <kwindowsystem.h> | 37 | #include <kwindowsystem.h> | ||
38 | #include <kwindoweffects.h> | 38 | #include <kwindoweffects.h> | ||
39 | 39 | | |||
40 | #include <plasma_version.h> | ||||
40 | #include <Plasma/Containment> | 41 | #include <Plasma/Containment> | ||
41 | #include <Plasma/Package> | 42 | #include <Plasma/Package> | ||
42 | 43 | | |||
43 | #include <KWayland/Client/plasmashell.h> | 44 | #include <KWayland/Client/plasmashell.h> | ||
44 | #include <KWayland/Client/surface.h> | 45 | #include <KWayland/Client/surface.h> | ||
45 | 46 | | |||
46 | #if HAVE_X11 | 47 | #if HAVE_X11 | ||
47 | #include <xcb/xcb.h> | 48 | #include <xcb/xcb.h> | ||
Show All 25 Lines | 69 | { | |||
73 | } | 74 | } | ||
74 | setResizeMode(QuickViewSharedEngine::SizeRootObjectToView); | 75 | setResizeMode(QuickViewSharedEngine::SizeRootObjectToView); | ||
75 | setClearBeforeRendering(true); | 76 | setClearBeforeRendering(true); | ||
76 | setColor(QColor(Qt::transparent)); | 77 | setColor(QColor(Qt::transparent)); | ||
77 | setFlags(Qt::FramelessWindowHint|Qt::WindowDoesNotAcceptFocus); | 78 | setFlags(Qt::FramelessWindowHint|Qt::WindowDoesNotAcceptFocus); | ||
78 | 79 | | |||
79 | connect(&m_theme, &Plasma::Theme::themeChanged, this, &PanelView::themeChanged); | 80 | connect(&m_theme, &Plasma::Theme::themeChanged, this, &PanelView::themeChanged); | ||
80 | connect(this, SIGNAL(backgroundHintsChanged()), this, SLOT(themeChanged())); | 81 | connect(this, SIGNAL(backgroundHintsChanged()), this, SLOT(themeChanged())); | ||
82 | // TODO: add finished/componentComplete signal to QuickViewSharedEngine, | ||||
83 | // so we exactly know when rootobject is available | ||||
84 | connect(this, &QuickViewSharedEngine::statusChanged, | ||||
85 | this, &PanelView::handleQmlStatusChange); | ||||
81 | 86 | | |||
82 | m_positionPaneltimer.setSingleShot(true); | 87 | m_positionPaneltimer.setSingleShot(true); | ||
83 | m_positionPaneltimer.setInterval(150); | 88 | m_positionPaneltimer.setInterval(150); | ||
84 | connect(&m_positionPaneltimer, &QTimer::timeout, this, &PanelView::restore); | 89 | connect(&m_positionPaneltimer, &QTimer::timeout, this, &PanelView::restore); | ||
85 | 90 | | |||
86 | m_unhideTimer.setSingleShot(true); | 91 | m_unhideTimer.setSingleShot(true); | ||
87 | m_unhideTimer.setInterval(500); | 92 | m_unhideTimer.setInterval(500); | ||
88 | connect(&m_unhideTimer, &QTimer::timeout, | 93 | connect(&m_unhideTimer, &QTimer::timeout, | ||
▲ Show 20 Lines • Show All 629 Lines • ▼ Show 20 Line(s) | 718 | { | |||
718 | if (m_shellSurface) { | 723 | if (m_shellSurface) { | ||
719 | m_shellSurface->setPosition(pos); | 724 | m_shellSurface->setPosition(pos); | ||
720 | } | 725 | } | ||
721 | m_strutsTimer.start(STRUTSTIMERDELAY); | 726 | m_strutsTimer.start(STRUTSTIMERDELAY); | ||
722 | emit m_corona->availableScreenRegionChanged(); | 727 | emit m_corona->availableScreenRegionChanged(); | ||
723 | 728 | | |||
724 | PlasmaQuick::ContainmentView::resizeEvent(ev); | 729 | PlasmaQuick::ContainmentView::resizeEvent(ev); | ||
725 | 730 | | |||
731 | #if PLASMA_VERSION < QT_VERSION_CHECK(5,59,0) | ||||
726 | updateMask(); | 732 | updateMask(); | ||
733 | #endif | ||||
727 | } | 734 | } | ||
728 | 735 | | |||
729 | void PanelView::moveEvent(QMoveEvent *ev) | 736 | void PanelView::moveEvent(QMoveEvent *ev) | ||
730 | { | 737 | { | ||
731 | updateEnabledBorders(); | 738 | updateEnabledBorders(); | ||
732 | m_strutsTimer.start(STRUTSTIMERDELAY); | 739 | m_strutsTimer.start(STRUTSTIMERDELAY); | ||
733 | PlasmaQuick::ContainmentView::moveEvent(ev); | 740 | PlasmaQuick::ContainmentView::moveEvent(ev); | ||
741 | #if PLASMA_VERSION < QT_VERSION_CHECK(5,59,0) | ||||
734 | updateMask(); | 742 | updateMask(); | ||
743 | #endif | ||||
735 | } | 744 | } | ||
736 | 745 | | |||
737 | void PanelView::integrateScreen() | 746 | void PanelView::integrateScreen() | ||
738 | { | 747 | { | ||
739 | connect(m_screenToFollow.data(), &QScreen::geometryChanged, this, &PanelView::restore); | 748 | connect(m_screenToFollow.data(), &QScreen::geometryChanged, this, &PanelView::restore); | ||
740 | themeChanged(); | 749 | themeChanged(); | ||
741 | KWindowSystem::setOnAllDesktops(winId(), true); | 750 | KWindowSystem::setOnAllDesktops(winId(), true); | ||
742 | KWindowSystem::setType(winId(), NET::Dock); | 751 | KWindowSystem::setType(winId(), NET::Dock); | ||
▲ Show 20 Lines • Show All 368 Lines • ▼ Show 20 Line(s) | 1116 | { | |||
1111 | } else { | 1120 | } else { | ||
1112 | KWindowEffects::enableBlurBehind(winId(), m_theme.blurBehindEnabled()); | 1121 | KWindowEffects::enableBlurBehind(winId(), m_theme.blurBehindEnabled()); | ||
1113 | KWindowEffects::enableBackgroundContrast(winId(), m_theme.backgroundContrastEnabled(), | 1122 | KWindowEffects::enableBackgroundContrast(winId(), m_theme.backgroundContrastEnabled(), | ||
1114 | m_theme.backgroundContrast(), | 1123 | m_theme.backgroundContrast(), | ||
1115 | m_theme.backgroundIntensity(), | 1124 | m_theme.backgroundIntensity(), | ||
1116 | m_theme.backgroundSaturation()); | 1125 | m_theme.backgroundSaturation()); | ||
1117 | } | 1126 | } | ||
1118 | 1127 | | |||
1128 | #if PLASMA_VERSION < QT_VERSION_CHECK(5,59,0) | ||||
1119 | updateMask(); | 1129 | updateMask(); | ||
1130 | #endif | ||||
1120 | } | 1131 | } | ||
1121 | 1132 | | |||
1122 | void PanelView::containmentChanged() | 1133 | void PanelView::containmentChanged() | ||
1123 | { | 1134 | { | ||
1124 | restore(); | 1135 | restore(); | ||
1125 | connect(containment(), &Plasma::Containment::userConfiguringChanged, this, [this](bool configuring){ | 1136 | connect(containment(), &Plasma::Containment::userConfiguringChanged, this, [this](bool configuring){ | ||
1126 | if (configuring) { | 1137 | if (configuring) { | ||
1127 | showTemporarily(); | 1138 | showTemporarily(); | ||
Show All 15 Lines | 1152 | if (grp.contains(QRegExp(QStringLiteral("Panel ") + QString::number(containment()->id()) + QStringLiteral("$")))) { | |||
1143 | views.deleteGroup(grp); | 1154 | views.deleteGroup(grp); | ||
1144 | } | 1155 | } | ||
1145 | views.sync(); | 1156 | views.sync(); | ||
1146 | } | 1157 | } | ||
1147 | } | 1158 | } | ||
1148 | }); | 1159 | }); | ||
1149 | } | 1160 | } | ||
1150 | 1161 | | |||
1162 | void PanelView::handleQmlStatusChange(QQmlComponent::Status status) | ||||
1163 | { | ||||
1164 | if (status != QQmlComponent::Ready) { | ||||
1165 | return; | ||||
1166 | } | ||||
1167 | | ||||
1168 | QQuickItem *rootObject = this->rootObject(); | ||||
1169 | if (rootObject) { | ||||
1170 | disconnect(this, &QuickViewSharedEngine::statusChanged, | ||||
1171 | this, &PanelView::handleQmlStatusChange); | ||||
1172 | | ||||
1173 | const QVariant maskProperty = rootObject->property("panelMask"); | ||||
1174 | if (static_cast<QMetaType::Type>(maskProperty.type()) == QMetaType::QRegion) { | ||||
1175 | connect(rootObject, SIGNAL(panelMaskChanged()), | ||||
1176 | this, SLOT(updateMask())); | ||||
1177 | updateMask(); | ||||
1178 | } | ||||
1179 | } | ||||
1180 | } | ||||
1181 | | ||||
1151 | void PanelView::statusChanged(Plasma::Types::ItemStatus status) | 1182 | void PanelView::statusChanged(Plasma::Types::ItemStatus status) | ||
1152 | { | 1183 | { | ||
1153 | if (status == Plasma::Types::NeedsAttentionStatus) { | 1184 | if (status == Plasma::Types::NeedsAttentionStatus) { | ||
1154 | showTemporarily(); | 1185 | showTemporarily(); | ||
1155 | } else if (status == Plasma::Types::AcceptingInputStatus) { | 1186 | } else if (status == Plasma::Types::AcceptingInputStatus) { | ||
1156 | KWindowSystem::forceActiveWindow(winId()); | 1187 | KWindowSystem::forceActiveWindow(winId()); | ||
1157 | } else { | 1188 | } else { | ||
1158 | restoreAutoHide(); | 1189 | restoreAutoHide(); | ||
▲ Show 20 Lines • Show All 102 Lines • Show Last 20 Lines |