#include <stdlib.h>
#include <string.h>
+#include <math.h>
#include <xcb/xcb.h>
#include <xcb/xcb_event.h>
#include "bspwm.h"
#include "helpers.h"
-void logmsg(FILE *stream, char *fmt, va_list ap)
-{
- vfprintf(stream, fmt, ap);
-}
-
void warn(char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
- logmsg(stderr, fmt, ap);
+ vfprintf(stderr, fmt, ap);
va_end(ap);
}
__attribute__((noreturn))
-void die(char *fmt, ...)
+void err(char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
- logmsg(stderr, fmt, ap);
+ vfprintf(stderr, fmt, ap);
va_end(ap);
exit(EXIT_FAILURE);
}
return pxl;
}
+
+double distance(xcb_point_t a, xcb_point_t b)
+{
+ return hypot(a.x - b.x, a.y - b.y);
+}