def _scroll(self, dx, dy): if dy: SendInput( 1, ctypes.byref(INPUT( type=INPUT.MOUSE, value=INPUT_union( mi=MOUSEINPUT( dwFlags=MOUSEINPUT.WHEEL, mouseData=int(dy))))), ctypes.sizeof(INPUT)) if dx: SendInput( 1, ctypes.byref(INPUT( type=INPUT.MOUSE, value=INPUT_union( mi=MOUSEINPUT( dwFlags=MOUSEINPUT.HWHEEL, mouseData=int(dx))))), ctypes.sizeof(INPUT)) if dx or dy: px, py = self._position_get() self._emit('on_scroll', px, py, dx, dy)
def _release(self, button): SendInput( 1, ctypes.byref( INPUT(type=INPUT.MOUSE, value=INPUT_union(mi=MOUSEINPUT( dwFlags=button.value[0])))), ctypes.sizeof(INPUT))
def _handle(self, key, is_press): SendInput( 1, ctypes.byref(INPUT( type=INPUT.KEYBOARD, value=INPUT_union( ki=KEYBDINPUT(**key._parameters(is_press))))), ctypes.sizeof(INPUT))
def _press(self, button): SendInput( 1, ctypes.byref( INPUT( type=INPUT.MOUSE, value=INPUT_union(mi=MOUSEINPUT( dwFlags=button.value[1], mouseData=button.value[2])))), ctypes.sizeof(INPUT))
def _handle(self, key, is_press): SendInput( 1, ctypes.byref(INPUT( type=INPUT.KEYBOARD, value=INPUT_union( ki=KEYBDINPUT(**key._parameters(is_press))))), ctypes.sizeof(INPUT)) # Notify any running listeners self._emit('_on_fake_event', key, is_press)
def _release_key(hexKeyCode): ii_ = INPUT_union() ii_.ki = KEYBDINPUT( 0, hexKeyCode, 0x0008 | 0x0002, 0) x = INPUT( ctypes.c_ulong(1), ii_ ) ctypes.windll.user32.SendInput(1, ctypes.pointer(x), ctypes.sizeof(x))