]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
[script] Update default script to use the window X and Y offsets every time
authorCharlie Brej <cbrej@cs.man.ac.uk>
Mon, 22 Mar 2010 23:39:32 +0000 (23:39 +0000)
committerCharlie Brej <cbrej@cs.man.ac.uk>
Mon, 22 Mar 2010 23:39:32 +0000 (23:39 +0000)
Previously the code was assuming the windows were placed at 0,0. This might not
be the case and the window X and Y values should be used when trying to
position items relative to a window.

This change needs to be applied to all other scripts otherwise mutiple screen
setups may have unaligned elements. Updates scripts should be tested using
multi-head test systems or the x11 test renderer.

themes/script/script.script

index 80302b73765bd8039763dc7373537ed016f30d28..ed54a010176a9f373929fa6d6ed1fb28f8e8dbbc 100644 (file)
@@ -16,8 +16,8 @@ fun refresh_callback ()
         opacity = (Math.Cos(logo.opacity_angle) + 1) / 2;
         opacity *= 1 - min_opacity;
         opacity += min_opacity;
-        logo.sprite.SetX (Window.GetWidth()  / 2 - logo.image.GetWidth()  / 2);
-        logo.sprite.SetY (Window.GetHeight() / 2 - logo.image.GetHeight() / 2);
+        logo.sprite.SetX (Window.GetX() + Window.GetWidth()  / 2 - logo.image.GetWidth()  / 2);
+        logo.sprite.SetY (Window.GetY() + Window.GetHeight() / 2 - logo.image.GetHeight() / 2);
         logo.sprite.SetOpacity (opacity);
       }
     else
@@ -45,8 +45,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);
     
@@ -119,15 +119,15 @@ Plymouth.SetDisplayPasswordFunction(display_password_callback);
 progress_box.image = Image("progress_box.png");
 progress_box.sprite = Sprite(progress_box.image);
 
-progress_box.x = Window.GetWidth()  / 2 -    progress_box.image.GetWidth()  / 2;
-progress_box.y = Window.GetHeight() * 0.75 - progress_box.image.GetHeight() / 2;
+progress_box.x = Window.GetX() + Window.GetWidth() / 2 - progress_box.image.GetWidth() / 2;
+progress_box.y = Window.GetY() + Window.GetHeight() * 0.75 - progress_box.image.GetHeight() / 2;
 progress_box.sprite.SetPosition(progress_box.x, progress_box.y, 0);
 
 progress_bar.original_image = Image("progress_bar.png");
 progress_bar.sprite = Sprite();
 
-progress_bar.x = Window.GetWidth()  / 2 -        progress_bar.original_image.GetWidth() / 2;
-progress_bar.y = Window.GetHeight() / 2 * 1.5  - progress_box.image.GetHeight() / 2 + (progress_box.image.GetHeight() - progress_bar.original_image.GetHeight()) / 2;
+progress_bar.x = Window.GetX() + Window.GetWidth()  / 2 -        progress_bar.original_image.GetWidth() / 2;
+progress_bar.y = Window.GetY() + Window.GetHeight() / 2 * 1.5  - progress_box.image.GetHeight() / 2 + (progress_box.image.GetHeight() - progress_bar.original_image.GetHeight()) / 2;
 progress_bar.sprite.SetPosition(progress_bar.x, progress_bar.y, 1);
 
 fun progress_callback (duration, progress)