Skip to content

shell: Use logical properties when getting usable area

Pablo Correa Gomez requested to merge pabloyoyoista/phosh:shell-usable-area into main

The rationale for this MR is to fix a bug in the background scaling when the primary monitor has an adjustable resolution and that is set to a different value than the default one. Original report in postmarketos.

For the primary monitor, the logic to get the background's width and height makes use of phosh_shell_get_usable_area: https://gitlab.gnome.org/World/Phosh/phosh/-/blob/main/src/background.c#L270 which is the function edited in this MR.

Previous to this MR, when the monitor is set to a resolution different than default one (scale 1.0), the monitor mode reflects this reduced resolution, but scaling is also adjusted accordingly. In consequence, when dividing the mode properties by the scale, we get the wrong usable area (basically the usable area divided by the scaling. I can provide some debug logs for verification if needed).

And some example:

  • Display set to maximum resolution 1920x1080 -- mode: 1920x1080; scale: 1.0; usable area: 1920x1008
  • Display set to some other resolution, like 1280x720 -- mode: 1280x720; scale: 1.5; usable area before: 853x408; usable area after: 1280x648

I could have simply remove the division by scale, but I thought that we would get a more simplified code by using display->logical instead.

Merge request reports

Loading