fix bug 473896

This commit is contained in:
drago01 2009-07-10 11:57:02 +00:00
parent 22305bde9f
commit af951951b0
2 changed files with 109 additions and 32 deletions

View File

@ -1,6 +1,6 @@
diff -upNr compiz-0.8.2.orign/include/compiz-core.h compiz-0.8.2/include/compiz-core.h
--- compiz-0.8.2.orign/include/compiz-core.h 2009-02-15 10:10:23.000000000 +0100
+++ compiz-0.8.2/include/compiz-core.h 2009-05-25 21:15:24.502138356 +0200
+++ compiz-0.8.2/include/compiz-core.h 2009-07-10 13:53:53.353467924 +0200
@@ -220,6 +220,9 @@ extern Bool noDetection;
extern Bool useDesktopHints;
extern Bool onlyCurrentScreen;
@ -13,50 +13,123 @@ diff -upNr compiz-0.8.2.orign/include/compiz-core.h compiz-0.8.2/include/compiz-
diff -upNr compiz-0.8.2.orign/src/display.c compiz-0.8.2/src/display.c
--- compiz-0.8.2.orign/src/display.c 2009-02-15 10:10:23.000000000 +0100
+++ compiz-0.8.2/src/display.c 2009-05-25 21:15:24.503089882 +0200
@@ -675,7 +675,7 @@ updatePlugins (CompDisplay *d)
+++ compiz-0.8.2/src/display.c 2009-07-10 13:53:53.354468151 +0200
@@ -675,24 +675,59 @@ updatePlugins (CompDisplay *d)
{
CompOption *o;
CompPlugin *p, **pop = 0;
- int nPop, i, j;
+ int nPop, i, j, k;
+ int nPop, i, j, k, dupPluginCount;
+ CompOptionValue *pList;
+ int pList_count;
d->dirtyPluginList = FALSE;
@@ -715,6 +715,30 @@ updatePlugins (CompDisplay *d)
o = &d->opt[COMP_DISPLAY_OPTION_ACTIVE_PLUGINS];
- /* The old plugin list always begins with the core plugin. To make sure
- we don't unnecessarily unload plugins if the new plugin list does not
- contain the core plugin, we have to use an offset */
- if (o->value.list.nValue > 0 && strcmp (o->value.list.value[0].s, "core"))
- i = 0;
- else
- i = 1;
+ /* Make sure the new plugin list always list core first, then the
+ initial plugins... */
+ dupPluginCount = 0;
+ for (i=0; i < o->value.list.nValue; ++i) {
+ if (strcmp(o->value.list.value[i].s, "core") == 0)
+ ++dupPluginCount;
+ else
+ for (j=0; j < nInitialPlugins; ++j)
+ if (strcmp(o->value.list.value[i].s, initialPlugins[j]) == 0) {
+ ++dupPluginCount;
+ break;
+ }
+ }
+
+ pList_count = 1+nInitialPlugins+o->value.list.nValue-dupPluginCount;
+
+ pList = malloc(sizeof(CompOptionValue) * pList_count);
+ if (!pList) {
+ (*core.setOptionForPlugin) (&d->base, "core", o->name, &d->plugin);
+ return;
+ }
+
+ pList[0].s = "core";
+ for (j=0; j < nInitialPlugins; ++j)
+ pList[j+1].s = initialPlugins[j];
+ ++j;
+
+ for (i=0; i < o->value.list.nValue; ++i) {
+ if (strcmp(o->value.list.value[i].s, "core") == 0)
+ goto L_nextPlugin;
+ else
+ for (k=0; k < nInitialPlugins; ++k)
+ if (strcmp(o->value.list.value[i].s, initialPlugins[k]) == 0)
+ goto L_nextPlugin;
+ pList[j++].s = o->value.list.value[i].s;
+ L_nextPlugin:
+ (void)0;
+ }
+
+ assert(j == pList_count);
/* j is initialized to 1 to make sure we never pop the core plugin */
- for (j = 1; j < d->plugin.list.nValue && i < o->value.list.nValue; i++, j++)
+ for (i = j = 1; j < d->plugin.list.nValue && i < pList_count; i++, j++)
{
- if (strcmp (d->plugin.list.value[j].s, o->value.list.value[i].s))
+ if (strcmp (d->plugin.list.value[j].s, pList[i].s))
break;
}
@@ -704,6 +739,7 @@ updatePlugins (CompDisplay *d)
if (!pop)
{
(*core.setOptionForPlugin) (&d->base, "core", o->name, &d->plugin);
+ free(pList);
return;
}
}
@@ -715,13 +751,13 @@ updatePlugins (CompDisplay *d)
free (d->plugin.list.value[d->plugin.list.nValue].s);
}
+ for ( k = 0; k < nInitialPlugins; k++)
+ {
+ for ( j = 0; j < nPop; j++)
+ {
+ if (pop[j] && strcmp (pop[j]->vTable->name,
+ initialPlugins[k]) == 0)
+ break;
+ }
+
+ if ( j == (nPop - 1))
+ {
+ p = loadPlugin (initialPlugins[k]);
+ if (p)
+ {
+ if (!pushPlugin (p))
+ {
+ unloadPlugin (p);
+ p = 0;
+ }
+ }
+ }
+ }
+
+
for (; i < o->value.list.nValue; i++)
- for (; i < o->value.list.nValue; i++)
+ for (; i < pList_count; i++)
{
p = 0;
for (j = 0; j < nPop; j++)
{
if (pop[j] && strcmp (pop[j]->vTable->name,
- o->value.list.value[i].s) == 0)
+ pList[i].s) == 0)
{
if (pushPlugin (pop[j]))
{
@@ -734,7 +770,7 @@ updatePlugins (CompDisplay *d)
if (p == 0)
{
- p = loadPlugin (o->value.list.value[i].s);
+ p = loadPlugin (pList[i].s);
if (p)
{
if (!pushPlugin (p))
@@ -775,7 +811,9 @@ updatePlugins (CompDisplay *d)
if (nPop)
free (pop);
+ free(pList);
(*core.setOptionForPlugin) (&d->base, "core", o->name, &d->plugin);
+
}
static void
diff -upNr compiz-0.8.2.orign/src/main.c compiz-0.8.2/src/main.c
--- compiz-0.8.2.orign/src/main.c 2009-02-16 14:57:22.000000000 +0100
+++ compiz-0.8.2/src/main.c 2009-05-25 21:15:24.503089882 +0200
+++ compiz-0.8.2/src/main.c 2009-07-10 13:53:53.354468151 +0200
@@ -40,6 +40,9 @@ char *programName;
char **programArgv;
int programArgc;

View File

@ -14,7 +14,7 @@ URL: http://www.go-compiz.org
License: GPLv2+ and LGPLv2+ and MIT
Group: User Interface/Desktops
Version: 0.8.2
Release: 3%{?dist}
Release: 4%{?dist}
Summary: OpenGL window and compositing manager
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -356,6 +356,10 @@ rm -rf $RPM_BUILD_ROOT
%changelog
* Fri Jul 10 2009 Adel Gadllah <adel.gadllah@gmail.com> - 0.8.2-4
- Replace compiz-0.8.2-pin-initial-plugins with a fixed up one
by Philippe Troin <phil@fifi.org> (RH #473896)
* Mon Jun 8 2009 Matthias Clasen <mclasen@redhat.com> - 0.8.2-3
- Fix handling of --replace in compiz-gtk, _again_