compositor: refactor to weston_output_schedule_repaint_reset()

No functional changes.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
diff --git a/src/compositor.c b/src/compositor.c
index c40f3eb..7085053 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -2131,15 +2131,33 @@
 	return 1;
 }
 
+static void
+weston_output_schedule_repaint_reset(struct weston_output *output)
+{
+	struct weston_compositor *compositor = output->compositor;
+	struct wl_event_loop *loop;
+	int fd;
+
+	output->repaint_scheduled = 0;
+	TL_POINT("core_repaint_exit_loop", TLP_OUTPUT(output), TLP_END);
+
+	if (compositor->input_loop_source)
+		return;
+
+	loop = wl_display_get_event_loop(compositor->wl_display);
+	fd = wl_event_loop_get_fd(compositor->input_loop);
+	compositor->input_loop_source =
+		wl_event_loop_add_fd(loop, fd, WL_EVENT_READABLE,
+				     weston_compositor_read_input, compositor);
+}
+
 WL_EXPORT void
 weston_output_finish_frame(struct weston_output *output,
 			   const struct timespec *stamp,
 			   uint32_t presented_flags)
 {
 	struct weston_compositor *compositor = output->compositor;
-	struct wl_event_loop *loop =
-		wl_display_get_event_loop(compositor->wl_display);
-	int fd, r;
+	int r;
 	uint32_t refresh_nsec;
 
 	TL_POINT("core_repaint_finished", TLP_OUTPUT(output),
@@ -2161,16 +2179,7 @@
 			return;
 	}
 
-	output->repaint_scheduled = 0;
-	TL_POINT("core_repaint_exit_loop", TLP_OUTPUT(output), TLP_END);
-
-	if (compositor->input_loop_source)
-		return;
-
-	fd = wl_event_loop_get_fd(compositor->input_loop);
-	compositor->input_loop_source =
-		wl_event_loop_add_fd(loop, fd, WL_EVENT_READABLE,
-				     weston_compositor_read_input, compositor);
+	weston_output_schedule_repaint_reset(output);
 }
 
 static void