summaryrefslogtreecommitdiff
path: root/dix
AgeCommit message (Collapse)AuthorFilesLines
2011-11-23Fix gcc -Wwrite-strings warnings in various extensionsAlan Coopersmith2-5/+5
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23Convert some malloc + strncpy pairs into strndup callsAlan Coopersmith1-5/+2
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-09input: replace remaining GetPairedDevice() with GetMaster()Peter Hutterer2-20/+13
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-09dix: Don't let a driver without a ProximityClassRec post eventsPeter Hutterer1-1/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-02Merge remote-tracking branch 'whot/two-screen-coordinates'Keith Packard4-42/+136
2011-10-31dix: Reinstate GetImage window size checkAaron Plattner1-0/+8
Commit 587c3a2d1961834558193e8e14e8e381a077a253 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-31dix: block signals when closing all devicesPeter Hutterer1-0/+4
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-25Use new FP1616/FP3232 conversion functionsPeter Hutterer1-10/+4
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-10-25dix: accept a NULL master for CreateClassesChangedEventPeter Hutterer1-1/+1
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-25dix: pass the flags into the CreateClassesChangedEventPeter Hutterer1-4/+3
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-25dix: drop unused argument from XISendDeviceChangedEventPeter Hutterer1-1/+1
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-25dix: add ScrollInfo to DeviceChangedEventsPeter Hutterer2-0/+54
3304bbff9b4ed63f1a47410a5320a136420ba2c6 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-25dix: move #if statement to stop compiler warningPeter Hutterer1-2/+2
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-25input: switch InputOption to use XF86OptionRec storage.Peter Hutterer1-16/+18
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-19Merge remote-tracking branch 'whot/for-keith'Keith Packard2-9/+59
2011-10-18dix: mark motion events as emulated if we're scrolling from button pressPeter Hutterer1-9/+23
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-18dix: add valuator_mask_fetch_double()Peter Hutterer1-0/+36
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-17Merge remote-tracking branch 'jeremyhu/master'Keith Packard1-0/+63
2011-10-17Merge remote-tracking branch 'whot/next'Keith Packard4-73/+129
2011-10-15dix: add utility functions for double to/fro FP1616/FP3232 conversionJeremy Huddleston1-0/+63
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-13input: change pointer screen crossing behaviour for multiple ScreenRecsPeter Hutterer2-31/+99
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-13dix: extend rescaleValuatorAxis to take a minimum defaultPeter Hutterer1-15/+15
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-13Store desktop dimensions in screenInfo.Peter Hutterer2-0/+26
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-11dix: move MD last.valuator update into fill_pointer_eventsPeter Hutterer1-6/+7
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-11mi: switch miPointerSetPosition to take doublesPeter Hutterer1-15/+12
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-11mi: return the screen from miPointerSetPositionPeter Hutterer1-2/+1
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-11dix: drop screen argument from positionSpritePeter Hutterer1-6/+7
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-11dix: move screen- to device coordinate scaling to separate functionPeter Hutterer1-18/+32
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-11dix: don't allow keyboard devices to submit motion or button events.Peter Hutterer1-0/+10
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-11dix: moveRelative modifies parameter in-place, say so.Peter Hutterer1-1/+1
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-11dix: rename moveAbsolute to clipAbsolutePeter Hutterer1-2/+2
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-11dix: fix missing verb in commentPeter Hutterer1-2/+3
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-11dix: document transformAbsolutePeter Hutterer1-0/+8
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-10dix: copy the source ID into the RawEvent (#34240)Peter Hutterer1-0/+1
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-06dix: fix inverted handling of legacy scroll button eventsMax Schwarz1-4/+5
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-04dixfonts: Don't overwrite local c variable until new_closure is safely ↵Alan Hourihane1-15/+15
initialized. Signed-off-by: Alan Hourihane <alanh@vmware.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-10-04Move pointOnScreen to inpututils.cPeter Hutterer2-9/+10
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-04dix: NewCurrentScreen must work on pointers where possiblePeter Hutterer1-5/+9
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-04dix: warn about keyboard events with valuator masksPeter Hutterer1-0/+5
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-04dix: fill out root_x/y for keyboard eventsPeter Hutterer1-4/+17
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-03Merge remote-tracking branch 'alanc/master'Keith Packard1-0/+1
2011-09-30Input: Fix frac calculation on [Raw]DeviceEvent conversionMax Schwarz1-4/+6
(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-30Merge branch 'smooth-scrolling' into nextPeter Hutterer5-410/+531
2011-09-30Input: Add smooth-scrolling support to GetPointerEventsPeter Hutterer2-4/+178
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-29Merge branch 'raw-events' into nextPeter Hutterer1-16/+76
Conflicts: configure.ac dix/events.c
2011-09-29dix: use 'rc' for return code in DeliverRawEventPeter Hutterer1-4/+4
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-29input: deliver raw events unconditionally for XI 2.1 clients.Peter Hutterer1-16/+77
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-29dix: rename ProcessRawEvents to dix/events.c:DeliverRawEventPeter Hutterer1-0/+29
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-29dix: split DeliverEventToWindowMask up a bit more.Peter Hutterer1-19/+33
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-29dix: rename DeliverEventsToClients to DeliverEventsToWindowMaskPeter Hutterer1-5/+5
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>