Update to libXi 1.7.6

This commit is contained in:
matthieu 2016-08-06 09:56:28 +00:00
parent 7a95b9000b
commit 0d928c6a2e
26 changed files with 588 additions and 68 deletions

View File

@ -1,3 +1,163 @@
commit 2286282f965064176b3b1492646c6e2e0f4ab7dd
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Tue Dec 22 11:20:01 2015 +1000
libXi 1.7.6
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
commit 13f25bfb55f4a0bc1f614cbf9b0b13a50ecad8a0
Author: Javier Pello <javier.pello@urjc.es>
Date: Wed Oct 7 12:41:01 2015 +0200
Fix const compiler warnings
When invoking Data, Data16 and Data32 from XChangeDeviceProperty,
we must cast the data pointer to the right type, but we do not need
to cast constness away. This change allows to enable -Wcast-qual on
the build and have it complete without warnings.
Signed-off-by: Javier Pello <javier.pello@urjc.es>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
commit 380861589690bcbe8b04b7a2c23b5dd5d10c4bf8
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Mon Oct 19 11:46:41 2015 +1000
Don't use raw serial numbers in XIEvents
cookie->serial is an Xlib contoction, provided by _XSetLastRequestRead(). This
serial may be different to the raw serial number from the wire protocol.
This causes issues when the raw serial is used to e.g. compare the event to
other non-XI events.
Use the cookie's serial number instead.
https://bugzilla.gnome.org/show_bug.cgi?id=756649
See also https://bugs.freedesktop.org/show_bug.cgi?id=64687
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
commit f180dff710dc54d00e0e26b84de053151f8f207e
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu Sep 10 01:16:19 2015 +1000
libXi 1.7.5
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
commit 05c86e53c0bae30e58b32b94e191c8720990918a
Author: Cosimo Cecchi <cosimoc@gnome.org>
Date: Tue Feb 24 07:49:34 2015 +1000
Fix version check in _XIAllowEvents
Commit 5810d0797160a97012664ffe719a59e1b288a525 changed _XIAllowEvents() to
use _XiCheckVersion() instead of _XiCheckExtInit() to avoid a double display
unlock, but it failed to correctly check for the version, since we should set
have_XI22 to True for every version greater or equal to 2.2.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
commit c648441036cf5ffc5225cd484e2c906d374f0a4b
Author: Michal Srb <msrb@suse.com>
Date: Mon Nov 3 12:43:40 2014 +0200
XIGrabDevice: Unlock display in error path.
Signed-off-by: Michal Srb <msrb@suse.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
commit 29c77457ad86966ae2204b865fb8b437269063c4
Author: Michal Srb <msrb@suse.com>
Date: Sat Nov 1 20:00:57 2014 +0200
Refactor XGetExtensionVersion.
_XiGetExtensionVersion was called from XGetExtensionVersion and from
_XiCheckExtInit. When called from _XiCheckExtInit, nothing accounted for the
fact that it can return ((XExtensionVersion *) NoSuchExtension) in case of
error. Also it recursively calls _XiCheckExtInit potentionally causing multiple
unlocks if _XiCheckExtInit fails.
-> Remove it and call directly _XiGetExtensionVersionRequest and only call
_XiCheckExtInit only from XGetExtensionVersion.
Signed-off-by: Michal Srb <msrb@suse.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
commit 5810d0797160a97012664ffe719a59e1b288a525
Author: Michal Srb <msrb@suse.com>
Date: Sat Nov 1 20:00:56 2014 +0200
Fix logic in _XIAllowEvents and prevent double unlock.
Replacing the second _XiCheckExtInit with _XiCheckVersion prevents possible
double unlock as _XiCheckExtInit actually unlocks the display when it returns
-1.
Signed-off-by: Michal Srb <msrb@suse.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
commit f699770e7c92da1dbf16892fde83438f0b79c979
Author: Michal Srb <msrb@suse.com>
Date: Sat Nov 1 20:00:54 2014 +0200
XIGetClientPointer: Return False on error.
Not NoSuchExtension which is 1 = True!
Signed-off-by: Michal Srb <msrb@suse.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
commit dc1f8c6ec1ba8135afa185c8e8360c1ed90bf96c
Author: Michal Srb <msrb@suse.com>
Date: Sat Nov 1 20:00:53 2014 +0200
Do not return NoSuchExtension casted to pointer as an error.
Several functions were returning NoSuchExtension casted to a pointer in case of
an error. Often in parallel with returning NULL in case of another error. It is
undocumented and certainly wrong.
Signed-off-by: Michal Srb <msrb@suse.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
commit 83261c52a17543437882e2863b7f06a92c9039f8
Author: Michal Srb <msrb@suse.com>
Date: Sat Nov 1 20:00:52 2014 +0200
XIChangeHierarchy: Add missing unlock.
When num_changes <= 0 or Xmalloc fails, the display has to be unlocked.
Signed-off-by: Michal Srb <msrb@suse.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
commit 22ae8d4f26e92b17e1ce8239a38481933d6f1ca7
Author: Michal Srb <msrb@suse.com>
Date: Sat Nov 1 20:00:51 2014 +0200
Fix double unlock when _XiCheckExtInit return -1.
_XiCheckExtInit unlocks the display if it fails and returns -1. Most callers
account for it properly, but few didn't.
Signed-off-by: Michal Srb <msrb@suse.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
commit 71a42145b678be623e30bd5bf55833a04f14376f
Author: Julien Cristau <jcristau@debian.org>
Date: Mon Oct 27 19:00:36 2014 +0100
Advance the request buffer by the right amount in XIChangeHierarchy
c->length is in 4-byte units, dptr is a char *, so we need to advance
dptr by 4 * length to get the position of the next HierarchyChangeInfo.
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Julien Cristau <jcristau@debian.org>
commit 8c255b30f3a4ed8bf67e6bb76df47cbd480735f8
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Fri Jul 18 16:45:51 2014 +1000

View File

@ -53,7 +53,7 @@ host_triplet = @host@
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/xi.pc.in \
$(top_srcdir)/configure COPYING ChangeLog INSTALL NEWS \
$(top_srcdir)/configure COPYING ChangeLog INSTALL compile \
config.guess config.sub depcomp install-sh ltmain.sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac

347
lib/libXi/compile Normal file
View File

@ -0,0 +1,347 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2012-10-14.11; # UTC
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"
file_conv=
# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
func_file_conv "$1"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
}
# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
lib=$1
found=no
save_IFS=$IFS
IFS=';'
for dir in $lib_path $LIB
do
IFS=$save_IFS
if $shared && test -f "$dir/$lib.dll.lib"; then
found=yes
lib=$dir/$lib.dll.lib
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
lib=$dir/$lib.lib
break
fi
if test -f "$dir/lib$lib.a"; then
found=yes
lib=$dir/lib$lib.a
break
fi
done
IFS=$save_IFS
if test "$found" != yes; then
lib=$lib.lib
fi
}
# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
lib_path=
shared=:
linker_opts=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
;;
*)
func_file_conv "$2"
set x "$@" -Fe"$file"
shift
;;
esac
;;
-I)
eat=1
func_file_conv "$2" mingw
set x "$@" -I"$file"
shift
;;
-I*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l)
eat=1
func_cl_dashl "$2"
set x "$@" "$lib"
shift
;;
-l*)
func_cl_dashl "${1#-l}"
set x "$@" "$lib"
shift
;;
-L)
eat=1
func_cl_dashL "$2"
;;
-L*)
func_cl_dashL "${1#-L}"
;;
-static)
shared=false
;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
for flag in $arg; do
IFS="$save_ifs"
linker_opts="$linker_opts $flag"
done
IFS="$save_ifs"
;;
-Xlinker)
eat=1
linker_opts="$linker_opts $2"
;;
-*)
set x "$@" "$1"
shift
;;
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
func_file_conv "$1"
set x "$@" -Tp"$file"
shift
;;
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
exec "$@" $linker_opts
exit 1
}
eat=
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand '-c -o'.
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
ofile=
cfile=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
# So we strip '-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no '-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# '.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

20
lib/libXi/configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for libXi 1.7.4.
# Generated by GNU Autoconf 2.69 for libXi 1.7.6.
#
# Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=xorg>.
#
@ -651,8 +651,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='libXi'
PACKAGE_TARNAME='libXi'
PACKAGE_VERSION='1.7.4'
PACKAGE_STRING='libXi 1.7.4'
PACKAGE_VERSION='1.7.6'
PACKAGE_STRING='libXi 1.7.6'
PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg'
PACKAGE_URL=''
@ -1451,7 +1451,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures libXi 1.7.4 to adapt to many kinds of systems.
\`configure' configures libXi 1.7.6 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1521,7 +1521,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of libXi 1.7.4:";;
short | recursive ) echo "Configuration of libXi 1.7.6:";;
esac
cat <<\_ACEOF
@ -1660,7 +1660,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
libXi configure 1.7.4
libXi configure 1.7.6
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@ -1984,7 +1984,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by libXi $as_me 1.7.4, which was
It was created by libXi $as_me 1.7.6, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@ -2813,7 +2813,7 @@ fi
# Define the identity of the package.
PACKAGE='libXi'
VERSION='1.7.4'
VERSION='1.7.6'
cat >>confdefs.h <<_ACEOF
@ -19175,7 +19175,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by libXi $as_me 1.7.4, which was
This file was extended by libXi $as_me 1.7.6, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -19241,7 +19241,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
libXi config.status 1.7.4
libXi config.status 1.7.6
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

View File

@ -1,7 +1,7 @@
# Initialize Autoconf
AC_PREREQ([2.60])
AC_INIT([libXi], [1.7.4],
AC_INIT([libXi], [1.7.6],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXi])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([src/config.h])

View File

@ -74,7 +74,7 @@ XChangeDeviceProperty(Display* dpy, XDevice* dev,
len = ((long)nelements + 3) >> 2;
if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) {
SetReqLen(req, len, len);
Data (dpy, (char *)data, nelements);
Data (dpy, (_Xconst char *)data, nelements);
} /* else force BadLength */
break;
@ -83,7 +83,7 @@ XChangeDeviceProperty(Display* dpy, XDevice* dev,
if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) {
SetReqLen(req, len, len);
len = (long)nelements << 1;
Data16 (dpy, (short *) data, len);
Data16 (dpy, (_Xconst short *) data, len);
} /* else force BadLength */
break;
@ -92,7 +92,7 @@ XChangeDeviceProperty(Display* dpy, XDevice* dev,
if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) {
SetReqLen(req, len, len);
len = (long)nelements << 2;
Data32 (dpy, (long *) data, len);
Data32 (dpy, (_Xconst long *) data, len);
} /* else force BadLength */
break;

View File

@ -380,7 +380,7 @@ _XiCheckExtInit(
return (-1);
}
((XInputData *) info->data)->vers =
_XiGetExtensionVersion(dpy, "XInputExtension", info);
_XiGetExtensionVersionRequest(dpy, "XInputExtension", info->codes->major_opcode);
}
if (_XiCheckVersion(info, version_index) < 0) {
@ -1521,7 +1521,7 @@ wireToDeviceEvent(xXIDeviceEvent *in, XGenericEventCookie* cookie)
out = next_block(&ptr_lib, sizeof(XIDeviceEvent));
out->display = cookie->display;
out->type = in->type;
out->serial = in->sequenceNumber;
out->serial = cookie->serial;
out->extension = in->extension;
out->evtype = in->evtype;
out->send_event = ((in->type & 0x80) != 0);
@ -1794,7 +1794,7 @@ wireToDeviceChangedEvent(xXIDeviceChangedEvent *in, XGenericEventCookie *cookie)
cookie->data = out = malloc(sizeof(XIDeviceChangedEvent) + len);
out->type = in->type;
out->serial = in->sequenceNumber;
out->serial = cookie->serial;
out->display = cookie->display;
out->extension = in->extension;
out->evtype = in->evtype;
@ -1827,7 +1827,7 @@ wireToHierarchyChangedEvent(xXIHierarchyEvent *in, XGenericEventCookie *cookie)
out->info = (XIHierarchyInfo*)&out[1];
out->display = cookie->display;
out->type = in->type;
out->serial = in->sequenceNumber;
out->serial = cookie->serial;
out->extension = in->extension;
out->evtype = in->evtype;
out->send_event = ((in->type & 0x80) != 0);
@ -1868,7 +1868,7 @@ wireToRawEvent(XExtDisplayInfo *info, xXIRawEvent *in, XGenericEventCookie *cook
out = next_block(&ptr, sizeof(XIRawEvent));
out->type = in->type;
out->serial = in->sequenceNumber;
out->serial = cookie->serial;
out->display = cookie->display;
out->extension = in->extension;
out->evtype = in->evtype;
@ -1919,7 +1919,7 @@ wireToEnterLeave(xXIEnterEvent *in, XGenericEventCookie *cookie)
out->buttons.mask = (unsigned char*)&out[1];
out->type = in->type;
out->serial = in->sequenceNumber;
out->serial = cookie->serial;
out->display = cookie->display;
out->extension = in->extension;
out->evtype = in->evtype;
@ -1962,7 +1962,7 @@ wireToPropertyEvent(xXIPropertyEvent *in, XGenericEventCookie *cookie)
cookie->data = out;
out->type = in->type;
out->serial = in->sequenceNumber;
out->serial = cookie->serial;
out->extension = in->extension;
out->evtype = in->evtype;
out->send_event = ((in->type & 0x80) != 0);
@ -1983,7 +1983,7 @@ wireToTouchOwnershipEvent(xXITouchOwnershipEvent *in,
cookie->data = out;
out->type = in->type;
out->serial = in->sequenceNumber;
out->serial = cookie->serial;
out->display = cookie->display;
out->extension = in->extension;
out->evtype = in->evtype;
@ -2011,7 +2011,7 @@ wireToBarrierEvent(xXIBarrierEvent *in, XGenericEventCookie *cookie)
out->display = cookie->display;
out->type = in->type;
out->serial = in->sequenceNumber;
out->serial = cookie->serial;
out->extension = in->extension;
out->evtype = in->evtype;
out->send_event = ((in->type & 0x80) != 0);

View File

@ -81,7 +81,7 @@ XGetDeviceMotionEvents(
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return ((XDeviceTimeCoord *) NoSuchExtension);
return NULL;
GetReq(GetDeviceMotionEvents, req);
req->reqType = info->codes->major_opcode;

View File

@ -49,7 +49,7 @@ XIGetClientPointer(Display* dpy, Window win, int *deviceid)
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, Dont_Check, info) == -1)
return (NoSuchExtension);
return False;
GetReq(XIGetClientPointer, req);
req->reqType = info->codes->major_opcode;

View File

@ -79,7 +79,7 @@ XGetDeviceControl(
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Add_XChangeDeviceControl, info) == -1)
return ((XDeviceControl *) NoSuchExtension);
return NULL;
GetReq(GetDeviceControl, req);
req->reqType = info->codes->major_opcode;

View File

@ -79,7 +79,7 @@ XGetFeedbackControl(
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return ((XFeedbackState *) NoSuchExtension);
return NULL;
GetReq(GetFeedbackControl, req);
req->reqType = info->codes->major_opcode;

View File

@ -78,7 +78,7 @@ XGetDeviceKeyMapping(register Display * dpy, XDevice * dev,
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return ((KeySym *) NoSuchExtension);
return NULL;
GetReq(GetDeviceKeyMapping, req);
req->reqType = info->codes->major_opcode;

View File

@ -73,7 +73,7 @@ XGetDeviceModifierMapping(
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return ((XModifierKeymap *) NoSuchExtension);
return NULL;
GetReq(GetDeviceModifierMapping, req);
req->reqType = info->codes->major_opcode;

View File

@ -75,7 +75,7 @@ XGetDeviceDontPropagateList(
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return ((XEventClass *) NoSuchExtension);
return NULL;
GetReq(GetDeviceDontPropagateList, req);
req->reqType = info->codes->major_opcode;

View File

@ -68,12 +68,16 @@ XGetExtensionVersion(register Display * dpy, _Xconst char *name)
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
ext = _XiGetExtensionVersion(dpy, name, info);
if (ext != (XExtensionVersion *) NoSuchExtension) {
UnlockDisplay(dpy);
SyncHandle();
}
return (ext);
if (_XiCheckExtInit(dpy, Dont_Check, info) == -1)
return NULL;
ext = _XiGetExtensionVersionRequest(dpy, name, info->codes->major_opcode);
UnlockDisplay(dpy);
SyncHandle();
return ext;
}
_X_HIDDEN XExtensionVersion*
@ -91,7 +95,7 @@ _XiGetExtensionVersionRequest(Display *dpy, _Xconst char *name, int xi_opcode)
_XSend(dpy, name, (long)req->nbytes);
if (!_XReply(dpy, (xReply *) & rep, 0, xTrue)) {
return (XExtensionVersion *) NULL;
return NULL;
}
ext = (XExtensionVersion *) Xmalloc(sizeof(XExtensionVersion));
@ -105,13 +109,3 @@ _XiGetExtensionVersionRequest(Display *dpy, _Xconst char *name, int xi_opcode)
return ext;
}
_X_HIDDEN XExtensionVersion *
_XiGetExtensionVersion(register Display * dpy, _Xconst char *name,
XExtDisplayInfo *info)
{
if (_XiCheckExtInit(dpy, Dont_Check, info) == -1)
return ((XExtensionVersion *) NoSuchExtension);
return _XiGetExtensionVersionRequest(dpy, name, info->codes->major_opcode);
}

View File

@ -40,7 +40,7 @@ static Status
_XIAllowEvents(Display *dpy, int deviceid, int event_mode, Time time,
unsigned int touchid, Window grab_window)
{
Bool have_XI22 = True;
Bool have_XI22 = False;
xXIAllowEventsReq *req;
xXI2_2AllowEventsReq *req_XI22;
@ -50,7 +50,7 @@ _XIAllowEvents(Display *dpy, int deviceid, int event_mode, Time time,
if (_XiCheckExtInit(dpy, XInput_2_0, extinfo) == -1)
return (NoSuchExtension);
if (_XiCheckExtInit(dpy, XInput_2_2, extinfo) == 0)
if (_XiCheckVersion(extinfo, XInput_2_2) >= 0)
have_XI22 = True;
if (have_XI22)

View File

@ -53,14 +53,20 @@ XIGrabDevice(Display* dpy, int deviceid, Window grab_window, Time time,
if (mask->mask_len > INT_MAX - 3 ||
(mask->mask_len + 3)/4 >= 0xffff)
return BadValue;
{
reply.status = BadValue;
goto out;
}
/* mask->mask_len is in bytes, but we need 4-byte units on the wire,
* and they need to be padded with 0 */
len = (mask->mask_len + 3)/4;
buff = calloc(4, len);
if (!buff)
return BadAlloc;
{
reply.status = BadAlloc;
goto out;
}
GetReq(XIGrabDevice, req);
req->reqType = extinfo->codes->major_opcode;
@ -83,6 +89,7 @@ XIGrabDevice(Display* dpy, int deviceid, Window grab_window, Time time,
if (_XReply(dpy, (xReply *)&reply, 0, xTrue) == 0)
reply.status = GrabSuccess;
out:
UnlockDisplay(dpy);
SyncHandle();

View File

@ -49,14 +49,14 @@ XIChangeHierarchy(Display* dpy,
xXIChangeHierarchyReq *req;
XExtDisplayInfo *info = XInput_find_display(dpy);
char *data = NULL, *dptr;
int dlen = 0, i;
int dlen = 0, i, ret = Success;
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_2_0, info) == -1)
return (NoSuchExtension);
if (num_changes <= 0)
return Success;
goto out;
GetReq(XIChangeHierarchy, req);
req->reqType = info->codes->major_opcode;
@ -91,8 +91,10 @@ XIChangeHierarchy(Display* dpy,
req->length += dlen / 4; /* dlen is 4-byte aligned */
data = Xmalloc(dlen);
if (!data)
return BadAlloc;
if (!data) {
ret = BadAlloc;
goto out;
}
dptr = data;
for (i = 0, any = changes; i < num_changes; i++, any++)
@ -109,7 +111,7 @@ XIChangeHierarchy(Display* dpy,
c->name_len = strlen(C->name);
c->length = (sizeof(xXIAddMasterInfo) + c->name_len + 3)/4;
strncpy((char*)&c[1], C->name, c->name_len);
dptr += c->length;
dptr += 4 * c->length;
}
break;
case XIRemoveMaster:
@ -155,8 +157,10 @@ XIChangeHierarchy(Display* dpy,
}
Data(dpy, data, dlen);
out:
Xfree(data);
UnlockDisplay(dpy);
SyncHandle();
return Success;
return ret;
}

View File

@ -51,7 +51,7 @@ XIListProperties(Display* dpy, int deviceid, int *num_props_return)
LockDisplay(dpy);
*num_props_return = 0;
if (_XiCheckExtInit(dpy, XInput_2_0, info) == -1)
goto cleanup;
goto cleanup_unlocked;
GetReq(XIListProperties, req);
req->reqType = info->codes->major_opcode;
@ -76,6 +76,7 @@ XIListProperties(Display* dpy, int deviceid, int *num_props_return)
cleanup:
UnlockDisplay(dpy);
cleanup_unlocked:
SyncHandle();
return props;
}

View File

@ -50,7 +50,7 @@ XIQueryDevice(Display *dpy, int deviceid, int *ndevices_return)
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_2_0, extinfo) == -1)
goto error;
goto error_unlocked;
GetReq(XIQueryDevice, req);
req->reqType = extinfo->codes->major_opcode;
@ -105,6 +105,7 @@ XIQueryDevice(Display *dpy, int deviceid, int *ndevices_return)
error:
UnlockDisplay(dpy);
error_unlocked:
SyncHandle();
*ndevices_return = -1;
return NULL;

View File

@ -41,10 +41,8 @@ XIQueryVersion(Display *dpy, int *major_inout, int *minor_inout)
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
rc = _xiQueryVersion(dpy, major_inout, minor_inout, info);
UnlockDisplay(dpy);
SyncHandle();
return rc;
}
@ -55,6 +53,8 @@ _xiQueryVersion(Display * dpy, int *major, int *minor, XExtDisplayInfo *info)
xXIQueryVersionReq *req;
xXIQueryVersionReply rep;
LockDisplay(dpy);
/* This could mean either a malloc problem, or supported
version < XInput_2_0 */
if (_XiCheckExtInit(dpy, XInput_2_0, info) == -1)
@ -82,9 +82,13 @@ _xiQueryVersion(Display * dpy, int *major, int *minor, XExtDisplayInfo *info)
req->minor_version = *minor;
if (!_XReply(dpy, (xReply*)&rep, 0, xTrue)) {
UnlockDisplay(dpy);
return BadImplementation;
}
*major = rep.major_version;
*minor = rep.minor_version;
UnlockDisplay(dpy);
return Success;
}

View File

@ -60,7 +60,7 @@ XISelectEvents(Display* dpy, Window win, XIEventMask* masks, int num_masks)
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_2_0, info) == -1) {
r = NoSuchExtension;
goto out;
goto out_unlocked;
}
for (i = 0; i < num_masks; i++) {
@ -114,6 +114,7 @@ XISelectEvents(Display* dpy, Window win, XIEventMask* masks, int num_masks)
free(buff);
out:
UnlockDisplay(dpy);
out_unlocked:
SyncHandle();
return r;
@ -134,7 +135,7 @@ XIGetSelectedEvents(Display* dpy, Window win, int *num_masks_return)
*num_masks_return = -1;
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_2_0, info) == -1)
goto out;
goto out_unlocked;
GetReq(XIGetSelectedEvents, req);
@ -203,6 +204,8 @@ out:
Xfree(mask_in);
UnlockDisplay(dpy);
out_unlocked:
SyncHandle();
return mask_out;

View File

@ -29,7 +29,6 @@ extern XExtDisplayInfo *XInput_find_display(Display *);
extern int _XiCheckExtInit(Display *, int, XExtDisplayInfo *);
extern int _XiCheckVersion(XExtDisplayInfo *info, int version_index);
extern XExtensionVersion *_XiGetExtensionVersion(Display *, _Xconst char *, XExtDisplayInfo *);
extern XExtensionVersion* _XiGetExtensionVersionRequest(Display *dpy, _Xconst char *name, int xi_opcode);
extern Status _xiQueryVersion(Display *dpy, int*, int*, XExtDisplayInfo *);

View File

@ -51,7 +51,7 @@ XListDeviceProperties(Display* dpy, XDevice* dev, int *nprops_return)
LockDisplay(dpy);
*nprops_return = 0;
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
goto cleanup;
return NULL;
GetReq(ListDeviceProperties, req);
req->reqType = info->codes->major_opcode;

View File

@ -73,7 +73,7 @@ XOpenDevice(
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return ((XDevice *) NoSuchExtension);
return NULL;
GetReq(OpenDevice, req);
req->reqType = info->codes->major_opcode;

View File

@ -78,7 +78,7 @@ XQueryDeviceState(
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return ((XDeviceState *) NoSuchExtension);
return NULL;
GetReq(QueryDeviceState, req);
req->reqType = info->codes->major_opcode;