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:
parent
aa194e3fe2
commit
0f56daf38d
4 changed files with 41 additions and 1 deletions
|
@ -1,3 +1,17 @@
|
|||
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
|
||||
|
||||
2005-11-07 Alexis Robert <alexis@linuxcode.eu.org>
|
||||
|
||||
Fixes #320647
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -50,6 +50,7 @@ static GEnumValue _bg_wptype_values[] = {
|
|||
{ WPTYPE_CENTERED, "WPTYPE_CENTERED", "centered"},
|
||||
{ WPTYPE_SCALED, "WPTYPE_SCALED", "scaled"},
|
||||
{ WPTYPE_STRETCHED, "WPTYPE_STRETCHED", "stretched"},
|
||||
{ WPTYPE_ZOOM, "WPTYPE_ZOOM", "zoom"},
|
||||
{ WPTYPE_NONE, "WPTYPE_NONE", "none"},
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
@ -383,6 +384,8 @@ read_wptype_from_string (gchar *string)
|
|||
type = WPTYPE_SCALED;
|
||||
} else if (!strncmp (string, "stretched", sizeof ("stretched"))) {
|
||||
type = WPTYPE_STRETCHED;
|
||||
} else if (!strncmp (string, "zoom", sizeof ("zoom"))) {
|
||||
type = WPTYPE_ZOOM;
|
||||
}
|
||||
g_free (string);
|
||||
}
|
||||
|
@ -432,6 +435,8 @@ bg_preferences_get_wptype_as_string (wallpaper_type_t wp)
|
|||
return "scaled";
|
||||
case WPTYPE_STRETCHED:
|
||||
return "stretched";
|
||||
case WPTYPE_ZOOM:
|
||||
return "zoom";
|
||||
case WPTYPE_NONE:
|
||||
return "none";
|
||||
case WPTYPE_UNSET:
|
||||
|
|
|
@ -52,7 +52,7 @@ typedef enum _orientation_t {
|
|||
|
||||
typedef enum _wallpaper_type_t {
|
||||
WPTYPE_TILED = 0, WPTYPE_CENTERED, WPTYPE_SCALED,
|
||||
WPTYPE_STRETCHED, WPTYPE_NONE,
|
||||
WPTYPE_STRETCHED, WPTYPE_ZOOM, WPTYPE_NONE,
|
||||
WPTYPE_UNSET
|
||||
} wallpaper_type_t;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue