1 /*
2  * vim:ts=4:sw=4:expandtab
3  *
4  * i3 - an improved dynamic tiling window manager
5  * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
6  *
7  * include/data.h: This file defines all data structures used by i3
8  *
9  */
10 #pragma once
11 
12 #define SN_API_NOT_YET_FROZEN 1
13 #include <libsn/sn-launcher.h>
14 
15 #include <xcb/randr.h>
16 #include <pcre.h>
17 #include <sys/time.h>
18 #include <cairo/cairo.h>
19 
20 #include "queue.h"
21 
22 /*
23  * To get the big concept: There are helper structures like struct
24  * Workspace_Assignment. Every struct which is also defined as type (see
25  * forward definitions) is considered to be a major structure, thus important.
26  *
27  * The following things are all stored in a 'Con', from very high level (the
28  * biggest Cons) to very small (a single window):
29  *
30  * 1) X11 root window (as big as all your outputs combined)
31  * 2) output (like LVDS1)
32  * 3) content container, dockarea containers
33  * 4) workspaces
34  * 5) split containers
35  * ... (you can arbitrarily nest split containers)
36  * 6) X11 window containers
37  *
38  */
39 
40 /* Forward definitions */
41 typedef struct Binding Binding;
42 typedef struct Rect Rect;
43 typedef struct xoutput Output;
44 typedef struct Con Con;
45 typedef struct Match Match;
46 typedef struct Assignment Assignment;
47 typedef struct Window i3Window;
48 typedef struct gaps_t gaps_t;
49 typedef struct mark_t mark_t;
50 
51 /******************************************************************************
52  * Helper types
53  *****************************************************************************/
54 typedef enum { D_LEFT,
55                D_RIGHT,
56                D_UP,
57                D_DOWN } direction_t;
58 typedef enum { NO_ORIENTATION = 0,
59                HORIZ,
60                VERT } orientation_t;
61 typedef enum { BEFORE,
62                AFTER } position_t;
63 typedef enum { BS_NORMAL = 0,
64                BS_NONE = 1,
65                BS_PIXEL = 2 } border_style_t;
66 
67 /** parameter to specify whether tree_close_internal() and x_window_kill() should kill
68  * only this specific window or the whole X11 client */
69 typedef enum { DONT_KILL_WINDOW = 0,
70                KILL_WINDOW = 1,
71                KILL_CLIENT = 2 } kill_window_t;
72 
73 /** describes if the window is adjacent to the output (physical screen) edges. */
74 typedef enum { ADJ_NONE = 0,
75                ADJ_LEFT_SCREEN_EDGE = (1 << 0),
76                ADJ_RIGHT_SCREEN_EDGE = (1 << 1),
77                ADJ_UPPER_SCREEN_EDGE = (1 << 2),
78                ADJ_LOWER_SCREEN_EDGE = (1 << 4) } adjacent_t;
79 
80 typedef enum { SMART_BORDERS_OFF,
81                SMART_BORDERS_ON,
82                SMART_BORDERS_NO_GAPS } smart_borders_t;
83 
84 typedef enum { SMART_GAPS_OFF,
85                SMART_GAPS_ON,
86                SMART_GAPS_INVERSE_OUTER } smart_gaps_t;
87 
88 typedef enum { HEBM_NONE = ADJ_NONE,
89                HEBM_VERTICAL = ADJ_LEFT_SCREEN_EDGE | ADJ_RIGHT_SCREEN_EDGE,
90                HEBM_HORIZONTAL = ADJ_UPPER_SCREEN_EDGE | ADJ_LOWER_SCREEN_EDGE,
91                HEBM_BOTH = HEBM_VERTICAL | HEBM_HORIZONTAL,
92                HEBM_SMART = (1 << 5),
93                HEBM_SMART_NO_GAPS = (1 << 6) } hide_edge_borders_mode_t;
94 
95 typedef enum { MM_REPLACE,
96                MM_ADD } mark_mode_t;
97 
98 /**
99  * Container layouts. See Con::layout.
100  */
101 typedef enum {
102     L_DEFAULT = 0,
103     L_STACKED = 1,
104     L_TABBED = 2,
105     L_DOCKAREA = 3,
106     L_OUTPUT = 4,
107     L_SPLITV = 5,
108     L_SPLITH = 6
109 } layout_t;
110 
111 /**
112  * Binding input types. See Binding::input_type.
113  */
114 typedef enum {
115     B_KEYBOARD = 0,
116     B_MOUSE = 1
117 } input_type_t;
118 
119 /**
120  * Bitmask for matching XCB_XKB_GROUP_1 to XCB_XKB_GROUP_4.
121  */
122 typedef enum {
123     I3_XKB_GROUP_MASK_ANY = 0,
124     I3_XKB_GROUP_MASK_1 = (1 << 0),
125     I3_XKB_GROUP_MASK_2 = (1 << 1),
126     I3_XKB_GROUP_MASK_3 = (1 << 2),
127     I3_XKB_GROUP_MASK_4 = (1 << 3)
128 } i3_xkb_group_mask_t;
129 
130 /**
131  * The lower 16 bits contain a xcb_key_but_mask_t, the higher 16 bits contain
132  * an i3_xkb_group_mask_t. This type is necessary for the fallback logic to
133  * work when handling XKB groups (see ticket #1775) and makes the code which
134  * locates keybindings upon KeyPress/KeyRelease events simpler.
135  */
136 typedef uint32_t i3_event_state_mask_t;
137 
138 /**
139  * Mouse pointer warping modes.
140  */
141 typedef enum {
142     POINTER_WARPING_OUTPUT = 0,
143     POINTER_WARPING_NONE = 1
144 } warping_t;
145 
146 struct gaps_t {
147     int inner;
148     int top;
149     int right;
150     int bottom;
151     int left;
152 };
153 
154 /**
155  * Focus wrapping modes.
156  */
157 typedef enum {
158     FOCUS_WRAPPING_OFF = 0,
159     FOCUS_WRAPPING_ON = 1,
160     FOCUS_WRAPPING_FORCE = 2,
161     FOCUS_WRAPPING_WORKSPACE = 3
162 } focus_wrapping_t;
163 
164 /**
165  * Stores a rectangle, for example the size of a window, the child window etc.
166  *
167  * Note that x and y can contain signed values in some cases (for example when
168  * used for the coordinates of a window, which can be set outside of the
169  * visible area, but not when specifying the position of a workspace for the
170  * _NET_WM_WORKAREA hint). Not declaring x/y as int32_t saves us a lot of
171  * typecasts.
172  *
173  */
174 struct Rect {
175     uint32_t x;
176     uint32_t y;
177     uint32_t width;
178     uint32_t height;
179 };
180 
181 /**
182  * Stores the reserved pixels on each screen edge read from a
183  * _NET_WM_STRUT_PARTIAL.
184  *
185  */
186 struct reservedpx {
187     uint32_t left;
188     uint32_t right;
189     uint32_t top;
190     uint32_t bottom;
191 };
192 
193 /**
194  * Stores a width/height pair, used as part of deco_render_params to check
195  * whether the rects width/height have changed.
196  *
197  */
198 struct width_height {
199     uint32_t w;
200     uint32_t h;
201 };
202 
203 /**
204  * Stores the parameters for rendering a window decoration. This structure is
205  * cached in every Con and no re-rendering will be done if the parameters have
206  * not changed (only the pixmaps will be copied).
207  *
208  */
209 struct deco_render_params {
210     struct Colortriple *color;
211     int border_style;
212     struct width_height con_rect;
213     struct width_height con_window_rect;
214     Rect con_deco_rect;
215     color_t background;
216     layout_t parent_layout;
217     bool con_is_leaf;
218 };
219 
220 /**
221  * Stores which workspace (by name or number) goes to which output and its gaps config.
222  *
223  */
224 struct Workspace_Assignment {
225     char *name;
226     char *output;
227     gaps_t gaps;
228 
229     TAILQ_ENTRY(Workspace_Assignment) ws_assignments;
230 };
231 
232 struct Ignore_Event {
233     int sequence;
234     int response_type;
235     time_t added;
236 
237     SLIST_ENTRY(Ignore_Event) ignore_events;
238 };
239 
240 /**
241  * Stores internal information about a startup sequence, like the workspace it
242  * was initiated on.
243  *
244  */
245 struct Startup_Sequence {
246     /** startup ID for this sequence, generated by libstartup-notification */
247     char *id;
248     /** workspace on which this startup was initiated */
249     char *workspace;
250     /** libstartup-notification context for this launch */
251     SnLauncherContext *context;
252     /** time at which this sequence should be deleted (after it was marked as
253      * completed) */
254     time_t delete_at;
255 
256     TAILQ_ENTRY(Startup_Sequence) sequences;
257 };
258 
259 /**
260  * Regular expression wrapper. It contains the pattern itself as a string (like
261  * ^foo[0-9]$) as well as a pointer to the compiled PCRE expression and the
262  * pcre_extra data returned by pcre_study().
263  *
264  * This makes it easier to have a useful logfile, including the matching or
265  * non-matching pattern.
266  *
267  */
268 struct regex {
269     char *pattern;
270     pcre *regex;
271     pcre_extra *extra;
272 };
273 
274 /**
275  * Stores a resolved keycode (from a keysym), including the modifier mask. Will
276  * be passed to xcb_grab_key().
277  *
278  */
279 struct Binding_Keycode {
280     xcb_keycode_t keycode;
281     i3_event_state_mask_t modifiers;
282     TAILQ_ENTRY(Binding_Keycode) keycodes;
283 };
284 
285 /******************************************************************************
286  * Major types
287  *****************************************************************************/
288 
289 /**
290  * Holds a keybinding, consisting of a keycode combined with modifiers and the
291  * command which is executed as soon as the key is pressed (see
292  * src/config_parser.c)
293  *
294  */
295 struct Binding {
296     /* The type of input this binding is for. (Mouse bindings are not yet
297      * implemented. All bindings are currently assumed to be keyboard bindings.) */
298     input_type_t input_type;
299 
300     /** If true, the binding should be executed upon a KeyRelease event, not a
301      * KeyPress (the default). */
302     enum {
303         /* This binding will only be executed upon KeyPress events */
304         B_UPON_KEYPRESS = 0,
305         /* This binding will be executed either upon a KeyRelease event, or… */
306         B_UPON_KEYRELEASE = 1,
307         /* …upon a KeyRelease event, even if the modifiers don’t match. This
308          * state is triggered from get_binding() when the corresponding
309          * KeyPress (!) happens, so that users can release the modifier keys
310          * before releasing the actual key. */
311         B_UPON_KEYRELEASE_IGNORE_MODS = 2,
312     } release;
313 
314     /** If this is true for a mouse binding, the binding should be executed
315      * when the button is pressed over the window border. */
316     bool border;
317 
318     /** If this is true for a mouse binding, the binding should be executed
319      * when the button is pressed over any part of the window, not just the
320      * title bar (default). */
321     bool whole_window;
322 
323     /** If this is true for a mouse binding, the binding should only be
324      * executed if the button press was not on the titlebar. */
325     bool exclude_titlebar;
326 
327     /** Keycode to bind */
328     uint32_t keycode;
329 
330     /** Bitmask which is applied against event->state for KeyPress and
331      * KeyRelease events to determine whether this binding applies to the
332      * current state. */
333     i3_event_state_mask_t event_state_mask;
334 
335     /** Symbol the user specified in configfile, if any. This needs to be
336      * stored with the binding to be able to re-convert it into a keycode
337      * if the keyboard mapping changes (using Xmodmap for example) */
338     char *symbol;
339 
340     /** Only in use if symbol != NULL. Contains keycodes which generate the
341      * specified symbol. Useful for unbinding and checking which binding was
342      * used when a key press event comes in. */
343     TAILQ_HEAD(keycodes_head, Binding_Keycode) keycodes_head;
344 
345     /** Command, like in command mode */
346     char *command;
347 
348     TAILQ_ENTRY(Binding) bindings;
349 };
350 
351 /**
352  * Holds a command specified by either an:
353  * - exec-line
354  * - exec_always-line
355  * in the config (see src/config.c)
356  *
357  */
358 struct Autostart {
359     /** Command, like in command mode */
360     char *command;
361     /** no_startup_id flag for start_application(). Determines whether a
362      * startup notification context/ID should be created. */
363     bool no_startup_id;
364     TAILQ_ENTRY(Autostart) autostarts;
365     TAILQ_ENTRY(Autostart) autostarts_always;
366 };
367 
368 struct output_name {
369     char *name;
370     SLIST_ENTRY(output_name) names;
371 };
372 
373 /**
374  * An Output is a physical output on your graphics driver. Outputs which
375  * are currently in use have (output->active == true). Each output has a
376  * position and a mode. An output usually corresponds to one connected
377  * screen (except if you are running multiple screens in clone mode).
378  *
379  */
380 struct xoutput {
381     /** Output id, so that we can requery the output directly later */
382     xcb_randr_output_t id;
383 
384     /** Whether the output is currently active (has a CRTC attached with a
385      * valid mode) */
386     bool active;
387 
388     /** Internal flags, necessary for querying RandR screens (happens in
389      * two stages) */
390     bool changed;
391     bool to_be_disabled;
392     bool primary;
393 
394     /** List of names for the output.
395      * An output always has at least one name; the first name is
396      * considered the primary one. */
397     SLIST_HEAD(names_head, output_name) names_head;
398 
399     /** Pointer to the Con which represents this output */
400     Con *con;
401 
402     /** x, y, width, height */
403     Rect rect;
404 
405     TAILQ_ENTRY(xoutput) outputs;
406 };
407 
408 /**
409  * A 'Window' is a type which contains an xcb_window_t and all the related
410  * information (hints like _NET_WM_NAME for that window).
411  *
412  */
413 struct Window {
414     xcb_window_t id;
415 
416     /** Holds the xcb_window_t (just an ID) for the leader window (logical
417      * parent for toolwindows and similar floating windows) */
418     xcb_window_t leader;
419     xcb_window_t transient_for;
420 
421     /** Pointers to the Assignments which were already ran for this Window
422      * (assignments run only once) */
423     uint32_t nr_assignments;
424     Assignment **ran_assignments;
425 
426     char *class_class;
427     char *class_instance;
428 
429     /** The name of the window. */
430     i3String *name;
431 
432     /** The WM_WINDOW_ROLE of this window (for example, the pidgin buddy window
433      * sets "buddy list"). Useful to match specific windows in assignments or
434      * for_window. */
435     char *role;
436 
437     /** WM_CLIENT_MACHINE of the window */
438     char *machine;
439 
440     /** Flag to force re-rendering the decoration upon changes */
441     bool name_x_changed;
442 
443     /** Whether the application used _NET_WM_NAME */
444     bool uses_net_wm_name;
445 
446     /** Whether the application needs to receive WM_TAKE_FOCUS */
447     bool needs_take_focus;
448 
449     /** Whether this window accepts focus. We store this inverted so that the
450      * default will be 'accepts focus'. */
451     bool doesnt_accept_focus;
452 
453     /** The _NET_WM_WINDOW_TYPE for this window. */
454     xcb_atom_t window_type;
455 
456     /** The _NET_WM_DESKTOP for this window. */
457     uint32_t wm_desktop;
458 
459     /** Whether the window says it is a dock window */
460     enum { W_NODOCK = 0,
461            W_DOCK_TOP = 1,
462            W_DOCK_BOTTOM = 2 } dock;
463 
464     /** When this window was marked urgent. 0 means not urgent */
465     struct timeval urgent;
466 
467     /** Pixels the window reserves. left/right/top/bottom */
468     struct reservedpx reserved;
469 
470     /** Depth of the window */
471     uint16_t depth;
472 
473     /* the wanted size of the window, used in combination with size
474      * increments (see below). */
475     int base_width;
476     int base_height;
477 
478     /* minimum increment size specified for the window (in pixels) */
479     int width_increment;
480     int height_increment;
481 
482     /* Minimum size specified for the window. */
483     int min_width;
484     int min_height;
485 
486     /* Maximum size specified for the window. */
487     int max_width;
488     int max_height;
489 
490     /* aspect ratio from WM_NORMAL_HINTS (MPlayer uses this for example) */
491     double min_aspect_ratio;
492     double max_aspect_ratio;
493 
494     /** Window icon, as Cairo surface */
495     cairo_surface_t *icon;
496 
497     /** The window has a nonrectangular shape. */
498     bool shaped;
499     /** The window has a nonrectangular input shape. */
500     bool input_shaped;
501 
502     /* Time when the window became managed. Used to determine whether a window
503      * should be swallowed after initial management. */
504     time_t managed_since;
505 
506     /* The window has been swallowed. */
507     bool swallowed;
508 };
509 
510 /**
511  * A "match" is a data structure which acts like a mask or expression to match
512  * certain windows or not. For example, when using commands, you can specify a
513  * command like this: [title="*Firefox*"] kill. The title member of the match
514  * data structure will then be filled and i3 will check each window using
515  * match_matches_window() to find the windows affected by this command.
516  *
517  */
518 struct Match {
519     /* Set if a criterion was specified incorrectly. */
520     char *error;
521 
522     struct regex *title;
523     struct regex *application;
524     struct regex *class;
525     struct regex *instance;
526     struct regex *mark;
527     struct regex *window_role;
528     struct regex *workspace;
529     struct regex *machine;
530     xcb_atom_t window_type;
531     enum {
532         U_DONTCHECK = -1,
533         U_LATEST = 0,
534         U_OLDEST = 1
535     } urgent;
536     enum {
537         M_DONTCHECK = -1,
538         M_NODOCK = 0,
539         M_DOCK_ANY = 1,
540         M_DOCK_TOP = 2,
541         M_DOCK_BOTTOM = 3
542     } dock;
543     xcb_window_t id;
544     enum { WM_ANY = 0,
545            WM_TILING_AUTO,
546            WM_TILING_USER,
547            WM_TILING,
548            WM_FLOATING_AUTO,
549            WM_FLOATING_USER,
550            WM_FLOATING } window_mode;
551     Con *con_id;
552     bool match_all_windows;
553 
554     /* Where the window looking for a match should be inserted:
555      *
556      * M_HERE   = the matched container will be replaced by the window
557      *            (layout saving)
558      * M_ASSIGN_WS = the matched container will be inserted in the target_ws.
559      * M_BELOW  = the window will be inserted as a child of the matched container
560      *            (dockareas)
561      *
562      */
563     enum { M_HERE = 0,
564            M_ASSIGN_WS,
565            M_BELOW } insert_where;
566 
567     TAILQ_ENTRY(Match) matches;
568 
569     /* Whether this match was generated when restarting i3 inplace.
570      * Leads to not setting focus when managing a new window, because the old
571      * focus stack should be restored. */
572     bool restart_mode;
573 };
574 
575 /**
576  * An Assignment makes specific windows go to a specific workspace/output or
577  * run a command for that window. With this mechanism, the user can -- for
578  * example -- assign their browser to workspace "www". Checking if a window is
579  * assigned works by comparing the Match data structure with the window (see
580  * match_matches_window()).
581  *
582  */
583 struct Assignment {
584     /** type of this assignment:
585      *
586      * A_COMMAND = run the specified command for the matching window
587      * A_TO_WORKSPACE = assign the matching window to the specified workspace
588      * A_NO_FOCUS = don't focus matched window when it is managed
589      *
590      * While the type is a bitmask, only one value can be set at a time. It is
591      * a bitmask to allow filtering for multiple types, for example in the
592      * assignment_for() function.
593      *
594      */
595     enum {
596         A_ANY = 0,
597         A_COMMAND = (1 << 0),
598         A_TO_WORKSPACE = (1 << 1),
599         A_NO_FOCUS = (1 << 2),
600         A_TO_WORKSPACE_NUMBER = (1 << 3),
601         A_TO_OUTPUT = (1 << 4)
602     } type;
603 
604     /** the criteria to check if a window matches */
605     Match match;
606 
607     /** destination workspace/command/output, depending on the type */
608     union {
609         char *command;
610         char *workspace;
611         char *output;
612     } dest;
613 
614     TAILQ_ENTRY(Assignment) assignments;
615 };
616 
617 /** Fullscreen modes. Used by Con.fullscreen_mode. */
618 typedef enum { CF_NONE = 0,
619                CF_OUTPUT = 1,
620                CF_GLOBAL = 2 } fullscreen_mode_t;
621 
622 struct mark_t {
623     char *name;
624 
625     TAILQ_ENTRY(mark_t) marks;
626 };
627 
628 /**
629  * A 'Con' represents everything from the X11 root window down to a single X11 window.
630  *
631  */
632 struct Con {
633     bool mapped;
634 
635     /* Should this container be marked urgent? This gets set when the window
636      * inside this container (if any) sets the urgency hint, for example. */
637     bool urgent;
638 
639     /** This counter contains the number of UnmapNotify events for this
640      * container (or, more precisely, for its ->frame) which should be ignored.
641      * UnmapNotify events need to be ignored when they are caused by i3 itself,
642      * for example when reparenting or when unmapping the window on a workspace
643      * change. */
644     uint8_t ignore_unmap;
645 
646     /* The surface used for the frame window. */
647     surface_t frame;
648     surface_t frame_buffer;
649     bool pixmap_recreated;
650 
651     enum {
652         CT_ROOT = 0,
653         CT_OUTPUT = 1,
654         CT_CON = 2,
655         CT_FLOATING_CON = 3,
656         CT_WORKSPACE = 4,
657         CT_DOCKAREA = 5
658     } type;
659 
660     /** the workspace number, if this Con is of type CT_WORKSPACE and the
661      * workspace is not a named workspace (for named workspaces, num == -1) */
662     int num;
663 
664     /** Only applicable for containers of type CT_WORKSPACE. */
665     gaps_t gaps;
666 
667     struct Con *parent;
668 
669     /* The position and size for this con. These coordinates are absolute. Note
670      * that the rect of a container does not include the decoration. */
671     struct Rect rect;
672     /* The position and size of the actual client window. These coordinates are
673      * relative to the container's rect. */
674     struct Rect window_rect;
675     /* The position and size of the container's decoration. These coordinates
676      * are relative to the container's parent's rect. */
677     struct Rect deco_rect;
678     /** the geometry this window requested when getting mapped */
679     struct Rect geometry;
680 
681     char *name;
682 
683     /** The format with which the window's name should be displayed. */
684     char *title_format;
685 
686     /** Whether the window icon should be displayed, and with what padding. -1
687       * means display no window icon (default behavior), 0 means display without
688       * any padding, 1 means display with 1 pixel of padding and so on. */
689     int window_icon_padding;
690 
691     /* a sticky-group is an identifier which bundles several containers to a
692      * group. The contents are shared between all of them, that is they are
693      * displayed on whichever of the containers is currently visible */
694     char *sticky_group;
695 
696     /* user-definable marks to jump to this container later */
697     TAILQ_HEAD(marks_head, mark_t) marks_head;
698     /* cached to decide whether a redraw is needed */
699     bool mark_changed;
700 
701     double percent;
702 
703     /* the x11 border pixel attribute */
704     int border_width;
705     int current_border_width;
706 
707     struct Window *window;
708 
709     /* timer used for disabling urgency */
710     struct ev_timer *urgency_timer;
711 
712     /** Cache for the decoration rendering */
713     struct deco_render_params *deco_render_params;
714 
715     /* Only workspace-containers can have floating clients */
716     TAILQ_HEAD(floating_head, Con) floating_head;
717 
718     TAILQ_HEAD(nodes_head, Con) nodes_head;
719     TAILQ_HEAD(focus_head, Con) focus_head;
720 
721     TAILQ_HEAD(swallow_head, Match) swallow_head;
722 
723     fullscreen_mode_t fullscreen_mode;
724 
725     /* Whether this window should stick to the glass. This corresponds to
726      * the _NET_WM_STATE_STICKY atom and will only be respected if the
727      * window is floating. */
728     bool sticky;
729 
730     /* layout is the layout of this container: one of split[v|h], stacked or
731      * tabbed. Special containers in the tree (above workspaces) have special
732      * layouts like dockarea or output.
733      *
734      * last_split_layout is one of splitv or splith to support the old "layout
735      * default" command which by now should be "layout splitv" or "layout
736      * splith" explicitly.
737      *
738      * workspace_layout is only for type == CT_WORKSPACE cons. When you change
739      * the layout of a workspace without any children, i3 cannot just set the
740      * layout (because workspaces need to be splitv/splith to allow focus
741      * parent and opening new containers). Instead, it stores the requested
742      * layout in workspace_layout and creates a new split container with that
743      * layout whenever a new container is attached to the workspace. */
744     layout_t layout, last_split_layout, workspace_layout;
745     border_style_t border_style;
746     /** floating? (= not in tiling layout) This cannot be simply a bool
747      * because we want to keep track of whether the status was set by the
748      * application (by setting _NET_WM_WINDOW_TYPE appropriately) or by the
749      * user. The user’s choice overwrites automatic mode, of course. The
750      * order of the values is important because we check with >=
751      * FLOATING_AUTO_ON if a client is floating. */
752     enum {
753         FLOATING_AUTO_OFF = 0,
754         FLOATING_USER_OFF = 1,
755         FLOATING_AUTO_ON = 2,
756         FLOATING_USER_ON = 3
757     } floating;
758 
759     TAILQ_ENTRY(Con) nodes;
760     TAILQ_ENTRY(Con) focused;
761     TAILQ_ENTRY(Con) all_cons;
762     TAILQ_ENTRY(Con) floating_windows;
763 
764     /** callbacks */
765     void (*on_remove_child)(Con *);
766 
767     enum {
768         /* Not a scratchpad window. */
769         SCRATCHPAD_NONE = 0,
770 
771         /* Just moved to scratchpad, not resized by the user yet.
772          * Window will be auto-centered and sized appropriately. */
773         SCRATCHPAD_FRESH = 1,
774 
775         /* The user changed position/size of the scratchpad window. */
776         SCRATCHPAD_CHANGED = 2
777     } scratchpad_state;
778 
779     /* The ID of this container before restarting. Necessary to correctly
780      * interpret back-references in the JSON (such as the focus stack). */
781     int old_id;
782 
783     /* Depth of the container window */
784     uint16_t depth;
785 
786     /* The colormap for this con if a custom one is used. */
787     xcb_colormap_t colormap;
788 };
789