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) {
275 if (fullscreen != NULL && fullscreen->
window != NULL) {
277 Con *transient_con = floating_child;
278 bool is_transient_for =
false;
282 while (transient_con != NULL &&
283 transient_con->
window != NULL &&
286 is_transient_for =
true;
292 if (!is_transient_for)
295 DLOG(
"Rendering floating child even though in fullscreen mode: "
296 "floating->transient_for (0x%08x) --> fullscreen->id (0x%08x)\n",
300 DLOG(
"floating child at (%d,%d) with %d x %d\n",
312 assert(children > 0);
337 child->
rect.
y += deco_height;
364 child->
rect.
y += (deco_height * children);
365 child->
rect.
height -= (deco_height * children);
382 if (i == (children-1)) {
387 child->
rect.
y += deco_height;
409 DLOG(
"child at (%d, %d) with (%d x %d)\n",