From 0ab77ec5611c34233cb833e8b1dd706761ae094f Mon Sep 17 00:00:00 2001 From: Eric Koegel Date: Sat, 18 Jan 2014 18:50:38 +0300 Subject: [PATCH] Wait for the settings manager at startup (Bug 10605) If xfdesktop starts loading the icon view before the settings manager has been set to the screen then the icons will appear as if they aren't themed. This patch has xfdesktop wait for the settings manager the same way it already does for the window manager. --- src/xfdesktop-application.c | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/src/xfdesktop-application.c b/src/xfdesktop-application.c index 5756df0..06d638d 100644 --- a/src/xfdesktop-application.c +++ b/src/xfdesktop-application.c @@ -106,7 +106,7 @@ typedef struct XfdesktopApplication *app; Display *dpy; - Atom *atoms; + Atom *wm_atoms, *setting_atoms; guint atom_count; guint have_wm : 1; guint counter; @@ -501,7 +501,8 @@ cb_xfdesktop_application_arrange(GAction *action, static void wait_for_window_manager_cleanup(WaitForWM *wfwm) { - g_free(wfwm->atoms); + g_free(wfwm->wm_atoms); + g_free(wfwm->setting_atoms); XCloseDisplay(wfwm->dpy); g_slice_free(WaitForWM, wfwm); } @@ -522,11 +523,19 @@ cb_wait_for_window_manager(gpointer data) } for(i = 0; i < wfwm->atom_count; i++) { - if(XGetSelectionOwner(wfwm->dpy, wfwm->atoms[i]) == None) { + /* check for the window manager on the screen */ + if(XGetSelectionOwner(wfwm->dpy, wfwm->wm_atoms[i]) == None) { DBG("window manager not ready on screen %d", i); have_wm = FALSE; break; } + + /* check if the settings manager is also present (bug 10605) */ + if(XGetSelectionOwner(wfwm->dpy, wfwm->setting_atoms[i]) == None) { + DBG("settings manager (such as xfsettingsd) not ready on screen %d", i); + have_wm = FALSE; + break; + } } wfwm->have_wm = have_wm; @@ -573,7 +582,7 @@ xfdesktop_application_startup(GApplication *g_application) XfdesktopApplication *app = XFDESKTOP_APPLICATION(g_application); WaitForWM *wfwm; guint i; - gchar **atom_names; + gchar **wm_atom_names, **setting_atom_names; TRACE("entering"); @@ -590,16 +599,24 @@ xfdesktop_application_startup(GApplication *g_application) /* preload wm atoms for all screens */ wfwm->atom_count = XScreenCount(wfwm->dpy); - wfwm->atoms = g_new(Atom, wfwm->atom_count); - atom_names = g_new0(gchar *, wfwm->atom_count + 1); + wfwm->wm_atoms = g_new(Atom, wfwm->atom_count); + wfwm->setting_atoms = g_new(Atom, wfwm->atom_count); + wm_atom_names = g_new0(gchar *, wfwm->atom_count + 1); + setting_atom_names = g_new0(gchar *, wfwm->atom_count + 1); + + for(i = 0; i < wfwm->atom_count; i++) { + wm_atom_names[i] = g_strdup_printf ("WM_S%d", i); + setting_atom_names[i] = g_strdup_printf ("_XSETTINGS_S%d", i); + } - for(i = 0; i < wfwm->atom_count; i++) - atom_names[i] = g_strdup_printf ("WM_S%d", i); + if(!XInternAtoms(wfwm->dpy, wm_atom_names, wfwm->atom_count, False, wfwm->wm_atoms)) + wfwm->atom_count = 0; - if(!XInternAtoms(wfwm->dpy, atom_names, wfwm->atom_count, False, wfwm->atoms)) + if(!XInternAtoms(wfwm->dpy, setting_atom_names, wfwm->atom_count, False, wfwm->setting_atoms)) wfwm->atom_count = 0; - g_strfreev(atom_names); + g_strfreev(wm_atom_names); + g_strfreev(setting_atom_names); /* setup timeout to check for a window manager */ app->wait_for_wm_timeout_id = g_timeout_add_full(G_PRIORITY_DEFAULT_IDLE, -- 1.8.3.2