X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fopenbox.c;h=800e6a210d3141a2fffd4eba1dc7b9816a167a0f;hb=50d662681160c309ea86268c0d05794b87b75593;hp=bc8fa3bcbd5249a4ea0a893a29a8b04ad38dd6f2;hpb=41a1f89613b72dd0006441a21213d4eb7ffa1cb7;p=chaz%2Fopenbox diff --git a/openbox/openbox.c b/openbox/openbox.c index bc8fa3bc..800e6a21 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -42,7 +42,6 @@ #include "config.h" #include "ping.h" #include "prompt.h" -#include "hooks.h" #include "gettext.h" #include "render/render.h" #include "render/theme.h" @@ -102,7 +101,7 @@ static gboolean reconfigure = FALSE; static gboolean restart = FALSE; static gchar *restart_path = NULL; static Cursor cursors[OB_NUM_CURSORS]; -static KeyCode keys[OB_NUM_KEYS]; +static KeyCode *keys[OB_NUM_KEYS]; static gint exitcode = 0; static guint remote_control = 0; static gboolean being_replaced = FALSE; @@ -235,7 +234,6 @@ gint main(gint argc, gchar **argv) /* register all the available actions */ actions_startup(reconfigure); - hooks_startup(reconfigure); /* start up config which sets up with the parser */ config_startup(i); @@ -401,8 +399,17 @@ gint main(gint argc, gchar **argv) sn_shutdown(reconfigure); event_shutdown(reconfigure); config_shutdown(); - hooks_shutdown(reconfigure); actions_shutdown(reconfigure); + + /* Free the key codes for built in keys */ + g_free(keys[OB_KEY_RETURN]); + g_free(keys[OB_KEY_ESCAPE]); + g_free(keys[OB_KEY_LEFT]); + g_free(keys[OB_KEY_RIGHT]); + g_free(keys[OB_KEY_UP]); + g_free(keys[OB_KEY_DOWN]); + g_free(keys[OB_KEY_TAB]); + g_free(keys[OB_KEY_SPACE]); } while (reconfigure); } @@ -417,6 +424,7 @@ gint main(gint argc, gchar **argv) obt_display_close(); if (restart) { + ob_debug_shutdown(); if (restart_path != NULL) { gint argcp; gchar **argvp; @@ -470,7 +478,8 @@ gint main(gint argc, gchar **argv) g_free(ob_sm_id); g_free(program_name); - ob_debug_shutdown(); + if (!restart) + ob_debug_shutdown(); return exitcode; } @@ -529,7 +538,7 @@ static void print_help(void) g_print(_(" --sync Run in synchronous mode\n")); g_print(_(" --debug Display debugging output\n")); g_print(_(" --debug-focus Display debugging output for focus handling\n")); - g_print(_(" --debug-session Display debugging output for session managment\n")); + g_print(_(" --debug-session Display debugging output for session management\n")); g_print(_(" --debug-xinerama Split the display into fake xinerama screens\n")); g_print(_("\nPlease report bugs at %s\n"), PACKAGE_BUGREPORT); } @@ -547,8 +556,21 @@ static void remove_args(gint *argc, gchar **argv, gint index, gint num) static void parse_env(void) { + const gchar *id; + /* unset this so we don't pass it on unknowingly */ unsetenv("DESKTOP_STARTUP_ID"); + + /* this is how gnome-session passes in a session client id */ + id = g_getenv("DESKTOP_AUTOSTART_ID"); + if (id) { + unsetenv("DESKTOP_AUTOSTART_ID"); + if (ob_sm_id) g_free(ob_sm_id); + ob_sm_id = g_strdup(id); + ob_debug_type(OB_DEBUG_SM, + "DESKTOP_AUTOSTART_ID %s supercedes --sm-client-id\n", + ob_sm_id); + } } static void parse_args(gint *argc, gchar **argv) @@ -605,7 +627,7 @@ static void parse_args(gint *argc, gchar **argv) what we want */ config_file = argv[i+1]; ++i; /* skip the argument */ - ob_debug("--config-file %s\n", config_file); + ob_debug("--config-file %s", config_file); } } else if (!strcmp(argv[i], "--sm-save-file")) { @@ -662,7 +684,7 @@ static Cursor load_cursor(const gchar *name, guint fontval) void ob_exit_with_error(const gchar *msg) { - g_message(msg); + g_message("%s", msg); session_shutdown(TRUE); exit(EXIT_FAILURE); } @@ -704,10 +726,14 @@ Cursor ob_cursor(ObCursor cursor) return cursors[cursor]; } -KeyCode ob_keycode(ObKey key) +gboolean ob_keycode_match(KeyCode code, ObKey key) { + KeyCode *k; + g_assert(key < OB_NUM_KEYS); - return keys[key]; + for (k = keys[key]; *k; ++k) + if (*k == code) return TRUE; + return FALSE; } ObState ob_state(void)