2010-10-21 08:13:00 -04:00
|
|
|
/*
|
|
|
|
* Clutter.
|
|
|
|
*
|
|
|
|
* An OpenGL based 'interactive canvas' library.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2010 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, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2010-10-21 06:49:37 -04:00
|
|
|
#ifndef __CLUTTER_BACKEND_PRIVATE_H__
|
|
|
|
#define __CLUTTER_BACKEND_PRIVATE_H__
|
|
|
|
|
|
|
|
#include <clutter/clutter-backend.h>
|
2011-10-17 11:03:19 -04:00
|
|
|
#include <clutter/clutter-device-manager.h>
|
|
|
|
#include <clutter/clutter-stage-window.h>
|
|
|
|
|
2011-02-09 07:20:56 -05:00
|
|
|
#include "clutter-event-translator.h"
|
2010-10-21 06:49:37 -04:00
|
|
|
|
|
|
|
#define CLUTTER_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BACKEND, ClutterBackendClass))
|
|
|
|
#define CLUTTER_IS_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BACKEND))
|
|
|
|
#define CLUTTER_BACKEND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BACKEND, ClutterBackendClass))
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
typedef struct _ClutterBackendPrivate ClutterBackendPrivate;
|
|
|
|
|
|
|
|
struct _ClutterBackend
|
|
|
|
{
|
|
|
|
/*< private >*/
|
2011-11-04 15:25:54 -04:00
|
|
|
GObject parent_instance;
|
2010-11-05 08:28:33 -04:00
|
|
|
|
2011-11-04 15:25:54 -04:00
|
|
|
CoglRenderer *cogl_renderer;
|
|
|
|
CoglDisplay *cogl_display;
|
|
|
|
CoglContext *cogl_context;
|
2011-12-21 10:13:53 -05:00
|
|
|
GSource *cogl_source;
|
2011-11-04 15:25:54 -04:00
|
|
|
|
2015-09-14 19:30:05 -04:00
|
|
|
CoglOnscreen *dummy_onscreen;
|
|
|
|
|
2011-11-04 15:25:54 -04:00
|
|
|
ClutterDeviceManager *device_manager;
|
2010-11-05 08:28:33 -04:00
|
|
|
|
2015-07-08 06:10:45 -04:00
|
|
|
cairo_font_options_t *font_options;
|
|
|
|
|
|
|
|
gchar *font_name;
|
|
|
|
|
|
|
|
gfloat units_per_em;
|
|
|
|
gint32 units_serial;
|
|
|
|
|
|
|
|
GList *event_translators;
|
2010-10-21 06:49:37 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _ClutterBackendClass
|
|
|
|
{
|
|
|
|
/*< private >*/
|
|
|
|
GObjectClass parent_class;
|
|
|
|
|
2011-11-04 14:26:33 -04:00
|
|
|
GType stage_window_type;
|
|
|
|
|
2010-10-21 06:49:37 -04:00
|
|
|
/* vfuncs */
|
|
|
|
gboolean (* pre_parse) (ClutterBackend *backend,
|
|
|
|
GError **error);
|
|
|
|
gboolean (* post_parse) (ClutterBackend *backend,
|
|
|
|
GError **error);
|
|
|
|
ClutterStageWindow * (* create_stage) (ClutterBackend *backend,
|
|
|
|
ClutterStage *wrapper,
|
|
|
|
GError **error);
|
|
|
|
void (* init_events) (ClutterBackend *backend);
|
|
|
|
void (* init_features) (ClutterBackend *backend);
|
|
|
|
void (* add_options) (ClutterBackend *backend,
|
|
|
|
GOptionGroup *group);
|
|
|
|
ClutterFeatureFlags (* get_features) (ClutterBackend *backend);
|
2011-11-04 11:50:47 -04:00
|
|
|
CoglRenderer * (* get_renderer) (ClutterBackend *backend,
|
|
|
|
GError **error);
|
|
|
|
CoglDisplay * (* get_display) (ClutterBackend *backend,
|
|
|
|
CoglRenderer *renderer,
|
|
|
|
CoglSwapChain *swap_chain,
|
|
|
|
GError **error);
|
2010-10-21 06:49:37 -04:00
|
|
|
gboolean (* create_context) (ClutterBackend *backend,
|
|
|
|
GError **error);
|
|
|
|
void (* ensure_context) (ClutterBackend *backend,
|
|
|
|
ClutterStage *stage);
|
|
|
|
ClutterDeviceManager *(* get_device_manager) (ClutterBackend *backend);
|
|
|
|
|
|
|
|
void (* copy_event_data) (ClutterBackend *backend,
|
|
|
|
const ClutterEvent *src,
|
|
|
|
ClutterEvent *dest);
|
|
|
|
void (* free_event_data) (ClutterBackend *backend,
|
|
|
|
ClutterEvent *event);
|
|
|
|
|
event/x11: Rework the way we translate X11 events
This is a lump commit that is fairly difficult to break down without
either breaking bisecting or breaking the test cases.
The new design for handling X11 event translation works this way:
- ClutterBackend::translate_event() has been added as the central
point used by a ClutterBackend implementation to translate a
native event into a ClutterEvent;
- ClutterEventTranslator is a private interface that should be
implemented by backend-specific objects, like stage
implementations and ClutterDeviceManager sub-classes, and
allows dealing with class-specific event translation;
- ClutterStageX11 implements EventTranslator, and deals with the
stage-relative X11 events coming from the X11 event source;
- ClutterStageGLX overrides EventTranslator, in order to
deal with the INTEL_GLX_swap_event extension, and it chains up
to the X11 default implementation;
- ClutterDeviceManagerX11 has been split into two separate classes,
one that deals with core and (optionally) XI1 events, and the
other that deals with XI2 events; the selection is done at run-time,
since the core+XI1 and XI2 mechanisms are mutually exclusive.
All the other backends we officially support still use their own
custom event source and translation function, but the end goal is to
migrate them to the translate_event() virtual function, and have the
event source be a shared part of Clutter core.
2011-01-04 07:32:04 -05:00
|
|
|
gboolean (* translate_event) (ClutterBackend *backend,
|
|
|
|
gpointer native,
|
|
|
|
ClutterEvent *event);
|
|
|
|
|
2014-03-03 18:22:13 -05:00
|
|
|
PangoDirection (* get_keymap_direction) (ClutterBackend *backend);
|
|
|
|
|
2010-10-21 06:49:37 -04:00
|
|
|
/* signals */
|
|
|
|
void (* resolution_changed) (ClutterBackend *backend);
|
|
|
|
void (* font_changed) (ClutterBackend *backend);
|
|
|
|
void (* settings_changed) (ClutterBackend *backend);
|
|
|
|
};
|
|
|
|
|
2013-09-10 12:29:28 -04:00
|
|
|
ClutterBackend * _clutter_create_backend (void);
|
|
|
|
|
2012-01-12 08:31:21 -05:00
|
|
|
ClutterStageWindow * _clutter_backend_create_stage (ClutterBackend *backend,
|
|
|
|
ClutterStage *wrapper,
|
|
|
|
GError **error);
|
|
|
|
void _clutter_backend_ensure_context (ClutterBackend *backend,
|
|
|
|
ClutterStage *stage);
|
|
|
|
void _clutter_backend_ensure_context_internal (ClutterBackend *backend,
|
|
|
|
ClutterStage *stage);
|
|
|
|
gboolean _clutter_backend_create_context (ClutterBackend *backend,
|
|
|
|
GError **error);
|
|
|
|
|
|
|
|
void _clutter_backend_add_options (ClutterBackend *backend,
|
|
|
|
GOptionGroup *group);
|
|
|
|
gboolean _clutter_backend_pre_parse (ClutterBackend *backend,
|
|
|
|
GError **error);
|
|
|
|
gboolean _clutter_backend_post_parse (ClutterBackend *backend,
|
|
|
|
GError **error);
|
|
|
|
|
|
|
|
void _clutter_backend_init_events (ClutterBackend *backend);
|
|
|
|
void _clutter_backend_copy_event_data (ClutterBackend *backend,
|
|
|
|
const ClutterEvent *src,
|
|
|
|
ClutterEvent *dest);
|
|
|
|
void _clutter_backend_free_event_data (ClutterBackend *backend,
|
|
|
|
ClutterEvent *event);
|
|
|
|
gboolean _clutter_backend_translate_event (ClutterBackend *backend,
|
|
|
|
gpointer native,
|
|
|
|
ClutterEvent *event);
|
|
|
|
void _clutter_backend_add_event_translator (ClutterBackend *backend,
|
|
|
|
ClutterEventTranslator *translator);
|
|
|
|
void _clutter_backend_remove_event_translator (ClutterBackend *backend,
|
|
|
|
ClutterEventTranslator *translator);
|
|
|
|
|
|
|
|
ClutterFeatureFlags _clutter_backend_get_features (ClutterBackend *backend);
|
|
|
|
|
|
|
|
gfloat _clutter_backend_get_units_per_em (ClutterBackend *backend,
|
|
|
|
PangoFontDescription *font_desc);
|
|
|
|
gint32 _clutter_backend_get_units_serial (ClutterBackend *backend);
|
2011-02-09 07:20:56 -05:00
|
|
|
|
2014-03-03 18:22:13 -05:00
|
|
|
PangoDirection _clutter_backend_get_keymap_direction (ClutterBackend *backend);
|
|
|
|
|
2015-09-14 19:30:05 -04:00
|
|
|
void _clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend);
|
|
|
|
|
2015-12-10 11:52:45 -05:00
|
|
|
void clutter_set_allowed_drivers (const char *drivers);
|
2015-09-14 19:30:05 -04:00
|
|
|
|
2010-10-21 06:49:37 -04:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __CLUTTER_BACKEND_PRIVATE_H__ */
|