mirror of
https://github.com/tiyn/st
synced 2025-12-15 16:19:45 +01:00
Compare commits
3 Commits
master
...
scrollback
| Author | SHA1 | Date | |
|---|---|---|---|
| 49130ea1bd | |||
| 65a106e2e0 | |||
| dc257b11ca |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -50,7 +50,3 @@ modules.order
|
|||||||
Module.symvers
|
Module.symvers
|
||||||
Mkfile.old
|
Mkfile.old
|
||||||
dkms.conf
|
dkms.conf
|
||||||
|
|
||||||
st
|
|
||||||
|
|
||||||
config.h
|
|
||||||
|
|||||||
4
Makefile
4
Makefile
@@ -44,9 +44,7 @@ dist: clean
|
|||||||
install: st
|
install: st
|
||||||
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
||||||
cp -f st $(DESTDIR)$(PREFIX)/bin
|
cp -f st $(DESTDIR)$(PREFIX)/bin
|
||||||
cp -f st-copyout $(DESTDIR)$(PREFIX)/bin
|
|
||||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/st
|
chmod 755 $(DESTDIR)$(PREFIX)/bin/st
|
||||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/st-copyout
|
|
||||||
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
|
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
|
||||||
sed "s/VERSION/$(VERSION)/g" < st.1 > $(DESTDIR)$(MANPREFIX)/man1/st.1
|
sed "s/VERSION/$(VERSION)/g" < st.1 > $(DESTDIR)$(MANPREFIX)/man1/st.1
|
||||||
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/st.1
|
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/st.1
|
||||||
@@ -55,8 +53,6 @@ install: st
|
|||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f $(DESTDIR)$(PREFIX)/bin/st
|
rm -f $(DESTDIR)$(PREFIX)/bin/st
|
||||||
rm -f $(DESTDIR)$(PREFIX)/bin/st-copyout
|
|
||||||
rm -f $(DESTDIR)$(MANPREFIX)/man1/st.1
|
|
||||||
rm -f $(DESTDIR)$(MANPREFIX)/man1/st.1
|
rm -f $(DESTDIR)$(MANPREFIX)/man1/st.1
|
||||||
|
|
||||||
.PHONY: all options clean dist install uninstall
|
.PHONY: all options clean dist install uninstall
|
||||||
|
|||||||
47
README.md
47
README.md
@@ -1,47 +0,0 @@
|
|||||||
# st
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
This is my patched version of st. The base version is directly from suckless.org.
|
|
||||||
This belongs to my larbs installation script, but does not directly depend on it.
|
|
||||||
It is supposed to work in the environment after the larbs-base-installation.
|
|
||||||
|
|
||||||
## Patches
|
|
||||||
|
|
||||||
The list below shows the currently applied patches to the master branch.
|
|
||||||
|
|
||||||
- st-alpha-20220206-0.8.5.diff (adds transparency)
|
|
||||||
- st-anysize-20220718-baa9357.diff (st leaves no gaps if the height/width doesn't match a multiple of
|
|
||||||
character height)
|
|
||||||
- st-externalpipe-0.8.4.diff (allows reading and writing st's screen through a pipe)
|
|
||||||
- st-ligatures-scrollback-20230105-0.9.diff (scrollback compatible addition of ligatures)
|
|
||||||
- st-scrollback-0.8.5.diff (add scrollback functionality)
|
|
||||||
|
|
||||||
## Hotkeys
|
|
||||||
|
|
||||||
There are various shortcuts and hotkeys used in this version. Included in my build are the following.
|
|
||||||
|
|
||||||
| ModKey | Shift | Key | Function |
|
|
||||||
| ------ | ----- | --------------- | -------------------------------------------- |
|
|
||||||
| Alt | | Break | Send break |
|
|
||||||
| Alt | | Print | Toggle printer |
|
|
||||||
| Alt | | Print | Print screen |
|
|
||||||
| | Shift | Insert | Clipboard paste |
|
|
||||||
| Alt | | c | Clipboard copy |
|
|
||||||
| Alt | | v | Clipboard paste |
|
|
||||||
| Alt | | p | Selected paste |
|
|
||||||
| Alt | | NumLock | Toggle Numlock |
|
|
||||||
| Alt | | k | Scroll up |
|
|
||||||
| Alt | | j | Scroll down |
|
|
||||||
| | | MouseScrollUp | Scroll up |
|
|
||||||
| | | MouseScrollDown | Scroll down |
|
|
||||||
| Alt | Shift | u | Zoom in |
|
|
||||||
| Alt | Shift | i | Zoom out |
|
|
||||||
| Alt | | o | copy output of previous command to clipboard |
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
The most basic way is to clone the repository and then invoke make.
|
|
||||||
|
|
||||||
- `git clone https://github.com/tiyn/st`
|
|
||||||
- `make clean install`
|
|
||||||
105
config.def.h
105
config.def.h
@@ -5,17 +5,9 @@
|
|||||||
*
|
*
|
||||||
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
|
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
|
||||||
*/
|
*/
|
||||||
static char *font = "mono:pixelsize=16:antialias=true:autohint=true";
|
static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
|
||||||
static int borderpx = 2;
|
static int borderpx = 2;
|
||||||
|
|
||||||
/* Spare fonts */
|
|
||||||
static char *font2[] = {
|
|
||||||
"JoyPixels:pixelsize=16:antialias=true:autohint=true",
|
|
||||||
"Symbola:pixelsize=16:antialias=true:autohint=true",
|
|
||||||
"Source Han Mono:pixelsize=16:antialias=true:autohint=true",
|
|
||||||
"Source Han Mono K:pixelsize=16:antialias=true:autohint=true",
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* What program is execed by st depends of these precedence rules:
|
* What program is execed by st depends of these precedence rules:
|
||||||
* 1: program passed with -e
|
* 1: program passed with -e
|
||||||
@@ -101,33 +93,35 @@ char *termname = "st-256color";
|
|||||||
*/
|
*/
|
||||||
unsigned int tabspaces = 8;
|
unsigned int tabspaces = 8;
|
||||||
|
|
||||||
/* bg opacity */
|
|
||||||
float alpha = 1.0;
|
|
||||||
|
|
||||||
/* Terminal colors (16 first used in escape sequence) */
|
/* Terminal colors (16 first used in escape sequence) */
|
||||||
static const char *colorname[] = {
|
static const char *colorname[] = {
|
||||||
/* 8 normal colors */
|
/* 8 normal colors */
|
||||||
"#191919",
|
"black",
|
||||||
"#f44747",
|
"red3",
|
||||||
"#608b4e",
|
"green3",
|
||||||
"#dcdcaa",
|
"yellow3",
|
||||||
"#569cd6",
|
"blue2",
|
||||||
"#c678dd",
|
"magenta3",
|
||||||
"#56b6c2",
|
"cyan3",
|
||||||
"#d4d4d4",
|
"gray90",
|
||||||
"#808080",
|
|
||||||
"#f44747",
|
/* 8 bright colors */
|
||||||
"#608b4e",
|
"gray50",
|
||||||
"#dcdcaa",
|
"red",
|
||||||
"#569cd6",
|
"green",
|
||||||
"#c678dd",
|
"yellow",
|
||||||
"#56b6c2",
|
"#5c5cff",
|
||||||
"#d4d4d4",
|
"magenta",
|
||||||
|
"cyan",
|
||||||
|
"white",
|
||||||
|
|
||||||
[255] = 0,
|
[255] = 0,
|
||||||
|
|
||||||
/* more colors can be added after 255 to use with DefaultXX */
|
/* more colors can be added after 255 to use with DefaultXX */
|
||||||
"#191919", /* 256 -> bg */
|
"#cccccc",
|
||||||
"#d4d4d4", /* 257 -> fg */
|
"#555555",
|
||||||
"#a4a4a4", /* 258 -> cursor */
|
"gray90", /* default foreground colour */
|
||||||
|
"black", /* default background colour */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -135,10 +129,10 @@ static const char *colorname[] = {
|
|||||||
* Default colors (colorname index)
|
* Default colors (colorname index)
|
||||||
* foreground, background, cursor, reverse cursor
|
* foreground, background, cursor, reverse cursor
|
||||||
*/
|
*/
|
||||||
unsigned int defaultfg = 257;
|
unsigned int defaultfg = 258;
|
||||||
unsigned int defaultbg = 256;
|
unsigned int defaultbg = 259;
|
||||||
unsigned int defaultcs = 258;
|
unsigned int defaultcs = 256;
|
||||||
static unsigned int defaultrcs = 0;
|
static unsigned int defaultrcs = 257;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Default shape of cursor
|
* Default shape of cursor
|
||||||
@@ -181,35 +175,34 @@ static uint forcemousemod = ShiftMask;
|
|||||||
* Beware that overloading Button1 will disable the selection.
|
* Beware that overloading Button1 will disable the selection.
|
||||||
*/
|
*/
|
||||||
static MouseShortcut mshortcuts[] = {
|
static MouseShortcut mshortcuts[] = {
|
||||||
/* mask button function argument release */
|
/* mask button function argument release */
|
||||||
// { Button4, XK_NO_MOD, "\031" },
|
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
|
||||||
// { Button5, XK_NO_MOD, "\005" },
|
{ ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} },
|
||||||
{ XK_NO_MOD, Button4, kscrollup, {.i = 1} },
|
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
|
||||||
{ XK_NO_MOD, Button5, kscrolldown,{.i = 1} },
|
{ ShiftMask, Button5, ttysend, {.s = "\033[6;2~"} },
|
||||||
|
{ XK_ANY_MOD, Button5, ttysend, {.s = "\005"} },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Internal keyboard shortcuts. */
|
/* Internal keyboard shortcuts. */
|
||||||
#define MODKEY Mod1Mask
|
#define MODKEY Mod1Mask
|
||||||
#define TERMMOD (ControlMask|ShiftMask)
|
#define TERMMOD (ControlMask|ShiftMask)
|
||||||
|
|
||||||
static char *copyoutput[] = { "/bin/sh", "-c", "st-copyout", "externalpipe", NULL };
|
|
||||||
|
|
||||||
static Shortcut shortcuts[] = {
|
static Shortcut shortcuts[] = {
|
||||||
/* mask keysym function argument */
|
/* mask keysym function argument */
|
||||||
{ MODKEY, XK_Break, sendbreak, {.i = 0} },
|
{ XK_ANY_MOD, XK_Break, sendbreak, {.i = 0} },
|
||||||
{ MODKEY, XK_Print, toggleprinter, {.i = 0} },
|
{ ControlMask, XK_Print, toggleprinter, {.i = 0} },
|
||||||
{ MODKEY, XK_Print, printscreen, {.i = 0} },
|
{ ShiftMask, XK_Print, printscreen, {.i = 0} },
|
||||||
{ ShiftMask, XK_Insert, clippaste, {.i = 0} },
|
{ XK_ANY_MOD, XK_Print, printsel, {.i = 0} },
|
||||||
{ MODKEY, XK_c, clipcopy, {.i = 0} },
|
{ TERMMOD, XK_Prior, zoom, {.f = +1} },
|
||||||
{ MODKEY, XK_v, clippaste, {.i = 0} },
|
{ TERMMOD, XK_Next, zoom, {.f = -1} },
|
||||||
{ MODKEY, XK_p, selpaste, {.i = 0} },
|
{ TERMMOD, XK_Home, zoomreset, {.f = 0} },
|
||||||
{ MODKEY, XK_Num_Lock, numlock, {.i = 0} },
|
{ TERMMOD, XK_C, clipcopy, {.i = 0} },
|
||||||
{ MODKEY, XK_k, kscrollup, {.i = 1} },
|
{ TERMMOD, XK_V, clippaste, {.i = 0} },
|
||||||
{ MODKEY, XK_j, kscrolldown, {.i = 1} },
|
{ TERMMOD, XK_Y, selpaste, {.i = 0} },
|
||||||
{ MODKEY, XK_U, zoom, {.f = +1} },
|
{ ShiftMask, XK_Insert, selpaste, {.i = 0} },
|
||||||
{ MODKEY|ShiftMask, XK_U, zoom, {.f = +1} },
|
{ TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
|
||||||
{ MODKEY|ShiftMask, XK_I, zoom, {.f = -1} },
|
{ ShiftMask, XK_Page_Up, kscrollup, {.i = -1} },
|
||||||
{ MODKEY, XK_o, externalpipe, {.v = copyoutput } },
|
{ ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} },
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ INCS = -I$(X11INC) \
|
|||||||
`$(PKG_CONFIG) --cflags fontconfig` \
|
`$(PKG_CONFIG) --cflags fontconfig` \
|
||||||
`$(PKG_CONFIG) --cflags freetype2` \
|
`$(PKG_CONFIG) --cflags freetype2` \
|
||||||
`$(PKG_CONFIG) --cflags harfbuzz`
|
`$(PKG_CONFIG) --cflags harfbuzz`
|
||||||
LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft -lXrender\
|
LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft \
|
||||||
`$(PKG_CONFIG) --libs fontconfig` \
|
`$(PKG_CONFIG) --libs fontconfig` \
|
||||||
`$(PKG_CONFIG) --libs freetype2` \
|
`$(PKG_CONFIG) --libs freetype2` \
|
||||||
`$(PKG_CONFIG) --libs harfbuzz`
|
`$(PKG_CONFIG) --libs harfbuzz`
|
||||||
|
|||||||
@@ -1,146 +0,0 @@
|
|||||||
diff --git a/config.def.h b/config.def.h
|
|
||||||
index 91ab8ca..6af616e 100644
|
|
||||||
--- a/config.def.h
|
|
||||||
+++ b/config.def.h
|
|
||||||
@@ -93,6 +93,9 @@ char *termname = "st-256color";
|
|
||||||
*/
|
|
||||||
unsigned int tabspaces = 8;
|
|
||||||
|
|
||||||
+/* bg opacity */
|
|
||||||
+float alpha = 0.8;
|
|
||||||
+
|
|
||||||
/* Terminal colors (16 first used in escape sequence) */
|
|
||||||
static const char *colorname[] = {
|
|
||||||
/* 8 normal colors */
|
|
||||||
diff --git a/config.mk b/config.mk
|
|
||||||
index 4c4c5d5..0114bad 100644
|
|
||||||
--- a/config.mk
|
|
||||||
+++ b/config.mk
|
|
||||||
@@ -16,7 +16,7 @@ PKG_CONFIG = pkg-config
|
|
||||||
INCS = -I$(X11INC) \
|
|
||||||
`$(PKG_CONFIG) --cflags fontconfig` \
|
|
||||||
`$(PKG_CONFIG) --cflags freetype2`
|
|
||||||
-LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft \
|
|
||||||
+LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft -lXrender\
|
|
||||||
`$(PKG_CONFIG) --libs fontconfig` \
|
|
||||||
`$(PKG_CONFIG) --libs freetype2`
|
|
||||||
|
|
||||||
diff --git a/st.h b/st.h
|
|
||||||
index 519b9bd..8bb533d 100644
|
|
||||||
--- a/st.h
|
|
||||||
+++ b/st.h
|
|
||||||
@@ -126,3 +126,4 @@ extern unsigned int tabspaces;
|
|
||||||
extern unsigned int defaultfg;
|
|
||||||
extern unsigned int defaultbg;
|
|
||||||
extern unsigned int defaultcs;
|
|
||||||
+extern float alpha;
|
|
||||||
diff --git a/x.c b/x.c
|
|
||||||
index 8a16faa..ddf4178 100644
|
|
||||||
--- a/x.c
|
|
||||||
+++ b/x.c
|
|
||||||
@@ -105,6 +105,7 @@ typedef struct {
|
|
||||||
XSetWindowAttributes attrs;
|
|
||||||
int scr;
|
|
||||||
int isfixed; /* is fixed geometry? */
|
|
||||||
+ int depth; /* bit depth */
|
|
||||||
int l, t; /* left and top offset */
|
|
||||||
int gm; /* geometry mask */
|
|
||||||
} XWindow;
|
|
||||||
@@ -243,6 +244,7 @@ static char *usedfont = NULL;
|
|
||||||
static double usedfontsize = 0;
|
|
||||||
static double defaultfontsize = 0;
|
|
||||||
|
|
||||||
+static char *opt_alpha = NULL;
|
|
||||||
static char *opt_class = NULL;
|
|
||||||
static char **opt_cmd = NULL;
|
|
||||||
static char *opt_embed = NULL;
|
|
||||||
@@ -736,7 +738,7 @@ xresize(int col, int row)
|
|
||||||
|
|
||||||
XFreePixmap(xw.dpy, xw.buf);
|
|
||||||
xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
|
|
||||||
- DefaultDepth(xw.dpy, xw.scr));
|
|
||||||
+ xw.depth);
|
|
||||||
XftDrawChange(xw.draw, xw.buf);
|
|
||||||
xclear(0, 0, win.w, win.h);
|
|
||||||
|
|
||||||
@@ -796,6 +798,13 @@ xloadcols(void)
|
|
||||||
else
|
|
||||||
die("could not allocate color %d\n", i);
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ /* set alpha value of bg color */
|
|
||||||
+ if (opt_alpha)
|
|
||||||
+ alpha = strtof(opt_alpha, NULL);
|
|
||||||
+ dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * alpha);
|
|
||||||
+ dc.col[defaultbg].pixel &= 0x00FFFFFF;
|
|
||||||
+ dc.col[defaultbg].pixel |= (unsigned char)(0xff * alpha) << 24;
|
|
||||||
loaded = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1118,11 +1127,23 @@ xinit(int cols, int rows)
|
|
||||||
Window parent;
|
|
||||||
pid_t thispid = getpid();
|
|
||||||
XColor xmousefg, xmousebg;
|
|
||||||
+ XWindowAttributes attr;
|
|
||||||
+ XVisualInfo vis;
|
|
||||||
|
|
||||||
if (!(xw.dpy = XOpenDisplay(NULL)))
|
|
||||||
die("can't open display\n");
|
|
||||||
xw.scr = XDefaultScreen(xw.dpy);
|
|
||||||
- xw.vis = XDefaultVisual(xw.dpy, xw.scr);
|
|
||||||
+
|
|
||||||
+ if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) {
|
|
||||||
+ parent = XRootWindow(xw.dpy, xw.scr);
|
|
||||||
+ xw.depth = 32;
|
|
||||||
+ } else {
|
|
||||||
+ XGetWindowAttributes(xw.dpy, parent, &attr);
|
|
||||||
+ xw.depth = attr.depth;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ XMatchVisualInfo(xw.dpy, xw.scr, xw.depth, TrueColor, &vis);
|
|
||||||
+ xw.vis = vis.visual;
|
|
||||||
|
|
||||||
/* font */
|
|
||||||
if (!FcInit())
|
|
||||||
@@ -1132,7 +1153,7 @@ xinit(int cols, int rows)
|
|
||||||
xloadfonts(usedfont, 0);
|
|
||||||
|
|
||||||
/* colors */
|
|
||||||
- xw.cmap = XDefaultColormap(xw.dpy, xw.scr);
|
|
||||||
+ xw.cmap = XCreateColormap(xw.dpy, parent, xw.vis, None);
|
|
||||||
xloadcols();
|
|
||||||
|
|
||||||
/* adjust fixed window geometry */
|
|
||||||
@@ -1152,19 +1173,15 @@ xinit(int cols, int rows)
|
|
||||||
| ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
|
|
||||||
xw.attrs.colormap = xw.cmap;
|
|
||||||
|
|
||||||
- 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,
|
|
||||||
- win.w, win.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput,
|
|
||||||
+ win.w, win.h, 0, xw.depth, InputOutput,
|
|
||||||
xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity
|
|
||||||
| CWEventMask | CWColormap, &xw.attrs);
|
|
||||||
|
|
||||||
memset(&gcvalues, 0, sizeof(gcvalues));
|
|
||||||
gcvalues.graphics_exposures = False;
|
|
||||||
- dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures,
|
|
||||||
- &gcvalues);
|
|
||||||
- xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
|
|
||||||
- DefaultDepth(xw.dpy, xw.scr));
|
|
||||||
+ xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, xw.depth);
|
|
||||||
+ dc.gc = XCreateGC(xw.dpy, xw.buf, GCGraphicsExposures, &gcvalues);
|
|
||||||
XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel);
|
|
||||||
XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h);
|
|
||||||
|
|
||||||
@@ -2019,6 +2036,9 @@ main(int argc, char *argv[])
|
|
||||||
case 'a':
|
|
||||||
allowaltscreen = 0;
|
|
||||||
break;
|
|
||||||
+ case 'A':
|
|
||||||
+ opt_alpha = EARGF(usage());
|
|
||||||
+ break;
|
|
||||||
case 'c':
|
|
||||||
opt_class = EARGF(usage());
|
|
||||||
break;
|
|
||||||
@@ -1,164 +0,0 @@
|
|||||||
From 8dcdc4b21a73268e167d98aa30f24315c7f3b7ff Mon Sep 17 00:00:00 2001
|
|
||||||
From: Bakkeby <bakkeby@gmail.com>
|
|
||||||
Date: Mon, 18 Jul 2022 16:52:03 +0200
|
|
||||||
Subject: [PATCH] Adding anysize patch
|
|
||||||
|
|
||||||
---
|
|
||||||
x.c | 56 ++++++++++++++++++++++++++++++--------------------------
|
|
||||||
1 file changed, 30 insertions(+), 26 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/x.c b/x.c
|
|
||||||
index 2a3bd38..f534347 100644
|
|
||||||
--- a/x.c
|
|
||||||
+++ b/x.c
|
|
||||||
@@ -81,6 +81,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 */
|
|
||||||
@@ -331,7 +332,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 +340,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;
|
|
||||||
}
|
|
||||||
@@ -739,6 +740,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);
|
|
||||||
@@ -869,8 +873,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;
|
|
||||||
@@ -1152,8 +1156,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 + 2 * borderpx + cols * win.cw;
|
|
||||||
+ win.h = 2 * win.vborderpx + 2 * borderpx + rows * win.ch;
|
|
||||||
if (xw.gm & XNegative)
|
|
||||||
xw.l += DisplayWidth(xw.dpy, xw.scr) - win.w - 2;
|
|
||||||
if (xw.gm & YNegative)
|
|
||||||
@@ -1242,7 +1246,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;
|
|
||||||
@@ -1375,7 +1379,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;
|
|
||||||
@@ -1465,17 +1469,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.hborderpx,
|
|
||||||
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.vborderpx);
|
|
||||||
+ 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. */
|
|
||||||
@@ -1569,35 +1573,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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.37.1
|
|
||||||
|
|
||||||
13
st-copyout
13
st-copyout
@@ -1,13 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# Using external pipe with st, give a dmenu prompt of recent commands,
|
|
||||||
# allowing the user to copy the output of one.
|
|
||||||
# xclip required for this script.
|
|
||||||
# By Jaywalker and Luke
|
|
||||||
tmpfile=$(mktemp /tmp/st-cmd-output.XXXXXX)
|
|
||||||
trap 'rm "$tmpfile"' 0 1 15
|
|
||||||
sed -n "w $tmpfile"
|
|
||||||
sed -i 's/\x0//g' "$tmpfile"
|
|
||||||
ps1="$(grep "\S" "$tmpfile" | tail -n 1 | sed 's/^\s*//' | cut -d' ' -f1)"
|
|
||||||
chosen="$(grep -F "$ps1" "$tmpfile" | sed '$ d' | tac | dmenu -p "Copy which command's output?" -i -l 10 | sed 's/[^^]/[&]/g; s/\^/\\^/g')"
|
|
||||||
eps1="$(echo "$ps1" | sed 's/[^^]/[&]/g; s/\^/\\^/g')"
|
|
||||||
awk "/^$chosen$/{p=1;print;next} p&&/$eps1/{p=0};p" "$tmpfile" | xclip -selection clipboard
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
diff --git a/st.c b/st.c
|
|
||||||
index 76b7e0d..0e9a614 100644
|
|
||||||
--- a/st.c
|
|
||||||
+++ b/st.c
|
|
||||||
@@ -723,8 +723,14 @@ sigchld(int a)
|
|
||||||
if ((p = waitpid(pid, &stat, WNOHANG)) < 0)
|
|
||||||
die("waiting for pid %hd failed: %s\n", pid, strerror(errno));
|
|
||||||
|
|
||||||
- if (pid != p)
|
|
||||||
+ if (pid != p) {
|
|
||||||
+ if (p == 0 && wait(&stat) < 0)
|
|
||||||
+ die("wait: %s\n", strerror(errno));
|
|
||||||
+
|
|
||||||
+ /* reinstall sigchld handler */
|
|
||||||
+ signal(SIGCHLD, sigchld);
|
|
||||||
return;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
if (WIFEXITED(stat) && WEXITSTATUS(stat))
|
|
||||||
die("child exited with status %d\n", WEXITSTATUS(stat));
|
|
||||||
@@ -1926,6 +1932,59 @@ strparse(void)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+void
|
|
||||||
+externalpipe(const Arg *arg)
|
|
||||||
+{
|
|
||||||
+ int to[2];
|
|
||||||
+ char buf[UTF_SIZ];
|
|
||||||
+ void (*oldsigpipe)(int);
|
|
||||||
+ Glyph *bp, *end;
|
|
||||||
+ int lastpos, n, newline;
|
|
||||||
+
|
|
||||||
+ if (pipe(to) == -1)
|
|
||||||
+ return;
|
|
||||||
+
|
|
||||||
+ switch (fork()) {
|
|
||||||
+ case -1:
|
|
||||||
+ close(to[0]);
|
|
||||||
+ close(to[1]);
|
|
||||||
+ return;
|
|
||||||
+ case 0:
|
|
||||||
+ dup2(to[0], STDIN_FILENO);
|
|
||||||
+ close(to[0]);
|
|
||||||
+ close(to[1]);
|
|
||||||
+ execvp(((char **)arg->v)[0], (char **)arg->v);
|
|
||||||
+ fprintf(stderr, "st: execvp %s\n", ((char **)arg->v)[0]);
|
|
||||||
+ perror("failed");
|
|
||||||
+ exit(0);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ close(to[0]);
|
|
||||||
+ /* ignore sigpipe for now, in case child exists early */
|
|
||||||
+ oldsigpipe = signal(SIGPIPE, SIG_IGN);
|
|
||||||
+ newline = 0;
|
|
||||||
+ for (n = 0; n < term.row; n++) {
|
|
||||||
+ bp = term.line[n];
|
|
||||||
+ lastpos = MIN(tlinelen(n) + 1, term.col) - 1;
|
|
||||||
+ if (lastpos < 0)
|
|
||||||
+ break;
|
|
||||||
+ end = &bp[lastpos + 1];
|
|
||||||
+ for (; bp < end; ++bp)
|
|
||||||
+ if (xwrite(to[1], buf, utf8encode(bp->u, buf)) < 0)
|
|
||||||
+ break;
|
|
||||||
+ if ((newline = term.line[n][lastpos].mode & ATTR_WRAP))
|
|
||||||
+ continue;
|
|
||||||
+ if (xwrite(to[1], "\n", 1) < 0)
|
|
||||||
+ break;
|
|
||||||
+ newline = 0;
|
|
||||||
+ }
|
|
||||||
+ if (newline)
|
|
||||||
+ (void)xwrite(to[1], "\n", 1);
|
|
||||||
+ close(to[1]);
|
|
||||||
+ /* restore */
|
|
||||||
+ signal(SIGPIPE, oldsigpipe);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
void
|
|
||||||
strdump(void)
|
|
||||||
{
|
|
||||||
diff --git a/st.h b/st.h
|
|
||||||
index 3d351b6..392b64e 100644
|
|
||||||
--- a/st.h
|
|
||||||
+++ b/st.h
|
|
||||||
@@ -81,6 +81,7 @@ void die(const char *, ...);
|
|
||||||
void redraw(void);
|
|
||||||
void draw(void);
|
|
||||||
|
|
||||||
+void externalpipe(const Arg *);
|
|
||||||
void printscreen(const Arg *);
|
|
||||||
void printsel(const Arg *);
|
|
||||||
void sendbreak(const Arg *);
|
|
||||||
@@ -1,163 +0,0 @@
|
|||||||
From 1635e04d3643dd4caa0c7c2043b585c6d7e4705f Mon Sep 17 00:00:00 2001
|
|
||||||
From: Rizqi Nur Assyaufi <bandithijo@gmail.com>
|
|
||||||
Date: Mon, 18 Jul 2022 01:15:45 +0800
|
|
||||||
Subject: [PATCH] [st][patch][font2] Add patch for st-0.8.5
|
|
||||||
|
|
||||||
---
|
|
||||||
config.def.h | 6 +++
|
|
||||||
x.c | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
||||||
2 files changed, 107 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/config.def.h b/config.def.h
|
|
||||||
index 91ab8ca..717b2f0 100644
|
|
||||||
--- a/config.def.h
|
|
||||||
+++ b/config.def.h
|
|
||||||
@@ -6,6 +6,12 @@
|
|
||||||
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
|
|
||||||
*/
|
|
||||||
static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
|
|
||||||
+/* Spare fonts */
|
|
||||||
+static char *font2[] = {
|
|
||||||
+/* "Inconsolata for Powerline:pixelsize=12:antialias=true:autohint=true", */
|
|
||||||
+/* "Hack Nerd Font Mono:pixelsize=11:antialias=true:autohint=true", */
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
static int borderpx = 2;
|
|
||||||
|
|
||||||
/*
|
|
||||||
diff --git a/x.c b/x.c
|
|
||||||
index 8a16faa..220fc4f 100644
|
|
||||||
--- a/x.c
|
|
||||||
+++ b/x.c
|
|
||||||
@@ -157,6 +157,8 @@ static void xhints(void);
|
|
||||||
static int xloadcolor(int, const char *, Color *);
|
|
||||||
static int xloadfont(Font *, FcPattern *);
|
|
||||||
static void xloadfonts(const char *, double);
|
|
||||||
+static int xloadsparefont(FcPattern *, int);
|
|
||||||
+static void xloadsparefonts(void);
|
|
||||||
static void xunloadfont(Font *);
|
|
||||||
static void xunloadfonts(void);
|
|
||||||
static void xsetenv(void);
|
|
||||||
@@ -306,6 +308,7 @@ zoomabs(const Arg *arg)
|
|
||||||
{
|
|
||||||
xunloadfonts();
|
|
||||||
xloadfonts(usedfont, arg->f);
|
|
||||||
+ xloadsparefonts();
|
|
||||||
cresize(0, 0);
|
|
||||||
redraw();
|
|
||||||
xhints();
|
|
||||||
@@ -1034,6 +1037,101 @@ xloadfonts(const char *fontstr, double fontsize)
|
|
||||||
FcPatternDestroy(pattern);
|
|
||||||
}
|
|
||||||
|
|
||||||
+int
|
|
||||||
+xloadsparefont(FcPattern *pattern, int flags)
|
|
||||||
+{
|
|
||||||
+ FcPattern *match;
|
|
||||||
+ FcResult result;
|
|
||||||
+
|
|
||||||
+ match = FcFontMatch(NULL, pattern, &result);
|
|
||||||
+ if (!match) {
|
|
||||||
+ return 1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (!(frc[frclen].font = XftFontOpenPattern(xw.dpy, match))) {
|
|
||||||
+ FcPatternDestroy(match);
|
|
||||||
+ return 1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ frc[frclen].flags = flags;
|
|
||||||
+ /* Believe U+0000 glyph will present in each default font */
|
|
||||||
+ frc[frclen].unicodep = 0;
|
|
||||||
+ frclen++;
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void
|
|
||||||
+xloadsparefonts(void)
|
|
||||||
+{
|
|
||||||
+ FcPattern *pattern;
|
|
||||||
+ double sizeshift, fontval;
|
|
||||||
+ int fc;
|
|
||||||
+ char **fp;
|
|
||||||
+
|
|
||||||
+ if (frclen != 0)
|
|
||||||
+ die("can't embed spare fonts. cache isn't empty");
|
|
||||||
+
|
|
||||||
+ /* Calculate count of spare fonts */
|
|
||||||
+ fc = sizeof(font2) / sizeof(*font2);
|
|
||||||
+ if (fc == 0)
|
|
||||||
+ return;
|
|
||||||
+
|
|
||||||
+ /* Allocate memory for cache entries. */
|
|
||||||
+ if (frccap < 4 * fc) {
|
|
||||||
+ frccap += 4 * fc - frccap;
|
|
||||||
+ frc = xrealloc(frc, frccap * sizeof(Fontcache));
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ for (fp = font2; fp - font2 < fc; ++fp) {
|
|
||||||
+
|
|
||||||
+ if (**fp == '-')
|
|
||||||
+ pattern = XftXlfdParse(*fp, False, False);
|
|
||||||
+ else
|
|
||||||
+ pattern = FcNameParse((FcChar8 *)*fp);
|
|
||||||
+
|
|
||||||
+ if (!pattern)
|
|
||||||
+ die("can't open spare font %s\n", *fp);
|
|
||||||
+
|
|
||||||
+ if (defaultfontsize > 0) {
|
|
||||||
+ sizeshift = usedfontsize - defaultfontsize;
|
|
||||||
+ if (sizeshift != 0 &&
|
|
||||||
+ FcPatternGetDouble(pattern, FC_PIXEL_SIZE, 0, &fontval) ==
|
|
||||||
+ FcResultMatch) {
|
|
||||||
+ fontval += sizeshift;
|
|
||||||
+ FcPatternDel(pattern, FC_PIXEL_SIZE);
|
|
||||||
+ FcPatternDel(pattern, FC_SIZE);
|
|
||||||
+ FcPatternAddDouble(pattern, FC_PIXEL_SIZE, fontval);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ FcPatternAddBool(pattern, FC_SCALABLE, 1);
|
|
||||||
+
|
|
||||||
+ FcConfigSubstitute(NULL, pattern, FcMatchPattern);
|
|
||||||
+ XftDefaultSubstitute(xw.dpy, xw.scr, pattern);
|
|
||||||
+
|
|
||||||
+ if (xloadsparefont(pattern, FRC_NORMAL))
|
|
||||||
+ die("can't open spare font %s\n", *fp);
|
|
||||||
+
|
|
||||||
+ FcPatternDel(pattern, FC_SLANT);
|
|
||||||
+ FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
|
|
||||||
+ if (xloadsparefont(pattern, FRC_ITALIC))
|
|
||||||
+ die("can't open spare font %s\n", *fp);
|
|
||||||
+
|
|
||||||
+ FcPatternDel(pattern, FC_WEIGHT);
|
|
||||||
+ FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD);
|
|
||||||
+ if (xloadsparefont(pattern, FRC_ITALICBOLD))
|
|
||||||
+ die("can't open spare font %s\n", *fp);
|
|
||||||
+
|
|
||||||
+ FcPatternDel(pattern, FC_SLANT);
|
|
||||||
+ FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN);
|
|
||||||
+ if (xloadsparefont(pattern, FRC_BOLD))
|
|
||||||
+ die("can't open spare font %s\n", *fp);
|
|
||||||
+
|
|
||||||
+ FcPatternDestroy(pattern);
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
void
|
|
||||||
xunloadfont(Font *f)
|
|
||||||
{
|
|
||||||
@@ -1131,6 +1229,9 @@ xinit(int cols, int rows)
|
|
||||||
usedfont = (opt_font == NULL)? font : opt_font;
|
|
||||||
xloadfonts(usedfont, 0);
|
|
||||||
|
|
||||||
+ /* spare fonts */
|
|
||||||
+ xloadsparefonts();
|
|
||||||
+
|
|
||||||
/* colors */
|
|
||||||
xw.cmap = XDefaultColormap(xw.dpy, xw.scr);
|
|
||||||
xloadcols();
|
|
||||||
--
|
|
||||||
2.37.1
|
|
||||||
|
|
||||||
61
st.c
61
st.c
@@ -725,14 +725,8 @@ sigchld(int a)
|
|||||||
if ((p = waitpid(pid, &stat, WNOHANG)) < 0)
|
if ((p = waitpid(pid, &stat, WNOHANG)) < 0)
|
||||||
die("waiting for pid %hd failed: %s\n", pid, strerror(errno));
|
die("waiting for pid %hd failed: %s\n", pid, strerror(errno));
|
||||||
|
|
||||||
if (pid != p) {
|
if (pid != p)
|
||||||
if (p == 0 && wait(&stat) < 0)
|
|
||||||
die("wait: %s\n", strerror(errno));
|
|
||||||
|
|
||||||
/* reinstall sigchld handler */
|
|
||||||
signal(SIGCHLD, sigchld);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (WIFEXITED(stat) && WEXITSTATUS(stat))
|
if (WIFEXITED(stat) && WEXITSTATUS(stat))
|
||||||
die("child exited with status %d\n", WEXITSTATUS(stat));
|
die("child exited with status %d\n", WEXITSTATUS(stat));
|
||||||
@@ -2049,59 +2043,6 @@ strparse(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
externalpipe(const Arg *arg)
|
|
||||||
{
|
|
||||||
int to[2];
|
|
||||||
char buf[UTF_SIZ];
|
|
||||||
void (*oldsigpipe)(int);
|
|
||||||
Glyph *bp, *end;
|
|
||||||
int lastpos, n, newline;
|
|
||||||
|
|
||||||
if (pipe(to) == -1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
switch (fork()) {
|
|
||||||
case -1:
|
|
||||||
close(to[0]);
|
|
||||||
close(to[1]);
|
|
||||||
return;
|
|
||||||
case 0:
|
|
||||||
dup2(to[0], STDIN_FILENO);
|
|
||||||
close(to[0]);
|
|
||||||
close(to[1]);
|
|
||||||
execvp(((char **)arg->v)[0], (char **)arg->v);
|
|
||||||
fprintf(stderr, "st: execvp %s\n", ((char **)arg->v)[0]);
|
|
||||||
perror("failed");
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
close(to[0]);
|
|
||||||
/* ignore sigpipe for now, in case child exists early */
|
|
||||||
oldsigpipe = signal(SIGPIPE, SIG_IGN);
|
|
||||||
newline = 0;
|
|
||||||
for (n = 0; n < term.row; n++) {
|
|
||||||
bp = term.line[n];
|
|
||||||
lastpos = MIN(tlinelen(n) + 1, term.col) - 1;
|
|
||||||
if (lastpos < 0)
|
|
||||||
break;
|
|
||||||
end = &bp[lastpos + 1];
|
|
||||||
for (; bp < end; ++bp)
|
|
||||||
if (xwrite(to[1], buf, utf8encode(bp->u, buf)) < 0)
|
|
||||||
break;
|
|
||||||
if ((newline = term.line[n][lastpos].mode & ATTR_WRAP))
|
|
||||||
continue;
|
|
||||||
if (xwrite(to[1], "\n", 1) < 0)
|
|
||||||
break;
|
|
||||||
newline = 0;
|
|
||||||
}
|
|
||||||
if (newline)
|
|
||||||
(void)xwrite(to[1], "\n", 1);
|
|
||||||
close(to[1]);
|
|
||||||
/* restore */
|
|
||||||
signal(SIGPIPE, oldsigpipe);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
strdump(void)
|
strdump(void)
|
||||||
{
|
{
|
||||||
|
|||||||
2
st.h
2
st.h
@@ -84,7 +84,6 @@ void draw(void);
|
|||||||
|
|
||||||
void kscrolldown(const Arg *);
|
void kscrolldown(const Arg *);
|
||||||
void kscrollup(const Arg *);
|
void kscrollup(const Arg *);
|
||||||
void externalpipe(const Arg *);
|
|
||||||
void printscreen(const Arg *);
|
void printscreen(const Arg *);
|
||||||
void printsel(const Arg *);
|
void printsel(const Arg *);
|
||||||
void sendbreak(const Arg *);
|
void sendbreak(const Arg *);
|
||||||
@@ -128,4 +127,3 @@ extern unsigned int tabspaces;
|
|||||||
extern unsigned int defaultfg;
|
extern unsigned int defaultfg;
|
||||||
extern unsigned int defaultbg;
|
extern unsigned int defaultbg;
|
||||||
extern unsigned int defaultcs;
|
extern unsigned int defaultcs;
|
||||||
extern float alpha;
|
|
||||||
|
|||||||
BIN
vim-example.png
BIN
vim-example.png
Binary file not shown.
|
Before Width: | Height: | Size: 118 KiB |
198
x.c
198
x.c
@@ -82,7 +82,6 @@ typedef XftGlyphFontSpec GlyphFontSpec;
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
int tw, th; /* tty width and height */
|
int tw, th; /* tty width and height */
|
||||||
int w, h; /* window width and height */
|
int w, h; /* window width and height */
|
||||||
int hborderpx, vborderpx;
|
|
||||||
int ch; /* char height */
|
int ch; /* char height */
|
||||||
int cw; /* char width */
|
int cw; /* char width */
|
||||||
int mode; /* window state/mode flags */
|
int mode; /* window state/mode flags */
|
||||||
@@ -107,7 +106,6 @@ typedef struct {
|
|||||||
XSetWindowAttributes attrs;
|
XSetWindowAttributes attrs;
|
||||||
int scr;
|
int scr;
|
||||||
int isfixed; /* is fixed geometry? */
|
int isfixed; /* is fixed geometry? */
|
||||||
int depth; /* bit depth */
|
|
||||||
int l, t; /* left and top offset */
|
int l, t; /* left and top offset */
|
||||||
int gm; /* geometry mask */
|
int gm; /* geometry mask */
|
||||||
} XWindow;
|
} XWindow;
|
||||||
@@ -161,8 +159,6 @@ static void xhints(void);
|
|||||||
static int xloadcolor(int, const char *, Color *);
|
static int xloadcolor(int, const char *, Color *);
|
||||||
static int xloadfont(Font *, FcPattern *);
|
static int xloadfont(Font *, FcPattern *);
|
||||||
static void xloadfonts(const char *, double);
|
static void xloadfonts(const char *, double);
|
||||||
static int xloadsparefont(FcPattern *, int);
|
|
||||||
static void xloadsparefonts(void);
|
|
||||||
static void xunloadfont(Font *);
|
static void xunloadfont(Font *);
|
||||||
static void xunloadfonts(void);
|
static void xunloadfonts(void);
|
||||||
static void xsetenv(void);
|
static void xsetenv(void);
|
||||||
@@ -249,7 +245,6 @@ static char *usedfont = NULL;
|
|||||||
static double usedfontsize = 0;
|
static double usedfontsize = 0;
|
||||||
static double defaultfontsize = 0;
|
static double defaultfontsize = 0;
|
||||||
|
|
||||||
static char *opt_alpha = NULL;
|
|
||||||
static char *opt_class = NULL;
|
static char *opt_class = NULL;
|
||||||
static char **opt_cmd = NULL;
|
static char **opt_cmd = NULL;
|
||||||
static char *opt_embed = NULL;
|
static char *opt_embed = NULL;
|
||||||
@@ -313,7 +308,6 @@ zoomabs(const Arg *arg)
|
|||||||
{
|
{
|
||||||
xunloadfonts();
|
xunloadfonts();
|
||||||
xloadfonts(usedfont, arg->f);
|
xloadfonts(usedfont, arg->f);
|
||||||
xloadsparefonts();
|
|
||||||
cresize(0, 0);
|
cresize(0, 0);
|
||||||
redraw();
|
redraw();
|
||||||
xhints();
|
xhints();
|
||||||
@@ -339,7 +333,7 @@ ttysend(const Arg *arg)
|
|||||||
int
|
int
|
||||||
evcol(XEvent *e)
|
evcol(XEvent *e)
|
||||||
{
|
{
|
||||||
int x = e->xbutton.x - win.hborderpx;
|
int x = e->xbutton.x - borderpx;
|
||||||
LIMIT(x, 0, win.tw - 1);
|
LIMIT(x, 0, win.tw - 1);
|
||||||
return x / win.cw;
|
return x / win.cw;
|
||||||
}
|
}
|
||||||
@@ -347,7 +341,7 @@ evcol(XEvent *e)
|
|||||||
int
|
int
|
||||||
evrow(XEvent *e)
|
evrow(XEvent *e)
|
||||||
{
|
{
|
||||||
int y = e->xbutton.y - win.vborderpx;
|
int y = e->xbutton.y - borderpx;
|
||||||
LIMIT(y, 0, win.th - 1);
|
LIMIT(y, 0, win.th - 1);
|
||||||
return y / win.ch;
|
return y / win.ch;
|
||||||
}
|
}
|
||||||
@@ -747,9 +741,6 @@ cresize(int width, int height)
|
|||||||
col = MAX(1, col);
|
col = MAX(1, col);
|
||||||
row = MAX(1, row);
|
row = MAX(1, row);
|
||||||
|
|
||||||
win.hborderpx = (win.w - col * win.cw) / 2;
|
|
||||||
win.vborderpx = (win.h - row * win.ch) / 2;
|
|
||||||
|
|
||||||
tresize(col, row);
|
tresize(col, row);
|
||||||
xresize(col, row);
|
xresize(col, row);
|
||||||
ttyresize(win.tw, win.th);
|
ttyresize(win.tw, win.th);
|
||||||
@@ -763,7 +754,7 @@ xresize(int col, int row)
|
|||||||
|
|
||||||
XFreePixmap(xw.dpy, xw.buf);
|
XFreePixmap(xw.dpy, xw.buf);
|
||||||
xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
|
xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
|
||||||
xw.depth);
|
DefaultDepth(xw.dpy, xw.scr));
|
||||||
XftDrawChange(xw.draw, xw.buf);
|
XftDrawChange(xw.draw, xw.buf);
|
||||||
xclear(0, 0, win.w, win.h);
|
xclear(0, 0, win.w, win.h);
|
||||||
|
|
||||||
@@ -823,13 +814,6 @@ xloadcols(void)
|
|||||||
else
|
else
|
||||||
die("could not allocate color %d\n", i);
|
die("could not allocate color %d\n", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set alpha value of bg color */
|
|
||||||
if (opt_alpha)
|
|
||||||
alpha = strtof(opt_alpha, NULL);
|
|
||||||
dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * alpha);
|
|
||||||
dc.col[defaultbg].pixel &= 0x00FFFFFF;
|
|
||||||
dc.col[defaultbg].pixel |= (unsigned char)(0xff * alpha) << 24;
|
|
||||||
loaded = 1;
|
loaded = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -887,8 +871,8 @@ xhints(void)
|
|||||||
sizeh->flags = PSize | PResizeInc | PBaseSize | PMinSize;
|
sizeh->flags = PSize | PResizeInc | PBaseSize | PMinSize;
|
||||||
sizeh->height = win.h;
|
sizeh->height = win.h;
|
||||||
sizeh->width = win.w;
|
sizeh->width = win.w;
|
||||||
sizeh->height_inc = 1;
|
sizeh->height_inc = win.ch;
|
||||||
sizeh->width_inc = 1;
|
sizeh->width_inc = win.cw;
|
||||||
sizeh->base_height = 2 * borderpx;
|
sizeh->base_height = 2 * borderpx;
|
||||||
sizeh->base_width = 2 * borderpx;
|
sizeh->base_width = 2 * borderpx;
|
||||||
sizeh->min_height = win.ch + 2 * borderpx;
|
sizeh->min_height = win.ch + 2 * borderpx;
|
||||||
@@ -1068,102 +1052,6 @@ xloadfonts(const char *fontstr, double fontsize)
|
|||||||
FcPatternDestroy(pattern);
|
FcPatternDestroy(pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
xloadsparefont(FcPattern *pattern, int flags)
|
|
||||||
{
|
|
||||||
FcPattern *match;
|
|
||||||
FcResult result;
|
|
||||||
|
|
||||||
match = FcFontMatch(NULL, pattern, &result);
|
|
||||||
if (!match) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(frc[frclen].font = XftFontOpenPattern(xw.dpy, match))) {
|
|
||||||
FcPatternDestroy(match);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
frc[frclen].flags = flags;
|
|
||||||
/* Believe U+0000 glyph will present in each default font */
|
|
||||||
frc[frclen].unicodep = 0;
|
|
||||||
frclen++;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
xloadsparefonts(void)
|
|
||||||
{
|
|
||||||
FcPattern *pattern;
|
|
||||||
double sizeshift, fontval;
|
|
||||||
int fc;
|
|
||||||
char **fp;
|
|
||||||
|
|
||||||
if (frclen != 0)
|
|
||||||
die("can't embed spare fonts. cache isn't empty");
|
|
||||||
|
|
||||||
/* Calculate count of spare fonts */
|
|
||||||
fc = sizeof(font2) / sizeof(*font2);
|
|
||||||
if (fc == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Allocate memory for cache entries. */
|
|
||||||
if (frccap < 4 * fc) {
|
|
||||||
frccap += 4 * fc - frccap;
|
|
||||||
frc = xrealloc(frc, frccap * sizeof(Fontcache));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (fp = font2; fp - font2 < fc; ++fp) {
|
|
||||||
|
|
||||||
if (**fp == '-')
|
|
||||||
pattern = XftXlfdParse(*fp, False, False);
|
|
||||||
else
|
|
||||||
pattern = FcNameParse((FcChar8 *)*fp);
|
|
||||||
|
|
||||||
if (!pattern)
|
|
||||||
die("can't open spare font %s\n", *fp);
|
|
||||||
|
|
||||||
if (defaultfontsize > 0) {
|
|
||||||
sizeshift = usedfontsize - defaultfontsize;
|
|
||||||
if (sizeshift != 0 &&
|
|
||||||
FcPatternGetDouble(pattern, FC_PIXEL_SIZE, 0, &fontval) ==
|
|
||||||
FcResultMatch) {
|
|
||||||
fontval += sizeshift;
|
|
||||||
FcPatternDel(pattern, FC_PIXEL_SIZE);
|
|
||||||
FcPatternDel(pattern, FC_SIZE);
|
|
||||||
FcPatternAddDouble(pattern, FC_PIXEL_SIZE, fontval);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FcPatternAddBool(pattern, FC_SCALABLE, 1);
|
|
||||||
|
|
||||||
FcConfigSubstitute(NULL, pattern, FcMatchPattern);
|
|
||||||
XftDefaultSubstitute(xw.dpy, xw.scr, pattern);
|
|
||||||
|
|
||||||
if (xloadsparefont(pattern, FRC_NORMAL))
|
|
||||||
die("can't open spare font %s\n", *fp);
|
|
||||||
|
|
||||||
FcPatternDel(pattern, FC_SLANT);
|
|
||||||
FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
|
|
||||||
if (xloadsparefont(pattern, FRC_ITALIC))
|
|
||||||
die("can't open spare font %s\n", *fp);
|
|
||||||
|
|
||||||
FcPatternDel(pattern, FC_WEIGHT);
|
|
||||||
FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD);
|
|
||||||
if (xloadsparefont(pattern, FRC_ITALICBOLD))
|
|
||||||
die("can't open spare font %s\n", *fp);
|
|
||||||
|
|
||||||
FcPatternDel(pattern, FC_SLANT);
|
|
||||||
FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN);
|
|
||||||
if (xloadsparefont(pattern, FRC_BOLD))
|
|
||||||
die("can't open spare font %s\n", *fp);
|
|
||||||
|
|
||||||
FcPatternDestroy(pattern);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
xunloadfont(Font *f)
|
xunloadfont(Font *f)
|
||||||
{
|
{
|
||||||
@@ -1251,23 +1139,11 @@ xinit(int cols, int rows)
|
|||||||
Window parent;
|
Window parent;
|
||||||
pid_t thispid = getpid();
|
pid_t thispid = getpid();
|
||||||
XColor xmousefg, xmousebg;
|
XColor xmousefg, xmousebg;
|
||||||
XWindowAttributes attr;
|
|
||||||
XVisualInfo vis;
|
|
||||||
|
|
||||||
if (!(xw.dpy = XOpenDisplay(NULL)))
|
if (!(xw.dpy = XOpenDisplay(NULL)))
|
||||||
die("can't open display\n");
|
die("can't open display\n");
|
||||||
xw.scr = XDefaultScreen(xw.dpy);
|
xw.scr = XDefaultScreen(xw.dpy);
|
||||||
|
xw.vis = XDefaultVisual(xw.dpy, xw.scr);
|
||||||
if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) {
|
|
||||||
parent = XRootWindow(xw.dpy, xw.scr);
|
|
||||||
xw.depth = 32;
|
|
||||||
} else {
|
|
||||||
XGetWindowAttributes(xw.dpy, parent, &attr);
|
|
||||||
xw.depth = attr.depth;
|
|
||||||
}
|
|
||||||
|
|
||||||
XMatchVisualInfo(xw.dpy, xw.scr, xw.depth, TrueColor, &vis);
|
|
||||||
xw.vis = vis.visual;
|
|
||||||
|
|
||||||
/* font */
|
/* font */
|
||||||
if (!FcInit())
|
if (!FcInit())
|
||||||
@@ -1276,16 +1152,13 @@ xinit(int cols, int rows)
|
|||||||
usedfont = (opt_font == NULL)? font : opt_font;
|
usedfont = (opt_font == NULL)? font : opt_font;
|
||||||
xloadfonts(usedfont, 0);
|
xloadfonts(usedfont, 0);
|
||||||
|
|
||||||
/* spare fonts */
|
|
||||||
xloadsparefonts();
|
|
||||||
|
|
||||||
/* colors */
|
/* colors */
|
||||||
xw.cmap = XCreateColormap(xw.dpy, parent, xw.vis, None);
|
xw.cmap = XDefaultColormap(xw.dpy, xw.scr);
|
||||||
xloadcols();
|
xloadcols();
|
||||||
|
|
||||||
/* adjust fixed window geometry */
|
/* adjust fixed window geometry */
|
||||||
win.w = 2 * win.hborderpx + 2 * borderpx + cols * win.cw;
|
win.w = 2 * borderpx + cols * win.cw;
|
||||||
win.h = 2 * win.vborderpx + 2 * borderpx + rows * win.ch;
|
win.h = 2 * borderpx + rows * win.ch;
|
||||||
if (xw.gm & XNegative)
|
if (xw.gm & XNegative)
|
||||||
xw.l += DisplayWidth(xw.dpy, xw.scr) - win.w - 2;
|
xw.l += DisplayWidth(xw.dpy, xw.scr) - win.w - 2;
|
||||||
if (xw.gm & YNegative)
|
if (xw.gm & YNegative)
|
||||||
@@ -1300,15 +1173,19 @@ xinit(int cols, int rows)
|
|||||||
| ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
|
| ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
|
||||||
xw.attrs.colormap = xw.cmap;
|
xw.attrs.colormap = xw.cmap;
|
||||||
|
|
||||||
|
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,
|
xw.win = XCreateWindow(xw.dpy, parent, xw.l, xw.t,
|
||||||
win.w, win.h, 0, xw.depth, InputOutput,
|
win.w, win.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput,
|
||||||
xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity
|
xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity
|
||||||
| CWEventMask | CWColormap, &xw.attrs);
|
| CWEventMask | CWColormap, &xw.attrs);
|
||||||
|
|
||||||
memset(&gcvalues, 0, sizeof(gcvalues));
|
memset(&gcvalues, 0, sizeof(gcvalues));
|
||||||
gcvalues.graphics_exposures = False;
|
gcvalues.graphics_exposures = False;
|
||||||
xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, xw.depth);
|
dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures,
|
||||||
dc.gc = XCreateGC(xw.dpy, xw.buf, GCGraphicsExposures, &gcvalues);
|
&gcvalues);
|
||||||
|
xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
|
||||||
|
DefaultDepth(xw.dpy, xw.scr));
|
||||||
XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel);
|
XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel);
|
||||||
XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h);
|
XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h);
|
||||||
|
|
||||||
@@ -1386,7 +1263,7 @@ xresetfontsettings(ushort mode, Font **font, int *frcflags)
|
|||||||
int
|
int
|
||||||
xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x, int y)
|
xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x, int y)
|
||||||
{
|
{
|
||||||
float winx = win.hborderpx + x * win.cw, winy = win.vborderpx + y * win.ch, xp, yp;
|
float winx = borderpx + x * win.cw, winy = borderpx + y * win.ch, xp, yp;
|
||||||
ushort mode, prevmode = USHRT_MAX;
|
ushort mode, prevmode = USHRT_MAX;
|
||||||
Font *font = &dc.font;
|
Font *font = &dc.font;
|
||||||
int frcflags = FRC_NORMAL;
|
int frcflags = FRC_NORMAL;
|
||||||
@@ -1549,7 +1426,7 @@ void
|
|||||||
xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, int y)
|
xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, int y)
|
||||||
{
|
{
|
||||||
int charlen = len * ((base.mode & ATTR_WIDE) ? 2 : 1);
|
int charlen = len * ((base.mode & ATTR_WIDE) ? 2 : 1);
|
||||||
int winx = win.hborderpx + x * win.cw, winy = win.vborderpx + y * win.ch,
|
int winx = borderpx + x * win.cw, winy = borderpx + y * win.ch,
|
||||||
width = charlen * win.cw;
|
width = charlen * win.cw;
|
||||||
Color *fg, *bg, *temp, revfg, revbg, truefg, truebg;
|
Color *fg, *bg, *temp, revfg, revbg, truefg, truebg;
|
||||||
XRenderColor colfg, colbg;
|
XRenderColor colfg, colbg;
|
||||||
@@ -1639,17 +1516,17 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
|
|||||||
|
|
||||||
/* Intelligent cleaning up of the borders. */
|
/* Intelligent cleaning up of the borders. */
|
||||||
if (x == 0) {
|
if (x == 0) {
|
||||||
xclear(0, (y == 0)? 0 : winy, win.hborderpx,
|
xclear(0, (y == 0)? 0 : winy, borderpx,
|
||||||
winy + win.ch +
|
winy + win.ch +
|
||||||
((winy + win.ch >= win.vborderpx + win.th)? win.h : 0));
|
((winy + win.ch >= borderpx + win.th)? win.h : 0));
|
||||||
}
|
}
|
||||||
if (winx + width >= win.hborderpx + win.tw) {
|
if (winx + width >= borderpx + win.tw) {
|
||||||
xclear(winx + width, (y == 0)? 0 : winy, win.w,
|
xclear(winx + width, (y == 0)? 0 : winy, win.w,
|
||||||
((winy + win.ch >= win.vborderpx + win.th)? win.h : (winy + win.ch)));
|
((winy + win.ch >= borderpx + win.th)? win.h : (winy + win.ch)));
|
||||||
}
|
}
|
||||||
if (y == 0)
|
if (y == 0)
|
||||||
xclear(winx, 0, winx + width, win.vborderpx);
|
xclear(winx, 0, winx + width, borderpx);
|
||||||
if (winy + win.ch >= win.vborderpx + win.th)
|
if (winy + win.ch >= borderpx + win.th)
|
||||||
xclear(winx, winy + win.ch, winx + width, win.h);
|
xclear(winx, winy + win.ch, winx + width, win.h);
|
||||||
|
|
||||||
/* Clean up the region we want to draw to. */
|
/* Clean up the region we want to draw to. */
|
||||||
@@ -1746,35 +1623,35 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og, Line line, int le
|
|||||||
case 3: /* Blinking Underline */
|
case 3: /* Blinking Underline */
|
||||||
case 4: /* Steady Underline */
|
case 4: /* Steady Underline */
|
||||||
XftDrawRect(xw.draw, &drawcol,
|
XftDrawRect(xw.draw, &drawcol,
|
||||||
win.hborderpx + cx * win.cw,
|
borderpx + cx * win.cw,
|
||||||
win.vborderpx + (cy + 1) * win.ch - \
|
borderpx + (cy + 1) * win.ch - \
|
||||||
cursorthickness,
|
cursorthickness,
|
||||||
win.cw, cursorthickness);
|
win.cw, cursorthickness);
|
||||||
break;
|
break;
|
||||||
case 5: /* Blinking bar */
|
case 5: /* Blinking bar */
|
||||||
case 6: /* Steady bar */
|
case 6: /* Steady bar */
|
||||||
XftDrawRect(xw.draw, &drawcol,
|
XftDrawRect(xw.draw, &drawcol,
|
||||||
win.hborderpx + cx * win.cw,
|
borderpx + cx * win.cw,
|
||||||
win.vborderpx + cy * win.ch,
|
borderpx + cy * win.ch,
|
||||||
cursorthickness, win.ch);
|
cursorthickness, win.ch);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
XftDrawRect(xw.draw, &drawcol,
|
XftDrawRect(xw.draw, &drawcol,
|
||||||
win.hborderpx + cx * win.cw,
|
borderpx + cx * win.cw,
|
||||||
win.vborderpx + cy * win.ch,
|
borderpx + cy * win.ch,
|
||||||
win.cw - 1, 1);
|
win.cw - 1, 1);
|
||||||
XftDrawRect(xw.draw, &drawcol,
|
XftDrawRect(xw.draw, &drawcol,
|
||||||
win.hborderpx + cx * win.cw,
|
borderpx + cx * win.cw,
|
||||||
win.vborderpx + cy * win.ch,
|
borderpx + cy * win.ch,
|
||||||
1, win.ch - 1);
|
1, win.ch - 1);
|
||||||
XftDrawRect(xw.draw, &drawcol,
|
XftDrawRect(xw.draw, &drawcol,
|
||||||
win.hborderpx + (cx + 1) * win.cw - 1,
|
borderpx + (cx + 1) * win.cw - 1,
|
||||||
win.vborderpx + cy * win.ch,
|
borderpx + cy * win.ch,
|
||||||
1, win.ch - 1);
|
1, win.ch - 1);
|
||||||
XftDrawRect(xw.draw, &drawcol,
|
XftDrawRect(xw.draw, &drawcol,
|
||||||
win.hborderpx + cx * win.cw,
|
borderpx + cx * win.cw,
|
||||||
win.vborderpx + (cy + 1) * win.ch - 1,
|
borderpx + (cy + 1) * win.ch - 1,
|
||||||
win.cw, 1);
|
win.cw, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2212,9 +2089,6 @@ main(int argc, char *argv[])
|
|||||||
case 'a':
|
case 'a':
|
||||||
allowaltscreen = 0;
|
allowaltscreen = 0;
|
||||||
break;
|
break;
|
||||||
case 'A':
|
|
||||||
opt_alpha = EARGF(usage());
|
|
||||||
break;
|
|
||||||
case 'c':
|
case 'c':
|
||||||
opt_class = EARGF(usage());
|
opt_class = EARGF(usage());
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user