@matheusbsbs / matheus-bagliano / commits / 10852086d4
Fork 0

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>

Alexander Gavrilov committed Nov 13, 2008 at 22:02 UTC 10852086d4dceee924000ef70388b00704f7b463
1 file changed +15 -1
lib/blame.tcl
+15 -1
@@ -1245,6 +1245,18 @@ method _open_tooltip {cur_w} {
1245
1246 $tooltip_t conf -state disabled
1247 _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 + }
1260 }
1261
1262 method _position_tooltip {} {
@@ -1268,7 +1280,9 @@ method _position_tooltip {} {
1280 append g $pos_y
1281
1282 wm geometry $tooltip_wm $g
1271 - raise $tooltip_wm
1283 + if {![is_MacOSX]} {
1284 + raise $tooltip_wm
1285 + }
1286 }
1287
1288 method _hide_tooltip {} {