# Path: pwm/config.py
# class Config:
#     def __init__(self):
#     def load(self, default=False):
#     def _load_default(self):
#     def _ensure_config_exists(self, path):
#     def __getattr__(self, name):
# def setup_keys():
# def handle_key_press_event(event):
# def create_arguments(func):
#     def wrapper(*args, **kwargs):
# 
# Path: pwm/ffi/xcb.py
# class XcbError(Exception):
# class Cookie:
# class Xcb:
#     def __init__(self, error):
#     def __str__(self):
#     def __init__(self, name, value):
#     def __getattr__(self, name):
#     def reply(self):
#     def check(self):
#     def __init__(self):
#     def __getattr__(self, name):
#         def request(func, *args, **kwargs):
#     def connect(self, display=None):
#     def mask(self, masks):
# 
# Path: pwm/ffi/cairo.py
# class CairoError(Exception):
# class Context:
# class Cairo:
#     def __init__(self, ctx):
#     def __getattr__(self, name):
#     def encode(self, text):
#     def select_font_face(self, face, slant, weight):
#     def text_extents(self, text, extents):
#     def show_text(self, text):
#     def __init__(self):
#     def __getattr__(self, name):
#     def create(self, surface):


from pwm.config import config
from pwm.ffi.xcb import xcb
from pwm.ffi.cairo import cairo
import pwm.color as color
import pwm.events
import pwm.windows
import pwm.widgets
        self.handlers = pwm.events.HandlerList()
        self.handlers.add(pwm.events.focus_changed, self.handle_focus_changed)
        self.handlers.add(pwm.events.window_name_changed,
                          self.handle_window_name_changed)
        self.handlers.add(pwm.events.window_unmapped,
                          self.handle_window_unmapped)
        self.handlers.add(pwm.events.workspace_switched,
                          self.handle_workspace_switched)
        self.handlers.add(pwm.events.window_exposed,
                          self.handle_window_exposed)
        self.handlers.add(pwm.events.window_urgent_set,
                          self.handle_window_urgent_set)

    def destroy(self):
        self.handlers.destroy()
        pwm.windows.destroy(self.wid)
        cairo.surface_destroy(self.surface)
        self.ctx.destroy()
        xcb.core.free_pixmap(self.pixmap)
        xcb.core.free_gc(self.gc)

    def create_window(self):
        mask = [(xcb.CW_OVERRIDE_REDIRECT, 1),
                (xcb.CW_BACK_PIXEL, color.get_pixel(config.bar.background)),
                (xcb.CW_EVENT_MASK, xcb.EVENT_MASK_EXPOSURE)]

        return pwm.windows.create(self.x, self.y, self.width, self.height,
                                  xcb.mask(mask))

    def create_pixmap(self):

# Path: pwm/config.py
# class Config:
#     def __init__(self):
#     def load(self, default=False):
#     def _load_default(self):
#     def _ensure_config_exists(self, path):
#     def __getattr__(self, name):
# def setup_keys():
# def handle_key_press_event(event):
# def create_arguments(func):
#     def wrapper(*args, **kwargs):
# 
# Path: pwm/ffi/xcb.py
# class XcbError(Exception):
# class Cookie:
# class Xcb:
#     def __init__(self, error):
#     def __str__(self):
#     def __init__(self, name, value):
#     def __getattr__(self, name):
#     def reply(self):
#     def check(self):
#     def __init__(self):
#     def __getattr__(self, name):
#         def request(func, *args, **kwargs):
#     def connect(self, display=None):
#     def mask(self, masks):
# 
# Path: pwm/ffi/cairo.py
# class CairoError(Exception):
# class Context:
# class Cairo:
#     def __init__(self, ctx):
#     def __getattr__(self, name):
#     def encode(self, text):
#     def select_font_face(self, face, slant, weight):
#     def text_extents(self, text, extents):
#     def show_text(self, text):
#     def __init__(self):
#     def __getattr__(self, name):
#     def create(self, surface):


# Path: pwm/bar.py
from pwm.config import config
from pwm.ffi.xcb import xcb
from pwm.ffi.cairo import cairo
import pwm.color as color
import pwm.events
import pwm.windows
import pwm.widgets

        self.handlers = pwm.events.HandlerList()
        self.handlers.add(pwm.events.focus_changed, self.handle_focus_changed)
        self.handlers.add(pwm.events.window_name_changed,
                          self.handle_window_name_changed)
        self.handlers.add(pwm.events.window_unmapped,
                          self.handle_window_unmapped)
        self.handlers.add(pwm.events.workspace_switched,
                          self.handle_workspace_switched)
        self.handlers.add(pwm.events.window_exposed,
                          self.handle_window_exposed)
        self.handlers.add(pwm.events.window_urgent_set,
                          self.handle_window_urgent_set)

    def destroy(self):
        self.handlers.destroy()
        pwm.windows.destroy(self.wid)
        cairo.surface_destroy(self.surface)
        self.ctx.destroy()
        xcb.core.free_pixmap(self.pixmap)
        xcb.core.free_gc(self.gc)

    def create_window(self):
        mask = [(xcb.CW_OVERRIDE_REDIRECT, 1),
                (xcb.CW_BACK_PIXEL, color.get_pixel(config.bar.background)),
                (xcb.CW_EVENT_MASK, xcb.EVENT_MASK_EXPOSURE)]

        return pwm.windows.create(self.x, self.y, self.width, self.height,
                                  xcb.mask(mask))

    def create_pixmap(self):

        pixmap = xcb.core.generate_id()