Handle the new WPTYPE_ZOOM setting and return proper geometry for it

2006-01-14  Alan Swanson <swanson@ukfsn.org>

	* applier.c (get_geometry): Handle the new WPTYPE_ZOOM setting and
	return proper geometry for it

	* preferences.c (_bg_wptype_values[]): Add the alias for the zoom type
	(read_wptype_from_string): Handle setting the type for zoom
	(bg_preferences_get_wptype_as_string): Return the string for the new
	zoom setting type

	* preferences.h (_wallpaper_type_t): Add the new zoom type

	Partial code for #105231
This commit is contained in:
Alan Swanson 2006-01-14 13:38:55 +00:00 committed by Rodney Dawes
parent aa194e3fe2
commit 0f56daf38d
4 changed files with 41 additions and 1 deletions

View file

@ -1091,6 +1091,27 @@ get_geometry (wallpaper_type_t wallpaper_type,
break;
case WPTYPE_ZOOM:
asp = (gdouble) pwidth / (gdouble) virtual_geom->width;
if (asp > (gdouble) pheight / virtual_geom->height) {
src_geom->width = pwidth * virtual_geom->height / pheight;
src_geom->height = pheight;
src_geom->x = (pwidth - src_geom->width) / 2;
src_geom->y = 0;
} else {
src_geom->width = pwidth;
src_geom->height = pheight * virtual_geom->width / pwidth;
src_geom->x = 0;
src_geom->y = (pheight - src_geom->height) / 2;
}
dest_geom->x = dest_geom->y = 0;
dest_geom->width = field_geom->width;
dest_geom->height = field_geom->height;
break;
case WPTYPE_STRETCHED:
dest_geom->width = field_geom->width;
dest_geom->height = field_geom->height;