Beispiel #1
0
    def saveCursorPos(self):
        if (not self.windowID) or (self.windowID != getFocalWindowID()):
            return
        if _has_aqutil:
            scrnPosDict = aqutil.getPointerGlobalPosition()
            self.lastScreenX = scrnPosDict['x']
            self.lastScreenY = scrnPosDict['y']
            return
        if not WUTIL_USING_X:
            return # some of the following xutil methods are undefined

        # This also won't work on a Mac if running from the Terminal app
        # but it WILL work on a Mac from an X11 xterm window
        if WUTIL_USING_X and WUTIL_ON_MAC and self.windowID < 2:
            return

        posdict = getPointerPosition(self.windowID)
        if posdict:
            x = posdict['win_x']
            y = posdict['win_y']
        else:
            return
        windict = getWindowAttributes(self.windowID)
        if windict and windict['width'] > 0:
            maxX = windict['width']
            maxY = windict['height']
        else:
            return
        # do nothing if position out of window
        if x < 0 or y < 0 or x >= maxX or y >= maxY:
            return
        self.lastX = x
        self.lastY = y
Beispiel #2
0
    def saveCursorPos(self):
        if (not self.windowID) or (self.windowID != getFocalWindowID()):
            return
        if _has_aqutil:
            scrnPosDict = aqutil.getPointerGlobalPosition()
            self.lastScreenX = scrnPosDict['x']
            self.lastScreenY = scrnPosDict['y']
            return
        if not WUTIL_USING_X:
            return  # some of the following xutil methods are undefined

        # This also won't work on a Mac if running from the Terminal app
        # but it WILL work on a Mac from an X11 xterm window
        if WUTIL_USING_X and WUTIL_ON_MAC and self.windowID < 2:
            return

        posdict = getPointerPosition(self.windowID)
        if posdict:
            x = posdict['win_x']
            y = posdict['win_y']
        else:
            return
        windict = getWindowAttributes(self.windowID)
        if windict and windict['width'] > 0:
            maxX = windict['width']
            maxY = windict['height']
        else:
            return
        # do nothing if position out of window
        if x < 0 or y < 0 or x >= maxX or y >= maxY:
            return
        self.lastX = x
        self.lastY = y
Beispiel #3
0
 def __init__(self):
     """IMPORTANT: This class must be instantiated while focus
     is in the terminal window"""
     self.lastScreenX = None
     self.lastScreenY = None
     try:
         self.windowID = getFocalWindowID()
         if self.windowID == -1:
             self.windowID = None
         if _has_aqutil:
             scrnPosDict = aqutil.getPointerGlobalPosition()
             self.lastScreenX = scrnPosDict['x']
             self.lastScreenY = scrnPosDict['y']
     except EnvironmentError, e:
         self.windowID = None
Beispiel #4
0
 def __init__(self):
     """IMPORTANT: This class must be instantiated while focus
     is in the terminal window"""
     self.lastScreenX = None
     self.lastScreenY = None
     try:
         self.windowID = getFocalWindowID()
         if self.windowID == -1:
             self.windowID = None
         if _has_aqutil:
             scrnPosDict = aqutil.getPointerGlobalPosition()
             self.lastScreenX = scrnPosDict['x']
             self.lastScreenY = scrnPosDict['y']
     except EnvironmentError, e:
         self.windowID = None