Fixed Command character on OSX in ImGUI

This commit is contained in:
Slic3rPE 2020-03-19 16:09:52 +01:00
parent cd5154b8e1
commit b4a7822098
2 changed files with 10 additions and 4 deletions

View file

@ -444,9 +444,9 @@ bool ImGuiWrapper::want_any_input() const
#ifdef __APPLE__ #ifdef __APPLE__
static const ImWchar ranges_keyboard_shortcuts[] = static const ImWchar ranges_keyboard_shortcuts[] =
{ {
0x21E7, 0x21E7, // OSX Shift Key symbol
0x2318, 0x2318, // OSX Command Key symbol 0x2318, 0x2318, // OSX Command Key symbol
0x2325, 0x2325, // OSX Option Key symbol 0x2325, 0x2325, // OSX Option Key symbol
0x21E7, 0x21E7, // OSX Shift Key symbol
0, 0,
}; };
#endif // __APPLE__ #endif // __APPLE__
@ -480,9 +480,13 @@ void ImGuiWrapper::init_font(bool compress)
} }
#ifdef __APPLE__ #ifdef __APPLE__
if (! m_font_cjk) ImFontConfig config;
config.MergeMode = true;
if (! m_font_cjk) {
// Apple keyboard shortcuts are only contained in the CJK fonts. // Apple keyboard shortcuts are only contained in the CJK fonts.
io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/NotoSansCJK-Regular.ttf").c_str(), m_font_size, nullptr, ranges_keyboard_shortcuts); ImFont *font_cjk = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/NotoSansCJK-Regular.ttc").c_str(), m_font_size, &config, ranges_keyboard_shortcuts);
assert(font_cjk != nullptr);
}
#endif #endif
// Build texture atlas // Build texture atlas

View file

@ -129,8 +129,10 @@ void RemovableDriveManager::register_window_osx()
void RemovableDriveManager::unregister_window_osx() void RemovableDriveManager::unregister_window_osx()
{ {
if (m_impl_osx) if (m_impl_osx) {
[m_impl_osx release]; [m_impl_osx release];
m_impl_osx = nullptr;
}
} }
namespace search_for_drives_internal namespace search_for_drives_internal