testing approach
This commit is contained in:
parent
cf0089e100
commit
b989e4b7f0
4 changed files with 345 additions and 4 deletions
|
|
@ -0,0 +1,112 @@
|
|||
diff -ruN a/shell/panelview.cpp b/shell/panelview.cpp
|
||||
--- a/shell/panelview.cpp 2026-04-08 06:33:10.000000000 -0300
|
||||
+++ b/shell/panelview.cpp 2026-07-03 21:54:49.238018607 -0300
|
||||
@@ -1364,6 +1364,37 @@
|
||||
}
|
||||
}
|
||||
|
||||
+void PanelView::setPanelAnimating(bool animating)
|
||||
+{
|
||||
+ if (!KX11Extras::compositingActive()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ auto *x11App = qGuiApp->nativeInterface<QNativeInterface::QX11Application>();
|
||||
+ if (!x11App) {
|
||||
+ return;
|
||||
+ }
|
||||
+ xcb_connection_t *connection = x11App->connection();
|
||||
+ if (m_panelAnimatingAtom == XCB_ATOM_NONE) {
|
||||
+ constexpr QByteArrayView atomName("_SONIC_WM_PANEL_ANIMATING");
|
||||
+ xcb_intern_atom_cookie_t cookie = xcb_intern_atom_unchecked(connection, false, atomName.length(), atomName.constData());
|
||||
+ xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(connection, cookie, nullptr);
|
||||
+ if (reply) {
|
||||
+ m_panelAnimatingAtom = reply->atom;
|
||||
+ free(reply);
|
||||
+ }
|
||||
+ }
|
||||
+ if (m_panelAnimatingAtom == XCB_ATOM_NONE) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (animating) {
|
||||
+ uint32_t value = 1;
|
||||
+ xcb_change_property(connection, XCB_PROP_MODE_REPLACE, winId(), m_panelAnimatingAtom, XCB_ATOM_CARDINAL, 32, 1, &value);
|
||||
+ } else {
|
||||
+ xcb_delete_property(connection, winId(), m_panelAnimatingAtom);
|
||||
+ }
|
||||
+ xcb_flush(connection);
|
||||
+}
|
||||
+
|
||||
bool PanelView::canSetStrut() const
|
||||
{
|
||||
// read the wm name, need to do this every time which means a roundtrip unfortunately
|
||||
@@ -1587,10 +1618,10 @@
|
||||
return;
|
||||
}
|
||||
m_floatingness = get<double>(value);
|
||||
- positionAndResizePanel();
|
||||
});
|
||||
connect(&m_floatingnessAnimation, &QPropertyAnimation::finished, rootObject, [this]() {
|
||||
- updateMask();
|
||||
+ setPanelAnimating(false);
|
||||
+ positionAndResizePanel();
|
||||
});
|
||||
connect(rootObject, SIGNAL(minPanelHeightChanged()), this, SLOT(updatePadding()));
|
||||
connect(rootObject, SIGNAL(minPanelWidthChanged()), this, SLOT(updatePadding()));
|
||||
@@ -1784,12 +1815,24 @@
|
||||
m_topFloatingPadding = rootObject()->property("fixedTopFloatingPadding").toInt();
|
||||
m_bottomFloatingPadding = rootObject()->property("fixedBottomFloatingPadding").toInt();
|
||||
|
||||
+ const bool instantAnimation = m_floatingnessAnimation.duration() == 0;
|
||||
+ if (instantAnimation) {
|
||||
+ // Skip the animation; jump straight to the target value.
|
||||
+ m_floatingness = m_floatingnessAnimation.endValue().toDouble();
|
||||
+ rootObject()->setProperty("floatingness", m_floatingness);
|
||||
+ }
|
||||
+
|
||||
positionAndResizePanel();
|
||||
updateExclusiveZone();
|
||||
updateShadows();
|
||||
|
||||
// positionPanel and updateMask are called by m_floatingnessAnimation
|
||||
if (m_floatingnessAnimation.targetObject()) {
|
||||
+ if (instantAnimation) {
|
||||
+ updateMask();
|
||||
+ return;
|
||||
+ }
|
||||
+ setPanelAnimating(true);
|
||||
m_floatingnessAnimation.start();
|
||||
}
|
||||
}
|
||||
diff -ruN a/shell/panelview.h b/shell/panelview.h
|
||||
--- a/shell/panelview.h 2026-04-08 06:33:10.000000000 -0300
|
||||
+++ b/shell/panelview.h 2026-07-03 20:50:54.914625829 -0300
|
||||
@@ -8,10 +8,13 @@
|
||||
|
||||
#include <Plasma/Theme>
|
||||
#include <QPointer>
|
||||
+#include <QAbstractAnimation>
|
||||
#include <QPropertyAnimation>
|
||||
#include <QTimer>
|
||||
#include <QWindow> // For WId
|
||||
|
||||
+#include <xcb/xcb.h>
|
||||
+
|
||||
#include <KSvg/FrameSvg>
|
||||
#include <kwindoweffects.h>
|
||||
|
||||
@@ -307,6 +310,7 @@
|
||||
void handleQmlStatusChange(QQmlComponent::Status status);
|
||||
void updateMask();
|
||||
void updateEnabledBorders();
|
||||
+ void setPanelAnimating(bool animating);
|
||||
void updatePadding();
|
||||
void updateFloating();
|
||||
void updateFloatingAnimationDuration();
|
||||
@@ -363,6 +367,7 @@
|
||||
LengthMode m_lengthMode;
|
||||
Plasma::Theme m_theme;
|
||||
QTimer m_unhideTimer;
|
||||
+ xcb_atom_t m_panelAnimatingAtom = XCB_ATOM_NONE;
|
||||
Plasma::Types::BackgroundHints m_backgroundHints;
|
||||
KSvg::FrameSvg::EnabledBorders m_enabledBorders = KSvg::FrameSvg::AllBorders;
|
||||
QPointer<QScreen> m_lastScreen;
|
||||
Loading…
Add table
Add a link
Reference in a new issue