[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#613249: desktop-base: plymouth theme spacefun with bad sprites positions in twin mode



Package: desktop-base
Version: 6.0.5
Severity: minor
Tags: patch

The spacefun script for plymouth is missing the Window.GetX() and
Window.GetY() adjustements for each sprite.  If mutliple monitors are in
use, then all sprites are shifted left the value of Window.GetX() and
top the value of GetY().

Please find attached a patched version of the spacefun.script using the
Window.GetX() and Window.GetY() methods to center the output when
mutliptle monitors are in use.

The patch also disables the downscaling of the background image.  If
downscaling is allowed, then the bigger screen resolutions won't be
filled up completely.  All output on these resolutions will have a
black border.  If this behaviour is not accaptable then please remove
the following changes in the patch.

	--- desktop-base-6.0.5/plymouth/spacefun/spacefun.script	2010-12-12
23:32:05.000000000 +0100
	+++ desktop-base-6.0.5_twinmode/plymouth/spacefun/spacefun.script
2011-02-13 17:27:37.118332543 +0100
	@@ -34,13 +34,15 @@ if (screen_ratio > bg_image_ratio)
	     bg_scale_factor = Window.GetWidth() / bg_image.GetWidth();
	 else
	     bg_scale_factor = Window.GetHeight() / bg_image.GetHeight();
	+if (bg_scale_factor < 1)
	+    bg_scale_factor = 1;
	 scaled_bg_image = bg_image.Scale(bg_image.GetWidth() * bg_scale_factor,
	                                  bg_image.GetHeight() * bg_scale_factor);

A better fix would be to implement the function Window.GetMaxWidth() and
Window.GetMaxHeight() in plymouth and use these for scaling.



-- System Information:
Debian Release: 6.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-5-686 (SMP w/1 CPU core)
Locale: LANG=de_DE.utf8, LC_CTYPE=de_DE.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages desktop-base depends on:
ii  librsvg2-common               2.26.3-1   SAX-based renderer library
for SVG

desktop-base recommends no packages.

Versions of packages desktop-base suggests:
ii  gnome                         1:2.30+7   The GNOME Desktop
Environment, wit

-- no debconf information

*** /home/adris/todo/desktop-base-6.0.5_twinmode.patch
diff -rupN desktop-base-6.0.5/plymouth/spacefun/spacefun.script
desktop-base-6.0.5_twinmode/plymouth/spacefun/spacefun.script
--- desktop-base-6.0.5/plymouth/spacefun/spacefun.script	2010-12-12
23:32:05.000000000 +0100
+++ desktop-base-6.0.5_twinmode/plymouth/spacefun/spacefun.script
2011-02-13 17:27:37.118332543 +0100
@@ -34,13 +34,15 @@ if (screen_ratio > bg_image_ratio)
     bg_scale_factor = Window.GetWidth() / bg_image.GetWidth();
 else
     bg_scale_factor = Window.GetHeight() / bg_image.GetHeight();
+if (bg_scale_factor < 1)
+    bg_scale_factor = 1;
 scaled_bg_image = bg_image.Scale(bg_image.GetWidth() * bg_scale_factor,
                                  bg_image.GetHeight() * bg_scale_factor);

 # Display background
 bg_sprite = Sprite(scaled_bg_image);
-bg_sprite.SetPosition(Window.GetWidth() / 2 -
scaled_bg_image.GetWidth() / 2,
-                      Window.GetHeight() / 2 -
scaled_bg_image.GetHeight() / 2,
+bg_sprite.SetPosition(Window.GetX() + Window.GetWidth() / 2 -
scaled_bg_image.GetWidth() / 2,
+                      Window.GetY() + Window.GetHeight() / 2 -
scaled_bg_image.GetHeight() / 2,
                       -10000);

 #------------------------------- Earth
---------------------------------------------
@@ -56,8 +58,8 @@ for (i = 0; i < 5; i++)
 earth_glow_index = 0;
 earth_sprite = Sprite(earth_images[earth_glow_index]);
 earth_to_edge = Math.Min(Window.GetWidth(), Window.GetHeight()) * 0.07;
-earth_x = earth_to_edge;
-earth_y = Window.GetHeight() - earth_to_edge - earth_images[0].GetHeight();
+earth_x = Window.GetX() + earth_to_edge;
+earth_y = Window.GetY() + Window.GetHeight() - earth_to_edge -
earth_images[0].GetHeight();
 earth_sprite.SetPosition(earth_x, earth_y, -10);

 #------------------------------- Planet
--------------------------------------------
@@ -69,8 +71,8 @@ planet_image = planet_image.Scale(planet
 planet_sprite = Sprite(planet_image);
 planet_to_edge_y = Window.GetHeight() * 0.14;
 planet_to_edge_x = Window.GetWidth() * 0.08;
-planet_x = Window.GetWidth() - planet_to_edge_x - planet_image.GetWidth();
-planet_y = planet_to_edge_y;
+planet_x = Window.GetX() + Window.GetWidth() - planet_to_edge_x -
planet_image.GetWidth();
+planet_y = Window.GetY() + planet_to_edge_y;
 planet_sprite.SetPosition(planet_x, planet_y, -10);

 #------------------------------- Logo
----------------------------------------------
@@ -81,8 +83,8 @@ logo_image = logo_image.Scale(logo_image
                               logo_image.GetHeight() * logo_scale_factor);
 logo_sprite = Sprite(logo_image);
 logo_to_edge = Window.GetHeight() * 0.1;
-logo_sprite.SetPosition(Window.GetWidth() - logo_to_edge -
logo_image.GetWidth(),
-                        Window.GetHeight() - logo_to_edge -
logo_image.GetHeight(),
+logo_sprite.SetPosition(Window.GetX() + Window.GetWidth() -
logo_to_edge - logo_image.GetWidth(),
+                        Window.GetY() + Window.GetHeight() -
logo_to_edge - logo_image.GetHeight(),
                         -10);

 #------------------------------- Swirl galaxies
------------------------------------
@@ -125,13 +127,13 @@ for (i = 0; i < 3; i++)
     swirl_image = swirl_image.Rotate(swirls[i].angle);
     swirl_sprites[i] = Sprite();
     if (swirls[i].x >= 0)
-      swirl_sprites[i].SetX(Window.GetWidth() * swirls[i].x);
+      swirl_sprites[i].SetX(Window.GetX() + Window.GetWidth() *
swirls[i].x);
     else
-      swirl_sprites[i].SetX(Window.GetWidth() * (1 + swirls[i].x) -
swirl_image.GetWidth());
+      swirl_sprites[i].SetX(Window.GetX() + Window.GetWidth() * (1 +
swirls[i].x) - swirl_image.GetWidth());
     if (swirls[i].y >= 0)
-      swirl_sprites[i].SetY(Window.GetHeight() * swirls[i].y);
+      swirl_sprites[i].SetY(Window.GetY() + Window.GetHeight() *
swirls[i].y);
     else
-      swirl_sprites[i].SetY(Window.GetHeight() * (1 + swirls[i].y) -
swirl_image.GetHeight());
+      swirl_sprites[i].SetY(Window.GetY() + Window.GetHeight() * (1 +
swirls[i].y) - swirl_image.GetHeight());
     swirl_sprites[i].SetImage(swirl_image);
   }

@@ -192,9 +194,9 @@ for (i = 0; i < NUM_STARS; i++)

     # Randomize position, we accept that stars may be half out of the
viewport
     # in each direction
-    star_x = Math.Random() * (Window.GetWidth() +
transformed_image.GetWidth())
+    star_x = Window.GetX() + Math.Random() * (Window.GetWidth() +
transformed_image.GetWidth())
              - transformed_image.GetWidth() / 2;
-    star_y = Math.Random() * (Window.GetHeight() +
transformed_image.GetHeight())
+    star_y = Window.GetY() + Math.Random() * (Window.GetHeight() +
transformed_image.GetHeight())
              - transformed_image.GetHeight() / 2;
     stars[i].SetPosition(star_x, star_y, -20); # Stars go behind other
elements.
   }
@@ -214,8 +216,8 @@ rocket_sprite = Sprite();

 # Rocket trajectory
 # Take a point somwhere in the middle to compute the parabola
-middle_x = Window.GetWidth() * 0.42;
-middle_y = Window.GetHeight() * 0.42;
+middle_x = Window.GetX() + Window.GetWidth() * 0.42;
+middle_y = Window.GetY() + Window.GetHeight() * 0.42;
 # Parabole coeffs so that y = a.x^2 + b.x + c for the earth, planet and
middle points
 # Use the earth and planet centers instead of top left corner
 earth_cx = earth_x + earth_images[0].GetWidth()/2;
@@ -314,8 +316,8 @@ fun dialog_setup()
     entry.image = Image("entry.png");

     box.sprite = Sprite(box.image);
-    box.x = Window.GetWidth()  / 2 - box.image.GetWidth ()/2;
-    box.y = Window.GetHeight() / 2 - box.image.GetHeight()/2;
+    box.x = Window.GetX() + Window.GetWidth()  / 2 - box.image.GetWidth
()/2;
+    box.y = Window.GetY() + Window.GetHeight() / 2 -
box.image.GetHeight()/2;
     box.z = 10000;
     box.sprite.SetPosition(box.x, box.y, box.z);

@@ -456,7 +458,7 @@ fun message_callback (text)
       }
     next_msg_image = Image.Text(text, 1, 1, 1, 1);
     msg_sprites[next_msg_idx] = Sprite();
-    msg_sprites[next_msg_idx].SetPosition(10, next_msg_y, 10000);
+    msg_sprites[next_msg_idx].SetPosition(Window.GetX() + 10,
Window.GetY() + next_msg_y, 10000);
     msg_sprites[next_msg_idx].SetImage(next_msg_image);

     next_msg_idx = (next_msg_idx + 1) % MAX_MSG_DISPLAYED;
diff -rupN desktop-base-6.0.5/plymouth/spacefun/spacefun.script desktop-base-6.0.5_twinmode/plymouth/spacefun/spacefun.script
--- desktop-base-6.0.5/plymouth/spacefun/spacefun.script	2010-12-12 23:32:05.000000000 +0100
+++ desktop-base-6.0.5_twinmode/plymouth/spacefun/spacefun.script	2011-02-13 17:27:37.118332543 +0100
@@ -34,13 +34,15 @@ if (screen_ratio > bg_image_ratio)
     bg_scale_factor = Window.GetWidth() / bg_image.GetWidth();
 else
     bg_scale_factor = Window.GetHeight() / bg_image.GetHeight();
+if (bg_scale_factor < 1)
+    bg_scale_factor = 1;
 scaled_bg_image = bg_image.Scale(bg_image.GetWidth() * bg_scale_factor,
                                  bg_image.GetHeight() * bg_scale_factor);
 
 # Display background
 bg_sprite = Sprite(scaled_bg_image);
-bg_sprite.SetPosition(Window.GetWidth() / 2 - scaled_bg_image.GetWidth() / 2,
-                      Window.GetHeight() / 2 - scaled_bg_image.GetHeight() / 2,
+bg_sprite.SetPosition(Window.GetX() + Window.GetWidth() / 2 - scaled_bg_image.GetWidth() / 2,
+                      Window.GetY() + Window.GetHeight() / 2 - scaled_bg_image.GetHeight() / 2,
                       -10000);
 
 #------------------------------- Earth ---------------------------------------------
@@ -56,8 +58,8 @@ for (i = 0; i < 5; i++)
 earth_glow_index = 0;
 earth_sprite = Sprite(earth_images[earth_glow_index]);
 earth_to_edge = Math.Min(Window.GetWidth(), Window.GetHeight()) * 0.07;
-earth_x = earth_to_edge;
-earth_y = Window.GetHeight() - earth_to_edge - earth_images[0].GetHeight();
+earth_x = Window.GetX() + earth_to_edge;
+earth_y = Window.GetY() + Window.GetHeight() - earth_to_edge - earth_images[0].GetHeight();
 earth_sprite.SetPosition(earth_x, earth_y, -10);
 
 #------------------------------- Planet --------------------------------------------
@@ -69,8 +71,8 @@ planet_image = planet_image.Scale(planet
 planet_sprite = Sprite(planet_image);
 planet_to_edge_y = Window.GetHeight() * 0.14;
 planet_to_edge_x = Window.GetWidth() * 0.08;
-planet_x = Window.GetWidth() - planet_to_edge_x - planet_image.GetWidth();
-planet_y = planet_to_edge_y;
+planet_x = Window.GetX() + Window.GetWidth() - planet_to_edge_x - planet_image.GetWidth();
+planet_y = Window.GetY() + planet_to_edge_y;
 planet_sprite.SetPosition(planet_x, planet_y, -10);
 
 #------------------------------- Logo ----------------------------------------------
@@ -81,8 +83,8 @@ logo_image = logo_image.Scale(logo_image
                               logo_image.GetHeight() * logo_scale_factor);
 logo_sprite = Sprite(logo_image);
 logo_to_edge = Window.GetHeight() * 0.1;
-logo_sprite.SetPosition(Window.GetWidth() - logo_to_edge - logo_image.GetWidth(),
-                        Window.GetHeight() - logo_to_edge - logo_image.GetHeight(),
+logo_sprite.SetPosition(Window.GetX() + Window.GetWidth() - logo_to_edge - logo_image.GetWidth(),
+                        Window.GetY() + Window.GetHeight() - logo_to_edge - logo_image.GetHeight(),
                         -10);
 
 #------------------------------- Swirl galaxies ------------------------------------
@@ -125,13 +127,13 @@ for (i = 0; i < 3; i++)
     swirl_image = swirl_image.Rotate(swirls[i].angle);
     swirl_sprites[i] = Sprite();
     if (swirls[i].x >= 0)
-      swirl_sprites[i].SetX(Window.GetWidth() * swirls[i].x);
+      swirl_sprites[i].SetX(Window.GetX() + Window.GetWidth() * swirls[i].x);
     else
-      swirl_sprites[i].SetX(Window.GetWidth() * (1 + swirls[i].x) - swirl_image.GetWidth());
+      swirl_sprites[i].SetX(Window.GetX() + Window.GetWidth() * (1 + swirls[i].x) - swirl_image.GetWidth());
     if (swirls[i].y >= 0)
-      swirl_sprites[i].SetY(Window.GetHeight() * swirls[i].y);
+      swirl_sprites[i].SetY(Window.GetY() + Window.GetHeight() * swirls[i].y);
     else
-      swirl_sprites[i].SetY(Window.GetHeight() * (1 + swirls[i].y) - swirl_image.GetHeight());
+      swirl_sprites[i].SetY(Window.GetY() + Window.GetHeight() * (1 + swirls[i].y) - swirl_image.GetHeight());
     swirl_sprites[i].SetImage(swirl_image);
   }
 
@@ -192,9 +194,9 @@ for (i = 0; i < NUM_STARS; i++)
 
     # Randomize position, we accept that stars may be half out of the viewport
     # in each direction
-    star_x = Math.Random() * (Window.GetWidth() + transformed_image.GetWidth()) 
+    star_x = Window.GetX() + Math.Random() * (Window.GetWidth() + transformed_image.GetWidth()) 
              - transformed_image.GetWidth() / 2;
-    star_y = Math.Random() * (Window.GetHeight() + transformed_image.GetHeight()) 
+    star_y = Window.GetY() + Math.Random() * (Window.GetHeight() + transformed_image.GetHeight()) 
              - transformed_image.GetHeight() / 2;
     stars[i].SetPosition(star_x, star_y, -20); # Stars go behind other elements.
   }
@@ -214,8 +216,8 @@ rocket_sprite = Sprite();
 
 # Rocket trajectory
 # Take a point somwhere in the middle to compute the parabola
-middle_x = Window.GetWidth() * 0.42;
-middle_y = Window.GetHeight() * 0.42;
+middle_x = Window.GetX() + Window.GetWidth() * 0.42;
+middle_y = Window.GetY() + Window.GetHeight() * 0.42;
 # Parabole coeffs so that y = a.x^2 + b.x + c for the earth, planet and middle points
 # Use the earth and planet centers instead of top left corner
 earth_cx = earth_x + earth_images[0].GetWidth()/2;
@@ -314,8 +316,8 @@ fun dialog_setup()
     entry.image = Image("entry.png");
     
     box.sprite = Sprite(box.image);
-    box.x = Window.GetWidth()  / 2 - box.image.GetWidth ()/2;
-    box.y = Window.GetHeight() / 2 - box.image.GetHeight()/2;
+    box.x = Window.GetX() + Window.GetWidth()  / 2 - box.image.GetWidth ()/2;
+    box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2;
     box.z = 10000;
     box.sprite.SetPosition(box.x, box.y, box.z);
     
@@ -456,7 +458,7 @@ fun message_callback (text)
       }
     next_msg_image = Image.Text(text, 1, 1, 1, 1);
     msg_sprites[next_msg_idx] = Sprite();
-    msg_sprites[next_msg_idx].SetPosition(10, next_msg_y, 10000);
+    msg_sprites[next_msg_idx].SetPosition(Window.GetX() + 10, Window.GetY() + next_msg_y, 10000);
     msg_sprites[next_msg_idx].SetImage(next_msg_image);
 
     next_msg_idx = (next_msg_idx + 1) % MAX_MSG_DISPLAYED;

Reply to: