From 694fd80fa5abccc80921d2d05490e36cb37698d2 Mon Sep 17 00:00:00 2001 From: AngryGamer Date: Tue, 6 Jun 2017 03:28:13 -0700 Subject: [PATCH] Fix visual glitchy on clicking on tab due to Document Peeker. Closes #3367 --- PowerEditor/src/WinControls/TabBar/TabBar.cpp | 27 +++++-------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/PowerEditor/src/WinControls/TabBar/TabBar.cpp b/PowerEditor/src/WinControls/TabBar/TabBar.cpp index e4fab7a2..c588bdaa 100644 --- a/PowerEditor/src/WinControls/TabBar/TabBar.cpp +++ b/PowerEditor/src/WinControls/TabBar/TabBar.cpp @@ -598,26 +598,7 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara if (_doDragNDrop) { - // ::DragDetect does not work with TCS_BUTTONS - if (::GetWindowLongPtr(_hSelf, GWL_STYLE) & TCS_BUTTONS) - { - _mightBeDragging = true; - } - else - { - _nSrcTab = _nTabDragged = currentTabOn; - - POINT point; - point.x = LOWORD(lParam); - point.y = HIWORD(lParam); - ::ClientToScreen(hwnd, &point); - if(::DragDetect(hwnd, point)) - { - // Yes, we're beginning to drag, so capture the mouse... - _isDragging = true; - ::SetCapture(hwnd); - } - } + _mightBeDragging = true; } notify(NM_CLICK, currentTabOn); @@ -658,6 +639,12 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara _nSrcTab = _nTabDragged = tabFocused; _isDragging = true; + + // ::SetCapture is required for normal non-TLS_BUTTONS. + if (!(::GetWindowLongPtr(_hSelf, GWL_STYLE) & TCS_BUTTONS)) + { + ::SetCapture(hwnd); + } } }