summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2011-04-01 17:19:34 +0000
committerManolo Gouy <Manolo>2011-04-01 17:19:34 +0000
commit32df4755c45711bc9cac74763f89c4766da56f7e (patch)
treea5fd9545e6133f6221bd093f2d7396c91277715d
parentcc3606b0972851b244e408433b0118e5246dcce9 (diff)
about STR #2599: - fix the synchro between key presses and key events
- implement character palette input by FL_PASTE events git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8555 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--src/Fl_cocoa.mm11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index 7db44d99f..272ec7c22 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -1803,7 +1803,6 @@ static void q_set_window_title(NSWindow *nsw, const char * name ) {
} else {
received = (NSString*)aString;
}
-//NSLog(@"insertText: received=%@ event type=%d",received, type);
if (type == NSKeyDown ) {
str = [event characters];
}
@@ -1814,9 +1813,13 @@ static void q_set_window_title(NSWindow *nsw, const char * name ) {
Fl_Window *window = [(FLWindow*)[NSApp keyWindow] getFl_Window];
Fl::e_text = (char*)[received UTF8String];
Fl::e_length = strlen(Fl::e_text);
- Fl::e_keysym = 0;
- Fl::handle(FL_KEYBOARD, window);
- Fl::handle(FL_KEYUP, window);
+ if (type == NSKeyDown ) {
+ Fl::e_keysym = macKeyLookUp[ [event keyCode] & 0x7f] ;
+ Fl::handle(FL_KEYBOARD, window);
+ }
+ else {
+ Fl::handle(FL_PASTE, window);
+ }
fl_unlock_function();
// for some reason, the window does not redraw until the next mouse move or button push
// sending a 'redraw()' or 'awake()' does not solve the issue!