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
commit e3a8ece54d
50 changed files with 7373 additions and 10 deletions

14
.gitignore vendored
View File

@ -29,6 +29,7 @@ stamp-marshal
/clutter/cogl/cogl/driver/gles/cogl-fixed-fragment-shader.[ch] /clutter/cogl/cogl/driver/gles/cogl-fixed-fragment-shader.[ch]
/clutter/x11/clutter-x11-enum-types.[ch] /clutter/x11/clutter-x11-enum-types.[ch]
/clutter/json/*.gir /clutter/json/*.gir
/clutter/cally/cally*.pc
*.gir *.gir
*.typelib *.typelib
config.* config.*
@ -69,6 +70,19 @@ doc/reference/cogl/cogl.signals
doc/reference/cogl/cogl-docs.xml doc/reference/cogl/cogl-docs.xml
doc/reference/cogl/*.stamp doc/reference/cogl/*.stamp
doc/reference/cogl/*.bak doc/reference/cogl/*.bak
doc/reference/cally/cally-*.txt
!/doc/reference/cally/cally-sections.txt
doc/reference/cally/html
doc/reference/cally/tmpl
doc/reference/cally/xml
doc/reference/cally/cally.args
doc/reference/cally/cally.hierarchy
doc/reference/cally/cally.interfaces
doc/reference/cally/cally.prerequisites
doc/reference/cally/cally.signals
doc/reference/cally/cally-docs.xml
doc/reference/cally/*.stamp
doc/reference/cally/*.bak
doltcompile doltcompile
doltlibtool doltlibtool
gtk-doc.make gtk-doc.make

View File

@ -2,7 +2,7 @@ include $(top_srcdir)/build/autotools/Makefile.am.silent
NULL = NULL =
SUBDIRS = cogl $(CLUTTER_WINSYS_BASE) $(CLUTTER_WINSYS) SUBDIRS = cogl $(CLUTTER_WINSYS_BASE) $(CLUTTER_WINSYS) cally
if LOCAL_JSON_GLIB if LOCAL_JSON_GLIB
SUBDIRS += json SUBDIRS += json
@ -12,7 +12,7 @@ clutter_json_libadd = $(top_builddir)/clutter/json/libclutter-json.la
clutter_json_gir = ClutterJson-@CLUTTER_API_VERSION@.gir clutter_json_gir = ClutterJson-@CLUTTER_API_VERSION@.gir
endif endif
DIST_SUBDIRS = glx egl cogl json osx x11 win32 fruity DIST_SUBDIRS = glx egl cogl json osx x11 win32 fruity cally
# common definitions # common definitions
CLEANFILES = CLEANFILES =
@ -39,6 +39,7 @@ endif # SUPPORT_WIN32
INCLUDES = \ INCLUDES = \
-I$(top_srcdir) \ -I$(top_srcdir) \
-I$(top_srcdir)/clutter/cally \
-I$(top_srcdir)/clutter/cogl \ -I$(top_srcdir)/clutter/cogl \
-I$(top_srcdir)/clutter/cogl/pango \ -I$(top_srcdir)/clutter/cogl/pango \
-I$(top_srcdir)/clutter \ -I$(top_srcdir)/clutter \
@ -260,13 +261,16 @@ source_h_priv = \
libclutter_@CLUTTER_SONAME_INFIX@_@CLUTTER_API_VERSION@_la_LIBADD = \ libclutter_@CLUTTER_SONAME_INFIX@_@CLUTTER_API_VERSION@_la_LIBADD = \
$(CLUTTER_LIBS) \ $(CLUTTER_LIBS) \
$(top_builddir)/clutter/cally/libcally.la \
$(top_builddir)/clutter/cogl/cogl/libclutter-cogl.la \ $(top_builddir)/clutter/cogl/cogl/libclutter-cogl.la \
$(top_builddir)/clutter/cogl/pango/libcoglpango.la \ $(top_builddir)/clutter/cogl/pango/libcoglpango.la \
$(top_builddir)/clutter/$(CLUTTER_WINSYS)/libclutter-$(CLUTTER_WINSYS).la \ $(top_builddir)/clutter/$(CLUTTER_WINSYS)/libclutter-$(CLUTTER_WINSYS).la \
$(clutter_json_libadd) \ $(clutter_json_libadd) \
$(CLUTTER_WINSYS_BASE_LIB) $(CLUTTER_WINSYS_BASE_LIB)
libclutter_@CLUTTER_SONAME_INFIX@_@CLUTTER_API_VERSION@_la_DEPENDENCIES = \ 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/cogl/libclutter-cogl.la \
$(top_builddir)/clutter/cogl/pango/libcoglpango.la \ $(top_builddir)/clutter/cogl/pango/libcoglpango.la \
$(top_builddir)/clutter/$(CLUTTER_WINSYS)/libclutter-$(CLUTTER_WINSYS).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) \ $(CLUTTER_LT_LDFLAGS) \
$(GCOV_LDFLAGS) \ $(GCOV_LDFLAGS) \
-export-dynamic \ -export-dynamic \
-export-symbols-regex "^(clutter|cogl|json).*" \ -export-symbols-regex "^(clutter|cogl|cally|json).*" \
-rpath $(libdir) \ -rpath $(libdir) \
$(win32_resources_ldflag) \ $(win32_resources_ldflag) \
$(NULL) $(NULL)
@ -318,7 +322,7 @@ json_gir_pkg=
# If we are building it, ClutterJson gets the same handling as described # If we are building it, ClutterJson gets the same handling as described
# for Cogl above # 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) \ $(QUIET_GEN) \
shlib=`sed -n 's/.*shared-library="\([^"]*\)".*/\1/p' < Clutter-@CLUTTER_API_VERSION@.gir` ; \ 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 > $@ 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 # 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. # 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 \ $(QUIET_GEN)$(INTROSPECTION_SCANNER) -v \
--namespace Clutter --nsversion=@CLUTTER_API_VERSION@ \ --namespace Clutter --nsversion=@CLUTTER_API_VERSION@ \
$(INCLUDES) \ $(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 # 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 # that we compile and install, we transfer the shared-library="" line from
# Clutter.gir to Cogl.gir # 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) \ $(QUIET_GEN) \
shlib=`sed -n 's/.*shared-library="\([^"]*\)".*/\1/p' < Clutter-@CLUTTER_API_VERSION@.gir` ; \ 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 > $@ sed "s/shared-library=\"[^\"]*\"/shared-library=\"$$shlib\"/"< cogl/cogl/Cogl-@CLUTTER_API_VERSION@.gir > $@
BUILT_GIRSOURCES += 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 # INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to
# install anything - we need to install inside our prefix. # install anything - we need to install inside our prefix.
girdir = $(datadir)/gir-1.0 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 "cogl/cogl.h"
#include "pango/cogl-pango.h" #include "pango/cogl-pango.h"
#include "cally.h" /* For accessibility support */
/* main context */ /* main context */
static ClutterMainContext *ClutterCntx = NULL; static ClutterMainContext *ClutterCntx = NULL;
@ -128,6 +130,7 @@ static gboolean clutter_show_fps = FALSE;
static gboolean clutter_fatal_warnings = FALSE; static gboolean clutter_fatal_warnings = FALSE;
static gboolean clutter_disable_mipmap_text = FALSE; static gboolean clutter_disable_mipmap_text = FALSE;
static gboolean clutter_use_fuzzy_picking = FALSE; static gboolean clutter_use_fuzzy_picking = FALSE;
static gboolean clutter_enable_accessibility = TRUE;
static guint clutter_default_fps = 60; static guint clutter_default_fps = 60;
@ -203,6 +206,24 @@ clutter_get_show_fps (void)
return clutter_show_fps; 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 void
_clutter_stage_maybe_relayout (ClutterActor *stage) _clutter_stage_maybe_relayout (ClutterActor *stage)
{ {
@ -1591,6 +1612,10 @@ clutter_init_real (GError **error)
clutter_is_initialized = TRUE; clutter_is_initialized = TRUE;
ctx->is_initialized = TRUE; ctx->is_initialized = TRUE;
/* Initialize a11y */
if (clutter_enable_accessibility)
cally_accessibility_init ();
return CLUTTER_INIT_SUCCESS; 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, { "clutter-no-profile", 0, 0, G_OPTION_ARG_CALLBACK, clutter_arg_no_profile_cb,
N_("Clutter profiling flags to unset"), "FLAGS" }, N_("Clutter profiling flags to unset"), "FLAGS" },
#endif /* CLUTTER_ENABLE_PROFILE */ #endif /* CLUTTER_ENABLE_PROFILE */
{ "clutter-enable-accessibility", 0, 0, G_OPTION_ARG_NONE, &clutter_enable_accessibility,
N_("Enable accessibility"), NULL },
{ NULL, }, { NULL, },
}; };

View File

@ -102,6 +102,7 @@ void clutter_do_event (ClutterEvent *event);
gboolean clutter_get_debug_enabled (void); gboolean clutter_get_debug_enabled (void);
gboolean clutter_get_show_fps (void); gboolean clutter_get_show_fps (void);
gulong clutter_get_timestamp (void); gulong clutter_get_timestamp (void);
gboolean clutter_get_accessibility_enabled (void);
/* Threading functions */ /* Threading functions */
void clutter_threads_init (void); 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 nodist_coglinclude_HEADERS = cogl-defines.h cogl-enum-types.h
if HAVE_INTROSPECTION 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 \ $(QUIET_GEN)$(INTROSPECTION_SCANNER) -v \
--namespace Cogl --nsversion=@CLUTTER_API_VERSION@ \ --namespace Cogl --nsversion=@CLUTTER_API_VERSION@ \
$(INCLUDES) \ $(INCLUDES) \

View File

@ -1025,6 +1025,8 @@ AC_CONFIG_FILES([
clutter/osx/Makefile clutter/osx/Makefile
clutter/win32/Makefile clutter/win32/Makefile
clutter/win32/clutter-win32.pc clutter/win32/clutter-win32.pc
clutter/cally/Makefile
clutter/cally/cally.pc
clutter/cogl/Makefile clutter/cogl/Makefile
clutter/cogl/cogl/Makefile clutter/cogl/cogl/Makefile
clutter/cogl/cogl/cogl-defines.h clutter/cogl/cogl/cogl-defines.h
@ -1036,6 +1038,7 @@ AC_CONFIG_FILES([
clutter/cogl/pango/Makefile clutter/cogl/pango/Makefile
clutter/json/Makefile clutter/json/Makefile
tests/Makefile tests/Makefile
tests/accessibility/Makefile
tests/conform/Makefile tests/conform/Makefile
tests/conform/test-launcher.sh tests/conform/test-launcher.sh
tests/data/Makefile tests/data/Makefile
@ -1049,6 +1052,8 @@ AC_CONFIG_FILES([
doc/reference/clutter/clutter-docs.xml doc/reference/clutter/clutter-docs.xml
doc/reference/cogl/Makefile doc/reference/cogl/Makefile
doc/reference/cogl/cogl-docs.xml doc/reference/cogl/cogl-docs.xml
doc/reference/cally/Makefile
doc/reference/cally/cally-docs.xml
doc/common/Makefile doc/common/Makefile
doc/manual/Makefile doc/manual/Makefile
doc/manual/clutter-manual.xml doc/manual/clutter-manual.xml

View File

@ -1 +1 @@
SUBDIRS = cogl clutter SUBDIRS = cogl clutter cally

View File

@ -0,0 +1,89 @@
## Process this file with automake to produce Makefile.in
# We require automake 1.6 at least.
AUTOMAKE_OPTIONS = 1.6
# This is a blank Makefile.am for using gtk-doc.
# Copy this to your project's API docs directory and modify the variables to
# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples
# of using the various options.
# The name of the module, e.g. 'glib'.
DOC_MODULE=cally
# The top-level SGML file. You can change this if you want to.
DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml
# The directory containing the source code. Relative to $(srcdir).
# gtk-doc will search all .c & .h files beneath here for inline comments
# documenting the functions and macros.
# e.g. DOC_SOURCE_DIR=../../../gtk
DOC_SOURCE_DIR=../../../clutter/cally
# Extra options to pass to gtkdoc-scangobj. Not normally needed.
SCANGOBJ_OPTIONS=--type-init-func="clutter_base_init()"
# Extra options to supply to gtkdoc-scan.
# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED"
SCAN_OPTIONS=--deprecated-guards="CALLY_DISABLE_DEPRECATED"
# Extra options to supply to gtkdoc-mkdb.
# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml
MKDB_OPTIONS=--sgml-mode --output-format=xml --name-space=cally
# Extra options to supply to gtkdoc-mktmpl
# e.g. MKTMPL_OPTIONS=--only-section-tmpl
MKTMPL_OPTIONS=
# Extra options to supply to gtkdoc-fixref. Not normally needed.
# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html
FIXXREF_OPTIONS=\
--extra-dir=../cogl/html \
--extra-dir=../clutter/html \
--extra-dir=$(GLIB_PREFIX)/share/gtk-doc/html/glib \
--extra-dir=$(GLIB_PREFIX)/share/gtk-doc/html/gobject \
--extra-dir=$(CAIRO_PREFIX)/share/gtk-doc/html/cairo \
--extra-dir=$(PANGO_PREFIX)/share/gtk-doc/html/pango
# Used for dependencies. The docs will be rebuilt if any of these change.
# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h
# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c
HFILE_GLOB=$(top_srcdir)/clutter/cally/*.h $(top_builddir)/clutter/cally/*.h
CFILE_GLOB=$(top_srcdir)/clutter/cally/*.c $(top_builddir)/clutter/cally/*.c
# Header files to ignore when scanning.
# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h
IGNORE_HFILES=cally-actor-private.h cally.h
EXTRA_HFILES=
# Images to copy into HTML directory.
# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
HTML_IMAGES=
# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
# e.g. content_files=running.sgml building.sgml changes-2.0.sgml
content_files= \
cally-overview.xml
# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded
# These files must be listed here *and* in content_files
# e.g. expand_content_files=running.sgml
expand_content_files= \
cally-overview.xml
# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library.
# Only needed if you are using gtkdoc-scangobj to dynamically query widget
# signals and properties.
# e.g. INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
INCLUDES=-I$(top_srcdir) -I$(top_srcdir)/clutter -I$(top_srcdir)/clutter/cogl -I$(top_builddir) -I$(top_builddir)/clutter -I$(top_builddir)/clutter/cogl $(CLUTTER_CFLAGS)
GTKDOC_LIBS=$(top_builddir)/clutter/libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la $(CLUTTER_LIBS)
# This includes the standard gtk-doc make rules, copied by gtkdocize.
include $(top_srcdir)/gtk-doc.make
# Other files to distribute
# e.g. EXTRA_DIST += version.xml.in
#EXTRA_DIST +=

View File

@ -0,0 +1,135 @@
<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
<!ENTITY version "@VERSION@">
]>
<book id="index" xmlns:xi="http://www.w3.org/2003/XInclude">
<bookinfo>
<title>Cally Reference Manual</title>
<releaseinfo>for Clutter &version;</releaseinfo>
<copyright>
<year>2008</year>
<year>2009</year>
<year>2010</year>
<holder>Igalia S.L.</holder>
</copyright>
<legalnotice>
<para>
Permission is granted to copy, distribute and/or modify this
document under the terms of the <citetitle>GNU Free
Documentation License</citetitle>, Version 1.1 or any later
version published by the Free Software Foundation with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover
Texts. You may obtain a copy of the <citetitle>GNU Free
Documentation License</citetitle> from the Free Software
Foundation by visiting <ulink type="http"
url="http://www.fsf.org">their Web site</ulink> or by writing
to:
<address>
The Free Software Foundation, Inc.,
<street>59 Temple Place</street> - Suite 330,
<city>Boston</city>, <state>MA</state> <postcode>02111-1307</postcode>,
<country>USA</country>
</address>
</para>
</legalnotice>
</bookinfo>
<xi:include href="xml/cally-overview.xml"/>
<part id="callybase">
<title>Cally Reference</title>
<chapter>
<title>Base Classes</title>
<xi:include href="xml/cally-actor.xml"/>
<xi:include href="xml/cally-group.xml"/>
<xi:include href="xml/cally-stage.xml"/>
<xi:include href="xml/cally-texture.xml"/>
<xi:include href="xml/cally-rectangle.xml"/>
<xi:include href="xml/cally-text.xml"/>
<xi:include href="xml/cally-clone.xml"/>
</chapter>
<chapter>
<title>Utility API</title>
<xi:include href="xml/cally.xml"/>
<xi:include href="xml/cally-util.xml"/>
<xi:include href="xml/cally-root.xml"/>
</chapter>
</part>
<part id="callyobjects">
<title>Cally Actors and Objects</title>
<chapter id="callyobjecthierarchy">
<title>Object Hierarchy</title>
<xi:include href="xml/tree_index.sgml"><xi:fallback /></xi:include>
</chapter>
<chapter id="callyobjectindex">
<title>Object Index</title>
<xi:include href="xml/object_index.sgml"><xi:fallback /></xi:include>
</chapter>
</part>
<index>
<title>Index of all symbols</title>
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
</index>
<index role="deprecated">
<title>Index of deprecated symbols</title>
<xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
</index>
<index role="1.4">
<title>Index of new symbols in 1.4</title>
<xi:include href="xml/api-index-1.4.xml"><xi:fallback /></xi:include>
</index>
<appendix id="license">
<title>License</title>
<para>
This library is free software; you can redistribute it and/or
modify it under the terms of the <citetitle>GNU Library General
Public License</citetitle> as published by the Free Software
Foundation; either version 2 of the License, or (at your option)
any later version.
</para>
<para>
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
<citetitle>GNU Library General Public License</citetitle> for
more details.
</para>
<para>
You may obtain a copy of the <citetitle>GNU Library General
Public License</citetitle> from the Free Software Foundation by
visiting <ulink type="http" url="http://www.fsf.org">their Web
site</ulink> or by writing to:
<address>
Free Software Foundation, Inc.
<street>59 Temple Place</street> - Suite 330
<city>Boston</city>, <state>MA</state> <postcode>02111-1307</postcode>
<country>USA</country>
</address>
</para>
</appendix>
</book>

View File

@ -0,0 +1,74 @@
<part id="clutter-overview">
<partinfo>
<author>
<firstname>Alejandro</firstname>
<surname>Piñeiro Iglesias</surname>
<affiliation>
<address>
<email>apinheiro@igalia.com</email>
</address>
</affiliation>
</author>
</partinfo>
<title>Overview</title>
<partintro>
<para>Cally (Clutter Accessibility Implementation Library) is the
Clutter implementation of the ATK interfaces. You can see as the
Clutter equivalent of GAIL, which provides accessibility support
for GTK+ and other GNOME related libraries.</para>
<para>This implementation expose Clutter actors to accessibility
tools like Orca. This allows not only writing accessible user
interfaces, but also allows testing and verification frameworks
based on accessibility technologies to inspect and test a Clutter
scene graph.</para>
<para>This reference manual defines the different APIs defined in
Cally. Anyway take into account that the most common use of case
Cally is transparent to the user, as the different accessibility
tools are intended to use the abstract ATK interfaces, and *not
directly* Cally, so this tools can communicate with applications
using different toolkits, like GTK+, Java, Clutter, etc. </para>
<para>The purpose of this reference is allow to extend Cally
functionality in any Clutter-based widget toolkit. Clutter is more
low-level that other toolkits like GTK+, and some toolkits have
started to appear based on Clutter: MX, Shell Toolkit, Candies,
Glitter, etc. This means that it is really likely that these
libraries will require extra accessibility support.</para>
<para>GAIL used a different approach, being a almost-pure-opaque
implementation of the ATK interfaces. So you can't extend it
directly. You need to use GObject and ATK mechanisms, like
run-time anonymous inheritance, to extend it. Although valid to
some custom cases, it showed to be really problematic and hacky in
wider approaches, like HAIL(Hildon Accessibility Implementation
Library). As explained, Clutter is more likely to be extended, so
these issues would arise sooner.</para>
<para>Part of the accessibility support is implemented on Clutter,
like the initialization code, and the method to obtain the
accessibility object for each Clutter object. In the same way, to
make it easier, and to allow access to Clutter object private
data, it would be really likely that the accessibility support
would be implemented directly on some Clutter objects</para>
<para>Check the next clutter methods for more information:</para>
<variablelist>
<varlistentry>
<term>clutter_actor_get_accessible()</term>
<listitem>Virtual method to obtain the accessibility object of a
clutter actor</listitem>
</varlistentry>
<varlistentry>
<term>clutter_get_accessibility_enabled()</term>
<listitem>Method to check if accessibility is enabled.</listitem>
</varlistentry>
</variablelist>
</partintro>
</part>

View File

@ -0,0 +1,174 @@
<SECTION>
<FILE>cally-clone</FILE>
<TITLE>CallyClone</TITLE>
CallyClone
CallyCloneClass
cally_clone_new
<SUBSECTION Standard>
CALLY_CLONE
CALLY_IS_CLONE
CALLY_TYPE_CLONE
CALLY_CLONE_CLASS
CALLY_IS_CLONE_CLASS
CALLY_CLONE_GET_CLASS
<SUBSECTION Private>
CallyClonePrivate
cally_clone_get_type
</SECTION>
<SECTION>
<FILE>cally-actor</FILE>
<TITLE>CallyActor</TITLE>
CallyActor
CallyActorClass
CallyActionFunc
cally_actor_new
cally_actor_add_action
cally_actor_remove_action
cally_actor_remove_action_by_name
<SUBSECTION Standard>
CALLY_ACTOR
CALLY_IS_ACTOR
CALLY_TYPE_ACTOR
CALLY_ACTOR_CLASS
CALLY_IS_ACTOR_CLASS
CALLY_ACTOR_GET_CLASS
<SUBSECTION Private>
CallyActorPrivate
cally_actor_get_type
</SECTION>
<SECTION>
<FILE>cally-text</FILE>
<TITLE>CallyText</TITLE>
CallyText
CallyTextClass
cally_text_new
<SUBSECTION Standard>
CALLY_TEXT
CALLY_IS_TEXT
CALLY_TYPE_TEXT
CALLY_TEXT_CLASS
CALLY_IS_TEXT_CLASS
CALLY_TEXT_GET_CLASS
<SUBSECTION Private>
CallyTextPrivate
cally_text_get_type
</SECTION>
<SECTION>
<FILE>cally-util</FILE>
<TITLE>CallyUtil</TITLE>
CallyUtil
CallyUtilClass
<SUBSECTION Standard>
CALLY_UTIL
CALLY_IS_UTIL
CALLY_TYPE_UTIL
CALLY_UTIL_CLASS
CALLY_IS_UTIL_CLASS
CALLY_UTIL_GET_CLASS
<SUBSECTION Private>
CallyUtilPrivate
cally_util_get_type
</SECTION>
<SECTION>
<FILE>cally-texture</FILE>
<TITLE>CallyTexture</TITLE>
CallyTexture
CallyTextureClass
cally_texture_new
<SUBSECTION Standard>
CALLY_TEXTURE
CALLY_IS_TEXTURE
CALLY_TYPE_TEXTURE
CALLY_TEXTURE_CLASS
CALLY_IS_TEXTURE_CLASS
CALLY_TEXTURE_GET_CLASS
<SUBSECTION Private>
CallyTexturePrivate
cally_texture_get_type
</SECTION>
<SECTION>
<FILE>cally-root</FILE>
<TITLE>CallyRoot</TITLE>
CallyRoot
CallyRootClass
cally_root_new
<SUBSECTION Standard>
CALLY_ROOT
CALLY_IS_ROOT
CALLY_TYPE_ROOT
CALLY_ROOT_CLASS
CALLY_IS_ROOT_CLASS
CALLY_ROOT_GET_CLASS
<SUBSECTION Private>
CallyRootPrivate
cally_root_get_type
</SECTION>
<SECTION>
<FILE>cally-group</FILE>
<TITLE>CallyGroup</TITLE>
CallyGroup
CallyGroupClass
cally_group_new
<SUBSECTION Standard>
CALLY_GROUP
CALLY_IS_GROUP
CALLY_TYPE_GROUP
CALLY_GROUP_CLASS
CALLY_IS_GROUP_CLASS
CALLY_GROUP_GET_CLASS
<SUBSECTION Private>
CallyGroupPrivate
cally_group_get_type
</SECTION>
<SECTION>
<FILE>cally-stage</FILE>
<TITLE>CallyStage</TITLE>
CallyStage
CallyStageClass
cally_stage_new
<SUBSECTION Standard>
CALLY_STAGE
CALLY_IS_STAGE
CALLY_TYPE_STAGE
CALLY_STAGE_CLASS
CALLY_IS_STAGE_CLASS
CALLY_STAGE_GET_CLASS
<SUBSECTION Private>
CallyStagePrivate
cally_stage_get_type
</SECTION>
<SECTION>
<FILE>cally-rectangle</FILE>
<TITLE>CallyRectangle</TITLE>
CallyRectangle
CallyRectangleClass
cally_rectangle_new
<SUBSECTION Standard>
CALLY_RECTANGLE
CALLY_IS_RECTANGLE
CALLY_TYPE_RECTANGLE
CALLY_RECTANGLE_CLASS
CALLY_IS_RECTANGLE_CLASS
CALLY_RECTANGLE_GET_CLASS
<SUBSECTION Private>
CallyRectanglePrivate
cally_rectangle_get_type
</SECTION>
<SECTION>
<FILE>cally</FILE>
<TITLE>General API</TITLE>
cally_get_cally_initialized
cally_accessibility_init
<SUBSECTION>
CALLY_ACCESSIBLE_FACTORY
CALLY_ACTOR_SET_FACTORY
</SECTION>

View File

@ -0,0 +1,9 @@
cally_actor_get_type
cally_clone_get_type
cally_group_get_type
cally_rectangle_get_type
cally_root_get_type
cally_stage_get_type
cally_text_get_type
cally_texture_get_type
cally_util_get_type

View File

@ -81,13 +81,14 @@ IGNORE_HFILES=\
clutter-script-private.h \ clutter-script-private.h \
clutter-stage-window.h \ clutter-stage-window.h \
clutter-timeout-interval.h \ clutter-timeout-interval.h \
cally \
cogl \ cogl \
egl \ egl \
fruity \ fruity \
glx \ glx \
json \
osx \ osx \
x11 \ x11 \
json \
win32 win32
EXTRA_HFILES=\ EXTRA_HFILES=\

View File

@ -137,6 +137,10 @@
<listitem><para>Unsets FLAGS from the COGL debugging <listitem><para>Unsets FLAGS from the COGL debugging
flags.</para></listitem> flags.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>--clutter-enable-accessibility</term>
<listitem><para>Enables accessibility support.</para></listitem>
</varlistentry>
</variablelist> </variablelist>
<para>The X11 backends also have the following command line <para>The X11 backends also have the following command line

View File

@ -1,4 +1,4 @@
SUBDIRS = data interactive micro-bench tools SUBDIRS = accessibility data interactive micro-bench tools
if BUILD_TESTS if BUILD_TESTS
SUBDIRS += conform SUBDIRS += conform

View File

@ -20,6 +20,9 @@ covers most of the original Clutter tests. Ideally some of these tests will be
migrated into the conformance/ directory so they can be used in automated migrated into the conformance/ directory so they can be used in automated
nightly tests. nightly tests.
The accessibility/ tests are tests created to test the accessibility support of
clutter, testing some of the atk interfaces.
The data/ directory contains optional data (like images and ClutterScript The data/ directory contains optional data (like images and ClutterScript
definitions) that can be referenced by a test. definitions) that can be referenced by a test.

5
tests/accessibility/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
/cally-atkcomponent-example
/cally-atkeditabletext-example
/cally-atkevents-example
/cally-atktext-example
/cally-clone-example

View File

@ -0,0 +1,61 @@
include $(top_srcdir)/build/autotools/Makefile.am.silent
EXAMPLES = cally-atkcomponent-example \
cally-atkeditabletext-example \
cally-atkevents-example \
cally-atktext-example \
cally-clone-example
common_ldadd = $(top_builddir)/clutter/libclutter-@CLUTTER_WINSYS@-@CLUTTER_API_VERSION@.la
CALLY_UTIL_SOURCES = cally-examples-util.c
INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/clutter \
-I$(top_srcdir)/clutter/cogl \
-I$(top_builddir)/clutter \
-I$(top_builddir)/clutter/cogl \
-I$(top_srcdir)/tests/accessibility
noinst_PROGRAMS = $(EXAMPLES)
# atk component example
cally_atkcomponent_example_LDADD = $(CLUTTER_LIBS) $(common_ldadd)
cally_atkcomponent_example_CFLAGS = $(CLUTTER_CFLAGS) $(MAINTAINER_CFLAGS) \
-DPREFIXDIR=\"$(libdir)\" \
$(INCLUDES)
cally_atkcomponent_example_SOURCES = cally-atkcomponent-example.c \
$(CALLY_UTIL_SOURCES)
# atk text example
cally_atktext_example_LDADD = $(CLUTTER_LIBS) $(common_ldadd)
cally_atktext_example_CFLAGS = $(CLUTTER_CFLAGS) $(MAINTAINER_CFLAGS)\
-DPREFIXDIR=\"$(libdir)\" \
$(INCLUDES)
cally_atktext_example_SOURCES = cally-atktext-example.c \
$(CALLY_UTIL_SOURCES)
# atk text example2
cally_atkevents_example_LDADD = $(CLUTTER_LIBS) $(common_ldadd)
cally_atkevents_example_CFLAGS = $(CLUTTER_CFLAGS) $(MAINTAINER_CFLAGS)\
-DPREFIXDIR=\"$(libdir)\" \
$(INCLUDES)
cally_atkevents_example_SOURCES = cally-atkevents-example.c \
$(CALLY_UTIL_SOURCES)
# atk editable text example
cally_atkeditabletext_example_LDADD = $(CLUTTER_LIBS) $(common_ldadd)
cally_atkeditabletext_example_CFLAGS = $(CLUTTER_CFLAGS) $(MAINTAINER_CFLAGS) \
-DPREFIXDIR=\"$(libdir)\" \
$(INCLUDES)
cally_atkeditabletext_example_SOURCES = cally-atkeditabletext-example.c \
$(CALLY_UTIL_SOURCES)
# cally clone example
cally_clone_example_LDADD = $(CLUTTER_LIBS) $(common_ldadd)
cally_clone_example_CFLAGS = $(CLUTTER_CFLAGS) $(MAINTAINER_CFLAGS) \
-DPREFIXDIR=\"$(libdir)\" \
$(INCLUDES)
cally_clone_example_SOURCES = cally-clone-example.c \
$(CALLY_UTIL_SOURCES)

View File

@ -0,0 +1,102 @@
/* 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.
*/
#include <clutter/clutter.h>
#include "cally-examples-util.h"
#define WIDTH 300
#define HEIGHT 300
#define SIZE 50
#define DEPTH -100
static const ClutterColor color1 = { 0xff, 0xff, 0x00, 0xff };
static const ClutterColor color2 = { 0x00, 0xff, 0x00, 0xff };
static const ClutterColor color3 = { 0x00, 0x00, 0xff, 0xff };
static const ClutterColor color4 = { 0xff, 0x00, 0xff, 0xff };
int
main (int argc, char *argv[])
{
ClutterActor *stage = NULL;
ClutterColor color = { 0x00, 0x00, 0x00, 0xff };
ClutterActor *button1 = NULL;
ClutterActor *button2 = NULL;
ClutterActor *button3 = NULL;
ClutterActor *button4 = NULL;
ClutterActor *group[4];
ClutterGeometry geom = {0, 0, SIZE, SIZE};
gint i = 0;
clutter_init (&argc, &argv);
cally_util_a11y_init (&argc, &argv);
stage = clutter_stage_get_default ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &color);
clutter_actor_set_size (stage, WIDTH, HEIGHT);
button1 = clutter_rectangle_new_with_color (&color1);
clutter_actor_set_geometry (button1, &geom);
button2 = clutter_rectangle_new_with_color (&color2);
geom.x = 2*SIZE;
geom.y = 0;
clutter_actor_set_geometry (button2, &geom);
geom.x = 0;
geom.y = 2*SIZE;
button3 = clutter_rectangle_new_with_color (&color3);
clutter_actor_set_geometry (button3, &geom);
clutter_actor_set_depth( button3, DEPTH);
/* a nested hierarchy, to check that the relative positions are
computed properly */
geom.x = SIZE/2;
geom.y = SIZE/2;
button4 = clutter_rectangle_new_with_color (&color4);
clutter_actor_set_geometry (button4, &geom);
clutter_actor_show (button4);
for (i = 0; i < 4; i++) {
group[i] = clutter_group_new ();
clutter_actor_set_geometry (group[i], &geom);
if (i > 0)
clutter_group_add (CLUTTER_GROUP (group[i]), group [i - 1]);
clutter_actor_show_all (group[i]);
}
clutter_group_add (CLUTTER_GROUP (stage), button1);
clutter_group_add (CLUTTER_GROUP (stage), button2);
clutter_group_add (CLUTTER_GROUP (stage), button3);
clutter_group_add (CLUTTER_GROUP (stage), group[3]);
clutter_group_add (CLUTTER_GROUP (group[0]), button4);
clutter_actor_show_all (stage);
clutter_main ();
return 0;
}

View File

@ -0,0 +1,270 @@
/* 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.
*/
#include <atk/atk.h>
#include <clutter/clutter.h>
#include "cally-examples-util.h"
#define WIDTH 800
#define HEIGHT 600
static ClutterActor *text_actor = NULL;
static ClutterActor *text_editable_actor = NULL;
/*
* Test AtkText interface
*/
static void
test_atk_text (ClutterActor *actor)
{
AtkObject *object = NULL;
AtkEditableText *cally_editable_text = NULL;
gint pos = 0;
object = atk_gobject_accessible_for_object (G_OBJECT (actor));
cally_editable_text = ATK_EDITABLE_TEXT (object);
if (cally_editable_text != NULL) {
atk_editable_text_set_text_contents (cally_editable_text, "New text");
atk_editable_text_delete_text (cally_editable_text, 0, 3);
pos = 3;
atk_editable_text_insert_text (cally_editable_text, "New", 0, &pos);
/* Not implemented in cally, just checking that we can call this
functions */
atk_editable_text_copy_text (cally_editable_text, 0, -1);
atk_editable_text_paste_text (cally_editable_text, 5);
atk_editable_text_cut_text (cally_editable_text, 0, -1);
}
}
static gboolean
insert_text_press_cb (ClutterActor *actor,
ClutterButtonEvent *event,
gpointer data)
{
AtkObject *object = NULL;
AtkEditableText *cally_editable_text = NULL;
gint pos = 0;
object = atk_gobject_accessible_for_object (G_OBJECT (text_editable_actor));
cally_editable_text = ATK_EDITABLE_TEXT (object);
pos = 3;
atk_editable_text_insert_text (cally_editable_text, "New", 0, &pos);
return TRUE;
}
static gboolean
delete_text_press_cb (ClutterActor *actor,
ClutterButtonEvent *event,
gpointer data)
{
AtkObject *object = NULL;
AtkEditableText *cally_editable_text = NULL;
object = atk_gobject_accessible_for_object (G_OBJECT (text_editable_actor));
cally_editable_text = ATK_EDITABLE_TEXT (object);
atk_editable_text_delete_text (cally_editable_text, 0, 3);
return TRUE;
}
static gboolean
set_text_press_cb (ClutterActor *actor,
ClutterButtonEvent *event,
gpointer data)
{
AtkObject *object = NULL;
AtkEditableText *cally_editable_text = NULL;
object = atk_gobject_accessible_for_object (G_OBJECT (text_editable_actor));
cally_editable_text = ATK_EDITABLE_TEXT (object);
atk_editable_text_set_text_contents (cally_editable_text, "New text");
return TRUE;
}
static gboolean
activate_deactivate_press_cb (ClutterActor *actor,
ClutterButtonEvent *event,
gpointer data)
{
gboolean active = FALSE;
active = clutter_text_get_activatable (CLUTTER_TEXT (text_editable_actor));
clutter_text_set_activatable (CLUTTER_TEXT (text_editable_actor), !active);
return TRUE;
}
static gboolean
print_cursor_position_press_cb (ClutterActor *actor,
ClutterButtonEvent *event,
gpointer data)
{
gint pos = 0;
pos = clutter_text_get_cursor_position (CLUTTER_TEXT (text_editable_actor));
g_print ("current cursor position %i\n", pos);
return TRUE;
}
static void
activate_cb (ClutterActor *actor,
gpointer data)
{
g_print ("Actor activated\n");
}
static ClutterActor*
_create_button (const gchar *text)
{
ClutterActor *button = NULL;
ClutterActor *rectangle = NULL;
ClutterActor *label = NULL;
ClutterColor color_rect = { 0x00, 0xff, 0xff, 0xff };
ClutterColor color_label = { 0x00, 0x00, 0x00, 0xff };
button = clutter_group_new ();
rectangle = clutter_rectangle_new_with_color (&color_rect);
clutter_actor_set_size (rectangle, 375, 35);
label = clutter_text_new_full ("Sans Bold 32px",
text, &color_label);
clutter_group_add (CLUTTER_GROUP (button), rectangle);
clutter_group_add (CLUTTER_GROUP (button), label);
clutter_actor_set_reactive (button, TRUE);
return button;
}
static void
make_ui (ClutterActor *stage)
{
ClutterColor color_stage = { 0x00, 0x00, 0x00, 0xff };
ClutterColor color_text = { 0xff, 0x00, 0x00, 0xff };
ClutterColor color_sel = { 0x00, 0xff, 0x00, 0x55 };
ClutterActor *button = NULL;
clutter_stage_set_color (CLUTTER_STAGE (stage), &color_stage);
clutter_actor_set_size (stage, WIDTH, HEIGHT);
/* text */
text_actor = clutter_text_new_full ("Sans Bold 32px",
"Lorem ipsum dolor sit amet",
&color_text);
clutter_group_add (CLUTTER_GROUP (stage), text_actor);
/* text_editable */
text_editable_actor = clutter_text_new_full ("Sans Bold 32px",
"consectetur adipisicing elit",
&color_text);
clutter_actor_set_position (text_editable_actor, 0, 100);
clutter_text_set_editable (CLUTTER_TEXT (text_editable_actor), TRUE);
clutter_text_set_selectable (CLUTTER_TEXT (text_editable_actor), TRUE);
clutter_text_set_selection_color (CLUTTER_TEXT (text_editable_actor),
&color_sel);
clutter_text_set_activatable (CLUTTER_TEXT (text_editable_actor),
TRUE);
clutter_text_set_line_wrap (CLUTTER_TEXT (text_editable_actor), TRUE);
clutter_actor_grab_key_focus (text_editable_actor);
clutter_actor_set_reactive (text_editable_actor, TRUE);
clutter_group_add (CLUTTER_GROUP (stage), text_editable_actor);
g_signal_connect (text_editable_actor, "activate",
G_CALLBACK (activate_cb), NULL);
/* test buttons */
button = _create_button ("Set");
clutter_actor_set_position (button, 100, 200);
g_signal_connect_after (button, "button-press-event",
G_CALLBACK (set_text_press_cb), NULL);
clutter_group_add (CLUTTER_GROUP (stage), button);
button = _create_button ("Delete");
clutter_actor_set_position (button, 100, 250);
g_signal_connect_after (button, "button-press-event",
G_CALLBACK (delete_text_press_cb), NULL);
clutter_group_add (CLUTTER_GROUP (stage), button);
button = _create_button ("Insert");
clutter_actor_set_position (button, 100, 300);
g_signal_connect_after (button, "button-press-event",
G_CALLBACK (insert_text_press_cb), NULL);
clutter_group_add (CLUTTER_GROUP (stage), button);
button = _create_button ("Activate/Deactivate");
clutter_actor_set_position (button, 100, 350);
g_signal_connect_after (button, "button-press-event",
G_CALLBACK (activate_deactivate_press_cb), NULL);
clutter_group_add (CLUTTER_GROUP (stage), button);
button = _create_button ("Cursor position");
clutter_actor_set_position (button, 100, 450);
g_signal_connect_after (button, "button-press-event",
G_CALLBACK (print_cursor_position_press_cb), NULL);
clutter_group_add (CLUTTER_GROUP (stage), button);
}
int
main (int argc, char *argv[])
{
ClutterActor *stage = NULL;
g_set_application_name ("AtkEditableText");
clutter_init (&argc, &argv);
cally_util_a11y_init (&argc, &argv);
stage = clutter_stage_get_default ();
make_ui (stage);
clutter_actor_show_all (stage);
test_atk_text (text_actor);
test_atk_text (text_editable_actor);
clutter_main ();
return 0;
}

View File

@ -0,0 +1,180 @@
/* 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.
*/
/*
* The purpose of this example is test key event and global event
* implementation, specifically:
*
* atk_add_global_event_listener
* atk_remove_global_event_listener
* atk_add_key_event_listener
* atk_remove_key_event_listener
*/
#include <atk/atk.h>
#include <clutter/clutter.h>
#include "cally-examples-util.h"
#define WIDTH 800
#define HEIGHT 600
#define HEIGHT_STEP 100
#define NUM_ENTRIES 3
struct _Data{
gint value;
};
typedef struct _Data Data;
static gboolean
atk_key_listener (AtkKeyEventStruct *event, gpointer data)
{
Data *my_data = (Data*) data;
g_print ("atk_listener: 0x%x ", event->keyval);
if (my_data != NULL) {
g_print ("\t Data value: %i\n", my_data->value);
} else {
g_print ("\tNo data!!\n");
}
return FALSE;
}
static gboolean
window_event_listener (GSignalInvocationHint * signal_hint,
guint n_param_values,
const GValue * param_values, gpointer data)
{
AtkObject *accessible;
GSignalQuery signal_query;
const gchar *name, *s;
g_signal_query (signal_hint->signal_id, &signal_query);
name = signal_query.signal_name;
accessible = ATK_OBJECT (g_value_get_object (&param_values[0]));
s = atk_object_get_name (accessible);
g_print ("Detected window event \"%s\" from object \"%p\" named \"%s\"\n",
name, accessible, s);
return TRUE;
}
static void
make_ui (ClutterActor *stage)
{
gint i = 0;
ClutterActor *editable = NULL;
ClutterActor *rectangle = NULL;
ClutterActor *label = NULL;
ClutterColor color_stage = { 0x00, 0x00, 0x00, 0xff };
ClutterColor color_text = { 0xff, 0x00, 0x00, 0xff };
ClutterColor color_sel = { 0x00, 0xff, 0x00, 0x55 };
ClutterColor color_label = { 0x00, 0xff, 0x55, 0xff };
ClutterColor color_rect = { 0x00, 0xff, 0xff, 0x55 };
ClutterGeometry label_geom = {0, 50, -1, -1};
ClutterGeometry editable_geom = {150, 50, 500, 75};
clutter_stage_set_color (CLUTTER_STAGE (stage), &color_stage);
clutter_actor_set_size (stage, WIDTH, HEIGHT);
for (i = 0; i < NUM_ENTRIES; i++)
{
/* label */
label = clutter_text_new_full ("Sans Bold 32px",
"Entry",
&color_label);
clutter_actor_set_geometry (label, &label_geom);
/* editable */
editable = clutter_text_new_full ("Sans Bold 32px",
"ddd",
&color_text);
clutter_actor_set_geometry (editable, &editable_geom);
clutter_text_set_editable (CLUTTER_TEXT (editable), TRUE);
clutter_text_set_selectable (CLUTTER_TEXT (editable), TRUE);
clutter_text_set_selection_color (CLUTTER_TEXT (editable),
&color_sel);
clutter_actor_grab_key_focus (editable);
clutter_actor_set_reactive (editable, TRUE);
/* rectangle: to create a entry "feeling" */
rectangle = clutter_rectangle_new_with_color (&color_rect);
clutter_actor_set_geometry (rectangle, &editable_geom);
clutter_group_add (CLUTTER_GROUP (stage), label);
clutter_group_add (CLUTTER_GROUP (stage), editable);
clutter_group_add (CLUTTER_GROUP (stage), rectangle);
label_geom.y += HEIGHT_STEP;
editable_geom.y += HEIGHT_STEP;
}
}
int
main (int argc, char *argv[])
{
ClutterActor *stage = NULL;
Data data1, data2,data3;
guint id_2 = 0;
g_set_application_name ("AtkText");
clutter_init (&argc, &argv);
cally_util_a11y_init (&argc, &argv);
data1.value = 10;
data2.value = 20;
data3.value = 30;
/* key event listeners */
atk_add_key_event_listener ((AtkKeySnoopFunc)atk_key_listener, &data1);
id_2 = atk_add_key_event_listener ((AtkKeySnoopFunc)atk_key_listener, &data2);
atk_add_key_event_listener ((AtkKeySnoopFunc)atk_key_listener, &data3);
atk_remove_key_event_listener (id_2);
/* event listeners */
atk_add_global_event_listener (window_event_listener, "window:create");
atk_add_global_event_listener (window_event_listener, "window:destroy");
atk_add_global_event_listener (window_event_listener, "window:activate");
atk_add_global_event_listener (window_event_listener, "window:deactivate");
stage = clutter_stage_get_default ();
make_ui (stage);
clutter_actor_show_all (stage);
if (clutter_feature_available (CLUTTER_FEATURE_STAGE_MULTIPLE))
{
stage = clutter_stage_new ();
make_ui (stage);
clutter_actor_show_all (stage);
}
clutter_main ();
return 0;
}

View File

@ -0,0 +1,212 @@
/* 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.
*/
#include <atk/atk.h>
#include <clutter/clutter.h>
#include "cally-examples-util.h"
#define WIDTH 800
#define HEIGHT 600
static ClutterActor *text_actor = NULL;
static ClutterActor *text_editable_actor = NULL;
/*
* Test AtkText interface
*/
static void
test_atk_text (ClutterActor *actor)
{
gchar *text = NULL;
AtkObject *object = NULL;
AtkText *cally_text = NULL;
gboolean bool = FALSE;
gunichar unichar;
gchar buf[7];
gint count = -1;
gint start = -1;
gint end = -1;
gint pos = -1;
AtkAttributeSet *at_set = NULL;
object = atk_gobject_accessible_for_object (G_OBJECT (actor));
cally_text = ATK_TEXT (object);
if (cally_text != NULL) {
text = atk_text_get_text (cally_text, 0, -1);
g_print ("atk_text_get_text output: %s\n", text);
g_free (text); text = NULL;
unichar = atk_text_get_character_at_offset (cally_text, 5);
g_unichar_to_utf8 (unichar, buf);
g_print ("atk_text_get_character_at_offset: %s\n", buf);
text = atk_text_get_text_before_offset (cally_text,
5, ATK_TEXT_BOUNDARY_WORD_END,
&start, &end);
g_print ("atk_text_get_text_before_offset: %s, %i, %i\n",
text, start, end);
g_free (text); text = NULL;
text = atk_text_get_text_at_offset (cally_text,
5, ATK_TEXT_BOUNDARY_WORD_END,
&start, &end);
g_print ("atk_text_get_text_at_offset: %s, %i, %i\n",
text, start, end);
g_free (text); text = NULL;
text = atk_text_get_text_after_offset (cally_text,
5, ATK_TEXT_BOUNDARY_WORD_END,
&start, &end);
g_print ("atk_text_get_text_after_offset: %s, %i, %i\n",
text, start, end);
g_free (text); text = NULL;
pos = atk_text_get_caret_offset (cally_text);
g_print ("atk_text_get_caret_offset: %i\n", pos);
atk_text_set_caret_offset (cally_text, 5);
count = atk_text_get_character_count (cally_text);
g_print ("atk_text_get_character_count: %i\n", count);
count = atk_text_get_n_selections (cally_text);
g_print ("atk_text_get_n_selections: %i\n", count);
text = atk_text_get_selection (cally_text, 0, &start, &end);
g_print ("atk_text_get_selection: %s, %i, %i\n", text, start, end);
g_free(text); text = NULL;
bool = atk_text_remove_selection (cally_text, 0);
g_print ("atk_text_remove_selection (0): %i\n", bool);
bool = atk_text_remove_selection (cally_text, 1);
g_print ("atk_text_remove_selection (1): %i\n", bool);
bool = atk_text_add_selection (cally_text, 5, 10);
g_print ("atk_text_add_selection: %i\n", bool);
bool = atk_text_set_selection (cally_text, 0, 6, 10);
g_print ("atk_text_set_selection: %i\n", bool);
at_set = atk_text_get_run_attributes (cally_text, 10,
&start, &end);
g_print ("atk_text_get_run_attributes: %i, %i\n", start, end);
at_set = atk_text_get_default_attributes (cally_text);
g_print ("atk_text_get_default_attributes: (at_set==NULL) == %i \n",
at_set == NULL);
}
}
static gboolean
button_press_cb (ClutterActor *actor,
ClutterButtonEvent *event,
gpointer data)
{
test_atk_text (text_actor);
test_atk_text (text_editable_actor);
return TRUE;
}
static void
make_ui (ClutterActor *stage)
{
ClutterColor color_stage = { 0x00, 0x00, 0x00, 0xff };
ClutterColor color_text = { 0xff, 0x00, 0x00, 0xff };
ClutterColor color_sel = { 0x00, 0xff, 0x00, 0x55 };
ClutterColor color_rect = { 0x00, 0xff, 0xff, 0xff };
ClutterColor color_label = { 0x00, 0x00, 0x00, 0xff };
ClutterActor *button = NULL;
ClutterActor *rectangle = NULL;
ClutterActor *label = NULL;
clutter_stage_set_color (CLUTTER_STAGE (stage), &color_stage);
clutter_actor_set_size (stage, WIDTH, HEIGHT);
/* text */
text_actor = clutter_text_new_full ("Sans Bold 32px",
"Lorem ipsum dolor sit amet",
&color_text);
clutter_group_add (CLUTTER_GROUP (stage), text_actor);
/* text_editable */
text_editable_actor = clutter_text_new_full ("Sans Bold 32px",
"consectetur adipisicing elit",
&color_text);
clutter_actor_set_position (text_editable_actor, 0, 100);
clutter_text_set_editable (CLUTTER_TEXT (text_editable_actor), TRUE);
clutter_text_set_selectable (CLUTTER_TEXT (text_editable_actor), TRUE);
clutter_text_set_selection_color (CLUTTER_TEXT (text_editable_actor),
&color_sel);
clutter_text_set_line_wrap (CLUTTER_TEXT (text_editable_actor), TRUE);
clutter_actor_grab_key_focus (text_editable_actor);
clutter_actor_set_reactive (text_editable_actor, TRUE);
clutter_group_add (CLUTTER_GROUP (stage), text_editable_actor);
/* test button */
button = clutter_group_new ();
rectangle = clutter_rectangle_new_with_color (&color_rect);
clutter_actor_set_size (rectangle, 75, 35);
label = clutter_text_new_full ("Sans Bold 32px",
"Test", &color_label);
clutter_actor_set_position (button, 100, 200);
clutter_group_add (CLUTTER_GROUP (button), rectangle);
clutter_group_add (CLUTTER_GROUP (button), label);
clutter_actor_set_reactive (button, TRUE);
g_signal_connect_after (button, "button-press-event",
G_CALLBACK (button_press_cb), NULL);
clutter_group_add (CLUTTER_GROUP (stage), button);
}
int
main (int argc, char *argv[])
{
ClutterActor *stage = NULL;
g_set_application_name ("AtkText");
clutter_init (&argc, &argv);
cally_util_a11y_init (&argc, &argv);
stage = clutter_stage_get_default ();
make_ui (stage);
clutter_actor_show_all (stage);
test_atk_text (text_actor);
test_atk_text (text_editable_actor);
clutter_main ();
return 0;
}

View File

@ -0,0 +1,112 @@
/* 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.
*/
#include <atk/atk.h>
#include <clutter/clutter.h>
#include "cally-examples-util.h"
#define WIDTH 800
#define HEIGHT 600
#define HEIGHT_STEP 100
#define NUM_ENTRIES 3
static void
make_ui (ClutterActor *stage)
{
ClutterActor *editable = NULL;
ClutterActor *rectangle = NULL;
ClutterActor *label = NULL;
ClutterColor color_stage = { 0x00, 0x00, 0x00, 0xff };
ClutterColor color_text = { 0xff, 0x00, 0x00, 0xff };
ClutterColor color_sel = { 0x00, 0xff, 0x00, 0x55 };
ClutterColor color_label = { 0x00, 0xff, 0x55, 0xff };
ClutterColor color_rect = { 0x00, 0xff, 0xff, 0x55 };
ClutterGeometry editable_geom = {150, 50, 100, 75};
ClutterActor *full_entry = NULL;
ClutterActor *cloned_entry = NULL;
clutter_stage_set_color (CLUTTER_STAGE (stage), &color_stage);
clutter_actor_set_size (stage, WIDTH, HEIGHT);
label = clutter_text_new_full ("Sans Bold 32px",
"Entry",
&color_label);
clutter_actor_set_position (label, 0, 50);
/* editable */
editable = clutter_text_new_full ("Sans Bold 32px",
"ddd",
&color_text);
clutter_actor_set_position (editable, 150, 50);
clutter_text_set_editable (CLUTTER_TEXT (editable), TRUE);
clutter_text_set_selectable (CLUTTER_TEXT (editable), TRUE);
clutter_text_set_selection_color (CLUTTER_TEXT (editable),
&color_sel);
clutter_actor_grab_key_focus (editable);
clutter_actor_set_reactive (editable, TRUE);
/* rectangle: to create a entry "feeling" */
rectangle = clutter_rectangle_new_with_color (&color_rect);
clutter_actor_set_geometry (rectangle, &editable_geom);
full_entry = clutter_group_new ();
clutter_actor_set_position (full_entry, 0, 50);
clutter_actor_set_size (full_entry, 100, 75);
clutter_group_add (CLUTTER_GROUP (full_entry), label);
clutter_group_add (CLUTTER_GROUP (full_entry), editable);
clutter_group_add (CLUTTER_GROUP (full_entry), rectangle);
clutter_actor_show_all (full_entry);
clutter_actor_set_scale (full_entry, 2, 1);
clutter_group_add (CLUTTER_GROUP (stage), full_entry);
/* Cloning! */
cloned_entry = clutter_clone_new (full_entry);
clutter_actor_set_position (cloned_entry, 50, 200);
clutter_actor_set_scale (cloned_entry, 1, 2);
clutter_actor_show_all (cloned_entry);
clutter_actor_set_reactive (cloned_entry, TRUE);
clutter_group_add (CLUTTER_GROUP (stage), cloned_entry);
}
int
main (int argc, char *argv[])
{
ClutterActor *stage = NULL;
g_set_application_name ("Clone Example");
clutter_init (&argc, &argv);
cally_util_a11y_init (&argc, &argv);
stage = clutter_stage_get_default ();
make_ui (stage);
clutter_actor_show_all (stage);
clutter_main ();
return 0;
}

View File

@ -0,0 +1,142 @@
/* 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.
*/
#include <gmodule.h>
#include <stdlib.h>
#include <clutter/clutter.h>
#include "cally-examples-util.h"
/* Checking the at-spi sources, the module directory is
* $(libdir)/gtk-2.0/modules
*
* It is supposed cally would be installed on the same libdir.
*
* You could use the option atk-bridge-dir to use other directory.
*/
#define ATK_BRIDGE_DEFAULT_MODULE_DIRECTORY PREFIXDIR"/gtk-2.0/modules"
static gchar *
_search_for_bridge_module (const gchar *module_name)
{
/* We simplify the search for the atk bridge, see see the definition
* of the macro for more information*/
return g_strdup (ATK_BRIDGE_DEFAULT_MODULE_DIRECTORY);
}
static gchar*
_a11y_check_custom_bridge (int *argc,
char ***argv)
{
GError *error = NULL;
GOptionContext *context;
static gchar *bridge_dir = NULL;
static GOptionEntry entries [] =
{
{"atk-bridge-dir", 'd', 0, G_OPTION_ARG_STRING, &bridge_dir, "atk-bridge module directory", NULL}
};
context = g_option_context_new ("- cally examples");
g_option_context_add_main_entries (context, entries, NULL);
if (!g_option_context_parse (context, argc, argv, &error))
{
g_print ("%s\n", error->message);
g_print ("Use --help for more information.\n");
exit (0);
}
return bridge_dir;
}
static gboolean
_a11y_invoke_module (const gchar *module_path,
gboolean init)
{
GModule *handle;
void (*invoke_fn) (void);
const char *method;
if (init)
method = "gnome_accessibility_module_init";
else
method = "gnome_accessibility_module_shutdown";
if (!module_path)
return FALSE;
if (!(handle = g_module_open (module_path, G_MODULE_BIND_LAZY)))
{
g_warning ("Accessibility: failed to load module '%s': '%s'",
module_path, g_module_error ());
return FALSE;
}
if (!g_module_symbol (handle, method, (gpointer *)&invoke_fn))
{
g_warning ("Accessibility: error library '%s' does not include "
"method '%s' required for accessibility support",
module_path, method);
g_module_close (handle);
return FALSE;
}
g_debug ("Module %s loaded successfully", module_path);
invoke_fn ();
return TRUE;
}
/**
* This method will initialize the accessibility support provided by cally.
*
* Basically it will load the cally module using gmodule functions.
*
*/
void
cally_util_a11y_init (int *argc, char ***argv)
{
gchar *bridge_dir = NULL;
gchar *bridge_path = NULL;
if (clutter_get_accessibility_enabled () == FALSE)
{
g_warning ("Accessibility: clutter has no accessibility enabled"
" skipping the atk-bridge load");
return;
}
bridge_dir = _a11y_check_custom_bridge (argc, argv);
if (bridge_dir == NULL)
bridge_dir = _search_for_bridge_module ("atk-bridge");
bridge_path = g_module_build_path (bridge_dir, "libatk-bridge");
_a11y_invoke_module (bridge_path, TRUE);
g_free (bridge_dir);
g_free (bridge_path);
}

View File

@ -0,0 +1,24 @@
/* 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.
*/
void
cally_util_a11y_init (int *argc, char ***argv);