Skip to content

Commit

Permalink
Update the dragbar when the titlebar content size changes (#4845)
Browse files Browse the repository at this point in the history
## Summary of the Pull Request

Add a `SizeChanged` handler to the titlebar content UI element. It's possible that this element's size will change after the dragbar's. When that happens, the drag bar won't send another `SizeChanged` event, because the dragbar's _size_ didn't change, only it's position.

## References

We originally duped this issue to #4166, but after #4829 fixed that issue, this one persisted. They're all related, and _look_ like dupes, but they weren't.

## PR Checklist
* [x] Closes #4288
* [x] I work here
* [ ] Tests added/passed
* [n/a] Requires documentation to be updated

## Detailed Description of the Pull Request / Additional comments

## Validation Steps Performed

I had a solid 100% repro that doesn't repro anymore.

I've maximized, restored, resized, and generally played with the window a bunch.
  • Loading branch information
zadjii-msft authored and carlos-zamora committed Mar 10, 2020
1 parent 55a6cee commit 62e424f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/cascadia/WindowsTerminal/NonClientIslandWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,16 @@ void NonClientIslandWindow::SetContent(winrt::Windows::UI::Xaml::UIElement conte
void NonClientIslandWindow::SetTitlebarContent(winrt::Windows::UI::Xaml::UIElement content)
{
_titlebar.Content(content);

// GH#4288 - add a SizeChanged handler to this content. It's possible that
// this element's size will change after the dragbar's. When that happens,
// the drag bar won't send another SizeChanged event, because the dragbar's
// _size_ didn't change, only it's position.
const auto fwe = content.try_as<winrt::Windows::UI::Xaml::FrameworkElement>();
if (fwe)
{
fwe.SizeChanged({ this, &NonClientIslandWindow::_OnDragBarSizeChanged });
}
}

// Method Description:
Expand Down

0 comments on commit 62e424f

Please sign in to comment.