Respect $XDG_CONFIG_HOME in openbox-session
[dana/openbox.git] / openbox / mainloop.h
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2
3    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 __ob__mainloop_h
21 #define __ob__mainloop_h
22
23 #include <X11/Xlib.h>
24 #include <glib.h>
25
26 typedef struct _ObMainLoop ObMainLoop;
27
28 ObMainLoop *ob_main_loop_new(Display *display);
29 void        ob_main_loop_destroy(ObMainLoop *loop);
30
31 typedef void (*ObMainLoopXHandler) (const XEvent *e, gpointer data);
32
33 void ob_main_loop_x_add(ObMainLoop *loop,
34                         ObMainLoopXHandler handler,
35                         gpointer data,
36                         GDestroyNotify notify);
37 void ob_main_loop_x_remove(ObMainLoop *loop,
38                            ObMainLoopXHandler handler);
39
40 typedef void (*ObMainLoopFdHandler) (gint fd, gpointer data);
41
42 void ob_main_loop_fd_add(ObMainLoop *loop,
43                          gint fd,
44                          ObMainLoopFdHandler handler,
45                          gpointer data,
46                          GDestroyNotify notify);
47 void ob_main_loop_fd_remove(ObMainLoop *loop,
48                             gint fd);
49
50 typedef void (*ObMainLoopSignalHandler) (gint signal, gpointer data);
51
52 void ob_main_loop_signal_add(ObMainLoop *loop,
53                              gint signal,
54                              ObMainLoopSignalHandler handler,
55                              gpointer data,
56                              GDestroyNotify notify);
57 void ob_main_loop_signal_remove(ObMainLoop *loop,
58                                 ObMainLoopSignalHandler handler);
59
60 void ob_main_loop_timeout_add(ObMainLoop *loop,
61                               gulong microseconds,
62                               GSourceFunc handler,
63                               gpointer data,
64                               GEqualFunc cmp,
65                               GDestroyNotify notify);
66 void ob_main_loop_timeout_remove(ObMainLoop *loop,
67                                  GSourceFunc handler);
68 void ob_main_loop_timeout_remove_data(ObMainLoop *loop,
69                                       GSourceFunc handler,
70                                       gpointer data,
71                                       gboolean cancel_dest);
72
73 void ob_main_loop_run(ObMainLoop *loop);
74 void ob_main_loop_exit(ObMainLoop *loop);
75
76 #endif