Merge branch 'master' into beta

This commit is contained in:
David Capello 2016-12-09 14:38:25 -03:00
commit b0bd722a1f
2 changed files with 12 additions and 4 deletions

View File

@ -1,5 +1,5 @@
// Aseprite // Aseprite
// Copyright (C) 2001-2015 David Capello // Copyright (C) 2001-2016 David Capello
// //
// This program is distributed under the terms of // This program is distributed under the terms of
// the End-User License Agreement for Aseprite. // the End-User License Agreement for Aseprite.
@ -106,7 +106,9 @@ namespace app {
} }
int getDimensionById(const std::string& id) { int getDimensionById(const std::string& id) {
return m_dimensions_by_id[id] * ui::guiscale(); // Warning! Don't use ui::guiscale(), as CurrentTheme::get()
// is still nullptr when we use this getDimensionById()
return m_dimensions_by_id[id] * this->guiscale();
} }
gfx::Color getColorById(const std::string& id) { gfx::Color getColorById(const std::string& id) {

View File

@ -90,9 +90,15 @@ KeyModifiers get_modifiers_from_nsevent(NSEvent* event)
CFStringRef get_unicode_from_key_code(NSEvent* event, CFStringRef get_unicode_from_key_code(NSEvent* event,
const bool translateDeadKeys) const bool translateDeadKeys)
{ {
TISInputSourceRef inputSource = TISCopyCurrentKeyboardInputSource(); // The "TISCopyCurrentKeyboardInputSource()" doesn't contain
// kTISPropertyUnicodeKeyLayoutData (returns nullptr) when the input
// source is Japanese (Romaji/Hiragana/Katakana).
//TISInputSourceRef inputSource = TISCopyCurrentKeyboardInputSource();
TISInputSourceRef inputSource = TISCopyCurrentKeyboardLayoutInputSource();
CFDataRef keyLayoutData = (CFDataRef)TISGetInputSourceProperty(inputSource, kTISPropertyUnicodeKeyLayoutData); CFDataRef keyLayoutData = (CFDataRef)TISGetInputSourceProperty(inputSource, kTISPropertyUnicodeKeyLayoutData);
const UCKeyboardLayout* keyLayout = (const UCKeyboardLayout*)CFDataGetBytePtr(keyLayoutData); const UCKeyboardLayout* keyLayout =
(keyLayoutData ? (const UCKeyboardLayout*)CFDataGetBytePtr(keyLayoutData): nullptr);
UInt32 deadKeyState = (translateDeadKeys ? g_lastDeadKeyState: 0); UInt32 deadKeyState = (translateDeadKeys ? g_lastDeadKeyState: 0);
UniChar output[4]; UniChar output[4];