src/layout.c File Reference

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <xcb/xcb.h>
#include <assert.h>
#include <math.h>
#include "config.h"
#include "i3.h"
#include "xcb.h"
#include "table.h"
#include "util.h"
#include "randr.h"
#include "layout.h"
#include "client.h"
#include "floating.h"
#include "handlers.h"
#include "workspace.h"
#include "log.h"
#include "container.h"
Include dependency graph for layout.c:

Go to the source code of this file.

Functions

int get_unoccupied_x (Workspace *workspace)
 Gets the unoccupied space (= space which is available for windows which were resized by the user) This is necessary to render both, customly resized windows and never touched windows correctly, meaning that the aspect ratio will be maintained when opening new windows.
int get_unoccupied_y (Workspace *workspace)
 See get_unoccupied_x.
void redecorate_window (xcb_connection_t *conn, Client *client)
 Redecorates the given client correctly by checking if it’s in a stacking container and re-rendering the stack window or just calling decorate_window if it’s not in a stacking container.
void decorate_window (xcb_connection_t *conn, Client *client, xcb_drawable_t drawable, xcb_gcontext_t gc, int offset_x, int offset_y)
 (Re-)draws window decorations for a given Client onto the given drawable/graphic context.
void reposition_client (xcb_connection_t *conn, Client *client)
 Pushes the client’s x and y coordinates to X11.
void resize_client (xcb_connection_t *conn, Client *client)
 Pushes the client’s width/height to X11 and resizes the child window.
void render_container (xcb_connection_t *conn, Container *container)
 Renders the given container.
static void render_bars (xcb_connection_t *conn, Workspace *r_ws, int width, int *height)
static void render_internal_bar (xcb_connection_t *conn, Workspace *r_ws, int width, int height)
void ignore_enter_notify_forall (xcb_connection_t *conn, Workspace *workspace, bool ignore_enter_notify)
 Modifies the event mask of all clients on the given workspace to either ignore or to handle enter notifies.
void render_workspace (xcb_connection_t *conn, Output *output, Workspace *r_ws)
 Renders the given workspace on the given screen.
void render_layout (xcb_connection_t *conn)
 Renders the whole layout, that is: Go through each screen, each workspace, each container and render each client.

Function Documentation

void decorate_window ( xcb_connection_t *  conn,
Client client,
xcb_drawable_t  drawable,
xcb_gcontext_t  gc,
int  offset_x,
int  offset_y 
)
int get_unoccupied_x ( Workspace workspace  ) 

Gets the unoccupied space (= space which is available for windows which were resized by the user) This is necessary to render both, customly resized windows and never touched windows correctly, meaning that the aspect ratio will be maintained when opening new windows.

Definition at line 40 of file layout.c.

References Workspace::cols, DLOG, Workspace::rect, Rect::width, and Workspace::width_factor.

Referenced by render_workspace(), and resize_container().

int get_unoccupied_y ( Workspace workspace  ) 

See get_unoccupied_x.

Definition at line 58 of file layout.c.

References DLOG, Workspace::height_factor, Workspace::rows, and workspace_height().

Referenced by render_workspace(), and resize_container().

Here is the call graph for this function:

void ignore_enter_notify_forall ( xcb_connection_t *  conn,
Workspace workspace,
bool  ignore_enter_notify 
)

Modifies the event mask of all clients on the given workspace to either ignore or to handle enter notifies.

It is handy to ignore notifies because they will be sent when a window is mapped under the cursor, thus when the user didn’t enter the window actively at all.

Definition at line 652 of file layout.c.

References Client::child, CHILD_EVENT_MASK, CIRCLEQ_FOREACH, FOR_TABLE, Client::frame, FRAME_EVENT_MASK, and Workspace::table.

Referenced by render_workspace(), workspace_map_clients(), and workspace_unmap_clients().

void redecorate_window ( xcb_connection_t *  conn,
Client client 
)

Redecorates the given client correctly by checking if it’s in a stacking container and re-rendering the stack window or just calling decorate_window if it’s not in a stacking container.

Definition at line 81 of file layout.c.

References Client::container, decorate_window(), Client::frame, Rect::height, Container::mode, Client::rect, render_container(), Client::titlegc, and Rect::width.

Referenced by client_change_border(), client_leave_fullscreen(), handle_hints(), reparent_window(), set_focus(), toggle_floating_mode(), and workspace_show().

Here is the call graph for this function:

static void render_bars ( xcb_connection_t *  conn,
Workspace r_ws,
int  width,
int *  height 
) [static]
void render_container ( xcb_connection_t *  conn,
Container container 
)
static void render_internal_bar ( xcb_connection_t *  conn,
Workspace r_ws,
int  width,
int  height 
) [static]
void render_layout ( xcb_connection_t *  conn  ) 

Renders the whole layout, that is: Go through each screen, each workspace, each container and render each client.

This also renders the bars.

If you don’t need to render *everything*, you should call render_container on the container you want to refresh.

Definition at line 771 of file layout.c.

References xoutput::current_workspace, outputs, render_workspace(), and TAILQ_FOREACH.

Referenced by client_change_border(), client_leave_fullscreen(), handle_expose_event(), handle_unmap_notify_event(), move_current_container(), move_current_window_in_container(), move_current_window_to_workspace(), move_floating_window_to_workspace(), parse_command(), randr_query_outputs(), reparent_window(), resize_container(), snap_current_container(), switch_layout_mode(), and workspace_show().

Here is the call graph for this function:

void render_workspace ( xcb_connection_t *  conn,
Output output,
Workspace r_ws 
)
void reposition_client ( xcb_connection_t *  conn,
Client client 
)
void resize_client ( xcb_connection_t *  conn,
Client client 
)

Pushes the client’s width/height to X11 and resizes the child window.

This function also updates the client’s position, so if you work on tiling clients only, you can use this function instead of separate calls to reposition_client and resize_client to reduce flickering.

Definition at line 248 of file layout.c.

References Client::base_height, Client::base_width, Client::border_width, Client::borderless, Client::child, Client::child_rect, config, Client::container, container_mode(), DLOG, fake_absolute_configure_notify(), Config::font, Client::frame, handle_expose_event(), Font::height, Rect::height, Client::height_increment, load_font(), Client::proportional_height, Client::proportional_width, Client::rect, Client::titlebar_position, Rect::width, Client::width_increment, Rect::x, xcb_set_window_rect(), and Rect::y.

Referenced by client_change_border(), client_leave_fullscreen(), DRAGGING_CB(), handle_configure_request(), handle_normal_hints(), parse_resize_command(), render_bars(), render_container(), render_workspace(), reparent_window(), and toggle_floating_mode().

Here is the call graph for this function:


Generated by  doxygen 1.6.2