tooltip: Add private api to allocate the window

Add private gtk_tooltip_maybe_allocate() function
and use it from GtkWindow and GtkPopover.

This will let us stop using the ::size-allocate signal,
without having to redo all the tooltip management first.

That will happen later.
This commit is contained in:
Matthias Clasen 2020-05-06 13:56:27 -04:00
parent cb94c7d69e
commit 1f0024a7f0
4 changed files with 22 additions and 0 deletions

View File

@ -122,6 +122,7 @@
#include "gtksnapshot.h"
#include "gtkshortcutmanager.h"
#include "gtkbuildable.h"
#include "gtktooltipprivate.h"
#include "gtkrender.h"
#include "gtkstylecontextprivate.h"
@ -1417,6 +1418,8 @@ gtk_popover_size_allocate (GtkWidget *widget,
gtk_popover_update_shape (popover);
g_clear_pointer (&priv->arrow_render_node, gsk_render_node_unref);
}
gtk_tooltip_maybe_allocate (GTK_NATIVE (popover));
}
static void

View File

@ -977,3 +977,16 @@ gtk_tooltip_handle_event_internal (GdkEventType event_type,
break;
}
}
void
gtk_tooltip_maybe_allocate (GtkNative *native)
{
GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (native));
GtkTooltip *tooltip;
tooltip = g_object_get_qdata (G_OBJECT (display), quark_current_tooltip);
if (!tooltip || GTK_NATIVE (tooltip->native) != native)
return;
gtk_native_check_resize (GTK_NATIVE (tooltip->window));
}

View File

@ -27,6 +27,7 @@
#include <gtk/gtktooltip.h>
#include <gtk/gtknative.h>
G_BEGIN_DECLS
@ -42,6 +43,8 @@ GtkWidget * _gtk_widget_find_at_coords (GdkSurface *surface,
gint *widget_x,
gint *widget_y);
void gtk_tooltip_maybe_allocate (GtkNative *native);
G_END_DECLS

View File

@ -70,6 +70,7 @@
#include "gtkwindowgroup.h"
#include "gtkpopovermenubarprivate.h"
#include "gtkcssboxesimplprivate.h"
#include "gtktooltipprivate.h"
#include "a11y/gtkwindowaccessibleprivate.h"
#include "a11y/gtkcontaineraccessibleprivate.h"
@ -5076,6 +5077,8 @@ gtk_window_size_allocate (GtkWidget *widget,
if (child && gtk_widget_get_visible (child))
gtk_widget_size_allocate (child, &child_allocation, -1);
gtk_tooltip_maybe_allocate (GTK_NATIVE (widget));
}
gboolean