summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2008-08-28 14:10:44 +0200
committerDanny Baumann <dannybaumann@web.de>2008-08-28 14:10:44 +0200
commit0d71c5e3cfd7fe0ae30f97dc0ba549bed035428d (patch)
tree5b88ae5678de33f1276673441c0a1827deea89dd /src
parenteacc4339fef37a314e5931c68647e601db569458 (diff)
Made logMessage a wrappable core (instead of display) function.
Diffstat (limited to 'src')
-rw-r--r--src/core.c5
-rw-r--r--src/display.c32
-rw-r--r--src/fragment.c6
-rw-r--r--src/main.c21
-rw-r--r--src/metadata.c6
-rw-r--r--src/plugin.c19
-rw-r--r--src/screen.c35
-rw-r--r--src/session.c2
-rw-r--r--src/texture.c6
-rw-r--r--src/window.c2
10 files changed, 66 insertions, 68 deletions
diff --git a/src/core.c b/src/core.c
index a79854b8..6b69a285 100644
--- a/src/core.c
+++ b/src/core.c
@@ -195,18 +195,19 @@ initCore (void)
core.fileWatchRemoved = fileWatchRemoved;
core.sessionEvent = sessionEvent;
+ core.logMessage = logMessage;
corePlugin = loadPlugin ("core");
if (!corePlugin)
{
- compLogMessage (0, "core", CompLogLevelFatal,
+ compLogMessage ("core", CompLogLevelFatal,
"Couldn't load core plugin");
return FALSE;
}
if (!pushPlugin (corePlugin))
{
- compLogMessage (0, "core", CompLogLevelFatal,
+ compLogMessage ("core", CompLogLevelFatal,
"Couldn't activate core plugin");
return FALSE;
}
diff --git a/src/display.c b/src/display.c
index a7d82620..23b0ba15 100644
--- a/src/display.c
+++ b/src/display.c
@@ -1955,8 +1955,6 @@ addDisplay (const char *name)
d->edgeDelayHandle = 0;
- d->logMessage = logMessage;
-
d->modMap = 0;
for (i = 0; i < CompModNum; i++)
@@ -1995,7 +1993,7 @@ addDisplay (const char *name)
d->display = dpy = XOpenDisplay (name);
if (!d->display)
{
- compLogMessage (d, "core", CompLogLevelFatal,
+ compLogMessage ("core", CompLogLevelFatal,
"Couldn't open display %s", XDisplayName (name));
return FALSE;
}
@@ -2212,7 +2210,7 @@ addDisplay (const char *name)
&d->compositeEvent,
&d->compositeError))
{
- compLogMessage (d, "core", CompLogLevelFatal,
+ compLogMessage ("core", CompLogLevelFatal,
"No composite extension");
return FALSE;
}
@@ -2220,28 +2218,28 @@ addDisplay (const char *name)
XCompositeQueryVersion (dpy, &compositeMajor, &compositeMinor);
if (compositeMajor == 0 && compositeMinor < 2)
{
- compLogMessage (d, "core", CompLogLevelFatal,
+ compLogMessage ("core", CompLogLevelFatal,
"Old composite extension");
return FALSE;
}
if (!XDamageQueryExtension (dpy, &d->damageEvent, &d->damageError))
{
- compLogMessage (d, "core", CompLogLevelFatal,
+ compLogMessage ("core", CompLogLevelFatal,
"No damage extension");
return FALSE;
}
if (!XSyncQueryExtension (dpy, &d->syncEvent, &d->syncError))
{
- compLogMessage (d, "core", CompLogLevelFatal,
+ compLogMessage ("core", CompLogLevelFatal,
"No sync extension");
return FALSE;
}
if (!XFixesQueryExtension (dpy, &d->fixesEvent, &d->fixesError))
{
- compLogMessage (d, "core", CompLogLevelFatal,
+ compLogMessage ("core", CompLogLevelFatal,
"No fixes extension");
return FALSE;
}
@@ -2277,7 +2275,7 @@ addDisplay (const char *name)
}
else
{
- compLogMessage (d, "core", CompLogLevelFatal,
+ compLogMessage ("core", CompLogLevelFatal,
"No XKB extension");
d->xkbEvent = d->xkbError = -1;
@@ -2336,7 +2334,7 @@ addDisplay (const char *name)
{
if (!replaceCurrentWm)
{
- compLogMessage (d, "core", CompLogLevelError,
+ compLogMessage ("core", CompLogLevelError,
"Screen %d on display \"%s\" already "
"has a window manager; try using the "
"--replace option to replace the current "
@@ -2359,7 +2357,7 @@ addDisplay (const char *name)
{
if (!replaceCurrentWm)
{
- compLogMessage (d, "core", CompLogLevelError,
+ compLogMessage ("core", CompLogLevelError,
"Screen %d on display \"%s\" already "
"has a compositing manager; try using the "
"--replace option to replace the current "
@@ -2400,7 +2398,7 @@ addDisplay (const char *name)
if (XGetSelectionOwner (dpy, wmSnAtom) != newWmSnOwner)
{
- compLogMessage (d, "core", CompLogLevelError,
+ compLogMessage ("core", CompLogLevelError,
"Could not acquire window manager "
"selection on screen %d display \"%s\"",
i, DisplayString (dpy));
@@ -2440,7 +2438,7 @@ addDisplay (const char *name)
if (compCheckForError (dpy))
{
- compLogMessage (d, "core", CompLogLevelError,
+ compLogMessage ("core", CompLogLevelError,
"Another composite manager is already "
"running on screen: %d", i);
@@ -2451,7 +2449,7 @@ addDisplay (const char *name)
if (XGetSelectionOwner (dpy, cmSnAtom) != newCmSnOwner)
{
- compLogMessage (d, "core", CompLogLevelError,
+ compLogMessage ("core", CompLogLevelError,
"Could not acquire compositing manager "
"selection on screen %d display \"%s\"",
i, DisplayString (dpy));
@@ -2477,7 +2475,7 @@ addDisplay (const char *name)
if (compCheckForError (dpy))
{
- compLogMessage (d, "core", CompLogLevelError,
+ compLogMessage ("core", CompLogLevelError,
"Another window manager is "
"already running on screen: %d", i);
@@ -2487,7 +2485,7 @@ addDisplay (const char *name)
if (!addScreen (d, i, newWmSnOwner, wmSnAtom, wmSnTimestamp))
{
- compLogMessage (d, "core", CompLogLevelError,
+ compLogMessage ("core", CompLogLevelError,
"Failed to manage screen: %d", i);
}
@@ -2504,7 +2502,7 @@ addDisplay (const char *name)
if (!d->screens)
{
- compLogMessage (d, "core", CompLogLevelFatal,
+ compLogMessage ("core", CompLogLevelFatal,
"No manageable screens found on display %s",
XDisplayName (name));
return FALSE;
diff --git a/src/fragment.c b/src/fragment.c
index dda806ce..8e1d5637 100644
--- a/src/fragment.c
+++ b/src/fragment.c
@@ -587,7 +587,7 @@ buildFragmentProgram (CompScreen *s,
if (!mask)
{
- compLogMessage (NULL, "core", CompLogLevelWarn,
+ compLogMessage ("core", CompLogLevelWarn,
"fragment functions can't be linked together "
"because a common type doesn't exist");
}
@@ -639,7 +639,7 @@ buildFragmentProgram (CompScreen *s,
glGetIntegerv (GL_PROGRAM_ERROR_POSITION_ARB, &errorPos);
if (glGetError () != GL_NO_ERROR || errorPos != -1)
{
- compLogMessage (NULL, "core", CompLogLevelError,
+ compLogMessage ("core", CompLogLevelError,
"failed to load fragment program");
(*s->deletePrograms) (1, &program->name);
@@ -933,7 +933,7 @@ addHeaderOpToFunctionData (CompFunctionData *data,
{
if (strncmp (name, reserved[i], strlen (reserved[i])) == 0)
{
- compLogMessage (NULL, "core", CompLogLevelWarn,
+ compLogMessage ("core", CompLogLevelWarn,
"%s is a reserved word", name);
return FALSE;
}
diff --git a/src/main.c b/src/main.c
index f4e33818..ff8328d5 100644
--- a/src/main.c
+++ b/src/main.c
@@ -52,6 +52,7 @@ char *defaultTextureFilter = "Good";
Bool shutDown = FALSE;
Bool restartSignal = FALSE;
+Bool coreInitialized = FALSE;
CompWindow *lastFoundWindow = 0;
CompWindow *lastDamagedWindow = 0;
@@ -99,8 +100,7 @@ usage (void)
}
void
-compLogMessage (CompDisplay *d,
- const char *componentName,
+compLogMessage (const char *componentName,
CompLogLevel level,
const char *format,
...)
@@ -112,17 +112,16 @@ compLogMessage (CompDisplay *d,
vsnprintf (message, 2048, format, args);
- if (d)
- (*d->logMessage) (d, componentName, level, message);
+ if (coreInitialized)
+ (*core.logMessage) (componentName, level, message);
else
- logMessage (d, componentName, level, message);
+ logMessage (componentName, level, message);
va_end (args);
}
void
-logMessage (CompDisplay *d,
- const char *componentName,
+logMessage (const char *componentName,
CompLogLevel level,
const char *message)
{
@@ -361,7 +360,7 @@ main (int argc, char **argv)
}
else if (*argv[i] == '-')
{
- compLogMessage (NULL, "core", CompLogLevelWarn,
+ compLogMessage ("core", CompLogLevelWarn,
"Unknown option '%s'\n", argv[i]);
}
else
@@ -407,7 +406,7 @@ main (int argc, char **argv)
if (!compInitMetadata (&coreMetadata))
{
- compLogMessage (NULL, "core", CompLogLevelFatal,
+ compLogMessage ("core", CompLogLevelFatal,
"Couldn't initialize core metadata");
return 1;
}
@@ -428,6 +427,8 @@ main (int argc, char **argv)
if (!initCore ())
return 1;
+ coreInitialized = TRUE;
+
if (!disableSm)
initSession (clientId);
@@ -439,6 +440,8 @@ main (int argc, char **argv)
if (!disableSm)
closeSession ();
+ coreInitialized = FALSE;
+
finiCore ();
compFiniMetadata (&coreMetadata);
diff --git a/src/metadata.c b/src/metadata.c
index 191edaa9..84dc4683 100644
--- a/src/metadata.c
+++ b/src/metadata.c
@@ -165,7 +165,7 @@ compAddMetadataFromFile (CompMetadata *metadata,
status |= addMetadataFromFilename (metadata, METADATADIR, file);
if (!status)
{
- compLogMessage (NULL, "core", CompLogLevelWarn,
+ compLogMessage ("core", CompLogLevelWarn,
"Unable to parse XML metadata from file \"%s%s\"",
file, EXTENSION);
@@ -184,7 +184,7 @@ compAddMetadataFromString (CompMetadata *metadata,
doc = xmlReadMemory (string, strlen (string), NULL, NULL, 0);
if (!doc)
{
- compLogMessage (NULL, "core", CompLogLevelWarn,
+ compLogMessage ("core", CompLogLevelWarn,
"Unable to parse XML metadata");
return FALSE;
@@ -214,7 +214,7 @@ compAddMetadataFromIO (CompMetadata *metadata,
doc = xmlReadIO (ioread, ioclose, ioctx, NULL, NULL, 0);
if (!doc)
{
- compLogMessage (NULL, "core", CompLogLevelWarn,
+ compLogMessage ("core", CompLogLevelWarn,
"Unable to parse XML metadata");
return FALSE;
diff --git a/src/plugin.c b/src/plugin.c
index 7b7a010c..206351dd 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -171,8 +171,7 @@ dlloaderLoadPlugin (CompPlugin *p,
error = dlerror ();
if (error)
{
- compLogMessage (NULL, "core", CompLogLevelError,
- "dlsym: %s", error);
+ compLogMessage ("core", CompLogLevelError, "dlsym: %s", error);
getInfo = 0;
}
@@ -182,7 +181,7 @@ dlloaderLoadPlugin (CompPlugin *p,
p->vTable = (*getInfo) ();
if (!p->vTable)
{
- compLogMessage (NULL, "core", CompLogLevelError,
+ compLogMessage ("core", CompLogLevelError,
"Couldn't get vtable from '%s' plugin",
file);
@@ -368,7 +367,7 @@ initObjectTree (CompObject *object,
{
if (!(*p->vTable->initObject) (p, object))
{
- compLogMessage (NULL, p->vTable->name, CompLogLevelError,
+ compLogMessage (p->vTable->name, CompLogLevelError,
"InitObject failed");
return FALSE;
}
@@ -433,7 +432,7 @@ initPlugin (CompPlugin *p)
if (!(*p->vTable->init) (p))
{
- compLogMessage (NULL, "core", CompLogLevelError,
+ compLogMessage ("core", CompLogLevelError,
"InitPlugin '%s' failed", p->vTable->name);
return FALSE;
}
@@ -575,7 +574,7 @@ loadPlugin (const char *name)
if (status)
return p;
- compLogMessage (NULL, "core", CompLogLevelError,
+ compLogMessage ("core", CompLogLevelError,
"Couldn't load plugin '%s'", name);
return 0;
@@ -586,7 +585,7 @@ pushPlugin (CompPlugin *p)
{
if (findActivePlugin (p->vTable->name))
{
- compLogMessage (NULL, "core", CompLogLevelWarn,
+ compLogMessage ("core", CompLogLevelWarn,
"Plugin '%s' already active",
p->vTable->name);
@@ -598,7 +597,7 @@ pushPlugin (CompPlugin *p)
if (!initPlugin (p))
{
- compLogMessage (NULL, "core", CompLogLevelError,
+ compLogMessage ("core", CompLogLevelError,
"Couldn't activate plugin '%s'", p->vTable->name);
plugins = p->next;
@@ -740,13 +739,13 @@ checkPluginABI (const char *name,
pluginABI = getPluginABI (name);
if (!pluginABI)
{
- compLogMessage (NULL, "core", CompLogLevelError,
+ compLogMessage ("core", CompLogLevelError,
"Plugin '%s' not loaded.\n", name);
return FALSE;
}
else if (pluginABI != abi)
{
- compLogMessage (NULL, "core", CompLogLevelError,
+ compLogMessage ("core", CompLogLevelError,
"Plugin '%s' has ABI version '%d', expected "
"ABI version '%d'.\n",
name, pluginABI, abi);
diff --git a/src/screen.c b/src/screen.c
index 2b7c9146..1e4460c4 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -1017,7 +1017,7 @@ updateScreenBackground (CompScreen *screen,
if (!bindPixmapToTexture (screen, texture, pixmap,
width, height, depth))
{
- compLogMessage (NULL, "core", CompLogLevelWarn,
+ compLogMessage ("core", CompLogLevelWarn,
"Couldn't bind background pixmap 0x%x to "
"texture", (int) pixmap);
}
@@ -1799,7 +1799,7 @@ addScreen (CompDisplay *display,
visinfo = XGetVisualInfo (dpy, VisualIDMask, &templ, &nvisinfo);
if (!nvisinfo)
{
- compLogMessage (display, "core", CompLogLevelFatal,
+ compLogMessage ("core", CompLogLevelFatal,
"Couldn't get visual info for default visual");
return FALSE;
}
@@ -1810,8 +1810,7 @@ addScreen (CompDisplay *display,
if (!XAllocColor (dpy, s->colormap, &black))
{
- compLogMessage (display, "core", CompLogLevelFatal,
- "Couldn't allocate color");
+ compLogMessage ("core", CompLogLevelFatal, "Couldn't allocate color");
XFree (visinfo);
return FALSE;
}
@@ -1819,8 +1818,7 @@ addScreen (CompDisplay *display,
bitmap = XCreateBitmapFromData (dpy, s->root, &data, 1, 1);
if (!bitmap)
{
- compLogMessage (display, "core", CompLogLevelFatal,
- "Couldn't create bitmap");
+ compLogMessage ("core", CompLogLevelFatal, "Couldn't create bitmap");
XFree (visinfo);
return FALSE;
}
@@ -1829,7 +1827,7 @@ addScreen (CompDisplay *display,
&black, &black, 0, 0);
if (!s->invisibleCursor)
{
- compLogMessage (display, "core", CompLogLevelFatal,
+ compLogMessage ("core", CompLogLevelFatal,
"Couldn't create invisible cursor");
XFree (visinfo);
return FALSE;
@@ -1841,7 +1839,7 @@ addScreen (CompDisplay *display,
glXGetConfig (dpy, visinfo, GLX_USE_GL, &value);
if (!value)
{
- compLogMessage (display, "core", CompLogLevelFatal,
+ compLogMessage ("core", CompLogLevelFatal,
"Root visual is not a GL visual");
XFree (visinfo);
return FALSE;
@@ -1850,7 +1848,7 @@ addScreen (CompDisplay *display,
glXGetConfig (dpy, visinfo, GLX_DOUBLEBUFFER, &value);
if (!value)
{
- compLogMessage (display, "core", CompLogLevelFatal,
+ compLogMessage ("core", CompLogLevelFatal,
"Root visual is not a double buffered GL visual");
XFree (visinfo);
return FALSE;
@@ -1859,8 +1857,7 @@ addScreen (CompDisplay *display,
s->ctx = glXCreateContext (dpy, visinfo, NULL, !indirectRendering);
if (!s->ctx)
{
- compLogMessage (display, "core", CompLogLevelFatal,
- "glXCreateContext failed");
+ compLogMessage ("core", CompLogLevelFatal, "glXCreateContext failed");
XFree (visinfo);
return FALSE;
@@ -1869,7 +1866,7 @@ addScreen (CompDisplay *display,
glxExtensions = glXQueryExtensionsString (dpy, screenNum);
if (!strstr (glxExtensions, "GLX_EXT_texture_from_pixmap"))
{
- compLogMessage (display, "core", CompLogLevelFatal,
+ compLogMessage ("core", CompLogLevelFatal,
"GLX_EXT_texture_from_pixmap is missing");
XFree (visinfo);
@@ -1880,7 +1877,7 @@ addScreen (CompDisplay *display,
if (!strstr (glxExtensions, "GLX_SGIX_fbconfig"))
{
- compLogMessage (display, "core", CompLogLevelFatal,
+ compLogMessage ("core", CompLogLevelFatal,
"GLX_SGIX_fbconfig is missing");
return FALSE;
}
@@ -1902,14 +1899,14 @@ addScreen (CompDisplay *display,
if (!s->bindTexImage)
{
- compLogMessage (display, "core", CompLogLevelFatal,
+ compLogMessage ("core", CompLogLevelFatal,
"glXBindTexImageEXT is missing");
return FALSE;
}
if (!s->releaseTexImage)
{
- compLogMessage (display, "core", CompLogLevelFatal,
+ compLogMessage ("core", CompLogLevelFatal,
"glXReleaseTexImageEXT is missing");
return FALSE;
}
@@ -1919,7 +1916,7 @@ addScreen (CompDisplay *display,
!s->getFBConfigAttrib ||
!s->createPixmap)
{
- compLogMessage (display, "core", CompLogLevelFatal,
+ compLogMessage ("core", CompLogLevelFatal,
"fbconfig functions missing");
return FALSE;
}
@@ -1946,7 +1943,7 @@ addScreen (CompDisplay *display,
glExtensions = (const char *) glGetString (GL_EXTENSIONS);
if (!glExtensions)
{
- compLogMessage (display, "core", CompLogLevelFatal,
+ compLogMessage ("core", CompLogLevelFatal,
"No valid GL extensions string found.");
return FALSE;
}
@@ -1976,7 +1973,7 @@ addScreen (CompDisplay *display,
if (!(s->textureRectangle || s->textureNonPowerOfTwo))
{
- compLogMessage (display, "core", CompLogLevelFatal,
+ compLogMessage ("core", CompLogLevelFatal,
"Support for non power of two textures missing");
return FALSE;
}
@@ -2212,7 +2209,7 @@ addScreen (CompDisplay *display,
if (!s->glxPixmapFBConfigs[defaultDepth].fbConfig)
{
- compLogMessage (display, "core", CompLogLevelFatal,
+ compLogMessage ("core", CompLogLevelFatal,
"No GLXFBConfig for default depth, "
"this isn't going to work.");
return FALSE;
diff --git a/src/session.c b/src/session.c
index 2ea8f859..1d2422b0 100644
--- a/src/session.c
+++ b/src/session.c
@@ -249,7 +249,7 @@ initSession (char *prevClientId)
sizeof (errorBuffer),
errorBuffer);
if (!smcConnection)
- compLogMessage (NULL, "core", CompLogLevelWarn,
+ compLogMessage ("core", CompLogLevelWarn,
"SmcOpenConnection failed: %s",
errorBuffer);
else
diff --git a/src/texture.c b/src/texture.c
index 0002e03f..324577a4 100644
--- a/src/texture.c
+++ b/src/texture.c
@@ -246,7 +246,7 @@ bindPixmapToTexture (CompScreen *screen,
if (!config->fbConfig)
{
- compLogMessage (NULL, "core", CompLogLevelWarn,
+ compLogMessage ("core", CompLogLevelWarn,
"No GLXFBConfig for depth %d",
depth);
@@ -292,7 +292,7 @@ bindPixmapToTexture (CompScreen *screen,
attribs);
if (!texture->pixmap)
{
- compLogMessage (NULL, "core", CompLogLevelWarn,
+ compLogMessage ("core", CompLogLevelWarn,
"glXCreatePixmap failed");
return FALSE;
@@ -338,7 +338,7 @@ bindPixmapToTexture (CompScreen *screen,
texture->mipmap = FALSE;
break;
default:
- compLogMessage (NULL, "core", CompLogLevelWarn,
+ compLogMessage ("core", CompLogLevelWarn,
"pixmap 0x%x can't be bound to texture",
(int) pixmap);
diff --git a/src/window.c b/src/window.c
index 9e248e8f..e30f1a54 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1353,7 +1353,7 @@ bindWindow (CompWindow *w)
w->width, w->height,
w->attrib.depth))
{
- compLogMessage (w->screen->display, "core", CompLogLevelInfo,
+ compLogMessage ("core", CompLogLevelInfo,
"Couldn't bind redirected window 0x%x to "
"texture\n", (int) w->id);
}