Skip to content

Commit 1085208

Browse files
angavrilovspearce
authored andcommitted
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 <[email protected]> Signed-off-by: Shawn O. Pearce <[email protected]>
1 parent 88520ca commit 1085208

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

lib/blame.tcl

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1245,6 +1245,18 @@ method _open_tooltip {cur_w} {
12451245

12461246
$tooltip_t conf -state disabled
12471247
_position_tooltip $this
1248+
1249+
# On MacOS raising a window causes it to acquire focus.
1250+
# Tk 8.5 on MacOS seems to properly support wm transient,
1251+
# so we can safely counter the effect there.
1252+
if {$::have_tk85 && [is_MacOSX]} {
1253+
update
1254+
if {$w eq {}} {
1255+
raise .
1256+
} else {
1257+
raise $w
1258+
}
1259+
}
12481260
}
12491261

12501262
method _position_tooltip {} {
@@ -1268,7 +1280,9 @@ method _position_tooltip {} {
12681280
append g $pos_y
12691281

12701282
wm geometry $tooltip_wm $g
1271-
raise $tooltip_wm
1283+
if {![is_MacOSX]} {
1284+
raise $tooltip_wm
1285+
}
12721286
}
12731287

12741288
method _hide_tooltip {} {

0 commit comments

Comments
 (0)