i3
Macros | Functions | Variables
main.c File Reference
#include "all.h"
#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 "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 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 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
 
Confocused
 
char ** start_argv
 
xcb_connection_t * conn
 XCB connection and root screen. More...
 
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_visualtype_t * visual_type
 
xcb_colormap_t colormap
 
struct ev_loop * main_loop
 
xcb_key_symbols_t * keysyms
 
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
 

Macro Definition Documentation

◆ xmacro [1/2]

#define xmacro (   atom)    xcb_intern_atom_cookie_t atom##_cookie = xcb_intern_atom(conn, 0, strlen(#atom), #atom);

◆ xmacro [2/2]

#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
XCB connection and root screen.
Definition: main.c:46

Function Documentation

◆ handle_signal()

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

Definition at line 185 of file main.c.

References shmlogname.

Referenced by main().

◆ i3_exit()

static void i3_exit ( void  )
static

Definition at line 164 of file main.c.

References main_loop, and shmlogname.

Referenced by main().

◆ main()

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

Definition at line 192 of file main.c.

References __attribute__, xoutput::active, aio_get_mod_mask_for(), autostarts, autostarts_always, barconfigs, xoutput::changed, colormap, Autostart::command, xoutput::con, con_descend_focused(), con_focus(), config, conn, conn_screen, croot, current_socketpath, default_shmlog_size, die, Config::disable_randr15, display_running_version(), DLOG, ELOG, ewmh_setup_hints(), ewmh_update_current_desktop(), ewmh_update_desktop_names(), ewmh_update_desktop_viewport(), ewmh_update_number_of_desktops(), ewmh_update_workarea(), Config::fake_outputs, fake_outputs_init(), Config::force_xinerama, FREE, get_first_output(), get_output_containing(), get_process_filename(), get_visualtype(), grab_all_keys(), handle_event(), handle_signal(), height, i3_exit(), i3_version, Barconfig::i3bar_command, Barconfig::id, init_dpi(), 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(), load_keymap(), LOG, logical_px(), main_loop, manage_existing_windows(), Con::name, Autostart::no_startup_id, Con::nodes_head, only_check_config, original_rlimit_core, output_get_content(), output_init_con(), output_primary_name(), outputs, parse_configuration(), property_handlers_init(), randr_base, randr_disable_output(), 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(), setup_signal_handler(), shmlog_size, smalloc(), sndisplay, srealloc(), sstrdup(), start_application(), start_argv, TAILQ_EMPTY, TAILQ_FIRST, TAILQ_FOREACH, TAILQ_REMOVE, xoutput::to_be_disabled, translate_keysyms(), tree_init(), tree_render(), tree_restore(), visual_type, 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_base, and xkb_supported.

Referenced by command_result_free(), and parse_config().

◆ main_set_x11_cb()

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

References DLOG, main_loop, and xcb_check.

Referenced by drag_pointer().

◆ xcb_check_cb()

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

Definition at line 117 of file main.c.

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

Referenced by main().

Here is the call graph for this function:

◆ xcb_got_event()

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

Definition at line 100 of file main.c.

Referenced by main().

◆ xcb_prepare_cb()

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

Definition at line 108 of file main.c.

References conn.

Referenced by main().

Variable Documentation

◆ assignments

struct assignments_head assignments = TAILQ_HEAD_INITIALIZER(assignments)

Definition at line 85 of file main.c.

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

◆ autostarts

struct autostarts_head autostarts = TAILQ_HEAD_INITIALIZER(autostarts)

Definition at line 79 of file main.c.

Referenced by CFGFUN(), and main().

◆ autostarts_always

struct autostarts_always_head autostarts_always = TAILQ_HEAD_INITIALIZER(autostarts_always)

Definition at line 82 of file main.c.

Referenced by CFGFUN(), and main().

◆ bindings

struct bindings_head* bindings

◆ colormap

xcb_colormap_t colormap

Definition at line 66 of file main.c.

Referenced by main(), and x_con_init().

◆ conn

xcb_connection_t* conn

XCB connection and root screen.

Definition at line 46 of file main.c.

Referenced by _con_move_to_con(), cmd_exit(), cmd_reload(), con_set_fullscreen_mode(), display_running_version(), drag_pointer(), DRAGGING_CB(), ewmh_setup_hints(), ewmh_update_active_window(), ewmh_update_client_list(), ewmh_update_client_list_stacking(), ewmh_update_current_desktop(), ewmh_update_desktop_names(), ewmh_update_desktop_viewport(), ewmh_update_number_of_desktops(), ewmh_update_sticky(), ewmh_update_visible_name(), ewmh_update_wm_desktop_recursively(), ewmh_update_workarea(), fake_absolute_configure_notify(), fill_rmlvo_from_root(), floating_move_to_pointer(), floating_set_hint_atom(), get_resource(), handle_button_press(), handle_client_message(), handle_configure_request(), handle_event(), handle_expose_event(), handle_map_request(), handle_mapping_notify(), handle_screen_change(), handle_signal(), handle_unmap_notify_event(), load_keymap(), main(), manage_existing_windows(), manage_window(), open_placeholder_window(), property_notify(), randr_init(), randr_query_outputs(), randr_query_outputs_14(), randr_query_outputs_15(), resize_graphical_handler(), restore_geometry(), route_click(), send_take_focus(), set_hidden_state(), sighandler_create_dialogs(), sighandler_destroy_dialogs(), sighandler_handle_expose(), startup_sequence_get(), switch_mode(), tree_close_internal(), update_placeholder_contents(), update_shmlog_atom(), window_supports_protocol(), x_con_init(), x_con_kill(), x_mask_event_mask(), x_push_changes(), x_push_node(), x_push_node_unmaps(), x_set_i3_atoms(), x_window_kill(), xcb_check_cb(), xcb_drag_check_cb(), xcb_prepare_cb(), xcb_set_root_cursor(), xcursor_load_cursors(), xcursor_set_root_cursor(), and xinerama_init().

◆ conn_screen

int conn_screen

Definition at line 48 of file main.c.

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

◆ default_shmlog_size

const int default_shmlog_size = 25 * 1024 * 1024

Definition at line 73 of file main.c.

Referenced by cmd_shmlog(), and main().

◆ focused

Con* focused

◆ keysyms

xcb_key_symbols_t* keysyms

Definition at line 70 of file main.c.

Referenced by handle_event(), handle_mapping_notify(), main(), and sighandler_handle_key_press().

◆ last_timestamp

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

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

◆ listen_fds

int listen_fds

The number of file descriptors passed via socket activation.

Definition at line 36 of file main.c.

Referenced by main(), and start_application().

◆ main_loop

struct ev_loop* main_loop

◆ original_rlimit_core

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

Referenced by main(), and start_application().

◆ root

xcb_window_t root

◆ root_depth

uint8_t root_depth

Definition at line 64 of file main.c.

Referenced by con_new_skeleton(), main(), sighandler_create_dialogs(), x_con_init(), and x_push_node().

◆ root_screen

xcb_screen_t* root_screen

◆ sndisplay

SnDisplay* sndisplay

Definition at line 51 of file main.c.

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

◆ start_argv

char** start_argv

Definition at line 44 of file main.c.

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

◆ visual_type

xcb_visualtype_t* visual_type

Definition at line 65 of file main.c.

Referenced by main().

◆ ws_assignments

struct ws_assignments_head ws_assignments = TAILQ_HEAD_INITIALIZER(ws_assignments)

◆ xcb_check

struct ev_check* xcb_check
static

Definition at line 40 of file main.c.

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

◆ xcursor_supported

bool xcursor_supported = true

◆ xkb_supported

bool xkb_supported = true

Definition at line 93 of file main.c.

Referenced by load_keymap(), and main().