diff options
Diffstat (limited to 'xorg-server/Xi')
-rw-r--r-- | xorg-server/Xi/Makefile.in | 15 | ||||
-rw-r--r-- | xorg-server/Xi/queryst.c | 14 | ||||
-rw-r--r-- | xorg-server/Xi/xiquerydevice.c | 41 | ||||
-rw-r--r-- | xorg-server/Xi/xiquerydevice.h | 8 |
4 files changed, 45 insertions, 33 deletions
diff --git a/xorg-server/Xi/Makefile.in b/xorg-server/Xi/Makefile.in index c4c483c81..dab5eeddd 100644 --- a/xorg-server/Xi/Makefile.in +++ b/xorg-server/Xi/Makefile.in @@ -41,7 +41,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ $(top_srcdir)/m4/dolt.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/shave.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -106,7 +106,6 @@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AM_MAKEFLAGS = @AM_MAKEFLAGS@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ @@ -131,7 +130,6 @@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ -CXX = @CXX@ CYGPATH_W = @CYGPATH_W@ DARWIN_LIBS = @DARWIN_LIBS@ DBUS_CFLAGS = @DBUS_CFLAGS@ @@ -155,6 +153,7 @@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOLT_BASH = @DOLT_BASH@ +DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ @@ -172,8 +171,6 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FC = @FC@ FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ @@ -219,7 +216,6 @@ LTCXXCOMPILE = @LTCXXCOMPILE@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAIN_LIB = @MAIN_LIB@ -MAKEFLAGS = @MAKEFLAGS@ MAKEINFO = @MAKEINFO@ MAKE_HTML = @MAKE_HTML@ MAKE_PDF = @MAKE_PDF@ @@ -245,6 +241,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ @@ -254,7 +251,6 @@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ PROJECTROOT = @PROJECTROOT@ PS2PDF = @PS2PDF@ -Q = @Q@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ @@ -268,7 +264,6 @@ STRIP = @STRIP@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ -V = @V@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ WINDRES = @WINDRES@ @@ -310,8 +305,6 @@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ -XSDL_INCS = @XSDL_INCS@ -XSDL_LIBS = @XSDL_LIBS@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ @@ -354,6 +347,7 @@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ +distcleancheck_listfiles = @distcleancheck_listfiles@ docdir = @docdir@ driverdir = @driverdir@ dvidir = @dvidir@ @@ -385,7 +379,6 @@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ -shavedir = @shavedir@ srcdir = @srcdir@ symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ diff --git a/xorg-server/Xi/queryst.c b/xorg-server/Xi/queryst.c index 2ba1edb63..78b97a769 100644 --- a/xorg-server/Xi/queryst.c +++ b/xorg-server/Xi/queryst.c @@ -96,7 +96,7 @@ ProcXQueryDeviceState(ClientPtr client) rep.sequenceNumber = client->sequence; rc = dixLookupDevice(&dev, stuff->deviceid, client, DixReadAccess); - if (rc != Success) + if (rc != Success && rc != BadAccess) return rc; v = dev->valuator; @@ -130,8 +130,9 @@ ProcXQueryDeviceState(ClientPtr client) tk->length = sizeof(xKeyState); tk->num_keys = k->xkbInfo->desc->max_key_code - k->xkbInfo->desc->min_key_code + 1; - for (i = 0; i < 32; i++) - tk->keys[i] = k->down[i]; + if (rc != BadAccess) + for (i = 0; i < 32; i++) + tk->keys[i] = k->down[i]; buf += sizeof(xKeyState); } @@ -140,7 +141,8 @@ ProcXQueryDeviceState(ClientPtr client) tb->class = ButtonClass; tb->length = sizeof(xButtonState); tb->num_buttons = b->numButtons; - memcpy(tb->buttons, b->down, sizeof(b->down)); + if (rc != BadAccess) + memcpy(tb->buttons, b->down, sizeof(b->down)); buf += sizeof(xButtonState); } @@ -152,7 +154,9 @@ ProcXQueryDeviceState(ClientPtr client) tv->mode = v->mode; buf += sizeof(xValuatorState); for (i = 0, values = v->axisVal; i < v->numAxes; i++) { - *((int *)buf) = *values++; + if (rc != BadAccess) + *((int *)buf) = *values; + values++; if (client->swapped) { swapl((int *)buf, n); /* macro - braces needed */ } diff --git a/xorg-server/Xi/xiquerydevice.c b/xorg-server/Xi/xiquerydevice.c index 68d91fa87..435868de2 100644 --- a/xorg-server/Xi/xiquerydevice.c +++ b/xorg-server/Xi/xiquerydevice.c @@ -45,7 +45,8 @@ #include "xiquerydevice.h" static Bool ShouldSkipDevice(ClientPtr client, int deviceid, DeviceIntPtr d); -static int ListDeviceInfo(DeviceIntPtr dev, xXIDeviceInfo* info); +static int +ListDeviceInfo(ClientPtr client, DeviceIntPtr dev, xXIDeviceInfo* info); static int SizeDeviceInfo(DeviceIntPtr dev); static void SwapDeviceInfo(DeviceIntPtr dev, xXIDeviceInfo* info); int @@ -119,7 +120,7 @@ ProcXIQueryDevice(ClientPtr client) ptr = info; if (dev) { - len = ListDeviceInfo(dev, (xXIDeviceInfo*)info); + len = ListDeviceInfo(client, dev, (xXIDeviceInfo*)info); if (client->swapped) SwapDeviceInfo(dev, (xXIDeviceInfo*)info); info += len; @@ -131,7 +132,7 @@ ProcXIQueryDevice(ClientPtr client) { if (!skip[i]) { - len = ListDeviceInfo(dev, (xXIDeviceInfo*)info); + len = ListDeviceInfo(client, dev, (xXIDeviceInfo*)info); if (client->swapped) SwapDeviceInfo(dev, (xXIDeviceInfo*)info); info += len; @@ -143,7 +144,7 @@ ProcXIQueryDevice(ClientPtr client) { if (!skip[i]) { - len = ListDeviceInfo(dev, (xXIDeviceInfo*)info); + len = ListDeviceInfo(client, dev, (xXIDeviceInfo*)info); if (client->swapped) SwapDeviceInfo(dev, (xXIDeviceInfo*)info); info += len; @@ -240,7 +241,7 @@ SizeDeviceClasses(DeviceIntPtr dev) * @return Number of bytes written into info. */ int -ListButtonInfo(DeviceIntPtr dev, xXIButtonInfo* info) +ListButtonInfo(DeviceIntPtr dev, xXIButtonInfo* info, Bool reportState) { unsigned char *bits; int mask_len; @@ -257,9 +258,11 @@ ListButtonInfo(DeviceIntPtr dev, xXIButtonInfo* info) bits = (unsigned char*)&info[1]; memset(bits, 0, mask_len * 4); - for (i = 0; dev && dev->button && i < dev->button->numButtons; i++) - if (BitIsOn(dev->button->down, i)) - SetBit(bits, i); + if (reportState) + for (i = 0; dev && dev->button && i < dev->button->numButtons; i++) + if (BitIsOn(dev->button->down, i)) + SetBit(bits, i); + bits += mask_len * 4; memcpy(bits, dev->button->labels, dev->button->numButtons * sizeof(Atom)); @@ -327,7 +330,8 @@ SwapKeyInfo(DeviceIntPtr dev, xXIKeyInfo* info) * @return The number of bytes written into info. */ int -ListValuatorInfo(DeviceIntPtr dev, xXIValuatorInfo* info, int axisnumber) +ListValuatorInfo(DeviceIntPtr dev, xXIValuatorInfo* info, int axisnumber, + Bool reportState) { ValuatorClassPtr v = dev->valuator; @@ -345,6 +349,9 @@ ListValuatorInfo(DeviceIntPtr dev, xXIValuatorInfo* info, int axisnumber) info->mode = v->mode; /* Server doesn't have per-axis mode yet */ info->sourceid = v->sourceid; + if (!reportState) + info->value = info->min; + return info->length * 4; } @@ -389,7 +396,7 @@ int GetDeviceUse(DeviceIntPtr dev, uint16_t *attachment) * @return The number of bytes used. */ static int -ListDeviceInfo(DeviceIntPtr dev, xXIDeviceInfo* info) +ListDeviceInfo(ClientPtr client, DeviceIntPtr dev, xXIDeviceInfo* info) { char *any = (char*)&info[1]; int len = 0, total_len = 0; @@ -407,7 +414,8 @@ ListDeviceInfo(DeviceIntPtr dev, xXIDeviceInfo* info) any += len; total_len += len; - return total_len + ListDeviceClasses(dev, any, &info->num_classes); + total_len += ListDeviceClasses(client, dev, any, &info->num_classes); + return total_len; } /** @@ -416,16 +424,21 @@ ListDeviceInfo(DeviceIntPtr dev, xXIDeviceInfo* info) * written. */ int -ListDeviceClasses(DeviceIntPtr dev, char *any, uint16_t *nclasses) +ListDeviceClasses(ClientPtr client, DeviceIntPtr dev, + char *any, uint16_t *nclasses) { int total_len = 0; int len; int i; + int rc; + + /* Check if the current device state should be suppressed */ + rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixReadAccess); if (dev->button) { (*nclasses)++; - len = ListButtonInfo(dev, (xXIButtonInfo*)any); + len = ListButtonInfo(dev, (xXIButtonInfo*)any, rc == Success); any += len; total_len += len; } @@ -441,7 +454,7 @@ ListDeviceClasses(DeviceIntPtr dev, char *any, uint16_t *nclasses) for (i = 0; dev->valuator && i < dev->valuator->numAxes; i++) { (*nclasses)++; - len = ListValuatorInfo(dev, (xXIValuatorInfo*)any, i); + len = ListValuatorInfo(dev, (xXIValuatorInfo*)any, i, rc == Success); any += len; total_len += len; } diff --git a/xorg-server/Xi/xiquerydevice.h b/xorg-server/Xi/xiquerydevice.h index 34e87bdde..02f06591e 100644 --- a/xorg-server/Xi/xiquerydevice.h +++ b/xorg-server/Xi/xiquerydevice.h @@ -37,9 +37,11 @@ int SProcXIQueryDevice(ClientPtr client); int ProcXIQueryDevice(ClientPtr client); void SRepXIQueryDevice(ClientPtr client, int size, xXIQueryDeviceReply *rep); int SizeDeviceClasses(DeviceIntPtr dev); -int ListDeviceClasses(DeviceIntPtr dev, char* any, uint16_t* nclasses); +int ListDeviceClasses(ClientPtr client, DeviceIntPtr dev, + char* any, uint16_t* nclasses); int GetDeviceUse(DeviceIntPtr dev, uint16_t *attachment); -int ListButtonInfo(DeviceIntPtr dev, xXIButtonInfo* info); +int ListButtonInfo(DeviceIntPtr dev, xXIButtonInfo* info, Bool reportState); int ListKeyInfo(DeviceIntPtr dev, xXIKeyInfo* info); -int ListValuatorInfo(DeviceIntPtr dev, xXIValuatorInfo* info, int axisnumber); +int ListValuatorInfo(DeviceIntPtr dev, xXIValuatorInfo* info, + int axisnumber, Bool reportState); #endif /* QUERYDEV_H */ |