Menu

#131 Request: Make it harder to close yad dialog by disabling ESC key

Started
nobody
None
Medium
Enhancement
2012-05-31
2012-05-31
Anonymous
No

Originally created by: mbst...@googlemail.com

What steps will reproduce the problem?
1. Use yad as a message box (like xmessage).
2. Try to disallow user interaction, notably closing the window easily.
3. Fail, because pressing ESC (the escape key) will close any dialog.

What is the expected output? What do you see instead?
Have an option to disable closing the dialog with ESC.

What version of the product are you using? On what operating system?
0.17.1.1
on Linux (SLES10 with many much newer libraries:
GTK+ 2.20.1
Glib 2.24.2
Pango 1.28.1
Cairo 1.10.0
X11 [r7].5
)

Please provide any additional information below.

I know the original xmessage doesn't provide this, so I may be going a little bit far.

I sometime have the need for message boxes (which a dialog is also sort of) which remain up on the screen to strongly inform the user. The "--on-top" and "--sticky" options are e.g. quite practical for that.

Because this is sometimes a shared account (a shared VNC of a faceless account, however evil that may be), I also want to make it hard for the user to "accidentally" close the message. The buttons disappear with "--no-buttons", the window manager controls disappear with "--undecorated" (though a WM hint alone would've been okay, but that's overkill).

Yet when the user presses ESC, the Escape key, the dialog just closes. This isn't specific yad behavior though, it seems to be a GtkDialog property.

I am attaching a patch which adds a new command line option "--no-escape", which modifies the GtkDialog to "stop the emission" of (i.e. ignore) the "close" signal. It works fine for me.

Note that, before I knew yad, I used gxmessage as a modern xmessage replacement. I myself committed the patches to gxmessage which make it sticky, make it stay on top, and which disable the Escape key. You see, I really need these features. :-) And two out of three are already in yad, hurray!

Please do consider my patch for inclusion.

I'm sure there are other practical uses of modifying the ESC key behavior or window behavior (such as the WM's close button). Like binding ESC or the window close button to the identical same return value as "Cancel"/"No". But this would make a much more complicated patch.

1 Attachments

Related

Commit: [r7]

Discussion

  • Anonymous

    Anonymous - 2012-05-31

    Originally posted by: ananasik

    thank you, i'll examine your patch. as a quick workaround you may use custom gtkrc file. for example

    #! /bin/bash
    cat <<EOF > /tmp/gtkrc.yad
    binding "noesc"
    {
            unbind "Escape"
    }
    class "GtkDialog" binding "noesc"
    EOF
    GTK2_RC_FILES="/tmp/gtkrc.yad:$GTK2_RC_FILES" yad --text "Escape doesn't work"
    rm -f /tmp/gtkrc.yad

    Status: Started

     
  • Anonymous

    Anonymous - 2012-05-31

    Originally posted by: ananasik

    (No comment was entered for this change.)

    Labels: -Type-Defect Type-Enhancement

     

Log in to post a comment.