Merge branch 'master' of https://gitlab.com/gambas/gambas
This commit is contained in:
commit
daafba28dc
3 changed files with 48 additions and 1 deletions
|
@ -451,9 +451,22 @@ static void hook_main(int *argc, char ***argv)
|
|||
{
|
||||
static bool init = false;
|
||||
|
||||
char *env;
|
||||
|
||||
if (init)
|
||||
return;
|
||||
|
||||
env = getenv("GB_GUI_PLATFORM");
|
||||
if (env && *env)
|
||||
{
|
||||
if (!strcasecmp(env, "X11"))
|
||||
putenv((char *)"GDK_BACKEND=x11");
|
||||
else if (!strcasecmp(env, "WAYLAND"))
|
||||
putenv((char *)"GDK_BACKEND=wayland");
|
||||
else
|
||||
fprintf(stderr, "gb.gtk3: warning: unknown platform: %s\n", env);
|
||||
}
|
||||
|
||||
gApplication::init(argc, argv);
|
||||
|
||||
load_platform();
|
||||
|
|
|
@ -718,11 +718,23 @@ static void hook_main(int *argc, char ***argv)
|
|||
{
|
||||
QString platform;
|
||||
const char *comp;
|
||||
char *env;
|
||||
|
||||
env = getenv("GB_GUI_PLATFORM");
|
||||
if (env && *env)
|
||||
{
|
||||
if (!strcasecmp(env, "X11"))
|
||||
putenv((char *)"QT_QPA_PLATFORM=xcb");
|
||||
else if (!strcasecmp(env, "WAYLAND"))
|
||||
putenv((char *)"QT_QPA_PLATFORM=wayland");
|
||||
else
|
||||
fprintf(stderr, QT_NAME ": warning: unknown platform: %s\n", env);
|
||||
}
|
||||
|
||||
new MyApplication(*argc, *argv);
|
||||
|
||||
platform = qApp->platformName();
|
||||
fprintf(stderr, "platform = %s\n", TO_UTF8(platform));
|
||||
|
||||
if (platform == "wayland")
|
||||
{
|
||||
comp = "gb.qt5.wayland";
|
||||
|
|
|
@ -131,6 +131,28 @@ static bool event_loop()
|
|||
|
||||
static void my_main(int *argc, char **argv)
|
||||
{
|
||||
char *env;
|
||||
const char *driver = NULL;
|
||||
|
||||
env = getenv("GB_GUI_PLATFORM");
|
||||
if (env && *env)
|
||||
{
|
||||
if (!strcasecmp(env, "wayland"))
|
||||
driver = "SDL_VIDEODRIVER=wayland";
|
||||
else if (!strcasecmp(env, "x11"))
|
||||
driver = "SDL_VIDEODRIVER=x11";
|
||||
else
|
||||
fprintf(stderr, "gb.sdl2: warning: unsupported platform: %s\n", env);
|
||||
}
|
||||
|
||||
if (!driver)
|
||||
{
|
||||
if (getenv("WAYLAND_DISPLAY"))
|
||||
putenv("SDL_VIDEODRIVER=wayland");
|
||||
}
|
||||
else
|
||||
putenv((char *)driver);
|
||||
|
||||
init_sdl();
|
||||
|
||||
CLASS_Window = GB.FindClass("Window");
|
||||
|
|
Loading…
Reference in a new issue