added PBaseSize hint and set default title to "st".

This commit is contained in:
Aurélien Aptel 2010-06-03 23:14:37 +02:00
parent 2f5ebe0a4d
commit 2f96cfeada

23
st.c
View file

@ -39,7 +39,8 @@
/* Attribute, Cursor, Character state, Terminal mode, Screen draw mode */ /* Attribute, Cursor, Character state, Terminal mode, Screen draw mode */
enum { ATTR_NULL=0 , ATTR_REVERSE=1 , ATTR_UNDERLINE=2, ATTR_BOLD=4, ATTR_GFX=8 }; enum { ATTR_NULL=0 , ATTR_REVERSE=1 , ATTR_UNDERLINE=2, ATTR_BOLD=4, ATTR_GFX=8 };
enum { CURSOR_UP, CURSOR_DOWN, CURSOR_LEFT, CURSOR_RIGHT, CURSOR_HIDE, CURSOR_DRAW, CURSOR_SAVE, CURSOR_LOAD }; enum { CURSOR_UP, CURSOR_DOWN, CURSOR_LEFT, CURSOR_RIGHT, CURSOR_HIDE, CURSOR_DRAW,
CURSOR_SAVE, CURSOR_LOAD };
enum { GLYPH_SET=1, GLYPH_DIRTY=2 }; enum { GLYPH_SET=1, GLYPH_DIRTY=2 };
enum { MODE_WRAP=1, MODE_INSERT=2, MODE_APPKEYPAD=4 }; enum { MODE_WRAP=1, MODE_INSERT=2, MODE_APPKEYPAD=4 };
enum { ESC_START=1, ESC_CSI=2, ESC_OSC=4, ESC_TITLE=8, ESC_ALTCHARSET=16 }; enum { ESC_START=1, ESC_CSI=2, ESC_OSC=4, ESC_TITLE=8, ESC_ALTCHARSET=16 };
@ -1024,8 +1025,8 @@ void
xclear(int x1, int y1, int x2, int y2) { xclear(int x1, int y1, int x2, int y2) {
XSetForeground(xw.dis, dc.gc, dc.col[DefaultBG]); XSetForeground(xw.dis, dc.gc, dc.col[DefaultBG]);
XFillRectangle(xw.dis, xw.buf, dc.gc, XFillRectangle(xw.dis, xw.buf, dc.gc,
x1 * xw.cw, y1 * xw.ch, x1 * xw.cw, y1 * xw.ch,
(x2-x1+1) * xw.cw, (y2-y1+1) * xw.ch); (x2-x1+1) * xw.cw, (y2-y1+1) * xw.ch);
} }
void void
@ -1034,11 +1035,13 @@ xhints(void)
XClassHint chint = {TNAME, TNAME}; XClassHint chint = {TNAME, TNAME};
XWMHints wmhint = {.flags = InputHint, .input = 1}; XWMHints wmhint = {.flags = InputHint, .input = 1};
XSizeHints shint = { XSizeHints shint = {
.flags = PSize | PResizeInc, .flags = PSize | PResizeInc | PBaseSize,
.height = xw.h, /* XXX: doesn't seem to work, see run() */ .height = xw.h,
.width = xw.w, .width = xw.w,
.height_inc = xw.ch, .height_inc = xw.ch,
.width_inc = xw.cw, .width_inc = xw.cw,
.base_height = 2*BORDER,
.base_width = 2*BORDER,
}; };
XSetWMProperties(xw.dis, xw.win, NULL, NULL, NULL, 0, &shint, &wmhint, &chint); XSetWMProperties(xw.dis, xw.win, NULL, NULL, NULL, 0, &shint, &wmhint, &chint);
} }
@ -1081,7 +1084,7 @@ xinit(void) {
dc.gc = XCreateGC(xw.dis, xw.win, 0, NULL); dc.gc = XCreateGC(xw.dis, xw.win, 0, NULL);
XMapWindow(xw.dis, xw.win); XMapWindow(xw.dis, xw.win);
xhints(); xhints();
XStoreName(xw.dis, xw.win, TNAME); XStoreName(xw.dis, xw.win, "st");
XSync(xw.dis, 0); XSync(xw.dis, 0);
} }
@ -1135,7 +1138,6 @@ xcursor(int mode) {
} }
} }
#ifdef DEBUG #ifdef DEBUG
/* basic drawing routines */ /* basic drawing routines */
void void
@ -1148,7 +1150,7 @@ xdrawc(int x, int y, Glyph g) {
} }
void void
draw_(int dummy) { draw(int dummy) {
int x, y; int x, y;
xclear(0, 0, term.col-1, term.row-1); xclear(0, 0, term.col-1, term.row-1);
@ -1162,8 +1164,9 @@ draw_(int dummy) {
XCopyArea(xw.dis, xw.buf, xw.win, dc.gc, 0, 0, xw.bufw, xw.bufh, BORDER, BORDER); XCopyArea(xw.dis, xw.buf, xw.win, dc.gc, 0, 0, xw.bufw, xw.bufh, BORDER, BORDER);
XFlush(xw.dis); XFlush(xw.dis);
} }
#endif
#else
/* optimized drawing routine */
void void
draw(int redraw_all) { draw(int redraw_all) {
int i, x, y, ox; int i, x, y, ox;
@ -1192,6 +1195,8 @@ draw(int redraw_all) {
XFlush(xw.dis); XFlush(xw.dis);
} }
#endif
void void
expose(XEvent *ev) { expose(XEvent *ev) {
draw(SCREEN_REDRAW); draw(SCREEN_REDRAW);