How to migrate the tooltip popup window to GTK4?

In GTK3, I could make a tooltip popup window, now I want to port them to GTK4, how to migrate them to GTK4

// GTK3
m_calltip_window = new Gtk.Window(Gtk.WindowType.POPUP);
m_calltip_window.set_type_hint(Gdk.WindowTypeHint.TOOLTIP);
m_calltip_window.default_width = 200;
m_calltip_window.default_height = 20;
m_calltip_window.realize();

// Port to GTK4
m_calltip_window = new Gtk.Window();
m_calltip_window.transient_for = code_view.root as Gtk.Window;
m_calltip_window.decorated = false;
m_calltip_window.titlebar = null;
m_calltip_window.default_width = 200;
m_calltip_window.default_height = 20;
m_calltip_window.realize();

Now it has followed issues:

  1. Window listed in the taskbar(it should not list in the taskbar)
  2. Window is not the topmost window(Stay as the topmost window)

You should have never done this. Window hints are X11-only, and your code would have broken the styling of your fake tooltips.

What you want to do is connect to the GtkWidget::query-tooltip signal of a widget, then use gtk_tooltip_set_custom() to set a custom widget inside the tooltip window.

the tooltip popup window is used for IntelliSense with GtkSourceView, needs to move with the cursor, but the tooltip can’t move by position, it is the problem.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.