From c4e554ff6b5dccf73269d4609c6260e6c4120338 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Mon, 28 Mar 2011 21:52:56 +0000 Subject: 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 --- src/Fl_cocoa.mm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src') 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 { -- cgit v1.2.3