aboutsummaryrefslogtreecommitdiff
path: root/cursor-shape.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2023-06-27 14:57:33 +0000
committerDaniel Eklöf <daniel@ekloef.se>2023-07-03 12:36:32 +0000
commitee794a121e4603d01fb662ad6d1f3b18b6937d2c (patch)
tree704298b5e68dece52429d14237d6a857764cbbdb /cursor-shape.c
parentwayland: handle enum value XDG_TOPLEVEL_STATE_SUSPENDED (diff)
refactor: track current xcursor using an enum, instead of a char pointer
Diffstat (limited to 'cursor-shape.c')
-rw-r--r--cursor-shape.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/cursor-shape.c b/cursor-shape.c
new file mode 100644
index 00000000..152f176f
--- /dev/null
+++ b/cursor-shape.c
@@ -0,0 +1,29 @@
+#include <stdlib.h>
+
+#include "cursor-shape.h"
+#include "debug.h"
+#include "util.h"
+
+const char *
+cursor_shape_to_string(enum cursor_shape shape)
+{
+ static const char *const table[] = {
+ [CURSOR_SHAPE_NONE] = NULL,
+ [CURSOR_SHAPE_HIDDEN] = "hidden",
+ [CURSOR_SHAPE_LEFT_PTR] = "left_ptr",
+ [CURSOR_SHAPE_TEXT] = "text",
+ [CURSOR_SHAPE_TEXT_FALLBACK] = "xterm",
+ [CURSOR_SHAPE_TOP_LEFT_CORNER] = "top_left_corner",
+ [CURSOR_SHAPE_TOP_RIGHT_CORNER] = "top_right_corner",
+ [CURSOR_SHAPE_BOTTOM_LEFT_CORNER] = "bottom_left_corner",
+ [CURSOR_SHAPE_BOTTOM_RIGHT_CORNER] = "bottom_right_corner",
+ [CURSOR_SHAPE_LEFT_SIDE] = "left_side",
+ [CURSOR_SHAPE_RIGHT_SIDE] = "right_side",
+ [CURSOR_SHAPE_TOP_SIDE] = "top_side",
+ [CURSOR_SHAPE_BOTTOM_SIDE] = "bottom_side",
+
+ };
+
+ xassert(shape <= ALEN(table));
+ return table[shape];
+}