Commit Graph

337 Commits

Author SHA1 Message Date
Peter Hutterer
8bf2f56267 dix: fix dev/keybd variable mixup.
Reported-by: Eric Anhold <eric@anholt.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-19 22:18:05 +10:00
Peter Hutterer
b406886bbf input: allow NULL as XkbRMVLOSet in InitKeyboardDeviceStruct.
Virtually all callers use
    XkbGetRulesDefault(&rmlvo);
    InitKeyboardDeviceStruct(..., rmlvo);

Let's save them the trouble and accept NULL as a hint to take the
default RMLVO.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Benjamin Close <Benjamin.Close@clearchain.com>
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2009-04-17 10:03:40 +10:00
Peter Hutterer
011cee3103 dix: fix dev/keybd variable mixup.
Reported-by: Eric Anhold <eric@anholt.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-09 20:50:32 +10:00
Peter Hutterer
6c3b633299 Merge branch 'master' into xi2 2009-04-07 19:36:27 +10:00
Peter Hutterer
0cfd481308 dix: Dont change the keyboard mapping on non-keyboard devices.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-07 19:25:17 +10:00
Peter Hutterer
45baef0b77 dix: return BadValue as error in SetModifierMapping.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2009-03-27 11:26:15 +10:00
Peter Hutterer
e11dc10f01 dix: Send HierarchyEvents when devices are added/removed/enabled/disabled. 2009-03-20 15:17:56 +10:00
Peter Hutterer
8634e1bcba dix: send presence events when floating and unfloating SDs 2009-03-20 15:17:56 +10:00
Peter Hutterer
38bba0c1b7 Xi: Change ChangeMasterDeviceClasses to new XI2 events.
Split ChangeMasterDeviceClasses into an extra XISendDeviceChangedEvent that
assembles the XI2 wire event for the DeviceChanged event. Re-use this when
detaching the last SD.

Not quite perfect yet, we still copy the device classes from the slave now
rather than from the data we had when the event occured. But it's a start.

(We can now unexport SizeDeviceInfo and CopySwapDevices, not needed anymore)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-20 15:17:55 +10:00
Peter Hutterer
dfa2e8e966 Xi: add XIQueryDevice request handling. 2009-03-20 15:17:55 +10:00
Peter Hutterer
43e48900fc dix: Force deviced ids of 2 and higher for actual devices.
0 is now reserved for the "AllDevices" virtual device.
1 is now reserved for the "AllMasterDevices" virtual device.

This also means that wherever we passed in (mskidx = 0), we now need to pass
in the deviceid.
2009-03-20 15:17:54 +10:00
Peter Hutterer
497a125339 dix: remove duplicate PickKeyboard() command.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-20 14:48:57 +10:00
Peter Hutterer
f1c7b95d83 dix: do percentage check before device check in ProcBell
This is just for correctness. The server should return BadValue for anything
not in [-100, 100].

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-20 14:48:57 +10:00
Peter Hutterer
18430616cf dix: use PickPointer() and PickKeyboard instead of inputInfo.pointer/keyboard.
Affected calls:
 ProcChangeKeyboardControl
 ProcBell
 ProcUngrabKey
 ProcUngrabButton
2009-03-16 13:29:06 +10:00
Peter Hutterer
e31727158c dix: fix ProcChangePointerControl's wrong inputInfo.pointer usage.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-16 13:29:06 +10:00
Peter Hutterer
97cb3cc28e dix: Merge DevicePresence notify events generation into a single function.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-12 11:03:29 +10:00
Peter Ã…strand
ddb8d8945d xserver: Avoid sending uninitialized padding data over the network
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-16 13:28:38 +10:00
Peter Hutterer
0e15697b53 dix: die if we can't activate or init the VCP/VCK.
If we have a busted xkb setup, the XKB initialization on the core devices
fails and leaves us with dev->key->xkbInfo == NULL. This in turn causes
segfaults lateron.

Return BadValue when the XKB configuration for a master device failed, and if
that happens for the VCP/VCK, die semi-gracefully.
The VCP init can only fail on OOM.

Reported by Aaron Plattner.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Daniel Stone <daniel@fooishbar.org>
Acked-by: Dan Nicholson <dbn.lists@gmail.com>
Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
2009-02-05 14:31:29 +10:00
Tomas Carnecky
111fdef74d ISO C90: Move declaration to the beginning of the function
devices.c: In function ‘DoChangeKeyboardControl’:
devices.c:1768: warning: ISO C90 forbids mixed declarations and code

Signed-off-by: Tomas Carnecky <tom@dbservice.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-04 09:41:05 +10:00
Adam Jackson
132b464d73 Remove a bunch of useless casts.
We've had void * for twenty years now people let's try to act like we
know how it works.
2009-01-22 02:11:16 -05: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
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
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
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
Julien Cristau
466dddbb83 dix: fix cast from pointer to integer 2009-01-11 08:54:10 +01:00
Julien Cristau
54332e4732 dix: ANSI cleanups 2009-01-11 08:54:10 +01:00
Thomas Jaeger
3d549438c2 Don't alter device button maps in DoSetPointerMapping
Currently, if a device map differs from the core pointer map, then the
request may return MappingBusy, even though all the affected core
buttons are in the up state.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-08 11:45:22 +10:00
Peter Hutterer
27011254c4 xfree86: If an input device failed to activate, return immediately.
Devices are only activated once - right after they've been added to the
server. If a device failes activation, it's dead. There's no reason to
continue. Return the error code from ActivateDevice() without setting up
sprite information or even sending a event to the client.

Then - in the DDX - just remove the device again.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-05 11:05:13 +10:00
Peter Hutterer
477c327087 dix: don't disable uninitialized devices.
If a device hasn't been initialized, it doesn't have a cursor yet. So don't
set the cursor to the NullCursor, and don't try to DisableDevice either.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2008-12-23 09:12:55 +10:00
Peter Hutterer
08a3d6928c dix: Allocate the space for the DCCE when the last SD is removed.
This still doesn't fix reset the MD's classes (a TODO that's been here for
ages), but at least we don't segfault anymore when detaching the last SD.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2008-12-18 09:58:42 +10:00
Peter Hutterer
d961abb59f dix: fix compiler warning (mixing declarations + statements)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
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
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
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
ec1d08442f dix: Enable core devices in InitCoreDevices already.
Updated patch, see
http://lists.freedesktop.org/archives/xorg/2008-November/040540.html

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2008-11-26 10:53:23 +10:00
Peter Hutterer
2b45602e82 Revert "dix: Enable core devices in InitCoreDevices already."
I merged the wrong patch. See correct patch at:
http://lists.freedesktop.org/archives/xorg/2008-November/040540.html

Not activating the device before attempting to enable it would leave the
sprite unset, crashing the server when enabling the real devices.

This reverts commit e078901a4e.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-11-26 10:53:23 +10:00
Peter Hutterer
b292a7a2d7 dix: updated enter/leave core event model.
As proposed by Owen Taylor [1], the enter-leave event model needs to adjust
the events sent to each window depending on the presence of pointers in a
window, or in a subwindow.

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

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

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

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-11-25 09:21:46 +10:00
Peter Hutterer
e078901a4e dix: Enable core devices in InitCoreDevices already.
Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2008-11-24 10:17:40 +10:00
Peter Hutterer
d939f2482e dix: fix false comment.
VCP and VCK are always present, this comment is a leftover from earlier MPX
days.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-11-24 10:07:22 +10:00
Simon Thum
7f818776b7 dix: fix typos in comments, one formatting fix.
Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-11-21 09:04:17 +10:00
Peter Hutterer
971aef6441 dix: FreeDeviceClass() and friends can be static. 2008-10-31 18:26:18 +10:30
Peter Hutterer
7c5dec9f71 dix: remove unused GuessFreePointerDevice().
Not used since the MD/SD hierarchy was introduced many moons ago.
2008-10-31 18:26:18 +10:30
Peter Hutterer
12599af285 dix: NextFreePointerDevice() can be static. 2008-10-31 18:26:18 +10:30
Peter Hutterer
eb014021c2 dix: PairDevices() can be static, remove from input.
PairDevices() is only ever called in EnableDevice().
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
Peter Hutterer
4c926dbac6 dix: fix two more endian issues, correct initial "enabled" value. #18111
EnableDevice and DisableDevice both change the property too.

And enabled must be set to FALSE in AddInputDevice, the device is not enabled
yet.

X.Org Bug 18111 <https://bugs.freedesktop.org/show_bug.cgi?id=18111>
2008-10-23 14:17:04 +02:00
Peter Hutterer
ff60e592f0 dix: don't allow VCP/VCK be disabled through properties. 2008-10-23 17:42:47 +10:30
Peter Hutterer
98f01c2abe dix: fix endianess issue in AddInputDevice. #18111
dev->enabled is a Bool. Bool is two bytes.
BOOL on the other hand is a protocol type and always 1 byte. So copy the value
into the one-byte type before passing it into XIChangeDeviceProperty.

Found by Michel Dänzer.

X.Org Bug 18111 <http://bugs.freedesktop.org/show_bug.cgi?id=18111>
2008-10-23 17:39:07 +10:30
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
decec14219 dix: silence "unused variable" compiler warning. 2008-10-10 16:57:32 +10:30
Adam Jackson
8a5b89e8e1 xalloc+memset(0) -> xcalloc 2008-10-06 15:36:51 -04:00
Adam Jackson
0b7b89fbac xalloc+bzero -> xcalloc 2008-10-06 14:19:30 -04:00
Simon Thum
5ef5e89f0e dix: fix non-initialization of pointer accel in master devices.
Init MDs always with PtrAccelNoOp.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-10-03 15:27:07 +09:30
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
e76b5b5e73 dix: calloc, not malloc, ValuatorClassRec.
For master devices, the ptraccel code could segfault on free since we'd be
dereferencing random memory. Callocing the valuatorClassRec is the easy fix.
2008-09-18 14:55:32 +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
998375f415 dix: remove superfluous check. 2008-08-12 20:42:08 +09:30
Peter Hutterer
2c3645581e dix: SetModifierMapping should only apply to the ClientPointer and it's SDs. 2008-08-08 16:19:20 +09:30
Simon Thum
4e32e6fb38 dix: rename classic accel _scheme_ to lightweight to avoid confusion with
classic accel _profile_

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2008-07-28 18:13:18 +09:30
Keith Packard
67d7821ae7 dix: reset potential lastSlaves when disabling an SD
Unplug a mouse, then warp the pointer and the warp pointer code will try
to update the position of the last slave device associated with the
master. That pointer will be stale and the X server will crash.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2008-07-22 15:54:48 +09:30
Peter Hutterer
69de40ee45 dix: shift the duplicate button mapping check to ProcSetPointerMapping.
XI 2 allows two buttons to have the same button code.
2008-07-21 17:26:33 +09:30
Peter Hutterer
5bcc45e07e Xi: expose Enable/DisableDevice through XI_PROP_ENABLED property. 2008-07-13 20:54:33 +09:30
Simon Thum
c9eb0e870c Add support for multiple pointer acceleration schemes. #8583
Available acceleration schemes:
 - xorg classic scheme.
 - the new "Predictable" polynomial accel scheme.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
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
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
Eamon Walsh
02a8b118cd Fix "warning: implicit declaration of function ‘miPointerGetScreen’". 2008-06-13 21:01:50 -04:00
Peter Hutterer
fbf4b5f16a dix: set dst->mapWidth when allocating a new map. 2008-06-05 08:53:34 +09:30
Peter Hutterer
5a3d06b8f4 xkb: delete default rules when devices are closed.
We only have one set of default rules options in xkb. When the second keyboard
is brought up with Xkb options specified, these new options overwrite the old.
In future server generations, the rules used for the VCK are a mixture of the
default ones and ones previously specified for other keyboards. Simply
resetting the xkb default rules to NULL avoids this issue.

Reproducable by setting XkbLayout "de" and XkbVariant "nodeadkeys". In the
second server generation, the VCK has "us(nodeadkeys)". This again produces a
SIGABRT when the first key is hit.

I could not figure out why the SIGABRT happens. This patch is avoiding the
issue rather than fixing it.
2008-06-02 10:27:05 +09:30
Peter Hutterer
62c1a32976 dix: null out dummyDev, otherwise Xephyr dereferences random pointers.
SendEventToAllWindow eventually causes a IsInterferingGrab(), which attempts
to dereference dev->deviceGrab.grab.
2008-05-31 17:42:05 +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
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
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
Peter Hutterer
1a3f351c50 dix: when floating a device, create a new cursor sprite.
This is essentially necessary to allow calls to miPointerGetSprite etc. to
work for floating slave devices.
2008-05-22 23:25:20 +09:30
Peter Hutterer
7a550cefd9 dix: shut up two compiler warnings. 2008-05-20 11:07:39 +09:30
Peter Hutterer
937e5aae33 dix: don't undisplay cursor if we don't own a sprite.
Sometimes we didn't have a cursor when coming back from suspend. Reason was
that the suspend caused the server to lose the device that was attached to the
VCP, and a RemoveDevice() would then set the cursor to NULL.
Solution: only set the cursor to NULL if we actually own the sprite.
2008-05-14 22:30:15 +09:30
Peter Hutterer
00db0f35ac dix: InitAndStartDevices doesn't need a window parameter.
Leftover from the old pointer-keyboard pairing code, obsolete and gone now.
2008-05-14 15:29:28 +09:30
Peter Hutterer
da728f2127 dix: don't use serverClient in AddInputDevice, use the one supplied instead.
We pass in the client that wants to create the device anyway, lets use the
parameter instead of hardcoding the serverClient.

Wow. I hope this is merge detritus, otherwise it'd be a sign that I didn't
have enough coffee that day.
2008-05-14 15:17:05 +09:30
Peter Hutterer
1fc1a2897e Remove UndisplayCursor API.
We can achieve the same thing by simply displaying a NullCursor, there's no
need for a separate API.
2008-05-13 11:17:02 +09:30
Peter Hutterer
a0e6a7d4f5 dix: resize EQ to minimum size to avoid reallocs during SIGIO.
When a new device is added, calculate the event size needed if a DCCE event is
sent and set the EQ's event size to this minimum. This avoids reallocs when a
event is sent (which may happen during a SIGIO).
2008-04-30 17:57:48 +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
53dba5381f dix: if alloc of a master keyboard fails, remove the master pointer. 2008-04-28 11:37:52 +09:30
Peter Hutterer
d9c38e84cc dix: remove pairingClient definition.
This variable was used originally to determine which client is allowed to
change the pointer-keyboard pairing. For now, we just let anyone change it and
see how that works out.
2008-04-25 14:29:26 +09:30
Peter Hutterer
8190ef8754 Merge branch 'master' into mpx
Conflicts:

	Xext/EVI.c
	Xext/appgroup.c
	Xext/cup.c
	Xext/mitmisc.c
	Xext/sampleEVI.c
	dix/window.c
2008-04-22 18:04:05 +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
48d33ab9b6 dix: float attached devices _before_ disabling the master.
It also helps if we're actually providing the correct argument to
AttachDevice...
2008-04-15 14:29:53 +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
6d22a9615a dix: Call DeleteInputDeviceRequest from CloseDownDevices (#14418)
The DDX (xfree86 anyway) maintains its own device list in addition to the one
in the DIX. CloseDevice will only remove it from the DIX, not the DDX. If the
server then restarts (last client disconnects), the DDX devices are still
there, will be re-initialised, then the hal devices come in and are added too.
This repeats until we run out of device ids.

This also requires us to strdup() the default pointer/keyboard in
checkCoreInputDevices.

X.Org Bug 14418 <http://bugs.freedesktop.org/show_bug.cgi?id=14418>
2008-04-11 18:45:32 +09:30