summaryrefslogtreecommitdiff
path: root/xlib_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlib_api.c')
-rw-r--r--xlib_api.c171
1 files changed, 171 insertions, 0 deletions
diff --git a/xlib_api.c b/xlib_api.c
new file mode 100644
index 0000000..990a748
--- /dev/null
+++ b/xlib_api.c
@@ -0,0 +1,171 @@
+#include <dlfcn.h>
+#include "xenon.h"
+#include "window.h"
+#include "display.h"
+
+Status XAllocColor(
+ Display* display,
+ Colormap colormap,
+ XColor* screen_in_out
+)
+{
+}
+
+int XCloseDisplay(
+ Display* display
+)
+{
+ printf("close display ok\n");
+}
+
+
+GC XCreateGC(
+ Display* display,
+ Drawable d,
+ unsigned long valuemask,
+ XGCValues* values
+)
+{
+ // XXX init hack, remove when the renderer is changed to gallium
+ extern int init_done;
+ if (!init_done)
+ {
+ void* handle;
+ handle = dlopen("/usr/lib64/libX11.so.6", RTLD_LAZY);
+ if (!handle)
+ handle = dlopen("/usr/lib/libX11.so.6", RTLD_LAZY);
+ if (!handle)
+ printf("can't open libX11\n");
+ typedef GC (* XCreateGCfunc) (Display*, Drawable,unsigned long, XGCValues*);
+ XCreateGCfunc XCreateGCreal = dlsym(handle, "XCreateGC");
+ return XCreateGCreal(display, d, valuemask, values);
+ }
+
+ printf("create GC ok\n");
+}
+
+Window XCreateSimpleWindow(
+ Display* display,
+ Window parent,
+ int x,
+ int y,
+ unsigned int width,
+ unsigned int height,
+ unsigned int border_width,
+ unsigned long border,
+ unsigned long background
+)
+{
+ Window wid = window_create();
+ window_resize(wid, width, height);
+ window_move(wid, x, y);
+ printf("simple window ok\n");
+ return wid;
+}
+
+int XDrawRectangle(
+ Display* display,
+ Drawable d,
+ GC gc,
+ int x,
+ int y,
+ unsigned int width,
+ unsigned int height
+)
+{
+ printf("draw rectangle ok\n");
+}
+
+int XDrawString(
+ Display* display,
+ Drawable d,
+ GC gc,
+ int x,
+ int y,
+ _Xconst char* string,
+ int length
+)
+{
+ printf("draw string ok\n");
+}
+
+int XFillRectangle(
+ Display* display,
+ Drawable d,
+ GC gc,
+ int x,
+ int y,
+ unsigned int width,
+ unsigned int height
+)
+{
+ printf("fill rectangle ok\n");
+}
+
+int XFlush(
+ Display* display
+)
+{
+ printf("flush ok\n");
+ // XXX here call render_update
+}
+
+void XFlushGC(
+ Display* display,
+ GC gc
+)
+{
+ XFlush(display);
+}
+
+int XMapWindow(
+ Display* display,
+ Window w
+)
+{
+ printf("map window ok\n");
+
+}
+
+int XNextEvent(
+ Display* display,
+ XEvent* event_return
+)
+{
+}
+
+Display *XOpenDisplay(
+ _Xconst char* name /* display_name */
+)
+{
+ Display* r = display_find(name);
+ printf("open display ok\n");
+ return r;
+}
+
+Status XParseColor(
+ Display* display,
+ Colormap colormap,
+ _Xconst char* spec,
+ XColor* exact_def_return
+)
+{
+}
+
+int XSelectInput(
+ Display* display,
+ Window w,
+ long event_mask
+)
+{
+}
+
+int XSetForeground(
+ Display* display,
+ GC gc,
+ unsigned long foreground
+)
+{
+}
+
+