"Initial commit to Gerrit"
[profile/ivi/cogl.git] / cogl / cogl-wayland-renderer.h
1 /*
2  * Cogl
3  *
4  * An object oriented GL/GLES Abstraction/Utility Layer
5  *
6  * Copyright (C) 2011 Intel Corporation.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the
20  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23
24 #if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
25 #error "Only <cogl/cogl.h> can be included directly."
26 #endif
27
28 #ifndef __COGL_WAYLAND_RENDERER_H__
29 #define __COGL_WAYLAND_RENDERER_H__
30
31 #include <cogl/cogl-types.h>
32 #include <cogl/cogl-renderer.h>
33
34 #include <wayland-client.h>
35
36 G_BEGIN_DECLS
37
38 /**
39  * cogl_wayland_renderer_set_foreign_display:
40  * @renderer: A #CoglRenderer
41  * @display: A Wayland display
42  *
43  * Allows you to explicitly control what Wayland display you want Cogl
44  * to work with instead of leaving Cogl to automatically connect to a
45  * wayland compositor.
46  *
47  * <note>If you use this API you must also explicitly set foreign
48  * Wayland compositor and shell objects using the
49  * cogl_wayland_renderer_set_foreign_compositor() and
50  * cogl_wayland_renderer_set_foreign_shell() respectively. This ie
51  * because Wayland doesn't currently provide a way to retrospectively
52  * query these interfaces so the expectation is that if you have taken
53  * ownership of the display then you will also have been notified of
54  * the compositor and shell interfaces which Cogl needs to use.</note>
55  *
56  * Since: 1.8
57  * Stability: unstable
58  */
59 void
60 cogl_wayland_renderer_set_foreign_display (CoglRenderer *renderer,
61                                            struct wl_display *display);
62
63 /**
64  * cogl_wayland_renderer_get_display:
65  * @renderer: A #CoglRenderer
66  * @display: A Wayland display
67  *
68  * Retrieves the Wayland display that Cogl is using. If a foreign
69  * display has been specified using
70  * cogl_wayland_renderer_set_foreign_display() then that display will
71  * be returned. If no foreign display has been specified then the
72  * display that Cogl creates internally will be returned unless the
73  * renderer has not yet been connected (either implicitly or explicitly by
74  * calling cogl_renderer_connect()) in which case %NULL is returned.
75  *
76  * Returns: The wayland display currently associated with @renderer,
77  *          or %NULL if the renderer hasn't yet been connected and no
78  *          foreign display has been specified.
79  *
80  * Since: 1.8
81  * Stability: unstable
82  */
83 struct wl_display *
84 cogl_wayland_renderer_get_display (CoglRenderer *renderer);
85
86 /**
87  * cogl_wayland_renderer_set_foreign_compositor:
88  * @renderer: A #CoglRenderer
89  * @compositor: A Wayland compositor
90  *
91  * Allows you to explicitly notify Cogl of a Wayland compositor
92  * interface to use. This API should be used in conjunction with
93  * cogl_wayland_renderer_set_foreign_display() because if you are
94  * connecting to a wayland compositor manually that will also mean you
95  * will be notified on connection of the available interfaces that
96  * can't be queried retrosectively with the current Wayland protocol.
97  *
98  * Since: 1.8
99  * Stability: unstable
100  */
101 void
102 cogl_wayland_renderer_set_foreign_compositor (CoglRenderer *renderer,
103                                               struct wl_compositor *compositor);
104
105 /**
106  * cogl_wayland_renderer_get_compositor:
107  * @renderer: A #CoglRenderer
108  *
109  * Retrieves the Wayland compositor interface that Cogl is using. If a
110  * foreign compositor has been specified using
111  * cogl_wayland_renderer_set_foreign_compositor() then that compositor
112  * will be returned. If no foreign compositor has been specified then
113  * the compositor that Cogl is notified of internally will be returned
114  * unless the renderer has not yet been connected (either implicitly
115  * or explicitly by calling cogl_renderer_connect()) in which case
116  * %NULL is returned.
117  *
118  * Since: 1.8
119  * Stability: unstable
120  */
121 struct wl_compositor *
122 cogl_wayland_renderer_get_compositor (CoglRenderer *renderer);
123
124 /**
125  * cogl_wayland_renderer_set_foreign_shell:
126  * @renderer: A #CoglRenderer
127  * @shell: A Wayland shell
128  *
129  * Allows you to explicitly notify Cogl of a Wayland shell interface
130  * to use.  This API should be used in conjunction with
131  * cogl_wayland_renderer_set_foreign_display() because if you are
132  * connecting to a wayland compositor manually that will also mean you
133  * will be notified on connection of the available interfaces that
134  * can't be queried retrosectively with the current Wayland protocol.
135  *
136  * Since: 1.10
137  * Stability: unstable
138  */
139 void
140 cogl_wayland_renderer_set_foreign_shell (CoglRenderer *renderer,
141                                          struct wl_shell *shell);
142
143 /**
144  * cogl_wayland_renderer_get_shell:
145  * @renderer: A #CoglRenderer
146  *
147  * Retrieves the Wayland shell interface that Cogl is using. If a
148  * foreign shell has been specified using
149  * cogl_wayland_renderer_set_foreign_shell() then that shell
150  * will be returned. If no foreign shell has been specified then
151  * the shell that Cogl is notified of internally will be returned
152  * unless the renderer has not yet been connected (either implicitly
153  * or explicitly by calling cogl_renderer_connect()) in which case
154  * %NULL is returned.
155  *
156  * Since: 1.10
157  * Stability: unstable
158  */
159 struct wl_shell *
160 cogl_wayland_renderer_get_shell (CoglRenderer *renderer);
161
162 G_END_DECLS
163
164 #endif /* __COGL_WAYLAND_RENDERER_H__ */