GNOME Bugzilla – Bug 755097
wayland: A couple of HiDPI window geometry fixes
Last modified: 2021-07-05 13:46:13 UTC
"unconstrained_rect" and "saved_rect" were left as-is when the "rect" changed given a new main monitor scale the window got. These two patches fixes this by also scaling these rectangles at the same time.
Created attachment 311435 [details] [review] wayland: Scale unconstrained rect changing monitor scale When a window is moved across monitors with different scales, its rectangle is scaled accordingly. We also need to scale the unconstrained_rect rectangle, so that moving a window via meta_window_move_resize() which uses the unconstrained_rect.
Created attachment 311436 [details] [review] wayland: Scale saved rect changing monitor scale The saved rect is used to restore a saved window size. We need to update this when the window is moved to a monitor with different scale, so that if we unmaximize a window which was moved to a different monitor while maximized (for example when unplugged) will restore to the correct size.
Review of attachment 311435 [details] [review]: Looks good
Review of attachment 311436 [details] [review]: I think this is right. What I wondered is if in some cases moving a maximized window to another monitor might leave the saved_rect on the old monitor - in which case scaling it would be wrong. But: - Dragging a window to a new monitor necessarily unmaximizes it - Using a keybinding to move a window to a new monitor goes through meta_window_move_to_monitor() => meta_window_move_between_rects() updating the saved rect - Changes to the output layout go through meta_window_update_for_monitors_changed() which also goes through meta_window_move_between_rects() It doesn't feel absolutely rock-solid - there possibly should be some sort of enforcement that saved_rect is always on the same monitor - but I think it's good ehough.
Pushing the attached patches, but not marking as fixed, given the above comment. Attachment 311435 [details] pushed as bc9e63d - wayland: Scale unconstrained rect changing monitor scale Attachment 311436 [details] pushed as a9df4bb - wayland: Scale saved rect changing monitor scale
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/mutter/-/issues/ Thank you for your understanding and your help.