Table Of Contents
Mouse provider implementation¶
On linux systems, the mouse provider can be annoying when used with another multitouch provider (hidinput or mtdev). The Mouse can conflict with them: a single touch can generate one event from the mouse provider and another from the multitouch provider.
To avoid this behavior, you can activate the “disable_on_activity” token in the mouse configuration. Then, if any touches are created by another provider, the mouse event will be discarded. Add this to your configuration:
[input]
mouse = mouse,disable_on_activity
Using multitouch interaction with the mouse¶
New in version 1.3.0.
By default, the middle and right mouse buttons, as well as a combination of ctrl + left mouse button are used for multitouch emulation.
When multitouch simulation is enabled, pressing the right or middle button (or ctrl + left button) places a red dot on screen representing a held touch. The dot follows the cursor while the button is held, then stays fixed at its last position until it is picked up again (by clicking near it) or removed (by clicking on it with the left button). Pressing ctrl + left click behaves identically to a right-click for multitouch emulation purposes.
If you want to use these mouse buttons for other purposes, you can disable this behavior by activating the “disable_multitouch” token:
[input]
mouse = mouse,disable_multitouch
Changed in version 1.9.0.
You can now selectively control whether a click initiated as described above will emulate multi-touch. If the touch has been initiated in the above manner (e.g. right mouse button), a multitouch_sim value will be added to the touch’s profile, and a multitouch_sim property will be added to the touch. By default, multitouch_sim is True and multitouch will be emulated for that touch. If, however, multitouch_on_demand is added to the config:
[input]
mouse = mouse,multitouch_on_demand
then multitouch_sim defaults to False. In that case, if multitouch_sim is set to True before the mouse is released (e.g. in on_touch_down/move), the touch will simulate a multi-touch event. For example:
if 'multitouch_sim' in touch.profile:
touch.multitouch_sim = True
Changed in version 2.1.0.
Provider dispatches hover events by listening to properties/events in
Window. Dispatching can be disabled by setting
MouseMotionEventProvider.disable_hover to True or by adding
disable_hover in the config:
[input]
mouse = mouse,disable_hover
It’s also possible to enable/disable hover events at runtime with
MouseMotionEventProvider.disable_hover property.
Following is a list of the supported values for the
profile property list.
Profile value |
Description |
button |
Mouse button (one of left, right, middle, scrollup or scrolldown). Accessed via the ‘button’ property. |
pos |
2D position. Also reflected in the
|
multitouch_sim |
Specifies whether multitouch is simulated or not. Accessed via the ‘multitouch_sim’ property. |
modifiers |
Active keyboard modifiers (list of strings: ‘ctrl’, ‘alt’, ‘shift’, etc.). Accessed via the ‘modifiers’ property. |
- class kivy.input.providers.mouse.MouseMotionEventProvider(device, args)¶
Bases:
kivy.input.provider.MotionEventProvider- start()¶
Start the mouse provider
- stop()¶
Stop the mouse provider
- update(dispatch_fn)¶
Update the mouse provider (pop event from the queue)