Commit Graph

32 Commits

Author SHA1 Message Date
Povilas Kanapickas b544a1fdb8 xi: Implement internal gesture event struct 2021-05-30 13:26:31 +03:00
Povilas Kanapickas 22fa31ed56 dix: Add new internal event enums for gesture events 2021-05-30 13:26:30 +03:00
Laurent Carlier e790bc621b dga: #if XFreeXDGA → #ifdef XFreeXDGA
../include/events.h:32:14: error: #if with no expression

Signed-off-by: Laurent Carlier <lordheavym@gmail.com>
2018-02-19 13:14:43 -05:00
Daniel Stone 816015648f Input: Add focus-in event source
Add a new event source type for keypress events synthesised from focus
notifications (e.g. KeymapNotify from the parent server, when running
nested). This is used to keep the keys-down array in sync with the host
server's, without sending actual keypress events to clients.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-24 11:36:34 +10:00
Daniel Stone c3788394e9 Input: Add DeviceEventSource enum
Add a flag to DeviceEvents, giving the source of the event. Currently
this only supports a 'normal' flag, but will be used later to add a
'focus-in' flag, noting events synthesised from key/button arrays on
focus-in notifications.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-24 11:36:32 +10:00
Alan Coopersmith 30c3852bda Delete stray ; in struct _DeviceChangedEvent
Caused Solaris Studio cc to complain in every file which included it:
 "../include/eventstr.h", line 179: warning: syntax error:
  empty member declaration

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-02-09 17:21:20 -08:00
Peter Hutterer a7d989d335 Xi: use public.processInputProc to replay the touch history
If a device is frozen in results to a grab, we need to enqueue the events.

This makes things complicated, and hard to follow since touch events are now
replayed in the history, pushed into EnqueueEvent, then replayed later
during PlayReleasedEvents in response to an XAllowEvents.

While the device is frozen, no touch events are processed, so if there is a
touch client with ownership mask _below_ the grab this will delay the
delivery and potentially screw gesture recognition. However, this is the
behaviour we have already anyway if the top-most client is a sync pgrab or
there is a sync grab active on the device when the TouchBegin was generated.

(also note, such a client would only reliably work in case of ReplayPointer
anyway)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-05-10 14:32:36 +10:00
Peter Hutterer 23d1bc69f3 dix: send the current axis value in DeviceChangedEvents (#62321)
X.Org Bug 62321 <http://bugs.freedesktop.org/show_bug.cgi?id=62321>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-05-07 09:40:42 +10:00
Jasper St. Pierre e130a46ab4 Add support for XI2.3: Pointer barrier events and releases.
This adds support for clients that would like to get a notification
every time a barrier is hit, and allows clients to temporarily release
a barrier so that pointers can go through them, without having to
destroy and recreate barriers.

Based on work by Chris Halse Rogers <chris.halse.rogers@canonical.com>

Signed-off-by: Jasper St. Pierre <jstpierre@mecheye.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-12-17 15:01:45 +10:00
Peter Hutterer b34cffd27b include: fix comment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-12-09 22:23:05 -05: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
Peter Hutterer 93c2a1628a Hook up the ownership events
This patch applies most of the protocol conversions and the internal event
type for ownership events.

Note that ownership events are generated by the DIX only, they do not pass
through the event queue.

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-19 09:08:32 +10:00
Peter Hutterer 3390d3fc03 Xi: process raw touch events
No-one can generated them yet, but if they could, we'd be processing them
like there was no tomorrow.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-16 11:18:47 +10:00
Peter Hutterer 84db813b9d Hook up TouchBegin/Update/End events
The are the same as device events internally but require the touch ID
separately from the detail.button field (the protocol uses the detail field
for the touch id).
For simpler integration of pointer emulation we need to set the
detail.button field while keeping the touchid around.

Add the three new touch event types to the various places in the server
where they need to be handled. The actual handling of the events is somewhat
more complicated in most places.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-16 11:18:47 +10:00
Peter Hutterer 8473e441b0 dix: add ScrollInfo to DeviceChangedEvents
3304bbff9b added smooth scrolling support for
pointer events and for XIQueryDevice but didn't add the matching parts to
XIDeviceChangedEvents.

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
Daniel Stone 2d9beeb217 Input: Make DeviceEvent use doubles internally
Change the DeviceEvent InternalEvent to use doubles for its valuators,
instead of data and data_frac.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-29 12:24:34 +10:00
Daniel Stone 626f487b97 Input: Make RawDeviceEvent use doubles internally
Change RawDeviceEvent to use doubles for valuators internally, rather
than data(_raw) and data(_raw)_frac.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-29 12:24:34 +10:00
Daniel Stone 60a766a96f Input: Add flags to RawDeviceEvent
Add a flags member which will be copied wholesale into the resultant
xXIRawEvent.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2011-09-29 12:23:51 +10:00
Daniel Stone 5d62c32981 Input: Add flags to DeviceEvent
Add a flags member which will be copied wholesale into the resultant
xXIDeviceEvent.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-29 12:23:07 +10:00
Peter Hutterer 5690199802 input: change CHECKEVENT macro to verify_internal_event function
The macro is sufficient if called during a development cycle, but not
sufficient information when triggered by a user (e.g.
https://bugzilla.redhat.com/show_bug.cgi?id=688693).

Expand what this does to print the event content and a backtrace, so at
least we know where we're coming from. Only the first 32 bytes are printed
since if something goes wrong, the event we have is almost certainly an
xEvent or xError, both restricted to 32 bytes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-05-06 09:58:08 +10:00
Ville Syrjala a2c4818219 include: Fix a copy/paste error in a comment
Signed-off-by: Ville Syrjala <syrjala@sci.fi>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-01-27 14:22:02 +10:00
Joe Shaw e354ccac36 fix a sign problem with valuator data.
Without this patch, any negative valuator value is wrong when returned
from XQueryDeviceState().  This is a regression from at least xserver
1.4.

Valuator data is set in dix/getevents.c:set_valuators() by copying
signed int values into an unsigned int field
DeviceEvent.valuators.data.

That data is converted into a double with an implicit cast by
assignment to axisVal[i] in Xi/exevents.c:UpdateDeviceState().

That double is converted back to a signed int in
queryst.c:ProcXQueryDeviceState().  If the original value in
set_valuators() is negative, the double value will be > 2^31 and the
conversion back to a signed int is undefined.  (Although I
consistently see the value -2^31.)

Fix this by changing the definition of DeviceEvent.valuators.data from
uint32_t to int32_t.

Signed-off-by: Joe Shaw <joeshaw@litl.com>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-10-18 10:16:23 +10:00
Chris Humbert 21ed660f30 dix: make DeviceEvent coordinates signed for Xinerama. #24986
With Xinerama enabled, event coordinates are relative to Screen 0, so
they can be negative.  The new DeviceEvent's coordinates are of type
uint16_t, making screens above and to the left of Screen 0 unusable.

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

Signed-off-by: Chris Humbert <freedesktop@mahadri.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-05-07 12:17:22 -07:00
Adam Tkac 8d53d84485 Do not define members of include/eventstr.h:EventType enum conditionally.
Main problem is that EventType enumeration members can be different in
module and in server, which obviously causes problems.

Signed-off-by: Adam Tkac <atkac@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-01-07 08:03:46 -08:00
Jeremy Huddleston 226b1033b4 XQuartz: Transition from xEvent based mieq to InternalEvent
(cherry picked from commit a3dbde2de8)
2009-09-27 23:31:07 -07:00
Peter Hutterer 90aa0e4a49 input: don't use typecasts to access members of InternalEvent.
To avoid confusion, the member names are now postfixed with _event.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-22 11:15:32 +10:00
Daniel Stone bfb219f532 input: allow for detectable autorepeat.
For core and XI1 events, store the key_repeat flag in the sequence number
until TryClientEvents. The sequenceNumber is unset until TryClientEvents.

[Also thrown in, some random indentation changes. Thanks]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-04 12:59:41 +10:00
Peter Hutterer 2851f04cb2 dix: rework DeviceChangedEvents a bit.
DCEs are now processed when sent throught the master device, not when sent
through the slave device. This includes a removal of some un-used (or partly
used) fields in the DCE itself to something more self-explanatory.

TODO: if a device has events queued and its attachment is changed, the DCE
is silently dropped now. Instead, it should be generated as soon as the
first event after the attachment is sent.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-17 13:25:35 +10:00
Peter Hutterer b44d34d5fd include: correct a copy/paste error in a comment.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-13 11:19:36 +10:00
Peter Hutterer 5085ac09a5 input: switch internal event types to enums.
Use enum EventType instead of ints. This requires a load of default
cases in various switch statements to silence compiler warnings.

Reported-by: Aaron Plattner
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-30 08:43:14 +10:00
Peter Hutterer 1ae8332d64 include: fix enum EventType declaration.
Having EventType after the enum declares a variable. silly me.

Reported-by: Aaron Plattner
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-30 08:43:14 +10:00
Peter Hutterer 4e9b2938cd include: untangle events.h from the SDK headers.
InternalEvents shouldn't be used anywhere outside the X server itself. Split
up into events.h for opaque typedefs for the events needed by various
headers and eventstr.h for the actual struct definitions.

eventstr.h must only be included by code that requires internal events and
is not part of the SDK.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-30 08:43:13 +10:00