]> git.sur5r.net Git - i3/i3/blob - data.h
Make table dynamic
[i3/i3] / data.h
1 #include <xcb/xcb.h>
2
3 #ifndef _DATA_H
4 #define _DATA_H
5 /*
6  * This file defines all data structures used by i3
7  *
8  */
9 #include "queue.h"
10
11 /* Forward definitions */
12 typedef struct Cell Cell;
13 typedef struct Font Font;
14 typedef struct Container Container;
15 typedef struct Client Client;
16
17 /* Helper types */
18 typedef enum { D_LEFT, D_RIGHT, D_UP, D_DOWN } direction_t;
19 struct table_dimensions_t {
20         int x;
21         int y;
22 };
23
24 /*
25  * Defines a position in the table
26  *
27  */
28 struct Cell {
29         int row;
30         int column;
31 };
32
33 /*
34  * We need to save the height of a font because it is required for each drawing of
35  * text but relatively hard to get. As soon as a new font needs to be loaded, a
36  * Font-entry will be filled for later use.
37  *
38  */
39 struct Font {
40         char *name;
41         int height;
42 };
43
44 /*
45  * A client is X11-speak for a window.
46  *
47  */
48 struct Client {
49         /* TODO: this is NOT final */
50         Cell old_position; /* if you set a client to floating and set it back to managed,
51                               it does remember its old position and *tries* to get back there */
52
53         /* Backpointer. A client is inside a container */
54         Container *container;
55
56
57         /* XCB contexts */
58         xcb_gcontext_t titlegc;
59         xcb_window_t window;
60         xcb_window_t child;
61
62         /* The following entry provides the necessary list pointers to use Client with LIST_* macros */
63         CIRCLEQ_ENTRY(Client) clients;
64 };
65
66 /*
67  * A container is either in default or stacking mode. It sits inside the table.
68  *
69  */
70 struct Container {
71         /* Those are speaking for themselves: */
72         Client *currently_focused;
73
74         /* Position of the container inside our table */
75         int row;
76         int col;
77         /* Width/Height of the container. Changeable by the user */
78         int width;
79         int height;
80         /* Ensure MODE_DEFAULT maps to 0 because we use calloc for initialization later */
81         enum { MODE_DEFAULT = 0, MODE_STACK = 1 } mode;
82         CIRCLEQ_HEAD(client_head, Client) clients;
83 };
84
85 #endif