Ejemplo n.º 1
0
def cb_MappingNotifyEvent(e):
    newmap = keysym.get_keyboard_mapping(state.conn).reply()

    # Update the key codes that may have changed
    if e.request == xcb.xproto.Mapping.Keyboard:
        changes = {}

        for kc in xrange(*keysym.get_min_max_keycode(state.conn)):
            knew = keysym.get_keysym(state.conn, newmap, kc)
            oldkc = keysym.get_keycode(state.conn, state.get_kbmap(), knew)

            if oldkc != kc:
                changes[oldkc] = kc

        state.set_kbmap(newmap)
        events.regrab(changes)
    # Update the modifier mappings that may have changed
    elif e.request == xcb.xproto.Mapping.Modifier:
        state.set_keys_to_mods(keysym.get_keys_to_mods(state.conn))
Ejemplo n.º 2
0
def cb_MappingNotifyEvent(e):
    newmap = keysym.get_keyboard_mapping(state.conn).reply()

    # Update the key codes that may have changed
    if e.request == xcb.xproto.Mapping.Keyboard:
        changes = {}

        for kc in xrange(*keysym.get_min_max_keycode(state.conn)):
            knew = keysym.get_keysym(state.conn, newmap, kc)
            oldkc = keysym.get_keycode(state.conn, state.get_kbmap(), knew)

            if oldkc != kc:
                changes[oldkc] = kc

        state.set_kbmap(newmap)
        events.regrab(changes)
    # Update the modifier mappings that may have changed
    elif e.request == xcb.xproto.Mapping.Modifier:
        state.set_keys_to_mods(keysym.get_keys_to_mods(state.conn))
Ejemplo n.º 3
0
# Temporary hack
rsetup.width_in_pixels  = 1920
rsetup.height_in_pixels = 1080

pyndow = conn.generate_id()
core.CreateWindow(rsetup.root_depth, pyndow, root, -1000, -1000, 1,
                       1, 0, xproto.WindowClass.InputOutput, rsetup.root_visual,
                       xproto.CW.EventMask | xproto.CW.OverrideRedirect,
                       [xproto.EventMask.PropertyChange, 1])
core.MapWindow(pyndow)

grab_pointer  = False
grab_keyboard = False

__kbmap = keysym.get_keyboard_mapping(conn)
__keystomods = keysym.get_keys_to_mods(conn)

FC = cursor.FontCursor
cursors = {
    'LeftPtr': cursor.create_font_cursor(conn, FC.LeftPtr),
    'Fleur': cursor.create_font_cursor(conn, FC.Fleur),
    'Watch': cursor.create_font_cursor(conn, FC.Watch),
    'TopSide': cursor.create_font_cursor(conn, FC.TopSide),
    'TopRightCorner': cursor.create_font_cursor(conn, FC.TopRightCorner),
    'RightSide': cursor.create_font_cursor(conn, FC.RightSide),
    'BottomRightCorner': cursor.create_font_cursor(conn, FC.BottomRightCorner),
    'BottomSide': cursor.create_font_cursor(conn, FC.BottomSide),
    'BottomLeftCorner': cursor.create_font_cursor(conn, FC.BottomLeftCorner),
    'LeftSide': cursor.create_font_cursor(conn, FC.LeftSide),
    'TopLeftCorner': cursor.create_font_cursor(conn, FC.TopLeftCorner)