Update portuguese translation
[openbox.git] / obt / xqueue.h
blob11cd2bc084c2e42b88081fdb5f10576629bfbf82
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 obt/xqueue.h for the Openbox window manager
4 Copyright (c) 2010 Dana 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 __obt_xqueue_h
20 #define __obt_xqueue_h
22 #include <glib.h>
23 #include <X11/Xlib.h>
25 G_BEGIN_DECLS
27 typedef struct _ObtXQueueWindowType {
28 Window window;
29 int type;
30 } ObtXQueueWindowType;
32 typedef struct _ObtXQueueWindowMessage {
33 Window window;
34 Atom message;
35 } ObtXQueueWindowMessage;
37 typedef gboolean (*xqueue_match_func)(XEvent *e, gpointer data);
39 /*! Returns TRUE if the event matches the window pointed to by @data */
40 gboolean xqueue_match_window(XEvent *e, gpointer data);
42 /*! Returns TRUE if the event matches the type contained in the value of @data */
43 gboolean xqueue_match_type(XEvent *e, gpointer data);
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);
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);
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);
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);
61 /*! Returns TRUE if there is anything in the local event queue, and FALSE
62 otherwise. */
63 gboolean xqueue_pending_local(void);
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);
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);
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);
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);
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);
90 typedef void (*ObtXQueueFunc)(const XEvent *ev, gpointer data);
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);
96 void xqueue_add_callback(ObtXQueueFunc f, gpointer data);
97 void xqueue_remove_callback(ObtXQueueFunc f, gpointer data);
99 G_END_DECLS
101 #endif