minecraft-pi-reborn/media-layer/extras/src/SDL.c

43 lines
1.0 KiB
C
Raw Normal View History

2021-06-17 21:32:24 +00:00
#include <SDL/SDL.h>
#include <SDL/SDL_syswm.h>
#include <X11/Xlib.h>
#include <sys/wait.h>
#include <libreborn/libreborn.h>
2021-09-12 03:18:12 +00:00
#include <media-layer/core.h>
2021-06-17 21:32:24 +00:00
// SDL Stub
void *SDL_SetVideoMode(__attribute__((unused)) int width, __attribute__((unused)) int height, __attribute__((unused)) int bpp, __attribute__((unused)) uint32_t flags) {
// Return Value Is Only Used For A NULL-Check
return (void *) 1;
}
static void x11_nop() {
// NOP
}
int SDL_GetWMInfo(SDL_SysWMinfo *info) {
// Return Fake Lock Functions Since XLib Isn't Directly Used
SDL_SysWMinfo ret;
ret.info.x11.lock_func = x11_nop;
ret.info.x11.unlock_func = x11_nop;
ret.info.x11.display = NULL;
ret.info.x11.window = 0;
ret.info.x11.wmwindow = ret.info.x11.window;
*info = ret;
return 1;
}
// Quit
2022-05-14 02:36:12 +00:00
void SDL_Quit() {
2021-06-17 21:32:24 +00:00
// Cleanup Media Layer
media_cleanup();
// Wait For Children To Stop
2022-05-14 02:36:12 +00:00
signal(SIGCHLD, SIG_IGN);
murder_children();
2021-06-17 21:32:24 +00:00
while (wait(NULL) > 0) {}
// Exit
2022-04-15 01:12:42 +00:00
INFO("Stopped");
2021-06-17 21:32:24 +00:00
}