1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 mainloop.h for the Openbox window manager
4 Copyright (c) 2003 Ben Jansens
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 See the COPYING file for a copy of the GNU General Public License.
19 #ifndef __ob__mainloop_h
20 #define __ob__mainloop_h
25 typedef struct _ObMainLoop ObMainLoop
;
27 ObMainLoop
*ob_main_loop_new(Display
*display
);
28 void ob_main_loop_destroy(ObMainLoop
*loop
);
30 typedef void (*ObMainLoopXHandler
) (const XEvent
*e
, gpointer data
);
31 typedef void (*ObMainLoopXDoneHandler
) (gpointer data
);
33 void ob_main_loop_x_add(ObMainLoop
*loop
,
34 ObMainLoopXHandler handler
,
35 ObMainLoopXDoneHandler done_handler
,
37 GDestroyNotify notify
);
38 void ob_main_loop_x_remove(ObMainLoop
*loop
,
39 ObMainLoopXHandler handler
);
41 typedef void (*ObMainLoopFdHandler
) (gint fd
, gpointer data
);
43 void ob_main_loop_fd_add(ObMainLoop
*loop
,
45 ObMainLoopFdHandler handler
,
47 GDestroyNotify notify
);
48 void ob_main_loop_fd_remove(ObMainLoop
*loop
,
51 typedef void (*ObMainLoopSignalHandler
) (gint signal
, gpointer data
);
53 void ob_main_loop_signal_add(ObMainLoop
*loop
,
55 ObMainLoopSignalHandler handler
,
57 GDestroyNotify notify
);
58 void ob_main_loop_signal_remove(ObMainLoop
*loop
,
59 ObMainLoopSignalHandler handler
);
61 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
,
74 /*! Queues an action, which will be run when there are no more X events
76 void ob_main_loop_queue_action(ObMainLoop
*loop
, struct _ObAction
*act
);
78 void ob_main_loop_run(ObMainLoop
*loop
);
79 void ob_main_loop_exit(ObMainLoop
*loop
);