mirror of
https://github.com/0intro/wmii
synced 2024-12-24 04:16:50 +03:00
fixed M-S-a (visual attach detached clients) page
This commit is contained in:
parent
c08ce4cb20
commit
7fdbcc92d1
@ -327,7 +327,7 @@ clientat(Client * clients, size_t idx)
|
||||
{
|
||||
size_t i = 0;
|
||||
Client *c = clients;
|
||||
for(; c && i != idx; c = c->next)
|
||||
for(; (i != idx) && c; c = c->next)
|
||||
i++;
|
||||
return c;
|
||||
}
|
||||
@ -356,4 +356,5 @@ attach_detached(Client * c)
|
||||
if(detached)
|
||||
detached->prev = c;
|
||||
detached = c;
|
||||
ndetached++;
|
||||
}
|
||||
|
32
cmd/wm/wm.c
32
cmd/wm/wm.c
@ -29,7 +29,6 @@ static void _detach_client(void *obj, char *arg);
|
||||
static void _close_client(void *obj, char *arg);
|
||||
static void pager(void *obj, char *arg);
|
||||
static void detached_clients(void *obj, char *arg);
|
||||
static void reserve_layout(void *obj, char *arg);
|
||||
|
||||
/* action table for /ctl namespace */
|
||||
Action wm_acttbl[] = {
|
||||
@ -41,8 +40,7 @@ Action wm_acttbl[] = {
|
||||
{"close", _close_client},
|
||||
{"quit", quit},
|
||||
{"pager", pager},
|
||||
{"detached_clients", detached_clients},
|
||||
{"reserve_layout", reserve_layout},
|
||||
{"detclients", detached_clients},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
@ -301,23 +299,19 @@ pager(void *obj, char *arg)
|
||||
}
|
||||
|
||||
static void
|
||||
draw_detached_clients()
|
||||
map_detached_clients()
|
||||
{
|
||||
unsigned int ic, ir, tw, th, rows, cols;
|
||||
int dx, dy;
|
||||
Client *c = detached;
|
||||
XRectangle cr;
|
||||
|
||||
if(!c)
|
||||
return;
|
||||
blitz_getbasegeometry(ndetached, &cols, &rows);
|
||||
dx = (cols - 1) * GAP; /* GAPpx space */
|
||||
dy = (rows - 1) * GAP; /* GAPpx space */
|
||||
tw = (rect.width - dx) / cols;
|
||||
th = (rect.height - dy) / rows;
|
||||
|
||||
XClearWindow(dpy, transient);
|
||||
XMapRaised(dpy, transient);
|
||||
for(ir = 0; ir < rows; ir++) {
|
||||
for(ic = 0; ic < cols; ic++) {
|
||||
if(!c)
|
||||
@ -326,10 +320,10 @@ draw_detached_clients()
|
||||
cr.y = ir * th + (ir * GAP);
|
||||
cr.width = tw;
|
||||
cr.height = th;
|
||||
XMoveResizeWindow(dpy, c->win, cr.x, cr.y, cr.width,
|
||||
cr.height);
|
||||
XMoveResizeWindow(dpy, c->win, cr.x, cr.y, cr.width, cr.height);
|
||||
configure_client(c);
|
||||
map_client(c);
|
||||
grab_client(c, AnyModifier, Button1);
|
||||
XRaiseWindow(dpy, c->win);
|
||||
XSync(dpy, False);
|
||||
c = c->next;
|
||||
@ -337,25 +331,18 @@ draw_detached_clients()
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
reserve_layout(void *obj, char *arg)
|
||||
{
|
||||
if(arg && strrchr(arg, ' ')) {
|
||||
XRectangle r;
|
||||
blitz_strtorect(&rect, &r, arg);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
detached_clients(void *obj, char *arg)
|
||||
{
|
||||
XEvent ev;
|
||||
int n;
|
||||
Client *c;
|
||||
Client *c = detached;
|
||||
|
||||
if(!c)
|
||||
return;
|
||||
XClearWindow(dpy, transient);
|
||||
XMapRaised(dpy, transient);
|
||||
draw_detached_clients();
|
||||
map_detached_clients();
|
||||
while(XGrabKeyboard
|
||||
(dpy, transient, True, GrabModeAsync, GrabModeAsync,
|
||||
CurrentTime) != GrabSuccess)
|
||||
@ -372,8 +359,7 @@ detached_clients(void *obj, char *arg)
|
||||
for(c = detached; c; c = c->next)
|
||||
unmap_client(c);
|
||||
if((n = handle_kpress(&ev.xkey)) != -1) {
|
||||
if(n - 1 < ndetached) {
|
||||
c = clientat(detached, n);
|
||||
if((c = clientat(detached, n))) {
|
||||
detach_detached(c);
|
||||
attach_client(c);
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ kbind normal $MODKEY-C-w,y wmiirc
|
||||
kbind normal $MODKEY-t 'extern xterm ''+sb'' -bg ''#000000'' -fg ''#ffffff'' -cr ''#ffffff'' -sl 4000'
|
||||
kbind normal $MODKEY-d 'wmiir write /wm/ctl detach'
|
||||
kbind normal $MODKEY-a 'wmiir write /wm/ctl attach'
|
||||
kbind normal $MODKEY-S-a 'wmiir write /wm/ctl detached_clients'
|
||||
kbind normal $MODKEY-S-a 'wmiir write /wm/ctl detclients'
|
||||
kbind normal $MODKEY-S-c 'wmiir write /wm/sel/layout/managed/name column'
|
||||
kbind normal $MODKEY-n 'wmiir write /wm/sel/layout/sel/ctl new'
|
||||
kbind normal $MODKEY-S-f 'wmiir write /wm/sel/layout/sel/name float'
|
||||
|
Loading…
Reference in New Issue
Block a user