mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 18:11:05 -05:00
clutter/frame: Turn into boxed type
This will allow us to pass a ClutterFrame in interfaces, including ones that end up being introspected. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2795>
This commit is contained in:
parent
56da8418f9
commit
c54b350313
@ -731,7 +731,7 @@ clutter_frame_clock_dispatch (ClutterFrameClock *frame_clock,
|
||||
|
||||
frame_count = frame_clock->frame_count++;
|
||||
|
||||
frame = g_new0 (ClutterFrame, 1);
|
||||
frame = clutter_frame_new ();
|
||||
frame->frame_count = frame_count;
|
||||
frame->has_target_presentation_time = frame_clock->is_next_presentation_time_valid;
|
||||
frame->target_presentation_time_us = frame_clock->next_presentation_time_us;
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
struct _ClutterFrame
|
||||
{
|
||||
grefcount ref_count;
|
||||
|
||||
int64_t frame_count;
|
||||
|
||||
gboolean has_target_presentation_time;
|
||||
@ -31,6 +33,9 @@ struct _ClutterFrame
|
||||
ClutterFrameResult result;
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterFrame * clutter_frame_new (void);
|
||||
|
||||
ClutterFrameResult clutter_frame_get_result (ClutterFrame *frame);
|
||||
|
||||
#endif /* CLUTTER_FRAME_PRIVATE_H */
|
||||
|
@ -17,6 +17,35 @@
|
||||
|
||||
#include "clutter/clutter-frame-private.h"
|
||||
|
||||
G_DEFINE_BOXED_TYPE (ClutterFrame, clutter_frame,
|
||||
clutter_frame_ref,
|
||||
clutter_frame_unref)
|
||||
|
||||
ClutterFrame *
|
||||
clutter_frame_ref (ClutterFrame *frame)
|
||||
{
|
||||
g_ref_count_inc (&frame->ref_count);
|
||||
return frame;
|
||||
}
|
||||
|
||||
void
|
||||
clutter_frame_unref (ClutterFrame *frame)
|
||||
{
|
||||
if (g_ref_count_dec (&frame->ref_count))
|
||||
g_free (frame);
|
||||
}
|
||||
|
||||
ClutterFrame *
|
||||
clutter_frame_new (void)
|
||||
{
|
||||
ClutterFrame *frame;
|
||||
|
||||
frame = g_new0 (ClutterFrame, 1);
|
||||
g_ref_count_init (&frame->ref_count);
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
int64_t
|
||||
clutter_frame_get_count (ClutterFrame *frame)
|
||||
{
|
||||
|
@ -26,6 +26,17 @@
|
||||
|
||||
typedef struct _ClutterFrame ClutterFrame;
|
||||
|
||||
#define CLUTTER_TYPE_FRAME (clutter_frame_get_type ())
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_frame_get_type (void);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterFrame * clutter_frame_ref (ClutterFrame *frame);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_frame_unref (ClutterFrame *frame);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
int64_t clutter_frame_get_count (ClutterFrame *frame);
|
||||
|
||||
@ -40,6 +51,6 @@ void clutter_frame_set_result (ClutterFrame *frame,
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_frame_has_result (ClutterFrame *frame);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterFrame, g_free)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterFrame, clutter_frame_unref)
|
||||
|
||||
#endif /* CLUTTER_FRAME_H */
|
||||
|
Loading…
Reference in New Issue
Block a user