diff options
| author | Manolo Gouy <Manolo> | 2011-03-28 21:52:56 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2011-03-28 21:52:56 +0000 |
| commit | c4e554ff6b5dccf73269d4609c6260e6c4120338 (patch) | |
| tree | 3f889cf6c700a1da9ca0f6944758e858882bdb72 | |
| parent | 3fdbcbe82f5aef2a2bb3422f11c71e683d477e36 (diff) | |
Mac OS: simplified the handling of text input:
use the FLTextView subclass of NSTextView only for Mac OS < 10.5 because it's not
necessary for Mac OS >= 10.5
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8542 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | src/Fl_cocoa.mm | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 9cc07d83d..f745de887 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -1251,12 +1251,15 @@ extern "C" { } - (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)client { - NSRect rect={{0,0},{20,20}}; - static FLTextView *view = nil; - if (!view) { - view = [[FLTextView alloc] initWithFrame:rect]; + if (fl_mac_os_version < 100500) { + NSRect rect={{0,0},{20,20}}; + static FLTextView *view = nil; + if (!view) { + view = [[FLTextView alloc] initWithFrame:rect]; + } + return view; } - return view; + return nil; } @end @@ -1675,7 +1678,7 @@ static void q_set_window_title(NSWindow *nsw, const char * name ) { cocoaMouseWheelHandler(theEvent); } - (void)keyDown:(NSEvent *)theEvent { - FLTextView *edit = (FLTextView*)[[theEvent window] fieldEditor:YES forObject:nil]; + NSText *edit = [[theEvent window] fieldEditor:YES forObject:nil]; [edit interpretKeyEvents:[NSArray arrayWithObject:theEvent]]; } - (void)keyUp:(NSEvent *)theEvent { |
