Commit Graph

64 Commits

Author SHA1 Message Date
Povilas Kanapickas 080bac39c8 xi: Implement grab support for new gesture event types 2021-05-30 13:26:32 +03:00
Peter Hutterer ca6d25ad2d dix: Move DeviceFocusEvent from Xi into enterleave.c
This is only called from the enterleave implementation, so move it and its
helper functions to there. No functional changes.

Fixes build error introduced in 31174565ec if
building with '-Werror=implicit-function-declaration'

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-05-17 08:50:44 +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
Chase Douglas 192b2c9a2e Export TouchEventRejected as TouchRejected
This function is mostly correct for early reject usage. With a small
change to pass the client resource explicitly and making the
TouchOwnership event optional, it is usable for all rejection scenarios.
This change exports it for use outside Xi/exevents.c and modifies the
name accordingly.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-02-08 18:04:15 +10:00
Peter Hutterer ed8f3c4bd1 Xi: change XIChangeDeviceProperty from const pointer to const void *
According to Daniel Kurtz, a typedef void *pointer is a atomic type. So a
'const pointer' is equivalent to 'void* const' instead of the intended
'const void*'.

This technically changes the ABI, but we don't bump it for this.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-01-06 14:04:45 +10:00
Peter Hutterer 4469430b10 Xi: add the hooks for passive touch grabs
Co-authored-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21 14:16:33 +10:00
Daniel Stone 8e58ce73c8 dix: when a window disappears, remove it from the touch sprite trace
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21 12:38:35 +10:00
Peter Hutterer 218752bdc5 input: replace GRABTYPE_* with the InputLevel enums
They achieve the same thing, re-use the more generic InputLevel so we can
convert to/fro easier.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-13 13:24:08 +10:00
Alan Coopersmith 5f285a30a1 Make XIGetKnownProperty take a const char * argument
Now that MakeAtom takes const char *, so can XIGetKnownProperty.
Clears 71 warnings from gcc -Wwrite-strings of the form:
devices.c:145:5: warning: passing argument 1 of 'XIGetKnownProperty' discards qualifiers from pointer target type
../include/exevents.h:128:23: note: expected 'char *' but argument is of type 'const char *'

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-11-23 12:15:06 -08:00
Peter Hutterer fcdd2587a1 dix: drop unused argument from XISendDeviceChangedEvent
Instead of device and master (and just using master), drop the master
argument and let the callers pass in the device the event is to be sent for.

No effective functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-10-25 14:06:41 +10:00
Peter Hutterer 3304bbff9b Input: Add smooth-scrolling support to GetPointerEvents
For scroll wheel support, we used to send buttons 4/5 and 6/7 for
horizontal/vertical positive/negative scroll events.  For touchpads, we
really want more fine-grained scroll values.  GetPointerEvents now
accepts both old-school scroll button presses, and new-style scroll axis
events, while emitting both types of events to support both old and new
clients.

This works with the new XIScrollClass to mark axes as scrolling axes.
Drivers mark any valuators that send scroll events with SetScrollValuator.
(Currently missing: the XIDeviceChangeEvent being sent when a driver changes
a scroll axis at run-time. This can be added later.)

Note: the SCROLL_TYPE enums are intentionally different values to the XI2
proto values to avoid copy/overlapping range bugs.

Co-authored-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-09-30 09:24:18 +10:00
Peter Hutterer 8d1a414cca input: switch InitValuatorAxisStruct to return Bool
Return errors instead of silently ignoring them.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-09-29 12:26:43 +10:00
Peter Hutterer 81daba8ce9 Xi: constify XIChangeDeviceProperty()
We don't modify "value", make it official.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com>
2011-02-14 09:12:58 +10:00
Daniel Stone 03f2eb1e15 Input: Set client error value for invalid mask bits
When we send BadValue back to the client for having invalid mask bits,
at least tell them what the (first) invalid bit was.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-12-31 12:36:44 +00:00
Chase Douglas 65c0fc81eb Add support for per-axis valuator modes (Relative/Absolute)
The XI2 protocol supports per-axis modes, but the server so far does
not. This change adds support in the server.

A complication is the fact that XI1 does not support per-axis modes.
The solution provided here is to set a per-device mode that defines the
mode of at least the first two valuators (X and Y). Note that initializing
the first two axes to a different mode than the device mode will fail.

For XI1 events, any axes following the first two that have the same mode
will be sent to clients, up to the first axis that has a different mode.
Thus, if a device has relative, then absolute, then relative mode axes,
only the first block of relative axes will be sent over XI1.

Since the XI2 protocol supports per-axis modes, all axes are sent to the
client.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
2010-10-22 13:37:57 +10:00
Peter Hutterer 0fb7a5c261 input: Purge Register*Device() functions.
RegisterPointerDevice() and RegisterKeyboardDevice() were already mapped to
RegisterOtherDevice() and obsolete.

RegisterOtherDevice() was called for all devices and the two assignments can
simply be moved into AddInputDevice(). Purge RegisterOtherDevice() and
pretend it never happened.

*lalalalala*

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2010-09-01 15:26:47 +10:00
Peter Hutterer 377a5f655c Xi: if XISetEventMask fails, return this to the client.
The only failure point can be a BadAlloc.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-03 08:39:27 +10:00
Peter Hutterer 727de7c90d Xi: Unify checking for invalid bits in grab masks.
Bits above XI2LASTEVENT are invalid and cause in BadValues. These checks
must be performed anywhere where a mask_len parameter is given.

This patch also adds the missing checks to grab masks.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-03 08:39:27 +10:00
Peter Hutterer 33eb6f7081 include: Unexport most symbols from exevents.h.
And shuffle them around so that the part used by drivers is up the top and
commented.

Also, woo, the sdksyms script doesn't like declarations with return type and
function name on the same line...

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-17 10:14:20 +10:00
Peter Hutterer 3f161a0aac Xi: un-statify XI2EventSwap, it is needed for tests.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-13 11:19:35 +10:00
Peter Hutterer de4dd5848c include: DeviceFocusEvent is not to be exported.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-30 11:04:32 +10:00
Peter Hutterer a30fef9956 input: Add labels to buttons and valuators - ABI_XINPUT_VERSION 7
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-18 14:41:47 +10:00
Peter Hutterer 080b0331b3 input: Add grabtype to GrabParameters.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-01 13:48:43 +10:00
Peter Hutterer a7e23a79c1 Xi: Add support for Enter and FocusIn grabs.
Enter grabs are checked for in CheckMotion(), each time the sprite window
changes the current grab is deactivated (if applicable) and the new grab is
activated (if applicable). Exception - if the grab is on a parent window of
the current window since we keep the grab across descendants.

Since CheckMotion() may change the grab status of a device, we mustn't get
"dev->deviceGrab.grab" in ProcessOtherEvents until after CheckMotion().
FocusIn grabs are checked in much the same manner.

The event delivery for grabs replaces the NotifyNormal on window change with
a NotifyGrab on window change. Note that this happens before the grab
activates, so the EnterNotify(NotifyGrab) is still delivered to the window,
not to the grabbing client. This is in line with the core protocol semantics
for NotifyGrab events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-27 14:40:58 +10:00
Peter Hutterer 6a618929a0 input: reshuffle CreateGrab and friends to take a GrabParameters param.
This is cleaning up work in preparation for XI2 passive grabs.
2009-05-01 09:07:37 +10:00
Peter Hutterer 8b6a370058 Add XI2 masks and XISelectEvent() request handling.
XI2 event masks are simply stored in the OtherEventMasks as a separate field.
This replaces the XiSelectEvent code.
2009-03-20 15:17:55 +10:00
Peter Hutterer 38bba0c1b7 Xi: Change ChangeMasterDeviceClasses to new XI2 events.
Split ChangeMasterDeviceClasses into an extra XISendDeviceChangedEvent that
assembles the XI2 wire event for the DeviceChanged event. Re-use this when
detaching the last SD.

Not quite perfect yet, we still copy the device classes from the slave now
rather than from the data we had when the event occured. But it's a start.

(We can now unexport SizeDeviceInfo and CopySwapDevices, not needed anymore)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-20 15:17:55 +10:00
Peter Hutterer 763848d3ab Input: change processing API to InternalEvents.
Don't pass xEvent* and count through to processing, pass a single
InternalEvent.

Custom handlers are disabled for the time being. And for extra fun,
XKB's pointer motion emulation is disabled. But stick an error in there so
that we get reminded should we forget about it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-23 17:52:40 +10:00
Peter Hutterer 8829d966a6 Xi: support InternalEvents in UpdateDeviceState, parts of POE and EnqueueEvent
Note that this breaks DGA. Life is tough.

EnqueueEvent is a somewhat half-baked solution, we immediately drop back into
XI and store them. But it should in theory work.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

Don't let the dcce be random data.
2009-02-23 17:52:39 +10:00
Peter Hutterer 58f3127919 Xi: remove dynamic mask assignment for XI events.
They end up being the same anyway on startup, so let's not have a dynamic mask
assignment mechanism and instead just hardcode them already.
Also unexport SelectForWindow and remove the valid_masks parameter. We can
check that before calling, since there's only one caller anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-16 13:28:17 +10:00
Daniel Stone bc909f7136 Input: Centralise pointer map changing
Replace both core and Xi functions with one function that validates the
proposed map, and sends out both kinds of notification.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-22 15:08:58 +11:00
Daniel Stone f06a9d2e05 Input: Clean up keymap change notifications
Keyboard map notifications are always generated from within XKB code,
which also takes care of copying the keysyms, etc.  If you need to
mangle the keymap yourself, generate a new core keymap/modmap, and pass
it to XkbApplyMappingChange.

SendMappingNotify is renamed to SendPointerMappingNotify (and ditto its
Device variants), which still only _sends_ the notifications, as opposed
to also doing the copying a la XkbApplyMappingChange.

Also have the modmap change code traverse the device hierachy, rather
than just going off the core keyboard.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2009-01-22 15:08:58 +11:00
Daniel Stone 1d1a0f67ee Xi: Introduce XIShouldNotify
XIShouldNotify just lets you know if you should send an event for a
keymap change (or similar) concerning a given device to a given client;
at the moment, this is only for devices which are sending events to that
client.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-22 15:08:58 +11:00
Daniel Stone f062e90a95 Input: Remove modifierKeyMap
Since modifierKeyMap is generated from modifierMap, just remove it, and
only generate it when we need to send the modifier map to the client.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-22 15:08:55 +11:00
Peter Hutterer a48c81dcdf Xi: add XATOM_FLOAT to server-defined properties.
This property is used to denote type float for input properties. Such
properties can be accessed easily through the XIPropToFloat() function.

Code originally written by Simon Thum.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2009-01-12 12:55:27 +10:00
Peter Hutterer 669f6810af Xi: add XIPropToInt() auxiliary function.
Converts an XIPropertyValuePtr to an integer, provided that type and format is
right.

Code originally written by Simon Thum.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2009-01-12 12:55:27 +10:00
Peter Hutterer fd2d40b7ec Xi: change XIUnRegisterPropertyHandler to XIUnregisterPropertyHandler
CamelCase can be taken too far, and AFAICT there's no consumers of that
function yet anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-12-03 20:25:15 +10:00
Paulo Cesar Pereira de Andrade 49f77fff14 Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.

  This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)

  LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.

  xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 05:43:34 -02:00
Peter Hutterer de1a8b68eb xkb: extract the correct device in XkbFilterEvents.
If the event is an XI event, we need to work on the correct device, not on
the VCK.

Adds XIGetDevice(event) function to extract the device from an event.
2008-11-04 16:04:16 +10:30
Peter Hutterer f3f6ea89aa Xi: check all handlers before applying property changes.
The current code exposes to inconsistent updates, i.e. if handler N succeeds
but handler N+1 fails in setting the property, an error is returned to the
client although parts of the server now behave as if the property change
succeeded.

This patch adds a "checkonly" parameter to the SetProperty handler. The
handlers are then called twice, once with checkonly set to TRUE.
On the checkonly run, handlers _MUST_ return error codes if the property
cannot be applied. Handlers are not permitted to actually apply the changes.
On the second run, handlers are permitted to apply property changes.
Errors codes returned on the second run are ignored.
2008-10-13 13:50:40 +10:30
Peter Hutterer a2d83b9dc8 Xi: add "deletable" flag to properties, add DeleteProperty handler.
A property can only be deleted if any of the following is true:
- if a property is deletable and all handlers return Success.
- if a property is non-deleteable and the all handlers return Success AND the
  delete request does not come from a client (i.e. driver or the server).

A client can never delete a non-deletable property.
2008-09-26 13:32:08 +09:30
Peter Hutterer 22e9047268 Xi: allow Set/GetProperties to return a status, and honour this status code.
If a property handler now bails out, return the error code to the caller. This
allows to be slightly more specific with the errors.
2008-09-26 13:32:07 +09:30
Peter Hutterer 1e24e7b9df Xi: remove configure/query device property calls.
This removes all the meta-information about device properties (pending,
fromClient, range, valid_values, immutable).
2008-09-26 13:32:05 +09:30
Peter Hutterer 5bcc45e07e Xi: expose Enable/DisableDevice through XI_PROP_ENABLED property. 2008-07-13 20:54:33 +09:30
Peter Hutterer e4054e5cb3 Xi: pack the property stuff into a struct, make handlers a linked list.
We may need more than one handler to deal with a property (e.g. one in the
driver, one in the DIX), so get the handlers into a linked list and call them
one-by-one. This is of course slightly less entertaining than the hilarious
WRAP/UNWRAP game we play in other parts of the server.

XIRegisterPropertyHandler/XIUnregisterPropertyHandler are the interface
drivers/the DIX should use to attach themselves to the device.

XIDeleteAllDeviceProperties destroys everything, including the handlers.
2008-07-10 16:28:44 +09:30
Peter Hutterer 2039c6ea43 Xi: add support for input device properties.
Basically just copied from randr properties, with minor changes only.
Each device supports arbitrary properties that can be modified by clients.
Modifications to the properties are passed to the driver (if applicable) and
can then affect the configuration of the device.

Note that device properties are limited to a specific device. A property set
on a slave device does not migrate to the master.
2008-07-10 16:28:34 +09:30
Peter Hutterer 4ab01fe5db Revert "Xi: add support for input device properties."
Note to self: don't mix up branches with half-finished cherrypicks.

This reverts commit 666838fcc8.
2008-07-10 16:27:36 +09:30
Peter Hutterer 666838fcc8 Xi: add support for input device properties.
Basically just copied from randr properties, with minor changes only.
Each device supports arbitrary properties that can be modified by clients.
Modifications to the properties are passed to the driver (if applicable) and
can then affect the configuration of the device.

Note that device properties are limited to a specific device. A property set
on a slave device does not migrate to the master.
2008-07-10 16:02:55 +09:30
Peter Hutterer 46340b7406 Xi: change UpdateDeviceState to be _X_EXPORT. 2008-04-29 14:17:48 +09:30
Peter Hutterer b304b0a65c Xi: add versioning support.
Remember the version the client sent to us, so we can adjust our replies
accordingly. This requires the client to use the {major|minor}Version fields
in the GetExtensionVersion request. However, they were padding before, so we
must assume they are garbage if nbytes is non-zero. If nbytes is zero, the
client is probably a new client and we can handle it correctly.
2008-04-26 17:47:15 +09:30