wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

commit a829af6746bab86423766688a4748707f83cd0b6
parent 8baa06eb3bad7037879cd66995431306d60b31f8
Author: Anselm R. Garbe <garbeam@wmii.de>
Date:   Wed,  8 Mar 2006 16:05:09 +0100

renamed sendtoarea into sendto, fixed both bugs reported by bogon, added classinstance stuff to Client struct (also initialized in alloc_client())


Diffstat:
Makefile | 2+-
cmd/wm/area.c | 4++--
cmd/wm/client.c | 12++++++++++--
cmd/wm/event.c | 4+++-
cmd/wm/fs.c | 8++++----
cmd/wm/wm.h | 6++++--
cmd/wm/wmii | 1+
cmd/wm/wmii.1 | 2--
rc/wmiirc | 10++++------
9 files changed, 29 insertions(+), 20 deletions(-)

diff --git a/Makefile b/Makefile @@ -17,7 +17,7 @@ all: @echo "LDFLAGS = ${LDFLAGS}" @echo "CC = ${CC}" @for i in ${SUBDIRS} cmd/wm; do \ - (cd $$i; make) \ + (cd $$i; make;) \ done dist: clean diff --git a/cmd/wm/area.c b/cmd/wm/area.c @@ -103,7 +103,7 @@ select_area(Area *a, char *arg) } void -send_toarea(Area *to, Area *from, Client *c) +send2area(Area *to, Area *from, Client *c) { detach_fromarea(from, c); attach_toarea(to, c); @@ -392,7 +392,7 @@ drop_moving(Frame *f, XRectangle *new, XPoint * pt) !blitz_ispointinrect(pt->x, pt->y, &t->area[i]->rect); i++); if((tgt = ((i < t->narea) ? t->area[i] : nil))) { if(tgt != src) { - send_toarea(tgt, src, f->client); + send2area(tgt, src, f->client); arrange_area(tgt); } else { diff --git a/cmd/wm/client.c b/cmd/wm/client.c @@ -16,6 +16,7 @@ alloc_client(Window w, XWindowAttributes *wa) XTextProperty name; Client *c = (Client *) cext_emallocz(sizeof(Client)); XSetWindowAttributes fwa; + XClassHint ch; long msize; static unsigned int id = 1; @@ -37,6 +38,10 @@ alloc_client(Window w, XWindowAttributes *wa) cext_strlcpy(c->name, (char *)name.value, sizeof(c->name)); free(name.value); } + if(XGetClassHint(dpy, c->win, &ch)) { + cext_strlcpy(c->class, ch.res_class, sizeof(c->class)); + cext_strlcpy(c->instance, ch.res_name, sizeof(c->instance)); + } fwa.override_redirect = 1; fwa.background_pixmap = ParentRelative; @@ -230,6 +235,9 @@ draw_client(Client *c) Draw d = { 0 }; char buf[512]; + if(!c->nframe) + return; /* might not have been attached atm */ + d.align = WEST; d.drawable = c->framewin; d.font = xfont; @@ -467,7 +475,7 @@ select_client(Client *c, char *arg) } void -sendtoarea_client(Client *c, char *arg) +send2area_client(Client *c, char *arg) { const char *errstr; Frame *f = c->frame[c->sel]; @@ -501,7 +509,7 @@ sendtoarea_client(Client *c, char *arg) return; to = t->area[i]; } - send_toarea(to, a, c); + send2area(to, a, c); } void diff --git a/cmd/wm/event.c b/cmd/wm/event.c @@ -181,6 +181,8 @@ handle_destroynotify(XEvent *e) { XDestroyWindowEvent *ev = &e->xdestroywindow; Client *c = win2client(ev->window); + if(!c) + return; if(c->frame) detach_client(c, False); destroy_client(c); @@ -194,7 +196,7 @@ handle_expose(XEvent *e) if(ev->count == 0) { if(ev->window == winbar) draw_bar(); - else if((c = win2clientframe(ev->window)) && c->nframe) + else if((c = win2clientframe(ev->window))) draw_client(c); } } diff --git a/cmd/wm/fs.c b/cmd/wm/fs.c @@ -1180,14 +1180,14 @@ xwrite(IXPConn *c, Fcall *fcall) f = tag[i1]->area[i2]->frame[i3]; if(!strncmp(buf, "kill", 5)) kill_client(f->client); - else if(!strncmp(buf, "sendtoarea ", 11)) - sendtoarea_client(f->client, &buf[11]); + else if(!strncmp(buf, "sendto ", 7)) + send2area_client(f->client, &buf[7]); break; case FsDGclient: if(!strncmp(buf, "kill", 5)) kill_client(client[i1]); - else if(!strncmp(buf, "sendtoarea ", 11)) - sendtoarea_client(client[i1], &buf[11]); + else if(!strncmp(buf, "sendto ", 7)) + send2area_client(client[i1], &buf[7]); break; default: break; diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h @@ -116,6 +116,8 @@ struct Client { unsigned short id; char name[256]; char tags[256]; + char class[128]; + char instance[128]; int proto; unsigned int border; Bool destroyed; @@ -207,7 +209,7 @@ int area2index(Area *a); int aid2index(Tag *t, unsigned short id); void update_area_geometry(Area *a); void select_area(Area *a, char *arg); -void send_toarea(Area *to, Area *from, Client *c); +void send2area(Area *to, Area *from, Client *c); void attach_toarea(Area *a, Client *c); void detach_fromarea(Area *a, Client *c); void arrange_tag(Tag *t, Bool updategeometry); @@ -243,7 +245,7 @@ Client *sel_client_of_tag(Tag *t); void focus_client(Client *c); void resize_client(Client *c, XRectangle *r, XPoint *pt, Bool ignore_xcall); void select_client(Client *c, char *arg); -void sendtoarea_client(Client *c, char *arg); +void send2area_client(Client *c, char *arg); void resize_all_clients(); void focus(Client *c); int cid2index(unsigned short id); diff --git a/cmd/wm/wmii b/cmd/wm/wmii @@ -1,6 +1,7 @@ #!/bin/sh # start wmiiwm and wait for its termination +test $# -eq 0 || exec wmiiwm "$@" wmiiwm -c || exit 1 OLD_PATH=$PATH export OLD_PATH diff --git a/cmd/wm/wmii.1 b/cmd/wm/wmii.1 @@ -1,8 +1,6 @@ .TH WMII 1 wmii-3 .SH NAME wmii \- window manager improved 2 -.SH SYNOPSIS -.B wmii .SH DESCRIPTION .SS Overview .BR wmii (1) diff --git a/rc/wmiirc b/rc/wmiirc @@ -71,7 +71,6 @@ $MODKEY-n $MODKEY-m $MODKEY-s $MODKEY-equal -$MODKEY-0 $MODKEY-1 $MODKEY-2 $MODKEY-3 @@ -81,7 +80,6 @@ $MODKEY-6 $MODKEY-7 $MODKEY-8 $MODKEY-9 -$MODKEY-Shift-0 $MODKEY-Shift-1 $MODKEY-Shift-2 $MODKEY-Shift-3 @@ -115,7 +113,7 @@ do $MODKEY-Control-a) `proglist CONFPREFIX/wmii-3:$HOME/.wmii-3 | wmiimenu` &;; $MODKEY-Control-t) - xwrite /ctl select `wmiir read /tags | awk '{print $NF}' | wmiimenu`;; + xwrite /ctl select `wmiir read /tags | awk '{print $10}' | wmiimenu`;; $MODKEY-t) extern xterm &;; $MODKEY-m) @@ -125,11 +123,11 @@ do $MODKEY-equal) xwrite /ws/sel/mode equal;; $MODKEY-n) - xwrite /ws/sel/sel/ctl sendtoarea new;; + xwrite /ws/sel/sel/ctl sendto new;; $MODKEY-Return) - xwrite /ws/sel/sel/ctl sendtoarea prev;; + xwrite /ws/sel/sel/ctl sendto prev;; $MODKEY-Shift-Return) - xwrite /ws/sel/sel/ctl sendtoarea next;; + xwrite /ws/sel/sel/ctl sendto next;; $MODKEY-h) xwrite /ws/ctl select prev;; $MODKEY-l)