Repository navigation
fix(ui): 首次显示候选窗时等待光标位置就绪,避免先画在旧位置 - #1967
Draft
doublemarkpro wants to merge 1 commit into
Draft
doublemarkpro wants to merge 1 commit into
doublemarkpro wants to merge 1 commit into
Conversation
TSF 侧的光标矩形是异步取回的(WeaselTSF/Composition.cpp 的 RequestEditSession(TF_ES_ASYNCDONTCARE)),而候选窗的 Show 在同一次 按键处理里就发生了,导致首帧按上一段输入的位置绘制,随后再跳到光标。 - UIImpl 记录本次输入是否已收到有效位置;未收到时 Show() 先挂起 - UI::UpdateInputPosition 到达后补上显示 - WeaselPanel::ShowDeferred 提供 80ms 兜底,避免拿不到 rect 的宿主不显示 关联 rime#1966
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
Electron / Chromium 宿主里,聚焦输入框后第一次输入时,候选窗会先在上一段输入的位置显示一帧,再跳到光标处(#1966)。UI throttle 修复(#1869)降低了概率,但没有消除。
原因
TSF 侧的光标矩形是异步取回的:
WeaselTSF/Composition.cpp的CGetTextExtentEditSession::DoEditSession:GetTextExt成功后才_SetCompositionPosition(rc)WeaselTSF::_UpdateCompositionWindow用RequestEditSession(..., TF_ES_ASYNCDONTCARE | TF_ES_READ, ...),结果要等下一个 UI tick而
CCandidateList::Show(TRUE)→UI::Show()在同一次按键处理里就执行了,此时WeaselPanel::m_inputPos还是上一段 composition 的值,于是首帧画在旧位置。改动
UIImpl增加has_position:记录本次输入是否已收到有效光标位置Show()在位置未就绪时只置pending_show,不再立即ShowWindowUI::UpdateInputPosition()到达后补上显示WeaselPanel::ShowDeferred(80ms)作为兜底:始终拿不到光标矩形的宿主仍然会显示Hide()/ 正常ShowWindow(SW_SHOWNA)时清理挂起状态与定时器改动共 3 个文件、+45 行。
说明
关联:#1966,#1869