clutter/stage: Add 'skipped-paint' signal/vfunc
This is intended to allow being notified about a stage update happening, but painting didn't happen. This is possible today by using other signals and keeping track of painting happened, but it saves us some state tracking by just being told so. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4067>
This commit is contained in:
parent
127c303254
commit
3806c0bd44
@ -59,6 +59,9 @@ void clutter_stage_emit_before_paint (ClutterStage
|
||||
void clutter_stage_emit_after_paint (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
ClutterFrame *frame);
|
||||
void clutter_stage_emit_skipped_paint (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
ClutterFrame *frame);
|
||||
void clutter_stage_after_update (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
ClutterFrame *frame);
|
||||
|
@ -1084,6 +1084,10 @@ handle_frame_clock_frame (ClutterFrameClock *frame_clock,
|
||||
if (clutter_context_get_show_fps (context))
|
||||
end_frame_timing_measurement (view);
|
||||
}
|
||||
else
|
||||
{
|
||||
clutter_stage_emit_skipped_paint (stage, view, frame);
|
||||
}
|
||||
|
||||
_clutter_stage_window_finish_frame (stage_window, view, frame);
|
||||
|
||||
|
@ -165,6 +165,7 @@ enum
|
||||
PREPARE_FRAME,
|
||||
BEFORE_PAINT,
|
||||
AFTER_PAINT,
|
||||
SKIPPED_PAINT,
|
||||
AFTER_UPDATE,
|
||||
PAINT_VIEW,
|
||||
PRESENTED,
|
||||
@ -527,6 +528,14 @@ clutter_stage_emit_after_paint (ClutterStage *stage,
|
||||
g_signal_emit (stage, stage_signals[AFTER_PAINT], 0, view, frame);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_stage_emit_skipped_paint (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
ClutterFrame *frame)
|
||||
{
|
||||
g_signal_emit (stage, stage_signals[SKIPPED_PAINT], 0, view, frame);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_stage_after_update (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
@ -1632,6 +1641,29 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
||||
G_TYPE_FROM_CLASS (gobject_class),
|
||||
_clutter_marshal_VOID__OBJECT_BOXEDv);
|
||||
|
||||
/**
|
||||
* ClutterStage::skipped-paint:
|
||||
* @stage: the stage that received the event
|
||||
* @view: a #ClutterStageView
|
||||
* @frame: a #ClutterFrame
|
||||
*
|
||||
* The ::skipped-paint signal is emitted after relayout, if no damage
|
||||
* was posted and the paint was skipped.
|
||||
*/
|
||||
stage_signals[SKIPPED_PAINT] =
|
||||
g_signal_new (I_("skipped-paint"),
|
||||
G_TYPE_FROM_CLASS (gobject_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ClutterStageClass, skipped_paint),
|
||||
NULL, NULL,
|
||||
_clutter_marshal_VOID__OBJECT_BOXED,
|
||||
G_TYPE_NONE, 2,
|
||||
CLUTTER_TYPE_STAGE_VIEW,
|
||||
CLUTTER_TYPE_FRAME | G_SIGNAL_TYPE_STATIC_SCOPE);
|
||||
g_signal_set_va_marshaller (stage_signals[SKIPPED_PAINT],
|
||||
G_TYPE_FROM_CLASS (gobject_class),
|
||||
_clutter_marshal_VOID__OBJECT_BOXEDv);
|
||||
|
||||
/**
|
||||
* ClutterStage::after-update:
|
||||
* @stage: the #ClutterStage
|
||||
|
@ -66,6 +66,10 @@ struct _ClutterStageClass
|
||||
ClutterStageView *view,
|
||||
const MtkRegion *redraw_clip,
|
||||
ClutterFrame *frame);
|
||||
|
||||
void (* skipped_paint) (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
ClutterFrame *frame);
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user