Skip to content

Commit

Permalink
Revert "Allow asking the soft keyboard from outside the window widget (
Browse files Browse the repository at this point in the history
…#1278)"

This reverts commit 08a729e.

This was a previous attempt to fix the bug, but it was not really
doing that, so it seems safe to remove it.
  • Loading branch information
svillar committed Jul 30, 2024
1 parent 62ec0de commit bcb671d
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void showSoftInput(final View view, int flags, ResultReceiver resultRecei
EditorInfo outAttrs = new EditorInfo();
view.onCreateInputConnection(outAttrs);
if (mDelegate != null)
mDelegate.showSoftInput(mSession, (View) mSession.getContentView());
mDelegate.showSoftInput(mSession);

// We don't take content space for the keyboard, and we report back to the ImeAdapter
// that the keyboard was always showing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void restartInput(@NonNull GeckoSession session, int reason) {

@Override
public void showSoftInput(@NonNull GeckoSession session) {
mDelegate.showSoftInput(mSession, null);
mDelegate.showSoftInput(mSession);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import android.os.Build;
import android.view.PointerIcon;
import android.view.Surface;
import android.view.View;
import android.view.inputmethod.CursorAnchorInfo;
import android.view.inputmethod.ExtractedText;
import android.view.inputmethod.ExtractedTextRequest;
Expand Down Expand Up @@ -1762,16 +1761,10 @@ default void restartInput(
* This method is always called, even in viewless mode.
*
* @param session Session instance.
* @param requestView View requesting the soft input. This can be set to allow the soft
* keyboard to be requested from a view that exist outside a hierarchy of
* the window widget which the keyboard widget is attached to.
* If this is null, this method will treat the focused view is the window
* widget.
* @see #hideSoftInput
*/

@UiThread
default void showSoftInput(@NonNull final WSession session, @Nullable View requestView) {}
default void showSoftInput(@NonNull final WSession session) {}

/**
* Hide the soft input. May be called consecutively, even if the soft input is already hidden.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import androidx.preference.PreferenceManager;
import android.util.Log;
import android.view.Surface;
import android.view.View;
import android.view.inputmethod.CursorAnchorInfo;
import android.view.inputmethod.ExtractedText;
import android.view.inputmethod.ExtractedTextRequest;
Expand Down Expand Up @@ -1435,11 +1434,11 @@ public void restartInput(@NonNull WSession aSession, int reason) {
}

@Override
public void showSoftInput(@NonNull WSession aSession, @Nullable View requestView) {
public void showSoftInput(@NonNull WSession aSession) {
if (mState.mSession == aSession) {
mState.mIsInputActive = true;
for (WSession.TextInputDelegate listener : mTextInputListeners) {
listener.showSoftInput(aSession, requestView);
listener.showSoftInput(aSession);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ public class KeyboardWidget extends UIWidget implements CustomKeyboardView.OnKey
private Drawable mShiftDisabledIcon;
private Drawable mCapsLockOnIcon;
private View mFocusedView;
private View mExternalFocusedView;
private LinearLayout mKeyboardLayout;
private RelativeLayout mKeyboardContainer;
private WindowWidget mAttachedWindow;
Expand Down Expand Up @@ -1378,8 +1377,7 @@ public void restartInput(@NonNull WSession session, int reason) {
}

@Override
public void showSoftInput(@NonNull WSession session, View requestView) {
mExternalFocusedView = requestView;
public void showSoftInput(@NonNull WSession session) {
if (mFocusedView != mAttachedWindow || getVisibility() != View.VISIBLE || mInputRestarted) {
post(() -> updateFocusedView(mAttachedWindow));
}
Expand Down Expand Up @@ -1415,7 +1413,7 @@ public void run() {

@Override
public void onGlobalFocusChanged(View oldFocus, View newFocus) {
updateFocusedView(mExternalFocusedView == newFocus ? mAttachedWindow : newFocus);
updateFocusedView(newFocus);
}


Expand Down

0 comments on commit bcb671d

Please sign in to comment.