[PATCH] Avoid warning from "xset r rate" when XF86Misc extension is not present

Alan Coopersmith alan.coopersmith at sun.com
Wed Apr 29 14:12:37 PDT 2009


- Since XKB is used if present, don't check for XF86Misc unless XKB is
  not present
- If we do check for XF86Misc, use QueryExtension instead of QueryVersion
  to avoid Xlib printing missing extension warning message.

Signed-off-by: Alan Coopersmith <alan.coopersmith at sun.com>
---
 xset.c |   35 ++++++++++++++++++-----------------
 1 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/xset.c b/xset.c
index bfdb6e7..ae1d818 100644
--- a/xset.c
+++ b/xset.c
@@ -195,18 +195,13 @@ main(int argc, char *argv[])
     Display *dpy;
     Bool hasargs = False;
 
-#ifdef XF86MISC
-    int miscpresent = 1;
-    int major, minor;
-#else
     int miscpresent = 0;
-#endif
+    int xkbpresent = 0;
+
 #ifdef XKB
-    int xkbpresent = 1;
     int xkbmajor = XkbMajorVersion, xkbminor = XkbMinorVersion;
     int xkbopcode, xkbevent, xkberror;
 #else
-    int xkbpresent = 0;
 #endif
 #ifdef FONTCACHE
     long himark, lowmark, balance;
@@ -731,22 +726,28 @@ main(int argc, char *argv[])
 
 #ifdef XF86MISC
 		    int rate_set = 0;
-
-		    if (XF86MiscQueryVersion(dpy, &major, &minor)) {
-			delay = KBDDELAY_DEFAULT, rate = KBDRATE_DEFAULT;
-		    } else {
-			miscpresent = 0;
-		    }
 #endif
+
 #ifdef XKB
 		    if (XkbQueryExtension(dpy, &xkbopcode, &xkbevent,
 					  &xkberror, &xkbmajor, &xkbminor)) {
-			delay = XKBDDELAY_DEFAULT, rate = XKBDRATE_DEFAULT;
-		    } else {
-			xkbpresent = 0;
+			delay = XKBDDELAY_DEFAULT;
+			rate = XKBDRATE_DEFAULT;
+			xkbpresent = 1;
+		    }
+#endif
+#ifdef XF86MISC
+		    if (!xkbpresent) {
+			int dummy;
+
+			if (XF86MiscQueryExtension(dpy, &dummy, &dummy)) {
+			    delay = KBDDELAY_DEFAULT;
+			    rate = KBDRATE_DEFAULT;
+			    miscpresent = 1;
+			}
 		    }
 #endif
-		    if (!miscpresent && !xkbpresent)
+		    if (!xkbpresent && !miscpresent)
 			fprintf(stderr,
 				"server does not have extension for \"r rate\" option\n");
 		    i++;
-- 
1.5.6.5



More information about the xorg-devel mailing list