mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
When removing xrandr regions, ensure clients are within the bounds of
the screen; adapted from an ancient diff from Sviatoslav Chagaev. Things in this area will likely change, but put this in so it works now and serves as a reminder.
This commit is contained in:
parent
5c13775d31
commit
a37606c63f
1
calmwm.h
1
calmwm.h
@ -455,6 +455,7 @@ struct geom screen_area(struct screen_ctx *, int, int, int);
|
||||
void screen_init(int);
|
||||
void screen_update_geometry(struct screen_ctx *);
|
||||
void screen_updatestackingorder(struct screen_ctx *);
|
||||
void screen_assert_clients_within(struct screen_ctx *);
|
||||
|
||||
void kbfunc_client_cycle(struct client_ctx *, union arg *);
|
||||
void kbfunc_client_delete(struct client_ctx *, union arg *);
|
||||
|
23
screen.c
23
screen.c
@ -229,3 +229,26 @@ screen_apply_gap(struct screen_ctx *sc, struct geom geom)
|
||||
|
||||
return(geom);
|
||||
}
|
||||
|
||||
/* Bring back clients which are beyond the screen. */
|
||||
void
|
||||
screen_assert_clients_within(struct screen_ctx *sc)
|
||||
{
|
||||
struct client_ctx *cc;
|
||||
int top, left, right, bottom;
|
||||
|
||||
TAILQ_FOREACH(cc, &sc->clientq, entry) {
|
||||
if (cc->sc != sc)
|
||||
continue;
|
||||
top = cc->geom.y;
|
||||
left = cc->geom.x;
|
||||
right = cc->geom.x + cc->geom.w + (cc->bwidth * 2) - 1;
|
||||
bottom = cc->geom.y + cc->geom.h + (cc->bwidth * 2) - 1;
|
||||
if ((top > sc->view.h || left > sc->view.w) ||
|
||||
(bottom < 0 || right < 0)) {
|
||||
cc->geom.x = sc->gap.left;
|
||||
cc->geom.y = sc->gap.top;
|
||||
client_move(cc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user