|
@@ -59,12 +59,19 @@ @interface SDLTranslatorResponder : NSTextView |
|
|
NSString *_markedText; |
|
|
NSRange _markedRange; |
|
|
NSRange _selectedRange; |
|
|
SDL_Rect inputRect; |
|
|
} |
|
|
- (void) doCommandBySelector:(SEL)myselector; |
|
|
- (void) setInputRect:(SDL_Rect *) rect; |
|
|
@end |
|
|
|
|
|
@implementation SDLTranslatorResponder |
|
|
|
|
|
- (void) setInputRect:(SDL_Rect *) rect |
|
|
{ |
|
|
inputRect = *rect; |
|
|
} |
|
|
|
|
|
- (void) insertText:(id) aString |
|
|
{ |
|
|
const char *str; |
|
@@ -135,11 +142,20 @@ - (void) unmarkText |
|
|
|
|
|
- (NSRect) firstRectForCharacterRange: (NSRange) theRange |
|
|
{ |
|
|
return NSMakeRect(0, 0, 0, 0); |
|
|
float windowHeight = [[self window] frame].size.height; |
|
|
NSRect rect = NSMakeRect(inputRect.x, windowHeight - inputRect.y, inputRect.w, inputRect.h); |
|
|
|
|
|
NSLog(@"firstRectForCharacterRange: (%d, %d): windowHeight = %g, rect = %@", |
|
|
theRange.location, theRange.length, windowHeight, |
|
|
NSStringFromRect(rect)); |
|
|
rect.origin = [[self window] convertBaseToScreen: rect.origin]; |
|
|
|
|
|
return rect; |
|
|
} |
|
|
|
|
|
- (NSAttributedString *) attributedSubstringFromRange: (NSRange) theRange |
|
|
{ |
|
|
NSLog(@"attributedSubstringFromRange: (%d, %d)", theRange.location, theRange.length); |
|
|
return nil; |
|
|
} |
|
|
|
|
@@ -152,6 +168,7 @@ - (NSInteger) conversationIdentifier |
|
|
// nearest to thePoint. thPoint is in screen coordinate system. |
|
|
- (NSUInteger) characterIndexForPoint:(NSPoint) thePoint |
|
|
{ |
|
|
NSLog(@"characterIndexForPoint: (%g, %g)", thePoint.x, thePoint.y); |
|
|
return 0; |
|
|
} |
|
|
|
|
@@ -577,6 +594,15 @@ - (NSArray *) validAttributesForMarkedText |
|
|
SDL_SetScancodeName(SDL_SCANCODE_RGUI, "Right Command"); |
|
|
} |
|
|
|
|
|
void |
|
|
Cocoa_StartTextInput(_THIS, SDL_Rect *rect) |
|
|
{ |
|
|
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; |
|
|
|
|
|
NSLog(@"StartTextInput: (%d, %d) (w=%d, h=%d)", rect->x, rect->y, rect->w, rect->h); |
|
|
[data->fieldEdit setInputRect: rect]; |
|
|
} |
|
|
|
|
|
void |
|
|
Cocoa_HandleKeyEvent(_THIS, NSEvent *event) |
|
|
{ |
|
|