Fix tab dragging issues under WINE and ReactOS
Fix tab dragging issues on both multiline and single line mode under WINE and ReactOS. Fix #4885, close #5792
This commit is contained in:
parent
4aec70273c
commit
6d3606074a
@ -153,7 +153,8 @@ void TabBar::activateAt(int index) const
|
|||||||
{
|
{
|
||||||
if (getCurrentTabIndex() != index)
|
if (getCurrentTabIndex() != index)
|
||||||
{
|
{
|
||||||
// TCS_BUTTONS needs both set or two tabs can appear selected
|
// TCM_SETCURFOCUS is busted on WINE/ReactOS for single line (non-TCS_BUTTONS) tabs...
|
||||||
|
// We need it on Windows for multi-line tabs or multiple tabs can appear pressed.
|
||||||
if (::GetWindowLongPtr(_hSelf, GWL_STYLE) & TCS_BUTTONS)
|
if (::GetWindowLongPtr(_hSelf, GWL_STYLE) & TCS_BUTTONS)
|
||||||
{
|
{
|
||||||
::SendMessage(_hSelf, TCM_SETCURFOCUS, index, 0);
|
::SendMessage(_hSelf, TCM_SETCURFOCUS, index, 0);
|
||||||
@ -654,8 +655,9 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara
|
|||||||
_nSrcTab = _nTabDragged = tabFocused;
|
_nSrcTab = _nTabDragged = tabFocused;
|
||||||
_isDragging = true;
|
_isDragging = true;
|
||||||
|
|
||||||
// ::SetCapture is required for normal non-TLS_BUTTONS.
|
// TLS_BUTTONS is already captured on Windows and will break on ::SetCapture
|
||||||
if (!(::GetWindowLongPtr(_hSelf, GWL_STYLE) & TCS_BUTTONS))
|
// However, this is not the case for WINE/ReactOS and must ::SetCapture
|
||||||
|
if (::GetCapture() != _hSelf)
|
||||||
{
|
{
|
||||||
::SetCapture(hwnd);
|
::SetCapture(hwnd);
|
||||||
}
|
}
|
||||||
@ -777,7 +779,13 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara
|
|||||||
if (_isDragging)
|
if (_isDragging)
|
||||||
{
|
{
|
||||||
if (::GetCapture() == _hSelf)
|
if (::GetCapture() == _hSelf)
|
||||||
|
{
|
||||||
::ReleaseCapture();
|
::ReleaseCapture();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_isDragging = false;
|
||||||
|
}
|
||||||
|
|
||||||
notify(_isDraggingInside?TCN_TABDROPPED:TCN_TABDROPPEDOUTSIDE, currentTabOn);
|
notify(_isDraggingInside?TCN_TABDROPPED:TCN_TABDROPPEDOUTSIDE, currentTabOn);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -1140,15 +1148,16 @@ void TabBarPlus::draggingCursor(POINT screenPoint)
|
|||||||
|
|
||||||
void TabBarPlus::setActiveTab(int tabIndex)
|
void TabBarPlus::setActiveTab(int tabIndex)
|
||||||
{
|
{
|
||||||
::SendMessage(_hSelf, TCM_SETCURFOCUS, tabIndex, 0);
|
// TCM_SETCURFOCUS is busted on WINE/ReactOS for single line (non-TCS_BUTTONS) tabs...
|
||||||
|
// We need it on Windows for multi-line tabs or multiple tabs can appear pressed.
|
||||||
// the TCS_BUTTONS style does not automatically send TCM_SETCURSEL & TCN_SELCHANGE
|
|
||||||
if (::GetWindowLongPtr(_hSelf, GWL_STYLE) & TCS_BUTTONS)
|
if (::GetWindowLongPtr(_hSelf, GWL_STYLE) & TCS_BUTTONS)
|
||||||
{
|
{
|
||||||
|
::SendMessage(_hSelf, TCM_SETCURFOCUS, tabIndex, 0);
|
||||||
|
}
|
||||||
|
|
||||||
::SendMessage(_hSelf, TCM_SETCURSEL, tabIndex, 0);
|
::SendMessage(_hSelf, TCM_SETCURSEL, tabIndex, 0);
|
||||||
notify(TCN_SELCHANGE, tabIndex);
|
notify(TCN_SELCHANGE, tabIndex);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void TabBarPlus::exchangeTabItemData(int oldTab, int newTab)
|
void TabBarPlus::exchangeTabItemData(int oldTab, int newTab)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user