Esempio n. 1
0
 def __init__(self, win, position, gravity, size, width, height, cycle):
     self.win_id = win.id
     self.args = (position, gravity, size, width, height
                  )  # TODO: remove me!?
     self.gravity = gravity
     workarea = WM.workarea_geometry
     self.position = absolute_position(workarea, position)
     self.sizes = absolute_size(win, workarea, size, width, height)
     dummy = DummyWindow(win, self.position, self.sizes, self.gravity)
     max_geo = expand_window(dummy,
                             dummy.gravity,
                             sticky=False,
                             vertical_first=cycle)
     widths = []
     for width in self.sizes.width:
         if max_geo.width - width >= 0 and \
            self.position.x - width * position.x >= max_geo.x and \
            self.position.x + width * (1 - position.x) <= max_geo.x2:
             widths.append(width)
     heights = []
     for height in self.sizes.height:
         if max_geo.height - height >= 0 and \
            self.position.y - height * position.y >= max_geo.y and \
            self.position.y + height * (1 - position.y) <= max_geo.y2:
             heights.append(height)
     width = max(widths)
     height = max(heights)
     self.sizes_iterator = Size(get_iterator(self.sizes.width, width),
                                get_iterator(self.sizes.height, height))
     [self.sizes_iterator.height, self.sizes_iterator.width][cycle].next()
     self.previous = Geometry(self.position.x, self.position.y, width,
                              height, self.gravity)
Esempio n. 2
0
def _expand(win, direction, vertical_first=True):
    """Expand window in given direction."""
    geometry = expand_window(win, direction, 
                             sticky=(not direction.is_middle),
                             vertical_first=vertical_first)
    log.debug('Setting %s' % (geometry,))
    win.set_geometry(geometry, direction)
Esempio n. 3
0
 def __init__(self, win, position, gravity, size, width, height, cycle):
     self.win_id = win.id
     self.args = (position, gravity, size, width, height) # TODO: remove me!?
     self.gravity = gravity
     workarea = WM.workarea_geometry
     self.position = absolute_position(workarea, position)
     self.sizes = absolute_size(win, workarea, size, width, height)
     dummy = DummyWindow(win, self.position, self.sizes, self.gravity)
     max_geo = expand_window(dummy, dummy.gravity,
                             sticky=False, vertical_first=cycle)
     widths = []
     for width in self.sizes.width:
         if max_geo.width - width >= 0 and \
            self.position.x - width * position.x >= max_geo.x and \
            self.position.x + width * (1 - position.x) <= max_geo.x2:
             widths.append(width)
     heights = []
     for height in self.sizes.height:
         if max_geo.height - height >= 0 and \
            self.position.y - height * position.y >= max_geo.y and \
            self.position.y + height * (1 - position.y) <= max_geo.y2:
             heights.append(height)
     width = max(widths)
     height = max(heights)
     self.sizes_iterator = Size(get_iterator(self.sizes.width, width),
                                get_iterator(self.sizes.height, height))
     [self.sizes_iterator.height, self.sizes_iterator.width][cycle].next()
     self.previous = Geometry(self.position.x, self.position.y,
                              width, height, self.gravity)
Esempio n. 4
0
def _expand(win, direction, vertical_first=True):
    """Expand window in given direction."""
    geometry = expand_window(win,
                             direction,
                             sticky=(not direction.is_middle),
                             vertical_first=vertical_first)
    log.debug('Setting %s' % (geometry, ))
    win.set_geometry(geometry, direction)
Esempio n. 5
0
def _move(win, direction, vertical_first=True):
    """Move window in given direction."""
    border = expand_window(win, direction, 
                           sticky=(not direction.is_middle), 
                           insideout=(not direction.is_middle),
                           vertical_first=vertical_first)
    geometry = win.geometry
    geometry.width = min(border.width, geometry.width)
    geometry.height = min(border.height, geometry.height)
    x = border.x + border.width * direction.x
    y = border.y + border.height * direction.y
    geometry.set_position(x, y, direction)
    log.debug('Setting %s' % (geometry,))
    win.set_geometry(geometry)
Esempio n. 6
0
def _move(win, direction, vertical_first=True):
    """Move window in given direction."""
    border = expand_window(win,
                           direction,
                           sticky=(not direction.is_middle),
                           insideout=(not direction.is_middle),
                           vertical_first=vertical_first)
    geometry = win.geometry
    geometry.width = min(border.width, geometry.width)
    geometry.height = min(border.height, geometry.height)
    x = border.x + border.width * direction.x
    y = border.y + border.height * direction.y
    geometry.set_position(x, y, direction)
    log.debug('Setting %s' % (geometry, ))
    win.set_geometry(geometry)