summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@gnugeneration.com>2017-02-24 19:36:08 -0800
committerVito Caputo <vcaputo@gnugeneration.com>2017-03-14 19:41:48 -0700
commitec9fd6bc0e7558c58e27692147f185bf5a596e2b (patch)
tree8de10239343ff2a4c9f77aee364edc246493de08
parentecd88826ac1f0bf3513c23a5ee90ae360422f618 (diff)
vwm: split out helper macros into util.h
In preparation for separating out the monitoring overlay code from being vwm-coupled, moving these into an independent header since they'll be used throughout.
-rw-r--r--src/Makefile.am2
-rw-r--r--src/util.h21
-rw-r--r--src/vwm.h25
3 files changed, 25 insertions, 23 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index d345bbd..a65aa86 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,5 +1,5 @@
SUBDIRS = libvmon
bin_PROGRAMS = vwm
-vwm_SOURCES = clickety.c composite.c context.c desktop.c key.c launch.c logo.c overlay.c screen.c vwm.c window.c xevent.c xwindow.c clickety.h composite.h context.h desktop.h key.h launch.h list.h logo.h overlay.h screen.h vwm.h window.h xevent.h xwindow.h colors.def launchers.def
+vwm_SOURCES = clickety.c composite.c context.c desktop.c key.c launch.c logo.c overlay.c screen.c vwm.c window.c xevent.c xwindow.c clickety.h composite.h context.h desktop.h key.h launch.h list.h logo.h overlay.h screen.h util.h vwm.h window.h xevent.h xwindow.h colors.def launchers.def
vwm_LDADD = @VWM_LIBS@ libvmon/libvmon.a
vwm_CPPFLAGS = @VWM_CFLAGS@
diff --git a/src/util.h b/src/util.h
new file mode 100644
index 0000000..9bd6a31
--- /dev/null
+++ b/src/util.h
@@ -0,0 +1,21 @@
+#ifndef _UTIL_H
+#define _UTIL_H
+
+#include <stdio.h>
+#include <errno.h>
+
+#define VWM_ERROR(_fmt, _args...) fprintf(stderr, "%s:%i\t%s() "_fmt"\n", __FILE__, __LINE__, __FUNCTION__, ##_args)
+#define VWM_PERROR(_fmt, _args...) fprintf(stderr, "%s:%i\t%s() "_fmt"; %s\n", __FILE__, __LINE__, __FUNCTION__, ##_args, strerror(errno))
+#define VWM_BUG(_fmt, _args...) fprintf(stderr, "BUG %s:%i\t%s() "_fmt"; %s\n", __FILE__, __LINE__, __FUNCTION__, ##_args, strerror(errno))
+
+#ifdef TRACE
+#define VWM_TRACE(_fmt, _args...) fprintf(stderr, "%s:%i\t%s() "_fmt"\n", __FILE__, __LINE__, __FUNCTION__, ##_args)
+#else
+#define VWM_TRACE(_fmt, _args...) do { } while(0)
+#endif
+
+#define MIN(_a, _b) ((_a) < (_b) ? (_a) : (_b))
+#define MAX(_a, _b) ((_a) > (_b) ? (_a) : (_b))
+#define NELEMS(_a) (sizeof(_a) / sizeof(_a[0]))
+
+#endif
diff --git a/src/vwm.h b/src/vwm.h
index 6442faa..fb7ed65 100644
--- a/src/vwm.h
+++ b/src/vwm.h
@@ -1,15 +1,14 @@
-#ifndef _UTIL_H
-#define _UTIL_H
+#ifndef _VWM_H
+#define _VWM_H
-#include <stdio.h>
// #include <X11/Xlib.h>
// #include <X11/Xutil.h>
-#include <errno.h>
#include <X11/Xlib.h>
#include <X11/extensions/Xinerama.h>
#include "context.h"
#include "list.h"
+#include "util.h"
#define WINDOW_BORDER_WIDTH 1
#define WM_GRAB_MODIFIER Mod1Mask /* the modifier for invoking vwm's controls */
@@ -23,24 +22,6 @@
#define CONSOLE_SESSION_STRING "_vwm_console.$DISPLAY" /* the unique console screen session identifier */
-#define VWM_ERROR(_fmt, _args...) fprintf(stderr, "%s:%i\t%s() "_fmt"\n", __FILE__, __LINE__, __FUNCTION__, ##_args)
-#define VWM_PERROR(_fmt, _args...) fprintf(stderr, "%s:%i\t%s() "_fmt"; %s\n", __FILE__, __LINE__, __FUNCTION__, ##_args, strerror(errno))
-#define VWM_BUG(_fmt, _args...) fprintf(stderr, "BUG %s:%i\t%s() "_fmt"; %s\n", __FILE__, __LINE__, __FUNCTION__, ##_args, strerror(errno))
-
-#ifdef TRACE
-#define VWM_TRACE(_fmt, _args...) fprintf(stderr, "%s:%i\t%s() "_fmt"\n", __FILE__, __LINE__, __FUNCTION__, ##_args)
-#else
-#define VWM_TRACE(_fmt, _args...) do { } while(0)
-#endif
-
-#define VWM_XROOT(_vwm) RootWindow((_vwm)->display, (_vwm)->screen_num)
-#define VWM_XVISUAL(_vwm) DefaultVisual((_vwm)->display, (_vwm)->screen_num)
-#define VWM_XDEPTH(_vwm) DefaultDepth((_vwm)->display, (_vwm)->screen_num)
-
-#define MIN(_a, _b) ((_a) < (_b) ? (_a) : (_b))
-#define MAX(_a, _b) ((_a) > (_b) ? (_a) : (_b))
-#define NELEMS(_a) (sizeof(_a) / sizeof(_a[0]))
-
typedef struct _vwm_window_t vwm_window_t;
typedef struct _vwm_desktop_t vwm_desktop_t;
© All Rights Reserved