Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 _press(self, button):
SendInput(
1,
ctypes.byref(INPUT(
type=INPUT.MOUSE,
value=INPUT_union(
mi=MOUSEINPUT(
dwFlags=button.value[1])))),
ctypes.sizeof(INPUT))
def set_pos(x, y):
x = 1 + int(x * 65536./Wd)
y = 1 + int(y * 65536./Hd)
extra = ctypes.c_ulong(0)
ii_ = pynput._util.win32.INPUT_union()
ii_.mi = pynput._util.win32.MOUSEINPUT(x, y, 0, (0x0001 | 0x8000), 0, ctypes.cast(ctypes.pointer(extra), ctypes.c_void_p))
command=pynput._util.win32.INPUT(ctypes.c_ulong(0), ii_)
SendInput(1, ctypes.pointer(command), ctypes.sizeof(command))
if __name__ == "__main__":
def set_pos(x, y):
x = 1 + int(x * 65536./1920.)
y = 1 + int(y * 65536./1080.)
extra = ctypes.c_ulong(0)
ii_ = pynput._util.win32.INPUT_union()
ii_.mi = pynput._util.win32.MOUSEINPUT(x, y, 0, (0x0001 | 0x8000), 0, ctypes.cast(ctypes.pointer(extra), ctypes.c_void_p))
command=pynput._util.win32.INPUT(ctypes.c_ulong(0), ii_)
SendInput(1, ctypes.pointer(command), ctypes.sizeof(command))
if __name__ == "__main__":
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 _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 _release(self, button):
SendInput(
1,
ctypes.byref(INPUT(
type=INPUT.MOUSE,
value=INPUT_union(
mi=MOUSEINPUT(
dwFlags=button.value[0])))),
ctypes.sizeof(INPUT))