From: Hans de Goede Date: Sun, 25 Aug 2019 16:01:59 +0000 (+0200) Subject: two-step: bgrt: Add workaround for desktops which do not use the golden ratio X-Git-Tag: 0.9.5~46^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b3be154867ddfc3315a39e57d23a374142c7d2f;p=thirdparty%2Fplymouth.git two-step: bgrt: Add workaround for desktops which do not use the golden ratio 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 --- diff --git a/src/plugins/splash/two-step/plugin.c b/src/plugins/splash/two-step/plugin.c index 2e596d54..b5ef926f 100644 --- a/src/plugins/splash/two-step/plugin.c +++ b/src/plugins/splash/two-step/plugin.c @@ -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);