diff options
author | rafa_99 <rafa99@protonmail.com> | 2019-10-06 14:58:32 +0000 |
---|---|---|
committer | rafa_99 <rafa99@protonmail.com> | 2019-10-06 14:58:32 +0000 |
commit | 771a35b0baf094c6de98697f5a8a210b0fecab21 (patch) | |
tree | f5c7c4c2bdff6e6a73a2d76250234c6aab5c3797 /sent.c | |
parent | a4bc34d7bfc9c1b864edd50cb9ba43e4bdaf2e58 (diff) |
Toogle Cursor Patch
Diffstat (limited to 'sent.c')
-rw-r--r-- | sent.c | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -18,6 +18,7 @@ #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/Xft/Xft.h> +#include <X11/cursorfont.h> #include "arg.h" #include "util.h" @@ -97,6 +98,7 @@ static void cleanup(int slidesonly); static void reload(const Arg *arg); static void load(FILE *fp); static void advance(const Arg *arg); +static void toggle_cursor(const Arg *arg); static void quit(const Arg *arg); static void resize(int width, int height); static void run(); @@ -515,6 +517,31 @@ advance(const Arg *arg) } void + +void toggle_cursor(const Arg *arg) +{ + Cursor cursor; + XColor color; + Pixmap bitmapNoData; + char noData[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + static int cursor_visible = 1; + + memset(&color, 0, sizeof(color)); + + + if (cursor_visible) { + bitmapNoData = XCreateBitmapFromData(xw.dpy, xw.win, noData, 8, 8); + cursor = XCreatePixmapCursor(xw.dpy, bitmapNoData, + bitmapNoData, &color, &color, 0, 0); + XFreePixmap(xw.dpy, bitmapNoData); + } else { + cursor = XCreateFontCursor(xw.dpy, XC_left_ptr); + } + XDefineCursor(xw.dpy, xw.win, cursor); + XFreeCursor(xw.dpy, cursor); + cursor_visible ^= 1; +} + quit(const Arg *arg) { running = 0; |