Xinqi Bao's Git
projects
/
st.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
Tmux wants this to be mutually exclusive.
[st.git]
/
st.c
diff --git
a/st.c
b/st.c
index
38cec50
..
8206001
100644
(file)
--- a/
st.c
+++ b/
st.c
@@
-807,7
+807,6
@@
void selclear(XEvent *e) {
void
selrequest(XEvent *e) {
void
selrequest(XEvent *e) {
- fprintf(stderr, "selrequest\n");
XSelectionRequestEvent *xsre;
XSelectionEvent xev;
Atom xa_targets, string;
XSelectionRequestEvent *xsre;
XSelectionEvent xev;
Atom xa_targets, string;
@@
-843,7
+842,6
@@
selrequest(XEvent *e) {
void
xsetsel(char *str) {
void
xsetsel(char *str) {
- fprintf(stderr, "xsetsel: %s\n", str);
/* register the selection for both the clipboard and the primary */
Atom clipboard;
/* register the selection for both the clipboard and the primary */
Atom clipboard;
@@
-1421,7
+1419,8
@@
tsetattr(int *attr, int l) {
case 4:
term.c.attr.mode |= ATTR_UNDERLINE;
break;
case 4:
term.c.attr.mode |= ATTR_UNDERLINE;
break;
- case 5:
+ case 5: /* slow blink */
+ case 6: /* rapid blink */
term.c.attr.mode |= ATTR_BLINK;
break;
case 7:
term.c.attr.mode |= ATTR_BLINK;
break;
case 7:
@@
-1438,6
+1437,7
@@
tsetattr(int *attr, int l) {
term.c.attr.mode &= ~ATTR_UNDERLINE;
break;
case 25:
term.c.attr.mode &= ~ATTR_UNDERLINE;
break;
case 25:
+ case 26:
term.c.attr.mode &= ~ATTR_BLINK;
break;
case 27:
term.c.attr.mode &= ~ATTR_BLINK;
break;
case 27:
@@
-1557,9
+1557,11
@@
tsetmode(bool priv, bool set, int *args, int narg) {
break;
case 1000: /* 1000,1002: enable xterm mouse report */
MODBIT(term.mode, set, MODE_MOUSEBTN);
break;
case 1000: /* 1000,1002: enable xterm mouse report */
MODBIT(term.mode, set, MODE_MOUSEBTN);
+ MODBIT(term.mode, 0, MODE_MOUSEMOTION);
break;
case 1002:
MODBIT(term.mode, set, MODE_MOUSEMOTION);
break;
case 1002:
MODBIT(term.mode, set, MODE_MOUSEMOTION);
+ MODBIT(term.mode, 0, MODE_MOUSEBTN);
break;
case 1006:
MODBIT(term.mode, set, MODE_MOUSESGR);
break;
case 1006:
MODBIT(term.mode, set, MODE_MOUSESGR);
@@
-1743,8
+1745,8
@@
csihandle(void) {
break;
case 'X': /* ECH -- Erase <n> char */
DEFAULT(csiescseq.arg[0], 1);
break;
case 'X': /* ECH -- Erase <n> char */
DEFAULT(csiescseq.arg[0], 1);
- tclearregion(term.c.x, term.c.y,
term.c.x + csiescseq.arg[0],
- term.c.
y, 0
);
+ tclearregion(term.c.x, term.c.y,
+ term.c.
x + csiescseq.arg[0] - 1, term.c.y, 1
);
break;
case 'P': /* DCH -- Delete <n> char */
DEFAULT(csiescseq.arg[0], 1);
break;
case 'P': /* DCH -- Delete <n> char */
DEFAULT(csiescseq.arg[0], 1);
@@
-2206,9
+2208,11
@@
tresize(int col, int row) {
/* free unneeded rows */
i = 0;
if(slide > 0) {
/* free unneeded rows */
i = 0;
if(slide > 0) {
- /* slide screen to keep cursor where we expect it -
+ /*
+ * slide screen to keep cursor where we expect it -
* tscrollup would work here, but we can optimize to
* tscrollup would work here, but we can optimize to
- * memmove because we're freeing the earlier lines */
+ * memmove because we're freeing the earlier lines
+ */
for(/* i = 0 */; i < slide; i++) {
free(term.line[i]);
free(term.alt[i]);
for(/* i = 0 */; i < slide; i++) {
free(term.line[i]);
free(term.alt[i]);
@@
-2273,7
+2277,7
@@
xresize(int col, int row) {
XFreePixmap(xw.dpy, xw.buf);
xw.buf = XCreatePixmap(xw.dpy, xw.win, xw.w, xw.h,
DefaultDepth(xw.dpy, xw.scr));
XFreePixmap(xw.dpy, xw.buf);
xw.buf = XCreatePixmap(xw.dpy, xw.win, xw.w, xw.h,
DefaultDepth(xw.dpy, xw.scr));
- XSetForeground(xw.dpy, dc.gc,
0
);
+ XSetForeground(xw.dpy, dc.gc,
dc.col[IS_SET(MODE_REVERSE) ? defaultfg : defaultbg].pixel
);
XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, xw.w, xw.h);
}
XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, xw.w, xw.h);
}
@@
-2438,7
+2442,9
@@
xloadfonts(char *fontstr, int fontsize) {
xw.cw = dc.font.width;
xw.ch = dc.font.height;
xw.cw = dc.font.width;
xw.ch = dc.font.height;
+ FcPatternDel(pattern, FC_SLANT);
FcPatternDel(pattern, FC_WEIGHT);
FcPatternDel(pattern, FC_WEIGHT);
+ FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN);
FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD);
if(xloadfont(&dc.bfont, pattern))
die("st: can't open font %s\n", fontstr);
FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD);
if(xloadfont(&dc.bfont, pattern))
die("st: can't open font %s\n", fontstr);
@@
-2449,6
+2455,7
@@
xloadfonts(char *fontstr, int fontsize) {
die("st: can't open font %s\n", fontstr);
FcPatternDel(pattern, FC_WEIGHT);
die("st: can't open font %s\n", fontstr);
FcPatternDel(pattern, FC_WEIGHT);
+ FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_MEDIUM);
if(xloadfont(&dc.ifont, pattern))
die("st: can't open font %s\n", fontstr);
if(xloadfont(&dc.ifont, pattern))
die("st: can't open font %s\n", fontstr);
@@
-2456,8
+2463,7
@@
xloadfonts(char *fontstr, int fontsize) {
}
void
}
void
-xunloadfonts(void)
-{
+xunloadfonts(void) {
int i, ip;
/*
int i, ip;
/*
@@
-2487,8
+2493,7
@@
xunloadfonts(void)
}
void
}
void
-xzoom(const Arg *arg)
-{
+xzoom(const Arg *arg) {
xunloadfonts();
xloadfonts(usedfont, usedfontsize + arg->i);
cresize(0, 0);
xunloadfonts();
xloadfonts(usedfont, usedfontsize + arg->i);
cresize(0, 0);
@@
-2570,7
+2575,7
@@
xinit(void) {
&gcvalues);
xw.buf = XCreatePixmap(xw.dpy, xw.win, xw.w, xw.h,
DefaultDepth(xw.dpy, xw.scr));
&gcvalues);
xw.buf = XCreatePixmap(xw.dpy, xw.win, xw.w, xw.h,
DefaultDepth(xw.dpy, xw.scr));
- XSetForeground(xw.dpy, dc.gc,
0
);
+ XSetForeground(xw.dpy, dc.gc,
dc.col[defaultbg].pixel
);
XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, xw.w, xw.h);
//xw.buf = xw.win;
/*
XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, xw.w, xw.h);
//xw.buf = xw.win;
/*
@@
-2894,7
+2899,7
@@
draw(void) {
} else {
XCopyArea(xw.dpy, xw.buf, xw.win, dc.gc, 0, 0, xw.w,
xw.h, 0, 0);
} else {
XCopyArea(xw.dpy, xw.buf, xw.win, dc.gc, 0, 0, xw.w,
xw.h, 0, 0);
- XSetForeground(xw.dpy, dc.gc,
0
);
+ XSetForeground(xw.dpy, dc.gc,
dc.col[IS_SET(MODE_REVERSE) ? defaultfg : defaultbg].pixel
);
}
}
}
}
@@
-2986,6
+2991,11
@@
xseturgency(int add) {
void
focus(XEvent *ev) {
void
focus(XEvent *ev) {
+ XFocusChangeEvent *e = &ev->xfocus;
+
+ if(e->mode == NotifyGrab)
+ return;
+
if(ev->type == FocusIn) {
XSetICFocus(xw.xic);
xw.state |= WIN_FOCUSED;
if(ev->type == FocusIn) {
XSetICFocus(xw.xic);
xw.state |= WIN_FOCUSED;
@@
-3109,8
+3119,10
@@
kpress(XEvent *ev) {
void
cmessage(XEvent *e) {
void
cmessage(XEvent *e) {
- /* See xembed specs
- http://standards.freedesktop.org/xembed-spec/xembed-spec-latest.html */
+ /*
+ * See xembed specs
+ * http://standards.freedesktop.org/xembed-spec/xembed-spec-latest.html
+ */
if(e->xclient.message_type == xw.xembed && e->xclient.format == 32) {
if(e->xclient.data.l[1] == XEMBED_FOCUS_IN) {
xw.state |= WIN_FOCUSED;
if(e->xclient.message_type == xw.xembed && e->xclient.format == 32) {
if(e->xclient.data.l[1] == XEMBED_FOCUS_IN) {
xw.state |= WIN_FOCUSED;
@@
-3126,8
+3138,7
@@
cmessage(XEvent *e) {
}
void
}
void
-cresize(int width, int height)
-{
+cresize(int width, int height) {
int col, row;
if(width != 0)
int col, row;
if(width != 0)