new functions add sigterm_handler in case we receive a SIGTERM. Closes

2008-10-22  Joe Marcus Clarke  <marcus@freebsd.org>

        * src/core/main.c (meta_finalize, sigterm_handler): new functions
        * src/core/main.c (main): add sigterm_handler in case we receive
          a SIGTERM.  Closes #553980.


svn path=/trunk/; revision=3974
This commit is contained in:
Joe Marcus Clarke 2008-10-22 03:35:48 +00:00 committed by Thomas James Alexander Thurman
parent b7ee7bdd9b
commit 1866268c94
2 changed files with 31 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2008-10-22 Joe Marcus Clarke <marcus@freebsd.org>
* src/core/main.c (meta_finalize, sigterm_handler): new functions
* src/core/main.c (main): add sigterm_handler in case we receive
a SIGTERM. Closes #553980.
2008-10-22 Matthew Martin <mtt.martin@gmail.com>
* src/core/window.c (meta_window_set_demands_attention): minimised

View File

@ -323,8 +323,8 @@ meta_parse_options (int *argc, char ***argv,
* try to use the environment variable METACITY_DISPLAY. If that
* also is NULL, use the default - :0.0
*/
static
void meta_select_display (gchar *display_name)
static void
meta_select_display (gchar *display_name)
{
gchar *envVar = "";
if (display_name)
@ -336,6 +336,23 @@ void meta_select_display (gchar *display_name)
putenv (envVar);
}
static void
meta_finalize (void)
{
meta_display_close (meta_get_display (),
CurrentTime); /* I doubt correct timestamps matter here */
meta_session_shutdown ();
}
static void
sigterm_handler (int signum)
{
meta_finalize ();
exit (meta_exit_code);
}
/**
* This is where the story begins. It parses commandline options and
* environment variables, sets up the screen, hands control off to
@ -375,6 +392,11 @@ main (int argc, char **argv)
g_strerror (errno));
#endif
act.sa_handler = &sigterm_handler;
if (sigaction (SIGTERM, &act, NULL) < 0)
g_printerr ("Failed to register SIGTERM handler: %s\n",
g_strerror (errno));
if (g_getenv ("METACITY_VERBOSE"))
meta_set_verbose (TRUE);
if (g_getenv ("METACITY_DEBUG"))
@ -504,10 +526,7 @@ main (int argc, char **argv)
g_main_loop_run (meta_main_loop);
meta_display_close (meta_get_display (),
CurrentTime); /* I doubt correct timestamps matter here */
meta_session_shutdown ();
meta_finalize ();
if (meta_restart_after_quit)
{