This is an automated email from the git hooks/post-receive script.

thansen pushed a commit to branch master
in repository aseprite.

commit ed4b26b2c8359571be0613682adf9e4c3fab7c7b
Author: David Capello <[email protected]>
Date:   Mon Apr 11 14:49:26 2016 -0300

    Add get_unicodechar_from_nsevent() to she/osx/view.mm
---
 src/she/osx/view.mm | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/src/she/osx/view.mm b/src/she/osx/view.mm
index 1ba6f3c..1cc7710 100644
--- a/src/she/osx/view.mm
+++ b/src/she/osx/view.mm
@@ -59,6 +59,19 @@ inline KeyModifiers get_modifiers_from_nsevent(NSEvent* 
event)
   return (KeyModifiers)modifiers;
 }
 
+inline int get_unicodechar_from_nsevent(NSEvent* event)
+{
+  int chr = 0;
+  // TODO we should use "event.characters" for a new kind of event 
(Event::Char or something like that)
+  NSString* chars = event.charactersIgnoringModifiers;
+  if (chars && chars.length >= 1) {
+    chr = [chars characterAtIndex:0];
+    if (chr < 32)
+      chr = 0;
+  }
+  return chr;
+}
+
 } // anonymous namespace
 
 namespace she {
@@ -142,11 +155,7 @@ bool is_key_pressed(KeyScancode scancode)
   ev.setScancode(scancode);
   ev.setModifiers(get_modifiers_from_nsevent(event));
   ev.setRepeat(event.ARepeat ? 1: 0);
-
-  // TODO we should use event.characters
-  NSString* chars = event.charactersIgnoringModifiers;
-  if (chars && chars.length >= 1)
-    ev.setUnicodeChar([chars characterAtIndex:0]);
+  ev.setUnicodeChar(get_unicodechar_from_nsevent(event));
 
   queue_event(ev);
 }
@@ -164,11 +173,7 @@ bool is_key_pressed(KeyScancode scancode)
   ev.setScancode(scancode);
   ev.setModifiers(get_modifiers_from_nsevent(event));
   ev.setRepeat(event.ARepeat ? 1: 0);
-
-  // TODO we should use event.characters
-  NSString* chars = event.charactersIgnoringModifiers;
-  if (chars && chars.length >= 1)
-    ev.setUnicodeChar([chars characterAtIndex:0]);
+  ev.setUnicodeChar(get_unicodechar_from_nsevent(event));
 
   queue_event(ev);
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-games/aseprite.git

_______________________________________________
Pkg-games-commits mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits

Reply via email to