Skip to content

Commit aba15f7

Browse files
committed
git-gui: Ensure error dialogs always appear over all other windows
If we are opening an error dialog we want it to appear above all of the other windows, even those that we may have opened with a grab to make the window modal. Failure to do so may allow an error dialog to open up (and grab focus!) under an existing toplevel, making the user think git-gui has frozen up and is unresponsive, as they cannot get to the dialog. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
1 parent 2c2a378 commit aba15f7

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

lib/error.tcl

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# git-gui branch (create/delete) support
22
# Copyright (C) 2006, 2007 Shawn Pearce
33

4+
proc _error_parent {} {
5+
return [grab current .]
6+
}
7+
48
proc error_popup {msg} {
59
set title [appname]
610
if {[reponame] ne {}} {
@@ -11,8 +15,8 @@ proc error_popup {msg} {
1115
-type ok \
1216
-title [append "$title: " [mc "error"]] \
1317
-message $msg]
14-
if {[winfo ismapped .]} {
15-
lappend cmd -parent .
18+
if {[winfo ismapped [_error_parent]]} {
19+
lappend cmd -parent [_error_parent]
1620
}
1721
eval $cmd
1822
}
@@ -27,13 +31,13 @@ proc warn_popup {msg} {
2731
-type ok \
2832
-title [append "$title: " [mc "warning"]] \
2933
-message $msg]
30-
if {[winfo ismapped .]} {
31-
lappend cmd -parent .
34+
if {[winfo ismapped [_error_parent]]} {
35+
lappend cmd -parent [_error_parent]
3236
}
3337
eval $cmd
3438
}
3539

36-
proc info_popup {msg {parent .}} {
40+
proc info_popup {msg} {
3741
set title [appname]
3842
if {[reponame] ne {}} {
3943
append title " ([reponame])"
@@ -56,8 +60,8 @@ proc ask_popup {msg} {
5660
-type yesno \
5761
-title $title \
5862
-message $msg]
59-
if {[winfo ismapped .]} {
60-
lappend cmd -parent .
63+
if {[winfo ismapped [_error_parent]]} {
64+
lappend cmd -parent [_error_parent]
6165
}
6266
eval $cmd
6367
}

0 commit comments

Comments
 (0)