mirror of https://github.com/OpenTTD/OpenTTD
(svn r27046) -Fix [FS#5812]: Don't require double-press from non-dead console hotkeys.
parent
a468c55750
commit
306b6a11ee
|
@ -308,7 +308,8 @@ static bool QZ_KeyEvent(unsigned short keycode, unsigned short unicode, BOOL dow
|
||||||
|
|
||||||
static bool console = false;
|
static bool console = false;
|
||||||
|
|
||||||
if (pressed_key == WKC_BACKQUOTE && unicode == 0) {
|
/* The second backquote may have a character, which we don't want to interpret. */
|
||||||
|
if (pressed_key == WKC_BACKQUOTE && (console || unicode == 0)) {
|
||||||
if (!console) {
|
if (!console) {
|
||||||
/* Backquote is a dead key, require a double press for hotkey behaviour (i.e. console). */
|
/* Backquote is a dead key, require a double press for hotkey behaviour (i.e. console). */
|
||||||
console = true;
|
console = true;
|
||||||
|
@ -538,7 +539,7 @@ static bool QZ_PollEvent()
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case NSKeyDown:
|
case NSKeyDown: {
|
||||||
/* Quit, hide and minimize */
|
/* Quit, hide and minimize */
|
||||||
switch ([ event keyCode ]) {
|
switch ([ event keyCode ]) {
|
||||||
case QZ_q:
|
case QZ_q:
|
||||||
|
@ -550,22 +551,20 @@ static bool QZ_PollEvent()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
chars = [ event characters ];
|
||||||
|
unsigned short unicode = [ chars length ] > 0 ? [ chars characterAtIndex:0 ] : 0;
|
||||||
if (EditBoxInGlobalFocus()) {
|
if (EditBoxInGlobalFocus()) {
|
||||||
if (QZ_KeyEvent([ event keyCode ], 0, YES)) {
|
if (QZ_KeyEvent([ event keyCode ], unicode, YES)) {
|
||||||
[ _cocoa_subdriver->cocoaview interpretKeyEvents:[ NSArray arrayWithObject:event ] ];
|
[ _cocoa_subdriver->cocoaview interpretKeyEvents:[ NSArray arrayWithObject:event ] ];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
chars = [ event characters ];
|
QZ_KeyEvent([ event keyCode ], unicode, YES);
|
||||||
if ([ chars length ] == 0) {
|
for (uint i = 1; i < [ chars length ]; i++) {
|
||||||
QZ_KeyEvent([ event keyCode ], 0, YES);
|
QZ_KeyEvent(0, [ chars characterAtIndex:i ], YES);
|
||||||
} else {
|
|
||||||
QZ_KeyEvent([ event keyCode ], [ chars characterAtIndex:0 ], YES);
|
|
||||||
for (uint i = 1; i < [ chars length ]; i++) {
|
|
||||||
QZ_KeyEvent(0, [ chars characterAtIndex:i ], YES);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case NSKeyUp:
|
case NSKeyUp:
|
||||||
/* Quit, hide and minimize */
|
/* Quit, hide and minimize */
|
||||||
|
|
Loading…
Reference in New Issue