Wmfs: Simplify mainloop()
This commit is contained in:
parent
92156f050d
commit
8bdc1a6294
16
src/client.c
16
src/client.c
@ -409,10 +409,11 @@ Client*
|
||||
client_manage(Window w, XWindowAttributes *wa, Bool ar)
|
||||
{
|
||||
Client *c, *t = NULL;
|
||||
Window trans;
|
||||
Window trans, dw;
|
||||
Status rettrans;
|
||||
XSetWindowAttributes at;
|
||||
int mx, my;
|
||||
int mx, my, dint;
|
||||
uint duint;
|
||||
|
||||
screen_get_sel();
|
||||
|
||||
@ -422,10 +423,6 @@ client_manage(Window w, XWindowAttributes *wa, Bool ar)
|
||||
|
||||
if(conf.client.place_at_mouse)
|
||||
{
|
||||
int dint;
|
||||
uint duint;
|
||||
Window dw;
|
||||
|
||||
XQueryPointer(dpy, ROOT, &dw, &dw, &mx, &my, &dint, &dint, &duint);
|
||||
|
||||
mx += BORDH;
|
||||
@ -466,8 +463,10 @@ client_manage(Window w, XWindowAttributes *wa, Bool ar)
|
||||
|
||||
if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success))
|
||||
for(t = clients; t && t->win != trans; t = t->next);
|
||||
if(t) c->tag = t->tag;
|
||||
if(!c->free) c->free = (rettrans == Success) || c->hint;
|
||||
if(t)
|
||||
c->tag = t->tag;
|
||||
if(!c->free)
|
||||
c->free = (rettrans == Success) || c->hint;
|
||||
free(t);
|
||||
|
||||
client_attach(c);
|
||||
@ -812,3 +811,4 @@ client_unmap(Client *c)
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
21
src/wmfs.c
21
src/wmfs.c
@ -38,7 +38,7 @@ errorhandler(Display *d, XErrorEvent *event)
|
||||
char mess[256];
|
||||
Client *c;
|
||||
|
||||
/* Check if there are another WM running */
|
||||
/* Check if there is another WM running */
|
||||
if(BadAccess == event->error_code
|
||||
&& ROOT == event->resourceid)
|
||||
{
|
||||
@ -149,23 +149,9 @@ void
|
||||
mainloop(void)
|
||||
{
|
||||
XEvent ev;
|
||||
fd_set fd;
|
||||
|
||||
while(!exiting)
|
||||
{
|
||||
if(QLength(dpy) > 0)
|
||||
XNextEvent(dpy, &ev);
|
||||
else
|
||||
{
|
||||
XFlush(dpy);
|
||||
FD_ZERO(&fd);
|
||||
FD_SET(ConnectionNumber(dpy), &fd);
|
||||
ev.type = LASTEvent;
|
||||
if(select(FD_SETSIZE, &fd, NULL, NULL, NULL) > 0)
|
||||
XNextEvent(dpy, &ev);
|
||||
}
|
||||
while(!exiting && !XNextEvent(dpy, &ev))
|
||||
getevent(ev);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
@ -280,7 +266,7 @@ check_wmfs_running(void)
|
||||
{
|
||||
XFree(ret);
|
||||
|
||||
fprintf(stderr, "Wmfs is not running. ( _WMFS_RUNNING not present)\n");
|
||||
fprintf(stderr, "Wmfs is not running. (_WMFS_RUNNING not present)\n");
|
||||
|
||||
return False;
|
||||
}
|
||||
@ -318,7 +304,6 @@ exec_uicb_function(char *func, char *cmd)
|
||||
XChangeProperty(dpy, ROOT, ATOM("_WMFS_CMD"), ATOM("UTF8_STRING"),
|
||||
8, PropModeReplace, (uchar*)cmd, strlen(cmd));
|
||||
|
||||
|
||||
ev.xclient.type = ClientMessage;
|
||||
ev.xclient.serial = 0;
|
||||
ev.xclient.send_event = True;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user