Git development
 help / color / mirror / Atom feed
From: Alexander Gavrilov <angavrilov@gmail.com>
To: git@vger.kernel.org
Cc: "Shawn O. Pearce" <spearce@spearce.org>
Subject: [RFC PATCH (GIT-GUI)] git-gui: Increase blame viewer usability on MacOS.
Date: Thu, 13 Nov 2008 22:02:09 +0300	[thread overview]
Message-ID: <200811132202.09139.angavrilov@gmail.com> (raw)

On MacOS raising a window causes the focus to be transferred
to it -- although it may actually be a bug in the Tcl/Tk port.
When this happens with the blame viewer tooltips, it makes
the interface less usable, because Entry and Leave handlers
on the text view cause the tip to disappear once the mouse
is moved even 1 pixel.

This commit makes the code raise the main window on MacOS
when Tk 8.5 is used. This version seems to properly support
wm transient by making the tip stay on top of the master,
so reraising the master does not cause it to disappear. Thus
the only remaining sign of problems is slight UI flicker
when focus is momentarily transferred to the tip and back.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
---

	An ugly hack, but it makes at least my experience better.
	Unfortunately, even it requires manually installing Tk 8.5.

	I wonder if there is a better fix.
	(maybe, tweaking Enter and Leave instead?)

	Alexander

 lib/blame.tcl |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/lib/blame.tcl b/lib/blame.tcl
index c1cd7f3..f086a8a 100644
--- a/lib/blame.tcl
+++ b/lib/blame.tcl
@@ -1246,6 +1246,18 @@ method _open_tooltip {cur_w} {
 
 	$tooltip_t conf -state disabled
 	_position_tooltip $this
+
+	# On MacOS raising a window causes it to acquire focus.
+	# Tk 8.5 on MacOS seems to properly support wm transient,
+	# so we can safely counter the effect there.
+	if {$::have_tk85 && [tk windowingsystem] eq {aqua}} {
+		update
+		if {$w eq {}} {
+			raise .
+		} else {
+			raise $w
+		}
+	}
 }
 
 method _position_tooltip {} {
@@ -1269,7 +1281,9 @@ method _position_tooltip {} {
 	append g $pos_y
 
 	wm geometry $tooltip_wm $g
-	raise $tooltip_wm
+	if {[tk windowingsystem] ne {aqua}} {
+		raise $tooltip_wm
+	}
 }
 
 method _hide_tooltip {} {
-- 
1.6.0.3.15.gb8d36

                 reply	other threads:[~2008-11-13 19:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200811132202.09139.angavrilov@gmail.com \
    --to=angavrilov@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=spearce@spearce.org \
    /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