commit: 990ab0f3cf004360d54589a6ee07465125d3245d
parent f08069e59ee2e13ee68b4b2db5616b2c47dcd066
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Fri, 20 Oct 2023 07:03:04 +0200
Xcursor/Xcursor.h: Gate behind #ifdef HAVE_X11 instead of comments
Diffstat:
M | Xcursor/Xcursor.h | 185 | +++++++++++++++++++++++++++++++++++-------------------------------------------- |
1 file changed, 83 insertions(+), 102 deletions(-)
diff --git a/Xcursor/Xcursor.h b/Xcursor/Xcursor.h
@@ -205,17 +205,21 @@ typedef struct _XcursorImages
char *name; /* name used to load images */
} XcursorImages;
-//typedef struct _XcursorCursors {
-// Display *dpy; /* Display holding cursors */
-// int ref; /* reference count */
-// int ncursor; /* number of cursors */
-// Cursor *cursors; /* array of cursors */
-//} XcursorCursors;
-
-//typedef struct _XcursorAnimate {
-// XcursorCursors *cursors; /* list of cursors to use */
-// int sequence; /* which cursor is next */
-//} XcursorAnimate;
+#ifdef HAVE_X11
+typedef struct _XcursorCursors
+{
+ Display *dpy; /* Display holding cursors */
+ int ref; /* reference count */
+ int ncursor; /* number of cursors */
+ Cursor *cursors; /* array of cursors */
+} XcursorCursors;
+
+typedef struct _XcursorAnimate
+{
+ XcursorCursors *cursors; /* list of cursors to use */
+ int sequence; /* which cursor is next */
+} XcursorAnimate;
+#endif
typedef struct _XcursorFile XcursorFile;
@@ -251,26 +255,24 @@ void XcursorImagesDestroy(XcursorImages *images);
void XcursorImagesSetName(XcursorImages *images, const char *name);
+#ifdef HAVE_X11
/*
* Manage Cursor objects
*/
-//XcursorCursors *
-//XcursorCursorsCreate (Display *dpy, int size);
+XcursorCursors *XcursorCursorsCreate(Display *dpy, int size);
//void
-//XcursorCursorsDestroy (XcursorCursors *cursors);
+XcursorCursorsDestroy(XcursorCursors *cursors);
/*
* Manage Animate objects
*/
-//XcursorAnimate *
-//XcursorAnimateCreate (XcursorCursors *cursors);
-//
-//void
-//XcursorAnimateDestroy (XcursorAnimate *animate);
-//
-//Cursor
-//XcursorAnimateNext (XcursorAnimate *animate);
+XcursorAnimate *XcursorAnimateCreate(XcursorCursors *cursors);
+
+void XcursorAnimateDestroy(XcursorAnimate *animate);
+
+Cursor XcursorAnimateNext(XcursorAnimate *animate);
+#endif
/*
* Manage Comment objects
@@ -346,36 +348,31 @@ const char *XcursorLibraryPath(void);
int XcursorLibraryShape(const char *library);
+#ifdef HAVE_X11
/*
* Image/Cursor APIs
*/
-//Cursor
-//XcursorImageLoadCursor (Display *dpy, const XcursorImage *image);
-//
-//XcursorCursors *
-//XcursorImagesLoadCursors (Display *dpy, const XcursorImages *images);
-//
-//Cursor
-//XcursorImagesLoadCursor (Display *dpy, const XcursorImages *images);
+Cursor XcursorImageLoadCursor(Display *dpy, const XcursorImage *image);
+
+XcursorCursors *XcursorImagesLoadCursors(Display *dpy, const XcursorImages *images);
+
+Cursor XcursorImagesLoadCursor(Display *dpy, const XcursorImages *images);
/*
* Filename/Cursor APIs
*/
-//Cursor
-//XcursorFilenameLoadCursor (Display *dpy, const char *file);
-//
-//XcursorCursors *
-//XcursorFilenameLoadCursors (Display *dpy, const char *file);
+Cursor XcursorFilenameLoadCursor(Display *dpy, const char *file);
+
+XcursorCursors *XcursorFilenameLoadCursors(Display *dpy, const char *file);
/*
* Library/Cursor APIs
*/
-//Cursor
-//XcursorLibraryLoadCursor (Display *dpy, const char *file);
-//
-//XcursorCursors *
-//XcursorLibraryLoadCursors (Display *dpy, const char *file);
+Cursor XcursorLibraryLoadCursor(Display *dpy, const char *file);
+
+XcursorCursors *XcursorLibraryLoadCursors(Display *dpy, const char *file);
+#endif
/*
* Shape/Image APIs
@@ -385,14 +382,13 @@ XcursorImage *XcursorShapeLoadImage(unsigned int shape, const char *theme, int s
XcursorImages *XcursorShapeLoadImages(unsigned int shape, const char *theme, int size);
+#ifdef HAVE_X11
/*
* Shape/Cursor APIs
*/
-//Cursor
-//XcursorShapeLoadCursor (Display *dpy, unsigned int shape);
-//
-//XcursorCursors *
-//XcursorShapeLoadCursors (Display *dpy, unsigned int shape);
+Cursor XcursorShapeLoadCursor(Display *dpy, unsigned int shape);
+
+XcursorCursors *XcursorShapeLoadCursors(Display *dpy, unsigned int shape);
/*
* This is the function called by Xlib when attempting to
@@ -400,67 +396,52 @@ XcursorImages *XcursorShapeLoadImages(unsigned int shape, const char *theme, int
* not change as Xlib loads 'libXcursor.so' instead of
* a specific major version
*/
-//Cursor
-//XcursorTryShapeCursor (Display *dpy,
-// Font source_font,
-// Font mask_font,
-// unsigned int source_char,
-// unsigned int mask_char,
-// XColor _Xconst *foreground,
-// XColor _Xconst *background);
-//
-//void
-//XcursorNoticeCreateBitmap (Display *dpy,
-// Pixmap pid,
-// unsigned int width,
-// unsigned int height);
-//
-//void
-//XcursorNoticePutBitmap (Display *dpy,
-// Drawable draw,
-// XImage *image);
-//
-//Cursor
-//XcursorTryShapeBitmapCursor (Display *dpy,
-// Pixmap source,
-// Pixmap mask,
-// XColor *foreground,
-// XColor *background,
-// unsigned int x,
-// unsigned int y);
+Cursor XcursorTryShapeCursor(Display *dpy,
+ Font source_font,
+ Font mask_font,
+ unsigned int source_char,
+ unsigned int mask_char,
+ XColor _Xconst *foreground,
+ XColor _Xconst *background);
+
+void XcursorNoticeCreateBitmap(Display *dpy, Pixmap pid, unsigned int width, unsigned int height);
+
+void XcursorNoticePutBitmap(Display *dpy, Drawable draw, XImage *image);
+
+Cursor XcursorTryShapeBitmapCursor(Display *dpy,
+ Pixmap source,
+ Pixmap mask,
+ XColor *foreground,
+ XColor *background,
+ unsigned int x,
+ unsigned int y);
+#endif
#define XCURSOR_BITMAP_HASH_SIZE 16
-// XImage undefined
-//
-//void
-//XcursorImageHash (XImage *image,
-// unsigned char hash[XCURSOR_BITMAP_HASH_SIZE]);
+#ifdef HAVE_X11
+void XcursorImageHash(XImage *image, unsigned char hash[XCURSOR_BITMAP_HASH_SIZE]);
+#endif
+
+#ifdef HAVE_X11
/*
* Display information APIs
*/
-//XcursorBool
-//XcursorSupportsARGB (Display *dpy);
-//
-//XcursorBool
-//XcursorSupportsAnim (Display *dpy);
-//
-//XcursorBool
-//XcursorSetDefaultSize (Display *dpy, int size);
-//
-//int
-//XcursorGetDefaultSize (Display *dpy);
-//
-//XcursorBool
-//XcursorSetTheme (Display *dpy, const char *theme);
-//
-//char *
-//XcursorGetTheme (Display *dpy);
-//
-//XcursorBool
-//XcursorGetThemeCore (Display *dpy);
-//
-//XcursorBool
-//XcursorSetThemeCore (Display *dpy, XcursorBool theme_core);
+XcursorBool XcursorSupportsARGB(Display *dpy);
-#endif
+XcursorBool XcursorSupportsAnim(Display *dpy);
+
+XcursorBool XcursorSetDefaultSize(Display *dpy, int size);
+
+int XcursorGetDefaultSize(Display *dpy);
+
+XcursorBool XcursorSetTheme(Display *dpy, const char *theme);
+
+char *XcursorGetTheme(Display *dpy);
+
+XcursorBool XcursorGetThemeCore(Display *dpy);
+
+XcursorBool XcursorSetThemeCore(Display *dpy, XcursorBool theme_core);
+#endif // HAVE_X11
+
+#endif // _XCURSOR_H_