1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 obt/mainloop.h for the Openbox window manager
4 Copyright (c) 2006 Mikael Magnusson
5 Copyright (c) 2003-2007 Dana Jansens
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 See the COPYING file for a copy of the GNU General Public License.
20 #ifndef __obt_mainloop_h
21 #define __obt_mainloop_h
26 typedef struct _ObtMainLoop ObtMainLoop;
28 ObtMainLoop *obt_main_loop_new(Display *display);
29 void obt_main_loop_ref(ObtMainLoop *loop);
30 void obt_main_loop_unref(ObtMainLoop *loop);
32 typedef void (*ObtMainLoopXHandler) (const XEvent *e, gpointer data);
34 void obt_main_loop_x_add(ObtMainLoop *loop,
35 ObtMainLoopXHandler handler,
37 GDestroyNotify notify);
38 void obt_main_loop_x_remove(ObtMainLoop *loop,
39 ObtMainLoopXHandler handler);
41 typedef void (*ObtMainLoopFdHandler) (gint fd, gpointer data);
43 void obt_main_loop_fd_add(ObtMainLoop *loop,
45 ObtMainLoopFdHandler handler,
47 GDestroyNotify notify);
48 void obt_main_loop_fd_remove(ObtMainLoop *loop,
51 typedef void (*ObtMainLoopSignalHandler) (gint signal, gpointer data);
53 void obt_main_loop_signal_add(ObtMainLoop *loop,
55 ObtMainLoopSignalHandler handler,
57 GDestroyNotify notify);
58 void obt_main_loop_signal_remove(ObtMainLoop *loop,
59 ObtMainLoopSignalHandler handler);
61 void obt_main_loop_timeout_add(ObtMainLoop *loop,
66 GDestroyNotify notify);
67 void obt_main_loop_timeout_remove(ObtMainLoop *loop,
69 void obt_main_loop_timeout_remove_data(ObtMainLoop *loop,
72 gboolean cancel_dest);
74 void obt_main_loop_run(ObtMainLoop *loop);
75 void obt_main_loop_exit(ObtMainLoop *loop);