summaryrefslogtreecommitdiff
path: root/xserver/Xi
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2011-11-05 13:32:59 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2011-11-05 13:32:59 +0000
commitbf781c5ff285301ad70ffc5f4321b8906f71edd8 (patch)
tree3b770f4bf9a8cd11dd9f14e7f758991a73a52d78 /xserver/Xi
parente59d0622d3162f7b5a7420ef87dbebb200348c37 (diff)
Update to xserver 1.11.2
Diffstat (limited to 'xserver/Xi')
-rw-r--r--xserver/Xi/Makefile.in69
-rw-r--r--xserver/Xi/chgdctl.c72
-rw-r--r--xserver/Xi/closedev.c1
-rw-r--r--xserver/Xi/exevents.c317
-rw-r--r--xserver/Xi/exglobals.h2
-rw-r--r--xserver/Xi/extinit.c10
-rw-r--r--xserver/Xi/getdctl.c75
-rw-r--r--xserver/Xi/getprop.c2
-rw-r--r--xserver/Xi/getselev.c6
-rw-r--r--xserver/Xi/listdev.c10
-rw-r--r--xserver/Xi/opendev.c1
-rw-r--r--xserver/Xi/queryst.c3
-rw-r--r--xserver/Xi/setmode.c2
-rw-r--r--xserver/Xi/stubs.c102
-rw-r--r--xserver/Xi/xichangehierarchy.c528
-rw-r--r--xserver/Xi/xigrabdev.c2
-rw-r--r--xserver/Xi/xipassivegrab.c43
-rw-r--r--xserver/Xi/xiproperty.c6
-rw-r--r--xserver/Xi/xiquerydevice.c13
-rw-r--r--xserver/Xi/xiquerypointer.c4
-rw-r--r--xserver/Xi/xiqueryversion.c7
-rw-r--r--xserver/Xi/xiselectev.c15
-rw-r--r--xserver/Xi/xiwarppointer.c4
23 files changed, 541 insertions, 753 deletions
diff --git a/xserver/Xi/Makefile.in b/xserver/Xi/Makefile.in
index db5c25316..e4962a510 100644
--- a/xserver/Xi/Makefile.in
+++ b/xserver/Xi/Makefile.in
@@ -40,7 +40,10 @@ subdir = Xi
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \
- $(top_srcdir)/m4/dolt.m4 $(top_srcdir)/configure.ac
+ $(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/xorg-tls.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(install_sh) -d
@@ -73,6 +76,9 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
@@ -86,8 +92,8 @@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
AGP_FALSE = @AGP_FALSE@
AGP_TRUE = @AGP_TRUE@
-AIGLX_FALSE = @AIGLX_FALSE@
-AIGLX_TRUE = @AIGLX_TRUE@
+AIGLX_DRI_LOADER_FALSE = @AIGLX_DRI_LOADER_FALSE@
+AIGLX_DRI_LOADER_TRUE = @AIGLX_DRI_LOADER_TRUE@
ALLOCA = @ALLOCA@
ALPHA_VIDEO_FALSE = @ALPHA_VIDEO_FALSE@
ALPHA_VIDEO_TRUE = @ALPHA_VIDEO_TRUE@
@@ -100,7 +106,6 @@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@
APP_MAN_DIR = @APP_MAN_DIR@
APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
AR = @AR@
-ARM_BACKTRACE_CFLAGS = @ARM_BACKTRACE_CFLAGS@
ARM_VIDEO_FALSE = @ARM_VIDEO_FALSE@
ARM_VIDEO_TRUE = @ARM_VIDEO_TRUE@
AS = @AS@
@@ -113,18 +118,19 @@ BSD_APM_FALSE = @BSD_APM_FALSE@
BSD_APM_TRUE = @BSD_APM_TRUE@
BSD_KQUEUE_APM_FALSE = @BSD_KQUEUE_APM_FALSE@
BSD_KQUEUE_APM_TRUE = @BSD_KQUEUE_APM_TRUE@
-BUILDDOCS_FALSE = @BUILDDOCS_FALSE@
-BUILDDOCS_TRUE = @BUILDDOCS_TRUE@
BUILD_DATE = @BUILD_DATE@
BUILD_KDRIVEFBDEVLIB_FALSE = @BUILD_KDRIVEFBDEVLIB_FALSE@
BUILD_KDRIVEFBDEVLIB_TRUE = @BUILD_KDRIVEFBDEVLIB_TRUE@
BUILD_TIME = @BUILD_TIME@
+BUNDLE_ID_PREFIX = @BUNDLE_ID_PREFIX@
CC = @CC@
CCAS = @CCAS@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CHANGELOG_CMD = @CHANGELOG_CMD@
+CLIENTIDS_FALSE = @CLIENTIDS_FALSE@
+CLIENTIDS_TRUE = @CLIENTIDS_TRUE@
COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
COMPOSITE_FALSE = @COMPOSITE_FALSE@
COMPOSITE_TRUE = @COMPOSITE_TRUE@
@@ -141,12 +147,7 @@ CONFIG_WSCONS_TRUE = @CONFIG_WSCONS_TRUE@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CWARNFLAGS = @CWARNFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
-DARWIN_LIBS = @DARWIN_LIBS@
DBE_FALSE = @DBE_FALSE@
DBE_TRUE = @DBE_TRUE@
DBUS_CFLAGS = @DBUS_CFLAGS@
@@ -181,7 +182,6 @@ DMX_BUILD_USB_FALSE = @DMX_BUILD_USB_FALSE@
DMX_BUILD_USB_TRUE = @DMX_BUILD_USB_TRUE@
DMX_FALSE = @DMX_FALSE@
DMX_TRUE = @DMX_TRUE@
-DOLT_BASH = @DOLT_BASH@
DOXYGEN = @DOXYGEN@
DPMSExtension_FALSE = @DPMSExtension_FALSE@
DPMSExtension_TRUE = @DPMSExtension_TRUE@
@@ -202,7 +202,7 @@ DRI_LIBS = @DRI_LIBS@
DRI_TRUE = @DRI_TRUE@
DSYMUTIL = @DSYMUTIL@
DTRACE = @DTRACE@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -211,11 +211,12 @@ ENABLE_DEVEL_DOCS_FALSE = @ENABLE_DEVEL_DOCS_FALSE@
ENABLE_DEVEL_DOCS_TRUE = @ENABLE_DEVEL_DOCS_TRUE@
ENABLE_DOCS_FALSE = @ENABLE_DOCS_FALSE@
ENABLE_DOCS_TRUE = @ENABLE_DOCS_TRUE@
+ENABLE_UNIT_TESTS_FALSE = @ENABLE_UNIT_TESTS_FALSE@
+ENABLE_UNIT_TESTS_TRUE = @ENABLE_UNIT_TESTS_TRUE@
EXEEXT = @EXEEXT@
-F77 = @F77@
FBDEVHW_FALSE = @FBDEVHW_FALSE@
FBDEVHW_TRUE = @FBDEVHW_TRUE@
-FFLAGS = @FFLAGS@
+FGREP = @FGREP@
FILE_MAN_DIR = @FILE_MAN_DIR@
FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
FONT100DPIDIR = @FONT100DPIDIR@
@@ -228,11 +229,10 @@ FONTTYPE1DIR = @FONTTYPE1DIR@
FOP = @FOP@
FREEBSD_KLDLOAD_FALSE = @FREEBSD_KLDLOAD_FALSE@
FREEBSD_KLDLOAD_TRUE = @FREEBSD_KLDLOAD_TRUE@
-GLIB_CFLAGS = @GLIB_CFLAGS@
-GLIB_LIBS = @GLIB_LIBS@
GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
GLX_DEFINES = @GLX_DEFINES@
GLX_FALSE = @GLX_FALSE@
+GLX_TLS = @GLX_TLS@
GLX_TRUE = @GLX_TRUE@
GL_CFLAGS = @GL_CFLAGS@
GL_LIBS = @GL_LIBS@
@@ -245,12 +245,16 @@ HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@
HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@
HAVE_FOP_FALSE = @HAVE_FOP_FALSE@
HAVE_FOP_TRUE = @HAVE_FOP_TRUE@
+HAVE_LD_WRAP_FALSE = @HAVE_LD_WRAP_FALSE@
+HAVE_LD_WRAP_TRUE = @HAVE_LD_WRAP_TRUE@
HAVE_STYLESHEETS_FALSE = @HAVE_STYLESHEETS_FALSE@
HAVE_STYLESHEETS_TRUE = @HAVE_STYLESHEETS_TRUE@
HAVE_XMLTO_FALSE = @HAVE_XMLTO_FALSE@
HAVE_XMLTO_TEXT_FALSE = @HAVE_XMLTO_TEXT_FALSE@
HAVE_XMLTO_TEXT_TRUE = @HAVE_XMLTO_TEXT_TRUE@
HAVE_XMLTO_TRUE = @HAVE_XMLTO_TRUE@
+HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@
+HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@
HP300_VIDEO_FALSE = @HP300_VIDEO_FALSE@
HP300_VIDEO_TRUE = @HP300_VIDEO_TRUE@
HPPA_VIDEO_FALSE = @HPPA_VIDEO_FALSE@
@@ -296,7 +300,10 @@ KDRIVE_MOUSE_TRUE = @KDRIVE_MOUSE_TRUE@
KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
KDRIVE_TRUE = @KDRIVE_TRUE@
-LAUNCHD_ID_PREFIX = @LAUNCHD_ID_PREFIX@
+KHRONOS_OPENGL_REGISTRY_CFLAGS = @KHRONOS_OPENGL_REGISTRY_CFLAGS@
+KHRONOS_OPENGL_REGISTRY_LIBS = @KHRONOS_OPENGL_REGISTRY_LIBS@
+KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@
+LD = @LD@
LDFLAGS = @LDFLAGS@
LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
LEX = @LEX@
@@ -315,19 +322,19 @@ LINUX_ALPHA_FALSE = @LINUX_ALPHA_FALSE@
LINUX_ALPHA_TRUE = @LINUX_ALPHA_TRUE@
LINUX_IA64_FALSE = @LINUX_IA64_FALSE@
LINUX_IA64_TRUE = @LINUX_IA64_TRUE@
+LIPO = @LIPO@
LNXACPI_FALSE = @LNXACPI_FALSE@
LNXACPI_TRUE = @LNXACPI_TRUE@
LNXAPM_FALSE = @LNXAPM_FALSE@
LNXAPM_TRUE = @LNXAPM_TRUE@
LN_S = @LN_S@
-LTCOMPILE = @LTCOMPILE@
-LTCXXCOMPILE = @LTCXXCOMPILE@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAIN_LIB = @MAIN_LIB@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
MAN_SUBSTS = @MAN_SUBSTS@
MISC_MAN_DIR = @MISC_MAN_DIR@
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
@@ -337,6 +344,7 @@ NEED_STRLCAT_FALSE = @NEED_STRLCAT_FALSE@
NEED_STRLCAT_TRUE = @NEED_STRLCAT_TRUE@
NEED_VSNPRINTF_FALSE = @NEED_VSNPRINTF_FALSE@
NEED_VSNPRINTF_TRUE = @NEED_VSNPRINTF_TRUE@
+NM = @NM@
NMEDIT = @NMEDIT@
OBJC = @OBJC@
OBJCCLD = @OBJCCLD@
@@ -348,6 +356,8 @@ OBJEXT = @OBJEXT@
OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
OPENSSL_LIBS = @OPENSSL_LIBS@
OS_LIB = @OS_LIB@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
@@ -358,7 +368,6 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
PCIACCESS_LIBS = @PCIACCESS_LIBS@
PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
-PERL = @PERL@
PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
PIXMAN_LIBS = @PIXMAN_LIBS@
PKG_CONFIG = @PKG_CONFIG@
@@ -400,6 +409,7 @@ SPECIAL_DTRACE_OBJECTS_FALSE = @SPECIAL_DTRACE_OBJECTS_FALSE@
SPECIAL_DTRACE_OBJECTS_TRUE = @SPECIAL_DTRACE_OBJECTS_TRUE@
STANDALONE_XPBPROXY_FALSE = @STANDALONE_XPBPROXY_FALSE@
STANDALONE_XPBPROXY_TRUE = @STANDALONE_XPBPROXY_TRUE@
+STRICT_CFLAGS = @STRICT_CFLAGS@
STRIP = @STRIP@
STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@
SYSCONFDIR = @SYSCONFDIR@
@@ -409,8 +419,6 @@ TSLIB_LIBS = @TSLIB_LIBS@
TSLIB_TRUE = @TSLIB_TRUE@
UDEV_CFLAGS = @UDEV_CFLAGS@
UDEV_LIBS = @UDEV_LIBS@
-UNITTESTS_FALSE = @UNITTESTS_FALSE@
-UNITTESTS_TRUE = @UNITTESTS_TRUE@
UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
VBE_FALSE = @VBE_FALSE@
VBE_TRUE = @VBE_TRUE@
@@ -427,8 +435,6 @@ XAA_FALSE = @XAA_FALSE@
XAA_TRUE = @XAA_TRUE@
XACE_FALSE = @XACE_FALSE@
XACE_TRUE = @XACE_TRUE@
-XCALIBRATE_FALSE = @XCALIBRATE_FALSE@
-XCALIBRATE_TRUE = @XCALIBRATE_TRUE@
XCSECURITY_FALSE = @XCSECURITY_FALSE@
XCSECURITY_TRUE = @XCSECURITY_TRUE@
XDMAUTH_FALSE = @XDMAUTH_FALSE@
@@ -464,6 +470,11 @@ XINERAMA_TRUE = @XINERAMA_TRUE@
XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKB_DFLT_LAYOUT = @XKB_DFLT_LAYOUT@
+XKB_DFLT_MODEL = @XKB_DFLT_MODEL@
+XKB_DFLT_OPTIONS = @XKB_DFLT_OPTIONS@
+XKB_DFLT_RULES = @XKB_DFLT_RULES@
+XKB_DFLT_VARIANT = @XKB_DFLT_VARIANT@
XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
XLIB_CFLAGS = @XLIB_CFLAGS@
XLIB_LIBS = @XLIB_LIBS@
@@ -495,6 +506,7 @@ XORG_TRUE = @XORG_TRUE@
XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@
XPBPROXY_LIBS = @XPBPROXY_LIBS@
XQUARTZ_FALSE = @XQUARTZ_FALSE@
+XQUARTZ_LIBS = @XQUARTZ_LIBS@
XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@
XQUARTZ_SPARKLE_FALSE = @XQUARTZ_SPARKLE_FALSE@
XQUARTZ_SPARKLE_TRUE = @XQUARTZ_SPARKLE_TRUE@
@@ -513,6 +525,7 @@ XSERVER_DTRACE_FALSE = @XSERVER_DTRACE_FALSE@
XSERVER_DTRACE_TRUE = @XSERVER_DTRACE_TRUE@
XSERVER_LIBS = @XSERVER_LIBS@
XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XSLTPROC = @XSLTPROC@
XSL_STYLESHEET = @XSL_STYLESHEET@
XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
@@ -557,13 +570,11 @@ abi_ansic = @abi_ansic@
abi_extension = @abi_extension@
abi_videodrv = @abi_videodrv@
abi_xinput = @abi_xinput@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
-am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
-am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__fastdepOBJC_FALSE = @am__fastdepOBJC_FALSE@
am__fastdepOBJC_TRUE = @am__fastdepOBJC_TRUE@
am__include = @am__include@
diff --git a/xserver/Xi/chgdctl.c b/xserver/Xi/chgdctl.c
index 901a0e419..4c4aebac6 100644
--- a/xserver/Xi/chgdctl.c
+++ b/xserver/Xi/chgdctl.c
@@ -76,8 +76,6 @@ SProcXChangeDeviceControl(ClientPtr client)
{
char n;
xDeviceCtl *ctl;
- xDeviceAbsCalibCtl *calib;
- xDeviceAbsAreaCtl *area;
REQUEST(xChangeDeviceControlReq);
swaps(&stuff->length, n);
@@ -88,26 +86,7 @@ SProcXChangeDeviceControl(ClientPtr client)
swaps(&ctl->length, n);
switch(stuff->control) {
case DEVICE_ABS_CALIB:
- calib = (xDeviceAbsCalibCtl*)ctl;
- swaps(&calib->length, n);
- swapl(&calib->min_x, n);
- swapl(&calib->max_x, n);
- swapl(&calib->min_y, n);
- swapl(&calib->max_y, n);
- swapl(&calib->flip_x, n);
- swapl(&calib->flip_y, n);
- swapl(&calib->rotation, n);
- swapl(&calib->button_threshold, n);
- break;
case DEVICE_ABS_AREA:
- area = (xDeviceAbsAreaCtl*)ctl;
- swapl(&area->offset_x, n);
- swapl(&area->offset_y, n);
- swapl(&area->width, n);
- swapl(&area->height, n);
- swapl(&area->screen, n);
- swapl(&area->following, n);
- break;
case DEVICE_CORE:
case DEVICE_ENABLE:
case DEVICE_RESOLUTION:
@@ -134,8 +113,6 @@ ProcXChangeDeviceControl(ClientPtr client)
xChangeDeviceControlReply rep;
AxisInfoPtr a;
CARD32 *resolution;
- xDeviceAbsCalibCtl *calib;
- xDeviceAbsAreaCtl *area;
xDeviceEnableCtl *e;
devicePresenceNotify dpn;
@@ -193,53 +170,10 @@ ProcXChangeDeviceControl(ClientPtr client)
}
break;
case DEVICE_ABS_CALIB:
- calib = (xDeviceAbsCalibCtl *)&stuff[1];
-
- if (calib->button_threshold < 0 || calib->button_threshold > 255) {
- ret = BadValue;
- goto out;
- }
-
- status = ChangeDeviceControl(client, dev, (xDeviceCtl *) calib);
-
- if (status == Success) {
- dev->absolute->min_x = calib->min_x;
- dev->absolute->max_x = calib->max_x;
- dev->absolute->min_y = calib->min_y;
- dev->absolute->max_y = calib->max_y;
- dev->absolute->flip_x = calib->flip_x;
- dev->absolute->flip_y = calib->flip_y;
- dev->absolute->rotation = calib->rotation;
- dev->absolute->button_threshold = calib->button_threshold;
- ret = Success;
- } else if (status == DeviceBusy || status == BadValue) {
- rep.status = status;
- ret = Success;
- } else {
- ret = BadMatch;
- }
-
- break;
case DEVICE_ABS_AREA:
- area = (xDeviceAbsAreaCtl *)&stuff[1];
-
- status = ChangeDeviceControl(client, dev, (xDeviceCtl *) area);
-
- if (status == Success) {
- dev->absolute->offset_x = area->offset_x;
- dev->absolute->offset_y = area->offset_y;
- dev->absolute->width = area->width;
- dev->absolute->height = area->height;
- dev->absolute->screen = area->screen;
- dev->absolute->following = area->following;
- ret = Success;
- } else if (status == DeviceBusy || status == BadValue) {
- rep.status = status;
- ret = Success;
- } else {
- ret = Success;
- }
-
+ /* Calibration is now done through properties, and never had any effect
+ * on anything (in the open-source world). Thus, be honest. */
+ ret = BadMatch;
break;
case DEVICE_CORE:
/* Sorry, no device core switching no more. If you want a device to
diff --git a/xserver/Xi/closedev.c b/xserver/Xi/closedev.c
index e319c737a..1064be67b 100644
--- a/xserver/Xi/closedev.c
+++ b/xserver/Xi/closedev.c
@@ -162,6 +162,5 @@ ProcXCloseDevice(ClientPtr client)
DeleteEventsFromChildren(d, p1, client);
}
- CloseInputDevice(d, client);
return Success;
}
diff --git a/xserver/Xi/exevents.c b/xserver/Xi/exevents.c
index 6d88151db..3e3c67b63 100644
--- a/xserver/Xi/exevents.c
+++ b/xserver/Xi/exevents.c
@@ -77,6 +77,7 @@ SOFTWARE.
#include "xiquerydevice.h" /* For List*Info */
#include "eventconvert.h"
#include "eventstr.h"
+#include "inpututils.h"
#include <X11/extensions/XKBproto.h>
#include "xkbsrv.h"
@@ -111,13 +112,6 @@ XIShouldNotify(ClientPtr client, DeviceIntPtr dev)
return 0;
}
-void
-RegisterOtherDevice(DeviceIntPtr device)
-{
- device->public.processInputProc = ProcessOtherEvent;
- device->public.realInputProc = ProcessOtherEvent;
-}
-
Bool
IsPointerEvent(InternalEvent* event)
{
@@ -542,6 +536,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
if (from->valuator)
{
ValuatorClassPtr v;
+
if (!to->valuator)
{
classes = to->unused_classes;
@@ -550,20 +545,15 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
classes->valuator = NULL;
}
- to->valuator = realloc(to->valuator, sizeof(ValuatorClassRec) +
- from->valuator->numAxes * sizeof(AxisInfo) +
- from->valuator->numAxes * sizeof(double));
- v = to->valuator;
+ v = AllocValuatorClass(to->valuator, from->valuator->numAxes);
+
if (!v)
FatalError("[Xi] no memory for class shift.\n");
- v->numAxes = from->valuator->numAxes;
- v->axes = (AxisInfoPtr)&v[1];
+ to->valuator = v;
memcpy(v->axes, from->valuator->axes, v->numAxes * sizeof(AxisInfo));
- v->axisVal = (double*)(v->axes + from->valuator->numAxes);
v->sourceid = from->id;
- v->mode = from->valuator->mode;
} else if (to->valuator && !from->valuator)
{
ClassesPtr classes;
@@ -634,30 +624,6 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
classes->proximity = to->proximity;
to->proximity = NULL;
}
-
- if (from->absolute)
- {
- if (!to->absolute)
- {
- classes = to->unused_classes;
- to->absolute = classes->absolute;
- if (!to->absolute)
- {
- to->absolute = calloc(1, sizeof(AbsoluteClassRec));
- if (!to->absolute)
- FatalError("[Xi] no memory for class shift.\n");
- } else
- classes->absolute = NULL;
- }
- memcpy(to->absolute, from->absolute, sizeof(AbsoluteClassRec));
- to->absolute->sourceid = from->id;
- } else if (to->absolute)
- {
- ClassesPtr classes;
- classes = to->unused_classes;
- classes->absolute = to->absolute;
- to->absolute = NULL;
- }
}
/**
@@ -718,10 +684,13 @@ ChangeMasterDeviceClasses(DeviceIntPtr device, DeviceChangedEvent *dce)
if (rc != Success)
return; /* Device has disappeared */
- if (!slave->u.master)
+ if (IsMaster(slave))
+ return;
+
+ if (IsFloating(slave))
return; /* set floating since the event */
- if (slave->u.master->id != dce->masterid)
+ if (GetMaster(slave, MASTER_ATTACHED)->id != dce->masterid)
return; /* not our slave anymore, don't care */
/* FIXME: we probably need to send a DCE for the new slave now */
@@ -874,7 +843,7 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
* event being delivered through the slave first
*/
for (sd = inputInfo.devices; sd; sd = sd->next) {
- if (IsMaster(sd) || sd->u.master != device)
+ if (IsMaster(sd) || GetMaster(sd, MASTER_POINTER) != device)
continue;
if (!sd->button)
continue;
@@ -900,39 +869,13 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
mask = PointerMotionMask | b->state | b->motionMask;
SetMaskForEvent(device->id, mask, MotionNotify);
} else if (event->type == ET_ProximityIn)
- device->valuator->mode &= ~OutOfProximity;
+ device->proximity->in_proximity = TRUE;
else if (event->type == ET_ProximityOut)
- device->valuator->mode |= OutOfProximity;
+ device->proximity->in_proximity = FALSE;
return DEFAULT;
}
-static void
-ProcessRawEvent(RawDeviceEvent *ev, DeviceIntPtr device)
-{
- GrabPtr grab = device->deviceGrab.grab;
-
- if (grab)
- DeliverGrabbedEvent((InternalEvent*)ev, device, FALSE);
- else { /* deliver to all root windows */
- xEvent *xi;
- int i;
-
- i = EventToXI2((InternalEvent*)ev, (xEvent**)&xi);
- if (i != Success)
- {
- ErrorF("[Xi] %s: XI2 conversion failed in ProcessRawEvent (%d)\n",
- device->name, i);
- return;
- }
-
- for (i = 0; i < screenInfo.numScreens; i++)
- DeliverEventsToWindow(device, screenInfo.screens[i]->root, xi, 1,
- GetEventFilter(device, xi), NULL);
- free(xi);
- }
-}
-
/**
* Main device event processing function.
* Called from when processing the events from the event queue.
@@ -952,7 +895,7 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
DeviceIntPtr mouse = NULL, kbd = NULL;
DeviceEvent *event = &ev->device_event;
- CHECKEVENT(ev);
+ verify_internal_event(ev);
if (ev->any.type == ET_RawKeyPress ||
ev->any.type == ET_RawKeyRelease ||
@@ -960,7 +903,7 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
ev->any.type == ET_RawButtonRelease ||
ev->any.type == ET_RawMotion)
{
- ProcessRawEvent(&ev->raw_event, device);
+ DeliverRawEvent(&ev->raw_event, device);
return;
}
@@ -1014,7 +957,7 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
b = device->button;
k = device->key;
- if (IsMaster(device) || !device->u.master)
+ if (IsMaster(device) || IsFloating(device))
CheckMotion(event, device);
switch (event->type)
@@ -1055,10 +998,8 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
switch(event->type)
{
case ET_KeyPress:
- if (!grab && CheckDeviceGrabs(device, event, 0)) {
- device->deviceGrab.activatingKey = key;
+ if (!grab && CheckDeviceGrabs(device, event, 0))
return;
- }
break;
case ET_KeyRelease:
if (grab && device->deviceGrab.fromPassiveGrab &&
@@ -1121,6 +1062,7 @@ InitProximityClassDeviceStruct(DeviceIntPtr dev)
if (!proxc)
return FALSE;
proxc->sourceid = dev->id;
+ proxc->in_proximity = TRUE;
dev->proximity = proxc;
return TRUE;
}
@@ -1136,7 +1078,7 @@ InitProximityClassDeviceStruct(DeviceIntPtr dev)
*/
void
InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval, int maxval,
- int resolution, int min_res, int max_res)
+ int resolution, int min_res, int max_res, int mode)
{
AxisInfoPtr ax;
@@ -1153,6 +1095,10 @@ InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval, int
ax->min_resolution = min_res;
ax->max_resolution = max_res;
ax->label = label;
+ ax->mode = mode;
+
+ if (mode & OutOfProximity)
+ dev->proximity->in_proximity = FALSE;
}
static void
@@ -1181,7 +1127,7 @@ FixDeviceStateNotify(DeviceIntPtr dev, deviceStateNotify * ev, KeyClassPtr k,
int nval = v->numAxes - first;
ev->classes_reported |= (1 << ValuatorClass);
- ev->classes_reported |= (dev->valuator->mode << ModeBitsShift);
+ ev->classes_reported |= valuator_get_mode(dev, 0) << ModeBitsShift;
ev->num_valuators = nval < 3 ? nval : 3;
switch (ev->num_valuators) {
case 3:
@@ -1217,6 +1163,108 @@ FixDeviceValuator(DeviceIntPtr dev, deviceValuator * ev, ValuatorClassPtr v,
first += ev->num_valuators;
}
+static void
+DeliverStateNotifyEvent(DeviceIntPtr dev, WindowPtr win)
+{
+ int evcount = 1;
+ deviceStateNotify *ev, *sev;
+ deviceKeyStateNotify *kev;
+ deviceButtonStateNotify *bev;
+
+ KeyClassPtr k;
+ ButtonClassPtr b;
+ ValuatorClassPtr v;
+ int nval = 0, nkeys = 0, nbuttons = 0, first = 0;
+
+ if (!(wOtherInputMasks(win)) ||
+ !(wOtherInputMasks(win)->inputEvents[dev->id] & DeviceStateNotifyMask))
+ return;
+
+ if ((b = dev->button) != NULL) {
+ nbuttons = b->numButtons;
+ if (nbuttons > 32)
+ evcount++;
+ }
+ if ((k = dev->key) != NULL) {
+ nkeys = k->xkbInfo->desc->max_key_code -
+ k->xkbInfo->desc->min_key_code;
+ if (nkeys > 32)
+ evcount++;
+ if (nbuttons > 0) {
+ evcount++;
+ }
+ }
+ if ((v = dev->valuator) != NULL) {
+ nval = v->numAxes;
+
+ if (nval > 3)
+ evcount++;
+ if (nval > 6) {
+ if (!(k && b))
+ evcount++;
+ if (nval > 9)
+ evcount += ((nval - 7) / 3);
+ }
+ }
+
+ sev = ev = (deviceStateNotify *) malloc(evcount * sizeof(xEvent));
+ FixDeviceStateNotify(dev, ev, NULL, NULL, NULL, first);
+
+ if (b != NULL) {
+ FixDeviceStateNotify(dev, ev++, NULL, b, v, first);
+ first += 3;
+ nval -= 3;
+ if (nbuttons > 32) {
+ (ev - 1)->deviceid |= MORE_EVENTS;
+ bev = (deviceButtonStateNotify *) ev++;
+ bev->type = DeviceButtonStateNotify;
+ bev->deviceid = dev->id;
+ memcpy((char*)&bev->buttons[4], (char*)&b->down[4], DOWN_LENGTH - 4);
+ }
+ if (nval > 0) {
+ (ev - 1)->deviceid |= MORE_EVENTS;
+ FixDeviceValuator(dev, (deviceValuator *) ev++, v, first);
+ first += 3;
+ nval -= 3;
+ }
+ }
+
+ if (k != NULL) {
+ FixDeviceStateNotify(dev, ev++, k, NULL, v, first);
+ first += 3;
+ nval -= 3;
+ if (nkeys > 32) {
+ (ev - 1)->deviceid |= MORE_EVENTS;
+ kev = (deviceKeyStateNotify *) ev++;
+ kev->type = DeviceKeyStateNotify;
+ kev->deviceid = dev->id;
+ memmove((char *)&kev->keys[0], (char *)&k->down[4], 28);
+ }
+ if (nval > 0) {
+ (ev - 1)->deviceid |= MORE_EVENTS;
+ FixDeviceValuator(dev, (deviceValuator *) ev++, v, first);
+ first += 3;
+ nval -= 3;
+ }
+ }
+
+ while (nval > 0) {
+ FixDeviceStateNotify(dev, ev++, NULL, NULL, v, first);
+ first += 3;
+ nval -= 3;
+ if (nval > 0) {
+ (ev - 1)->deviceid |= MORE_EVENTS;
+ FixDeviceValuator(dev, (deviceValuator *) ev++, v, first);
+ first += 3;
+ nval -= 3;
+ }
+ }
+
+ DeliverEventsToWindow(dev, win, (xEvent *) sev, evcount,
+ DeviceStateNotifyMask, NullGrab);
+ free(sev);
+}
+
void
DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
WindowPtr pWin)
@@ -1226,7 +1274,7 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
DeviceIntPtr mouse;
int btlen, len, i;
- mouse = (IsMaster(dev) || dev->u.master) ? GetMaster(dev, MASTER_POINTER) : dev;
+ mouse = IsFloating(dev) ? dev : GetMaster(dev, MASTER_POINTER);
/* XI 2 event */
btlen = (mouse->button) ? bits_to_bytes(mouse->button->numButtons) : 0;
@@ -1264,7 +1312,8 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
xi2event->group.effective_group = dev->key->xkbInfo->state.group;
}
- FixUpEventFromWindow(dev, (xEvent*)xi2event, pWin, None, FALSE);
+ FixUpEventFromWindow(dev->spriteInfo->sprite, (xEvent*)xi2event, pWin,
+ None, FALSE);
DeliverEventsToWindow(dev, pWin, (xEvent*)xi2event, 1,
GetEventFilter(dev, (xEvent*)xi2event), NullGrab);
@@ -1282,104 +1331,8 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
DeliverEventsToWindow(dev, pWin, (xEvent *) & event, 1,
DeviceFocusChangeMask, NullGrab);
- if ((type == DeviceFocusIn) &&
- (wOtherInputMasks(pWin)) &&
- (wOtherInputMasks(pWin)->inputEvents[dev->id] & DeviceStateNotifyMask))
- {
- int evcount = 1;
- deviceStateNotify *ev, *sev;
- deviceKeyStateNotify *kev;
- deviceButtonStateNotify *bev;
-
- KeyClassPtr k;
- ButtonClassPtr b;
- ValuatorClassPtr v;
- int nval = 0, nkeys = 0, nbuttons = 0, first = 0;
-
- if ((b = dev->button) != NULL) {
- nbuttons = b->numButtons;
- if (nbuttons > 32)
- evcount++;
- }
- if ((k = dev->key) != NULL) {
- nkeys = k->xkbInfo->desc->max_key_code -
- k->xkbInfo->desc->min_key_code;
- if (nkeys > 32)
- evcount++;
- if (nbuttons > 0) {
- evcount++;
- }
- }
- if ((v = dev->valuator) != NULL) {
- nval = v->numAxes;
-
- if (nval > 3)
- evcount++;
- if (nval > 6) {
- if (!(k && b))
- evcount++;
- if (nval > 9)
- evcount += ((nval - 7) / 3);
- }
- }
-
- sev = ev = (deviceStateNotify *) malloc(evcount * sizeof(xEvent));
- FixDeviceStateNotify(dev, ev, NULL, NULL, NULL, first);
-
- if (b != NULL) {
- FixDeviceStateNotify(dev, ev++, NULL, b, v, first);
- first += 3;
- nval -= 3;
- if (nbuttons > 32) {
- (ev - 1)->deviceid |= MORE_EVENTS;
- bev = (deviceButtonStateNotify *) ev++;
- bev->type = DeviceButtonStateNotify;
- bev->deviceid = dev->id;
- memcpy((char*)&bev->buttons[4], (char*)&b->down[4], DOWN_LENGTH - 4);
- }
- if (nval > 0) {
- (ev - 1)->deviceid |= MORE_EVENTS;
- FixDeviceValuator(dev, (deviceValuator *) ev++, v, first);
- first += 3;
- nval -= 3;
- }
- }
-
- if (k != NULL) {
- FixDeviceStateNotify(dev, ev++, k, NULL, v, first);
- first += 3;
- nval -= 3;
- if (nkeys > 32) {
- (ev - 1)->deviceid |= MORE_EVENTS;
- kev = (deviceKeyStateNotify *) ev++;
- kev->type = DeviceKeyStateNotify;
- kev->deviceid = dev->id;
- memmove((char *)&kev->keys[0], (char *)&k->down[4], 28);
- }
- if (nval > 0) {
- (ev - 1)->deviceid |= MORE_EVENTS;
- FixDeviceValuator(dev, (deviceValuator *) ev++, v, first);
- first += 3;
- nval -= 3;
- }
- }
-
- while (nval > 0) {
- FixDeviceStateNotify(dev, ev++, NULL, NULL, v, first);
- first += 3;
- nval -= 3;
- if (nval > 0) {
- (ev - 1)->deviceid |= MORE_EVENTS;
- FixDeviceValuator(dev, (deviceValuator *) ev++, v, first);
- first += 3;
- nval -= 3;
- }
- }
-
- DeliverEventsToWindow(dev, pWin, (xEvent *) sev, evcount,
- DeviceStateNotifyMask, NullGrab);
- free(sev);
- }
+ if (event.type == DeviceFocusIn)
+ DeliverStateNotifyEvent(dev, pWin);
}
int
@@ -1632,14 +1585,18 @@ AddExtensionClient(WindowPtr pWin, ClientPtr client, Mask mask, int mskidx)
if (!others)
return BadAlloc;
if (!pWin->optional->inputMasks && !MakeInputMasks(pWin))
- return BadAlloc;
+ goto bail;
others->mask[mskidx] = mask;
others->resource = FakeClientID(client->index);
others->next = pWin->optional->inputMasks->inputClients;
pWin->optional->inputMasks->inputClients = others;
if (!AddResource(others->resource, RT_INPUTCLIENT, (pointer) pWin))
- return BadAlloc;
+ goto bail;
return Success;
+
+bail:
+ free(others);
+ return BadAlloc;
}
static Bool
diff --git a/xserver/Xi/exglobals.h b/xserver/Xi/exglobals.h
index f7557079e..8c5a42e6e 100644
--- a/xserver/Xi/exglobals.h
+++ b/xserver/Xi/exglobals.h
@@ -76,7 +76,7 @@ extern int ChangeDeviceNotify;
extern int DevicePresenceNotify;
extern int DevicePropertyNotify;
-extern int RT_INPUTCLIENT;
+extern RESTYPE RT_INPUTCLIENT;
extern DevPrivateKeyRec XIClientPrivateKeyRec;
#define XIClientPrivateKey (&XIClientPrivateKeyRec)
diff --git a/xserver/Xi/extinit.c b/xserver/Xi/extinit.c
index ab91ce640..0905e1877 100644
--- a/xserver/Xi/extinit.c
+++ b/xserver/Xi/extinit.c
@@ -84,7 +84,6 @@ SOFTWARE.
#include "closedev.h"
#include "devbell.h"
#include "getbmap.h"
-#include "getbmap.h"
#include "getdctl.h"
#include "getfctl.h"
#include "getfocus.h"
@@ -93,7 +92,6 @@ SOFTWARE.
#include "getprop.h"
#include "getselev.h"
#include "getvers.h"
-#include "getvers.h"
#include "grabdev.h"
#include "grabdevb.h"
#include "grabdevk.h"
@@ -359,7 +357,7 @@ int ChangeDeviceNotify;
int DevicePresenceNotify;
int DevicePropertyNotify;
-int RT_INPUTCLIENT;
+RESTYPE RT_INPUTCLIENT;
/*****************************************************************
*
@@ -511,7 +509,7 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
SRepXIQueryDevice(client, len, (xXIQueryDeviceReply*)rep);
else if (rep->RepType == X_XIGrabDevice)
SRepXIGrabDevice(client, len, (xXIGrabDeviceReply *) rep);
- else if (rep->RepType == X_XIGrabDevice)
+ else if (rep->RepType == X_XIPassiveGrabDevice)
SRepXIPassiveGrabDevice(client, len, (xXIPassiveGrabDeviceReply *) rep);
else if (rep->RepType == X_XIListProperties)
SRepXIListProperties(client, len, (xXIListPropertiesReply *) rep);
@@ -758,6 +756,7 @@ static void SDeviceEvent(xXIDeviceEvent *from, xXIDeviceEvent *to)
swapl(&to->mods.latched_mods, n);
swapl(&to->mods.locked_mods, n);
swapl(&to->mods.effective_mods, n);
+ swapl(&to->flags, n);
ptr = (char*)(&to[1]);
ptr += from->buttons_len * 4;
@@ -1155,8 +1154,7 @@ void
AssignTypeAndName(DeviceIntPtr dev, Atom type, char *name)
{
dev->xinput_type = type;
- dev->name = (char *)malloc(strlen(name) + 1);
- strcpy(dev->name, name);
+ dev->name = strdup(name);
}
/***********************************************************************
diff --git a/xserver/Xi/getdctl.c b/xserver/Xi/getdctl.c
index 3e81e9479..4e04b8b06 100644
--- a/xserver/Xi/getdctl.c
+++ b/xserver/Xi/getdctl.c
@@ -118,64 +118,6 @@ CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf,
}
}
-static void CopySwapDeviceAbsCalib (ClientPtr client, AbsoluteClassPtr dts,
- char *buf)
-{
- char n;
- xDeviceAbsCalibState *calib = (xDeviceAbsCalibState *) buf;
-
- calib->control = DEVICE_ABS_CALIB;
- calib->length = sizeof(xDeviceAbsCalibState);
- calib->min_x = dts->min_x;
- calib->max_x = dts->max_x;
- calib->min_y = dts->min_y;
- calib->max_y = dts->max_y;
- calib->flip_x = dts->flip_x;
- calib->flip_y = dts->flip_y;
- calib->rotation = dts->rotation;
- calib->button_threshold = dts->button_threshold;
-
- if (client->swapped) {
- swaps(&calib->control, n);
- swaps(&calib->length, n);
- swapl(&calib->min_x, n);
- swapl(&calib->max_x, n);
- swapl(&calib->min_y, n);
- swapl(&calib->max_y, n);
- swapl(&calib->flip_x, n);
- swapl(&calib->flip_y, n);
- swapl(&calib->rotation, n);
- swapl(&calib->button_threshold, n);
- }
-}
-
-static void CopySwapDeviceAbsArea (ClientPtr client, AbsoluteClassPtr dts,
- char *buf)
-{
- char n;
- xDeviceAbsAreaState *area = (xDeviceAbsAreaState *) buf;
-
- area->control = DEVICE_ABS_AREA;
- area->length = sizeof(xDeviceAbsAreaState);
- area->offset_x = dts->offset_x;
- area->offset_y = dts->offset_y;
- area->width = dts->width;
- area->height = dts->height;
- area->screen = dts->screen;
- area->following = dts->following;
-
- if (client->swapped) {
- swaps(&area->control, n);
- swaps(&area->length, n);
- swapl(&area->offset_x, n);
- swapl(&area->offset_y, n);
- swapl(&area->width, n);
- swapl(&area->height, n);
- swapl(&area->screen, n);
- swapl(&area->following, n);
- }
-}
-
static void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf)
{
char n;
@@ -260,17 +202,8 @@ ProcXGetDeviceControl(ClientPtr client)
(3 * sizeof(int) * dev->valuator->numAxes);
break;
case DEVICE_ABS_CALIB:
- if (!dev->absolute)
- return BadMatch;
-
- total_length = sizeof(xDeviceAbsCalibState);
- break;
case DEVICE_ABS_AREA:
- if (!dev->absolute)
- return BadMatch;
-
- total_length = sizeof(xDeviceAbsAreaState);
- break;
+ return BadMatch;
case DEVICE_CORE:
total_length = sizeof(xDeviceCoreState);
break;
@@ -290,12 +223,6 @@ ProcXGetDeviceControl(ClientPtr client)
case DEVICE_RESOLUTION:
CopySwapDeviceResolution(client, dev->valuator, buf, total_length);
break;
- case DEVICE_ABS_CALIB:
- CopySwapDeviceAbsCalib(client, dev->absolute, buf);
- break;
- case DEVICE_ABS_AREA:
- CopySwapDeviceAbsArea(client, dev->absolute, buf);
- break;
case DEVICE_CORE:
CopySwapDeviceCore(client, dev, buf);
break;
diff --git a/xserver/Xi/getprop.c b/xserver/Xi/getprop.c
index ba98fc80f..5e102627d 100644
--- a/xserver/Xi/getprop.c
+++ b/xserver/Xi/getprop.c
@@ -115,7 +115,7 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
if ((others = wOtherInputMasks(pWin)) != 0) {
for (i = 0; i < EMASKSIZE; i++)
- tbuf = ClassFromMask(NULL, others->dontPropagateMask[i], i,
+ ClassFromMask(NULL, others->dontPropagateMask[i], i,
&count, COUNT);
if (count) {
rep.count = count;
diff --git a/xserver/Xi/getselev.c b/xserver/Xi/getselev.c
index d63b661cd..7304738b3 100644
--- a/xserver/Xi/getselev.c
+++ b/xserver/Xi/getselev.c
@@ -118,13 +118,13 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
if ((pOthers = wOtherInputMasks(pWin)) != 0) {
for (others = pOthers->inputClients; others; others = others->next)
for (i = 0; i < EMASKSIZE; i++)
- tclient = ClassFromMask(NULL, others->mask[i], i,
+ ClassFromMask(NULL, others->mask[i], i,
&rep.all_clients_count, COUNT);
for (others = pOthers->inputClients; others; others = others->next)
if (SameClient(others, client)) {
for (i = 0; i < EMASKSIZE; i++)
- tclient = ClassFromMask(NULL, others->mask[i], i,
+ ClassFromMask(NULL, others->mask[i], i,
&rep.this_client_count, COUNT);
break;
}
@@ -152,8 +152,8 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
if (total_length) {
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, total_length, buf);
- free(buf);
}
+ free(buf);
return Success;
}
diff --git a/xserver/Xi/listdev.c b/xserver/Xi/listdev.c
index b38fbd1c0..29f0d96e3 100644
--- a/xserver/Xi/listdev.c
+++ b/xserver/Xi/listdev.c
@@ -230,10 +230,11 @@ CopySwapKeyClass(ClientPtr client, KeyClassPtr k, char **buf)
*/
static int
-CopySwapValuatorClass(ClientPtr client, ValuatorClassPtr v, char **buf)
+CopySwapValuatorClass(ClientPtr client, DeviceIntPtr dev, char **buf)
{
int i, j, axes, t_axes;
char n;
+ ValuatorClassPtr v = dev->valuator;
xValuatorInfoPtr v2;
AxisInfo *a;
xAxisInfoPtr a2;
@@ -247,7 +248,7 @@ CopySwapValuatorClass(ClientPtr client, ValuatorClassPtr v, char **buf)
v2->class = ValuatorClass;
v2->length = sizeof(xValuatorInfo) + t_axes * sizeof(xAxisInfo);
v2->num_axes = t_axes;
- v2->mode = v->mode & DeviceMode;
+ v2->mode = valuator_get_mode(dev, 0);
v2->motion_buffer_size = v->numMotionEvents;
if (client && client->swapped) {
swapl(&v2->motion_buffer_size, n);
@@ -286,7 +287,7 @@ CopySwapClasses(ClientPtr client, DeviceIntPtr dev, CARD8 *num_classes,
}
if (dev->valuator != NULL) {
(*num_classes) +=
- CopySwapValuatorClass(client, dev->valuator, classbuf);
+ CopySwapValuatorClass(client, dev, classbuf);
}
}
@@ -356,9 +357,6 @@ ProcXListInputDevices(ClientPtr client)
rep.length = 0;
rep.sequenceNumber = client->sequence;
-
- AddOtherInputDevices();
-
/* allocate space for saving skip value */
skip = calloc(sizeof(Bool), inputInfo.numDevices);
if (!skip)
diff --git a/xserver/Xi/opendev.c b/xserver/Xi/opendev.c
index e4c02d32a..13841dc4f 100644
--- a/xserver/Xi/opendev.c
+++ b/xserver/Xi/opendev.c
@@ -115,7 +115,6 @@ ProcXOpenDevice(ClientPtr client)
if (IsMaster(dev))
return BadDevice;
- OpenInputDevice(dev, client, &status);
if (status != Success)
return status;
diff --git a/xserver/Xi/queryst.c b/xserver/Xi/queryst.c
index 65a43d1d2..73af76d22 100644
--- a/xserver/Xi/queryst.c
+++ b/xserver/Xi/queryst.c
@@ -151,7 +151,8 @@ ProcXQueryDeviceState(ClientPtr client)
tv->class = ValuatorClass;
tv->length = sizeof(xValuatorState) + v->numAxes * 4;
tv->num_valuators = v->numAxes;
- tv->mode = v->mode;
+ tv->mode = valuator_get_mode(dev, 0);
+ tv->mode |= (dev->proximity && !dev->proximity->in_proximity) ? OutOfProximity : 0;
buf += sizeof(xValuatorState);
for (i = 0, values = v->axisVal; i < v->numAxes; i++) {
if (rc != BadAccess)
diff --git a/xserver/Xi/setmode.c b/xserver/Xi/setmode.c
index ce2ad47c7..42e90f75d 100644
--- a/xserver/Xi/setmode.c
+++ b/xserver/Xi/setmode.c
@@ -110,7 +110,7 @@ ProcXSetDeviceMode(ClientPtr client)
rep.status = SetDeviceMode(client, dev, stuff->mode);
if (rep.status == Success)
- dev->valuator->mode = stuff->mode;
+ valuator_set_mode(dev, VALUATOR_MODE_ALL_AXES, stuff->mode);
else if (rep.status != AlreadyGrabbed)
{
switch(rep.status) {
diff --git a/xserver/Xi/stubs.c b/xserver/Xi/stubs.c
index 296a8c4a5..6a4c18158 100644
--- a/xserver/Xi/stubs.c
+++ b/xserver/Xi/stubs.c
@@ -66,96 +66,6 @@ SOFTWARE.
#include "XIstubs.h"
#include "xace.h"
-/***********************************************************************
- *
- * Caller: ProcXCloseDevice
- *
- * Take care of implementation-dependent details of closing a device.
- * Some implementations may actually close the device, others may just
- * remove this clients interest in that device.
- *
- * The default implementation is to do nothing (assume all input devices
- * are initialized during X server initialization and kept open).
- *
- */
-
-void
-CloseInputDevice(DeviceIntPtr d, ClientPtr client)
-{
-}
-
-/***********************************************************************
- *
- * Caller: ProcXListInputDevices
- *
- * This is the implementation-dependent routine to initialize an input
- * device to the point that information about it can be listed.
- * Some implementations open all input devices when the server is first
- * initialized, and never close them. Other implementations open only
- * the X pointer and keyboard devices during server initialization,
- * and only open other input devices when some client makes an
- * XOpenDevice request. If some other process has the device open, the
- * server may not be able to get information about the device to list it.
- *
- * This procedure should be used by implementations that do not initialize
- * all input devices at server startup. It should do device-dependent
- * initialization for any devices not previously initialized, and call
- * AddInputDevice for each of those devices so that a DeviceIntRec will be
- * created for them.
- *
- * The default implementation is to do nothing (assume all input devices
- * are initialized during X server initialization and kept open).
- * The commented-out sample code shows what you might do if you don't want
- * the default.
- *
- */
-
-void
-AddOtherInputDevices(void)
-{
- /**********************************************************************
- for each uninitialized device, do something like:
-
- DeviceIntPtr dev;
- DeviceProc deviceProc;
- pointer private;
-
- dev = (DeviceIntPtr) AddInputDevice(deviceProc, TRUE);
- dev->public.devicePrivate = private;
- RegisterOtherDevice(dev);
- dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success);
- ************************************************************************/
-
-}
-
-/***********************************************************************
- *
- * Caller: ProcXOpenDevice
- *
- * This is the implementation-dependent routine to open an input device.
- * Some implementations open all input devices when the server is first
- * initialized, and never close them. Other implementations open only
- * the X pointer and keyboard devices during server initialization,
- * and only open other input devices when some client makes an
- * XOpenDevice request. This entry point is for the latter type of
- * implementation.
- *
- * If the physical device is not already open, do it here. In this case,
- * you need to keep track of the fact that one or more clients has the
- * device open, and physically close it when the last client that has
- * it open does an XCloseDevice.
- *
- * The default implementation is to do nothing (assume all input devices
- * are opened during X server initialization and kept open).
- *
- */
-
-void
-OpenInputDevice(DeviceIntPtr dev, ClientPtr client, int *status)
-{
- *status = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixUseAccess);
-}
-
/****************************************************************************
*
* Caller: ProcXSetDeviceMode
@@ -205,17 +115,7 @@ int
ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev,
xDeviceCtl * control)
{
- switch (control->control) {
- case DEVICE_RESOLUTION:
- return BadMatch;
- case DEVICE_ABS_CALIB:
- case DEVICE_ABS_AREA:
- return BadMatch;
- case DEVICE_CORE:
- return BadMatch;
- default:
- return BadMatch;
- }
+ return BadMatch;
}
diff --git a/xserver/Xi/xichangehierarchy.c b/xserver/Xi/xichangehierarchy.c
index c1899e109..96ead6fcd 100644
--- a/xserver/Xi/xichangehierarchy.c
+++ b/xserver/Xi/xichangehierarchy.c
@@ -70,6 +70,8 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
ev = calloc(1, sizeof(xXIHierarchyEvent) +
MAXDEVICES * sizeof(xXIHierarchyInfo));
+ if (!ev)
+ return;
ev->type = GenericEvent;
ev->extension = IReqCode;
ev->evtype = XI_HierarchyChanged;
@@ -114,7 +116,9 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
ev->length = bytes_to_int32(ev->num_info * sizeof(xXIHierarchyInfo));
+ memset(&dummyDev, 0, sizeof(dummyDev));
dummyDev.id = XIAllDevices;
+ dummyDev.type = SLAVE;
SendEventToAllWindows(&dummyDev, (XI_HierarchyChangedMask >> 8), (xEvent*)ev, 1);
free(ev);
}
@@ -136,12 +140,288 @@ int SProcXIChangeHierarchy(ClientPtr client)
return (ProcXIChangeHierarchy(client));
}
+static int
+add_master(ClientPtr client, xXIAddMasterInfo *c, int flags[MAXDEVICES])
+{
+ DeviceIntPtr ptr, keybd, XTestptr, XTestkeybd;
+ char* name;
+ int rc;
+
+ name = calloc(c->name_len + 1, sizeof(char));
+ strncpy(name, (char*)&c[1], c->name_len);
+
+ rc = AllocDevicePair(client, name, &ptr, &keybd,
+ CorePointerProc, CoreKeyboardProc, TRUE);
+ if (rc != Success)
+ goto unwind;
+
+ if (!c->send_core)
+ ptr->coreEvents = keybd->coreEvents = FALSE;
+
+ /* Allocate virtual slave devices for xtest events */
+ rc = AllocXTestDevice(client, name, &XTestptr, &XTestkeybd, ptr, keybd);
+ if (rc != Success)
+ {
+ DeleteInputDeviceRequest(ptr);
+ DeleteInputDeviceRequest(keybd);
+ goto unwind;
+ }
+
+ ActivateDevice(ptr, FALSE);
+ ActivateDevice(keybd, FALSE);
+ flags[ptr->id] |= XIMasterAdded;
+ flags[keybd->id] |= XIMasterAdded;
+
+ ActivateDevice(XTestptr, FALSE);
+ ActivateDevice(XTestkeybd, FALSE);
+ flags[XTestptr->id] |= XISlaveAdded;
+ flags[XTestkeybd->id] |= XISlaveAdded;
+
+ if (c->enable)
+ {
+ EnableDevice(ptr, FALSE);
+ EnableDevice(keybd, FALSE);
+ flags[ptr->id] |= XIDeviceEnabled;
+ flags[keybd->id] |= XIDeviceEnabled;
+
+ EnableDevice(XTestptr, FALSE);
+ EnableDevice(XTestkeybd, FALSE);
+ flags[XTestptr->id] |= XIDeviceEnabled;
+ flags[XTestkeybd->id] |= XIDeviceEnabled;
+ }
+
+ /* Attach the XTest virtual devices to the newly
+ created master device */
+ AttachDevice(NULL, XTestptr, ptr);
+ AttachDevice(NULL, XTestkeybd, keybd);
+ flags[XTestptr->id] |= XISlaveAttached;
+ flags[XTestkeybd->id] |= XISlaveAttached;
+
+unwind:
+ free(name);
+ return rc;
+}
+
+static int
+remove_master(ClientPtr client, xXIRemoveMasterInfo *r,
+ int flags[MAXDEVICES])
+{
+ DeviceIntPtr ptr, keybd, XTestptr, XTestkeybd;
+ int rc = Success;
+
+ if (r->return_mode != XIAttachToMaster &&
+ r->return_mode != XIFloating)
+ return BadValue;
+
+ rc = dixLookupDevice(&ptr, r->deviceid, client, DixDestroyAccess);
+ if (rc != Success)
+ goto unwind;
+
+ if (!IsMaster(ptr))
+ {
+ client->errorValue = r->deviceid;
+ rc = BadDevice;
+ goto unwind;
+ }
+
+ /* XXX: For now, don't allow removal of VCP, VCK */
+ if (ptr == inputInfo.pointer || ptr == inputInfo.keyboard)
+ {
+ rc = BadDevice;
+ goto unwind;
+ }
+
+
+ ptr = GetMaster(ptr, MASTER_POINTER);
+ rc = dixLookupDevice(&ptr, ptr->id, client, DixDestroyAccess);
+ if (rc != Success)
+ goto unwind;
+ keybd = GetMaster(ptr, MASTER_KEYBOARD);
+ rc = dixLookupDevice(&keybd, keybd->id, client, DixDestroyAccess);
+ if (rc != Success)
+ goto unwind;
+
+ XTestptr = GetXTestDevice(ptr);
+ rc = dixLookupDevice(&XTestptr, XTestptr->id, client, DixDestroyAccess);
+ if (rc != Success)
+ goto unwind;
+
+ XTestkeybd = GetXTestDevice(keybd);
+ rc = dixLookupDevice(&XTestkeybd, XTestkeybd->id, client,
+ DixDestroyAccess);
+ if (rc != Success)
+ goto unwind;
+
+ /* Disabling sends the devices floating, reattach them if
+ * desired. */
+ if (r->return_mode == XIAttachToMaster)
+ {
+ DeviceIntPtr attached,
+ newptr,
+ newkeybd;
+
+ rc = dixLookupDevice(&newptr, r->return_pointer, client, DixAddAccess);
+ if (rc != Success)
+ goto unwind;
+
+ if (!IsMaster(newptr))
+ {
+ client->errorValue = r->return_pointer;
+ rc = BadDevice;
+ goto unwind;
+ }
+
+ rc = dixLookupDevice(&newkeybd, r->return_keyboard,
+ client, DixAddAccess);
+ if (rc != Success)
+ goto unwind;
+
+ if (!IsMaster(newkeybd))
+ {
+ client->errorValue = r->return_keyboard;
+ rc = BadDevice;
+ goto unwind;
+ }
+
+ for (attached = inputInfo.devices; attached; attached = attached->next)
+ {
+ if (!IsMaster(attached)) {
+ if (GetMaster(attached, MASTER_ATTACHED) == ptr)
+ {
+ AttachDevice(client, attached, newptr);
+ flags[attached->id] |= XISlaveAttached;
+ }
+ if (GetMaster(attached, MASTER_ATTACHED) == keybd)
+ {
+ AttachDevice(client, attached, newkeybd);
+ flags[attached->id] |= XISlaveAttached;
+ }
+ }
+ }
+ }
+
+ /* can't disable until we removed pairing */
+ keybd->spriteInfo->paired = NULL;
+ ptr->spriteInfo->paired = NULL;
+ XTestptr->spriteInfo->paired = NULL;
+ XTestkeybd->spriteInfo->paired = NULL;
+
+ /* disable the remove the devices, XTest devices must be done first
+ else the sprites they rely on will be destroyed */
+ DisableDevice(XTestptr, FALSE);
+ DisableDevice(XTestkeybd, FALSE);
+ DisableDevice(keybd, FALSE);
+ DisableDevice(ptr, FALSE);
+ flags[XTestptr->id] |= XIDeviceDisabled | XISlaveDetached;
+ flags[XTestkeybd->id] |= XIDeviceDisabled | XISlaveDetached;
+ flags[keybd->id] |= XIDeviceDisabled;
+ flags[ptr->id] |= XIDeviceDisabled;
+
+ RemoveDevice(XTestptr, FALSE);
+ RemoveDevice(XTestkeybd, FALSE);
+ RemoveDevice(keybd, FALSE);
+ RemoveDevice(ptr, FALSE);
+ flags[XTestptr->id] |= XISlaveRemoved;
+ flags[XTestkeybd->id] |= XISlaveRemoved;
+ flags[keybd->id] |= XIMasterRemoved;
+ flags[ptr->id] |= XIMasterRemoved;
+
+unwind:
+ return rc;
+}
+
+static int
+detach_slave(ClientPtr client, xXIDetachSlaveInfo *c, int flags[MAXDEVICES])
+{
+ DeviceIntPtr dev;
+ int rc;
+
+ rc = dixLookupDevice(&dev, c->deviceid, client, DixManageAccess);
+ if (rc != Success)
+ goto unwind;
+
+ if (IsMaster(dev))
+ {
+ client->errorValue = c->deviceid;
+ rc = BadDevice;
+ goto unwind;
+ }
+
+ /* Don't allow changes to XTest Devices, these are fixed */
+ if (IsXTestDevice(dev, NULL))
+ {
+ client->errorValue = c->deviceid;
+ rc = BadDevice;
+ goto unwind;
+ }
+
+ ReleaseButtonsAndKeys(dev);
+ AttachDevice(client, dev, NULL);
+ flags[dev->id] |= XISlaveDetached;
+
+unwind:
+ return rc;
+}
+
+static int
+attach_slave(ClientPtr client, xXIAttachSlaveInfo *c,
+ int flags[MAXDEVICES])
+{
+ DeviceIntPtr dev;
+ DeviceIntPtr newmaster;
+ int rc;
+
+ rc = dixLookupDevice(&dev, c->deviceid, client, DixManageAccess);
+ if (rc != Success)
+ goto unwind;
+
+ if (IsMaster(dev))
+ {
+ client->errorValue = c->deviceid;
+ rc = BadDevice;
+ goto unwind;
+ }
+
+ /* Don't allow changes to XTest Devices, these are fixed */
+ if (IsXTestDevice(dev, NULL))
+ {
+ client->errorValue = c->deviceid;
+ rc = BadDevice;
+ goto unwind;
+ }
+
+ rc = dixLookupDevice(&newmaster, c->new_master, client, DixAddAccess);
+ if (rc != Success)
+ goto unwind;
+ if (!IsMaster(newmaster))
+ {
+ client->errorValue = c->new_master;
+ rc = BadDevice;
+ goto unwind;
+ }
+
+ if (!((IsPointerDevice(newmaster) && IsPointerDevice(dev)) ||
+ (IsKeyboardDevice(newmaster) && IsKeyboardDevice(dev))))
+ {
+ rc = BadDevice;
+ goto unwind;
+ }
+
+ ReleaseButtonsAndKeys(dev);
+ AttachDevice(client, dev, newmaster);
+ flags[dev->id] |= XISlaveAttached;
+
+unwind:
+ return rc;
+}
+
+
+
#define SWAPIF(cmd) if (client->swapped) { cmd; }
int
ProcXIChangeHierarchy(ClientPtr client)
{
- DeviceIntPtr ptr, keybd, XTestptr, XTestkeybd;
xXIAnyHierarchyChangeInfo *any;
int required_len = sizeof(xXIChangeHierarchyReq);
char n;
@@ -169,276 +449,38 @@ ProcXIChangeHierarchy(ClientPtr client)
case XIAddMaster:
{
xXIAddMasterInfo* c = (xXIAddMasterInfo*)any;
- char* name;
-
SWAPIF(swaps(&c->name_len, n));
- name = calloc(c->name_len + 1, sizeof(char));
- strncpy(name, (char*)&c[1], c->name_len);
-
- rc = AllocDevicePair(client, name, &ptr, &keybd,
- CorePointerProc, CoreKeyboardProc,
- TRUE);
+ rc = add_master(client, c, flags);
if (rc != Success)
- {
- free(name);
goto unwind;
- }
-
- if (!c->send_core)
- ptr->coreEvents = keybd->coreEvents = FALSE;
-
- /* Allocate virtual slave devices for xtest events */
- rc = AllocXTestDevice(client, name, &XTestptr, &XTestkeybd,
- ptr, keybd);
- if (rc != Success)
- {
-
- free(name);
- goto unwind;
- }
-
- ActivateDevice(ptr, FALSE);
- ActivateDevice(keybd, FALSE);
- flags[ptr->id] |= XIMasterAdded;
- flags[keybd->id] |= XIMasterAdded;
-
- ActivateDevice(XTestptr, FALSE);
- ActivateDevice(XTestkeybd, FALSE);
- flags[XTestptr->id] |= XISlaveAdded;
- flags[XTestkeybd->id] |= XISlaveAdded;
-
- if (c->enable)
- {
- EnableDevice(ptr, FALSE);
- EnableDevice(keybd, FALSE);
- flags[ptr->id] |= XIDeviceEnabled;
- flags[keybd->id] |= XIDeviceEnabled;
-
- EnableDevice(XTestptr, FALSE);
- EnableDevice(XTestkeybd, FALSE);
- flags[XTestptr->id] |= XIDeviceEnabled;
- flags[XTestkeybd->id] |= XIDeviceEnabled;
- }
-
- /* Attach the XTest virtual devices to the newly
- created master device */
- AttachDevice(NULL, XTestptr, ptr);
- AttachDevice(NULL, XTestkeybd, keybd);
- flags[XTestptr->id] |= XISlaveAttached;
- flags[XTestkeybd->id] |= XISlaveAttached;
-
- free(name);
}
break;
case XIRemoveMaster:
{
xXIRemoveMasterInfo* r = (xXIRemoveMasterInfo*)any;
- if (r->return_mode != XIAttachToMaster &&
- r->return_mode != XIFloating)
- return BadValue;
-
- rc = dixLookupDevice(&ptr, r->deviceid, client,
- DixDestroyAccess);
+ rc = remove_master(client, r, flags);
if (rc != Success)
goto unwind;
-
- if (!IsMaster(ptr))
- {
- client->errorValue = r->deviceid;
- rc = BadDevice;
- goto unwind;
- }
-
- /* XXX: For now, don't allow removal of VCP, VCK */
- if (ptr == inputInfo.pointer ||
- ptr == inputInfo.keyboard)
- {
- rc = BadDevice;
- goto unwind;
- }
-
-
- ptr = GetMaster(ptr, MASTER_POINTER);
- rc = dixLookupDevice(&ptr,
- ptr->id,
- client,
- DixDestroyAccess);
- if (rc != Success)
- goto unwind;
- keybd = GetMaster(ptr, MASTER_KEYBOARD);
- rc = dixLookupDevice(&keybd,
- keybd->id,
- client,
- DixDestroyAccess);
- if (rc != Success)
- goto unwind;
-
- XTestptr = GetXTestDevice(ptr);
- rc = dixLookupDevice(&XTestptr, XTestptr->id, client,
- DixDestroyAccess);
- if (rc != Success)
- goto unwind;
-
- XTestkeybd = GetXTestDevice(keybd);
- rc = dixLookupDevice(&XTestkeybd, XTestkeybd->id, client,
- DixDestroyAccess);
- if (rc != Success)
- goto unwind;
-
- /* Disabling sends the devices floating, reattach them if
- * desired. */
- if (r->return_mode == XIAttachToMaster)
- {
- DeviceIntPtr attached,
- newptr,
- newkeybd;
-
- rc = dixLookupDevice(&newptr, r->return_pointer,
- client, DixAddAccess);
- if (rc != Success)
- goto unwind;
-
- if (!IsMaster(newptr))
- {
- client->errorValue = r->return_pointer;
- rc = BadDevice;
- goto unwind;
- }
-
- rc = dixLookupDevice(&newkeybd, r->return_keyboard,
- client, DixAddAccess);
- if (rc != Success)
- goto unwind;
-
- if (!IsMaster(newkeybd))
- {
- client->errorValue = r->return_keyboard;
- rc = BadDevice;
- goto unwind;
- }
-
- for (attached = inputInfo.devices;
- attached;
- attached = attached->next)
- {
- if (!IsMaster(attached)) {
- if (attached->u.master == ptr)
- {
- AttachDevice(client, attached, newptr);
- flags[attached->id] |= XISlaveAttached;
- }
- if (attached->u.master == keybd)
- {
- AttachDevice(client, attached, newkeybd);
- flags[attached->id] |= XISlaveAttached;
- }
- }
- }
- }
-
- /* can't disable until we removed pairing */
- keybd->spriteInfo->paired = NULL;
- ptr->spriteInfo->paired = NULL;
- XTestptr->spriteInfo->paired = NULL;
- XTestkeybd->spriteInfo->paired = NULL;
-
- /* disable the remove the devices, XTest devices must be done first
- else the sprites they rely on will be destroyed */
- DisableDevice(XTestptr, FALSE);
- DisableDevice(XTestkeybd, FALSE);
- DisableDevice(keybd, FALSE);
- DisableDevice(ptr, FALSE);
- flags[XTestptr->id] |= XIDeviceDisabled | XISlaveDetached;
- flags[XTestkeybd->id] |= XIDeviceDisabled | XISlaveDetached;
- flags[keybd->id] |= XIDeviceDisabled;
- flags[ptr->id] |= XIDeviceDisabled;
-
- RemoveDevice(XTestptr, FALSE);
- RemoveDevice(XTestkeybd, FALSE);
- RemoveDevice(keybd, FALSE);
- RemoveDevice(ptr, FALSE);
- flags[XTestptr->id] |= XISlaveRemoved;
- flags[XTestkeybd->id] |= XISlaveRemoved;
- flags[keybd->id] |= XIMasterRemoved;
- flags[ptr->id] |= XIMasterRemoved;
}
break;
case XIDetachSlave:
{
xXIDetachSlaveInfo* c = (xXIDetachSlaveInfo*)any;
- rc = dixLookupDevice(&ptr, c->deviceid, client,
- DixManageAccess);
+ rc = detach_slave(client, c, flags);
if (rc != Success)
goto unwind;
-
- if (IsMaster(ptr))
- {
- client->errorValue = c->deviceid;
- rc = BadDevice;
- goto unwind;
- }
-
- /* Don't allow changes to XTest Devices, these are fixed */
- if (IsXTestDevice(ptr, NULL))
- {
- client->errorValue = c->deviceid;
- rc = BadDevice;
- goto unwind;
- }
-
- AttachDevice(client, ptr, NULL);
- flags[ptr->id] |= XISlaveDetached;
}
break;
case XIAttachSlave:
{
xXIAttachSlaveInfo* c = (xXIAttachSlaveInfo*)any;
- DeviceIntPtr newmaster;
- rc = dixLookupDevice(&ptr, c->deviceid, client,
- DixManageAccess);
+ rc = attach_slave(client, c, flags);
if (rc != Success)
goto unwind;
-
- if (IsMaster(ptr))
- {
- client->errorValue = c->deviceid;
- rc = BadDevice;
- goto unwind;
- }
-
- /* Don't allow changes to XTest Devices, these are fixed */
- if (IsXTestDevice(ptr, NULL))
- {
- client->errorValue = c->deviceid;
- rc = BadDevice;
- goto unwind;
- }
-
- rc = dixLookupDevice(&newmaster, c->new_master,
- client, DixAddAccess);
- if (rc != Success)
- goto unwind;
- if (!IsMaster(newmaster))
- {
- client->errorValue = c->new_master;
- rc = BadDevice;
- goto unwind;
- }
-
- if (!((IsPointerDevice(newmaster) &&
- IsPointerDevice(ptr)) ||
- (IsKeyboardDevice(newmaster) &&
- IsKeyboardDevice(ptr))))
- {
- rc = BadDevice;
- goto unwind;
- }
- AttachDevice(client, ptr, newmaster);
- flags[ptr->id] |= XISlaveAttached;
}
break;
}
diff --git a/xserver/Xi/xigrabdev.c b/xserver/Xi/xigrabdev.c
index 24ededcb1..0adc8787d 100644
--- a/xserver/Xi/xigrabdev.c
+++ b/xserver/Xi/xigrabdev.c
@@ -79,7 +79,7 @@ ProcXIGrabDevice(ClientPtr client)
if (!IsMaster(dev))
stuff->paired_device_mode = GrabModeAsync;
- if (XICheckInvalidMaskBits((unsigned char*)&stuff[1],
+ if (XICheckInvalidMaskBits(client, (unsigned char*)&stuff[1],
stuff->mask_len * 4) != Success)
return BadValue;
diff --git a/xserver/Xi/xipassivegrab.c b/xserver/Xi/xipassivegrab.c
index 296614510..5cdd8aca6 100644
--- a/xserver/Xi/xipassivegrab.c
+++ b/xserver/Xi/xipassivegrab.c
@@ -43,6 +43,7 @@
#include "exevents.h"
#include "xipassivegrab.h"
#include "dixgrabs.h"
+#include "misc.h"
int
SProcXIPassiveGrabDevice(ClientPtr client)
@@ -87,6 +88,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
GrabParameters param;
void *tmp;
int mask_len;
+ int n;
REQUEST(xXIPassiveGrabDeviceReq);
REQUEST_AT_LEAST_SIZE(xXIPassiveGrabDeviceReq);
@@ -99,7 +101,10 @@ ProcXIPassiveGrabDevice(ClientPtr client)
{
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
if (ret != Success)
+ {
+ client->errorValue = stuff->deviceid;
return ret;
+ }
}
if (stuff->grab_type != XIGrabtypeButton &&
@@ -118,7 +123,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
return BadValue;
}
- if (XICheckInvalidMaskBits((unsigned char*)&stuff[1],
+ if (XICheckInvalidMaskBits(client, (unsigned char*)&stuff[1],
stuff->mask_len * 4) != Success)
return BadValue;
@@ -156,16 +161,15 @@ ProcXIPassiveGrabDevice(ClientPtr client)
return status;
status = CheckGrabValues(client, &param);
+ if (status != Success)
+ return status;
modifiers = (uint32_t*)&stuff[1] + stuff->mask_len;
modifiers_failed = calloc(stuff->num_modifiers, sizeof(xXIGrabModifierInfo));
if (!modifiers_failed)
return BadAlloc;
- if (!IsMaster(dev) && dev->u.master)
- mod_dev = GetMaster(dev, MASTER_KEYBOARD);
- else
- mod_dev = dev;
+ mod_dev = (IsFloating(dev)) ? dev : GetMaster(dev, MASTER_KEYBOARD);
for (i = 0; i < stuff->num_modifiers; i++, modifiers++)
{
@@ -193,17 +197,18 @@ ProcXIPassiveGrabDevice(ClientPtr client)
info->status = status;
info->modifiers = *modifiers;
+ if (client->swapped)
+ swapl(&info->modifiers, n);
+
rep.num_modifiers++;
- rep.length++;
+ rep.length += bytes_to_int32(sizeof(xXIGrabModifierInfo));
}
}
WriteReplyToClient(client, sizeof(rep), &rep);
if (rep.num_modifiers)
- {
- client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
- WriteSwappedDataToClient(client, rep.num_modifiers * 4, (char*)modifiers_failed);
- }
+ WriteToClient(client, rep.length * 4, (char*)modifiers_failed);
+
free(modifiers_failed);
return ret;
}
@@ -256,9 +261,16 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
REQUEST(xXIPassiveUngrabDeviceReq);
REQUEST_AT_LEAST_SIZE(xXIPassiveUngrabDeviceReq);
- rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
- if (rc != Success)
- return rc;
+ if (stuff->deviceid == XIAllDevices)
+ dev = inputInfo.all_devices;
+ else if (stuff->deviceid == XIAllMasterDevices)
+ dev = inputInfo.all_master_devices;
+ else
+ {
+ rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
+ if (rc != Success)
+ return rc;
+ }
if (stuff->grab_type != XIGrabtypeButton &&
stuff->grab_type != XIGrabtypeKeycode &&
@@ -280,10 +292,7 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
if (rc != Success)
return rc;
- if (!IsMaster(dev) && dev->u.master)
- mod_dev = GetMaster(dev, MASTER_KEYBOARD);
- else
- mod_dev = dev;
+ mod_dev = (IsFloating(dev)) ? dev : GetMaster(dev, MASTER_KEYBOARD);
tempGrab.resource = client->clientAsMask;
tempGrab.device = dev;
diff --git a/xserver/Xi/xiproperty.c b/xserver/Xi/xiproperty.c
index b9f53f7dc..83ce93014 100644
--- a/xserver/Xi/xiproperty.c
+++ b/xserver/Xi/xiproperty.c
@@ -701,7 +701,7 @@ XIDeleteDeviceProperty (DeviceIntPtr device, Atom property, Bool fromClient)
int
XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
int format, int mode, unsigned long len,
- pointer value, Bool sendevent)
+ const pointer value, Bool sendevent)
{
XIPropertyPtr prop;
int size_in_bytes;
@@ -1051,11 +1051,11 @@ SProcXChangeDeviceProperty (ClientPtr client)
char n;
REQUEST(xChangeDevicePropertyReq);
+ REQUEST_AT_LEAST_SIZE(xChangeDevicePropertyReq);
swaps(&stuff->length, n);
swapl(&stuff->property, n);
swapl(&stuff->type, n);
swapl(&stuff->nUnits, n);
- REQUEST_SIZE_MATCH(xChangeDevicePropertyReq);
return (ProcXChangeDeviceProperty(client));
}
@@ -1295,12 +1295,12 @@ SProcXIChangeProperty(ClientPtr client)
char n;
REQUEST(xXIChangePropertyReq);
+ REQUEST_AT_LEAST_SIZE(xXIChangePropertyReq);
swaps(&stuff->length, n);
swaps(&stuff->deviceid, n);
swapl(&stuff->property, n);
swapl(&stuff->type, n);
swapl(&stuff->num_items, n);
- REQUEST_SIZE_MATCH(xXIChangePropertyReq);
return (ProcXIChangeProperty(client));
}
diff --git a/xserver/Xi/xiquerydevice.c b/xserver/Xi/xiquerydevice.c
index cc7eca630..a768d499c 100644
--- a/xserver/Xi/xiquerydevice.c
+++ b/xserver/Xi/xiquerydevice.c
@@ -107,8 +107,10 @@ ProcXIQueryDevice(ClientPtr client)
}
info = calloc(1, len);
- if (!info)
+ if (!info) {
+ free(skip);
return BadAlloc;
+ }
memset(&rep, 0, sizeof(xXIQueryDeviceReply));
rep.repType = X_Reply;
@@ -152,7 +154,8 @@ ProcXIQueryDevice(ClientPtr client)
}
}
}
- len = rep.length*4;
+
+ len = rep.length * 4;
WriteReplyToClient(client, sizeof(xXIQueryDeviceReply), &rep);
WriteToClient(client, len, ptr);
free(ptr);
@@ -349,7 +352,7 @@ ListValuatorInfo(DeviceIntPtr dev, xXIValuatorInfo* info, int axisnumber,
info->value.frac = (int)(v->axisVal[axisnumber] * (1 << 16) * (1 << 16));
info->resolution = v->axes[axisnumber].resolution;
info->number = axisnumber;
- info->mode = v->mode; /* Server doesn't have per-axis mode yet */
+ info->mode = valuator_get_mode(dev, axisnumber);
info->sourceid = v->sourceid;
if (!reportState)
@@ -375,7 +378,7 @@ SwapValuatorInfo(DeviceIntPtr dev, xXIValuatorInfo* info)
int GetDeviceUse(DeviceIntPtr dev, uint16_t *attachment)
{
- DeviceIntPtr master = dev->u.master;
+ DeviceIntPtr master = GetMaster(dev, MASTER_ATTACHED);
int use;
if (IsMaster(dev))
@@ -383,7 +386,7 @@ int GetDeviceUse(DeviceIntPtr dev, uint16_t *attachment)
DeviceIntPtr paired = GetPairedDevice(dev);
use = IsPointerDevice(dev) ? XIMasterPointer : XIMasterKeyboard;
*attachment = (paired ? paired->id : 0);
- } else if (master)
+ } else if (!IsFloating(dev))
{
use = IsPointerDevice(master) ? XISlavePointer : XISlaveKeyboard;
*attachment = master->id;
diff --git a/xserver/Xi/xiquerypointer.c b/xserver/Xi/xiquerypointer.c
index b521c48ef..51317994b 100644
--- a/xserver/Xi/xiquerypointer.c
+++ b/xserver/Xi/xiquerypointer.c
@@ -93,7 +93,7 @@ ProcXIQueryPointer(ClientPtr client)
}
if (pDev->valuator == NULL || IsKeyboardDevice(pDev) ||
- (!IsMaster(pDev) && pDev->u.master)) /* no attached devices */
+ (!IsMaster(pDev) && !IsFloating(pDev))) /* no attached devices */
{
client->errorValue = stuff->deviceid;
return BadDevice;
@@ -129,7 +129,7 @@ ProcXIQueryPointer(ClientPtr client)
if (kbd)
{
- state = &kbd->key->xkbInfo->prev_state;
+ state = &kbd->key->xkbInfo->state;
rep.mods.base_mods = state->base_mods;
rep.mods.latched_mods = state->latched_mods;
rep.mods.locked_mods = state->locked_mods;
diff --git a/xserver/Xi/xiqueryversion.c b/xserver/Xi/xiqueryversion.c
index ae63297da..f647f9872 100644
--- a/xserver/Xi/xiqueryversion.c
+++ b/xserver/Xi/xiqueryversion.c
@@ -58,7 +58,6 @@ ProcXIQueryVersion(ClientPtr client)
xXIQueryVersionReply rep;
XIClientPtr pXIClient;
int major, minor;
- unsigned int sversion, cversion;
REQUEST(xXIQueryVersionReq);
REQUEST_SIZE_MATCH(xXIQueryVersionReq);
@@ -72,10 +71,8 @@ ProcXIQueryVersion(ClientPtr client)
pXIClient = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
- sversion = XIVersion.major_version * 1000 + XIVersion.minor_version;
- cversion = stuff->major_version * 1000 + stuff->minor_version;
-
- if (sversion > cversion)
+ if (version_compare(XIVersion.major_version, XIVersion.minor_version,
+ stuff->major_version, stuff->minor_version) > 0)
{
major = stuff->major_version;
minor = stuff->minor_version;
diff --git a/xserver/Xi/xiselectev.c b/xserver/Xi/xiselectev.c
index 7aa3f0ab6..22fbaf5e7 100644
--- a/xserver/Xi/xiselectev.c
+++ b/xserver/Xi/xiselectev.c
@@ -42,14 +42,19 @@
*
* @return BadValue if at least one invalid bit is set or Success otherwise.
*/
-int XICheckInvalidMaskBits(unsigned char *mask, int len)
+int XICheckInvalidMaskBits(ClientPtr client, unsigned char *mask, int len)
{
if (len >= XIMaskLen(XI2LASTEVENT))
{
int i;
for (i = XI2LASTEVENT + 1; i < len * 8; i++)
+ {
if (BitIsOn(mask, i))
+ {
+ client->errorValue = i;
return BadValue;
+ }
+ }
}
return Success;
@@ -126,7 +131,10 @@ ProcXISelectEvents(ClientPtr client)
{
unsigned char *bits = (unsigned char*)&evmask[1];
if (BitIsOn(bits, XI_HierarchyChanged))
+ {
+ client->errorValue = XI_HierarchyChanged;
return BadValue;
+ }
}
/* Raw events may only be selected on root windows */
@@ -138,10 +146,13 @@ ProcXISelectEvents(ClientPtr client)
BitIsOn(bits, XI_RawButtonPress) ||
BitIsOn(bits, XI_RawButtonRelease) ||
BitIsOn(bits, XI_RawMotion))
+ {
+ client->errorValue = XI_RawKeyPress;
return BadValue;
+ }
}
- if (XICheckInvalidMaskBits((unsigned char*)&evmask[1],
+ if (XICheckInvalidMaskBits(client, (unsigned char*)&evmask[1],
evmask->mask_len * 4) != Success)
return BadValue;
diff --git a/xserver/Xi/xiwarppointer.c b/xserver/Xi/xiwarppointer.c
index 7276e6faf..a463ab94d 100644
--- a/xserver/Xi/xiwarppointer.c
+++ b/xserver/Xi/xiwarppointer.c
@@ -97,7 +97,7 @@ ProcXIWarpPointer(ClientPtr client)
return rc;
}
- if ((!IsMaster(pDev) && pDev->u.master) ||
+ if ((!IsMaster(pDev) && !IsFloating(pDev)) ||
(IsMaster(pDev) && !IsPointerDevice(pDev)))
{
client->errorValue = stuff->deviceid;
@@ -192,6 +192,8 @@ ProcXIWarpPointer(ClientPtr client)
/* if we don't update the device, we get a jump next time it moves */
pDev->last.valuators[0] = x;
pDev->last.valuators[1] = y;
+ pDev->last.remainder[0] = 0;
+ pDev->last.remainder[1] = 0;
miPointerUpdateSprite(pDev);
/* FIXME: XWarpPointer is supposed to generate an event. It doesn't do it