* clutter/win32/clutter-stage-win32.c:
* clutter/win32/clutter-backend-win32.c: Reflect changes to the GLX/X11 backend in revisions 2708-2709 and 2713-2715 which simplify the backend a little.
This commit is contained in:
parent
53e031210a
commit
8ef653a9e8
@ -1,3 +1,10 @@
|
|||||||
|
2008-05-15 Neil Roberts <neil@o-hand.com>
|
||||||
|
|
||||||
|
* clutter/win32/clutter-stage-win32.c:
|
||||||
|
* clutter/win32/clutter-backend-win32.c: Reflect changes to the
|
||||||
|
GLX/X11 backend in revisions 2708-2709 and 2713-2715 which
|
||||||
|
simplify the backend a little.
|
||||||
|
|
||||||
2008-05-15 Emmanuele Bassi <ebassi@openedhand.com>
|
2008-05-15 Emmanuele Bassi <ebassi@openedhand.com>
|
||||||
|
|
||||||
* clutter/x11/clutter-backend-x11.c:
|
* clutter/x11/clutter-backend-x11.c:
|
||||||
|
@ -116,6 +116,9 @@ clutter_backend_win32_dispose (GObject *gobject)
|
|||||||
CLUTTER_NOTE (BACKEND, "Removing the event source");
|
CLUTTER_NOTE (BACKEND, "Removing the event source");
|
||||||
_clutter_backend_win32_events_uninit (CLUTTER_BACKEND (backend_win32));
|
_clutter_backend_win32_events_uninit (CLUTTER_BACKEND (backend_win32));
|
||||||
|
|
||||||
|
/* Unrealize all shaders, since the GL context is going away */
|
||||||
|
_clutter_shader_release_all ();
|
||||||
|
|
||||||
if (backend_win32->gl_context)
|
if (backend_win32->gl_context)
|
||||||
{
|
{
|
||||||
wglDeleteContext (backend_win32->gl_context);
|
wglDeleteContext (backend_win32->gl_context);
|
||||||
@ -313,33 +316,13 @@ clutter_backend_win32_create_stage (ClutterBackend *backend,
|
|||||||
CLUTTER_NOTE (BACKEND, "Creating stage of type `%s'",
|
CLUTTER_NOTE (BACKEND, "Creating stage of type `%s'",
|
||||||
g_type_name (CLUTTER_STAGE_TYPE));
|
g_type_name (CLUTTER_STAGE_TYPE));
|
||||||
|
|
||||||
stage = g_object_new (CLUTTER_STAGE_TYPE, NULL);
|
stage = g_object_new (CLUTTER_TYPE_STAGE_WIN32, NULL);
|
||||||
|
|
||||||
/* copy backend data into the stage */
|
/* copy backend data into the stage */
|
||||||
stage_win32 = CLUTTER_STAGE_WIN32 (stage);
|
stage_win32 = CLUTTER_STAGE_WIN32 (stage);
|
||||||
stage_win32->backend = backend_win32;
|
stage_win32->backend = backend_win32;
|
||||||
stage_win32->wrapper = wrapper;
|
stage_win32->wrapper = wrapper;
|
||||||
|
|
||||||
/* set the pointer back into the wrapper */
|
|
||||||
_clutter_stage_set_window (wrapper, CLUTTER_STAGE_WINDOW (stage));
|
|
||||||
|
|
||||||
/* needed ? */
|
|
||||||
g_object_set_data (G_OBJECT (stage), "clutter-backend", backend);
|
|
||||||
|
|
||||||
/* FIXME - is this needed? we should call realize inside the clutter
|
|
||||||
* init sequence for the default stage, and let the usual realization
|
|
||||||
* sequence be used for any other stage
|
|
||||||
*/
|
|
||||||
clutter_actor_realize (stage);
|
|
||||||
|
|
||||||
if (!CLUTTER_ACTOR_IS_REALIZED (stage))
|
|
||||||
{
|
|
||||||
g_set_error (error, CLUTTER_INIT_ERROR,
|
|
||||||
CLUTTER_INIT_ERROR_INTERNAL,
|
|
||||||
"Unable to realize the main stage");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return stage;
|
return stage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,8 +61,7 @@ clutter_stage_win32_show (ClutterActor *actor)
|
|||||||
if (stage_win32->hwnd)
|
if (stage_win32->hwnd)
|
||||||
ShowWindow (stage_win32->hwnd, SW_SHOW);
|
ShowWindow (stage_win32->hwnd, SW_SHOW);
|
||||||
|
|
||||||
/* chain up */
|
CLUTTER_ACTOR_SET_FLAGS (actor, CLUTTER_ACTOR_MAPPED);
|
||||||
CLUTTER_ACTOR_CLASS (clutter_stage_win32_parent_class)->show (actor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -70,11 +69,10 @@ clutter_stage_win32_hide (ClutterActor *actor)
|
|||||||
{
|
{
|
||||||
ClutterStageWin32 *stage_win32 = CLUTTER_STAGE_WIN32 (actor);
|
ClutterStageWin32 *stage_win32 = CLUTTER_STAGE_WIN32 (actor);
|
||||||
|
|
||||||
|
CLUTTER_ACTOR_UNSET_FLAGS (actor, CLUTTER_ACTOR_MAPPED);
|
||||||
|
|
||||||
if (stage_win32->hwnd)
|
if (stage_win32->hwnd)
|
||||||
ShowWindow (stage_win32->hwnd, SW_HIDE);
|
ShowWindow (stage_win32->hwnd, SW_HIDE);
|
||||||
|
|
||||||
/* chain up */
|
|
||||||
CLUTTER_ACTOR_CLASS (clutter_stage_win32_parent_class)->hide (actor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -426,10 +424,7 @@ clutter_stage_win32_realize (ClutterActor *actor)
|
|||||||
if (window_class == 0)
|
if (window_class == 0)
|
||||||
{
|
{
|
||||||
g_critical ("Unable to register window class");
|
g_critical ("Unable to register window class");
|
||||||
CLUTTER_ACTOR_UNSET_FLAGS (stage_win32->wrapper,
|
goto fail;
|
||||||
CLUTTER_ACTOR_REALIZED);
|
|
||||||
CLUTTER_ACTOR_UNSET_FLAGS (actor, CLUTTER_ACTOR_REALIZED);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we're in fullscreen mode then use the fullscreen rect
|
/* If we're in fullscreen mode then use the fullscreen rect
|
||||||
@ -470,10 +465,7 @@ clutter_stage_win32_realize (ClutterActor *actor)
|
|||||||
if (stage_win32->hwnd == NULL)
|
if (stage_win32->hwnd == NULL)
|
||||||
{
|
{
|
||||||
g_critical ("Unable to create stage window");
|
g_critical ("Unable to create stage window");
|
||||||
CLUTTER_ACTOR_UNSET_FLAGS (stage_win32->wrapper,
|
goto fail;
|
||||||
CLUTTER_ACTOR_REALIZED);
|
|
||||||
CLUTTER_ACTOR_UNSET_FLAGS (actor, CLUTTER_ACTOR_REALIZED);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the position in case CW_USEDEFAULT was specified */
|
/* Get the position in case CW_USEDEFAULT was specified */
|
||||||
@ -513,10 +505,7 @@ clutter_stage_win32_realize (ClutterActor *actor)
|
|||||||
|| !SetPixelFormat (stage_win32->client_dc, pf, &pfd))
|
|| !SetPixelFormat (stage_win32->client_dc, pf, &pfd))
|
||||||
{
|
{
|
||||||
g_critical ("Unable to find suitable GL pixel format");
|
g_critical ("Unable to find suitable GL pixel format");
|
||||||
CLUTTER_ACTOR_UNSET_FLAGS (stage_win32->wrapper,
|
goto fail;
|
||||||
CLUTTER_ACTOR_REALIZED);
|
|
||||||
CLUTTER_ACTOR_UNSET_FLAGS (actor, CLUTTER_ACTOR_REALIZED);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (backend_win32->gl_context == NULL)
|
if (backend_win32->gl_context == NULL)
|
||||||
@ -526,30 +515,26 @@ clutter_stage_win32_realize (ClutterActor *actor)
|
|||||||
if (backend_win32->gl_context == NULL)
|
if (backend_win32->gl_context == NULL)
|
||||||
{
|
{
|
||||||
g_critical ("Unable to create suitable GL context");
|
g_critical ("Unable to create suitable GL context");
|
||||||
CLUTTER_ACTOR_UNSET_FLAGS (stage_win32->wrapper,
|
goto fail;
|
||||||
CLUTTER_ACTOR_REALIZED);
|
|
||||||
CLUTTER_ACTOR_UNSET_FLAGS (actor, CLUTTER_ACTOR_REALIZED);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* below will call wglMakeCurrent */
|
/* Make the context current so we can check the GL version */
|
||||||
CLUTTER_ACTOR_SET_FLAGS (stage_win32->wrapper, CLUTTER_ACTOR_REALIZED);
|
wglMakeCurrent (stage_win32->client_dc, backend_win32->gl_context);
|
||||||
CLUTTER_ACTOR_SET_FLAGS (stage_win32, CLUTTER_ACTOR_REALIZED);
|
|
||||||
clutter_stage_ensure_current (stage_win32->wrapper);
|
|
||||||
|
|
||||||
if (!clutter_stage_win32_check_gl_version ())
|
if (!clutter_stage_win32_check_gl_version ())
|
||||||
{
|
{
|
||||||
g_critical ("OpenGL version number is too low");
|
g_critical ("OpenGL version number is too low");
|
||||||
CLUTTER_ACTOR_UNSET_FLAGS (stage_win32->wrapper,
|
goto fail;
|
||||||
CLUTTER_ACTOR_REALIZED);
|
}
|
||||||
CLUTTER_ACTOR_UNSET_FLAGS (actor, CLUTTER_ACTOR_REALIZED);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure the viewport gets set up correctly */
|
CLUTTER_NOTE (BACKEND, "Marking stage as realized");
|
||||||
CLUTTER_SET_PRIVATE_FLAGS (stage_win32->wrapper,
|
CLUTTER_ACTOR_SET_FLAGS (stage_win32, CLUTTER_ACTOR_REALIZED);
|
||||||
CLUTTER_ACTOR_SYNC_MATRICES);
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
CLUTTER_ACTOR_UNSET_FLAGS (actor, CLUTTER_ACTOR_REALIZED);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -564,12 +549,6 @@ clutter_stage_win32_unrealize (ClutterActor *actor)
|
|||||||
*/
|
*/
|
||||||
CLUTTER_ACTOR_CLASS (clutter_stage_win32_parent_class)->unrealize (actor);
|
CLUTTER_ACTOR_CLASS (clutter_stage_win32_parent_class)->unrealize (actor);
|
||||||
|
|
||||||
/* Unrealize all shaders, since the GL context is going away */
|
|
||||||
_clutter_shader_release_all ();
|
|
||||||
|
|
||||||
/* As unrealised the context will now get cleared */
|
|
||||||
clutter_stage_ensure_current (stage_win32->wrapper);
|
|
||||||
|
|
||||||
if (stage_win32->client_dc)
|
if (stage_win32->client_dc)
|
||||||
{
|
{
|
||||||
ReleaseDC (stage_win32->hwnd, stage_win32->client_dc);
|
ReleaseDC (stage_win32->hwnd, stage_win32->client_dc);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user