[mutter/wip/wayland-work: 39/44] wayland: don't require Clutter backend variables to be set from outside
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/wayland-work: 39/44] wayland: don't require Clutter backend variables to be set from outside
- Date: Tue, 27 Aug 2013 08:19:21 +0000 (UTC)
commit a10aab4e0e87f3b64330c478c0e9e4d8c5479073
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 | 11 +++++++----
2 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/src/core/main.c b/src/core/main.c
index 1975e8f..c1d45ed 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 9e6c403..10c2975 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -1673,16 +1673,19 @@ meta_wayland_init (void)
clutter_wayland_set_compositor_display (compositor->wayland_display);
- /* We need to set this before clutter_init(), so we do it unconditionally.
- It doesn't harm anyway to do it under X11 */
weston_launch_fd = env_get_fd ("WESTON_LAUNCHER_SOCK");
if (weston_launch_fd >= 0)
- compositor->weston_launch = g_socket_new_from_fd (weston_launch_fd, NULL);
- clutter_evdev_set_open_callback (on_evdev_device_open, compositor);
+ {
+ compositor->weston_launch = g_socket_new_from_fd (weston_launch_fd, NULL);
+ clutter_evdev_set_open_callback (on_evdev_device_open, compositor);
+ }
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]