cvsimport
* refs/heads/master: (23 commits) Check the atom type on propertynotify before iterating. use screen_find() for xrandr crtc changes Find the managed screen from the parent window for client_current(). Print window id in hex; while here, remove unnecessary newline. Similar to keypress event, fetch the screen from the event root window in the buttonpress handler; bail if we don't manage the screen. Allows us to find the current client based on the screen/event root. extend verbose logging for key/button events [keypress event] turns out we've been checking the wrong window for a matching client thus always falling back to client_current(); while the current client is problaby right in most cases, use event's subwindow (not window) to find the client. Bail early if this event came to us from a screen we don't manage. This is result of us grabing all keybindings off the root window instead of selectively. add parans for readibility Teach client_current() to use a screen to find the current client instead of iterating over all (fallback if no screen provided for now). Initially convert trivial uses of client_current(). check cc->gc directly zip extra lines gc clientq inside groups, instead use the better maintained one per-screen shuffle deck chairs: rename group actions to match intent for clarity same thing as screen_find() Separate out the menu window from the client resize/move geom window; in each case, create and destroy on-demand. Isolate more menu specific code. fix a few misplaced (and misnamed) ewmh root window functions _NET_WORKAREA needs ngroups, so screen_update_geometry() needs to come after conf_group(). simplify xftcolor config Tie group number and name together during config. Move the group index (desktop number) check to the only 2 callers that require checking due to ewmh. ...
This commit is contained in:
59
client.c
59
client.c
@@ -128,7 +128,7 @@ client_init(Window win, struct screen_ctx *sc, int active)
|
||||
if (client_get_wm_state(cc) == IconicState)
|
||||
client_hide(cc);
|
||||
else
|
||||
client_unhide(cc);
|
||||
client_show(cc);
|
||||
|
||||
if (mapped) {
|
||||
if (cc->gc) {
|
||||
@@ -183,9 +183,6 @@ client_remove(struct client_ctx *cc)
|
||||
if (cc->flags & CLIENT_ACTIVE)
|
||||
xu_ewmh_net_active_window(sc, None);
|
||||
|
||||
if (cc->gc != NULL)
|
||||
TAILQ_REMOVE(&cc->gc->clientq, cc, group_entry);
|
||||
|
||||
while ((wn = TAILQ_FIRST(&cc->nameq)) != NULL) {
|
||||
TAILQ_REMOVE(&cc->nameq, wn, entry);
|
||||
free(wn->name);
|
||||
@@ -221,7 +218,7 @@ client_setactive(struct client_ctx *cc)
|
||||
if (cc->flags & CLIENT_WM_TAKE_FOCUS)
|
||||
client_msg(cc, cwmh[WM_TAKE_FOCUS], Last_Event_Time);
|
||||
|
||||
if ((oldcc = client_current()) != NULL) {
|
||||
if ((oldcc = client_current(sc)) != NULL) {
|
||||
oldcc->flags &= ~CLIENT_ACTIVE;
|
||||
client_draw_border(oldcc);
|
||||
}
|
||||
@@ -238,16 +235,23 @@ client_setactive(struct client_ctx *cc)
|
||||
}
|
||||
|
||||
struct client_ctx *
|
||||
client_current(void)
|
||||
client_current(struct screen_ctx *sc)
|
||||
{
|
||||
struct screen_ctx *sc;
|
||||
struct screen_ctx *_sc;
|
||||
struct client_ctx *cc;
|
||||
|
||||
TAILQ_FOREACH(sc, &Screenq, entry) {
|
||||
if (sc) {
|
||||
TAILQ_FOREACH(cc, &sc->clientq, entry) {
|
||||
if (cc->flags & CLIENT_ACTIVE)
|
||||
return(cc);
|
||||
}
|
||||
} else {
|
||||
TAILQ_FOREACH(_sc, &Screenq, entry) {
|
||||
TAILQ_FOREACH(cc, &_sc->clientq, entry) {
|
||||
if (cc->flags & CLIENT_ACTIVE)
|
||||
return(cc);
|
||||
}
|
||||
}
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
@@ -527,25 +531,16 @@ client_hide(struct client_ctx *cc)
|
||||
{
|
||||
XUnmapWindow(X_Dpy, cc->win);
|
||||
|
||||
if (cc->flags & CLIENT_ACTIVE)
|
||||
if (cc->flags & CLIENT_ACTIVE) {
|
||||
cc->flags &= ~CLIENT_ACTIVE;
|
||||
xu_ewmh_net_active_window(cc->sc, None);
|
||||
|
||||
cc->flags &= ~CLIENT_ACTIVE;
|
||||
}
|
||||
cc->flags |= CLIENT_HIDDEN;
|
||||
client_set_wm_state(cc, IconicState);
|
||||
}
|
||||
|
||||
void
|
||||
client_show(struct client_ctx *cc)
|
||||
{
|
||||
if (cc->flags & CLIENT_HIDDEN)
|
||||
client_unhide(cc);
|
||||
else
|
||||
client_raise(cc);
|
||||
}
|
||||
|
||||
void
|
||||
client_unhide(struct client_ctx *cc)
|
||||
{
|
||||
XMapRaised(X_Dpy, cc->win);
|
||||
|
||||
@@ -691,7 +686,7 @@ client_cycle(struct screen_ctx *sc, int flags)
|
||||
return;
|
||||
|
||||
prevcc = TAILQ_FIRST(&sc->clientq);
|
||||
oldcc = client_current();
|
||||
oldcc = client_current(sc);
|
||||
if (oldcc == NULL)
|
||||
oldcc = (flags & CWM_CYCLE_REVERSE) ?
|
||||
TAILQ_LAST(&sc->clientq, client_q) :
|
||||
@@ -972,12 +967,11 @@ void
|
||||
client_htile(struct client_ctx *cc)
|
||||
{
|
||||
struct client_ctx *ci;
|
||||
struct group_ctx *gc = cc->gc;
|
||||
struct screen_ctx *sc = cc->sc;
|
||||
struct geom area;
|
||||
int i, n, mh, x, w, h;
|
||||
|
||||
if (!gc)
|
||||
if (!cc->gc)
|
||||
return;
|
||||
i = n = 0;
|
||||
|
||||
@@ -985,7 +979,9 @@ client_htile(struct client_ctx *cc)
|
||||
cc->geom.x + cc->geom.w / 2,
|
||||
cc->geom.y + cc->geom.h / 2, CWM_GAP);
|
||||
|
||||
TAILQ_FOREACH(ci, &gc->clientq, group_entry) {
|
||||
TAILQ_FOREACH(ci, &sc->clientq, entry) {
|
||||
if (ci->gc != cc->gc)
|
||||
continue;
|
||||
if (ci->flags & CLIENT_HIDDEN ||
|
||||
ci->flags & CLIENT_IGNORE || (ci == cc) ||
|
||||
ci->geom.x < area.x ||
|
||||
@@ -1014,7 +1010,9 @@ client_htile(struct client_ctx *cc)
|
||||
x = area.x;
|
||||
w = area.w / n;
|
||||
h = area.h - mh;
|
||||
TAILQ_FOREACH(ci, &gc->clientq, group_entry) {
|
||||
TAILQ_FOREACH(ci, &sc->clientq, entry) {
|
||||
if (ci->gc != cc->gc)
|
||||
continue;
|
||||
if (ci->flags & CLIENT_HIDDEN ||
|
||||
ci->flags & CLIENT_IGNORE || (ci == cc) ||
|
||||
ci->geom.x < area.x ||
|
||||
@@ -1040,12 +1038,11 @@ void
|
||||
client_vtile(struct client_ctx *cc)
|
||||
{
|
||||
struct client_ctx *ci;
|
||||
struct group_ctx *gc = cc->gc;
|
||||
struct screen_ctx *sc = cc->sc;
|
||||
struct geom area;
|
||||
int i, n, mw, y, w, h;
|
||||
|
||||
if (!gc)
|
||||
if (!cc->gc)
|
||||
return;
|
||||
i = n = 0;
|
||||
|
||||
@@ -1053,7 +1050,9 @@ client_vtile(struct client_ctx *cc)
|
||||
cc->geom.x + cc->geom.w / 2,
|
||||
cc->geom.y + cc->geom.h / 2, CWM_GAP);
|
||||
|
||||
TAILQ_FOREACH(ci, &gc->clientq, group_entry) {
|
||||
TAILQ_FOREACH(ci, &sc->clientq, entry) {
|
||||
if (ci->gc != cc->gc)
|
||||
continue;
|
||||
if (ci->flags & CLIENT_HIDDEN ||
|
||||
ci->flags & CLIENT_IGNORE || (ci == cc) ||
|
||||
ci->geom.x < area.x ||
|
||||
@@ -1082,7 +1081,9 @@ client_vtile(struct client_ctx *cc)
|
||||
y = area.y;
|
||||
h = area.h / n;
|
||||
w = area.w - mw;
|
||||
TAILQ_FOREACH(ci, &gc->clientq, group_entry) {
|
||||
TAILQ_FOREACH(ci, &sc->clientq, entry) {
|
||||
if (ci->gc != cc->gc)
|
||||
continue;
|
||||
if (ci->flags & CLIENT_HIDDEN ||
|
||||
ci->flags & CLIENT_IGNORE || (ci == cc) ||
|
||||
ci->geom.x < area.x ||
|
||||
|
||||
Reference in New Issue
Block a user