[saco] Match CDXUTIMEEditBox::RenderCandidateReadingWindow; retail has no bottom/top/right/left fitting

This commit is contained in:
ricardoofnl
2026-08-30 18:41:19 +07:00
parent 1b02719af0
commit f21e9d5f89
-52
View File
@@ -7077,12 +7077,6 @@ void CDXUTIMEEditBox::RenderCandidateReadingWindow( IDirect3DDevice9* pd3dDevice
}
// Now that we have the dimension, calculate the location for the candidate window.
// We attempt to fit the window in this order:
// bottom, top, right, left.
bool bHasPosition = false;
// Bottom
SetRect( &rc, s_ptCompString.x + nXComp, s_ptCompString.y + m_rcText.bottom - m_rcText.top,
s_ptCompString.x + nXComp + nWidthRequired, s_ptCompString.y + m_rcText.bottom - m_rcText.top + nHeightRequired );
// if the right edge is cut off, move it left.
@@ -7091,52 +7085,6 @@ void CDXUTIMEEditBox::RenderCandidateReadingWindow( IDirect3DDevice9* pd3dDevice
rc.left -= rc.right - m_pDialog->GetWidth();
rc.right = m_pDialog->GetWidth();
}
if( rc.bottom <= m_pDialog->GetHeight() )
bHasPosition = true;
// Top
if( !bHasPosition )
{
SetRect( &rc, s_ptCompString.x + nXComp, s_ptCompString.y - nHeightRequired,
s_ptCompString.x + nXComp + nWidthRequired, s_ptCompString.y );
// if the right edge is cut off, move it left.
if( rc.right > m_pDialog->GetWidth() )
{
rc.left -= rc.right - m_pDialog->GetWidth();
rc.right = m_pDialog->GetWidth();
}
if( rc.top >= 0 )
bHasPosition = true;
}
// Right
if( !bHasPosition )
{
int nXCompTrail;
s_CompString.CPtoX( s_nCompCaret, TRUE, &nXCompTrail );
SetRect( &rc, s_ptCompString.x + nXCompTrail, 0,
s_ptCompString.x + nXCompTrail + nWidthRequired, nHeightRequired );
if( rc.right <= m_pDialog->GetWidth() )
bHasPosition = true;
}
// Left
if( !bHasPosition )
{
SetRect( &rc, s_ptCompString.x + nXComp - nWidthRequired, 0,
s_ptCompString.x + nXComp, nHeightRequired );
if( rc.right >= 0 )
bHasPosition = true;
}
if( !bHasPosition )
{
// The dialog is too small for the candidate window.
// Fall back to render at 0, 0. Some part of the window
// will be cut off.
rc.left = 0;
rc.right = nWidthRequired;
}
// If we are rendering the candidate window, save the position
// so that mouse clicks are checked properly.