stage: Use macros for subclassing boilerplate

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
This commit is contained in:
Bilal Elmoussaoui 2023-11-11 19:35:12 +01:00
parent 62482c2ac0
commit d07056992b
3 changed files with 117 additions and 98 deletions

View File

@ -32,7 +32,6 @@
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterClone, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterInputDevice, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterScrollActor, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterStage, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterText, g_object_unref)
#endif /* __GI_SCANNER__ */

View File

@ -105,7 +105,7 @@ typedef struct _PointerDeviceEntry
GArray *event_emission_chain;
} PointerDeviceEntry;
struct _ClutterStagePrivate
typedef struct _ClutterStagePrivate
{
/* the stage implementation */
ClutterStageWindow *impl;
@ -136,7 +136,7 @@ struct _ClutterStagePrivate
GHashTable *touch_sequences;
guint actor_needs_immediate_relayout : 1;
};
} ClutterStagePrivate;
struct _ClutterGrab
{
@ -200,7 +200,8 @@ clutter_stage_get_preferred_width (ClutterActor *self,
gfloat *min_width_p,
gfloat *natural_width_p)
{
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
ClutterStagePrivate *priv =
clutter_stage_get_instance_private (CLUTTER_STAGE (self));
MtkRectangle geom;
if (priv->impl == NULL)
@ -221,7 +222,8 @@ clutter_stage_get_preferred_height (ClutterActor *self,
gfloat *min_height_p,
gfloat *natural_height_p)
{
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
ClutterStagePrivate *priv =
clutter_stage_get_instance_private (CLUTTER_STAGE (self));
MtkRectangle geom;
if (priv->impl == NULL)
@ -288,7 +290,8 @@ static void
clutter_stage_allocate (ClutterActor *self,
const ClutterActorBox *box)
{
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
ClutterStagePrivate *priv =
clutter_stage_get_instance_private (CLUTTER_STAGE (self));
ClutterActorBox alloc = CLUTTER_ACTOR_BOX_INIT_ZERO;
float new_width, new_height;
float width, height;
@ -339,7 +342,7 @@ setup_clip_frustum (ClutterStage *stage,
const MtkRectangle *clip,
graphene_frustum_t *frustum)
{
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
MtkRectangle geom;
graphene_point3d_t camera_position;
graphene_point3d_t p[4];
@ -472,7 +475,7 @@ clutter_stage_paint_view (ClutterStage *stage,
const MtkRegion *redraw_clip,
ClutterFrame *frame)
{
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
if (!priv->impl)
return;
@ -523,7 +526,7 @@ clutter_stage_after_update (ClutterStage *stage,
ClutterStageView *view,
ClutterFrame *frame)
{
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
g_signal_emit (stage, stage_signals[AFTER_UPDATE], 0, view, frame);
@ -542,7 +545,8 @@ clutter_stage_get_paint_volume (ClutterActor *self,
static void
clutter_stage_realize (ClutterActor *self)
{
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
ClutterStagePrivate *priv =
clutter_stage_get_instance_private (CLUTTER_STAGE (self));
gboolean is_realized;
g_assert (priv->impl != NULL);
@ -555,7 +559,8 @@ clutter_stage_realize (ClutterActor *self)
static void
clutter_stage_unrealize (ClutterActor *self)
{
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
ClutterStagePrivate *priv =
clutter_stage_get_instance_private (CLUTTER_STAGE (self));
/* and then unrealize the implementation */
g_assert (priv->impl != NULL);
@ -567,7 +572,8 @@ clutter_stage_unrealize (ClutterActor *self)
static void
clutter_stage_show (ClutterActor *self)
{
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
ClutterStagePrivate *priv =
clutter_stage_get_instance_private (CLUTTER_STAGE (self));
CLUTTER_ACTOR_CLASS (clutter_stage_parent_class)->show (self);
@ -598,7 +604,8 @@ clutter_stage_hide_all (ClutterActor *self)
static void
clutter_stage_hide (ClutterActor *self)
{
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
ClutterStagePrivate *priv =
clutter_stage_get_instance_private (CLUTTER_STAGE (self));
g_assert (priv->impl != NULL);
_clutter_stage_window_hide (priv->impl);
@ -610,7 +617,7 @@ static void
clutter_stage_emit_key_focus_event (ClutterStage *stage,
gboolean focus_in)
{
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
if (priv->key_focused_actor == NULL)
return;
@ -641,7 +648,7 @@ _clutter_stage_queue_event (ClutterStage *stage,
g_return_if_fail (CLUTTER_IS_STAGE (stage));
priv = stage->priv;
priv = clutter_stage_get_instance_private (stage);
g_queue_push_tail (priv->event_queue,
copy_event ? clutter_event_copy (event) : event);
@ -699,7 +706,7 @@ _clutter_stage_process_queued_events (ClutterStage *stage)
COGL_TRACE_BEGIN_SCOPED (ProcessQueuedEvents, "Clutter::Stage::process_queued_events()");
priv = stage->priv;
priv = clutter_stage_get_instance_private (stage);
if (priv->event_queue->length == 0)
return;
@ -710,7 +717,7 @@ _clutter_stage_process_queued_events (ClutterStage *stage)
/* Steal events before starting processing to avoid reentrancy
* issues */
events = priv->event_queue->head;
priv->event_queue->head = NULL;
priv->event_queue->head = NULL;
priv->event_queue->tail = NULL;
priv->event_queue->length = 0;
@ -801,7 +808,7 @@ void
clutter_stage_queue_actor_relayout (ClutterStage *stage,
ClutterActor *actor)
{
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
clutter_stage_schedule_update (stage);
@ -813,7 +820,7 @@ void
clutter_stage_dequeue_actor_relayout (ClutterStage *stage,
ClutterActor *actor)
{
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
GSList *l;
for (l = priv->pending_relayouts; l; l = l->next)
@ -848,7 +855,7 @@ void
clutter_stage_maybe_relayout (ClutterActor *actor)
{
ClutterStage *stage = CLUTTER_STAGE (actor);
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
g_autoptr (GSList) stolen_list = NULL;
GSList *l;
int count = 0;
@ -898,7 +905,7 @@ GSList *
clutter_stage_find_updated_devices (ClutterStage *stage,
ClutterStageView *view)
{
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
GSList *updating = NULL;
GHashTableIter iter;
gpointer value;
@ -927,7 +934,7 @@ void
clutter_stage_finish_layout (ClutterStage *stage)
{
ClutterActor *actor = CLUTTER_ACTOR (stage);
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
int phase;
COGL_TRACE_BEGIN_SCOPED (ClutterStageUpdateActorStageViews,
@ -961,7 +968,7 @@ void
clutter_stage_update_devices (ClutterStage *stage,
GSList *devices)
{
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
GSList *l;
COGL_TRACE_BEGIN_SCOPED (ClutterStageUpdateDevices, "Clutter::Stage::update_devices()");
@ -1020,7 +1027,7 @@ setup_ray_for_coordinates (ClutterStage *stage,
graphene_point3d_t *point,
graphene_ray_t *ray)
{
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
graphene_point3d_t camera_position;
graphene_point3d_t p;
graphene_vec3_t direction;
@ -1080,7 +1087,7 @@ clutter_stage_get_view_at (ClutterStage *stage,
float x,
float y)
{
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
GList *l;
for (l = _clutter_stage_window_get_views (priv->impl); l; l = l->next)
@ -1107,11 +1114,11 @@ _clutter_stage_do_pick (ClutterStage *stage,
MtkRegion **clear_area)
{
ClutterActor *actor = CLUTTER_ACTOR (stage);
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
float stage_width, stage_height;
ClutterStageView *view = NULL;
priv = stage->priv;
priv = clutter_stage_get_instance_private (stage);
if (CLUTTER_ACTOR_IN_DESTRUCTION (stage))
return actor;
@ -1137,7 +1144,8 @@ static void
clutter_stage_real_apply_transform (ClutterActor *stage,
graphene_matrix_t *matrix)
{
ClutterStagePrivate *priv = CLUTTER_STAGE (stage)->priv;
ClutterStagePrivate *priv =
clutter_stage_get_instance_private (CLUTTER_STAGE (stage));
/* FIXME: we probably shouldn't be explicitly resetting the matrix
* here... */
@ -1188,7 +1196,8 @@ clutter_stage_get_property (GObject *gobject,
GValue *value,
GParamSpec *pspec)
{
ClutterStagePrivate *priv = CLUTTER_STAGE (gobject)->priv;
ClutterStagePrivate *priv =
clutter_stage_get_instance_private (CLUTTER_STAGE (gobject));
switch (prop_id)
{
@ -1218,7 +1227,7 @@ static void
clutter_stage_dispose (GObject *object)
{
ClutterStage *stage = CLUTTER_STAGE (object);
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
ClutterStageManager *stage_manager;
clutter_actor_hide (CLUTTER_ACTOR (object));
@ -1256,7 +1265,7 @@ static void
clutter_stage_finalize (GObject *object)
{
ClutterStage *stage = CLUTTER_STAGE (object);
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
g_queue_foreach (priv->event_queue, (GFunc) clutter_event_free, NULL);
g_queue_free (priv->event_queue);
@ -1629,7 +1638,7 @@ clutter_stage_init (ClutterStage *self)
/* a stage is a top-level object */
CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IS_TOPLEVEL);
self->priv = priv = clutter_stage_get_instance_private (self);
priv = clutter_stage_get_instance_private (self);
CLUTTER_NOTE (BACKEND, "Creating stage from the default backend");
backend = clutter_get_default_backend ();
@ -1683,7 +1692,7 @@ static void
clutter_stage_set_perspective (ClutterStage *stage,
ClutterPerspective *perspective)
{
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
if (priv->perspective.fovy == perspective->fovy &&
priv->perspective.aspect == perspective->aspect &&
@ -1717,10 +1726,13 @@ void
clutter_stage_get_perspective (ClutterStage *stage,
ClutterPerspective *perspective)
{
ClutterStagePrivate *priv;
g_return_if_fail (CLUTTER_IS_STAGE (stage));
g_return_if_fail (perspective != NULL);
*perspective = stage->priv->perspective;
priv = clutter_stage_get_instance_private (stage);
*perspective = priv->perspective;
}
/*
@ -1737,10 +1749,13 @@ void
_clutter_stage_get_projection_matrix (ClutterStage *stage,
graphene_matrix_t *projection)
{
ClutterStagePrivate *priv;
g_return_if_fail (CLUTTER_IS_STAGE (stage));
g_return_if_fail (projection != NULL);
*projection = stage->priv->projection;
priv = clutter_stage_get_instance_private (stage);
*projection = priv->projection;
}
/* This simply provides a simple mechanism for us to ensure that
@ -1755,7 +1770,7 @@ _clutter_stage_dirty_projection (ClutterStage *stage)
g_return_if_fail (CLUTTER_IS_STAGE (stage));
priv = stage->priv;
priv = clutter_stage_get_instance_private (stage);
for (l = _clutter_stage_window_get_views (priv->impl); l; l = l->next)
{
@ -1808,7 +1823,7 @@ clutter_stage_set_viewport (ClutterStage *stage,
g_return_if_fail (CLUTTER_IS_STAGE (stage));
priv = stage->priv;
priv = clutter_stage_get_instance_private (stage);
x = 0.f;
y = 0.f;
@ -1844,7 +1859,7 @@ _clutter_stage_dirty_viewport (ClutterStage *stage)
g_return_if_fail (CLUTTER_IS_STAGE (stage));
priv = stage->priv;
priv = clutter_stage_get_instance_private (stage);
for (l = _clutter_stage_window_get_views (priv->impl); l; l = l->next)
{
@ -1882,7 +1897,7 @@ _clutter_stage_get_viewport (ClutterStage *stage,
g_return_if_fail (CLUTTER_IS_STAGE (stage));
priv = stage->priv;
priv = clutter_stage_get_instance_private (stage);
*x = priv->viewport[0];
*y = priv->viewport[1];
@ -1933,7 +1948,7 @@ clutter_stage_read_pixels (ClutterStage *stage,
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
priv = stage->priv;
priv = clutter_stage_get_instance_private (stage);
clutter_actor_get_allocation_box (CLUTTER_ACTOR (stage), &box);
@ -2026,7 +2041,7 @@ clutter_stage_set_title (ClutterStage *stage,
g_return_if_fail (CLUTTER_IS_STAGE (stage));
priv = stage->priv;
priv = clutter_stage_get_instance_private (stage);
g_free (priv->title);
priv->title = g_strdup (title);
@ -2051,9 +2066,12 @@ clutter_stage_set_title (ClutterStage *stage,
const gchar *
clutter_stage_get_title (ClutterStage *stage)
{
ClutterStagePrivate *priv;
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
return stage->priv->title;
priv = clutter_stage_get_instance_private (stage);
return priv->title;
}
/**
@ -2074,7 +2092,7 @@ clutter_stage_set_key_focus (ClutterStage *stage,
g_return_if_fail (CLUTTER_IS_STAGE (stage));
g_return_if_fail (actor == NULL || CLUTTER_IS_ACTOR (actor));
priv = stage->priv;
priv = clutter_stage_get_instance_private (stage);
/* normalize the key focus. NULL == stage */
if (actor == CLUTTER_ACTOR (stage))
@ -2139,10 +2157,13 @@ clutter_stage_set_key_focus (ClutterStage *stage,
ClutterActor *
clutter_stage_get_key_focus (ClutterStage *stage)
{
ClutterStagePrivate *priv;
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
if (stage->priv->key_focused_actor)
return stage->priv->key_focused_actor;
priv = clutter_stage_get_instance_private (stage);
if (priv->key_focused_actor)
return priv->key_focused_actor;
return CLUTTER_ACTOR (stage);
}
@ -2365,7 +2386,7 @@ view_2d_in_perspective (graphene_matrix_t *matrix,
static void
clutter_stage_update_view_perspective (ClutterStage *stage)
{
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
ClutterPerspective perspective;
float z_2d;
@ -2401,7 +2422,7 @@ void
_clutter_stage_maybe_setup_viewport (ClutterStage *stage,
ClutterStageView *view)
{
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
if (clutter_stage_view_is_dirty_viewport (view))
{
@ -2456,21 +2477,29 @@ void
_clutter_stage_set_window (ClutterStage *stage,
ClutterStageWindow *stage_window)
{
ClutterStagePrivate *priv;
g_return_if_fail (CLUTTER_IS_STAGE (stage));
g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (stage_window));
if (stage->priv->impl != NULL)
g_object_unref (stage->priv->impl);
priv = clutter_stage_get_instance_private (stage);
stage->priv->impl = stage_window;
if (priv->impl != NULL)
g_object_unref (priv->impl);
priv->impl = stage_window;
}
ClutterStageWindow *
_clutter_stage_get_window (ClutterStage *stage)
{
ClutterStagePrivate *priv;
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
return CLUTTER_STAGE_WINDOW (stage->priv->impl);
priv = clutter_stage_get_instance_private (stage);
return CLUTTER_STAGE_WINDOW (priv->impl);
}
/**
@ -2482,7 +2511,7 @@ _clutter_stage_get_window (ClutterStage *stage)
void
clutter_stage_schedule_update (ClutterStage *stage)
{
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
ClutterStageWindow *stage_window;
gboolean first_event;
GList *l;
@ -2660,7 +2689,7 @@ clutter_stage_paint_to_framebuffer (ClutterStage *stage,
float scale,
ClutterPaintFlag paint_flags)
{
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
ClutterPaintContext *paint_context;
g_autoptr (MtkRegion) redraw_clip = NULL;
@ -2876,7 +2905,7 @@ clutter_stage_capture_view_into (ClutterStage *stage,
GList *
clutter_stage_peek_stage_views (ClutterStage *stage)
{
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
return _clutter_stage_window_get_views (priv->impl);
}
@ -2891,7 +2920,7 @@ GList *
clutter_stage_get_views_for_rect (ClutterStage *stage,
const graphene_rect_t *rect)
{
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
GList *views_for_rect = NULL;
GList *l;
@ -2914,7 +2943,7 @@ clutter_stage_get_views_for_rect (ClutterStage *stage,
void
clutter_stage_set_actor_needs_immediate_relayout (ClutterStage *stage)
{
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
priv->actor_needs_immediate_relayout = TRUE;
}
@ -2923,7 +2952,7 @@ void
clutter_stage_maybe_invalidate_focus (ClutterStage *self,
ClutterActor *actor)
{
ClutterStagePrivate *priv = self->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (self);
GHashTableIter iter;
gpointer value;
@ -3004,7 +3033,7 @@ clutter_stage_update_device_entry (ClutterStage *self,
ClutterActor *actor,
MtkRegion *clear_area)
{
ClutterStagePrivate *priv = self->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (self);
PointerDeviceEntry *entry = NULL;
g_assert (device != NULL);
@ -3057,7 +3086,7 @@ clutter_stage_remove_device_entry (ClutterStage *self,
ClutterInputDevice *device,
ClutterEventSequence *sequence)
{
ClutterStagePrivate *priv = self->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (self);
gboolean removed;
g_assert (device != NULL);
@ -3086,7 +3115,7 @@ clutter_stage_get_device_actor (ClutterStage *stage,
ClutterInputDevice *device,
ClutterEventSequence *sequence)
{
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
PointerDeviceEntry *entry = NULL;
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
@ -3112,7 +3141,7 @@ clutter_stage_get_device_coords (ClutterStage *stage,
ClutterEventSequence *sequence,
graphene_point_t *coords)
{
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
PointerDeviceEntry *entry = NULL;
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
@ -3138,7 +3167,7 @@ clutter_stage_set_device_coords (ClutterStage *stage,
ClutterEventSequence *sequence,
graphene_point_t coords)
{
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
PointerDeviceEntry *entry = NULL;
if (sequence != NULL)
@ -3201,7 +3230,7 @@ create_event_emission_chain (ClutterStage *stage,
ClutterActor *topmost,
ClutterActor *deepmost)
{
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
int i;
g_assert (priv->cur_event_actors->len == 0);
@ -3283,7 +3312,7 @@ clutter_stage_emit_crossing_event (ClutterStage *self,
ClutterActor *deepmost,
ClutterActor *topmost)
{
ClutterStagePrivate *priv = self->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (self);
ClutterInputDevice *device = clutter_event_get_device (event);
ClutterEventSequence *sequence = clutter_event_get_event_sequence (event);
PointerDeviceEntry *entry;
@ -3510,7 +3539,7 @@ clutter_stage_check_in_clear_area (ClutterStage *stage,
ClutterEventSequence *sequence,
graphene_point_t point)
{
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
PointerDeviceEntry *entry = NULL;
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
@ -3599,7 +3628,7 @@ clutter_stage_notify_grab_on_pointer_entry (ClutterStage *stage,
unsigned int implicit_grab_n_removed = 0, implicit_grab_n_remaining = 0;
ClutterEventType event_type = CLUTTER_NOTHING;
ClutterActor *topmost, *deepmost;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
if (!entry->current_actor)
return;
@ -3665,7 +3694,7 @@ clutter_stage_notify_grab_on_pointer_entry (ClutterStage *stage,
"[grab=%p device=%p sequence=%p implicit_grab_cancelled=%d] "
"Cancelled %u actors and actions (%u remaining) on implicit "
"grab due to new seat grab",
stage->priv->topmost_grab, device, sequence, implicit_grab_cancelled,
priv->topmost_grab, device, sequence, implicit_grab_cancelled,
implicit_grab_n_removed, implicit_grab_n_remaining);
}
@ -3767,12 +3796,12 @@ clutter_stage_notify_grab_on_key_focus (ClutterStage *stage,
ClutterActor *grab_actor,
ClutterActor *old_grab_actor)
{
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
ClutterActor *key_focus;
gboolean focus_in_grab, focus_in_old_grab;
key_focus = priv->key_focused_actor ?
priv->key_focused_actor : CLUTTER_ACTOR (stage);
priv->key_focused_actor : CLUTTER_ACTOR (stage);
focus_in_grab =
!grab_actor ||
@ -3794,7 +3823,7 @@ clutter_stage_notify_grab (ClutterStage *stage,
ClutterGrab *cur,
ClutterGrab *old)
{
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
ClutterActor *cur_actor = NULL, *old_actor = NULL;
PointerDeviceEntry *entry;
GHashTableIter iter;
@ -3884,7 +3913,7 @@ clutter_stage_grab_full (ClutterStage *stage,
(ClutterStage *) _clutter_actor_get_stage_internal (actor),
NULL);
priv = stage->priv;
priv = clutter_stage_get_instance_private (stage);
if (!priv->topmost_grab)
{
@ -3973,7 +4002,7 @@ void
clutter_stage_unlink_grab (ClutterStage *stage,
ClutterGrab *grab)
{
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
ClutterGrab *prev, *next;
gboolean was_grabbed;
@ -4064,9 +4093,12 @@ clutter_grab_dismiss (ClutterGrab *grab)
ClutterGrabState
clutter_grab_get_seat_state (ClutterGrab *grab)
{
ClutterStagePrivate *priv;
g_return_val_if_fail (grab != NULL, CLUTTER_GRAB_STATE_NONE);
return grab->stage->priv->grab_state;
priv = clutter_stage_get_instance_private (grab->stage);
return priv->grab_state;
}
/**
@ -4080,7 +4112,7 @@ clutter_grab_get_seat_state (ClutterGrab *grab)
ClutterActor *
clutter_stage_get_grab_actor (ClutterStage *stage)
{
ClutterStagePrivate *priv = stage->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (stage);
if (!priv->topmost_grab)
return NULL;
@ -4250,7 +4282,7 @@ clutter_stage_maybe_lost_implicit_grab (ClutterStage *self,
ClutterInputDevice *device,
ClutterEventSequence *sequence)
{
ClutterStagePrivate *priv = self->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (self);
PointerDeviceEntry *entry = NULL;
unsigned int i;
@ -4286,7 +4318,7 @@ void
clutter_stage_emit_event (ClutterStage *self,
const ClutterEvent *event)
{
ClutterStagePrivate *priv = self->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (self);
ClutterInputDevice *device = clutter_event_get_device (event);
ClutterEventSequence *sequence = clutter_event_get_event_sequence (event);
PointerDeviceEntry *entry;
@ -4461,7 +4493,7 @@ void
clutter_stage_implicit_grab_actor_unmapped (ClutterStage *self,
ClutterActor *actor)
{
ClutterStagePrivate *priv = self->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (self);
GHashTableIter iter;
PointerDeviceEntry *entry;
@ -4485,7 +4517,7 @@ clutter_stage_notify_action_implicit_grab (ClutterStage *self,
ClutterInputDevice *device,
ClutterEventSequence *sequence)
{
ClutterStagePrivate *priv = self->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (self);
PointerDeviceEntry *entry;
if (sequence != NULL)
@ -4513,7 +4545,7 @@ clutter_stage_pointing_input_foreach (ClutterStage *self,
ClutterStageInputForeachFunc func,
gpointer user_data)
{
ClutterStagePrivate *priv = self->priv;
ClutterStagePrivate *priv = clutter_stage_get_instance_private (self);
GHashTableIter iter;
PointerDeviceEntry *entry;

View File

@ -35,24 +35,14 @@
G_BEGIN_DECLS
#define CLUTTER_TYPE_STAGE (clutter_stage_get_type())
#define CLUTTER_TYPE_STAGE (clutter_stage_get_type ())
#define CLUTTER_STAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_STAGE, ClutterStage))
#define CLUTTER_STAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_STAGE, ClutterStageClass))
#define CLUTTER_IS_STAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_STAGE))
#define CLUTTER_IS_STAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_STAGE))
#define CLUTTER_STAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_STAGE, ClutterStageClass))
typedef struct _ClutterStageClass ClutterStageClass;
typedef struct _ClutterStagePrivate ClutterStagePrivate;
struct _ClutterStage
{
/*< private >*/
ClutterActor parent_instance;
ClutterStagePrivate *priv;
};
CLUTTER_EXPORT
G_DECLARE_DERIVABLE_TYPE (ClutterStage,
clutter_stage,
CLUTTER,
STAGE,
ClutterActor)
/**
* ClutterStageClass:
* @activate: handler for the #ClutterStage::activate signal
@ -143,8 +133,6 @@ struct _ClutterFrameInfo
CLUTTER_EXPORT
GType clutter_perspective_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
GType clutter_stage_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
void clutter_stage_get_perspective (ClutterStage *stage,