[gtk+] GdkFrameClock: Clean up the public API
- From: Owen Taylor <otaylor src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GdkFrameClock: Clean up the public API
- Date: Thu, 14 Feb 2013 22:26:28 +0000 (UTC)
commit bb11195ec06e24a58a3f3d7b9b11381e588a7d64
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Tue Feb 12 15:03:21 2013 -0500
GdkFrameClock: Clean up the public API
* remove gdk_frame_clock_get_frame_time_val(); a convenience
function that would rarely be used.
* remove gdk_frame_clock_get_requested() and
::frame-requested signal; while we might want to eventually
be able to track the requested phases for a clock, we don't
have a current use case.
* Make gdk_frame_clock_freeze/thaw() private: they are only
used within GTK+ and have complex semantics.
* Remove gdk_frame_clock_get_last_complete(). Another convenience
function that I don't have a current use case for.
* Rename:
gdk_frame_clock_get_start() => gdk_frame_clock_get_history_start()
gdk_frame_clocK_get_current_frame_timings() => gdk_frame_clock_get_timings()
gdk/gdkframeclock.c | 87 ++------------------------------------------
gdk/gdkframeclock.h | 13 +------
gdk/gdkframeclockidle.c | 15 +-------
gdk/gdkframeclockprivate.h | 15 ++++----
gdk/gdkwindow.c | 4 +-
gdk/x11/gdkdisplay-x11.c | 6 ++--
gdk/x11/gdkwindow-x11.c | 6 ++--
tests/video-timer.c | 6 ++--
8 files changed, 27 insertions(+), 125 deletions(-)
---
diff --git a/gdk/gdkframeclock.c b/gdk/gdkframeclock.c
index b8ab15c..4c5bd51 100644
--- a/gdk/gdkframeclock.c
+++ b/gdk/gdkframeclock.c
@@ -78,7 +78,6 @@
G_DEFINE_ABSTRACT_TYPE (GdkFrameClock, gdk_frame_clock, G_TYPE_OBJECT)
enum {
- FRAME_REQUESTED,
FLUSH_EVENTS,
BEFORE_PAINT,
UPDATE,
@@ -122,22 +121,6 @@ gdk_frame_clock_class_init (GdkFrameClockClass *klass)
gobject_class->finalize = gdk_frame_clock_finalize;
/**
- * GdkFrameClock::frame-requested:
- * @clock: the frame clock emitting the signal
- *
- * This signal is emitted when a frame is not pending, and
- * gdk_frame_clock_request_frame() is called to request a frame.
- */
- signals[FRAME_REQUESTED] =
- g_signal_new (g_intern_static_string ("frame-requested"),
- GDK_TYPE_FRAME_CLOCK,
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- /**
* GdkFrameClock::flush-events:
* @clock: the frame clock emitting the signal
*
@@ -319,7 +302,7 @@ gdk_frame_clock_request_phase (GdkFrameClock *clock,
void
-gdk_frame_clock_freeze (GdkFrameClock *clock)
+_gdk_frame_clock_freeze (GdkFrameClock *clock)
{
g_return_if_fail (GDK_IS_FRAME_CLOCK (clock));
@@ -328,55 +311,13 @@ gdk_frame_clock_freeze (GdkFrameClock *clock)
void
-gdk_frame_clock_thaw (GdkFrameClock *clock)
+_gdk_frame_clock_thaw (GdkFrameClock *clock)
{
g_return_if_fail (GDK_IS_FRAME_CLOCK (clock));
GDK_FRAME_CLOCK_GET_CLASS (clock)->thaw (clock);
}
-/**
- * gdk_frame_clock_get_requested:
- * @clock: the clock
- *
- * Gets whether a frame paint has been requested but has not been
- * performed.
- *
- *
- * Since: 3.0
- * Return value: TRUE if a frame paint is pending
- */
-GdkFrameClockPhase
-gdk_frame_clock_get_requested (GdkFrameClock *clock)
-{
- g_return_val_if_fail (GDK_IS_FRAME_CLOCK (clock), FALSE);
-
- return GDK_FRAME_CLOCK_GET_CLASS (clock)->get_requested (clock);
-}
-
-/**
- * gdk_frame_clock_get_frame_time_val:
- * @clock: the clock
- * @timeval: #GTimeVal to fill in with frame time
- *
- * Like gdk_frame_clock_get_frame_time() but returns the time as a
- * #GTimeVal which may be handy with some APIs (such as
- * #GdkPixbufAnimation).
- */
-void
-gdk_frame_clock_get_frame_time_val (GdkFrameClock *clock,
- GTimeVal *timeval)
-{
- guint64 time_ms;
-
- g_return_if_fail (GDK_IS_FRAME_CLOCK (clock));
-
- time_ms = gdk_frame_clock_get_frame_time (clock);
-
- timeval->tv_sec = time_ms / 1000;
- timeval->tv_usec = (time_ms % 1000) * 1000;
-}
-
gint64
gdk_frame_clock_get_frame_counter (GdkFrameClock *clock)
{
@@ -390,7 +331,7 @@ gdk_frame_clock_get_frame_counter (GdkFrameClock *clock)
}
gint64
-gdk_frame_clock_get_start (GdkFrameClock *clock)
+gdk_frame_clock_get_history_start (GdkFrameClock *clock)
{
GdkFrameClockPrivate *priv;
@@ -446,7 +387,7 @@ gdk_frame_clock_get_timings (GdkFrameClock *clock,
}
GdkFrameTimings *
-gdk_frame_clock_get_current_frame_timings (GdkFrameClock *clock)
+gdk_frame_clock_get_frame_timings (GdkFrameClock *clock)
{
GdkFrameClockPrivate *priv;
@@ -458,26 +399,6 @@ gdk_frame_clock_get_current_frame_timings (GdkFrameClock *clock)
}
-GdkFrameTimings *
-gdk_frame_clock_get_last_complete (GdkFrameClock *clock)
-{
- GdkFrameClockPrivate *priv;
- gint i;
-
- g_return_val_if_fail (GDK_IS_FRAME_CLOCK (clock), NULL);
-
- priv = clock->priv;
-
- for (i = 0; i < priv->n_timings; i++)
- {
- gint pos = ((priv->current - i) + FRAME_HISTORY_MAX_LENGTH) % FRAME_HISTORY_MAX_LENGTH;
- if (priv->timings[pos]->complete)
- return priv->timings[pos];
- }
-
- return NULL;
-}
-
#ifdef G_ENABLE_DEBUG
void
_gdk_frame_clock_debug_print_timings (GdkFrameClock *clock,
diff --git a/gdk/gdkframeclock.h b/gdk/gdkframeclock.h
index 3780615..11845ac 100644
--- a/gdk/gdkframeclock.h
+++ b/gdk/gdkframeclock.h
@@ -63,29 +63,20 @@ guint64 gdk_frame_clock_get_frame_time (GdkFrameClock *clock);
void gdk_frame_clock_request_phase (GdkFrameClock *clock,
GdkFrameClockPhase phase);
-GdkFrameClockPhase gdk_frame_clock_get_requested (GdkFrameClock *clock);
-
-void gdk_frame_clock_freeze (GdkFrameClock *clock);
-void gdk_frame_clock_thaw (GdkFrameClock *clock);
/* Frame history */
gint64 gdk_frame_clock_get_frame_counter (GdkFrameClock *clock);
-gint64 gdk_frame_clock_get_start (GdkFrameClock *clock);
+gint64 gdk_frame_clock_get_history_start (GdkFrameClock *clock);
GdkFrameTimings *gdk_frame_clock_get_timings (GdkFrameClock *clock,
gint64 frame_counter);
-GdkFrameTimings *gdk_frame_clock_get_last_complete (GdkFrameClock *clock);
-/* Convenience API */
-void gdk_frame_clock_get_frame_time_val (GdkFrameClock *clock,
- GTimeVal *timeval);
+GdkFrameTimings *gdk_frame_clock_get_current_timings (GdkFrameClock *clock);
void gdk_frame_clock_get_refresh_info (GdkFrameClock *clock,
gint64 base_time,
gint64 *refresh_interval_return,
gint64 *presentation_time_return);
-GdkFrameTimings *gdk_frame_clock_get_current_frame_timings (GdkFrameClock *clock);
-
G_END_DECLS
#endif /* __GDK_FRAME_CLOCK_H__ */
diff --git a/gdk/gdkframeclockidle.c b/gdk/gdkframeclockidle.c
index afb9430..5974e26 100644
--- a/gdk/gdkframeclockidle.c
+++ b/gdk/gdkframeclockidle.c
@@ -220,8 +220,6 @@ maybe_start_idle (GdkFrameClockIdle *clock_idle)
gdk_frame_clock_paint_idle,
g_object_ref (clock_idle),
(GDestroyNotify) g_object_unref);
-
- g_signal_emit_by_name (clock_idle, "frame-requested");
}
}
}
@@ -286,7 +284,7 @@ gdk_frame_clock_paint_idle (void *data)
if (priv->phase > GDK_FRAME_CLOCK_PHASE_BEFORE_PAINT)
{
- timings = gdk_frame_clock_get_current_frame_timings (clock);
+ timings = gdk_frame_clock_get_current_timings (clock);
}
if (!skip_to_resume_events)
@@ -302,7 +300,7 @@ gdk_frame_clock_paint_idle (void *data)
priv->frame_time = compute_frame_time (clock_idle);
_gdk_frame_clock_begin_frame (clock);
- timings = gdk_frame_clock_get_current_frame_timings (clock);
+ timings = gdk_frame_clock_get_current_timings (clock);
timings->frame_time = priv->frame_time;
timings->slept_before = priv->sleep_serial != get_sleep_serial ();
@@ -430,14 +428,6 @@ gdk_frame_clock_idle_request_phase (GdkFrameClock *clock,
maybe_start_idle (clock_idle);
}
-static GdkFrameClockPhase
-gdk_frame_clock_idle_get_requested (GdkFrameClock *clock)
-{
- GdkFrameClockIdlePrivate *priv = GDK_FRAME_CLOCK_IDLE (clock)->priv;
-
- return priv->requested;
-}
-
static void
gdk_frame_clock_idle_freeze (GdkFrameClock *clock)
{
@@ -492,7 +482,6 @@ gdk_frame_clock_idle_class_init (GdkFrameClockIdleClass *klass)
frame_clock_class->get_frame_time = gdk_frame_clock_idle_get_frame_time;
frame_clock_class->request_phase = gdk_frame_clock_idle_request_phase;
- frame_clock_class->get_requested = gdk_frame_clock_idle_get_requested;
frame_clock_class->freeze = gdk_frame_clock_idle_freeze;
frame_clock_class->thaw = gdk_frame_clock_idle_thaw;
diff --git a/gdk/gdkframeclockprivate.h b/gdk/gdkframeclockprivate.h
index c924550..262b327 100644
--- a/gdk/gdkframeclockprivate.h
+++ b/gdk/gdkframeclockprivate.h
@@ -47,17 +47,15 @@ struct _GdkFrameClockClass
{
GObjectClass parent_class;
- guint64 (* get_frame_time) (GdkFrameClock *clock);
+ guint64 (* get_frame_time) (GdkFrameClock *clock);
- void (* request_phase) (GdkFrameClock *clock,
- GdkFrameClockPhase phase);
- GdkFrameClockPhase (* get_requested) (GdkFrameClock *clock);
+ void (* request_phase) (GdkFrameClock *clock,
+ GdkFrameClockPhase phase);
- void (* freeze) (GdkFrameClock *clock);
- void (* thaw) (GdkFrameClock *clock);
+ void (* freeze) (GdkFrameClock *clock);
+ void (* thaw) (GdkFrameClock *clock);
/* signals */
- /* void (* frame_requested) (GdkFrameClock *clock); */
/* void (* flush_events) (GdkFrameClock *clock); */
/* void (* before_paint) (GdkFrameClock *clock); */
/* void (* update) (GdkFrameClock *clock); */
@@ -89,6 +87,9 @@ struct _GdkFrameTimings
guint slept_before : 1;
};
+void _gdk_frame_clock_freeze (GdkFrameClock *clock);
+void _gdk_frame_clock_thaw (GdkFrameClock *clock);
+
void _gdk_frame_clock_begin_frame (GdkFrameClock *clock);
void _gdk_frame_clock_debug_print_timings (GdkFrameClock *clock,
GdkFrameTimings *timings);
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index c626b2c..410eb16 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -4903,7 +4903,7 @@ gdk_window_freeze_toplevel_updates_libgtk_only (GdkWindow *window)
g_return_if_fail (window->window_type != GDK_WINDOW_CHILD);
window->update_and_descendants_freeze_count++;
- gdk_frame_clock_freeze (gdk_window_get_frame_clock (window));
+ _gdk_frame_clock_freeze (gdk_window_get_frame_clock (window));
}
/**
@@ -4924,7 +4924,7 @@ gdk_window_thaw_toplevel_updates_libgtk_only (GdkWindow *window)
g_return_if_fail (window->update_and_descendants_freeze_count > 0);
window->update_and_descendants_freeze_count--;
- gdk_frame_clock_thaw (gdk_window_get_frame_clock (window));
+ _gdk_frame_clock_thaw (gdk_window_get_frame_clock (window));
gdk_window_schedule_update (window);
}
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index 90a2eca..85b50a7 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -686,7 +686,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
window_impl->toplevel->frame_pending)
{
window_impl->toplevel->frame_pending = FALSE;
- gdk_frame_clock_thaw (gdk_window_get_frame_clock (event->any.window));
+ _gdk_frame_clock_thaw (gdk_window_get_frame_clock (event->any.window));
}
if (toplevel)
@@ -1064,7 +1064,7 @@ find_frame_timings (GdkFrameClock *clock,
{
gint64 start_frame, end_frame, i;
- start_frame = gdk_frame_clock_get_start (clock);
+ start_frame = gdk_frame_clock_get_history_start (clock);
end_frame = gdk_frame_clock_get_frame_counter (clock);
for (i = end_frame; i >= start_frame; i--)
{
@@ -1121,7 +1121,7 @@ _gdk_wm_protocols_filter (GdkXEvent *xev,
if (window_impl->toplevel->frame_pending)
{
window_impl->toplevel->frame_pending = FALSE;
- gdk_frame_clock_thaw (clock);
+ _gdk_frame_clock_thaw (clock);
}
gdk_frame_clock_get_refresh_info (clock,
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index edb8591..4f30287 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -291,7 +291,7 @@ gdk_x11_window_predict_presentation_time (GdkWindow *window)
clock = gdk_window_get_frame_clock (window);
- timings = gdk_frame_clock_get_current_frame_timings (clock);
+ timings = gdk_frame_clock_get_current_timings (clock);
gdk_frame_clock_get_refresh_info (clock,
timings->frame_time,
@@ -372,7 +372,7 @@ gdk_x11_window_end_frame (GdkWindow *window)
return;
clock = gdk_window_get_frame_clock (window);
- timings = gdk_frame_clock_get_current_frame_timings (clock);
+ timings = gdk_frame_clock_get_current_timings (clock);
impl->toplevel->in_frame = FALSE;
@@ -407,7 +407,7 @@ gdk_x11_window_end_frame (GdkWindow *window)
gdk_atom_intern_static_string ("_NET_WM_FRAME_DRAWN")))
{
impl->toplevel->frame_pending = TRUE;
- gdk_frame_clock_freeze (gdk_window_get_frame_clock (window));
+ _gdk_frame_clock_freeze (gdk_window_get_frame_clock (window));
timings->cookie = impl->toplevel->current_counter_value;
}
}
diff --git a/tests/video-timer.c b/tests/video-timer.c
index 69ae562..1ddc260 100644
--- a/tests/video-timer.c
+++ b/tests/video-timer.c
@@ -221,7 +221,7 @@ on_window_draw (GtkWidget *widget,
if (displayed_frame->frame_counter == 0)
{
GdkFrameClock *frame_clock = gtk_widget_get_frame_clock (window);
- displayed_frame->frame_counter = gdk_frame_clock_get_frame_counter (clock);
+ displayed_frame->frame_counter = gdk_frame_clock_get_frame_counter (frame_clock);
}
}
}
@@ -238,7 +238,7 @@ collect_old_frames (void)
gboolean remove = FALSE;
l_next = l->next;
- GdkFrameTimings *timings = gdk_frame_clock_get_timings (clock,
+ GdkFrameTimings *timings = gdk_frame_clock_get_timings (frame_clock,
frame_data->frame_counter);
if (timings == NULL)
{
@@ -303,7 +303,7 @@ static void
on_update (GdkFrameClock *frame_clock,
gpointer data)
{
- GdkFrameTimings *timings = gdk_frame_clock_get_current_frame_timings (frame_clock);
+ GdkFrameTimings *timings = gdk_frame_clock_get_current_timings (frame_clock);
gint64 frame_time = gdk_frame_timings_get_frame_time (timings);
gint64 predicted_presentation_time = gdk_frame_timings_get_predicted_presentation_time (timings);
gint64 refresh_interval;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]