i3
Macros | Functions | Variables
key_press.c File Reference
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <fcntl.h>
#include "all.h"
Include dependency graph for key_press.c:

Go to the source code of this file.

Macros

#define I3__FILE__   "key_press.c"
 

Functions

static void nagbar_exited (EV_P_ ev_child *watcher, int revents)
 
static bool write_nagbar_script (const char *path, const char *command)
 
static void start_commanderror_nagbar (void)
 
void kill_commanderror_nagbar (bool wait_for_it)
 Kills the commanderror i3-nagbar process, if any.
 
static int json_boolean (void *ctx, int boolval)
 
static int json_map_key (void *ctx, const unsigned char *stringval, unsigned int stringlen)
 
static int json_start_map (void *ctx)
 
static int json_end_map (void *ctx)
 
void handle_key_press (xcb_key_press_event_t *event)
 There was a key press.
 

Variables

static int current_nesting_level
 
static bool parse_error_key
 
static bool command_failed
 
static char * pager_script_path
 
static pid_t nagbar_pid = -1
 
static yajl_callbacks command_error_callbacks
 

Macro Definition Documentation

#define I3__FILE__   "key_press.c"

Definition at line 2 of file key_press.c.

Function Documentation

void handle_key_press ( xcb_key_press_event_t *  event)

There was a key press.

We compare this key code with our bindings table and pass the bound action to parse_command().

Definition at line 235 of file key_press.c.

References BIND_MODE_SWITCH, Binding::command, command_failed, command_output, current_nesting_level, DLOG, ELOG, get_binding(), CommandResult::json_gen, last_timestamp, CommandResult::needs_tree_render, parse_command(), parse_error_key, sstrdup(), start_commanderror_nagbar(), state, tree_render(), xcb_numlock_mask, and xkb_current_group.

Referenced by handle_event().

Here is the call graph for this function:

static int json_boolean ( void *  ctx,
int  boolval 
)
static

Definition at line 186 of file key_press.c.

References command_failed, current_nesting_level, DLOG, and parse_error_key.

static int json_end_map ( void *  ctx)
static

Definition at line 210 of file key_press.c.

References current_nesting_level.

static int json_map_key ( void *  ctx,
const unsigned char *  stringval,
unsigned int  stringlen 
)
static

Definition at line 198 of file key_press.c.

References parse_error_key.

static int json_start_map ( void *  ctx)
static

Definition at line 205 of file key_press.c.

References current_nesting_level.

Referenced by tree_append_json().

void kill_commanderror_nagbar ( bool  wait_for_it)

Kills the commanderror i3-nagbar process, if any.

Called when reloading/restarting, since the user probably fixed his wrong keybindings.

If wait_for_it is set (restarting), this function will waitpid(), otherwise, ev is assumed to handle it (reloading).

Definition at line 169 of file key_press.c.

References nagbar_pid.

Referenced by cmd_reload(), and i3_restart().

static void nagbar_exited ( EV_P_ ev_child *  watcher,
int  revents 
)
static

Definition at line 33 of file key_press.c.

References nagbar_pid, and pager_script_path.

Referenced by start_commanderror_nagbar().

static void start_commanderror_nagbar ( void  )
static

Definition at line 94 of file key_press.c.

References DLOG, errorfilename, exec_i3_utility(), get_process_filename(), main_loop, nagbar_exited(), nagbar_pid, pager_script_path, sasprintf(), smalloc(), and write_nagbar_script().

Referenced by handle_key_press().

Here is the call graph for this function:

static bool write_nagbar_script ( const char *  path,
const char *  command 
)
static

Definition at line 75 of file key_press.c.

Referenced by start_commanderror_nagbar().

Variable Documentation

yajl_callbacks command_error_callbacks
static
Initial value:
= {
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL
}

Definition at line 215 of file key_press.c.

bool command_failed
static

Definition at line 20 of file key_press.c.

Referenced by handle_key_press(), and json_boolean().

int current_nesting_level
static

Definition at line 18 of file key_press.c.

Referenced by handle_key_press(), json_boolean(), json_end_map(), and json_start_map().

pid_t nagbar_pid = -1
static

Definition at line 26 of file key_press.c.

Referenced by kill_commanderror_nagbar(), nagbar_exited(), and start_commanderror_nagbar().

char* pager_script_path
static

Definition at line 25 of file key_press.c.

Referenced by nagbar_exited(), and start_commanderror_nagbar().

bool parse_error_key
static

Definition at line 19 of file key_press.c.

Referenced by handle_key_press(), json_boolean(), and json_map_key().