patches/gnome-session-02-solaris-branding.diff
author dcarbery
Fri, 24 Nov 2006 16:37:59 +0000
branch217update
changeset 19096 d542fc2c823e
parent 8396 3047112e1ba8
child 8679 3e6a66828a04
permissions -rw-r--r--
Merged trunk changes r9797:9829 into 217update branch.

diff -urN gnome-session-2.16.1/gnome-session/gnome-session.schemas.in gnome-session-2.16.1-hacked/gnome-session/gnome-session.schemas.in
--- gnome-session-2.16.1/gnome-session/gnome-session.schemas.in	2005-04-26 22:56:50.000000000 +1200
+++ gnome-session-2.16.1-hacked/gnome-session/gnome-session.schemas.in	2006-10-23 09:05:18.497049000 +1300
@@ -50,7 +50,7 @@
          <applyto>/apps/gnome-session/options/splash_image</applyto>
          <owner>gnome</owner>
          <type>string</type>
-         <default>splash/gnome-splash.png</default>
+         <default>splash/sun-splash.png</default>
          <locale name="C">
             <short>Preferred Image to use for login splash screen</short>
             <long>This is a relative path value based off the $datadir/pixmaps/ directory.  Sub-directories and image names are valid values. Changing this value will effect the next session login.</long>
diff -urN gnome-session-2.16.1/gnome-session/splash-widget.c gnome-session-2.16.1-hacked/gnome-session/splash-widget.c
--- gnome-session-2.16.1/gnome-session/splash-widget.c	2006-10-23 09:02:34.942158000 +1300
+++ gnome-session-2.16.1-hacked/gnome-session/splash-widget.c	2006-10-23 09:05:18.498728000 +1300
@@ -24,6 +24,8 @@
 #include <libgnome/gnome-macros.h>
 #include <libgnome/gnome-program.h>
 #include <gconf/gconf-client.h>
+#include <gdk/gdkx.h>
+#include <X11/Xlib.h>
 
 #include "headers.h"
 #include "splash-widget.h"
@@ -112,13 +114,19 @@
 calc_text_box (SplashWidget *sw)
 {
 	PangoRectangle pixel_rect;
+	GdkScreen *scr = gdk_screen_get_default ();
+	int scr_h = gdk_screen_get_height (scr);
+	
 	
 	pango_layout_get_pixel_extents (sw->layout, NULL, &pixel_rect);
 	
 	sw->text_box.x = (sw->image_bounds.x + sw->image_bounds.width / 2 -
 			  pixel_rect.width / 2);
-	sw->text_box.y = (sw->image_bounds.y + sw->image_bounds.height -
-			  pixel_rect.height - SPLASH_LABEL_V_OFFSET);
+	if (scr_h < 768)
+	    sw->text_box.y = (gdk_screen_get_height (scr) * 5714) / 10000;
+	else
+	    sw->text_box.y = (sw->image_bounds.y + sw->image_bounds.height -
+			      pixel_rect.height - SPLASH_LABEL_V_OFFSET);
 	sw->text_box.width = pixel_rect.width + 1;
 	sw->text_box.height = pixel_rect.height + 1;
 }
@@ -130,19 +138,18 @@
 	GList *l;
 	GdkRectangle exposed;
 	SplashWidget *sw = SPLASH_WIDGET (widget);
-
+	GdkScreen *scr = gdk_screen_get_default ();
+	
 	if (!GTK_WIDGET_DRAWABLE (widget))
 		return FALSE;
 
-	if (gdk_rectangle_intersect (
-		&event->area, &sw->image_bounds, &exposed))
-		gdk_draw_drawable  (
-			GDK_DRAWABLE (widget->window),
-			widget->style->black_gc,
-			GDK_DRAWABLE (sw->bg_pixmap),
-			exposed.x, exposed.y,
-			exposed.x, exposed.y,
-			exposed.width, exposed.height);
+	gdk_draw_drawable  (GDK_DRAWABLE (widget->window),
+			    widget->style->black_gc,
+			    GDK_DRAWABLE (sw->bg_pixmap),
+			    0, 0,
+			    0, 0,
+			    gdk_screen_get_width (scr), 
+			    gdk_screen_get_height (scr));
 
 	for (l = sw->icons; l; l = l->next) {
 		SplashIcon *si = l->data;
@@ -190,17 +197,6 @@
 }
 
 static void
-splash_widget_size_allocate (GtkWidget     *widget,
-			     GtkAllocation *allocation)
-{
-	SplashWidget *sw = SPLASH_WIDGET (widget);
-
-	sw->image_bounds = *allocation;
-
-	GNOME_CALL_PARENT (GTK_WIDGET_CLASS, size_allocate, (widget, allocation));
-}
-
-static void
 splash_widget_size_request (GtkWidget      *widget,
 			    GtkRequisition *requisition)
 {
@@ -305,10 +301,138 @@
 	widget_class->unrealize = splash_widget_unrealize;
 	widget_class->expose_event = splash_widget_expose_event;
 	widget_class->size_request = splash_widget_size_request;
-	widget_class->size_allocate = splash_widget_size_allocate;
 	widget_class->button_release_event = splash_widget_button_release_event;
 }
 
+
+static GdkPixbuf *
+composite_bkg_image (SplashWidget *sw, 
+		     GdkPixbuf *splash, 
+		     GdkPixbuf *sun_logo, 
+		     GdkPixbuf *java_logo, 
+		     GdkPixbuf *adobe_logo,
+		     GdkPixbuf *flash_logo)
+{
+  GdkScreen *scr;
+  GdkWindow *root_win;
+  GdkPixbuf *root_pb;
+  GdkPixbuf *splash_scaled = NULL;
+  int w, h, scr_w, scr_h, x_offset, y_offset;
+
+  scr = gdk_screen_get_default ();
+  root_win = gdk_screen_get_root_window (scr);  
+
+  scr_w = gdk_screen_get_width (scr);
+  scr_h = gdk_screen_get_height (scr);
+
+  root_pb = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
+			    TRUE,
+			    gdk_pixbuf_get_bits_per_sample (splash),
+			    scr_w, scr_h);
+
+  gdk_pixbuf_fill (root_pb, 0x35556bff); 
+  /* gdk_pixbuf_fill (root_pb, 0xffffffff); */
+
+  w = gdk_pixbuf_get_width (splash);
+  h = gdk_pixbuf_get_height (splash);
+
+  if (w > scr_w)
+    {
+      splash_scaled = gdk_pixbuf_scale_simple (splash, 
+					       scr_w,
+					       scr_h,
+					       GDK_INTERP_BILINEAR);
+      splash = splash_scaled;
+      x_offset = 0;
+      y_offset = 0;
+      w = scr_w;
+      h = scr_h;
+    }
+  else
+    {
+      x_offset = (scr_w - w) / 2;
+      y_offset = (scr_h - h) / 2;
+    }
+  
+  sw->image_bounds.x = x_offset;
+  sw->image_bounds.y = y_offset;
+  sw->image_bounds.width = w;
+  sw->image_bounds.height = h;
+
+  gdk_pixbuf_copy_area (splash, 0, 0,
+			w, h,
+			root_pb,
+			x_offset,
+			y_offset);
+
+  w = gdk_pixbuf_get_width (sun_logo);
+  h = gdk_pixbuf_get_height (sun_logo);
+
+#define SUN_LOGO_X_OFFSET 20
+#define SUN_LOGO_Y_OFFSET 20
+  
+  gdk_pixbuf_copy_area (sun_logo, 0, 0,
+			w, h,
+			root_pb,
+			SUN_LOGO_X_OFFSET,
+			SUN_LOGO_Y_OFFSET);
+
+#define BOTTOM_LOGO_INITIAL_X_GAP 25
+#define BOTTOM_LOGO_X_GAP 10
+#define BOTTOM_LOGO_Y_GAP 20
+  
+  w = gdk_pixbuf_get_width (java_logo);
+  h = gdk_pixbuf_get_height (java_logo);
+
+  y_offset = scr_h - (h + BOTTOM_LOGO_Y_GAP);
+  
+  gdk_pixbuf_copy_area (java_logo, 0, 0,
+			w, h,
+			root_pb,
+			BOTTOM_LOGO_INITIAL_X_GAP,
+			y_offset);
+
+  x_offset = BOTTOM_LOGO_INITIAL_X_GAP + w + BOTTOM_LOGO_X_GAP;
+
+  w = gdk_pixbuf_get_width (flash_logo);
+  h = gdk_pixbuf_get_height (flash_logo);
+
+  y_offset = scr_h - (h + BOTTOM_LOGO_Y_GAP);
+  
+  gdk_pixbuf_copy_area (flash_logo, 0, 0,
+			w, h,
+			root_pb,
+			x_offset,
+			y_offset);
+
+  x_offset += w + BOTTOM_LOGO_X_GAP;
+
+  /* display the adobe postscript if running on a Xsun xserver */
+  if (adobe_logo) {
+    Display *dpy = gdk_x11_display_get_xdisplay (gdk_screen_get_display (scr));
+    int opcode, event, error;
+      
+    if ((strcmp(ServerVendor(dpy), "Sun Microsystems, Inc.") == 0) && 
+	(XQueryExtension(dpy, "Adobe-DPS-Extension", &opcode, &event, &error) == True))
+      {
+	w = gdk_pixbuf_get_width (adobe_logo);
+	h = gdk_pixbuf_get_height (adobe_logo);
+	
+	y_offset = scr_h - (h + BOTTOM_LOGO_Y_GAP);
+
+	gdk_pixbuf_copy_area (adobe_logo, 0, 0,
+			      w, h,
+			      root_pb,
+			      x_offset, y_offset);
+      }
+  }
+
+  gdk_pixbuf_unref (splash_scaled);
+  
+  return root_pb;
+}
+
+
 static GdkPixbuf *
 load_background_pixbuf (const char *filename)
 {
@@ -346,6 +470,7 @@
 {
 	GConfClient *client;
 	char        *filename;
+	GdkPixbuf *pb, *sun_logo, *adobe_logo, *java_logo, *flash_logo;
 
 	client = gconf_client_get_default ();
 
@@ -355,11 +480,43 @@
 
 	g_object_unref (client);
 
-	sw->background = load_background_pixbuf (filename);
+	pb = load_background_pixbuf (filename);
 	g_free (filename);
+	
+	if (!pb)
+	  pb = load_background_pixbuf ("splash/gnome-splash.png");
+	
+	if (!pb)
+	  pb = load_background_pixbuf ("splash/sun-splash.png");
 
-	if (!sw->background)
-		sw->background = load_background_pixbuf ("splash/gnome-splash.png");
+	if (g_file_test (GNOME_ICONDIR "/splash/sun-logo.png", G_FILE_TEST_EXISTS))
+	  {    
+	    filename = g_strdup (GNOME_ICONDIR "/splash/sun-logo.png");
+
+	    sun_logo = gdk_pixbuf_new_from_file (filename, NULL);
+	    g_free (filename);
+
+	    filename = g_strdup (GNOME_ICONDIR "/splash/java-logo.png");
+	    java_logo = gdk_pixbuf_new_from_file (filename, NULL);
+	    g_free (filename);
+
+	    filename = g_strdup (GNOME_ICONDIR "/splash/adobe-sun.png");
+	    adobe_logo = gdk_pixbuf_new_from_file (filename, NULL);
+	    g_free (filename);
+
+	    filename = g_strdup (GNOME_ICONDIR "/splash/flash.png");
+	    flash_logo = gdk_pixbuf_new_from_file (filename, NULL);
+	    g_free (filename);
+
+	    sw->background = composite_bkg_image (sw, pb, sun_logo, java_logo, adobe_logo, flash_logo);
+
+	    g_object_unref (pb);
+	    g_object_unref (sun_logo);
+	    if (adobe_logo)
+	      g_object_unref (adobe_logo); if (flash_logo) g_object_unref (flash_logo);
+	  }
+	else
+	  sw->background = pb;
 }
 
 static void
@@ -521,13 +678,13 @@
 	basename = g_path_get_basename (executable_name);
 	app = get_splash_app (basename);
 
-	if (app)
+/*	if (app)
 		pb = get_splash_icon (sw, app->icon);
 
 	if (!pb)
 		pb = get_splash_icon (sw, basename);
 
-	if (pb) {
+	if (pb)*/ {
 		SplashIcon   *si;
 		GdkRectangle  area;
 		char         *text;
@@ -552,7 +709,8 @@
 			sw->text_box.x, sw->text_box.y,
 			sw->text_box.width, sw->text_box.height);
 
-		si = g_new0 (SplashIcon, 1);
+		/* Disable the icons as the current design doesn't require it 
+		 *  si = g_new0 (SplashIcon, 1);
 		si->unscaled = pb;
 
 		sw->icons = g_list_append (sw->icons, si);
@@ -562,7 +720,7 @@
 		gtk_widget_queue_draw_area (
 			GTK_WIDGET (sw),
 			area.x, area.y,
-			area.width, area.height);
+			area.width, area.height);*/
 	}
 
 	g_free (basename);
diff -urN gnome-session-2.16.1/gnome-session/splash-widget.h gnome-session-2.16.1-hacked/gnome-session/splash-widget.h
--- gnome-session-2.16.1/gnome-session/splash-widget.h	2005-07-29 12:24:44.000000000 +1200
+++ gnome-session-2.16.1-hacked/gnome-session/splash-widget.h	2006-10-23 09:05:18.499384000 +1300
@@ -66,13 +66,13 @@
 #define SPLASH_BASE_HEIGHT 220
 
 /* offset from bottom of label & font */
-#define SPLASH_LABEL_V_OFFSET 3
-#define SPLASH_LABEL_FONT_SIZE 8
+#define SPLASH_LABEL_V_OFFSET 310
+#define SPLASH_LABEL_FONT_SIZE 10
 
 /* icon border, spacing, offset from bottom and initial size */
-#define SPLASH_ICON_BORDER  8
+#define SPLASH_ICON_BORDER  195
 #define SPLASH_ICON_SPACING 4
-#define SPLASH_ICON_V_OFFSET 14
+#define SPLASH_ICON_V_OFFSET 235
 #define SPLASH_BASE_ICON_SIZE 36
 #define SPLASH_BASE_ICON_ROWS 1