Commit Graph

517 Commits

Author SHA1 Message Date
Peter Hutterer
772e0f9159 dix: Don't set core events in SetMaskForEvent.
Rather, modify the two callers to call separately for the two different.
events. Unexport SetMaskForEvent too.
And while we're at it, get rid of the MotionFilter macro, because it's one
half confusing and one half pointless.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-16 13:28:17 +10:00
Peter Hutterer
58f3127919 Xi: remove dynamic mask assignment for XI events.
They end up being the same anyway on startup, so let's not have a dynamic mask
assignment mechanism and instead just hardcode them already.
Also unexport SelectForWindow and remove the valid_masks parameter. We can
check that before calling, since there's only one caller anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-16 13:28:17 +10:00
Peter Hutterer
9f3c5d46f8 Xi: initialize the device before applying button map changes.
This part got lost in bc909f7136.
Reported by Tomas Carnecky.

Acked-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-03 11:12:01 +10:00
Simon Thum
6bf6a4c47e Xi: create well-known atoms on demand, rather than preinit them
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-03 08:51:11 +10:00
Peter Hutterer
32adf8d34f Xi: If the MD doesn't have a key/kbdfeed class, init the keyboard.
This fixes crashes on mouse/keyboard combos where the mouse is both a keyboard
and a mouse. Upon copying the SD's key info into the VCP, the NULL xkbInfo of
the VCP would crash the server.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-03 08:51:11 +10:00
Peter Hutterer
caade11b84 Xi: remove now obsolete oldXkbInfo.
Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2009-02-03 08:51:11 +10:00
Maarten Maathuis
3903e23153 XKB: ifdef XKB is dead, yet it was still present in a few places. 2009-01-29 12:42:57 +01:00
Peter Hutterer
01ffaf6834 Xi: define a range of axis labels.
This is copied from linux/input.h, presumably that's the ones at least the
Linux kernel can give us for any device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-23 08:09:29 +11:00
Daniel Stone
b5ece46b76 Input: Clarify valuator FatalError messages
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-22 15:09:00 +11:00
Daniel Stone
ddb46c1421 Input: Use previous state in valuator events
Make valuator event state match other events by using the device state
from before processing the event, not after.  Also, we already check the
number of valuators in UpdateDeviceState, so no need to do it again.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-22 15:09:00 +11:00
Daniel Stone
c05f3bc935 Input: Don't allow DDX to generate repeat events
We always use soft-repeat at the moment; XKB posts a release/press sequence,
which admittedly needs cleaning up, but that's for another day.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-22 15:09:00 +11:00
Daniel Stone
4fa3872dc2 Input: Remove core keysyms from KeyClassRec
Instead of always keeping two copies of the keymap, only generate the
core keymap from the XKB keymap when we really need to, and use the XKB
keymap as the canonical keymap.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-22 15:08:59 +11:00
Daniel Stone
bc909f7136 Input: Centralise pointer map changing
Replace both core and Xi functions with one function that validates the
proposed map, and sends out both kinds of notification.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-22 15:08:58 +11:00
Daniel Stone
f06a9d2e05 Input: Clean up keymap change notifications
Keyboard map notifications are always generated from within XKB code,
which also takes care of copying the keysyms, etc.  If you need to
mangle the keymap yourself, generate a new core keymap/modmap, and pass
it to XkbApplyMappingChange.

SendMappingNotify is renamed to SendPointerMappingNotify (and ditto its
Device variants), which still only _sends_ the notifications, as opposed
to also doing the copying a la XkbApplyMappingChange.

Also have the modmap change code traverse the device hierachy, rather
than just going off the core keyboard.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2009-01-22 15:08:58 +11:00
Daniel Stone
1d1a0f67ee Xi: Introduce XIShouldNotify
XIShouldNotify just lets you know if you should send an event for a
keymap change (or similar) concerning a given device to a given client;
at the moment, this is only for devices which are sending events to that
client.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-22 15:08:58 +11:00
Daniel Stone
32db27a7f8 Input: Remove modifierMap from core
We already have modmap (in the exact same format!) in XKB, so just use
that all the time, instead of duplicating the information.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-22 15:08:55 +11:00
Daniel Stone
f062e90a95 Input: Remove modifierKeyMap
Since modifierKeyMap is generated from modifierMap, just remove it, and
only generate it when we need to send the modifier map to the client.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-22 15:08:55 +11:00
Daniel Stone
cf6a2fc2bd Input: Ignore modifiers in core input processing
Modifiers get cleared by the XKB code when we drop down into core input
processing, so just delete the dead code path to simplify things a bit.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-22 15:08:55 +11:00
Daniel Stone
6727ee9408 Input: Remove state from KeyClassRec
We already have state fully stored within XKB, so instead of duplicating it,
just generate the values to send to clients when required.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-22 15:08:55 +11:00
Daniel Stone
08363c5830 Input: Overhaul keyboard initialisation process
XkbInitKeyboardDeviceStruct is now the only valid keyboard
initialisation: all the details are hidden behind here.  This now makes
it impossible to supply a core keymap at startup.

If dev->key is valid, dev->key->xkbInfo->desc is also valid.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-22 15:08:51 +11:00
Daniel Stone
40877c6680 XKB: Make XKB mandatory
No more #ifdef XKB, because you can't disable the build, and no more
noXkbExtension either.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-22 15:06:25 +11:00
Daniel Stone
07c3bb922b XKB: Move XkbCopyKeymap definition to xkbsrv.h
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-20 15:32:18 +11:00
Peter Hutterer
58a6b5b9ef Xi: don't care about CoreDevicePrivateKey when copying keys
If we get here, we must copy.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2009-01-20 15:32:18 +11:00
Thomas Jaeger
717a961528 Don't release grabs unless all buttons are up
Previously, only buttons <= 5 would count here, but the core protocol
allows for 255 buttons.

http://lists.freedesktop.org/archives/xorg/2009-January/042092.html

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-16 11:46:26 +10:00
Thomas Jaeger
f7f85f6965 Count the number of logically down buttons in buttonsDown
This fixes the following bug.  Assuming your window manager grabs
Alt+Button1 to move windows, map Button3 to 0 via XSetPointerMapping,
then press the physical button 3 (this shouldn't have any effect), press
Alt and then button 1.  The press event is delivered to the application
instead of firing the grab.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-16 10:43:53 +10:00
Simon Thum
19275ea8e9 dix: add property support for pointer acceleration.
Note: properties don't need to be cleaned up, the DIX does it for us anyway.
Data that is stored in properties is cleaned up by the property system.
Handlers, etc. don't need to be unregistered while cleaning up, as they get
deleted when the device is removed anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
Signed-off-by: Simon Thum <simon.thum@gmx.de>
2009-01-15 09:28:55 +10:00
Peter Hutterer
a48c81dcdf Xi: add XATOM_FLOAT to server-defined properties.
This property is used to denote type float for input properties. Such
properties can be accessed easily through the XIPropToFloat() function.

Code originally written by Simon Thum.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2009-01-12 12:55:27 +10:00
Peter Hutterer
669f6810af Xi: add XIPropToInt() auxiliary function.
Converts an XIPropertyValuePtr to an integer, provided that type and format is
right.

Code originally written by Simon Thum.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2009-01-12 12:55:27 +10:00
Julien Cristau
e64473b14e Xi: fix missing declaration of XkbSetRulesDflts 2009-01-11 08:54:10 +01:00
Peter Hutterer
9bf77569cc Xi: call CheckMotion for floating SDs too.
CheckMotion updates the sprite position so we need to call it for all devices
that have a sprite - including floating SDs (which have an invisible sprite).
2009-01-09 16:09:20 +10:00
Christian Beier
f8ecc2f08f Xi: fix typo in WarpDevicePointer handling.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-08 11:45:22 +10:00
Peter Hutterer
aeff14d5f2 dix: don't alloc in ChangeMasterDeviceClasses.
We mustn't realloc as we are inside a signal handler. With
SetMinimumEventSize, this code should never be hit anyway, as the event list
should have the required memory before this code is hit.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-12-12 11:43:32 +10:00
Peter Hutterer
fb2a8d0e59 Xi: silence compiler warning
Don't mix declarations and statements.
2008-12-12 11:43:32 +10:00
Peter Hutterer
cb95642dc8 Remove #define NEED_EVENTS and NEED_REPLIES
A grep on xorg/* revealed there's no consumer of this define.

Quote Alan Coopersmith:
"The consumer was in past versions of the headers now located
in proto/x11proto - for instance, in X11R6.0's xc/include/Xproto.h,
all the event definitions were only available if NEED_EVENTS were
defined, and all the reply definitions required NEED_REPLIES.

Looks like Xproto.h dropped them by X11R6.3, which didn't have
the #ifdef's anymore, so these are truly ancient now."

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2008-12-12 11:43:32 +10:00
Tom Jaeger
78a62d7713 Xi: XIGetDevice needs to ignore the MORE_EVENTS flag.
Reported in X.Org Bug 18882, Comment 5.
<http://bugs.freedesktop.org/show_bug.cgi?id=18882>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2008-12-08 12:05:54 +10:00
Peter Hutterer
fd2d40b7ec Xi: change XIUnRegisterPropertyHandler to XIUnregisterPropertyHandler
CamelCase can be taken too far, and AFAICT there's no consumers of that
function yet anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-12-03 20:25:15 +10:00
Paulo Cesar Pereira de Andrade
49f77fff14 Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.

  This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)

  LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.

  xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 05:43:34 -02:00
Peter Hutterer
9c5dd7337f Let the DDX decide on the XkbRulesDefaults.
Rather than assuming rules in the CoreKeyboardProc, init the default rules in
InitCoreDevices, then re-use them later.

In the xfree86 DDX, set the rules to "base" or "evdev", depending on whether
we'll load kbd or evdev.

If we create a new MD, use pc105,us as default and re-use the rules file used
previously.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-12-03 16:10:40 +10:00
Peter Hutterer
9bf761468f Xi: fix xi_filters size. 2008-12-02 15:50:38 +10:00
Peter Hutterer
a85f0d6b98 Xi: fix use of button->down - bitflags instead of int arrays.
The device's button down state array was changed to use DOWN_LENGTH and thus
bitflags for each button in cfcb3da7.

Update the DBSN events to copy this bit-wise state.
Update xkb and Xi to check for the bit flag instead of the array value.

Reported by ajax.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-12-02 15:50:37 +10:00
Paulo Cesar Pereira de Andrade
d6cbd4511e Export symbols defined in the sdk.
This is the biggest "visibility" patch. Instead of doing a "export"
symbol on demand, export everything in the sdk, so that if some module
fails due to an unresolved symbol, it is because it is using a symbol
not in the sdk.

  Most exported symbols shouldn't really be made visible, neither
advertised in the sdk, as they are only used by a single shared object.

  Symbols in the sdk (or referenced in sdk macros), but not defined
anywhere include:
XkbBuildCoreState()
XkbInitialMap
XkbXIUnsupported
XkbCheckActionVMods()
XkbSendCompatNotify()
XkbDDXFakePointerButton()
XkbDDXApplyConfig()
_XkbStrCaseCmp()
_XkbErrMessages[]
_XkbErrCode
_XkbErrLocation
_XkbErrData
XkbAccessXDetailText()
XkbNKNDetailMaskText()
XkbLookupGroupAndLevel()
XkbInitAtoms()
XkbGetOrderedDrawables()
XkbFreeOrderedDrawables()
XkbConvertXkbComponents()
XkbWriteXKBSemantics()
XkbWriteXKBLayout()
XkbWriteXKBKeymap()
XkbWriteXKBFile()
XkbWriteCFile()
XkbWriteXKMFile()
XkbWriteToServer()
XkbMergeFile()
XkmFindTOCEntry()
XkmReadFileSection()
XkmReadFileSectionName()
InitExtInput()
xf86CheckButton()
xf86SwitchCoreDevice()
RamDacSetGamma()
RamDacRestoreDACValues()
xf86Bpp
xf86ConfigPix24
xf86MouseCflags[]
xf86SupportedMouseTypes[]
xf86NumMouseTypes
xf86ChangeBusIndex()
xf86EntityEnter()
xf86EntityLeave()
xf86WrapperInit()
xf86RingBell()
xf86findOptionBoolean()
xf86debugListOptions()
LoadSubModuleLocal()
LoaderSymbolLocal()
getInt10Rec()
xf86CurrentScreen
xf86ReallocatePciResources()
xf86NewSerialNumber()
xf86RandRSetInitialMode()
fbCompositeSolidMask_nx1xn
fbCompositeSolidMask_nx8888x0565C
fbCompositeSolidMask_nx8888x8888C
fbCompositeSolidMask_nx8x0565
fbCompositeSolidMask_nx8x0888
fbCompositeSolidMask_nx8x8888
fbCompositeSrc_0565x0565
fbCompositeSrc_8888x0565
fbCompositeSrc_8888x0888
fbCompositeSrc_8888x8888
fbCompositeSrcAdd_1000x1000
fbCompositeSrcAdd_8000x8000
fbCompositeSrcAdd_8888x8888
fbGeneration
fbIn
fbOver
fbOver24
fbOverlayGeneration
fbRasterizeEdges
fbRestoreAreas
fbSaveAreas
composeFunctions
VBEBuildVbeModeList()
VBECalcVbeModeIndex()
TIramdac3030CalculateMNPForClock()
shadowBufPtr
shadowFindBuf()
miRRGetScreenInfo()
RRSetScreenConfig()
RRModePruneUnused()
PixmanImageFromPicture()
extern int miPointerGetMotionEvents()
miClipPicture()
miRasterizeTriangle()
fbPush1toN()
fbInitializeBackingStore()
ddxBeforeReset()
SetupSprite()
InitSprite()
DGADeliverEvent()

  SPECIAL CASES
o defined as _X_INTERNAL
	xf86NewInputDevice()
o defined as static
	fbGCPrivateKey
	fbOverlayScreenPrivateKey
	fbScreenPrivateKey
	fbWinPrivateKey
o defined in libXfont.so, but declared in xorg/dixfont.h
	GetGlyphs()
	QueryGlyphExtents()
	QueryTextExtents()
	ParseGlyphCachingMode()
	InitGlyphCaching()
	SetGlyphCachingMode()
2008-11-29 23:56:06 -02:00
Peter Hutterer
de1a8b68eb xkb: extract the correct device in XkbFilterEvents.
If the event is an XI event, we need to work on the correct device, not on
the VCK.

Adds XIGetDevice(event) function to extract the device from an event.
2008-11-04 16:04:16 +10:30
Peter Hutterer
d972399566 Purge device-based WindowAccess code.
Really, this was a bad idea. It's not security, the UI features that would
have been cool (e.g. clicking through windows) aren't implemented anyway, and
there's nothing you can't achieve just by using plain XI anyway.

Requires inputproto 1.9.99.6.
2008-11-04 16:04:15 +10:30
Peter Hutterer
b6b26560d6 Move EXTENSION_BASE and EXTENSION_EVENT_BASE to misc.h. 2008-10-31 17:09:13 +10:30
Peter Hutterer
f781a752e6 Move MAX_DEVICES to misc.h, rename to MAXDEVICES for consistency. 2008-10-31 17:09:13 +10:30
Julien Cristau
add946daed Nuke unused variables 2008-10-26 11:44:10 +01:00
Peter Hutterer
f3f6ea89aa Xi: check all handlers before applying property changes.
The current code exposes to inconsistent updates, i.e. if handler N succeeds
but handler N+1 fails in setting the property, an error is returned to the
client although parts of the server now behave as if the property change
succeeded.

This patch adds a "checkonly" parameter to the SetProperty handler. The
handlers are then called twice, once with checkonly set to TRUE.
On the checkonly run, handlers _MUST_ return error codes if the property
cannot be applied. Handlers are not permitted to actually apply the changes.
On the second run, handlers are permitted to apply property changes.
Errors codes returned on the second run are ignored.
2008-10-13 13:50:40 +10:30
Peter Hutterer
4808bdec45 Xi: don't memcpy the KeyClassRec from SD to MD. #16167
Most of its component get copied during CopyKeyClass anyway.
The ones that aren't:
  postdown - never changed for virtual devices anyway.
  down - shouldn't change that without sending events.

memcpy'ing the struct also copied mapWidth, which means we didn't realloc
during SetKeySymsMap lateron, overwriting the memory assigned to us.

X.Org Bug 16167 <http://bugs.freedesktop.org/show_bug.cgi?id=16167>
2008-10-10 16:58:08 +10:30
Adam Jackson
c6d6d3e87a Loader: Unexport a handful of consumerless symbols from dixsym. 2008-10-06 16:18:21 -04:00
Adam Jackson
0b7b89fbac xalloc+bzero -> xcalloc 2008-10-06 14:19:30 -04:00
Peter Hutterer
fbd09486c6 Push server-known properties into xserver-properties.h. 2008-09-26 13:32:11 +09:30
Peter Hutterer
a2d83b9dc8 Xi: add "deletable" flag to properties, add DeleteProperty handler.
A property can only be deleted if any of the following is true:
- if a property is deletable and all handlers return Success.
- if a property is non-deleteable and the all handlers return Success AND the
  delete request does not come from a client (i.e. driver or the server).

A client can never delete a non-deletable property.
2008-09-26 13:32:08 +09:30
Peter Hutterer
22e9047268 Xi: allow Set/GetProperties to return a status, and honour this status code.
If a property handler now bails out, return the error code to the caller. This
allows to be slightly more specific with the errors.
2008-09-26 13:32:07 +09:30
Peter Hutterer
1e24e7b9df Xi: remove configure/query device property calls.
This removes all the meta-information about device properties (pending,
fromClient, range, valid_values, immutable).
2008-09-26 13:32:05 +09:30
Peter Hutterer
cc20112a65 Xi: don't include client-side headers.
Spotted by Mikhail Gusarov.
2008-09-19 08:45:43 +09:30
Peter Hutterer
f789408f7d Xi: remove broken SDeviceEnterNotifyEvent, replace with ...Leave...
The event format is the same for both (bar the type), so one is enough.
2008-09-18 13:32:57 +09:30
Tomas Carnecky
ebea78cdba Prepare for array-index based devPrivates.
TODO: static indices can be made just an int; some indices
can be combined.
2008-08-28 18:05:40 -04:00
Peter Hutterer
95b466e457 Xi: don't include .c files. 2008-08-22 21:38:01 +09:30
Peter Hutterer
c696da75c7 Xi: swap devices property replies. 2008-08-22 21:38:01 +09:30
Peter Hutterer
de1573172a Backport device properties to XI 1.5 instead of XI 2.0 2008-08-15 14:52:13 +09:30
Peter Hutterer
e6813e8de6 Xi: byte-swap device property requests. 2008-08-14 15:01:18 +09:30
Peter Hutterer
139c3ab7b7 Xi: return the state from the correct keyboard in QueryDevicePointer. 2008-08-12 20:42:08 +09:30
Peter Hutterer
591ef3c047 Xi: ChangeDeviceControl presence events should set the appropriate devchange.
Requires inputproto 1.4.4 or higher.
2008-07-29 10:00:01 +09:30
Adam Jackson
d6228cb22a Shape extension is built-in and mandatory. 2008-07-24 15:46:08 -04:00
Peter Hutterer
5bcc45e07e Xi: expose Enable/DisableDevice through XI_PROP_ENABLED property. 2008-07-13 20:54:33 +09:30
Peter Hutterer
e7abe1676a Xi: protect against NULL handlers, don't try to dereference. 2008-07-13 20:54:33 +09:30
Peter Hutterer
2bbb12c355 Xi: remove ChangeDeviceControl for CoreCtl.
If you want to set a device to core, attach it to a master device.
2008-07-13 20:54:33 +09:30
Peter Hutterer
18ff17756c Xi: GetDeviceProperty reply includes deviceid. 2008-07-13 20:54:33 +09:30
Peter Hutterer
e4054e5cb3 Xi: pack the property stuff into a struct, make handlers a linked list.
We may need more than one handler to deal with a property (e.g. one in the
driver, one in the DIX), so get the handlers into a linked list and call them
one-by-one. This is of course slightly less entertaining than the hilarious
WRAP/UNWRAP game we play in other parts of the server.

XIRegisterPropertyHandler/XIUnregisterPropertyHandler are the interface
drivers/the DIX should use to attach themselves to the device.

XIDeleteAllDeviceProperties destroys everything, including the handlers.
2008-07-10 16:28:44 +09:30
Peter Hutterer
2039c6ea43 Xi: add support for input device properties.
Basically just copied from randr properties, with minor changes only.
Each device supports arbitrary properties that can be modified by clients.
Modifications to the properties are passed to the driver (if applicable) and
can then affect the configuration of the device.

Note that device properties are limited to a specific device. A property set
on a slave device does not migrate to the master.
2008-07-10 16:28:34 +09:30
Peter Hutterer
4ab01fe5db Revert "Xi: add support for input device properties."
Note to self: don't mix up branches with half-finished cherrypicks.

This reverts commit 666838fcc8.
2008-07-10 16:27:36 +09:30
Peter Hutterer
666838fcc8 Xi: add support for input device properties.
Basically just copied from randr properties, with minor changes only.
Each device supports arbitrary properties that can be modified by clients.
Modifications to the properties are passed to the driver (if applicable) and
can then affect the configuration of the device.

Note that device properties are limited to a specific device. A property set
on a slave device does not migrate to the master.
2008-07-10 16:02:55 +09:30
Peter Hutterer
acce270935 Xext: store the GenericMasks in the resource system.
This fixes a severe issue - when the client died the event mask didn't get
unregistered and a future event would dereference dangling pointers. By
storing the event masks in the resource system we can free them when the
client dies.
2008-07-10 16:02:55 +09:30
Peter Hutterer
15e4b6c574 input: for non-device events (e.g. DevicePresence) use MAX_DEVICES as id.
Using id = 0 only worked pre-MPX since XInput didn't allow XOpenDevice for the
core devices (0 and 1). Now we can now legally register for events so we may
overwrite our device-independent classes with the ones selected for the VCP.

So, increase the EMASKSIZE to MAX_DEVICES + 1 and use MAX_DEVICES as the ID
when we don't have a device.
2008-06-26 12:53:05 +09:30
Keith Packard
cfcb3da75e Make button down state a bitmask. Master buttons track union of slave buttons
Mixing usage where some parts of the code treated this field as a bitmask
and other parts as an array of card8 was wrong, and as the wire protocol
wanted bitmasks, it was less invasive to switch the newer counting code use
booleans.

Master devices track slave buttons by waiting for all slave buttons to be
released before delivering the release event to the client.

This also removes the state merging code in DeepCopyDeviceClasses -- that
code was changing master device state without delivering any events,
violating protocol invariants. The result will be that existing slave
button state which does not match the master will not be visible through the
master device. Fixing this would require that we synthesize events in this
function, which seems like a bad idea. Note that keyboards have the same
issue.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter@cs.unisa.edu.au>
2008-06-19 17:41:00 +09:30
Peter Hutterer
d21155a3e9 input: fix up usage of button->down, used to be a bitmask, is now an array.
device->button->down used to be a 32-byte bitmask with one bit for each
button. This has changed into a 256-byte array, with one byte assigned for
each button. Some of the callers were still using this array as a bitmask
however, this is fixed with this patch.

Thanks to Keith Packard for pointing this out. See also:
http://lists.freedesktop.org/archives/xorg/2008-June/036202.html
2008-06-18 10:17:08 +09:30
Peter Hutterer
2b9c829bde Xi: don't drop the grab status in XExtendedGrabDevice(). 2008-06-18 10:07:37 +09:30
Keith Packard
8c9234a163 Xi: avoid double button mapping.
Button events were mapped once in GetPointerEvents and then again in
UpdateDeviceState. While it might make sense to just fix up UpdateDeviceState,
it turns out to be better to leave the raw button number in the event because
DGA reports raw device events without button translation, and so when it calls
UpdateDeviceState, the button down counts get scrambled and buttons get stuck
down.

See also:
http://lists.freedesktop.org/archives/xorg/2008-June/036201.html

Signed-off-by: Peter Hutterer <peter@cs.unisa.edu.au>
2008-06-15 11:47:24 +09:30
Eamon Walsh
61dafe384a Fix "warning: unused variable `tsize'". 2008-06-13 22:47:10 -04:00
Eamon Walsh
37a64b02df Fix "warning: ‘rc’ may be used uninitialized in this function". 2008-06-13 22:46:51 -04:00
Peter Hutterer
5fe57787fa dix: store the absolute values in the motion history.
The core protocol requires absolute values and it's a bit hard to get them if
we only have relative ones in the history. Switch the motion history to
absolute, and if we really need the relative values, we can probably generated
them from the abs. ones in the future.
2008-05-26 17:27:32 +09:30
Peter Hutterer
1883485edd If core motion history is required, scale back to screen coords and INT16. 2008-05-26 17:22:25 +09:30
Peter Hutterer
0b88510069 Ensure the motion history is merged for master devices.
Add each event to the master's MH as well as to the SDs. In the MD, store
min/max and the actual value. When retrieving the MH, rescale all coordinates
to the current coordinate range and only post those valuators that are
currently active on the device.
2008-05-26 15:55:20 +09:30
Peter Hutterer
0877de13ac Remove GetMotionProc from ValuatorClassRec.
With the MD/SD device hierarchy we need control over the generation of the
motion history as well as the conversion later before posting it to the
client. So let's not let the drivers change it.

No x.org driver currently uses it anyway, linuxwacom doesn't either so dumping
it seems safe enough.
2008-05-25 22:49:54 +09:30
Peter Hutterer
096117cf02 Xi: reset motion history when swapping device classes.
This isn't really the correct solution, but it'll have to do until I figured
out how to transfer the history over correctly.
2008-05-25 10:38:33 +09:30
Peter Hutterer
ba557e0263 Xi: remove deprecated comment.
Axis clipping wouldn't be necessary here, it's already performed in GPE.
2008-05-24 17:23:10 +09:30
Peter Hutterer
0d1b41ace3 Xi: update device valuators based on the event.
Event is always absolute, update the device's valuators (always absolute too),
and then change the deviceValuator event to reflect the device's reporting
mode.
2008-05-23 13:32:33 +09:30
Peter Hutterer
75551a2ef9 Revert "dix: Correct values in the device axisVal are calculated in GPE"
We can't rely on GPE to update device->valuators->axisVal. If a SIGIO occurs
during event processing this may have incoherent results.

This reverts commit f6645ddbf7.
2008-05-23 12:55:50 +09:30
Peter Hutterer
6c9e9f8a40 input: instead of lastx/y, use a last.valuators[] array on the device.
During GetPointerEvents (and others), we need to access the last coordinates
posted for this device from the driver (not as posted to the client!). Lastx/y
is ok if we only have two axes, but with more complex devices we also need to
transition between all other axes.

ABI break, recompile your input drivers.
2008-05-23 12:01:37 +09:30
Magnus Vigerlöf
f6645ddbf7 dix: Correct values in the device axisVal are calculated in GPE
Signed-off-by: Peter Hutterer <peter@cs.unisa.edu.au>
2008-05-23 09:20:01 +09:30
Peter Hutterer
5c5a1eaf68 Replace UniSA with full Uni name in Author affiliation.
Big boss says UniSA isn't unique enough. Who am I to argue?
2008-05-21 21:51:27 +09:30
Peter Hutterer
28378d26b4 Xi: assemble button/modifier state before updating the device. #15934
The state field of the event must specify the state of the devices before the
event occured. With the code as it was, the state would also include the
event (e.g. state from a button press event would show the button as pressed)
Gathering the state before updating the device should fix this.

X.Org Bug 15934 <http://bugs.freedesktop.org/show_bug.cgi?id=15934>
2008-05-16 15:42:57 +09:30
Peter Hutterer
59b8d29b3a Xi: Fix up ProcIVector, got out of sync with the protocol.
When the opcode squash happened in the protocol, the processing vector got out
of sync for a few requests. As a result, client and server would interpret
requests differently, leading to a couple of BadLength problems.
2008-05-13 11:17:02 +09:30
Peter Hutterer
3344569529 Merge branch 'master' into mpx
Conflicts:

	Xi/exevents.c
	dix/devices.c
2008-05-02 11:00:14 +09:30
Peter Hutterer
ffaccc2dc9 input: replace -1 as default axis limit with NO_AXIS_LIMIT define.
This allows easier refacturing of the coordinate limit handling. Grepping for
-1 is boring.
2008-04-30 11:49:11 +09:30
Peter Hutterer
18b33dd4ff Xi: stop excessive use of _X_EXPORT. 2008-04-29 15:24:55 +09:30
Peter Hutterer
8208b842b7 Xi: add IEventBase global variable. Stores event base for X Input events. 2008-04-29 14:19:42 +09:30
Peter Hutterer
46340b7406 Xi: change UpdateDeviceState to be _X_EXPORT. 2008-04-29 14:17:48 +09:30
Peter Hutterer
3a922c5d07 Xi: apply ValuatorEvent data to the device's valuators.
After UpdateDeviceState, the device has the current position in absolute
coordinates, the event has the correct valuator data to be delivered to the
client.
2008-04-29 11:18:35 +09:30
Peter Hutterer
b5004722a2 Xi: Only return VCP, VCK and floating SDs to Xi 1.x clients.
This is better than the approach implemented with
8973a3f798 which disabled XI altogether for 1.x.
Instead, return a device list that resembles a traditional XI setup on pre XI
2.0 servers. If the client tries to open a device other than a floating SD,
return a BadDevice error.
2008-04-28 10:26:01 +09:30
Peter Hutterer
684b5d8382 Xi: whoops, stray ! caused a bit of memory mess. 2008-04-26 19:55:59 +09:30
Peter Hutterer
87071b604c Revert "Xi: disable XI for clients < XI 2.0"
Turns out some programs don't like this change. gnome-settings-daemon crashes
hard if you tell it that XI doesn't exist. So, tell them we have XI, but leave
the other change (the one that pretends no devices are available).

This reverts commit 8973a3f798.
2008-04-26 19:37:57 +09:30
Peter Hutterer
7447a30fb2 Xi: if a pre-XI2 client tries to list the devices, pretend we don't have any.
XI 1.x isn't supported anymore, so let's pretend we don't have any devices.
This stops clients from opening them and thus stops interference.
2008-04-26 19:03:13 +09:30
Peter Hutterer
8973a3f798 Xi: disable XI for clients < XI 2.0
Sorry. With the huge changes in the device handling I honestly don't know how
to support XI and XI2 alongside. So let's just pretend XI doesn't exist if a
client doesn't request it supporting XI2.
2008-04-26 19:01:00 +09:30
Peter Hutterer
b304b0a65c Xi: add versioning support.
Remember the version the client sent to us, so we can adjust our replies
accordingly. This requires the client to use the {major|minor}Version fields
in the GetExtensionVersion request. However, they were padding before, so we
must assume they are garbage if nbytes is non-zero. If nbytes is zero, the
client is probably a new client and we can handle it correctly.
2008-04-26 17:47:15 +09:30
Peter Hutterer
be5ff2b8d8 Xi: remove some superflous code 2008-04-25 16:25:13 +09:30
Peter Hutterer
f5ac98747d Standardise copyright headers for all new files created as part of MPX. 2008-04-25 14:50:24 +09:30
Peter Hutterer
3fc67b4205 Xi: remove leftover chpkpair.h file.
Used to contain declarations for ChangePointerKeyboardPairing request
handling.
2008-04-25 14:30:46 +09:30
Peter Hutterer
c14b858aec Xi: fix two compiler warnings
unused variable in exevents.c
implicit declaration in warpdevp.c
2008-04-25 14:29:05 +09:30
Peter Hutterer
6015b7a812 Xi: handle requests through a dispatch handler.
Same principle as e.g. in the RandR extension, rather than having a load of
    if (type == XI_whatever)
use an array of function pointers.
2008-04-25 14:28:45 +09:30
Peter Hutterer
cb8cb87bc6 Xi: remove unused #define DISPATCH 2008-04-25 14:28:25 +09:30
Peter Hutterer
f377141912 Xi: don't attempt to send to a NULL window.
Only applicable when the server comes down/restarts. In this case,
WindowTable[i] may be NULL. Let's not try to send an event then.
2008-04-24 14:19:28 +09:30
Peter Hutterer
aa6687322d Xi: when copying button classes, copy xkb_acts as well.
This should be the last piece in the quest for the class copy.
2008-04-18 14:39:21 +09:30
Peter Hutterer
51c8fd69ec dix: free the unused device classes when closing a device.
This also requires to NULL-ify all pointers while we're actually using them,
otherwise we'd try to free them twice.
2008-04-15 15:09:40 +09:30
Peter Hutterer
4cf9c5909d Xi: fix up button count.
Some leftover code from the previously used alloc/free device classes left us
with a incorrect button count. So a button release didn't come through if
a different pointer was moved after the button press.
2008-04-15 13:56:11 +09:30
Peter Hutterer
6866e84e3c Xi: store feedback classes in devProviates system as well.
This is a follow-up to cb48d88085.
2008-04-13 19:57:51 +09:30
Peter Hutterer
cb48d88085 Xi: store unused classes in devPrivates.
Rather than freeing/allocing classes each time the device capabilities need to
swap, store them in the devPrivates system.
When a class is unused, it is pushed into the devPrivates, and later recovered
when needed again. This saves us a lot of memory allocations/frees, admittedly
on the cost of some memory.
2008-04-13 19:48:28 +09:30
Peter Hutterer
fde3c83662 Xi: copy the KeySyms.map over from the source. 2008-04-13 17:10:18 +09:30
Peter Hutterer
3c4c9938f3 Xi: Fix pointer handling in KeyClassRec copy.
We don't free the class anymore, so just store the previous pointers, do the
memcpy from the SD and then restore the pointers.
Plugs a memleak too, before xkbInfo was never freed.
2008-04-13 17:00:00 +09:30
Peter Hutterer
6faf5b97b9 Xi: fix up modifierKeyMap copying.
Setting it to NULL isn't correct either. The correct behaviour is to realloc
it to the size necessary (or newly alloc it/free it).  Otherwise we have a
memleak.
2008-04-13 16:28:31 +09:30
Peter Hutterer
415c6df0da Xi: copy feedback classes first, in some cases xkb relies on kbdfeed.
XkbInitIndicatorMap (in XkbInitDevice) calls XkbFindSrvLedInfo. This accesses
the devices kbdfeed struct, which is all nice and dandy if it is NULL. When
copying the device classes however, kbdfeed may not be NULL and thus
XkbFindSrvLedInfo goes on its merry way to do whatever it does.

By copying kbdfeed first, we avoid XkbFSLI to reference the "old" kbdfeed
struct of the previous SD.
2008-04-13 11:46:44 +09:30
Peter Hutterer
961f666090 Xi: modifierKeyMap needs to be set to NULL when copying classes.
Otherwise we have a double reference to the same memory area.
2008-04-13 09:31:16 +09:30
Peter Hutterer
bf6679cba4 Xi: copy the XkbSrvLedInfo too when copying device classes. 2008-04-13 09:29:32 +09:30
Peter Hutterer
a88386ee27 Xi: only DeliverFocusedEvents if the event is not a pointer event.
A pointer device may have a focus class, but even if so, pointer events must
be delivered to the sprite window, not the focus window.
2008-04-10 14:42:26 +09:30
Peter Hutterer
4824942527 Xi: dont copy FocusClassRec if the master already has one.
Blindly copying will override the focus setting of the master. If there's XI
applications running, they may set the SD focus, while leaving the
MD's focus as it was. In this case, after a class swap we still want to get
the MD's events to the same window as before.
2008-04-10 14:36:10 +09:30
Peter Hutterer
5a4c6621aa Xi: some extra checks for validity of kbd and mouse.
Floating SDs are paired with themselves, so the paired device may not be a
proper keyboard or mouse. Put some extra checks in to avoid dereferencing a
nullpointer later.
2008-04-10 08:29:05 +09:30
Peter Hutterer
e7211eb0b3 Xi: When attaching, check for ptr -> ptr and keybd -> keybd.
Some pointer devices have key classes (e.g. MS Optical Desktop 2000). The
previous test was performed as Error if ptr -> keybd or keybd -> ptr. This
doesnt work with such devices. New test is Succeed if ptr->ptr or
keybd->keybd.
2008-04-10 08:08:54 +09:30
Peter Hutterer
389dae73cc Xi: If device "to" has a class but "from" doesn't, free the class in "to". 2008-04-09 08:26:00 +09:30
Peter Hutterer
60c38d248c Xi: plug memory leak, free previous motion history before allocating new. 2008-04-09 07:47:34 +09:30
Peter Hutterer
ea05cf0813 Xi: check if source has a key class before copying. 2008-04-08 22:09:11 +09:30
Peter Hutterer
fd06e8f8c1 Merge branch 'master' into dcdc_rework
Conflicts:

	Xext/xevie.c
	dix/dispatch.c
2008-04-07 07:56:41 +09:30
Peter Hutterer
8f38feb3e4 Xi: add comments for DeepCopyDeviceClasses, ChangeMasterDeviceClasses. 2008-04-05 20:37:21 +10:30
Peter Hutterer
d0395a7530 Xi: realloc to->valuator instead of allocing it blindly. 2008-04-04 15:05:26 +10:30
Peter Hutterer
502689847b Xi: ALLOC_COPY_CLASS_IF should only alloc if to->field doesn't exist. 2008-04-04 15:01:53 +10:30
Peter Hutterer
035b1b6995 Xi: remove duplicate copying of kbdfeed and ptrfeed. 2008-04-04 15:00:06 +10:30
Peter Hutterer
52fc7aed18 Xi: only alloc memory for feedback classes if it doesn't already exist. 2008-04-04 14:47:23 +10:30
Peter Hutterer
4eb87c8693 Xi: don't free device classes before copying them.
First commit in a series to come.
2008-04-04 14:20:37 +10:30
Peter Hutterer
8e562fe26f Xi: remove false memset from DeepCopyDeviceClasses.
It's wrong, needs to be different, but I haven't had enough coffee to figure
out what it needs to do yet.
2008-03-05 15:11:41 +10:30
Peter Hutterer
7b4f3616f7 Xi: add deviceid to QueryDevicePointer request.
Why not, we had the padding anyway.
Suggested by Jim Gettys on the X.Org mailing list.
2008-03-04 18:29:15 +10:30
Peter Hutterer
4f2cd0ed96 Merge branch 'master' into mpx
This merge reverts Magnus' device coorindate scaling changes. MPX core event
generation is very different, so we can't scale in GetPointerEvents.

Conflicts:

	Xi/opendev.c
	dix/devices.c
	dix/dixfonts.c
	dix/getevents.c
	dix/resource.c
	dix/window.c
	hw/xfree86/common/xf86Xinput.c
	mi/mipointer.c
	xkb/ddxBeep.c
	xkb/ddxCtrls.c
	xkb/ddxKeyClick.c
	xkb/ddxList.c
	xkb/ddxLoad.c
	xkb/xkb.c
	xkb/xkbAccessX.c
	xkb/xkbEvents.c
	xkb/xkbInit.c
	xkb/xkbPrKeyEv.c
	xkb/xkbUtils.c
2008-03-04 18:11:10 +10:30
Eamon Walsh
27bcf40cda XACE: Fix instances of DixUnknownAccess at hook callsites. 2008-02-28 16:43:43 -05:00
Peter Hutterer
453661a9e1 Xi: swap the control attached to a ChangeDeviceControl request. Bug #14170
Just swapping the request's data isn't enough, we need to swap the actual
control as well.

X.Org Bug 14170 <http://bugs.freedesktop.org/show_bug.cgi?id=14170>
2008-02-28 15:47:26 +10:30
Peter Hutterer
ce9fb2f8c4 Xi: MDs return the paired device's ID in attached field of ListInputDevices. 2008-02-26 13:51:19 +10:30
Peter Hutterer
d61f481a44 Xi: remove GetPairedPointer handling.
obsolete, ListInputDevices provides this information now.
2008-02-25 17:52:45 +10:30
Peter Hutterer
27b2127893 Xi: remove ungrab handling of ExtendedUngrabDevice request.
This can be done by UngrabDevice, no need for separate codepaths.
2008-02-25 17:00:42 +10:30
Peter Hutterer
09a8fc5c7a Xi: make SizeDeviceInfo public and re-use from CreateClassesChangedEvent. 2008-02-18 18:42:46 +10:30
Peter Hutterer
088067c891 Xi: even if ChangeDeviceHierarchy fails, we may need to send an event.
Changes are committed instantly, so if at least one change was successful, we
must send an event to the client, even if subsequent ones fail.
2008-02-18 16:46:07 +10:30
Eamon Walsh
ae43d835bd XACE: Change access modes for some device-related requests.
Opening a device is not really "reading" it.
Requests that globally configure a device should require "manage" access.
2008-02-13 20:20:49 -05:00
Peter Hutterer
921c298c4c Xi: QueryDevicePointer doesn't have a shared field anymore. 2008-02-14 09:48:19 +10:30
Peter Hutterer
b885588756 Xi: remove FakeDeviceData calls. And one leftover from GrabAccessControl.
FakeDeviceData needs more thoughtful integration.
2008-02-14 09:47:31 +10:30
Peter Hutterer
c99a9a9729 Xi: remove raw device events.
Need to be better refined.
2008-02-14 09:43:49 +10:30
Peter Hutterer
b35a9efa16 Xi: Remove files for GrabAccessControl. 2008-02-14 09:42:37 +10:30
Peter Hutterer
9d5edebe96 Xi: finish XKB initialisation before copying the keymap. 2008-02-07 21:24:45 +10:30
Peter Hutterer
0ac1755977 Merge branch 'master' into mpx
Conflicts:

	Xext/sampleEVI.c
2008-01-26 13:55:07 +10:30
Peter Hutterer
466f655219 Xi: if deviceid is > 127 assume GE mask is for all devices (XiSelectEvent). 2008-01-25 10:27:30 +10:30
Peter Hutterer
91dc8c43d2 Xi: Change window access right check to RecieveAccess in XiSelectEvent. 2008-01-25 10:27:21 +10:30
Peter Hutterer
94a6a65ae7 Xext: allow per-device GE masks.
Instead of a single mask per client we allow the storage of a mask per client
per device.
2008-01-25 10:26:41 +10:30
Peter Hutterer
ba315ae5dd Xi: add XACE hooks for device creation (ChangeDeviceHierarchy)
AddInputDevice checks for permissions already, so all we do is modify a few
callers to let AID sort it out.
2008-01-21 23:44:07 +10:30
Peter Hutterer
6e17184486 Xi: Check for DestroyAccess when trying to delete a master device. 2008-01-18 17:52:38 +10:30
Matthieu Herrb
dd5e0f5cd5 Fix for CVE-2007-6427 - Xinput extension memory corruption. 2008-01-17 15:27:34 +01:00
Peter Hutterer
4fd0885978 Xi: remove some leftovers from ProcessOtherEvents.
Core handling not needed anymore here.
2008-01-15 18:58:42 +10:30
Peter Hutterer
32aa252e98 dix: Process an input event as a single event, instead of two separate ones.
This is a significant shift in how input events are perceived. The common
approach was to treat a core event as a different entity than the XI event.
This could result in the XI event being delivered to a different client than
the core event. This doesn't work nicely if they come from the same device.

Instead, we treat an input event as a single event, that is delivered through
two separate APIs. So when delivering an event, we first try the XI event,
then the core event. If the window want's neither, we go to the parent and
repeat. Once either core or XI has been delivered, the processing stops.

Important: Different to the previous method, if a client registers for core
button events, the parent window will not get XI events. This should only
cause problems when you're mixing core and XI events, so don't do that!

Generic events don't fit into this yet, they cause me headaches.
2008-01-15 18:41:51 +10:30
Peter Hutterer
0969a9f749 dix: Emulate core events within CheckDeviceGrabs and ComputeFreezes.
This should restore the correct passive grab processing. When checking for
passive grabs, the core event is emulated and we check first for XI grabs on
the window, then for core grabs. Regardless of which event activates the grab,
the XI event is stored in the device's EQ.

When replaying the event, we take the XI event and replay it on the next
window, again including the emulation of the core event.
2008-01-15 11:31:12 +10:30
Peter Hutterer
4e85c7c322 Xi: keep a counter of buttons down to avoid duplicate press/release events.
If two devices are attached to the same master device, pressing button 1 on
each of them leads to two button presses from the same device. Some apps
really don't like that.

So we just put a counter in place and only send the first press and the last
release.
2008-01-09 17:36:39 +10:30
Peter Hutterer
249b9b30c1 Xi: remove file for the obsolete ChangePointerKeyboardPairing request handling. 2008-01-04 13:49:48 +10:30
Peter Hutterer
9cc41b88df Xi: ProcXSetClientPointer should directly check for the client from the id.
The window ID includes the client ID anyway, so we might as well just look up
the client directly instead of trying to get the window first and the client
from the window.

This also fixes a possible issue with XACE. If the client had permission to
write on the client but not on the window, the previous approach would have
failed.
2008-01-03 18:48:13 +10:30
Peter Hutterer
37194b1355 Xi: switch to using "rc" (instead of "err") as returncode.
All the rest of XI uses rc and returns rc in case of error, so make
mpx-related stuff comply. This stops the rest of XI sending the error
manually.
This is just a cosmetic change to be in line with the rest.
2008-01-03 18:36:33 +10:30
Peter Hutterer
8da83836b6 Merge branch 'master' into mpx
Conflicts:

	XTrap/xtrapddmi.c
	Xext/security.c
	Xext/xprint.c
	Xext/xtest.c
	Xext/xvdisp.c
	Xi/exevents.c
	Xi/grabdevb.c
	Xi/grabdevk.c
	Xi/opendev.c
	Xi/ungrdev.c
	Xi/ungrdevb.c
	Xi/ungrdevk.c
	dix/cursor.c
	dix/devices.c
	dix/dixutils.c
	dix/events.c
	dix/getevents.c
	dix/main.c
	dix/window.c
	hw/xfree86/ramdac/xf86Cursor.c
	include/dix.h
	include/input.h
	include/inputstr.h
	mi/midispcur.c
	mi/miinitext.c
	mi/misprite.c
	render/animcur.c
	xfixes/cursor.c
	xkb/xkbAccessX.c
2008-01-03 17:04:54 +10:30
Peter Hutterer
d0308b6465 Xi: specify correct struct when calculating size of GetDeviceControl reply.
This doesn't change much, as the struct previously given has the same size as
the ones now anyway. Still, we should be pendantic.

Thanks to Simon Thum for reporting.
2007-12-19 18:18:10 +10:30
Eamon Walsh
c8feb73f58 Merge branch 'master' into XACE-SELINUX
Conflicts:

	Xext/EVI.c
	Xext/bigreq.c
	Xext/cup.c
	Xext/dpms.c
	Xext/fontcache.c
	Xext/mitmisc.c
	Xext/xcmisc.c
	Xext/xf86bigfont.c
	Xext/xtest.c
	configure.ac
	dbe/dbe.c
	hw/darwin/darwin.h
	hw/darwin/darwinEvents.c
	hw/darwin/iokit/xfIOKit.h
	hw/darwin/iokit/xfIOKitCursor.c
	hw/darwin/quartz/fullscreen/fullscreen.c
	hw/darwin/quartz/fullscreen/quartzCursor.c
	hw/darwin/quartz/quartz.c
	hw/darwin/quartz/quartzCommon.h
	hw/darwin/quartz/quartzCursor.c
	hw/darwin/quartz/xpr/dri.c
	hw/darwin/quartz/xpr/dristruct.h
	hw/darwin/quartz/xpr/xprCursor.c
	hw/darwin/quartz/xpr/xprFrame.c
	hw/xfree86/modes/xf86RandR12.c
	include/cursor.h
	miext/rootless/rootlessCommon.h
	miext/rootless/rootlessScreen.c
	miext/rootless/rootlessWindow.c
	render/picturestr.h

Trying to pick up the pieces from the darwin churn here...
2007-12-13 18:38:25 -05:00
Daniel Stone
0fccb24aa9 ProcessOtherEvent: Don't do double translation of button events
We already deal with the button mapping in GetPointerEvents, so don't
do the remapping again in ProcessOtherEvent.
2007-12-05 18:29:54 +00:00
Peter Hutterer
f44d7dcb5f dix: change the filters to be per-device.
If we have one global filter, one pointer may change the filter value and
affect another pointer.

Reproduceable effect:
blackbox and xterm, start dragging xterm then click anywhere with the other
pointer (attached to different masterd device!).  The button release resets
the filter[Motion_Filter(button)] value, thus stopping dragging and no event
is sent to the client anymore.
Having the filters set per device gets around this.
2007-12-04 19:07:46 +10:30
Peter Hutterer
edebe76cfd Xi: set DeviceXXXState's length fields to the correct size of the struct.
Setting it to the size of a pointer is an interesting but equally wrong
approach. Luckily Xlib never used this field anyway so nobody got hurt so far.

Spotted by Simon Thum.
(cherry picked from commit 0f2398d06c)
2007-11-27 13:15:28 +10:30
Peter Hutterer
0f2398d06c Xi: set DeviceXXXState's length fields to the correct size of the struct.
Setting it to the size of a pointer is an interesting but equally wrong
approach. Luckily Xlib never used this field anyway so nobody got hurt so far.

Spotted by Simon Thum.
2007-11-27 10:22:44 +10:30
Peter Hutterer
691da03131 Xi: allocate motion history for master device.
We're still missing out on the actual content of the history but at least this
way we don't segfault.
2007-11-22 17:59:48 +10:30
Peter Hutterer
f9269bebae DeviceIntRec: move lastx/lasty from valuator into DeviceIntRec.
We free the ValuatorClassRec quite regularly. If a SIGIO is handled while
we're swapping device classes, we can bring the server down when we try to
access lastx/lasty of the master device.
2007-11-22 17:30:14 +10:30
Peter Hutterer
9ed43eff48 Xi: allow clients to specify pure client id in SetClientPointer.
If no window was found with the given ID, try if there's a client with the ID.
Allows us to set the CP for apps that don't open windows (e.g. x2x).
2007-11-21 17:16:27 +10:30
Eamon Walsh
17b0c729b5 registry: Remove registry code from XInput extension.
Moving all the names into dix/registry.c
2007-11-20 18:46:43 -05:00
Peter Hutterer
75e5e9f88c Xi: add missing XI_DeviceClassesChangedMask to XI filters array. 2007-11-18 15:12:50 +10:30
Peter Hutterer
3c39dd19ec Xi: Deep-copy full list of FeedbackClasses.
All feedback classes are linked lists and the whole list has to be duplicated,
not just the first entry.

Xkb stuff still missing.
2007-11-16 12:12:14 +10:30
Peter Hutterer
83926cb8be Xi: Only alloc modifierKeyMap if <slave device>->maxKeysPerModifier > 0
Sometimes (e.g. on my debian ppc box) maxKeysPerModifier of the SD is 0. So we
try to malloc(0), bringing the whole server down with a FatalError because it
looks as if the malloc failed. This is bad, so only alloc if we actually have
something to alloc.
2007-11-15 17:41:07 +10:30
Peter Hutterer
070195dbf8 Xi: fix up sloppy class copying causing segfaults. 2007-11-15 16:27:18 +10:30
Peter Hutterer
b40646dc10 dix: Add FreeDeviceClass and FreeFeedbackClass for centralised xfree.
Ensures that we only have one way of freeing a device class to avoid leaks in
ChangeMasterDeviceClasses and other places.
2007-11-15 15:43:44 +10:30
Peter Hutterer
18833d648f Xi: reset xkb-stuff to NULL after copying (DeepCopyDeviceClasses)
Having two devices point to the same xkb stuff causes SIGABRTs.

Also, don't init a MD's xkbInfo unless the SD has an xkbInfo.
2007-11-15 12:13:59 +10:30
Peter Hutterer
b05246696d Xi: free XkbSrvLedInfos as well when freeing an MD's device classes. 2007-11-15 11:31:43 +10:30
Peter Hutterer
64711a0948 Xi: When switching MD classes, make a deep copy instead of pointer flip.
Turns out it's really really hard synchronising device state across multiple
duplicated events if they all share the same struct. So instead of doing so,
when the SD changes deep-copy all it's classes into the MD. The MD then has
the same capabilities, but the state can be set separately. This should fix
xkb, key state, repeat etc. problems.

Updating the device state allows us to remove the SwitchCoreKeyboard from the
event gathering, it's all done during event processing now.
2007-11-15 10:41:34 +10:30
Peter Hutterer
cc4586df60 Xi: toggle the public.devPrivate as well when switching device classes.
The master needs to have the same devPrivate as the slave, in case a client
issues a request that goes down to the driver.
Example: if a driver wants to ring the keyboard bell, it'll pick a keyboard.
The KeyClassPtr will direct it to the matching method in the driver, but
because the MD doesn't have the devPrivate set the driver segfaults.
Even if all drivers were updated to not dereference the nullpointer, nothing
would actually ever happen.

To avoid this, we flip the master's public.devPrivate to the last SDs
devPrivate.
2007-11-14 14:27:52 +10:30
Peter Hutterer
240b10fa9c Xi: Move updating the device state from POE into separate function.
POE now only deals with processing the event and calling the appropriate
delivery methods. Actually modifying the device state is done in
UpdateDeviceState. This separation should make it easier to avoid setting the
state twice when master events are processed.
2007-11-14 13:38:56 +10:30
Peter Hutterer
0bdfeb55fc Xi: remove RegisterPairingClient handling. Deprecated with device hierarchy. 2007-11-13 17:31:20 +10:30
Peter Hutterer
e96d926d64 Xi: remove trailing whitespaces. 2007-11-13 17:14:35 +10:30
Peter Hutterer
a05f43bf3e dix: When the last slave is removed, set master to the original classes.
DeviceClassesChangedEvent is sent to the client, where device == new slave.
2007-11-12 11:35:18 +10:30
Peter Hutterer
7a81bafc9b Xi, dix: Add ability to change MD classes + send event when doing so.
Each time a different slave device sends through a master, an
DeviceClassesChangedEvent is enqueued. When this event is processed, all
classes of the matching master device are changed, and the event is sent to
the clients.

Next time the master is queried, it thus shows the evclasses of the last slave
device. The original classes are stored in the devPrivates.

TODO: if all slave devices are removed, the master's original classes need to
be restored.
2007-11-09 23:10:24 +10:30
Peter Hutterer
676b26ca3e Xi: notify the clients when the device hierarchy has been changed. 2007-11-09 14:31:54 +10:30
Peter Hutterer
180220f284 Xi: return BadDevice for slave devices on ProcXSetClientPointer
Also clean up to return error codes instead of sending the error manually.
2007-11-08 10:00:35 +10:30
Peter Hutterer
184a7b8917 Merge branch 'mpx' into mdsd
Conflicts:

	Xi/opendev.c
2007-11-08 09:34:35 +10:30
Peter Hutterer
0b729051c0 Merge branch 'master' into mpx
Conflicts:

	Xi/extinit.c
	Xi/grabdev.c
	Xi/setmode.c
	Xi/ungrdev.c
	dix/devices.c
	dix/events.c
	dix/getevents.c
	include/dix.h
	mi/midispcur.c
	mi/misprite.c
	xkb/xkbActions.c
	xkb/xkbEvents.c
	xkb/xkbPrKeyEv.c
2007-11-07 15:37:23 +10:30
Peter Hutterer
a8808ac3d0 Xi: don't call CheckMotion for slave devices.
This essentially disables enter/leave for slave devices, but re-enables them
for master devices. Which is a good thing after all.
2007-11-07 11:42:58 +10:30
Eamon Walsh
a52c9b2a59 Merge branch 'master' into XACE-SELINUX
Conflicts:

	dix/dispatch.c
	dix/property.c
	hw/xfree86/common/xf86VidMode.c
	include/xkbsrv.h
	render/glyph.c
	xkb/xkbActions.c
2007-11-05 19:08:36 -05:00
Daniel Stone
fb32bb9839 Xi: Remove usage of alloca
Replace with xalloc/xfree.
2007-11-05 14:34:46 +00:00
Peter Hutterer
d9caa469b9 Xi: allow VCP/VCK to be OpenDevice'd as well.
All devices deserve to be equal. Except master devices, they are a bit more
equal than the others.
2007-10-19 15:26:09 +09:30
Peter Hutterer
155e2c559e Xi: advertise as XInput v2 capable 2007-10-19 14:37:07 +09:30
Peter Hutterer
5ba738935f Xi: remove ChangePointerKeyboardPairing in favour of ChangeDeviceHierarchy. 2007-10-19 14:36:37 +09:30
Peter Hutterer
6dcde0e9c1 Xi: set master device's id in ListDevices Reply. 2007-10-19 11:28:50 +09:30
Peter Hutterer
cfcc6e14b9 Xi: return all master devices as type IsXPointer/Keyboard when listing devs.
Slave devices are reported as IsXExtensionPointer/Keyboard.
2007-10-19 11:28:44 +09:30
Eamon Walsh
6107a24503 dix: Add client parameter to AddPassiveGrabsToList(). 2007-10-18 12:24:55 -04:00
Peter Hutterer
ae9fc10ade Xi: don't send core events for slave devices. 2007-10-17 10:41:04 +09:30
Peter Hutterer
e9f149fb56 Fix up detritus from removing GetPairedPointer/Keyboard. 2007-10-16 14:24:20 +09:30
Eamon Walsh
5277a6ff58 registry: Register Input extension protocol names. 2007-10-15 14:14:37 -04:00
Peter Hutterer
113011221a Xi, xfree86: Remove leftovers of the XI wrapper code. 2007-10-01 21:42:01 +09:30
Eamon Walsh
8b54865720 xace: add hooks + new access codes: XKB extension.
Removes "LookupKeyboardDevice" and "LookupPointerDevice" in favor of
inputInfo.keyboard and inputInfo.pointer, respectively; all use cases
are non-XI compliant anyway.
2007-09-28 13:34:18 -04:00
Eamon Walsh
5c03d13181 xace: add new hooks + access controls: XInput extension.
Introduces new dix API to lookup a device, dixLookupDevice(), which
replaces LookupDeviceIntRec and LookupDevice.
2007-09-28 08:02:00 -04:00
Peter Hutterer
a511c445de Remove generation of core events, long live XI!
Let the drivers only generate XI events and put those into the event queue.
When processing events, generate core events as needed. This fixes a number of
problems with XKB and the DIX in general.

The previous approach was to put core events and XI events as separate events
into the event queue. When being processed, the server had no knowledge of
them coming from the same device state change. Anything that would then change
the state of the device accordingly was in danger of changing it twice,
leading to some funny (i.e. not funny at all) results.

Emulating core events while processing XI events fixes this, there is only one
path that actually changes the device state now. Although we have to be
careful when replaying events from synced devices, otherwise we may lose
events.

Note: XI has precedence over core for passive grabs, but core events are
delivered to the client first.

This removes the wrapping added in 340911d724
2007-09-28 18:46:41 +09:30
Eamon Walsh
3b114f2603 Input: Properly swap DevicePresenceNotify events. 2007-09-26 07:26:59 -04:00
Eamon Walsh
31a7994ac7 Input: Return errors to the dispatcher instead of sending them ourself.
Also fixed two "unused variable: stuff" warnings.
2007-09-26 07:26:59 -04:00
Peter Hutterer
3342b5ad47 Xi: fix the wrapper code for processInputProc wrapping.
Followup to [1].
If a core grab causes the device to freeze, it overwrites the processInputProc
of the device. [1] would then overwrite this while unwrapping, the device
does not thaw anymore.
Changing this to only re-wrap if the processInputProc hasn't been changed
during the event handling.

[1] 340911d724
2007-09-26 18:03:21 +09:30
Peter Hutterer
55fd50273e Xi: unify ErrorFs. Prefix all with [Xi]. 2007-09-26 15:15:34 +09:30
Peter Hutterer
340911d724 Wrap core event handling through ProcessOtherEvents.
When processing events from the EQ, _always_ call the processInputProc of the
matching device. For XI devices, this proc is wrapped in three layers.
Core event handling is wrapped by XI event handling, which is wrapped by XKB.
A core event now passes through XKB -> XI -> DIX.

This gets rid of a sync'd grab problem: with the previous code, core events
did disappear during a sync'd device grab on account of mieqProcessInputEvents
calling the processInputProc of the VCP/VCK instead of the actual device. This
lead to the event being processed as normal instead of being enqueued for
later replaying.
2007-09-26 15:12:49 +09:30
Daniel Stone
27ad5d74c2 Input: Generate XKB mapping changes for all core-sending devices (bug #12523)
When we change the mapping on a core device, make sure we propagate this
through to XKB for all extended devices as well.
2007-09-23 17:17:20 +03:00
Peter Hutterer
03680a384a dix: don't change the device struct while processing core events.
The device state needs to be changed while processing the XI event. Core
events are always processed after XI, so by then the device is already set up
properly. However, we now rely on DeviceButtonMotionMask to be equal to
ButtonMotionMask. It already is, but stick a big fat warning in so nobody
attempts to change it.

This commit disables XKB for the VCK, thus essentially for all devices.
Temporarily anyway.
2007-09-06 15:43:47 +09:30
Peter Hutterer
f367285fd5 Merge branch 'master' into mpx
Conflicts:

	Xi/exevents.c
	dix/devices.c
	dix/getevents.c
	include/dix.h
	mi/mieq.c
2007-08-12 15:31:10 +09:30
Daniel Stone
cd8e99e56e Input: Don't enable devices when we open them
Thanks to Xi's braindead design, it's otherwise impossible to query input
devices without enabling them.  Hurrah.
2007-08-01 03:33:06 +03:00
Peter Hutterer
9809715afa Change CheckMotion to ignore non-pointer events but acknowledge XI events.
Call CheckMotion from ProcessOtherEvents() to make sure absolute XI events
update the sprite before an event is sent.
2007-07-10 10:09:50 +09:30
Paulo Ricardo Zanoni
c1a6841a64 ProcX{Change|Query}WindowAccess: change device list from char* to XID*. 2007-07-10 10:08:44 +09:30
Peter Hutterer
5ccc09b182 Use the same struct for generic event masks throughout the code.
Renaming those structs too.

Previously grabs were using a different struct than windows, which was
reasonably stupid.
2007-07-06 15:43:08 +09:30
Peter Hutterer
c1a16bdcfe Add 'evfill' field to GEExtensions.
We need this to allow extensions to fill in extra data for an event before it
is sent to the client. This is probably to be used like
FillUpEventsFromWindow().
2007-07-01 09:14:18 +09:30
Peter Hutterer
08779c62ba Reset grab->next to NULL when we're creating a grab.
This is definitely necessary in CheckDeviceGrabAndHintWindow (thanks to Paulo
Zanoni for spotting it). We're resetting it everywhere else too, just to be
save.
2007-06-27 11:58:20 +09:30
Peter Hutterer
8396bf7c8b Init genericMasks to 0, make sure list is NULL terminated. 2007-06-27 11:58:04 +09:30
Peter Hutterer
87564543d9 Only decrement buttonsDown when the button count is greater than 0.
Device drivers flush their buttons on device init and cause a button down
event to be generated. If we unconditionally decrease the buttons, we won't be
able to ever get a passive device grab.

Format documentation for CheckDeviceGrabs to make it readable.
(cherry picked from commit 3e894974cd)

Conflicts:

	Xi/exevents.c
2007-06-25 09:35:30 +09:30
Peter Hutterer
5dee64fc99 Add a few comments to ProcXGrabDevice. 2007-06-19 11:31:22 +09:30
Peter Hutterer
3e894974cd Only decrement buttonsDown when the button count is greater than 0.
Device drivers flush their buttons on device init and cause a button down
event to be generated. If we unconditionally decrease the buttons, we won't be
able to ever get a passive device grab.

Format documentation for CheckDeviceGrabs to make it readable.
2007-06-15 17:16:16 +09:30
Peter Hutterer
26b21157cf Add a deviceMask to the GrabRec and don't interfere with passiveGrabs.
This quickfixes event delivery problems with XI events when a grab was on.
deviceMask is only used when the grab was from a ButtonPress to preserve
potential XI event masks.

This is not an ideal solution but it works until I have time to work on
PassiveGrabs.
2007-05-31 17:05:14 +09:30
Paulo Ricardo Zanoni
b5db863945 Allow value None for windows when setting ClientPointer.
We need this for clients that need to set the ClientPointer but don't have a
window on display yet. If used, it will set the device as the ClientPointer
for the requesting client.
2007-05-30 16:15:15 +09:30
Peter Hutterer
167e1773de Remove unused include "gestr.h" 2007-05-21 10:45:10 +09:30
Peter Hutterer
333bab4b23 Clean up, correct some comments.
Send event type down with the RawEvents.
2007-05-17 17:59:02 +09:30
Peter Hutterer
81fc6a128b Add ungrab support to ExtendedGrabDeviceRequest handling.
Polish the code a bit.
2007-05-14 18:12:56 +09:30
Peter Hutterer
5c680e9493 Remove double-grab option. We only want one grab per device. 2007-05-14 12:34:53 +09:30
Peter Hutterer
4dc973f08c Add ExtendedGrabDevice handling.
Add XGE handling in DeliverGrabbedEvent.

We can now grab something selecting XGE events, but the current code is a
bit messy and doesn't work too well yet.
2007-05-14 10:42:03 +09:30
Peter Hutterer
c03d9a7217 Cleaning up a bit.
Register correct event in EventSwapVector.
Fix up event swap for GE events, register XI's swap function at GE.
2007-05-02 18:16:40 +09:30
Peter Hutterer
e6fd4a24eb Add handling for FakeDeviceEvent request.
Fix a stupid bug from last commit, mask names were wrong.
2007-05-02 17:49:20 +09:30
Peter Hutterer
af25720598 Add missing files for ProcXiSelectEvent.
Should have been a part of 5e43910929. Oh well.
2007-05-02 13:51:16 +09:30
Peter Hutterer
58c0fd2927 Adjust EQ to support long events.
Add RawDeviceEvent (pointers only for now).

This commit changes the event queue to use EventLists instead of xEvent
arrays. Only EQ is affected, event delivery still uses xEvent* (look for
comment in mieqProcessInputEvent).

RawDeviceEvents deliver driver information to the client, without clipping or
acceleration.
2007-05-02 13:50:09 +09:30
Peter Hutterer
8b42ba64e1 Send PointerKeyboardPairingChangedNotifyEvent using XGE.
Needs updated inputproto and libXi.
2007-05-01 12:12:58 +09:30
Paulo Ricardo Zanoni
82f97e1c0c Enable event delivery for multiple heads.
Requires moving the spriteTrace into the DeviceIntRec and adjusting a few
functions to take in device argument, most notably XYToWindow().

Cursor rendering on the second screen is busted.
2007-04-26 15:58:50 +09:30
Peter Hutterer
d4dad6f84f Merge branch 'master' into mpx
Conflicts:

	configure.ac
	dix/events.c
	hw/xfree86/common/xf86Xinput.c
2007-04-12 11:11:03 +09:30
Remigiusz Marcinkiewicz
aecbc71214 Input: Allow a pointer to a device to be returned in NIDR
Allow a pointer to the first device added to be returned, so we know which
device(s) were added by the NIDR call.
2007-04-11 00:38:16 +03:00
Magnus Vigerlöf
82962bbae2 Input: Add DeleteInputDeviceRequest
Add DIDR, which asks the DDX to remove a device, analogous to
NewInputDeviceRequest.  Only implemented for XFree86 at the moment.
2007-04-10 23:58:20 +03:00
Peter Hutterer
9b0b340668 Make GrabDevice differ between core grabs and device grabs. 2007-04-03 15:06:26 +09:30
Peter Hutterer
e8777a91f3 Merge branch 'master' into mpx
Conflicts:

	Xi/closedev.c
	Xi/exevents.c
	Xi/extinit.c
	Xi/listdev.c
	dix/window.c
	hw/xfree86/common/xf86Xinput.c
	include/extinit.h
	mi/mipointer.c
2007-04-02 15:36:26 +09:30
Peter Hutterer
a12054757d Xi: fix ProcXListInputDevices to include the virtual core devices. 2007-04-02 11:20:44 +09:30
Peter Hutterer
63d8f01819 dix: Fix wrong cursor refcount.
Calloc cursor struct to ensure devPrivates are zeroed out and don't
        increase the refcnt for devices automatically when allocating a new
        cursor. Use new DeviceIsPointerType() to detect if device is a pointer
        _before_ device has been activated and can thus be identified and set
        up grab functions accordingly. This way we can increase the refcnt
        when we get a pointer grab.
2007-03-30 14:59:43 +09:30