i3
|
00001 /* 00002 * vim:ts=8:expandtab 00003 * 00004 * i3 - an improved dynamic tiling window manager 00005 * 00006 * © 2009 Michael Stapelberg and contributors 00007 * 00008 * See file LICENSE for license information. 00009 * 00010 */ 00011 00012 #include "data.h" 00013 #include "log.h" 00014 00015 /* 00016 * Returns the mode of the given container (or MODE_DEFAULT if a NULL pointer 00017 * was passed in order to save a few explicit checks in other places). If 00018 * for_frame was set to true, the special case of having exactly one client 00019 * in a container is handled so that MODE_DEFAULT is returned. For some parts 00020 * of the rendering, this is interesting, other parts need the real mode. 00021 * 00022 */ 00023 int container_mode(Container *con, bool for_frame) { 00024 int num_clients = 0; 00025 Client *client; 00026 00027 if (con == NULL || con->mode == MODE_DEFAULT) 00028 return MODE_DEFAULT; 00029 00030 if (!for_frame) 00031 return con->mode; 00032 00033 CIRCLEQ_FOREACH(client, &(con->clients), clients) 00034 num_clients++; 00035 00036 /* If the container contains only one client, mode is irrelevant */ 00037 if (num_clients == 1) { 00038 DLOG("mode to default\n"); 00039 return MODE_DEFAULT; 00040 } 00041 00042 return con->mode; 00043 }