1404 } |
1404 } |
1405 |
1405 |
1406 void |
1406 void |
1407 run(void) { |
1407 run(void) { |
1408 XEvent ev; |
1408 XEvent ev; |
1409 static const char *evname[LASTEvent] = { |
|
1410 [ButtonPress] = "buttonpress", |
|
1411 [ClientMessage] = "clientmessage", |
|
1412 [ConfigureRequest] = "configurerequest", |
|
1413 [ConfigureNotify] = "configurenotify", |
|
1414 [DestroyNotify] = "destroynotify", |
|
1415 [EnterNotify] = "enternotify", |
|
1416 [Expose] = "expose", |
|
1417 [FocusIn] = "focusin", |
|
1418 [KeyPress] = "keypress", |
|
1419 [MappingNotify] = "mappingnotify", |
|
1420 [MapRequest] = "maprequest", |
|
1421 [PropertyNotify] = "propertynotify", |
|
1422 [UnmapNotify] = "unmapnotify" |
|
1423 }; |
|
1424 /* main event loop */ |
1409 /* main event loop */ |
1425 XSync(dpy, False); |
1410 XSync(dpy, False); |
1426 while(running && !XNextEvent(dpy, &ev)) { |
1411 while(running && !XNextEvent(dpy, &ev)) { |
1427 if(handler[ev.type]) |
1412 if(handler[ev.type]) |
1428 handler[ev.type](&ev); /* call handler */ |
1413 handler[ev.type](&ev); /* call handler */ |
2034 } |
2019 } |
2035 |
2020 |
2036 int |
2021 int |
2037 main(int argc, char *argv[]) { |
2022 main(int argc, char *argv[]) { |
2038 if(argc == 2 && !strcmp("-v", argv[1])) |
2023 if(argc == 2 && !strcmp("-v", argv[1])) |
2039 die("dwm-"VERSION", © 2006-2009 dwm engineers, see LICENSE for details\n"); |
2024 die("dwm-"VERSION", © 2006-2010 dwm engineers, see LICENSE for details\n"); |
2040 else if(argc != 1) |
2025 else if(argc != 1) |
2041 die("usage: dwm [-v]\n"); |
2026 die("usage: dwm [-v]\n"); |
2042 if(!setlocale(LC_CTYPE, "") || !XSupportsLocale()) |
2027 if(!setlocale(LC_CTYPE, "") || !XSupportsLocale()) |
2043 fputs("warning: no locale support\n", stderr); |
2028 fputs("warning: no locale support\n", stderr); |
2044 if(!(dpy = XOpenDisplay(NULL))) |
2029 if(!(dpy = XOpenDisplay(NULL))) |