[wiki] [sites] st: routine update for the hidecursor patch || Ivan Delalande
commit 4bebf48de27e8b41f7eeec9afa4647972fe6a77a
Author: Ivan Delalande <colona_AT_ycc.fr>
Date: Tue Apr 4 23:11:42 2017 -0700
st: routine update for the hidecursor patch
diff --git a/st.suckless.org/patches/hidecursor.md b/st.suckless.org/patches/hidecursor.md
index 9284ff0..316dfab 100644
--- a/st.suckless.org/patches/hidecursor.md
+++ b/st.suckless.org/patches/hidecursor.md
_AT_@ -12,7 +12,8 @@ Download
* [st-hidecursor-0.5.diff](st-hidecursor-0.5.diff)
* [st-hidecursor-0.6.diff](st-hidecursor-0.6.diff)
-* [st-hidecursor-20160727-308bfbf.diff](st-hidecursor-20160727-308bfbf.diff)
+* [st-hidecursor-0.7.diff](st-hidecursor-0.7.diff)
+* [st-hidecursor-20170404-745c40f.diff](st-hidecursor-20170404-745c40f.diff)
Authors
-------
diff --git a/st.suckless.org/patches/st-hidecursor-0.7.diff b/st.suckless.org/patches/st-hidecursor-0.7.diff
new file mode 100644
index 0000000..b9873e6
--- /dev/null
+++ b/st.suckless.org/patches/st-hidecursor-0.7.diff
_AT_@ -0,0 +1,88 @@
+diff --git a/st.c b/st.c
+index 2594c65..2a031f0 100644
+--- a/st.c
++++ b/st.c
+_AT_@ -260,6 +260,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 */
+_AT_@ -1291,6 +1296,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;
+_AT_@ -3435,10 +3447,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
");
+_AT_@ -3511,8 +3523,9 @@ xinit(void)
+ die("XCreateIC failed. Could not obtain input method.
");
+
+ /* 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;
+_AT_@ -3526,7 +3539,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);
+_AT_@ -4026,6 +4042,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);
+ }
+_AT_@ -4125,6 +4143,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-hidecursor-20160727-308bfbf.diff b/st.suckless.org/patches/st-hidecursor-20160727-308bfbf.diff
deleted file mode 100644
index b9873e6..0000000
--- a/st.suckless.org/patches/st-hidecursor-20160727-308bfbf.diff
+++ /dev/null
_AT_@ -1,88 +0,0 @@
-diff --git a/st.c b/st.c
-index 2594c65..2a031f0 100644
---- a/st.c
-+++ b/st.c
-_AT_@ -260,6 +260,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 */
-_AT_@ -1291,6 +1296,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;
-_AT_@ -3435,10 +3447,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
");
-_AT_@ -3511,8 +3523,9 @@ xinit(void)
- die("XCreateIC failed. Could not obtain input method.
");
-
- /* 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;
-_AT_@ -3526,7 +3539,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);
-_AT_@ -4026,6 +4042,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);
- }
-_AT_@ -4125,6 +4143,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-hidecursor-20170404-745c40f.diff b/st.suckless.org/patches/st-hidecursor-20170404-745c40f.diff
new file mode 100644
index 0000000..bf892bb
--- /dev/null
+++ b/st.suckless.org/patches/st-hidecursor-20170404-745c40f.diff
_AT_@ -0,0 +1,88 @@
+diff --git a/x.c b/x.c
+index fbfd350..2f72214 100644
+--- a/x.c
++++ b/x.c
+_AT_@ -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 */
+_AT_@ -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;
+_AT_@ -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
");
+_AT_@ -947,8 +959,9 @@ xinit(void)
+ die("XCreateIC failed. Could not obtain input method.
");
+
+ /* 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;
+_AT_@ -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);
+_AT_@ -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);
+ }
+_AT_@ -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;
+
Received on Wed Apr 05 2017 - 08:29:02 CEST
This archive was generated by hypermail 2.3.0
: Wed Apr 05 2017 - 08:36:16 CEST