From 61d0cff357389f5e6b7b729035b677d7ca9588c0 Mon Sep 17 00:00:00 2001 From: uint Date: Sun, 14 Dec 2025 17:22:59 +0000 Subject: add cursor fonts --- config.h | 4 ++++ xnap.c | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/config.h b/config.h index e69de29..5fb725c 100644 --- a/config.h +++ b/config.h @@ -0,0 +1,4 @@ +#include + +static int cursor_font = XC_heart; +static const char* save_path = "/path/to/your/screenshots"; diff --git a/xnap.c b/xnap.c index d4c0c06..a6cc3b6 100644 --- a/xnap.c +++ b/xnap.c @@ -2,6 +2,7 @@ #include #include +#include #include #include #include @@ -13,7 +14,10 @@ struct pointer_t { int ret; + Bool sel; + Cursor selcur; + int x0; int y0; int x1; @@ -113,6 +117,7 @@ void mkppm(const char* path, XImage* img) void quit(Bool ex) { XUngrabPointer(dpy, CurrentTime); + XFreeCursor(dpy, p.selcur); XCloseDisplay(dpy); if (ex) exit(EXIT_SUCCESS); @@ -156,10 +161,11 @@ void setup(void) root = RootWindow(dpy, scr); /* pointer */ + p.selcur = XCreateFontCursor(dpy, cursor_font); p.ret = XGrabPointer( dpy, root, False, ButtonPressMask | ButtonReleaseMask | PointerMotionMask, - GrabModeAsync, GrabModeAsync, None, None, CurrentTime + GrabModeAsync, GrabModeAsync, None, p.selcur, CurrentTime ); if (p.ret != GrabSuccess) die("XGrabPointer failed"); -- cgit v1.2.3