Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
56e08a5966 | ||
|
|
6a4cb9977e | ||
|
|
0d5986bb89 | ||
|
|
b7d40eeac7 | ||
|
|
6097395d45 | ||
|
|
c527a9f007 | ||
|
|
b4a91efedc | ||
|
|
49e2a9071d | ||
|
|
e71673e46b | ||
|
|
386e3ca307 | ||
|
|
36e5eb1bde |
@@ -155,6 +155,9 @@ WPrefs.app/WPrefs.desktop
|
||||
WINGs/wings-rs-tests/Cargo.lock
|
||||
WINGs/wings-rs/Cargo.lock
|
||||
WINGs/wings-rs/src/WINGsP.rs
|
||||
WINGs/wings-rs/src/WINGsP/constants.rs
|
||||
WINGs/wings-rs/src/WINGsP/mod.rs
|
||||
wmaker-rs/Cargo.lock
|
||||
wrlib-rs/src/ffi.rs
|
||||
wrlib-rs/Cargo.lock
|
||||
wutil-rs/Cargo.lock
|
||||
|
||||
@@ -39,7 +39,7 @@ ACLOCAL_AMFLAGS = -I m4
|
||||
AM_DISTCHECK_CONFIGURE_FLAGS = --enable-silent-rules LINGUAS='*'
|
||||
|
||||
|
||||
SUBDIRS = wrlib wutil-rs WINGs wmaker-rs src util po WindowMaker wmlib WPrefs.app doc
|
||||
SUBDIRS = wrlib wrlib-rs wutil-rs WINGs wmaker-rs src util po WindowMaker wmlib WPrefs.app doc
|
||||
DIST_SUBDIRS = $(SUBDIRS) test
|
||||
|
||||
EXTRA_DIST = TODO BUGS BUGFORM FAQ INSTALL \
|
||||
|
||||
@@ -32,7 +32,6 @@ libWINGs_la_SOURCES = \
|
||||
wbox.c \
|
||||
wbrowser.c \
|
||||
wbutton.c \
|
||||
wcolor.c \
|
||||
wcolorpanel.c \
|
||||
wcolorwell.c \
|
||||
wconfig.h \
|
||||
@@ -46,7 +45,6 @@ libWINGs_la_SOURCES = \
|
||||
wmenuitem.c \
|
||||
wmisc.c \
|
||||
wpanel.c \
|
||||
wpixmap.c \
|
||||
wpopupbutton.c \
|
||||
wprogressindicator.c \
|
||||
wruler.c \
|
||||
|
||||
@@ -688,8 +688,7 @@ void WMSetApplicationIconPixmap(WMScreen *app, WMPixmap *icon);
|
||||
|
||||
WMPixmap* WMGetApplicationIconPixmap(WMScreen *app);
|
||||
|
||||
/* If color==NULL it will use the default color for panels: ae/aa/ae */
|
||||
WMPixmap* WMCreateApplicationIconBlendedPixmap(WMScreen *scr, const RColor *color);
|
||||
WMPixmap* WMCreateApplicationIconGreyedPixmap(WMScreen *scr);
|
||||
|
||||
void WMSetApplicationIconWindow(WMScreen *scr, Window window);
|
||||
|
||||
@@ -833,26 +832,34 @@ WMSize WMGetPixmapSize(WMPixmap *pixmap);
|
||||
|
||||
WMPixmap* WMCreatePixmapFromFile(WMScreen *scrPtr, const char *fileName);
|
||||
|
||||
WMPixmap* WMCreateBlendedPixmapFromRImage(WMScreen *scrPtr, RImage *image,
|
||||
const RColor *color);
|
||||
WMPixmap* WMCreateGreyedPixmapFromRImage(WMScreen *scrPtr, RImage *image);
|
||||
|
||||
WMPixmap* WMCreateBlendedPixmapFromFile(WMScreen *scrPtr, const char *fileName,
|
||||
const RColor *color);
|
||||
WMPixmap* WMCreateGreyedPixmapFromFile(WMScreen *scrPtr, const char *fileName);
|
||||
|
||||
WMPixmap* WMCreateScaledBlendedPixmapFromFile(WMScreen *scrPtr, const char *fileName,
|
||||
const RColor *color,
|
||||
unsigned int width,
|
||||
unsigned int height);
|
||||
WMPixmap* WMCreateScaledPixmapFromFile(WMScreen *scrPtr, const char *fileName,
|
||||
unsigned int width,
|
||||
unsigned int height);
|
||||
|
||||
WMPixmap* WMCreateScaledGreyedPixmapFromFile(WMScreen *scrPtr, const char *fileName,
|
||||
unsigned int width,
|
||||
unsigned int height);
|
||||
|
||||
void WMDrawPixmap(WMPixmap *pixmap, Drawable d, int x, int y);
|
||||
|
||||
Pixmap WMGetPixmapXID(WMPixmap *pixmap);
|
||||
|
||||
/* Deliberately leaks the internal pixmap resource. */
|
||||
void WMLeakPixmapXID(WMPixmap *pixmap);
|
||||
|
||||
Pixmap WMGetPixmapMaskXID(WMPixmap *pixmap);
|
||||
|
||||
void WMSetPixmapMaskXID(WMPixmap *pixmap, Pixmap mask);
|
||||
|
||||
int WMGetPixmapDepth(WMPixmap *pixmap);
|
||||
|
||||
WMPixmap* WMGetSystemPixmap(WMScreen *scr, int image);
|
||||
|
||||
/* ---[ WINGs/wcolor.c ]-------------------------------------------------- */
|
||||
/* ---[ WINGs/wings-rs/src/color.rs ]------------------------------------- */
|
||||
|
||||
|
||||
WMColor* WMDarkGrayColor(WMScreen *scr);
|
||||
|
||||
@@ -67,9 +67,11 @@ typedef struct W_DraggingInfo {
|
||||
|
||||
/* ---[ Structures from WINGs.h ]----------------------------------------- */
|
||||
|
||||
/* Pre-definition of internal structs */
|
||||
/* Opaque primitive types defined in Rust. */
|
||||
typedef struct W_Color W_Color;
|
||||
typedef struct W_Pixmap W_Pixmap;
|
||||
|
||||
/* Pre-definition of internal structs */
|
||||
typedef struct W_Pixmap WMPixmap;
|
||||
typedef struct W_View W_View;
|
||||
|
||||
typedef struct W_FocusInfo {
|
||||
@@ -104,7 +106,7 @@ typedef struct W_Screen {
|
||||
W_FocusInfo *focusInfo;
|
||||
|
||||
RImage *applicationIconImage; /* image (can have alpha channel) */
|
||||
W_Pixmap *applicationIconPixmap; /* pixmap - no alpha channel */
|
||||
WMPixmap *applicationIconPixmap; /* pixmap - no alpha channel */
|
||||
Window applicationIconWindow;
|
||||
|
||||
struct W_Window *windowList; /* list of windows in the app */
|
||||
@@ -130,10 +132,10 @@ typedef struct W_Screen {
|
||||
W_DraggingInfo dragInfo;
|
||||
|
||||
/* colors */
|
||||
W_Color *white;
|
||||
W_Color *black;
|
||||
W_Color *gray;
|
||||
W_Color *darkGray;
|
||||
WMColor *white;
|
||||
WMColor *black;
|
||||
WMColor *gray;
|
||||
WMColor *darkGray;
|
||||
|
||||
GC stippleGC;
|
||||
|
||||
@@ -163,57 +165,57 @@ typedef struct W_Screen {
|
||||
struct W_Balloon *balloon;
|
||||
|
||||
|
||||
W_Pixmap *checkButtonImageOn;
|
||||
W_Pixmap *checkButtonImageOff;
|
||||
WMPixmap *checkButtonImageOn;
|
||||
WMPixmap *checkButtonImageOff;
|
||||
|
||||
W_Pixmap *radioButtonImageOn;
|
||||
W_Pixmap *radioButtonImageOff;
|
||||
WMPixmap *radioButtonImageOn;
|
||||
WMPixmap *radioButtonImageOff;
|
||||
|
||||
W_Pixmap *buttonArrow;
|
||||
W_Pixmap *pushedButtonArrow;
|
||||
WMPixmap *buttonArrow;
|
||||
WMPixmap *pushedButtonArrow;
|
||||
|
||||
W_Pixmap *scrollerDimple;
|
||||
WMPixmap *scrollerDimple;
|
||||
|
||||
W_Pixmap *upArrow;
|
||||
W_Pixmap *downArrow;
|
||||
W_Pixmap *leftArrow;
|
||||
W_Pixmap *rightArrow;
|
||||
WMPixmap *upArrow;
|
||||
WMPixmap *downArrow;
|
||||
WMPixmap *leftArrow;
|
||||
WMPixmap *rightArrow;
|
||||
|
||||
W_Pixmap *hiUpArrow;
|
||||
W_Pixmap *hiDownArrow;
|
||||
W_Pixmap *hiLeftArrow;
|
||||
W_Pixmap *hiRightArrow;
|
||||
WMPixmap *hiUpArrow;
|
||||
WMPixmap *hiDownArrow;
|
||||
WMPixmap *hiLeftArrow;
|
||||
WMPixmap *hiRightArrow;
|
||||
|
||||
W_Pixmap *pullDownIndicator;
|
||||
W_Pixmap *popUpIndicator;
|
||||
WMPixmap *pullDownIndicator;
|
||||
WMPixmap *popUpIndicator;
|
||||
|
||||
W_Pixmap *checkMark;
|
||||
WMPixmap *checkMark;
|
||||
|
||||
W_Pixmap *homeIcon;
|
||||
W_Pixmap *altHomeIcon;
|
||||
WMPixmap *homeIcon;
|
||||
WMPixmap *altHomeIcon;
|
||||
|
||||
W_Pixmap *trashcanIcon;
|
||||
W_Pixmap *altTrashcanIcon;
|
||||
WMPixmap *trashcanIcon;
|
||||
WMPixmap *altTrashcanIcon;
|
||||
|
||||
W_Pixmap *createDirIcon;
|
||||
W_Pixmap *altCreateDirIcon;
|
||||
WMPixmap *createDirIcon;
|
||||
WMPixmap *altCreateDirIcon;
|
||||
|
||||
W_Pixmap *disketteIcon;
|
||||
W_Pixmap *altDisketteIcon;
|
||||
W_Pixmap *unmountIcon;
|
||||
W_Pixmap *altUnmountIcon;
|
||||
WMPixmap *disketteIcon;
|
||||
WMPixmap *altDisketteIcon;
|
||||
WMPixmap *unmountIcon;
|
||||
WMPixmap *altUnmountIcon;
|
||||
|
||||
W_Pixmap *magnifyIcon;
|
||||
/*W_Pixmap *altMagnifyIcon;*/
|
||||
W_Pixmap *wheelIcon;
|
||||
W_Pixmap *grayIcon;
|
||||
W_Pixmap *rgbIcon;
|
||||
W_Pixmap *cmykIcon;
|
||||
W_Pixmap *hsbIcon;
|
||||
W_Pixmap *customPaletteIcon;
|
||||
W_Pixmap *colorListIcon;
|
||||
WMPixmap *magnifyIcon;
|
||||
/*WMPixmap *altMagnifyIcon;*/
|
||||
WMPixmap *wheelIcon;
|
||||
WMPixmap *grayIcon;
|
||||
WMPixmap *rgbIcon;
|
||||
WMPixmap *cmykIcon;
|
||||
WMPixmap *hsbIcon;
|
||||
WMPixmap *customPaletteIcon;
|
||||
WMPixmap *colorListIcon;
|
||||
|
||||
W_Pixmap *defaultObjectIcon;
|
||||
WMPixmap *defaultObjectIcon;
|
||||
|
||||
Cursor defaultCursor;
|
||||
|
||||
@@ -270,9 +272,9 @@ typedef struct W_Screen {
|
||||
* Added at the end of the structure to avoid breaking binary compatibility
|
||||
* with previous versions of the toolkit
|
||||
*/
|
||||
W_Pixmap *tristateButtonImageOn;
|
||||
W_Pixmap *tristateButtonImageOff;
|
||||
W_Pixmap *tristateButtonImageTri;
|
||||
WMPixmap *tristateButtonImageOn;
|
||||
WMPixmap *tristateButtonImageOff;
|
||||
WMPixmap *tristateButtonImageTri;
|
||||
|
||||
} W_Screen;
|
||||
|
||||
@@ -413,23 +415,6 @@ void W_BalloonHandleEnterView(WMView *view);
|
||||
void W_BalloonHandleLeaveView(WMView *view);
|
||||
|
||||
|
||||
/* ---[ wcolor.c ]-------------------------------------------------------- */
|
||||
|
||||
struct W_Color {
|
||||
struct W_Screen *screen;
|
||||
|
||||
XColor color;
|
||||
unsigned short alpha;
|
||||
short refCount;
|
||||
GC gc;
|
||||
struct {
|
||||
unsigned int exact:1;
|
||||
} flags;
|
||||
};
|
||||
|
||||
#define W_PIXEL(c) (c)->color.pixel
|
||||
|
||||
|
||||
/* ---[ wevent.c ]-------------------------------------------------------- */
|
||||
|
||||
typedef struct W_EventHandler {
|
||||
@@ -491,7 +476,7 @@ void W_DrawReliefWithGC(W_Screen *scr, Drawable d, int x, int y,
|
||||
|
||||
void W_PaintTextAndImage(W_View *view, int wrap, WMColor *textColor,
|
||||
WMFont *font, WMReliefType relief, const char *text,
|
||||
WMAlignment alignment, W_Pixmap *image,
|
||||
WMAlignment alignment, WMPixmap *image,
|
||||
WMImagePosition position, WMColor *backColor, int ofs);
|
||||
|
||||
void W_PaintText(W_View *view, Drawable d, WMFont *font, int x, int y,
|
||||
@@ -501,19 +486,6 @@ void W_PaintText(W_View *view, Drawable d, WMFont *font, int x, int y,
|
||||
int W_GetTextHeight(WMFont *font, const char *text, int width, int wrap);
|
||||
|
||||
|
||||
/* ---[ wpixmap.c ]------------------------------------------------------- */
|
||||
|
||||
struct W_Pixmap {
|
||||
struct W_Screen *screen;
|
||||
Pixmap pixmap;
|
||||
Pixmap mask;
|
||||
unsigned short width;
|
||||
unsigned short height;
|
||||
short depth;
|
||||
short refCount;
|
||||
};
|
||||
|
||||
|
||||
/* ---[ wview.c ]--------------------------------------------------------- */
|
||||
|
||||
typedef struct W_ViewDelegate {
|
||||
|
||||
@@ -281,7 +281,7 @@ char* wtrimspace(const char *s);
|
||||
*/
|
||||
char *wshellquote(const char *s);
|
||||
|
||||
/* ---[ WINGs/misc.c ]--------------------------------------------------- */
|
||||
/* ---[ wutil-rs/src/range.rs ]------------------------------------------ */
|
||||
|
||||
WMRange wmkrange(int start, int count);
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ static Window makeDragIcon(WMScreen * scr, WMPixmap * pixmap)
|
||||
|
||||
flags = CWSaveUnder | CWBackPixmap | CWOverrideRedirect | CWColormap;
|
||||
attribs.save_under = True;
|
||||
attribs.background_pixmap = pixmap->pixmap;
|
||||
attribs.background_pixmap = WMGetPixmapXID(pixmap);
|
||||
attribs.override_redirect = True;
|
||||
attribs.colormap = scr->colormap;
|
||||
|
||||
@@ -203,8 +203,8 @@ static Window makeDragIcon(WMScreen * scr, WMPixmap * pixmap)
|
||||
size.height, 0, scr->depth, InputOutput, scr->visual, flags, &attribs);
|
||||
|
||||
#ifdef USE_XSHAPE
|
||||
if (pixmap->mask) {
|
||||
XShapeCombineMask(scr->display, window, ShapeBounding, 0, 0, pixmap->mask, ShapeSet);
|
||||
if (WMGetPixmapMaskXID(pixmap)) {
|
||||
XShapeCombineMask(scr->display, window, ShapeBounding, 0, 0, WMGetPixmapMaskXID(pixmap), ShapeSet);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -24,16 +24,6 @@
|
||||
|
||||
#include "error.h"
|
||||
|
||||
WMRange wmkrange(int start, int count)
|
||||
{
|
||||
WMRange range;
|
||||
|
||||
range.position = start;
|
||||
range.count = count;
|
||||
|
||||
return range;
|
||||
}
|
||||
|
||||
/*
|
||||
* wutil_shutdown - cleanup in WUtil when user program wants to exit
|
||||
*/
|
||||
|
||||
@@ -63,8 +63,8 @@ void WMSetApplicationIconPixmap(WMScreen * scr, WMPixmap * icon)
|
||||
|
||||
hints = XGetWMHints(scr->display, scr->groupLeader);
|
||||
hints->flags |= IconPixmapHint | IconMaskHint;
|
||||
hints->icon_pixmap = (icon != NULL ? icon->pixmap : None);
|
||||
hints->icon_mask = (icon != NULL ? icon->mask : None);
|
||||
hints->icon_pixmap = (icon != NULL ? WMGetPixmapXID(icon) : None);
|
||||
hints->icon_mask = (icon != NULL ? WMGetPixmapMaskXID(icon) : None);
|
||||
|
||||
XSetWMHints(scr->display, scr->groupLeader, hints);
|
||||
XFree(hints);
|
||||
@@ -76,22 +76,12 @@ WMPixmap *WMGetApplicationIconPixmap(WMScreen * scr)
|
||||
return scr->applicationIconPixmap;
|
||||
}
|
||||
|
||||
WMPixmap *WMCreateApplicationIconBlendedPixmap(WMScreen * scr, const RColor * color)
|
||||
WMPixmap *WMCreateApplicationIconGreyedPixmap(WMScreen * scr)
|
||||
{
|
||||
WMPixmap *pix;
|
||||
|
||||
if (scr->applicationIconImage) {
|
||||
static const RColor gray = {
|
||||
/* red */ 0xAE,
|
||||
/* green */ 0xAA,
|
||||
/* blue */ 0xAE,
|
||||
/* alpha */ 0xFF
|
||||
};
|
||||
|
||||
if (!color)
|
||||
color = &gray;
|
||||
|
||||
pix = WMCreateBlendedPixmapFromRImage(scr, scr->applicationIconImage, color);
|
||||
pix = WMCreateGreyedPixmapFromRImage(scr, scr->applicationIconImage);
|
||||
} else {
|
||||
pix = NULL;
|
||||
}
|
||||
@@ -133,10 +123,10 @@ void W_InitApplication(WMScreen * scr)
|
||||
*/
|
||||
if (scr->applicationIconPixmap) {
|
||||
hints->flags |= IconPixmapHint;
|
||||
hints->icon_pixmap = scr->applicationIconPixmap->pixmap;
|
||||
if (scr->applicationIconPixmap->mask) {
|
||||
hints->icon_pixmap = WMGetPixmapXID(scr->applicationIconPixmap);
|
||||
if (WMGetPixmapMaskXID(scr->applicationIconPixmap)) {
|
||||
hints->flags |= IconMaskHint;
|
||||
hints->icon_mask = scr->applicationIconPixmap->mask;
|
||||
hints->icon_mask = WMGetPixmapMaskXID(scr->applicationIconPixmap);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,11 +15,11 @@ typedef struct W_Button {
|
||||
WMColor *altTextColor;
|
||||
WMColor *disTextColor;
|
||||
|
||||
W_Pixmap *image;
|
||||
W_Pixmap *altImage;
|
||||
W_Pixmap *tsImage;
|
||||
WMPixmap *image;
|
||||
WMPixmap *altImage;
|
||||
WMPixmap *tsImage;
|
||||
|
||||
W_Pixmap *dimage;
|
||||
WMPixmap *dimage;
|
||||
|
||||
void *clientData;
|
||||
WMAction *action;
|
||||
@@ -232,32 +232,32 @@ static void updateDisabledMask(WMButton * bPtr)
|
||||
if (bPtr->image) {
|
||||
XGCValues gcv;
|
||||
|
||||
if (bPtr->dimage->mask) {
|
||||
XFreePixmap(dpy, bPtr->dimage->mask);
|
||||
bPtr->dimage->mask = None;
|
||||
if (WMGetPixmapMaskXID(bPtr->dimage)) {
|
||||
XFreePixmap(dpy, WMGetPixmapMaskXID(bPtr->dimage));
|
||||
WMSetPixmapMaskXID(bPtr->dimage, 0);
|
||||
}
|
||||
|
||||
if (bPtr->flags.dimsWhenDisabled) {
|
||||
bPtr->dimage->mask = XCreatePixmap(dpy, scr->stipple,
|
||||
bPtr->dimage->width, bPtr->dimage->height, 1);
|
||||
WMSize size = WMGetPixmapSize(bPtr->dimage);
|
||||
WMSetPixmapMaskXID(bPtr->dimage, XCreatePixmap(dpy, scr->stipple, size.width, size.height, 1));
|
||||
|
||||
XSetForeground(dpy, scr->monoGC, 0);
|
||||
XFillRectangle(dpy, bPtr->dimage->mask, scr->monoGC, 0, 0,
|
||||
bPtr->dimage->width, bPtr->dimage->height);
|
||||
XFillRectangle(dpy, WMGetPixmapMaskXID(bPtr->dimage), scr->monoGC, 0, 0,
|
||||
size.width, size.height);
|
||||
|
||||
gcv.foreground = 1;
|
||||
gcv.background = 0;
|
||||
gcv.stipple = scr->stipple;
|
||||
gcv.fill_style = FillStippled;
|
||||
gcv.clip_mask = bPtr->image->mask;
|
||||
gcv.clip_mask = WMGetPixmapMaskXID(bPtr->image);
|
||||
gcv.clip_x_origin = 0;
|
||||
gcv.clip_y_origin = 0;
|
||||
|
||||
XChangeGC(dpy, scr->monoGC, GCForeground | GCBackground | GCStipple
|
||||
| GCFillStyle | GCClipMask | GCClipXOrigin | GCClipYOrigin, &gcv);
|
||||
|
||||
XFillRectangle(dpy, bPtr->dimage->mask, scr->monoGC, 0, 0,
|
||||
bPtr->dimage->width, bPtr->dimage->height);
|
||||
XFillRectangle(dpy, WMGetPixmapMaskXID(bPtr->dimage), scr->monoGC, 0, 0,
|
||||
size.width, size.height);
|
||||
|
||||
gcv.fill_style = FillSolid;
|
||||
gcv.clip_mask = None;
|
||||
@@ -279,15 +279,17 @@ void WMSetButtonImage(WMButton * bPtr, WMPixmap * image)
|
||||
bPtr->image = WMRetainPixmap(image);
|
||||
|
||||
if (bPtr->dimage) {
|
||||
bPtr->dimage->pixmap = None;
|
||||
WMLeakPixmapXID(bPtr->dimage);
|
||||
WMReleasePixmap(bPtr->dimage);
|
||||
bPtr->dimage = NULL;
|
||||
}
|
||||
|
||||
if (image) {
|
||||
WMSize size = WMGetPixmapSize(image);
|
||||
bPtr->dimage = WMCreatePixmapFromXPixmaps(WMWidgetScreen(bPtr),
|
||||
image->pixmap, None,
|
||||
image->width, image->height, image->depth);
|
||||
WMGetPixmapXID(image), None,
|
||||
size.width, size.height,
|
||||
WMGetPixmapDepth(image));
|
||||
updateDisabledMask(bPtr);
|
||||
}
|
||||
|
||||
@@ -771,7 +773,7 @@ static void destroyButton(Button * bPtr)
|
||||
|
||||
if (bPtr->dimage) {
|
||||
/* yuck.. kluge */
|
||||
bPtr->dimage->pixmap = None;
|
||||
WMLeakPixmapXID(bPtr->dimage);
|
||||
|
||||
WMReleasePixmap(bPtr->dimage);
|
||||
}
|
||||
|
||||
@@ -560,7 +560,7 @@ static WMColorPanel *makeColorPanel(WMScreen * scrPtr, const char *name)
|
||||
RReleaseImage(image);
|
||||
|
||||
if (pixmap)
|
||||
W_PaintText(W_VIEW(panel->grayBrightnessS), pixmap->pixmap,
|
||||
W_PaintText(W_VIEW(panel->grayBrightnessS), WMGetPixmapXID(pixmap),
|
||||
panel->font12, 2, 0, 100, WALeft, scrPtr->white,
|
||||
False, _("Brightness"), strlen(_("Brightness")));
|
||||
else
|
||||
@@ -581,7 +581,7 @@ static WMColorPanel *makeColorPanel(WMScreen * scrPtr, const char *name)
|
||||
|
||||
graybuttoncolor = WMCreateRGBColor(scrPtr, (255 / 6) * i << 8,
|
||||
(255 / 6) * i << 8, (255 / 6) * i << 8, True);
|
||||
WMPaintColorSwatch(graybuttoncolor, pixmap->pixmap, 0, 0, 15, 15);
|
||||
WMPaintColorSwatch(graybuttoncolor, WMGetPixmapXID(pixmap), 0, 0, 15, 15);
|
||||
WMReleaseColor(graybuttoncolor);
|
||||
|
||||
panel->grayPresetBtn[i] = WMCreateCommandButton(panel->grayFrm);
|
||||
@@ -635,7 +635,7 @@ static WMColorPanel *makeColorPanel(WMScreen * scrPtr, const char *name)
|
||||
RReleaseImage(image);
|
||||
|
||||
if (pixmap)
|
||||
W_PaintText(W_VIEW(panel->rgbRedS), pixmap->pixmap, panel->font12,
|
||||
W_PaintText(W_VIEW(panel->rgbRedS), WMGetPixmapXID(pixmap), panel->font12,
|
||||
2, 0, 100, WALeft, scrPtr->white, False, _("Red"), strlen(_("Red")));
|
||||
else
|
||||
wwarning(_("Color Panel: Could not allocate memory"));
|
||||
@@ -666,7 +666,7 @@ static WMColorPanel *makeColorPanel(WMScreen * scrPtr, const char *name)
|
||||
RReleaseImage(image);
|
||||
|
||||
if (pixmap)
|
||||
W_PaintText(W_VIEW(panel->rgbGreenS), pixmap->pixmap, panel->font12,
|
||||
W_PaintText(W_VIEW(panel->rgbGreenS), WMGetPixmapXID(pixmap), panel->font12,
|
||||
2, 0, 100, WALeft, scrPtr->white, False, _("Green"), strlen(_("Green")));
|
||||
else
|
||||
wwarning(_("Color Panel: Could not allocate memory"));
|
||||
@@ -697,7 +697,7 @@ static WMColorPanel *makeColorPanel(WMScreen * scrPtr, const char *name)
|
||||
RReleaseImage(image);
|
||||
|
||||
if (pixmap)
|
||||
W_PaintText(W_VIEW(panel->rgbBlueS), pixmap->pixmap, panel->font12,
|
||||
W_PaintText(W_VIEW(panel->rgbBlueS), WMGetPixmapXID(pixmap), panel->font12,
|
||||
2, 0, 100, WALeft, scrPtr->white, False, _("Blue"), strlen(_("Blue")));
|
||||
else
|
||||
wwarning(_("Color Panel: Could not allocate memory"));
|
||||
@@ -772,7 +772,7 @@ static WMColorPanel *makeColorPanel(WMScreen * scrPtr, const char *name)
|
||||
RReleaseImage(image);
|
||||
|
||||
if (pixmap)
|
||||
W_PaintText(W_VIEW(panel->cmykCyanS), pixmap->pixmap, panel->font12,
|
||||
W_PaintText(W_VIEW(panel->cmykCyanS), WMGetPixmapXID(pixmap), panel->font12,
|
||||
2, 0, 100, WALeft, scrPtr->black, False, _("Cyan"), strlen(_("Cyan")));
|
||||
else
|
||||
wwarning(_("Color Panel: Could not allocate memory"));
|
||||
@@ -803,7 +803,7 @@ static WMColorPanel *makeColorPanel(WMScreen * scrPtr, const char *name)
|
||||
RReleaseImage(image);
|
||||
|
||||
if (pixmap)
|
||||
W_PaintText(W_VIEW(panel->cmykMagentaS), pixmap->pixmap, panel->font12,
|
||||
W_PaintText(W_VIEW(panel->cmykMagentaS), WMGetPixmapXID(pixmap), panel->font12,
|
||||
2, 0, 100, WALeft, scrPtr->black, False, _("Magenta"), strlen(_("Magenta")));
|
||||
else
|
||||
wwarning(_("Color Panel: Could not allocate memory"));
|
||||
@@ -835,7 +835,7 @@ static WMColorPanel *makeColorPanel(WMScreen * scrPtr, const char *name)
|
||||
RReleaseImage(image);
|
||||
|
||||
if (pixmap)
|
||||
W_PaintText(W_VIEW(panel->cmykYellowS), pixmap->pixmap, panel->font12,
|
||||
W_PaintText(W_VIEW(panel->cmykYellowS), WMGetPixmapXID(pixmap), panel->font12,
|
||||
2, 0, 100, WALeft, scrPtr->black, False, _("Yellow"), strlen(_("Yellow")));
|
||||
else
|
||||
wwarning(_("Color Panel: Could not allocate memory"));
|
||||
@@ -868,7 +868,7 @@ static WMColorPanel *makeColorPanel(WMScreen * scrPtr, const char *name)
|
||||
RReleaseImage(image);
|
||||
|
||||
if (pixmap)
|
||||
W_PaintText(W_VIEW(panel->cmykBlackS), pixmap->pixmap, panel->font12,
|
||||
W_PaintText(W_VIEW(panel->cmykBlackS), WMGetPixmapXID(pixmap), panel->font12,
|
||||
2, 0, 100, WALeft, scrPtr->black, False, _("Black"), strlen(_("Black")));
|
||||
else
|
||||
wwarning(_("Color Panel: Could not allocate memory"));
|
||||
@@ -1292,7 +1292,7 @@ void WMSetColorPanelPickerMode(WMColorPanel * panel, WMColorPanelMode mode)
|
||||
panel->mode = mode;
|
||||
}
|
||||
|
||||
WMColor *WMGetColorPanelColor(WMColorPanel * panel)
|
||||
WMColor* WMGetColorPanelColor(WMColorPanel * panel)
|
||||
{
|
||||
return WMGetColorWellColor(panel->colorWell);
|
||||
}
|
||||
@@ -1301,9 +1301,9 @@ void WMSetColorPanelColor(WMColorPanel * panel, WMColor * color)
|
||||
{
|
||||
WMSetColorWellColor(panel->colorWell, color);
|
||||
|
||||
panel->color.rgb.red = color->color.red >> 8;
|
||||
panel->color.rgb.green = color->color.green >> 8;
|
||||
panel->color.rgb.blue = color->color.blue >> 8;
|
||||
panel->color.rgb.red = (WMRedComponentOfColor(color) >> 8);
|
||||
panel->color.rgb.green = (WMGreenComponentOfColor(color) >> 8);
|
||||
panel->color.rgb.blue = (WMBlueComponentOfColor(color) >> 8);
|
||||
panel->color.set = cpRGB;
|
||||
|
||||
if (panel->mode == panel->lastChanged)
|
||||
@@ -2711,7 +2711,7 @@ static void hsbUpdateBrightnessGradient(W_ColorPanel * panel)
|
||||
RReleaseImage(sliderImg);
|
||||
|
||||
if (sliderPxmp)
|
||||
W_PaintText(W_VIEW(panel->hsbBrightnessS), sliderPxmp->pixmap,
|
||||
W_PaintText(W_VIEW(panel->hsbBrightnessS), WMGetPixmapXID(sliderPxmp),
|
||||
panel->font12, 2, 0, 100, WALeft, scr->white,
|
||||
False, _("Brightness"), strlen(_("Brightness")));
|
||||
else
|
||||
@@ -2744,7 +2744,7 @@ static void hsbUpdateSaturationGradient(W_ColorPanel * panel)
|
||||
RReleaseImage(sliderImg);
|
||||
|
||||
if (sliderPxmp)
|
||||
W_PaintText(W_VIEW(panel->hsbSaturationS), sliderPxmp->pixmap,
|
||||
W_PaintText(W_VIEW(panel->hsbSaturationS), WMGetPixmapXID(sliderPxmp),
|
||||
panel->font12, 2, 0, 100, WALeft,
|
||||
from.hsv.value < 128 ? scr->white : scr->black, False,
|
||||
_("Saturation"), strlen(_("Saturation")));
|
||||
@@ -2779,7 +2779,7 @@ static void hsbUpdateHueGradient(W_ColorPanel * panel)
|
||||
RReleaseImage(sliderImg);
|
||||
|
||||
if (sliderPxmp)
|
||||
W_PaintText(W_VIEW(panel->hsbHueS), sliderPxmp->pixmap,
|
||||
W_PaintText(W_VIEW(panel->hsbHueS), WMGetPixmapXID(sliderPxmp),
|
||||
panel->font12, 2, 0, 100, WALeft,
|
||||
hsvcolor.value < 128 ? scr->white : scr->black, False, _("Hue"), strlen(_("Hue")));
|
||||
else
|
||||
|
||||
@@ -180,7 +180,7 @@ static WMFilePanel *makeFilePanel(WMScreen * scrPtr, const char *name, const cha
|
||||
WMResizeWidget(fPtr->iconLabel, 64, 64);
|
||||
WMMoveWidget(fPtr->iconLabel, 0, 0);
|
||||
WMSetLabelImagePosition(fPtr->iconLabel, WIPImageOnly);
|
||||
icon = WMCreateApplicationIconBlendedPixmap(scrPtr, (RColor *) NULL);
|
||||
icon = WMCreateApplicationIconGreyedPixmap(scrPtr);
|
||||
if (icon) {
|
||||
WMSetLabelImage(fPtr->iconLabel, icon);
|
||||
WMReleasePixmap(icon);
|
||||
|
||||
@@ -725,14 +725,14 @@ WMScreen *WMCreateScreenWithRContext(Display * display, int screen, RContext * c
|
||||
gcv.graphics_exposures = False;
|
||||
|
||||
gcv.function = GXxor;
|
||||
gcv.foreground = W_PIXEL(scrPtr->white);
|
||||
gcv.foreground = WMColorPixel(scrPtr->white);
|
||||
if (gcv.foreground == 0)
|
||||
gcv.foreground = 1;
|
||||
scrPtr->xorGC = XCreateGC(display, W_DRAWABLE(scrPtr), GCFunction
|
||||
| GCGraphicsExposures | GCForeground, &gcv);
|
||||
|
||||
gcv.function = GXxor;
|
||||
gcv.foreground = W_PIXEL(scrPtr->gray);
|
||||
gcv.foreground = WMColorPixel(scrPtr->gray);
|
||||
gcv.subwindow_mode = IncludeInferiors;
|
||||
scrPtr->ixorGC = XCreateGC(display, W_DRAWABLE(scrPtr), GCFunction
|
||||
| GCGraphicsExposures | GCForeground | GCSubwindowMode, &gcv);
|
||||
@@ -743,8 +743,8 @@ WMScreen *WMCreateScreenWithRContext(Display * display, int screen, RContext * c
|
||||
scrPtr->clipGC = XCreateGC(display, W_DRAWABLE(scrPtr), GCFunction | GCGraphicsExposures, &gcv);
|
||||
|
||||
stipple = XCreateBitmapFromData(display, W_DRAWABLE(scrPtr), STIPPLE_BITS, STIPPLE_WIDTH, STIPPLE_HEIGHT);
|
||||
gcv.foreground = W_PIXEL(scrPtr->darkGray);
|
||||
gcv.background = W_PIXEL(scrPtr->gray);
|
||||
gcv.foreground = WMColorPixel(scrPtr->darkGray);
|
||||
gcv.background = WMColorPixel(scrPtr->gray);
|
||||
gcv.fill_style = FillStippled;
|
||||
gcv.stipple = stipple;
|
||||
scrPtr->stippleGC = XCreateGC(display, W_DRAWABLE(scrPtr),
|
||||
@@ -1000,7 +1000,7 @@ void WMSetWidgetBackgroundColor(WMWidget * w, WMColor * color)
|
||||
WMRedisplayWidget(w);
|
||||
}
|
||||
|
||||
WMColor *WMGetWidgetBackgroundColor(WMWidget * w)
|
||||
WMColor * WMGetWidgetBackgroundColor(WMWidget * w)
|
||||
{
|
||||
return W_VIEW(w)->backColor;
|
||||
}
|
||||
|
||||
@@ -1,993 +0,0 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "adler2"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
|
||||
|
||||
[[package]]
|
||||
name = "allocator-api2"
|
||||
version = "0.2.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.102"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"
|
||||
|
||||
[[package]]
|
||||
name = "atomic-write-file"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "84790c55b5704b0d35130bf16a4ce22a8e70eb0ea773522557524d9a4852663d"
|
||||
dependencies = [
|
||||
"nix",
|
||||
"rand 0.9.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.2.56"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aebf35691d1bfb0ac386a69bac2fde4dd276fb618cf8bf4f5318fe285e821bb2"
|
||||
dependencies = [
|
||||
"find-msvc-tools",
|
||||
"shlex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-expr"
|
||||
version = "0.20.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78cef5b5a1a6827c7322ae2a636368a573006b27cfa76c7ebd53e834daeaab6a"
|
||||
dependencies = [
|
||||
"smallvec",
|
||||
"target-lexicon",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
||||
|
||||
[[package]]
|
||||
name = "cfg_aliases"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
|
||||
|
||||
[[package]]
|
||||
name = "console"
|
||||
version = "0.16.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d64e8af5551369d19cf50138de61f1c42074ab970f74e99be916646777f8fc87"
|
||||
dependencies = [
|
||||
"encode_unicode",
|
||||
"libc",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crc32fast"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dlib"
|
||||
version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a"
|
||||
dependencies = [
|
||||
"libloading",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encode_unicode"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0"
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.3.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "2.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
|
||||
|
||||
[[package]]
|
||||
name = "fdeflate"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c"
|
||||
dependencies = [
|
||||
"simd-adler32",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "find-msvc-tools"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
|
||||
|
||||
[[package]]
|
||||
name = "flate2"
|
||||
version = "1.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"miniz_oxide",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "foldhash"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
|
||||
|
||||
[[package]]
|
||||
name = "foldhash"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
|
||||
|
||||
[[package]]
|
||||
name = "fuchsia-cprng"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"r-efi",
|
||||
"wasip2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "139ef39800118c7683f2fd3c98c1b23c09ae076556b435f8e9064ae108aaeeec"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"r-efi",
|
||||
"wasip2",
|
||||
"wasip3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glib-sys"
|
||||
version = "0.21.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2d95e1a3a19ae464a7286e14af9a90683c64d70c02532d88d87ce95056af3e6c"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"system-deps",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gobject-sys"
|
||||
version = "0.21.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2dca35da0d19a18f4575f3cb99fe1c9e029a2941af5662f326f738a21edaf294"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"libc",
|
||||
"system-deps",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.15.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
|
||||
dependencies = [
|
||||
"foldhash 0.1.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.16.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
|
||||
dependencies = [
|
||||
"allocator-api2",
|
||||
"equivalent",
|
||||
"foldhash 0.2.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||
|
||||
[[package]]
|
||||
name = "id-arena"
|
||||
version = "2.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954"
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown 0.16.1",
|
||||
"serde",
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "insta"
|
||||
version = "1.47.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f40e41efb5f592d3a0764f818e2f08e5e21c4f368126f74f37c81bd4af7a0c6"
|
||||
dependencies = [
|
||||
"console",
|
||||
"once_cell",
|
||||
"similar",
|
||||
"tempfile",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "insta-image"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7996488b176249911af0e5d17b2bdfe43e33267f650291cb874c0d4654e1dcb8"
|
||||
dependencies = [
|
||||
"insta",
|
||||
"png",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2"
|
||||
|
||||
[[package]]
|
||||
name = "leb128fmt"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.182"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112"
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
version = "0.8.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.8.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
|
||||
dependencies = [
|
||||
"adler2",
|
||||
"simd-adler32",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.30.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cfg-if",
|
||||
"cfg_aliases",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nom"
|
||||
version = "8.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nom-language"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2de2bc5b451bfedaef92c90b8939a8fff5770bdcc1fafd6239d086aab8fa6b29"
|
||||
dependencies = [
|
||||
"nom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.21.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
||||
|
||||
[[package]]
|
||||
name = "pango-sys"
|
||||
version = "0.21.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4f06627d36ed5ff303d2df65211fc2e52ba5b17bf18dd80ff3d9628d6e06cfd"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"gobject-sys",
|
||||
"libc",
|
||||
"system-deps",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
|
||||
|
||||
[[package]]
|
||||
name = "png"
|
||||
version = "0.18.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"crc32fast",
|
||||
"fdeflate",
|
||||
"flate2",
|
||||
"miniz_oxide",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
|
||||
dependencies = [
|
||||
"zerocopy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "prettyplease"
|
||||
version = "0.2.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.106"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "r-efi"
|
||||
version = "5.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"
|
||||
dependencies = [
|
||||
"fuchsia-cprng",
|
||||
"libc",
|
||||
"rand_core 0.3.1",
|
||||
"rdrand",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.9.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1"
|
||||
dependencies = [
|
||||
"rand_chacha",
|
||||
"rand_core 0.9.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core 0.9.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
|
||||
dependencies = [
|
||||
"rand_core 0.4.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.9.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c"
|
||||
dependencies = [
|
||||
"getrandom 0.3.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rdrand"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
|
||||
dependencies = [
|
||||
"rand_core 0.3.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "remove_dir_all"
|
||||
version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "1.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.228"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
|
||||
dependencies = [
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_core"
|
||||
version = "1.0.228"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.228"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.149"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"memchr",
|
||||
"serde",
|
||||
"serde_core",
|
||||
"zmij",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_spanned"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8bbf91e5a4d6315eee45e704372590b30e260ee83af6639d64557f51b067776"
|
||||
dependencies = [
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "shlex"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||
|
||||
[[package]]
|
||||
name = "simd-adler32"
|
||||
version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2"
|
||||
|
||||
[[package]]
|
||||
name = "similar"
|
||||
version = "2.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa"
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.15.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.117"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "system-deps"
|
||||
version = "7.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "48c8f33736f986f16d69b6cb8b03f55ddcad5c41acc4ccc39dd88e84aa805e7f"
|
||||
dependencies = [
|
||||
"cfg-expr",
|
||||
"heck",
|
||||
"pkg-config",
|
||||
"toml",
|
||||
"version-compare",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "target-lexicon"
|
||||
version = "0.13.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df7f62577c25e07834649fc3b39fafdc597c0a3527dc1c60129201ccfcbaa50c"
|
||||
|
||||
[[package]]
|
||||
name = "tempdir"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"
|
||||
dependencies = [
|
||||
"rand 0.4.6",
|
||||
"remove_dir_all",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.26.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "82a72c767771b47409d2345987fda8628641887d5466101319899796367354a0"
|
||||
dependencies = [
|
||||
"fastrand",
|
||||
"getrandom 0.4.1",
|
||||
"once_cell",
|
||||
"rustix",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.9.12+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"serde_core",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
"toml_parser",
|
||||
"toml_writer",
|
||||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_datetime"
|
||||
version = "0.7.5+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347"
|
||||
dependencies = [
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_parser"
|
||||
version = "1.0.9+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "702d4415e08923e7e1ef96cd5727c0dfed80b4d2fa25db9647fe5eb6f7c5a4c4"
|
||||
dependencies = [
|
||||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_writer"
|
||||
version = "1.0.6+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab16f14aed21ee8bfd8ec22513f7287cd4a91aa92e44edfe2c17ddd004e92607"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
|
||||
|
||||
[[package]]
|
||||
name = "version-compare"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "03c2856837ef78f57382f06b2b8563a2f512f7185d732608fd9176cb3b8edf0e"
|
||||
|
||||
[[package]]
|
||||
name = "wasip2"
|
||||
version = "1.0.2+wasi-0.2.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5"
|
||||
dependencies = [
|
||||
"wit-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasip3"
|
||||
version = "0.4.0+wasi-0.3.0-rc-2026-01-06"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5"
|
||||
dependencies = [
|
||||
"wit-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-encoder"
|
||||
version = "0.244.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319"
|
||||
dependencies = [
|
||||
"leb128fmt",
|
||||
"wasmparser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-metadata"
|
||||
version = "0.244.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"indexmap",
|
||||
"wasm-encoder",
|
||||
"wasmparser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmparser"
|
||||
version = "0.244.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"hashbrown 0.15.5",
|
||||
"indexmap",
|
||||
"semver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu",
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows-link"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.61.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wings-rs"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"pango-sys",
|
||||
"wutil-rs",
|
||||
"x11",
|
||||
"yeslogic-fontconfig-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wings-rs-tests"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"insta",
|
||||
"insta-image",
|
||||
"libc",
|
||||
"png",
|
||||
"tempdir",
|
||||
"wings-rs",
|
||||
"wutil-rs",
|
||||
"x11",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.7.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829"
|
||||
|
||||
[[package]]
|
||||
name = "wit-bindgen"
|
||||
version = "0.51.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5"
|
||||
dependencies = [
|
||||
"wit-bindgen-rust-macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-bindgen-core"
|
||||
version = "0.51.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"heck",
|
||||
"wit-parser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-bindgen-rust"
|
||||
version = "0.51.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"heck",
|
||||
"indexmap",
|
||||
"prettyplease",
|
||||
"syn",
|
||||
"wasm-metadata",
|
||||
"wit-bindgen-core",
|
||||
"wit-component",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-bindgen-rust-macro"
|
||||
version = "0.51.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"prettyplease",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"wit-bindgen-core",
|
||||
"wit-bindgen-rust",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-component"
|
||||
version = "0.244.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bitflags",
|
||||
"indexmap",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"wasm-encoder",
|
||||
"wasm-metadata",
|
||||
"wasmparser",
|
||||
"wit-parser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-parser"
|
||||
version = "0.244.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"id-arena",
|
||||
"indexmap",
|
||||
"log",
|
||||
"semver",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"unicode-xid",
|
||||
"wasmparser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wutil-rs"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"atomic-write-file",
|
||||
"cc",
|
||||
"hashbrown 0.16.1",
|
||||
"nom",
|
||||
"nom-language",
|
||||
"x11",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "x11"
|
||||
version = "2.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "502da5464ccd04011667b11c435cb992822c2c0dbde1770c988480d312a0db2e"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "yeslogic-fontconfig-sys"
|
||||
version = "6.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "503a066b4c037c440169d995b869046827dbc71263f6e8f3be6d77d4f3229dbd"
|
||||
dependencies = [
|
||||
"dlib",
|
||||
"once_cell",
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.8.40"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a789c6e490b576db9f7e6b6d661bcc9799f7c0ac8352f56ea20193b2681532e5"
|
||||
dependencies = [
|
||||
"zerocopy-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy-derive"
|
||||
version = "0.8.40"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f65c489a7071a749c849713807783f70672b28094011623e200cb86dcb835953"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zmij"
|
||||
version = "1.0.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa"
|
||||
@@ -10,6 +10,7 @@ insta-image = { version = "1.0", features = ["png"] }
|
||||
png = "0.18"
|
||||
tempdir = "0.3.7"
|
||||
wings-rs = { path = "../wings-rs" }
|
||||
wrlib-rs = { path = "../../wrlib-rs" }
|
||||
wutil-rs = { path = "../../wutil-rs" }
|
||||
x11 = "2.21.0"
|
||||
|
||||
|
||||
@@ -15,14 +15,74 @@ RUST_SOURCES = \
|
||||
src/headless/xvfb.rs \
|
||||
src/headless/xwd.rs \
|
||||
src/lib.rs \
|
||||
src/logo_data.rs \
|
||||
tests/font_panel_tests.rs \
|
||||
tests/system_pixmap_tests.rs \
|
||||
tests/wmpixmap_tests.rs \
|
||||
tests/snapshots/font_panel_tests__font_panel.snap \
|
||||
tests/snapshots/font_panel_tests__font_panel.snap.png
|
||||
tests/snapshots/font_panel_tests__font_panel.snap.png \
|
||||
tests/snapshots/system_pixmap_tests__arrow_down.snap \
|
||||
tests/snapshots/system_pixmap_tests__arrow_down.snap.png \
|
||||
tests/snapshots/system_pixmap_tests__arrow_left.snap \
|
||||
tests/snapshots/system_pixmap_tests__arrow_left.snap.png \
|
||||
tests/snapshots/system_pixmap_tests__arrow_right.snap \
|
||||
tests/snapshots/system_pixmap_tests__arrow_right.snap.png \
|
||||
tests/snapshots/system_pixmap_tests__arrow_up.snap \
|
||||
tests/snapshots/system_pixmap_tests__arrow_up.snap.png \
|
||||
tests/snapshots/system_pixmap_tests__check_mark.snap \
|
||||
tests/snapshots/system_pixmap_tests__check_mark.snap.png \
|
||||
tests/snapshots/system_pixmap_tests__highlighted_arrow_down.snap \
|
||||
tests/snapshots/system_pixmap_tests__highlighted_arrow_down.snap.png \
|
||||
tests/snapshots/system_pixmap_tests__highlighted_arrow_left.snap \
|
||||
tests/snapshots/system_pixmap_tests__highlighted_arrow_left.snap.png \
|
||||
tests/snapshots/system_pixmap_tests__highlighted_arrow_right.snap \
|
||||
tests/snapshots/system_pixmap_tests__highlighted_arrow_right.snap.png \
|
||||
tests/snapshots/system_pixmap_tests__highlighted_arrow_up.snap \
|
||||
tests/snapshots/system_pixmap_tests__highlighted_arrow_up.snap.png \
|
||||
tests/snapshots/system_pixmap_tests__highlighted_return_arrow.snap \
|
||||
tests/snapshots/system_pixmap_tests__highlighted_return_arrow.snap.png \
|
||||
tests/snapshots/system_pixmap_tests__return_arrow.snap \
|
||||
tests/snapshots/system_pixmap_tests__return_arrow.snap.png \
|
||||
tests/snapshots/system_pixmap_tests__scroller_dimple.snap \
|
||||
tests/snapshots/system_pixmap_tests__scroller_dimple.snap.png \
|
||||
tests/snapshots/wmpixmap_tests__empty_pixmap_on_window.snap \
|
||||
tests/snapshots/wmpixmap_tests__empty_pixmap_on_window.snap.png \
|
||||
tests/snapshots/wmpixmap_tests__empty_window.snap \
|
||||
tests/snapshots/wmpixmap_tests__empty_window.snap.png \
|
||||
tests/snapshots/wmpixmap_tests__from_file_blended_base_pixmap.snap \
|
||||
tests/snapshots/wmpixmap_tests__from_file_blended_base_pixmap.snap.png \
|
||||
tests/snapshots/wmpixmap_tests__from_file_blended_cleared_window.snap \
|
||||
tests/snapshots/wmpixmap_tests__from_file_blended_cleared_window.snap.png \
|
||||
tests/snapshots/wmpixmap_tests__from_file_blended_with_grey.snap \
|
||||
tests/snapshots/wmpixmap_tests__from_file_blended_with_grey.snap.png \
|
||||
tests/snapshots/wmpixmap_tests__from_file_pixmap.snap \
|
||||
tests/snapshots/wmpixmap_tests__from_file_pixmap.snap.png \
|
||||
tests/snapshots/wmpixmap_tests__from_file_scaled_blended_base_pixmap.snap \
|
||||
tests/snapshots/wmpixmap_tests__from_file_scaled_blended_base_pixmap.snap.png \
|
||||
tests/snapshots/wmpixmap_tests__from_file_scaled_blended_cleared_window.snap \
|
||||
tests/snapshots/wmpixmap_tests__from_file_scaled_blended_cleared_window.snap.png \
|
||||
tests/snapshots/wmpixmap_tests__from_file_scaled_blended_non_integral_base_pixmap.snap \
|
||||
tests/snapshots/wmpixmap_tests__from_file_scaled_blended_non_integral_base_pixmap.snap.png \
|
||||
tests/snapshots/wmpixmap_tests__from_file_scaled_blended_non_integral_cleared_window.snap \
|
||||
tests/snapshots/wmpixmap_tests__from_file_scaled_blended_non_integral_cleared_window.snap.png \
|
||||
tests/snapshots/wmpixmap_tests__from_file_scaled_blended_non_integral_scaled.snap \
|
||||
tests/snapshots/wmpixmap_tests__from_file_scaled_blended_non_integral_scaled.snap.png \
|
||||
tests/snapshots/wmpixmap_tests__from_file_scaled_blended_with_grey.snap \
|
||||
tests/snapshots/wmpixmap_tests__from_file_scaled_blended_with_grey.snap.png \
|
||||
tests/snapshots/wmpixmap_tests__from_r_image_no_mask.snap \
|
||||
tests/snapshots/wmpixmap_tests__from_r_image_no_mask.snap.png \
|
||||
tests/snapshots/wmpixmap_tests__from_r_image_with_mask.snap \
|
||||
tests/snapshots/wmpixmap_tests__from_r_image_with_mask.snap.png \
|
||||
tests/snapshots/wmpixmap_tests__pixmap_from_xpm_data.snap \
|
||||
tests/snapshots/wmpixmap_tests__pixmap_from_xpm_data.snap.png
|
||||
|
||||
RUST_EXTRA = \
|
||||
Cargo.lock \
|
||||
Cargo.toml
|
||||
|
||||
Cargo.lock:
|
||||
cargo build
|
||||
|
||||
rustlib: $(RUST_SOURCES) $(RUST_EXTRA)
|
||||
cargo build
|
||||
|
||||
@@ -37,4 +97,4 @@ all: rustlib
|
||||
# process, and WINGs currently assumes that it is running in a single-threaded
|
||||
# environment.
|
||||
test: rustlib
|
||||
LD_LIBRARY_PATH=../.libs $(CARGO) nextest run
|
||||
LD_LIBRARY_PATH=../.libs:../../wrlib/.libs $(CARGO) nextest run
|
||||
|
||||
@@ -1,19 +1,13 @@
|
||||
fn main() {
|
||||
println!("cargo::rustc-link-search=../.libs");
|
||||
println!("cargo::rustc-link-search=../../wrlib/.libs");
|
||||
println!("cargo::rustc-link-arg=-lX11");
|
||||
|
||||
println!("cargo::rustc-link-arg-tests=-lWUtil");
|
||||
println!("cargo::rustc-link-arg-tests=-lWINGs");
|
||||
println!("cargo::rustc-link-arg-tests=-lXft");
|
||||
println!("cargo::rustc-link-arg-tests=-lpango-1.0");
|
||||
println!("cargo::rustc-link-arg-tests=-lpangoxft-1.0");
|
||||
println!("cargo::rustc-link-arg-tests=-lpangoft2-1.0");
|
||||
|
||||
println!("cargo::rustc-link-arg-examples=-lWUtil");
|
||||
println!("cargo::rustc-link-arg-examples=-lWINGs");
|
||||
println!("cargo::rustc-link-arg-examples=-lX11");
|
||||
println!("cargo::rustc-link-arg-examples=-lXft");
|
||||
println!("cargo::rustc-link-arg-examples=-lpango-1.0");
|
||||
println!("cargo::rustc-link-arg-examples=-lpangoxft-1.0");
|
||||
println!("cargo::rustc-link-arg-examples=-lpangoft2-1.0");
|
||||
println!("cargo::rustc-link-arg=-lWUtil");
|
||||
println!("cargo::rustc-link-arg=-lWINGs");
|
||||
println!("cargo::rustc-link-arg=-lwraster");
|
||||
println!("cargo::rustc-link-arg=-lX11");
|
||||
println!("cargo::rustc-link-arg=-lXft");
|
||||
println!("cargo::rustc-link-arg=-lpango-1.0");
|
||||
println!("cargo::rustc-link-arg=-lpangoxft-1.0");
|
||||
println!("cargo::rustc-link-arg=-lpangoft2-1.0");
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
pub mod logo_data;
|
||||
pub mod headless;
|
||||
|
||||
use headless::{xvfb::XvfbProcess, DisplayNumberRegistry};
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
use std::ffi::CStr;
|
||||
|
||||
/// Taken from logo.xpm originally in this repository.
|
||||
pub static GNUSTEP_XPM: &'static [&'static CStr] = &[
|
||||
c"45 45 8 1",
|
||||
c" c None",
|
||||
c". c #666666666666",
|
||||
c"X c #777777777777",
|
||||
c"o c #596559656185",
|
||||
c"O c #000000000000",
|
||||
c"+ c #3CF33CF33CF3",
|
||||
c"@ c #CF3CCF3CCF3C",
|
||||
c"# c #FFFFFFFFFFFF",
|
||||
c" ",
|
||||
c" .Xooooooooo. ",
|
||||
c" ..ooOOOOOOOOOOOOOo. ",
|
||||
c" .XoOOOOOOOOOOOOOOOOOO+ ",
|
||||
c" .oOOOOOOOOOOOOOOOOOOOOOO+ ",
|
||||
c" XOOOOOOOOOOOOOOOOOOOOOOOOOOo ",
|
||||
c" oOOOOOOOOOOOOOOOOOOOOOOOOOOOO+ ",
|
||||
c" oOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO+ooooooo",
|
||||
c" +OOOOOOOOOOOOOOOOOOOOOOOOoXXXXX.XOOOOOOO",
|
||||
c" XOOOOOOOOOOOOOOOOOOOOOOOOOX#######.OOOOOO",
|
||||
c" XOOOOOOOOOOOOOOOOOOOOOOOOOOX########oOOOOO",
|
||||
c" OOOOOOOOOOOOOOOOOOOOOOOOOOOX#########oOOOO",
|
||||
c" oOOOOOOOOOOOOOOOOOOOOOOOOOOOX#########@OOOO",
|
||||
c" OOOOOOOOOOOOOOOOOOOOOOOOOOOOX##########oOOO",
|
||||
c" oOOOOOOOOOOOOOOOOOOOOOOOOOOOOX##########@OOO",
|
||||
c" OOOOOOOOOOOOOOOOOOOOOOOOOOOOOX###########+OO",
|
||||
c" OOOOOOOOOOOOOOOOOOOOOOOOOOOOOX###########oOO",
|
||||
c"oOOOOOOOOOOOOOOOOOOOOOOOOOOOOOX###########@OO",
|
||||
c"+OOOOOOOOOOOOOOOOOOOOOOOOOOOOOX###########@OO",
|
||||
c"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOX############XO",
|
||||
c"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOX############XO",
|
||||
c"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOX############XO",
|
||||
c"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOX############XO",
|
||||
c"OOOOOOOOOOOOOOOoX.X.X.X.XX.XXX@############XO",
|
||||
c"OOOOOOOOOOOOOOOX###########################XO",
|
||||
c"OOOOOOOOOOOOOOOX###########################XO",
|
||||
c"OOOOOOOOOOOOOOOX###########################XO",
|
||||
c"+OOOOOOOOOOOOOOX###########################OO",
|
||||
c"oOOOOOOOOOOOOOOX###########################OO",
|
||||
c" OOOOOOOOOOOOOOX##########################XOO",
|
||||
c" OOOOOOOOOOOOOOX##########################oOO",
|
||||
c" oOOOOOOOOOOOOOX#########################@OOO",
|
||||
c" OOOOOOOOOOOOOX#########################+OOO",
|
||||
c" oOOOOOOOOOOOOX########################@OOOO",
|
||||
c" OOOOOOOOOOOOX########################oOOOO",
|
||||
c" OOOOOOOOOOOX#######################oOOOOO",
|
||||
c" OOOOOOOOOOX######################XOOOOOO",
|
||||
c"OOOOOOOXXXXXXXX@#####################@OOOOOOO",
|
||||
c"OOOOOOOo############################@OOOOOOOO",
|
||||
c"OOOOOOOOO@#########################oOOOOOOOOO",
|
||||
c"OOOOOOOOOOX######################@oOOOOOOOOOO",
|
||||
c"OOOOOOOOOOOOX###################XOOOOOOOOOOOO",
|
||||
c"OOOOOOOOOOOOOOX@#############@XOOOOOOOOOOOOOO",
|
||||
c"OOOOOOOOOOOOOOOOOXXX#####XXXOOOOOOOOOOOOOOOOO",
|
||||
c"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",
|
||||
];
|
||||
|
After Width: | Height: | Size: 79 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 23 KiB |
@@ -0,0 +1,7 @@
|
||||
---
|
||||
source: tests/system_pixmap_tests.rs
|
||||
assertion_line: 265
|
||||
expression: app.xvfb.png_screenshot()
|
||||
extension: png
|
||||
snapshot_kind: binary
|
||||
---
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
@@ -0,0 +1,7 @@
|
||||
---
|
||||
source: tests/system_pixmap_tests.rs
|
||||
assertion_line: 109
|
||||
expression: app.xvfb.png_screenshot()
|
||||
extension: png
|
||||
snapshot_kind: binary
|
||||
---
|
||||
|
After Width: | Height: | Size: 2.4 KiB |
@@ -0,0 +1,7 @@
|
||||
---
|
||||
source: tests/system_pixmap_tests.rs
|
||||
assertion_line: 161
|
||||
expression: app.xvfb.png_screenshot()
|
||||
extension: png
|
||||
snapshot_kind: binary
|
||||
---
|
||||
|
After Width: | Height: | Size: 2.4 KiB |
@@ -0,0 +1,7 @@
|
||||
---
|
||||
source: tests/system_pixmap_tests.rs
|
||||
assertion_line: 213
|
||||
expression: app.xvfb.png_screenshot()
|
||||
extension: png
|
||||
snapshot_kind: binary
|
||||
---
|
||||
|
After Width: | Height: | Size: 2.4 KiB |
@@ -0,0 +1,7 @@
|
||||
---
|
||||
source: tests/system_pixmap_tests.rs
|
||||
assertion_line: 317
|
||||
expression: app.xvfb.png_screenshot()
|
||||
extension: png
|
||||
snapshot_kind: binary
|
||||
---
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
@@ -0,0 +1,7 @@
|
||||
---
|
||||
source: tests/system_pixmap_tests.rs
|
||||
assertion_line: 291
|
||||
expression: app.xvfb.png_screenshot()
|
||||
extension: png
|
||||
snapshot_kind: binary
|
||||
---
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
@@ -0,0 +1,7 @@
|
||||
---
|
||||
source: tests/system_pixmap_tests.rs
|
||||
assertion_line: 135
|
||||
expression: app.xvfb.png_screenshot()
|
||||
extension: png
|
||||
snapshot_kind: binary
|
||||
---
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
@@ -0,0 +1,7 @@
|
||||
---
|
||||
source: tests/system_pixmap_tests.rs
|
||||
assertion_line: 187
|
||||
expression: app.xvfb.png_screenshot()
|
||||
extension: png
|
||||
snapshot_kind: binary
|
||||
---
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
@@ -0,0 +1,7 @@
|
||||
---
|
||||
source: tests/system_pixmap_tests.rs
|
||||
assertion_line: 239
|
||||
expression: app.xvfb.png_screenshot()
|
||||
extension: png
|
||||
snapshot_kind: binary
|
||||
---
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
@@ -0,0 +1,7 @@
|
||||
---
|
||||
source: tests/system_pixmap_tests.rs
|
||||
assertion_line: 57
|
||||
expression: app.xvfb.png_screenshot()
|
||||
extension: png
|
||||
snapshot_kind: binary
|
||||
---
|
||||
|
After Width: | Height: | Size: 2.4 KiB |
@@ -0,0 +1,7 @@
|
||||
---
|
||||
source: tests/system_pixmap_tests.rs
|
||||
assertion_line: 31
|
||||
expression: app.xvfb.png_screenshot()
|
||||
extension: png
|
||||
snapshot_kind: binary
|
||||
---
|
||||
|
After Width: | Height: | Size: 2.4 KiB |
@@ -0,0 +1,7 @@
|
||||
---
|
||||
source: tests/system_pixmap_tests.rs
|
||||
assertion_line: 83
|
||||
expression: app.xvfb.png_screenshot()
|
||||
extension: png
|
||||
snapshot_kind: binary
|
||||
---
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
@@ -0,0 +1,7 @@
|
||||
---
|
||||
source: tests/wmpixmap_tests.rs
|
||||
assertion_line: 56
|
||||
expression: app.xvfb.png_screenshot()
|
||||
extension: png
|
||||
snapshot_kind: binary
|
||||
---
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
@@ -0,0 +1,7 @@
|
||||
---
|
||||
source: tests/wmpixmap_tests.rs
|
||||
assertion_line: 41
|
||||
expression: app.xvfb.png_screenshot()
|
||||
extension: png
|
||||
snapshot_kind: binary
|
||||
---
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
@@ -0,0 +1,7 @@
|
||||
---
|
||||
source: tests/wmpixmap_tests.rs
|
||||
assertion_line: 142
|
||||
expression: app.xvfb.png_screenshot()
|
||||
extension: png
|
||||
snapshot_kind: binary
|
||||
---
|
||||
|
After Width: | Height: | Size: 35 KiB |
@@ -0,0 +1,7 @@
|
||||
---
|
||||
source: tests/wmpixmap_tests.rs
|
||||
assertion_line: 160
|
||||
expression: app.xvfb.png_screenshot()
|
||||
extension: png
|
||||
snapshot_kind: binary
|
||||
---
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
@@ -0,0 +1,7 @@
|
||||
---
|
||||
source: tests/wmpixmap_tests.rs
|
||||
assertion_line: 162
|
||||
expression: app.xvfb.png_screenshot()
|
||||
extension: png
|
||||
snapshot_kind: binary
|
||||
---
|
||||
|
After Width: | Height: | Size: 36 KiB |
@@ -0,0 +1,7 @@
|
||||
---
|
||||
source: tests/wmpixmap_tests.rs
|
||||
assertion_line: 58
|
||||
expression: app.xvfb.png_screenshot()
|
||||
extension: png
|
||||
snapshot_kind: binary
|
||||
---
|
||||
|
After Width: | Height: | Size: 37 KiB |
@@ -0,0 +1,7 @@
|
||||
---
|
||||
source: tests/wmpixmap_tests.rs
|
||||
assertion_line: 204
|
||||
expression: app.xvfb.png_screenshot()
|
||||
extension: png
|
||||
snapshot_kind: binary
|
||||
---
|
||||
|
After Width: | Height: | Size: 35 KiB |
@@ -0,0 +1,7 @@
|
||||
---
|
||||
source: tests/wmpixmap_tests.rs
|
||||
assertion_line: 222
|
||||
expression: app.xvfb.png_screenshot()
|
||||
extension: png
|
||||
snapshot_kind: binary
|
||||
---
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
@@ -0,0 +1,7 @@
|
||||
---
|
||||
source: tests/wmpixmap_tests.rs
|
||||
assertion_line: 268
|
||||
expression: app.xvfb.png_screenshot()
|
||||
extension: png
|
||||
snapshot_kind: binary
|
||||
---
|
||||
|
After Width: | Height: | Size: 37 KiB |
@@ -0,0 +1,7 @@
|
||||
---
|
||||
source: tests/wmpixmap_tests.rs
|
||||
assertion_line: 286
|
||||
expression: app.xvfb.png_screenshot()
|
||||
extension: png
|
||||
snapshot_kind: binary
|
||||
---
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
@@ -0,0 +1,7 @@
|
||||
---
|
||||
source: tests/wmpixmap_tests.rs
|
||||
assertion_line: 304
|
||||
expression: app.xvfb.png_screenshot()
|
||||
extension: png
|
||||
snapshot_kind: binary
|
||||
---
|
||||
|
After Width: | Height: | Size: 29 KiB |
@@ -0,0 +1,7 @@
|
||||
---
|
||||
source: tests/wmpixmap_tests.rs
|
||||
assertion_line: 220
|
||||
expression: app.xvfb.png_screenshot()
|
||||
extension: png
|
||||
snapshot_kind: binary
|
||||
---
|
||||
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,7 @@
|
||||
---
|
||||
source: tests/wmpixmap_tests.rs
|
||||
assertion_line: 130
|
||||
expression: app.xvfb.png_screenshot()
|
||||
extension: png
|
||||
snapshot_kind: binary
|
||||
---
|
||||
|
After Width: | Height: | Size: 37 KiB |
@@ -0,0 +1,7 @@
|
||||
---
|
||||
source: tests/wmpixmap_tests.rs
|
||||
assertion_line: 229
|
||||
expression: app.xvfb.png_screenshot()
|
||||
extension: png
|
||||
snapshot_kind: binary
|
||||
---
|
||||
|
After Width: | Height: | Size: 68 KiB |
@@ -0,0 +1,7 @@
|
||||
---
|
||||
source: tests/wmpixmap_tests.rs
|
||||
assertion_line: 451
|
||||
expression: app.xvfb.png_screenshot()
|
||||
extension: png
|
||||
snapshot_kind: binary
|
||||
---
|
||||
|
After Width: | Height: | Size: 3.0 KiB |
@@ -0,0 +1,355 @@
|
||||
use insta_image::assert_png_snapshot;
|
||||
use std::time::Instant;
|
||||
use wings_rs::{
|
||||
pixmap::ffi::*,
|
||||
WINGsP,
|
||||
};
|
||||
use wings_rs_tests::HeadlessApplication;
|
||||
|
||||
#[test]
|
||||
fn draw_return_arrow() {
|
||||
let mut app = HeadlessApplication::new();
|
||||
unsafe {
|
||||
let screen = &raw mut *app.screen.as_ptr();
|
||||
let display = (*screen).display;
|
||||
let win = x11::xlib::XCreateSimpleWindow(
|
||||
display,
|
||||
(*app.screen.as_ptr()).rootWin,
|
||||
0,
|
||||
0,
|
||||
512,
|
||||
512,
|
||||
1,
|
||||
1,
|
||||
x11::xlib::XWhitePixel(display, 0),
|
||||
);
|
||||
x11::xlib::XMapWindow(display, win);
|
||||
|
||||
let pixmap = WMGetSystemPixmap(screen, WINGsP::constants::WSystemIcon_ReturnArrow);
|
||||
WMDrawPixmap(pixmap, win, 64, 96);
|
||||
while app.pump_event_queue(Instant::now()) {}
|
||||
assert_png_snapshot!("return_arrow", app.xvfb.png_screenshot());
|
||||
|
||||
x11::xlib::XUnmapWindow(display, win);
|
||||
WMReleasePixmap(pixmap);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn draw_highlighted_return_arrow() {
|
||||
let mut app = HeadlessApplication::new();
|
||||
unsafe {
|
||||
let screen = &raw mut *app.screen.as_ptr();
|
||||
let display = (*screen).display;
|
||||
let win = x11::xlib::XCreateSimpleWindow(
|
||||
display,
|
||||
(*app.screen.as_ptr()).rootWin,
|
||||
0,
|
||||
0,
|
||||
512,
|
||||
512,
|
||||
1,
|
||||
1,
|
||||
x11::xlib::XWhitePixel(display, 0),
|
||||
);
|
||||
x11::xlib::XMapWindow(display, win);
|
||||
|
||||
let pixmap = WMGetSystemPixmap(screen, WINGsP::constants::WSystemIcon_HighlightedReturnArrow);
|
||||
WMDrawPixmap(pixmap, win, 64, 96);
|
||||
while app.pump_event_queue(Instant::now()) {}
|
||||
assert_png_snapshot!("highlighted_return_arrow", app.xvfb.png_screenshot());
|
||||
|
||||
x11::xlib::XUnmapWindow(display, win);
|
||||
WMReleasePixmap(pixmap);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn draw_scroller_dimple() {
|
||||
let mut app = HeadlessApplication::new();
|
||||
unsafe {
|
||||
let screen = &raw mut *app.screen.as_ptr();
|
||||
let display = (*screen).display;
|
||||
let win = x11::xlib::XCreateSimpleWindow(
|
||||
display,
|
||||
(*app.screen.as_ptr()).rootWin,
|
||||
0,
|
||||
0,
|
||||
512,
|
||||
512,
|
||||
1,
|
||||
1,
|
||||
x11::xlib::XWhitePixel(display, 0),
|
||||
);
|
||||
x11::xlib::XMapWindow(display, win);
|
||||
|
||||
let pixmap = WMGetSystemPixmap(screen, WINGsP::constants::WSystemIcon_ScrollerDimple);
|
||||
WMDrawPixmap(pixmap, win, 64, 96);
|
||||
while app.pump_event_queue(Instant::now()) {}
|
||||
assert_png_snapshot!("scroller_dimple", app.xvfb.png_screenshot());
|
||||
|
||||
x11::xlib::XUnmapWindow(display, win);
|
||||
WMReleasePixmap(pixmap);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn draw_arrow_left() {
|
||||
let mut app = HeadlessApplication::new();
|
||||
unsafe {
|
||||
let screen = &raw mut *app.screen.as_ptr();
|
||||
let display = (*screen).display;
|
||||
let win = x11::xlib::XCreateSimpleWindow(
|
||||
display,
|
||||
(*app.screen.as_ptr()).rootWin,
|
||||
0,
|
||||
0,
|
||||
512,
|
||||
512,
|
||||
1,
|
||||
1,
|
||||
x11::xlib::XWhitePixel(display, 0),
|
||||
);
|
||||
x11::xlib::XMapWindow(display, win);
|
||||
|
||||
let pixmap = WMGetSystemPixmap(screen, WINGsP::constants::WSystemIcon_ArrowLeft);
|
||||
WMDrawPixmap(pixmap, win, 64, 96);
|
||||
while app.pump_event_queue(Instant::now()) {}
|
||||
assert_png_snapshot!("arrow_left", app.xvfb.png_screenshot());
|
||||
|
||||
x11::xlib::XUnmapWindow(display, win);
|
||||
WMReleasePixmap(pixmap);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn draw_highlighted_arrow_left() {
|
||||
let mut app = HeadlessApplication::new();
|
||||
unsafe {
|
||||
let screen = &raw mut *app.screen.as_ptr();
|
||||
let display = (*screen).display;
|
||||
let win = x11::xlib::XCreateSimpleWindow(
|
||||
display,
|
||||
(*app.screen.as_ptr()).rootWin,
|
||||
0,
|
||||
0,
|
||||
512,
|
||||
512,
|
||||
1,
|
||||
1,
|
||||
x11::xlib::XWhitePixel(display, 0),
|
||||
);
|
||||
x11::xlib::XMapWindow(display, win);
|
||||
|
||||
let pixmap = WMGetSystemPixmap(screen, WINGsP::constants::WSystemIcon_HighlightedArrowLeft);
|
||||
WMDrawPixmap(pixmap, win, 64, 96);
|
||||
while app.pump_event_queue(Instant::now()) {}
|
||||
assert_png_snapshot!("highlighted_arrow_left", app.xvfb.png_screenshot());
|
||||
|
||||
x11::xlib::XUnmapWindow(display, win);
|
||||
WMReleasePixmap(pixmap);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn draw_arrow_right() {
|
||||
let mut app = HeadlessApplication::new();
|
||||
unsafe {
|
||||
let screen = &raw mut *app.screen.as_ptr();
|
||||
let display = (*screen).display;
|
||||
let win = x11::xlib::XCreateSimpleWindow(
|
||||
display,
|
||||
(*app.screen.as_ptr()).rootWin,
|
||||
0,
|
||||
0,
|
||||
512,
|
||||
512,
|
||||
1,
|
||||
1,
|
||||
x11::xlib::XWhitePixel(display, 0),
|
||||
);
|
||||
x11::xlib::XMapWindow(display, win);
|
||||
|
||||
let pixmap = WMGetSystemPixmap(screen, WINGsP::constants::WSystemIcon_ArrowRight);
|
||||
WMDrawPixmap(pixmap, win, 64, 96);
|
||||
while app.pump_event_queue(Instant::now()) {}
|
||||
assert_png_snapshot!("arrow_right", app.xvfb.png_screenshot());
|
||||
|
||||
x11::xlib::XUnmapWindow(display, win);
|
||||
WMReleasePixmap(pixmap);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn draw_highlighted_arrow_right() {
|
||||
let mut app = HeadlessApplication::new();
|
||||
unsafe {
|
||||
let screen = &raw mut *app.screen.as_ptr();
|
||||
let display = (*screen).display;
|
||||
let win = x11::xlib::XCreateSimpleWindow(
|
||||
display,
|
||||
(*app.screen.as_ptr()).rootWin,
|
||||
0,
|
||||
0,
|
||||
512,
|
||||
512,
|
||||
1,
|
||||
1,
|
||||
x11::xlib::XWhitePixel(display, 0),
|
||||
);
|
||||
x11::xlib::XMapWindow(display, win);
|
||||
|
||||
let pixmap = WMGetSystemPixmap(screen, WINGsP::constants::WSystemIcon_HighlightedArrowRight);
|
||||
WMDrawPixmap(pixmap, win, 64, 96);
|
||||
while app.pump_event_queue(Instant::now()) {}
|
||||
assert_png_snapshot!("highlighted_arrow_right", app.xvfb.png_screenshot());
|
||||
|
||||
x11::xlib::XUnmapWindow(display, win);
|
||||
WMReleasePixmap(pixmap);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn draw_arrow_up() {
|
||||
let mut app = HeadlessApplication::new();
|
||||
unsafe {
|
||||
let screen = &raw mut *app.screen.as_ptr();
|
||||
let display = (*screen).display;
|
||||
let win = x11::xlib::XCreateSimpleWindow(
|
||||
display,
|
||||
(*app.screen.as_ptr()).rootWin,
|
||||
0,
|
||||
0,
|
||||
512,
|
||||
512,
|
||||
1,
|
||||
1,
|
||||
x11::xlib::XWhitePixel(display, 0),
|
||||
);
|
||||
x11::xlib::XMapWindow(display, win);
|
||||
|
||||
let pixmap = WMGetSystemPixmap(screen, WINGsP::constants::WSystemIcon_ArrowUp);
|
||||
WMDrawPixmap(pixmap, win, 64, 96);
|
||||
while app.pump_event_queue(Instant::now()) {}
|
||||
assert_png_snapshot!("arrow_up", app.xvfb.png_screenshot());
|
||||
|
||||
x11::xlib::XUnmapWindow(display, win);
|
||||
WMReleasePixmap(pixmap);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn draw_highlighted_arrow_up() {
|
||||
let mut app = HeadlessApplication::new();
|
||||
unsafe {
|
||||
let screen = &raw mut *app.screen.as_ptr();
|
||||
let display = (*screen).display;
|
||||
let win = x11::xlib::XCreateSimpleWindow(
|
||||
display,
|
||||
(*app.screen.as_ptr()).rootWin,
|
||||
0,
|
||||
0,
|
||||
512,
|
||||
512,
|
||||
1,
|
||||
1,
|
||||
x11::xlib::XWhitePixel(display, 0),
|
||||
);
|
||||
x11::xlib::XMapWindow(display, win);
|
||||
|
||||
let pixmap = WMGetSystemPixmap(screen, WINGsP::constants::WSystemIcon_HighlightedArrowUp);
|
||||
WMDrawPixmap(pixmap, win, 64, 96);
|
||||
while app.pump_event_queue(Instant::now()) {}
|
||||
assert_png_snapshot!("highlighted_arrow_up", app.xvfb.png_screenshot());
|
||||
|
||||
x11::xlib::XUnmapWindow(display, win);
|
||||
WMReleasePixmap(pixmap);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn draw_arrow_down() {
|
||||
let mut app = HeadlessApplication::new();
|
||||
unsafe {
|
||||
let screen = &raw mut *app.screen.as_ptr();
|
||||
let display = (*screen).display;
|
||||
let win = x11::xlib::XCreateSimpleWindow(
|
||||
display,
|
||||
(*app.screen.as_ptr()).rootWin,
|
||||
0,
|
||||
0,
|
||||
512,
|
||||
512,
|
||||
1,
|
||||
1,
|
||||
x11::xlib::XWhitePixel(display, 0),
|
||||
);
|
||||
x11::xlib::XMapWindow(display, win);
|
||||
|
||||
let pixmap = WMGetSystemPixmap(screen, WINGsP::constants::WSystemIcon_ArrowDown);
|
||||
WMDrawPixmap(pixmap, win, 64, 96);
|
||||
while app.pump_event_queue(Instant::now()) {}
|
||||
assert_png_snapshot!("arrow_down", app.xvfb.png_screenshot());
|
||||
|
||||
x11::xlib::XUnmapWindow(display, win);
|
||||
WMReleasePixmap(pixmap);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn draw_highlighted_arrow_down() {
|
||||
let mut app = HeadlessApplication::new();
|
||||
unsafe {
|
||||
let screen = &raw mut *app.screen.as_ptr();
|
||||
let display = (*screen).display;
|
||||
let win = x11::xlib::XCreateSimpleWindow(
|
||||
display,
|
||||
(*app.screen.as_ptr()).rootWin,
|
||||
0,
|
||||
0,
|
||||
512,
|
||||
512,
|
||||
1,
|
||||
1,
|
||||
x11::xlib::XWhitePixel(display, 0),
|
||||
);
|
||||
x11::xlib::XMapWindow(display, win);
|
||||
|
||||
let pixmap = WMGetSystemPixmap(screen, WINGsP::constants::WSystemIcon_HighlightedArrowDown);
|
||||
WMDrawPixmap(pixmap, win, 64, 96);
|
||||
while app.pump_event_queue(Instant::now()) {}
|
||||
assert_png_snapshot!("highlighted_arrow_down", app.xvfb.png_screenshot());
|
||||
|
||||
x11::xlib::XUnmapWindow(display, win);
|
||||
WMReleasePixmap(pixmap);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn draw_check_mark() {
|
||||
let mut app = HeadlessApplication::new();
|
||||
unsafe {
|
||||
let screen = &raw mut *app.screen.as_ptr();
|
||||
let display = (*screen).display;
|
||||
let win = x11::xlib::XCreateSimpleWindow(
|
||||
display,
|
||||
(*app.screen.as_ptr()).rootWin,
|
||||
0,
|
||||
0,
|
||||
512,
|
||||
512,
|
||||
1,
|
||||
1,
|
||||
x11::xlib::XWhitePixel(display, 0),
|
||||
);
|
||||
x11::xlib::XMapWindow(display, win);
|
||||
|
||||
let pixmap = WMGetSystemPixmap(screen, WINGsP::constants::WSystemIcon_CheckMark);
|
||||
WMDrawPixmap(pixmap, win, 64, 96);
|
||||
while app.pump_event_queue(Instant::now()) {}
|
||||
assert_png_snapshot!("check_mark", app.xvfb.png_screenshot());
|
||||
|
||||
x11::xlib::XUnmapWindow(display, win);
|
||||
WMReleasePixmap(pixmap);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,459 @@
|
||||
use insta_image::assert_png_snapshot;
|
||||
use std::{
|
||||
ffi::c_char,
|
||||
ptr::{self, NonNull},
|
||||
time::Instant,
|
||||
};
|
||||
use wings_rs::pixmap::ffi::*;
|
||||
use wings_rs_tests::HeadlessApplication;
|
||||
use wrlib_rs::ffi::{RLoadImage, RReleaseImage};
|
||||
|
||||
#[test]
|
||||
fn draw_blank_pixmap() {
|
||||
let mut app = HeadlessApplication::new();
|
||||
unsafe {
|
||||
let display = (*app.screen.as_ptr()).display;
|
||||
let win = x11::xlib::XCreateSimpleWindow(
|
||||
display,
|
||||
(*app.screen.as_ptr()).rootWin,
|
||||
0,
|
||||
0,
|
||||
512,
|
||||
512,
|
||||
1,
|
||||
1,
|
||||
x11::xlib::XWhitePixel(display, 0),
|
||||
);
|
||||
x11::xlib::XMapWindow(display, win);
|
||||
|
||||
let pixmap = NonNull::new(WMCreatePixmap(app.screen.as_ptr(), 128, 196, 24, 1)).unwrap();
|
||||
WMDrawPixmap(pixmap.as_ptr(), win, 64, 96);
|
||||
while app.pump_event_queue(Instant::now()) {}
|
||||
assert_png_snapshot!("empty_window", app.xvfb.png_screenshot());
|
||||
|
||||
let gc = x11::xlib::XCreateGC(display, (*pixmap.as_ptr()).pixmap(), 0, ptr::null_mut());
|
||||
x11::xlib::XSetForeground(display, gc, 0);
|
||||
x11::xlib::XFillRectangle(display, (*pixmap.as_ptr()).pixmap(), gc, 0, 0, 128, 196);
|
||||
WMDrawPixmap(pixmap.as_ptr(), win, 64, 96);
|
||||
while app.pump_event_queue(Instant::now()) {}
|
||||
assert_png_snapshot!("empty_pixmap_on_window", app.xvfb.png_screenshot());
|
||||
|
||||
x11::xlib::XFreeGC(display, gc);
|
||||
WMReleasePixmap(pixmap.as_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
// WMCreatePixmapFromXPixmaps is not tested because it simply fills in struct
|
||||
// fields. Coverage from other tests in this file should be adequate.
|
||||
|
||||
#[test]
|
||||
fn draw_pixmap_from_file() {
|
||||
let mut app = HeadlessApplication::new();
|
||||
unsafe {
|
||||
let display = (*app.screen.as_ptr()).display;
|
||||
let win = x11::xlib::XCreateSimpleWindow(
|
||||
display,
|
||||
(*app.screen.as_ptr()).rootWin,
|
||||
0,
|
||||
0,
|
||||
512,
|
||||
512,
|
||||
1,
|
||||
1,
|
||||
x11::xlib::XWhitePixel(display, 0),
|
||||
);
|
||||
x11::xlib::XMapWindow(display, win);
|
||||
|
||||
let pixmap = NonNull::new(WMCreatePixmapFromFile(
|
||||
app.screen.as_ptr(),
|
||||
c"tests/image_128x120.png".as_ptr(),
|
||||
))
|
||||
.unwrap();
|
||||
WMDrawPixmap(pixmap.as_ptr(), win, 64, 96);
|
||||
|
||||
while app.pump_event_queue(Instant::now()) {}
|
||||
assert_png_snapshot!("from_file_pixmap", app.xvfb.png_screenshot());
|
||||
WMReleasePixmap(pixmap.as_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn draw_pixmap_from_r_image_no_mask() {
|
||||
let mut app = HeadlessApplication::new();
|
||||
unsafe {
|
||||
let display = (*app.screen.as_ptr()).display;
|
||||
let win = x11::xlib::XCreateSimpleWindow(
|
||||
display,
|
||||
(*app.screen.as_ptr()).rootWin,
|
||||
0,
|
||||
0,
|
||||
512,
|
||||
512,
|
||||
1,
|
||||
1,
|
||||
x11::xlib::XWhitePixel(display, 0),
|
||||
);
|
||||
x11::xlib::XMapWindow(display, win);
|
||||
|
||||
let rimage = RLoadImage(
|
||||
(*app.screen.as_ptr()).rcontext,
|
||||
c"tests/image_128x120.png".as_ptr(),
|
||||
0,
|
||||
);
|
||||
let pixmap =
|
||||
NonNull::new(WMCreatePixmapFromRImage(app.screen.as_ptr(), rimage, 255)).unwrap();
|
||||
WMDrawPixmap(pixmap.as_ptr(), win, 70, 74);
|
||||
|
||||
while app.pump_event_queue(Instant::now()) {}
|
||||
assert_png_snapshot!("from_r_image_no_mask", app.xvfb.png_screenshot());
|
||||
WMReleasePixmap(pixmap.as_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn draw_pixmap_from_r_image_with_mask() {
|
||||
let mut app = HeadlessApplication::new();
|
||||
unsafe {
|
||||
let display = (*app.screen.as_ptr()).display;
|
||||
let win = x11::xlib::XCreateSimpleWindow(
|
||||
display,
|
||||
(*app.screen.as_ptr()).rootWin,
|
||||
0,
|
||||
0,
|
||||
512,
|
||||
512,
|
||||
1,
|
||||
1,
|
||||
x11::xlib::XBlackPixel(display, 0),
|
||||
);
|
||||
x11::xlib::XMapWindow(display, win);
|
||||
|
||||
let rimage = NonNull::new(RLoadImage(
|
||||
(*app.screen.as_ptr()).rcontext,
|
||||
c"tests/image_128x120_varying_alpha.png".as_ptr(),
|
||||
255,
|
||||
))
|
||||
.unwrap();
|
||||
|
||||
// The threshold given to WMCreatePixmapFromRImage is compared against
|
||||
// the image's alpha channel. Pixels whose transparency are below the
|
||||
// threshold are masked out. This should draw a quartet of images with
|
||||
// varying masks.
|
||||
|
||||
// Totally masked.
|
||||
let pixmap_255 = NonNull::new(WMCreatePixmapFromRImage(
|
||||
app.screen.as_ptr(),
|
||||
rimage.as_ptr(),
|
||||
255,
|
||||
))
|
||||
.unwrap();
|
||||
WMDrawPixmap(pixmap_255.as_ptr(), win, 70, 74);
|
||||
// Three bubbles masked.
|
||||
let pixmap_200 = NonNull::new(WMCreatePixmapFromRImage(
|
||||
app.screen.as_ptr(),
|
||||
rimage.as_ptr(),
|
||||
200,
|
||||
))
|
||||
.unwrap();
|
||||
WMDrawPixmap(pixmap_200.as_ptr(), win, 200, 74);
|
||||
// Two bubbles masked.
|
||||
let pixmap_128 = NonNull::new(WMCreatePixmapFromRImage(
|
||||
app.screen.as_ptr(),
|
||||
rimage.as_ptr(),
|
||||
128,
|
||||
))
|
||||
.unwrap();
|
||||
WMDrawPixmap(pixmap_128.as_ptr(), win, 70, 200);
|
||||
// Nothing masked.
|
||||
let pixmap_0 = NonNull::new(WMCreatePixmapFromRImage(
|
||||
app.screen.as_ptr(),
|
||||
rimage.as_ptr(),
|
||||
0,
|
||||
))
|
||||
.unwrap();
|
||||
WMDrawPixmap(pixmap_0.as_ptr(), win, 200, 200);
|
||||
|
||||
while app.pump_event_queue(Instant::now()) {}
|
||||
assert_png_snapshot!("from_r_image_with_mask", app.xvfb.png_screenshot());
|
||||
WMReleasePixmap(pixmap_255.as_ptr());
|
||||
WMReleasePixmap(pixmap_200.as_ptr());
|
||||
WMReleasePixmap(pixmap_128.as_ptr());
|
||||
WMReleasePixmap(pixmap_0.as_ptr());
|
||||
RReleaseImage(rimage.as_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn draw_blended_pixmap_from_r_image() {
|
||||
let mut app = HeadlessApplication::new();
|
||||
unsafe {
|
||||
let display = (*app.screen.as_ptr()).display;
|
||||
let win = x11::xlib::XCreateSimpleWindow(
|
||||
display,
|
||||
(*app.screen.as_ptr()).rootWin,
|
||||
0,
|
||||
0,
|
||||
512,
|
||||
512,
|
||||
1,
|
||||
1,
|
||||
x11::xlib::XWhitePixel(display, 0),
|
||||
);
|
||||
x11::xlib::XMapWindow(display, win);
|
||||
|
||||
let rimage = RLoadImage(
|
||||
(*app.screen.as_ptr()).rcontext,
|
||||
c"tests/image_128x120.png".as_ptr(),
|
||||
0,
|
||||
);
|
||||
let pixmap =
|
||||
NonNull::new(WMCreateGreyedPixmapFromRImage(app.screen.as_ptr(), rimage)).unwrap();
|
||||
WMDrawPixmap(pixmap.as_ptr(), win, 70, 74);
|
||||
|
||||
while app.pump_event_queue(Instant::now()) {}
|
||||
assert_png_snapshot!("from_r_image_no_mask", app.xvfb.png_screenshot());
|
||||
WMReleasePixmap(pixmap.as_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn draw_blended_pixmap_from_file() {
|
||||
let mut app = HeadlessApplication::new();
|
||||
unsafe {
|
||||
let display = (*app.screen.as_ptr()).display;
|
||||
let win = x11::xlib::XCreateSimpleWindow(
|
||||
display,
|
||||
(*app.screen.as_ptr()).rootWin,
|
||||
0,
|
||||
0,
|
||||
512,
|
||||
512,
|
||||
1,
|
||||
1,
|
||||
x11::xlib::XWhitePixel(display, 0),
|
||||
);
|
||||
x11::xlib::XMapWindow(display, win);
|
||||
|
||||
let pixmap = NonNull::new(WMCreatePixmapFromFile(
|
||||
app.screen.as_ptr(),
|
||||
c"tests/image_with_transparent_dot_128x120.png".as_ptr(),
|
||||
))
|
||||
.unwrap();
|
||||
WMDrawPixmap(pixmap.as_ptr(), win, 64, 96);
|
||||
while app.pump_event_queue(Instant::now()) {}
|
||||
assert_png_snapshot!("from_file_blended_base_pixmap", app.xvfb.png_screenshot());
|
||||
|
||||
x11::xlib::XUnmapWindow(display, win);
|
||||
WMReleasePixmap(pixmap.as_ptr());
|
||||
|
||||
let win = x11::xlib::XCreateSimpleWindow(
|
||||
display,
|
||||
(*app.screen.as_ptr()).rootWin,
|
||||
0,
|
||||
0,
|
||||
512,
|
||||
512,
|
||||
1,
|
||||
1,
|
||||
x11::xlib::XWhitePixel(display, 0),
|
||||
);
|
||||
x11::xlib::XMapWindow(display, win);
|
||||
while app.pump_event_queue(Instant::now()) {}
|
||||
assert_png_snapshot!(
|
||||
"from_file_blended_cleared_window",
|
||||
app.xvfb.png_screenshot()
|
||||
);
|
||||
|
||||
let pixmap = NonNull::new(WMCreateGreyedPixmapFromFile(
|
||||
app.screen.as_ptr(),
|
||||
c"tests/image_with_transparent_dot_128x120.png".as_ptr(),
|
||||
))
|
||||
.unwrap();
|
||||
WMDrawPixmap(pixmap.as_ptr(), win, 64, 96);
|
||||
|
||||
while app.pump_event_queue(Instant::now()) {}
|
||||
assert_png_snapshot!("from_file_blended_with_grey", app.xvfb.png_screenshot());
|
||||
WMReleasePixmap(pixmap.as_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn draw_scaled_blended_pixmap_from_file() {
|
||||
let mut app = HeadlessApplication::new();
|
||||
unsafe {
|
||||
let display = (*app.screen.as_ptr()).display;
|
||||
let win = x11::xlib::XCreateSimpleWindow(
|
||||
display,
|
||||
(*app.screen.as_ptr()).rootWin,
|
||||
0,
|
||||
0,
|
||||
512,
|
||||
512,
|
||||
1,
|
||||
1,
|
||||
x11::xlib::XWhitePixel(display, 0),
|
||||
);
|
||||
x11::xlib::XMapWindow(display, win);
|
||||
|
||||
let pixmap = NonNull::new(WMCreatePixmapFromFile(
|
||||
app.screen.as_ptr(),
|
||||
c"tests/image_with_transparent_dot_128x120.png".as_ptr(),
|
||||
))
|
||||
.unwrap();
|
||||
WMDrawPixmap(pixmap.as_ptr(), win, 64, 96);
|
||||
while app.pump_event_queue(Instant::now()) {}
|
||||
assert_png_snapshot!(
|
||||
"from_file_scaled_blended_base_pixmap",
|
||||
app.xvfb.png_screenshot()
|
||||
);
|
||||
|
||||
x11::xlib::XUnmapWindow(display, win);
|
||||
WMReleasePixmap(pixmap.as_ptr());
|
||||
|
||||
let win = x11::xlib::XCreateSimpleWindow(
|
||||
display,
|
||||
(*app.screen.as_ptr()).rootWin,
|
||||
0,
|
||||
0,
|
||||
512,
|
||||
512,
|
||||
1,
|
||||
1,
|
||||
x11::xlib::XWhitePixel(display, 0),
|
||||
);
|
||||
x11::xlib::XMapWindow(display, win);
|
||||
while app.pump_event_queue(Instant::now()) {}
|
||||
assert_png_snapshot!(
|
||||
"from_file_scaled_blended_cleared_window",
|
||||
app.xvfb.png_screenshot()
|
||||
);
|
||||
|
||||
let pixmap = NonNull::new(WMCreateScaledGreyedPixmapFromFile(
|
||||
app.screen.as_ptr(),
|
||||
c"tests/image_with_transparent_dot_128x120.png".as_ptr(),
|
||||
60,
|
||||
64,
|
||||
))
|
||||
.unwrap();
|
||||
WMDrawPixmap(pixmap.as_ptr(), win, 64, 96);
|
||||
|
||||
while app.pump_event_queue(Instant::now()) {}
|
||||
assert_png_snapshot!(
|
||||
"from_file_scaled_blended_with_grey",
|
||||
app.xvfb.png_screenshot()
|
||||
);
|
||||
WMReleasePixmap(pixmap.as_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn draw_scaled_blended_pixmap_from_file_non_integral_scaling() {
|
||||
let mut app = HeadlessApplication::new();
|
||||
unsafe {
|
||||
let display = (*app.screen.as_ptr()).display;
|
||||
let win = x11::xlib::XCreateSimpleWindow(
|
||||
display,
|
||||
(*app.screen.as_ptr()).rootWin,
|
||||
0,
|
||||
0,
|
||||
512,
|
||||
512,
|
||||
1,
|
||||
1,
|
||||
x11::xlib::XWhitePixel(display, 0),
|
||||
);
|
||||
x11::xlib::XMapWindow(display, win);
|
||||
|
||||
let pixmap = NonNull::new(WMCreatePixmapFromFile(
|
||||
app.screen.as_ptr(),
|
||||
c"tests/image_128x120.png".as_ptr(),
|
||||
))
|
||||
.unwrap();
|
||||
WMDrawPixmap(pixmap.as_ptr(), win, 64, 96);
|
||||
while app.pump_event_queue(Instant::now()) {}
|
||||
assert_png_snapshot!(
|
||||
"from_file_scaled_blended_non_integral_base_pixmap",
|
||||
app.xvfb.png_screenshot()
|
||||
);
|
||||
|
||||
x11::xlib::XUnmapWindow(display, win);
|
||||
WMReleasePixmap(pixmap.as_ptr());
|
||||
|
||||
let win = x11::xlib::XCreateSimpleWindow(
|
||||
display,
|
||||
(*app.screen.as_ptr()).rootWin,
|
||||
0,
|
||||
0,
|
||||
512,
|
||||
512,
|
||||
1,
|
||||
1,
|
||||
x11::xlib::XWhitePixel(display, 0),
|
||||
);
|
||||
x11::xlib::XMapWindow(display, win);
|
||||
while app.pump_event_queue(Instant::now()) {}
|
||||
assert_png_snapshot!(
|
||||
"from_file_scaled_blended_non_integral_cleared_window",
|
||||
app.xvfb.png_screenshot()
|
||||
);
|
||||
|
||||
let pixmap = NonNull::new(WMCreateScaledGreyedPixmapFromFile(
|
||||
app.screen.as_ptr(),
|
||||
// No alpha channel on this image, so no color blending happens.
|
||||
c"tests/image_128x120.png".as_ptr(),
|
||||
// Shrink by only a little bit, such that simple integer division
|
||||
// might be thrown off. This test ensures that rescaling will
|
||||
// actually happen.
|
||||
110,
|
||||
114,
|
||||
))
|
||||
.unwrap();
|
||||
WMDrawPixmap(pixmap.as_ptr(), win, 64, 96);
|
||||
|
||||
while app.pump_event_queue(Instant::now()) {}
|
||||
assert_png_snapshot!(
|
||||
"from_file_scaled_blended_non_integral_scaled",
|
||||
app.xvfb.png_screenshot()
|
||||
);
|
||||
WMReleasePixmap(pixmap.as_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn draw_pixmap_from_xpm_data() {
|
||||
let mut app = HeadlessApplication::new();
|
||||
let mut data: Vec<*mut c_char> = wings_rs_tests::logo_data::GNUSTEP_XPM
|
||||
.iter()
|
||||
.map(|line| line.as_ptr() as *mut c_char)
|
||||
.collect();
|
||||
unsafe {
|
||||
let display = (*app.screen.as_ptr()).display;
|
||||
let win = x11::xlib::XCreateSimpleWindow(
|
||||
display,
|
||||
(*app.screen.as_ptr()).rootWin,
|
||||
0,
|
||||
0,
|
||||
512,
|
||||
512,
|
||||
1,
|
||||
1,
|
||||
x11::xlib::XWhitePixel(display, 0),
|
||||
);
|
||||
x11::xlib::XMapWindow(display, win);
|
||||
|
||||
let pixmap = NonNull::new(WMCreatePixmapFromXPMData(
|
||||
app.screen.as_ptr(),
|
||||
data.as_mut_ptr(),
|
||||
)).unwrap();
|
||||
|
||||
WMDrawPixmap(pixmap.as_ptr(), win, 64, 96);
|
||||
while app.pump_event_queue(Instant::now()) {}
|
||||
assert_png_snapshot!(
|
||||
"pixmap_from_xpm_data",
|
||||
app.xvfb.png_screenshot()
|
||||
);
|
||||
|
||||
x11::xlib::XUnmapWindow(display, win);
|
||||
WMReleasePixmap(pixmap.as_ptr());
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ crate-type = ["cdylib", "rlib"]
|
||||
[dependencies]
|
||||
libc = "0.2.177"
|
||||
pango-sys = "0.21.2"
|
||||
wrlib-rs = { path = "../../wrlib-rs" }
|
||||
wutil-rs = { path = "../../wutil-rs" }
|
||||
x11 = "2.21.0"
|
||||
yeslogic-fontconfig-sys = "6.0"
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
AUTOMAKE_OPTIONS =
|
||||
|
||||
RUST_SOURCES = \
|
||||
src/WINGsP.rs \
|
||||
RUST_SRC = \
|
||||
src/WINGsP/constants.rs \
|
||||
src/WINGsP/mod.rs \
|
||||
src/button.rs \
|
||||
src/color.rs \
|
||||
src/configuration.rs \
|
||||
src/ffi.rs \
|
||||
src/font.rs \
|
||||
src/font_panel.rs \
|
||||
src/lib.rs \
|
||||
src/list.rs \
|
||||
src/pango_extras.rs \
|
||||
src/pixmap.rs \
|
||||
src/screen.rs \
|
||||
src/widget.rs
|
||||
|
||||
@@ -16,11 +20,14 @@ RUST_EXTRA = \
|
||||
Cargo.lock \
|
||||
Cargo.toml
|
||||
|
||||
src/WINGsP.rs: ../WINGs/WINGsP.h ../../wrlib/wraster.h ../WINGs/WINGs.h ../WINGs/WUtil.h Makefile patch_WINGsP.sh
|
||||
$(BINDGEN) ../WINGs/WINGsP.h \
|
||||
src/WINGsP/mod.rs: ../WINGs/WINGsP.h ../../wrlib/wraster.h ../WINGs/WINGs.h ../WINGs/WUtil.h Makefile patch_WINGsP.sed
|
||||
mkdir -p src/WINGsP \
|
||||
&& $(BINDGEN) ../WINGs/WINGsP.h \
|
||||
--no-recursive-allowlist \
|
||||
--allowlist-type "^W_.+|^WM(View|Array|DragOperationType|Point|Data|OpenPanel|SavePanel|HashTable|DraggingInfo|SelectionProcs|Rect|EventProc|Widget|Size|Color|Pixmap|FilePanel)|R(Context|ContextAttributes|Image|RenderingMode|ScalingFilter|StdColormapMode|ImageFormat|Color)|_WINGsConfiguration" \
|
||||
--allowlist-type "^W_.+|^WM(View|DragOperationType|Point|Data|OpenPanel|SavePanel|HashTable|DraggingInfo|SelectionProcs|Rect|EventProc|Widget|Size|FilePanel|List|ListItem)" \
|
||||
--allowlist-type "^WM(FontPanel|Screen|Button)" \
|
||||
--allowlist-type "^W_(Screen|View|DragSourceProcs|ViewDelegate|DragDestinationProcs|Data|HashTable|Button|FilePanel|DraggingInfo|IMContext|Window|FocusInfo|SelectionHandlers|FontPanel|DragSourceInfo|DragDestinationInfo|ColorPanel|Balloon|DndState)" \
|
||||
--allowlist-type "^WM(View|DragOperationType|Point|Data|OpenPanel|SavePanel|HashTable|DraggingInfo|SelectionProcs|Rect|EventProc|Widget|Size|FilePanel|FontPanel|Screen|Button)|_WINGsConfiguration" \
|
||||
--allowlist-function "^WMCreateScreen|^WM(Get|Show)FontPanel|^WMCreateCommandButton|^WM(Initialize|Release)Application|^WMScreenMainLoop|^WMHandleEvent" \
|
||||
--allowlist-function "^WMWidgetScreen|^WM(Initialize|Release)Application|^WM(ScreenMainLoop|HandleEvent)|^WM(((Get|Set)TextFieldFont)|GetTextFieldText|SetTextFieldText|SelectTextFieldRange)" \
|
||||
--allowlist-type "WMList" \
|
||||
@@ -46,21 +53,26 @@ src/WINGsP.rs: ../WINGs/WINGsP.h ../../wrlib/wraster.h ../WINGs/WINGs.h ../WINGs
|
||||
--allowlist-function "^WM(CreateLabel|SetLabelText|SetLabelFont|SetLabelTextColor|SetLabelRelief|SetLabelTextAlignment)" \
|
||||
--allowlist-type "^WM(Button|ButtonBehaviorMask)" \
|
||||
--allowlist-function "^WM(CreateCustomButton|SetButtonText|SetButtonAction|SetButtonText)" \
|
||||
--allowlist-function "wmkrange" \
|
||||
--allowlist-type "^WM(View|Array|DragOperationType|Point|Data|OpenPanel|SavePanel|HashTable|DraggingInfo|SelectionProcs|Rect|EventProc|Widget|Size|Color|Pixmap|FilePanel|Screen|Range|List|ListItem)" \
|
||||
--allowlist-type "^R(Context|ContextAttributes|Image|RenderingMode|ScalingFilter|StdColormapMode|ImageFormat|Color)" \
|
||||
--allowlist-type "_WINGsConfiguration" \
|
||||
--allowlist-item "^WMAlignment" \
|
||||
--allowlist-item "^WMReliefType" \
|
||||
-o src/WINGsP.rs -- \
|
||||
-o src/WINGsP/mod.rs -- \
|
||||
@PANGO_CFLAGS@ \
|
||||
-I../../wrlib \
|
||||
-I.. && ./patch_WINGsP.sh src/WINGsP.rs
|
||||
-I.. \
|
||||
&& sed -i -r -f patch_WINGsP.sed src/WINGsP/mod.rs
|
||||
|
||||
src/WINGsP/constants.rs: src/WINGsP/mod.rs src/defines.h ../WINGs/WINGs.h Makefile
|
||||
$(BINDGEN) src/defines.h \
|
||||
--allowlist-type WSystemIcon \
|
||||
-o src/WINGsP/constants.rs -- \
|
||||
-I../../wrlib \
|
||||
-I..
|
||||
|
||||
Cargo.lock:
|
||||
$(CARGO) build
|
||||
|
||||
target/debug/libwings_rs.so: $(RUST_SOURCES) $(RUST_EXTRA)
|
||||
target/debug/libwings_rs.so: $(RUST_SRC) $(RUST_EXTRA)
|
||||
$(CARGO) build
|
||||
|
||||
check-local:
|
||||
@@ -69,5 +81,7 @@ check-local:
|
||||
clean-local:
|
||||
$(CARGO) clean
|
||||
rm -f src/WINGsP.rs
|
||||
rm -f src/WINGsP/constants.rs
|
||||
rm -f src/WINGsP/mod.rs
|
||||
|
||||
all: target/debug/libwings_rs.so
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# This file provides ad-hoc fixups to the WINGsP bindings provided by bindgen.
|
||||
|
||||
# Rust submodules.
|
||||
1s/^/pub mod constants;\n/
|
||||
|
||||
# Import Xlib symbols so that everything compiles.
|
||||
1s/^/\nuse x11::xlib::*;/
|
||||
|
||||
# Import FFI symbols from Rust bindings and rewrites.
|
||||
1s/^/\nuse wutil_rs::range::ffi::*;/
|
||||
1s/^/\nuse wutil_rs::array::ffi::*;/
|
||||
1s/^/\nuse wrlib_rs::ffi::*;/
|
||||
1s/^/\nuse crate::ffi::*;/
|
||||
|
||||
# These opaque types don't have Rust bindings. They are only passed to C
|
||||
# functions, so we cast away their type on the Rust side of things.
|
||||
s/_XftDraw/::std::ffi::c_void/g
|
||||
s/_XftFont/::std::ffi::c_void/g
|
||||
s/PangoLayout/::std::ffi::c_void/g
|
||||
@@ -1,22 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This file provides ad-hoc fixups to the WINGsP provided by bindgen:
|
||||
# - Import Xlib symbols so that everything compiles.
|
||||
# - The opaque type names _XftDraw and _XftFont are replaced with void*.
|
||||
# - Pango bindings aren't yet pulled into our Rust code, so PangoLayout is also demoted to void*.
|
||||
|
||||
set -e
|
||||
|
||||
if [ "x$1" = "x" ]; then
|
||||
echo "Usage: $(basename $0) <file to patch>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
FILE="$1"
|
||||
|
||||
exec sed -i -r \
|
||||
-e "1s/^/use x11::xlib::*;\nuse crate::font::ffi::WMFont;\n\n/" \
|
||||
-e "s/_XftDraw/::std::ffi::c_void/g" \
|
||||
-e "s/_XftFont/::std::ffi::c_void/g" \
|
||||
-e "s/PangoLayout/::std::ffi::c_void/g" \
|
||||
"$1"
|
||||
@@ -0,0 +1,566 @@
|
||||
use crate::WINGsP::WMScreen;
|
||||
use std::cell::RefCell;
|
||||
use std::ffi::c_ulong;
|
||||
use std::ptr::{self, NonNull};
|
||||
use wrlib_rs::ffi::{RColor, RGetClosestXColor};
|
||||
|
||||
pub struct Color {
|
||||
screen: NonNull<WMScreen>,
|
||||
color: x11::xlib::XColor,
|
||||
alpha: RefCell<u16>,
|
||||
gc: RefCell<x11::xlib::GC>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct Rgb {
|
||||
pub r: u16,
|
||||
pub g: u16,
|
||||
pub b: u16,
|
||||
}
|
||||
|
||||
impl Rgb {
|
||||
pub fn with_alpha(self, alpha: u16) -> Rgba {
|
||||
Rgba {
|
||||
r: self.r,
|
||||
g: self.g,
|
||||
b: self.b,
|
||||
a: alpha,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub enum ColorMatch {
|
||||
Approximate,
|
||||
Exact,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct Rgba {
|
||||
pub r: u16,
|
||||
pub g: u16,
|
||||
pub b: u16,
|
||||
pub a: u16,
|
||||
}
|
||||
|
||||
impl Color {
|
||||
const LIGHT_STIPPLE_WIDTH: u32 = 4;
|
||||
const LIGHT_STIPPLE_HEIGHT: u32 = 4;
|
||||
const LIGHT_STIPPLE_BITS: [u8; 4] = [0x05, 0x0a, 0x05, 0x0a];
|
||||
const DARK_STIPPLE_WIDTH: u32 = 4;
|
||||
const DARK_STIPPLE_HEIGHT: u32 = 4;
|
||||
const DARK_STIPPLE_BITS: [u8; 4] = [0x0a, 0x04, 0x0a, 0x01];
|
||||
|
||||
pub fn new_rgb(screen: NonNull<WMScreen>, rgb: Rgb, mtch: ColorMatch) -> Option<Self> {
|
||||
Self::new_rgba(screen, rgb.with_alpha(0xffff), mtch)
|
||||
}
|
||||
|
||||
pub fn new_rgba(screen: NonNull<WMScreen>, rgba: Rgba, mtch: ColorMatch) -> Option<Self> {
|
||||
match mtch {
|
||||
ColorMatch::Approximate => find_close_rgba(screen, rgba),
|
||||
ColorMatch::Exact => create_rgba(screen, rgba),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn red(&self) -> u16 {
|
||||
self.color.red
|
||||
}
|
||||
|
||||
pub fn green(&self) -> u16 {
|
||||
self.color.green
|
||||
}
|
||||
|
||||
pub fn blue(&self) -> u16 {
|
||||
self.color.blue
|
||||
}
|
||||
|
||||
pub fn alpha(&self) -> u16 {
|
||||
*self.alpha.borrow()
|
||||
}
|
||||
|
||||
pub fn pixel(&self) -> c_ulong {
|
||||
self.color.pixel
|
||||
}
|
||||
|
||||
pub fn to_xft_color(&self) -> x11::xft::XftColor {
|
||||
x11::xft::XftColor {
|
||||
color: x11::xrender::XRenderColor {
|
||||
red: self.red(),
|
||||
green: self.green(),
|
||||
blue: self.blue(),
|
||||
alpha: self.alpha(),
|
||||
},
|
||||
pixel: self.pixel(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_rcolor(&self) -> RColor {
|
||||
RColor {
|
||||
red: (self.red() >> 8) as u8,
|
||||
green: (self.green() >> 8) as u8,
|
||||
blue: (self.blue() >> 8) as u8,
|
||||
alpha: (self.alpha() >> 8) as u8,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn gc(&self) -> x11::xlib::GC {
|
||||
let mut gc = self.gc.borrow_mut();
|
||||
if gc.is_null() {
|
||||
let mut gcv =
|
||||
unsafe { std::mem::MaybeUninit::<x11::xlib::XGCValues>::zeroed().assume_init() };
|
||||
gcv.foreground = self.pixel();
|
||||
gcv.graphics_exposures = 0;
|
||||
|
||||
*gc = unsafe {
|
||||
let screen = &mut *self.screen.as_ptr();
|
||||
x11::xlib::XCreateGC(
|
||||
screen.display,
|
||||
(*screen.rcontext).drawable,
|
||||
(x11::xlib::GCForeground | x11::xlib::GCGraphicsExposures) as u64,
|
||||
&mut gcv,
|
||||
)
|
||||
};
|
||||
}
|
||||
*gc
|
||||
}
|
||||
|
||||
pub fn hex_triplet(&self) -> String {
|
||||
format!(
|
||||
"#{:02x}{:02x}{:02x}",
|
||||
self.red() >> 8,
|
||||
self.green() >> 8,
|
||||
self.blue() >> 8
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO: make the color creation code return the same WMColor for the
|
||||
* same colors.
|
||||
* make findCloseColor() find the closest color in the RContext pallette
|
||||
* or in the other colors allocated by WINGs.
|
||||
*/
|
||||
|
||||
fn find_close_rgba(screen: NonNull<WMScreen>, rgba: Rgba) -> Option<Color> {
|
||||
let rcontext = unsafe { (*screen.as_ptr()).rcontext };
|
||||
let display = unsafe { (*screen.as_ptr()).display };
|
||||
let colormap = unsafe { (*screen.as_ptr()).colormap };
|
||||
|
||||
let mut xcolor = x11::xlib::XColor {
|
||||
pixel: 0,
|
||||
red: 0,
|
||||
green: 0,
|
||||
blue: 0,
|
||||
flags: 0,
|
||||
pad: 0,
|
||||
};
|
||||
let mut rcolor = RColor {
|
||||
red: (rgba.r >> 8) as u8,
|
||||
green: (rgba.g >> 8) as u8,
|
||||
blue: (rgba.b >> 8) as u8,
|
||||
alpha: (rgba.a >> 8) as u8,
|
||||
};
|
||||
if unsafe { RGetClosestXColor(rcontext, &mut rcolor, &mut xcolor) } == 0 {
|
||||
return None;
|
||||
}
|
||||
if unsafe { x11::xlib::XAllocColor(display, colormap, &mut xcolor) } == 0 {
|
||||
return None;
|
||||
}
|
||||
|
||||
Some(Color {
|
||||
screen: screen,
|
||||
color: xcolor,
|
||||
alpha: RefCell::new(rgba.a),
|
||||
gc: RefCell::new(ptr::null_mut()),
|
||||
})
|
||||
}
|
||||
|
||||
fn create_rgba(screen: NonNull<WMScreen>, rgba: Rgba) -> Option<Color> {
|
||||
let display = unsafe { (*screen.as_ptr()).display };
|
||||
let colormap = unsafe { (*screen.as_ptr()).colormap };
|
||||
let mut xcolor = x11::xlib::XColor {
|
||||
red: rgba.r,
|
||||
green: rgba.g,
|
||||
blue: rgba.b,
|
||||
flags: x11::xlib::DoRed | x11::xlib::DoGreen | x11::xlib::DoBlue,
|
||||
pad: 0,
|
||||
pixel: 0,
|
||||
};
|
||||
if unsafe { x11::xlib::XAllocColor(display, colormap, &mut xcolor) } == 0 {
|
||||
return None;
|
||||
}
|
||||
|
||||
Some(Color {
|
||||
screen: screen,
|
||||
color: xcolor,
|
||||
alpha: RefCell::new(rgba.a),
|
||||
gc: RefCell::new(ptr::null_mut()),
|
||||
})
|
||||
}
|
||||
|
||||
impl Drop for Color {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
let display = (*self.screen.as_ptr()).display;
|
||||
let colormap = (*self.screen.as_ptr()).colormap;
|
||||
x11::xlib::XFreeColors(display, colormap, &mut self.color.pixel, 1, 0);
|
||||
let gc = self.gc.borrow();
|
||||
if !gc.is_null() {
|
||||
x11::xlib::XFreeGC(display, *gc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub mod ffi {
|
||||
use super::*;
|
||||
use std::ffi::{c_char, c_int, c_uint, c_ulong, c_ushort, CString};
|
||||
use std::ptr::NonNull;
|
||||
use std::rc::Rc;
|
||||
use wrlib_rs::ffi::RColor;
|
||||
|
||||
pub type WMColor = Rc<Color>;
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMCreateRGBColor(
|
||||
screen: NonNull<WMScreen>,
|
||||
red: c_ushort,
|
||||
green: c_ushort,
|
||||
blue: c_ushort,
|
||||
exact: c_int,
|
||||
) -> *mut WMColor {
|
||||
Color::new_rgb(
|
||||
screen,
|
||||
Rgb {
|
||||
r: red,
|
||||
g: green,
|
||||
b: blue,
|
||||
},
|
||||
if exact == 0 {
|
||||
ColorMatch::Approximate
|
||||
} else {
|
||||
ColorMatch::Exact
|
||||
},
|
||||
)
|
||||
.map(|c| Box::leak(Box::new(Rc::new(c))) as *mut _)
|
||||
.unwrap_or(unsafe { (*screen.as_ptr()).black })
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMGetRColorFroMColor(color: NonNull<WMColor>) -> RColor {
|
||||
unsafe { (*color.as_ptr()).to_rcolor() }
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn pixel(c: &WMColor) -> c_ulong {
|
||||
c.color.pixel
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMCreateRGBAColor(
|
||||
screen: NonNull<WMScreen>,
|
||||
red: c_ushort,
|
||||
green: c_ushort,
|
||||
blue: c_ushort,
|
||||
alpha: c_ushort,
|
||||
exact: c_int,
|
||||
) -> *mut WMColor {
|
||||
Color::new_rgba(
|
||||
screen,
|
||||
Rgba {
|
||||
r: red,
|
||||
g: green,
|
||||
b: blue,
|
||||
a: alpha,
|
||||
},
|
||||
if exact == 0 {
|
||||
ColorMatch::Approximate
|
||||
} else {
|
||||
ColorMatch::Exact
|
||||
},
|
||||
)
|
||||
.map(|c| Box::leak(Box::new(Rc::new(c))) as *mut _)
|
||||
.unwrap_or(unsafe { (*screen.as_ptr()).black })
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMCreateNamedColor(
|
||||
screen: NonNull<WMScreen>,
|
||||
name: *const c_char,
|
||||
exact: c_int,
|
||||
) -> *mut WMColor {
|
||||
let display = unsafe { (*screen.as_ptr()).display };
|
||||
let colormap = unsafe { (*screen.as_ptr()).colormap };
|
||||
let mut xcolor = x11::xlib::XColor {
|
||||
red: 0,
|
||||
green: 0,
|
||||
blue: 0,
|
||||
flags: 0,
|
||||
pad: 0,
|
||||
pixel: 0,
|
||||
};
|
||||
if unsafe { x11::xlib::XParseColor(display, colormap, name, &mut xcolor) } == 0 {
|
||||
return ptr::null_mut();
|
||||
}
|
||||
let visual_class = unsafe { (*(*screen.as_ptr()).visual).class };
|
||||
let exact = visual_class == x11::xlib::TrueColor || exact != 0;
|
||||
if exact {
|
||||
if let Some(c) = Color::new_rgb(
|
||||
screen,
|
||||
Rgb {
|
||||
r: xcolor.red,
|
||||
g: xcolor.green,
|
||||
b: xcolor.blue,
|
||||
},
|
||||
ColorMatch::Exact,
|
||||
) {
|
||||
return Box::leak(Box::new(Rc::new(c))) as *mut _;
|
||||
}
|
||||
}
|
||||
match Color::new_rgb(
|
||||
screen,
|
||||
Rgb {
|
||||
r: xcolor.red,
|
||||
g: xcolor.green,
|
||||
b: xcolor.blue,
|
||||
},
|
||||
ColorMatch::Approximate,
|
||||
) {
|
||||
Some(c) => Box::leak(Box::new(Rc::new(c))) as *mut _,
|
||||
None => ptr::null_mut(),
|
||||
}
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMRetainColor(color: NonNull<WMColor>) -> *mut WMColor {
|
||||
Box::leak(Box::new(unsafe { (*color.as_ptr()).clone() })) as *mut _
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMReleaseColor(color: NonNull<WMColor>) {
|
||||
unsafe {
|
||||
let _ = Box::from_raw(color.as_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMSetColorAlpha(color: NonNull<WMColor>, alpha: c_ushort) {
|
||||
unsafe {
|
||||
(&mut *color.as_ptr()).alpha.replace(alpha);
|
||||
}
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMPaintColorSwatch(
|
||||
color: NonNull<WMColor>,
|
||||
d: x11::xlib::Drawable,
|
||||
x: c_int,
|
||||
y: c_int,
|
||||
width: c_uint,
|
||||
height: c_uint,
|
||||
) {
|
||||
unsafe {
|
||||
let color = &mut *color.as_ptr();
|
||||
let display = (*color.screen.as_ptr()).display;
|
||||
x11::xlib::XFillRectangle(display, d, color.gc(), x, y, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMColorPixel(color: NonNull<WMColor>) -> c_ulong {
|
||||
unsafe { (*color.as_ptr()).pixel() }
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMColorGC(color: NonNull<WMColor>) -> x11::xlib::GC {
|
||||
unsafe { (&mut *color.as_ptr()).gc() }
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMSetColorInGC(color: NonNull<WMColor>, gc: x11::xlib::GC) {
|
||||
unsafe {
|
||||
let color = &mut *color.as_ptr();
|
||||
let display = (*color.screen.as_ptr()).display;
|
||||
x11::xlib::XSetForeground(display, gc, color.pixel());
|
||||
}
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMWhiteColor(screen: NonNull<WMScreen>) -> *mut WMColor {
|
||||
unsafe {
|
||||
let scr = &mut *screen.as_ptr();
|
||||
if scr.white.is_null() {
|
||||
// TODO: warn if we couldn't allocate.
|
||||
scr.white = WMCreateRGBColor(screen, 0xffff, 0xffff, 0xffff, 1);
|
||||
}
|
||||
|
||||
NonNull::new(scr.white)
|
||||
.map(|c| WMRetainColor(c))
|
||||
.unwrap_or(ptr::null_mut())
|
||||
}
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMBlackColor(screen: NonNull<WMScreen>) -> *mut WMColor {
|
||||
unsafe {
|
||||
let scr = &mut *screen.as_ptr();
|
||||
if scr.black.is_null() {
|
||||
// TODO: warn or bail out if we couldn't allocate.
|
||||
scr.black = WMCreateRGBColor(screen, 0, 0, 0, 1);
|
||||
}
|
||||
|
||||
NonNull::new(scr.black)
|
||||
.map(|c| WMRetainColor(c))
|
||||
.unwrap_or(ptr::null_mut())
|
||||
}
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMGrayColor(screen: NonNull<WMScreen>) -> *mut WMColor {
|
||||
unsafe {
|
||||
let scr = &mut *screen.as_ptr();
|
||||
if scr.gray.is_null() {
|
||||
if scr.depth == 1 {
|
||||
let white = WMWhiteColor(screen);
|
||||
let black = WMBlackColor(screen);
|
||||
let stipple = x11::xlib::XCreateBitmapFromData(
|
||||
scr.display,
|
||||
(*scr.rcontext).drawable,
|
||||
Color::LIGHT_STIPPLE_BITS.as_ptr(),
|
||||
Color::LIGHT_STIPPLE_WIDTH,
|
||||
Color::LIGHT_STIPPLE_HEIGHT,
|
||||
);
|
||||
let color = create_rgba(
|
||||
screen,
|
||||
Rgba {
|
||||
r: 0,
|
||||
g: 0,
|
||||
b: 0,
|
||||
a: 0xffff,
|
||||
},
|
||||
)
|
||||
.expect("cannot create stipple color");
|
||||
let mut gcv =
|
||||
std::mem::MaybeUninit::<x11::xlib::XGCValues>::zeroed().assume_init();
|
||||
gcv.foreground = (&mut *white).color.pixel;
|
||||
gcv.background = (&mut *black).color.pixel;
|
||||
gcv.fill_style = x11::xlib::FillStippled;
|
||||
gcv.stipple = stipple;
|
||||
*color.gc.borrow_mut() = x11::xlib::XCreateGC(
|
||||
scr.display,
|
||||
(*scr.rcontext).drawable,
|
||||
(x11::xlib::GCForeground
|
||||
| x11::xlib::GCBackground
|
||||
| x11::xlib::GCStipple
|
||||
| x11::xlib::GCFillStyle
|
||||
| x11::xlib::GCGraphicsExposures) as u64,
|
||||
&mut gcv,
|
||||
);
|
||||
x11::xlib::XFreePixmap(scr.display, stipple);
|
||||
if let Some(white) = NonNull::new(white) {
|
||||
WMReleaseColor(white);
|
||||
}
|
||||
if let Some(black) = NonNull::new(black) {
|
||||
WMReleaseColor(black);
|
||||
}
|
||||
} else {
|
||||
scr.gray = WMCreateRGBColor(screen, 0xaeba, 0xaaaa, 0xaeba, 1);
|
||||
// TODO: warn or bail if we couldn't allocate.
|
||||
}
|
||||
}
|
||||
NonNull::new(scr.gray)
|
||||
.map(|c| WMRetainColor(c))
|
||||
.unwrap_or(ptr::null_mut())
|
||||
}
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMDarkGrayColor(screen: NonNull<WMScreen>) -> *mut WMColor {
|
||||
unsafe {
|
||||
let scr = &mut *screen.as_ptr();
|
||||
if scr.darkGray.is_null() {
|
||||
if scr.depth == 1 {
|
||||
let white = WMWhiteColor(screen);
|
||||
let black = WMBlackColor(screen);
|
||||
let stipple = x11::xlib::XCreateBitmapFromData(
|
||||
scr.display,
|
||||
(*scr.rcontext).drawable,
|
||||
Color::DARK_STIPPLE_BITS.as_ptr(),
|
||||
Color::DARK_STIPPLE_WIDTH,
|
||||
Color::DARK_STIPPLE_HEIGHT,
|
||||
);
|
||||
let color = create_rgba(
|
||||
screen,
|
||||
Rgba {
|
||||
r: 0,
|
||||
g: 0,
|
||||
b: 0,
|
||||
a: 0xffff,
|
||||
},
|
||||
)
|
||||
.expect("cannot create dark stipple color");
|
||||
let mut gcv =
|
||||
std::mem::MaybeUninit::<x11::xlib::XGCValues>::zeroed().assume_init();
|
||||
gcv.foreground = (&mut *white).color.pixel;
|
||||
gcv.background = (&mut *black).color.pixel;
|
||||
gcv.fill_style = x11::xlib::FillStippled;
|
||||
gcv.stipple = stipple;
|
||||
*color.gc.borrow_mut() = x11::xlib::XCreateGC(
|
||||
scr.display,
|
||||
(*scr.rcontext).drawable,
|
||||
(x11::xlib::GCForeground
|
||||
| x11::xlib::GCBackground
|
||||
| x11::xlib::GCStipple
|
||||
| x11::xlib::GCFillStyle
|
||||
| x11::xlib::GCGraphicsExposures) as u64,
|
||||
&mut gcv,
|
||||
);
|
||||
x11::xlib::XFreePixmap(scr.display, stipple);
|
||||
if let Some(white) = NonNull::new(white) {
|
||||
WMReleaseColor(white);
|
||||
}
|
||||
if let Some(black) = NonNull::new(black) {
|
||||
WMReleaseColor(black);
|
||||
}
|
||||
} else {
|
||||
scr.darkGray = WMCreateRGBColor(screen, 0x5144, 0x5555, 0x5144, 1);
|
||||
// TODO: warn or bail if we couldn't allocate.
|
||||
}
|
||||
}
|
||||
NonNull::new(scr.darkGray)
|
||||
.map(|c| WMRetainColor(c))
|
||||
.unwrap_or(ptr::null_mut())
|
||||
}
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMRedComponentOfColor(color: NonNull<WMColor>) -> c_ushort {
|
||||
unsafe { (*color.as_ptr()).red() }
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMGreenComponentOfColor(color: NonNull<WMColor>) -> c_ushort {
|
||||
unsafe { (*color.as_ptr()).green() }
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMBlueComponentOfColor(color: NonNull<WMColor>) -> c_ushort {
|
||||
unsafe { (*color.as_ptr()).blue() }
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMGetColorAlpha(color: NonNull<WMColor>) -> c_ushort {
|
||||
unsafe { (*color.as_ptr()).alpha() }
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMGetColorRGBDescription(color: NonNull<WMColor>) -> *const c_char {
|
||||
unsafe {
|
||||
wutil_rs::string::wstrdup(
|
||||
CString::new((*color.as_ptr()).hex_triplet())
|
||||
.unwrap()
|
||||
.as_ptr(),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// Exposes preprocessor symbol constants as an enum so that bindgen can see them.
|
||||
|
||||
#include "../../WINGs/WINGs.h"
|
||||
|
||||
enum WSystemIcon {
|
||||
ReturnArrow = WSIReturnArrow,
|
||||
HighlightedReturnArrow = WSIHighlightedReturnArrow,
|
||||
ScrollerDimple = WSIScrollerDimple,
|
||||
ArrowLeft = WSIArrowLeft,
|
||||
HighlightedArrowLeft = WSIHighlightedArrowLeft,
|
||||
ArrowRight = WSIArrowRight,
|
||||
HighlightedArrowRight = WSIHighlightedArrowRight,
|
||||
ArrowUp = WSIArrowUp,
|
||||
HighlightedArrowUp = WSIHighlightedArrowUp,
|
||||
ArrowDown = WSIArrowDown,
|
||||
HighlightedArrowDown = WSIHighlightedArrowDown,
|
||||
CheckMark = WSICheckMark,
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
//! Provides reexports of all public FFI symbols, for convenience.
|
||||
|
||||
pub use crate::color::ffi::*;
|
||||
pub use crate::font::ffi::*;
|
||||
pub use crate::pixmap::ffi::*;
|
||||
@@ -210,7 +210,12 @@ pub mod ffi {
|
||||
|
||||
use std::ffi::CStr;
|
||||
|
||||
use crate::{WINGsP, configuration::Configuration, pango_extras};
|
||||
use crate::{
|
||||
WINGsP,
|
||||
configuration::Configuration,
|
||||
color::ffi::WMColor,
|
||||
pango_extras,
|
||||
};
|
||||
|
||||
use std::{
|
||||
ffi::{c_char, c_int, c_uint},
|
||||
@@ -452,7 +457,7 @@ pub mod ffi {
|
||||
pub unsafe extern "C" fn WMDrawString(
|
||||
screen: *mut WINGsP::W_Screen,
|
||||
d: x11::xlib::Drawable,
|
||||
color: *mut WINGsP::W_Color,
|
||||
color: *mut WMColor,
|
||||
font: *mut WMFont,
|
||||
x: c_int,
|
||||
y: c_int,
|
||||
@@ -466,15 +471,7 @@ pub mod ffi {
|
||||
let screen = unsafe { &*screen };
|
||||
let color = unsafe { &*color };
|
||||
let layout = unsafe { &mut *(**font).layout.as_ptr() };
|
||||
let mut xftcolor = x11::xft::XftColor {
|
||||
color: x11::xrender::XRenderColor {
|
||||
red: color.color.red,
|
||||
green: color.color.green,
|
||||
blue: color.color.blue,
|
||||
alpha: color.alpha,
|
||||
},
|
||||
pixel: color.color.pixel,
|
||||
};
|
||||
let mut xftcolor = color.to_xft_color();
|
||||
|
||||
let previous_text = unsafe { pango_sys::pango_layout_get_text(layout) };
|
||||
if previous_text.is_null() {
|
||||
@@ -507,8 +504,8 @@ pub mod ffi {
|
||||
pub unsafe extern "C" fn WMDrawImageString(
|
||||
screen: *mut WINGsP::W_Screen,
|
||||
d: x11::xlib::Drawable,
|
||||
color: *mut WINGsP::W_Color,
|
||||
background: *mut WINGsP::W_Color,
|
||||
color: *mut WMColor,
|
||||
background: *mut WMColor,
|
||||
font: *mut WMFont,
|
||||
x: c_int,
|
||||
y: c_int,
|
||||
@@ -523,24 +520,8 @@ pub mod ffi {
|
||||
let color = unsafe { &*color };
|
||||
let background = unsafe { &*background };
|
||||
let layout = unsafe { &mut *(**font).layout.as_ptr() };
|
||||
let mut text_color = x11::xft::XftColor {
|
||||
color: x11::xrender::XRenderColor {
|
||||
red: color.color.red,
|
||||
green: color.color.green,
|
||||
blue: color.color.blue,
|
||||
alpha: color.alpha,
|
||||
},
|
||||
pixel: color.color.pixel,
|
||||
};
|
||||
let background = x11::xft::XftColor {
|
||||
color: x11::xrender::XRenderColor {
|
||||
red: background.color.red,
|
||||
green: background.color.green,
|
||||
blue: background.color.blue,
|
||||
alpha: background.alpha,
|
||||
},
|
||||
pixel: color.color.pixel,
|
||||
};
|
||||
let mut text_color = color.to_xft_color();
|
||||
let background = background.to_xft_color();
|
||||
|
||||
unsafe {
|
||||
let Ok(width) = u32::try_from(WMWidthOfString(font, text, length)) else {
|
||||
|
||||
@@ -741,10 +741,10 @@ impl FontPanel {
|
||||
return;
|
||||
}
|
||||
WMSetTextFieldText(self.size_text.as_ptr(), (*item).text);
|
||||
let Ok(len) = CStr::from_ptr((*item).text).count_bytes().try_into() else {
|
||||
let Ok(len) = TryInto::<c_int>::try_into(CStr::from_ptr((*item).text).count_bytes()) else {
|
||||
return;
|
||||
};
|
||||
WMSelectTextFieldRange(self.size_text.as_ptr(), wmkrange(0, len));
|
||||
WMSelectTextFieldRange(self.size_text.as_ptr(), wutil_rs::range::Range::from(0..len));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,13 @@
|
||||
#[allow(non_upper_case_globals)]
|
||||
pub mod WINGsP;
|
||||
pub mod button;
|
||||
pub mod color;
|
||||
pub mod configuration;
|
||||
pub mod ffi;
|
||||
pub mod font;
|
||||
pub mod font_panel;
|
||||
pub mod list;
|
||||
pub(crate) mod pango_extras;
|
||||
pub mod pixmap;
|
||||
pub mod screen;
|
||||
pub mod widget;
|
||||
|
||||
@@ -0,0 +1,660 @@
|
||||
//! [X PixMap](https://en.wikipedia.org/wiki/X_PixMap) wrapper and supporting functions.
|
||||
|
||||
use crate::WINGsP;
|
||||
use std::{
|
||||
cell::Cell,
|
||||
ffi::CStr,
|
||||
num::NonZero,
|
||||
ptr::NonNull,
|
||||
};
|
||||
|
||||
/// Wraps an `x11::xlib::Pixmap` and additional X11 resources, including
|
||||
/// optional clipping region and image mask.
|
||||
///
|
||||
/// Supports limited interior mutability due to hacks in the original C code.
|
||||
pub struct Pixmap {
|
||||
display: NonNull<x11::xlib::Display>,
|
||||
clip_gc: x11::xlib::GC,
|
||||
// Note that `x11::xlib::Pixmap` is actually just an XID, which is just an
|
||||
// integer. A value of 0 is a null value. These may be mutated because there
|
||||
// were a few places in the original C code that modify these fields
|
||||
// directly.
|
||||
pixmap: Cell<Option<NonZero<x11::xlib::Pixmap>>>,
|
||||
mask: Cell<Option<NonZero<x11::xlib::Pixmap>>>,
|
||||
width: u16,
|
||||
height: u16,
|
||||
depth: u16,
|
||||
}
|
||||
|
||||
/// Controls whether a `Pixmap` should have a mask when it is created.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub enum Masked {
|
||||
Yes,
|
||||
No,
|
||||
}
|
||||
|
||||
impl Pixmap {
|
||||
/// Creates a new `Pixmap` with the given dimensions and depth. If `masked`
|
||||
/// is `Yes`, a mask pixmap is created. If `masked` is `No`, no mask is created.
|
||||
pub fn new(screen: NonNull<WINGsP::WMScreen>, width: u16, height: u16, depth: u16, masked: Masked) -> Self {
|
||||
let display = NonNull::new(unsafe { (*screen.as_ptr()).display }).unwrap();
|
||||
let drawable = unsafe { (*(*screen.as_ptr()).rcontext).drawable };
|
||||
let clip_gc = unsafe { (*screen.as_ptr()).clipGC };
|
||||
let pixmap = unsafe {
|
||||
x11::xlib::XCreatePixmap(display.as_ptr(), drawable, width.into(), height.into(), depth.into())
|
||||
};
|
||||
// TODO: warn if pixmap is 0.
|
||||
let pixmap = Cell::new(NonZero::new(pixmap));
|
||||
let mask = match masked {
|
||||
Masked::Yes => {
|
||||
let mask = unsafe {
|
||||
x11::xlib::XCreatePixmap(display.as_ptr(), drawable, width.into(), height.into(), 1)
|
||||
};
|
||||
// TODO: warn if mask is 0.
|
||||
Cell::new(NonZero::new(mask))
|
||||
}
|
||||
Masked::No => Cell::new(None),
|
||||
};
|
||||
Pixmap {
|
||||
display,
|
||||
clip_gc,
|
||||
pixmap,
|
||||
mask,
|
||||
width,
|
||||
height,
|
||||
depth,
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a `Pixmap` from exisiting X11 PixMap resources.
|
||||
///
|
||||
/// Takes ownership of `pixmap` and `mask`, which may be 0 (AKA `None` in xlib).
|
||||
///
|
||||
/// ## Safety
|
||||
///
|
||||
/// The dimensions of `pixmap` and `mask` must be consistent. `width`,
|
||||
/// `height`, and `depth` must all be consistent with the sizes of `pixmap`
|
||||
/// and `mask`.
|
||||
pub unsafe fn new_from_x_pixmaps(
|
||||
screen: NonNull<WINGsP::WMScreen>,
|
||||
pixmap: x11::xlib::Pixmap,
|
||||
mask: x11::xlib::Pixmap,
|
||||
width: u16,
|
||||
height: u16,
|
||||
depth: u16,
|
||||
) -> Self {
|
||||
let display = NonNull::new(unsafe { (*screen.as_ptr()).display }).unwrap();
|
||||
let clip_gc = unsafe { (*screen.as_ptr()).clipGC };
|
||||
Pixmap {
|
||||
display,
|
||||
clip_gc,
|
||||
pixmap: Cell::new(NonZero::new(pixmap)),
|
||||
mask: Cell::new(NonZero::new(mask)),
|
||||
width,
|
||||
height,
|
||||
depth,
|
||||
}
|
||||
}
|
||||
|
||||
/// Attempts to load a `Pixmap` from `file_name`.
|
||||
///
|
||||
/// Returns `None` if the file cannot be loaded.
|
||||
pub fn new_from_file(
|
||||
screen: NonNull<WINGsP::WMScreen>,
|
||||
file_name: &CStr,
|
||||
) -> Option<Self> {
|
||||
let rcontext = NonNull::new(unsafe { (*screen.as_ptr()).rcontext }).unwrap();
|
||||
let Some(image) = NonNull::new(unsafe { wrlib_rs::ffi::RLoadImage(rcontext.as_ptr(), file_name.as_ptr(), 0) }) else {
|
||||
return None;
|
||||
};
|
||||
let result = Self::new_from_r_image(screen, image, 127);
|
||||
unsafe { wrlib_rs::ffi::RReleaseImage(image.as_ptr()) };
|
||||
result
|
||||
}
|
||||
|
||||
/// Attempts to create a `Pixmap` from `image`.
|
||||
///
|
||||
/// If `image` has an alpha channel, its mask will have all pixels with an
|
||||
/// alpha value less than or equal to `threshold` made completely
|
||||
/// transparent.
|
||||
pub fn new_from_r_image(
|
||||
screen: NonNull<WINGsP::WMScreen>,
|
||||
image: NonNull<wrlib_rs::ffi::RImage>,
|
||||
threshold: u16,
|
||||
) -> Option<Self> {
|
||||
let display = NonNull::new(unsafe { (*screen.as_ptr()).display }).unwrap();
|
||||
let clip_gc = unsafe { (*screen.as_ptr()).clipGC };
|
||||
let depth: u16 = unsafe { (*screen.as_ptr()).depth.try_into().expect("invalid depth") };
|
||||
let rcontext = NonNull::new(unsafe { (*screen.as_ptr()).rcontext }).unwrap();
|
||||
let mut pixmap: x11::xlib::Pixmap = 0;
|
||||
let mut mask: x11::xlib::Pixmap = 0;
|
||||
if unsafe { wrlib_rs::ffi::RConvertImageMask(rcontext.as_ptr(), image.as_ptr(), &mut pixmap, &mut mask, threshold.into()) } == 0 {
|
||||
return None;
|
||||
}
|
||||
|
||||
let (width, height) = unsafe {
|
||||
((*image.as_ptr()).width.try_into().expect("invalid width"),
|
||||
(*image.as_ptr()).height.try_into().expect("invalid height"))
|
||||
};
|
||||
Some(Pixmap {
|
||||
display,
|
||||
clip_gc,
|
||||
pixmap: Cell::new(NonZero::new(pixmap)),
|
||||
mask: Cell::new(NonZero::new(mask)),
|
||||
width,
|
||||
height,
|
||||
depth,
|
||||
})
|
||||
}
|
||||
|
||||
/// Draws `self` to `drawable` at location `(x, y)`.
|
||||
pub fn draw(&self, drawable: x11::xlib::Drawable, x: i32, y: i32) {
|
||||
// TODO: maybe we should do something other than pass 0 for some of
|
||||
// these pixmaps when they aren't available. In some cases, like
|
||||
// XSetClipMask, passing a 0 value is correct.
|
||||
unsafe {
|
||||
x11::xlib::XSetClipMask(self.display.as_ptr(), self.clip_gc, self.mask.get().map(|x| x.get()).unwrap_or(0));
|
||||
x11::xlib::XSetClipOrigin(self.display.as_ptr(), self.clip_gc, x, y);
|
||||
x11::xlib::XCopyArea(
|
||||
self.display.as_ptr(),
|
||||
self.pixmap.get().map(|x| x.get()).unwrap_or(0),
|
||||
drawable,
|
||||
self.clip_gc,
|
||||
0,
|
||||
0,
|
||||
self.width.into(),
|
||||
self.height.into(),
|
||||
x,
|
||||
y,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the XID of the X11 pixmap resource owned by `self`.
|
||||
pub fn pixmap(&self) -> x11::xlib::Pixmap {
|
||||
self.pixmap.get().map(|x| x.get()).unwrap_or(0)
|
||||
}
|
||||
|
||||
/// Returns the XID of the X11 pixmap resource owned by `self` for this
|
||||
/// `Pixmap`'s mask.
|
||||
pub fn mask(&self) -> x11::xlib::Pixmap {
|
||||
self.mask.get().map(|x| x.get()).unwrap_or(0)
|
||||
}
|
||||
}
|
||||
|
||||
/// Attempts to load an `RImage` from `file_name` and returns the value of invoking `f` on it.
|
||||
///
|
||||
/// If image loading fails, `f` is invoked on a `None` value.
|
||||
///
|
||||
/// For example:
|
||||
///
|
||||
/// ```ignore
|
||||
/// # use std::ffi::CString;
|
||||
/// # use wings_rs::pixmap::with_r_image_from_file;
|
||||
/// # fn main() {
|
||||
/// # let rcontext = unsafe { wrlib_rs::RCreateContext(display, 0, ptr::null_mut()) };
|
||||
/// let (width, height) = with_r_image_from_file(
|
||||
/// rcontext,
|
||||
/// &CString::new("test_image_32x48.png").unwrap(),
|
||||
/// |image| {
|
||||
/// let image = image.expect("image loading failed");
|
||||
/// ((*image.as_ptr()).width, (*image.as_ptr()).height)
|
||||
/// }
|
||||
/// );
|
||||
/// assert_eq!(width, 32);
|
||||
/// assert_eq!(height, 48);
|
||||
/// # unsafe { wrlib_rs::RDestroyContext(rcontext); }
|
||||
/// # }
|
||||
/// ```
|
||||
pub fn with_r_image_from_file<R>(
|
||||
rcontext: NonNull<wrlib_rs::ffi::RContext>,
|
||||
file_name: &CStr,
|
||||
f: impl FnOnce(Option<NonNull<wrlib_rs::ffi::RImage>>) -> R,
|
||||
) -> R {
|
||||
let image = NonNull::new(unsafe {
|
||||
wrlib_rs::ffi::RLoadImage(rcontext.as_ptr(), file_name.as_ptr(), 0)
|
||||
});
|
||||
let result = f(image);
|
||||
if let Some(image) = image {
|
||||
unsafe { wrlib_rs::ffi::RReleaseImage(image.as_ptr()); }
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
/// A transformation on a `Pixmap`.
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Debug)]
|
||||
pub enum Transform {
|
||||
/// Downscales the `Pixmap` to `width` by `height`.
|
||||
Downscale { width: u32, height: u32 },
|
||||
/// Fills in transparent areas of the `Pixmap` with a grey color. Partially
|
||||
/// transparent areas (with an alpha greater than 0 but less than 255) will
|
||||
/// be blended with the grey color.
|
||||
Greymask,
|
||||
}
|
||||
|
||||
impl Transform {
|
||||
/// Transforms `image` non-destructively by applying each of `transforms`,
|
||||
/// in order, and passing the result to `f`. Returns whatever `f` returns.
|
||||
pub fn with_transformed<R>(
|
||||
mut image: NonNull<wrlib_rs::ffi::RImage>,
|
||||
transforms: &[Transform],
|
||||
f: impl FnOnce(NonNull<wrlib_rs::ffi::RImage>) -> R,
|
||||
) -> R {
|
||||
let mut transforms_i = transforms.iter();
|
||||
if let Some(t) = transforms_i.next() {
|
||||
image = t.apply(image);
|
||||
}
|
||||
for t in transforms_i {
|
||||
let next_image = t.apply(image);
|
||||
unsafe { wrlib_rs::ffi::RReleaseImage(image.as_ptr()); }
|
||||
image = next_image;
|
||||
}
|
||||
let result = f(image);
|
||||
if !transforms.is_empty() {
|
||||
unsafe { wrlib_rs::ffi::RReleaseImage(image.as_ptr()); }
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
fn apply(
|
||||
&self,
|
||||
image: NonNull<wrlib_rs::ffi::RImage>,
|
||||
) -> NonNull<wrlib_rs::ffi::RImage> {
|
||||
match self {
|
||||
Transform::Downscale { width, height } => {
|
||||
let Ok(current_width): Result<u32, _> = (unsafe { (*image.as_ptr()).width.try_into() }) else {
|
||||
return image;
|
||||
};
|
||||
let Ok(current_height): Result<u32, _> = (unsafe { (*image.as_ptr()).height.try_into() }) else {
|
||||
return image;
|
||||
};
|
||||
if current_width <= *width && current_height <= *height {
|
||||
return image;
|
||||
}
|
||||
|
||||
let mut new_width = current_width;
|
||||
let mut new_height = current_height;
|
||||
if new_width > *width {
|
||||
new_width = *width;
|
||||
new_height = *width * current_height / current_width;
|
||||
}
|
||||
if new_height > *height {
|
||||
new_width = *height * current_width / current_height;
|
||||
new_height = *height;
|
||||
}
|
||||
let image = unsafe { wrlib_rs::ffi::RScaleImage(image.as_ptr(), new_width, new_height) };
|
||||
NonNull::new(image).expect("RScaleImage failed")
|
||||
}
|
||||
Transform::Greymask => {
|
||||
const GREY: wrlib_rs::ffi::RColor = wrlib_rs::ffi::RColor {
|
||||
red: 0xAE,
|
||||
green: 0xAA,
|
||||
blue: 0xAE,
|
||||
alpha: 0xFF,
|
||||
};
|
||||
unsafe {
|
||||
let result = NonNull::new(wrlib_rs::ffi::RCloneImage(image.as_ptr()))
|
||||
.expect("RCloneImage failed");
|
||||
wrlib_rs::ffi::RCombineImageWithColor(result.as_ptr(), &GREY as *const _);
|
||||
result
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for Pixmap {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if let Some(pixmap) = self.pixmap.get() {
|
||||
x11::xlib::XFreePixmap(self.display.as_ptr(), pixmap.get());
|
||||
}
|
||||
if let Some(mask) = self.mask.get() {
|
||||
x11::xlib::XFreePixmap(self.display.as_ptr(), mask.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub mod ffi {
|
||||
use super::*;
|
||||
use std::{
|
||||
ffi::{c_char, c_int, c_uint, c_ushort},
|
||||
ptr,
|
||||
rc::Rc,
|
||||
};
|
||||
|
||||
pub type WMPixmap = Rc<Pixmap>;
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMRetainPixmap(pixmap: *mut WMPixmap) -> *mut WMPixmap {
|
||||
if pixmap.is_null() {
|
||||
return ptr::null_mut();
|
||||
}
|
||||
Box::leak(Box::new(unsafe { (*pixmap).clone() })) as *mut _
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMReleasePixmap(pixmap: *mut WMPixmap) {
|
||||
let _ = unsafe { Box::from_raw(pixmap) };
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMCreatePixmap(
|
||||
screen: *mut WINGsP::WMScreen,
|
||||
width: c_ushort,
|
||||
height: c_ushort,
|
||||
depth: c_ushort,
|
||||
masked: c_int,
|
||||
) -> *mut WMPixmap {
|
||||
let pixmap = Pixmap::new(
|
||||
NonNull::new(screen).expect("pixmap screen cannot be null"),
|
||||
width,
|
||||
height,
|
||||
depth,
|
||||
if masked == 0 {
|
||||
Masked::No
|
||||
} else {
|
||||
Masked::Yes
|
||||
},
|
||||
);
|
||||
Box::leak(Box::new(Rc::new(pixmap))) as *mut _
|
||||
}
|
||||
|
||||
/// ## Safety
|
||||
///
|
||||
/// `pixmap` and `mask` should have the same dimensions.
|
||||
///
|
||||
/// The values `width`, `height`, and `depth` must match the dimensions of
|
||||
/// `pixmap` and `mask`.
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMCreatePixmapFromXPixmaps(
|
||||
screen: *mut WINGsP::WMScreen,
|
||||
pixmap: x11::xlib::Pixmap,
|
||||
mask: x11::xlib::Pixmap,
|
||||
width: c_ushort,
|
||||
height: c_ushort,
|
||||
depth: c_ushort,
|
||||
) -> *mut WMPixmap {
|
||||
let Some(screen) = NonNull::new(screen) else {
|
||||
return ptr::null_mut();
|
||||
};
|
||||
let pixmap = unsafe {
|
||||
Pixmap::new_from_x_pixmaps(
|
||||
screen,
|
||||
pixmap,
|
||||
mask,
|
||||
width,
|
||||
height,
|
||||
depth,
|
||||
)
|
||||
};
|
||||
Box::leak(Box::new(Rc::new(pixmap))) as *mut _
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMCreatePixmapFromFile(
|
||||
screen: *mut WINGsP::WMScreen,
|
||||
file_name: *const c_char,
|
||||
) -> *mut WMPixmap {
|
||||
let Some(screen) = NonNull::new(screen) else {
|
||||
return ptr::null_mut();
|
||||
};
|
||||
if file_name.is_null() {
|
||||
return ptr::null_mut();
|
||||
}
|
||||
let file_name = unsafe { CStr::from_ptr(file_name) };
|
||||
let Some(pixmap) = Pixmap::new_from_file(screen, file_name) else {
|
||||
return ptr::null_mut();
|
||||
};
|
||||
Box::leak(Box::new(Rc::new(pixmap))) as *mut _
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMCreatePixmapFromRImage(
|
||||
screen: *mut WINGsP::WMScreen,
|
||||
image: *mut wrlib_rs::ffi::RImage,
|
||||
threshold: c_ushort,
|
||||
) -> *mut WMPixmap {
|
||||
let Some(screen) = NonNull::new(screen) else {
|
||||
return ptr::null_mut();
|
||||
};
|
||||
let Some(image) = NonNull::new(image) else {
|
||||
return ptr::null_mut();
|
||||
};
|
||||
let Some(pixmap) = Pixmap::new_from_r_image(
|
||||
screen,
|
||||
image,
|
||||
threshold,
|
||||
) else {
|
||||
return ptr::null_mut();
|
||||
};
|
||||
Box::leak(Box::new(Rc::new(pixmap))) as *mut _
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMCreateGreyedPixmapFromRImage(
|
||||
screen: *mut WINGsP::WMScreen,
|
||||
image: *mut wrlib_rs::ffi::RImage,
|
||||
) -> *mut WMPixmap {
|
||||
let Some(screen) = NonNull::new(screen) else {
|
||||
return ptr::null_mut();
|
||||
};
|
||||
let image = NonNull::new(image).expect("image cannot be null");
|
||||
let Some(result) = Transform::with_transformed(
|
||||
image,
|
||||
&[Transform::Greymask],
|
||||
|image| Pixmap::new_from_r_image(screen, image, 0)) else {
|
||||
return ptr::null_mut();
|
||||
};
|
||||
Box::leak(Box::new(Rc::new(result))) as *mut _
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMCreateScaledPixmapFromFile(
|
||||
screen: *mut WINGsP::WMScreen,
|
||||
file_name: *const c_char,
|
||||
width: c_uint,
|
||||
height: c_uint,
|
||||
) -> *mut WMPixmap {
|
||||
let Some(screen) = NonNull::new(screen) else {
|
||||
return ptr::null_mut();
|
||||
};
|
||||
if file_name.is_null() {
|
||||
return ptr::null_mut();
|
||||
}
|
||||
let file_name = unsafe { CStr::from_ptr(file_name) };
|
||||
let Some(rcontext) = NonNull::new(unsafe { (*screen.as_ptr()).rcontext }) else {
|
||||
return ptr::null_mut();
|
||||
};
|
||||
let Some(result) =
|
||||
with_r_image_from_file(
|
||||
rcontext,
|
||||
file_name,
|
||||
|image| {
|
||||
let Some(image) = image else {
|
||||
return None;
|
||||
};
|
||||
Transform::with_transformed(
|
||||
image,
|
||||
&[Transform::Downscale { width, height }],
|
||||
|image| Pixmap::new_from_r_image(screen, image, 0),
|
||||
)
|
||||
}
|
||||
) else {
|
||||
return ptr::null_mut();
|
||||
};
|
||||
Box::leak(Box::new(Rc::new(result))) as *mut _
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMCreateGreyedPixmapFromFile(
|
||||
screen: *mut WINGsP::WMScreen,
|
||||
file_name: *const c_char,
|
||||
) -> *mut WMPixmap {
|
||||
let Some(screen) = NonNull::new(screen) else {
|
||||
return ptr::null_mut();
|
||||
};
|
||||
if file_name.is_null() {
|
||||
return ptr::null_mut();
|
||||
}
|
||||
let file_name = unsafe { CStr::from_ptr(file_name) };
|
||||
let Some(rcontext) = NonNull::new(unsafe { (*screen.as_ptr()).rcontext }) else {
|
||||
return ptr::null_mut();
|
||||
};
|
||||
let Some(result) =
|
||||
with_r_image_from_file(
|
||||
rcontext,
|
||||
file_name,
|
||||
|image| {
|
||||
let Some(image) = image else {
|
||||
return None;
|
||||
};
|
||||
Transform::with_transformed(
|
||||
image,
|
||||
&[Transform::Greymask],
|
||||
|image| Pixmap::new_from_r_image(screen, image, 0),
|
||||
)
|
||||
}
|
||||
) else {
|
||||
return ptr::null_mut();
|
||||
};
|
||||
Box::leak(Box::new(Rc::new(result))) as *mut _
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMCreateScaledGreyedPixmapFromFile(
|
||||
screen: *mut WINGsP::WMScreen,
|
||||
file_name: *const c_char,
|
||||
width: c_uint,
|
||||
height: c_uint,
|
||||
) -> *mut WMPixmap {
|
||||
let Some(screen) = NonNull::new(screen) else {
|
||||
return ptr::null_mut();
|
||||
};
|
||||
if file_name.is_null() {
|
||||
return ptr::null_mut();
|
||||
}
|
||||
let file_name = unsafe { CStr::from_ptr(file_name) };
|
||||
let Some(rcontext) = NonNull::new(unsafe { (*screen.as_ptr()).rcontext }) else {
|
||||
return ptr::null_mut();
|
||||
};
|
||||
let Some(result) = with_r_image_from_file(
|
||||
rcontext,
|
||||
file_name,
|
||||
|image| {
|
||||
let Some(image) = image else {
|
||||
return None;
|
||||
};
|
||||
Transform::with_transformed(
|
||||
image,
|
||||
&[Transform::Downscale { width, height },
|
||||
Transform::Greymask],
|
||||
|image| Pixmap::new_from_r_image(screen, image, 0),
|
||||
)
|
||||
},
|
||||
) else {
|
||||
return ptr::null_mut();
|
||||
};
|
||||
Box::leak(Box::new(Rc::new(result))) as *mut _
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMCreatePixmapFromXPMData(
|
||||
screen: *mut WINGsP::WMScreen,
|
||||
data: *mut *mut c_char,
|
||||
) -> *mut WMPixmap {
|
||||
unsafe {
|
||||
let rcontext = (*screen).rcontext;
|
||||
let image = wrlib_rs::ffi::RGetImageFromXPMData(rcontext, data);
|
||||
if image.is_null() {
|
||||
return ptr::null_mut();
|
||||
}
|
||||
|
||||
let result = WMCreatePixmapFromRImage(screen, image, 127);
|
||||
wrlib_rs::ffi::RReleaseImage(image);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMGetPixmapXID(pixmap: *mut WMPixmap) -> x11::xlib::Pixmap {
|
||||
let pixmap = NonNull::new(pixmap).expect("pixmap cannot be null");
|
||||
|
||||
unsafe { (**pixmap.as_ptr()).pixmap.get().map(|x| x.get()).unwrap_or(0) }
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMLeakPixmapXID(pixmap: *mut WMPixmap) {
|
||||
let pixmap = NonNull::new(pixmap).expect("pixmap cannot be null");
|
||||
|
||||
unsafe { (**pixmap.as_ptr()).pixmap.set(None) }
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMGetPixmapMaskXID(pixmap: *mut WMPixmap) -> x11::xlib::Pixmap {
|
||||
let pixmap = NonNull::new(pixmap).expect("pixmap cannot be null");
|
||||
|
||||
unsafe { (**pixmap.as_ptr()).mask.get().map(|x| x.get()).unwrap_or(0) }
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMSetPixmapMaskXID(pixmap: *mut WMPixmap, mask: x11::xlib::Pixmap) {
|
||||
let pixmap = NonNull::new(pixmap).expect("pixmap cannot be null");
|
||||
|
||||
unsafe { (**pixmap.as_ptr()).mask.set(NonZero::new(mask)); }
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMGetPixmapSize(pixmap: *mut WMPixmap) -> WINGsP::WMSize {
|
||||
let pixmap = NonNull::new(pixmap).expect("pixmap cannot be null");
|
||||
|
||||
let (width, height) = unsafe {
|
||||
((&(*pixmap.as_ptr())).width, (&(*pixmap.as_ptr())).height)
|
||||
};
|
||||
WINGsP::WMSize {
|
||||
width: width.into(),
|
||||
height: height.into(),
|
||||
}
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMGetPixmapDepth(pixmap: *mut WMPixmap) -> c_int {
|
||||
let pixmap = NonNull::new(pixmap).expect("pixmap cannot be null");
|
||||
|
||||
unsafe { (&(*pixmap.as_ptr())).depth.into() }
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMGetSystemPixmap(screen: *mut WINGsP::WMScreen, image: c_uint) -> *mut WMPixmap {
|
||||
unsafe {
|
||||
let screen = &*screen;
|
||||
match image {
|
||||
WINGsP::constants::WSystemIcon_ReturnArrow => WMRetainPixmap(screen.buttonArrow),
|
||||
WINGsP::constants::WSystemIcon_HighlightedReturnArrow => WMRetainPixmap(screen.pushedButtonArrow),
|
||||
WINGsP::constants::WSystemIcon_ScrollerDimple => WMRetainPixmap(screen.scrollerDimple),
|
||||
WINGsP::constants::WSystemIcon_ArrowLeft => WMRetainPixmap(screen.leftArrow),
|
||||
WINGsP::constants::WSystemIcon_HighlightedArrowLeft => WMRetainPixmap(screen.hiLeftArrow),
|
||||
WINGsP::constants::WSystemIcon_ArrowRight => WMRetainPixmap(screen.rightArrow),
|
||||
WINGsP::constants::WSystemIcon_HighlightedArrowRight => WMRetainPixmap(screen.hiRightArrow),
|
||||
WINGsP::constants::WSystemIcon_ArrowUp => WMRetainPixmap(screen.upArrow),
|
||||
WINGsP::constants::WSystemIcon_HighlightedArrowUp => WMRetainPixmap(screen.hiUpArrow),
|
||||
WINGsP::constants::WSystemIcon_ArrowDown => WMRetainPixmap(screen.downArrow),
|
||||
WINGsP::constants::WSystemIcon_HighlightedArrowDown => WMRetainPixmap(screen.hiDownArrow),
|
||||
WINGsP::constants::WSystemIcon_CheckMark => WMRetainPixmap(screen.checkMark),
|
||||
_ => ptr::null_mut(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMDrawPixmap(
|
||||
pixmap: *mut WMPixmap,
|
||||
drawable: x11::xlib::Drawable,
|
||||
x: c_int,
|
||||
y: c_int,
|
||||
) {
|
||||
let pixmap = unsafe { &*pixmap };
|
||||
pixmap.draw(drawable, x, y);
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ typedef struct W_Label {
|
||||
WMColor *textColor;
|
||||
WMFont *font; /* if NULL, use default */
|
||||
|
||||
W_Pixmap *image;
|
||||
WMPixmap *image;
|
||||
|
||||
struct {
|
||||
WMReliefType relief:3;
|
||||
|
||||
@@ -165,7 +165,7 @@ int W_GetTextHeight(WMFont * font, const char *text, int width, int wrap)
|
||||
|
||||
void
|
||||
W_PaintText(W_View * view, Drawable d, WMFont * font, int x, int y,
|
||||
int width, WMAlignment alignment, WMColor * color, int wrap,
|
||||
int width, WMAlignment alignment, WMColor *color, int wrap,
|
||||
const char *text, int length)
|
||||
{
|
||||
const char *ptr = text;
|
||||
@@ -203,7 +203,7 @@ W_PaintText(W_View * view, Drawable d, WMFont * font, int x, int y,
|
||||
void
|
||||
W_PaintTextAndImage(W_View * view, int wrap, WMColor * textColor, WMFont * font,
|
||||
WMReliefType relief, const char *text,
|
||||
WMAlignment alignment, W_Pixmap * image,
|
||||
WMAlignment alignment, WMPixmap * image,
|
||||
WMImagePosition position, WMColor * backColor, int ofs)
|
||||
{
|
||||
W_Screen *screen = view->screen;
|
||||
@@ -250,11 +250,12 @@ W_PaintTextAndImage(W_View * view, int wrap, WMColor * textColor, WMFont * font,
|
||||
|
||||
/* calc. image alignment */
|
||||
if (position != WIPNoImage && image != NULL) {
|
||||
WMSize size = WMGetPixmapSize(image);
|
||||
switch (position) {
|
||||
case WIPOverlaps:
|
||||
case WIPImageOnly:
|
||||
ix = (view->size.width - image->width) / 2;
|
||||
iy = (view->size.height - image->height) / 2;
|
||||
ix = (view->size.width - size.width) / 2;
|
||||
iy = (view->size.height - size.height) / 2;
|
||||
/*
|
||||
x = 2;
|
||||
y = 0;
|
||||
@@ -263,31 +264,31 @@ W_PaintTextAndImage(W_View * view, int wrap, WMColor * textColor, WMFont * font,
|
||||
|
||||
case WIPLeft:
|
||||
ix = x;
|
||||
iy = y + (h - image->height) / 2;
|
||||
x = x + image->width + 5;
|
||||
iy = y + (h - size.height) / 2;
|
||||
x = x + size.width + 5;
|
||||
y = 0;
|
||||
w -= image->width + 5;
|
||||
w -= size.width + 5;
|
||||
break;
|
||||
|
||||
case WIPRight:
|
||||
ix = view->size.width - image->width - x;
|
||||
iy = y + (h - image->height) / 2;
|
||||
w -= image->width + 5;
|
||||
ix = view->size.width - size.width - x;
|
||||
iy = y + (h - size.height) / 2;
|
||||
w -= size.width + 5;
|
||||
break;
|
||||
|
||||
case WIPBelow:
|
||||
ix = (view->size.width - image->width) / 2;
|
||||
iy = h - image->height;
|
||||
ix = (view->size.width - size.width) / 2;
|
||||
iy = h - size.height;
|
||||
y = 0;
|
||||
h -= image->height;
|
||||
h -= size.height;
|
||||
break;
|
||||
|
||||
default:
|
||||
case WIPAbove:
|
||||
ix = (view->size.width - image->width) / 2;
|
||||
ix = (view->size.width - size.width) / 2;
|
||||
iy = y;
|
||||
y = image->height;
|
||||
h -= image->height;
|
||||
y = size.height;
|
||||
h -= size.height;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -295,14 +296,14 @@ W_PaintTextAndImage(W_View * view, int wrap, WMColor * textColor, WMFont * font,
|
||||
iy += ofs;
|
||||
|
||||
XSetClipOrigin(screen->display, screen->clipGC, ix, iy);
|
||||
XSetClipMask(screen->display, screen->clipGC, image->mask);
|
||||
XSetClipMask(screen->display, screen->clipGC, WMGetPixmapMaskXID(image));
|
||||
|
||||
if (image->depth == 1)
|
||||
XCopyPlane(screen->display, image->pixmap, d, screen->clipGC,
|
||||
0, 0, image->width, image->height, ix, iy, 1);
|
||||
if (WMGetPixmapDepth(image) == 1)
|
||||
XCopyPlane(screen->display, WMGetPixmapXID(image), d, screen->clipGC,
|
||||
0, 0, size.width, size.height, ix, iy, 1);
|
||||
else
|
||||
XCopyArea(screen->display, image->pixmap, d, screen->clipGC,
|
||||
0, 0, image->width, image->height, ix, iy);
|
||||
XCopyArea(screen->display, WMGetPixmapXID(image), d, screen->clipGC,
|
||||
0, 0, size.width, size.height, ix, iy);
|
||||
}
|
||||
|
||||
/* draw text */
|
||||
|
||||
@@ -124,7 +124,7 @@ WMAlertPanel *WMCreateAlertPanel(WMScreen * scrPtr, WMWindow * owner,
|
||||
WMSetLabelImagePosition(panel->iLbl, WIPImageOnly);
|
||||
WMMapWidget(panel->iLbl);
|
||||
WMAddBoxSubview(hbox, WMWidgetView(panel->iLbl), False, True, 64, 0, 10);
|
||||
icon = WMCreateApplicationIconBlendedPixmap(scrPtr, (RColor *) NULL);
|
||||
icon = WMCreateApplicationIconGreyedPixmap(scrPtr);
|
||||
if (icon) {
|
||||
WMSetLabelImage(panel->iLbl, icon);
|
||||
WMReleasePixmap(icon);
|
||||
@@ -181,7 +181,7 @@ WMAlertPanel *WMCreateAlertPanel(WMScreen * scrPtr, WMWindow * owner,
|
||||
if (defaultButton)
|
||||
dw = WMWidthOfString(defaultFont, defaultButton, strlen(defaultButton));
|
||||
|
||||
dw = dw + (scrPtr->buttonArrow ? scrPtr->buttonArrow->width : 0);
|
||||
dw = dw + (scrPtr->buttonArrow ? WMGetPixmapSize(scrPtr->buttonArrow).width : 0);
|
||||
|
||||
aw += 30;
|
||||
ow += 30;
|
||||
@@ -291,7 +291,7 @@ WMAlertPanel *WMCreateScaledAlertPanel(WMScreen * scrPtr, WMWindow * owner,
|
||||
WMSetLabelImagePosition(panel->iLbl, WIPImageOnly);
|
||||
WMMapWidget(panel->iLbl);
|
||||
WMAddBoxSubview(hbox, WMWidgetView(panel->iLbl), False, True, 64, 0, 10);
|
||||
icon = WMCreateApplicationIconBlendedPixmap(scrPtr, (RColor *) NULL);
|
||||
icon = WMCreateApplicationIconGreyedPixmap(scrPtr);
|
||||
if (icon) {
|
||||
WMSetLabelImage(panel->iLbl, icon);
|
||||
WMReleasePixmap(icon);
|
||||
@@ -347,7 +347,7 @@ WMAlertPanel *WMCreateScaledAlertPanel(WMScreen * scrPtr, WMWindow * owner,
|
||||
if (defaultButton)
|
||||
dw = WMWidthOfString(scrPtr->normalFont, defaultButton, strlen(defaultButton));
|
||||
|
||||
dw = dw + (scrPtr->buttonArrow ? scrPtr->buttonArrow->width : 0);
|
||||
dw = dw + (scrPtr->buttonArrow ? WMGetPixmapSize(scrPtr->buttonArrow).width : 0);
|
||||
|
||||
aw += WMScaleX(30);
|
||||
ow += WMScaleX(30);
|
||||
@@ -563,7 +563,7 @@ WMInputPanel *WMCreateInputPanel(WMScreen * scrPtr, WMWindow * owner, const char
|
||||
if (okButton)
|
||||
dw = WMWidthOfString(defaultFont, okButton, strlen(okButton));
|
||||
|
||||
w = dw + (scrPtr->buttonArrow ? scrPtr->buttonArrow->width : 0);
|
||||
w = dw + (scrPtr->buttonArrow ? WMGetPixmapSize(scrPtr->buttonArrow).width : 0);
|
||||
if (aw > w)
|
||||
w = aw;
|
||||
|
||||
@@ -662,7 +662,7 @@ WMInputPanel *WMCreateScaledInputPanel(WMScreen * scrPtr, WMWindow * owner, cons
|
||||
if (okButton)
|
||||
dw = WMWidthOfString(scrPtr->normalFont, okButton, strlen(okButton));
|
||||
|
||||
w = dw + (scrPtr->buttonArrow ? scrPtr->buttonArrow->width : 0);
|
||||
w = dw + (scrPtr->buttonArrow ? WMGetPixmapSize(scrPtr->buttonArrow).width : 0);
|
||||
if (aw > w)
|
||||
w = aw;
|
||||
|
||||
@@ -767,7 +767,7 @@ WMGenericPanel *WMCreateGenericPanel(WMScreen * scrPtr, WMWindow * owner,
|
||||
WMSetLabelImagePosition(panel->iLbl, WIPImageOnly);
|
||||
WMMapWidget(panel->iLbl);
|
||||
WMAddBoxSubview(hbox, WMWidgetView(panel->iLbl), False, True, 64, 0, 10);
|
||||
icon = WMCreateApplicationIconBlendedPixmap(scrPtr, (RColor *) NULL);
|
||||
icon = WMCreateApplicationIconGreyedPixmap(scrPtr);
|
||||
if (icon) {
|
||||
WMSetLabelImage(panel->iLbl, icon);
|
||||
WMReleasePixmap(icon);
|
||||
@@ -815,7 +815,7 @@ WMGenericPanel *WMCreateGenericPanel(WMScreen * scrPtr, WMWindow * owner,
|
||||
if (alternateButton)
|
||||
aw = WMWidthOfString(defaultFont, alternateButton, strlen(alternateButton));
|
||||
|
||||
dw = dw + (scrPtr->buttonArrow ? scrPtr->buttonArrow->width : 0);
|
||||
dw = dw + (scrPtr->buttonArrow ? WMGetPixmapSize(scrPtr->buttonArrow).width : 0);
|
||||
|
||||
aw += 30;
|
||||
dw += 30;
|
||||
|
||||
@@ -1,260 +0,0 @@
|
||||
|
||||
#include "WINGsP.h"
|
||||
|
||||
#include <wraster.h>
|
||||
|
||||
WMPixmap *WMRetainPixmap(WMPixmap * pixmap)
|
||||
{
|
||||
if (pixmap)
|
||||
pixmap->refCount++;
|
||||
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
void WMReleasePixmap(WMPixmap * pixmap)
|
||||
{
|
||||
wassertr(pixmap != NULL);
|
||||
|
||||
pixmap->refCount--;
|
||||
|
||||
if (pixmap->refCount < 1) {
|
||||
if (pixmap->pixmap)
|
||||
XFreePixmap(pixmap->screen->display, pixmap->pixmap);
|
||||
if (pixmap->mask)
|
||||
XFreePixmap(pixmap->screen->display, pixmap->mask);
|
||||
wfree(pixmap);
|
||||
}
|
||||
}
|
||||
|
||||
WMPixmap *WMCreatePixmap(WMScreen * scrPtr, int width, int height, int depth, Bool masked)
|
||||
{
|
||||
WMPixmap *pixPtr;
|
||||
|
||||
pixPtr = wmalloc(sizeof(WMPixmap));
|
||||
pixPtr->screen = scrPtr;
|
||||
pixPtr->width = width;
|
||||
pixPtr->height = height;
|
||||
pixPtr->depth = depth;
|
||||
pixPtr->refCount = 1;
|
||||
|
||||
pixPtr->pixmap = XCreatePixmap(scrPtr->display, W_DRAWABLE(scrPtr), width, height, depth);
|
||||
if (masked) {
|
||||
pixPtr->mask = XCreatePixmap(scrPtr->display, W_DRAWABLE(scrPtr), width, height, 1);
|
||||
} else {
|
||||
pixPtr->mask = None;
|
||||
}
|
||||
|
||||
return pixPtr;
|
||||
}
|
||||
|
||||
WMPixmap *WMCreatePixmapFromXPixmaps(WMScreen * scrPtr, Pixmap pixmap, Pixmap mask,
|
||||
int width, int height, int depth)
|
||||
{
|
||||
WMPixmap *pixPtr;
|
||||
|
||||
pixPtr = wmalloc(sizeof(WMPixmap));
|
||||
pixPtr->screen = scrPtr;
|
||||
pixPtr->pixmap = pixmap;
|
||||
pixPtr->mask = mask;
|
||||
pixPtr->width = width;
|
||||
pixPtr->height = height;
|
||||
pixPtr->depth = depth;
|
||||
pixPtr->refCount = 1;
|
||||
|
||||
return pixPtr;
|
||||
}
|
||||
|
||||
WMPixmap *WMCreatePixmapFromFile(WMScreen * scrPtr, const char *fileName)
|
||||
{
|
||||
WMPixmap *pixPtr;
|
||||
RImage *image;
|
||||
|
||||
image = RLoadImage(scrPtr->rcontext, fileName, 0);
|
||||
if (!image)
|
||||
return NULL;
|
||||
|
||||
pixPtr = WMCreatePixmapFromRImage(scrPtr, image, 127);
|
||||
|
||||
RReleaseImage(image);
|
||||
|
||||
return pixPtr;
|
||||
}
|
||||
|
||||
WMPixmap *WMCreatePixmapFromRImage(WMScreen * scrPtr, RImage * image, int threshold)
|
||||
{
|
||||
WMPixmap *pixPtr;
|
||||
Pixmap pixmap, mask;
|
||||
|
||||
if (image == NULL)
|
||||
return NULL;
|
||||
|
||||
if (!RConvertImageMask(scrPtr->rcontext, image, &pixmap, &mask, threshold)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pixPtr = wmalloc(sizeof(WMPixmap));
|
||||
pixPtr->screen = scrPtr;
|
||||
pixPtr->pixmap = pixmap;
|
||||
pixPtr->mask = mask;
|
||||
pixPtr->width = image->width;
|
||||
pixPtr->height = image->height;
|
||||
pixPtr->depth = scrPtr->depth;
|
||||
pixPtr->refCount = 1;
|
||||
|
||||
return pixPtr;
|
||||
}
|
||||
|
||||
WMPixmap *WMCreateBlendedPixmapFromRImage(WMScreen * scrPtr, RImage * image, const RColor * color)
|
||||
{
|
||||
WMPixmap *pixPtr;
|
||||
RImage *copy;
|
||||
|
||||
copy = RCloneImage(image);
|
||||
if (!copy)
|
||||
return NULL;
|
||||
|
||||
RCombineImageWithColor(copy, color);
|
||||
pixPtr = WMCreatePixmapFromRImage(scrPtr, copy, 0);
|
||||
RReleaseImage(copy);
|
||||
|
||||
return pixPtr;
|
||||
}
|
||||
|
||||
WMPixmap *WMCreateBlendedPixmapFromFile(WMScreen * scrPtr, const char *fileName, const RColor * color)
|
||||
{
|
||||
return WMCreateScaledBlendedPixmapFromFile(scrPtr, fileName, color, 0, 0);
|
||||
}
|
||||
|
||||
WMPixmap *WMCreateScaledBlendedPixmapFromFile(WMScreen *scrPtr, const char *fileName, const RColor *color,
|
||||
unsigned int width, unsigned int height)
|
||||
{
|
||||
WMPixmap *pixPtr;
|
||||
RImage *image;
|
||||
|
||||
image = RLoadImage(scrPtr->rcontext, fileName, 0);
|
||||
if (!image)
|
||||
return NULL;
|
||||
|
||||
/* scale it if needed to fit in the specified box */
|
||||
if ((width > 0) && (height > 0) && ((image->width > width) || (image->height > height))) {
|
||||
int new_width, new_height;
|
||||
RImage *new_image;
|
||||
|
||||
new_width = image->width;
|
||||
new_height = image->height;
|
||||
if (new_width > width) {
|
||||
new_width = width;
|
||||
new_height = width * image->height / image->width;
|
||||
}
|
||||
if (new_height > height) {
|
||||
new_width = height * image->width / image->height;
|
||||
new_height = height;
|
||||
}
|
||||
|
||||
new_image = RScaleImage(image, new_width, new_height);
|
||||
RReleaseImage(image);
|
||||
image = new_image;
|
||||
}
|
||||
|
||||
RCombineImageWithColor(image, color);
|
||||
pixPtr = WMCreatePixmapFromRImage(scrPtr, image, 0);
|
||||
RReleaseImage(image);
|
||||
|
||||
return pixPtr;
|
||||
}
|
||||
|
||||
WMPixmap *WMCreatePixmapFromXPMData(WMScreen * scrPtr, char **data)
|
||||
{
|
||||
WMPixmap *pixPtr;
|
||||
RImage *image;
|
||||
|
||||
image = RGetImageFromXPMData(scrPtr->rcontext, data);
|
||||
if (!image)
|
||||
return NULL;
|
||||
|
||||
pixPtr = WMCreatePixmapFromRImage(scrPtr, image, 127);
|
||||
|
||||
RReleaseImage(image);
|
||||
|
||||
return pixPtr;
|
||||
}
|
||||
|
||||
Pixmap WMGetPixmapXID(WMPixmap * pixmap)
|
||||
{
|
||||
wassertrv(pixmap != NULL, None);
|
||||
|
||||
return pixmap->pixmap;
|
||||
}
|
||||
|
||||
Pixmap WMGetPixmapMaskXID(WMPixmap * pixmap)
|
||||
{
|
||||
wassertrv(pixmap != NULL, None);
|
||||
|
||||
return pixmap->mask;
|
||||
}
|
||||
|
||||
WMSize WMGetPixmapSize(WMPixmap * pixmap)
|
||||
{
|
||||
WMSize size = { 0, 0 };
|
||||
|
||||
wassertrv(pixmap != NULL, size);
|
||||
|
||||
size.width = pixmap->width;
|
||||
size.height = pixmap->height;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
WMPixmap *WMGetSystemPixmap(WMScreen * scr, int image)
|
||||
{
|
||||
switch (image) {
|
||||
case WSIReturnArrow:
|
||||
return WMRetainPixmap(scr->buttonArrow);
|
||||
|
||||
case WSIHighlightedReturnArrow:
|
||||
return WMRetainPixmap(scr->pushedButtonArrow);
|
||||
|
||||
case WSIScrollerDimple:
|
||||
return WMRetainPixmap(scr->scrollerDimple);
|
||||
|
||||
case WSIArrowLeft:
|
||||
return WMRetainPixmap(scr->leftArrow);
|
||||
|
||||
case WSIHighlightedArrowLeft:
|
||||
return WMRetainPixmap(scr->hiLeftArrow);
|
||||
|
||||
case WSIArrowRight:
|
||||
return WMRetainPixmap(scr->rightArrow);
|
||||
|
||||
case WSIHighlightedArrowRight:
|
||||
return WMRetainPixmap(scr->hiRightArrow);
|
||||
|
||||
case WSIArrowUp:
|
||||
return WMRetainPixmap(scr->upArrow);
|
||||
|
||||
case WSIHighlightedArrowUp:
|
||||
return WMRetainPixmap(scr->hiUpArrow);
|
||||
|
||||
case WSIArrowDown:
|
||||
return WMRetainPixmap(scr->downArrow);
|
||||
|
||||
case WSIHighlightedArrowDown:
|
||||
return WMRetainPixmap(scr->hiDownArrow);
|
||||
|
||||
case WSICheckMark:
|
||||
return WMRetainPixmap(scr->checkMark);
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void WMDrawPixmap(WMPixmap * pixmap, Drawable d, int x, int y)
|
||||
{
|
||||
WMScreen *scr = pixmap->screen;
|
||||
|
||||
XSetClipMask(scr->display, scr->clipGC, pixmap->mask);
|
||||
XSetClipOrigin(scr->display, scr->clipGC, x, y);
|
||||
|
||||
XCopyArea(scr->display, pixmap->pixmap, d, scr->clipGC, 0, 0, pixmap->width, pixmap->height, x, y);
|
||||
}
|
||||
@@ -284,21 +284,23 @@ static void paintPopUpButton(PopUpButton * bPtr)
|
||||
}
|
||||
|
||||
if (bPtr->flags.pullsDown) {
|
||||
XCopyArea(scr->display, scr->pullDownIndicator->pixmap,
|
||||
pixmap, scr->copyGC, 0, 0, scr->pullDownIndicator->width,
|
||||
scr->pullDownIndicator->height,
|
||||
bPtr->view->size.width - scr->pullDownIndicator->width - 4,
|
||||
(bPtr->view->size.height - scr->pullDownIndicator->height) / 2);
|
||||
WMSize size = WMGetPixmapSize(scr->pullDownIndicator);
|
||||
XCopyArea(scr->display, WMGetPixmapXID(scr->pullDownIndicator),
|
||||
pixmap, scr->copyGC, 0, 0, size.width,
|
||||
size.height,
|
||||
bPtr->view->size.width - size.width - 4,
|
||||
(bPtr->view->size.height - size.height) / 2);
|
||||
} else {
|
||||
int x, y;
|
||||
WMSize size = WMGetPixmapSize(scr->popUpIndicator);
|
||||
|
||||
x = bPtr->view->size.width - scr->popUpIndicator->width - 4;
|
||||
y = (bPtr->view->size.height - scr->popUpIndicator->height) / 2;
|
||||
x = bPtr->view->size.width - size.width - 4;
|
||||
y = (bPtr->view->size.height - size.height) / 2;
|
||||
|
||||
XSetClipOrigin(scr->display, scr->clipGC, x, y);
|
||||
XSetClipMask(scr->display, scr->clipGC, scr->popUpIndicator->mask);
|
||||
XCopyArea(scr->display, scr->popUpIndicator->pixmap, pixmap,
|
||||
scr->clipGC, 0, 0, scr->popUpIndicator->width, scr->popUpIndicator->height, x, y);
|
||||
XSetClipMask(scr->display, scr->clipGC, WMGetPixmapMaskXID(scr->popUpIndicator));
|
||||
XCopyArea(scr->display, WMGetPixmapXID(scr->popUpIndicator), pixmap,
|
||||
scr->clipGC, 0, 0, size.width, size.height, x, y);
|
||||
}
|
||||
|
||||
XCopyArea(scr->display, pixmap, bPtr->view->window, scr->copyGC, 0, 0,
|
||||
@@ -357,11 +359,12 @@ static void paintMenuEntry(PopUpButton * bPtr, int index, int highlight)
|
||||
index * itemHeight + yo, width, WALeft, scr->black, False, title, strlen(title));
|
||||
|
||||
if (!bPtr->flags.pullsDown && index == bPtr->selectedItemIndex) {
|
||||
XCopyArea(scr->display, scr->popUpIndicator->pixmap,
|
||||
WMSize size = WMGetPixmapSize(scr->popUpIndicator);
|
||||
XCopyArea(scr->display, WMGetPixmapXID(scr->popUpIndicator),
|
||||
bPtr->menuView->window, scr->copyGC, 0, 0,
|
||||
scr->popUpIndicator->width, scr->popUpIndicator->height,
|
||||
width - scr->popUpIndicator->width - 4,
|
||||
index * itemHeight + (itemHeight - scr->popUpIndicator->height) / 2);
|
||||
size.width, size.height,
|
||||
width - size.width - 4,
|
||||
index * itemHeight + (itemHeight - size.height) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -401,11 +404,12 @@ static Pixmap makeMenuPixmap(PopUpButton * bPtr)
|
||||
i * itemHeight + yo, width, WALeft, color, False, text, strlen(text));
|
||||
|
||||
if (!bPtr->flags.pullsDown && i == bPtr->selectedItemIndex) {
|
||||
XCopyArea(scr->display, scr->popUpIndicator->pixmap, pixmap,
|
||||
scr->copyGC, 0, 0, scr->popUpIndicator->width,
|
||||
scr->popUpIndicator->height,
|
||||
width - scr->popUpIndicator->width - 4,
|
||||
i * itemHeight + (itemHeight - scr->popUpIndicator->height) / 2);
|
||||
WMSize size = WMGetPixmapSize(scr->popUpIndicator);
|
||||
XCopyArea(scr->display, WMGetPixmapXID(scr->popUpIndicator), pixmap,
|
||||
scr->copyGC, 0, 0, size.width,
|
||||
size.height,
|
||||
width - size.width - 4,
|
||||
i * itemHeight + (itemHeight - size.height) / 2);
|
||||
}
|
||||
|
||||
i++;
|
||||
|
||||
@@ -225,7 +225,7 @@ static void paintArrow(WMScroller * sPtr, Drawable d, int part)
|
||||
WMView *view = sPtr->view;
|
||||
WMScreen *scr = view->screen;
|
||||
int ofs;
|
||||
W_Pixmap *arrow;
|
||||
WMPixmap *arrow;
|
||||
|
||||
#ifndef DOUBLE_BUFFER
|
||||
GC gc = scr->lightGC;
|
||||
@@ -290,6 +290,7 @@ static void paintArrow(WMScroller * sPtr, Drawable d, int part)
|
||||
|
||||
if (sPtr->flags.horizontal) {
|
||||
/* paint button */
|
||||
WMSize size = WMGetPixmapSize(arrow);
|
||||
#ifndef DOUBLE_BUFFER
|
||||
XFillRectangle(scr->display, d, gc, ofs + 1, 2 + 1, BUTTON_SIZE + 1 - 3, BUTTON_SIZE - 3);
|
||||
#else
|
||||
@@ -300,16 +301,16 @@ static void paintArrow(WMScroller * sPtr, Drawable d, int part)
|
||||
W_DrawRelief(scr, d, ofs, 2, BUTTON_SIZE, BUTTON_SIZE, WRRaised);
|
||||
|
||||
/* paint arrow */
|
||||
XSetClipMask(scr->display, scr->clipGC, arrow->mask);
|
||||
XSetClipMask(scr->display, scr->clipGC, WMGetPixmapMaskXID(arrow));
|
||||
XSetClipOrigin(scr->display, scr->clipGC,
|
||||
ofs + (BUTTON_SIZE - arrow->width) / 2, 2 + (BUTTON_SIZE - arrow->height) / 2);
|
||||
ofs + (BUTTON_SIZE - size.width) / 2, 2 + (BUTTON_SIZE - size.height) / 2);
|
||||
|
||||
XCopyArea(scr->display, arrow->pixmap, d, scr->clipGC,
|
||||
0, 0, arrow->width, arrow->height,
|
||||
ofs + (BUTTON_SIZE - arrow->width) / 2, 2 + (BUTTON_SIZE - arrow->height) / 2);
|
||||
XCopyArea(scr->display, WMGetPixmapXID(arrow), d, scr->clipGC,
|
||||
0, 0, size.width, size.height,
|
||||
ofs + (BUTTON_SIZE - size.width) / 2, 2 + (BUTTON_SIZE - size.height) / 2);
|
||||
|
||||
} else { /* vertical */
|
||||
|
||||
WMSize size = WMGetPixmapSize(arrow);
|
||||
/* paint button */
|
||||
#ifndef DOUBLE_BUFFER
|
||||
XFillRectangle(scr->display, d, gc, 2 + 1, ofs + 1, BUTTON_SIZE - 3, BUTTON_SIZE + 1 - 3);
|
||||
@@ -322,12 +323,12 @@ static void paintArrow(WMScroller * sPtr, Drawable d, int part)
|
||||
|
||||
/* paint arrow */
|
||||
|
||||
XSetClipMask(scr->display, scr->clipGC, arrow->mask);
|
||||
XSetClipMask(scr->display, scr->clipGC, WMGetPixmapMaskXID(arrow));
|
||||
XSetClipOrigin(scr->display, scr->clipGC,
|
||||
2 + (BUTTON_SIZE - arrow->width) / 2, ofs + (BUTTON_SIZE - arrow->height) / 2);
|
||||
XCopyArea(scr->display, arrow->pixmap, d, scr->clipGC,
|
||||
0, 0, arrow->width, arrow->height,
|
||||
2 + (BUTTON_SIZE - arrow->width) / 2, ofs + (BUTTON_SIZE - arrow->height) / 2);
|
||||
2 + (BUTTON_SIZE - size.width) / 2, ofs + (BUTTON_SIZE - size.height) / 2);
|
||||
XCopyArea(scr->display, WMGetPixmapXID(arrow), d, scr->clipGC,
|
||||
0, 0, size.width, size.height,
|
||||
2 + (BUTTON_SIZE - size.width) / 2, ofs + (BUTTON_SIZE - size.height) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -395,6 +396,7 @@ static void paintScroller(Scroller * sPtr)
|
||||
knobP = sPtr->floatValue * ((float)length - knobL);
|
||||
|
||||
if (sPtr->flags.horizontal) {
|
||||
WMSize size = WMGetPixmapSize(scr->scrollerDimple);
|
||||
/* before */
|
||||
XFillRectangle(scr->display, d, scr->stippleGC, ofs, 2, (int)knobP, view->size.height - 4);
|
||||
|
||||
@@ -405,11 +407,11 @@ static void paintScroller(Scroller * sPtr)
|
||||
#endif
|
||||
W_DrawRelief(scr, d, ofs + (int)knobP, 2, (int)knobL, view->size.height - 4, WRRaised);
|
||||
|
||||
XCopyArea(scr->display, scr->scrollerDimple->pixmap, d,
|
||||
XCopyArea(scr->display, WMGetPixmapXID(scr->scrollerDimple), d,
|
||||
scr->copyGC, 0, 0,
|
||||
scr->scrollerDimple->width, scr->scrollerDimple->height,
|
||||
ofs + (int)knobP + ((int)knobL - scr->scrollerDimple->width - 1) / 2,
|
||||
(view->size.height - scr->scrollerDimple->height - 1) / 2);
|
||||
size.width, size.height,
|
||||
ofs + (int)knobP + ((int)knobL - size.width - 1) / 2,
|
||||
(view->size.height - size.height - 1) / 2);
|
||||
|
||||
/* after */
|
||||
if ((int)(knobP + knobL) < length)
|
||||
@@ -418,6 +420,7 @@ static void paintScroller(Scroller * sPtr)
|
||||
length - (int)(knobP + knobL), view->size.height - 4);
|
||||
} else {
|
||||
/* before */
|
||||
WMSize size = WMGetPixmapSize(scr->scrollerDimple);
|
||||
if (knobP > 0.0F)
|
||||
XFillRectangle(scr->display, d, scr->stippleGC,
|
||||
2, ofs, view->size.width - 4, (int)knobP);
|
||||
@@ -427,11 +430,11 @@ static void paintScroller(Scroller * sPtr)
|
||||
XFillRectangle(scr->display, d, scr->lightGC,
|
||||
2 + 2, ofs + (int)knobP + 2, view->size.width - 4 - 4, (int)knobL - 4);
|
||||
#endif
|
||||
XCopyArea(scr->display, scr->scrollerDimple->pixmap, d,
|
||||
XCopyArea(scr->display, WMGetPixmapXID(scr->scrollerDimple), d,
|
||||
scr->copyGC, 0, 0,
|
||||
scr->scrollerDimple->width, scr->scrollerDimple->height,
|
||||
(view->size.width - scr->scrollerDimple->width - 1) / 2,
|
||||
ofs + (int)knobP + ((int)knobL - scr->scrollerDimple->height - 1) / 2);
|
||||
size.width, size.height,
|
||||
(view->size.width - size.width - 1) / 2,
|
||||
ofs + (int)knobP + ((int)knobL - size.height - 1) / 2);
|
||||
|
||||
W_DrawRelief(scr, d, 2, ofs + (int)knobP, view->size.width - 4, (int)knobL, WRRaised);
|
||||
|
||||
|
||||
@@ -400,16 +400,18 @@ static void paintSplitView(WMSplitView * sPtr)
|
||||
sPtr->flags.adjustOnPaint = 0;
|
||||
}
|
||||
|
||||
XSetClipMask(scr->display, scr->clipGC, dimple->mask);
|
||||
XSetClipMask(scr->display, scr->clipGC, WMGetPixmapMaskXID(dimple));
|
||||
|
||||
WMSize size = WMGetPixmapSize(dimple);
|
||||
if (sPtr->flags.vertical) {
|
||||
x = ((DIVIDER_THICKNESS - dimple->width) / 2);
|
||||
y = (sPtr->view->size.height - dimple->height) / 2;
|
||||
x = ((DIVIDER_THICKNESS - size.width) / 2);
|
||||
y = (sPtr->view->size.height - size.height) / 2;
|
||||
} else {
|
||||
x = (sPtr->view->size.width - dimple->width) / 2;
|
||||
y = ((DIVIDER_THICKNESS - dimple->height) / 2);
|
||||
x = (sPtr->view->size.width - size.width) / 2;
|
||||
y = ((DIVIDER_THICKNESS - size.height) / 2);
|
||||
}
|
||||
|
||||
WMSize dimpleSize = WMGetPixmapSize(dimple);
|
||||
for (i = 0; i < count - 1; i++) {
|
||||
p = _GetPSubviewStructAt(i);
|
||||
|
||||
@@ -419,8 +421,8 @@ static void paintSplitView(WMSplitView * sPtr)
|
||||
y += p->size;
|
||||
|
||||
XSetClipOrigin(scr->display, scr->clipGC, x, y);
|
||||
XCopyArea(scr->display, dimple->pixmap, sPtr->view->window,
|
||||
scr->clipGC, 0, 0, dimple->width, dimple->height, x, y);
|
||||
XCopyArea(scr->display, WMGetPixmapXID(dimple), sPtr->view->window,
|
||||
scr->clipGC, 0, 0, dimpleSize.width, dimpleSize.height, x, y);
|
||||
|
||||
if (sPtr->flags.vertical)
|
||||
x += DIVIDER_THICKNESS;
|
||||
|
||||
@@ -627,9 +627,10 @@ static void paintText(Text * tPtr)
|
||||
XFillRectangle(dpy, tPtr->db, WMColorGC(tPtr->bgColor), 0, 0, tPtr->visible.w, tPtr->visible.h);
|
||||
|
||||
if (tPtr->bgPixmap) {
|
||||
WMSize bgSize = WMGetPixmapSize(tPtr->bgPixmap);
|
||||
WMDrawPixmap(tPtr->bgPixmap, tPtr->db,
|
||||
(tPtr->visible.w - tPtr->visible.x - tPtr->bgPixmap->width) / 2,
|
||||
(tPtr->visible.h - tPtr->visible.y - tPtr->bgPixmap->height) / 2);
|
||||
(tPtr->visible.w - tPtr->visible.x - bgSize.width) / 2,
|
||||
(tPtr->visible.h - tPtr->visible.y - bgSize.height) / 2);
|
||||
}
|
||||
|
||||
if (!(tb = tPtr->currentTextBlock)) {
|
||||
@@ -766,7 +767,7 @@ static void paintText(Text * tPtr)
|
||||
WMDrawPixmap(tb->d.pixmap, tPtr->db,
|
||||
tb->sections[0].x - tPtr->hpos,
|
||||
tb->sections[0].y - tPtr->vpos);
|
||||
h = tb->d.pixmap->height + 1;
|
||||
h = WMGetPixmapSize(tb->d.pixmap).height + 1;
|
||||
|
||||
}
|
||||
|
||||
@@ -848,7 +849,7 @@ static void mouseOverObject(Text * tPtr, int x, int y)
|
||||
if (tb->sections[0].x <= x
|
||||
&& tb->sections[0].y <= y
|
||||
&& tb->sections[0].x + tb->sections[0].w >= x
|
||||
&& tb->sections[0].y + tb->d.pixmap->height >= y) {
|
||||
&& tb->sections[0].y + WMGetPixmapSize(tb->d.pixmap).height >= y) {
|
||||
tPtr->flags.isOverGraphic = 3;
|
||||
result = True;
|
||||
break;
|
||||
@@ -1059,7 +1060,7 @@ static void cursorToTextPosition(Text * tPtr, int x, int y)
|
||||
if (tb->object)
|
||||
_w = WMWidgetWidth(tb->d.widget) - 5;
|
||||
else
|
||||
_w = tb->d.pixmap->width - 5;
|
||||
_w = WMGetPixmapSize(tb->d.pixmap).width - 5;
|
||||
|
||||
if (tb->sections[0].x + _w >= x)
|
||||
break;
|
||||
@@ -1096,7 +1097,7 @@ static void cursorToTextPosition(Text * tPtr, int x, int y)
|
||||
if (tb->object)
|
||||
tPtr->cursor.x += WMWidgetWidth(tb->d.widget);
|
||||
else
|
||||
tPtr->cursor.x += tb->d.pixmap->width;
|
||||
tPtr->cursor.x += WMGetPixmapSize(tb->d.pixmap).width;
|
||||
} else if (pos > tb->sections[s].begin) {
|
||||
tPtr->cursor.x +=
|
||||
WMWidthOfString(tb->d.font,
|
||||
@@ -1121,7 +1122,7 @@ static void cursorToTextPosition(Text * tPtr, int x, int y)
|
||||
/* we have said TextBlock, now where within it? */
|
||||
if (tb) {
|
||||
if (tb->graphic) {
|
||||
int gw = (tb->object ? WMWidgetWidth(tb->d.widget) : tb->d.pixmap->width);
|
||||
int gw = (tb->object ? WMWidgetWidth(tb->d.widget) : WMGetPixmapSize(tb->d.pixmap).width);
|
||||
|
||||
tPtr->cursor.x = tb->sections[0].x;
|
||||
|
||||
@@ -1370,9 +1371,9 @@ static int layOutLine(Text * tPtr, myLineItems * items, int nitems, int x, int y
|
||||
if (tPtr->flags.alignment != WALeft)
|
||||
lw += WMWidgetWidth(wdt);
|
||||
} else {
|
||||
line_height = WMAX(line_height, tb->d.pixmap->height + max_d);
|
||||
line_height = WMAX(line_height, WMGetPixmapSize(tb->d.pixmap).height + max_d);
|
||||
if (tPtr->flags.alignment != WALeft)
|
||||
lw += tb->d.pixmap->width;
|
||||
lw += WMGetPixmapSize(tb->d.pixmap).width;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1420,8 +1421,8 @@ static int layOutLine(Text * tPtr, myLineItems * items, int nitems, int x, int y
|
||||
tb->sections[n].y = max_d + y + line_height - WMWidgetHeight(wdt);
|
||||
tb->sections[n].w = WMWidgetWidth(wdt);
|
||||
} else {
|
||||
tb->sections[n].y = y + line_height + max_d - tb->d.pixmap->height;
|
||||
tb->sections[n].w = tb->d.pixmap->width;
|
||||
tb->sections[n].y = y + line_height + max_d - WMGetPixmapSize(tb->d.pixmap).height;
|
||||
tb->sections[n].w = WMGetPixmapSize(tb->d.pixmap).width;
|
||||
}
|
||||
x += tb->sections[n].w;
|
||||
}
|
||||
@@ -1530,7 +1531,7 @@ static void layOutDocument(Text * tPtr)
|
||||
if (tb->object)
|
||||
width = WMWidgetWidth(tb->d.widget);
|
||||
else
|
||||
width = tb->d.pixmap->width;
|
||||
width = WMGetPixmapSize(tb->d.pixmap).width;
|
||||
|
||||
if (width > tPtr->docWidth)
|
||||
tPtr->docWidth = width;
|
||||
@@ -2989,8 +2990,8 @@ WMText *WMCreateTextForDocumentType(WMWidget * parent, WMAction * parser, WMActi
|
||||
W_SetViewBackgroundColor(tPtr->view, tPtr->bgColor);
|
||||
|
||||
gcv.graphics_exposures = False;
|
||||
gcv.foreground = W_PIXEL(scr->gray);
|
||||
gcv.background = W_PIXEL(scr->darkGray);
|
||||
gcv.foreground = WMColorPixel(scr->gray);
|
||||
gcv.background = WMColorPixel(scr->darkGray);
|
||||
gcv.fill_style = FillStippled;
|
||||
/* why not use scr->stipple here? */
|
||||
gcv.stipple = XCreateBitmapFromData(dpy, W_DRAWABLE(scr), STIPPLE_BITS, STIPPLE_WIDTH, STIPPLE_HEIGHT);
|
||||
|
||||
@@ -102,8 +102,8 @@ static W_View *createView(W_Screen * screen, W_View * parent)
|
||||
|
||||
view->attribFlags |= CWBackPixel | CWColormap | CWBorderPixel | CWBackPixmap;
|
||||
view->attribs.background_pixmap = None;
|
||||
view->attribs.background_pixel = W_PIXEL(screen->gray);
|
||||
view->attribs.border_pixel = W_PIXEL(screen->black);
|
||||
view->attribs.background_pixel = WMColorPixel(screen->gray);
|
||||
view->attribs.border_pixel = WMColorPixel(screen->black);
|
||||
view->attribs.colormap = screen->colormap;
|
||||
|
||||
view->backColor = WMRetainColor(screen->gray);
|
||||
@@ -483,7 +483,7 @@ void W_RedisplayView(W_View * view)
|
||||
WMHandleEvent(&ev);
|
||||
}
|
||||
|
||||
void W_SetViewBackgroundColor(W_View * view, WMColor * color)
|
||||
void W_SetViewBackgroundColor(W_View * view, WMColor *color)
|
||||
{
|
||||
if (view->backColor)
|
||||
WMReleaseColor(view->backColor);
|
||||
@@ -491,9 +491,9 @@ void W_SetViewBackgroundColor(W_View * view, WMColor * color)
|
||||
|
||||
view->attribFlags |= CWBackPixel;
|
||||
view->attribFlags &= ~CWBackPixmap;
|
||||
view->attribs.background_pixel = W_PIXEL(color);
|
||||
view->attribs.background_pixel = WMColorPixel(color);
|
||||
if (view->flags.realized) {
|
||||
XSetWindowBackground(view->screen->display, view->window, W_PIXEL(color));
|
||||
XSetWindowBackground(view->screen->display, view->window, WMColorPixel(color));
|
||||
XClearWindow(view->screen->display, view->window);
|
||||
}
|
||||
}
|
||||
@@ -506,9 +506,9 @@ void W_SetViewBackgroundPixmap(W_View *view, WMPixmap *pix)
|
||||
|
||||
view->attribFlags |= CWBackPixmap;
|
||||
view->attribFlags &= ~CWBackPixel;
|
||||
view->attribs.background_pixmap = pix->pixmap;
|
||||
view->attribs.background_pixmap = WMGetPixmapXID(pix);
|
||||
if (view->flags.realized) {
|
||||
XSetWindowBackgroundPixmap(view->screen->display, view->window, pix->pixmap);
|
||||
XSetWindowBackgroundPixmap(view->screen->display, view->window, WMGetPixmapXID(pix));
|
||||
XClearWindow(view->screen->display, view->window);
|
||||
}
|
||||
}
|
||||
|
||||