]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
two-step: bgrt: Add workaround for desktops which do not use the golden ratio
authorHans de Goede <hdegoede@redhat.com>
Sun, 25 Aug 2019 16:01:59 +0000 (18:01 +0200)
committerHans de Goede <hdegoede@redhat.com>
Fri, 6 Sep 2019 15:34:05 +0000 (17:34 +0200)
On desktops (no panel) we normally do not use the BGRT provided
xoffset and yoffset because the resolution they are intended for
may be differtent then the resolution of the current display.

On some desktops (no panel) the image gets centered not only
horizontally, but also vertically. In this case our default of using
the golden ratio for the vertical position causes the BGRT image
to jump.

To avoid this this commits adds an extra check to see if the provided
xoffset and yoffset perfectly center the image and in that case uses them.

An example of a system needing this workaround is the Minix Neo Z83-4.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
src/plugins/splash/two-step/plugin.c

index 2e596d54054bac3a2905ae0cf200e82e2185d3fe..b5ef926f559ce599145b485442cd6feb2e3662f3 100644 (file)
@@ -506,6 +506,24 @@ view_set_bgrt_background (view_t *view)
                 }
         }
 
+        /*
+         * On desktops (no panel) we normally do not use the BGRT provided
+         * xoffset and yoffset because the resolution they are intended for
+         * may be differtent then the resolution of the current display.
+         *
+         * On some desktops (no panel) the image gets centered not only
+         * horizontally, but also vertically. In this case our default of using
+         * the golden ratio for the vertical position causes the BGRT image
+         * to jump.  To avoid this we check here if the provided xoffset and
+         * yoffset perfectly center the image and in that case we use them.
+         */
+        if (!have_panel_props && screen_scale == 1 &&
+            (screen_width  - width ) / 2 == sysfs_x_offset &&
+            (screen_height - height) / 2 == sysfs_y_offset) {
+                x_offset = sysfs_x_offset;
+                y_offset = sysfs_y_offset;
+        }
+
         ply_trace ("using %dx%d bgrt image centered at %dx%d for %dx%d screen",
                    width, height, x_offset, y_offset, screen_width, screen_height);