True transparency support

This commit is contained in:
Nikita Zlobin 2020-05-04 19:45:02 +05:00
parent 7a094bc702
commit d3f6c05590

View File

@ -647,13 +647,19 @@ struct window_x11 *x_win_create(void)
struct window_x11 *win = g_malloc0(sizeof(struct window_x11)); struct window_x11 *win = g_malloc0(sizeof(struct window_x11));
Window root; Window root;
int scr_n;
XVisualInfo vi;
XSetWindowAttributes wa; XSetWindowAttributes wa;
root = RootWindow(xctx.dpy, DefaultScreen(xctx.dpy)); scr_n = DefaultScreen(xctx.dpy);
root = RootWindow(xctx.dpy, scr_n);
XMatchVisualInfo(xctx.dpy, scr_n, 32, TrueColor, &vi);
wa.override_redirect = true; wa.override_redirect = true;
wa.background_pixmap = ParentRelative; wa.background_pixmap = None;
wa.background_pixel = 0; wa.background_pixel = 0;
wa.border_pixel = 0;
wa.colormap = XCreateColormap(xctx.dpy, root, vi.visual, AllocNone);
wa.event_mask = wa.event_mask =
ExposureMask | KeyPressMask | VisibilityChangeMask | ExposureMask | KeyPressMask | VisibilityChangeMask |
ButtonReleaseMask | FocusChangeMask| StructureNotifyMask; ButtonReleaseMask | FocusChangeMask| StructureNotifyMask;
@ -666,10 +672,10 @@ struct window_x11 *x_win_create(void)
scr->w, scr->w,
1, 1,
0, 0,
DefaultDepth(xctx.dpy, DefaultScreen(xctx.dpy)), vi.depth,
CopyFromParent, CopyFromParent,
DefaultVisual(xctx.dpy, DefaultScreen(xctx.dpy)), vi.visual,
CWOverrideRedirect | CWBackPixmap | CWBackPixel | CWEventMask, CWOverrideRedirect | CWBackPixmap | CWBackPixel | CWBorderPixel | CWColormap | CWEventMask,
&wa); &wa);
x_set_wm(win->xwin); x_set_wm(win->xwin);
@ -680,7 +686,7 @@ struct window_x11 *x_win_create(void)
(0xffffffff / 100))); (0xffffffff / 100)));
win->root_surface = cairo_xlib_surface_create(xctx.dpy, win->xwin, win->root_surface = cairo_xlib_surface_create(xctx.dpy, win->xwin,
DefaultVisual(xctx.dpy, 0), vi.visual,
WIDTH, HEIGHT); WIDTH, HEIGHT);
win->c_ctx = cairo_create(win->root_surface); win->c_ctx = cairo_create(win->root_surface);