Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/Files.App/Actions/Open/OpenClassicPropertiesAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
using System.Runtime.InteropServices;
using Windows.Win32;
using Windows.Win32.UI.Shell;
using Windows.Win32.Foundation;
using Windows.Win32.UI.WindowsAndMessaging;

namespace Files.App.Actions
{
Expand Down Expand Up @@ -53,12 +55,23 @@ private unsafe void ExecuteShellCommand(string itemPath)
info.nShow = 5; // SW_SHOW
info.fMask = 0x0000000C; // SEE_MASK_INVOKEIDLIST

// Prevent Main Window from coming to from when sidebar menu is opened.

MainWindow.Instance.SetCanWindowToFront(false);

fixed (char* cVerb = "properties", lpFile = itemPath)
{
info.lpVerb = cVerb;
info.lpFile = lpFile;

PInvoke.ShellExecuteEx(ref info);
try
{
PInvoke.ShellExecuteEx(ref info);
}
finally
{
MainWindow.Instance.SetCanWindowToFront(true);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cb1ca000ef2f03f1afc7bde9ed4fb2987669c89a58b63919e67574696091f60f
6d8695f63ae17c1df079e8e207b3b8dec7ab5b34b17a79386c6bba77d8684027
7 changes: 6 additions & 1 deletion src/Files.App/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,12 @@ async Task PerformNavigationAsync(string payload, string selectItem = null)
if (rootFrame.Content is MainPage && MainPageViewModel.AppInstances.Any())
{
// Bring to foreground (#14730)
Win32Helper.BringToForegroundEx(new(WindowHandle));

// Exception for Menus opened from the sidebar.
if (CanWindowToFront)
{
Win32Helper.BringToForegroundEx(new(WindowHandle));
}

var existingTabIndex = MainPageViewModel.AppInstances
.Select((tabItem, idx) => new { tabItem, idx })
Expand Down