Avoid mixing declarations and code

Mixing declarations and code causes problems for MSVC as it is a C99
feature so we should try to avoid it.
This commit is contained in:
Neil Roberts 2010-10-25 13:08:52 +01:00
parent 8e3674dcc1
commit f1752ff3ba
9 changed files with 62 additions and 45 deletions

View File

@ -919,37 +919,43 @@ _get_top_level_origin (ClutterActor *actor,
*y = 0;
#ifdef HAVE_CLUTTER_GLX
ClutterActor *stage = NULL;
Display *display = NULL;
Window root_window;
Window stage_window;
Window child;
gint return_val = 0;
{
ClutterActor *stage = NULL;
Display *display = NULL;
Window root_window;
Window stage_window;
Window child;
gint return_val = 0;
stage = clutter_actor_get_stage (actor);
stage = clutter_actor_get_stage (actor);
display = clutter_x11_get_default_display (); /* FIXME: what happens if you use another
display with clutter_backend_x11_set_display ?*/
root_window = clutter_x11_get_root_window ();
stage_window = clutter_x11_get_stage_window (CLUTTER_STAGE (stage));
/* FIXME: what happens if you use another display with
clutter_backend_x11_set_display ?*/
display = clutter_x11_get_default_display ();
root_window = clutter_x11_get_root_window ();
stage_window = clutter_x11_get_stage_window (CLUTTER_STAGE (stage));
return_val = XTranslateCoordinates (display, stage_window, root_window,
0, 0, x, y,
&child);
return_val = XTranslateCoordinates (display, stage_window, root_window,
0, 0, x, y,
&child);
if (!return_val)
g_warning ("[x11] We were not able to get proper absolute position of the stage");
if (!return_val)
g_warning ("[x11] We were not able to get proper absolute "
"position of the stage");
}
#else
static gboolean yet_warned = FALSE;
{
static gboolean yet_warned = FALSE;
if (!yet_warned)
{
yet_warned = TRUE;
g_warning ("Using a clutter backend not supported. "
"atk_component_get_extents using ATK_XY_SCREEN could return a wrong screen position");
}
if (!yet_warned)
{
yet_warned = TRUE;
g_warning ("Using a clutter backend not supported. "
"atk_component_get_extents using ATK_XY_SCREEN "
"could return a wrong screen position");
}
}
#endif
}

View File

@ -3258,12 +3258,13 @@ _clutter_stage_maybe_finish_queue_redraws (ClutterStage *stage)
for (l = stolen_list; l; l = l->next)
{
ClutterStageQueueRedrawEntry *entry = l->data;
ClutterPaintVolume *clip;
/* NB: Entries may be invalidated if the actor gets destroyed */
if (G_UNLIKELY (entry->actor == NULL))
continue;
ClutterPaintVolume *clip = entry->has_clip ? &entry->clip : NULL;
clip = entry->has_clip ? &entry->clip : NULL;
_clutter_actor_finish_queue_redraw (entry->actor, clip);
free_queue_redraw_entry (entry);

View File

@ -290,12 +290,14 @@ void
_cogl_gl_use_program_wrapper (CoglHandle program_handle)
{
#ifdef COGL_MATERIAL_BACKEND_GLSL
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
#ifndef HAVE_COGL_GLES2
CoglProgram *program = (CoglProgram *)program_handle;
GLuint gl_program;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
if (program_handle != COGL_INVALID_HANDLE)
gl_program = program->gl_handle;
else
@ -322,9 +324,14 @@ _cogl_gl_use_program_wrapper (CoglHandle program_handle)
GE (glUseProgram (0));
ctx->current_gl_program = gl_program;
#else /* HAVE_COGL_GLES2 */
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
ctx->drv.gles2.settings.user_program = program_handle;
ctx->drv.gles2.settings_dirty = TRUE;
#endif /* HAVE_COGL_GLES2 */
#endif

View File

@ -5578,8 +5578,10 @@ dump_material_cb (CoglMaterialNode *node, void *user_data)
if (material->differences & COGL_MATERIAL_STATE_BLEND)
{
changes = TRUE;
const char *blend_enable_name;
changes = TRUE;
switch (material->blend_enable)
{
case COGL_MATERIAL_BLEND_ENABLE_AUTOMATIC:

View File

@ -734,12 +734,13 @@ event_translate (ClutterBackend *backend,
case Expose:
{
CLUTTER_NOTE (MULTISTAGE, "expose for stage: %p, redrawing", stage);
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
XExposeEvent *expose = (XExposeEvent *)xevent;
ClutterPaintVolume clip;
ClutterVertex origin;
CLUTTER_NOTE (MULTISTAGE, "expose for stage: %p, redrawing", stage);
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
CLUTTER_NOTE (MULTISTAGE,
"expose for stage: %p, "
"redrawing (x=%d, y=%d, width=%d, height=%d)",

View File

@ -14,10 +14,10 @@ static const ClutterColor stage_color = { 0x0, 0x0, 0x0, 0xff };
#define BLUE 2
#define ALPHA 3
#define MASK_RED(COLOR) ((COLOR & 0xff000000) >> 24);
#define MASK_GREEN(COLOR) ((COLOR & 0xff0000) >> 16);
#define MASK_BLUE(COLOR) ((COLOR & 0xff00) >> 8);
#define MASK_ALPHA(COLOR) (COLOR & 0xff);
#define MASK_RED(COLOR) ((COLOR & 0xff000000) >> 24)
#define MASK_GREEN(COLOR) ((COLOR & 0xff0000) >> 16)
#define MASK_BLUE(COLOR) ((COLOR & 0xff00) >> 8)
#define MASK_ALPHA(COLOR) (COLOR & 0xff)
#define BLEND_CONSTANT_UNUSED 0xDEADBEEF
#define TEX_CONSTANT_UNUSED 0xDEADBEEF

View File

@ -19,10 +19,10 @@ static const ClutterColor stage_color = { 0x0, 0x0, 0x0, 0xff };
#define BLUE 2
#define ALPHA 3
#define MASK_RED(COLOR) ((COLOR & 0xff000000) >> 24);
#define MASK_GREEN(COLOR) ((COLOR & 0xff0000) >> 16);
#define MASK_BLUE(COLOR) ((COLOR & 0xff00) >> 8);
#define MASK_ALPHA(COLOR) (COLOR & 0xff);
#define MASK_RED(COLOR) ((COLOR & 0xff000000) >> 24)
#define MASK_GREEN(COLOR) ((COLOR & 0xff0000) >> 16)
#define MASK_BLUE(COLOR) ((COLOR & 0xff00) >> 8)
#define MASK_ALPHA(COLOR) (COLOR & 0xff)
typedef struct _TestState
{

View File

@ -15,10 +15,10 @@ static const ClutterColor stage_color = { 0x0, 0x0, 0x0, 0xff };
#define BLUE 2
#define ALPHA 3
#define MASK_RED(COLOR) ((COLOR & 0xff000000) >> 24);
#define MASK_GREEN(COLOR) ((COLOR & 0xff0000) >> 16);
#define MASK_BLUE(COLOR) ((COLOR & 0xff00) >> 8);
#define MASK_ALPHA(COLOR) (COLOR & 0xff);
#define MASK_RED(COLOR) ((COLOR & 0xff000000) >> 24)
#define MASK_GREEN(COLOR) ((COLOR & 0xff0000) >> 16)
#define MASK_BLUE(COLOR) ((COLOR & 0xff00) >> 8)
#define MASK_ALPHA(COLOR) (COLOR & 0xff)
typedef struct _TestState
{

View File

@ -14,10 +14,10 @@ static const ClutterColor stage_color = { 0x0, 0x0, 0x0, 0xff };
#define BLUE 2
#define ALPHA 3
#define MASK_RED(COLOR) ((COLOR & 0xff000000) >> 24);
#define MASK_GREEN(COLOR) ((COLOR & 0xff0000) >> 16);
#define MASK_BLUE(COLOR) ((COLOR & 0xff00) >> 8);
#define MASK_ALPHA(COLOR) (COLOR & 0xff);
#define MASK_RED(COLOR) ((COLOR & 0xff000000) >> 24)
#define MASK_GREEN(COLOR) ((COLOR & 0xff0000) >> 16)
#define MASK_BLUE(COLOR) ((COLOR & 0xff00) >> 8)
#define MASK_ALPHA(COLOR) (COLOR & 0xff)
typedef struct _TestState
{