Skip to content

Commit

Permalink
update schema, actually fix the default values.
Browse files Browse the repository at this point in the history
  • Loading branch information
zadjii-msft committed Sep 8, 2021
1 parent f97efcc commit 6b5d03b
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
10 changes: 9 additions & 1 deletion doc/cascadia/profiles.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1348,7 +1348,7 @@
"properties": {
"acrylicOpacity": {
"default": 0.5,
"description": "When useAcrylic is set to true, it sets the transparency of the window for the profile. Accepts floating point values from 0-1 (default 0.5).",
"description": "[deprecated] Please use `opacity` instead.",
"maximum": 1,
"minimum": 0,
"type": "number"
Expand Down Expand Up @@ -1561,6 +1561,14 @@
"minLength": 1,
"type": "string"
},

"opacity": {
"default": 100,
"description": "Sets the opacity of the window for the profile. Accepts values from 0-100. Defaults to 50 when useAcrylic is set to true.",
"maximum": 100,
"minimum": 0,
"type": "number"
},
"padding": {
"default": "8, 8, 8, 8",
"description": "Sets the padding around the text within the window. Can have three different formats:\n -\"#\" sets the same padding for all sides \n -\"#, #\" sets the same padding for left-right and top-bottom\n -\"#, #, #, #\" sets the padding individually for left, top, right, and bottom.",
Expand Down
3 changes: 1 addition & 2 deletions src/cascadia/TerminalControl/TermControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,10 +495,9 @@ namespace winrt::Microsoft::Terminal::Control::implementation
}
else if (auto solidColor = RootGrid().Background().try_as<Media::SolidColorBrush>())
{
auto originalOpacity = solidColor.Opacity();
const auto originalOpacity = solidColor.Opacity();
solidColor.Color(bg);
solidColor.Opacity(originalOpacity);
// solidColor.Color(til::color{bg.r, bg.g, bg.b, base::saturated_cast<uint8_t>(255 * originalOpacity)})
}
}
}
Expand Down
10 changes: 9 additions & 1 deletion src/cascadia/TerminalSettingsModel/TerminalSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,15 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
_IntenseIsBold = WI_IsFlagSet(appearance.IntenseTextStyle(), Microsoft::Terminal::Settings::Model::IntenseStyle::Bold);
_IntenseIsBright = WI_IsFlagSet(appearance.IntenseTextStyle(), Microsoft::Terminal::Settings::Model::IntenseStyle::Bright);

_Opacity = appearance.Opacity();
// If the user set an opacity, then just use that. Otherwise, change the
// default value based off of whether useAcrylic was set or not. If they
// want acrylic, then default to 50%. Otherwise, default to 100% (fully
// opaque)
_Opacity = appearance.HasOpacity() ?
appearance.Opacity() :
UseAcrylic() ?
.5 :
1.0;
}

// Method Description:
Expand Down
15 changes: 7 additions & 8 deletions src/cascadia/WindowsTerminal/NonClientIslandWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,11 @@ void NonClientIslandWindow::_UpdateFrameMargins() const noexcept
{
MARGINS margins = { 0, 0, 0, 0 };

// GH#603: When we're in Focus Mode, hide the titlebar, by setting it to a single
// pixel tall. Otherwise, the titlebar will be visible underneath controls with
// vintage opacity set.
//
// We can't set it to all 0's unfortunately.
if (_borderless)
{
margins.cyTopHeight = 1;
Expand Down Expand Up @@ -900,14 +905,8 @@ void NonClientIslandWindow::_SetIsBorderless(const bool borderlessEnabled)
_titlebar.Visibility(_IsTitlebarVisible() ? Visibility::Visible : Visibility::Collapsed);
}

// These are all useless.
// auto windowStyle = GetWindowLongW(GetHandle(), GWL_STYLE);
// WI_ClearAllFlags(windowStyle, WS_OVERLAPPEDWINDOW);
// WI_SetFlag(windowStyle, WS_SIZEBOX);
// // WI_SetFlag(windowStyle, WS_BORDER);
// WI_SetFlag(windowStyle, WS_POPUP);
// SetWindowLongWHelper(GetHandle(), GWL_STYLE, windowStyle);

// Update the margins when entering/leaving focus mode, so we can prevent
// the titlebar from showing through transparent terminal controls
_UpdateFrameMargins();

// GH#4224 - When the auto-hide taskbar setting is enabled, then we don't
Expand Down

1 comment on commit 6b5d03b

@github-actions

This comment was marked as resolved.

Please sign in to comment.