This commit is contained in:
IoIxD 2025-12-02 22:43:53 -07:00
commit ef81be7efe

View file

@ -131,13 +131,15 @@ static XVisualInfo* get_visual_info(Display* display) {
} }
static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) { static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) {
MwLL r; MwLL r;
Window p; Window p;
XVisualInfo* xvi; XVisualInfo* xvi;
unsigned long n = 1; XVisualInfo visualinfo;
int i; unsigned long n = 1;
int px = x, py = y; int i;
XSizeHints sh; int px = x, py = y;
XSizeHints sh;
XSetWindowAttributes attr;
r = malloc(sizeof(*r)); 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; p = parent->x11.window;
r->x11.top = 0; 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.flags = PWinGravity;
sh.win_gravity = StaticGravity; sh.win_gravity = StaticGravity;
XSetWMNormalHints(r->x11.display, r->x11.window, &sh); XSetWMNormalHints(r->x11.display, r->x11.window, &sh);