From 296cea499c4b1ea09c20bf54a150987938b800d4 Mon Sep 17 00:00:00 2001 From: Nikita Zlobin Date: Fri, 8 May 2020 06:23:10 +0500 Subject: [PATCH] Compositor detection --- src/x11/x.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/x11/x.c b/src/x11/x.c index 672b6e2..468b18d 100644 --- a/src/x11/x.c +++ b/src/x11/x.c @@ -135,6 +135,8 @@ static void x_win_round_corners(struct window_x11 *win, const int rad) void x_display_surface(cairo_surface_t *srf, struct window_x11 *win, const struct dimensions *dim) { + char astr[sizeof("_NET_WM_CM_S") / sizeof(char) + 8]; + x_win_move(win, dim->x, dim->y, dim->w, dim->h); cairo_xlib_surface_set_size(win->root_surface, dim->w, dim->h); @@ -145,8 +147,21 @@ void x_display_surface(cairo_surface_t *srf, struct window_x11 *win, const struc cairo_paint(win->c_ctx); cairo_show_page(win->c_ctx); - if (settings.corner_radius != 0) + sprintf (astr, "_NET_WM_CM_S%i", win->cur_screen); + Atom cm_sel = XInternAtom (xctx.dpy, astr, true); + if (settings.corner_radius != 0 && XGetSelectionOwner(xctx.dpy, cm_sel) == None) x_win_round_corners(win, dim->corner_radius); + else + { + XRectangle rect = { + .x = 0, + .y = 0, + .width = dim->w, + .height = dim->h }; + XShapeCombineRectangles(xctx.dpy, win->xwin, ShapeBounding, 0, 0, &rect, 1, ShapeSet, 1); + XShapeSelectInput(xctx.dpy, + win->xwin, ShapeNotifyMask); + } XFlush(xctx.dpy);