summaryrefslogtreecommitdiff
diff options
authorDidier Roche <didier.roche@canonical.com>2012-02-10 10:06:16 +0100
committerDidier Roche <didier.roche@canonical.com>2012-02-10 10:06:16 +0100
commita130faa7f8ddba41c82d1f8ab634bd35767f9ec2 (patch)
treee0ffe45478508f96ee1727a69c51bedd53462f91
parentacd1f36f2cbcc8b03c714300c5000a3fef9c2644 (diff)
Cherry-pick new gtk_init initialization in unity (not anymore in compiz)
(bzr r55.3.587)
-rw-r--r--debian/changelog1
-rw-r--r--plugins/unityshell/src/unityshell.cpp15
2 files changed, 16 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index aee3f796c..62a48667a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,7 @@ unity (5.2.0-0ubuntu4~ppa1) precise; urgency=low
- build-dep on latest compiz-dev and libcompizconfig0-dev for ABI break
* debian/rules:
- pick new abiversion file
+ * Cherry-pick new gtk_init initialization in unity (not anymore in compiz)
-- Didier Roche <didrocks@ubuntu.com> Thu, 09 Feb 2012 18:15:04 +0100
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp
index 568e238e6..b15fdab71 100644
--- a/plugins/unityshell/src/unityshell.cpp
+++ b/plugins/unityshell/src/unityshell.cpp
@@ -2664,6 +2664,21 @@ bool UnityPluginVTable::init()
if (!CompPlugin::checkPluginABI("opengl", COMPIZ_OPENGL_ABI))
return false;
+ /*
+ * GTK needs to be initialized or else unity's gdk/gtk calls will crash.
+ * This is already done in compiz' main() if using ubuntu packages, but not
+ * if you're using the regular (upstream) compiz.
+ * Admittedly this is the same as what the "gtkloader" plugin does. But it
+ * is faster, more efficient (one less plugin in memory), and more reliable
+ * to do the init here where its needed. And yes, init'ing multiple times is
+ * safe, and does nothing after the first init.
+ */
+ if (!gtk_init_check(&programArgc, &programArgv))
+ {
+ compLogMessage("unityshell", CompLogLevelError, "GTK init failed\n");
+ return false;
+ }
+
return true;
}