diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2008-11-13 22:02:09 +0300 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2009-12-06 01:26:59 +0300 |
commit | 10852086d4dceee924000ef70388b00704f7b463 (patch) | |
tree | ca99c0f18ececed819316eb20e9be7f9292f439f | |
parent | 88520cadf902c8bc780394e1ddecc726534c3df9 (diff) |
git-gui: Increase blame viewer usability on MacOS.
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>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rw-r--r-- | lib/blame.tcl | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/blame.tcl b/lib/blame.tcl index 1f3b08f9ef..8525b79aaa 100644 --- a/lib/blame.tcl +++ b/lib/blame.tcl @@ -1245,6 +1245,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 && [is_MacOSX]} { + update + if {$w eq {}} { + raise . + } else { + raise $w + } + } } method _position_tooltip {} { @@ -1268,7 +1280,9 @@ method _position_tooltip {} { append g $pos_y wm geometry $tooltip_wm $g - raise $tooltip_wm + if {![is_MacOSX]} { + raise $tooltip_wm + } } method _hide_tooltip {} { |