Changeset 152
- Timestamp:
- 03/31/08 19:06:12 (9 months ago)
- Files:
-
- trunk/pycawm/client.py (modified) (16 diffs)
- trunk/pycawm/hookmanager.py (modified) (1 diff)
- trunk/pycawm/pycawm.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/pycawm/client.py
r151 r152 25 25 import Image 26 26 27 from copy import copy 27 28 from Xlib import X, Xutil, protocol, error 28 29 from Xlib.error import BadDrawable, BadWindow, BadMatch, XError … … 154 155 return self.window in self.parent.query_tree().children 155 156 157 @property 158 def nonshaded_geometry(self): 159 if self.states.shaded: 160 geo = copy(self.geometry) 161 geo.height = (self.window.get_geometry().height + 162 self.title_bar_height) 163 else: 164 geo = self.geometry 165 return geo 166 156 167 def is_hidden(self): 157 168 return (self.states.icccm_state == self.withdrawn or … … 482 493 return 483 494 495 iconified = self.states.icccm_state == self.iconified 496 484 497 self.states.icccm_state = self.withdrawn 485 498 # the 2 lines below will generate BadWindow errors … … 490 503 491 504 # iconified window disappearing? 492 if self.states.icccm_state == self.iconified:505 if iconified: 493 506 # do nothing... 494 507 pass … … 621 634 622 635 def send_configure_notify(self): 623 # no need to send anything if we do not see the client 624 if self.is_hidden() :636 # no need to send anything if we do not see the client or window 637 if self.is_hidden() or self.states.shaded: 625 638 return 626 639 … … 664 677 665 678 def resize(self, coords, little=False): 666 if self.states.shaded:667 # for now, do not resize a shaded client668 return669 670 679 left = coords['left'] 671 680 top = coords['top'] … … 681 690 bottom = self.good_dy_increment(bottom, little) 682 691 683 x = self.geometry.x + left 684 y = self.geometry.y + top 685 width = self.geometry.width - left + right 686 height = self.geometry.height - self.title_bar_height - top + bottom 692 geo = self.nonshaded_geometry 693 x = geo.x + left 694 y = geo.y + top 695 width = geo.width - left + right 696 height = geo.height - self.title_bar_height - top + bottom 687 697 688 698 if self.wm_normal_hints is not None: … … 699 709 return 700 710 711 self.window.configure(width=width, height=height) 701 712 self.title_bar.configure(width=width, height=self.title_bar_height) 702 self.parent.configure(width=width, height=height+self.title_bar_height) 703 self.window.configure(width=width, height=height) 713 if self.states.shaded: 714 self.parent.configure(width=width, 715 height=self.title_bar_height) 716 else: 717 self.parent.configure(width=width, 718 height=height+self.title_bar_height) 704 719 self.move(dict(x=x, y=y), send_event=False) 705 720 … … 808 823 if horizontally and vertically: 809 824 self.states.maximized = self.maximized_both 810 geo = self. geometry825 geo = self.nonshaded_geometry 811 826 self.coords_backup = (geo.x, geo.y, 812 827 geo.width, geo.height) … … 846 861 self.window.configure(x=0, y=self.title_bar_height) 847 862 self.title_bar.map() 848 geo = self. geometry863 geo = self.nonshaded_geometry 849 864 x, y = self.coords_backup[:2] 850 865 right = self.coords_backup[2] - geo.width … … 864 879 clients.append(client) 865 880 geo = self.geometry 866 self.coords_backup = (geo.x, geo.y,867 geo.width, geo.height)868 881 if horizontally: 869 882 x1, x2 = [-1], [self.screen.width_in_pixels] … … 890 903 else: 891 904 y2.append(geo_client.y - 1) 905 geo = self.nonshaded_geometry 906 self.coords_backup = (geo.x, geo.y, 907 geo.width, geo.height) 892 908 self.move(dict(x=max(x1) + 1, y=max(y1) + 1)) 893 909 self.resize( … … 912 928 def fullscreen(self): 913 929 # Warning: alpha code ;-) 914 if self.states.maximized :930 if self.states.maximized or self.states.shaded: 915 931 return 916 932 geo = self.geometry … … 947 963 return 948 964 949 visible = False if self.is_hidden() else True965 visible = not self.is_hidden() 950 966 self.states.icccm_state = self.iconified 951 967 self.window.set_wm_state(state=Xutil.IconicState, icon=0) … … 967 983 def shade(self): 968 984 if self.states.reparented and not self.states.shaded: 969 self.states.icccm_state = self.iconified 970 self.window.set_wm_state(state=Xutil.IconicState, icon=0) 985 # window will become invisible, we need to change its state 986 if not self.is_hidden(): 987 self.window.set_wm_state(state=Xutil.WithdrawnState, icon=0) 988 disable_method_for_instance(self.withdraw) 989 self.window.unmap() 971 990 self.parent.configure(height=self.title_bar_height) 972 991 self.geometry = self.parent.get_geometry() … … 975 994 def unshade(self): 976 995 if self.states.reparented and self.states.shaded: 977 self.states.icccm_state = self.normal 978 self.window.set_wm_state(state=Xutil.NormalState, icon=0) 996 # window will become visible again, change its state to reflect that 997 if not self.is_hidden(): 998 self.window.set_wm_state(state=Xutil.NormalState, icon=0) 999 self.window.map() 1000 # get the lost focus from the temporay unmapping 1001 if self.states.focused: 1002 self.states.focused = False 1003 self.take_focus() 979 1004 geo = self.window.get_geometry() 980 1005 self.parent.configure(height=self.title_bar_height + geo.height) trunk/pycawm/hookmanager.py
r151 r152 67 67 ret_args = hook(*args, **kwargs) 68 68 except TypeError: 69 print ('Cannot execute %s %s for %s, args: %s, %s' %69 print ('Cannot execute %s %s for %s, args: %s, kwargs: %s' % 70 70 (get_hook_type(hooks), hook, key, args, kwargs)) 71 71 return ret_args trunk/pycawm/pycawm.py
r146 r152 617 617 return ( 618 618 (ny < 0 and pointer.root_y < client.geometry.y + 619 client.geometry.height + client.parent_border_width) or 619 client.nonshaded_geometry.height + 620 client.parent_border_width) or 620 621 (ny > 0 and pointer.root_y > client.geometry.y + 621 client.geometry.height + (client.parent_border_width * 2))) 622 client.nonshaded_geometry.height + 623 (client.parent_border_width * 2))) 622 624 elif edge == PycaWM.left: 623 625 return (
