2 #define I3__FILE__ "render.c"
35 Con *child, *dockchild;
45 if (child->
type == CT_CON) {
46 if (content != NULL) {
47 DLOG(
"More than one CT_CON on output container\n");
51 }
else if (child->
type != CT_DOCKAREA) {
52 DLOG(
"Child %p of type %d is inside the OUTPUT con\n", child, child->
type);
57 if (content == NULL) {
58 DLOG(
"Skipping this output because it is currently being destroyed.\n");
67 DLOG(
"Skipping this output because it is currently being destroyed.\n");
81 if (child->
type != CT_DOCKAREA)
93 if (child->
type == CT_CON) {
111 DLOG(
"child at (%d, %d) with (%d x %d)\n",
128 DLOG(
"Rendering %snode %p / %s / layout %d / children %d\n",
129 (render_fullscreen ?
"fullscreen " :
""), con, con->
name, con->
layout,
158 if (!render_fullscreen)
174 if (!render_fullscreen &&
176 DLOG(
"aspect_ratio = %f, current width/height are %d/%d\n",
178 double new_height = inset->
height + 1;
179 int new_width = inset->
width;
181 while (new_height > inset->
height) {
184 if (new_height > inset->
height)
188 inset->
y += ceil(inset->
height / 2) - floor((new_height + .5) / 2);
189 inset->
x += ceil(inset->
width / 2) - floor(new_width / 2);
191 inset->
height = new_height + .5;
192 inset->
width = new_width;
201 DLOG(
"child will be at %dx%d with size %dx%d\n", inset->
x, inset->
y, inset->
width, inset->
height);
205 Con *fullscreen = NULL;
206 if (con->
type != CT_OUTPUT) {
210 fullscreen->
rect = rect;
221 memset(sizes, 0, children *
sizeof(
int));
225 int i = 0, assigned = 0;
228 double percentage = child->
percent > 0.0 ? child->
percent : 1.0 / children;
229 assigned += sizes[i++] = percentage * total;
231 assert(assigned == total ||
232 (assigned > total && assigned - total <= children * 2) ||
233 (assigned < total && total - assigned <= children * 2));
234 int signal = assigned < total ? 1 : -1;
235 while (assigned != total) {
236 for (i = 0; i < children && assigned != total; ++i) {
248 }
else if (con->
type == CT_ROOT) {
258 DLOG(
"Rendering floating windows:\n");
264 if (!content ||
TAILQ_EMPTY(&(content->focus_head))) {
265 DLOG(
"Skipping this output because it is currently being destroyed.\n");
271 TAILQ_FOREACH (child, &(workspace->floating_head), floating_windows) {
279 if (fullscreen != NULL && fullscreen->
window == NULL)
281 if (fullscreen != NULL && fullscreen->
window != NULL) {
283 Con *transient_con = floating_child;
284 bool is_transient_for =
false;
288 while (transient_con != NULL &&
289 transient_con->
window != NULL &&
292 is_transient_for =
true;
296 if (next_transient == NULL)
301 if (transient_con == next_transient)
303 transient_con = next_transient;
306 if (!is_transient_for)
309 DLOG(
"Rendering floating child even though in fullscreen mode: "
310 "floating->transient_for (0x%08x) --> fullscreen->id (0x%08x)\n",
314 DLOG(
"floating child at (%d,%d) with %d x %d\n",
325 assert(children > 0);
350 child->
rect.
y += deco_height;
377 child->
rect.
y += (deco_height * children);
378 child->
rect.
height -= (deco_height * children);
395 if (i == (children - 1)) {
400 child->
rect.
y += deco_height;
422 DLOG(
"child at (%d, %d) with (%d x %d)\n",
static bool show_debug_borders
Rect rect_add(Rect a, Rect b)
int render_deco_height(void)
Stores a rectangle, for example the size of a window, the child window etc.
Con * con_descend_focused(Con *con)
Returns the focused con inside this client, descending the tree as far as possible.
#define TAILQ_FOREACH_REVERSE(var, head, headname, field)
#define TAILQ_FIRST(head)
border_style_t border_style
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...
xcb_window_t transient_for
Con * con_get_fullscreen_con(Con *con, fullscreen_mode_t fullscreen_mode)
Returns the first fullscreen node below this node.
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...
bool con_is_leaf(Con *con)
Returns true when this node is a leaf node (has no children)
struct Rect geometry
the geometry this window requested when getting mapped
int height
The height of the font, built from font_ascent + font_descent.
#define TAILQ_EMPTY(head)
int con_num_children(Con *con)
Returns the number of children of this container.
orientation_t con_orientation(Con *con)
Returns the orientation of the given container (for stacked containers, vertical orientation is used ...
A 'Con' represents everything from the X11 root window down to a single X11 window.
static void render_l_output(Con *con)
Con * output_get_content(Con *output)
Returns the output container below the given output container.
#define TAILQ_FOREACH(var, head, field)
void render_con(Con *con, bool render_fullscreen)
"Renders" the given container (and its children), meaning that all rects are updated correctly...
void x_raise_con(Con *con)
Raises the specified container in the internal stack of X windows.