summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Swanson <swanson@ukfsn.org>2006-01-14 13:38:55 +0000
committerRodney Dawes <dobey@src.gnome.org>2006-01-14 13:38:55 +0000
commit0f56daf38d2fd44aaeeb95fb79dd5b5ebe8d6765 (patch)
tree8cec76cd5d32a7579c6cb731e4d03bd6b295c3d3
parentaa194e3fe2911a827a7f49f7d706a448135a251c (diff)
downloadgnome-control-center-0f56daf38d2fd44aaeeb95fb79dd5b5ebe8d6765.tar.gz
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
-rw-r--r--libbackground/ChangeLog14
-rw-r--r--libbackground/applier.c21
-rw-r--r--libbackground/preferences.c5
-rw-r--r--libbackground/preferences.h2
4 files changed, 41 insertions, 1 deletions
diff --git a/libbackground/ChangeLog b/libbackground/ChangeLog
index caa0ea84a..af9005956 100644
--- a/libbackground/ChangeLog
+++ b/libbackground/ChangeLog
@@ -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
diff --git a/libbackground/applier.c b/libbackground/applier.c
index 68da91b62..0a4275e87 100644
--- a/libbackground/applier.c
+++ b/libbackground/applier.c
@@ -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;
diff --git a/libbackground/preferences.c b/libbackground/preferences.c
index e0c0519a0..84eda13c9 100644
--- a/libbackground/preferences.c
+++ b/libbackground/preferences.c
@@ -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:
diff --git a/libbackground/preferences.h b/libbackground/preferences.h
index ad2d719eb..30fb7df18 100644
--- a/libbackground/preferences.h
+++ b/libbackground/preferences.h
@@ -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;