From 35f7d049ae4679b52d0f609e04c177e532d787dc Mon Sep 17 00:00:00 2001 From: "Niklas.Waern" Date: Sat, 22 May 2010 00:11:00 +0200 Subject: [PATCH] x11.xinput2: xi2-available? --- basis/x11/xinput2/xinput2.factor | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/basis/x11/xinput2/xinput2.factor b/basis/x11/xinput2/xinput2.factor index 682c79fc43..80aaf95d63 100644 --- a/basis/x11/xinput2/xinput2.factor +++ b/basis/x11/xinput2/xinput2.factor @@ -1,4 +1,17 @@ ! Copyright (C) 2010 Niklas Waern. ! See http://factorcode.org/license.txt for BSD license. -USING: ; +USING: alien.c-types combinators kernel namespaces x11 +x11.constants x11.xinput2.ffi ; IN: x11.xinput2 + +: (xi2-available?) ( display -- ? ) + 2 0 [ ] bi@ + XIQueryVersion + { + { BadRequest [ f ] } + { Success [ t ] } + [ "Internal Xlib error." throw ] + } case ; + +: xi2-available? ( -- ? ) dpy get (xi2-available?) ; inline +