Ejemplo n.º 1
0
 def add(self, c, above=None):
     if c.floating:
         if getattr(config, 'remove_decorations', False):
             motif.set_hints_checked(
                 c.wid, 2, decoration=1).check()  # add decorations
         if getattr(config, 'tiles_below', False):
             ewmh.request_wm_state_checked(
                 c.wid, 0, util.get_atom('_NET_WM_STATE_BELOW')).check()
         self.floats.append(c)
     else:
         #restore window if maximized
         #ewmh.request_wm_state_checked(c.wid,0,util.get_atom('_NET_WM_STATE_MAXIMIZED_VERT')).check()
         #ewmh.request_wm_state_checked(c.wid,0,util.get_atom('_NET_WM_STATE_MAXIMIZED_HORZ')).check()
         if getattr(config, 'remove_decorations', False):
             motif.set_hints_checked(
                 c.wid, 2, decoration=2).check()  #remove decorations
         if getattr(config, 'tiles_below', False):
             ewmh.request_wm_state_checked(
                 c.wid, 1, util.get_atom('_NET_WM_STATE_BELOW')).check()
         if len(self.masters) < self.mcnt:
             if c in self.slaves:
                 self.slaves.remove(c)
             self.masters.append(c)
         elif c not in self.slaves:
             self.slaves.append(c)
Ejemplo n.º 2
0
    def restore(self):
        debug('Restoring %s' % self)
        if getattr(config, 'remove_decorations', False):
            motif.set_hints_checked(self.wid, 2, decoration=1).check()
        if getattr(config, 'tiles_below', False):
            ewmh.request_wm_state_checked(
                self.wid, 0, util.get_atom('_NET_WM_STATE_BELOW')).check()
        if self.saved_state:
            fullymaxed = False
            vatom = util.get_atom('_NET_WM_STATE_MAXIMIZED_VERT')
            hatom = util.get_atom('_NET_WM_STATE_MAXIMIZED_HORZ')

            if vatom in self.saved_state and hatom in self.saved_state:
                fullymaxed = True
                ewmh.request_wm_state_checked(self.wid, 1, vatom,
                                              hatom).check()
            elif vatom in self.saved_state:
                ewmh.request_wm_state_checked(self.wid, 1, vatom).check()
            elif hatom in self.saved_state:
                ewmh.request_wm_state_checked(self.wid, 1, hatom).check()

            # No need to continue if we've fully maximized the window
            if fullymaxed:
                return

        mnow = rect.get_monitor_area(window.get_geometry(self.wid),
                                     state.monitors)
        mold = rect.get_monitor_area(self.saved_geom, state.monitors)

        x, y, w, h = self.saved_geom

        # What if the client is on a monitor different than what it was before?
        # Use the same algorithm in Openbox to convert one monitor's
        # coordinates to another.
        if mnow != mold:
            nowx, nowy, noww, nowh = mnow
            oldx, oldy, oldw, oldh = mold

            xrat, yrat = float(noww) / float(oldw), float(nowh) / float(oldh)

            x = nowx + (x - oldx) * xrat
            y = nowy + (y - oldy) * yrat
            w *= xrat
            h *= yrat

        window.moveresize(self.wid, x, y, w, h)
Ejemplo n.º 3
0
 def add(self, c, above=None):
     if c.floating:
         if getattr(config, 'remove_decorations', False):
             motif.set_hints_checked(c.wid,2,decoration=1).check() # add decorations
         if getattr(config, 'tiles_below', False):
             ewmh.request_wm_state_checked(c.wid,0,util.get_atom('_NET_WM_STATE_BELOW')).check()
         self.floats.append(c)
     else:
         if getattr(config, 'remove_decorations', False):
             motif.set_hints_checked(c.wid,2,decoration=2).check() #remove decorations
         if getattr(config, 'tiles_below', False):
             ewmh.request_wm_state_checked(c.wid,1,util.get_atom('_NET_WM_STATE_BELOW')).check()
         if len(self.masters) < self.mcnt:
             if c in self.slaves:
                 self.slaves.remove(c)
             self.masters.append(c)
         elif c not in self.slaves:
             self.slaves.append(c)
Ejemplo n.º 4
0
 def add(self, c, above=None):
     if c.floating:
         if config.remove_decorations:
             motif.set_hints_checked(c.wid,2,decoration=1).check() # add decorations
         if config.tiles_below:
             ewmh.request_wm_state_checked(c.wid,0,util.get_atom('_NET_WM_STATE_BELOW')).check()
         self.floats.append(c)
     else:
         if config.remove_decorations:
             motif.set_hints_checked(c.wid,2,decoration=2).check() #remove decorations
         if config.tiles_below:
             ewmh.request_wm_state_checked(c.wid,1,util.get_atom('_NET_WM_STATE_BELOW')).check()
         if len(self.masters) < self.mcnt:
             if c in self.slaves:
                 self.slaves.remove(c)
             self.masters.append(c)
         elif c not in self.slaves:
             self.slaves.append(c)
Ejemplo n.º 5
0
    def restore(self):
        debug('Restoring %s' % self)
        if config.remove_decorations:
            motif.set_hints_checked(self.wid,2,decoration=1).check()
        if config.tiles_below:
            ewmh.request_wm_state_checked(self.wid,0,util.get_atom('_NET_WM_STATE_BELOW')).check()
        if self.saved_state:
            fullymaxed = False
            vatom = util.get_atom('_NET_WM_STATE_MAXIMIZED_VERT')
            hatom = util.get_atom('_NET_WM_STATE_MAXIMIZED_HORZ')

            if vatom in self.saved_state and hatom in self.saved_state:
                fullymaxed = True
                ewmh.request_wm_state_checked(self.wid, 1, vatom, hatom).check()
            elif vatom in self.saved_state:
                ewmh.request_wm_state_checked(self.wid, 1, vatom).check()
            elif hatom in self.saved_state:
                ewmh.request_wm_state_checked(self.wid, 1, hatom).check()

            # No need to continue if we've fully maximized the window
            if fullymaxed:
                return
            
        mnow = rect.get_monitor_area(window.get_geometry(self.wid),
                                     state.monitors)
        mold = rect.get_monitor_area(self.saved_geom, state.monitors)

        x, y, w, h = self.saved_geom

        # What if the client is on a monitor different than what it was before?
        # Use the same algorithm in Openbox to convert one monitor's 
        # coordinates to another.
        if mnow != mold:
            nowx, nowy, noww, nowh = mnow
            oldx, oldy, oldw, oldh = mold

            xrat, yrat = float(noww) / float(oldw), float(nowh) / float(oldh)

            x = nowx + (x - oldx) * xrat
            y = nowy + (y - oldy) * yrat
            w *= xrat
            h *= yrat

        window.moveresize(self.wid, x, y, w, h)