Perform evil experiments (run this driver in a completely different program)

This commit is contained in:
Alcaro 2016-09-07 14:28:15 +02:00
parent cc6fe3159f
commit 3f105fe71f
2 changed files with 16 additions and 4 deletions

View File

@ -14,6 +14,8 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#define _XOPEN_SOURCE 600 // TODO: this doesn't really belong here.
#include <stdlib.h>
#include <string.h>
@ -62,14 +64,20 @@ static void *xshm_gfx_init(const video_info_t *video,
const input_driver_t **input, void **input_data)
{
xshm_t* xshm = (xshm_t*)malloc(sizeof(xshm_t));
Window parent;
XInitThreads();
xshm->display = XOpenDisplay(NULL);
#ifdef RARCH_INTERNAL
parent = DefaultRootWindow(xshm->display);
#else
parent = video->parent;
#endif
XSetWindowAttributes attributes;
attributes.border_pixel=0;
xshm->wndw = XCreateWindow(xshm->display, DefaultRootWindow(xshm->display)/*xshm->parentwindow*/,
xshm->wndw = XCreateWindow(xshm->display, parent,
0, 0, video->width, video->height,
0, 24, CopyFromParent, NULL, CWBorderPixel, &attributes);
XSetWindowBackground(xshm->display, xshm->wndw, 0);
@ -91,8 +99,8 @@ static void *xshm_gfx_init(const video_info_t *video,
xshm->width = video->width;
xshm->height = video->height;
*input = NULL;
*input_data = NULL;
if (input) *input = NULL;
if (input_data) *input_data = NULL;
return xshm;
}
@ -102,7 +110,7 @@ static bool xshm_gfx_frame(void *data, const void *frame, unsigned width,
unsigned pitch, const char *msg)
{
xshm_t* xshm = (xshm_t*)data;
int x, y;
int y;
for (y=0;y<height;y++)
{

View File

@ -123,6 +123,10 @@ typedef struct video_info
/* Use 32bit RGBA rather than native RGB565/XBGR1555. */
bool rgb32;
#ifndef RARCH_INTERNAL
uintptr_t parent;
#endif
} video_info_t;
#define FONT_COLOR_RGBA(r, g, b, a) (((unsigned)(r) << 24) | ((g) << 16) | ((b) << 8) | ((a) << 0))