Apply custom patches
This commit is contained in:
parent
fa253f077f
commit
d51e250907
11 changed files with 1027 additions and 89 deletions
73
config.def.h
73
config.def.h
|
@ -4,9 +4,11 @@
|
|||
* appearance
|
||||
*
|
||||
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
|
||||
* borderperc: percentage of cell width to use as a border
|
||||
* 0 = no border, 100 = border width is same as cell width
|
||||
*/
|
||||
static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
|
||||
static int borderpx = 2;
|
||||
static int borderperc = 20;
|
||||
|
||||
/*
|
||||
* What program is execed by st depends of these precedence rules:
|
||||
|
@ -95,43 +97,48 @@ unsigned int tabspaces = 8;
|
|||
|
||||
/* Terminal colors (16 first used in escape sequence) */
|
||||
static const char *colorname[] = {
|
||||
/* 8 normal colors */
|
||||
"black",
|
||||
"red3",
|
||||
"green3",
|
||||
"yellow3",
|
||||
"blue2",
|
||||
"magenta3",
|
||||
"cyan3",
|
||||
"gray90",
|
||||
|
||||
/* 8 bright colors */
|
||||
"gray50",
|
||||
"red",
|
||||
"green",
|
||||
"yellow",
|
||||
"#5c5cff",
|
||||
"magenta",
|
||||
"cyan",
|
||||
"white",
|
||||
/* 8 normal colors */
|
||||
[0] = "#000000", /* black */
|
||||
[1] = "#ff5555", /* red */
|
||||
[2] = "#50fa7b", /* green */
|
||||
[3] = "#f1fa8c", /* yellow */
|
||||
[4] = "#bd93f9", /* blue */
|
||||
[5] = "#ff79c6", /* magenta */
|
||||
[6] = "#8be9fd", /* cyan */
|
||||
[7] = "#bbbbbb", /* white */
|
||||
|
||||
[255] = 0,
|
||||
/* 8 bright colors */
|
||||
[8] = "#44475a", /* black */
|
||||
[9] = "#ff5555", /* red */
|
||||
[10] = "#50fa7b", /* green */
|
||||
[11] = "#f1fa8c", /* yellow */
|
||||
[12] = "#bd93f9", /* blue */
|
||||
[13] = "#ff79c6", /* magenta */
|
||||
[14] = "#8be9fd", /* cyan */
|
||||
[15] = "#ffffff", /* white */
|
||||
|
||||
/* more colors can be added after 255 to use with DefaultXX */
|
||||
"#cccccc",
|
||||
"#555555",
|
||||
/* special colors */
|
||||
[256] = "#282a36", /* background */
|
||||
[257] = "#f8f8f2", /* foreground */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Default colors (colorname index)
|
||||
* foreground, background, cursor, reverse cursor
|
||||
* foreground, background, cursor
|
||||
*/
|
||||
unsigned int defaultfg = 7;
|
||||
unsigned int defaultbg = 0;
|
||||
static unsigned int defaultcs = 256;
|
||||
unsigned int defaultfg = 257;
|
||||
unsigned int defaultbg = 256;
|
||||
static unsigned int defaultcs = 257;
|
||||
static unsigned int defaultrcs = 257;
|
||||
|
||||
/*
|
||||
* Colors used, when the specific fg == defaultfg. So in reverse mode this
|
||||
* will reverse too. Another logic would only make the simple feature too
|
||||
* complex.
|
||||
*/
|
||||
unsigned int defaultitalic = 7;
|
||||
unsigned int defaultunderline = 7;
|
||||
/*
|
||||
* Default shape of cursor
|
||||
* 2: Block ("█")
|
||||
|
@ -173,11 +180,11 @@ static uint forcemousemod = ShiftMask;
|
|||
* Beware that overloading Button1 will disable the selection.
|
||||
*/
|
||||
static MouseShortcut mshortcuts[] = {
|
||||
/* mask button function argument release */
|
||||
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
|
||||
{ ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} },
|
||||
/* mask button function argument release alt */
|
||||
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
|
||||
{ XK_ANY_MOD, Button4, ttysend, {.s = "\033[5;2~"}, 0, -1 },
|
||||
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
|
||||
{ ShiftMask, Button5, ttysend, {.s = "\033[6;2~"} },
|
||||
{ XK_ANY_MOD, Button5, ttysend, {.s = "\033[6;2~"}, 0, -1 },
|
||||
{ XK_ANY_MOD, Button5, ttysend, {.s = "\005"} },
|
||||
};
|
||||
|
||||
|
@ -199,6 +206,8 @@ static Shortcut shortcuts[] = {
|
|||
{ TERMMOD, XK_Y, selpaste, {.i = 0} },
|
||||
{ ShiftMask, XK_Insert, selpaste, {.i = 0} },
|
||||
{ TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
|
||||
{ ShiftMask, XK_Page_Up, kscrollup, {.i = -1} },
|
||||
{ ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} },
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
152
st-anysize-0.8.1.diff
Normal file
152
st-anysize-0.8.1.diff
Normal file
|
@ -0,0 +1,152 @@
|
|||
diff --git a/x.c b/x.c
|
||||
index 00cb6b1..8f87c0f 100644
|
||||
--- a/x.c
|
||||
+++ b/x.c
|
||||
@@ -78,6 +78,7 @@ typedef XftGlyphFontSpec GlyphFontSpec;
|
||||
typedef struct {
|
||||
int tw, th; /* tty width and height */
|
||||
int w, h; /* window width and height */
|
||||
+ int hborderpx, vborderpx;
|
||||
int ch; /* char height */
|
||||
int cw; /* char width */
|
||||
int mode; /* window state/mode flags */
|
||||
@@ -311,7 +312,7 @@ zoomreset(const Arg *arg)
|
||||
int
|
||||
evcol(XEvent *e)
|
||||
{
|
||||
- int x = e->xbutton.x - borderpx;
|
||||
+ int x = e->xbutton.x - win.hborderpx;
|
||||
LIMIT(x, 0, win.tw - 1);
|
||||
return x / win.cw;
|
||||
}
|
||||
@@ -319,7 +320,7 @@ evcol(XEvent *e)
|
||||
int
|
||||
evrow(XEvent *e)
|
||||
{
|
||||
- int y = e->xbutton.y - borderpx;
|
||||
+ int y = e->xbutton.y - win.vborderpx;
|
||||
LIMIT(y, 0, win.th - 1);
|
||||
return y / win.ch;
|
||||
}
|
||||
@@ -675,6 +676,9 @@ cresize(int width, int height)
|
||||
col = MAX(1, col);
|
||||
row = MAX(1, row);
|
||||
|
||||
+ win.hborderpx = (win.w - col * win.cw) / 2;
|
||||
+ win.vborderpx = (win.h - row * win.ch) / 2;
|
||||
+
|
||||
tresize(col, row);
|
||||
xresize(col, row);
|
||||
ttyresize(win.tw, win.th);
|
||||
@@ -793,8 +797,8 @@ xhints(void)
|
||||
sizeh->flags = PSize | PResizeInc | PBaseSize | PMinSize;
|
||||
sizeh->height = win.h;
|
||||
sizeh->width = win.w;
|
||||
- sizeh->height_inc = win.ch;
|
||||
- sizeh->width_inc = win.cw;
|
||||
+ sizeh->height_inc = 1;
|
||||
+ sizeh->width_inc = 1;
|
||||
sizeh->base_height = 2 * borderpx;
|
||||
sizeh->base_width = 2 * borderpx;
|
||||
sizeh->min_height = win.ch + 2 * borderpx;
|
||||
@@ -1022,8 +1026,8 @@ xinit(int cols, int rows)
|
||||
xloadcols();
|
||||
|
||||
/* adjust fixed window geometry */
|
||||
- win.w = 2 * borderpx + cols * win.cw;
|
||||
- win.h = 2 * borderpx + rows * win.ch;
|
||||
+ win.w = 2 * win.hborderpx + cols * win.cw;
|
||||
+ win.h = 2 * win.vborderpx + rows * win.ch;
|
||||
if (xw.gm & XNegative)
|
||||
xw.l += DisplayWidth(xw.dpy, xw.scr) - win.w - 2;
|
||||
if (xw.gm & YNegative)
|
||||
@@ -1123,7 +1127,7 @@ xinit(int cols, int rows)
|
||||
int
|
||||
xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x, int y)
|
||||
{
|
||||
- float winx = borderpx + x * win.cw, winy = borderpx + y * win.ch, xp, yp;
|
||||
+ float winx = win.hborderpx + x * win.cw, winy = win.vborderpx + y * win.ch, xp, yp;
|
||||
ushort mode, prevmode = USHRT_MAX;
|
||||
Font *font = &dc.font;
|
||||
int frcflags = FRC_NORMAL;
|
||||
@@ -1259,7 +1263,7 @@ void
|
||||
xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, int y)
|
||||
{
|
||||
int charlen = len * ((base.mode & ATTR_WIDE) ? 2 : 1);
|
||||
- int winx = borderpx + x * win.cw, winy = borderpx + y * win.ch,
|
||||
+ int winx = win.hborderpx + x * win.cw, winy = win.vborderpx + y * win.ch,
|
||||
width = charlen * win.cw;
|
||||
Color *fg, *bg, *temp, revfg, revbg, truefg, truebg;
|
||||
XRenderColor colfg, colbg;
|
||||
@@ -1349,17 +1353,17 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
|
||||
|
||||
/* Intelligent cleaning up of the borders. */
|
||||
if (x == 0) {
|
||||
- xclear(0, (y == 0)? 0 : winy, borderpx,
|
||||
+ xclear(0, (y == 0)? 0 : winy, win.vborderpx,
|
||||
winy + win.ch +
|
||||
- ((winy + win.ch >= borderpx + win.th)? win.h : 0));
|
||||
+ ((winy + win.ch >= win.vborderpx + win.th)? win.h : 0));
|
||||
}
|
||||
- if (winx + width >= borderpx + win.tw) {
|
||||
+ if (winx + width >= win.hborderpx + win.tw) {
|
||||
xclear(winx + width, (y == 0)? 0 : winy, win.w,
|
||||
- ((winy + win.ch >= borderpx + win.th)? win.h : (winy + win.ch)));
|
||||
+ ((winy + win.ch >= win.vborderpx + win.th)? win.h : (winy + win.ch)));
|
||||
}
|
||||
if (y == 0)
|
||||
- xclear(winx, 0, winx + width, borderpx);
|
||||
- if (winy + win.ch >= borderpx + win.th)
|
||||
+ xclear(winx, 0, winx + width, win.hborderpx);
|
||||
+ if (winy + win.ch >= win.vborderpx + win.th)
|
||||
xclear(winx, winy + win.ch, winx + width, win.h);
|
||||
|
||||
/* Clean up the region we want to draw to. */
|
||||
@@ -1452,35 +1456,35 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
|
||||
case 3: /* Blinking Underline */
|
||||
case 4: /* Steady Underline */
|
||||
XftDrawRect(xw.draw, &drawcol,
|
||||
- borderpx + cx * win.cw,
|
||||
- borderpx + (cy + 1) * win.ch - \
|
||||
+ win.hborderpx + cx * win.cw,
|
||||
+ win.vborderpx + (cy + 1) * win.ch - \
|
||||
cursorthickness,
|
||||
win.cw, cursorthickness);
|
||||
break;
|
||||
case 5: /* Blinking bar */
|
||||
case 6: /* Steady bar */
|
||||
XftDrawRect(xw.draw, &drawcol,
|
||||
- borderpx + cx * win.cw,
|
||||
- borderpx + cy * win.ch,
|
||||
+ win.hborderpx + cx * win.cw,
|
||||
+ win.vborderpx + cy * win.ch,
|
||||
cursorthickness, win.ch);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
XftDrawRect(xw.draw, &drawcol,
|
||||
- borderpx + cx * win.cw,
|
||||
- borderpx + cy * win.ch,
|
||||
+ win.hborderpx + cx * win.cw,
|
||||
+ win.vborderpx + cy * win.ch,
|
||||
win.cw - 1, 1);
|
||||
XftDrawRect(xw.draw, &drawcol,
|
||||
- borderpx + cx * win.cw,
|
||||
- borderpx + cy * win.ch,
|
||||
+ win.hborderpx + cx * win.cw,
|
||||
+ win.vborderpx + cy * win.ch,
|
||||
1, win.ch - 1);
|
||||
XftDrawRect(xw.draw, &drawcol,
|
||||
- borderpx + (cx + 1) * win.cw - 1,
|
||||
- borderpx + cy * win.ch,
|
||||
+ win.hborderpx + (cx + 1) * win.cw - 1,
|
||||
+ win.vborderpx + cy * win.ch,
|
||||
1, win.ch - 1);
|
||||
XftDrawRect(xw.draw, &drawcol,
|
||||
- borderpx + cx * win.cw,
|
||||
- borderpx + (cy + 1) * win.ch - 1,
|
||||
+ win.hborderpx + cx * win.cw,
|
||||
+ win.vborderpx + (cy + 1) * win.ch - 1,
|
||||
win.cw, 1);
|
||||
}
|
||||
}
|
12
st-clipboard-0.8.3.diff
Normal file
12
st-clipboard-0.8.3.diff
Normal file
|
@ -0,0 +1,12 @@
|
|||
diff --git a/x.c b/x.c
|
||||
index e5f1737..5cabd60 100644
|
||||
--- a/x.c
|
||||
+++ b/x.c
|
||||
@@ -673,6 +673,7 @@ setsel(char *str, Time t)
|
||||
XSetSelectionOwner(xw.dpy, XA_PRIMARY, xw.win, t);
|
||||
if (XGetSelectionOwner(xw.dpy, XA_PRIMARY) != xw.win)
|
||||
selclear();
|
||||
+ clipcopy(NULL);
|
||||
}
|
||||
|
||||
void
|
84
st-dracula-0.8.2.diff
Normal file
84
st-dracula-0.8.2.diff
Normal file
|
@ -0,0 +1,84 @@
|
|||
diff --git a/config.def.h b/config.def.h
|
||||
index 877afab..6a1699f 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -84,44 +84,49 @@ static unsigned int tabspaces = 8;
|
||||
|
||||
/* Terminal colors (16 first used in escape sequence) */
|
||||
static const char *colorname[] = {
|
||||
- /* 8 normal colors */
|
||||
- "black",
|
||||
- "red3",
|
||||
- "green3",
|
||||
- "yellow3",
|
||||
- "blue2",
|
||||
- "magenta3",
|
||||
- "cyan3",
|
||||
- "gray90",
|
||||
-
|
||||
- /* 8 bright colors */
|
||||
- "gray50",
|
||||
- "red",
|
||||
- "green",
|
||||
- "yellow",
|
||||
- "#5c5cff",
|
||||
- "magenta",
|
||||
- "cyan",
|
||||
- "white",
|
||||
-
|
||||
- [255] = 0,
|
||||
-
|
||||
- /* more colors can be added after 255 to use with DefaultXX */
|
||||
- "#cccccc",
|
||||
- "#555555",
|
||||
-};
|
||||
|
||||
+ /* 8 normal colors */
|
||||
+ [0] = "#000000", /* black */
|
||||
+ [1] = "#ff5555", /* red */
|
||||
+ [2] = "#50fa7b", /* green */
|
||||
+ [3] = "#f1fa8c", /* yellow */
|
||||
+ [4] = "#bd93f9", /* blue */
|
||||
+ [5] = "#ff79c6", /* magenta */
|
||||
+ [6] = "#8be9fd", /* cyan */
|
||||
+ [7] = "#bbbbbb", /* white */
|
||||
+
|
||||
+ /* 8 bright colors */
|
||||
+ [8] = "#44475a", /* black */
|
||||
+ [9] = "#ff5555", /* red */
|
||||
+ [10] = "#50fa7b", /* green */
|
||||
+ [11] = "#f1fa8c", /* yellow */
|
||||
+ [12] = "#bd93f9", /* blue */
|
||||
+ [13] = "#ff79c6", /* magenta */
|
||||
+ [14] = "#8be9fd", /* cyan */
|
||||
+ [15] = "#ffffff", /* white */
|
||||
+
|
||||
+ /* special colors */
|
||||
+ [256] = "#282a36", /* background */
|
||||
+ [257] = "#f8f8f2", /* foreground */
|
||||
+};
|
||||
|
||||
/*
|
||||
* Default colors (colorname index)
|
||||
- * foreground, background, cursor, reverse cursor
|
||||
+ * foreground, background, cursor
|
||||
*/
|
||||
-unsigned int defaultfg = 7;
|
||||
-unsigned int defaultbg = 0;
|
||||
-static unsigned int defaultcs = 256;
|
||||
+unsigned int defaultfg = 257;
|
||||
+unsigned int defaultbg = 256;
|
||||
+static unsigned int defaultcs = 257;
|
||||
static unsigned int defaultrcs = 257;
|
||||
|
||||
/*
|
||||
+ * Colors used, when the specific fg == defaultfg. So in reverse mode this
|
||||
+ * will reverse too. Another logic would only make the simple feature too
|
||||
+ * complex.
|
||||
+ */
|
||||
+unsigned int defaultitalic = 7;
|
||||
+unsigned int defaultunderline = 7;
|
||||
+/*
|
||||
* Default shape of cursor
|
||||
* 2: Block ("█")
|
||||
* 4: Underline ("_")
|
88
st-hidecursor-0.8.3.diff
Normal file
88
st-hidecursor-0.8.3.diff
Normal file
|
@ -0,0 +1,88 @@
|
|||
diff --git a/x.c b/x.c
|
||||
index e5f1737..7e759b0 100644
|
||||
--- a/x.c
|
||||
+++ b/x.c
|
||||
@@ -103,6 +103,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 */
|
||||
@@ -698,6 +703,13 @@ brelease(XEvent *e)
|
||||
void
|
||||
bmotion(XEvent *e)
|
||||
{
|
||||
+ 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 & forcemousemod)) {
|
||||
mousereport(e);
|
||||
return;
|
||||
@@ -1099,10 +1111,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");
|
||||
@@ -1166,8 +1178,9 @@ xinit(int cols, int rows)
|
||||
}
|
||||
|
||||
/* 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;
|
||||
@@ -1181,7 +1194,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);
|
||||
@@ -1673,6 +1689,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);
|
||||
}
|
||||
@@ -1793,6 +1811,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;
|
||||
|
39
st-relativeborder-0.8.3.diff
Normal file
39
st-relativeborder-0.8.3.diff
Normal file
|
@ -0,0 +1,39 @@
|
|||
diff -up ../st-0.8.3/config.def.h ./config.def.h
|
||||
--- ../st-0.8.3/config.def.h 2020-04-27 13:58:27.000000000 +0200
|
||||
+++ ./config.def.h 2020-05-24 18:27:19.179361165 +0200
|
||||
@@ -4,9 +4,11 @@
|
||||
* appearance
|
||||
*
|
||||
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
|
||||
+ * borderperc: percentage of cell width to use as a border
|
||||
+ * 0 = no border, 100 = border width is same as cell width
|
||||
*/
|
||||
static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
|
||||
-static int borderpx = 2;
|
||||
+static int borderperc = 20;
|
||||
|
||||
/*
|
||||
* What program is execed by st depends of these precedence rules:
|
||||
diff -up ../st-0.8.3/st.h ./st.h
|
||||
--- ../st-0.8.3/st.h 2020-04-27 13:58:27.000000000 +0200
|
||||
+++ ./st.h 2020-05-24 18:27:20.255369735 +0200
|
||||
@@ -52,6 +52,7 @@ enum selection_snap {
|
||||
SNAP_LINE = 2
|
||||
};
|
||||
|
||||
+int borderpx;
|
||||
typedef unsigned char uchar;
|
||||
typedef unsigned int uint;
|
||||
typedef unsigned long ulong;
|
||||
diff -up ../st-0.8.3/x.c ./x.c
|
||||
--- ../st-0.8.3/x.c 2020-04-27 13:58:27.000000000 +0200
|
||||
+++ ./x.c 2020-05-24 18:27:17.551348200 +0200
|
||||
@@ -1001,6 +1001,8 @@ xloadfonts(char *fontstr, double fontsiz
|
||||
win.cw = ceilf(dc.font.width * cwscale);
|
||||
win.ch = ceilf(dc.font.height * chscale);
|
||||
|
||||
+ borderpx = ceilf(((float)borderperc / 100) * win.cw);
|
||||
+
|
||||
FcPatternDel(pattern, FC_SLANT);
|
||||
FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
|
||||
if (xloadfont(&dc.ifont, pattern))
|
351
st-scrollback-20200419-72e3f6c.diff
Normal file
351
st-scrollback-20200419-72e3f6c.diff
Normal file
|
@ -0,0 +1,351 @@
|
|||
diff --git a/config.def.h b/config.def.h
|
||||
index 0895a1f..eef24df 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -188,6 +188,8 @@ static Shortcut shortcuts[] = {
|
||||
{ TERMMOD, XK_Y, selpaste, {.i = 0} },
|
||||
{ ShiftMask, XK_Insert, selpaste, {.i = 0} },
|
||||
{ TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
|
||||
+ { ShiftMask, XK_Page_Up, kscrollup, {.i = -1} },
|
||||
+ { ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} },
|
||||
};
|
||||
|
||||
/*
|
||||
diff --git a/st.c b/st.c
|
||||
index 0ce6ac2..641edc0 100644
|
||||
--- a/st.c
|
||||
+++ b/st.c
|
||||
@@ -35,6 +35,7 @@
|
||||
#define ESC_ARG_SIZ 16
|
||||
#define STR_BUF_SIZ ESC_BUF_SIZ
|
||||
#define STR_ARG_SIZ ESC_ARG_SIZ
|
||||
+#define HISTSIZE 2000
|
||||
|
||||
/* macros */
|
||||
#define IS_SET(flag) ((term.mode & (flag)) != 0)
|
||||
@@ -42,6 +43,9 @@
|
||||
#define ISCONTROLC1(c) (BETWEEN(c, 0x80, 0x9f))
|
||||
#define ISCONTROL(c) (ISCONTROLC0(c) || ISCONTROLC1(c))
|
||||
#define ISDELIM(u) (u && wcschr(worddelimiters, u))
|
||||
+#define TLINE(y) ((y) < term.scr ? term.hist[((y) + term.histi - \
|
||||
+ term.scr + HISTSIZE + 1) % HISTSIZE] : \
|
||||
+ term.line[(y) - term.scr])
|
||||
|
||||
enum term_mode {
|
||||
MODE_WRAP = 1 << 0,
|
||||
@@ -117,6 +121,9 @@ typedef struct {
|
||||
int col; /* nb col */
|
||||
Line *line; /* screen */
|
||||
Line *alt; /* alternate screen */
|
||||
+ Line hist[HISTSIZE]; /* history buffer */
|
||||
+ int histi; /* history index */
|
||||
+ int scr; /* scroll back */
|
||||
int *dirty; /* dirtyness of lines */
|
||||
TCursor c; /* cursor */
|
||||
int ocx; /* old cursor col */
|
||||
@@ -185,8 +192,8 @@ static void tnewline(int);
|
||||
static void tputtab(int);
|
||||
static void tputc(Rune);
|
||||
static void treset(void);
|
||||
-static void tscrollup(int, int);
|
||||
-static void tscrolldown(int, int);
|
||||
+static void tscrollup(int, int, int);
|
||||
+static void tscrolldown(int, int, int);
|
||||
static void tsetattr(int *, int);
|
||||
static void tsetchar(Rune, Glyph *, int, int);
|
||||
static void tsetdirt(int, int);
|
||||
@@ -415,10 +422,10 @@ tlinelen(int y)
|
||||
{
|
||||
int i = term.col;
|
||||
|
||||
- if (term.line[y][i - 1].mode & ATTR_WRAP)
|
||||
+ if (TLINE(y)[i - 1].mode & ATTR_WRAP)
|
||||
return i;
|
||||
|
||||
- while (i > 0 && term.line[y][i - 1].u == ' ')
|
||||
+ while (i > 0 && TLINE(y)[i - 1].u == ' ')
|
||||
--i;
|
||||
|
||||
return i;
|
||||
@@ -527,7 +534,7 @@ selsnap(int *x, int *y, int direction)
|
||||
* Snap around if the word wraps around at the end or
|
||||
* beginning of a line.
|
||||
*/
|
||||
- prevgp = &term.line[*y][*x];
|
||||
+ prevgp = &TLINE(*y)[*x];
|
||||
prevdelim = ISDELIM(prevgp->u);
|
||||
for (;;) {
|
||||
newx = *x + direction;
|
||||
@@ -542,14 +549,14 @@ selsnap(int *x, int *y, int direction)
|
||||
yt = *y, xt = *x;
|
||||
else
|
||||
yt = newy, xt = newx;
|
||||
- if (!(term.line[yt][xt].mode & ATTR_WRAP))
|
||||
+ if (!(TLINE(yt)[xt].mode & ATTR_WRAP))
|
||||
break;
|
||||
}
|
||||
|
||||
if (newx >= tlinelen(newy))
|
||||
break;
|
||||
|
||||
- gp = &term.line[newy][newx];
|
||||
+ gp = &TLINE(newy)[newx];
|
||||
delim = ISDELIM(gp->u);
|
||||
if (!(gp->mode & ATTR_WDUMMY) && (delim != prevdelim
|
||||
|| (delim && gp->u != prevgp->u)))
|
||||
@@ -570,14 +577,14 @@ selsnap(int *x, int *y, int direction)
|
||||
*x = (direction < 0) ? 0 : term.col - 1;
|
||||
if (direction < 0) {
|
||||
for (; *y > 0; *y += direction) {
|
||||
- if (!(term.line[*y-1][term.col-1].mode
|
||||
+ if (!(TLINE(*y-1)[term.col-1].mode
|
||||
& ATTR_WRAP)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (direction > 0) {
|
||||
for (; *y < term.row-1; *y += direction) {
|
||||
- if (!(term.line[*y][term.col-1].mode
|
||||
+ if (!(TLINE(*y)[term.col-1].mode
|
||||
& ATTR_WRAP)) {
|
||||
break;
|
||||
}
|
||||
@@ -608,13 +615,13 @@ getsel(void)
|
||||
}
|
||||
|
||||
if (sel.type == SEL_RECTANGULAR) {
|
||||
- gp = &term.line[y][sel.nb.x];
|
||||
+ gp = &TLINE(y)[sel.nb.x];
|
||||
lastx = sel.ne.x;
|
||||
} else {
|
||||
- gp = &term.line[y][sel.nb.y == y ? sel.nb.x : 0];
|
||||
+ gp = &TLINE(y)[sel.nb.y == y ? sel.nb.x : 0];
|
||||
lastx = (sel.ne.y == y) ? sel.ne.x : term.col-1;
|
||||
}
|
||||
- last = &term.line[y][MIN(lastx, linelen-1)];
|
||||
+ last = &TLINE(y)[MIN(lastx, linelen-1)];
|
||||
while (last >= gp && last->u == ' ')
|
||||
--last;
|
||||
|
||||
@@ -849,6 +856,9 @@ void
|
||||
ttywrite(const char *s, size_t n, int may_echo)
|
||||
{
|
||||
const char *next;
|
||||
+ Arg arg = (Arg) { .i = term.scr };
|
||||
+
|
||||
+ kscrolldown(&arg);
|
||||
|
||||
if (may_echo && IS_SET(MODE_ECHO))
|
||||
twrite(s, n, 1);
|
||||
@@ -1060,13 +1070,53 @@ tswapscreen(void)
|
||||
}
|
||||
|
||||
void
|
||||
-tscrolldown(int orig, int n)
|
||||
+kscrolldown(const Arg* a)
|
||||
+{
|
||||
+ int n = a->i;
|
||||
+
|
||||
+ if (n < 0)
|
||||
+ n = term.row + n;
|
||||
+
|
||||
+ if (n > term.scr)
|
||||
+ n = term.scr;
|
||||
+
|
||||
+ if (term.scr > 0) {
|
||||
+ term.scr -= n;
|
||||
+ selscroll(0, -n);
|
||||
+ tfulldirt();
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+kscrollup(const Arg* a)
|
||||
+{
|
||||
+ int n = a->i;
|
||||
+
|
||||
+ if (n < 0)
|
||||
+ n = term.row + n;
|
||||
+
|
||||
+ if (term.scr <= HISTSIZE-n) {
|
||||
+ term.scr += n;
|
||||
+ selscroll(0, n);
|
||||
+ tfulldirt();
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+tscrolldown(int orig, int n, int copyhist)
|
||||
{
|
||||
int i;
|
||||
Line temp;
|
||||
|
||||
LIMIT(n, 0, term.bot-orig+1);
|
||||
|
||||
+ if (copyhist) {
|
||||
+ term.histi = (term.histi - 1 + HISTSIZE) % HISTSIZE;
|
||||
+ temp = term.hist[term.histi];
|
||||
+ term.hist[term.histi] = term.line[term.bot];
|
||||
+ term.line[term.bot] = temp;
|
||||
+ }
|
||||
+
|
||||
tsetdirt(orig, term.bot-n);
|
||||
tclearregion(0, term.bot-n+1, term.col-1, term.bot);
|
||||
|
||||
@@ -1076,17 +1126,28 @@ tscrolldown(int orig, int n)
|
||||
term.line[i-n] = temp;
|
||||
}
|
||||
|
||||
- selscroll(orig, n);
|
||||
+ if (term.scr == 0)
|
||||
+ selscroll(orig, n);
|
||||
}
|
||||
|
||||
void
|
||||
-tscrollup(int orig, int n)
|
||||
+tscrollup(int orig, int n, int copyhist)
|
||||
{
|
||||
int i;
|
||||
Line temp;
|
||||
|
||||
LIMIT(n, 0, term.bot-orig+1);
|
||||
|
||||
+ if (copyhist) {
|
||||
+ term.histi = (term.histi + 1) % HISTSIZE;
|
||||
+ temp = term.hist[term.histi];
|
||||
+ term.hist[term.histi] = term.line[orig];
|
||||
+ term.line[orig] = temp;
|
||||
+ }
|
||||
+
|
||||
+ if (term.scr > 0 && term.scr < HISTSIZE)
|
||||
+ term.scr = MIN(term.scr + n, HISTSIZE-1);
|
||||
+
|
||||
tclearregion(0, orig, term.col-1, orig+n-1);
|
||||
tsetdirt(orig+n, term.bot);
|
||||
|
||||
@@ -1096,7 +1157,8 @@ tscrollup(int orig, int n)
|
||||
term.line[i+n] = temp;
|
||||
}
|
||||
|
||||
- selscroll(orig, -n);
|
||||
+ if (term.scr == 0)
|
||||
+ selscroll(orig, -n);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1135,7 +1197,7 @@ tnewline(int first_col)
|
||||
int y = term.c.y;
|
||||
|
||||
if (y == term.bot) {
|
||||
- tscrollup(term.top, 1);
|
||||
+ tscrollup(term.top, 1, 1);
|
||||
} else {
|
||||
y++;
|
||||
}
|
||||
@@ -1300,14 +1362,14 @@ void
|
||||
tinsertblankline(int n)
|
||||
{
|
||||
if (BETWEEN(term.c.y, term.top, term.bot))
|
||||
- tscrolldown(term.c.y, n);
|
||||
+ tscrolldown(term.c.y, n, 0);
|
||||
}
|
||||
|
||||
void
|
||||
tdeleteline(int n)
|
||||
{
|
||||
if (BETWEEN(term.c.y, term.top, term.bot))
|
||||
- tscrollup(term.c.y, n);
|
||||
+ tscrollup(term.c.y, n, 0);
|
||||
}
|
||||
|
||||
int32_t
|
||||
@@ -1738,11 +1800,11 @@ csihandle(void)
|
||||
break;
|
||||
case 'S': /* SU -- Scroll <n> line up */
|
||||
DEFAULT(csiescseq.arg[0], 1);
|
||||
- tscrollup(term.top, csiescseq.arg[0]);
|
||||
+ tscrollup(term.top, csiescseq.arg[0], 0);
|
||||
break;
|
||||
case 'T': /* SD -- Scroll <n> line down */
|
||||
DEFAULT(csiescseq.arg[0], 1);
|
||||
- tscrolldown(term.top, csiescseq.arg[0]);
|
||||
+ tscrolldown(term.top, csiescseq.arg[0], 0);
|
||||
break;
|
||||
case 'L': /* IL -- Insert <n> blank lines */
|
||||
DEFAULT(csiescseq.arg[0], 1);
|
||||
@@ -2248,7 +2310,7 @@ eschandle(uchar ascii)
|
||||
return 0;
|
||||
case 'D': /* IND -- Linefeed */
|
||||
if (term.c.y == term.bot) {
|
||||
- tscrollup(term.top, 1);
|
||||
+ tscrollup(term.top, 1, 1);
|
||||
} else {
|
||||
tmoveto(term.c.x, term.c.y+1);
|
||||
}
|
||||
@@ -2261,7 +2323,7 @@ eschandle(uchar ascii)
|
||||
break;
|
||||
case 'M': /* RI -- Reverse index */
|
||||
if (term.c.y == term.top) {
|
||||
- tscrolldown(term.top, 1);
|
||||
+ tscrolldown(term.top, 1, 1);
|
||||
} else {
|
||||
tmoveto(term.c.x, term.c.y-1);
|
||||
}
|
||||
@@ -2482,7 +2544,7 @@ twrite(const char *buf, int buflen, int show_ctrl)
|
||||
void
|
||||
tresize(int col, int row)
|
||||
{
|
||||
- int i;
|
||||
+ int i, j;
|
||||
int minrow = MIN(row, term.row);
|
||||
int mincol = MIN(col, term.col);
|
||||
int *bp;
|
||||
@@ -2519,6 +2581,14 @@ tresize(int col, int row)
|
||||
term.dirty = xrealloc(term.dirty, row * sizeof(*term.dirty));
|
||||
term.tabs = xrealloc(term.tabs, col * sizeof(*term.tabs));
|
||||
|
||||
+ for (i = 0; i < HISTSIZE; i++) {
|
||||
+ term.hist[i] = xrealloc(term.hist[i], col * sizeof(Glyph));
|
||||
+ for (j = mincol; j < col; j++) {
|
||||
+ term.hist[i][j] = term.c.attr;
|
||||
+ term.hist[i][j].u = ' ';
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/* resize each row to new width, zero-pad if needed */
|
||||
for (i = 0; i < minrow; i++) {
|
||||
term.line[i] = xrealloc(term.line[i], col * sizeof(Glyph));
|
||||
@@ -2577,7 +2647,7 @@ drawregion(int x1, int y1, int x2, int y2)
|
||||
continue;
|
||||
|
||||
term.dirty[y] = 0;
|
||||
- xdrawline(term.line[y], x1, y, x2);
|
||||
+ xdrawline(TLINE(y), x1, y, x2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2598,8 +2668,9 @@ draw(void)
|
||||
cx--;
|
||||
|
||||
drawregion(0, 0, term.col, term.row);
|
||||
- xdrawcursor(cx, term.c.y, term.line[term.c.y][cx],
|
||||
- term.ocx, term.ocy, term.line[term.ocy][term.ocx]);
|
||||
+ if (term.scr == 0)
|
||||
+ xdrawcursor(cx, term.c.y, term.line[term.c.y][cx],
|
||||
+ term.ocx, term.ocy, term.line[term.ocy][term.ocx]);
|
||||
term.ocx = cx;
|
||||
term.ocy = term.c.y;
|
||||
xfinishdraw();
|
||||
diff --git a/st.h b/st.h
|
||||
index d978458..b9a4eeb 100644
|
||||
--- a/st.h
|
||||
+++ b/st.h
|
||||
@@ -81,6 +81,8 @@ void die(const char *, ...);
|
||||
void redraw(void);
|
||||
void draw(void);
|
||||
|
||||
+void kscrolldown(const Arg *);
|
||||
+void kscrollup(const Arg *);
|
||||
void printscreen(const Arg *);
|
||||
void printsel(const Arg *);
|
||||
void sendbreak(const Arg *);
|
90
st-universcroll-0.8.4.diff
Normal file
90
st-universcroll-0.8.4.diff
Normal file
|
@ -0,0 +1,90 @@
|
|||
From 9726b1e58352126252412e101432e64d46fc51ca Mon Sep 17 00:00:00 2001
|
||||
From: Dennis Lee <dennis@dennislee.xyz>
|
||||
Date: Sun, 28 Jun 2020 23:01:03 -0700
|
||||
Subject: [PATCH] universcroll: mouse wheel only scroll in all modes
|
||||
|
||||
Scroll normally via scroll(1), without Shift, when outside of
|
||||
`MODE_ALTSCREEN`. Inside an alt screen, continue to scroll normally
|
||||
without Shift; in this mode, your scrolling is automatically translated
|
||||
into ^Y and ^E. It just werks!
|
||||
|
||||
Based on the existing mouse-altscreen patch
|
||||
https://st.suckless.org/patches/scrollback/
|
||||
adapted for st(1) 0.8.4 and scroll(1).
|
||||
---
|
||||
config.def.h | 10 +++++-----
|
||||
st.c | 5 +++++
|
||||
st.h | 1 +
|
||||
x.c | 2 ++
|
||||
4 files changed, 13 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 6f05dce..62e87da 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -173,11 +173,11 @@ static uint forcemousemod = ShiftMask;
|
||||
* Beware that overloading Button1 will disable the selection.
|
||||
*/
|
||||
static MouseShortcut mshortcuts[] = {
|
||||
- /* mask button function argument release */
|
||||
- { XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
|
||||
- { ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} },
|
||||
+ /* mask button function argument release alt */
|
||||
+ { XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
|
||||
+ { XK_ANY_MOD, Button4, ttysend, {.s = "\033[5;2~"}, 0, -1 },
|
||||
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
|
||||
- { ShiftMask, Button5, ttysend, {.s = "\033[6;2~"} },
|
||||
+ { XK_ANY_MOD, Button5, ttysend, {.s = "\033[6;2~"}, 0, -1 },
|
||||
{ XK_ANY_MOD, Button5, ttysend, {.s = "\005"} },
|
||||
};
|
||||
|
||||
diff --git a/st.c b/st.c
|
||||
index 76b7e0d..1f65453 100644
|
||||
--- a/st.c
|
||||
+++ b/st.c
|
||||
@@ -1047,6 +1047,11 @@ tnew(int col, int row)
|
||||
treset();
|
||||
}
|
||||
|
||||
+int tisaltscr(void)
|
||||
+{
|
||||
+ return IS_SET(MODE_ALTSCREEN);
|
||||
+}
|
||||
+
|
||||
void
|
||||
tswapscreen(void)
|
||||
{
|
||||
diff --git a/st.h b/st.h
|
||||
index 3d351b6..39cc054 100644
|
||||
--- a/st.h
|
||||
+++ b/st.h
|
||||
@@ -87,6 +87,7 @@ void sendbreak(const Arg *);
|
||||
void toggleprinter(const Arg *);
|
||||
|
||||
int tattrset(int);
|
||||
+int tisaltscr(void);
|
||||
void tnew(int, int);
|
||||
void tresize(int, int);
|
||||
void tsetdirtattr(int);
|
||||
diff --git a/x.c b/x.c
|
||||
index 210f184..210dde9 100644
|
||||
--- a/x.c
|
||||
+++ b/x.c
|
||||
@@ -34,6 +34,7 @@ typedef struct {
|
||||
void (*func)(const Arg *);
|
||||
const Arg arg;
|
||||
uint release;
|
||||
+ int altscrn; /* 0: don't care, -1: not alt screen, 1: alt screen */
|
||||
} MouseShortcut;
|
||||
|
||||
typedef struct {
|
||||
@@ -446,6 +447,7 @@ mouseaction(XEvent *e, uint release)
|
||||
for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) {
|
||||
if (ms->release == release &&
|
||||
ms->button == e->xbutton.button &&
|
||||
+ (!ms->altscrn || (ms->altscrn == (tisaltscr() ? 1 : -1))) &&
|
||||
(match(ms->mod, state) || /* exact or forced */
|
||||
match(ms->mod, state & ~forcemousemod))) {
|
||||
ms->func(&(ms->arg));
|
||||
--
|
||||
2.27.0
|
130
st.c
130
st.c
|
@ -35,6 +35,7 @@
|
|||
#define ESC_ARG_SIZ 16
|
||||
#define STR_BUF_SIZ ESC_BUF_SIZ
|
||||
#define STR_ARG_SIZ ESC_ARG_SIZ
|
||||
#define HISTSIZE 2000
|
||||
|
||||
/* macros */
|
||||
#define IS_SET(flag) ((term.mode & (flag)) != 0)
|
||||
|
@ -42,6 +43,9 @@
|
|||
#define ISCONTROLC1(c) (BETWEEN(c, 0x80, 0x9f))
|
||||
#define ISCONTROL(c) (ISCONTROLC0(c) || ISCONTROLC1(c))
|
||||
#define ISDELIM(u) (u && wcschr(worddelimiters, u))
|
||||
#define TLINE(y) ((y) < term.scr ? term.hist[((y) + term.histi - \
|
||||
term.scr + HISTSIZE + 1) % HISTSIZE] : \
|
||||
term.line[(y) - term.scr])
|
||||
|
||||
enum term_mode {
|
||||
MODE_WRAP = 1 << 0,
|
||||
|
@ -115,6 +119,9 @@ typedef struct {
|
|||
int col; /* nb col */
|
||||
Line *line; /* screen */
|
||||
Line *alt; /* alternate screen */
|
||||
Line hist[HISTSIZE]; /* history buffer */
|
||||
int histi; /* history index */
|
||||
int scr; /* scroll back */
|
||||
int *dirty; /* dirtyness of lines */
|
||||
TCursor c; /* cursor */
|
||||
int ocx; /* old cursor col */
|
||||
|
@ -184,8 +191,8 @@ static void tnewline(int);
|
|||
static void tputtab(int);
|
||||
static void tputc(Rune);
|
||||
static void treset(void);
|
||||
static void tscrollup(int, int);
|
||||
static void tscrolldown(int, int);
|
||||
static void tscrollup(int, int, int);
|
||||
static void tscrolldown(int, int, int);
|
||||
static void tsetattr(int *, int);
|
||||
static void tsetchar(Rune, Glyph *, int, int);
|
||||
static void tsetdirt(int, int);
|
||||
|
@ -414,10 +421,10 @@ tlinelen(int y)
|
|||
{
|
||||
int i = term.col;
|
||||
|
||||
if (term.line[y][i - 1].mode & ATTR_WRAP)
|
||||
if (TLINE(y)[i - 1].mode & ATTR_WRAP)
|
||||
return i;
|
||||
|
||||
while (i > 0 && term.line[y][i - 1].u == ' ')
|
||||
while (i > 0 && TLINE(y)[i - 1].u == ' ')
|
||||
--i;
|
||||
|
||||
return i;
|
||||
|
@ -526,7 +533,7 @@ selsnap(int *x, int *y, int direction)
|
|||
* Snap around if the word wraps around at the end or
|
||||
* beginning of a line.
|
||||
*/
|
||||
prevgp = &term.line[*y][*x];
|
||||
prevgp = &TLINE(*y)[*x];
|
||||
prevdelim = ISDELIM(prevgp->u);
|
||||
for (;;) {
|
||||
newx = *x + direction;
|
||||
|
@ -541,14 +548,14 @@ selsnap(int *x, int *y, int direction)
|
|||
yt = *y, xt = *x;
|
||||
else
|
||||
yt = newy, xt = newx;
|
||||
if (!(term.line[yt][xt].mode & ATTR_WRAP))
|
||||
if (!(TLINE(yt)[xt].mode & ATTR_WRAP))
|
||||
break;
|
||||
}
|
||||
|
||||
if (newx >= tlinelen(newy))
|
||||
break;
|
||||
|
||||
gp = &term.line[newy][newx];
|
||||
gp = &TLINE(newy)[newx];
|
||||
delim = ISDELIM(gp->u);
|
||||
if (!(gp->mode & ATTR_WDUMMY) && (delim != prevdelim
|
||||
|| (delim && gp->u != prevgp->u)))
|
||||
|
@ -569,14 +576,14 @@ selsnap(int *x, int *y, int direction)
|
|||
*x = (direction < 0) ? 0 : term.col - 1;
|
||||
if (direction < 0) {
|
||||
for (; *y > 0; *y += direction) {
|
||||
if (!(term.line[*y-1][term.col-1].mode
|
||||
if (!(TLINE(*y-1)[term.col-1].mode
|
||||
& ATTR_WRAP)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (direction > 0) {
|
||||
for (; *y < term.row-1; *y += direction) {
|
||||
if (!(term.line[*y][term.col-1].mode
|
||||
if (!(TLINE(*y)[term.col-1].mode
|
||||
& ATTR_WRAP)) {
|
||||
break;
|
||||
}
|
||||
|
@ -607,13 +614,13 @@ getsel(void)
|
|||
}
|
||||
|
||||
if (sel.type == SEL_RECTANGULAR) {
|
||||
gp = &term.line[y][sel.nb.x];
|
||||
gp = &TLINE(y)[sel.nb.x];
|
||||
lastx = sel.ne.x;
|
||||
} else {
|
||||
gp = &term.line[y][sel.nb.y == y ? sel.nb.x : 0];
|
||||
gp = &TLINE(y)[sel.nb.y == y ? sel.nb.x : 0];
|
||||
lastx = (sel.ne.y == y) ? sel.ne.x : term.col-1;
|
||||
}
|
||||
last = &term.line[y][MIN(lastx, linelen-1)];
|
||||
last = &TLINE(y)[MIN(lastx, linelen-1)];
|
||||
while (last >= gp && last->u == ' ')
|
||||
--last;
|
||||
|
||||
|
@ -848,6 +855,9 @@ void
|
|||
ttywrite(const char *s, size_t n, int may_echo)
|
||||
{
|
||||
const char *next;
|
||||
Arg arg = (Arg) { .i = term.scr };
|
||||
|
||||
kscrolldown(&arg);
|
||||
|
||||
if (may_echo && IS_SET(MODE_ECHO))
|
||||
twrite(s, n, 1);
|
||||
|
@ -1047,6 +1057,11 @@ tnew(int col, int row)
|
|||
treset();
|
||||
}
|
||||
|
||||
int tisaltscr(void)
|
||||
{
|
||||
return IS_SET(MODE_ALTSCREEN);
|
||||
}
|
||||
|
||||
void
|
||||
tswapscreen(void)
|
||||
{
|
||||
|
@ -1059,13 +1074,53 @@ tswapscreen(void)
|
|||
}
|
||||
|
||||
void
|
||||
tscrolldown(int orig, int n)
|
||||
kscrolldown(const Arg* a)
|
||||
{
|
||||
int n = a->i;
|
||||
|
||||
if (n < 0)
|
||||
n = term.row + n;
|
||||
|
||||
if (n > term.scr)
|
||||
n = term.scr;
|
||||
|
||||
if (term.scr > 0) {
|
||||
term.scr -= n;
|
||||
selscroll(0, -n);
|
||||
tfulldirt();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
kscrollup(const Arg* a)
|
||||
{
|
||||
int n = a->i;
|
||||
|
||||
if (n < 0)
|
||||
n = term.row + n;
|
||||
|
||||
if (term.scr <= HISTSIZE-n) {
|
||||
term.scr += n;
|
||||
selscroll(0, n);
|
||||
tfulldirt();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tscrolldown(int orig, int n, int copyhist)
|
||||
{
|
||||
int i;
|
||||
Line temp;
|
||||
|
||||
LIMIT(n, 0, term.bot-orig+1);
|
||||
|
||||
if (copyhist) {
|
||||
term.histi = (term.histi - 1 + HISTSIZE) % HISTSIZE;
|
||||
temp = term.hist[term.histi];
|
||||
term.hist[term.histi] = term.line[term.bot];
|
||||
term.line[term.bot] = temp;
|
||||
}
|
||||
|
||||
tsetdirt(orig, term.bot-n);
|
||||
tclearregion(0, term.bot-n+1, term.col-1, term.bot);
|
||||
|
||||
|
@ -1075,17 +1130,28 @@ tscrolldown(int orig, int n)
|
|||
term.line[i-n] = temp;
|
||||
}
|
||||
|
||||
selscroll(orig, n);
|
||||
if (term.scr == 0)
|
||||
selscroll(orig, n);
|
||||
}
|
||||
|
||||
void
|
||||
tscrollup(int orig, int n)
|
||||
tscrollup(int orig, int n, int copyhist)
|
||||
{
|
||||
int i;
|
||||
Line temp;
|
||||
|
||||
LIMIT(n, 0, term.bot-orig+1);
|
||||
|
||||
if (copyhist) {
|
||||
term.histi = (term.histi + 1) % HISTSIZE;
|
||||
temp = term.hist[term.histi];
|
||||
term.hist[term.histi] = term.line[orig];
|
||||
term.line[orig] = temp;
|
||||
}
|
||||
|
||||
if (term.scr > 0 && term.scr < HISTSIZE)
|
||||
term.scr = MIN(term.scr + n, HISTSIZE-1);
|
||||
|
||||
tclearregion(0, orig, term.col-1, orig+n-1);
|
||||
tsetdirt(orig+n, term.bot);
|
||||
|
||||
|
@ -1095,7 +1161,8 @@ tscrollup(int orig, int n)
|
|||
term.line[i+n] = temp;
|
||||
}
|
||||
|
||||
selscroll(orig, -n);
|
||||
if (term.scr == 0)
|
||||
selscroll(orig, -n);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1124,7 +1191,7 @@ tnewline(int first_col)
|
|||
int y = term.c.y;
|
||||
|
||||
if (y == term.bot) {
|
||||
tscrollup(term.top, 1);
|
||||
tscrollup(term.top, 1, 1);
|
||||
} else {
|
||||
y++;
|
||||
}
|
||||
|
@ -1289,14 +1356,14 @@ void
|
|||
tinsertblankline(int n)
|
||||
{
|
||||
if (BETWEEN(term.c.y, term.top, term.bot))
|
||||
tscrolldown(term.c.y, n);
|
||||
tscrolldown(term.c.y, n, 0);
|
||||
}
|
||||
|
||||
void
|
||||
tdeleteline(int n)
|
||||
{
|
||||
if (BETWEEN(term.c.y, term.top, term.bot))
|
||||
tscrollup(term.c.y, n);
|
||||
tscrollup(term.c.y, n, 0);
|
||||
}
|
||||
|
||||
int32_t
|
||||
|
@ -1733,11 +1800,11 @@ csihandle(void)
|
|||
break;
|
||||
case 'S': /* SU -- Scroll <n> line up */
|
||||
DEFAULT(csiescseq.arg[0], 1);
|
||||
tscrollup(term.top, csiescseq.arg[0]);
|
||||
tscrollup(term.top, csiescseq.arg[0], 0);
|
||||
break;
|
||||
case 'T': /* SD -- Scroll <n> line down */
|
||||
DEFAULT(csiescseq.arg[0], 1);
|
||||
tscrolldown(term.top, csiescseq.arg[0]);
|
||||
tscrolldown(term.top, csiescseq.arg[0], 0);
|
||||
break;
|
||||
case 'L': /* IL -- Insert <n> blank lines */
|
||||
DEFAULT(csiescseq.arg[0], 1);
|
||||
|
@ -2241,7 +2308,7 @@ eschandle(uchar ascii)
|
|||
return 0;
|
||||
case 'D': /* IND -- Linefeed */
|
||||
if (term.c.y == term.bot) {
|
||||
tscrollup(term.top, 1);
|
||||
tscrollup(term.top, 1, 1);
|
||||
} else {
|
||||
tmoveto(term.c.x, term.c.y+1);
|
||||
}
|
||||
|
@ -2254,7 +2321,7 @@ eschandle(uchar ascii)
|
|||
break;
|
||||
case 'M': /* RI -- Reverse index */
|
||||
if (term.c.y == term.top) {
|
||||
tscrolldown(term.top, 1);
|
||||
tscrolldown(term.top, 1, 1);
|
||||
} else {
|
||||
tmoveto(term.c.x, term.c.y-1);
|
||||
}
|
||||
|
@ -2464,7 +2531,7 @@ twrite(const char *buf, int buflen, int show_ctrl)
|
|||
void
|
||||
tresize(int col, int row)
|
||||
{
|
||||
int i;
|
||||
int i, j;
|
||||
int minrow = MIN(row, term.row);
|
||||
int mincol = MIN(col, term.col);
|
||||
int *bp;
|
||||
|
@ -2501,6 +2568,14 @@ tresize(int col, int row)
|
|||
term.dirty = xrealloc(term.dirty, row * sizeof(*term.dirty));
|
||||
term.tabs = xrealloc(term.tabs, col * sizeof(*term.tabs));
|
||||
|
||||
for (i = 0; i < HISTSIZE; i++) {
|
||||
term.hist[i] = xrealloc(term.hist[i], col * sizeof(Glyph));
|
||||
for (j = mincol; j < col; j++) {
|
||||
term.hist[i][j] = term.c.attr;
|
||||
term.hist[i][j].u = ' ';
|
||||
}
|
||||
}
|
||||
|
||||
/* resize each row to new width, zero-pad if needed */
|
||||
for (i = 0; i < minrow; i++) {
|
||||
term.line[i] = xrealloc(term.line[i], col * sizeof(Glyph));
|
||||
|
@ -2559,7 +2634,7 @@ drawregion(int x1, int y1, int x2, int y2)
|
|||
continue;
|
||||
|
||||
term.dirty[y] = 0;
|
||||
xdrawline(term.line[y], x1, y, x2);
|
||||
xdrawline(TLINE(y), x1, y, x2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2580,8 +2655,9 @@ draw(void)
|
|||
cx--;
|
||||
|
||||
drawregion(0, 0, term.col, term.row);
|
||||
xdrawcursor(cx, term.c.y, term.line[term.c.y][cx],
|
||||
term.ocx, term.ocy, term.line[term.ocy][term.ocx]);
|
||||
if (term.scr == 0)
|
||||
xdrawcursor(cx, term.c.y, term.line[term.c.y][cx],
|
||||
term.ocx, term.ocy, term.line[term.ocy][term.ocx]);
|
||||
term.ocx = cx;
|
||||
term.ocy = term.c.y;
|
||||
xfinishdraw();
|
||||
|
|
4
st.h
4
st.h
|
@ -52,6 +52,7 @@ enum selection_snap {
|
|||
SNAP_LINE = 2
|
||||
};
|
||||
|
||||
int borderpx;
|
||||
typedef unsigned char uchar;
|
||||
typedef unsigned int uint;
|
||||
typedef unsigned long ulong;
|
||||
|
@ -81,12 +82,15 @@ void die(const char *, ...);
|
|||
void redraw(void);
|
||||
void draw(void);
|
||||
|
||||
void kscrolldown(const Arg *);
|
||||
void kscrollup(const Arg *);
|
||||
void printscreen(const Arg *);
|
||||
void printsel(const Arg *);
|
||||
void sendbreak(const Arg *);
|
||||
void toggleprinter(const Arg *);
|
||||
|
||||
int tattrset(int);
|
||||
int tisaltscr(void);
|
||||
void tnew(int, int);
|
||||
void tresize(int, int);
|
||||
void tsetdirtattr(int);
|
||||
|
|
93
x.c
93
x.c
|
@ -34,6 +34,7 @@ typedef struct {
|
|||
void (*func)(const Arg *);
|
||||
const Arg arg;
|
||||
uint release;
|
||||
int altscrn; /* 0: don't care, -1: not alt screen, 1: alt screen */
|
||||
} MouseShortcut;
|
||||
|
||||
typedef struct {
|
||||
|
@ -81,6 +82,7 @@ typedef XftGlyphFontSpec GlyphFontSpec;
|
|||
typedef struct {
|
||||
int tw, th; /* tty width and height */
|
||||
int w, h; /* window width and height */
|
||||
int hborderpx, vborderpx;
|
||||
int ch; /* char height */
|
||||
int cw; /* char width */
|
||||
int mode; /* window state/mode flags */
|
||||
|
@ -103,6 +105,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 */
|
||||
|
@ -331,7 +338,7 @@ ttysend(const Arg *arg)
|
|||
int
|
||||
evcol(XEvent *e)
|
||||
{
|
||||
int x = e->xbutton.x - borderpx;
|
||||
int x = e->xbutton.x - win.hborderpx;
|
||||
LIMIT(x, 0, win.tw - 1);
|
||||
return x / win.cw;
|
||||
}
|
||||
|
@ -339,7 +346,7 @@ evcol(XEvent *e)
|
|||
int
|
||||
evrow(XEvent *e)
|
||||
{
|
||||
int y = e->xbutton.y - borderpx;
|
||||
int y = e->xbutton.y - win.vborderpx;
|
||||
LIMIT(y, 0, win.th - 1);
|
||||
return y / win.ch;
|
||||
}
|
||||
|
@ -446,6 +453,7 @@ mouseaction(XEvent *e, uint release)
|
|||
for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) {
|
||||
if (ms->release == release &&
|
||||
ms->button == e->xbutton.button &&
|
||||
(!ms->altscrn || (ms->altscrn == (tisaltscr() ? 1 : -1))) &&
|
||||
(match(ms->mod, state) || /* exact or forced */
|
||||
match(ms->mod, state & ~forcemousemod))) {
|
||||
ms->func(&(ms->arg));
|
||||
|
@ -673,6 +681,7 @@ setsel(char *str, Time t)
|
|||
XSetSelectionOwner(xw.dpy, XA_PRIMARY, xw.win, t);
|
||||
if (XGetSelectionOwner(xw.dpy, XA_PRIMARY) != xw.win)
|
||||
selclear();
|
||||
clipcopy(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -698,6 +707,13 @@ brelease(XEvent *e)
|
|||
void
|
||||
bmotion(XEvent *e)
|
||||
{
|
||||
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 & forcemousemod)) {
|
||||
mousereport(e);
|
||||
return;
|
||||
|
@ -721,6 +737,9 @@ cresize(int width, int height)
|
|||
col = MAX(1, col);
|
||||
row = MAX(1, row);
|
||||
|
||||
win.hborderpx = (win.w - col * win.cw) / 2;
|
||||
win.vborderpx = (win.h - row * win.ch) / 2;
|
||||
|
||||
tresize(col, row);
|
||||
xresize(col, row);
|
||||
ttyresize(win.tw, win.th);
|
||||
|
@ -838,8 +857,8 @@ xhints(void)
|
|||
sizeh->flags = PSize | PResizeInc | PBaseSize | PMinSize;
|
||||
sizeh->height = win.h;
|
||||
sizeh->width = win.w;
|
||||
sizeh->height_inc = win.ch;
|
||||
sizeh->width_inc = win.cw;
|
||||
sizeh->height_inc = 1;
|
||||
sizeh->width_inc = 1;
|
||||
sizeh->base_height = 2 * borderpx;
|
||||
sizeh->base_width = 2 * borderpx;
|
||||
sizeh->min_height = win.ch + 2 * borderpx;
|
||||
|
@ -1001,6 +1020,8 @@ xloadfonts(char *fontstr, double fontsize)
|
|||
win.cw = ceilf(dc.font.width * cwscale);
|
||||
win.ch = ceilf(dc.font.height * chscale);
|
||||
|
||||
borderpx = ceilf(((float)borderperc / 100) * win.cw);
|
||||
|
||||
FcPatternDel(pattern, FC_SLANT);
|
||||
FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
|
||||
if (xloadfont(&dc.ifont, pattern))
|
||||
|
@ -1099,10 +1120,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");
|
||||
|
@ -1121,8 +1142,8 @@ xinit(int cols, int rows)
|
|||
xloadcols();
|
||||
|
||||
/* adjust fixed window geometry */
|
||||
win.w = 2 * borderpx + cols * win.cw;
|
||||
win.h = 2 * borderpx + rows * win.ch;
|
||||
win.w = 2 * win.hborderpx + cols * win.cw;
|
||||
win.h = 2 * win.vborderpx + rows * win.ch;
|
||||
if (xw.gm & XNegative)
|
||||
xw.l += DisplayWidth(xw.dpy, xw.scr) - win.w - 2;
|
||||
if (xw.gm & YNegative)
|
||||
|
@ -1166,8 +1187,9 @@ xinit(int cols, int rows)
|
|||
}
|
||||
|
||||
/* 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;
|
||||
|
@ -1181,7 +1203,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);
|
||||
|
@ -1210,7 +1235,7 @@ xinit(int cols, int rows)
|
|||
int
|
||||
xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x, int y)
|
||||
{
|
||||
float winx = borderpx + x * win.cw, winy = borderpx + y * win.ch, xp, yp;
|
||||
float winx = win.hborderpx + x * win.cw, winy = win.vborderpx + y * win.ch, xp, yp;
|
||||
ushort mode, prevmode = USHRT_MAX;
|
||||
Font *font = &dc.font;
|
||||
int frcflags = FRC_NORMAL;
|
||||
|
@ -1343,7 +1368,7 @@ void
|
|||
xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, int y)
|
||||
{
|
||||
int charlen = len * ((base.mode & ATTR_WIDE) ? 2 : 1);
|
||||
int winx = borderpx + x * win.cw, winy = borderpx + y * win.ch,
|
||||
int winx = win.hborderpx + x * win.cw, winy = win.vborderpx + y * win.ch,
|
||||
width = charlen * win.cw;
|
||||
Color *fg, *bg, *temp, revfg, revbg, truefg, truebg;
|
||||
XRenderColor colfg, colbg;
|
||||
|
@ -1433,17 +1458,17 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
|
|||
|
||||
/* Intelligent cleaning up of the borders. */
|
||||
if (x == 0) {
|
||||
xclear(0, (y == 0)? 0 : winy, borderpx,
|
||||
xclear(0, (y == 0)? 0 : winy, win.vborderpx,
|
||||
winy + win.ch +
|
||||
((winy + win.ch >= borderpx + win.th)? win.h : 0));
|
||||
((winy + win.ch >= win.vborderpx + win.th)? win.h : 0));
|
||||
}
|
||||
if (winx + width >= borderpx + win.tw) {
|
||||
if (winx + width >= win.hborderpx + win.tw) {
|
||||
xclear(winx + width, (y == 0)? 0 : winy, win.w,
|
||||
((winy + win.ch >= borderpx + win.th)? win.h : (winy + win.ch)));
|
||||
((winy + win.ch >= win.vborderpx + win.th)? win.h : (winy + win.ch)));
|
||||
}
|
||||
if (y == 0)
|
||||
xclear(winx, 0, winx + width, borderpx);
|
||||
if (winy + win.ch >= borderpx + win.th)
|
||||
xclear(winx, 0, winx + width, win.hborderpx);
|
||||
if (winy + win.ch >= win.vborderpx + win.th)
|
||||
xclear(winx, winy + win.ch, winx + width, win.h);
|
||||
|
||||
/* Clean up the region we want to draw to. */
|
||||
|
@ -1537,35 +1562,35 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
|
|||
case 3: /* Blinking Underline */
|
||||
case 4: /* Steady Underline */
|
||||
XftDrawRect(xw.draw, &drawcol,
|
||||
borderpx + cx * win.cw,
|
||||
borderpx + (cy + 1) * win.ch - \
|
||||
win.hborderpx + cx * win.cw,
|
||||
win.vborderpx + (cy + 1) * win.ch - \
|
||||
cursorthickness,
|
||||
win.cw, cursorthickness);
|
||||
break;
|
||||
case 5: /* Blinking bar */
|
||||
case 6: /* Steady bar */
|
||||
XftDrawRect(xw.draw, &drawcol,
|
||||
borderpx + cx * win.cw,
|
||||
borderpx + cy * win.ch,
|
||||
win.hborderpx + cx * win.cw,
|
||||
win.vborderpx + cy * win.ch,
|
||||
cursorthickness, win.ch);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
XftDrawRect(xw.draw, &drawcol,
|
||||
borderpx + cx * win.cw,
|
||||
borderpx + cy * win.ch,
|
||||
win.hborderpx + cx * win.cw,
|
||||
win.vborderpx + cy * win.ch,
|
||||
win.cw - 1, 1);
|
||||
XftDrawRect(xw.draw, &drawcol,
|
||||
borderpx + cx * win.cw,
|
||||
borderpx + cy * win.ch,
|
||||
win.hborderpx + cx * win.cw,
|
||||
win.vborderpx + cy * win.ch,
|
||||
1, win.ch - 1);
|
||||
XftDrawRect(xw.draw, &drawcol,
|
||||
borderpx + (cx + 1) * win.cw - 1,
|
||||
borderpx + cy * win.ch,
|
||||
win.hborderpx + (cx + 1) * win.cw - 1,
|
||||
win.vborderpx + cy * win.ch,
|
||||
1, win.ch - 1);
|
||||
XftDrawRect(xw.draw, &drawcol,
|
||||
borderpx + cx * win.cw,
|
||||
borderpx + (cy + 1) * win.ch - 1,
|
||||
win.hborderpx + cx * win.cw,
|
||||
win.vborderpx + (cy + 1) * win.ch - 1,
|
||||
win.cw, 1);
|
||||
}
|
||||
}
|
||||
|
@ -1674,6 +1699,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);
|
||||
}
|
||||
|
@ -1793,6 +1820,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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue