1 /* evilwm - Minimalist Window Manager for X
2 * Copyright (C) 1999-2009 Ciaran Anscomb <evilwm@6809.org.uk>
3 * see README for license and other details. */
5 #include <X11/Xproto.h>
14 int need_client_tidy
= 0;
15 int ignore_xerror
= 0;
17 /* Now do this by fork()ing twice so we don't have to worry about SIGCHLDs */
18 void spawn(const char *const cmd
[]) {
19 ScreenInfo
*current_screen
= find_current_screen();
22 if (current_screen
&& current_screen
->display
)
23 putenv(current_screen
->display
);
24 if (!(pid
= fork())) {
27 /* Expect compiler warnings because of half-broken SUS
28 * execvp prototype: "char *const argv[]" should have
29 * been "const char *const argv[]", but the committee
30 * favored legacy code over modern code, and modern
31 * compilers bark at our extra const. (LD) */
32 case 0: execvp(cmd
[0], cmd
+1);
40 void handle_signal(int signo
) {
41 (void)signo
; /* unused */
45 int handle_xerror(Display
*dsply
, XErrorEvent
*e
) {
47 (void)dsply
; /* unused */
49 LOG_ENTER("handle_xerror(error=%d, request=%d/%d, resourceid=%lx)", e
->error_code
, e
->request_code
, e
->minor_code
, e
->resourceid
);
52 LOG_DEBUG("ignoring...\n");
56 /* If this error actually occurred while setting up the new
57 * window, best let make_new_client() know not to bother */
58 if (initialising
!= None
&& e
->resourceid
== initialising
) {
59 LOG_DEBUG("error caught while initialising window=%lx\n", initialising
);
64 if (e
->error_code
== BadAccess
&& e
->request_code
== X_ChangeWindowAttributes
) {
65 LOG_ERROR("root window unavailable (maybe another wm is running?)\n");
69 c
= find_client(e
->resourceid
);
71 LOG_DEBUG("flagging client for removal\n");
75 LOG_DEBUG("unknown error: not handling\n");