mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r25687) -Codechange: [OSX] Pass text input directly down to the text handling.
This commit is contained in:
parent
e4d48f3a3b
commit
643a294e68
|
@ -788,6 +788,23 @@ void cocoaReleaseAutoreleasePool()
|
||||||
if (_cocoa_subdriver != NULL) UndrawMouseCursor();
|
if (_cocoa_subdriver != NULL) UndrawMouseCursor();
|
||||||
_cursor.in_window = false;
|
_cursor.in_window = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Insert the given text at the caret. */
|
||||||
|
- (void)insertText:(id)aString
|
||||||
|
{
|
||||||
|
NSString *s = [ aString isKindOfClass:[ NSAttributedString class ] ] ? [ aString string ] : (NSString *)aString;
|
||||||
|
|
||||||
|
HandleTextInput(NULL, true);
|
||||||
|
HandleTextInput([ s UTF8String ]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Invoke the selector if we implement it. */
|
||||||
|
- (void)doCommandBySelector:(SEL)aSelector
|
||||||
|
{
|
||||||
|
if ([ self respondsToSelector:aSelector ]) [ self performSelector:aSelector ];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include "../../network/network.h"
|
#include "../../network/network.h"
|
||||||
#include "../../core/random_func.hpp"
|
#include "../../core/random_func.hpp"
|
||||||
#include "../../texteff.hpp"
|
#include "../../texteff.hpp"
|
||||||
|
#include "../../window_func.h"
|
||||||
|
|
||||||
#import <sys/time.h> /* gettimeofday */
|
#import <sys/time.h> /* gettimeofday */
|
||||||
|
|
||||||
|
@ -399,7 +400,6 @@ static bool QZ_PollEvent()
|
||||||
|
|
||||||
NSString *chars;
|
NSString *chars;
|
||||||
NSPoint pt;
|
NSPoint pt;
|
||||||
NSText *fieldEditor;
|
|
||||||
switch ([ event type ]) {
|
switch ([ event type ]) {
|
||||||
case NSMouseMoved:
|
case NSMouseMoved:
|
||||||
case NSOtherMouseDragged:
|
case NSOtherMouseDragged:
|
||||||
|
@ -516,10 +516,10 @@ static bool QZ_PollEvent()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldEditor = [[ event window ] fieldEditor:YES forObject:nil ];
|
if (EditBoxInGlobalFocus()) {
|
||||||
[ fieldEditor setString:@"" ];
|
[ _cocoa_subdriver->cocoaview interpretKeyEvents:[ NSArray arrayWithObject:event ] ];
|
||||||
[ fieldEditor interpretKeyEvents: [ NSArray arrayWithObject:event ] ];
|
QZ_KeyEvent([ event keyCode ], 0, YES);
|
||||||
|
} else {
|
||||||
chars = [ event characters ];
|
chars = [ event characters ];
|
||||||
if ([ chars length ] == 0) {
|
if ([ chars length ] == 0) {
|
||||||
QZ_KeyEvent([ event keyCode ], 0, YES);
|
QZ_KeyEvent([ event keyCode ], 0, YES);
|
||||||
|
@ -529,6 +529,7 @@ static bool QZ_PollEvent()
|
||||||
QZ_KeyEvent(0, [ chars characterAtIndex:i ], YES);
|
QZ_KeyEvent(0, [ chars characterAtIndex:i ], YES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSKeyUp:
|
case NSKeyUp:
|
||||||
|
|
Loading…
Reference in New Issue