From 313157a036ba361f95d0a69949368cc868e5b3fe Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 24 Sep 2012 14:09:43 +0200 Subject: [PATCH] winex11: Add window data structure locking to the remaining entry points. --- dlls/winex11.drv/desktop.c | 3 ++- dlls/winex11.drv/window.c | 29 ++++++++--------------------- dlls/winex11.drv/x11drv.h | 1 - 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/dlls/winex11.drv/desktop.c b/dlls/winex11.drv/desktop.c index b35ccaa468e..69cc3464e7b 100644 --- a/dlls/winex11.drv/desktop.c +++ b/dlls/winex11.drv/desktop.c @@ -177,7 +177,7 @@ static BOOL CALLBACK update_windows_on_desktop_resize( HWND hwnd, LPARAM lparam struct desktop_resize_data *resize_data = (struct desktop_resize_data *)lparam; int mask = 0; - if (!(data = X11DRV_get_win_data( hwnd ))) return TRUE; + if (!(data = get_win_data( hwnd ))) return TRUE; /* update the full screen state */ update_net_wm_states( data ); @@ -193,6 +193,7 @@ static BOOL CALLBACK update_windows_on_desktop_resize( HWND hwnd, LPARAM lparam XReconfigureWMWindow( data->display, data->whole_window, DefaultScreen(data->display), mask, &changes ); } + release_win_data( data ); if (hwnd == GetForegroundWindow()) clip_fullscreen_window( hwnd, TRUE ); return TRUE; } diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index c9211f48b0c..2a8b0102063 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1671,24 +1671,6 @@ void release_win_data( struct x11drv_win_data *data ) /*********************************************************************** - * X11DRV_get_win_data - * - * Return the X11 data structure associated with a window. - */ -struct x11drv_win_data *X11DRV_get_win_data( HWND hwnd ) -{ - struct x11drv_win_data *data = get_win_data( hwnd ); - - if (data) - { - release_win_data( data ); - if (GetWindowThreadProcessId( hwnd, NULL ) != GetCurrentThreadId()) data = NULL; - } - return data; -} - - -/*********************************************************************** * X11DRV_create_win_data * * Create an X11 data window structure for an existing window. @@ -1882,7 +1864,6 @@ void CDECL X11DRV_GetDC( HDC hdc, HWND hwnd, HWND top, const RECT *win_rect, const RECT *top_rect, DWORD flags ) { struct x11drv_escape_set_drawable escape; - struct x11drv_win_data *data = X11DRV_get_win_data( hwnd ); HWND parent; escape.code = X11DRV_SET_DRAWABLE; @@ -1897,10 +1878,13 @@ void CDECL X11DRV_GetDC( HDC hdc, HWND hwnd, HWND top, const RECT *win_rect, if (top == hwnd) { + struct x11drv_win_data *data = get_win_data( hwnd ); + escape.drawable = data ? data->whole_window : X11DRV_get_whole_window( hwnd ); /* special case: when repainting the root window, clip out top-level windows */ if (data && data->whole_window == root_window) escape.mode = ClipByChildren; + release_win_data( data ); } else { @@ -2372,8 +2356,11 @@ LRESULT CDECL X11DRV_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) X11DRV_resize_desktop( LOWORD(lp), HIWORD(lp) ); return 0; case WM_X11DRV_SET_CURSOR: - if ((data = X11DRV_get_win_data( hwnd )) && data->whole_window) - set_window_cursor( data->whole_window, (HCURSOR)lp ); + if ((data = get_win_data( hwnd ))) + { + if (data->whole_window) set_window_cursor( data->whole_window, (HCURSOR)lp ); + release_win_data( data ); + } else if (hwnd == x11drv_thread_data()->clip_hwnd) set_window_cursor( x11drv_thread_data()->clip_window, (HCURSOR)lp ); return 0; diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 6b4657f8a1e..d2ce84f86ab 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -557,7 +557,6 @@ struct x11drv_win_data extern struct x11drv_win_data *get_win_data( HWND hwnd ) DECLSPEC_HIDDEN; extern void release_win_data( struct x11drv_win_data *data ) DECLSPEC_HIDDEN; -extern struct x11drv_win_data *X11DRV_get_win_data( HWND hwnd ) DECLSPEC_HIDDEN; extern Window X11DRV_get_whole_window( HWND hwnd ) DECLSPEC_HIDDEN; extern XIC X11DRV_get_ic( HWND hwnd ) DECLSPEC_HIDDEN; -- 2.11.4.GIT