]> git.eshelyaron.com Git - emacs.git/commitdiff
Work around tooltip bug on new versions of WebKitGTK
authorPo Lu <luangruo@yahoo.com>
Sun, 13 Feb 2022 03:29:44 +0000 (11:29 +0800)
committerPo Lu <luangruo@yahoo.com>
Sun, 13 Feb 2022 03:29:44 +0000 (11:29 +0800)
* src/xwidget.c (dummy_tooltip_string): New variable.
(xw_maybe_synthesize_crossing): Call `xg_prepare_tooltip' to
disable tooltips on WebKitGTK 2.34 or later.
(syms_of_xwidget): Make dummy string.

src/xwidget.c

index fc6ba2c6335e63755e8cd720791b818a16b1ba9a..bfee80ef3ed026fd0efa0b2006cbbb1642d5ab2e 100644 (file)
@@ -62,6 +62,9 @@ static uint32_t xwidget_counter = 0;
 #ifdef USE_GTK
 #ifdef HAVE_X_WINDOWS
 static Lisp_Object x_window_to_xwv_map;
+#if WEBKIT_CHECK_VERSION (2, 34, 0)
+static Lisp_Object dummy_tooltip_string;
+#endif
 #endif
 static gboolean offscreen_damage_event (GtkWidget *, GdkEvent *, gpointer);
 static void synthesize_focus_in_event (GtkWidget *);
@@ -1731,6 +1734,17 @@ xw_maybe_synthesize_crossing (struct xwidget_view *view,
   bool nonlinear_p;
   bool retention_flag;
 
+#if WEBKIT_CHECK_VERSION (2, 34, 0)
+  /* Work around a silly bug in WebKitGTK+ that tries to make tooltip
+     windows transient for our offscreen window.  */
+  int tooltip_width, tooltip_height;
+  struct x_output *output = FRAME_X_OUTPUT (view->frame);
+
+  if (!output->ttip_widget)
+    xg_prepare_tooltip (view->frame, dummy_tooltip_string,
+                       &tooltip_width, &tooltip_height);
+#endif
+
   toplevel = gtk_widget_get_window (XXWIDGET (view->model)->widgetwindow_osr);
   retention_flag = false;
 
@@ -3931,6 +3945,11 @@ syms_of_xwidget (void)
   x_window_to_xwv_map = CALLN (Fmake_hash_table, QCtest, Qeq);
 
   staticpro (&x_window_to_xwv_map);
+
+#if WEBKIT_CHECK_VERSION (2, 34, 0)
+  dummy_tooltip_string = build_string ("");
+  staticpro (&dummy_tooltip_string);
+#endif
 #endif
 }