2 #define I3__FILE__ "render.c"
49 DLOG(
"Rendering %snode %p / %s / layout %d / children %d\n",
50 (render_fullscreen ?
"fullscreen " :
""), con, con->
name, con->
layout,
62 if (!render_fullscreen)
79 DLOG(
"aspect_ratio = %f, current width/height are %d/%d\n",
81 double new_height = inset->
height + 1;
82 int new_width = inset->
width;
84 while (new_height > inset->
height) {
87 if (new_height > inset->
height)
91 inset->
y += ceil(inset->
height / 2) - floor((new_height + .5) / 2);
92 inset->
x += ceil(inset->
width / 2) - floor(new_width / 2);
94 inset->
height = new_height + .5;
95 inset->
width = new_width;
104 DLOG(
"child will be at %dx%d with size %dx%d\n", inset->
x, inset->
y, inset->
width, inset->
height);
108 Con *fullscreen = NULL;
109 if (con->
type != CT_OUTPUT) {
122 if (con->
type != CT_ROOT) {
138 }
else if (con->
type == CT_ROOT) {
155 DLOG(
"child at (%d, %d) with (%d x %d)\n",
193 int i = 0, assigned = 0;
197 assigned += sizes[i++] = percentage * total;
199 assert(assigned == total ||
200 (assigned > total && assigned - total <= p->children * 2) ||
201 (assigned < total && total - assigned <= p->children * 2));
202 int signal = assigned < total ? 1 : -1;
203 while (assigned != total) {
204 for (i = 0; i < p->
children && assigned != total; ++i) {
226 DLOG(
"Rendering floating windows:\n");
232 if (!content ||
TAILQ_EMPTY(&(content->focus_head))) {
233 DLOG(
"Skipping this output because it is currently being destroyed.\n");
239 TAILQ_FOREACH(child, &(workspace->floating_head), floating_windows) {
247 if (fullscreen != NULL && fullscreen->
window == NULL)
249 if (fullscreen != NULL && fullscreen->
window != NULL) {
251 Con *transient_con = floating_child;
252 bool is_transient_for =
false;
256 while (transient_con != NULL &&
257 transient_con->
window != NULL &&
259 DLOG(
"transient_con = 0x%08x, transient_con->window->transient_for = 0x%08x, fullscreen_id = 0x%08x\n",
262 is_transient_for =
true;
266 if (next_transient == NULL)
271 if (transient_con == next_transient)
273 transient_con = next_transient;
276 if (!is_transient_for)
279 DLOG(
"Rendering floating child even though in fullscreen mode: "
280 "floating->transient_for (0x%08x) --> fullscreen->id (0x%08x)\n",
284 DLOG(
"floating child at (%d,%d) with %d x %d\n",
298 Con *child, *dockchild;
308 if (child->
type == CT_CON) {
309 if (content != NULL) {
310 DLOG(
"More than one CT_CON on output container\n");
314 }
else if (child->
type != CT_DOCKAREA) {
315 DLOG(
"Child %p of type %d is inside the OUTPUT con\n", child, child->
type);
320 if (content == NULL) {
321 DLOG(
"Skipping this output because it is currently being destroyed.\n");
330 DLOG(
"Skipping this output because it is currently being destroyed.\n");
344 if (child->
type != CT_DOCKAREA)
356 if (child->
type == CT_CON) {
374 DLOG(
"child at (%d, %d) with (%d x %d)\n",
static void render_con_split(Con *con, Con *child, render_params *p, int i)
static void render_con_stacked(Con *con, Con *child, render_params *p, int i)
int height
The height of the font, built from font_ascent + font_descent.
static void render_con_tabbed(Con *con, Con *child, render_params *p, int i)
void * smalloc(size_t size)
Safe-wrapper around malloc which exits if malloc returns NULL (meaning that there is no more memory a...
#define TAILQ_EMPTY(head)
Con * output_get_content(Con *output)
Returns the output container below the given output container.
bool con_is_internal(Con *con)
Returns true if the container is internal, such as __i3_scratch.
Con * con_by_window_id(xcb_window_t window)
Returns the container with the given client window ID or NULL if no such container exists...
#define TAILQ_FOREACH(var, head, field)
Rect rect_add(Rect a, Rect b)
Con * con_descend_focused(Con *con)
Returns the focused con inside this client, descending the tree as far as possible.
Rect con_border_style_rect(Con *con)
Returns a "relative" Rect which contains the amount of pixels that need to be added to the original R...
static void render_output(Con *con)
static int * precalculate_sizes(Con *con, render_params *p)
static void render_con_dockarea(Con *con, Con *child, render_params *p)
struct Rect geometry
the geometry this window requested when getting mapped
#define TAILQ_FOREACH_REVERSE(var, head, headname, field)
Stores a rectangle, for example the size of a window, the child window etc.
bool con_is_leaf(Con *con)
Returns true when this node is a leaf node (has no children)
orientation_t con_orientation(Con *con)
Returns the orientation of the given container (for stacked containers, vertical orientation is used ...
Con * con_get_fullscreen_con(Con *con, fullscreen_mode_t fullscreen_mode)
Returns the first fullscreen node below this node.
static void render_root(Con *con, Con *fullscreen)
xcb_window_t transient_for
A 'Con' represents everything from the X11 root window down to a single X11 window.
#define TAILQ_FIRST(head)
void x_raise_con(Con *con)
Raises the specified container in the internal stack of X windows.
int con_num_children(Con *con)
Returns the number of children of this container.
void render_con(Con *con, bool render_fullscreen)
"Renders" the given container (and its children), meaning that all rects are updated correctly...
border_style_t border_style
int render_deco_height(void)