X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fstartupnotify.c;h=24f2a85cc44094caee4eecf16a39aa76452134be;hb=452627a51ce38229533dfe5d8eeb877b0918d02c;hp=3383dd5f16203c389cef89d3a8b2237989cafd63;hpb=6377d2ee581c6fbc6a29f7e3c94de8a7324b9e7e;p=chaz%2Fopenbox diff --git a/openbox/startupnotify.c b/openbox/startupnotify.c index 3383dd5f..24f2a85c 100644 --- a/openbox/startupnotify.c +++ b/openbox/startupnotify.c @@ -40,7 +40,6 @@ void sn_spawn_cancel() {} #else #include "openbox.h" -#include "mainloop.h" #include "screen.h" #define SN_API_NOT_YET_FROZEN @@ -58,17 +57,21 @@ static void sn_event_func(SnMonitorEvent *event, gpointer data); void sn_startup(gboolean reconfig) { + gchar *s; + if (reconfig) return; /* unset this so we don't pass it on unknowingly */ - unsetenv("DESKTOP_STARTUP_ID"); + s = g_strdup("DESKTOP_STARTUP_ID"); + putenv(s); + g_free(s); sn_display = sn_display_new(ob_display, NULL, NULL); sn_context = sn_monitor_context_new(sn_display, ob_screen, sn_event_func, NULL, NULL); sn_launcher = sn_launcher_context_new(sn_display, ob_screen); - ob_main_loop_x_add(ob_main_loop, sn_handler, NULL, NULL); + obt_main_loop_x_add(ob_main_loop, sn_handler, NULL, NULL); } void sn_shutdown(gboolean reconfig) @@ -77,7 +80,7 @@ void sn_shutdown(gboolean reconfig) if (reconfig) return; - ob_main_loop_x_remove(ob_main_loop, sn_handler); + obt_main_loop_x_remove(ob_main_loop, sn_handler); for (it = sn_waits; it; it = g_slist_next(it)) sn_startup_sequence_unref((SnStartupSequence*)it->data); @@ -106,7 +109,7 @@ static SnStartupSequence* sequence_find(const gchar *id) return ret; } -gboolean sn_app_starting() +gboolean sn_app_starting(void) { return sn_waits != NULL; } @@ -140,10 +143,10 @@ static void sn_event_func(SnMonitorEvent *ev, gpointer data) sn_waits = g_slist_prepend(sn_waits, seq); /* 20 second timeout for apps to start if the launcher doesn't have a timeout */ - ob_main_loop_timeout_add(ob_main_loop, 20 * G_USEC_PER_SEC, - sn_wait_timeout, seq, - g_direct_equal, - (GDestroyNotify)sn_startup_sequence_unref); + obt_main_loop_timeout_add(ob_main_loop, 20 * G_USEC_PER_SEC, + sn_wait_timeout, seq, + g_direct_equal, + (GDestroyNotify)sn_startup_sequence_unref); change = TRUE; break; case SN_MONITOR_EVENT_CHANGED: @@ -154,8 +157,8 @@ static void sn_event_func(SnMonitorEvent *ev, gpointer data) case SN_MONITOR_EVENT_CANCELED: if ((seq = sequence_find(sn_startup_sequence_get_id(seq)))) { sn_waits = g_slist_remove(sn_waits, seq); - ob_main_loop_timeout_remove_data(ob_main_loop, sn_wait_timeout, - seq, FALSE); + obt_main_loop_timeout_remove_data(ob_main_loop, sn_wait_timeout, + seq, FALSE); change = TRUE; } break; @@ -243,7 +246,8 @@ void sn_setup_spawn_environment(gchar *program, gchar *name, sn_launcher_context_set_name(sn_launcher, name ? name : program); sn_launcher_context_set_description(sn_launcher, desc); - sn_launcher_context_set_icon_name(sn_launcher, icon_name ? icon_name : program); + sn_launcher_context_set_icon_name(sn_launcher, icon_name ? + icon_name : program); sn_launcher_context_set_binary_name(sn_launcher, program); if (desktop >= 0 && (unsigned) desktop < screen_num_desktops) sn_launcher_context_set_workspace(sn_launcher, (signed) desktop); @@ -253,17 +257,17 @@ void sn_setup_spawn_environment(gchar *program, gchar *name, /* 20 second timeout for apps to start */ sn_launcher_context_ref(sn_launcher); - ob_main_loop_timeout_add(ob_main_loop, 20 * G_USEC_PER_SEC, - sn_launch_wait_timeout, sn_launcher, - g_direct_equal, - (GDestroyNotify)sn_launcher_context_unref); + obt_main_loop_timeout_add(ob_main_loop, 20 * G_USEC_PER_SEC, + sn_launch_wait_timeout, sn_launcher, + g_direct_equal, + (GDestroyNotify)sn_launcher_context_unref); - setenv("DESKTOP_STARTUP_ID", id, TRUE); + putenv(g_strdup_printf("DESKTOP_STARTUP_ID=%s", id)); g_free(desc); } -void sn_spawn_cancel() +void sn_spawn_cancel(void) { sn_launcher_context_complete(sn_launcher); }