Compare commits

...

5 Commits

Author SHA1 Message Date
Dustin Howett
80c529aced Revert the removal of LayoutUpdated_revoker from ColorSchemes in ab79a8538 2023-01-23 19:01:07 -06:00
Dustin Howett
ab79a85381 Revert "Manually set the automation name of the default color scheme for screen reader (#14704)"
This reverts commit 47f38e31a1.
2023-01-23 18:52:19 -06:00
Carlos Zamora
b9089d9d1d [UIA] Dispatch a TextChanged event on new output (#14723)
For some reason, Windows Terminal stops dispatching UIA TextChanged events sometimes. There isn't a reliable repro for this bug.

However, under NVDA's logger, it appears that when the bug does occur, we still dispatch UIA notifications (which may be ignored by NVDA in some configurations). A "quick fix" here is to dispatch a TextChanged event if we're going to dispatch a notification. Since we're just enabling a flag, we won't send two events at once.

Closes #10911

(cherry picked from commit a0e830cc1a)
Service-Card-Id: 87730855
Service-Version: 1.17
2023-01-23 16:57:05 -06:00
Carlos Zamora
272e7b0905 Ensure TermControl is not closing when firing UIA events (#14714)
The `SignalTextChanged` crash seems to be occurring due to the `TermControlAutomationPeer` being destructed by the time the UIA event is actually dispatched. Even though we're already checking if TCAP and TermControl still exist, it could be that the TermControl is being closed as text is being output.

The proposed fix here is to record when the closing process starts and exposing that information directly to the TCAP. If TCAP sees that we're in the process of closing, don't bother sending a UIA event.

Closes #13978

(cherry picked from commit 3dd40791c9)
Service-Card-Id: 87728853
Service-Version: 1.17
2023-01-23 12:44:39 -06:00
Mike Griese
7326eaaa6f Resize our ContentDialog's when the window resizes (#14722)
Major thanks to @dongle-the-gadget in https://github.com/microsoft/microsoft-ui-xaml/issues/3577#issuecomment-1399250405 for coming up with this workaround.

This PR will manually forward a `WM_SIZE` message to our `CoreWindow`, to trigger the `ContentDialog` to resize itself.

We always closed these issues as dupes of the upstream one, so this doesn't actually close anything.
HOWEVER, these are the following issues that reported this bug:
- #2380
- #4463
- #5252
- #5810
- #6181
- #7113
- #7225
- #8245
- #8496
- #8643
- #9336
- #9563
- #5808
- #10351
- #10634
- #10995
- #11770
- #13796

(cherry picked from commit a4cf4e2761)
Service-Card-Id: 87727806
Service-Version: 1.17
2023-01-23 12:43:04 -06:00
6 changed files with 33 additions and 10 deletions

View File

@@ -1990,6 +1990,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
if (!_IsClosing())
{
_closing = true;
if (_automationPeer)
{
auto autoPeerImpl{ winrt::get_self<implementation::TermControlAutomationPeer>(_automationPeer) };
autoPeerImpl->Close();
}
_RestorePointerCursorHandlers(*this, nullptr);

View File

@@ -117,6 +117,13 @@ namespace winrt::Microsoft::Terminal::Control::implementation
}
}
void TermControlAutomationPeer::Close()
{
// GH#13978: If the TermControl has already been removed from the UI tree, XAML might run into weird bugs.
// This will prevent the `dispatcher.RunAsync` calls below from raising UIA events on the main thread.
_termControl = {};
}
// Method Description:
// - Signals the ui automation client that the terminal's selection has changed and should be updated
// Arguments:

View File

@@ -49,6 +49,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
void UpdateControlBounds();
void SetControlPadding(const Core::Padding padding);
void RecordKeyEvent(const WORD vkey);
void Close();
#pragma region FrameworkElementAutomationPeer
hstring GetClassNameCore() const;

View File

@@ -42,16 +42,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
// Only let this succeed once.
_layoutUpdatedRevoker.revoke();
for (const auto scheme : _ViewModel.AllColorSchemes())
{
if (scheme.IsDefaultScheme())
{
winrt::hstring newName{ fmt::format(L"{} ({})", scheme.Name(), RS_(L"ColorScheme_DefaultTag/Text")) };
Automation::AutomationProperties::SetName(ColorSchemeListView().ContainerFromItem(scheme), newName);
break;
}
}
ColorSchemeListView().Focus(FocusState::Programmatic);
});
}

View File

@@ -9,6 +9,7 @@
#include "NotificationIcon.h"
#include <dwmapi.h>
#include <TerminalThemeHelpers.h>
#include <CoreWindow.h>
extern "C" IMAGE_DOS_HEADER __ImageBase;
@@ -499,6 +500,24 @@ long IslandWindow::_calculateTotalSize(const bool isWidth, const long clientSize
return 0;
}
}
// BODGY This is a fix for the upstream:
//
// https://github.com/microsoft/microsoft-ui-xaml/issues/3577
//
// ContentDialogs don't resize themselves when the XAML island resizes.
// However, if we manually resize our CoreWindow, that'll actually
// trigger a resize of the ContentDialog.
if (const auto& coreWindow{ winrt::Windows::UI::Core::CoreWindow::GetForCurrentThread() })
{
if (const auto& interop{ coreWindow.as<ICoreWindowInterop>() })
{
HWND coreWindowInterop;
interop->get_WindowHandle(&coreWindowInterop);
PostMessage(coreWindowInterop, message, wparam, lparam);
}
}
break;
}
case WM_MOVING:

View File

@@ -175,6 +175,7 @@ try
{
_newOutput.append(newText);
_newOutput.push_back(L'\n');
_textBufferChanged = true;
}
return S_OK;
}