[hackers] [st] Call XdbeQueryExtension before of calling any Xdbe function || "Roberto E. Vargas Caballero"

From: <hg_AT_suckless.org>
Date: Sun, 16 Sep 2012 12:25:52 +0200 (CEST)

changeset: 303:33c01f44bef1
user: "Roberto E. Vargas Caballero" <k0ga_AT_shike2.com>
date: Sun Sep 16 10:45:36 2012 +0200
files: st.c
description:
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(-)
diff -r 2a0be13ebd44 -r 33c01f44bef1 st.c
--- a/st.c	Fri Sep 14 19:46:07 2012 +0200
+++ b/st.c	Sun Sep 16 10:45:36 2012 +0200
_AT_@ -1970,7 +1970,7 @@
 	XSetWindowAttributes attrs;
 	Cursor cursor;
 	Window parent;
-	int sw, sh;
+	int sw, sh, major, minor;
 
 	if(!(xw.dpy = XOpenDisplay(NULL)))
 		die("Can't open display\n");
_AT_@ -2021,9 +2021,10 @@
 			CWBackPixel | CWBorderPixel | CWBitGravity | CWEventMask
 			| CWColormap,
 			&attrs);
+	if(!XdbeQueryExtension(xw.dpy, &major, &minor))
+		die("Xdbe extension is not present\n");
 	xw.buf = XdbeAllocateBackBufferName(xw.dpy, xw.win, XdbeCopied);
 
-
 	/* input methods */
 	xw.xim = XOpenIM(xw.dpy, NULL, NULL, NULL);
 	xw.xic = XCreateIC(xw.xim, XNInputStyle, XIMPreeditNothing
Received on Sun Sep 16 2012 - 12:25:52 CEST

This archive was generated by hypermail 2.3.0 : Sun Sep 16 2012 - 12:36:07 CEST