Merge branch 'cally-merge'

* cally-merge:
  cally: Add introspection generation
  cally: Improving cally doc
  cally: Cleaning CallyText
  cally: Refactoring "window:create" and "window:destroy" emission code
  cally: Use proper backend information on CallyActor
  cally: Check HAVE_CONFIG_H on cally-util.c
  docs: Fix Cally documentation
  cally: Clean up the headers
  Add binaries of the Cally examples to the ignore file
  docs: Add Cally API reference
  Avoid to load cally module on a11y examples
  Add accessibility tests
  Initialize accessibility support on clutter_init
  Rename some methods and includes to avoid -Wshadow warnings
  Cally initialization code
  Add Cally
This commit is contained in:
Emmanuele Bassi
2010-07-07 16:06:30 +01:00
50 changed files with 7373 additions and 10 deletions

View File

@ -2,7 +2,7 @@ include $(top_srcdir)/build/autotools/Makefile.am.silent
NULL =
SUBDIRS = cogl $(CLUTTER_WINSYS_BASE) $(CLUTTER_WINSYS)
SUBDIRS = cogl $(CLUTTER_WINSYS_BASE) $(CLUTTER_WINSYS) cally
if LOCAL_JSON_GLIB
SUBDIRS += json
@ -12,7 +12,7 @@ clutter_json_libadd = $(top_builddir)/clutter/json/libclutter-json.la
clutter_json_gir = ClutterJson-@CLUTTER_API_VERSION@.gir
endif
DIST_SUBDIRS = glx egl cogl json osx x11 win32 fruity
DIST_SUBDIRS = glx egl cogl json osx x11 win32 fruity cally
# common definitions
CLEANFILES =
@ -39,6 +39,7 @@ endif # SUPPORT_WIN32
INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/clutter/cally \
-I$(top_srcdir)/clutter/cogl \
-I$(top_srcdir)/clutter/cogl/pango \
-I$(top_srcdir)/clutter \
@ -260,13 +261,16 @@ source_h_priv = \
libclutter_@CLUTTER_SONAME_INFIX@_@CLUTTER_API_VERSION@_la_LIBADD = \
$(CLUTTER_LIBS) \
$(top_builddir)/clutter/cally/libcally.la \
$(top_builddir)/clutter/cogl/cogl/libclutter-cogl.la \
$(top_builddir)/clutter/cogl/pango/libcoglpango.la \
$(top_builddir)/clutter/$(CLUTTER_WINSYS)/libclutter-$(CLUTTER_WINSYS).la \
$(clutter_json_libadd) \
$(CLUTTER_WINSYS_BASE_LIB)
libclutter_@CLUTTER_SONAME_INFIX@_@CLUTTER_API_VERSION@_la_DEPENDENCIES = \
$(top_builddir)/clutter/cally/libcally.la \
$(top_builddir)/clutter/cogl/cogl/libclutter-cogl.la \
$(top_builddir)/clutter/cogl/pango/libcoglpango.la \
$(top_builddir)/clutter/$(CLUTTER_WINSYS)/libclutter-$(CLUTTER_WINSYS).la \
@ -289,7 +293,7 @@ libclutter_@CLUTTER_SONAME_INFIX@_@CLUTTER_API_VERSION@_la_LDFLAGS = \
$(CLUTTER_LT_LDFLAGS) \
$(GCOV_LDFLAGS) \
-export-dynamic \
-export-symbols-regex "^(clutter|cogl|json).*" \
-export-symbols-regex "^(clutter|cogl|cally|json).*" \
-rpath $(libdir) \
$(win32_resources_ldflag) \
$(NULL)
@ -318,7 +322,7 @@ json_gir_pkg=
# If we are building it, ClutterJson gets the same handling as described
# for Cogl above
ClutterJson-@CLUTTER_API_VERSION@.gir: Clutter-@CLUTTER_API_VERSION@.gir json/ClutterJson-@CLUTTER_API_VERSION@.gir
ClutterJson-@CLUTTER_API_VERSION@.gir: Makefile Clutter-@CLUTTER_API_VERSION@.gir json/ClutterJson-@CLUTTER_API_VERSION@.gir
$(QUIET_GEN) \
shlib=`sed -n 's/.*shared-library="\([^"]*\)".*/\1/p' < Clutter-@CLUTTER_API_VERSION@.gir` ; \
sed "s/shared-library=\"[^\"]*\"/shared-library=\"$$shlib\"/"< json/ClutterJson-@CLUTTER_API_VERSION@.gir > $@
@ -334,7 +338,7 @@ if HAVE_INTROSPECTION
# subdir Makefile.am, so just extract them from cogl.h instead. The doc
# comments for COGL are in the headers, so we don't need the source files.
Clutter-@CLUTTER_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la
Clutter-@CLUTTER_API_VERSION@.gir: Makefile $(INTROSPECTION_SCANNER) libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la
$(QUIET_GEN)$(INTROSPECTION_SCANNER) -v \
--namespace Clutter --nsversion=@CLUTTER_API_VERSION@ \
$(INCLUDES) \
@ -373,13 +377,37 @@ Clutter-@CLUTTER_API_VERSION@.typelib: $(clutter_json_gir) Cogl-@CLUTTER_API_VER
# until after we've built the shared library. To create the final Cogl.gir
# that we compile and install, we transfer the shared-library="" line from
# Clutter.gir to Cogl.gir
Cogl-@CLUTTER_API_VERSION@.gir: Clutter-@CLUTTER_API_VERSION@.gir cogl/cogl/Cogl-@CLUTTER_API_VERSION@.gir
Cogl-@CLUTTER_API_VERSION@.gir: Makefile Clutter-@CLUTTER_API_VERSION@.gir cogl/cogl/Cogl-@CLUTTER_API_VERSION@.gir
$(QUIET_GEN) \
shlib=`sed -n 's/.*shared-library="\([^"]*\)".*/\1/p' < Clutter-@CLUTTER_API_VERSION@.gir` ; \
sed "s/shared-library=\"[^\"]*\"/shared-library=\"$$shlib\"/"< cogl/cogl/Cogl-@CLUTTER_API_VERSION@.gir > $@
BUILT_GIRSOURCES += Cogl-@CLUTTER_API_VERSION@.gir
# Cally depends on Clutter because it exposes Clutter types; for this reason,
# we cannot build Cally.gir under cally/ and then do the shlib trick we do
# for Cogl and ClutterJson.
Cally-@CLUTTER_API_VERSION@.gir: Makefile $(INTROSPECTION_SCANNER) Clutter-@CLUTTER_API_VERSION@.gir
$(QUIET_GEN)$(INTROSPECTION_SCANNER) -v \
--namespace Cally --nsversion=@CLUTTER_API_VERSION@ \
$(INCLUDES) \
$(AM_CPPFLAGS) \
--c-include='cally/cally.h' \
--include=GObject-2.0 \
--include=Atk-1.0 \
--include=Pango-1.0 \
--include=Clutter-1.0 \
--library=libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la \
--libtool="$(top_builddir)/libtool" \
--pkg gobject-2.0 \
--pkg atk \
--pkg clutter-1.0 \
--output $@ \
$(top_srcdir)/clutter/cally/*.h \
$(top_srcdir)/clutter/cally/*.c
BUILT_GIRSOURCES += Cally-@CLUTTER_API_VERSION@.gir
# INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to
# install anything - we need to install inside our prefix.
girdir = $(datadir)/gir-1.0

78
clutter/cally/Makefile.am Normal file
View File

@ -0,0 +1,78 @@
include $(top_srcdir)/build/autotools/Makefile.am.silent
EXTRA_DIST =
CLEANFILES =
DISTCLEANFILES =
# pkg-config ==================================================================
pc_files = \
cally-$(CLUTTER_API_VERSION).pc
cally-$(CLUTTER_API_VERSION).pc: cally.pc
$(QUIET_GEN)cp -f $< $(@F)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = $(pc_files)
EXTRA_DIST += cally.pc.in
CLEANFILES += $(pc_files)
noinst_LTLIBRARIES = libcally.la
cally_h_sources = cally.h \
cally-actor.h \
cally-factory.h \
cally-group.h \
cally-main.h \
cally-rectangle.h \
cally-root.h \
cally-stage.h \
cally-text.h \
cally-texture.h \
cally-clone.h \
cally-util.h
cally_private_h_sources = cally-actor-private.h
cally_c_sources = cally.c \
cally-actor.c \
cally-group.c \
cally-rectangle.c \
cally-root.c \
cally-stage.c \
cally-text.c \
cally-texture.c \
cally-clone.c \
cally-util.c
libcally_la_SOURCES = \
$(cally_private_h_sources) \
$(cally_h_sources) \
$(cally_c_sources)
INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/clutter \
-I$(top_srcdir)/clutter/cally \
-I$(top_srcdir)/clutter/cogl
AM_CPPFLAGS = \
-DG_LOG_DOMAIN=\"Cally\" \
-DCLUTTER_COMPILATION \
-DVERSION=\"$(VERSION)\" \
$(CLUTTER_DEBUG_CFLAGS)
AM_CFLAGS = \
$(CLUTTER_CFLAGS) \
$(MAINTAINER_CFLAGS)
libcallydir=$(includedir)/clutter-@CLUTTER_API_VERSION@/cally
# In opposit to GAIL, CALLY exports all the headers. It will very
# unlikely in any real final clutter-based application to use only raw
# CALLY. In fact, after HAIL experience, probably export GAIL
# interfaces would be a good idea
libcally_HEADERS = $(cally_h_sources)
libcally_la_LIBADD = $(CLUTTER_LIBS)

View File

@ -0,0 +1,38 @@
/* CALLY - The Clutter Accessibility Implementation Library
*
* Copyright (C) 2008 Igalia, S.L.
*
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
*
* Some parts are based on GailWidget from GAIL
* GAIL - The GNOME Accessibility Implementation Library
* Copyright 2001, 2002, 2003 Sun Microsystems Inc.
*
* 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 __CALLY_ACTOR_PRIVATE_H__
#define __CALLY_ACTOR_PRIVATE_H__
#include "cally-actor.h"
/*
* Auxiliar define, in order to get the clutter actor from the AtkObject using
* AtkGObject methods
*
*/
#define CALLY_GET_CLUTTER_ACTOR(cally_object) \
(CLUTTER_ACTOR (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (cally_object))))
#endif /* __CALLY_ACTOR_PRIVATE_H__ */

1503
clutter/cally/cally-actor.c Normal file

File diff suppressed because it is too large Load Diff

135
clutter/cally/cally-actor.h Normal file
View File

@ -0,0 +1,135 @@
/* CALLY - The Clutter Accessibility Implementation Library
*
* Copyright (C) 2008 Igalia, S.L.
*
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
*
* Some parts are based on GailWidget from GAIL
* GAIL - The GNOME Accessibility Implementation Library
* Copyright 2001, 2002, 2003 Sun Microsystems Inc.
*
* 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/>.
*/
#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <cally/cally.h> can be included directly."
#endif
#ifndef __CALLY_ACTOR_H__
#define __CALLY_ACTOR_H__
#include <atk/atk.h>
#include <clutter/clutter-actor.h>
G_BEGIN_DECLS
#define CALLY_TYPE_ACTOR (cally_actor_get_type ())
#define CALLY_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_ACTOR, CallyActor))
#define CALLY_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_ACTOR, CallyActorClass))
#define CALLY_IS_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_ACTOR))
#define CALLY_IS_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_ACTOR))
#define CALLY_ACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_ACTOR, CallyActorClass))
typedef struct _CallyActor CallyActor;
typedef struct _CallyActorClass CallyActorClass;
typedef struct _CallyActorPrivate CallyActorPrivate;
/**
* CallyActionFunc:
* @cally_actor: a #CallyActor
*
* Action function, to be used on #AtkAction implementations as a individual
* action
*
* Since: 1.4
*/
typedef void (* CallyActionFunc) (CallyActor *cally_actor);
/**
* CallyActor:
*
* The <structname>CallyActor</structname> structure contains only private
* data and should be accessed using the provided API
*
* Since: 1.4
*/
struct _CallyActor
{
/*< private >*/
AtkGObjectAccessible parent;
CallyActorPrivate *priv;
};
/**
* CallyActorClass:
* @notify_clutter: Signal handler for notify signal on Clutter actor
* @focus_clutter: Signal handler for key-focus-in and key-focus-out signal on Clutter actor
* @add_actor: Signal handler for actor-added signal on ClutterContainer interface
* @remove_actor: Signal handler for actor-added signal on ClutterContainer interface
*
* The <structname>CallyActorClass</structname> structure contains only
* private data
*
* Since: 1.4
*/
struct _CallyActorClass
{
/*< private >*/
AtkGObjectAccessibleClass parent_class;
/*< public >*/
/* Signal handler for notify signal on Clutter Actor */
void (*notify_clutter) (GObject *object,
GParamSpec *pspec);
/*
* Signal handler for key_focus_in and key_focus_out on Clutter Actor
*/
gboolean (*focus_clutter) (ClutterActor *actor,
gpointer data);
gint (*add_actor) (ClutterActor *container,
ClutterActor *actor,
gpointer data);
gint (*remove_actor) (ClutterActor *container,
ClutterActor *actor,
gpointer data);
/*< private >*/
/* padding for future expansion */
gpointer _padding_dummy[32];
};
GType cally_actor_get_type (void) G_GNUC_CONST;
AtkObject* cally_actor_new (ClutterActor *actor);
guint cally_actor_add_action (CallyActor *cally_actor,
const gchar *action_name,
const gchar *action_description,
const gchar *action_keybinding,
CallyActionFunc action_func);
gboolean cally_actor_remove_action (CallyActor *cally_actor,
gint action_id);
gboolean cally_actor_remove_action_by_name (CallyActor *cally_actor,
const gchar *action_name);
G_END_DECLS
#endif /* __CALLY_ACTOR_H__ */

153
clutter/cally/cally-clone.c Normal file
View File

@ -0,0 +1,153 @@
/* CALLY - The Clutter Accessibility Implementation Library
*
* Copyright (C) 2010 Igalia, S.L.
*
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
*
* 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.
*/
/**
* SECTION:cally-clone
* @Title: CallyClone
* @short_description: Implementation of the ATK interfaces for a #ClutterClone
* @see_also: #ClutterClone
*
* #CallyClone implements the required ATK interfaces of #ClutterClone
*
* In particular it sets a proper role for the clone, as just a image,
* as it is the sanest and simplest approach.
*/
/* Design rationale for CallyClone:
*
* In the old times, it was just ClutterCloneTexture. So, from a a11y POV
* CallyCloneTexture was just another image, like ClutterTexture, and if
* it was a clone was irrevelant. So on cally-0.8, CallyCloneTexture
* expose a object with role ATK_ROLE_IMAGE. But now, ClutterClone is more
* general. You can clone any object, including groups, and made things
* like have one text entry, and a clone with different properties in the
* same window, updated both at once.
*
* The question is if the idea is have a ClutterClone as a "first-class"
* citizen inside the stage hierarchy (full clone), or it is just supposed
* to be a mirror image of the original object.
*
* In the case of the a11y POV this would mean that if the text changes on
* the source, the clone should emit as well the text-changing signals.
*
* As ClutterClone smartly just paint the same object with different
* parameters, this would mean that it should be the cally object the one
* that should replicate the source clutter hierarchy to do that,
* something that just sound crazy.
*
* Taking into account that:
*
* - ClutterClone doesn't re-emit mirrored signals from the source
* I think that likely the answer would be "yes, it is just a
* mirrored image, not a real full clone".
*
* - You can't interact directly with the clone (ie: focus, and so on).
* Its basic usage (right now) is clone textures.
*
* Any other solution could be overwhelming.
*
* I think that the final solution would be that ClutterClone from the
* a11y POV should still be managed as a image (with the proper properties,
* position, size, etc.).
*/
#include "cally-clone.h"
#include "cally-actor-private.h"
#define CALLY_CLONE_DEFAULT_DESCRIPTION "ClutterClone accessibility object"
static void cally_clone_class_init (CallyCloneClass *klass);
static void cally_clone_init (CallyClone *clone);
/* AtkObject */
static void cally_clone_real_initialize (AtkObject *obj,
gpointer data);
static G_CONST_RETURN gchar *cally_clone_get_description (AtkObject *obj);
G_DEFINE_TYPE (CallyClone, cally_clone, CALLY_TYPE_ACTOR)
static void
cally_clone_class_init (CallyCloneClass *klass)
{
/* GObjectClass *gobject_class = G_OBJECT_CLASS (klass); */
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
class->initialize = cally_clone_real_initialize;
class->get_description = cally_clone_get_description;
}
static void
cally_clone_init (CallyClone *clone)
{
/* nothing to do yet */
}
/**
* cally_clone_new:
* @actor: a #ClutterActor
*
* Creates a new #CallyClone for the given @actor. @actor must be a
* #ClutterClone.
*
* Return value: the newly created #AtkObject
*
* Since: 1.4
*/
AtkObject*
cally_clone_new (ClutterActor *actor)
{
GObject *object = NULL;
AtkObject *accessible = NULL;
g_return_val_if_fail (CLUTTER_IS_CLONE (actor), NULL);
object = g_object_new (CALLY_TYPE_CLONE, NULL);
accessible = ATK_OBJECT (object);
atk_object_initialize (accessible, actor);
return accessible;
}
static void
cally_clone_real_initialize (AtkObject *obj,
gpointer data)
{
ATK_OBJECT_CLASS (cally_clone_parent_class)->initialize (obj, data);
obj->role = ATK_ROLE_IMAGE;
}
static G_CONST_RETURN gchar *
cally_clone_get_description (AtkObject *obj)
{
G_CONST_RETURN gchar *description = NULL;
g_return_val_if_fail (CALLY_IS_CLONE (obj), NULL);
description = ATK_OBJECT_CLASS (cally_clone_parent_class)->get_description (obj);
if (description == NULL)
description = CALLY_CLONE_DEFAULT_DESCRIPTION;
return description;
}

View File

@ -0,0 +1,82 @@
/* CALLY - The Clutter Accessibility Implementation Library
*
* Copyright (C) 2010 Igalia, S.L.
*
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
*
* 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/>.
*/
#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <cally/cally.h> can be included directly."
#endif
#ifndef __CALLY_CLONE_H__
#define __CALLY_CLONE_H__
#include <cally/cally-actor.h>
#include <clutter/clutter-clone.h>
G_BEGIN_DECLS
#define CALLY_TYPE_CLONE (cally_clone_get_type ())
#define CALLY_CLONE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_CLONE, CallyClone))
#define CALLY_CLONE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_CLONE, CallyCloneClass))
#define CALLY_IS_CLONE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_CLONE))
#define CALLY_IS_CLONE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_CLONE))
#define CALLY_CLONE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_CLONE, CallyCloneClass))
typedef struct _CallyClone CallyClone;
typedef struct _CallyCloneClass CallyCloneClass;
typedef struct _CallyClonePrivate CallyClonePrivate;
/**
* CallyClone:
*
* The <structname>CallyClone</structname> structure contains only private
* data and should be accessed using the provided API
*
* Since: 1.4
*/
struct _CallyClone
{
/*< private >*/
CallyActor parent;
CallyClonePrivate *priv;
};
/**
* CallyCloneClass:
*
* The <structname>CallyCloneClass</structname> structure contains only
* private data
*
* Since: 1.4
*/
struct _CallyCloneClass
{
/*< private >*/
CallyActorClass parent_class;
/* padding for future expansion */
gpointer _padding_dummy[8];
};
GType cally_clone_get_type (void) G_GNUC_CONST;
AtkObject *cally_clone_new (ClutterActor *actor);
G_END_DECLS
#endif /* __CALLY_CLONE_H__ */

View File

@ -0,0 +1,117 @@
/* CALLY - The Clutter Accessibility Implementation Library
*
* Copyright (C) 2008 Igalia, S.L.
*
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
*
* Based on gailfactory.h from GAIL
* Copyright 2001, 2002, 2003 Sun Microsystems Inc.
*
* 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.
*/
#ifndef _CALLY_FACTORY_H__
#define _CALLY_FACTORY_H__
#include <glib-object.h>
#include <atk/atkobject.h>
/**
* CALLY_ACCESSIBLE_FACTORY:
* @type: GType of the accessible which is created by the factory
* @type_as_function: prefix of the accessible object methods
* @opt_create_accessible: method to instantiate the accessibility object
*
* Defines a new #AtkObjectFactory factory to create accessible
* objects of a specific GType. It defines the factory GType and also
* overrides the proper #AtkObjectFactory methods.
*
* It assumes that the accessibility object provides a
* @opt_create_accessible method in order to create the accessibility
* object. It returns a @type GType object.
*
* Since: 1.4
*/
#define CALLY_ACCESSIBLE_FACTORY(type, type_as_function, opt_create_accessible) \
\
static GType \
type_as_function ## _factory_get_accessible_type (void) \
{ \
return type; \
} \
\
static AtkObject* \
type_as_function ## _factory_create_accessible (GObject *obj) \
{ \
ClutterActor *actor; \
AtkObject *accessible; \
\
g_return_val_if_fail (CLUTTER_ACTOR (obj), NULL); \
\
actor = CLUTTER_ACTOR (obj); \
\
accessible = opt_create_accessible (actor); \
\
return accessible; \
} \
\
static void \
type_as_function ## _factory_class_init (AtkObjectFactoryClass *klass) \
{ \
klass->create_accessible = type_as_function ## _factory_create_accessible; \
klass->get_accessible_type = type_as_function ## _factory_get_accessible_type;\
} \
\
static GType \
type_as_function ## _factory_get_type (void) \
{ \
static GType t = 0; \
\
if (!t) \
{ \
char *name; \
static const GTypeInfo tinfo = \
{ \
sizeof (AtkObjectFactoryClass), \
NULL, NULL, (GClassInitFunc) type_as_function ## _factory_class_init, \
NULL, NULL, sizeof (AtkObjectFactory), 0, NULL, NULL \
}; \
\
name = g_strconcat (g_type_name (type), "Factory", NULL); \
t = g_type_register_static ( \
ATK_TYPE_OBJECT_FACTORY, name, &tinfo, 0); \
g_free (name); \
} \
\
return t; \
}
/**
* CALLY_ACTOR_SET_FACTORY:
* @widget_type: GType of the clutter actor
* @type_as_function: prefix of the accessible object methods
*
* Sets the #AtkObjectFactory to be used in order to instantiate
* accessibility objects for the actor which GType is @widget_type.
*
* Since: 1.4
*/
#define CALLY_ACTOR_SET_FACTORY(widget_type, type_as_function) \
atk_registry_set_factory_type (atk_get_default_registry (), \
widget_type, \
type_as_function ## _factory_get_type ())
#endif /* _CALLY_FACTORY_H__ */

151
clutter/cally/cally-group.c Normal file
View File

@ -0,0 +1,151 @@
/* CALLY - The Clutter Accessibility Implementation Library
*
* Copyright (C) 2008 Igalia, S.L.
*
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
*
* Based on GailContainer from GAIL
* Copyright 2001, 2002, 2003 Sun Microsystems Inc.
*
* 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.
*/
/**
* SECTION:cally-group
* @Title: CallyGroup
* @short_description: Implementation of the ATK interfaces for a #ClutterGroup
* @see_also: #ClutterGroup
*
* #CallyClutterGroup implements the required ATK interfaces of #ClutterGroup
* In particular it exposes:
*
* <itemizedlist>
* <listitem><simpara>Each of the Clutter actors contained in the
* Group.</simpara></listitem>
* </itemizedlist>
*/
#include "cally-group.h"
#include "cally-actor-private.h"
static void cally_group_class_init (CallyGroupClass *klass);
static void cally_group_init (CallyGroup *group);
static gint cally_group_get_n_children (AtkObject *obj);
static AtkObject* cally_group_ref_child (AtkObject *obj,
gint i);
static void cally_group_real_initialize (AtkObject *obj,
gpointer data);
G_DEFINE_TYPE (CallyGroup, cally_group, CALLY_TYPE_ACTOR)
static void
cally_group_class_init (CallyGroupClass *klass)
{
/* GObjectClass *gobject_class = G_OBJECT_CLASS (klass); */
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
class->get_n_children = cally_group_get_n_children;
class->ref_child = cally_group_ref_child;
class->initialize = cally_group_real_initialize;
}
static void
cally_group_init (CallyGroup *group)
{
/* nothing to do yet */
}
/**
* cally_group_new:
* @actor: a #ClutterGroup
*
* Creates a #CallyGroup for @actor
*
* Return value: the newly created #CallyGroup
*
* Since: 1.4
*/
AtkObject *
cally_group_new (ClutterActor *actor)
{
GObject *object = NULL;
AtkObject *accessible = NULL;
g_return_val_if_fail (CLUTTER_IS_GROUP (actor), NULL);
object = g_object_new (CALLY_TYPE_GROUP, NULL);
accessible = ATK_OBJECT (object);
atk_object_initialize (accessible, actor);
return accessible;
}
static gint
cally_group_get_n_children (AtkObject *obj)
{
ClutterActor *actor = NULL;
gint count = 0;
g_return_val_if_fail (CALLY_IS_GROUP (obj), count);
actor = CALLY_GET_CLUTTER_ACTOR (obj);
if (actor == NULL) /* defunct */
return 0;
g_return_val_if_fail (CLUTTER_IS_GROUP(actor), count);
count = clutter_group_get_n_children (CLUTTER_GROUP (actor));
return count;
}
static AtkObject*
cally_group_ref_child (AtkObject *obj,
gint i)
{
AtkObject *accessible = NULL;
ClutterActor *actor = NULL;
ClutterActor *child = NULL;
g_return_val_if_fail (CALLY_IS_GROUP (obj), NULL);
g_return_val_if_fail ((i >= 0), NULL);
actor = CALLY_GET_CLUTTER_ACTOR (obj);
g_return_val_if_fail (CLUTTER_IS_GROUP(actor), NULL);
child = clutter_group_get_nth_child (CLUTTER_GROUP(actor), i);
if (!child)
return NULL;
accessible = clutter_actor_get_accessible (child);
if (accessible != NULL)
g_object_ref (accessible);
return accessible;
}
static void
cally_group_real_initialize (AtkObject *obj,
gpointer data)
{
ATK_OBJECT_CLASS (cally_group_parent_class)->initialize (obj, data);
obj->role = ATK_ROLE_PANEL;
}

View File

@ -0,0 +1,85 @@
/* CALLY - The Clutter Accessibility Implementation Library
*
* Copyright (C) 2008 Igalia, S.L.
*
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
*
* Based on GailContainer from GAIL
* Copyright 2001, 2002, 2003 Sun Microsystems Inc.
*
* 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/>.
*/
#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <cally/cally.h> can be included directly."
#endif
#ifndef __CALLY_GROUP_H__
#define __CALLY_GROUP_H__
#include <cally/cally-actor.h>
#include <clutter/clutter-group.h>
G_BEGIN_DECLS
#define CALLY_TYPE_GROUP (cally_group_get_type ())
#define CALLY_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_GROUP, CallyGroup))
#define CALLY_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_GROUP, CallyGroupClass))
#define CALLY_IS_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_GROUP))
#define CALLY_IS_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_GROUP))
#define CALLY_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_GROUP, CallyGroupClass))
typedef struct _CallyGroup CallyGroup;
typedef struct _CallyGroupClass CallyGroupClass;
typedef struct _CallyGroupPrivate CallyGroupPrivate;
/**
* CallyGroup:
*
* The <structname>CallyGroup</structname> structure contains only
* private data and should be accessed using the provided API
*
* Since: 1.4
*/
struct _CallyGroup
{
/*< private >*/
CallyActor parent;
CallyGroupPrivate *priv;
};
/**
* CallyGroupClass:
*
* The <structname>CallyGroupClass</structname> structure contains only
* private data
*
* Since: 1.4
*/
struct _CallyGroupClass
{
/*< private >*/
CallyActorClass parent_class;
/* padding for future expansion */
gpointer _padding_dummy[8];
};
GType cally_group_get_type (void) G_GNUC_CONST;
AtkObject* cally_group_new (ClutterActor *actor);
G_END_DECLS
#endif /* __CALLY_GROUP_H__ */

View File

@ -0,0 +1,39 @@
/* CALLY - The Clutter Accessibility Implementation Library
*
* Copyright (C) 2008 Igalia, S.L.
*
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
*
* Some parts are based on GailWidget from GAIL
* GAIL - The GNOME Accessibility Implementation Library
* Copyright 2001, 2002, 2003 Sun Microsystems Inc.
*
* 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/>.
*/
#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <cally/cally.h> can be included directly."
#endif
#ifndef __CALLY_MAIN_H__
#define __CALLY_MAIN_H__
G_BEGIN_DECLS
gboolean cally_get_cally_initialized (void);
gboolean cally_accessibility_init (void);
G_END_DECLS
#endif /* __CALLY_MAIN_H__ */

View File

@ -0,0 +1,113 @@
/* CALLY - The Clutter Accessibility Implementation Library
*
* Copyright (C) 2009 Igalia, S.L.
*
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
*
* 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.
*/
/**
* SECTION:cally-rectangle
* @short_description: Implementation of the ATK interfaces for a #ClutterRectangle
* @see_also: #ClutterRectangle
*
* #CallyRectangle implements the required ATK interfaces of #ClutterRectangle
*
* In particular it sets a proper role for the rectangle.
*/
#include "cally-rectangle.h"
#include "cally-actor-private.h"
#define CALLY_RECTANGLE_DEFAULT_DESCRIPTION "A rectangle"
static void cally_rectangle_class_init (CallyRectangleClass *klass);
static void cally_rectangle_init (CallyRectangle *rectangle);
/* AtkObject */
static void cally_rectangle_real_initialize (AtkObject *obj,
gpointer data);
static G_CONST_RETURN gchar *cally_rectangle_get_description (AtkObject *obj);
G_DEFINE_TYPE (CallyRectangle, cally_rectangle, CALLY_TYPE_ACTOR)
static void
cally_rectangle_class_init (CallyRectangleClass *klass)
{
/* GObjectClass *gobject_class = G_OBJECT_CLASS (klass); */
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
class->initialize = cally_rectangle_real_initialize;
class->get_description = cally_rectangle_get_description;
}
static void
cally_rectangle_init (CallyRectangle *rectangle)
{
/* nothing to do yet */
}
/**
* cally_rectangle_new:
* @actor: a #ClutterActor
*
* Creates a new #CallyRectangle for the given @actor. @actor must be
* a #ClutterRectangle.
*
* Return value: the newly created #AtkObject
*
* Since: 1.4
*/
AtkObject*
cally_rectangle_new (ClutterActor *actor)
{
GObject *object = NULL;
AtkObject *accessible = NULL;
g_return_val_if_fail (CLUTTER_IS_RECTANGLE (actor), NULL);
object = g_object_new (CALLY_TYPE_RECTANGLE, NULL);
accessible = ATK_OBJECT (object);
atk_object_initialize (accessible, actor);
return accessible;
}
static void
cally_rectangle_real_initialize (AtkObject *obj,
gpointer data)
{
ATK_OBJECT_CLASS (cally_rectangle_parent_class)->initialize (obj, data);
obj->role = ATK_ROLE_IMAGE;
}
static G_CONST_RETURN gchar *
cally_rectangle_get_description (AtkObject *obj)
{
G_CONST_RETURN gchar *description = NULL;
g_return_val_if_fail (CALLY_IS_RECTANGLE (obj), NULL);
description = ATK_OBJECT_CLASS (cally_rectangle_parent_class)->get_description (obj);
if (description == NULL)
description = CALLY_RECTANGLE_DEFAULT_DESCRIPTION;
return description;
}

View File

@ -0,0 +1,82 @@
/* CALLY - The Clutter Accessibility Implementation Library
*
* Copyright (C) 2009 Igalia, S.L.
*
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
*
* 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/>.
*/
#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <cally/cally.h> can be included directly."
#endif
#ifndef __CALLY_RECTANGLE_H__
#define __CALLY_RECTANGLE_H__
#include <cally/cally-actor.h>
#include <clutter/clutter-rectangle.h>
G_BEGIN_DECLS
#define CALLY_TYPE_RECTANGLE (cally_rectangle_get_type ())
#define CALLY_RECTANGLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_RECTANGLE, CallyRectangle))
#define CALLY_RECTANGLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_RECTANGLE, CallyRectangleClass))
#define CALLY_IS_RECTANGLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_RECTANGLE))
#define CALLY_IS_RECTANGLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_RECTANGLE))
#define CALLY_RECTANGLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_RECTANGLE, CallyRectangleClass))
typedef struct _CallyRectangle CallyRectangle;
typedef struct _CallyRectangleClass CallyRectangleClass;
typedef struct _CallyRectanglePrivate CallyRectanglePrivate;
/**
* CallyRectangle:
*
* The <structname>CallyRectangle</structname> structure contains only private
* data and should be accessed using the provided API
*
* Since: 1.4
*/
struct _CallyRectangle
{
/*< private >*/
CallyActor parent;
CallyRectanglePrivate *priv;
};
/**
* CallyRectangleClass:
*
* The <structname>CallyRectangleClass</structname> structure contains
* only private data
*
* Since: 1.4
*/
struct _CallyRectangleClass
{
/*< private >*/
CallyActorClass parent_class;
/* padding for future expansion */
gpointer _padding_dummy[8];
};
GType cally_rectangle_get_type (void) G_GNUC_CONST;
AtkObject* cally_rectangle_new (ClutterActor *actor);
G_END_DECLS
#endif /* __CALLY_RECTANGLE_H__ */

283
clutter/cally/cally-root.c Normal file
View File

@ -0,0 +1,283 @@
/* CALLY - The Clutter Accessibility Implementation Library
*
* Copyright (C) 2008 Igalia, S.L.
*
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
*
* 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.
*/
/**
* SECTION:cally-root
* @short_description: Root object for the Cally toolkit
* @see_also: #ClutterStage
*
* #CallyRoot is the root object of the accessibility tree-like
* hierarchy, exposing the application level.
*
* Somewhat equivalent to #GailTopLevel. We consider that this class
* expose the a11y information of the #ClutterStageManager, as the
* children of this object are the different ClutterStage managed (so
* the #GObject used in the atk_object_initialize() is the
* #ClutterStageManager).
*/
#include <clutter/clutter.h>
#include "cally-root.h"
/* GObject */
static void cally_root_class_init (CallyRootClass *klass);
static void cally_root_init (CallyRoot *root);
static void cally_root_finalize (GObject *object);
/* AtkObject.h */
static void cally_root_initialize (AtkObject *accessible,
gpointer data);
static gint cally_root_get_n_children (AtkObject *obj);
static AtkObject *cally_root_ref_child (AtkObject *obj,
gint i);
static AtkObject *cally_root_get_parent (AtkObject *obj);
/* Private */
static void cally_util_stage_added_cb (ClutterStageManager *stage_manager,
ClutterStage *stage,
gpointer data);
static void cally_util_stage_removed_cb (ClutterStageManager *stage_manager,
ClutterStage *stage,
gpointer data);
#define CALLY_ROOT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CALLY_TYPE_ROOT, CallyRootPrivate))
G_DEFINE_TYPE (CallyRoot, cally_root, ATK_TYPE_GOBJECT_ACCESSIBLE)
struct _CallyRootPrivate
{
/* We save the CallyStage objects. Other option could save the stage
* list, and then just get the a11y object on the ref_child, etc. But
* the ref_child is more common that the init and the stage-add,
* stage-remove, so we avoid getting the accessible object
* constantly
*/
GSList *stage_list;
/* signals id */
guint stage_added_id;
guint stage_removed_id;
};
static void
cally_root_class_init (CallyRootClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
gobject_class->finalize = cally_root_finalize;
/* AtkObject */
class->get_n_children = cally_root_get_n_children;
class->ref_child = cally_root_ref_child;
class->get_parent = cally_root_get_parent;
class->initialize = cally_root_initialize;
g_type_class_add_private (gobject_class, sizeof (CallyRootPrivate));
}
static void
cally_root_init (CallyRoot *root)
{
root->priv = CALLY_ROOT_GET_PRIVATE (root);
root->priv->stage_list = NULL;
root->priv->stage_added_id = 0;
root->priv->stage_removed_id = 0;
}
/**
* cally_root_new:
*
* Creates a new #CallyRoot object.
*
* Return value: the newly created #AtkObject
*
* Since: 1.4
*/
AtkObject*
cally_root_new (void)
{
GObject *object = NULL;
AtkObject *accessible = NULL;
ClutterStageManager *stage_manager = NULL;
object = g_object_new (CALLY_TYPE_ROOT, NULL);
accessible = ATK_OBJECT (object);
stage_manager = clutter_stage_manager_get_default ();
atk_object_initialize (accessible, stage_manager);
return accessible;
}
static void
cally_root_finalize (GObject *object)
{
CallyRoot *root = CALLY_ROOT (object);
GObject *stage_manager = NULL;
g_return_if_fail (CALLY_IS_ROOT (object));
if (root->priv->stage_list)
{
g_slist_free (root->priv->stage_list);
root->priv->stage_list = NULL;
}
stage_manager = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (root));
g_signal_handler_disconnect (stage_manager,
root->priv->stage_added_id);
g_signal_handler_disconnect (stage_manager,
root->priv->stage_added_id);
G_OBJECT_CLASS (cally_root_parent_class)->finalize (object);
}
/* AtkObject.h */
static void
cally_root_initialize (AtkObject *accessible,
gpointer data)
{
ClutterStageManager *stage_manager = NULL;
const GSList *iter = NULL;
const GSList *stage_list = NULL;
ClutterStage *clutter_stage = NULL;
AtkObject *cally_stage = NULL;
CallyRoot *root = NULL;
accessible->role = ATK_ROLE_APPLICATION;
accessible->name = g_get_prgname();
accessible->accessible_parent = NULL;
/* children initialization */
root = CALLY_ROOT (accessible);
stage_manager = CLUTTER_STAGE_MANAGER (data);
stage_list = clutter_stage_manager_peek_stages (stage_manager);
for (iter = stage_list; iter != NULL; iter = g_slist_next (iter))
{
clutter_stage = CLUTTER_STAGE (iter->data);
cally_stage = clutter_actor_get_accessible (CLUTTER_ACTOR (clutter_stage));
root->priv->stage_list = g_slist_append (root->priv->stage_list,
cally_stage);
}
root->priv->stage_added_id =
g_signal_connect (G_OBJECT (stage_manager), "stage-added",
G_CALLBACK (cally_util_stage_added_cb), root);
root->priv->stage_removed_id =
g_signal_connect (G_OBJECT (stage_manager), "stage-removed",
G_CALLBACK (cally_util_stage_removed_cb), root);
ATK_OBJECT_CLASS (cally_root_parent_class)->initialize (accessible, data);
}
static gint
cally_root_get_n_children (AtkObject *obj)
{
CallyRoot *root = CALLY_ROOT (obj);
return g_slist_length (root->priv->stage_list);
}
static AtkObject*
cally_root_ref_child (AtkObject *obj,
gint i)
{
CallyRoot *cally_root = NULL;
GSList *stage_list = NULL;
gint num = 0;
AtkObject *item = NULL;
cally_root = CALLY_ROOT (obj);
stage_list = cally_root->priv->stage_list;
num = g_slist_length (stage_list);
g_return_val_if_fail ((i < num)&&(i >= 0), NULL);
item = g_slist_nth_data (stage_list, i);
if (!item)
{
return NULL;
}
g_object_ref (item);
return item;
}
static AtkObject*
cally_root_get_parent (AtkObject *obj)
{
return NULL;
}
/* -------------------------------- PRIVATE --------------------------------- */
static void
cally_util_stage_added_cb (ClutterStageManager *stage_manager,
ClutterStage *stage,
gpointer data)
{
CallyRoot *root = CALLY_ROOT (data);
AtkObject *cally_stage = NULL;
gint index = -1;
cally_stage = clutter_actor_get_accessible (CLUTTER_ACTOR (stage));
root->priv->stage_list = g_slist_append (root->priv->stage_list,
cally_stage);
index = g_slist_index (root->priv->stage_list, cally_stage);
g_signal_emit_by_name (root, "children_changed::add",
index, cally_stage, NULL);
g_signal_emit_by_name (cally_stage, "create", 0);
}
static void
cally_util_stage_removed_cb (ClutterStageManager *stage_manager,
ClutterStage *stage,
gpointer data)
{
CallyRoot *root = CALLY_ROOT (data);
AtkObject *cally_stage = NULL;
gint index = -1;
cally_stage = clutter_actor_get_accessible (CLUTTER_ACTOR (stage));
index = g_slist_index (root->priv->stage_list, cally_stage);
root->priv->stage_list = g_slist_remove (root->priv->stage_list,
cally_stage);
index = g_slist_index (root->priv->stage_list, cally_stage);
g_signal_emit_by_name (root, "children_changed::remove",
index, cally_stage, NULL);
g_signal_emit_by_name (cally_stage, "destroy", 0);
}

View File

@ -0,0 +1,82 @@
/* CALLY - The Clutter Accessibility Implementation Library
*
* Copyright (C) 2009 Igalia, S.L.
*
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
*
* 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/>.
*/
#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <cally/cally.h> can be included directly."
#endif
#ifndef __CALLY_ROOT_H__
#define __CALLY_ROOT_H__
#include <atk/atk.h>
G_BEGIN_DECLS
#define CALLY_TYPE_ROOT (cally_root_get_type ())
#define CALLY_ROOT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_ROOT, CallyRoot))
#define CALLY_ROOT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_ROOT, CallyRootClass))
#define CALLY_IS_ROOT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_ROOT))
#define CALLY_IS_ROOT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_ROOT))
#define CALLY_ROOT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_ROOT, CallyRootClass))
typedef struct _CallyRoot CallyRoot;
typedef struct _CallyRootClass CallyRootClass;
typedef struct _CallyRootPrivate CallyRootPrivate;
/**
* CallyRoot:
*
* The <structname>CallyRoot</structname> structure contains only private
* data and should be accessed using the provided API
*
* Since: 1.4
*/
struct _CallyRoot
{
/*< private >*/
AtkGObjectAccessible parent;
CallyRootPrivate *priv;
};
/**
* CallyRootClass:
*
* The <structname>CallyRootClass</structname> structure contains only
* private data
*
* Since: 1.4
*/
struct _CallyRootClass
{
/*< private >*/
AtkGObjectAccessibleClass parent_class;
/* padding for future expansion */
gpointer _padding_dummy[16];
};
GType cally_root_get_type (void) G_GNUC_CONST;
AtkObject *cally_root_new (void);
G_END_DECLS
#endif /* __CALLY_ROOT_H__ */

324
clutter/cally/cally-stage.c Normal file
View File

@ -0,0 +1,324 @@
/* CALLY - The Clutter Accessibility Implementation Library
*
* Copyright (C) 2008 Igalia, S.L.
*
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
*
* 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.
*/
/**
* SECTION:cally-stage
* @Title: CallyStage
* @short_description: Implementation of the ATK interfaces for a #ClutterStage
* @see_also: #ClutterStage
*
* #CallyStage implements the required ATK interfaces for #ClutterStage
*
* Some implementation details: at this moment #CallyStage is used as
* the most similar Window object in this toolkit (ie: emitting window
* related signals), although the real purpose of #ClutterStage is
* being a canvas. Anyway, this is required for applications using
* just clutter, or directly #ClutterStage
*/
#include "cally-stage.h"
#include "cally-actor-private.h"
enum {
ACTIVATE,
CREATE,
DEACTIVATE,
DESTROY,
LAST_SIGNAL
};
static guint cally_stage_signals [LAST_SIGNAL] = { 0, };
static void cally_stage_class_init (CallyStageClass *klass);
static void cally_stage_init (CallyStage *stage);
/* AtkObject.h */
static G_CONST_RETURN gchar *cally_stage_get_name (AtkObject *obj);
static G_CONST_RETURN gchar *cally_stage_get_description (AtkObject *obj);
static void cally_stage_real_initialize (AtkObject *obj,
gpointer data);
static AtkStateSet* cally_stage_ref_state_set (AtkObject *obj);
/* Auxiliar */
static void cally_stage_activate_cb (ClutterStage *stage,
gpointer data);
static void cally_stage_deactivate_cb (ClutterStage *stage,
gpointer data);
#define CALLY_STAGE_DEFAULT_NAME "Stage"
#define CALLY_STAGE_DEFAULT_DESCRIPTION "Top level 'window' on which child actors are placed and manipulated"
G_DEFINE_TYPE (CallyStage, cally_stage, CALLY_TYPE_GROUP);
#define CALLY_STAGE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), CALLY_TYPE_STAGE, CallyStagePrivate))
struct _CallyStagePrivate
{
gboolean active;
};
static void
cally_stage_class_init (CallyStageClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
/* CallyActorClass *cally_class = CALLY_ACTOR_CLASS (klass); */
/* AtkObject */
class->get_name = cally_stage_get_name;
class->get_description = cally_stage_get_description;
class->initialize = cally_stage_real_initialize;
class->ref_state_set = cally_stage_ref_state_set;
g_type_class_add_private (gobject_class, sizeof (CallyStagePrivate));
/**
* CallyStage::activate:
* @cally_actor: the object which received the signal
*
* The ::activate signal is emitted when the stage receives the key
* focus from the underlying window system.
*
* Toolkit implementation note: it is used when anyone adds a global
* event listener to "window:activate"
*
* Since: 1.4
*/
cally_stage_signals [ACTIVATE] =
g_signal_new ("activate",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, /* default signal handler */
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
* CallyStage::create:
* @cally_actor: the object which received the signal
*
* The ::create signal is emitted when the stage is created.
*
* Toolkit implementation note: it is used when anyone adds a global
* event listener to "window:create"
*
* Since: 1.4
*/
cally_stage_signals [CREATE] =
g_signal_new ("create",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, /* default signal handler */
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
* CallyStage::deactivate:
* @cally_actor: the object which received the signal
*
* The ::deactivate signal is emitted when the stage loses key focus
* from the underlying window system.
*
* Toolkit implementation note: it is used when anyone adds a global
* event listener to "window:deactivate"
*
* Since: 1.4
*/
cally_stage_signals [DEACTIVATE] =
g_signal_new ("deactivate",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, /* default signal handler */
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
* CallyStage::destroy:
* @cally_actor: the object which received the signal
*
* The ::destroy signal is emitted when the stage is destroyed.
*
* Toolkit implementation note: it is used when anyone adds a global
* event listener to "window:destroy"
*
* Since: 1.4
*/
cally_stage_signals [DESTROY] =
g_signal_new ("destroy",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, /* default signal handler */
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
static void
cally_stage_init (CallyStage *cally_stage)
{
CallyStagePrivate *priv = CALLY_STAGE_GET_PRIVATE (cally_stage);
cally_stage->priv = priv;
priv->active = FALSE;
}
/**
* cally_stage_new:
* @actor: a #ClutterActor
*
* Creates a new #CallyStage for the given @actor. @actor should be a
* #ClutterStage.
*
* Return value: the newly created #AtkObject
*
* Since: 1.4
*/
AtkObject*
cally_stage_new (ClutterActor *actor)
{
GObject *object = NULL;
AtkObject *accessible = NULL;
g_return_val_if_fail (CLUTTER_IS_STAGE (actor), NULL);
object = g_object_new (CALLY_TYPE_STAGE, NULL);
accessible = ATK_OBJECT (object);
atk_object_initialize (accessible, actor);
return accessible;
}
/* AtkObject.h */
static G_CONST_RETURN gchar *
cally_stage_get_name (AtkObject *obj)
{
G_CONST_RETURN gchar *name = NULL;
g_return_val_if_fail (CALLY_IS_STAGE (obj), NULL);
/* parent name */
name = ATK_OBJECT_CLASS (cally_stage_parent_class)->get_name (obj);
if (name == NULL)
name = CALLY_STAGE_DEFAULT_NAME;
return name;
}
static G_CONST_RETURN gchar *
cally_stage_get_description (AtkObject *obj)
{
G_CONST_RETURN gchar *description = NULL;
g_return_val_if_fail (CALLY_IS_STAGE (obj), NULL);
/* parent description */
description = ATK_OBJECT_CLASS (cally_stage_parent_class)->get_description (obj);
if (description == NULL)
description = CALLY_STAGE_DEFAULT_DESCRIPTION;
return description;
}
static void
cally_stage_real_initialize (AtkObject *obj,
gpointer data)
{
ClutterStage *stage = NULL;
g_return_if_fail (CALLY_IS_STAGE (obj));
ATK_OBJECT_CLASS (cally_stage_parent_class)->initialize (obj, data);
stage = CLUTTER_STAGE (CALLY_GET_CLUTTER_ACTOR (obj));
g_signal_connect (stage, "activate", G_CALLBACK (cally_stage_activate_cb), obj);
g_signal_connect (stage, "deactivate", G_CALLBACK (cally_stage_deactivate_cb), obj);
obj->role = ATK_ROLE_CANVAS;
}
static AtkStateSet*
cally_stage_ref_state_set (AtkObject *obj)
{
CallyStage *cally_stage = NULL;
AtkStateSet *state_set = NULL;
ClutterStage *stage = NULL;
g_return_val_if_fail (CALLY_IS_STAGE (obj), NULL);
cally_stage = CALLY_STAGE (obj);
state_set = ATK_OBJECT_CLASS (cally_stage_parent_class)->ref_state_set (obj);
stage = CLUTTER_STAGE (CALLY_GET_CLUTTER_ACTOR (cally_stage));
if (stage == NULL)
return state_set;
if (cally_stage->priv->active)
atk_state_set_add_state (state_set, ATK_STATE_ACTIVE);
return state_set;
}
/* Auxiliar */
static void
cally_stage_activate_cb (ClutterStage *stage,
gpointer data)
{
CallyStage *cally_stage = NULL;
g_return_if_fail (CALLY_IS_STAGE (data));
cally_stage = CALLY_STAGE (data);
cally_stage->priv->active = TRUE;
atk_object_notify_state_change (ATK_OBJECT (cally_stage),
ATK_STATE_ACTIVE, TRUE);
g_signal_emit (cally_stage, cally_stage_signals [ACTIVATE], 0);
}
static void
cally_stage_deactivate_cb (ClutterStage *stage,
gpointer data)
{
CallyStage *cally_stage = NULL;
g_return_if_fail (CALLY_IS_STAGE (data));
cally_stage = CALLY_STAGE (data);
cally_stage->priv->active = FALSE;
atk_object_notify_state_change (ATK_OBJECT (cally_stage),
ATK_STATE_ACTIVE, FALSE);
g_signal_emit (cally_stage, cally_stage_signals [DEACTIVATE], 0);
}

View File

@ -0,0 +1,82 @@
/* CALLY - The Clutter Accessibility Implementation Library
*
* Copyright (C) 2008 Igalia, S.L.
*
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
*
* 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/>.
*/
#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <cally/cally.h> can be included directly."
#endif
#ifndef __CALLY_STAGE_H__
#define __CALLY_STAGE_H__
#include <cally/cally-group.h>
#include <clutter/clutter-stage.h>
G_BEGIN_DECLS
#define CALLY_TYPE_STAGE (cally_stage_get_type ())
#define CALLY_STAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_STAGE, CallyStage))
#define CALLY_STAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_STAGE, CallyStageClass))
#define CALLY_IS_STAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_STAGE))
#define CALLY_IS_STAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_STAGE))
#define CALLY_STAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_STAGE, CallyStageClass))
typedef struct _CallyStage CallyStage;
typedef struct _CallyStageClass CallyStageClass;
typedef struct _CallyStagePrivate CallyStagePrivate;
/**
* CallyStage:
*
* The <structname>CallyStage</structname> structure contains only
* private data and should be accessed using the provided API
*
* Since: 1.4
*/
struct _CallyStage
{
/*< private >*/
CallyGroup parent;
CallyStagePrivate *priv;
};
/**
* CallyStageClass:
*
* The <structname>CallyStageClass</structname> structure contains only
* private data
*
* Since: 1.4
*/
struct _CallyStageClass
{
/*< private >*/
CallyGroupClass parent_class;
/* padding for future expansion */
gpointer _padding_dummy[16];
};
GType cally_stage_get_type (void) G_GNUC_CONST;
AtkObject *cally_stage_new (ClutterActor *actor);
G_END_DECLS
#endif /* __CALLY_STAGE_H__ */

1254
clutter/cally/cally-text.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,82 @@
/* CALLY - The Clutter Accessibility Implementation Library
*
* Copyright (C) 2009 Igalia, S.L.
*
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
*
* 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/>.
*/
#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <cally/cally.h> can be included directly."
#endif
#ifndef __CALLY_TEXT_H__
#define __CALLY_TEXT_H__
#include <cally/cally-actor.h>
#include <clutter/clutter-text.h>
G_BEGIN_DECLS
#define CALLY_TYPE_TEXT (cally_text_get_type ())
#define CALLY_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_TEXT, CallyText))
#define CALLY_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_TEXT, CallyTextClass))
#define CALLY_IS_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_TEXT))
#define CALLY_IS_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_TEXT))
#define CALLY_TEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_TEXT, CallyTextClass))
typedef struct _CallyText CallyText;
typedef struct _CallyTextClass CallyTextClass;
typedef struct _CallyTextPrivate CallyTextPrivate;
/**
* CallyText:
*
* The <structname>CallyText</structname> structure contains only private
* data and should be accessed using the provided API
*
* Since: 1.4
*/
struct _CallyText
{
/*< private >*/
CallyActor parent;
CallyTextPrivate *priv;
};
/**
* CallyTextClass:
*
* The <structname>CallyTextClass</structname> structure contains only
* private data
*
* Since: 1.4
*/
struct _CallyTextClass
{
/*< private >*/
CallyActorClass parent_class;
/* padding for future expansion */
gpointer _padding_dummy[8];
};
GType cally_text_get_type (void) G_GNUC_CONST;
AtkObject* cally_text_new (ClutterActor *actor);
G_END_DECLS
#endif /* __CALLY_TEXT_H__ */

View File

@ -0,0 +1,115 @@
/* CALLY - The Clutter Accessibility Implementation Library
*
* Copyright (C) 2009 Igalia, S.L.
*
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
*
* 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.
*/
/**
* SECTION:cally-texture
* @Title: CallyTexture
* @short_description: Implementation of the ATK interfaces for a #ClutterTexture
* @see_also: #ClutterTexture
*
* #CallyTexture implements the required ATK interfaces of #ClutterTexture
*
* In particular it sets a proper role for the texture.
*/
#include "cally-texture.h"
#include "cally-actor-private.h"
#define CALLY_TEXTURE_DEFAULT_DESCRIPTION "A texture"
static void cally_texture_class_init (CallyTextureClass *klass);
static void cally_texture_init (CallyTexture *texture);
/* AtkObject */
static void cally_texture_real_initialize (AtkObject *obj,
gpointer data);
static G_CONST_RETURN gchar *cally_texture_get_description (AtkObject *obj);
G_DEFINE_TYPE (CallyTexture, cally_texture, CALLY_TYPE_ACTOR)
static void
cally_texture_class_init (CallyTextureClass *klass)
{
/* GObjectClass *gobject_class = G_OBJECT_CLASS (klass); */
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
class->initialize = cally_texture_real_initialize;
class->get_description = cally_texture_get_description;
}
static void
cally_texture_init (CallyTexture *texture)
{
/* nothing to do yet */
}
/**
* cally_texture_new:
* @actor: a #ClutterActor
*
* Creates a new #CallyTexture for the given @actor. @actor must be
* a #ClutterTexture.
*
* Return value: the newly created #AtkObject
*
* Since: 1.4
*/
AtkObject*
cally_texture_new (ClutterActor *actor)
{
GObject *object = NULL;
AtkObject *accessible = NULL;
g_return_val_if_fail (CLUTTER_IS_TEXTURE (actor), NULL);
object = g_object_new (CALLY_TYPE_TEXTURE, NULL);
accessible = ATK_OBJECT (object);
atk_object_initialize (accessible, actor);
return accessible;
}
static void
cally_texture_real_initialize (AtkObject *obj,
gpointer data)
{
ATK_OBJECT_CLASS (cally_texture_parent_class)->initialize (obj, data);
/* default role */
obj->role = ATK_ROLE_IMAGE;
}
static G_CONST_RETURN gchar *
cally_texture_get_description (AtkObject *obj)
{
G_CONST_RETURN gchar *description = NULL;
g_return_val_if_fail (CALLY_IS_TEXTURE (obj), NULL);
description = ATK_OBJECT_CLASS (cally_texture_parent_class)->get_description (obj);
if (description == NULL)
description = CALLY_TEXTURE_DEFAULT_DESCRIPTION;
return description;
}

View File

@ -0,0 +1,82 @@
/* CALLY - The Clutter Accessibility Implementation Library
*
* Copyright (C) 2009 Igalia, S.L.
*
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
*
* 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/>.
*/
#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <cally/cally.h> can be included directly."
#endif
#ifndef __CALLY_TEXTURE_H__
#define __CALLY_TEXTURE_H__
#include <cally/cally-actor.h>
#include <clutter/clutter-texture.h>
G_BEGIN_DECLS
#define CALLY_TYPE_TEXTURE (cally_texture_get_type ())
#define CALLY_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_TEXTURE, CallyTexture))
#define CALLY_TEXTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_TEXTURE, CallyTextureClass))
#define CALLY_IS_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_TEXTURE))
#define CALLY_IS_TEXTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_TEXTURE))
#define CALLY_TEXTURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_TEXTURE, CallyTextureClass))
typedef struct _CallyTexture CallyTexture;
typedef struct _CallyTextureClass CallyTextureClass;
typedef struct _CallyTexturePrivate CallyTexturePrivate;
/**
* CallyTexture:
*
* The <structname>CallyTexture</structname> structure contains only
* private data and should be accessed using the provided API
*
* Since: 1.4
*/
struct _CallyTexture
{
/*< private >*/
CallyActor parent;
CallyTexturePrivate *priv;
};
/**
* CallyTextureClass:
*
* The <structname>CallyTextureClass</structname> structure contains
* only private data
*
* Since: 1.4
*/
struct _CallyTextureClass
{
/*< private >*/
CallyActorClass parent_class;
/* padding for future expansion */
gpointer _padding_dummy[8];
};
GType cally_texture_get_type (void) G_GNUC_CONST;
AtkObject *cally_texture_new (ClutterActor *actor);
G_END_DECLS
#endif /* __CALLY_TEXTURE_H__ */

560
clutter/cally/cally-util.c Normal file
View File

@ -0,0 +1,560 @@
/* CALLY - The Clutter Accessibility Implementation Library
*
* Copyright (C) 2008 Igalia, S.L.
*
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
*
* Based on GailUtil from GAIL
* Copyright 2001, 2002, 2003 Sun Microsystems Inc.
*
* 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.
*/
/**
* SECTION:cally-util
* @Title: CallyUtil
* @short_description: #AtkUtil implementation
* @see_also: #ClutterActor
*
* #CallyUtil implements #AtkUtil abstract methods. Although it
* includes the name "Util" it is in fact one of the most important
* interfaces to be implemented in any ATK toolkit implementation.
* For instance, it defines atk_get_root(), the method that returns
* the root object in the hierarchy. Without it, you don't have
* available any accessible object.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <string.h>
#include <clutter/clutter.h>
#include "cally-util.h"
#include "cally-root.h"
#include "cally-stage.h"
static void cally_util_class_init (CallyUtilClass *klass);
static void cally_util_init (CallyUtil *cally_util);
/* atkutil.h */
static guint cally_util_add_global_event_listener (GSignalEmissionHook listener,
const gchar* event_type);
static void cally_util_remove_global_event_listener (guint remove_listener);
static guint cally_util_add_key_event_listener (AtkKeySnoopFunc listener,
gpointer data);
static void cally_util_remove_key_event_listener (guint remove_listener);
static AtkObject* cally_util_get_root (void);
static G_CONST_RETURN gchar *cally_util_get_toolkit_name (void);
static G_CONST_RETURN gchar *cally_util_get_toolkit_version (void);
/* private */
static void _listener_info_destroy (gpointer data);
static guint add_listener (GSignalEmissionHook listener,
const gchar *object_type,
const gchar *signal,
const gchar *hook_data);
static void cally_util_simulate_snooper_install (void);
static void cally_util_simulate_snooper_remove (void);
static gboolean cally_key_snooper (ClutterActor *actor,
ClutterEvent *event,
gpointer user_data);
static void cally_util_stage_added_cb (ClutterStageManager *stage_manager,
ClutterStage *stage,
gpointer data);
static void cally_util_stage_removed_cb (ClutterStageManager *stage_manager,
ClutterStage *stage,
gpointer data);
static gboolean notify_hf (gpointer key,
gpointer value,
gpointer data);
static void insert_hf (gpointer key,
gpointer value,
gpointer data);
static AtkKeyEventStruct * atk_key_event_from_clutter_event_key (ClutterKeyEvent *event);
static void do_window_event_initialization (void);
/* This is just a copy of the Gail one, a shared library or place to
define it could be a good idea. */
typedef struct _CallyUtilListenerInfo CallyUtilListenerInfo;
typedef struct _CallyKeyEventInfo CallyKeyEventInfo;
struct _CallyUtilListenerInfo
{
gint key;
guint signal_id;
gulong hook_id;
};
struct _CallyKeyEventInfo
{
AtkKeySnoopFunc listener;
gpointer func_data;
};
static AtkObject* root = NULL;
static GHashTable *listener_list = NULL;
static GHashTable *key_listener_list = NULL;
static gint listener_idx = 1;
G_DEFINE_TYPE (CallyUtil, cally_util, ATK_TYPE_UTIL);
static void
cally_util_class_init (CallyUtilClass *klass)
{
AtkUtilClass *atk_class;
gpointer data;
data = g_type_class_peek (ATK_TYPE_UTIL);
atk_class = ATK_UTIL_CLASS (data);
atk_class->add_global_event_listener = cally_util_add_global_event_listener;
atk_class->remove_global_event_listener = cally_util_remove_global_event_listener;
atk_class->add_key_event_listener = cally_util_add_key_event_listener;
atk_class->remove_key_event_listener = cally_util_remove_key_event_listener;
atk_class->get_root = cally_util_get_root;
atk_class->get_toolkit_name = cally_util_get_toolkit_name;
atk_class->get_toolkit_version = cally_util_get_toolkit_version;
/* FIXME: Instead of create this on the class, I think that would
worth to implement CallyUtil as a singleton instance, so the
class methods will access this instance. This will be a good
future enhancement, meanwhile, just using the same *working*
implementation used on GailUtil */
listener_list = g_hash_table_new_full (g_int_hash, g_int_equal, NULL,
_listener_info_destroy);
}
static void
cally_util_init (CallyUtil *cally_util)
{
/* instance init: usually not required */
}
/* ------------------------------ ATK UTIL METHODS -------------------------- */
static AtkObject*
cally_util_get_root (void)
{
if (!root)
root = cally_root_new ();
return root;
}
static G_CONST_RETURN gchar *
cally_util_get_toolkit_name (void)
{
return "CALLY";
}
static G_CONST_RETURN gchar *
cally_util_get_toolkit_version (void)
{
/*
* FIXME:
* Version is passed in as a -D flag when this file is
* compiled.
*/
return "0.1";
}
static guint
cally_util_add_global_event_listener (GSignalEmissionHook listener,
const gchar *event_type)
{
guint rc = 0;
gchar **split_string;
split_string = g_strsplit (event_type, ":", 3);
if (split_string)
{
if (!strcmp ("window", split_string[0]))
{
/* Using ClutterStage as the window equivalent, although
several methods (move, etc) are missing. This would be
probably defined for other window-related classes (MxWindow)
FIXME: for this reason, this process should be extendable
on the future.*/
static gboolean initialized = FALSE;
if (initialized == FALSE)
{
do_window_event_initialization ();
initialized = TRUE;
}
rc = add_listener (listener, "CallyStage", split_string[1], event_type);
}
else
{
rc = add_listener (listener, split_string[1], split_string[2], event_type);
}
g_strfreev (split_string);
}
return rc;
}
static void
cally_util_remove_global_event_listener (guint remove_listener)
{
if (remove_listener > 0)
{
CallyUtilListenerInfo *listener_info;
gint tmp_idx = remove_listener;
listener_info = (CallyUtilListenerInfo *)
g_hash_table_lookup(listener_list, &tmp_idx);
if (listener_info != NULL)
{
/* Hook id of 0 and signal id of 0 are invalid */
if (listener_info->hook_id != 0 && listener_info->signal_id != 0)
{
/* Remove the emission hook */
g_signal_remove_emission_hook(listener_info->signal_id,
listener_info->hook_id);
/* Remove the element from the hash */
g_hash_table_remove(listener_list, &tmp_idx);
}
else
{
g_warning("Invalid listener hook_id %ld or signal_id %d\n",
listener_info->hook_id, listener_info->signal_id);
}
}
else
{
g_warning("No listener with the specified listener id %d",
remove_listener);
}
}
else
{
g_warning("Invalid listener_id %d", remove_listener);
}
}
static guint
cally_util_add_key_event_listener (AtkKeySnoopFunc listener,
gpointer data)
{
static guint key=0;
CallyKeyEventInfo *event_info = NULL;
if (!key_listener_list)
{
key_listener_list = g_hash_table_new_full (NULL, NULL, NULL, g_free);
cally_util_simulate_snooper_install ();
}
event_info = g_new (CallyKeyEventInfo, 1);
event_info->listener = listener;
event_info->func_data = data;
g_hash_table_insert (key_listener_list, GUINT_TO_POINTER (key++), event_info);
/* XXX: we don't check to see if n_listeners > MAXUINT */
return key - 1;
}
static void
cally_util_remove_key_event_listener (guint remove_listener)
{
if (!g_hash_table_remove (key_listener_list, GUINT_TO_POINTER (remove_listener))) {
g_warning ("Not able to remove listener with id %i", remove_listener);
}
if (g_hash_table_size (key_listener_list) == 0)
{
cally_util_simulate_snooper_remove ();
}
}
/* ------------------------------ PRIVATE FUNCTIONS ------------------------- */
static void
_listener_info_destroy (gpointer data)
{
g_free(data);
}
static guint
add_listener (GSignalEmissionHook listener,
const gchar *object_type,
const gchar *signal_name,
const gchar *hook_data)
{
GType type;
guint signal_id;
gint rc = 0;
type = g_type_from_name (object_type);
if (type)
{
signal_id = g_signal_lookup (signal_name, type);
if (signal_id > 0)
{
CallyUtilListenerInfo *listener_info;
rc = listener_idx;
listener_info = g_new (CallyUtilListenerInfo, 1);
listener_info->key = listener_idx;
listener_info->hook_id =
g_signal_add_emission_hook (signal_id, 0, listener,
g_strdup (hook_data),
(GDestroyNotify) g_free);
listener_info->signal_id = signal_id;
g_hash_table_insert(listener_list, &(listener_info->key), listener_info);
listener_idx++;
}
else
{
/* This is mainly because some "window:xxx" methods not
implemented on CallyStage */
g_debug ("Signal type %s not supported\n", signal_name);
}
}
else
{
g_warning("Invalid object type %s\n", object_type);
}
return rc;
}
/* Trying to emulate gtk_key_snooper install (a kind of wrapper). This
could be implemented without it, but I will maintain it in this
way, so if in the future clutter implements it natively it would be
easier the transition */
static void
cally_util_simulate_snooper_install (void)
{
ClutterStageManager *stage_manager = NULL;
ClutterStage *stage = NULL;
GSList *stage_list = NULL;
GSList *iter = NULL;
stage_manager = clutter_stage_manager_get_default ();
stage_list = clutter_stage_manager_list_stages (stage_manager);
for (iter = stage_list; iter != NULL; iter = g_slist_next (iter))
{
stage = CLUTTER_STAGE (iter->data);
g_signal_connect (G_OBJECT (stage), "captured-event",
G_CALLBACK (cally_key_snooper), NULL);
}
g_signal_connect (G_OBJECT (stage_manager), "stage-added",
G_CALLBACK (cally_util_stage_added_cb), cally_key_snooper);
g_signal_connect (G_OBJECT (stage_manager), "stage-removed",
G_CALLBACK (cally_util_stage_removed_cb), cally_key_snooper);
}
static void
cally_util_simulate_snooper_remove (void)
{
ClutterStageManager *stage_manager = NULL;
ClutterStage *stage = NULL;
GSList *stage_list = NULL;
GSList *iter = NULL;
gint num = 0;
stage_manager = clutter_stage_manager_get_default ();
stage_list = clutter_stage_manager_list_stages (stage_manager);
for (iter = stage_list; iter != NULL; iter = g_slist_next (iter))
{
stage = CLUTTER_STAGE (iter->data);
num += g_signal_handlers_disconnect_by_func (stage, cally_key_snooper, NULL);
}
g_signal_handlers_disconnect_by_func (G_OBJECT (stage_manager),
G_CALLBACK (cally_util_stage_added_cb),
cally_key_snooper);
g_signal_handlers_disconnect_by_func (G_OBJECT (stage_manager),
G_CALLBACK (cally_util_stage_removed_cb),
cally_key_snooper);
#ifdef CALLY_DEBUG
g_print ("Number of snooper callbacks disconnected: %i\n", num);
#endif
}
static AtkKeyEventStruct *
atk_key_event_from_clutter_event_key (ClutterKeyEvent *clutter_event)
{
AtkKeyEventStruct *atk_event = g_new0 (AtkKeyEventStruct, 1);
gunichar key_unichar;
switch (clutter_event->type)
{
case CLUTTER_KEY_PRESS:
atk_event->type = ATK_KEY_EVENT_PRESS;
break;
case CLUTTER_KEY_RELEASE:
atk_event->type = ATK_KEY_EVENT_RELEASE;
break;
default:
g_assert_not_reached ();
return NULL;
}
atk_event->state = clutter_event->modifier_state;
/* We emit the clutter keyval. This is not exactly the one expected
by AtkKeyEventStruct, as it expects a Gdk-like event, with the
modifiers applied. But to avoid a dependency to gdk, we delegate
that on the AT application.
More information: Bug 1952 and bug 2072
*/
atk_event->keyval = clutter_event->keyval;
/* It is expected to store a key defining string here (ie "Space" in
case you press a space). Anyway, there are no function on clutter
to obtain that, and we want to avoid a gdk dependency here, so we
delegate on the AT application to obtain that string using the
rest of the data on the ATK event struct.
More information: Bug 1952 and 2072
*/
key_unichar = clutter_event_get_key_unicode ((ClutterEvent *) clutter_event);
if (g_unichar_validate (key_unichar) && !g_unichar_iscntrl (key_unichar))
{
GString *new = NULL;
new = g_string_new ("");
new = g_string_insert_unichar (new, 0, key_unichar);
atk_event->string = new->str;
g_string_free (new, FALSE);
}
else
atk_event->string = NULL;
atk_event->length = 0;
atk_event->keycode = clutter_event->hardware_keycode;
atk_event->timestamp = clutter_event->time;
#ifdef CALLY_DEBUG
g_debug ("CallyKeyEvent:\tsym 0x%x\n\t\tmods %x\n\t\tcode %u\n\t\ttime %lx \n\t\tstring %s\n",
(unsigned int) atk_event->keyval,
(unsigned int) atk_event->state,
(unsigned int) atk_event->keycode,
(unsigned long int) atk_event->timestamp,
atk_event->string);
#endif
return atk_event;
}
static gboolean
notify_hf (gpointer key, gpointer value, gpointer data)
{
CallyKeyEventInfo *info = (CallyKeyEventInfo *) value;
AtkKeyEventStruct *key_event = (AtkKeyEventStruct *)data;
return (*(AtkKeySnoopFunc) info->listener) (key_event, info->func_data) ? TRUE : FALSE;
}
static void
insert_hf (gpointer key, gpointer value, gpointer data)
{
GHashTable *new_table = (GHashTable *) data;
g_hash_table_insert (new_table, key, value);
}
static gboolean
cally_key_snooper (ClutterActor *actor,
ClutterEvent *event,
gpointer user_data)
{
AtkKeyEventStruct *key_event = NULL;
gint consumed = 0;
/* filter key events */
if ((event->type != CLUTTER_KEY_PRESS) && (event->type != CLUTTER_KEY_RELEASE))
{
return FALSE;
}
if (key_listener_list)
{
GHashTable *new_hash = g_hash_table_new (NULL, NULL);
g_hash_table_foreach (key_listener_list, insert_hf, new_hash);
key_event = atk_key_event_from_clutter_event_key ((ClutterKeyEvent *)event);
/* func data is inside the hash table */
consumed = g_hash_table_foreach_steal (new_hash, notify_hf, key_event);
g_hash_table_destroy (new_hash);
}
g_free (key_event->string);
g_free (key_event);
return (consumed ? 1 : 0);
}
static void
cally_util_stage_added_cb (ClutterStageManager *stage_manager,
ClutterStage *stage,
gpointer data)
{
GCallback cally_key_snooper_cb = G_CALLBACK (data);
g_signal_connect (G_OBJECT (stage), "captured-event", cally_key_snooper_cb, NULL);
}
static void
cally_util_stage_removed_cb (ClutterStageManager *stage_manager,
ClutterStage *stage,
gpointer data)
{
GCallback cally_key_snooper_cb = G_CALLBACK (data);
gint num = 0;
num = g_signal_handlers_disconnect_by_func (stage, cally_key_snooper_cb, NULL);
}
static void
do_window_event_initialization (void)
{
/*
* Ensure that CallyStageClass exists.
*/
g_type_class_unref (g_type_class_ref (CALLY_TYPE_STAGE));
}

View File

@ -0,0 +1,80 @@
/* CALLY - The Clutter Accessibility Implementation Library
*
* Copyright (C) 2008 Igalia, S.L.
*
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
*
* 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/>.
*/
#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <cally/cally.h> can be included directly."
#endif
#ifndef __CALLY_UTIL_H__
#define __CALLY_UTIL_H__
#include <atk/atk.h>
G_BEGIN_DECLS
#define CALLY_TYPE_UTIL (cally_util_get_type ())
#define CALLY_UTIL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_UTIL, CallyUtil))
#define CALLY_UTIL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_UTIL, CallyUtilClass))
#define CALLY_IS_UTIL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_UTIL))
#define CALLY_IS_UTIL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_UTIL))
#define CALLY_UTIL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_UTIL, CallyUtilClass))
typedef struct _CallyUtil CallyUtil;
typedef struct _CallyUtilClass CallyUtilClass;
typedef struct _CallyUtilPrivate CallyUtilPrivate;
/**
* CallyUtil:
*
* The <structname>CallyUtil</structname> structure contains only
* private data and should be accessed using the provided API
*
* Since: 1.4
*/
struct _CallyUtil
{
/*< private >*/
AtkUtil parent;
CallyUtilPrivate *priv;
};
/**
* CallyUtilClass:
*
* The <structname>CallyUtilClass</structname> structure contains only
* private data
*
* Since: 1.4
*/
struct _CallyUtilClass
{
/*< private >*/
AtkUtilClass parent_class;
/* padding for future expansion */
gpointer _padding_dummy[8];
};
GType cally_util_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __CALLY_UTIL_H__ */

113
clutter/cally/cally.c Normal file
View File

@ -0,0 +1,113 @@
/* CALLY - The Clutter Accessibility Implementation Library
*
* Copyright (C) 2008 Igalia, S.L.
*
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
*
* 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.
*/
/**
* SECTION:cally
* @Title: Cally
* @short_description: Cally initialization methods.
*
* Cally initialization methods.
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "cally.h"
#include "cally-actor.h"
#include "cally-group.h"
#include "cally-stage.h"
#include "cally-text.h"
#include "cally-texture.h"
#include "cally-rectangle.h"
#include "cally-clone.h"
#include "cally-factory.h"
#include "cally-util.h"
#include "clutter.h"
#include "clutter-debug.h"
#include "clutter-private.h"
static int cally_initialized = FALSE;
/* factories initialization*/
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_ACTOR, cally_actor, cally_actor_new)
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_GROUP, cally_group, cally_group_new)
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_STAGE, cally_stage, cally_stage_new)
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_TEXT, cally_text, cally_text_new)
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_TEXTURE, cally_texture, cally_texture_new)
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_RECTANGLE, cally_rectangle, cally_rectangle_new)
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_CLONE, cally_clone, cally_clone_new)
/**
* cally_accessibility_init:
*
* Initializes the accessibility support.
*
* Return value: %TRUE if accessibility support has been correctly
* initialized.
*
* Since: 1.4
*/
gboolean
cally_accessibility_init (void)
{
if (cally_initialized)
return TRUE;
cally_initialized = TRUE;
/* setting the factories */
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_ACTOR, cally_actor);
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_GROUP, cally_group);
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_STAGE, cally_stage);
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_TEXT, cally_text);
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_TEXTURE, cally_texture);
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_RECTANGLE, cally_rectangle);
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_CLONE, cally_clone);
/* Initialize the CallyUtility class */
g_type_class_unref (g_type_class_ref (CALLY_TYPE_UTIL));
CLUTTER_NOTE (MISC, "Clutter Accessibility initialized");
return cally_initialized;
}
/**
* cally_get_cally_initialized:
*
* Returns if the accessibility support using cally is enabled.
*
* Return value: %TRUE if accessibility support has been correctly
* initialized.
*
* Since: 1.4
*/
gboolean cally_get_cally_initialized (void)
{
return cally_initialized;
}

40
clutter/cally/cally.h Normal file
View File

@ -0,0 +1,40 @@
/* CALLY - The Clutter Accessibility Implementation Library
*
* Copyright (C) 2008 Igalia, S.L.
*
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
*
* 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 __CALLY_H__
#define __CALLY_H__
#define __CALLY_H_INSIDE__
#include "cally-actor.h"
#include "cally-clone.h"
#include "cally-factory.h"
#include "cally-group.h"
#include "cally-main.h"
#include "cally-rectangle.h"
#include "cally-root.h"
#include "cally-stage.h"
#include "cally-text.h"
#include "cally-texture.h"
#include "cally-util.h"
#undef __CALLY_H_INSIDE__
#endif /* __CALLY_H__ */

18
clutter/cally/cally.pc.in Normal file
View File

@ -0,0 +1,18 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
apiversion=@CLUTTER_API_VERSION@
winsys=@CLUTTER_WINSYS@
soname_infix=@CLUTTER_SONAME_INFIX@
cogl_driver=@COGL_DRIVER@
requires=@CLUTTER_REQUIRES@
Name: Cally
Description: Clutter Accessibility Implementation Library
Version: @VERSION@
Requires: atk clutter-1.0
Libs: -L${libdir} -lclutter-${winsys}-${apiversion}
Cflags: -I${includedir}/clutter-${apiversion}
Requires: ${requires}

View File

@ -114,6 +114,8 @@
#include "cogl/cogl.h"
#include "pango/cogl-pango.h"
#include "cally.h" /* For accessibility support */
/* main context */
static ClutterMainContext *ClutterCntx = NULL;
@ -128,6 +130,7 @@ static gboolean clutter_show_fps = FALSE;
static gboolean clutter_fatal_warnings = FALSE;
static gboolean clutter_disable_mipmap_text = FALSE;
static gboolean clutter_use_fuzzy_picking = FALSE;
static gboolean clutter_enable_accessibility = TRUE;
static guint clutter_default_fps = 60;
@ -203,6 +206,24 @@ clutter_get_show_fps (void)
return clutter_show_fps;
}
/**
* clutter_get_accessibility_enabled:
*
* Returns whether Clutter has accessibility support enabled. As
* least, a value of TRUE means that there are a proper AtkUtil
* implementation available
*
* Return value: %TRUE if Clutter has accessibility support enabled
*
* Since: 1.4
*/
gboolean
clutter_get_accessibility_enabled (void)
{
return cally_get_cally_initialized ();
}
void
_clutter_stage_maybe_relayout (ClutterActor *stage)
{
@ -1591,6 +1612,10 @@ clutter_init_real (GError **error)
clutter_is_initialized = TRUE;
ctx->is_initialized = TRUE;
/* Initialize a11y */
if (clutter_enable_accessibility)
cally_accessibility_init ();
return CLUTTER_INIT_SUCCESS;
}
@ -1622,6 +1647,8 @@ static GOptionEntry clutter_args[] = {
{ "clutter-no-profile", 0, 0, G_OPTION_ARG_CALLBACK, clutter_arg_no_profile_cb,
N_("Clutter profiling flags to unset"), "FLAGS" },
#endif /* CLUTTER_ENABLE_PROFILE */
{ "clutter-enable-accessibility", 0, 0, G_OPTION_ARG_NONE, &clutter_enable_accessibility,
N_("Enable accessibility"), NULL },
{ NULL, },
};

View File

@ -102,6 +102,7 @@ void clutter_do_event (ClutterEvent *event);
gboolean clutter_get_debug_enabled (void);
gboolean clutter_get_show_fps (void);
gulong clutter_get_timestamp (void);
gboolean clutter_get_accessibility_enabled (void);
/* Threading functions */
void clutter_threads_init (void);

View File

@ -221,7 +221,7 @@ coglinclude_HEADERS = $(cogl_headers)
nodist_coglinclude_HEADERS = cogl-defines.h cogl-enum-types.h
if HAVE_INTROSPECTION
Cogl-@CLUTTER_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libclutter-cogl.la
Cogl-@CLUTTER_API_VERSION@.gir: Makefile $(INTROSPECTION_SCANNER) libclutter-cogl.la
$(QUIET_GEN)$(INTROSPECTION_SCANNER) -v \
--namespace Cogl --nsversion=@CLUTTER_API_VERSION@ \
$(INCLUDES) \