From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winex11.drv/event.c | 6 ++++++ dlls/winex11.drv/window.c | 15 +++++++++++++++ dlls/winex11.drv/x11drv.h | 2 ++ dlls/winex11.drv/x11drv_main.c | 2 ++ 4 files changed, 25 insertions(+)
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index e20d5cb70b5..29967539c20 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -1264,6 +1264,12 @@ static void handle_net_supporting_wm_check_notify( XPropertyEvent *event ) { struct x11drv_thread_data *data = x11drv_thread_data();
+ if (data->window_manager) + { + XFree( data->window_manager ); + data->window_manager = NULL; + } + if (event->state == PropertyNewValue) net_supporting_wm_check_init( data ); }
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index d31f0d87030..b2684f7dfd2 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -3434,6 +3434,18 @@ static Window get_net_supporting_wm_check( Display *display, Window window ) return support; }
+static BOOL get_window_property_str( Display *display, Window window, Atom atom, char **name ) +{ + unsigned long count, remaining; + int format, ret; + Atom type; + + X11DRV_expect_error( display, host_window_error, NULL ); + ret = XGetWindowProperty( display, window, atom, 0, 65536 / sizeof(CARD32), False, x11drv_atom(UTF8_STRING), + &type, &format, &count, &remaining, (unsigned char **)name ); + return !X11DRV_check_error() && !ret; +} + void net_supporting_wm_check_init( struct x11drv_thread_data *data ) { Window window = None, other; @@ -3443,6 +3455,9 @@ void net_supporting_wm_check_init( struct x11drv_thread_data *data ) 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" ); + else if (get_window_property_str( data->display, window, x11drv_atom(_NET_WM_NAME), &data->window_manager ) || + get_window_property_str( data->display, window, x11drv_atom(WM_NAME), &data->window_manager )) + TRACE( "Detected window manager: %s\n", debugstr_a(data->window_manager) ); }
void init_win_context(void) diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 324e9d0f3ae..ed72214bf58 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -397,6 +397,7 @@ struct x11drv_thread_data 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 */ + char *window_manager; /* name of the supporting window manager */ #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H XIValuatorClassInfo x_valuator; XIValuatorClassInfo y_valuator; @@ -477,6 +478,7 @@ enum x11drv_atoms XATOM_RAW_CAP_HEIGHT, XATOM_WM_PROTOCOLS, XATOM_WM_DELETE_WINDOW, + XATOM_WM_NAME, XATOM_WM_STATE, XATOM_WM_TAKE_FOCUS, XATOM_DndProtocol, diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 99d2dbd8c97..a939ed8cd92 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -122,6 +122,7 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] = "RAW_CAP_HEIGHT", "WM_PROTOCOLS", "WM_DELETE_WINDOW", + "WM_NAME", "WM_STATE", "WM_TAKE_FOCUS", "DndProtocol", @@ -691,6 +692,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 ); + if (data->window_manager) XFree( data->window_manager ); XSync( gdi_display, False ); /* make sure XReparentWindow requests have completed before closing the thread display */ XCloseDisplay( data->display ); free( data );