Commit Graph

104 Commits

Author SHA1 Message Date
Alan Coopersmith 23e83724df Fix spelling/wording issues
Most (but not all) of these were found by using
  codespell --builtin clear,rare,usage,informal,code,names
but not everything reported by that was fixed.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-07-05 13:07:33 -07:00
Adam Jackson dc7ceda90f dispatch: Mark swapped dispatch as _X_COLD
This touches everything that ends up in the Xorg binary; the big missing
part is GLX since that's all generated code. Cuts about 14k from the
binary on amd64.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2017-03-01 10:16:20 -05:00
Peter Hutterer f485a1af64 Drop valuator mask argument from GetKeyboardEvents
Nothing was using it and if anyone had they would've gotten a warning and
noticed that it doesn't actually work. Drop this, it has been unused for years.

Input ABI 22

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2015-03-13 12:31:21 +10:00
Keith Packard 60014a4a98 Replace 'pointer' type with 'void *'
This lets us stop using the 'pointer' typedef in Xdefs.h as 'pointer'
is used throughout the X server for other things, and having duplicate
names generates compiler warnings.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-01-12 10:24:11 -08:00
Peter Hutterer 8571c648a7 Xext: if a root window is given in XTestFakeInput, move to that
For absolute events, if the client specifies a screen number offset the
coordinates by that. And add a new flag so we know when _not_ to add the
screen offset in GPE.

Without this offset and the flag, GPE would simply add the offset of the
current screen if POINTER_SCREEN is set.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-02-08 13:49:49 +10:00
Peter Hutterer 9fd6cb8953 Xext: pass the current screen to miProcessDeviceEvent() from xtest calls
Not passing in a screen means we skip the screen crossing updates, so a
xtest event that changes between ScreenRecs won't do so until the next
physical event comes in or never, whichever comes earlier.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-02-08 13:47:24 +10:00
Alan Coopersmith 48bc30c541 Xext: avoid null-pointer dereference in XTestFakeInput (#59937)
dv is still NULL at this point, so return firstValuator instead (which is
the same value dv->firstValuator would be once initialized)

X.Org Bug 59937 <http://bugs.freedesktop.org/show_bug.cgi?id=59937>

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-02-08 13:47:23 +10:00
Yaakov Selkowitz 20cf7918ed Xext: fix redundant redeclaration warnings
panoramiX.c:595:13: warning: redundant redeclaration of 'CreateConnectionBlock'
../include/dix.h:167:23: note: previous declaration of 'CreateConnectionBlock' was here
xres.c:193:13: warning: redundant redeclaration of 'ResExtensionInit'
../include/extinit.h:109:13: note: previous declaration of 'ResExtensionInit'
xtest.c:60:12: warning: redundant redeclaration of 'DeviceValuator'
../Xi/exglobals.h:61:12: note: previous declaration of 'DeviceValuator' was here

Signed-off-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-11-05 13:25:07 -06:00
Daniel Stone a1d41e311c Move extension initialisation prototypes into extinit.h
Create extinit.h (and xf86Extensions.h, for Xorg-specific extensions) to
hold all our extension initialisation prototypes, rather than
duplicating them everywhere.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-09 23:06:41 -07:00
Tomas Carnecky 5079db78ae Replace INITARGS with void
INITARGS was a hardcoded define to void.  Since knowing the function
signature for your extensions is kinda useful, just replace it with a
hardcoded void, but leave the define there for API compatibility.

Signed-off-by: Tomas Carnecky <tom@dbservice.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Cyril Brulebois <kibi@debian.org>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-09 23:06:41 -07:00
Alan Coopersmith 6a721e3af5 Use C99 designated initializers in Xext Replies
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Tested-by: Daniel Stone <daniel@fooishbar.org>
2012-07-09 19:58:30 -07:00
Alan Coopersmith 789d64e19a Remove unneccesary casts from WriteToClient calls
Casting return to (void) was used to tell lint that you intended
to ignore the return value, so it didn't warn you about it.

Casting the third argument to (char *) was used as the most generic
pointer type in the days before compilers supported C89 (void *)
(except for a couple places it's used for byte-sized pointer math).

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Tested-by: Daniel Stone <daniel@fooishbar.org>
2012-07-09 19:12:56 -07:00
Peter Hutterer 6b6afd3d01 Xext: return BadAccess if PickPointer fails (#45796)
PickPointer or PickKeyboard return NULL, all MDs are currently disabled and
we cannot emulate a core event. This wasn't anticipated by the protocol, so
we don't really have an error code we may use here - BadAccess is simply the
least bad of the possible ones.

And returning BadAccess beats crashing the server.

X.Org Bug 45796 <http://bugs.freedesktop.org/show_bug.cgi?id=45796>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-03-22 11:33:20 +10:00
Keith Packard 9838b7032e Introduce a consistent coding style
This is strictly the application of the script 'x-indent-all.sh'
from util/modular. Compared to the patch that Daniel posted in
January, I've added a few indent flags:

	-bap
	-psl
	-T PrivatePtr
	-T pmWait
	-T _XFUNCPROTOBEGIN
	-T _XFUNCPROTOEND
	-T _X_EXPORT

The typedefs were needed to make the output of sdksyms.sh match the
previous output, otherwise, the code is formatted badly enough that
sdksyms.sh generates incorrect output.

The generated code was compared with the previous version and found to
be essentially identical -- "assert" line numbers and BUILD_TIME were
the only differences found.

The comparison was done with this script:

dir1=$1
dir2=$2

for dir in $dir1 $dir2; do
	(cd $dir && find . -name '*.o' | while read file; do
		dir=`dirname $file`
		base=`basename $file .o`
		dump=$dir/$base.dump
		objdump -d $file > $dump
	done)
done

find $dir1 -name '*.dump' | while read dump; do
	otherdump=`echo $dump | sed "s;$dir1;$dir2;"`
	diff -u $dump $otherdump
done

Signed-off-by: Keith Packard <keithp@keithp.com>
Acked-by: Daniel Stone <daniel@fooishbar.org>
Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-03-21 13:54:42 -07:00
Alan Coopersmith 05f589d464 Fix gcc -Wwrite-strings warnings in various extensions
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23 12:15:07 -08:00
Alan Coopersmith e189dbb3e5 Convert AllocXTestDevice to use asprintf
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23 12:15:05 -08:00
Matt Turner 2c7c520cfe Use internal temp variable for swap macros
Also, fix whitespace, mainly around
	swaps(&rep.sequenceNumber)

Reviewed-by: Peter Harris <pharris@opentext.com>
Signed-off-by: Matt Turner <mattst88@gmail.com>
2011-09-21 17:12:04 -04:00
Peter Hutterer 87d4f90bfc input: free the EQ allocated memory on shutdown (#38634)
mieqFini() already does the right thing, but it needs to be called by the
various DDXs and the XTest Extension.

X.Org Bug 38634 <http://bugs.freedesktop.org/show_bug.cgi?id=38634>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Acked-by: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-07-01 08:46:28 +10:00
Peter Hutterer 8670c46bdf input: replace EventListPtr with InternalEvent array
EventListPtr is a relic from pre-1.6, when we had protocol events in the
event queue and thus events of varying size.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-05-11 14:27:36 +10:00
Peter Hutterer 071a6ac4d0 input: remove GetKeyboardValuatorEvents, this is now unnecessary.
GetKeyboardValuatorEvents handles NULL valuator masks already, so the
GetKeyboardEvents wrapper is not needed. Rename GKVE to GKE.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-04-18 13:05:46 +10:00
Tiago Vignatti aa7096ca6f xorg: remove unused pointer values all over the server
Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Nicolas Peninguy <nico@lostgeeks.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-04-04 15:41:13 +03:00
Peter Hutterer 675f4a8525 Abstract valuator masks through a set of APIs.
This commit introduces an abstraction API for handling masked valuators. The
intent is that drivers just allocate a mask, set the data and pass the mask
to the server. The actual storage type of the mask is hidden from the
drivers.

The new calls for drivers are:
    valuator_mask_new()     /* to allocate a valuator mask */
    valuator_mask_zero()    /* to reset a mask to zero */
    valuator_mask_set()     /* to set a valuator value */

The new interface to the server is
    xf86PostMotionEventM()
    xf86PostButtonEventM()
    xf86PostKeyboardEventM()
    xf86PostProximityEventM()

all taking a mask instead of the valuator array.

The ValuatorMask is currently defined for MAX_VALUATORS fixed size due to
memory allocation restrictions in SIGIO handlers.

For easier review, a lot of the code still uses separate valuator arrays.
This will be fixed in a later patch.

This patch was initially written by Chase Douglas.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-10-22 11:02:48 +10:00
Tiago Vignatti cbd4d5dbb7 xserver: delete pervasively use of DISPATCH_PROC
Some functions had to be moved around due some missing static definitions.
Another minor clean up like inexistent function declarations and etc were made
also.

Part of this patch was cooked using:
sed -i -e '/static DISPATCH_PROC*.*;/d' `git ls-files`

Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
2010-09-28 16:45:05 +03:00
Mikhail Gusarov 7287ef9e6c Remove unnecessary parentheses around return values in functions
This patch was generated by the following Perl code:

perl -i -pe 's/([^_])return\s*\(\s*([^(]+?)\s*\)s*;(\s+(\n))?/$1return $2;$4/g;'

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-06-10 06:42:42 -07:00
Keith Packard 8e97e5f942 If XTest is always required, then eliminate the XTest devPrivate
The internals of XTest are used by Xi and Xkb, and both Xi and Xkb are
always required, so it makes little sense to have XTest place data in
a devPrivate, especially a devPrivate which is only available when the
XTest extension is enabled.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-06-07 19:56:47 -07:00
Keith Packard bc26665661 Initialize private keys in test suite
Make sure all of the private keys used by the test code are
initialized before being used.

Signed-off-by: Keith Packard <keithp@keithp.com>
Tested-by: Robert Hooker <sarvatt@ubuntu.com>
2010-06-06 21:24:04 -07:00
Keith Packard faeebead7b Change the devPrivates API to require dixRegisterPrivateKey
This patch only changes the API, not the implementation of the
devPrivates infrastructure. This will permit a new devPrivates
implementation to be layed into the server without requiring
simultaneous changes in every devPrivates user.

Signed-off-by: Keith Packard <keithp@keithp.com>
Tested-by: Tiago Vignatti <tiago.vignatti@nokia.com>
2010-06-05 19:23:03 -07:00
Jamey Sharp e291c56182 Return an appropriately-typed error from dixLookupResourceByType.
Rather than always returning BadValue, associate an error status like
BadWindow with a resource type like RT_WINDOW, and return the
appropriate one for the requested type.

This patch only touches the core protocol resource types. Others still
return BadValue and need to be mapped appropriately.

dixLookupResourceByType can now return BadImplementation, if the caller
asked for a resource type that has not been allocated in the server.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2010-05-19 12:32:48 -07:00
Jamey Sharp 92ed75ac59 Eliminate boilerplate around client->noClientException.
Just let Dispatch() check for a noClientException, rather than making
every single dispatch procedure take care of it.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2010-05-13 17:14:07 -07:00
Mikhail Gusarov 3f3ff971ec Replace X-allocation functions with their C89 counterparts
The only remaining X-functions used in server are XNF*, the rest is converted to
plain alloc/calloc/realloc/free/strdup.

X* functions are still exported from server and x* macros are still defined in
header file, so both ABI and API are not affected by this change.

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-05-13 00:22:37 +07:00
Peter Hutterer af170a4ab7 Xext: only update the sprite on pointer events.
A call to miPointerUpdateSprite for the XTEST keyboard may result in a
NULL pointer dereference in miDCPutUpCursor() when the save buffer is NULL.

XTS test case: Xlib 11 KeymapNotify

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-04-27 15:50:26 +10:00
Tiago Vignatti 0ba82562ee Death to Multibuffer extension
The rationale behind is because no sane application will use this when we have
modern APIs such DRI2. Besides, as a fact, xfree86 server has already
deprecated this extension in 1998:

    http://www.xfree86.org/3.3.6/isc7.html

Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-04-21 18:06:35 +03:00
Jamey Sharp b0dd6be2c8 Cast small-int values through intptr_t when passed as pointers
On 64-bit systems, int and pointers don't have the same size, so GCC gives
warnings about casts between int and pointer types. However, in the cases
covered by this patch, it's always a value that fits in int being stored
temporarily as a pointer and then converted back later, which is safe.
Casting through the pointer-sized integer type intptr_t convinces the
compiler that this is OK.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2009-10-08 13:38:44 +11:00
Peter Hutterer e62549b8d6 Xext: don't try to initialize XTEST device properties if they failed.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-10 09:48:05 +10:00
Peter Hutterer 903c3db1d1 Xext: rename Xtst* to XTest*
This patch corrects a misnaming of XTest-related functions.

The extension itself announces itself as XTEST. Xtst is the library name
itself, but all library functions are prefixed by XTest. Same with the
naming in the server.

- Rename all *Xtst* functions to *XTest* for consistency with the library
  and in-server API.
- Rename the "Xtst device" property to "XTEST device" for consistency with
  the extension naming.
- Rename the device naming to "<master device name> XTEST device". The
  default xtest devices become "Virtual core XTEST pointer" and "Virtual
  core XTEST keyboard".

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-27 14:24:51 +10:00
Peter Hutterer 8bfd23e144 input: move XTest device initialization into Xext/xtest.c
XTest devices are non-optional but nonetheless specific to the XTEST
extension.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-27 14:24:50 +10:00
Peter Hutterer 990d204ef8 Xext: remove un-used extern of DeviceMotionNotify.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-24 10:15:00 +10:00
Peter Hutterer e46f02fa2d Xext: allocate a separate event list for XTest events (#23100)
XTest event processing may be interrupted by a SIGIO. If Xtest uses the same
event list as the rest of the server, this list may be overwritten
in-flight.

X.Org Bug 23100 <http://bugs.freedesktop.org/show_bug.cgi?id=23100>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-13 11:19:35 +10:00
Peter Hutterer d3f6b43a24 Update to xextproto 7.0.99.1.
xextproto had Xlib client headers moved into libXext.
Protocol header files are named fooproto.h, header files with constants
foo.h or fooconst.h where foo.h was already in use for client-side headers.
2009-07-15 17:00:05 +10:00
Peter Hutterer 89cf81cd85 Xext: return BadValue for XTestFakeInput on unsupported capabilities.
Calling XTestFakeDevice*Event on a device that doesn't allow the matching
event returns BadValue.

Reported-by: Florian Echtler
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-06 12:59:42 +10:00
Peter Hutterer 744bb55982 Xext: remove unused variable 'it'.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-06 12:58:03 +10:00
Peter Hutterer 0814f511d5 input: store the master device's ID in the devPrivate for XTest devices.
Rather than storing a simple boolean in the devPrivate for XTest devices,
store the actual master device's id (since it is constant for the life of
the device anyway).

Callers should use GetXtstDevice now instead of digging around in the
devPrivates themselves.

This patch allows for a cleanup in the creation of new master devices since
GetMaster and GetXtstDevice spare the need for loops, IsPointer checks and
similar.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Benjamin Close <Benjamin.Close@clearchain.com>
2009-07-01 08:46:31 +10:00
Peter Hutterer b12d302df8 Input: rename DeviceIntRec->isMaster to ->type.
isMaster is not enough as long as we differ between master pointers and
keyboard. With flexible device classes, the usual checks for whether a
master device is a pointer (currently check for ->button, ->valuators or
->key) do not work as an SD may post an event through a master and mess this
check up.

Example, a device with valuators but no buttons would remove the button
class from the VCP and thus result in the
IsPointerDevice(inputInfo.pointer) == FALSE.

This will become worse in the future when new device classes are introduced
that aren't provided in the current system (e.g. a switch class).

This patch replaces isMaster with "type", one of SLAVE, MASTER_POINTER and
MASTER_KEYBOARD. All checks for dev->isMaster are replaced with an
IsMaster(dev).
2009-05-22 15:44:50 +10:00
Peter Hutterer 63a3c727b3 Xext: shut up compiler warnings in xtest.c
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-04 15:21:39 +10:00
Peter Hutterer 226dd90597 Xext: return BadDevice from XTest if we don't have keys/buttons/valuators.
BadDevice is an XI error, but this cannot happen for core XTest fake input
anyway since the device will be the matching virtual XTest slave device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-04 15:21:39 +10:00
Peter Hutterer 0fdff0a47a Xext: fix core Xtest button presses, don't call PickPointer.
We already did the device selection before, so dev should be the XTest virtual
pointer.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-04 15:21:39 +10:00
Benjamin Close fab563bf8f input: propagate XTst events through virtual slave devices.
A XTest virtual slave device pair (kbd/ptr) exists for every master
device pair. This is so XTest events are correctly propogated via slave
devices up to Master devices and the classes are correctly changed along
the way. We add the XTest slave device pair to the Virtual Core pointer
and provide a simple way of creating the devices.

A XTest Slave Device is identified by the XTstDevicePrivateKey property
being set in the devices devProperties

XI events are still propagated through the matching device, in the hope the
client knows what it is doing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-24 15:28:33 +10:00
Peter Hutterer 603db34337 Xext: set POINTER_SCREEN flag in XTestFakeInput if necessary. (RH #490984)
The POINTER_SCREEN flag must be set explicitly for XTest core events to avoid
out-of-range events when the lastSlave was an SD with an explicit axis range.
Device events sent through XTest don't need this flag, they are expected to be
in the valuator range of the device anyway.

Red Hat Bug 490984 <https://bugzilla.redhat.com/show_bug.cgi?id=490984>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-27 11:26:15 +10:00
Keith Packard f8dd80d13b Replace dixLookupResource by dixLookupResourceBy{Type,Class}
dixLookupResource attempted to automatically detect whether the caller
wanted a lookup by-type or by-class, unfortunately, it guessed wrong for
RT_NONE. Instead of trying to make the guess better, this patch just reverts
the unification and creates separate functions for each operation.
2009-03-09 13:08:09 -07:00
Peter Hutterer 36583a4996 mi: split EQ popping and event processing into two functions.
mieqProcessInputEvents() - pop an event off the EQ and pass it to
mieqProcessDeviceEvent() - process the event according to the MD/SD hierarchy.

This way, we can use mieqPDE() from Xtest, xkb, and others to post an event.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-23 17:52:40 +10:00