summaryrefslogtreecommitdiff
path: root/obt/signal.h
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2010-06-27 12:02:44 -0400
committerMikael Magnusson <mikachu@gmail.com>2010-09-16 17:24:11 +0200
commit1666d285d744173e03c585dd6525219732ba313a (patch)
treecba6085a3b060ed2e3cc7ea62c31ca5ce8c64b7c /obt/signal.h
parentb79b70620fbf4b73534d964bfbf647e268ece404 (diff)
Add signal handling with the GMainLoop
Provided through a very simplistic interface in obt, found in the obt/signal.[ch] files
Diffstat (limited to 'obt/signal.h')
-rw-r--r--obt/signal.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/obt/signal.h b/obt/signal.h
new file mode 100644
index 00000000..ec712b24
--- /dev/null
+++ b/obt/signal.h
@@ -0,0 +1,46 @@
+/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
+
+ obt/signal.h for the Openbox window manager
+ Copyright (c) 2010 Dana 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.
+*/
+
+#ifndef __obt_signal_h
+#define __obt_signal_h
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef void (*ObtSignalHandler)(gint signal, gpointer data);
+
+/*! Listen for signals and report them through the default GMainContext within
+ main program thread (except signals that require immediate exit).
+ The app should not set its own signal handler function or it will interfere
+ with this one. */
+void obt_signal_listen(void);
+/*! Stop listening to signals and clean up */
+void obt_signal_stop(void);
+
+/*! Adds a signal handler for a signal. The callback function @func will be
+ called when the signal @sig is fired. @sig must not be a signal that
+ would cause the core to dump as these are handled internally.
+ */
+void obt_signal_add_callback(gint sig, ObtSignalHandler func, gpointer data);
+/*! Removes the most recently added callback with the given function. */
+void obt_signal_remove_callback(gint sig, ObtSignalHandler func);
+
+G_END_DECLS
+
+#endif