Changeset 150

Show
Ignore:
Timestamp:
31.03.2008 01:22:35 (9 months ago)
Author:
poillubo
Message:

* when a client is withdrawn, all the transient windows are withdrawn too

(recommanded behavior in the ICCCM?)

* new option map_transients in Client.map
* added a test in Client.hide in order not to hide an already hidden window

(if Client.hide happens twice, 2 tempory hooks get added, and this should not happen)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/pycawm/client.py

    r149 r150  
    370370            title_bar_pixmap.free() 
    371371 
    372     def map(self): 
     372    def map(self, map_transients=False): 
    373373        if (self.states.icccm_state == self.just_reparented or 
    374374            self.states.icccm_state == self.normal): 
     
    378378            self.title_bar.map() 
    379379            self.window.map() 
     380            # get rid of the just_reparented state 
     381            self.states.icccm_state == self.normal 
    380382        # unmapped client getting a map... 
    381383        elif (self.parent != self.screen.root and 
     
    387389        self.window.set_wm_state(state=Xutil.NormalState, icon=0) 
    388390        self.update_frame() 
     391 
     392        if map_transients: 
     393            for transient in self.transient_clients: 
     394                transient.map() 
    389395 
    390396    def fake_reparent(self): 
     
    491497            self.parent.unmap() 
    492498            self.title_bar.unmap() 
     499            # will generate a BadWindow error if the window is already destroyed 
     500            self.window.unmap(onerror=self.error_handler) 
    493501            self.states.focused = False 
    494502            self.make_last() 
    495503            self.wm.set_new_focused_client() 
     504 
     505        for transient in self.transient_clients: 
     506            transient.withdraw() 
    496507 
    497508    def manage(self, new_window=True): 
     
    915926 
    916927    def hide(self): 
     928        if self.is_hidden(): 
     929            return 
     930 
    917931        # do not generate dummy enternotify events, unmap the parent first 
    918932        self.parent.unmap() 
     
    936950            return 
    937951 
     952        self.hide() 
    938953        self.states.icccm_state = self.iconified 
    939954        self.window.set_wm_state(state=Xutil.IconicState, icon=0) 
    940         self.hide() 
    941955        for transient in self.transient_clients: 
    942             if transient.states.icccm_state != self.withdrawn: 
    943                 transient.iconify() 
     956            transient.iconify() 
    944957 
    945958    def uniconify(self): 
     
    947960            return 
    948961 
     962        self.unhide() 
    949963        self.states.icccm_state = self.normal 
    950964        self.window.set_wm_state(state=Xutil.NormalState, icon=0) 
    951         self.unhide() 
    952965        for transient in self.transient_clients: 
    953966            transient.uniconify()