/** The number of file descriptors passed via socket activation. */
int listen_fds;
+/* We keep the xcb_check watcher around to be able to enable and disable it
+ * temporarily for drag_pointer(). */
+static struct ev_check *xcb_check;
+
static int xkb_event_base;
int xkb_current_group;
}
}
+/*
+ * Enable or disable the main X11 event handling function.
+ * This is used by drag_pointer() which has its own, modal event handler, which
+ * takes precedence over the normal event handler.
+ *
+ */
+void main_set_x11_cb(bool enable) {
+ DLOG("Setting main X11 callback to enabled=%d\n", enable);
+ if (enable) {
+ ev_check_start(main_loop, xcb_check);
+ /* Trigger the watcher explicitly to handle all remaining X11 events.
+ * drag_pointer()’s event handler exits in the middle of the loop. */
+ ev_feed_event(main_loop, xcb_check, 0);
+ } else {
+ ev_check_stop(main_loop, xcb_check);
+ }
+}
/*
* When using xmodmap to change the keyboard mapping, this event
init_logging();
/* On release builds, disable SHM logging by default. */
- shmlog_size = (is_debug_build() ? default_shmlog_size : 0);
+ shmlog_size = (is_debug_build() || strstr(argv[0], "i3-with-shmlog") != NULL ? default_shmlog_size : 0);
start_argv = argv;
}
}
+ restore_connect();
+
/* Setup NetWM atoms */
#define xmacro(name) \
do { \
struct ev_io *xcb_watcher = scalloc(sizeof(struct ev_io));
struct ev_io *xkb = scalloc(sizeof(struct ev_io));
- struct ev_check *xcb_check = scalloc(sizeof(struct ev_check));
+ xcb_check = scalloc(sizeof(struct ev_check));
struct ev_prepare *xcb_prepare = scalloc(sizeof(struct ev_prepare));
ev_io_init(xcb_watcher, xcb_got_event, xcb_get_file_descriptor(conn), EV_READ);