git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Gavrilov <angavrilov@gmail.com>
To: git@vger.kernel.org
Cc: Paul Mackerras <paulus@samba.org>
Subject: [PATCH (GITK) v3 1/6] gitk: Add Return and Escape bindings to dialogs.
Date: Sun,  2 Nov 2008 21:59:44 +0300	[thread overview]
Message-ID: <1225652389-22082-2-git-send-email-angavrilov@gmail.com> (raw)
In-Reply-To: <1225652389-22082-1-git-send-email-angavrilov@gmail.com>

It is often more convenient to dismiss or accept a
dialog using the keyboard, than by clicking buttons
on the screen. This commit adds key binding to make
it possible with gitk's dialogs.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
---
 gitk |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/gitk b/gitk
index 3fe1b47..edef9e2 100755
--- a/gitk
+++ b/gitk
@@ -1746,6 +1746,8 @@ proc show_error {w top msg} {
     pack $w.ok -side bottom -fill x
     bind $top <Visibility> "grab $top; focus $top"
     bind $top <Key-Return> "destroy $top"
+    bind $top <Key-space>  "destroy $top"
+    bind $top <Key-Escape> "destroy $top"
     tkwait window $top
 }
 
@@ -1769,6 +1771,9 @@ proc confirm_popup msg {
     button $w.cancel -text [mc Cancel] -command "destroy $w"
     pack $w.cancel -side right -fill x
     bind $w <Visibility> "grab $w; focus $w"
+    bind $w <Key-Return> "set confirm_ok 1; destroy $w"
+    bind $w <Key-space>  "set confirm_ok 1; destroy $w"
+    bind $w <Key-Escape> "destroy $w"
     tkwait window $w
     return $confirm_ok
 }
@@ -2611,6 +2616,7 @@ proc keys {} {
 	    -justify left -bg white -border 2 -relief groove
     pack $w.m -side top -fill both -padx 2 -pady 2
     button $w.ok -text [mc "Close"] -command "destroy $w" -default active
+    bind $w <Key-Escape> [list destroy $w]
     pack $w.ok -side bottom
     bind $w <Visibility> "focus $w.ok"
     bind $w <Key-Escape> "destroy $w"
@@ -3533,6 +3539,7 @@ proc vieweditor {top n title} {
     frame $top.buts
     button $top.buts.ok -text [mc "OK"] -command [list newviewok $top $n]
     button $top.buts.can -text [mc "Cancel"] -command [list destroy $top]
+    bind $top <Escape> [list destroy $top]
     grid $top.buts.ok $top.buts.can
     grid columnconfigure $top.buts 0 -weight 1 -uniform a
     grid columnconfigure $top.buts 1 -weight 1 -uniform a
@@ -7793,6 +7800,8 @@ proc mkpatch {} {
     frame $top.buts
     button $top.buts.gen -text [mc "Generate"] -command mkpatchgo
     button $top.buts.can -text [mc "Cancel"] -command mkpatchcan
+    bind $top <Key-Return> mkpatchgo
+    bind $top <Key-Escape> mkpatchcan
     grid $top.buts.gen $top.buts.can
     grid columnconfigure $top.buts 0 -weight 1 -uniform a
     grid columnconfigure $top.buts 1 -weight 1 -uniform a
@@ -7864,6 +7873,8 @@ proc mktag {} {
     frame $top.buts
     button $top.buts.gen -text [mc "Create"] -command mktaggo
     button $top.buts.can -text [mc "Cancel"] -command mktagcan
+    bind $top <Key-Return> mktaggo
+    bind $top <Key-Escape> mktagcan
     grid $top.buts.gen $top.buts.can
     grid columnconfigure $top.buts 0 -weight 1 -uniform a
     grid columnconfigure $top.buts 1 -weight 1 -uniform a
@@ -7967,6 +7978,8 @@ proc writecommit {} {
     frame $top.buts
     button $top.buts.gen -text [mc "Write"] -command wrcomgo
     button $top.buts.can -text [mc "Cancel"] -command wrcomcan
+    bind $top <Key-Return> wrcomgo
+    bind $top <Key-Escape> wrcomcan
     grid $top.buts.gen $top.buts.can
     grid columnconfigure $top.buts 0 -weight 1 -uniform a
     grid columnconfigure $top.buts 1 -weight 1 -uniform a
@@ -8014,6 +8027,8 @@ proc mkbranch {} {
     frame $top.buts
     button $top.buts.go -text [mc "Create"] -command [list mkbrgo $top]
     button $top.buts.can -text [mc "Cancel"] -command "catch {destroy $top}"
+    bind $top <Key-Return> [list mkbrgo $top]
+    bind $top <Key-Escape> "catch {destroy $top}"
     grid $top.buts.go $top.buts.can
     grid columnconfigure $top.buts 0 -weight 1 -uniform a
     grid columnconfigure $top.buts 1 -weight 1 -uniform a
@@ -8138,6 +8153,7 @@ proc resethead {} {
     button $w.ok -text [mc OK] -command "set confirm_ok 1; destroy $w"
     pack $w.ok -side left -fill x -padx 20 -pady 20
     button $w.cancel -text [mc Cancel] -command "destroy $w"
+    bind $w <Key-Escape> [list destroy $w]
     pack $w.cancel -side right -fill x -padx 20 -pady 20
     bind $w <Visibility> "grab $w; focus $w"
     tkwait window $w
@@ -8315,6 +8331,7 @@ proc showrefs {} {
     pack $top.f.l -side left
     grid $top.f - -sticky ew -pady 2
     button $top.close -command [list destroy $top] -text [mc "Close"]
+    bind $top <Key-Escape> [list destroy $top]
     grid $top.close -
     grid columnconfigure $top 0 -weight 1
     grid rowconfigure $top 0 -weight 1
@@ -9666,6 +9683,8 @@ proc choosefont {font which} {
 	frame $top.buts
 	button $top.buts.ok -text [mc "OK"] -command fontok -default active
 	button $top.buts.can -text [mc "Cancel"] -command fontcan -default normal
+	bind $top <Key-Return> fontok
+	bind $top <Key-Escape> fontcan
 	grid $top.buts.ok $top.buts.can
 	grid columnconfigure $top.buts 0 -weight 1 -uniform a
 	grid columnconfigure $top.buts 1 -weight 1 -uniform a
@@ -9845,6 +9864,8 @@ proc doprefs {} {
     frame $top.buts
     button $top.buts.ok -text [mc "OK"] -command prefsok -default active
     button $top.buts.can -text [mc "Cancel"] -command prefscan -default normal
+    bind $top <Key-Return> prefsok
+    bind $top <Key-Escape> prefscan
     grid $top.buts.ok $top.buts.can
     grid columnconfigure $top.buts 0 -weight 1 -uniform a
     grid columnconfigure $top.buts 1 -weight 1 -uniform a
-- 
1.6.0.3.15.gb8d36

  reply	other threads:[~2008-11-02 19:03 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-02 18:59 [PATCH (GITK) v3 0/6] Enhance popup dialogs in gitk Alexander Gavrilov
2008-11-02 18:59 ` Alexander Gavrilov [this message]
2008-11-02 18:59   ` [PATCH (GITK) v3 2/6] gitk: Make gitk dialog windows transient Alexander Gavrilov
2008-11-02 18:59     ` [PATCH (GITK) v3 3/6] gitk: Add accelerators to frequently used menu commands Alexander Gavrilov
2008-11-02 18:59       ` [PATCH (GITK) v3 4/6] gitk: Make cherry-pick call git-citool on conflicts Alexander Gavrilov
2008-11-02 18:59         ` [PATCH (GITK) v3 5/6] gitk: Implement a user-friendly Edit View dialog Alexander Gavrilov
2008-11-02 18:59           ` [PATCH (GITK) v3 6/6] gitk: Explicitly position popup windows Alexander Gavrilov
2008-11-07 11:57             ` Paul Mackerras
2008-11-07 14:39               ` Alex Riesen
2008-11-07 16:37                 ` Johannes Sixt
2008-11-09 10:26                   ` Alex Riesen
2008-11-09 11:12                 ` Paul Mackerras
2008-11-09 14:53               ` Alexander Gavrilov
2008-11-10 11:47                 ` Paul Mackerras
2008-11-10 12:15                   ` Alexander Gavrilov
2008-11-11 11:00               ` Alexander Gavrilov
2008-11-07 11:51         ` [PATCH (GITK) v3 4/6] gitk: Make cherry-pick call git-citool on conflicts Paul Mackerras
2008-11-07 11:50       ` [PATCH (GITK) v3 3/6] gitk: Add accelerators to frequently used menu commands Paul Mackerras
2008-11-09 11:21         ` Alexander Gavrilov
2008-11-07 11:41     ` [PATCH (GITK) v3 2/6] gitk: Make gitk dialog windows transient Paul Mackerras
2008-11-07 11:41   ` [PATCH (GITK) v3 1/6] gitk: Add Return and Escape bindings to dialogs Paul Mackerras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1225652389-22082-2-git-send-email-angavrilov@gmail.com \
    --to=angavrilov@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).