-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathshape.c
More file actions
36 lines (36 loc) · 1.11 KB
/
Copy pathshape.c
File metadata and controls
36 lines (36 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// jbwm - Minimalist Window Manager for X
// Copyright 2008-2020, Alisa Bedard <alisabedard@gmail.com>
// Copyright 1999-2015, Ciaran Anscomb <evilwm@6809.org.uk>
// See README for license and other details.
#include "shape.h"
#include <X11/extensions/shape.h>
#include "JBWMClient.h"
#include "log.h"
// Declared with pure attribute, as value may not change between calls.
__attribute__((pure))
static bool is_shaped(Display * dpy, const Window win)
{
int s, d;
unsigned int u;
return XShapeQueryExtents(dpy, win, &s, &d, &d,
&u, &u, &d, &d, &d, &u, &u) && s;
}
void jbwm_set_shape(struct JBWMClient * c)
{
if(c->opt.shaped) {
JBWM_LOG("XShapeCombineShape: %d", (int)c->window);
Display * d = c->screen->xlib->display;
XFlush(d);
XShapeCombineShape(d, c->parent, ShapeBounding,
1, 1, c->window, ShapeBounding, ShapeSet);
}
}
void jbwm_new_shaped_client(struct JBWMClient * c)
{
if (is_shaped(c->screen->xlib->display, c->window)) {
JBWM_LOG("Window %d is shaped", (int)c->window);
struct JBWMClientOptions * o = &c->opt;
o->no_title_bar = o->shaped = true;
o->border = 0;
}
}