Commit ea28a2de authored by Peter Hutterer's avatar Peter Hutterer
Browse files

test: expose Display to our fake lib



Easier than hacking around _XPrivDisplay.

Fixes #1
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent 217e3704
Pipeline #148505 passed with stages
in 1 minute and 8 seconds
......@@ -24,6 +24,8 @@
#include <assert.h>
#include <stdlib.h>
#include <string.h>
/* So we get to access Display directly */
#define XLIB_ILLEGAL_ACCESS
#include <X11/Xlib.h>
#include <X11/extensions/Xrandr.h>
......@@ -42,18 +44,18 @@ XOpenDisplay(const char *name)
/* Thanks to the DefaultScreenOfDisplay() macro we need to emulate the
* display struct initialized correctly enough to get past the segfaults
* otherwise */
_XPrivDisplay dpy = calloc(1, sizeof(*dpy));
Display *dpy = calloc(1, sizeof(*dpy));
dpy->default_screen = 0;
dpy->screens = calloc(1, sizeof(Screen));
dpy->screens[0].root = 10;
return (Display*)dpy;
return dpy;
}
int
XCloseDisplay(Display *dpy)
{
assert(dpy);
free(((_XPrivDisplay)&dpy)->screens);
free(dpy->screens);
free(dpy);
return 0;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment