From ef81be7efed18b6a579afb9fef2a57a98bc356da Mon Sep 17 00:00:00 2001 From: IoIxD Date: Tue, 2 Dec 2025 22:43:53 -0700 Subject: [PATCH] alpha --- src/backend/x11.c | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/src/backend/x11.c b/src/backend/x11.c index f75adfb..c3e79f8 100644 --- a/src/backend/x11.c +++ b/src/backend/x11.c @@ -131,13 +131,15 @@ static XVisualInfo* get_visual_info(Display* display) { } static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) { - MwLL r; - Window p; - XVisualInfo* xvi; - unsigned long n = 1; - int i; - int px = x, py = y; - XSizeHints sh; + MwLL r; + Window p; + XVisualInfo* xvi; + XVisualInfo visualinfo; + unsigned long n = 1; + int i; + int px = x, py = y; + XSizeHints sh; + XSetWindowAttributes attr; r = malloc(sizeof(*r)); @@ -157,7 +159,25 @@ static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) { p = parent->x11.window; r->x11.top = 0; } - r->x11.window = XCreateSimpleWindow(r->x11.display, p, px, py, width, height, 0, 0, WhitePixel(r->x11.display, DefaultScreen(r->x11.display))); + /* If we have a 32-bit capable screen, use XCreateWindow to select it with a proper colormap.*/ + if(XMatchVisualInfo(r->x11.display, DefaultScreen(r->x11.display), 32, TrueColor, &visualinfo)) { + attr.colormap = XCreateColormap(r->x11.display, p, visualinfo.visual, AllocNone); + attr.event_mask = mask; + attr.background_pixmap = None; + attr.border_pixel = 0; + + r->x11.window = XCreateWindow( + r->x11.display, p, + px, py, width, height, + 0, + visualinfo.depth, + InputOutput, + visualinfo.visual, + CWColormap | CWEventMask | CWBackPixmap | CWBorderPixel, + &attr); + } else { + r->x11.window = XCreateSimpleWindow(r->x11.display, p, px, py, width, height, 0, 0, WhitePixel(r->x11.display, DefaultScreen(r->x11.display))); + } sh.flags = PWinGravity; sh.win_gravity = StaticGravity; XSetWMNormalHints(r->x11.display, r->x11.window, &sh);