From 790c0d1f9128ea64b84db944ef2ac853bfd8e057 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Thu, 3 Nov 2011 16:45:56 +0000 Subject: [PATCH] backend: Provide an implementation of ensure_backend() We can do it for all Cogl-based backends. --- clutter/clutter-backend.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/clutter/clutter-backend.c b/clutter/clutter-backend.c index 7243cac8a..e448a27f5 100644 --- a/clutter/clutter-backend.c +++ b/clutter/clutter-backend.c @@ -50,6 +50,7 @@ #include "clutter-profile.h" #include "clutter-stage-manager-private.h" #include "clutter-stage-private.h" +#include "clutter-stage-window.h" #include "clutter-version.h" #include @@ -205,6 +206,27 @@ clutter_backend_real_font_changed (ClutterBackend *backend) CLUTTER_NOTE (BACKEND, "Units per em: %.2f", priv->units_per_em); } +static void +clutter_backend_real_ensure_context (ClutterBackend *backend, + ClutterStage *stage) +{ + ClutterStageWindow *stage_impl; + CoglFramebuffer *framebuffer; + + if (stage == NULL) + return; + + stage_impl = _clutter_stage_get_window (stage); + if (stage_impl == NULL) + return; + + framebuffer = _clutter_stage_window_get_active_framebuffer (stage_impl); + if (framebuffer == NULL) + return; + + cogl_set_framebuffer (framebuffer); +} + static void clutter_backend_real_redraw (ClutterBackend *backend, ClutterStage *stage) @@ -316,7 +338,9 @@ clutter_backend_class_init (ClutterBackendClass *klass) klass->resolution_changed = clutter_backend_real_resolution_changed; klass->font_changed = clutter_backend_real_font_changed; + klass->translate_event = clutter_backend_real_translate_event; + klass->ensure_context = clutter_backend_real_ensure_context; klass->redraw = clutter_backend_real_redraw; }