wmii

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

commit 93d8eb3617800a80ab371968375a4bd608add2c0
parent 88ae3e3606dda34ebdea8ebc2a82fca97e953fda
Author: Anselm R. Garbe <garbeam@wmii.de>
Date:   Thu, 16 Feb 2006 01:55:21 +0100

some changes


Diffstat:
cmd/wm/client.c | 23+++++++++++++++--------
cmd/wm/column.c | 12++++++------
cmd/wm/event.c | 8++++----
cmd/wm/page.c | 2+-
cmd/wm/wm.h | 2+-
rc/wmiirc | 4++--
6 files changed, 29 insertions(+), 22 deletions(-)

diff --git a/cmd/wm/client.c b/cmd/wm/client.c @@ -98,8 +98,17 @@ client_name_event(Client *c) broadcast_event(buf); } +static void +client_focus_event(Client *c) +{ + char buf[256]; + snprintf(buf, sizeof(buf), "CF %d %d %d %d\n", c->frame.rect.x, c->frame.rect.y, + c->frame.rect.width, c->frame.rect.height); + broadcast_event(buf); +} + void -focus_client(Client *c) +focus_client(Client *c, Bool fevent) { Page *p = page ? page[sel] : nil; size_t i, j; @@ -134,6 +143,8 @@ focus_client(Client *c) draw_client(c); XSync(dpy, False); client_name_event(c); + if(fevent) + client_focus_event(c); } void @@ -369,7 +380,6 @@ void attach_client(Client *c) { Page *p; - char buf[32]; if(!page) p = alloc_page(); else @@ -389,10 +399,7 @@ attach_client(Client *c) resize_client(c, &c->frame.rect, nil); map_client(c); XMapWindow(dpy, c->frame.win); - focus_client(c); - snprintf(buf, sizeof(buf), "CA %d %d %d %d\n", c->frame.rect.x, c->frame.rect.y, - c->frame.rect.width, c->frame.rect.height); - broadcast_event(buf); + focus_client(c, True); } void @@ -425,7 +432,7 @@ detach_client(Client *c, Bool unmap) } c->area = nil; if(c->revert) - focus_client(c->revert); + focus_client(c->revert, True); if(c->destroyed) destroy_client(c); } @@ -606,6 +613,6 @@ select_client(Client *c, char *arg) return; i--; } - focus_client(a->client[i]); + focus_client(a->client[i], True); } } diff --git a/cmd/wm/column.c b/cmd/wm/column.c @@ -192,7 +192,7 @@ drop_moving(Client *c, XRectangle *new, XPoint * pt) arrange_column(p, src); } } - focus_client(c); + focus_client(c, False); } } @@ -217,13 +217,13 @@ select_column(Client *c, char *arg) if(!strncmp(arg, "prev", 5)) { if(!i) for(i = 0; (i < col->clientsz) && col->client[i]; i++); - focus_client(col->client[i - 1]); + focus_client(col->client[i - 1], True); return; } else if(!strncmp(arg, "next", 5)) { if(col->client[i + 1]) - focus_client(col->client[i + 1]); + focus_client(col->client[i + 1], True); else - focus_client(col->client[0]); + focus_client(col->client[0], True); return; } @@ -245,7 +245,7 @@ select_column(Client *c, char *arg) return; col = p->area[i]; } - focus_client(col->client[col->sel]); + focus_client(col->client[col->sel], True); } void @@ -268,7 +268,7 @@ new_column(Page *p) sizeof(Client *), &col->clientsz); c->area = col; update_column_width(p); - focus_client(c); + focus_client(c, True); } /* diff --git a/cmd/wm/event.c b/cmd/wm/event.c @@ -75,7 +75,7 @@ handle_buttonpress(XEvent *e) else if((c = win_to_frame(ev->window))) { if(ev->button == Button1) { if(sel_client() != c) { - focus_client(c); + focus_client(c, False); return; } align = cursor_to_align(c->frame.cursor); @@ -96,11 +96,11 @@ handle_buttonpress(XEvent *e) XRaiseWindow(dpy, c->frame.win); switch (ev->button) { case Button1: - focus_client(c); + focus_client(c, False); mouse_move(c); break; case Button3: - focus_client(c); + focus_client(c, False); align = xy_to_align(&c->rect, ev->x, ev->y); if(align == CENTER) mouse_move(c); @@ -110,7 +110,7 @@ handle_buttonpress(XEvent *e) } } else if(ev->button == Button1) - focus_client(c); + focus_client(c, False); if(c && c->area) { snprintf(buf, sizeof(buf), "CB %d %d\n", client_to_index(c) + 1, ev->button); diff --git a/cmd/wm/page.c b/cmd/wm/page.c @@ -91,7 +91,7 @@ focus_page(Page *p) } } if((c = sel_client_of_page(p))) - focus_client(c); + focus_client(c, False); snprintf(buf, sizeof(buf), "PN %d\n", sel + 1); broadcast_event(buf); XChangeProperty(dpy, root, net_atoms[NET_CURRENT_DESKTOP], XA_CARDINAL, diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h @@ -220,7 +220,7 @@ void attach_client(Client * c); void detach_client(Client * c, Bool unmap); Client *sel_client(); Client *sel_client_of_page(Page *p); -void focus_client(Client *c); +void focus_client(Client *c, Bool fevent); Client *win_to_frame(Window w); void resize_client(Client *c, XRectangle * r, XPoint * pt); unsigned int bar_height(Client *c); diff --git a/rc/wmiirc b/rc/wmiirc @@ -112,8 +112,8 @@ while(event=`{read}) { text=`{echo $"event | sed 's/^CN //g'} xwrite /bar/2/data $"text } - if(~ $event(1) CA) - xwrite /ctl 'warp '^`{echo $event(2) + 10 | bc}^' '^`{echo $event(3) + 10 | bc} + if(~ $event(1) CF) + xwrite /ctl 'warp '^$event(2)^' '^$event(3) if(~ $event(1) LB) { # label button press switch($event(3)) { # button case 1