1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 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 __ob__mainloop_h
21 #define __ob__mainloop_h
26 typedef struct _ObMainLoop ObMainLoop
;
28 ObMainLoop
*ob_main_loop_new(Display
*display
);
29 void ob_main_loop_destroy(ObMainLoop
*loop
);
31 typedef void (*ObMainLoopXHandler
) (const XEvent
*e
, gpointer data
);
33 void ob_main_loop_x_add(ObMainLoop
*loop
,
34 ObMainLoopXHandler handler
,
36 GDestroyNotify notify
);
37 void ob_main_loop_x_remove(ObMainLoop
*loop
,
38 ObMainLoopXHandler handler
);
40 typedef void (*ObMainLoopFdHandler
) (gint fd
, gpointer data
);
42 void ob_main_loop_fd_add(ObMainLoop
*loop
,
44 ObMainLoopFdHandler handler
,
46 GDestroyNotify notify
);
47 void ob_main_loop_fd_remove(ObMainLoop
*loop
,
50 typedef void (*ObMainLoopSignalHandler
) (gint signal
, gpointer data
);
52 void ob_main_loop_signal_add(ObMainLoop
*loop
,
54 ObMainLoopSignalHandler handler
,
56 GDestroyNotify notify
);
57 void ob_main_loop_signal_remove(ObMainLoop
*loop
,
58 ObMainLoopSignalHandler handler
);
60 void ob_main_loop_timeout_add(ObMainLoop
*loop
,
65 GDestroyNotify notify
);
66 void ob_main_loop_timeout_remove(ObMainLoop
*loop
,
68 void ob_main_loop_timeout_remove_data(ObMainLoop
*loop
,
71 gboolean cancel_dest
);
75 /*! Queues an action, which will be run when there are no more X events
77 void ob_main_loop_queue_action(ObMainLoop
*loop
, struct _ObAction
*act
);
79 void ob_main_loop_run(ObMainLoop
*loop
);
80 void ob_main_loop_exit(ObMainLoop
*loop
);