Android: Set window focus based on window touch, not global focus parentage
Since QtEditText is no longer focused on QtWindow touch, onGlobalFocusChange event is no longer triggered, and so we cannot get the parent View (QtWindow) of the current global focus object and set it as the focused QWindow. Move QWindow focus setting to be done directly under QtWindow onTouched. Pick-to: 6.7 Change-Id: I292f197c64d170aa2f15a3118e6f861b59c906f5 Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io> (cherry picked from commit 1442a9ea479d197ed338f440d5106a7e195c4ee2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
e6211e49b9
commit
7cea4391ce
@ -149,7 +149,6 @@ class QtActivityDelegate extends QtActivityDelegateBase
|
||||
r.width(), kbHeight);
|
||||
return true;
|
||||
});
|
||||
registerGlobalFocusChangeListener(m_layout);
|
||||
m_inputDelegate.setEditPopupMenu(new EditPopupMenu(m_activity, m_layout));
|
||||
}
|
||||
|
||||
|
@ -108,23 +108,6 @@ abstract class QtActivityDelegateBase
|
||||
setUpLayout();
|
||||
}
|
||||
|
||||
protected void registerGlobalFocusChangeListener(final View view) {
|
||||
view.getViewTreeObserver().addOnGlobalFocusChangeListener(this::onGlobalFocusChanged);
|
||||
}
|
||||
|
||||
private void onGlobalFocusChanged(View oldFocus, View newFocus) {
|
||||
if (newFocus instanceof QtEditText) {
|
||||
final QtWindow newWindow = (QtWindow) newFocus.getParent();
|
||||
QtWindow.windowFocusChanged(true, newWindow.getId());
|
||||
} else {
|
||||
int id = -1;
|
||||
if (oldFocus instanceof QtEditText) {
|
||||
final QtWindow oldWindow = (QtWindow) oldFocus.getParent();
|
||||
QtWindow.windowFocusChanged(false, oldWindow.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void hideSplashScreen()
|
||||
{
|
||||
hideSplashScreen(0);
|
||||
|
@ -165,8 +165,6 @@ class QtEmbeddedDelegate extends QtActivityDelegateBase
|
||||
{
|
||||
m_view = view;
|
||||
updateInputDelegate();
|
||||
if (m_view != null)
|
||||
registerGlobalFocusChangeListener(m_view);
|
||||
}
|
||||
// QtEmbeddedViewInterface implementation end
|
||||
|
||||
|
@ -67,6 +67,7 @@ class QtWindow extends QtLayout implements QtSurfaceInterface {
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event)
|
||||
{
|
||||
windowFocusChanged(true, getId());
|
||||
if (m_editText != null && m_inputConnectionListener != null)
|
||||
m_inputConnectionListener.onEditTextChanged(m_editText);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user