git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Carlo Marcelo Arenas Belón" <carenas@gmail.com>
To: git@vger.kernel.org, paulus@samba.org
Cc: pietzsch@mycroft.speedport.ip, sunshine@sunshineco.com,
	tair.sabirgaliev@bee.kz, lists@haller-berlin.de,
	"Carlo Marcelo Arenas Belón" <carenas@gmail.com>
Subject: [PATCH 1/3] gitk: skip calling osascript to set frontmost for tk >= 8.6
Date: Tue,  3 Aug 2021 18:08:58 -0700	[thread overview]
Message-ID: <20210804010900.33133-2-carenas@gmail.com> (raw)
In-Reply-To: <20210804010900.33133-1-carenas@gmail.com>

76bf6ff (gitk: On OSX, bring the gitk window to front, 2013-04-24) adds
an osascript to set the gitk window to the front to workaround and
unfortunate default in older tk versions to add it to the back.

tk 8.6 or newer do not need that workaround so add a conditional check
to skip it and while at it update the comment with the new name for the
OS.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
 gitk | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/gitk b/gitk
index 23d9dd1..f68d983 100755
--- a/gitk
+++ b/gitk
@@ -12288,13 +12288,15 @@ if {[catch {package require Tk 8.4} err]} {
     exit 1
 }
 
-# on OSX bring the current Wish process window to front
+# on macOS bring the current Wish process window to front if needed
 if {[tk windowingsystem] eq "aqua"} {
-    exec osascript -e [format {
-        tell application "System Events"
-            set frontmost of processes whose unix id is %d to true
-        end tell
-    } [pid] ]
+    if {$tcl_version < 8.6} {
+        exec osascript -e [format {
+            tell application "System Events"
+                set frontmost of processes whose unix id is %d to true
+            end tell
+        } [pid] ]
+    }
 }
 
 # Unset GIT_TRACE var if set
-- 
2.33.0.rc0.433.g9a510e7e11


  reply	other threads:[~2021-08-04  1:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-04  1:08 [PATCH 0/3] gitk: macOS improvements Carlo Marcelo Arenas Belón
2021-08-04  1:08 ` Carlo Marcelo Arenas Belón [this message]
2021-08-04  1:08 ` [PATCH 2/3] gitk: avoid fatal error if `exec osascript` fails Carlo Marcelo Arenas Belón
2021-08-04  1:09 ` [PATCH 3/3] gitk: check main window visibility before waiting for it to show Carlo Marcelo Arenas Belón
2021-08-04  6:27   ` Chris Torek
2021-08-04  2:37 ` [PATCH 0/3] gitk: macOS improvements Carlo Arenas

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=20210804010900.33133-2-carenas@gmail.com \
    --to=carenas@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=lists@haller-berlin.de \
    --cc=paulus@samba.org \
    --cc=pietzsch@mycroft.speedport.ip \
    --cc=sunshine@sunshineco.com \
    --cc=tair.sabirgaliev@bee.kz \
    /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).