2011-06-28 13:16:24 +00:00
|
|
|
/*
|
|
|
|
* Cogl
|
|
|
|
*
|
|
|
|
* An object oriented GL/GLES Abstraction/Utility Layer
|
|
|
|
*
|
|
|
|
* Copyright (C) 2011 Intel Corporation.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2012-06-20 17:49:08 +00:00
|
|
|
#if !defined(__COGL_XLIB_H_INSIDE__) && !defined(COGL_COMPILATION)
|
2011-10-17 16:55:35 +00:00
|
|
|
#error "Only <cogl/cogl-xlib.h> can be included directly."
|
2011-06-28 13:16:24 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __COGL_XLIB_RENDERER_H__
|
|
|
|
#define __COGL_XLIB_RENDERER_H__
|
|
|
|
|
|
|
|
#include <X11/Xlib.h>
|
2012-02-18 01:19:17 +00:00
|
|
|
|
2013-10-09 12:31:12 +00:00
|
|
|
/* NB: this is a top-level header that can be included directly but we
|
|
|
|
* want to be careful not to define __COGL_H_INSIDE__ when this is
|
|
|
|
* included internally while building Cogl itself since
|
|
|
|
* __COGL_H_INSIDE__ is used in headers to guard public vs private api
|
|
|
|
* definitions
|
|
|
|
*/
|
|
|
|
#ifndef COGL_COMPILATION
|
2013-11-28 12:34:45 +00:00
|
|
|
|
|
|
|
/* Note: When building Cogl .gir we explicitly define
|
|
|
|
* __COGL_H_INSIDE__ */
|
|
|
|
#ifndef __COGL_H_INSIDE__
|
2012-02-18 01:19:17 +00:00
|
|
|
#define __COGL_H_INSIDE__
|
2013-11-28 12:34:45 +00:00
|
|
|
#define __COGL_XLIB_RENDERER_H_MUST_UNDEF_COGL_H_INSIDE__
|
2013-10-09 12:31:12 +00:00
|
|
|
#endif
|
2013-11-28 12:34:45 +00:00
|
|
|
|
|
|
|
#endif /* COGL_COMPILATION */
|
|
|
|
|
2012-02-18 01:19:17 +00:00
|
|
|
#include <cogl/cogl-renderer.h>
|
2011-06-28 13:16:24 +00:00
|
|
|
|
2012-11-22 18:01:10 +00:00
|
|
|
COGL_BEGIN_DECLS
|
2011-06-28 13:16:24 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* cogl_xlib_renderer_handle_event:
|
2012-12-30 17:47:12 +00:00
|
|
|
* @renderer: a #CoglRenderer
|
2011-06-28 13:16:24 +00:00
|
|
|
* @event: pointer to an XEvent structure
|
|
|
|
*
|
|
|
|
* This function processes a single event; it can be used to hook into
|
|
|
|
* external event retrieval (for example that done by Clutter or
|
|
|
|
* GDK).
|
|
|
|
*
|
|
|
|
* Return value: #CoglFilterReturn. %COGL_FILTER_REMOVE indicates that
|
|
|
|
* Cogl has internally handled the event and the caller should do no
|
|
|
|
* further processing. %COGL_FILTER_CONTINUE indicates that Cogl is
|
|
|
|
* either not interested in the event, or has used the event to update
|
|
|
|
* internal state without taking any exclusive action.
|
|
|
|
*/
|
|
|
|
CoglFilterReturn
|
|
|
|
cogl_xlib_renderer_handle_event (CoglRenderer *renderer,
|
|
|
|
XEvent *event);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* CoglXlibFilterFunc:
|
|
|
|
* @event: pointer to an XEvent structure
|
2012-12-30 17:47:12 +00:00
|
|
|
* @data: the data that was given when the filter was added
|
2011-06-28 13:16:24 +00:00
|
|
|
*
|
|
|
|
* A callback function that can be registered with
|
|
|
|
* cogl_xlib_renderer_add_filter(). The function should return
|
|
|
|
* %COGL_FILTER_REMOVE if it wants to prevent further processing or
|
|
|
|
* %COGL_FILTER_CONTINUE otherwise.
|
|
|
|
*/
|
|
|
|
typedef CoglFilterReturn (* CoglXlibFilterFunc) (XEvent *event,
|
|
|
|
void *data);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* cogl_xlib_renderer_add_filter:
|
2012-12-30 17:47:12 +00:00
|
|
|
* @renderer: a #CoglRenderer
|
|
|
|
* @func: the callback function
|
|
|
|
* @data: user data passed to @func when called
|
2011-06-28 13:16:24 +00:00
|
|
|
*
|
|
|
|
* Adds a callback function that will receive all native events. The
|
|
|
|
* function can stop further processing of the event by return
|
|
|
|
* %COGL_FILTER_REMOVE.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
cogl_xlib_renderer_add_filter (CoglRenderer *renderer,
|
|
|
|
CoglXlibFilterFunc func,
|
|
|
|
void *data);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* cogl_xlib_renderer_remove_filter:
|
2012-12-30 17:47:12 +00:00
|
|
|
* @renderer: a #CoglRenderer
|
|
|
|
* @func: the callback function
|
|
|
|
* @data: user data given when the callback was installed
|
2011-06-28 13:16:24 +00:00
|
|
|
*
|
|
|
|
* Removes a callback that was previously added with
|
|
|
|
* cogl_xlib_renderer_add_filter().
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
cogl_xlib_renderer_remove_filter (CoglRenderer *renderer,
|
|
|
|
CoglXlibFilterFunc func,
|
|
|
|
void *data);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* cogl_xlib_renderer_get_foreign_display:
|
2012-12-30 17:47:12 +00:00
|
|
|
* @renderer: a #CoglRenderer
|
2011-06-28 13:16:24 +00:00
|
|
|
*
|
|
|
|
* Return value: the foreign Xlib display that will be used by any Xlib based
|
|
|
|
* winsys backend. The display needs to be set with
|
|
|
|
* cogl_xlib_renderer_set_foreign_display() before this function is called.
|
|
|
|
*/
|
|
|
|
Display *
|
|
|
|
cogl_xlib_renderer_get_foreign_display (CoglRenderer *renderer);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* cogl_xlib_renderer_set_foreign_display:
|
2012-12-30 17:47:12 +00:00
|
|
|
* @renderer: a #CoglRenderer
|
2011-06-28 13:16:24 +00:00
|
|
|
*
|
|
|
|
* Sets a foreign Xlib display that Cogl will use for and Xlib based winsys
|
|
|
|
* backend.
|
2011-12-16 18:50:49 +00:00
|
|
|
*
|
|
|
|
* Note that calling this function will automatically call
|
|
|
|
* cogl_xlib_renderer_set_event_retrieval_enabled() to disable Cogl's
|
|
|
|
* event retrieval. Cogl still needs to see all of the X events so the
|
|
|
|
* application should also use cogl_xlib_renderer_handle_event() if it
|
|
|
|
* uses this function.
|
2011-06-28 13:16:24 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
cogl_xlib_renderer_set_foreign_display (CoglRenderer *renderer,
|
|
|
|
Display *display);
|
|
|
|
|
2011-12-16 18:50:49 +00:00
|
|
|
/**
|
|
|
|
* cogl_xlib_renderer_set_event_retrieval_enabled:
|
2012-12-30 17:47:12 +00:00
|
|
|
* @renderer: a #CoglRenderer
|
2011-12-16 18:50:49 +00:00
|
|
|
* @enable: The new value
|
|
|
|
*
|
|
|
|
* Sets whether Cogl should automatically retrieve events from the X
|
|
|
|
* display. This defaults to %TRUE unless
|
|
|
|
* cogl_xlib_renderer_set_foreign_display() is called. It can be set
|
|
|
|
* to %FALSE if the application wants to handle its own event
|
|
|
|
* retrieval. Note that Cogl still needs to see all of the X events to
|
|
|
|
* function properly so the application should call
|
|
|
|
* cogl_xlib_renderer_handle_event() for each event if it disables
|
|
|
|
* automatic event retrieval.
|
|
|
|
*
|
|
|
|
* Since: 1.10
|
|
|
|
* Stability: unstable
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
cogl_xlib_renderer_set_event_retrieval_enabled (CoglRenderer *renderer,
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 20:56:40 +00:00
|
|
|
CoglBool enable);
|
2011-12-16 18:50:49 +00:00
|
|
|
|
2011-06-28 13:16:24 +00:00
|
|
|
Display *
|
|
|
|
cogl_xlib_renderer_get_display (CoglRenderer *renderer);
|
|
|
|
|
2012-11-22 18:01:10 +00:00
|
|
|
COGL_END_DECLS
|
2011-06-28 13:16:24 +00:00
|
|
|
|
2013-11-28 12:34:45 +00:00
|
|
|
/* The gobject introspection scanner seems to parse public headers in
|
|
|
|
* isolation which means we need to be extra careful about how we
|
|
|
|
* define and undefine __COGL_H_INSIDE__ used to detect when internal
|
|
|
|
* headers are incorrectly included by developers. In the gobject
|
|
|
|
* introspection case we have to manually define __COGL_H_INSIDE__ as
|
|
|
|
* a commandline argument for the scanner which means we must be
|
|
|
|
* careful not to undefine it in a header...
|
|
|
|
*/
|
|
|
|
#ifdef __COGL_XLIB_RENDERER_H_MUST_UNDEF_COGL_H_INSIDE__
|
|
|
|
#undef __COGL_H_INSIDE__
|
|
|
|
#undef __COGL_XLIB_RENDERER_H_MUST_UNDEF_COGL_H_INSIDE__
|
|
|
|
#endif
|
|
|
|
|
2011-06-28 13:16:24 +00:00
|
|
|
#endif /* __COGL_XLIB_RENDERER_H__ */
|