Skip to content

Commit f554df9

Browse files
Fixed FloatingDockContainer.cpp to properly post the dragging start event
1 parent 7f58877 commit f554df9

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

src/AutoHideDockContainer.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -529,16 +529,6 @@ bool CAutoHideDockContainer::eventFilter(QObject* watched, QEvent* event)
529529
// should get collapsed
530530
collapseView(true);
531531
}
532-
else if (event->type() == QEvent::NonClientAreaMouseButtonPress)
533-
{
534-
// If the user starts dragging a floating widget, then we collapse
535-
// the auto hide widget
536-
CFloatingDockContainer* FloatingWidget = qobject_cast<CFloatingDockContainer*>(watched);
537-
if (FloatingWidget)
538-
{
539-
collapseView(true);
540-
}
541-
}
542532
else if (event->type() == internal::FloatingWidgetDragStartEvent)
543533
{
544534
collapseView(true);

src/FloatingDockContainer.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,13 +404,20 @@ struct FloatingDockContainerPrivate
404404
return StateId == DraggingState;
405405
}
406406

407+
/**
408+
* Sets the dragging state and posts a FloatingWidgetDragStartEvent
409+
* if dragging starts
410+
*/
407411
void setState(eDragState StateId)
408412
{
409-
auto OldState = DraggingState;
413+
if (DraggingState == StateId)
414+
{
415+
return;
416+
}
417+
410418
DraggingState = StateId;
411-
if (DraggingInactive == OldState && DraggingFloatingWidget == DraggingState)
419+
if (DraggingFloatingWidget == DraggingState)
412420
{
413-
qDebug() << "Start dragging floating widget " << internal::FloatingWidgetDragStartEvent;
414421
qApp->postEvent(DockManager, new QEvent((QEvent::Type)internal::FloatingWidgetDragStartEvent));
415422
}
416423
}

src/ads_globals.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ namespace ads
5050

5151
namespace internal
5252
{
53+
const int FloatingWidgetDragStartEvent = QEvent::registerEventType();
5354
#ifdef Q_OS_LINUX
5455
static QString _window_manager;
5556
static QHash<QString, xcb_atom_t> _xcb_atom_cache;
56-
const int FloatingWidgetDragStartEvent = QEvent::registerEventType();
5757

5858

5959
//============================================================================

0 commit comments

Comments
 (0)