Skip to content

Commit 542a813

Browse files
authored
WindowBase: Don't return motion event in transform_motion_event_2d method. (kivy#7778)
1 parent 1830123 commit 542a813

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

kivy/core/window/__init__.py

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1543,8 +1543,8 @@ def to_normalized_pos(self, x, y):
15431543
)
15441544

15451545
def transform_motion_event_2d(self, me, widget=None):
1546-
'''Returns transformed motion event `me` to this window size and then
1547-
if `widget` is passed transforms `me` to `widget`'s local coordinates.
1546+
'''Transforms the motion event `me` to this window size and then if
1547+
`widget` is passed transforms `me` to `widget`'s local coordinates.
15481548
15491549
:raises:
15501550
`AttributeError`: If widget's ancestor is ``None``.
@@ -1564,22 +1564,20 @@ def transform_motion_event_2d(self, me, widget=None):
15641564
smode=self.softinput_mode,
15651565
kheight=self.keyboard_height
15661566
)
1567-
if widget is None:
1568-
return me
1569-
parent = widget.parent
1570-
try:
1571-
if parent:
1572-
me.apply_transform_2d(parent.to_widget)
1573-
else:
1574-
me.apply_transform_2d(widget.to_widget)
1575-
me.apply_transform_2d(widget.to_parent)
1576-
except AttributeError:
1577-
# when using inner window, an app have grab the touch
1578-
# but app is removed. The touch can't access
1579-
# to one of the parent. (i.e, self.parent will be None)
1580-
# and BAM the bug happen.
1581-
raise
1582-
return me
1567+
if widget is not None:
1568+
parent = widget.parent
1569+
try:
1570+
if parent:
1571+
me.apply_transform_2d(parent.to_widget)
1572+
else:
1573+
me.apply_transform_2d(widget.to_widget)
1574+
me.apply_transform_2d(widget.to_parent)
1575+
except AttributeError:
1576+
# when using inner window, an app have grab the touch
1577+
# but app is removed. The touch can't access
1578+
# to one of the parent. (i.e, self.parent will be None)
1579+
# and BAM the bug happen.
1580+
raise
15831581

15841582
def _apply_transform(self, m):
15851583
return m

0 commit comments

Comments
 (0)