]> icculus.org git repositories - dana/openbox.git/blob - obt/mainloop.h
Merge branch 'backport' into work
[dana/openbox.git] / obt / mainloop.h
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2
3    obt/mainloop.h for the Openbox window manager
4    Copyright (c) 2006        Mikael Magnusson
5    Copyright (c) 2003-2007   Dana Jansens
6
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.
11
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.
16
17    See the COPYING file for a copy of the GNU General Public License.
18 */
19
20 #ifndef __obt_mainloop_h
21 #define __obt_mainloop_h
22
23 #include <X11/Xlib.h>
24 #include <glib.h>
25
26 G_BEGIN_DECLS
27
28 typedef struct _ObtMainLoop ObtMainLoop;
29
30 ObtMainLoop *obt_main_loop_new(void);
31 void        obt_main_loop_ref(ObtMainLoop *loop);
32 void        obt_main_loop_unref(ObtMainLoop *loop);
33
34 typedef void (*ObtMainLoopXHandler) (const XEvent *e, gpointer data);
35
36 void obt_main_loop_x_add(ObtMainLoop *loop,
37                          ObtMainLoopXHandler handler,
38                          gpointer data,
39                          GDestroyNotify notify);
40 void obt_main_loop_x_remove(ObtMainLoop *loop,
41                             ObtMainLoopXHandler handler);
42
43 typedef void (*ObtMainLoopFdHandler) (gint fd, gpointer data);
44
45 void obt_main_loop_fd_add(ObtMainLoop *loop,
46                           gint fd,
47                           ObtMainLoopFdHandler handler,
48                           gpointer data,
49                           GDestroyNotify notify);
50 void obt_main_loop_fd_remove(ObtMainLoop *loop,
51                              gint fd);
52
53 typedef void (*ObtMainLoopSignalHandler) (gint signal, gpointer data);
54
55 void obt_main_loop_signal_add(ObtMainLoop *loop,
56                               gint signal,
57                               ObtMainLoopSignalHandler handler,
58                               gpointer data,
59                               GDestroyNotify notify);
60 void obt_main_loop_signal_remove(ObtMainLoop *loop,
61                                  ObtMainLoopSignalHandler handler);
62
63 void obt_main_loop_timeout_add(ObtMainLoop *loop,
64                                gulong microseconds,
65                                GSourceFunc handler,
66                                gpointer data,
67                                GEqualFunc cmp,
68                                GDestroyNotify notify);
69 void obt_main_loop_timeout_remove(ObtMainLoop *loop,
70                                   GSourceFunc handler);
71 void obt_main_loop_timeout_remove_data(ObtMainLoop *loop,
72                                        GSourceFunc handler,
73                                        gpointer data,
74                                        gboolean cancel_dest);
75
76 void obt_main_loop_run(ObtMainLoop *loop);
77 void obt_main_loop_exit(ObtMainLoop *loop);
78
79 G_END_DECLS
80
81 #endif