Call XdbeQueryExtension before of calling any Xdbe function

XdbeQueryExtension() tells to the caller if the Xdbe extension is present in
the X server, so it should be called for sanity. But like is said in
XdbeQueryExtension(3):

	No other Xdbe functions may be called before this function.  If a
	client violates this rule, the effects of all subsequent Xdbe calls
	that it makes are undefined.

it is mandatory call this function.
---
 st.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
dev
Roberto E. Vargas Caballero 2012-09-16 10:45:36 +02:00
parent a62789788c
commit ba1e9daeef
1 changed files with 3 additions and 2 deletions

5
st.c
View File

@ -1970,7 +1970,7 @@ xinit(void) {
XSetWindowAttributes attrs; XSetWindowAttributes attrs;
Cursor cursor; Cursor cursor;
Window parent; Window parent;
int sw, sh; int sw, sh, major, minor;
if(!(xw.dpy = XOpenDisplay(NULL))) if(!(xw.dpy = XOpenDisplay(NULL)))
die("Can't open display\n"); die("Can't open display\n");
@ -2021,9 +2021,10 @@ xinit(void) {
CWBackPixel | CWBorderPixel | CWBitGravity | CWEventMask CWBackPixel | CWBorderPixel | CWBitGravity | CWEventMask
| CWColormap, | CWColormap,
&attrs); &attrs);
if(!XdbeQueryExtension(xw.dpy, &major, &minor))
die("Xdbe extension is not present\n");
xw.buf = XdbeAllocateBackBufferName(xw.dpy, xw.win, XdbeCopied); xw.buf = XdbeAllocateBackBufferName(xw.dpy, xw.win, XdbeCopied);
/* input methods */ /* input methods */
xw.xim = XOpenIM(xw.dpy, NULL, NULL, NULL); xw.xim = XOpenIM(xw.dpy, NULL, NULL, NULL);
xw.xic = XCreateIC(xw.xim, XNInputStyle, XIMPreeditNothing xw.xic = XCreateIC(xw.xim, XNInputStyle, XIMPreeditNothing