[mutter/wip/wayland-work: 19/21] wayland: don't require Clutter backend variables to be set from outside



commit 744f49c3a50e5ac8151cd8d17b7cd818ff7da1b1
Author: Giovanni Campagna <gcampagn redhat com>
Date:   Wed Aug 21 11:43:36 2013 +0200

    wayland: don't require Clutter backend variables to be set from outside
    
    When running under mutter-launch, we can assume we're running on
    bare metal, and set the clutter backend appropriately.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=706421

 src/core/main.c            |   11 +++++++++++
 src/wayland/meta-wayland.c |    3 +++
 2 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/core/main.c b/src/core/main.c
index 2d605e6..0d60537 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -249,6 +249,17 @@ meta_get_option_context (void)
   bindtextdomain (GETTEXT_PACKAGE, MUTTER_LOCALEDIR);
   bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 
+  /* We must set the variables here, because Clutter creates the backend
+     when the first call is made.
+
+     We consider running from mutter-launch equivalent to running from bare metal.
+  */
+  if (getenv ("WESTON_LAUNCHER_SOCK"))
+    {
+      g_setenv ("CLUTTER_BACKEND", "eglnative", TRUE);
+      g_setenv ("CLUTTER_INPUT_BACKEND", "evdev", TRUE);
+    }
+
   ctx = g_option_context_new (NULL);
   g_option_context_add_main_entries (ctx, meta_options, GETTEXT_PACKAGE);
   g_option_context_add_group (ctx, clutter_get_option_group_without_init ());
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index 2ec4125..1c84314 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -1618,6 +1618,9 @@ meta_wayland_init (void)
   if (clutter_init (NULL, NULL) != CLUTTER_INIT_SUCCESS)
     g_error ("Failed to initialize Clutter");
 
+  unsetenv ("CLUTTER_BACKEND");
+  unsetenv ("CLUTTER_INPUT_BACKEND");
+
   backend = clutter_get_default_backend ();
   cogl_context = clutter_backend_get_cogl_context (backend);
   cogl_renderer = cogl_display_get_renderer (cogl_context_get_display (cogl_context));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]