i3
restore_layout.c File Reference
#include "all.h"
Include dependency graph for restore_layout.c:

Go to the source code of this file.

Data Structures

struct  placeholder_state
 

Macros

#define TEXT_PADDING   logical_px(2)
 
#define APPEND_REGEX(re_name)
 

Typedefs

typedef struct placeholder_state placeholder_state
 

Functions

static TAILQ_HEAD (state_head, placeholder_state)
 
static void restore_xcb_prepare_cb (EV_P_ ev_prepare *w, int revents)
 
void restore_connect (void)
 Opens a separate connection to X11 for placeholder windows when restoring layouts.
 
static void update_placeholder_contents (placeholder_state *state)
 
static void open_placeholder_window (Con *con)
 
void restore_open_placeholder_windows (Con *parent)
 Open placeholder windows for all children of parent.
 
bool restore_kill_placeholder (xcb_window_t placeholder)
 Kill the placeholder window, if placeholder refers to a placeholder window.
 
static void expose_event (xcb_expose_event_t *event)
 
static void configure_notify (xcb_configure_notify_event_t *event)
 
static void restore_handle_event (int type, xcb_generic_event_t *event)
 

Macro Definition Documentation

◆ APPEND_REGEX

#define APPEND_REGEX ( re_name)
Value:
do { \
if (swallows->re_name != NULL) { \
sasprintf(&serialized, "%s%s" #re_name "=\"%s\"", (serialized ? serialized : "["), (serialized ? " " : ""), swallows->re_name->pattern); \
} \
} while (0)

Referenced by update_placeholder_contents().

◆ TEXT_PADDING

#define TEXT_PADDING   logical_px(2)

Definition at line 18 of file restore_layout.c.

Referenced by update_placeholder_contents().

Typedef Documentation

◆ placeholder_state

typedef struct placeholder_state placeholder_state

Function Documentation

◆ configure_notify()

static void configure_notify ( xcb_configure_notify_event_t * event)
static

Definition at line 312 of file restore_layout.c.

References DLOG, draw_util_surface_set_size(), ELOG, state, TAILQ_FOREACH, and update_placeholder_contents().

Referenced by restore_handle_event().

Here is the call graph for this function:

◆ expose_event()

static void expose_event ( xcb_expose_event_t * event)
static

Definition at line 289 of file restore_layout.c.

References DLOG, ELOG, state, TAILQ_FOREACH, and update_placeholder_contents().

Referenced by restore_handle_event().

Here is the call graph for this function:

◆ open_placeholder_window()

◆ restore_connect()

void restore_connect ( void )

Opens a separate connection to X11 for placeholder windows when restoring layouts.

This is done as a safety measure (users can xkill a placeholder window without killing their window manager) and for better isolation, both on the wire to X11 and thus also in the code.

Definition at line 85 of file restore_layout.c.

References main_loop, restore_xcb_prepare_cb(), scalloc(), state, TAILQ_EMPTY, TAILQ_FIRST, TAILQ_REMOVE, and xcb_prepare.

Referenced by main(), and restore_xcb_prepare_cb().

Here is the call graph for this function:

◆ restore_handle_event()

static void restore_handle_event ( int type,
xcb_generic_event_t * event )
static

Definition at line 335 of file restore_layout.c.

References configure_notify(), DLOG, and expose_event().

Referenced by restore_xcb_prepare_cb().

Here is the call graph for this function:

◆ restore_kill_placeholder()

bool restore_kill_placeholder ( xcb_window_t placeholder)

Kill the placeholder window, if placeholder refers to a placeholder window.

This function is called when manage.c puts a window into an existing container. In order not to leak resources, we need to destroy the window and all associated X11 objects (pixmap/gc).

Definition at line 270 of file restore_layout.c.

References DLOG, draw_util_surface_free(), state, TAILQ_FOREACH, and TAILQ_REMOVE.

Referenced by manage_window(), and remanage_window().

Here is the call graph for this function:

◆ restore_open_placeholder_windows()

void restore_open_placeholder_windows ( Con * con)

Open placeholder windows for all children of parent.

The placeholder window will vanish as soon as a real window is swallowed by the container. Until then, it exposes the criteria that must be fulfilled for a window to be swallowed by this container.

Definition at line 251 of file restore_layout.c.

References open_placeholder_window(), and TAILQ_FOREACH.

Referenced by cmd_append_layout(), and tree_restore().

Here is the call graph for this function:

◆ restore_xcb_prepare_cb()

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

Definition at line 49 of file restore_layout.c.

References DLOG, restore_connect(), and restore_handle_event().

Referenced by restore_connect().

Here is the call graph for this function:

◆ TAILQ_HEAD()

static TAILQ_HEAD ( state_head ,
placeholder_state  )
static

Definition at line 35 of file restore_layout.c.

◆ update_placeholder_contents()