OSX, fixed arrow keys creating TextEntred event.

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1789 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
mantognini 2011-02-05 14:15:31 +00:00
parent c48792e933
commit e9a201af21
4 changed files with 17 additions and 5 deletions

View File

@ -359,8 +359,20 @@
if (myUseKeyRepeat || ![theEvent isARepeat]) if (myUseKeyRepeat || ![theEvent isARepeat])
myRequester->KeyDown([theEvent keyCode], [theEvent modifierFlags]); myRequester->KeyDown([theEvent keyCode], [theEvent modifierFlags]);
if ((myUseKeyRepeat || ![theEvent isARepeat]) && [[theEvent characters] length] > 0) if ((myUseKeyRepeat || ![theEvent isARepeat]) && [[theEvent characters] length] > 0) {
myRequester->TextEntred([[theEvent characters] characterAtIndex:0]); /// From NSEvent.h :
/*
* Unicodes we reserve for function keys on the keyboard,
* OpenStep reserves the range 0xF700-0xF8FF for this purpose.
* The availability of various keys will be system dependent.
*/
/// And 0x35 is the Escape key.
unichar ch = [[theEvent characters] characterAtIndex:0];
if ([theEvent keyCode] != 0x35 &&
(ch < 0xf700 || ch > 0xf8ff)) {
myRequester->TextEntered(ch);
}
}
} }

View File

@ -102,7 +102,7 @@ public:
void MouseMovedOut(void); void MouseMovedOut(void);
void KeyDown(unsigned short keycode, unsigned int modifierFlags); void KeyDown(unsigned short keycode, unsigned int modifierFlags);
void KeyUp(unsigned short keycode, unsigned int modifierFlags); void KeyUp(unsigned short keycode, unsigned int modifierFlags);
void TextEntred(Uint32 charcode); void TextEntered(Uint32 charcode);
static Key::Code NSKeyCodeToSFMLKeyCode(unsigned short rawchar); static Key::Code NSKeyCodeToSFMLKeyCode(unsigned short rawchar);

View File

@ -281,7 +281,7 @@ void WindowImplCocoa::KeyUp(unsigned short keycode, unsigned int modifierFlags)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void WindowImplCocoa::TextEntred(Uint32 charcode) void WindowImplCocoa::TextEntered(Uint32 charcode)
{ {
Event event; Event event;
event.Type = Event::TextEntered; event.Type = Event::TextEntered;

View File

@ -54,7 +54,7 @@ namespace sf {
/// MouseDownAt, MouseUpAt, MouseMovedAt, MouseWheelScrolledAt, /// MouseDownAt, MouseUpAt, MouseMovedAt, MouseWheelScrolledAt,
/// MouseMovedIn, MouseMovedOut /// MouseMovedIn, MouseMovedOut
/// ///
/// KeyDown, KeyUp, TextEntred /// KeyDown, KeyUp, TextEntered
/// ///
/// Note : Joystick are not bound to a view or window /// Note : Joystick are not bound to a view or window
/// thus they're not managed by a class implementing this protocol. /// thus they're not managed by a class implementing this protocol.