summaryrefslogtreecommitdiff
path: root/src/mouse.c
Commit message (Collapse)AuthorAgeFilesLines
* autoGood: quiet -Wimplicit-fallthrough warningAlan Coopersmith2022-10-171-0/+1
| | | | | | | | | | | | mouse.c: In function ‘autoGood’: mouse.c:3724:12: warning: this statement may fall through [-Wimplicit-fallthrough=] if (mPriv->goodCount < PROBE_UNCERTAINTY/2) ^ mouse.c:3726:5: note: here default: ^~~~~~~ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* InputDriverRec: Fix -Wmissing-field-initializers warningAlan Coopersmith2022-10-171-6/+12
| | | | | | | | | | | | mouse.c:185:1: warning: missing initializer for field ‘default_options’ of ‘InputDriverRec {aka struct _InputDriverRec}’ [-Wmissing-field-initializers] }; ^ In file included from mouse.c:63:0: /usr/include/xorg/xf86Xinput.h:83:18: note: ‘default_options’ declared here const char **default_options; ^~~~~~~~~~~~~~~ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* SetupMouse: fix -Wsign-compare warningAlan Coopersmith2022-10-161-2/+1
| | | | | | | | | mouse.c: In function ‘SetupMouse’: mouse.c:2620:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < sizeof(pMse->protoPara); i++) ^ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* checkForErraticMovements: Fix -Wempty-body warningsAlan Coopersmith2022-10-161-2/+4
| | | | | | | | | | | | mouse.c: In function ‘checkForErraticMovements’: mouse.c:3759:52: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body] AP_DBG(("accDx=%i\n",mPriv->accDx)); ^ mouse.c:3772:52: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body] AP_DBG(("accDy=%i\n",mPriv->accDy)); ^ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Fix spelling/wording issuesAlan Coopersmith2022-01-161-7/+7
| | | | | | | Found by using: codespell --builtin clear,rare,usage,informal,code,names Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Adapt to removal of xf86GetOSAdam Jackson2017-02-161-6/+5
| | | | Signed-off-by: Adam Jackson <ajax@redhat.com>
* Support ABI_XINPUT_VERSION 24 (remove LastSelectMask from block/wakeup)Keith Packard2016-09-061-9/+12
| | | | | | | | | | The block and wakeup handler API is changing so that the FD_SET type isn't visible outside the OS layer anymore. The mouse driver didn't need that argument anyways, so the change is just to adjust the APIs to avoid compiler warnings. Signed-off-by: Keith Packard <keithp@keithp.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Support ABI_XINPUT_VERSION 23 (use input_lock/input_unlock)Keith Packard2016-06-011-0/+24
| | | | | | | | | This makes using input_lock/input_unlock conditional on the ABI version so that we don't get compiler warnings when compiling with the newer server bits. Signed-off-by: Keith Packard <keithp@keithp.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Update some outdated language in a comment on obsolete hardwareAlan Coopersmith2014-07-111-1/+1
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Do not drop the result of protocol detectionMichael Thayer2014-04-181-5/+2
| | | | | | | | | | | | | | | In MousePickProtocol() with protocol PROT_AUTO we probe for the protocol to use but drop the result in most cases. This was causing DEVICE_INIT and DEVICE_ON to fail to be called with the VUID protocol. Git history suggests that this code was originally meant to cover both PS/2 auto-detection and OS- specific detection, but that only the first case was implemented at the time. Now that only the second is needed dropping the result to keep the protocol as PROT_AUTO is presumably no longer useful and seems to actively breaking things. Signed-off-by: Michael Thayer <michael.thayer@oracle.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* For wsmouse, keep 3-button emulation status.Thomas Klausner2014-03-301-0/+11
| | | | | | | | | | | With a multiplexed device like wsmouse it does not make sense to kill emulate3buttons on the first button-3-pressed event. The button-3 pressed may belong to a mouse long gone and leave the internal (two button only) mousepad useless. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> From Martin Husemann <martin@NetBSD.org> Signed-off-by: Thomas Klausner <wiz@NetBSD.org>
* Make wsmouse (re-)init the version.Thomas Klausner2014-03-301-0/+11
| | | | | | | | | This makes sure that the xserver and the mouse speak the same protocol version. Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com> From Matthew R. Green <mrg@NetBSD.org> Signed-off-by: Thomas Klausner <wiz@NetBSD.org>
* Use asprintf (or Xprintf on old servers) instead of strdup+sprintfAlan Coopersmith2013-11-031-17/+40
| | | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
* Wrap some overly long linesAlan Coopersmith2013-10-191-12/+22
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Use signal-safe logging if availablePeter Hutterer2012-10-081-18/+18
| | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@ubuntu.com>
* Fix compilation error with EXTMOUSEDEBUG onPeter Hutterer2012-08-171-2/+1
| | | | | | | pInfo->atom was removed in xorg-server-1.9.0-26-g9802cca Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Fix compiler warningsPeter Hutterer2012-07-301-7/+7
| | | | | | | | | | | | | | | | | | | | | | pnp.c: In function 'probePs2ProtocolPnP': pnp.c:711:31: warning: declaration of 'seq' shadows a previous local [-Wshadow] pnp.c:705:23: warning: shadowed declaration is here [-Wshadow] mouse.c: In function 'MouseCommonOptions': mouse.c:330:13: warning: declaration of 'i' shadows a previous local [-Wshadow] mouse.c:279:9: warning: shadowed declaration is here [-Wshadow] mouse.c: In function 'autoProbeMouse': mouse.c:3602:29: warning: declaration of 'proto' shadows a global declaration [-Wshadow] mouse.c:2482:22: warning: shadowed declaration is here [-Wshadow] Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Raise bar for xorg-server to 1.7 for XINPUT ABI 7Alan Coopersmith2012-07-241-14/+2
| | | | | | | | | Not all of the button label settings were wrapped in ABI #ifdefs, so just drop all #ifdefs for GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 7 Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
* Expand tabs to spacesAlan Coopersmith2012-04-301-2053/+2053
| | | | | | | | | | Existing code had a mix of places tab & space characters were used. Make them all spaces for consistency, since that's the new style chosen for xorg-server. "git diff -w" shows no changes - this is pure whitespace adjustment. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Strip trailing whitespaceAlan Coopersmith2012-04-301-111/+111
| | | | | | | cleanup done via: perl -p -i -e 's/[\t ]*$//' "git diff -w" shows no changes - this is pure whitespace adjustment. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Add settable properties for middle mouse button emulationAlan Coopersmith2012-04-301-7/+87
| | | | | | | | | | | | | | | Based on evdev's similar properties, including using the name "middle" button, to avoid confusion with evdev's 3rd button emulation for emulating the right button on a single button mouse. Allows manual enable & disable at runtime. Exports new xf86-mouse.pc & xf86-mouse-properties.h for property name definitions. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Alexandr Shadchin <alexandr.shadchin@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
* Set button & axis labelsAlan Coopersmith2012-04-301-1/+41
| | | | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Alexandr Shadchin <alexandr.shadchin@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
* Set XI_PROP_DEVICE_NODE property to string from "Device" optionAlan Coopersmith2012-04-301-0/+23
| | | | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Alexandr Shadchin <alexandr.shadchin@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
* Avoid NULL pointer dereference in autoProbeMouse if proto == PROT_UNSUPAlan Coopersmith2011-12-051-1/+3
| | | | | | | | | | | | | | | | | Error: Null pointer dereference (CWE 476) Read from null pointer 'GetProtocol(proto)' at line 3477 of src/mouse.c in function 'autoProbeMouse'. Function 'GetProtocol' may return constant 'NULL' at line 736, called at line 3477. Null pointer introduced at line 736 in function 'GetProtocol'. We already handle one of the two cases that make GetProtocol return NULL, proto == PROTO_UNKNOWN, but not PROT_UNSUP. [ This bug was found by the Parfait 0.4.2 bug checking tool. For more information see http://labs.oracle.com/projects/parfait/ ] Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Alexandr Shadchin <alexandr.shadchin@gmail.com>
* Fix wrong read Protocol and Device from xorg.confAlexandr Shadchin2011-08-221-0/+2
| | | | | | | | | Add call xf86CollectInputOptions() before using pInfo->options. The bug is seeing by ABI < 12. Signed-off-by: Alexandr Shadchin <Alexandr.Shadchin@gmail.com> Reviewed-by: Matthieu Herrb <matthieu.herrb@laas.fr> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* No need to merge NULL options list with existing optionsAlan Coopersmith2011-07-271-4/+4
| | | | | | | | | Appending NULL to an existing options list simply walks the entire existing list before returning it unchanged, so if we aren't creating a new list to merge, don't bother merging it either. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
* xf86-input-mouse: Return proper default for unknown values in ↵Terry Lambert2011-07-181-0/+3
| | | | | | | | pInfo->device_control. Signed-off-by: Terry Lambert <tlambert@chromium.org> Reviewed-by: Stephane Marchesin <marcheu@chromium.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Fix Solaris issues with new ABI12 init process.Alan Coopersmith2011-06-271-0/+2
| | | | | | | | | | Based on BSD changes in commit a22879c6779283684fe4a61543fc95179b4f5d0b by Alexandr Shadchin Fix segfaults when mouse device fails to open. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Fix OSMouse OS-defined protocol supportSamuel Thibault2011-03-301-0/+2
| | | | | | | | Fix regression introduced by 0a088df6: in the case of an OS-specific protocol, the protocol is PROT_UNKNOWN, but should not be rejected: the core mouse drive just needs to let the OS driver handle it. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
* Fix BSD issues with new ABI12 init process.Alexandr Shadchin2011-03-101-0/+5
| | | | | | | | | | | | | | | | | | | From Bug 34794: "Until xf86-input-mouse-1.6.0, the MousePreInit() function exited if an os specific PreInit function existed. It let the os-specific function finish all initialisations that remained to be done after osInfo->PreInit() was called. The code in master now continues, and does things that the bsdMousePreInit() function in bsd_mouse.c doesn't expect." Fix up wsconsPreInit to deal with the new init process. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=34794 Signed-off-by: Alexandr Shadchin <Alexandr.Shadchin@gmail.com> Reviewed-by: Matthieu Herrb <matthieu.herrb@laas.fr> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Adjust to new Input ABI 12.Peter Hutterer2010-11-181-22/+65
| | | | | | | New PreInit prototype and a couple of other minor changes. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
* ABI 12 requires per-valuator modes.Peter Hutterer2010-11-181-2/+10
| | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
* Use pInfo->options instead of conf-idev.Peter Hutterer2010-11-181-1/+5
| | | | | | | Because it doesn't really matter anyway, I think. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
* Remove write-only field mouseFlags.Peter Hutterer2010-10-261-22/+1
| | | | | | | | | The flags were used to store ClearDTS and ClearRTR, but those options only resulted in log messages. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Tested-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Rename xf86OSMouseInit to OSMouseInit.Peter Hutterer2010-10-261-1/+1
| | | | | | | | This isn't a DDX function anymore. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Tested-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Rename xf86OSmouse.h to mouse.hPeter Hutterer2010-10-261-2/+1
| | | | | | | | | The driver-internal mouse.h header was only an include command for xf86OSmouse.h anyway. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Tested-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Move a statement down to have all allocations close together.Peter Hutterer2010-10-261-6/+7
| | | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Tested-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Remove convoluted do { } while loop.Peter Hutterer2010-10-261-20/+15
| | | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Tested-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Move protocol ID detection into a separate function.Peter Hutterer2010-10-261-45/+57
| | | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Tested-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Use single exit path for PreInit.Peter Hutterer2010-10-261-8/+10
| | | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Tested-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* De-duplicate Option "Device" handling.Peter Hutterer2010-10-261-28/+26
| | | | | | | | | | Move the warning messages and the OS-specific autoprobing calls into a new function. This will change the order log messages appear in but functional changes should be identical. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Tested-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Remove unused branch from if 1 condition.Peter Hutterer2010-10-261-6/+0
| | | | | | | | This has been in since 2003 or earlier, let's pretend it works. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Tested-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Remove a bunch of unnecessary log prints.Peter Hutterer2010-10-261-25/+1
| | | | | | | | xf86SetFooOption will print to the log anyway, no need to print twice. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Tested-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Remove if 0'd out model.Peter Hutterer2010-10-261-13/+0
| | | | | | | | If 0 since at least 2003 is enough to pretend we don't need this block. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Tested-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Remove includes for protocol headers.Peter Hutterer2010-10-261-2/+0
| | | | | | | | The driver shouldn't need those. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Tested-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Remove unused define NEED_X86_TYPES.Peter Hutterer2010-10-261-4/+0
| | | | | | | | Not needed for 1.6 and later. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Tested-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Assume ABI_XINPUT_VERSION 4 or higher.Peter Hutterer2010-10-261-49/+0
| | | | | | | | | | We require server 1.6 in configure.ac to build, so let's assume that's the minimal ABI version we support. Purge the rest. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Gaetan Nadon <memsize@videotron.ca> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Tested-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Remove refcnt field from InputDriverRec.Peter Hutterer2010-10-251-1/+0
| | | | | | | | Wasn't used in the server and is now removed. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Tested-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Don't try to call conversion_proc anymore.Peter Hutterer2010-10-251-0/+6
| | | | | | | | | This hasn't been called since at least server 1.5 or so (ABI 2), possibly longer. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Tested-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Replace LocalDevicePtr with InputInfoPtr.Peter Hutterer2010-10-251-1/+1
| | | | | | | | | | No functional changes. The typedef has been removed from the server but was an alias for InputInfoPtr since the dawn of, well, at least git. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Tested-by: Alan Coopersmith <alan.coopersmith@oracle.com>