]> Pileus Git - wmpus/blob - sys-xcb.c
Split x11 into xlib and xcb systems
[wmpus] / sys-xcb.c
1 /*
2  * Copyright (c) 2015 Andy Spencer <andy753421@gmail.com>
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  */
15
16 #define _GNU_SOURCE
17 #include <stdio.h>
18 #include <stdlib.h>
19
20 #include <xcb/xcb.h>
21
22 #include "util.h"
23 #include "conf.h"
24 #include "types.h"
25 #include "sys.h"
26 #include "wm.h"
27
28 /* Configuration */
29 static int border     = 2;
30 static int stack      = 25;
31 static int no_capture = 0;
32
33 /* Internal structures */
34 struct win_sys {
35 };
36
37 /* Global data */
38 static xcb_connection_t *conn;
39 static list_t           *screens;
40
41 /********************
42  * System functions *
43  ********************/
44 void sys_move(win_t *win, int x, int y, int w, int h)
45 {
46         printf("sys_move: %p - %dx%d @ %d,%d\n",
47                         win, w, h, x, y);
48 }
49
50 void sys_raise(win_t *win)
51 {
52         printf("sys_raise: %p\n", win);
53 }
54
55 void sys_focus(win_t *win)
56 {
57         printf("sys_focus: %p\n", win);
58 }
59
60 void sys_show(win_t *win, state_t state)
61 {
62         printf("sys_show: %p - %d\n", win, state);
63 }
64
65 void sys_watch(win_t *win, event_t ev, mod_t mod)
66 {
67         printf("sys_watch: %p - 0x%X,0x%X\n", win, ev, mod2int(mod));
68 }
69
70 void sys_unwatch(win_t *win, event_t ev, mod_t mod)
71 {
72         printf("sys_unwatch: %p - 0x%X,0x%X\n", win, ev, mod2int(mod));
73 }
74
75 list_t *sys_info(void)
76 {
77         printf("sys_info\n");
78         if (screens == NULL) {
79                 win_t *screen = new0(win_t);
80                 screens = list_insert(NULL, screen);
81         }
82         return screens;
83 }
84
85 void sys_init(void)
86 {
87         printf("sys_init\n");
88
89         /* Load configuration */
90         stack      = conf_get_int("main.stack",      stack);
91         border     = conf_get_int("main.border",     border);
92         no_capture = conf_get_int("main.no-capture", no_capture);
93
94         /* Connect to display */
95         if (!(conn = xcb_connect(NULL, NULL)))
96                 error("xcb connect failed");
97         if (xcb_connection_has_error(conn))
98                 error("xcb connection has errors");
99 }
100
101 void sys_run(void)
102 {
103         printf("sys_run\n");
104 }
105
106 void sys_exit(void)
107 {
108         printf("sys_exit\n");
109 }
110
111 void sys_free(void)
112 {
113         printf("sys_free\n");
114 }