add debug-trace for the configuration information

Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
This commit is contained in:
Thomas E. Dickey 2024-11-03 18:33:06 -05:00
parent 304ac296f3
commit cb2d1b97c3
No known key found for this signature in database
GPG key ID: CC2AF4472167BE03
4 changed files with 24 additions and 1 deletions

View file

@ -24,6 +24,7 @@
#include "xcursorint.h"
#include <X11/Xlibint.h>
#include <ctype.h>
#include <unistd.h> /* 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

View file

@ -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;
}

View file

@ -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)

View file

@ -324,6 +324,7 @@ _XcursorLogDiscover (void)
if (getenv ("XCURSOR_DISCOVER"))
log = True;
traceOpts((T_OPTION(XCURSOR_DISCOVER) ": %d\n", log));
}
return log;
}