mirror of
https://github.com/0intro/wmii
synced 2025-03-20 05:33:18 +03:00
added id-based qid-routing to wm/fs.c
This commit is contained in:
parent
bdbc256a1b
commit
150c7bef96
@ -10,7 +10,7 @@
|
||||
Area *
|
||||
alloc_area()
|
||||
{
|
||||
static unsigned short id = 0;
|
||||
static unsigned short id = 1;
|
||||
Area *a = cext_emallocz(sizeof(Area));
|
||||
|
||||
a->id = id++;
|
||||
|
@ -26,7 +26,7 @@ alloc_client(Window w, XWindowAttributes *wa)
|
||||
XSetWindowAttributes fwa;
|
||||
int bw = def.border, bh;
|
||||
long msize;
|
||||
static unsigned short id = 0;
|
||||
static unsigned short id = 1;
|
||||
|
||||
/* client itself */
|
||||
c->id = id++;
|
||||
|
@ -43,7 +43,7 @@ init_x_event_handler()
|
||||
}
|
||||
|
||||
void
|
||||
check_x_event(IXPServer *s, IXPConn *c)
|
||||
check_x_event(IXPConn *c)
|
||||
{
|
||||
XEvent ev;
|
||||
while(XPending(dpy)) { /* main evet loop */
|
||||
|
649
cmd/wm/fs.c
649
cmd/wm/fs.c
File diff suppressed because it is too large
Load Diff
@ -27,7 +27,7 @@ Action page_acttbl[] = {
|
||||
Page *
|
||||
alloc_page()
|
||||
{
|
||||
static unsigned short id = 0;
|
||||
static unsigned short id = 1;
|
||||
Page *p = cext_emallocz(sizeof(Page));
|
||||
Area *a = cext_emallocz(sizeof(Area));
|
||||
|
||||
|
23
cmd/wm/wm.c
23
cmd/wm/wm.c
@ -620,8 +620,7 @@ main(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
int checkwm = 0;
|
||||
char *address= 0;
|
||||
IXPConn *c;
|
||||
char *address = nil, *errstr;
|
||||
|
||||
/* command line args */
|
||||
if(argc > 1) {
|
||||
@ -682,23 +681,13 @@ main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
/* IXP server */
|
||||
c = cext_emallocz(sizeof(IXPConn));
|
||||
c->fd = i;
|
||||
c->read = new_ixp_conn;
|
||||
c->close = close_ixp_conn;
|
||||
srv.conn = (IXPConn **)cext_array_attach((void **)srv.conn, c,
|
||||
sizeof(IXPConn *), &srv.connsz);
|
||||
|
||||
ixp_server_open_conn(&srv, i, new_ixp_conn, ixp_server_close_conn);
|
||||
root_qid.type = IXP_QTDIR;
|
||||
root_qid.version = 0;
|
||||
root_qid.path = mkqpath(Droot, 0, 0, 0);
|
||||
/* X server */
|
||||
c = cext_emallocz(sizeof(IXPConn));
|
||||
c->fd = ConnectionNumber(dpy);
|
||||
c->read = check_x_event;
|
||||
srv.conn = (IXPConn **)cext_array_attach((void **)srv.conn, c,
|
||||
sizeof(IXPConn *), &srv.connsz);
|
||||
|
||||
/* X server */
|
||||
ixp_server_open_conn(&srv, ConnectionNumber(dpy), check_x_event, nil);
|
||||
init_x_event_handler();
|
||||
|
||||
ndet = npage = nclient = aqsz = detsz = pagesz = clientsz = sel = 0;
|
||||
@ -726,9 +715,9 @@ main(int argc, char *argv[])
|
||||
if(errstr)
|
||||
fprintf(stderr, "wmii: fatal: %s\n", errstr);
|
||||
|
||||
|
||||
ixp_server_close(&srv);
|
||||
cleanup();
|
||||
XCloseDisplay(dpy);
|
||||
|
||||
return 0;
|
||||
return errstr ? 1 : 0;
|
||||
}
|
||||
|
@ -120,7 +120,6 @@ XFontStruct *xfont;
|
||||
GC gc_xor;
|
||||
GC gc_transient;
|
||||
IXPServer srv;
|
||||
char *errstr;
|
||||
Qid root_qid;
|
||||
|
||||
/* default values */
|
||||
@ -191,14 +190,13 @@ int index_of_client_id(Area *a, unsigned short id);
|
||||
|
||||
/* event.c */
|
||||
void init_x_event_handler();
|
||||
void check_x_event(IXPServer *s, IXPConn *c);
|
||||
void check_x_event(IXPConn *c);
|
||||
|
||||
/* fs.c */
|
||||
unsigned long long mkqpath(unsigned char type, unsigned short pg,
|
||||
unsigned short area, unsigned short cl);
|
||||
void do_pend_fcall(char *event);
|
||||
void new_ixp_conn(IXPServer *s, IXPConn *c);
|
||||
void close_ixp_conn(IXPServer *s, IXPConn *c);
|
||||
void new_ixp_conn(IXPConn *c);
|
||||
|
||||
/* mouse.c */
|
||||
void mouse_resize(Client *c, Align align);
|
||||
|
@ -107,7 +107,7 @@ dummy_error_handler(Display * dpy, XErrorEvent * err)
|
||||
static void
|
||||
new_item()
|
||||
{
|
||||
static unsigned int id = 0;
|
||||
static unsigned int id = 1;
|
||||
Item *it = cext_emallocz(sizeof(Item));
|
||||
it->id = id++;
|
||||
if(nitem > 0) {
|
||||
@ -603,7 +603,7 @@ xread(IXPConn *c, Fcall *fcall)
|
||||
break;
|
||||
case Ditem:
|
||||
if(i > nitem)
|
||||
goto error_xread;
|
||||
return Enofile;
|
||||
if(i == nitem)
|
||||
new_item();
|
||||
fcall->count = type_to_stat(&stat, "color", &m->qid);
|
||||
@ -627,7 +627,7 @@ xread(IXPConn *c, Fcall *fcall)
|
||||
if(i == nitem)
|
||||
new_item();
|
||||
if(i >= nitem)
|
||||
goto error_xread;
|
||||
return Enofile;
|
||||
if((fcall->count = strlen(item[i]->data)))
|
||||
memcpy(p, item[i]->data, fcall->count);
|
||||
break;
|
||||
@ -635,7 +635,7 @@ xread(IXPConn *c, Fcall *fcall)
|
||||
if(i == nitem)
|
||||
new_item();
|
||||
if(i >= nitem)
|
||||
goto error_xread;
|
||||
return Enofile;
|
||||
if((fcall->count = strlen(item[i]->colstr)))
|
||||
memcpy(p, item[i]->colstr, fcall->count);
|
||||
break;
|
||||
@ -644,7 +644,6 @@ xread(IXPConn *c, Fcall *fcall)
|
||||
return nil;
|
||||
break;
|
||||
default:
|
||||
error_xread:
|
||||
return "invalid read";
|
||||
break;
|
||||
}
|
||||
@ -718,7 +717,7 @@ xwrite(IXPConn *c, Fcall *fcall)
|
||||
}
|
||||
}
|
||||
}
|
||||
return "item not found";
|
||||
return Enofile;
|
||||
break;
|
||||
case Fdata:
|
||||
{
|
||||
@ -726,7 +725,7 @@ xwrite(IXPConn *c, Fcall *fcall)
|
||||
if(i == nitem)
|
||||
new_item();
|
||||
if(!i || (i >= nitem))
|
||||
goto error_xwrite;
|
||||
return Enofile;
|
||||
if(len >= sizeof(item[i]->data))
|
||||
len = sizeof(item[i]->data) - 1;
|
||||
memcpy(item[i]->data, fcall->data, len);
|
||||
@ -748,7 +747,6 @@ xwrite(IXPConn *c, Fcall *fcall)
|
||||
draw();
|
||||
break;
|
||||
default:
|
||||
error_xwrite:
|
||||
return "invalid write";
|
||||
break;
|
||||
}
|
||||
@ -880,13 +878,13 @@ main(int argc, char *argv[])
|
||||
|
||||
/* IXP server */
|
||||
ixp_server_open_conn(&srv, i, new_ixp_conn, ixp_server_close_conn);
|
||||
/* X server */
|
||||
ixp_server_open_conn(&srv, ConnectionNumber(dpy), check_x_event, nil);
|
||||
|
||||
root_qid.type = IXP_QTDIR;
|
||||
root_qid.version = 0;
|
||||
root_qid.path = mkqpath(Droot, 0);
|
||||
|
||||
/* X server */
|
||||
ixp_server_open_conn(&srv, ConnectionNumber(dpy), check_x_event, nil);
|
||||
|
||||
/* default settings */
|
||||
new_item();
|
||||
cext_strlcpy(item[0]->colstr, BLITZ_SEL_COLOR, sizeof(item[0]->colstr));
|
||||
|
@ -111,7 +111,11 @@ ixp_server_fid2map(IXPConn *c, unsigned int fid)
|
||||
void
|
||||
ixp_server_enqueue_fcall(IXPConn *c, Fcall *fcall)
|
||||
{
|
||||
c->pend = (Fcall **)cext_array_attach((void **)c->pend, fcall, sizeof(Fcall *), &c->pendsz);
|
||||
Fcall *new = cext_emallocz(sizeof(Fcall));
|
||||
ixp_fcall_to_msg(fcall, msg, IXP_MAX_MSG);
|
||||
ixp_msg_to_fcall(msg, IXP_MAX_MSG, new);
|
||||
c->pend = (Fcall **)cext_array_attach((void **)c->pend,
|
||||
new, sizeof(Fcall *), &c->pendsz);
|
||||
}
|
||||
|
||||
Fcall *
|
||||
@ -125,6 +129,7 @@ ixp_server_dequeue_fcall(IXPConn *c, unsigned short id)
|
||||
cext_array_detach((void **)c->pend, fcall, &c->pendsz);
|
||||
break;
|
||||
}
|
||||
/* free it */
|
||||
return fcall;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user