Commit Graph

484 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult bae6cbc8ca include: move private defs to dixstruct_priv.h
Public server module API shouldn't be clobbered with private definitions,
thus move them out to dixstruct_priv.h

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1289>
2024-04-30 00:47:38 +00:00
Enrico Weigelt, metux IT consult d444cd4237 dix: unexport some lookup functions
These aren't used by any drivers, so no need to export them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1380>
2024-04-15 18:11:57 -07:00
Enrico Weigelt, metux IT consult a3ebe4fa41 dix: move non-exported ptrveloc functions to separate header
unclutter ptrveloc.h by moving non-exported declarations into their own
private header file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1347>
2024-03-09 18:01:52 +00:00
Peter Hutterer eaa92ea422 Revert "include: move BUG_*() macros to separate header"
This breaks the xf86-input-synaptics driver:

  synaptics.c: In function 'clickpad_guess_clickfingers':
  synaptics.c:2638:5: error: implicit declaration of function 'BUG_RETURN_VAL' [-Werror=implicit-function-declaration]
   2638 |     BUG_RETURN_VAL(hw->num_mt_mask > sizeof(close_point) * 8, 0);

This reverts commit 442aec2219.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1316>
2024-02-23 23:11:01 +00:00
Enrico Weigelt 442aec2219 include: move BUG_*() macros to separate header
Yet another step of uncluttering includes: move out the BUG_* macros
into a separate header, which then is included as-needed.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-02-15 23:33:46 +00:00
Peter Hutterer 26769aa71f dix: when disabling a master, float disabled slaved devices too
Disabling a master device floats all slave devices but we didn't do this
to already-disabled slave devices. As a result those devices kept their
reference to the master device resulting in access to already freed
memory if the master device was removed before the corresponding slave
device.

And to match this behavior, also forcibly reset that pointer during
CloseDownDevices().

Related to CVE-2024-21886, ZDI-CAN-22840
2024-01-16 09:24:31 +01:00
José Expósito bc1fdbe465 Xi: do not keep linked list pointer during recursion
The `DisableDevice()` function is called whenever an enabled device
is disabled and it moves the device from the `inputInfo.devices` linked
list to the `inputInfo.off_devices` linked list.

However, its link/unlink operation has an issue during the recursive
call to `DisableDevice()` due to the `prev` pointer pointing to a
removed device.

This issue leads to a length mismatch between the total number of
devices and the number of device in the list, leading to a heap
overflow and, possibly, to local privilege escalation.

Simplify the code that checked whether the device passed to
`DisableDevice()` was in `inputInfo.devices` or not and find the
previous device after the recursion.

CVE-2024-21886, ZDI-CAN-22840

This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative
2024-01-16 09:24:31 +01:00
Peter Hutterer de0031eefd dix: initialize the XTest sendEventsProc for all devices
XTest requests lets the client specify a device ID, only if none
is specified do we fall back to the XTEST special device.
As of commit
  aa4074251 input: Add new hook DeviceSendEventsProc for XTEST
regular devices are no longer able to send XTest events because they
have no sendEventsProc set.

This caused issue #1574 and the crash was fixed with commit
  e820030de xtest: Check whether there is a sendEventsProc to call
but we still cannot send XTest events through a specific device.

Fix this by defaulting every device to the XTest send function and
punting it to the DDX (i.e. Xwayland) to override the devices as
necessary.

Fixes e820030de2
Fixes aa4074251f
2024-01-09 00:45:31 +00:00
Peter Hutterer d0b0137a95 Two whitespace fixes 2024-01-09 09:49:54 +10:00
Peter Hutterer 0a9f223eec dix: factor out the duplicate the RemoveDevice code paths
This is the same loop twice, once over inputInfo.devices and once over
inputInfo.off_devices, let's make both the same.
2024-01-09 09:49:54 +10:00
Peter Hutterer 2cee5fb36c test: fix various leaks in the tests 2024-01-09 09:49:54 +10:00
Peter Hutterer 373cd80081 dix: use valuator_mask_free() to free the last touches vmask
No functional effect since that one is just a free() call anyway.
2024-01-09 09:49:54 +10:00
Peter Hutterer 7aba2514b2 dix: don't allow for devices with 0 axes
This just makes the existing behavior explicit, previously we relied on
a malloc(numAxes * ...) to return NULL to error out.
2024-01-09 09:49:54 +10:00
Peter Hutterer 0c1a93d319 Xi: allocate enough XkbActions for our buttons
button->xkb_acts is supposed to be an array sufficiently large for all
our buttons, not just a single XkbActions struct. Allocating
insufficient memory here means when we memcpy() later in
XkbSetDeviceInfo we write into memory that wasn't ours to begin with,
leading to the usual security ooopsiedaisies.

CVE-2023-6377, ZDI-CAN-22412, ZDI-CAN-22413

This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative
2023-12-13 10:44:49 +10:00
Peter Hutterer 45009fb7f5 dix: clean up the GestureInfoRec on device close
Direct leak of 1080 byte(s) in 3 object(s) allocated from:
    #0 0x7f00a4ed8cc7 in calloc (/lib64/libasan.so.8+0xd8cc7) (BuildId: 6f17f87dc4c1aa9f9dde7c4856604c3a25ba4872)
    #1 0x59f740 in InitGestureClassDeviceStruct ../dix/devices.c:1692
    #2 0x418a0b in xwl_pointer_proc_pointer_gestures ../hw/xwayland/xwayland-input.c:325
    #3 0x598e5c in ActivateDevice ../dix/devices.c:578
    #4 0x420207 in init_pointer_gestures_device ../hw/xwayland/xwayland-input.c:1677
    #5 0x420bf1 in seat_handle_capabilities ../hw/xwayland/xwayland-input.c:1801
    #6 0x7f00a4145055 in ffi_call_unix64 (/lib64/libffi.so.8+0x9055) (BuildId: 308041eea4a8d89d9265d3c24b7261dfbe44a61e)

Acked-by: Olivier Fourdan <ofourdan@redhat.com>
2023-12-05 14:21:28 +10:00
Yao Wei 7ce57e179b dix: Force update LEDs after device state update in EnableDevice
This is to make sure the hardware gets the device states regardless
whether the internal state has changed or not, to overcome situations
that device LEDs are out of sync e.g. switching between VTs.

Signed-off-by: Yao Wei (魏銘廷) <yao.wei@canonical.com>
2023-02-21 03:43:05 +00:00
Olivier Fourdan e196535abb dix: Clear device sprite after free in AttachDevice()
The code in AttachDevice() may free the dev->spriteInfo->sprite under
some circumstances and later call GetCurrentRootWindow() which uses
the same dev->spriteInfo->sprite.

While it seems unlikely that this is actually an issue, considering the
cases where one or the other get called, it still makes the code look
suspicious.

Make sure to clear set dev->spriteInfo->sprite to NULL  immediately
after it's freed to avoid any confusion, even if only to clarify the
code.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1436
2023-02-09 23:54:11 +00:00
Povilas Kanapickas 1801fe0ac3 dix: Fix use after free in input device shutdown
This fixes access to freed heap memory via dev->master. E.g. when
running BarrierNotify.ReceivesNotifyEvents/7 test from
xorg-integration-tests:

==24736==ERROR: AddressSanitizer: heap-use-after-free on address
0x619000065020 at pc 0x55c450e2b9cf bp 0x7fffc532fd20 sp 0x7fffc532fd10
READ of size 4 at 0x619000065020 thread T0
    #0 0x55c450e2b9ce in GetMaster ../../../dix/devices.c:2722
    #1 0x55c450e9d035 in IsFloating ../../../dix/events.c:346
    #2 0x55c4513209c6 in GetDeviceUse ../../../Xi/xiquerydevice.c:525
../../../Xi/xichangehierarchy.c:95
    #4 0x55c450e3455c in RemoveDevice ../../../dix/devices.c:1204
../../../hw/xfree86/common/xf86Xinput.c:1142
    #6 0x55c450e17b04 in CloseDeviceList ../../../dix/devices.c:1038
    #7 0x55c450e1de85 in CloseDownDevices ../../../dix/devices.c:1068
    #8 0x55c450e837ef in dix_main ../../../dix/main.c:302
    #9 0x55c4517a8d93 in main ../../../dix/stubmain.c:34
(/lib/x86_64-linux-gnu/libc.so.6+0x28564)
    #11 0x55c450d0113d in _start (/usr/lib/xorg/Xorg+0x117713d)

0x619000065020 is located 160 bytes inside of 912-byte region
[0x619000064f80,0x619000065310)
freed by thread T0 here:
(/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10d7cf)
    #1 0x55c450e19f1c in CloseDevice ../../../dix/devices.c:1014
    #2 0x55c450e343a4 in RemoveDevice ../../../dix/devices.c:1186
../../../hw/xfree86/common/xf86Xinput.c:1142
    #4 0x55c450e17b04 in CloseDeviceList ../../../dix/devices.c:1038
    #5 0x55c450e1de85 in CloseDownDevices ../../../dix/devices.c:1068
    #6 0x55c450e837ef in dix_main ../../../dix/main.c:302
    #7 0x55c4517a8d93 in main ../../../dix/stubmain.c:34
(/lib/x86_64-linux-gnu/libc.so.6+0x28564)

previously allocated by thread T0 here:
(/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10ddc6)
    #1 0x55c450e1c57b in AddInputDevice ../../../dix/devices.c:259
    #2 0x55c450e34840 in AllocDevicePair ../../../dix/devices.c:2755
    #3 0x55c45130318f in add_master ../../../Xi/xichangehierarchy.c:152
../../../Xi/xichangehierarchy.c:465
    #5 0x55c4512cb9f5 in ProcIDispatch ../../../Xi/extinit.c:390
    #6 0x55c450e6a92b in Dispatch ../../../dix/dispatch.c:551
    #7 0x55c450e834b7 in dix_main ../../../dix/main.c:272
    #8 0x55c4517a8d93 in main ../../../dix/stubmain.c:34
(/lib/x86_64-linux-gnu/libc.so.6+0x28564)

The problem is caused by dev->master being not reset when disabling the
device, which then causes dangling pointer when the master device itself
is being deleted when exiting whole server.

Note that RecalculateMasterButtons() requires dev->master to be still
valid, so we can reset it only at the end of function.

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2022-02-09 11:36:48 +00:00
tholin dc7cb45482 dix: Hold input lock for AttachDevice()
Fix the following race:

Possible data race during read of size 8 at 0xA112510 by thread #6
Locks held: 1, at address 0x366B40
   at 0x14C8B9: GetMaster (devices.c:2691)
   by 0x15CFC5: IsFloating (events.c:346)
   by 0x2B9554: miPointerGetScreen (mipointer.c:527)
   by 0x1A5136: xf86PostButtonEventM (xf86Xinput.c:1379)
   by 0x1A52BD: xf86PostButtonEvent (xf86Xinput.c:1345)
   by 0x485F45B: EvdevProcessEvent (in /usr/lib64/xorg/modules/input/evdev_drv.so)
   by 0x485FDAC: EvdevReadInput (in /usr/lib64/xorg/modules/input/evdev_drv.so)
   by 0x195427: xf86ReadInput (xf86Events.c:247)
   by 0x2CC113: InputReady (inputthread.c:180)
   by 0x2CE4EA: ospoll_wait (ospoll.c:657)
   by 0x2CC077: InputThreadDoWork (inputthread.c:369)
   by 0x484A336: mythread_wrapper (hg_intercepts.c:406)

This conflicts with a previous write of size 8 by thread #1
Locks held: none
   at 0x14D2C6: AttachDevice (devices.c:2609)
   by 0x15CF85: ReattachToOldMaster (events.c:1457)
   by 0x1647DD: DeactivateKeyboardGrab (events.c:1700)
   by 0x25D7F1: ProcXIUngrabDevice (xigrabdev.c:169)
   by 0x2552AD: ProcIDispatch (extinit.c:398)
   by 0x155291: Dispatch (dispatch.c:479)
   by 0x158CBA: dix_main (main.c:276)
   by 0x143A3D: main (stubmain.c:34)
 Address 0xa112510 is 336 bytes inside a block of size 904 alloc'd
   at 0x4846571: calloc (vg_replace_malloc.c:1328)
   by 0x14A0B3: AddInputDevice (devices.c:260)
   by 0x1A31A0: xf86ActivateDevice (xf86Xinput.c:365)
   by 0x1A4549: xf86NewInputDevice (xf86Xinput.c:948)
   by 0x1A4B44: NewInputDeviceRequest (xf86Xinput.c:1090)
   by 0x1B81FE: device_added (udev.c:282)
   by 0x1B8516: config_udev_init (udev.c:439)
   by 0x1B7091: config_init (config.c:50)
   by 0x197970: InitInput (xf86Init.c:814)
   by 0x158C6B: dix_main (main.c:250)
   by 0x143A3D: main (stubmain.c:34)
 Block was alloc'd by thread #1

The steps to trigger the race are:
1. Main thread does cleanup at mipointer.c:360 setting the slave device's
   miPointerPtr to null.
2. Input thread use MIPOINTER in mipointer.c and get the slave's
   miPointerPtr = null.
3. Main thread updates dev->master at devices.c:2609.
4. MIPOINTER would now return the master's miPointerPtr but the input
   thread already got the slave's miPointerPtr in step 2 and segfaults by
   null ptr deref.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1260
Signed-off-by: Thomas Lindroth <thomas.lindroth@gmail.com>
2022-02-03 16:56:53 +00:00
Povilas Kanapickas 5163fc8bc2 Implement gesture processing logic 2021-05-30 13:26:42 +03:00
Povilas Kanapickas 7656a9c8dd dix: Implement internal gesture state handling 2021-05-30 13:26:39 +03:00
Olivier Fourdan dee2bb033e dix: Guard against non-existing PtrFeedbackPtr
Trying to change the pointer control settings on a device without
PtrFeedbackPtr would be a bug and a crash in the Xserver.

Guard against that case by returning early with a BadImplementation
error, that might kill the X11 client but the Xserver would survive.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Related: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1137
2021-02-16 09:37:46 +01:00
Povilas Kanapickas 23a8b62d34 dix: Store replayed event into GrabInfoRec struct as InternalEvent* 2020-11-25 04:20:22 +00:00
Povilas Kanapickas 56d7205921 dix: Extract DeliverDeviceClassesChangedEvent() utility function 2020-11-25 04:20:21 +00:00
Alan Coopersmith d00594ebc7 AddInputDevice: only need to check once if we failed to calloc dev
Resolves warning from Oracle Parfait static analyser:

Warning: Impossible or redundant condition
   Impossible or redundant condition [impossible-redundant-condition]:
      Condition 'dev != NULL' of branch is determined by previous branch
        at line 270 of dix/devices.c in function 'AddInputDevice'.
          Condition 'dev != NULL' from this branch implies following branch is always true at line 262

Fixes: commit 493ad83323
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-11-17 18:43:39 -08:00
Adam Jackson 89a9927b1e include: Remove now-empty site.h 2019-10-30 16:17:04 +00:00
Arthur Williams e693c9657f dix: Check for NULL spriteInfo in GetPairedDevice
There is a race when reseting the XServer that causes spriteInfo to be
NULL in GetPairedDevice resulting a segfault and subsequent crash. The
problem was noticed when opening a connection, creating master devices,
destroying master devices and closing the connection during testing.

Signed-off-by: Arthur Williams <taaparthur@gmail.com>
2019-10-06 12:18:13 -07:00
Dave Airlie ba0f5d854f devices: break after finding and removing device from lists
Coverity complains about a use after free in here after the
freeing, I can't follow the linked list so well, but whot
says the device can only be on one list once, so break should
fix it.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2018-09-12 12:26:48 +10:00
Olivier Fourdan 9f7a9be13d dix: avoid deferencing NULL PtrCtrl
PtrCtrl really makes sense for relative pointing device only, absolute
devices such as touch devices do not have any PtrCtrl set.

In some cases, if the client issues a XGetPointerControl() immediatlely
after a ChangeMasterDeviceClasses() copied the touch device to the VCP,
a NULL pointer dereference will occur leading to a crash of Xwayland.

Check whether the PtrCtrl is not NULL in ProcGetPointerControl() and
return the default control values otherwise, to avoid the NULL pointer
dereference.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1519533
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2017-12-06 11:59:28 -05:00
Jeremy Huddleston Sequoia d0c5d205a9 dix: Make InitCoreDevices() failures more verbose.
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-09-21 21:11:40 +10:00
Keith Packard 52d6a1e832 Hold input lock for deviceProc
This ensures that the deviceProc is never called while the input
thread is processing data from the device.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-09-15 07:50:38 +10:00
Keith Packard 6a5a4e6037 Remove SIGIO support for input [v5]
This removes all of the SIGIO handling support used for input
throughout the X server, preparing the way for using threads for input
handling instead.

Places calling OsBlockSIGIO and OsReleaseSIGIO are marked with calls
to stub functions input_lock/input_unlock so that we don't lose this
information.

xfree86 SIGIO support is reworked to use internal versions of
OsBlockSIGIO and OsReleaseSIGIO.

v2: Don't change locking order (Peter Hutterer)
v3: Comment weird && FALSE in xf86Helper.c
    Leave errno save/restore in xf86ReadInput
    Squash with stub adding patch (Peter Hutterer)
v4: Leave UseSIGIO config parameter so that
    existing config files don't break (Peter Hutterer)
v5: Split a couple of independent patch bits out
    of kinput.c (Peter Hutterer)

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-05-26 16:07:54 -07:00
Adam Jackson 137ac094e7 dix: Push UpdateCurrentTimeIf down out of the main loop
This was added in:

    commit 312910b4e3
    Author: Chase Douglas <chase.douglas@canonical.com>
    Date:   Wed Apr 18 11:15:40 2012 -0700

        Update currentTime in dispatch loop

Unfortunately this is equivalent to calling GetTimeInMillis() once per
request. In the absolute best case (as on Linux) you're only hitting the
vDSO; on other platforms that's a syscall. Either way it puts a pretty
hard ceiling on request throughput.

Instead, push the call down to the requests that need it; basically,
grab processing and event generation.

Cc: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-05-04 10:58:01 -04:00
Adam Jackson a5dd7b890f dix: Squash some new gcc6 warnings
-Wlogical-op now tells us:

    devices.c:1685:23: warning: logical ‘and’ of equal expressions

Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-04-29 11:19:58 -04:00
Peter Hutterer 3f0d3201f3 dix: fix indentation
from 9ff89a2e46

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-20 12:44:54 +10:00
Jason Gerecke 9ff89a2e46 dix: Do not allow device transform to be set on valuatorless devices
If a device does not have any valuators, it makes no sense to set the
device transformation. Return a BadMatch error to let the caller know
that they're trying something stupid.

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-05-11 15:43:04 -07:00
Alan Coopersmith b9e665c8b2 Convert dix/* to new *allocarray functions
v2: remove now useless parentheses

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-04-21 16:57:08 -07:00
Peter Hutterer f485a1af64 Drop valuator mask argument from GetKeyboardEvents
Nothing was using it and if anyone had they would've gotten a warning and
noticed that it doesn't actually work. Drop this, it has been unused for years.

Input ABI 22

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2015-03-13 12:31:21 +10:00
John Hunter 6a117af7e7 fix an annotation mistake
Signed-off-by: John Hunter <zhaojunwang@pku.edu.cn>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-12 10:26:02 +10:00
Adam Jackson c695a1430b input: Remove unused SetKeySymsMap
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2014-10-08 10:10:39 +02:00
Peter Hutterer 1e30fc1b99 xkb: ignore floating slave devices when updating from master (#81885)
Introduced in 45fb3a934d. When a device is
enabled, the master's locked state is pushed to the slave. If the device is
floating, no master exists and we triggered a NULL-pointer dereference
in XkbPushLockedStateToSlaves.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-08-12 15:53:51 -07:00
Egbert Eich e6c8c7e46c BellProc: Send bell event on core protocol bell when requested
XKB allows to override the BellProc() ringing the 'keyboard bell':
instead an event is sent to an X client which can perform an
appropriate action.
In most cases this effectively prevents the core protocol bell
from ringing: if no BellProc() is set for the device, no attempt
is made to ring a bell.
This patch ensures that an XKB bell event is sent also when
the core protocol bell is rung end thus an appropriate action
can be taken by a client.

Signed-off-by: Egbert Eich <eich@freedesktop.org>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-08-04 22:02:26 -07:00
Brendan King b92d86a982 dix: fix pixmap leak on server reset
The server is leaking a pixmap (created by CreateDefaultStipple()) on
reset. The leak is caused by some X Server graphics contexts not being
freed on reset by the machine independent cursor code in the server,
which in turn is caused by the cursor cleanup code
(miSpriteDeviceCursorCleanup()) not being called.

Ensures the DeviceCursorCleanup() function is called when the associated
input device is closed on server reset.

Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-06-04 21:32:30 -07:00
Michal Srb 6a848122de input: Remove invalid bug checks.
Commit 2f1aedcaed added several bug checks. Some
of them are not correct.

Checks in Init(Ptr|String|Bell|Led|Integer)FeedbackClassDeviceStruct verify
that no feedback struct was set yet, but that is not required. If any feedback
structs are already present, the function will chain them behind the new one.

Signed-off-by: Michal Srb <msrb@suse.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-04-29 10:06:25 +10:00
Peter Hutterer 45fb3a934d xkb: push locked modifier state down to attached slave devices
Whenever the master changes, push the locked modifier state to the attached
slave devices, then update the indicators. This way, when NumLock or CapsLock
are hit on any device, the LED will light up on all devices. Likewise, a new
keyboard attached to a master device will light up with the correct
indicators.

The indicators are handled per-keyboard, depending on the layout, i.e. if one
keyboard has grp_led:num set, the NumLock LED won't light up on that keyboard.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2014-03-11 17:43:34 +10:00
Peter Hutterer 87ca80a719 dix: prevent a driver from initializing or submitting buttons > MAX_BUTTONS
The server internally relies on arrays with a MAX_BUTTONS maximum size (which
is the max the core protocol can transport). Make sure a driver adheres to
that.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2014-02-04 11:38:00 +10:00
Peter Hutterer 45f1d527f3 input: un-constify dev->name
Fallout from fecc7eb1cf, and reverts most of the
rest of that patch.

The device name is allocated and may even change during PreInit. The const
warnings came from the test codes, the correct fix here is to fix the test
code.

touch.c: In function ‘touch_init’:
touch.c:254:14: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
     dev.name = "test device";

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-02-04 11:27:48 +10:00
Keith Packard 60014a4a98 Replace 'pointer' type with 'void *'
This lets us stop using the 'pointer' typedef in Xdefs.h as 'pointer'
is used throughout the X server for other things, and having duplicate
names generates compiler warnings.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-01-12 10:24:11 -08:00
Keith Packard fecc7eb1cf xi: More warning cleanup for input
Lots more const char stuff.

Remove duplicate defs of CoreKeyboardProc and CorePointerProc from
test/xi2/protocol-common.c

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-01-12 10:14:50 -08:00
Keith Packard cb3018d8a1 Merge remote-tracking branch 'whot/unreviewed' 2013-05-23 19:58:46 -06:00