mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-01 08:55:59 +01:00
Catch SIGTERM on UNIX targets
This commit is contained in:
parent
fb088e1fe0
commit
8409fb2a2d
2 changed files with 31 additions and 0 deletions
28
zathura.c
28
zathura.c
|
@ -17,6 +17,10 @@
|
||||||
#include <glib/gstdio.h>
|
#include <glib/gstdio.h>
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
|
|
||||||
|
#ifdef G_OS_UNIX
|
||||||
|
#include <glib-unix.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "bookmarks.h"
|
#include "bookmarks.h"
|
||||||
#include "callbacks.h"
|
#include "callbacks.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -50,6 +54,10 @@ static void zathura_jumplist_reset_current(zathura_t* zathura);
|
||||||
static void zathura_jumplist_append_jump(zathura_t* zathura);
|
static void zathura_jumplist_append_jump(zathura_t* zathura);
|
||||||
static void zathura_jumplist_save(zathura_t* zathura);
|
static void zathura_jumplist_save(zathura_t* zathura);
|
||||||
|
|
||||||
|
#ifdef G_OS_UNIX
|
||||||
|
static gboolean zathura_signal_sigterm(gpointer data);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* function implementation */
|
/* function implementation */
|
||||||
zathura_t*
|
zathura_t*
|
||||||
zathura_create(void)
|
zathura_create(void)
|
||||||
|
@ -73,6 +81,11 @@ zathura_create(void)
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef G_OS_UNIX
|
||||||
|
/* signal handler */
|
||||||
|
zathura->signals.sigterm = g_unix_signal_add(SIGTERM, zathura_signal_sigterm, zathura);
|
||||||
|
#endif
|
||||||
|
|
||||||
zathura->ui.session->global.data = zathura;
|
zathura->ui.session->global.data = zathura;
|
||||||
|
|
||||||
return zathura;
|
return zathura;
|
||||||
|
@ -1384,3 +1397,18 @@ zathura_jumplist_save(zathura_t* zathura)
|
||||||
cur->y = zathura_document_get_position_y(zathura->document);
|
cur->y = zathura_document_get_position_y(zathura->document);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef G_OS_UNIX
|
||||||
|
static gboolean
|
||||||
|
zathura_signal_sigterm(gpointer data)
|
||||||
|
{
|
||||||
|
if (data == NULL) {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
zathura_t* zathura = (zathura_t*) data;
|
||||||
|
cb_destroy(NULL, zathura);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -174,6 +174,9 @@ struct zathura_s
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
guint refresh_view;
|
guint refresh_view;
|
||||||
|
#ifdef G_OS_UNIX
|
||||||
|
guint sigterm;
|
||||||
|
#endif
|
||||||
} signals;
|
} signals;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
|
|
Loading…
Reference in a new issue