i3
Macros | Functions | Variables
main.c File Reference
#include <ev.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <libgen.h>
#include "all.h"
#include "shmlog.h"
#include "sd-daemon.h"
#include "atoms.xmacro"
Include dependency graph for main.c:

Go to the source code of this file.

Macros

#define I3__FILE__   "main.c"
 
#define xmacro(atom)   xcb_intern_atom_cookie_t atom##_cookie = xcb_intern_atom(conn, 0, strlen(#atom), #atom);
 
#define xmacro(name)
 

Functions

static void xcb_got_event (EV_P_ struct ev_io *w, int revents)
 
static void xcb_prepare_cb (EV_P_ ev_prepare *w, int revents)
 
static void xcb_check_cb (EV_P_ ev_check *w, int revents)
 
void main_set_x11_cb (bool enable)
 Enable or disable the main X11 event handling function. More...
 
static void xkb_got_event (EV_P_ struct ev_io *w, int revents)
 
static void i3_exit (void)
 
static void handle_signal (int sig, siginfo_t *info, void *data)
 
int main (int argc, char *argv[])
 

Variables

struct rlimit original_rlimit_core
 The original value of RLIMIT_CORE when i3 was started. More...
 
int listen_fds
 The number of file descriptors passed via socket activation. More...
 
static struct ev_check * xcb_check
 
static int xkb_event_base
 
int xkb_current_group
 
Confocused
 
char ** start_argv
 
xcb_connection_t * conn
 
int conn_screen
 
SnDisplay * sndisplay
 
xcb_timestamp_t last_timestamp = XCB_CURRENT_TIME
 The last timestamp we got from X11 (timestamps are included in some events and are used for some things, like determining a unique ID in startup notification). More...
 
xcb_screen_t * root_screen
 
xcb_window_t root
 
uint8_t root_depth
 
xcb_visualid_t visual_id
 
xcb_colormap_t colormap
 
struct ev_loop * main_loop
 
xcb_key_symbols_t * keysyms
 
Display * xlibdpy
 
Display * xkbdpy
 
const int default_shmlog_size = 25 * 1024 * 1024
 
struct bindings_head * bindings
 
struct autostarts_head autostarts = TAILQ_HEAD_INITIALIZER(autostarts)
 
struct autostarts_always_head autostarts_always = TAILQ_HEAD_INITIALIZER(autostarts_always)
 
struct assignments_head assignments = TAILQ_HEAD_INITIALIZER(assignments)
 
struct ws_assignments_head ws_assignments = TAILQ_HEAD_INITIALIZER(ws_assignments)
 
bool xcursor_supported = true
 
bool xkb_supported = true
 
bool only_check_config = false
 

Macro Definition Documentation

#define I3__FILE__   "main.c"

Definition at line 2 of file main.c.

#define xmacro (   atom)    xcb_intern_atom_cookie_t atom##_cookie = xcb_intern_atom(conn, 0, strlen(#atom), #atom);
#define xmacro (   name)
Value:
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);
xcb_connection_t * conn
Definition: main.c:47
#define ELOG(fmt,...)
Definition: libi3.h:81

Function Documentation

static void handle_signal ( int  sig,
siginfo_t *  info,
void *  data 
)
static

Definition at line 261 of file main.c.

References shmlogname.

static void i3_exit ( void  )
static

Definition at line 240 of file main.c.

References main_loop, and shmlogname.

int main ( int  argc,
char *  argv[] 
)

Definition at line 268 of file main.c.

References __attribute__, aio_get_mod_mask_for(), check_error(), colormap, xoutput::con, con_descend_focused(), con_focus(), config, conn, conn_screen, default_shmlog_size, die, display_running_version(), DLOG, ELOG, ewmh_setup_hints(), ewmh_update_current_desktop(), ewmh_update_workarea(), Config::fake_outputs, fake_outputs_init(), Config::force_xinerama, FREE, get_first_output(), get_output_containing(), get_process_filename(), grab_all_keys(), handle_event(), height, init_logging(), ipc_create_socket(), ipc_new_client(), ipc_recv_message(), ipc_send_message(), Config::ipc_socket_path, is_debug_build(), keysyms, listen_fds, load_configuration(), LOG, main_loop, manage_existing_windows(), only_check_config, original_rlimit_core, output_get_content(), pixmap, property_handlers_init(), randr_base, randr_init(), restore_connect(), root, root_atom_contents(), root_depth, ROOT_EVENT_MASK, root_screen, sasprintf(), scalloc(), scratchpad_fix_resolution(), sd_listen_fds(), SD_LISTEN_FDS_START, set_debug_logging(), set_verbosity(), shmlog_size, smalloc(), sndisplay, srealloc(), sstrdup(), start_argv, translate_keysyms(), tree_init(), tree_render(), tree_restore(), visual_id, width, x_set_i3_atoms(), xcb_check, xcb_check_cb(), xcb_got_event(), XCB_NUM_LOCK, xcb_numlock_mask, xcb_prepare_cb(), xcb_set_root_cursor(), XCURSOR_CURSOR_POINTER, xcursor_load_cursors(), xcursor_set_root_cursor(), xcursor_supported, xinerama_init(), xkb_event_base, xkb_got_event(), xkb_supported, xkbdpy, and xlibdpy.

Here is the call graph for this function:

void main_set_x11_cb ( bool  enable)

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.

Definition at line 157 of file main.c.

References DLOG, main_loop, and xcb_check.

Referenced by drag_pointer().

static void xcb_check_cb ( EV_P_ ev_check *  w,
int  revents 
)
static

Definition at line 126 of file main.c.

References conn, DLOG, event_is_ignored(), and handle_event().

Referenced by main().

Here is the call graph for this function:

static void xcb_got_event ( EV_P_ struct ev_io *  w,
int  revents 
)
static

Definition at line 109 of file main.c.

Referenced by main().

static void xcb_prepare_cb ( EV_P_ ev_prepare *  w,
int  revents 
)
static

Definition at line 117 of file main.c.

References conn.

Referenced by main().

static void xkb_got_event ( EV_P_ struct ev_io *  w,
int  revents 
)
static

Definition at line 174 of file main.c.

References aio_get_mod_mask_for(), conn, DLOG, ELOG, grab_all_keys(), keysyms, translate_keysyms(), ungrab_all_keys(), XCB_NUM_LOCK, xcb_numlock_mask, xkb_current_group, xkb_event_base, and xkbdpy.

Referenced by main().

Here is the call graph for this function:

Variable Documentation

struct assignments_head assignments = TAILQ_HEAD_INITIALIZER(assignments)

Definition at line 89 of file main.c.

Referenced by assignment_for(), CFGFUN(), load_configuration(), and run_assignments().

struct autostarts_head autostarts = TAILQ_HEAD_INITIALIZER(autostarts)

Definition at line 83 of file main.c.

Referenced by CFGFUN().

struct autostarts_always_head autostarts_always = TAILQ_HEAD_INITIALIZER(autostarts_always)

Definition at line 86 of file main.c.

Referenced by CFGFUN().

struct bindings_head* bindings
xcb_colormap_t colormap

Definition at line 67 of file main.c.

Referenced by main(), and x_con_init().

xcb_connection_t* conn
int conn_screen

Definition at line 49 of file main.c.

Referenced by display_running_version(), main(), property_handlers_init(), and start_application().

const int default_shmlog_size = 25 * 1024 * 1024

Definition at line 77 of file main.c.

Referenced by cmd_shmlog(), and main().

Con* focused
xcb_key_symbols_t* keysyms
xcb_timestamp_t last_timestamp = XCB_CURRENT_TIME

The last timestamp we got from X11 (timestamps are included in some events and are used for some things, like determining a unique ID in startup notification).

Definition at line 57 of file main.c.

Referenced by handle_button_press(), handle_enter_notify(), handle_event(), handle_key_press(), handle_motion_notify(), start_application(), and x_push_changes().

int listen_fds

The number of file descriptors passed via socket activation.

Definition at line 33 of file main.c.

Referenced by main(), and start_application().

struct ev_loop* main_loop
bool only_check_config = false

Definition at line 102 of file main.c.

Referenced by main().

struct rlimit original_rlimit_core

The original value of RLIMIT_CORE when i3 was started.

We need to restore this before starting any other process, since we set RLIMIT_CORE to RLIM_INFINITY for i3 debugging versions.

Definition at line 30 of file main.c.

Referenced by main(), and start_application().

xcb_window_t root
uint8_t root_depth
xcb_screen_t* root_screen
SnDisplay* sndisplay

Definition at line 52 of file main.c.

Referenced by handle_client_message(), main(), property_handlers_init(), and start_application().

char** start_argv

Definition at line 45 of file main.c.

Referenced by backtrace(), exec_i3_utility(), i3_restart(), and main().

xcb_visualid_t visual_id

Definition at line 66 of file main.c.

Referenced by main().

struct ws_assignments_head ws_assignments = TAILQ_HEAD_INITIALIZER(ws_assignments)
struct ev_check* xcb_check
static

Definition at line 37 of file main.c.

Referenced by main(), main_set_x11_cb(), and restore_connect().

bool xcursor_supported = true
int xkb_current_group

Definition at line 41 of file main.c.

Referenced by get_binding_from_xcb_event(), and xkb_got_event().

int xkb_event_base
static

Definition at line 39 of file main.c.

Referenced by main(), and xkb_got_event().

bool xkb_supported = true

Definition at line 97 of file main.c.

Referenced by main().

Display * xkbdpy

Definition at line 74 of file main.c.

Referenced by main(), and xkb_got_event().

Display* xlibdpy

Definition at line 74 of file main.c.

Referenced by main().