Skip to content

Commit

Permalink
git-gui: Ensure error dialogs always appear over all other windows
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Shawn O. Pearce committed Feb 21, 2008
1 parent 2c2a378 commit aba15f7
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions lib/error.tcl
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# git-gui branch (create/delete) support
# Copyright (C) 2006, 2007 Shawn Pearce

proc _error_parent {} {
return [grab current .]
}

proc error_popup {msg} {
set title [appname]
if {[reponame] ne {}} {
Expand All @@ -11,8 +15,8 @@ proc error_popup {msg} {
-type ok \
-title [append "$title: " [mc "error"]] \
-message $msg]
if {[winfo ismapped .]} {
lappend cmd -parent .
if {[winfo ismapped [_error_parent]]} {
lappend cmd -parent [_error_parent]
}
eval $cmd
}
Expand All @@ -27,13 +31,13 @@ proc warn_popup {msg} {
-type ok \
-title [append "$title: " [mc "warning"]] \
-message $msg]
if {[winfo ismapped .]} {
lappend cmd -parent .
if {[winfo ismapped [_error_parent]]} {
lappend cmd -parent [_error_parent]
}
eval $cmd
}

proc info_popup {msg {parent .}} {
proc info_popup {msg} {
set title [appname]
if {[reponame] ne {}} {
append title " ([reponame])"
Expand All @@ -56,8 +60,8 @@ proc ask_popup {msg} {
-type yesno \
-title $title \
-message $msg]
if {[winfo ismapped .]} {
lappend cmd -parent .
if {[winfo ismapped [_error_parent]]} {
lappend cmd -parent [_error_parent]
}
eval $cmd
}
Expand Down

0 comments on commit aba15f7

Please sign in to comment.