mirror of https://github.com/kivy/kivy.git
try to detect and use Ptr* method only if available. refs #675
This commit is contained in:
parent
49ef114e51
commit
85c921854a
|
@ -53,8 +53,14 @@ else:
|
|||
h = property(lambda self: self.bottom - self.top)
|
||||
win_rect = RECT()
|
||||
|
||||
windll.user32.SetWindowLongPtrW.restype = WNDPROC
|
||||
windll.user32.SetWindowLongPtrW.argtypes = [HANDLE, c_int, WNDPROC]
|
||||
|
||||
if hasattr(windll.user32, 'SetWindowLongPtrW'):
|
||||
windll.user32.SetWindowLongPtrW.restype = WNDPROC
|
||||
windll.user32.SetWindowLongPtrW.argtypes = [HANDLE, c_int, WNDPROC]
|
||||
SetWindowLong_wrapper = windll.user32.SetWindowLongPtrW
|
||||
else:
|
||||
SetWindowLong_wrapper = windll.user32.SetWindowLongW
|
||||
|
||||
windll.user32.GetMessageExtraInfo.restype = LPARAM
|
||||
windll.user32.GetMessageExtraInfo.argtypes = []
|
||||
windll.user32.GetClientRect.restype = BOOL
|
||||
|
@ -115,10 +121,8 @@ else:
|
|||
# inject our own wndProc to handle messages
|
||||
# before window manager does
|
||||
self.new_windProc = WNDPROC(self._pen_wndProc)
|
||||
self.old_windProc = windll.user32.SetWindowLongPtrW(
|
||||
self.hwnd,
|
||||
GWL_WNDPROC,
|
||||
self.new_windProc)
|
||||
self.old_windProc = SetWindowLong_wrapper(
|
||||
self.hwnd, GWL_WNDPROC, self.new_windProc)
|
||||
|
||||
def update(self, dispatch_fn):
|
||||
while True:
|
||||
|
@ -140,9 +144,6 @@ else:
|
|||
|
||||
def stop(self):
|
||||
self.pen = None
|
||||
windll.user32.SetWindowLongPtrW(
|
||||
self.hwnd,
|
||||
GWL_WNDPROC,
|
||||
self.old_windProc)
|
||||
SetWindowLong_wrapper(self.hwnd, GWL_WNDPROC, self.old_windProc)
|
||||
|
||||
MotionEventFactory.register('wm_pen', WM_PenProvider)
|
||||
|
|
|
@ -99,8 +99,13 @@ else:
|
|||
w = property(lambda self: self.right - self.left)
|
||||
h = property(lambda self: self.bottom - self.top)
|
||||
|
||||
windll.user32.SetWindowLongPtrW.restype = WNDPROC
|
||||
windll.user32.SetWindowLongPtrW.argtypes = [HANDLE, c_int, WNDPROC]
|
||||
if hasattr(windll.user32, 'SetWindowLongPtrW'):
|
||||
windll.user32.SetWindowLongPtrW.restype = WNDPROC
|
||||
windll.user32.SetWindowLongPtrW.argtypes = [HANDLE, c_int, WNDPROC]
|
||||
SetWindowLong_wrapper = windll.user32.SetWindowLongPtrW
|
||||
else:
|
||||
SetWindowLong_wrapper = windll.user32.SetWindowLongW
|
||||
|
||||
windll.user32.GetMessageExtraInfo.restype = LPARAM
|
||||
windll.user32.GetMessageExtraInfo.argtypes = []
|
||||
windll.user32.GetClientRect.restype = BOOL
|
||||
|
@ -134,10 +139,8 @@ else:
|
|||
# inject our own wndProc to handle messages
|
||||
# before window manager does
|
||||
self.new_windProc = WNDPROC(self._touch_wndProc)
|
||||
self.old_windProc = windll.user32.SetWindowLongPtrW(
|
||||
self.hwnd,
|
||||
GWL_WNDPROC,
|
||||
self.new_windProc)
|
||||
self.old_windProc = SetWindowLong_wrapper(
|
||||
self.hwnd, GWL_WNDPROC, self.new_windProc)
|
||||
|
||||
def update(self, dispatch_fn):
|
||||
win_rect = RECT()
|
||||
|
@ -173,10 +176,8 @@ else:
|
|||
|
||||
def stop(self):
|
||||
windll.user32.UnregisterTouchWindow(self.hwnd)
|
||||
self.new_windProc = windll.user32.SetWindowLongPtrW(
|
||||
self.hwnd,
|
||||
GWL_WNDPROC,
|
||||
self.old_windProc)
|
||||
self.new_windProc = SetWindowLong_wrapper(
|
||||
self.hwnd, GWL_WNDPROC, self.old_windProc)
|
||||
|
||||
# we inject this wndProc into our main window, to process
|
||||
# WM_TOUCH and mouse messages before the window manager does
|
||||
|
|
Loading…
Reference in New Issue