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; GSource *source;
int64_t min_render_time_allowed_us; int64_t min_render_time_allowed_us;
int64_t target_presentation_time_us; int64_t target_presentation_time_us;
int64_t frame_deadline_us;
if (!META_IS_BACKEND_NATIVE (backend)) if (!META_IS_BACKEND_NATIVE (backend))
{ {
@ -316,10 +317,8 @@ on_after_update (ClutterStage *stage,
{ {
g_source_set_ready_time (source, -1); g_source_set_ready_time (source, -1);
emit_frame_callbacks_for_stage_view (compositor, stage_view); emit_frame_callbacks_for_stage_view (compositor, stage_view);
return;
} }
else
{
int64_t frame_deadline_us;
frame_deadline_us = target_presentation_time_us - frame_deadline_us = target_presentation_time_us -
min_render_time_allowed_us; min_render_time_allowed_us;
@ -328,15 +327,13 @@ on_after_update (ClutterStage *stage,
{ {
g_source_set_ready_time (source, -1); g_source_set_ready_time (source, -1);
emit_frame_callbacks_for_stage_view (compositor, stage_view); emit_frame_callbacks_for_stage_view (compositor, stage_view);
return;
} }
else
{
if (g_source_get_ready_time (source) != -1) if (g_source_get_ready_time (source) != -1)
return; return;
g_source_set_ready_time (source, frame_deadline_us); g_source_set_ready_time (source, frame_deadline_us);
}
}
#else #else
emit_frame_callbacks_for_stage_view (compositor, stage_view); emit_frame_callbacks_for_stage_view (compositor, stage_view);
#endif #endif