From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winex11.drv/event.c | 8 ++++++++ dlls/winex11.drv/window.c | 28 ++++++++++++++++++++++++++++ dlls/winex11.drv/x11drv.h | 2 ++ dlls/winex11.drv/x11drv_main.c | 2 ++ 4 files changed, 40 insertions(+)
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index cf9fd96a2fb..e20d5cb70b5 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -1260,6 +1260,13 @@ static void handle_net_supported_notify( XPropertyEvent *event ) if (event->state == PropertyNewValue) net_supported_init( data ); }
+static void handle_net_supporting_wm_check_notify( XPropertyEvent *event ) +{ + struct x11drv_thread_data *data = x11drv_thread_data(); + + if (event->state == PropertyNewValue) net_supporting_wm_check_init( data ); +} + /*********************************************************************** * X11DRV_PropertyNotify */ @@ -1272,6 +1279,7 @@ static BOOL X11DRV_PropertyNotify( HWND hwnd, XEvent *xev ) if (event->atom == x11drv_atom(_XEMBED_INFO)) handle_xembed_info_notify( hwnd, event ); if (event->atom == x11drv_atom(_NET_WM_STATE)) handle_net_wm_state_notify( hwnd, event ); if (event->atom == x11drv_atom(_NET_SUPPORTED)) handle_net_supported_notify( event ); + if (event->atom == x11drv_atom(_NET_SUPPORTING_WM_CHECK)) handle_net_supporting_wm_check_notify( event );
return TRUE; } diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 179ca0b5ca3..d31f0d87030 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -3417,6 +3417,34 @@ void net_supported_init( struct x11drv_thread_data *data ) } }
+static Window get_net_supporting_wm_check( Display *display, Window window ) +{ + unsigned long count, remaining; + Window *tmp, support = None; + int format; + Atom type; + + if (!XGetWindowProperty( display, window, x11drv_atom(_NET_SUPPORTING_WM_CHECK), 0, 65536 / sizeof(CARD32), + False, XA_WINDOW, &type, &format, &count, &remaining, (unsigned char **)&tmp )) + { + support = *tmp; + free( tmp ); + } + + return support; +} + +void net_supporting_wm_check_init( struct x11drv_thread_data *data ) +{ + Window window = None, other; + + window = get_net_supporting_wm_check( data->display, DefaultRootWindow( data->display ) ); + /* the window itself must have the property set too */ + X11DRV_expect_error( data->display, host_window_error, NULL ); + other = get_net_supporting_wm_check( data->display, window ); + if (X11DRV_check_error() || window != other) WARN( "Invalid _NET_SUPPORTING_WM_CHECK window\n" ); +} + void init_win_context(void) { init_recursive_mutex( &win_data_mutex ); diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 995df13e843..324e9d0f3ae 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -487,6 +487,7 @@ enum x11drv_atoms XATOM__NET_STARTUP_INFO_BEGIN, XATOM__NET_STARTUP_INFO, XATOM__NET_SUPPORTED, + XATOM__NET_SUPPORTING_WM_CHECK, XATOM__NET_SYSTEM_TRAY_OPCODE, XATOM__NET_SYSTEM_TRAY_S0, XATOM__NET_SYSTEM_TRAY_VISUAL, @@ -667,6 +668,7 @@ extern void window_configure_notify( struct x11drv_win_data *data, unsigned long 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 void net_supporting_wm_check_init( struct x11drv_thread_data *data );
extern Window init_clip_window(void); extern void update_user_time( Time time ); diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index a9ef67085f1..99d2dbd8c97 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -132,6 +132,7 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] = "_NET_STARTUP_INFO_BEGIN", "_NET_STARTUP_INFO", "_NET_SUPPORTED", + "_NET_SUPPORTING_WM_CHECK", "_NET_SYSTEM_TRAY_OPCODE", "_NET_SYSTEM_TRAY_S0", "_NET_SYSTEM_TRAY_VISUAL", @@ -758,6 +759,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 ); + net_supporting_wm_check_init( data );
return data; }