Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable unfocused acrylic #15923

Merged
merged 46 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
fdbbf02
in app acrylic
Jaswir Jul 28, 2023
dff51f8
settings change test
Jaswir Jul 28, 2023
35dbd32
plumbing global settings part 1
Jaswir Jul 28, 2023
e8d47d5
plumbing global settings part 2
Jaswir Jul 28, 2023
bd41d65
use controlsettings instead of core
Jaswir Jul 28, 2023
9d7abaa
Merge branch 'microsoft:main' into jaswir/dev
Jaswir Aug 4, 2023
081eaa2
Temp UseAcrylic2
Jaswir Aug 5, 2023
970d055
Plumbing UseAcrylic2
Jaswir Aug 7, 2023
d77de2b
Merge branch 'microsoft:main' into jaswir/dev
Jaswir Aug 10, 2023
a7b5686
UseAcrylic plumbing progress commit before I lose this
Jaswir Aug 10, 2023
f8a66b9
Demolished part of the thing
Jaswir Aug 10, 2023
1325127
Plumbing done, with buggy controlsettings.h manual addition
Jaswir Aug 10, 2023
3c28b5d
Solved merge conflicts with master
Jaswir Aug 22, 2023
23fbe82
Acrylic unfocused + focused ugly buggy code
Jaswir Aug 22, 2023
2e57567
EnableUnfocusedAcrylic taken into account when changing acrylic upon …
Jaswir Aug 22, 2023
83bb426
Merge branch 'microsoft:main' into jaswir/dev
Jaswir Aug 23, 2023
a2fe7cf
Fixed bug I introduced by trying things out and forgetting about it
Jaswir Aug 23, 2023
56410fd
By lack of benefit from using Background Brush instead of _changeBack…
Jaswir Aug 23, 2023
7edbb6e
Merge branch 'microsoft:main' into jaswir/dev
Jaswir Aug 23, 2023
3245370
profiles.schema.json for compatability.enableUnfocusedAcrylic
Jaswir Aug 23, 2023
fbab1a1
Merge branch 'microsoft:main' into jaswir/7158
Jaswir Aug 27, 2023
71e0270
Settings Json tooltip for UseAcrylic in Unfocused
Jaswir Aug 27, 2023
b97cdbe
Cleanup vscode settings.json
Jaswir Aug 27, 2023
fc5cca2
Cleanup vscode settings.json part 2
Jaswir Aug 27, 2023
7ea1d1a
Cleanup profiles.schema.json
Jaswir Aug 27, 2023
b7d27e4
Reverted changes to global appearance view model .h
Jaswir Aug 27, 2023
1496864
Solved acrylic bug when switching focus when opacity is 100
Jaswir Aug 28, 2023
5ecbb19
Merge branch 'microsoft:main' into jaswir/7158
Jaswir Aug 28, 2023
0e129e1
Solved bug that colorscheme no longer updated on focus state change i…
Jaswir Aug 28, 2023
c067698
Cleanup: Closed up macros I accidentally opened in 2 files
Jaswir Aug 29, 2023
7233558
Revert "Cleanup: Closed up macros I accidentally opened in 2 files"
Jaswir Aug 31, 2023
a96c695
Merge branch 'microsoft:main' into jaswir/7158
Jaswir Sep 1, 2023
d152ffb
cleaned up files with opened up macro's that I forgot to close again
Jaswir Sep 1, 2023
1480c77
Removed unfamiliar file name
Jaswir Sep 1, 2023
e58fac2
Removed random created .csproj
Jaswir Sep 1, 2023
517dec8
cleaned up some code
Jaswir Sep 1, 2023
aad7ca3
Cleaned up code more
Jaswir Sep 1, 2023
cce4fcc
removed unnecessary whiteline
Jaswir Sep 1, 2023
5849f4c
Run Code Formatting to get rid of some spaces and set some \ right
Jaswir Sep 1, 2023
c6c58db
cleaned up mtsmsettings.h
Jaswir Sep 1, 2023
8099771
Cleaned up terminal settings cpp, removed unnecesarry comments
Jaswir Sep 1, 2023
21f8f2d
Removed redundant code, applyappearance already deals with brush swit…
Jaswir Sep 1, 2023
86204eb
updated comment for controlcore
Jaswir Sep 1, 2023
0760d40
Update src/cascadia/TerminalControl/TermControl.cpp
Jaswir Sep 7, 2023
dc40bd9
Update src/cascadia/TerminalControl/ControlCore.cpp
Jaswir Sep 7, 2023
039bfe4
Merge branch 'microsoft:main' into jaswir/7158
Jaswir Sep 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions doc/cascadia/profiles.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@
"experimental.pixelShaderPath": {
"description": "Use to set a path to a pixel shader to use with the Terminal when unfocused. Overrides `experimental.retroTerminalEffect`. This is an experimental feature, and its continued existence is not guaranteed.",
"type": "string"
},
"useAcrylic":{
"description": "When set to true, the window will have an acrylic material background when unfocused. When set to false, the window will have a plain, untextured background when unfocused.",
"type": "boolean"
}
},
"type": "object"
Expand Down Expand Up @@ -2173,6 +2177,11 @@
"description": "When set to true, tabs are always displayed. When set to false and \"showTabsInTitlebar\" is set to false, tabs only appear after opening a new tab.",
"type": "boolean"
},
"compatibility.enableUnfocusedAcrylic":{
"default": true,
"description": "When set to true, unfocused windows can have acrylic instead of opaque.",
"type": "boolean"
},
"centerOnLaunch": {
"default": false,
"description": "When set to `true`, the terminal window will auto-center itself on the display it opens on. The terminal will use the \"initialPosition\" to determine which display to open on.",
Expand Down
19 changes: 18 additions & 1 deletion src/cascadia/TerminalControl/ControlCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,24 @@ namespace winrt::Microsoft::Terminal::Control::implementation
_renderEngine->SetSelectionBackground(til::color{ newAppearance->SelectionBackground() });
_renderEngine->SetRetroTerminalEffect(newAppearance->RetroTerminalEffect());
_renderEngine->SetPixelShaderPath(newAppearance->PixelShaderPath());
_renderer->TriggerRedrawAll();

// No need to update Acrylic if UnfocusedAcrylic is disabled
if (_settings->EnableUnfocusedAcrylic())
{
// Manually turn off acrylic if they turn off transparency.
_runtimeUseAcrylic = Opacity() < 1.0 && newAppearance->UseAcrylic();

// Update the renderer as well. It might need to fall back from
// cleartype -> grayscale if the BG is transparent / acrylic.
_renderEngine->EnableTransparentBackground(_isBackgroundTransparent());
_renderer->NotifyPaintFrame();

auto eventArgs = winrt::make_self<TransparencyChangedEventArgs>(Opacity());

_TransparencyChangedHandlers(*this, *eventArgs);
}

_renderer->TriggerRedrawAll(true, true);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/cascadia/TerminalControl/IControlAppearance.idl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace Microsoft.Terminal.Control
Windows.UI.Xaml.VerticalAlignment BackgroundImageVerticalAlignment { get; };
// IntenseIsBold and IntenseIsBright are in Core Appearance
Double Opacity { get; };
Boolean UseAcrylic { get; };

// Experimental settings
Boolean RetroTerminalEffect { get; };
Expand Down
2 changes: 1 addition & 1 deletion src/cascadia/TerminalControl/IControlSettings.idl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace Microsoft.Terminal.Control
String ProfileName;
String ProfileSource;

Boolean UseAcrylic { get; };
Boolean EnableUnfocusedAcrylic;
ScrollbarState ScrollState { get; };

Boolean UseAtlasEngine { get; };
Expand Down
10 changes: 9 additions & 1 deletion src/cascadia/TerminalControl/TermControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,15 @@ namespace winrt::Microsoft::Terminal::Control::implementation
if (acrylic == nullptr)
{
acrylic = Media::AcrylicBrush{};
acrylic.BackgroundSource(Media::AcrylicBackgroundSource::HostBackdrop);

if (_core.Settings().EnableUnfocusedAcrylic())
{
acrylic.BackgroundSource(Media::AcrylicBackgroundSource::Backdrop);
}
else
{
acrylic.BackgroundSource(Media::AcrylicBackgroundSource::HostBackdrop);
}
}

// see GH#1082: Initialize background color so we don't get a
Expand Down
2 changes: 1 addition & 1 deletion src/cascadia/TerminalSettingsEditor/ProfileViewModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
OBSERVABLE_PROJECTED_SETTING(_profile, TabTitle);
OBSERVABLE_PROJECTED_SETTING(_profile, TabColor);
OBSERVABLE_PROJECTED_SETTING(_profile, SuppressApplicationTitle);
OBSERVABLE_PROJECTED_SETTING(_profile, UseAcrylic);
OBSERVABLE_PROJECTED_SETTING(_profile, ScrollState);
OBSERVABLE_PROJECTED_SETTING(_profile, Padding);
OBSERVABLE_PROJECTED_SETTING(_profile, Commandline);
Expand All @@ -98,6 +97,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
OBSERVABLE_PROJECTED_SETTING(_profile.DefaultAppearance(), SelectionBackground);
OBSERVABLE_PROJECTED_SETTING(_profile.DefaultAppearance(), CursorColor);
OBSERVABLE_PROJECTED_SETTING(_profile.DefaultAppearance(), Opacity);
OBSERVABLE_PROJECTED_SETTING(_profile.DefaultAppearance(), UseAcrylic);
OBSERVABLE_PROJECTED_SETTING(_profile, HistorySize);
OBSERVABLE_PROJECTED_SETTING(_profile, SnapOnInput);
OBSERVABLE_PROJECTED_SETTING(_profile, AltGrAliasing);
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/TerminalSettingsModel/GlobalAppSettings.idl
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ namespace Microsoft.Terminal.Settings.Model
INHERITABLE_SETTING(IVector<NewTabMenuEntry>, NewTabMenu);
INHERITABLE_SETTING(Boolean, EnableColorSelection);
INHERITABLE_SETTING(Boolean, EnableShellCompletionMenu);
INHERITABLE_SETTING(Boolean, EnableUnfocusedAcrylic);
INHERITABLE_SETTING(Boolean, IsolatedMode);
INHERITABLE_SETTING(Boolean, AllowHeadless);
INHERITABLE_SETTING(String, SearchWebDefaultQueryUrl);
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/TerminalSettingsModel/IAppearanceConfig.idl
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@ namespace Microsoft.Terminal.Settings.Model
INHERITABLE_APPEARANCE_SETTING(IntenseStyle, IntenseTextStyle);
INHERITABLE_APPEARANCE_SETTING(Microsoft.Terminal.Core.AdjustTextMode, AdjustIndistinguishableColors);
INHERITABLE_APPEARANCE_SETTING(Double, Opacity);
INHERITABLE_APPEARANCE_SETTING(Boolean, UseAcrylic);
};
}
5 changes: 3 additions & 2 deletions src/cascadia/TerminalSettingsModel/MTSMSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Author(s):
X(bool, TrimPaste, "trimPaste", true) \
X(bool, EnableColorSelection, "experimental.enableColorSelection", false) \
X(bool, EnableShellCompletionMenu, "experimental.enableShellCompletionMenu", false) \
X(bool, EnableUnfocusedAcrylic, "compatibility.enableUnfocusedAcrylic", true) \
X(winrt::Windows::Foundation::Collections::IVector<Model::NewTabMenuEntry>, NewTabMenu, "newTabMenu", winrt::single_threaded_vector<Model::NewTabMenuEntry>({ Model::RemainingProfilesEntry{} })) \
X(bool, AllowHeadless, "compatibility.allowHeadless", false) \
X(bool, IsolatedMode, "compatibility.isolatedMode", false) \
Expand All @@ -79,7 +80,6 @@ Author(s):
X(int32_t, HistorySize, "historySize", DEFAULT_HISTORY_SIZE) \
X(bool, SnapOnInput, "snapOnInput", true) \
X(bool, AltGrAliasing, "altGrAliasing", true) \
X(bool, UseAcrylic, "useAcrylic", false) \
X(hstring, Commandline, "commandline", L"%SystemRoot%\\System32\\cmd.exe") \
X(Microsoft::Terminal::Control::ScrollbarState, ScrollState, "scrollbarState", Microsoft::Terminal::Control::ScrollbarState::Visible) \
X(Microsoft::Terminal::Control::TextAntialiasingMode, AntialiasingMode, "antialiasingMode", Microsoft::Terminal::Control::TextAntialiasingMode::Grayscale) \
Expand Down Expand Up @@ -128,7 +128,8 @@ Author(s):
X(ConvergedAlignment, BackgroundImageAlignment, "backgroundImageAlignment", ConvergedAlignment::Horizontal_Center | ConvergedAlignment::Vertical_Center) \
X(hstring, BackgroundImagePath, "backgroundImage") \
X(Model::IntenseStyle, IntenseTextStyle, "intenseTextStyle", Model::IntenseStyle::Bright) \
X(Core::AdjustTextMode, AdjustIndistinguishableColors, "adjustIndistinguishableColors", Core::AdjustTextMode::Never)
X(Core::AdjustTextMode, AdjustIndistinguishableColors, "adjustIndistinguishableColors", Core::AdjustTextMode::Never) \
X(bool, UseAcrylic, "useAcrylic", false)

// Intentionally omitted Appearance settings:
// * ForegroundKey, BackgroundKey, SelectionBackgroundKey, CursorColorKey: all optional colors
Expand Down
1 change: 0 additions & 1 deletion src/cascadia/TerminalSettingsModel/Profile.idl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ namespace Microsoft.Terminal.Settings.Model
INHERITABLE_PROFILE_SETTING(String, TabTitle);
INHERITABLE_PROFILE_SETTING(Windows.Foundation.IReference<Microsoft.Terminal.Core.Color>, TabColor);
INHERITABLE_PROFILE_SETTING(Boolean, SuppressApplicationTitle);
INHERITABLE_PROFILE_SETTING(Boolean, UseAcrylic);
INHERITABLE_PROFILE_SETTING(Microsoft.Terminal.Control.ScrollbarState, ScrollState);
INHERITABLE_PROFILE_SETTING(String, Padding);
INHERITABLE_PROFILE_SETTING(String, Commandline);
Expand Down
3 changes: 2 additions & 1 deletion src/cascadia/TerminalSettingsModel/TerminalSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation

_AdjustIndistinguishableColors = appearance.AdjustIndistinguishableColors();
_Opacity = appearance.Opacity();
_UseAcrylic = appearance.UseAcrylic();
}

// Method Description:
Expand All @@ -276,7 +277,6 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
// Fill in the remaining properties from the profile
_ProfileName = profile.Name();
_ProfileSource = profile.Source();
_UseAcrylic = profile.UseAcrylic();

const auto fontInfo = profile.FontInfo();
_FontFace = fontInfo.FontFace();
Expand Down Expand Up @@ -356,6 +356,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
_ForceVTInput = globalSettings.ForceVTInput();
_TrimBlockSelection = globalSettings.TrimBlockSelection();
_DetectURLs = globalSettings.DetectURLs();
_EnableUnfocusedAcrylic = globalSettings.EnableUnfocusedAcrylic();
}

// Method Description:
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/TerminalSettingsModel/TerminalSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
INHERITABLE_SETTING(Model::TerminalSettings, hstring, ProfileName);
INHERITABLE_SETTING(Model::TerminalSettings, hstring, ProfileSource);

INHERITABLE_SETTING(Model::TerminalSettings, bool, EnableUnfocusedAcrylic, false);
INHERITABLE_SETTING(Model::TerminalSettings, bool, UseAcrylic, false);
INHERITABLE_SETTING(Model::TerminalSettings, double, Opacity, UseAcrylic() ? 0.5 : 1.0);
INHERITABLE_SETTING(Model::TerminalSettings, hstring, Padding, DEFAULT_PADDING);
Expand Down
3 changes: 2 additions & 1 deletion src/cascadia/inc/ControlProperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#define CONTROL_APPEARANCE_SETTINGS(X) \
X(til::color, SelectionBackground, DEFAULT_FOREGROUND) \
X(double, Opacity, 1.0) \
X(bool, UseAcrylic, false) \
X(winrt::hstring, BackgroundImage) \
X(double, BackgroundImageOpacity, 1.0) \
X(winrt::Windows::UI::Xaml::Media::Stretch, BackgroundImageStretchMode, winrt::Windows::UI::Xaml::Media::Stretch::UniformToFill) \
Expand Down Expand Up @@ -55,7 +56,7 @@
#define CONTROL_SETTINGS(X) \
X(winrt::hstring, ProfileName) \
X(winrt::hstring, ProfileSource) \
X(bool, UseAcrylic, false) \
X(bool, EnableUnfocusedAcrylic, false) \
X(winrt::hstring, Padding, DEFAULT_PADDING) \
X(winrt::hstring, FontFace, L"Consolas") \
X(float, FontSize, DEFAULT_FONT_SIZE) \
Expand Down
Loading