Use xcb_ewmh_get_supporting_wm to get window to get wm name on

This commit is contained in:
Dave Davenport 2017-02-11 19:51:02 +01:00
parent a579c86c1f
commit 97be4e9c72

View file

@ -926,11 +926,17 @@ void x11_disable_decoration ( xcb_window_t window )
void x11_helper_discover_window_manager ( void )
{
xcb_window_t wm_win = 0;
xcb_get_property_cookie_t cc = xcb_ewmh_get_supporting_wm_check_unchecked ( &xcb->ewmh,
xcb_stuff_get_root_window ( xcb ) );
if ( xcb_ewmh_get_supporting_wm_check_reply ( &xcb->ewmh, cc, &wm_win, NULL ) ) {
xcb_ewmh_get_utf8_strings_reply_t wtitle;
xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_name_unchecked(&(xcb->ewmh), xcb_stuff_get_root_window ( xcb ) );
xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_name_unchecked(&(xcb->ewmh), wm_win );
if ( xcb_ewmh_get_wm_name_reply(&(xcb->ewmh), cookie, &wtitle, (void *)0))
{
if ( wtitle.strings_len > 0 ){
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Found window manager: %s", wtitle.strings );
if ( g_strcmp0(wtitle.strings, "i3") == 0 ){
current_window_manager = WM_I3;
} else if ( g_strcmp0 ( wtitle.strings, "awesome" ) == 0 ){
@ -939,4 +945,5 @@ void x11_helper_discover_window_manager ( void )
}
xcb_ewmh_get_utf8_strings_reply_wipe(&wtitle);
}
}
}