Skip to content

Improve tab reordering#1293

Merged
mintty merged 2 commits into
mintty:masterfrom
k-takata:improve-tab-reordering
Oct 17, 2024
Merged

Improve tab reordering#1293
mintty merged 2 commits into
mintty:masterfrom
k-takata:improve-tab-reordering

Conversation

@k-takata

Copy link
Copy Markdown
Contributor

The old implementation didn't correctly detect the end of dragging if
the left mouse button was released out of the tab bar. Sometimes, tabs
were highlighted unintentionally. Or even crashes occurred.

  • Use SetCapture()/ReleaseCapture() to detect the end of dragging.
  • Change the mouse cursor while dragging.
  • Change the tab order in real-time.

The old implementation didn't correctly detect the end of dragging if
the left mouse button was released out of the tab bar.  Sometimes, tabs
were highlighted unintentionally. Or even crashes occurred.

* Use SetCapture()/ReleaseCapture() to detect the end of dragging.
* Change the mouse cursor while dragging.
* Change the tab order in real-time.
@mintty mintty merged commit 95899c4 into mintty:master Oct 17, 2024
@mintty

mintty commented Oct 17, 2024

Copy link
Copy Markdown
Owner

Thank you very much for handling issues that I hadn't noticed, and improving more.
I'm however missing somehow the dynamic colour background feedback in the tabbar which I liked (part of code that you removed).

@k-takata k-takata deleted the improve-tab-reordering branch October 17, 2024 11:09
@k-takata

Copy link
Copy Markdown
Contributor Author

When I use gVim, the tab is highlighted in pale blue when the mouse cursor hovers over it.
GVim uses the default tab control, so I'm not sure why it doesn't occur on mintty.
Let me check if I can add highlights.

@mintty

mintty commented Oct 17, 2024

Copy link
Copy Markdown
Owner

Not sure whether we're talking about the same thing, and how vim would be involved.
The current tab is always highlighted, yes. When click-and-dragging, in my previous implementation, while dragging over other tabs, their tabbar colour would change from normal to dark blue gradually, with a peak in the middle.

@k-takata

Copy link
Copy Markdown
Contributor Author

and how vim would be involved.

This is because I was referring to Vim's code when I implemented this PR:
https://github.com/vim/vim/blob/6c2fc377bfbfb6f1a46b1061413cd21116b596ed/src/gui_w32.c#L8420
(partly implemented by me)

When click-and-dragging, in my previous implementation, while dragging over other tabs, their tabbar colour would change from normal to dark blue gradually, with a peak in the middle.

In my implementation, tabs are reordered soon if the mouse cursor goes over another tab. So, there might be no chance to set the background color. If we set a threshold for it, setting the color might be possible.
(The above Vim implementation has a threshold, though.)

@mintty

mintty commented Oct 23, 2024

Copy link
Copy Markdown
Owner

I have reactived dynamic tab highlighting. First I fixed the crash condition, then I adapted the approach to the new paradigm of dropping tabs right away while dragging. The dynamic colouring is a substitute of dynamic visual tab placement as other applications (browsers) do. Colour could be chosen to something different, see comments after line 360.
I'd appreciate if you check this.

@k-takata

Copy link
Copy Markdown
Contributor Author

I've tried your latest commit. It works fine. Thank you for revising my PR.

Comment thread src/wintab.c
}
else if (HIWORD(lp) == WM_LBUTTONUP) {
// drop tab while dragging for tab reordering
if (abs(p.x - xpos) > GetSystemMetrics(SM_CXDRAG)) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For better high DPI support, it might be better to use pGetSystemMetricsForDpi() instead of GetSystemMetrics().

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds proper in theory but it doesn't seem to make a difference. Checking my previous use of the Dpi version I did some tests with it but it's currently not in use anywhere in mintty.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds proper in theory but it doesn't seem to make a difference.

GetSystemMetrics(SM_CXDRAG) normally returns a small value (e.g. 3). Even if the value is multiplied by the DPI ratio, it will be still small. So, it might be difficult to notice the difference.

@mintty

mintty commented Nov 1, 2024

Copy link
Copy Markdown
Owner

I added the value to the debug output (winmain.c line 3071) and values were the same for me (switching between 125% and 175% zoom factor).

@k-takata

k-takata commented Nov 1, 2024

Copy link
Copy Markdown
Contributor Author

Oh, you are correct. I didn't know that some values are unaffected by the DPI ratio.

@mintty

mintty commented Dec 19, 2024

Copy link
Copy Markdown
Owner

I've further enhanced tab dragging by swiping the tab button. Comments welcome.
I couldn't swipe the border though - it seems to be drawn implicitly.

@mintty

mintty commented Dec 20, 2024

Copy link
Copy Markdown
Owner

I also changed the tab colour while dragging. Planning a release this weekend.

@mintty

mintty commented Dec 21, 2024

Copy link
Copy Markdown
Owner

Released 3.7.7.

qdzhaov added a commit to qdzhaov/mintty that referenced this pull request Jan 1, 2025
merge from b9e097b
commit b9e097b  Dec 26 2024
    fix overhang rendering for some characters, clipped in 3.7.7 (mintty#1304)
commit 392b44a  Dec 21 2024
    3.7.7
commit 34db7bc  Dec 21 2024
commit 8ffad55  Dec 19 2024
    virtual transparency: fix background offset with options Scrollbar=left or BorderStyle=frame/void (mintty#1296)
commit b8148bb  Dec 19 2024
    swipe visualisation of tab reorder dragging (~mintty#1293)
commit fce7f18  Dec 17 2024
    image background: enhance updating when desktop background is changed (mintty#1296)
commit 02e2266  Dec 16 2024
    image background: keep updated while moving/resizing
commit eb6ead7  Dec 15 2024
    virtual transparency: fix desktop background offset, adjust brush (mintty#1296)
commit d227ec8  Dec 15 2024
    wiki: describe tweaked emoji width mode
commit e0d8b4e  Dec 15 2024
    wiki: hints on Paste protection (mintty#777)
commit e6b69f0  Dec 11 2024
    fix distinction of ZWJ emoji vs other occurence
commit c2e2d35  Dec 10 2024
    tweak debug_win_text_invocation
commit f2ee904  Dec 5 2024
    VT52 emulation absolute position keeps row/column if out-of-bounds (mintty#1299)
commit 995c45d  Dec 2 2024
    neutralise mysterious compilation bug since gcc 14
qdzhaov added a commit to qdzhaov/mintty that referenced this pull request Jan 1, 2025
merge from b9e097b
commit b9e097b  Dec 26 2024
    fix overhang rendering for some characters, clipped in 3.7.7 (mintty#1304)
commit 392b44a  Dec 21 2024
    3.7.7
commit 34db7bc  Dec 21 2024
commit 8ffad55  Dec 19 2024
    virtual transparency: fix background offset with options Scrollbar=left or BorderStyle=frame/void (mintty#1296)
commit b8148bb  Dec 19 2024
    swipe visualisation of tab reorder dragging (~mintty#1293)
commit fce7f18  Dec 17 2024
    image background: enhance updating when desktop background is changed (mintty#1296)
commit 02e2266  Dec 16 2024
    image background: keep updated while moving/resizing
commit eb6ead7  Dec 15 2024
    virtual transparency: fix desktop background offset, adjust brush (mintty#1296)
commit d227ec8  Dec 15 2024
    wiki: describe tweaked emoji width mode
commit e0d8b4e  Dec 15 2024
    wiki: hints on Paste protection (mintty#777)
commit e6b69f0  Dec 11 2024
    fix distinction of ZWJ emoji vs other occurence
commit c2e2d35  Dec 10 2024
    tweak debug_win_text_invocation
commit f2ee904  Dec 5 2024
    VT52 emulation absolute position keeps row/column if out-of-bounds (mintty#1299)
commit 995c45d  Dec 2 2024
    neutralise mysterious compilation bug since gcc 14
qdzhaov added a commit to qdzhaov/mintty that referenced this pull request Jan 1, 2025
merge from b9e097b
commit b9e097b  Dec 26 2024
    fix overhang rendering for some characters, clipped in 3.7.7 (mintty#1304)
commit 392b44a  Dec 21 2024
    3.7.7
commit 34db7bc  Dec 21 2024
commit 8ffad55  Dec 19 2024
    virtual transparency: fix background offset with options Scrollbar=left or BorderStyle=frame/void (mintty#1296)
commit b8148bb  Dec 19 2024
    swipe visualisation of tab reorder dragging (~mintty#1293)
commit fce7f18  Dec 17 2024
    image background: enhance updating when desktop background is changed (mintty#1296)
commit 02e2266  Dec 16 2024
    image background: keep updated while moving/resizing
commit eb6ead7  Dec 15 2024
    virtual transparency: fix desktop background offset, adjust brush (mintty#1296)
commit d227ec8  Dec 15 2024
    wiki: describe tweaked emoji width mode
commit e0d8b4e  Dec 15 2024
    wiki: hints on Paste protection (mintty#777)
commit e6b69f0  Dec 11 2024
    fix distinction of ZWJ emoji vs other occurence
commit c2e2d35  Dec 10 2024
    tweak debug_win_text_invocation
commit f2ee904  Dec 5 2024
    VT52 emulation absolute position keeps row/column if out-of-bounds (mintty#1299)
commit 995c45d  Dec 2 2024
    neutralise mysterious compilation bug since gcc 14
qdzhaov added a commit to qdzhaov/mintty that referenced this pull request Jan 1, 2025
merge from b9e097b
commit b9e097b  Dec 26 2024
    fix overhang rendering for some characters, clipped in 3.7.7 (mintty#1304)
commit 392b44a  Dec 21 2024
    3.7.7
commit 34db7bc  Dec 21 2024
commit 8ffad55  Dec 19 2024
    virtual transparency: fix background offset with options Scrollbar=left or BorderStyle=frame/void (mintty#1296)
commit b8148bb  Dec 19 2024
    swipe visualisation of tab reorder dragging (~mintty#1293)
commit fce7f18  Dec 17 2024
    image background: enhance updating when desktop background is changed (mintty#1296)
commit 02e2266  Dec 16 2024
    image background: keep updated while moving/resizing
commit eb6ead7  Dec 15 2024
    virtual transparency: fix desktop background offset, adjust brush (mintty#1296)
commit d227ec8  Dec 15 2024
    wiki: describe tweaked emoji width mode
commit e0d8b4e  Dec 15 2024
    wiki: hints on Paste protection (mintty#777)
commit e6b69f0  Dec 11 2024
    fix distinction of ZWJ emoji vs other occurence
commit c2e2d35  Dec 10 2024
    tweak debug_win_text_invocation
commit f2ee904  Dec 5 2024
    VT52 emulation absolute position keeps row/column if out-of-bounds (mintty#1299)
commit 995c45d  Dec 2 2024
    neutralise mysterious compilation bug since gcc 14
@mintty

mintty commented Aug 22, 2025

Copy link
Copy Markdown
Owner

Released 3.8.0. Fixed colour glitches in the visual feedback during tab reordering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants