diff --git a/src/main.c b/src/main.c index af11691..6072b83 100644 --- a/src/main.c +++ b/src/main.c @@ -49,6 +49,7 @@ #endif #include +#include #include #include @@ -221,6 +222,16 @@ xfdesktop_handle_quit_signals(gint sig, int main(int argc, char **argv) { + /******************************************************************/ + + Display *_dpy; + Atom *_atoms; + gchar **_atom_names; + guint _atom_count; + guint _i, _c; + + /******************************************************************/ + GOptionContext *octx; GdkDisplay *gdpy; GtkWidget **desktops; @@ -328,6 +339,36 @@ main(int argc, char **argv) g_print("%s[%d]: starting up\n", PACKAGE, getpid()); + /******************************************************************/ + + _dpy = XOpenDisplay (NULL); + _atom_count = XScreenCount (_dpy); + _atoms = g_new (Atom, _atom_count); + _atom_names = g_new0 (gchar *, _atom_count + 1); + + for (_i = 0; _i < _atom_count; _i++) + _atom_names[_i] = g_strdup_printf ("WM_S%d", _i); + + if (!XInternAtoms (_dpy, _atom_names, _atom_count, False, _atoms)) + _atom_count = 0; + + for (_c = 0; _c < 3; _c++) + { + for (_i = 0; _i < _atom_count; _i++) + { + if (XGetSelectionOwner (_dpy, _atoms[_i]) == None) + g_print("%s[%d]: [round %d] window manager NOT ready on screen %d\n", PACKAGE, getpid(), _c, _i); + else + g_print("%s[%d]: [round %d] window manager ready on screen %d\n", PACKAGE, getpid(), _c, _i); + } + sleep (1); + } + + g_strfreev (_atom_names); + g_free (_atoms); + + /******************************************************************/ + sm_client = xfce_sm_client_get(); xfce_sm_client_set_restart_style(sm_client, XFCE_SM_CLIENT_RESTART_IMMEDIATELY); xfce_sm_client_set_priority(sm_client, XFCE_SM_CLIENT_PRIORITY_DESKTOP);