kivy / kivy-ios

Toolchain for compiling Python / Kivy / other libraries for iOS
https://kivy.org/docs/guide/packaging-ios.html
MIT License
759 stars 238 forks source link

extra Button on_press event if disable_multitouch is set #685

Open RobertFlatt opened 2 years ago

RobertFlatt commented 2 years ago

Versions

Describe the bug A Button press generates two on_press events if disable_multitouch is set.

In the example below on iOS the count is always an even number. If 'disable_multitouch' is removed, the count increments by one as expected.

On Windows each touchpad tap increments the count by one as expected.

To Reproduce

from kivy.app import App
from kivy.uix.button import Button

from kivy.config import Config 
Config.set('input', 'mouse', 'mouse, disable_multitouch')

class MyApp(App):

    def build(self, **args):
        self.push_count = 0
        self.button = Button(text = 'Tap a few times',
                             on_press = self.increment)
        return self.button

    def increment(self, *args):
        self.push_count = self.push_count + 1
        self.button.text = 'Number of taps = ' + str(self.push_count)

MyApp().run()

Additional context I have observed that on iOS, Kivy generates touch events with an integer touch.id as expected. It also generates redundant derivative touch events with touch.id of the form "mouseNN", filtering these events on_touch_down() removes aberrant behavior in custom event handling.

Clearly "mouse" events are unexpected in this context. It is possible this is a Kivy issue, that is exposed in the iOS context.

It might be informative to test using a Windows machine with a touch screen. (I don't have one)