Skip to content

Commit

Permalink
Fix ed2923b by backporting HRESULT change from de7f931
Browse files Browse the repository at this point in the history
  • Loading branch information
DHowett committed May 6, 2024
1 parent 42bc7f2 commit e349130
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/cascadia/TerminalControl/EventArgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ namespace winrt::Microsoft::Terminal::Control::implementation
struct RendererWarningArgs : public RendererWarningArgsT<RendererWarningArgs>
{
public:
RendererWarningArgs(const uint64_t hr) :
RendererWarningArgs(const HRESULT hr) :
_Result(hr)
{
}

WINRT_PROPERTY(uint64_t, Result);
WINRT_PROPERTY(HRESULT, Result);
};

struct TransparencyChangedEventArgs : public TransparencyChangedEventArgsT<TransparencyChangedEventArgs>
Expand Down
2 changes: 1 addition & 1 deletion src/cascadia/TerminalControl/EventArgs.idl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ namespace Microsoft.Terminal.Control

runtimeclass RendererWarningArgs
{
UInt64 Result { get; };
HRESULT Result { get; };
}

runtimeclass TransparencyChangedEventArgs
Expand Down
9 changes: 5 additions & 4 deletions src/cascadia/TerminalControl/TermControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -995,9 +995,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
winrt::fire_and_forget TermControl::_RendererWarning(IInspectable /*sender*/,
Control::RendererWarningArgs args)
{
// HRESULT is a signed 32-bit integer which would result in a hex output like "-0x7766FFF4",
// but canonically HRESULTs are displayed unsigned as "0x8899000C". See GH#11556.
const auto hr = std::bit_cast<uint32_t>(args.Result());
const auto hr = args.Result();

auto weakThis{ get_weak() };
co_await wil::resume_foreground(Dispatcher());
Expand All @@ -1017,8 +1015,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
}
else
{
// HRESULT is a signed 32-bit integer which would result in a hex output like "-0x7766FFF4",
// but canonically HRESULTs are displayed unsigned as "0x8899000C". See GH#11556.
const auto displayHr = std::bit_cast<uint32_t>(hr);
message = winrt::hstring{ fmt::format(std::wstring_view{ RS_(L"UnexpectedRendererError") },
hr) };
displayHr) };
}

auto noticeArgs = winrt::make<NoticeEventArgs>(NoticeLevel::Warning, std::move(message));
Expand Down

0 comments on commit e349130

Please sign in to comment.