we honor safe modes for GL addons too. maybe this should end somewhere in libbe and a userland safemode.h
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25333 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -5,9 +5,11 @@
|
|||||||
* Authors:
|
* Authors:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <image.h>
|
||||||
|
#include <safemode.h>
|
||||||
|
|
||||||
#include <Directory.h>
|
#include <Directory.h>
|
||||||
#include <FindDirectory.h>
|
#include <FindDirectory.h>
|
||||||
#include <image.h>
|
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include "GLDispatcher.h"
|
#include "GLDispatcher.h"
|
||||||
@@ -17,13 +19,49 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
||||||
|
extern "C" status_t _kern_get_safemode_option(const char *parameter,
|
||||||
|
char *buffer, size_t *_bufferSize);
|
||||||
|
#else
|
||||||
|
extern "C" status_t _kget_safemode_option_(const char *parameter,
|
||||||
|
char *buffer, size_t *_bufferSize);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
GLRendererRoster::GLRendererRoster(BGLView *view, ulong options)
|
GLRendererRoster::GLRendererRoster(BGLView *view, ulong options)
|
||||||
: fNextID(0),
|
: fNextID(0),
|
||||||
fView(view),
|
fView(view),
|
||||||
fOptions(options)
|
fOptions(options),
|
||||||
|
fSafeMode(false)
|
||||||
{
|
{
|
||||||
AddDefaultPaths();
|
char parameter[32];
|
||||||
|
size_t parameterLength = sizeof(parameter);
|
||||||
|
|
||||||
|
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
||||||
|
if (_kern_get_safemode_option(B_SAFEMODE_SAFE_MODE, parameter, ¶meterLength) == B_OK)
|
||||||
|
#else
|
||||||
|
if (_kget_safemode_option_(B_SAFEMODE_SAFE_MODE, parameter, ¶meterLength) == B_OK)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
if (!strcasecmp(parameter, "enabled") || !strcasecmp(parameter, "on")
|
||||||
|
|| !strcasecmp(parameter, "true") || !strcasecmp(parameter, "yes")
|
||||||
|
|| !strcasecmp(parameter, "enable") || !strcmp(parameter, "1"))
|
||||||
|
fSafeMode = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
||||||
|
if (_kern_get_safemode_option(B_SAFEMODE_DISABLE_USER_ADD_ONS, parameter, ¶meterLength) == B_OK)
|
||||||
|
#else
|
||||||
|
if (_kget_safemode_option_(B_SAFEMODE_DISABLE_USER_ADD_ONS, parameter, ¶meterLength) == B_OK)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
if (!strcasecmp(parameter, "enabled") || !strcasecmp(parameter, "on")
|
||||||
|
|| !strcasecmp(parameter, "true") || !strcasecmp(parameter, "yes")
|
||||||
|
|| !strcasecmp(parameter, "enable") || !strcmp(parameter, "1"))
|
||||||
|
fSafeMode = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
AddDefaultPaths();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -55,7 +93,7 @@ GLRendererRoster::AddDefaultPaths()
|
|||||||
B_BEOS_ADDONS_DIRECTORY,
|
B_BEOS_ADDONS_DIRECTORY,
|
||||||
};
|
};
|
||||||
|
|
||||||
for (uint32 i = 0; i < sizeof(paths) / sizeof(paths[0]); i++) {
|
for (uint32 i = fSafeMode ? 2 : 0; i < sizeof(paths) / sizeof(paths[0]); i++) {
|
||||||
BPath path;
|
BPath path;
|
||||||
status_t status = find_directory(paths[i], &path, true);
|
status_t status = find_directory(paths[i], &path, true);
|
||||||
if (status == B_OK && path.Append("opengl") == B_OK)
|
if (status == B_OK && path.Append("opengl") == B_OK)
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ class GLRendererRoster {
|
|||||||
int32 fNextID;
|
int32 fNextID;
|
||||||
BGLView *fView;
|
BGLView *fView;
|
||||||
ulong fOptions;
|
ulong fOptions;
|
||||||
|
bool fSafeMode;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _GLRENDERER_ROSTER_H */
|
#endif /* _GLRENDERER_ROSTER_H */
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ SubDir HAIKU_TOP src kits opengl ;
|
|||||||
|
|
||||||
SetSubDirSupportedPlatformsBeOSCompatible ;
|
SetSubDirSupportedPlatformsBeOSCompatible ;
|
||||||
|
|
||||||
UsePrivateHeaders opengl ;
|
UsePrivateHeaders kernel opengl ;
|
||||||
|
|
||||||
if $(TARGET_PLATFORM) != haiku {
|
if $(TARGET_PLATFORM) != haiku {
|
||||||
UseHeaders [ FDirName $(HAIKU_TOP) headers os opengl ] : true ;
|
UseHeaders [ FDirName $(HAIKU_TOP) headers os opengl ] : true ;
|
||||||
|
|||||||
Reference in New Issue
Block a user