Fixed clickthrough issue on Openbox and XFCE, closes #61

This commit is contained in:
Jarcode
2018-09-17 19:23:06 -07:00
parent bc955a5b3d
commit 3be916f157

View File

@@ -174,7 +174,7 @@ struct glxwin {
Window w;
GLXContext context;
double time;
bool should_close;
bool should_close, clickthrough;
};
static Atom ATOM__MOTIF_WM_HINTS, ATOM_WM_DELETE_WINDOW, ATOM_WM_PROTOCOLS, ATOM__NET_ACTIVE_WINDOW;
@@ -250,6 +250,19 @@ static void apply_decorations(Window w) {
}
}
static void apply_clickthrough(struct glxwin* w) {
if (w->clickthrough) {
int ignored;
if (XShapeQueryExtension(display, &ignored, &ignored)) {
Region region;
if ((region = XCreateRegion())) {
XShapeCombineRegion(display, w->w, ShapeInput, 0, 0, region, ShapeSet);
XDestroyRegion(region);
}
}
}
}
static void* create_and_bind(const char* name, const char* class,
const char* type, const char** states,
size_t states_sz,
@@ -260,6 +273,7 @@ static void* create_and_bind(const char* name, const char* class,
struct glxwin* w = malloc(sizeof(struct glxwin));
w->time = 0.0D;
w->should_close = false;
w->clickthrough = false;
XVisualInfo* vi;
XSetWindowAttributes attr;
@@ -360,16 +374,8 @@ static void* create_and_bind(const char* name, const char* class,
XSetWMProtocols(display, w->w, &ATOM_WM_DELETE_WINDOW, 1);
/* Eliminate the window's effective region */
if (desktop || clickthrough) {
int ignored;
if (XShapeQueryExtension(display, &ignored, &ignored)) {
Region region;
if ((region = XCreateRegion())) {
XShapeCombineRegion(display, w->w, ShapeInput, 0, 0, region, ShapeSet);
XDestroyRegion(region);
}
}
}
w->clickthrough = desktop || clickthrough;
apply_clickthrough(w);
glXCreateContextAttribsARBProc glXCreateContextAttribsARB = NULL;
glXSwapIntervalEXTProc glXSwapIntervalEXT = NULL;
@@ -437,7 +443,10 @@ static void set_geometry(struct glxwin* w, int x, int y, int d, int h) {
}
static void set_visible(struct glxwin* w, bool visible) {
if (visible) XMapWindow(display, w->w);
if (visible) {
XMapWindow(display, w->w);
apply_clickthrough(w);
}
else XUnmapWindow(display, w->w);
}