]> git.lizzy.rs Git - bspwm.git/blobdiff - helpers.c
Fix silly mistakes in `send_desktop_to`
[bspwm.git] / helpers.c
index 12b8f6c1e5d6d76f0fdb3c63dd7457471613fc0e..45e3e6a11c8c4cea4ae22d2187720d9c243d3882 100644 (file)
--- a/helpers.c
+++ b/helpers.c
@@ -1,29 +1,25 @@
 #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);
 }
@@ -56,3 +52,8 @@ uint32_t get_color(char *col)
 
     return pxl;
 }
+
+double distance(xcb_point_t a, xcb_point_t b)
+{
+    return hypot(a.x - b.x, a.y - b.y);
+}