for each user, needs modifications in /home/[user]/.kivy/config.ini
specifically check these sections:
[input]
mouse = mouse
mtdev_%(name)s = probesysfs,provider=mtdev
%(name)s = probesysfs,provider=hidinput
[modules]
cursor = texture = cursor.png,size=32x32
/usr/local/lib/python3.7/dist-packages/kivy/modules/cursor.py
from os.path import join
from functools import partial
__all__ = ('start', 'stop')
from kivy.core.image import Image
from kivy.graphics import Color, Rectangle
from kivy import kivy_data_dir
from kivy.compat import string_types
def _mouse_move_constrain(win, pos):
if pos[0] < 0:
_x = 0
elif pos[0] > 1910:
_x = 1910
else:
_x = pos[0]
if pos[1] > 1080:
_y = 1048
elif pos[1] < 12:
_y = -20
else:
_y = pos[1]-32
win._cursor.pos = _x, _y
def _mouse_move(texture, size, offset, win, pos, *args):
global cursor_texture
global cursor_size
global cursor_offset
if hasattr(win, '_cursor'):
c = win._cursor
else:
with win.canvas.after:
Color(1, 1, 1, 1, mode='rgba')
win._cursor = c = Rectangle(texture=texture, size=size)
win.unbind(mouse_pos=_mouse_move)
win.bind(
mouse_pos=partial(
_mouse_move_constrain))
# c.pos = pos[0] + offset[0], pos[1] - size[1] + offset[1]
c.pos = pos[0], pos[1] - 32
def start(win, ctx):
cursor_texture = Image(
ctx.config.get('texture', join(kivy_data_dir, 'images', 'cursor.png'))
).texture
cursor_size = ctx.config.get('size')
if isinstance(cursor_size, string_types):
cursor_size = [int(x) for x in cursor_size.split('x')]
elif not cursor_size:
cursor_size = cursor_texture.size
cursor_offset = ctx.config.get('offset', (0, 0))
if isinstance(cursor_offset, string_types):
cursor_offset = [int(x) for x in cursor_offset.split('x')]
win.bind(
mouse_pos=partial(
_mouse_move, cursor_texture, cursor_size, cursor_offset))
def stop(win, ctx):
win.unbind(mouse_pos=_mouse_move_constrain)