예제 #1
0
def mainloop():
    wm = Manager(Xconn)
    wm.register_handlers()
    bind_launcher_keys()
    #Should move these to Manager.register_handlers()
    keybind.bind_global_key('KeyRelease', 'Mod4-x', quit)
    try:
        while True:
            if exit:
                break
            event.read()
            for e in event.queue():
                #print e
                w = None
                if wm.no_window(e):
                    w = None
                elif hasattr(e, 'window'):
                    w = e.window
                elif hasattr(e, 'event'):
                    w = e.event
                elif hasattr(e, 'requestor'):
                    w = e.requestor
                key = (e.__class__, w)
                for cb in event.__callbacks.get(key, []):
                    cb(e)
                wm.conn.flush()
    except xcb.Exception:
        traceback.print_exc()
        sys.exit(1)
예제 #2
0
def mainloop():
    wm = Manager(Xconn)
    wm.register_handlers()
    bind_launcher_keys()
    #Should move these to Manager.register_handlers()
    keybind.bind_global_key('KeyRelease', 'Mod4-x', quit)
    try:
        while True:
            if exit:
                break
            event.read()
            for e in event.queue():
                #print e
                w = None
                if wm.no_window(e):
                    w = None
                elif hasattr(e, 'window'):
                    w = e.window
                elif hasattr(e, 'event'):
                    w = e.event
                elif hasattr(e, 'requestor'):
                    w = e.requestor
                key = (e.__class__, w)
                for cb in event.__callbacks.get(key, []):
                    cb(e)
                wm.conn.flush()
    except xcb.Exception:
        traceback.print_exc()
        sys.exit(1)
예제 #3
0
events.register_callback(xproto.MappingNotifyEvent,
                         root.cb_MappingNotifyEvent, state.root)
events.register_callback(xproto.MapRequestEvent,
                         client.cb_MapRequestEvent, state.root)
events.register_callback(xproto.FocusInEvent,
                         client.cb_FocusInEvent, state.root)
events.register_callback(xproto.FocusOutEvent,
                         client.cb_FocusOutEvent, state.root)
events.register_callback(xproto.ConfigureRequestEvent,
                         window.cb_ConfigureRequestEvent, state.root)
events.register_callback(xproto.MotionNotifyEvent, grab.drag_do,
                         state.pyndow, None, None, None)
events.register_callback(xproto.ButtonReleaseEvent, grab.drag_end,
                         state.pyndow, None, None, None)

state.root_focus()

while True:
    event.read(state.conn, block=True)
    for e in event.queue():
        events.dispatch(e)

    events.run_latent()

    state.conn.flush()

    if state.die:
        break

misc.spawn('killall Xephyr')