---- - 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 -_AT_@ -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 */ -_AT_@ -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; -_AT_@ -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 "); -_AT_@ -3071,11 +3082,13 @@ xinit(void) { - die("XCreateIC failed. Could not obtain input method. "); - - /* 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); -_AT_@ -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); - } -_AT_@ -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 new file mode 100644 index 0000000..2638524 --- /dev/null +++ b/st.suckless.org/patches/st-0.6-hidecursor.diff _AT_@ -0,0 +1,84 @@ +diff --git a/st.c b/st.c +index b89d094..d2979ff 100644 +--- a/st.c ++++ b/st.c +_AT_@ -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 */ +_AT_@ -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; +_AT_@ -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 "); +_AT_@ -3257,11 +3271,13 @@ xinit(void) { + die("XCreateIC failed. Could not obtain input method. "); + + /* 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); +_AT_@ -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); + } +_AT_@ -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 deleted file mode 100644 index f5d2142..0000000 --- a/st.suckless.org/patches/st-0.6-hidexcursor.diff +++ /dev/null _AT_@ -1,100 +0,0 @@ -From 700158aa952756a52b043fa6c665053d48cb2de2 Mon Sep 17 00:00:00 2001 -From: Colona <colona_AT_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 -_AT_@ -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 */ -_AT_@ -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; -_AT_@ -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 "); -_AT_@ -3248,11 +3262,13 @@ xinit(void) { - die("XCreateIC failed. Could not obtain input method. "); - - /* 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); -_AT_@ -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); - } -_AT_@ -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 new file mode 100644 index 0000000..3eae0e2 --- /dev/null +++ b/st.suckless.org/patches/st-git-20150917-hidecursor.diff _AT_@ -0,0 +1,88 @@ +diff --git a/st.c b/st.c +index bd8b815..9a8e872 100644 +--- a/st.c ++++ b/st.c +_AT_@ -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 */ +_AT_@ -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; +_AT_@ -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 "); +_AT_@ -3516,8 +3528,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_@ -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); +_AT_@ -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); + } +_AT_@ -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 deleted file mode 100644 index f83ba89..0000000 --- a/st.suckless.org/patches/st-git-hidexcursor.diff +++ /dev/null _AT_@ -1,104 +0,0 @@ -From 679b7353a8a6146c81f9fbb5a4012324e87f8008 Mon Sep 17 00:00:00 2001 -From: Ivan Delalande <colona_AT_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 -_AT_@ -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 */ -_AT_@ -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; -_AT_@ -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 "); -_AT_@ -3484,8 +3496,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_@ -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); -_AT_@ -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); - } -_AT_@ -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 -Received on Thu Sep 17 2015 - 18:37:50 CEST
This archive was generated by hypermail 2.3.0 : Thu Sep 17 2015 - 18:48:13 CEST