Hide clutter_context_get_default()

The clutter_context_get_default() function is private, but shared
across Clutter. For this reason, it should be prefixed by '_' so
that the symbol is hidden from the shared object.
This commit is contained in:
Emmanuele Bassi 2009-06-17 17:59:54 +01:00
parent 8c676ebd87
commit c6fba47a52
18 changed files with 87 additions and 88 deletions

View File

@ -1432,7 +1432,7 @@ clutter_actor_should_pick_paint (ClutterActor *self)
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
context = clutter_context_get_default ();
context = _clutter_context_get_default ();
if (CLUTTER_ACTOR_IS_MAPPED (self) &&
(G_UNLIKELY (context->pick_mode == CLUTTER_PICK_ALL) ||
@ -2267,7 +2267,8 @@ clutter_actor_paint (ClutterActor *self)
g_return_if_fail (CLUTTER_IS_ACTOR (self));
priv = self->priv;
context = clutter_context_get_default ();
context = _clutter_context_get_default ();
/* It's an important optimization that we consider painting of
* actors with 0 opacity to be a NOP... */
@ -6463,15 +6464,11 @@ void
clutter_actor_set_parent (ClutterActor *self,
ClutterActor *parent)
{
ClutterMainContext *clutter_context;
ClutterActorPrivate *priv;
clutter_context = clutter_context_get_default ();
g_return_if_fail (CLUTTER_IS_ACTOR (self));
g_return_if_fail (CLUTTER_IS_ACTOR (parent));
g_return_if_fail (self != parent);
g_return_if_fail (clutter_context != NULL);
priv = self->priv;
@ -8341,7 +8338,7 @@ clutter_actor_shader_pre_paint (ClutterActor *actor,
if (!shader_data)
return;
context = clutter_context_get_default ();
context = _clutter_context_get_default ();
shader = shader_data->shader;
if (shader)
@ -8369,7 +8366,7 @@ clutter_actor_shader_post_paint (ClutterActor *actor)
if (!shader_data)
return;
context = clutter_context_get_default ();
context = _clutter_context_get_default ();
shader = shader_data->shader;
if (shader)

View File

@ -85,7 +85,7 @@ clutter_backend_dispose (GObject *gobject)
ClutterBackendPrivate *priv = CLUTTER_BACKEND (gobject)->priv;
ClutterMainContext *clutter_context;
clutter_context = clutter_context_get_default ();
clutter_context = _clutter_context_get_default ();
if (clutter_context && clutter_context->events_queue)
{
@ -270,7 +270,7 @@ _clutter_backend_create_stage (ClutterBackend *backend,
g_return_val_if_fail (CLUTTER_IS_BACKEND (backend), FALSE);
g_return_val_if_fail (CLUTTER_IS_STAGE (wrapper), FALSE);
context = clutter_context_get_default ();
context = _clutter_context_get_default ();
if (!context->stage_manager)
context->stage_manager = clutter_stage_manager_get_default ();
@ -394,7 +394,7 @@ _clutter_backend_init_events (ClutterBackend *backend)
ClutterBackendClass *klass;
ClutterMainContext *clutter_context;
clutter_context = clutter_context_get_default ();
clutter_context = _clutter_context_get_default ();
g_return_if_fail (CLUTTER_IS_BACKEND (backend));
g_return_if_fail (clutter_context != NULL);
@ -443,7 +443,7 @@ clutter_get_default_backend (void)
{
ClutterMainContext *clutter_context;
clutter_context = clutter_context_get_default ();
clutter_context = _clutter_context_get_default ();
return clutter_context->backend;
}

View File

@ -549,7 +549,7 @@ clutter_event_free (ClutterEvent *event)
ClutterEvent *
clutter_event_get (void)
{
ClutterMainContext *context = clutter_context_get_default ();
ClutterMainContext *context = _clutter_context_get_default ();
if (!context->events_queue)
return NULL;
@ -573,7 +573,7 @@ clutter_event_get (void)
ClutterEvent *
clutter_event_peek (void)
{
ClutterMainContext *context = clutter_context_get_default ();
ClutterMainContext *context = _clutter_context_get_default ();
g_return_val_if_fail (context != NULL, NULL);
@ -601,7 +601,7 @@ clutter_event_peek (void)
void
clutter_event_put (ClutterEvent *event)
{
ClutterMainContext *context = clutter_context_get_default ();
ClutterMainContext *context = _clutter_context_get_default ();
ClutterEvent *event_copy;
/* FIXME: check queue is valid */
@ -625,7 +625,7 @@ clutter_event_put (ClutterEvent *event)
gboolean
clutter_events_pending (void)
{
ClutterMainContext *context = clutter_context_get_default ();
ClutterMainContext *context = _clutter_context_get_default ();
g_return_val_if_fail (context != NULL, FALSE);
@ -648,7 +648,7 @@ clutter_events_pending (void)
guint32
clutter_get_current_event_time (void)
{
ClutterMainContext *context = clutter_context_get_default ();
ClutterMainContext *context = _clutter_context_get_default ();
g_return_val_if_fail (context != NULL, FALSE);

View File

@ -93,10 +93,10 @@ _clutter_feature_init (void)
if (__features->features_set)
return;
context = clutter_context_get_default ();
context = _clutter_context_get_default ();
__features->flags = (_clutter_features_from_cogl (cogl_get_features ())
| _clutter_backend_get_features (context->backend));
| _clutter_backend_get_features (context->backend));
__features->features_set = TRUE;

View File

@ -182,7 +182,7 @@ _clutter_do_redraw (ClutterStage *stage)
static GTimer *timer = NULL;
static guint timer_n_frames = 0;
ctx = clutter_context_get_default ();
ctx = _clutter_context_get_default ();
master_clock = _clutter_master_clock_get_default ();
/* Before we can paint, we have to be sure we have the latest layout */
@ -261,7 +261,7 @@ clutter_redraw (ClutterStage *stage)
void
clutter_set_motion_events_enabled (gboolean enable)
{
ClutterMainContext *context = clutter_context_get_default ();
ClutterMainContext *context = _clutter_context_get_default ();
context->motion_events_per_actor = enable;
}
@ -278,7 +278,7 @@ clutter_set_motion_events_enabled (gboolean enable)
gboolean
clutter_get_motion_events_enabled (void)
{
ClutterMainContext *context = clutter_context_get_default ();
ClutterMainContext *context = _clutter_context_get_default ();
return context->motion_events_per_actor;
}
@ -293,7 +293,7 @@ static inline void init_bits (void)
if (G_LIKELY (done))
return;
ctx = clutter_context_get_default ();
ctx = _clutter_context_get_default ();
done = TRUE;
}
@ -302,8 +302,9 @@ void
_clutter_id_to_color (guint id, ClutterColor *col)
{
ClutterMainContext *ctx;
gint red, green, blue;
ctx = clutter_context_get_default ();
gint red, green, blue;
ctx = _clutter_context_get_default ();
/* compute the numbers we'll store in the components */
red = (id >> (ctx->fb_g_mask_used+ctx->fb_b_mask_used))
@ -340,7 +341,7 @@ _clutter_pixel_to_id (guchar pixel[4])
gint red, green, blue;
guint id;
ctx = clutter_context_get_default ();
ctx = _clutter_context_get_default ();
/* reduce the pixel components to the number of bits actually used of the
* 8bits.
@ -374,7 +375,7 @@ _clutter_do_pick (ClutterStage *stage,
guint32 id;
GLboolean dither_was_on;
context = clutter_context_get_default ();
context = _clutter_context_get_default ();
_clutter_backend_ensure_context (context->backend, stage);
@ -1052,13 +1053,14 @@ clutter_get_debug_enabled (void)
}
ClutterMainContext *
clutter_context_get_default (void)
_clutter_context_get_default (void)
{
if (G_UNLIKELY(!ClutterCntx))
{
ClutterMainContext *ctx;
ClutterCntx = ctx = g_new0 (ClutterMainContext, 1);
ctx->backend = g_object_new (_clutter_backend_impl_get_type (), NULL);
ctx->is_initialized = FALSE;
@ -1088,7 +1090,7 @@ clutter_get_timestamp (void)
ClutterMainContext *ctx;
gdouble seconds;
ctx = clutter_context_get_default ();
ctx = _clutter_context_get_default ();
/* FIXME: may need a custom timer for embedded setups */
seconds = g_timer_elapsed (ctx->timer, NULL);
@ -1154,7 +1156,7 @@ clutter_init_real (GError **error)
/* Note, creates backend if not already existing, though parse args will
* have likely created it
*/
ctx = clutter_context_get_default ();
ctx = _clutter_context_get_default ();
backend = ctx->backend;
if (!ctx->options_parsed)
@ -1297,7 +1299,7 @@ pre_parse_hook (GOptionContext *context,
g_warning ("Locale not supported by C library.\n"
"Using the fallback 'C' locale.");
clutter_context = clutter_context_get_default ();
clutter_context = _clutter_context_get_default ();
clutter_context->id_pool = clutter_id_pool_new (256);
@ -1359,7 +1361,7 @@ post_parse_hook (GOptionContext *context,
if (clutter_is_initialized)
return TRUE;
clutter_context = clutter_context_get_default ();
clutter_context = _clutter_context_get_default ();
backend = clutter_context->backend;
g_assert (CLUTTER_IS_BACKEND (backend));
@ -1424,7 +1426,7 @@ clutter_get_option_group (void)
clutter_base_init ();
context = clutter_context_get_default ();
context = _clutter_context_get_default ();
group = g_option_group_new ("clutter",
_("Clutter Options"),
@ -1467,7 +1469,7 @@ clutter_get_option_group_without_init (void)
clutter_base_init ();
context = clutter_context_get_default ();
context = _clutter_context_get_default ();
context->defer_display_setup = TRUE;
group = clutter_get_option_group ();
@ -1526,7 +1528,7 @@ clutter_init_with_args (int *argc,
clutter_base_init ();
ctx = clutter_context_get_default ();
ctx = _clutter_context_get_default ();
if (!ctx->defer_display_setup)
{
@ -1631,7 +1633,7 @@ clutter_init (int *argc,
clutter_base_init ();
ctx = clutter_context_get_default ();
ctx = _clutter_context_get_default ();
if (!ctx->defer_display_setup)
{
@ -1683,7 +1685,7 @@ event_click_count_generate (ClutterEvent *event)
guint double_click_time;
guint double_click_distance;
backend = clutter_context_get_default ()->backend;
backend = _clutter_context_get_default ()->backend;
double_click_distance = clutter_backend_get_double_click_distance (backend);
double_click_time = clutter_backend_get_double_click_time (backend);
@ -2026,7 +2028,7 @@ _clutter_process_event (ClutterEvent *event)
ClutterActor *stage;
ClutterInputDevice *device = NULL;
context = clutter_context_get_default ();
context = _clutter_context_get_default ();
backend = context->backend;
stage = CLUTTER_ACTOR(event->any.stage);
@ -2250,7 +2252,7 @@ clutter_get_actor_by_gid (guint32 id)
{
ClutterMainContext *context;
context = clutter_context_get_default ();
context = _clutter_context_get_default ();
g_return_val_if_fail (context != NULL, NULL);
@ -2293,7 +2295,7 @@ clutter_get_default_frame_rate (void)
{
ClutterMainContext *context;
context = clutter_context_get_default ();
context = _clutter_context_get_default ();
return context->frame_rate;
}
@ -2314,7 +2316,7 @@ clutter_set_default_frame_rate (guint frames_per_sec)
{
ClutterMainContext *context;
context = clutter_context_get_default ();
context = _clutter_context_get_default ();
if (context->frame_rate != frames_per_sec)
context->frame_rate = frames_per_sec;
@ -2328,7 +2330,7 @@ on_pointer_grab_weak_notify (gpointer data,
ClutterInputDevice *dev = (ClutterInputDevice *)data;
ClutterMainContext *context;
context = clutter_context_get_default ();
context = _clutter_context_get_default ();
if (dev)
{
@ -2369,7 +2371,7 @@ clutter_grab_pointer (ClutterActor *actor)
g_return_if_fail (actor == NULL || CLUTTER_IS_ACTOR (actor));
context = clutter_context_get_default ();
context = _clutter_context_get_default ();
if (context->pointer_grab_actor == actor)
return;
@ -2486,7 +2488,7 @@ ClutterActor *
clutter_get_pointer_grab (void)
{
ClutterMainContext *context;
context = clutter_context_get_default ();
context = _clutter_context_get_default ();
return context->pointer_grab_actor;
}
@ -2498,7 +2500,7 @@ on_keyboard_grab_weak_notify (gpointer data,
{
ClutterMainContext *context;
context = clutter_context_get_default ();
context = _clutter_context_get_default ();
context->keyboard_grab_actor = NULL;
clutter_ungrab_keyboard ();
@ -2529,7 +2531,7 @@ clutter_grab_keyboard (ClutterActor *actor)
g_return_if_fail (actor == NULL || CLUTTER_IS_ACTOR (actor));
context = clutter_context_get_default ();
context = _clutter_context_get_default ();
if (context->keyboard_grab_actor == actor)
return;
@ -2578,7 +2580,8 @@ ClutterActor *
clutter_get_keyboard_grab (void)
{
ClutterMainContext *context;
context = clutter_context_get_default ();
context = _clutter_context_get_default ();
return context->keyboard_grab_actor;
}
@ -2705,7 +2708,7 @@ clutter_get_input_device_for_id (gint id)
ClutterInputDevice *device = NULL;
ClutterMainContext *context;
context = clutter_context_get_default ();
context = _clutter_context_get_default ();
for (item = context->input_devices;
item != NULL;

View File

@ -133,8 +133,8 @@ struct _ClutterMainContext
GList *repaint_funcs;
};
#define CLUTTER_CONTEXT() (clutter_context_get_default ())
ClutterMainContext *clutter_context_get_default (void);
#define CLUTTER_CONTEXT() (_clutter_context_get_default ())
ClutterMainContext *_clutter_context_get_default (void);
PangoContext *_clutter_context_create_pango_context (ClutterMainContext *self);
PangoContext *_clutter_context_get_pango_context (ClutterMainContext *self);

View File

@ -1947,11 +1947,12 @@ clutter_stage_new (void)
void
clutter_stage_ensure_current (ClutterStage *stage)
{
ClutterMainContext *ctx = clutter_context_get_default ();
ClutterBackend *backend;
g_return_if_fail (CLUTTER_IS_STAGE (stage));
_clutter_backend_ensure_context (ctx->backend, stage);
backend = clutter_get_default_backend ();
_clutter_backend_ensure_context (backend, stage);
}
/**

View File

@ -524,7 +524,7 @@ clutter_texture_paint (ClutterActor *self)
ClutterActor *stage = NULL;
ClutterPerspective perspective;
context = clutter_context_get_default ();
context = _clutter_context_get_default ();
if (context->shaders)
shader = clutter_actor_get_shader (context->shaders->data);

View File

@ -217,7 +217,7 @@ clutter_event_dispatch (GSource *source,
clutter_threads_enter ();
clutter_context = clutter_context_get_default ();
clutter_context = _clutter_context_get_default ();
#ifdef HAVE_TSLIB
/* FIXME while would be better here but need to deal with lockups */

View File

@ -220,11 +220,11 @@ clutter_backend_egl_init (ClutterBackendEGL *backend_egl)
clutter_backend_set_double_click_time (backend, 250);
clutter_backend_set_double_click_distance (backend, 5);
context = clutter_context_get_default ();
context = _clutter_context_get_default ();
#define MAX_FINGERS 5
#define MAX_FINGERS 5
for (i=0; i<MAX_FINGERS; i++)
for (i = 0; i < MAX_FINGERS; i++)
{
ClutterFruityFingerDevice *device;
@ -240,6 +240,8 @@ clutter_backend_egl_init (ClutterBackendEGL *backend_egl)
device->x = 0;
device->y = 0;
}
#undef MAX_FINGERS
}
GType

View File

@ -74,7 +74,7 @@ typedef struct {
ClutterStage *stage = CLUTTER_STAGE_EGL(ba->stage)->wrapper;
MEvent *event = (MEvent*)gs_event;
context = clutter_context_get_default ();
context = _clutter_context_get_default ();
bool mapped[MAX_FINGERS] = {false, false, false, false, false}; /* an event has been mapped to this device */
int evs[MAX_FINGERS] = {0,0,0,0,0};

View File

@ -335,7 +335,7 @@ clutter_event_dispatch (GSource *source,
clutter_threads_enter ();
clutter_context = clutter_context_get_default ();
clutter_context = _clutter_context_get_default ();
while (SDL_PollEvent(&sdl_event))
{

View File

@ -99,13 +99,11 @@ static void
clutter_backend_win32_dispose (GObject *gobject)
{
ClutterBackendWin32 *backend_win32 = CLUTTER_BACKEND_WIN32 (gobject);
ClutterMainContext *context;
ClutterStageManager *stage_manager;
CLUTTER_NOTE (BACKEND, "Disposing the of stages");
context = clutter_context_get_default ();
stage_manager = context->stage_manager;
stage_manager = clutter_stage_manager_get_default ();
/* Destroy all of the stages. g_slist_foreach is used because the
finalizer for the stages will remove the stage from the

View File

@ -228,10 +228,8 @@ void
clutter_win32_disable_event_retrieval (void)
{
ClutterBackendWin32 *backend;
ClutterMainContext *clutter_context;
clutter_context = clutter_context_get_default ();
backend = CLUTTER_BACKEND_WIN32 (clutter_context->backend);
backend = CLUTTER_BACKEND_WIN32 (clutter_get_default_backend ());
backend->no_event_retrieval = TRUE;
}
@ -645,7 +643,7 @@ _clutter_stage_win32_window_proc (HWND hwnd, UINT umsg,
ClutterMainContext *clutter_context;
DWORD message_pos = GetMessagePos ();
clutter_context = clutter_context_get_default ();
clutter_context = _clutter_context_get_default ();
msg.hwnd = hwnd;
msg.message = umsg;

View File

@ -693,11 +693,13 @@ clutter_win32_get_stage_from_window (HWND hwnd)
{
/* Otherwise it might be a foreign window so we should check the
stage list */
ClutterMainContext *context = clutter_context_get_default ();
ClutterStageManager *stage_manager = context->stage_manager;
GSList *l;
ClutterStageManager *stage_manager
const GSList *stages, *l;
for (l = stage_manager->stages; l; l = l->next)
stage_manager = clutter_stage_manager_get_default ();
stages = clutter_stage_manager_peek_stages (stage_manager);
for (l = stages; l != NULL; l = l->next)
{
ClutterStage *stage = l->data;
ClutterStageWindow *impl;

View File

@ -292,7 +292,7 @@ clutter_backend_x11_dispose (GObject *gobject)
CLUTTER_NOTE (BACKEND, "Disposing the of stages");
context = clutter_context_get_default ();
context = _clutter_context_get_default ();
stage_manager = context->stage_manager;
/* Destroy all of the stages. g_slist_foreach is used because the
@ -445,7 +445,7 @@ clutter_x11_get_default_display (void)
void
clutter_x11_set_display (Display *xdpy)
{
ClutterMainContext *ctx = clutter_context_get_default ();
ClutterMainContext *ctx = _clutter_context_get_default ();
if (ctx->is_initialized)
{
@ -472,7 +472,7 @@ clutter_x11_set_display (Display *xdpy)
void
clutter_x11_enable_xinput ()
{
ClutterMainContext *ctx = clutter_context_get_default ();
ClutterMainContext *ctx = _clutter_context_get_default ();
if (ctx->is_initialized)
{
@ -497,7 +497,7 @@ clutter_x11_enable_xinput ()
void
clutter_x11_disable_event_retrieval (void)
{
ClutterMainContext *ctx = clutter_context_get_default ();
ClutterMainContext *ctx = _clutter_context_get_default ();
if (ctx->is_initialized)
{
@ -672,7 +672,7 @@ _clutter_x11_register_xinput ()
return;
}
context = clutter_context_get_default ();
context = _clutter_context_get_default ();
backend_singleton->have_xinput = TRUE;
@ -840,7 +840,7 @@ _clutter_x11_select_events (Window xwin)
ClutterMainContext *context;
context = clutter_context_get_default ();
context = _clutter_context_get_default ();
if (!backend_singleton)
{
@ -870,7 +870,7 @@ _clutter_x11_get_device_for_xid (XID id)
ClutterX11XInputDevice *device = NULL;
ClutterMainContext *context;
context = clutter_context_get_default ();
context = _clutter_context_get_default ();
if (!backend_singleton)
{
@ -906,7 +906,7 @@ clutter_x11_get_input_devices (void)
return NULL;
}
context = clutter_context_get_default ();
context = _clutter_context_get_default ();
return context->input_devices;
#else /* !HAVE_XINPUT */

View File

@ -881,7 +881,7 @@ events_queue (ClutterBackend *backend)
XEvent xevent;
ClutterMainContext *clutter_context;
clutter_context = clutter_context_get_default ();
clutter_context = _clutter_context_get_default ();
while (!clutter_events_pending () && XPending (xdisplay))
{
@ -940,7 +940,7 @@ clutter_x11_handle_event (XEvent *xevent)
clutter_threads_enter ();
clutter_context = clutter_context_get_default ();
clutter_context = _clutter_context_get_default ();
backend = clutter_context->backend;
event = clutter_event_new (CLUTTER_NOTHING);

View File

@ -711,18 +711,16 @@ clutter_x11_get_stage_window (ClutterStage *stage)
ClutterStage *
clutter_x11_get_stage_from_window (Window win)
{
ClutterMainContext *context;
ClutterStageManager *stage_manager;
GSList *l;
const GSList *stages, *s;
context = clutter_context_get_default ();
stage_manager = clutter_stage_manager_get_default ();
stages = clutter_stage_manager_peek_stages (stage_manager);
stage_manager = context->stage_manager;
/* FIXME: use a hash here for performance resaon */
for (l = stage_manager->stages; l; l = l->next)
/* XXX: might use a hash here for performance resaon */
for (s = stages; s != NULL; s = s->next)
{
ClutterStage *stage = l->data;
ClutterStage *stage = s->data;
ClutterStageWindow *impl;
impl = _clutter_stage_get_window (stage);