From f554df9e7a183eb2ff5a6f370054816c6894c81c Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Tue, 15 Nov 2022 09:28:23 +0100 Subject: [PATCH] Fixed FloatingDockContainer.cpp to properly post the dragging start event --- src/AutoHideDockContainer.cpp | 10 ---------- src/FloatingDockContainer.cpp | 13 ++++++++++--- src/ads_globals.cpp | 2 +- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/AutoHideDockContainer.cpp b/src/AutoHideDockContainer.cpp index c63e17c..8376891 100644 --- a/src/AutoHideDockContainer.cpp +++ b/src/AutoHideDockContainer.cpp @@ -529,16 +529,6 @@ bool CAutoHideDockContainer::eventFilter(QObject* watched, QEvent* event) // should get collapsed collapseView(true); } - else if (event->type() == QEvent::NonClientAreaMouseButtonPress) - { - // If the user starts dragging a floating widget, then we collapse - // the auto hide widget - CFloatingDockContainer* FloatingWidget = qobject_cast(watched); - if (FloatingWidget) - { - collapseView(true); - } - } else if (event->type() == internal::FloatingWidgetDragStartEvent) { collapseView(true); diff --git a/src/FloatingDockContainer.cpp b/src/FloatingDockContainer.cpp index 6de5904..ffdfda4 100644 --- a/src/FloatingDockContainer.cpp +++ b/src/FloatingDockContainer.cpp @@ -404,13 +404,20 @@ struct FloatingDockContainerPrivate return StateId == DraggingState; } + /** + * Sets the dragging state and posts a FloatingWidgetDragStartEvent + * if dragging starts + */ void setState(eDragState StateId) { - auto OldState = DraggingState; + if (DraggingState == StateId) + { + return; + } + DraggingState = StateId; - if (DraggingInactive == OldState && DraggingFloatingWidget == DraggingState) + if (DraggingFloatingWidget == DraggingState) { - qDebug() << "Start dragging floating widget " << internal::FloatingWidgetDragStartEvent; qApp->postEvent(DockManager, new QEvent((QEvent::Type)internal::FloatingWidgetDragStartEvent)); } } diff --git a/src/ads_globals.cpp b/src/ads_globals.cpp index 29743fc..c2e4681 100644 --- a/src/ads_globals.cpp +++ b/src/ads_globals.cpp @@ -50,10 +50,10 @@ namespace ads namespace internal { +const int FloatingWidgetDragStartEvent = QEvent::registerEventType(); #ifdef Q_OS_LINUX static QString _window_manager; static QHash _xcb_atom_cache; -const int FloatingWidgetDragStartEvent = QEvent::registerEventType(); //============================================================================