summaryrefslogtreecommitdiff
path: root/lib/libXcursor/src/display.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libXcursor/src/display.c')
-rw-r--r--lib/libXcursor/src/display.c57
1 files changed, 55 insertions, 2 deletions
diff --git a/lib/libXcursor/src/display.c b/lib/libXcursor/src/display.c
index a61b5fd4e..a542a5195 100644
--- a/lib/libXcursor/src/display.c
+++ b/lib/libXcursor/src/display.c
@@ -1,4 +1,5 @@
/*
+ * Copyright © 2024 Thomas E. Dickey
* Copyright © 2002 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@@ -23,6 +24,7 @@
#include "xcursorint.h"
#include <X11/Xlibint.h>
#include <ctype.h>
+#include <unistd.h> /* for getpid */
static XcursorDisplayInfo *_XcursorDisplayInfo;
@@ -138,6 +140,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
*/
info->has_render_cursor = XcursorFalse;
@@ -153,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))
{
@@ -162,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));
}
}
@@ -175,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
@@ -187,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));
}
/*
@@ -205,12 +219,28 @@ _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;
info->theme_from_config = NULL;
/*
+ * Provide for making cursors resized to match the requested size
+ */
+ info->resized_cursors = XcursorFalse;
+ v = getenv ("XCURSOR_RESIZED");
+ if (!v)
+ v = XGetDefault (dpy, "Xcursor", "resized");
+ if (v)
+ {
+ i = _XcursorDefaultParseBool (v);
+ if (i >= 0)
+ info->resized_cursors = i;
+ }
+ traceOpts((T_OPTION(XCURSOR_RESIZED) ": %d\n", info->resized_cursors));
+
+ /*
* Get the desired theme
*/
v = getenv ("XCURSOR_THEME");
@@ -221,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
@@ -240,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;
/*
@@ -255,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++)
@@ -281,7 +314,7 @@ _XcursorGetDisplayInfo (Display *dpy)
}
_XUnlockMutex (_Xglobal_lock);
- return info;
+ returnAddr(info);
}
XcursorBool
@@ -322,6 +355,27 @@ XcursorGetDefaultSize (Display *dpy)
}
XcursorBool
+XcursorSetResizable (Display *dpy, XcursorBool flag)
+{
+ XcursorDisplayInfo *info = _XcursorGetDisplayInfo (dpy);
+
+ if (!info)
+ return XcursorFalse;
+ info->resized_cursors = flag;
+ return XcursorTrue;
+}
+
+XcursorBool
+XcursorGetResizable (Display *dpy)
+{
+ XcursorDisplayInfo *info = _XcursorGetDisplayInfo (dpy);
+
+ if (!info)
+ return 0;
+ return info->resized_cursors;
+}
+
+XcursorBool
XcursorSetTheme (Display *dpy, const char *theme)
{
XcursorDisplayInfo *info = _XcursorGetDisplayInfo (dpy);
@@ -365,7 +419,6 @@ XcursorGetThemeCore (Display *dpy)
if (!info)
return XcursorFalse;
return info->theme_core;
-
}
XcursorBool