[GB.GUI]
* NEW: If one GUI component fails to load, try the other one. * NEW: Abort if no GUI component is found. * NEW: Define the GB_GUI environment variable with the GUI component actually loaded. [GB.GUI.OPENGL] * NEW: Always load the OpenGL support component associated with what lies in the GB_GUI environment variable. git-svn-id: svn://localhost/gambas/trunk@5925 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
46ee39c5a1
commit
b9930f0701
2 changed files with 35 additions and 21 deletions
|
@ -50,16 +50,9 @@ int EXPORT GB_INIT(void)
|
|||
|
||||
if (!comp)
|
||||
{
|
||||
comp = "gb.gtk.opengl";
|
||||
|
||||
env = getenv("KDE_FULL_SESSION");
|
||||
|
||||
if (env && !strcmp(env, "true"))
|
||||
{
|
||||
env = getenv("KDE_SESSION_VERSION");
|
||||
if (env && !strcmp(env, "4"))
|
||||
comp = "gb.qt4.opengl";
|
||||
}
|
||||
// GB_GUI should be set by gb.gui
|
||||
fprintf(stderr, "gb.gui.opengl: error: no component specified in GB_GUI environment variable");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (GB.Component.Load(comp))
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
|
||||
#include "main.h"
|
||||
|
||||
#define USE_NOTHING 0
|
||||
#define USE_GB_QT4 1
|
||||
#define USE_GB_GTK 2
|
||||
|
||||
GB_INTERFACE GB EXPORT;
|
||||
|
||||
// Prevents gbi3 from complaining
|
||||
|
@ -38,21 +42,23 @@ char *GB_INCLUDE EXPORT = "gb.qt4";
|
|||
|
||||
int EXPORT GB_INIT(void)
|
||||
{
|
||||
const char *comp = NULL;
|
||||
int use = USE_NOTHING;
|
||||
char *env;
|
||||
|
||||
const char *comp;
|
||||
const char *comp2;
|
||||
|
||||
env = getenv("GB_GUI");
|
||||
if (env)
|
||||
{
|
||||
if (!strcmp(env, "gb.qt4"))
|
||||
comp = "gb.qt4";
|
||||
else if (!strcmp(env, "gb.gtk"))
|
||||
comp = "gb.gtk";
|
||||
if (strcmp(env, "gb.qt4") == 0)
|
||||
use = USE_GB_QT4;
|
||||
else if (strcmp(env, "gb.gtk") == 0)
|
||||
use = USE_GB_GTK;
|
||||
}
|
||||
|
||||
if (!comp)
|
||||
if (use == USE_NOTHING)
|
||||
{
|
||||
comp = "gb.gtk";
|
||||
use = USE_GB_GTK;
|
||||
|
||||
env = getenv("KDE_FULL_SESSION");
|
||||
|
||||
|
@ -60,13 +66,28 @@ int EXPORT GB_INIT(void)
|
|||
{
|
||||
env = getenv("KDE_SESSION_VERSION");
|
||||
if (env && !strcmp(env, "4"))
|
||||
comp = "gb.qt4";
|
||||
use = USE_GB_QT4;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
comp = use == USE_GB_QT4 ? "gb.qt4" : "gb.gtk";
|
||||
|
||||
if (GB.Component.Load(comp))
|
||||
fprintf(stderr, "gb.gui: unable to load '%s' component\n", comp);
|
||||
{
|
||||
comp2 = use == USE_GB_QT4 ? "gb.gtk" : "gb.qt4";
|
||||
|
||||
if (GB.Component.Load(comp2))
|
||||
{
|
||||
fprintf(stderr, "gb.gui: error: unable to find any GUI component. Please install the 'gb.qt4' or 'gb.gtk' component\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fprintf(stderr, "gb.gui: warning: '%s' component not found, using '%s' instead\n", comp, comp2);
|
||||
comp = comp2;
|
||||
}
|
||||
|
||||
setenv("GB_GUI", comp, TRUE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue