mirror of
https://github.com/mintycube/st.git
synced 2024-10-22 14:05:49 +02:00
Adding the anygeometry patch ref. #137
This commit is contained in:
parent
aa5957495d
commit
8aee31444a
@ -15,6 +15,8 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the
|
|||||||
|
|
||||||
### Changelog:
|
### Changelog:
|
||||||
|
|
||||||
|
2024-05-31 - Added the anygeometry patch
|
||||||
|
|
||||||
2024-03-13 - Added the reflow patch and upgraded the netwmicon patch
|
2024-03-13 - Added the reflow patch and upgraded the netwmicon patch
|
||||||
|
|
||||||
2024-03-07 - Improved sixel support, removed VIM browse patch
|
2024-03-07 - Improved sixel support, removed VIM browse patch
|
||||||
@ -102,6 +104,10 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the
|
|||||||
- allows the user to specify two distinct opacity values or background colors in order to
|
- allows the user to specify two distinct opacity values or background colors in order to
|
||||||
easily differentiate between focused and unfocused terminal windows
|
easily differentiate between focused and unfocused terminal windows
|
||||||
|
|
||||||
|
- [anygeometry](https://st.suckless.org/patches/anygeometry/)
|
||||||
|
- allows st to start at any pixel size using the \-G command line option (if floating)
|
||||||
|
- can be combined with the anysize patch to resize to any pixel size
|
||||||
|
|
||||||
- [anysize](https://st.suckless.org/patches/anysize/)
|
- [anysize](https://st.suckless.org/patches/anysize/)
|
||||||
- allows st to reize to any pixel size rather than snapping to character width / height
|
- allows st to reize to any pixel size rather than snapping to character width / height
|
||||||
|
|
||||||
|
10
config.def.h
10
config.def.h
@ -267,6 +267,16 @@ static unsigned int cursorshape = 2;
|
|||||||
static unsigned int cols = 80;
|
static unsigned int cols = 80;
|
||||||
static unsigned int rows = 24;
|
static unsigned int rows = 24;
|
||||||
|
|
||||||
|
#if ANYGEOMETRY_PATCH
|
||||||
|
/*
|
||||||
|
* Whether to use pixel geometry or cell geometry
|
||||||
|
*/
|
||||||
|
|
||||||
|
static Geometry geometry = CellGeometry; // or PixelGeometry to use the below size
|
||||||
|
static unsigned int width = 564;
|
||||||
|
static unsigned int height = 364;
|
||||||
|
#endif // ANYGEOMETRY_PATCH
|
||||||
|
|
||||||
#if THEMED_CURSOR_PATCH
|
#if THEMED_CURSOR_PATCH
|
||||||
/*
|
/*
|
||||||
* Default shape of the mouse cursor
|
* Default shape of the mouse cursor
|
||||||
|
@ -29,6 +29,13 @@
|
|||||||
*/
|
*/
|
||||||
#define ALPHA_GRADIENT_PATCH 0
|
#define ALPHA_GRADIENT_PATCH 0
|
||||||
|
|
||||||
|
/* Allows for the initial size of the terminal to be specified as pixel width and height
|
||||||
|
* using the -G command line option. Can be combined with the anysize patch to also allow
|
||||||
|
* the window to be resized to any pixel size.
|
||||||
|
* https://st.suckless.org/patches/anygeometry/
|
||||||
|
*/
|
||||||
|
#define ANYGEOMETRY_PATCH 0
|
||||||
|
|
||||||
/* This patch allows st to resize to any pixel size rather than snapping to character width/height.
|
/* This patch allows st to resize to any pixel size rather than snapping to character width/height.
|
||||||
* https://st.suckless.org/patches/anysize/
|
* https://st.suckless.org/patches/anysize/
|
||||||
*/
|
*/
|
||||||
|
52
x.c
52
x.c
@ -42,6 +42,13 @@ enum undercurl_slope_type {
|
|||||||
};
|
};
|
||||||
#endif // UNDERCURL_PATCH
|
#endif // UNDERCURL_PATCH
|
||||||
|
|
||||||
|
#if ANYGEOMETRY_PATCH
|
||||||
|
typedef enum {
|
||||||
|
PixelGeometry,
|
||||||
|
CellGeometry
|
||||||
|
} Geometry;
|
||||||
|
#endif // ANYGEOMETRY_PATCH
|
||||||
|
|
||||||
/* X modifiers */
|
/* X modifiers */
|
||||||
#define XK_ANY_MOD UINT_MAX
|
#define XK_ANY_MOD UINT_MAX
|
||||||
#define XK_NO_MOD 0
|
#define XK_NO_MOD 0
|
||||||
@ -1468,13 +1475,31 @@ xinit(int cols, int rows)
|
|||||||
xloadcols();
|
xloadcols();
|
||||||
|
|
||||||
/* adjust fixed window geometry */
|
/* adjust fixed window geometry */
|
||||||
|
#if ANYGEOMETRY_PATCH
|
||||||
|
switch (geometry) {
|
||||||
|
case CellGeometry:
|
||||||
#if ANYSIZE_PATCH
|
#if ANYSIZE_PATCH
|
||||||
win.w = 2 * win.hborderpx + cols * win.cw;
|
win.w = 2 * win.hborderpx + cols * win.cw;
|
||||||
win.h = 2 * win.vborderpx + rows * win.ch;
|
win.h = 2 * win.vborderpx + rows * win.ch;
|
||||||
#else
|
#else
|
||||||
win.w = 2 * borderpx + cols * win.cw;
|
win.w = 2 * borderpx + cols * win.cw;
|
||||||
win.h = 2 * borderpx + rows * win.ch;
|
win.h = 2 * borderpx + rows * win.ch;
|
||||||
#endif // ANYSIZE_PATCH
|
#endif // ANYGEOMETRY_PATCH | ANYSIZE_PATCH
|
||||||
|
break;
|
||||||
|
case PixelGeometry:
|
||||||
|
win.w = cols;
|
||||||
|
win.h = rows;
|
||||||
|
cols = (win.w - 2 * borderpx) / win.cw;
|
||||||
|
rows = (win.h - 2 * borderpx) / win.ch;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#elif ANYSIZE_PATCH
|
||||||
|
win.w = 2 * win.hborderpx + cols * win.cw;
|
||||||
|
win.h = 2 * win.vborderpx + rows * win.ch;
|
||||||
|
#else
|
||||||
|
win.w = 2 * borderpx + cols * win.cw;
|
||||||
|
win.h = 2 * borderpx + rows * win.ch;
|
||||||
|
#endif // ANYGEOMETRY_PATCH | ANYSIZE_PATCH
|
||||||
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)
|
||||||
@ -3863,7 +3888,17 @@ main(int argc, char *argv[])
|
|||||||
case 'g':
|
case 'g':
|
||||||
xw.gm = XParseGeometry(EARGF(usage()),
|
xw.gm = XParseGeometry(EARGF(usage()),
|
||||||
&xw.l, &xw.t, &cols, &rows);
|
&xw.l, &xw.t, &cols, &rows);
|
||||||
|
#if ANYGEOMETRY_PATCH
|
||||||
|
geometry = CellGeometry;
|
||||||
|
#endif // ANYGEOMETRY_PATCH
|
||||||
break;
|
break;
|
||||||
|
#if ANYGEOMETRY_PATCH
|
||||||
|
case 'G':
|
||||||
|
xw.gm = XParseGeometry(EARGF(usage()),
|
||||||
|
&xw.l, &xw.t, &width, &height);
|
||||||
|
geometry = PixelGeometry;
|
||||||
|
break;
|
||||||
|
#endif // ANYGEOMETRY_PATCH
|
||||||
case 'i':
|
case 'i':
|
||||||
xw.isfixed = 1;
|
xw.isfixed = 1;
|
||||||
break;
|
break;
|
||||||
@ -3912,13 +3947,28 @@ run:
|
|||||||
hbcreatebuffer();
|
hbcreatebuffer();
|
||||||
#endif // LIGATURES_PATCH
|
#endif // LIGATURES_PATCH
|
||||||
|
|
||||||
|
#if ANYGEOMETRY_PATCH
|
||||||
|
switch (geometry) {
|
||||||
|
case CellGeometry:
|
||||||
|
xinit(cols, rows);
|
||||||
|
break;
|
||||||
|
case PixelGeometry:
|
||||||
|
xinit(width, height);
|
||||||
|
cols = (win.w - 2 * borderpx) / win.cw;
|
||||||
|
rows = (win.h - 2 * borderpx) / win.ch;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif // ANYGEOMETRY_PATCH
|
||||||
|
|
||||||
cols = MAX(cols, 1);
|
cols = MAX(cols, 1);
|
||||||
rows = MAX(rows, 1);
|
rows = MAX(rows, 1);
|
||||||
#if ALPHA_PATCH && ALPHA_FOCUS_HIGHLIGHT_PATCH
|
#if ALPHA_PATCH && ALPHA_FOCUS_HIGHLIGHT_PATCH
|
||||||
defaultbg = MAX(LEN(colorname), 256);
|
defaultbg = MAX(LEN(colorname), 256);
|
||||||
#endif // ALPHA_FOCUS_HIGHLIGHT_PATCH
|
#endif // ALPHA_FOCUS_HIGHLIGHT_PATCH
|
||||||
tnew(cols, rows);
|
tnew(cols, rows);
|
||||||
|
#if !ANYGEOMETRY_PATCH
|
||||||
xinit(cols, rows);
|
xinit(cols, rows);
|
||||||
|
#endif // ANYGEOMETRY_PATCH
|
||||||
#if BACKGROUND_IMAGE_PATCH
|
#if BACKGROUND_IMAGE_PATCH
|
||||||
bginit();
|
bginit();
|
||||||
#endif // BACKGROUND_IMAGE_PATCH
|
#endif // BACKGROUND_IMAGE_PATCH
|
||||||
|
Loading…
Reference in New Issue
Block a user