Compare commits

..

1 Commits

Author SHA1 Message Date
Carlos Garnacho
435e1a47ac clutter/cogl: Fix invalidation on non-primary monitors with no buffer age
We passed the view rectangle, we however want a fb-scaled rectangle starting
at 0,0. Fixes invalidation on other than the primary monitor when those
paths are hit.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/897
2019-10-29 16:11:39 +01:00
312 changed files with 24624 additions and 6693 deletions

View File

@@ -19,7 +19,7 @@ RUN dnf -y update && dnf -y upgrade && \
dnf install -y 'pkgconfig(graphene-gobject-1.0)' 'pkgconfig(sysprof-capture-3)' && \
# For running unit tests
dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 '*/xvfb-run' gdm-lib accountsservice-libs gnome-control-center && \
dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 '*/xvfb-run' gdm-lib accountsservice-libs && \
# GNOME Shell
dnf builddep -y gnome-shell --setopt=install_weak_deps=False && \

View File

@@ -1,5 +1,6 @@
#!/usr/bin/bash
mutter_branch=$(git describe --contains --all HEAD)
gnome_shell_target=
git clone https://gitlab.gnome.org/GNOME/gnome-shell.git
@@ -25,7 +26,8 @@ if [ "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" ]; then
fi
if [ -z "$gnome_shell_target" ]; then
gnome_shell_target=$(git branch -r -l origin/$CI_COMMIT_REF_NAME)
gnome_shell_target=$(git branch -r -l origin/$mutter_branch)
gnome_shell_target=${gnome_shell_target:-$(git branch -r -l ${mutter_branch#remotes/})}
gnome_shell_target=${gnome_shell_target:-origin/master}
echo Using $gnome_shell_target instead
fi

View File

@@ -310,7 +310,11 @@ cally_actor_finalize (GObject *obj)
_cally_actor_clean_action_list (cally_actor);
g_clear_handle_id (&priv->action_idle_handler, g_source_remove);
if (priv->action_idle_handler)
{
g_source_remove (priv->action_idle_handler);
priv->action_idle_handler = 0;
}
if (priv->action_queue)
{

View File

@@ -75,8 +75,8 @@ struct _CallyRootPrivate
GSList *stage_list;
/* signals id */
gulong stage_added_id;
gulong stage_removed_id;
guint stage_added_id;
guint stage_removed_id;
};
G_DEFINE_TYPE_WITH_PRIVATE (CallyRoot, cally_root, ATK_TYPE_GOBJECT_ACCESSIBLE)
@@ -149,9 +149,11 @@ cally_root_finalize (GObject *object)
stage_manager = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (root));
g_clear_signal_handler (&root->priv->stage_added_id, stage_manager);
g_signal_handler_disconnect (stage_manager,
root->priv->stage_added_id);
g_clear_signal_handler (&root->priv->stage_removed_id, stage_manager);
g_signal_handler_disconnect (stage_manager,
root->priv->stage_added_id);
G_OBJECT_CLASS (cally_root_parent_class)->finalize (object);
}

View File

@@ -247,7 +247,11 @@ cally_text_finalize (GObject *obj)
/* g_object_unref (cally_text->priv->textutil); */
/* cally_text->priv->textutil = NULL; */
g_clear_handle_id (&cally_text->priv->insert_idle_handler, g_source_remove);
if (cally_text->priv->insert_idle_handler)
{
g_source_remove (cally_text->priv->insert_idle_handler);
cally_text->priv->insert_idle_handler = 0;
}
G_OBJECT_CLASS (cally_text_parent_class)->finalize (obj);
}

View File

@@ -0,0 +1,98 @@
/* 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 "clutter-build-config.h"
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "cally-texture.h"
#include "cally-actor-private.h"
#include "deprecated/clutter-texture.h"
/* AtkObject */
static void cally_texture_real_initialize (AtkObject *obj,
gpointer data);
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;
}
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;
}

View File

@@ -0,0 +1,84 @@
/* 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/>.
*/
#ifndef __CALLY_TEXTURE_H__
#define __CALLY_TEXTURE_H__
#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <cally/cally.h> can be included directly."
#endif
#include <clutter/clutter.h>
#include <cally/cally-actor.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];
};
CLUTTER_EXPORT
GType cally_texture_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
AtkObject *cally_texture_new (ClutterActor *actor);
G_END_DECLS
#endif /* __CALLY_TEXTURE_H__ */

View File

@@ -39,6 +39,7 @@
#include "cally-group.h"
#include "cally-stage.h"
#include "cally-text.h"
#include "cally-texture.h"
#include "cally-rectangle.h"
#include "cally-clone.h"
@@ -55,6 +56,7 @@ 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)
@@ -76,6 +78,7 @@ cally_accessibility_init (void)
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);

View File

@@ -32,6 +32,7 @@
#include "cally-root.h"
#include "cally-stage.h"
#include "cally-text.h"
#include "cally-texture.h"
#include "cally-util.h"
#undef __CALLY_H_INSIDE__

View File

@@ -51,7 +51,7 @@
struct _ClutterActorMetaPrivate
{
ClutterActor *actor;
gulong destroy_id;
guint destroy_id;
gchar *name;
@@ -91,7 +91,11 @@ clutter_actor_meta_real_set_actor (ClutterActorMeta *meta,
if (meta->priv->actor == actor)
return;
g_clear_signal_handler (&meta->priv->destroy_id, meta->priv->actor);
if (meta->priv->destroy_id != 0)
{
g_signal_handler_disconnect (meta->priv->actor, meta->priv->destroy_id);
meta->priv->destroy_id = 0;
}
meta->priv->actor = actor;
@@ -158,8 +162,8 @@ clutter_actor_meta_finalize (GObject *gobject)
{
ClutterActorMetaPrivate *priv = CLUTTER_ACTOR_META (gobject)->priv;
if (priv->actor != NULL)
g_clear_signal_handler (&priv->destroy_id, priv->actor);
if (priv->destroy_id != 0 && priv->actor != NULL)
g_signal_handler_disconnect (priv->actor, priv->destroy_id);
g_free (priv->name);

View File

@@ -808,8 +808,8 @@ struct _ClutterActorPrivate
gpointer create_child_data;
GDestroyNotify create_child_notify;
gulong resolution_changed_id;
gulong font_changed_id;
guint resolution_changed_id;
guint font_changed_id;
/* bitfields: KEEP AT THE END */
@@ -2028,6 +2028,29 @@ clutter_actor_hide (ClutterActor *self)
g_object_thaw_notify (G_OBJECT (self));
}
/**
* clutter_actor_hide_all:
* @self: a #ClutterActor
*
* Calls clutter_actor_hide() on all child actors (if any).
*
* Since: 0.2
*
* Deprecated: 1.10: Using clutter_actor_hide() on the actor will
* prevent its children from being painted as well.
*/
void
clutter_actor_hide_all (ClutterActor *self)
{
ClutterActorClass *klass;
g_return_if_fail (CLUTTER_IS_ACTOR (self));
klass = CLUTTER_ACTOR_GET_CLASS (self);
if (klass->hide_all)
klass->hide_all (self);
}
/**
* clutter_actor_realize:
* @self: A #ClutterActor
@@ -3382,20 +3405,20 @@ _clutter_actor_apply_relative_transformation_matrix (ClutterActor *self,
}
static void
_clutter_actor_draw_paint_volume_full (ClutterActor *self,
_clutter_actor_draw_paint_volume_full (ClutterActor *self,
ClutterPaintVolume *pv,
const char *label,
const ClutterColor *color,
ClutterPaintNode *node)
const char *label,
const CoglColor *color)
{
g_autoptr (ClutterPaintNode) pipeline_node = NULL;
static CoglPipeline *outline = NULL;
CoglPrimitive *prim;
graphene_point3d_t line_ends[12 * 2];
int n_vertices;
CoglContext *ctx =
clutter_backend_get_cogl_context (clutter_get_default_backend ());
CoglColor cogl_color;
/* XXX: at some point we'll query this from the stage but we can't
* do that until the osx backend uses Cogl natively. */
CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
if (outline == NULL)
outline = cogl_pipeline_new (ctx);
@@ -3429,50 +3452,29 @@ _clutter_actor_draw_paint_volume_full (ClutterActor *self,
n_vertices,
(CoglVertexP3 *)line_ends);
cogl_color_init_from_4ub (&cogl_color,
color->red,
color->green,
color->blue,
color->alpha);
cogl_pipeline_set_color (outline, &cogl_color);
pipeline_node = clutter_pipeline_node_new (outline);
clutter_paint_node_set_name (pipeline_node,
"ClutterActor (paint volume outline)");
clutter_paint_node_add_primitive (pipeline_node, prim);
clutter_paint_node_add_child (node, pipeline_node);
cogl_pipeline_set_color (outline, color);
cogl_framebuffer_draw_primitive (fb, outline, prim);
cogl_object_unref (prim);
if (label)
{
g_autoptr (ClutterPaintNode) text_node = NULL;
PangoLayout *layout;
layout = pango_layout_new (clutter_actor_get_pango_context (self));
pango_layout_set_text (layout, label, -1);
text_node = clutter_text_node_new (layout, color);
clutter_paint_node_set_name (text_node,
"ClutterActor (paint volume label)");
clutter_paint_node_add_rectangle (text_node,
&(ClutterActorBox) {
.x1 = pv->vertices[0].x,
.y1 = pv->vertices[0].y,
.x2 = pv->vertices[2].x,
.y2 = pv->vertices[2].y,
});
clutter_paint_node_add_child (node, text_node);
cogl_pango_render_layout (layout,
pv->vertices[0].x,
pv->vertices[0].y,
color,
0);
g_object_unref (layout);
}
}
static void
_clutter_actor_draw_paint_volume (ClutterActor *self,
ClutterPaintNode *node)
_clutter_actor_draw_paint_volume (ClutterActor *self)
{
ClutterPaintVolume *pv;
ClutterColor color;
CoglColor color;
pv = _clutter_actor_get_paint_volume_mutable (self);
if (!pv)
@@ -3487,79 +3489,61 @@ _clutter_actor_draw_paint_volume (ClutterActor *self,
clutter_paint_volume_set_width (&fake_pv, width);
clutter_paint_volume_set_height (&fake_pv, height);
clutter_color_init (&color, 0, 0, 255, 255);
cogl_color_init_from_4f (&color, 0, 0, 1, 1);
_clutter_actor_draw_paint_volume_full (self, &fake_pv,
_clutter_actor_get_debug_name (self),
&color,
node);
&color);
clutter_paint_volume_free (&fake_pv);
}
else
{
clutter_color_init (&color, 0, 255, 0, 255);
cogl_color_init_from_4f (&color, 0, 1, 0, 1);
_clutter_actor_draw_paint_volume_full (self, pv,
_clutter_actor_get_debug_name (self),
&color,
node);
&color);
}
}
static void
_clutter_actor_paint_cull_result (ClutterActor *self,
gboolean success,
ClutterCullResult result,
ClutterPaintNode *node)
_clutter_actor_paint_cull_result (ClutterActor *self,
gboolean success,
ClutterCullResult result)
{
ClutterActorPrivate *priv = self->priv;
ClutterPaintVolume *pv;
ClutterColor color;
CoglColor color;
if (success)
{
if (result == CLUTTER_CULL_RESULT_IN)
clutter_color_init (&color, 0, 255, 0, 255);
cogl_color_init_from_4f (&color, 0, 1, 0, 1);
else if (result == CLUTTER_CULL_RESULT_OUT)
clutter_color_init (&color, 0, 0, 255, 255);
cogl_color_init_from_4f (&color, 0, 0, 1, 1);
else
clutter_color_init (&color, 0, 255, 255, 255);
cogl_color_init_from_4f (&color, 0, 1, 1, 1);
}
else
clutter_color_init (&color, 255, 255, 255, 255);
cogl_color_init_from_4f (&color, 1, 1, 1, 1);
if (success && (pv = _clutter_actor_get_paint_volume_mutable (self)))
_clutter_actor_draw_paint_volume_full (self, pv,
_clutter_actor_get_debug_name (self),
&color,
node);
&color);
else
{
g_autoptr (ClutterPaintNode) text_node = NULL;
PangoLayout *layout;
float width;
float height;
char *label =
g_strdup_printf ("CULL FAILURE: %s", _clutter_actor_get_debug_name (self));
clutter_color_init (&color, 255, 255, 255, 255);
width = clutter_actor_box_get_width (&priv->allocation);
height = clutter_actor_box_get_height (&priv->allocation);
cogl_color_init_from_4f (&color, 1, 1, 1, 1);
cogl_set_source_color (&color);
layout = pango_layout_new (clutter_actor_get_pango_context (self));
pango_layout_set_text (layout, label, -1);
text_node = clutter_text_node_new (layout, &color);
clutter_paint_node_set_name (text_node,
"ClutterActor (paint volume text)");
clutter_paint_node_add_rectangle (text_node,
&(ClutterActorBox) {
.x1 = 0.f,
.y1 = 0.f,
.x2 = width,
.y2 = height,
});
clutter_paint_node_add_child (node, text_node);
cogl_pango_render_layout (layout,
0,
0,
&color,
0);
g_free (label);
g_object_unref (layout);
}
@@ -3823,6 +3807,8 @@ clutter_actor_paint_node (ClutterActor *actor,
bg_color.alpha);
clear_flags = COGL_BUFFER_BIT_DEPTH;
if (!clutter_stage_get_no_clear_hint (CLUTTER_STAGE (actor)))
clear_flags |= COGL_BUFFER_BIT_COLOR;
node = clutter_root_node_new (fb, &bg_color, clear_flags);
clutter_paint_node_set_name (node, "stageClear");
@@ -3920,6 +3906,9 @@ clutter_actor_paint (ClutterActor *self)
clutter_actor_ensure_resource_scale (self);
/* mark that we are in the paint process */
CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IN_PAINT);
actor_node = clutter_actor_node_new (self);
root_node = clutter_paint_node_ref (actor_node);
@@ -3947,7 +3936,6 @@ clutter_actor_paint (ClutterActor *self)
clip_node = clutter_clip_node_new ();
clutter_paint_node_add_rectangle (clip_node, &clip);
clutter_paint_node_add_child (clip_node, root_node);
clutter_paint_node_unref (root_node);
root_node = g_steal_pointer (&clip_node);
}
@@ -3961,7 +3949,6 @@ clutter_actor_paint (ClutterActor *self)
transform_node = clutter_transform_node_new (&transform);
clutter_paint_node_add_child (transform_node, root_node);
clutter_paint_node_unref (root_node);
root_node = g_steal_pointer (&transform_node);
@@ -4055,9 +4042,9 @@ clutter_actor_paint (ClutterActor *self)
success = cull_actor (self, &result);
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_REDRAWS))
_clutter_actor_paint_cull_result (self, success, result, actor_node);
_clutter_actor_paint_cull_result (self, success, result);
else if (result == CLUTTER_CULL_RESULT_OUT && success)
return;
goto done;
}
if (priv->effects == NULL)
@@ -4066,14 +4053,18 @@ clutter_actor_paint (ClutterActor *self)
priv->next_effect_to_paint =
_clutter_meta_group_peek_metas (priv->effects);
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_VOLUMES))
_clutter_actor_draw_paint_volume (self, actor_node);
clutter_paint_node_paint (root_node);
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_VOLUMES))
_clutter_actor_draw_paint_volume (self);
/* If we make it here then the actor has run through a complete
paint run including all the effects so it's no longer dirty */
priv->is_dirty = FALSE;
done:
/* paint sequence complete */
CLUTTER_UNSET_PRIVATE_FLAGS (self, CLUTTER_IN_PAINT);
}
/**
@@ -4508,6 +4499,7 @@ clutter_actor_remove_child_internal (ClutterActor *self,
clutter_actor_queue_compute_expand (self);
}
/* clutter_actor_reparent() will emit ::parent-set for us */
if (emit_parent_set && !CLUTTER_ACTOR_IN_REPARENT (child) &&
!CLUTTER_ACTOR_IN_DESTRUCTION (child))
{
@@ -6141,8 +6133,17 @@ clutter_actor_dispose (GObject *object)
g_assert (!CLUTTER_ACTOR_IS_REALIZED (self));
}
g_clear_signal_handler (&priv->resolution_changed_id, backend);
g_clear_signal_handler (&priv->font_changed_id, backend);
if (priv->resolution_changed_id)
{
g_signal_handler_disconnect (backend, priv->resolution_changed_id);
priv->resolution_changed_id = 0;
}
if (priv->font_changed_id)
{
g_signal_handler_disconnect (backend, priv->font_changed_id);
priv->font_changed_id = 0;
}
g_clear_object (&priv->pango_context);
g_clear_object (&priv->actions);
@@ -11694,6 +11695,45 @@ clutter_actor_set_scale_full (ClutterActor *self,
g_object_thaw_notify (G_OBJECT (self));
}
/**
* clutter_actor_set_scale_with_gravity:
* @self: A #ClutterActor
* @scale_x: double factor to scale actor by horizontally.
* @scale_y: double factor to scale actor by vertically.
* @gravity: the location of the scale center expressed as a compass
* direction.
*
* Scales an actor with the given factors around the given
* center point. The center point is specified as one of the compass
* directions in #ClutterGravity. For example, setting it to north
* will cause the top of the actor to remain unchanged and the rest of
* the actor to expand left, right and downwards.
*
* The #ClutterActor:scale-x and #ClutterActor:scale-y properties are
* animatable.
*
* Since: 1.0
*
* Deprecated: 1.12: Use clutter_actor_set_pivot_point() to set the
* scale center using normalized coordinates instead.
*/
void
clutter_actor_set_scale_with_gravity (ClutterActor *self,
gdouble scale_x,
gdouble scale_y,
ClutterGravity gravity)
{
g_return_if_fail (CLUTTER_IS_ACTOR (self));
g_object_freeze_notify (G_OBJECT (self));
clutter_actor_set_scale_factor (self, CLUTTER_X_AXIS, scale_x);
clutter_actor_set_scale_factor (self, CLUTTER_Y_AXIS, scale_y);
clutter_actor_set_scale_gravity (self, gravity);
g_object_thaw_notify (G_OBJECT (self));
}
/**
* clutter_actor_get_scale:
* @self: A #ClutterActor
@@ -12084,6 +12124,27 @@ clutter_actor_get_name (ClutterActor *self)
return self->priv->name;
}
/**
* clutter_actor_get_gid:
* @self: A #ClutterActor
*
* Retrieves the unique id for @self.
*
* Return value: Globally unique value for this object instance.
*
* Since: 0.6
*
* Deprecated: 1.8: The id is not used any longer, and this function
* always returns 0.
*/
guint32
clutter_actor_get_gid (ClutterActor *self)
{
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
return 0;
}
static inline void
clutter_actor_set_depth_internal (ClutterActor *self,
float depth)
@@ -13071,6 +13132,7 @@ clutter_actor_add_child_internal (ClutterActor *self,
clutter_actor_queue_compute_expand (self);
}
/* clutter_actor_reparent() will emit ::parent-set for us */
if (emit_parent_set && !CLUTTER_ACTOR_IN_REPARENT (child))
{
child->priv->needs_compute_resource_scale = TRUE;
@@ -13591,6 +13653,89 @@ clutter_actor_unparent (ClutterActor *self)
REMOVE_CHILD_LEGACY_FLAGS);
}
/**
* clutter_actor_reparent:
* @self: a #ClutterActor
* @new_parent: the new #ClutterActor parent
*
* Resets the parent actor of @self.
*
* This function is logically equivalent to calling clutter_actor_unparent()
* and clutter_actor_set_parent(), but more efficiently implemented, as it
* ensures the child is not finalized when unparented, and emits the
* #ClutterActor::parent-set signal only once.
*
* In reality, calling this function is less useful than it sounds, as some
* application code may rely on changes in the intermediate state between
* removal and addition of the actor from its old parent to the @new_parent.
* Thus, it is strongly encouraged to avoid using this function in application
* code.
*
* Since: 0.2
*
* Deprecated: 1.10: Use clutter_actor_remove_child() and
* clutter_actor_add_child() instead; remember to take a reference on
* the actor being removed before calling clutter_actor_remove_child()
* to avoid the reference count dropping to zero and the actor being
* destroyed.
*/
void
clutter_actor_reparent (ClutterActor *self,
ClutterActor *new_parent)
{
ClutterActorPrivate *priv;
g_return_if_fail (CLUTTER_IS_ACTOR (self));
g_return_if_fail (CLUTTER_IS_ACTOR (new_parent));
g_return_if_fail (self != new_parent);
if (CLUTTER_ACTOR_IS_TOPLEVEL (self))
{
g_warning ("Cannot set a parent on a toplevel actor");
return;
}
if (CLUTTER_ACTOR_IN_DESTRUCTION (self))
{
g_warning ("Cannot set a parent currently being destroyed");
return;
}
priv = self->priv;
if (priv->parent != new_parent)
{
ClutterActor *old_parent;
CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IN_REPARENT);
old_parent = priv->parent;
g_object_ref (self);
if (old_parent != NULL)
{
/* this will have to call unparent() */
clutter_container_remove_actor (CLUTTER_CONTAINER (old_parent), self);
}
/* Note, will call set_parent() */
clutter_container_add_actor (CLUTTER_CONTAINER (new_parent), self);
priv->needs_compute_resource_scale = TRUE;
/* we emit the ::parent-set signal once */
g_signal_emit (self, actor_signals[PARENT_SET], 0, old_parent);
CLUTTER_UNSET_PRIVATE_FLAGS (self, CLUTTER_IN_REPARENT);
/* the IN_REPARENT flag suspends state updates */
clutter_actor_update_map_state (self, MAP_STATE_CHECK);
g_object_unref (self);
}
}
/**
* clutter_actor_contains:
* @self: A #ClutterActor
@@ -13758,6 +13903,134 @@ clutter_actor_set_child_at_index (ClutterActor *self,
clutter_actor_queue_relayout (self);
}
/**
* clutter_actor_raise:
* @self: A #ClutterActor
* @below: (allow-none): A #ClutterActor to raise above.
*
* Puts @self above @below.
*
* Both actors must have the same parent, and the parent must implement
* the #ClutterContainer interface
*
* This function calls clutter_container_raise_child() internally.
*
* Deprecated: 1.10: Use clutter_actor_set_child_above_sibling() instead.
*/
void
clutter_actor_raise (ClutterActor *self,
ClutterActor *below)
{
ClutterActor *parent;
g_return_if_fail (CLUTTER_IS_ACTOR (self));
parent = clutter_actor_get_parent (self);
if (parent == NULL)
{
g_warning ("%s: Actor '%s' is not inside a container",
G_STRFUNC,
_clutter_actor_get_debug_name (self));
return;
}
if (below != NULL)
{
if (parent != clutter_actor_get_parent (below))
{
g_warning ("%s Actor '%s' is not in the same container as "
"actor '%s'",
G_STRFUNC,
_clutter_actor_get_debug_name (self),
_clutter_actor_get_debug_name (below));
return;
}
}
clutter_container_raise_child (CLUTTER_CONTAINER (parent), self, below);
}
/**
* clutter_actor_lower:
* @self: A #ClutterActor
* @above: (allow-none): A #ClutterActor to lower below
*
* Puts @self below @above.
*
* Both actors must have the same parent, and the parent must implement
* the #ClutterContainer interface.
*
* This function calls clutter_container_lower_child() internally.
*
* Deprecated: 1.10: Use clutter_actor_set_child_below_sibling() instead.
*/
void
clutter_actor_lower (ClutterActor *self,
ClutterActor *above)
{
ClutterActor *parent;
g_return_if_fail (CLUTTER_IS_ACTOR (self));
parent = clutter_actor_get_parent (self);
if (parent == NULL)
{
g_warning ("%s: Actor of type %s is not inside a container",
G_STRFUNC,
_clutter_actor_get_debug_name (self));
return;
}
if (above)
{
if (parent != clutter_actor_get_parent (above))
{
g_warning ("%s: Actor '%s' is not in the same container as "
"actor '%s'",
G_STRFUNC,
_clutter_actor_get_debug_name (self),
_clutter_actor_get_debug_name (above));
return;
}
}
clutter_container_lower_child (CLUTTER_CONTAINER (parent), self, above);
}
/**
* clutter_actor_raise_top:
* @self: A #ClutterActor
*
* Raises @self to the top.
*
* This function calls clutter_actor_raise() internally.
*
* Deprecated: 1.10: Use clutter_actor_set_child_above_sibling() with
* a %NULL sibling, instead.
*/
void
clutter_actor_raise_top (ClutterActor *self)
{
clutter_actor_raise (self, NULL);
}
/**
* clutter_actor_lower_bottom:
* @self: A #ClutterActor
*
* Lowers @self to the bottom.
*
* This function calls clutter_actor_lower() internally.
*
* Deprecated: 1.10: Use clutter_actor_set_child_below_sibling() with
* a %NULL sibling, instead.
*/
void
clutter_actor_lower_bottom (ClutterActor *self)
{
clutter_actor_lower (self, NULL);
}
/*
* Event handling
*/
@@ -13900,6 +14173,34 @@ clutter_actor_get_reactive (ClutterActor *actor)
return CLUTTER_ACTOR_IS_REACTIVE (actor) ? TRUE : FALSE;
}
/**
* clutter_actor_get_anchor_point:
* @self: a #ClutterActor
* @anchor_x: (out): return location for the X coordinate of the anchor point
* @anchor_y: (out): return location for the Y coordinate of the anchor point
*
* Gets the current anchor point of the @actor in pixels.
*
* Since: 0.6
*
* Deprecated: 1.12: Use #ClutterActor:pivot-point instead
*/
void
clutter_actor_get_anchor_point (ClutterActor *self,
gfloat *anchor_x,
gfloat *anchor_y)
{
const ClutterTransformInfo *info;
g_return_if_fail (CLUTTER_IS_ACTOR (self));
info = _clutter_actor_get_transform_info_or_defaults (self);
clutter_anchor_coord_get_units (self, &info->anchor,
anchor_x,
anchor_y,
NULL);
}
/**
* clutter_actor_set_anchor_point:
* @self: a #ClutterActor
@@ -16159,6 +16460,25 @@ clutter_actor_unset_flags (ClutterActor *self,
g_object_thaw_notify (obj);
}
/**
* clutter_actor_get_transformation_matrix:
* @self: a #ClutterActor
* @matrix: (out caller-allocates): the return location for a #ClutterMatrix
*
* Retrieves the transformations applied to @self relative to its
* parent.
*
* Since: 1.0
*
* Deprecated: 1.12: Use clutter_actor_get_transform() instead
*/
void
clutter_actor_get_transformation_matrix (ClutterActor *self,
ClutterMatrix *matrix)
{
clutter_actor_get_transform (self, matrix);
}
static void
clutter_actor_set_transform_internal (ClutterActor *self,
const ClutterMatrix *transform)
@@ -19000,7 +19320,7 @@ transition_closure_free (gpointer data)
* so that we don't end up inside on_transition_stopped() from
* a call to g_hash_table_remove().
*/
g_clear_signal_handler (&clos->completed_id, clos->transition);
g_signal_handler_disconnect (clos->transition, clos->completed_id);
if (clutter_timeline_is_playing (timeline))
clutter_timeline_stop (timeline);

View File

@@ -54,6 +54,7 @@
#include "clutter-debug.h"
#include "clutter-private.h"
#include "deprecated/clutter-animatable.h"
#include "deprecated/clutter-animation.h"
G_DEFINE_INTERFACE (ClutterAnimatable, clutter_animatable, G_TYPE_OBJECT);
@@ -63,6 +64,80 @@ clutter_animatable_default_init (ClutterAnimatableInterface *iface)
{
}
/**
* clutter_animatable_animate_property:
* @animatable: a #ClutterAnimatable
* @animation: a #ClutterAnimation
* @property_name: the name of the animated property
* @initial_value: the initial value of the animation interval
* @final_value: the final value of the animation interval
* @progress: the progress factor
* @value: return location for the animation value
*
* Calls the animate_property() virtual function for @animatable.
*
* The @initial_value and @final_value #GValue<!-- -->s must contain
* the same type; @value must have been initialized to the same
* type of @initial_value and @final_value.
*
* All implementation of the #ClutterAnimatable interface must
* implement this function.
*
* Return value: %TRUE if the value has been validated and can
* be applied to the #ClutterAnimatable, and %FALSE otherwise
*
* Since: 1.0
*
* Deprecated: 1.8: Use clutter_animatable_interpolate_value()
* instead
*/
gboolean
clutter_animatable_animate_property (ClutterAnimatable *animatable,
ClutterAnimation *animation,
const gchar *property_name,
const GValue *initial_value,
const GValue *final_value,
gdouble progress,
GValue *value)
{
ClutterAnimatableInterface *iface;
gboolean res;
g_return_val_if_fail (CLUTTER_IS_ANIMATABLE (animatable), FALSE);
g_return_val_if_fail (CLUTTER_IS_ANIMATION (animation), FALSE);
g_return_val_if_fail (property_name != NULL, FALSE);
g_return_val_if_fail (initial_value != NULL && final_value != NULL, FALSE);
g_return_val_if_fail (G_VALUE_TYPE (initial_value) != G_TYPE_INVALID, FALSE);
g_return_val_if_fail (G_VALUE_TYPE (final_value) != G_TYPE_INVALID, FALSE);
g_return_val_if_fail (value != NULL, FALSE);
g_return_val_if_fail (G_VALUE_TYPE (value) == G_VALUE_TYPE (initial_value) &&
G_VALUE_TYPE (value) == G_VALUE_TYPE (final_value),
FALSE);
iface = CLUTTER_ANIMATABLE_GET_IFACE (animatable);
if (iface->animate_property == NULL)
{
ClutterInterval *interval;
interval = clutter_animation_get_interval (animation, property_name);
if (interval == NULL)
return FALSE;
res = clutter_animatable_interpolate_value (animatable, property_name,
interval,
progress,
value);
}
else
res = iface->animate_property (animatable, animation,
property_name,
initial_value, final_value,
progress,
value);
return res;
}
/**
* clutter_animatable_find_property:
* @animatable: a #ClutterAnimatable

View File

@@ -23,7 +23,8 @@
#define __CLUTTER_BACKEND_PRIVATE_H__
#include <clutter/clutter-backend.h>
#include <clutter/clutter-seat.h>
#include <clutter/clutter-device-manager.h>
#include <clutter/clutter-keymap.h>
#include <clutter/clutter-stage-window.h>
#define CLUTTER_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BACKEND, ClutterBackendClass))
@@ -46,6 +47,8 @@ struct _ClutterBackend
CoglOnscreen *dummy_onscreen;
ClutterDeviceManager *device_manager;
cairo_font_options_t *font_options;
gchar *font_name;
@@ -56,6 +59,8 @@ struct _ClutterBackend
ClutterStageWindow *stage_window;
ClutterInputMethod *input_method;
ClutterKeymap *keymap;
};
struct _ClutterBackendClass
@@ -84,12 +89,17 @@ struct _ClutterBackendClass
GError **error);
gboolean (* create_context) (ClutterBackend *backend,
GError **error);
ClutterDeviceManager *(* get_device_manager) (ClutterBackend *backend);
gboolean (* translate_event) (ClutterBackend *backend,
gpointer native,
ClutterEvent *event);
ClutterSeat * (* get_default_seat) (ClutterBackend *backend);
PangoDirection (* get_keymap_direction) (ClutterBackend *backend);
void (* bell_notify) (ClutterBackend *backend);
ClutterKeymap * (* get_keymap) (ClutterBackend *backend);
/* signals */
void (* resolution_changed) (ClutterBackend *backend);
@@ -129,6 +139,8 @@ gfloat _clutter_backend_get_units_per_em (Clutter
PangoFontDescription *font_desc);
gint32 _clutter_backend_get_units_serial (ClutterBackend *backend);
PangoDirection _clutter_backend_get_keymap_direction (ClutterBackend *backend);
CLUTTER_EXPORT
void _clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend);

View File

@@ -51,6 +51,7 @@
#include "clutter-stage-manager-private.h"
#include "clutter-stage-private.h"
#include "clutter-stage-window.h"
#include "clutter-device-manager-private.h"
#ifdef CLUTTER_HAS_WAYLAND_COMPOSITOR_SUPPORT
#include "wayland/clutter-wayland-compositor.h"
@@ -527,6 +528,30 @@ clutter_backend_real_init_events (ClutterBackend *backend)
g_error ("Unknown input backend");
}
static ClutterDeviceManager *
clutter_backend_real_get_device_manager (ClutterBackend *backend)
{
if (G_UNLIKELY (backend->device_manager == NULL))
{
g_critical ("No device manager available, expect broken input");
return NULL;
}
return backend->device_manager;
}
static ClutterKeymap *
clutter_backend_real_get_keymap (ClutterBackend *backend)
{
if (G_UNLIKELY (backend->keymap == NULL))
{
g_critical ("No keymap available, expect broken keyboard input");
return NULL;
}
return backend->keymap;
}
static void
clutter_backend_class_init (ClutterBackendClass *klass)
{
@@ -590,8 +615,10 @@ clutter_backend_class_init (ClutterBackendClass *klass)
klass->font_changed = clutter_backend_real_font_changed;
klass->init_events = clutter_backend_real_init_events;
klass->get_device_manager = clutter_backend_real_get_device_manager;
klass->create_context = clutter_backend_real_create_context;
klass->get_features = clutter_backend_real_get_features;
klass->get_keymap = clutter_backend_real_get_keymap;
}
static void
@@ -756,24 +783,24 @@ _clutter_backend_copy_event_data (ClutterBackend *backend,
const ClutterEvent *src,
ClutterEvent *dest)
{
ClutterSeatClass *seat_class;
ClutterSeat *seat;
ClutterDeviceManagerClass *device_manager_class;
ClutterDeviceManager *device_manager;
seat = clutter_backend_get_default_seat (backend);
seat_class = CLUTTER_SEAT_GET_CLASS (seat);
seat_class->copy_event_data (seat, src, dest);
device_manager = clutter_device_manager_get_default ();
device_manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
device_manager_class->copy_event_data (device_manager, src, dest);
}
void
_clutter_backend_free_event_data (ClutterBackend *backend,
ClutterEvent *event)
{
ClutterSeatClass *seat_class;
ClutterSeat *seat;
ClutterDeviceManagerClass *device_manager_class;
ClutterDeviceManager *device_manager;
seat = clutter_backend_get_default_seat (backend);
seat_class = CLUTTER_SEAT_GET_CLASS (seat);
seat_class->free_event_data (seat, event);
device_manager = clutter_device_manager_get_default ();
device_manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
device_manager_class->free_event_data (device_manager, event);
}
/**
@@ -970,6 +997,18 @@ clutter_wayland_set_compositor_display (void *display)
}
#endif
PangoDirection
_clutter_backend_get_keymap_direction (ClutterBackend *backend)
{
ClutterBackendClass *klass;
klass = CLUTTER_BACKEND_GET_CLASS (backend);
if (klass->get_keymap_direction != NULL)
return klass->get_keymap_direction (backend);
return PANGO_DIRECTION_NEUTRAL;
}
void
_clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend)
{
@@ -1003,6 +1042,16 @@ clutter_set_allowed_drivers (const char *drivers)
allowed_drivers = g_strdup (drivers);
}
void
clutter_backend_bell_notify (ClutterBackend *backend)
{
ClutterBackendClass *klass;
klass = CLUTTER_BACKEND_GET_CLASS (backend);
if (klass->bell_notify)
klass->bell_notify (backend);
}
/**
* clutter_backend_get_input_method:
* @backend: the #CLutterBackend
@@ -1031,24 +1080,22 @@ clutter_backend_set_input_method (ClutterBackend *backend,
g_set_object (&backend->input_method, method);
}
/**
* clutter_backend_get_keymap:
* @backend: the #ClutterBackend
*
* Gets the keymap used by Clutter
*
* Returns: (transfer none): the keymap
**/
ClutterKeymap *
clutter_backend_get_keymap (ClutterBackend *backend)
{
return CLUTTER_BACKEND_GET_CLASS (backend)->get_keymap (backend);
}
ClutterStageWindow *
clutter_backend_get_stage_window (ClutterBackend *backend)
{
return backend->stage_window;
}
/**
* clutter_backend_get_default_seat:
* @backend: the #ClutterBackend
*
* Returns the default seat
*
* Returns: (transfer none): the default seat
**/
ClutterSeat *
clutter_backend_get_default_seat (ClutterBackend *backend)
{
g_return_val_if_fail (CLUTTER_IS_BACKEND (backend), NULL);
return CLUTTER_BACKEND_GET_CLASS (backend)->get_default_seat (backend);
}

View File

@@ -36,7 +36,6 @@
#include <clutter/clutter-config.h>
#include <clutter/clutter-keymap.h>
#include <clutter/clutter-types.h>
#include <clutter/clutter-seat.h>
G_BEGIN_DECLS
@@ -73,6 +72,9 @@ const cairo_font_options_t * clutter_backend_get_font_options (Clutter
CLUTTER_EXPORT
CoglContext * clutter_backend_get_cogl_context (ClutterBackend *backend);
CLUTTER_EXPORT
void clutter_backend_bell_notify (ClutterBackend *backend);
CLUTTER_EXPORT
ClutterInputMethod * clutter_backend_get_input_method (ClutterBackend *backend);
@@ -80,7 +82,7 @@ CLUTTER_EXPORT
void clutter_backend_set_input_method (ClutterBackend *backend,
ClutterInputMethod *method);
CLUTTER_EXPORT
ClutterSeat * clutter_backend_get_default_seat (ClutterBackend *backend);
ClutterKeymap * clutter_backend_get_keymap (ClutterBackend *backend);
G_END_DECLS

View File

@@ -49,10 +49,10 @@
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "deprecated/clutter-container.h"
#include "deprecated/clutter-bin-layout.h"
#include "clutter-actor-private.h"
#include "clutter-animatable.h"
#include "clutter-bin-layout.h"
#include "clutter-child-meta.h"
#include "clutter-debug.h"
#include "clutter-enum-types.h"
@@ -698,3 +698,187 @@ clutter_bin_layout_new (ClutterBinAlignment x_align,
"y-align", y_align,
NULL);
}
/**
* clutter_bin_layout_set_alignment:
* @self: a #ClutterBinLayout
* @child: (allow-none): a child of @container
* @x_align: the horizontal alignment policy to be used for the @child
* inside @container
* @y_align: the vertical aligment policy to be used on the @child
* inside @container
*
* Sets the horizontal and vertical alignment policies to be applied
* to a @child of @self
*
* If @child is %NULL then the @x_align and @y_align values will
* be set as the default alignment policies
*
* Since: 1.2
*
* Deprecated: 1.12: Use the #ClutterActor:x-align and
* #ClutterActor:y-align properties of #ClutterActor instead.
*/
void
clutter_bin_layout_set_alignment (ClutterBinLayout *self,
ClutterActor *child,
ClutterBinAlignment x_align,
ClutterBinAlignment y_align)
{
ClutterBinLayoutPrivate *priv;
ClutterLayoutManager *manager;
ClutterLayoutMeta *meta;
g_return_if_fail (CLUTTER_IS_BIN_LAYOUT (self));
g_return_if_fail (child == NULL || CLUTTER_IS_ACTOR (child));
priv = self->priv;
if (priv->container == NULL)
{
if (child == NULL)
{
set_x_align (self, x_align);
set_y_align (self, y_align);
}
else
g_warning ("The layout of type '%s' must be associated to "
"a ClutterContainer before setting the alignment "
"on its children",
G_OBJECT_TYPE_NAME (self));
return;
}
manager = CLUTTER_LAYOUT_MANAGER (self);
meta = clutter_layout_manager_get_child_meta (manager,
priv->container,
child);
g_assert (CLUTTER_IS_BIN_LAYER (meta));
set_layer_x_align (CLUTTER_BIN_LAYER (meta), x_align);
set_layer_y_align (CLUTTER_BIN_LAYER (meta), y_align);
}
/**
* clutter_bin_layout_get_alignment:
* @self: a #ClutterBinLayout
* @child: (allow-none): a child of @container
* @x_align: (out) (allow-none): return location for the horizontal
* alignment policy
* @y_align: (out) (allow-none): return location for the vertical
* alignment policy
*
* Retrieves the horizontal and vertical alignment policies for
* a child of @self
*
* If @child is %NULL the default alignment policies will be returned
* instead
*
* Since: 1.2
*
* Deprecated: 1.12: Use the #ClutterActor:x-align and the
* #ClutterActor:y-align properties of #ClutterActor instead.
*/
void
clutter_bin_layout_get_alignment (ClutterBinLayout *self,
ClutterActor *child,
ClutterBinAlignment *x_align,
ClutterBinAlignment *y_align)
{
ClutterBinLayoutPrivate *priv;
ClutterLayoutManager *manager;
ClutterLayoutMeta *meta;
ClutterBinLayer *layer;
g_return_if_fail (CLUTTER_IS_BIN_LAYOUT (self));
priv = self->priv;
if (priv->container == NULL)
{
if (child == NULL)
{
if (x_align)
*x_align = priv->x_align;
if (y_align)
*y_align = priv->y_align;
}
else
g_warning ("The layout of type '%s' must be associated to "
"a ClutterContainer before getting the alignment "
"of its children",
G_OBJECT_TYPE_NAME (self));
return;
}
manager = CLUTTER_LAYOUT_MANAGER (self);
meta = clutter_layout_manager_get_child_meta (manager,
priv->container,
child);
g_assert (CLUTTER_IS_BIN_LAYER (meta));
layer = CLUTTER_BIN_LAYER (meta);
if (x_align)
*x_align = layer->x_align;
if (y_align)
*y_align = layer->y_align;
}
/**
* clutter_bin_layout_add:
* @self: a #ClutterBinLayout
* @child: a #ClutterActor
* @x_align: horizontal alignment policy for @child
* @y_align: vertical alignment policy for @child
*
* Adds a #ClutterActor to the container using @self and
* sets the alignment policies for it
*
* This function is equivalent to clutter_container_add_actor()
* and clutter_layout_manager_child_set_property() but it does not
* require a pointer to the #ClutterContainer associated to the
* #ClutterBinLayout
*
* Since: 1.2
*
* Deprecated: 1.12: Use clutter_actor_add_child() instead.
*/
void
clutter_bin_layout_add (ClutterBinLayout *self,
ClutterActor *child,
ClutterBinAlignment x_align,
ClutterBinAlignment y_align)
{
ClutterBinLayoutPrivate *priv;
ClutterLayoutManager *manager;
ClutterLayoutMeta *meta;
g_return_if_fail (CLUTTER_IS_BIN_LAYOUT (self));
g_return_if_fail (CLUTTER_IS_ACTOR (child));
priv = self->priv;
if (priv->container == NULL)
{
g_warning ("The layout of type '%s' must be associated to "
"a ClutterContainer before adding children",
G_OBJECT_TYPE_NAME (self));
return;
}
clutter_container_add_actor (priv->container, child);
manager = CLUTTER_LAYOUT_MANAGER (self);
meta = clutter_layout_manager_get_child_meta (manager,
priv->container,
child);
g_assert (CLUTTER_IS_BIN_LAYER (meta));
set_layer_x_align (CLUTTER_BIN_LAYER (meta), x_align);
set_layer_y_align (CLUTTER_BIN_LAYER (meta), y_align);
}

View File

@@ -105,8 +105,8 @@ struct _ClutterClickActionPrivate
{
ClutterActor *stage;
gulong event_id;
gulong capture_id;
guint event_id;
guint capture_id;
guint long_press_id;
gint long_press_threshold;
@@ -202,7 +202,11 @@ click_action_emit_long_press (gpointer data)
CLUTTER_LONG_PRESS_ACTIVATE,
&result);
g_clear_signal_handler (&priv->capture_id, priv->stage);
if (priv->capture_id != 0)
{
g_signal_handler_disconnect (priv->stage, priv->capture_id);
priv->capture_id = 0;
}
click_action_set_pressed (action, FALSE);
click_action_set_held (action, FALSE);
@@ -257,7 +261,8 @@ click_action_cancel_long_press (ClutterClickAction *action)
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
g_clear_handle_id (&priv->long_press_id, g_source_remove);
g_source_remove (priv->long_press_id);
priv->long_press_id = 0;
g_signal_emit (action, click_signals[LONG_PRESS], 0,
actor,
@@ -370,9 +375,17 @@ on_captured_event (ClutterActor *stage,
click_action_cancel_long_press (action);
/* disconnect the capture */
g_clear_signal_handler (&priv->capture_id, priv->stage);
if (priv->capture_id != 0)
{
g_signal_handler_disconnect (priv->stage, priv->capture_id);
priv->capture_id = 0;
}
g_clear_handle_id (&priv->long_press_id, g_source_remove);
if (priv->long_press_id != 0)
{
g_source_remove (priv->long_press_id);
priv->long_press_id = 0;
}
if (!clutter_actor_contains (actor, clutter_event_get_source (event)))
return CLUTTER_EVENT_PROPAGATE;
@@ -440,7 +453,7 @@ clutter_click_action_set_actor (ClutterActorMeta *meta,
ClutterActor *old_actor = clutter_actor_meta_get_actor (meta);
if (old_actor != NULL)
g_clear_signal_handler (&priv->event_id, old_actor);
g_signal_handler_disconnect (old_actor, priv->event_id);
priv->event_id = 0;
}
@@ -448,13 +461,17 @@ clutter_click_action_set_actor (ClutterActorMeta *meta,
if (priv->capture_id != 0)
{
if (priv->stage != NULL)
g_clear_signal_handler (&priv->capture_id, priv->stage);
g_signal_handler_disconnect (priv->stage, priv->capture_id);
priv->capture_id = 0;
priv->stage = NULL;
}
g_clear_handle_id (&priv->long_press_id, g_source_remove);
if (priv->long_press_id != 0)
{
g_source_remove (priv->long_press_id);
priv->long_press_id = 0;
}
click_action_set_pressed (action, FALSE);
click_action_set_held (action, FALSE);
@@ -528,12 +545,24 @@ clutter_click_action_dispose (GObject *gobject)
{
ClutterClickActionPrivate *priv = CLUTTER_CLICK_ACTION (gobject)->priv;
g_clear_signal_handler (&priv->event_id,
clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (gobject)));
if (priv->event_id)
{
g_signal_handler_disconnect (clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (gobject)),
priv->event_id);
priv->event_id = 0;
}
g_clear_signal_handler (&priv->capture_id, priv->stage);
if (priv->capture_id)
{
g_signal_handler_disconnect (priv->stage, priv->capture_id);
priv->capture_id = 0;
}
g_clear_handle_id (&priv->long_press_id, g_source_remove);
if (priv->long_press_id)
{
g_source_remove (priv->long_press_id);
priv->long_press_id = 0;
}
G_OBJECT_CLASS (clutter_click_action_parent_class)->dispose (gobject);
}
@@ -731,7 +760,11 @@ clutter_click_action_release (ClutterClickAction *action)
return;
/* disconnect the capture */
g_clear_signal_handler (&priv->capture_id, priv->stage);
if (priv->capture_id != 0)
{
g_signal_handler_disconnect (priv->stage, priv->capture_id);
priv->capture_id = 0;
}
click_action_cancel_long_press (action);
click_action_set_held (action, FALSE);

View File

@@ -400,7 +400,8 @@ clutter_clone_set_source_internal (ClutterClone *self,
if (priv->clone_source != NULL)
{
g_clear_signal_handler (&priv->source_destroy_id, priv->clone_source);
g_signal_handler_disconnect (priv->clone_source, priv->source_destroy_id);
priv->source_destroy_id = 0;
_clutter_actor_detach_clone (priv->clone_source, CLUTTER_ACTOR (self));
g_object_unref (priv->clone_source);
priv->clone_source = NULL;

View File

@@ -48,7 +48,7 @@
* Constraints provide a way to build user interfaces by using
* relations between #ClutterActors, without explicit fixed
* positioning and sizing, similarly to how fluid layout managers like
* #ClutterBoxLayout lay out their children.
* #ClutterBoxLayout and #ClutterTableLayout lay out their children.
*
* Constraints are attached to a #ClutterActor, and are available
* for inspection using clutter_actor_get_constraints().

View File

@@ -384,6 +384,33 @@ clutter_container_add_actor (ClutterContainer *container,
container_add_actor (container, actor);
}
/**
* clutter_container_add_valist: (skip)
* @container: a #ClutterContainer
* @first_actor: the first #ClutterActor to add
* @var_args: list of actors to add, followed by %NULL
*
* Alternative va_list version of clutter_container_add().
*
* This function will call #ClutterContainerIface.add(), which is a
* deprecated virtual function. The default implementation will
* call clutter_actor_add_child().
*
* Since: 0.4
*
* Deprecated: 1.10: Use clutter_actor_add_child() instead.
*/
void
clutter_container_add_valist (ClutterContainer *container,
ClutterActor *first_actor,
va_list var_args)
{
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
g_return_if_fail (CLUTTER_IS_ACTOR (first_actor));
container_add_valist (container, first_actor, var_args);
}
/**
* clutter_container_remove: (skip)
* @container: a #ClutterContainer
@@ -447,6 +474,33 @@ clutter_container_remove_actor (ClutterContainer *container,
container_remove_actor (container, actor);
}
/**
* clutter_container_remove_valist: (skip)
* @container: a #ClutterContainer
* @first_actor: the first #ClutterActor to add
* @var_args: list of actors to remove, followed by %NULL
*
* Alternative va_list version of clutter_container_remove().
*
* This function will call #ClutterContainerIface.remove(), which is a
* deprecated virtual function. The default implementation will call
* clutter_actor_remove_child().
*
* Since: 0.4
*
* Deprecated: 1.10: Use clutter_actor_remove_child() instead.
*/
void
clutter_container_remove_valist (ClutterContainer *container,
ClutterActor *first_actor,
va_list var_args)
{
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
g_return_if_fail (CLUTTER_IS_ACTOR (first_actor));
container_remove_valist (container, first_actor, var_args);
}
/**
* clutter_container_get_children:
* @container: a #ClutterContainer

View File

@@ -147,7 +147,7 @@ clutter_deform_effect_set_actor (ClutterActorMeta *meta,
ClutterActor *old_actor = clutter_actor_meta_get_actor (meta);
if (old_actor != NULL)
g_clear_signal_handler (&priv->allocation_id, old_actor);
g_signal_handler_disconnect (old_actor, priv->allocation_id);
priv->allocation_id = 0;
}

View File

@@ -5,13 +5,20 @@
#include "deprecated/clutter-actor.h"
#include "deprecated/clutter-alpha.h"
#include "deprecated/clutter-animatable.h"
#include "deprecated/clutter-animation.h"
#include "deprecated/clutter-bin-layout.h"
#include "deprecated/clutter-box.h"
#include "deprecated/clutter-cairo-texture.h"
#include "deprecated/clutter-container.h"
#include "deprecated/clutter-group.h"
#include "deprecated/clutter-keysyms.h"
#include "deprecated/clutter-rectangle.h"
#include "deprecated/clutter-stage-manager.h"
#include "deprecated/clutter-stage.h"
#include "deprecated/clutter-state.h"
#include "deprecated/clutter-table-layout.h"
#include "deprecated/clutter-texture.h"
#include "deprecated/clutter-timeline.h"
#undef __CLUTTER_DEPRECATED_H_INSIDE__

View File

@@ -0,0 +1,306 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2010 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author:
* Emmanuele Bassi <ebassi@linux.intel.com>
*/
#ifndef __CLUTTER_DEVICE_MANAGER_PRIVATE_H__
#define __CLUTTER_DEVICE_MANAGER_PRIVATE_H__
#include <clutter/clutter-backend.h>
#include <clutter/clutter-device-manager.h>
#include <clutter/clutter-event.h>
G_BEGIN_DECLS
typedef struct _ClutterAxisInfo
{
ClutterInputAxis axis;
gdouble min_axis;
gdouble max_axis;
gdouble min_value;
gdouble max_value;
gdouble resolution;
} ClutterAxisInfo;
typedef struct _ClutterKeyInfo
{
guint keyval;
ClutterModifierType modifiers;
} ClutterKeyInfo;
typedef struct _ClutterScrollInfo
{
guint axis_id;
ClutterScrollDirection direction;
gdouble increment;
gdouble last_value;
guint last_value_valid : 1;
} ClutterScrollInfo;
typedef struct _ClutterTouchInfo
{
ClutterEventSequence *sequence;
ClutterActor *actor;
gfloat current_x;
gfloat current_y;
} ClutterTouchInfo;
typedef struct _ClutterPtrA11yData
{
int n_btn_pressed;
float current_x;
float current_y;
float dwell_x;
float dwell_y;
gboolean dwell_drag_started;
gboolean dwell_gesture_started;
guint dwell_timer;
guint dwell_position_timer;
guint secondary_click_timer;
gboolean secondary_click_triggered;
} ClutterPtrA11yData;
struct _ClutterInputDevice
{
GObject parent_instance;
gint id;
ClutterInputDeviceType device_type;
ClutterInputMode device_mode;
gchar *device_name;
ClutterDeviceManager *device_manager;
ClutterBackend *backend;
/* the associated device */
ClutterInputDevice *associated;
GList *slaves;
/* the actor underneath the pointer */
ClutterActor *cursor_actor;
GHashTable *inv_touch_sequence_actors;
/* the actor that has a grab in place for the device */
ClutterActor *pointer_grab_actor;
ClutterActor *keyboard_grab_actor;
GHashTable *sequence_grab_actors;
GHashTable *inv_sequence_grab_actors;
/* the current click count */
gint click_count;
/* the stage the device is on */
ClutterStage *stage;
/* the current state */
gfloat current_x;
gfloat current_y;
guint32 current_time;
gint current_button_number;
ClutterModifierType current_state;
/* the current touch points states */
GHashTable *touch_sequences_info;
/* the previous state, used for click count generation */
gint previous_x;
gint previous_y;
guint32 previous_time;
gint previous_button_number;
ClutterModifierType previous_state;
GArray *axes;
guint n_keys;
GArray *keys;
GArray *scroll_info;
gchar *vendor_id;
gchar *product_id;
gchar *node_path;
GPtrArray *tools;
gint n_rings;
gint n_strips;
gint n_mode_groups;
ClutterInputDeviceMapping mapping_mode;
guint has_cursor : 1;
guint is_enabled : 1;
/* Accessiblity */
ClutterVirtualInputDevice *accessibility_virtual_device;
ClutterPtrA11yData *ptr_a11y_data;
};
typedef void (*ClutterEmitInputDeviceEvent) (ClutterEvent *event,
ClutterInputDevice *device);
struct _ClutterInputDeviceClass
{
GObjectClass parent_class;
gboolean (* keycode_to_evdev) (ClutterInputDevice *device,
guint hardware_keycode,
guint *evdev_keycode);
void (* update_from_tool) (ClutterInputDevice *device,
ClutterInputDeviceTool *tool);
gboolean (* is_mode_switch_button) (ClutterInputDevice *device,
guint group,
guint button);
gint (* get_group_n_modes) (ClutterInputDevice *device,
gint group);
gboolean (* is_grouped) (ClutterInputDevice *device,
ClutterInputDevice *other_device);
/* Keyboard accessbility */
void (* process_kbd_a11y_event) (ClutterEvent *event,
ClutterInputDevice *device,
ClutterEmitInputDeviceEvent emit_event_func);
};
/* device manager */
CLUTTER_EXPORT
void _clutter_device_manager_add_device (ClutterDeviceManager *device_manager,
ClutterInputDevice *device);
CLUTTER_EXPORT
void _clutter_device_manager_remove_device (ClutterDeviceManager *device_manager,
ClutterInputDevice *device);
void _clutter_device_manager_update_devices (ClutterDeviceManager *device_manager);
CLUTTER_EXPORT
void _clutter_device_manager_select_stage_events (ClutterDeviceManager *device_manager,
ClutterStage *stage);
ClutterBackend *_clutter_device_manager_get_backend (ClutterDeviceManager *device_manager);
void _clutter_device_manager_compress_motion (ClutterDeviceManager *device_manger,
ClutterEvent *event,
const ClutterEvent *to_discard);
CLUTTER_EXPORT
void clutter_device_manager_ensure_a11y_state (ClutterDeviceManager *device_manager);
/* input device */
CLUTTER_EXPORT
gboolean _clutter_input_device_has_sequence (ClutterInputDevice *device,
ClutterEventSequence *sequence);
CLUTTER_EXPORT
void _clutter_input_device_add_event_sequence (ClutterInputDevice *device,
ClutterEvent *event);
CLUTTER_EXPORT
void _clutter_input_device_remove_event_sequence (ClutterInputDevice *device,
ClutterEvent *event);
CLUTTER_EXPORT
void _clutter_input_device_set_coords (ClutterInputDevice *device,
ClutterEventSequence *sequence,
gfloat x,
gfloat y,
ClutterStage *stage);
CLUTTER_EXPORT
void _clutter_input_device_set_state (ClutterInputDevice *device,
ClutterModifierType state);
CLUTTER_EXPORT
void _clutter_input_device_set_time (ClutterInputDevice *device,
guint32 time_);
CLUTTER_EXPORT
void _clutter_input_device_set_stage (ClutterInputDevice *device,
ClutterStage *stage);
CLUTTER_EXPORT
ClutterStage * _clutter_input_device_get_stage (ClutterInputDevice *device);
void _clutter_input_device_set_actor (ClutterInputDevice *device,
ClutterEventSequence *sequence,
ClutterActor *actor,
gboolean emit_crossing);
ClutterActor * _clutter_input_device_update (ClutterInputDevice *device,
ClutterEventSequence *sequence,
gboolean emit_crossing);
CLUTTER_EXPORT
void _clutter_input_device_set_n_keys (ClutterInputDevice *device,
guint n_keys);
CLUTTER_EXPORT
guint _clutter_input_device_add_axis (ClutterInputDevice *device,
ClutterInputAxis axis,
gdouble min_value,
gdouble max_value,
gdouble resolution);
CLUTTER_EXPORT
void _clutter_input_device_reset_axes (ClutterInputDevice *device);
CLUTTER_EXPORT
void _clutter_input_device_set_associated_device (ClutterInputDevice *device,
ClutterInputDevice *associated);
CLUTTER_EXPORT
void _clutter_input_device_add_slave (ClutterInputDevice *master,
ClutterInputDevice *slave);
CLUTTER_EXPORT
void _clutter_input_device_remove_slave (ClutterInputDevice *master,
ClutterInputDevice *slave);
CLUTTER_EXPORT
gboolean _clutter_input_device_translate_axis (ClutterInputDevice *device,
guint index_,
gdouble value,
gdouble *axis_value);
CLUTTER_EXPORT
void _clutter_input_device_add_scroll_info (ClutterInputDevice *device,
guint index_,
ClutterScrollDirection direction,
gdouble increment);
CLUTTER_EXPORT
void _clutter_input_device_reset_scroll_info (ClutterInputDevice *device);
CLUTTER_EXPORT
gboolean _clutter_input_device_get_scroll_delta (ClutterInputDevice *device,
guint index_,
gdouble value,
ClutterScrollDirection *direction_p,
gdouble *delta_p);
CLUTTER_EXPORT
ClutterInputDeviceTool * clutter_input_device_lookup_tool (ClutterInputDevice *device,
guint64 serial,
ClutterInputDeviceToolType type);
CLUTTER_EXPORT
void clutter_input_device_add_tool (ClutterInputDevice *device,
ClutterInputDeviceTool *tool);
CLUTTER_EXPORT
void clutter_input_device_update_from_tool (ClutterInputDevice *device,
ClutterInputDeviceTool *tool);
G_END_DECLS
#endif /* __CLUTTER_DEVICE_MANAGER_PRIVATE_H__ */

View File

@@ -0,0 +1,753 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2009 Intel Corp.
*
* 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/>.
*
* Author: Emmanuele Bassi <ebassi@linux.intel.com>
*/
/**
* SECTION:clutter-device-manager
* @short_description: Maintains the list of input devices
*
* #ClutterDeviceManager is a singleton object, owned by Clutter, which
* maintains the list of #ClutterInputDevice<!-- -->s.
*
* Depending on the backend used by Clutter it is possible to use the
* #ClutterDeviceManager::device-added and
* #ClutterDeviceManager::device-removed to monitor addition and removal
* of devices.
*
* #ClutterDeviceManager is available since Clutter 1.2
*/
#include "clutter-build-config.h"
#include "clutter-backend-private.h"
#include "clutter-debug.h"
#include "clutter-device-manager-private.h"
#include "clutter-enum-types.h"
#include "clutter-marshal.h"
#include "clutter-private.h"
#include "clutter-stage-private.h"
#include "clutter-virtual-input-device.h"
#include "clutter-input-device-tool.h"
#include "clutter-input-pointer-a11y-private.h"
struct _ClutterDeviceManagerPrivate
{
/* back-pointer to the backend */
ClutterBackend *backend;
/* Keyboard a11y */
ClutterKbdA11ySettings kbd_a11y_settings;
/* Pointer a11y */
ClutterPointerA11ySettings pointer_a11y_settings;
};
enum
{
PROP_0,
PROP_BACKEND,
PROP_LAST
};
static GParamSpec *obj_props[PROP_LAST];
enum
{
DEVICE_ADDED,
DEVICE_REMOVED,
TOOL_CHANGED,
KBD_A11Y_MASK_CHANGED,
KBD_A11Y_FLAGS_CHANGED,
PTR_A11Y_DWELL_CLICK_TYPE_CHANGED,
PTR_A11Y_TIMEOUT_STARTED,
PTR_A11Y_TIMEOUT_STOPPED,
LAST_SIGNAL
};
static guint manager_signals[LAST_SIGNAL] = { 0, };
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterDeviceManager,
clutter_device_manager,
G_TYPE_OBJECT)
static void
clutter_device_manager_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterDeviceManager *self = CLUTTER_DEVICE_MANAGER (gobject);
ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (self);
switch (prop_id)
{
case PROP_BACKEND:
priv->backend = g_value_get_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
}
}
static void
clutter_device_manager_get_property (GObject *gobject,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ClutterDeviceManager *self = CLUTTER_DEVICE_MANAGER (gobject);
ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (self);
switch (prop_id)
{
case PROP_BACKEND:
g_value_set_object (value, priv->backend);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
}
}
static void
clutter_device_manager_class_init (ClutterDeviceManagerClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
obj_props[PROP_BACKEND] =
g_param_spec_object ("backend",
P_("Backend"),
P_("The ClutterBackend of the device manager"),
CLUTTER_TYPE_BACKEND,
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
gobject_class->set_property = clutter_device_manager_set_property;
gobject_class->get_property = clutter_device_manager_get_property;
g_object_class_install_properties (gobject_class,
PROP_LAST,
obj_props);
/**
* ClutterDeviceManager::device-added:
* @manager: the #ClutterDeviceManager that emitted the signal
* @device: the newly added #ClutterInputDevice
*
* The ::device-added signal is emitted each time a device has been
* added to the #ClutterDeviceManager
*
* Since: 1.2
*/
manager_signals[DEVICE_ADDED] =
g_signal_new (I_("device-added"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 1,
CLUTTER_TYPE_INPUT_DEVICE);
/**
* ClutterDeviceManager::device-removed:
* @manager: the #ClutterDeviceManager that emitted the signal
* @device: the removed #ClutterInputDevice
*
* The ::device-removed signal is emitted each time a device has been
* removed from the #ClutterDeviceManager
*
* Since: 1.2
*/
manager_signals[DEVICE_REMOVED] =
g_signal_new (I_("device-removed"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 1,
CLUTTER_TYPE_INPUT_DEVICE);
manager_signals[TOOL_CHANGED] =
g_signal_new (I_("tool-changed"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
_clutter_marshal_VOID__OBJECT_OBJECT,
G_TYPE_NONE, 2,
CLUTTER_TYPE_INPUT_DEVICE,
CLUTTER_TYPE_INPUT_DEVICE_TOOL);
/**
* ClutterDeviceManager::kbd-a11y-mods-state-changed:
* @manager: the #ClutterDeviceManager that emitted the signal
* @latched_mask: the latched modifier mask from stickykeys
* @locked_mask: the locked modifier mask from stickykeys
*
* The ::kbd-a11y-mods-state-changed signal is emitted each time either the
* latched modifiers mask or locked modifiers mask are changed as the
* result of keyboard accessibilty's sticky keys operations.
*/
manager_signals[KBD_A11Y_MASK_CHANGED] =
g_signal_new (I_("kbd-a11y-mods-state-changed"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
_clutter_marshal_VOID__UINT_UINT,
G_TYPE_NONE, 2,
G_TYPE_UINT,
G_TYPE_UINT);
/**
* ClutterDeviceManager::kbd-a11y-flags-changed:
* @manager: the #ClutterDeviceManager that emitted the signal
* @settings_flags: the new ClutterKeyboardA11yFlags configuration
* @changed_mask: the ClutterKeyboardA11yFlags changed
*
* The ::kbd-a11y-flags-changed signal is emitted each time the
* ClutterKeyboardA11yFlags configuration is changed as the result of
* keyboard accessibilty operations.
*/
manager_signals[KBD_A11Y_FLAGS_CHANGED] =
g_signal_new (I_("kbd-a11y-flags-changed"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
_clutter_marshal_VOID__UINT_UINT,
G_TYPE_NONE, 2,
G_TYPE_UINT,
G_TYPE_UINT);
/**
* ClutterDeviceManager::ptr-a11y-dwell-click-type-changed:
* @manager: the #ClutterDeviceManager that emitted the signal
* @click_type: the new #ClutterPointerA11yDwellClickType mode
*
* The ::ptr-a11y-dwell-click-type-changed signal is emitted each time
* the ClutterPointerA11yDwellClickType mode is changed as the result
* of pointer accessibility operations.
*/
manager_signals[PTR_A11Y_DWELL_CLICK_TYPE_CHANGED] =
g_signal_new (I_("ptr-a11y-dwell-click-type-changed"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
g_cclosure_marshal_VOID__FLAGS,
G_TYPE_NONE, 1,
CLUTTER_TYPE_POINTER_A11Y_DWELL_CLICK_TYPE);
/**
* ClutterDeviceManager::ptr-a11y-timeout-started:
* @manager: the #ClutterDeviceManager that emitted the signal
* @device: the core pointer #ClutterInputDevice
* @timeout_type: the type of timeout #ClutterPointerA11yTimeoutType
* @delay: the delay in ms before secondary-click is triggered.
*
* The ::ptr-a11y-timeout-started signal is emitted when a
* pointer accessibility timeout delay is started, so that upper
* layers can notify the user with some visual feedback.
*/
manager_signals[PTR_A11Y_TIMEOUT_STARTED] =
g_signal_new (I_("ptr-a11y-timeout-started"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
_clutter_marshal_VOID__OBJECT_FLAGS_UINT,
G_TYPE_NONE, 3,
CLUTTER_TYPE_INPUT_DEVICE,
CLUTTER_TYPE_POINTER_A11Y_TIMEOUT_TYPE,
G_TYPE_UINT);
/**
* ClutterDeviceManager::ptr-a11y-timeout-stopped:
* @manager: the #ClutterDeviceManager that emitted the signal
* @device: the core pointer #ClutterInputDevice
* @timeout_type: the type of timeout #ClutterPointerA11yTimeoutType
* @clicked: %TRUE if the timeout finished and triggered a click
*
* The ::ptr-a11y-timeout-stopped signal is emitted when a running
* pointer accessibility timeout delay is stopped, either because
* it's triggered at the end of the delay or cancelled, so that
* upper layers can notify the user with some visual feedback.
*/
manager_signals[PTR_A11Y_TIMEOUT_STOPPED] =
g_signal_new (I_("ptr-a11y-timeout-stopped"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
_clutter_marshal_VOID__OBJECT_FLAGS_BOOLEAN,
G_TYPE_NONE, 3,
CLUTTER_TYPE_INPUT_DEVICE,
CLUTTER_TYPE_POINTER_A11Y_TIMEOUT_TYPE,
G_TYPE_BOOLEAN);
}
static void
clutter_device_manager_init (ClutterDeviceManager *self)
{
}
/**
* clutter_device_manager_get_default:
*
* Retrieves the device manager singleton
*
* Return value: (transfer none): the #ClutterDeviceManager singleton.
* The returned instance is owned by Clutter and it should not be
* modified or freed
*
* Since: 1.2
*/
ClutterDeviceManager *
clutter_device_manager_get_default (void)
{
ClutterBackend *backend = clutter_get_default_backend ();
return CLUTTER_BACKEND_GET_CLASS (backend)->get_device_manager (backend);
}
/**
* clutter_device_manager_list_devices:
* @device_manager: a #ClutterDeviceManager
*
* Lists all currently registered input devices
*
* Return value: (transfer container) (element-type Clutter.InputDevice):
* a newly allocated list of #ClutterInputDevice objects. Use
* g_slist_free() to deallocate it when done
*
* Since: 1.2
*/
GSList *
clutter_device_manager_list_devices (ClutterDeviceManager *device_manager)
{
const GSList *devices;
g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager), NULL);
devices = clutter_device_manager_peek_devices (device_manager);
return g_slist_copy ((GSList *) devices);
}
/**
* clutter_device_manager_peek_devices:
* @device_manager: a #ClutterDeviceManager
*
* Lists all currently registered input devices
*
* Return value: (transfer none) (element-type Clutter.InputDevice):
* a pointer to the internal list of #ClutterInputDevice objects. The
* returned list is owned by the #ClutterDeviceManager and should never
* be modified or freed
*
* Since: 1.2
*/
const GSList *
clutter_device_manager_peek_devices (ClutterDeviceManager *device_manager)
{
ClutterDeviceManagerClass *manager_class;
g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager), NULL);
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
return manager_class->get_devices (device_manager);
}
/**
* clutter_device_manager_get_device:
* @device_manager: a #ClutterDeviceManager
* @device_id: the integer id of a device
*
* Retrieves the #ClutterInputDevice with the given @device_id
*
* Return value: (transfer none): a #ClutterInputDevice or %NULL. The
* returned device is owned by the #ClutterDeviceManager and should
* never be modified or freed
*
* Since: 1.2
*/
ClutterInputDevice *
clutter_device_manager_get_device (ClutterDeviceManager *device_manager,
gint device_id)
{
ClutterDeviceManagerClass *manager_class;
g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager), NULL);
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
return manager_class->get_device (device_manager, device_id);
}
/**
* clutter_device_manager_get_core_device:
* @device_manager: a #ClutterDeviceManager
* @device_type: the type of the core device
*
* Retrieves the core #ClutterInputDevice of type @device_type
*
* Core devices are devices created automatically by the default
* Clutter backend
*
* Return value: (transfer none): a #ClutterInputDevice or %NULL. The
* returned device is owned by the #ClutterDeviceManager and should
* not be modified or freed
*
* Since: 1.2
*/
ClutterInputDevice *
clutter_device_manager_get_core_device (ClutterDeviceManager *device_manager,
ClutterInputDeviceType device_type)
{
ClutterDeviceManagerClass *manager_class;
g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager), NULL);
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
return manager_class->get_core_device (device_manager, device_type);
}
void
_clutter_device_manager_select_stage_events (ClutterDeviceManager *device_manager,
ClutterStage *stage)
{
ClutterDeviceManagerClass *manager_class;
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
if (manager_class->select_stage_events)
manager_class->select_stage_events (device_manager, stage);
}
/*
* _clutter_device_manager_add_device:
* @device_manager: a #ClutterDeviceManager
* @device: a #ClutterInputDevice
*
* Adds @device to the list of #ClutterInputDevice<!-- -->s maintained
* by @device_manager
*
* The reference count of @device is not increased
*
* The #ClutterDeviceManager::device-added signal is emitted after
* adding @device to the list
*/
void
_clutter_device_manager_add_device (ClutterDeviceManager *device_manager,
ClutterInputDevice *device)
{
ClutterDeviceManagerClass *manager_class;
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
g_assert (manager_class->add_device != NULL);
manager_class->add_device (device_manager, device);
g_signal_emit (device_manager, manager_signals[DEVICE_ADDED], 0, device);
}
/*
* _clutter_device_manager_remove_device:
* @device_manager: a #ClutterDeviceManager
* @device: a #ClutterInputDevice
*
* Removes @device from the list of #ClutterInputDevice<!-- -->s
* maintained by @device_manager
*
* The reference count of @device is not decreased
*
* The #ClutterDeviceManager::device-removed signal is emitted after
* removing @device from the list
*/
void
_clutter_device_manager_remove_device (ClutterDeviceManager *device_manager,
ClutterInputDevice *device)
{
ClutterDeviceManagerClass *manager_class;
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
g_assert (manager_class->remove_device != NULL);
/* The subclass remove_device() method will likely unref it but we
have to keep it alive during the signal emission. */
g_object_ref (device);
manager_class->remove_device (device_manager, device);
g_signal_emit (device_manager, manager_signals[DEVICE_REMOVED], 0, device);
g_object_unref (device);
}
/*
* _clutter_device_manager_update_devices:
* @device_manager: a #ClutterDeviceManager
*
* Updates every #ClutterInputDevice handled by @device_manager
* by performing a pick paint at the coordinates of each pointer
* device
*/
void
_clutter_device_manager_update_devices (ClutterDeviceManager *device_manager)
{
const GSList *d;
for (d = clutter_device_manager_peek_devices (device_manager);
d != NULL;
d = d->next)
{
ClutterInputDevice *device = d->data;
ClutterInputDeviceType device_type;
/* we only care about pointer devices */
device_type = clutter_input_device_get_device_type (device);
if (device_type != CLUTTER_POINTER_DEVICE)
continue;
/* out of stage */
if (device->stage == NULL)
continue;
/* the user disabled motion events delivery on actors for
* the stage the device is on; we don't perform any picking
* since the source of the events will always be set to be
* the stage
*/
if (!clutter_stage_get_motion_events_enabled (device->stage))
continue;
_clutter_input_device_update (device, NULL, TRUE);
}
}
ClutterBackend *
_clutter_device_manager_get_backend (ClutterDeviceManager *manager)
{
ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (manager);
g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER (manager), NULL);
return priv->backend;
}
/**
* clutter_device_manager_create_virtual_device:
* @device_manager: a #ClutterDeviceManager
* @device_type: the type of the virtual device
*
* Creates a virtual input device.
*
* Returns: (transfer full): a newly created virtual device
**/
ClutterVirtualInputDevice *
clutter_device_manager_create_virtual_device (ClutterDeviceManager *device_manager,
ClutterInputDeviceType device_type)
{
ClutterDeviceManagerClass *manager_class;
g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager), NULL);
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
return manager_class->create_virtual_device (device_manager,
device_type);
}
/**
* clutter_device_manager_supported_virtua_device_types: (skip)
*/
ClutterVirtualDeviceType
clutter_device_manager_get_supported_virtual_device_types (ClutterDeviceManager *device_manager)
{
ClutterDeviceManagerClass *manager_class;
g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager),
CLUTTER_VIRTUAL_DEVICE_TYPE_NONE);
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
return manager_class->get_supported_virtual_device_types (device_manager);
}
void
_clutter_device_manager_compress_motion (ClutterDeviceManager *device_manager,
ClutterEvent *event,
const ClutterEvent *to_discard)
{
ClutterDeviceManagerClass *manager_class;
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
if (!manager_class->compress_motion)
return;
manager_class->compress_motion (device_manager, event, to_discard);
}
void
clutter_device_manager_ensure_a11y_state (ClutterDeviceManager *device_manager)
{
ClutterInputDevice *core_pointer;
core_pointer = clutter_device_manager_get_core_device (device_manager,
CLUTTER_POINTER_DEVICE);
if (core_pointer)
{
if (_clutter_is_input_pointer_a11y_enabled (core_pointer))
_clutter_input_pointer_a11y_add_device (core_pointer);
}
}
static gboolean
are_kbd_a11y_settings_equal (ClutterKbdA11ySettings *a,
ClutterKbdA11ySettings *b)
{
return (memcmp (a, b, sizeof (ClutterKbdA11ySettings)) == 0);
}
void
clutter_device_manager_set_kbd_a11y_settings (ClutterDeviceManager *device_manager,
ClutterKbdA11ySettings *settings)
{
ClutterDeviceManagerClass *manager_class;
ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (device_manager);
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
if (are_kbd_a11y_settings_equal (&priv->kbd_a11y_settings, settings))
return;
priv->kbd_a11y_settings = *settings;
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
if (manager_class->apply_kbd_a11y_settings)
manager_class->apply_kbd_a11y_settings (device_manager, settings);
}
void
clutter_device_manager_get_kbd_a11y_settings (ClutterDeviceManager *device_manager,
ClutterKbdA11ySettings *settings)
{
ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (device_manager);
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
*settings = priv->kbd_a11y_settings;
}
static gboolean
are_pointer_a11y_settings_equal (ClutterPointerA11ySettings *a,
ClutterPointerA11ySettings *b)
{
return (memcmp (a, b, sizeof (ClutterPointerA11ySettings)) == 0);
}
static void
clutter_device_manager_enable_pointer_a11y (ClutterDeviceManager *device_manager)
{
ClutterInputDevice *core_pointer;
core_pointer = clutter_device_manager_get_core_device (device_manager,
CLUTTER_POINTER_DEVICE);
_clutter_input_pointer_a11y_add_device (core_pointer);
}
static void
clutter_device_manager_disable_pointer_a11y (ClutterDeviceManager *device_manager)
{
ClutterInputDevice *core_pointer;
core_pointer = clutter_device_manager_get_core_device (device_manager,
CLUTTER_POINTER_DEVICE);
_clutter_input_pointer_a11y_remove_device (core_pointer);
}
/**
* clutter_device_manager_set_pointer_a11y_settings:
* @device_manager: a #ClutterDeviceManager
* @settings: a pointer to a #ClutterPointerA11ySettings
*
* Sets the pointer accessibility settings
**/
void
clutter_device_manager_set_pointer_a11y_settings (ClutterDeviceManager *device_manager,
ClutterPointerA11ySettings *settings)
{
ClutterDeviceManagerPrivate *priv =
clutter_device_manager_get_instance_private (device_manager);
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
if (are_pointer_a11y_settings_equal (&priv->pointer_a11y_settings, settings))
return;
if (priv->pointer_a11y_settings.controls == 0 && settings->controls != 0)
clutter_device_manager_enable_pointer_a11y (device_manager);
else if (priv->pointer_a11y_settings.controls != 0 && settings->controls == 0)
clutter_device_manager_disable_pointer_a11y (device_manager);
priv->pointer_a11y_settings = *settings;
}
/**
* clutter_device_manager_get_pointer_a11y_settings:
* @device_manager: a #ClutterDeviceManager
* @settings: a pointer to a #ClutterPointerA11ySettings
*
* Gets the current pointer accessibility settings
**/
void
clutter_device_manager_get_pointer_a11y_settings (ClutterDeviceManager *device_manager,
ClutterPointerA11ySettings *settings)
{
ClutterDeviceManagerPrivate *priv =
clutter_device_manager_get_instance_private (device_manager);
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
*settings = priv->pointer_a11y_settings;
}
/**
* clutter_device_manager_set_pointer_a11y_dwell_click_type:
* @device_manager: a #ClutterDeviceManager
* @click_type: type of click as #ClutterPointerA11yDwellClickType
*
* Sets the dwell click type
**/
void
clutter_device_manager_set_pointer_a11y_dwell_click_type (ClutterDeviceManager *device_manager,
ClutterPointerA11yDwellClickType click_type)
{
ClutterDeviceManagerPrivate *priv =
clutter_device_manager_get_instance_private (device_manager);
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
priv->pointer_a11y_settings.dwell_click_type = click_type;
}

View File

@@ -0,0 +1,181 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2009 Intel Corp.
*
* 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/>.
*
* Author: Emmanuele Bassi <ebassi@linux.intel.com>
*/
#ifndef __CLUTTER_DEVICE_MANAGER_H__
#define __CLUTTER_DEVICE_MANAGER_H__
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#include <clutter/clutter-input-device.h>
#include <clutter/clutter-stage.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_DEVICE_MANAGER (clutter_device_manager_get_type ())
CLUTTER_EXPORT
G_DECLARE_DERIVABLE_TYPE (ClutterDeviceManager, clutter_device_manager,
CLUTTER, DEVICE_MANAGER, GObject)
typedef struct _ClutterDeviceManagerPrivate ClutterDeviceManagerPrivate;
/**
* ClutterVirtualDeviceType:
*/
typedef enum _ClutterVirtualDeviceType
{
CLUTTER_VIRTUAL_DEVICE_TYPE_NONE = 0,
CLUTTER_VIRTUAL_DEVICE_TYPE_KEYBOARD = 1 << 0,
CLUTTER_VIRTUAL_DEVICE_TYPE_POINTER = 1 << 1,
CLUTTER_VIRTUAL_DEVICE_TYPE_TOUCHSCREEN = 1 << 2,
} ClutterVirtualDeviceType;
/**
* ClutterKbdA11ySettings:
*
* The #ClutterKbdA11ySettings structure contains keyboard accessibility
* settings
*
*/
typedef struct _ClutterKbdA11ySettings
{
ClutterKeyboardA11yFlags controls;
gint slowkeys_delay;
gint debounce_delay;
gint timeout_delay;
gint mousekeys_init_delay;
gint mousekeys_max_speed;
gint mousekeys_accel_time;
} ClutterKbdA11ySettings;
/**
* ClutterPointerA11ySettings:
*
* The #ClutterPointerA11ySettings structure contains pointer accessibility
* settings
*
*/
typedef struct _ClutterPointerA11ySettings
{
ClutterPointerA11yFlags controls;
ClutterPointerA11yDwellClickType dwell_click_type;
ClutterPointerA11yDwellMode dwell_mode;
ClutterPointerA11yDwellDirection dwell_gesture_single;
ClutterPointerA11yDwellDirection dwell_gesture_double;
ClutterPointerA11yDwellDirection dwell_gesture_drag;
ClutterPointerA11yDwellDirection dwell_gesture_secondary;
gint secondary_click_delay;
gint dwell_delay;
gint dwell_threshold;
} ClutterPointerA11ySettings;
/**
* ClutterDeviceManagerClass:
*
* The #ClutterDeviceManagerClass structure contains only private data
*
* Since: 1.2
*/
struct _ClutterDeviceManagerClass
{
/*< private >*/
GObjectClass parent_class;
const GSList * (* get_devices) (ClutterDeviceManager *device_manager);
ClutterInputDevice *(* get_core_device) (ClutterDeviceManager *device_manager,
ClutterInputDeviceType device_type);
ClutterInputDevice *(* get_device) (ClutterDeviceManager *device_manager,
gint device_id);
void (* add_device) (ClutterDeviceManager *manager,
ClutterInputDevice *device);
void (* remove_device) (ClutterDeviceManager *manager,
ClutterInputDevice *device);
void (* select_stage_events) (ClutterDeviceManager *manager,
ClutterStage *stage);
ClutterVirtualInputDevice *(* create_virtual_device) (ClutterDeviceManager *device_manager,
ClutterInputDeviceType device_type);
ClutterVirtualDeviceType (* get_supported_virtual_device_types) (ClutterDeviceManager *device_manager);
void (* compress_motion) (ClutterDeviceManager *device_manger,
ClutterEvent *event,
const ClutterEvent *to_discard);
/* Keyboard accessbility */
void (* apply_kbd_a11y_settings) (ClutterDeviceManager *device_manger,
ClutterKbdA11ySettings *settings);
/* Event platform data */
void (* copy_event_data) (ClutterDeviceManager *device_manager,
const ClutterEvent *src,
ClutterEvent *dest);
void (* free_event_data) (ClutterDeviceManager *device_manager,
ClutterEvent *event);
/* padding */
gpointer _padding[4];
};
CLUTTER_EXPORT
ClutterDeviceManager *clutter_device_manager_get_default (void);
CLUTTER_EXPORT
GSList * clutter_device_manager_list_devices (ClutterDeviceManager *device_manager);
CLUTTER_EXPORT
const GSList * clutter_device_manager_peek_devices (ClutterDeviceManager *device_manager);
CLUTTER_EXPORT
ClutterInputDevice * clutter_device_manager_get_device (ClutterDeviceManager *device_manager,
gint device_id);
CLUTTER_EXPORT
ClutterInputDevice * clutter_device_manager_get_core_device (ClutterDeviceManager *device_manager,
ClutterInputDeviceType device_type);
CLUTTER_EXPORT
ClutterVirtualInputDevice *clutter_device_manager_create_virtual_device (ClutterDeviceManager *device_manager,
ClutterInputDeviceType device_type);
CLUTTER_EXPORT
ClutterVirtualDeviceType clutter_device_manager_get_supported_virtual_device_types (ClutterDeviceManager *device_manager);
CLUTTER_EXPORT
void clutter_device_manager_set_kbd_a11y_settings (ClutterDeviceManager *device_manager,
ClutterKbdA11ySettings *settings);
CLUTTER_EXPORT
void clutter_device_manager_get_kbd_a11y_settings (ClutterDeviceManager *device_manager,
ClutterKbdA11ySettings *settings);
CLUTTER_EXPORT
void clutter_device_manager_set_pointer_a11y_settings (ClutterDeviceManager *device_manager,
ClutterPointerA11ySettings *settings);
CLUTTER_EXPORT
void clutter_device_manager_get_pointer_a11y_settings (ClutterDeviceManager *device_manager,
ClutterPointerA11ySettings *settings);
CLUTTER_EXPORT
void clutter_device_manager_set_pointer_a11y_dwell_click_type (ClutterDeviceManager *device_manager,
ClutterPointerA11yDwellClickType click_type);
G_END_DECLS
#endif /* __CLUTTER_DEVICE_MANAGER_H__ */

View File

@@ -315,7 +315,11 @@ emit_drag_end (ClutterDragAction *action,
goto out;
/* disconnect the capture */
g_clear_signal_handler (&priv->capture_id, priv->stage);
if (priv->capture_id != 0)
{
g_signal_handler_disconnect (priv->stage, priv->capture_id);
priv->capture_id = 0;
}
clutter_stage_set_motion_events_enabled (priv->stage,
priv->motion_events_enabled);
@@ -474,8 +478,8 @@ clutter_drag_action_set_actor (ClutterActorMeta *meta,
old_actor = clutter_actor_meta_get_actor (meta);
if (old_actor != NULL)
{
g_clear_signal_handler (&priv->button_press_id, old_actor);
g_clear_signal_handler (&priv->touch_begin_id, old_actor);
g_signal_handler_disconnect (old_actor, priv->button_press_id);
g_signal_handler_disconnect (old_actor, priv->touch_begin_id);
}
priv->button_press_id = 0;
@@ -485,7 +489,7 @@ clutter_drag_action_set_actor (ClutterActorMeta *meta,
if (priv->capture_id != 0)
{
if (priv->stage != NULL)
g_clear_signal_handler (&priv->capture_id, priv->stage);
g_signal_handler_disconnect (priv->stage, priv->capture_id);
priv->capture_id = 0;
priv->stage = NULL;
@@ -664,7 +668,7 @@ clutter_drag_action_dispose (GObject *gobject)
priv->motion_events_enabled);
if (priv->stage != NULL)
g_clear_signal_handler (&priv->capture_id, priv->stage);
g_signal_handler_disconnect (priv->stage, priv->capture_id);
priv->capture_id = 0;
priv->stage = NULL;
@@ -677,8 +681,8 @@ clutter_drag_action_dispose (GObject *gobject)
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (gobject));
if (actor != NULL)
{
g_clear_signal_handler (&priv->button_press_id, actor);
g_clear_signal_handler (&priv->touch_begin_id, actor);
g_signal_handler_disconnect (actor, priv->button_press_id);
g_signal_handler_disconnect (actor, priv->touch_begin_id);
}
priv->button_press_id = 0;

View File

@@ -107,7 +107,7 @@ drop_target_free (gpointer _data)
{
DropTarget *data = _data;
g_clear_signal_handler (&data->capture_id, data->stage);
g_signal_handler_disconnect (data->stage, data->capture_id);
g_hash_table_destroy (data->actions);
g_free (data);
}
@@ -326,10 +326,12 @@ clutter_drop_action_set_actor (ClutterActorMeta *meta,
{
drop_action_unregister (CLUTTER_DROP_ACTION (meta));
g_clear_signal_handler (&priv->mapped_id, priv->actor);
if (priv->mapped_id != 0)
g_signal_handler_disconnect (priv->actor, priv->mapped_id);
priv->stage = NULL;
priv->actor = NULL;
priv->mapped_id = 0;
}
priv->actor = actor;

View File

@@ -1183,6 +1183,29 @@ typedef enum /*< prefix=CLUTTER_PAN >*/
CLUTTER_PAN_AXIS_AUTO
} ClutterPanAxis;
/**
* ClutterTableAlignment:
* @CLUTTER_TABLE_ALIGNMENT_START: Align the child to the top or to the
* left of a cell in the table, depending on the axis
* @CLUTTER_TABLE_ALIGNMENT_CENTER: Align the child to the center of
* a cell in the table
* @CLUTTER_TABLE_ALIGNMENT_END: Align the child to the bottom or to the
* right of a cell in the table, depending on the axis
*
* The alignment policies available on each axis of the #ClutterTableLayout
*
* Since: 1.4
*
* Deprecated: 1.22: Use the alignment properties of #ClutterActor
*/
typedef enum
{
CLUTTER_TABLE_ALIGNMENT_START,
CLUTTER_TABLE_ALIGNMENT_CENTER,
CLUTTER_TABLE_ALIGNMENT_END
} ClutterTableAlignment;
/**
* ClutterTextureFlags:
* @CLUTTER_TEXTURE_NONE: No flags

View File

@@ -2161,9 +2161,9 @@ clutter_event_get_scroll_source (const ClutterEvent *event)
ClutterScrollFinishFlags
clutter_event_get_scroll_finish_flags (const ClutterEvent *event)
{
g_return_val_if_fail (event != NULL, CLUTTER_SCROLL_FINISHED_NONE);
g_return_val_if_fail (event != NULL, CLUTTER_SCROLL_SOURCE_UNKNOWN);
g_return_val_if_fail (event->type == CLUTTER_SCROLL,
CLUTTER_SCROLL_FINISHED_NONE);
CLUTTER_SCROLL_SOURCE_UNKNOWN);
return event->scroll.finish_flags;
}

View File

@@ -118,7 +118,7 @@ struct _ClutterGestureActionPrivate
gint requested_nb_points;
GArray *points;
gulong actor_capture_id;
guint actor_capture_id;
gulong stage_capture_id;
ClutterGestureTriggerEdge edge;
@@ -308,7 +308,11 @@ cancel_gesture (ClutterGestureAction *action)
priv->in_gesture = FALSE;
g_clear_signal_handler (&priv->stage_capture_id, priv->stage);
if (priv->stage_capture_id != 0)
{
g_signal_handler_disconnect (priv->stage, priv->stage_capture_id);
priv->stage_capture_id = 0;
}
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
g_signal_emit (action, gesture_signals[GESTURE_CANCEL], 0, actor);
@@ -477,8 +481,11 @@ stage_captured_event_cb (ClutterActor *stage,
break;
}
if (priv->points->len == 0)
g_clear_signal_handler (&priv->stage_capture_id, priv->stage);
if (priv->points->len == 0 && priv->stage_capture_id)
{
g_signal_handler_disconnect (priv->stage, priv->stage_capture_id);
priv->stage_capture_id = 0;
}
return CLUTTER_EVENT_PROPAGATE;
}
@@ -531,7 +538,7 @@ clutter_gesture_action_set_actor (ClutterActorMeta *meta,
ClutterActor *old_actor = clutter_actor_meta_get_actor (meta);
if (old_actor != NULL)
g_clear_signal_handler (&priv->actor_capture_id, old_actor);
g_signal_handler_disconnect (old_actor, priv->actor_capture_id);
priv->actor_capture_id = 0;
}
@@ -539,7 +546,7 @@ clutter_gesture_action_set_actor (ClutterActorMeta *meta,
if (priv->stage_capture_id != 0)
{
if (priv->stage != NULL)
g_clear_signal_handler (&priv->stage_capture_id, priv->stage);
g_signal_handler_disconnect (priv->stage, priv->stage_capture_id);
priv->stage_capture_id = 0;
priv->stage = NULL;

View File

@@ -44,12 +44,12 @@
* SECTION:clutter-grid-layout
* @Short_description: A layout manager for a grid of actors
* @Title: ClutterGridLayout
* @See_also: #ClutterBoxLayout
* @See_also: #ClutterTableLayout, #ClutterBoxLayout
*
* #ClutterGridLayout is a layout manager which arranges its child widgets in
* rows and columns. It is a very similar to #ClutterBoxLayout, but it
* consistently uses #ClutterActor's alignment and expansion flags instead of
* custom child properties.
* rows and columns. It is a very similar to #ClutterTableLayout and
* #ClutterBoxLayout, but it consistently uses #ClutterActor's
* alignment and expansion flags instead of custom child properties.
*
* Children are added using clutter_grid_layout_attach(). They can span
* multiple rows or columns. It is also possible to add a child next to an

View File

@@ -1,254 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright © 2009, 2010, 2011 Intel Corp.
*
* 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/>.
*
* Author: Emmanuele Bassi <ebassi@linux.intel.com>
*/
#ifndef CLUTTER_INPUT_DEVICE_PRIVATE_H
#define CLUTTER_INPUT_DEVICE_PRIVATE_H
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#include <clutter/clutter-input-device.h>
G_BEGIN_DECLS
typedef struct _ClutterAxisInfo
{
ClutterInputAxis axis;
gdouble min_axis;
gdouble max_axis;
gdouble min_value;
gdouble max_value;
gdouble resolution;
} ClutterAxisInfo;
typedef struct _ClutterKeyInfo
{
guint keyval;
ClutterModifierType modifiers;
} ClutterKeyInfo;
typedef struct _ClutterScrollInfo
{
guint axis_id;
ClutterScrollDirection direction;
gdouble increment;
gdouble last_value;
guint last_value_valid : 1;
} ClutterScrollInfo;
typedef struct _ClutterTouchInfo
{
ClutterEventSequence *sequence;
ClutterActor *actor;
gfloat current_x;
gfloat current_y;
} ClutterTouchInfo;
typedef struct _ClutterPtrA11yData
{
int n_btn_pressed;
float current_x;
float current_y;
float dwell_x;
float dwell_y;
gboolean dwell_drag_started;
gboolean dwell_gesture_started;
guint dwell_timer;
guint dwell_position_timer;
guint secondary_click_timer;
gboolean secondary_click_triggered;
} ClutterPtrA11yData;
struct _ClutterInputDevice
{
GObject parent_instance;
gint id;
ClutterInputDeviceType device_type;
ClutterInputMode device_mode;
gchar *device_name;
ClutterSeat *seat;
ClutterBackend *backend;
/* the associated device */
ClutterInputDevice *associated;
GList *slaves;
/* the actor underneath the pointer */
ClutterActor *cursor_actor;
GHashTable *inv_touch_sequence_actors;
/* the actor that has a grab in place for the device */
ClutterActor *pointer_grab_actor;
ClutterActor *keyboard_grab_actor;
GHashTable *sequence_grab_actors;
GHashTable *inv_sequence_grab_actors;
/* the current click count */
gint click_count;
/* the stage the device is on */
ClutterStage *stage;
/* the current state */
gfloat current_x;
gfloat current_y;
guint32 current_time;
gint current_button_number;
ClutterModifierType current_state;
/* the current touch points states */
GHashTable *touch_sequences_info;
/* the previous state, used for click count generation */
gint previous_x;
gint previous_y;
guint32 previous_time;
gint previous_button_number;
ClutterModifierType previous_state;
GArray *axes;
guint n_keys;
GArray *keys;
GArray *scroll_info;
gchar *vendor_id;
gchar *product_id;
gchar *node_path;
GPtrArray *tools;
gint n_rings;
gint n_strips;
gint n_mode_groups;
ClutterInputDeviceMapping mapping_mode;
guint has_cursor : 1;
guint is_enabled : 1;
/* Accessiblity */
ClutterVirtualInputDevice *accessibility_virtual_device;
ClutterPtrA11yData *ptr_a11y_data;
};
CLUTTER_EXPORT
void _clutter_input_device_set_associated_device (ClutterInputDevice *device,
ClutterInputDevice *associated);
CLUTTER_EXPORT
void _clutter_input_device_add_slave (ClutterInputDevice *master,
ClutterInputDevice *slave);
CLUTTER_EXPORT
void _clutter_input_device_remove_slave (ClutterInputDevice *master,
ClutterInputDevice *slave);
CLUTTER_EXPORT
void clutter_input_device_update_from_tool (ClutterInputDevice *device,
ClutterInputDeviceTool *tool);
CLUTTER_EXPORT
ClutterStage * _clutter_input_device_get_stage (ClutterInputDevice *device);
CLUTTER_EXPORT
void _clutter_input_device_set_stage (ClutterInputDevice *device,
ClutterStage *stage);
CLUTTER_EXPORT
void _clutter_input_device_set_coords (ClutterInputDevice *device,
ClutterEventSequence *sequence,
gfloat x,
gfloat y,
ClutterStage *stage);
CLUTTER_EXPORT
void _clutter_input_device_set_state (ClutterInputDevice *device,
ClutterModifierType state);
CLUTTER_EXPORT
void _clutter_input_device_set_time (ClutterInputDevice *device,
guint32 time_);
void _clutter_input_device_set_actor (ClutterInputDevice *device,
ClutterEventSequence *sequence,
ClutterActor *actor,
gboolean emit_crossing);
ClutterActor * _clutter_input_device_update (ClutterInputDevice *device,
ClutterEventSequence *sequence,
gboolean emit_crossing);
CLUTTER_EXPORT
void _clutter_input_device_add_event_sequence (ClutterInputDevice *device,
ClutterEvent *event);
CLUTTER_EXPORT
void _clutter_input_device_remove_event_sequence (ClutterInputDevice *device,
ClutterEvent *event);
CLUTTER_EXPORT
void _clutter_input_device_set_n_keys (ClutterInputDevice *device,
guint n_keys);
CLUTTER_EXPORT
gboolean _clutter_input_device_translate_axis (ClutterInputDevice *device,
guint index_,
gdouble value,
gdouble *axis_value);
CLUTTER_EXPORT
guint _clutter_input_device_add_axis (ClutterInputDevice *device,
ClutterInputAxis axis,
gdouble minimum,
gdouble maximum,
gdouble resolution);
CLUTTER_EXPORT
void _clutter_input_device_reset_axes (ClutterInputDevice *device);
CLUTTER_EXPORT
void _clutter_input_device_add_scroll_info (ClutterInputDevice *device,
guint index_,
ClutterScrollDirection direction,
gdouble increment);
CLUTTER_EXPORT
gboolean _clutter_input_device_get_scroll_delta (ClutterInputDevice *device,
guint index_,
gdouble value,
ClutterScrollDirection *direction_p,
gdouble *delta_p);
CLUTTER_EXPORT
void _clutter_input_device_reset_scroll_info (ClutterInputDevice *device);
CLUTTER_EXPORT
void clutter_input_device_add_tool (ClutterInputDevice *device,
ClutterInputDeviceTool *tool);
CLUTTER_EXPORT
ClutterInputDeviceTool *
clutter_input_device_lookup_tool (ClutterInputDevice *device,
guint64 serial,
ClutterInputDeviceToolType type);
#endif /* CLUTTER_INPUT_DEVICE_PRIVATE_H */

View File

@@ -37,12 +37,12 @@
#include "clutter-actor-private.h"
#include "clutter-debug.h"
#include "clutter-device-manager-private.h"
#include "clutter-enum-types.h"
#include "clutter-event-private.h"
#include "clutter-marshal.h"
#include "clutter-private.h"
#include "clutter-stage-private.h"
#include "clutter-input-device-private.h"
#include "clutter-input-device-tool.h"
#include <math.h>
@@ -57,7 +57,7 @@ enum
PROP_NAME,
PROP_DEVICE_TYPE,
PROP_SEAT,
PROP_DEVICE_MANAGER,
PROP_DEVICE_MODE,
PROP_HAS_CURSOR,
@@ -170,8 +170,8 @@ clutter_input_device_set_property (GObject *gobject,
self->device_type = g_value_get_enum (value);
break;
case PROP_SEAT:
self->seat = g_value_get_object (value);
case PROP_DEVICE_MANAGER:
self->device_manager = g_value_get_object (value);
break;
case PROP_DEVICE_MODE:
@@ -246,8 +246,8 @@ clutter_input_device_get_property (GObject *gobject,
g_value_set_enum (value, self->device_type);
break;
case PROP_SEAT:
g_value_set_object (value, self->seat);
case PROP_DEVICE_MANAGER:
g_value_set_object (value, self->device_manager);
break;
case PROP_DEVICE_MODE:
@@ -361,15 +361,17 @@ clutter_input_device_class_init (ClutterInputDeviceClass *klass)
G_PARAM_CONSTRUCT_ONLY);
/**
* ClutterInputDevice:seat:
* ClutterInputDevice:device-manager:
*
* The #ClutterSeat instance which owns the device
* The #ClutterDeviceManager instance which owns the device
*
* Since: 1.6
*/
obj_props[PROP_SEAT] =
g_param_spec_object ("seat",
P_("Seat"),
P_("Seat"),
CLUTTER_TYPE_SEAT,
obj_props[PROP_DEVICE_MANAGER] =
g_param_spec_object ("device-manager",
P_("Device Manager"),
P_("The device manager instance"),
CLUTTER_TYPE_DEVICE_MANAGER,
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
/**
@@ -1222,11 +1224,11 @@ clutter_input_device_get_device_mode (ClutterInputDevice *device)
*
* translate_native_event_to_clutter (native_event, &c_event);
*
* // get the seat
* seat = clutter_backend_get_deafult_seat (clutter_get_default_backend ());
* // get the device manager
* manager = clutter_device_manager_get_default ();
*
* // use the default Core Pointer that Clutter backends register by default
* device = clutter_seat_get_pointer (seat);
* device = clutter_device_manager_get_core_device (manager, %CLUTTER_POINTER_DEVICE);
*
* // update the state of the input device
* clutter_input_device_update_from_event (device, &c_event, FALSE);
@@ -2439,19 +2441,3 @@ clutter_input_device_is_grouped (ClutterInputDevice *device,
return CLUTTER_INPUT_DEVICE_GET_CLASS (device)->is_grouped (device, other_device);
}
/**
* clutter_input_device_get_seat:
* @device: a #ClutterInputDevice
*
* Returns the seat the device belongs to
*
* Returns: (transfer none): the device seat
**/
ClutterSeat *
clutter_input_device_get_seat (ClutterInputDevice *device)
{
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
return device->seat;
}

View File

@@ -28,40 +28,10 @@
#error "Only <clutter/clutter.h> can be included directly."
#endif
#include <clutter/clutter-backend.h>
#include <clutter/clutter-types.h>
#include <clutter/clutter-seat.h>
G_BEGIN_DECLS
typedef void (*ClutterEmitInputDeviceEvent) (ClutterEvent *event,
ClutterInputDevice *device);
struct _ClutterInputDeviceClass
{
GObjectClass parent_class;
gboolean (* keycode_to_evdev) (ClutterInputDevice *device,
guint hardware_keycode,
guint *evdev_keycode);
void (* update_from_tool) (ClutterInputDevice *device,
ClutterInputDeviceTool *tool);
gboolean (* is_mode_switch_button) (ClutterInputDevice *device,
guint group,
guint button);
gint (* get_group_n_modes) (ClutterInputDevice *device,
gint group);
gboolean (* is_grouped) (ClutterInputDevice *device,
ClutterInputDevice *other_device);
/* Keyboard accessbility */
void (* process_kbd_a11y_event) (ClutterEvent *event,
ClutterInputDevice *device,
ClutterEmitInputDeviceEvent emit_event_func);
};
#define CLUTTER_TYPE_INPUT_DEVICE (clutter_input_device_get_type ())
#define CLUTTER_INPUT_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_INPUT_DEVICE, ClutterInputDevice))
#define CLUTTER_IS_INPUT_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_INPUT_DEVICE))
@@ -201,8 +171,6 @@ void clutter_input_device_set_mapping_mode (ClutterInputDev
CLUTTER_EXPORT
gboolean clutter_input_device_is_grouped (ClutterInputDevice *device,
ClutterInputDevice *other_device);
CLUTTER_EXPORT
ClutterSeat * clutter_input_device_get_seat (ClutterInputDevice *device);
G_END_DECLS

View File

@@ -22,10 +22,10 @@
#include "clutter-build-config.h"
#include "clutter-private.h"
#include "clutter/clutter-input-device-private.h"
#include "clutter/clutter-input-method.h"
#include "clutter/clutter-input-method-private.h"
#include "clutter/clutter-input-focus-private.h"
#include "clutter/clutter-device-manager-private.h"
typedef struct _ClutterInputMethodPrivate ClutterInputMethodPrivate;
@@ -452,8 +452,8 @@ clutter_input_method_forward_key (ClutterInputMethod *im,
gboolean press)
{
ClutterInputMethodPrivate *priv;
ClutterDeviceManager *device_manager;
ClutterInputDevice *keyboard;
ClutterSeat *seat;
ClutterStage *stage;
ClutterEvent *event;
@@ -463,8 +463,9 @@ clutter_input_method_forward_key (ClutterInputMethod *im,
if (!priv->focus)
return;
seat = clutter_backend_get_default_seat (clutter_get_default_backend ());
keyboard = clutter_seat_get_keyboard (seat);
device_manager = clutter_device_manager_get_default ();
keyboard = clutter_device_manager_get_core_device (device_manager,
CLUTTER_KEYBOARD_DEVICE);
stage = _clutter_input_device_get_stage (keyboard);
if (stage == NULL)
return;

View File

@@ -25,9 +25,10 @@
#include "clutter-build-config.h"
#include "clutter-device-manager.h"
#include "clutter-device-manager-private.h"
#include "clutter-enum-types.h"
#include "clutter-input-device.h"
#include "clutter-input-device-private.h"
#include "clutter-input-pointer-a11y-private.h"
#include "clutter-main.h"
#include "clutter-virtual-input-device.h"
@@ -37,7 +38,7 @@ is_secondary_click_enabled (ClutterInputDevice *device)
{
ClutterPointerA11ySettings settings;
clutter_seat_get_pointer_a11y_settings (device->seat, &settings);
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
return (settings.controls & CLUTTER_A11Y_SECONDARY_CLICK_ENABLED);
}
@@ -47,7 +48,7 @@ is_dwell_click_enabled (ClutterInputDevice *device)
{
ClutterPointerA11ySettings settings;
clutter_seat_get_pointer_a11y_settings (device->seat, &settings);
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
return (settings.controls & CLUTTER_A11Y_DWELL_ENABLED);
}
@@ -57,7 +58,7 @@ get_secondary_click_delay (ClutterInputDevice *device)
{
ClutterPointerA11ySettings settings;
clutter_seat_get_pointer_a11y_settings (device->seat, &settings);
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
return settings.secondary_click_delay;
}
@@ -67,7 +68,7 @@ get_dwell_delay (ClutterInputDevice *device)
{
ClutterPointerA11ySettings settings;
clutter_seat_get_pointer_a11y_settings (device->seat, &settings);
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
return settings.dwell_delay;
}
@@ -77,7 +78,7 @@ get_dwell_threshold (ClutterInputDevice *device)
{
ClutterPointerA11ySettings settings;
clutter_seat_get_pointer_a11y_settings (device->seat, &settings);
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
return settings.dwell_threshold;
}
@@ -87,7 +88,7 @@ get_dwell_mode (ClutterInputDevice *device)
{
ClutterPointerA11ySettings settings;
clutter_seat_get_pointer_a11y_settings (device->seat, &settings);
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
return settings.dwell_mode;
}
@@ -97,7 +98,7 @@ get_dwell_click_type (ClutterInputDevice *device)
{
ClutterPointerA11ySettings settings;
clutter_seat_get_pointer_a11y_settings (device->seat, &settings);
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
return settings.dwell_click_type;
}
@@ -108,7 +109,7 @@ get_dwell_click_type_for_direction (ClutterInputDevice *device,
{
ClutterPointerA11ySettings settings;
clutter_seat_get_pointer_a11y_settings (device->seat, &settings);
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
if (direction == settings.dwell_gesture_single)
return CLUTTER_A11Y_DWELL_CLICK_TYPE_PRIMARY;
@@ -167,7 +168,7 @@ trigger_secondary_click (gpointer data)
device->ptr_a11y_data->secondary_click_triggered = TRUE;
device->ptr_a11y_data->secondary_click_timer = 0;
g_signal_emit_by_name (device->seat,
g_signal_emit_by_name (device->device_manager,
"ptr-a11y-timeout-stopped",
device,
CLUTTER_A11Y_TIMEOUT_TYPE_SECONDARY_CLICK,
@@ -184,7 +185,7 @@ start_secondary_click_timeout (ClutterInputDevice *device)
device->ptr_a11y_data->secondary_click_timer =
clutter_threads_add_timeout (delay, trigger_secondary_click, device);
g_signal_emit_by_name (device->seat,
g_signal_emit_by_name (device->device_manager,
"ptr-a11y-timeout-started",
device,
CLUTTER_A11Y_TIMEOUT_TYPE_SECONDARY_CLICK,
@@ -196,10 +197,10 @@ stop_secondary_click_timeout (ClutterInputDevice *device)
{
if (device->ptr_a11y_data->secondary_click_timer)
{
g_clear_handle_id (&device->ptr_a11y_data->secondary_click_timer,
g_source_remove);
g_source_remove (device->ptr_a11y_data->secondary_click_timer);
device->ptr_a11y_data->secondary_click_timer = 0;
g_signal_emit_by_name (device->seat,
g_signal_emit_by_name (device->device_manager,
"ptr-a11y-timeout-stopped",
device,
CLUTTER_A11Y_TIMEOUT_TYPE_SECONDARY_CLICK,
@@ -303,7 +304,7 @@ update_dwell_click_type (ClutterInputDevice *device)
ClutterPointerA11ySettings settings;
ClutterPointerA11yDwellClickType dwell_click_type;
clutter_seat_get_pointer_a11y_settings (device->seat, &settings);
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
dwell_click_type = settings.dwell_click_type;
switch (dwell_click_type)
@@ -328,9 +329,10 @@ update_dwell_click_type (ClutterInputDevice *device)
if (dwell_click_type != settings.dwell_click_type)
{
settings.dwell_click_type = dwell_click_type;
clutter_seat_set_pointer_a11y_settings (device->seat, &settings);
clutter_device_manager_set_pointer_a11y_settings (device->device_manager,
&settings);
g_signal_emit_by_name (device->seat,
g_signal_emit_by_name (device->device_manager,
"ptr-a11y-dwell-click-type-changed",
dwell_click_type);
}
@@ -435,7 +437,7 @@ trigger_dwell_gesture (gpointer data)
device->ptr_a11y_data->dwell_timer =
clutter_threads_add_timeout (delay, trigger_clear_dwell_gesture, device);
g_signal_emit_by_name (device->seat,
g_signal_emit_by_name (device->device_manager,
"ptr-a11y-timeout-stopped",
device,
CLUTTER_A11Y_TIMEOUT_TYPE_GESTURE,
@@ -453,7 +455,7 @@ start_dwell_gesture_timeout (ClutterInputDevice *device)
clutter_threads_add_timeout (delay, trigger_dwell_gesture, device);
device->ptr_a11y_data->dwell_gesture_started = TRUE;
g_signal_emit_by_name (device->seat,
g_signal_emit_by_name (device->device_manager,
"ptr-a11y-timeout-started",
device,
CLUTTER_A11Y_TIMEOUT_TYPE_GESTURE,
@@ -467,7 +469,7 @@ trigger_dwell_click (gpointer data)
device->ptr_a11y_data->dwell_timer = 0;
g_signal_emit_by_name (device->seat,
g_signal_emit_by_name (device->device_manager,
"ptr-a11y-timeout-stopped",
device,
CLUTTER_A11Y_TIMEOUT_TYPE_DWELL,
@@ -497,7 +499,7 @@ start_dwell_timeout (ClutterInputDevice *device)
device->ptr_a11y_data->dwell_timer =
clutter_threads_add_timeout (delay, trigger_dwell_click, device);
g_signal_emit_by_name (device->seat,
g_signal_emit_by_name (device->device_manager,
"ptr-a11y-timeout-started",
device,
CLUTTER_A11Y_TIMEOUT_TYPE_DWELL,
@@ -509,10 +511,11 @@ stop_dwell_timeout (ClutterInputDevice *device)
{
if (device->ptr_a11y_data->dwell_timer)
{
g_clear_handle_id (&device->ptr_a11y_data->dwell_timer, g_source_remove);
g_source_remove (device->ptr_a11y_data->dwell_timer);
device->ptr_a11y_data->dwell_timer = 0;
device->ptr_a11y_data->dwell_gesture_started = FALSE;
g_signal_emit_by_name (device->seat,
g_signal_emit_by_name (device->device_manager,
"ptr-a11y-timeout-stopped",
device,
CLUTTER_A11Y_TIMEOUT_TYPE_DWELL,
@@ -571,7 +574,8 @@ is_device_core_pointer (ClutterInputDevice *device)
{
ClutterInputDevice *core_pointer;
core_pointer = clutter_seat_get_pointer (device->seat);
core_pointer = clutter_device_manager_get_core_device (device->device_manager,
CLUTTER_POINTER_DEVICE);
if (core_pointer == NULL)
return FALSE;
@@ -585,8 +589,8 @@ _clutter_input_pointer_a11y_add_device (ClutterInputDevice *device)
return;
device->accessibility_virtual_device =
clutter_seat_create_virtual_device (device->seat,
CLUTTER_POINTER_DEVICE);
clutter_device_manager_create_virtual_device (device->device_manager,
CLUTTER_POINTER_DEVICE);
device->ptr_a11y_data = g_new0 (ClutterPtrA11yData, 1);
}

View File

@@ -62,9 +62,3 @@ clutter_keymap_get_caps_lock_state (ClutterKeymap *keymap)
{
return CLUTTER_KEYMAP_GET_CLASS (keymap)->get_caps_lock_state (keymap);
}
PangoDirection
clutter_keymap_get_direction (ClutterKeymap *keymap)
{
return CLUTTER_KEYMAP_GET_CLASS (keymap)->get_direction (keymap);
}

View File

@@ -29,7 +29,6 @@
#include <clutter/clutter-macros.h>
#include <glib-object.h>
#include <pango/pango.h>
typedef struct _ClutterKeymap ClutterKeymap;
typedef struct _ClutterKeymapClass ClutterKeymapClass;
@@ -40,7 +39,6 @@ struct _ClutterKeymapClass
gboolean (* get_num_lock_state) (ClutterKeymap *keymap);
gboolean (* get_caps_lock_state) (ClutterKeymap *keymap);
PangoDirection (* get_direction) (ClutterKeymap *keymap);
};
#define CLUTTER_TYPE_KEYMAP (clutter_keymap_get_type ())
@@ -55,6 +53,4 @@ gboolean clutter_keymap_get_num_lock_state (ClutterKeymap *keymap);
CLUTTER_EXPORT
gboolean clutter_keymap_get_caps_lock_state (ClutterKeymap *keymap);
PangoDirection clutter_keymap_get_direction (ClutterKeymap *keymap);
#endif /* CLUTTER_KEYMAP_H */

View File

@@ -58,6 +58,10 @@ die "Could not open file keysymdef.h: $!\n"
die "Could not open file clutter-keysyms.h: $!\n"
unless open(OUT_KEYSYMS, ">:utf8", "clutter-keysyms.h");
# Output: clutter/clutter/deprecated/clutter-keysyms.h
die "Could not open file clutter-keysyms-compat.h: $!\n"
unless open(OUT_KEYSYMS_COMPAT, ">:utf8", "deprecated/clutter-keysyms.h");
my $LICENSE_HEADER= <<EOF;
/* Clutter
*
@@ -81,6 +85,7 @@ my $LICENSE_HEADER= <<EOF;
EOF
print OUT_KEYSYMS $LICENSE_HEADER;
print OUT_KEYSYMS_COMPAT $LICENSE_HEADER;
print OUT_KEYSYMS<<EOF;
@@ -99,6 +104,23 @@ print OUT_KEYSYMS<<EOF;
EOF
print OUT_KEYSYMS_COMPAT<<EOF;
/*
* Compatibility version of clutter-keysyms.h.
*
* Since Clutter 1.4, the key symbol defines have been changed to have
* a KEY_ prefix. This is a compatibility header that is included when
* deprecated symbols are enabled. Consider porting to the new names
* instead.
*/
#ifndef __CLUTTER_KEYSYMS_DEPRECATED_H__
#define __CLUTTER_KEYSYMS_DEPRECATED_H__
#ifndef CLUTTER_DISABLE_DEPRECATED
EOF
while (<IN_KEYSYMDEF>)
{
next if ( ! /^#define / );
@@ -115,8 +137,13 @@ while (<IN_KEYSYMDEF>)
my $element = $keysymelements[1];
my $binding = $element;
$binding =~ s/^XK_/CLUTTER_KEY_/g;
my $compat_binding = $element;
$compat_binding =~ s/^XK_/CLUTTER_/g;
my $deprecation = "CLUTTER_DEPRECATED_MACRO_FOR(\"Deprecated key symbol. Use $binding instead.\")";
printf OUT_KEYSYMS "#define %s 0x%03x\n", $binding, hex($keysymelements[2]);
printf OUT_KEYSYMS_COMPAT "#define %s 0x%03x %s\n", $compat_binding, hex($keysymelements[2]), $deprecation;
}
close IN_KEYSYMDEF;
@@ -160,8 +187,11 @@ while (<IN_XF86KEYSYM>)
my $element = $keysymelements[1];
my $binding = $element;
$binding =~ s/^XF86XK_/CLUTTER_KEY_/g;
my $compat_binding = $element;
$compat_binding =~ s/^XF86XK_/CLUTTER_/g;
printf OUT_KEYSYMS "#define %s 0x%03x\n", $binding, hex($keysymelements[2]);
printf OUT_KEYSYMS_COMPAT "#define %s 0x%03x\n", $compat_binding, hex($keysymelements[2]);
}
close IN_XF86KEYSYM;
@@ -172,6 +202,13 @@ print OUT_KEYSYMS<<EOF;
#endif /* __CLUTTER_KEYSYMS_H__ */
EOF
print OUT_KEYSYMS_COMPAT<<EOF;
#endif /* CLUTTER_DISABLE_DEPRECATED */
#endif /* __CLUTTER_KEYSYMS_DEPRECATED_H__ */
EOF
foreach my $f (qw/ keysymdef.h XF86keysym.h /) {
unlink $f or die "Unable to delete $f: $!";
}

View File

@@ -98,11 +98,11 @@
* |[
* {
* "type" : "ClutterBox",
* "layout-manager" : { "type" : "ClutterGridLayout" },
* "layout-manager" : { "type" : "ClutterTableLayout" },
* "children" : [
* {
* "type" : "ClutterText",
* "text" : "Some text",
* "type" : "ClutterTexture",
* "filename" : "image-00.png",
*
* "layout::row" : 0,
* "layout::column" : 0,
@@ -112,8 +112,8 @@
* "layout::y-expand" : true
* },
* {
* "type" : "ClutterText",
* "text" : "Some more text",
* "type" : "ClutterTexture",
* "filename" : "image-01.png",
*
* "layout::row" : 0,
* "layout::column" : 1,

View File

@@ -55,9 +55,9 @@
#include "clutter-backend-private.h"
#include "clutter-config.h"
#include "clutter-debug.h"
#include "clutter-device-manager-private.h"
#include "clutter-event-private.h"
#include "clutter-feature.h"
#include "clutter-input-device-private.h"
#include "clutter-input-pointer-a11y-private.h"
#include "clutter-graphene.h"
#include "clutter-main.h"
@@ -1838,7 +1838,8 @@ _clutter_process_event_details (ClutterActor *stage,
gfloat x, y;
clutter_event_get_coords (event, &x, &y);
core_pointer = clutter_event_get_device (event);
core_pointer = clutter_device_manager_get_core_device (device->device_manager,
CLUTTER_POINTER_DEVICE);
_clutter_input_pointer_a11y_on_motion_event (core_pointer, x, y);
}
}
@@ -1880,7 +1881,9 @@ _clutter_process_event_details (ClutterActor *stage,
{
ClutterInputDevice *core_pointer;
core_pointer = clutter_event_get_device (event);
core_pointer = clutter_device_manager_get_core_device (device->device_manager,
CLUTTER_POINTER_DEVICE);
_clutter_input_pointer_a11y_on_button_event (core_pointer,
event->button.button,
event->type == CLUTTER_BUTTON_PRESS);
@@ -2308,7 +2311,8 @@ clutter_threads_remove_repaint_func (guint handle_id)
* that it does not block, otherwise the frame time budget may be lost.
*
* A repaint function is useful to ensure that an update of the scenegraph
* is performed before the scenegraph is repainted. By default, a repaint
* is performed before the scenegraph is repainted; for instance, uploading
* a frame from a video into a #ClutterTexture. By default, a repaint
* function added using this function will be invoked prior to the frame
* being processed.
*
@@ -2357,7 +2361,8 @@ clutter_threads_add_repaint_func (GSourceFunc func,
* that it does not block, otherwise the frame time budget may be lost.
*
* A repaint function is useful to ensure that an update of the scenegraph
* is performed before the scenegraph is repainted. The @flags passed to this
* is performed before the scenegraph is repainted; for instance, uploading
* a frame from a video into a #ClutterTexture. The @flags passed to this
* function will determine the section of the frame processing that will
* result in @func being called.
*

View File

@@ -26,8 +26,8 @@
#define __CLUTTER_H_INSIDE__
#include "clutter-backend.h"
#include "clutter-device-manager-private.h"
#include "clutter-event-private.h"
#include "clutter-input-device-private.h"
#include "clutter-input-pointer-a11y-private.h"
#include "clutter-macros.h"
#include "clutter-private.h"

View File

@@ -1102,10 +1102,6 @@ G_DEFINE_TYPE (ClutterActorNode, clutter_actor_node, CLUTTER_TYPE_PAINT_NODE)
static gboolean
clutter_actor_node_pre_draw (ClutterPaintNode *node)
{
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
CLUTTER_SET_PRIVATE_FLAGS (actor_node->actor, CLUTTER_IN_PAINT);
return TRUE;
}
@@ -1117,14 +1113,6 @@ clutter_actor_node_draw (ClutterPaintNode *node)
clutter_actor_continue_paint (actor_node->actor);
}
static void
clutter_actor_node_post_draw (ClutterPaintNode *node)
{
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
CLUTTER_UNSET_PRIVATE_FLAGS (actor_node->actor, CLUTTER_IN_PAINT);
}
static JsonNode *
clutter_actor_node_serialize (ClutterPaintNode *node)
{
@@ -1151,7 +1139,6 @@ clutter_actor_node_class_init (ClutterActorNodeClass *klass)
node_class = CLUTTER_PAINT_NODE_CLASS (klass);
node_class->pre_draw = clutter_actor_node_pre_draw;
node_class->draw = clutter_actor_node_draw;
node_class->post_draw = clutter_actor_node_post_draw;
node_class->serialize = clutter_actor_node_serialize;
}

View File

@@ -175,6 +175,7 @@
#include "clutter-actor.h"
#include "clutter-stage.h"
#include "clutter-texture.h"
#include "clutter-script.h"
#include "clutter-script-private.h"

View File

@@ -1,568 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2019 Red Hat 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/>.
*
* Author: Carlos Garnacho <carlosg@gnome.org>
*/
#include "clutter-build-config.h"
#include "clutter-backend-private.h"
#include "clutter-input-device-tool.h"
#include "clutter-input-pointer-a11y-private.h"
#include "clutter-marshal.h"
#include "clutter-private.h"
#include "clutter-seat.h"
#include "clutter-virtual-input-device.h"
enum
{
DEVICE_ADDED,
DEVICE_REMOVED,
TOOL_CHANGED,
KBD_A11Y_MASK_CHANGED,
KBD_A11Y_FLAGS_CHANGED,
PTR_A11Y_DWELL_CLICK_TYPE_CHANGED,
PTR_A11Y_TIMEOUT_STARTED,
PTR_A11Y_TIMEOUT_STOPPED,
N_SIGNALS,
};
static guint signals[N_SIGNALS] = { 0 };
enum
{
PROP_0,
PROP_BACKEND,
N_PROPS
};
static GParamSpec *props[N_PROPS];
typedef struct _ClutterSeatPrivate ClutterSeatPrivate;
struct _ClutterSeatPrivate
{
ClutterBackend *backend;
/* Keyboard a11y */
ClutterKbdA11ySettings kbd_a11y_settings;
/* Pointer a11y */
ClutterPointerA11ySettings pointer_a11y_settings;
};
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterSeat, clutter_seat, G_TYPE_OBJECT)
static void
clutter_seat_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterSeat *seat = CLUTTER_SEAT (object);
ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
switch (prop_id)
{
case PROP_BACKEND:
priv->backend = g_value_get_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
static void
clutter_seat_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ClutterSeat *seat = CLUTTER_SEAT (object);
ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
switch (prop_id)
{
case PROP_BACKEND:
g_value_set_object (value, priv->backend);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
static void
clutter_seat_finalize (GObject *object)
{
ClutterSeat *seat = CLUTTER_SEAT (object);
ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
g_clear_object (&priv->backend);
G_OBJECT_CLASS (clutter_seat_parent_class)->finalize (object);
}
static void
clutter_seat_class_init (ClutterSeatClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->set_property = clutter_seat_set_property;
object_class->get_property = clutter_seat_get_property;
object_class->finalize = clutter_seat_finalize;
signals[DEVICE_ADDED] =
g_signal_new (I_("device-added"),
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
CLUTTER_TYPE_INPUT_DEVICE);
g_signal_set_va_marshaller (signals[DEVICE_ADDED],
G_TYPE_FROM_CLASS (object_class),
g_cclosure_marshal_VOID__OBJECTv);
signals[DEVICE_REMOVED] =
g_signal_new (I_("device-removed"),
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
CLUTTER_TYPE_INPUT_DEVICE);
g_signal_set_va_marshaller (signals[DEVICE_REMOVED],
G_TYPE_FROM_CLASS (object_class),
g_cclosure_marshal_VOID__OBJECTv);
signals[TOOL_CHANGED] =
g_signal_new (I_("tool-changed"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
_clutter_marshal_VOID__OBJECT_OBJECT,
G_TYPE_NONE, 2,
CLUTTER_TYPE_INPUT_DEVICE,
CLUTTER_TYPE_INPUT_DEVICE_TOOL);
g_signal_set_va_marshaller (signals[TOOL_CHANGED],
G_TYPE_FROM_CLASS (object_class),
_clutter_marshal_VOID__OBJECT_OBJECTv);
/**
* ClutterSeat::kbd-a11y-mods-state-changed:
* @seat: the #ClutterSeat that emitted the signal
* @latched_mask: the latched modifier mask from stickykeys
* @locked_mask: the locked modifier mask from stickykeys
*
* The ::kbd-a11y-mods-state-changed signal is emitted each time either the
* latched modifiers mask or locked modifiers mask are changed as the
* result of keyboard accessibilty's sticky keys operations.
*/
signals[KBD_A11Y_MASK_CHANGED] =
g_signal_new (I_("kbd-a11y-mods-state-changed"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
_clutter_marshal_VOID__UINT_UINT,
G_TYPE_NONE, 2,
G_TYPE_UINT,
G_TYPE_UINT);
g_signal_set_va_marshaller (signals[KBD_A11Y_MASK_CHANGED],
G_TYPE_FROM_CLASS (object_class),
_clutter_marshal_VOID__UINT_UINTv);
/**
* ClutterSeat::kbd-a11y-flags-changed:
* @seat: the #ClutterSeat that emitted the signal
* @settings_flags: the new ClutterKeyboardA11yFlags configuration
* @changed_mask: the ClutterKeyboardA11yFlags changed
*
* The ::kbd-a11y-flags-changed signal is emitted each time the
* ClutterKeyboardA11yFlags configuration is changed as the result of
* keyboard accessibility operations.
*/
signals[KBD_A11Y_FLAGS_CHANGED] =
g_signal_new (I_("kbd-a11y-flags-changed"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
_clutter_marshal_VOID__UINT_UINT,
G_TYPE_NONE, 2,
G_TYPE_UINT,
G_TYPE_UINT);
g_signal_set_va_marshaller (signals[KBD_A11Y_FLAGS_CHANGED],
G_TYPE_FROM_CLASS (object_class),
_clutter_marshal_VOID__UINT_UINTv);
/**
* ClutterSeat::ptr-a11y-dwell-click-type-changed:
* @seat: the #ClutterSeat that emitted the signal
* @click_type: the new #ClutterPointerA11yDwellClickType mode
*
* The ::ptr-a11y-dwell-click-type-changed signal is emitted each time
* the ClutterPointerA11yDwellClickType mode is changed as the result
* of pointer accessibility operations.
*/
signals[PTR_A11Y_DWELL_CLICK_TYPE_CHANGED] =
g_signal_new (I_("ptr-a11y-dwell-click-type-changed"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
g_cclosure_marshal_VOID__FLAGS,
G_TYPE_NONE, 1,
CLUTTER_TYPE_POINTER_A11Y_DWELL_CLICK_TYPE);
g_signal_set_va_marshaller (signals[PTR_A11Y_DWELL_CLICK_TYPE_CHANGED],
G_TYPE_FROM_CLASS (object_class),
g_cclosure_marshal_VOID__FLAGSv);
/**
* ClutterSeat::ptr-a11y-timeout-started:
* @seat: the #ClutterSeat that emitted the signal
* @device: the core pointer #ClutterInputDevice
* @timeout_type: the type of timeout #ClutterPointerA11yTimeoutType
* @delay: the delay in ms before secondary-click is triggered.
*
* The ::ptr-a11y-timeout-started signal is emitted when a
* pointer accessibility timeout delay is started, so that upper
* layers can notify the user with some visual feedback.
*/
signals[PTR_A11Y_TIMEOUT_STARTED] =
g_signal_new (I_("ptr-a11y-timeout-started"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
_clutter_marshal_VOID__OBJECT_FLAGS_UINT,
G_TYPE_NONE, 3,
CLUTTER_TYPE_INPUT_DEVICE,
CLUTTER_TYPE_POINTER_A11Y_TIMEOUT_TYPE,
G_TYPE_UINT);
g_signal_set_va_marshaller (signals[PTR_A11Y_TIMEOUT_STARTED],
G_TYPE_FROM_CLASS (object_class),
_clutter_marshal_VOID__OBJECT_FLAGS_UINTv);
/**
* ClutterSeat::ptr-a11y-timeout-stopped:
* @seat: the #ClutterSeat that emitted the signal
* @device: the core pointer #ClutterInputDevice
* @timeout_type: the type of timeout #ClutterPointerA11yTimeoutType
* @clicked: %TRUE if the timeout finished and triggered a click
*
* The ::ptr-a11y-timeout-stopped signal is emitted when a running
* pointer accessibility timeout delay is stopped, either because
* it's triggered at the end of the delay or cancelled, so that
* upper layers can notify the user with some visual feedback.
*/
signals[PTR_A11Y_TIMEOUT_STOPPED] =
g_signal_new (I_("ptr-a11y-timeout-stopped"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
_clutter_marshal_VOID__OBJECT_FLAGS_BOOLEAN,
G_TYPE_NONE, 3,
CLUTTER_TYPE_INPUT_DEVICE,
CLUTTER_TYPE_POINTER_A11Y_TIMEOUT_TYPE,
G_TYPE_BOOLEAN);
g_signal_set_va_marshaller (signals[PTR_A11Y_TIMEOUT_STOPPED],
G_TYPE_FROM_CLASS (object_class),
_clutter_marshal_VOID__OBJECT_FLAGS_BOOLEANv);
props[PROP_BACKEND] =
g_param_spec_object ("backend",
P_("Backend"),
P_("Backend"),
CLUTTER_TYPE_BACKEND,
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_properties (object_class, N_PROPS, props);
}
static void
clutter_seat_init (ClutterSeat *seat)
{
}
/**
* clutter_seat_get_pointer:
* @seat: a #ClutterSeat
*
* Returns the master pointer
*
* Returns: (transfer none): the master pointer
**/
ClutterInputDevice *
clutter_seat_get_pointer (ClutterSeat *seat)
{
g_return_val_if_fail (CLUTTER_IS_SEAT (seat), NULL);
return CLUTTER_SEAT_GET_CLASS (seat)->get_pointer (seat);
}
/**
* clutter_seat_get_keyboard:
* @seat: a #ClutterSeat
*
* Returns the master keyboard
*
* Returns: (transfer none): the master keyboard
**/
ClutterInputDevice *
clutter_seat_get_keyboard (ClutterSeat *seat)
{
g_return_val_if_fail (CLUTTER_IS_SEAT (seat), NULL);
return CLUTTER_SEAT_GET_CLASS (seat)->get_keyboard (seat);
}
/**
* clutter_seat_list_devices:
* @seat: a #ClutterSeat
*
* Returns the list of HW devices
*
* Returns: (transfer container) (element-type Clutter.InputDevice): A list of #ClutterInputDevice
**/
GList *
clutter_seat_list_devices (ClutterSeat *seat)
{
g_return_val_if_fail (CLUTTER_IS_SEAT (seat), NULL);
return CLUTTER_SEAT_GET_CLASS (seat)->list_devices (seat);
}
void
clutter_seat_bell_notify (ClutterSeat *seat)
{
CLUTTER_SEAT_GET_CLASS (seat)->bell_notify (seat);
}
/**
* clutter_seat_get_keymap:
* @seat: a #ClutterSeat
*
* Returns the seat keymap
*
* Returns: (transfer none): the seat keymap
**/
ClutterKeymap *
clutter_seat_get_keymap (ClutterSeat *seat)
{
return CLUTTER_SEAT_GET_CLASS (seat)->get_keymap (seat);
}
static gboolean
are_kbd_a11y_settings_equal (ClutterKbdA11ySettings *a,
ClutterKbdA11ySettings *b)
{
return (memcmp (a, b, sizeof (ClutterKbdA11ySettings)) == 0);
}
void
clutter_seat_set_kbd_a11y_settings (ClutterSeat *seat,
ClutterKbdA11ySettings *settings)
{
ClutterSeatClass *seat_class;
ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
g_return_if_fail (CLUTTER_IS_SEAT (seat));
if (are_kbd_a11y_settings_equal (&priv->kbd_a11y_settings, settings))
return;
priv->kbd_a11y_settings = *settings;
seat_class = CLUTTER_SEAT_GET_CLASS (seat);
if (seat_class->apply_kbd_a11y_settings)
seat_class->apply_kbd_a11y_settings (seat, settings);
}
void
clutter_seat_get_kbd_a11y_settings (ClutterSeat *seat,
ClutterKbdA11ySettings *settings)
{
ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
g_return_if_fail (CLUTTER_IS_SEAT (seat));
*settings = priv->kbd_a11y_settings;
}
void
clutter_seat_ensure_a11y_state (ClutterSeat *seat)
{
ClutterInputDevice *core_pointer;
core_pointer = clutter_seat_get_pointer (seat);
if (core_pointer)
{
if (_clutter_is_input_pointer_a11y_enabled (core_pointer))
_clutter_input_pointer_a11y_add_device (core_pointer);
}
}
static gboolean
are_pointer_a11y_settings_equal (ClutterPointerA11ySettings *a,
ClutterPointerA11ySettings *b)
{
return (memcmp (a, b, sizeof (ClutterPointerA11ySettings)) == 0);
}
static void
clutter_seat_enable_pointer_a11y (ClutterSeat *seat)
{
ClutterInputDevice *core_pointer;
core_pointer = clutter_seat_get_pointer (seat);
_clutter_input_pointer_a11y_add_device (core_pointer);
}
static void
clutter_seat_disable_pointer_a11y (ClutterSeat *seat)
{
ClutterInputDevice *core_pointer;
core_pointer = clutter_seat_get_pointer (seat);
_clutter_input_pointer_a11y_remove_device (core_pointer);
}
/**
* clutter_seat_set_pointer_a11y_settings:
* @seat: a #ClutterSeat
* @settings: a pointer to a #ClutterPointerA11ySettings
*
* Sets the pointer accessibility settings
**/
void
clutter_seat_set_pointer_a11y_settings (ClutterSeat *seat,
ClutterPointerA11ySettings *settings)
{
ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
g_return_if_fail (CLUTTER_IS_SEAT (seat));
if (are_pointer_a11y_settings_equal (&priv->pointer_a11y_settings, settings))
return;
if (priv->pointer_a11y_settings.controls == 0 && settings->controls != 0)
clutter_seat_enable_pointer_a11y (seat);
else if (priv->pointer_a11y_settings.controls != 0 && settings->controls == 0)
clutter_seat_disable_pointer_a11y (seat);
priv->pointer_a11y_settings = *settings;
}
/**
* clutter_seat_get_pointer_a11y_settings:
* @seat: a #ClutterSeat
* @settings: a pointer to a #ClutterPointerA11ySettings
*
* Gets the current pointer accessibility settings
**/
void
clutter_seat_get_pointer_a11y_settings (ClutterSeat *seat,
ClutterPointerA11ySettings *settings)
{
ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
g_return_if_fail (CLUTTER_IS_SEAT (seat));
*settings = priv->pointer_a11y_settings;
}
/**
* clutter_seat_set_pointer_a11y_dwell_click_type:
* @seat: a #ClutterSeat
* @click_type: type of click as #ClutterPointerA11yDwellClickType
*
* Sets the dwell click type
**/
void
clutter_seat_set_pointer_a11y_dwell_click_type (ClutterSeat *seat,
ClutterPointerA11yDwellClickType click_type)
{
ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
g_return_if_fail (CLUTTER_IS_SEAT (seat));
priv->pointer_a11y_settings.dwell_click_type = click_type;
}
/**
* clutter_seat_create_virtual_device:
* @seat: a #ClutterSeat
* @device_type: the type of the virtual device
*
* Creates a virtual input device.
*
* Returns: (transfer full): a newly created virtual device
**/
ClutterVirtualInputDevice *
clutter_seat_create_virtual_device (ClutterSeat *seat,
ClutterInputDeviceType device_type)
{
ClutterSeatClass *seat_class;
g_return_val_if_fail (CLUTTER_IS_SEAT (seat), NULL);
seat_class = CLUTTER_SEAT_GET_CLASS (seat);
return seat_class->create_virtual_device (seat, device_type);
}
/**
* clutter_seat_supported_virtual_device_types: (skip)
*/
ClutterVirtualDeviceType
clutter_seat_get_supported_virtual_device_types (ClutterSeat *seat)
{
ClutterSeatClass *seat_class;
g_return_val_if_fail (CLUTTER_IS_SEAT (seat),
CLUTTER_VIRTUAL_DEVICE_TYPE_NONE);
seat_class = CLUTTER_SEAT_GET_CLASS (seat);
return seat_class->get_supported_virtual_device_types (seat);
}
void
clutter_seat_compress_motion (ClutterSeat *seat,
ClutterEvent *event,
const ClutterEvent *to_discard)
{
ClutterSeatClass *seat_class;
g_return_if_fail (CLUTTER_IS_SEAT (seat));
seat_class = CLUTTER_SEAT_GET_CLASS (seat);
if (!seat_class->compress_motion)
return;
seat_class->compress_motion (seat, event, to_discard);
}
void
clutter_seat_warp_pointer (ClutterSeat *seat,
int x,
int y)
{
g_return_if_fail (CLUTTER_IS_SEAT (seat));
CLUTTER_SEAT_GET_CLASS (seat)->warp_pointer (seat, x, y);
}

View File

@@ -1,178 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2019 Red Hat 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/>.
*
* Author: Carlos Garnacho <carlosg@gnome.org>
*/
#ifndef CLUTTER_SEAT_H
#define CLUTTER_SEAT_H
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#include "clutter/clutter-types.h"
#include "clutter/clutter-keymap.h"
#include "clutter/clutter-virtual-input-device.h"
#define CLUTTER_TYPE_SEAT (clutter_seat_get_type ())
CLUTTER_EXPORT
G_DECLARE_DERIVABLE_TYPE (ClutterSeat, clutter_seat,
CLUTTER, SEAT, GObject)
/**
* ClutterKbdA11ySettings:
*
* The #ClutterKbdA11ySettings structure contains keyboard accessibility
* settings
*
*/
typedef struct _ClutterKbdA11ySettings
{
ClutterKeyboardA11yFlags controls;
gint slowkeys_delay;
gint debounce_delay;
gint timeout_delay;
gint mousekeys_init_delay;
gint mousekeys_max_speed;
gint mousekeys_accel_time;
} ClutterKbdA11ySettings;
/**
* ClutterPointerA11ySettings:
*
* The #ClutterPointerA11ySettings structure contains pointer accessibility
* settings
*
*/
typedef struct _ClutterPointerA11ySettings
{
ClutterPointerA11yFlags controls;
ClutterPointerA11yDwellClickType dwell_click_type;
ClutterPointerA11yDwellMode dwell_mode;
ClutterPointerA11yDwellDirection dwell_gesture_single;
ClutterPointerA11yDwellDirection dwell_gesture_double;
ClutterPointerA11yDwellDirection dwell_gesture_drag;
ClutterPointerA11yDwellDirection dwell_gesture_secondary;
gint secondary_click_delay;
gint dwell_delay;
gint dwell_threshold;
} ClutterPointerA11ySettings;
/**
* ClutterVirtualDeviceType:
*/
typedef enum
{
CLUTTER_VIRTUAL_DEVICE_TYPE_NONE = 0,
CLUTTER_VIRTUAL_DEVICE_TYPE_KEYBOARD = 1 << 0,
CLUTTER_VIRTUAL_DEVICE_TYPE_POINTER = 1 << 1,
CLUTTER_VIRTUAL_DEVICE_TYPE_TOUCHSCREEN = 1 << 2,
} ClutterVirtualDeviceType;
typedef struct _ClutterSeatClass ClutterSeatClass;
struct _ClutterSeatClass
{
GObjectClass parent_class;
ClutterInputDevice * (* get_pointer) (ClutterSeat *seat);
ClutterInputDevice * (* get_keyboard) (ClutterSeat *seat);
GList * (* list_devices) (ClutterSeat *seat);
void (* bell_notify) (ClutterSeat *seat);
ClutterKeymap * (* get_keymap) (ClutterSeat *seat);
void (* compress_motion) (ClutterSeat *seat,
ClutterEvent *event,
const ClutterEvent *to_discard);
void (* warp_pointer) (ClutterSeat *seat,
int x,
int y);
/* Event platform data */
void (* copy_event_data) (ClutterSeat *seat,
const ClutterEvent *src,
ClutterEvent *dest);
void (* free_event_data) (ClutterSeat *seat,
ClutterEvent *event);
/* Keyboard accessibility */
void (* apply_kbd_a11y_settings) (ClutterSeat *seat,
ClutterKbdA11ySettings *settings);
/* Virtual devices */
ClutterVirtualInputDevice * (* create_virtual_device) (ClutterSeat *seat,
ClutterInputDeviceType device_type);
ClutterVirtualDeviceType (* get_supported_virtual_device_types) (ClutterSeat *seat);
};
CLUTTER_EXPORT
ClutterInputDevice * clutter_seat_get_pointer (ClutterSeat *seat);
CLUTTER_EXPORT
ClutterInputDevice * clutter_seat_get_keyboard (ClutterSeat *seat);
CLUTTER_EXPORT
GList * clutter_seat_list_devices (ClutterSeat *seat);
CLUTTER_EXPORT
void clutter_seat_bell_notify (ClutterSeat *seat);
CLUTTER_EXPORT
ClutterKeymap * clutter_seat_get_keymap (ClutterSeat *seat);
CLUTTER_EXPORT
void clutter_seat_set_kbd_a11y_settings (ClutterSeat *seat,
ClutterKbdA11ySettings *settings);
CLUTTER_EXPORT
void clutter_seat_get_kbd_a11y_settings (ClutterSeat *seat,
ClutterKbdA11ySettings *settings);
CLUTTER_EXPORT
void clutter_seat_ensure_a11y_state (ClutterSeat *seat);
CLUTTER_EXPORT
void clutter_seat_set_pointer_a11y_settings (ClutterSeat *seat,
ClutterPointerA11ySettings *settings);
CLUTTER_EXPORT
void clutter_seat_get_pointer_a11y_settings (ClutterSeat *seat,
ClutterPointerA11ySettings *settings);
CLUTTER_EXPORT
void clutter_seat_set_pointer_a11y_dwell_click_type (ClutterSeat *seat,
ClutterPointerA11yDwellClickType click_type);
CLUTTER_EXPORT
ClutterVirtualInputDevice *clutter_seat_create_virtual_device (ClutterSeat *seat,
ClutterInputDeviceType device_type);
CLUTTER_EXPORT
ClutterVirtualDeviceType clutter_seat_get_supported_virtual_device_types (ClutterSeat *seat);
void clutter_seat_compress_motion (ClutterSeat *seat,
ClutterEvent *event,
const ClutterEvent *to_discard);
CLUTTER_EXPORT
void clutter_seat_warp_pointer (ClutterSeat *seat,
int x,
int y);
#endif /* CLUTTER_SEAT_H */

View File

@@ -44,6 +44,8 @@
#include "clutter-debug.h"
#include "clutter-private.h"
#include "deprecated/clutter-stage-manager.h"
enum
{
PROP_0,
@@ -181,6 +183,23 @@ clutter_stage_manager_get_default (void)
return context->stage_manager;
}
/**
* clutter_stage_manager_set_default_stage:
* @stage_manager: a #ClutterStageManager
* @stage: a #ClutterStage
*
* Sets @stage as the default stage.
*
* Since: 0.8
*
* Deprecated: 1.2: Calling this function has no effect
*/
void
clutter_stage_manager_set_default_stage (ClutterStageManager *stage_manager,
ClutterStage *stage)
{
}
/*< private >
* _clutter_stage_manager_set_default_stage:
* @stage_manager: a #ClutterStageManager

View File

@@ -20,8 +20,8 @@
#include "clutter/clutter-stage-view.h"
void clutter_stage_view_after_paint (ClutterStageView *view,
const cairo_rectangle_int_t *clip);
void clutter_stage_view_blit_offscreen (ClutterStageView *view,
const cairo_rectangle_int_t *clip);
gboolean clutter_stage_view_is_dirty_viewport (ClutterStageView *view);

View File

@@ -30,7 +30,6 @@ enum
PROP_LAYOUT,
PROP_FRAMEBUFFER,
PROP_OFFSCREEN,
PROP_SHADOWFB,
PROP_SCALE,
PROP_LAST
@@ -45,10 +44,7 @@ typedef struct _ClutterStageViewPrivate
CoglFramebuffer *framebuffer;
CoglOffscreen *offscreen;
CoglPipeline *offscreen_pipeline;
CoglOffscreen *shadowfb;
CoglPipeline *shadowfb_pipeline;
CoglPipeline *pipeline;
guint dirty_viewport : 1;
guint dirty_projection : 1;
@@ -82,8 +78,6 @@ clutter_stage_view_get_framebuffer (ClutterStageView *view)
if (priv->offscreen)
return priv->offscreen;
else if (priv->shadowfb)
return priv->shadowfb;
else
return priv->framebuffer;
}
@@ -105,24 +99,6 @@ clutter_stage_view_get_onscreen (ClutterStageView *view)
return priv->framebuffer;
}
static CoglPipeline *
clutter_stage_view_create_framebuffer_pipeline (CoglFramebuffer *framebuffer)
{
CoglPipeline *pipeline;
pipeline = cogl_pipeline_new (cogl_framebuffer_get_context (framebuffer));
cogl_pipeline_set_layer_filters (pipeline, 0,
COGL_PIPELINE_FILTER_NEAREST,
COGL_PIPELINE_FILTER_NEAREST);
cogl_pipeline_set_layer_texture (pipeline, 0,
cogl_offscreen_get_texture (framebuffer));
cogl_pipeline_set_layer_wrap_mode (pipeline, 0,
COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE);
return pipeline;
}
static void
clutter_stage_view_ensure_offscreen_blit_pipeline (ClutterStageView *view)
{
@@ -133,27 +109,21 @@ clutter_stage_view_ensure_offscreen_blit_pipeline (ClutterStageView *view)
g_assert (priv->offscreen != NULL);
if (priv->offscreen_pipeline)
if (priv->pipeline)
return;
priv->offscreen_pipeline =
clutter_stage_view_create_framebuffer_pipeline (priv->offscreen);
priv->pipeline =
cogl_pipeline_new (cogl_framebuffer_get_context (priv->offscreen));
cogl_pipeline_set_layer_filters (priv->pipeline, 0,
COGL_PIPELINE_FILTER_NEAREST,
COGL_PIPELINE_FILTER_NEAREST);
cogl_pipeline_set_layer_texture (priv->pipeline, 0,
cogl_offscreen_get_texture (priv->offscreen));
cogl_pipeline_set_layer_wrap_mode (priv->pipeline, 0,
COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE);
if (view_class->setup_offscreen_blit_pipeline)
view_class->setup_offscreen_blit_pipeline (view, priv->offscreen_pipeline);
}
static void
clutter_stage_view_ensure_shadowfb_blit_pipeline (ClutterStageView *view)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
if (priv->shadowfb_pipeline)
return;
priv->shadowfb_pipeline =
clutter_stage_view_create_framebuffer_pipeline (priv->shadowfb);
view_class->setup_offscreen_blit_pipeline (view, priv->pipeline);
}
void
@@ -162,93 +132,48 @@ clutter_stage_view_invalidate_offscreen_blit_pipeline (ClutterStageView *view)
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
g_clear_pointer (&priv->offscreen_pipeline, cogl_object_unref);
g_clear_pointer (&priv->pipeline, cogl_object_unref);
}
static void
clutter_stage_view_copy_to_framebuffer (ClutterStageView *view,
const cairo_rectangle_int_t *rect,
CoglPipeline *pipeline,
CoglFramebuffer *src_framebuffer,
CoglFramebuffer *dst_framebuffer,
gboolean can_blit)
void
clutter_stage_view_blit_offscreen (ClutterStageView *view,
const cairo_rectangle_int_t *rect)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
CoglMatrix matrix;
/* First, try with blit */
if (can_blit)
clutter_stage_view_get_offscreen_transformation_matrix (view, &matrix);
if (cogl_matrix_is_identity (&matrix))
{
if (cogl_blit_framebuffer (src_framebuffer,
dst_framebuffer,
int fb_width = cogl_framebuffer_get_width (priv->framebuffer);
int fb_height = cogl_framebuffer_get_height (priv->framebuffer);
if (cogl_blit_framebuffer (priv->offscreen,
priv->framebuffer,
0, 0,
0, 0,
cogl_framebuffer_get_width (dst_framebuffer),
cogl_framebuffer_get_height (dst_framebuffer),
fb_width, fb_height,
NULL))
return;
}
/* If blit fails, fallback to the slower painting method */
cogl_framebuffer_push_matrix (dst_framebuffer);
clutter_stage_view_ensure_offscreen_blit_pipeline (view);
cogl_framebuffer_push_matrix (priv->framebuffer);
/* Set transform so 0,0 is on the top left corner and 1,1 on
* the bottom right corner.
*/
cogl_matrix_init_identity (&matrix);
cogl_matrix_translate (&matrix, -1, 1, 0);
cogl_matrix_scale (&matrix, 2, -2, 0);
cogl_framebuffer_set_projection_matrix (dst_framebuffer, &matrix);
cogl_framebuffer_set_projection_matrix (priv->framebuffer, &matrix);
cogl_framebuffer_draw_rectangle (dst_framebuffer,
pipeline,
cogl_framebuffer_draw_rectangle (priv->framebuffer,
priv->pipeline,
0, 0, 1, 1);
cogl_framebuffer_pop_matrix (dst_framebuffer);
}
void
clutter_stage_view_after_paint (ClutterStageView *view,
const cairo_rectangle_int_t *rect)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
if (priv->offscreen)
{
gboolean can_blit;
CoglMatrix matrix;
clutter_stage_view_ensure_offscreen_blit_pipeline (view);
clutter_stage_view_get_offscreen_transformation_matrix (view, &matrix);
can_blit = cogl_matrix_is_identity (&matrix);
if (priv->shadowfb)
{
clutter_stage_view_copy_to_framebuffer (view,
rect,
priv->offscreen_pipeline,
priv->offscreen,
priv->shadowfb,
can_blit);
}
else
{
clutter_stage_view_copy_to_framebuffer (view,
rect,
priv->offscreen_pipeline,
priv->offscreen,
priv->framebuffer,
can_blit);
}
}
if (priv->shadowfb)
{
clutter_stage_view_ensure_shadowfb_blit_pipeline (view);
clutter_stage_view_copy_to_framebuffer (view,
rect,
priv->shadowfb_pipeline,
priv->shadowfb,
priv->framebuffer,
TRUE);
}
cogl_framebuffer_pop_matrix (priv->framebuffer);
}
float
@@ -348,9 +273,6 @@ clutter_stage_view_get_property (GObject *object,
case PROP_OFFSCREEN:
g_value_set_boxed (value, priv->offscreen);
break;
case PROP_SHADOWFB:
g_value_set_boxed (value, priv->shadowfb);
break;
case PROP_SCALE:
g_value_set_float (value, priv->scale);
break;
@@ -396,9 +318,6 @@ clutter_stage_view_set_property (GObject *object,
case PROP_OFFSCREEN:
priv->offscreen = g_value_dup_boxed (value);
break;
case PROP_SHADOWFB:
priv->shadowfb = g_value_dup_boxed (value);
break;
case PROP_SCALE:
priv->scale = g_value_get_float (value);
break;
@@ -415,10 +334,8 @@ clutter_stage_view_dispose (GObject *object)
clutter_stage_view_get_instance_private (view);
g_clear_pointer (&priv->framebuffer, cogl_object_unref);
g_clear_pointer (&priv->shadowfb, cogl_object_unref);
g_clear_pointer (&priv->offscreen, cogl_object_unref);
g_clear_pointer (&priv->offscreen_pipeline, cogl_object_unref);
g_clear_pointer (&priv->shadowfb_pipeline, cogl_object_unref);
g_clear_pointer (&priv->pipeline, cogl_object_unref);
G_OBJECT_CLASS (clutter_stage_view_parent_class)->dispose (object);
}
@@ -473,15 +390,6 @@ clutter_stage_view_class_init (ClutterStageViewClass *klass)
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
obj_props[PROP_SHADOWFB] =
g_param_spec_boxed ("shadowfb",
"Shadow framebuffer",
"Framebuffer used as intermediate shadow buffer",
COGL_TYPE_HANDLE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
obj_props[PROP_SCALE] =
g_param_spec_float ("scale",
"View scale",

View File

@@ -249,6 +249,23 @@ _clutter_stage_window_get_redraw_clip (ClutterStageWindow *window)
return NULL;
}
gboolean
_clutter_stage_window_get_redraw_clip_bounds (ClutterStageWindow *window,
cairo_rectangle_int_t *stage_clip)
{
cairo_region_t *redraw_clip;
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
redraw_clip = _clutter_stage_window_get_redraw_clip (window);
if (!redraw_clip)
return FALSE;
cairo_region_get_extents (redraw_clip, stage_clip);
cairo_region_destroy (redraw_clip);
return TRUE;
}
void
_clutter_stage_window_set_accept_focus (ClutterStageWindow *window,
gboolean accept_focus)

View File

@@ -98,6 +98,8 @@ void _clutter_stage_window_add_redraw_clip (ClutterStageWin
cairo_rectangle_int_t *stage_clip);
gboolean _clutter_stage_window_has_redraw_clips (ClutterStageWindow *window);
gboolean _clutter_stage_window_ignoring_redraw_clips (ClutterStageWindow *window);
gboolean _clutter_stage_window_get_redraw_clip_bounds (ClutterStageWindow *window,
cairo_rectangle_int_t *clip);
cairo_region_t * _clutter_stage_window_get_redraw_clip (ClutterStageWindow *window);
void _clutter_stage_window_set_accept_focus (ClutterStageWindow *window,

View File

@@ -60,10 +60,10 @@
#include "clutter-color.h"
#include "clutter-container.h"
#include "clutter-debug.h"
#include "clutter-device-manager-private.h"
#include "clutter-enum-types.h"
#include "clutter-event-private.h"
#include "clutter-id-pool.h"
#include "clutter-input-device-private.h"
#include "clutter-main.h"
#include "clutter-marshal.h"
#include "clutter-master-clock.h"
@@ -78,6 +78,24 @@
#include "cogl/cogl.h"
#include "cogl/cogl-trace.h"
/* <private>
* ClutterStageHint:
* @CLUTTER_STAGE_NONE: No hint set
* @CLUTTER_STAGE_NO_CLEAR_ON_PAINT: When this hint is set, the stage
* should not clear the viewport; this flag is useful when painting
* fully opaque actors covering the whole visible area of the stage,
* i.e. when no blending with the stage color happens over the whole
* stage viewport
*/
typedef enum /*< prefix=CLUTTER_STAGE >*/
{
CLUTTER_STAGE_HINT_NONE = 0,
CLUTTER_STAGE_NO_CLEAR_ON_PAINT = 1 << 0
} ClutterStageHint;
#define STAGE_NO_CLEAR_ON_PAINT(s) ((((ClutterStage *) (s))->priv->stage_hints & CLUTTER_STAGE_NO_CLEAR_ON_PAINT) != 0)
struct _ClutterStageQueueRedrawEntry
{
ClutterActor *actor;
@@ -114,6 +132,8 @@ struct _ClutterStagePrivate
GQueue *event_queue;
ClutterStageHint stage_hints;
GArray *paint_volume_stack;
ClutterPlane current_clip_planes[4];
@@ -168,6 +188,7 @@ enum
PROP_TITLE,
PROP_USE_ALPHA,
PROP_KEY_FOCUS,
PROP_NO_CLEAR_HINT,
PROP_ACCEPT_FOCUS,
PROP_LAST
};
@@ -1248,9 +1269,11 @@ _clutter_stage_process_queued_events (ClutterStage *stage)
if (next_event->type == CLUTTER_MOTION)
{
ClutterSeat *seat = clutter_input_device_get_seat (device);
ClutterDeviceManager *device_manager =
clutter_device_manager_get_default ();
clutter_seat_compress_motion (seat, next_event, event);
_clutter_device_manager_compress_motion (device_manager,
next_event, event);
}
goto next_event;
@@ -1389,22 +1412,21 @@ static GSList *
_clutter_stage_check_updated_pointers (ClutterStage *stage)
{
ClutterStagePrivate *priv = stage->priv;
ClutterBackend *backend;
ClutterSeat *seat;
ClutterDeviceManager *device_manager;
GSList *updating = NULL;
GList *l, *devices;
cairo_region_t *clip;
const GSList *devices;
cairo_rectangle_int_t clip;
graphene_point_t point;
gboolean has_clip;
clip = _clutter_stage_window_get_redraw_clip (priv->impl);
has_clip = _clutter_stage_window_get_redraw_clip_bounds (priv->impl, &clip);
backend = clutter_get_default_backend ();
seat = clutter_backend_get_default_seat (backend);
devices = clutter_seat_list_devices (seat);
device_manager = clutter_device_manager_get_default ();
devices = clutter_device_manager_peek_devices (device_manager);
for (l = devices; l; l = l->next)
for (; devices != NULL; devices = devices->next)
{
ClutterInputDevice *dev = l->data;
ClutterInputDevice *dev = devices->data;
if (clutter_input_device_get_device_mode (dev) !=
CLUTTER_INPUT_MODE_MASTER)
@@ -1420,7 +1442,9 @@ _clutter_stage_check_updated_pointers (ClutterStage *stage)
if (!clutter_input_device_get_coords (dev, NULL, &point))
continue;
if (!clip || cairo_region_contains_point (clip, point.x, point.y))
if (!has_clip ||
(point.x >= clip.x && point.x < clip.x + clip.width &&
point.y >= clip.y && point.y < clip.y + clip.height))
updating = g_slist_prepend (updating, dev);
break;
default:
@@ -1433,8 +1457,6 @@ _clutter_stage_check_updated_pointers (ClutterStage *stage)
}
}
g_list_free (devices);
return updating;
}
@@ -1631,6 +1653,41 @@ clutter_stage_get_redraw_clip (ClutterStage *stage)
return cairo_region_create_rectangle (&clip);
}
/**
* clutter_stage_get_redraw_clip_bounds:
* @stage: A #ClutterStage
* @clip: (out caller-allocates): Return location for the clip bounds
*
* Gets the bounds of the current redraw for @stage in stage pixel
* coordinates. E.g., if only a single actor has queued a redraw then
* Clutter may redraw the stage with a clip so that it doesn't have to
* paint every pixel in the stage. This function would then return the
* bounds of that clip. An application can use this information to
* avoid some extra work if it knows that some regions of the stage
* aren't going to be painted. This should only be called while the
* stage is being painted. If there is no current redraw clip then
* this function will set @clip to the full extents of the stage.
*
* Since: 1.8
*/
void
clutter_stage_get_redraw_clip_bounds (ClutterStage *stage,
cairo_rectangle_int_t *clip)
{
ClutterStagePrivate *priv;
g_return_if_fail (CLUTTER_IS_STAGE (stage));
g_return_if_fail (clip != NULL);
priv = stage->priv;
if (!_clutter_stage_window_get_redraw_clip_bounds (priv->impl, clip))
{
/* Set clip to the full extents of the stage */
_clutter_stage_window_get_geometry (priv->impl, clip);
}
}
static ClutterActor *
_clutter_stage_do_pick_on_view (ClutterStage *stage,
float x,
@@ -1832,6 +1889,10 @@ clutter_stage_set_property (GObject *object,
clutter_stage_set_key_focus (stage, g_value_get_object (value));
break;
case PROP_NO_CLEAR_HINT:
clutter_stage_set_no_clear_hint (stage, g_value_get_boolean (value));
break;
case PROP_ACCEPT_FOCUS:
clutter_stage_set_accept_focus (stage, g_value_get_boolean (value));
break;
@@ -1882,6 +1943,15 @@ clutter_stage_get_property (GObject *gobject,
g_value_set_object (value, priv->key_focused_actor);
break;
case PROP_NO_CLEAR_HINT:
{
gboolean hint =
(priv->stage_hints & CLUTTER_STAGE_NO_CLEAR_ON_PAINT) != 0;
g_value_set_boolean (value, hint);
}
break;
case PROP_ACCEPT_FOCUS:
g_value_set_boolean (value, priv->accept_focus);
break;
@@ -2084,6 +2154,23 @@ clutter_stage_class_init (ClutterStageClass *klass)
CLUTTER_TYPE_ACTOR,
CLUTTER_PARAM_READWRITE);
/**
* ClutterStage:no-clear-hint:
*
* Whether or not the #ClutterStage should clear its contents
* before each paint cycle.
*
* See clutter_stage_set_no_clear_hint() for further information.
*
* Since: 1.4
*/
obj_props[PROP_NO_CLEAR_HINT] =
g_param_spec_boolean ("no-clear-hint",
P_("No Clear Hint"),
P_("Whether the stage should clear its contents"),
FALSE,
CLUTTER_PARAM_READWRITE);
/**
* ClutterStage:accept-focus:
*
@@ -3701,6 +3788,72 @@ _clutter_stage_clear_update_time (ClutterStage *stage)
_clutter_stage_window_clear_update_time (stage_window);
}
/**
* clutter_stage_set_no_clear_hint:
* @stage: a #ClutterStage
* @no_clear: %TRUE if the @stage should not clear itself on every
* repaint cycle
*
* Sets whether the @stage should clear itself at the beginning
* of each paint cycle or not.
*
* Clearing the #ClutterStage can be a costly operation, especially
* if the stage is always covered - for instance, in a full-screen
* video player or in a game with a background texture.
*
* This setting is a hint; Clutter might discard this hint
* depending on its internal state.
*
* If parts of the stage are visible and you disable clearing you
* might end up with visual artifacts while painting the contents of
* the stage.
*
* Since: 1.4
*/
void
clutter_stage_set_no_clear_hint (ClutterStage *stage,
gboolean no_clear)
{
ClutterStagePrivate *priv;
ClutterStageHint new_hints;
g_return_if_fail (CLUTTER_IS_STAGE (stage));
priv = stage->priv;
new_hints = priv->stage_hints;
if (no_clear)
new_hints |= CLUTTER_STAGE_NO_CLEAR_ON_PAINT;
else
new_hints &= ~CLUTTER_STAGE_NO_CLEAR_ON_PAINT;
if (priv->stage_hints == new_hints)
return;
priv->stage_hints = new_hints;
g_object_notify_by_pspec (G_OBJECT (stage), obj_props[PROP_NO_CLEAR_HINT]);
}
/**
* clutter_stage_get_no_clear_hint:
* @stage: a #ClutterStage
*
* Retrieves the hint set with clutter_stage_set_no_clear_hint()
*
* Return value: %TRUE if the stage should not clear itself on every paint
* cycle, and %FALSE otherwise
*
* Since: 1.4
*/
gboolean
clutter_stage_get_no_clear_hint (ClutterStage *stage)
{
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
return (stage->priv->stage_hints & CLUTTER_STAGE_NO_CLEAR_ON_PAINT) != 0;
}
ClutterPaintVolume *
_clutter_stage_paint_volume_stack_allocate (ClutterStage *stage)
{

View File

@@ -164,6 +164,11 @@ void clutter_stage_get_minimum_size (ClutterStage
guint *width,
guint *height);
CLUTTER_EXPORT
void clutter_stage_set_no_clear_hint (ClutterStage *stage,
gboolean no_clear);
CLUTTER_EXPORT
gboolean clutter_stage_get_no_clear_hint (ClutterStage *stage);
CLUTTER_EXPORT
void clutter_stage_set_use_alpha (ClutterStage *stage,
gboolean use_alpha);
CLUTTER_EXPORT
@@ -206,6 +211,9 @@ guchar * clutter_stage_read_pixels (ClutterStage
gint height);
CLUTTER_EXPORT
void clutter_stage_get_redraw_clip_bounds (ClutterStage *stage,
cairo_rectangle_int_t *clip);
CLUTTER_EXPORT
cairo_region_t * clutter_stage_get_redraw_clip (ClutterStage *stage);
CLUTTER_EXPORT
void clutter_stage_ensure_viewport (ClutterStage *stage);

View File

@@ -178,17 +178,17 @@ struct _ClutterTextPrivate
guint password_hint_timeout;
/* Signal handler for when the backend changes its font settings */
gulong settings_changed_id;
guint settings_changed_id;
/* Signal handler for when the :text-direction changes */
gulong direction_changed_id;
guint direction_changed_id;
ClutterInputFocus *input_focus;
ClutterInputContentHintFlags input_hints;
ClutterInputContentPurpose input_purpose;
/* Signal handler for when the :resource-scale changes */
gulong resource_scale_changed_id;
guint resource_scale_changed_id;
/* bitfields */
guint alignment : 2;
@@ -759,14 +759,7 @@ clutter_text_create_layout_no_cache (ClutterText *text,
ClutterTextDirection text_dir;
if (clutter_actor_has_key_focus (CLUTTER_ACTOR (text)))
{
ClutterSeat *seat;
ClutterKeymap *keymap;
seat = clutter_backend_get_default_seat (backend);
keymap = clutter_seat_get_keymap (seat);
pango_dir = clutter_keymap_get_direction (keymap);
}
pango_dir = _clutter_backend_get_keymap_direction (backend);
else
{
text_dir = clutter_actor_get_text_direction (CLUTTER_ACTOR (text));
@@ -1765,12 +1758,30 @@ clutter_text_dispose (GObject *gobject)
/* get rid of the entire cache */
clutter_text_dirty_cache (self);
g_clear_signal_handler (&priv->direction_changed_id, self);
g_clear_signal_handler (&priv->resource_scale_changed_id, self);
g_clear_signal_handler (&priv->settings_changed_id,
clutter_get_default_backend ());
if (priv->direction_changed_id)
{
g_signal_handler_disconnect (self, priv->direction_changed_id);
priv->direction_changed_id = 0;
}
g_clear_handle_id (&priv->password_hint_id, g_source_remove);
if (priv->resource_scale_changed_id)
{
g_signal_handler_disconnect (self, priv->resource_scale_changed_id);
priv->resource_scale_changed_id = 0;
}
if (priv->settings_changed_id)
{
g_signal_handler_disconnect (clutter_get_default_backend (),
priv->settings_changed_id);
priv->settings_changed_id = 0;
}
if (priv->password_hint_id)
{
g_source_remove (priv->password_hint_id);
priv->password_hint_id = 0;
}
clutter_text_set_buffer (self, NULL);
@@ -2453,7 +2464,8 @@ clutter_text_key_press (ClutterActor *actor,
if (priv->show_password_hint)
{
g_clear_handle_id (&priv->password_hint_id, g_source_remove);
if (priv->password_hint_id != 0)
g_source_remove (priv->password_hint_id);
priv->password_hint_visible = TRUE;
priv->password_hint_id =

View File

@@ -0,0 +1,130 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_TEXTURE_H__
#define __CLUTTER_TEXTURE_H__
#include <cogl/cogl.h>
#include <clutter/clutter-actor.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_TEXTURE (clutter_texture_get_type ())
#define CLUTTER_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_TEXTURE, ClutterTexture))
#define CLUTTER_TEXTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_TEXTURE, ClutterTextureClass))
#define CLUTTER_IS_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_TEXTURE))
#define CLUTTER_IS_TEXTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_TEXTURE))
#define CLUTTER_TEXTURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_TEXTURE, ClutterTextureClass))
/**
* ClutterTextureError:
* @CLUTTER_TEXTURE_ERROR_OUT_OF_MEMORY: OOM condition
* @CLUTTER_TEXTURE_ERROR_NO_YUV: YUV operation attempted but no YUV support
* found
* @CLUTTER_TEXTURE_ERROR_BAD_FORMAT: The requested format for
* clutter_texture_set_from_rgb_data is unsupported.
*
* Error enumeration for #ClutterTexture
*
* Since: 0.4
*/
typedef enum
{
CLUTTER_TEXTURE_ERROR_OUT_OF_MEMORY,
CLUTTER_TEXTURE_ERROR_NO_YUV,
CLUTTER_TEXTURE_ERROR_BAD_FORMAT
} ClutterTextureError;
/**
* CLUTTER_TEXTURE_ERROR:
*
* Error domain for #ClutterTexture errors
*
* Since: 0.4
*/
#define CLUTTER_TEXTURE_ERROR (clutter_texture_error_quark ())
CLUTTER_EXPORT
GQuark clutter_texture_error_quark (void);
typedef struct _ClutterTexture ClutterTexture;
typedef struct _ClutterTextureClass ClutterTextureClass;
typedef struct _ClutterTexturePrivate ClutterTexturePrivate;
/**
* ClutterTexture:
*
* The #ClutterTexture structure contains only private data
* and should be accessed using the provided API
*
* Since: 0.2
*/
struct _ClutterTexture
{
/*< private >*/
ClutterActor parent;
ClutterTexturePrivate *priv;
};
/**
* ClutterTextureClass:
* @size_change: handler for the #ClutterTexture::size-change signal
* @pixbuf_change: handler for the #ClutterTexture::pixbuf-change signal
* @load_finished: handler for the #ClutterTexture::load-finished signal
*
* The #ClutterTextureClass structure contains only private data
*
* Since: 0.2
*/
struct _ClutterTextureClass
{
/*< private >*/
ClutterActorClass parent_class;
/*< public >*/
void (* size_change) (ClutterTexture *texture,
gint width,
gint height);
void (* pixbuf_change) (ClutterTexture *texture);
void (* load_finished) (ClutterTexture *texture,
const GError *error);
/*< private >*/
/* padding, for future expansion */
void (*_clutter_texture1) (void);
void (*_clutter_texture2) (void);
void (*_clutter_texture3) (void);
void (*_clutter_texture4) (void);
void (*_clutter_texture5) (void);
};
CLUTTER_EXPORT
GType clutter_texture_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __CLUTTER_TEXTURE_H__ */

View File

@@ -27,15 +27,15 @@
#include "clutter-virtual-input-device.h"
#include "clutter-enum-types.h"
#include "clutter-device-manager.h"
#include "clutter-private.h"
#include "clutter-seat.h"
#include "clutter-enum-types.h"
enum
{
PROP_0,
PROP_SEAT,
PROP_DEVICE_MANAGER,
PROP_DEVICE_TYPE,
PROP_LAST
@@ -45,7 +45,7 @@ static GParamSpec *obj_props[PROP_LAST];
typedef struct _ClutterVirtualInputDevicePrivate
{
ClutterSeat *seat;
ClutterDeviceManager *manager;
ClutterInputDeviceType device_type;
} ClutterVirtualInputDevicePrivate;
@@ -181,6 +181,23 @@ clutter_virtual_input_device_notify_touch_up (ClutterVirtualInputDevice *virtual
slot);
}
/**
* clutter_virtual_input_device_get_manager:
* @virtual_device: a virtual device
*
* Gets the device manager of this virtual device.
*
* Returns: (transfer none): The #ClutterDeviceManager of this virtual device
**/
ClutterDeviceManager *
clutter_virtual_input_device_get_manager (ClutterVirtualInputDevice *virtual_device)
{
ClutterVirtualInputDevicePrivate *priv =
clutter_virtual_input_device_get_instance_private (virtual_device);
return priv->manager;
}
int
clutter_virtual_input_device_get_device_type (ClutterVirtualInputDevice *virtual_device)
{
@@ -203,8 +220,8 @@ clutter_virtual_input_device_get_property (GObject *object,
switch (prop_id)
{
case PROP_SEAT:
g_value_set_object (value, priv->seat);
case PROP_DEVICE_MANAGER:
g_value_set_object (value, priv->manager);
break;
case PROP_DEVICE_TYPE:
g_value_set_enum (value, priv->device_type);
@@ -228,8 +245,8 @@ clutter_virtual_input_device_set_property (GObject *object,
switch (prop_id)
{
case PROP_SEAT:
priv->seat = g_value_get_object (value);
case PROP_DEVICE_MANAGER:
priv->manager = g_value_get_object (value);
break;
case PROP_DEVICE_TYPE:
priv->device_type = g_value_get_enum (value);
@@ -253,11 +270,11 @@ clutter_virtual_input_device_class_init (ClutterVirtualInputDeviceClass *klass)
object_class->get_property = clutter_virtual_input_device_get_property;
object_class->set_property = clutter_virtual_input_device_set_property;
obj_props[PROP_SEAT] =
g_param_spec_object ("seat",
P_("Seat"),
P_("Seat"),
CLUTTER_TYPE_SEAT,
obj_props[PROP_DEVICE_MANAGER] =
g_param_spec_object ("device-manager",
P_("Device Manager"),
P_("The device manager instance"),
CLUTTER_TYPE_DEVICE_MANAGER,
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
obj_props[PROP_DEVICE_TYPE] =
g_param_spec_enum ("device-type",

View File

@@ -27,7 +27,7 @@
#include <glib-object.h>
#include <stdint.h>
#include "clutter-seat.h"
#include "clutter-device-manager.h"
#define CLUTTER_TYPE_VIRTUAL_INPUT_DEVICE (clutter_virtual_input_device_get_type ())
@@ -169,6 +169,9 @@ void clutter_virtual_input_device_notify_touch_up (ClutterVirtualInputDevice *vi
uint64_t time_us,
int slot);
CLUTTER_EXPORT
ClutterDeviceManager * clutter_virtual_input_device_get_manager (ClutterVirtualInputDevice *virtual_device);
CLUTTER_EXPORT
int clutter_virtual_input_device_get_device_type (ClutterVirtualInputDevice *virtual_device);

View File

@@ -56,6 +56,7 @@
#include "clutter-content.h"
#include "clutter-deform-effect.h"
#include "clutter-desaturate-effect.h"
#include "clutter-device-manager.h"
#include "clutter-drag-action.h"
#include "clutter-drop-action.h"
#include "clutter-effect.h"
@@ -102,6 +103,7 @@
#include "clutter-stage-manager.h"
#include "clutter-stage-view.h"
#include "clutter-tap-action.h"
#include "clutter-texture.h"
#include "clutter-text.h"
#include "clutter-timeline.h"
#include "clutter-transition-group.h"

View File

@@ -563,7 +563,11 @@ paint_stage (ClutterStageCogl *stage_cogl,
_clutter_stage_maybe_setup_viewport (stage, view);
_clutter_stage_paint_view (stage, view, &paint_rect);
clutter_stage_view_after_paint (view, &paint_rect);
if (clutter_stage_view_get_onscreen (view) !=
clutter_stage_view_get_framebuffer (view))
{
clutter_stage_view_blit_offscreen (view, &paint_rect);
}
}
static void
@@ -796,7 +800,7 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
swap_with_damage = FALSE;
if (has_buffer_age)
{
if (use_clipped_redraw && !clip_region_empty)
if (use_clipped_redraw)
{
int age;
@@ -879,34 +883,27 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
cairo_rectangle_int_t clip_rect;
cairo_rectangle_int_t scissor_rect;
cairo_region_get_extents (fb_clip_region, &clip_rect);
calculate_scissor_region (&clip_rect,
subpixel_compensation,
fb_width, fb_height,
&scissor_rect);
CLUTTER_NOTE (CLIPPING,
"Stage clip pushed: x=%d, y=%d, width=%d, height=%d\n",
scissor_rect.x,
scissor_rect.y,
scissor_rect.width,
scissor_rect.height);
stage_cogl->using_clipped_redraw = TRUE;
if (cairo_region_num_rectangles (fb_clip_region) == 1)
{
cairo_region_get_extents (fb_clip_region, &clip_rect);
calculate_scissor_region (&clip_rect,
subpixel_compensation,
fb_width, fb_height,
&scissor_rect);
CLUTTER_NOTE (CLIPPING,
"Stage clip pushed: x=%d, y=%d, width=%d, height=%d\n",
scissor_rect.x,
scissor_rect.y,
scissor_rect.width,
scissor_rect.height);
cogl_framebuffer_push_scissor_clip (fb,
scissor_rect.x,
scissor_rect.y,
scissor_rect.width,
scissor_rect.height);
}
else
{
cogl_framebuffer_push_region_clip (fb, fb_clip_region);
}
cogl_framebuffer_push_scissor_clip (fb,
scissor_rect.x,
scissor_rect.y,
scissor_rect.width,
scissor_rect.height);
paint_stage (stage_cogl, view, fb_clip_region);

View File

@@ -33,9 +33,16 @@
G_BEGIN_DECLS
CLUTTER_DEPRECATED
guint32 clutter_actor_get_gid (ClutterActor *self);
CLUTTER_DEPRECATED
ClutterActor * clutter_get_actor_by_gid (guint32 id_);
CLUTTER_DEPRECATED_FOR(clutter_actor_remove_child() and clutter_actor_add_child())
void clutter_actor_reparent (ClutterActor *self,
ClutterActor *new_parent);
CLUTTER_DEPRECATED_FOR(clutter_actor_add_child)
void clutter_actor_set_parent (ClutterActor *self,
ClutterActor *parent);
@@ -43,6 +50,20 @@ void clutter_actor_set_parent (ClutterActor
CLUTTER_DEPRECATED_FOR(clutter_actor_remove_child)
void clutter_actor_unparent (ClutterActor *self);
CLUTTER_DEPRECATED_FOR(clutter_actor_set_child_above_sibling)
void clutter_actor_raise (ClutterActor *self,
ClutterActor *below);
CLUTTER_DEPRECATED_FOR(clutter_actor_set_child_below_sibling)
void clutter_actor_lower (ClutterActor *self,
ClutterActor *above);
CLUTTER_DEPRECATED_FOR(clutter_actor_set_child_above_sibling() with NULL sibling)
void clutter_actor_raise_top (ClutterActor *self);
CLUTTER_DEPRECATED_FOR(clutter_actor_set_child_below_sibling() with NULL sibling)
void clutter_actor_lower_bottom (ClutterActor *self);
CLUTTER_DEPRECATED
void clutter_actor_push_internal (ClutterActor *self);
@@ -52,6 +73,9 @@ void clutter_actor_pop_internal (ClutterActor
CLUTTER_DEPRECATED
void clutter_actor_show_all (ClutterActor *self);
CLUTTER_DEPRECATED
void clutter_actor_hide_all (ClutterActor *self);
CLUTTER_DEPRECATED_FOR(clutter_actor_set_z_position)
void clutter_actor_set_depth (ClutterActor *self,
gfloat depth);
@@ -85,6 +109,11 @@ void clutter_actor_set_scale_full (ClutterActor
gdouble scale_y,
gfloat center_x,
gfloat center_y);
CLUTTER_DEPRECATED_FOR(clutter_actor_set_scale and clutter_actor_set_pivot_point)
void clutter_actor_set_scale_with_gravity (ClutterActor *self,
gdouble scale_x,
gdouble scale_y,
ClutterGravity gravity);
CLUTTER_DEPRECATED_FOR(clutter_actor_get_pivot_point)
void clutter_actor_get_scale_center (ClutterActor *self,
gfloat *center_x,
@@ -101,6 +130,10 @@ void clutter_actor_move_anchor_point (ClutterActor
gfloat anchor_x,
gfloat anchor_y);
CLUTTER_DEPRECATED
void clutter_actor_get_anchor_point (ClutterActor *self,
gfloat *anchor_x,
gfloat *anchor_y);
CLUTTER_DEPRECATED
ClutterGravity clutter_actor_get_anchor_point_gravity (ClutterActor *self);
CLUTTER_DEPRECATED
void clutter_actor_set_anchor_point_from_gravity (ClutterActor *self,
@@ -108,6 +141,9 @@ void clutter_actor_set_anchor_point_from_gravity (ClutterActor
CLUTTER_DEPRECATED
void clutter_actor_move_anchor_point_from_gravity (ClutterActor *self,
ClutterGravity gravity);
CLUTTER_DEPRECATED
void clutter_actor_get_transformation_matrix (ClutterActor *self,
ClutterMatrix *matrix);
G_END_DECLS

View File

@@ -43,8 +43,9 @@
*
* You should provide a #ClutterTimeline and bind it to the #ClutterAlpha
* instance using clutter_alpha_set_timeline(). You should also set an
* "animation mode", by using the #ClutterAnimationMode values that
* Clutter provides.
* "animation mode", either by using the #ClutterAnimationMode values that
* Clutter itself provides or by registering custom functions using
* clutter_alpha_register_func().
*
* Instead of a #ClutterAnimationMode you may provide a function returning
* the alpha value depending on the progress of the timeline, using
@@ -361,8 +362,9 @@ clutter_alpha_class_init (ClutterAlphaClass *klass)
/**
* ClutterAlpha:mode:
*
* The progress function logical id - a value from the
* #ClutterAnimationMode enumeration.
* The progress function logical id - either a value from the
* #ClutterAnimationMode enumeration or a value returned by
* clutter_alpha_register_func().
*
* If %CLUTTER_CUSTOM_MODE is used then the function set using
* clutter_alpha_set_closure() or clutter_alpha_set_func()
@@ -677,6 +679,44 @@ clutter_alpha_new_full (ClutterTimeline *timeline,
NULL);
}
/**
* clutter_alpha_new_with_func:
* @timeline: a #ClutterTimeline
* @func: a #ClutterAlphaFunc
* @data: data to pass to the function, or %NULL
* @destroy: function to call when removing the alpha function, or %NULL
*
* Creates a new #ClutterAlpha instances and sets the timeline
* and the alpha function.
*
* This function will not register @func as a global alpha function.
*
* See also clutter_alpha_set_timeline() and clutter_alpha_set_func().
*
* Return value: the newly created #ClutterAlpha
*
* Since: 1.0
*
* Deprecated: 1.12: Use #ClutterTimeline instead
*/
ClutterAlpha *
clutter_alpha_new_with_func (ClutterTimeline *timeline,
ClutterAlphaFunc func,
gpointer data,
GDestroyNotify destroy)
{
ClutterAlpha *retval;
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), NULL);
g_return_val_if_fail (func != NULL, NULL);
retval = clutter_alpha_new ();
clutter_alpha_set_timeline (retval, timeline);
clutter_alpha_set_func (retval, func, data, destroy);
return retval;
}
/**
* clutter_alpha_get_mode:
* @alpha: a #ClutterAlpha
@@ -731,7 +771,8 @@ clutter_alpha_easing_func (ClutterAlpha *alpha,
* @mode: a #ClutterAnimationMode
*
* Sets the progress function of @alpha using the symbolic value
* of @mode, as taken by the #ClutterAnimationMode enumeration.
* of @mode, as taken by the #ClutterAnimationMode enumeration or
* using the value returned by clutter_alpha_register_func().
*
* Since: 1.0
*
@@ -785,7 +826,9 @@ clutter_alpha_set_mode (ClutterAlpha *alpha,
if (G_UNLIKELY (clutter_alphas == NULL))
{
g_warning ("No alpha functions defined for ClutterAlpha to use. ");
g_warning ("No alpha functions defined for ClutterAlpha to use. "
"Use clutter_alpha_register_func() to register an "
"alpha function.");
return;
}
@@ -817,3 +860,81 @@ clutter_alpha_set_mode (ClutterAlpha *alpha,
g_object_notify_by_pspec (G_OBJECT (alpha), obj_props[PROP_MODE]);
}
static gulong
register_alpha_internal (AlphaData *alpha_data)
{
if (G_UNLIKELY (clutter_alphas == NULL))
clutter_alphas = g_ptr_array_new ();
g_ptr_array_add (clutter_alphas, alpha_data);
return clutter_alphas->len + CLUTTER_ANIMATION_LAST;
}
/**
* clutter_alpha_register_func: (skip)
* @func: a #ClutterAlphaFunc
* @data: user data to pass to @func, or %NULL
*
* Registers a global alpha function and returns its logical id
* to be used by clutter_alpha_set_mode() or by #ClutterAnimation.
*
* The logical id is always greater than %CLUTTER_ANIMATION_LAST.
*
* Return value: the logical id of the alpha function
*
* Since: 1.0
*
* Deprecated: 1.12: There is no direct replacement for this
* function. Use clutter_timeline_set_progress_func() on each
* specific #ClutterTimeline instance
*/
gulong
clutter_alpha_register_func (ClutterAlphaFunc func,
gpointer data)
{
AlphaData *alpha_data;
g_return_val_if_fail (func != NULL, 0);
alpha_data = g_slice_new (AlphaData);
alpha_data->closure_set = FALSE;
alpha_data->func = func;
alpha_data->data = data;
return register_alpha_internal (alpha_data);
}
/**
* clutter_alpha_register_closure: (rename-to clutter_alpha_register_func)
* @closure: a #GClosure
*
* #GClosure variant of clutter_alpha_register_func().
*
* Registers a global alpha function and returns its logical id
* to be used by clutter_alpha_set_mode() or by #ClutterAnimation.
*
* The logical id is always greater than %CLUTTER_ANIMATION_LAST.
*
* Return value: the logical id of the alpha function
*
* Since: 1.0
*
* Deprecated: 1.12: There is no direct replacement for this
* function. Use clutter_timeline_set_progress_func() on each
* specific #ClutterTimeline instance
*/
gulong
clutter_alpha_register_closure (GClosure *closure)
{
AlphaData *alpha_data;
g_return_val_if_fail (closure != NULL, 0);
alpha_data = g_slice_new (AlphaData);
alpha_data->closure_set = TRUE;
alpha_data->closure = closure;
return register_alpha_internal (alpha_data);
}

View File

@@ -113,6 +113,12 @@ CLUTTER_DEPRECATED
ClutterAlpha * clutter_alpha_new_full (ClutterTimeline *timeline,
gulong mode);
CLUTTER_DEPRECATED
ClutterAlpha * clutter_alpha_new_with_func (ClutterTimeline *timeline,
ClutterAlphaFunc func,
gpointer data,
GDestroyNotify destroy);
CLUTTER_DEPRECATED
gdouble clutter_alpha_get_alpha (ClutterAlpha *alpha);
CLUTTER_DEPRECATED
void clutter_alpha_set_func (ClutterAlpha *alpha,
@@ -133,6 +139,12 @@ void clutter_alpha_set_mode (ClutterAlpha *alpha,
CLUTTER_DEPRECATED
gulong clutter_alpha_get_mode (ClutterAlpha *alpha);
CLUTTER_DEPRECATED
gulong clutter_alpha_register_func (ClutterAlphaFunc func,
gpointer data);
CLUTTER_DEPRECATED
gulong clutter_alpha_register_closure (GClosure *closure);
G_END_DECLS
#endif /* __CLUTTER_ALPHA_H__ */

View File

@@ -0,0 +1,47 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author:
* Emmanuele Bassi <ebassi@linux.intel.com>
*/
#ifndef __CLUTTER_ANIMATABLE_DEPRECATED_H__
#define __CLUTTER_ANIMATABLE_DEPRECATED_H__
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#include <clutter/clutter-animatable.h>
G_BEGIN_DECLS
CLUTTER_DEPRECATED_FOR(clutter_animatable_interpolate_value)
gboolean clutter_animatable_animate_property (ClutterAnimatable *animatable,
ClutterAnimation *animation,
const gchar *property_name,
const GValue *initial_value,
const GValue *final_value,
gdouble progress,
GValue *value);
G_END_DECLS
#endif /* __CLUTTER_ANIMATABLE_DEPRECATED_H__ */

View File

@@ -50,6 +50,9 @@
* emitted if #ClutterAnimation:loop is set to %TRUE - that is, a looping
* animation never completes.
*
* If your animation depends on user control you can force its completion
* using clutter_animation_completed().
*
* If the #GObject instance bound to a #ClutterAnimation implements the
* #ClutterAnimatable interface it is possible for that instance to
* control the way the initial and final states are interpolated.
@@ -635,6 +638,231 @@ clutter_animation_update_property_internal (ClutterAnimation *animation,
g_object_ref_sink (interval));
}
static GParamSpec *
clutter_animation_validate_bind (ClutterAnimation *animation,
const char *property_name,
GType argtype)
{
ClutterAnimationPrivate *priv;
GParamSpec *pspec;
GType pspec_type;
priv = animation->priv;
if (G_UNLIKELY (!priv->object))
{
g_warning ("Cannot bind property '%s': the animation has no "
"object set. You need to call clutter_animation_set_object() "
"first to be able to bind a property",
property_name);
return NULL;
}
if (G_UNLIKELY (clutter_animation_has_property (animation, property_name)))
{
g_warning ("Cannot bind property '%s': the animation already has "
"a bound property with the same name",
property_name);
return NULL;
}
if (CLUTTER_IS_ANIMATABLE (priv->object))
{
ClutterAnimatable *animatable = CLUTTER_ANIMATABLE (priv->object);
pspec = clutter_animatable_find_property (animatable, property_name);
}
else
{
GObjectClass *klass = G_OBJECT_GET_CLASS (priv->object);
pspec = g_object_class_find_property (klass, property_name);
}
if (pspec == NULL)
{
g_warning ("Cannot bind property '%s': objects of type '%s' have "
"no such property",
property_name,
g_type_name (G_OBJECT_TYPE (priv->object)));
return NULL;
}
if (!(pspec->flags & G_PARAM_WRITABLE))
{
g_warning ("Cannot bind property '%s': the property is not writable",
property_name);
return NULL;
}
pspec_type = G_PARAM_SPEC_VALUE_TYPE (pspec);
if (g_value_type_transformable (argtype, pspec_type))
return pspec;
else
{
g_warning ("Cannot bind property '%s': the interval value of "
"type '%s' is not compatible with the property value "
"of type '%s'",
property_name,
g_type_name (argtype),
g_type_name (pspec_type));
return NULL;
}
}
/**
* clutter_animation_bind_interval:
* @animation: a #ClutterAnimation
* @property_name: the property to control
* @interval: (transfer full): a #ClutterInterval
*
* Binds @interval to the @property_name of the #GObject
* attached to @animation. The #ClutterAnimation will take
* ownership of the passed #ClutterInterval. For more information
* about animations, see clutter_actor_animate().
*
* If you need to update the interval instance use
* clutter_animation_update_interval() instead.
*
* Return value: (transfer none): The animation itself.
* Since: 1.0
* Deprecated: 1.12: Use #ClutterPropertyTransition instead
*/
ClutterAnimation *
clutter_animation_bind_interval (ClutterAnimation *animation,
const gchar *property_name,
ClutterInterval *interval)
{
GParamSpec *pspec;
g_return_val_if_fail (CLUTTER_IS_ANIMATION (animation), NULL);
g_return_val_if_fail (property_name != NULL, NULL);
g_return_val_if_fail (CLUTTER_IS_INTERVAL (interval), NULL);
pspec = clutter_animation_validate_bind (animation, property_name,
clutter_interval_get_value_type (interval));
if (pspec == NULL)
return NULL;
clutter_animation_bind_property_internal (animation, property_name,
pspec,
interval);
return animation;
}
/**
* clutter_animation_bind:
* @animation: a #ClutterAnimation
* @property_name: the property to control
* @final: The final value of the property
*
* Adds a single property with name @property_name to the
* animation @animation. For more information about animations,
* see clutter_actor_animate().
*
* This method returns the animation primarily to make chained
* calls convenient in language bindings.
*
* Return value: (transfer none): The animation itself.
*
* Since: 1.0
* Deprecated: 1.12: Use #ClutterPropertyTransition instead
*/
ClutterAnimation *
clutter_animation_bind (ClutterAnimation *animation,
const gchar *property_name,
const GValue *final)
{
ClutterAnimationPrivate *priv;
GParamSpec *pspec;
ClutterInterval *interval;
GType type;
GValue initial = G_VALUE_INIT;
GValue real_final = G_VALUE_INIT;
g_return_val_if_fail (CLUTTER_IS_ANIMATION (animation), NULL);
g_return_val_if_fail (property_name != NULL, NULL);
priv = animation->priv;
type = G_VALUE_TYPE (final);
pspec = clutter_animation_validate_bind (animation, property_name, type);
if (pspec == NULL)
return NULL;
g_value_init (&real_final, G_PARAM_SPEC_VALUE_TYPE (pspec));
if (!g_value_transform (final, &real_final))
{
g_value_unset (&real_final);
g_warning ("Unable to transform the value of type '%s' to a value "
"of '%s' compatible with the property '%s'of the object "
"of type '%s'",
g_type_name (type),
g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)),
property_name,
G_OBJECT_TYPE_NAME (priv->object));
return NULL;
}
g_value_init (&initial, G_PARAM_SPEC_VALUE_TYPE (pspec));
if (CLUTTER_IS_ANIMATABLE (priv->object))
clutter_animatable_get_initial_state (CLUTTER_ANIMATABLE (priv->object),
property_name,
&initial);
else
g_object_get_property (priv->object, property_name, &initial);
interval = clutter_interval_new_with_values (G_PARAM_SPEC_VALUE_TYPE (pspec),
&initial,
&real_final);
g_value_unset (&initial);
g_value_unset (&real_final);
clutter_animation_bind_property_internal (animation, property_name,
pspec,
interval);
return animation;
}
/**
* clutter_animation_unbind_property:
* @animation: a #ClutterAnimation
* @property_name: name of the property
*
* Removes @property_name from the list of animated properties.
*
* Since: 1.0
* Deprecated: 1.12: Use #ClutterPropertyTransition instead
*/
void
clutter_animation_unbind_property (ClutterAnimation *animation,
const gchar *property_name)
{
ClutterAnimationPrivate *priv;
g_return_if_fail (CLUTTER_IS_ANIMATION (animation));
g_return_if_fail (property_name != NULL);
priv = animation->priv;
if (!clutter_animation_has_property (animation, property_name))
{
g_warning ("Cannot unbind property '%s': the animation has "
"no bound property with that name",
property_name);
return;
}
g_hash_table_remove (priv->properties, property_name);
}
/**
* clutter_animation_has_property:
* @animation: a #ClutterAnimation
@@ -662,6 +890,137 @@ clutter_animation_has_property (ClutterAnimation *animation,
return g_hash_table_lookup (priv->properties, property_name) != NULL;
}
/**
* clutter_animation_update_interval:
* @animation: a #ClutterAnimation
* @property_name: name of the property
* @interval: a #ClutterInterval
*
* Changes the @interval for @property_name. The #ClutterAnimation
* will take ownership of the passed #ClutterInterval.
*
* Since: 1.0
* Deprecated: 1.12: Use #ClutterPropertyTransition instead
*/
void
clutter_animation_update_interval (ClutterAnimation *animation,
const gchar *property_name,
ClutterInterval *interval)
{
ClutterAnimationPrivate *priv;
GParamSpec *pspec;
GType pspec_type, int_type;
g_return_if_fail (CLUTTER_IS_ANIMATION (animation));
g_return_if_fail (property_name != NULL);
g_return_if_fail (CLUTTER_IS_INTERVAL (interval));
priv = animation->priv;
if (!clutter_animation_has_property (animation, property_name))
{
g_warning ("Cannot update property '%s': the animation has "
"no bound property with that name",
property_name);
return;
}
if (CLUTTER_IS_ANIMATABLE (priv->object))
{
ClutterAnimatable *animatable = CLUTTER_ANIMATABLE (priv->object);
pspec = clutter_animatable_find_property (animatable, property_name);
}
else
{
GObjectClass *klass = G_OBJECT_GET_CLASS (priv->object);
pspec = g_object_class_find_property (klass, property_name);
}
if (pspec == NULL)
{
g_warning ("Cannot update property '%s': objects of type '%s' have "
"no such property",
property_name,
g_type_name (G_OBJECT_TYPE (priv->object)));
return;
}
pspec_type = G_PARAM_SPEC_VALUE_TYPE (pspec);
int_type = clutter_interval_get_value_type (interval);
if (!g_value_type_compatible (int_type, pspec_type) ||
!g_value_type_transformable (int_type, pspec_type))
{
g_warning ("Cannot update property '%s': the interval value of "
"type '%s' is not compatible with the property value "
"of type '%s'",
property_name,
g_type_name (int_type),
g_type_name (pspec_type));
return;
}
clutter_animation_update_property_internal (animation, property_name,
pspec,
interval);
}
/**
* clutter_animation_update:
* @animation: a #ClutterAnimation
* @property_name: name of the property
* @final: The final value of the property
*
* Updates the @final value of the interval for @property_name
*
* Return value: (transfer none): The animation itself.
*
* Since: 1.0
* Deprecated: 1.12: Use #ClutterPropertyTransition instead
*/
ClutterAnimation *
clutter_animation_update (ClutterAnimation *animation,
const gchar *property_name,
const GValue *final)
{
ClutterInterval *interval;
GType int_type;
g_return_val_if_fail (CLUTTER_IS_ANIMATION (animation), NULL);
g_return_val_if_fail (property_name != NULL, NULL);
g_return_val_if_fail (final != NULL, NULL);
g_return_val_if_fail (G_VALUE_TYPE (final) != G_TYPE_INVALID, NULL);
interval = clutter_animation_get_interval (animation, property_name);
if (interval == NULL)
{
g_warning ("Cannot update property '%s': the animation has "
"no bound property with that name",
property_name);
return NULL;
}
int_type = clutter_interval_get_value_type (interval);
if (!g_value_type_compatible (G_VALUE_TYPE (final), int_type) ||
!g_value_type_transformable (G_VALUE_TYPE (final), int_type))
{
g_warning ("Cannot update property '%s': the interval value of "
"type '%s' is not compatible with the property value "
"of type '%s'",
property_name,
g_type_name (int_type),
g_type_name (G_VALUE_TYPE (final)));
return NULL;
}
clutter_interval_set_final_value (interval, final);
return animation;
}
/**
* clutter_animation_get_interval:
* @animation: a #ClutterAnimation
@@ -925,6 +1284,10 @@ out:
* set the duration with clutter_animation_set_duration() and the
* easing mode using clutter_animation_set_mode().
*
* Use clutter_animation_bind() or clutter_animation_bind_interval()
* to define the properties to be animated. The interval and the
* animated properties can be updated at runtime.
*
* The clutter_actor_animate() and relative family of functions provide
* an easy way to animate a #ClutterActor and automatically manage the
* lifetime of a #ClutterAnimation instance, so you should consider using
@@ -978,6 +1341,25 @@ clutter_animation_set_object (ClutterAnimation *animation,
g_object_notify_by_pspec (G_OBJECT (animation), obj_props[PROP_OBJECT]);
}
/**
* clutter_animation_get_object:
* @animation: a #ClutterAnimation
*
* Retrieves the #GObject attached to @animation.
*
* Return value: (transfer none): a #GObject
*
* Since: 1.0
* Deprecated: 1.12: Use #ClutterPropertyTransition instead
*/
GObject *
clutter_animation_get_object (ClutterAnimation *animation)
{
g_return_val_if_fail (CLUTTER_IS_ANIMATION (animation), NULL);
return animation->priv->object;
}
/**
* clutter_animation_set_mode:
* @animation: a #ClutterAnimation
@@ -1268,6 +1650,76 @@ clutter_animation_get_timeline (ClutterAnimation *animation)
return clutter_animation_get_timeline_internal (animation);
}
/**
* clutter_animation_set_alpha:
* @animation: a #ClutterAnimation
* @alpha: a #ClutterAlpha, or %NULL to unset the current #ClutterAlpha
*
* Sets @alpha as the #ClutterAlpha used by @animation.
*
* If @alpha is not %NULL, the #ClutterAnimation will take ownership
* of the #ClutterAlpha instance.
*
* Since: 1.0
*
* Deprecated: 1.10: Use clutter_animation_get_timeline() and
* clutter_timeline_set_progress_mode() instead.
*/
void
clutter_animation_set_alpha (ClutterAnimation *animation,
ClutterAlpha *alpha)
{
g_return_if_fail (CLUTTER_IS_ANIMATION (animation));
g_return_if_fail (alpha == NULL || CLUTTER_IS_ALPHA (alpha));
clutter_animation_set_alpha_internal (animation, alpha);
}
/**
* clutter_animation_get_alpha:
* @animation: a #ClutterAnimation
*
* Retrieves the #ClutterAlpha used by @animation.
*
* Return value: (transfer none): the alpha object used by the animation
*
* Since: 1.0
*
* Deprecated: 1.10: Use clutter_animation_get_timeline() and
* clutter_timeline_get_progress_mode() instead.
*/
ClutterAlpha *
clutter_animation_get_alpha (ClutterAnimation *animation)
{
g_return_val_if_fail (CLUTTER_IS_ANIMATION (animation), NULL);
return clutter_animation_get_alpha_internal (animation);
}
/**
* clutter_animation_completed:
* @animation: a #ClutterAnimation
*
* Emits the ::completed signal on @animation
*
* When using this function with a #ClutterAnimation created
* by the clutter_actor_animate() family of functions, @animation
* will be unreferenced and it will not be valid anymore,
* unless g_object_ref() was called before calling this function
* or unless a reference was taken inside a handler for the
* #ClutterAnimation::completed signal
*
* Since: 1.0
* Deprecated: 1.12: Use #ClutterPropertyTransition instead
*/
void
clutter_animation_completed (ClutterAnimation *animation)
{
g_return_if_fail (CLUTTER_IS_ANIMATION (animation));
g_signal_emit (animation, animation_signals[COMPLETED], 0);
}
/*
* starts the timeline
*/
@@ -1401,6 +1853,55 @@ done:
g_value_unset (&real_value);
}
static void
clutter_animation_setupv (ClutterAnimation *animation,
gint n_properties,
const gchar * const properties[],
const GValue *values)
{
ClutterAnimationPrivate *priv = animation->priv;
ClutterAnimatable *animatable = NULL;
GObjectClass *klass = NULL;
gint i;
if (CLUTTER_IS_ANIMATABLE (priv->object))
animatable = CLUTTER_ANIMATABLE (priv->object);
else
klass = G_OBJECT_GET_CLASS (priv->object);
for (i = 0; i < n_properties; i++)
{
const gchar *property_name = properties[i];
GParamSpec *pspec;
gboolean is_fixed = FALSE;
if (g_str_has_prefix (property_name, "fixed::"))
{
property_name += 7; /* strlen("fixed::") */
is_fixed = TRUE;
}
if (animatable != NULL)
pspec = clutter_animatable_find_property (animatable, property_name);
else
pspec = g_object_class_find_property (klass, property_name);
if (pspec == NULL)
{
g_warning ("Cannot bind property '%s': objects of type '%s' do "
"not have this property",
property_name,
g_type_name (G_OBJECT_TYPE (priv->object)));
break;
}
clutter_animation_setup_property (animation, property_name,
&values[i],
pspec,
is_fixed);
}
}
static const struct
{
const gchar *name;
@@ -1554,6 +2055,67 @@ animation_create_for_actor (ClutterActor *actor)
return animation;
}
/**
* clutter_actor_animate_with_alpha:
* @actor: a #ClutterActor
* @alpha: a #ClutterAlpha
* @first_property_name: the name of a property
* @...: a %NULL terminated list of property names and
* property values
*
* Animates the given list of properties of @actor between the current
* value for each property and a new final value. The animation has a
* definite behaviour given by the passed @alpha.
*
* See clutter_actor_animate() for further details.
*
* This function is useful if you want to use an existing #ClutterAlpha
* to animate @actor.
*
* Return value: (transfer none): a #ClutterAnimation object. The object is owned by the
* #ClutterActor and should not be unreferenced with g_object_unref()
*
* Since: 1.0
*
* Deprecated: 1.10: Use the implicit transition for animatable properties
* in #ClutterActor instead. See clutter_actor_save_easing_state(),
* clutter_actor_set_easing_mode(), clutter_actor_set_easing_duration(),
* clutter_actor_set_easing_delay(), and clutter_actor_restore_easing_state().
*/
ClutterAnimation *
clutter_actor_animate_with_alpha (ClutterActor *actor,
ClutterAlpha *alpha,
const gchar *first_property_name,
...)
{
ClutterAnimation *animation;
ClutterTimeline *timeline;
va_list args;
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), NULL);
g_return_val_if_fail (CLUTTER_IS_ALPHA (alpha), NULL);
g_return_val_if_fail (first_property_name != NULL, NULL);
timeline = clutter_alpha_get_timeline (alpha);
if (timeline == NULL)
{
g_warning ("The passed ClutterAlpha does not have an "
"associated ClutterTimeline.");
return NULL;
}
animation = animation_create_for_actor (actor);
clutter_animation_set_alpha_internal (animation, alpha);
va_start (args, first_property_name);
clutter_animation_setup_valist (animation, first_property_name, args);
va_end (args);
clutter_animation_start (animation);
return animation;
}
/**
* clutter_actor_animate_with_timeline:
* @actor: a #ClutterActor
@@ -1797,3 +2359,263 @@ clutter_actor_animate (ClutterActor *actor,
return animation;
}
/**
* clutter_actor_animatev:
* @actor: a #ClutterActor
* @mode: an animation mode logical id
* @duration: duration of the animation, in milliseconds
* @n_properties: number of property names and values
* @properties: (array length=n_properties) (element-type utf8): a vector
* containing the property names to set
* @values: (array length=n_properties): a vector containing the
* property values to set
*
* Animates the given list of properties of @actor between the current
* value for each property and a new final value. The animation has a
* definite duration and a speed given by the @mode.
*
* This is the vector-based variant of clutter_actor_animate(), useful
* for language bindings.
*
* Unlike clutter_actor_animate(), this function will not
* allow you to specify "signal::" names and callbacks.
*
* Return value: (transfer none): a #ClutterAnimation object. The object is
* owned by the #ClutterActor and should not be unreferenced with
* g_object_unref()
*
* Since: 1.0
* Deprecated: 1.12: Use the implicit transition for animatable properties
* in #ClutterActor instead. See clutter_actor_save_easing_state(),
* clutter_actor_set_easing_mode(), clutter_actor_set_easing_duration(),
* clutter_actor_set_easing_delay(), and clutter_actor_restore_easing_state().
*/
ClutterAnimation *
clutter_actor_animatev (ClutterActor *actor,
gulong mode,
guint duration,
gint n_properties,
const gchar * const properties[],
const GValue *values)
{
ClutterAnimation *animation;
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), NULL);
g_return_val_if_fail (mode != CLUTTER_CUSTOM_MODE, NULL);
g_return_val_if_fail (duration > 0, NULL);
g_return_val_if_fail (properties != NULL, NULL);
g_return_val_if_fail (values != NULL, NULL);
animation = animation_create_for_actor (actor);
clutter_animation_set_mode (animation, mode);
clutter_animation_set_duration (animation, duration);
clutter_animation_setupv (animation, n_properties, properties, values);
clutter_animation_start (animation);
return animation;
}
/**
* clutter_actor_animate_with_timelinev:
* @actor: a #ClutterActor
* @mode: an animation mode logical id
* @timeline: a #ClutterTimeline
* @n_properties: number of property names and values
* @properties: (array length=n_properties) (element-type utf8): a vector
* containing the property names to set
* @values: (array length=n_properties): a vector containing the
* property values to set
*
* Animates the given list of properties of @actor between the current
* value for each property and a new final value. The animation has a
* definite duration given by @timeline and a speed given by the @mode.
*
* See clutter_actor_animate() for further details.
*
* This function is useful if you want to use an existing timeline
* to animate @actor.
*
* This is the vector-based variant of clutter_actor_animate_with_timeline(),
* useful for language bindings.
*
* Unlike clutter_actor_animate_with_timeline(), this function
* will not allow you to specify "signal::" names and callbacks.
*
* Return value: (transfer none): a #ClutterAnimation object. The object is
* owned by the #ClutterActor and should not be unreferenced with
* g_object_unref()
*
* Since: 1.0
* Deprecated: 1.12: Use the implicit transition for animatable properties
* in #ClutterActor instead. See clutter_actor_save_easing_state(),
* clutter_actor_set_easing_mode(), clutter_actor_set_easing_duration(),
* clutter_actor_set_easing_delay(), and clutter_actor_restore_easing_state().
*/
ClutterAnimation *
clutter_actor_animate_with_timelinev (ClutterActor *actor,
gulong mode,
ClutterTimeline *timeline,
gint n_properties,
const gchar * const properties[],
const GValue *values)
{
ClutterAnimation *animation;
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), NULL);
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), NULL);
g_return_val_if_fail (properties != NULL, NULL);
g_return_val_if_fail (values != NULL, NULL);
animation = animation_create_for_actor (actor);
clutter_animation_set_mode (animation, mode);
clutter_animation_set_timeline (animation, timeline);
clutter_animation_setupv (animation, n_properties, properties, values);
clutter_animation_start (animation);
return animation;
}
/**
* clutter_actor_animate_with_alphav:
* @actor: a #ClutterActor
* @alpha: a #ClutterAlpha
* @n_properties: number of property names and values
* @properties: (array length=n_properties) (element-type utf8): a vector
* containing the property names to set
* @values: (array length=n_properties): a vector containing the
* property values to set
*
* Animates the given list of properties of @actor between the current
* value for each property and a new final value. The animation has a
* definite behaviour given by the passed @alpha.
*
* See clutter_actor_animate() for further details.
*
* This function is useful if you want to use an existing #ClutterAlpha
* to animate @actor.
*
* This is the vector-based variant of clutter_actor_animate_with_alpha(),
* useful for language bindings.
*
* Unlike clutter_actor_animate_with_alpha(), this function will
* not allow you to specify "signal::" names and callbacks.
*
* Return value: (transfer none): a #ClutterAnimation object. The object is owned by the
* #ClutterActor and should not be unreferenced with g_object_unref()
*
* Since: 1.0
*
* Deprecated: 1.10: Use the implicit transition for animatable properties
* in #ClutterActor instead. See clutter_actor_save_easing_state(),
* clutter_actor_set_easing_mode(), clutter_actor_set_easing_duration(),
* clutter_actor_set_easing_delay(), and clutter_actor_restore_easing_state().
*/
ClutterAnimation *
clutter_actor_animate_with_alphav (ClutterActor *actor,
ClutterAlpha *alpha,
gint n_properties,
const gchar * const properties[],
const GValue *values)
{
ClutterAnimation *animation;
ClutterTimeline *timeline;
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), NULL);
g_return_val_if_fail (CLUTTER_IS_ALPHA (alpha), NULL);
g_return_val_if_fail (properties != NULL, NULL);
g_return_val_if_fail (values != NULL, NULL);
timeline = clutter_alpha_get_timeline (alpha);
if (timeline == NULL)
{
g_warning ("The passed ClutterAlpha does not have an "
"associated ClutterTimeline.");
return NULL;
}
animation = animation_create_for_actor (actor);
clutter_animation_set_alpha_internal (animation, alpha);
clutter_animation_setupv (animation, n_properties, properties, values);
clutter_animation_start (animation);
return animation;
}
/**
* clutter_actor_get_animation:
* @actor: a #ClutterActor
*
* Retrieves the #ClutterAnimation used by @actor, if clutter_actor_animate()
* has been called on @actor.
*
* Return value: (transfer none): a #ClutterAnimation, or %NULL
*
* Since: 1.0
* Deprecated: 1.12: Use the implicit transition for animatable properties
* in #ClutterActor instead, and clutter_actor_get_transition() to retrieve
* the transition.
*/
ClutterAnimation *
clutter_actor_get_animation (ClutterActor *actor)
{
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), NULL);
return g_object_get_qdata (G_OBJECT (actor), quark_object_animation);
}
/**
* clutter_actor_detach_animation:
* @actor: a #ClutterActor
*
* Detaches the #ClutterAnimation used by @actor, if clutter_actor_animate()
* has been called on @actor.
*
* Once the animation has been detached, it loses a reference. If it was
* the only reference then the #ClutterAnimation becomes invalid.
*
* The #ClutterAnimation::completed signal will not be emitted.
*
* Since: 1.4
* Deprecated: 1.12: Use the implicit transition for animatable properties
* in #ClutterActor instead, and clutter_actor_remove_transition() to
* remove the transition.
*/
void
clutter_actor_detach_animation (ClutterActor *actor)
{
ClutterAnimation *animation;
ClutterAnimationPrivate *priv;
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
animation = g_object_get_qdata (G_OBJECT (actor), quark_object_animation);
if (animation == NULL)
return;
priv = animation->priv;
g_assert (priv->object == G_OBJECT (actor));
/* we can't call get_timeline_internal() here because it would be
* pointless to create a timeline on an animation we want to detach
*/
if (priv->alpha != NULL)
{
ClutterTimeline *timeline;
timeline = clutter_alpha_get_timeline (priv->alpha);
if (timeline != NULL)
clutter_timeline_stop (timeline);
}
/* disconnect the ::destroy handler added by animation_create_for_actor() */
g_signal_handlers_disconnect_by_func (actor,
G_CALLBACK (on_actor_destroy),
animation);
clutter_animation_set_object (animation, NULL);
/* drop the reference on the animation */
g_object_unref (animation);
}

View File

@@ -103,6 +103,8 @@ ClutterAnimation * clutter_animation_new (void);
CLUTTER_DEPRECATED_FOR(clutter_transition_set_animatable)
void clutter_animation_set_object (ClutterAnimation *animation,
GObject *object);
CLUTTER_DEPRECATED_FOR(clutter_transition_get_animatable)
GObject * clutter_animation_get_object (ClutterAnimation *animation);
CLUTTER_DEPRECATED_FOR(clutter_timeline_set_progress_mode)
void clutter_animation_set_mode (ClutterAnimation *animation,
gulong mode);
@@ -123,12 +125,38 @@ void clutter_animation_set_timeline (ClutterAnimatio
ClutterTimeline *timeline);
CLUTTER_DEPRECATED
ClutterTimeline * clutter_animation_get_timeline (ClutterAnimation *animation);
CLUTTER_DEPRECATED_FOR(clutter_animation_set_timeline)
void clutter_animation_set_alpha (ClutterAnimation *animation,
ClutterAlpha *alpha);
CLUTTER_DEPRECATED_FOR(clutter_animation_get_timeline)
ClutterAlpha * clutter_animation_get_alpha (ClutterAnimation *animation);
CLUTTER_DEPRECATED
ClutterAnimation * clutter_animation_bind (ClutterAnimation *animation,
const gchar *property_name,
const GValue *final);
CLUTTER_DEPRECATED_FOR(clutter_transition_set_interval)
ClutterAnimation * clutter_animation_bind_interval (ClutterAnimation *animation,
const gchar *property_name,
ClutterInterval *interval);
CLUTTER_DEPRECATED
gboolean clutter_animation_has_property (ClutterAnimation *animation,
const gchar *property_name);
CLUTTER_DEPRECATED
ClutterAnimation * clutter_animation_update (ClutterAnimation *animation,
const gchar *property_name,
const GValue *final);
CLUTTER_DEPRECATED
void clutter_animation_update_interval (ClutterAnimation *animation,
const gchar *property_name,
ClutterInterval *interval);
CLUTTER_DEPRECATED
void clutter_animation_unbind_property (ClutterAnimation *animation,
const gchar *property_name);
CLUTTER_DEPRECATED
ClutterInterval * clutter_animation_get_interval (ClutterAnimation *animation,
const gchar *property_name);
CLUTTER_DEPRECATED
void clutter_animation_completed (ClutterAnimation *animation);
/*
* ClutterActor API
@@ -146,6 +174,36 @@ ClutterAnimation * clutter_actor_animate_with_timeline (ClutterActor
ClutterTimeline *timeline,
const gchar *first_property_name,
...) G_GNUC_NULL_TERMINATED;
CLUTTER_DEPRECATED
ClutterAnimation * clutter_actor_animatev (ClutterActor *actor,
gulong mode,
guint duration,
gint n_properties,
const gchar * const properties[],
const GValue *values);
CLUTTER_DEPRECATED
ClutterAnimation * clutter_actor_animate_with_timelinev (ClutterActor *actor,
gulong mode,
ClutterTimeline *timeline,
gint n_properties,
const gchar * const properties[],
const GValue *values);
CLUTTER_DEPRECATED_FOR(clutter_actor_animate_with_timeline)
ClutterAnimation * clutter_actor_animate_with_alpha (ClutterActor *actor,
ClutterAlpha *alpha,
const gchar *first_property_name,
...) G_GNUC_NULL_TERMINATED;
CLUTTER_DEPRECATED_FOR(clutter_actor_animate_with_timelinev)
ClutterAnimation * clutter_actor_animate_with_alphav (ClutterActor *actor,
ClutterAlpha *alpha,
gint n_properties,
const gchar * const properties[],
const GValue *values);
CLUTTER_DEPRECATED
ClutterAnimation * clutter_actor_get_animation (ClutterActor *actor);
CLUTTER_DEPRECATED
void clutter_actor_detach_animation (ClutterActor *actor);
G_END_DECLS

View File

@@ -0,0 +1,56 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author:
* Emmanuele Bassi <ebassi@linux.intel.com>
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_BIN_LAYOUT_DEPRECATED_H__
#define __CLUTTER_BIN_LAYOUT_DEPRECATED_H__
#include <clutter/clutter-bin-layout.h>
G_BEGIN_DECLS
CLUTTER_DEPRECATED
void clutter_bin_layout_set_alignment (ClutterBinLayout *self,
ClutterActor *child,
ClutterBinAlignment x_align,
ClutterBinAlignment y_align);
CLUTTER_DEPRECATED
void clutter_bin_layout_get_alignment (ClutterBinLayout *self,
ClutterActor *child,
ClutterBinAlignment *x_align,
ClutterBinAlignment *y_align);
CLUTTER_DEPRECATED
void clutter_bin_layout_add (ClutterBinLayout *self,
ClutterActor *child,
ClutterBinAlignment x_align,
ClutterBinAlignment y_align);
G_END_DECLS
#endif /* __CLUTTER_BIN_LAYOUT_DEPRECATED_H__ */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,139 @@
/*
* Clutter
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By: Emmanuele Bassi <ebassi@linux.intel.com>
* Matthew Allum <mallum@o-hand.com>
* Chris Lord <chris@o-hand.com>
* Iain Holmes <iain@o-hand.com>
* Neil Roberts <neil@linux.intel.com>
*
* Copyright (C) 2008, 2009, 2010 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_CAIRO_TEXTURE_H__
#define __CLUTTER_CAIRO_TEXTURE_H__
#include <clutter/clutter-texture.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_CAIRO_TEXTURE (clutter_cairo_texture_get_type ())
#define CLUTTER_CAIRO_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_CAIRO_TEXTURE, ClutterCairoTexture))
#define CLUTTER_CAIRO_TEXTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_CAIRO_TEXTURE, ClutterCairoTextureClass))
#define CLUTTER_IS_CAIRO_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_CAIRO_TEXTURE))
#define CLUTTER_IS_CAIRO_TEXTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_CAIRO_TEXTURE))
#define CLUTTER_CAIRO_TEXTURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_CAIRO_TEXTURE, ClutterCairoTextureClass))
typedef struct _ClutterCairoTexture ClutterCairoTexture;
typedef struct _ClutterCairoTextureClass ClutterCairoTextureClass;
typedef struct _ClutterCairoTexturePrivate ClutterCairoTexturePrivate;
/**
* ClutterCairoTexture:
*
* The #ClutterCairoTexture struct contains only private data.
*
* Since: 1.0
*
* Deprecated: 1.12: Use #ClutterCanvas instead
*/
struct _ClutterCairoTexture
{
/*< private >*/
ClutterTexture parent_instance;
ClutterCairoTexturePrivate *priv;
};
/**
* ClutterCairoTextureClass:
* @create_surface: class handler for the #ClutterCairoTexture::create-surface
* signal
* @draw: class handler for the #ClutterCairoTexture::draw signal
*
* The #ClutterCairoTextureClass struct contains only private data.
*
* Since: 1.0
*
* Deprecated: 1.12: Use #ClutterCanvas instead
*/
struct _ClutterCairoTextureClass
{
/*< private >*/
ClutterTextureClass parent_class;
/*< public >*/
cairo_surface_t *(* create_surface) (ClutterCairoTexture *texture,
guint width,
guint height);
gboolean (* draw) (ClutterCairoTexture *texture,
cairo_t *cr);
/*< private >*/
void (*_clutter_cairo_3) (void);
void (*_clutter_cairo_4) (void);
};
CLUTTER_DEPRECATED_FOR(clutter_canvas_get_type)
GType clutter_cairo_texture_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_FOR(clutter_canvas_new)
ClutterActor * clutter_cairo_texture_new (guint width,
guint height);
CLUTTER_DEPRECATED_FOR(clutter_canvas_set_size)
void clutter_cairo_texture_set_surface_size (ClutterCairoTexture *self,
guint width,
guint height);
CLUTTER_DEPRECATED_FOR(clutter_canvas_get_size)
void clutter_cairo_texture_get_surface_size (ClutterCairoTexture *self,
guint *width,
guint *height);
CLUTTER_DEPRECATED
void clutter_cairo_texture_set_auto_resize (ClutterCairoTexture *self,
gboolean value);
CLUTTER_DEPRECATED
gboolean clutter_cairo_texture_get_auto_resize (ClutterCairoTexture *self);
CLUTTER_DEPRECATED
void clutter_cairo_texture_clear (ClutterCairoTexture *self);
CLUTTER_DEPRECATED
void clutter_cairo_texture_invalidate_rectangle (ClutterCairoTexture *self,
cairo_rectangle_int_t *rect);
CLUTTER_DEPRECATED
void clutter_cairo_texture_invalidate (ClutterCairoTexture *self);
CLUTTER_DEPRECATED_FOR(clutter_cairo_texture_invalidate_rectangle)
cairo_t * clutter_cairo_texture_create_region (ClutterCairoTexture *self,
gint x_offset,
gint y_offset,
gint width,
gint height);
CLUTTER_DEPRECATED_FOR(clutter_cairo_texture_invalidate)
cairo_t * clutter_cairo_texture_create (ClutterCairoTexture *self);
G_END_DECLS
#endif /* __CLUTTER_CAIRO_TEXTURE_DEPRECATED_H__ */

View File

@@ -43,6 +43,11 @@ CLUTTER_DEPRECATED_FOR(clutter_actor_add_child)
void clutter_container_add_actor (ClutterContainer *container,
ClutterActor *actor);
CLUTTER_DEPRECATED_FOR(clutter_actor_add_child)
void clutter_container_add_valist (ClutterContainer *container,
ClutterActor *first_actor,
va_list var_args);
CLUTTER_DEPRECATED_FOR(clutter_actor_remove_child)
void clutter_container_remove (ClutterContainer *container,
ClutterActor *first_actor,
@@ -52,6 +57,11 @@ CLUTTER_DEPRECATED_FOR(clutter_actor_remove_child)
void clutter_container_remove_actor (ClutterContainer *container,
ClutterActor *actor);
CLUTTER_DEPRECATED_FOR(clutter_actor_remove_child)
void clutter_container_remove_valist (ClutterContainer *container,
ClutterActor *first_actor,
va_list var_args);
CLUTTER_DEPRECATED_FOR(clutter_actor_get_children)
GList * clutter_container_get_children (ClutterContainer *container);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,42 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2008 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Emmanuele Bassi <ebassi@linux.intel.com>
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_STAGE_MANAGER_DEPRECATED_H__
#define __CLUTTER_STAGE_MANAGER_DEPRECATED_H__
#include <clutter/clutter-stage-manager.h>
G_BEGIN_DECLS
CLUTTER_DEPRECATED
void clutter_stage_manager_set_default_stage (ClutterStageManager *stage_manager,
ClutterStage *stage);
G_END_DECLS
#endif /*__CLUTTER_STAGE_MANAGER_DEPRECATED_H__ */

View File

@@ -1217,6 +1217,143 @@ clutter_state_get_states (ClutterState *state)
return g_hash_table_get_keys (state->priv->states);
}
/**
* clutter_state_get_keys:
* @state: a #ClutterState instance.
* @source_state_name: (allow-none): the source transition name to query,
* or %NULL for all source states
* @target_state_name: (allow-none): the target transition name to query,
* or %NULL for all target states
* @object: (allow-none): the specific object instance to list keys for,
* or %NULL for all managed objects
* @property_name: (allow-none): the property name to search for, or %NULL
* for all properties.
*
* Returns a list of pointers to opaque structures with accessor functions
* that describe the keys added to an animator.
*
* Return value: (transfer container) (element-type Clutter.StateKey): a
* newly allocated #GList of #ClutterStateKey<!-- -->s. The contents of
* the returned list are owned by the #ClutterState and should not be
* modified or freed. Use g_list_free() to free the resources allocated
* by the returned list when done using it
*
* Since: 1.4
* Deprecated: 1.12: Use #ClutterKeyframeTransition and
* #ClutterTransitionGroup instead
*/
GList *
clutter_state_get_keys (ClutterState *state,
const gchar *source_state_name,
const gchar *target_state_name,
GObject *object,
const gchar *property_name)
{
GList *s, *state_list;
GList *targets = NULL;
State *source_state = NULL;
g_return_val_if_fail (CLUTTER_IS_STATE (state), NULL);
source_state_name = g_intern_string (source_state_name);
target_state_name = g_intern_string (target_state_name);
property_name = g_intern_string (property_name);
if (target_state_name != NULL)
state_list = g_list_append (NULL, (gpointer) target_state_name);
else
state_list = clutter_state_get_states (state);
if (source_state_name)
source_state = clutter_state_fetch_state (state, source_state_name, FALSE);
for (s = state_list; s != NULL; s = s->next)
{
State *target_state;
target_state = clutter_state_fetch_state (state, s->data, FALSE);
if (target_state != NULL)
{
GList *k;
for (k = target_state->keys; k; k = k->next)
{
ClutterStateKey *key = k->data;
if ((object == NULL || (object == key->object)) &&
(source_state_name == NULL ||
source_state == key->source_state) &&
(property_name == NULL ||
(property_name == key->property_name)))
{
targets = g_list_prepend (targets, key);
}
}
}
}
g_list_free (state_list);
return g_list_reverse (targets);
}
/**
* clutter_state_remove_key:
* @state: a #ClutterState instance.
* @source_state_name: (allow-none): the source state name to query,
* or %NULL for all source states
* @target_state_name: (allow-none): the target state name to query,
* or %NULL for all target states
* @object: (allow-none): the specific object instance to list keys for,
* or %NULL for all managed objects
* @property_name: (allow-none): the property name to search for,
* or %NULL for all properties.
*
* Removes all keys matching the search criteria passed in arguments.
*
* Since: 1.4
* Deprecated: 1.12: Use #ClutterKeyframeTransition and
* #ClutterTransitionGroup instead
*/
void
clutter_state_remove_key (ClutterState *state,
const gchar *source_state_name,
const gchar *target_state_name,
GObject *object,
const gchar *property_name)
{
g_return_if_fail (CLUTTER_IS_STATE (state));
clutter_state_remove_key_internal (state,
source_state_name, target_state_name,
object, property_name,
FALSE);
}
/**
* clutter_state_get_timeline:
* @state: a #ClutterState
*
* Gets the timeline driving the #ClutterState
*
* Return value: (transfer none): the #ClutterTimeline that drives
* the state change animations. The returned timeline is owned
* by the #ClutterState and it should not be unreferenced directly
*
* Since: 1.4
* Deprecated: 1.12: Use #ClutterKeyframeTransition and
* #ClutterTransitionGroup instead
*/
ClutterTimeline *
clutter_state_get_timeline (ClutterState *state)
{
g_return_val_if_fail (CLUTTER_IS_STATE (state), NULL);
return state->priv->timeline;
}
static void
clutter_state_set_property (GObject *object,
guint prop_id,
@@ -1373,12 +1510,227 @@ G_DEFINE_BOXED_TYPE (ClutterStateKey, clutter_state_key,
clutter_state_key_copy,
clutter_state_key_free);
/**
* clutter_state_key_get_pre_delay:
* @state_key: a #ClutterStateKey
*
* Retrieves the pause before transitioning starts as a fraction of
* the total transition time.
*
* Return value: the pre delay used before starting the transition.
*
* Since: 1.4
* Deprecated: 1.12: Use #ClutterKeyframeTransition and
* #ClutterTransitionGroup instead
*/
gdouble
clutter_state_key_get_pre_delay (const ClutterStateKey *state_key)
{
g_return_val_if_fail (state_key != NULL, 0.0);
return state_key->pre_delay;
}
/**
* clutter_state_key_get_post_delay:
* @state_key: a #ClutterStateKey
*
* Retrieves the duration of the pause after transitioning is complete
* as a fraction of the total transition time.
*
* Return value: the post delay, used after doing the transition.
*
* Since: 1.4
* Deprecated: 1.12: Use #ClutterKeyframeTransition and
* #ClutterTransitionGroup instead
*/
gdouble
clutter_state_key_get_post_delay (const ClutterStateKey *state_key)
{
g_return_val_if_fail (state_key != NULL, 0.0);
return state_key->post_delay;
}
/**
* clutter_state_key_get_mode:
* @state_key: a #ClutterStateKey
*
* Retrieves the easing mode used for @state_key.
*
* Return value: the mode of a #ClutterStateKey
*
* Since: 1.4
* Deprecated: 1.12: Use #ClutterKeyframeTransition and
* #ClutterTransitionGroup instead
*/
gulong
clutter_state_key_get_mode (const ClutterStateKey *state_key)
{
g_return_val_if_fail (state_key != NULL, 0);
return state_key->mode;
}
/**
* clutter_state_key_get_value:
* @state_key: a #ClutterStateKey
* @value: a #GValue initialized with the correct type for the @state_key
*
* Retrieves a copy of the value for a #ClutterStateKey.
*
* The #GValue needs to be already initialized for the value type
* of the property or to a type that allow transformation from the value
* type of the key.
*
* Use g_value_unset() when done.
*
* Return value: %TRUE if the value was successfully retrieved,
* and %FALSE otherwise
*
* Since: 1.4
* Deprecated: 1.12: Use #ClutterKeyframeTransition and
* #ClutterTransitionGroup instead
*/
gboolean
clutter_state_key_get_value (const ClutterStateKey *state_key,
GValue *value)
{
g_return_val_if_fail (state_key != NULL, FALSE);
g_return_val_if_fail (value != NULL, FALSE);
g_return_val_if_fail (G_VALUE_TYPE (value) != G_TYPE_INVALID, FALSE);
if (!g_type_is_a (G_VALUE_TYPE (&state_key->value), G_VALUE_TYPE (value)))
{
if (g_value_type_compatible (G_VALUE_TYPE (&state_key->value),
G_VALUE_TYPE (value)))
{
g_value_copy (&state_key->value, value);
return TRUE;
}
if (g_value_type_transformable (G_VALUE_TYPE (&state_key->value),
G_VALUE_TYPE (value)))
{
if (g_value_transform (&state_key->value, value))
return TRUE;
}
g_warning ("%s: Unable to convert from %s to %s for the "
"property '%s' of object %s in the state key",
G_STRLOC,
g_type_name (G_VALUE_TYPE (&state_key->value)),
g_type_name (G_VALUE_TYPE (value)),
state_key->property_name,
G_OBJECT_TYPE_NAME (state_key->object));
return FALSE;
}
else
g_value_copy (&state_key->value, value);
return TRUE;
}
/**
* clutter_state_key_get_object:
* @state_key: a #ClutterStateKey
*
* Retrieves the object instance this #ClutterStateKey applies to.
*
* Return value: (transfer none): the object this state key applies to.
*
* Since: 1.4
* Deprecated: 1.12: Use #ClutterKeyframeTransition and
* #ClutterTransitionGroup instead
*/
GObject *
clutter_state_key_get_object (const ClutterStateKey *state_key)
{
g_return_val_if_fail (state_key, NULL);
return state_key->object;
}
/**
* clutter_state_key_get_property_name:
* @state_key: a #ClutterStateKey
*
* Retrieves the name of the property this #ClutterStateKey applies to
*
* Return value: the name of the property. The returned string is owned
* by the #ClutterStateKey and should never be modified or freed
*
* Since: 1.4
* Deprecated: 1.12: Use #ClutterKeyframeTransition and
* #ClutterTransitionGroup instead
*/
const gchar *
clutter_state_key_get_property_name (const ClutterStateKey *state_key)
{
g_return_val_if_fail (state_key, NULL);
return state_key->property_name;
}
/**
* clutter_state_key_get_source_state_name:
* @state_key: a #ClutterStateKey
*
* Retrieves the name of the source state of the @state_key
*
* Return value: the name of the source state for this key, or %NULL
* if this is the generic state key for the given property when
* transitioning to the target state. The returned string is owned
* by the #ClutterStateKey and should never be modified or freed
*
* Since: 1.4
* Deprecated: 1.12: Use #ClutterKeyframeTransition and
* #ClutterTransitionGroup instead
*/
const gchar *
clutter_state_key_get_source_state_name (const ClutterStateKey *state_key)
{
g_return_val_if_fail (state_key, NULL);
if (state_key->source_state != NULL)
return state_key->source_state->name;
return NULL;
}
/**
* clutter_state_key_get_target_state_name:
* @state_key: a #ClutterStateKey
*
* Get the name of the source state this #ClutterStateKey contains,
* or NULL if this is the generic state key for the given property
* when transitioning to the target state.
*
* Return value: the name of the source state for this key, or NULL if
* the key is generic
*
* Since: 1.4
* Deprecated: 1.12: Use #ClutterKeyframeTransition and
* #ClutterTransitionGroup instead
*/
const gchar *
clutter_state_key_get_target_state_name (const ClutterStateKey *state_key)
{
g_return_val_if_fail (state_key, NULL);
return state_key->target_state->name;
}
/**
* clutter_state_key_get_property_type:
* @key: a #ClutterStateKey
*
* Retrieves the #GType of the property a key applies to
*
* You can use this type to initialize the #GValue to pass to
* clutter_state_key_get_value()
*
* Return value: the #GType of the property
*
* Since: 1.4

View File

@@ -131,6 +131,20 @@ void clutter_state_set (ClutterState *state,
CLUTTER_DEPRECATED
GList * clutter_state_get_states (ClutterState *state);
CLUTTER_DEPRECATED
GList * clutter_state_get_keys (ClutterState *state,
const gchar *source_state_name,
const gchar *target_state_name,
GObject *object,
const gchar *property_name);
CLUTTER_DEPRECATED
void clutter_state_remove_key (ClutterState *state,
const gchar *source_state_name,
const gchar *target_state_name,
GObject *object,
const gchar *property_name);
CLUTTER_DEPRECATED
ClutterTimeline * clutter_state_get_timeline (ClutterState *state);
CLUTTER_DEPRECATED
const gchar * clutter_state_get_state (ClutterState *state);
/*
@@ -140,7 +154,24 @@ const gchar * clutter_state_get_state (ClutterState *state);
CLUTTER_DEPRECATED
GType clutter_state_key_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED
gdouble clutter_state_key_get_pre_delay (const ClutterStateKey *state_key);
CLUTTER_DEPRECATED
gdouble clutter_state_key_get_post_delay (const ClutterStateKey *state_key);
CLUTTER_DEPRECATED
gulong clutter_state_key_get_mode (const ClutterStateKey *state_key);
CLUTTER_DEPRECATED
gboolean clutter_state_key_get_value (const ClutterStateKey *state_key,
GValue *value);
CLUTTER_DEPRECATED
GType clutter_state_key_get_property_type (const ClutterStateKey *key);
CLUTTER_DEPRECATED
GObject * clutter_state_key_get_object (const ClutterStateKey *state_key);
CLUTTER_DEPRECATED
const gchar * clutter_state_key_get_property_name (const ClutterStateKey *state_key);
CLUTTER_DEPRECATED
const gchar * clutter_state_key_get_source_state_name (const ClutterStateKey *state_key);
CLUTTER_DEPRECATED
const gchar * clutter_state_key_get_target_state_name (const ClutterStateKey *state_key);
G_END_DECLS

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,172 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2010 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author:
* Jose Dapena Paz <jdapena@igalia.com>
*
* Based on the MX MxTable actor by:
* Thomas Wood <thomas.wood@intel.com>
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_TABLE_LAYOUT_H__
#define __CLUTTER_TABLE_LAYOUT_H__
#include <clutter/clutter-layout-manager.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_TABLE_LAYOUT (clutter_table_layout_get_type ())
#define CLUTTER_TABLE_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_TABLE_LAYOUT, ClutterTableLayout))
#define CLUTTER_IS_TABLE_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_TABLE_LAYOUT))
#define CLUTTER_TABLE_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_TABLE_LAYOUT, ClutterTableLayoutClass))
#define CLUTTER_IS_TABLE_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_TABLE_LAYOUT))
#define CLUTTER_TABLE_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_TABLE_LAYOUT, ClutterTableLayoutClass))
typedef struct _ClutterTableLayout ClutterTableLayout;
typedef struct _ClutterTableLayoutPrivate ClutterTableLayoutPrivate;
typedef struct _ClutterTableLayoutClass ClutterTableLayoutClass;
/**
* ClutterTableLayout:
*
* The #ClutterTableLayout structure contains only private data
* and should be accessed using the provided API
*
* Since: 1.4
*
* Deprecated: 1.18: Use #ClutterGridLayout instead
*/
struct _ClutterTableLayout
{
/*< private >*/
ClutterLayoutManager parent_instance;
ClutterTableLayoutPrivate *priv;
};
/**
* ClutterTableLayoutClass:
*
* The #ClutterTableLayoutClass structure contains only private
* data and should be accessed using the provided API
*
* Since: 1.4
*
* Deprecated: 1.18: Use #ClutterGridLayout instead
*/
struct _ClutterTableLayoutClass
{
/*< private >*/
ClutterLayoutManagerClass parent_class;
};
CLUTTER_DEPRECATED_FOR (clutter_grid_layout_get_type)
GType clutter_table_layout_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_FOR (clutter_grid_layout_new)
ClutterLayoutManager *clutter_table_layout_new (void);
CLUTTER_DEPRECATED_FOR (clutter_grid_layout_attach)
void clutter_table_layout_pack (ClutterTableLayout *layout,
ClutterActor *actor,
gint column,
gint row);
CLUTTER_DEPRECATED_FOR (clutter_grid_layout_set_column_spacing)
void clutter_table_layout_set_column_spacing (ClutterTableLayout *layout,
guint spacing);
CLUTTER_DEPRECATED_FOR (clutter_grid_layout_set_row_spacing)
void clutter_table_layout_set_row_spacing (ClutterTableLayout *layout,
guint spacing);
CLUTTER_DEPRECATED_FOR (clutter_grid_layout_get_column_spacing)
guint clutter_table_layout_get_column_spacing (ClutterTableLayout *layout);
CLUTTER_DEPRECATED_FOR (clutter_grid_layout_get_row_spacing)
guint clutter_table_layout_get_row_spacing (ClutterTableLayout *layout);
CLUTTER_DEPRECATED
void clutter_table_layout_set_span (ClutterTableLayout *layout,
ClutterActor *actor,
gint column_span,
gint row_span);
CLUTTER_DEPRECATED
void clutter_table_layout_get_span (ClutterTableLayout *layout,
ClutterActor *actor,
gint *column_span,
gint *row_span);
CLUTTER_DEPRECATED
void clutter_table_layout_set_alignment (ClutterTableLayout *layout,
ClutterActor *actor,
ClutterTableAlignment x_align,
ClutterTableAlignment y_align);
CLUTTER_DEPRECATED
void clutter_table_layout_get_alignment (ClutterTableLayout *layout,
ClutterActor *actor,
ClutterTableAlignment *x_align,
ClutterTableAlignment *y_align);
CLUTTER_DEPRECATED
void clutter_table_layout_set_fill (ClutterTableLayout *layout,
ClutterActor *actor,
gboolean x_fill,
gboolean y_fill);
CLUTTER_DEPRECATED
void clutter_table_layout_get_fill (ClutterTableLayout *layout,
ClutterActor *actor,
gboolean *x_fill,
gboolean *y_fill);
CLUTTER_DEPRECATED
void clutter_table_layout_set_expand (ClutterTableLayout *layout,
ClutterActor *actor,
gboolean x_expand,
gboolean y_expand);
CLUTTER_DEPRECATED
void clutter_table_layout_get_expand (ClutterTableLayout *layout,
ClutterActor *actor,
gboolean *x_expand,
gboolean *y_expand);
CLUTTER_DEPRECATED
gint clutter_table_layout_get_row_count (ClutterTableLayout *layout);
CLUTTER_DEPRECATED
gint clutter_table_layout_get_column_count (ClutterTableLayout *layout);
CLUTTER_DEPRECATED
void clutter_table_layout_set_use_animations (ClutterTableLayout *layout,
gboolean animate);
CLUTTER_DEPRECATED
gboolean clutter_table_layout_get_use_animations (ClutterTableLayout *layout);
CLUTTER_DEPRECATED
void clutter_table_layout_set_easing_mode (ClutterTableLayout *layout,
gulong mode);
CLUTTER_DEPRECATED
gulong clutter_table_layout_get_easing_mode (ClutterTableLayout *layout);
CLUTTER_DEPRECATED
void clutter_table_layout_set_easing_duration (ClutterTableLayout *layout,
guint msecs);
CLUTTER_DEPRECATED
guint clutter_table_layout_get_easing_duration (ClutterTableLayout *layout);
G_END_DECLS
#endif /* __CLUTTER_TABLE_LAYOUT_H__ */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,128 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_TEXTURE_DEPRECATED_H__
#define __CLUTTER_TEXTURE_DEPRECATED_H__
#include <clutter/clutter-texture.h>
G_BEGIN_DECLS
CLUTTER_DEPRECATED_FOR(clutter_image_new)
ClutterActor * clutter_texture_new (void);
CLUTTER_DEPRECATED_FOR(ClutterImage and platform-specific image loading)
ClutterActor * clutter_texture_new_from_file (const gchar *filename,
GError **error);
CLUTTER_DEPRECATED_FOR(ClutterImage and platform-specific image loading)
gboolean clutter_texture_set_from_file (ClutterTexture *texture,
const gchar *filename,
GError **error);
CLUTTER_DEPRECATED_FOR(clutter_image_set_data)
gboolean clutter_texture_set_from_rgb_data (ClutterTexture *texture,
const guchar *data,
gboolean has_alpha,
gint width,
gint height,
gint rowstride,
gint bpp,
ClutterTextureFlags flags,
GError **error);
CLUTTER_DEPRECATED_FOR(clutter_image_set_area)
gboolean clutter_texture_set_area_from_rgb_data (ClutterTexture *texture,
const guchar *data,
gboolean has_alpha,
gint x,
gint y,
gint width,
gint height,
gint rowstride,
gint bpp,
ClutterTextureFlags flags,
GError **error);
CLUTTER_DEPRECATED_FOR(ClutterImage and clutter_content_get_preferred_size)
void clutter_texture_get_base_size (ClutterTexture *texture,
gint *width,
gint *height);
CLUTTER_DEPRECATED_FOR(ClutterImage and clutter_actor_set_content_scaling_filters)
void clutter_texture_set_filter_quality (ClutterTexture *texture,
ClutterTextureQuality filter_quality);
CLUTTER_DEPRECATED_FOR(ClutterImage and clutter_actor_get_content_scaling_filters)
ClutterTextureQuality clutter_texture_get_filter_quality (ClutterTexture *texture);
CLUTTER_DEPRECATED
CoglHandle clutter_texture_get_cogl_texture (ClutterTexture *texture);
CLUTTER_DEPRECATED
void clutter_texture_set_cogl_texture (ClutterTexture *texture,
CoglHandle cogl_tex);
CLUTTER_DEPRECATED
CoglHandle clutter_texture_get_cogl_material (ClutterTexture *texture);
CLUTTER_DEPRECATED
void clutter_texture_set_cogl_material (ClutterTexture *texture,
CoglHandle cogl_material);
CLUTTER_DEPRECATED
void clutter_texture_set_sync_size (ClutterTexture *texture,
gboolean sync_size);
CLUTTER_DEPRECATED
gboolean clutter_texture_get_sync_size (ClutterTexture *texture);
CLUTTER_DEPRECATED_FOR(ClutterImage and clutter_actor_set_content_repeat)
void clutter_texture_set_repeat (ClutterTexture *texture,
gboolean repeat_x,
gboolean repeat_y);
CLUTTER_DEPRECATED_FOR(ClutterImage and clutter_actor_get_content_repeat)
void clutter_texture_get_repeat (ClutterTexture *texture,
gboolean *repeat_x,
gboolean *repeat_y);
CLUTTER_DEPRECATED
gint clutter_texture_get_max_tile_waste (ClutterTexture *texture);
CLUTTER_DEPRECATED_FOR(ClutterImage and clutter_actor_set_content_gravity)
void clutter_texture_set_keep_aspect_ratio (ClutterTexture *texture,
gboolean keep_aspect);
CLUTTER_DEPRECATED_FOR(ClutterImage and clutter_actor_get_content_gravity)
gboolean clutter_texture_get_keep_aspect_ratio (ClutterTexture *texture);
CLUTTER_DEPRECATED
void clutter_texture_set_load_async (ClutterTexture *texture,
gboolean load_async);
CLUTTER_DEPRECATED
gboolean clutter_texture_get_load_async (ClutterTexture *texture);
CLUTTER_DEPRECATED
void clutter_texture_set_load_data_async (ClutterTexture *texture,
gboolean load_async);
CLUTTER_DEPRECATED
gboolean clutter_texture_get_load_data_async (ClutterTexture *texture);
CLUTTER_DEPRECATED
void clutter_texture_set_pick_with_alpha (ClutterTexture *texture,
gboolean pick_with_alpha);
CLUTTER_DEPRECATED
gboolean clutter_texture_get_pick_with_alpha (ClutterTexture *texture);
CLUTTER_DEPRECATED_FOR(ClutterOffscreenEffect)
ClutterActor * clutter_texture_new_from_actor (ClutterActor *actor);
G_END_DECLS
#endif /* __CLUTTER_TEXTURE_DEPRECATED_H__ */

View File

@@ -27,11 +27,11 @@
#define __CLUTTER_BACKEND_EGL_NATIVE_H__
#include <glib-object.h>
#include <gio/gio.h>
#include <cogl/cogl.h>
#include <cogl/cogl-egl.h>
#include <clutter/clutter-event.h>
#include <clutter/clutter-backend.h>
#include <clutter/clutter-device-manager.h>
#include "clutter-backend-private.h"
@@ -53,6 +53,9 @@ struct _ClutterBackendEglNative
{
ClutterBackend parent_instance;
/* device manager (ie evdev) */
ClutterDeviceManager *device_manager;
/* event source */
GSource *event_source;

View File

@@ -30,6 +30,7 @@ clutter_headers = [
'clutter-deform-effect.h',
'clutter-deprecated.h',
'clutter-desaturate-effect.h',
'clutter-device-manager.h',
'clutter-drag-action.h',
'clutter-drop-action.h',
'clutter-effect.h',
@@ -67,7 +68,6 @@ clutter_headers = [
'clutter-script.h',
'clutter-scriptable.h',
'clutter-scroll-actor.h',
'clutter-seat.h',
'clutter-settings.h',
'clutter-shader-effect.h',
'clutter-shader-types.h',
@@ -77,6 +77,7 @@ clutter_headers = [
'clutter-stage-manager.h',
'clutter-stage-view.h',
'clutter-tap-action.h',
'clutter-texture.h',
'clutter-text.h',
'clutter-text-buffer.h',
'clutter-timeline.h',
@@ -116,6 +117,7 @@ clutter_sources = [
'clutter-content.c',
'clutter-deform-effect.c',
'clutter-desaturate-effect.c',
'clutter-device-manager.c',
'clutter-drag-action.c',
'clutter-drop-action.c',
'clutter-effect.c',
@@ -156,7 +158,6 @@ clutter_sources = [
'clutter-script-parser.c',
'clutter-scriptable.c',
'clutter-scroll-actor.c',
'clutter-seat.c',
'clutter-settings.c',
'clutter-shader-effect.c',
'clutter-shader-types.c',
@@ -186,6 +187,7 @@ clutter_private_headers = [
'clutter-constraint-private.h',
'clutter-content-private.h',
'clutter-debug.h',
'clutter-device-manager-private.h',
'clutter-easing.h',
'clutter-effect-private.h',
'clutter-event-private.h',
@@ -193,7 +195,6 @@ clutter_private_headers = [
'clutter-graphene.h',
'clutter-gesture-action-private.h',
'clutter-id-pool.h',
'clutter-input-device-private.h',
'clutter-input-focus-private.h',
'clutter-input-method-private.h',
'clutter-input-pointer-a11y-private.h',
@@ -219,13 +220,20 @@ clutter_nonintrospected_sources = [
clutter_deprecated_headers = [
'deprecated/clutter-actor.h',
'deprecated/clutter-alpha.h',
'deprecated/clutter-animatable.h',
'deprecated/clutter-animation.h',
'deprecated/clutter-bin-layout.h',
'deprecated/clutter-box.h',
'deprecated/clutter-cairo-texture.h',
'deprecated/clutter-container.h',
'deprecated/clutter-group.h',
'deprecated/clutter-keysyms.h',
'deprecated/clutter-rectangle.h',
'deprecated/clutter-stage-manager.h',
'deprecated/clutter-stage.h',
'deprecated/clutter-state.h',
'deprecated/clutter-table-layout.h',
'deprecated/clutter-texture.h',
'deprecated/clutter-timeline.h',
]
@@ -233,9 +241,12 @@ clutter_deprecated_sources = [
'deprecated/clutter-alpha.c',
'deprecated/clutter-animation.c',
'deprecated/clutter-box.c',
'deprecated/clutter-cairo-texture.c',
'deprecated/clutter-group.c',
'deprecated/clutter-rectangle.c',
'deprecated/clutter-state.c',
'deprecated/clutter-table-layout.c',
'deprecated/clutter-texture.c',
]
clutter_backend_sources = []
@@ -298,6 +309,7 @@ cally_headers = [
'cally/cally-root.h',
'cally/cally-stage.h',
'cally/cally-text.h',
'cally/cally-texture.h',
'cally/cally-util.h',
]
@@ -310,6 +322,7 @@ cally_sources = [
'cally/cally-root.c',
'cally/cally-stage.c',
'cally/cally-text.c',
'cally/cally-texture.c',
'cally/cally-util.c',
]

View File

@@ -47,6 +47,7 @@
#include "clutter-backend.h"
#include "clutter-debug.h"
#include "clutter-device-manager-private.h"
#include "clutter-event-private.h"
#include "clutter-main.h"
#include "clutter-private.h"

View File

@@ -86,6 +86,8 @@ struct _ClutterBackendX11
Time last_event_time;
ClutterDeviceManager *device_manager;
XSettingsClient *xsettings;
Window xsettings_xwin;
};

View File

@@ -1022,5 +1022,6 @@ cogl_atlas_texture_vtable =
_cogl_atlas_texture_gl_flush_legacy_texobj_wrap_modes,
_cogl_atlas_texture_get_format,
_cogl_atlas_texture_get_gl_format,
NULL, /* is_foreign */
NULL /* set_auto_mipmap */
};

View File

@@ -216,6 +216,16 @@ validate_blend_statements (CoglBlendStringStatement *statements,
_COGL_GET_CONTEXT (ctx, 0);
if (n_statements == 2 &&
!ctx->glBlendEquationSeparate &&
statements[0].function->type != statements[1].function->type)
{
error_string = "Separate blend functions for the RGB an A "
"channels isn't supported by the driver";
detail = COGL_BLEND_STRING_ERROR_GPU_UNSUPPORTED_ERROR;
goto error;
}
for (i = 0; i < n_statements; i++)
for (j = 0; j < statements[i].function->argc; j++)
{

View File

@@ -295,30 +295,6 @@ _cogl_clip_stack_push_primitive (CoglClipStack *stack,
return (CoglClipStack *) entry;
}
CoglClipStack *
cogl_clip_stack_push_region (CoglClipStack *stack,
cairo_region_t *region)
{
CoglClipStack *entry;
CoglClipStackRegion *entry_region;
cairo_rectangle_int_t bounds;
entry_region = _cogl_clip_stack_push_entry (stack,
sizeof (CoglClipStackRegion),
COGL_CLIP_STACK_REGION);
entry = (CoglClipStack *) entry_region;
cairo_region_get_extents (region, &bounds);
entry->bounds_x0 = bounds.x;
entry->bounds_x1 = bounds.x + bounds.width;
entry->bounds_y0 = bounds.y;
entry->bounds_y1 = bounds.y + bounds.height;
entry_region->region = cairo_region_reference (region);
return entry;
}
CoglClipStack *
_cogl_clip_stack_ref (CoglClipStack *entry)
{
@@ -360,13 +336,6 @@ _cogl_clip_stack_unref (CoglClipStack *entry)
g_slice_free1 (sizeof (CoglClipStackPrimitive), entry);
break;
}
case COGL_CLIP_STACK_REGION:
{
CoglClipStackRegion *region = (CoglClipStackRegion *) entry;
cairo_region_destroy (region->region);
g_slice_free1 (sizeof (CoglClipStackRegion), entry);
break;
}
default:
g_assert_not_reached ();
}

View File

@@ -48,14 +48,12 @@ typedef struct _CoglClipStack CoglClipStack;
typedef struct _CoglClipStackRect CoglClipStackRect;
typedef struct _CoglClipStackWindowRect CoglClipStackWindowRect;
typedef struct _CoglClipStackPrimitive CoglClipStackPrimitive;
typedef struct _CoglClipStackRegion CoglClipStackRegion;
typedef enum
{
COGL_CLIP_STACK_RECT,
COGL_CLIP_STACK_WINDOW_RECT,
COGL_CLIP_STACK_PRIMITIVE,
COGL_CLIP_STACK_REGION,
COGL_CLIP_STACK_PRIMITIVE
} CoglClipStackType;
/* A clip stack consists a list of entries. Each entry has a reference
@@ -164,13 +162,6 @@ struct _CoglClipStackPrimitive
float bounds_y2;
};
struct _CoglClipStackRegion
{
CoglClipStack _parent_data;
cairo_region_t *region;
};
CoglClipStack *
_cogl_clip_stack_push_window_rectangle (CoglClipStack *stack,
int x_offset,
@@ -198,9 +189,6 @@ _cogl_clip_stack_push_primitive (CoglClipStack *stack,
CoglMatrixEntry *modelview_entry,
CoglMatrixEntry *projection_entry,
const float *viewport);
CoglClipStack *
cogl_clip_stack_push_region (CoglClipStack *stack,
cairo_region_t *region);
CoglClipStack *
_cogl_clip_stack_pop (CoglClipStack *stack);

View File

@@ -76,6 +76,17 @@ cogl_color_init_from_4ub (CoglColor *color,
color->alpha = alpha;
}
/* XXX: deprecated, use cogl_color_init_from_4ub */
void
cogl_color_set_from_4ub (CoglColor *dest,
uint8_t red,
uint8_t green,
uint8_t blue,
uint8_t alpha)
{
cogl_color_init_from_4ub (dest, red, green, blue, alpha);
}
void
cogl_color_init_from_4f (CoglColor *color,
float red,
@@ -91,6 +102,17 @@ cogl_color_init_from_4f (CoglColor *color,
color->alpha = (alpha * 255);
}
/* XXX: deprecated, use cogl_color_init_from_4f */
void
cogl_color_set_from_4f (CoglColor *color,
float red,
float green,
float blue,
float alpha)
{
cogl_color_init_from_4f (color, red, green, blue, alpha);
}
void
cogl_color_init_from_4fv (CoglColor *color,
const float *color_array)

View File

@@ -116,6 +116,27 @@ cogl_color_init_from_4ub (CoglColor *color,
uint8_t blue,
uint8_t alpha);
/**
* cogl_color_set_from_4ub:
* @color: A pointer to a #CoglColor to initialize
* @red: value of the red channel, between 0 and 255
* @green: value of the green channel, between 0 and 255
* @blue: value of the blue channel, between 0 and 255
* @alpha: value of the alpha channel, between 0 and 255
*
* Sets the values of the passed channels into a #CoglColor.
*
* Since: 1.0
* Deprecated: 1.4: Use cogl_color_init_from_4ub instead.
*/
COGL_DEPRECATED_FOR (cogl_color_init_from_4ub)
void
cogl_color_set_from_4ub (CoglColor *color,
uint8_t red,
uint8_t green,
uint8_t blue,
uint8_t alpha);
/**
* cogl_color_init_from_4f:
* @color: A pointer to a #CoglColor to initialize
@@ -135,6 +156,27 @@ cogl_color_init_from_4f (CoglColor *color,
float blue,
float alpha);
/**
* cogl_color_set_from_4f:
* @color: A pointer to a #CoglColor to initialize
* @red: value of the red channel, between 0 and %1.0
* @green: value of the green channel, between 0 and %1.0
* @blue: value of the blue channel, between 0 and %1.0
* @alpha: value of the alpha channel, between 0 and %1.0
*
* Sets the values of the passed channels into a #CoglColor
*
* Since: 1.0
* Deprecated: 1.4: Use cogl_color_init_from_4f instead.
*/
COGL_DEPRECATED_FOR (cogl_color_init_from_4f)
void
cogl_color_set_from_4f (CoglColor *color,
float red,
float green,
float blue,
float alpha);
/**
* cogl_color_init_from_4fv:
* @color: A pointer to a #CoglColor to initialize

View File

@@ -0,0 +1,45 @@
/*
* Cogl
*
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2011 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*
*
* Authors:
* Robert Bragg <robert@linux.intel.com>
*/
#ifndef __COGL_CONFIG_PRIVATE_H
#define __COGL_CONFIG_PRIVATE_H
void
_cogl_config_read (void);
extern char *_cogl_config_driver;
extern char *_cogl_config_renderer;
extern char *_cogl_config_disable_gl_extensions;
extern char *_cogl_config_override_gl_version;
#endif /* __COGL_CONFIG_PRIVATE_H */

133
cogl/cogl/cogl-config.c Normal file
View File

@@ -0,0 +1,133 @@
/*
* Cogl
*
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2011 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*
* Authors:
* Robert Bragg <robert@linux.intel.com>
*/
#include "cogl-config.h"
#include "cogl-debug.h"
#include "cogl-config-private.h"
#include <glib.h>
char *_cogl_config_driver;
char *_cogl_config_renderer;
char *_cogl_config_disable_gl_extensions;
char *_cogl_config_override_gl_version;
/* Array of config options that just set a global string */
static const struct
{
const char *conf_name;
char **variable;
} cogl_config_string_options[] =
{
{ "COGL_DRIVER", &_cogl_config_driver },
{ "COGL_RENDERER", &_cogl_config_renderer },
{ "COGL_DISABLE_GL_EXTENSIONS", &_cogl_config_disable_gl_extensions },
{ "COGL_OVERRIDE_GL_VERSION", &_cogl_config_override_gl_version }
};
static void
_cogl_config_process (GKeyFile *key_file)
{
char *value;
int i;
value = g_key_file_get_string (key_file, "global", "COGL_DEBUG", NULL);
if (value)
{
_cogl_parse_debug_string (value,
TRUE /* enable the flags */,
TRUE /* ignore help option */);
g_free (value);
}
value = g_key_file_get_string (key_file, "global", "COGL_NO_DEBUG", NULL);
if (value)
{
_cogl_parse_debug_string (value,
FALSE /* disable the flags */,
TRUE /* ignore help option */);
g_free (value);
}
for (i = 0; i < G_N_ELEMENTS (cogl_config_string_options); i++)
{
const char *conf_name = cogl_config_string_options[i].conf_name;
char **variable = cogl_config_string_options[i].variable;
value = g_key_file_get_string (key_file, "global", conf_name, NULL);
if (value)
{
g_free (*variable);
*variable = value;
}
}
}
void
_cogl_config_read (void)
{
GKeyFile *key_file = g_key_file_new ();
const char * const *system_dirs = g_get_system_config_dirs ();
char *filename;
gboolean status = FALSE;
int i;
for (i = 0; system_dirs[i]; i++)
{
filename = g_build_filename (system_dirs[i], "cogl", "cogl.conf", NULL);
status = g_key_file_load_from_file (key_file,
filename,
0,
NULL);
g_free (filename);
if (status)
{
_cogl_config_process (key_file);
g_key_file_free (key_file);
key_file = g_key_file_new ();
break;
}
}
filename = g_build_filename (g_get_user_config_dir (), "cogl", "cogl.conf", NULL);
status = g_key_file_load_from_file (key_file,
filename,
0,
NULL);
g_free (filename);
if (status)
_cogl_config_process (key_file);
g_key_file_free (key_file);
}

View File

@@ -249,6 +249,8 @@ struct _CoglContext
/* Fragment processing programs */
CoglHandle current_program;
CoglPipelineProgramType current_fragment_program_type;
CoglPipelineProgramType current_vertex_program_type;
GLuint current_gl_program;
gboolean current_gl_dither_enabled;
@@ -270,6 +272,11 @@ struct _CoglContext
same state multiple times. When the clip state is flushed this
will hold a reference */
CoglClipStack *current_clip_stack;
/* Whether the stencil buffer was used as part of the current clip
state. If TRUE then any further use of the stencil buffer (such
as for drawing paths) would need to be merged with the existing
stencil buffer */
gboolean current_clip_stack_uses_stencil;
/* This is used as a temporary buffer to fill a CoglBuffer when
cogl_buffer_map fails and we only want to map to fill it with new

View File

@@ -46,6 +46,7 @@
#include "cogl-attribute-private.h"
#include "cogl1-context.h"
#include "cogl-gpu-info-private.h"
#include "cogl-config-private.h"
#include "cogl-gtype-private.h"
#include "driver/gl/cogl-pipeline-opengl-private.h"
#include "driver/gl/cogl-util-gl-private.h"
@@ -299,6 +300,8 @@ cogl_context_new (CoglDisplay *display,
context->max_texture_units = -1;
context->max_activateable_texture_units = -1;
context->current_fragment_program_type = COGL_PIPELINE_PROGRAM_TYPE_GLSL;
context->current_vertex_program_type = COGL_PIPELINE_PROGRAM_TYPE_GLSL;
context->current_gl_program = 0;
context->current_gl_dither_enabled = TRUE;
@@ -345,7 +348,7 @@ cogl_context_new (CoglDisplay *display,
*/
GE (context, glEnable (GL_ALPHA_TEST));
if (context->driver == COGL_DRIVER_GL3)
if ((context->driver == COGL_DRIVER_GL3))
{
GLuint vertex_array;
@@ -587,9 +590,11 @@ _cogl_context_get_gl_extensions (CoglContext *context)
ret = g_strsplit (all_extensions, " ", 0 /* max tokens */);
}
if ((env_disabled_extensions = g_getenv ("COGL_DISABLE_GL_EXTENSIONS")))
if ((env_disabled_extensions = g_getenv ("COGL_DISABLE_GL_EXTENSIONS"))
|| _cogl_config_disable_gl_extensions)
{
char **split_env_disabled_extensions;
char **split_conf_disabled_extensions;
char **src, **dst;
if (env_disabled_extensions)
@@ -600,6 +605,14 @@ _cogl_context_get_gl_extensions (CoglContext *context)
else
split_env_disabled_extensions = NULL;
if (_cogl_config_disable_gl_extensions)
split_conf_disabled_extensions =
g_strsplit (_cogl_config_disable_gl_extensions,
",",
0 /* no max tokens */);
else
split_conf_disabled_extensions = NULL;
for (dst = ret, src = ret;
*src;
src++)
@@ -610,6 +623,10 @@ _cogl_context_get_gl_extensions (CoglContext *context)
for (d = split_env_disabled_extensions; *d; d++)
if (!strcmp (*src, *d))
goto disabled;
if (split_conf_disabled_extensions)
for (d = split_conf_disabled_extensions; *d; d++)
if (!strcmp (*src, *d))
goto disabled;
*(dst++) = *src;
continue;
@@ -623,6 +640,8 @@ _cogl_context_get_gl_extensions (CoglContext *context)
if (split_env_disabled_extensions)
g_strfreev (split_env_disabled_extensions);
if (split_conf_disabled_extensions)
g_strfreev (split_conf_disabled_extensions);
}
return ret;
@@ -635,6 +654,8 @@ _cogl_context_get_gl_version (CoglContext *context)
if ((version_override = g_getenv ("COGL_OVERRIDE_GL_VERSION")))
return version_override;
else if (_cogl_config_override_gl_version)
return _cogl_config_override_gl_version;
else
return (const char *) context->glGetString (GL_VERSION);

View File

@@ -0,0 +1,43 @@
/*
* Cogl
*
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2008,2009 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*
*/
#ifndef COGL_DEPRECATED_H
#define cogl_color cogl_color_REPLACED_BY_cogl_set_source_color
#define cogl_enable_depth_test cogl_enable_depth_test_RENAMED_TO_cogl_set_depth_test_enabled
#define cogl_enable_backface_culling cogl_enable_backface_culling_RENAMED_TO_cogl_set_backface_culling_enabled
#define cogl_texture_rectangle cogl_texture_rectangle_REPLACE_BY_cogl_set_source_texture_AND_cogl_rectangle_with_texture_coords
#define cogl_texture_multiple_rectangles cogl_texture_multiple_rectangles_REPLACED_BY_cogl_set_source_texture_AND_cogl_rectangles_with_texture_coords
#define cogl_texture_polygon cogl_texture_polygon_REPLACED_BY_cogl_set_source_texture_AND_cogl_polygon
#endif

View File

@@ -67,6 +67,7 @@ COGL_OBJECT_DEFINE_WITH_CODE_GTYPE (Offscreen, offscreen,
_cogl_framebuffer_unref);
COGL_GTYPE_DEFINE_CLASS (Offscreen, offscreen,
COGL_GTYPE_IMPLEMENT_INTERFACE (framebuffer));
COGL_OBJECT_DEFINE_DEPRECATED_REF_COUNTING (offscreen);
COGL_GTYPE_DEFINE_INTERFACE (Framebuffer, framebuffer);
/* XXX:
@@ -1761,19 +1762,6 @@ cogl_framebuffer_push_primitive_clip (CoglFramebuffer *framebuffer,
COGL_FRAMEBUFFER_STATE_CLIP;
}
void
cogl_framebuffer_push_region_clip (CoglFramebuffer *framebuffer,
cairo_region_t *region)
{
framebuffer->clip_stack =
cogl_clip_stack_push_region (framebuffer->clip_stack,
region);
if (framebuffer->context->current_draw_buffer == framebuffer)
framebuffer->context->current_draw_buffer_changes |=
COGL_FRAMEBUFFER_STATE_CLIP;
}
void
cogl_framebuffer_pop_clip (CoglFramebuffer *framebuffer)
{
@@ -2128,6 +2116,59 @@ _cogl_framebuffer_draw_attributes (CoglFramebuffer *framebuffer,
}
}
/* XXX: deprecated */
void
cogl_framebuffer_draw_attributes (CoglFramebuffer *framebuffer,
CoglPipeline *pipeline,
CoglVerticesMode mode,
int first_vertex,
int n_vertices,
CoglAttribute **attributes,
int n_attributes)
{
_cogl_framebuffer_draw_attributes (framebuffer,
pipeline,
mode,
first_vertex,
n_vertices,
attributes, n_attributes,
COGL_DRAW_SKIP_LEGACY_STATE);
}
/* XXX: deprecated */
void
cogl_framebuffer_vdraw_attributes (CoglFramebuffer *framebuffer,
CoglPipeline *pipeline,
CoglVerticesMode mode,
int first_vertex,
int n_vertices,
...)
{
va_list ap;
int n_attributes;
CoglAttribute *attribute;
CoglAttribute **attributes;
int i;
va_start (ap, n_vertices);
for (n_attributes = 0; va_arg (ap, CoglAttribute *); n_attributes++)
;
va_end (ap);
attributes = g_alloca (sizeof (CoglAttribute *) * n_attributes);
va_start (ap, n_vertices);
for (i = 0; (attribute = va_arg (ap, CoglAttribute *)); i++)
attributes[i] = attribute;
va_end (ap);
_cogl_framebuffer_draw_attributes (framebuffer,
pipeline,
mode, first_vertex, n_vertices,
attributes, n_attributes,
COGL_DRAW_SKIP_LEGACY_STATE);
}
void
_cogl_framebuffer_draw_indexed_attributes (CoglFramebuffer *framebuffer,
CoglPipeline *pipeline,
@@ -2167,6 +2208,65 @@ _cogl_framebuffer_draw_indexed_attributes (CoglFramebuffer *framebuffer,
}
}
/* XXX: deprecated */
void
cogl_framebuffer_draw_indexed_attributes (CoglFramebuffer *framebuffer,
CoglPipeline *pipeline,
CoglVerticesMode mode,
int first_vertex,
int n_vertices,
CoglIndices *indices,
CoglAttribute **attributes,
int n_attributes)
{
_cogl_framebuffer_draw_indexed_attributes (framebuffer,
pipeline,
mode, first_vertex,
n_vertices, indices,
attributes, n_attributes,
COGL_DRAW_SKIP_LEGACY_STATE);
}
/* XXX: deprecated */
void
cogl_framebuffer_vdraw_indexed_attributes (CoglFramebuffer *framebuffer,
CoglPipeline *pipeline,
CoglVerticesMode mode,
int first_vertex,
int n_vertices,
CoglIndices *indices,
...)
{
va_list ap;
int n_attributes;
CoglAttribute **attributes;
int i;
CoglAttribute *attribute;
va_start (ap, indices);
for (n_attributes = 0; va_arg (ap, CoglAttribute *); n_attributes++)
;
va_end (ap);
attributes = g_alloca (sizeof (CoglAttribute *) * n_attributes);
va_start (ap, indices);
for (i = 0; (attribute = va_arg (ap, CoglAttribute *)); i++)
attributes[i] = attribute;
va_end (ap);
_cogl_framebuffer_draw_indexed_attributes (framebuffer,
pipeline,
mode,
first_vertex,
n_vertices,
indices,
attributes,
n_attributes,
COGL_DRAW_SKIP_LEGACY_STATE);
}
void
cogl_framebuffer_draw_primitive (CoglFramebuffer *framebuffer,
CoglPipeline *pipeline,

View File

@@ -54,7 +54,6 @@ typedef struct _CoglFramebuffer CoglFramebuffer;
#include <cogl/cogl-bitmap.h>
#include <cogl/cogl-texture.h>
#include <glib-object.h>
#include <cairo.h>
#include <graphene.h>
@@ -625,10 +624,6 @@ cogl_framebuffer_push_primitive_clip (CoglFramebuffer *framebuffer,
float bounds_x2,
float bounds_y2);
void
cogl_framebuffer_push_region_clip (CoglFramebuffer *framebuffer,
cairo_region_t *region);
/**
* cogl_framebuffer_pop_clip:
* @framebuffer: A #CoglFramebuffer pointer
@@ -1079,6 +1074,230 @@ cogl_framebuffer_draw_primitive (CoglFramebuffer *framebuffer,
CoglPipeline *pipeline,
CoglPrimitive *primitive);
/**
* cogl_framebuffer_vdraw_attributes:
* @framebuffer: A destination #CoglFramebuffer
* @pipeline: A #CoglPipeline state object
* @mode: The #CoglVerticesMode defining the topology of vertices
* @first_vertex: The vertex offset within the given attributes to draw from
* @n_vertices: The number of vertices to draw from the given attributes
* @...: A set of vertex #CoglAttribute<!-- -->s defining vertex geometry
*
* First defines a geometry primitive by grouping a set of vertex attributes;
* specifying a @first_vertex; a number of vertices (@n_vertices) and
* specifying what kind of topology the vertices have via @mode.
*
* Then the function draws the given @primitive geometry to the specified
* destination @framebuffer using the graphics processing pipeline described by
* @pipeline.
*
* The list of #CoglAttribute<!-- -->s define the attributes of the vertices to
* be drawn, such as positions, colors and normals and should be %NULL
* terminated.
*
* This drawing api doesn't support high-level meta texture types such
* as #CoglTexture2DSliced so it is the user's responsibility to
* ensure that only low-level textures that can be directly sampled by
* a GPU such as #CoglTexture2D are associated with layers of the given
* @pipeline.
*
* Stability: unstable
* Since: 1.10
* Deprecated: 1.16: Use #CoglPrimitive<!-- -->s and
* cogl_primitive_draw() instead
*/
COGL_DEPRECATED_FOR (cogl_primitive_draw)
void
cogl_framebuffer_vdraw_attributes (CoglFramebuffer *framebuffer,
CoglPipeline *pipeline,
CoglVerticesMode mode,
int first_vertex,
int n_vertices,
...) G_GNUC_NULL_TERMINATED;
/**
* cogl_framebuffer_draw_attributes: (skip)
* @framebuffer: A destination #CoglFramebuffer
* @pipeline: A #CoglPipeline state object
* @mode: The #CoglVerticesMode defining the topology of vertices
* @first_vertex: The vertex offset within the given attributes to draw from
* @n_vertices: The number of vertices to draw from the given attributes
* @attributes: An array of pointers to #CoglAttribute<-- -->s defining vertex
* geometry
* @n_attributes: The number of attributes in the @attributes array.
*
* First defines a geometry primitive by grouping a set of vertex @attributes;
* specifying a @first_vertex; a number of vertices (@n_vertices) and
* specifying what kind of topology the vertices have via @mode.
*
* Then the function draws the given @primitive geometry to the specified
* destination @framebuffer using the graphics processing pipeline described by
* @pipeline.
*
* The list of #CoglAttribute<!-- -->s define the attributes of the vertices to
* be drawn, such as positions, colors and normals and the number of attributes
* is given as @n_attributes.
*
* This drawing api doesn't support high-level meta texture types such
* as #CoglTexture2DSliced so it is the user's responsibility to
* ensure that only low-level textures that can be directly sampled by
* a GPU such as #CoglTexture2D are associated with layers of the given
* @pipeline.
*
* <note>This api doesn't support any of the legacy global state options such
* as cogl_set_depth_test_enabled(), cogl_set_backface_culling_enabled() or
* cogl_program_use()</note>
*
* Stability: unstable
* Since: 1.10
* Deprecated: 1.16: Use #CoglPrimitive<!-- -->s and
* cogl_primitive_draw() instead
*/
COGL_DEPRECATED_FOR (cogl_primitive_draw)
void
cogl_framebuffer_draw_attributes (CoglFramebuffer *framebuffer,
CoglPipeline *pipeline,
CoglVerticesMode mode,
int first_vertex,
int n_vertices,
CoglAttribute **attributes,
int n_attributes);
/**
* cogl_framebuffer_vdraw_indexed_attributes: (skip)
* @framebuffer: A destination #CoglFramebuffer
* @pipeline: A #CoglPipeline state object
* @mode: The #CoglVerticesMode defining the topology of vertices
* @first_vertex: The vertex offset within the given attributes to draw from
* @n_vertices: The number of vertices to draw from the given attributes
* @indices: The array of indices used by the GPU to lookup attribute
* data for each vertex.
* @...: A set of vertex #CoglAttribute<!-- -->s defining vertex geometry
*
* Behaves the same as cogl_framebuffer_vdraw_attributes() except that
* instead of reading vertex data sequentially from the specified
* attributes the @indices provide an indirection for how the data
* should be indexed allowing a random access order to be
* specified.
*
* For example an indices array of [0, 1, 2, 0, 2, 3] could be used
* used to draw two triangles (@mode = %COGL_VERTICES_MODE_TRIANGLES +
* @n_vertices = 6) but only provide attribute data for the 4 corners
* of a rectangle. When the GPU needs to read in each of the 6
* vertices it will read the @indices array for each vertex in
* sequence and use the index to look up the vertex attribute data. So
* here you can see that first and fourth vertex will point to the
* same data and third and fifth vertex will also point to shared
* data.
*
* Drawing with indices can be a good way of minimizing the size of a
* mesh by allowing you to avoid data for duplicate vertices because
* multiple entries in the index array can refer back to a single
* shared vertex.
*
* <note>The @indices array must be at least as long as @first_vertex
* + @n_vertices otherwise the GPU will overrun the indices array when
* looking up vertex data.</note>
*
* Since it's very common to want to draw a run of rectangles using
* indices to avoid duplicating vertex data you can use
* cogl_get_rectangle_indices() to get a set of indices that can be
* shared.
*
* This drawing api doesn't support high-level meta texture types such
* as #CoglTexture2DSliced so it is the user's responsibility to
* ensure that only low-level textures that can be directly sampled by
* a GPU such as #CoglTexture2D are associated with layers of the given
* @pipeline.
*
* <note>This api doesn't support any of the legacy global state
* options such as cogl_set_depth_test_enabled(),
* cogl_set_backface_culling_enabled() or cogl_program_use()</note>
*
* Stability: unstable
* Since: 1.10
* Deprecated: 1.16: Use #CoglPrimitive<!-- -->s and
* cogl_primitive_draw() instead
*/
COGL_DEPRECATED_FOR (cogl_primitive_draw)
void
cogl_framebuffer_vdraw_indexed_attributes (CoglFramebuffer *framebuffer,
CoglPipeline *pipeline,
CoglVerticesMode mode,
int first_vertex,
int n_vertices,
CoglIndices *indices,
...) G_GNUC_NULL_TERMINATED;
/**
* cogl_framebuffer_draw_indexed_attributes: (skip)
* @framebuffer: A destination #CoglFramebuffer
* @pipeline: A #CoglPipeline state object
* @mode: The #CoglVerticesMode defining the topology of vertices
* @first_vertex: The vertex offset within the given attributes to draw from
* @n_vertices: The number of vertices to draw from the given attributes
* @indices: The array of indices used by the GPU to lookup attribute
* data for each vertex.
* @attributes: An array of pointers to #CoglAttribute<-- -->s defining vertex
* geometry
* @n_attributes: The number of attributes in the @attributes array.
*
* Behaves the same as cogl_framebuffer_draw_attributes() except that
* instead of reading vertex data sequentially from the specified
* @attributes the @indices provide an indirection for how the data
* should be indexed allowing a random access order to be
* specified.
*
* For example an indices array of [0, 1, 2, 0, 2, 3] could be used
* used to draw two triangles (@mode = %COGL_VERTICES_MODE_TRIANGLES +
* @n_vertices = 6) but only provide attribute data for the 4 corners
* of a rectangle. When the GPU needs to read in each of the 6
* vertices it will read the @indices array for each vertex in
* sequence and use the index to look up the vertex attribute data. So
* here you can see that first and fourth vertex will point to the
* same data and third and fifth vertex will also point to shared
* data.
*
* Drawing with indices can be a good way of minimizing the size of a
* mesh by allowing you to avoid data for duplicate vertices because
* multiple entries in the index array can refer back to a single
* shared vertex.
*
* <note>The @indices array must be at least as long as @first_vertex
* + @n_vertices otherwise the GPU will overrun the indices array when
* looking up vertex data.</note>
*
* Since it's very common to want to draw a run of rectangles using
* indices to avoid duplicating vertex data you can use
* cogl_get_rectangle_indices() to get a set of indices that can be
* shared.
*
* This drawing api doesn't support high-level meta texture types such
* as #CoglTexture2DSliced so it is the user's responsibility to
* ensure that only low-level textures that can be directly sampled by
* a GPU such as #CoglTexture2D are associated with layers of the given
* @pipeline.
*
* <note>This api doesn't support any of the legacy global state
* options such as cogl_set_depth_test_enabled(),
* cogl_set_backface_culling_enabled() or cogl_program_use()</note>
*
* Stability: unstable
* Since: 1.10
* Deprecated: 1.16: Use #CoglPrimitive<!-- -->s and
* cogl_primitive_draw() instead
*/
COGL_DEPRECATED_FOR (cogl_primitive_draw)
void
cogl_framebuffer_draw_indexed_attributes (CoglFramebuffer *framebuffer,
CoglPipeline *pipeline,
CoglVerticesMode mode,
int first_vertex,
int n_vertices,
CoglIndices *indices,
CoglAttribute **attributes,
int n_attributes);
/**
* cogl_framebuffer_draw_rectangle:
* @framebuffer: A destination #CoglFramebuffer

View File

@@ -41,6 +41,7 @@
#include "cogl-point-in-poly-private.h"
#include "cogl-private.h"
#include "cogl1-context.h"
#include "deprecated/cogl-vertex-buffer-private.h"
#include <string.h>
#include <gmodule.h>

View File

@@ -1476,6 +1476,19 @@ _cogl_matrix_orthographic (CoglMatrix *matrix,
MAT_FLAG_TRANSLATION));
}
void
cogl_matrix_ortho (CoglMatrix *matrix,
float left,
float right,
float bottom,
float top,
float near,
float far)
{
_cogl_matrix_orthographic (matrix, left, top, right, bottom, near, far);
_COGL_MATRIX_DEBUG_PRINT (matrix);
}
void
cogl_matrix_orthographic (CoglMatrix *matrix,
float x_1,

View File

@@ -374,6 +374,34 @@ cogl_matrix_orthographic (CoglMatrix *matrix,
float near,
float far);
/**
* cogl_matrix_ortho:
* @matrix: A 4x4 transformation matrix
* @left: The coordinate for the left clipping plane
* @right: The coordinate for the right clipping plane
* @bottom: The coordinate for the bottom clipping plane
* @top: The coordinate for the top clipping plane
* @near: The <emphasis>distance</emphasis> to the near clipping
* plane (will be <emphasis>negative</emphasis> if the plane is
* behind the viewer)
* @far: The <emphasis>distance</emphasis> to the far clipping
* plane (will be <emphasis>negative</emphasis> if the plane is
* behind the viewer)
*
* Multiplies @matrix by a parallel projection matrix.
*
* Deprecated: 1.10: Use cogl_matrix_orthographic()
*/
COGL_DEPRECATED_FOR (cogl_matrix_orthographic)
void
cogl_matrix_ortho (CoglMatrix *matrix,
float left,
float right,
float bottom,
float top,
float near,
float far);
/**
* cogl_matrix_view_2d_in_frustum:
* @matrix: A 4x4 transformation matrix

View File

@@ -243,6 +243,37 @@ _cogl_is_##type_name (void *object) \
return obj->klass == &_cogl_##type_name##_class; \
}
#define COGL_OBJECT_DEFINE_DEPRECATED_REF_COUNTING(type_name) \
\
void * G_GNUC_DEPRECATED \
cogl_##type_name##_ref (void *object) \
{ \
if (!cogl_is_##type_name (object)) \
return NULL; \
\
_COGL_OBJECT_DEBUG_REF (TypeName, object); \
\
cogl_object_ref (object); \
\
return object; \
} \
\
void G_GNUC_DEPRECATED \
cogl_##type_name##_unref (void *object) \
{ \
if (!cogl_is_##type_name (object)) \
{ \
g_warning (G_STRINGIFY (cogl_##type_name##_unref) \
": Ignoring unref of Cogl handle " \
"due to type mismatch"); \
return; \
} \
\
_COGL_OBJECT_DEBUG_UNREF (TypeName, object); \
\
cogl_object_unref (object); \
}
#define COGL_OBJECT_DEFINE(TypeName, type_name) \
COGL_OBJECT_DEFINE_WITH_CODE_GTYPE (TypeName, type_name, (void) 0)

View File

@@ -135,6 +135,34 @@ cogl_offscreen_new_to_texture (CoglTexture *texture);
gboolean
cogl_is_offscreen (void *object);
/**
* cogl_offscreen_ref:
* @offscreen: A pointer to a #CoglOffscreen framebuffer
*
* Increments the reference count on the @offscreen framebuffer.
*
* Return value: (transfer none): For convenience it returns the
* given @offscreen
*
* Deprecated: 1.2: cogl_object_ref() should be used in new code.
*/
COGL_DEPRECATED_FOR (cogl_object_ref)
void *
cogl_offscreen_ref (void *offscreen);
/**
* cogl_offscreen_unref:
* @offscreen: A pointer to a #CoglOffscreen framebuffer
*
* Decreases the reference count for the @offscreen buffer and frees it when
* the count reaches 0.
*
* Deprecated: 1.2: cogl_object_unref() should be used in new code.
*/
COGL_DEPRECATED_FOR (cogl_object_unref)
void
cogl_offscreen_unref (void *offscreen);
/**
* cogl_offscreen_get_texture: (skip)
*/

View File

@@ -445,6 +445,78 @@ cogl_onscreen_remove_frame_callback (CoglOnscreen *onscreen,
_cogl_closure_disconnect (closure);
}
typedef struct _SwapBufferCallbackState
{
CoglSwapBuffersNotify callback;
void *user_data;
} SwapBufferCallbackState;
static void
destroy_swap_buffers_callback_state (void *user_data)
{
g_slice_free (SwapBufferCallbackState, user_data);
}
static void
shim_swap_buffers_callback (CoglOnscreen *onscreen,
CoglFrameEvent event,
CoglFrameInfo *info,
void *user_data)
{
SwapBufferCallbackState *state = user_data;
/* XXX: Note that technically it is a change in semantics for this
* interface to forward _SYNC events here and also makes the api
* name somewhat missleading.
*
* In practice though this interface is currently used by
* applications for throttling, not because they are strictly
* interested in knowing when a frame has been presented and so
* forwarding _SYNC events should serve them better.
*/
if (event == COGL_FRAME_EVENT_SYNC)
state->callback (COGL_FRAMEBUFFER (onscreen), state->user_data);
}
unsigned int
cogl_onscreen_add_swap_buffers_callback (CoglOnscreen *onscreen,
CoglSwapBuffersNotify callback,
void *user_data)
{
CoglContext *ctx = COGL_FRAMEBUFFER (onscreen)->context;
SwapBufferCallbackState *state = g_slice_new (SwapBufferCallbackState);
CoglFrameClosure *closure;
unsigned int id = ctx->next_swap_callback_id++;
state->callback = callback;
state->user_data = user_data;
closure =
cogl_onscreen_add_frame_callback (onscreen,
shim_swap_buffers_callback,
state,
destroy_swap_buffers_callback_state);
g_hash_table_insert (ctx->swap_callback_closures,
GINT_TO_POINTER (id),
closure);
return id;
}
void
cogl_onscreen_remove_swap_buffers_callback (CoglOnscreen *onscreen,
unsigned int id)
{
CoglContext *ctx = COGL_FRAMEBUFFER (onscreen)->context;
CoglFrameClosure *closure = g_hash_table_lookup (ctx->swap_callback_closures,
GINT_TO_POINTER (id));
g_return_if_fail (closure);
cogl_onscreen_remove_frame_callback (onscreen, closure);
}
void
cogl_onscreen_show (CoglOnscreen *onscreen)
{

Some files were not shown because too many files have changed in this diff Show More