diff --git a/src/display.c b/src/display.c index d1d8ad3..a542a51 100644 --- a/src/display.c +++ b/src/display.c @@ -24,6 +24,7 @@ #include "xcursorint.h" #include #include +#include /* for getpid */ static XcursorDisplayInfo *_XcursorDisplayInfo; @@ -138,6 +139,14 @@ _XcursorGetDisplayInfo (Display *dpy) } (void) XESetCloseDisplay (dpy, info->codes->extension, _XcursorCloseDisplay); + /* + * The debugging-trace for new info-blocks begins here. + * As a reminder that multiple processes/threads use this library, + * the current process-id is logged. + */ + traceOpts((T_CALLED(_XcursorGetDisplayInfo) " info %p, pid %d\n", + (void*)info, getpid())); + /* * Check whether the display supports the Render CreateCursor request */ @@ -154,6 +163,7 @@ _XcursorGetDisplayInfo (Display *dpy) v = XGetDefault (dpy, "Xcursor", "core"); if (v && _XcursorDefaultParseBool (v) == 1) info->has_render_cursor = XcursorFalse; + traceOpts((T_OPTION(XCURSOR_CORE) ": %d\n", info->has_render_cursor)); } if (info->has_render_cursor && (major > 0 || minor >= 8)) { @@ -163,6 +173,7 @@ _XcursorGetDisplayInfo (Display *dpy) v = XGetDefault (dpy, "Xcursor", "anim"); if (v && _XcursorDefaultParseBool (v) == 0) info->has_anim_cursor = XcursorFalse; + traceOpts((T_OPTION(XCURSOR_ANIM) ": %d\n", info->has_anim_cursor)); } } @@ -176,6 +187,7 @@ _XcursorGetDisplayInfo (Display *dpy) v = XGetDefault (dpy, "Xcursor", "size"); if (v) info->size = atoi (v); + traceOpts((T_OPTION(XCURSOR_SIZE) ": %d\n", info->size)); /* * Use the Xft size to guess a size; make cursors 16 "points" tall @@ -188,6 +200,7 @@ _XcursorGetDisplayInfo (Display *dpy) dpi = atoi (v); if (dpi) info->size = dpi * 16 / 72; + traceOpts((T_OPTION(XCURSOR_SIZE) ": %d\n", info->size)); } /* @@ -206,6 +219,7 @@ _XcursorGetDisplayInfo (Display *dpy) * 16 pixels on a display of dimension 768 */ info->size = dim / 48; + traceOpts((T_OPTION(XCURSOR_SIZE) ": %d\n", info->size)); } info->theme = NULL; @@ -224,6 +238,7 @@ _XcursorGetDisplayInfo (Display *dpy) if (i >= 0) info->resized_cursors = i; } + traceOpts((T_OPTION(XCURSOR_RESIZED) ": %d\n", info->resized_cursors)); /* * Get the desired theme @@ -236,6 +251,7 @@ _XcursorGetDisplayInfo (Display *dpy) info->theme = strdup (v); info->theme_from_config = strdup (v); } + traceOpts((T_OPTION(XCURSOR_THEME) ": %s\n", NonNull(info->theme))); /* * Get the desired dither @@ -255,6 +271,7 @@ _XcursorGetDisplayInfo (Display *dpy) if (!strcmp (v, "diffuse")) info->dither = XcursorDitherDiffuse; } + traceOpts((T_OPTION(XCURSOR_DITHER) ": %d\n", info->dither)); info->theme_core = False; /* @@ -270,6 +287,7 @@ _XcursorGetDisplayInfo (Display *dpy) if (i >= 0) info->theme_core = i; } + traceOpts((T_OPTION(XCURSOR_THEME_CORE) ": %d\n", info->theme_core)); info->fonts = NULL; for (i = 0; i < NUM_BITMAPS; i++) @@ -296,7 +314,7 @@ _XcursorGetDisplayInfo (Display *dpy) } _XUnlockMutex (_Xglobal_lock); - return info; + returnAddr(info); } XcursorBool diff --git a/src/library.c b/src/library.c index d483aff..85c5006 100644 --- a/src/library.c +++ b/src/library.c @@ -48,6 +48,7 @@ XcursorLibraryPath (void) path = getenv ("XCURSOR_PATH"); if (!path) path = XCURSORPATH; + traceOpts((T_OPTION(XCURSOR_PATH) ": %s\n", NonNull(path))); } return path; } diff --git a/src/xcursorint.h b/src/xcursorint.h index 36e4698..5fca76e 100644 --- a/src/xcursorint.h +++ b/src/xcursorint.h @@ -136,8 +136,10 @@ unsigned long _XcursorReturnLong(unsigned long code); unsigned _XcursorReturnUint(unsigned code); void _XcursorReturnVoid(void); #define T_CALLED(func) "called: { " #func +#define T_OPTION(opts) "option: : " #opts #define T_RETURN(form) "return: } %" #form "\n" #define enterFunc(params) _XcursorTrace params +#define traceOpts(params) _XcursorTrace params #define returnAddr(addr) return _XcursorReturnAddr(addr) #define returnCode(code) return _XcursorReturnCode(code) #define returnLong(code) return _XcursorReturnLong(code) @@ -145,6 +147,7 @@ void _XcursorReturnVoid(void); #define returnVoid() do { _XcursorReturnVoid(); return; } while (0) #else #define enterFunc(params) /* nothing */ +#define traceOpts(params) /* nothing */ #define returnAddr(addr) return (addr) #define returnCode(code) return (code) #define returnLong(code) return (code) diff --git a/src/xlib.c b/src/xlib.c index 0d83770..79a31f3 100644 --- a/src/xlib.c +++ b/src/xlib.c @@ -324,6 +324,7 @@ _XcursorLogDiscover (void) if (getenv ("XCURSOR_DISCOVER")) log = True; + traceOpts((T_OPTION(XCURSOR_DISCOVER) ": %d\n", log)); } return log; }