summaryrefslogtreecommitdiff
path: root/dix/enterleave.c
AgeCommit message (Collapse)AuthorFilesLines
2016-06-01dix: Don't update current time in the middle of input event processingKeith Packard1-1/+0
In patch 137ac094e7ab8c871f3b36e40ad826ac797f0e26, Adam moved an expensive call to UpdateCurrentTime out of the main dispatch loop. That's a good change as the original fix from Chase was a bit expensive. However, it breaks grab processing and so a couple of the calls to UpdateCurrenTime need to be removed. Input event processing can generate a stream of events; a button press that activates a grab will send a press followed by a sequence of enter/leave events. All of these should have the same time stamp on the wire as they occur at the 'same' time. More importantly, the grab time recorded in the device is pulled from currentTime after all of the events are delivered, so if currentTime doesn't match the time in the device event, then future grab modifications will fail as the time marked in the device will be 'later' than the grab time known to the client (which is defined as the timestamp from the activating input event). A bit of history here -- it used to be that currentTime was driven *entirely* by input events; those timestamps didn't even have to be related to the system time in any way. Then we started doing ICCCM stuff and people got confused when PropertyNotify events would have the same timestamp even when delivered minutes apart because no input events were delivered. We added code in the server to go update the time, but only if no input events were pending (so that the clock "wouldn't" go backwards). The only places where this is necessary is in request processing which may generate an event with a timestamp, and there only at the very top of the request processing code so that the whole request would be processed at the 'same time', just like events. cc: Chase Douglas <chase.douglas@canonical.com> cc: Peter Hutterer <peter.hutterer@who-t.net> cc: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com> Tested-by: Michel Dänzer <michel.daenzer@amd.com> Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-05-16Input: Send XI2 FocusOut NotifyPointer events to the pointer window.Andrew Comminos1-4/+16
This changes XInput 2's propagation of NotifyPointer focus out events to include the pointer window as well, similar to core events. This fixes a potential permanent focus in GDK when the focus moves to PointerRoot. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=93539 Signed-off-by: Andrew Comminos <andrew@comminos.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-05-04dix: Push UpdateCurrentTimeIf down out of the main loopAdam Jackson1-0/+1
This was added in: commit 312910b4e34215aaa50fc0c6092684d5878dc32f Author: Chase Douglas <chase.douglas@canonical.com> Date: Wed Apr 18 11:15:40 2012 -0700 Update currentTime in dispatch loop Unfortunately this is equivalent to calling GetTimeInMillis() once per request. In the absolute best case (as on Linux) you're only hitting the vDSO; on other platforms that's a syscall. Either way it puts a pretty hard ceiling on request throughput. Instead, push the call down to the requests that need it; basically, grab processing and event generation. Cc: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2015-07-08dix: Unexport various implementation detailsAdam Jackson1-1/+1
Acked-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Adam Jackson <ajax@redhat.com>
2015-04-21Convert dix/* to new *allocarray functionsAlan Coopersmith1-1/+1
v2: remove now useless parentheses Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
2012-11-19input: drop FP1616 macroPeter Hutterer1-2/+3
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-07-09Use C99 designated initializers in dix EventsAlan Coopersmith1-6/+8
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-09Fix more poorly indented/wrapped comments & codeAlan Coopersmith1-3/+6
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com> Tested-by: Daniel Stone <daniel@fooishbar.org>
2012-05-17dix: Move DeviceFocusEvent from Xi into enterleave.cPeter Hutterer1-0/+239
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 31174565ec0090b4c03c9334c82878be2455f938 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-03-21Introduce a consistent coding styleKeith Packard1-576/+497
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-01-06dix: on PointerRootWin send a FocusIn to the sprite window tooPeter Hutterer1-0/+3
XTS XSetDeviceFocus-7 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-01-06dix: send focus events to the immediate parent (#44079)Peter Hutterer1-3/+3
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>
2011-11-09input: replace remaining GetPairedDevice() with GetMaster()Peter Hutterer1-5/+5
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>
2010-10-13Use GetCurrentRootWindow or equivalent instead of spriteTrace[0].Jamey Sharp1-9/+4
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-07-21dix: hack around enter/leave event issues for grabbed devices (#27804)Peter Hutterer1-9/+18
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-06-03Move each screen's root-window pointer into ScreenRec.Jamey Sharp1-6/+6
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)
2009-08-03dix: call SetFocusOut and LeaveWindow when disabling a device.Peter Hutterer1-1/+1
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-03dix: SetFocusOut and LeaveWindow don't need parameters other than dev.Peter Hutterer1-4/+4
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-30dix: pass the sourceid around for enter/leave events.Peter Hutterer1-14/+18
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-30dix: remove obsolete comment, parameter described doesn't exist.Peter Hutterer1-2/+0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-10input: move inputstr.h to where its needed.Dave Airlie1-0/+1
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-05-28Xi: Send Enter or Leave events with XIPassive(Un)grabNotifyPeter Hutterer1-1/+2
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-22Input: rename DeviceIntRec->isMaster to ->type.Peter Hutterer1-2/+2
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-03-20Xi: send XI2 focus events.Peter Hutterer1-13/+13
2009-03-20dix: fix up device enter/leave for XI_Enter/XI_Leave.Peter Hutterer1-8/+9
2009-02-13dix: doxygen-ify enterleave.cPeter Hutterer1-46/+57
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-05Fix "warning: cast from pointer to integer of different size"Tomas Carnecky1-4/+4
Signed-off-by: Tomas Carnecky <tom@dbservice.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-08dix: move focus handling into enterleave.c.Peter Hutterer1-7/+793
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-08dix: add a few auxiliary functions for the updated focus model.Peter Hutterer1-0/+54
SetFocusIn and SetFocusOut, including the static array to keep all focus windows. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-08dix: reduce FirstPointerChild complexityPeter Hutterer1-54/+10
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-08dix: remove now unused "exclude" parameter from FirstPointerChildPeter Hutterer1-15/+8
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-08dix: re-implement enter/leave model.Peter Hutterer1-279/+317
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
2008-11-25dix: updated enter/leave core event model.Peter Hutterer1-1/+267
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-25dix: add FirstPointerChild, FirstPointerAncestor auxiliary functions.Peter Hutterer1-0/+100
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-25dix: Add EnterWindow, LeaveWindow, HasPointer auxiliary functions.Peter Hutterer1-0/+50
These replace the ENTER_LEAVE_SEMAPHORE_* macros. Unused currently. Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-11-25dix: split enter/leave event handling into core and device handling.Peter Hutterer1-44/+32
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-25dix: move Enter-Leave related functions into new enterleave.cPeter Hutterer1-0/+138
Preparation for the new core enter/leave model. Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>