make interactive actions a type and not special cases.
[mikachu/openbox.git] / openbox / mainloop.h
1 #ifndef __ob__mainloop_h
2 #define __ob__mainloop_h
3
4 #include <X11/Xlib.h>
5 #include <glib.h>
6
7 typedef struct _ObMainLoop ObMainLoop;
8
9 ObMainLoop *ob_main_loop_new(Display *display);
10 void        ob_main_loop_destroy(ObMainLoop *loop);
11
12 typedef void (*ObMainLoopXHandler) (const XEvent *e, gpointer data);
13
14 void ob_main_loop_x_add(ObMainLoop *loop,
15                         ObMainLoopXHandler handler,
16                         gpointer data,
17                         GDestroyNotify notify);
18 void ob_main_loop_x_remove(ObMainLoop *loop,
19                            ObMainLoopXHandler handler);
20
21 typedef void (*ObMainLoopFdHandler) (gint fd, gpointer data);
22
23 void ob_main_loop_fd_add(ObMainLoop *loop,
24                          gint fd,
25                          ObMainLoopFdHandler handler,
26                          gpointer data,
27                          GDestroyNotify notify);
28 void ob_main_loop_fd_remove(ObMainLoop *loop,
29                             gint fd);
30
31 typedef void (*ObMainLoopSignalHandler) (gint signal, gpointer data);
32
33 void ob_main_loop_signal_add(ObMainLoop *loop,
34                              gint signal,
35                              ObMainLoopSignalHandler handler,
36                              gpointer data,
37                              GDestroyNotify notify);
38 void ob_main_loop_signal_remove(ObMainLoop *loop,
39                                 ObMainLoopSignalHandler handler);
40
41 void ob_main_loop_timeout_add(ObMainLoop *loop,
42                               gulong microseconds,
43                               GSourceFunc handler,
44                               gpointer data,
45                               GDestroyNotify notify);
46 void ob_main_loop_timeout_remove(ObMainLoop *loop,
47                                  GSourceFunc handler);
48
49 void ob_main_loop_run(ObMainLoop *loop);
50 void ob_main_loop_exit(ObMainLoop *loop);
51
52 #endif