mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
clutter/actor: Add API to pick frame clock
The frame clock wouldn't be useable yet, but none the less, add API to get the frame clock best suited for driving the actor. Currently this translates to the fastest one, but that might change. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
This commit is contained in:
parent
3aff755048
commit
f9eb140e62
@ -652,6 +652,7 @@
|
|||||||
#include "clutter-scriptable.h"
|
#include "clutter-scriptable.h"
|
||||||
#include "clutter-script-private.h"
|
#include "clutter-script-private.h"
|
||||||
#include "clutter-stage-private.h"
|
#include "clutter-stage-private.h"
|
||||||
|
#include "clutter-stage-view-private.h"
|
||||||
#include "clutter-timeline.h"
|
#include "clutter-timeline.h"
|
||||||
#include "clutter-transition.h"
|
#include "clutter-transition.h"
|
||||||
#include "clutter-units.h"
|
#include "clutter-units.h"
|
||||||
@ -16250,6 +16251,40 @@ clutter_actor_peek_stage_views (ClutterActor *self)
|
|||||||
return self->priv->stage_views;
|
return self->priv->stage_views;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_actor_pick_frame_clock:
|
||||||
|
* @self: a #ClutterActor
|
||||||
|
*
|
||||||
|
* Pick the most suitable frame clock for driving animations for this actor.
|
||||||
|
*
|
||||||
|
* Returns: (transfer none): a #ClutterFrameClock
|
||||||
|
*/
|
||||||
|
ClutterFrameClock *
|
||||||
|
clutter_actor_pick_frame_clock (ClutterActor *self)
|
||||||
|
{
|
||||||
|
float max_refresh_rate = 0.0;
|
||||||
|
ClutterStageView *best_view = NULL;
|
||||||
|
GList *l;
|
||||||
|
|
||||||
|
for (l = self->priv->stage_views; l; l = l->next)
|
||||||
|
{
|
||||||
|
ClutterStageView *view = l->data;
|
||||||
|
float refresh_rate;
|
||||||
|
|
||||||
|
refresh_rate = clutter_stage_view_get_refresh_rate (view);
|
||||||
|
if (refresh_rate > max_refresh_rate)
|
||||||
|
{
|
||||||
|
best_view = view;
|
||||||
|
max_refresh_rate = refresh_rate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (best_view)
|
||||||
|
return clutter_stage_view_get_frame_clock (best_view);
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_actor_has_overlaps:
|
* clutter_actor_has_overlaps:
|
||||||
* @self: A #ClutterActor
|
* @self: A #ClutterActor
|
||||||
|
@ -924,6 +924,9 @@ GList * clutter_actor_peek_stage_views (ClutterActor *self);
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_actor_invalidate_transform (ClutterActor *self);
|
void clutter_actor_invalidate_transform (ClutterActor *self);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
ClutterFrameClock * clutter_actor_pick_frame_clock (ClutterActor *self);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __CLUTTER_ACTOR_H__ */
|
#endif /* __CLUTTER_ACTOR_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user