Skip to content

Add modern CandidateWindow rendering and theme support#3

Open
omni624562 wants to merge 13 commits into
EasyIME:masterfrom
omni624562:codex/candidate-window-ui
Open

Add modern CandidateWindow rendering and theme support#3
omni624562 wants to merge 13 commits into
EasyIME:masterfrom
omni624562:codex/candidate-window-ui

Conversation

@omni624562
Copy link
Copy Markdown

Summary / 摘要

中文

這個 PR 新增 libIME2 CandidateWindow 的新版候選窗繪製能力,讓 PIME 端可以啟用較現代化、可客製化的候選窗 UI。

主要內容:

  • 新增新版候選窗模式,保留既有 legacy 行為作為預設相容路徑
  • 支援 header/body 雙層結構,可顯示輸入法名稱、組字字根與頁碼資訊
  • 支援候選窗內提示訊息,例如「查無組字...」
  • 新增配色、選字符樣式、間距、圓角、固定最小寬度、最大寬度換行等外觀控制
  • 改善新版候選窗尺寸計算與選取項目的可讀性
  • 修正空候選清單時可能造成尺寸計算異常的問題
  • 減少 recalculateSize() 期間重複取得 DC 的成本

English

This PR adds modern rendering support to libIME2 CandidateWindow, allowing PIME clients to opt into a more customizable candidate window UI.

Highlights:

  • Adds an opt-in modern candidate window mode while preserving the legacy default behavior
  • Supports a stable header/body layout for IME name, composition roots, and page information
  • Supports inline candidate-window messages, such as no-candidate hints
  • Adds appearance controls for theme colors, selection-key styles, spacing, border radius, stable minimum width, and max-width wrapping
  • Improves modern candidate sizing and selected-candidate readability
  • Fixes sizing behavior for empty candidate lists
  • Reduces repeated DC acquisition during recalculateSize()

Compatibility / 相容性

中文

新版 UI 需要由上層 client 明確啟用;未啟用時,既有候選窗行為應維持不變。

English

The modern UI is opt-in from the client side. Existing legacy candidate window behavior should remain unchanged when it is not enabled.

Validation / 驗證

Validated through the dependent PIME branch:

  • PIMETextService Release build, Win32
  • PIMETextService Release build, x64
  • Dependent PIME-side Python compile/tests passed

omni624562 and others added 13 commits May 28, 2026 07:16
The original code had no return after the early resize(margin_*2, margin_*2)
for empty items, causing execution to fall through to width calculation where
items_.size()-1 underflows to SIZE_MAX, producing incorrect window dimensions.

Restructured the function to measure header width as well as height, then
handle the empty-items case explicitly with header-based sizing. Also added
max(width, headerWidth+margin_*2) for non-empty cases to ensure the window
is always wide enough to display the header.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Separate the composition header from the candidate row, add divider-aware sizing, and keep modern candidate item hit areas aligned with the visual layout.
Calculate modern candidate window height from the same top offset used by itemRect and reserve extra bottom padding so selected candidates do not collide with the window border.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant