mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-01 01:49:06 +08:00
Fix regression: Open PowerRename on current monitor (#18311)
Add missing reference to Version proj Minor cleanup
This commit is contained in:
parent
88e79ac669
commit
871b456be3
@ -47,6 +47,29 @@ namespace winrt::PowerRenameUI::implementation
|
||||
Microsoft::UI::WindowId windowId =
|
||||
Microsoft::UI::GetWindowIdFromWindow(m_window);
|
||||
|
||||
POINT cursorPosition{};
|
||||
if (GetCursorPos(&cursorPosition))
|
||||
{
|
||||
HMONITOR hMonitor = MonitorFromPoint(cursorPosition, MONITOR_DEFAULTTOPRIMARY);
|
||||
MONITORINFOEX monitorInfo;
|
||||
monitorInfo.cbSize = sizeof(MONITORINFOEX);
|
||||
GetMonitorInfo(hMonitor, &monitorInfo);
|
||||
RECT rect;
|
||||
if (GetWindowRect(m_window, &rect))
|
||||
{
|
||||
int width = rect.right - rect.left;
|
||||
int height = rect.bottom - rect.top;
|
||||
|
||||
MoveWindow(m_window,
|
||||
monitorInfo.rcWork.left + (monitorInfo.rcWork.right - monitorInfo.rcWork.left - width) / 2,
|
||||
monitorInfo.rcWork.top + (monitorInfo.rcWork.bottom - monitorInfo.rcWork.top - height) / 2,
|
||||
width,
|
||||
height,
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Microsoft::UI::Windowing::AppWindow appWindow =
|
||||
Microsoft::UI::Windowing::AppWindow::GetFromWindowId(windowId);
|
||||
appWindow.SetIcon(PowerRenameUIIco);
|
||||
@ -107,7 +130,7 @@ namespace winrt::PowerRenameUI::implementation
|
||||
CComPtr<IShellItemArray> shellItemArray;
|
||||
// To test PowerRename uncomment this line and update the path to
|
||||
// your local (absolute or relative) path which you want to see in PowerRename
|
||||
// files.push_back(<path>);
|
||||
// g_files.push_back(<path>);
|
||||
|
||||
if (!g_files.empty())
|
||||
{
|
||||
|
@ -150,10 +150,9 @@
|
||||
<Image Include="Assets\file.png" />
|
||||
<Image Include="Assets\folder.png" />
|
||||
<Image Include="PowerRenameUI.ico">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<_WildCardPRIResource Include="Strings\*\Resources.resw" />
|
||||
</ItemGroup>
|
||||
@ -161,6 +160,9 @@
|
||||
<ProjectReference Include="..\..\..\common\logger\logger.vcxproj">
|
||||
<Project>{d9b8fc84-322a-4f9f-bbb9-20915c47ddfd}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\common\version\version.vcxproj">
|
||||
<Project>{cc6e41ac-8174-4e8a-8d22-85dd7f4851df}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\lib\PowerRenameLib.vcxproj">
|
||||
<Project>{51920f1f-c28c-4adf-8660-4238766796c2}</Project>
|
||||
</ProjectReference>
|
||||
|
@ -44,7 +44,4 @@
|
||||
</Image>
|
||||
<Image Include="PowerRenameUI.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PRIResource Include="Resources.resw" />
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user