ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #00016
[Merge] lp:~bratsche/xsplash/new-assets into lp:xsplash
Cody Russell has proposed merging lp:~bratsche/xsplash/new-assets into lp:xsplash.
Requested reviews:
Canonical Desktop Experience Team (canonical-dx-team)
mt kicks ass.
--
https://code.launchpad.net/~bratsche/xsplash/new-assets/+merge/10934
Your team ayatana-commits is subscribed to branch lp:xsplash.
=== modified file 'images/Makefile.am'
--- images/Makefile.am 2009-08-20 11:07:58 +0000
+++ images/Makefile.am 2009-08-31 18:47:10 +0000
@@ -2,6 +2,20 @@
imagesdir = $(datadir)/images/xsplash
-images_DATA = xsplash-background.png xsplash-throbber.png
+images_DATA = bg_800x600.jpg
+ bg_1024x768.jpg
+ bg_1280x1024.jpg
+ bg_1440x900.jpg
+ bg_1680x1050.jpg
+ bg_1920x1200.jpg
+ bg_2560x1600.jpg
+ logo_small.png
+ logo_medium.png
+ logo_large.png
+ logo_xtra_large.png
+ throbber_small.png
+ throbber_medium.png
+ throbber_large.png
+ throbber_xtra-large.png
EXTRA_DIST = $(images_DATA)
=== added file 'images/bg_1024x768.jpg'
Binary files images/bg_1024x768.jpg 1970-01-01 00:00:00 +0000 and images/bg_1024x768.jpg 2009-08-31 18:47:10 +0000 differ
=== added file 'images/bg_1280x1024.jpg'
Binary files images/bg_1280x1024.jpg 1970-01-01 00:00:00 +0000 and images/bg_1280x1024.jpg 2009-08-31 18:47:10 +0000 differ
=== added file 'images/bg_1440x900.jpg'
Binary files images/bg_1440x900.jpg 1970-01-01 00:00:00 +0000 and images/bg_1440x900.jpg 2009-08-31 18:47:10 +0000 differ
=== added file 'images/bg_1680x1050.jpg'
Binary files images/bg_1680x1050.jpg 1970-01-01 00:00:00 +0000 and images/bg_1680x1050.jpg 2009-08-31 18:47:10 +0000 differ
=== added file 'images/bg_1920x1200.jpg'
Binary files images/bg_1920x1200.jpg 1970-01-01 00:00:00 +0000 and images/bg_1920x1200.jpg 2009-08-31 18:47:10 +0000 differ
=== added file 'images/bg_2560x1600.jpg'
Binary files images/bg_2560x1600.jpg 1970-01-01 00:00:00 +0000 and images/bg_2560x1600.jpg 2009-08-31 18:47:10 +0000 differ
=== added file 'images/bg_800x600.jpg'
Binary files images/bg_800x600.jpg 1970-01-01 00:00:00 +0000 and images/bg_800x600.jpg 2009-08-31 18:47:10 +0000 differ
=== added file 'images/logo_large.png'
Binary files images/logo_large.png 1970-01-01 00:00:00 +0000 and images/logo_large.png 2009-08-31 18:47:10 +0000 differ
=== added file 'images/logo_medium.png'
Binary files images/logo_medium.png 1970-01-01 00:00:00 +0000 and images/logo_medium.png 2009-08-31 18:47:10 +0000 differ
=== added file 'images/logo_small.png'
Binary files images/logo_small.png 1970-01-01 00:00:00 +0000 and images/logo_small.png 2009-08-31 18:47:10 +0000 differ
=== added file 'images/logo_xtra_large.png'
Binary files images/logo_xtra_large.png 1970-01-01 00:00:00 +0000 and images/logo_xtra_large.png 2009-08-31 18:47:10 +0000 differ
=== added file 'images/throbber_large.png'
Binary files images/throbber_large.png 1970-01-01 00:00:00 +0000 and images/throbber_large.png 2009-08-31 18:47:10 +0000 differ
=== added file 'images/throbber_medium.png'
Binary files images/throbber_medium.png 1970-01-01 00:00:00 +0000 and images/throbber_medium.png 2009-08-31 18:47:10 +0000 differ
=== added file 'images/throbber_small.png'
Binary files images/throbber_small.png 1970-01-01 00:00:00 +0000 and images/throbber_small.png 2009-08-31 18:47:10 +0000 differ
=== added file 'images/throbber_xtra-large.png'
Binary files images/throbber_xtra-large.png 1970-01-01 00:00:00 +0000 and images/throbber_xtra-large.png 2009-08-31 18:47:10 +0000 differ
=== removed file 'images/xsplash-background.png'
Binary files images/xsplash-background.png 2009-08-06 14:42:39 +0000 and images/xsplash-background.png 1970-01-01 00:00:00 +0000 differ
=== removed file 'images/xsplash-throbber.png'
Binary files images/xsplash-throbber.png 2009-08-19 00:44:34 +0000 and images/xsplash-throbber.png 1970-01-01 00:00:00 +0000 differ
=== modified file 'src/xsplash.c'
--- src/xsplash.c 2009-08-26 15:29:53 +0000
+++ src/xsplash.c 2009-08-31 18:47:10 +0000
@@ -267,16 +267,120 @@
return gdk_pixbuf_scale_simple (src, new_width, new_height, GDK_INTERP_BILINEAR);
}
+static gchar *
+get_background_filename (gint width, gint height)
+{
+ gint widths[] = { 2560, 1920, 1680, 1440, 1280, 1024, 800 };
+ gint heights[] = { 1600, 1200, 1050, 900, 1024, 768, 600 };
+ gint i;
+ gint last_good = 0;
+ gchar *ret;
+
+ /* A custom background image was supplied on the command-line */
+ if (background_image != NULL)
+ {
+ g_debug ("get_background_filename(): user provided background on the command line; using that");
+
+ return g_strdup (background_image);
+ }
+
+ g_debug ("get_background_filename(): looking for appropriate resolution...");
+ for (i = 0; i < (sizeof (widths) / sizeof (gint)); i++)
+ {
+ if (widths[i] > width && heights[i] && height)
+ {
+ g_debug (" ** %dx%d will work.", widths[i], heights[i]);
+ last_good = i;
+ }
+ else
+ {
+ g_debug (" ** %dx%d is too small, using last good size.\n", widths[i], heights[i]);
+ break;
+ }
+ }
+
+ g_debug (" ** Found a resolution: %dx%d", widths[last_good], heights[last_good]);
+
+ ret = g_strdup_printf (DATADIR "/images/xsplash/bg_%dx%d.jpg", widths[last_good], heights[last_good]);
+
+ g_debug (" ** filename: %s\n", ret);
+
+ return ret;
+}
+
+static const gchar *
+get_filename_size_modifier (gint width)
+{
+ if (width < 1280)
+ return "small";
+ else if (width < 1600)
+ return "medium";
+ else if (width < 2560)
+ return "large";
+ else
+ return "xtra_large";
+}
+
+static gchar *
+get_throbber_filename (gint width)
+{
+ gchar *ret;
+
+ if (throbber_image != NULL)
+ {
+ g_debug ("get_throbber_filename(): user provided a throbber on the command line; using that\n");
+
+ return g_strdup (throbber_image);
+ }
+
+ g_debug ("get_throbber_filename(): looking for the best throbber for screen width...");
+
+ ret = g_strdup_printf (DATADIR "/images/xsplash/throbber_%s.png",
+ get_filename_size_modifier (width));
+
+ g_debug (" ** Chose `%s'", get_filename_size_modifier (width));
+ g_debug (" ** throbber filename is: %s\n", ret);
+
+ return ret;
+}
+
+static gchar *
+get_logo_filename (gint width)
+{
+ gchar *ret;
+
+ if (logo_image != NULL)
+ {
+ g_debug ("get_logo_filename(): user provided a logo on the command line; using that\n");
+
+ return g_strdup (logo_image);
+ }
+
+ g_debug ("get_logo_filename(): looking for the best logo for screen width...");
+
+ ret = g_strdup_printf (DATADIR "/images/xsplash/logo_%s.png",
+ get_filename_size_modifier (width));
+
+ g_debug (" ** Chose `%s'", get_filename_size_modifier (width));
+ g_debug (" ** logo filename is: %s\n", ret);
+
+ return ret;
+}
+
static GdkPixbuf *
get_pixbuf (gint width, gint height)
{
GdkPixbuf *pixbuf;
GdkPixbuf *scaled;
+ gchar *background_filename;
gint x, y, w, h;
- pixbuf = gdk_pixbuf_new_from_file (background_image, NULL);
+ background_filename = get_background_filename (width, height);
+
+ pixbuf = gdk_pixbuf_new_from_file (background_filename, NULL);
scaled = scale_to_min (pixbuf,
- width, height);
+ width,
+ height);
w = gdk_pixbuf_get_width (scaled);
h = gdk_pixbuf_get_height (scaled);
@@ -286,6 +390,9 @@
x = ABS(x);
y = ABS(y);
+ if (background_filename)
+ g_free (background_filename);
+
return gdk_pixbuf_new_subpixbuf (scaled,
x,
y,
@@ -325,6 +432,8 @@
GdkPixbuf *logo;
GtkWidget *image;
GtkWidget *fixed;
+ gchar *logo_filename;
+ gchar *throbber_filename;
priv->dbusobject = NULL;
priv->system_bus = NULL;
@@ -373,9 +482,12 @@
G_CALLBACK (key_press_event),
server);
+ logo_filename = get_logo_filename (gdk_screen_get_width (priv->screen));
+ throbber_filename = get_throbber_filename (gdk_screen_get_width (priv->screen));
+
pixbuf = get_pixbuf (gdk_screen_get_width (priv->screen),
gdk_screen_get_height (priv->screen));
- logo = gdk_pixbuf_new_from_file (logo_image, NULL);
+ logo = gdk_pixbuf_new_from_file (logo_filename, NULL);
fixed = gtk_fixed_new ();
@@ -387,9 +499,12 @@
gdk_pixbuf_get_width (pixbuf) / 2 - gdk_pixbuf_get_width (logo) / 2,
gdk_pixbuf_get_height (pixbuf) / 3 - gdk_pixbuf_get_height (logo) / 2);
- if (throbber_image && throbber_frames)
+ g_print ("throbber_filename: %s\n", throbber_filename);
+ g_print ("throbber_frames: %d\n", throbber_frames);
+
+ if (throbber_filename && throbber_frames)
{
- priv->throbber_pixbuf = gdk_pixbuf_new_from_file (throbber_image, NULL);
+ priv->throbber_pixbuf = gdk_pixbuf_new_from_file (throbber_filename, NULL);
if (priv->throbber_pixbuf != NULL)
{
@@ -673,15 +788,6 @@
signal (SIGINT, sig_handler);
signal (SIGTERM, sig_handler);
- if (background_image == NULL)
- background_image = g_strdup ("/usr/share/backgrounds/warty-final-ubuntu.png");
-
- if (logo_image == NULL)
- logo_image = g_strdup ("/usr/share/images/C/ubuntuheader.png");
-
- if (throbber_image == NULL)
- throbber_image = g_strdup (DATADIR "/images/xsplash/xsplash-throbber.png");
-
g_debug ("background_image = %s", background_image);
g_debug ("logo_image = %s", logo_image);
g_debug ("throbber_image = %s", throbber_image);
References