X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fopenbox.c;h=c768bdf431c709ee73b64408f080bf4d20b38554;hb=ebce321a72331697287838b864735e7b81e60b33;hp=48f31f9140f5c2b3ab0749100f302e2ed5421fc9;hpb=98dda05c4ae1372391a26fca4c5a8b0551bbb4f9;p=chaz%2Fopenbox diff --git a/openbox/openbox.c b/openbox/openbox.c index 48f31f91..c768bdf4 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -49,6 +49,7 @@ #include "parser/parse.h" #include "render/render.h" #include "render/theme.h" +#include "obt/obt.h" #ifdef HAVE_FCNTL_H # include @@ -83,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; @@ -144,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(); @@ -159,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); } @@ -386,7 +385,7 @@ gint main(gint argc, gchar **argv) session_shutdown(being_replaced); - XCloseDisplay(ob_display); + obt_instance_unref(obt_inst); parse_paths_shutdown();