From d1279f5ef2552adb54027004331ffdaa0c1d4078 Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Wed, 7 Jun 2023 15:47:50 +0200 Subject: [PATCH] drivers/multiple/SDL2: allow overriding SDL_Init() flags --- drivers/multiple/SDL/gdisp_lld_SDL.c | 5 ++++- drivers/multiple/SDL/readme.txt | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/multiple/SDL/gdisp_lld_SDL.c b/drivers/multiple/SDL/gdisp_lld_SDL.c index 2802edd3..722be681 100644 --- a/drivers/multiple/SDL/gdisp_lld_SDL.c +++ b/drivers/multiple/SDL/gdisp_lld_SDL.c @@ -33,6 +33,9 @@ #ifndef GDISP_SCREEN_HEIGHT #define GDISP_SCREEN_HEIGHT 480 #endif +#ifndef UGFX_SDL_INIT_FLAGS + #define UGFX_SDL_INIT_FLAGS SDL_INIT_EVERYTHING +#endif #if GINPUT_NEED_MOUSE // Include mouse support code @@ -311,7 +314,7 @@ static void *SDL_input_event_loop (void *arg) { // Must be executed on early stage of initialization: before threads and timer void sdl_driver_init (void) { - if (SDL_Init(SDL_INIT_EVERYTHING) != 0){ + if (SDL_Init(UGFX_SDL_INIT_FLAGS) != 0){ fprintf(stderr, "Unable to initialize SDL: %s\n", SDL_GetError()); exit (1) ; } diff --git a/drivers/multiple/SDL/readme.txt b/drivers/multiple/SDL/readme.txt index 9e9530d9..b04a0063 100644 --- a/drivers/multiple/SDL/readme.txt +++ b/drivers/multiple/SDL/readme.txt @@ -24,3 +24,7 @@ and a touchscreen driver. 4. Modify your makefile to add `sdl2-config --libs --cflags` to the CFLAGS line. i.e. CFLAGS = `sdl2-config --libs --cflags` + +By default, this driver will pass the `SDL_INIT_EVERYTHING` flag to SDL_Init(). This +can be overriden by defining the UGFX_SDL_INIT_FLAGS macro. +