Hi Bram,

On Fri, Jun 11, 2021 at 11:53:16AM +0200, Johannes Stezenbach wrote:
> I'm suffering from an annoying issue with ballooneval as
> used by the taglist plugin. When using gvim built with --enable-gui=gtk3
> the balloon sometimes does not hide when the gvim window loses
> focus, i.e. the ballon shows on top of other windows even
> when gvim is completely hidden behind other windows, or even
> when the gvim window is on a different virtual desktop.

Could you please take a look at the issue and my proposed patch?

Thanks,
Johannes


--- snip ---
fix gtk3 GUI balloon failing to hide

In some rare cases the GDK_LEAVE_NOTIFY event does not
propagate to the target window but instead is sent
to the main window twice. This might be a gtk3 issue.

diff --git a/src/gui_beval.c b/src/gui_beval.c
index 57122ffa9ae2..d2bf8089a357 100644
--- a/src/gui_beval.c
+++ b/src/gui_beval.c
@@ -253,6 +253,9 @@ addEventHandler(GtkWidget *target, BalloonEval *beval)
     if (gtk_socket_id == 0 && gui.mainwin != NULL
            && gtk_widget_is_ancestor(target, gui.mainwin))
     {
+       gtk_widget_add_events(gui.mainwin,
+                             GDK_LEAVE_NOTIFY_MASK);
+
        g_signal_connect(G_OBJECT(gui.mainwin), "event",
                         G_CALLBACK(mainwin_event_cb),
                         beval);
@@ -360,6 +363,14 @@ mainwin_event_cb(GtkWidget *widget UNUSED, GdkEvent 
*event, gpointer data)
        case GDK_KEY_RELEASE:
            key_event(beval, event->key.keyval, FALSE);
            break;
+       case GDK_LEAVE_NOTIFY:
+           /*
+            * Ignore LeaveNotify events that are not "normal".
+            * Apparently we also get it when somebody else grabs focus.
+            */
+           if (event->crossing.mode == GDK_CROSSING_NORMAL)
+               cancelBalloon(beval);
+           break;
        default:
            break;
     }

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/YMenUF6k%2BpPFWG8a%40sig21.net.

Raspunde prin e-mail lui