X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fvideo%2Fomapdss%2FSDL_x11reuse.c;fp=src%2Fvideo%2Fomapdss%2FSDL_x11reuse.c;h=d95bd6518024609b27318290921bfd859fbab767;hb=ee7e6b2d8bc82029aac405d13f719f4532851224;hp=0000000000000000000000000000000000000000;hpb=7eac0547921ad8b0b522a50716e5d21021ec06fb;p=sdl_omap.git diff --git a/src/video/omapdss/SDL_x11reuse.c b/src/video/omapdss/SDL_x11reuse.c new file mode 100644 index 0000000..d95bd65 --- /dev/null +++ b/src/video/omapdss/SDL_x11reuse.c @@ -0,0 +1,62 @@ +/* this file is all aobut reusing stock SDL's x11 functions */ + +#include "SDL_x11reuse.h" +#define SDL_PrivateVideoData SDL_x11_PrivateVideoData +#include "../x11/SDL_x11video.h" + +/* mess from SDL_x11video.h */ +#undef SDL_Display +#undef GFX_Display +#undef SDL_Screen +#undef WMwindow +#undef SDL_iconcolors + +struct x11reuse_context { + SDL_VideoDevice fake_device; + struct SDL_x11_PrivateVideoData fake_x11private; +}; + +struct x11reuse_context *x11reuse_init(void) +{ + struct x11reuse_context *retval; + int ret; + + ret = SDL_X11_LoadSymbols(); + if (ret == 0) { + fprintf(stderr, "omapsdl: SDL_X11_LoadSymbols failed\n"); + return NULL; + } + + retval = calloc(1, sizeof(*retval)); + if (retval == NULL) + return NULL; + + retval->fake_device.hidden = &retval->fake_x11private; + return retval; +} + +void x11reuse_SetCaption(struct x11reuse_context *context, + void *display, int screen, void *window, + const char *title, const char *icon) +{ + if (context == NULL) + return; + + context->fake_x11private.X11_Display = + context->fake_x11private.GFX_Display = display; + context->fake_x11private.WMwindow = (Window)window; + X11_SetCaptionNoLock(&context->fake_device, title, icon); +} + +void x11reuse_SetIcon(struct x11reuse_context *context, + void *display, int screen, void *window, + void *icon, void *mask) +{ + if (context == NULL) + return; + + context->fake_x11private.X11_Display = + context->fake_x11private.GFX_Display = display; + context->fake_x11private.WMwindow = (Window)window; + X11_SetIcon(&context->fake_device, icon, mask); +}