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

This commit is contained in:
Mathieu Virbel 2012-09-12 15:29:17 +02:00
parent 85c921854a
commit 744358104c
2 changed files with 6 additions and 3 deletions

View File

@ -59,6 +59,8 @@ else:
windll.user32.SetWindowLongPtrW.argtypes = [HANDLE, c_int, WNDPROC] windll.user32.SetWindowLongPtrW.argtypes = [HANDLE, c_int, WNDPROC]
SetWindowLong_wrapper = windll.user32.SetWindowLongPtrW SetWindowLong_wrapper = windll.user32.SetWindowLongPtrW
else: else:
windll.user32.SetWindowLongW.restype = WNDPROC
windll.user32.SetWindowLongW.argtypes = [HANDLE, c_int, WNDPROC]
SetWindowLong_wrapper = windll.user32.SetWindowLongW SetWindowLong_wrapper = windll.user32.SetWindowLongW
windll.user32.GetMessageExtraInfo.restype = LPARAM windll.user32.GetMessageExtraInfo.restype = LPARAM

View File

@ -43,8 +43,7 @@ if 'KIVY_DOC' in os.environ:
else: else:
from ctypes.wintypes import (ULONG, HANDLE, DWORD, LONG, UINT, from ctypes.wintypes import (ULONG, HANDLE, DWORD, LONG, UINT,
WPARAM, LPARAM, POINTER, BOOL) WPARAM, LPARAM, POINTER, BOOL)
from ctypes import (windll, WINFUNCTYPE, c_int, from ctypes import windll, WINFUNCTYPE, c_int, Structure, sizeof, byref
Structure, pointer, sizeof, byref)
from collections import deque from collections import deque
from kivy.input.provider import MotionEventProvider from kivy.input.provider import MotionEventProvider
from kivy.input.factory import MotionEventFactory from kivy.input.factory import MotionEventFactory
@ -104,6 +103,8 @@ else:
windll.user32.SetWindowLongPtrW.argtypes = [HANDLE, c_int, WNDPROC] windll.user32.SetWindowLongPtrW.argtypes = [HANDLE, c_int, WNDPROC]
SetWindowLong_wrapper = windll.user32.SetWindowLongPtrW SetWindowLong_wrapper = windll.user32.SetWindowLongPtrW
else: else:
windll.user32.SetWindowLongW.restype = WNDPROC
windll.user32.SetWindowLongW.argtypes = [HANDLE, c_int, WNDPROC]
SetWindowLong_wrapper = windll.user32.SetWindowLongW SetWindowLong_wrapper = windll.user32.SetWindowLongW
windll.user32.GetMessageExtraInfo.restype = LPARAM windll.user32.GetMessageExtraInfo.restype = LPARAM
@ -202,7 +203,7 @@ else:
touches = (TOUCHINPUT * wParam)() touches = (TOUCHINPUT * wParam)()
windll.user32.GetTouchInputInfo(HANDLE(lParam), windll.user32.GetTouchInputInfo(HANDLE(lParam),
wParam, wParam,
pointer(touches), touches,
sizeof(TOUCHINPUT)) sizeof(TOUCHINPUT))
for i in xrange(wParam): for i in xrange(wParam):
self.touch_events.appendleft(touches[i]) self.touch_events.appendleft(touches[i])