mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 847823 - Change NotifyIMEEnabled to NotifyIMEContext; r=cpeterson
This commit is contained in:
parent
4fecb0f012
commit
72f7263504
@ -1474,7 +1474,7 @@ abstract public class GeckoApp
|
||||
layerView.initializeView(GeckoAppShell.getEventDispatcher());
|
||||
mLayerView = layerView;
|
||||
// bind the GeckoEditable instance to the new LayerView
|
||||
GeckoAppShell.notifyIMEEnabled(GeckoEditableListener.IME_STATE_DISABLED, "", "", "", false);
|
||||
GeckoAppShell.notifyIMEContext(GeckoEditableListener.IME_STATE_DISABLED, "", "", "");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -327,15 +327,10 @@ public class GeckoAppShell
|
||||
}
|
||||
}
|
||||
|
||||
public static void notifyIMEEnabled(int state, String typeHint,
|
||||
String modeHint, String actionHint,
|
||||
boolean landscapeFS) {
|
||||
// notifyIMEEnabled() still needs the landscapeFS parameter
|
||||
// because it is called from JNI code that assumes it has the
|
||||
// same signature as XUL Fennec's (which does use landscapeFS).
|
||||
// Bug 807124 will eliminate the need for landscapeFS
|
||||
public static void notifyIMEContext(int state, String typeHint,
|
||||
String modeHint, String actionHint) {
|
||||
if (mEditableListener != null) {
|
||||
mEditableListener.notifyIMEEnabled(state, typeHint,
|
||||
mEditableListener.notifyIMEContext(state, typeHint,
|
||||
modeHint, actionHint);
|
||||
}
|
||||
}
|
||||
|
@ -52,14 +52,14 @@ interface GeckoEditableListener {
|
||||
// IME focus state for notifyIME(NOTIFY_IME_FOCUSCHANGE, ..)
|
||||
final int IME_FOCUS_STATE_FOCUS = 1;
|
||||
final int IME_FOCUS_STATE_BLUR = 0;
|
||||
// IME enabled state for notifyIMEEnabled()
|
||||
// IME enabled state for notifyIMEContext()
|
||||
final int IME_STATE_DISABLED = 0;
|
||||
final int IME_STATE_ENABLED = 1;
|
||||
final int IME_STATE_PASSWORD = 2;
|
||||
final int IME_STATE_PLUGIN = 3;
|
||||
|
||||
void notifyIME(int type, int state);
|
||||
void notifyIMEEnabled(int state, String typeHint,
|
||||
void notifyIMEContext(int state, String typeHint,
|
||||
String modeHint, String actionHint);
|
||||
void onSelectionChange(int start, int end);
|
||||
void onTextChange(String text, int start, int oldEnd, int newEnd);
|
||||
@ -697,12 +697,12 @@ final class GeckoEditable
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyIMEEnabled(final int state, final String typeHint,
|
||||
public void notifyIMEContext(final int state, final String typeHint,
|
||||
final String modeHint, final String actionHint) {
|
||||
// Because we want to be able to bind GeckoEditable to the newest LayerView instance,
|
||||
// this can be called from the Java IC thread in addition to the Gecko thread.
|
||||
if (DEBUG) {
|
||||
Log.d(LOGTAG, "notifyIMEEnabled(" +
|
||||
Log.d(LOGTAG, "notifyIMEContext(" +
|
||||
getConstantName(GeckoEditableListener.class, "IME_STATE_", state) +
|
||||
", \"" + typeHint + "\", \"" + modeHint + "\", \"" + actionHint + "\")");
|
||||
}
|
||||
@ -711,14 +711,14 @@ final class GeckoEditable
|
||||
public void run() {
|
||||
// Make sure there are no other things going on
|
||||
mActionQueue.syncWithGecko();
|
||||
// Set InputConnectionHandler in notifyIMEEnabled because
|
||||
// GeckoInputConnection.notifyIMEEnabled calls restartInput() which will invoke
|
||||
// Set InputConnectionHandler in notifyIMEContext because
|
||||
// GeckoInputConnection.notifyIMEContext calls restartInput() which will invoke
|
||||
// InputConnectionHandler.onCreateInputConnection
|
||||
LayerView v = GeckoApp.mAppContext.getLayerView();
|
||||
if (v != null) {
|
||||
mListener = GeckoInputConnection.create(v, GeckoEditable.this);
|
||||
v.setInputConnectionHandler((InputConnectionHandler)mListener);
|
||||
mListener.notifyIMEEnabled(state, typeHint, modeHint, actionHint);
|
||||
mListener.notifyIMEContext(state, typeHint, modeHint, actionHint);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -180,7 +180,7 @@ class GeckoInputConnection
|
||||
|
||||
private final InputThreadUtils mThreadUtils = new InputThreadUtils();
|
||||
|
||||
// Managed only by notifyIMEEnabled; see comments in notifyIMEEnabled
|
||||
// Managed only by notifyIMEContext; see comments in notifyIMEContext
|
||||
private int mIMEState;
|
||||
private String mIMETypeHint = "";
|
||||
private String mIMEModeHint = "";
|
||||
@ -393,7 +393,7 @@ class GeckoInputConnection
|
||||
|
||||
mCurrentInputMethod = "";
|
||||
|
||||
// Do not reset mIMEState here; see comments in notifyIMEEnabled
|
||||
// Do not reset mIMEState here; see comments in notifyIMEContext
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -805,7 +805,7 @@ class GeckoInputConnection
|
||||
break;
|
||||
|
||||
case NOTIFY_IME_FOCUSCHANGE:
|
||||
// Showing/hiding vkb is done in notifyIMEEnabled
|
||||
// Showing/hiding vkb is done in notifyIMEContext
|
||||
resetInputConnection();
|
||||
break;
|
||||
|
||||
@ -818,7 +818,7 @@ class GeckoInputConnection
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyIMEEnabled(int state, String typeHint, String modeHint, String actionHint) {
|
||||
public void notifyIMEContext(int state, String typeHint, String modeHint, String actionHint) {
|
||||
// For some input type we will use a widget to display the ui, for those we must not
|
||||
// display the ime. We can display a widget for date and time types and, if the sdk version
|
||||
// is 11 or greater, for datetime/month/week as well.
|
||||
@ -833,13 +833,13 @@ class GeckoInputConnection
|
||||
return;
|
||||
}
|
||||
|
||||
// mIMEState and the mIME*Hint fields should only be changed by notifyIMEEnabled,
|
||||
// and not reset anywhere else. Usually, notifyIMEEnabled is called right after a
|
||||
// mIMEState and the mIME*Hint fields should only be changed by notifyIMEContext,
|
||||
// and not reset anywhere else. Usually, notifyIMEContext is called right after a
|
||||
// focus or blur, so resetting mIMEState during the focus or blur seems harmless.
|
||||
// However, this behavior is not guaranteed. Gecko may call notifyIMEEnabled
|
||||
// However, this behavior is not guaranteed. Gecko may call notifyIMEContext
|
||||
// independent of focus change; that is, a focus change may not be accompanied by
|
||||
// a notifyIMEEnabled call. So if we reset mIMEState inside focus, there may not
|
||||
// be another notifyIMEEnabled call to set mIMEState to a proper value (bug 829318)
|
||||
// a notifyIMEContext call. So if we reset mIMEState inside focus, there may not
|
||||
// be another notifyIMEContext call to set mIMEState to a proper value (bug 829318)
|
||||
/* When IME is 'disabled', IME processing is disabled.
|
||||
In addition, the IME UI is hidden */
|
||||
mIMEState = state;
|
||||
@ -849,7 +849,7 @@ class GeckoInputConnection
|
||||
|
||||
View v = getView();
|
||||
if (v == null || !v.hasFocus()) {
|
||||
// When using Find In Page, we can still receive notifyIMEEnabled calls due to the
|
||||
// When using Find In Page, we can still receive notifyIMEContext calls due to the
|
||||
// selection changing when highlighting. However in this case we don't want to reset/
|
||||
// show/hide the keyboard because the find box has the focus and is taking input from
|
||||
// the keyboard.
|
||||
@ -901,7 +901,7 @@ final class DebugGeckoInputConnection
|
||||
if ("notifyIME".equals(method.getName()) && arg == args[0]) {
|
||||
log.append(GeckoEditable.getConstantName(
|
||||
GeckoEditableListener.class, "NOTIFY_IME_", arg));
|
||||
} else if ("notifyIMEEnabled".equals(method.getName()) && arg == args[0]) {
|
||||
} else if ("notifyIMEContext".equals(method.getName()) && arg == args[0]) {
|
||||
log.append(GeckoEditable.getConstantName(
|
||||
GeckoEditableListener.class, "IME_STATE_", arg));
|
||||
} else {
|
||||
|
@ -40,9 +40,6 @@
|
||||
#define ALOG_BRIDGE(args...) ((void)0)
|
||||
#endif
|
||||
|
||||
#define IME_FULLSCREEN_PREF "widget.ime.android.landscape_fullscreen"
|
||||
#define IME_FULLSCREEN_THRESHOLD_PREF "widget.ime.android.fullscreen_threshold"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS0(nsFilePickerCallback)
|
||||
@ -106,7 +103,7 @@ AndroidBridge::Init(JNIEnv *jEnv,
|
||||
mAndroidSmsMessageClass = (jclass) jEnv->NewGlobalRef(jAndroidSmsMessageClass);
|
||||
|
||||
jNotifyIME = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyIME", "(II)V");
|
||||
jNotifyIMEEnabled = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyIMEEnabled", "(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)V");
|
||||
jNotifyIMEContext = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyIMEContext", "(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
|
||||
jNotifyIMEChange = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyIMEChange", "(Ljava/lang/String;III)V");
|
||||
jAcknowledgeEvent = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "acknowledgeEvent", "()V");
|
||||
|
||||
@ -285,10 +282,10 @@ jstring NewJavaString(AutoLocalJNIFrame* frame, const nsACString& string) {
|
||||
}
|
||||
|
||||
void
|
||||
AndroidBridge::NotifyIMEEnabled(int aState, const nsAString& aTypeHint,
|
||||
AndroidBridge::NotifyIMEContext(int aState, const nsAString& aTypeHint,
|
||||
const nsAString& aModeHint, const nsAString& aActionHint)
|
||||
{
|
||||
ALOG_BRIDGE("AndroidBridge::NotifyIMEEnabled");
|
||||
ALOG_BRIDGE("AndroidBridge::NotifyIMEContext");
|
||||
if (!sBridge)
|
||||
return;
|
||||
|
||||
@ -298,34 +295,14 @@ AndroidBridge::NotifyIMEEnabled(int aState, const nsAString& aTypeHint,
|
||||
|
||||
AutoLocalJNIFrame jniFrame(env);
|
||||
|
||||
jvalue args[5];
|
||||
jvalue args[4];
|
||||
args[0].i = aState;
|
||||
args[1].l = NewJavaString(&jniFrame, aTypeHint);
|
||||
args[2].l = NewJavaString(&jniFrame, aModeHint);
|
||||
args[3].l = NewJavaString(&jniFrame, aActionHint);
|
||||
args[4].z = false;
|
||||
|
||||
int32_t landscapeFS;
|
||||
if (NS_SUCCEEDED(Preferences::GetInt(IME_FULLSCREEN_PREF, &landscapeFS))) {
|
||||
if (landscapeFS == 1) {
|
||||
args[4].z = true;
|
||||
} else if (landscapeFS == -1){
|
||||
if (NS_SUCCEEDED(
|
||||
Preferences::GetInt(IME_FULLSCREEN_THRESHOLD_PREF,
|
||||
&landscapeFS))) {
|
||||
// the threshold is hundreths of inches, so convert the
|
||||
// threshold to pixels and multiply the height by 100
|
||||
if (nsWindow::GetAndroidScreenBounds().height * 100 <
|
||||
landscapeFS * Bridge()->GetDPI()) {
|
||||
args[4].z = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
env->CallStaticVoidMethodA(sBridge->mGeckoAppShellClass,
|
||||
sBridge->jNotifyIMEEnabled, args);
|
||||
sBridge->jNotifyIMEContext, args);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -154,7 +154,7 @@ public:
|
||||
/* These are all implemented in Java */
|
||||
static void NotifyIME(int aType, int aState);
|
||||
|
||||
static void NotifyIMEEnabled(int aState, const nsAString& aTypeHint,
|
||||
static void NotifyIMEContext(int aState, const nsAString& aTypeHint,
|
||||
const nsAString& aModeHint, const nsAString& aActionHint);
|
||||
|
||||
static void NotifyIMEChange(const PRUnichar *aText, uint32_t aTextLen, int aStart, int aEnd, int aNewEnd);
|
||||
@ -405,7 +405,7 @@ protected:
|
||||
|
||||
// other things
|
||||
jmethodID jNotifyIME;
|
||||
jmethodID jNotifyIMEEnabled;
|
||||
jmethodID jNotifyIMEContext;
|
||||
jmethodID jNotifyIMEChange;
|
||||
jmethodID jAcknowledgeEvent;
|
||||
jmethodID jEnableLocation;
|
||||
|
@ -1718,7 +1718,7 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *ae)
|
||||
AndroidBridge::NotifyIME(AndroidBridge::NOTIFY_IME_REPLY_EVENT, 0);
|
||||
return;
|
||||
} else if (ae->Action() == AndroidGeckoEvent::IME_UPDATE_CONTEXT) {
|
||||
AndroidBridge::NotifyIMEEnabled(mInputContext.mIMEState.mEnabled,
|
||||
AndroidBridge::NotifyIMEContext(mInputContext.mIMEState.mEnabled,
|
||||
mInputContext.mHTMLInputType,
|
||||
mInputContext.mHTMLInputInputmode,
|
||||
mInputContext.mActionHint);
|
||||
|
Loading…
Reference in New Issue
Block a user