22
glx_wcb.c
22
glx_wcb.c
@@ -175,6 +175,7 @@ struct glxwin {
|
|||||||
GLXContext context;
|
GLXContext context;
|
||||||
double time;
|
double time;
|
||||||
bool should_close, clickthrough;
|
bool should_close, clickthrough;
|
||||||
|
char override_state;
|
||||||
};
|
};
|
||||||
|
|
||||||
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;
|
||||||
@@ -271,12 +272,13 @@ static void* create_and_bind(const char* name, const char* class,
|
|||||||
int version_major, int version_minor,
|
int version_major, int version_minor,
|
||||||
bool clickthrough) {
|
bool clickthrough) {
|
||||||
struct glxwin* w = malloc(sizeof(struct glxwin));
|
struct glxwin* w = malloc(sizeof(struct glxwin));
|
||||||
|
w->override_state = '\0';
|
||||||
w->time = 0.0D;
|
w->time = 0.0D;
|
||||||
w->should_close = false;
|
w->should_close = false;
|
||||||
w->clickthrough = false;
|
w->clickthrough = false;
|
||||||
|
|
||||||
XVisualInfo* vi;
|
XVisualInfo* vi;
|
||||||
XSetWindowAttributes attr;
|
XSetWindowAttributes attr = {};
|
||||||
GLXFBConfig* fbc;
|
GLXFBConfig* fbc;
|
||||||
int fb_sz, best = -1, samp = -1;
|
int fb_sz, best = -1, samp = -1;
|
||||||
|
|
||||||
@@ -340,11 +342,17 @@ static void* create_and_bind(const char* name, const char* class,
|
|||||||
attr.background_pixmap = None;
|
attr.background_pixmap = None;
|
||||||
attr.border_pixel = 0;
|
attr.border_pixel = 0;
|
||||||
|
|
||||||
|
unsigned long vmask = CWColormap | CWEventMask | CWBackPixmap | CWBorderPixel;
|
||||||
|
if (type[0] == '!') {
|
||||||
|
vmask |= CWOverrideRedirect;
|
||||||
|
attr.override_redirect = true;
|
||||||
|
w->override_state = type[1];
|
||||||
|
}
|
||||||
|
|
||||||
if (!(w->w = XCreateWindow(display, DefaultRootWindow(display)/**xwin_get_desktop_layer(&wcb_glx)*/,
|
if (!(w->w = XCreateWindow(display, DefaultRootWindow(display)/**xwin_get_desktop_layer(&wcb_glx)*/,
|
||||||
x, y, d, h, 0,
|
x, y, d, h, 0,
|
||||||
vi->depth, InputOutput, vi->visual,
|
vi->depth, InputOutput, vi->visual,
|
||||||
CWColormap | CWEventMask | CWBackPixmap | CWBorderPixel,
|
vmask, &attr))) {
|
||||||
&attr))) {
|
|
||||||
fprintf(stderr, "XCreateWindow(): failed\n");
|
fprintf(stderr, "XCreateWindow(): failed\n");
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
@@ -409,6 +417,7 @@ static void* create_and_bind(const char* name, const char* class,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void raise(struct glxwin* w) {
|
static void raise(struct glxwin* w) {
|
||||||
|
if (w->override_state == '\0') {
|
||||||
XClientMessageEvent ev = {
|
XClientMessageEvent ev = {
|
||||||
.type = ClientMessage,
|
.type = ClientMessage,
|
||||||
.serial = 0,
|
.serial = 0,
|
||||||
@@ -426,6 +435,7 @@ static void raise(struct glxwin* w) {
|
|||||||
};
|
};
|
||||||
/* Send the client message as defined by EWMH standards (usually works) */
|
/* Send the client message as defined by EWMH standards (usually works) */
|
||||||
XSendEvent(display, DefaultRootWindow(display), false, StructureNotifyMask, (XEvent*) &ev);
|
XSendEvent(display, DefaultRootWindow(display), false, StructureNotifyMask, (XEvent*) &ev);
|
||||||
|
}
|
||||||
/* Raise the client in the X11 stacking order (sometimes works, can be blocked by the WM) */
|
/* Raise the client in the X11 stacking order (sometimes works, can be blocked by the WM) */
|
||||||
XRaiseWindow(display, w->w);
|
XRaiseWindow(display, w->w);
|
||||||
XFlush(display);
|
XFlush(display);
|
||||||
@@ -446,6 +456,12 @@ static void set_visible(struct glxwin* w, bool visible) {
|
|||||||
if (visible) {
|
if (visible) {
|
||||||
XMapWindow(display, w->w);
|
XMapWindow(display, w->w);
|
||||||
apply_clickthrough(w);
|
apply_clickthrough(w);
|
||||||
|
switch (w->override_state) {
|
||||||
|
case '+': XRaiseWindow(display, w->w); break;
|
||||||
|
case '-': XLowerWindow(display, w->w); break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
XFlush(display);
|
||||||
}
|
}
|
||||||
else XUnmapWindow(display, w->w);
|
else XUnmapWindow(display, w->w);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,13 @@
|
|||||||
|
|
||||||
This will set _NET_WM_WINDOW_TYPE to _NET_WM_WINDOW_TYPE_(TYPE),
|
This will set _NET_WM_WINDOW_TYPE to _NET_WM_WINDOW_TYPE_(TYPE),
|
||||||
where (TYPE) is the one of the window types listed (after being
|
where (TYPE) is the one of the window types listed (after being
|
||||||
converted to uppercase). */
|
converted to uppercase).
|
||||||
|
|
||||||
|
Alternatively, you can set this value to "!", which will cause
|
||||||
|
the window to be unmanaged. If this is set, then `addxwinstate`
|
||||||
|
will do nothing, but you can use "!+" and "!-" to stack on top
|
||||||
|
or below other windows.
|
||||||
|
*/
|
||||||
#request setxwintype "normal"
|
#request setxwintype "normal"
|
||||||
|
|
||||||
/* (X11 only) EWMH Window state atoms (multiple can be specified).
|
/* (X11 only) EWMH Window state atoms (multiple can be specified).
|
||||||
|
|||||||
2
xwin.c
2
xwin.c
@@ -221,8 +221,10 @@ static void xwin_changeatom(struct gl_wcb* wcb, void* impl, const char* type,
|
|||||||
-> "desktop", "dock", "toolbar", "menu", "utility", "splash", "dialog", "normal" */
|
-> "desktop", "dock", "toolbar", "menu", "utility", "splash", "dialog", "normal" */
|
||||||
bool xwin_settype(struct gl_wcb* wcb, void* impl, const char* rtype) {
|
bool xwin_settype(struct gl_wcb* wcb, void* impl, const char* rtype) {
|
||||||
S_UPPER(rtype, type);
|
S_UPPER(rtype, type);
|
||||||
|
if (type[0] != '!') {
|
||||||
xwin_changeatom(wcb, impl, type, "_NET_WM_WINDOW_TYPE",
|
xwin_changeatom(wcb, impl, type, "_NET_WM_WINDOW_TYPE",
|
||||||
"_NET_WM_WINDOW_TYPE_%s", PropModeReplace);
|
"_NET_WM_WINDOW_TYPE_%s", PropModeReplace);
|
||||||
|
}
|
||||||
return !strcmp(type, "DESKTOP");
|
return !strcmp(type, "DESKTOP");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user