Version

Quick search

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. If you want to use them 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 x, y and pos properties.

multitouch_sim

Specifies whether multitouch is simulated or not. Accessed via the ‘multitouch_sim’ property.

class kivy.input.providers.mouse.MouseMotionEventProvider(device, args)[source]

Bases: kivy.input.provider.MotionEventProvider

property disable_hover

Disables dispatching of hover events if set to True (default).

New in version 2.1.0.

start()[source]

Start the mouse provider

stop()[source]

Stop the mouse provider

update(dispatch_fn)[source]

Update the mouse provider (pop event from the queue)