Page MenuHome

Fix T97304: Win32 Aero Snap Positioning
Changes PlannedPublic

Authored by Harley Acheson (harley) on Apr 13 2022, 10:43 PM.

Details

Summary

Windows API GetWindowPlacement does not include updated position after
you "Aero Snap" a window to a monitor edge. This updates that position
on normal window restore.


This would need some testing (by others) to ensure there are no bad side effects. Everything seems to work with a quick check, but there are lots of combinations of transitioning between states to verify.

Will set the bug reporter to initial reviewer to see if they will test. Afterward I'll add platform reviewer.

Diff Detail

Repository
rB Blender

Event Timeline

Ray Molenkamp (LazyDodo) added inline comments.
intern/ghost/intern/GHOST_WindowWin32.cpp
489

weird sentence, also why is Snap capitalized?

@Ray Molenkamp (LazyDodo) - weird sentence...

Yes, I was trying to be too economical and make a one-sentence comment. LOL. Have expanded that to be more useful.

also why is Snap capitalized?

I wanted to include the official feature name there because I found very little information on the subject until I found that dumb name.

Thank you Harley. Your solution works :D


But this change has a side effect.
Attaching gifs and reproducing steps to tell the issue introduced by this change
steps:

  • split window
  • Click blender icon in task bar to minimize and then maximize it
  • maximize window from title bar
  • press Restore down button
  • Window appears in same size as it was in split state (this is not the case with may other applications including blender without this patch)
other applicationsbuildbot buildwith patch

@Pratik Borhade (PratikPB2123) - Thank you Harley. Your solution works :D

Thanks for testing!

But this change has a side effect.
steps:

  • split window
  • maximize it
  • Restore down button
  • Window size appears of same size as it was in split state (this is not the case with may other applications including blender without this patch)

I'm not quite seeing it, so maybe we are talking about different things. Note that I have multiple monitors (of differing DPI) so I actually sometimes see the same (weird) behavior with Blender as I do with Windows Notepad. I'm using Notepad as comparison because it is simple and should work as Microsoft Intended.

I have Notepad open on a monitor, not full screen. I drag it to a monitor edge and it then takes up half the monitor. I then hit the maximize button and it takes up the entire space. I click the same button again (now "Restore Down") and then it randomly does one of two things: it either goes back to size and position before I started, or it restores at a place that is straddling both monitors (which is dumb).

If I do the above with Blender I get identical result. With Blender usually going back to the position it was to begin with, sometimes straddling my monitors like Notepad does. When this works correctly it seems to match what you show for "other applications". I can't tell what you showing with the "with patch" example since it appears to be launching maximized so I don't see what the normal position is.

Hi, haven't checked with multiple screens yet but can do this later.
Tested patch again and realized that steps are bit different for replicating the issue. You need to minimize the window after you split monitor screen (also updated the last message)
gifs can be confusing so recorded video files this time.
The issue is: when I press "restore down" button after "maximizing" the window, window goes back to it's previous size and position of split screen (covers half of the monitor).
I expect Blender window back to the center just like notepad.
This is not very easily noticeable so I'm totally ok with the current behavior

NotepadBlender with patch
Harley Acheson (harley) planned changes to this revision.Apr 17 2022, 2:37 AM

@Pratik Borhade (PratikPB2123) - You need to minimize the window after you split monitor screen...

Oh yes, it is a little different. Although I'm not sure how to do that. In order for the restore to back to the docked position I have to save it to that rcNormalPosition, so I don't have the previous non-docked position to go back to.

If this were the only issue I'd still be happy, but...

There is a regression from current behavior. If you have the window at some size that is not full screen, Window / Toggle Full Screen and then back again will not restore to the previous position with this patch applied.

gifs can be confusing so recorded video files this time.

100+ this!

Please don’t upload gifs. Phabricator has no gui for controlling them, which makes it difficult to tell where the beginning and end are, and impossible to look at individual frames. They are almost always larger, therefor take longer to download. Even if similar to h264 mp4s in size, the gif takes longer to load, at least in my experience in the US.