Skip to content

Commit

Permalink
Some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
zadjii-msft committed May 7, 2021
1 parent 47410c9 commit 0869456
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 49 deletions.
54 changes: 30 additions & 24 deletions src/cascadia/TerminalControl/ControlCore.idl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ namespace Microsoft.Terminal.Control
// but projectable.
struct MouseButtonState
{
// !! LOAD BEARING !! If you make these Booleans (like they should be),
// then the app will crash trying to toss one of these across the
// process boundary. I haven't the damndest idea why.
Int32 IsLeftButtonDown;
Int32 IsMiddleButtonDown;
Int32 IsRightButtonDown;
Expand All @@ -23,56 +26,59 @@ namespace Microsoft.Terminal.Control
ControlCore(IControlSettings settings,
Microsoft.Terminal.TerminalConnection.ITerminalConnection connection);

// void AttachUiaEngine(::Microsoft::Console::Render::IRenderEngine* const pEngine);
// ::Microsoft::Console::Types::IUiaData* GetUiaData() const;
Boolean Initialize(Double actualWidth,
Double actualHeight,
Double compositionScale);

void UpdateSettings(IControlSettings settings);
void UpdateAppearance(IControlAppearance appearance);

UInt64 GetSwapChainHandle();

Windows.Foundation.Size FontSize { get; };
String FontFaceName { get; };
UInt16 FontWeight { get; };

UInt64 GetSwapChainHandle();
// std::vector<std::wstring> SelectedText(bool trimTrailingWhitespace) const;
IVector<String> SelectedText(Boolean trimTrailingWhitespace);
void UpdateHoveredCell(Windows.Foundation.IReference<Microsoft.Terminal.Core.Point> terminalPosition);
Windows.Foundation.IReference<Microsoft.Terminal.Core.Point> GetHoveredCell();

Boolean TrySendKeyEvent(Int16 vkey,
Int16 scanCode,
Microsoft.Terminal.Core.ControlKeyStates modifiers,
Boolean keyDown);
Boolean SendCharEvent(Char ch,
Int16 scanCode,
Microsoft.Terminal.Core.ControlKeyStates modifiers);
void SendInput(String text);
void PasteText(String text);

void UpdateHoveredCell(Windows.Foundation.IReference<Microsoft.Terminal.Core.Point> terminalPosition);

void ResetFontSize();
void AdjustFontSize(Int32 fontSize);
void SizeChanged(Double width, Double height);
void ScaleChanged(Double scale);

void ToggleShaderEffects();
void ToggleReadOnlyMode();

Microsoft.Terminal.Core.Point CursorPosition();
void ResumeRendering();
void ToggleReadOnlyMode();
void BlinkAttributeTick();
String GetHoveredUriText();
void SendInput(String text);
void PasteText(String text);
void UpdatePatternLocations();
Boolean HasSelection();
void Search(String text, Boolean goForward, Boolean caseSensitive);
void UpdateSettings(IControlSettings settings);
void UpdateAppearance(IControlAppearance appearance);
void ToggleShaderEffects();
void SetBackgroundOpacity(Double opacity);
Microsoft.Terminal.Core.Color BackgroundColor();
Boolean Initialize(Double actualWidth,
Double actualHeight,
Double compositionScale);

Boolean HasSelection();
IVector<String> SelectedText(Boolean trimTrailingWhitespace);

String GetHoveredUriText();
Windows.Foundation.IReference<Microsoft.Terminal.Core.Point> GetHoveredCell();

void Close();
void BlinkCursor();
void ResetFontSize();
void AdjustFontSize(Int32 fontSize);
void SizeChanged(Double width, Double height);
void ScaleChanged(Double scale);
Boolean IsInReadOnlyMode();
Boolean CursorOn;
void EnablePainting();


event FontSizeChangedEventArgs FontSizeChanged;

event Windows.Foundation.TypedEventHandler<Object, CopyToClipboardEventArgs> CopyToClipboard;
Expand Down
37 changes: 12 additions & 25 deletions src/cascadia/TerminalControl/InteractivityAutomationPeer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
void InteractivityAutomationPeer::SignalSelectionChanged()
{
UiaTracing::Signal::SelectionChanged();
// TODO! We seemingly got Dispatcher() for free when we said we extended

// TODO:projects/5#card-50760282
// We seemingly got a Dispatcher() for free when we said we extended
// Windows.UI.Automation.Peers.AutomationPeer. This is suspect to me.
// This probably won't work when OOP.
// This probably won't work when out-of-proc from the WinUI layer.

Dispatcher().RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, [&]() {
// The event that is raised when the text selection is modified.
Expand All @@ -72,9 +74,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
void InteractivityAutomationPeer::SignalTextChanged()
{
UiaTracing::Signal::TextChanged();
// TODO! We seemingly got Dispatcher() for free when we said we extended

// TODO:projects/5#card-50760282
// We seemingly got a Dispatcher() for free when we said we extended
// Windows.UI.Automation.Peers.AutomationPeer. This is suspect to me.
// This probably won't work when OOP.
// This probably won't work when out-of-proc from the WinUI layer.

Dispatcher().RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, [&]() {
// The event that is raised when textual content is modified.
Expand All @@ -91,9 +95,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
void InteractivityAutomationPeer::SignalCursorChanged()
{
UiaTracing::Signal::CursorChanged();
// TODO! We seemingly got Dispatcher() for free when we said we extended

// TODO:projects/5#card-50760282
// We seemingly got a Dispatcher() for free when we said we extended
// Windows.UI.Automation.Peers.AutomationPeer. This is suspect to me.
// This probably won't work when OOP.
// This probably won't work when out-of-proc from the WinUI layer.

Dispatcher().RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, [&]() {
// The event that is raised when the text was changed in an edit control.
Expand Down Expand Up @@ -170,18 +176,6 @@ namespace winrt::Microsoft::Terminal::Control::implementation

RECT InteractivityAutomationPeer::GetBounds() const
{
// const auto padding = _interactivity->GetPadding();
// // TODO! Get this from the core
// const til::size dimensions{ 100, 100 };
// const til::rectangle realBounds{ padding.origin(), dimensions };
// return realBounds;
// auto rect = GetBoundingRectangle();
// return {
// gsl::narrow_cast<LONG>(rect.X),
// gsl::narrow_cast<LONG>(rect.Y),
// gsl::narrow_cast<LONG>(rect.X + rect.Width),
// gsl::narrow_cast<LONG>(rect.Y + rect.Height)
// };
return _controlBounds;
}

Expand All @@ -196,13 +190,6 @@ namespace winrt::Microsoft::Terminal::Control::implementation
RECT InteractivityAutomationPeer::GetPadding() const
{
return _controlPadding;
// return _interactivity->GetPadding();
// return {
// gsl::narrow_cast<LONG>(padding.Left),
// gsl::narrow_cast<LONG>(padding.Top),
// gsl::narrow_cast<LONG>(padding.Right),
// gsl::narrow_cast<LONG>(padding.Bottom)
// };
}

double InteractivityAutomationPeer::GetScaleFactor() const
Expand Down
8 changes: 8 additions & 0 deletions src/cascadia/TerminalControl/TermControlAutomationPeer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ namespace winrt::Microsoft::Terminal::Control::implementation
UpdateControlBounds();
};

// Method Description:
// - Inform the interactivity layer about the bounds of the control.
// IControlAccessibilityInfo needs to know this information, but it cannot
// ask us directly.
// Arguments:
// - <none>
// Return Value:
// - <none>
void TermControlAutomationPeer::UpdateControlBounds()
{
// FrameworkElementAutomationPeer has this great GetBoundingRectangle
Expand Down

1 comment on commit 0869456

@github-actions

This comment was marked as resolved.

Please sign in to comment.