Skip to content

Commit 7b8d7e9

Browse files
committed
Fix to Kivy example: send mouse move events to CEF (Issue cztomczak#243)
1 parent 9756f7a commit 7b8d7e9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/linux/binaries_64bit/kivy_.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ def _cef_mes(self, *kwargs):
132132
'''Get called every frame.
133133
'''
134134
cefpython.MessageLoopWork()
135+
self.on_mouse_move_emulate()
135136

136137

137138
def _update_rect(self, *kwargs):
@@ -541,6 +542,18 @@ def on_touch_down(self, touch, *kwargs):
541542
cefpython.MOUSEBUTTON_LEFT,
542543
mouseUp=False, clickCount=1)
543544

545+
last_mouse_pos = None
546+
def on_mouse_move_emulate(self):
547+
mouse_pos = self.get_root_window().mouse_pos
548+
if self.last_mouse_pos == mouse_pos:
549+
return
550+
self.last_mouse_pos = mouse_pos
551+
# Fix mouse pos: realy = 0, kivy y = 600 / realy = 600, kivy y = 0
552+
x = mouse_pos[0]
553+
y = int(mouse_pos[1]-self.height)
554+
if x >= 0 and y <= 0:
555+
y = abs(y)
556+
self.browser.SendMouseMoveEvent(x, y, mouseLeave=False)
544557

545558

546559
def on_touch_move(self, touch, *kwargs):

0 commit comments

Comments
 (0)