fixed client dir walking (because of broken area id's)

This commit is contained in:
Anselm R. Garbe 2006-02-10 17:09:59 +01:00
parent c331ae7a51
commit d14c83d855
6 changed files with 9 additions and 25 deletions

View File

@ -8,12 +8,13 @@
#include "wm.h"
Area *
alloc_area()
alloc_area(Page *p)
{
static unsigned short id = 1;
Area *a = cext_emallocz(sizeof(Area));
a->id = id++;
p->area = (Area **)cext_array_attach((void **)p->area, a, sizeof(Area *), &p->areasz);
p->narea++;
return a;
}
@ -41,8 +42,6 @@ int
aid_to_index(Page *p, unsigned short id)
{
int i;
if(id == NEW_OBJ)
return p->narea;
for(i = 0; i < p->narea; i++)
if(p->area[i]->id == id)
return i;

View File

@ -551,8 +551,6 @@ int
cid_to_index(Area *a, unsigned short id)
{
int i;
if(id == NEW_OBJ)
return a->nclient;
for(i = 0; i < a->nclient; i++)
if(a->client[i]->id == id)
return i;

View File

@ -295,7 +295,6 @@ mkqid(Qid *dir, char *wname, Qid *new, Bool iswalk)
case Dlabel:
new->type = IXP_QTDIR;
if(!strncmp(wname, "new", 4)) {
/*fprintf(stderr, "mkqid iswalk=%d, wname=%s\n", iswalk, wname);*/
if(iswalk)
new->path = mkqpath(Dlabel, new_label()->id, 0, 0);
else
@ -337,9 +336,8 @@ mkqid(Qid *dir, char *wname, Qid *new, Bool iswalk)
new->type = IXP_QTDIR;
if(!strncmp(wname, "new", 4)) {
if(iswalk) {
Area *a = alloc_area();
p->area = (Area **)cext_array_attach((void **)p->area, a, sizeof(Area *), &p->areasz);
p->narea++;
Area *a = alloc_area(p);
fprintf(stderr, "p->id %d, a->id %d\n", p->id, a->id);
new->path = mkqpath(Darea, p->id, a->id, 0);
}
else
@ -384,7 +382,7 @@ mkqid(Qid *dir, char *wname, Qid *new, Bool iswalk)
break;
case Fdata:
case Fcolor:
if(dir_i1 >= nlabel)
if((dir_type == Dlabel) && (dir_i1 >= nlabel))
return -1;
default:
new->type = IXP_QTFILE;
@ -439,10 +437,7 @@ xwalk(IXPConn *c, Fcall *fcall)
for(nwqid = 0; (nwqid < fcall->nwname)
&& !mkqid(&dir, fcall->wname[nwqid], &fcall->wqid[nwqid], True); nwqid++)
{
/*fprintf(stderr, "dir.dtype=%d\n", dir.dtype);*/
dir = fcall->wqid[nwqid];
/*fprintf(stderr, "walk: qid_to_name()=%s qpath_type(dir.path)=%d dir.dtype=%d\n",
qid_to_name(&dir), qpath_type(dir.path), dir.dtype);*/
}
if(!nwqid) {
/*fprintf(stderr, "%s", "xwalk: no such file\n");*/

View File

@ -33,12 +33,9 @@ alloc_page()
{
static unsigned short id = 1;
Page *p = cext_emallocz(sizeof(Page));
Area *a = cext_emallocz(sizeof(Area));
p->id = id++;
p->area = (Area **)cext_array_attach((void **)p->area, a, sizeof(Area *), &p->areasz);
p->narea++;
do_pend_fcall("NewPage\n");
alloc_area(p);
page = (Page **)cext_array_attach((void **)page, p, sizeof(Page *), &pagesz);
npage++;
focus_page(p);
@ -243,8 +240,6 @@ int
pid_to_index(unsigned short id)
{
int i;
if(id == NEW_OBJ)
return npage;
for(i = 0; i < npage; i++)
if(page[i]->id == id)
return i;

View File

@ -52,8 +52,6 @@ enum {
#define ROOT_MASK SubstructureRedirectMask
#define CLIENT_MASK (StructureNotifyMask | PropertyChangeMask)
#define NEW_OBJ (unsigned short)0xffff
typedef struct Area Area;
typedef struct Page Page;
typedef struct Client Client;
@ -193,7 +191,7 @@ Cursor se_cursor;
unsigned int valid_mask, num_lock_mask;
/* area.c */
Area *alloc_area();
Area *alloc_area(Page *p);
void destroy_area(Area *a);
int area_to_index(Page *p, Area *a);
int aid_to_index(Page *p, unsigned short id);

View File

@ -1,4 +1,4 @@
#!9PREFIX/bin/rc -x
#!9PREFIX/bin/rc
# configure wmii
PIDFILE=/tmp/ns.$USER.$DISPLAY/wmiircpid-$DISPLAY
@ -69,7 +69,6 @@ echo -n key | wmiir write /bar/new/data
# MISC
xsetroot -mod 2 2 -bg '#444466' -fg '#555555'
extern xterm -rv&
status &
wmiir read /event | \