[PATCH] [main] allow clients to watch for <enter> as a keystroke
Steve Langasek
steve.langasek at canonical.com
Sun Mar 28 20:56:41 PDT 2010
Hi folks,
Please find below a patch that lets clients listen for the enter key with
watch-keystroke. "Press <Enter> to continue" seems like a not uncommon use
case (we've run into it in the Ubuntu installer), and a natural default
for "Press any key" is the enter key, so it would be good to permit it here.
(The downside is that there's a possible race between a user pressing enter
and a prompt showing up via ask-for-password and ask-question. IMHO this is
a tolerable risk; YMMV.)
---
src/main.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/src/main.c b/src/main.c
index e560462..d3d670d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1182,6 +1182,22 @@ on_enter (state_t *state,
free (entry_trigger);
update_display (state);
}
+ else
+ {
+ for (node = ply_list_get_first_node (state->keystroke_triggers); node;
+ node = ply_list_get_next_node (state->keystroke_triggers, node))
+ {
+ ply_keystroke_watch_t* keystroke_trigger = ply_list_node_get_data (node);
+ if (!keystroke_trigger->keys || strstr(keystroke_trigger->keys, "\n")) /* assume strstr works on utf8 arrays */
+ {
+ ply_trigger_pull (keystroke_trigger->trigger, line);
+ ply_list_remove_node (state->keystroke_triggers, node);
+ free(keystroke_trigger);
+ return;
+ }
+ }
+ return;
+ }
}
static void
--
1.6.5
Cheers,
--
Steve Langasek Give me a lever long enough and a Free OS
Debian Developer to set it on, and I can move the world.
Ubuntu Developer http://www.debian.org/
slangasek at ubuntu.com vorlon at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 828 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/plymouth/attachments/20100328/af3b6208/attachment.pgp>
More information about the plymouth
mailing list