chore: 定义 DISABLE_XAML_GENERATED_MAIN

This commit is contained in:
Xu 2023-12-31 19:52:37 +08:00
commit b60ff120e6
3 changed files with 3 additions and 3 deletions

View file

@ -53,7 +53,7 @@
<ClCompile>
<!-- 为了支持 ARM64删除用于 XAML 设计器的几个导出函数,然后自己导出 DllGetActivationFactory -->
<!-- 见 https://github.com/Blinue/Magpie/pull/795#issuecomment-1872681282 -->
<PreprocessorDefinitions>_WINRT_DLL;_VSDESIGNER_DONT_LOAD_AS_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_WINRT_DLL;_VSDESIGNER_DONT_LOAD_AS_DLL;DISABLE_XAML_GENERATED_MAIN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\Magpie.Core\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>

View file

@ -8,7 +8,7 @@
<ProjectGuid>{1801171b-65b6-400f-92ff-73eaf499cfb3}</ProjectGuid>
<RootNamespace>Magpie</RootNamespace>
<WindowsTargetPlatformVersion>10.0.22621.0</WindowsTargetPlatformVersion>
<!-- OutDir 不能放入 Solution.props否则有时会导致编译失败 -->
<!-- OutDir 不能放入 Common.Post.props否则有时会导致编译失败 -->
<OutDir>$(SolutionDir)bin\$(Platform)\$(Configuration)\</OutDir>
<!-- Up-to-date check fails for Xaml Islands projects: -->
<!-- https://github.com/dotnet/project-system/issues/5543 -->

View file

@ -259,7 +259,7 @@ std::pair<POINT, SIZE> MainWindow::_CreateWindow(HINSTANCE hInstance, winrt::Poi
MONITORINFO mi{ sizeof(mi) };
GetMonitorInfo(hMon, &mi);
// 确保启动位置在屏幕工作区内。不允许启动时跨越多个屏幕
// 确保启动位置在屏幕工作区内。不允许启动时跨越多个屏幕
if (windowSize.cx <= mi.rcWork.right - mi.rcWork.left && windowSize.cy <= mi.rcWork.bottom - mi.rcWork.top) {
windowPos.x = std::lroundf(windowCenter.X - windowSizeInPixels.Width / 2);
windowPos.x = std::clamp(windowPos.x, mi.rcWork.left, mi.rcWork.right - windowSize.cx);