summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ab53147)
raw | patch | inline | side by side (parent: ab53147)
author | Eric Wertz <ericdwertz@gmail.com> | |
Thu, 16 Mar 2017 13:03:48 +0000 (09:03 -0400) | ||
committer | Eric Wertz <ericdwertz@gmail.com> | |
Thu, 16 Mar 2017 13:03:48 +0000 (09:03 -0400) |
main.c | patch | blob | history |
index 6f7d65f0e864d5049b956c8d3399416dc0d78b85..dd6821444940f7cb8fb09ee32c6db2e22fcd7109 100644 (file)
--- a/main.c
+++ b/main.c
//gconf_client_set_string( client, "/desktop/eric/theme_color", buffer, NULL );
g_settings_set_string( gsettings, "primary-color", buffer );
- //Calculate texture coordiantes
+ //Calculate texture coordinates
tx2 = tx1; ty2 = ty1; tw2 = tw1; th2 = th1; //Copy old values
float aspect = (float)screen_width/(float)screen_height;
float sw, sh;
- float targetheight = (float)width / aspect;
- float targetwidth = (float)height * aspect;
- if( targetwidth >= screen_width && targetwidth <= height )
+ float targetheight = screen_height;
+ float targetwidth = screen_width;
+ float mw = targetwidth/(float)width;
+ float mh = targetheight/(float)height;
+
+ if( mh > mw )
+ {
+ targetwidth = targetheight / (float)height * (float)width;
+ }
+ else if ( mw > mh )
+ {
+ targetheight = targetwidth / (float)width * (float)height;
+ }
+
+ if( targetwidth >= screen_width || targetheight <= screen_height )
{
//Scale width, crop height
tx1 = 0.0f;
GSettingsSchema* gsettings_schema;
gsettings_schema = g_settings_schema_source_lookup( g_settings_schema_source_get_default(),
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- "org.gnome.desktop.background",
- TRUE );
+ "org.gnome.desktop.background",
+ TRUE );
if( gsettings_schema )
{
g_settings_schema_unref (gsettings_schema);