-#line 2 "main.c"
+#undef I3__FILE__
+#define I3__FILE__ "main.c"
/*
* vim:ts=4:sw=4:expandtab
*
{"no-autostart", no_argument, 0, 'a'},
{"config", required_argument, 0, 'c'},
{"version", no_argument, 0, 'v'},
+ {"moreversion", no_argument, 0, 'm'},
+ {"more-version", no_argument, 0, 'm'},
+ {"more_version", no_argument, 0, 'm'},
{"help", no_argument, 0, 'h'},
{"layout", required_argument, 0, 'L'},
{"restart", required_argument, 0, 0},
start_argv = argv;
- while ((opt = getopt_long(argc, argv, "c:CvaL:hld:V", long_options, &option_index)) != -1) {
+ while ((opt = getopt_long(argc, argv, "c:CvmaL:hld:V", long_options, &option_index)) != -1) {
switch (opt) {
case 'a':
LOG("Autostart disabled using -a\n");
case 'v':
printf("i3 version " I3_VERSION " © 2009-2012 Michael Stapelberg and contributors\n");
exit(EXIT_SUCCESS);
+ break;
+ case 'm':
+ printf("Binary i3 version: " I3_VERSION " © 2009-2012 Michael Stapelberg and contributors\n");
+ display_running_version();
+ exit(EXIT_SUCCESS);
+ break;
case 'V':
set_verbosity(true);
break;
fprintf(stderr, "\t--force-xinerama\n"
"\tUse Xinerama instead of RandR.\n"
"\tThis option should only be used if you are stuck with the\n"
- "\tnvidia closed source driver which does not support RandR.\n");
+ "\told nVidia closed source driver (older than 302.17), which does\n"
+ "\tnot support RandR.\n");
fprintf(stderr, "\n");
fprintf(stderr, "\t--get-socketpath\n"
"\tRetrieve the i3 IPC socket path from X11, print it, then exit.\n");
}
}
- LOG("i3 (tree) version " I3_VERSION " starting\n");
+ LOG("i3 " I3_VERSION " starting\n");
conn = xcb_connect(NULL, &conn_screen);
if (xcb_connection_has_error(conn))
xcb_flush(conn);
- manage_existing_windows(root);
+ /* What follows is a fugly consequence of X11 protocol race conditions like
+ * the following: In an i3 in-place restart, i3 will reparent all windows
+ * to the root window, then exec() itself. In the new process, it calls
+ * manage_existing_windows. However, in case any application sent a
+ * generated UnmapNotify message to the WM (as GIMP does), this message
+ * will be handled by i3 *after* managing the window, thus i3 thinks the
+ * window just closed itself. In reality, the message was sent in the time
+ * period where i3 wasn’t running yet.
+ *
+ * To prevent this, we grab the server (disables processing of any other
+ * connections), then discard all pending events (since we didn’t do
+ * anything, there cannot be any meaningful responses), then ungrab the
+ * server. */
+ xcb_grab_server(conn);
+ {
+ xcb_aux_sync(conn);
+ xcb_generic_event_t *event;
+ while ((event = xcb_poll_for_event(conn)) != NULL) {
+ free(event);
+ }
+ manage_existing_windows(root);
+ }
+ xcb_ungrab_server(conn);
struct sigaction action;