]> Pileus Git - wmpus/commitdiff
Split x11 into xlib and xcb systems
authorAndy Spencer <andy753421@gmail.com>
Mon, 6 Apr 2015 23:46:00 +0000 (23:46 +0000)
committerAndy Spencer <andy753421@gmail.com>
Wed, 15 Apr 2015 19:54:07 +0000 (19:54 +0000)
makefile
sys-xcb.c [new file with mode: 0644]
sys-xlib.c [moved from sys-x11.c with 100% similarity]

index 9eb59248489ff5d974d8ef71a72a8dc9dc85ce48..d556e1451422dc6ced17642338989c5c04254d23 100644 (file)
--- a/makefile
+++ b/makefile
@@ -10,7 +10,13 @@ CFLAGS    ?= -g -Wall
 PREFIX    ?= /usr/local
 MANPREFIX ?= ${PREFIX}/share/man
 
-ifeq ($(SYS),x11)
+ifeq ($(SYS),xcb)
+GCC       ?= gcc
+PROG      ?= wmpus
+LDFLAGS   += -lxcb
+endif
+
+ifeq ($(SYS),xlib)
 GCC       ?= gcc
 PROG      ?= wmpus
 LDFLAGS   += -lX11 -lXinerama
diff --git a/sys-xcb.c b/sys-xcb.c
new file mode 100644 (file)
index 0000000..87dcb01
--- /dev/null
+++ b/sys-xcb.c
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2015 Andy Spencer <andy753421@gmail.com>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ */
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <xcb/xcb.h>
+
+#include "util.h"
+#include "conf.h"
+#include "types.h"
+#include "sys.h"
+#include "wm.h"
+
+/* Configuration */
+static int border     = 2;
+static int stack      = 25;
+static int no_capture = 0;
+
+/* Internal structures */
+struct win_sys {
+};
+
+/* Global data */
+static xcb_connection_t *conn;
+static list_t           *screens;
+
+/********************
+ * System functions *
+ ********************/
+void sys_move(win_t *win, int x, int y, int w, int h)
+{
+       printf("sys_move: %p - %dx%d @ %d,%d\n",
+                       win, w, h, x, y);
+}
+
+void sys_raise(win_t *win)
+{
+       printf("sys_raise: %p\n", win);
+}
+
+void sys_focus(win_t *win)
+{
+       printf("sys_focus: %p\n", win);
+}
+
+void sys_show(win_t *win, state_t state)
+{
+       printf("sys_show: %p - %d\n", win, state);
+}
+
+void sys_watch(win_t *win, event_t ev, mod_t mod)
+{
+       printf("sys_watch: %p - 0x%X,0x%X\n", win, ev, mod2int(mod));
+}
+
+void sys_unwatch(win_t *win, event_t ev, mod_t mod)
+{
+       printf("sys_unwatch: %p - 0x%X,0x%X\n", win, ev, mod2int(mod));
+}
+
+list_t *sys_info(void)
+{
+       printf("sys_info\n");
+       if (screens == NULL) {
+               win_t *screen = new0(win_t);
+               screens = list_insert(NULL, screen);
+       }
+       return screens;
+}
+
+void sys_init(void)
+{
+       printf("sys_init\n");
+
+       /* Load configuration */
+       stack      = conf_get_int("main.stack",      stack);
+       border     = conf_get_int("main.border",     border);
+       no_capture = conf_get_int("main.no-capture", no_capture);
+
+       /* Connect to display */
+       if (!(conn = xcb_connect(NULL, NULL)))
+               error("xcb connect failed");
+       if (xcb_connection_has_error(conn))
+               error("xcb connection has errors");
+}
+
+void sys_run(void)
+{
+       printf("sys_run\n");
+}
+
+void sys_exit(void)
+{
+       printf("sys_exit\n");
+}
+
+void sys_free(void)
+{
+       printf("sys_free\n");
+}
similarity index 100%
rename from sys-x11.c
rename to sys-xlib.c