i3
Defines | Functions | Variables
src/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 "all.h"
#include "sd-daemon.h"
#include "atoms.xmacro"
Include dependency graph for main.c:

Go to the source code of this file.

Defines

#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)
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.
bool debug_build = false
 Whether this version of i3 is a debug build or a release build.
int listen_fds
 The number of file descriptors passed via socket activation.
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).
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
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

Define Documentation

#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);

Function Documentation

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

Definition at line 236 of file main.c.

References shmlogname.

Referenced by main().

static void i3_exit ( void  ) [static]

Definition at line 215 of file main.c.

References main_loop, and shmlogname.

Referenced by main().

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

Definition at line 246 of file main.c.

References add_loglevel(), aio_get_mod_mask_for(), autostarts, autostarts_always, barconfigs, check_error(), colormap, Autostart::command, xoutput::con, con_descend_focused(), con_focus(), config, conn, conn_screen, current_socketpath, debug_build, die, DLOG, ELOG, ewmh_setup_hints(), Config::fake_outputs, fake_outputs_init(), Config::force_xinerama, FREE, get_first_output(), get_output_containing(), get_process_filename(), grab_all_keys(), handle_signal(), i3_exit(), Barconfig::i3bar_command, Barconfig::id, init_logging(), ipc_create_socket(), ipc_new_client(), ipc_recv_message(), ipc_send_message(), Config::ipc_socket_path, keysyms, listen_fds, load_configuration(), LOG, main_loop, manage_existing_windows(), Autostart::no_startup_id, only_check_config, original_rlimit_core, output_get_content(), property_handlers_init(), randr_base, randr_init(), root, root_atom_contents(), root_depth, root_screen, sasprintf(), scalloc(), sd_listen_fds(), SD_LISTEN_FDS_START, set_verbosity(), setup_signal_handler(), shmlog_size, sndisplay, sstrdup(), start_application(), start_argv, TAILQ_FOREACH, translate_keysyms(), tree_init(), tree_render(), tree_restore(), visual_id, x_set_i3_atoms(), 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:

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

Definition at line 118 of file main.c.

References conn, DLOG, ELOG, 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 101 of file main.c.

Referenced by main().

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

Definition at line 109 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 149 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 81 of file main.c.

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

struct autostarts_head autostarts = TAILQ_HEAD_INITIALIZER(autostarts)

Definition at line 75 of file main.c.

Referenced by main(), parse_file(), and yyparse().

Definition at line 78 of file main.c.

Referenced by main(), parse_file(), and yyparse().

struct bindings_head* bindings
xcb_colormap_t colormap

Definition at line 62 of file main.c.

Referenced by main(), and x_con_init().

xcb_connection_t* conn

Definition at line 44 of file main.c.

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

bool debug_build = false

Whether this version of i3 is a debug build or a release build.

Definition at line 29 of file main.c.

Referenced by main().

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 52 of file main.c.

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

The number of file descriptors passed via socket activation.

Definition at line 32 of file main.c.

Referenced by main(), and start_application().

struct ev_loop* main_loop

Definition at line 64 of file main.c.

Referenced by i3_exit(), main(), start_application(), and start_configerror_nagbar().

bool only_check_config = false

Definition at line 94 of file main.c.

Referenced by main(), and start_configerror_nagbar().

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 26 of file main.c.

Referenced by main(), and start_application().

xcb_window_t root
uint8_t root_depth

Definition at line 60 of file main.c.

Referenced by handle_signal(), main(), x_con_init(), and x_push_node().

xcb_screen_t* root_screen

Definition at line 54 of file main.c.

Referenced by disable_randr(), get_visual_depth(), get_visualid_by_depth(), main(), and x_con_init().

SnDisplay* sndisplay

Definition at line 47 of file main.c.

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

char** start_argv

Definition at line 40 of file main.c.

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

xcb_visualid_t visual_id

Definition at line 61 of file main.c.

Referenced by main().

struct ws_assignments_head ws_assignments = TAILQ_HEAD_INITIALIZER(ws_assignments)
bool xcursor_supported = true

Definition at line 88 of file main.c.

Referenced by create_window(), load_cursor(), main(), start_application(), and startup_monitor_event().

Definition at line 36 of file main.c.

Referenced by handle_key_press(), and xkb_got_event().

int xkb_event_base [static]

Definition at line 34 of file main.c.

Referenced by main(), and xkb_got_event().

bool xkb_supported = true

Definition at line 89 of file main.c.

Referenced by main().

Display * xkbdpy

Definition at line 69 of file main.c.

Referenced by main(), and xkb_got_event().

Display* xlibdpy

Definition at line 69 of file main.c.

Referenced by load_cursor(), main(), and xcursor_set_root_cursor().