windowmaker-wl/wrlib/wstubs_no_x11.c

159 lines
5.3 KiB
C

/* wstubs_no_x11.c - empty implementations for the X11 wraster public API.
*
* Compiled only when --disable-x11-wraster is configured. The X11
* conversion path source files (context.c, convert.c, convert_x11.c,
* xpixmap.c, xutil.c, load_xpm.c) are excluded in that build; this
* file provides the public-API symbols they would otherwise export
* so consumer code that calls them (or references them but never
* executes the call, like load.c's IM_XPM branch) links cleanly.
*
* Behaviour: every stub returns failure-neutral values (NULL, 0,
* RERR_INTERNAL). Calling them in pure-Wayland mode is silent and
* non-crashing rather than an error abort, so applications that
* branch on context->dpy correctly skip past these paths anyway.
*
* Raster graphics library
*
* Copyright (c) 2025 Window Maker Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*/
#define WRASTER_NO_XLIB
#include <config.h>
#include <stdlib.h>
#include "wraster.h"
/* ------------------------------------------------------------------ */
/* Context (context.c) */
/* ------------------------------------------------------------------ */
RContext *RCreateContext(Display *dpy, int screen_number,
const RContextAttributes *attribs)
{
(void)dpy; (void)screen_number; (void)attribs;
RErrorCode = RERR_INTERNAL;
return NULL;
}
void RDestroyContext(RContext *context)
{
if (!context) return;
if (context->attribs) free(context->attribs);
if (context->colors) free(context->colors);
if (context->pixels) free(context->pixels);
free(context);
}
/* ------------------------------------------------------------------ */
/* Image conversion (convert.c, convert_x11.c) */
/* ------------------------------------------------------------------ */
int RConvertImage(RContext *context, RImage *image, Pixmap *pixmap)
{
/* Use the backend vtable installed by RCreateContextWayland. */
if (context && context->convert_image)
return context->convert_image(context, image, pixmap);
RErrorCode = RERR_INTERNAL;
return 0;
}
int RConvertImageMask(RContext *context, RImage *image,
Pixmap *pixmap, Pixmap *mask, int threshold)
{
if (context && context->convert_image_mask)
return context->convert_image_mask(context, image, pixmap, mask, threshold);
RErrorCode = RERR_INTERNAL;
return 0;
}
Bool RGetClosestXColor(RContext *context, const RColor *color, XColor *retColor)
{
(void)context; (void)color; (void)retColor;
RErrorCode = RERR_INTERNAL;
return 0;
}
/* ------------------------------------------------------------------ */
/* Drawable → RImage (xpixmap.c) */
/* ------------------------------------------------------------------ */
RImage *RCreateImageFromDrawable(RContext *context, Drawable drawable, Pixmap mask)
{
(void)context; (void)drawable; (void)mask;
RErrorCode = RERR_INTERNAL;
return NULL;
}
RImage *RCreateImageFromXImage(RContext *context, XImage *image, XImage *mask)
{
(void)context; (void)image; (void)mask;
RErrorCode = RERR_INTERNAL;
return NULL;
}
/* ------------------------------------------------------------------ */
/* RXImage utilities (xutil.c) */
/* ------------------------------------------------------------------ */
RXImage *RCreateXImage(RContext *context, int depth,
unsigned width, unsigned height)
{
(void)context; (void)depth; (void)width; (void)height;
RErrorCode = RERR_INTERNAL;
return NULL;
}
RXImage *RGetXImage(RContext *context, Drawable d, int x, int y,
unsigned width, unsigned height)
{
(void)context; (void)d; (void)x; (void)y; (void)width; (void)height;
RErrorCode = RERR_INTERNAL;
return NULL;
}
void RDestroyXImage(RContext *context, RXImage *ximage)
{
(void)context;
if (ximage) free(ximage);
}
void RPutXImage(RContext *context, Drawable d, GC gc, RXImage *ximage,
int src_x, int src_y, int dest_x, int dest_y,
unsigned width, unsigned height)
{
(void)context; (void)d; (void)gc; (void)ximage;
(void)src_x; (void)src_y; (void)dest_x; (void)dest_y;
(void)width; (void)height;
}
/* ------------------------------------------------------------------ */
/* XPM loading (load_xpm.c) */
/* ------------------------------------------------------------------ */
RImage *RGetImageFromXPMData(RContext *context, char **xpmData)
{
(void)context; (void)xpmData;
RErrorCode = RERR_BADFORMAT;
return NULL;
}
RImage *RLoadXPM(RContext *context, const char *file)
{
(void)context; (void)file;
RErrorCode = RERR_BADFORMAT;
return NULL;
}
void r_destroy_conversion_tables(void) { }