This commit is contained in:
Ingy döt Net 2013-04-10 16:57:12 -07:00
parent 518da4a923
commit 764da6cbbb
6144 changed files with 83610 additions and 11 deletions

View file

@ -0,0 +1,26 @@
(load "@lib/gcc.l")
(gcc "x11" '("-lX11") 'xOpenDisplay 'xCloseDisplay)
#include <X11/Xlib.h>
any xOpenDisplay(any ex) {
any x = evSym(cdr(ex)); // Get display name
char display[bufSize(x)]; // Create a buffer for the name
bufString(x, display); // Upack the name
return boxCnt((long)XOpenDisplay(display));
}
any xCloseDisplay(any ex) {
return boxCnt(XCloseDisplay((Display*)evCnt(ex, cdr(ex))));
}
/**/
# With that we can open and close the display:
: (setq Display (xOpenDisplay ":0.7")) # Wrong
-> 0
: (setq Display (xOpenDisplay ":0.0")) # Correct
-> 158094320
: (xCloseDisplay Display)
-> 0

View file

@ -0,0 +1,4 @@
: (setq Display (native "/usr/lib/libX11.so.6" "XOpenDisplay" 'N ":0.0"))
-> 6502688
: (native "/usr/lib/libX11.so.6" "XCloseDisplay" 'I Display)
-> 0