From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winex11.drv/window.c | 31 +++++++++++++++++-------------- dlls/winex11.drv/x11drv.h | 5 +++++ dlls/winex11.drv/x11drv_main.c | 2 ++ 3 files changed, 24 insertions(+), 14 deletions(-)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 11006896c9c..11864d3d515 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -104,11 +104,6 @@ static XContext host_window_context = 0; static Time last_user_time; static Window user_time_window;
-/* list of _NET_SUPPORTED atoms */ -static Atom *net_supported; -static int net_supported_count; -static UINT net_wm_state_mask; - static const WCHAR whole_window_prop[] = {'_','_','w','i','n','e','_','x','1','1','_','w','h','o','l','e','_','w','i','n','d','o','w',0}; static const WCHAR clip_window_prop[] = @@ -1219,7 +1214,7 @@ static void window_set_net_wm_state( struct x11drv_win_data *data, UINT new_stat { UINT i, count, old_state = data->pending_state.net_wm_state;
- new_state &= net_wm_state_mask; + new_state &= x11drv_thread_data()->net_wm_state_mask; data->desired_state.net_wm_state = new_state; if (!data->whole_window) return; /* no window, nothing to update */ if (data->wm_state_serial) return; /* another WM_STATE update is pending, wait for it to complete */ @@ -3276,10 +3271,15 @@ LRESULT X11DRV_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) */ static BOOL is_netwm_supported( Atom atom ) { + struct x11drv_thread_data *data = x11drv_thread_data(); + BOOL supported; int i; - for (i = 0; i < net_supported_count; i++) - if (net_supported[i] == atom) return TRUE; - return FALSE; + + for (i = 0; i < data->net_supported_count; i++) + if (data->net_supported[i] == atom) break; + supported = i < data->net_supported_count; + + return supported; }
@@ -3405,22 +3405,25 @@ void X11DRV_FlashWindowEx( FLASHWINFO *pfinfo ) release_win_data( data ); }
-void init_win_context(void) +void net_supported_init( struct x11drv_thread_data *data ) { unsigned long count, remaining; int format, i; Atom type;
- if (!XGetWindowProperty( gdi_display, DefaultRootWindow( gdi_display ), x11drv_atom(_NET_SUPPORTED), 0, 65536 / sizeof(CARD32), - False, XA_ATOM, &type, &format, &count, &remaining, (unsigned char **)&net_supported )) - net_supported_count = get_property_size( format, count ) / sizeof(Atom); + if (!XGetWindowProperty( data->display, DefaultRootWindow( data->display ), x11drv_atom(_NET_SUPPORTED), 0, 65536 / sizeof(CARD32), + False, XA_ATOM, &type, &format, &count, &remaining, (unsigned char **)&data->net_supported )) + data->net_supported_count = get_property_size( format, count ) / sizeof(Atom);
for (i = 0; i < NB_NET_WM_STATES; i++) { Atom atom = X11DRV_Atoms[net_wm_state_atoms[i] - FIRST_XATOM]; - if (is_netwm_supported( atom )) net_wm_state_mask |= (1 << i); + if (is_netwm_supported( atom )) data->net_wm_state_mask |= (1 << i); } +}
+void init_win_context(void) +{ init_recursive_mutex( &win_data_mutex );
winContext = XUniqueContext(); diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 860ba22eae4..995df13e843 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -394,6 +394,9 @@ struct x11drv_thread_data unsigned long warp_serial; /* serial number of last pointer warp request */ Window clip_window; /* window used for cursor clipping */ BOOL clipping_cursor; /* whether thread is currently clipping the cursor */ + Atom *net_supported; /* list of _NET_SUPPORTED atoms */ + int net_supported_count; /* number of _NET_SUPPORTED atoms */ + UINT net_wm_state_mask; /* mask of supported _NET_WM_STATE *bits */ #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H XIValuatorClassInfo x_valuator; XIValuatorClassInfo y_valuator; @@ -663,6 +666,8 @@ extern void window_net_wm_state_notify( struct x11drv_win_data *data, unsigned l extern void window_configure_notify( struct x11drv_win_data *data, unsigned long serial, const RECT *rect ); extern BOOL get_window_state_updates( HWND hwnd, UINT *state_cmd, UINT *config_cmd, RECT *rect );
+extern void net_supported_init( struct x11drv_thread_data *data ); + extern Window init_clip_window(void); extern void update_user_time( Time time ); extern UINT get_window_net_wm_state( Display *display, Window window ); diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 86867abf9f9..6e2690e1817 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -686,6 +686,7 @@ void X11DRV_ThreadDetach(void) { if (data->xim) XCloseIM( data->xim ); if (data->font_set) XFreeFontSet( data->display, data->font_set ); + if (data->net_supported) XFree( data->net_supported ); XSync( gdi_display, False ); /* make sure XReparentWindow requests have completed before closing the thread display */ XCloseDisplay( data->display ); free( data ); @@ -752,6 +753,7 @@ struct x11drv_thread_data *x11drv_init_thread_data(void)
if (use_xim) xim_thread_attach( data ); x11drv_xinput2_init( data ); + net_supported_init( data );
return data; }