mirror of
https://github.com/vale981/spectrwm
synced 2025-03-06 02:01:42 -05:00
somehow if( and for( remained in the code borrowed from dwm. Kill that dead.
This commit is contained in:
parent
1ebdff4405
commit
8ad832c092
1 changed files with 22 additions and 22 deletions
44
scrotwm.c
44
scrotwm.c
|
@ -436,9 +436,9 @@ spawn(union arg *args)
|
||||||
* The double-fork construct avoids zombie processes and keeps the code
|
* The double-fork construct avoids zombie processes and keeps the code
|
||||||
* clean from stupid signal handlers.
|
* clean from stupid signal handlers.
|
||||||
*/
|
*/
|
||||||
if(fork() == 0) {
|
if (fork() == 0) {
|
||||||
if(fork() == 0) {
|
if (fork() == 0) {
|
||||||
if(display)
|
if (display)
|
||||||
close(ConnectionNumber(display));
|
close(ConnectionNumber(display));
|
||||||
setsid();
|
setsid();
|
||||||
execvp(args->argv[0], args->argv);
|
execvp(args->argv[0], args->argv);
|
||||||
|
@ -1087,9 +1087,9 @@ grabkeys(void)
|
||||||
updatenumlockmask();
|
updatenumlockmask();
|
||||||
|
|
||||||
XUngrabKey(display, AnyKey, AnyModifier, root);
|
XUngrabKey(display, AnyKey, AnyModifier, root);
|
||||||
for(i = 0; i < LENGTH(keys); i++) {
|
for (i = 0; i < LENGTH(keys); i++) {
|
||||||
if((code = XKeysymToKeycode(display, keys[i].keysym)))
|
if ((code = XKeysymToKeycode(display, keys[i].keysym)))
|
||||||
for(j = 0; j < LENGTH(modifiers); j++)
|
for (j = 0; j < LENGTH(modifiers); j++)
|
||||||
XGrabKey(display, code,
|
XGrabKey(display, code,
|
||||||
keys[i].mod | modifiers[j], root,
|
keys[i].mod | modifiers[j], root,
|
||||||
True, GrabModeAsync, GrabModeAsync);
|
True, GrabModeAsync, GrabModeAsync);
|
||||||
|
@ -1111,8 +1111,8 @@ keypress(XEvent *e)
|
||||||
DNPRINTF(SWM_D_EVENT, "keypress: window: %lu\n", ev->window);
|
DNPRINTF(SWM_D_EVENT, "keypress: window: %lu\n", ev->window);
|
||||||
|
|
||||||
keysym = XKeycodeToKeysym(display, (KeyCode)ev->keycode, 0);
|
keysym = XKeycodeToKeysym(display, (KeyCode)ev->keycode, 0);
|
||||||
for(i = 0; i < LENGTH(keys); i++)
|
for (i = 0; i < LENGTH(keys); i++)
|
||||||
if(keysym == keys[i].keysym
|
if (keysym == keys[i].keysym
|
||||||
&& CLEANMASK(keys[i].mod) == CLEANMASK(ev->state)
|
&& CLEANMASK(keys[i].mod) == CLEANMASK(ev->state)
|
||||||
&& keys[i].func)
|
&& keys[i].func)
|
||||||
keys[i].func(&(keys[i].args));
|
keys[i].func(&(keys[i].args));
|
||||||
|
@ -1190,14 +1190,14 @@ manage_window(Window id)
|
||||||
|
|
||||||
/* XXX */
|
/* XXX */
|
||||||
bzero(&ch, sizeof ch);
|
bzero(&ch, sizeof ch);
|
||||||
if(XGetClassHint(display, win->id, &ch)) {
|
if (XGetClassHint(display, win->id, &ch)) {
|
||||||
/*fprintf(stderr, "class: %s name: %s\n", ch.res_class, ch.res_name); */
|
/*fprintf(stderr, "class: %s name: %s\n", ch.res_class, ch.res_name); */
|
||||||
if (!strcmp(ch.res_class, "MPlayer") && !strcmp(ch.res_name, "xv")) {
|
if (!strcmp(ch.res_class, "MPlayer") && !strcmp(ch.res_name, "xv")) {
|
||||||
win->floating = 1;
|
win->floating = 1;
|
||||||
}
|
}
|
||||||
if(ch.res_class)
|
if (ch.res_class)
|
||||||
XFree(ch.res_class);
|
XFree(ch.res_class);
|
||||||
if(ch.res_name)
|
if (ch.res_name)
|
||||||
XFree(ch.res_name);
|
XFree(ch.res_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1287,7 +1287,7 @@ enternotify(XEvent *e)
|
||||||
|
|
||||||
DNPRINTF(SWM_D_EVENT, "enternotify: window: %lu\n", ev->window);
|
DNPRINTF(SWM_D_EVENT, "enternotify: window: %lu\n", ev->window);
|
||||||
|
|
||||||
if((ev->mode != NotifyNormal || ev->detail == NotifyInferior) &&
|
if ((ev->mode != NotifyNormal || ev->detail == NotifyInferior) &&
|
||||||
ev->window != root)
|
ev->window != root)
|
||||||
return;
|
return;
|
||||||
if (ignore_enter) {
|
if (ignore_enter) {
|
||||||
|
@ -1331,7 +1331,7 @@ mappingnotify(XEvent *e)
|
||||||
DNPRINTF(SWM_D_EVENT, "mappingnotify: window: %lu\n", ev->window);
|
DNPRINTF(SWM_D_EVENT, "mappingnotify: window: %lu\n", ev->window);
|
||||||
|
|
||||||
XRefreshKeyboardMapping(ev);
|
XRefreshKeyboardMapping(ev);
|
||||||
if(ev->request == MappingKeyboard)
|
if (ev->request == MappingKeyboard)
|
||||||
grabkeys();
|
grabkeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1344,9 +1344,9 @@ maprequest(XEvent *e)
|
||||||
DNPRINTF(SWM_D_EVENT, "maprequest: window: %lu\n",
|
DNPRINTF(SWM_D_EVENT, "maprequest: window: %lu\n",
|
||||||
e->xmaprequest.window);
|
e->xmaprequest.window);
|
||||||
|
|
||||||
if(!XGetWindowAttributes(display, ev->window, &wa))
|
if (!XGetWindowAttributes(display, ev->window, &wa))
|
||||||
return;
|
return;
|
||||||
if(wa.override_redirect)
|
if (wa.override_redirect)
|
||||||
return;
|
return;
|
||||||
manage_window(e->xmaprequest.window);
|
manage_window(e->xmaprequest.window);
|
||||||
stack();
|
stack();
|
||||||
|
@ -1415,7 +1415,7 @@ active_wm(void)
|
||||||
XSelectInput(display, DefaultRootWindow(display),
|
XSelectInput(display, DefaultRootWindow(display),
|
||||||
SubstructureRedirectMask);
|
SubstructureRedirectMask);
|
||||||
XSync(display, False);
|
XSync(display, False);
|
||||||
if(other_wm)
|
if (other_wm)
|
||||||
return (1);
|
return (1);
|
||||||
|
|
||||||
XSetErrorHandler(xerror);
|
XSetErrorHandler(xerror);
|
||||||
|
@ -1435,9 +1435,9 @@ getstate(Window w)
|
||||||
astate = XInternAtom(display, "WM_STATE", False);
|
astate = XInternAtom(display, "WM_STATE", False);
|
||||||
status = XGetWindowProperty(display, w, astate, 0L, 2L, False, astate,
|
status = XGetWindowProperty(display, w, astate, 0L, 2L, False, astate,
|
||||||
&real, &format, &n, &extra, (unsigned char **)&p);
|
&real, &format, &n, &extra, (unsigned char **)&p);
|
||||||
if(status != Success)
|
if (status != Success)
|
||||||
return (-1);
|
return (-1);
|
||||||
if(n != 0)
|
if (n != 0)
|
||||||
result = *p;
|
result = *p;
|
||||||
XFree(p);
|
XFree(p);
|
||||||
return (result);
|
return (result);
|
||||||
|
@ -1456,10 +1456,10 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
start_argv = argv;
|
start_argv = argv;
|
||||||
fprintf(stderr, "Welcome to scrotwm V%s\n", SWM_VERSION);
|
fprintf(stderr, "Welcome to scrotwm V%s\n", SWM_VERSION);
|
||||||
if(!setlocale(LC_CTYPE, "") || !XSupportsLocale())
|
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
|
||||||
warnx("no locale support");
|
warnx("no locale support");
|
||||||
|
|
||||||
if(!(display = XOpenDisplay(0)))
|
if (!(display = XOpenDisplay(0)))
|
||||||
errx(1, "can not open display");
|
errx(1, "can not open display");
|
||||||
|
|
||||||
if (active_wm())
|
if (active_wm())
|
||||||
|
@ -1521,14 +1521,14 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
/* transient windows */
|
/* transient windows */
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
if(!XGetWindowAttributes(display, wins[i], &wa))
|
if (!XGetWindowAttributes(display, wins[i], &wa))
|
||||||
continue;
|
continue;
|
||||||
if (XGetTransientForHint(display, wins[i], &d1) &&
|
if (XGetTransientForHint(display, wins[i], &d1) &&
|
||||||
(wa.map_state == IsViewable || getstate(wins[i]) ==
|
(wa.map_state == IsViewable || getstate(wins[i]) ==
|
||||||
NormalState))
|
NormalState))
|
||||||
manage_window(wins[i]);
|
manage_window(wins[i]);
|
||||||
}
|
}
|
||||||
if(wins)
|
if (wins)
|
||||||
XFree(wins);
|
XFree(wins);
|
||||||
}
|
}
|
||||||
ws[0].focus = TAILQ_FIRST(&ws[0].winlist);
|
ws[0].focus = TAILQ_FIRST(&ws[0].winlist);
|
||||||
|
|
Loading…
Add table
Reference in a new issue