Commit Graph

2250 Commits

Author SHA1 Message Date
Peter Hutterer
0d5bb88260 Merge branch 'ptraccel-fixes' into for-keith 2013-02-08 14:10:52 +10:00
Peter Hutterer
61a99aff9d dix: pre-scale relative events from abs devices to desktop ratio (#31636)
Absolute devices may send relative events depending on the mode (synaptics
by default, wacom per option). The relative events are added to the previous
position, converted into device coordinates and then scaled into desktop
coordinates for pointer movement.

Because the device range must be mapped into the desktop coordinate range,
this results in uneven scaling depending dimensions, e.g. on a setup with
width == 2 * height, a relative movement of 10/10 in device coordinates
results in a cursor movement of 20/10 (+ acceleration)

Other commonly user-visible results:
* the touchpad changing acceleration once an external monitor as added.
* drawing a circle on a wacom tablet in relative mode gives an ellipsis in
  the same ratio as the desktop dimensions.

Solution: pre-scale the incoming relative x/y coordinates by width/height
ratio of the total desktop size. Then add them to the previous
coordinates and scale back with the previous mapping, which will undo the
pre-scaling and give us the right movement.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-02-08 14:00:57 +10:00
Peter Hutterer
a6ba2b79ae dix: unify prefix for ptraccel debugging in DebugAccelF macro
If we're already using our own custom macro, might as well use it properly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-02-08 14:00:56 +10:00
Peter Hutterer
0d7d794060 dix: use BUG_RETURN_VAL for an error message
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-02-08 14:00:56 +10:00
Peter Hutterer
a0c38ea6cb dix: add some more info to a ptraccel debug msg
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-02-08 14:00:56 +10:00
Peter Hutterer
95125a7c0c dix: fix ptraccel debugging printfs
This is mostly sigsafe code, so use sigsave printf. And update some fields
to double that used to be int.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-02-08 14:00:53 +10: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
Sybren van Elderen
a191dbfe85 dix: when scaling from desktop coord, take the total desktop size (#51904)
Scaled is already in desktop coordinates, take the total width into account,
not just the current screen's width.

Fixes Xdmx pointer position calculation.

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

Signed-off-by: Sybren van Elderen <sowmestno@msn.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:24 +10:00
Peter Hutterer
fa6ab7d9b2 Merge branch 'pointer-emulation-fixes-56558-v2' into for-keith 2013-01-11 14:58:17 +10:00
Peter Hutterer
adde4e6448 dix: typo fix in comment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-01-11 14:57:48 +10:00
Benjamin Tissoires
05ed095dd8 dix: fix error logging occuring in signal context of GetTouchEvents
GetTouchEvents is usually called in a signal context.
Calling ErrorF for the error messages leads to X complaining about log:

(EE) BUG: triggered 'if (inSignalContext)'
(EE) BUG: log.c:484 in LogVMessageVerb()
(EE) Warning: attempting to log data in a signal unsafe manner while in signal context.
Please update to check inSignalContext and/or use LogMessageVerbSigSafe() or ErrorFSigSafe().
The offending log format message is:
%s: Attempted to start touch without x/y (driver bug)

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-01-11 14:57:48 +10:00
Peter Hutterer
4e13dd9014 dix: don't filter RawEvents if the grab window is not the root window (#53897)
If a XI2.1+ client has a grab on a non-root window, it  must still receive
raw events on the root window.

Test case: register for XI_ButtonPress on window and XI_RawMotion on root.
No raw events are received once the press activates an implicit grab on the
window.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-01-11 14:57:29 +10:00
Peter Hutterer
0e1ab433f4 dix: remove already-moved hunk
Should've been removed in bc1f90a615018c05994fae3e678dd2341256cd82a, but got
left here due to a botched rebase.

Fixes stray button events sent to clients after deactivating an async
pointer grab on a pointer-emulating-touch.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-01-09 12:33:49 +10:00
Peter Hutterer
32a6d8a6b5 dix: check for the right device's xi2 mask
events.c: In function 'DeactivatePointerGrab':
events.c:1524:51: warning: 'dev' may be used uninitialized in this function
[-Wuninitialized

dev is unset when we get here, the device to check is "mouse".
Introduced in ece8157a59.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-01-09 12:33:43 +10:00
Peter Hutterer
f59499b5d0 dix: add resource type to touch listeners
Instead of guessing what resource type the listener is and what property to
retrieve, store the resource type in the listener directly.

Breaks XIT test cases:
TouchGrabTestMultipleTaps.PassiveGrabPointerEmulationMultipleTouchesFastSuccession

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=56557

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Chase Douglas <chase.douglas@ubuntu.com>
2013-01-09 12:33:36 +10:00
Keith Packard
9ad0fdb135 input: Record grab pointer in TouchListener
This places a pointer to the grab related to a TouchListener directly
in the TouchListener structure rather than hoping to find the grab
later on using the resource ID.

Passive grabs have resource ID in the resource DB so they can be
removed when a client exits, and those resource IDs get copied when
activated, but implicit grabs are constructed on-the-fly and have no
resource DB entry.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-01-09 12:33:33 +10:00
Keith Packard
0eb1559eb2 Merge remote-tracking branch 'yselkowitz/master'
I checked this patch with diff -w to check that it only affected
whitespace.
2012-12-19 12:22:03 -08:00
Keith Packard
014a5c8a9d Merge remote-tracking branch 'whot/barriers'
Conflicts:
	Xi/xichangehierarchy.c

Small conflict with the patch from

	Xi: don't use devices after removing them

Was easily resolved by hand.

Signed-off-by: Keith Packard <keithp@keithp.com>
2012-12-19 12:09:31 -08:00
Peter Hutterer
f793b5fd3e dix: don't copy the wrong event mask when activating a passive grab
GrabMask is a union of core, XI1 and XI2 masks. If a XI2 grab is activated,
the value is a random pointer value, using it as mask has unpredictable
effects.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2012-12-18 08:53:46 +10:00
Peter Hutterer
dd3242c87a dix: don't allow overriding a grab with a different type of grab (#58255)
If a client has a core grab, don't allow re-grabbing with type XI2, etc.
This was the intent of the original commit
xorg-server-1.5.99.1-782-g09f9a86, but ineffective.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2012-12-18 08:53:41 +10:00
Peter Hutterer
3b16140170 dix: ignore barrier events in FixUpEventFromWindow
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
2012-12-17 15:03:32 +10:00
Peter Hutterer
a1eeb6fbec dix: handle barrier events properly when converting to core/XI 1.x
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
2012-12-17 15:03:26 +10:00
Peter Hutterer
1b83775f67 dix: skip delivery if it's not the right pointer barrier client
Only deliver to the client that created the barrier, not to other clients.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
2012-12-17 15:03:23 +10:00
Peter Hutterer
21a15f9a04 Pass the event list through to the pointer barrier code to return it
Instead of having the pointer barrier code enqueue events separately from
GetPointerEvents, pass the event list through and let it add to it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
2012-12-17 15:03:12 +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
bb6f3514ca Merge branch 'stack-smash-on-touchpoint' into for-keith 2012-12-12 17:25:28 +10:00
Peter Hutterer
a7c97d737e dix: split xi2_mask_isset into a per-device function
For touch selection conflicts, we need to check not only if the mask is set
for the device, but if it is set for only that specific device (regardless
of XIAll*Devices)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-12-12 17:25:16 +10:00
Peter Hutterer
08da994a08 dix: add FIXME, TouchRemovePointerGrab does nothing
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-12-12 17:24:56 +10:00
Peter Hutterer
ece8157a59 dix: when deactivating pointer-only grabs, don't emulate TouchEnd events
A client with a pointer grab on a touch device must reject the touch when
detactivating the grab while the touch is active. However, such a rejecting
must not trigger a ButtonRelease event to be emulated and sent to the
client.
Set the grabbing listener's state to HAS_END, so we simply skip delivery to
that client.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-12-12 17:24:56 +10:00
Peter Hutterer
bc1f90a615 dix: only reject active grabs on ungrab and do it before actually ungrabbing
An active grab ungrabbing is the same as rejecting the grab, since the
client is no longer interested in those events. So reject any touch grab,
but do so before actually deactivating since we're interested in the
TouchEnd for the current grabbing client.

A passive grab otoh is _not_ like rejecting a grab, since it deactivates
automatically when the touch ends.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-12-12 17:24:56 +10:00
Peter Hutterer
146f48c293 dix: don't call ProcessInputEvents() when accepting/rejecting touches
TouchListenerAcceptReject may be called during normal event processing, but
ProcessInputEvents is not reentrant and calling it here smashes the event
queue.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-12-12 17:24:55 +10:00
Yaakov Selkowitz
ea1d76d1b6 Fix formatting of address operators
The formatter confused address operators preceded by casts with
bitwise-and expressions, placing spaces on either side of both.
That syntax isn't used by ordinary address operators, however,
so fix them for consistency.

Signed-off-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-12-05 18:09:48 -06:00
Peter Hutterer
ce6b652929 Merge branch 'high-resolution-touch-devices' into for-keith 2012-11-29 14:49:22 +10:00
Peter Hutterer
59d70b30e9 dix: use pixman for fp1616 conversions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Søren Sandmann <ssp@redhat.com>>
2012-11-29 14:48:54 +10:00
Peter Hutterer
2dc6d92284 When resetting device idle time, reset XIAll(Master)Devices too (#56649)
When the screen saver is forcibly deactivated, the idle time counter is
reset for all devices but not for the fake XIAllDevices and
XIAllMasterDevices. XScreenSaverQueryInfo uses XIAlldevices to fill the
"idle" field, thus returning the wrong value.

Regression introduced in
commit 6aef209ebc
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Mon Mar 12 13:51:02 2012 +1000

    Change lastDeviceIdleTime to be per-device

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Giacomo Perale <ghepeu@virgilio.it>
Reviewed-by: Keith Packard <keithp@keithp.com>
2012-11-29 14:48:54 +10:00
Jon TURNEY
fb170498ab dix/dispatch.c, os/utils.c: Disable smart scheduler on WIN32
setitimer() and SIGALRM aren't available on WIN32, so smart scheduler
code cannot be built.  Provide only stubs for smart scheduler timer
code, and disable smart scheduler by default.

Signed-off-by: Ryan Pavlik <rpavlik@iastate.edu>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Tested-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2012-11-28 14:44:12 +00:00
Yuly Novikov
3b9f1c7017 dix: Save touchpoint last coordinates before transform. #49347
DDXTouchPointInfoRec.valuators used to store axis values after transform.
This resulted in Coordinate Transformation Matrix
being applied multiple times to the last coordinates,
in the case when only pressure changes in the last touch event.

Changed DDXTouchPointInfoRec.valuators to store values before transform.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=49347

Signed-off-by: Yuly Novikov <ynovikov@chromium.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-11-20 16:06:06 +10:00
Thomas Jaeger
d0fd592fc7 Simplify GetTouchEvents
With only one callee left, we are free to assume that
!(flags & TOUCH_CLIENT_ID)

Signed-off-by: Thomas Jaeger <ThJaeger@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-11-20 15:42:46 +10:00
Thomas Jaeger
fe59774c55 Don't use GetTouchEvents in EmitTouchEnd
As before GetTouchEvents causes unwanted side effects.  Add a new
function GetDixTouchEnd, which generates a touch event from the touch
point.  We fill in the event's screen coordinates from the MD's current
sprite position.

Signed-off-by: Thomas Jaeger <ThJaeger@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-11-20 15:42:46 +10:00
Thomas Jaeger
cc79107a5b Don't use GetTouchEvents when replaying events
GetTouchEvents has plenty of side effects such as moving the pointer or
updating the master device, which we don't want to happen when
replaying.  The only reason for calling it was to generate a DCCE event,
but GetTouchEvents doesn't even do that right (we might need a DCCE
event even when replaying a master event, or clients could interpret
valuator data incorrectly).

This discussion is moot at the moment anyway, since DeliverTouchEvents
doesn't appear to deliver DCCE events.

Signed-off-by: Thomas Jaeger <ThJaeger@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>

[Added call to processInputProc instead of direct call to DeliverTouchEvents]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-11-20 15:42:01 +10:00
Thomas Jaeger
90b177e5cb Update the MD's position when a touch event is received
Signed-off-by: Thomas Jaeger <ThJaeger@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-11-20 15:14:43 +10:00
Thomas Jaeger
aa9da5eae1 remove init_event
The function is identical to init_device_event from inpututils.c with
the first two arguments swapped.

Signed-off-by: Thomas Jaeger <ThJaeger@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-11-19 12:12:28 +10:00
Peter Hutterer
fd214aabf7 input: drop FP1616 macro
The double_to_f1616() functions do the same thing, and they're tested.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2012-11-19 12:12:23 +10:00
Keith Packard
011f845880 Merge remote-tracking branch 'whot/for-keith' 2012-11-05 17:16:07 -08:00
Peter Hutterer
aad65415bf dix: don't allow disabling XTest devices
Disabling a XTest device followed by an XTest API call crashes the server.
This could be fixed elsewhere but disabled devices must not send events
anyway. The use-case for disabled XTest devices is somewhat limited, so
simply disallow disabling the devices.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2012-11-06 10:48:32 +10:00
Yaakov Selkowitz
e8d45f3018 dix: fix shadow warnings
dispatch.c: In function 'ProcCopyArea':
dispatch.c:1608:5: warning: declaration of 'rc' shadows a previous local
dispatch.c:1604:9: warning: shadowed declaration is here
dispatch.c: In function 'ProcCopyPlane':
dispatch.c:1647:5: warning: declaration of 'rc' shadows a previous local
dispatch.c:1643:9: warning: shadowed declaration is here
events.c: In function 'GetClientsForDelivery':
events.c:2030:68: warning: declaration of 'clients' shadows a global declaration
../include/dix.h:124:28: warning: shadowed declaration is here
events.c: In function 'DeliverEventToWindowMask':
events.c:2113:19: warning: declaration of 'clients' shadows a global declaration
../include/dix.h:124:28: warning: shadowed declaration is here
events.c: In function 'EventSuppressForWindow':
events.c:4420:12: warning: declaration of 'free' shadows a global declaration

Signed-off-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-11-05 13:25:00 -06:00
Yaakov Selkowitz
1aa783754e dix: fix redundant redeclaration warnings in dixfont
These functions are already declared in <X11/fonts/fontproto.h>.
Redeclaring them just for _X_EXPORT causes tons of warnings throughout
xserver, but they need to be declared somewhere to be picked up by
sdksyms.sh.  Doing so in a private header limits the warnings to
sdksyms.c; fixing those as well would require changes to fontsproto.

Signed-off-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-11-05 13:24:59 -06:00
Carlos Garnacho
ced56f322e Sync TouchListener memory allocation with population in TouchSetupListeners()
The allocated TouchListener array may fall short by 1 if hitting the worst case
situation where there's an active grab, passive grabs on each window in the
sprite trace and event selection for touch in one of the windows. This may lead
to memory corruptions as the array is overflown.

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-10-30 15:11:09 +10:00
Peter Hutterer
e7cd5cce74 dix: fix zaphod screen scrossing (#54654)
POINTER_SCREEN coordinates are screen-relative. For a Zaphod setup, the
coordinates after a screen crossing are already relative to the new screen's
origin. Add that offset to the coordinates before re-setting.

regression introduced by
commit bafbd99080
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed Aug 8 11:34:32 2012 +1000

    dix: work around scaling issues during WarpPointer (#53037)

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2012-10-29 13:15:50 +10:00
Lionel Elie Mamane
c0a752d286 dix: fix Ungrab action #55785
UngrabAllDevices(Bool kill_client):
If we are not going to kill the client (kill_clients false),
we need to deactivate grabs of active clients, too.
(If we are going to kill the client,
 no need to deactivate the grab,
 as this will be done as part of the client kill.)

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

Signed-off-by: Lionel Elie Mamane <lionel@mamane.lu>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-10-19 13:12:33 +10:00
Chase Douglas
3b67cd2614 End physically active touches when device is disabled
Otherwise:

* We can't end the touches while device is disabled
* New touches after enabling the device may erroneously be mapped to old
  logical touches

Signed-off-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>
2012-10-19 13:12:33 +10:00
Peter Hutterer
4b7f00346d dix: fix crash on shutdown if a disabled device is still grabbed (XI1 grab)
A disabled device doesn't have a sprite (less so a sprite->win) and triggers
a NULL-pointer dereference on shutdown when all active grabs are released as
part of the cleanup.

Fix this by checking for sprite being non-null and setting the focus window
to the NullWindow if it is. The rest of the patch just attempts to make
things more readable.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2012-10-10 14:40:45 +10:00
Keith Packard
8367dd9736 Merge remote-tracking branch 'whot/for-keith' 2012-10-04 13:08:35 -07:00
Peter Hutterer
9d6b836570 dix: fix crash on XI 1.x grabs on disabled devices. (#54934)
If the device is disabled, the sprite window is NULL and dereferencing
crashes the server.

This is only triggered for XI 1.x grabs (ProcXGrabDevice) as XI2 grabs would
trigger another code path, creating a sprite for the disabled device as if
detaching it (which is wrong and fixed with this patch too).

Grabbing a disabled device doesn't make sense as it won't send events
anyway. However, the protocol specs do not prohibit it, so we need to keep
it working.
Luckily, oldWin is only used for focus out events, which aren't necessary
given that the device is disabled.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@ubuntu.com>
2012-10-04 13:24:43 +10:00
Keith Packard
4dd5989d15 Merge remote-tracking branch 'ajax/server-1.14-abi-churn' 2012-09-24 11:43:01 -07:00
Yufeng Shen
0b02150c27 dix: fix scale_to_desktop for edge ABS events
Scale_to_desktop() converts ABS events from device coordinates
to screen coordinates:
[dev_X_min, dev_X_max]  -> [screen_X_min, screen_X_max]
[dev_Y_min, dev_Y_max]  -> [screen_Y_min, screen_Y_max]

An edge ABS event with X = dev_X_max (e.g., generated from the
edge of a touchscreen) will be converted to have screen X value
= screen_X_max, which, however, will be filterd out when xserver
tries to find proper Window to receive the event, because the
range check for a Window to receive events is
       window_X_min <= event_screen_X < window_X_max
Events with event_screen_X = screen_X_max will fail the test get
and rejected by the Window.

To fix this, we change the device to screen coordinates mapping to
[dev_X_min, dev_X_max]  -> [screen_X_min, screen_X_max-1]
[dev_Y_min, dev_Y_max]  -> [screen_Y_min, screen_Y_max-1]

Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Signed-off-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-09-24 11:12:04 -07:00
Adam Jackson
ad0156c369 dix: Remove MapUnmapEventsEnabled and friends
This hack was added to suppress events generated by Composite's internal
unmap/map cycle on redirection state change.  Since that cycle was
removed in 193ecc8b4, these can go.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Ville Syrjälä <syrjala@sci.fi>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-09-23 10:41:54 -07:00
Adam Jackson
387b1ac33c dix: Factor out DeliverUnmapNotify
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-09-23 10:41:41 -07:00
Adam Jackson
d20cc0fca4 dix: Factor out DeliverMapNotify
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-09-23 10:41:26 -07:00
Adam Jackson
63843cb700 dix: Factor out MaybeDeliverMapRequest
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-09-23 10:40:38 -07:00
Adam Jackson
dab7a1ec7f dix: Fix some indentation
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-09-23 10:40:08 -07:00
Peter Hutterer
3d1051aecb dix: set the device transformation matrix
The property handler is registered after setting the property, so
dev->transform remains as all-zeros. That causes pixman_f_transform_invert()
to fail (in transformAbsolute()) and invert remains as garbage. This
may then cause a cursor jump to 0,0.

Since the axes are not yet initialized here and we need to allow for drivers
changing the matrix, we cannot use the property handler for matrix
initialization, essentially duplicating the code.

Triggered by the fix to (#49347) in 749a593e49

https://bugzilla.redhat.com/show_bug.cgi?id=852841

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@ubuntu.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-09-23 10:38:42 -07:00
Adam Jackson
e2c7d70e5d dix: Extend initial connection handshake for forwarding proxies
Forwarding proxies like sshd will appear to be local, even though they
aren't really.  This leads to weird behaviour for extensions that truly
require running under the same OS services as the client, like MIT-SHM
and DRI2.

Add two new legal values for the initial connection's byteOrder field,
'r' and 'R'.  These act like 'l' and 'B' respectively, but have the side
effect of forcing the client to be treated as non-local.  Forwarding
proxies should attempt to munge the first packet of the connection
accordingly; older servers will reject connections thusly munged, so the
proxy should fall back to passthrough if the munged connection attempt
fails.

Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2012-09-20 14:40:18 -04:00
Dave Airlie
49ec57d509 dix: free default colormap before screen deletion
If we don't free this here, it gets freed later in the resource
cleanups, however it then looks up up pmap->pScreen, which we
freed already in this function. So free the default colormap
when we should.

This fixes a bug after a couple of hotplug cycles when you try
to exit the X server and it crashes.

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-09-04 16:15:52 +10:00
Keith Packard
a557edca61 Merge remote-tracking branch 'whot/for-keith' 2012-08-27 08:06:09 -07:00
Peter Hutterer
bafbd99080 dix: work around scaling issues during WarpPointer (#53037)
In WarpPointer calls, we get input in screen coordinates. They must be
scaled to device coordinates, and then back to screen coordinates for screen
crossing and root coordinates in events.

The rounding errors introduced (and clipping in core/XI 1.x events) can lead
to the actual position being different to the requested input coordinates.
e.g. 200 scales to 199.9999, truncated to 199 in the event.

Avoid this by simply overwriting the scaled screen coordinates with the
input coordinates for the POINTER_SCREEN case.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2012-08-21 07:54:07 +10:00
Keith Packard
288b87e42c Close GPU screens before core screens
This should make cleaning up the GPU screens easier as the core
screens they are associated with will still be around.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2012-08-14 17:13:52 -07:00
Keith Packard
02f94b2d44 Merge remote-tracking branch 'whot/for-keith' 2012-08-06 16:52:12 -07:00
Keith Packard
360fa7736b Merge remote-tracking branch 'airlied/for-keithp' 2012-08-06 16:42:34 -07:00
Peter Hutterer
cb306a8f17 dix: make sure the mask is set for emulated scroll events (#52508)
If a device has smooth scrolling axes, but submits scroll button events, we
convert those to motion events and update the valuators. For legacy button
events, the valuator mask is likely unset though, causing
add_to_scroll_valuator() to return early, leaving us with an empty mask.
That again skipped the rest of the code and no events were generated.

Fix it by making sure that the scroll valuator in the mask is at least
initialized to 0.

Broke evdev wheel emulation, introduced by
54476b5e44.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-07 09:39:56 +10:00
Dave Airlie
1a465fef9b pixmap: have slave pixmap take a reference on master pixmap
Since the free routines free the master pixmap then the slave, we should
be taking a reference when we bind them together.

Fixes a use-after-free when resizing a primed gears.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2012-08-07 08:25:06 +10:00
Alan Coopersmith
c37c65052f Make indentation of dix/tables.c much more consistent and readable
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Acked-by: Daniel Stone <daniel@fooishbar.org>
2012-08-06 15:22:53 -07:00
Alan Coopersmith
9f7ef7f7f0 Fix up formatting of initializers for arrays of structs
The indenter seems to have gotten confused by initializing arrays of
structs with the struct defined inline - for predefined structs it did
a better job, so match that.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-08-06 15:22:53 -07:00
Daniel Stone
59c2c4f645 AllocDevicePair: Ensure XKB privates are initialised
Since we call directly into XKB and may be doing so before the extension
has been initialised, make sure its privates are set up first.  XTest
had a hack to do this itself, but seems cleaner to just make sure we do
it in AllocDevicePair.

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-10 23:12:39 -07:00
Keith Packard
34cf559bcf ProcGetPointerMapping uses rep.nElts before it is initialized
In:

	commit d792ac125a
	Author: Alan Coopersmith <alan.coopersmith@oracle.com>
	Date:   Mon Jul 9 19:12:43 2012 -0700

	    Use C99 designated initializers in dix Replies

the initializer for the .length element of the xGetPointerMappingReply
structure uses the value of rep.nElts, but that won't be set until
after this initializer runs, so we get garbage in the length element
and clients using it will generally wedge.

Easy to verify:

	$ xmodmap -pp

Fixed by creating a local nElts variable and using that.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-07-10 23:07:06 -07:00
Keith Packard
6e12cb147d Merge branch 'local-fixes' 2012-07-10 00:52:11 -07:00
Alan Coopersmith
ad4092cf7d Replace padlength tables with inline functions from misc.h
Adds new function padding_for_int32() and uses existing pad_to_int32()
depending on required results.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Daniel Stone <daniel@fooishbar.org>
2012-07-09 22:52:30 -07:00
Alan Coopersmith
1622dd8ab2 Use C99 designated initializers in dix registry
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 22:52:30 -07:00
Alan Coopersmith
0af79b124e Use C99 designated initializers in dix Events
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 22:52:30 -07:00
Alan Coopersmith
d792ac125a Use C99 designated initializers in dix 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:29 -07:00
Alan Coopersmith
69fa5630b5 Use C99 designated initializers in SendErrorToClient
Let the compiler worry about 0-filling the rest of the fields,
instead of memsetting the whole struct and then going back to
overwrite some of the fields.

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:29 -07:00
Alan Coopersmith
5b86c072d1 Use temporary variables instead of parts of reply structures
When passing variable pointers to functions or otherwise doing long
sequences to compute values for replies, create & use some new
temporary variables, to allow for simpler initialization of reply
structures in the following patches.

Move memsets & other initializations to group with the rest of the
filling in of the reply structure, now that they're not needed so
early in the code path.

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:14:50 -07:00
Alan Coopersmith
c2fb1a7b2a ProcQueryKeymap: rework logic around permission to copy key states
Always initialize to zero, and then if permission is granted, copy
the current key state maps, instead of always copying and then
zeroing out if permission was denied.

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:14:50 -07:00
Alan Coopersmith
dccb0858d7 Core events: invert check for permission to copy key states
Always initialize to zero, and then if permission is granted, copy
the current key state maps.   Use memcpy instead of memmove for the
copy, since we're always copying to a newly allocated event on the
stack, so guaranteed not to overlap with the device map structure.

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:14:50 -07:00
Alan Coopersmith
db69212df8 Rework reply initialization in ProcGetProperty & NullPropertyReply
Don't need to pass an empty reply to NullPropertyReply, let it make
it's own.   Move reply initialization code in remaining replies in
ProcGetProperty to group with the rest of the fields.   (Prepares
for coming C99 designated initializer conversion.)

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:14:50 -07:00
Alan Coopersmith
6be74a9080 Fix more poorly indented/wrapped comments & code
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:14:50 -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
Keith Packard
ea8b04507e privates: Resize GPU screen-specific privates too
When allocating new global privates, make sure the gpu
screens get their private offsets updated.

This only affects GPU screens that enumerate before the non-GPU
screens, which generally requires that the related device be present
when the system boots so that it can get an earlier DRM filename.

Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-09 16:30:24 -07:00
Dave Airlie
12905dfaf0 dix/xf86: initial offload slave tracking (v1.1)
add the linked list and provider hooks.

v1.1: add another assert in the add path.

Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-07 10:37:45 +01:00
Dave Airlie
9b8217f9ef dix/pixmap: track dirty pixmaps in server. (v4)
This adds two functions for drivers to use directly to keep a
linked list of slave pixmaps to do damage tracking on and keep
updated. It also adds a helper function that drivers may optionally
call to do a simple copy area damage update.

v2: use damage.h not damagestr.h, fixes ephyr build.

v3: address ajax review: use slave_dst, drop unused dst member.

v4: check DamageCreate return, add SourceValidate comment,
add a comment addressing possible optimisation possibility

Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-07 10:37:11 +01:00
Dave Airlie
f2da2c1204 randr: add initial scanout pixmap support (v3)
When randr notices a crtc configuration request for a slave device,
it checks if the slave allocated pixmap exists and is suitable,
if not it allocates a new shared pixmap from the master, shares
it to the slave, and starts the master tracking damage to it,
to keep it updated from the current front pixmap.

If the resize means the crtc is no longer used it will destroy
the slave pixmap.

This adds the concept of a scanout_pixmap to the randr_crtc object,
and also adds a master pixmap pointer to the pixmap object, along
with defining some pixmap helper functions for getting pixmap box/regions.

v2: split out pixmap sharing to a separate function.

v3: update for void *

Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-07 10:37:10 +01:00
Dave Airlie
382dd45bb8 dix: add ability to link output slave gpus to the current gpu (v1.1)
Just add the interfaces to attach/detach output slaves, and
a linked list to keep track of them. Hook up the randr providers
list to include these slaves.

v1.1: add another assert to the add path.

Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-07 10:37:10 +01:00
Dave Airlie
4caad34c93 dix: add unattached list for attaching screens to initially. (v1.1)
This list is meant for attaching unbound gpu screens to initially,
before the client side rebinds them.

v1.1: add another assert in the add path.

Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-06 22:16:13 +01:00
Dave Airlie
9d17981829 dix: introduce gpu screens. (v5)
This patch introduces gpu screens into screenInfo. It adds interfaces
for adding and removing gpu screens, along with adding private fixup,
block handler support, and scratch pixmap init.

GPU screens have a myNum that is offset by GPU_SCREEN_OFFSET (256),
this is used for logging etc.

RemoveGPUScreen isn't used until "xfree86: add platform bus hotplug support".

v2: no glyph pictures for GPU screens for now.
v3: introduce MAXGPUSCREENS, fix return value check
v4: fixup myNum when renumbering screens (ajax)
v5: drop cursor privates for now.

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-06 10:35:13 +01:00
Dave Airlie
3478af3374 screen: split out screen init code. (v2)
This is a precursor for reusing this code to init gpu screens.

v2: fixup int check as per Keith's review.

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-06 10:20:19 +01:00
Keith Packard
9e4b8b74b0 privates: Allow device privates to be allocated after server start
This will permit midispcur to allocate its privates for hotplug outputs

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2012-07-05 13:40:27 -07:00
Keith Packard
493ad83323 dix: Allocate device privates separate from devices
This will allow device privates to be resized.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2012-07-05 13:40:25 -07:00
Keith Packard
9d457f9c55 Add screen-specific privates.
Screen-specific privates areas are only allocated for objects related
to the target screen; objects allocated for other screens will not
have the private space reserved. This saves memory in these objects
while also allowing hot-plug screens to have additional private
allocation space beyond what the core screens are using.

Drivers are encouraged to switch to this mechanism as it will reduce
memory usage in multi-GPU environments, but it is only required for
drivers which will be loaded after the server starts, like
modesetting.

Objects providing screen-specific privates *must* be managed by the
screen-specific private API when allocating or initializing privates
so that the per-screen area can be initialized properly.

The objects which support screen-specific privates are:

	Windows
	Pixmaps
	GCs
	Pictures

Extending this list to include Colormaps would be possible, but
require slightly more work as the default colormap is created before
all colormap privates are allocated during server startup, and hence
gets a bunch of special treatment.

Of particular note, glyphs are *not* capable of supporting
screen-specific privates as they are global objects, not allocated on
a screen-specific basis, and so each driver must be able to see their
privates within the glyph.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2012-07-05 13:39:50 -07:00
Peter Hutterer
a9c09f8f8e dix: fix memory leak in TouchEventHistoryReplay
Don't leak if ti->history is NULL.

Found by coverity.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2012-07-04 21:16:16 +10:00
Peter Hutterer
55ff20eb37 dix: fix dereference before null check
Found by Coverity.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2012-07-04 21:16:16 +10:00
Keith Packard
24525d96a3 Merge branch 'sigsafe-logging-varargs'
This merge includes a minor fixup for '%p' arguments; must cast to
uintptr_t instead of uint64_t as we use -Werror=pointer-to-int-cast
which complains when doing a cast (even explicitly) from a pointer
to an integer of different size.
2012-07-02 22:35:39 -07:00
Chase Douglas
7f4a69b628 Log messages in TouchBeginDDXTouch() in a signal-safe manner
Signed-off-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>
2012-07-02 22:34:32 -07:00
Chase Douglas
f752226e40 Log messages in GetTouchEvents() in a signal safe manner
Signed-off-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>
2012-07-02 22:34:32 -07:00
Alan Coopersmith
a00066d291 Add dixGetGlyphs to replace GetGlyphs from libXfont to simplify linking
No other Xfont consumer used it, and this saves us from having to link
callers against libXfont for one simple function when doing
-no-undefined symbols builds.

The function is given a new name to avoid clashing with existing libXfont
binaries, but a #define is provided to preserve the API so we don't have
to fix all the callers at the same time.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
2012-07-02 10:09:08 -07:00
Dave Airlie
957bf959fb dix/render: consolidate window format matching code.
This code existed in 3 different forms, perhaps it should be
consolidated.

Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-06-28 10:43:35 -07:00
Keith Packard
59294a2179 Merge remote-tracking branch 'whot/for-keith' 2012-06-28 10:11:44 -07:00
Alan Coopersmith
687536b104 Fix some overly indented/poorly line wrapped comments in dix/events.c
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2012-06-20 21:41:42 -07:00
Alan Coopersmith
93a378aad4 OtherClientGone: Remove unreachable return statement
Now that FatalError is marked as _X_NORETURN, the compilers know we
can't get here, and the return statement added to make them happy in
the past now makes them unhappy.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2012-06-20 21:41:37 -07:00
Peter Hutterer
54476b5e44 dix: if the scroll valuator reaches INT_MAX, reset to 0
Too much scrolling down may eventually trigger an overflow of the valuator.
If this happens, reset the valuator to 0 and skip this event for button
emulation. Clients will have to figure out a way to deal with this, but a
scroll event from (close to) INT_MAX to 0 is a hint of that it needs to be
ignored.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-06-20 10:36:11 +10:00
Keith Packard
6d86b64dba Merge remote-tracking branch 'whot/for-keith' 2012-06-14 11:05:22 -07:00
Peter Hutterer
4c68f5d395 dix: disable all devices before shutdown
f3410b97cf introduced a regression on server
shutdown. If any button or key was held on shutdown (ctrl, alt, backspace
are usually still down) sending a raw event will segfault the server. The
the root windows are set to NULL before calling CloseDownDevices().

Avoid this by disabling all devices first when shutting down. Disabled
devices won't send events anymore.

Master keyboards must be disabled first, otherwise disabling the pointer
will trigger DisableDevice(keyboard) and the keyboard is removed from the
inputInfo.devices list and moved to inputInfo.off_devices. A regular loop
through inputInfo.devices would thus jump to off_devices and not recover.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-06-07 14:13:51 +10:00
Peter Hutterer
e433d1046c dix: disable non-sprite-owners first when disabling paired devices
If a sprite-owner is to be disabled but still paired, disable the paired
device first. i.e. disabling a master pointer will disable the master
keyboard first.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-06-07 14:13:47 +10:00
Peter Hutterer
df1704365e dix: free the sprite when disabling the device
Disabled devices don't need sprites (they can't send events anyway) and the
device init process is currently geared to check for whether sprite is
present to check if the device should be paired/attached.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-06-07 14:13:45 +10:00
Peter Hutterer
e57d6a8902 dix: move freeing the sprite into a function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-06-07 14:13:44 +10:00
Peter Hutterer
46adcefb0e dix: return early from DisableDevice if the device is already disabled
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-06-07 14:13:43 +10:00
Peter Hutterer
076f9d3a66 dix: drop client argument from PairDevices - unused
This is a leftover from early MPX days where any keyboard could be paired
with any pointer (before the device hierarchy).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-06-07 14:13:41 +10:00
Peter Hutterer
d034605f39 dix: rename shadowing loop variable in TouchResizeQueue
second 'i' shadows the function-wide one, rename to 'j'

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-06-07 13:31:41 +10:00
Peter Hutterer
a86f3ef511 dix: change "still paired warning" to use BUG_RETURN_VAL
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-06-07 13:31:06 +10:00
Peter Hutterer
4bcf43919a dix: use BUG_RETURN_VAL for pairing errors
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-06-07 13:30:58 +10:00
Peter Hutterer
642569fc79 Replace a few BUG_WARN with BUG_RETURN_VAL
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-06-07 13:30:54 +10:00
Dave Airlie
1f0e8bd5eb api: rework the X server driver API to avoid global arrays.
This is a squash merge containing all the API changes, as
well as the video ABI bump.

Its been squashed to make bisection easier.

Full patch log below:

commit b202738bbf0c5a1c1172767119c2c71f1e7f8070
Author: Aaron Plattner <aplattner@nvidia.com>
Date:   Mon May 14 15:16:11 2012 -0700

    xfree86: Bump video ABI to 13.0

    The ABI was broken by changes to convert from screen index numbers to ScreenPtr
    / ScrnInfoPtr in various structures and function signatures.

    Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Dave Airlie <airlied@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 3d5f7d9f8d408bcad3f83277d255f25d3b0edbf3
Author: Dave Airlie <airlied@redhat.com>
Date:   Thu May 24 10:56:57 2012 +0100

    xf86: xf86ClearEntityListForScreen should take a pScrn

    When adding GPU screens this make life easier.

    (also fix comment, as pointed out by Alan)

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit afee8b5ab4501597ecc1ade34124d7ca227ab055
Author: Dave Airlie <airlied@redhat.com>
Date:   Thu May 24 07:07:32 2012 +0100

    xf86i2c: add pscrn for drivers to use

    This just adds a pScrn pointer into the struct for the drivers to use
    instead of scrnIndex. Mostly scrnIndex is used for logging, but some
    drivers use it to lookup xf86Screens, so let them stash a pScrn instead.

    Removing the scrnIndex is a bit more involved and I'm not sure its worth
    the effort. Doing i2c in the X server is legacy code as far as I'm concerned.

    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit ea5092f1f679691d187f1eee9427e6057beec56e
Author: Dave Airlie <airlied@redhat.com>
Date:   Wed May 23 19:25:20 2012 +0100

    dix/gc: consolidate GC object creation in one place

    The standard GC create and scratch GC create were 90% the same really,
    and I have a need in the future for creating GC objects without the
    other bits, so wanted to avoid a third copy.

    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 3d91482ea9b4883e64e496f2768168e0ffa21ba1
Author: Dave Airlie <airlied@redhat.com>
Date:   Wed May 23 10:24:06 2012 +0100

    xf86: add a define to denote the new non-index interfaces are being used

    This can be used by drivers to provide compatible APIs.

    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 37c3ae3e6cd4f3dedc72f371096d6743f8f99df3
Author: Dave Airlie <airlied@redhat.com>
Date:   Wed May 23 15:09:12 2012 +0100

    dix: make Create/Free scratch pixmaps take a ScreenPtr

    While technically an API/ABI change I doubt anyone uses it,
    but it helps in splitting screens up.

    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 75f2062a3fe94f04764ecc7d2ff2fbbeccb9da60
Author: Dave Airlie <airlied@redhat.com>
Date:   Wed May 23 14:57:55 2012 +0100

    xf86/xv: remove scrnIndexfrom xf86FindXvOptions.

    Move this interface to taking an ScrnInfoPtr.

    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit f80c2374f40ea7b2ee0556e2e76cc07406f3d843
Author: Dave Airlie <airlied@redhat.com>
Date:   Wed May 23 14:53:59 2012 +0100

    xf86: make xf86DeleteScreen take a ScrnInfoPtr (v2)

    stop passing indices into this function.

    v2: drop flags argument.

    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 58824e414f35682435f15bfe6c4b656bd90b9235
Author: Dave Airlie <airlied@redhat.com>
Date:   Wed May 23 14:48:09 2012 +0100

    xf86: fix xf86IsScreenPrimary interface to take a pScrn (API/ABI)

    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 6b4fc1f9d391bcdf7ca288766e49bce60f4635cd
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 14:18:59 2012 +0100

    xserver: convert block/wakeup handlers to passing ScreenPtr (ABI/API) (v2)

    Instead of passing an index, pass the actual ScreenPtr. This allows
    more moving towards not abusing xf86Screens + screenInfo.

    v2: drop the blockData/wakeupData args as per ajax's suggestion.,
    fix docs.

    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 790d003de20fb47674420a24dadd92412d78620d
Author: Dave Airlie <airlied@gmail.com>
Date:   Wed Apr 11 09:53:14 2012 +0100

    xf86/common: remove some more pScrn->pScreen uses

    remove some more conversions that appeared after api cleanups.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit aac85e18d1dd093f2cad6bd29375e40bd7af0b8f
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 16:34:53 2012 +0100

    ddc: change API to take ScrnInfoPtr (v2)

    This removes all xf86Screens usage from ddc code,
    it modifies the API for some functions to avoid taking indices.

    v2: address Alan's comments about dropping DDC2Init parameter.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit fe3f57b6eaf6860a33876a54f9439f69578f03a5
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 16:31:26 2012 +0100

    vbe: don't use index for VBEInterpretPanelID (API)

    Remove use of xf86screens from vbe module.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit abf1965f4ed91529036d3fdb470d6a3ce6f29675
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 16:25:11 2012 +0100

    int10/vbe: don't use xf86Screens. (ABI) (v3)

    Pass the ScrnInfoPtr instead of the index in the int10 struct.

    This saves us using it to dereference xf86Screens.

    v2: address Alan's comment to fix struct alignment.

    v3: squash in all the int10 fixes, test the vm86 code builds,
    after comments by Keith.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 23cca612b4fb5efc33683c7624b803b457387e3d
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 15:30:18 2012 +0100

    xserver: drop index argument to ScreenInit (ABI/API) (v2)

    This drops the index argument, its the same as pScreen->myNum,
    and its the last major index abuse I can find.

    v2: address Alan's review - update docs, fix xwin/xnest/darwin

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 40d360e2d7e832407f3ed64e3a02c27ecc89a960
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 15:23:01 2012 +0100

    xf86: migrate PointerMoved from index to ScrnInfoPtr (ABI/API)

    This migrates PointerMoved from an index to ScrnInfoPtr.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit aa60a2f38679d0eeb979a9c2648c9bc771409bf9
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 15:20:46 2012 +0100

    xf86: migrate PMEvent to a ScrnInfoPtr (ABI/API)

    This migrates the PMEvent from index to ScrnInfoPtr.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit d3f28ef44371ed4a039ffc5dd7eb6408d1269ba2
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 15:18:30 2012 +0100

    xf86: migrate SetDGAMode from index to ScrnInfoPtr (ABI/API)

    This migrates the SetDGAMode callback from an index to ScrnInfoPtr.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit baf5e4818a74f2b68c3dfdcc56f54322351039a0
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 15:14:11 2012 +0100

    xf86: migrate ChangeGamma from index to ScrnInfoPtr (ABI/API) (v2)

    This migrates the ChangeGamma interface to avoid passing a index.

    v2: fix xf86RandR12.c + xf86cmap.c call

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 51e5f90ada929d6b23176090badbb42fdb3fa550
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 15:11:09 2012 +0100

    xf86/exa: migrate index to screen types for EnableDisableFBAccess (ABI/API)

    The EXA interface migrates to ScreenPtr,
    and the xf86 interface migrated to ScrnInfoPtr.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 94f1f21d17e86f96d4a54292a399160950087675
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 15:02:11 2012 +0100

    xf86: migrate ValidMode callback to ScrnInfoPtr (ABI/API)

    This migrates the ValidMode to passing a ScrnInfoPtr instead
    of an index.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 3f8f18198fed4f39ec805b508a3482e91eea26b2
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 14:59:46 2012 +0100

    xf86: migrate SwitchMode to taking ScrnInfoPtr (ABI/API) (v2)

    This migrate the SwitchMode interface to take a ScrnInfoPtr
    instead of an index.

    v2: drop flags.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit d06a038a5c49328ab3a8d969d24f9fcd22c63202
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 14:50:37 2012 +0100

    xf86: move AdjustFrame to passing ScrnInfoPtr (ABI/API) (v2)

    This converts AdjustFrame code paths to passing a ScrnInfoPtr
    instead of an integer index.

    v2: drop flags args.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 53d2f8608ffd4090d08e7d5cf2e92fb954959b90
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 14:41:27 2012 +0100

    xf86: modify FreeScreen callback to take pScrn instead of index. (ABI/API) (v2)

    Another index->pScrn conversion.

    v2: drop flags arg.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 60db37c0b247052e0f5c54b1921fe58a3609c2e3
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 14:35:41 2012 +0100

    xf86: change EnterVT/LeaveVT to take a ScrnInfoPtr (ABI/API break) (v2)

    This modifies the EnterVT/LeaveVT interfaces to take a ScrnInfoPtr
    instead of an index into xf86Screens. This allows dropping more
    public dereferences of the xf86Screens and screenInfo.

    v2: drop flags args as suggested by Keith, fix docs.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 06729dbbc804a20242e6499f446acb5d94023c3c
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 14:04:59 2012 +0100

    xserver: remove index from CloseScreen (API/ABI breakage)

    This drops the index from the CloseScreen callback,
    its always been useless really, since the pScreen contains it.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-06-05 13:22:18 +01:00
Michal Suchanek
88c767edb0 Fix crash for motion events from devices without valuators
A WarpPointer request may trigger a motion event on a device without
valuators. That request is ignored by GetPointerEvents but during smooth
scroll emulation we dereference dev->valuators to get the number of axes.

Break out early if the device doesn't have valuators.

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-06-04 11:28:44 +10: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
Peter Hutterer
749a593e49 dix: undo transformation for missing valuators (#49347)
last.valuators contains the transformed valuators of the device. If the
device submits events with x/y missing, we need to get that from
last.valuators and undo the transformation to that axis.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-05-16 10:59:39 +10:00
Simon Thum
693a31e704 dix: indentation fixes for pointer acceleration
Signed-off-by: Simon Thum <simon.thum@gmx.de>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-05-16 10:59:35 +10:00
Michal Suchanek
31174565ec dix: Remove redundant declarations.
Signed-off-by: Michal Suchanek <hramrach@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-14 13:31:00 +01:00
Michal Suchanek
369edd7876 dix: don't duplicate DoFocusEvents declaration.
Signed-off-by: Michal Suchanek <hramrach@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-14 13:17:21 +01:00
Michal Suchanek
36377fb0e8 dix: Remove redundant declarations.
Signed-off-by: Michal Suchanek <hramrach@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-14 13:17:17 +01:00
Peter Hutterer
f3410b97cf dix: when disabling a device, release all buttons and keys
A suspend-induced device disable may happen before the device gets to see
the button release event. On resume, the server's internal state still has
some buttons pressed, causing inconsistent behaviour.

Force the release and the matching events to be sent to the client.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-05-01 11:36:36 +10:00
Peter Hutterer
af88b43f9e dix: don't emulate scroll events for non-existing axes (#47281)
Test case:
- create a device with REL_HWHEEL and ABS_X and ABS_Y. evdev 2.7.0 will set
  that up as device with 1 relative axis
- move pointer to VGA1
- xrandr --output VGA1 --off

Warps the pointer to the new spot and calls GPE with the x/y mask bits set.
When running through the loop to check for scroll event, this overruns the
axes and may try to emulate scroll events based on random garbage in the
memory. If that memory contained non-zero for the scroll type but near-zero
for the increment field, the server would hang in an infinite loop.

This was the trigger for this suggested, never-merged, patch here:
http://patchwork.freedesktop.org/patch/9543/

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-05-01 11:36:35 +10:00
Chase Douglas
5c361d59c5 TouchListenerAcceptReject: Warn and return early on bad listener index
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Bryce Harrington <bryce@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-05-01 11:36:35 +10:00
Chase Douglas
88bacc49f0 os: Add -displayfd option
This option specifies a file descriptor in the launching process.  X
will scan for an available display number and write that number back to
the launching process, at the same time as SIGUSR1 generation.  This
means display managers don't need to guess at available display numbers.
As a consequence, if X fails to start when using -displayfd, it's not
because the display was in use, so there's no point in retrying the X
launch on a higher display number.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Tested-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-05-01 11:36:30 +10:00
Keith Packard
e6308e32fe Merge remote-tracking branch 'whot/for-keith'
Touch input changes from Chase
2012-04-19 10:45:07 -05:00
Peter Hutterer
51a8d8dd19 Merge branch 'input-fixes' of git://people.freedesktop.org/~cndougla/xserver into for-keith 2012-04-19 17:03:54 +10:00
Chase Douglas
00cf1c40b2 Replay original touch begin event instead of generated begin event
The generated event does not have axes other than X and Y and has a
newer timestamp. In particular, the newer timestamp may be newer than
the real touch end event, which may be stuck in the syncEvents queue. If
a client uses the timestamps for grabbing bad things may happen.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-18 20:36:02 -07:00
Chase Douglas
312910b4e3 Update currentTime in dispatch loop
A request, like input device grabs, may check a request timestamp
against currentTime. It is possible for currentTime to lag a previously
sent event timestamp. If the client makes a request based on such an
event timestamp, the request may fail the validity check against
currentTime unless we always update the time before processing the
request.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-18 20:35:36 -07:00
Chase Douglas
a986f2f30c Update device state including when touch record does not exist
If a touch is physically active, the pointer core state should reflect
that the first button is pressed. Currently, this only occurs when there
are active listeners of the touch sequence. By moving the device state
updating to the beginning of touch processing we ensure it is updated
according to the processed physical state no matter what.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-18 18:29:56 -07:00
Chase Douglas
ec9c429583 Check other clients' core masks properly when adding touch listener
The current code checks the core event mask as though it were an XI
mask. This change fixes the checks so the proper client and event masks
are used.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-18 18:29:56 -07:00
Chase Douglas
d0449851d1 Create a new dix touch record for an emulated touch with no listeners
As a special case, if a still physically active pointer emulated touch
has no listeners and the device is explicitly grabbed for pointer
events, create a new dix touch record for the grab only.

This allows for clients to "hand off" grabs. For example, when dragging
a window under compiz the window decorator sees the button press and
then ungrabs the implicit grab. It then tells compiz to grab the device,
and compiz then moves the window with the pointer motion. This is racy,
but is allowed by the input protocol for pointer events when there are
no other clients with a grab on the device.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-18 13:58:40 -07:00
Chase Douglas
3d06bfe93d Rename TouchEnsureSprite to TouchBuildSprite and event type checks
The function will be used for building a sprite for pointer emulation
after an explicit device grab. This commit refactors the code so that
TouchBuildSprite will function with any event type and moves the checks
to the caller.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-18 13:58:40 -07:00
Chase Douglas
2efbed23c2 When activating an explicit grab, update owning listener
Pointer passive grabs may be changed by the grabbing client. This allows
for a selecting client to change an implicit grab to an active grab,
which is the mechanism used for pop-up windows like application menus.

We need to do the same thing with touches. If the grabbing client is the
owner of a touch sequence, change the listener record to reflect the new
grab. If the grabbing client is not the owner, nothing changes for the
touch.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-18 13:58:40 -07:00
Chase Douglas
8dfd98245d Fix copy/paste error from before git history in UpdateCurrentTimeIf()
See UpdateCurrentTime() for reference. I don't know what bug this might
trigger, but it wouldn't hurt to fix this.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-18 13:58:40 -07:00
Chase Douglas
6ca30cb33e When deactivating an explicit pointer grab, reject all grabs on touches
Explicit pointer grabs are placed at the head of the touch listener
array for pointer emulated touches. If the grab is deactivated, we must
remove it from all touches for the device.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-18 13:58:39 -07:00
Chase Douglas
447fe7a1a7 Split out helper function TouchListenerAcceptReject()
This will be used for accepting and rejecting touches in the future.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-18 13:58:39 -07:00
Erkki Seppälä
233eab4d05 dix: add reference count of the resource to ResourceSizeRec
The ResourceSizeRec now contains the number of references to the
resource. For example a Pixmap knows this value and it can be useful
for determining the "weight" of the resource. Typically this value
is 1.

Reviewed-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
Signed-off-by: Erkki Seppälä <erkki.seppala@vincit.fi>
2012-04-18 12:49:11 +03:00
Erkki Seppälä
a2ac01a8ea dix: don't use a local wrapper for calling HashResourceID
Calls to Hash(client, id) were replaced with calls directly to
HashResourceID(id, clientTable[client].hashsize) and the Hash-function
was removed.

Signed-off-by: Erkki Seppälä <erkki.seppala@vincit.fi>
2012-04-18 12:44:49 +03:00
Erkki Seppälä
a0b0fb83f9 dix: add hashing functions to resource.h for others to use.
The public hashing function HashResourceID uses the same hashing
hashing algorithm as resource.c uses internally, but it provides an
interface that will is usable by external modules. It provides a
parameter for the number of bits for the hash, instead of finding the
size from its internal hash table.

Signed-off-by: Erkki Seppälä <erkki.seppala@vincit.fi>
2012-04-18 12:43:54 +03:00
Erkki Seppälä
3ba0decb4b dix: add a mechanism for iterating through all subresources
The mechanism allows iterating even through subresources that don't
have specific XID's. When such 'resources' are iterated, the XID for
them will be zero. A resource type can assign an iteration function
for its subresources with SetResourceTypeFindSubResFunc; by default
resources are assumed not to contain subresources.

The purpose of this extension is to enable accurate accounting of
the resources a resource consumes or uses.

This patch provides the subresource iteration functions for Windows
and GCs.

Reviewed-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
Signed-off-by: Erkki Seppälä <erkki.seppala@vincit.fi>
2012-04-18 12:36:25 +03:00
Rami Ylimäki
e83388cc70 render: Report pixmap usage of pictures to resource extension.
Signed-off-by: Erkki Seppälä <erkki.seppala@vincit.fi>
Signed-off-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Tiago Vignatti <tiago.vignatti@nokia.com>
2012-04-18 12:31:24 +03:00
Peter Hutterer
ebf214876a dix: indentation fix
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-18 15:56:37 +10:00
Chase Douglas
12188c8a8a Use touch state when querying pointer through core protocol
QueryPointer is part of the core protocol. As such, it knows nothing
about touch devices. Touches are converted to button 1 press, pointer
motion, and button 1 release for core clients, so we should ensure the
pointer state mask has button 1 set when XQueryPointer is used.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-16 11:30:03 +10:00
Daniel Kurtz
c5a45b0f76 dix: don't BUG_WARN for button events from button-only device
Events from button-only devices still need coordinates, and they get them
from scale_to_desktop().  Therefore, a dev without valuators is not a bug.
However, a dev with valuators, but less than two of them still is a bug.

This was noticed when unplugging a "Creative Technology SB Arena Headset",
which has some BTNs and some KEYs, but no REL or ABS valuators.
It emits [BTN_3] = 0 on unplug, which would trigger the BUG_WARN.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-12 10:11:10 +10:00
Peter Hutterer
a7eac500e6 Merge branch 'per-device-sync-counters' into for-keith 2012-03-22 13:13:07 +10:00
Peter Hutterer
d645edd11e Xext: Add per-device SyncCounters
Previously, we only had one idle alarm that was triggered for all devices,
whenever the user used any device, came back from suspend, etc.

Add system SyncCounters for each device (named "DEVICEIDLETIME x", with x
being the device id) that trigger on that device only. This allows for
enabling/disabling devices based on interaction with other devices.

Popular use-case: disable the touchpad when the keyboard just above the
touchpad stops being idle.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: James Jones <jajones@nvidia.com>
2012-03-22 13:12:56 +10:00
Peter Hutterer
6aef209ebc Change lastDeviceIdleTime to be per-device
Preparation work for per-device idle counters.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: James Jones <jajones@nvidia.com>
2012-03-22 13:12:56 +10:00
Peter Hutterer
bf876c87a9 Merge branch 'dtrace-input-abi' into for-keith 2012-03-22 11:34:43 +10:00
Peter Hutterer
c0b0a9bce9 dix: add dtrace probes to input API
For driver debugging, it is helpful to know whether the driver has actually
submitted an event to the server. dtrace hooks can help here.

Note that GetPointerEvents and friends may also be triggered by the server
for other emulated devices, some care must be taken when analysing the
results.

Additional difficulty: proximity events have a run-time assigned type, so
this may make automatic detection a tad harder. If in doubt, go for any
event > 64 since the only two that can have that value are ProximityIn and
ProximityOut.

An example systemtap script is below:

  # Compile+run with
  #       stap -g xorg.stp /usr/bin/Xorg
  #

  function print_valuators:string(nvaluators:long, mask_in:long, valuators_in:long) %{
          int i;
          unsigned char *mask = (unsigned char*)THIS->mask_in;
          double *valuators = (double*)THIS->valuators_in;
          char str[128] = {0};
          char *s = str;

  #define BitIsSet(ptr, bit) (((unsigned char*)(ptr))[(bit)>>3] & (1 << ((bit) & 7)))

          s += sprintf(s, "nval: %d ::", (int)THIS->nvaluators);
          for (i = 0; i < THIS->nvaluators; i++)
          {
                  s += sprintf(s, "	%d: ", i);
                  if (BitIsSet(mask, i))
                      s += sprintf(s, "%d", (int)valuators[i]);
          }

          sprintf(THIS->__retvalue, "%s", str);
  %}

  probe process(@1).mark("input__event")
  {
      deviceid = $arg1
      type = $arg2
      detail = $arg3
      flags = $arg4
      nvaluators = $arg5

      str = print_valuators(nvaluators, $arg6, $arg7)
      printf("Event: device %d type %d detail %d flags %#x %s\n",
              deviceid, type, detail, flags, str);
  }

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-03-22 11:33:42 +10:00
Peter Hutterer
908ab3d580 dix: set raw event values before adding up relative values (#46976)
Regression introduced in 4e52cc0ef4

Raw event values are values as-is from the driver, modified only be
transformation or acceleration. 4e52cc caused the mask to be updated from
relative to absolute coordinates which then got written into the raw events.

Move the raw event update into the respective branches for absolute/relative
events.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Tested-by: Sven Arvidsson <sa@whiz.se>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
2012-03-22 11:33:21 +10:00
Peter Hutterer
9c3bd3ae65 dix: fix compiler warning "unused variable 'scr'"
getevents.c: In function 'updateSlaveDeviceCoords':
getevents.c:326:15: warning: unused variable 'scr' [-Wunused-variable]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-03-22 11:33:21 +10:00
Chase Douglas
31df08a449 Use a new sprite trace for indirect touches when all touches have physically ended
All touches of an indirect device, such as a trackpad, are sent to the
same window set. When there are no active touches, a new window set is
created; otherwise, the window set of an existing touch is copied.

The current code checks for any logically active touches. This includes
touches that have physically ended but are still logically active due to
unhandled touch grabs. Instead, we want a new window set whenever there
are no physically active touches.

This change skips over logically active but pending end touches, which
are touches that have physically ended.

Signed-off-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>
2012-03-22 11:33:20 +10:00
Peter Hutterer
5497ce3da4 dix: IsFloating() on master devices is always false
There are a few subtle bugs during startup where IsFloating() returns true
if the device is a master device that is not yet paired with its keyboard
device.

Force IsFloating() to always return FALSE for master devices, that was the
intent after all and any code that relies on the other behaviour should be
fixed instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Tested-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2012-03-22 11:33:20 +10:00
Peter Hutterer
eb84c154ed dix: when rescaling from master, rescale from desktop dimensions (#46657)
master->last.valuators[] is in desktop dimensions, so use those as
rescale axis ranges, not the screen. Otherwise, a rescale on any screen
not the top-left will cause out-of-bounds coordinates which will always
map to the bottom-right screen, causing the device to be stuck on that
screen.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-03-22 11:33:20 +10:00
Daniel Stone
ab3a815a75 Indentation: Change '& stuff' to '&stuff'
If the typedef wasn't perfect, indent would get confused and change:
    foo = (SomePointlessTypedef *) &stuff[1];
to:
    foo = (SomePointlessTypedef *) & stuff[1];

Fix this up with a really naïve sed script, plus some hand-editing to
change some false positives in XKB back.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-21 14:02:30 -07: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
2416ee4a01 dix: avoid NULL-pointer dereference on button-only devices (#38313)
And for such devices simply take the last.valuators[] which must be valid at
all times anyway. UpdateSlaveDeviceCoords takes care of that.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-02-27 13:01:45 +10:00
Jeremy Huddleston
38000e7d1f Revert "dix: don't XWarpPointer through the last slave anymore (#38313)"
This reverts commit 2bfb802839.

This commit caused a regression.

See: http://xquartz.macosforge.org/trac/ticket/517#comment:10

Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-02-22 21:15:41 -08:00
Keith Packard
71594746c7 Merge remote-tracking branch 'whot/for-keith' 2012-02-22 18:07:20 +13:00
Peter Hutterer
6f28388187 dix: reset last.scroll when resetting the valuator (#45611)
last.scroll remained on the last-submitted scrolling value but last.valuator
was changed whenever the slave device changed. The first scrolling delta
after a switch was then calculated as (last.scroll - new abs value), causing
erroneous scrolling events.

Test case:
- synaptics with a scrolling method enabled, other device with 3+ axes (e.g.
  wacom)
- scroll on touchpad
- use other device
- scroll on touchpad

The second scroll caused erroneous button press/release events.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-02-14 21:47:30 +10:00
Keith Packard
42b6756463 Merge remote-tracking branch 'alanc/master' 2012-02-11 15:36:43 +13:00
Benjamin Otte
b96275c4cd dix: fix an out-of-memory crash
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-02-08 19:06:17 +10:00
Chase Douglas
6241b5e4fd Implement touch early accept
This doesn't really implement early accept as it should. Ideally, the
server should send end events to all subsequent touch clients as soon as
an early accept comes in. However, this implementation is still protocol
compliant. We can always improve it later.

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
Chase Douglas
b0c54856df Implement early touch reject
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
Chase Douglas
656ab879f2 Check for proper window ID when processing touch allow requests
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
Chase Douglas
9a260e9af8 Move AllowTouch to dix/touch.c, and rename to TouchAcceptReject
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
Chase Douglas
ab60cadc2a Store window pointer in touch listener record
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:14 +10:00
Peter Hutterer
f92ba92adf Revert "dix: deduplicate callers of DeliverDeviceEvents in DeliverGrabbedEvents"
This call was supposed to have no functional changes but in some cases
DeliverDeviceEvents() was called with a uninitialised win variable.
Revert, safer than trying to sort this out otherwise.

This reverts commit 6eff14a789.

Reported-by: Mathieu Taillefumier <mathieu.taillefumier@free.fr>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2012-02-08 18:04:08 +10:00
Alan Coopersmith
ca64912c02 Namespace list api to reduce conflicts with similar system headers
Rename functions/macros from list_* to xorg_list_*
Rename struct from struct list to struct xorg_list.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
In-sed-I-trust: Peter Hutterer <peter.hutterer@who-t.net>
2012-02-03 14:23:24 -08:00
Chase Douglas
e1085a0da0 Don't set X and Y valuators for indirect touch events
For expediency, it made sense to always have the X and Y axes set for
direct touch device event propagation. The last X and Y values are
stored internally. However, indirect device touch event propagation
does not depend on the touch's X and Y values. Thus, we don't need to
set the values for every indirect touch event.

On top of this, the previous X and Y values aren't stored for indirect
touches, so without this change the axes get erroneously set to 0.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-01-24 13:27:30 +10:00
Daniel Stone
5201310559 UngrabAllDevices: Don't kill clients if not told to
The kill_client argument to UngrabAllClients specifies if we want to
kill the client holding the grab or just deactivate the grab.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reported-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Cyril Brulebois <kibi@debian.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-01-24 13:26:37 +10:00
Chase Douglas
9b1e18f42a Only update pointer motion data for pointer emulated touch events
Signed-off-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>
2012-01-24 13:26:36 +10:00
Chase Douglas
f00e5b02f5 Only scale direct device touch coordinates
Indirect touch devices provide valuator values in pure device
coordinates. They also don't need to be fixed up for screen crossings.

Signed-off-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>
2012-01-24 13:26:36 +10:00
Chase Douglas
f9e6858d5c Use event time instead of CurrentTime for grab times
When {XI,X,}AllowEvents is called, the timestamp is compared against the
grab time to ensure that the request pertains to the current grab in the
server. While many clients may use CurrentTime (client-side), the
timestamp of the event causing the grab is also valid.

This change ensures that the server's notion of the grab time is the
time of the event that activated the grab rather than the time that the
grab is actually activated.

This bug was exposed through nested touch then pointer grabs.

Signed-off-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>
2012-01-13 09:04:49 +10:00
Peter Hutterer
35bd77e9d0 dix: Update pointer limits for floating devices too (#43635)
When the screen is restructured, the pointer limits need to be reset for
floating slave devices as well, not just for master pointers. Only skip
devices that don't have a cursor (attached slaves and keyboard)

Bug reproducer: float an absolute slave device, rotate the screen - the
device is now confined to a section of the screen only.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-01-13 09:03:04 +10:00
Keith Packard
3be37375ee Revert "dix: Extend initial connection handshake for forwarding proxies"
This reverts commit 78fa121f40.

ABI change pended for 1.13
2012-01-12 12:09:55 -08:00
Keith Packard
e476af417d Merge remote-tracking branch 'whot/multitouch' 2012-01-09 13:17:37 -08:00
Chris Halse Rogers
63a8012947 Revert "dix: don't return BadMatch from GetProperty (#23562)"
This reverts commit f04fe06ae2.

dixLookupWindow no longer returns BadMatch. No other caller was checking
for it, so this problem is now fixed in the utility function.

Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-01-09 13:09:48 -08:00
Chris Halse Rogers
ef492e9797 dix: Return BadWindow rather than BadMatch from dixLookupWindow
dixLookupWindow uses dixLookupDrawable internally, which returns
BadMatch when the XID matches a non-Window drawable.  Users
of dixLookupWindow don't care about this, just that it's not
a valid Window.

This is a generalised version of the fix for X.Org Bug 23562,
where GetProperty was incorrectly returning BadMatch. Auditing other
window requests, all that I checked would incorrectly return BadMatch
in these circumstances.  An incomplete list of calls that could
incorrectly return BadMatch is: ListProperties, SetSelectionOwner,
{Destroy,Map,Unmap}{,Sub}Window.

None of the callers of dixLookupWindow, except for GetProperty, check
for BadMatch

Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-01-09 13:09:48 -08:00
Keith Packard
0b113f7cdf Merge commit '777bf90abeac37087a3d0538b847742523d5acf2' 2012-01-09 13:07:25 -08:00
Adam Jackson
8f9bdfd293 dix: Tune dixLookupDrawable for success
The vast vast vast majority of resource lookups are successful.  Move some
work to the error paths so we don't punish success.

Before:
40000000 trep @   0.0009 msec (1109091.3/sec): PutImage 10x10 square
60000000 trep @   0.0005 msec (2072652.2/sec): ShmPutImage 10x10 square

After:
40000000 trep @   0.0009 msec (1148346.9/sec): PutImage 10x10 square
60000000 trep @   0.0005 msec (2091666.1/sec): ShmPutImage 10x10 square

Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2012-01-06 13:29:54 -05:00
Adam Jackson
83a98543b5 dix: Tune dtrace hooks around Dispatch
Don't call LookupMajorName if the hooks aren't active, it's quite expensive.

Before:
40000000 trep @   0.0009 msec (1087458.5/sec): PutImage 10x10 square
60000000 trep @   0.0005 msec (2012238.6/sec): ShmPutImage 10x10 square

After:
40000000 trep @   0.0009 msec (1109091.3/sec): PutImage 10x10 square
60000000 trep @   0.0005 msec (2072652.2/sec): ShmPutImage 10x10 square

Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2012-01-06 13:29:54 -05:00
Adam Jackson
78fa121f40 dix: Extend initial connection handshake for forwarding proxies
Forwarding proxies like sshd will appear to be local, even though they
aren't really.  This leads to weird behaviour for extensions that truly
require running under the same OS services as the client, like MIT-SHM
and DRI2.

Add two new legal values for the initial connection's byteOrder field,
'r' and 'R'.  These act like 'l' and 'B' respectively, but have the side
effect of forcing the client to be treated as non-local.  Forwarding
proxies should attempt to munge the first packet of the connection
accordingly; older servers will reject connections thusly munged, so the
proxy should fall back to passthrough if the munged connection attempt
fails.

Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2012-01-06 13:29:53 -05:00
Carlos Garnacho
075a473e53 dix: Set XITouchEmulatingPointer on events from the touch sequence emulating pointer events
The internal flag is kept around, merely translated to XITouchEmulatingPointer
when creating the XI2 events that will be delivered to the client.

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-01-06 14:03:04 +10:00
Peter Hutterer
223ba8b46e dix: fix wrong condition checking for attached slave (#44003)
We need to update the master if the device is not a master _and_ it is not
floating.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-01-06 08:06:05 +10:00
Peter Hutterer
3ce102c362 dix: on PointerRootWin send a FocusIn to the sprite window too
XTS XSetDeviceFocus-7

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-01-06 08:05:59 +10:00
Peter Hutterer
a125aabda3 dix: send focus events to the immediate parent (#44079)
For a transition from windows A to B, A->parent did not receive an event.
DeviceFocusOutEvents sends to windows ]from, to[, so start with the actual
window, not it's parent.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2012-01-06 08:05:16 +10:00
Peter Hutterer
e395efc25f Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into multitouch
Conflicts:
	configure.ac
	dix/inpututils.c

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-22 09:29:59 +10:00
Carlos Garnacho
475ef5cc83 dix: fix xi2 mask/filter when delivering grabbed events
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-21 15:20:32 +10:00
Peter Hutterer
8080d785b2 dix: remove requirement for client_id be the first element
Leftover code from an earlier version of GetTouchEvents.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21 14:16:37 +10:00
Peter Hutterer
552de314bf dix: don't retrieve the syncEvents tail on an empty list
An empty list points to itself but syncEvents has the list head only and is
of a different format than the elements. Thus, casting it to a QdEventPtr
gives us garbage.

Segfaults with XTS test case Xlib13/XGrabKeyboard

Introduced in 7af23259d8.

Reported-by: Aaron Plattner <aplattner@nvidia.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21 14:16:37 +10:00
Peter Hutterer
76c11e0872 dix: button state must show the logical buttons, not physical buttons
If the device is mapped 3 2 1, a click on physical button 1 sends a button 3
press, but the state was set for button 1. Fix this, the state must be set
for that button's logical mapping.

https://bugzilla.gnome.org/show_bug.cgi?id=655928

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21 14:16:36 +10:00
Daniel Stone
3b1e2035cc dix: Remove touch grabs if the grab disappears
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21 14:16:36 +10:00
Peter Hutterer
cd3de8324e dix: hook up passive grabs and pointer emulated passive grabs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21 14:16:36 +10:00
Peter Hutterer
753c4dca1e dix: add touch to pointer event conversion helper
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21 12:38:36 +10:00
Peter Hutterer
c3843f5498 dix: add real_event parameter to ActivatePassiveGrab
For touch events with pointer emulation, the event that triggers the grab
(the pointer event) is not the same as the actual event (the touch event).
For replaying, we need to store the real event then.

No effective changes at this point, for the current caller event and
real_event are identical.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21 12:38:36 +10:00
Peter Hutterer
e389a19a73 Process and deliver touch events
Does not include pointer emulation handling.
Does include partial ownership handling but not the actual processing of
ownership events.

Note: this commit is a retroactive commit extracted from a series of ~50
commits and may thus appear a bit more complicated than what you'd write out
from scratch.

Pointer processing tree is roughly:
- ProcessOtherEvents
  - ProcessTouchEvents
    - DeliverTouchEvents
      - DeliverTouchBeginEvent|DeliverTouchEndEvent|...
        - DeliverOneTouchEvent

Also hooks up the event history playing to the right function now.

Co-authored-by: Daniel Stone <daniel@fooishbar.org>
Co-authored-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>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21 12:38:35 +10:00
Peter Hutterer
634b0da9a8 dix: set core and button state based on the touch state
If a pointer-emulating touch caused a button to be logically down, set that
state in the input events.

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
593c3e2eb3 dix: add TouchResourceIsOwner helper function
The first listener in the sequence is the owner of the touch sequence.

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
5d0260cc98 dix: add helper functions for adding/removing touch listeners
The DIX will call TouchSetupListeners once for a new touch. After that
the listener list remains static, with listeners only dropping out when they
either reject the grab or disappear.

Exception: if grabs activate they are prefixed to the listeners.

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
Chase Douglas
6a68f97ce6 dix: add TouchGetPointerEventType helper function
Returns the respective pointer event type for a given touch event type.

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
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
Daniel Stone
c18a173cf5 dix: add helper functions to build up/verify the sprite trace
Touch events' sprite trace stays the same for the duration of the touch
sequence.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21 12:38:35 +10:00
Peter Hutterer
40475261ea dix: add touch event history helper functions
If touch client has not registered for ownership events and a grab above
that client is rejected, the client needs to receive the complete event
history.

The history currently doesn't really do fancy overflow handling. We assume
that the first TOUCH_HISTORY_SIZE events are the important ones and anything
after that is dropped. If that is a problem, fix the client that takes > 100
event to decide whether to accept or reject.

Events marked with TOUCH_CLIENT_ID or TOUCH_REPLAYING must not be stored in
the history, they are events created by the DIX to comply with the protocol.
Any such event should already be in the history anyway.

A fixme in this patch: we don't have a function to actually deliver the
event yet.

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
f3df3ad668 dix: handle DIX-submitted touch events
The DIX needs to submit touch events for e.g. TouchEnd after an
acceptance/rejection. These have the TOUCH_CLIENT_ID flag set.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21 12:38:32 +10:00
Peter Hutterer
fcda98c486 dix: button state must show the logical buttons, not physical buttons
If the device is mapped 3 2 1, a click on physical button 1 sends a button 3
press, but the state was set for button 1. Fix this, the state must be set
for that button's logical mapping.

https://bugzilla.gnome.org/show_bug.cgi?id=655928

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21 08:12:52 +10:00
Peter Hutterer
47da6b6b2c dix: don't retrieve the syncEvents tail on an empty list
An empty list points to itself but syncEvents has the list head only and is
of a different format than the elements. Thus, casting it to a QdEventPtr
gives us garbage.

Segfaults with XTS test case Xlib13/XGrabKeyboard

Introduced in 7af23259d8.

Reported-by: Aaron Plattner <aplattner@nvidia.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21 08:12:48 +10:00
Daniel Stone
9ce8463a33 dix: generate touchpoints from driver-submitted data
The touchpoints are generated, enqueued but not processed since we don't
handle them in the event processing yet.

Co-authored-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-20 13:06:32 +10:00
Daniel Stone
bec51f5ec6 dix: add GetTouchOwnership event API
No callers yet. This API is not to be used by drivers, it's an API for the
DIX which will create ownership events mainly on touch acceptance/rejection.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-20 13:01:03 +10:00
Peter Hutterer
5c63dc6dbc dix: add DIX API to create touchpoints
The DIX touchpoints are the ones used for event processing.

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-20 13:01:03 +10:00
Peter Hutterer
7f8127d203 dix: if we run out of space for new touch events, resize the queue
The SIGIO handler forces us to drop the current touch and schedule the
actual resize for later. Should not happen if the device sets up the
TouchClassRec with the correct number of touchpoints.

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-20 13:01:00 +10:00
Peter Hutterer
758bc57ba5 dix: add helper functions to create DDX touch recs
DDX touch points are the ones that keep records of the driver-submitted
touchpoints. They're unaffected by the grab state and terminate on a
TouchEnd submitted by the driver.

The client ID assigned is server-global.

Since drivers usually submit in the SIGIO handler, we cannot allocate in the
these functions.

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:36 +10:00
Daniel Stone
3fb258ca28 input: add a TouchClassRec to the devices
These structs will be used to store touch-related data, events and
information.

Drivers must call InitTouchClassDeviceStruct to set up a multi-touch capable
device.

Touchpoints for the DDX and the DIX are handled separately - touchpoints
submitted by the driver/DDX will be stored in the DDXTouchPointInfoRec. Once
the touchpoints are processed by the DIX, new TouchPointInfoRecs are created
and stored. This process is already used for pointer events with the
last.valuators field.

Note that this patch does not actually add the generation of touch events,
only the required structs.

TouchListeners are (future) recipients of touch or emulated pointer events.
Each listener is in a state, depending which event they have already
received. The type of listener defines how the listener got to be one.

Co-authored-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-19 09:08:36 +10:00
Daniel Stone
098b837440 Add the touch input API stubs
xf86PostTouchEvent is the driver API to submit touch events to the server.
This API doesn't do anything yet though but now we can at least bump the
API.

For valuators, drivers should use the existing xf86InitValuatorAxisStruct
function.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-19 09:08:36 +10: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
190a6f45ee dix: split positionSprite into scale_to_desktop and positionSprite
For future touch points, we need positionSprite to calculate the coordinates
but we don't want to actually change the cursor position for non-emulating
touches.

No functional changes at this point.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-16 11:18:40 +10:00
Keith Packard
7da7aa96a0 Merge remote-tracking branch 'whot/for-keith' 2011-12-14 11:40:10 -08:00
Peter Hutterer
7528a6b88e Merge branch 'for-whot' of git://people.freedesktop.org/~alanc/xserver into for-keith 2011-12-13 14:19:54 +10:00
Peter Hutterer
f0de5e3990 dix: add a MAXEVENTS define for the number of core + extension events
Not including GenericEvents

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Walter Harms <wharms@bfs.de>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-13 13:24:57 +10:00
Peter Hutterer
adf8a0d62c dix: move event filter retrieval helpers to inpututils.c
No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-13 13:24:57 +10:00
Peter Hutterer
a03fe81950 dix: switch EventIsDeliverable to take the event type only
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-13 13:24:57 +10:00
Peter Hutterer
10a8c428fa dix: move storing last.valuators into a helper function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-13 13:24:57 +10:00
Peter Hutterer
a15abf82dd dix: always allocate and set the grab's sync.event
Allocate the memory at device creation time and always store the event, even
if we're not frozen. This way we know which event triggered the grab.
Since the event was never freed anyway except on device shutdown, this
doesn't really change things much.

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
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
Peter Hutterer
cd56bd7b3e Add GrabIsPointerGrab and GrabIsKeyboardGrab helpers
No functional changes

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
Peter Hutterer
47734b2ba2 dix: move delivery stop condition out of event mask
Previously, this was only called if there was a mask match, so even if we
had a no-propagate flag set or a stopAt window specified, if no mask
triggered on the window we would recurse up to the root window and
eventually deliver.
Move this, so that the stopAt and do-not-propagate mask is honoured.

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
Peter Hutterer
1d01e861b6 dix: split out core state and event state setting into helper functions
no functional changes.

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
Peter Hutterer
fb010c5436 dix: move grab matching code into a helper function
No functional changes.

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
Peter Hutterer
d253a262c2 dix: split core grab interference check into helper function
No functional changes.

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
Peter Hutterer
97d79dd740 dix: compare the grab type, not the tempGrab type
No functional change. To get here, GrabMatchesSecond() needs to be TRUE and
for that the two grab types must be identical.

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
Peter Hutterer
b9d6ae42b6 dix: remove event type check
Can't remember why this is there but we'll need to pass in XI2 events soon,
so this check is obsolete.

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
Chase Douglas
80816366aa dix: Split ActivatePassiveGrab() from CheckPassiveGrab()
The changed logic means we don't require the explicit grab = NULL setting
and early exit anymore. Not 100% of it, but if we see that message pop up in
a log we know it's broken.

Signed-off-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>
2011-12-13 13:24:05 +10:00
Chase Douglas
9ee62cd8ce dix: Move grab check and activation logic to CheckPassiveGrab()
This is needed for future pointer emulation work.

Signed-off-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>
2011-12-13 13:24:01 +10:00
Peter Hutterer
c53651dabc dix: move EventDeliveryState into a header file, we'll need it elsewhere
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-13 13:24:00 +10:00
Peter Hutterer
6eff14a789 dix: deduplicate callers of DeliverDeviceEvents in DeliverGrabbedEvents
No functional change.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-13 13:24:00 +10:00
Peter Hutterer
93945b0a74 dix: split grab event conversion and delivery into a helper function
Effective functional change: XI2 events are checked with XACE now.

DeliverOneGrabbedEvent is exported for future use by touch events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-13 13:24:00 +10:00
Peter Hutterer
c81cdb0862 dix: replace conversion errors with BUG_WARN_MSG
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-13 13:24:00 +10:00
Peter Hutterer
6368c2aa46 dix: deduplicate event delivery code
Move all the event delivery code into DeliverOneEvent, based on the
InputLevel we're sending to.

Functional change: we now check XI2 events with XACE too.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-13 13:24:00 +10:00
Alan Coopersmith
898d976729 verify_internal_event: preserve constness of data pointer
All we're using it for is ErrorF calls, so make it a const char *
to stop gcc from warning:

inpututils.c: In function 'verify_internal_event':
inpututils.c:629:9: warning: cast discards qualifiers from pointer target type

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-12 17:04:33 -08:00
Alan Coopersmith
99dfe9b1de Fix deconstifying cast warning in xi2_get_type
Since we're just comparing values in the struct, cast it to a
const xGenericEvent * to clear gcc warning of:

events.c: In function 'xi2_get_type':
events.c:193:5: warning: cast discards qualifiers from pointer target type

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-12 17:04:03 -08:00
Alan Coopersmith
dd80156bf0 Include client name if available in PrintDeviceGrabInfo
Also adds missing newline to first line of output.

Before patch:

[3581472.414] (II) Printing all currently active device grabs:
[3581472.414] Active grab 0x1800000 (core) on device 'Virtual core pointer' (2):
      client pid 26174 uid 0 gid 10
[3581472.415]       at 3581469139 (from active grab) (device thawed, state 1)
[3581472.415]         core event mask 0x0
[3581472.415]       owner-events true, kb 1 ptr 1, confine 0, cursor 0x0
[3581472.415] Active grab 0x1800000 (core) on device 'Virtual core keyboard' (3)
:      client pid 26174 uid 0 gid 10
[3581472.415]       at 3581469139 (from active grab) (device thawed, state 1)
[3581472.415]         core event mask 0x3
[3581472.415]       owner-events true, kb 1 ptr 1, confine 0, cursor 0x0
[3581472.415] (II) End list of active device grabs

After patch:
[3581736.601] (II) Printing all currently active device grabs:
[3581736.601] Active grab 0x1600000 (core) on device 'Virtual core pointer' (2):
[3581736.601]       client pid 26741 /usr/bin/xscreensaver -nosplash
[3581736.601]       at 3581735000 (from active grab) (device thawed, state 1)
[3581736.601]         core event mask 0x0
[3581736.601]       owner-events true, kb 1 ptr 1, confine 0, cursor 0x0
[3581736.601] Active grab 0x1600000 (core) on device 'Virtual core keyboard' (3)
:
[3581736.601]       client pid 26741 /usr/bin/xscreensaver -nosplash
[3581736.601]       at 3581735000 (from active grab) (device thawed, state 1)
[3581736.601]         core event mask 0x3
[3581736.601]       owner-events true, kb 1 ptr 1, confine 0, cursor 0x0
[3581736.601] (II) End list of active device grabs

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
2011-12-12 17:03:34 -08:00
Alan Coopersmith
d5a5eece67 CompareISOLatin1Lowered: constify arguments
Allows callers to avoid deconstifying arguments when calling, fixing
gcc warning:

filter.c: In function 'PictureGetFilterId':
filter.c:59:2: warning: cast discards qualifiers from pointer target type

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-12 17:03:10 -08:00
Alan Coopersmith
50b1097643 Constify the reason string throughout the authorization check framework
Almost all of the places the string is assigned point to a literal
string constant, so use const char * for those, and const char **
for function calls that return it via an argument.   Fortunately
the top level function, ClientAuthorized, which returns the string
as its return value is called from only one place, ProcEstablishConnection.

ProcEstablishConnection stores either that return value or a string literal
in char *reason.  It only uses reason as an argument to SendConnSetup.
SendConnSetup passes the reason argument to strlen & WriteToClient,
both of which already have const qualifiers on their args.
Thus added const to the reason variable in ProcEstablishConnection
and the reason argument to SendConnSetup.

Fixes gcc warnings:
dispatch.c: In function 'ProcEstablishConnection':
dispatch.c:3711:9: warning: assignment discards qualifiers from pointer target type
auth.c: In function 'CheckAuthorization':
auth.c:218:14: warning: assignment discards qualifiers from pointer target type
auth.c:220:20: warning: assignment discards qualifiers from pointer target type
connection.c: In function 'ClientAuthorized':
connection.c:683:3: warning: return discards qualifiers from pointer target type
mitauth.c: In function 'MitCheckCookie':
mitauth.c:88:13: warning: assignment discards qualifiers from pointer target type
xdmauth.c:259:14: warning: assignment discards qualifiers from pointer target type
xdmauth.c:270:14: warning: assignment discards qualifiers from pointer target type
xdmauth.c:277:11: warning: assignment discards qualifiers from pointer target type
xdmauth.c:293:15: warning: assignment discards qualifiers from pointer target type
xdmauth.c:313:14: warning: assignment discards qualifiers from pointer target type
xdmauth.c:322:11: warning: assignment discards qualifiers from pointer target type
rpcauth.c: In function 'SecureRPCCheck':
rpcauth.c:136:10: warning: assignment discards qualifiers from pointer target type

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-12 17:03:10 -08:00
Alan Coopersmith
2ddae8f0bd constify strings in resource name registry
LookupResourceName already returned a const char *, so just needed
to change the variable we're storing the list in to be a const char **
and then add const to the name argument to RegisterResourceName
(which just stores name in the array) and CreateNewResourceType
(which just passes name to RegisterResourceName).

Clears a bunch of gcc warnings of the form:
registry.c:319:5: warning: passing argument 2 of 'RegisterResourceName' discards qualifiers from pointer target type
registry.c:200:1: note: expected 'char *' but argument is of type 'const char *'

and from all the extensions:
damageext.c: In function 'DamageExtensionInit':
damageext.c:490:5: warning: passing argument 2 of 'CreateNewResourceType' discards qualifiers from pointer target type
../include/resource.h:159:26: note: expected 'char *' but argument is of type 'const char *'

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-12 17:03:08 -08:00
Alan Coopersmith
424dbde891 CheckForEmptyMask does not need to declare int n twice
Just use the existing n variable again in the ARGB_CURSOR loop
instead of creating another one.

Fixes gcc -Wshadow warning:
cursor.c: In function 'CheckForEmptyMask':
cursor.c:155:6: warning: declaration of 'n' shadows a previous local
cursor.c:146:9: warning: shadowed declaration is here

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-12 17:03:08 -08:00
Peter Hutterer
e5aa00989c Change GetXI2/XI/CoreType to just take a type argument
Avoids the dummy-event dance if we have an event type and need to get the
matching XI2 type.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-10 17:54:34 +10:00
Peter Hutterer
6cc0e6a0af include: add GetXI2MaskByte and GetXI2EventFilterMask to headers
This is needed for touch event processing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-10 17:54:34 +10:00
Peter Hutterer
27425f07b2 dix: use BUG_WARN for input mask size issues
Yes, we're likely corrupting memory here but really this is unlikely to be
triggered other than a real bug in the server. In which case a stacktrace is
going to be more useful than any silent error handling.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-09 14:56:23 +10:00
Peter Hutterer
86bb3781b3 input: swap the server over to use the XI2mask struct
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-09 14:56:23 +10:00
Peter Hutterer
b8b90cd161 Add a new XI2Mask struct and a few helper functions.
The current XI2 mask handling is handy for copying (fixed size arrays) but a
pain to deal with otherwise. Add a struct for XI2 masks and the required
accessors.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-09 14:56:23 +10:00
Peter Hutterer
4bc2761ad5 dix: switch the dev->deviceGrab.activeGrab from GrabRec to GrabPtr
This breaks the input ABI.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-09 14:56:23 +10:00
Peter Hutterer
b601ea769f dix: allocate temporary grabs on the heap
Once grabs start having nested memory locations, we can't just use the
GrabRec on the stack anymore, we need to alloc/copy/free the grabs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-09 14:56:23 +10:00
Peter Hutterer
b0e9e2e326 dix: add CopyGrab() function
Not really needed at this point, but will be once touch support is added.
Since grabs are now expected to be allocated/freed with AllocGrab and
FreeGrab, CopyGrab must increase the refcount and duplicate the modifier
masks. Until the callers are switched to use FreeGrab, this introduces
memleaks.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-09 14:56:23 +10:00
Peter Hutterer
347f377f3b dix: add AllocGrab helper function
Not needed since the GrabRec is a self-contained struct but will be needed
for the xi2 input mask rework.
FreeGrab already exists, make it available to other callers.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-09 14:56:23 +10:00
Peter Hutterer
7af23259d8 dix: switch the syncEvent queue to a struct list
No effective functionality change, just cleanup to make this code slightly
more sane.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-09 14:56:20 +10:00
Keith Packard
fb22a408c6 Save major/minor opcodes in ClientRec for RecordAReply
The record extension needs the major and minor opcodes in the reply
hook, but the request buffer may have been freed by the time the hook
is invoked. Saving the request major and minor codes as the request is
executed avoids fetching from the defunct request buffer.

This patch also eliminates the public MinorOpcodeOfRequest function,
inlining it into Dispatch. Usages of that function have been replaced
with direct access to the new ClientRec field.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
2011-12-01 15:11:20 +00:00
Peter Hutterer
4acf999c29 dix: use a single return statement in CheckPassiveGrabsOnWindow
No functional change.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-11-29 15:12:38 +10:00
Peter Hutterer
b371795f01 dix: rename GetWindowXI2Mask to WindowXI2MaskIsset
And let it return a boolean value, that's all the callers need anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-11-29 15:12:35 +10: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
08093c25a9 Convert some malloc + strncpy pairs into strndup calls
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23 12:15:05 -08:00
Peter Hutterer
35ec24cf24 input: replace remaining GetPairedDevice() with GetMaster()
Wherever it's obvious which device we need (keyboard or pointer), use
GetMaster() instead of GetPairedDevice(). It is more reliable in actually
getting the device type we want.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-11-09 13:26:47 +10:00
Peter Hutterer
11840595a1 dix: Don't let a driver without a ProximityClassRec post events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-09 13:26:47 +10:00
Keith Packard
d91aa0e660 Merge remote-tracking branch 'whot/two-screen-coordinates' 2011-11-02 21:20:07 -07:00
Aaron Plattner
8329afa59d dix: Reinstate GetImage window size check
Commit 587c3a2d19 fixed DoGetImage to
check windows against their backing drawables, rather than against the
screen dimensions, to prevent reading outside the bounds of redirected
windows' backing pixmaps (see bug #22804).  Unfortunately, while
making that change I also removed the check that the rectangle is
contained within the bounds of the source window, which is a violation
of the specification:

    If the drawable is a window, the window must be viewable, and it
    must be the case that, if there were no inferiors or overlapping
    windows, the specified rectangle of the window would be fully
    visible on the screen *and wholly contained within the outside
    edges of the window* (or a Match error results). Note that the
    borders of the window can be included and read with this request.

    (emphasis mine)

Reinstate the window dimension check, to return BadMatch if the
GetImage request falls outside the bounds of the window.

Fixes X Test Suite test XGetImage-15:

    400|0 15 1 11:05:41|IC Start
    200|0 15 11:05:41|TP Start
    520|0 15 00005146 1 1|VSW5TESTSUITE PURPOSE 15
    520|0 15 00005146 1 2|Assertion XGetImage-15.(A)
    520|0 15 00005146 1 3|When the drawable is a window and the window is viewable
    520|0 15 00005146 1 4|and it is not the case that given there were no inferiors or
    520|0 15 00005146 1 5|overlapping windows the specified rectangle of the window
    520|0 15 00005146 1 6|would be fully visible on the screen and wholly contained
    520|0 15 00005146 1 7|within the outside edges of the window, then a BadMatch
    520|0 15 00005146 1 8|error occurs.
    520|0 15 00005146 1 9|METH: Create window which is not fully visible on the screen.
    520|0 15 00005146 1 10|METH: Call XMapWindow to make sure the window is viewable.
    520|0 15 00005146 1 11|METH: Call XGetImage with rectangle extending beyond edge of screen.
    520|0 15 00005146 1 12|METH: Verify XGetImage return value is null.
    520|0 15 00005146 1 13|METH: Verify that BadMatch error occurred.
    520|0 15 00005146 1 14|METH: Create window which is fully visible on the screen.
    520|0 15 00005146 1 15|METH: Call XMapWindow to make sure the window is viewable.
    520|0 15 00005146 1 16|METH: Call XGetImage with rectangle extending beyond edge of window.
    520|0 15 00005146 1 17|METH: Verify XGetImage return value is null.
    520|0 15 00005146 1 18|METH: Verify that BadMatch error occurred.
    520|0 15 00005146 1 19|REPORT: Got Success, Expecting BadMatch
    520|0 15 00005146 1 20|REPORT: Null image not returned.
    220|0 15 1 11:05:41|FAIL

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2011-10-31 15:42:11 -07:00
Peter Hutterer
d7c44a7c97 dix: block signals when closing all devices
When closing down all devices, we manually unset master for all attached
devices, but the device's sprite info still points to the master's sprite
info. This leaves us a window where the master is freed already but the
device isn't yet. A signal during that window causes dereference of the
already freed spriteInfo in mieqEnqueue's EnqueueScreen macro.

Simply block signals when removing all devices. It's not like we're really
worrying about high-responsive input at this stage.

https://bugzilla.redhat.com/show_bug.cgi?id=737031

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
2011-10-31 09:39:04 +10:00
Peter Hutterer
ffe20acedb Use new FP1616/FP3232 conversion functions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-10-25 14:06:41 +10:00
Peter Hutterer
1f4af6c12f dix: accept a NULL master for CreateClassesChangedEvent
If a floating device changes, the master is NULL but we must still create a
DCE for it.

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
e9dee21fa3 dix: pass the flags into the CreateClassesChangedEvent
No effective functional changes, prep work for future patches.

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
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
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
Peter Hutterer
1ecc427a39 dix: move #if statement to stop compiler warning
ptrveloc.c: In function 'QueryTrackers':
ptrveloc.c:598:34: warning: variable 'used_offset' set but not used
[-Wunused-but-set-variable]

used_offset is used, but only in the debugging code. Move the #if statement
to ignore that warning.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-10-25 14:06:41 +10:00
Peter Hutterer
c39c8d3428 input: switch InputOption to use XF86OptionRec storage.
Use the same struct for both InputOption and XF86OptionRec so we don't need
to convert to and fro the two in the config backends.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-10-25 14:06:39 +10:00
Keith Packard
15bbdc103b Merge remote-tracking branch 'whot/for-keith' 2011-10-19 17:26:50 -07:00
Peter Hutterer
2cb63180fa dix: mark motion events as emulated if we're scrolling from button press
The protocol requires that the emulated event is marked as such. So if a
driver with smooth scrolling axis sends legacy button events, the motion
event must be marked as emulated.

Pass the real type to emulate_scroll_button_events and create the events
accordingly. For real button press or relase events, only that event must be
generated since a release event will follow or a press event has already
occured, respectively. (This fixes a bug where we'd get two release events
for each legacy button event)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-10-18 09:15:54 +10:00
Peter Hutterer
82c60232c0 dix: add valuator_mask_fetch_double()
Using this call simplifies callers that don't know if the mask bit is set.

Before:
  if (valuator_mask_isset(mask, valnum))
    value = valuator_mask_get_double(mask, valnum));
  else
    value = someothervalue;

Now:
 if (!valuator_mask_fetch_double(mask, valnum, &value))
    value = someothervalue;

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-10-18 09:15:54 +10:00
Keith Packard
64d2d1bef1 Merge remote-tracking branch 'jeremyhu/master' 2011-10-17 14:36:34 -07:00
Keith Packard
fb84be47db Merge remote-tracking branch 'whot/next' 2011-10-17 13:50:25 -07:00
Jeremy Huddleston
f9c6903d4a dix: add utility functions for double to/fro FP1616/FP3232 conversion
Co-authored-by: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
2011-10-15 21:15:47 -07:00
Peter Hutterer
401150d7dc input: change pointer screen crossing behaviour for multiple ScreenRecs
miPointerSetPosition traditionally took coordinates on a per-screen basis,
triggering a screen switch when these went out-of-bounds. For absolute
devices, this prevented screen crossing in the negative x/y direction.

This patch changes the event generation patch to handle screen coordinates
in a desktop range (i.e. all screens together). Screen switches are
triggered when these coordinates are not on the current screen.

This unifies the pointer behaviour of single ScreenRec multihead and
multiple ScreenRecs multihead in that the cursor by default moves about the
whole screen rather than be confined to one single screen. The
transformation matrix may then be used to actually confine the cursor to the
screen again.

Note: fill_pointer_events has to deal with several different coordinate
systems. Make sure you read the comment before trying to understand the code.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-10-13 11:34:43 +10:00
Peter Hutterer
6bd0eff40f dix: extend rescaleValuatorAxis to take a minimum default
Allow rescaling to non-zero based axis ranges as default (for when screen
offsets are non-zero). Currently unused.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-10-13 11:34:17 +10:00
Peter Hutterer
8bebb4b489 Store desktop dimensions in screenInfo.
For Zaphod mode screen crossing handling we need to know the size of all
screens together (i.e. the whole desktop size). Store that in the screenInfo to
have it readily available in events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-10-13 11:26:09 +10:00
Peter Hutterer
32b289e46c dix: move MD last.valuator update into fill_pointer_events
Don't update the MD where it's not expected, positionSprite should really
just do that - position the sprite.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-10-11 12:07:00 +10:00
Peter Hutterer
3b36fd1b49 mi: switch miPointerSetPosition to take doubles
Don't switch between doubles and ints in the caller, instead take doubles in
miPointerSetPosition and do the conversion there. For full feature we should
change everything down from here for doubles too.

Functional change: previously we'd restore the remainder regardless of
screen switching/confinement (despite what the comment said). Now,
screen changing or cursor constraints will cause the remainder be clipped
off. This should happen for cursor constraints but arguably not for screen
crossing.

This also corrects a currently wrong comment about miPointerSetPosition's
input coordinates.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-10-11 12:06:56 +10:00
Peter Hutterer
81cfe44b1e mi: return the screen from miPointerSetPosition
miPointerSetPosition may switch screens. Always return the screen the sprite
is on instead of relying on callers to call miPointerGetScreen().

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-10-11 12:06:53 +10:00
Peter Hutterer
88dfe5366d dix: drop screen argument from positionSprite
We can just get this in the function, no effective functional changes.

Also return the screen to the caller. Though we don't use it yet, we will in
a follow-up patch.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-10-11 12:06:50 +10:00
Peter Hutterer
967bc25da2 dix: move screen- to device coordinate scaling to separate function
No functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-10-11 12:06:48 +10:00
Peter Hutterer
b059e06e19 dix: don't allow keyboard devices to submit motion or button events.
GPE unconditionally dereferences pDev->valuator if a mask is present. This
shouldn't really happen but if it does, don't crash, just ignore the events
with an error.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-10-11 12:06:42 +10:00
Peter Hutterer
bccff53318 dix: moveRelative modifies parameter in-place, say so.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-10-11 12:06:38 +10:00
Peter Hutterer
b966362ccf dix: rename moveAbsolute to clipAbsolute
Let's be honest about what it does.

moveRelative accumulates delta _and_ clips in some cases, so that one can
keep it's name.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-10-11 12:06:34 +10:00
Peter Hutterer
959d18c376 dix: fix missing verb in comment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-10-11 12:06:29 +10:00
Peter Hutterer
7074ec87bd dix: document transformAbsolute
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-10-11 12:06:27 +10:00
Peter Hutterer
f4ca19ce3a dix: copy the source ID into the RawEvent (#34240)
X.Org Bug 34240 <http://bugs.freedesktop.org/show_bug.cgi?id=34240>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-10-10 10:49:10 +10:00
Max Schwarz
765ef69295 dix: fix inverted handling of legacy scroll button events
This bug led to inverted scrolling axes with drivers that support smooth
scrolling axes but send legacy button events.

Signed-off-by: Max Schwarz <Max@x-quadraht.de>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-10-06 10:55:16 +10:00
Alan Hourihane
7a33c5b934 dixfonts: Don't overwrite local c variable until new_closure is safely initialized.
Signed-off-by: Alan Hourihane <alanh@vmware.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-10-04 19:43:52 -07:00
Peter Hutterer
911e7368bf Move pointOnScreen to inpututils.c
We need this from other files too.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-10-04 13:01:33 +10:00
Peter Hutterer
d0a7cd759d dix: NewCurrentScreen must work on pointers where possible
When a screen switch is triggered by PointerKeys, the device for
NewCurrentScreen is the keyboard. Submitting pointer events for this
keyboard (without valuators) has no effect as GPE ignores the event.

Force the dequeuing through the XTest device attached to this device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-10-04 13:00:26 +10:00
Peter Hutterer
535b3789be dix: warn about keyboard events with valuator masks
We don't actually handle the mask correctly. They're clipped and dropped
into the event but that's about it. I don't think we did since 1.4, let's
warn the user if this happens.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-10-04 13:00:23 +10:00
Peter Hutterer
9537afb13f dix: fill out root_x/y for keyboard events
Switching screens relies on rootx/y to be set to the correct value. Note:
though we technically take a mask for GetKeyboardEvents we don't actually
handle it properly to move the pointer as required (and generate motion
events if needed).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-10-04 13:00:21 +10:00
Keith Packard
9a55b3661b Merge remote-tracking branch 'alanc/master' 2011-10-03 11:49:23 -07:00
Max Schwarz
f32c827d51 Input: Fix frac calculation on [Raw]DeviceEvent conversion
(1UL << 32) evaluates to 0 (at least here), so do the
fraction calculation in two steps as in libXi. Fractions on xXIRawEvent
were not multiplied at all, which also gave 0 as result.

Signed-off-by: Max Schwarz <Max@x-quadraht.de>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-30 09:25:03 +10:00
Peter Hutterer
4c6bc0e765 Merge branch 'smooth-scrolling' into next 2011-09-30 09:24:56 +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
057cc92ebf Merge branch 'raw-events' into next
Conflicts:
	configure.ac
	dix/events.c
2011-09-29 14:18:35 +10:00
Peter Hutterer
52c9b59a9f dix: use 'rc' for return code in DeliverRawEvent
Reported-by: Walter Harms <wharms@bfs.de>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Cyril Brulebois <kibi@debian.org>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-09-29 14:09:41 +10:00
Peter Hutterer
b6b1f1b514 input: deliver raw events unconditionally for XI 2.1 clients.
Deliver raw events regardless whether there is a grab on or not for clients
supporting 2.1 or later.

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-09-29 14:09:41 +10:00
Peter Hutterer
54e05d80a1 dix: rename ProcessRawEvents to dix/events.c:DeliverRawEvent
No functional changes, prep work for future changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Cyril Brulebois <kibi@debian.org>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-09-29 14:09:40 +10:00
Peter Hutterer
ac0850e86f dix: split DeliverEventToWindowMask up a bit more.
Move out the actual event delivery, it needs to be used from elsewhere.

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-09-29 14:09:40 +10:00
Peter Hutterer
5ea2fb389f dix: rename DeliverEventsToClients to DeliverEventsToWindowMask
To avoid confusion with a future patch and it better describes what this
does anyway - delivering events to all clients that have the event mask on
the window.

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-09-29 14:09:40 +10:00
Peter Hutterer
016413dae9 dix: split client list retrieval out of DeliverEventToClients
No functional change, but "other" was renamed to "clients".

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-09-29 14:09:40 +10:00
Daniel Stone
5ac1f885f5 Input: Add POINTER_EMULATED flag to GetPointerEvents
POINTER_EMULATED merely sets XIPointerEmulated in the generated
DeviceEvent.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-29 12:26:43 +10:00
Daniel Stone
d8e42decba Input: Split GetPointerEvents body into a helper function
For smooth-scrolling support, we want GetPointerEvents to generate
multiple events, so split the body of the function out into a helper
function in order to call it multiple times.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-29 12:26:43 +10:00
Daniel Stone
bc8aad2376 Input: Set last valuators in GetPointerEvents only
Previously, various pieces of code, including acceleration, used to drop
the values into DeviceIntRec::last.valuators.  Remove all this and only
do it in GetPointerEvents after all transformation, acceleration and
clipping, so we're guaranteed to always have the correct values.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-29 12:26:42 +10:00
Daniel Stone
94c19a0a72 Input: Convert DeviceIntRec::last to use doubles
Change the last real user of a split integer/fractional co-ordinate
system, DeviceIntRec's last->{valuators,remainder} to just have one set
of doubles.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-29 12:26:34 +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
3b7fb0f68d Input: Modify mask in-place in positionSprite
Instead of taking pointers to x and y values to modify in
positionSprite, just modify the mask (as well as dev->last) in place.

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
629a575261 Input: Convert positionSprite and GetPointerEvents to double
Use doubles internally in both of these functions, eliminating most of
the remaining int co-ordinate usage.

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
51437995a5 Input: Don't call positionSprite for non-pointer devices
If the device doesn't have any valuators, or if it has less than two of
them, don't bother calling positionSprite.  Users with one-dimensional
pointing devices may be upset.

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
4c364a312d Input: Convert rescaleValuatorAxis to double
Instead of passing fractional pointers around everywhere, just pass
doubles instead.  Much easier.

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
5680fa41ea Input: Remove x and y from moveAbsolute/moveRelative
Both these functions modify the mask and
pDev->last.{valuators,remainder} in-place now, so there's no need to
pass in pointers to local x and y values.

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
0882b788da Input: Convert acceleration code to using ValuatorMask
Instead of passing a set of int* to the acceleration code, pass it a
mask instead, which avoids an unfortunate loss of precision.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
2011-09-29 12:24:34 +10:00
Daniel Stone
2b8f1d07bd Input: Widen pointer acceleration types to double
This widens almost all of the float-using code in ptrveloc.[ch] to
doubles, other than values coming from properties which are specified to
be floats by the property API.

Bumps input API to v14 as this changes the AccelScheme signature, as
used by xf86-input-synaptics.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2011-09-29 12:24:33 +10:00
Daniel Stone
8a4a4e1b8a Input: Use trunc instead of lrintf in acceleration code
For compatibility with all the rest of the input code.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
2011-09-29 12:23:52 +10:00
Daniel Stone
e1df51421b Input: Set fractional member in set_raw_valuators
RawDeviceEvents have space for fractional valuator members, so might as
well start using them.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-29 12:23:51 +10:00
Daniel Stone
cdf202250e Input: Convert transformAbsolute to work on doubles
Change transformAbsolute to use doubles internally.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-29 12:23:51 +10:00
Daniel Stone
3463078f96 Input: Convert clipAxis, moveAbsolute and moveRelative to double
Change all these three to use doubles internally, though the outputs of
moveAbsolute and moveRelative are still truncated to int.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2011-09-29 12:23:51 +10:00
Daniel Stone
4e52cc0ef4 Input: Prepare moveRelative for conversion to double
Shuffle some code around in moveRelative to make the conversion to
double easier later.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-29 12:23:51 +10:00
Daniel Stone
80fdf9ca33 Input: Prepare moveAbsolute for conversion to double
Shuffle some code around to make moving to double easier later.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-29 12:23:51 +10:00
Daniel Stone
6a6b4eb05c Input: Store clipped absolute axes in the mask
Change moveAbsolute to be more symmetric with moveRelative by storing a
clipped axis value back in the mask, rather than just in
dev->last.valuators.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-29 12:23:51 +10:00
Daniel Stone
7e919ef5bf Input: Add double-precision valuator_mask API
Add API for valuator_mask that accepts and returns doubles, rather than
ints.  No double API is provided for set_range at the moment.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-29 12:23:51 +10:00
Daniel Stone
79d4deb76d Input: Convert ValuatorMask to double-precision internally
Switch the ValuatorMask struct to using doubles instead of ints for the
actual values.  Preserve the old int API, and (attempt to) round towards
zero for values we return.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-29 12:23:51 +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
Keith Packard
afb1fe695d Merge remote-tracking branch 'whot/next' 2011-09-26 20:24:15 -07:00
Sam Spilsbury
2d2dce558d Remove the SendEvent bit (0x80) before doing range checks on event type.
Some extension libraries may set this bit before converting the event to
wire protocol and as such range checking the event will cause an invalid
BadValue error to result. As the documentation suggests the the bit
should be "forced on", remove it before doing range checks and continue
to force it on in the server.

Reviewed-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-27 11:57:17 +10:00
Gaetan Nadon
84bb0207f6 dix and os: gitignore dix.O and os.O
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-09-23 17:14:47 -07:00
Keith Packard
7fb4bef039 Merge remote-tracking branch 'mattst88/for-keith' 2011-09-21 14:34:27 -07:00
Keith Packard
98f4940093 Merge remote-tracking branch 'alanc/master' 2011-09-21 14:30:19 -07:00
Matt Turner
54770c980c Cast char* buffers to swap functions
Reviewed-by: Peter Harris <pharris@opentext.com>
Signed-off-by: Matt Turner <mattst88@gmail.com>
2011-09-21 17:14:44 -04: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