unix: Factor out the check for GTK into an internal function

This will allow the same check to be done by the libdecor integration.

Helps: https://github.com/libsdl-org/sdl2-compat/issues/564
Signed-off-by: Simon McVittie <smcv@debian.org>
This commit is contained in:
Simon McVittie
2025-12-28 13:41:06 +00:00
committed by Sam Lantinga
parent 76352f2931
commit 9e0b31b297
2 changed files with 11 additions and 1 deletions

View File

@@ -81,12 +81,21 @@ static bool IsGtkInit()
return libgdk != NULL && libgtk != NULL;
}
static bool InitGtk(void)
bool SDL_CanUseGtk(void)
{
if (!SDL_GetHintBoolean("SDL_ENABLE_GTK", true)) {
return false;
}
return true;
}
static bool InitGtk(void)
{
if (!SDL_CanUseGtk()) {
return false;
}
if (IsGtkInit()) {
return true;
}

View File

@@ -116,6 +116,7 @@ typedef struct SDL_GtkContext
} gtk;
} SDL_GtkContext;
extern bool SDL_CanUseGtk(void);
extern bool SDL_Gtk_Init(void);
extern void SDL_Gtk_Quit(void);
extern SDL_GtkContext *SDL_Gtk_EnterContext(void);