Add gtk_widget_add_tick_callback(), remove GtkTimeline, etc.

Add a very simple GtkWidget function for an "tick" callback, which
is connected to the ::update signal of GdkFrameClock.

Remove:

 - GtkTimeline. The consensus is that it is too complex.
 - GdkPaintClockTarget. In the rare cases where tick callbacks
    aren't sufficient, it's possible to track the
    paint clock with ::realize/::unrealize/::hierarchy-changed.

GtkTimeline is kept using ::update directly to allow using a GtkTimeline
with a paint clock but no widget.
This commit is contained in:
Owen W. Taylor
2012-12-19 12:03:16 -05:00
parent 06c4598fc5
commit 449e8c8856
11 changed files with 389 additions and 1194 deletions

View File

@ -86,6 +86,21 @@ typedef GdkRectangle GtkAllocation;
typedef void (*GtkCallback) (GtkWidget *widget,
gpointer data);
/**
* GtkTickCallback:
* @widget: the widget
* @frame_clock: the frame clock for the widget (same as calling gtk_widget_get_frame_clock())
* @user_data: user data passed to gtk_widget_add_tick_callback().
*
* Callback type for adding a function to update animations. See gtk_widget_add_tick_callback().
*
* Returns: %TRUE if the tick callback should continue to be called,
* %FALSE if the tick callback should be removed.
*/
typedef gboolean (*GtkTickCallback) (GtkWidget *widget,
GdkFrameClock *frame_clock,
gpointer user_data);
/**
* GtkRequisition:
* @width: the widget's desired width
@ -905,12 +920,17 @@ void gtk_widget_insert_action_group (GtkWidg
const gchar *name,
GActionGroup *group);
GDK_AVAILABLE_IN_3_2
void gtk_widget_add_frame_clock_target (GtkWidget *widget,
GdkFrameClockTarget *target);
GDK_AVAILABLE_IN_3_2
void gtk_widget_remove_frame_clock_target (GtkWidget *widget,
GdkFrameClockTarget *target);
GDK_AVAILABLE_IN_3_8
guint gtk_widget_add_tick_callback (GtkWidget *widget,
GtkTickCallback callback,
gpointer user_data,
GDestroyNotify notify);
GDK_AVAILABLE_IN_3_8
void gtk_widget_remove_tick_callback (GtkWidget *widget,
guint id);
G_END_DECLS