mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
Allow 'transientfor' clients to inherit group and bwidth either during init or
via property notify events. Previously only the flags were set but nothing was in the path to apply said flags and/or bwidth. Required slight of re-orgnaization of client_init.
This commit is contained in:
parent
268deed916
commit
194589eb6b
37
client.c
37
client.c
@ -62,10 +62,9 @@ client_init(Window win, struct screen_ctx *sc, int active)
|
|||||||
mapped = wattr.map_state != IsUnmapped;
|
mapped = wattr.map_state != IsUnmapped;
|
||||||
}
|
}
|
||||||
|
|
||||||
cc = xmalloc(sizeof(*cc));
|
|
||||||
|
|
||||||
XGrabServer(X_Dpy);
|
XGrabServer(X_Dpy);
|
||||||
|
|
||||||
|
cc = xmalloc(sizeof(*cc));
|
||||||
cc->sc = sc;
|
cc->sc = sc;
|
||||||
cc->win = win;
|
cc->win = win;
|
||||||
cc->label = NULL;
|
cc->label = NULL;
|
||||||
@ -74,30 +73,33 @@ client_init(Window win, struct screen_ctx *sc, int active)
|
|||||||
cc->stackingorder = 0;
|
cc->stackingorder = 0;
|
||||||
memset(&cc->hint, 0, sizeof(cc->hint));
|
memset(&cc->hint, 0, sizeof(cc->hint));
|
||||||
memset(&cc->ch, 0, sizeof(cc->ch));
|
memset(&cc->ch, 0, sizeof(cc->ch));
|
||||||
|
|
||||||
TAILQ_INIT(&cc->nameq);
|
TAILQ_INIT(&cc->nameq);
|
||||||
client_setname(cc);
|
|
||||||
|
|
||||||
|
cc->geom.x = wattr.x;
|
||||||
|
cc->geom.y = wattr.y;
|
||||||
|
cc->geom.w = wattr.width;
|
||||||
|
cc->geom.h = wattr.height;
|
||||||
|
cc->colormap = wattr.colormap;
|
||||||
|
cc->obwidth = wattr.border_width;
|
||||||
|
cc->bwidth = Conf.bwidth;
|
||||||
|
|
||||||
|
client_setname(cc);
|
||||||
conf_client(cc);
|
conf_client(cc);
|
||||||
|
|
||||||
XGetClassHint(X_Dpy, cc->win, &cc->ch);
|
XGetClassHint(X_Dpy, cc->win, &cc->ch);
|
||||||
client_wm_hints(cc);
|
client_wm_hints(cc);
|
||||||
client_wm_protocols(cc);
|
client_wm_protocols(cc);
|
||||||
client_getsizehints(cc);
|
client_getsizehints(cc);
|
||||||
|
client_transient(cc);
|
||||||
client_mwm_hints(cc);
|
client_mwm_hints(cc);
|
||||||
|
|
||||||
cc->geom.x = wattr.x;
|
if ((cc->flags & CLIENT_IGNORE))
|
||||||
cc->geom.y = wattr.y;
|
cc->bwidth = 0;
|
||||||
cc->geom.w = wattr.width;
|
|
||||||
cc->geom.h = wattr.height;
|
|
||||||
cc->dim.w = (cc->geom.w - cc->hint.basew) / cc->hint.incw;
|
cc->dim.w = (cc->geom.w - cc->hint.basew) / cc->hint.incw;
|
||||||
cc->dim.h = (cc->geom.h - cc->hint.baseh) / cc->hint.inch;
|
cc->dim.h = (cc->geom.h - cc->hint.baseh) / cc->hint.inch;
|
||||||
cc->ptr.x = cc->geom.w / 2;
|
cc->ptr.x = cc->geom.w / 2;
|
||||||
cc->ptr.y = cc->geom.h / 2;
|
cc->ptr.y = cc->geom.h / 2;
|
||||||
|
|
||||||
cc->colormap = wattr.colormap;
|
|
||||||
cc->obwidth = wattr.border_width;
|
|
||||||
|
|
||||||
if (wattr.map_state != IsViewable) {
|
if (wattr.map_state != IsViewable) {
|
||||||
client_placecalc(cc);
|
client_placecalc(cc);
|
||||||
client_resize(cc, 0);
|
client_resize(cc, 0);
|
||||||
@ -114,8 +116,6 @@ client_init(Window win, struct screen_ctx *sc, int active)
|
|||||||
|
|
||||||
XAddToSaveSet(X_Dpy, cc->win);
|
XAddToSaveSet(X_Dpy, cc->win);
|
||||||
|
|
||||||
client_transient(cc);
|
|
||||||
|
|
||||||
/* Notify client of its configuration. */
|
/* Notify client of its configuration. */
|
||||||
client_config(cc);
|
client_config(cc);
|
||||||
|
|
||||||
@ -131,6 +131,10 @@ client_init(Window win, struct screen_ctx *sc, int active)
|
|||||||
client_unhide(cc);
|
client_unhide(cc);
|
||||||
|
|
||||||
if (mapped) {
|
if (mapped) {
|
||||||
|
if (cc->gc) {
|
||||||
|
group_movetogroup(cc, cc->gc->num);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
if (group_restore(cc))
|
if (group_restore(cc))
|
||||||
goto out;
|
goto out;
|
||||||
if (group_autogroup(cc))
|
if (group_autogroup(cc))
|
||||||
@ -926,10 +930,11 @@ client_transient(struct client_ctx *cc)
|
|||||||
Window trans;
|
Window trans;
|
||||||
|
|
||||||
if (XGetTransientForHint(X_Dpy, cc->win, &trans)) {
|
if (XGetTransientForHint(X_Dpy, cc->win, &trans)) {
|
||||||
if ((tc = client_find(trans)) != NULL && tc->gc) {
|
if ((tc = client_find(trans)) != NULL) {
|
||||||
group_movetogroup(cc, tc->gc->num);
|
if (tc->flags & CLIENT_IGNORE) {
|
||||||
if (tc->flags & CLIENT_IGNORE)
|
|
||||||
cc->flags |= CLIENT_IGNORE;
|
cc->flags |= CLIENT_IGNORE;
|
||||||
|
cc->bwidth = tc->bwidth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
5
conf.c
5
conf.c
@ -434,16 +434,13 @@ void
|
|||||||
conf_client(struct client_ctx *cc)
|
conf_client(struct client_ctx *cc)
|
||||||
{
|
{
|
||||||
struct winname *wn;
|
struct winname *wn;
|
||||||
int ignore = 0;
|
|
||||||
|
|
||||||
TAILQ_FOREACH(wn, &Conf.ignoreq, entry) {
|
TAILQ_FOREACH(wn, &Conf.ignoreq, entry) {
|
||||||
if (strncasecmp(wn->name, cc->name, strlen(wn->name)) == 0) {
|
if (strncasecmp(wn->name, cc->name, strlen(wn->name)) == 0) {
|
||||||
ignore = 1;
|
cc->flags |= CLIENT_IGNORE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cc->bwidth = (ignore) ? 0 : Conf.bwidth;
|
|
||||||
cc->flags |= (ignore) ? CLIENT_IGNORE : 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -198,6 +198,9 @@ xev_handle_propertynotify(XEvent *ee)
|
|||||||
break;
|
break;
|
||||||
case XA_WM_TRANSIENT_FOR:
|
case XA_WM_TRANSIENT_FOR:
|
||||||
client_transient(cc);
|
client_transient(cc);
|
||||||
|
client_draw_border(cc);
|
||||||
|
if (cc->gc)
|
||||||
|
group_movetogroup(cc, cc->gc->num);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* do nothing */
|
/* do nothing */
|
||||||
|
Loading…
Reference in New Issue
Block a user