microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
110.71k stars 6.52k forks source link

[FancyZones] Un-snapped windows still belong to their previous zone #9461

Open fran-f opened 3 years ago

fran-f commented 3 years ago

When handling windows with a combination of Win+Left/Right and mouse, there are often situations when a window jumps to an unexpected location. I have two cases that I can reproduce consistently and---I might be jumping to a diagnosis here---feel connected.

Baseline for both cases:

  1. Enable a layout with at least two zones
  2. Open a new Notepad window

Case 1

  1. Disable "Restore the original size of windows when unsnapping"
  2. Focus the Notepad window
  3. Hit Win-Right
  4. ✔️ Notepad snaps to Zone 1
  5. With the mouse, un-snap the window from Zone 1
  6. Hit Win-Right
  7. ❌ Notepad snaps to Zone 2, instead of Zone 1

Same result repeating the steps with "Restore the original size of windows when unsnapping" enabled.

Case 2

  1. Enable "Restore the original size of windows when unsnapping"
  2. Move the Notepad window in a "starting position"; for example, the very center of the screen
  3. Holding Shift, drag Notepad on Zone 1, but drop it in a place easy to remember; for example, half outside the screen
  4. ✔️Notepad snaps to Zone 1
  5. With the mouse, un-snap the window from Zone 1
  6. ✔️Notepad returns to its original dimensions
  7. Hit Win-Left
  8. ❌Notepad jumps half outside the screen, instead of Zone 2

It seems that FancyZones thinks that Notepad is still in Zone 1, and moving "left" it returns it to the recorded location.

[ A separate issue: the window should be restored to the starting location (the center of the screen in this case) and not the "drop" location (half outside the screen). ]

ℹ Computer information

enricogior commented 3 years ago

@fran-f thank you for reporting the issue. This is a mix of https://github.com/microsoft/PowerToys/issues/9453 (that is a regression for which we are going to release a hot fix) and https://github.com/microsoft/PowerToys/issues/9464 Closing this issue in favor of the other two,

fran-f commented 3 years ago

@enricogior I have updated PowerToys to v.0.31.2, and both behaviours are still present. Since #9464 focusses on the "Restore the original size of windows when unsnapping" option, I would suggest to re-open this one, which is indipendent by its status.

I also stand by my initial diagnosis: when a window is moved out of a zone, the internal "current zone" state is not cleared.

enricogior commented 3 years ago

@fran-f I'll edit the issue since Case 1 is the same as #9464 and there is no reason to track the same problem in two issue. So let's use this issue to track just Case2.