-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix tab row doesn't grow #3347
Fix tab row doesn't grow #3347
Conversation
Anyone else notice the header text getting cut off in the gifs you posted? (not related to this issue I know) |
…ix-tabrow-resize
@greg904 So I think initially we had some reluctance to merge this PR, since there 's some plans we've been throwing around to refactor how AppHost and TerminalApp own the titlebar. However, this is still goodness, and the refactoring probably won't happen for a while. So we should just get this in now, and deal with refactoring later. I'll start reviewing this now. Looks like there's a fair amount of merge conflicts (probably from #3394), if you want to get started on resolving those. Sorry for the delay 😔 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a lot of thoughts here:
- I miss the abstraction that the TitlebarControl is just something that could hold any content, and we just so happen to be putting a TabRowControl there. I suppose the theoretical plans to re-use this work elsewhere never really panned out, but still, it was a nice abstraction.
- I dislike this bug more than I like that abstraction
- I'm glad to be rid of the
MaxWidth
hack, even if this doesn't fix Terminal crashes when dragged to another monitor #3303 - Let's get this merged 😀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @greg904! Thanks for looking into this, and sorry it took us forever to review.
We're tracking the original issue upstream in WinUI now, which is great... but I'm going to hold this PR until we know whether upstream can fix it for us. We shouldn't need to work too hard to get around their layout issues. 😄
FWIW, this is microsoft/microsoft-ui-xaml#1581 |
Ok. BTW if the bug is fixed upstream, then this maybe this is still good because it makes the code cleaner IMO (it's subjective of course). It's also more like the docs: https://docs.microsoft.com/en-us/windows/uwp/design/controls-and-patterns/tab-view#display-tabview-tabs-in-a-windows-titlebar. In that case I could rename the PR to "Refactor title bar : put drag region inside tab row and remove useless code". |
@greg904 I personally owe you an apology here, as I've been the one holding up this pull request. I'm sorry. My major concern is perhaps academic: Our original design for NonClientIslandWindow was that it would contain a Now, no initial battle plan survives first contact with the enemy. That much I get. I do wonder, though, if there's a different design that brings us even closer to the [1]: we've been entertaining the idea of working with the WinUI 3.0 folks to turn this into an official Xaml hosting edifice for consumers who want to draw in the non-client area, or at least contribute to the design of one. |
Ok. No worries for the delay. I don't really know XAML and UWP unfortunately, this PR is definitely not the best way to do things. It looks like the issue will be fixed upstream microsoft/microsoft-ui-xaml#1744 so I should close it now. |
Summary of the Pull Request
Fix the bug where resizing the window to a smaller size makes the tab row shrink but it doesn't grows back to its original size when the window is resized to its original size.
References
PR Checklist
Detailed Description of the Pull Request / Additional comments
I don't really understand the bug but I managed to solve it by changing things so I don't know if this is a good PR.
Anyways, here is how I fixed the bug:
We need to make sure that both the tab row and the drag bar grow as much as they can, but we give priority to the tab row.
Before, the solution was to manually set the tab row's maximum size by taking the title bar's size and subtracting the drag bar and min-max-close buttons' size.
I think I found a better solution that for some reason fixes this bug: I decided to put the drag bar inside the tab row and let the tab row extend as much as it can.
Other changes:
TabRowControl::OnNewTabButtonClick
because it was not used anywhere (the TerminalPage listens for the click itself)? I can add it back or make a separate PR if needed.TitleBar::DragBar_DoubleTapped
into theTabRowControl
but I ran the terminal and it worked without it. So I just removed it and double click to maximize still works. MaybeDefWindowProc
is already implementing double click on title bar to maximize based on whatWM_NCHITTEST
returns? I tried returningHTNOWHERE
everytime forWM_NCHITTEST
and the double click on title bar to maximize no longer worked. Also, when I put a breakpoint inTitleBar::DragBar_DoubleTapped
, I found that it was not even called anyways. EDIT:TitleBar::DragBar_DoubleTapped
is not called because the Xaml doesn't handle the drag bar because of Apply a GDI region to the top level Island window to allow dragging with a single Xaml Island #929.Validation Steps Performed
I checked if it was fixed.
Before:
After: