commit 5806667ac7f53d96740f14fdd02124c5c7b6bab5
parent 55b6611a50504d8b00921453987ab37c9f7fc6d8
Author: garbeam <garbeam@mmv.wmii.de>
Date: Sun, 11 Dec 2005 17:24:52 +0200
added unmap flag to detach* signatures
Diffstat:
7 files changed, 25 insertions(+), 23 deletions(-)
diff --git a/cmd/wm/client.c b/cmd/wm/client.c
@@ -329,12 +329,12 @@ void attach_client(Client * c)
invoke_wm_event(def[WM_EVENT_PAGE_UPDATE]);
}
-void detach_client(Client *c) {
+void detach_client(Client *c, Bool unmap) {
Page *p;
Frame *f = c->frame;
Area *a = f ? f->area : nil;
if (a) {
- a->layout->detach(a, c);
+ a->layout->detach(a, c, unmap);
cext_detach_item(&a->clients, c);
}
if (c->destroyed)
diff --git a/cmd/wm/event.c b/cmd/wm/event.c
@@ -172,7 +172,7 @@ static void handle_destroynotify(XEvent * e)
fprintf(stderr, "%s\n", "handle_destroynotify");
if (c) {
c->destroyed = True;
- detach_client(c);
+ detach_client(c, False);
}
}
@@ -239,7 +239,7 @@ static void handle_unmapnotify(XEvent * e)
fprintf(stderr, "%s\n", "handle_unmapnotify");
handle_ignore_enternotify_crap(e);
if ((c = win_to_client(ev->window)))
- detach_client(c);
+ detach_client(c, True);
}
static void handle_enternotify(XEvent * e)
diff --git a/cmd/wm/frame.c b/cmd/wm/frame.c
@@ -305,15 +305,13 @@ void attach_client_to_frame(Frame *f, Client *c)
f->file[F_SEL_CLIENT]->content = c->file[C_PREFIX]->content;
cext_attach_item(&f->clients, c);
c->frame = f;
- c->rect.x = border_width(f);
- c->rect.y = tab_height(f);
- reparent_client(c, f->win, c->rect.x, c->rect.y);
resize_frame(f, &f->rect, 0);
+ reparent_client(c, f->win, c->rect.x, c->rect.y);
show_client(c);
sel_client(c);
}
-void detach_client_from_frame(Client *c)
+void detach_client_from_frame(Client *c, Bool unmap)
{
Frame *f = c->frame;
Client *client;
@@ -322,8 +320,10 @@ void detach_client_from_frame(Client *c)
wmii_move_ixpfile(c->file[C_PREFIX], def[WM_DETACHED_CLIENT]);
cext_detach_item(&f->clients, c);
if (!c->destroyed) {
- cext_attach_item(&detached, c);
- hide_client(c);
+ if (!unmap) {
+ cext_attach_item(&detached, c);
+ hide_client(c);
+ }
c->rect.x = f->rect.x;
c->rect.y = f->rect.y;
reparent_client(c, root, c->rect.x, c->rect.y);
diff --git a/cmd/wm/layout_column.c b/cmd/wm/layout_column.c
@@ -28,7 +28,7 @@ static void init_col(Area * a);
static void deinit_col(Area * a);
static void arrange_col(Area * a);
static Bool attach_col(Area * a, Client * c);
-static void detach_col(Area * a, Client * c);
+static void detach_col(Area * a, Client * c, Bool unmap);
static void resize_col(Frame *f, XRectangle * new, XPoint * pt);
static void select_col(Frame *f, Bool raise);
static Container *get_frames_col(Area *a);
@@ -103,7 +103,8 @@ static void init_col(Area *a)
static void iter_detach_client(void *client, void *area)
{
- detach_col((Area *)area, (Client *)client);
+ Area *a = area;
+ detach_col(a, (Client *)client, a->page != get_sel_page());
}
static void deinit_col(Area *a)
@@ -148,13 +149,13 @@ static Bool attach_col(Area *a, Client *c)
return True;
}
-static void detach_col(Area *a, Client *c)
+static void detach_col(Area *a, Client *c, Bool unmap)
{
Acme *acme = a->aux;
Frame *f = c->frame;
Column *col = f->aux;
- detach_client_from_frame(c);
+ detach_client_from_frame(c, unmap);
if (!cext_sizeof(&f->clients)) {
detach_frame_from_area(f);
cext_detach_item(&acme->frames, f);
diff --git a/cmd/wm/layout_float.c b/cmd/wm/layout_float.c
@@ -14,7 +14,7 @@ static void init_float(Area *a);
static void deinit_float(Area *a);
static void arrange_float(Area *a);
static Bool attach_float(Area *a, Client *c);
-static void detach_float(Area *a, Client *c);
+static void detach_float(Area *a, Client *c, Bool unmap);
static void resize_float(Frame *f, XRectangle *new, XPoint *pt);
static void select_float(Frame *f, Bool raise);
static Container *get_frames_float(Area *a);
@@ -53,7 +53,8 @@ static void init_float(Area *a)
static void iter_detach_float(void *client, void *area)
{
- detach_float(area, client);
+ Area *a = area;
+ detach_float(a, client, a->page == get_sel_page());
}
static void deinit_float(Area *a)
@@ -83,10 +84,10 @@ static Bool attach_float(Area *a, Client *c)
return True;
}
-static void detach_float(Area *a, Client *c)
+static void detach_float(Area *a, Client *c, Bool unmap)
{
Frame *f = c->frame;
- detach_client_from_frame(c);
+ detach_client_from_frame(c, unmap);
if (!cext_sizeof(&f->clients)) {
detach_frame_from_area(f);
cext_detach_item((Container *)a->aux, f);
diff --git a/cmd/wm/wm.c b/cmd/wm/wm.c
@@ -115,7 +115,7 @@ static void iter_draw_pager_frame(void *item, void *aux)
{
Draw *d = aux;
Frame *f = (Frame *)item;
- if (f == cext_stack_get_top_item(f->area->layout->get_frames(f->area))) {
+ if (f == get_sel_frame_of_area(f->area)) {
d->bg = blitz_loadcolor(dpy, screen_num, def[WM_SEL_BG_COLOR]->content);
d->fg = blitz_loadcolor(dpy, screen_num, def[WM_SEL_FG_COLOR]->content);
d->border = blitz_loadcolor(dpy, screen_num, def[WM_SEL_BORDER_COLOR]->content);
@@ -394,7 +394,7 @@ static void _detach_client(void *obj, char *cmd)
if (!f)
return;
c = cext_stack_get_top_item(&f->clients);
- f->area->layout->detach(f->area, c);
+ f->area->layout->detach(f->area, c, False);
}
static void _select_page(void *obj, char *cmd)
diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h
@@ -115,7 +115,7 @@ struct Layout {
void (*deinit) (Area *); /* called when layout is uninitialized */
void (*arrange) (Area *); /* called when area is resized */
Bool (*attach) (Area *, Client *); /* called on attach */
- void (*detach) (Area *, Client *); /* called on detach */
+ void (*detach) (Area *, Client *, Bool unmap); /* called on detach */
void (*resize) (Frame *, XRectangle *, XPoint *); /* called after resize */
void (*select) (Frame *, Bool raise); /* selection */
Container *(*get_frames) (Area *); /* called after resize */
@@ -227,7 +227,7 @@ void show_client(Client * c);
void reparent_client(Client * c, Window w, int x, int y);
void sel_client(Client *c);
void attach_client(Client *c);
-void detach_client(Client *c);
+void detach_client(Client *c, Bool unmap);
Client *get_sel_client();
/* frame.c */
@@ -238,7 +238,7 @@ void resize_frame(Frame *f, XRectangle *r, XPoint *pt);
void draw_frame(void *frame, void *aux);
void handle_frame_buttonpress(XButtonEvent *e, Frame *f);
void attach_client_to_frame(Frame *f, Client *c);
-void detach_client_from_frame(Client *c);
+void detach_client_from_frame(Client *c, Bool unmap);
unsigned int tab_height(Frame * f);
unsigned int border_width(Frame * f);
Frame *get_sel_frame();