commit 10670e642a08a34311ece70f0d92fe5ada44a1b3
parent 395aa6512699381b5b97acf7200ec15b2e37b52f
Author: FRIGN <dev@frign.de>
Date: Thu, 17 Sep 2015 18:37:08 +0200
st hidecursor - Rename patch, update git-diff, rework page
Diffstat:
8 files changed, 275 insertions(+), 320 deletions(-)
diff --git a/st.suckless.org/patches/hide_X_cursor.md b/st.suckless.org/patches/hide_X_cursor.md
@@ -1,20 +0,0 @@
-Hide X cursor
-=============
-
-Description
------------
-
-Hide the X cursor whenever a key is pressed and show it back when the mouse is
-moved in the terminal window.
-
-Download
---------
-
-* [st-0.5-hidexcursor.diff](st-0.5-hidexcursor.diff)
-* [st-0.6-hidexcursor.diff](st-0.6-hidexcursor.diff)
-* [st-git-hidexcursor.diff](st-git-hidexcursor.diff)
-
-Author
-------
-
- * Ivan Delalande - colona
diff --git a/st.suckless.org/patches/hidecursor.md b/st.suckless.org/patches/hidecursor.md
@@ -0,0 +1,21 @@
+hidecursor
+==========
+
+Description
+-----------
+
+Hide the X cursor whenever a key is pressed and show it back when the mouse
+is moved in the terminal window.
+
+Download
+--------
+
+* [st-0.5-hidecursor.diff](st-0.5-hidecursor.diff)
+* [st-0.6-hidecursor.diff](st-0.6-hidecursor.diff)
+* [st-git-20150917-hidecursor.diff](st-git-20150917-hidecursor.diff)
+
+Author
+------
+
+ * Ivan Delalande - colona@ycc.fr
+ * Laslo Hunhold - dev@frign.de (st-git-20150917 port)
diff --git a/st.suckless.org/patches/st-0.5-hidecursor.diff b/st.suckless.org/patches/st-0.5-hidecursor.diff
@@ -0,0 +1,82 @@
+diff --git a/st.c b/st.c
+index 392f12d..52deb92 100644
+--- a/st.c
++++ b/st.c
+@@ -248,6 +248,8 @@ typedef struct {
+ Draw draw;
+ Visual *vis;
+ XSetWindowAttributes attrs;
++ Cursor cursor, bcursor; /* visible and blank cursors */
++ bool cursorstate; /* is cursor currently visible */
+ int scr;
+ bool isfixed; /* is fixed geometry? */
+ int fx, fy, fw, fh; /* fixed geometry */
+@@ -1112,6 +1114,13 @@ void
+ bmotion(XEvent *e) {
+ int oldey, oldex, oldsby, oldsey;
+
++ if(!xw.cursorstate) {
++ XDefineCursor(xw.dpy, xw.win, xw.cursor);
++ xw.cursorstate = true;
++ if(!IS_SET(MODE_MOUSEMANY))
++ xsetpointermotion(0);
++ }
++
+ if(IS_SET(MODE_MOUSE)) {
+ mousereport(e);
+ return;
+@@ -2984,10 +2993,12 @@ xzoom(const Arg *arg) {
+ void
+ xinit(void) {
+ XGCValues gcvalues;
+- Cursor cursor;
+ Window parent;
+ int sw, sh;
+ pid_t thispid = getpid();
++ XColor xcwhite = {.red = 0xffff, .green = 0xffff, .blue = 0xffff};
++ XColor xcblack = {.red = 0x0000, .green = 0x0000, .blue = 0x0000};
++ Pixmap blankpm;
+
+ if(!(xw.dpy = XOpenDisplay(NULL)))
+ die("Can't open display\n");
+@@ -3071,11 +3082,13 @@ xinit(void) {
+ die("XCreateIC failed. Could not obtain input method.\n");
+
+ /* white cursor, black outline */
+- cursor = XCreateFontCursor(xw.dpy, XC_xterm);
+- XDefineCursor(xw.dpy, xw.win, cursor);
+- XRecolorCursor(xw.dpy, cursor,
+- &(XColor){.red = 0xffff, .green = 0xffff, .blue = 0xffff},
+- &(XColor){.red = 0x0000, .green = 0x0000, .blue = 0x0000});
++ xw.cursor = XCreateFontCursor(xw.dpy, XC_xterm);
++ XDefineCursor(xw.dpy, xw.win, xw.cursor);
++ XRecolorCursor(xw.dpy, xw.cursor, &xcwhite, &xcblack);
++ xw.cursorstate = true;
++ blankpm = XCreateBitmapFromData(xw.dpy, xw.win, &(char){0}, 1, 1);
++ xw.bcursor = XCreatePixmapCursor(xw.dpy, blankpm, blankpm,
++ &xcblack, &xcblack, 0, 0);
+
+ xw.xembed = XInternAtom(xw.dpy, "_XEMBED", False);
+ xw.wmdeletewin = XInternAtom(xw.dpy, "WM_DELETE_WINDOW", False);
+@@ -3537,6 +3550,8 @@ unmap(XEvent *ev) {
+
+ void
+ xsetpointermotion(int set) {
++ if(!set && !xw.cursorstate)
++ return;
+ MODBIT(xw.attrs.event_mask, set, PointerMotionMask);
+ XChangeWindowAttributes(xw.dpy, xw.win, CWEventMask, &xw.attrs);
+ }
+@@ -3630,6 +3645,12 @@ kpress(XEvent *ev) {
+ Status status;
+ Shortcut *bp;
+
++ if(xw.cursorstate) {
++ XDefineCursor(xw.dpy, xw.win, xw.bcursor);
++ xsetpointermotion(1);
++ xw.cursorstate = false;
++ }
++
+ if(IS_SET(MODE_KBDLOCK))
+ return;
+
diff --git a/st.suckless.org/patches/st-0.5-hidexcursor.diff b/st.suckless.org/patches/st-0.5-hidexcursor.diff
@@ -1,96 +0,0 @@
-From d081963fc75e1656f5ee4305947384a00b9e5f39 Mon Sep 17 00:00:00 2001
-From: Colona <colona@ycc.fr>
-Date: Mon, 9 Jun 2014 00:55:54 -0700
-Subject: [PATCH] Hide X cursor when typing.
-
-Hide the X cursor when typing in the terminal. The cursor is displayed again
-when the mouse is moved.
----
- st.c | 33 +++++++++++++++++++++++++++------
- 1 file changed, 27 insertions(+), 6 deletions(-)
-
-diff --git a/st.c b/st.c
-index 392f12d..52deb92 100644
---- a/st.c
-+++ b/st.c
-@@ -248,6 +248,8 @@ typedef struct {
- Draw draw;
- Visual *vis;
- XSetWindowAttributes attrs;
-+ Cursor cursor, bcursor; /* visible and blank cursors */
-+ bool cursorstate; /* is cursor currently visible */
- int scr;
- bool isfixed; /* is fixed geometry? */
- int fx, fy, fw, fh; /* fixed geometry */
-@@ -1112,6 +1114,13 @@ void
- bmotion(XEvent *e) {
- int oldey, oldex, oldsby, oldsey;
-
-+ if(!xw.cursorstate) {
-+ XDefineCursor(xw.dpy, xw.win, xw.cursor);
-+ xw.cursorstate = true;
-+ if(!IS_SET(MODE_MOUSEMANY))
-+ xsetpointermotion(0);
-+ }
-+
- if(IS_SET(MODE_MOUSE)) {
- mousereport(e);
- return;
-@@ -2984,10 +2993,12 @@ xzoom(const Arg *arg) {
- void
- xinit(void) {
- XGCValues gcvalues;
-- Cursor cursor;
- Window parent;
- int sw, sh;
- pid_t thispid = getpid();
-+ XColor xcwhite = {.red = 0xffff, .green = 0xffff, .blue = 0xffff};
-+ XColor xcblack = {.red = 0x0000, .green = 0x0000, .blue = 0x0000};
-+ Pixmap blankpm;
-
- if(!(xw.dpy = XOpenDisplay(NULL)))
- die("Can't open display\n");
-@@ -3071,11 +3082,13 @@ xinit(void) {
- die("XCreateIC failed. Could not obtain input method.\n");
-
- /* white cursor, black outline */
-- cursor = XCreateFontCursor(xw.dpy, XC_xterm);
-- XDefineCursor(xw.dpy, xw.win, cursor);
-- XRecolorCursor(xw.dpy, cursor,
-- &(XColor){.red = 0xffff, .green = 0xffff, .blue = 0xffff},
-- &(XColor){.red = 0x0000, .green = 0x0000, .blue = 0x0000});
-+ xw.cursor = XCreateFontCursor(xw.dpy, XC_xterm);
-+ XDefineCursor(xw.dpy, xw.win, xw.cursor);
-+ XRecolorCursor(xw.dpy, xw.cursor, &xcwhite, &xcblack);
-+ xw.cursorstate = true;
-+ blankpm = XCreateBitmapFromData(xw.dpy, xw.win, &(char){0}, 1, 1);
-+ xw.bcursor = XCreatePixmapCursor(xw.dpy, blankpm, blankpm,
-+ &xcblack, &xcblack, 0, 0);
-
- xw.xembed = XInternAtom(xw.dpy, "_XEMBED", False);
- xw.wmdeletewin = XInternAtom(xw.dpy, "WM_DELETE_WINDOW", False);
-@@ -3537,6 +3550,8 @@ unmap(XEvent *ev) {
-
- void
- xsetpointermotion(int set) {
-+ if(!set && !xw.cursorstate)
-+ return;
- MODBIT(xw.attrs.event_mask, set, PointerMotionMask);
- XChangeWindowAttributes(xw.dpy, xw.win, CWEventMask, &xw.attrs);
- }
-@@ -3630,6 +3645,12 @@ kpress(XEvent *ev) {
- Status status;
- Shortcut *bp;
-
-+ if(xw.cursorstate) {
-+ XDefineCursor(xw.dpy, xw.win, xw.bcursor);
-+ xsetpointermotion(1);
-+ xw.cursorstate = false;
-+ }
-+
- if(IS_SET(MODE_KBDLOCK))
- return;
-
---
-2.0.0
-
diff --git a/st.suckless.org/patches/st-0.6-hidecursor.diff b/st.suckless.org/patches/st-0.6-hidecursor.diff
@@ -0,0 +1,84 @@
+diff --git a/st.c b/st.c
+index b89d094..d2979ff 100644
+--- a/st.c
++++ b/st.c
+@@ -257,6 +257,11 @@ typedef struct {
+ Draw draw;
+ Visual *vis;
+ XSetWindowAttributes attrs;
++ /* Here, we use the term *pointer* to differentiate the cursor
++ * one sees when hovering the mouse over the terminal from, e.g.,
++ * a green rectangle where text would be entered. */
++ Cursor vpointer, bpointer; /* visible and hidden pointers */
++ bool pointerisvisible;
+ int scr;
+ bool isfixed; /* is fixed geometry? */
+ int l, t; /* left and top offset */
+@@ -1181,6 +1186,13 @@ void
+ bmotion(XEvent *e) {
+ int oldey, oldex, oldsby, oldsey;
+
++ if(!xw.pointerisvisible) {
++ XDefineCursor(xw.dpy, xw.win, xw.vpointer);
++ xw.pointerisvisible = true;
++ if(!IS_SET(MODE_MOUSEMANY))
++ xsetpointermotion(0);
++ }
++
+ if(IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) {
+ mousereport(e);
+ return;
+@@ -3182,9 +3194,11 @@ xzoomreset(const Arg *arg) {
+ void
+ xinit(void) {
+ XGCValues gcvalues;
+- Cursor cursor;
+ Window parent;
+ pid_t thispid = getpid();
++ XColor xcwhite = {.red = 0xffff, .green = 0xffff, .blue = 0xffff};
++ XColor xcblack = {.red = 0x0000, .green = 0x0000, .blue = 0x0000};
++ Pixmap blankpm;
+
+ if(!(xw.dpy = XOpenDisplay(NULL)))
+ die("Can't open display\n");
+@@ -3257,11 +3271,13 @@ xinit(void) {
+ die("XCreateIC failed. Could not obtain input method.\n");
+
+ /* white cursor, black outline */
+- cursor = XCreateFontCursor(xw.dpy, XC_xterm);
+- XDefineCursor(xw.dpy, xw.win, cursor);
+- XRecolorCursor(xw.dpy, cursor,
+- &(XColor){.red = 0xffff, .green = 0xffff, .blue = 0xffff},
+- &(XColor){.red = 0x0000, .green = 0x0000, .blue = 0x0000});
++ xw.vpointer = XCreateFontCursor(xw.dpy, XC_xterm);
++ XDefineCursor(xw.dpy, xw.win, xw.vpointer);
++ XRecolorCursor(xw.dpy, xw.vpointer, &xcwhite, &xcblack);
++ xw.pointerisvisible = true;
++ blankpm = XCreateBitmapFromData(xw.dpy, xw.win, &(char){0}, 1, 1);
++ xw.bpointer = XCreatePixmapCursor(xw.dpy, blankpm, blankpm,
++ &xcblack, &xcblack, 0, 0);
+
+ xw.xembed = XInternAtom(xw.dpy, "_XEMBED", False);
+ xw.wmdeletewin = XInternAtom(xw.dpy, "WM_DELETE_WINDOW", False);
+@@ -3725,6 +3741,8 @@ unmap(XEvent *ev) {
+
+ void
+ xsetpointermotion(int set) {
++ if(!set && !xw.pointerisvisible)
++ return;
+ MODBIT(xw.attrs.event_mask, set, PointerMotionMask);
+ XChangeWindowAttributes(xw.dpy, xw.win, CWEventMask, &xw.attrs);
+ }
+@@ -3818,6 +3836,12 @@ kpress(XEvent *ev) {
+ Status status;
+ Shortcut *bp;
+
++ if(xw.pointerisvisible) {
++ XDefineCursor(xw.dpy, xw.win, xw.bpointer);
++ xsetpointermotion(1);
++ xw.pointerisvisible = false;
++ }
++
+ if(IS_SET(MODE_KBDLOCK))
+ return;
+
diff --git a/st.suckless.org/patches/st-0.6-hidexcursor.diff b/st.suckless.org/patches/st-0.6-hidexcursor.diff
@@ -1,100 +0,0 @@
-From 700158aa952756a52b043fa6c665053d48cb2de2 Mon Sep 17 00:00:00 2001
-From: Colona <colona@ycc.fr>
-Date: Mon, 9 Jun 2014 01:00:20 -0700
-Subject: [PATCH] Hide X cursor when typing.
-
-Hide the X cursor when typing in the terminal. The cursor is displayed again
-when the mouse is moved.
-
-[ s/cursor/pointer - Alex Pilon ]
----
- st.c | 36 ++++++++++++++++++++++++++++++------
- 1 file changed, 30 insertions(+), 6 deletions(-)
-
-diff --git a/st.c b/st.c
-index 39d3fee..b95a4a5 100644
---- a/st.c
-+++ b/st.c
-@@ -248,6 +248,11 @@ typedef struct {
- Draw draw;
- Visual *vis;
- XSetWindowAttributes attrs;
-+ /* Here, we use the term *pointer* to differentiate the cursor
-+ * one sees when hovering the mouse over the terminal from, e.g.,
-+ * a green rectangle where text would be entered. */
-+ Cursor vpointer, bpointer; /* visible and hidden pointers */
-+ bool pointerisvisible;
- int scr;
- bool isfixed; /* is fixed geometry? */
- int l, t; /* left and top offset */
-@@ -1155,6 +1160,13 @@ void
- bmotion(XEvent *e) {
- int oldey, oldex, oldsby, oldsey;
-
-+ if(!xw.pointerisvisible) {
-+ XDefineCursor(xw.dpy, xw.win, xw.vpointer);
-+ xw.pointerisvisible = true;
-+ if(!IS_SET(MODE_MOUSEMANY))
-+ xsetpointermotion(0);
-+ }
-+
- if(IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) {
- mousereport(e);
- return;
-@@ -3173,9 +3185,11 @@ xzoomreset(const Arg *arg) {
- void
- xinit(void) {
- XGCValues gcvalues;
-- Cursor cursor;
- Window parent;
- pid_t thispid = getpid();
-+ XColor xcwhite = {.red = 0xffff, .green = 0xffff, .blue = 0xffff};
-+ XColor xcblack = {.red = 0x0000, .green = 0x0000, .blue = 0x0000};
-+ Pixmap blankpm;
-
- if(!(xw.dpy = XOpenDisplay(NULL)))
- die("Can't open display\n");
-@@ -3248,11 +3262,13 @@ xinit(void) {
- die("XCreateIC failed. Could not obtain input method.\n");
-
- /* white cursor, black outline */
-- cursor = XCreateFontCursor(xw.dpy, XC_xterm);
-- XDefineCursor(xw.dpy, xw.win, cursor);
-- XRecolorCursor(xw.dpy, cursor,
-- &(XColor){.red = 0xffff, .green = 0xffff, .blue = 0xffff},
-- &(XColor){.red = 0x0000, .green = 0x0000, .blue = 0x0000});
-+ xw.vpointer = XCreateFontCursor(xw.dpy, XC_xterm);
-+ XDefineCursor(xw.dpy, xw.win, xw.vpointer);
-+ XRecolorCursor(xw.dpy, xw.vpointer, &xcwhite, &xcblack);
-+ xw.pointerisvisible = true;
-+ blankpm = XCreateBitmapFromData(xw.dpy, xw.win, &(char){0}, 1, 1);
-+ xw.bpointer = XCreatePixmapCursor(xw.dpy, blankpm, blankpm,
-+ &xcblack, &xcblack, 0, 0);
-
- xw.xembed = XInternAtom(xw.dpy, "_XEMBED", False);
- xw.wmdeletewin = XInternAtom(xw.dpy, "WM_DELETE_WINDOW", False);
-@@ -3739,6 +3755,8 @@ unmap(XEvent *ev) {
-
- void
- xsetpointermotion(int set) {
-+ if(!set && !xw.pointerisvisible)
-+ return;
- MODBIT(xw.attrs.event_mask, set, PointerMotionMask);
- XChangeWindowAttributes(xw.dpy, xw.win, CWEventMask, &xw.attrs);
- }
-@@ -3832,6 +3850,12 @@ kpress(XEvent *ev) {
- Status status;
- Shortcut *bp;
-
-+ if(xw.pointerisvisible) {
-+ XDefineCursor(xw.dpy, xw.win, xw.bpointer);
-+ xsetpointermotion(1);
-+ xw.pointerisvisible = false;
-+ }
-+
- if(IS_SET(MODE_KBDLOCK))
- return;
-
---
-2.3.3
-
diff --git a/st.suckless.org/patches/st-git-20150917-hidecursor.diff b/st.suckless.org/patches/st-git-20150917-hidecursor.diff
@@ -0,0 +1,88 @@
+diff --git a/st.c b/st.c
+index bd8b815..9a8e872 100644
+--- a/st.c
++++ b/st.c
+@@ -259,6 +259,11 @@ typedef struct {
+ Draw draw;
+ Visual *vis;
+ XSetWindowAttributes attrs;
++ /* Here, we use the term *pointer* to differentiate the cursor
++ * one sees when hovering the mouse over the terminal from, e.g.,
++ * a green rectangle where text would be entered. */
++ Cursor vpointer, bpointer; /* visible and hidden pointers */
++ int pointerisvisible;
+ int scr;
+ int isfixed; /* is fixed geometry? */
+ int l, t; /* left and top offset */
+@@ -1290,6 +1295,13 @@ bmotion(XEvent *e)
+ {
+ int oldey, oldex, oldsby, oldsey;
+
++ if(!xw.pointerisvisible) {
++ XDefineCursor(xw.dpy, xw.win, xw.vpointer);
++ xw.pointerisvisible = 1;
++ if(!IS_SET(MODE_MOUSEMANY))
++ xsetpointermotion(0);
++ }
++
+ if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) {
+ mousereport(e);
+ return;
+@@ -3440,10 +3452,10 @@ void
+ xinit(void)
+ {
+ XGCValues gcvalues;
+- Cursor cursor;
+ Window parent;
+ pid_t thispid = getpid();
+ XColor xmousefg, xmousebg;
++ Pixmap blankpm;
+
+ if (!(xw.dpy = XOpenDisplay(NULL)))
+ die("Can't open display\n");
+@@ -3516,8 +3528,9 @@ xinit(void)
+ die("XCreateIC failed. Could not obtain input method.\n");
+
+ /* white cursor, black outline */
+- cursor = XCreateFontCursor(xw.dpy, mouseshape);
+- XDefineCursor(xw.dpy, xw.win, cursor);
++ xw.pointerisvisible = 1;
++ xw.vpointer = XCreateFontCursor(xw.dpy, mouseshape);
++ XDefineCursor(xw.dpy, xw.win, xw.vpointer);
+
+ if (XParseColor(xw.dpy, xw.cmap, colorname[mousefg], &xmousefg) == 0) {
+ xmousefg.red = 0xffff;
+@@ -3531,7 +3544,10 @@ xinit(void)
+ xmousebg.blue = 0x0000;
+ }
+
+- XRecolorCursor(xw.dpy, cursor, &xmousefg, &xmousebg);
++ XRecolorCursor(xw.dpy, xw.vpointer, &xmousefg, &xmousebg);
++ blankpm = XCreateBitmapFromData(xw.dpy, xw.win, &(char){0}, 1, 1);
++ xw.bpointer = XCreatePixmapCursor(xw.dpy, blankpm, blankpm,
++ &xmousefg, &xmousebg, 0, 0);
+
+ xw.xembed = XInternAtom(xw.dpy, "_XEMBED", False);
+ xw.wmdeletewin = XInternAtom(xw.dpy, "WM_DELETE_WINDOW", False);
+@@ -4006,6 +4022,8 @@ unmap(XEvent *ev)
+ void
+ xsetpointermotion(int set)
+ {
++ if(!set && !xw.pointerisvisible)
++ return;
+ MODBIT(xw.attrs.event_mask, set, PointerMotionMask);
+ XChangeWindowAttributes(xw.dpy, xw.win, CWEventMask, &xw.attrs);
+ }
+@@ -4105,6 +4123,12 @@ kpress(XEvent *ev)
+ Status status;
+ Shortcut *bp;
+
++ if(xw.pointerisvisible) {
++ XDefineCursor(xw.dpy, xw.win, xw.bpointer);
++ xsetpointermotion(1);
++ xw.pointerisvisible = 0;
++ }
++
+ if (IS_SET(MODE_KBDLOCK))
+ return;
+
diff --git a/st.suckless.org/patches/st-git-hidexcursor.diff b/st.suckless.org/patches/st-git-hidexcursor.diff
@@ -1,104 +0,0 @@
-From 679b7353a8a6146c81f9fbb5a4012324e87f8008 Mon Sep 17 00:00:00 2001
-From: Ivan Delalande <colona@ycc.fr>
-Date: Thu, 30 Jul 2015 01:53:26 -0700
-Subject: [PATCH] Hide X mouse cursor when typing.
-
-Hide the X cursor when typing in the terminal. The cursor is displayed again
-when the mouse is moved.
-
-[ s/cursor/pointer - Alex Pilon ]
----
- st.c | 32 ++++++++++++++++++++++++++++----
- 1 file changed, 28 insertions(+), 4 deletions(-)
-
-diff --git a/st.c b/st.c
-index 1df4fde..96b58e3 100644
---- a/st.c
-+++ b/st.c
-@@ -258,6 +258,11 @@ typedef struct {
- Draw draw;
- Visual *vis;
- XSetWindowAttributes attrs;
-+ /* Here, we use the term *pointer* to differentiate the cursor
-+ * one sees when hovering the mouse over the terminal from, e.g.,
-+ * a green rectangle where text would be entered. */
-+ Cursor vpointer, bpointer; /* visible and hidden pointers */
-+ int pointerisvisible;
- int scr;
- int isfixed; /* is fixed geometry? */
- int l, t; /* left and top offset */
-@@ -1285,6 +1290,13 @@ bmotion(XEvent *e)
- {
- int oldey, oldex, oldsby, oldsey;
-
-+ if(!xw.pointerisvisible) {
-+ XDefineCursor(xw.dpy, xw.win, xw.vpointer);
-+ xw.pointerisvisible = 1;
-+ if(!IS_SET(MODE_MOUSEMANY))
-+ xsetpointermotion(0);
-+ }
-+
- if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) {
- mousereport(e);
- return;
-@@ -3408,10 +3420,10 @@ void
- xinit(void)
- {
- XGCValues gcvalues;
-- Cursor cursor;
- Window parent;
- pid_t thispid = getpid();
- XColor xmousefg, xmousebg;
-+ Pixmap blankpm;
-
- if (!(xw.dpy = XOpenDisplay(NULL)))
- die("Can't open display\n");
-@@ -3484,8 +3496,9 @@ xinit(void)
- die("XCreateIC failed. Could not obtain input method.\n");
-
- /* white cursor, black outline */
-- cursor = XCreateFontCursor(xw.dpy, mouseshape);
-- XDefineCursor(xw.dpy, xw.win, cursor);
-+ xw.pointerisvisible = 1;
-+ xw.vpointer = XCreateFontCursor(xw.dpy, mouseshape);
-+ XDefineCursor(xw.dpy, xw.win, xw.vpointer);
-
- if (XParseColor(xw.dpy, xw.cmap, colorname[mousefg], &xmousefg) == 0) {
- xmousefg.red = 0xffff;
-@@ -3499,7 +3512,10 @@ xinit(void)
- xmousebg.blue = 0x0000;
- }
-
-- XRecolorCursor(xw.dpy, cursor, &xmousefg, &xmousebg);
-+ XRecolorCursor(xw.dpy, xw.vpointer, &xmousefg, &xmousebg);
-+ blankpm = XCreateBitmapFromData(xw.dpy, xw.win, &(char){0}, 1, 1);
-+ xw.bpointer = XCreatePixmapCursor(xw.dpy, blankpm, blankpm,
-+ &xmousefg, &xmousebg, 0, 0);
-
- xw.xembed = XInternAtom(xw.dpy, "_XEMBED", False);
- xw.wmdeletewin = XInternAtom(xw.dpy, "WM_DELETE_WINDOW", False);
-@@ -3974,6 +3990,8 @@ unmap(XEvent *ev)
- void
- xsetpointermotion(int set)
- {
-+ if(!set && !xw.pointerisvisible)
-+ return;
- MODBIT(xw.attrs.event_mask, set, PointerMotionMask);
- XChangeWindowAttributes(xw.dpy, xw.win, CWEventMask, &xw.attrs);
- }
-@@ -4073,6 +4091,12 @@ kpress(XEvent *ev)
- Status status;
- Shortcut *bp;
-
-+ if(xw.pointerisvisible) {
-+ XDefineCursor(xw.dpy, xw.win, xw.bpointer);
-+ xsetpointermotion(1);
-+ xw.pointerisvisible = 0;
-+ }
-+
- if (IS_SET(MODE_KBDLOCK))
- return;
-
---
-2.4.6
-