update flexipatch
All checks were successful
Update void-packages template / Update xbps-src template (push) Successful in 2m51s
All checks were successful
Update void-packages template / Update xbps-src template (push) Successful in 2m51s
This commit is contained in:
parent
0b10705240
commit
e9398f8471
6 changed files with 84 additions and 47 deletions
|
@ -231,8 +231,8 @@ static MouseShortcut mshortcuts[] = {
|
|||
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
|
||||
{ ShiftMask, Button4, kscrollup, {.i = 1}, 0, S_PRI},
|
||||
{ ShiftMask, Button5, kscrolldown, {.i = 1}, 0, S_PRI},
|
||||
{ XK_NO_MOD, Button4, kscrollup, {.i = 1}, 0, S_PRI },
|
||||
{ XK_NO_MOD, Button5, kscrolldown, {.i = 1}, 0, S_PRI },
|
||||
{ XK_ANY_MOD, Button4, kscrollup, {.i = 1}, 0, S_PRI },
|
||||
{ XK_ANY_MOD, Button5, kscrolldown, {.i = 1}, 0, S_PRI },
|
||||
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"}, 0, S_ALT },
|
||||
{ XK_ANY_MOD, Button5, ttysend, {.s = "\005"}, 0, S_ALT },
|
||||
};
|
||||
|
|
|
@ -1,7 +1,15 @@
|
|||
extern char* argv0;
|
||||
|
||||
static char*
|
||||
getcwd_by_pid(pid_t pid) {
|
||||
static char cwd[32];
|
||||
snprintf(cwd, sizeof cwd, "/proc/%d/cwd", pid);
|
||||
return cwd;
|
||||
}
|
||||
|
||||
void
|
||||
newterm(const Arg* a)
|
||||
{
|
||||
int res;
|
||||
switch (fork()) {
|
||||
case -1:
|
||||
die("fork failed: %s\n", strerror(errno));
|
||||
|
@ -12,19 +20,12 @@ newterm(const Arg* a)
|
|||
die("fork failed: %s\n", strerror(errno));
|
||||
break;
|
||||
case 0:
|
||||
res = chdir(getcwd_by_pid(pid));
|
||||
execlp("st", "./st", NULL);
|
||||
break;
|
||||
chdir(getcwd_by_pid(pid));
|
||||
|
||||
execl("/proc/self/exe", argv0, NULL);
|
||||
exit(1);
|
||||
default:
|
||||
exit(0);
|
||||
}
|
||||
default:
|
||||
wait(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static char *getcwd_by_pid(pid_t pid) {
|
||||
char buf[32];
|
||||
snprintf(buf, sizeof buf, "/proc/%d/cwd", pid);
|
||||
return realpath(buf, NULL);
|
||||
}
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
void newterm(const Arg *);
|
||||
static char *getcwd_by_pid(pid_t pid);
|
||||
|
|
15
sixel.c
15
sixel.c
|
@ -256,10 +256,10 @@ sixel_parser_finalize(sixel_state_t *st, ImageList **newimages, int cx, int cy,
|
|||
sixel_image_t *image = &st->image;
|
||||
int x, y;
|
||||
sixel_color_no_t *src;
|
||||
sixel_color_t *dst;
|
||||
int color;
|
||||
sixel_color_t *dst, color;
|
||||
int w, h;
|
||||
int i, j, cols, numimages;
|
||||
char trans;
|
||||
ImageList *im, *next, *tail;
|
||||
|
||||
if (!image->data)
|
||||
|
@ -306,7 +306,6 @@ sixel_parser_finalize(sixel_state_t *st, ImageList **newimages, int cx, int cy,
|
|||
im->clipmask = NULL;
|
||||
im->cw = cw;
|
||||
im->ch = ch;
|
||||
im->transparent = st->transparent;
|
||||
}
|
||||
if (!im || !im->pixels) {
|
||||
for (im = *newimages; im; im = next) {
|
||||
|
@ -319,11 +318,15 @@ sixel_parser_finalize(sixel_state_t *st, ImageList **newimages, int cx, int cy,
|
|||
return -1;
|
||||
}
|
||||
dst = (sixel_color_t *)im->pixels;
|
||||
for (j = 0; j < im->height && y < h; j++, y++) {
|
||||
for (trans = 0, j = 0; j < im->height && y < h; j++, y++) {
|
||||
src = st->image.data + image->width * y;
|
||||
for (x = 0; x < w; x++)
|
||||
*dst++ = st->image.palette[*src++];
|
||||
for (x = 0; x < w; x++) {
|
||||
color = st->image.palette[*src++];
|
||||
trans |= (color == 0);
|
||||
*dst++ = color;
|
||||
}
|
||||
}
|
||||
im->transparent = (st->transparent && trans);
|
||||
}
|
||||
|
||||
return numimages;
|
||||
|
|
75
st.c
75
st.c
|
@ -558,17 +558,16 @@ sigchld(int a)
|
|||
int stat;
|
||||
pid_t p;
|
||||
|
||||
if ((p = waitpid(pid, &stat, WNOHANG)) < 0)
|
||||
die("waiting for pid %hd failed: %s\n", pid, strerror(errno));
|
||||
while ((p = waitpid(-1, &stat, WNOHANG)) > 0) {
|
||||
if (p == pid) {
|
||||
|
||||
if (pid != p)
|
||||
return;
|
||||
|
||||
if (WIFEXITED(stat) && WEXITSTATUS(stat))
|
||||
die("child exited with status %d\n", WEXITSTATUS(stat));
|
||||
else if (WIFSIGNALED(stat))
|
||||
die("child terminated due to signal %d\n", WTERMSIG(stat));
|
||||
_exit(0);
|
||||
if (WIFEXITED(stat) && WEXITSTATUS(stat))
|
||||
die("child exited with status %d\n", WEXITSTATUS(stat));
|
||||
else if (WIFSIGNALED(stat))
|
||||
die("child terminated due to signal %d\n", WTERMSIG(stat));
|
||||
_exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -599,6 +598,7 @@ int
|
|||
ttynew(const char *line, char *cmd, const char *out, char **args)
|
||||
{
|
||||
int m, s;
|
||||
struct sigaction sa;
|
||||
|
||||
if (out) {
|
||||
term.mode |= MODE_PRINT;
|
||||
|
@ -651,7 +651,10 @@ ttynew(const char *line, char *cmd, const char *out, char **args)
|
|||
#endif
|
||||
close(s);
|
||||
cmdfd = m;
|
||||
signal(SIGCHLD, sigchld);
|
||||
memset(&sa, 0, sizeof(sa));
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sa.sa_handler = sigchld;
|
||||
sigaction(SIGCHLD, &sa, NULL);
|
||||
break;
|
||||
}
|
||||
return cmdfd;
|
||||
|
@ -1500,7 +1503,7 @@ csihandle(void)
|
|||
tclearregion(0, term.c.y+1, term.col-1, term.row-1, 1);
|
||||
break;
|
||||
case 1: /* above */
|
||||
if (term.c.y >= 1)
|
||||
if (term.c.y > 0)
|
||||
tclearregion(0, 0, term.col-1, term.c.y-1, 1);
|
||||
tclearregion(0, term.c.y, term.c.x, term.c.y, 1);
|
||||
break;
|
||||
|
@ -1778,8 +1781,8 @@ strhandle(void)
|
|||
{ defaultbg, "background" },
|
||||
{ defaultcs, "cursor" }
|
||||
};
|
||||
ImageList *im, *newimages, *next, *tail;
|
||||
int i, x1, y1, x2, y2, numimages;
|
||||
ImageList *im, *newimages, *next, *tail = NULL;
|
||||
int i, x1, y1, x2, y2, y, numimages;
|
||||
int cx, cy;
|
||||
Line line;
|
||||
int scr = IS_SET(MODE_ALTSCREEN) ? 0 : term.scr;
|
||||
|
@ -1886,15 +1889,33 @@ strhandle(void)
|
|||
y1 = newimages->y;
|
||||
x2 = x1 + newimages->cols;
|
||||
y2 = y1 + numimages;
|
||||
if (newimages->transparent) {
|
||||
for (tail = term.images; tail && tail->next; tail = tail->next);
|
||||
} else {
|
||||
for (tail = NULL, im = term.images; im; im = next) {
|
||||
/* Delete the old images that are covered by the new image(s). We also need
|
||||
* to check if they have already been deleted before adding the new ones. */
|
||||
if (term.images) {
|
||||
char transparent[numimages];
|
||||
for (i = 0, im = newimages; im; im = im->next, i++) {
|
||||
transparent[i] = im->transparent;
|
||||
}
|
||||
for (im = term.images; im; im = next) {
|
||||
next = im->next;
|
||||
if (im->x >= x1 && im->x + im->cols <= x2 &&
|
||||
im->y >= y1 && im->y <= y2) {
|
||||
delete_image(im);
|
||||
continue;
|
||||
if (im->y >= y1 && im->y < y2) {
|
||||
y = im->y - scr;
|
||||
if (y >= 0 && y < term.row && term.dirty[y]) {
|
||||
line = term.line[y];
|
||||
j = MIN(im->x + im->cols, term.col);
|
||||
for (i = im->x; i < j; i++) {
|
||||
if (line[i].mode & ATTR_SIXEL)
|
||||
break;
|
||||
}
|
||||
if (i == j) {
|
||||
delete_image(im);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (im->x >= x1 && im->x + im->cols <= x2 && !transparent[im->y - y1]) {
|
||||
delete_image(im);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
tail = im;
|
||||
}
|
||||
|
@ -1965,6 +1986,16 @@ strparse(void)
|
|||
if (*p == '\0')
|
||||
return;
|
||||
|
||||
/* preserve semicolons in window titles, icon names and OSC 7 sequences */
|
||||
if (strescseq.type == ']' && (
|
||||
p[0] <= '2'
|
||||
) && p[1] == ';') {
|
||||
strescseq.args[strescseq.narg++] = p;
|
||||
strescseq.args[strescseq.narg++] = p + 2;
|
||||
p[1] = '\0';
|
||||
return;
|
||||
}
|
||||
|
||||
while (strescseq.narg < STR_ARG_SIZ) {
|
||||
strescseq.args[strescseq.narg++] = p;
|
||||
while ((c = *p) != ';' && c != '\0')
|
||||
|
|
11
x.c
11
x.c
|
@ -1148,7 +1148,7 @@ xinit(int cols, int rows)
|
|||
{
|
||||
XGCValues gcvalues;
|
||||
Pixmap blankpm;
|
||||
Window parent;
|
||||
Window parent, root;
|
||||
pid_t thispid = getpid();
|
||||
|
||||
if (!(xw.dpy = XOpenDisplay(NULL)))
|
||||
|
@ -1190,17 +1190,20 @@ xinit(int cols, int rows)
|
|||
xw.attrs.colormap = xw.cmap;
|
||||
xw.attrs.event_mask |= PointerMotionMask;
|
||||
|
||||
root = XRootWindow(xw.dpy, xw.scr);
|
||||
if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0))))
|
||||
parent = XRootWindow(xw.dpy, xw.scr);
|
||||
xw.win = XCreateWindow(xw.dpy, parent, xw.l, xw.t,
|
||||
parent = root;
|
||||
xw.win = XCreateWindow(xw.dpy, root, xw.l, xw.t,
|
||||
win.w, win.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput,
|
||||
xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity
|
||||
| CWEventMask | CWColormap, &xw.attrs);
|
||||
if (parent != root)
|
||||
XReparentWindow(xw.dpy, xw.win, parent, xw.l, xw.t);
|
||||
|
||||
memset(&gcvalues, 0, sizeof(gcvalues));
|
||||
gcvalues.graphics_exposures = False;
|
||||
|
||||
dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures,
|
||||
dc.gc = XCreateGC(xw.dpy, xw.win, GCGraphicsExposures,
|
||||
&gcvalues);
|
||||
xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
|
||||
DefaultDepth(xw.dpy, xw.scr));
|
||||
|
|
Loading…
Add table
Reference in a new issue