• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1from cffi import FFI
2ffi = FFI()
3ffi.cdef("""
4
5typedef ... Display;
6typedef struct { ...; } Window;
7
8typedef struct { int type; ...; } XEvent;
9
10Display *XOpenDisplay(char *display_name);
11Window DefaultRootWindow(Display *display);
12int XMapRaised(Display *display, Window w);
13Window XCreateSimpleWindow(Display *display, Window parent, int x, int y,
14                           unsigned int width, unsigned int height,
15                           unsigned int border_width, unsigned long border,
16                           unsigned long background);
17int XNextEvent(Display *display, XEvent *event_return);
18""")
19
20ffi.set_source('_xclient_cffi', """
21            #include <X11/Xlib.h>
22""", libraries=['X11'])
23
24if __name__ == '__main__':
25    ffi.compile(verbose=True)
26