libcompizconfig: Changes to 'upstream-unstable'
Makefile.am | 10
VERSION | 2
config/config | 5
configure.ac | 28
include/ccs.h | 44
metadata/Makefile.am | 7
metadata/global.xml | 416 ------
plugin/ccp.c | 99 -
src/Makefile.am | 46
src/ccs-private.h | 5
src/compiz.c | 1570 ------------------------
src/compiz.cpp | 3137 +++++++++++++++++++++++++++++++++++++++++++++++++
src/compizconfig.proto | 164 ++
src/config.c | 13
src/ini.c | 131 --
src/lists.c | 6
src/main.c | 65 -
17 files changed, 3609 insertions(+), 2139 deletions(-)
New commits:
commit cbbdcceea27f671f96ff86902478487f76cd3f12
Author: Guillaume Seguin <guillaume@segu.in>
Date: Mon Mar 9 15:43:46 2009 +0100
* Bump version to 0.8.2
diff --git a/VERSION b/VERSION
index 1357b31..2dcc312 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-VERSION=0.7.9
+VERSION=0.8.2
commit bb0ec725b1f5ed60d719ecb37843150b6713cc1f
Author: Guillaume Seguin <guillaume@segu.in>
Date: Thu Mar 5 16:28:32 2009 +0100
Fix compizconfig.proto dist inclusion
diff --git a/src/Makefile.am b/src/Makefile.am
index 6dfae9c..788bda2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,8 +4,6 @@ PROTOBUF_LIB = -lprotobuf
PROTOBUF_DEFINES = \
-DUSE_PROTOBUF=1
-EXTRA_DIST = compizconfig.proto
-
compizconfig.pb.cc: compizconfig.proto
protoc --cpp_out=. compizconfig.proto
@@ -21,6 +19,7 @@ clean-local:
endif
+EXTRA_DIST = compizconfig.proto
INCLUDES = \
@COMPIZ_CFLAGS@ \
commit 00646fe0c31ccaa81dae69ed74393cf151a3e963
Author: Danny Baumann <dannybaumann@web.de>
Date: Tue Dec 2 11:13:47 2008 +0100
Revert accidential change.
diff --git a/configure.ac b/configure.ac
index 38e8503..0ce5d31 100644
--- a/configure.ac
+++ b/configure.ac
@@ -96,7 +96,7 @@ AC_SUBST(LIBXML2_REQUIRES)
AC_ARG_ENABLE(protobuf,
[ --disable-protobuf Disable Protocol Buffers],
- [use_protobuf=no], [use_protobuf=yes])
+ [use_protobuf=$enableval], [use_protobuf=yes])
if test "x$use_protobuf" = "xyes"; then
protobuf_error_msg="\nWARNING: You need to install Protocol Buffers to get faster program startup.\n Sources are available at http://code.google.com/p/protobuf/downloads/list\n Package names for Ubuntu/Debian: libprotobuf0, libprotobuf-dev, protobuf-compiler\n Package names for other distributions: protobuf, protobuf-devel\n Disabling protobuf.\n"
commit 79c0f14071db762bba256da6c0588115725219a3
Author: Danny Baumann <dannybaumann@web.de>
Date: Tue Dec 2 11:03:43 2008 +0100
Mem leak fixes and minor cleanup.
diff --git a/configure.ac b/configure.ac
index 0ce5d31..38e8503 100644
--- a/configure.ac
+++ b/configure.ac
@@ -96,7 +96,7 @@ AC_SUBST(LIBXML2_REQUIRES)
AC_ARG_ENABLE(protobuf,
[ --disable-protobuf Disable Protocol Buffers],
- [use_protobuf=$enableval], [use_protobuf=yes])
+ [use_protobuf=no], [use_protobuf=yes])
if test "x$use_protobuf" = "xyes"; then
protobuf_error_msg="\nWARNING: You need to install Protocol Buffers to get faster program startup.\n Sources are available at http://code.google.com/p/protobuf/downloads/list\n Package names for Ubuntu/Debian: libprotobuf0, libprotobuf-dev, protobuf-compiler\n Package names for other distributions: protobuf, protobuf-devel\n Disabling protobuf.\n"
diff --git a/src/compiz.cpp b/src/compiz.cpp
index ddcb82c..5b36a4d 100644
--- a/src/compiz.cpp
+++ b/src/compiz.cpp
@@ -2755,6 +2755,9 @@ updatePBFilePath (CCSContext * context, char *name, char *pbFilePath)
if (plugin)
{
PLUGIN_PRIV (plugin);
+
+ if (pPrivate->pbFilePath)
+ free (pPrivate->pbFilePath);
pPrivate->pbFilePath = strdup (pbFilePath);
}
}
@@ -2791,15 +2794,14 @@ loadPluginFromXMLFile (CCSContext * context, char *xmlName, char *xmlDirPath)
Bool error = TRUE;
int lenXMLName = strlen (xmlName);
struct stat pbStat;
- name = (char *) malloc (lenXMLName - 4 + 1);
+
+ name = strndup (xmlName, strlen (xmlName) - 4);
if (!name)
{
fprintf (stderr, "[ERROR]: Can't allocate memory\n");
free (xmlFilePath);
return;
}
- strncpy (name, xmlName, lenXMLName - 4);
- name[lenXMLName - 4] = '\0';
if (createProtoBufCacheDir () &&
metadataCacheDir.length () > 0)
@@ -2861,12 +2863,13 @@ loadPluginFromXMLFile (CCSContext * context, char *xmlName, char *xmlDirPath)
if (usingProtobuf && xmlLoaded)
{
writePBFile (pbFilePath, NULL, &persistentPluginBriefPB);
-
updatePBFilePath (context, name, pbFilePath);
+ }
+ if (pbFilePath)
free (pbFilePath);
+ if (name)
free (name);
- }
#endif
}
commit 6202217f3efa974a55aed34bf467f0462f2cf8a0
Author: Danny Baumann <dannybaumann@web.de>
Date: Mon Nov 24 09:40:24 2008 +0100
Sanity check input values of ccsFindSetting.
diff --git a/src/main.c b/src/main.c
index 1747b2a..d2680eb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -242,8 +242,14 @@ CCSSetting *
ccsFindSetting (CCSPlugin * plugin, const char *name,
Bool isScreen, unsigned int screenNum)
{
+ if (!plugin)
+ return NULL;
+
PLUGIN_PRIV (plugin);
+ if (!name)
+ name = "";
+
if (!pPrivate->loaded)
ccsLoadPluginSettings (plugin);
commit 890a30e25eb3a1499b08d69ea7b97bdc6dbc76db
Author: Erkin Bahceci <erkinbah@gmail.com>
Date: Fri Nov 7 00:39:05 2008 -0600
Don't write .pb for ini, gconf, ccp, kconfig.
Fixes these errors:
libprotobuf ERROR google/protobuf/message.cc:110] Can't parse message of
type "metadata.PluginBrief" because it is missing required fields: info
libprotobuf FATAL google/protobuf/message.cc:198] CHECK failed:
IsInitialized(): Can't serialize message of type "metadata.PluginBrief"
because it is missing required fields: info.name
diff --git a/src/compiz.cpp b/src/compiz.cpp
index 1efabb4..ddcb82c 100644
--- a/src/compiz.cpp
+++ b/src/compiz.cpp
@@ -2480,7 +2480,8 @@ fillBasicInfoIntoPB (CCSPlugin *plugin, PluginInfoMetadata *pluginInfoPB)
}
#endif
-static void
+/* Returns TRUE on success. */
+static Bool
addPluginFromXMLNode (CCSContext * context,
xmlNode * node,
char * file,
@@ -2491,7 +2492,7 @@ addPluginFromXMLNode (CCSContext * context,
CCSPluginPrivate *pPrivate;
if (!node)
- return;
+ return FALSE;
name = getStringFromXPath (node->doc, node, "@name");
@@ -2499,31 +2500,31 @@ addPluginFromXMLNode (CCSContext * context,
{
if (name)
free (name);
- return;
+ return FALSE;
}
if (!strcmp (name, "ini") || !strcmp (name, "gconf") ||
!strcmp (name, "ccp") || !strcmp (name, "kconfig"))
{
free (name);
- return;
+ return FALSE;
}
if (ccsFindPlugin (context, name))
{
free (name);
- return;
+ return FALSE;
}
plugin = (CCSPlugin *) calloc (1, sizeof (CCSPlugin));
if (!plugin)
- return;
+ return FALSE;
pPrivate = (CCSPluginPrivate *) calloc (1, sizeof (CCSPluginPrivate));
if (!pPrivate)
{
free (plugin);
- return;
+ return FALSE;
}
plugin->ccsPrivate = (void *) pPrivate;
@@ -2558,9 +2559,12 @@ addPluginFromXMLNode (CCSContext * context,
context->plugins = ccsPluginListAppend (context->plugins, plugin);
free (name);
+
+ return TRUE;
}
-static void
+/* Returns TRUE on success. */
+static Bool
addCoreSettingsFromXMLNode (CCSContext * context,
xmlNode * node,
char *file,
@@ -2570,20 +2574,20 @@ addCoreSettingsFromXMLNode (CCSContext * context,
CCSPluginPrivate *pPrivate;
if (!node)
- return;
+ return FALSE;
if (ccsFindPlugin (context, "core"))
- return;
+ return FALSE;
plugin = (CCSPlugin *) calloc (1, sizeof (CCSPlugin));
if (!plugin)
- return;
+ return FALSE;
pPrivate = (CCSPluginPrivate *) calloc (1, sizeof (CCSPluginPrivate));
if (!pPrivate)
{
free (plugin);
- return;
+ return FALSE;
}
plugin->ccsPrivate = (void *) pPrivate;
@@ -2616,6 +2620,8 @@ addCoreSettingsFromXMLNode (CCSContext * context,
initRulesFromRootNode (plugin, node, pluginInfoPBv);
context->plugins = ccsPluginListAppend (context->plugins, plugin);
+
+ return TRUE;
}
/* End of XML parsing */
@@ -2711,7 +2717,8 @@ writePBFile (char *pbFilePath,
}
#endif
-static void
+/* Returns TRUE on success. */
+static Bool
loadPluginFromXML (CCSContext * context,
xmlDoc * doc,
char *filename,
@@ -2719,20 +2726,25 @@ loadPluginFromXML (CCSContext * context,
{
xmlNode **nodes;
int num;
+ Bool success = FALSE;
nodes = getNodesFromXPath (doc, NULL, "/compiz/core", &num);
if (num)
{
- addCoreSettingsFromXMLNode (context, nodes[0], filename, pluginInfoPBv);
+ success = addCoreSettingsFromXMLNode (context, nodes[0], filename,
+ pluginInfoPBv);
free (nodes);
+ return success;
}
nodes = getNodesFromXPath (doc, NULL, "/compiz/plugin", &num);
if (num)
{
- addPluginFromXMLNode (context, nodes[0], filename, pluginInfoPBv);
+ success = addPluginFromXMLNode (context, nodes[0], filename,
+ pluginInfoPBv);
free (nodes);
}
+ return success;
}
#ifdef USE_PROTOBUF
@@ -2830,6 +2842,7 @@ loadPluginFromXMLFile (CCSContext * context, char *xmlName, char *xmlDirPath)
// Load from .xml
FILE *fp = fopen (xmlFilePath, "r");
+ Bool xmlLoaded = FALSE;
if (fp)
{
@@ -2837,14 +2850,15 @@ loadPluginFromXMLFile (CCSContext * context, char *xmlName, char *xmlDirPath)
xmlDoc *doc = xmlReadFile (xmlFilePath, NULL, 0);
if (doc)
{
- loadPluginFromXML (context, doc, xmlFilePath, pluginInfoPBv);
+ xmlLoaded = loadPluginFromXML (context, doc, xmlFilePath,
+ pluginInfoPBv);
xmlFreeDoc (doc);
}
}
free (xmlFilePath);
#ifdef USE_PROTOBUF
- if (usingProtobuf)
+ if (usingProtobuf && xmlLoaded)
{
writePBFile (pbFilePath, NULL, &persistentPluginBriefPB);
commit f6f66a73f13b42390ecd47ab769c37debf116943
Author: Danny Baumann <dannybaumann@web.de>
Date: Thu Nov 6 13:07:47 2008 +0100
Fix memory leak.
diff --git a/src/compiz.cpp b/src/compiz.cpp
index f507a0f..1efabb4 100644
--- a/src/compiz.cpp
+++ b/src/compiz.cpp
@@ -2502,6 +2502,13 @@ addPluginFromXMLNode (CCSContext * context,
return;
}
+ if (!strcmp (name, "ini") || !strcmp (name, "gconf") ||
+ !strcmp (name, "ccp") || !strcmp (name, "kconfig"))
+ {
+ free (name);
+ return;
+ }
+
if (ccsFindPlugin (context, name))
{
free (name);
@@ -2547,13 +2554,6 @@ addPluginFromXMLNode (CCSContext * context,
fillBasicInfoIntoPB (plugin, (PluginInfoMetadata *) pluginInfoPBv);
#endif
- if (!strcmp (name, "ini") || !strcmp (name, "gconf") ||
- !strcmp (name, "ccp") || !strcmp (name, "kconfig"))
- {
- free (name);
- return;
- }
-
initRulesFromRootNode (plugin, node, pluginInfoPBv);
context->plugins = ccsPluginListAppend (context->plugins, plugin);
commit 246006056a24c087112a22b3c72611f8c0683270
Author: Erkin Bahceci <erkinbah@gmail.com>
Date: Wed Oct 22 17:33:33 2008 -0500
Create protobuf cache dir recursively.
Enables using ".../x/y" as cache dir when ".../x" doesn't exist.
diff --git a/include/ccs.h b/include/ccs.h
index e9cd44e..9d886d5 100644
--- a/include/ccs.h
+++ b/include/ccs.h
@@ -715,6 +715,8 @@ void ccsIniClose (IniDictionary *dictionary);
void ccsIniSave (IniDictionary *dictionary,
const char *fileName);
+Bool ccsCreateDirFor (const char *fileName);
+
Bool ccsIniGetString (IniDictionary *dictionary,
const char *section,
const char *entry,
diff --git a/src/compiz.cpp b/src/compiz.cpp
index 0c46ea4..f507a0f 100644
--- a/src/compiz.cpp
+++ b/src/compiz.cpp
@@ -1933,14 +1933,13 @@ createProtoBufCacheDir ()
if (cacheBaseDir)
{
metadataCacheDir = cacheBaseDir;
- metadataCacheDir += "/compizconfig";
-
- // Create base dir
- mkdir (cacheBaseDir, 0700);
+ if (metadataCacheDir[metadataCacheDir.length () - 1] != '/')
+ metadataCacheDir += "/";
+ metadataCacheDir += "compizconfig";
+ std::string metadataCacheFileDummy = metadataCacheDir + "/dummy";
// Create cache dir
- Bool success = !mkdir (metadataCacheDir.c_str (), 0700);
- success |= (errno == EEXIST);
+ Bool success = ccsCreateDirFor (metadataCacheFileDummy.c_str ());
if (!success)
fprintf (stderr, "[ERROR]: Error creating directory \"%s\"\n",
metadataCacheDir.c_str ());
diff --git a/src/ini.c b/src/ini.c
index 3c3c419..5f8e2bc 100644
--- a/src/ini.c
+++ b/src/ini.c
@@ -35,7 +35,7 @@
* @return: True if the parent directory of the file now exists
**/
-static Bool
+Bool
ccsCreateDirFor (const char *fileName)
{
char *path, *delim;
commit d6ecf8ae663dbac371729da70f37f8a3c8821e51
Author: Lubos Lunak <llunak@suse.cz>
Date: Wed Oct 22 12:13:16 2008 +0200
Fix copy'n'paste mistakes in allocation size.
diff --git a/src/lists.c b/src/lists.c
index 103f13a..5f58a2a 100644
--- a/src/lists.c
+++ b/src/lists.c
@@ -257,7 +257,7 @@ char ** ccsGetStringArrayFromValueList (CCSSettingValueList list, int *num)
if (length)
{
- rv = calloc (length, sizeof (int));
+ rv = calloc (length, sizeof (char *));
if (!rv)
return NULL;
}
@@ -278,7 +278,7 @@ char ** ccsGetMatchArrayFromValueList (CCSSettingValueList list, int *num)
if (length)
{
- rv = calloc (length, sizeof (int));
+ rv = calloc (length, sizeof (char *));
if (!rv)
return NULL;
}
commit fae747aa92479c3ff9ab62ad5aa333c175fcab7a
Author: Erkin Bahceci <erkinbah@gmail.com>
Date: Sun Oct 19 17:25:15 2008 -0500
Disable protobuf if cache dir cannot be created.
diff --git a/src/compiz.cpp b/src/compiz.cpp
index 9e610e0..0c46ea4 100644
--- a/src/compiz.cpp
+++ b/src/compiz.cpp
@@ -1952,6 +1952,7 @@ createProtoBufCacheDir ()
metadataCacheDir = ""; // invalidate metadataCacheDir
}
+ usingProtobuf = FALSE; // Disable protobuf if cache dir cannot be created
return FALSE;
}
commit 5519ac6e74c056750eca8fb543822326fd0f43b8
Author: Erkin Bahceci <erkinbah@gmail.com>
Date: Sun Oct 19 17:04:42 2008 -0500
Use $XDG_CACHE_HOME/compizconfig/ as protobuf cache directory.
As protobuf cache dir, we now use $XDG_CACHE_HOME/compizconfig/
if $XDG_CACHE_HOME is defined and ~/.cache/compizconfig/ otherwise,
to conform to the standards described at
http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html
diff --git a/src/compiz.cpp b/src/compiz.cpp
index 18db39e..9e610e0 100644
--- a/src/compiz.cpp
+++ b/src/compiz.cpp
@@ -55,8 +55,6 @@ Bool usingProtobuf = TRUE;
#define PB_ABI_VERSION 20081004
-#define METADATA_CACHE_DIR ".config/compiz/compizconfig/cache"
-
typedef metadata::PluginInfo PluginInfoMetadata;
typedef metadata::PluginBrief PluginBriefMetadata;
typedef metadata::Plugin PluginMetadata;
@@ -74,6 +72,8 @@ PluginMetadata persistentPluginPB; // Made global so that it gets reused,
// for better performance (to avoid
// mem alloc/free for each plugin)
+std::string metadataCacheDir = "";
+
static char *
getLocale ()
{
@@ -1908,25 +1908,50 @@ checkAddGroupSubgroup (OptionMetadata *optPB,
static Bool
createProtoBufCacheDir ()
{
- char *path = NULL;
- char *home = getenv ("HOME");
+ if (metadataCacheDir.length () > 0)
+ {
+ // Cache dir must have been created already, since otherwise it would
+ // be "". So we can return here.
+ return TRUE;
+ }
+ char *cacheBaseDir = NULL;
+ char *cacheHome = getenv ("XDG_CACHE_HOME");
- if (home && strlen (home))
+ if (cacheHome && strlen (cacheHome))
{
- asprintf (&path, "%s/%s", home, METADATA_CACHE_DIR);
- if (path)
+ asprintf (&cacheBaseDir, "%s", cacheHome);
+ }
+ else
+ {
+ char *home = getenv ("HOME");
+ if (home && strlen (home))
{
- Bool success = !mkdir (path, 0700);
- success |= (errno == EEXIST);
- if (!success)
- fprintf (stderr, "[ERROR]: Error creating directory \"%s\"\n",
- path);
- free (path);
-
- if (success)
- return TRUE;
+ asprintf (&cacheBaseDir, "%s/.cache", home);
}
}
+
+ if (cacheBaseDir)
+ {
+ metadataCacheDir = cacheBaseDir;
+ metadataCacheDir += "/compizconfig";
+
+ // Create base dir
+ mkdir (cacheBaseDir, 0700);
+
+ // Create cache dir
+ Bool success = !mkdir (metadataCacheDir.c_str (), 0700);
+ success |= (errno == EEXIST);
+ if (!success)
+ fprintf (stderr, "[ERROR]: Error creating directory \"%s\"\n",
+ metadataCacheDir.c_str ());
+ free (cacheBaseDir);
+
+ if (success)
+ return TRUE; // metadataCacheDir will be used later in this case
+
+ metadataCacheDir = ""; // invalidate metadataCacheDir
+ }
+
return FALSE;
}
@@ -2764,11 +2789,10 @@ loadPluginFromXMLFile (CCSContext * context, char *xmlName, char *xmlDirPath)
strncpy (name, xmlName, lenXMLName - 4);
name[lenXMLName - 4] = '\0';
- char *home = getenv ("HOME");
- if (home && strlen (home))
+ if (createProtoBufCacheDir () &&
+ metadataCacheDir.length () > 0)
{
- asprintf (&pbFilePath, "%s/%s/%s.pb",
- home, METADATA_CACHE_DIR, name);
+ asprintf (&pbFilePath, "%s/%s.pb", metadataCacheDir.c_str (), name);
if (!pbFilePath)
{
fprintf (stderr, "[ERROR]: Can't allocate memory\n");
commit afe4ed1ece82778cfcdade60057d58aeeb9818d8
Author: Erkin Bahceci <erkinbah@gmail.com>
Date: Sun Oct 19 15:55:00 2008 -0500
Fix circular dependency error (bug 1061).
diff --git a/configure.ac b/configure.ac
index b1926c6..0ce5d31 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,6 +6,8 @@ AC_INIT([libcompizconfig],esyscmd(. ./VERSION;echo -n $VERSION), [dev@opencompos
AM_INIT_AUTOMAKE([1.9 dist-bzip2])
+AC_PROG_CXX
+
AC_CONFIG_HEADER([config.h])
AM_MAINTAINER_MODE
@@ -97,7 +99,6 @@ AC_ARG_ENABLE(protobuf,
[use_protobuf=$enableval], [use_protobuf=yes])
if test "x$use_protobuf" = "xyes"; then
- AC_LANG([C++])
protobuf_error_msg="\nWARNING: You need to install Protocol Buffers to get faster program startup.\n Sources are available at http://code.google.com/p/protobuf/downloads/list\n Package names for Ubuntu/Debian: libprotobuf0, libprotobuf-dev, protobuf-compiler\n Package names for other distributions: protobuf, protobuf-devel\n Disabling protobuf.\n"
AC_CHECK_PROG(have_protoc, protoc, yes, no)
if test "x$have_protoc" = "xno"; then
@@ -106,11 +107,12 @@ if test "x$use_protobuf" = "xyes"; then
AC_CHECK_LIB(protobuf, _ZN6google8protobuf7MessageD2Ev, [], [
echo -e $protobuf_error_msg; use_protobuf=no ])
if test "x$use_protobuf" = "xyes"; then
+ AC_LANG([C++])
AC_CHECK_HEADER([google/protobuf/message.h],,[
echo -e $protobuf_error_msg; use_protobuf=no ])
+ AC_LANG([C])
fi
fi
- AC_LANG([C])
fi
AM_CONDITIONAL([USE_PROTOBUF], [test "x$use_protobuf" = "xyes"])
commit 21bda9debec54b37342eb5ee037fc81aeb32cbc8
Author: Erkin Bahceci <erkinbah@gmail.com>
Date: Sun Oct 19 10:04:02 2008 -0500
Add source URL to protobuf warning message.
diff --git a/configure.ac b/configure.ac
index db96a78..b1926c6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -98,7 +98,7 @@ AC_ARG_ENABLE(protobuf,
if test "x$use_protobuf" = "xyes"; then
AC_LANG([C++])
- protobuf_error_msg="\nWARNING: You need to install Protocol Buffers to get faster program startup.\n Package names for Ubuntu/Debian: libprotobuf0, libprotobuf-dev, protobuf-compiler\n Package names for other distributions: protobuf, protobuf-devel\n Disabling protobuf.\n"
+ protobuf_error_msg="\nWARNING: You need to install Protocol Buffers to get faster program startup.\n Sources are available at http://code.google.com/p/protobuf/downloads/list\n Package names for Ubuntu/Debian: libprotobuf0, libprotobuf-dev, protobuf-compiler\n Package names for other distributions: protobuf, protobuf-devel\n Disabling protobuf.\n"
AC_CHECK_PROG(have_protoc, protoc, yes, no)
if test "x$have_protoc" = "xno"; then
echo -e $protobuf_error_msg; use_protobuf=no
commit 514ba489124b029960f4d8e94cac6bd0c3205de6
Author: Erkin Bahceci <erkinbah@gmail.com>
Date: Sun Oct 19 09:23:25 2008 -0500
Add compizconfig.proto to dist. Simplify Makefile.am.
diff --git a/src/Makefile.am b/src/Makefile.am
index 1411996..5782087 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,6 +4,8 @@ PROTOBUF_LIB = -lprotobuf
PROTOBUF_DEFINES = \
-DUSE_PROTOBUF=1
+EXTRA_DIST = compizconfig.proto
+
compizconfig.pb.cc: compizconfig.proto
protoc --cpp_out=. compizconfig.proto
@@ -17,11 +19,6 @@ nodist_libcompizconfig_la_SOURCES = \
clean-local:
rm -f compizconfig.pb.cc compizconfig.pb.h
-else
-
-PROTOBUF_LIB =
-nodist_libcompizconfig_la_SOURCES =
-
endif
commit 741f99ade7e9b9d19e367253273c11519ac348f0
Author: Danny Baumann <dannybaumann@web.de>
Date: Sun Oct 19 14:03:15 2008 +0200
Link against libX11 because we need it for XStringToKeysym.
diff --git a/configure.ac b/configure.ac
index 1668771..1f8cbb4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -73,6 +73,7 @@ fi
AC_C_BIGENDIAN
+PKG_CHECK_MODULES(LIBX11, "x11")
PKG_CHECK_MODULES(COMPIZ, "compiz")
if test -z "$PKG_CONFIG"; then
diff --git a/src/Makefile.am b/src/Makefile.am
index ac7424f..5dff962 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,11 +1,12 @@
-INCLUDES = \
- @COMPIZ_CFLAGS@ \
- @LIBXML2_CFLAGS@ \
- -I$(top_srcdir)/include \
- -I$(top_srcdir)/src \
- -DPLUGINDIR=\"$(PLUGINDIR)\" \
- -DMETADATADIR=\"$(METADATADIR)\" \
- -DLIBDIR=\"$(libdir)\" \
+INCLUDES = \
+ @COMPIZ_CFLAGS@ \
+ @LIBX11_CFLAGS@ \
+ @LIBXML2_CFLAGS@ \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/src \
+ -DPLUGINDIR=\"$(PLUGINDIR)\" \
+ -DMETADATADIR=\"$(METADATADIR)\" \
+ -DLIBDIR=\"$(libdir)\" \
-DGLOBALMETADATA=\"$(globalmetadata)\" \
-DSYSCONFDIR=\"$(sysconfdir)\"
@@ -22,7 +23,7 @@ libcompizconfig_la_SOURCES = \
ccs-private.h \
iniparser.h
-libcompizconfig_la_LIBADD = @LIBXML2_LIBS@
+libcompizconfig_la_LIBADD = @LIBXML2_LIBS@ @LIBX11_LIBS@
lib_LTLIBRARIES=libcompizconfig.la
commit 4431eeec30226cb81ffa2df868d9bbe9b2f76145
Author: Erkin Bahceci <erkinbah@gmail.com>
Date: Sat Oct 18 15:44:50 2008 -0500
Clean up whitespace.
diff --git a/src/compiz.cpp b/src/compiz.cpp
index d6d38d9..18db39e 100644
--- a/src/compiz.cpp
+++ b/src/compiz.cpp
@@ -999,13 +999,13 @@ getOptionType (const char *name)
{ "bool", TypeBool },
{ "int", TypeInt },
{ "float", TypeFloat },
- { "string", TypeString },
+ { "string", TypeString },
{ "color", TypeColor },
{ "action", TypeAction },
{ "key", TypeKey },
{ "button", TypeButton },
- { "edge", TypeEdge },
- { "bell", TypeBell },
+ { "edge", TypeEdge },
+ { "bell", TypeBell },
{ "match", TypeMatch },
{ "list", TypeList }
};
@@ -1448,7 +1448,7 @@ initEdgeValue (CCSSettingValue * v,
"Right",
"Top",
"Bottom",
- "TopLeft",
+ "TopLeft",
"TopRight",
"BottomLeft",
"BottomRight"
@@ -1622,7 +1622,7 @@ initIntInfo (CCSSettingInfo * i, xmlNode * node, void * optionPBv)
if (val >= i->forInt.min && val <= i->forInt.max)
{
name = stringFromNodeDefTrans (nodes[j],
- "name/child::text()",
+ "name/child::text()",
NULL);
if (name)
{
@@ -1910,7 +1910,7 @@ createProtoBufCacheDir ()
{
char *path = NULL;
char *home = getenv ("HOME");
-
+
if (home && strlen (home))
{
asprintf (&path, "%s/%s", home, METADATA_CACHE_DIR);
@@ -2588,7 +2588,7 @@ addCoreSettingsFromXMLNode (CCSContext * context,
#ifdef USE_PROTOBUF
fillBasicInfoIntoPB (plugin, (PluginInfoMetadata *) pluginInfoPBv);
#endif
-
+
initRulesFromRootNode (plugin, node, pluginInfoPBv);
context->plugins = ccsPluginListAppend (context->plugins, plugin);
}
@@ -2743,7 +2743,7 @@ loadPluginFromXMLFile (CCSContext * context, char *xmlName, char *xmlDirPath)
if (usingProtobuf)
{
struct stat xmlStat;
-
+
if (stat (xmlFilePath, &xmlStat))
{
free (xmlFilePath);
commit 6706b47468cb9adb8d39a891a38bd30984aab4a5
Author: Erkin Bahceci <erkinbah@gmail.com>
Date: Sat Oct 18 15:26:33 2008 -0500
Disable protobuf automatically if not installed.
diff --git a/configure.ac b/configure.ac
index c798edb..9f9edea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -96,9 +96,20 @@ AC_ARG_ENABLE(protobuf,
[use_protobuf=$enableval], [use_protobuf=yes])
if test "x$use_protobuf" = "xyes"; then
- AC_CHECK_PROG(have_protoc, protoc, yes)
-
- AC_CHECK_LIB(protobuf, _ZN6google8protobuf7MessageD2Ev)
+ AC_LANG([C++])
+ protobuf_error_msg="\nWARNING: You need to install Protocol Buffers to get faster program startup.\n Package names for Ubuntu/Debian: libprotobuf0, libprotobuf-dev, protobuf-compiler\n Package names for other distributions: protobuf, protobuf-devel\n Disabling protobuf.\n"
+ AC_CHECK_PROG(have_protoc, protoc, yes, no)
+ if test "x$have_protoc" = "xno"; then
+ echo -e $protobuf_error_msg; use_protobuf=no
+ else
+ AC_CHECK_LIB(protobuf, _ZN6google8protobuf7MessageD2Ev, [], [
+ echo -e $protobuf_error_msg; use_protobuf=no ])
+ if test "x$use_protobuf" = "xyes"; then
+ AC_CHECK_HEADER([google/protobuf/message.h],,[
+ echo -e $protobuf_error_msg; use_protobuf=no ])
+ fi
+ fi
+ AC_LANG([C])
fi
AM_CONDITIONAL([USE_PROTOBUF], [test "x$use_protobuf" = "xyes"])
commit 37dab05e44d3c8d1f75a1fa15f69a8ee7b18aed7
Author: Erkin Bahceci <erkinbah@gmail.com>
Date: Sat Oct 4 17:58:17 2008 -0500
Speed up metadata parsing via protocol buffers.
Reduces startup times for compiz, ccsm, and simple-ccsm.
diff --git a/configure.ac b/configure.ac
index 19f2e38..c798edb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -91,6 +91,17 @@ AC_SUBST(plugindir)
PKG_CHECK_MODULES(LIBXML2, "libxml-2.0")
AC_SUBST(LIBXML2_REQUIRES)
+AC_ARG_ENABLE(protobuf,
+ [ --disable-protobuf Disable Protocol Buffers],
+ [use_protobuf=$enableval], [use_protobuf=yes])
+
+if test "x$use_protobuf" = "xyes"; then
+ AC_CHECK_PROG(have_protoc, protoc, yes)
+
+ AC_CHECK_LIB(protobuf, _ZN6google8protobuf7MessageD2Ev)
+fi
+AM_CONDITIONAL([USE_PROTOBUF], [test "x$use_protobuf" = "xyes"])
+
AC_CHECK_HEADERS([sys/inotify.h], [have_inotify=yes], [have_inotify=no])
AC_ARG_ENABLE(debug,
diff --git a/include/ccs.h b/include/ccs.h
index 92af4fc..e9cd44e 100644
--- a/include/ccs.h
+++ b/include/ccs.h
@@ -182,17 +182,19 @@ struct _CCSPlugin
typedef enum _CCSSettingType
{
+ /* This needs to be in the same order as CompOptionType for consistency */
TypeBool,
TypeInt,
TypeFloat,
TypeString,
TypeColor,
- TypeMatch,
- TypeList,
+ TypeAction,
TypeKey,
TypeButton,
TypeEdge,
TypeBell,
+ TypeMatch,
+ TypeList,
TypeNum
} CCSSettingType;
diff --git a/src/Makefile.am b/src/Makefile.am
index e3f0eac..1411996 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,3 +1,30 @@
+if USE_PROTOBUF
+
+PROTOBUF_LIB = -lprotobuf
+PROTOBUF_DEFINES = \
+ -DUSE_PROTOBUF=1
+
+compizconfig.pb.cc: compizconfig.proto
+ protoc --cpp_out=. compizconfig.proto
+
+compizconfig.pb.h: compizconfig.pb.cc
+
+compiz.cpp: compizconfig.pb.h Makefile
+
+nodist_libcompizconfig_la_SOURCES = \
+ compizconfig.pb.cc
+
+clean-local:
+ rm -f compizconfig.pb.cc compizconfig.pb.h
+
+else
+
+PROTOBUF_LIB =
+nodist_libcompizconfig_la_SOURCES =
+
+endif
+
+
INCLUDES = \
@COMPIZ_CFLAGS@ \
@LIBXML2_CFLAGS@ \
@@ -6,13 +33,14 @@ INCLUDES = \
-DPLUGINDIR=\"$(PLUGINDIR)\" \
-DMETADATADIR=\"$(METADATADIR)\" \
-DLIBDIR=\"$(libdir)\" \
+ $(PROTOBUF_DEFINES) \
-DSYSCONFDIR=\"$(sysconfdir)\"
libcompizconfig_la_SOURCES = \
main.c \
lists.c \
- compiz.c \
+ compiz.cpp \
config.c \
iniparser.c \
ini.c \
@@ -21,7 +49,7 @@ libcompizconfig_la_SOURCES = \
ccs-private.h \
iniparser.h
-libcompizconfig_la_LIBADD = @LIBXML2_LIBS@
+libcompizconfig_la_LIBADD = @LIBXML2_LIBS@ $(PROTOBUF_LIB)
lib_LTLIBRARIES=libcompizconfig.la
diff --git a/src/ccs-private.h b/src/ccs-private.h
index 3ae3255..4909379 100644
--- a/src/ccs-private.h
+++ b/src/ccs-private.h
@@ -51,6 +51,9 @@ typedef struct _CCSPluginPrivate
Bool active;
char * xmlFile;
Reply to: