1 /*
2  * Cogl
3  *
4  * A Low Level GPU Graphics and Utilities API
5  *
6  * Copyright (C) 2011 Intel Corporation.
7  *
8  * Permission is hereby granted, free of charge, to any person
9  * obtaining a copy of this software and associated documentation
10  * files (the "Software"), to deal in the Software without
11  * restriction, including without limitation the rights to use, copy,
12  * modify, merge, publish, distribute, sublicense, and/or sell copies
13  * of the Software, and to permit persons to whom the Software is
14  * furnished to do so, subject to the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be
17  * included in all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
23  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
24  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26  * SOFTWARE.
27  */
28 
29 #ifndef __COGL_XLIB_H__
30 #define __COGL_XLIB_H__
31 
32 #include <X11/Xlib.h>
33 
34 /* NB: this is a top-level header that can be included directly but we
35  * want to be careful not to define __COGL_H_INSIDE__ when this is
36  * included internally while building Cogl itself since
37  * __COGL_H_INSIDE__ is used in headers to guard public vs private api
38  * definitions
39  */
40 #ifndef COGL_COMPILATION
41 
42 /* Note: When building Cogl .gir we explicitly define
43  * __COGL_XLIB_H_INSIDE__ */
44 #ifndef __COGL_XLIB_H_INSIDE__
45 #define __COGL_XLIB_H_INSIDE__
46 #endif
47 
48 /* Note: When building Cogl .gir we explicitly define
49  * __COGL_H_INSIDE__ */
50 #ifndef __COGL_H_INSIDE__
51 #define __COGL_H_INSIDE__
52 #define __COGL_XLIB_H_MUST_UNDEF_COGL_H_INSIDE__
53 #endif
54 
55 #endif /* COGL_COMPILATION */
56 
57 #include <cogl/cogl-types.h>
58 #include <cogl/deprecated/cogl-clutter-xlib.h>
59 #include <cogl/cogl-xlib-renderer.h>
60 #include <cogl/cogl-macros.h>
61 
62 COGL_BEGIN_DECLS
63 
64 /*
65  * cogl_xlib_get_display:
66  *
67  * Return value: the Xlib display that will be used by the Xlib winsys
68  * backend. The display needs to be set with _cogl_xlib_set_display()
69  * before this function is called.
70  *
71  * Stability: Unstable
72  * Deprecated: 1.16: Use cogl_xlib_renderer_get_display() instead
73  */
74 COGL_DEPRECATED_IN_1_16_FOR (cogl_xlib_renderer_get_display)
75 Display *
76 cogl_xlib_get_display (void);
77 
78 /*
79  * cogl_xlib_set_display:
80  *
81  * Sets the Xlib display that Cogl will use for the Xlib winsys
82  * backend. This function should eventually go away when Cogl gains a
83  * more complete winsys abstraction.
84  *
85  * Stability: Unstable
86  * Deprecated: 1.16: Use cogl_xlib_renderer_set_foreign_display()
87  *                   instead
88  */
89 COGL_DEPRECATED_IN_1_16_FOR (cogl_xlib_renderer_set_foreign_display)
90 void
91 cogl_xlib_set_display (Display *display);
92 
93 /*
94  * cogl_xlib_handle_event:
95  * @xevent: pointer to XEvent structure
96  *
97  * This function processes a single X event; it can be used to hook
98  * into external X event retrieval (for example that done by Clutter
99  * or GDK).
100  *
101  * Return value: #CoglXlibFilterReturn. %COGL_XLIB_FILTER_REMOVE
102  * indicates that Cogl has internally handled the event and the
103  * caller should do no further processing. %COGL_XLIB_FILTER_CONTINUE
104  * indicates that Cogl is either not interested in the event,
105  * or has used the event to update internal state without taking
106  * any exclusive action.
107  *
108  * Stability: Unstable
109  * Deprecated: 1.16: Use cogl_xlib_renderer_handle_event() instead
110  */
111 COGL_DEPRECATED_IN_1_16_FOR (cogl_xlib_renderer_handle_event)
112 CoglFilterReturn
113 cogl_xlib_handle_event (XEvent *xevent);
114 
115 COGL_END_DECLS
116 
117 
118 /* The gobject introspection scanner seems to parse public headers in
119  * isolation which means we need to be extra careful about how we
120  * define and undefine __COGL_H_INSIDE__ used to detect when internal
121  * headers are incorrectly included by developers. In the gobject
122  * introspection case we have to manually define __COGL_H_INSIDE__ as
123  * a commandline argument for the scanner which means we must be
124  * careful not to undefine it in a header...
125  */
126 #ifdef __COGL_XLIB_H_MUST_UNDEF_COGL_H_INSIDE__
127 #undef __COGL_H_INSIDE__
128 #undef __COGL_XLIB_H_INSIDE__
129 #undef __COGL_XLIB_H_MUST_UNDEF_COGL_H_INSIDE__
130 #endif
131 
132 #endif /* __COGL_XLIB_H__ */
133