def whole(self, mapper, x, y, what): if mapper.is_touched(what): # Store mouse position if pad was just touched if self.orig_position is None: if self.osd_enabled: x1, y1, x2, y2 = self.transform_osd_coords(mapper) self.execute(mapper, int(x1), int(y1), int(x2), int(y2)) self.orig_position = X.get_mouse_pos(mapper.get_xdisplay()) # Compute coordinates specified from other side of screen if needed x1, y1, x2, y2 = self.transform_coords(mapper) # Transform position on circne to position on rectangle x = x / float(STICK_PAD_MAX) y = y / float(STICK_PAD_MAX) x, y = circle_to_square(x, y) # Perform magic x = max(0, (x + 1.0) * 0.5) y = max(0, (1.0 - y) * 0.5) w = float(x2 - x1) h = float(y2 - y1) x = int(x1 + w * x) y = int(y1 + h * y) # Set position self.set_mouse(mapper, x, y) elif mapper.was_touched(what): # Pad just released X.set_mouse_pos(mapper.get_xdisplay(), *self.orig_position) if self.osd_enabled: self.execute_named("clear_osd", mapper) self.orig_position = None
def whole(self, mapper, x, y, what): if mapper.is_touched(what): # Store mouse position if pad was just touched if self.orig_position is None: if self.osd_enabled: x1, x2, y1, y2 = self.transform_osd_coords(mapper) self.execute(mapper, int(x1), int(y1), int(x2), int(y2)) self.orig_position = X.get_mouse_pos(mapper.xdisplay) # Compute coordinates specified from other side of screen if needed x1, x2, y1, y2 = self.transform_coords(mapper) # Transform position on circne to position on rectangle x = x / float(STICK_PAD_MAX) y = y / float(STICK_PAD_MAX) x, y = circle_to_square(x, y) # Perform magic x = max(0, (x + 1.0) * 0.5) y = max(0, (1.0 - y) * 0.5) w = float(x2 - x1) h = float(y2 - y1) x = int(x1 + w * x) y = int(y1 + h * y) # Set position self.set_mouse(mapper, x, y) elif mapper.was_touched(what): # Pad just released X.set_mouse_pos(mapper.xdisplay, *self.orig_position) if self.osd_enabled: self.execute_named("clear_osd", mapper) self.orig_position = None
def set_mouse(self, mapper, x, y): X.set_mouse_pos(mapper.get_xdisplay(), x, y, mapper.get_current_window())
def set_mouse(self, mapper, x, y): """ Performs final mouse position setting. Overrided by subclasses. """ X.set_mouse_pos(mapper.get_xdisplay(), x, y)
def set_mouse(self, mapper, x, y): X.set_mouse_pos(mapper.xdisplay, x, y, X.get_current_window(mapper.xdisplay))
def set_mouse(self, mapper, x, y): """ Performs final mouse position setting. Overrided by subclasses. """ X.set_mouse_pos(mapper.xdisplay, x, y)