Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #361 #365

Merged
merged 2 commits into from
Mar 13, 2016
Merged

Fix #361 #365

merged 2 commits into from
Mar 13, 2016

Conversation

yukawa
Copy link
Collaborator

@yukawa yukawa commented Mar 13, 2016

In order to fix #361, two changes are needed; one is to fix a bug about how to calculate the exclusion rect, and the other is to use CAN_USE_CANDIDATE_FORM_FOR_SUGGEST compatibility flag for Firefox.

See commit messages for details.

It turns out that |CANDIDATEFORM::rcArea| has been unexpectedly ignored
when the IMM32 client also supports IMR_QUERYCHARPOSITION protocol.

In short, the base position and exclude region for suggestion/conversion
window should be determined by using different priority rules.

Followings are expected orders of rules after this CL is applied.

 A. base position for suggestion:
  1. IMR_QUERYCHARPOSITION
  2. CANDIDATEFORM::ptCurrentPos (if CAN_USE_CANDIDATE_FORM_FOR_SUGGEST)
  3. GUITHREADINFO::rcCaret
  4. COMPOSITIONFORM::ptCurrentPos
  5. The edge of the client window.

 B. base position for conversion:
  1. IMR_QUERYCHARPOSITION
  2. CANDIDATEFORM::ptCurrentPos
  3. GUITHREADINFO::rcCaret
  4. COMPOSITIONFORM::ptCurrentPos
  5. The edge of the client window.

 C. exclude rect for suggestion:
  1. CANDIDATEFORM::rcArea (if CAN_USE_CANDIDATE_FORM_FOR_SUGGEST)
  2. IMR_QUERYCHARPOSITION + font height
  3. GUITHREADINFO::rcCaret + font height
  4. COMPOSITIONFORM::ptCurrentPos + font height
  5. The client rect of the target window.

 D. exclude rect for conversion:
  1. CANDIDATEFORM::rcArea
  2. IMR_QUERYCHARPOSITION + font height
  3. GUITHREADINFO::rcCaret + font height
  4. COMPOSITIONFORM::ptCurrentPos + font height
  5. The client rect of the target window.

What has been broken is the 1st rule and 2nd rule of C and D.
Previously we have mistakenly put higher priority on
IMR_QUERYCHARPOSITION in those cases.

BUG=#361
TEST=manually done
REF_BUG=27394949
REF_CL=115815290
Strictly speaking, IMM32 spec never requires the application to update
|CANDIDATEFORM| until IMN_OPENCANDIDATE is sent from the IME.

In the case of Mozc, we intentionally do not send IMN_OPENCANDIDATE when
the suggestion window is shown, because doing that can confuse some
applications such as command prompt.

That said, |CANDIDATEFORM::rcArea| is still a useful information that we
want to rely on if it is guaranteed to be kept updated.  For that
purpose, we have maintained a list of applications which are known to
keep |CANDIDATEFORM::rcArea| updated regardless of IMN_OPENCANDIDATE,
and this CL adds "MozillaWindowClass" window class into the whitelist so
that Firefox can be marked with CAN_USE_CANDIDATE_FORM_FOR_SUGGEST
compatibility flag.

BUG=#361
TEST=manually done
REF_BUG=27394949
REF_CL=115815738
@yukawa yukawa self-assigned this Mar 13, 2016
yukawa added a commit that referenced this pull request Mar 13, 2016
@yukawa yukawa merged commit 0ccaad3 into master Mar 13, 2016
@yukawa yukawa deleted the fix_issue361 branch March 13, 2016 05:00
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.

ImmSetCandidateWindow() with CFS_EXCLUDE isn't supported on Win Vista and Win7
1 participant