]> Dogcows Code - chaz/openbox/blob - obt/xqueue.h
Button proper freeing/newing.
[chaz/openbox] / obt / xqueue.h
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2
3 obt/xqueue.h for the Openbox window manager
4 Copyright (c) 2010 Dana Jansens
5
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.
10
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.
15
16 See the COPYING file for a copy of the GNU General Public License.
17 */
18
19 #ifndef __obt_xqueue_h
20 #define __obt_xqueue_h
21
22 #include <glib.h>
23 #include <X11/Xlib.h>
24
25 G_BEGIN_DECLS
26
27 typedef struct _ObtXQueueWindowType {
28 Window window;
29 int type;
30 } ObtXQueueWindowType;
31
32 typedef struct _ObtXQueueWindowMessage {
33 Window window;
34 Atom message;
35 } ObtXQueueWindowMessage;
36
37 typedef gboolean (*xqueue_match_func)(XEvent *e, gpointer data);
38
39 /*! Returns TRUE if the event matches the window pointed to by @data */
40 gboolean xqueue_match_window(XEvent *e, gpointer data);
41
42 /*! Returns TRUE if the event matches the type contained in the value of @data */
43 gboolean xqueue_match_type(XEvent *e, gpointer data);
44
45 /*! Returns TRUE if the event matches the type and window in the
46 ObtXQueueWindowType pointed to by @data */
47 gboolean xqueue_match_window_type(XEvent *e, gpointer data);
48
49 /*! Returns TRUE if a ClientMessage event matches the message and window in the
50 ObtXQueueWindowMessage pointed to by @data */
51 gboolean xqueue_match_window_message(XEvent *e, gpointer data);
52
53 /*! Returns TRUE and passes the next event in the queue and removes it from
54 the queue. On error, returns FALSE */
55 gboolean xqueue_next(XEvent *event_return);
56
57 /*! Returns TRUE and passes the next event in the local queue and removes it
58 from the queue. If no event is in the local queue, it returns FALSE. */
59 gboolean xqueue_next_local(XEvent *event_return);
60
61 /*! Returns TRUE if there is anything in the local event queue, and FALSE
62 otherwise. */
63 gboolean xqueue_pending_local(void);
64
65 /*! Returns TRUE and passes the next event in the queue, or FALSE if there
66 is an error */
67 gboolean xqueue_peek(XEvent *event_return);
68
69 /*! Returns TRUE and passes the next event in the queue, if there is one,
70 and returns FALSE otherwise. */
71 gboolean xqueue_peek_local(XEvent *event_return);
72
73 /*! Returns TRUE if xqueue_match_func returns TRUE for some event in the
74 current event queue or in the stream of events from the server,
75 and passes the matching event without removing it from the queue.
76 This blocks until an event is found or an error occurs. */
77 gboolean xqueue_exists(xqueue_match_func match, gpointer data);
78
79 /*! Returns TRUE if xqueue_match_func returns TRUE for some event in the
80 current event queue, and passes the matching event without removing it
81 from the queue. */
82 gboolean xqueue_exists_local(xqueue_match_func match, gpointer data);
83
84 /*! Returns TRUE if xqueue_match_func returns TRUE for some event in the
85 current event queue, and passes the matching event while removing it
86 from the queue. */
87 gboolean xqueue_remove_local(XEvent *event_return,
88 xqueue_match_func match, gpointer data);
89
90 typedef void (*ObtXQueueFunc)(const XEvent *ev, gpointer data);
91
92 /*! Begin listening for X events in the default GMainContext, and feed them
93 to the registered callback functions, added with xqueue_add_callback(). */
94 void xqueue_listen(void);
95
96 void xqueue_add_callback(ObtXQueueFunc f, gpointer data);
97 void xqueue_remove_callback(ObtXQueueFunc f, gpointer data);
98
99 G_END_DECLS
100
101 #endif
This page took 0.038562 seconds and 4 git commands to generate.