]> git.lizzy.rs Git - bspwm.git/blob - types.c
Proper strings, drop non POSIX strdup
[bspwm.git] / types.c
1 #include <stdlib.h>
2 #include <string.h>
3 #include <xcb/xcb.h>
4 #include <xcb/xcb_event.h>
5 #include "types.h"
6
7 node_t *make_node(void)
8 {
9     node_t *n = malloc(sizeof(node_t));
10     n->parent = n->first_child = n->second_child = NULL;
11     n->split_ratio = SPLIT_RATIO;
12     n->split_type = TYPE_VERTICAL;
13     n->client = NULL;
14     n->vacant = false;
15     return n;
16 }
17
18 desktop_t *make_desktop(void)
19 {
20     desktop_t *d = malloc(sizeof(desktop_t));
21     strncpy(d->name, DESK_NAME, sizeof(d->name));
22     d->layout = LAYOUT_TILED;
23     d->prev = d->next = NULL;
24     d->root = d->focus = d->last_focus = NULL;
25     return d;
26 }
27
28 client_t *make_client(xcb_window_t win)
29 {
30     client_t *c = malloc(sizeof(client_t));
31     c->window = win;
32     c->floating = c->fullscreen = c->locked = false;
33     return c;
34 }
35
36 rule_t *make_rule(void)
37 {
38     rule_t *r = malloc(sizeof(rule_t));
39     r->floating = r->fullscreen = r->locked = r->centered = false;
40     return r;
41 }