From 74a74928bd0552d5e45d1e48cdcf3098930b3d52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 12 Mar 2014 04:38:33 +0100 Subject: [PATCH] plymouth: display password prompt text --- qubes-logos/plymouth/qubes/qubes.script | 30 ++++++++++++++++++++----- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/qubes-logos/plymouth/qubes/qubes.script b/qubes-logos/plymouth/qubes/qubes.script index f36742d..5a79dc2 100644 --- a/qubes-logos/plymouth/qubes/qubes.script +++ b/qubes-logos/plymouth/qubes/qubes.script @@ -34,13 +34,16 @@ Plymouth.SetRefreshFunction (refresh_callback); status = "normal"; -fun dialog_setup() +fun dialog_setup(text) { local.box; + local.prompt; local.lock; local.entry; box.image = Image("box.png"); + prompt.text = text; + prompt.image = Image.Text(text, 1, 1, 1); lock.image = Image("lock.png"); entry.image = Image("entry.png"); @@ -50,19 +53,27 @@ fun dialog_setup() box.z = 10000; box.sprite.SetPosition(box.x, box.y, box.z); + prompt.sprite = Sprite(prompt.image); + prompt.x = box.x + box.image.GetWidth()/2 - prompt.image.GetWidth() / 2; + prompt.y = box.y + box.image.GetHeight()/2 - (prompt.image.GetHeight() + entry.image.GetHeight())/2; + prompt.z = box.z + 1; + prompt.sprite.SetPosition(prompt.x, prompt.y, prompt.z); + prompt.sprite.text = text; + lock.sprite = Sprite(lock.image); lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2; - lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2; + lock.y = prompt.y + prompt.image.GetHeight() + (entry.image.GetHeight() - lock.image.GetHeight())/2; lock.z = box.z + 1; lock.sprite.SetPosition(lock.x, lock.y, lock.z); entry.sprite = Sprite(entry.image); entry.x = lock.x + lock.image.GetWidth(); - entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2; + entry.y = prompt.y + prompt.image.GetHeight(); entry.z = box.z + 1; entry.sprite.SetPosition(entry.x, entry.y, entry.z); global.dialog.box = box; + global.dialog.prompt = prompt; global.dialog.lock = lock; global.dialog.entry = entry; global.dialog.bullet_image = Image("bullet.png"); @@ -72,6 +83,7 @@ fun dialog_setup() fun dialog_opacity(opacity) { dialog.box.sprite.SetOpacity (opacity); + dialog.prompt.sprite.SetOpacity (opacity); dialog.lock.sprite.SetOpacity (opacity); dialog.entry.sprite.SetOpacity (opacity); for (index = 0; dialog.bullet[index]; index++) @@ -91,9 +103,15 @@ fun display_password_callback (prompt, bullets) { global.status = "password"; if (!global.dialog) - dialog_setup(); - else - dialog_opacity(1); + dialog_setup(prompt); + else { + if (global.dialog.prompt.text != prompt) { + dialog_opacity(0); + global.dialog = NULL; + dialog_setup(prompt); + } else + dialog_opacity(1); + } for (index = 0; dialog.bullet[index] || index < bullets; index++) { if (!dialog.bullet[index])