mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
JRE-665 Navigate Class/File/Symbol, Find in Path popup windows don't pick characters from input method
(cherry picked from commit 676f305b2b3b278e305bd4d9bde4269f27b3d676)
(cherry picked from commit 6ce31e0a32)
This commit is contained in:
@@ -292,6 +292,18 @@ public class CInputMethod extends InputMethodAdapter {
|
||||
if (component.getInputMethodRequests() == null) {
|
||||
imInstance = null;
|
||||
}
|
||||
|
||||
LWWindowPeer windowPeer = peer.getPlatformWindow().getPeer();
|
||||
if (windowPeer.isSimpleWindow()) {
|
||||
// A simple window gains focus. Cocoa won't dispatch IME events into the simple window, but into its owner.
|
||||
// This IM represents the focused component in the simple window. We will use the owner as IME proxy.
|
||||
// For that, this IM is set for the owner and is dropped for the simple window.
|
||||
Window owner = windowPeer.getTarget().getOwner();
|
||||
assert owner != null && owner.isActive();
|
||||
long ownerPtr = getNativeViewPtr((LWComponentPeer)AWTAccessor.getComponentAccessor().getPeer(owner));
|
||||
nativeNotifyPeer(ownerPtr, this);
|
||||
imInstance = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (peer != null) {
|
||||
@@ -368,6 +380,14 @@ public class CInputMethod extends InputMethodAdapter {
|
||||
fAwtFocussedComponentPeer = null;
|
||||
}
|
||||
|
||||
private boolean isValid() {
|
||||
return fIMContext != null &&
|
||||
fAwtFocussedComponent != null &&
|
||||
fAwtFocussedComponentPeer != null &&
|
||||
fCurrentText != null &&
|
||||
fCurrentTextAsString != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a control object from this input method, or null. A
|
||||
* control object provides methods that control the behavior of the
|
||||
@@ -587,6 +607,7 @@ public class CInputMethod extends InputMethodAdapter {
|
||||
final String[] retString = new String[1];
|
||||
|
||||
try {
|
||||
if (isValid())
|
||||
LWCToolkit.invokeAndWait(new Runnable() {
|
||||
public void run() { synchronized(retString) {
|
||||
int location = locationIn;
|
||||
@@ -639,6 +660,7 @@ public class CInputMethod extends InputMethodAdapter {
|
||||
final int[] returnValue = new int[2];
|
||||
|
||||
try {
|
||||
if (isValid())
|
||||
LWCToolkit.invokeAndWait(new Runnable() {
|
||||
public void run() { synchronized(returnValue) {
|
||||
AttributedCharacterIterator theIterator = fIMContext.getSelectedText(null);
|
||||
@@ -714,6 +736,7 @@ public class CInputMethod extends InputMethodAdapter {
|
||||
final int[] rect = new int[4];
|
||||
|
||||
try {
|
||||
if (isValid())
|
||||
LWCToolkit.invokeAndWait(new Runnable() {
|
||||
public void run() { synchronized(rect) {
|
||||
int insertOffset = fIMContext.getInsertPositionOffset();
|
||||
@@ -758,6 +781,7 @@ public class CInputMethod extends InputMethodAdapter {
|
||||
final int[] insertPositionOffset = new int[1];
|
||||
|
||||
try {
|
||||
if (isValid())
|
||||
LWCToolkit.invokeAndWait(new Runnable() {
|
||||
public void run() { synchronized(offsetInfo) {
|
||||
offsetInfo[0] = fIMContext.getLocationOffset(screenX, screenY);
|
||||
|
||||
Reference in New Issue
Block a user