mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
backend: remove untested fruity backend
This backend hasn't been used for years now and so because it is untested code and almost certainly doesn't work any more it would be a burdon to continue trying to maintain it. Considering that we are now looking at moving OpenGL window system integration code down from Clutter backends into Cogl that will be easier if we don't have to consider this backend.
This commit is contained in:
parent
70767f08dc
commit
af366ad750
@ -210,9 +210,6 @@ Clutter has additional command line options for the configure script:
|
||||
win32:
|
||||
Microsoft Windows(tm) WGL backend.
|
||||
|
||||
fruity:
|
||||
Apple iPod Touch(tm)/iPhone(tm) backend. (EXPERIMENTAL)
|
||||
|
||||
--with-imagebackend=[gdk-pixbuf/quartz/internal]
|
||||
Select the image loading backend used by COGL
|
||||
|
||||
|
@ -536,29 +536,6 @@ clutterosx_includedir = $(clutter_includedir)/osx
|
||||
clutterosx_include_HEADERS = $(osx_source_h)
|
||||
endif # SUPPORT_OSX
|
||||
|
||||
# Fruity backend rules
|
||||
fruity_source_c = \
|
||||
$(srcdir)/fruity/clutter-backend-fruity.c \
|
||||
$(srcdir)/fruity/clutter-stage-fruity.c \
|
||||
$(srcdir)/fruity/clutter-fruity.c \
|
||||
$(NULL)
|
||||
|
||||
fruity_source_h = \
|
||||
$(srcdir)/fruity/clutter-backend-fruity.h \
|
||||
$(srcdir)/fruity/clutter-stage-fruity.h \
|
||||
$(srcdir)/fruity/clutter-fruity.h \
|
||||
$(NULL)
|
||||
|
||||
if SUPPORT_FRUITY
|
||||
AM_CFLAGS += -xobjective-c
|
||||
|
||||
backend_source_c_priv += $(fruity_source_c)
|
||||
backend_source_h_priv += $(fruity_source_h)
|
||||
|
||||
clutterfruity_includedir = $(clutter_includedir)/fruity
|
||||
clutterfruity_include_HEADERS = $(srcdir)/fruity/clutter-fruity.h
|
||||
endif # SUPPORT_FRUITY
|
||||
|
||||
# Wayland backend rules
|
||||
if SUPPORT_WAYLAND
|
||||
backend_source_h += \
|
||||
|
@ -665,19 +665,12 @@ clutter_main (void)
|
||||
loop = g_main_loop_new (NULL, TRUE);
|
||||
main_loops = g_slist_prepend (main_loops, loop);
|
||||
|
||||
#ifdef HAVE_CLUTTER_FRUITY
|
||||
/* clutter fruity creates an application that forwards events and manually
|
||||
* spins the mainloop
|
||||
*/
|
||||
clutter_fruity_main ();
|
||||
#else
|
||||
if (g_main_loop_is_running (main_loops->data))
|
||||
{
|
||||
clutter_threads_leave ();
|
||||
g_main_loop_run (loop);
|
||||
clutter_threads_enter ();
|
||||
}
|
||||
#endif
|
||||
|
||||
main_loops = g_slist_remove (main_loops, loop);
|
||||
|
||||
@ -1406,14 +1399,9 @@ pre_parse_hook (GOptionContext *context,
|
||||
if (env_string)
|
||||
clutter_disable_mipmap_text = TRUE;
|
||||
|
||||
#ifdef HAVE_CLUTTER_FRUITY
|
||||
/* we always enable fuzzy picking in the "fruity" backend */
|
||||
clutter_use_fuzzy_picking = TRUE;
|
||||
#else
|
||||
env_string = g_getenv ("CLUTTER_FUZZY_PICK");
|
||||
if (env_string)
|
||||
clutter_use_fuzzy_picking = TRUE;
|
||||
#endif /* HAVE_CLUTTER_FRUITY */
|
||||
|
||||
return _clutter_backend_pre_parse (backend, error);
|
||||
}
|
||||
|
@ -344,10 +344,6 @@ cogl_sources_c += \
|
||||
$(srcdir)/winsys/cogl-winsys-egl.c \
|
||||
$(srcdir)/winsys/cogl-winsys-stub.c
|
||||
endif
|
||||
if SUPPORT_EGL_PLATFORM_FRUITY
|
||||
cogl_sources_c += \
|
||||
$(srcdir)/winsys/cogl-winsys-fruity.c
|
||||
endif
|
||||
if SUPPORT_EGL_PLATFORM_DRM_SURFACELESS
|
||||
cogl_sources_c += \
|
||||
$(srcdir)/winsys/cogl-winsys-egl.c \
|
||||
|
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Cogl
|
||||
*
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Copyright (C) 2007,2008,2009 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/>.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "cogl.h"
|
||||
|
||||
CoglFuncPtr
|
||||
_cogl_winsys_get_proc_address (const char *name)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
@ -273,9 +273,7 @@ AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_POWERVR_X11, [false])
|
||||
AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_POWERVR_NULL, [false])
|
||||
AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_POWERVR_GDL, [false])
|
||||
AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_DRM_SURFACELESS, [false])
|
||||
AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_FRUITY, [false])
|
||||
AM_CONDITIONAL(SUPPORT_OSX, [false])
|
||||
AM_CONDITIONAL(SUPPORT_FRUITY, [false])
|
||||
AM_CONDITIONAL(SUPPORT_WIN32, [false])
|
||||
AM_CONDITIONAL(SUPPORT_CEX100, [false])
|
||||
AM_CONDITIONAL(SUPPORT_WAYLAND, [false])
|
||||
|
@ -1,302 +0,0 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "clutter-backend-fruity.h"
|
||||
#include "clutter-stage-fruity.h"
|
||||
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-stage-private.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
static ClutterBackendEGL *backend_singleton = NULL;
|
||||
|
||||
|
||||
G_DEFINE_TYPE (ClutterBackendEGL, clutter_backend_egl, CLUTTER_TYPE_BACKEND);
|
||||
|
||||
static gboolean
|
||||
clutter_backend_egl_pre_parse (ClutterBackend *backend,
|
||||
GError **error)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_backend_egl_post_parse (ClutterBackend *backend,
|
||||
GError **error)
|
||||
{
|
||||
ClutterBackendEGL *backend_egl = CLUTTER_BACKEND_EGL(backend);
|
||||
EGLBoolean status;
|
||||
|
||||
backend_egl->edpy = eglGetDisplay (EGL_DEFAULT_DISPLAY);
|
||||
|
||||
status = eglInitialize (backend_egl->edpy,
|
||||
&backend_egl->egl_version_major,
|
||||
&backend_egl->egl_version_minor);
|
||||
|
||||
if (status != EGL_TRUE)
|
||||
{
|
||||
g_set_error (error, CLUTTER_INIT_ERROR,
|
||||
CLUTTER_INIT_ERROR_BACKEND,
|
||||
"Unable to Initialize EGL");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "EGL Reports version %i.%i",
|
||||
backend_egl->egl_version_major,
|
||||
backend_egl->egl_version_minor);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_egl_ensure_context (ClutterBackend *backend,
|
||||
ClutterStage *stage)
|
||||
{
|
||||
/* not doing anything since we only have one context */
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_egl_redraw (ClutterBackend *backend,
|
||||
ClutterStage *stage)
|
||||
{
|
||||
ClutterBackendEGL *backend_egl = CLUTTER_BACKEND_EGL (backend);
|
||||
ClutterStageEGL *stage_egl;
|
||||
ClutterStageWindow *impl;
|
||||
|
||||
impl = _clutter_stage_get_window (stage);
|
||||
if (!impl)
|
||||
return;
|
||||
|
||||
g_assert (CLUTTER_IS_STAGE_EGL (impl));
|
||||
stage_egl = CLUTTER_STAGE_EGL (impl);
|
||||
|
||||
eglWaitNative (EGL_CORE_NATIVE_ENGINE);
|
||||
_clutter_stage_do_paint (stage, NULL);
|
||||
cogl_flush ();
|
||||
eglWaitGL();
|
||||
eglSwapBuffers (backend_egl->edpy, stage_egl->egl_surface);
|
||||
}
|
||||
|
||||
static ClutterActor *
|
||||
clutter_backend_egl_create_stage (ClutterBackend *backend,
|
||||
ClutterStage *wrapper,
|
||||
GError **error)
|
||||
{
|
||||
ClutterBackendEGL *backend_egl = CLUTTER_BACKEND_EGL (backend);
|
||||
ClutterStageEGL *stage_egl;
|
||||
ClutterActor *stage;
|
||||
|
||||
if (backend_egl->stage)
|
||||
{
|
||||
g_warning ("The EGL native backend does not support multiple stages");
|
||||
return backend_egl->stage;
|
||||
}
|
||||
|
||||
stage = g_object_new (CLUTTER_TYPE_STAGE_FRUITY, NULL);
|
||||
|
||||
stage_egl = CLUTTER_STAGE_EGL (stage);
|
||||
stage_egl->backend = backend_egl;
|
||||
stage_egl->wrapper = wrapper;
|
||||
|
||||
backend_egl->stage = CLUTTER_ACTOR (stage_egl);
|
||||
|
||||
return stage;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
clutter_backend_egl_init_events (ClutterBackend *backend)
|
||||
{
|
||||
}
|
||||
|
||||
static const GOptionEntry entries[] =
|
||||
{
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static void
|
||||
clutter_backend_egl_finalize (GObject *gobject)
|
||||
{
|
||||
if (backend_singleton)
|
||||
backend_singleton = NULL;
|
||||
|
||||
G_OBJECT_CLASS (clutter_backend_egl_parent_class)->finalize (gobject);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_egl_dispose (GObject *gobject)
|
||||
{
|
||||
ClutterBackendEGL *backend_egl = CLUTTER_BACKEND_EGL (gobject);
|
||||
|
||||
_clutter_events_uninit (CLUTTER_BACKEND (backend_egl));
|
||||
|
||||
if (backend_egl->egl_context)
|
||||
{
|
||||
eglDestroyContext (backend_egl->edpy, backend_egl->egl_context);
|
||||
backend_egl->egl_context = NULL;
|
||||
}
|
||||
|
||||
if (backend_egl->edpy)
|
||||
{
|
||||
eglTerminate (backend_egl->edpy);
|
||||
backend_egl->edpy = 0;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (clutter_backend_egl_parent_class)->dispose (gobject);
|
||||
}
|
||||
|
||||
static GObject *
|
||||
clutter_backend_egl_constructor (GType gtype,
|
||||
guint n_params,
|
||||
GObjectConstructParam *params)
|
||||
{
|
||||
GObjectClass *parent_class;
|
||||
GObject *retval;
|
||||
|
||||
if (!backend_singleton)
|
||||
{
|
||||
parent_class = G_OBJECT_CLASS (clutter_backend_egl_parent_class);
|
||||
retval = parent_class->constructor (gtype, n_params, params);
|
||||
|
||||
backend_singleton = CLUTTER_BACKEND_EGL (retval);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
g_warning ("Attempting to create a new backend object. This should "
|
||||
"never happen, so we return the singleton instance.");
|
||||
|
||||
return g_object_ref (backend_singleton);
|
||||
}
|
||||
|
||||
static ClutterFeatureFlags
|
||||
clutter_backend_egl_get_features (ClutterBackend *backend)
|
||||
{
|
||||
ClutterBackendEGL *backend_egl = CLUTTER_BACKEND_EGL (backend);
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "Checking features\n"
|
||||
"GL_VENDOR: %s\n"
|
||||
"GL_RENDERER: %s\n"
|
||||
"GL_VERSION: %s\n"
|
||||
"EGL_VENDOR: %s\n"
|
||||
"EGL_VERSION: %s\n"
|
||||
"EGL_EXTENSIONS: %s\n",
|
||||
glGetString (GL_VENDOR),
|
||||
glGetString (GL_RENDERER),
|
||||
glGetString (GL_VERSION),
|
||||
eglQueryString (backend_egl->edpy, EGL_VENDOR),
|
||||
eglQueryString (backend_egl->edpy, EGL_VERSION),
|
||||
eglQueryString (backend_egl->edpy, EGL_EXTENSIONS));
|
||||
|
||||
return CLUTTER_FEATURE_STAGE_STATIC;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_egl_class_init (ClutterBackendEGLClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
ClutterBackendClass *backend_class = CLUTTER_BACKEND_CLASS (klass);
|
||||
|
||||
gobject_class->constructor = clutter_backend_egl_constructor;
|
||||
gobject_class->dispose = clutter_backend_egl_dispose;
|
||||
gobject_class->finalize = clutter_backend_egl_finalize;
|
||||
|
||||
backend_class->pre_parse = clutter_backend_egl_pre_parse;
|
||||
backend_class->post_parse = clutter_backend_egl_post_parse;
|
||||
backend_class->init_events = clutter_backend_egl_init_events;
|
||||
backend_class->create_stage = clutter_backend_egl_create_stage;
|
||||
backend_class->ensure_context = clutter_backend_egl_ensure_context;
|
||||
backend_class->redraw = clutter_backend_egl_redraw;
|
||||
backend_class->get_features = clutter_backend_egl_get_features;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_egl_init (ClutterBackendEGL *backend_egl)
|
||||
{
|
||||
ClutterBackend *backend = CLUTTER_BACKEND (backend_egl);
|
||||
ClutterMainContext *context;
|
||||
int i;
|
||||
|
||||
clutter_backend_set_resolution (backend, 96.0);
|
||||
clutter_backend_set_double_click_time (backend, 250);
|
||||
clutter_backend_set_double_click_distance (backend, 5);
|
||||
|
||||
context = _clutter_context_get_default ();
|
||||
|
||||
#define MAX_FINGERS 5
|
||||
|
||||
for (i = 0; i < MAX_FINGERS; i++)
|
||||
{
|
||||
ClutterFruityFingerDevice *device;
|
||||
|
||||
device = g_new0 (ClutterFruityFingerDevice, 1);
|
||||
context->input_devices = g_slist_append (context->input_devices, device);
|
||||
|
||||
device->device.id = i;
|
||||
device->device.click_count = 0;
|
||||
device->device.previous_time = 0;
|
||||
device->device.previous_x = -1;
|
||||
device->device.previous_y = -1;
|
||||
device->device.previous_button_number = -1;
|
||||
device->x = 0;
|
||||
device->y = 0;
|
||||
}
|
||||
|
||||
#undef MAX_FINGERS
|
||||
}
|
||||
|
||||
GType
|
||||
_clutter_backend_impl_get_type (void)
|
||||
{
|
||||
return clutter_backend_egl_get_type ();
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_egl_display:
|
||||
*
|
||||
* Retrieves the <structname>EGLDisplay</structname> used by Clutter.
|
||||
*
|
||||
* Return value: the EGL display
|
||||
*
|
||||
* Deprecated: 1.6: Use clutter_fruity_get_egl_display() instead
|
||||
*
|
||||
* Since: 0.6
|
||||
*/
|
||||
EGLDisplay
|
||||
clutter_egl_display (void)
|
||||
{
|
||||
return backend_singleton->edpy;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_fruity_egl_display:
|
||||
*
|
||||
* Retrieves the <structname>EGLDisplay</structname> used by Clutter.
|
||||
*
|
||||
* Return value: the EGL display
|
||||
*
|
||||
* Since: 1.6
|
||||
*/
|
||||
EGLDisplay
|
||||
clutter_fruity_get_egl_display (void)
|
||||
{
|
||||
if (backend_singleton == NULL)
|
||||
{
|
||||
g_critical ("%s has been called before clutter_init()", G_STRFUNC);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return backend_singleton->edpy;
|
||||
}
|
||||
|
||||
void *rpl_malloc (size_t allocation)
|
||||
{
|
||||
return g_malloc (allocation);
|
||||
}
|
||||
|
||||
void rpl_free (void *ptr)
|
||||
{
|
||||
g_free (ptr);
|
||||
}
|
@ -1,93 +0,0 @@
|
||||
/* Clutter.
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
* Copyright (C) 2006-2007 OpenedHand
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __CLUTTER_BACKEND_EGL_H__
|
||||
#define __CLUTTER_BACKEND_EGL_H__
|
||||
|
||||
/*#ifdef HAVE_CLUTTER_FRUITY */
|
||||
/* extra include needed for the GLES header for arm-apple-darwin */
|
||||
#include <CoreSurface/CoreSurface.h>
|
||||
/*#endif*/
|
||||
|
||||
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/egl.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "clutter-backend-private.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_BACKEND_FRUITY (clutter_backend_egl_get_type ())
|
||||
#define CLUTTER_BACKEND_EGL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BACKEND_FRUITY, ClutterBackendEGL))
|
||||
#define CLUTTER_IS_BACKEND_EGL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BACKEND_FRUITY))
|
||||
#define CLUTTER_BACKEND_EGL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BACKEND_FRUITY, ClutterBackendEGLClass))
|
||||
#define CLUTTER_IS_BACKEND_EGL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BACKEND_FRUITY))
|
||||
#define CLUTTER_BACKEND_EGL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BACKEND_FRUITY, ClutterBackendEGLClass))
|
||||
|
||||
typedef struct _ClutterBackendEGL ClutterBackendEGL;
|
||||
typedef struct _ClutterBackendEGLClass ClutterBackendEGLClass;
|
||||
typedef struct _ClutterFruityFingerDevice ClutterFruityFingerDevice;
|
||||
|
||||
struct _ClutterFruityFingerDevice
|
||||
{
|
||||
ClutterInputDevice device;
|
||||
int x, y;
|
||||
gboolean is_down;
|
||||
};
|
||||
|
||||
struct _ClutterBackendEGL
|
||||
{
|
||||
ClutterBackend parent_instance;
|
||||
|
||||
/* EGL Specific */
|
||||
EGLDisplay edpy;
|
||||
EGLSurface egl_surface;
|
||||
EGLContext egl_context;
|
||||
|
||||
gint egl_version_major;
|
||||
gint egl_version_minor;
|
||||
|
||||
/* main stage singleton */
|
||||
ClutterActor *stage;
|
||||
|
||||
/* event source */
|
||||
GSource *event_source;
|
||||
|
||||
int num_fingers;
|
||||
|
||||
/*< private >*/
|
||||
};
|
||||
|
||||
struct _ClutterBackendEGLClass
|
||||
{
|
||||
ClutterBackendClass parent_class;
|
||||
};
|
||||
|
||||
GType clutter_backend_egl_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void _clutter_events_init (ClutterBackend *backend);
|
||||
void _clutter_events_uninit (ClutterBackend *backend);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BACKEND_EGL_H__ */
|
@ -1,443 +0,0 @@
|
||||
#include <clutter/clutter.h>
|
||||
#include "clutter-backend-fruity.h"
|
||||
#include "clutter-stage-fruity.h"
|
||||
#include "../clutter-main.h"
|
||||
#include "../clutter-private.h"
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreFoundation/CoreFoundation.h>
|
||||
#include <GraphicsServices/GraphicsServices.h>
|
||||
#include <OpenGLES/gl.h>
|
||||
#include <glib.h>
|
||||
|
||||
#import <UIKit/UIView.h>
|
||||
#import <UIKit/UITextView.h>
|
||||
#import <UIKit/UIHardware.h>
|
||||
#import <UIKit/UINavigationBar.h>
|
||||
#import <UIKit/UIView-Geometry.h>
|
||||
#include "clutter-fruity.h"
|
||||
|
||||
static gboolean alive = TRUE;
|
||||
|
||||
@interface StageView : UIView
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation StageView
|
||||
|
||||
struct GSPathPoint {
|
||||
char unk0;
|
||||
char unk1;
|
||||
short int status;
|
||||
int unk2;
|
||||
float x;
|
||||
float y;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
int unk0;
|
||||
int unk1;
|
||||
int type;
|
||||
int subtype;
|
||||
float unk2;
|
||||
float unk3;
|
||||
float x;
|
||||
float y;
|
||||
int timestamp1;
|
||||
int timestamp2;
|
||||
int unk4;
|
||||
int modifierFlags;
|
||||
int unk5;
|
||||
int unk6;
|
||||
int mouseEvent;
|
||||
short int dx;
|
||||
short int fingerCount;
|
||||
int unk7;
|
||||
int unk8;
|
||||
char unk9;
|
||||
char numPoints;
|
||||
short int unk10;
|
||||
struct GSPathPoint points[10];
|
||||
} MEvent;
|
||||
|
||||
#define MAX_FINGERS 5
|
||||
|
||||
- (void)doEvent:(GSEvent*)gs_event
|
||||
{
|
||||
ClutterBackendEGL *ba = CLUTTER_BACKEND_EGL (clutter_get_default_backend());
|
||||
int i, j;
|
||||
ClutterMainContext *context;
|
||||
ClutterStage *stage = CLUTTER_STAGE_EGL(ba->stage)->wrapper;
|
||||
MEvent *event = (MEvent*)gs_event;
|
||||
|
||||
context = _clutter_context_get_default ();
|
||||
|
||||
bool mapped[MAX_FINGERS] = {false, false, false, false, false}; /* an event has been mapped to this device */
|
||||
int evs[MAX_FINGERS] = {0,0,0,0,0};
|
||||
|
||||
/* using numPoints (with the points[i].status check) seems to
|
||||
* be no different from using numFingers :/ */
|
||||
|
||||
for (i = 0; i < event->numPoints; i++)
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
if (event->points[i].status != 3) /* skip if finger not down */
|
||||
continue;
|
||||
|
||||
/* NSLog(@"IncomingEvent: %d, pos: %f, %f", i, event->points[i].x, event->points[i].y);*/
|
||||
|
||||
/* check if this finger maps to one of the existing devices */
|
||||
for (j = 0; j < MAX_FINGERS; j++)
|
||||
{
|
||||
ClutterFruityFingerDevice *dev;
|
||||
|
||||
if (mapped[j])
|
||||
continue; /* we're already using device j */
|
||||
|
||||
dev = g_slist_nth_data (context->input_devices, j);
|
||||
|
||||
if (!dev->is_down)
|
||||
continue; /* device isn't down we cannot really match against it */
|
||||
|
||||
int dist = (event->points[i].x - dev->x) * (event->points[i].x - dev->x) +
|
||||
(event->points[i].y - dev->y) * (event->points[i].y - dev->y);
|
||||
if (dist < 20 * 20)
|
||||
{
|
||||
found = true;
|
||||
mapped[j] = true;
|
||||
|
||||
/* only generate motion events if we've changed position */
|
||||
if (dist >= 1)
|
||||
{
|
||||
dev->x = event->points[i].x;
|
||||
dev->y = event->points[i].y;
|
||||
// MOUSEMOVE
|
||||
/*NSLog(@"MouseMove: %d, pos: %d, %d", j, dev->x, dev->y);*/
|
||||
evs[j] = 3;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
ClutterFruityFingerDevice *dev;
|
||||
|
||||
for (j = 0; j < MAX_FINGERS; j++)
|
||||
{
|
||||
dev = g_slist_nth_data (context->input_devices, j);
|
||||
if (!dev->is_down)
|
||||
break;
|
||||
}
|
||||
|
||||
dev->x = event->points[i].x;
|
||||
dev->y = event->points[i].y;
|
||||
g_assert (dev->is_down == FALSE);
|
||||
dev->is_down = TRUE;
|
||||
|
||||
mapped[j] = true;
|
||||
|
||||
// MOUSEDOWN
|
||||
/* NSLog(@"MouseDown: %d, pos: %d, %d", j, event->points[i].x, dev->x, dev->y); */
|
||||
evs[j] = 2;
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; j < MAX_FINGERS; j++)
|
||||
{
|
||||
ClutterFruityFingerDevice *dev;
|
||||
|
||||
dev = g_slist_nth_data (context->input_devices, j);
|
||||
|
||||
if (dev->is_down && !mapped[j])
|
||||
{
|
||||
// MOUSEUP
|
||||
/* NSLog(@"MouseUp: %d, pos: %d, %d", j, dev->x, dev->y); */
|
||||
evs[j] = 1;
|
||||
dev->is_down = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Now I guess go through device list and deliver an event for each
|
||||
* if valid and devliver if so...
|
||||
*/
|
||||
{
|
||||
i = 0;
|
||||
GSList *list_it;
|
||||
|
||||
for (list_it = context->input_devices;
|
||||
list_it != NULL;
|
||||
list_it = list_it->next)
|
||||
{
|
||||
ClutterFruityFingerDevice *dev = (ClutterFruityFingerDevice *)list_it->data;
|
||||
|
||||
if (evs[i] > 0)
|
||||
{
|
||||
ClutterEvent *cev;
|
||||
|
||||
if (evs[i] == 1)
|
||||
{
|
||||
cev = clutter_event_new (CLUTTER_BUTTON_RELEASE);
|
||||
cev->button.device = (ClutterInputDevice *)dev;
|
||||
cev->button.x = dev->x;
|
||||
cev->button.y = dev->y;
|
||||
cev->button.button = 1;
|
||||
cev->button.time = clutter_get_timestamp () / 1000;
|
||||
cev->any.stage = stage;
|
||||
clutter_do_event (cev);
|
||||
clutter_event_free (cev);
|
||||
}
|
||||
else if (evs[i] == 2)
|
||||
{
|
||||
cev = clutter_event_new (CLUTTER_BUTTON_PRESS);
|
||||
cev->button.device = (ClutterInputDevice *)dev;
|
||||
cev->button.x = dev->x;
|
||||
cev->button.y = dev->y;
|
||||
cev->button.button = 1;
|
||||
cev->button.time = clutter_get_timestamp () / 1000;
|
||||
cev->any.stage = stage;
|
||||
clutter_do_event (cev);
|
||||
clutter_event_free (cev);
|
||||
}
|
||||
else /* evs = 3, motion */
|
||||
{
|
||||
cev = clutter_event_new (CLUTTER_MOTION);
|
||||
cev->motion.device = (ClutterInputDevice *)dev;
|
||||
cev->motion.x = dev->x;
|
||||
cev->motion.y = dev->y;
|
||||
cev->motion.time = clutter_get_timestamp () / 1000;
|
||||
cev->any.stage = stage;
|
||||
clutter_do_event (cev);
|
||||
clutter_event_free (cev);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0 // old style
|
||||
- (void) mouseDown:(GSEvent*)event
|
||||
{
|
||||
CGPoint location= GSEventGetLocationInWindow(event);
|
||||
ClutterBackendEGL *backend_fruity = CLUTTER_BACKEND_EGL (clutter_get_default_backend());
|
||||
ClutterStage *stage = CLUTTER_STAGE_EGL(backend_fruity->stage)->wrapper;
|
||||
ClutterEvent *cev;
|
||||
float x = location.x;
|
||||
float y = location.y;
|
||||
|
||||
cev = clutter_event_new (CLUTTER_BUTTON_PRESS);
|
||||
cev->button.x = x;
|
||||
cev->button.y = y;
|
||||
cev->button.button = 1;
|
||||
cev->button.time = clutter_get_timestamp () / 1000;
|
||||
cev->any.stage = stage;
|
||||
|
||||
clutter_do_event (cev);
|
||||
clutter_event_free (cev);
|
||||
}
|
||||
|
||||
- (void) mouseUp:(GSEvent*)event
|
||||
{
|
||||
ClutterEvent *cev;
|
||||
ClutterBackendEGL *backend_fruity = CLUTTER_BACKEND_EGL (clutter_get_default_backend());
|
||||
ClutterStage *stage = CLUTTER_STAGE_EGL(backend_fruity->stage)->wrapper;
|
||||
CGPoint location= GSEventGetLocationInWindow(event);
|
||||
float x = location.x;
|
||||
float y = location.y;
|
||||
|
||||
cev = clutter_event_new (CLUTTER_BUTTON_RELEASE);
|
||||
cev->button.x = x;
|
||||
cev->button.y = y;
|
||||
cev->button.button = 1;
|
||||
cev->button.time = clutter_get_timestamp () / 1000;
|
||||
cev->any.stage = stage;
|
||||
clutter_do_event (cev);
|
||||
clutter_event_free (cev);
|
||||
}
|
||||
|
||||
- (void) mouseDragged:(GSEvent*)event
|
||||
{
|
||||
ClutterEvent *cev;
|
||||
ClutterBackendEGL *backend_fruity = CLUTTER_BACKEND_EGL (clutter_get_default_backend());
|
||||
ClutterStage *stage = CLUTTER_STAGE_EGL(backend_fruity->stage)->wrapper;
|
||||
CGPoint location= GSEventGetLocationInWindow(event);
|
||||
float x = location.x;
|
||||
float y = location.y;
|
||||
|
||||
cev = clutter_event_new (CLUTTER_MOTION);
|
||||
cev->motion.x = x;
|
||||
cev->motion.y = y;
|
||||
cev->motion.time = clutter_get_timestamp () / 1000;
|
||||
cev->any.stage = stage;
|
||||
clutter_do_event (cev);
|
||||
clutter_event_free (cev);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* New... */
|
||||
|
||||
#if 0
|
||||
- (void)gestureChanged:(GSEvent*)event {
|
||||
NSLog(@"gestureChanged:");
|
||||
[self doEvent: event];
|
||||
}
|
||||
|
||||
- (void)gestureEnded:(GSEvent*)event {
|
||||
NSLog(@"gestureEnded:");
|
||||
[self doEvent: event];
|
||||
}
|
||||
|
||||
- (void)gestureStarted:(GSEvent*)event {
|
||||
/*NSLog(@"gestureStarted:");*/
|
||||
[self doEvent: event];
|
||||
}
|
||||
#endif
|
||||
|
||||
- (void)mouseDown:(GSEvent*)event {
|
||||
/*NSLog(@"mouseDown:");*/
|
||||
[self doEvent: event];
|
||||
}
|
||||
|
||||
- (void)mouseDragged:(GSEvent*)event {
|
||||
/*NSLog(@"mouseDragged:");*/
|
||||
[self doEvent: event];
|
||||
}
|
||||
|
||||
- (void)mouseEntered:(GSEvent*)event {
|
||||
/*NSLog(@"mouseEntered:");*/
|
||||
[self doEvent: event];
|
||||
}
|
||||
|
||||
- (void)mouseExited:(GSEvent*)event {
|
||||
/*NSLog(@"mouseExited:");*/
|
||||
[self doEvent: event];
|
||||
}
|
||||
|
||||
- (void)mouseMoved:(GSEvent*)event {
|
||||
/*NSLog(@"mouseMoved:");*/
|
||||
[self doEvent: event];
|
||||
}
|
||||
|
||||
- (void)mouseUp:(GSEvent*)event {
|
||||
/*NSLog(@"mouseUp:");*/
|
||||
[self doEvent: event];
|
||||
}
|
||||
|
||||
- (void)view:(UIView *)view handleTapWithCount:(int)count event:(GSEvent *)event {
|
||||
/*NSLog(@"handleTapWithCount: %d", count);*/
|
||||
[self doEvent: event];
|
||||
}
|
||||
|
||||
- (double)viewTouchPauseThreshold:(UIView *)view {
|
||||
return 0.5;
|
||||
}
|
||||
|
||||
- (BOOL)isFirstResponder {
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface ClutterUIKit : UIApplication
|
||||
{
|
||||
StageView *stage_view;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation ClutterUIKit
|
||||
|
||||
- (void) applicationDidFinishLaunching: (id) unused
|
||||
{
|
||||
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
[UIHardware _setStatusBarHeight:0.0f];
|
||||
[self setStatusBarMode:2 orientation:0 duration:0.0f fenceID:0];
|
||||
|
||||
CGRect screenRect = [UIHardware fullScreenApplicationContentRect];
|
||||
UIWindow* window = [[UIWindow alloc] initWithContentRect: screenRect];
|
||||
|
||||
[window orderFront: self];
|
||||
[window makeKey: self];
|
||||
[window _setHidden: NO];
|
||||
|
||||
[NSTimer
|
||||
scheduledTimerWithTimeInterval:0.0025
|
||||
target: self
|
||||
selector: @selector(update)
|
||||
userInfo: nil
|
||||
repeats: YES
|
||||
];
|
||||
|
||||
StageView *stageView = [StageView alloc];
|
||||
[stageView initWithFrame: screenRect];
|
||||
[window setContentView: stageView];
|
||||
|
||||
stage_view = stageView;
|
||||
|
||||
[pool release];
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate
|
||||
{
|
||||
/* FIXME: here we should do things to shut down the uikit application */
|
||||
[stage_view release];
|
||||
ClutterBackendEGL *backend_fruity = CLUTTER_BACKEND_EGL (clutter_get_default_backend());
|
||||
ClutterStageEGL *stage_fruity;
|
||||
stage_fruity = CLUTTER_STAGE_EGL(backend_fruity->stage);
|
||||
|
||||
alive = FALSE;
|
||||
/* FIXME why is this unrealize here? is the intent to destroy the stage?
|
||||
* or hide it? Trying to clean up all manual unrealization so
|
||||
* clutter_actor_unrealize() can be made private to clutter-actor.c
|
||||
*/
|
||||
clutter_actor_unrealize (CLUTTER_ACTOR (stage_fruity));
|
||||
clutter_main_quit ();
|
||||
}
|
||||
|
||||
- (void)applicationWillSuspend
|
||||
{
|
||||
ClutterBackendEGL *backend_fruity = CLUTTER_BACKEND_EGL (clutter_get_default_backend());
|
||||
ClutterStageEGL *stage_fruity;
|
||||
stage_fruity = CLUTTER_STAGE_EGL(backend_fruity->stage);
|
||||
alive = FALSE;
|
||||
}
|
||||
|
||||
- (void)applicationDidResumeFromUnderLock
|
||||
{
|
||||
alive = TRUE;
|
||||
[stage_view setNeedsDisplay];
|
||||
}
|
||||
|
||||
- (void) update
|
||||
{
|
||||
if (alive && g_main_context_pending (NULL))
|
||||
g_main_context_iteration (NULL, FALSE);
|
||||
}
|
||||
|
||||
- (id)initWithFrame:(struct CGRect)frame {
|
||||
[super initWithFrame: frame];
|
||||
[super setTapDelegate: self];
|
||||
[super setGestureDelegate: self];
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
void clutter_fruity_main (void)
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
UIApplicationMain(0, NULL, [ClutterUIKit class]);
|
||||
[pool release];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __CLUTTER_FRUITY_H__
|
||||
#define __CLUTTER_FRUITY_H__
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#if HAVE_CLUTTER_FRUITY
|
||||
/* extra include needed for the GLES header for arm-apple-darwin */
|
||||
#include <CoreSurface/CoreSurface.h>
|
||||
#endif
|
||||
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/egl.h>
|
||||
|
||||
#include <clutter/clutter-stage.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#ifndef CLUTTER_DISABLE_DEPRECATED
|
||||
EGLDisplay clutter_egl_display (void);
|
||||
#endif
|
||||
|
||||
EGLDisplay clutter_fruity_get_egl_display (void);
|
||||
|
||||
void clutter_uikit_main (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_EGL_H__ */
|
@ -1,259 +0,0 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "clutter-stage-fruity.h"
|
||||
#include "clutter-fruity.h"
|
||||
#include "clutter-backend-fruity.h"
|
||||
|
||||
#include "../clutter-main.h"
|
||||
#include "../clutter-feature.h"
|
||||
#include "../clutter-color.h"
|
||||
#include "../clutter-util.h"
|
||||
#include "../clutter-event.h"
|
||||
#include "../clutter-enum-types.h"
|
||||
#include "../clutter-private.h"
|
||||
#include "../clutter-debug.h"
|
||||
#include "../clutter-units.h"
|
||||
#include "../clutter-stage.h"
|
||||
#include "../clutter-stage-window.h"
|
||||
|
||||
static void clutter_stage_window_iface_init (ClutterStageWindowIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (ClutterStageEGL,
|
||||
clutter_stage_egl,
|
||||
CLUTTER_TYPE_ACTOR,
|
||||
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_STAGE_WINDOW,
|
||||
clutter_stage_window_iface_init));
|
||||
|
||||
static void
|
||||
clutter_stage_egl_show (ClutterActor *actor)
|
||||
{
|
||||
CLUTTER_ACTOR_SET_FLAGS (actor, CLUTTER_ACTOR_MAPPED);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_egl_hide (ClutterActor *actor)
|
||||
{
|
||||
CLUTTER_ACTOR_UNSET_FLAGS (actor, CLUTTER_ACTOR_MAPPED);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_egl_unrealize (ClutterActor *actor)
|
||||
{
|
||||
ClutterStageEGL *stage_egl = CLUTTER_STAGE_EGL (actor);
|
||||
|
||||
CLUTTER_MARK();
|
||||
|
||||
if (CLUTTER_ACTOR_CLASS (clutter_stage_egl_parent_class)->unrealize != NULL)
|
||||
CLUTTER_ACTOR_CLASS (clutter_stage_egl_parent_class)->unrealize (actor);
|
||||
|
||||
if (stage_egl->egl_surface)
|
||||
{
|
||||
eglDestroySurface (clutter_fruity_get_egl_display (),
|
||||
stage_egl->egl_surface);
|
||||
stage_egl->egl_surface = EGL_NO_SURFACE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_egl_realize (ClutterActor *actor)
|
||||
{
|
||||
ClutterStageEGL *stage_egl = CLUTTER_STAGE_EGL (actor);
|
||||
ClutterBackendEGL *backend_egl;
|
||||
EGLConfig configs[2];
|
||||
EGLint config_count;
|
||||
EGLBoolean status;
|
||||
EGLint cfg_attribs[] = {
|
||||
EGL_BUFFER_SIZE, EGL_DONT_CARE,
|
||||
EGL_RED_SIZE, 5,
|
||||
EGL_GREEN_SIZE, 6,
|
||||
EGL_BLUE_SIZE, 5,
|
||||
EGL_DEPTH_SIZE, 16,
|
||||
EGL_ALPHA_SIZE, EGL_DONT_CARE,
|
||||
EGL_STENCIL_SIZE, 2,
|
||||
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
||||
EGL_NONE };
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "Realizing main stage");
|
||||
|
||||
backend_egl = CLUTTER_BACKEND_EGL (clutter_get_default_backend ());
|
||||
|
||||
status = eglGetConfigs (backend_egl->edpy,
|
||||
configs,
|
||||
2,
|
||||
&config_count);
|
||||
|
||||
if (status != EGL_TRUE)
|
||||
g_warning ("eglGetConfigs failed");
|
||||
|
||||
status = eglChooseConfig (backend_egl->edpy,
|
||||
cfg_attribs,
|
||||
configs,
|
||||
G_N_ELEMENTS (configs),
|
||||
&config_count);
|
||||
|
||||
if (status != EGL_TRUE)
|
||||
{
|
||||
g_critical ("eglChooseConfig failed");
|
||||
CLUTTER_ACTOR_UNSET_FLAGS (actor, CLUTTER_ACTOR_REALIZED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (stage_egl->egl_surface != EGL_NO_SURFACE)
|
||||
{
|
||||
eglDestroySurface (backend_egl->edpy, stage_egl->egl_surface);
|
||||
stage_egl->egl_surface = EGL_NO_SURFACE;
|
||||
}
|
||||
|
||||
if (backend_egl->egl_context)
|
||||
{
|
||||
eglDestroyContext (backend_egl->edpy, backend_egl->egl_context);
|
||||
backend_egl->egl_context = NULL;
|
||||
}
|
||||
|
||||
stage_egl->egl_surface =
|
||||
eglCreateWindowSurface (backend_egl->edpy,
|
||||
configs[0],
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
|
||||
|
||||
if (stage_egl->egl_surface == EGL_NO_SURFACE)
|
||||
{
|
||||
g_critical ("Unable to create an EGL surface");
|
||||
CLUTTER_ACTOR_UNSET_FLAGS (actor, CLUTTER_ACTOR_REALIZED);
|
||||
return;
|
||||
}
|
||||
|
||||
eglQuerySurface (backend_egl->edpy,
|
||||
stage_egl->egl_surface,
|
||||
EGL_WIDTH,
|
||||
&stage_egl->surface_width);
|
||||
|
||||
eglQuerySurface (backend_egl->edpy,
|
||||
stage_egl->egl_surface,
|
||||
EGL_HEIGHT,
|
||||
&stage_egl->surface_height);
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "EGL surface is %ix%i",
|
||||
stage_egl->surface_width,
|
||||
stage_egl->surface_height);
|
||||
|
||||
|
||||
if (G_UNLIKELY (backend_egl->egl_context == NULL))
|
||||
{
|
||||
CLUTTER_NOTE (GL, "Creating EGL Context");
|
||||
|
||||
backend_egl->egl_context = eglCreateContext (backend_egl->edpy,
|
||||
configs[0],
|
||||
EGL_NO_CONTEXT,
|
||||
NULL);
|
||||
|
||||
if (backend_egl->egl_context == EGL_NO_CONTEXT)
|
||||
{
|
||||
g_critical ("Unable to create a suitable EGL context");
|
||||
|
||||
CLUTTER_ACTOR_UNSET_FLAGS (actor, CLUTTER_ACTOR_REALIZED);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* this will make sure to set the current context */
|
||||
CLUTTER_NOTE (BACKEND, "Setting context");
|
||||
|
||||
/* this should be done in ClutterBackend::ensure_context */
|
||||
status = eglMakeCurrent (backend_egl->edpy,
|
||||
stage_egl->egl_surface,
|
||||
stage_egl->egl_surface,
|
||||
backend_egl->egl_context);
|
||||
|
||||
if (status != EGL_TRUE)
|
||||
{
|
||||
g_critical ("eglMakeCurrent failed");
|
||||
CLUTTER_ACTOR_UNSET_FLAGS (actor, CLUTTER_ACTOR_REALIZED);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_egl_get_preferred_width (ClutterActor *self,
|
||||
gfloat for_height,
|
||||
gfloat *min_width_p,
|
||||
gfloat *natural_width_p)
|
||||
{
|
||||
ClutterStageEGL *stage_egl = CLUTTER_STAGE_EGL (self);
|
||||
|
||||
if (min_width_p)
|
||||
*min_width_p = CLUTTER_UNITS_FROM_DEVICE (stage_egl->surface_width);
|
||||
|
||||
if (natural_width_p)
|
||||
*natural_width_p = CLUTTER_UNITS_FROM_DEVICE (stage_egl->surface_width);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_egl_get_preferred_height (ClutterActor *self,
|
||||
gfloat for_width,
|
||||
gfloat *min_height_p,
|
||||
gfloat *natural_height_p)
|
||||
{
|
||||
ClutterStageEGL *stage_egl = CLUTTER_STAGE_EGL (self);
|
||||
|
||||
if (min_height_p)
|
||||
*min_height_p = CLUTTER_UNITS_FROM_DEVICE (stage_egl->surface_height);
|
||||
|
||||
if (natural_height_p)
|
||||
*natural_height_p = CLUTTER_UNITS_FROM_DEVICE (stage_egl->surface_height);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_egl_dispose (GObject *gobject)
|
||||
{
|
||||
ClutterStageEGL *stage_egl = CLUTTER_STAGE_EGL (gobject);
|
||||
|
||||
G_OBJECT_CLASS (clutter_stage_egl_parent_class)->dispose (gobject);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_egl_class_init (ClutterStageEGLClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
||||
|
||||
gobject_class->dispose = clutter_stage_egl_dispose;
|
||||
|
||||
actor_class->show = clutter_stage_egl_show;
|
||||
actor_class->hide = clutter_stage_egl_hide;
|
||||
actor_class->realize = clutter_stage_egl_realize;
|
||||
actor_class->unrealize = clutter_stage_egl_unrealize;
|
||||
actor_class->get_preferred_width = clutter_stage_egl_get_preferred_width;
|
||||
actor_class->get_preferred_height = clutter_stage_egl_get_preferred_height;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_egl_set_fullscreen (ClutterStageWindow *stage_window,
|
||||
gboolean fullscreen)
|
||||
{
|
||||
g_warning ("Stage of type '%s' do not support ClutterStage::set_fullscreen",
|
||||
G_OBJECT_TYPE_NAME (stage_window));
|
||||
}
|
||||
|
||||
static ClutterActor *
|
||||
clutter_stage_egl_get_wrapper (ClutterStageWindow *stage_window)
|
||||
{
|
||||
return CLUTTER_ACTOR (CLUTTER_STAGE_EGL (stage_window)->wrapper);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
|
||||
{
|
||||
iface->set_fullscreen = clutter_stage_egl_set_fullscreen;
|
||||
iface->set_title = NULL;
|
||||
iface->get_wrapper = clutter_stage_egl_get_wrapper;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_egl_init (ClutterStageEGL *stage)
|
||||
{
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
#ifndef __CLUTTER_STAGE_EGL_H__
|
||||
#define __CLUTTER_STAGE_EGL_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <clutter/clutter-stage.h>
|
||||
|
||||
#if HAVE_CLUTTER_FRUITY
|
||||
/* extra include needed for the GLES header for arm-apple-darwin */
|
||||
#include <CoreSurface/CoreSurface.h>
|
||||
#endif
|
||||
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/egl.h>
|
||||
#include "clutter-backend-fruity.h"
|
||||
|
||||
#define CLUTTER_TYPE_STAGE_FRUITY (clutter_stage_egl_get_type ())
|
||||
#define CLUTTER_STAGE_EGL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_STAGE_FRUITY, ClutterStageEGL))
|
||||
#define CLUTTER_IS_STAGE_EGL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_STAGE_FRUITY))
|
||||
#define CLUTTER_STAGE_EGL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_STAGE_FRUITY, ClutterStageEGLClass))
|
||||
#define CLUTTER_IS_STAGE_EGL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_STAGE_FRUITY))
|
||||
#define CLUTTER_STAGE_EGL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_STAGE_FRUITY, ClutterStageEGLClass))
|
||||
|
||||
typedef struct _ClutterStageEGL ClutterStageEGL;
|
||||
typedef struct _ClutterStageEGLClass ClutterStageEGLClass;
|
||||
|
||||
struct _ClutterStageEGL
|
||||
{
|
||||
ClutterActor parent_instance;
|
||||
|
||||
/* from the backend */
|
||||
gint surface_width;
|
||||
gint surface_height;
|
||||
|
||||
EGLSurface egl_surface;
|
||||
|
||||
/* the stage wrapper */
|
||||
ClutterStage *wrapper;
|
||||
ClutterBackendEGL *backend;
|
||||
};
|
||||
|
||||
struct _ClutterStageEGLClass
|
||||
{
|
||||
ClutterActorClass parent_class;
|
||||
};
|
||||
|
||||
GType clutter_stage_egl_get_type (void) G_GNUC_CONST;
|
||||
|
||||
#endif /* __CLUTTER_STAGE_EGL_H__ */
|
38
configure.ac
38
configure.ac
@ -197,7 +197,7 @@ experimental_backend=no
|
||||
experimental_image=no
|
||||
|
||||
AC_ARG_WITH([flavour],
|
||||
[AC_HELP_STRING([--with-flavour=@<:@glx/opengl-egl-xlib/wayland/eglx/eglnative/osx/win32/fruity/cex100@:>@],
|
||||
[AC_HELP_STRING([--with-flavour=@<:@glx/opengl-egl-xlib/wayland/eglx/eglnative/osx/win32/cex100@:>@],
|
||||
[Select the Clutter window system backend])],
|
||||
[CLUTTER_FLAVOUR=$with_flavour])
|
||||
|
||||
@ -402,25 +402,6 @@ AS_CASE([$CLUTTER_FLAVOUR],
|
||||
FLAVOUR_LIBS="$FLAVOUR_LIBS -lgdl $EVDEV_LIBS"
|
||||
],
|
||||
|
||||
[fruity],
|
||||
[
|
||||
experimental_backend="yes"
|
||||
# the GL header is defined in the COGL checks above
|
||||
CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_FRUITY"
|
||||
AC_DEFINE([HAVE_CLUTTER_FRUITY], [1], [Have the Fruity backend])
|
||||
AC_DEFINE([COGL_HAS_EGL_PLATFORM_FRUITY_SUPPORT], [1],
|
||||
[Cogl supports OpenGLES using the EGL API with Fruity platform typedefs])
|
||||
|
||||
COGL_DRIVER="gles"
|
||||
# the fruity backend requires a different handling for GLES
|
||||
glesversion=fruity
|
||||
|
||||
FLAVOUR_LIBS="$FLAVOUR_LIBS -ObjC -framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreSurface -framework GraphicsServices -framework OpenGLES -framework LayerKit -framework UIKit"
|
||||
|
||||
CLUTTER_WINSYS=fruity
|
||||
CLUTTER_SONAME_INFIX=fruity
|
||||
],
|
||||
|
||||
[osx],
|
||||
[
|
||||
experimental_backend="yes"
|
||||
@ -462,7 +443,8 @@ AS_CASE([$CLUTTER_FLAVOUR],
|
||||
CLUTTER_SONAME_INFIX=win32
|
||||
],
|
||||
|
||||
[AC_MSG_ERROR([Invalid backend for Clutter: use glx, osx, win32, eglx, eglnative or fruity])]
|
||||
[AC_MSG_ERROR([Invalid backend for Clutter: use glx, osx,
|
||||
win32, eglx or eglnative])]
|
||||
)
|
||||
|
||||
AS_IF([test "x$SUPPORT_X11" = "x1"],
|
||||
@ -536,11 +518,8 @@ AM_CONDITIONAL(SUPPORT_EGL, [test "x$SUPPORT_EGL" = "x1"])
|
||||
AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_POWERVR_X11, [test "x$SUPPORT_EGL_PLATFORM_POWERVR_X11" = "x1"])
|
||||
AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_POWERVR_NULL, [test "x$SUPPORT_EGL_PLATFORM_POWERVR_NULL" = "x1"])
|
||||
AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_POWERVR_GDL, [test "x$SUPPORT_EGL_PLATFORM_POWERVR_GDL" = "x1"])
|
||||
AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_FRUITY, [test "x$CLUTTER_WINSYS" = "xfruity"])
|
||||
AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_DRM_SURFACELESS, [test "x$SUPPORT_EGL_PLATFORM_DRM_SURFACELESS" = "x1"])
|
||||
AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_FRUITY, [test "x$CLUTTER_WINSYS" = "xfruity"])
|
||||
AM_CONDITIONAL(SUPPORT_OSX, [test "x$CLUTTER_WINSYS" = "xosx"])
|
||||
AM_CONDITIONAL(SUPPORT_FRUITY, [test "x$CLUTTER_WINSYS" = "xfruity"])
|
||||
AM_CONDITIONAL(SUPPORT_WIN32, [test "x$CLUTTER_WINSYS" = "xwin32"])
|
||||
AM_CONDITIONAL(SUPPORT_CEX100, [test "x$SUPPORT_EGL_PLATFORM_POWERVR_GDL" = "x1"])
|
||||
AM_CONDITIONAL(SUPPORT_WAYLAND, [test "x$CLUTTER_WINSYS" = "xwayland"])
|
||||
@ -649,17 +628,6 @@ AS_IF([test "x$COGL_DRIVER" = "xgles"],
|
||||
NEED_SEPARATE_EGL=yes
|
||||
],
|
||||
|
||||
[fruity],
|
||||
[
|
||||
cogl_gl_headers="GLES/gl.h GLES/glext.h"
|
||||
AC_DEFINE([HAVE_COGL_GLES], 1, [Have GL/ES for rendering])
|
||||
cogl_gles_version_define="COGL_HAS_GLES1"
|
||||
|
||||
AC_CHECK_HEADERS([GLES/egl.h],
|
||||
[],
|
||||
[AC_MSG_ERROR([Unable to locate required GLES headers])])
|
||||
],
|
||||
|
||||
[AC_MSG_ERROR([Unknown argument for --with-gles])]
|
||||
)
|
||||
]
|
||||
|
@ -95,7 +95,6 @@ IGNORE_HFILES=\
|
||||
cogl \
|
||||
egl \
|
||||
evdev \
|
||||
fruity \
|
||||
glx \
|
||||
osx \
|
||||
x11 \
|
||||
|
@ -141,7 +141,7 @@
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>--with-flavour=[glx/eglx/eglnative/win32/osx/fruity/cex100]</term>
|
||||
<term>--with-flavour=[glx/eglx/eglnative/win32/osx/cex100]</term>
|
||||
<listitem>
|
||||
<para>Select the Clutter backend; default=glx.
|
||||
</para>
|
||||
|
Loading…
Reference in New Issue
Block a user