@matheusbsbs / matheus-bagliano / commits / aba15f7f59
Fork 0

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>

Shawn O. Pearce committed Feb 20, 2008 at 23:37 UTC aba15f7f592c302196401d17a42c772d744555b4
1 file changed +11 -7
lib/error.tcl
+11 -7
@@ -1,6 +1,10 @@
1 # git-gui branch (create/delete) support
2 # Copyright (C) 2006, 2007 Shawn Pearce
3
4 +proc _error_parent {} {
5 + return [grab current .]
6 +}
7 +
8 proc error_popup {msg} {
9 set title [appname]
10 if {[reponame] ne {}} {
@@ -11,8 +15,8 @@ proc error_popup {msg} {
15 -type ok \
16 -title [append "$title: " [mc "error"]] \
17 -message $msg]
14 - if {[winfo ismapped .]} {
15 - lappend cmd -parent .
18 + if {[winfo ismapped [_error_parent]]} {
19 + lappend cmd -parent [_error_parent]
20 }
21 eval $cmd
22 }
@@ -27,13 +31,13 @@ proc warn_popup {msg} {
31 -type ok \
32 -title [append "$title: " [mc "warning"]] \
33 -message $msg]
30 - if {[winfo ismapped .]} {
31 - lappend cmd -parent .
34 + if {[winfo ismapped [_error_parent]]} {
35 + lappend cmd -parent [_error_parent]
36 }
37 eval $cmd
38 }
39
36 -proc info_popup {msg {parent .}} {
40 +proc info_popup {msg} {
41 set title [appname]
42 if {[reponame] ne {}} {
43 append title " ([reponame])"
@@ -56,8 +60,8 @@ proc ask_popup {msg} {
60 -type yesno \
61 -title $title \
62 -message $msg]
59 - if {[winfo ismapped .]} {
60 - lappend cmd -parent .
63 + if {[winfo ismapped [_error_parent]]} {
64 + lappend cmd -parent [_error_parent]
65 }
66 eval $cmd
67 }