iOS: Limit duration of FirstResponderCandidate to becomeFirstResponder
We only need the FirstResponderCandidate for the duration of the call to [super becomeFirstResponder]. Keeping it around longer means that when emitting window activation events, which may result in changing the first responder again, we may wrongly conclude that we're not allowed to change the responder due to the FirstResponderCandidate still being alive. Change-Id: I8203e795cdde4128776283fe63a1907eb6ebc151 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
parent
8ad200dcb4
commit
bc80cef1d4
@ -209,19 +209,24 @@
|
||||
|
||||
- (BOOL)becomeFirstResponder
|
||||
{
|
||||
FirstResponderCandidate firstResponderCandidate(self);
|
||||
{
|
||||
// Scope for the duration of becoming first responder only, as the window
|
||||
// activation event may trigger new responders, which we don't want to be
|
||||
// blocked by this guard.
|
||||
FirstResponderCandidate firstResponderCandidate(self);
|
||||
|
||||
qImDebug() << "win:" << m_qioswindow->window() << "self:" << self
|
||||
<< "first:" << [UIResponder currentFirstResponder];
|
||||
qImDebug() << "win:" << m_qioswindow->window() << "self:" << self
|
||||
<< "first:" << [UIResponder currentFirstResponder];
|
||||
|
||||
if (![super becomeFirstResponder]) {
|
||||
qImDebug() << m_qioswindow->window()
|
||||
<< "was not allowed to become first responder";
|
||||
return NO;
|
||||
if (![super becomeFirstResponder]) {
|
||||
qImDebug() << m_qioswindow->window()
|
||||
<< "was not allowed to become first responder";
|
||||
return NO;
|
||||
}
|
||||
|
||||
qImDebug() << m_qioswindow->window() << "became first responder";
|
||||
}
|
||||
|
||||
qImDebug() << m_qioswindow->window() << "became first responder";
|
||||
|
||||
if (qGuiApp->focusWindow() != m_qioswindow->window())
|
||||
QWindowSystemInterface::handleWindowActivated<QWindowSystemInterface::SynchronousDelivery>(m_qioswindow->window());
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user