- if (screen_annex()) { /* it will be ours! */
- /* 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();
- moveresize_startup();
- focus_startup();
- screen_startup();
- group_startup();
- client_startup();
- slit_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;
-
- slit_remove_all();
- client_unmanage_all();
-
- plugin_shutdown(); /* calls all the plugins' shutdown functions */
- slit_shutdown();
- client_shutdown();
- group_shutdown();
- screen_shutdown();
- focus_shutdown();
- moveresize_shutdown();
- frame_shutdown();
- menu_shutdown();
- grab_shutdown();
- event_shutdown();
- theme_shutdown();
- render_shutdown();
- timer_shutdown();
- config_shutdown();
+ /* 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 */
+ sn_startup(reconfigure);
+ window_startup(reconfigure);
+ focus_startup(reconfigure);
+ focus_cycle_startup(reconfigure);
+ focus_cycle_indicator_startup(reconfigure);
+ focus_cycle_popup_startup(reconfigure);
+ screen_startup(reconfigure);
+ grab_startup(reconfigure);
+ group_startup(reconfigure);
+ ping_startup(reconfigure);
+ client_startup(reconfigure);
+ dock_startup(reconfigure);
+ moveresize_startup(reconfigure);
+ keyboard_startup(reconfigure);
+ mouse_startup(reconfigure);
+ menu_frame_startup(reconfigure);
+ menu_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 (OBT_PROP_GET32(RootWindow(obt_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));
+ }
+ } else {
+ GList *it;
+
+ /* redecorate all existing windows */
+ for (it = client_list; it; it = g_list_next(it)) {
+ ObClient *c = it->data;
+
+ /* the new config can change the window's decorations */
+ client_setup_decor_and_functions(c, FALSE);
+ /* redraw the frames */
+ frame_adjust_area(c->frame, TRUE, TRUE, FALSE);
+ /* the decor sizes may have changed, so the windows may
+ end up in new positions */
+ client_reconfigure(c, FALSE);
+ }
+ }
+
+ reconfigure = FALSE;
+
+ state = OB_STATE_RUNNING;
+ obt_main_loop_run(ob_main_loop);
+ state = OB_STATE_EXITING;
+
+ if (!reconfigure) {
+ dock_remove_all();
+ client_unmanage_all();
+ }
+
+ menu_shutdown(reconfigure);
+ menu_frame_shutdown(reconfigure);
+ mouse_shutdown(reconfigure);
+ keyboard_shutdown(reconfigure);
+ moveresize_shutdown(reconfigure);
+ dock_shutdown(reconfigure);
+ client_shutdown(reconfigure);
+ ping_shutdown(reconfigure);
+ group_shutdown(reconfigure);
+ grab_shutdown(reconfigure);
+ screen_shutdown(reconfigure);
+ focus_cycle_popup_shutdown(reconfigure);
+ focus_cycle_indicator_shutdown(reconfigure);
+ focus_cycle_shutdown(reconfigure);
+ focus_shutdown(reconfigure);
+ window_shutdown(reconfigure);
+ sn_shutdown(reconfigure);
+ event_shutdown(reconfigure);
+ config_shutdown();
+ actions_shutdown(reconfigure);
+ modkeys_shutdown(reconfigure);
+ } while (reconfigure);