From 7657a867095f9edbb43c22f979f06dbe880059b7 Mon Sep 17 00:00:00 2001
From: Eli Zaretskii <eliz@gnu.org>
Date: Sat, 11 Nov 2017 14:42:30 +0200
Subject: [PATCH] Fix comparisons with tip_frame in GTK builds

* src/xterm.c (x_update_begin, x_new_font):
* src/xfns.c (Fx_display_monitor_attributes_list):
* src/frame.c (Fframe_list) [USE_GTK]: Don't consider tip_frame a
tooltip frame unless its 'tooltip' parameter is non-nil.  (Bug#26747)
---
 src/frame.c |  6 +++++-
 src/xfns.c  |  6 +++++-
 src/xterm.c | 12 ++++++++++--
 3 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/src/frame.c b/src/frame.c
index fe1709e6ede..2b32751c0d3 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1472,7 +1472,11 @@ DEFUN ("frame-list", Fframe_list, Sframe_list,
   Lisp_Object frames;
   frames = Fcopy_sequence (Vframe_list);
 #ifdef HAVE_WINDOW_SYSTEM
-  if (FRAMEP (tip_frame))
+  if (FRAMEP (tip_frame)
+#ifdef USE_GTK
+      && !NILP (Fframe_parameter (tip_frame, Qtooltip))
+#endif
+      )
     frames = Fdelq (tip_frame, frames);
 #endif
   return frames;
diff --git a/src/xfns.c b/src/xfns.c
index 9022e4a9674..83fc07dc6cb 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -4915,7 +4915,11 @@ Internal use only, use `display-monitor-attributes-list' instead.  */)
       struct frame *f = XFRAME (frame);
 
       if (FRAME_X_P (f) && FRAME_DISPLAY_INFO (f) == dpyinfo
-	  && !EQ (frame, tip_frame))
+	  && !(EQ (frame, tip_frame)
+#ifdef USE_GTK
+	       && !NILP (Fframe_parameter (tip_frame, Qtooltip))
+#endif
+	       ))
 	{
 	  GdkWindow *gwin = gtk_widget_get_window (FRAME_GTK_WIDGET (f));
 
diff --git a/src/xterm.c b/src/xterm.c
index dbb8349452d..e11cde771ab 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -997,7 +997,11 @@ x_update_begin (struct frame *f)
 {
 #ifdef USE_CAIRO
   if (! NILP (tip_frame) && XFRAME (tip_frame) == f
-      && ! FRAME_VISIBLE_P (f))
+      && ! FRAME_VISIBLE_P (f)
+#ifdef USE_GTK
+      && !NILP (Fframe_parameter (tip_frame, Qtooltip))
+#endif
+      )
     return;
 
   if (! FRAME_CR_SURFACE (f))
@@ -9960,7 +9964,11 @@ x_new_font (struct frame *f, Lisp_Object font_object, int fontset)
       /* Don't change the size of a tip frame; there's no point in
 	 doing it because it's done in Fx_show_tip, and it leads to
 	 problems because the tip frame has no widget.  */
-      if (NILP (tip_frame) || XFRAME (tip_frame) != f)
+      if (NILP (tip_frame) || XFRAME (tip_frame) != f
+#ifdef USE_GTK
+	  || NILP (Fframe_parameter (tip_frame, Qtooltip))
+#endif
+	  )
 	{
 	  adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f),
 			     FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 3,
-- 
2.39.5