From 6b0977b0b831f0ffdef3d13fc9d1d56bc393bbaf Mon Sep 17 00:00:00 2001 From: AngryGamer Date: Sun, 28 May 2017 16:41:38 -0700 Subject: [PATCH] Fix rapid swapping between two tabs during tab drag and drop. Closes 3328, Fixes #3017, fixes #2771 --- PowerEditor/src/WinControls/TabBar/TabBar.cpp | 11 +++++++++++ PowerEditor/src/WinControls/TabBar/TabBar.h | 1 + 2 files changed, 12 insertions(+) diff --git a/PowerEditor/src/WinControls/TabBar/TabBar.cpp b/PowerEditor/src/WinControls/TabBar/TabBar.cpp index 0980cef4..e4fab7a2 100644 --- a/PowerEditor/src/WinControls/TabBar/TabBar.cpp +++ b/PowerEditor/src/WinControls/TabBar/TabBar.cpp @@ -1194,13 +1194,24 @@ void TabBarPlus::exchangeItemData(POINT point) if (nTab != _nTabDragged) { + if (_previousTabSwapped == nTab) + { + return; + } + exchangeTabItemData(_nTabDragged, nTab); + _previousTabSwapped = _nTabDragged; _nTabDragged = nTab; } + else + { + _previousTabSwapped = -1; + } } else { //::SetCursor(::LoadCursor(_hInst, MAKEINTRESOURCE(IDC_DRAG_TAB))); + _previousTabSwapped = -1; _isDraggingInside = false; } diff --git a/PowerEditor/src/WinControls/TabBar/TabBar.h b/PowerEditor/src/WinControls/TabBar/TabBar.h index 2ed4b006..0790a316 100644 --- a/PowerEditor/src/WinControls/TabBar/TabBar.h +++ b/PowerEditor/src/WinControls/TabBar/TabBar.h @@ -229,6 +229,7 @@ protected: bool _isDraggingInside = false; int _nSrcTab = -1; int _nTabDragged = -1; + int _previousTabSwapped = -1; POINT _draggingPoint; // coordinate of Screen WNDPROC _tabBarDefaultProc = nullptr;