X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fstartupnotify.c;h=1e5c45a8dc4a21860a84de93686b72e90d399936;hb=9d6e3907650f4bc05ebf147aeec92573d7b88758;hp=6d1ba5ad623298166e00ce8f27bb294cdb148e9c;hpb=2cd1644e1040684d5f646541f65a36b01b011db2;p=chaz%2Fopenbox diff --git a/openbox/startupnotify.c b/openbox/startupnotify.c index 6d1ba5ad..1e5c45a8 100644 --- a/openbox/startupnotify.c +++ b/openbox/startupnotify.c @@ -1,3 +1,22 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + startupnotify.c for the Openbox window manager + Copyright (c) 2006 Mikael Magnusson + Copyright (c) 2003 Ben Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + #include "startupnotify.h" #ifndef USE_LIBSN @@ -5,7 +24,11 @@ void sn_startup(gboolean reconfig) {} void sn_shutdown(gboolean reconfig) {} gboolean sn_app_starting() { return FALSE; } -void sn_app_started(gchar *wmclass, guint *desktop) {} +Time sn_app_started(const gchar *id, const gchar *wmclass) +{ + return CurrentTime; +} +gboolean sn_get_desktop(gchar *id, guint *desktop) { return FALSE; } #else @@ -49,6 +72,8 @@ void sn_shutdown(gboolean reconfig) if (reconfig) return; + ob_main_loop_x_remove(ob_main_loop, sn_handler); + for (it = sn_waits; it; it = g_slist_next(it)) wait_data_free(it->data); g_slist_free(sn_waits); @@ -140,11 +165,10 @@ static void sn_event_func(SnMonitorEvent *ev, gpointer data) switch (sn_monitor_event_get_type(ev)) { case SN_MONITOR_EVENT_INITIATED: - g_message("starting"); d = wait_data_new(seq); sn_waits = g_slist_prepend(sn_waits, d); - /* 30 second timeout for apps to start */ - ob_main_loop_timeout_add(ob_main_loop, 30 * G_USEC_PER_SEC, + /* 15 second timeout for apps to start */ + ob_main_loop_timeout_add(ob_main_loop, 15 * G_USEC_PER_SEC, sn_wait_timeout, d, sn_wait_destroy); change = TRUE; break; @@ -156,7 +180,8 @@ static void sn_event_func(SnMonitorEvent *ev, gpointer data) case SN_MONITOR_EVENT_CANCELED: if ((d = wait_find(sn_startup_sequence_get_id(seq)))) { d->feedback = FALSE; - ob_main_loop_timeout_remove_data(ob_main_loop, sn_wait_timeout, d); + ob_main_loop_timeout_remove_data(ob_main_loop, sn_wait_timeout, + d, FALSE); change = TRUE; } break; @@ -166,19 +191,25 @@ static void sn_event_func(SnMonitorEvent *ev, gpointer data) screen_set_root_cursor(); } -void sn_app_started(gchar *wmclass) +Time sn_app_started(const gchar *id, const gchar *wmclass) { GSList *it; + Time t = CurrentTime; for (it = sn_waits; it; it = g_slist_next(it)) { ObWaitData *d = it->data; - if (sn_startup_sequence_get_wmclass(d->seq) && - !strcmp(sn_startup_sequence_get_wmclass(d->seq), wmclass)) + const gchar *seqid, *seqclass; + seqid = sn_startup_sequence_get_id(d->seq); + seqclass = sn_startup_sequence_get_wmclass(d->seq); + if ((seqid && id && !strcmp(seqid, id)) || + (seqclass && wmclass && !strcmp(seqclass, wmclass))) { sn_startup_sequence_complete(d->seq); + t = sn_startup_sequence_get_timestamp(d->seq); break; } } + return t; } gboolean sn_get_desktop(gchar *id, guint *desktop)