mirror of
https://github.com/microsoft/terminal.git
synced 2026-04-06 06:09:50 +00:00
Compare commits
8 Commits
v1.24.2812
...
dev/duhowe
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba4fb67ee0 | ||
|
|
77d5d8d8ea | ||
|
|
f936461eea | ||
|
|
7adaa813e8 | ||
|
|
a0eceaedfe | ||
|
|
c7e62c532c | ||
|
|
cfba4e2785 | ||
|
|
8d4f2c61f4 |
@@ -20,7 +20,7 @@ class JsonTestClass
|
||||
public:
|
||||
static Json::Value VerifyParseSucceeded(const std::string_view& content)
|
||||
{
|
||||
static const std::unique_ptr<Json::CharReader> reader{ Json::CharReaderBuilder::CharReaderBuilder().newCharReader() };
|
||||
static const std::unique_ptr<Json::CharReader> reader{ Json::CharReaderBuilder{}.newCharReader() };
|
||||
|
||||
Json::Value root;
|
||||
std::string errs;
|
||||
|
||||
@@ -1255,7 +1255,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
Windows::Foundation::IReference<winrt::Windows::UI::Color> ControlCore::TabColor() noexcept
|
||||
{
|
||||
auto coreColor = _terminal->GetTabColor();
|
||||
return coreColor.has_value() ? Windows::Foundation::IReference<winrt::Windows::UI::Color>(til::color{ coreColor.value() }) :
|
||||
return coreColor.has_value() ? Windows::Foundation::IReference<winrt::Windows::UI::Color>{ static_cast<winrt::Windows::UI::Color>(coreColor.value()) } :
|
||||
nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -2708,7 +2708,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// Just in case someone was holding a lock when they called us and
|
||||
// the handlers decide to do something that take another lock
|
||||
// (like ShellExecute pumping our messaging thread...GH#7994)
|
||||
co_await Dispatcher();
|
||||
co_await winrt::resume_foreground(Dispatcher());
|
||||
|
||||
_OpenHyperlinkHandlers(*strongThis, args);
|
||||
}
|
||||
@@ -2719,7 +2719,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
IInspectable /*args*/)
|
||||
{
|
||||
auto strongThis{ get_strong() };
|
||||
co_await Dispatcher(); // pop up onto the UI thread
|
||||
co_await winrt::resume_foreground(Dispatcher()); // pop up onto the UI thread
|
||||
|
||||
if (auto loadedUiElement{ FindName(L"RendererFailedNotice") })
|
||||
{
|
||||
|
||||
@@ -46,6 +46,9 @@
|
||||
<ProjectReference Include="$(OpenConsoleDir)src\renderer\dx\lib\dx.vcxproj">
|
||||
<Project>{48d21369-3d7b-4431-9967-24e81292cf62}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="$(OpenConsoleDir)src\audio\midi\lib\midi.vcxproj">
|
||||
<Project>{3c67784e-1453-49c2-9660-483e2cc7f7ad}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
{
|
||||
auto data = til::u16u8(str);
|
||||
std::string errs;
|
||||
std::unique_ptr<Json::CharReader> reader{ Json::CharReaderBuilder::CharReaderBuilder().newCharReader() };
|
||||
std::unique_ptr<Json::CharReader> reader{ Json::CharReaderBuilder{}.newCharReader() };
|
||||
|
||||
Json::Value root;
|
||||
if (!reader->parse(data.data(), data.data() + data.size(), &root, &errs))
|
||||
@@ -161,7 +161,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
try
|
||||
{
|
||||
std::string errs;
|
||||
std::unique_ptr<Json::CharReader> reader{ Json::CharReaderBuilder::CharReaderBuilder().newCharReader() };
|
||||
std::unique_ptr<Json::CharReader> reader{ Json::CharReaderBuilder{}.newCharReader() };
|
||||
|
||||
// First get shared state out of `state.json`.
|
||||
const auto sharedData = _readSharedContents().value_or(std::string{});
|
||||
@@ -228,7 +228,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
if (::Microsoft::Console::Utils::IsElevated())
|
||||
{
|
||||
std::string errs;
|
||||
std::unique_ptr<Json::CharReader> reader{ Json::CharReaderBuilder::CharReaderBuilder().newCharReader() };
|
||||
std::unique_ptr<Json::CharReader> reader{ Json::CharReaderBuilder{}.newCharReader() };
|
||||
Json::Value root;
|
||||
|
||||
// First load the contents of state.json into a json blob. This will
|
||||
|
||||
@@ -500,7 +500,7 @@ Json::Value SettingsLoader::_parseJSON(const std::string_view& content)
|
||||
{
|
||||
Json::Value json;
|
||||
std::string errs;
|
||||
const std::unique_ptr<Json::CharReader> reader{ Json::CharReaderBuilder::CharReaderBuilder().newCharReader() };
|
||||
const std::unique_ptr<Json::CharReader> reader{ Json::CharReaderBuilder{}.newCharReader() };
|
||||
|
||||
if (!reader->parse(content.data(), content.data() + content.size(), &json, &errs))
|
||||
{
|
||||
|
||||
@@ -552,7 +552,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
}
|
||||
|
||||
std::string errs; // This string will receive any error text from failing to parse.
|
||||
std::unique_ptr<Json::CharReader> reader{ Json::CharReaderBuilder::CharReaderBuilder().newCharReader() };
|
||||
std::unique_ptr<Json::CharReader> reader{ Json::CharReaderBuilder{}.newCharReader() };
|
||||
|
||||
// First, get a string for the original Json::Value
|
||||
auto oldJsonString = expandable->_originalJson.toStyledString();
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
try
|
||||
{
|
||||
winrt::Windows::Foundation::Uri iconUri{ path };
|
||||
BitmapIconSource<TIconSource>::type iconSource;
|
||||
typename BitmapIconSource<TIconSource>::type iconSource;
|
||||
// Make sure to set this to false, so we keep the RGB data of the
|
||||
// image. Otherwise, the icon will be white for all the
|
||||
// non-transparent pixels in the image.
|
||||
@@ -95,6 +95,16 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
_TIL_INLINEPREFIX winrt::hstring _expandIconPath(hstring iconPath)
|
||||
{
|
||||
if (iconPath.empty())
|
||||
{
|
||||
return iconPath;
|
||||
}
|
||||
winrt::hstring envExpandedPath{ wil::ExpandEnvironmentStringsW<std::wstring>(iconPath.c_str()) };
|
||||
return envExpandedPath;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Creates an IconSource for the given path.
|
||||
// * If the icon is a path to an image, we'll use that.
|
||||
@@ -129,7 +139,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
{
|
||||
try
|
||||
{
|
||||
FontIconSource<TIconSource>::type icon;
|
||||
typename FontIconSource<TIconSource>::type icon;
|
||||
const auto ch = iconPath[0];
|
||||
|
||||
// The range of MDL2 Icons isn't explicitly defined, but
|
||||
@@ -160,7 +170,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
// Swapping between nullptr IconSources and non-null IconSources causes a crash
|
||||
// to occur, but swapping between IconSources with a null source and non-null IconSources
|
||||
// work perfectly fine :shrug:.
|
||||
BitmapIconSource<TIconSource>::type icon;
|
||||
typename BitmapIconSource<TIconSource>::type icon;
|
||||
icon.UriSource(nullptr);
|
||||
iconSource = icon;
|
||||
}
|
||||
@@ -168,16 +178,6 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
return iconSource;
|
||||
}
|
||||
|
||||
static winrt::hstring _expandIconPath(hstring iconPath)
|
||||
{
|
||||
if (iconPath.empty())
|
||||
{
|
||||
return iconPath;
|
||||
}
|
||||
winrt::hstring envExpandedPath{ wil::ExpandEnvironmentStringsW<std::wstring>(iconPath.c_str()) };
|
||||
return envExpandedPath;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Attempt to convert something into another type. For the
|
||||
// IconPathConverter, we support a variety of icons:
|
||||
|
||||
@@ -47,6 +47,18 @@ inline std::string JsonKey(const std::string_view key)
|
||||
|
||||
namespace Microsoft::Terminal::Settings::Model::JsonUtils
|
||||
{
|
||||
template<typename T>
|
||||
struct ConversionTrait
|
||||
{
|
||||
// Forward-declare these so the linker can pick up specializations from elsewhere!
|
||||
T FromJson(const Json::Value&);
|
||||
bool CanConvert(const Json::Value& json);
|
||||
|
||||
Json::Value ToJson(const T& val);
|
||||
|
||||
std::string TypeDescription() const { return "<unknown>"; }
|
||||
};
|
||||
|
||||
namespace Detail
|
||||
{
|
||||
// Function Description:
|
||||
@@ -238,18 +250,6 @@ namespace Microsoft::Terminal::Settings::Model::JsonUtils
|
||||
SetValueForKey(json, key, target, ConversionTrait<std::decay_t<T>>{});
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
struct ConversionTrait
|
||||
{
|
||||
// Forward-declare these so the linker can pick up specializations from elsewhere!
|
||||
T FromJson(const Json::Value&);
|
||||
bool CanConvert(const Json::Value& json);
|
||||
|
||||
Json::Value ToJson(const T& val);
|
||||
|
||||
std::string TypeDescription() const { return "<unknown>"; }
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ConversionTrait<std::string>
|
||||
{
|
||||
@@ -298,6 +298,62 @@ namespace Microsoft::Terminal::Settings::Model::JsonUtils
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ConversionTrait<GUID>
|
||||
{
|
||||
GUID FromJson(const Json::Value& json)
|
||||
{
|
||||
return ::Microsoft::Console::Utils::GuidFromString(til::u8u16(Detail::GetStringView(json)).c_str());
|
||||
}
|
||||
|
||||
bool CanConvert(const Json::Value& json)
|
||||
{
|
||||
if (!json.isString())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto string{ Detail::GetStringView(json) };
|
||||
return string.length() == 38 && string.front() == '{' && string.back() == '}';
|
||||
}
|
||||
|
||||
Json::Value ToJson(const GUID& val)
|
||||
{
|
||||
return til::u16u8(::Microsoft::Console::Utils::GuidToString(val));
|
||||
}
|
||||
|
||||
std::string TypeDescription() const
|
||||
{
|
||||
return "guid";
|
||||
}
|
||||
};
|
||||
|
||||
// GUID and winrt::guid are mutually convertible,
|
||||
// but IReference<winrt::guid> throws some of this off
|
||||
template<>
|
||||
struct ConversionTrait<winrt::guid>
|
||||
{
|
||||
winrt::guid FromJson(const Json::Value& json) const
|
||||
{
|
||||
return static_cast<winrt::guid>(ConversionTrait<GUID>{}.FromJson(json));
|
||||
}
|
||||
|
||||
bool CanConvert(const Json::Value& json) const
|
||||
{
|
||||
return ConversionTrait<GUID>{}.CanConvert(json);
|
||||
}
|
||||
|
||||
Json::Value ToJson(const winrt::guid& val)
|
||||
{
|
||||
return ConversionTrait<GUID>{}.ToJson(val);
|
||||
}
|
||||
|
||||
std::string TypeDescription() const
|
||||
{
|
||||
return ConversionTrait<GUID>{}.TypeDescription();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct ConversionTrait<std::vector<T>>
|
||||
{
|
||||
@@ -684,62 +740,6 @@ namespace Microsoft::Terminal::Settings::Model::JsonUtils
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ConversionTrait<GUID>
|
||||
{
|
||||
GUID FromJson(const Json::Value& json)
|
||||
{
|
||||
return ::Microsoft::Console::Utils::GuidFromString(til::u8u16(Detail::GetStringView(json)).c_str());
|
||||
}
|
||||
|
||||
bool CanConvert(const Json::Value& json)
|
||||
{
|
||||
if (!json.isString())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto string{ Detail::GetStringView(json) };
|
||||
return string.length() == 38 && string.front() == '{' && string.back() == '}';
|
||||
}
|
||||
|
||||
Json::Value ToJson(const GUID& val)
|
||||
{
|
||||
return til::u16u8(::Microsoft::Console::Utils::GuidToString(val));
|
||||
}
|
||||
|
||||
std::string TypeDescription() const
|
||||
{
|
||||
return "guid";
|
||||
}
|
||||
};
|
||||
|
||||
// GUID and winrt::guid are mutually convertible,
|
||||
// but IReference<winrt::guid> throws some of this off
|
||||
template<>
|
||||
struct ConversionTrait<winrt::guid>
|
||||
{
|
||||
winrt::guid FromJson(const Json::Value& json) const
|
||||
{
|
||||
return static_cast<winrt::guid>(ConversionTrait<GUID>{}.FromJson(json));
|
||||
}
|
||||
|
||||
bool CanConvert(const Json::Value& json) const
|
||||
{
|
||||
return ConversionTrait<GUID>{}.CanConvert(json);
|
||||
}
|
||||
|
||||
Json::Value ToJson(const winrt::guid& val)
|
||||
{
|
||||
return ConversionTrait<GUID>{}.ToJson(val);
|
||||
}
|
||||
|
||||
std::string TypeDescription() const
|
||||
{
|
||||
return ConversionTrait<GUID>{}.TypeDescription();
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ConversionTrait<til::color>
|
||||
{
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ShObjIdl_core.h>
|
||||
|
||||
// Function Description:
|
||||
// - This function presents a File Open "common dialog" and returns its selected file asynchronously.
|
||||
// Parameters:
|
||||
|
||||
@@ -2,5 +2,5 @@ LIBRARY Console
|
||||
|
||||
EXPORTS
|
||||
CPlApplet
|
||||
DllGetClassObject private
|
||||
DllCanUnloadNow private
|
||||
DllGetClassObject PRIVATE
|
||||
DllCanUnloadNow PRIVATE
|
||||
|
||||
@@ -32,7 +32,7 @@ using namespace ABI::Windows::ApplicationModel::AppExtensions;
|
||||
#define DELEGATION_CONSOLE_EXTENSION_NAME L"com.microsoft.windows.console.host"
|
||||
#define DELEGATION_TERMINAL_EXTENSION_NAME L"com.microsoft.windows.terminal.host"
|
||||
|
||||
static [[nodiscard]] HRESULT _lookupCatalog(PCWSTR extensionName, std::vector<DelegationConfig::DelegationBase>& vec) noexcept
|
||||
[[nodiscard]] static HRESULT _lookupCatalog(PCWSTR extensionName, std::vector<DelegationConfig::DelegationBase>& vec) noexcept
|
||||
{
|
||||
ComPtr<IAppExtensionCatalogStatics> catalogStatics;
|
||||
RETURN_IF_FAILED(Windows::Foundation::GetActivationFactory(HStringReference(RuntimeClass_Windows_ApplicationModel_AppExtensions_AppExtensionCatalog).Get(), &catalogStatics));
|
||||
|
||||
@@ -92,24 +92,24 @@ namespace Microsoft::Console::Render
|
||||
|
||||
// DxRenderer - getter
|
||||
virtual HRESULT Enable() noexcept { return S_OK; }
|
||||
virtual [[nodiscard]] std::wstring_view GetPixelShaderPath() noexcept { return {}; }
|
||||
virtual [[nodiscard]] bool GetRetroTerminalEffect() const noexcept { return false; }
|
||||
virtual [[nodiscard]] float GetScaling() const noexcept { return 1; }
|
||||
virtual [[nodiscard]] Types::Viewport GetViewportInCharacters(const Types::Viewport& viewInPixels) const noexcept { return Types::Viewport::Empty(); }
|
||||
virtual [[nodiscard]] Types::Viewport GetViewportInPixels(const Types::Viewport& viewInCharacters) const noexcept { return Types::Viewport::Empty(); }
|
||||
[[nodiscard]] virtual std::wstring_view GetPixelShaderPath() noexcept { return {}; }
|
||||
[[nodiscard]] virtual bool GetRetroTerminalEffect() const noexcept { return false; }
|
||||
[[nodiscard]] virtual float GetScaling() const noexcept { return 1; }
|
||||
[[nodiscard]] virtual Types::Viewport GetViewportInCharacters(const Types::Viewport& viewInPixels) const noexcept { return Types::Viewport::Empty(); }
|
||||
[[nodiscard]] virtual Types::Viewport GetViewportInPixels(const Types::Viewport& viewInCharacters) const noexcept { return Types::Viewport::Empty(); }
|
||||
// DxRenderer - setter
|
||||
virtual void SetAntialiasingMode(const D2D1_TEXT_ANTIALIAS_MODE antialiasingMode) noexcept {}
|
||||
virtual void SetCallback(std::function<void(HANDLE)> pfn) noexcept {}
|
||||
virtual void EnableTransparentBackground(const bool isTransparent) noexcept {}
|
||||
virtual void SetForceFullRepaintRendering(bool enable) noexcept {}
|
||||
virtual [[nodiscard]] HRESULT SetHwnd(const HWND hwnd) noexcept { return E_NOTIMPL; }
|
||||
[[nodiscard]] virtual HRESULT SetHwnd(const HWND hwnd) noexcept { return E_NOTIMPL; }
|
||||
virtual void SetPixelShaderPath(std::wstring_view value) noexcept {}
|
||||
virtual void SetRetroTerminalEffect(bool enable) noexcept {}
|
||||
virtual void SetSelectionBackground(const COLORREF color, const float alpha = 0.5f) noexcept {}
|
||||
virtual void SetSoftwareRendering(bool enable) noexcept {}
|
||||
virtual void SetWarningCallback(std::function<void(HRESULT)> pfn) noexcept {}
|
||||
virtual [[nodiscard]] HRESULT SetWindowSize(const til::size pixels) noexcept { return E_NOTIMPL; }
|
||||
virtual [[nodiscard]] HRESULT UpdateFont(const FontInfoDesired& pfiFontInfoDesired, FontInfo& fiFontInfo, const std::unordered_map<std::wstring_view, uint32_t>& features, const std::unordered_map<std::wstring_view, float>& axes) noexcept { return E_NOTIMPL; }
|
||||
[[nodiscard]] virtual HRESULT SetWindowSize(const til::size pixels) noexcept { return E_NOTIMPL; }
|
||||
[[nodiscard]] virtual HRESULT UpdateFont(const FontInfoDesired& pfiFontInfoDesired, FontInfo& fiFontInfo, const std::unordered_map<std::wstring_view, uint32_t>& features, const std::unordered_map<std::wstring_view, float>& axes) noexcept { return E_NOTIMPL; }
|
||||
virtual void UpdateHyperlinkHoveredId(const uint16_t hoveredId) noexcept {}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#include <precomp.h>
|
||||
#include "precomp.h"
|
||||
|
||||
#include "adaptDispatch.hpp"
|
||||
#include "../../types/inc/utils.hpp"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#include <precomp.h>
|
||||
#include "precomp.h"
|
||||
|
||||
#include "telemetry.hpp"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#include <precomp.h>
|
||||
#include "precomp.h"
|
||||
|
||||
#include "telemetry.hpp"
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#include <precomp.h>
|
||||
#include "precomp.h"
|
||||
|
||||
void PrintUsage()
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#include <precomp.h>
|
||||
#include "precomp.h"
|
||||
|
||||
#include <windowsinternalstring.h>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#include <precomp.h>
|
||||
#include "precomp.h"
|
||||
#include <windows.h>
|
||||
#include <wincon.h>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user