From 744358104cd1ad600870a4762cb971ff991365f9 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Wed, 12 Sep 2012 15:29:17 +0200 Subject: [PATCH] wmtouch: fix SetWindowLongW params + fix crash on pointer(). Many thanks to Manfred Knobloch for remotely testing the issue, and give traceback for fixing this issue. closes #675 --- kivy/input/providers/wm_pen.py | 2 ++ kivy/input/providers/wm_touch.py | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/kivy/input/providers/wm_pen.py b/kivy/input/providers/wm_pen.py index 8e21355ab..b6b7702cc 100644 --- a/kivy/input/providers/wm_pen.py +++ b/kivy/input/providers/wm_pen.py @@ -59,6 +59,8 @@ else: windll.user32.SetWindowLongPtrW.argtypes = [HANDLE, c_int, WNDPROC] SetWindowLong_wrapper = windll.user32.SetWindowLongPtrW else: + windll.user32.SetWindowLongW.restype = WNDPROC + windll.user32.SetWindowLongW.argtypes = [HANDLE, c_int, WNDPROC] SetWindowLong_wrapper = windll.user32.SetWindowLongW windll.user32.GetMessageExtraInfo.restype = LPARAM diff --git a/kivy/input/providers/wm_touch.py b/kivy/input/providers/wm_touch.py index cf29a9d36..8f96269cf 100644 --- a/kivy/input/providers/wm_touch.py +++ b/kivy/input/providers/wm_touch.py @@ -43,8 +43,7 @@ if 'KIVY_DOC' in os.environ: else: from ctypes.wintypes import (ULONG, HANDLE, DWORD, LONG, UINT, WPARAM, LPARAM, POINTER, BOOL) - from ctypes import (windll, WINFUNCTYPE, c_int, - Structure, pointer, sizeof, byref) + from ctypes import windll, WINFUNCTYPE, c_int, Structure, sizeof, byref from collections import deque from kivy.input.provider import MotionEventProvider from kivy.input.factory import MotionEventFactory @@ -104,6 +103,8 @@ else: windll.user32.SetWindowLongPtrW.argtypes = [HANDLE, c_int, WNDPROC] SetWindowLong_wrapper = windll.user32.SetWindowLongPtrW else: + windll.user32.SetWindowLongW.restype = WNDPROC + windll.user32.SetWindowLongW.argtypes = [HANDLE, c_int, WNDPROC] SetWindowLong_wrapper = windll.user32.SetWindowLongW windll.user32.GetMessageExtraInfo.restype = LPARAM @@ -202,7 +203,7 @@ else: touches = (TOUCHINPUT * wParam)() windll.user32.GetTouchInputInfo(HANDLE(lParam), wParam, - pointer(touches), + touches, sizeof(TOUCHINPUT)) for i in xrange(wParam): self.touch_events.appendleft(touches[i])