def get_window_prop(dpy, window, prop_name, max_size=2):
"""
Returns (nitems, property) of specified window or (-1, None) if anything fails.
Returned 'property' is POINTER(c_void_p) and has to be freed using X.free().
"""
prop_atom = intern_atom(dpy, prop_name, False)
type_return, format_return = Atom(), Atom()
nitems, bytes_after = c_ulong(), c_ulong()
prop = c_void_p()
if SUCCESS == get_window_property(dpy, window,
prop_atom, 0, max_size, False, ANYPROPERTYTYPE,
byref(type_return), byref(format_return), byref(nitems),
byref(bytes_after), byref(prop)):
return nitems.value, prop
return -1, None
评论列表
文章目录