more hacking on click to focus

This commit is contained in:
ZappoMan 2015-08-17 14:02:24 -07:00
parent b7d9dc444b
commit 47b0e2fda6

View file

@ -1277,6 +1277,7 @@ bool Application::event(QEvent* event) {
QCoreApplication::sendEvent(webEntity->getEventHandler(), event);
if (event->isAccepted()) {
_lastAcceptedKeyPress = usecTimestampNow();
qDebug() << "Application::event() key event... _lastAcceptedKeyPress:" << _lastAcceptedKeyPress;
return true;
}
}
@ -1287,6 +1288,7 @@ bool Application::event(QEvent* event) {
break;
}
/*
const quint64 LOSE_FOCUS_AFTER_ELAPSED_TIME = 30 * USECS_PER_SECOND; // if idle for 30 seconds, drop focus
quint64 elapsedSinceAcceptedKeyPress = usecTimestampNow() - _lastAcceptedKeyPress;
if (elapsedSinceAcceptedKeyPress > LOSE_FOCUS_AFTER_ELAPSED_TIME) {
@ -1295,6 +1297,7 @@ bool Application::event(QEvent* event) {
} else {
qDebug() << "elapsedSinceAcceptedKeyPress:" << elapsedSinceAcceptedKeyPress;
}
*/
}
@ -2003,6 +2006,19 @@ void Application::idle() {
return; // bail early, nothing to do here.
}
if (!_keyboardFocusedItem.isInvalidID()) {
const quint64 LOSE_FOCUS_AFTER_ELAPSED_TIME = 30 * USECS_PER_SECOND; // if idle for 30 seconds, drop focus
quint64 elapsedSinceAcceptedKeyPress = usecTimestampNow() - _lastAcceptedKeyPress;
if (elapsedSinceAcceptedKeyPress > LOSE_FOCUS_AFTER_ELAPSED_TIME) {
_keyboardFocusedItem = UNKNOWN_ENTITY_ID;
qDebug() << "Application::idle() no key messages for 30 seconds.... _keyboardFocusedItem: UNKNOWN_ENTITY_ID:" << UNKNOWN_ENTITY_ID;
} else {
qDebug() << "Application::idle() _keyboardFocusedItem:" << _keyboardFocusedItem << "elapsedSinceAcceptedKeyPress:" << elapsedSinceAcceptedKeyPress;
}
} else {
qDebug() << "Application::idle() no focused item, who cares...";
}
// Normally we check PipelineWarnings, but since idle will often take more than 10ms we only show these idle timing
// details if we're in ExtraDebugging mode. However, the ::update() and its subcomponents will show their timing
// details normally.