Compare commits
11 Commits
532d5a28f5
...
b48198caf0
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b48198caf0 | ||
![]() |
3f15c7b6c2 | ||
![]() |
3277b150ad | ||
![]() |
8cb091da1b | ||
![]() |
65b7758f4f | ||
![]() |
26b9546481 | ||
![]() |
374e2fafdd | ||
![]() |
2199b4d94d | ||
![]() |
6f9a3fc06e | ||
![]() |
d0db839278 | ||
![]() |
20220575bd |
10
Makefile
10
Makefile
@ -24,12 +24,12 @@ st: $(OBJ)
|
|||||||
$(CC) -o $@ $(OBJ) $(STLDFLAGS)
|
$(CC) -o $@ $(OBJ) $(STLDFLAGS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f st $(OBJ) st-$(VERSION).tar.gz
|
rm -f st $(OBJ) st-$(VERSION).tar.gz config.h
|
||||||
|
|
||||||
dist: clean
|
dist: clean
|
||||||
mkdir -p st-$(VERSION)
|
mkdir -p st-$(VERSION)
|
||||||
cp -R FAQ LEGACY TODO LICENSE Makefile README config.mk\
|
cp -R FAQ LEGACY TODO LICENSE Makefile README config.mk\
|
||||||
config.def.h st.info st.1 arg.h st.h win.h $(SRC)\
|
config.def.h show_stuff.sh st_show_stuff.sh st.info st.1 arg.h st.h win.h $(SRC)\
|
||||||
st-$(VERSION)
|
st-$(VERSION)
|
||||||
tar -cf - st-$(VERSION) | gzip > st-$(VERSION).tar.gz
|
tar -cf - st-$(VERSION) | gzip > st-$(VERSION).tar.gz
|
||||||
rm -rf st-$(VERSION)
|
rm -rf st-$(VERSION)
|
||||||
@ -37,7 +37,11 @@ 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 show_stuff.sh $(DESTDIR)$(PREFIX)/bin
|
||||||
|
cp -f st_show_stuff.sh $(DESTDIR)$(PREFIX)/bin
|
||||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/st
|
chmod 755 $(DESTDIR)$(PREFIX)/bin/st
|
||||||
|
chmod 755 $(DESTDIR)$(PREFIX)/bin/show_stuff.sh
|
||||||
|
chmod 755 $(DESTDIR)$(PREFIX)/bin/st_show_stuff.sh
|
||||||
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
|
||||||
@ -46,6 +50,8 @@ install: st
|
|||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f $(DESTDIR)$(PREFIX)/bin/st
|
rm -f $(DESTDIR)$(PREFIX)/bin/st
|
||||||
|
rm -f $(DESTDIR)$(PREFIX)/bin/show_stuff.sh
|
||||||
|
rm -f $(DESTDIR)$(PREFIX)/bin/st_show_stuff.sh
|
||||||
rm -f $(DESTDIR)$(MANPREFIX)/man1/st.1
|
rm -f $(DESTDIR)$(MANPREFIX)/man1/st.1
|
||||||
|
|
||||||
.PHONY: all clean dist install uninstall
|
.PHONY: all clean dist install uninstall
|
||||||
|
18
config.def.h
18
config.def.h
@ -5,7 +5,13 @@
|
|||||||
*
|
*
|
||||||
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
|
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
|
||||||
*/
|
*/
|
||||||
static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
|
static char *font = "Liberation Mono:pixelsize=16:antialias=true:autohint=true";
|
||||||
|
/* Spare fonts */
|
||||||
|
static char *font2[] = {
|
||||||
|
// "Inconsolata for Powerline:pixelsize=14:antialias=true:autohint=true",
|
||||||
|
// "Hack Nerd Font Mono:pixelsize=11:antialias=true:autohint=true",
|
||||||
|
};
|
||||||
|
|
||||||
static int borderpx = 2;
|
static int borderpx = 2;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -93,6 +99,9 @@ char *termname = "st-256color";
|
|||||||
*/
|
*/
|
||||||
unsigned int tabspaces = 8;
|
unsigned int tabspaces = 8;
|
||||||
|
|
||||||
|
/* bg opacity */
|
||||||
|
float alpha = 0.8;
|
||||||
|
|
||||||
/* 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 */
|
||||||
@ -201,6 +210,8 @@ static Shortcut shortcuts[] = {
|
|||||||
{ TERMMOD, XK_Y, selpaste, {.i = 0} },
|
{ TERMMOD, XK_Y, selpaste, {.i = 0} },
|
||||||
{ ShiftMask, XK_Insert, selpaste, {.i = 0} },
|
{ ShiftMask, XK_Insert, selpaste, {.i = 0} },
|
||||||
{ TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
|
{ TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
|
||||||
|
{ XK_NO_MOD, XK_F11, fullscreen, {.i = 0} },
|
||||||
|
{ MODKEY, XK_Return, fullscreen, {.i = 0} },
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -228,7 +239,7 @@ static Shortcut shortcuts[] = {
|
|||||||
* If you want keys other than the X11 function keys (0xFD00 - 0xFFFF)
|
* If you want keys other than the X11 function keys (0xFD00 - 0xFFFF)
|
||||||
* to be mapped below, add them to this array.
|
* to be mapped below, add them to this array.
|
||||||
*/
|
*/
|
||||||
static KeySym mappedkeys[] = { -1 };
|
static KeySym mappedkeys[] = {';', -1 };
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* State bits to ignore when matching key or button events. By default,
|
* State bits to ignore when matching key or button events. By default,
|
||||||
@ -451,6 +462,9 @@ static Key key[] = {
|
|||||||
{ XK_F33, XK_NO_MOD, "\033[20;5~", 0, 0},
|
{ XK_F33, XK_NO_MOD, "\033[20;5~", 0, 0},
|
||||||
{ XK_F34, XK_NO_MOD, "\033[21;5~", 0, 0},
|
{ XK_F34, XK_NO_MOD, "\033[21;5~", 0, 0},
|
||||||
{ XK_F35, XK_NO_MOD, "\033[23;5~", 0, 0},
|
{ XK_F35, XK_NO_MOD, "\033[23;5~", 0, 0},
|
||||||
|
// My custom keybindings
|
||||||
|
{ XK_semicolon, ControlMask, "\033[69;50S", 0, 0},
|
||||||
|
{ XK_semicolon, Mod1Mask, "\033[69;2S", 0, 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -16,7 +16,7 @@ PKG_CONFIG = pkg-config
|
|||||||
INCS = -I$(X11INC) \
|
INCS = -I$(X11INC) \
|
||||||
`$(PKG_CONFIG) --cflags fontconfig` \
|
`$(PKG_CONFIG) --cflags fontconfig` \
|
||||||
`$(PKG_CONFIG) --cflags freetype2`
|
`$(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 fontconfig` \
|
||||||
`$(PKG_CONFIG) --libs freetype2`
|
`$(PKG_CONFIG) --libs freetype2`
|
||||||
|
|
||||||
|
8
show_stuff.sh
Executable file
8
show_stuff.sh
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
trap 'stty sane; exit' INT TERM
|
||||||
|
eval "$@"
|
||||||
|
stty_orig="$(stty -g)"
|
||||||
|
stty -echo raw
|
||||||
|
dd bs=1 count=1 1>/dev/null 2>/dev/null
|
||||||
|
stty $stty_orig
|
||||||
|
|
2
st.h
2
st.h
@ -81,6 +81,7 @@ void die(const char *, ...);
|
|||||||
void redraw(void);
|
void redraw(void);
|
||||||
void draw(void);
|
void draw(void);
|
||||||
|
|
||||||
|
void fullscreen(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 *);
|
||||||
@ -124,3 +125,4 @@ 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;
|
||||||
|
3
st_show_stuff.sh
Normal file
3
st_show_stuff.sh
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
st -e show_stuff.sh "$@"
|
||||||
|
|
189
x.c
189
x.c
@ -94,6 +94,7 @@ typedef struct {
|
|||||||
Drawable buf;
|
Drawable buf;
|
||||||
GlyphFontSpec *specbuf; /* font spec buffer used for rendering */
|
GlyphFontSpec *specbuf; /* font spec buffer used for rendering */
|
||||||
Atom xembed, wmdeletewin, netwmname, netwmiconname, netwmpid;
|
Atom xembed, wmdeletewin, netwmname, netwmiconname, netwmpid;
|
||||||
|
Atom netwmstate, netwmfullscreen;
|
||||||
struct {
|
struct {
|
||||||
XIM xim;
|
XIM xim;
|
||||||
XIC xic;
|
XIC xic;
|
||||||
@ -105,6 +106,7 @@ 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;
|
||||||
@ -157,6 +159,8 @@ 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);
|
||||||
@ -243,6 +247,7 @@ 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;
|
||||||
@ -306,6 +311,7 @@ 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();
|
||||||
@ -752,7 +758,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,
|
||||||
DefaultDepth(xw.dpy, xw.scr));
|
xw.depth);
|
||||||
XftDrawChange(xw.draw, xw.buf);
|
XftDrawChange(xw.draw, xw.buf);
|
||||||
xclear(0, 0, win.w, win.h);
|
xclear(0, 0, win.w, win.h);
|
||||||
|
|
||||||
@ -760,6 +766,24 @@ xresize(int col, int row)
|
|||||||
xw.specbuf = xrealloc(xw.specbuf, col * sizeof(GlyphFontSpec));
|
xw.specbuf = xrealloc(xw.specbuf, col * sizeof(GlyphFontSpec));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
fullscreen(const Arg *arg)
|
||||||
|
{
|
||||||
|
XEvent ev;
|
||||||
|
|
||||||
|
memset(&ev, 0, sizeof(ev));
|
||||||
|
|
||||||
|
ev.xclient.type = ClientMessage;
|
||||||
|
ev.xclient.message_type = xw.netwmstate;
|
||||||
|
ev.xclient.display = xw.dpy;
|
||||||
|
ev.xclient.window = xw.win;
|
||||||
|
ev.xclient.format = 32;
|
||||||
|
ev.xclient.data.l[0] = 2; /* _NET_WM_STATE_TOGGLE */
|
||||||
|
ev.xclient.data.l[1] = xw.netwmfullscreen;
|
||||||
|
|
||||||
|
XSendEvent(xw.dpy, DefaultRootWindow(xw.dpy), False, SubstructureNotifyMask|SubstructureRedirectMask, &ev);
|
||||||
|
}
|
||||||
|
|
||||||
ushort
|
ushort
|
||||||
sixd_to_16bit(int x)
|
sixd_to_16bit(int x)
|
||||||
{
|
{
|
||||||
@ -812,6 +836,13 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -869,8 +900,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 = win.ch;
|
sizeh->height_inc = 1;
|
||||||
sizeh->width_inc = win.cw;
|
sizeh->width_inc = 1;
|
||||||
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;
|
||||||
@ -1050,6 +1081,101 @@ 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)
|
||||||
{
|
{
|
||||||
@ -1134,11 +1260,23 @@ xinit(int cols, int rows)
|
|||||||
Window parent, root;
|
Window parent, root;
|
||||||
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())
|
||||||
@ -1147,8 +1285,11 @@ 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 = XDefaultColormap(xw.dpy, xw.scr);
|
xw.cmap = XCreateColormap(xw.dpy, parent, xw.vis, None);
|
||||||
xloadcols();
|
xloadcols();
|
||||||
|
|
||||||
/* adjust fixed window geometry */
|
/* adjust fixed window geometry */
|
||||||
@ -1168,22 +1309,28 @@ xinit(int cols, int rows)
|
|||||||
| ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
|
| ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
|
||||||
xw.attrs.colormap = xw.cmap;
|
xw.attrs.colormap = xw.cmap;
|
||||||
|
|
||||||
root = XRootWindow(xw.dpy, xw.scr);
|
// There was merging conflict
|
||||||
if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0))))
|
/* Determine the root and parent (embedding support) */
|
||||||
parent = root;
|
root = XRootWindow(xw.dpy, xw.scr);
|
||||||
xw.win = XCreateWindow(xw.dpy, root, xw.l, xw.t,
|
if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0))))
|
||||||
win.w, win.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput,
|
parent = root;
|
||||||
xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity
|
|
||||||
| CWEventMask | CWColormap, &xw.attrs);
|
/* Create the window using the chosen depth (from with-alpha) */
|
||||||
if (parent != root)
|
xw.win = XCreateWindow(xw.dpy, parent, xw.l, xw.t,
|
||||||
XReparentWindow(xw.dpy, xw.win, parent, xw.l, xw.t);
|
win.w, win.h, 0, xw.depth, InputOutput,
|
||||||
|
xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity
|
||||||
|
| CWEventMask | CWColormap, &xw.attrs);
|
||||||
|
if (parent != root)
|
||||||
|
XReparentWindow(xw.dpy, xw.win, parent, xw.l, xw.t);
|
||||||
|
|
||||||
|
|
||||||
memset(&gcvalues, 0, sizeof(gcvalues));
|
memset(&gcvalues, 0, sizeof(gcvalues));
|
||||||
gcvalues.graphics_exposures = False;
|
gcvalues.graphics_exposures = False;
|
||||||
dc.gc = XCreateGC(xw.dpy, xw.win, GCGraphicsExposures,
|
|
||||||
&gcvalues);
|
// There was merging conflict
|
||||||
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));
|
dc.gc = XCreateGC(xw.dpy, xw.buf, GCGraphicsExposures, &gcvalues);
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
@ -1227,6 +1374,9 @@ xinit(int cols, int rows)
|
|||||||
XChangeProperty(xw.dpy, xw.win, xw.netwmpid, XA_CARDINAL, 32,
|
XChangeProperty(xw.dpy, xw.win, xw.netwmpid, XA_CARDINAL, 32,
|
||||||
PropModeReplace, (uchar *)&thispid, 1);
|
PropModeReplace, (uchar *)&thispid, 1);
|
||||||
|
|
||||||
|
xw.netwmstate = XInternAtom(xw.dpy, "_NET_WM_STATE", False);
|
||||||
|
xw.netwmfullscreen = XInternAtom(xw.dpy, "_NET_WM_STATE_FULLSCREEN", False);
|
||||||
|
|
||||||
win.mode = MODE_NUMLOCK;
|
win.mode = MODE_NUMLOCK;
|
||||||
resettitle();
|
resettitle();
|
||||||
xhints();
|
xhints();
|
||||||
@ -2047,6 +2197,9 @@ 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;
|
||||||
|
Loading…
Reference in New Issue
Block a user