X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fmain.c;h=4c5b5f18ced0aff76ae7b2838c89039dfe49673d;hb=94a09b3cac98a3bc1ed580fce16aa9869f83bbaa;hp=ac40e7a389bc2eb41c303a2dd28637e4fea8007c;hpb=4958ca00ab362056c0f90bc3a4346715f6dd333e;p=i3%2Fi3 diff --git a/src/main.c b/src/main.c index ac40e7a3..4c5b5f18 100644 --- a/src/main.c +++ b/src/main.c @@ -4,7 +4,7 @@ * vim:ts=4:sw=4:expandtab * * i3 - an improved dynamic tiling window manager - * © 2009-2013 Michael Stapelberg and contributors (see also: LICENSE) + * © 2009 Michael Stapelberg and contributors (see also: LICENSE) * * main.c: Initialization, main loop * @@ -261,11 +261,11 @@ int main(int argc, char *argv[]) { only_check_config = true; break; case 'v': - printf("i3 version %s © 2009-2014 Michael Stapelberg and contributors\n", i3_version); + printf("i3 version %s © 2009 Michael Stapelberg and contributors\n", i3_version); exit(EXIT_SUCCESS); break; case 'm': - printf("Binary i3 version: %s © 2009-2014 Michael Stapelberg and contributors\n", i3_version); + printf("Binary i3 version: %s © 2009 Michael Stapelberg and contributors\n", i3_version); display_running_version(); exit(EXIT_SUCCESS); break; @@ -450,7 +450,7 @@ int main(int argc, char *argv[]) { memset(cwd, '\0', cwd_size); if (read(patternfd, cwd, cwd_size) > 0) /* a trailing newline is included in cwd */ - LOG("CORE DUMPS: Your core_pattern is: %s", cwd); + LOG("CORE DUMPS: Your core_pattern is: \"%s\".\n", cwd); close(patternfd); } free(cwd); @@ -474,6 +474,12 @@ int main(int argc, char *argv[]) { root_screen = xcb_aux_get_screen(conn, conn_screen); root = root_screen->root; +/* Place requests for the atoms we need as soon as possible */ +#define xmacro(atom) \ + xcb_intern_atom_cookie_t atom##_cookie = xcb_intern_atom(conn, 0, strlen(#atom), #atom); +#include "atoms.xmacro" +#undef xmacro + /* By default, we use the same depth and visual as the root window, which * usually is TrueColor (24 bit depth) and the corresponding visual. * However, we also check if a 32 bit depth and visual are available (for @@ -491,6 +497,20 @@ int main(int argc, char *argv[]) { xcb_get_geometry_cookie_t gcookie = xcb_get_geometry(conn, root); xcb_query_pointer_cookie_t pointercookie = xcb_query_pointer(conn, root); +/* Setup NetWM atoms */ +#define xmacro(name) \ + do { \ + xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(conn, name##_cookie, NULL); \ + if (!reply) { \ + ELOG("Could not get atom " #name "\n"); \ + exit(-1); \ + } \ + A_##name = reply->atom; \ + free(reply); \ + } while (0); +#include "atoms.xmacro" +#undef xmacro + load_configuration(conn, override_configpath, false); if (config.ipc_socket_path == NULL) { @@ -512,12 +532,6 @@ int main(int argc, char *argv[]) { } DLOG("root geometry reply: (%d, %d) %d x %d\n", greply->x, greply->y, greply->width, greply->height); -/* Place requests for the atoms we need as soon as possible */ -#define xmacro(atom) \ - xcb_intern_atom_cookie_t atom##_cookie = xcb_intern_atom(conn, 0, strlen(#atom), #atom); -#include "atoms.xmacro" -#undef xmacro - xcursor_load_cursors(); /* Set a cursor for the root window (otherwise the root window will show no @@ -547,20 +561,6 @@ int main(int argc, char *argv[]) { restore_connect(); -/* Setup NetWM atoms */ -#define xmacro(name) \ - do { \ - xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(conn, name##_cookie, NULL); \ - if (!reply) { \ - ELOG("Could not get atom " #name "\n"); \ - exit(-1); \ - } \ - A_##name = reply->atom; \ - free(reply); \ - } while (0); -#include "atoms.xmacro" -#undef xmacro - property_handlers_init(); ewmh_setup_hints(); @@ -574,7 +574,7 @@ int main(int argc, char *argv[]) { bool needs_tree_init = true; if (layout_path) { - LOG("Trying to restore the layout from %s...", layout_path); + LOG("Trying to restore the layout from \"%s\".\n", layout_path); needs_tree_init = !tree_restore(layout_path, greply); if (delete_layout_path) { unlink(layout_path); @@ -621,6 +621,8 @@ int main(int argc, char *argv[]) { ELOG("ERROR: No screen at (%d, %d), starting on the first screen\n", pointerreply->root_x, pointerreply->root_y); output = get_first_output(); + if (!output) + die("No usable outputs available.\n"); } con_focus(con_descend_focused(output_get_content(output->con))); @@ -766,7 +768,7 @@ int main(int argc, char *argv[]) { sigaction(SIGABRT, &action, NULL) == -1 || sigaction(SIGFPE, &action, NULL) == -1 || sigaction(SIGSEGV, &action, NULL) == -1) - ELOG("Could not setup signal handler"); + ELOG("Could not setup signal handler.\n"); } /* Catch all signals with default action "Term", see signal(7) */ @@ -775,7 +777,7 @@ int main(int argc, char *argv[]) { sigaction(SIGALRM, &action, NULL) == -1 || sigaction(SIGUSR1, &action, NULL) == -1 || sigaction(SIGUSR2, &action, NULL) == -1) - ELOG("Could not setup signal handler"); + ELOG("Could not setup signal handler.\n"); /* Ignore SIGPIPE to survive errors when an IPC client disconnects * while we are sending them a message */