mirror of
https://github.com/Blinue/Magpie.git
synced 2026-06-24 02:04:10 +00:00
fix: 全屏模式缩放时不限制最小尺寸
This commit is contained in:
parent
c3473a0604
commit
a5e079b0ee
3 changed files with 12 additions and 18 deletions
|
|
@ -1,4 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Microsoft.Cpp.props 之后导入 -->
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Microsoft.Cpp.Default.props 之后导入 -->
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
|
|
@ -22,21 +23,21 @@
|
|||
<!-- 编译选项 -->
|
||||
<Import Project="$(MSBuildThisFileDirectory)\BuildOptions.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VS17 Condition="$([System.String]::new('$(MSBuildVersion)').StartsWith('17'))">true</VS17>
|
||||
<VS17 Condition="'$(VS17)' != 'true'">false</VS17>
|
||||
<VCProjectVersion Condition="$(VS17)">17.0</VCProjectVersion>
|
||||
<VCProjectVersion Condition="!$(VS17)">18.0</VCProjectVersion>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<MajorVersion Condition="'$(MajorVersion)' == ''">0</MajorVersion>
|
||||
<MinorVersion Condition="'$(MinorVersion)' == ''">0</MinorVersion>
|
||||
<PatchVersion Condition="'$(PatchVersion)' == ''">0</PatchVersion>
|
||||
<!-- 可通过 VersionString 区分开发版本和发布版本 -->
|
||||
<!-- 可通过 VersionString 区分开发版本和发布版本 -->
|
||||
<VersionString Condition="'$(VersionString)' == '' And ('$(MajorVersion)' != '0' Or '$(MinorVersion)' != '0' Or '$(PatchVersion)' != '0')">$(MajorVersion).$(MinorVersion).$(PatchVersion)</VersionString>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset Condition="$(UseClangCL)">ClangCL</PlatformToolset>
|
||||
<VS17 Condition="$([System.String]::new('$(MSBuildVersion)').StartsWith('17'))">true</VS17>
|
||||
<VS17 Condition="'$(VS17)' != 'true'">false</VS17>
|
||||
<VCProjectVersion Condition="$(VS17)">17.0</VCProjectVersion>
|
||||
<VCProjectVersion Condition="!$(VS17)">18.0</VCProjectVersion>
|
||||
<PlatformToolset Condition="!$(UseClangCL) And $(VS17)">v143</PlatformToolset>
|
||||
<PlatformToolset Condition="!$(UseClangCL) And !$(VS17)">v145</PlatformToolset>
|
||||
<UseDebugLibraries Condition="'$(Configuration)' == 'Debug'">true</UseDebugLibraries>
|
||||
|
|
|
|||
|
|
@ -1125,24 +1125,15 @@ ScalingError ScalingWindow::_CalcFullscreenRendererRect(uint32_t& monitorCount)
|
|||
}
|
||||
}
|
||||
|
||||
// 全屏模式缩放无需保持比例,但要限制最小和最大尺寸
|
||||
// 全屏模式缩放无需保持比例,但要限制最大尺寸
|
||||
SIZE ScalingWindow::_AdjustFullscreenWindowSize(SIZE size, uint32_t dpi) const noexcept {
|
||||
if (dpi == 0) {
|
||||
dpi = _currentDpi;
|
||||
}
|
||||
|
||||
const RECT& srcFrameRect = _srcTracker.WindowFrameRect();
|
||||
const LONG spaceAround = lroundf(WINDOWED_MODE_MIN_SPACE_AROUND *
|
||||
dpi / float(USER_DEFAULT_SCREEN_DPI));
|
||||
const LONG minWidth = srcFrameRect.right - srcFrameRect.left + spaceAround;
|
||||
const LONG minHeight = srcFrameRect.bottom - srcFrameRect.top + spaceAround;
|
||||
const LONG maxWidth = GetSystemMetricsForDpi(SM_CXMAXTRACK, dpi);
|
||||
const LONG maxHeight = GetSystemMetricsForDpi(SM_CYMAXTRACK, dpi);
|
||||
|
||||
return SIZE{
|
||||
std::clamp(size.cx, minWidth, maxWidth),
|
||||
std::clamp(size.cy, minHeight, maxHeight)
|
||||
};
|
||||
return SIZE{ std::clamp(size.cx, 1l, maxWidth), std::clamp(size.cy, 1l, maxHeight) };
|
||||
}
|
||||
|
||||
ScalingError ScalingWindow::_InitialMoveSrcWindowInFullscreen() noexcept {
|
||||
|
|
@ -2040,7 +2031,8 @@ void ScalingWindow::_UpdateRendererRect() noexcept {
|
|||
const bool resized = Win32Helper::GetSizeOfRect(_rendererRect) !=
|
||||
Win32Helper::GetSizeOfRect(oldRendererRect);
|
||||
|
||||
if (!_isMovingDueToSrcMoved && !_srcTracker.IsMoving()) {
|
||||
// 全屏模式缩放时不移动源窗口,因为我们不限制最小尺寸,而且源窗口可能处于最大化或全屏状态
|
||||
if (_options.IsWindowedMode() && !_isMovingDueToSrcMoved && !_srcTracker.IsMoving()) {
|
||||
// 确保源窗口中心点和缩放窗口中心点相同。应先移动源窗口,因为之后需要调整光标位置
|
||||
const RECT& srcRect = _srcTracker.WindowRect();
|
||||
const int offsetX = (_windowRect.left + _windowRect.right - srcRect.left - srcRect.right) / 2;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue