Example #1
0
    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)
Example #2
0
 def _release(self, button):
     SendInput(
         1,
         ctypes.byref(
             INPUT(type=INPUT.MOUSE,
                   value=INPUT_union(mi=MOUSEINPUT(
                       dwFlags=button.value[0])))), ctypes.sizeof(INPUT))
Example #3
0
 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))
Example #4
0
 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))
Example #5
0
    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)