2021-08-18 20:36:46 +00:00
|
|
|
#include "window.hpp"
|
|
|
|
|
|
|
|
#if defined(OS_MACOS)
|
|
|
|
|
2022-07-02 15:53:13 +00:00
|
|
|
#include <hex/api/imhex_api.hpp>
|
2022-02-01 17:09:40 +00:00
|
|
|
#include <hex/api/content_registry.hpp>
|
|
|
|
#include <hex/api/event.hpp>
|
|
|
|
|
2022-06-30 13:09:57 +00:00
|
|
|
#include <hex/helpers/utils_macos.hpp>
|
2022-01-17 19:06:00 +00:00
|
|
|
#include <hex/helpers/logger.hpp>
|
|
|
|
|
2021-09-16 20:23:51 +00:00
|
|
|
#include <nlohmann/json.hpp>
|
2022-01-17 19:06:00 +00:00
|
|
|
#include <unistd.h>
|
2021-09-16 20:23:51 +00:00
|
|
|
|
2022-08-04 07:51:07 +00:00
|
|
|
#include <imgui_impl_glfw.h>
|
|
|
|
|
2022-01-24 19:53:17 +00:00
|
|
|
namespace hex {
|
2021-08-18 20:36:46 +00:00
|
|
|
|
2022-01-24 19:53:17 +00:00
|
|
|
void Window::initNative() {
|
|
|
|
if (!isatty(STDOUT_FILENO)) {
|
|
|
|
log::redirectToFile();
|
2021-08-22 18:24:42 +00:00
|
|
|
}
|
2022-01-24 19:53:17 +00:00
|
|
|
}
|
2021-08-22 18:24:42 +00:00
|
|
|
|
2022-01-24 19:53:17 +00:00
|
|
|
void Window::setupNativeWindow() {
|
2022-08-04 07:51:07 +00:00
|
|
|
ImGui_ImplGlfw_SetBorderlessWindowMode(false);
|
|
|
|
|
2022-07-02 14:22:38 +00:00
|
|
|
bool themeFollowSystem = ImHexApi::System::usesSystemThemeDetection();
|
2022-01-24 19:53:17 +00:00
|
|
|
EventManager::subscribe<EventOSThemeChanged>(this, [themeFollowSystem] {
|
|
|
|
if (!themeFollowSystem) return;
|
2021-12-10 15:09:55 +00:00
|
|
|
|
2022-06-30 13:09:57 +00:00
|
|
|
if (!isMacosSystemDarkModeEnabled())
|
2022-12-29 18:26:00 +00:00
|
|
|
EventManager::post<RequestChangeTheme>("Light");
|
2022-06-30 13:09:57 +00:00
|
|
|
else
|
2022-12-29 18:26:00 +00:00
|
|
|
EventManager::post<RequestChangeTheme>("Dark");
|
2022-01-24 19:53:17 +00:00
|
|
|
});
|
2021-08-18 20:36:46 +00:00
|
|
|
|
2022-01-24 19:53:17 +00:00
|
|
|
if (themeFollowSystem)
|
|
|
|
EventManager::post<EventOSThemeChanged>();
|
|
|
|
}
|
2021-08-18 20:36:46 +00:00
|
|
|
|
2022-01-24 19:53:17 +00:00
|
|
|
void Window::beginNativeWindowFrame() {
|
|
|
|
}
|
2021-08-18 21:12:27 +00:00
|
|
|
|
2022-01-24 19:53:17 +00:00
|
|
|
void Window::endNativeWindowFrame() {
|
|
|
|
}
|
2021-08-18 21:12:27 +00:00
|
|
|
|
2022-01-24 19:53:17 +00:00
|
|
|
void Window::drawTitleBar() {
|
2021-08-18 20:36:46 +00:00
|
|
|
}
|
|
|
|
|
2022-01-24 19:53:17 +00:00
|
|
|
}
|
|
|
|
|
2021-08-18 20:36:46 +00:00
|
|
|
#endif
|