mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1253426 - When Fennec is brought to the foreground, soft keyboard needs to be restored if it was previously visible r=snorp
This commit is contained in:
parent
e0df9454b0
commit
3ab57f32f0
@ -473,6 +473,8 @@ class GeckoInputConnection
|
||||
return mEditableClient.setInputConnectionHandler(getBackgroundHandler());
|
||||
}
|
||||
|
||||
private boolean mIsVisible = false;
|
||||
|
||||
@Override
|
||||
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
|
||||
if (mIMEState == IME_STATE_DISABLED) {
|
||||
@ -585,6 +587,13 @@ class GeckoInputConnection
|
||||
Editable editable = getEditable();
|
||||
outAttrs.initialSelStart = Selection.getSelectionStart(editable);
|
||||
outAttrs.initialSelEnd = Selection.getSelectionEnd(editable);
|
||||
|
||||
if (mIsVisible) {
|
||||
// The app has been brought to the foreground and the Soft Keyboard
|
||||
// was previously visible, so request that it be shown again.
|
||||
showSoftInput();
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -790,6 +799,16 @@ class GeckoInputConnection
|
||||
return processKey(KeyEvent.ACTION_UP, keyCode, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowVisibilityChanged (int visibility) {
|
||||
if (visibility == View.VISIBLE) {
|
||||
mIsVisible = true;
|
||||
} else {
|
||||
mIsVisible = false;
|
||||
hideSoftInput();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a key that represents a given character.
|
||||
*/
|
||||
|
@ -343,8 +343,24 @@ public class GeckoView extends LayerView
|
||||
}
|
||||
}
|
||||
|
||||
private int mLastVisibility = View.GONE;
|
||||
|
||||
/* package */ void setInputConnectionListener(final InputConnectionListener icl) {
|
||||
mInputConnectionListener = icl;
|
||||
if (mInputConnectionListener != null) {
|
||||
mInputConnectionListener.onWindowVisibilityChanged(mLastVisibility);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onWindowVisibilityChanged (int visibility) {
|
||||
mLastVisibility = visibility;
|
||||
|
||||
if (mInputConnectionListener != null) {
|
||||
mInputConnectionListener.onWindowVisibilityChanged(visibility);
|
||||
}
|
||||
|
||||
super.onWindowVisibilityChanged(visibility);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -21,5 +21,6 @@ interface InputConnectionListener
|
||||
boolean onKeyLongPress(int keyCode, KeyEvent event);
|
||||
boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event);
|
||||
boolean onKeyUp(int keyCode, KeyEvent event);
|
||||
void onWindowVisibilityChanged (int visibility);
|
||||
boolean isIMEEnabled();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user