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  */
30 
31 #if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION)
32 #error "Only <cogl/cogl.h> can be included directly."
33 #endif
34 
35 #ifndef __COGL_GSOURCE_H__
36 #define __COGL_GSOURCE_H__
37 
38 #include <glib.h>
39 #include <cogl/cogl-context.h>
40 
41 G_BEGIN_DECLS
42 
43 /**
44  * cogl_glib_source_new:
45  * @context: A #CoglContext
46  * @priority: The priority of the #GSource
47  *
48  * Creates a #GSource which handles Cogl's internal system event
49  * processing. This can be used as a convenience instead of
50  * cogl_poll_renderer_get_info() and cogl_poll_renderer_dispatch() in
51  * applications that are already using the GLib main loop. After this
52  * is called the #GSource should be attached to the main loop using
53  * g_source_attach().
54  *
55  * Applications that manually connect to a #CoglRenderer before they
56  * create a #CoglContext should instead use
57  * cogl_glib_renderer_source_new() so that events may be dispatched
58  * before a context has been created. In that case you don't need to
59  * use this api in addition later, it is simply enough to use
60  * cogl_glib_renderer_source_new() instead.
61  *
62  * <note>This api is actually just a thin convenience wrapper around
63  * cogl_glib_renderer_source_new()</note>
64  *
65  * Return value: a new #GSource
66  *
67  * Stability: unstable
68  * Since: 1.10
69  */
70 GSource *
71 cogl_glib_source_new (CoglContext *context,
72                       int priority);
73 
74 /**
75  * cogl_glib_renderer_source_new:
76  * @renderer: A #CoglRenderer
77  * @priority: The priority of the #GSource
78  *
79  * Creates a #GSource which handles Cogl's internal system event
80  * processing. This can be used as a convenience instead of
81  * cogl_poll_renderer_get_info() and cogl_poll_renderer_dispatch() in
82  * applications that are already using the GLib main loop. After this
83  * is called the #GSource should be attached to the main loop using
84  * g_source_attach().
85  *
86  * Return value: a new #GSource
87  *
88  * Stability: unstable
89  * Since: 1.16
90  */
91 GSource *
92 cogl_glib_renderer_source_new (CoglRenderer *renderer,
93                                int priority);
94 
95 G_END_DECLS
96 
97 #endif /* __COGL_GSOURCE_H__ */
98