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);
32 void ob_main_loop_x_add(ObMainLoop *loop,
33 ObMainLoopXHandler handler,
35 GDestroyNotify notify);
36 void ob_main_loop_x_remove(ObMainLoop *loop,
37 ObMainLoopXHandler handler);
39 typedef void (*ObMainLoopFdHandler) (gint fd, gpointer data);
41 void ob_main_loop_fd_add(ObMainLoop *loop,
43 ObMainLoopFdHandler handler,
45 GDestroyNotify notify);
46 void ob_main_loop_fd_remove(ObMainLoop *loop,
49 typedef void (*ObMainLoopSignalHandler) (gint signal, gpointer data);
51 void ob_main_loop_signal_add(ObMainLoop *loop,
53 ObMainLoopSignalHandler handler,
55 GDestroyNotify notify);
56 void ob_main_loop_signal_remove(ObMainLoop *loop,
57 ObMainLoopSignalHandler handler);
59 void ob_main_loop_timeout_add(ObMainLoop *loop,
63 GDestroyNotify notify);
64 void ob_main_loop_timeout_remove(ObMainLoop *loop,
66 void ob_main_loop_timeout_remove_data(ObMainLoop *loop,
72 /*! Queues an action, which will be run when there are no more X events
74 void ob_main_loop_queue_action(ObMainLoop *loop, struct _ObAction *act);
76 void ob_main_loop_run(ObMainLoop *loop);
77 void ob_main_loop_exit(ObMainLoop *loop);