Fixed clickthrough issue on Openbox and XFCE, closes #61
This commit is contained in:
41
glx_wcb.c
41
glx_wcb.c
@@ -174,7 +174,7 @@ struct glxwin {
|
|||||||
Window w;
|
Window w;
|
||||||
GLXContext context;
|
GLXContext context;
|
||||||
double time;
|
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;
|
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,
|
static void* create_and_bind(const char* name, const char* class,
|
||||||
const char* type, const char** states,
|
const char* type, const char** states,
|
||||||
size_t states_sz,
|
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));
|
struct glxwin* w = malloc(sizeof(struct glxwin));
|
||||||
w->time = 0.0D;
|
w->time = 0.0D;
|
||||||
w->should_close = false;
|
w->should_close = false;
|
||||||
|
w->clickthrough = false;
|
||||||
|
|
||||||
XVisualInfo* vi;
|
XVisualInfo* vi;
|
||||||
XSetWindowAttributes attr;
|
XSetWindowAttributes attr;
|
||||||
@@ -360,34 +374,26 @@ static void* create_and_bind(const char* name, const char* class,
|
|||||||
XSetWMProtocols(display, w->w, &ATOM_WM_DELETE_WINDOW, 1);
|
XSetWMProtocols(display, w->w, &ATOM_WM_DELETE_WINDOW, 1);
|
||||||
|
|
||||||
/* Eliminate the window's effective region */
|
/* Eliminate the window's effective region */
|
||||||
if (desktop || clickthrough) {
|
w->clickthrough = desktop || clickthrough;
|
||||||
int ignored;
|
apply_clickthrough(w);
|
||||||
if (XShapeQueryExtension(display, &ignored, &ignored)) {
|
|
||||||
Region region;
|
|
||||||
if ((region = XCreateRegion())) {
|
|
||||||
XShapeCombineRegion(display, w->w, ShapeInput, 0, 0, region, ShapeSet);
|
|
||||||
XDestroyRegion(region);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
glXCreateContextAttribsARBProc glXCreateContextAttribsARB = NULL;
|
glXCreateContextAttribsARBProc glXCreateContextAttribsARB = NULL;
|
||||||
glXSwapIntervalEXTProc glXSwapIntervalEXT = NULL;
|
glXSwapIntervalEXTProc glXSwapIntervalEXT = NULL;
|
||||||
glXCreateContextAttribsARB = (glXCreateContextAttribsARBProc)
|
glXCreateContextAttribsARB = (glXCreateContextAttribsARBProc)
|
||||||
glXGetProcAddressARB((const GLubyte*) "glXCreateContextAttribsARB");
|
glXGetProcAddressARB((const GLubyte*) "glXCreateContextAttribsARB");
|
||||||
glXSwapIntervalEXT = (glXSwapIntervalEXTProc)
|
glXSwapIntervalEXT = (glXSwapIntervalEXTProc)
|
||||||
glXGetProcAddressARB((const GLubyte*) "glXSwapIntervalEXT");
|
glXGetProcAddressARB((const GLubyte*) "glXSwapIntervalEXT");
|
||||||
|
|
||||||
if (!glXCreateContextAttribsARB) {
|
if (!glXCreateContextAttribsARB) {
|
||||||
fprintf(stderr, "glXGetProcAddressARB(\"glXCreateContextAttribsARB\"): failed\n");
|
fprintf(stderr, "glXGetProcAddressARB(\"glXCreateContextAttribsARB\"): failed\n");
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(w->context = glXCreateContextAttribsARB(display, config, 0, True, context_attrs))) {
|
if (!(w->context = glXCreateContextAttribsARB(display, config, 0, True, context_attrs))) {
|
||||||
fprintf(stderr, "glXCreateContextAttribsARB(): failed\n");
|
fprintf(stderr, "glXCreateContextAttribsARB(): failed\n");
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
XSync(display, False);
|
XSync(display, False);
|
||||||
|
|
||||||
glXMakeCurrent(display, w->w, w->context);
|
glXMakeCurrent(display, w->w, w->context);
|
||||||
@@ -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) {
|
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);
|
else XUnmapWindow(display, w->w);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user