Commit Graph

34 Commits

Author SHA1 Message Date
Adam Jackson
b51f7f8582 dix: Unexport various implementation details
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2015-07-08 16:40:57 -04:00
Alan Coopersmith
b9e665c8b2 Convert dix/* to new *allocarray functions
v2: remove now useless parentheses

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-04-21 16:57:08 -07: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
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
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
Peter Hutterer
ca6d25ad2d dix: Move DeviceFocusEvent from Xi into enterleave.c
This is only called from the enterleave implementation, so move it and its
helper functions to there. No functional changes.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-05-17 08:50:44 +10:00
Keith Packard
9838b7032e Introduce a consistent coding style
This is strictly the application of the script 'x-indent-all.sh'
from util/modular. Compared to the patch that Daniel posted in
January, I've added a few indent flags:

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

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

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

The comparison was done with this script:

dir1=$1
dir2=$2

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

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

Signed-off-by: Keith Packard <keithp@keithp.com>
Acked-by: Daniel Stone <daniel@fooishbar.org>
Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-03-21 13:54:42 -07:00
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
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
Jamey Sharp
8efa3623f3 Use GetCurrentRootWindow or equivalent instead of spriteTrace[0].
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-10-13 15:58:12 +10:00
Peter Hutterer
c54f81ba7a dix: hack around enter/leave event issues for grabbed devices (#27804)
The current core enter/leave does not cater for device grabs during
enter/leave events. If a window W contains a pointer P1 and a client grabs a
pointer P2, this pointer will not generate enter/leave events inside this
window.

Hack around this by forcing grabbed devices to always send enter/leave
events.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-07-21 08:11:27 +10:00
Jamey Sharp
e7fae9ecc4 Move each screen's root-window pointer into ScreenRec.
Many references to the WindowTable array already had the corresponding
screen pointer handy, which meant they usually looked like
"WindowTable[pScreen->myNum]". Adding a field to ScreenRec instead of
keeping this information in a parallel array simplifies those
expressions, and eliminates a MAXSCREENS-sized array.

Since dix uses this data, a screen private entry isn't appropriate.

xf86-video-dummy currently uses WindowTable, so it needs to be updated
to reflect this change.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Tested-by: Tiago Vignatti <tiago.vignatti@nokia.com> (i686 GNU/Linux)
2010-06-03 14:03:23 -07:00
Peter Hutterer
d3e5629fac dix: call SetFocusOut and LeaveWindow when disabling a device.
PointerWindows[x] would be set after removing a master pointer. Destroying
this window then crashed the server.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-03 10:11:48 +10:00
Peter Hutterer
97ed946cfc dix: SetFocusOut and LeaveWindow don't need parameters other than dev.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-03 10:11:48 +10:00
Peter Hutterer
46ac9f9241 dix: pass the sourceid around for enter/leave events.
The sourceid for enter/leave events as a result of pointer motion is the ID
of the slave device. The sourceid for those as a result of a grab activating
is the device itself.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-30 11:04:28 +10:00
Peter Hutterer
c299b2228f dix: remove obsolete comment, parameter described doesn't exist.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-30 08:43:14 +10:00
Dave Airlie
6d4ffcc9e0 input: move inputstr.h to where its needed.
This stops inputstr.h being needed to be included by output drivers.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-10 11:15:24 +10:00
Peter Hutterer
a25f248fc3 Xi: Send Enter or Leave events with XIPassive(Un)grabNotify
If a passive enter or focus in grab activates, send additional enter or
focus events with mode XIPassiveGrabNotify to the grabbing client.
Likewise, if the grab deactivates, send additional leave or focus out
events.

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

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

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

This patch replaces isMaster with "type", one of SLAVE, MASTER_POINTER and
MASTER_KEYBOARD. All checks for dev->isMaster are replaced with an
IsMaster(dev).
2009-05-22 15:44:50 +10:00
Peter Hutterer
3f37923a72 Xi: send XI2 focus events. 2009-03-20 15:17:55 +10:00
Peter Hutterer
181e41511d dix: fix up device enter/leave for XI_Enter/XI_Leave. 2009-03-20 15:17:55 +10:00
Peter Hutterer
c178c3f814 dix: doxygen-ify enterleave.c
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-13 14:41:57 +10:00
Tomas Carnecky
9a1d07ecb7 Fix "warning: cast from pointer to integer of different size"
Signed-off-by: Tomas Carnecky <tom@dbservice.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-05 14:31:29 +10:00
Peter Hutterer
eb2d7b3d70 dix: move focus handling into enterleave.c.
This commit moves the focus handling from events.c into enterleave.c and
implements a model similar to the core enter/leave model.
For a full description of the model, see:
http://lists.freedesktop.org/archives/xorg/2008-December/041740.html

This commit also gets rid of the focusinout array in the WindowRec, ditching
it in favour of a local array that keeps the current focus window for each
device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-08 11:45:22 +10:00
Peter Hutterer
673eb23aac dix: add a few auxiliary functions for the updated focus model.
SetFocusIn and SetFocusOut, including the static array to keep all focus
windows.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-08 11:45:22 +10:00
Peter Hutterer
38b28dcadd dix: reduce FirstPointerChild complexity
Instead of keeping a flag on each window for the devices that are in this
window, keep a local array that holds the current pointer window for each
device. Benefit: searching for the first descendant of a pointer is a simple
run through the array.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-08 11:45:22 +10:00
Peter Hutterer
72ad4a85cc dix: remove now unused "exclude" parameter from FirstPointerChild
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-08 11:45:22 +10:00
Peter Hutterer
0aa4460c3b dix: re-implement enter/leave model.
The old model was implemented based on a misunderstanding of NotifyVirtual and
NotifyNonlinearVirtual events. It became complicated and was broken in some
places [1]. This patch wipes this model completely.

A much simplified implementation is provided instead. Rather than a top-down
approach ("we have a tree of windows, which ones need to get which event")
this one uses a step-by-step approach. For each window W between A and B
determine the pointer window P as perceived by this window and determine the
event type based on this information. This is in-line with the model described
by Owen Taylor [2].

[1] http://lists.freedesktop.org/archives/xorg/2008-December/041559.html
[2] http://lists.freedesktop.org/archives/xorg/2008-August/037606.html
2009-01-08 11:45:22 +10:00
Peter Hutterer
b292a7a2d7 dix: updated enter/leave core event model.
As proposed by Owen Taylor [1], the enter-leave event model needs to adjust
the events sent to each window depending on the presence of pointers in a
window, or in a subwindow.

The new model can be summarised as:
- if the pointer moves into or out of a window that has a pointer in a child
  window, the events are modified to appear as if the pointer was moved out of
  or into this child window.
- if the pointer moves into or out of a window that has a pointer in a parent
  window, the events are modified to appear as if the pointer was moved out of
  or into this parent window.

Note that this model requires CoreEnterLeaveEvent and DeviceEnterLeaveEvent to
be split and treated separately.

[1] http://lists.freedesktop.org/archives/xorg/2008-August/037606.html

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-11-25 09:21:46 +10:00
Peter Hutterer
724f83b87b dix: add FirstPointerChild, FirstPointerAncestor auxiliary functions.
FirstPointerChild: Return the first child that has a pointer within its
boundaries.

FirstPointerAncestor: return the first ancestor with a child within its
boundaries.

These are required for the updated enter/leave model.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-11-25 09:21:46 +10:00
Peter Hutterer
7d3e595f93 dix: Add EnterWindow, LeaveWindow, HasPointer auxiliary functions.
These replace the ENTER_LEAVE_SEMAPHORE_* macros. Unused currently.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-11-25 09:21:45 +10:00
Peter Hutterer
6bdc963cda dix: split enter/leave event handling into core and device handling.
Device events always need to be delivered, core events only in some cases.
Let's keep them completely separate so we can adjust core event delivery.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-11-25 09:21:45 +10:00
Peter Hutterer
868fd503b7 dix: move Enter-Leave related functions into new enterleave.c
Preparation for the new core enter/leave model.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-11-25 09:21:45 +10:00