Exemplo n.º 1
0
def get_root_screen_index():
    """Get Screen Index"""
    xwa = globs.XWindowAttributes()
    glob.x11.XGetWindowAttributes(glob.disp, glob.root, ctypes.byref(xwa))
    glob.x11.XScreenNumberOfScreen.argtypes = [ctypes.c_void_p]
    screen_index = glob.x11.XScreenNumberOfScreen(xwa.screen)
    return screen_index
Exemplo n.º 2
0
def get_geom(win):
    """
    Status XQueryTree(display, w, root_return, parent_return, children_return, nchildren_return)
       Display *display;
       Window w;
       Window *root_return;
       Window *parent_return;
       Window **children_return;
       unsigned int *nchildren_return;
    """
    root_return = ctypes.c_ulong()
    parent_return = ctypes.c_ulong()
    children_return = ctypes.c_ulong()
    nchildren_return = ctypes.c_uint()

    glob.x11.XQueryTree(glob.disp,win,ctypes.byref(root_return),ctypes.byref(parent_return),
       ctypes.byref(children_return),ctypes.byref(nchildren_return))

    # undecorated windows have root as parent...
    if (glob.root!=parent_return.value):
        win=parent_return

    xwa = globs.XWindowAttributes()
    glob.x11.XGetWindowAttributes(glob.disp, win,ctypes.byref(xwa))

    get_property("_NET_FRAME_EXTENTS",win,glob.XA_CARDINAL)
    if bool(glob.ret_pointer)==False:
        l,r,t,b = (0,0,0,0)
    else:
        l,r,t,b = glob.ret_pointer[0], glob.ret_pointer[1], glob.ret_pointer[2], glob.ret_pointer[3]

    return xwa.x-l,xwa.y-t,xwa.width+(l+r),xwa.height+(t+b),xwa.root