sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit abf3eb72ea23e4590b264554fa43e9f028d5ed19
parent 6ecb2296143c620076126eedb630d6f751b40ec3
Author: Raphael Scholer <rascholer@gmail.com>
Date:   Tue, 20 Mar 2018 03:38:04 +0100

[st][hidecursor] Update for 0.8

Diffstat:
st.suckless.org/patches/hidecursor/index.md | 2+-
st.suckless.org/patches/hidecursor/st-hidecursor-0.8.diff | 88+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
st.suckless.org/patches/hidecursor/st-hidecursor-20170404-745c40f.diff | 88-------------------------------------------------------------------------------
3 files changed, 89 insertions(+), 89 deletions(-)

diff --git a/st.suckless.org/patches/hidecursor/index.md b/st.suckless.org/patches/hidecursor/index.md @@ -13,7 +13,7 @@ Download * [st-hidecursor-0.5.diff](st-hidecursor-0.5.diff) * [st-hidecursor-0.6.diff](st-hidecursor-0.6.diff) * [st-hidecursor-0.7.diff](st-hidecursor-0.7.diff) -* [st-hidecursor-20170404-745c40f.diff](st-hidecursor-20170404-745c40f.diff) +* [st-hidecursor-0.8.diff](st-hidecursor-0.8.diff) Authors ------- diff --git a/st.suckless.org/patches/hidecursor/st-hidecursor-0.8.diff b/st.suckless.org/patches/hidecursor/st-hidecursor-0.8.diff @@ -0,0 +1,88 @@ +diff --git a/x.c b/x.c +index d43a529..9c9bcbd 100644 +--- a/x.c ++++ b/x.c +@@ -96,6 +96,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 */ +@@ -411,6 +416,13 @@ bpress(XEvent *e) + MouseShortcut *ms; + int snap; + ++ 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; +@@ -994,10 +1006,10 @@ void + xinit(int cols, int rows) + { + 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"); +@@ -1073,8 +1085,9 @@ xinit(int cols, int rows) + 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; +@@ -1088,7 +1101,10 @@ xinit(int cols, int rows) + 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); +@@ -1571,6 +1587,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); + } +@@ -1689,6 +1707,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/hidecursor/st-hidecursor-20170404-745c40f.diff b/st.suckless.org/patches/hidecursor/st-hidecursor-20170404-745c40f.diff @@ -1,88 +0,0 @@ -diff --git a/x.c b/x.c -index fbfd350..2f72214 100644 ---- a/x.c -+++ b/x.c -@@ -47,6 +47,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 */ -@@ -535,6 +540,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; -@@ -871,10 +883,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"); -@@ -947,8 +959,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; -@@ -962,7 +975,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); -@@ -1462,6 +1478,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); - } -@@ -1521,6 +1539,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; -