Skip to content

Commit

Permalink
now this works!
Browse files Browse the repository at this point in the history
  • Loading branch information
zadjii-msft committed May 7, 2021
1 parent 6e031e5 commit 47410c9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/cascadia/TerminalControl/TermControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1537,8 +1537,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation

if (auto ap{ _automationPeer.get() })
{
auto controlOrigin{ ActualOffset() };
ap.SetControlBounds(Windows::Foundation::Rect{ controlOrigin.x, controlOrigin.y, newSize.Width, newSize.Height });
ap.UpdateControlBounds();
}
}

Expand Down
11 changes: 6 additions & 5 deletions src/cascadia/TerminalControl/TermControlAutomationPeer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ namespace winrt::Microsoft::Terminal::Control::implementation
_termControl{ owner },
_implementation{ impl }
{
auto controlOrigin{ owner->ActualOffset() };
auto controlSize{ owner->ActualSize() };
impl.SetControlBounds(Windows::Foundation::Rect{ controlOrigin.x, controlOrigin.y, controlSize.x, controlSize.y });
UpdateControlBounds();
};

void TermControlAutomationPeer::SetControlBounds(const Windows::Foundation::Rect bounds)
void TermControlAutomationPeer::UpdateControlBounds()
{
_implementation.SetControlBounds(bounds);
// FrameworkElementAutomationPeer has this great GetBoundingRectangle
// method that's seemingly impossible to recreate just from the
// UserControl itself. Weird. But we can use it handily here!
_implementation.SetControlBounds(GetBoundingRectangle());
}
void TermControlAutomationPeer::SetControlPadding(const Core::Padding padding)
{
Expand Down
2 changes: 1 addition & 1 deletion src/cascadia/TerminalControl/TermControlAutomationPeer.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
TermControlAutomationPeer(Microsoft::Terminal::Control::implementation::TermControl* owner,
Control::InteractivityAutomationPeer implementation);

void SetControlBounds(const Windows::Foundation::Rect bounds);
void UpdateControlBounds();
void SetControlPadding(const Core::Padding padding);

#pragma region FrameworkElementAutomationPeer
Expand Down
2 changes: 1 addition & 1 deletion src/cascadia/TerminalControl/TermControlAutomationPeer.idl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Microsoft.Terminal.Control
Windows.UI.Xaml.Automation.Provider.ITextProvider
{

void SetControlBounds(Windows.Foundation.Rect bounds);
void UpdateControlBounds();
void SetControlPadding(Microsoft.Terminal.Core.Padding padding);
}
}

0 comments on commit 47410c9

Please sign in to comment.