summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.h4
-rw-r--r--xnap.c8
2 files changed, 11 insertions, 1 deletions
diff --git a/config.h b/config.h
index e69de29..5fb725c 100644
--- a/config.h
+++ b/config.h
@@ -0,0 +1,4 @@
+#include <X11/cursorfont.h>
+
+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 <stdio.h>
#include <X11/X.h>
+#include <X11/cursorfont.h>
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <X11/Xutil.h>
@@ -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");