commit 418ded55d9a2cb499a23823dab81a929f8ffc1c7
parent e620aa3e45d3de7f417ab657106623540fca4cb7
Author: garbeam <garbeam@localhost>
Date: Tue, 3 Jan 2006 11:30:15 +0200
removed lock-based tabbing, tabbing is up to the layout now
Diffstat:
7 files changed, 50 insertions(+), 78 deletions(-)
diff --git a/cmd/wm/client.c b/cmd/wm/client.c
@@ -13,19 +13,15 @@
Client *
alloc_client(Window w)
{
- static int id = 0;
- char buf[MAX_BUF];
XTextProperty name;
Client *c = (Client *) cext_emallocz(sizeof(Client));
c->win = w;
- snprintf(buf, MAX_BUF, "/detached/client/%d", id);
- c->file[C_PREFIX] = ixp_create(ixps, buf);
XGetWMName(dpy, c->win, &name);
- snprintf(buf, MAX_BUF, "/detached/client/%d/name", id);
- c->file[C_NAME] = wmii_create_ixpfile(ixps, buf, (char *) name.value);
- free(name.value);
- id++;
+ if(name.value) {
+ strncpy(c->name, (char *)name.value, 256);
+ free(name.value);
+ }
return c;
}
@@ -36,7 +32,6 @@ focus_client(Client * c)
/* sel client */
f = c->frame;
f->sel = c;
- f->file[F_SEL_CLIENT]->content = c->file[C_PREFIX]->content;
XRaiseWindow(dpy, c->win);
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
invoke_wm_event(def[WM_EVENT_CLIENT_UPDATE]);
@@ -167,13 +162,10 @@ handle_client_property(Client * c, XPropertyEvent * e)
switch (e->atom) {
case XA_WM_NAME:
XGetWMName(dpy, c->win, &name);
- if(strlen((char *) name.value)) {
- if(c->file[C_NAME]->content)
- free(c->file[C_NAME]->content);
- c->file[C_NAME]->content = cext_estrdup((char *) name.value);
- c->file[C_NAME]->size = strlen((char *) name.value);
- }
- free(name.value);
+ if(name.value) {
+ strncpy(c->name, (char*) name.value, 256);
+ free(name.value);
+ }
if(c->frame)
draw_client(c);
invoke_wm_event(def[WM_EVENT_CLIENT_UPDATE]);
@@ -194,7 +186,6 @@ void
destroy_client(Client * c)
{
detach_detached(c);
- ixp_remove_file(ixps, c->file[C_PREFIX]);
free(c);
}
@@ -222,7 +213,7 @@ draw_client(Client * client)
if(i && (i == f->nclients - 1))
d.rect.width = f->rect.width - d.rect.x;
d.rect.height = tabh;
- d.data = c->file[C_NAME]->content;
+ d.data = c->name;
d.font = font;
if((f == sel_frame()) && (c == f->sel)) {
diff --git a/cmd/wm/frame.c b/cmd/wm/frame.c
@@ -32,34 +32,29 @@ alloc_frame(XRectangle * r)
f->rect = *r;
f->cursor = normal_cursor;
- snprintf(buf, MAX_BUF, "/detached/frame/%d", id);
+ snprintf(buf, MAX_BUF, "/detached/%d", id);
f->file[F_PREFIX] = ixp_create(ixps, buf);
- snprintf(buf, MAX_BUF, "/detached/frame/%d/client", id);
- f->file[F_CLIENT_PREFIX] = ixp_create(ixps, buf);
- snprintf(buf, MAX_BUF, "/detached/frame/%d/client/sel", id);
- f->file[F_SEL_CLIENT] = ixp_create(ixps, buf);
- f->file[F_SEL_CLIENT]->bind = 1;
- snprintf(buf, MAX_BUF, "/detached/frame/%d/ctl", id);
+ snprintf(buf, MAX_BUF, "/detached/%d/name", id);
+ f->file[F_NAME] = ixp_create(ixps, buf);
+ f->file[F_NAME]->before_read = handle_before_read_frame;
+ snprintf(buf, MAX_BUF, "/detached/%d/ctl", id);
f->file[F_CTL] = ixp_create(ixps, buf);
f->file[F_CTL]->after_write = handle_after_write_frame;
- snprintf(buf, MAX_BUF, "/detached/frame/%d/geometry", id);
+ snprintf(buf, MAX_BUF, "/detached/%d/geometry", id);
f->file[F_GEOMETRY] = ixp_create(ixps, buf);
f->file[F_GEOMETRY]->before_read = handle_before_read_frame;
f->file[F_GEOMETRY]->after_write = handle_after_write_frame;
- snprintf(buf, MAX_BUF, "/detached/frame/%d/border", id);
+ snprintf(buf, MAX_BUF, "/detached/%d/border", id);
f->file[F_BORDER] =
wmii_create_ixpfile(ixps, buf, def[WM_BORDER]->content);
f->file[F_BORDER]->after_write = handle_after_write_frame;
- snprintf(buf, MAX_BUF, "/detached/frame/%d/tab", id);
+ snprintf(buf, MAX_BUF, "/detached/%d/tab", id);
f->file[F_TAB] = wmii_create_ixpfile(ixps, buf, def[WM_TAB]->content);
f->file[F_TAB]->after_write = handle_after_write_frame;
- snprintf(buf, MAX_BUF, "/detached/frame/%d/handleinc", id);
+ snprintf(buf, MAX_BUF, "/detached/%d/handleinc", id);
f->file[F_HANDLE_INC] =
wmii_create_ixpfile(ixps, buf, def[WM_HANDLE_INC]->content);
f->file[F_HANDLE_INC]->after_write = handle_after_write_frame;
- snprintf(buf, MAX_BUF, "/detached/frame/%d/locked", id);
- f->file[F_LOCKED] =
- wmii_create_ixpfile(ixps, buf, def[WM_LOCKED]->content);
id++;
wa.override_redirect = 1;
@@ -295,8 +290,6 @@ void
attach_client_to_frame(Frame * f, Client * client)
{
Client *c;
- wmii_move_ixpfile(client->file[C_PREFIX], f->file[F_CLIENT_PREFIX]);
- f->file[F_SEL_CLIENT]->content = client->file[C_PREFIX]->content;
for(c = f->clients; c && c->next; c = c->next);
if(!c) {
f->clients = client;
@@ -321,9 +314,6 @@ detach_client_from_frame(Client * c, Bool unmap)
Frame *f = c->frame;
c->frame = nil;
- f->file[F_SEL_CLIENT]->content = nil;
- wmii_move_ixpfile(c->file[C_PREFIX], def[WM_DETACHED_CLIENT]);
-
if(f->sel == c) {
if(c->prev)
f->sel = c->prev;
@@ -381,10 +371,10 @@ static Frame *
handle_before_read_frames(IXPServer * s, File * file, Area * a)
{
Frame *f;
- char buf[64];
- for(f = a->layout->frames(a); f; f = f->next)
+ char buf[32];
+ for(f = a->layout->frames(a); f; f = f->next) {
if(file == f->file[F_GEOMETRY]) {
- snprintf(buf, 64, "%d,%d,%d,%d", f->rect.x, f->rect.y,
+ snprintf(buf, sizeof(buf), "%d,%d,%d,%d", f->rect.x, f->rect.y,
f->rect.width, f->rect.height);
if(file->content)
free(file->content);
@@ -392,6 +382,20 @@ handle_before_read_frames(IXPServer * s, File * file, Area * a)
file->size = strlen(buf);
return f;
}
+ else if(file == f->file[F_NAME]) {
+ if(file->content)
+ free(file->content);
+ if(f->sel && f->sel->name) {
+ file->content = cext_estrdup(f->sel->name);
+ file->size = strlen(buf);
+ }
+ else {
+ file->content = nil;
+ file->size = 0;
+ }
+ return f;
+ }
+ }
return nil;
}
diff --git a/cmd/wm/layout_column.c b/cmd/wm/layout_column.c
@@ -239,13 +239,8 @@ attach_col(Area * a, Client * c)
acme->ncolumns++;
}
- /* check for tabbing? */
- if(f && (((char *) f->file[F_LOCKED]->content)[0] == '1'))
- f = 0;
- if(!f) {
- f = alloc_frame(&c->rect);
- attach_frame(a, col, f);
- }
+ f = alloc_frame(&c->rect);
+ attach_frame(a, col, f);
attach_client_to_frame(f, c);
arrange_column(col);
if(a->page == selpage)
diff --git a/cmd/wm/layout_float.c b/cmd/wm/layout_float.c
@@ -147,22 +147,17 @@ deinit_float(Area * a)
static Bool
attach_float(Area * a, Client * c)
{
- Float *fl = a->aux;
- Frame *f = fl->sel;
+ Frame *f;
/* check for tabbing? */
- if(f && (((char *) f->file[F_LOCKED]->content)[0] == '1'))
- f = 0;
- if(!f) {
- if(c->rect.y < area_rect.y)
- c->rect.y = area_rect.y;
- if(c->rect.x < area_rect.x)
- c->rect.x = area_rect.x;
-
- f = alloc_frame(&c->rect);
- attach_frame_to_area(a, f);
- attach_frame(a, f);
- }
+ if(c->rect.y < area_rect.y)
+ c->rect.y = area_rect.y;
+ if(c->rect.x < area_rect.x)
+ c->rect.x = area_rect.x;
+
+ f = alloc_frame(&c->rect);
+ attach_frame_to_area(a, f);
+ attach_frame(a, f);
attach_client_to_frame(f, c);
if(a->page == selpage)
XMapWindow(dpy, f->win);
diff --git a/cmd/wm/wm.c b/cmd/wm/wm.c
@@ -144,7 +144,7 @@ draw_pager_area(Area * a, Draw * d)
blitz_loadcolor(dpy, screen_num,
def[WM_NORM_BORDER_COLOR]->content);
}
- d->data = f->sel->file[C_NAME]->content;
+ d->data = f->sel->name;
scale_rect(&rect, &initial_rect, &f->rect, &d->rect);
blitz_drawlabel(dpy, d);
XSync(dpy, False); /* do not clear upwards */
@@ -722,7 +722,6 @@ init_default()
def[WM_TAB] = wmii_create_ixpfile(ixps, "/default/tab", "1");
def[WM_HANDLE_INC] =
wmii_create_ixpfile(ixps, "/default/handleinc", "1");
- def[WM_LOCKED] = wmii_create_ixpfile(ixps, "/default/locked", "1");
def[WM_LAYOUT] = wmii_create_ixpfile(ixps, "/default/layout", LAYOUT);
def[WM_SEL_PAGE] = ixp_create(ixps, "/sel");
def[WM_EVENT_PAGE_UPDATE] = ixp_create(ixps, "/event/pageupdate");
diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h
@@ -31,24 +31,15 @@ enum {
/* array indexes of frame file pointers */
enum {
F_PREFIX,
- F_CLIENT_PREFIX,
- F_SEL_CLIENT,
+ F_NAME,
F_CTL,
F_GEOMETRY,
F_BORDER,
F_TAB,
F_HANDLE_INC,
- F_LOCKED,
F_LAST
};
-/* array indexes of client file pointers */
-enum {
- C_PREFIX,
- C_NAME,
- C_LAST
-};
-
/* array indexes of wm file pointers */
enum {
WM_CTL,
@@ -66,7 +57,6 @@ enum {
WM_BORDER,
WM_TAB,
WM_HANDLE_INC,
- WM_LOCKED,
WM_SNAP_VALUE,
WM_SEL_PAGE,
WM_LAYOUT,
@@ -155,13 +145,13 @@ struct Client {
int proto;
unsigned int border;
unsigned int ignore_unmap;
+ char name[256];
Bool destroyed;
Window win;
Window trans;
XRectangle rect;
XSizeHints size;
Frame *frame;
- File *file[C_LAST];
Client *next;
Client *prev;
};
diff --git a/rc/wmiirc b/rc/wmiirc
@@ -106,7 +106,7 @@ wmiir write /wm/default/handleinc $HANDLEINC
wmiir write /wm/default/border 1
wmiir write /wm/event/clientupdate \
-'text=`{wmiir read /wm/sel/layout/sel/frame/sel/client/sel/name} \
+'text=`{wmiir read /wm/sel/layout/sel/frame/sel/name} \
wmiir write /bar/'^$clab^'/data $"text'
wmiir write /wm/event/pageupdate \
'wmiir write /bar/'^$plab^'/data `{wmiir read /wm/sel/name} &&' ^ \
@@ -143,8 +143,6 @@ kbind normal $MODKEY-S-f 'wmiir write /wm/sel/layout/sel/name float'
kbind normal $MODKEY-Return 'wmiir write /wm/sel/layout/sel/ctl ''swap west'''
kbind normal $MODKEY-S-Return 'wmiir write /wm/sel/layout/sel/ctl ''swap east'''
kbind normal $MODKEY-C-y 'wmiir write /wm/ctl new'
-kbind normal $MODKEY-u 'wmiir write /wm/sel/layout/sel/frame/sel/locked 0'
-kbind normal $MODKEY-S-u 'wmiir write /wm/sel/layout/sel/frame/sel/locked 1'
kbind normal $MODKEY-$WESTKEY 'wmiir write /wm/sel/layout/sel/ctl ''select west'''
kbind normal $MODKEY-$EASTKEY 'wmiir write /wm/sel/layout/sel/ctl ''select east'''
kbind normal $MODKEY-Tab 'wmiir write /wm/sel/layout/sel/ctl ''select next'''