|
i3
|
#include <ev.h>#include <stdbool.h>#include <yajl/yajl_gen.h>#include <yajl/yajl_parse.h>#include "data.h"#include "tree.h"#include "config.h"#include "i3/ipc.h"

Go to the source code of this file.
Data Structures | |
| struct | ipc_client |
Macros | |
| #define | IPC_HANDLER(name) |
Typedefs | |
| typedef struct ipc_client | ipc_client |
| typedef void(* | handler_t) (int, uint8_t *, int, uint32_t, uint32_t) |
Functions | |
| 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... | |
| 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... | |
| void | dump_node (yajl_gen gen, Con *con, bool inplace_restart) |
| yajl_gen | ipc_marshal_workspace_event (const char *change, Con *current, Con *old) |
| Generates a json workspace event. More... | |
| void | ipc_send_workspace_event (const char *change, Con *current, Con *old) |
| For the workspace events we send, along with the usual "change" field, also the workspace container in "current". More... | |
| void | ipc_send_window_event (const char *property, Con *con) |
| For the window events we send, along the usual "change" field, also the window container, in "container". More... | |
| void | ipc_send_barconfig_update_event (Barconfig *barconfig) |
| For the barconfig update events, we send the serialized barconfig. More... | |
| void | ipc_send_binding_event (const char *event_type, Binding *bind) |
| For the binding events, we send the serialized binding struct. More... | |
Variables | |
| char * | current_socketpath |
| #define IPC_HANDLER | ( | name | ) |
| typedef void(* handler_t) (int, uint8_t *, int, uint32_t, uint32_t) |
| typedef struct ipc_client ipc_client |
| void dump_node | ( | yajl_gen | gen, |
| Con * | con, | ||
| bool | inplace_restart | ||
| ) |
Definition at line 178 of file ipc.c.
References BS_NONE, BS_NORMAL, BS_PIXEL, con_is_split(), con_orientation(), DLOG, Match::dock, dump_node(), DUMP_PROPERTY, dump_rect(), DUMP_REGEX, focused, HORIZ, i3string_as_utf8(), Match::insert_where, L_DEFAULT, L_DOCKAREA, L_OUTPUT, L_SPLITH, L_SPLITV, L_STACKED, L_TABBED, Match::restart_mode, TAILQ_FOREACH, y, and ystr.
Referenced by dump_node(), IPC_HANDLER(), ipc_marshal_workspace_event(), ipc_send_window_event(), and store_restart_layout().

| 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 1056 of file ipc.c.
References current_socketpath, DLOG, FREE, mkdirp(), path_exists(), resolve_tilde(), and sstrdup().
Referenced by main().

Generates a json workspace event.
Returns a dynamically allocated yajl generator. Free with yajl_gen_free().
Definition at line 1106 of file ipc.c.
References dump_node(), y, ygenalloc, and ystr.
Referenced by _workspace_show(), con_on_remove_child(), and ipc_send_workspace_event().

| 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 1022 of file ipc.c.
References DLOG, ipc_receive_message(), scalloc(), and TAILQ_INSERT_TAIL.
Referenced by main().

| void ipc_send_barconfig_update_event | ( | Barconfig * | barconfig | ) |
For the barconfig update events, we send the serialized barconfig.
Definition at line 1184 of file ipc.c.
References DLOG, dump_bar_config(), Barconfig::id, ipc_send_event(), y, and ygenalloc.
Referenced by update_barconfig().

| void ipc_send_binding_event | ( | const char * | event_type, |
| Binding * | bind | ||
| ) |
For the binding events, we send the serialized binding struct.
Definition at line 1203 of file ipc.c.
References DLOG, dump_binding(), ipc_send_event(), Binding::keycode, Binding::symbol, y, ygenalloc, and ystr.
Referenced by run_binding().

| 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 45 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(), con_on_remove_child(), handle_screen_change(), ipc_send_barconfig_update_event(), ipc_send_binding_event(), ipc_send_window_event(), ipc_send_workspace_event(), and switch_mode().

| void ipc_send_window_event | ( | const char * | property, |
| Con * | con | ||
| ) |
For the window events we send, along the usual "change" field, also the window container, in "container".
Definition at line 1155 of file ipc.c.
References DLOG, dump_node(), Window::id, ipc_send_event(), Con::window, y, ygenalloc, and ystr.
Referenced by con_focus(), con_move_to_workspace(), con_set_fullscreen_mode(), con_set_urgency(), floating_disable(), floating_enable(), handle_windowname_change(), handle_windowname_change_legacy(), manage_window(), tree_close(), tree_move(), workspace_defer_update_urgent_hint_cb(), and x_push_changes().

For the workspace events we send, along with the usual "change" field, also the workspace container in "current".
For focus events, we send the previously focused workspace in "old".
Definition at line 1139 of file ipc.c.
References ipc_marshal_workspace_event(), ipc_send_event(), and y.
Referenced by _workspace_show(), cmd_append_layout(), cmd_reload(), cmd_rename_workspace(), move_to_output_directed(), workspace_get(), workspace_move_to_output(), 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 68 of file ipc.c.
References ipc_client::fd, TAILQ_EMPTY, TAILQ_FIRST, and TAILQ_REMOVE.
Referenced by cmd_exit(), cmd_restart(), and i3_restart().
| char* current_socketpath |
Definition at line 23 of file ipc.c.
Referenced by ipc_create_socket(), main(), and x_set_i3_atoms().
1.8.9.1