From 5ccf69c113335cc97259773549d984ddf60fdefe Mon Sep 17 00:00:00 2001 From: David Thurstenson Date: Tue, 23 May 2017 08:35:03 -0500 Subject: [PATCH] added local copies of now-unavailable patches --- PKGBUILD | 6 +-- st-externalpipe.diff | 75 +++++++++++++++++++++++++++++++++++++ st-hidecursor.diff | 88 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 166 insertions(+), 3 deletions(-) create mode 100644 st-externalpipe.diff create mode 100644 st-hidecursor.diff diff --git a/PKGBUILD b/PKGBUILD index d00e586..84d4f54 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -13,10 +13,10 @@ conflicts=('st') url="http://st.suckless.org" source=('git://git.suckless.org/st#commit=c63a87cd936c1eeef14c4c21572e5b782d3df4bc' tl-config.diff - st-externalpipe.diff::http://st.suckless.org/patches/st-externalpipe-20161125-e448324.diff - st-hidecursor.diff::http://st.suckless.org/patches/st-hidecursor-20160727-308bfbf.diff) + st-externalpipe.diff + st-hidecursor.diff) md5sums=('SKIP' - 'd097c0d6327c5df49ea49000b8f248e1' + '3178cbe36ecf7285544dbbe08291f53e' 'c54c87489342b8d77c6dd8f3c2ff997e' '8ff8a77b34dfc09a4dd0d2cf876d68e7') diff --git a/st-externalpipe.diff b/st-externalpipe.diff new file mode 100644 index 0000000..e4b47e0 --- /dev/null +++ b/st-externalpipe.diff @@ -0,0 +1,75 @@ +diff --git a/st.c b/st.c +index d6fe58a..1595e59 100644 +--- a/st.c ++++ b/st.c +@@ -344,6 +344,7 @@ static void printscreen(const Arg *) ; + static void iso14755(const Arg *); + static void toggleprinter(const Arg *); + static void sendbreak(const Arg *); ++static void externalpipe(const Arg *); + + /* Config.h for applying patches and the configuration. */ + #include "config.h" +@@ -2996,6 +2997,62 @@ eschandle(uchar ascii) + } + + void ++externalpipe(const Arg *arg) ++{ ++ int to[2]; /* 0 = read, 1 = write */ ++ pid_t child; ++ int n; ++ void (*oldsigpipe)(int); ++ char buf[UTF_SIZ]; ++ Glyph *bp, *end; ++ ++ if(pipe(to) == -1) ++ return; ++ ++ /* sigchld() handles this */ ++ switch(child = fork()){ ++ case -1: ++ close(to[0]), close(to[1]); ++ return; ++ case 0: ++ /* child */ ++ close(to[1]); ++ dup2(to[0], STDIN_FILENO); /* 0<&to */ ++ close(to[0]); ++ execvp( ++ "sh", ++ (char *const []){ ++ "/bin/sh", ++ "-c", ++ (char *)arg->v, ++ 0 ++ }); ++ exit(127); ++ } ++ ++ /* parent */ ++ close(to[0]); ++ /* ignore sigpipe for now, in case child exits early */ ++ oldsigpipe = signal(SIGPIPE, SIG_IGN); ++ ++ for(n = 0; n < term.row; n++){ ++ bp = &term.line[n][0]; ++ end = &bp[MIN(tlinelen(n), term.col) - 1]; ++ if(bp != end || bp->u != ' ') ++ for(; bp <= end; ++bp) ++ if(xwrite(to[1], buf, utf8encode(bp->u, buf)) < 0) ++ break; ++ if(xwrite(to[1], "\n", 1) < 0) ++ break; ++ } ++ ++ close(to[1]); ++ ++ /* restore */ ++ signal(SIGPIPE, oldsigpipe); ++} ++ ++void + tputc(Rune u) + { + char c[UTF_SIZ]; diff --git a/st-hidecursor.diff b/st-hidecursor.diff new file mode 100644 index 0000000..b9873e6 --- /dev/null +++ b/st-hidecursor.diff @@ -0,0 +1,88 @@ +diff --git a/st.c b/st.c +index 2594c65..2a031f0 100644 +--- a/st.c ++++ b/st.c +@@ -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 */ +@@ -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; +@@ -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\n"); +@@ -3511,8 +3523,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; +@@ -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); +@@ -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); + } +@@ -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; +