Changeset 212
- Timestamp:
- 05/05/2008 12:14:37 AM (8 months ago)
- Location:
- trunk
- Files:
-
- 9 added
- 4 modified
-
. (modified) (5 props)
-
examples/petliwm.py (modified) (9 diffs)
-
plcm (added)
-
plcm/Makefile (added)
-
plcm/events.c (added)
-
plcm/main.c (added)
-
plcm/plcm.h (added)
-
plcm/projection.c (added)
-
plcm/trans_glx.c (added)
-
plcm/trans_render.c (added)
-
plwm/__init__.py (modified) (1 diff)
-
plwm/composite.py (added)
-
plwm/wmanager.py (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property bzr:revision-id:v3-trunk0
-
old new 7 7 164 david.bronke@g33xnexus.com-20080425163300-bd5hb9q7lv4tvqi2 8 8 165 david.bronke@g33xnexus.com-20080502003750-x2jktkjxttsrfd7y 9 166 david.bronke@g33xnexus.com-20080505045843-m80adl8a0lzjc6qr
-
- Property bzr:file-ids
-
old new 1 plwm/mw_xmms2.py mw_xmms2.py-20080502003726-9k8jbylthw1lg0s0-1 1 plwm/composite.py 210@51b01d74-a847-0410-9038-a726f43140df:trunk:plwm%2Fcomposite.py 2 plcm 210@51b01d74-a847-0410-9038-a726f43140df:trunk:plcm 3 plcm/projection.c 210@51b01d74-a847-0410-9038-a726f43140df:trunk:plcm%2Fprojection.c 4 plcm/plcm.h 210@51b01d74-a847-0410-9038-a726f43140df:trunk:plcm%2Fplcm.h 5 plcm/Makefile 210@51b01d74-a847-0410-9038-a726f43140df:trunk:plcm%2FMakefile 6 plcm/trans_glx.c 210@51b01d74-a847-0410-9038-a726f43140df:trunk:plcm%2Ftrans_glx.c 7 plcm/events.c 210@51b01d74-a847-0410-9038-a726f43140df:trunk:plcm%2Fevents.c 8 plcm/trans_render.c 210@51b01d74-a847-0410-9038-a726f43140df:trunk:plcm%2Ftrans_render.c 9 plcm/main.c 210@51b01d74-a847-0410-9038-a726f43140df:trunk:plcm%2Fmain.c
-
- Property bzr:revision-info
-
old new 1 timestamp: 2008-05-0 1 20:37:50.073999882-04001 timestamp: 2008-05-05 00:58:43.687000036 -0400 2 2 committer: David Bronke <David.Bronke@g33xnexus.com> 3 3 properties:
-
-
Property
bzr:ancestry:v3-trunk0 set
to
svn-v3-trunk0:51b01d74-a847-0410-9038-a726f43140df:trunk:210
- Property bzr:revision-id:v3-trunk0
-
trunk/examples/petliwm.py
r198 r212 39 39 mw_clock, mw_acpi, \ 40 40 mw_watchfiles, \ 41 inspect, misc, input 41 inspect, misc, input, \ 42 composite, mixer 42 43 43 44 from plwm.cycle import CycleKeys, CycleActivate … … 180 181 ): 181 182 183 window_proxy_class = composite.CompositeProxy 184 182 185 no_border_clients = name('MPlayer') 183 186 full_screen_windows = name('MPlayer') … … 223 226 view_reorder_views = 1 224 227 view_reorder_delay = 2.0 225 226 allow_self_changes = none228 229 #allow_self_changes = none 227 230 228 231 class WMConfig: … … 239 242 mw_watchfiles.ModeWindowWatchFiles, 240 243 inspect.InspectServer, 244 composite.CompositionManager, 245 mixer.Mixer, 241 246 ModeWindowTraceIM, 242 247 WMConfig): … … 251 256 present_msg = '', 252 257 missing_msg = 'LTM OFF'), 253 mw_watchfiles.WatchedFile('/var/run/ network-error',254 present_msg = ' NET:%s',258 mw_watchfiles.WatchedFile('/var/run/tre-network', 259 present_msg = '3|%s', 255 260 format_content = 1) 256 261 ) … … 378 383 self.wm.current_screen.view_find_with_client(Or(name('xpdf'), 379 384 name('soffice'), 380 name(' VCLSalFrame'),385 name('OpenOffice.org 2.0'), 381 386 name('AcroRead'))) 382 387 … … 385 390 386 391 def F8(self, evt): 387 self.wm.current_screen.view_find_with_client(name('Vmware')) 392 self.wm.current_screen.view_find_with_client(Or(name('Vmware'), 393 name('Vmplayer'))) 388 394 389 395 def F5(self, evt): … … 443 449 self.wm.fake_button_click(3) 444 450 445 # def F12(self, evt): 446 # clients = self.wm.query_clients() 447 # f = name('titrax') 448 # for c in clients: 449 # if f(c): 450 # c.deiconify() 451 # c.activate() 452 # return 453 # else: 454 # self.wm.system('/opt/local/bin/titrax') 451 # 452 # Composition effects 453 # 454 455 def M5_S_b(self, evt): 456 if self.wm.current_client: 457 self.wm.comp_change_brightness(self.wm.current_client, 16) 458 459 def M5_b(self, evt): 460 if self.wm.current_client: 461 self.wm.comp_change_brightness(self.wm.current_client, -16) 462 463 def M5_C_b(self, evt): 464 if self.wm.current_client: 465 self.wm.comp_set_brightness(self.wm.current_client, 0) 455 466 456 467 # … … 458 469 # 459 470 460 # def F7(self, evt): 461 # # lower volume. First main to 50, then pcm to 0 462 # main = self.wm.mixer_get('vol') 463 # if main > 50: 464 # self.wm.mixer_set('vol', max(main - 10, 50)) 465 # else: 466 # pcm = self.wm.mixer_get('pcm') 467 # if pcm > 0: 468 # self.wm.mixer_set('pcm', max(pcm - 10, 0)) 469 # else: 470 # self.wm.display.bell(100) 471 # 472 # self.wm.mixer_status_view(devs = ('vol', 'pcm')) 473 # 474 # def F8(self, evt): 475 # # raise volume. First pcm to 100, then main to 100 476 # pcm = self.wm.mixer_get('pcm') 477 # if pcm < 100: 478 # self.wm.mixer_set('pcm', min(pcm + 10, 100)) 479 # else: 480 # main = self.wm.mixer_get('vol') 481 # if main < 100: 482 # self.wm.mixer_set('vol', min(main + 10, 100)) 483 # else: 484 # self.wm.display.bell(-50) 485 # 486 # self.wm.mixer_status_view(devs = ('vol', 'pcm')) 487 # 488 # def S_F7(self, evt): 489 # # toggle mute 490 # self.wm.mixer_mute('pcm') 491 # self.wm.mixer_status_view(devs = ('vol', 'pcm')) 492 # 493 # S_F8 = S_F7 471 def M5_Delete(self, evt): 472 # lower volume. First main to 50, then pcm to 0 473 main = self.wm.mixer_get('vol') 474 if main > 50: 475 self.wm.mixer_set('vol', max(main - 10, 50)) 476 else: 477 pcm = self.wm.mixer_get('pcm') 478 if pcm > 0: 479 self.wm.mixer_set('pcm', max(pcm - 10, 0)) 480 else: 481 self.wm.display.bell(100) 482 483 self.wm.mixer_status_view(devs = ('vol', 'pcm')) 484 485 def M5_Insert(self, evt): 486 # raise volume. First pcm to 100, then main to 100 487 pcm = self.wm.mixer_get('pcm') 488 if pcm < 100: 489 self.wm.mixer_set('pcm', min(pcm + 10, 100)) 490 else: 491 main = self.wm.mixer_get('vol') 492 if main < 100: 493 self.wm.mixer_set('vol', min(main + 10, 100)) 494 else: 495 self.wm.display.bell(-50) 496 497 self.wm.mixer_status_view(devs = ('vol', 'pcm')) 498 499 def M5_End(self, evt): 500 # toggle mute 501 self.wm.mixer_mute('pcm') 502 self.wm.mixer_status_view(devs = ('vol', 'pcm')) 494 503 495 504 -
trunk/plwm/__init__.py
r203 r212 33 33 'cfilter', 34 34 'color', 35 'composite', 35 36 'cycle', 36 37 'deltamove', -
trunk/plwm/wmanager.py
r201 r212 62 62 63 63 class Window: 64 "A container for all window objects on a screen." 64 """Class representing any window object on a screen, either internal 65 or client windows. 66 """ 65 67 66 68 full_screen_windows = cfilter.none … … 94 96 self.border_width = r.border_width 95 97 98 99 def __str__(self): 100 return '<%s %s>' % (self.__class__, self.window) 101 102 def __repr__(self): 103 return self.__str__() 104 96 105 # 97 106 # Internal methods … … 200 209 201 210 211 def set_border_color(self, color): 212 if self.withdrawn: 213 return 214 215 self.window.change_attributes(border_pixel = color) 216 217 202 218 def keep_on_screen(self, x, y, width, height): 203 219 """Return X, Y, WIDTH, HEIGHT after adjusting so the entire window … … 284 300 def map(self): 285 301 if self.withdrawn: return None 302 303 # Perform delayed resizing 304 if self.delayed_moveresize: 305 self.window.configure(x = self.x, y = self.y, 306 width = self.width, 307 height = self.height) 308 self.delayed_moveresize = 0 309 286 310 self.window.map() 287 311 … … 344 368 needs_reparent_clients = cfilter.name('AWTapp') 345 369 370 window_proxy_class = None 371 346 372 def __init__(self, screen, window, maprequest): 347 373 """Create a client object managing WINDOW. … … 353 379 """ 354 380 381 # Let any window proxy in on the fun 382 if self.window_proxy_class is not None: 383 window = self.window_proxy_class(screen, window) 384 355 385 Window.__init__(self, screen, window) 356 386 self.window.change_save_set(X.SetModeInsert) … … 469 499 self.window.delete_property(self.wm.WM_STATE) 470 500 471 501 # Pass note to proxy, if any, that the window is gone 502 if self.window_proxy_class is not None: 503 self.window._proxy_withdraw() 504 505 472 506 def handle_property_notify(self, event): 473 507 """Called when a property has changed on the client window. … … 555 589 self.window.unmap() 556 590 591 debug('client', 'iconify') 592 593 # Prevent us from recieving UnmapNotify events 594 self.dispatch.block_masks(X.StructureNotifyMask) 595 self.screen.dispatch.block_masks(X.SubstructureNotifyMask) 596 597 self.unmap() 598 557 599 self.screen.dispatch.unblock_masks(X.SubstructureNotifyMask) 558 600 self.dispatch.unblock_masks(X.StructureNotifyMask) … … 562 604 self.wm.events.put_event(wmevents.ClientIconified(self)) 563 605 606 564 607 def deiconify(self): 565 608 if self.withdrawn: … … 569 612 return 570 613 614 if self.force_iconified: 615 return 616 571 617 debug('client', 'deiconify') 572 573 # Perform delayed resizing 574 if self.delayed_moveresize: 575 self.window.configure(x = self.x, y = self.y, 576 width = self.width, 577 height = self.height) 578 self.delayed_moveresize = 0 579 580 self.window.map() 618 619 self.map() 581 620 self.mapped = 1 582 621 self.window.set_wm_state(state = Xutil.NormalState, icon = 0) … … 822 861 self.windows = {} 823 862 863 # Map proxy windows to actual windows 864 self.proxy_windows = {} 865 824 866 # Set up event handler for this screen 825 867 self.dispatch = event.WindowDispatcher(self.root) … … 839 881 # Fix a DISPLAY string for this screen by replacing the 840 882 # screen number in the DISPLAY with this screen's number 841 883 842 884 dstr = self.wm.display.get_display_name() 843 885 m = re.search(r'(:\d+)(\.\d+)?$', dstr) … … 913 955 else: 914 956 debug('clients', 'Adding client for %s', window) 915 self.windows[window] = self.wm.client_class(self, window, maprequest) 916 self.windows[window].initial_map() 917 self.wm.events.put_event(wmevents.AddClient(self.windows[window])) 957 client = self.wm.client_class(self, window, maprequest) 958 959 # Use what client think its window is, to handle proxy windows 960 self.windows[client.window] = client 961 962 client.initial_map() 963 self.wm.events.put_event(wmevents.AddClient(client)) 918 964 return 1 919 965 … … 956 1002 957 1003 def get_window(self, window): 958 return self.windows.get(window, None) 1004 """Translate an Xlib window object into its controlling Window 1005 or Client object. 1006 1007 Returns None if the Xlib window isn't known. 1008 """ 1009 1010 while window is not None: 1011 try: 1012 return self.windows[window] 1013 except KeyError: 1014 # Try to translate via proxy window 1015 window = self.proxy_windows.get(window, None) 1016 1017 return None 1018 959 1019 960 1020 def is_client(self, window): 961 1021 return isinstance(self.get_window(window), Client) 1022 962 1023 963 1024 def is_internal_window(self, window): 964 1025 return isinstance(self.get_window(window), InternalWindow) 1026 1027 1028 def add_proxy_window(self, proxy, window): 1029 """Add a proxy window, so that get_window() on PROXY leads on 1030 to WINDOW to find the actual Window object. 1031 """ 1032 1033 self.proxy_windows[proxy] = window 1034 1035 1036 def remove_proxy_window(self, proxy): 1037 """Remove a proxy window previously registered with add_proxy_window(). 1038 """ 1039 1040 del self.proxy_windows[proxy] 1041 965 1042 966 1043 def query_clients(self, client_filter = cfilter.all, stackorder = 0): … … 1748 1825 1749 1826 1827 class WindowProxyBase: 1828 """Base class for proxy objects for the real Xlib window objects. 1829 1830 These proxies can override the Xlib window object methods when 1831 necessary. 1832 """ 1833 1834 def __init__(self, screen, window): 1835 self._screen = screen 1836 self._window = window 1837 self._wm = screen.wm 1838 1839 # These Xlib casts allows the proxy object to be passed to any 1840 # Xlib method expecting one of the following objects 1841 self.__resource__ = window.__resource__ 1842 self.__drawable__ = window.__resource__ 1843 self.__window__ = window.__resource__ 1844 1845 # And these allows the proxy, for dictionary purposes, to 1846 # pretend to be the actual window object. 1847 self.__cmp__ = window.__cmp__ 1848 self.__hash__ = window.__hash__ 1849 1850 1851 def __getattr__(self, attr): 1852 # Unknown attribute in the proxy, grab it from the real window instead 1853 v = getattr(self._window, attr) 1854 1855 # And avoid this getting called again for this attr 1856 setattr(self, attr, v) 1857 1858 return v 1859 1860 1861 def _proxy_withdraw(self): 1862 """Called by Client when the proxied window is gone, to allow any cleanup. 1863 """ 1864 pass 1865 1866 1867 def __str__(self): 1868 return '<%s for %s 0x%08x>' % ( 1869 self.__class__, 1870 self._window.__class__, self._window.id) 1871 1872 1873 def __repr__(self): 1874 return self.__str__() 1750 1875 1751 1876
