mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 19:42:05 +00:00
backend: Provide a default create_stage()
We can now safely create a ClutterStageWindow in the shared code path, instead of deferring to the backend.
This commit is contained in:
parent
9c038ebefb
commit
828ca2982f
@ -389,6 +389,37 @@ clutter_backend_real_get_features (ClutterBackend *backend)
|
||||
return flags;
|
||||
}
|
||||
|
||||
static ClutterStageWindow *
|
||||
clutter_backend_real_create_stage (ClutterBackend *backend,
|
||||
ClutterStage *wrapper,
|
||||
GError **error)
|
||||
{
|
||||
ClutterBackendClass *klass;
|
||||
|
||||
if (!clutter_feature_available (CLUTTER_FEATURE_STAGE_MULTIPLE))
|
||||
{
|
||||
ClutterStageManager *manager = clutter_stage_manager_get_default ();
|
||||
|
||||
if (clutter_stage_manager_get_default_stage (manager) != NULL)
|
||||
{
|
||||
g_set_error (error, CLUTTER_INIT_ERROR,
|
||||
CLUTTER_INIT_ERROR_BACKEND,
|
||||
_("The backend of type '%s' does not support "
|
||||
"creating multiple stages"),
|
||||
G_OBJECT_TYPE_NAME (backend));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
||||
g_assert (klass->stage_window_type != G_TYPE_INVALID);
|
||||
|
||||
return g_object_new (klass->stage_window_type,
|
||||
"backend", backend,
|
||||
"wrapper", wrapper,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_real_redraw (ClutterBackend *backend,
|
||||
ClutterStage *stage)
|
||||
@ -576,6 +607,7 @@ clutter_backend_class_init (ClutterBackendClass *klass)
|
||||
klass->create_context = clutter_backend_real_create_context;
|
||||
klass->ensure_context = clutter_backend_real_ensure_context;
|
||||
klass->get_features = clutter_backend_real_get_features;
|
||||
klass->create_stage = clutter_backend_real_create_stage;
|
||||
klass->redraw = clutter_backend_real_redraw;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user