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).
dev->u.lastSlave was not signal safe since it was accessed by the DIX and
during signal handling.
Replaced with:
'dev->last.slave' for the signal handler's lastSlave (used to generate
DeviceChangedEvents), .
'dev->u.lastSlave' for the DIX lastSlave (currently only used in
change_modmap)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
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>
A device can only be attached to a single master device. So instead of
looping and searching for the master device, we can just use dev->u.master
directly.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Historically, if no input device was referenced in the ServerLayout,
the server would pick the first "mouse" device found in the xorg.conf.
This patch gives evdev, synaptics, vmmouse and void the same status. If
there is a section in the config file using this driver - use it as the core
pointer.
Device selection is in driver-order, not in config-order. If a "mouse"
device is listed after a "synaptics" device, the "mouse" device gets
preference. This replicates the original behaviour.
This code only takes effect if AllowEmptyInput is off and there is no core
pointer in the server layout.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
According to the RENDER spec, the origin of the alpha map is
interpreted relative to the origin of the drawable of the image, not
the origin of drawable of the alpha map.
The only use of alpha maps I have been able to find is in Qt and they
don't use a non-zero alpha origin.
Many old monitors zero-fill the detailed descriptors, so check for that
to avoid a useless warning like:
(WW) RADEON(0): Unknown vendor-specific block 0
Historically, if no input device was referenced in the ServerLayout,
the server would pick the first "mouse" device found in the xorg.conf.
This patch gives evdev, synaptics, vmmouse and void the same status. If
there is a section in the config file using this driver - use it as the core
pointer.
Device selection is in driver-order, not in config-order. If a "mouse"
device is listed after a "synaptics" device, the "mouse" device gets
preference. This replicates the original behaviour.
This code only takes effect if AllowEmptyInput is off and there is no core
pointer in the server layout.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
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>
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>
If the device is disabled ("off"), it must not send events to a client.
The driver shouldn't send events in that case anyway, but just to make sure
we simply drop events coming while the device is disabled.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This approach is broken anyway. DIPT only checked for the XInput type
"MOUSE" and the only user of this is xf86ActivateDevice when it sets the
Activate/DeactivateGrab functions.
Since synaptics and wacom set their own types, evdev only sets MOUSE for,
well, mice half the devices didn't have this set correctly anyway.
Instead, ActivatePointerGrab should be merged together with
ActivateKeyboardGrab.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
A device can only be attached to a single master device. So instead of
looping and searching for the master device, we can just use dev->u.master
directly.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Add a proper access mode, and reverse the logic of the return value.
Zero ("Success") is returned on success from the hook calls.
Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
This way we don't always need to scan over previously allocated areas when
looking for an available one, and there might be less fragmentation.
Signed-off-by: Michel Dänzer <daenzer@vmware.com>
At most once per second, under the following circumstances:
* We can't satisfy an offscreen memory allocation, but there seems to be enough
offscreen memory available in total.
or
* The server has been idle for at least 100ms, and there is more than one
available offscreen area.
Signed-off-by: Michel Dänzer <daenzer@vmware.com>
Commit 987579c930 moves main.c into
into libmain.a to be linked with separately, and updates the various
DDXs to link with libmain.a, except Xwin, which also needs this change.
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Buttons append 4-byte units to the end of the reply, they need to be
included too.
Reported-by: Mark Dokter
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Both values need to fail the request, so we need to check them before
looping through the modifier masks. Otherwise, a wrong grab_window will
show up in each failed modifier return but not actually cause an error.
This function was deprecated in ef68273f5b
because it didn't take a device argument. The device argument was added in
1c7568b8a1 though, so the deprecation is
obsolete.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
There's only two reasons for hierarchy events:
- device is added, removed, etc. In this case we want to send the event as
it happens.
- devices are added in a XIChangeDeviceHierarchy request. In this case we
only want one event cumulating all changes.
Rather than have one field per hierarchy change, XI2 has two fields - one
generic one and one per-device that include the device-specific flags.
This requires some funky handling for removed devices, but oh well.
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>
Xephyr doesn't manually set Activate/DeactivateGrab for new devices,
resulting in a NULL-pointer dereference later when a grab is activated.
Avoid the segfault by ensuring that the pointer is always valid.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Xephyr doesn't manually set Activate/DeactivateGrab for new devices,
resulting in a NULL-pointer dereference later when a grab is activated.
Avoid the segfault by ensuring that the pointer is always valid.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This function was deprecated in ef68273f5b
because it didn't take a device argument. The device argument was added in
1c7568b8a1 though, so the deprecation is
obsolete.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
It reports vertical size in cm in the detailed mode.
X.Org bug#21750 <http://bugs.freedesktop.org/show_bug.cgi?id=21750>
Reported-by: Peter Poklop <Peter.Poklop@gmx.at>
Signed-off-by: Julien Cristau <jcristau@debian.org>