- /* startup the parsing so everything can register sections of the rc */
- parse_startup();
-
- /* anything that is going to read data from the rc file needs to be
- in this group */
- timer_startup();
- render_startup();
- font_startup();
- theme_startup();
- event_startup();
- grab_startup();
- plugin_startup();
- /* load the plugins specified in the pluginrc */
- plugin_loadall();
-
- /* set up the kernel config shit */
- config_startup();
- /* parse/load user options */
- parse_rc();
- /* we're done with parsing now, kill it */
- parse_shutdown();
-
- /* load the theme specified in the rc file */
- theme = theme_load(config_theme);
- g_free(theme);
- if (!theme) return 1;
-
- menu_startup();
- frame_startup();
- stacking_startup();
- focus_startup();
- screen_startup();
- group_startup();
- client_startup();
-
- /* call startup for all the plugins */
- plugin_startall();
-
- /* get all the existing windows */
- client_manage_all();
-
- ob_state = State_Running;
- while (!ob_shutdown)
- event_loop();
- ob_state = State_Exiting;
-
- client_unmanage_all();
-
- plugin_shutdown(); /* calls all the plugins' shutdown functions */
- client_shutdown();
- group_shutdown();
- screen_shutdown();
- focus_shutdown();
- stacking_shutdown();
- frame_shutdown();
- menu_shutdown();
- grab_shutdown();
- event_shutdown();
- theme_shutdown();
- render_shutdown();
- timer_shutdown();
- config_shutdown();
+ do {
+ {
+ ObParseInst *i;
+ xmlDocPtr doc;
+ xmlNodePtr node;
+
+ /* startup the parsing so everything can register sections
+ of the rc */
+ i = parse_startup();
+
+ config_startup(i);
+ /* parse/load user options */
+ if (parse_load_rc(&doc, &node))
+ parse_tree(i, doc, node->xmlChildrenNode);
+ /* we're done with parsing now, kill it */
+ parse_close(doc);
+ parse_shutdown(i);
+ }
+
+ /* load the theme specified in the rc file */
+ {
+ RrTheme *theme;
+ if ((theme = RrThemeNew(ob_rr_inst, config_theme))) {
+ RrThemeFree(ob_rr_theme);
+ ob_rr_theme = theme;
+ }
+ if (ob_rr_theme == NULL)
+ ob_exit_with_error("Unable to load a theme.");
+ }
+
+ if (reconfigure) {
+ GList *it;
+
+ /* 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);
+
+ if (!reconfigure) {
+ /* get all the existing windows */
+ client_manage_all();
+ focus_fallback(OB_FOCUS_FALLBACK_NOFOCUS);
+ } else {
+ GList *it;
+
+ /* redecorate all existing windows */
+ for (it = client_list; it; it = g_list_next(it)) {
+ ObClient *c = it->data;
+ frame_adjust_area(c->frame, TRUE, TRUE, FALSE);
+ }
+ }
+
+ reconfigure = FALSE;
+
+ state = OB_STATE_RUNNING;
+ ob_main_loop_run(ob_main_loop);
+ state = OB_STATE_EXITING;
+
+ if (!reconfigure) {
+ dock_remove_all();
+ client_unmanage_all();
+ }
+
+ menu_shutdown(reconfigure);
+ mouse_shutdown(reconfigure);
+ keyboard_shutdown(reconfigure);
+ moveresize_shutdown(reconfigure);
+ dock_shutdown(reconfigure);
+ client_shutdown(reconfigure);
+ group_shutdown(reconfigure);
+ grab_shutdown(reconfigure);
+ screen_shutdown(reconfigure);
+ focus_shutdown(reconfigure);
+ sn_shutdown(reconfigure);
+ window_shutdown(reconfigure);
+ event_shutdown(reconfigure);
+ config_shutdown();
+ } while (reconfigure);