mirror of
https://github.com/0intro/wmii
synced 2024-12-17 09:02:37 +03:00
fixed missing respond in xclunk of wmiibar, now proceeding with wm
This commit is contained in:
parent
3728e6420f
commit
bdbc256a1b
@ -767,7 +767,8 @@ xclunk(IXPConn *c, Fcall *fcall)
|
||||
cext_array_detach((void **)c->map, m, &c->mapsz);
|
||||
free(m);
|
||||
fcall->id = RCLUNK;
|
||||
return 0;
|
||||
ixp_server_respond_fcall(c, fcall);
|
||||
return nil;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -795,16 +796,6 @@ do_fcall(IXPConn *c)
|
||||
}
|
||||
}
|
||||
|
||||
static Fcall *
|
||||
pending(IXPConn *c, unsigned char id)
|
||||
{
|
||||
size_t i;
|
||||
for(i = 0; (i < c->pendsz) && c->pend[i]; i++)
|
||||
if(c->pend[i]->id == id)
|
||||
return c->pend[i];
|
||||
return nil;
|
||||
}
|
||||
|
||||
static void
|
||||
do_pend_fcall(char *event)
|
||||
{
|
||||
@ -813,7 +804,7 @@ do_pend_fcall(char *event)
|
||||
for(i = 0; (i < srv.connsz) && srv.conn[i]; i++) {
|
||||
IXPConn *c = srv.conn[i];
|
||||
/* all pending TREADs are on /event, so no qid checking necessary */
|
||||
while((fcall = pending(c, TREAD))) {
|
||||
while((fcall = ixp_server_dequeue_fcall(c, TREAD))) {
|
||||
IXPMap *m = ixp_server_fid2map(c, fcall->fid);
|
||||
unsigned char *p = fcall->data;
|
||||
|
||||
@ -828,7 +819,6 @@ do_pend_fcall(char *event)
|
||||
if(ixp_server_respond_fcall(c, fcall))
|
||||
break;
|
||||
}
|
||||
cext_array_detach((void **)c->pend, fcall, &c->pendsz);
|
||||
free(fcall);
|
||||
}
|
||||
}
|
||||
@ -940,9 +930,7 @@ main(int argc, char *argv[])
|
||||
fprintf(stderr, "wmiibar: fatal: %s\n", errstr);
|
||||
|
||||
/* cleanup */
|
||||
for(i = 0; (i < srv.connsz) && srv.conn[i]; i++)
|
||||
if(srv.conn[i]->close)
|
||||
srv.conn[i]->close(srv.conn[i]);
|
||||
ixp_server_close(&srv);
|
||||
XCloseDisplay(dpy);
|
||||
|
||||
return errstr ? 1 : 0;
|
||||
|
@ -288,6 +288,8 @@ void ixp_server_enqueue_fcall(IXPConn *c, Fcall *fcall);
|
||||
unsigned int ixp_server_receive_fcall(IXPConn *c, Fcall *fcall);
|
||||
int ixp_server_respond_fcall(IXPConn *c, Fcall *fcall);
|
||||
int ixp_server_respond_error(IXPConn *c, Fcall *fcall, char *errstr);
|
||||
Fcall *ixp_server_dequeue_fcall(IXPConn *c, unsigned short id);
|
||||
void ixp_server_close(IXPServer *s);
|
||||
|
||||
/* socket.c */
|
||||
int ixp_connect_sock(char *address);
|
||||
|
@ -108,11 +108,26 @@ ixp_server_fid2map(IXPConn *c, unsigned int fid)
|
||||
return nil;
|
||||
}
|
||||
|
||||
void ixp_server_enqueue_fcall(IXPConn *c, Fcall *fcall)
|
||||
void
|
||||
ixp_server_enqueue_fcall(IXPConn *c, Fcall *fcall)
|
||||
{
|
||||
c->pend = (Fcall **)cext_array_attach((void **)c->pend, fcall, sizeof(Fcall *), &c->pendsz);
|
||||
}
|
||||
|
||||
Fcall *
|
||||
ixp_server_dequeue_fcall(IXPConn *c, unsigned short id)
|
||||
{
|
||||
Fcall *fcall = nil;
|
||||
size_t i;
|
||||
for(i = 0; (i < c->pendsz) && c->pend[i]; i++)
|
||||
if(c->pend[i]->id == id) {
|
||||
fcall = c->pend[i];
|
||||
cext_array_detach((void **)c->pend, fcall, &c->pendsz);
|
||||
break;
|
||||
}
|
||||
return fcall;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
ixp_server_receive_fcall(IXPConn *c, Fcall *fcall)
|
||||
{
|
||||
@ -153,3 +168,12 @@ ixp_server_respond_error(IXPConn *c, Fcall *fcall, char *errstr)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
ixp_server_close(IXPServer *s)
|
||||
{
|
||||
size_t i;
|
||||
for(i = 0; (i < s->connsz) && s->conn[i]; i++)
|
||||
if(s->conn[i]->close)
|
||||
s->conn[i]->close(s->conn[i]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user