Compare commits

...

3 Commits

Author SHA1 Message Date
Matthias Clasen
49e93f6ee4 textview: Don't validate during snapshot
Do it during size_allocate, and go back there
if needed.
2023-02-21 15:04:30 -05:00
Matthias Clasen
4ec2234537 widget: Warn for invalidation during paint 2023-02-21 15:04:30 -05:00
Matthias Clasen
5a3755b233 frameclock: Add a debug helper
Begin able to query the current phase
is useful for debugging purposes.
2023-02-21 15:04:30 -05:00
4 changed files with 27 additions and 4 deletions

View File

@ -584,6 +584,8 @@ gdk_frame_clock_paint_idle (void *data)
{
priv->requested &= ~GDK_FRAME_CLOCK_PHASE_LAYOUT;
_gdk_frame_clock_emit_layout (clock);
if (priv->requested & GDK_FRAME_CLOCK_PHASE_LAYOUT)
g_print ("looping in layout %d\n", iter);
}
if (iter == 5)
g_warning ("gdk-frame-clock: layout continuously requested, giving up after 4 tries");
@ -809,3 +811,12 @@ _gdk_frame_clock_idle_new (void)
return GDK_FRAME_CLOCK (clock);
}
GdkFrameClockPhase
gdk_frame_clock_get_current_phase (GdkFrameClock *clock)
{
GdkFrameClockIdle *clock_idle = GDK_FRAME_CLOCK_IDLE (clock);
GdkFrameClockIdlePrivate *priv = clock_idle->priv;
return priv->phase;
}

View File

@ -127,6 +127,8 @@ void _gdk_frame_clock_emit_paint (GdkFrameClock *frame_clock);
void _gdk_frame_clock_emit_after_paint (GdkFrameClock *frame_clock);
void _gdk_frame_clock_emit_resume_events (GdkFrameClock *frame_clock);
GdkFrameClockPhase gdk_frame_clock_get_current_phase (GdkFrameClock *frame_clock);
G_END_DECLS
#endif /* __GDK_FRAME_CLOCK_PRIVATE_H__ */

View File

@ -4689,10 +4689,6 @@ gtk_text_view_size_allocate (GtkWidget *widget,
}
g_object_unref (layout);
/* The GTK resize loop processes all the pending exposes right
* after doing the resize stuff, so the idle sizer won't have a
* chance to run. So we do the work here.
*/
gtk_text_view_flush_first_validate (text_view);
chooser = g_object_get_data (G_OBJECT (text_view), "gtk-emoji-chooser");
@ -4876,6 +4872,8 @@ gtk_text_view_invalidate (GtkTextView *text_view)
DV (g_print (G_STRLOC": adding incremental validate idle %d\n",
priv->incremental_validate_idle));
}
gtk_widget_queue_allocate (GTK_WIDGET (text_view));
}
static void
@ -5843,6 +5841,9 @@ gtk_text_view_paint (GtkWidget *widget,
g_return_if_fail (priv->xoffset >= - priv->left_padding);
g_return_if_fail (priv->yoffset >= - priv->top_margin);
if (priv->first_validate_idle != 0)
g_critical ("textview: paint with unfinished validation\n");
while (priv->first_validate_idle != 0)
{
DV (g_print (G_STRLOC": first_validate_idle: %d\n",

View File

@ -75,6 +75,7 @@
#include "gdk/gdkeventsprivate.h"
#include "gdk/gdkprofilerprivate.h"
#include "gdk/gdkframeclockprivate.h"
#include "gsk/gskdebugprivate.h"
#include "gsk/gskrendererprivate.h"
@ -10571,6 +10572,14 @@ static void
gtk_widget_set_alloc_needed (GtkWidget *widget)
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
GdkFrameClock *frame_clock = gtk_widget_get_frame_clock (widget);
if (frame_clock != NULL &&
gdk_frame_clock_get_current_phase (frame_clock) == GDK_FRAME_CLOCK_PHASE_PAINT)
{
g_warning ("%s %p set alloc-needed during PAINT\n",
G_OBJECT_TYPE_NAME (widget), widget);
}
priv->alloc_needed = TRUE;