RamonUnch / AltSnap

Maintained continuation of Stefan Sundin's AltDrag
GNU General Public License v3.0
2.07k stars 66 forks source link

Unable to delete a file or folder inside a window that has just been alt-dragged #414

Open Riman85 opened 1 year ago

Riman85 commented 1 year ago

Selecting a file or a folder and pressing the "delete" key no longer works (at least for a while) after alt-dragging the window that contains it.

Pressing Ctrl to focus the window does not help, neither does the option to always focus the window when alt-dragging. The only work-around I am aware of is to left-click somewhere outside the window and then return back to it.

However, deleting the file/folder via the right-click menu is not affected by this.

My OS is Windows 10 22H2 x64, but I am pretty sure that the issue has been present since the AltDrag and Windows 7 days.

RamonUnch commented 1 year ago

I am not sure I understand, you mean that the DEL key gets blocked? Ctrl to focus cannot be 100% reliable because the OS does not want random windows to be able to popup and steal focus. But I never saw it to be not working, for me it fails only once after an AltSanp restart.

I cannot reproduce your problem with the DEL key, I would need more context, did happen with older versions? and do you have other programs running that might interact? (AHK scripts etc.)

RamonUnch commented 1 year ago

Also it might be an interaction with a shellext, so could you try also with selected text in notepad instead of a selected file on the explorer? Finally could you give a copy f your ini file (you can zip it and attach it to a post).

Riman85 commented 1 year ago

I am not sure I understand, you mean that the DEL key gets blocked? Ctrl to focus cannot be 100% reliable because the OS does not want random windows to be able to popup and steal focus. But I never saw it to be not working, for me it fails only once after an AltSanp restart.

I cannot reproduce your problem with the DEL key, I would need more context, did happen with older versions? and do you have other programs running that might interact? (AHK scripts etc.)

Yes, exactly, the DEL key gets blocked, except for the very first time I alt-drag the window after a reboot. Even if I close the window and then open it anew and then alt-drag it around, the issue persists, unless I left-click outside of the window.

It happens with AltDrag 1.1 and AltSnap 1.60. I don't know about earlier versions of AltSnap, because I only very recently discovered your fork.

I am not aware of any programs that might be interacting, but now that you've mentioned it, it sure seems like that, because I don't think I've experienced the issue on a clean reinstall (which I recently had to do). Just in case I've also closed anything running in the tray (Outlook, uTorrent 2.1.1 portable, foobar2000, nVidia settings, SyncBack Pro), but the issue was still present.

I will try to reproduce it in a clean VM (with no AltSnap on the host).

Also it might be an interaction with a shellext, so could you try also with selected text in notepad instead of a selected file on the explorer? Finally could you give a copy f your ini file (you can zip it and attach it to a post).

I've tried with selected text in Notepad, no issues there. The .ini file should be the default one as I haven't changed any settings at all (see attachment AltSnap.zip).

RamonUnch commented 1 year ago

From what you describe you could try to set the EndSendKey=FF in the [Input] section of the ini file, maybe explorer does not like to receive ctrl (which is the default). I will have a deeper look later, thanks for your detailed report!

Riman85 commented 1 year ago

From what you describe you could try to set the EndSendKey=FF in the [Input] section of the ini file, maybe explorer does not like to receive ctrl (which is the default). I will have a deeper look later, thanks for your detailed report!

Thanks! Unfortunately that did not resolve the issue.

Just to clarify, when I mentioned the Ctrl part in my original post, it was just to emphasize that I wasn't trying to delete files/folders in a window that perhaps was accidentally out of focus.

Anyhow, I spun up a VM of a clean Win 10 x64 22H2 (.iso downloaded directly from MS), not even updates (no internet connection), only installed VMware tools and AltSnap on it. Surprisingly, the issue appeared there as well. (FYI, I didn't use Unify mode.) However, I don't know exactly what and how much VMware tools communicate from the host to the guest.

I made a screen recording of it to hopefully give a better idea of what is going on. The times when I have selected the file/folder, but nothing happens, is when I try to delete them via the DEL key. Afterwards I delete them successfully via the right-click menu and so on.

AltSnap Video.zip

EDIT: I now gave it a try with no VMware tools installed, the issue persists in the VM.

RamonUnch commented 1 year ago

Thanks for the clarification and for the very clear video, it is Weird indeed. I have no idea on how to fix the issue right now because it is now quite clear that the issue is not really due to the DEL key being blocked by AltSnap as there is no issue on Notepad, so it is a more complex issue related to explorer and maybe other windows.

A last test could be to try using the WinKey as a hotkey instead of the Alt key? This might not be ideal for you but testing costs nothing.

Ichisich commented 1 year ago

Can confirm, the issue only presents itself when using ALT as hotkey and inside the Windows10 Explorer. A focus loss resolves the issue. Even switching between fields inside the explorer resolves the issue.

Currently, the easiest workaround, I could muster, is pressing alt twice after moving the explorer window.

Ichisich commented 1 year ago

It seems the issue is a Windows Bug. You can reproduce the issue with a native Alt+click and Alt+drag (selection rectangle) inside the explorer as well.

RamonUnch commented 1 year ago

The way the new ribbon accelerators works is different from the usual menu selection.

In a classic program with a menu bar the selection of the File menu for example can be done via Alt+F or via Alt, F, The way it works is that when you hit Alt, the menu gets the selection on the Alt UP event, so once you hit Alt you can navigate the menu via the keyboard (very useful feature).

The newer Ribbon works is slightly different and the Ribbon also selection starts when you keep Alt Down for a while, you will see the hints (the small letters that pops up everywhere). Because of this interaction with the Alt key is far more tricky to be canceled by AltSanp. I am not sure how it could be done reliably.

Ichisich commented 1 year ago

I tried some EndSendKey events but nothing works. Pressing double Alt manually (focus ribbon, defocus ribbon) helps and would probably be worth a consideration.

Should only affect Alt as a hotkey and apply in Windows 8/10's explorer. (explorer.exe:*|CabinetWClass) Windows 11 got rid of ribbons, although I have currently no means to test that OS, and other applications with ribbons don't show this behavior (tested Paint3D and Wordpad).

mbartlett21 commented 1 week ago

I can confirm that Windows 11 23H2 still has this behaviour.

I haven't generally run into the issue, as I set my hotkeys to winkeys rather than alts. (I found that alt conflicted with too many CAD etc. applications).

Riman85 commented 1 week ago

I can confirm that Windows 11 23H2 still has this behaviour.

I haven't generally run into the issue, as I set my hotkeys to winkeys rather than alts. (I found that alt conflicted with too many CAD etc. applications).

Thanks for checking! In the meantime I'm trying to get used to using the Win key instead, but being also a long-time Linux user it's somewhat hard to readjust this old habit.