i3
|
#include "all.h"
#include "yajl_utils.h"
#include <sys/socket.h>
#include <sys/un.h>
#include <fcntl.h>
#include <libgen.h>
#include <ev.h>
#include <yajl/yajl_gen.h>
#include <yajl/yajl_parse.h>
Go to the source code of this file.
Macros | |
#define | I3__FILE__ "ipc.c" |
#define | YSTR_IF_SET(name) |
#define | YSTR_IF_SET(name) |
Functions | |
TAILQ_HEAD (ipc_client_head, ipc_client) | |
static bool | mkdirp (const char *path) |
void | ipc_send_event (const char *event, uint32_t message_type, const char *payload) |
Sends the specified event to all IPC clients which are currently connected and subscribed to this kind of event. More... | |
void | ipc_shutdown (void) |
Calls shutdown() on each socket and closes it. More... | |
IPC_HANDLER (command) | |
static void | dump_rect (yajl_gen gen, const char *name, Rect r) |
void | dump_node (yajl_gen gen, struct Con *con, bool inplace_restart) |
IPC_HANDLER (tree) | |
IPC_HANDLER (get_workspaces) | |
IPC_HANDLER (get_outputs) | |
IPC_HANDLER (get_marks) | |
IPC_HANDLER (get_version) | |
IPC_HANDLER (get_bar_config) | |
static int | add_subscription (void *extra, const unsigned char *s, ylength len) |
IPC_HANDLER (subscribe) | |
static void | ipc_receive_message (EV_P_ struct ev_io *w, int revents) |
void | ipc_new_client (EV_P_ struct ev_io *w, int revents) |
Handler for activity on the listening socket, meaning that a new client has just connected and we should accept() him. More... | |
int | ipc_create_socket (const char *filename) |
Creates the UNIX domain socket at the given path, sets it to non-blocking mode, bind()s and listen()s on it. More... | |
Variables | |
char * | current_socketpath = NULL |
handler_t | handlers [8] |
#define YSTR_IF_SET | ( | name) |
Referenced by IPC_HANDLER().
#define YSTR_IF_SET | ( | name) |
|
static |
Definition at line 737 of file ipc.c.
References DLOG, ipc_client::events, ipc_client::num_events, and scalloc().
Referenced by IPC_HANDLER().
void dump_node | ( | yajl_gen | gen, |
struct Con * | con, | ||
bool | inplace_restart | ||
) |
Definition at line 150 of file ipc.c.
References BS_NONE, BS_NORMAL, BS_PIXEL, con_is_split(), con_orientation(), DLOG, Match::dock, dump_node(), dump_rect(), focused, HORIZ, i3string_as_utf8(), Match::insert_where, L_DEFAULT, L_DOCKAREA, L_OUTPUT, L_SPLITH, L_SPLITV, L_STACKED, L_TABBED, TAILQ_FOREACH, y, and ystr.
Referenced by dump_node(), IPC_HANDLER(), ipc_send_window_new_event(), ipc_send_workspace_focus_event(), and store_restart_layout().
|
static |
Definition at line 136 of file ipc.c.
References Rect::height, Rect::width, Rect::x, y, Rect::y, and ystr.
Referenced by dump_node().
int ipc_create_socket | ( | const char * | filename) |
Creates the UNIX domain socket at the given path, sets it to non-blocking mode, bind()s and listen()s on it.
Definition at line 916 of file ipc.c.
References current_socketpath, DLOG, FREE, mkdirp(), path_exists(), resolve_tilde(), and sstrdup().
Referenced by main().
IPC_HANDLER | ( | command | ) |
Definition at line 114 of file ipc.c.
References command_output, ipc_send_message(), CommandResult::json_gen, LOG, CommandResult::needs_tree_render, parse_command(), scalloc(), and tree_render().
IPC_HANDLER | ( | tree | ) |
Definition at line 365 of file ipc.c.
References croot, dump_node(), ipc_send_message(), y, and ygenalloc.
IPC_HANDLER | ( | get_workspaces | ) |
Definition at line 385 of file ipc.c.
References con_get_workspace(), con_is_internal(), croot, focused, Rect::height, ipc_send_message(), Con::name, Con::num, output_get_content(), Con::rect, TAILQ_FOREACH, Con::type, Con::urgent, Rect::width, workspace_is_visible(), Rect::x, y, Rect::y, ygenalloc, and ystr.
IPC_HANDLER | ( | get_outputs | ) |
Definition at line 451 of file ipc.c.
References xoutput::active, xoutput::con, con_get_fullscreen_con(), Rect::height, ipc_send_message(), xoutput::name, Con::name, outputs, xoutput::primary, xoutput::rect, TAILQ_FOREACH, Rect::width, Rect::x, y, Rect::y, ygenalloc, and ystr.
IPC_HANDLER | ( | get_marks | ) |
Definition at line 504 of file ipc.c.
References all_cons, ipc_send_message(), Con::mark, TAILQ_FOREACH, y, ygenalloc, and ystr.
IPC_HANDLER | ( | get_version | ) |
IPC_HANDLER | ( | get_bar_config | ) |
Definition at line 558 of file ipc.c.
References barconfigs, config, Barconfig::hidden_state, Barconfig::hide_workspace_buttons, Barconfig::id, ipc_send_message(), LOG, Barconfig::mode, Barconfig::modifier, Barconfig::num_outputs, Barconfig::outputs, Barconfig::position, scalloc(), TAILQ_FOREACH, Barconfig::verbose, y, ygenalloc, ystr, and YSTR_IF_SET.
IPC_HANDLER | ( | subscribe | ) |
Definition at line 764 of file ipc.c.
References add_subscription(), ELOG, ipc_client::fd, ipc_send_message(), TAILQ_FOREACH, and yalloc.
void ipc_new_client | ( | EV_P_ struct ev_io * | w, |
int | revents | ||
) |
Handler for activity on the listening socket, meaning that a new client has just connected and we should accept() him.
Sets up the event handler for activity on the new connection and inserts the file descriptor into the list of clients.
Definition at line 883 of file ipc.c.
References DLOG, ipc_receive_message(), scalloc(), and TAILQ_INSERT_TAIL.
Referenced by main().
|
static |
Definition at line 830 of file ipc.c.
References DLOG, ipc_client::events, ipc_client::fd, handlers, ipc_recv_message(), ipc_client::num_events, TAILQ_FOREACH, and TAILQ_REMOVE.
Referenced by ipc_new_client().
void ipc_send_event | ( | const char * | event, |
uint32_t | message_type, | ||
const char * | payload | ||
) |
Sends the specified event to all IPC clients which are currently connected and subscribed to this kind of event.
Definition at line 75 of file ipc.c.
References ipc_client::events, ipc_client::fd, ipc_send_message(), ipc_client::num_events, and TAILQ_FOREACH.
Referenced by _workspace_show(), cmd_move_workspace_to_output(), cmd_reload(), cmd_rename_workspace(), con_on_remove_child(), handle_screen_change(), ipc_send_window_new_event(), ipc_send_workspace_focus_event(), switch_mode(), update_barconfig(), workspace_get(), and workspace_update_urgent_flag().
void ipc_shutdown | ( | void | ) |
Calls shutdown() on each socket and closes it.
This function to be called when exiting or restarting only!
Definition at line 98 of file ipc.c.
References ipc_client::fd, TAILQ_EMPTY, TAILQ_FIRST, and TAILQ_REMOVE.
Referenced by i3_restart().
|
static |
TAILQ_HEAD | ( | ipc_client_head | , |
ipc_client | |||
) |
char* current_socketpath = NULL |
Definition at line 23 of file ipc.c.
Referenced by ipc_create_socket(), main(), and x_set_i3_atoms().
handler_t handlers[8] |
Definition at line 809 of file ipc.c.
Referenced by ipc_receive_message().