aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Lohmann <20h@r-36.net>2013-01-19 09:13:52 +0100
committerChristoph Lohmann <20h@r-36.net>2013-01-19 09:13:52 +0100
commit0e232a41150d67539df05e60c7e829f0bfb431d0 (patch)
tree0bc41f12a41e914b95210a1209d2c26a4d4af22d
parent3ce96aea8af566c88ed1e076d270b4d1abcf6e96 (diff)
downloadst-0e232a41150d67539df05e60c7e829f0bfb431d0.tar.gz
Dbe is not required anymore.
-rw-r--r--st.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/st.c b/st.c
index 0ea51d9..979fdc8 100644
--- a/st.c
+++ b/st.c
@@ -203,7 +203,7 @@ typedef struct {
Display *dpy;
Colourmap cmap;
Window win;
- XdbeBackBuffer buf;
+ Drawable buf;
Atom xembed, wmdeletewin;
XIM xim;
XIC xic;
@@ -414,6 +414,8 @@ static char *opt_embed = NULL;
static char *opt_class = NULL;
static char *opt_font = NULL;
+bool usedbe = False;
+
static char *usedfont = NULL;
static int usedfontsize = 0;
@@ -2500,7 +2502,8 @@ xinit(void) {
| ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
attrs.colormap = xw.cmap;
- parent = opt_embed ? strtol(opt_embed, NULL, 0) : XRootWindow(xw.dpy, xw.scr);
+ parent = opt_embed ? strtol(opt_embed, NULL, 0) : \
+ XRootWindow(xw.dpy, xw.scr);
xw.win = XCreateWindow(xw.dpy, parent, xw.fx, xw.fy,
xw.w, xw.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput,
xw.vis,
@@ -2509,12 +2512,16 @@ xinit(void) {
&attrs);
/* double buffering */
- if(!XdbeQueryExtension(xw.dpy, &major, &minor))
- die("Xdbe extension is not present\n");
- xw.buf = XdbeAllocateBackBufferName(xw.dpy, xw.win, XdbeBackground);
+ if(XdbeQueryExtension(xw.dpy, &major, &minor)) {
+ xw.buf = XdbeAllocateBackBufferName(xw.dpy, xw.win,
+ XdbeBackground);
+ usedbe = True;
+ } else {
+ xw.buf = xw.win;
+ }
/* Xft rendering context */
- xw.draw = XftDrawCreate(xw.dpy, xw.buf, xw.vis, xw.cmap);
+ xw.draw = XftDrawCreate(xw.dpy, xw.win, xw.vis, xw.cmap);
/* input methods */
if((xw.xim = XOpenIM(xw.dpy, NULL, NULL, NULL)) == NULL) {
@@ -2822,7 +2829,8 @@ draw(void) {
XdbeSwapInfo swpinfo[1] = {{xw.win, XdbeCopied}};
drawregion(0, 0, term.col, term.row);
- XdbeSwapBuffers(xw.dpy, swpinfo, 1);
+ if(usedbe)
+ XdbeSwapBuffers(xw.dpy, swpinfo, 1);
}
void
remember that computers suck.