From 8c29dbd3a81e6f0c9b9a76d4fd617f05ae2ea235 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sat, 11 Dec 2021 18:44:53 +0800 Subject: [PATCH] Fix tooltips in PGTK child frames * src/gtkutil.c (xg_show_tooltip, xg_hide_tooltip): Make safe for child frames. --- src/gtkutil.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/gtkutil.c b/src/gtkutil.c index 225984af41a..0164d873bb3 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -928,15 +928,18 @@ xg_show_tooltip (struct frame *f, Lisp_Object string) { Lisp_Object encoded_string = ENCODE_UTF_8 (string); - gtk_widget_set_tooltip_text (FRAME_GTK_OUTER_WIDGET (f), SSDATA (encoded_string)); + gtk_widget_set_tooltip_text (FRAME_GTK_OUTER_WIDGET (f) + ? FRAME_GTK_OUTER_WIDGET (f) + : FRAME_GTK_WIDGET (f), + SSDATA (encoded_string)); } bool xg_hide_tooltip (struct frame *f) { - if (gtk_widget_get_tooltip_text (FRAME_GTK_OUTER_WIDGET (f)) == NULL) - return FALSE; - gtk_widget_set_tooltip_text (FRAME_GTK_OUTER_WIDGET (f), NULL); + if (FRAME_GTK_OUTER_WIDGET (f)) + gtk_widget_set_tooltip_text (FRAME_GTK_OUTER_WIDGET (f), NULL); + gtk_widget_set_tooltip_text (FRAME_GTK_WIDGET (f), NULL); return TRUE; } -- 2.39.2