X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fopenbox.c;h=c768bdf431c709ee73b64408f080bf4d20b38554;hb=ebce321a72331697287838b864735e7b81e60b33;hp=6f47fbd0cc5ba6f4d6f9cd202950ae2d50c60c33;hpb=2b8b5da04b14af1639143cc332874c7e1a03a8bb;p=chaz%2Fopenbox diff --git a/openbox/openbox.c b/openbox/openbox.c index 6f47fbd0..c768bdf4 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -43,11 +43,13 @@ #include "grab.h" #include "group.h" #include "config.h" +#include "ping.h" #include "mainloop.h" #include "gettext.h" #include "parser/parse.h" #include "render/render.h" #include "render/theme.h" +#include "obt/obt.h" #ifdef HAVE_FCNTL_H # include @@ -82,18 +84,18 @@ #include #include - -RrInstance *ob_rr_inst; -RrTheme *ob_rr_theme; -ObMainLoop *ob_main_loop; -Display *ob_display; -gint ob_screen; -gboolean ob_replace_wm = FALSE; -gboolean ob_sm_use = TRUE; -gchar *ob_sm_id = NULL; -gchar *ob_sm_save_file = NULL; -gboolean ob_sm_restore = TRUE; -gboolean ob_debug_xinerama = FALSE; +ObtInstance *obt_inst; +RrInstance *ob_rr_inst; +RrTheme *ob_rr_theme; +ObMainLoop *ob_main_loop; +Display *ob_display; +gint ob_screen; +gboolean ob_replace_wm = FALSE; +gboolean ob_sm_use = TRUE; +gchar *ob_sm_id = NULL; +gchar *ob_sm_save_file = NULL; +gboolean ob_sm_restore = TRUE; +gboolean ob_debug_xinerama = FALSE; static ObState state; static gboolean xsync = FALSE; @@ -143,12 +145,10 @@ gint main(gint argc, gchar **argv) session_startup(argc, argv); } - - ob_display = XOpenDisplay(NULL); - if (ob_display == NULL) + obt_inst = obt_instance_new(NULL); + if (obt_inst == NULL) ob_exit_with_error(_("Failed to open the display from the DISPLAY environment variable.")); - if (fcntl(ConnectionNumber(ob_display), F_SETFD, 1) == -1) - ob_exit_with_error("Failed to set display as close-on-exec"); + ob_display = obt_display(obt_inst); if (remote_control) { prop_startup(); @@ -158,7 +158,7 @@ gint main(gint argc, gchar **argv) * remote_control = 2 -> restart */ PROP_MSG(RootWindow(ob_display, ob_screen), ob_control, remote_control, 0, 0, 0); - XCloseDisplay(ob_display); + obt_instance_unref(obt_inst); exit(EXIT_SUCCESS); } @@ -292,15 +292,16 @@ gint main(gint argc, gchar **argv) 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); - window_startup(reconfigure); - sn_startup(reconfigure); screen_startup(reconfigure); grab_startup(reconfigure); group_startup(reconfigure); + ping_startup(reconfigure); client_startup(reconfigure); dock_startup(reconfigure); moveresize_startup(reconfigure); @@ -360,6 +361,7 @@ gint main(gint argc, gchar **argv) moveresize_shutdown(reconfigure); dock_shutdown(reconfigure); client_shutdown(reconfigure); + ping_shutdown(reconfigure); group_shutdown(reconfigure); grab_shutdown(reconfigure); screen_shutdown(reconfigure); @@ -367,8 +369,8 @@ gint main(gint argc, gchar **argv) focus_cycle_indicator_shutdown(reconfigure); focus_cycle_shutdown(reconfigure); focus_shutdown(reconfigure); - sn_shutdown(reconfigure); window_shutdown(reconfigure); + sn_shutdown(reconfigure); event_shutdown(reconfigure); config_shutdown(); actions_shutdown(reconfigure); @@ -383,7 +385,7 @@ gint main(gint argc, gchar **argv) session_shutdown(being_replaced); - XCloseDisplay(ob_display); + obt_instance_unref(obt_inst); parse_paths_shutdown(); @@ -470,9 +472,9 @@ static void print_version() { g_print("Openbox %s\n", PACKAGE_VERSION); g_print(_("Copyright (c)")); - g_print(" 2007 Mikael Magnusson\n"); + g_print(" 2008 Mikael Magnusson\n"); g_print(_("Copyright (c)")); - g_print(" 2003-2007 Dana Jansens\n\n"); + g_print(" 2003-2006 Dana Jansens\n\n"); g_print("This program comes with ABSOLUTELY NO WARRANTY.\n"); g_print("This is free software, and you are welcome to redistribute it\n"); g_print("under certain conditions. See the file COPYING for details.\n\n"); @@ -512,7 +514,9 @@ static void remove_args(gint *argc, gchar **argv, gint index, gint num) static void parse_env() { /* unset this so we don't pass it on unknowingly */ - putenv("DESKTOP_STARTUP_ID"); + gchar *s = g_strdup("DESKTOP_STARTUP_ID"); + putenv(s); + g_free(s); } static void parse_args(gint *argc, gchar **argv)