def get_current_window(self): """ Returns window id of current window or None if xdisplay is not set """ if self.xdisplay: return X.get_current_window(self.xdisplay) return None
def transform_osd_coords(self, mapper): wx, wy, ww, wh = X.get_window_geometry(mapper.xdisplay, X.get_current_window(mapper.xdisplay)) x1, x2, y1, y2 = self.coords x1 = wx + float(ww) * x1 y1 = wy + float(wh) * y1 x2 = wx + float(ww) * x2 y2 = wy + float(wh) * y2 return x1, x2, y1, y2
def transform_coords(self, mapper): w_size = X.get_window_size(mapper.xdisplay, X.get_current_window(mapper.xdisplay)) x1, x2, y1, y2 = self.coords x1 = w_size[0] * x1 y1 = w_size[1] * y1 x2 = w_size[0] * x2 y2 = w_size[1] * y2 return x1, x2, y1, y2
def transform_osd_coords(self, mapper): wx, wy, ww, wh = X.get_window_geometry(mapper.xdisplay, X.get_current_window(mapper.xdisplay)) x1, x2, y1, y2 = self.coords x1 = wx + x1 if x1 >= 0 else wx + ww + x1 y1 = wy + y1 if y1 >= 0 else wy + wh + y1 x2 = wx + x2 if x2 >= 0 else wx + ww + x2 y2 = wy + y2 if y2 >= 0 else wy + wh + y2 return x1, x2, y1, y2
def transform_coords(self, mapper): if self.needs_query_screen: w_size = X.get_window_size(mapper.xdisplay, X.get_current_window(mapper.xdisplay)) x1, x2, y1, y2 = self.coords if x1 < 0 : x1 = w_size[0] + x1 if y1 < 0 : y1 = w_size[1] + y1 if x2 < 0 : x2 = w_size[0] + x2 if y2 < 0 : y2 = w_size[1] + y2 return x1, x2, y1, y2 return self.coords
def set_mouse(self, mapper, x, y): X.set_mouse_pos(mapper.xdisplay, x, y, X.get_current_window(mapper.xdisplay))