diff mbox series

git-gui blame: prevent tool tips from sticking around after Command-Tab

Message ID 20201013132643.3209-1-stefan@haller-berlin.de (mailing list archive)
State Accepted
Commit 38c2ac2e2ab00a8bcef528f24cb5b883b4413e5c
Headers show
Series git-gui blame: prevent tool tips from sticking around after Command-Tab | expand

Commit Message

Stefan Haller Oct. 13, 2020, 1:26 p.m. UTC
On Mac, tooltips are not automatically removed when a window loses
focus. Furthermore, mouse-move events are only dispatched to the active
window, which means that if we Command-tab to another application while
a tool tip is showing, the tool tip will stay there forever (in front of
other applications). So we must hide it manually when we lose focus.

I'm doing this unconditionally here (i.e. without if {[is_MacOSX]}); it
shouldn't hurt on other platforms, even though they don't seem to have
this problem.

Signed-off-by: Stefan Haller <stefan@haller-berlin.de>
---
 lib/blame.tcl | 1 +
 1 file changed, 1 insertion(+)

Comments

Pratyush Yadav Oct. 13, 2020, 3:17 p.m. UTC | #1
Hi Stefan,

> Subject: [PATCH] git-gui blame: prevent tool tips from sticking around
Nitpick:                  ^ Add a ':' here.

On 13/10/20 03:26PM, Stefan Haller wrote:
> On Mac, tooltips are not automatically removed when a window loses
> focus. Furthermore, mouse-move events are only dispatched to the active
> window, which means that if we Command-tab to another application while
> a tool tip is showing, the tool tip will stay there forever (in front of
> other applications). So we must hide it manually when we lose focus.
> 
> I'm doing this unconditionally here (i.e. without if {[is_MacOSX]}); it

Nitpick: s/I'm doing this/Do this/.

> shouldn't hurt on other platforms, even though they don't seem to have
> this problem.

Yes, I don't have this problem on Linux. But this patch does not make 
any visible difference/regressions either.
 
> Signed-off-by: Stefan Haller <stefan@haller-berlin.de>
> ---
>  lib/blame.tcl | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/blame.tcl b/lib/blame.tcl
> index 62ec083..8441e10 100644
> --- a/lib/blame.tcl
> +++ b/lib/blame.tcl
> @@ -328,6 +328,7 @@ constructor new {i_commit i_path i_jump} {
>  		bind $i <Any-Motion>  [cb _show_tooltip $i @%x,%y]
>  		bind $i <Any-Enter>   [cb _hide_tooltip]
>  		bind $i <Any-Leave>   [cb _hide_tooltip]
> +		bind $i <Deactivate>  [cb _hide_tooltip]
>  		bind_button3 $i "
>  			[cb _hide_tooltip]
>  			set cursorX %x

Will apply with the two nitpicks above fixed. No need to resend. Thanks.
Pratyush Yadav Oct. 17, 2020, 9:37 a.m. UTC | #2
On 13/10/20 08:47PM, Pratyush Yadav wrote:
> Hi Stefan,
> 
> > Subject: [PATCH] git-gui blame: prevent tool tips from sticking around
> Nitpick:                  ^ Add a ':' here.
> 
> On 13/10/20 03:26PM, Stefan Haller wrote:
> > On Mac, tooltips are not automatically removed when a window loses
> > focus. Furthermore, mouse-move events are only dispatched to the active
> > window, which means that if we Command-tab to another application while
> > a tool tip is showing, the tool tip will stay there forever (in front of
> > other applications). So we must hide it manually when we lose focus.
> > 
> > I'm doing this unconditionally here (i.e. without if {[is_MacOSX]}); it
> 
> Nitpick: s/I'm doing this/Do this/.
> 
> > shouldn't hurt on other platforms, even though they don't seem to have
> > this problem.
> 
> Yes, I don't have this problem on Linux. But this patch does not make 
> any visible difference/regressions either.
>  
> > Signed-off-by: Stefan Haller <stefan@haller-berlin.de>
> > ---
> >  lib/blame.tcl | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/lib/blame.tcl b/lib/blame.tcl
> > index 62ec083..8441e10 100644
> > --- a/lib/blame.tcl
> > +++ b/lib/blame.tcl
> > @@ -328,6 +328,7 @@ constructor new {i_commit i_path i_jump} {
> >  		bind $i <Any-Motion>  [cb _show_tooltip $i @%x,%y]
> >  		bind $i <Any-Enter>   [cb _hide_tooltip]
> >  		bind $i <Any-Leave>   [cb _hide_tooltip]
> > +		bind $i <Deactivate>  [cb _hide_tooltip]
> >  		bind_button3 $i "
> >  			[cb _hide_tooltip]
> >  			set cursorX %x
> 
> Will apply with the two nitpicks above fixed. No need to resend. Thanks.

Applied to git-gui/master. Thanks.
diff mbox series

Patch

diff --git a/lib/blame.tcl b/lib/blame.tcl
index 62ec083..8441e10 100644
--- a/lib/blame.tcl
+++ b/lib/blame.tcl
@@ -328,6 +328,7 @@  constructor new {i_commit i_path i_jump} {
 		bind $i <Any-Motion>  [cb _show_tooltip $i @%x,%y]
 		bind $i <Any-Enter>   [cb _hide_tooltip]
 		bind $i <Any-Leave>   [cb _hide_tooltip]
+		bind $i <Deactivate>  [cb _hide_tooltip]
 		bind_button3 $i "
 			[cb _hide_tooltip]
 			set cursorX %x