Reduce useless setTypingState calls on lost focus

This commit is contained in:
miruka 2019-05-17 16:01:42 -04:00
parent 2e5b846695
commit de9140cdb2
2 changed files with 13 additions and 3 deletions

View File

@ -47,7 +47,6 @@
- Client improvements
- Filtering rooms: search more than display names?
- nio.MatrixRoom has `typing_users`, no need to handle it on our own
- Don't send setTypingState False when focus lost if nothing in sendbox
- Initial sync filter and lazy load, see weechat-matrix `_handle_login()`
- See also `handle_response()`'s `keys_query` request
- HTTP/2
@ -64,6 +63,7 @@
- Keep an accounts order
- See `Qt.callLater()` potential usages
- Banner name color instead of bold
- Animate RoomEventDelegate DayBreak apparition
- Missing nio support
- MatrixRoom invited members list

View File

@ -31,13 +31,23 @@ HRectangle {
backgroundColor: "transparent"
area.focus: true
property bool textChangedSinceLostFocus: false
function setTyping(typing) {
Backend.clients.get(chatPage.userId)
.setTypingState(chatPage.roomId, typing)
}
onTextChanged: setTyping(Boolean(text))
area.onEditingFinished: setTyping(false) // when lost focus
onTextChanged: {
setTyping(Boolean(text))
textChangedSinceLostFocus = true
}
area.onEditingFinished: { // when lost focus
if (text && textChangedSinceLostFocus) {
setTyping(false)
textChangedSinceLostFocus = false
}
}
Keys.onReturnPressed: {
event.accepted = true