From 578ed46f34430a5998046a1137ef5c1db15da8ac Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Thu, 24 Apr 2025 22:13:07 +0100 Subject: [PATCH] GTK: correct a misuse of WhitePixel and BlackPixel According to the X specs, WhitePixel and BlackPixel refer to permanent entries in the default colourmap. This means that they're not necessarily appropriate for use with a Drawable with a different depth than the root window. When drawing to a Pixmap that will be used as a 1-bit alpha mask by Cairo, the correct values are simply 0 (transparent) and 1 (opaque). --- unix/unifont.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unix/unifont.c b/unix/unifont.c index 04a65ccf..0ac77120 100644 --- a/unix/unifont.c +++ b/unix/unifont.c @@ -677,8 +677,8 @@ static void x11font_cairo_setup( xfi->pixmap_surface = cairo_xlib_surface_create_for_bitmap( disp, xfi->pixmap, ScreenOfDisplay(disp, widgetscr), xfi->pixwidth, xfi->pixheight); - gcvals.foreground = WhitePixel(disp, widgetscr); - gcvals.background = BlackPixel(disp, widgetscr); + gcvals.foreground = 1; + gcvals.background = 0; gcvals.font = xfi->xfs->fid; xfi->gc = XCreateGC(disp, xfi->pixmap, GCForeground | GCBackground | GCFont, &gcvals);