summaryrefslogtreecommitdiff
path: root/src/defs.h
diff options
context:
space:
mode:
authoruint23 <[email protected]>2025-04-17 12:50:13 +0100
committeruint23 <[email protected]>2025-04-17 12:50:13 +0100
commitc1aa40459115b5476726abd8ab793d57d4523bd0 (patch)
treeeeb319b146b098bd86652bd6ae923217c3e9cc06 /src/defs.h
parentbd49afd48693fd604d1b9a32c49c73f36f8e11a7 (diff)
snap borders and release time ( less cpu usage)
Diffstat (limited to 'src/defs.h')
-rw-r--r--src/defs.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/defs.h b/src/defs.h
index 1521f0a..c9ca97b 100644
--- a/src/defs.h
+++ b/src/defs.h
@@ -16,6 +16,15 @@
#define BIND(mod, key, cmdstr) { (mod), XK_##key, { cmdstr }, 0 }
#define CALL(mod, key, fnptr) { (mod), XK_##key, { .fn = fnptr }, 1 }
+#define UDIST(a,b) abs((int)(a) - (int)(b))
+#define SNAP_EDGE(pos, size, bound) \
+ do { \
+ if (UDIST(pos, 0) < SNAP_DISTANCE) \
+ pos = 0; \
+ else if (UDIST(pos, (bound) - (size)) < SNAP_DISTANCE)\
+ pos = (bound) - (size); \
+ } while (0)
+
#define MAXCLIENTS 64
enum { DRAG_NONE, DRAG_MOVE, DRAG_RESIZE } drag_mode = DRAG_NONE;