<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>idea.txt</filename>
    </added>
    <added>
      <filename>whimsy/actions/misc.py</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -47,6 +47,9 @@ class if_multiclick:
         return self.count == \
             props.get_prop(signal.wm.dpy, signal.wm.root, '_WHIMSY_MULTICLICK_COUNT')
 
+
+# move these into window_manager, minus the if_; keep if_ versions here as
+# wrapper filters
 def if_should_manage_existing_window(signal):
     attr = signal.win.get_attributes()
     return (</diff>
      <filename>whimsy/filters/__init__.py</filename>
    </modified>
    <modified>
      <diff>@@ -2,6 +2,8 @@
 
 from Xlib import X, XK
 
+# hmmm, is it really necessary to swallow the release events?
+
 class binding_base:
     def __init__(self, detail, mods, **options):
         self.detail = detail
@@ -34,12 +36,17 @@ class if_key_press(binding_base):
         binding_base.__init__(self, None, mods, **options)
 
     def __call__(self, signal):
-        if self.detail == None:
+        if self.detail is None:
+            # maybe we should just do this in __init__
             self.detail = signal.wm.dpy.keysym_to_keycode(
                 XK.string_to_keysym(self.keyname)
             )
         return binding_base.__call__(self, signal)
 
+class if_key_release(if_key_press):
+    execute_event_types = [X.KeyRelease]
+    swallow_event_types = [X.KeyRelease]
+
 class if_button_press(binding_base):
     execute_event_types = [X.ButtonPress]
     swallow_event_types = [X.ButtonPress, X.ButtonRelease]
@@ -48,7 +55,3 @@ class if_button_release(if_button_press):
     execute_event_types = [X.ButtonRelease]
     swallow_event_types = [X.ButtonRelease]
 
-class if_key_release(if_key_press):
-    execute_event_types = [X.KeyRelease]
-    swallow_event_types = [X.KeyRelease]
-</diff>
      <filename>whimsy/filters/bindings.py</filename>
    </modified>
    <modified>
      <diff>@@ -5,38 +5,19 @@ from Xlib import X
 from whimsy import event, modifiers, props, util, infrastructure, window_manager
 from whimsy.actions import ewmh
 
+from whimsy.actions.misc import socksend
 from whimsy.actions.builtins import *
 from whimsy.actions.event_handling import *
 from whimsy.infrastructure.modifiers import *
 from whimsy.filters import *
 from whimsy.filters.bindings import *
 
-import logging
-
-logging.basicConfig(
-    level=logging.INFO,
-    format=&quot;%(asctime)s %(levelname)-8s %(message)s&quot;,
-)
-
 wm = infrastructure.init()
 
 root_geometry = wm.root.get_geometry()
 W = root_geometry.width
 H = root_geometry.height
 
-class wrap_xevent:
-    def __call__(self, signal):
-        import time
-        t = time.time()
-        signal.wm.signal('event_begin', ev=signal.xev)
-        signal.wm.signal('event',       ev=signal.xev)
-        signal.wm.signal('event_done',  ev=signal.xev)
-        t2 = time.time()
-        logging.debug('took %0.2f ms to handle %s' % ((t2-t) * 1000, signal.xev.__class__.__name__))
-
-# raw x events come in on the 'xevent' signal
-wm.register('xevent', wrap_xevent())
-
 startup_shutdown_signal_methods = {
     'wm_manage_after': 'startup',
     'wm_shutdown_before': 'shutdown',
@@ -60,17 +41,6 @@ wm.register_methods(ewmh.net_desktop_viewport(), {
     'after_viewport_move': 'refresh',
 })
 
-#IDEA!!
-# have the wm have 'states' or 'scenes' (in game terms)
-# this would allow for clean move/resize loops
-# have some handlers that persist in all new scenes (just a boolean called 'persist'?)
-
-# perhaps somehow split actions up into &lt;which window(s)&gt; and &lt;what to do
-# to it/them&gt;
-
-# perhaps clean up variations between functions and callable instances -- the
-# randomness of parentheses is confusing
-
 wm.register('wm_manage_after',            discover_existing_windows)
 wm.register('existing_window_discovered', manage_window, [ if_should_manage_existing_window ])
 wm.register('event',                      manage_window, [ if_(X.MapRequest), if_should_manage_new_window ])
@@ -80,61 +50,54 @@ wm.register('client_init_after', client_method('map_normal'))
 
 # how to focus root now?
 
-wm.register('event', client_method('focus'),      [ if_(X.MapRequest,     'client') ])
-wm.register('event', client_method('focus'),      [ if_(X.EnterNotify,    'client'), if_state(~ButtonMask) ]) #use infrastructure.modifiers.ButtonMask.matches()
-wm.register('event', remove_client(),             [ if_(X.DestroyNotify,  'client') ])
-wm.register('event', remove_client(),             [ if_(X.UnmapNotify,    'client') ])
-wm.register('event', update_client_list_focus,    [ if_(X.FocusIn,        'client') ])
-wm.register('event', update_client_property(),    [ if_(X.PropertyNotify, 'client') ])
-wm.register('event', focus_last_focused,          [ if_(X.DestroyNotify)    ])
-wm.register('event', install_colormap(),          [ if_(X.ColormapNotify)   ])
-wm.register('event', configure_request_handler(), [ if_(X.ConfigureRequest) ])
-wm.register('event', update_last_button_press,    [ if_(X.ButtonPress)      ])
-
-wm.register('event', viewport_absolute_move(  0,   0), [ if_key_press(&quot;u&quot;,      C+A) ])
-wm.register('event', viewport_absolute_move(  W,   0), [ if_key_press(&quot;i&quot;,      C+A) ])
-wm.register('event', viewport_absolute_move(W*2,   0), [ if_key_press(&quot;o&quot;,      C+A) ])
-wm.register('event', viewport_absolute_move(  0,   H), [ if_key_press(&quot;j&quot;,      C+A) ])
-wm.register('event', viewport_absolute_move(  W,   H), [ if_key_press(&quot;k&quot;,      C+A) ])
-wm.register('event', viewport_absolute_move(W*2,   H), [ if_key_press(&quot;l&quot;,      C+A) ])
-wm.register('event', viewport_absolute_move(  0, H*2), [ if_key_press(&quot;m&quot;,      C+A) ])
-wm.register('event', viewport_absolute_move(  W, H*2), [ if_key_press(&quot;comma&quot;,  C+A) ])
-wm.register('event', viewport_absolute_move(W*2, H*2), [ if_key_press(&quot;period&quot;, C+A) ])
-
-wm.register('event', viewport_relative_move(-W,  0),   [ if_key_press(&quot;Left&quot;,  C) ])
-wm.register('event', viewport_relative_move(+W,  0),   [ if_key_press(&quot;Right&quot;, C) ])
-wm.register('event', viewport_relative_move( 0, -H),   [ if_key_press(&quot;Up&quot;,    C) ])
-wm.register('event', viewport_relative_move( 0, +H),   [ if_key_press(&quot;Down&quot;,  C) ])
-
-wm.register('event', execute(&quot;aterm&quot;),                    [ if_key_press(&quot;x&quot;, C+A) ])
-wm.register('event', execute(&quot;sleep 1; xset s activate&quot;), [ if_key_press(&quot;s&quot;, C+A) ])
-
-def socksend(host, port, text):
-    import socket
-    try:
-        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-        s.connect((host, port))
-        s.send(text)
-        s.close()
-    except socket.error:
-        pass
+act = lambda *args: wm.register(&quot;event&quot;, *args)
+
+act(client_method('focus'),      [ if_(X.MapRequest,     'client') ])
+act(client_method('focus'),      [ if_(X.EnterNotify,    'client'), if_state(~ButtonMask) ])
+act(remove_client(),             [ if_(X.DestroyNotify,  'client') ])
+act(remove_client(),             [ if_(X.UnmapNotify,    'client') ])
+act(update_client_list_focus,    [ if_(X.FocusIn,        'client') ])
+act(update_client_property(),    [ if_(X.PropertyNotify, 'client') ])
+act(focus_last_focused,          [ if_(X.DestroyNotify)    ])
+act(install_colormap(),          [ if_(X.ColormapNotify)   ])
+act(configure_request_handler(), [ if_(X.ConfigureRequest) ])
+act(update_last_button_press,    [ if_(X.ButtonPress)      ])
+
+act(viewport_absolute_move(  0,   0), [ if_key_press(&quot;u&quot;,      C+A) ])
+act(viewport_absolute_move(  W,   0), [ if_key_press(&quot;i&quot;,      C+A) ])
+act(viewport_absolute_move(W*2,   0), [ if_key_press(&quot;o&quot;,      C+A) ])
+act(viewport_absolute_move(  0,   H), [ if_key_press(&quot;j&quot;,      C+A) ])
+act(viewport_absolute_move(  W,   H), [ if_key_press(&quot;k&quot;,      C+A) ])
+act(viewport_absolute_move(W*2,   H), [ if_key_press(&quot;l&quot;,      C+A) ])
+act(viewport_absolute_move(  0, H*2), [ if_key_press(&quot;m&quot;,      C+A) ])
+act(viewport_absolute_move(  W, H*2), [ if_key_press(&quot;comma&quot;,  C+A) ])
+act(viewport_absolute_move(W*2, H*2), [ if_key_press(&quot;period&quot;, C+A) ])
+
+act(viewport_relative_move(-W,  0),   [ if_key_press(&quot;Left&quot;,  C) ])
+act(viewport_relative_move(+W,  0),   [ if_key_press(&quot;Right&quot;, C) ])
+act(viewport_relative_move( 0, -H),   [ if_key_press(&quot;Up&quot;,    C) ])
+act(viewport_relative_move( 0, +H),   [ if_key_press(&quot;Down&quot;,  C) ])
+
+act(execute(&quot;aterm&quot;), [ if_key_press(&quot;x&quot;, C+A) ])
+act(execute(&quot;aterm&quot;), [ if_root, if_button_press(1, Any), if_multiclick(2) ])
+
+act(execute(&quot;sleep 1; xset s activate&quot;), [ if_key_press(&quot;s&quot;, C+A) ])
 
 def mpd(cmd):
     socksend('localhost', 6600, &quot;%s\n&quot; % cmd)
 
-wm.register('event', lambda ev: mpd(&quot;previous&quot;), [ if_key_press(&quot;z&quot;, M4) ])
-wm.register('event', lambda ev: mpd(&quot;stop&quot;),     [ if_key_press(&quot;x&quot;, M4) ])
-wm.register('event', lambda ev: mpd(&quot;play&quot;),     [ if_key_press(&quot;c&quot;, M4) ])
-wm.register('event', lambda ev: mpd(&quot;pause&quot;),    [ if_key_press(&quot;v&quot;, M4) ])
-wm.register('event', lambda ev: mpd(&quot;next&quot;),     [ if_key_press(&quot;b&quot;, M4) ])
-
-wm.register('event', execute(&quot;aterm&quot;),              [ if_root, if_button_press(1, Any), if_multiclick(2) ])
-wm.register('event', client_method(&quot;focus&quot;),        [ if_client, if_button_press(1, Any, passthru=True) ])
-wm.register('event', delete_client(),               [ if_client, if_key_press('w', C+A) ])
-wm.register('event', start_move(),                  [ if_button_press(1, A), if_client ])
-wm.register('event', start_resize(),                [ if_button_press(3, A), if_client ])
-wm.register('event', client_method('stack_bottom'), [ if_button_press(4, A), if_client ])
-wm.register('event', client_method('stack_top'),    [ if_button_press(5, A), if_client ])
+act(lambda ev: mpd(&quot;previous&quot;), [ if_key_press(&quot;z&quot;, M4) ])
+act(lambda ev: mpd(&quot;stop&quot;),     [ if_key_press(&quot;x&quot;, M4) ])
+act(lambda ev: mpd(&quot;play&quot;),     [ if_key_press(&quot;c&quot;, M4) ])
+act(lambda ev: mpd(&quot;pause&quot;),    [ if_key_press(&quot;v&quot;, M4) ])
+act(lambda ev: mpd(&quot;next&quot;),     [ if_key_press(&quot;b&quot;, M4) ])
+
+act(client_method(&quot;focus&quot;),        [ if_client, if_button_press(1, Any, passthru=True) ])
+act(delete_client(),               [ if_client, if_key_press('w', C+A) ])
+act(start_move(),                  [ if_button_press(1, A), if_client ])
+act(start_resize(),                [ if_button_press(3, A), if_client ])
+act(client_method('stack_bottom'), [ if_button_press(4, A), if_client ])
+act(client_method('stack_top'),    [ if_button_press(5, A), if_client ])
 
 wm.register('event_done', event.smart_replay(),
     [ if_event_type(X.KeyPress, X.KeyRelease, X.ButtonPress, X.ButtonRelease) ]</diff>
      <filename>whimsy/main.py</filename>
    </modified>
    <modified>
      <diff>@@ -39,7 +39,10 @@ class window_manager(x_event_manager, signals.publisher):
 
     # x_event_manager virtual method
     def process_one_event(self):
-        self.signal(&quot;xevent&quot;, xev=self.next_event())
+        ev=self.next_event()
+        self.signal('event_begin', ev=ev)
+        self.signal('event',       ev=ev)
+        self.signal('event_done',  ev=ev)
 
     # MOVE TO SCREEN CLASS?
 </diff>
      <filename>whimsy/window_manager/__init__.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f7ec93755b0f4a88a5333815affa890433927db3</id>
    </parent>
  </parents>
  <author>
    <name>mackstann</name>
    <email>mackstann@982c8757-7e2d-0410-8fcf-a4f776c43a23</email>
  </author>
  <url>http://github.com/mackstann/whimsy/commit/8c5b9131fcc71d200e6b96b29f6bfa1203468d67</url>
  <id>8c5b9131fcc71d200e6b96b29f6bfa1203468d67</id>
  <committed-date>2008-02-26T08:36:26-08:00</committed-date>
  <authored-date>2008-02-26T08:36:26-08:00</authored-date>
  <message>small cleanups/refactoring

git-svn-id: https://whimsy.svn.sourceforge.net/svnroot/whimsy@41 982c8757-7e2d-0410-8fcf-a4f776c43a23</message>
  <tree>e0bdbacfa1da7f301bd1ccacdec5ea8ead0c2615</tree>
  <committer>
    <name>mackstann</name>
    <email>mackstann@982c8757-7e2d-0410-8fcf-a4f776c43a23</email>
  </committer>
</commit>
