2016-06-18 12:46:12 +00:00
|
|
|
/*************************************************************************/
|
|
|
|
/* os_haiku.cpp */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
2017-08-27 12:16:55 +00:00
|
|
|
/* https://godotengine.org */
|
2016-06-18 12:46:12 +00:00
|
|
|
/*************************************************************************/
|
2019-01-01 11:53:14 +00:00
|
|
|
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
|
2016-06-18 12:46:12 +00:00
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/*************************************************************************/
|
2018-01-04 23:50:27 +00:00
|
|
|
|
2018-08-11 11:05:48 +00:00
|
|
|
#include "drivers/gles3/rasterizer_gles3.h"
|
|
|
|
|
2017-08-27 19:07:15 +00:00
|
|
|
#include "os_haiku.h"
|
2015-06-20 23:08:31 +00:00
|
|
|
|
2017-08-27 19:07:15 +00:00
|
|
|
#include "main/main.h"
|
2015-06-11 19:57:41 +00:00
|
|
|
#include "servers/physics/physics_server_sw.h"
|
2017-03-05 15:44:50 +00:00
|
|
|
#include "servers/visual/visual_server_raster.h"
|
|
|
|
#include "servers/visual/visual_server_wrap_mt.h"
|
2015-06-11 19:57:41 +00:00
|
|
|
|
2017-08-27 19:07:15 +00:00
|
|
|
#include <Screen.h>
|
2015-05-25 00:49:24 +00:00
|
|
|
|
2015-05-25 03:02:55 +00:00
|
|
|
OS_Haiku::OS_Haiku() {
|
2015-07-25 23:18:32 +00:00
|
|
|
#ifdef MEDIA_KIT_ENABLED
|
2017-01-16 18:19:45 +00:00
|
|
|
AudioDriverManager::add_driver(&driver_media_kit);
|
2015-07-25 23:18:32 +00:00
|
|
|
#endif
|
2015-05-25 03:02:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void OS_Haiku::run() {
|
2015-06-11 19:57:41 +00:00
|
|
|
if (!main_loop) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
main_loop->init();
|
2015-07-02 15:41:32 +00:00
|
|
|
context_gl->release_current();
|
|
|
|
|
|
|
|
// TODO: clean up
|
2017-03-05 15:44:50 +00:00
|
|
|
BMessenger *bms = new BMessenger(window);
|
|
|
|
BMessage *msg = new BMessage();
|
2015-07-02 15:41:32 +00:00
|
|
|
bms->SendMessage(LOCKGL_MSG, msg);
|
|
|
|
|
2015-06-16 18:52:24 +00:00
|
|
|
window->StartMessageRunner();
|
2015-06-11 19:57:41 +00:00
|
|
|
app->Run();
|
2015-06-16 18:52:24 +00:00
|
|
|
window->StopMessageRunner();
|
2015-06-11 19:57:41 +00:00
|
|
|
|
2015-06-20 00:43:11 +00:00
|
|
|
delete app;
|
2015-07-02 15:41:32 +00:00
|
|
|
|
|
|
|
delete bms;
|
|
|
|
delete msg;
|
2015-06-11 19:57:41 +00:00
|
|
|
main_loop->finish();
|
2015-05-25 03:02:55 +00:00
|
|
|
}
|
|
|
|
|
2015-05-25 00:49:24 +00:00
|
|
|
String OS_Haiku::get_name() {
|
|
|
|
return "Haiku";
|
|
|
|
}
|
2015-05-25 03:02:55 +00:00
|
|
|
|
|
|
|
int OS_Haiku::get_video_driver_count() const {
|
2015-05-29 21:57:07 +00:00
|
|
|
return 1;
|
2015-05-25 03:02:55 +00:00
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
const char *OS_Haiku::get_video_driver_name(int p_driver) const {
|
2017-11-19 16:52:18 +00:00
|
|
|
return "GLES3";
|
2015-05-25 03:02:55 +00:00
|
|
|
}
|
|
|
|
|
2018-07-20 09:56:18 +00:00
|
|
|
int OS_Haiku::get_current_video_driver() const {
|
|
|
|
return video_driver_index;
|
|
|
|
}
|
|
|
|
|
2018-01-03 17:26:44 +00:00
|
|
|
Error OS_Haiku::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
|
2015-05-28 00:42:40 +00:00
|
|
|
main_loop = NULL;
|
2015-05-29 21:57:07 +00:00
|
|
|
current_video_mode = p_desired;
|
2015-05-28 00:42:40 +00:00
|
|
|
|
2015-06-11 19:57:41 +00:00
|
|
|
app = new HaikuApplication();
|
|
|
|
|
2015-06-16 18:52:24 +00:00
|
|
|
BRect frame;
|
|
|
|
frame.Set(50, 50, 50 + current_video_mode.width - 1, 50 + current_video_mode.height - 1);
|
|
|
|
|
|
|
|
window = new HaikuDirectWindow(frame);
|
2015-07-02 15:41:32 +00:00
|
|
|
window->SetVideoMode(¤t_video_mode);
|
2015-06-16 18:52:24 +00:00
|
|
|
|
2015-06-23 18:22:12 +00:00
|
|
|
if (current_video_mode.fullscreen) {
|
|
|
|
window->SetFullScreen(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!current_video_mode.resizable) {
|
|
|
|
uint32 flags = window->Flags();
|
|
|
|
flags |= B_NOT_RESIZABLE;
|
|
|
|
window->SetFlags(flags);
|
|
|
|
}
|
|
|
|
|
2017-10-12 22:18:04 +00:00
|
|
|
#if defined(OPENGL_ENABLED)
|
2015-06-16 18:52:24 +00:00
|
|
|
context_gl = memnew(ContextGL_Haiku(window));
|
2015-06-11 19:57:41 +00:00
|
|
|
context_gl->initialize();
|
2015-07-02 15:41:32 +00:00
|
|
|
context_gl->make_current();
|
2017-12-08 16:58:28 +00:00
|
|
|
context_gl->set_use_vsync(current_video_mode.use_vsync);
|
2018-08-11 11:05:48 +00:00
|
|
|
RasterizerGLES3::register_config();
|
|
|
|
RasterizerGLES3::make_current();
|
2017-11-19 16:52:18 +00:00
|
|
|
|
2015-05-28 00:42:40 +00:00
|
|
|
#endif
|
|
|
|
|
2018-11-01 18:22:15 +00:00
|
|
|
visual_server = memnew(VisualServerRaster);
|
|
|
|
// FIXME: Reimplement threaded rendering
|
2017-01-14 11:26:56 +00:00
|
|
|
if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
|
2018-11-01 13:27:04 +00:00
|
|
|
visual_server = memnew(VisualServerWrapMT(visual_server, false));
|
2017-01-14 11:26:56 +00:00
|
|
|
}
|
2018-11-01 13:27:04 +00:00
|
|
|
|
|
|
|
ERR_FAIL_COND_V(!visual_server, ERR_UNAVAILABLE);
|
2015-05-29 21:57:07 +00:00
|
|
|
|
2018-07-20 09:56:18 +00:00
|
|
|
video_driver_index = p_video_driver;
|
|
|
|
|
2015-07-02 15:41:32 +00:00
|
|
|
input = memnew(InputDefault);
|
|
|
|
window->SetInput(input);
|
|
|
|
|
|
|
|
window->Show();
|
2015-05-29 21:57:07 +00:00
|
|
|
visual_server->init();
|
2015-06-11 19:57:41 +00:00
|
|
|
|
2017-09-13 16:34:22 +00:00
|
|
|
AudioDriverManager::initialize(p_audio_driver);
|
2017-03-05 15:44:50 +00:00
|
|
|
|
2018-01-03 17:26:44 +00:00
|
|
|
return OK;
|
2015-05-25 03:02:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void OS_Haiku::finalize() {
|
2015-05-28 00:42:40 +00:00
|
|
|
if (main_loop) {
|
|
|
|
memdelete(main_loop);
|
|
|
|
}
|
|
|
|
|
|
|
|
main_loop = NULL;
|
|
|
|
|
|
|
|
visual_server->finish();
|
|
|
|
memdelete(visual_server);
|
2015-06-11 19:57:41 +00:00
|
|
|
|
2015-06-16 18:52:24 +00:00
|
|
|
memdelete(input);
|
|
|
|
|
2017-10-12 22:18:04 +00:00
|
|
|
#if defined(OPENGL_ENABLED)
|
2015-06-11 19:57:41 +00:00
|
|
|
memdelete(context_gl);
|
|
|
|
#endif
|
2015-05-25 03:02:55 +00:00
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void OS_Haiku::set_main_loop(MainLoop *p_main_loop) {
|
2015-05-28 00:42:40 +00:00
|
|
|
main_loop = p_main_loop;
|
2015-06-16 18:52:24 +00:00
|
|
|
input->set_main_loop(p_main_loop);
|
2015-06-19 22:59:32 +00:00
|
|
|
window->SetMainLoop(p_main_loop);
|
2015-05-25 03:02:55 +00:00
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
MainLoop *OS_Haiku::get_main_loop() const {
|
2015-05-28 00:42:40 +00:00
|
|
|
return main_loop;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OS_Haiku::delete_main_loop() {
|
|
|
|
if (main_loop) {
|
|
|
|
memdelete(main_loop);
|
|
|
|
}
|
|
|
|
|
|
|
|
main_loop = NULL;
|
2015-06-19 22:59:32 +00:00
|
|
|
window->SetMainLoop(NULL);
|
2015-05-25 03:02:55 +00:00
|
|
|
}
|
|
|
|
|
2015-06-11 19:57:41 +00:00
|
|
|
void OS_Haiku::release_rendering_thread() {
|
2015-06-16 18:52:24 +00:00
|
|
|
context_gl->release_current();
|
2015-06-11 19:57:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void OS_Haiku::make_rendering_thread() {
|
2015-06-16 18:52:24 +00:00
|
|
|
context_gl->make_current();
|
2015-06-11 19:57:41 +00:00
|
|
|
}
|
|
|
|
|
2015-05-25 03:02:55 +00:00
|
|
|
bool OS_Haiku::can_draw() const {
|
2015-06-11 19:57:41 +00:00
|
|
|
// TODO: implement
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OS_Haiku::swap_buffers() {
|
|
|
|
context_gl->swap_buffers();
|
2015-05-25 03:02:55 +00:00
|
|
|
}
|
|
|
|
|
2017-03-29 15:29:38 +00:00
|
|
|
Point2 OS_Haiku::get_mouse_position() const {
|
2015-06-18 19:41:33 +00:00
|
|
|
return window->GetLastMousePosition();
|
2015-05-25 03:02:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int OS_Haiku::get_mouse_button_state() const {
|
2015-06-18 19:41:33 +00:00
|
|
|
return window->GetLastButtonMask();
|
2015-05-25 03:02:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void OS_Haiku::set_cursor_shape(CursorShape p_shape) {
|
2015-06-18 19:41:33 +00:00
|
|
|
//ERR_PRINT("set_cursor_shape() NOT IMPLEMENTED");
|
2015-05-25 03:02:55 +00:00
|
|
|
}
|
|
|
|
|
2017-11-10 10:50:11 +00:00
|
|
|
void OS_Haiku::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
|
|
|
|
// TODO
|
|
|
|
}
|
|
|
|
|
2015-06-20 23:08:31 +00:00
|
|
|
int OS_Haiku::get_screen_count() const {
|
|
|
|
// TODO: implement get_screen_count()
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int OS_Haiku::get_current_screen() const {
|
|
|
|
// TODO: implement get_current_screen()
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OS_Haiku::set_current_screen(int p_screen) {
|
|
|
|
// TODO: implement set_current_screen()
|
|
|
|
}
|
|
|
|
|
|
|
|
Point2 OS_Haiku::get_screen_position(int p_screen) const {
|
|
|
|
// TODO: make this work with the p_screen parameter
|
2017-03-05 15:44:50 +00:00
|
|
|
BScreen *screen = new BScreen(window);
|
2015-06-20 23:08:31 +00:00
|
|
|
BRect frame = screen->Frame();
|
|
|
|
delete screen;
|
|
|
|
return Point2i(frame.left, frame.top);
|
|
|
|
}
|
|
|
|
|
|
|
|
Size2 OS_Haiku::get_screen_size(int p_screen) const {
|
|
|
|
// TODO: make this work with the p_screen parameter
|
2017-03-05 15:44:50 +00:00
|
|
|
BScreen *screen = new BScreen(window);
|
2015-06-20 23:08:31 +00:00
|
|
|
BRect frame = screen->Frame();
|
|
|
|
delete screen;
|
|
|
|
return Size2i(frame.IntegerWidth() + 1, frame.IntegerHeight() + 1);
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void OS_Haiku::set_window_title(const String &p_title) {
|
2015-06-11 19:57:41 +00:00
|
|
|
window->SetTitle(p_title.utf8().get_data());
|
2015-05-25 03:02:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Size2 OS_Haiku::get_window_size() const {
|
2015-06-20 12:35:54 +00:00
|
|
|
BSize size = window->Size();
|
2015-06-20 23:08:31 +00:00
|
|
|
return Size2i(size.IntegerWidth() + 1, size.IntegerHeight() + 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OS_Haiku::set_window_size(const Size2 p_size) {
|
|
|
|
// TODO: why does it stop redrawing after this is called?
|
|
|
|
window->ResizeTo(p_size.x, p_size.y);
|
2015-06-20 12:35:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Point2 OS_Haiku::get_window_position() const {
|
|
|
|
BPoint point(0, 0);
|
|
|
|
window->ConvertToScreen(&point);
|
|
|
|
return Point2i(point.x, point.y);
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void OS_Haiku::set_window_position(const Point2 &p_position) {
|
2015-06-20 12:35:54 +00:00
|
|
|
window->MoveTo(p_position.x, p_position.y);
|
2015-05-25 03:02:55 +00:00
|
|
|
}
|
|
|
|
|
2015-06-20 23:08:31 +00:00
|
|
|
void OS_Haiku::set_window_fullscreen(bool p_enabled) {
|
|
|
|
window->SetFullScreen(p_enabled);
|
|
|
|
current_video_mode.fullscreen = p_enabled;
|
|
|
|
visual_server->init();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool OS_Haiku::is_window_fullscreen() const {
|
|
|
|
return current_video_mode.fullscreen;
|
|
|
|
}
|
|
|
|
|
2015-06-23 18:22:12 +00:00
|
|
|
void OS_Haiku::set_window_resizable(bool p_enabled) {
|
|
|
|
uint32 flags = window->Flags();
|
|
|
|
|
|
|
|
if (p_enabled) {
|
|
|
|
flags &= ~(B_NOT_RESIZABLE);
|
|
|
|
} else {
|
|
|
|
flags |= B_NOT_RESIZABLE;
|
|
|
|
}
|
|
|
|
|
|
|
|
window->SetFlags(flags);
|
2015-07-02 15:41:32 +00:00
|
|
|
current_video_mode.resizable = p_enabled;
|
2015-06-23 18:22:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool OS_Haiku::is_window_resizable() const {
|
2015-07-02 15:41:32 +00:00
|
|
|
return current_video_mode.resizable;
|
2015-06-23 18:22:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void OS_Haiku::set_window_minimized(bool p_enabled) {
|
|
|
|
window->Minimize(p_enabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool OS_Haiku::is_window_minimized() const {
|
|
|
|
return window->IsMinimized();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OS_Haiku::set_window_maximized(bool p_enabled) {
|
|
|
|
window->Minimize(!p_enabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool OS_Haiku::is_window_maximized() const {
|
|
|
|
return !window->IsMinimized();
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void OS_Haiku::set_video_mode(const VideoMode &p_video_mode, int p_screen) {
|
2015-05-29 21:57:07 +00:00
|
|
|
ERR_PRINT("set_video_mode() NOT IMPLEMENTED");
|
2015-05-25 03:02:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
OS::VideoMode OS_Haiku::get_video_mode(int p_screen) const {
|
2015-05-29 21:57:07 +00:00
|
|
|
return current_video_mode;
|
2015-05-25 03:02:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void OS_Haiku::get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen) const {
|
2015-05-29 21:57:07 +00:00
|
|
|
ERR_PRINT("get_fullscreen_mode_list() NOT IMPLEMENTED");
|
2015-05-25 03:02:55 +00:00
|
|
|
}
|
2015-05-25 03:34:16 +00:00
|
|
|
|
|
|
|
String OS_Haiku::get_executable_path() const {
|
|
|
|
return OS::get_executable_path();
|
|
|
|
}
|
2017-07-19 20:00:46 +00:00
|
|
|
|
|
|
|
bool OS_Haiku::_check_internal_feature_support(const String &p_feature) {
|
|
|
|
|
|
|
|
return p_feature == "pc" || p_feature == "s3tc";
|
|
|
|
}
|
Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).
Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows
So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.
Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.
user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.
For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.
Part of #3513.
2017-11-17 16:11:41 +00:00
|
|
|
|
|
|
|
String OS_Haiku::get_config_path() const {
|
|
|
|
|
|
|
|
if (has_environment("XDG_CONFIG_HOME")) {
|
|
|
|
return get_environment("XDG_CONFIG_HOME");
|
|
|
|
} else if (has_environment("HOME")) {
|
2018-08-11 11:05:48 +00:00
|
|
|
return get_environment("HOME").plus_file("config/settings");
|
Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).
Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows
So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.
Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.
user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.
For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.
Part of #3513.
2017-11-17 16:11:41 +00:00
|
|
|
} else {
|
|
|
|
return ".";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
String OS_Haiku::get_data_path() const {
|
|
|
|
|
|
|
|
if (has_environment("XDG_DATA_HOME")) {
|
|
|
|
return get_environment("XDG_DATA_HOME");
|
|
|
|
} else if (has_environment("HOME")) {
|
2018-08-11 11:05:48 +00:00
|
|
|
return get_environment("HOME").plus_file("config/data");
|
Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).
Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows
So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.
Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.
user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.
For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.
Part of #3513.
2017-11-17 16:11:41 +00:00
|
|
|
} else {
|
|
|
|
return get_config_path();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
String OS_Haiku::get_cache_path() const {
|
|
|
|
|
|
|
|
if (has_environment("XDG_CACHE_HOME")) {
|
|
|
|
return get_environment("XDG_CACHE_HOME");
|
|
|
|
} else if (has_environment("HOME")) {
|
2018-08-11 11:05:48 +00:00
|
|
|
return get_environment("HOME").plus_file("config/cache");
|
Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).
Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows
So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.
Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.
user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.
For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.
Part of #3513.
2017-11-17 16:11:41 +00:00
|
|
|
} else {
|
|
|
|
return get_config_path();
|
|
|
|
}
|
|
|
|
}
|
2018-08-11 11:05:48 +00:00
|
|
|
|
|
|
|
OS::PowerState OS_Haiku::get_power_state() {
|
|
|
|
WARN_PRINT("Power management is not implemented on this platform, defaulting to POWERSTATE_UNKNOWN");
|
|
|
|
return OS::POWERSTATE_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
int OS_Haiku::get_power_seconds_left() {
|
|
|
|
WARN_PRINT("Power management is not implemented on this platform, defaulting to -1");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int OS_Haiku::get_power_percent_left() {
|
|
|
|
WARN_PRINT("Power management is not implemented on this platform, defaulting to -1");
|
|
|
|
return -1;
|
|
|
|
}
|