src/client.c File Reference

#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <limits.h>
#include <xcb/xcb.h>
#include <xcb/xcb_icccm.h>
#include "data.h"
#include "i3.h"
#include "xcb.h"
#include "util.h"
#include "queue.h"
#include "layout.h"
#include "client.h"
#include "table.h"
#include "workspace.h"
#include "config.h"
#include "log.h"
Include dependency graph for client.c:

Go to the source code of this file.

Functions

void client_remove_from_container (xcb_connection_t *conn, Client *client, Container *container, bool remove_from_focusstack)
 Removes the given client from the container, either because it will be inserted into another one or because it was unmapped.
void client_warp_pointer_into (xcb_connection_t *conn, Client *client)
 Warps the pointer into the given client (in the middle of it, to be specific), therefore selecting it.
static bool client_supports_protocol (xcb_connection_t *conn, Client *client, xcb_atom_t atom)
void client_kill (xcb_connection_t *conn, Client *window)
 Kills the given window using WM_DELETE_WINDOW or xcb_kill_window.
bool client_matches_class_name (Client *client, char *to_class, char *to_title, char *to_title_ucs, int to_title_ucs_len)
 Checks if the given window class and title match the given client Window title is passed as "normal" string and as UCS-2 converted string for matching _NET_WM_NAME capable clients as well as those using legacy hints.
void client_enter_fullscreen (xcb_connection_t *conn, Client *client, bool global)
 Enters fullscreen mode for the given client.
void client_leave_fullscreen (xcb_connection_t *conn, Client *client)
 Leaves fullscreen mode for the current client.
void client_toggle_fullscreen (xcb_connection_t *conn, Client *client)
 Toggles fullscreen mode for the given client.
void client_toggle_fullscreen_global (xcb_connection_t *conn, Client *client)
 Like client_toggle_fullscreen(), but putting it in global fullscreen-mode.
void client_set_below_floating (xcb_connection_t *conn, Client *client)
 Sets the position of the given client in the X stack to the highest (tiling layer is always on the same position, so this doesn’t matter) below the first floating client, so that floating windows are always on top.
bool client_is_floating (Client *client)
 Returns true if the client is floating.
bool client_init_border (xcb_connection_t *conn, Client *client, char border_type)
 Change the border type for the given client to normal (n), 1px border (p) or completely borderless (b) without actually re-rendering the layout.
void client_change_border (xcb_connection_t *conn, Client *client, char border_type)
 Change the border type for the given client to normal (n), 1px border (p) or completely borderless (b).
void client_unmap (xcb_connection_t *conn, Client *client)
 Unmap the client, correctly setting any state which is needed.
void client_map (xcb_connection_t *conn, Client *client)
 Map the client, correctly restoring any state needed.
void client_mark (xcb_connection_t *conn, Client *client, const char *mark)
 Set the given mark for this client.
uint32_t client_min_height (Client *client)
 Returns the minimum height of a specific window.
uint32_t client_min_width (Client *client)
 See client_min_height.

Function Documentation

void client_change_border ( xcb_connection_t *  conn,
Client client,
char  border_type 
)

Change the border type for the given client to normal (n), 1px border (p) or completely borderless (b).

Definition at line 370 of file client.c.

References client_init_border(), client_is_floating(), Client::container, Client::force_reconfigure, redecorate_window(), render_container(), render_layout(), and resize_client().

Referenced by parse_command().

Here is the call graph for this function:

void client_enter_fullscreen ( xcb_connection_t *  conn,
Client client,
bool  global 
)

Enters fullscreen mode for the given client.

This is called by toggle_fullscreen and when moving a fullscreen client to another screen.

Definition at line 156 of file client.c.

References xoutput::active, Client::child, xoutput::current_workspace, DLOG, fake_configure_notify(), Client::frame, Client::fullscreen, Workspace::fullscreen_client, Rect::height, LOG, xoutput::name, outputs, Workspace::rect, xoutput::rect, TAILQ_FOREACH, Rect::width, Client::workspace, Rect::x, xcb_set_window_rect(), and Rect::y.

Referenced by client_toggle_fullscreen(), client_toggle_fullscreen_global(), move_current_window_to_workspace(), move_floating_window_to_workspace(), and workspace_show().

Here is the call graph for this function:

bool client_init_border ( xcb_connection_t *  conn,
Client client,
char  border_type 
)

Change the border type for the given client to normal (n), 1px border (p) or completely borderless (b) without actually re-rendering the layout.

Useful for calling it when initializing a new client.

Definition at line 342 of file client.c.

References Client::borderless, LOG, and Client::titlebar_position.

Referenced by client_change_border(), and reparent_window().

bool client_is_floating ( Client client  ) 

Returns true if the client is floating.

Makes the code more beatiful, as floating is not simply a boolean, but also saves whether the user selected the current state or whether it was automatically set.

Definition at line 332 of file client.c.

References Client::floating.

Referenced by client_change_border(), client_leave_fullscreen(), decorate_window(), floating_toggle_hide(), handle_button_press(), handle_configure_request(), handle_unmap_notify_event(), move_floating_window_to_workspace(), output_change_mode(), parse_command(), parse_resize_command(), reparent_window(), reposition_client(), set_focus(), toggle_floating_mode(), travel_focus_stack(), and workspace_unmap_clients().

void client_kill ( xcb_connection_t *  conn,
Client window 
)

Kills the given window using WM_DELETE_WINDOW or xcb_kill_window.

Definition at line 95 of file client.c.

References atoms, Client::child, client_supports_protocol(), LOG, WM_DELETE_WINDOW, and WM_PROTOCOLS.

Referenced by parse_command().

Here is the call graph for this function:

void client_leave_fullscreen ( xcb_connection_t *  conn,
Client client 
)

Leaves fullscreen mode for the current client.

Leaves fullscreen mode for the given client.

This is called by toggle_fullscreen.

Definition at line 240 of file client.c.

References client_is_floating(), client_set_below_floating(), Client::force_reconfigure, Client::fullscreen, Workspace::fullscreen_client, LOG, redecorate_window(), render_layout(), reposition_client(), resize_client(), TAILQ_FOREACH, and workspaces.

Referenced by client_toggle_fullscreen(), client_toggle_fullscreen_global(), and parse_command().

Here is the call graph for this function:

void client_map ( xcb_connection_t *  conn,
Client client 
)

Map the client, correctly restoring any state needed.

Definition at line 407 of file client.c.

References atoms, Client::child, Client::frame, and WM_STATE.

Referenced by floating_toggle_hide(), reparent_window(), and workspace_map_clients().

void client_mark ( xcb_connection_t *  conn,
Client client,
const char *  mark 
)

Set the given mark for this client.

Used for jumping to the client afterwards (like m<mark> and '<mark> in vim).

Definition at line 421 of file client.c.

References Client::mark, SLIST_FOREACH, sstrdup(), TAILQ_FOREACH, and workspaces.

Referenced by parse_command().

Here is the call graph for this function:

bool client_matches_class_name ( Client client,
char *  to_class,
char *  to_title,
char *  to_title_ucs,
int  to_title_ucs_len 
)

Checks if the given window class and title match the given client Window title is passed as "normal" string and as UCS-2 converted string for matching _NET_WM_NAME capable clients as well as those using legacy hints.

Definition at line 125 of file client.c.

References Client::name, Client::name_len, Client::window_class_class, and Client::window_class_instance.

Referenced by get_matching_client().

uint32_t client_min_height ( Client client  ) 

Returns the minimum height of a specific window.

The height is calculated by using 2 pixels (for the client window itself), possibly padding this to comply with the client’s base_height and then adding the decoration height.

Definition at line 450 of file client.c.

References Client::base_height, Client::borderless, config, Config::font, global_conn, Font::height, load_font(), max(), and Client::titlebar_position.

Referenced by DRAGGING_CB().

Here is the call graph for this function:

uint32_t client_min_width ( Client client  ) 

See client_min_height.

Definition at line 467 of file client.c.

References Client::base_width, Client::borderless, max(), and Client::titlebar_position.

Referenced by DRAGGING_CB().

Here is the call graph for this function:

void client_remove_from_container ( xcb_connection_t *  conn,
Client client,
Container container,
bool  remove_from_focusstack 
)

Removes the given client from the container, either because it will be inserted into another one or because it was unmapped.

Definition at line 38 of file client.c.

References CIRCLEQ_EMPTY, CIRCLEQ_REMOVE, DLOG, Rect::height, Container::mode, Stack_Window::rect, SLIST_REMOVE, Container::stack_win, Stack_Window::window, and Container::workspace.

Referenced by handle_unmap_notify_event(), move_current_window(), move_current_window_to_workspace(), and toggle_floating_mode().

void client_set_below_floating ( xcb_connection_t *  conn,
Client client 
)

Sets the position of the given client in the X stack to the highest (tiling layer is always on the same position, so this doesn’t matter) below the first floating client, so that floating windows are always on top.

Definition at line 306 of file client.c.

References DLOG, Client::frame, Workspace::fullscreen_client, TAILQ_END, TAILQ_FIRST, and Client::workspace.

Referenced by client_leave_fullscreen(), reparent_window(), and toggle_floating_mode().

static bool client_supports_protocol ( xcb_connection_t *  conn,
Client client,
xcb_atom_t  atom 
) [static]

Definition at line 72 of file client.c.

References atoms, Client::child, and WM_PROTOCOLS.

Referenced by client_kill().

void client_toggle_fullscreen ( xcb_connection_t *  conn,
Client client 
)

Toggles fullscreen mode for the given client.

It updates the data structures and reconfigures (= resizes/moves) the client and its frame to the full size of the screen. When leaving fullscreen, re-rendering the layout is forced.

Definition at line 274 of file client.c.

References client_enter_fullscreen(), client_leave_fullscreen(), Client::dock, and Client::fullscreen.

Referenced by handle_client_message(), parse_command(), and reparent_window().

Here is the call graph for this function:

void client_toggle_fullscreen_global ( xcb_connection_t *  conn,
Client client 
)

Like client_toggle_fullscreen(), but putting it in global fullscreen-mode.

Definition at line 289 of file client.c.

References client_enter_fullscreen(), client_leave_fullscreen(), Client::dock, and Client::fullscreen.

Referenced by parse_command().

Here is the call graph for this function:

void client_unmap ( xcb_connection_t *  conn,
Client client 
)

Unmap the client, correctly setting any state which is needed.

Definition at line 395 of file client.c.

References atoms, Client::child, Client::frame, and WM_STATE.

Referenced by floating_toggle_hide(), handle_unmap_notify_event(), move_current_window_to_workspace(), move_floating_window_to_workspace(), and workspace_unmap_clients().

void client_warp_pointer_into ( xcb_connection_t *  conn,
Client client 
)

Warps the pointer into the given client (in the middle of it, to be specific), therefore selecting it.

Definition at line 62 of file client.c.

References Client::child, Rect::height, Client::rect, and Rect::width.

Referenced by move_current_window_to_workspace(), move_floating_window_to_workspace(), and workspace_show().


Generated on 10 Sep 2010 for i3 by  doxygen 1.6.1