Skip to content

Commit

Permalink
Merge branch 'dev' into onnx
Browse files Browse the repository at this point in the history
  • Loading branch information
Blinue committed Jun 12, 2024
2 parents 1f2693f + b6f5da2 commit 7de2f4b
Show file tree
Hide file tree
Showing 36 changed files with 635 additions and 163 deletions.
16 changes: 2 additions & 14 deletions docs/Home (EN).md
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
# Magpie Wiki
[Chinese version](https://github.com/Blinue/Magpie/wiki/)

Welcome to the Magpie Wiki. Please read [Contributing](https://github.com/Blinue/Magpie/blob/main/CONTRIBUTING_EN.md) if you'd like to contribute the the documentations.

[FAQ](https://github.com/Blinue/Magpie/wiki/FAQ%20(EN))

[Compilation guide](https://github.com/Blinue/Magpie/wiki/Compilation%20guide)

[Built-in effects](https://github.com/Blinue/Magpie/wiki/Built-in%20effects)

[MagpieFX](https://github.com/Blinue/Magpie/wiki/MagpieFX%20(EN))

[Performance optimization](https://github.com/Blinue/Magpie/wiki/Performance%20optimization)

[Comparison of capture methods](https://github.com/Blinue/Magpie/wiki/Comparison%20of%20capture%20methods)
Welcome to the Magpie Wiki. Please read [CONTRIBUTING](https://github.com/Blinue/Magpie/blob/dev/CONTRIBUTING.md) if you'd like to contribute the the documentations.
16 changes: 1 addition & 15 deletions docs/Home.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
# Magpie Wiki

欢迎来到 Magpie Wiki。如果你想贡献文档,请阅读[贡献指南](https://github.com/Blinue/Magpie/blob/main/CONTRIBUTING.md#%E6%88%91%E6%83%B3%E8%B4%A1%E7%8C%AE%E6%96%87%E6%A1%A3-)

[English version](https://github.com/Blinue/Magpie/wiki/Home%20(EN))

[FAQ](https://github.com/Blinue/Magpie/wiki/FAQ)

[编译指南](https://github.com/Blinue/Magpie/wiki/编译指南)

[内置效果介绍](https://github.com/Blinue/Magpie/wiki/内置效果介绍)

[MagpieFX](https://github.com/Blinue/Magpie/wiki/MagpieFX)

[性能优化建议](https://github.com/Blinue/Magpie/wiki/性能优化建议)

[捕获方式对比](https://github.com/Blinue/Magpie/wiki/捕获方式对比)
欢迎来到 Magpie Wiki。如果你想贡献文档,请阅读[贡献指南](https://github.com/Blinue/Magpie/blob/main/CONTRIBUTING_ZH.md#%E6%88%91%E6%83%B3%E8%B4%A1%E7%8C%AE%E6%96%87%E6%A1%A3-)
4 changes: 4 additions & 0 deletions docs/Interact with Magpie programally.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ destRect.right = (LONG)(INT_PTR)GetProp(hwndScaling, L"Magpie.DestRight");
destRect.bottom = (LONG)(INT_PTR)GetProp(hwndScaling, L"Magpie.DestBottom");
```

### Notes

These properties are only guaranteed to exist after the scaling window has completed its initialization. Therefore, it is advisable to check whether the scaling window is visible before retrieving these properties, especially when the window handle is obtained using the class name.

## How to Keep Magpie Scaling When Your Window Is in the Foreground

Magpie stops scaling when the foreground window changes, with some system windows being exceptions. By setting the `Magpie.ToolWindow` property, you can include your window and all its owned windows in the exceptions list.
Expand Down
4 changes: 4 additions & 0 deletions docs/_Sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
- [MagpieFX](https://github.com/Blinue/Magpie/wiki/MagpieFX)
- [性能优化建议](https://github.com/Blinue/Magpie/wiki/性能优化建议)
- [捕获方式对比](https://github.com/Blinue/Magpie/wiki/捕获方式对比)
- [关于触控支持](https://github.com/Blinue/Magpie/wiki/关于触控支持)
- [以编程方式与 Magpie 交互](https://github.com/Blinue/Magpie/wiki/以编程方式与-Magpie-交互)

- [WIKI HOME](https://github.com/Blinue/Magpie/wiki/Home%20(EN))
- [FAQ](https://github.com/Blinue/Magpie/wiki/FAQ%20(EN))
Expand All @@ -13,3 +15,5 @@
- [MagpieFX](https://github.com/Blinue/Magpie/wiki/MagpieFX%20(EN))
- [Performance optimization](https://github.com/Blinue/Magpie/wiki/Performance%20optimization)
- [Comparison of capture methods](https://github.com/Blinue/Magpie/wiki/Comparison%20of%20capture%20methods)
- [About touch support](https://github.com/Blinue/Magpie/wiki/About-touch-support)
- [Interact with Magpie programally](https://github.com/Blinue/Magpie/wiki/Interact-with-Magpie-programally)
4 changes: 4 additions & 0 deletions docs/以编程方式与 Magpie 交互.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ destRect.right = (LONG)(INT_PTR)GetProp(hwndScaling, L"Magpie.DestRight");
destRect.bottom = (LONG)(INT_PTR)GetProp(hwndScaling, L"Magpie.DestBottom");
```

### 注意事项

这些属性只在缩放窗口初始化完成后才保证存在,因此建议检索属性前检查缩放窗口是否可见,尤其是当窗口句柄是使用类名获取到的。

## 如何使 Magpie 在你的窗口位于前台时保持缩放

前台窗口改变时 Magpie 会停止缩放,只对某些系统窗口例外。你可以通过设置属性 `Magpie.ToolWindow` 将自己的窗口添加入例外,这对由该窗口拥有 (owned) 的窗口也有效。
Expand Down
6 changes: 3 additions & 3 deletions publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,11 @@ def remove_file(file):
#
#####################################################################

if len(sys.argv) >= 5:
if len(sys.argv) >= 5 and sys.argv[4] != "":
# sys.argv[2] 保留为打包选项
pfxPath = os.path.join("..\..", sys.argv[3])
pfxPath = os.path.join("..\\..", sys.argv[3])
pfxPassword = sys.argv[4]

p = subprocess.run(f'"{windowsSdkDir}\\x64\\signtool.exe" sign /fd SHA256 /a /f "{pfxPath}" /p "{pfxPassword}" TouchHelper.exe')
if p.returncode != 0:
raise Exception("makepri 失败")
raise Exception("签名失败")
21 changes: 21 additions & 0 deletions src/Magpie.App/HomePage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,25 @@ void HomePage::ComboBox_DropDownOpened(IInspectable const& sender, IInspectable
ComboBoxHelper::DropDownOpened(*this, sender);
}

void HomePage::SimulateExclusiveFullscreenToggleSwitch_Toggled(IInspectable const& sender, RoutedEventArgs const&) {
// 如果没有启用开发者模式,模拟独占全屏选项位于页面底部,用户可能注意不到警告。
// 为了解决这个问题,打开模拟独占全屏选项时自动滚动页面。
if (_viewModel.IsDeveloperMode() || !sender.as<Controls::ToggleSwitch>().IsOn() || !IsLoaded()) {
return;
}

// 这个回调被触发时 UI 还没有更新,需要异步处理
Dispatcher().TryRunAsync(CoreDispatcherPriority::Low, [weakThis(get_weak())]() {
auto strongThis = weakThis.get();
if (!strongThis) {
return;
}

auto scrollViewer = strongThis->PageFrame().ScrollViewer();
scrollViewer.UpdateLayout();
// 滚动到底部
scrollViewer.ChangeView(nullptr, scrollViewer.ScrollableHeight(), nullptr);
});
}

}
2 changes: 2 additions & 0 deletions src/Magpie.App/HomePage.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ struct HomePage : HomePageT<HomePage> {

void ComboBox_DropDownOpened(IInspectable const& sender, IInspectable const&) const;

void SimulateExclusiveFullscreenToggleSwitch_Toggled(IInspectable const& sender, RoutedEventArgs const&);

private:
Magpie::App::HomeViewModel _viewModel;
};
Expand Down
10 changes: 8 additions & 2 deletions src/Magpie.App/HomePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
<local:PageFrame x:Uid="Home_PageFrame">
<local:PageFrame x:Name="PageFrame"
x:Uid="Home_PageFrame">
<local:SimpleStackPanel Padding="0,4,0,0"
HorizontalAlignment="Stretch"
ChildrenTransitions="{StaticResource SettingsCardsAnimations}"
Expand Down Expand Up @@ -170,8 +171,13 @@
<FontIcon Glyph="&#xec46;" />
</local:SettingsCard.HeaderIcon>
<ToggleSwitch x:Uid="ToggleSwitch"
IsOn="{x:Bind ViewModel.IsSimulateExclusiveFullscreen, Mode=TwoWay}" />
IsOn="{x:Bind ViewModel.IsSimulateExclusiveFullscreen, Mode=TwoWay}"
Toggled="SimulateExclusiveFullscreenToggleSwitch_Toggled" />
</local:SettingsCard>
<muxc:InfoBar x:Uid="Home_Advanced_SimulateExclusiveFullscreen_InfoBar"
IsClosable="False"
IsOpen="{x:Bind ViewModel.IsSimulateExclusiveFullscreen, Mode=OneWay}"
Severity="Warning" />
<local:SettingsExpander x:Name="DeveloperModeExpander"
x:Uid="Home_Advanced_DeveloperOptions"
x:Load="{x:Bind ViewModel.IsDeveloperMode, Mode=OneWay}"
Expand Down
4 changes: 2 additions & 2 deletions src/Magpie.App/Magpie.App.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ File.Delete("priconfig.xml");
<Import Project="..\..\packages\Microsoft.UI.Xaml.2.8.6\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('..\..\packages\Microsoft.UI.Xaml.2.8.6\build\native\Microsoft.UI.Xaml.targets')" />
<Import Project="..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.240122.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.240122.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\packages\Microsoft.Web.WebView2.1.0.2478.35\build\native\Microsoft.Web.WebView2.targets" Condition="Exists('..\..\packages\Microsoft.Web.WebView2.1.0.2478.35\build\native\Microsoft.Web.WebView2.targets')" />
<Import Project="..\..\packages\Microsoft.Web.WebView2.1.0.2535.41\build\native\Microsoft.Web.WebView2.targets" Condition="Exists('..\..\packages\Microsoft.Web.WebView2.1.0.2535.41\build\native\Microsoft.Web.WebView2.targets')" />
<Import Project="..\..\packages\Microsoft.AI.DirectML.1.13.1\build\Microsoft.AI.DirectML.targets" Condition="Exists('..\..\packages\Microsoft.AI.DirectML.1.13.1\build\Microsoft.AI.DirectML.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
Expand All @@ -711,7 +711,7 @@ File.Delete("priconfig.xml");
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.240122.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.240122.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Web.WebView2.1.0.2478.35\build\native\Microsoft.Web.WebView2.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Web.WebView2.1.0.2478.35\build\native\Microsoft.Web.WebView2.targets'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Web.WebView2.1.0.2535.41\build\native\Microsoft.Web.WebView2.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Web.WebView2.1.0.2535.41\build\native\Microsoft.Web.WebView2.targets'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.AI.DirectML.1.13.1\build\Microsoft.AI.DirectML.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.AI.DirectML.1.13.1\build\Microsoft.AI.DirectML.props'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.AI.DirectML.1.13.1\build\Microsoft.AI.DirectML.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.AI.DirectML.1.13.1\build\Microsoft.AI.DirectML.targets'))" />
</Target>
Expand Down
2 changes: 1 addition & 1 deletion src/Magpie.App/PageFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void PageFrame::ScrollViewer_ViewChanging(IInspectable const&, ScrollViewerViewC
}

void PageFrame::ScrollViewer_KeyDown(IInspectable const& sender, KeyRoutedEventArgs const& args) {
ScrollViewer scrollViewer = sender.as<ScrollViewer>();
auto scrollViewer = sender.as<Controls::ScrollViewer>();
switch (args.Key()) {
case VirtualKey::Up:
scrollViewer.ChangeView(scrollViewer.HorizontalOffset(), scrollViewer.VerticalOffset() - 100, 1);
Expand Down
2 changes: 2 additions & 0 deletions src/Magpie.App/PageFrame.idl
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ namespace Magpie.App {
Windows.UI.Xaml.Controls.IconElement Icon;
Windows.UI.Xaml.FrameworkElement HeaderAction;
Object MainContent;

Windows.UI.Xaml.Controls.ScrollViewer ScrollViewer { get; };
}
}
3 changes: 2 additions & 1 deletion src/Magpie.App/PageFrame.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@
</Grid>
</local:SimpleStackPanel>
<!-- ScrollViewer 可以接受焦点,这使用户可以通过键盘滚动页面 -->
<ScrollViewer Grid.Row="1"
<ScrollViewer x:Name="ScrollViewer"
Grid.Row="1"
IsTabStop="True"
KeyDown="ScrollViewer_KeyDown"
PointerPressed="ScrollViewer_PointerPressed"
Expand Down
Loading

0 comments on commit 7de2f4b

Please sign in to comment.