Commit Graph

349 Commits

Author SHA1 Message Date
Peter Hutterer
1e210d6d10 xkb: remove now-unused XkbGetKeysym.
XkbGetKeysyms was only used by the now-removed Keysym grabs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-05 07:59:07 +10:00
Peter Hutterer
845e65f080 xkb: move XkbFilterEvents to xkbsrv.h
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-30 08:43:14 +10:00
Peter Hutterer
a148d40742 xkb: restore XKB PtrBtn actions.
Ifdef'd out since the switch to internal events. PtrBtn actions now work
again. Instead of generating the event directly, GPE generates the event and
it is then posted through the usual event processing routines
(mieqProcessDeviceEvent).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-30 08:43:13 +10:00
Peter Hutterer
4e9b2938cd include: untangle events.h from the SDK headers.
InternalEvents shouldn't be used anywhere outside the X server itself. Split
up into events.h for opaque typedefs for the events needed by various
headers and eventstr.h for the actual struct definitions.

eventstr.h must only be included by code that requires internal events and
is not part of the SDK.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-30 08:43:13 +10:00
Peter Hutterer
6a90c7b937 xkb: cosmetic fix, use TRUE instead of True.
Rest of InitKeyboardDeviceStruct uses TRUE and FALSE.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-16 09:29:17 +10:00
Peter Hutterer
693babbf12 xkb: Remove XKMformat.h include from xkbsrv.h into the files that need it.
xkbsrv.h is used by drivers, they don't need the XKM format and shouldn't
require it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-15 12:30:44 +10:00
Peter Hutterer
089c460058 xkb: switch to byte counting functions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-14 10:14:02 +10:00
Peter Hutterer
3711d68f65 Revert "XKB: Sanitise * actions" commits (#19602)
Reverts the following four patches:

feb757f384 "XKB: Sanitise vmods for redirected keys"
b5f49382fe "XKB: Sanitise ctrls action"
1bd7fd195d "XKB: Sanitise pointer actions"
61c508fa78 "XKB: Sanitise vmods in actions"

Strictly speaking, the structs used in the server are not part of the client
ABI. Practically, they are as we copy from the wire straight into the
structs. Changing the struct sizes breaks various wire/server conversions.

Even when the structs have the same size, some internal magic causes
conversions to fail. Visible by diffing the output files of:
setxkbmap -layout de; xkbcomp -xkb :0 busted.xkb
setxkbmap -layout de -print | xkbcomp -xkb - correct.xkb

Interestingly enough, busted.xkb is the working one although the output is
incorrect. Revert the four offending patches until the exact cause of this
breakage can be determined.

This patch restores functionality to Level3 modifiers.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-10 11:23:52 +10:00
Peter Hutterer
01241b4247 Xi: Add support for sourceid in the device classes. 2009-06-17 11:21:19 +10:00
Peter Hutterer
b40289c876 xkb: allow pointer events to pass through for floating SDs without a key class.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-02 16:37:39 +10:00
Peter Hutterer
d7aef3f663 Merge branch 'master' into xi2
Conflicts:
	Xext/geext.c
	Xi/chdevcur.c
	Xi/extgrbdev.c
	Xi/xiproperty.c
	configure.ac
	dix/ptrveloc.c
	hw/xfree86/common/xf86Config.c
	mi/mipointer.h
	test/input.c
	xkb/xkb.c
2009-05-28 17:20:58 +10:00
Peter Hutterer
c9df51b070 input: allow for master pointers to not have a button class.
There's devices (e.g. some barcode readers) that have axes but no buttons.
When such a device sends a motion event, the valuator and button class is
copied into the master pointer (i.e. removing the button class).
So we need a couple of extra sanity checks for the button class to exist.

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

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

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

This patch replaces isMaster with "type", one of SLAVE, MASTER_POINTER and
MASTER_KEYBOARD. All checks for dev->isMaster are replaced with an
IsMaster(dev).
2009-05-22 15:44:50 +10:00
Tomas Janousek
525aa17f80 Bug #6428, #16458, #21464: Fix crash due to uninitialized VModMap fields.
In ProcXkbGetKbdByName, mrep.firstVModMapKey, .nVModMapKeys and
.totalVModMapKeys were not initialized, contained random values and caused
accesses to unallocated and later modified memory, causing
XkbSizeVirtualModMap and XkbWriteVirtualModMap to see different number of
nonzero values, resulting in writes past the end of an array in XkbSendMap.

This patch initializes those values sensibly and reverts commits 5c0a2088 and
6dd4fc46, which have been plain non-sense.

Signed-off-by: Tomas Janousek <tomi@nomi.cz>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-22 12:24:21 +10:00
Peter Hutterer
1cce55cc03 input: rename device->type to device->xinput_type.
This type is only used in XI to give a hint of what type this device may be.
Call it xinput_type for clarity.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-21 10:42:35 +10:00
Tomas Janousek
81b3b0cce0 Bug #6428, #16458, #21464: Fix crash due to uninitialized VModMap fields.
In ProcXkbGetKbdByName, mrep.firstVModMapKey, .nVModMapKeys and
.totalVModMapKeys were not initialized, contained random values and caused
accesses to unallocated and later modified memory, causing
XkbSizeVirtualModMap and XkbWriteVirtualModMap to see different number of
nonzero values, resulting in writes past the end of an array in XkbSendMap.

This patch initializes those values sensibly and reverts commits 5c0a2088 and
6dd4fc46, which have been plain non-sense.

Signed-off-by: Tomas Janousek <tomi@nomi.cz>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-21 10:42:35 +10:00
Peter Hutterer
8fb51feae2 xkb: if kbd init failed, NULL out the pointers after freeing them (#21278)
Reproducible:
Configure a server that uses the keyboard driver with an invalid ruleset,
e.g. (Option "XkbRules" "foobar"). Ensure that Option "AllowEmptyInput" is
"off" in the ServerFlags or ServerLayout section. Start the server.
After failing to init the keymap, the server will try to clean up after the
device, double-freeing some xkb structs that have not been reset properly.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-16 12:20:58 +10:00
Peter Hutterer
ac13145dbc xkb: if kbd init failed, NULL out the pointers after freeing them (#21278)
Reproducible:
Configure a server that uses the keyboard driver with an invalid ruleset,
e.g. (Option "XkbRules" "foobar"). Ensure that Option "AllowEmptyInput" is
"off" in the ServerFlags or ServerLayout section. Start the server.
After failing to init the keymap, the server will try to clean up after the
device, double-freeing some xkb structs that have not been reset properly.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-11 15:54:12 +10:00
Peter Hutterer
9c5b761c8c Revert "xkb: write the _XKB_RF_RULES_PROP to each device."
This commit shouldn't have been pushed, we're still sorting out the API we
want to use.

This reverts commit 876910a951.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-09 16:19:42 +10:00
Peter Hutterer
5cf7018381 xkb: remove _XkbAlloc, _XkbCalloc, _XkbRealloc and _XkbFree
We all agree that wrapping is fun, but seriously. One of these days someone
will get hurt.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-08 14:28:53 +10:00
Peter Hutterer
0e31d3906d xkb: remove some now-useless XFUNCPROTOBEGIN
We bring them back if we start rewriting the server in C++, promise.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-08 14:28:44 +10:00
Peter Hutterer
d220d6907d Xi: add GrabButton and GrabKeysym code.
We don't do keycode grabs in XI2, they're pointless.
2009-05-06 14:37:33 +10:00
Peter Hutterer
35a4b8e7f4 xkb: remove oldState from XkbHandleActions.
I really don't know what the purpose of this variable is or was, aside from
potentially clobbering up our key state since there's a path where it may be
used uninitialised.

Also, this means that xkbi->prev_state is now accessible from the DIX with
meaningful data.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-06 14:37:32 +10:00
Alan Coopersmith
557dbadf3b XkbSetNamedIndicator should ignore SD's without LED's
When ProcXkbSetNamedIndicator is called on a core device, and we
walk the slaves to set the LED's on each of them, ignore any slaves
that do not have either a KbdFeedbackCtrl or LedCtrl structure.

(This is much more critical in xserver-1.5-branch, where we walk
 *all* devices, not just the slaves of the specified master, and
 thus return failure when setting an LED on the Core Keyboard and
 hit a xf86-input-mouse device with no LED's to set.)

Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-03 20:11:21 -07:00
Peter Hutterer
876910a951 xkb: write the _XKB_RF_RULES_PROP to each device.
We only have one root window and writing the rules used to the same property
for each device is quite pointless if you don't have the same RMLVO on all
devices. So let's be sensible and write the same property to the device too,
so at least we know which device got loaded with which RMLVO.
2009-05-01 09:07:39 +10:00
Peter Hutterer
057fc9a4f8 Merge branch 'master' into xi2
Conflicts:
	Xi/chdevhier.c
	include/input.h
2009-04-24 16:15:47 +10:00
Colin Harrison
6559f02ef8 xkb: set bell_func in InitKeyboardDeviceStruct.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-20 16:40:34 +10:00
Peter Hutterer
d5ad14c8ed Merge branch 'master' into xi2 2009-04-19 22:28:22 +10:00
Peter Hutterer
62d2fb6863 xkb: Add XkbFreeRMLVOSet helper function.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Dan Nicholson <dbn.lists@gmail.com>
2009-04-19 22:20:18 +10:00
Peter Hutterer
56a5955c8c xkb: strdup the values returned by XkbGetRulesDflts
XkbGetRulesDftls may get a copy of what will later be freed when passed into
XkbSetRulesDftls.

On the second run of XkbGet/SetRulesDflts:
XkbGetRulesDflts(rmlvo)
        rmlvo->rules = current-rules

XkbSetRulesDflts(rmlvo)
        free(current-rules)
        current-rules = strdup(rmlvo->rules)

Leaving us with garbage in current-rules.

This patch requires callers of XkbGetRulesDflts to free the associated memory.

See also
http://lists.freedesktop.org/archives/xorg-devel/2009-February/000305.html

Reported-by: Benjamin Close <Benjamin.Close@clearchain.com>
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:04:28 +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
6c3b633299 Merge branch 'master' into xi2 2009-04-07 19:36:27 +10:00
Maarten Maathuis
d698e62690 xkb: plug a memory leak in XkbCopySrvLedInfo (#20756)
X.Org Bug 20756 <http://bugs.freedesktop.org/show_bug.cgi?id=20756>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-23 16:07:23 +10:00
Peter Hutterer
e26f79335b xkb: put a few extra checks in against non-keyboards 2009-03-23 16:07:05 +10:00
Peter Hutterer
04ed0bcb25 xkb: remove Device/Enter leave handling - XI2 enter/leave don't have compat state. 2009-03-20 15:17:55 +10:00
Peter Hutterer
836864b657 xkb: don't overrun the map index when accessing symbols.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-20 14:48:57 +10:00
Peter Hutterer
4eeaee1e5a xkb: xkbi has a pointer to the device - use this instead of inputInfo.pointer. 2009-03-16 13:29:07 +10:00
Peter Hutterer
3f801ba62a xkb: the VCP can post device events, don't stop xkb filtering on it. 2009-03-16 13:29:07 +10:00
Peter Hutterer
23686e5680 xkb: Fix a mis-use of inputInfo.keyboard. 2009-03-16 13:29:07 +10:00
Peter Hutterer
c97c6c3de3 xkb: fix a couple of device checks when looping through all devices.
Generally, we want to apply stuff to the device and to all attached slave
devices.
2009-03-16 13:29:07 +10:00
Jason Vas Dias
e0ed9f16d0 Fix build with --enable-debug.
[amended by Peter Hutterer]
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-03 16:53:06 +10:00
Peter Hutterer
763848d3ab Input: change processing API to InternalEvents.
Don't pass xEvent* and count through to processing, pass a single
InternalEvent.

Custom handlers are disabled for the time being. And for extra fun,
XKB's pointer motion emulation is disabled. But stick an error in there so
that we get reminded should we forget about it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-23 17:52:40 +10:00
Peter Hutterer
0b4066c116 xkb: _XkbFilterRedirectKey needs to pass InternalEvents down.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-23 17:52:40 +10:00
Peter Hutterer
8829d966a6 Xi: support InternalEvents in UpdateDeviceState, parts of POE and EnqueueEvent
Note that this breaks DGA. Life is tough.

EnqueueEvent is a somewhat half-baked solution, we immediately drop back into
XI and store them. But it should in theory work.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

Don't let the dcce be random data.
2009-02-23 17:52:39 +10:00
Peter Hutterer
007e93c869 xkb: Switch the xkb event processing path over to InternalEvents.
Before dropping down into the DIX, convert back into XI events. This is a
temporary solution only, until the DIX is capable of handling InternalEvents
anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-23 17:52:39 +10:00
Dan Nicholson
225853d51d xkb: Use cached XKB keymap when rules haven't changed
Rather than compiling a new keymap every time InitKeyboardDeviceStruct
is called, cache the previous keymap and reuse it if the rules have not
changed.

Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
Acked-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-20 09:42:27 +10:00
Peter Hutterer
f5bf1fdaf3 xkb: Fix wrong colour reference in XKB geometry copying. #20081
base_color and label_color need to reference the color in the destination, not
in the source.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2009-02-17 08:04:16 +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
Adam Jackson
0bad0552bf XKB: Remove -kb and +kb from -help text and man page. 2009-02-04 17:21:19 -05:00
Tomas Carnecky
a88995dfb8 Make gcc happy: correct third argument of CopyGetMasterEvent()
Signed-off-by: Tomas Carnecky <tom@dbservice.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-04 09:43:44 +10:00