Exemple #1
0
 def _mouse_move(self):
     if self.move_x != 0 or self.move_y != 0:        
         if self.move_x != 0:
             g15uinput.emit(g15uinput.MOUSE, g15uinput.REL_X, self.move_x)        
         if self.move_y != 0:
             g15uinput.emit(g15uinput.MOUSE, g15uinput.REL_Y, self.move_y)
         self.timer = g15scheduler.schedule("MouseMove", 0.05, self._mouse_move)
Exemple #2
0
 def _mouse_move(self):
     if self.move_x != 0 or self.move_y != 0:        
         if self.move_x != 0:
             g15uinput.emit(g15uinput.MOUSE, g15uinput.REL_X, self.move_x)        
         if self.move_y != 0:
             g15uinput.emit(g15uinput.MOUSE, g15uinput.REL_Y, self.move_y)
         self.timer = g15scheduler.schedule("MouseMove", 0.05, self._mouse_move)
 def _check_buttons(self, target, this_keys, key, button):
     if key in this_keys:
         this_keys.remove(key)
         if not key in self.down:
             g15uinput.emit(target, button, 1)
             self.down.append(key)
     elif key in self.down:
         g15uinput.emit(target, button, 0)
         self.down.remove(key)
 def _do_uinput_keys(self, down, up):
     if len(down) > 0:
         for uinput_code in down:
             g15uinput.emit(g15uinput.KEYBOARD, uinput_code, 1, False)
         g15uinput.syn(g15uinput.KEYBOARD)
     if len(up) > 0:
         for uinput_code in up:
             g15uinput.emit(g15uinput.KEYBOARD, uinput_code, 0, False)
         g15uinput.syn(g15uinput.KEYBOARD)
Exemple #5
0
 def _check_buttons(self, target, this_keys, key, button):        
     if key in this_keys:
         this_keys.remove(key)
         if not key in self.down:
             g15uinput.emit(target, button, 1)
             self.down.append(key)
     elif key in self.down:
         g15uinput.emit(target, button, 0)
         self.down.remove(key)
Exemple #6
0
 def _do_uinput_keys(self, down, up):
     if len(down) > 0:
         for uinput_code in down:
             g15uinput.emit(g15uinput.KEYBOARD, uinput_code, 1, False)
         g15uinput.syn(g15uinput.KEYBOARD)
     if len(up) > 0:            
         for uinput_code in up:
             g15uinput.emit(g15uinput.KEYBOARD, uinput_code, 0, False)
         g15uinput.syn(g15uinput.KEYBOARD)
Exemple #7
0
    def _digital_joystick(self, this_keys, pos, low_val, high_val):
        self._check_js_buttons(g15uinput.DIGITAL_JOYSTICK, this_keys)
        pos_x = g15uinput.JOYSTICK_CENTER
        pos_y = g15uinput.JOYSTICK_CENTER

        if pos[0] < low_val:
            pos_x = g15uinput.JOYSTICK_MIN
        elif pos[0] > high_val:
            pos_x = g15uinput.JOYSTICK_MAX
        if pos[1] < low_val:
            pos_y = g15uinput.JOYSTICK_MIN
        elif pos[1] > high_val:
            pos_y = g15uinput.JOYSTICK_MAX

        g15uinput.emit(g15uinput.DIGITAL_JOYSTICK, g15uinput.ABS_X, pos_x, syn=False)
        g15uinput.emit(g15uinput.DIGITAL_JOYSTICK, g15uinput.ABS_Y, pos_y)
Exemple #8
0
    def _digital_joystick(self, this_keys, pos, low_val, high_val):
        self._check_js_buttons(g15uinput.DIGITAL_JOYSTICK, this_keys)
        pos_x = g15uinput.JOYSTICK_CENTER
        pos_y = g15uinput.JOYSTICK_CENTER

        if pos[0] < low_val:
            pos_x = g15uinput.JOYSTICK_MIN
        elif pos[0] > high_val:
            pos_x = g15uinput.JOYSTICK_MAX
        if pos[1] < low_val:
            pos_y = g15uinput.JOYSTICK_MIN
        elif pos[1] > high_val:
            pos_y = g15uinput.JOYSTICK_MAX

        g15uinput.emit(g15uinput.DIGITAL_JOYSTICK, g15uinput.ABS_X, pos_x, syn=False)
        g15uinput.emit(g15uinput.DIGITAL_JOYSTICK, g15uinput.ABS_Y, pos_y)
Exemple #9
0
 def receive(self, event):
     if event.etype == S.EV_KEY:
         state = g15driver.KEY_STATE_DOWN if event.evalue == 1 else g15driver.KEY_STATE_UP
         if event.evalue != 2:
             self._event(event.ecode, state)
     elif event.etype == 0:
         return
     elif event.etype == 4 and event.evalue == 786666:
         # Hack for Volume down on G930
         if not self._grab_multimedia:
             g15uinput.emit(g15uinput.KEYBOARD, g15uinput.KEY_VOLUMEDOWN, 1, True)
             g15uinput.emit(g15uinput.KEYBOARD, g15uinput.KEY_VOLUMEDOWN, 0, True)
     elif event.etype == 4 and event.evalue == 786665:
         # Hack for Volume down on G930
         if not self._grab_multimedia:
             g15uinput.emit(g15uinput.KEYBOARD, g15uinput.KEY_VOLUMEUP, 1, True)
             g15uinput.emit(g15uinput.KEYBOARD, g15uinput.KEY_VOLUMEUP, 0, True)
     else:
         logger.warning("Unhandled event: %s", str(event))
Exemple #10
0
 def receive(self, event):
     if event.etype == S.EV_KEY:
         state = g15driver.KEY_STATE_DOWN if event.evalue == 1 else g15driver.KEY_STATE_UP
         if event.evalue != 2:
             self._event(event.ecode, state)
     elif event.etype == 0:
         return
     elif event.etype == 4 and event.evalue == 786666:
         # Hack for Volume down on G930
         if not self._grab_multimedia:
             g15uinput.emit(g15uinput.KEYBOARD, g15uinput.KEY_VOLUMEDOWN, 1, True)
             g15uinput.emit(g15uinput.KEYBOARD, g15uinput.KEY_VOLUMEDOWN, 0, True)
     elif event.etype == 4 and event.evalue == 786665:
         # Hack for Volume down on G930
         if not self._grab_multimedia:
             g15uinput.emit(g15uinput.KEYBOARD, g15uinput.KEY_VOLUMEUP, 1, True)
             g15uinput.emit(g15uinput.KEYBOARD, g15uinput.KEY_VOLUMEUP, 0, True)
     else:
         logger.warning("Unhandled event: %s", str(event))
Exemple #11
0
 def _abs_joystick(self, this_keys, pos):
     self._check_js_buttons(g15uinput.JOYSTICK, this_keys)
     g15uinput.emit(g15uinput.JOYSTICK, g15uinput.ABS_X, pos[0], syn=False)
     g15uinput.emit(g15uinput.JOYSTICK, g15uinput.ABS_Y, pos[1])
Exemple #12
0
 def _abs_joystick(self, this_keys, pos):
     self._check_js_buttons(g15uinput.JOYSTICK, this_keys)
     g15uinput.emit(g15uinput.JOYSTICK, g15uinput.ABS_X, pos[0], syn=False)
     g15uinput.emit(g15uinput.JOYSTICK, g15uinput.ABS_Y, pos[1])