--- src/evolution-indicator.c.orig 2019-11-02 14:16:59.793068602 +0100 +++ src/evolution-indicator.c 2019-11-02 13:40:57.716515338 +0100 @@ -116,45 +116,54 @@ evolution_is_focused (void) { #define MAIL_ICON "evolution-mail" + EShell *evo_shell; + EShellWindow *shell_window; +#ifdef GDK_WINDOWING_X11 + static GdkDisplay *display = NULL; static GdkScreen *screen = NULL; static GdkWindow *root = NULL; gboolean res = FALSE; Window xwindow; - EShell *evo_shell; - EShellWindow *shell_window; /* Try and do a match through X, by grabbing the current active window and checking to see if it's an evolution window */ - if (screen == NULL || root == NULL) + if (display == NULL || screen == NULL || root == NULL) { + display = gdk_display_get_default (); screen = gdk_screen_get_default (); root = gdk_screen_get_root_window (screen); } xwindow = None; + + if (GDK_IS_X11_DISPLAY(display)) { #if GTK_CHECK_VERSION(2, 91, 0) - res = _wnck_get_window (GDK_WINDOW_XID (root), + res = _wnck_get_window (GDK_WINDOW_XID (root), + gdk_x11_get_xatom_by_name ("_NET_ACTIVE_WINDOW"), + &xwindow); #else - res = _wnck_get_window (GDK_WINDOW_XWINDOW (root), + res = _wnck_get_window (GDK_WINDOW_XWINDOW (root), + gdk_x11_get_xatom_by_name ("_NET_ACTIVE_WINDOW"), + &xwindow); #endif - gdk_x11_get_xatom_by_name ("_NET_ACTIVE_WINDOW"), - &xwindow); - if (res) - { - gchar *res_class = NULL; - gchar *res_name = NULL; + if (res) + { + gchar *res_class = NULL; + gchar *res_name = NULL; - _wnck_get_wmclass (xwindow, &res_class, &res_name); + _wnck_get_wmclass (xwindow, &res_class, &res_name); - if (!g_strcmp0 (res_name, "evolution")) - { + if (!g_strcmp0 (res_name, "evolution")) + { + g_free (res_class); + g_free (res_name); + return TRUE; + } g_free (res_class); g_free (res_name); - return TRUE; } - g_free (res_class); - g_free (res_name); } +#endif evo_shell = e_shell_get_default ();