summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Reveman <davidr@novell.com>2007-09-05 11:42:35 -0400
committerDavid Reveman <davidr@novell.com>2007-09-05 11:42:35 -0400
commitd041be6ec22b5330034866cf1f9a600f26619c3f (patch)
tree51b7c68ea12f69314e2f788c1cfc2413eacd7bae
parent4530cf0f095df003bb9d18586999efbcd4f72154 (diff)
Remove compDisplays variable and add comments to code
which break support for multiple displays.
-rw-r--r--include/compiz-core.h2
-rw-r--r--plugins/dbus.c49
-rw-r--r--plugins/fuse.c31
-rw-r--r--plugins/gconf.c2
-rw-r--r--plugins/ini.c36
-rw-r--r--src/display.c32
-rw-r--r--src/main.c2
-rw-r--r--src/plugin.c3
8 files changed, 60 insertions, 97 deletions
diff --git a/include/compiz-core.h b/include/compiz-core.h
index 410b4d56..6f5ade3f 100644
--- a/include/compiz-core.h
+++ b/include/compiz-core.h
@@ -1006,8 +1006,6 @@ struct _CompDisplay {
LogMessageProc logMessage;
};
-extern CompDisplay *compDisplays;
-
#define GET_CORE_DISPLAY(object) ((CompDisplay *) (object))
#define CORE_DISPLAY(object) CompDisplay *d = GET_CORE_DISPLAY (object)
diff --git a/plugins/dbus.c b/plugins/dbus.c
index 5ba1ba06..c5b9ceec 100644
--- a/plugins/dbus.c
+++ b/plugins/dbus.c
@@ -93,26 +93,20 @@ dbusGetOptionsFromPath (char **path,
CompPlugin *p;
CompObject *object;
- if (strcmp (path[1], "allscreens"))
- {
- CompScreen *s;
- int screenNum;
-
- if (sscanf (path[1], "screen%d", &screenNum) != 1)
- return FALSE;
-
- for (s = compDisplays->screens; s; s = s->next)
- if (s->screenNum == screenNum)
- break;
+ object = compObjectFind (&core.base, COMP_OBJECT_TYPE_DISPLAY, NULL);
+ if (!object)
+ return NULL;
- if (!s)
+ if (strncmp (path[1], "screen", 6) == 0)
+ {
+ object = compObjectFind (object, COMP_OBJECT_TYPE_SCREEN,
+ path[1] + 6);
+ if (!object)
return NULL;
-
- object = &s->base;
}
- else
+ else if (strcmp (path[1], "allscreens") != 0)
{
- object = &compDisplays->base;
+ return NULL;
}
if (returnObject)
@@ -329,11 +323,13 @@ dbusHandleRootIntrospectMessage (DBusConnection *connection,
return TRUE;
}
+/* MULTIDPYERROR: only works with one or less displays present */
static Bool
dbusHandlePluginIntrospectMessage (DBusConnection *connection,
DBusMessage *message,
char **path)
{
+ CompDisplay *d;
CompScreen *s;
char screenName[256];
@@ -345,12 +341,15 @@ dbusHandlePluginIntrospectMessage (DBusConnection *connection,
dbusIntrospectStartRoot (writer);
- dbusIntrospectAddNode (writer, "allscreens");
-
- for (s = compDisplays->screens; s; s = s->next)
+ for (d = core.displays; d; d = d->next)
{
- sprintf (screenName, "screen%d", s->screenNum);
- dbusIntrospectAddNode (writer, screenName);
+ dbusIntrospectAddNode (writer, "allscreens");
+
+ for (s = d->screens; s; s = s->next)
+ {
+ sprintf (screenName, "screen%d", s->screenNum);
+ dbusIntrospectAddNode (writer, screenName);
+ }
}
dbusIntrospectEndRoot (writer);
@@ -2207,10 +2206,12 @@ dbusSetOptionForPlugin (CompObject *object,
{
CompScreen *s;
- dbusUnregisterPluginsForDisplay (dc->connection, compDisplays);
- dbusRegisterPluginsForDisplay (dc->connection, compDisplays);
+ CORE_DISPLAY (object);
+
+ dbusUnregisterPluginsForDisplay (dc->connection, d);
+ dbusRegisterPluginsForDisplay (dc->connection, d);
- for (s = compDisplays->screens; s; s = s->next)
+ for (s = d->screens; s; s = s->next)
{
dbusUnregisterPluginsForScreen (dc->connection, s);
dbusRegisterPluginsForScreen (dc->connection, s);
diff --git a/plugins/fuse.c b/plugins/fuse.c
index d290c342..ddfc45e7 100644
--- a/plugins/fuse.c
+++ b/plugins/fuse.c
@@ -211,26 +211,25 @@ fuseLookupChild (FuseInode *inode,
return NULL;
}
+/* MULTIDPYERROR: only works with one or less displays present */
+/* OBJECTOPTION: only display and screen options are supported */
static CompObject *
fuseGetObjectFromInode (FuseInode *inode)
{
- if (inode->type & FUSE_INODE_TYPE_SCREEN)
- {
- CompScreen *s;
- int screenNum = -1;
+ CompObject *object;
- sscanf (inode->name, "screen%d", &screenNum);
-
- for (s = compDisplays->screens; s; s = s->next)
- if (s->screenNum == screenNum)
- break;
+ object = compObjectFind (&core.base, COMP_OBJECT_TYPE_DISPLAY, NULL);
+ if (!object)
+ return NULL;
- if (s)
- return &s->base;
+ if (inode->type & FUSE_INODE_TYPE_SCREEN)
+ {
+ return compObjectFind (object, COMP_OBJECT_TYPE_SCREEN,
+ inode->name + 6);
}
else if (inode->type & FUSE_INODE_TYPE_DISPLAY)
{
- return &compDisplays->base;
+ return object;
}
return NULL;
@@ -288,6 +287,7 @@ fuseGetOptionFromInode (FuseInode *inode)
return NULL;
}
+/* MULTIDPYERROR: only works with one or less displays present */
static char *
fuseGetStringFromInode (FuseInode *inode)
{
@@ -348,9 +348,12 @@ fuseGetStringFromInode (FuseInode *inode)
case CompOptionTypeColor:
return colorToString (value->c);
case CompOptionTypeKey:
- return keyActionToString (compDisplays, &value->action);
+ if (core.displays)
+ return keyActionToString (core.displays, &value->action);
case CompOptionTypeButton:
- return buttonActionToString (compDisplays, &value->action);
+ if (core.displays)
+ return buttonActionToString (core.displays,
+ &value->action);
case CompOptionTypeEdge:
return edgeMaskToString (value->action.edgeMask);
case CompOptionTypeBell:
diff --git a/plugins/gconf.c b/plugins/gconf.c
index aa784373..43fdbfd1 100644
--- a/plugins/gconf.c
+++ b/plugins/gconf.c
@@ -570,7 +570,7 @@ gconfInitPluginForObject (CompPlugin *p,
return status;
}
-/* TODO: support for more than display and screen objects */
+/* MULTIDPYERROR: only works with one or less displays present */
static void
gconfKeyChanged (GConfClient *client,
guint cnxn_id,
diff --git a/plugins/ini.c b/plugins/ini.c
index 335a14b0..d1b79c38 100644
--- a/plugins/ini.c
+++ b/plugins/ini.c
@@ -251,9 +251,8 @@ iniGetFilename (CompObject *object,
const char *plugin,
char **filename)
{
- CompScreen *s;
- int len;
- char *fn = NULL, *screenStr;
+ int len;
+ char *fn = NULL, *screenStr;
screenStr = malloc (sizeof(char) * 12);
if (!screenStr)
@@ -261,15 +260,7 @@ iniGetFilename (CompObject *object,
if (object->type == COMP_OBJECT_TYPE_SCREEN)
{
- for (s = compDisplays->screens; s; s = s->next)
- if (&s->base == object)
- break;
-
- if (!s)
- {
- free(screenStr);
- return FALSE;
- }
+ CORE_SCREEN (object);
snprintf (screenStr, 12, "screen%d", s->screenNum);
}
@@ -578,21 +569,10 @@ static Bool
iniSaveOptions (CompObject *object,
const char *plugin)
{
- CompScreen *s = NULL;
CompOption *option = NULL;
int nOption = 0;
char *filename, *directory, *fullPath, *strVal = NULL;
- if (object->type == COMP_OBJECT_TYPE_SCREEN)
- {
- for (s = compDisplays->screens; s; s = s->next)
- if (&s->base == object)
- break;
-
- if (!s)
- return FALSE;
- }
-
if (plugin)
{
CompPlugin *p;
@@ -826,7 +806,7 @@ iniLoadOptions (CompObject *object,
compLogMessage (NULL, "ini", CompLogLevelWarn,
"Loading default plugins (%s)", DEFAULT_PLUGINS);
- (*core.setOptionForPlugin) (&compDisplays->base,
+ (*core.setOptionForPlugin) (object,
"core", "active_plugins",
&value);
@@ -893,6 +873,8 @@ iniLoadOptions (CompObject *object,
return TRUE;
}
+/* MULTIDPYERROR: only works with one or less displays present */
+/* OBJECTOPTION: only display and screen options are supported */
static void
iniFileModified (const char *name,
void *closure)
@@ -900,17 +882,17 @@ iniFileModified (const char *name,
IniFileData *fd;
fd = iniGetFileDataFromFilename (name);
- if (fd)
+ if (fd && core.displays)
{
if (fd->screen < 0)
{
- iniLoadOptions (&compDisplays->base, fd->plugin);
+ iniLoadOptions (&core.displays->base, fd->plugin);
}
else
{
CompScreen *s;
- for (s = compDisplays->screens; s; s = s->next)
+ for (s = core.displays->screens; s; s = s->next)
if (s->screenNum == fd->screen)
break;
diff --git a/src/display.c b/src/display.c
index 7b512005..1811d3f3 100644
--- a/src/display.c
+++ b/src/display.c
@@ -96,8 +96,6 @@ int pointerY = 0;
#define NUM_OPTIONS(d) (sizeof ((d)->opt) / sizeof (CompOption))
-CompDisplay *compDisplays = 0;
-
static char *displayPrivateIndices = 0;
static int displayPrivateLen = 0;
@@ -105,10 +103,10 @@ static int
reallocDisplayPrivate (int size,
void *closure)
{
- CompDisplay *d = compDisplays;
+ CompDisplay *d;
void *privates;
- if (d)
+ for (d = core.displays; d; d = d->next)
{
privates = realloc (d->base.privates, size * sizeof (CompPrivate));
if (!privates)
@@ -1553,13 +1551,14 @@ paintScreen (CompScreen *s,
}
}
+/* MULTIDPYERROR: only works with one display present */
void
eventLoop (void)
{
XEvent event;
int timeDiff;
struct timeval tv;
- CompDisplay *display = compDisplays;
+ CompDisplay *display = core.displays;
CompScreen *s;
int time, timeToNextRedraw = 0;
CompWindow *w;
@@ -1887,8 +1886,6 @@ errorHandler (Display *dpy,
#ifdef DEBUG
char str[128];
- char *name = 0;
- int o;
#endif
errors++;
@@ -1897,24 +1894,8 @@ errorHandler (Display *dpy,
XGetErrorDatabaseText (dpy, "XlibMessage", "XError", "", str, 128);
fprintf (stderr, "%s", str);
- o = e->error_code - compDisplays->damageError;
- switch (o) {
- case BadDamage:
- name = "BadDamage";
- break;
- default:
- break;
- }
-
- if (name)
- {
- fprintf (stderr, ": %s\n ", name);
- }
- else
- {
- XGetErrorText (dpy, e->error_code, str, 128);
- fprintf (stderr, ": %s\n ", str);
- }
+ XGetErrorText (dpy, e->error_code, str, 128);
+ fprintf (stderr, ": %s\n ", str);
XGetErrorDatabaseText (dpy, "XlibMessage", "MajorCode", "%d", str, 128);
fprintf (stderr, str, e->request_code);
@@ -2380,7 +2361,6 @@ addDisplay (const char *name)
}
addDisplayToCore (d);
- compDisplays = d;
d->escapeKeyCode = XKeysymToKeycode (dpy, XStringToKeysym ("Escape"));
d->returnKeyCode = XKeysymToKeycode (dpy, XStringToKeysym ("Return"));
diff --git a/src/main.c b/src/main.c
index 6bc88fb1..2f1aa894 100644
--- a/src/main.c
+++ b/src/main.c
@@ -264,8 +264,6 @@ main (int argc, char **argv)
programArgc = argc;
programArgv = argv;
- compDisplays = NULL;
-
signal (SIGHUP, signalHandler);
signal (SIGCHLD, signalHandler);
signal (SIGINT, signalHandler);
diff --git a/src/plugin.c b/src/plugin.c
index 0f9071ce..bbd26c20 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -724,7 +724,8 @@ getPluginABI (const char *name)
if (!p || !p->vTable->getObjectOptions)
return 0;
- option = (*p->vTable->getObjectOptions) (p, &compDisplays->base,
+ /* MULTIDPYERROR: ABI options should be moved into core */
+ option = (*p->vTable->getObjectOptions) (p, &core.displays->base,
&nOption);
return getIntOptionNamed (option, nOption, "abi", 0);