patch 8.2.2999: balloon sometimes does not hide with GTK 3

Problem:    Balloon sometimes does not hide with GTK 3.
Solution:   Also listen to GDK_LEAVE_NOTIFY. (Johannes Stezenbach)
This commit is contained in:
Bram Moolenaar
2021-06-14 22:08:46 +02:00
parent 1b0a9dd413
commit 47f6db9089
2 changed files with 11 additions and 0 deletions

View File

@ -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,12 @@ 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;
}