Commit 2ed57f9b authored by Alexandre Julliard's avatar Alexandre Julliard

winex11: Make sure the clipping window is initialized in every thread.

parent bd3ec1a9
......@@ -774,7 +774,7 @@ static void X11DRV_MapNotify( HWND hwnd, XEvent *event )
{
struct x11drv_win_data *data;
if (event->xany.window == clip_window)
if (event->xany.window == x11drv_thread_data()->clip_window)
{
clipping_cursor = 1;
return;
......@@ -795,7 +795,7 @@ static void X11DRV_MapNotify( HWND hwnd, XEvent *event )
*/
static void X11DRV_UnmapNotify( HWND hwnd, XEvent *event )
{
if (event->xany.window == clip_window) clipping_window_unmapped();
if (event->xany.window == x11drv_thread_data()->clip_window) clipping_window_unmapped();
}
......
......@@ -379,7 +379,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU
input->type = INPUT_MOUSE;
if (!hwnd && window == clip_window)
if (!hwnd && window == x11drv_thread_data()->clip_window)
{
input->u.mi.dx += clip_rect.left;
input->u.mi.dy += clip_rect.top;
......@@ -1032,7 +1032,7 @@ void CDECL X11DRV_SetCursor( HCURSOR handle )
GetTickCount() - last_cursor_change > 100)
{
last_cursor_change = GetTickCount();
if (clipping_cursor) set_window_cursor( clip_window, handle );
if (clipping_cursor) set_window_cursor( init_clip_window(), handle );
else if (cursor_window) SendNotifyMessageW( cursor_window, WM_X11DRV_SET_CURSOR, 0, (LPARAM)handle );
}
}
......@@ -1085,6 +1085,7 @@ BOOL CDECL X11DRV_GetCursorPos(LPPOINT pos)
BOOL CDECL X11DRV_ClipCursor( LPCRECT clip )
{
Display *display = thread_init_display();
Window clip_window = init_clip_window();
if (!clip_window) return TRUE;
......
......@@ -68,8 +68,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
#define SWP_AGG_NOPOSCHANGE (SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE | SWP_NOZORDER)
/* cursor clipping window */
Window clip_window = 0;
/* is cursor clipping active? */
int clipping_cursor = 0;
/* X context to associate a hwnd to an X window */
......@@ -1208,6 +1207,24 @@ static void set_wm_hints( Display *display, struct x11drv_win_data *data )
/***********************************************************************
* init_clip_window
*/
Window init_clip_window(void)
{
struct x11drv_thread_data *data = x11drv_init_thread_data();
if (!data->clip_window &&
(data->clip_window = (Window)GetPropA( GetDesktopWindow(), clip_window_prop )))
{
wine_tsx11_lock();
XSelectInput( data->display, data->clip_window, StructureNotifyMask );
wine_tsx11_unlock();
}
return data->clip_window;
}
/***********************************************************************
* update_user_time
*/
void update_user_time( Time time )
......@@ -1711,6 +1728,8 @@ static Window create_whole_window( Display *display, struct x11drv_win_data *dat
if (!GetLayeredWindowAttributes( data->hwnd, &key, &alpha, &layered_flags )) layered_flags = 0;
sync_window_opacity( display, data->whole_window, key, alpha, layered_flags );
init_clip_window(); /* make sure the clip window is initialized in this thread */
wine_tsx11_lock();
XFlush( display ); /* make sure the window exists before we start painting to it */
wine_tsx11_unlock();
......@@ -1964,35 +1983,26 @@ BOOL CDECL X11DRV_CreateDesktopWindow( HWND hwnd )
*/
BOOL CDECL X11DRV_CreateWindow( HWND hwnd )
{
Display *display = thread_init_display();
if (hwnd == GetDesktopWindow())
{
struct x11drv_thread_data *data = x11drv_init_thread_data();
XSetWindowAttributes attr;
if (root_window != DefaultRootWindow( gdi_display ))
{
/* the desktop win data can't be created lazily */
if (!create_desktop_win_data( display, hwnd )) return FALSE;
if (!create_desktop_win_data( data->display, hwnd )) return FALSE;
}
/* create the cursor clipping window */
attr.override_redirect = TRUE;
attr.event_mask = StructureNotifyMask;
wine_tsx11_lock();
clip_window = XCreateWindow( display, root_window, 0, 0, 1, 1, 0, 0,
InputOnly, visual, CWOverrideRedirect | CWEventMask, &attr );
data->clip_window = XCreateWindow( data->display, root_window, 0, 0, 1, 1, 0, 0,
InputOnly, visual, CWOverrideRedirect | CWEventMask, &attr );
wine_tsx11_unlock();
SetPropA( hwnd, clip_window_prop, (HANDLE)clip_window );
SetPropA( hwnd, clip_window_prop, (HANDLE)data->clip_window );
}
else if (!clip_window)
{
clip_window = (Window)GetPropA( GetDesktopWindow(), clip_window_prop );
wine_tsx11_lock();
XSelectInput( display, clip_window, StructureNotifyMask );
wine_tsx11_unlock();
}
return TRUE;
}
......
......@@ -550,6 +550,7 @@ struct x11drv_thread_data
HWND last_xic_hwnd; /* last xic window */
XFontSet font_set; /* international text drawing font set */
Window selection_wnd; /* window used for selection interactions */
Window clip_window; /* window used for cursor clipping */
HKL kbd_layout; /* active keyboard layout */
enum { xi_unavailable = -1, xi_unknown, xi_disabled, xi_enabled } xi2_state; /* XInput2 state */
};
......@@ -585,7 +586,6 @@ static inline size_t get_property_size( int format, unsigned long count )
extern Visual *visual;
extern Window root_window;
extern Window clip_window;
extern int clipping_cursor;
extern unsigned int screen_width;
extern unsigned int screen_height;
......@@ -800,6 +800,7 @@ extern Drawable create_glxpixmap( Display *display, XVisualInfo *vis, Pixmap par
extern void flush_gl_drawable( X11DRV_PDEVICE *physDev );
extern void wait_for_withdrawn_state( Display *display, struct x11drv_win_data *data, BOOL set );
extern Window init_clip_window(void);
extern void update_user_time( Time time );
extern void update_net_wm_states( Display *display, struct x11drv_win_data *data );
extern void make_window_embedded( Display *display, struct x11drv_win_data *data );
......
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