Commit 8b6a2195 authored by Alexandre Julliard's avatar Alexandre Julliard

Create an X input context for each top-level window.

parent d0372b4e
...@@ -688,6 +688,15 @@ static Window create_whole_window( Display *display, WND *win ) ...@@ -688,6 +688,15 @@ static Window create_whole_window( Display *display, WND *win )
return 0; return 0;
} }
if (is_top_level)
{
XIM xim = x11drv_thread_data()->xim;
if (xim) data->xic = XCreateIC( xim,
XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
XNClientWindow, data->whole_window,
0 );
}
/* non-maximized child must be at bottom of Z order */ /* non-maximized child must be at bottom of Z order */
if ((win->dwStyle & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD) if ((win->dwStyle & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD)
{ {
...@@ -829,6 +838,11 @@ BOOL X11DRV_DestroyWindow( HWND hwnd ) ...@@ -829,6 +838,11 @@ BOOL X11DRV_DestroyWindow( HWND hwnd )
XDeleteContext( display, data->whole_window, winContext ); XDeleteContext( display, data->whole_window, winContext );
XDeleteContext( display, data->client_window, winContext ); XDeleteContext( display, data->client_window, winContext );
XDestroyWindow( display, data->whole_window ); /* this destroys client too */ XDestroyWindow( display, data->whole_window ); /* this destroys client too */
if (data->xic)
{
XUnsetICFocus( data->xic );
XDestroyIC( data->xic );
}
destroy_icon_window( display, wndPtr ); destroy_icon_window( display, wndPtr );
wine_tsx11_unlock(); wine_tsx11_unlock();
} }
...@@ -871,6 +885,7 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode ) ...@@ -871,6 +885,7 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
data->whole_window = 0; data->whole_window = 0;
data->client_window = 0; data->client_window = 0;
data->icon_window = 0; data->icon_window = 0;
data->xic = 0;
data->hWMIconBitmap = 0; data->hWMIconBitmap = 0;
data->hWMIconMask = 0; data->hWMIconMask = 0;
...@@ -1080,6 +1095,26 @@ Window X11DRV_get_whole_window( HWND hwnd ) ...@@ -1080,6 +1095,26 @@ Window X11DRV_get_whole_window( HWND hwnd )
} }
/***********************************************************************
* X11DRV_get_ic
*
* Return the X input context associated with a window
*/
XIC X11DRV_get_ic( HWND hwnd )
{
XIC ret = 0;
WND *win = WIN_GetPtr( hwnd );
if (win && win != WND_OTHER_PROCESS)
{
struct x11drv_win_data *data = win->pDriverData;
ret = data->xic;
WIN_ReleasePtr( win );
}
return ret;
}
/***************************************************************** /*****************************************************************
* SetParent (X11DRV.@) * SetParent (X11DRV.@)
*/ */
......
...@@ -328,14 +328,6 @@ static void process_attach(void) ...@@ -328,14 +328,6 @@ static void process_attach(void)
screen_depth = desktop_vi->depth; screen_depth = desktop_vi->depth;
} }
/* tell the libX11 that we will do input method handling ourselves
* that keep libX11 from doing anything whith dead keys, allowing Wine
* to have total control over dead keys, that is this line allows
* them to work in Wine, even whith a libX11 including the dead key
* patches from Th.Quinot (http://Web.FdN.FR/~tquinot/dead-keys.en.html)
*/
TSXOpenIM( display, NULL, NULL, NULL);
if (synchronous) XSynchronize( display, True ); if (synchronous) XSynchronize( display, True );
screen_width = WidthOfScreen( screen ); screen_width = WidthOfScreen( screen );
...@@ -377,6 +369,7 @@ static void thread_detach(void) ...@@ -377,6 +369,7 @@ static void thread_detach(void)
CloseHandle( data->display_fd ); CloseHandle( data->display_fd );
wine_tsx11_lock(); wine_tsx11_lock();
XCloseDisplay( data->display ); XCloseDisplay( data->display );
if (data->xim) XCloseIM( data->xim );
wine_tsx11_unlock(); wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, data ); HeapFree( GetProcessHeap(), 0, data );
} }
...@@ -429,6 +422,10 @@ struct x11drv_thread_data *x11drv_init_thread_data(void) ...@@ -429,6 +422,10 @@ struct x11drv_thread_data *x11drv_init_thread_data(void)
ExitProcess(1); ExitProcess(1);
} }
fcntl( ConnectionNumber(data->display), F_SETFD, 1 ); /* set close on exec flag */ fcntl( ConnectionNumber(data->display), F_SETFD, 1 ); /* set close on exec flag */
if (!(data->xim = XOpenIM( data->display, NULL, NULL, NULL )))
WARN("Can't open input method\n");
if (synchronous) XSynchronize( data->display, True ); if (synchronous) XSynchronize( data->display, True );
wine_tsx11_unlock(); wine_tsx11_unlock();
if (wine_server_fd_to_handle( ConnectionNumber(data->display), GENERIC_READ | SYNCHRONIZE, if (wine_server_fd_to_handle( ConnectionNumber(data->display), GENERIC_READ | SYNCHRONIZE,
......
...@@ -337,6 +337,7 @@ struct x11drv_thread_data ...@@ -337,6 +337,7 @@ struct x11drv_thread_data
Cursor cursor; /* current cursor */ Cursor cursor; /* current cursor */
Window cursor_window; /* current window that contains the cursor */ Window cursor_window; /* current window that contains the cursor */
HWND last_focus; /* last window that had focus */ HWND last_focus; /* last window that had focus */
XIM xim; /* input method */
}; };
extern struct x11drv_thread_data *x11drv_init_thread_data(void); extern struct x11drv_thread_data *x11drv_init_thread_data(void);
...@@ -400,6 +401,7 @@ struct x11drv_win_data ...@@ -400,6 +401,7 @@ struct x11drv_win_data
Window icon_window; /* X window for the icon */ Window icon_window; /* X window for the icon */
RECT whole_rect; /* X window rectangle for the whole window relative to parent */ RECT whole_rect; /* X window rectangle for the whole window relative to parent */
RECT client_rect; /* client area relative to whole window */ RECT client_rect; /* client area relative to whole window */
XIC xic; /* X input context */
HBITMAP hWMIconBitmap; HBITMAP hWMIconBitmap;
HBITMAP hWMIconMask; HBITMAP hWMIconMask;
}; };
...@@ -408,6 +410,7 @@ typedef struct x11drv_win_data X11DRV_WND_DATA; ...@@ -408,6 +410,7 @@ typedef struct x11drv_win_data X11DRV_WND_DATA;
extern Window X11DRV_get_client_window( HWND hwnd ); extern Window X11DRV_get_client_window( HWND hwnd );
extern Window X11DRV_get_whole_window( HWND hwnd ); extern Window X11DRV_get_whole_window( HWND hwnd );
extern XIC X11DRV_get_ic( HWND hwnd );
inline static Window get_client_window( WND *wnd ) inline static Window get_client_window( WND *wnd )
{ {
......
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