diff --git a/src/cascadia/WindowsTerminal/WindowUiaProvider.hpp b/src/cascadia/WindowsTerminal/WindowUiaProvider.hpp index af05800f752..272d8e0e426 100644 --- a/src/cascadia/WindowsTerminal/WindowUiaProvider.hpp +++ b/src/cascadia/WindowsTerminal/WindowUiaProvider.hpp @@ -42,6 +42,10 @@ class WindowUiaProvider final : _COM_Outptr_result_maybenull_ IRawElementProviderFragment** ppProvider) override; IFACEMETHODIMP GetFocus(_COM_Outptr_result_maybenull_ IRawElementProviderFragment** ppProvider) override; +protected: + const OLECHAR* AutomationIdPropertyName = L"Terminal Window"; + const OLECHAR* ProviderDescriptionPropertyName = L"Microsoft Windows Terminal Window"; + private: WindowUiaProvider(Microsoft::Console::Types::IConsoleWindow* baseWindow); ~WindowUiaProvider(); diff --git a/src/host/scrolling.cpp b/src/host/scrolling.cpp index 571c8058cbf..e45d9aece7e 100644 --- a/src/host/scrolling.cpp +++ b/src/host/scrolling.cpp @@ -11,6 +11,7 @@ using Microsoft::Console::VirtualTerminal::StateMachine; using namespace Microsoft::Console::Interactivity; +using namespace Microsoft::Console::Types; ULONG Scrolling::s_ucWheelScrollLines = 0; ULONG Scrolling::s_ucWheelScrollChars = 0; @@ -30,7 +31,7 @@ bool Scrolling::s_IsInScrollMode() void Scrolling::s_DoScroll() { CONSOLE_INFORMATION& gci = ServiceLocator::LocateGlobals().getConsoleInformation(); - Microsoft::Console::Types::IConsoleWindow* const pWindow = ServiceLocator::LocateConsoleWindow(); + IConsoleWindow* const pWindow = ServiceLocator::LocateConsoleWindow(); if (!s_IsInScrollMode()) { // clear any selection we may have -- can't scroll and select at the same time @@ -48,7 +49,7 @@ void Scrolling::s_DoScroll() void Scrolling::s_ClearScroll() { CONSOLE_INFORMATION& gci = ServiceLocator::LocateGlobals().getConsoleInformation(); - Microsoft::Console::Types::IConsoleWindow* const pWindow = ServiceLocator::LocateConsoleWindow(); + IConsoleWindow* const pWindow = ServiceLocator::LocateConsoleWindow(); WI_ClearFlag(gci.Flags, CONSOLE_SCROLLING); if (pWindow != nullptr) { @@ -58,7 +59,7 @@ void Scrolling::s_ClearScroll() void Scrolling::s_ScrollIfNecessary(const SCREEN_INFORMATION& ScreenInfo) { - Microsoft::Console::Types::IConsoleWindow* pWindow = ServiceLocator::LocateConsoleWindow(); + IConsoleWindow* pWindow = ServiceLocator::LocateConsoleWindow(); FAIL_FAST_IF_NULL(pWindow); Selection* const pSelection = &Selection::Instance(); @@ -202,7 +203,7 @@ void Scrolling::s_HandleMouseWheel(_In_ bool isMouseWheel, bool Scrolling::s_HandleKeyScrollingEvent(const INPUT_KEY_INFO* const pKeyInfo) { CONSOLE_INFORMATION& gci = ServiceLocator::LocateGlobals().getConsoleInformation(); - Microsoft::Console::Types::IConsoleWindow* pWindow = ServiceLocator::LocateConsoleWindow(); + IConsoleWindow* pWindow = ServiceLocator::LocateConsoleWindow(); FAIL_FAST_IF_NULL(pWindow); const WORD VirtualKeyCode = pKeyInfo->GetVirtualKey(); diff --git a/src/host/selection.cpp b/src/host/selection.cpp index 7fc7c98f856..5a361595f6f 100644 --- a/src/host/selection.cpp +++ b/src/host/selection.cpp @@ -10,6 +10,7 @@ #include "../interactivity/inc/ServiceLocator.hpp" using namespace Microsoft::Console::Interactivity; +using namespace Microsoft::Console::Types; std::unique_ptr Selection::_instance; @@ -309,7 +310,7 @@ void Selection::InitializeMouseSelection(const COORD coordBufferPos) CheckAndSetAlternateSelection(); // set window title to mouse selection mode - Microsoft::Console::Types::IConsoleWindow* const pWindow = ServiceLocator::LocateConsoleWindow(); + IConsoleWindow* const pWindow = ServiceLocator::LocateConsoleWindow(); if (pWindow != nullptr) { pWindow->UpdateWindowText(); @@ -437,7 +438,7 @@ void Selection::_CancelMouseSelection() // turn off selection flag _SetSelectingState(false); - Microsoft::Console::Types::IConsoleWindow* const pWindow = ServiceLocator::LocateConsoleWindow(); + IConsoleWindow* const pWindow = ServiceLocator::LocateConsoleWindow(); if (pWindow != nullptr) { pWindow->UpdateWindowText(); @@ -467,7 +468,7 @@ void Selection::_CancelMarkSelection() // Turn off selection flag. _SetSelectingState(false); - Microsoft::Console::Types::IConsoleWindow* const pWindow = ServiceLocator::LocateConsoleWindow(); + IConsoleWindow* const pWindow = ServiceLocator::LocateConsoleWindow(); if (pWindow != nullptr) { pWindow->UpdateWindowText(); @@ -621,7 +622,7 @@ void Selection::InitializeMarkSelection() _coordSelectionAnchor = coordPosition; // set frame title text - Microsoft::Console::Types::IConsoleWindow* const pWindow = ServiceLocator::LocateConsoleWindow(); + IConsoleWindow* const pWindow = ServiceLocator::LocateConsoleWindow(); if (pWindow != nullptr) { pWindow->UpdateWindowText(); diff --git a/src/host/tracing.cpp b/src/host/tracing.cpp index 220cd994dfb..01033921877 100644 --- a/src/host/tracing.cpp +++ b/src/host/tracing.cpp @@ -247,7 +247,7 @@ void Tracing::s_TraceApi(const CONSOLE_WRITECONSOLEOUTPUTSTRING_MSG* const a) TraceLoggingKeyword(TraceKeywords::API)); } -void Tracing::s_TraceWindowViewport(const Microsoft::Console::Types::Viewport& viewport) +void Tracing::s_TraceWindowViewport(const Viewport& viewport) { TraceLoggingWrite( g_hConhostV2EventTraceProvider, diff --git a/src/host/tracing.hpp b/src/host/tracing.hpp index 1ecc8870506..63b28af9365 100644 --- a/src/host/tracing.hpp +++ b/src/host/tracing.hpp @@ -21,17 +21,6 @@ Author(s): #include "../types/inc/Viewport.hpp" -namespace Microsoft::Console::Types -{ - class WindowUiaProvider; - - namespace WindowUiaProviderTracing - { - enum class ApiCall; - struct IApiMsg; - } -} - namespace Microsoft::Console::Interactivity::Win32 { class UiaTextRange; diff --git a/src/interactivity/base/ServiceLocator.cpp b/src/interactivity/base/ServiceLocator.cpp index e7d716c8183..ef8411c5389 100644 --- a/src/interactivity/base/ServiceLocator.cpp +++ b/src/interactivity/base/ServiceLocator.cpp @@ -9,6 +9,7 @@ #pragma hdrstop +using namespace Microsoft::Console::Types; using namespace Microsoft::Console::Interactivity; #pragma region Private Static Member Initialization @@ -22,7 +23,7 @@ std::unique_ptr ServiceLocator::s_highDpiApi; std::unique_ptr ServiceLocator::s_systemConfigurationProvider; std::unique_ptr ServiceLocator::s_inputServices; -Microsoft::Console::Types::IConsoleWindow* ServiceLocator::s_consoleWindow = nullptr; +IConsoleWindow* ServiceLocator::s_consoleWindow = nullptr; Globals ServiceLocator::s_globals; @@ -103,7 +104,7 @@ void ServiceLocator::RundownAndExit(const HRESULT hr) #pragma region Set Methods -[[nodiscard]] NTSTATUS ServiceLocator::SetConsoleWindowInstance(_In_ Microsoft::Console::Types::IConsoleWindow* window) +[[nodiscard]] NTSTATUS ServiceLocator::SetConsoleWindowInstance(_In_ IConsoleWindow* window) { NTSTATUS status = STATUS_SUCCESS; @@ -127,7 +128,7 @@ void ServiceLocator::RundownAndExit(const HRESULT hr) #pragma region Location Methods -Microsoft::Console::Types::IConsoleWindow* ServiceLocator::LocateConsoleWindow() +IConsoleWindow* ServiceLocator::LocateConsoleWindow() { return s_consoleWindow; } diff --git a/src/interactivity/inc/ServiceLocator.hpp b/src/interactivity/inc/ServiceLocator.hpp index fea999091fd..d81d77d666b 100644 --- a/src/interactivity/inc/ServiceLocator.hpp +++ b/src/interactivity/inc/ServiceLocator.hpp @@ -23,6 +23,8 @@ Author(s): #pragma hdrstop +using namespace Microsoft::Console::Types; + namespace Microsoft::Console::Interactivity { class ServiceLocator final @@ -52,8 +54,8 @@ namespace Microsoft::Console::Interactivity return static_cast(LocateConsoleInputThread()); } - [[nodiscard]] static NTSTATUS SetConsoleWindowInstance(_In_ Microsoft::Console::Types::IConsoleWindow* window); - static Microsoft::Console::Types::IConsoleWindow* LocateConsoleWindow(); + [[nodiscard]] static NTSTATUS SetConsoleWindowInstance(_In_ IConsoleWindow* window); + static IConsoleWindow* LocateConsoleWindow(); template static T* LocateConsoleWindow() { @@ -102,7 +104,7 @@ namespace Microsoft::Console::Interactivity // TODO: MSFT 15344939 - some implementations of IConsoleWindow are currently singleton // classes so we can't own a pointer to them here. fix this so s_consoleWindow can follow the // pattern of the rest of the service interface pointers. - static Microsoft::Console::Types::IConsoleWindow* s_consoleWindow; + static IConsoleWindow* s_consoleWindow; static std::unique_ptr s_windowMetrics; static std::unique_ptr s_highDpiApi; static std::unique_ptr s_systemConfigurationProvider; diff --git a/src/interactivity/win32/AccessibilityNotifier.cpp b/src/interactivity/win32/AccessibilityNotifier.cpp index 1f4095c4d0d..e7eeaaca6f0 100644 --- a/src/interactivity/win32/AccessibilityNotifier.cpp +++ b/src/interactivity/win32/AccessibilityNotifier.cpp @@ -8,11 +8,12 @@ #include "..\inc\ServiceLocator.hpp" #include "ConsoleControl.hpp" +using namespace Microsoft::Console::Types; using namespace Microsoft::Console::Interactivity::Win32; void AccessibilityNotifier::NotifyConsoleCaretEvent(_In_ RECT rectangle) { - Microsoft::Console::Types::IConsoleWindow* const pWindow = ServiceLocator::LocateConsoleWindow(); + IConsoleWindow* const pWindow = ServiceLocator::LocateConsoleWindow(); if (pWindow != nullptr) { CONSOLE_CARET_INFO caretInfo; @@ -41,7 +42,7 @@ void AccessibilityNotifier::NotifyConsoleCaretEvent(_In_ ConsoleCaretEventFlags // UIA event notification static COORD previousCursorLocation = { 0, 0 }; - Microsoft::Console::Types::IConsoleWindow* const pWindow = ServiceLocator::LocateConsoleWindow(); + IConsoleWindow* const pWindow = ServiceLocator::LocateConsoleWindow(); if (pWindow != nullptr) { @@ -63,7 +64,7 @@ void AccessibilityNotifier::NotifyConsoleCaretEvent(_In_ ConsoleCaretEventFlags void AccessibilityNotifier::NotifyConsoleUpdateScrollEvent(_In_ LONG x, _In_ LONG y) { - Microsoft::Console::Types::IConsoleWindow* pWindow = ServiceLocator::LocateConsoleWindow(); + IConsoleWindow* pWindow = ServiceLocator::LocateConsoleWindow(); if (pWindow) { NotifyWinEvent(EVENT_CONSOLE_UPDATE_SCROLL, @@ -75,7 +76,7 @@ void AccessibilityNotifier::NotifyConsoleUpdateScrollEvent(_In_ LONG x, _In_ LON void AccessibilityNotifier::NotifyConsoleUpdateSimpleEvent(_In_ LONG start, _In_ LONG charAndAttribute) { - Microsoft::Console::Types::IConsoleWindow* pWindow = ServiceLocator::LocateConsoleWindow(); + IConsoleWindow* pWindow = ServiceLocator::LocateConsoleWindow(); if (pWindow) { NotifyWinEvent(EVENT_CONSOLE_UPDATE_SIMPLE, @@ -87,7 +88,7 @@ void AccessibilityNotifier::NotifyConsoleUpdateSimpleEvent(_In_ LONG start, _In_ void AccessibilityNotifier::NotifyConsoleUpdateRegionEvent(_In_ LONG startXY, _In_ LONG endXY) { - Microsoft::Console::Types::IConsoleWindow* pWindow = ServiceLocator::LocateConsoleWindow(); + IConsoleWindow* pWindow = ServiceLocator::LocateConsoleWindow(); if (pWindow) { NotifyWinEvent(EVENT_CONSOLE_UPDATE_REGION, @@ -99,7 +100,7 @@ void AccessibilityNotifier::NotifyConsoleUpdateRegionEvent(_In_ LONG startXY, _I void AccessibilityNotifier::NotifyConsoleLayoutEvent() { - Microsoft::Console::Types::IConsoleWindow* pWindow = ServiceLocator::LocateConsoleWindow(); + IConsoleWindow* pWindow = ServiceLocator::LocateConsoleWindow(); if (pWindow) { NotifyWinEvent(EVENT_CONSOLE_LAYOUT, @@ -111,7 +112,7 @@ void AccessibilityNotifier::NotifyConsoleLayoutEvent() void AccessibilityNotifier::NotifyConsoleStartApplicationEvent(_In_ DWORD processId) { - Microsoft::Console::Types::IConsoleWindow* pWindow = ServiceLocator::LocateConsoleWindow(); + IConsoleWindow* pWindow = ServiceLocator::LocateConsoleWindow(); if (pWindow) { NotifyWinEvent(EVENT_CONSOLE_START_APPLICATION, @@ -123,7 +124,7 @@ void AccessibilityNotifier::NotifyConsoleStartApplicationEvent(_In_ DWORD proces void AccessibilityNotifier::NotifyConsoleEndApplicationEvent(_In_ DWORD processId) { - Microsoft::Console::Types::IConsoleWindow* pWindow = ServiceLocator::LocateConsoleWindow(); + IConsoleWindow* pWindow = ServiceLocator::LocateConsoleWindow(); if (pWindow) { NotifyWinEvent(EVENT_CONSOLE_END_APPLICATION, diff --git a/src/interactivity/win32/windowUiaProvider.cpp b/src/interactivity/win32/windowUiaProvider.cpp index b219ac639a2..febeaa087b4 100644 --- a/src/interactivity/win32/windowUiaProvider.cpp +++ b/src/interactivity/win32/windowUiaProvider.cpp @@ -9,9 +9,10 @@ #include "../host/renderData.hpp" #include "../inc/ServiceLocator.hpp" +using namespace Microsoft::Console::Types; using namespace Microsoft::Console::Interactivity::Win32; -WindowUiaProvider::WindowUiaProvider(Microsoft::Console::Types::IConsoleWindow* baseWindow) : +WindowUiaProvider::WindowUiaProvider(IConsoleWindow* baseWindow) : _pScreenInfoProvider{ nullptr }, WindowUiaProviderBase(baseWindow) { @@ -25,7 +26,7 @@ WindowUiaProvider::~WindowUiaProvider() } } -WindowUiaProvider* WindowUiaProvider::Create(Microsoft::Console::Types::IConsoleWindow* baseWindow) +WindowUiaProvider* WindowUiaProvider::Create(IConsoleWindow* baseWindow) { WindowUiaProvider* pWindowProvider = nullptr; Microsoft::Console::Types::ScreenInfoUiaProvider* pScreenInfoProvider = nullptr; diff --git a/src/interactivity/win32/windowUiaProvider.hpp b/src/interactivity/win32/windowUiaProvider.hpp index 466608079ca..cb9f1b31bb3 100644 --- a/src/interactivity/win32/windowUiaProvider.hpp +++ b/src/interactivity/win32/windowUiaProvider.hpp @@ -22,6 +22,11 @@ Author(s): #include "precomp.h" #include "../types/WindowUiaProviderBase.hpp" +namespace Microsoft::Console::Types +{ + class IConsoleWindow; +} + namespace Microsoft::Console::Interactivity::Win32 { class WindowUiaProvider final : @@ -44,6 +49,10 @@ namespace Microsoft::Console::Interactivity::Win32 _COM_Outptr_result_maybenull_ IRawElementProviderFragment** ppProvider) override; IFACEMETHODIMP GetFocus(_COM_Outptr_result_maybenull_ IRawElementProviderFragment** ppProvider) override; + protected: + const OLECHAR* AutomationIdPropertyName = L"Console Window"; + const OLECHAR* ProviderDescriptionPropertyName = L"Microsoft Console Host Window"; + private: WindowUiaProvider(Microsoft::Console::Types::IConsoleWindow* baseWindow); ~WindowUiaProvider(); diff --git a/src/interactivity/win32/windowproc.cpp b/src/interactivity/win32/windowproc.cpp index f7c20449dbd..9292bef9823 100644 --- a/src/interactivity/win32/windowproc.cpp +++ b/src/interactivity/win32/windowproc.cpp @@ -39,7 +39,7 @@ using namespace Microsoft::Console::Types; // The static and specific window procedures for this class are contained here #pragma region Window Procedure -[[nodiscard]] LRESULT CALLBACK Microsoft::Console::Interactivity::Win32::Window::s_ConsoleWindowProc(_In_ HWND hWnd, _In_ UINT Message, _In_ WPARAM wParam, _In_ LPARAM lParam) +[[nodiscard]] LRESULT CALLBACK Window::s_ConsoleWindowProc(_In_ HWND hWnd, _In_ UINT Message, _In_ WPARAM wParam, _In_ LPARAM lParam) { // Save the pointer here to the specific window instance when one is created if (Message == WM_CREATE) @@ -61,7 +61,7 @@ using namespace Microsoft::Console::Types; return DefWindowProcW(hWnd, Message, wParam, lParam); } -[[nodiscard]] LRESULT CALLBACK Microsoft::Console::Interactivity::Win32::Window::ConsoleWindowProc(_In_ HWND hWnd, _In_ UINT Message, _In_ WPARAM wParam, _In_ LPARAM lParam) +[[nodiscard]] LRESULT CALLBACK Window::ConsoleWindowProc(_In_ HWND hWnd, _In_ UINT Message, _In_ WPARAM wParam, _In_ LPARAM lParam) { Globals& g = ServiceLocator::LocateGlobals(); CONSOLE_INFORMATION& gci = g.getConsoleInformation(); @@ -777,7 +777,7 @@ using namespace Microsoft::Console::Types; // Helper handler methods for specific cases within the large window procedure are in this section #pragma region Message Handlers -void Microsoft::Console::Interactivity::Win32::Window::_HandleWindowPosChanged(const LPARAM lParam) +void Window::_HandleWindowPosChanged(const LPARAM lParam) { HWND hWnd = GetWindowHandle(); SCREEN_INFORMATION& ScreenInfo = GetScreenInfo(); @@ -822,7 +822,7 @@ void Microsoft::Console::Interactivity::Win32::Window::_HandleWindowPosChanged(c // - // Return Value: // - S_OK if we succeeded. ERROR_INVALID_HANDLE if there is no HWND. E_FAIL if GDI failed for some reason. -[[nodiscard]] HRESULT Microsoft::Console::Interactivity::Win32::Window::_HandlePaint() const +[[nodiscard]] HRESULT Window::_HandlePaint() const { HWND const hwnd = GetWindowHandle(); RETURN_HR_IF_NULL(HRESULT_FROM_WIN32(ERROR_INVALID_HANDLE), hwnd); @@ -860,7 +860,7 @@ void Microsoft::Console::Interactivity::Win32::Window::_HandleWindowPosChanged(c // - Console - Pointer to CONSOLE_INFORMATION structure // Return Value: // - -void Microsoft::Console::Interactivity::Win32::Window::_HandleDrop(const WPARAM wParam) const +void Window::_HandleDrop(const WPARAM wParam) const { WCHAR szPath[MAX_PATH]; BOOL fAddQuotes; @@ -888,7 +888,7 @@ void Microsoft::Console::Interactivity::Win32::Window::_HandleDrop(const WPARAM } } -[[nodiscard]] LRESULT Microsoft::Console::Interactivity::Win32::Window::_HandleGetObject(const HWND hwnd, const WPARAM wParam, const LPARAM lParam) +[[nodiscard]] LRESULT Window::_HandleGetObject(const HWND hwnd, const WPARAM wParam, const LPARAM lParam) { LRESULT retVal = 0; @@ -912,7 +912,7 @@ void Microsoft::Console::Interactivity::Win32::Window::_HandleDrop(const WPARAM // Dispatchers are used to post or send a window message into the queue from other portions of the codebase without accessing internal properties directly #pragma region Dispatchers -BOOL Microsoft::Console::Interactivity::Win32::Window::PostUpdateWindowSize() const +BOOL Window::PostUpdateWindowSize() const { CONSOLE_INFORMATION& gci = ServiceLocator::LocateGlobals().getConsoleInformation(); const SCREEN_INFORMATION& ScreenInfo = GetScreenInfo(); @@ -931,17 +931,17 @@ BOOL Microsoft::Console::Interactivity::Win32::Window::PostUpdateWindowSize() co return PostMessageW(GetWindowHandle(), CM_SET_WINDOW_SIZE, (WPARAM)&ScreenInfo, 0); } -BOOL Microsoft::Console::Interactivity::Win32::Window::SendNotifyBeep() const +BOOL Window::SendNotifyBeep() const { return SendNotifyMessageW(GetWindowHandle(), CM_BEEP, 0, 0); } -BOOL Microsoft::Console::Interactivity::Win32::Window::PostUpdateScrollBars() const +BOOL Window::PostUpdateScrollBars() const { return PostMessageW(GetWindowHandle(), CM_UPDATE_SCROLL_BARS, (WPARAM)&GetScreenInfo(), 0); } -BOOL Microsoft::Console::Interactivity::Win32::Window::PostUpdateExtendedEditKeys() const +BOOL Window::PostUpdateExtendedEditKeys() const { return PostMessageW(GetWindowHandle(), CM_UPDATE_EDITKEYS, 0, 0); } diff --git a/src/types/ScreenInfoUiaProvider.cpp b/src/types/ScreenInfoUiaProvider.cpp index 3dddea51d25..83230b1108d 100644 --- a/src/types/ScreenInfoUiaProvider.cpp +++ b/src/types/ScreenInfoUiaProvider.cpp @@ -5,7 +5,6 @@ #include "ScreenInfoUiaProvider.h" -#include "IConsoleWindow.hpp" #include "WindowUiaProviderBase.hpp" #include "UiaTextRange.hpp" @@ -33,7 +32,7 @@ SAFEARRAY* BuildIntSafeArray(_In_reads_(length) const int* const data, const int } ScreenInfoUiaProvider::ScreenInfoUiaProvider(_In_ Microsoft::Console::Render::IRenderData* pData, - _In_ Microsoft::Console::Types::WindowUiaProviderBase* const pUiaParent) : + _In_ WindowUiaProviderBase* const pUiaParent) : _pUiaParent(THROW_HR_IF_NULL(E_INVALIDARG, pUiaParent)), _signalFiringMapping{}, _cRefs(1), @@ -639,7 +638,7 @@ const TextBuffer& ScreenInfoUiaProvider::_getTextBuffer() const return _pData->GetTextBuffer(); } -const Microsoft::Console::Types::Viewport ScreenInfoUiaProvider::_getViewport() const +const Viewport ScreenInfoUiaProvider::_getViewport() const { return _pData->GetViewport(); } diff --git a/src/types/ScreenInfoUiaProvider.h b/src/types/ScreenInfoUiaProvider.h index 672a14711e2..707bd0428bd 100644 --- a/src/types/ScreenInfoUiaProvider.h +++ b/src/types/ScreenInfoUiaProvider.h @@ -27,7 +27,6 @@ Author(s): namespace Microsoft::Console::Types { - class IConsoleWindow; class WindowUiaProviderBase; class Viewport; diff --git a/src/types/UiaTextRange.cpp b/src/types/UiaTextRange.cpp index 12b4aa79b22..aa96f4db59a 100644 --- a/src/types/UiaTextRange.cpp +++ b/src/types/UiaTextRange.cpp @@ -1172,7 +1172,7 @@ IFACEMETHODIMP UiaTextRange::ScrollIntoView(_In_ BOOL alignToTop) try { - auto provider = static_cast(_pProvider); + auto provider = static_cast(_pProvider); provider->ChangeViewport(newViewport); } CATCH_RETURN(); @@ -2265,6 +2265,6 @@ RECT UiaTextRange::_getTerminalRect() const HWND UiaTextRange::_getWindowHandle() const { - const auto provider = static_cast(_pProvider); + const auto provider = static_cast(_pProvider); return provider->GetWindowHandle(); } diff --git a/src/types/UiaTextRange.hpp b/src/types/UiaTextRange.hpp index c34f21e61ef..a8a100ff4cb 100644 --- a/src/types/UiaTextRange.hpp +++ b/src/types/UiaTextRange.hpp @@ -20,7 +20,6 @@ Author(s): #include "precomp.h" -#include "IConsoleWindow.hpp" #include "inc/viewport.hpp" #include "../buffer/out/textBuffer.hpp" #include "../renderer/inc/IRenderData.hpp" diff --git a/src/types/WindowUiaProviderBase.cpp b/src/types/WindowUiaProviderBase.cpp index 02bc07f4aec..e9a0c72bc89 100644 --- a/src/types/WindowUiaProviderBase.cpp +++ b/src/types/WindowUiaProviderBase.cpp @@ -106,7 +106,7 @@ IFACEMETHODIMP WindowUiaProviderBase::GetPropertyValue(_In_ PROPERTYID propertyI } else if (propertyId == UIA_AutomationIdPropertyId) { - pVariant->bstrVal = SysAllocString(L"Terminal Window"); + pVariant->bstrVal = SysAllocString(AutomationIdPropertyName); if (pVariant->bstrVal != nullptr) { pVariant->vt = VT_BSTR; @@ -134,7 +134,7 @@ IFACEMETHODIMP WindowUiaProviderBase::GetPropertyValue(_In_ PROPERTYID propertyI } else if (propertyId == UIA_ProviderDescriptionPropertyId) { - pVariant->bstrVal = SysAllocString(L"Microsoft Windows Terminal Window"); + pVariant->bstrVal = SysAllocString(ProviderDescriptionPropertyName); if (pVariant->bstrVal != nullptr) { pVariant->vt = VT_BSTR; diff --git a/src/types/WindowUiaProviderBase.hpp b/src/types/WindowUiaProviderBase.hpp index 2bc0175a49b..dedea0c55fc 100644 --- a/src/types/WindowUiaProviderBase.hpp +++ b/src/types/WindowUiaProviderBase.hpp @@ -89,6 +89,9 @@ namespace Microsoft::Console::Types [[nodiscard]] HRESULT _EnsureValidHwnd() const; + const OLECHAR* AutomationIdPropertyName = L"Console Window"; + const OLECHAR* ProviderDescriptionPropertyName = L"Microsoft Console Host Window"; + private: // Ref counter for COM object ULONG _cRefs;