-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Improved behavior when dragging items from an unfocused Files window #16508
base: main
Are you sure you want to change the base?
Conversation
…itialized & Added unregisteration
@Jack251970 the behavior is working nicely when Files is maximized. Is there a way to also do this when Files isn't maximized? |
@yaira2 Sorry, I cannot get your meaning. What is the difference between the behaviour when File is maximized and when it is not? |
https://github.com/user-attachments/assets/91b17452-b706-47fe-be16-89460ec12508 |
I meant that Files is brought to the foreground if the window isn't maximized. |
Sorry, still no idea about why Files needs to be brought to the foreground if the window isn't maximized. (Under what situation?) As you can see in the video above, my codes implement a function that the Files will stay in the current z index (not be brought to front for covering another topper window that need to drag files into) if dragging selected files so that it will have the same experience as system File Explorer. |
Putting aside the behavior, you can use DidPositionChanged from AppWindow.Changed event instead of utilizing win32 apis. |
I am not quite familiar with this api. Will it make some differences? |
@Jack251970 I'm referring to the behavior (around two seconds into your recording) where the Files window is brought to the foreground.
Isn't the expected behavior for File Explorer to remain the topmost window? |
Get it. I will try to make this work. |
Thanks! I should note, your current changes already helped to resolve this issue when the window is maximized. |
Yeah you don't have to hook/unhook win32 window message loop, there's high-level API wrapper called WinRT API as opposed to low-level Win32 API. This API let you just subscribe an event. Go to MainWindow and subscribe this.AppWindow.Changed event and get args.DidPositionChange property value. |
Sure, I will have a try. |
@yaira2 Sorry about the misunderstanding description (I have removed the useless step that asks you to maximize the Files window). This feature can work while Files isn't a maximized window. |
@0x5bfa Yeah I have found that AppWindow.Changed event contains information about DidPositionChange & ZOrderChange, but I cannot handle these changes. (AppWindowChangedEventArgs does not have Handle property, and I cannot stop those changing event) So I think WindowMessageReceived event in WinUIEx.WindowManager is the only way to implement this and WinUIEx package has provided a good solution for this. |
@Jack251970 thank you for clarifying. I'll test again to confirm the behavior works on my side. |
Thanks, I missed that. I'll file a feature request on WinAppSdk for this later. |
@Jack251970 I can confirm the behavior is working as expected. I'm going to wait for a review from @hishitetsu, but as far as I'm concerned I have no requested changes. |
Resolved / Related Issues
Steps used to test these changes
Stability is a top priority for Files and all changes are required to go through testing before being merged into the repo. Please include a list of steps that you used to test this PR.