-#define SM_ERR_LEN 1024
-
- SmcCallbacks cb;
- char sm_err[SM_ERR_LEN];
-
- cb.save_yourself.callback = sm_save_yourself;
- cb.save_yourself.client_data = NULL;
-
- cb.die.callback = sm_die;
- cb.die.client_data = NULL;
-
- cb.save_complete.callback = sm_save_complete;
- cb.save_complete.client_data = NULL;
-
- cb.shutdown_cancelled.callback = sm_shutdown_cancelled;
- cb.shutdown_cancelled.client_data = NULL;
-
- ob_sm_conn = SmcOpenConnection(NULL, NULL, 1, 0,
- SmcSaveYourselfProcMask |
- SmcDieProcMask |
- SmcSaveCompleteProcMask |
- SmcShutdownCancelledProcMask,
- &cb, ob_sm_id, &ob_sm_id,
- SM_ERR_LEN, sm_err);
- if (ob_sm_conn == NULL)
- g_warning("Failed to connect to session manager: %s", sm_err);
- else {
- SmPropValue val_prog;
- SmPropValue val_uid;
- SmPropValue val_hint;
- SmPropValue val_pri;
- SmPropValue val_pid;
- SmProp prop_cmd = { SmCloneCommand, SmLISTofARRAY8, 1, };
- SmProp prop_res = { SmRestartCommand, SmLISTofARRAY8, };
- SmProp prop_prog = { SmProgram, SmARRAY8, 1, };
- SmProp prop_uid = { SmUserID, SmARRAY8, 1, };
- SmProp prop_hint = { SmRestartStyleHint, SmCARD8, 1, };
- SmProp prop_pid = { SmProcessID, SmARRAY8, 1, };
- SmProp prop_pri = { "_GSM_Priority", SmCARD8, 1, };
- SmProp *props[7];
- gulong hint, pri;
- gchar pid[32];
- gint i;
- gboolean has_id;
-
- for (i = 1; i < argc - 1; ++i)
- if (strcmp(argv[i], "-sm-client-id") == 0)
- break;
- has_id = (i < argc - 1);
-
- prop_cmd.vals = g_new(SmPropValue, (has_id ? argc-2 : argc));
- prop_cmd.num_vals = (has_id ? argc-2 : argc);
- for (i = 0; i < argc; ++i) {
- if (strcmp (argv[i], "-sm-client-id") == 0) {
- ++i; /* skip the next as well */
+ /* update all existing windows for the new theme */
+ for (it = client_list; it; it = g_list_next(it)) {
+ ObClient *c = it->data;
+ frame_adjust_theme(c->frame);
+ }
+ }
+ event_startup(reconfigure);
+ /* focus_backup is used for stacking, so this needs to come before
+ anything that calls stacking_add */
+ focus_startup(reconfigure);
+ window_startup(reconfigure);
+ sn_startup(reconfigure);
+ screen_startup(reconfigure);
+ grab_startup(reconfigure);
+ group_startup(reconfigure);
+ client_startup(reconfigure);
+ dock_startup(reconfigure);
+ moveresize_startup(reconfigure);
+ keyboard_startup(reconfigure);
+ mouse_startup(reconfigure);
+ menu_startup(reconfigure);
+ menu_frame_startup(reconfigure);
+
+ if (!reconfigure) {
+ guint32 xid;
+ ObWindow *w;
+
+ /* get all the existing windows */
+ client_manage_all();
+ focus_nothing();
+
+ /* focus what was focused if a wm was already running */
+ if (PROP_GET32(RootWindow(ob_display, ob_screen),
+ net_active_window, window, &xid) &&
+ (w = g_hash_table_lookup(window_map, &xid)) &&
+ WINDOW_IS_CLIENT(w))
+ {
+ client_focus(WINDOW_AS_CLIENT(w));
+ }