[evolution] EWebView: Change mouse leave detection code



commit 0d666bc1d9ebe9e7876cb5c6aa88fa0a382e29b7
Author: Milan Crha <mcrha redhat com>
Date:   Mon Oct 18 17:11:25 2021 +0200

    EWebView: Change mouse leave detection code
    
    The old change causes runtime warnings with WebKitGTK 2.34.0,
    thus stop sending fake signal to the WebKitGTK and count with
    the case when the cached link hover will not update the status
    bar text.
    
    Related to https://bugzilla.gnome.org/show_bug.cgi?id=752543

 src/e-util/e-web-view.c | 26 ++++++++------------------
 1 file changed, 8 insertions(+), 18 deletions(-)
---
diff --git a/src/e-util/e-web-view.c b/src/e-util/e-web-view.c
index 551ccb5b65..1115ab8e9b 100644
--- a/src/e-util/e-web-view.c
+++ b/src/e-util/e-web-view.c
@@ -2128,25 +2128,13 @@ web_view_toplevel_event_after_cb (GtkWidget *widget,
                                  GdkEvent *event,
                                  EWebView *web_view)
 {
-       if (event && event->type == GDK_MOTION_NOTIFY && web_view->priv->has_hover_link) {
-               GdkEventMotion *motion_event = (GdkEventMotion *) event;
+       if (event && event->type == GDK_MOTION_NOTIFY && web_view->priv->has_hover_link &&
+           gdk_event_get_window (event) != gtk_widget_get_window (GTK_WIDGET (web_view))) {
+               /* This won't reset WebKitGTK's cached link the cursor stays on, but do this,
+                  instead of sending a fake signal to the WebKitGTK. */
+               e_web_view_status_message (web_view, NULL);
 
-               if (gdk_event_get_window (event) != gtk_widget_get_window (GTK_WIDGET (web_view))) {
-                       GdkEventMotion fake_motion_event;
-                       gboolean result = FALSE;
-
-                       fake_motion_event = *motion_event;
-                       fake_motion_event.x = -1.0;
-                       fake_motion_event.y = -1.0;
-                       fake_motion_event.window = gtk_widget_get_window (GTK_WIDGET (web_view));
-
-                       /* Use a fake event instead of the call to unset the status message, because
-                          WebKit caches which link it stays on and doesn't emit the signal when still
-                          moving about the same link, thus this will unset the link also for the WebKit. */
-                       g_signal_emit_by_name (web_view, "motion-notify-event", &fake_motion_event, &result);
-
-                       web_view->priv->has_hover_link = FALSE;
-               }
+               web_view->priv->has_hover_link = FALSE;
        }
 }
 
@@ -2172,6 +2160,8 @@ web_view_unmap (GtkWidget *widget)
        g_signal_handlers_disconnect_by_func (toplevel, G_CALLBACK (web_view_toplevel_event_after_cb), 
widget);
 
        GTK_WIDGET_CLASS (e_web_view_parent_class)->unmap (widget);
+
+       e_web_view_status_message (E_WEB_VIEW (widget), NULL);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]