Send plymouth mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.freedesktop.org/mailman/listinfo/plymouth
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of plymouth digest..."


Today's Topics:

   1. [PATCH] [main] allow clients to watch for <enter> as a
      keystroke (Steve Langasek)
   2. Re: [PATCH] [main] allow clients to watch for <enter> as a
      keystroke (Charlie Brej)


----------------------------------------------------------------------

Message: 1
Date: Sun, 28 Mar 2010 20:56:41 -0700
From: Steve Langasek <[email protected]>
Subject: [PATCH] [main] allow clients to watch for <enter> as a
        keystroke
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"

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/
[email protected]                                     [email protected]
-------------- 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-0001.pgp>

------------------------------

Message: 2
Date: Mon, 29 Mar 2010 12:06:10 +0100
From: Charlie Brej <[email protected]>
Subject: Re: [PATCH] [main] allow clients to watch for <enter> as a
        keystroke
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 29/03/10 04:56, Steve Langasek wrote:
> "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.

Thanks, tested with /n in the keys and general anykey. Committed:
http://cgit.freedesktop.org/plymouth/commit/?id=02ca382344d46fd8f8654588ddcb8e3d25c68e7a

The bigger question is are Backspace and Esc anykeys too. (I would say 
Esc is not Backspace is maybe)

> (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.)

A random popup dialogue is an issue with all GUIs and I don't know of 
any solutions so I think that's fine.


------------------------------

_______________________________________________
plymouth mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/plymouth


End of plymouth Digest, Vol 17, Issue 20
****************************************

Reply via email to