commit 7fdbcc92d186bfbf4b5aa5688b5761f5634e1624
parent c08ce4cb2049676fdfbee4d8781881d565fcf7ab
Author: Anselm R. Garbe <garbeam@wmii.de>
Date: Wed, 18 Jan 2006 20:34:10 +0200
fixed M-S-a (visual attach detached clients) page
Diffstat:
3 files changed, 12 insertions(+), 25 deletions(-)
diff --git a/cmd/wm/client.c b/cmd/wm/client.c
@@ -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++;
}
diff --git a/cmd/wm/wm.c b/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;
@@ -338,24 +332,17 @@ 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);
}
diff --git a/rc/wmiirc b/rc/wmiirc
@@ -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'