diff --git a/cmd/wm/client.c b/cmd/wm/client.c index 80b70169..52cd725c 100644 --- a/cmd/wm/client.c +++ b/cmd/wm/client.c @@ -323,8 +323,10 @@ void gravitate(Client * c, unsigned int tabh, unsigned int bw, int invert) void attach_client(Client * c) { Area *a = 0; + Frame *old; if (!page) alloc_page(); + old = SELFRAME(page[sel]); /* transient stuff */ a = SELAREA; if (c && c->trans) { @@ -332,8 +334,9 @@ void attach_client(Client * c) if (t && t->frame) a = t->frame->area; } - a->layout->attach(a, c); + if (old) + draw_frame(old); invoke_wm_event(def[WM_EVENT_PAGE_UPDATE]); } diff --git a/cmd/wm/event.c b/cmd/wm/event.c index 327a3276..0e868520 100644 --- a/cmd/wm/event.c +++ b/cmd/wm/event.c @@ -63,6 +63,7 @@ static void handle_buttonpress(XEvent * e) Client *c; XButtonPressedEvent *ev = &e->xbutton; Frame *f = win_to_frame(ev->window); + if (f) { handle_frame_buttonpress(ev, f); return; @@ -76,6 +77,7 @@ static void handle_buttonpress(XEvent * e) if (c->frame) { /* client is attached */ ev->state &= valid_mask; if (ev->state & Mod1Mask) { + Align align; if (!c->frame->area->page->sel) XRaiseWindow(dpy, c->frame->win); switch (ev->button) { @@ -83,13 +85,9 @@ static void handle_buttonpress(XEvent * e) mouse_move(c->frame); break; case Button3: - { - Align align = xy_to_align(&c->rect, ev->x, ev->y); - if (align == CENTER) - mouse_move(c->frame); - else - mouse_resize(c->frame, align); - } + align = xy_to_align(&c->rect, ev->x, ev->y); + if (align == CENTER) mouse_move(c->frame); + else mouse_resize(c->frame, align); break; default: break; @@ -120,23 +118,16 @@ static void handle_configurerequest(XEvent * e) tabh = tab_height(f); } if (ev->value_mask & CWStackMode) { - if (wc.stack_mode == Above) - XRaiseWindow(dpy, c->win); - else - ev->value_mask &= ~CWStackMode; + if (wc.stack_mode == Above) XRaiseWindow(dpy, c->win); + else ev->value_mask &= ~CWStackMode; } gravitate(c, tabh ? tabh : bw, bw, 1); - if (ev->value_mask & CWX) - c->rect.x = ev->x; - if (ev->value_mask & CWY) - c->rect.y = ev->y; - if (ev->value_mask & CWWidth) - c->rect.width = ev->width; - if (ev->value_mask & CWHeight) - c->rect.height = ev->height; - if (ev->value_mask & CWBorderWidth) - c->border = ev->border_width; + if (ev->value_mask & CWX) c->rect.x = ev->x; + if (ev->value_mask & CWY) c->rect.y = ev->y; + if (ev->value_mask & CWWidth) c->rect.width = ev->width; + if (ev->value_mask & CWHeight) c->rect.height = ev->height; + if (ev->value_mask & CWBorderWidth) c->border = ev->border_width; gravitate(c, tabh ? tabh : bw, bw, 0); @@ -144,8 +135,7 @@ static void handle_configurerequest(XEvent * e) f->rect.x = wc.x = c->rect.x - bw; f->rect.y = wc.y = c->rect.y - (tabh ? tabh : bw); f->rect.width = wc.width = c->rect.width + 2 * bw; - f->rect.height = wc.height = - c->rect.height + bw + (tabh ? tabh : bw); + f->rect.height = wc.height = c->rect.height + bw + (tabh ? tabh : bw); wc.border_width = 1; wc.sibling = None; wc.stack_mode = ev->detail; diff --git a/libcext/Makefile b/libcext/Makefile index 80f8c1b3..0d32508b 100644 --- a/libcext/Makefile +++ b/libcext/Makefile @@ -3,7 +3,7 @@ include ../config.mk -SRC = array.c emalloc.c estrdup.c strlcat.c strlcpy.c strtonum.c tokenize.c +SRC = container.c emalloc.c estrdup.c strlcat.c strlcpy.c strtonum.c tokenize.c OBJ = ${SRC:.c=.o} diff --git a/libcext/cext.h b/libcext/cext.h index 87516b3b..ef0e0c36 100644 --- a/libcext/cext.h +++ b/libcext/cext.h @@ -15,7 +15,25 @@ #define TRUE 1 #endif -/* array.c */ +/* container.c */ +typedef struct Container Container; +typedef struct CItem CItem; + +struct CItem { + void *item; + CItem *prev; + CItem *next; +}; + +struct Container { + CItem *list; + CItem *stack; +} Container; + +void attach_item +void *item_at( + + void **attach_item_end(void **old, void *item, size_t size_item); void **attach_item_begin(void **old, void *item, size_t size_item); void **detach_item(void **old, void *item, size_t size_item); diff --git a/libcext/array.c b/libcext/container.c similarity index 99% rename from libcext/array.c rename to libcext/container.c index fcc58c71..f0ea2107 100644 --- a/libcext/array.c +++ b/libcext/container.c @@ -7,6 +7,10 @@ #include "cext.h" + + + + void **attach_item_begin(void **old, void *item, size_t size_item) { int i, size_old;