Commit bf9a649e authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winex11: Add a helper to select IME private font.

parent 904ddc7e
......@@ -49,7 +49,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(imm);
#define FROM_X11 ((HIMC)0xcafe1337)
typedef struct _IMEPRIVATE {
typedef struct ime_private
{
BOOL bInComposition;
BOOL bInternalState;
HFONT textfont;
......@@ -91,6 +92,16 @@ static WCHAR *input_context_get_comp_str( INPUTCONTEXT *ctx, BOOL result, UINT *
return text;
}
static HFONT input_context_select_ui_font( INPUTCONTEXT *ctx, HDC hdc )
{
struct ime_private *priv;
HFONT font = NULL;
if (!(priv = ImmLockIMCC( ctx->hPrivate ))) return NULL;
if (priv->textfont) font = SelectObject( hdc, priv->textfont );
ImmUnlockIMCC( ctx->hPrivate );
return font;
}
static LRESULT WINAPI IME_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
LPARAM lParam);
......@@ -1010,17 +1021,9 @@ static void PaintDefaultIMEWnd(HIMC hIMC, HWND hwnd)
if ((str = input_context_get_comp_str( lpIMC, FALSE, &len )))
{
HFONT font = input_context_select_ui_font( lpIMC, hdc );
SIZE size;
POINT pt;
HFONT oldfont = NULL;
LPIMEPRIVATE myPrivate;
myPrivate = ImmLockIMCC(lpIMC->hPrivate);
if (myPrivate->textfont)
oldfont = SelectObject(hdc,myPrivate->textfont);
ImmUnlockIMCC(lpIMC->hPrivate);
GetTextExtentPoint32W( hdc, str, len, &size );
pt.x = size.cx;
......@@ -1101,8 +1104,7 @@ static void PaintDefaultIMEWnd(HIMC hIMC, HWND hwnd)
TextOutW( hdc, offX, offY, str, len );
if (oldfont)
SelectObject(hdc,oldfont);
if (font) SelectObject( hdc, font );
free( str );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment