1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-28 02:30:05 +00:00

NSViewComponentPeer: Avoid processing key events directly during IME composition

This fixes an issue where e.g. pressing 'return' to select an item from
an IME list would directly insert a newline character, rather than
selecting the entry.
This commit is contained in:
reuk 2022-10-19 19:52:26 +01:00
parent d563fcd7b4
commit 8d6169fbf5
No known key found for this signature in database
GPG key ID: 9ADCD339CFC98A11

View file

@ -1590,7 +1590,7 @@ public:
#else
bool usingCoreGraphics = false;
#endif
bool isZooming = false, isFirstLiveResize = false, textWasInserted = false;
bool textWasInserted = false, isFirstLiveResize = false;
bool isStretchingTop = false, isStretchingLeft = false, isStretchingBottom = false, isStretchingRight = false;
bool windowRepresentsFile = false;
bool isAlwaysOnTop = false, wasAlwaysOnTop = false;
@ -2007,15 +2007,14 @@ struct JuceNSViewClass : public NSViewComponentPeerWrapper<ObjCClass<NSView>>
{
if (auto* owner = getOwner (self))
{
auto* target = owner->findCurrentTextInputTarget();
owner->textWasInserted = false;
if (target != nullptr)
if (auto* target = owner->findCurrentTextInputTarget())
[(NSView*) self interpretKeyEvents: [NSArray arrayWithObject: ev]];
else
owner->stringBeingComposed.clear();
if (! (owner->textWasInserted || owner->redirectKeyDown (ev)))
if (! (owner->textWasInserted || owner->stringBeingComposed.isNotEmpty() || owner->redirectKeyDown (ev)))
sendSuperclassMessage<void> (self, @selector (keyDown:), ev);
}
});
@ -2367,7 +2366,7 @@ struct JuceNSWindowClass : public NSViewComponentPeerWrapper<ObjCClass<NSWindo
{
auto* owner = getOwner (self);
if (owner == nullptr || owner->isZooming)
if (owner == nullptr)
return proposedFrameSize;
NSRect frameRect = flippedScreenRect ([(NSWindow*) self frame]);