From 63670e7a4b1c1ebd1dcd7c1ac1791201db28429d Mon Sep 17 00:00:00 2001 From: "K. Lange" Date: Fri, 3 Aug 2018 20:01:28 +0900 Subject: [PATCH] Fix enforcing maximum seamless window count --- apps/compositor.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/apps/compositor.c b/apps/compositor.c index dbc3aade..1e27d619 100644 --- a/apps/compositor.c +++ b/apps/compositor.c @@ -759,9 +759,16 @@ static void yutani_post_vbox_rects(yutani_globals_t * yg) { int32_t * magic = (int32_t *)tmp; magic++; - if (*count > 254) *count = 254; /* maximum we can support */ + /* Add top window if it exists */ + if (yg->top_z) { + *magic = yg->top_z->x; magic++; + *magic = yg->top_z->y; magic++; + *magic = yg->top_z->x + yg->top_z->width; magic++; + *magic = yg->top_z->y + yg->top_z->height; magic++; + (*count)++; + } - /* Skip the bottom window */ + /* Add regular windows */ foreach (node, yg->mid_zs) { yutani_server_window_t * w = node->value; if (w) { @@ -770,18 +777,10 @@ static void yutani_post_vbox_rects(yutani_globals_t * yg) { *magic = w->x + w->width; magic++; *magic = w->y + w->height; magic++; (*count)++; + if (*count == 254) break; } } - /* Add top window if it exists */ - if (yg->top_z) { - *magic = yg->top_z->x; magic++; - *magic = yg->top_z->y; magic++; - *magic = yg->top_z->x + yg->top_z->width; magic++; - *magic = yg->top_z->y + yg->top_z->height; magic++; - (*count)++; - } - /* * If there were no windows, show the whole desktop * so we can see, eg., the login screen.