diff options
author | Charlie Brej <cbrej@cs.man.ac.uk> | 2010-03-22 23:39:32 +0000 |
---|---|---|
committer | Charlie Brej <cbrej@cs.man.ac.uk> | 2010-03-22 23:39:32 +0000 |
commit | d28ff94b690d9dd231def8723a63910f52bd4ebb (patch) | |
tree | b0c666201dc297ccf0a26587f1978837a6b567e3 /themes | |
parent | 0bbc2437228abb36298606eda4b6bb7d87b2b96e (diff) |
[script] Update default script to use the window X and Y offsets every time
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.
Diffstat (limited to 'themes')
-rw-r--r-- | themes/script/script.script | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/themes/script/script.script b/themes/script/script.script index 80302b73..ed54a010 100644 --- a/themes/script/script.script +++ b/themes/script/script.script @@ -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) |