aboutsummaryrefslogtreecommitdiff
path: root/rootston/xcursor.c
blob: 74e732c9bb3e95829835b0b189b80eb5f0c5b498 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#define _POSIX_C_SOURCE 200809L
#include <stdlib.h>
#include <string.h>
#include "rootston/xcursor.h"
#include "rootston/input.h"

const char *roots_xcursor_get_resize_name(uint32_t edges) {
	if (edges & ROOTS_CURSOR_RESIZE_EDGE_TOP) {
		if (edges & ROOTS_CURSOR_RESIZE_EDGE_RIGHT) {
			return "ne-resize";
		} else if (edges & ROOTS_CURSOR_RESIZE_EDGE_LEFT) {
			return "nw-resize";
		}
		return "n-resize";
	} else if (edges & ROOTS_CURSOR_RESIZE_EDGE_BOTTOM) {
		if (edges & ROOTS_CURSOR_RESIZE_EDGE_RIGHT) {
			return "se-resize";
		} else if (edges & ROOTS_CURSOR_RESIZE_EDGE_LEFT) {
			return "sw-resize";
		}
		return "s-resize";
	} else if (edges & ROOTS_CURSOR_RESIZE_EDGE_RIGHT) {
		return "e-resize";
	} else if (edges & ROOTS_CURSOR_RESIZE_EDGE_LEFT) {
		return "w-resize";
	}
	return "se-resize"; // fallback
}