winex11: Prevent XCreateIC from returning NULL when input style isn't "root".

This commit is contained in:
Muneyuki Noguchi 2008-10-18 23:03:48 +09:00 committed by Alexandre Julliard
parent a226f6609f
commit edd24b613f
3 changed files with 25 additions and 0 deletions

View File

@ -515,6 +515,7 @@ struct x11drv_thread_data
Window grab_window; /* window that currently grabs the mouse */
HWND last_focus; /* last window that had focus */
XIM xim; /* input method */
XFontSet font_set; /* international text drawing font set */
Window selection_wnd; /* window used for selection interactions */
};

View File

@ -562,6 +562,7 @@ static void thread_detach(void)
X11DRV_ResetSelectionOwner();
wine_tsx11_lock();
if (data->xim) XCloseIM( data->xim );
if (data->font_set) XFreeFontSet( data->display, data->font_set );
XCloseDisplay( data->display );
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, data );

View File

@ -477,6 +477,26 @@ static BOOL open_xim( Display *display )
thread_data->xim = xim;
if ((ximStyle & (XIMPreeditNothing | XIMPreeditNone)) == 0 ||
(ximStyle & (XIMStatusNothing | XIMStatusNone)) == 0)
{
char **list;
int count;
thread_data->font_set = XCreateFontSet(display, "fixed",
&list, &count, NULL);
TRACE("ximFontSet = %p\n", thread_data->font_set);
TRACE("list = %p, count = %d\n", list, count);
if (list != NULL)
{
int i;
for (i = 0; i < count; ++i)
TRACE("list[%d] = %s\n", i, list[i]);
XFreeStringList(list);
}
}
else
thread_data->font_set = NULL;
wine_tsx11_unlock();
IME_UpdateAssociation(NULL);
wine_tsx11_lock();
@ -518,6 +538,7 @@ XIC X11DRV_CreateIC(XIM xim, struct x11drv_win_data *data)
XICCallback P_StartCB, P_DoneCB, P_DrawCB, P_CaretCB;
LANGID langid = PRIMARYLANGID(LANGIDFROMLCID(GetThreadLocale()));
Window win = data->whole_window;
XFontSet fontSet = x11drv_thread_data()->font_set;
TRACE("xim = %p\n", xim);
@ -552,6 +573,7 @@ XIC X11DRV_CreateIC(XIM xim, struct x11drv_win_data *data)
if ((ximStyle & (XIMPreeditNothing | XIMPreeditNone)) == 0)
{
preedit = XVaCreateNestedList(0,
XNFontSet, fontSet,
XNSpotLocation, &spot,
XNPreeditStartCallback, &P_StartCB,
XNPreeditDoneCallback, &P_DoneCB,
@ -575,6 +597,7 @@ XIC X11DRV_CreateIC(XIM xim, struct x11drv_win_data *data)
if ((ximStyle & (XIMStatusNothing | XIMStatusNone)) == 0)
{
status = XVaCreateNestedList(0,
XNFontSet, fontSet,
NULL);
TRACE("status = %p\n", status);
}