gitk: On OSX, bring the gitk window to front

On OSX, Tcl/Tk application windows are created behind all the applications down the stack of windows. This is very annoying, because once a gitk window appears, it's the downmost window and switching to it is pain. The patch is: if we are on OSX, use osascript to bring the current Wish process window to front. Signed-off-by: Tair Sabirgaliev <tair.sabirgaliev@gmail.com> Thanks-to: Stefan Haller <lists@haller-berlin.de> Signed-off-by: Paul Mackerras <paulus@samba.org>

Tair Sabirgaliev committed Apr 24, 2013 at 15:48 UTC 76bf6ff93e1766b8813f0cdbe9089080010ba646
1 file changed +9
gitk
+9
@@ -11751,6 +11751,15 @@ if {[catch {package require Tk 8.4} err]} {
11751 exit 1
11752 }
11753
11754 +# on OSX bring the current Wish process window to front
11755 +if {[tk windowingsystem] eq "aqua"} {
11756 + exec osascript -e [format {
11757 + tell application "System Events"
11758 + set frontmost of processes whose unix id is %d to true
11759 + end tell
11760 + } [pid] ]
11761 +}
11762 +
11763 # Unset GIT_TRACE var if set
11764 if { [info exists ::env(GIT_TRACE)] } {
11765 unset ::env(GIT_TRACE)