wayland: Flatten logic in on_after_update()

Slightly improves the cognitive complexity of the function.

No change in behavior.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3521>
This commit is contained in:
Dor Askayo 2023-09-25 12:41:48 +03:00
parent 26d8b9c69b
commit d5c2f20d55

View File

@ -297,6 +297,7 @@ on_after_update (ClutterStage *stage,
GSource *source;
int64_t min_render_time_allowed_us;
int64_t target_presentation_time_us;
int64_t frame_deadline_us;
if (!META_IS_BACKEND_NATIVE (backend))
{
@ -316,27 +317,23 @@ on_after_update (ClutterStage *stage,
{
g_source_set_ready_time (source, -1);
emit_frame_callbacks_for_stage_view (compositor, stage_view);
return;
}
else
frame_deadline_us = target_presentation_time_us -
min_render_time_allowed_us;
if (frame_deadline_us <= g_get_monotonic_time ())
{
int64_t frame_deadline_us;
frame_deadline_us = target_presentation_time_us -
min_render_time_allowed_us;
if (frame_deadline_us <= g_get_monotonic_time ())
{
g_source_set_ready_time (source, -1);
emit_frame_callbacks_for_stage_view (compositor, stage_view);
}
else
{
if (g_source_get_ready_time (source) != -1)
return;
g_source_set_ready_time (source, frame_deadline_us);
}
g_source_set_ready_time (source, -1);
emit_frame_callbacks_for_stage_view (compositor, stage_view);
return;
}
if (g_source_get_ready_time (source) != -1)
return;
g_source_set_ready_time (source, frame_deadline_us);
#else
emit_frame_callbacks_for_stage_view (compositor, stage_view);
#endif