1
0
mirror of synced 2024-11-24 07:40:17 +01:00

fix: Window title being cleared after ImHex exits

This commit is contained in:
WerWolv 2023-06-10 15:08:56 +02:00
parent 0e8273eaa7
commit 73d4214fd3
2 changed files with 13 additions and 13 deletions

View File

@ -13,15 +13,15 @@
#include <wolv/types/type_name.hpp>
#define EVENT_DEF_IMPL(event_name, should_log, ...) \
#define EVENT_DEF_IMPL(event_name, event_name_string, should_log, ...) \
struct event_name final : public hex::impl::Event<__VA_ARGS__> { \
constexpr static auto Id = [] { return hex::impl::EventId(); }(); \
constexpr static auto Id = [] { return hex::impl::EventId(event_name_string); }(); \
constexpr static auto ShouldLog = (should_log); \
explicit event_name(Callback func) noexcept : Event(std::move(func)) { } \
}
#define EVENT_DEF(event_name, ...) EVENT_DEF_IMPL(event_name, true, __VA_ARGS__)
#define EVENT_DEF_NO_LOG(event_name, ...) EVENT_DEF_IMPL(event_name, false, __VA_ARGS__)
#define EVENT_DEF(event_name, ...) EVENT_DEF_IMPL(event_name, #event_name, true, __VA_ARGS__)
#define EVENT_DEF_NO_LOG(event_name, ...) EVENT_DEF_IMPL(event_name, #event_name, false, __VA_ARGS__)
struct GLFWwindow;
@ -31,9 +31,9 @@ namespace hex {
class EventId {
public:
explicit constexpr EventId(const char *func = __builtin_FUNCTION(), u32 line = __builtin_LINE()) {
this->m_hash = line ^ 987654321;
for (auto c : std::string_view(func)) {
explicit constexpr EventId(const char *eventName) {
this->m_hash = 0x811C'9DC5;
for (auto c : std::string_view(eventName)) {
this->m_hash = (this->m_hash >> 5) | (this->m_hash << 27);
this->m_hash ^= c;
}

View File

@ -227,7 +227,7 @@ namespace hex::init {
cfg.MergeMode = true;
// Add font awesome and codicons icons to font atlas
cfg.GlyphOffset = ImVec2(0, 3);
cfg.GlyphOffset = ImVec2(0, 3_scaled);
fonts->AddFontFromMemoryCompressedTTF(font_awesome_compressed_data, font_awesome_compressed_size, 0, &cfg, fontAwesomeRange);
fonts->AddFontFromMemoryCompressedTTF(codicons_compressed_data, codicons_compressed_size, 0, &cfg, codiconsRange);
@ -276,6 +276,8 @@ namespace hex::init {
EventManager::post<EventImHexClosing>();
EventManager::clear();
while (ImHexApi::Provider::isValid())
ImHexApi::Provider::remove(ImHexApi::Provider::get());
ContentRegistry::Provider::impl::getEntries().clear();
@ -348,8 +350,6 @@ namespace hex::init {
fs::setFileBrowserErrorCallback(nullptr);
EventManager::clear();
return true;
}