Compare commits
1 Commits
3.37.2
...
wip/lantw/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af0478ae1e |
@@ -4,7 +4,6 @@ stages:
|
|||||||
- review
|
- review
|
||||||
- build
|
- build
|
||||||
- test
|
- test
|
||||||
- coverage
|
|
||||||
|
|
||||||
check-commit-log:
|
check-commit-log:
|
||||||
stage: review
|
stage: review
|
||||||
@@ -18,7 +17,7 @@ check-commit-log:
|
|||||||
build-mutter:
|
build-mutter:
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- meson . build -Dbuildtype=debugoptimized -Db_coverage=true -Degl_device=true -Dwayland_eglstream=true --werror --prefix /usr
|
- meson . build -Dbuildtype=debugoptimized -Degl_device=true -Dwayland_eglstream=true --werror --prefix /usr
|
||||||
- ninja -C build
|
- ninja -C build
|
||||||
- ninja -C build install
|
- ninja -C build install
|
||||||
artifacts:
|
artifacts:
|
||||||
@@ -36,8 +35,9 @@ build-without-opengl-and-glx:
|
|||||||
- ninja -C build
|
- ninja -C build
|
||||||
- ninja -C build install
|
- ninja -C build install
|
||||||
artifacts:
|
artifacts:
|
||||||
|
expire_in: 1 day
|
||||||
paths:
|
paths:
|
||||||
- build/meson-logs
|
- build
|
||||||
only:
|
only:
|
||||||
- merge_requests
|
- merge_requests
|
||||||
- /^.*$/
|
- /^.*$/
|
||||||
@@ -49,8 +49,9 @@ build-without-native-backend-and-wayland:
|
|||||||
- ninja -C build
|
- ninja -C build
|
||||||
- ninja -C build install
|
- ninja -C build install
|
||||||
artifacts:
|
artifacts:
|
||||||
|
expire_in: 1 day
|
||||||
paths:
|
paths:
|
||||||
- build/meson-logs
|
- build
|
||||||
only:
|
only:
|
||||||
- merge_requests
|
- merge_requests
|
||||||
- /^.*$/
|
- /^.*$/
|
||||||
@@ -65,6 +66,7 @@ test-mutter:
|
|||||||
G_SLICE: "always-malloc"
|
G_SLICE: "always-malloc"
|
||||||
MALLOC_CHECK_: "3"
|
MALLOC_CHECK_: "3"
|
||||||
NO_AT_BRIDGE: "1"
|
NO_AT_BRIDGE: "1"
|
||||||
|
MALLOC_PERTURB_: "123"
|
||||||
script:
|
script:
|
||||||
- dconf update
|
- dconf update
|
||||||
- mkdir -m 700 $XDG_RUNTIME_DIR
|
- mkdir -m 700 $XDG_RUNTIME_DIR
|
||||||
@@ -72,30 +74,10 @@ test-mutter:
|
|||||||
- >
|
- >
|
||||||
dbus-run-session -- xvfb-run -s '+iglx -noreset'
|
dbus-run-session -- xvfb-run -s '+iglx -noreset'
|
||||||
meson test -C build --no-rebuild -t 10 --verbose --no-stdsplit --print-errorlogs --wrap catchsegv
|
meson test -C build --no-rebuild -t 10 --verbose --no-stdsplit --print-errorlogs --wrap catchsegv
|
||||||
artifacts:
|
|
||||||
expire_in: 1 day
|
|
||||||
paths:
|
|
||||||
- build
|
|
||||||
only:
|
only:
|
||||||
- merge_requests
|
- merge_requests
|
||||||
- /^.*$/
|
- /^.*$/
|
||||||
|
|
||||||
test-mutter-coverage:
|
|
||||||
stage: coverage
|
|
||||||
dependencies:
|
|
||||||
- test-mutter
|
|
||||||
script:
|
|
||||||
- ninja -C build coverage
|
|
||||||
- cat build/meson-logs/coverage.txt
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- build/meson-logs
|
|
||||||
when: manual
|
|
||||||
except:
|
|
||||||
refs:
|
|
||||||
- tags
|
|
||||||
- master
|
|
||||||
|
|
||||||
can-build-gnome-shell:
|
can-build-gnome-shell:
|
||||||
stage: test
|
stage: test
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ RUN dnf -y update && dnf -y upgrade && \
|
|||||||
|
|
||||||
# For running unit tests
|
# For running unit tests
|
||||||
dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 \
|
dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 \
|
||||||
'*/xvfb-run' gdm-lib accountsservice-libs gnome-control-center gcovr \
|
'*/xvfb-run' gdm-lib accountsservice-libs gnome-control-center \
|
||||||
--setopt=install_weak_deps=False && \
|
--setopt=install_weak_deps=False && \
|
||||||
|
|
||||||
# GNOME Shell
|
# GNOME Shell
|
||||||
|
|||||||
27
NEWS
27
NEWS
@@ -1,30 +1,3 @@
|
|||||||
3.37.2
|
|
||||||
======
|
|
||||||
* Fix move-to-center keybinding with multiple monitors [Sergey; #1073]
|
|
||||||
* Fix stuck buttons when a virtual device is destroyed [Carlos; !1239]
|
|
||||||
* Use workarea when centering new windows [Akatsuki; #964]
|
|
||||||
* Limit mipmap levels when rendering background [Daniel; !1003]
|
|
||||||
* Broadcast clipboard/primary offers [Carlos; !1253]
|
|
||||||
* Support primary-selection protocol from wayland-protocols [Carlos; !1255]
|
|
||||||
* Fix monitor screen cast on X11 [Jonas Å.; !1251]
|
|
||||||
* Support a "blank" cursor type [Florian; !1244]
|
|
||||||
* Improve stage view damage tracking [Jonas Å.; !1237]
|
|
||||||
* Implement touch-mode detecation for the X11 backend [Carlos; !1278]
|
|
||||||
* Drop external keyboard detection from touch-mode heuristics [Carlos; !1277]
|
|
||||||
* Optimize actor allocations [Jonas D.; !1247]
|
|
||||||
* Fixed crashes [Daniel, Carlos, Jonas Å., Jonas D.; !1256, !1258, !1217, !1280]
|
|
||||||
* Misc. bug fixes and cleanups [Christian, Jonas D., Olivier, Ting-Wei,
|
|
||||||
Jonas Å., Marco, Corentin, Daniel, Robert, Niels, Florian, Simon; !1231,
|
|
||||||
!1228, !1238, !1229, !1192, !1236, !1171, !1134, #1126, !1234, !1230, !1210,
|
|
||||||
!1242, !1243, !1252, !1113, !1232, !1259, !1245, !1265, !1180, !1261, !788,
|
|
||||||
!1264, !1235, !1218, !1150, !1274, !1271, !1279, !1283, !1272]
|
|
||||||
|
|
||||||
Contributors:
|
|
||||||
Marco Trevisan (Treviño), Akatsuki, Jonas Dreßler, Olivier Fourdan,
|
|
||||||
Carlos Garnacho, Niels De Graef, Ting-Wei Lan, Robert Mader, Simon McVittie,
|
|
||||||
Florian Müllner, Corentin Noël, Christian Rauch, Daniel van Vugt,
|
|
||||||
Sergey Zigachev, Jonas Ådahl
|
|
||||||
|
|
||||||
3.37.1
|
3.37.1
|
||||||
======
|
======
|
||||||
* Fix screencasting non-maximized windows [Jonas Å.; !1174]
|
* Fix screencasting non-maximized windows [Jonas Å.; !1174]
|
||||||
|
|||||||
@@ -33,11 +33,28 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define CLUTTER_TYPE_ACTION (clutter_action_get_type ())
|
#define CLUTTER_TYPE_ACTION (clutter_action_get_type ())
|
||||||
|
#define CLUTTER_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ACTION, ClutterAction))
|
||||||
|
#define CLUTTER_IS_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ACTION))
|
||||||
|
#define CLUTTER_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_ACTION, ClutterActionClass))
|
||||||
|
#define CLUTTER_IS_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_ACTION))
|
||||||
|
#define CLUTTER_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ACTION, ClutterActionClass))
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
typedef struct _ClutterActionClass ClutterActionClass;
|
||||||
G_DECLARE_DERIVABLE_TYPE (ClutterAction, clutter_action,
|
|
||||||
CLUTTER, ACTION, ClutterActorMeta);
|
/**
|
||||||
|
* ClutterAction:
|
||||||
|
*
|
||||||
|
* The #ClutterAction structure contains only private data and
|
||||||
|
* should be accessed using the provided API.
|
||||||
|
*
|
||||||
|
* Since: 1.4
|
||||||
|
*/
|
||||||
|
struct _ClutterAction
|
||||||
|
{
|
||||||
|
/*< private >*/
|
||||||
|
ClutterActorMeta parent_instance;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterActionClass:
|
* ClutterActionClass:
|
||||||
@@ -61,6 +78,9 @@ struct _ClutterActionClass
|
|||||||
void (* _clutter_action8) (void);
|
void (* _clutter_action8) (void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
GType clutter_action_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
/* ClutterActor API */
|
/* ClutterActor API */
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_actor_add_action (ClutterActor *self,
|
void clutter_actor_add_action (ClutterActor *self,
|
||||||
|
|||||||
@@ -81,47 +81,38 @@ static void
|
|||||||
on_actor_destroy (ClutterActor *actor,
|
on_actor_destroy (ClutterActor *actor,
|
||||||
ClutterActorMeta *meta)
|
ClutterActorMeta *meta)
|
||||||
{
|
{
|
||||||
ClutterActorMetaPrivate *priv =
|
meta->priv->actor = NULL;
|
||||||
clutter_actor_meta_get_instance_private (meta);
|
|
||||||
|
|
||||||
priv->actor = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_actor_meta_real_set_actor (ClutterActorMeta *meta,
|
clutter_actor_meta_real_set_actor (ClutterActorMeta *meta,
|
||||||
ClutterActor *actor)
|
ClutterActor *actor)
|
||||||
{
|
{
|
||||||
ClutterActorMetaPrivate *priv =
|
g_warn_if_fail (!meta->priv->actor ||
|
||||||
clutter_actor_meta_get_instance_private (meta);
|
!CLUTTER_ACTOR_IN_PAINT (meta->priv->actor));
|
||||||
|
|
||||||
g_warn_if_fail (!priv->actor ||
|
|
||||||
!CLUTTER_ACTOR_IN_PAINT (priv->actor));
|
|
||||||
g_warn_if_fail (!actor || !CLUTTER_ACTOR_IN_PAINT (actor));
|
g_warn_if_fail (!actor || !CLUTTER_ACTOR_IN_PAINT (actor));
|
||||||
|
|
||||||
if (priv->actor == actor)
|
if (meta->priv->actor == actor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_clear_signal_handler (&priv->destroy_id, priv->actor);
|
g_clear_signal_handler (&meta->priv->destroy_id, meta->priv->actor);
|
||||||
|
|
||||||
priv->actor = actor;
|
meta->priv->actor = actor;
|
||||||
|
|
||||||
if (priv->actor != NULL)
|
if (meta->priv->actor != NULL)
|
||||||
priv->destroy_id = g_signal_connect (priv->actor, "destroy",
|
meta->priv->destroy_id = g_signal_connect (meta->priv->actor, "destroy",
|
||||||
G_CALLBACK (on_actor_destroy),
|
G_CALLBACK (on_actor_destroy),
|
||||||
meta);
|
meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_actor_meta_real_set_enabled (ClutterActorMeta *meta,
|
clutter_actor_meta_real_set_enabled (ClutterActorMeta *meta,
|
||||||
gboolean is_enabled)
|
gboolean is_enabled)
|
||||||
{
|
{
|
||||||
ClutterActorMetaPrivate *priv =
|
g_warn_if_fail (!meta->priv->actor ||
|
||||||
clutter_actor_meta_get_instance_private (meta);
|
!CLUTTER_ACTOR_IN_PAINT (meta->priv->actor));
|
||||||
|
|
||||||
g_warn_if_fail (!priv->actor ||
|
meta->priv->is_enabled = is_enabled;
|
||||||
!CLUTTER_ACTOR_IN_PAINT (priv->actor));
|
|
||||||
|
|
||||||
priv->is_enabled = is_enabled;
|
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (meta), obj_props[PROP_ENABLED]);
|
g_object_notify_by_pspec (G_OBJECT (meta), obj_props[PROP_ENABLED]);
|
||||||
}
|
}
|
||||||
@@ -156,21 +147,20 @@ clutter_actor_meta_get_property (GObject *gobject,
|
|||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
ClutterActorMetaPrivate *priv =
|
ClutterActorMeta *meta = CLUTTER_ACTOR_META (gobject);
|
||||||
clutter_actor_meta_get_instance_private (CLUTTER_ACTOR_META (gobject));
|
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_ACTOR:
|
case PROP_ACTOR:
|
||||||
g_value_set_object (value, priv->actor);
|
g_value_set_object (value, meta->priv->actor);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_NAME:
|
case PROP_NAME:
|
||||||
g_value_set_string (value, priv->name);
|
g_value_set_string (value, meta->priv->name);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_ENABLED:
|
case PROP_ENABLED:
|
||||||
g_value_set_boolean (value, priv->is_enabled);
|
g_value_set_boolean (value, meta->priv->is_enabled);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -182,8 +172,7 @@ clutter_actor_meta_get_property (GObject *gobject,
|
|||||||
static void
|
static void
|
||||||
clutter_actor_meta_finalize (GObject *gobject)
|
clutter_actor_meta_finalize (GObject *gobject)
|
||||||
{
|
{
|
||||||
ClutterActorMetaPrivate *priv =
|
ClutterActorMetaPrivate *priv = CLUTTER_ACTOR_META (gobject)->priv;
|
||||||
clutter_actor_meta_get_instance_private (CLUTTER_ACTOR_META (gobject));
|
|
||||||
|
|
||||||
if (priv->actor != NULL)
|
if (priv->actor != NULL)
|
||||||
g_clear_signal_handler (&priv->destroy_id, priv->actor);
|
g_clear_signal_handler (&priv->destroy_id, priv->actor);
|
||||||
@@ -254,11 +243,9 @@ clutter_actor_meta_class_init (ClutterActorMetaClass *klass)
|
|||||||
void
|
void
|
||||||
clutter_actor_meta_init (ClutterActorMeta *self)
|
clutter_actor_meta_init (ClutterActorMeta *self)
|
||||||
{
|
{
|
||||||
ClutterActorMetaPrivate *priv =
|
self->priv = clutter_actor_meta_get_instance_private (self);
|
||||||
clutter_actor_meta_get_instance_private (self);
|
self->priv->is_enabled = TRUE;
|
||||||
|
self->priv->priority = CLUTTER_ACTOR_META_PRIORITY_DEFAULT;
|
||||||
priv->is_enabled = TRUE;
|
|
||||||
priv->priority = CLUTTER_ACTOR_META_PRIORITY_DEFAULT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -276,17 +263,13 @@ void
|
|||||||
clutter_actor_meta_set_name (ClutterActorMeta *meta,
|
clutter_actor_meta_set_name (ClutterActorMeta *meta,
|
||||||
const gchar *name)
|
const gchar *name)
|
||||||
{
|
{
|
||||||
ClutterActorMetaPrivate *priv;
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_ACTOR_META (meta));
|
g_return_if_fail (CLUTTER_IS_ACTOR_META (meta));
|
||||||
|
|
||||||
priv = clutter_actor_meta_get_instance_private (meta);
|
if (g_strcmp0 (meta->priv->name, name) == 0)
|
||||||
|
|
||||||
if (g_strcmp0 (priv->name, name) == 0)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_free (priv->name);
|
g_free (meta->priv->name);
|
||||||
priv->name = g_strdup (name);
|
meta->priv->name = g_strdup (name);
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (meta), obj_props[PROP_NAME]);
|
g_object_notify_by_pspec (G_OBJECT (meta), obj_props[PROP_NAME]);
|
||||||
}
|
}
|
||||||
@@ -307,13 +290,9 @@ clutter_actor_meta_set_name (ClutterActorMeta *meta,
|
|||||||
const gchar *
|
const gchar *
|
||||||
clutter_actor_meta_get_name (ClutterActorMeta *meta)
|
clutter_actor_meta_get_name (ClutterActorMeta *meta)
|
||||||
{
|
{
|
||||||
ClutterActorMetaPrivate *priv;
|
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), NULL);
|
g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), NULL);
|
||||||
|
|
||||||
priv = clutter_actor_meta_get_instance_private (meta);
|
return meta->priv->name;
|
||||||
|
|
||||||
return priv->name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -329,14 +308,11 @@ void
|
|||||||
clutter_actor_meta_set_enabled (ClutterActorMeta *meta,
|
clutter_actor_meta_set_enabled (ClutterActorMeta *meta,
|
||||||
gboolean is_enabled)
|
gboolean is_enabled)
|
||||||
{
|
{
|
||||||
ClutterActorMetaPrivate *priv;
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_ACTOR_META (meta));
|
g_return_if_fail (CLUTTER_IS_ACTOR_META (meta));
|
||||||
|
|
||||||
priv = clutter_actor_meta_get_instance_private (meta);
|
|
||||||
is_enabled = !!is_enabled;
|
is_enabled = !!is_enabled;
|
||||||
|
|
||||||
if (priv->is_enabled == is_enabled)
|
if (meta->priv->is_enabled == is_enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CLUTTER_ACTOR_META_GET_CLASS (meta)->set_enabled (meta, is_enabled);
|
CLUTTER_ACTOR_META_GET_CLASS (meta)->set_enabled (meta, is_enabled);
|
||||||
@@ -355,13 +331,9 @@ clutter_actor_meta_set_enabled (ClutterActorMeta *meta,
|
|||||||
gboolean
|
gboolean
|
||||||
clutter_actor_meta_get_enabled (ClutterActorMeta *meta)
|
clutter_actor_meta_get_enabled (ClutterActorMeta *meta)
|
||||||
{
|
{
|
||||||
ClutterActorMetaPrivate *priv;
|
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), FALSE);
|
g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), FALSE);
|
||||||
|
|
||||||
priv = clutter_actor_meta_get_instance_private (meta);
|
return meta->priv->is_enabled;
|
||||||
|
|
||||||
return priv->is_enabled;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -397,54 +369,40 @@ _clutter_actor_meta_set_actor (ClutterActorMeta *meta,
|
|||||||
ClutterActor *
|
ClutterActor *
|
||||||
clutter_actor_meta_get_actor (ClutterActorMeta *meta)
|
clutter_actor_meta_get_actor (ClutterActorMeta *meta)
|
||||||
{
|
{
|
||||||
ClutterActorMetaPrivate *priv;
|
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), NULL);
|
g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), NULL);
|
||||||
|
|
||||||
priv = clutter_actor_meta_get_instance_private (meta);
|
return meta->priv->actor;
|
||||||
|
|
||||||
return priv->actor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_clutter_actor_meta_set_priority (ClutterActorMeta *meta,
|
_clutter_actor_meta_set_priority (ClutterActorMeta *meta,
|
||||||
gint priority)
|
gint priority)
|
||||||
{
|
{
|
||||||
ClutterActorMetaPrivate *priv;
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_ACTOR_META (meta));
|
g_return_if_fail (CLUTTER_IS_ACTOR_META (meta));
|
||||||
|
|
||||||
priv = clutter_actor_meta_get_instance_private (meta);
|
|
||||||
|
|
||||||
/* This property shouldn't be modified after the actor meta is in
|
/* This property shouldn't be modified after the actor meta is in
|
||||||
use because ClutterMetaGroup doesn't resort the list when it
|
use because ClutterMetaGroup doesn't resort the list when it
|
||||||
changes. If we made the priority public then we could either make
|
changes. If we made the priority public then we could either make
|
||||||
the priority a construct-only property or listen for
|
the priority a construct-only property or listen for
|
||||||
notifications on the property from the ClutterMetaGroup and
|
notifications on the property from the ClutterMetaGroup and
|
||||||
resort. */
|
resort. */
|
||||||
g_return_if_fail (priv->actor == NULL);
|
g_return_if_fail (meta->priv->actor == NULL);
|
||||||
|
|
||||||
priv->priority = priority;
|
meta->priv->priority = priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
_clutter_actor_meta_get_priority (ClutterActorMeta *meta)
|
_clutter_actor_meta_get_priority (ClutterActorMeta *meta)
|
||||||
{
|
{
|
||||||
ClutterActorMetaPrivate *priv;
|
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), 0);
|
g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), 0);
|
||||||
|
|
||||||
priv = clutter_actor_meta_get_instance_private (meta);
|
return meta->priv->priority;
|
||||||
|
|
||||||
return priv->priority;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_clutter_actor_meta_is_internal (ClutterActorMeta *meta)
|
_clutter_actor_meta_is_internal (ClutterActorMeta *meta)
|
||||||
{
|
{
|
||||||
ClutterActorMetaPrivate *priv =
|
gint priority = meta->priv->priority;
|
||||||
clutter_actor_meta_get_instance_private (meta);
|
|
||||||
gint priority = priv->priority;
|
|
||||||
|
|
||||||
return (priority <= CLUTTER_ACTOR_META_PRIORITY_INTERNAL_LOW ||
|
return (priority <= CLUTTER_ACTOR_META_PRIORITY_INTERNAL_LOW ||
|
||||||
priority >= CLUTTER_ACTOR_META_PRIORITY_INTERNAL_HIGH);
|
priority >= CLUTTER_ACTOR_META_PRIORITY_INTERNAL_HIGH);
|
||||||
@@ -491,21 +449,19 @@ void
|
|||||||
_clutter_meta_group_add_meta (ClutterMetaGroup *group,
|
_clutter_meta_group_add_meta (ClutterMetaGroup *group,
|
||||||
ClutterActorMeta *meta)
|
ClutterActorMeta *meta)
|
||||||
{
|
{
|
||||||
ClutterActorMetaPrivate *priv =
|
|
||||||
clutter_actor_meta_get_instance_private (meta);
|
|
||||||
GList *prev = NULL, *l;
|
GList *prev = NULL, *l;
|
||||||
|
|
||||||
if (priv->actor != NULL)
|
if (meta->priv->actor != NULL)
|
||||||
{
|
{
|
||||||
g_warning ("The meta of type '%s' with name '%s' is "
|
g_warning ("The meta of type '%s' with name '%s' is "
|
||||||
"already attached to actor '%s'",
|
"already attached to actor '%s'",
|
||||||
G_OBJECT_TYPE_NAME (meta),
|
G_OBJECT_TYPE_NAME (meta),
|
||||||
priv->name != NULL
|
meta->priv->name != NULL
|
||||||
? priv->name
|
? meta->priv->name
|
||||||
: "<unknown>",
|
: "<unknown>",
|
||||||
clutter_actor_get_name (priv->actor) != NULL
|
clutter_actor_get_name (meta->priv->actor) != NULL
|
||||||
? clutter_actor_get_name (priv->actor)
|
? clutter_actor_get_name (meta->priv->actor)
|
||||||
: G_OBJECT_TYPE_NAME (priv->actor));
|
: G_OBJECT_TYPE_NAME (meta->priv->actor));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -541,16 +497,13 @@ void
|
|||||||
_clutter_meta_group_remove_meta (ClutterMetaGroup *group,
|
_clutter_meta_group_remove_meta (ClutterMetaGroup *group,
|
||||||
ClutterActorMeta *meta)
|
ClutterActorMeta *meta)
|
||||||
{
|
{
|
||||||
ClutterActorMetaPrivate *priv =
|
if (meta->priv->actor != group->actor)
|
||||||
clutter_actor_meta_get_instance_private (meta);
|
|
||||||
|
|
||||||
if (priv->actor != group->actor)
|
|
||||||
{
|
{
|
||||||
g_warning ("The meta of type '%s' with name '%s' is not "
|
g_warning ("The meta of type '%s' with name '%s' is not "
|
||||||
"attached to the actor '%s'",
|
"attached to the actor '%s'",
|
||||||
G_OBJECT_TYPE_NAME (meta),
|
G_OBJECT_TYPE_NAME (meta),
|
||||||
priv->name != NULL
|
meta->priv->name != NULL
|
||||||
? priv->name
|
? meta->priv->name
|
||||||
: "<unknown>",
|
: "<unknown>",
|
||||||
clutter_actor_get_name (group->actor) != NULL
|
clutter_actor_get_name (group->actor) != NULL
|
||||||
? clutter_actor_get_name (group->actor)
|
? clutter_actor_get_name (group->actor)
|
||||||
@@ -693,10 +646,8 @@ _clutter_meta_group_get_meta (ClutterMetaGroup *group,
|
|||||||
for (l = group->meta; l != NULL; l = l->next)
|
for (l = group->meta; l != NULL; l = l->next)
|
||||||
{
|
{
|
||||||
ClutterActorMeta *meta = l->data;
|
ClutterActorMeta *meta = l->data;
|
||||||
ClutterActorMetaPrivate *priv =
|
|
||||||
clutter_actor_meta_get_instance_private (meta);
|
|
||||||
|
|
||||||
if (g_strcmp0 (priv->name, name) == 0)
|
if (g_strcmp0 (meta->priv->name, name) == 0)
|
||||||
return meta;
|
return meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -716,8 +667,6 @@ _clutter_meta_group_get_meta (ClutterMetaGroup *group,
|
|||||||
const gchar *
|
const gchar *
|
||||||
_clutter_actor_meta_get_debug_name (ClutterActorMeta *meta)
|
_clutter_actor_meta_get_debug_name (ClutterActorMeta *meta)
|
||||||
{
|
{
|
||||||
ClutterActorMetaPrivate *priv =
|
return meta->priv->name != NULL ? meta->priv->name
|
||||||
clutter_actor_meta_get_instance_private (meta);
|
: G_OBJECT_TYPE_NAME (meta);
|
||||||
|
|
||||||
return priv->name != NULL ? priv->name : G_OBJECT_TYPE_NAME (meta);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,13 +33,31 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define CLUTTER_TYPE_ACTOR_META (clutter_actor_meta_get_type ())
|
#define CLUTTER_TYPE_ACTOR_META (clutter_actor_meta_get_type ())
|
||||||
|
#define CLUTTER_ACTOR_META(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ACTOR_META, ClutterActorMeta))
|
||||||
|
#define CLUTTER_IS_ACTOR_META(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ACTOR_META))
|
||||||
|
#define CLUTTER_ACTOR_META_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_ACTOR_META, ClutterActorMetaClass))
|
||||||
|
#define CLUTTER_IS_ACTOR_META_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_ACTOR_META))
|
||||||
|
#define CLUTTER_ACTOR_META_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ACTOR_META, ClutterActorMetaClass))
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
typedef struct _ClutterActorMetaPrivate ClutterActorMetaPrivate;
|
||||||
G_DECLARE_DERIVABLE_TYPE (ClutterActorMeta, clutter_actor_meta,
|
typedef struct _ClutterActorMetaClass ClutterActorMetaClass;
|
||||||
CLUTTER, ACTOR_META, GInitiallyUnowned);
|
|
||||||
|
|
||||||
typedef struct _ClutterActorMetaPrivate ClutterActorMetaPrivate;
|
/**
|
||||||
|
* ClutterActorMeta:
|
||||||
|
*
|
||||||
|
* The #ClutterActorMeta structure contains only
|
||||||
|
* private data and should be accessed using the provided API
|
||||||
|
*
|
||||||
|
* Since: 1.4
|
||||||
|
*/
|
||||||
|
struct _ClutterActorMeta
|
||||||
|
{
|
||||||
|
/*< private >*/
|
||||||
|
GInitiallyUnowned parent_instance;
|
||||||
|
|
||||||
|
ClutterActorMetaPrivate *priv;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterActorMetaClass:
|
* ClutterActorMetaClass:
|
||||||
@@ -81,6 +99,9 @@ struct _ClutterActorMetaClass
|
|||||||
void (* _clutter_meta6) (void);
|
void (* _clutter_meta6) (void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
GType clutter_actor_meta_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_actor_meta_set_name (ClutterActorMeta *meta,
|
void clutter_actor_meta_set_name (ClutterActorMeta *meta,
|
||||||
const gchar *name);
|
const gchar *name);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -175,12 +175,9 @@ struct _ClutterActor
|
|||||||
* @get_preferred_height: virtual function, used when querying the minimum
|
* @get_preferred_height: virtual function, used when querying the minimum
|
||||||
* and natural heights of an actor for a given width; it is used by
|
* and natural heights of an actor for a given width; it is used by
|
||||||
* clutter_actor_get_preferred_height()
|
* clutter_actor_get_preferred_height()
|
||||||
* @allocate: virtual function, used when setting the coordinates of an
|
* @allocate: virtual function, used when settings the coordinates of an
|
||||||
* actor; it is used by clutter_actor_allocate(); when overriding this
|
* actor; it is used by clutter_actor_allocate(); it must chain up to
|
||||||
* function without chaining up, clutter_actor_set_allocation() must be
|
* the parent's implementation, or call clutter_actor_set_allocation()
|
||||||
* called and children must be allocated by the implementation, when
|
|
||||||
* chaining up though, those things will be done by the parent's
|
|
||||||
* implementation.
|
|
||||||
* @apply_transform: virtual function, used when applying the transformations
|
* @apply_transform: virtual function, used when applying the transformations
|
||||||
* to an actor before painting it or when transforming coordinates or
|
* to an actor before painting it or when transforming coordinates or
|
||||||
* the allocation; it must chain up to the parent's implementation
|
* the allocation; it must chain up to the parent's implementation
|
||||||
@@ -256,7 +253,8 @@ struct _ClutterActorClass
|
|||||||
gfloat *min_height_p,
|
gfloat *min_height_p,
|
||||||
gfloat *natural_height_p);
|
gfloat *natural_height_p);
|
||||||
void (* allocate) (ClutterActor *self,
|
void (* allocate) (ClutterActor *self,
|
||||||
const ClutterActorBox *box);
|
const ClutterActorBox *box,
|
||||||
|
ClutterAllocationFlags flags);
|
||||||
|
|
||||||
/* transformations */
|
/* transformations */
|
||||||
void (* apply_transform) (ClutterActor *actor,
|
void (* apply_transform) (ClutterActor *actor,
|
||||||
@@ -417,29 +415,38 @@ void clutter_actor_get_preferred_size
|
|||||||
gfloat *natural_height_p);
|
gfloat *natural_height_p);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_actor_allocate (ClutterActor *self,
|
void clutter_actor_allocate (ClutterActor *self,
|
||||||
const ClutterActorBox *box);
|
const ClutterActorBox *box,
|
||||||
|
ClutterAllocationFlags flags);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_actor_allocate_preferred_size (ClutterActor *self);
|
void clutter_actor_allocate_preferred_size (ClutterActor *self,
|
||||||
|
ClutterAllocationFlags flags);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_actor_allocate_available_size (ClutterActor *self,
|
void clutter_actor_allocate_available_size (ClutterActor *self,
|
||||||
gfloat x,
|
gfloat x,
|
||||||
gfloat y,
|
gfloat y,
|
||||||
gfloat available_width,
|
gfloat available_width,
|
||||||
gfloat available_height);
|
gfloat available_height,
|
||||||
|
ClutterAllocationFlags flags);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_actor_allocate_align_fill (ClutterActor *self,
|
void clutter_actor_allocate_align_fill (ClutterActor *self,
|
||||||
const ClutterActorBox *box,
|
const ClutterActorBox *box,
|
||||||
gdouble x_align,
|
gdouble x_align,
|
||||||
gdouble y_align,
|
gdouble y_align,
|
||||||
gboolean x_fill,
|
gboolean x_fill,
|
||||||
gboolean y_fill);
|
gboolean y_fill,
|
||||||
|
ClutterAllocationFlags flags);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_actor_set_allocation (ClutterActor *self,
|
void clutter_actor_set_allocation (ClutterActor *self,
|
||||||
const ClutterActorBox *box);
|
const ClutterActorBox *box,
|
||||||
|
ClutterAllocationFlags flags);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_actor_get_allocation_box (ClutterActor *self,
|
void clutter_actor_get_allocation_box (ClutterActor *self,
|
||||||
ClutterActorBox *box);
|
ClutterActorBox *box);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
|
void clutter_actor_get_allocation_vertices (ClutterActor *self,
|
||||||
|
ClutterActor *ancestor,
|
||||||
|
graphene_point3d_t *verts);
|
||||||
|
CLUTTER_EXPORT
|
||||||
gboolean clutter_actor_has_allocation (ClutterActor *self);
|
gboolean clutter_actor_has_allocation (ClutterActor *self);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_actor_set_size (ClutterActor *self,
|
void clutter_actor_set_size (ClutterActor *self,
|
||||||
|
|||||||
@@ -85,7 +85,8 @@ G_DEFINE_TYPE (ClutterAlignConstraint,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
source_position_changed (ClutterActor *actor,
|
source_position_changed (ClutterActor *actor,
|
||||||
GParamSpec *pspec,
|
const ClutterActorBox *allocation,
|
||||||
|
ClutterAllocationFlags flags,
|
||||||
ClutterAlignConstraint *align)
|
ClutterAlignConstraint *align)
|
||||||
{
|
{
|
||||||
if (align->actor != NULL)
|
if (align->actor != NULL)
|
||||||
@@ -409,7 +410,7 @@ clutter_align_constraint_set_source (ClutterAlignConstraint *align,
|
|||||||
align->source = source;
|
align->source = source;
|
||||||
if (align->source != NULL)
|
if (align->source != NULL)
|
||||||
{
|
{
|
||||||
g_signal_connect (align->source, "notify::allocation",
|
g_signal_connect (align->source, "allocation-changed",
|
||||||
G_CALLBACK (source_position_changed),
|
G_CALLBACK (source_position_changed),
|
||||||
align);
|
align);
|
||||||
g_signal_connect (align->source, "destroy",
|
g_signal_connect (align->source, "destroy",
|
||||||
|
|||||||
@@ -27,23 +27,35 @@
|
|||||||
* @short_description: Interface for animatable classes
|
* @short_description: Interface for animatable classes
|
||||||
*
|
*
|
||||||
* #ClutterAnimatable is an interface that allows a #GObject class
|
* #ClutterAnimatable is an interface that allows a #GObject class
|
||||||
* to control how an actor will animate a property.
|
* to control how a #ClutterAnimation will animate a property.
|
||||||
*
|
*
|
||||||
* Each #ClutterAnimatable should implement the
|
* Each #ClutterAnimatable should implement the
|
||||||
* #ClutterAnimatableInterface.interpolate_property() virtual function of the
|
* #ClutterAnimatableInterface.interpolate_property() virtual function of the
|
||||||
* interface to compute the animation state between two values of an interval
|
* interface to compute the animation state between two values of an interval
|
||||||
* depending on a progress factor, expressed as a floating point value.
|
* depending on a progress factor, expressed as a floating point value.
|
||||||
*
|
*
|
||||||
|
* If a #ClutterAnimatable is animated by a #ClutterAnimation
|
||||||
|
* instance, the #ClutterAnimation will call
|
||||||
|
* clutter_animatable_interpolate_property() passing the name of the
|
||||||
|
* currently animated property; the values interval; and the progress factor.
|
||||||
|
* The #ClutterAnimatable implementation should return the computed value for
|
||||||
|
* the animated
|
||||||
|
* property.
|
||||||
|
*
|
||||||
* #ClutterAnimatable is available since Clutter 1.0
|
* #ClutterAnimatable is available since Clutter 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "clutter-build-config.h"
|
#include "clutter-build-config.h"
|
||||||
|
|
||||||
|
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||||
|
|
||||||
#include "clutter-animatable.h"
|
#include "clutter-animatable.h"
|
||||||
#include "clutter-interval.h"
|
#include "clutter-interval.h"
|
||||||
#include "clutter-debug.h"
|
#include "clutter-debug.h"
|
||||||
#include "clutter-private.h"
|
#include "clutter-private.h"
|
||||||
|
|
||||||
|
#include "deprecated/clutter-animation.h"
|
||||||
|
|
||||||
G_DEFINE_INTERFACE (ClutterAnimatable, clutter_animatable, G_TYPE_OBJECT);
|
G_DEFINE_INTERFACE (ClutterAnimatable, clutter_animatable, G_TYPE_OBJECT);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ G_DECLARE_INTERFACE (ClutterAnimatable, clutter_animatable,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterAnimatableInterface:
|
* ClutterAnimatableInterface:
|
||||||
|
* @animate_property: virtual function for custom interpolation of a
|
||||||
|
* property. This virtual function is deprecated
|
||||||
* @find_property: virtual function for retrieving the #GParamSpec of
|
* @find_property: virtual function for retrieving the #GParamSpec of
|
||||||
* an animatable property
|
* an animatable property
|
||||||
* @get_initial_state: virtual function for retrieving the initial
|
* @get_initial_state: virtual function for retrieving the initial
|
||||||
@@ -51,6 +53,9 @@ G_DECLARE_INTERFACE (ClutterAnimatable, clutter_animatable,
|
|||||||
* @interpolate_value: virtual function for interpolating the progress
|
* @interpolate_value: virtual function for interpolating the progress
|
||||||
* of a property
|
* of a property
|
||||||
*
|
*
|
||||||
|
* Base interface for #GObject<!-- -->s that can be animated by a
|
||||||
|
* a #ClutterAnimation.
|
||||||
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
struct _ClutterAnimatableInterface
|
struct _ClutterAnimatableInterface
|
||||||
@@ -59,6 +64,13 @@ struct _ClutterAnimatableInterface
|
|||||||
GTypeInterface parent_iface;
|
GTypeInterface parent_iface;
|
||||||
|
|
||||||
/*< public >*/
|
/*< public >*/
|
||||||
|
gboolean (* animate_property) (ClutterAnimatable *animatable,
|
||||||
|
ClutterAnimation *animation,
|
||||||
|
const gchar *property_name,
|
||||||
|
const GValue *initial_value,
|
||||||
|
const GValue *final_value,
|
||||||
|
gdouble progress,
|
||||||
|
GValue *value);
|
||||||
GParamSpec *(* find_property) (ClutterAnimatable *animatable,
|
GParamSpec *(* find_property) (ClutterAnimatable *animatable,
|
||||||
const gchar *property_name);
|
const gchar *property_name);
|
||||||
void (* get_initial_state) (ClutterAnimatable *animatable,
|
void (* get_initial_state) (ClutterAnimatable *animatable,
|
||||||
|
|||||||
@@ -30,7 +30,9 @@
|
|||||||
|
|
||||||
#ifndef __GI_SCANNER__
|
#ifndef __GI_SCANNER__
|
||||||
|
|
||||||
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterAction, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActor, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActor, g_object_unref)
|
||||||
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActorMeta, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterAlignConstraint, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterAlignConstraint, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBackend, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBackend, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBindConstraint, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBindConstraint, g_object_unref)
|
||||||
@@ -41,6 +43,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBoxLayout, g_object_unref)
|
|||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBrightnessContrastEffect, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBrightnessContrastEffect, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterCanvas, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterCanvas, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterChildMeta, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterChildMeta, g_object_unref)
|
||||||
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterClickAction, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterClone, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterClone, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColorizeEffect, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColorizeEffect, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterConstraint, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterConstraint, g_object_unref)
|
||||||
@@ -50,6 +53,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDesaturateEffect, g_object_unref)
|
|||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterEffect, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterEffect, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterFixedLayout, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterFixedLayout, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterFlowLayout, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterFlowLayout, g_object_unref)
|
||||||
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterGestureAction, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterGridLayout, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterGridLayout, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterImage, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterImage, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterInputDevice, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterInputDevice, g_object_unref)
|
||||||
|
|||||||
@@ -406,7 +406,8 @@ get_actor_align_factor (ClutterActorAlign alignment)
|
|||||||
static void
|
static void
|
||||||
clutter_bin_layout_allocate (ClutterLayoutManager *manager,
|
clutter_bin_layout_allocate (ClutterLayoutManager *manager,
|
||||||
ClutterContainer *container,
|
ClutterContainer *container,
|
||||||
const ClutterActorBox *allocation)
|
const ClutterActorBox *allocation,
|
||||||
|
ClutterAllocationFlags flags)
|
||||||
{
|
{
|
||||||
gfloat allocation_x, allocation_y;
|
gfloat allocation_x, allocation_y;
|
||||||
gfloat available_w, available_h;
|
gfloat available_w, available_h;
|
||||||
@@ -514,7 +515,8 @@ clutter_bin_layout_allocate (ClutterLayoutManager *manager,
|
|||||||
|
|
||||||
clutter_actor_allocate_align_fill (child, &child_alloc,
|
clutter_actor_allocate_align_fill (child, &child_alloc,
|
||||||
x_align, y_align,
|
x_align, y_align,
|
||||||
x_fill, y_fill);
|
x_fill, y_fill,
|
||||||
|
flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -105,6 +105,64 @@ void clutter_box_layout_set_pack_start (ClutterBoxLayou
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
gboolean clutter_box_layout_get_pack_start (ClutterBoxLayout *layout);
|
gboolean clutter_box_layout_get_pack_start (ClutterBoxLayout *layout);
|
||||||
|
|
||||||
|
CLUTTER_DEPRECATED_FOR(clutter_box_layout_set_orientation)
|
||||||
|
void clutter_box_layout_set_vertical (ClutterBoxLayout *layout,
|
||||||
|
gboolean vertical);
|
||||||
|
CLUTTER_DEPRECATED_FOR(clutter_box_layout_get_orientation)
|
||||||
|
gboolean clutter_box_layout_get_vertical (ClutterBoxLayout *layout);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
void clutter_box_layout_pack (ClutterBoxLayout *layout,
|
||||||
|
ClutterActor *actor,
|
||||||
|
gboolean expand,
|
||||||
|
gboolean x_fill,
|
||||||
|
gboolean y_fill,
|
||||||
|
ClutterBoxAlignment x_align,
|
||||||
|
ClutterBoxAlignment y_align);
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
void clutter_box_layout_set_alignment (ClutterBoxLayout *layout,
|
||||||
|
ClutterActor *actor,
|
||||||
|
ClutterBoxAlignment x_align,
|
||||||
|
ClutterBoxAlignment y_align);
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
void clutter_box_layout_get_alignment (ClutterBoxLayout *layout,
|
||||||
|
ClutterActor *actor,
|
||||||
|
ClutterBoxAlignment *x_align,
|
||||||
|
ClutterBoxAlignment *y_align);
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
void clutter_box_layout_set_fill (ClutterBoxLayout *layout,
|
||||||
|
ClutterActor *actor,
|
||||||
|
gboolean x_fill,
|
||||||
|
gboolean y_fill);
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
void clutter_box_layout_get_fill (ClutterBoxLayout *layout,
|
||||||
|
ClutterActor *actor,
|
||||||
|
gboolean *x_fill,
|
||||||
|
gboolean *y_fill);
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
void clutter_box_layout_set_expand (ClutterBoxLayout *layout,
|
||||||
|
ClutterActor *actor,
|
||||||
|
gboolean expand);
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
gboolean clutter_box_layout_get_expand (ClutterBoxLayout *layout,
|
||||||
|
ClutterActor *actor);
|
||||||
|
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
void clutter_box_layout_set_use_animations (ClutterBoxLayout *layout,
|
||||||
|
gboolean animate);
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
gboolean clutter_box_layout_get_use_animations (ClutterBoxLayout *layout);
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
void clutter_box_layout_set_easing_mode (ClutterBoxLayout *layout,
|
||||||
|
gulong mode);
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
gulong clutter_box_layout_get_easing_mode (ClutterBoxLayout *layout);
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
void clutter_box_layout_set_easing_duration (ClutterBoxLayout *layout,
|
||||||
|
guint msecs);
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
guint clutter_box_layout_get_easing_duration (ClutterBoxLayout *layout);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __CLUTTER_BOX_LAYOUT_H__ */
|
#endif /* __CLUTTER_BOX_LAYOUT_H__ */
|
||||||
|
|||||||
@@ -159,8 +159,7 @@ static inline void
|
|||||||
click_action_set_pressed (ClutterClickAction *action,
|
click_action_set_pressed (ClutterClickAction *action,
|
||||||
gboolean is_pressed)
|
gboolean is_pressed)
|
||||||
{
|
{
|
||||||
ClutterClickActionPrivate *priv =
|
ClutterClickActionPrivate *priv = action->priv;
|
||||||
clutter_click_action_get_instance_private (action);
|
|
||||||
|
|
||||||
is_pressed = !!is_pressed;
|
is_pressed = !!is_pressed;
|
||||||
|
|
||||||
@@ -175,8 +174,7 @@ static inline void
|
|||||||
click_action_set_held (ClutterClickAction *action,
|
click_action_set_held (ClutterClickAction *action,
|
||||||
gboolean is_held)
|
gboolean is_held)
|
||||||
{
|
{
|
||||||
ClutterClickActionPrivate *priv =
|
ClutterClickActionPrivate *priv = action->priv;
|
||||||
clutter_click_action_get_instance_private (action);
|
|
||||||
|
|
||||||
is_held = !!is_held;
|
is_held = !!is_held;
|
||||||
|
|
||||||
@@ -191,8 +189,7 @@ static gboolean
|
|||||||
click_action_emit_long_press (gpointer data)
|
click_action_emit_long_press (gpointer data)
|
||||||
{
|
{
|
||||||
ClutterClickAction *action = data;
|
ClutterClickAction *action = data;
|
||||||
ClutterClickActionPrivate *priv =
|
ClutterClickActionPrivate *priv = action->priv;
|
||||||
clutter_click_action_get_instance_private (action);
|
|
||||||
ClutterActor *actor;
|
ClutterActor *actor;
|
||||||
gboolean result;
|
gboolean result;
|
||||||
|
|
||||||
@@ -216,8 +213,7 @@ click_action_emit_long_press (gpointer data)
|
|||||||
static inline void
|
static inline void
|
||||||
click_action_query_long_press (ClutterClickAction *action)
|
click_action_query_long_press (ClutterClickAction *action)
|
||||||
{
|
{
|
||||||
ClutterClickActionPrivate *priv =
|
ClutterClickActionPrivate *priv = action->priv;
|
||||||
clutter_click_action_get_instance_private (action);
|
|
||||||
ClutterActor *actor;
|
ClutterActor *actor;
|
||||||
gboolean result = FALSE;
|
gboolean result = FALSE;
|
||||||
gint timeout;
|
gint timeout;
|
||||||
@@ -253,8 +249,7 @@ click_action_query_long_press (ClutterClickAction *action)
|
|||||||
static inline void
|
static inline void
|
||||||
click_action_cancel_long_press (ClutterClickAction *action)
|
click_action_cancel_long_press (ClutterClickAction *action)
|
||||||
{
|
{
|
||||||
ClutterClickActionPrivate *priv =
|
ClutterClickActionPrivate *priv = action->priv;
|
||||||
clutter_click_action_get_instance_private (action);
|
|
||||||
|
|
||||||
if (priv->long_press_id != 0)
|
if (priv->long_press_id != 0)
|
||||||
{
|
{
|
||||||
@@ -277,8 +272,7 @@ on_event (ClutterActor *actor,
|
|||||||
ClutterEvent *event,
|
ClutterEvent *event,
|
||||||
ClutterClickAction *action)
|
ClutterClickAction *action)
|
||||||
{
|
{
|
||||||
ClutterClickActionPrivate *priv =
|
ClutterClickActionPrivate *priv = action->priv;
|
||||||
clutter_click_action_get_instance_private (action);
|
|
||||||
gboolean has_button = TRUE;
|
gboolean has_button = TRUE;
|
||||||
|
|
||||||
if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (action)))
|
if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (action)))
|
||||||
@@ -348,8 +342,7 @@ on_captured_event (ClutterActor *stage,
|
|||||||
ClutterEvent *event,
|
ClutterEvent *event,
|
||||||
ClutterClickAction *action)
|
ClutterClickAction *action)
|
||||||
{
|
{
|
||||||
ClutterClickActionPrivate *priv =
|
ClutterClickActionPrivate *priv = action->priv;
|
||||||
clutter_click_action_get_instance_private (action);
|
|
||||||
ClutterActor *actor;
|
ClutterActor *actor;
|
||||||
ClutterModifierType modifier_state;
|
ClutterModifierType modifier_state;
|
||||||
gboolean has_button = TRUE;
|
gboolean has_button = TRUE;
|
||||||
@@ -441,8 +434,7 @@ clutter_click_action_set_actor (ClutterActorMeta *meta,
|
|||||||
ClutterActor *actor)
|
ClutterActor *actor)
|
||||||
{
|
{
|
||||||
ClutterClickAction *action = CLUTTER_CLICK_ACTION (meta);
|
ClutterClickAction *action = CLUTTER_CLICK_ACTION (meta);
|
||||||
ClutterClickActionPrivate *priv =
|
ClutterClickActionPrivate *priv = action->priv;
|
||||||
clutter_click_action_get_instance_private (action);
|
|
||||||
|
|
||||||
if (priv->event_id != 0)
|
if (priv->event_id != 0)
|
||||||
{
|
{
|
||||||
@@ -496,8 +488,7 @@ clutter_click_action_set_property (GObject *gobject,
|
|||||||
const GValue *value,
|
const GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
ClutterClickActionPrivate *priv =
|
ClutterClickActionPrivate *priv = CLUTTER_CLICK_ACTION (gobject)->priv;
|
||||||
clutter_click_action_get_instance_private (CLUTTER_CLICK_ACTION (gobject));
|
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
@@ -521,8 +512,7 @@ clutter_click_action_get_property (GObject *gobject,
|
|||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
ClutterClickActionPrivate *priv =
|
ClutterClickActionPrivate *priv = CLUTTER_CLICK_ACTION (gobject)->priv;
|
||||||
clutter_click_action_get_instance_private (CLUTTER_CLICK_ACTION (gobject));
|
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
@@ -551,8 +541,7 @@ clutter_click_action_get_property (GObject *gobject,
|
|||||||
static void
|
static void
|
||||||
clutter_click_action_dispose (GObject *gobject)
|
clutter_click_action_dispose (GObject *gobject)
|
||||||
{
|
{
|
||||||
ClutterClickActionPrivate *priv =
|
ClutterClickActionPrivate *priv = CLUTTER_CLICK_ACTION (gobject)->priv;
|
||||||
clutter_click_action_get_instance_private (CLUTTER_CLICK_ACTION (gobject));
|
|
||||||
|
|
||||||
g_clear_signal_handler (&priv->event_id,
|
g_clear_signal_handler (&priv->event_id,
|
||||||
clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (gobject)));
|
clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (gobject)));
|
||||||
@@ -710,11 +699,9 @@ clutter_click_action_class_init (ClutterClickActionClass *klass)
|
|||||||
static void
|
static void
|
||||||
clutter_click_action_init (ClutterClickAction *self)
|
clutter_click_action_init (ClutterClickAction *self)
|
||||||
{
|
{
|
||||||
ClutterClickActionPrivate *priv =
|
self->priv = clutter_click_action_get_instance_private (self);
|
||||||
clutter_click_action_get_instance_private (self);
|
self->priv->long_press_threshold = -1;
|
||||||
|
self->priv->long_press_duration = -1;
|
||||||
priv->long_press_threshold = -1;
|
|
||||||
priv->long_press_duration = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -754,7 +741,7 @@ clutter_click_action_release (ClutterClickAction *action)
|
|||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_CLICK_ACTION (action));
|
g_return_if_fail (CLUTTER_IS_CLICK_ACTION (action));
|
||||||
|
|
||||||
priv = clutter_click_action_get_instance_private (action);
|
priv = action->priv;
|
||||||
|
|
||||||
if (!priv->is_held)
|
if (!priv->is_held)
|
||||||
return;
|
return;
|
||||||
@@ -780,13 +767,9 @@ clutter_click_action_release (ClutterClickAction *action)
|
|||||||
guint
|
guint
|
||||||
clutter_click_action_get_button (ClutterClickAction *action)
|
clutter_click_action_get_button (ClutterClickAction *action)
|
||||||
{
|
{
|
||||||
ClutterClickActionPrivate *priv;
|
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_CLICK_ACTION (action), 0);
|
g_return_val_if_fail (CLUTTER_IS_CLICK_ACTION (action), 0);
|
||||||
|
|
||||||
priv = clutter_click_action_get_instance_private (action);
|
return action->priv->press_button;
|
||||||
|
|
||||||
return priv->press_button;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -802,13 +785,9 @@ clutter_click_action_get_button (ClutterClickAction *action)
|
|||||||
ClutterModifierType
|
ClutterModifierType
|
||||||
clutter_click_action_get_state (ClutterClickAction *action)
|
clutter_click_action_get_state (ClutterClickAction *action)
|
||||||
{
|
{
|
||||||
ClutterClickActionPrivate *priv;
|
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_CLICK_ACTION (action), 0);
|
g_return_val_if_fail (CLUTTER_IS_CLICK_ACTION (action), 0);
|
||||||
|
|
||||||
priv = clutter_click_action_get_instance_private (action);
|
return action->priv->modifier_state;
|
||||||
|
|
||||||
return priv->modifier_state;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -826,15 +805,11 @@ clutter_click_action_get_coords (ClutterClickAction *action,
|
|||||||
gfloat *press_x,
|
gfloat *press_x,
|
||||||
gfloat *press_y)
|
gfloat *press_y)
|
||||||
{
|
{
|
||||||
ClutterClickActionPrivate *priv;
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_ACTION (action));
|
g_return_if_fail (CLUTTER_IS_ACTION (action));
|
||||||
|
|
||||||
priv = clutter_click_action_get_instance_private (action);
|
|
||||||
|
|
||||||
if (press_x != NULL)
|
if (press_x != NULL)
|
||||||
*press_x = priv->press_x;
|
*press_x = action->priv->press_x;
|
||||||
|
|
||||||
if (press_y != NULL)
|
if (press_y != NULL)
|
||||||
*press_y = priv->press_y;
|
*press_y = action->priv->press_y;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,13 +37,32 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define CLUTTER_TYPE_CLICK_ACTION (clutter_click_action_get_type ())
|
#define CLUTTER_TYPE_CLICK_ACTION (clutter_click_action_get_type ())
|
||||||
|
#define CLUTTER_CLICK_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_CLICK_ACTION, ClutterClickAction))
|
||||||
|
#define CLUTTER_IS_CLICK_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_CLICK_ACTION))
|
||||||
|
#define CLUTTER_CLICK_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_CLICK_ACTION, ClutterClickActionClass))
|
||||||
|
#define CLUTTER_IS_CLICK_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_CLICK_ACTION))
|
||||||
|
#define CLUTTER_CLICK_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_CLICK_ACTION, ClutterClickActionClass))
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
typedef struct _ClutterClickAction ClutterClickAction;
|
||||||
G_DECLARE_DERIVABLE_TYPE (ClutterClickAction, clutter_click_action,
|
typedef struct _ClutterClickActionPrivate ClutterClickActionPrivate;
|
||||||
CLUTTER, CLICK_ACTION, ClutterAction);
|
typedef struct _ClutterClickActionClass ClutterClickActionClass;
|
||||||
|
|
||||||
typedef struct _ClutterClickActionPrivate ClutterClickActionPrivate;
|
/**
|
||||||
|
* ClutterClickAction:
|
||||||
|
*
|
||||||
|
* The #ClutterClickAction structure contains
|
||||||
|
* only private data and should be accessed using the provided API
|
||||||
|
*
|
||||||
|
* Since: 1.4
|
||||||
|
*/
|
||||||
|
struct _ClutterClickAction
|
||||||
|
{
|
||||||
|
/*< private >*/
|
||||||
|
ClutterAction parent_instance;
|
||||||
|
|
||||||
|
ClutterClickActionPrivate *priv;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterClickActionClass:
|
* ClutterClickActionClass:
|
||||||
@@ -78,6 +97,9 @@ struct _ClutterClickActionClass
|
|||||||
void (* _clutter_click_action7) (void);
|
void (* _clutter_click_action7) (void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
GType clutter_click_action_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
ClutterAction * clutter_click_action_new (void);
|
ClutterAction * clutter_click_action_new (void);
|
||||||
|
|
||||||
|
|||||||
@@ -240,14 +240,15 @@ clutter_clone_has_overlaps (ClutterActor *actor)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_clone_allocate (ClutterActor *self,
|
clutter_clone_allocate (ClutterActor *self,
|
||||||
const ClutterActorBox *box)
|
const ClutterActorBox *box,
|
||||||
|
ClutterAllocationFlags flags)
|
||||||
{
|
{
|
||||||
ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv;
|
ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv;
|
||||||
ClutterActorClass *parent_class;
|
ClutterActorClass *parent_class;
|
||||||
|
|
||||||
/* chain up */
|
/* chain up */
|
||||||
parent_class = CLUTTER_ACTOR_CLASS (clutter_clone_parent_class);
|
parent_class = CLUTTER_ACTOR_CLASS (clutter_clone_parent_class);
|
||||||
parent_class->allocate (self, box);
|
parent_class->allocate (self, box, flags);
|
||||||
|
|
||||||
if (priv->clone_source == NULL)
|
if (priv->clone_source == NULL)
|
||||||
return;
|
return;
|
||||||
@@ -257,7 +258,7 @@ clutter_clone_allocate (ClutterActor *self,
|
|||||||
*/
|
*/
|
||||||
if (clutter_actor_get_parent (priv->clone_source) != NULL &&
|
if (clutter_actor_get_parent (priv->clone_source) != NULL &&
|
||||||
!clutter_actor_has_allocation (priv->clone_source))
|
!clutter_actor_has_allocation (priv->clone_source))
|
||||||
clutter_actor_allocate_preferred_size (priv->clone_source);
|
clutter_actor_allocate_preferred_size (priv->clone_source, flags);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* XXX - this is wrong: ClutterClone cannot clone unparented
|
/* XXX - this is wrong: ClutterClone cannot clone unparented
|
||||||
@@ -272,7 +273,7 @@ clutter_clone_allocate (ClutterActor *self,
|
|||||||
* paint cycle, we can safely give it as much size as it requires
|
* paint cycle, we can safely give it as much size as it requires
|
||||||
*/
|
*/
|
||||||
if (clutter_actor_get_parent (priv->clone_source) == NULL)
|
if (clutter_actor_get_parent (priv->clone_source) == NULL)
|
||||||
clutter_actor_allocate_preferred_size (priv->clone_source);
|
clutter_actor_allocate_preferred_size (priv->clone_source, flags);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,92 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2007,2008,2009,2010,2011 Intel Corporation.
|
|
||||||
* Copyright (C) 2020 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "clutter-build-config.h"
|
|
||||||
|
|
||||||
#include "clutter-damage-history.h"
|
|
||||||
|
|
||||||
#define DAMAGE_HISTORY_LENGTH 0x10
|
|
||||||
|
|
||||||
struct _ClutterDamageHistory
|
|
||||||
{
|
|
||||||
cairo_region_t *damages[DAMAGE_HISTORY_LENGTH];
|
|
||||||
int index;
|
|
||||||
};
|
|
||||||
|
|
||||||
ClutterDamageHistory *
|
|
||||||
clutter_damage_history_new (void)
|
|
||||||
{
|
|
||||||
ClutterDamageHistory *history;
|
|
||||||
|
|
||||||
history = g_new0 (ClutterDamageHistory, 1);
|
|
||||||
|
|
||||||
return history;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
clutter_damage_history_free (ClutterDamageHistory *history)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (history->damages); i++)
|
|
||||||
g_clear_pointer (&history->damages[i], cairo_region_destroy);
|
|
||||||
|
|
||||||
g_free (history);
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
clutter_damage_history_is_age_valid (ClutterDamageHistory *history,
|
|
||||||
int age)
|
|
||||||
{
|
|
||||||
if (age >= DAMAGE_HISTORY_LENGTH ||
|
|
||||||
age < 1)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (!clutter_damage_history_lookup (history, age))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
clutter_damage_history_record (ClutterDamageHistory *history,
|
|
||||||
const cairo_region_t *damage)
|
|
||||||
{
|
|
||||||
g_clear_pointer (&history->damages[history->index], cairo_region_destroy);
|
|
||||||
history->damages[history->index] = cairo_region_copy (damage);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
step_damage_index (int current,
|
|
||||||
int diff)
|
|
||||||
{
|
|
||||||
return (current + diff) & (DAMAGE_HISTORY_LENGTH - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
clutter_damage_history_step (ClutterDamageHistory *history)
|
|
||||||
{
|
|
||||||
history->index = step_damage_index (history->index, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const cairo_region_t *
|
|
||||||
clutter_damage_history_lookup (ClutterDamageHistory *history,
|
|
||||||
int age)
|
|
||||||
{
|
|
||||||
return history->damages[step_damage_index (history->index, -age)];
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2007,2008,2009,2010,2011 Intel Corporation.
|
|
||||||
* Copyright (C) 2020 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef CLUTTER_DAMAGE_HISTORY_H
|
|
||||||
#define CLUTTER_DAMAGE_HISTORY_H
|
|
||||||
|
|
||||||
#include <cairo.h>
|
|
||||||
#include <glib.h>
|
|
||||||
|
|
||||||
typedef struct _ClutterDamageHistory ClutterDamageHistory;
|
|
||||||
|
|
||||||
ClutterDamageHistory * clutter_damage_history_new (void);
|
|
||||||
|
|
||||||
void clutter_damage_history_free (ClutterDamageHistory *history);
|
|
||||||
|
|
||||||
gboolean clutter_damage_history_is_age_valid (ClutterDamageHistory *history,
|
|
||||||
int age);
|
|
||||||
|
|
||||||
void clutter_damage_history_record (ClutterDamageHistory *history,
|
|
||||||
const cairo_region_t *damage);
|
|
||||||
|
|
||||||
void clutter_damage_history_step (ClutterDamageHistory *history);
|
|
||||||
|
|
||||||
const cairo_region_t * clutter_damage_history_lookup (ClutterDamageHistory *history,
|
|
||||||
int age);
|
|
||||||
|
|
||||||
#endif /* CLUTTER_DAMAGE_HISTORY_H */
|
|
||||||
@@ -128,9 +128,10 @@ clutter_deform_effect_deform_vertex (ClutterDeformEffect *effect,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vbo_invalidate (ClutterActor *actor,
|
vbo_invalidate (ClutterActor *actor,
|
||||||
GParamSpec *pspec,
|
const ClutterActorBox *allocation,
|
||||||
ClutterDeformEffect *effect)
|
ClutterAllocationFlags flags,
|
||||||
|
ClutterDeformEffect *effect)
|
||||||
{
|
{
|
||||||
effect->priv->is_dirty = TRUE;
|
effect->priv->is_dirty = TRUE;
|
||||||
}
|
}
|
||||||
@@ -155,7 +156,7 @@ clutter_deform_effect_set_actor (ClutterActorMeta *meta,
|
|||||||
* changes
|
* changes
|
||||||
*/
|
*/
|
||||||
if (actor != NULL)
|
if (actor != NULL)
|
||||||
priv->allocation_id = g_signal_connect (actor, "notify::allocation",
|
priv->allocation_id = g_signal_connect (actor, "allocation-changed",
|
||||||
G_CALLBACK (vbo_invalidate),
|
G_CALLBACK (vbo_invalidate),
|
||||||
meta);
|
meta);
|
||||||
|
|
||||||
|
|||||||
@@ -4,11 +4,14 @@
|
|||||||
#define __CLUTTER_DEPRECATED_H_INSIDE__
|
#define __CLUTTER_DEPRECATED_H_INSIDE__
|
||||||
|
|
||||||
#include "deprecated/clutter-actor.h"
|
#include "deprecated/clutter-actor.h"
|
||||||
|
#include "deprecated/clutter-alpha.h"
|
||||||
|
#include "deprecated/clutter-animation.h"
|
||||||
#include "deprecated/clutter-box.h"
|
#include "deprecated/clutter-box.h"
|
||||||
#include "deprecated/clutter-container.h"
|
#include "deprecated/clutter-container.h"
|
||||||
#include "deprecated/clutter-group.h"
|
#include "deprecated/clutter-group.h"
|
||||||
#include "deprecated/clutter-rectangle.h"
|
#include "deprecated/clutter-rectangle.h"
|
||||||
#include "deprecated/clutter-stage.h"
|
#include "deprecated/clutter-stage.h"
|
||||||
|
#include "deprecated/clutter-state.h"
|
||||||
#include "deprecated/clutter-timeline.h"
|
#include "deprecated/clutter-timeline.h"
|
||||||
|
|
||||||
#undef __CLUTTER_DEPRECATED_H_INSIDE__
|
#undef __CLUTTER_DEPRECATED_H_INSIDE__
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ typedef enum /*< prefix=CLUTTER_REQUEST >*/
|
|||||||
* @CLUTTER_ANIMATION_LAST: last animation mode, used as a guard for
|
* @CLUTTER_ANIMATION_LAST: last animation mode, used as a guard for
|
||||||
* registered global alpha functions
|
* registered global alpha functions
|
||||||
*
|
*
|
||||||
* The animation modes used by #ClutterAnimatable. This
|
* The animation modes used by #ClutterAlpha and #ClutterAnimation. This
|
||||||
* enumeration can be expanded in later versions of Clutter.
|
* enumeration can be expanded in later versions of Clutter.
|
||||||
*
|
*
|
||||||
* <figure id="easing-modes">
|
* <figure id="easing-modes">
|
||||||
@@ -554,6 +554,32 @@ typedef enum /*< prefix=CLUTTER_OFFSCREEN_REDIRECT >*/
|
|||||||
CLUTTER_OFFSCREEN_REDIRECT_ON_IDLE = 1 << 2
|
CLUTTER_OFFSCREEN_REDIRECT_ON_IDLE = 1 << 2
|
||||||
} ClutterOffscreenRedirect;
|
} ClutterOffscreenRedirect;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClutterAllocationFlags:
|
||||||
|
* @CLUTTER_ALLOCATION_NONE: No flag set
|
||||||
|
* @CLUTTER_ABSOLUTE_ORIGIN_CHANGED: Whether the absolute origin of the
|
||||||
|
* actor has changed; this implies that any ancestor of the actor has
|
||||||
|
* been moved.
|
||||||
|
* @CLUTTER_DELEGATE_LAYOUT: Whether the allocation should be delegated
|
||||||
|
* to the #ClutterLayoutManager instance stored inside the
|
||||||
|
* #ClutterActor:layout-manager property of #ClutterActor. This flag
|
||||||
|
* should only be used if you are subclassing #ClutterActor and
|
||||||
|
* overriding the #ClutterActorClass.allocate() virtual function, but
|
||||||
|
* you wish to use the default implementation of the virtual function
|
||||||
|
* inside #ClutterActor. Added in Clutter 1.10.
|
||||||
|
*
|
||||||
|
* Flags passed to the #ClutterActorClass.allocate() virtual function
|
||||||
|
* and to the clutter_actor_allocate() function.
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
CLUTTER_ALLOCATION_NONE = 0,
|
||||||
|
CLUTTER_ABSOLUTE_ORIGIN_CHANGED = 1 << 1,
|
||||||
|
CLUTTER_DELEGATE_LAYOUT = 1 << 2
|
||||||
|
} ClutterAllocationFlags;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterAlignAxis:
|
* ClutterAlignAxis:
|
||||||
* @CLUTTER_ALIGN_X_AXIS: Maintain the alignment on the X axis
|
* @CLUTTER_ALIGN_X_AXIS: Maintain the alignment on the X axis
|
||||||
|
|||||||
@@ -131,7 +131,8 @@ clutter_fixed_layout_get_preferred_height (ClutterLayoutManager *manager,
|
|||||||
static void
|
static void
|
||||||
clutter_fixed_layout_allocate (ClutterLayoutManager *manager,
|
clutter_fixed_layout_allocate (ClutterLayoutManager *manager,
|
||||||
ClutterContainer *container,
|
ClutterContainer *container,
|
||||||
const ClutterActorBox *allocation)
|
const ClutterActorBox *allocation,
|
||||||
|
ClutterAllocationFlags flags)
|
||||||
{
|
{
|
||||||
ClutterActor *child;
|
ClutterActor *child;
|
||||||
|
|
||||||
@@ -139,7 +140,7 @@ clutter_fixed_layout_allocate (ClutterLayoutManager *manager,
|
|||||||
child != NULL;
|
child != NULL;
|
||||||
child = clutter_actor_get_next_sibling (child))
|
child = clutter_actor_get_next_sibling (child))
|
||||||
{
|
{
|
||||||
clutter_actor_allocate_preferred_size (child);
|
clutter_actor_allocate_preferred_size (child, flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -566,7 +566,8 @@ clutter_flow_layout_get_preferred_height (ClutterLayoutManager *manager,
|
|||||||
static void
|
static void
|
||||||
clutter_flow_layout_allocate (ClutterLayoutManager *manager,
|
clutter_flow_layout_allocate (ClutterLayoutManager *manager,
|
||||||
ClutterContainer *container,
|
ClutterContainer *container,
|
||||||
const ClutterActorBox *allocation)
|
const ClutterActorBox *allocation,
|
||||||
|
ClutterAllocationFlags flags)
|
||||||
{
|
{
|
||||||
ClutterFlowLayoutPrivate *priv = CLUTTER_FLOW_LAYOUT (manager)->priv;
|
ClutterFlowLayoutPrivate *priv = CLUTTER_FLOW_LAYOUT (manager)->priv;
|
||||||
ClutterActor *actor, *child;
|
ClutterActor *actor, *child;
|
||||||
@@ -728,7 +729,7 @@ clutter_flow_layout_allocate (ClutterLayoutManager *manager,
|
|||||||
child_alloc.y1 = ceil (item_y);
|
child_alloc.y1 = ceil (item_y);
|
||||||
child_alloc.x2 = ceil (child_alloc.x1 + item_width);
|
child_alloc.x2 = ceil (child_alloc.x1 + item_width);
|
||||||
child_alloc.y2 = ceil (child_alloc.y1 + item_height);
|
child_alloc.y2 = ceil (child_alloc.y1 + item_height);
|
||||||
clutter_actor_allocate (child, &child_alloc);
|
clutter_actor_allocate (child, &child_alloc, flags);
|
||||||
|
|
||||||
if (priv->orientation == CLUTTER_FLOW_HORIZONTAL)
|
if (priv->orientation == CLUTTER_FLOW_HORIZONTAL)
|
||||||
item_x = new_x;
|
item_x = new_x;
|
||||||
|
|||||||
@@ -157,8 +157,7 @@ G_DEFINE_TYPE_WITH_PRIVATE (ClutterGestureAction, clutter_gesture_action, CLUTTE
|
|||||||
static GesturePoint *
|
static GesturePoint *
|
||||||
gesture_register_point (ClutterGestureAction *action, ClutterEvent *event)
|
gesture_register_point (ClutterGestureAction *action, ClutterEvent *event)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv =
|
ClutterGestureActionPrivate *priv = action->priv;
|
||||||
clutter_gesture_action_get_instance_private (action);
|
|
||||||
GesturePoint *point = NULL;
|
GesturePoint *point = NULL;
|
||||||
|
|
||||||
if (priv->points->len >= MAX_GESTURE_POINTS)
|
if (priv->points->len >= MAX_GESTURE_POINTS)
|
||||||
@@ -191,8 +190,7 @@ gesture_find_point (ClutterGestureAction *action,
|
|||||||
ClutterEvent *event,
|
ClutterEvent *event,
|
||||||
gint *position)
|
gint *position)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv =
|
ClutterGestureActionPrivate *priv = action->priv;
|
||||||
clutter_gesture_action_get_instance_private (action);
|
|
||||||
GesturePoint *point = NULL;
|
GesturePoint *point = NULL;
|
||||||
ClutterEventType type = clutter_event_type (event);
|
ClutterEventType type = clutter_event_type (event);
|
||||||
ClutterInputDevice *device = clutter_event_get_device (event);
|
ClutterInputDevice *device = clutter_event_get_device (event);
|
||||||
@@ -222,10 +220,9 @@ gesture_find_point (ClutterGestureAction *action,
|
|||||||
static void
|
static void
|
||||||
gesture_unregister_point (ClutterGestureAction *action, gint position)
|
gesture_unregister_point (ClutterGestureAction *action, gint position)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv =
|
ClutterGestureActionPrivate *priv = action->priv;
|
||||||
clutter_gesture_action_get_instance_private (action);
|
|
||||||
|
|
||||||
if (priv->points->len == 0)
|
if (action->priv->points->len == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_array_remove_index (priv->points, position);
|
g_array_remove_index (priv->points, position);
|
||||||
@@ -306,8 +303,7 @@ gesture_point_unset (GesturePoint *point)
|
|||||||
static void
|
static void
|
||||||
cancel_gesture (ClutterGestureAction *action)
|
cancel_gesture (ClutterGestureAction *action)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv =
|
ClutterGestureActionPrivate *priv = action->priv;
|
||||||
clutter_gesture_action_get_instance_private (action);
|
|
||||||
ClutterActor *actor;
|
ClutterActor *actor;
|
||||||
|
|
||||||
priv->in_gesture = FALSE;
|
priv->in_gesture = FALSE;
|
||||||
@@ -317,15 +313,14 @@ cancel_gesture (ClutterGestureAction *action)
|
|||||||
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
|
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
|
||||||
g_signal_emit (action, gesture_signals[GESTURE_CANCEL], 0, actor);
|
g_signal_emit (action, gesture_signals[GESTURE_CANCEL], 0, actor);
|
||||||
|
|
||||||
g_array_set_size (priv->points, 0);
|
g_array_set_size (action->priv->points, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
begin_gesture (ClutterGestureAction *action,
|
begin_gesture (ClutterGestureAction *action,
|
||||||
ClutterActor *actor)
|
ClutterActor *actor)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv =
|
ClutterGestureActionPrivate *priv = action->priv;
|
||||||
clutter_gesture_action_get_instance_private (action);
|
|
||||||
gboolean return_value;
|
gboolean return_value;
|
||||||
|
|
||||||
priv->in_gesture = TRUE;
|
priv->in_gesture = TRUE;
|
||||||
@@ -358,8 +353,7 @@ stage_captured_event_cb (ClutterActor *stage,
|
|||||||
ClutterEvent *event,
|
ClutterEvent *event,
|
||||||
ClutterGestureAction *action)
|
ClutterGestureAction *action)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv =
|
ClutterGestureActionPrivate *priv = action->priv;
|
||||||
clutter_gesture_action_get_instance_private (action);
|
|
||||||
ClutterActor *actor;
|
ClutterActor *actor;
|
||||||
gint position;
|
gint position;
|
||||||
float threshold_x, threshold_y;
|
float threshold_x, threshold_y;
|
||||||
@@ -494,8 +488,7 @@ actor_captured_event_cb (ClutterActor *actor,
|
|||||||
ClutterEvent *event,
|
ClutterEvent *event,
|
||||||
ClutterGestureAction *action)
|
ClutterGestureAction *action)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv =
|
ClutterGestureActionPrivate *priv = action->priv;
|
||||||
clutter_gesture_action_get_instance_private (action);
|
|
||||||
GesturePoint *point G_GNUC_UNUSED;
|
GesturePoint *point G_GNUC_UNUSED;
|
||||||
|
|
||||||
if ((clutter_event_type (event) != CLUTTER_BUTTON_PRESS) &&
|
if ((clutter_event_type (event) != CLUTTER_BUTTON_PRESS) &&
|
||||||
@@ -529,8 +522,7 @@ static void
|
|||||||
clutter_gesture_action_set_actor (ClutterActorMeta *meta,
|
clutter_gesture_action_set_actor (ClutterActorMeta *meta,
|
||||||
ClutterActor *actor)
|
ClutterActor *actor)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv =
|
ClutterGestureActionPrivate *priv = CLUTTER_GESTURE_ACTION (meta)->priv;
|
||||||
clutter_gesture_action_get_instance_private (CLUTTER_GESTURE_ACTION (meta));
|
|
||||||
ClutterActorMetaClass *meta_class =
|
ClutterActorMetaClass *meta_class =
|
||||||
CLUTTER_ACTOR_META_CLASS (clutter_gesture_action_parent_class);
|
CLUTTER_ACTOR_META_CLASS (clutter_gesture_action_parent_class);
|
||||||
|
|
||||||
@@ -571,8 +563,7 @@ clutter_gesture_action_set_enabled (ClutterActorMeta *meta,
|
|||||||
ClutterActorMetaClass *meta_class =
|
ClutterActorMetaClass *meta_class =
|
||||||
CLUTTER_ACTOR_META_CLASS (clutter_gesture_action_parent_class);
|
CLUTTER_ACTOR_META_CLASS (clutter_gesture_action_parent_class);
|
||||||
ClutterGestureAction *gesture_action = CLUTTER_GESTURE_ACTION (meta);
|
ClutterGestureAction *gesture_action = CLUTTER_GESTURE_ACTION (meta);
|
||||||
ClutterGestureActionPrivate *priv =
|
ClutterGestureActionPrivate *priv = gesture_action->priv;
|
||||||
clutter_gesture_action_get_instance_private (gesture_action);
|
|
||||||
|
|
||||||
if (!is_enabled && priv->in_gesture)
|
if (!is_enabled && priv->in_gesture)
|
||||||
cancel_gesture (gesture_action);
|
cancel_gesture (gesture_action);
|
||||||
@@ -594,8 +585,6 @@ clutter_gesture_action_set_property (GObject *gobject,
|
|||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
ClutterGestureAction *self = CLUTTER_GESTURE_ACTION (gobject);
|
ClutterGestureAction *self = CLUTTER_GESTURE_ACTION (gobject);
|
||||||
ClutterGestureActionPrivate *priv =
|
|
||||||
clutter_gesture_action_get_instance_private (self);
|
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
@@ -608,15 +597,11 @@ clutter_gesture_action_set_property (GObject *gobject,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_THRESHOLD_TRIGGER_DISTANCE_X:
|
case PROP_THRESHOLD_TRIGGER_DISTANCE_X:
|
||||||
clutter_gesture_action_set_threshold_trigger_distance (self,
|
clutter_gesture_action_set_threshold_trigger_distance (self, g_value_get_float (value), self->priv->distance_y);
|
||||||
g_value_get_float (value),
|
|
||||||
priv->distance_y);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_THRESHOLD_TRIGGER_DISTANCE_Y:
|
case PROP_THRESHOLD_TRIGGER_DISTANCE_Y:
|
||||||
clutter_gesture_action_set_threshold_trigger_distance (self,
|
clutter_gesture_action_set_threshold_trigger_distance (self, self->priv->distance_x, g_value_get_float (value));
|
||||||
priv->distance_x,
|
|
||||||
g_value_get_float (value));
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -631,29 +616,28 @@ clutter_gesture_action_get_property (GObject *gobject,
|
|||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv =
|
ClutterGestureAction *self = CLUTTER_GESTURE_ACTION (gobject);
|
||||||
clutter_gesture_action_get_instance_private (CLUTTER_GESTURE_ACTION (gobject));
|
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_N_TOUCH_POINTS:
|
case PROP_N_TOUCH_POINTS:
|
||||||
g_value_set_int (value, priv->requested_nb_points);
|
g_value_set_int (value, self->priv->requested_nb_points);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_THRESHOLD_TRIGGER_EDGE:
|
case PROP_THRESHOLD_TRIGGER_EDGE:
|
||||||
g_value_set_enum (value, priv->edge);
|
g_value_set_enum (value, self->priv->edge);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_THRESHOLD_TRIGGER_DISTANCE_X:
|
case PROP_THRESHOLD_TRIGGER_DISTANCE_X:
|
||||||
if (priv->distance_x > 0.0)
|
if (self->priv->distance_x > 0.0)
|
||||||
g_value_set_float (value, priv->distance_x);
|
g_value_set_float (value, self->priv->distance_x);
|
||||||
else
|
else
|
||||||
g_value_set_float (value, gesture_get_default_threshold ());
|
g_value_set_float (value, gesture_get_default_threshold ());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_THRESHOLD_TRIGGER_DISTANCE_Y:
|
case PROP_THRESHOLD_TRIGGER_DISTANCE_Y:
|
||||||
if (priv->distance_y > 0.0)
|
if (self->priv->distance_y > 0.0)
|
||||||
g_value_set_float (value, priv->distance_y);
|
g_value_set_float (value, self->priv->distance_y);
|
||||||
else
|
else
|
||||||
g_value_set_float (value, gesture_get_default_threshold ());
|
g_value_set_float (value, gesture_get_default_threshold ());
|
||||||
break;
|
break;
|
||||||
@@ -667,8 +651,7 @@ clutter_gesture_action_get_property (GObject *gobject,
|
|||||||
static void
|
static void
|
||||||
clutter_gesture_action_finalize (GObject *gobject)
|
clutter_gesture_action_finalize (GObject *gobject)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv =
|
ClutterGestureActionPrivate *priv = CLUTTER_GESTURE_ACTION (gobject)->priv;
|
||||||
clutter_gesture_action_get_instance_private (CLUTTER_GESTURE_ACTION (gobject));
|
|
||||||
|
|
||||||
g_array_unref (priv->points);
|
g_array_unref (priv->points);
|
||||||
|
|
||||||
@@ -860,14 +843,13 @@ clutter_gesture_action_class_init (ClutterGestureActionClass *klass)
|
|||||||
static void
|
static void
|
||||||
clutter_gesture_action_init (ClutterGestureAction *self)
|
clutter_gesture_action_init (ClutterGestureAction *self)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv =
|
self->priv = clutter_gesture_action_get_instance_private (self);
|
||||||
clutter_gesture_action_get_instance_private (self);
|
|
||||||
|
|
||||||
priv->points = g_array_sized_new (FALSE, TRUE, sizeof (GesturePoint), 3);
|
self->priv->points = g_array_sized_new (FALSE, TRUE, sizeof (GesturePoint), 3);
|
||||||
g_array_set_clear_func (priv->points, (GDestroyNotify) gesture_point_unset);
|
g_array_set_clear_func (self->priv->points, (GDestroyNotify) gesture_point_unset);
|
||||||
|
|
||||||
priv->requested_nb_points = 1;
|
self->priv->requested_nb_points = 1;
|
||||||
priv->edge = CLUTTER_GESTURE_TRIGGER_EDGE_NONE;
|
self->priv->edge = CLUTTER_GESTURE_TRIGGER_EDGE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -906,21 +888,16 @@ clutter_gesture_action_get_press_coords (ClutterGestureAction *action,
|
|||||||
gfloat *press_x,
|
gfloat *press_x,
|
||||||
gfloat *press_y)
|
gfloat *press_y)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv;
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
|
g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
|
||||||
|
g_return_if_fail (action->priv->points->len > point);
|
||||||
priv = clutter_gesture_action_get_instance_private (action);
|
|
||||||
|
|
||||||
g_return_if_fail (priv->points->len > point);
|
|
||||||
|
|
||||||
if (press_x)
|
if (press_x)
|
||||||
*press_x = g_array_index (priv->points,
|
*press_x = g_array_index (action->priv->points,
|
||||||
GesturePoint,
|
GesturePoint,
|
||||||
point).press_x;
|
point).press_x;
|
||||||
|
|
||||||
if (press_y)
|
if (press_y)
|
||||||
*press_y = g_array_index (priv->points,
|
*press_y = g_array_index (action->priv->points,
|
||||||
GesturePoint,
|
GesturePoint,
|
||||||
point).press_y;
|
point).press_y;
|
||||||
}
|
}
|
||||||
@@ -946,21 +923,16 @@ clutter_gesture_action_get_motion_coords (ClutterGestureAction *action,
|
|||||||
gfloat *motion_x,
|
gfloat *motion_x,
|
||||||
gfloat *motion_y)
|
gfloat *motion_y)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv;
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
|
g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
|
||||||
|
g_return_if_fail (action->priv->points->len > point);
|
||||||
priv = clutter_gesture_action_get_instance_private (action);
|
|
||||||
|
|
||||||
g_return_if_fail (priv->points->len > point);
|
|
||||||
|
|
||||||
if (motion_x)
|
if (motion_x)
|
||||||
*motion_x = g_array_index (priv->points,
|
*motion_x = g_array_index (action->priv->points,
|
||||||
GesturePoint,
|
GesturePoint,
|
||||||
point).last_motion_x;
|
point).last_motion_x;
|
||||||
|
|
||||||
if (motion_y)
|
if (motion_y)
|
||||||
*motion_y = g_array_index (priv->points,
|
*motion_y = g_array_index (action->priv->points,
|
||||||
GesturePoint,
|
GesturePoint,
|
||||||
point).last_motion_y;
|
point).last_motion_y;
|
||||||
}
|
}
|
||||||
@@ -988,19 +960,15 @@ clutter_gesture_action_get_motion_delta (ClutterGestureAction *action,
|
|||||||
gfloat *delta_x,
|
gfloat *delta_x,
|
||||||
gfloat *delta_y)
|
gfloat *delta_y)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv;
|
|
||||||
gfloat d_x, d_y;
|
gfloat d_x, d_y;
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), 0);
|
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), 0);
|
||||||
|
g_return_val_if_fail (action->priv->points->len > point, 0);
|
||||||
|
|
||||||
priv = clutter_gesture_action_get_instance_private (action);
|
d_x = g_array_index (action->priv->points,
|
||||||
|
|
||||||
g_return_val_if_fail (priv->points->len > point, 0);
|
|
||||||
|
|
||||||
d_x = g_array_index (priv->points,
|
|
||||||
GesturePoint,
|
GesturePoint,
|
||||||
point).last_delta_x;
|
point).last_delta_x;
|
||||||
d_y = g_array_index (priv->points,
|
d_y = g_array_index (action->priv->points,
|
||||||
GesturePoint,
|
GesturePoint,
|
||||||
point).last_delta_y;
|
point).last_delta_y;
|
||||||
|
|
||||||
@@ -1034,21 +1002,16 @@ clutter_gesture_action_get_release_coords (ClutterGestureAction *action,
|
|||||||
gfloat *release_x,
|
gfloat *release_x,
|
||||||
gfloat *release_y)
|
gfloat *release_y)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv;
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
|
g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
|
||||||
|
g_return_if_fail (action->priv->points->len > point);
|
||||||
priv = clutter_gesture_action_get_instance_private (action);
|
|
||||||
|
|
||||||
g_return_if_fail (priv->points->len > point);
|
|
||||||
|
|
||||||
if (release_x)
|
if (release_x)
|
||||||
*release_x = g_array_index (priv->points,
|
*release_x = g_array_index (action->priv->points,
|
||||||
GesturePoint,
|
GesturePoint,
|
||||||
point).release_x;
|
point).release_x;
|
||||||
|
|
||||||
if (release_y)
|
if (release_y)
|
||||||
*release_y = g_array_index (priv->points,
|
*release_y = g_array_index (action->priv->points,
|
||||||
GesturePoint,
|
GesturePoint,
|
||||||
point).release_y;
|
point).release_y;
|
||||||
}
|
}
|
||||||
@@ -1074,20 +1037,16 @@ clutter_gesture_action_get_velocity (ClutterGestureAction *action,
|
|||||||
gfloat *velocity_x,
|
gfloat *velocity_x,
|
||||||
gfloat *velocity_y)
|
gfloat *velocity_y)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv;
|
|
||||||
gfloat d_x, d_y, distance, velocity;
|
gfloat d_x, d_y, distance, velocity;
|
||||||
gint64 d_t;
|
gint64 d_t;
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), 0);
|
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), 0);
|
||||||
|
g_return_val_if_fail (action->priv->points->len > point, 0);
|
||||||
priv = clutter_gesture_action_get_instance_private (action);
|
|
||||||
|
|
||||||
g_return_val_if_fail (priv->points->len > point, 0);
|
|
||||||
|
|
||||||
distance = clutter_gesture_action_get_motion_delta (action, point,
|
distance = clutter_gesture_action_get_motion_delta (action, point,
|
||||||
&d_x, &d_y);
|
&d_x, &d_y);
|
||||||
|
|
||||||
d_t = g_array_index (priv->points,
|
d_t = g_array_index (action->priv->points,
|
||||||
GesturePoint,
|
GesturePoint,
|
||||||
point).last_delta_time;
|
point).last_delta_time;
|
||||||
|
|
||||||
@@ -1114,13 +1073,9 @@ clutter_gesture_action_get_velocity (ClutterGestureAction *action,
|
|||||||
gint
|
gint
|
||||||
clutter_gesture_action_get_n_touch_points (ClutterGestureAction *action)
|
clutter_gesture_action_get_n_touch_points (ClutterGestureAction *action)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv;
|
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), 0);
|
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), 0);
|
||||||
|
|
||||||
priv = clutter_gesture_action_get_instance_private (action);
|
return action->priv->requested_nb_points;
|
||||||
|
|
||||||
return priv->requested_nb_points;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1141,7 +1096,7 @@ clutter_gesture_action_set_n_touch_points (ClutterGestureAction *action,
|
|||||||
g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
|
g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
|
||||||
g_return_if_fail (nb_points >= 1);
|
g_return_if_fail (nb_points >= 1);
|
||||||
|
|
||||||
priv = clutter_gesture_action_get_instance_private (action);
|
priv = action->priv;
|
||||||
|
|
||||||
if (priv->requested_nb_points == nb_points)
|
if (priv->requested_nb_points == nb_points)
|
||||||
return;
|
return;
|
||||||
@@ -1195,13 +1150,9 @@ clutter_gesture_action_set_n_touch_points (ClutterGestureAction *action,
|
|||||||
guint
|
guint
|
||||||
clutter_gesture_action_get_n_current_points (ClutterGestureAction *action)
|
clutter_gesture_action_get_n_current_points (ClutterGestureAction *action)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv;
|
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), 0);
|
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), 0);
|
||||||
|
|
||||||
priv = clutter_gesture_action_get_instance_private (action);
|
return action->priv->points->len;
|
||||||
|
|
||||||
return priv->points->len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1219,15 +1170,10 @@ ClutterEventSequence *
|
|||||||
clutter_gesture_action_get_sequence (ClutterGestureAction *action,
|
clutter_gesture_action_get_sequence (ClutterGestureAction *action,
|
||||||
guint point)
|
guint point)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv;
|
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), NULL);
|
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), NULL);
|
||||||
|
g_return_val_if_fail (action->priv->points->len > point, NULL);
|
||||||
|
|
||||||
priv = clutter_gesture_action_get_instance_private (action);
|
return g_array_index (action->priv->points, GesturePoint, point).sequence;
|
||||||
|
|
||||||
g_return_val_if_fail (priv->points->len > point, NULL);
|
|
||||||
|
|
||||||
return g_array_index (priv->points, GesturePoint, point).sequence;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1246,15 +1192,10 @@ ClutterInputDevice *
|
|||||||
clutter_gesture_action_get_device (ClutterGestureAction *action,
|
clutter_gesture_action_get_device (ClutterGestureAction *action,
|
||||||
guint point)
|
guint point)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv;
|
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), NULL);
|
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), NULL);
|
||||||
|
g_return_val_if_fail (action->priv->points->len > point, NULL);
|
||||||
|
|
||||||
priv = clutter_gesture_action_get_instance_private (action);
|
return g_array_index (action->priv->points, GesturePoint, point).device;
|
||||||
|
|
||||||
g_return_val_if_fail (priv->points->len > point, NULL);
|
|
||||||
|
|
||||||
return g_array_index (priv->points, GesturePoint, point).device;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1274,15 +1215,11 @@ clutter_gesture_action_get_last_event (ClutterGestureAction *action,
|
|||||||
guint point)
|
guint point)
|
||||||
{
|
{
|
||||||
GesturePoint *gesture_point;
|
GesturePoint *gesture_point;
|
||||||
ClutterGestureActionPrivate *priv;
|
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), NULL);
|
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), NULL);
|
||||||
|
g_return_val_if_fail (action->priv->points->len > point, NULL);
|
||||||
|
|
||||||
priv = clutter_gesture_action_get_instance_private (action);
|
gesture_point = &g_array_index (action->priv->points, GesturePoint, point);
|
||||||
|
|
||||||
g_return_val_if_fail (priv->points->len > point, NULL);
|
|
||||||
|
|
||||||
gesture_point = &g_array_index (priv->points, GesturePoint, point);
|
|
||||||
|
|
||||||
return gesture_point->last_event;
|
return gesture_point->last_event;
|
||||||
}
|
}
|
||||||
@@ -1319,16 +1256,12 @@ void
|
|||||||
clutter_gesture_action_set_threshold_trigger_edge (ClutterGestureAction *action,
|
clutter_gesture_action_set_threshold_trigger_edge (ClutterGestureAction *action,
|
||||||
ClutterGestureTriggerEdge edge)
|
ClutterGestureTriggerEdge edge)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv;
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
|
g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
|
||||||
|
|
||||||
priv = clutter_gesture_action_get_instance_private (action);
|
if (action->priv->edge == edge)
|
||||||
|
|
||||||
if (priv->edge == edge)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
priv->edge = edge;
|
action->priv->edge = edge;
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (action), gesture_props[PROP_THRESHOLD_TRIGGER_EDGE]);
|
g_object_notify_by_pspec (G_OBJECT (action), gesture_props[PROP_THRESHOLD_TRIGGER_EDGE]);
|
||||||
}
|
}
|
||||||
@@ -1347,14 +1280,10 @@ clutter_gesture_action_set_threshold_trigger_edge (ClutterGestureAction *ac
|
|||||||
ClutterGestureTriggerEdge
|
ClutterGestureTriggerEdge
|
||||||
clutter_gesture_action_get_threshold_trigger_edge (ClutterGestureAction *action)
|
clutter_gesture_action_get_threshold_trigger_edge (ClutterGestureAction *action)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv;
|
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action),
|
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action),
|
||||||
CLUTTER_GESTURE_TRIGGER_EDGE_NONE);
|
CLUTTER_GESTURE_TRIGGER_EDGE_NONE);
|
||||||
|
|
||||||
priv = clutter_gesture_action_get_instance_private (action);
|
return action->priv->edge;
|
||||||
|
|
||||||
return priv->edge;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1394,21 +1323,17 @@ clutter_gesture_action_set_threshold_trigger_distance (ClutterGestureAction
|
|||||||
float x,
|
float x,
|
||||||
float y)
|
float y)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv;
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
|
g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
|
||||||
|
|
||||||
priv = clutter_gesture_action_get_instance_private (action);
|
if (fabsf (x - action->priv->distance_x) > FLOAT_EPSILON)
|
||||||
|
|
||||||
if (fabsf (x - priv->distance_x) > FLOAT_EPSILON)
|
|
||||||
{
|
{
|
||||||
priv->distance_x = x;
|
action->priv->distance_x = x;
|
||||||
g_object_notify_by_pspec (G_OBJECT (action), gesture_props[PROP_THRESHOLD_TRIGGER_DISTANCE_X]);
|
g_object_notify_by_pspec (G_OBJECT (action), gesture_props[PROP_THRESHOLD_TRIGGER_DISTANCE_X]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fabsf (y - priv->distance_y) > FLOAT_EPSILON)
|
if (fabsf (y - action->priv->distance_y) > FLOAT_EPSILON)
|
||||||
{
|
{
|
||||||
priv->distance_y = y;
|
action->priv->distance_y = y;
|
||||||
g_object_notify_by_pspec (G_OBJECT (action), gesture_props[PROP_THRESHOLD_TRIGGER_DISTANCE_Y]);
|
g_object_notify_by_pspec (G_OBJECT (action), gesture_props[PROP_THRESHOLD_TRIGGER_DISTANCE_Y]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1429,23 +1354,19 @@ clutter_gesture_action_get_threshold_trigger_distance (ClutterGestureAction *act
|
|||||||
float *x,
|
float *x,
|
||||||
float *y)
|
float *y)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv;
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
|
g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
|
||||||
|
|
||||||
priv = clutter_gesture_action_get_instance_private (action);
|
|
||||||
|
|
||||||
if (x != NULL)
|
if (x != NULL)
|
||||||
{
|
{
|
||||||
if (priv->distance_x > 0.0)
|
if (action->priv->distance_x > 0.0)
|
||||||
*x = priv->distance_x;
|
*x = action->priv->distance_x;
|
||||||
else
|
else
|
||||||
*x = gesture_get_default_threshold ();
|
*x = gesture_get_default_threshold ();
|
||||||
}
|
}
|
||||||
if (y != NULL)
|
if (y != NULL)
|
||||||
{
|
{
|
||||||
if (priv->distance_y > 0.0)
|
if (action->priv->distance_y > 0.0)
|
||||||
*y = priv->distance_y;
|
*y = action->priv->distance_y;
|
||||||
else
|
else
|
||||||
*y = gesture_get_default_threshold ();
|
*y = gesture_get_default_threshold ();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,13 +34,32 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define CLUTTER_TYPE_GESTURE_ACTION (clutter_gesture_action_get_type ())
|
#define CLUTTER_TYPE_GESTURE_ACTION (clutter_gesture_action_get_type ())
|
||||||
|
#define CLUTTER_GESTURE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_GESTURE_ACTION, ClutterGestureAction))
|
||||||
|
#define CLUTTER_IS_GESTURE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_GESTURE_ACTION))
|
||||||
|
#define CLUTTER_GESTURE_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_GESTURE_ACTION, ClutterGestureActionClass))
|
||||||
|
#define CLUTTER_IS_GESTURE_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_GESTURE_ACTION))
|
||||||
|
#define CLUTTER_GESTURE_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_GESTURE_ACTION, ClutterGestureActionClass))
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
typedef struct _ClutterGestureAction ClutterGestureAction;
|
||||||
G_DECLARE_DERIVABLE_TYPE (ClutterGestureAction, clutter_gesture_action,
|
typedef struct _ClutterGestureActionPrivate ClutterGestureActionPrivate;
|
||||||
CLUTTER, GESTURE_ACTION, ClutterAction);
|
typedef struct _ClutterGestureActionClass ClutterGestureActionClass;
|
||||||
|
|
||||||
typedef struct _ClutterGestureActionPrivate ClutterGestureActionPrivate;
|
/**
|
||||||
|
* ClutterGestureAction:
|
||||||
|
*
|
||||||
|
* The #ClutterGestureAction structure contains
|
||||||
|
* only private data and should be accessed using the provided API
|
||||||
|
*
|
||||||
|
* Since: 1.8
|
||||||
|
*/
|
||||||
|
struct _ClutterGestureAction
|
||||||
|
{
|
||||||
|
/*< private >*/
|
||||||
|
ClutterAction parent_instance;
|
||||||
|
|
||||||
|
ClutterGestureActionPrivate *priv;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterGestureActionClass:
|
* ClutterGestureActionClass:
|
||||||
@@ -82,6 +101,9 @@ struct _ClutterGestureActionClass
|
|||||||
void (* _clutter_gesture_action6) (void);
|
void (* _clutter_gesture_action6) (void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
GType clutter_gesture_action_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
ClutterAction * clutter_gesture_action_new (void);
|
ClutterAction * clutter_gesture_action_new (void);
|
||||||
|
|
||||||
|
|||||||
@@ -1391,7 +1391,8 @@ allocate_child (ClutterGridRequest *request,
|
|||||||
static void
|
static void
|
||||||
clutter_grid_layout_allocate (ClutterLayoutManager *layout,
|
clutter_grid_layout_allocate (ClutterLayoutManager *layout,
|
||||||
ClutterContainer *container,
|
ClutterContainer *container,
|
||||||
const ClutterActorBox *allocation)
|
const ClutterActorBox *allocation,
|
||||||
|
ClutterAllocationFlags flags)
|
||||||
{
|
{
|
||||||
ClutterGridLayout *self = CLUTTER_GRID_LAYOUT (layout);
|
ClutterGridLayout *self = CLUTTER_GRID_LAYOUT (layout);
|
||||||
ClutterOrientation orientation;
|
ClutterOrientation orientation;
|
||||||
@@ -1452,7 +1453,7 @@ clutter_grid_layout_allocate (ClutterLayoutManager *layout,
|
|||||||
child_allocation.x2 = child_allocation.x1 + width;
|
child_allocation.x2 = child_allocation.x1 + width;
|
||||||
child_allocation.y2 = child_allocation.y1 + height;
|
child_allocation.y2 = child_allocation.y1 + height;
|
||||||
|
|
||||||
clutter_actor_allocate (child, &child_allocation);
|
clutter_actor_allocate (child, &child_allocation, flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,9 @@
|
|||||||
* any object taking a reference on a #ClutterInterval instance should
|
* any object taking a reference on a #ClutterInterval instance should
|
||||||
* also take ownership of the interval by using g_object_ref_sink().
|
* also take ownership of the interval by using g_object_ref_sink().
|
||||||
*
|
*
|
||||||
|
* #ClutterInterval is used by #ClutterAnimation to define the
|
||||||
|
* interval of values that an implicit animation should tween over.
|
||||||
|
*
|
||||||
* #ClutterInterval can be subclassed to override the validation
|
* #ClutterInterval can be subclassed to override the validation
|
||||||
* and value computation.
|
* and value computation.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -136,6 +136,7 @@
|
|||||||
|
|
||||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||||
#include "deprecated/clutter-container.h"
|
#include "deprecated/clutter-container.h"
|
||||||
|
#include "deprecated/clutter-alpha.h"
|
||||||
|
|
||||||
#include "clutter-debug.h"
|
#include "clutter-debug.h"
|
||||||
#include "clutter-layout-manager.h"
|
#include "clutter-layout-manager.h"
|
||||||
@@ -163,6 +164,7 @@ G_DEFINE_ABSTRACT_TYPE (ClutterLayoutManager,
|
|||||||
G_TYPE_INITIALLY_UNOWNED)
|
G_TYPE_INITIALLY_UNOWNED)
|
||||||
|
|
||||||
static GQuark quark_layout_meta = 0;
|
static GQuark quark_layout_meta = 0;
|
||||||
|
static GQuark quark_layout_alpha = 0;
|
||||||
|
|
||||||
static guint manager_signals[LAST_SIGNAL] = { 0, };
|
static guint manager_signals[LAST_SIGNAL] = { 0, };
|
||||||
|
|
||||||
@@ -253,7 +255,8 @@ layout_manager_real_get_preferred_height (ClutterLayoutManager *manager,
|
|||||||
static void
|
static void
|
||||||
layout_manager_real_allocate (ClutterLayoutManager *manager,
|
layout_manager_real_allocate (ClutterLayoutManager *manager,
|
||||||
ClutterContainer *container,
|
ClutterContainer *container,
|
||||||
const ClutterActorBox *allocation)
|
const ClutterActorBox *allocation,
|
||||||
|
ClutterAllocationFlags flags)
|
||||||
{
|
{
|
||||||
LAYOUT_MANAGER_WARN_NOT_IMPLEMENTED (manager, "allocate");
|
LAYOUT_MANAGER_WARN_NOT_IMPLEMENTED (manager, "allocate");
|
||||||
}
|
}
|
||||||
@@ -298,12 +301,96 @@ layout_manager_real_get_child_meta_type (ClutterLayoutManager *manager)
|
|||||||
return G_TYPE_INVALID;
|
return G_TYPE_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* XXX:2.0 - Remove */
|
||||||
|
static ClutterAlpha *
|
||||||
|
layout_manager_real_begin_animation (ClutterLayoutManager *manager,
|
||||||
|
guint duration,
|
||||||
|
gulong mode)
|
||||||
|
{
|
||||||
|
ClutterTimeline *timeline;
|
||||||
|
ClutterAlpha *alpha;
|
||||||
|
|
||||||
|
alpha = g_object_get_qdata (G_OBJECT (manager), quark_layout_alpha);
|
||||||
|
if (alpha != NULL)
|
||||||
|
{
|
||||||
|
clutter_alpha_set_mode (alpha, mode);
|
||||||
|
|
||||||
|
timeline = clutter_alpha_get_timeline (alpha);
|
||||||
|
clutter_timeline_set_duration (timeline, duration);
|
||||||
|
clutter_timeline_rewind (timeline);
|
||||||
|
|
||||||
|
return alpha;
|
||||||
|
};
|
||||||
|
|
||||||
|
timeline = clutter_timeline_new (duration);
|
||||||
|
|
||||||
|
alpha = clutter_alpha_new_full (timeline, mode);
|
||||||
|
|
||||||
|
/* let the alpha take ownership of the timeline */
|
||||||
|
g_object_unref (timeline);
|
||||||
|
|
||||||
|
g_signal_connect_swapped (timeline, "new-frame",
|
||||||
|
G_CALLBACK (clutter_layout_manager_layout_changed),
|
||||||
|
manager);
|
||||||
|
|
||||||
|
g_object_set_qdata_full (G_OBJECT (manager),
|
||||||
|
quark_layout_alpha, alpha,
|
||||||
|
(GDestroyNotify) g_object_unref);
|
||||||
|
|
||||||
|
clutter_timeline_start (timeline);
|
||||||
|
|
||||||
|
return alpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* XXX:2.0 - Remove */
|
||||||
|
static gdouble
|
||||||
|
layout_manager_real_get_animation_progress (ClutterLayoutManager *manager)
|
||||||
|
{
|
||||||
|
ClutterAlpha *alpha;
|
||||||
|
|
||||||
|
alpha = g_object_get_qdata (G_OBJECT (manager), quark_layout_alpha);
|
||||||
|
if (alpha == NULL)
|
||||||
|
return 1.0;
|
||||||
|
|
||||||
|
return clutter_alpha_get_alpha (alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* XXX:2.0 - Remove */
|
||||||
|
static void
|
||||||
|
layout_manager_real_end_animation (ClutterLayoutManager *manager)
|
||||||
|
{
|
||||||
|
ClutterTimeline *timeline;
|
||||||
|
ClutterAlpha *alpha;
|
||||||
|
|
||||||
|
alpha = g_object_get_qdata (G_OBJECT (manager), quark_layout_alpha);
|
||||||
|
if (alpha == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
timeline = clutter_alpha_get_timeline (alpha);
|
||||||
|
g_assert (timeline != NULL);
|
||||||
|
|
||||||
|
if (clutter_timeline_is_playing (timeline))
|
||||||
|
clutter_timeline_stop (timeline);
|
||||||
|
|
||||||
|
g_signal_handlers_disconnect_by_func (timeline,
|
||||||
|
G_CALLBACK (clutter_layout_manager_layout_changed),
|
||||||
|
manager);
|
||||||
|
|
||||||
|
g_object_set_qdata (G_OBJECT (manager), quark_layout_alpha, NULL);
|
||||||
|
|
||||||
|
clutter_layout_manager_layout_changed (manager);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_layout_manager_class_init (ClutterLayoutManagerClass *klass)
|
clutter_layout_manager_class_init (ClutterLayoutManagerClass *klass)
|
||||||
{
|
{
|
||||||
quark_layout_meta =
|
quark_layout_meta =
|
||||||
g_quark_from_static_string ("clutter-layout-manager-child-meta");
|
g_quark_from_static_string ("clutter-layout-manager-child-meta");
|
||||||
|
|
||||||
|
/* XXX:2.0 - Remove */
|
||||||
|
quark_layout_alpha =
|
||||||
|
g_quark_from_static_string ("clutter-layout-manager-alpha");
|
||||||
|
|
||||||
klass->get_preferred_width = layout_manager_real_get_preferred_width;
|
klass->get_preferred_width = layout_manager_real_get_preferred_width;
|
||||||
klass->get_preferred_height = layout_manager_real_get_preferred_height;
|
klass->get_preferred_height = layout_manager_real_get_preferred_height;
|
||||||
klass->allocate = layout_manager_real_allocate;
|
klass->allocate = layout_manager_real_allocate;
|
||||||
@@ -311,6 +398,9 @@ clutter_layout_manager_class_init (ClutterLayoutManagerClass *klass)
|
|||||||
klass->get_child_meta_type = layout_manager_real_get_child_meta_type;
|
klass->get_child_meta_type = layout_manager_real_get_child_meta_type;
|
||||||
|
|
||||||
/* XXX:2.0 - Remove */
|
/* XXX:2.0 - Remove */
|
||||||
|
klass->begin_animation = layout_manager_real_begin_animation;
|
||||||
|
klass->get_animation_progress = layout_manager_real_get_animation_progress;
|
||||||
|
klass->end_animation = layout_manager_real_end_animation;
|
||||||
klass->set_container = layout_manager_real_set_container;
|
klass->set_container = layout_manager_real_set_container;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -433,6 +523,7 @@ clutter_layout_manager_get_preferred_height (ClutterLayoutManager *manager,
|
|||||||
* @container: the #ClutterContainer using @manager
|
* @container: the #ClutterContainer using @manager
|
||||||
* @allocation: the #ClutterActorBox containing the allocated area
|
* @allocation: the #ClutterActorBox containing the allocated area
|
||||||
* of @container
|
* of @container
|
||||||
|
* @flags: the allocation flags
|
||||||
*
|
*
|
||||||
* Allocates the children of @container given an area
|
* Allocates the children of @container given an area
|
||||||
*
|
*
|
||||||
@@ -443,7 +534,8 @@ clutter_layout_manager_get_preferred_height (ClutterLayoutManager *manager,
|
|||||||
void
|
void
|
||||||
clutter_layout_manager_allocate (ClutterLayoutManager *manager,
|
clutter_layout_manager_allocate (ClutterLayoutManager *manager,
|
||||||
ClutterContainer *container,
|
ClutterContainer *container,
|
||||||
const ClutterActorBox *allocation)
|
const ClutterActorBox *allocation,
|
||||||
|
ClutterAllocationFlags flags)
|
||||||
{
|
{
|
||||||
ClutterLayoutManagerClass *klass;
|
ClutterLayoutManagerClass *klass;
|
||||||
|
|
||||||
@@ -452,7 +544,7 @@ clutter_layout_manager_allocate (ClutterLayoutManager *manager,
|
|||||||
g_return_if_fail (allocation != NULL);
|
g_return_if_fail (allocation != NULL);
|
||||||
|
|
||||||
klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
|
klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
|
||||||
klass->allocate (manager, container, allocation);
|
klass->allocate (manager, container, allocation, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -115,7 +115,8 @@ struct _ClutterLayoutManagerClass
|
|||||||
gfloat *nat_height_p);
|
gfloat *nat_height_p);
|
||||||
void (* allocate) (ClutterLayoutManager *manager,
|
void (* allocate) (ClutterLayoutManager *manager,
|
||||||
ClutterContainer *container,
|
ClutterContainer *container,
|
||||||
const ClutterActorBox *allocation);
|
const ClutterActorBox *allocation,
|
||||||
|
ClutterAllocationFlags flags);
|
||||||
|
|
||||||
void (* set_container) (ClutterLayoutManager *manager,
|
void (* set_container) (ClutterLayoutManager *manager,
|
||||||
ClutterContainer *container);
|
ClutterContainer *container);
|
||||||
@@ -125,6 +126,15 @@ struct _ClutterLayoutManagerClass
|
|||||||
ClutterContainer *container,
|
ClutterContainer *container,
|
||||||
ClutterActor *actor);
|
ClutterActor *actor);
|
||||||
|
|
||||||
|
/* deprecated */
|
||||||
|
ClutterAlpha * (* begin_animation) (ClutterLayoutManager *manager,
|
||||||
|
guint duration,
|
||||||
|
gulong mode);
|
||||||
|
/* deprecated */
|
||||||
|
gdouble (* get_animation_progress) (ClutterLayoutManager *manager);
|
||||||
|
/* deprecated */
|
||||||
|
void (* end_animation) (ClutterLayoutManager *manager);
|
||||||
|
|
||||||
void (* layout_changed) (ClutterLayoutManager *manager);
|
void (* layout_changed) (ClutterLayoutManager *manager);
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
@@ -157,7 +167,8 @@ void clutter_layout_manager_get_preferred_height (ClutterLayoutMa
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_layout_manager_allocate (ClutterLayoutManager *manager,
|
void clutter_layout_manager_allocate (ClutterLayoutManager *manager,
|
||||||
ClutterContainer *container,
|
ClutterContainer *container,
|
||||||
const ClutterActorBox *allocation);
|
const ClutterActorBox *allocation,
|
||||||
|
ClutterAllocationFlags flags);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_layout_manager_set_container (ClutterLayoutManager *manager,
|
void clutter_layout_manager_set_container (ClutterLayoutManager *manager,
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ master_clock_schedule_stage_updates (ClutterMasterClockDefault *master_clock)
|
|||||||
stages = clutter_stage_manager_peek_stages (stage_manager);
|
stages = clutter_stage_manager_peek_stages (stage_manager);
|
||||||
|
|
||||||
for (l = stages; l != NULL; l = l->next)
|
for (l = stages; l != NULL; l = l->next)
|
||||||
clutter_stage_schedule_update (l->data);
|
_clutter_stage_schedule_update (l->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GSList *
|
static GSList *
|
||||||
@@ -252,7 +252,7 @@ master_clock_reschedule_stage_updates (ClutterMasterClockDefault *master_clock,
|
|||||||
if (master_clock->timelines ||
|
if (master_clock->timelines ||
|
||||||
_clutter_stage_has_queued_events (l->data) ||
|
_clutter_stage_has_queued_events (l->data) ||
|
||||||
_clutter_stage_needs_update (l->data))
|
_clutter_stage_needs_update (l->data))
|
||||||
clutter_stage_schedule_update (l->data);
|
_clutter_stage_schedule_update (l->data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ typedef struct _ClutterVertex4 ClutterVertex4;
|
|||||||
|
|
||||||
#define CLUTTER_ACTOR_IS_TOPLEVEL(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IS_TOPLEVEL) != FALSE)
|
#define CLUTTER_ACTOR_IS_TOPLEVEL(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IS_TOPLEVEL) != FALSE)
|
||||||
#define CLUTTER_ACTOR_IN_DESTRUCTION(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_DESTRUCTION) != FALSE)
|
#define CLUTTER_ACTOR_IN_DESTRUCTION(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_DESTRUCTION) != FALSE)
|
||||||
|
#define CLUTTER_ACTOR_IN_REPARENT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_REPARENT) != FALSE)
|
||||||
#define CLUTTER_ACTOR_IN_PAINT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PAINT) != FALSE)
|
#define CLUTTER_ACTOR_IN_PAINT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PAINT) != FALSE)
|
||||||
#define CLUTTER_ACTOR_IN_PICK(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PICK) != FALSE)
|
#define CLUTTER_ACTOR_IN_PICK(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PICK) != FALSE)
|
||||||
#define CLUTTER_ACTOR_IN_RELAYOUT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_RELAYOUT) != FALSE)
|
#define CLUTTER_ACTOR_IN_RELAYOUT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_RELAYOUT) != FALSE)
|
||||||
@@ -98,6 +99,7 @@ typedef enum
|
|||||||
|
|
||||||
CLUTTER_IN_DESTRUCTION = 1 << 0,
|
CLUTTER_IN_DESTRUCTION = 1 << 0,
|
||||||
CLUTTER_IS_TOPLEVEL = 1 << 1,
|
CLUTTER_IS_TOPLEVEL = 1 << 1,
|
||||||
|
CLUTTER_IN_REPARENT = 1 << 2,
|
||||||
CLUTTER_IN_PREF_WIDTH = 1 << 3,
|
CLUTTER_IN_PREF_WIDTH = 1 << 3,
|
||||||
CLUTTER_IN_PREF_HEIGHT = 1 << 4,
|
CLUTTER_IN_PREF_HEIGHT = 1 << 4,
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||||
#include "deprecated/clutter-container.h"
|
#include "deprecated/clutter-container.h"
|
||||||
|
#include "deprecated/clutter-alpha.h"
|
||||||
|
|
||||||
#include "clutter-actor.h"
|
#include "clutter-actor.h"
|
||||||
#include "clutter-debug.h"
|
#include "clutter-debug.h"
|
||||||
@@ -798,6 +799,232 @@ parse_signals (ClutterScript *script,
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ClutterTimeline *
|
||||||
|
construct_timeline (ClutterScript *script,
|
||||||
|
JsonObject *object)
|
||||||
|
{
|
||||||
|
ClutterTimeline *retval = NULL;
|
||||||
|
ObjectInfo *oinfo;
|
||||||
|
GList *members, *l;
|
||||||
|
|
||||||
|
/* we fake an ObjectInfo so we can reuse clutter_script_construct_object()
|
||||||
|
* here; we do not save it inside the hash table, because if this had
|
||||||
|
* been a named object then we wouldn't have ended up here in the first
|
||||||
|
* place
|
||||||
|
*/
|
||||||
|
oinfo = g_slice_new0 (ObjectInfo);
|
||||||
|
oinfo->gtype = CLUTTER_TYPE_TIMELINE;
|
||||||
|
oinfo->id = g_strdup ("dummy");
|
||||||
|
|
||||||
|
members = json_object_get_members (object);
|
||||||
|
for (l = members; l != NULL; l = l->next)
|
||||||
|
{
|
||||||
|
const gchar *name = l->data;
|
||||||
|
JsonNode *node = json_object_get_member (object, name);
|
||||||
|
PropertyInfo *pinfo = g_slice_new0 (PropertyInfo);
|
||||||
|
|
||||||
|
pinfo->name = g_strdelimit (g_strdup (name), G_STR_DELIMITERS, '-');
|
||||||
|
pinfo->node = json_node_copy (node);
|
||||||
|
|
||||||
|
oinfo->properties = g_list_prepend (oinfo->properties, pinfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_list_free (members);
|
||||||
|
|
||||||
|
_clutter_script_construct_object (script, oinfo);
|
||||||
|
_clutter_script_apply_properties (script, oinfo);
|
||||||
|
retval = CLUTTER_TIMELINE (oinfo->object);
|
||||||
|
|
||||||
|
/* we transfer ownership to the alpha function, so we ref before
|
||||||
|
* destroying the ObjectInfo to avoid the timeline going away
|
||||||
|
*/
|
||||||
|
g_object_ref (retval);
|
||||||
|
object_info_free (oinfo);
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* define the names of the animation modes to match the ones
|
||||||
|
* that developers might be more accustomed to
|
||||||
|
*/
|
||||||
|
static const struct
|
||||||
|
{
|
||||||
|
const gchar *name;
|
||||||
|
ClutterAnimationMode mode;
|
||||||
|
} animation_modes[] = {
|
||||||
|
{ "linear", CLUTTER_LINEAR },
|
||||||
|
{ "easeInQuad", CLUTTER_EASE_IN_QUAD },
|
||||||
|
{ "easeOutQuad", CLUTTER_EASE_OUT_QUAD },
|
||||||
|
{ "easeInOutQuad", CLUTTER_EASE_IN_OUT_QUAD },
|
||||||
|
{ "easeInCubic", CLUTTER_EASE_IN_CUBIC },
|
||||||
|
{ "easeOutCubic", CLUTTER_EASE_OUT_CUBIC },
|
||||||
|
{ "easeInOutCubic", CLUTTER_EASE_IN_OUT_CUBIC },
|
||||||
|
{ "easeInQuart", CLUTTER_EASE_IN_QUART },
|
||||||
|
{ "easeOutQuart", CLUTTER_EASE_OUT_QUART },
|
||||||
|
{ "easeInOutQuart", CLUTTER_EASE_IN_OUT_QUART },
|
||||||
|
{ "easeInQuint", CLUTTER_EASE_IN_QUINT },
|
||||||
|
{ "easeOutQuint", CLUTTER_EASE_OUT_QUINT },
|
||||||
|
{ "easeInOutQuint", CLUTTER_EASE_IN_OUT_QUINT },
|
||||||
|
{ "easeInSine", CLUTTER_EASE_IN_SINE },
|
||||||
|
{ "easeOutSine", CLUTTER_EASE_OUT_SINE },
|
||||||
|
{ "easeInOutSine", CLUTTER_EASE_IN_OUT_SINE },
|
||||||
|
{ "easeInExpo", CLUTTER_EASE_IN_EXPO },
|
||||||
|
{ "easeOutExpo", CLUTTER_EASE_OUT_EXPO },
|
||||||
|
{ "easeInOutExpo", CLUTTER_EASE_IN_OUT_EXPO },
|
||||||
|
{ "easeInCirc", CLUTTER_EASE_IN_CIRC },
|
||||||
|
{ "easeOutCirc", CLUTTER_EASE_OUT_CIRC },
|
||||||
|
{ "easeInOutCirc", CLUTTER_EASE_IN_OUT_CIRC },
|
||||||
|
{ "easeInElastic", CLUTTER_EASE_IN_ELASTIC },
|
||||||
|
{ "easeOutElastic", CLUTTER_EASE_OUT_ELASTIC },
|
||||||
|
{ "easeInOutElastic", CLUTTER_EASE_IN_OUT_ELASTIC },
|
||||||
|
{ "easeInBack", CLUTTER_EASE_IN_BACK },
|
||||||
|
{ "easeOutBack", CLUTTER_EASE_OUT_BACK },
|
||||||
|
{ "easeInOutBack", CLUTTER_EASE_IN_OUT_BACK },
|
||||||
|
{ "easeInBounce", CLUTTER_EASE_IN_BOUNCE },
|
||||||
|
{ "easeOutBounce", CLUTTER_EASE_OUT_BOUNCE },
|
||||||
|
{ "easeInOutBounce", CLUTTER_EASE_IN_OUT_BOUNCE },
|
||||||
|
};
|
||||||
|
|
||||||
|
static const gint n_animation_modes = G_N_ELEMENTS (animation_modes);
|
||||||
|
|
||||||
|
gulong
|
||||||
|
_clutter_script_resolve_animation_mode (JsonNode *node)
|
||||||
|
{
|
||||||
|
gint i, res = CLUTTER_CUSTOM_MODE;
|
||||||
|
|
||||||
|
if (JSON_NODE_TYPE (node) != JSON_NODE_VALUE)
|
||||||
|
return CLUTTER_CUSTOM_MODE;
|
||||||
|
|
||||||
|
if (json_node_get_value_type (node) == G_TYPE_INT64)
|
||||||
|
return json_node_get_int (node);
|
||||||
|
|
||||||
|
if (json_node_get_value_type (node) == G_TYPE_STRING)
|
||||||
|
{
|
||||||
|
const gchar *name = json_node_get_string (node);
|
||||||
|
|
||||||
|
/* XXX - we might be able to optimize by changing the ordering
|
||||||
|
* of the animation_modes array, e.g.
|
||||||
|
* - special casing linear
|
||||||
|
* - tokenizing ('ease', 'In', 'Sine') and matching on token
|
||||||
|
* - binary searching?
|
||||||
|
*/
|
||||||
|
for (i = 0; i < n_animation_modes; i++)
|
||||||
|
{
|
||||||
|
if (strcmp (animation_modes[i].name, name) == 0)
|
||||||
|
return animation_modes[i].mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_clutter_script_enum_from_string (CLUTTER_TYPE_ANIMATION_MODE,
|
||||||
|
name,
|
||||||
|
&res))
|
||||||
|
return res;
|
||||||
|
|
||||||
|
g_warning ("Unable to find the animation mode '%s'", name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return CLUTTER_CUSTOM_MODE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ClutterAlphaFunc
|
||||||
|
resolve_alpha_func (const gchar *name)
|
||||||
|
{
|
||||||
|
static GModule *module = NULL;
|
||||||
|
ClutterAlphaFunc func;
|
||||||
|
|
||||||
|
CLUTTER_NOTE (SCRIPT, "Looking up '%s' alpha function", name);
|
||||||
|
|
||||||
|
if (G_UNLIKELY (!module))
|
||||||
|
module = g_module_open (NULL, 0);
|
||||||
|
|
||||||
|
if (g_module_symbol (module, name, (gpointer) &func))
|
||||||
|
{
|
||||||
|
CLUTTER_NOTE (SCRIPT, "Found '%s' alpha function in the symbols table",
|
||||||
|
name);
|
||||||
|
return func;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
GObject *
|
||||||
|
_clutter_script_parse_alpha (ClutterScript *script,
|
||||||
|
JsonNode *node)
|
||||||
|
{
|
||||||
|
GObject *retval = NULL;
|
||||||
|
JsonObject *object;
|
||||||
|
ClutterTimeline *timeline = NULL;
|
||||||
|
ClutterAlphaFunc alpha_func = NULL;
|
||||||
|
ClutterAnimationMode mode = CLUTTER_CUSTOM_MODE;
|
||||||
|
JsonNode *val;
|
||||||
|
gboolean unref_timeline = FALSE;
|
||||||
|
|
||||||
|
if (JSON_NODE_TYPE (node) != JSON_NODE_OBJECT)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
object = json_node_get_object (node);
|
||||||
|
|
||||||
|
val = json_object_get_member (object, "timeline");
|
||||||
|
if (val)
|
||||||
|
{
|
||||||
|
if (JSON_NODE_TYPE (val) == JSON_NODE_VALUE &&
|
||||||
|
json_node_get_string (val) != NULL)
|
||||||
|
{
|
||||||
|
const gchar *id_ = json_node_get_string (val);
|
||||||
|
|
||||||
|
timeline =
|
||||||
|
CLUTTER_TIMELINE (clutter_script_get_object (script, id_));
|
||||||
|
}
|
||||||
|
else if (JSON_NODE_TYPE (val) == JSON_NODE_OBJECT)
|
||||||
|
{
|
||||||
|
timeline = construct_timeline (script, json_node_get_object (val));
|
||||||
|
unref_timeline = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val = json_object_get_member (object, "mode");
|
||||||
|
if (val != NULL)
|
||||||
|
mode = _clutter_script_resolve_animation_mode (val);
|
||||||
|
|
||||||
|
if (mode == CLUTTER_CUSTOM_MODE)
|
||||||
|
{
|
||||||
|
val = json_object_get_member (object, "function");
|
||||||
|
if (val && json_node_get_string (val) != NULL)
|
||||||
|
{
|
||||||
|
alpha_func = resolve_alpha_func (json_node_get_string (val));
|
||||||
|
if (!alpha_func)
|
||||||
|
{
|
||||||
|
g_warning ("Unable to find the function '%s' in the "
|
||||||
|
"Clutter alpha functions or the symbols table",
|
||||||
|
json_node_get_string (val));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CLUTTER_NOTE (SCRIPT, "Parsed alpha: %s timeline (%p) (mode:%d, func:%p)",
|
||||||
|
unref_timeline ? "implicit" : "explicit",
|
||||||
|
timeline ? timeline : 0x0,
|
||||||
|
mode != CLUTTER_CUSTOM_MODE ? mode : 0,
|
||||||
|
alpha_func ? alpha_func : 0x0);
|
||||||
|
|
||||||
|
retval = g_object_new (CLUTTER_TYPE_ALPHA, NULL);
|
||||||
|
|
||||||
|
if (mode != CLUTTER_CUSTOM_MODE)
|
||||||
|
clutter_alpha_set_mode (CLUTTER_ALPHA (retval), mode);
|
||||||
|
|
||||||
|
if (alpha_func != NULL)
|
||||||
|
clutter_alpha_set_func (CLUTTER_ALPHA (retval), alpha_func, NULL, NULL);
|
||||||
|
|
||||||
|
clutter_alpha_set_timeline (CLUTTER_ALPHA (retval), timeline);
|
||||||
|
|
||||||
|
/* if we created an implicit timeline, the Alpha has full ownership
|
||||||
|
* of it now, since it won't be accessible from ClutterScript
|
||||||
|
*/
|
||||||
|
if (unref_timeline)
|
||||||
|
g_object_unref (timeline);
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_script_parser_object_end (JsonParser *json_parser,
|
clutter_script_parser_object_end (JsonParser *json_parser,
|
||||||
JsonObject *object)
|
JsonObject *object)
|
||||||
|
|||||||
@@ -110,6 +110,8 @@ gboolean _clutter_script_parse_node (ClutterScript *script,
|
|||||||
GType _clutter_script_get_type_from_symbol (const gchar *symbol);
|
GType _clutter_script_get_type_from_symbol (const gchar *symbol);
|
||||||
GType _clutter_script_get_type_from_class (const gchar *name);
|
GType _clutter_script_get_type_from_class (const gchar *name);
|
||||||
|
|
||||||
|
gulong _clutter_script_resolve_animation_mode (JsonNode *node);
|
||||||
|
|
||||||
gboolean _clutter_script_enum_from_string (GType gtype,
|
gboolean _clutter_script_enum_from_string (GType gtype,
|
||||||
const gchar *string,
|
const gchar *string,
|
||||||
gint *enum_value);
|
gint *enum_value);
|
||||||
@@ -126,6 +128,8 @@ gboolean _clutter_script_parse_rect (ClutterScript *script,
|
|||||||
gboolean _clutter_script_parse_color (ClutterScript *script,
|
gboolean _clutter_script_parse_color (ClutterScript *script,
|
||||||
JsonNode *node,
|
JsonNode *node,
|
||||||
ClutterColor *color);
|
ClutterColor *color);
|
||||||
|
GObject *_clutter_script_parse_alpha (ClutterScript *script,
|
||||||
|
JsonNode *node);
|
||||||
gboolean _clutter_script_parse_point (ClutterScript *script,
|
gboolean _clutter_script_parse_point (ClutterScript *script,
|
||||||
JsonNode *node,
|
JsonNode *node,
|
||||||
graphene_point_t *point);
|
graphene_point_t *point);
|
||||||
|
|||||||
@@ -98,6 +98,49 @@
|
|||||||
* respectively) and the "object" string member for calling
|
* respectively) and the "object" string member for calling
|
||||||
* g_signal_connect_object() instead of g_signal_connect().
|
* g_signal_connect_object() instead of g_signal_connect().
|
||||||
*
|
*
|
||||||
|
* Signals can also be directly attached to a specific state defined
|
||||||
|
* inside a #ClutterState instance, for instance:
|
||||||
|
*
|
||||||
|
* |[
|
||||||
|
* ...
|
||||||
|
* "signals" : [
|
||||||
|
* {
|
||||||
|
* "name" : "enter-event",
|
||||||
|
* "states" : "button-states",
|
||||||
|
* "target-state" : "hover"
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* "name" : "leave-event",
|
||||||
|
* "states" : "button-states",
|
||||||
|
* "target-state" : "base"
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* "name" : "button-press-event",
|
||||||
|
* "states" : "button-states",
|
||||||
|
* "target-state" : "active",
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* "name" : "key-press-event",
|
||||||
|
* "states" : "button-states",
|
||||||
|
* "target-state" : "key-focus",
|
||||||
|
* "warp" : true
|
||||||
|
* }
|
||||||
|
* ],
|
||||||
|
* ...
|
||||||
|
* ]|
|
||||||
|
*
|
||||||
|
* The "states" key defines the #ClutterState instance to be used to
|
||||||
|
* resolve the "target-state" key; it can be either a script id for a
|
||||||
|
* #ClutterState built by the same #ClutterScript instance, or to a
|
||||||
|
* #ClutterState built in code and associated to the #ClutterScript
|
||||||
|
* instance through the clutter_script_add_states() function. If no
|
||||||
|
* "states" key is present, then the default #ClutterState associated to
|
||||||
|
* the #ClutterScript instance will be used; the default #ClutterState
|
||||||
|
* can be set using clutter_script_add_states() using a %NULL name. The
|
||||||
|
* "warp" key can be used to warp to a specific state instead of
|
||||||
|
* animating to it. State changes on signal emission will not affect
|
||||||
|
* the signal emission chain.
|
||||||
|
*
|
||||||
* Clutter reserves the following names, so classes defining properties
|
* Clutter reserves the following names, so classes defining properties
|
||||||
* through the usual GObject registration process should avoid using these
|
* through the usual GObject registration process should avoid using these
|
||||||
* names to avoid collisions:
|
* names to avoid collisions:
|
||||||
@@ -141,7 +184,9 @@
|
|||||||
#include "clutter-private.h"
|
#include "clutter-private.h"
|
||||||
#include "clutter-debug.h"
|
#include "clutter-debug.h"
|
||||||
|
|
||||||
|
#include "deprecated/clutter-alpha.h"
|
||||||
#include "deprecated/clutter-container.h"
|
#include "deprecated/clutter-container.h"
|
||||||
|
#include "deprecated/clutter-state.h"
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@@ -165,6 +210,8 @@ struct _ClutterScriptPrivate
|
|||||||
|
|
||||||
ClutterScriptParser *parser;
|
ClutterScriptParser *parser;
|
||||||
|
|
||||||
|
GHashTable *states;
|
||||||
|
|
||||||
gchar **search_paths;
|
gchar **search_paths;
|
||||||
|
|
||||||
gchar *translation_domain;
|
gchar *translation_domain;
|
||||||
@@ -217,6 +264,7 @@ signal_info_free (gpointer data)
|
|||||||
g_free (sinfo->name);
|
g_free (sinfo->name);
|
||||||
g_free (sinfo->handler);
|
g_free (sinfo->handler);
|
||||||
g_free (sinfo->object);
|
g_free (sinfo->object);
|
||||||
|
g_free (sinfo->state);
|
||||||
g_free (sinfo->target);
|
g_free (sinfo->target);
|
||||||
|
|
||||||
g_slice_free (SignalInfo, sinfo);
|
g_slice_free (SignalInfo, sinfo);
|
||||||
@@ -271,6 +319,7 @@ clutter_script_finalize (GObject *gobject)
|
|||||||
g_hash_table_destroy (priv->objects);
|
g_hash_table_destroy (priv->objects);
|
||||||
g_strfreev (priv->search_paths);
|
g_strfreev (priv->search_paths);
|
||||||
g_free (priv->filename);
|
g_free (priv->filename);
|
||||||
|
g_hash_table_destroy (priv->states);
|
||||||
g_free (priv->translation_domain);
|
g_free (priv->translation_domain);
|
||||||
|
|
||||||
G_OBJECT_CLASS (clutter_script_parent_class)->finalize (gobject);
|
G_OBJECT_CLASS (clutter_script_parent_class)->finalize (gobject);
|
||||||
@@ -405,6 +454,9 @@ clutter_script_init (ClutterScript *script)
|
|||||||
priv->objects = g_hash_table_new_full (g_str_hash, g_str_equal,
|
priv->objects = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||||
NULL,
|
NULL,
|
||||||
object_info_free);
|
object_info_free);
|
||||||
|
priv->states = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||||
|
g_free,
|
||||||
|
(GDestroyNotify) g_object_unref);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -920,12 +972,65 @@ clutter_script_connect_signals (ClutterScript *script,
|
|||||||
g_free (cd);
|
g_free (cd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
ClutterState *state;
|
||||||
|
GObject *emitter;
|
||||||
|
gchar *target;
|
||||||
|
gulong signal_id;
|
||||||
|
gulong hook_id;
|
||||||
|
gboolean warp_to;
|
||||||
|
} HookData;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ClutterScript *script;
|
ClutterScript *script;
|
||||||
ClutterScriptConnectFunc func;
|
ClutterScriptConnectFunc func;
|
||||||
gpointer user_data;
|
gpointer user_data;
|
||||||
} SignalConnectData;
|
} SignalConnectData;
|
||||||
|
|
||||||
|
static void
|
||||||
|
hook_data_free (gpointer data)
|
||||||
|
{
|
||||||
|
if (G_LIKELY (data != NULL))
|
||||||
|
{
|
||||||
|
HookData *hook_data = data;
|
||||||
|
|
||||||
|
g_free (hook_data->target);
|
||||||
|
g_slice_free (HookData, hook_data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
clutter_script_state_change_hook (GSignalInvocationHint *ihint,
|
||||||
|
guint n_params,
|
||||||
|
const GValue *params,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
HookData *hook_data = user_data;
|
||||||
|
GObject *emitter;
|
||||||
|
|
||||||
|
emitter = g_value_get_object (¶ms[0]);
|
||||||
|
|
||||||
|
if (emitter == hook_data->emitter)
|
||||||
|
{
|
||||||
|
if (hook_data->warp_to)
|
||||||
|
clutter_state_warp_to_state (hook_data->state, hook_data->target);
|
||||||
|
else
|
||||||
|
clutter_state_set_state (hook_data->state, hook_data->target);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_script_remove_state_change_hook (gpointer user_data,
|
||||||
|
GObject *object_p)
|
||||||
|
{
|
||||||
|
HookData *hook_data = user_data;
|
||||||
|
|
||||||
|
g_signal_remove_emission_hook (hook_data->signal_id,
|
||||||
|
hook_data->hook_id);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
connect_each_object (gpointer key,
|
connect_each_object (gpointer key,
|
||||||
gpointer value,
|
gpointer value,
|
||||||
@@ -965,7 +1070,64 @@ connect_each_object (gpointer key,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_warn_if_reached ();
|
GObject *state_object = NULL;
|
||||||
|
const gchar *signal_name, *signal_detail;
|
||||||
|
gchar **components;
|
||||||
|
GQuark signal_quark;
|
||||||
|
guint signal_id;
|
||||||
|
HookData *hook_data;
|
||||||
|
|
||||||
|
if (sinfo->state == NULL)
|
||||||
|
state_object = (GObject *) clutter_script_get_states (script, NULL);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
state_object = clutter_script_get_object (script, sinfo->state);
|
||||||
|
if (state_object == NULL)
|
||||||
|
state_object = (GObject *) clutter_script_get_states (script, sinfo->state);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state_object == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
components = g_strsplit (sinfo->name, "::", 2);
|
||||||
|
if (g_strv_length (components) == 2)
|
||||||
|
{
|
||||||
|
signal_name = components[0];
|
||||||
|
signal_detail = components[1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
signal_name = components[0];
|
||||||
|
signal_detail = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
signal_id = g_signal_lookup (signal_name, G_OBJECT_TYPE (object));
|
||||||
|
if (signal_id == 0)
|
||||||
|
{
|
||||||
|
g_strfreev (components);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (signal_detail != NULL)
|
||||||
|
signal_quark = g_quark_from_string (signal_detail);
|
||||||
|
else
|
||||||
|
signal_quark = 0;
|
||||||
|
|
||||||
|
hook_data = g_slice_new (HookData);
|
||||||
|
hook_data->emitter = object;
|
||||||
|
hook_data->state = CLUTTER_STATE (state_object);
|
||||||
|
hook_data->target = g_strdup (sinfo->target);
|
||||||
|
hook_data->warp_to = sinfo->warp_to;
|
||||||
|
hook_data->signal_id = signal_id;
|
||||||
|
hook_data->hook_id =
|
||||||
|
g_signal_add_emission_hook (signal_id, signal_quark,
|
||||||
|
clutter_script_state_change_hook,
|
||||||
|
hook_data,
|
||||||
|
hook_data_free);
|
||||||
|
|
||||||
|
g_object_weak_ref (hook_data->emitter,
|
||||||
|
clutter_script_remove_state_change_hook,
|
||||||
|
hook_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
signal_info_free (sinfo);
|
signal_info_free (sinfo);
|
||||||
@@ -1190,6 +1352,72 @@ clutter_script_list_objects (ClutterScript *script)
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_script_add_states:
|
||||||
|
* @script: a #ClutterScript
|
||||||
|
* @name: (allow-none): a name for the @state, or %NULL to
|
||||||
|
* set the default #ClutterState
|
||||||
|
* @state: a #ClutterState
|
||||||
|
*
|
||||||
|
* Associates a #ClutterState to the #ClutterScript instance using the given
|
||||||
|
* name.
|
||||||
|
*
|
||||||
|
* The #ClutterScript instance will use @state to resolve target states when
|
||||||
|
* connecting signal handlers.
|
||||||
|
*
|
||||||
|
* The #ClutterScript instance will take a reference on the #ClutterState
|
||||||
|
* passed to this function.
|
||||||
|
*
|
||||||
|
* Since: 1.8
|
||||||
|
*
|
||||||
|
* Deprecated: 1.12
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
clutter_script_add_states (ClutterScript *script,
|
||||||
|
const gchar *name,
|
||||||
|
ClutterState *state)
|
||||||
|
{
|
||||||
|
g_return_if_fail (CLUTTER_IS_SCRIPT (script));
|
||||||
|
g_return_if_fail (CLUTTER_IS_STATE (state));
|
||||||
|
|
||||||
|
if (name == NULL || *name == '\0')
|
||||||
|
name = "__clutter_script_default_state";
|
||||||
|
|
||||||
|
g_hash_table_replace (script->priv->states,
|
||||||
|
g_strdup (name),
|
||||||
|
g_object_ref (state));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_script_get_states:
|
||||||
|
* @script: a #ClutterScript
|
||||||
|
* @name: (allow-none): the name of the #ClutterState, or %NULL
|
||||||
|
*
|
||||||
|
* Retrieves the #ClutterState for the given @state_name.
|
||||||
|
*
|
||||||
|
* If @name is %NULL, this function will return the default
|
||||||
|
* #ClutterState instance.
|
||||||
|
*
|
||||||
|
* Return value: (transfer none): a pointer to the #ClutterState for the
|
||||||
|
* given name. The #ClutterState is owned by the #ClutterScript instance
|
||||||
|
* and it should not be unreferenced
|
||||||
|
*
|
||||||
|
* Since: 1.8
|
||||||
|
*
|
||||||
|
* Deprecated: 1.12
|
||||||
|
*/
|
||||||
|
ClutterState *
|
||||||
|
clutter_script_get_states (ClutterScript *script,
|
||||||
|
const gchar *name)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), NULL);
|
||||||
|
|
||||||
|
if (name == NULL || *name == '\0')
|
||||||
|
name = "__clutter_script_default_state";
|
||||||
|
|
||||||
|
return g_hash_table_lookup (script->priv->states, name);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_script_set_translation_domain:
|
* clutter_script_set_translation_domain:
|
||||||
* @script: a #ClutterScript
|
* @script: a #ClutterScript
|
||||||
|
|||||||
@@ -179,6 +179,15 @@ void clutter_script_unmerge_objects (ClutterScript
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_script_ensure_objects (ClutterScript *script);
|
void clutter_script_ensure_objects (ClutterScript *script);
|
||||||
|
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
void clutter_script_add_states (ClutterScript *script,
|
||||||
|
const gchar *name,
|
||||||
|
ClutterState *state);
|
||||||
|
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
ClutterState * clutter_script_get_states (ClutterScript *script,
|
||||||
|
const gchar *name);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_script_connect_signals (ClutterScript *script,
|
void clutter_script_connect_signals (ClutterScript *script,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|||||||
@@ -682,6 +682,7 @@ clutter_seat_warp_pointer (ClutterSeat *seat,
|
|||||||
* requirements are fulfilled:
|
* requirements are fulfilled:
|
||||||
*
|
*
|
||||||
* - A touchscreen is available
|
* - A touchscreen is available
|
||||||
|
* - No external keyboard is attached to the device
|
||||||
* - A tablet mode switch, if present, is enabled
|
* - A tablet mode switch, if present, is enabled
|
||||||
*
|
*
|
||||||
* Returns: %TRUE if the device is a tablet that doesn't have an external
|
* Returns: %TRUE if the device is a tablet that doesn't have an external
|
||||||
|
|||||||
@@ -50,6 +50,11 @@ ClutterStageWindow *_clutter_stage_get_window (ClutterStage
|
|||||||
void _clutter_stage_get_projection_matrix (ClutterStage *stage,
|
void _clutter_stage_get_projection_matrix (ClutterStage *stage,
|
||||||
CoglMatrix *projection);
|
CoglMatrix *projection);
|
||||||
void _clutter_stage_dirty_projection (ClutterStage *stage);
|
void _clutter_stage_dirty_projection (ClutterStage *stage);
|
||||||
|
void _clutter_stage_set_viewport (ClutterStage *stage,
|
||||||
|
float x,
|
||||||
|
float y,
|
||||||
|
float width,
|
||||||
|
float height);
|
||||||
void _clutter_stage_get_viewport (ClutterStage *stage,
|
void _clutter_stage_get_viewport (ClutterStage *stage,
|
||||||
float *x,
|
float *x,
|
||||||
float *y,
|
float *y,
|
||||||
@@ -69,6 +74,7 @@ void _clutter_stage_queue_event (ClutterStage *stage,
|
|||||||
gboolean _clutter_stage_has_queued_events (ClutterStage *stage);
|
gboolean _clutter_stage_has_queued_events (ClutterStage *stage);
|
||||||
void _clutter_stage_process_queued_events (ClutterStage *stage);
|
void _clutter_stage_process_queued_events (ClutterStage *stage);
|
||||||
void _clutter_stage_update_input_devices (ClutterStage *stage);
|
void _clutter_stage_update_input_devices (ClutterStage *stage);
|
||||||
|
void _clutter_stage_schedule_update (ClutterStage *stage);
|
||||||
gint64 _clutter_stage_get_update_time (ClutterStage *stage);
|
gint64 _clutter_stage_get_update_time (ClutterStage *stage);
|
||||||
void _clutter_stage_clear_update_time (ClutterStage *stage);
|
void _clutter_stage_clear_update_time (ClutterStage *stage);
|
||||||
gboolean _clutter_stage_has_full_redraw_queued (ClutterStage *stage);
|
gboolean _clutter_stage_has_full_redraw_queued (ClutterStage *stage);
|
||||||
|
|||||||
@@ -20,28 +20,17 @@
|
|||||||
|
|
||||||
#include "clutter/clutter-stage-view.h"
|
#include "clutter/clutter-stage-view.h"
|
||||||
|
|
||||||
void clutter_stage_view_after_paint (ClutterStageView *view,
|
void clutter_stage_view_after_paint (ClutterStageView *view);
|
||||||
cairo_region_t *redraw_clip);
|
|
||||||
|
|
||||||
void clutter_stage_view_before_swap_buffer (ClutterStageView *view,
|
|
||||||
const cairo_region_t *swap_region);
|
|
||||||
|
|
||||||
gboolean clutter_stage_view_is_dirty_viewport (ClutterStageView *view);
|
gboolean clutter_stage_view_is_dirty_viewport (ClutterStageView *view);
|
||||||
|
|
||||||
void clutter_stage_view_invalidate_viewport (ClutterStageView *view);
|
void clutter_stage_view_set_dirty_viewport (ClutterStageView *view,
|
||||||
|
gboolean dirty);
|
||||||
void clutter_stage_view_set_viewport (ClutterStageView *view,
|
|
||||||
float x,
|
|
||||||
float y,
|
|
||||||
float width,
|
|
||||||
float height);
|
|
||||||
|
|
||||||
gboolean clutter_stage_view_is_dirty_projection (ClutterStageView *view);
|
gboolean clutter_stage_view_is_dirty_projection (ClutterStageView *view);
|
||||||
|
|
||||||
void clutter_stage_view_invalidate_projection (ClutterStageView *view);
|
void clutter_stage_view_set_dirty_projection (ClutterStageView *view,
|
||||||
|
gboolean dirty);
|
||||||
void clutter_stage_view_set_projection (ClutterStageView *view,
|
|
||||||
const CoglMatrix *matrix);
|
|
||||||
|
|
||||||
void clutter_stage_view_add_redraw_clip (ClutterStageView *view,
|
void clutter_stage_view_add_redraw_clip (ClutterStageView *view,
|
||||||
const cairo_rectangle_int_t *clip);
|
const cairo_rectangle_int_t *clip);
|
||||||
@@ -56,10 +45,4 @@ cairo_region_t * clutter_stage_view_take_redraw_clip (ClutterStageView *view);
|
|||||||
|
|
||||||
CoglScanout * clutter_stage_view_take_scanout (ClutterStageView *view);
|
CoglScanout * clutter_stage_view_take_scanout (ClutterStageView *view);
|
||||||
|
|
||||||
void clutter_stage_view_transform_rect_to_onscreen (ClutterStageView *view,
|
|
||||||
const cairo_rectangle_int_t *src_rect,
|
|
||||||
int dst_width,
|
|
||||||
int dst_height,
|
|
||||||
cairo_rectangle_int_t *dst_rect);
|
|
||||||
|
|
||||||
#endif /* __CLUTTER_STAGE_VIEW_PRIVATE_H__ */
|
#endif /* __CLUTTER_STAGE_VIEW_PRIVATE_H__ */
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
#include <cairo-gobject.h>
|
#include <cairo-gobject.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "clutter/clutter-damage-history.h"
|
|
||||||
#include "clutter/clutter-private.h"
|
#include "clutter/clutter-private.h"
|
||||||
#include "clutter/clutter-mutter.h"
|
#include "clutter/clutter-mutter.h"
|
||||||
#include "cogl/cogl.h"
|
#include "cogl/cogl.h"
|
||||||
@@ -32,11 +31,10 @@ enum
|
|||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
|
|
||||||
PROP_NAME,
|
|
||||||
PROP_LAYOUT,
|
PROP_LAYOUT,
|
||||||
PROP_FRAMEBUFFER,
|
PROP_FRAMEBUFFER,
|
||||||
PROP_OFFSCREEN,
|
PROP_OFFSCREEN,
|
||||||
PROP_USE_SHADOWFB,
|
PROP_SHADOWFB,
|
||||||
PROP_SCALE,
|
PROP_SCALE,
|
||||||
|
|
||||||
PROP_LAST
|
PROP_LAST
|
||||||
@@ -46,8 +44,6 @@ static GParamSpec *obj_props[PROP_LAST];
|
|||||||
|
|
||||||
typedef struct _ClutterStageViewPrivate
|
typedef struct _ClutterStageViewPrivate
|
||||||
{
|
{
|
||||||
char *name;
|
|
||||||
|
|
||||||
cairo_rectangle_int_t layout;
|
cairo_rectangle_int_t layout;
|
||||||
float scale;
|
float scale;
|
||||||
CoglFramebuffer *framebuffer;
|
CoglFramebuffer *framebuffer;
|
||||||
@@ -55,16 +51,8 @@ typedef struct _ClutterStageViewPrivate
|
|||||||
CoglOffscreen *offscreen;
|
CoglOffscreen *offscreen;
|
||||||
CoglPipeline *offscreen_pipeline;
|
CoglPipeline *offscreen_pipeline;
|
||||||
|
|
||||||
gboolean use_shadowfb;
|
CoglOffscreen *shadowfb;
|
||||||
struct {
|
CoglPipeline *shadowfb_pipeline;
|
||||||
struct {
|
|
||||||
CoglDmaBufHandle *handles[2];
|
|
||||||
int current_idx;
|
|
||||||
ClutterDamageHistory *damage_history;
|
|
||||||
} dma_buf;
|
|
||||||
|
|
||||||
CoglOffscreen *framebuffer;
|
|
||||||
} shadow;
|
|
||||||
|
|
||||||
CoglScanout *next_scanout;
|
CoglScanout *next_scanout;
|
||||||
|
|
||||||
@@ -103,8 +91,8 @@ clutter_stage_view_get_framebuffer (ClutterStageView *view)
|
|||||||
|
|
||||||
if (priv->offscreen)
|
if (priv->offscreen)
|
||||||
return priv->offscreen;
|
return priv->offscreen;
|
||||||
else if (priv->shadow.framebuffer)
|
else if (priv->shadowfb)
|
||||||
return priv->shadow.framebuffer;
|
return priv->shadowfb;
|
||||||
else
|
else
|
||||||
return priv->framebuffer;
|
return priv->framebuffer;
|
||||||
}
|
}
|
||||||
@@ -164,6 +152,19 @@ clutter_stage_view_ensure_offscreen_blit_pipeline (ClutterStageView *view)
|
|||||||
view_class->setup_offscreen_blit_pipeline (view, priv->offscreen_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);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
clutter_stage_view_invalidate_offscreen_blit_pipeline (ClutterStageView *view)
|
clutter_stage_view_invalidate_offscreen_blit_pipeline (ClutterStageView *view)
|
||||||
{
|
{
|
||||||
@@ -173,563 +174,85 @@ clutter_stage_view_invalidate_offscreen_blit_pipeline (ClutterStageView *view)
|
|||||||
g_clear_pointer (&priv->offscreen_pipeline, cogl_object_unref);
|
g_clear_pointer (&priv->offscreen_pipeline, cogl_object_unref);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
clutter_stage_view_transform_rect_to_onscreen (ClutterStageView *view,
|
|
||||||
const cairo_rectangle_int_t *src_rect,
|
|
||||||
int dst_width,
|
|
||||||
int dst_height,
|
|
||||||
cairo_rectangle_int_t *dst_rect)
|
|
||||||
{
|
|
||||||
ClutterStageViewClass *view_class = CLUTTER_STAGE_VIEW_GET_CLASS (view);
|
|
||||||
|
|
||||||
return view_class->transform_rect_to_onscreen (view,
|
|
||||||
src_rect,
|
|
||||||
dst_width,
|
|
||||||
dst_height,
|
|
||||||
dst_rect);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
paint_transformed_framebuffer (ClutterStageView *view,
|
clutter_stage_view_copy_to_framebuffer (ClutterStageView *view,
|
||||||
CoglPipeline *pipeline,
|
CoglPipeline *pipeline,
|
||||||
CoglFramebuffer *src_framebuffer,
|
CoglFramebuffer *src_framebuffer,
|
||||||
CoglFramebuffer *dst_framebuffer,
|
CoglFramebuffer *dst_framebuffer,
|
||||||
const cairo_region_t *redraw_clip)
|
gboolean can_blit)
|
||||||
{
|
{
|
||||||
CoglMatrix matrix;
|
CoglMatrix matrix;
|
||||||
unsigned int n_rectangles, i;
|
|
||||||
int dst_width, dst_height;
|
|
||||||
cairo_rectangle_int_t view_layout;
|
|
||||||
cairo_rectangle_int_t onscreen_layout;
|
|
||||||
float view_scale;
|
|
||||||
float *coordinates;
|
|
||||||
|
|
||||||
dst_width = cogl_framebuffer_get_width (dst_framebuffer);
|
/* First, try with blit */
|
||||||
dst_height = cogl_framebuffer_get_height (dst_framebuffer);
|
if (can_blit)
|
||||||
clutter_stage_view_get_layout (view, &view_layout);
|
{
|
||||||
clutter_stage_view_transform_rect_to_onscreen (view,
|
if (cogl_blit_framebuffer (src_framebuffer,
|
||||||
&(cairo_rectangle_int_t) {
|
dst_framebuffer,
|
||||||
.width = view_layout.width,
|
0, 0,
|
||||||
.height = view_layout.height,
|
0, 0,
|
||||||
},
|
cogl_framebuffer_get_width (dst_framebuffer),
|
||||||
view_layout.width,
|
cogl_framebuffer_get_height (dst_framebuffer),
|
||||||
view_layout.height,
|
NULL))
|
||||||
&onscreen_layout);
|
return;
|
||||||
view_scale = clutter_stage_view_get_scale (view);
|
}
|
||||||
|
|
||||||
|
/* If blit fails, fallback to the slower painting method */
|
||||||
cogl_framebuffer_push_matrix (dst_framebuffer);
|
cogl_framebuffer_push_matrix (dst_framebuffer);
|
||||||
|
|
||||||
cogl_matrix_init_identity (&matrix);
|
cogl_matrix_init_identity (&matrix);
|
||||||
cogl_matrix_scale (&matrix,
|
cogl_matrix_translate (&matrix, -1, 1, 0);
|
||||||
1.0 / (dst_width / 2.0),
|
cogl_matrix_scale (&matrix, 2, -2, 0);
|
||||||
-1.0 / (dst_height / 2.0), 0);
|
|
||||||
cogl_matrix_translate (&matrix,
|
|
||||||
-(dst_width / 2.0),
|
|
||||||
-(dst_height / 2.0), 0);
|
|
||||||
cogl_framebuffer_set_projection_matrix (dst_framebuffer, &matrix);
|
cogl_framebuffer_set_projection_matrix (dst_framebuffer, &matrix);
|
||||||
cogl_framebuffer_set_viewport (dst_framebuffer,
|
|
||||||
0, 0, dst_width, dst_height);
|
|
||||||
|
|
||||||
n_rectangles = cairo_region_num_rectangles (redraw_clip);
|
cogl_framebuffer_draw_rectangle (dst_framebuffer,
|
||||||
coordinates = g_newa (float, 2 * 4 * n_rectangles);
|
pipeline,
|
||||||
|
0, 0, 1, 1);
|
||||||
for (i = 0; i < n_rectangles; i++)
|
|
||||||
{
|
|
||||||
cairo_rectangle_int_t src_rect;
|
|
||||||
cairo_rectangle_int_t dst_rect;
|
|
||||||
|
|
||||||
cairo_region_get_rectangle (redraw_clip, i, &src_rect);
|
|
||||||
_clutter_util_rectangle_offset (&src_rect,
|
|
||||||
-view_layout.x,
|
|
||||||
-view_layout.y,
|
|
||||||
&src_rect);
|
|
||||||
|
|
||||||
clutter_stage_view_transform_rect_to_onscreen (view,
|
|
||||||
&src_rect,
|
|
||||||
onscreen_layout.width,
|
|
||||||
onscreen_layout.height,
|
|
||||||
&dst_rect);
|
|
||||||
|
|
||||||
coordinates[i * 8 + 0] = (float) dst_rect.x * view_scale;
|
|
||||||
coordinates[i * 8 + 1] = (float) dst_rect.y * view_scale;
|
|
||||||
coordinates[i * 8 + 2] = ((float) (dst_rect.x + dst_rect.width) *
|
|
||||||
view_scale);
|
|
||||||
coordinates[i * 8 + 3] = ((float) (dst_rect.y + dst_rect.height) *
|
|
||||||
view_scale);
|
|
||||||
|
|
||||||
coordinates[i * 8 + 4] = (((float) dst_rect.x / (float) dst_width) *
|
|
||||||
view_scale);
|
|
||||||
coordinates[i * 8 + 5] = (((float) dst_rect.y / (float) dst_height) *
|
|
||||||
view_scale);
|
|
||||||
coordinates[i * 8 + 6] = ((float) (dst_rect.x + dst_rect.width) /
|
|
||||||
(float) dst_width) * view_scale;
|
|
||||||
coordinates[i * 8 + 7] = ((float) (dst_rect.y + dst_rect.height) /
|
|
||||||
(float) dst_height) * view_scale;
|
|
||||||
}
|
|
||||||
|
|
||||||
cogl_framebuffer_draw_textured_rectangles (dst_framebuffer,
|
|
||||||
pipeline,
|
|
||||||
coordinates,
|
|
||||||
n_rectangles);
|
|
||||||
|
|
||||||
cogl_framebuffer_pop_matrix (dst_framebuffer);
|
cogl_framebuffer_pop_matrix (dst_framebuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
is_shadowfb_double_buffered (ClutterStageView *view)
|
|
||||||
{
|
|
||||||
ClutterStageViewPrivate *priv =
|
|
||||||
clutter_stage_view_get_instance_private (view);
|
|
||||||
|
|
||||||
return priv->shadow.dma_buf.handles[0] && priv->shadow.dma_buf.handles[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
init_dma_buf_shadowfbs (ClutterStageView *view,
|
|
||||||
CoglContext *cogl_context,
|
|
||||||
int width,
|
|
||||||
int height,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
ClutterStageViewPrivate *priv =
|
|
||||||
clutter_stage_view_get_instance_private (view);
|
|
||||||
CoglRenderer *cogl_renderer = cogl_context_get_renderer (cogl_context);
|
|
||||||
CoglFramebuffer *initial_shadowfb;
|
|
||||||
|
|
||||||
if (!cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE))
|
|
||||||
{
|
|
||||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
|
|
||||||
"Buffer age not supported");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!cogl_is_onscreen (priv->framebuffer))
|
|
||||||
{
|
|
||||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
|
|
||||||
"Tried to use shadow buffer without onscreen");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
priv->shadow.dma_buf.handles[0] = cogl_renderer_create_dma_buf (cogl_renderer,
|
|
||||||
width, height,
|
|
||||||
error);
|
|
||||||
if (!priv->shadow.dma_buf.handles[0])
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
priv->shadow.dma_buf.handles[1] = cogl_renderer_create_dma_buf (cogl_renderer,
|
|
||||||
width, height,
|
|
||||||
error);
|
|
||||||
if (!priv->shadow.dma_buf.handles[1])
|
|
||||||
{
|
|
||||||
g_clear_pointer (&priv->shadow.dma_buf.handles[0],
|
|
||||||
cogl_dma_buf_handle_free);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
priv->shadow.dma_buf.damage_history = clutter_damage_history_new ();
|
|
||||||
|
|
||||||
initial_shadowfb =
|
|
||||||
cogl_dma_buf_handle_get_framebuffer (priv->shadow.dma_buf.handles[0]);
|
|
||||||
priv->shadow.framebuffer = cogl_object_ref (initial_shadowfb);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static CoglOffscreen *
|
|
||||||
create_offscreen_framebuffer (CoglContext *context,
|
|
||||||
int width,
|
|
||||||
int height,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
CoglOffscreen *framebuffer;
|
|
||||||
CoglTexture2D *texture;
|
|
||||||
|
|
||||||
texture = cogl_texture_2d_new_with_size (context, width, height);
|
|
||||||
cogl_primitive_texture_set_auto_mipmap (COGL_PRIMITIVE_TEXTURE (texture),
|
|
||||||
FALSE);
|
|
||||||
|
|
||||||
if (!cogl_texture_allocate (COGL_TEXTURE (texture), error))
|
|
||||||
{
|
|
||||||
cogl_object_unref (texture);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
framebuffer = cogl_offscreen_new_with_texture (COGL_TEXTURE (texture));
|
|
||||||
cogl_object_unref (texture);
|
|
||||||
if (!cogl_framebuffer_allocate (COGL_FRAMEBUFFER (framebuffer), error))
|
|
||||||
{
|
|
||||||
cogl_object_unref (framebuffer);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return framebuffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
init_fallback_shadowfb (ClutterStageView *view,
|
|
||||||
CoglContext *cogl_context,
|
|
||||||
int width,
|
|
||||||
int height,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
ClutterStageViewPrivate *priv =
|
|
||||||
clutter_stage_view_get_instance_private (view);
|
|
||||||
CoglOffscreen *offscreen;
|
|
||||||
|
|
||||||
offscreen = create_offscreen_framebuffer (cogl_context, width, height, error);
|
|
||||||
if (!offscreen)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
priv->shadow.framebuffer = offscreen;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
init_shadowfb (ClutterStageView *view)
|
|
||||||
{
|
|
||||||
ClutterStageViewPrivate *priv =
|
|
||||||
clutter_stage_view_get_instance_private (view);
|
|
||||||
g_autoptr (GError) error = NULL;
|
|
||||||
int width;
|
|
||||||
int height;
|
|
||||||
CoglContext *cogl_context;
|
|
||||||
|
|
||||||
width = cogl_framebuffer_get_width (priv->framebuffer);
|
|
||||||
height = cogl_framebuffer_get_height (priv->framebuffer);
|
|
||||||
cogl_context = cogl_framebuffer_get_context (priv->framebuffer);
|
|
||||||
|
|
||||||
if (init_dma_buf_shadowfbs (view, cogl_context, width, height, &error))
|
|
||||||
{
|
|
||||||
g_message ("Initialized double buffered shadow fb for %s", priv->name);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_warning ("Failed to initialize double buffered shadow fb for %s: %s",
|
|
||||||
priv->name, error->message);
|
|
||||||
g_clear_error (&error);
|
|
||||||
|
|
||||||
if (!init_fallback_shadowfb (view, cogl_context, width, height, &error))
|
|
||||||
{
|
|
||||||
g_warning ("Failed to initialize single buffered shadow fb for %s: %s",
|
|
||||||
priv->name, error->message);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g_message ("Initialized single buffered shadow fb for %s", priv->name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
clutter_stage_view_after_paint (ClutterStageView *view,
|
clutter_stage_view_after_paint (ClutterStageView *view)
|
||||||
cairo_region_t *redraw_clip)
|
|
||||||
{
|
{
|
||||||
ClutterStageViewPrivate *priv =
|
ClutterStageViewPrivate *priv =
|
||||||
clutter_stage_view_get_instance_private (view);
|
clutter_stage_view_get_instance_private (view);
|
||||||
|
|
||||||
if (priv->offscreen)
|
if (priv->offscreen)
|
||||||
{
|
{
|
||||||
|
gboolean can_blit;
|
||||||
|
CoglMatrix matrix;
|
||||||
|
|
||||||
clutter_stage_view_ensure_offscreen_blit_pipeline (view);
|
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->shadow.framebuffer)
|
if (priv->shadowfb)
|
||||||
{
|
{
|
||||||
paint_transformed_framebuffer (view,
|
clutter_stage_view_copy_to_framebuffer (view,
|
||||||
priv->offscreen_pipeline,
|
priv->offscreen_pipeline,
|
||||||
priv->offscreen,
|
priv->offscreen,
|
||||||
priv->shadow.framebuffer,
|
priv->shadowfb,
|
||||||
redraw_clip);
|
can_blit);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
paint_transformed_framebuffer (view,
|
clutter_stage_view_copy_to_framebuffer (view,
|
||||||
priv->offscreen_pipeline,
|
priv->offscreen_pipeline,
|
||||||
priv->offscreen,
|
priv->offscreen,
|
||||||
priv->framebuffer,
|
priv->framebuffer,
|
||||||
redraw_clip);
|
can_blit);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
is_tile_dirty (cairo_rectangle_int_t *tile,
|
|
||||||
uint8_t *current_data,
|
|
||||||
uint8_t *prev_data,
|
|
||||||
int bpp,
|
|
||||||
int stride)
|
|
||||||
{
|
|
||||||
int y;
|
|
||||||
|
|
||||||
for (y = tile->y; y < tile->y + tile->height; y++)
|
|
||||||
{
|
|
||||||
if (memcmp (prev_data + y * stride + tile->x * bpp,
|
|
||||||
current_data + y * stride + tile->x * bpp,
|
|
||||||
tile->width * bpp) != 0)
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
flip_dma_buf_idx (int idx)
|
|
||||||
{
|
|
||||||
return (idx + 1) % 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cairo_region_t *
|
|
||||||
find_damaged_tiles (ClutterStageView *view,
|
|
||||||
const cairo_region_t *damage_region,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
ClutterStageViewPrivate *priv =
|
|
||||||
clutter_stage_view_get_instance_private (view);
|
|
||||||
cairo_region_t *tile_damage_region;
|
|
||||||
cairo_rectangle_int_t damage_extents;
|
|
||||||
cairo_rectangle_int_t fb_rect;
|
|
||||||
int prev_dma_buf_idx;
|
|
||||||
CoglDmaBufHandle *prev_dma_buf_handle;
|
|
||||||
uint8_t *prev_data;
|
|
||||||
int current_dma_buf_idx;
|
|
||||||
CoglDmaBufHandle *current_dma_buf_handle;
|
|
||||||
uint8_t *current_data;
|
|
||||||
int width, height, stride, bpp;
|
|
||||||
int tile_x_min, tile_x_max;
|
|
||||||
int tile_y_min, tile_y_max;
|
|
||||||
int tile_x, tile_y;
|
|
||||||
const int tile_size = 16;
|
|
||||||
|
|
||||||
prev_dma_buf_idx = flip_dma_buf_idx (priv->shadow.dma_buf.current_idx);
|
|
||||||
prev_dma_buf_handle = priv->shadow.dma_buf.handles[prev_dma_buf_idx];
|
|
||||||
|
|
||||||
current_dma_buf_idx = priv->shadow.dma_buf.current_idx;
|
|
||||||
current_dma_buf_handle = priv->shadow.dma_buf.handles[current_dma_buf_idx];
|
|
||||||
|
|
||||||
width = cogl_dma_buf_handle_get_width (current_dma_buf_handle);
|
|
||||||
height = cogl_dma_buf_handle_get_height (current_dma_buf_handle);
|
|
||||||
stride = cogl_dma_buf_handle_get_stride (current_dma_buf_handle);
|
|
||||||
bpp = cogl_dma_buf_handle_get_bpp (current_dma_buf_handle);
|
|
||||||
|
|
||||||
cogl_framebuffer_finish (priv->shadow.framebuffer);
|
|
||||||
|
|
||||||
if (!cogl_dma_buf_handle_sync_read_start (prev_dma_buf_handle, error))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (!cogl_dma_buf_handle_sync_read_start (current_dma_buf_handle, error))
|
|
||||||
goto err_sync_read_current;
|
|
||||||
|
|
||||||
prev_data = cogl_dma_buf_handle_mmap (prev_dma_buf_handle, error);
|
|
||||||
if (!prev_data)
|
|
||||||
goto err_mmap_prev;
|
|
||||||
current_data = cogl_dma_buf_handle_mmap (current_dma_buf_handle, error);
|
|
||||||
if (!current_data)
|
|
||||||
goto err_mmap_current;
|
|
||||||
|
|
||||||
fb_rect = (cairo_rectangle_int_t) {
|
|
||||||
.width = width,
|
|
||||||
.height = height,
|
|
||||||
};
|
|
||||||
|
|
||||||
cairo_region_get_extents (damage_region, &damage_extents);
|
|
||||||
|
|
||||||
tile_x_min = damage_extents.x / tile_size;
|
|
||||||
tile_x_max = ((damage_extents.x + damage_extents.width + tile_size - 1) /
|
|
||||||
tile_size);
|
|
||||||
tile_y_min = damage_extents.y / tile_size;
|
|
||||||
tile_y_max = ((damage_extents.y + damage_extents.height + tile_size - 1) /
|
|
||||||
tile_size);
|
|
||||||
|
|
||||||
tile_damage_region = cairo_region_create ();
|
|
||||||
|
|
||||||
for (tile_y = tile_y_min; tile_y <= tile_y_max; tile_y++)
|
|
||||||
{
|
|
||||||
for (tile_x = tile_x_min; tile_x <= tile_x_max; tile_x++)
|
|
||||||
{
|
|
||||||
cairo_rectangle_int_t tile = {
|
|
||||||
.x = tile_x * tile_size,
|
|
||||||
.y = tile_y * tile_size,
|
|
||||||
.width = tile_size,
|
|
||||||
.height = tile_size,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (cairo_region_contains_rectangle (damage_region, &tile) ==
|
|
||||||
CAIRO_REGION_OVERLAP_OUT)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
_clutter_util_rectangle_intersection (&tile, &fb_rect, &tile);
|
|
||||||
|
|
||||||
if (is_tile_dirty (&tile, current_data, prev_data, bpp, stride))
|
|
||||||
cairo_region_union_rectangle (tile_damage_region, &tile);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cogl_dma_buf_handle_sync_read_end (prev_dma_buf_handle, error))
|
if (priv->shadowfb)
|
||||||
{
|
{
|
||||||
g_warning ("Failed to end DMA buffer read synchronization: %s",
|
clutter_stage_view_ensure_shadowfb_blit_pipeline (view);
|
||||||
(*error)->message);
|
clutter_stage_view_copy_to_framebuffer (view,
|
||||||
g_clear_error (error);
|
priv->shadowfb_pipeline,
|
||||||
|
priv->shadowfb,
|
||||||
|
priv->framebuffer,
|
||||||
|
TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cogl_dma_buf_handle_sync_read_end (current_dma_buf_handle, error))
|
|
||||||
{
|
|
||||||
g_warning ("Failed to end DMA buffer read synchronization: %s",
|
|
||||||
(*error)->message);
|
|
||||||
g_clear_error (error);
|
|
||||||
}
|
|
||||||
|
|
||||||
cogl_dma_buf_handle_munmap (prev_dma_buf_handle, prev_data, NULL);
|
|
||||||
cogl_dma_buf_handle_munmap (current_dma_buf_handle, current_data, NULL);
|
|
||||||
|
|
||||||
cairo_region_intersect (tile_damage_region, damage_region);
|
|
||||||
|
|
||||||
return tile_damage_region;
|
|
||||||
|
|
||||||
err_mmap_current:
|
|
||||||
cogl_dma_buf_handle_munmap (prev_dma_buf_handle, prev_data, NULL);
|
|
||||||
|
|
||||||
err_mmap_prev:
|
|
||||||
cogl_dma_buf_handle_sync_read_end (current_dma_buf_handle, NULL);
|
|
||||||
|
|
||||||
err_sync_read_current:
|
|
||||||
cogl_dma_buf_handle_sync_read_end (prev_dma_buf_handle, NULL);
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
swap_dma_buf_framebuffer (ClutterStageView *view)
|
|
||||||
{
|
|
||||||
ClutterStageViewPrivate *priv =
|
|
||||||
clutter_stage_view_get_instance_private (view);
|
|
||||||
int next_idx;
|
|
||||||
CoglDmaBufHandle *next_dma_buf_handle;
|
|
||||||
CoglOffscreen *next_framebuffer;
|
|
||||||
|
|
||||||
next_idx = ((priv->shadow.dma_buf.current_idx + 1) %
|
|
||||||
G_N_ELEMENTS (priv->shadow.dma_buf.handles));
|
|
||||||
priv->shadow.dma_buf.current_idx = next_idx;
|
|
||||||
|
|
||||||
next_dma_buf_handle = priv->shadow.dma_buf.handles[next_idx];
|
|
||||||
next_framebuffer =
|
|
||||||
cogl_dma_buf_handle_get_framebuffer (next_dma_buf_handle);
|
|
||||||
cogl_clear_object (&priv->shadow.framebuffer);
|
|
||||||
priv->shadow.framebuffer = cogl_object_ref (next_framebuffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
copy_shadowfb_to_onscreen (ClutterStageView *view,
|
|
||||||
const cairo_region_t *swap_region)
|
|
||||||
{
|
|
||||||
ClutterStageViewPrivate *priv =
|
|
||||||
clutter_stage_view_get_instance_private (view);
|
|
||||||
ClutterDamageHistory *damage_history = priv->shadow.dma_buf.damage_history;
|
|
||||||
cairo_region_t *damage_region;
|
|
||||||
int age;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (cairo_region_is_empty (swap_region))
|
|
||||||
{
|
|
||||||
cairo_rectangle_int_t full_damage = {
|
|
||||||
.width = cogl_framebuffer_get_width (priv->framebuffer),
|
|
||||||
.height = cogl_framebuffer_get_height (priv->framebuffer),
|
|
||||||
};
|
|
||||||
damage_region = cairo_region_create_rectangle (&full_damage);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
damage_region = cairo_region_copy (swap_region);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_shadowfb_double_buffered (view))
|
|
||||||
{
|
|
||||||
CoglOnscreen *onscreen = COGL_ONSCREEN (priv->framebuffer);
|
|
||||||
cairo_region_t *changed_region;
|
|
||||||
|
|
||||||
if (cogl_onscreen_get_frame_counter (onscreen) >= 1)
|
|
||||||
{
|
|
||||||
g_autoptr (GError) error = NULL;
|
|
||||||
|
|
||||||
changed_region = find_damaged_tiles (view, damage_region, &error);
|
|
||||||
if (!changed_region)
|
|
||||||
{
|
|
||||||
int other_dma_buf_idx;
|
|
||||||
|
|
||||||
g_warning ("Disabling actual damage detection: %s",
|
|
||||||
error->message);
|
|
||||||
|
|
||||||
other_dma_buf_idx =
|
|
||||||
flip_dma_buf_idx (priv->shadow.dma_buf.current_idx);
|
|
||||||
g_clear_pointer (&priv->shadow.dma_buf.handles[other_dma_buf_idx],
|
|
||||||
cogl_dma_buf_handle_free);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
changed_region = cairo_region_copy (damage_region);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (changed_region)
|
|
||||||
{
|
|
||||||
int buffer_age;
|
|
||||||
|
|
||||||
clutter_damage_history_record (damage_history, changed_region);
|
|
||||||
|
|
||||||
buffer_age = cogl_onscreen_get_buffer_age (onscreen);
|
|
||||||
if (clutter_damage_history_is_age_valid (damage_history, buffer_age))
|
|
||||||
{
|
|
||||||
for (age = 1; age <= buffer_age; age++)
|
|
||||||
{
|
|
||||||
const cairo_region_t *old_damage;
|
|
||||||
|
|
||||||
old_damage = clutter_damage_history_lookup (damage_history, age);
|
|
||||||
cairo_region_union (changed_region, old_damage);
|
|
||||||
}
|
|
||||||
|
|
||||||
cairo_region_destroy (damage_region);
|
|
||||||
damage_region = g_steal_pointer (&changed_region);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cairo_region_destroy (changed_region);
|
|
||||||
}
|
|
||||||
|
|
||||||
clutter_damage_history_step (damage_history);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < cairo_region_num_rectangles (damage_region); i++)
|
|
||||||
{
|
|
||||||
g_autoptr (GError) error = NULL;
|
|
||||||
cairo_rectangle_int_t rect;
|
|
||||||
|
|
||||||
cairo_region_get_rectangle (damage_region, i, &rect);
|
|
||||||
|
|
||||||
if (!cogl_blit_framebuffer (priv->shadow.framebuffer,
|
|
||||||
priv->framebuffer,
|
|
||||||
rect.x, rect.y,
|
|
||||||
rect.x, rect.y,
|
|
||||||
rect.width, rect.height,
|
|
||||||
&error))
|
|
||||||
{
|
|
||||||
g_warning ("Failed to blit shadow buffer: %s", error->message);
|
|
||||||
cairo_region_destroy (damage_region);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cairo_region_destroy (damage_region);
|
|
||||||
|
|
||||||
if (is_shadowfb_double_buffered (view))
|
|
||||||
swap_dma_buf_framebuffer (view);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
clutter_stage_view_before_swap_buffer (ClutterStageView *view,
|
|
||||||
const cairo_region_t *swap_region)
|
|
||||||
{
|
|
||||||
ClutterStageViewPrivate *priv =
|
|
||||||
clutter_stage_view_get_instance_private (view);
|
|
||||||
|
|
||||||
if (priv->shadow.framebuffer)
|
|
||||||
copy_shadowfb_to_onscreen (view, swap_region);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
@@ -741,47 +264,6 @@ clutter_stage_view_get_scale (ClutterStageView *view)
|
|||||||
return priv->scale;
|
return priv->scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef void (*FrontBufferCallback) (CoglFramebuffer *framebuffer,
|
|
||||||
gconstpointer user_data);
|
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_stage_view_foreach_front_buffer (ClutterStageView *view,
|
|
||||||
FrontBufferCallback callback,
|
|
||||||
gconstpointer user_data)
|
|
||||||
{
|
|
||||||
ClutterStageViewPrivate *priv =
|
|
||||||
clutter_stage_view_get_instance_private (view);
|
|
||||||
|
|
||||||
if (priv->offscreen)
|
|
||||||
{
|
|
||||||
callback (priv->offscreen, user_data);
|
|
||||||
}
|
|
||||||
else if (priv->shadow.framebuffer)
|
|
||||||
{
|
|
||||||
if (is_shadowfb_double_buffered (view))
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (priv->shadow.dma_buf.handles); i++)
|
|
||||||
{
|
|
||||||
CoglDmaBufHandle *handle = priv->shadow.dma_buf.handles[i];
|
|
||||||
CoglFramebuffer *framebuffer =
|
|
||||||
cogl_dma_buf_handle_get_framebuffer (handle);
|
|
||||||
|
|
||||||
callback (framebuffer, user_data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
callback (priv->shadow.framebuffer, user_data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
callback (priv->framebuffer, user_data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
clutter_stage_view_is_dirty_viewport (ClutterStageView *view)
|
clutter_stage_view_is_dirty_viewport (ClutterStageView *view)
|
||||||
{
|
{
|
||||||
@@ -792,47 +274,13 @@ clutter_stage_view_is_dirty_viewport (ClutterStageView *view)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
clutter_stage_view_invalidate_viewport (ClutterStageView *view)
|
clutter_stage_view_set_dirty_viewport (ClutterStageView *view,
|
||||||
|
gboolean dirty)
|
||||||
{
|
{
|
||||||
ClutterStageViewPrivate *priv =
|
ClutterStageViewPrivate *priv =
|
||||||
clutter_stage_view_get_instance_private (view);
|
clutter_stage_view_get_instance_private (view);
|
||||||
|
|
||||||
priv->dirty_viewport = TRUE;
|
priv->dirty_viewport = dirty;
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
set_framebuffer_viewport (CoglFramebuffer *framebuffer,
|
|
||||||
gconstpointer user_data)
|
|
||||||
{
|
|
||||||
const graphene_rect_t *rect = user_data;
|
|
||||||
|
|
||||||
cogl_framebuffer_set_viewport (framebuffer,
|
|
||||||
rect->origin.x,
|
|
||||||
rect->origin.y,
|
|
||||||
rect->size.width,
|
|
||||||
rect->size.height);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
clutter_stage_view_set_viewport (ClutterStageView *view,
|
|
||||||
float x,
|
|
||||||
float y,
|
|
||||||
float width,
|
|
||||||
float height)
|
|
||||||
{
|
|
||||||
ClutterStageViewPrivate *priv =
|
|
||||||
clutter_stage_view_get_instance_private (view);
|
|
||||||
graphene_rect_t rect;
|
|
||||||
|
|
||||||
priv->dirty_viewport = FALSE;
|
|
||||||
|
|
||||||
rect = (graphene_rect_t) {
|
|
||||||
.origin = { .x = x, .y = y },
|
|
||||||
.size = { .width = width, .height = height },
|
|
||||||
};
|
|
||||||
clutter_stage_view_foreach_front_buffer (view,
|
|
||||||
set_framebuffer_viewport,
|
|
||||||
&rect);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
@@ -844,33 +292,14 @@ clutter_stage_view_is_dirty_projection (ClutterStageView *view)
|
|||||||
return priv->dirty_projection;
|
return priv->dirty_projection;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
set_framebuffer_projection_matrix (CoglFramebuffer *framebuffer,
|
|
||||||
gconstpointer user_data)
|
|
||||||
{
|
|
||||||
cogl_framebuffer_set_projection_matrix (framebuffer, user_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
clutter_stage_view_invalidate_projection (ClutterStageView *view)
|
clutter_stage_view_set_dirty_projection (ClutterStageView *view,
|
||||||
|
gboolean dirty)
|
||||||
{
|
{
|
||||||
ClutterStageViewPrivate *priv =
|
ClutterStageViewPrivate *priv =
|
||||||
clutter_stage_view_get_instance_private (view);
|
clutter_stage_view_get_instance_private (view);
|
||||||
|
|
||||||
priv->dirty_projection = TRUE;
|
priv->dirty_projection = dirty;
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
clutter_stage_view_set_projection (ClutterStageView *view,
|
|
||||||
const CoglMatrix *matrix)
|
|
||||||
{
|
|
||||||
ClutterStageViewPrivate *priv =
|
|
||||||
clutter_stage_view_get_instance_private (view);
|
|
||||||
|
|
||||||
priv->dirty_projection = FALSE;
|
|
||||||
clutter_stage_view_foreach_front_buffer (view,
|
|
||||||
set_framebuffer_projection_matrix,
|
|
||||||
matrix);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -962,6 +391,19 @@ clutter_stage_view_take_redraw_clip (ClutterStageView *view)
|
|||||||
return g_steal_pointer (&priv->redraw_clip);
|
return g_steal_pointer (&priv->redraw_clip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
clutter_stage_view_transform_to_onscreen (ClutterStageView *view,
|
||||||
|
gfloat *x,
|
||||||
|
gfloat *y)
|
||||||
|
{
|
||||||
|
gfloat z = 0, w = 1;
|
||||||
|
CoglMatrix matrix;
|
||||||
|
|
||||||
|
clutter_stage_view_get_offscreen_transformation_matrix (view, &matrix);
|
||||||
|
cogl_matrix_get_inverse (&matrix, &matrix);
|
||||||
|
cogl_matrix_transform_point (&matrix, x, y, &z, &w);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_default_get_offscreen_transformation_matrix (ClutterStageView *view,
|
clutter_stage_default_get_offscreen_transformation_matrix (ClutterStageView *view,
|
||||||
CoglMatrix *matrix)
|
CoglMatrix *matrix)
|
||||||
@@ -1000,9 +442,6 @@ clutter_stage_view_get_property (GObject *object,
|
|||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_NAME:
|
|
||||||
g_value_set_string (value, priv->name);
|
|
||||||
break;
|
|
||||||
case PROP_LAYOUT:
|
case PROP_LAYOUT:
|
||||||
g_value_set_boxed (value, &priv->layout);
|
g_value_set_boxed (value, &priv->layout);
|
||||||
break;
|
break;
|
||||||
@@ -1012,8 +451,8 @@ clutter_stage_view_get_property (GObject *object,
|
|||||||
case PROP_OFFSCREEN:
|
case PROP_OFFSCREEN:
|
||||||
g_value_set_boxed (value, priv->offscreen);
|
g_value_set_boxed (value, priv->offscreen);
|
||||||
break;
|
break;
|
||||||
case PROP_USE_SHADOWFB:
|
case PROP_SHADOWFB:
|
||||||
g_value_set_boolean (value, priv->use_shadowfb);
|
g_value_set_boxed (value, priv->shadowfb);
|
||||||
break;
|
break;
|
||||||
case PROP_SCALE:
|
case PROP_SCALE:
|
||||||
g_value_set_float (value, priv->scale);
|
g_value_set_float (value, priv->scale);
|
||||||
@@ -1036,9 +475,6 @@ clutter_stage_view_set_property (GObject *object,
|
|||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_NAME:
|
|
||||||
priv->name = g_value_dup_string (value);
|
|
||||||
break;
|
|
||||||
case PROP_LAYOUT:
|
case PROP_LAYOUT:
|
||||||
layout = g_value_get_boxed (value);
|
layout = g_value_get_boxed (value);
|
||||||
priv->layout = *layout;
|
priv->layout = *layout;
|
||||||
@@ -1063,8 +499,8 @@ clutter_stage_view_set_property (GObject *object,
|
|||||||
case PROP_OFFSCREEN:
|
case PROP_OFFSCREEN:
|
||||||
priv->offscreen = g_value_dup_boxed (value);
|
priv->offscreen = g_value_dup_boxed (value);
|
||||||
break;
|
break;
|
||||||
case PROP_USE_SHADOWFB:
|
case PROP_SHADOWFB:
|
||||||
priv->use_shadowfb = g_value_get_boolean (value);
|
priv->shadowfb = g_value_dup_boxed (value);
|
||||||
break;
|
break;
|
||||||
case PROP_SCALE:
|
case PROP_SCALE:
|
||||||
priv->scale = g_value_get_float (value);
|
priv->scale = g_value_get_float (value);
|
||||||
@@ -1074,41 +510,18 @@ clutter_stage_view_set_property (GObject *object,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_stage_view_constructed (GObject *object)
|
|
||||||
{
|
|
||||||
ClutterStageView *view = CLUTTER_STAGE_VIEW (object);
|
|
||||||
ClutterStageViewPrivate *priv =
|
|
||||||
clutter_stage_view_get_instance_private (view);
|
|
||||||
|
|
||||||
if (priv->use_shadowfb)
|
|
||||||
init_shadowfb (view);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (clutter_stage_view_parent_class)->constructed (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_view_dispose (GObject *object)
|
clutter_stage_view_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
ClutterStageView *view = CLUTTER_STAGE_VIEW (object);
|
ClutterStageView *view = CLUTTER_STAGE_VIEW (object);
|
||||||
ClutterStageViewPrivate *priv =
|
ClutterStageViewPrivate *priv =
|
||||||
clutter_stage_view_get_instance_private (view);
|
clutter_stage_view_get_instance_private (view);
|
||||||
int i;
|
|
||||||
|
|
||||||
g_clear_pointer (&priv->name, g_free);
|
|
||||||
g_clear_pointer (&priv->framebuffer, cogl_object_unref);
|
g_clear_pointer (&priv->framebuffer, cogl_object_unref);
|
||||||
|
g_clear_pointer (&priv->shadowfb, cogl_object_unref);
|
||||||
g_clear_pointer (&priv->shadow.framebuffer, cogl_object_unref);
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (priv->shadow.dma_buf.handles); i++)
|
|
||||||
{
|
|
||||||
g_clear_pointer (&priv->shadow.dma_buf.handles[i],
|
|
||||||
cogl_dma_buf_handle_free);
|
|
||||||
}
|
|
||||||
g_clear_pointer (&priv->shadow.dma_buf.damage_history,
|
|
||||||
clutter_damage_history_free);
|
|
||||||
|
|
||||||
g_clear_pointer (&priv->offscreen, cogl_object_unref);
|
g_clear_pointer (&priv->offscreen, cogl_object_unref);
|
||||||
g_clear_pointer (&priv->offscreen_pipeline, 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->redraw_clip, cairo_region_destroy);
|
g_clear_pointer (&priv->redraw_clip, cairo_region_destroy);
|
||||||
|
|
||||||
G_OBJECT_CLASS (clutter_stage_view_parent_class)->dispose (object);
|
G_OBJECT_CLASS (clutter_stage_view_parent_class)->dispose (object);
|
||||||
@@ -1135,17 +548,8 @@ clutter_stage_view_class_init (ClutterStageViewClass *klass)
|
|||||||
|
|
||||||
object_class->get_property = clutter_stage_view_get_property;
|
object_class->get_property = clutter_stage_view_get_property;
|
||||||
object_class->set_property = clutter_stage_view_set_property;
|
object_class->set_property = clutter_stage_view_set_property;
|
||||||
object_class->constructed = clutter_stage_view_constructed;
|
|
||||||
object_class->dispose = clutter_stage_view_dispose;
|
object_class->dispose = clutter_stage_view_dispose;
|
||||||
|
|
||||||
obj_props[PROP_NAME] =
|
|
||||||
g_param_spec_string ("name",
|
|
||||||
"Name",
|
|
||||||
"Name of view",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READWRITE |
|
|
||||||
G_PARAM_CONSTRUCT_ONLY |
|
|
||||||
G_PARAM_STATIC_STRINGS);
|
|
||||||
obj_props[PROP_LAYOUT] =
|
obj_props[PROP_LAYOUT] =
|
||||||
g_param_spec_boxed ("layout",
|
g_param_spec_boxed ("layout",
|
||||||
"View layout",
|
"View layout",
|
||||||
@@ -1173,14 +577,14 @@ clutter_stage_view_class_init (ClutterStageViewClass *klass)
|
|||||||
G_PARAM_CONSTRUCT_ONLY |
|
G_PARAM_CONSTRUCT_ONLY |
|
||||||
G_PARAM_STATIC_STRINGS);
|
G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
obj_props[PROP_USE_SHADOWFB] =
|
obj_props[PROP_SHADOWFB] =
|
||||||
g_param_spec_boolean ("use-shadowfb",
|
g_param_spec_boxed ("shadowfb",
|
||||||
"Use shadowfb",
|
"Shadow framebuffer",
|
||||||
"Whether to use one or more shadow framebuffers",
|
"Framebuffer used as intermediate shadow buffer",
|
||||||
FALSE,
|
COGL_TYPE_HANDLE,
|
||||||
G_PARAM_READWRITE |
|
G_PARAM_READWRITE |
|
||||||
G_PARAM_CONSTRUCT_ONLY |
|
G_PARAM_CONSTRUCT_ONLY |
|
||||||
G_PARAM_STATIC_STRINGS);
|
G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
obj_props[PROP_SCALE] =
|
obj_props[PROP_SCALE] =
|
||||||
g_param_spec_float ("scale",
|
g_param_spec_float ("scale",
|
||||||
|
|||||||
@@ -43,12 +43,6 @@ struct _ClutterStageViewClass
|
|||||||
|
|
||||||
void (* get_offscreen_transformation_matrix) (ClutterStageView *view,
|
void (* get_offscreen_transformation_matrix) (ClutterStageView *view,
|
||||||
CoglMatrix *matrix);
|
CoglMatrix *matrix);
|
||||||
|
|
||||||
void (* transform_rect_to_onscreen) (ClutterStageView *view,
|
|
||||||
const cairo_rectangle_int_t *src_rect,
|
|
||||||
int dst_width,
|
|
||||||
int dst_height,
|
|
||||||
cairo_rectangle_int_t *dst_rect);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
@@ -62,6 +56,11 @@ CoglFramebuffer *clutter_stage_view_get_onscreen (ClutterStageView *view);
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_stage_view_invalidate_offscreen_blit_pipeline (ClutterStageView *view);
|
void clutter_stage_view_invalidate_offscreen_blit_pipeline (ClutterStageView *view);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
void clutter_stage_view_transform_to_onscreen (ClutterStageView *view,
|
||||||
|
gfloat *x,
|
||||||
|
gfloat *y);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
float clutter_stage_view_get_scale (ClutterStageView *view);
|
float clutter_stage_view_get_scale (ClutterStageView *view);
|
||||||
|
|
||||||
|
|||||||
@@ -142,8 +142,6 @@ struct _ClutterStagePrivate
|
|||||||
|
|
||||||
int update_freeze_count;
|
int update_freeze_count;
|
||||||
|
|
||||||
gboolean needs_update;
|
|
||||||
|
|
||||||
guint redraw_pending : 1;
|
guint redraw_pending : 1;
|
||||||
guint throttle_motion_events : 1;
|
guint throttle_motion_events : 1;
|
||||||
guint min_size_changed : 1;
|
guint min_size_changed : 1;
|
||||||
@@ -189,9 +187,6 @@ static void capture_view_into (ClutterStage *stage,
|
|||||||
uint8_t *data,
|
uint8_t *data,
|
||||||
int stride);
|
int stride);
|
||||||
static void clutter_stage_update_view_perspective (ClutterStage *stage);
|
static void clutter_stage_update_view_perspective (ClutterStage *stage);
|
||||||
static void clutter_stage_set_viewport (ClutterStage *stage,
|
|
||||||
float width,
|
|
||||||
float height);
|
|
||||||
|
|
||||||
static void clutter_container_iface_init (ClutterContainerIface *iface);
|
static void clutter_container_iface_init (ClutterContainerIface *iface);
|
||||||
|
|
||||||
@@ -618,18 +613,23 @@ stage_is_default (ClutterStage *stage)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_allocate (ClutterActor *self,
|
clutter_stage_allocate (ClutterActor *self,
|
||||||
const ClutterActorBox *box)
|
const ClutterActorBox *box,
|
||||||
|
ClutterAllocationFlags flags)
|
||||||
{
|
{
|
||||||
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
|
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
|
||||||
ClutterActorBox alloc = CLUTTER_ACTOR_BOX_INIT_ZERO;
|
ClutterActorBox alloc = CLUTTER_ACTOR_BOX_INIT_ZERO;
|
||||||
|
float old_width, old_height;
|
||||||
float new_width, new_height;
|
float new_width, new_height;
|
||||||
float width, height;
|
float width, height;
|
||||||
cairo_rectangle_int_t window_size;
|
cairo_rectangle_int_t window_size;
|
||||||
ClutterLayoutManager *layout_manager = clutter_actor_get_layout_manager (self);
|
|
||||||
|
|
||||||
if (priv->impl == NULL)
|
if (priv->impl == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* our old allocation */
|
||||||
|
clutter_actor_get_allocation_box (self, &alloc);
|
||||||
|
clutter_actor_box_get_size (&alloc, &old_width, &old_height);
|
||||||
|
|
||||||
/* the current allocation */
|
/* the current allocation */
|
||||||
clutter_actor_box_get_size (box, &width, &height);
|
clutter_actor_box_get_size (box, &width, &height);
|
||||||
|
|
||||||
@@ -643,21 +643,15 @@ clutter_stage_allocate (ClutterActor *self,
|
|||||||
*/
|
*/
|
||||||
if (!clutter_feature_available (CLUTTER_FEATURE_STAGE_STATIC))
|
if (!clutter_feature_available (CLUTTER_FEATURE_STAGE_STATIC))
|
||||||
{
|
{
|
||||||
ClutterActorBox children_box;
|
|
||||||
|
|
||||||
children_box.x1 = children_box.y1 = 0.f;
|
|
||||||
children_box.x2 = box->x2 - box->x1;
|
|
||||||
children_box.y2 = box->y2 - box->y1;
|
|
||||||
|
|
||||||
CLUTTER_NOTE (LAYOUT,
|
CLUTTER_NOTE (LAYOUT,
|
||||||
"Following allocation to %.2fx%.2f",
|
"Following allocation to %.2fx%.2f (absolute origin %s)",
|
||||||
width, height);
|
width, height,
|
||||||
|
(flags & CLUTTER_ABSOLUTE_ORIGIN_CHANGED)
|
||||||
|
? "changed"
|
||||||
|
: "not changed");
|
||||||
|
|
||||||
clutter_actor_set_allocation (self, box);
|
clutter_actor_set_allocation (self, box,
|
||||||
|
flags | CLUTTER_DELEGATE_LAYOUT);
|
||||||
clutter_layout_manager_allocate (layout_manager,
|
|
||||||
CLUTTER_CONTAINER (self),
|
|
||||||
&children_box);
|
|
||||||
|
|
||||||
/* Ensure the window is sized correctly */
|
/* Ensure the window is sized correctly */
|
||||||
if (priv->min_size_changed)
|
if (priv->min_size_changed)
|
||||||
@@ -705,23 +699,39 @@ clutter_stage_allocate (ClutterActor *self,
|
|||||||
|
|
||||||
CLUTTER_NOTE (LAYOUT,
|
CLUTTER_NOTE (LAYOUT,
|
||||||
"Overriding original allocation of %.2fx%.2f "
|
"Overriding original allocation of %.2fx%.2f "
|
||||||
"with %.2fx%.2f",
|
"with %.2fx%.2f (absolute origin %s)",
|
||||||
width, height,
|
width, height,
|
||||||
override.x2, override.y2);
|
override.x2, override.y2,
|
||||||
|
(flags & CLUTTER_ABSOLUTE_ORIGIN_CHANGED)
|
||||||
|
? "changed"
|
||||||
|
: "not changed");
|
||||||
|
|
||||||
/* and store the overridden allocation */
|
/* and store the overridden allocation */
|
||||||
clutter_actor_set_allocation (self, &override);
|
clutter_actor_set_allocation (self, &override,
|
||||||
|
flags | CLUTTER_DELEGATE_LAYOUT);
|
||||||
clutter_layout_manager_allocate (layout_manager,
|
|
||||||
CLUTTER_CONTAINER (self),
|
|
||||||
&override);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set the viewport to the new allocation */
|
/* reset the viewport if the allocation effectively changed */
|
||||||
clutter_actor_get_allocation_box (self, &alloc);
|
clutter_actor_get_allocation_box (self, &alloc);
|
||||||
clutter_actor_box_get_size (&alloc, &new_width, &new_height);
|
clutter_actor_box_get_size (&alloc, &new_width, &new_height);
|
||||||
|
|
||||||
clutter_stage_set_viewport (CLUTTER_STAGE (self), new_width, new_height);
|
if (CLUTTER_NEARBYINT (old_width) != CLUTTER_NEARBYINT (new_width) ||
|
||||||
|
CLUTTER_NEARBYINT (old_height) != CLUTTER_NEARBYINT (new_height))
|
||||||
|
{
|
||||||
|
int real_width = CLUTTER_NEARBYINT (new_width);
|
||||||
|
int real_height = CLUTTER_NEARBYINT (new_height);
|
||||||
|
|
||||||
|
_clutter_stage_set_viewport (CLUTTER_STAGE (self),
|
||||||
|
0, 0,
|
||||||
|
real_width,
|
||||||
|
real_height);
|
||||||
|
|
||||||
|
/* Note: we don't assume that set_viewport will queue a full redraw
|
||||||
|
* since it may bail-out early if something preemptively set the
|
||||||
|
* viewport before the stage was really allocated its new size.
|
||||||
|
*/
|
||||||
|
queue_full_redraw (CLUTTER_STAGE (self));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct _Vector4
|
typedef struct _Vector4
|
||||||
@@ -1160,7 +1170,7 @@ _clutter_stage_queue_event (ClutterStage *stage,
|
|||||||
{
|
{
|
||||||
ClutterMasterClock *master_clock = _clutter_master_clock_get_default ();
|
ClutterMasterClock *master_clock = _clutter_master_clock_get_default ();
|
||||||
_clutter_master_clock_start_running (master_clock);
|
_clutter_master_clock_start_running (master_clock);
|
||||||
clutter_stage_schedule_update (stage);
|
_clutter_stage_schedule_update (stage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1292,9 +1302,7 @@ _clutter_stage_needs_update (ClutterStage *stage)
|
|||||||
|
|
||||||
priv = stage->priv;
|
priv = stage->priv;
|
||||||
|
|
||||||
return (priv->redraw_pending ||
|
return priv->redraw_pending || g_hash_table_size (priv->pending_relayouts) > 0;
|
||||||
priv->needs_update ||
|
|
||||||
g_hash_table_size (priv->pending_relayouts) > 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1304,7 +1312,7 @@ clutter_stage_queue_actor_relayout (ClutterStage *stage,
|
|||||||
ClutterStagePrivate *priv = stage->priv;
|
ClutterStagePrivate *priv = stage->priv;
|
||||||
|
|
||||||
if (g_hash_table_size (priv->pending_relayouts) == 0)
|
if (g_hash_table_size (priv->pending_relayouts) == 0)
|
||||||
clutter_stage_schedule_update (stage);
|
_clutter_stage_schedule_update (stage);
|
||||||
|
|
||||||
g_hash_table_add (priv->pending_relayouts, g_object_ref (actor));
|
g_hash_table_add (priv->pending_relayouts, g_object_ref (actor));
|
||||||
priv->pending_relayouts_version++;
|
priv->pending_relayouts_version++;
|
||||||
@@ -1351,7 +1359,8 @@ _clutter_stage_maybe_relayout (ClutterActor *actor)
|
|||||||
CLUTTER_SET_PRIVATE_FLAGS (queued_actor, CLUTTER_IN_RELAYOUT);
|
CLUTTER_SET_PRIVATE_FLAGS (queued_actor, CLUTTER_IN_RELAYOUT);
|
||||||
|
|
||||||
old_version = priv->pending_relayouts_version;
|
old_version = priv->pending_relayouts_version;
|
||||||
clutter_actor_allocate_preferred_size (queued_actor);
|
clutter_actor_allocate_preferred_size (queued_actor,
|
||||||
|
CLUTTER_ALLOCATION_NONE);
|
||||||
|
|
||||||
CLUTTER_UNSET_PRIVATE_FLAGS (queued_actor, CLUTTER_IN_RELAYOUT);
|
CLUTTER_UNSET_PRIVATE_FLAGS (queued_actor, CLUTTER_IN_RELAYOUT);
|
||||||
|
|
||||||
@@ -1485,8 +1494,6 @@ _clutter_stage_do_update (ClutterStage *stage)
|
|||||||
|
|
||||||
priv->stage_was_relayout = FALSE;
|
priv->stage_was_relayout = FALSE;
|
||||||
|
|
||||||
priv->needs_update = FALSE;
|
|
||||||
|
|
||||||
/* if the stage is being destroyed, or if the destruction already
|
/* if the stage is being destroyed, or if the destruction already
|
||||||
* happened and we don't have an StageWindow any more, then we
|
* happened and we don't have an StageWindow any more, then we
|
||||||
* should bail out
|
* should bail out
|
||||||
@@ -2239,7 +2246,10 @@ clutter_stage_init (ClutterStage *self)
|
|||||||
g_signal_connect (self, "notify::min-height",
|
g_signal_connect (self, "notify::min-height",
|
||||||
G_CALLBACK (clutter_stage_notify_min_size), NULL);
|
G_CALLBACK (clutter_stage_notify_min_size), NULL);
|
||||||
|
|
||||||
clutter_stage_set_viewport (self, geom.width, geom.height);
|
_clutter_stage_set_viewport (self,
|
||||||
|
0, 0,
|
||||||
|
geom.width,
|
||||||
|
geom.height);
|
||||||
|
|
||||||
priv->paint_volume_stack =
|
priv->paint_volume_stack =
|
||||||
g_array_new (FALSE, FALSE, sizeof (ClutterPaintVolume));
|
g_array_new (FALSE, FALSE, sizeof (ClutterPaintVolume));
|
||||||
@@ -2419,13 +2429,15 @@ _clutter_stage_dirty_projection (ClutterStage *stage)
|
|||||||
{
|
{
|
||||||
ClutterStageView *view = l->data;
|
ClutterStageView *view = l->data;
|
||||||
|
|
||||||
clutter_stage_view_invalidate_projection (view);
|
clutter_stage_view_set_dirty_projection (view, TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* clutter_stage_set_viewport:
|
* clutter_stage_set_viewport:
|
||||||
* @stage: A #ClutterStage
|
* @stage: A #ClutterStage
|
||||||
|
* @x: The X postition to render the stage at, in window coordinates
|
||||||
|
* @y: The Y position to render the stage at, in window coordinates
|
||||||
* @width: The width to render the stage at, in window coordinates
|
* @width: The width to render the stage at, in window coordinates
|
||||||
* @height: The height to render the stage at, in window coordinates
|
* @height: The height to render the stage at, in window coordinates
|
||||||
*
|
*
|
||||||
@@ -2458,22 +2470,19 @@ _clutter_stage_dirty_projection (ClutterStage *stage)
|
|||||||
*
|
*
|
||||||
* Since: 1.6
|
* Since: 1.6
|
||||||
*/
|
*/
|
||||||
static void
|
void
|
||||||
clutter_stage_set_viewport (ClutterStage *stage,
|
_clutter_stage_set_viewport (ClutterStage *stage,
|
||||||
float width,
|
float x,
|
||||||
float height)
|
float y,
|
||||||
|
float width,
|
||||||
|
float height)
|
||||||
{
|
{
|
||||||
ClutterStagePrivate *priv;
|
ClutterStagePrivate *priv;
|
||||||
float x, y;
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
||||||
|
|
||||||
priv = stage->priv;
|
priv = stage->priv;
|
||||||
|
|
||||||
x = 0.f;
|
|
||||||
y = 0.f;
|
|
||||||
width = roundf (width);
|
|
||||||
height = roundf (height);
|
|
||||||
|
|
||||||
if (x == priv->viewport[0] &&
|
if (x == priv->viewport[0] &&
|
||||||
y == priv->viewport[1] &&
|
y == priv->viewport[1] &&
|
||||||
@@ -2510,7 +2519,7 @@ _clutter_stage_dirty_viewport (ClutterStage *stage)
|
|||||||
{
|
{
|
||||||
ClutterStageView *view = l->data;
|
ClutterStageView *view = l->data;
|
||||||
|
|
||||||
clutter_stage_view_invalidate_viewport (view);
|
clutter_stage_view_set_dirty_viewport (view, TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3133,6 +3142,7 @@ _clutter_stage_maybe_setup_viewport (ClutterStage *stage,
|
|||||||
ClutterStageView *view)
|
ClutterStageView *view)
|
||||||
{
|
{
|
||||||
ClutterStagePrivate *priv = stage->priv;
|
ClutterStagePrivate *priv = stage->priv;
|
||||||
|
CoglFramebuffer *fb = clutter_stage_view_get_framebuffer (view);
|
||||||
|
|
||||||
if (clutter_stage_view_is_dirty_viewport (view))
|
if (clutter_stage_view_is_dirty_viewport (view))
|
||||||
{
|
{
|
||||||
@@ -3159,14 +3169,19 @@ _clutter_stage_maybe_setup_viewport (ClutterStage *stage,
|
|||||||
viewport_y = roundf (priv->viewport[1] * fb_scale - viewport_offset_y);
|
viewport_y = roundf (priv->viewport[1] * fb_scale - viewport_offset_y);
|
||||||
viewport_width = roundf (priv->viewport[2] * fb_scale);
|
viewport_width = roundf (priv->viewport[2] * fb_scale);
|
||||||
viewport_height = roundf (priv->viewport[3] * fb_scale);
|
viewport_height = roundf (priv->viewport[3] * fb_scale);
|
||||||
|
cogl_framebuffer_set_viewport (fb,
|
||||||
|
viewport_x, viewport_y,
|
||||||
|
viewport_width, viewport_height);
|
||||||
|
|
||||||
clutter_stage_view_set_viewport (view,
|
clutter_stage_view_set_dirty_viewport (view, FALSE);
|
||||||
viewport_x, viewport_y,
|
|
||||||
viewport_width, viewport_height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clutter_stage_view_is_dirty_projection (view))
|
if (clutter_stage_view_is_dirty_projection (view))
|
||||||
clutter_stage_view_set_projection (view, &priv->projection);
|
{
|
||||||
|
cogl_framebuffer_set_projection_matrix (fb, &priv->projection);
|
||||||
|
|
||||||
|
clutter_stage_view_set_dirty_projection (view, FALSE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef _DEG_TO_RAD
|
#undef _DEG_TO_RAD
|
||||||
@@ -3194,7 +3209,7 @@ clutter_stage_ensure_redraw (ClutterStage *stage)
|
|||||||
priv = stage->priv;
|
priv = stage->priv;
|
||||||
|
|
||||||
if (!_clutter_stage_needs_update (stage))
|
if (!_clutter_stage_needs_update (stage))
|
||||||
clutter_stage_schedule_update (stage);
|
_clutter_stage_schedule_update (stage);
|
||||||
|
|
||||||
priv->redraw_pending = TRUE;
|
priv->redraw_pending = TRUE;
|
||||||
|
|
||||||
@@ -3422,13 +3437,13 @@ clutter_stage_get_minimum_size (ClutterStage *stage,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_stage_schedule_update:
|
* _clutter_stage_schedule_update:
|
||||||
* @stage: a #ClutterStage actor
|
* @window: a #ClutterStage actor
|
||||||
*
|
*
|
||||||
* Schedules a redraw of the #ClutterStage at the next optimal timestamp.
|
* Schedules a redraw of the #ClutterStage at the next optimal timestamp.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
clutter_stage_schedule_update (ClutterStage *stage)
|
_clutter_stage_schedule_update (ClutterStage *stage)
|
||||||
{
|
{
|
||||||
ClutterStageWindow *stage_window;
|
ClutterStageWindow *stage_window;
|
||||||
|
|
||||||
@@ -3439,8 +3454,6 @@ clutter_stage_schedule_update (ClutterStage *stage)
|
|||||||
if (stage_window == NULL)
|
if (stage_window == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
stage->priv->needs_update = TRUE;
|
|
||||||
|
|
||||||
return _clutter_stage_window_schedule_update (stage_window,
|
return _clutter_stage_window_schedule_update (stage_window,
|
||||||
stage->priv->sync_delay);
|
stage->priv->sync_delay);
|
||||||
}
|
}
|
||||||
@@ -3450,7 +3463,7 @@ clutter_stage_schedule_update (ClutterStage *stage)
|
|||||||
* @stage: a #ClutterStage actor
|
* @stage: a #ClutterStage actor
|
||||||
*
|
*
|
||||||
* Returns the earliest time in which the stage is ready to update. The update
|
* Returns the earliest time in which the stage is ready to update. The update
|
||||||
* time is set when clutter_stage_schedule_update() is called. This can then
|
* time is set when _clutter_stage_schedule_update() is called. This can then
|
||||||
* be used by e.g. the #ClutterMasterClock to know when the stage needs to be
|
* be used by e.g. the #ClutterMasterClock to know when the stage needs to be
|
||||||
* redrawn.
|
* redrawn.
|
||||||
*
|
*
|
||||||
@@ -3560,7 +3573,7 @@ _clutter_stage_queue_actor_redraw (ClutterStage *stage,
|
|||||||
|
|
||||||
CLUTTER_NOTE (PAINT, "First redraw request");
|
CLUTTER_NOTE (PAINT, "First redraw request");
|
||||||
|
|
||||||
clutter_stage_schedule_update (stage);
|
_clutter_stage_schedule_update (stage);
|
||||||
priv->redraw_pending = TRUE;
|
priv->redraw_pending = TRUE;
|
||||||
|
|
||||||
master_clock = _clutter_master_clock_get_default ();
|
master_clock = _clutter_master_clock_get_default ();
|
||||||
|
|||||||
@@ -209,9 +209,6 @@ CLUTTER_EXPORT
|
|||||||
void clutter_stage_skip_sync_delay (ClutterStage *stage);
|
void clutter_stage_skip_sync_delay (ClutterStage *stage);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_stage_schedule_update (ClutterStage *stage);
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
gboolean clutter_stage_get_capture_final_size (ClutterStage *stage,
|
gboolean clutter_stage_get_capture_final_size (ClutterStage *stage,
|
||||||
cairo_rectangle_int_t *rect,
|
cairo_rectangle_int_t *rect,
|
||||||
|
|||||||
@@ -3037,7 +3037,8 @@ clutter_text_get_preferred_height (ClutterActor *self,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_text_allocate (ClutterActor *self,
|
clutter_text_allocate (ClutterActor *self,
|
||||||
const ClutterActorBox *box)
|
const ClutterActorBox *box,
|
||||||
|
ClutterAllocationFlags flags)
|
||||||
{
|
{
|
||||||
ClutterText *text = CLUTTER_TEXT (self);
|
ClutterText *text = CLUTTER_TEXT (self);
|
||||||
ClutterActorClass *parent_class;
|
ClutterActorClass *parent_class;
|
||||||
@@ -3057,7 +3058,7 @@ clutter_text_allocate (ClutterActor *self,
|
|||||||
box->y2 - box->y1);
|
box->y2 - box->y1);
|
||||||
|
|
||||||
parent_class = CLUTTER_ACTOR_CLASS (clutter_text_parent_class);
|
parent_class = CLUTTER_ACTOR_CLASS (clutter_text_parent_class);
|
||||||
parent_class->allocate (self, box);
|
parent_class->allocate (self, box, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@@ -4786,11 +4787,11 @@ clutter_text_queue_redraw_or_relayout (ClutterText *self)
|
|||||||
clutter_text_get_preferred_height (actor, preferred_width, NULL, &preferred_height);
|
clutter_text_get_preferred_height (actor, preferred_width, NULL, &preferred_height);
|
||||||
|
|
||||||
if (clutter_actor_has_allocation (actor) &&
|
if (clutter_actor_has_allocation (actor) &&
|
||||||
fabsf (preferred_width - clutter_actor_get_width (actor)) <= 0.001 &&
|
(fabsf (preferred_width - clutter_actor_get_width (actor)) > 0.001 ||
|
||||||
fabsf (preferred_height - clutter_actor_get_height (actor)) <= 0.001)
|
fabsf (preferred_height - clutter_actor_get_height (actor)) > 0.001))
|
||||||
clutter_text_queue_redraw (actor);
|
|
||||||
else
|
|
||||||
clutter_actor_queue_relayout (actor);
|
clutter_actor_queue_relayout (actor);
|
||||||
|
else
|
||||||
|
clutter_text_queue_redraw (actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
/**
|
/**
|
||||||
* SECTION:clutter-timeline
|
* SECTION:clutter-timeline
|
||||||
* @short_description: A class for time-based events
|
* @short_description: A class for time-based events
|
||||||
|
* @see_also: #ClutterAnimation, #ClutterAnimator, #ClutterState
|
||||||
*
|
*
|
||||||
* #ClutterTimeline is a base class for managing time-based event that cause
|
* #ClutterTimeline is a base class for managing time-based event that cause
|
||||||
* Clutter to redraw a stage, such as animations.
|
* Clutter to redraw a stage, such as animations.
|
||||||
@@ -70,7 +71,7 @@
|
|||||||
* when reaching completion by using the #ClutterTimeline:auto-reverse property.
|
* when reaching completion by using the #ClutterTimeline:auto-reverse property.
|
||||||
*
|
*
|
||||||
* Timelines are used in the Clutter animation framework by classes like
|
* Timelines are used in the Clutter animation framework by classes like
|
||||||
* #ClutterTransition.
|
* #ClutterAnimation, #ClutterAnimator, and #ClutterState.
|
||||||
*
|
*
|
||||||
* ## Defining Timelines in ClutterScript
|
* ## Defining Timelines in ClutterScript
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -79,6 +79,10 @@ typedef struct _ClutterKnot ClutterKnot;
|
|||||||
typedef struct _ClutterMargin ClutterMargin;
|
typedef struct _ClutterMargin ClutterMargin;
|
||||||
typedef struct _ClutterPerspective ClutterPerspective;
|
typedef struct _ClutterPerspective ClutterPerspective;
|
||||||
|
|
||||||
|
typedef struct _ClutterAlpha ClutterAlpha;
|
||||||
|
typedef struct _ClutterAnimation ClutterAnimation;
|
||||||
|
typedef struct _ClutterState ClutterState;
|
||||||
|
|
||||||
typedef struct _ClutterInputDeviceTool ClutterInputDeviceTool;
|
typedef struct _ClutterInputDeviceTool ClutterInputDeviceTool;
|
||||||
typedef struct _ClutterInputDevice ClutterInputDevice;
|
typedef struct _ClutterInputDevice ClutterInputDevice;
|
||||||
typedef struct _ClutterVirtualInputDevice ClutterVirtualInputDevice;
|
typedef struct _ClutterVirtualInputDevice ClutterVirtualInputDevice;
|
||||||
|
|||||||
@@ -38,7 +38,6 @@
|
|||||||
|
|
||||||
#include "clutter-actor-private.h"
|
#include "clutter-actor-private.h"
|
||||||
#include "clutter-backend-private.h"
|
#include "clutter-backend-private.h"
|
||||||
#include "clutter-damage-history.h"
|
|
||||||
#include "clutter-debug.h"
|
#include "clutter-debug.h"
|
||||||
#include "clutter-event.h"
|
#include "clutter-event.h"
|
||||||
#include "clutter-enum-types.h"
|
#include "clutter-enum-types.h"
|
||||||
@@ -52,9 +51,13 @@
|
|||||||
|
|
||||||
typedef struct _ClutterStageViewCoglPrivate
|
typedef struct _ClutterStageViewCoglPrivate
|
||||||
{
|
{
|
||||||
/* Damage history, in stage view render target framebuffer coordinate space.
|
/*
|
||||||
|
* List of previous damaged areas in stage view framebuffer coordinate space.
|
||||||
*/
|
*/
|
||||||
ClutterDamageHistory *damage_history;
|
#define DAMAGE_HISTORY_MAX 16
|
||||||
|
#define DAMAGE_HISTORY(x) ((x) & (DAMAGE_HISTORY_MAX - 1))
|
||||||
|
cairo_region_t * damage_history[DAMAGE_HISTORY_MAX];
|
||||||
|
unsigned int damage_index;
|
||||||
} ClutterStageViewCoglPrivate;
|
} ClutterStageViewCoglPrivate;
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterStageViewCogl, clutter_stage_view_cogl,
|
G_DEFINE_TYPE_WITH_PRIVATE (ClutterStageViewCogl, clutter_stage_view_cogl,
|
||||||
@@ -285,13 +288,26 @@ clutter_stage_cogl_resize (ClutterStageWindow *stage_window,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline gboolean
|
||||||
|
valid_buffer_age (ClutterStageViewCogl *view_cogl,
|
||||||
|
int age)
|
||||||
|
{
|
||||||
|
ClutterStageViewCoglPrivate *view_priv =
|
||||||
|
clutter_stage_view_cogl_get_instance_private (view_cogl);
|
||||||
|
|
||||||
|
if (age <= 0)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return age < MIN (view_priv->damage_index, DAMAGE_HISTORY_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
paint_damage_region (ClutterStageWindow *stage_window,
|
paint_damage_region (ClutterStageWindow *stage_window,
|
||||||
ClutterStageView *view,
|
ClutterStageView *view,
|
||||||
cairo_region_t *swap_region,
|
cairo_region_t *swap_region,
|
||||||
cairo_region_t *queued_redraw_clip)
|
cairo_region_t *queued_redraw_clip)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *framebuffer = clutter_stage_view_get_framebuffer (view);
|
CoglFramebuffer *framebuffer = clutter_stage_view_get_onscreen (view);
|
||||||
CoglContext *ctx = cogl_framebuffer_get_context (framebuffer);
|
CoglContext *ctx = cogl_framebuffer_get_context (framebuffer);
|
||||||
static CoglPipeline *overlay_blue = NULL;
|
static CoglPipeline *overlay_blue = NULL;
|
||||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
|
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
|
||||||
@@ -362,26 +378,24 @@ swap_framebuffer (ClutterStageWindow *stage_window,
|
|||||||
gboolean swap_with_damage)
|
gboolean swap_with_damage)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *framebuffer = clutter_stage_view_get_onscreen (view);
|
CoglFramebuffer *framebuffer = clutter_stage_view_get_onscreen (view);
|
||||||
|
int *damage, n_rects, i;
|
||||||
|
|
||||||
clutter_stage_view_before_swap_buffer (view, swap_region);
|
n_rects = cairo_region_num_rectangles (swap_region);
|
||||||
|
damage = g_newa (int, n_rects * 4);
|
||||||
|
for (i = 0; i < n_rects; i++)
|
||||||
|
{
|
||||||
|
cairo_rectangle_int_t rect;
|
||||||
|
|
||||||
|
cairo_region_get_rectangle (swap_region, i, &rect);
|
||||||
|
damage[i * 4] = rect.x;
|
||||||
|
damage[i * 4 + 1] = rect.y;
|
||||||
|
damage[i * 4 + 2] = rect.width;
|
||||||
|
damage[i * 4 + 3] = rect.height;
|
||||||
|
}
|
||||||
|
|
||||||
if (cogl_is_onscreen (framebuffer))
|
if (cogl_is_onscreen (framebuffer))
|
||||||
{
|
{
|
||||||
CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer);
|
CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer);
|
||||||
int *damage, n_rects, i;
|
|
||||||
|
|
||||||
n_rects = cairo_region_num_rectangles (swap_region);
|
|
||||||
damage = g_newa (int, n_rects * 4);
|
|
||||||
for (i = 0; i < n_rects; i++)
|
|
||||||
{
|
|
||||||
cairo_rectangle_int_t rect;
|
|
||||||
|
|
||||||
cairo_region_get_rectangle (swap_region, i, &rect);
|
|
||||||
damage[i * 4] = rect.x;
|
|
||||||
damage[i * 4 + 1] = rect.y;
|
|
||||||
damage[i * 4 + 2] = rect.width;
|
|
||||||
damage[i * 4 + 3] = rect.height;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* push on the screen */
|
/* push on the screen */
|
||||||
if (n_rects > 0 && !swap_with_damage)
|
if (n_rects > 0 && !swap_with_damage)
|
||||||
@@ -416,6 +430,18 @@ swap_framebuffer (ClutterStageWindow *stage_window,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
scale_and_clamp_rect (const graphene_rect_t *rect,
|
||||||
|
float scale,
|
||||||
|
cairo_rectangle_int_t *dest)
|
||||||
|
|
||||||
|
{
|
||||||
|
graphene_rect_t tmp = *rect;
|
||||||
|
|
||||||
|
graphene_rect_scale (&tmp, scale, scale, &tmp);
|
||||||
|
_clutter_util_rectangle_int_extents (&tmp, dest);
|
||||||
|
}
|
||||||
|
|
||||||
static cairo_region_t *
|
static cairo_region_t *
|
||||||
offset_scale_and_clamp_region (const cairo_region_t *region,
|
offset_scale_and_clamp_region (const cairo_region_t *region,
|
||||||
int offset_x,
|
int offset_x,
|
||||||
@@ -437,52 +463,15 @@ offset_scale_and_clamp_region (const cairo_region_t *region,
|
|||||||
rects = freeme = g_new (cairo_rectangle_int_t, n_rects);
|
rects = freeme = g_new (cairo_rectangle_int_t, n_rects);
|
||||||
|
|
||||||
for (i = 0; i < n_rects; i++)
|
for (i = 0; i < n_rects; i++)
|
||||||
{
|
cairo_region_get_rectangle (region, i, &rects[i]);
|
||||||
cairo_rectangle_int_t *rect = &rects[i];
|
|
||||||
graphene_rect_t tmp;
|
|
||||||
|
|
||||||
cairo_region_get_rectangle (region, i, rect);
|
|
||||||
|
|
||||||
_clutter_util_rect_from_rectangle (rect, &tmp);
|
|
||||||
graphene_rect_offset (&tmp, offset_x, offset_y);
|
|
||||||
graphene_rect_scale (&tmp, scale, scale, &tmp);
|
|
||||||
_clutter_util_rectangle_int_extents (&tmp, rect);
|
|
||||||
}
|
|
||||||
|
|
||||||
return cairo_region_create_rectangles (rects, n_rects);
|
|
||||||
}
|
|
||||||
|
|
||||||
static cairo_region_t *
|
|
||||||
scale_offset_and_clamp_region (const cairo_region_t *region,
|
|
||||||
float scale,
|
|
||||||
int offset_x,
|
|
||||||
int offset_y)
|
|
||||||
{
|
|
||||||
int n_rects, i;
|
|
||||||
cairo_rectangle_int_t *rects;
|
|
||||||
g_autofree cairo_rectangle_int_t *freeme = NULL;
|
|
||||||
|
|
||||||
n_rects = cairo_region_num_rectangles (region);
|
|
||||||
|
|
||||||
if (n_rects == 0)
|
|
||||||
return cairo_region_create ();
|
|
||||||
|
|
||||||
if (n_rects < MAX_STACK_RECTS)
|
|
||||||
rects = g_newa (cairo_rectangle_int_t, n_rects);
|
|
||||||
else
|
|
||||||
rects = freeme = g_new (cairo_rectangle_int_t, n_rects);
|
|
||||||
|
|
||||||
for (i = 0; i < n_rects; i++)
|
for (i = 0; i < n_rects; i++)
|
||||||
{
|
{
|
||||||
cairo_rectangle_int_t *rect = &rects[i];
|
|
||||||
graphene_rect_t tmp;
|
graphene_rect_t tmp;
|
||||||
|
|
||||||
cairo_region_get_rectangle (region, i, rect);
|
_clutter_util_rect_from_rectangle (&rects[i], &tmp);
|
||||||
|
|
||||||
_clutter_util_rect_from_rectangle (rect, &tmp);
|
|
||||||
graphene_rect_scale (&tmp, scale, scale, &tmp);
|
|
||||||
graphene_rect_offset (&tmp, offset_x, offset_y);
|
graphene_rect_offset (&tmp, offset_x, offset_y);
|
||||||
_clutter_util_rectangle_int_extents (&tmp, rect);
|
scale_and_clamp_rect (&tmp, scale, &rects[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return cairo_region_create_rectangles (rects, n_rects);
|
return cairo_region_create_rectangles (rects, n_rects);
|
||||||
@@ -498,38 +487,107 @@ paint_stage (ClutterStageCogl *stage_cogl,
|
|||||||
_clutter_stage_maybe_setup_viewport (stage, view);
|
_clutter_stage_maybe_setup_viewport (stage, view);
|
||||||
clutter_stage_paint_view (stage, view, redraw_clip);
|
clutter_stage_paint_view (stage, view, redraw_clip);
|
||||||
|
|
||||||
clutter_stage_view_after_paint (view, redraw_clip);
|
clutter_stage_view_after_paint (view);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
fill_current_damage_history (ClutterStageView *view,
|
||||||
|
cairo_region_t *damage)
|
||||||
|
{
|
||||||
|
ClutterStageViewCogl *view_cogl = CLUTTER_STAGE_VIEW_COGL (view);
|
||||||
|
ClutterStageViewCoglPrivate *view_priv =
|
||||||
|
clutter_stage_view_cogl_get_instance_private (view_cogl);
|
||||||
|
cairo_region_t **current_fb_damage;
|
||||||
|
|
||||||
|
current_fb_damage =
|
||||||
|
&view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index)];
|
||||||
|
|
||||||
|
g_clear_pointer (current_fb_damage, cairo_region_destroy);
|
||||||
|
*current_fb_damage = cairo_region_copy (damage);
|
||||||
|
view_priv->damage_index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
fill_current_damage_history_rectangle (ClutterStageView *view,
|
||||||
|
const cairo_rectangle_int_t *rect)
|
||||||
|
{
|
||||||
|
cairo_region_t *damage;
|
||||||
|
|
||||||
|
damage = cairo_region_create_rectangle (rect);
|
||||||
|
fill_current_damage_history (view, damage);
|
||||||
|
cairo_region_destroy (damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cairo_region_t *
|
static cairo_region_t *
|
||||||
transform_swap_region_to_onscreen (ClutterStageView *view,
|
transform_swap_region_to_onscreen (ClutterStageView *view,
|
||||||
cairo_region_t *swap_region)
|
cairo_region_t *swap_region)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *onscreen = clutter_stage_view_get_onscreen (view);
|
CoglFramebuffer *framebuffer;
|
||||||
|
cairo_rectangle_int_t layout;
|
||||||
|
gint width, height;
|
||||||
int n_rects, i;
|
int n_rects, i;
|
||||||
cairo_rectangle_int_t *rects;
|
cairo_rectangle_int_t *rects;
|
||||||
cairo_region_t *transformed_region;
|
cairo_region_t *transformed_region;
|
||||||
int width, height;
|
|
||||||
|
|
||||||
width = cogl_framebuffer_get_width (onscreen);
|
framebuffer = clutter_stage_view_get_onscreen (view);
|
||||||
height = cogl_framebuffer_get_height (onscreen);
|
clutter_stage_view_get_layout (view, &layout);
|
||||||
|
|
||||||
|
width = cogl_framebuffer_get_width (framebuffer);
|
||||||
|
height = cogl_framebuffer_get_height (framebuffer);
|
||||||
|
|
||||||
n_rects = cairo_region_num_rectangles (swap_region);
|
n_rects = cairo_region_num_rectangles (swap_region);
|
||||||
rects = g_newa (cairo_rectangle_int_t, n_rects);
|
rects = g_newa (cairo_rectangle_int_t, n_rects);
|
||||||
for (i = 0; i < n_rects; i++)
|
for (i = 0; i < n_rects; i++)
|
||||||
{
|
{
|
||||||
|
gfloat x1, y1, x2, y2;
|
||||||
|
|
||||||
cairo_region_get_rectangle (swap_region, i, &rects[i]);
|
cairo_region_get_rectangle (swap_region, i, &rects[i]);
|
||||||
clutter_stage_view_transform_rect_to_onscreen (view,
|
|
||||||
&rects[i],
|
x1 = (float) rects[i].x / layout.width;
|
||||||
width,
|
y1 = (float) rects[i].y / layout.height;
|
||||||
height,
|
x2 = (float) (rects[i].x + rects[i].width) / layout.width;
|
||||||
&rects[i]);
|
y2 = (float) (rects[i].y + rects[i].height) / layout.height;
|
||||||
|
|
||||||
|
clutter_stage_view_transform_to_onscreen (view, &x1, &y1);
|
||||||
|
clutter_stage_view_transform_to_onscreen (view, &x2, &y2);
|
||||||
|
|
||||||
|
x1 = floor (x1 * width);
|
||||||
|
y1 = floor (height - (y1 * height));
|
||||||
|
x2 = ceil (x2 * width);
|
||||||
|
y2 = ceil (height - (y2 * height));
|
||||||
|
|
||||||
|
rects[i].x = x1;
|
||||||
|
rects[i].y = y1;
|
||||||
|
rects[i].width = x2 - x1;
|
||||||
|
rects[i].height = y2 - y1;
|
||||||
}
|
}
|
||||||
transformed_region = cairo_region_create_rectangles (rects, n_rects);
|
transformed_region = cairo_region_create_rectangles (rects, n_rects);
|
||||||
|
|
||||||
return transformed_region;
|
return transformed_region;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
calculate_scissor_region (cairo_rectangle_int_t *fb_clip_region,
|
||||||
|
int subpixel_compensation,
|
||||||
|
int fb_width,
|
||||||
|
int fb_height,
|
||||||
|
cairo_rectangle_int_t *out_scissor_rect)
|
||||||
|
{
|
||||||
|
*out_scissor_rect = *fb_clip_region;
|
||||||
|
|
||||||
|
if (subpixel_compensation == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (fb_clip_region->x > 0)
|
||||||
|
out_scissor_rect->x += subpixel_compensation;
|
||||||
|
if (fb_clip_region->y > 0)
|
||||||
|
out_scissor_rect->y += subpixel_compensation;
|
||||||
|
if (fb_clip_region->x + fb_clip_region->width < fb_width)
|
||||||
|
out_scissor_rect->width -= 2 * subpixel_compensation;
|
||||||
|
if (fb_clip_region->y + fb_clip_region->height < fb_height)
|
||||||
|
out_scissor_rect->height -= 2 * subpixel_compensation;
|
||||||
|
}
|
||||||
|
|
||||||
static inline gboolean
|
static inline gboolean
|
||||||
is_buffer_age_enabled (void)
|
is_buffer_age_enabled (void)
|
||||||
{
|
{
|
||||||
@@ -548,21 +606,27 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
|||||||
ClutterStageViewCoglPrivate *view_priv =
|
ClutterStageViewCoglPrivate *view_priv =
|
||||||
clutter_stage_view_cogl_get_instance_private (view_cogl);
|
clutter_stage_view_cogl_get_instance_private (view_cogl);
|
||||||
CoglFramebuffer *fb = clutter_stage_view_get_framebuffer (view);
|
CoglFramebuffer *fb = clutter_stage_view_get_framebuffer (view);
|
||||||
CoglFramebuffer *onscreen = clutter_stage_view_get_onscreen (view);
|
|
||||||
cairo_rectangle_int_t view_rect;
|
cairo_rectangle_int_t view_rect;
|
||||||
gboolean is_full_redraw;
|
gboolean is_full_redraw;
|
||||||
|
gboolean may_use_clipped_redraw;
|
||||||
gboolean use_clipped_redraw;
|
gboolean use_clipped_redraw;
|
||||||
gboolean can_blit_sub_buffer;
|
gboolean can_blit_sub_buffer;
|
||||||
gboolean has_buffer_age;
|
gboolean has_buffer_age;
|
||||||
|
gboolean do_swap_buffer;
|
||||||
gboolean swap_with_damage;
|
gboolean swap_with_damage;
|
||||||
|
ClutterActor *wrapper;
|
||||||
cairo_region_t *redraw_clip;
|
cairo_region_t *redraw_clip;
|
||||||
cairo_region_t *queued_redraw_clip = NULL;
|
cairo_region_t *queued_redraw_clip = NULL;
|
||||||
cairo_region_t *fb_clip_region;
|
cairo_region_t *fb_clip_region;
|
||||||
cairo_region_t *swap_region;
|
cairo_region_t *swap_region;
|
||||||
|
cairo_rectangle_int_t redraw_rect;
|
||||||
|
gboolean clip_region_empty;
|
||||||
float fb_scale;
|
float fb_scale;
|
||||||
|
int subpixel_compensation = 0;
|
||||||
int fb_width, fb_height;
|
int fb_width, fb_height;
|
||||||
int buffer_age;
|
int buffer_age;
|
||||||
gboolean res;
|
|
||||||
|
wrapper = CLUTTER_ACTOR (stage_cogl->wrapper);
|
||||||
|
|
||||||
clutter_stage_view_get_layout (view, &view_rect);
|
clutter_stage_view_get_layout (view, &view_rect);
|
||||||
fb_scale = clutter_stage_view_get_scale (view);
|
fb_scale = clutter_stage_view_get_scale (view);
|
||||||
@@ -570,10 +634,10 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
|||||||
fb_height = cogl_framebuffer_get_height (fb);
|
fb_height = cogl_framebuffer_get_height (fb);
|
||||||
|
|
||||||
can_blit_sub_buffer =
|
can_blit_sub_buffer =
|
||||||
cogl_is_onscreen (onscreen) &&
|
cogl_is_onscreen (fb) &&
|
||||||
cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_REGION);
|
cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_REGION);
|
||||||
|
|
||||||
has_buffer_age = cogl_is_onscreen (onscreen) && is_buffer_age_enabled ();
|
has_buffer_age = cogl_is_onscreen (fb) && is_buffer_age_enabled ();
|
||||||
|
|
||||||
redraw_clip = clutter_stage_view_take_redraw_clip (view);
|
redraw_clip = clutter_stage_view_take_redraw_clip (view);
|
||||||
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_DAMAGE_REGION))
|
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_DAMAGE_REGION))
|
||||||
@@ -585,35 +649,51 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
|||||||
else
|
else
|
||||||
is_full_redraw = FALSE;
|
is_full_redraw = FALSE;
|
||||||
|
|
||||||
if (has_buffer_age)
|
may_use_clipped_redraw =
|
||||||
{
|
|
||||||
buffer_age = cogl_onscreen_get_buffer_age (COGL_ONSCREEN (onscreen));
|
|
||||||
if (!clutter_damage_history_is_age_valid (view_priv->damage_history,
|
|
||||||
buffer_age))
|
|
||||||
{
|
|
||||||
CLUTTER_NOTE (CLIPPING,
|
|
||||||
"Invalid back buffer(age=%d): forcing full redraw\n",
|
|
||||||
buffer_age);
|
|
||||||
use_clipped_redraw = FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
use_clipped_redraw =
|
|
||||||
use_clipped_redraw &&
|
|
||||||
!(clutter_paint_debug_flags & CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS) &&
|
|
||||||
_clutter_stage_window_can_clip_redraws (stage_window) &&
|
_clutter_stage_window_can_clip_redraws (stage_window) &&
|
||||||
(can_blit_sub_buffer || has_buffer_age) &&
|
(can_blit_sub_buffer || has_buffer_age) &&
|
||||||
!is_full_redraw &&
|
!is_full_redraw &&
|
||||||
/* some drivers struggle to get going and produce some junk
|
/* some drivers struggle to get going and produce some junk
|
||||||
* frames when starting up... */
|
* frames when starting up... */
|
||||||
cogl_onscreen_get_frame_counter (COGL_ONSCREEN (onscreen)) > 3;
|
cogl_onscreen_get_frame_counter (COGL_ONSCREEN (fb)) > 3;
|
||||||
|
|
||||||
if (use_clipped_redraw)
|
if (has_buffer_age)
|
||||||
|
{
|
||||||
|
buffer_age = cogl_onscreen_get_buffer_age (COGL_ONSCREEN (fb));
|
||||||
|
if (!valid_buffer_age (view_cogl, buffer_age))
|
||||||
|
{
|
||||||
|
CLUTTER_NOTE (CLIPPING, "Invalid back buffer(age=%d): forcing full redraw\n", buffer_age);
|
||||||
|
may_use_clipped_redraw = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (may_use_clipped_redraw)
|
||||||
{
|
{
|
||||||
fb_clip_region = offset_scale_and_clamp_region (redraw_clip,
|
fb_clip_region = offset_scale_and_clamp_region (redraw_clip,
|
||||||
-view_rect.x,
|
-view_rect.x,
|
||||||
-view_rect.y,
|
-view_rect.y,
|
||||||
fb_scale);
|
fb_scale);
|
||||||
|
|
||||||
|
if (fb_scale != floorf (fb_scale))
|
||||||
|
{
|
||||||
|
int n_rects, i;
|
||||||
|
cairo_rectangle_int_t *rects;
|
||||||
|
|
||||||
|
subpixel_compensation = ceilf (fb_scale);
|
||||||
|
|
||||||
|
n_rects = cairo_region_num_rectangles (fb_clip_region);
|
||||||
|
rects = g_newa (cairo_rectangle_int_t, n_rects);
|
||||||
|
for (i = 0; i < n_rects; i++)
|
||||||
|
{
|
||||||
|
cairo_region_get_rectangle (fb_clip_region, i, &rects[i]);
|
||||||
|
rects[i].x -= subpixel_compensation;
|
||||||
|
rects[i].y -= subpixel_compensation;
|
||||||
|
rects[i].width += 2 * subpixel_compensation;
|
||||||
|
rects[i].height += 2 * subpixel_compensation;
|
||||||
|
}
|
||||||
|
cairo_region_destroy (fb_clip_region);
|
||||||
|
fb_clip_region = cairo_region_create_rectangles (rects, n_rects);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -629,40 +709,46 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
|||||||
redraw_clip = cairo_region_create_rectangle (&view_rect);
|
redraw_clip = cairo_region_create_rectangle (&view_rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_return_val_if_fail (!cairo_region_is_empty (fb_clip_region), FALSE);
|
if (may_use_clipped_redraw &&
|
||||||
|
G_LIKELY (!(clutter_paint_debug_flags & CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS)))
|
||||||
|
use_clipped_redraw = TRUE;
|
||||||
|
else
|
||||||
|
use_clipped_redraw = FALSE;
|
||||||
|
|
||||||
|
clip_region_empty = may_use_clipped_redraw && cairo_region_is_empty (fb_clip_region);
|
||||||
|
|
||||||
swap_with_damage = FALSE;
|
swap_with_damage = FALSE;
|
||||||
if (has_buffer_age)
|
if (has_buffer_age)
|
||||||
{
|
{
|
||||||
clutter_damage_history_record (view_priv->damage_history,
|
if (use_clipped_redraw && !clip_region_empty)
|
||||||
fb_clip_region);
|
|
||||||
|
|
||||||
if (use_clipped_redraw)
|
|
||||||
{
|
{
|
||||||
cairo_region_t *fb_damage;
|
cairo_region_t *fb_damage;
|
||||||
cairo_region_t *view_damage;
|
cairo_region_t *view_damage;
|
||||||
int age;
|
int i;
|
||||||
|
|
||||||
|
fill_current_damage_history (view, fb_clip_region);
|
||||||
|
|
||||||
fb_damage = cairo_region_create ();
|
fb_damage = cairo_region_create ();
|
||||||
|
|
||||||
for (age = 1; age <= buffer_age; age++)
|
for (i = 1; i <= buffer_age; i++)
|
||||||
{
|
{
|
||||||
const cairo_region_t *old_damage;
|
int damage_index;
|
||||||
|
|
||||||
old_damage =
|
damage_index = DAMAGE_HISTORY (view_priv->damage_index - i - 1);
|
||||||
clutter_damage_history_lookup (view_priv->damage_history, age);
|
cairo_region_union (fb_damage,
|
||||||
cairo_region_union (fb_damage, old_damage);
|
view_priv->damage_history[damage_index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update the fb clip region with the extra damage. */
|
/* Update the fb clip region with the extra damage. */
|
||||||
cairo_region_union (fb_clip_region, fb_damage);
|
cairo_region_union (fb_clip_region, fb_damage);
|
||||||
|
|
||||||
/* Update the redraw clip with the extra damage done to the view */
|
view_damage = offset_scale_and_clamp_region (fb_damage,
|
||||||
view_damage = scale_offset_and_clamp_region (fb_damage,
|
0, 0,
|
||||||
1.0f / fb_scale,
|
1.0f / fb_scale);
|
||||||
view_rect.x,
|
cairo_region_translate (view_damage, view_rect.x, view_rect.y);
|
||||||
view_rect.y);
|
cairo_region_intersect_rectangle (view_damage, &view_rect);
|
||||||
|
|
||||||
|
/* Update the redraw clip region with the extra damage. */
|
||||||
cairo_region_union (redraw_clip, view_damage);
|
cairo_region_union (redraw_clip, view_damage);
|
||||||
|
|
||||||
cairo_region_destroy (view_damage);
|
cairo_region_destroy (view_damage);
|
||||||
@@ -674,13 +760,55 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
|||||||
|
|
||||||
swap_with_damage = TRUE;
|
swap_with_damage = TRUE;
|
||||||
}
|
}
|
||||||
|
else if (!use_clipped_redraw)
|
||||||
|
{
|
||||||
|
cairo_rectangle_int_t fb_damage;
|
||||||
|
|
||||||
clutter_damage_history_step (view_priv->damage_history);
|
fb_damage = (cairo_rectangle_int_t) {
|
||||||
|
.x = 0,
|
||||||
|
.y = 0,
|
||||||
|
.width = ceilf (view_rect.width * fb_scale),
|
||||||
|
.height = ceilf (view_rect.height * fb_scale)
|
||||||
|
};
|
||||||
|
fill_current_damage_history_rectangle (view, &fb_damage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (use_clipped_redraw)
|
if (use_clipped_redraw && clip_region_empty)
|
||||||
{
|
{
|
||||||
cogl_framebuffer_push_region_clip (fb, fb_clip_region);
|
CLUTTER_NOTE (CLIPPING, "Empty stage output paint\n");
|
||||||
|
}
|
||||||
|
else if (use_clipped_redraw)
|
||||||
|
{
|
||||||
|
cairo_rectangle_int_t clip_rect;
|
||||||
|
cairo_rectangle_int_t scissor_rect;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
paint_stage (stage_cogl, view, redraw_clip);
|
paint_stage (stage_cogl, view, redraw_clip);
|
||||||
|
|
||||||
@@ -690,7 +818,77 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
|||||||
{
|
{
|
||||||
CLUTTER_NOTE (CLIPPING, "Unclipped stage paint\n");
|
CLUTTER_NOTE (CLIPPING, "Unclipped stage paint\n");
|
||||||
|
|
||||||
paint_stage (stage_cogl, view, redraw_clip);
|
/* If we are trying to debug redraw issues then we want to pass
|
||||||
|
* the redraw_clip so it can be visualized */
|
||||||
|
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS) &&
|
||||||
|
may_use_clipped_redraw &&
|
||||||
|
!clip_region_empty)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
|
||||||
|
cogl_framebuffer_push_scissor_clip (fb,
|
||||||
|
scissor_rect.x,
|
||||||
|
scissor_rect.y,
|
||||||
|
scissor_rect.width,
|
||||||
|
scissor_rect.height);
|
||||||
|
|
||||||
|
paint_stage (stage_cogl, view, redraw_clip);
|
||||||
|
|
||||||
|
cogl_framebuffer_pop_clip (fb);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
paint_stage (stage_cogl, view, redraw_clip);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cairo_region_get_extents (redraw_clip, &redraw_rect);
|
||||||
|
|
||||||
|
if (may_use_clipped_redraw &&
|
||||||
|
G_UNLIKELY ((clutter_paint_debug_flags & CLUTTER_DEBUG_REDRAWS)))
|
||||||
|
{
|
||||||
|
CoglContext *ctx = cogl_framebuffer_get_context (fb);
|
||||||
|
static CoglPipeline *outline = NULL;
|
||||||
|
ClutterActor *actor = CLUTTER_ACTOR (wrapper);
|
||||||
|
float x_1 = redraw_rect.x;
|
||||||
|
float x_2 = redraw_rect.x + redraw_rect.width;
|
||||||
|
float y_1 = redraw_rect.y;
|
||||||
|
float y_2 = redraw_rect.y + redraw_rect.height;
|
||||||
|
CoglVertexP2 quad[4] = {
|
||||||
|
{ x_1, y_1 },
|
||||||
|
{ x_2, y_1 },
|
||||||
|
{ x_2, y_2 },
|
||||||
|
{ x_1, y_2 }
|
||||||
|
};
|
||||||
|
CoglPrimitive *prim;
|
||||||
|
CoglMatrix modelview;
|
||||||
|
|
||||||
|
if (outline == NULL)
|
||||||
|
{
|
||||||
|
outline = cogl_pipeline_new (ctx);
|
||||||
|
cogl_pipeline_set_color4ub (outline, 0xff, 0x00, 0x00, 0xff);
|
||||||
|
}
|
||||||
|
|
||||||
|
prim = cogl_primitive_new_p2 (ctx,
|
||||||
|
COGL_VERTICES_MODE_LINE_LOOP,
|
||||||
|
4, /* n_vertices */
|
||||||
|
quad);
|
||||||
|
|
||||||
|
cogl_framebuffer_push_matrix (fb);
|
||||||
|
cogl_matrix_init_identity (&modelview);
|
||||||
|
_clutter_actor_apply_modelview_transform (actor, &modelview);
|
||||||
|
cogl_framebuffer_set_modelview_matrix (fb, &modelview);
|
||||||
|
cogl_framebuffer_draw_primitive (fb, outline, prim);
|
||||||
|
cogl_framebuffer_pop_matrix (fb);
|
||||||
|
cogl_object_unref (prim);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX: It seems there will be a race here in that the stage
|
/* XXX: It seems there will be a race here in that the stage
|
||||||
@@ -702,42 +900,65 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
|||||||
* artefacts.
|
* artefacts.
|
||||||
*/
|
*/
|
||||||
if (use_clipped_redraw)
|
if (use_clipped_redraw)
|
||||||
swap_region = cairo_region_copy (fb_clip_region);
|
{
|
||||||
|
if (clip_region_empty)
|
||||||
|
{
|
||||||
|
do_swap_buffer = FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
swap_region = cairo_region_copy (fb_clip_region);
|
||||||
|
do_swap_buffer = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
swap_region = cairo_region_create ();
|
{
|
||||||
|
swap_region = cairo_region_create ();
|
||||||
|
do_swap_buffer = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
g_clear_pointer (&redraw_clip, cairo_region_destroy);
|
g_clear_pointer (&redraw_clip, cairo_region_destroy);
|
||||||
g_clear_pointer (&fb_clip_region, cairo_region_destroy);
|
g_clear_pointer (&fb_clip_region, cairo_region_destroy);
|
||||||
|
|
||||||
COGL_TRACE_BEGIN_SCOPED (ClutterStageCoglRedrawViewSwapFramebuffer,
|
if (do_swap_buffer)
|
||||||
"Paint (swap framebuffer)");
|
|
||||||
|
|
||||||
if (clutter_stage_view_get_onscreen (view) !=
|
|
||||||
clutter_stage_view_get_framebuffer (view))
|
|
||||||
{
|
{
|
||||||
cairo_region_t *transformed_swap_region;
|
gboolean res;
|
||||||
|
|
||||||
|
COGL_TRACE_BEGIN_SCOPED (ClutterStageCoglRedrawViewSwapFramebuffer,
|
||||||
|
"Paint (swap framebuffer)");
|
||||||
|
|
||||||
|
if (clutter_stage_view_get_onscreen (view) !=
|
||||||
|
clutter_stage_view_get_framebuffer (view))
|
||||||
|
{
|
||||||
|
cairo_region_t *transformed_swap_region;
|
||||||
|
|
||||||
|
transformed_swap_region =
|
||||||
|
transform_swap_region_to_onscreen (view, swap_region);
|
||||||
|
cairo_region_destroy (swap_region);
|
||||||
|
swap_region = transformed_swap_region;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (queued_redraw_clip)
|
||||||
|
{
|
||||||
|
paint_damage_region (stage_window, view,
|
||||||
|
swap_region, queued_redraw_clip);
|
||||||
|
cairo_region_destroy (queued_redraw_clip);
|
||||||
|
}
|
||||||
|
|
||||||
|
res = swap_framebuffer (stage_window,
|
||||||
|
view,
|
||||||
|
swap_region,
|
||||||
|
swap_with_damage);
|
||||||
|
|
||||||
transformed_swap_region =
|
|
||||||
transform_swap_region_to_onscreen (view, swap_region);
|
|
||||||
cairo_region_destroy (swap_region);
|
cairo_region_destroy (swap_region);
|
||||||
swap_region = transformed_swap_region;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (queued_redraw_clip)
|
return res;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
paint_damage_region (stage_window, view,
|
g_clear_pointer (&queued_redraw_clip, cairo_region_destroy);
|
||||||
swap_region, queued_redraw_clip);
|
return FALSE;
|
||||||
cairo_region_destroy (queued_redraw_clip);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
res = swap_framebuffer (stage_window,
|
|
||||||
view,
|
|
||||||
swap_region,
|
|
||||||
swap_with_damage);
|
|
||||||
|
|
||||||
cairo_region_destroy (swap_region);
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -862,31 +1083,12 @@ _clutter_stage_cogl_init (ClutterStageCogl *stage)
|
|||||||
stage->update_time = -1;
|
stage->update_time = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_stage_view_cogl_finalize (GObject *object)
|
|
||||||
{
|
|
||||||
ClutterStageViewCogl *view_cogl = CLUTTER_STAGE_VIEW_COGL (object);
|
|
||||||
ClutterStageViewCoglPrivate *view_priv =
|
|
||||||
clutter_stage_view_cogl_get_instance_private (view_cogl);
|
|
||||||
|
|
||||||
clutter_damage_history_free (view_priv->damage_history);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (clutter_stage_view_cogl_parent_class)->finalize (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_view_cogl_init (ClutterStageViewCogl *view_cogl)
|
clutter_stage_view_cogl_init (ClutterStageViewCogl *view_cogl)
|
||||||
{
|
{
|
||||||
ClutterStageViewCoglPrivate *view_priv =
|
|
||||||
clutter_stage_view_cogl_get_instance_private (view_cogl);
|
|
||||||
|
|
||||||
view_priv->damage_history = clutter_damage_history_new ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_view_cogl_class_init (ClutterStageViewCoglClass *klass)
|
clutter_stage_view_cogl_class_init (ClutterStageViewCoglClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
||||||
|
|
||||||
object_class->finalize = clutter_stage_view_cogl_finalize;
|
|
||||||
}
|
}
|
||||||
|
|||||||
819
clutter/clutter/deprecated/clutter-alpha.c
Normal file
819
clutter/clutter/deprecated/clutter-alpha.c
Normal file
@@ -0,0 +1,819 @@
|
|||||||
|
/*
|
||||||
|
* Clutter.
|
||||||
|
*
|
||||||
|
* An OpenGL based 'interactive canvas' library.
|
||||||
|
*
|
||||||
|
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||||
|
* Jorn Baayen <jorn@openedhand.com>
|
||||||
|
* Emmanuele Bassi <ebassi@openedhand.com>
|
||||||
|
* Tomas Frydrych <tf@openedhand.com>
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006, 2007, 2008 OpenedHand
|
||||||
|
* Copyright (C) 2009, 2010 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SECTION:clutter-alpha
|
||||||
|
* @short_description: A class for calculating a value as a function of time
|
||||||
|
*
|
||||||
|
* #ClutterAlpha is a class for calculating an floating point value
|
||||||
|
* dependent only on the position of a #ClutterTimeline.
|
||||||
|
*
|
||||||
|
* For newly written code, it is recommended to use the
|
||||||
|
* #ClutterTimeline:progress-mode property of #ClutterTimeline, or the
|
||||||
|
* clutter_timeline_set_progress_func() function instead of #ClutterAlpha.
|
||||||
|
* The #ClutterAlpha class will be deprecated in the future, and will not
|
||||||
|
* be available any more in the next major version of Clutter.
|
||||||
|
*
|
||||||
|
* A #ClutterAlpha binds a #ClutterTimeline to a progress function which
|
||||||
|
* translates the time T into an adimensional factor alpha.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* Instead of a #ClutterAnimationMode you may provide a function returning
|
||||||
|
* the alpha value depending on the progress of the timeline, using
|
||||||
|
* clutter_alpha_set_func() or clutter_alpha_set_closure(). The alpha
|
||||||
|
* function will be executed each time a new frame in the #ClutterTimeline
|
||||||
|
* is reached.
|
||||||
|
*
|
||||||
|
* Since the alpha function is controlled by the timeline instance, you can
|
||||||
|
* pause, stop or resume the #ClutterAlpha from calling the alpha function by
|
||||||
|
* using the appropriate functions of the #ClutterTimeline object.
|
||||||
|
*
|
||||||
|
* #ClutterAlpha is available since Clutter 0.2.
|
||||||
|
*
|
||||||
|
* #ClutterAlpha is deprecated since Clutter 1.12. #ClutterTimeline and
|
||||||
|
* the #ClutterTimeline:progress-mode property replace this whole class.
|
||||||
|
*
|
||||||
|
* ## ClutterAlpha custom properties for #ClutterScript
|
||||||
|
*
|
||||||
|
* #ClutterAlpha defines a custom `function` property for
|
||||||
|
* #ClutterScript which allows to reference a custom alpha function
|
||||||
|
* available in the source code. Setting the `function` property
|
||||||
|
* is equivalent to calling clutter_alpha_set_func() with the
|
||||||
|
* specified function name. No user data or #GDestroyNotify is
|
||||||
|
* available to be passed.
|
||||||
|
*
|
||||||
|
* The following JSON fragment defines a #ClutterAlpha
|
||||||
|
* using a #ClutterTimeline with id "sine-timeline" and an alpha
|
||||||
|
* function called `my_sine_alpha`.
|
||||||
|
*
|
||||||
|
* |[
|
||||||
|
* {
|
||||||
|
* "id" : "sine-alpha",
|
||||||
|
* "timeline" : {
|
||||||
|
* "id" : "sine-timeline",
|
||||||
|
* "duration" : 500,
|
||||||
|
* "loop" : true
|
||||||
|
* },
|
||||||
|
* "function" : "my_sine_alpha"
|
||||||
|
* }
|
||||||
|
* ]|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "clutter-build-config.h"
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#include <gmodule.h>
|
||||||
|
|
||||||
|
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||||
|
|
||||||
|
#include "clutter-alpha.h"
|
||||||
|
#include "clutter-debug.h"
|
||||||
|
#include "clutter-enum-types.h"
|
||||||
|
#include "clutter-easing.h"
|
||||||
|
#include "clutter-main.h"
|
||||||
|
#include "clutter-marshal.h"
|
||||||
|
#include "clutter-private.h"
|
||||||
|
#include "clutter-scriptable.h"
|
||||||
|
#include "clutter-script-private.h"
|
||||||
|
|
||||||
|
struct _ClutterAlphaPrivate
|
||||||
|
{
|
||||||
|
ClutterTimeline *timeline;
|
||||||
|
guint timeline_new_frame_id;
|
||||||
|
|
||||||
|
gdouble alpha;
|
||||||
|
|
||||||
|
GClosure *closure;
|
||||||
|
|
||||||
|
ClutterAlphaFunc func;
|
||||||
|
gpointer user_data;
|
||||||
|
GDestroyNotify notify;
|
||||||
|
|
||||||
|
gulong mode;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PROP_0,
|
||||||
|
|
||||||
|
PROP_TIMELINE,
|
||||||
|
PROP_ALPHA,
|
||||||
|
PROP_MODE,
|
||||||
|
|
||||||
|
PROP_LAST
|
||||||
|
};
|
||||||
|
|
||||||
|
static GParamSpec *obj_props[PROP_LAST];
|
||||||
|
|
||||||
|
static void clutter_scriptable_iface_init (ClutterScriptableIface *iface);
|
||||||
|
|
||||||
|
G_DEFINE_TYPE_WITH_CODE (ClutterAlpha,
|
||||||
|
clutter_alpha,
|
||||||
|
G_TYPE_INITIALLY_UNOWNED,
|
||||||
|
G_ADD_PRIVATE (ClutterAlpha)
|
||||||
|
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE,
|
||||||
|
clutter_scriptable_iface_init));
|
||||||
|
|
||||||
|
static void
|
||||||
|
timeline_new_frame_cb (ClutterTimeline *timeline,
|
||||||
|
guint msecs,
|
||||||
|
ClutterAlpha *alpha)
|
||||||
|
{
|
||||||
|
ClutterAlphaPrivate *priv = alpha->priv;
|
||||||
|
|
||||||
|
/* Update alpha value and notify */
|
||||||
|
priv->alpha = clutter_alpha_get_alpha (alpha);
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (alpha), obj_props[PROP_ALPHA]);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_alpha_set_property (GObject *object,
|
||||||
|
guint prop_id,
|
||||||
|
const GValue *value,
|
||||||
|
GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
ClutterAlpha *alpha = CLUTTER_ALPHA (object);
|
||||||
|
|
||||||
|
switch (prop_id)
|
||||||
|
{
|
||||||
|
case PROP_TIMELINE:
|
||||||
|
clutter_alpha_set_timeline (alpha, g_value_get_object (value));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PROP_MODE:
|
||||||
|
clutter_alpha_set_mode (alpha, g_value_get_ulong (value));
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_alpha_get_property (GObject *object,
|
||||||
|
guint prop_id,
|
||||||
|
GValue *value,
|
||||||
|
GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
ClutterAlphaPrivate *priv = CLUTTER_ALPHA (object)->priv;
|
||||||
|
|
||||||
|
switch (prop_id)
|
||||||
|
{
|
||||||
|
case PROP_TIMELINE:
|
||||||
|
g_value_set_object (value, priv->timeline);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PROP_ALPHA:
|
||||||
|
g_value_set_double (value, priv->alpha);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PROP_MODE:
|
||||||
|
g_value_set_ulong (value, priv->mode);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_alpha_finalize (GObject *object)
|
||||||
|
{
|
||||||
|
ClutterAlphaPrivate *priv = CLUTTER_ALPHA (object)->priv;
|
||||||
|
|
||||||
|
if (priv->notify != NULL)
|
||||||
|
priv->notify (priv->user_data);
|
||||||
|
else if (priv->closure != NULL)
|
||||||
|
g_closure_unref (priv->closure);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (clutter_alpha_parent_class)->finalize (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_alpha_dispose (GObject *object)
|
||||||
|
{
|
||||||
|
ClutterAlpha *self = CLUTTER_ALPHA(object);
|
||||||
|
|
||||||
|
clutter_alpha_set_timeline (self, NULL);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (clutter_alpha_parent_class)->dispose (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ClutterAlphaFunc
|
||||||
|
resolve_alpha_func (const gchar *name)
|
||||||
|
{
|
||||||
|
static GModule *module = NULL;
|
||||||
|
ClutterAlphaFunc func;
|
||||||
|
|
||||||
|
CLUTTER_NOTE (SCRIPT, "Looking up '%s' alpha function", name);
|
||||||
|
|
||||||
|
if (G_UNLIKELY (module == NULL))
|
||||||
|
module = g_module_open (NULL, 0);
|
||||||
|
|
||||||
|
if (g_module_symbol (module, name, (gpointer) &func))
|
||||||
|
{
|
||||||
|
CLUTTER_NOTE (SCRIPT, "Found '%s' alpha function in the symbols table",
|
||||||
|
name);
|
||||||
|
return func;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_alpha_set_custom_property (ClutterScriptable *scriptable,
|
||||||
|
ClutterScript *script,
|
||||||
|
const gchar *name,
|
||||||
|
const GValue *value)
|
||||||
|
{
|
||||||
|
if (strncmp (name, "function", 8) == 0)
|
||||||
|
{
|
||||||
|
g_assert (G_VALUE_HOLDS (value, G_TYPE_POINTER));
|
||||||
|
if (g_value_get_pointer (value) != NULL)
|
||||||
|
{
|
||||||
|
clutter_alpha_set_func (CLUTTER_ALPHA (scriptable),
|
||||||
|
g_value_get_pointer (value),
|
||||||
|
NULL, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
g_object_set_property (G_OBJECT (scriptable), name, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
clutter_alpha_parse_custom_node (ClutterScriptable *scriptable,
|
||||||
|
ClutterScript *script,
|
||||||
|
GValue *value,
|
||||||
|
const gchar *name,
|
||||||
|
JsonNode *node)
|
||||||
|
{
|
||||||
|
if (strncmp (name, "function", 8) == 0)
|
||||||
|
{
|
||||||
|
const gchar *func_name = json_node_get_string (node);
|
||||||
|
|
||||||
|
g_value_init (value, G_TYPE_POINTER);
|
||||||
|
g_value_set_pointer (value, resolve_alpha_func (func_name));
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* we need to do this because we use gulong in place
|
||||||
|
* of ClutterAnimationMode for ClutterAlpha:mode
|
||||||
|
*/
|
||||||
|
if (strncmp (name, "mode", 4) == 0)
|
||||||
|
{
|
||||||
|
gulong mode;
|
||||||
|
|
||||||
|
mode = _clutter_script_resolve_animation_mode (node);
|
||||||
|
|
||||||
|
g_value_init (value, G_TYPE_ULONG);
|
||||||
|
g_value_set_ulong (value, mode);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_scriptable_iface_init (ClutterScriptableIface *iface)
|
||||||
|
{
|
||||||
|
iface->parse_custom_node = clutter_alpha_parse_custom_node;
|
||||||
|
iface->set_custom_property = clutter_alpha_set_custom_property;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_alpha_class_init (ClutterAlphaClass *klass)
|
||||||
|
{
|
||||||
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
|
object_class->set_property = clutter_alpha_set_property;
|
||||||
|
object_class->get_property = clutter_alpha_get_property;
|
||||||
|
object_class->finalize = clutter_alpha_finalize;
|
||||||
|
object_class->dispose = clutter_alpha_dispose;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClutterAlpha:timeline:
|
||||||
|
*
|
||||||
|
* A #ClutterTimeline instance used to drive the alpha function.
|
||||||
|
*
|
||||||
|
* Since: 0.2
|
||||||
|
*
|
||||||
|
* Deprecated: 1.12
|
||||||
|
*/
|
||||||
|
obj_props[PROP_TIMELINE] =
|
||||||
|
g_param_spec_object ("timeline",
|
||||||
|
P_("Timeline"),
|
||||||
|
P_("Timeline used by the alpha"),
|
||||||
|
CLUTTER_TYPE_TIMELINE,
|
||||||
|
CLUTTER_PARAM_READWRITE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClutterAlpha:alpha:
|
||||||
|
*
|
||||||
|
* The alpha value as computed by the alpha function. The linear
|
||||||
|
* interval is 0.0 to 1.0, but the Alpha allows overshooting by
|
||||||
|
* one unit in each direction, so the valid interval is -1.0 to 2.0.
|
||||||
|
*
|
||||||
|
* Since: 0.2
|
||||||
|
* Deprecated: 1.12: Use #ClutterTimeline::new-frame and
|
||||||
|
* clutter_timeline_get_progress() instead
|
||||||
|
*/
|
||||||
|
obj_props[PROP_ALPHA] =
|
||||||
|
g_param_spec_double ("alpha",
|
||||||
|
P_("Alpha value"),
|
||||||
|
P_("Alpha value as computed by the alpha"),
|
||||||
|
-1.0, 2.0,
|
||||||
|
0.0,
|
||||||
|
CLUTTER_PARAM_READABLE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClutterAlpha:mode:
|
||||||
|
*
|
||||||
|
* The progress function logical id - a value from the
|
||||||
|
* #ClutterAnimationMode enumeration.
|
||||||
|
*
|
||||||
|
* If %CLUTTER_CUSTOM_MODE is used then the function set using
|
||||||
|
* clutter_alpha_set_closure() or clutter_alpha_set_func()
|
||||||
|
* will be used.
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
* Deprecated: 1.12: Use #ClutterTimeline:progress-mode
|
||||||
|
*/
|
||||||
|
obj_props[PROP_MODE] =
|
||||||
|
g_param_spec_ulong ("mode",
|
||||||
|
P_("Mode"),
|
||||||
|
P_("Progress mode"),
|
||||||
|
0, G_MAXULONG,
|
||||||
|
CLUTTER_CUSTOM_MODE,
|
||||||
|
G_PARAM_CONSTRUCT | CLUTTER_PARAM_READWRITE);
|
||||||
|
|
||||||
|
g_object_class_install_properties (object_class,
|
||||||
|
PROP_LAST,
|
||||||
|
obj_props);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_alpha_init (ClutterAlpha *self)
|
||||||
|
{
|
||||||
|
self->priv = clutter_alpha_get_instance_private (self);
|
||||||
|
self->priv->mode = CLUTTER_CUSTOM_MODE;
|
||||||
|
self->priv->alpha = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_alpha_get_alpha:
|
||||||
|
* @alpha: A #ClutterAlpha
|
||||||
|
*
|
||||||
|
* Query the current alpha value.
|
||||||
|
*
|
||||||
|
* Return Value: The current alpha value for the alpha
|
||||||
|
*
|
||||||
|
* Since: 0.2
|
||||||
|
*
|
||||||
|
* Deprecated: 1.12: Use clutter_timeline_get_progress()
|
||||||
|
*/
|
||||||
|
gdouble
|
||||||
|
clutter_alpha_get_alpha (ClutterAlpha *alpha)
|
||||||
|
{
|
||||||
|
ClutterAlphaPrivate *priv;
|
||||||
|
gdouble retval = 0;
|
||||||
|
|
||||||
|
g_return_val_if_fail (CLUTTER_IS_ALPHA (alpha), 0);
|
||||||
|
|
||||||
|
priv = alpha->priv;
|
||||||
|
|
||||||
|
if (G_LIKELY (priv->func))
|
||||||
|
{
|
||||||
|
return priv->func (alpha, priv->user_data);
|
||||||
|
}
|
||||||
|
else if (priv->closure)
|
||||||
|
{
|
||||||
|
GValue params = G_VALUE_INIT;
|
||||||
|
GValue result_value = G_VALUE_INIT;
|
||||||
|
|
||||||
|
g_object_ref (alpha);
|
||||||
|
|
||||||
|
g_value_init (&result_value, G_TYPE_DOUBLE);
|
||||||
|
|
||||||
|
g_value_init (¶ms, CLUTTER_TYPE_ALPHA);
|
||||||
|
g_value_set_object (¶ms, alpha);
|
||||||
|
|
||||||
|
g_closure_invoke (priv->closure, &result_value, 1, ¶ms, NULL);
|
||||||
|
|
||||||
|
retval = g_value_get_double (&result_value);
|
||||||
|
|
||||||
|
g_value_unset (&result_value);
|
||||||
|
g_value_unset (¶ms);
|
||||||
|
|
||||||
|
g_object_unref (alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* clutter_alpha_set_closure_internal:
|
||||||
|
* @alpha: a #ClutterAlpha
|
||||||
|
* @closure: a #GClosure
|
||||||
|
*
|
||||||
|
* Sets the @closure for @alpha. This function does not
|
||||||
|
* set the #ClutterAlpha:mode property and does not emit
|
||||||
|
* the #GObject::notify signal for it.
|
||||||
|
*/
|
||||||
|
static inline void
|
||||||
|
clutter_alpha_set_closure_internal (ClutterAlpha *alpha,
|
||||||
|
GClosure *closure)
|
||||||
|
{
|
||||||
|
ClutterAlphaPrivate *priv = alpha->priv;
|
||||||
|
|
||||||
|
if (priv->notify != NULL)
|
||||||
|
priv->notify (priv->user_data);
|
||||||
|
else if (priv->closure != NULL)
|
||||||
|
g_closure_unref (priv->closure);
|
||||||
|
|
||||||
|
priv->func = NULL;
|
||||||
|
priv->user_data = NULL;
|
||||||
|
priv->notify = NULL;
|
||||||
|
|
||||||
|
if (closure == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* need to take ownership of the closure before sinking it */
|
||||||
|
priv->closure = g_closure_ref (closure);
|
||||||
|
g_closure_sink (closure);
|
||||||
|
|
||||||
|
/* set the marshaller */
|
||||||
|
if (G_CLOSURE_NEEDS_MARSHAL (closure))
|
||||||
|
{
|
||||||
|
GClosureMarshal marshal = _clutter_marshal_DOUBLE__VOID;
|
||||||
|
|
||||||
|
g_closure_set_marshal (priv->closure, marshal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_alpha_set_closure:
|
||||||
|
* @alpha: A #ClutterAlpha
|
||||||
|
* @closure: A #GClosure
|
||||||
|
*
|
||||||
|
* Sets the #GClosure used to compute the alpha value at each
|
||||||
|
* frame of the #ClutterTimeline bound to @alpha.
|
||||||
|
*
|
||||||
|
* Since: 0.8
|
||||||
|
*
|
||||||
|
* Deprecated: 1.12: Use clutter_timeline_set_progress_func()
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
clutter_alpha_set_closure (ClutterAlpha *alpha,
|
||||||
|
GClosure *closure)
|
||||||
|
{
|
||||||
|
ClutterAlphaPrivate *priv;
|
||||||
|
|
||||||
|
g_return_if_fail (CLUTTER_IS_ALPHA (alpha));
|
||||||
|
g_return_if_fail (closure != NULL);
|
||||||
|
|
||||||
|
priv = alpha->priv;
|
||||||
|
|
||||||
|
clutter_alpha_set_closure_internal (alpha, closure);
|
||||||
|
|
||||||
|
priv->mode = CLUTTER_CUSTOM_MODE;
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (alpha), obj_props[PROP_MODE]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_alpha_set_func:
|
||||||
|
* @alpha: A #ClutterAlpha
|
||||||
|
* @func: A #ClutterAlphaFunc
|
||||||
|
* @data: user data to be passed to the alpha function, or %NULL
|
||||||
|
* @destroy: notify function used when disposing the alpha function
|
||||||
|
*
|
||||||
|
* Sets the #ClutterAlphaFunc function used to compute
|
||||||
|
* the alpha value at each frame of the #ClutterTimeline
|
||||||
|
* bound to @alpha.
|
||||||
|
*
|
||||||
|
* This function will not register @func as a global alpha function.
|
||||||
|
*
|
||||||
|
* Since: 0.2
|
||||||
|
*
|
||||||
|
* Deprecated: 1.12: Use clutter_timeline_set_progress_func()
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
clutter_alpha_set_func (ClutterAlpha *alpha,
|
||||||
|
ClutterAlphaFunc func,
|
||||||
|
gpointer data,
|
||||||
|
GDestroyNotify destroy)
|
||||||
|
{
|
||||||
|
ClutterAlphaPrivate *priv;
|
||||||
|
|
||||||
|
g_return_if_fail (CLUTTER_IS_ALPHA (alpha));
|
||||||
|
g_return_if_fail (func != NULL);
|
||||||
|
|
||||||
|
priv = alpha->priv;
|
||||||
|
|
||||||
|
if (priv->notify != NULL)
|
||||||
|
{
|
||||||
|
priv->notify (priv->user_data);
|
||||||
|
}
|
||||||
|
else if (priv->closure != NULL)
|
||||||
|
{
|
||||||
|
g_closure_unref (priv->closure);
|
||||||
|
priv->closure = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
priv->func = func;
|
||||||
|
priv->user_data = data;
|
||||||
|
priv->notify = destroy;
|
||||||
|
|
||||||
|
priv->mode = CLUTTER_CUSTOM_MODE;
|
||||||
|
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (alpha), obj_props[PROP_MODE]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_alpha_set_timeline:
|
||||||
|
* @alpha: A #ClutterAlpha
|
||||||
|
* @timeline: A #ClutterTimeline
|
||||||
|
*
|
||||||
|
* Binds @alpha to @timeline.
|
||||||
|
*
|
||||||
|
* Since: 0.2
|
||||||
|
*
|
||||||
|
* Deprecated: 1.12: Use #ClutterTimeline directly
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
clutter_alpha_set_timeline (ClutterAlpha *alpha,
|
||||||
|
ClutterTimeline *timeline)
|
||||||
|
{
|
||||||
|
ClutterAlphaPrivate *priv;
|
||||||
|
|
||||||
|
g_return_if_fail (CLUTTER_IS_ALPHA (alpha));
|
||||||
|
g_return_if_fail (timeline == NULL || CLUTTER_IS_TIMELINE (timeline));
|
||||||
|
|
||||||
|
priv = alpha->priv;
|
||||||
|
|
||||||
|
if (priv->timeline == timeline)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (priv->timeline)
|
||||||
|
{
|
||||||
|
g_signal_handlers_disconnect_by_func (priv->timeline,
|
||||||
|
timeline_new_frame_cb,
|
||||||
|
alpha);
|
||||||
|
|
||||||
|
g_object_unref (priv->timeline);
|
||||||
|
priv->timeline = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (timeline)
|
||||||
|
{
|
||||||
|
priv->timeline = g_object_ref (timeline);
|
||||||
|
|
||||||
|
g_signal_connect (priv->timeline, "new-frame",
|
||||||
|
G_CALLBACK (timeline_new_frame_cb),
|
||||||
|
alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (alpha), obj_props[PROP_TIMELINE]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_alpha_get_timeline:
|
||||||
|
* @alpha: A #ClutterAlpha
|
||||||
|
*
|
||||||
|
* Gets the #ClutterTimeline bound to @alpha.
|
||||||
|
*
|
||||||
|
* Return value: (transfer none): a #ClutterTimeline instance
|
||||||
|
*
|
||||||
|
* Since: 0.2
|
||||||
|
*
|
||||||
|
* Deprecated: 1.12: Use #ClutterTimeline directlry
|
||||||
|
*/
|
||||||
|
ClutterTimeline *
|
||||||
|
clutter_alpha_get_timeline (ClutterAlpha *alpha)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (CLUTTER_IS_ALPHA (alpha), NULL);
|
||||||
|
|
||||||
|
return alpha->priv->timeline;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_alpha_new:
|
||||||
|
*
|
||||||
|
* Creates a new #ClutterAlpha instance. You must set a function
|
||||||
|
* to compute the alpha value using clutter_alpha_set_func() and
|
||||||
|
* bind a #ClutterTimeline object to the #ClutterAlpha instance
|
||||||
|
* using clutter_alpha_set_timeline().
|
||||||
|
*
|
||||||
|
* Return value: the newly created empty #ClutterAlpha instance.
|
||||||
|
*
|
||||||
|
* Since: 0.2
|
||||||
|
*
|
||||||
|
* Deprecated: 1.12: Use #ClutterTimeline instead
|
||||||
|
*/
|
||||||
|
ClutterAlpha *
|
||||||
|
clutter_alpha_new (void)
|
||||||
|
{
|
||||||
|
return g_object_new (CLUTTER_TYPE_ALPHA, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_alpha_new_full:
|
||||||
|
* @timeline: #ClutterTimeline timeline
|
||||||
|
* @mode: animation mode
|
||||||
|
*
|
||||||
|
* Creates a new #ClutterAlpha instance and sets the timeline
|
||||||
|
* and animation mode.
|
||||||
|
*
|
||||||
|
* See also clutter_alpha_set_timeline() and clutter_alpha_set_mode().
|
||||||
|
*
|
||||||
|
* Return Value: the newly created #ClutterAlpha
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*
|
||||||
|
* Deprecated: 1.12: Use #ClutterTimeline instead
|
||||||
|
*/
|
||||||
|
ClutterAlpha *
|
||||||
|
clutter_alpha_new_full (ClutterTimeline *timeline,
|
||||||
|
gulong mode)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), NULL);
|
||||||
|
g_return_val_if_fail (mode != CLUTTER_ANIMATION_LAST, NULL);
|
||||||
|
|
||||||
|
return g_object_new (CLUTTER_TYPE_ALPHA,
|
||||||
|
"timeline", timeline,
|
||||||
|
"mode", mode,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_alpha_get_mode:
|
||||||
|
* @alpha: a #ClutterAlpha
|
||||||
|
*
|
||||||
|
* Retrieves the #ClutterAnimationMode used by @alpha.
|
||||||
|
*
|
||||||
|
* Return value: the animation mode
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*
|
||||||
|
* Deprecated: 1.12: Use #ClutterTimeline instead
|
||||||
|
*/
|
||||||
|
gulong
|
||||||
|
clutter_alpha_get_mode (ClutterAlpha *alpha)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (CLUTTER_IS_ALPHA (alpha), CLUTTER_CUSTOM_MODE);
|
||||||
|
|
||||||
|
return alpha->priv->mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef struct _AlphaData {
|
||||||
|
guint closure_set : 1;
|
||||||
|
|
||||||
|
ClutterAlphaFunc func;
|
||||||
|
gpointer data;
|
||||||
|
|
||||||
|
GClosure *closure;
|
||||||
|
} AlphaData;
|
||||||
|
|
||||||
|
static GPtrArray *clutter_alphas = NULL;
|
||||||
|
|
||||||
|
static gdouble
|
||||||
|
clutter_alpha_easing_func (ClutterAlpha *alpha,
|
||||||
|
gpointer data G_GNUC_UNUSED)
|
||||||
|
{
|
||||||
|
ClutterAlphaPrivate *priv = alpha->priv;
|
||||||
|
ClutterTimeline *timeline = priv->timeline;
|
||||||
|
gdouble t, d;
|
||||||
|
|
||||||
|
if (G_UNLIKELY (priv->timeline == NULL))
|
||||||
|
return 0.0;
|
||||||
|
|
||||||
|
t = clutter_timeline_get_elapsed_time (timeline);
|
||||||
|
d = clutter_timeline_get_duration (timeline);
|
||||||
|
|
||||||
|
return clutter_easing_for_mode (priv->mode, t, d);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_alpha_set_mode:
|
||||||
|
* @alpha: a #ClutterAlpha
|
||||||
|
* @mode: a #ClutterAnimationMode
|
||||||
|
*
|
||||||
|
* Sets the progress function of @alpha using the symbolic value
|
||||||
|
* of @mode, as taken by the #ClutterAnimationMode enumeration.
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*
|
||||||
|
* Deprecated: 1.12: Use #ClutterTimeline and
|
||||||
|
* clutter_timeline_set_progress_mode() instead
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
clutter_alpha_set_mode (ClutterAlpha *alpha,
|
||||||
|
gulong mode)
|
||||||
|
{
|
||||||
|
ClutterAlphaPrivate *priv;
|
||||||
|
|
||||||
|
g_return_if_fail (CLUTTER_IS_ALPHA (alpha));
|
||||||
|
g_return_if_fail (mode != CLUTTER_ANIMATION_LAST);
|
||||||
|
|
||||||
|
priv = alpha->priv;
|
||||||
|
|
||||||
|
if (mode == CLUTTER_CUSTOM_MODE)
|
||||||
|
{
|
||||||
|
priv->mode = mode;
|
||||||
|
}
|
||||||
|
else if (mode < CLUTTER_ANIMATION_LAST)
|
||||||
|
{
|
||||||
|
if (priv->mode == mode)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* sanity check to avoid getting an out of sync
|
||||||
|
* enum/function mapping
|
||||||
|
*/
|
||||||
|
g_assert (clutter_get_easing_func_for_mode (mode) != NULL);
|
||||||
|
|
||||||
|
clutter_alpha_set_closure_internal (alpha, NULL);
|
||||||
|
|
||||||
|
priv->mode = mode;
|
||||||
|
|
||||||
|
CLUTTER_NOTE (ANIMATION, "New easing mode '%s'[%lu]\n",
|
||||||
|
clutter_get_easing_name_for_mode (priv->mode),
|
||||||
|
priv->mode);
|
||||||
|
|
||||||
|
priv->func = clutter_alpha_easing_func;
|
||||||
|
priv->user_data = NULL;
|
||||||
|
priv->notify = NULL;
|
||||||
|
}
|
||||||
|
else if (mode > CLUTTER_ANIMATION_LAST)
|
||||||
|
{
|
||||||
|
AlphaData *alpha_data = NULL;
|
||||||
|
gulong real_index = 0;
|
||||||
|
|
||||||
|
if (priv->mode == mode)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (G_UNLIKELY (clutter_alphas == NULL))
|
||||||
|
{
|
||||||
|
g_warning ("No alpha functions defined for ClutterAlpha to use. ");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
real_index = mode - CLUTTER_ANIMATION_LAST - 1;
|
||||||
|
|
||||||
|
alpha_data = g_ptr_array_index (clutter_alphas, real_index);
|
||||||
|
if (G_UNLIKELY (alpha_data == NULL))
|
||||||
|
{
|
||||||
|
g_warning ("No alpha function registered for mode %lu.",
|
||||||
|
mode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (alpha_data->closure_set)
|
||||||
|
clutter_alpha_set_closure (alpha, alpha_data->closure);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
clutter_alpha_set_closure_internal (alpha, NULL);
|
||||||
|
|
||||||
|
priv->func = alpha_data->func;
|
||||||
|
priv->user_data = alpha_data->data;
|
||||||
|
priv->notify = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
priv->mode = mode;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
g_assert_not_reached ();
|
||||||
|
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (alpha), obj_props[PROP_MODE]);
|
||||||
|
}
|
||||||
138
clutter/clutter/deprecated/clutter-alpha.h
Normal file
138
clutter/clutter/deprecated/clutter-alpha.h
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
/*
|
||||||
|
* Clutter.
|
||||||
|
*
|
||||||
|
* An OpenGL based 'interactive canvas' library.
|
||||||
|
*
|
||||||
|
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||||
|
* Jorn Baayen <jorn@openedhand.com>
|
||||||
|
* Emmanuele Bassi <ebassi@openedhand.com>
|
||||||
|
* Tomas Frydrych <tf@openedhand.com>
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006, 2007, 2008 OpenedHand
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||||
|
#error "Only <clutter/clutter.h> can be included directly."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __CLUTTER_ALPHA_H__
|
||||||
|
#define __CLUTTER_ALPHA_H__
|
||||||
|
|
||||||
|
#include <clutter/clutter-timeline.h>
|
||||||
|
#include <clutter/clutter-types.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#define CLUTTER_TYPE_ALPHA (clutter_alpha_get_type ())
|
||||||
|
#define CLUTTER_ALPHA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ALPHA, ClutterAlpha))
|
||||||
|
#define CLUTTER_ALPHA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_ALPHA, ClutterAlphaClass))
|
||||||
|
#define CLUTTER_IS_ALPHA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ALPHA))
|
||||||
|
#define CLUTTER_IS_ALPHA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_ALPHA))
|
||||||
|
#define CLUTTER_ALPHA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ALPHA, ClutterAlphaClass))
|
||||||
|
|
||||||
|
typedef struct _ClutterAlphaClass ClutterAlphaClass;
|
||||||
|
typedef struct _ClutterAlphaPrivate ClutterAlphaPrivate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClutterAlphaFunc:
|
||||||
|
* @alpha: a #ClutterAlpha
|
||||||
|
* @user_data: user data passed to the function
|
||||||
|
*
|
||||||
|
* A function returning a value depending on the position of
|
||||||
|
* the #ClutterTimeline bound to @alpha.
|
||||||
|
*
|
||||||
|
* Return value: a floating point value
|
||||||
|
*
|
||||||
|
* Since: 0.2
|
||||||
|
*
|
||||||
|
* Deprecated: 1.12: Use #ClutterTimelineProgressFunc instead.
|
||||||
|
*/
|
||||||
|
typedef gdouble (*ClutterAlphaFunc) (ClutterAlpha *alpha,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClutterAlpha:
|
||||||
|
*
|
||||||
|
* #ClutterAlpha combines a #ClutterTimeline and a function.
|
||||||
|
* The contents of the #ClutterAlpha structure are private and should
|
||||||
|
* only be accessed using the provided API.
|
||||||
|
*
|
||||||
|
* Since: 0.2
|
||||||
|
*
|
||||||
|
* Deprecated: 1.12: Use #ClutterTimeline instead
|
||||||
|
*/
|
||||||
|
struct _ClutterAlpha
|
||||||
|
{
|
||||||
|
/*< private >*/
|
||||||
|
GInitiallyUnowned parent;
|
||||||
|
|
||||||
|
ClutterAlphaPrivate *priv;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClutterAlphaClass:
|
||||||
|
*
|
||||||
|
* Base class for #ClutterAlpha
|
||||||
|
*
|
||||||
|
* Since: 0.2
|
||||||
|
*
|
||||||
|
* Deprecated: 1.12: Use #ClutterTimeline instead
|
||||||
|
*/
|
||||||
|
struct _ClutterAlphaClass
|
||||||
|
{
|
||||||
|
/*< private >*/
|
||||||
|
GInitiallyUnownedClass parent_class;
|
||||||
|
|
||||||
|
void (*_clutter_alpha_1) (void);
|
||||||
|
void (*_clutter_alpha_2) (void);
|
||||||
|
void (*_clutter_alpha_3) (void);
|
||||||
|
void (*_clutter_alpha_4) (void);
|
||||||
|
void (*_clutter_alpha_5) (void);
|
||||||
|
};
|
||||||
|
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
GType clutter_alpha_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
ClutterAlpha * clutter_alpha_new (void);
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
ClutterAlpha * clutter_alpha_new_full (ClutterTimeline *timeline,
|
||||||
|
gulong mode);
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
gdouble clutter_alpha_get_alpha (ClutterAlpha *alpha);
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
void clutter_alpha_set_func (ClutterAlpha *alpha,
|
||||||
|
ClutterAlphaFunc func,
|
||||||
|
gpointer data,
|
||||||
|
GDestroyNotify destroy);
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
void clutter_alpha_set_closure (ClutterAlpha *alpha,
|
||||||
|
GClosure *closure);
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
void clutter_alpha_set_timeline (ClutterAlpha *alpha,
|
||||||
|
ClutterTimeline *timeline);
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
ClutterTimeline *clutter_alpha_get_timeline (ClutterAlpha *alpha);
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
void clutter_alpha_set_mode (ClutterAlpha *alpha,
|
||||||
|
gulong mode);
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
gulong clutter_alpha_get_mode (ClutterAlpha *alpha);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __CLUTTER_ALPHA_H__ */
|
||||||
1799
clutter/clutter/deprecated/clutter-animation.c
Normal file
1799
clutter/clutter/deprecated/clutter-animation.c
Normal file
File diff suppressed because it is too large
Load Diff
152
clutter/clutter/deprecated/clutter-animation.h
Normal file
152
clutter/clutter/deprecated/clutter-animation.h
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
/*
|
||||||
|
* Clutter.
|
||||||
|
*
|
||||||
|
* An OpenGL based 'interactive canvas' library.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2008 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_ANIMATION_H__
|
||||||
|
#define __CLUTTER_ANIMATION_H__
|
||||||
|
|
||||||
|
#include <clutter/clutter-types.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#define CLUTTER_TYPE_ANIMATION (clutter_animation_get_type ())
|
||||||
|
#define CLUTTER_ANIMATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ANIMATION, ClutterAnimation))
|
||||||
|
#define CLUTTER_IS_ANIMATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ANIMATION))
|
||||||
|
#define CLUTTER_ANIMATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_ANIMATION, ClutterAnimationClass))
|
||||||
|
#define CLUTTER_IS_ANIMATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_ANIMATION))
|
||||||
|
#define CLUTTER_ANIMATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ANIMATION, ClutterAnimationClass))
|
||||||
|
|
||||||
|
typedef struct _ClutterAnimationPrivate ClutterAnimationPrivate;
|
||||||
|
typedef struct _ClutterAnimationClass ClutterAnimationClass;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClutterAnimation:
|
||||||
|
*
|
||||||
|
* The #ClutterAnimation structure contains only private data and should
|
||||||
|
* be accessed using the provided functions.
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*
|
||||||
|
* Deprecated: 1.12: Use the implicit animation on #ClutterActor
|
||||||
|
*/
|
||||||
|
struct _ClutterAnimation
|
||||||
|
{
|
||||||
|
/*< private >*/
|
||||||
|
GObject parent_instance;
|
||||||
|
|
||||||
|
ClutterAnimationPrivate *priv;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClutterAnimationClass:
|
||||||
|
* @started: class handler for the #ClutterAnimation::started signal
|
||||||
|
* @completed: class handler for the #ClutterAnimation::completed signal
|
||||||
|
*
|
||||||
|
* The #ClutterAnimationClass structure contains only private data and
|
||||||
|
* should be accessed using the provided functions.
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*
|
||||||
|
* Deprecated: 1.12: Use the implicit animation on #ClutterActor
|
||||||
|
*/
|
||||||
|
struct _ClutterAnimationClass
|
||||||
|
{
|
||||||
|
/*< private >*/
|
||||||
|
GObjectClass parent_class;
|
||||||
|
|
||||||
|
/*< public >*/
|
||||||
|
void (* started) (ClutterAnimation *animation);
|
||||||
|
void (* completed) (ClutterAnimation *animation);
|
||||||
|
|
||||||
|
/*< private >*/
|
||||||
|
/* padding for future expansion */
|
||||||
|
void (*_clutter_reserved1) (void);
|
||||||
|
void (*_clutter_reserved2) (void);
|
||||||
|
void (*_clutter_reserved3) (void);
|
||||||
|
void (*_clutter_reserved4) (void);
|
||||||
|
void (*_clutter_reserved5) (void);
|
||||||
|
void (*_clutter_reserved6) (void);
|
||||||
|
void (*_clutter_reserved7) (void);
|
||||||
|
void (*_clutter_reserved8) (void);
|
||||||
|
};
|
||||||
|
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
GType clutter_animation_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
CLUTTER_DEPRECATED_FOR(clutter_property_transition_new)
|
||||||
|
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_timeline_set_progress_mode)
|
||||||
|
void clutter_animation_set_mode (ClutterAnimation *animation,
|
||||||
|
gulong mode);
|
||||||
|
CLUTTER_DEPRECATED_FOR(clutter_timeline_get_progress_mode)
|
||||||
|
gulong clutter_animation_get_mode (ClutterAnimation *animation);
|
||||||
|
CLUTTER_DEPRECATED_FOR(clutter_timeline_set_duration)
|
||||||
|
void clutter_animation_set_duration (ClutterAnimation *animation,
|
||||||
|
guint msecs);
|
||||||
|
CLUTTER_DEPRECATED_FOR(clutter_timeline_get_duration)
|
||||||
|
guint clutter_animation_get_duration (ClutterAnimation *animation);
|
||||||
|
CLUTTER_DEPRECATED_FOR(clutter_timeline_set_repeat_count)
|
||||||
|
void clutter_animation_set_loop (ClutterAnimation *animation,
|
||||||
|
gboolean loop);
|
||||||
|
CLUTTER_DEPRECATED_FOR(clutter_timeline_get_repeat_count)
|
||||||
|
gboolean clutter_animation_get_loop (ClutterAnimation *animation);
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
void clutter_animation_set_timeline (ClutterAnimation *animation,
|
||||||
|
ClutterTimeline *timeline);
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
ClutterTimeline * clutter_animation_get_timeline (ClutterAnimation *animation);
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
gboolean clutter_animation_has_property (ClutterAnimation *animation,
|
||||||
|
const gchar *property_name);
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
ClutterInterval * clutter_animation_get_interval (ClutterAnimation *animation,
|
||||||
|
const gchar *property_name);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ClutterActor API
|
||||||
|
*/
|
||||||
|
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
ClutterAnimation * clutter_actor_animate (ClutterActor *actor,
|
||||||
|
gulong mode,
|
||||||
|
guint duration,
|
||||||
|
const gchar *first_property_name,
|
||||||
|
...) G_GNUC_NULL_TERMINATED;
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
ClutterAnimation * clutter_actor_animate_with_timeline (ClutterActor *actor,
|
||||||
|
gulong mode,
|
||||||
|
ClutterTimeline *timeline,
|
||||||
|
const gchar *first_property_name,
|
||||||
|
...) G_GNUC_NULL_TERMINATED;
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __CLUTTER_ANIMATION_DEPRECATED_H__ */
|
||||||
@@ -333,20 +333,21 @@ clutter_group_real_get_preferred_height (ClutterActor *actor,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_group_real_allocate (ClutterActor *actor,
|
clutter_group_real_allocate (ClutterActor *actor,
|
||||||
const ClutterActorBox *allocation)
|
const ClutterActorBox *allocation,
|
||||||
|
ClutterAllocationFlags flags)
|
||||||
{
|
{
|
||||||
ClutterGroupPrivate *priv = CLUTTER_GROUP (actor)->priv;
|
ClutterGroupPrivate *priv = CLUTTER_GROUP (actor)->priv;
|
||||||
ClutterActorClass *klass;
|
ClutterActorClass *klass;
|
||||||
|
|
||||||
klass = CLUTTER_ACTOR_CLASS (clutter_group_parent_class);
|
klass = CLUTTER_ACTOR_CLASS (clutter_group_parent_class);
|
||||||
klass->allocate (actor, allocation);
|
klass->allocate (actor, allocation, flags);
|
||||||
|
|
||||||
if (priv->children == NULL)
|
if (priv->children == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
clutter_layout_manager_allocate (priv->layout,
|
clutter_layout_manager_allocate (priv->layout,
|
||||||
CLUTTER_CONTAINER (actor),
|
CLUTTER_CONTAINER (actor),
|
||||||
allocation);
|
allocation, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
1760
clutter/clutter/deprecated/clutter-state.c
Normal file
1760
clutter/clutter/deprecated/clutter-state.c
Normal file
File diff suppressed because it is too large
Load Diff
147
clutter/clutter/deprecated/clutter-state.h
Normal file
147
clutter/clutter/deprecated/clutter-state.h
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
/*
|
||||||
|
* Clutter.
|
||||||
|
*
|
||||||
|
* An OpenGL based 'interactive canvas' library.
|
||||||
|
*
|
||||||
|
* Authored By Øyvind Kolås <pippin@linux.intel.com>
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __CLUTTER_STATE_H__
|
||||||
|
#define __CLUTTER_STATE_H__
|
||||||
|
|
||||||
|
#include <clutter/clutter-types.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#define CLUTTER_TYPE_STATE_KEY (clutter_state_key_get_type ())
|
||||||
|
#define CLUTTER_TYPE_STATE (clutter_state_get_type ())
|
||||||
|
#define CLUTTER_STATE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_STATE, ClutterState))
|
||||||
|
#define CLUTTER_STATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_STATE, ClutterStateClass))
|
||||||
|
#define CLUTTER_IS_STATE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_STATE))
|
||||||
|
#define CLUTTER_IS_STATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_STATE))
|
||||||
|
#define CLUTTER_STATE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_STATE, ClutterStateClass))
|
||||||
|
|
||||||
|
typedef struct _ClutterStatePrivate ClutterStatePrivate;
|
||||||
|
typedef struct _ClutterStateClass ClutterStateClass;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClutterStateKey:
|
||||||
|
*
|
||||||
|
* #ClutterStateKey is an opaque structure whose
|
||||||
|
* members cannot be accessed directly
|
||||||
|
*
|
||||||
|
* Since: 1.4
|
||||||
|
*/
|
||||||
|
typedef struct _ClutterStateKey ClutterStateKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClutterState:
|
||||||
|
*
|
||||||
|
* The #ClutterState structure contains only
|
||||||
|
* private data and should be accessed using the provided API
|
||||||
|
*
|
||||||
|
* Since: 1.4
|
||||||
|
*/
|
||||||
|
struct _ClutterState
|
||||||
|
{
|
||||||
|
/*< private >*/
|
||||||
|
GObject parent;
|
||||||
|
ClutterStatePrivate *priv;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClutterStateClass:
|
||||||
|
* @completed: class handler for the #ClutterState::completed signal
|
||||||
|
*
|
||||||
|
* The #ClutterStateClass structure contains
|
||||||
|
* only private data
|
||||||
|
*
|
||||||
|
* Since: 1.4
|
||||||
|
*
|
||||||
|
* Deprecated: 1.12
|
||||||
|
*/
|
||||||
|
struct _ClutterStateClass
|
||||||
|
{
|
||||||
|
/*< private >*/
|
||||||
|
GObjectClass parent_class;
|
||||||
|
|
||||||
|
/*< public >*/
|
||||||
|
void (* completed) (ClutterState *state);
|
||||||
|
|
||||||
|
/*< private >*/
|
||||||
|
/* padding for future expansion */
|
||||||
|
gpointer _padding_dummy[8];
|
||||||
|
};
|
||||||
|
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
GType clutter_state_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
ClutterState *clutter_state_new (void);
|
||||||
|
|
||||||
|
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
ClutterTimeline * clutter_state_set_state (ClutterState *state,
|
||||||
|
const gchar *target_state_name);
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
ClutterTimeline * clutter_state_warp_to_state (ClutterState *state,
|
||||||
|
const gchar *target_state_name);
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
ClutterState * clutter_state_set_key (ClutterState *state,
|
||||||
|
const gchar *source_state_name,
|
||||||
|
const gchar *target_state_name,
|
||||||
|
GObject *object,
|
||||||
|
const gchar *property_name,
|
||||||
|
guint mode,
|
||||||
|
const GValue *value,
|
||||||
|
gdouble pre_delay,
|
||||||
|
gdouble post_delay);
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
void clutter_state_set_duration (ClutterState *state,
|
||||||
|
const gchar *source_state_name,
|
||||||
|
const gchar *target_state_name,
|
||||||
|
guint duration);
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
guint clutter_state_get_duration (ClutterState *state,
|
||||||
|
const gchar *source_state_name,
|
||||||
|
const gchar *target_state_name);
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
void clutter_state_set (ClutterState *state,
|
||||||
|
const gchar *source_state_name,
|
||||||
|
const gchar *target_state_name,
|
||||||
|
gpointer first_object,
|
||||||
|
const gchar *first_property_name,
|
||||||
|
gulong first_mode,
|
||||||
|
...) G_GNUC_NULL_TERMINATED;
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
GList * clutter_state_get_states (ClutterState *state);
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
const gchar * clutter_state_get_state (ClutterState *state);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ClutterStateKey
|
||||||
|
*/
|
||||||
|
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
GType clutter_state_key_get_type (void) G_GNUC_CONST;
|
||||||
|
CLUTTER_DEPRECATED
|
||||||
|
GType clutter_state_key_get_property_type (const ClutterStateKey *key);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __CLUTTER_STATE_H__ */
|
||||||
@@ -114,7 +114,6 @@ clutter_sources = [
|
|||||||
'clutter-constraint.c',
|
'clutter-constraint.c',
|
||||||
'clutter-container.c',
|
'clutter-container.c',
|
||||||
'clutter-content.c',
|
'clutter-content.c',
|
||||||
'clutter-damage-history.c',
|
|
||||||
'clutter-deform-effect.c',
|
'clutter-deform-effect.c',
|
||||||
'clutter-desaturate-effect.c',
|
'clutter-desaturate-effect.c',
|
||||||
'clutter-effect.c',
|
'clutter-effect.c',
|
||||||
@@ -186,7 +185,6 @@ clutter_private_headers = [
|
|||||||
'clutter-bezier.h',
|
'clutter-bezier.h',
|
||||||
'clutter-constraint-private.h',
|
'clutter-constraint-private.h',
|
||||||
'clutter-content-private.h',
|
'clutter-content-private.h',
|
||||||
'clutter-damage-history.h',
|
|
||||||
'clutter-debug.h',
|
'clutter-debug.h',
|
||||||
'clutter-easing.h',
|
'clutter-easing.h',
|
||||||
'clutter-effect-private.h',
|
'clutter-effect-private.h',
|
||||||
@@ -221,18 +219,24 @@ clutter_nonintrospected_sources = [
|
|||||||
|
|
||||||
clutter_deprecated_headers = [
|
clutter_deprecated_headers = [
|
||||||
'deprecated/clutter-actor.h',
|
'deprecated/clutter-actor.h',
|
||||||
|
'deprecated/clutter-alpha.h',
|
||||||
|
'deprecated/clutter-animation.h',
|
||||||
'deprecated/clutter-box.h',
|
'deprecated/clutter-box.h',
|
||||||
'deprecated/clutter-container.h',
|
'deprecated/clutter-container.h',
|
||||||
'deprecated/clutter-group.h',
|
'deprecated/clutter-group.h',
|
||||||
'deprecated/clutter-rectangle.h',
|
'deprecated/clutter-rectangle.h',
|
||||||
'deprecated/clutter-stage.h',
|
'deprecated/clutter-stage.h',
|
||||||
|
'deprecated/clutter-state.h',
|
||||||
'deprecated/clutter-timeline.h',
|
'deprecated/clutter-timeline.h',
|
||||||
]
|
]
|
||||||
|
|
||||||
clutter_deprecated_sources = [
|
clutter_deprecated_sources = [
|
||||||
|
'deprecated/clutter-alpha.c',
|
||||||
|
'deprecated/clutter-animation.c',
|
||||||
'deprecated/clutter-box.c',
|
'deprecated/clutter-box.c',
|
||||||
'deprecated/clutter-group.c',
|
'deprecated/clutter-group.c',
|
||||||
'deprecated/clutter-rectangle.c',
|
'deprecated/clutter-rectangle.c',
|
||||||
|
'deprecated/clutter-state.c',
|
||||||
]
|
]
|
||||||
|
|
||||||
clutter_backend_sources = []
|
clutter_backend_sources = []
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ _cogl_blit_framebuffer_begin (CoglBlitData *data)
|
|||||||
supported. */
|
supported. */
|
||||||
if ((_cogl_texture_get_format (data->src_tex) & COGL_PREMULT_BIT) !=
|
if ((_cogl_texture_get_format (data->src_tex) & COGL_PREMULT_BIT) !=
|
||||||
(_cogl_texture_get_format (data->dst_tex) & COGL_PREMULT_BIT) ||
|
(_cogl_texture_get_format (data->dst_tex) & COGL_PREMULT_BIT) ||
|
||||||
!cogl_has_feature (ctx, COGL_FEATURE_ID_BLIT_FRAMEBUFFER))
|
!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
dst_offscreen = _cogl_offscreen_new_with_texture_full
|
dst_offscreen = _cogl_offscreen_new_with_texture_full
|
||||||
|
|||||||
@@ -193,8 +193,6 @@ cogl_is_context (void *object);
|
|||||||
* expected to return age values other than 0.
|
* expected to return age values other than 0.
|
||||||
* @COGL_FEATURE_ID_PRESENTATION_TIME: Whether frame presentation
|
* @COGL_FEATURE_ID_PRESENTATION_TIME: Whether frame presentation
|
||||||
* time stamps will be recorded in #CoglFrameInfo objects.
|
* time stamps will be recorded in #CoglFrameInfo objects.
|
||||||
* @COGL_FEATURE_ID_BLIT_FRAMEBUFFER: Whether blitting using
|
|
||||||
* cogl_blit_framebuffer() is supported.
|
|
||||||
*
|
*
|
||||||
* All the capabilities that can vary between different GPUs supported
|
* All the capabilities that can vary between different GPUs supported
|
||||||
* by Cogl. Applications that depend on any of these features should explicitly
|
* by Cogl. Applications that depend on any of these features should explicitly
|
||||||
@@ -213,7 +211,6 @@ typedef enum _CoglFeatureID
|
|||||||
COGL_FEATURE_ID_TEXTURE_RG,
|
COGL_FEATURE_ID_TEXTURE_RG,
|
||||||
COGL_FEATURE_ID_BUFFER_AGE,
|
COGL_FEATURE_ID_BUFFER_AGE,
|
||||||
COGL_FEATURE_ID_TEXTURE_EGL_IMAGE_EXTERNAL,
|
COGL_FEATURE_ID_TEXTURE_EGL_IMAGE_EXTERNAL,
|
||||||
COGL_FEATURE_ID_BLIT_FRAMEBUFFER,
|
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
_COGL_N_FEATURE_IDS /*< skip >*/
|
_COGL_N_FEATURE_IDS /*< skip >*/
|
||||||
|
|||||||
@@ -34,22 +34,12 @@
|
|||||||
#include "cogl-dma-buf-handle.h"
|
#include "cogl-dma-buf-handle.h"
|
||||||
#include "cogl-object.h"
|
#include "cogl-object.h"
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <gio/gio.h>
|
|
||||||
#include <linux/dma-buf.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#include <sys/mman.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
struct _CoglDmaBufHandle
|
struct _CoglDmaBufHandle
|
||||||
{
|
{
|
||||||
CoglFramebuffer *framebuffer;
|
CoglFramebuffer *framebuffer;
|
||||||
int dmabuf_fd;
|
int dmabuf_fd;
|
||||||
int width;
|
|
||||||
int height;
|
|
||||||
int stride;
|
|
||||||
int offset;
|
|
||||||
int bpp;
|
|
||||||
gpointer user_data;
|
gpointer user_data;
|
||||||
GDestroyNotify destroy_func;
|
GDestroyNotify destroy_func;
|
||||||
};
|
};
|
||||||
@@ -57,11 +47,6 @@ struct _CoglDmaBufHandle
|
|||||||
CoglDmaBufHandle *
|
CoglDmaBufHandle *
|
||||||
cogl_dma_buf_handle_new (CoglFramebuffer *framebuffer,
|
cogl_dma_buf_handle_new (CoglFramebuffer *framebuffer,
|
||||||
int dmabuf_fd,
|
int dmabuf_fd,
|
||||||
int width,
|
|
||||||
int height,
|
|
||||||
int stride,
|
|
||||||
int offset,
|
|
||||||
int bpp,
|
|
||||||
gpointer user_data,
|
gpointer user_data,
|
||||||
GDestroyNotify destroy_func)
|
GDestroyNotify destroy_func)
|
||||||
{
|
{
|
||||||
@@ -76,12 +61,6 @@ cogl_dma_buf_handle_new (CoglFramebuffer *framebuffer,
|
|||||||
dmabuf_handle->user_data = user_data;
|
dmabuf_handle->user_data = user_data;
|
||||||
dmabuf_handle->destroy_func = destroy_func;
|
dmabuf_handle->destroy_func = destroy_func;
|
||||||
|
|
||||||
dmabuf_handle->width = width;
|
|
||||||
dmabuf_handle->height = height;
|
|
||||||
dmabuf_handle->stride = stride;
|
|
||||||
dmabuf_handle->offset = offset;
|
|
||||||
dmabuf_handle->bpp = bpp;
|
|
||||||
|
|
||||||
return dmabuf_handle;
|
return dmabuf_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,93 +80,6 @@ cogl_dma_buf_handle_free (CoglDmaBufHandle *dmabuf_handle)
|
|||||||
g_free (dmabuf_handle);
|
g_free (dmabuf_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
sync_read (CoglDmaBufHandle *dmabuf_handle,
|
|
||||||
uint64_t start_or_end,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
struct dma_buf_sync sync = { 0 };
|
|
||||||
|
|
||||||
sync.flags = start_or_end | DMA_BUF_SYNC_READ;
|
|
||||||
|
|
||||||
while (TRUE)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = ioctl (dmabuf_handle->dmabuf_fd, DMA_BUF_IOCTL_SYNC, &sync);
|
|
||||||
if (ret == -1 && errno == EINTR)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else if (ret == -1)
|
|
||||||
{
|
|
||||||
g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),
|
|
||||||
"ioctl: %s", g_strerror (errno));
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
cogl_dma_buf_handle_sync_read_start (CoglDmaBufHandle *dmabuf_handle,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
return sync_read (dmabuf_handle, DMA_BUF_SYNC_START, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
cogl_dma_buf_handle_sync_read_end (CoglDmaBufHandle *dmabuf_handle,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
return sync_read (dmabuf_handle, DMA_BUF_SYNC_END, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
gpointer
|
|
||||||
cogl_dma_buf_handle_mmap (CoglDmaBufHandle *dmabuf_handle,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
gpointer data;
|
|
||||||
|
|
||||||
size = dmabuf_handle->height * dmabuf_handle->stride;
|
|
||||||
|
|
||||||
data = mmap (NULL, size, PROT_READ, MAP_PRIVATE,
|
|
||||||
dmabuf_handle->dmabuf_fd,
|
|
||||||
dmabuf_handle->offset);
|
|
||||||
if (data == MAP_FAILED)
|
|
||||||
{
|
|
||||||
g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),
|
|
||||||
"mmap failed: %s", g_strerror (errno));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
cogl_dma_buf_handle_munmap (CoglDmaBufHandle *dmabuf_handle,
|
|
||||||
gpointer data,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
size_t size;
|
|
||||||
|
|
||||||
size = dmabuf_handle->height * dmabuf_handle->stride;
|
|
||||||
if (munmap (data, size) != 0)
|
|
||||||
{
|
|
||||||
g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),
|
|
||||||
"munmap failed: %s", g_strerror (errno));
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
CoglFramebuffer *
|
CoglFramebuffer *
|
||||||
cogl_dma_buf_handle_get_framebuffer (CoglDmaBufHandle *dmabuf_handle)
|
cogl_dma_buf_handle_get_framebuffer (CoglDmaBufHandle *dmabuf_handle)
|
||||||
{
|
{
|
||||||
@@ -200,32 +92,3 @@ cogl_dma_buf_handle_get_fd (CoglDmaBufHandle *dmabuf_handle)
|
|||||||
return dmabuf_handle->dmabuf_fd;
|
return dmabuf_handle->dmabuf_fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
cogl_dma_buf_handle_get_width (CoglDmaBufHandle *dmabuf_handle)
|
|
||||||
{
|
|
||||||
return dmabuf_handle->width;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
cogl_dma_buf_handle_get_height (CoglDmaBufHandle *dmabuf_handle)
|
|
||||||
{
|
|
||||||
return dmabuf_handle->height;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
cogl_dma_buf_handle_get_stride (CoglDmaBufHandle *dmabuf_handle)
|
|
||||||
{
|
|
||||||
return dmabuf_handle->stride;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
cogl_dma_buf_handle_get_offset (CoglDmaBufHandle *dmabuf_handle)
|
|
||||||
{
|
|
||||||
return dmabuf_handle->offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
cogl_dma_buf_handle_get_bpp (CoglDmaBufHandle *dmabuf_handle)
|
|
||||||
{
|
|
||||||
return dmabuf_handle->bpp;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -46,12 +46,7 @@
|
|||||||
COGL_EXPORT CoglDmaBufHandle *
|
COGL_EXPORT CoglDmaBufHandle *
|
||||||
cogl_dma_buf_handle_new (CoglFramebuffer *framebuffer,
|
cogl_dma_buf_handle_new (CoglFramebuffer *framebuffer,
|
||||||
int dmabuf_fd,
|
int dmabuf_fd,
|
||||||
int width,
|
gpointer data,
|
||||||
int height,
|
|
||||||
int stride,
|
|
||||||
int offset,
|
|
||||||
int bpp,
|
|
||||||
gpointer user_data,
|
|
||||||
GDestroyNotify destroy_func);
|
GDestroyNotify destroy_func);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -63,23 +58,6 @@ cogl_dma_buf_handle_new (CoglFramebuffer *framebuffer,
|
|||||||
COGL_EXPORT void
|
COGL_EXPORT void
|
||||||
cogl_dma_buf_handle_free (CoglDmaBufHandle *dmabuf_handle);
|
cogl_dma_buf_handle_free (CoglDmaBufHandle *dmabuf_handle);
|
||||||
|
|
||||||
COGL_EXPORT gboolean
|
|
||||||
cogl_dma_buf_handle_sync_read_start (CoglDmaBufHandle *dmabuf_handle,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
COGL_EXPORT gboolean
|
|
||||||
cogl_dma_buf_handle_sync_read_end (CoglDmaBufHandle *dmabuf_handle,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
COGL_EXPORT gpointer
|
|
||||||
cogl_dma_buf_handle_mmap (CoglDmaBufHandle *dmabuf_handle,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
COGL_EXPORT gboolean
|
|
||||||
cogl_dma_buf_handle_munmap (CoglDmaBufHandle *dmabuf_handle,
|
|
||||||
gpointer data,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_dma_buf_handle_get_framebuffer: (skip)
|
* cogl_dma_buf_handle_get_framebuffer: (skip)
|
||||||
*
|
*
|
||||||
@@ -101,44 +79,5 @@ cogl_dma_buf_handle_get_framebuffer (CoglDmaBufHandle *dmabuf_handle);
|
|||||||
COGL_EXPORT int
|
COGL_EXPORT int
|
||||||
cogl_dma_buf_handle_get_fd (CoglDmaBufHandle *dmabuf_handle);
|
cogl_dma_buf_handle_get_fd (CoglDmaBufHandle *dmabuf_handle);
|
||||||
|
|
||||||
/**
|
|
||||||
* cogl_dmabuf_handle_get_width: (skip)
|
|
||||||
*
|
|
||||||
* Returns: the buffer width
|
|
||||||
*/
|
|
||||||
COGL_EXPORT int
|
|
||||||
cogl_dma_buf_handle_get_width (CoglDmaBufHandle *dmabuf_handle);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* cogl_dmabuf_handle_get_height: (skip)
|
|
||||||
*
|
|
||||||
* Returns: the buffer height
|
|
||||||
*/
|
|
||||||
COGL_EXPORT int
|
|
||||||
cogl_dma_buf_handle_get_height (CoglDmaBufHandle *dmabuf_handle);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* cogl_dmabuf_handle_get_stride: (skip)
|
|
||||||
*
|
|
||||||
* Returns: the buffer stride
|
|
||||||
*/
|
|
||||||
COGL_EXPORT int
|
|
||||||
cogl_dma_buf_handle_get_stride (CoglDmaBufHandle *dmabuf_handle);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* cogl_dmabuf_handle_get_offset: (skip)
|
|
||||||
*
|
|
||||||
* Returns: the buffer offset
|
|
||||||
*/
|
|
||||||
COGL_EXPORT int
|
|
||||||
cogl_dma_buf_handle_get_offset (CoglDmaBufHandle *dmabuf_handle);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* cogl_dmabuf_handle_get_bpp: (skip)
|
|
||||||
*
|
|
||||||
* Returns: the number of bytes per pixel
|
|
||||||
*/
|
|
||||||
COGL_EXPORT int
|
|
||||||
cogl_dma_buf_handle_get_bpp (CoglDmaBufHandle *dmabuf_handle);
|
|
||||||
|
|
||||||
#endif /* __COGL_DMA_BUF_HANDLE_H__ */
|
#endif /* __COGL_DMA_BUF_HANDLE_H__ */
|
||||||
|
|||||||
@@ -1292,7 +1292,7 @@ cogl_blit_framebuffer (CoglFramebuffer *src,
|
|||||||
int src_x1, src_y1, src_x2, src_y2;
|
int src_x1, src_y1, src_x2, src_y2;
|
||||||
int dst_x1, dst_y1, dst_x2, dst_y2;
|
int dst_x1, dst_y1, dst_x2, dst_y2;
|
||||||
|
|
||||||
if (!cogl_has_feature (ctx, COGL_FEATURE_ID_BLIT_FRAMEBUFFER))
|
if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER))
|
||||||
{
|
{
|
||||||
g_set_error_literal (error, COGL_SYSTEM_ERROR,
|
g_set_error_literal (error, COGL_SYSTEM_ERROR,
|
||||||
COGL_SYSTEM_ERROR_UNSUPPORTED,
|
COGL_SYSTEM_ERROR_UNSUPPORTED,
|
||||||
|
|||||||
@@ -1509,7 +1509,7 @@ cogl_is_framebuffer (void *object);
|
|||||||
*
|
*
|
||||||
* This blits a region of the color buffer of the source buffer
|
* This blits a region of the color buffer of the source buffer
|
||||||
* to the destination buffer. This function should only be
|
* to the destination buffer. This function should only be
|
||||||
* called if the COGL_FEATURE_ID_BLIT_FRAMEBUFFER feature is
|
* called if the COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER feature is
|
||||||
* advertised.
|
* advertised.
|
||||||
*
|
*
|
||||||
* The source and destination rectangles are defined in offscreen
|
* The source and destination rectangles are defined in offscreen
|
||||||
|
|||||||
@@ -1361,17 +1361,6 @@ cogl_pipeline_set_layer_filters (CoglPipeline *pipeline,
|
|||||||
sampler_state);
|
sampler_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
cogl_pipeline_set_layer_max_mipmap_level (CoglPipeline *pipeline,
|
|
||||||
int layer,
|
|
||||||
int max_level)
|
|
||||||
{
|
|
||||||
CoglTexture *texture = cogl_pipeline_get_layer_texture (pipeline, layer);
|
|
||||||
|
|
||||||
if (texture != NULL)
|
|
||||||
cogl_texture_set_max_level (texture, max_level);
|
|
||||||
}
|
|
||||||
|
|
||||||
const CoglSamplerCacheEntry *
|
const CoglSamplerCacheEntry *
|
||||||
_cogl_pipeline_layer_get_sampler_state (CoglPipelineLayer *layer)
|
_cogl_pipeline_layer_get_sampler_state (CoglPipelineLayer *layer)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -568,11 +568,6 @@ cogl_pipeline_add_layer_snippet (CoglPipeline *pipeline,
|
|||||||
int layer,
|
int layer,
|
||||||
CoglSnippet *snippet);
|
CoglSnippet *snippet);
|
||||||
|
|
||||||
COGL_EXPORT void
|
|
||||||
cogl_pipeline_set_layer_max_mipmap_level (CoglPipeline *pipeline,
|
|
||||||
int layer,
|
|
||||||
int max_level);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __COGL_PIPELINE_LAYER_STATE_H__ */
|
#endif /* __COGL_PIPELINE_LAYER_STATE_H__ */
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ typedef enum
|
|||||||
{
|
{
|
||||||
COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE,
|
COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE,
|
||||||
COGL_PRIVATE_FEATURE_MESA_PACK_INVERT,
|
COGL_PRIVATE_FEATURE_MESA_PACK_INVERT,
|
||||||
|
COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER,
|
||||||
COGL_PRIVATE_FEATURE_PBOS,
|
COGL_PRIVATE_FEATURE_PBOS,
|
||||||
COGL_PRIVATE_FEATURE_EXT_PACKED_DEPTH_STENCIL,
|
COGL_PRIVATE_FEATURE_EXT_PACKED_DEPTH_STENCIL,
|
||||||
COGL_PRIVATE_FEATURE_OES_PACKED_DEPTH_STENCIL,
|
COGL_PRIVATE_FEATURE_OES_PACKED_DEPTH_STENCIL,
|
||||||
|
|||||||
@@ -204,8 +204,7 @@ struct _CoglTexture
|
|||||||
CoglContext *context;
|
CoglContext *context;
|
||||||
CoglTextureLoader *loader;
|
CoglTextureLoader *loader;
|
||||||
GList *framebuffers;
|
GList *framebuffers;
|
||||||
int max_level_set;
|
int max_level;
|
||||||
int max_level_requested;
|
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
gboolean allocated;
|
gboolean allocated;
|
||||||
@@ -378,10 +377,6 @@ _cogl_texture_needs_premult_conversion (CoglPixelFormat src_format,
|
|||||||
int
|
int
|
||||||
_cogl_texture_get_n_levels (CoglTexture *texture);
|
_cogl_texture_get_n_levels (CoglTexture *texture);
|
||||||
|
|
||||||
void
|
|
||||||
cogl_texture_set_max_level (CoglTexture *texture,
|
|
||||||
int max_level);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_texture_get_level_size (CoglTexture *texture,
|
_cogl_texture_get_level_size (CoglTexture *texture,
|
||||||
int level,
|
int level,
|
||||||
|
|||||||
@@ -115,8 +115,7 @@ _cogl_texture_init (CoglTexture *texture,
|
|||||||
const CoglTextureVtable *vtable)
|
const CoglTextureVtable *vtable)
|
||||||
{
|
{
|
||||||
texture->context = context;
|
texture->context = context;
|
||||||
texture->max_level_set = 0;
|
texture->max_level = 0;
|
||||||
texture->max_level_requested = 1000; /* OpenGL default GL_TEXTURE_MAX_LEVEL */
|
|
||||||
texture->width = width;
|
texture->width = width;
|
||||||
texture->height = height;
|
texture->height = height;
|
||||||
texture->allocated = FALSE;
|
texture->allocated = FALSE;
|
||||||
@@ -230,16 +229,8 @@ _cogl_texture_get_n_levels (CoglTexture *texture)
|
|||||||
int width = cogl_texture_get_width (texture);
|
int width = cogl_texture_get_width (texture);
|
||||||
int height = cogl_texture_get_height (texture);
|
int height = cogl_texture_get_height (texture);
|
||||||
int max_dimension = MAX (width, height);
|
int max_dimension = MAX (width, height);
|
||||||
int n_levels = _cogl_util_fls (max_dimension);
|
|
||||||
|
|
||||||
return MIN (n_levels, texture->max_level_requested + 1);
|
return _cogl_util_fls (max_dimension);
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
cogl_texture_set_max_level (CoglTexture *texture,
|
|
||||||
int max_level)
|
|
||||||
{
|
|
||||||
texture->max_level_requested = max_level;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -388,8 +388,8 @@ _cogl_framebuffer_gl_flush_state (CoglFramebuffer *draw_buffer,
|
|||||||
{
|
{
|
||||||
/* NB: Currently we only take advantage of binding separate
|
/* NB: Currently we only take advantage of binding separate
|
||||||
* read/write buffers for framebuffer blit purposes. */
|
* read/write buffers for framebuffer blit purposes. */
|
||||||
g_return_if_fail (cogl_has_feature
|
g_return_if_fail (_cogl_has_private_feature
|
||||||
(ctx, COGL_FEATURE_ID_BLIT_FRAMEBUFFER));
|
(ctx, COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER));
|
||||||
|
|
||||||
_cogl_framebuffer_gl_bind (draw_buffer, GL_DRAW_FRAMEBUFFER);
|
_cogl_framebuffer_gl_bind (draw_buffer, GL_DRAW_FRAMEBUFFER);
|
||||||
_cogl_framebuffer_gl_bind (read_buffer, GL_READ_FRAMEBUFFER);
|
_cogl_framebuffer_gl_bind (read_buffer, GL_READ_FRAMEBUFFER);
|
||||||
|
|||||||
@@ -567,9 +567,6 @@ _cogl_texture_2d_gl_copy_from_bitmap (CoglTexture2D *tex_2d,
|
|||||||
&gl_format,
|
&gl_format,
|
||||||
&gl_type);
|
&gl_type);
|
||||||
|
|
||||||
if (tex->max_level_set < level)
|
|
||||||
cogl_texture_gl_set_max_level (tex, level);
|
|
||||||
|
|
||||||
status = ctx->texture_driver->upload_subregion_to_gl (ctx,
|
status = ctx->texture_driver->upload_subregion_to_gl (ctx,
|
||||||
tex,
|
tex,
|
||||||
src_x, src_y,
|
src_x, src_y,
|
||||||
@@ -583,6 +580,8 @@ _cogl_texture_2d_gl_copy_from_bitmap (CoglTexture2D *tex_2d,
|
|||||||
|
|
||||||
cogl_object_unref (upload_bmp);
|
cogl_object_unref (upload_bmp);
|
||||||
|
|
||||||
|
_cogl_texture_gl_maybe_update_max_level (tex, level);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ _cogl_texture_gl_flush_legacy_texobj_filters (CoglTexture *texture,
|
|||||||
unsigned int mag_filter);
|
unsigned int mag_filter);
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_texture_gl_set_max_level (CoglTexture *texture,
|
_cogl_texture_gl_maybe_update_max_level (CoglTexture *texture,
|
||||||
int max_level);
|
int max_level);
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_texture_gl_generate_mipmaps (CoglTexture *texture);
|
_cogl_texture_gl_generate_mipmaps (CoglTexture *texture);
|
||||||
|
|||||||
@@ -97,36 +97,32 @@ _cogl_texture_gl_flush_legacy_texobj_filters (CoglTexture *texture,
|
|||||||
min_filter, mag_filter);
|
min_filter, mag_filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GL and GLES3 have this by default, but GLES2 does not except via extension.
|
|
||||||
* So really it's probably always available. Even if we used it and it wasn't
|
|
||||||
* available in some driver then there are no adverse consequences to the
|
|
||||||
* command simply being ignored...
|
|
||||||
*/
|
|
||||||
#ifndef GL_TEXTURE_MAX_LEVEL
|
|
||||||
#define GL_TEXTURE_MAX_LEVEL 0x813D
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_texture_gl_set_max_level (CoglTexture *texture,
|
_cogl_texture_gl_maybe_update_max_level (CoglTexture *texture,
|
||||||
int max_level)
|
int max_level)
|
||||||
{
|
{
|
||||||
|
/* This isn't supported on GLES */
|
||||||
|
#ifdef HAVE_COGL_GL
|
||||||
CoglContext *ctx = texture->context;
|
CoglContext *ctx = texture->context;
|
||||||
|
|
||||||
if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_TEXTURE_MAX_LEVEL))
|
if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_TEXTURE_MAX_LEVEL) &&
|
||||||
|
texture->max_level < max_level)
|
||||||
{
|
{
|
||||||
|
CoglContext *ctx = texture->context;
|
||||||
GLuint gl_handle;
|
GLuint gl_handle;
|
||||||
GLenum gl_target;
|
GLenum gl_target;
|
||||||
|
|
||||||
cogl_texture_get_gl_texture (texture, &gl_handle, &gl_target);
|
cogl_texture_get_gl_texture (texture, &gl_handle, &gl_target);
|
||||||
|
|
||||||
texture->max_level_set = max_level;
|
texture->max_level = max_level;
|
||||||
|
|
||||||
_cogl_bind_gl_texture_transient (gl_target,
|
_cogl_bind_gl_texture_transient (gl_target,
|
||||||
gl_handle);
|
gl_handle);
|
||||||
|
|
||||||
GE( ctx, glTexParameteri (gl_target,
|
GE( ctx, glTexParameteri (gl_target,
|
||||||
GL_TEXTURE_MAX_LEVEL, texture->max_level_set));
|
GL_TEXTURE_MAX_LEVEL, texture->max_level));
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_COGL_GL */
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -137,8 +133,7 @@ _cogl_texture_gl_generate_mipmaps (CoglTexture *texture)
|
|||||||
GLuint gl_handle;
|
GLuint gl_handle;
|
||||||
GLenum gl_target;
|
GLenum gl_target;
|
||||||
|
|
||||||
if (texture->max_level_set != n_levels - 1)
|
_cogl_texture_gl_maybe_update_max_level (texture, n_levels - 1);
|
||||||
cogl_texture_gl_set_max_level (texture, n_levels - 1);
|
|
||||||
|
|
||||||
cogl_texture_get_gl_texture (texture, &gl_handle, &gl_target);
|
cogl_texture_get_gl_texture (texture, &gl_handle, &gl_target);
|
||||||
|
|
||||||
|
|||||||
@@ -455,8 +455,8 @@ _cogl_driver_update_features (CoglContext *ctx,
|
|||||||
TRUE);
|
TRUE);
|
||||||
|
|
||||||
if (ctx->glBlitFramebuffer)
|
if (ctx->glBlitFramebuffer)
|
||||||
COGL_FLAGS_SET (ctx->features,
|
COGL_FLAGS_SET (private_features,
|
||||||
COGL_FEATURE_ID_BLIT_FRAMEBUFFER, TRUE);
|
COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER, TRUE);
|
||||||
|
|
||||||
COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_PBOS, TRUE);
|
COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_PBOS, TRUE);
|
||||||
|
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ _cogl_texture_driver_upload_subregion_to_gl (CoglContext *ctx,
|
|||||||
* glTexImage2D first to assert that the storage for this
|
* glTexImage2D first to assert that the storage for this
|
||||||
* level exists.
|
* level exists.
|
||||||
*/
|
*/
|
||||||
if (texture->max_level_set < level)
|
if (texture->max_level < level)
|
||||||
{
|
{
|
||||||
ctx->glTexImage2D (gl_target,
|
ctx->glTexImage2D (gl_target,
|
||||||
level,
|
level,
|
||||||
|
|||||||
@@ -318,8 +318,8 @@ _cogl_driver_update_features (CoglContext *context,
|
|||||||
COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_SAMPLER_OBJECTS, TRUE);
|
COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_SAMPLER_OBJECTS, TRUE);
|
||||||
|
|
||||||
if (context->glBlitFramebuffer)
|
if (context->glBlitFramebuffer)
|
||||||
COGL_FLAGS_SET (context->features,
|
COGL_FLAGS_SET (private_features,
|
||||||
COGL_FEATURE_ID_BLIT_FRAMEBUFFER, TRUE);
|
COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER, TRUE);
|
||||||
|
|
||||||
if (_cogl_check_extension ("GL_OES_element_index_uint", gl_extensions))
|
if (_cogl_check_extension ("GL_OES_element_index_uint", gl_extensions))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -303,7 +303,7 @@ _cogl_texture_driver_upload_subregion_to_gl (CoglContext *ctx,
|
|||||||
* glTexImage2D first to assert that the storage for this
|
* glTexImage2D first to assert that the storage for this
|
||||||
* level exists.
|
* level exists.
|
||||||
*/
|
*/
|
||||||
if (texture->max_level_set < level)
|
if (texture->max_level < level)
|
||||||
{
|
{
|
||||||
ctx->glTexImage2D (gl_target,
|
ctx->glTexImage2D (gl_target,
|
||||||
level,
|
level,
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ cogl_config_h = configure_file(
|
|||||||
|
|
||||||
cogl_pkg_deps = [
|
cogl_pkg_deps = [
|
||||||
glib_dep,
|
glib_dep,
|
||||||
gio_dep,
|
|
||||||
gobject_dep,
|
gobject_dep,
|
||||||
graphene_dep,
|
graphene_dep,
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ is_boolean_env_set (const char *variable)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
void
|
||||||
test_utils_init (TestFlags requirement_flags,
|
test_utils_init (TestFlags requirement_flags,
|
||||||
TestFlags known_failure_flags)
|
TestFlags known_failure_flags)
|
||||||
{
|
{
|
||||||
@@ -156,8 +156,6 @@ test_utils_init (TestFlags requirement_flags,
|
|||||||
g_print ("WARNING: Missing required feature[s] for this test\n");
|
g_print ("WARNING: Missing required feature[s] for this test\n");
|
||||||
else if (known_failure)
|
else if (known_failure)
|
||||||
g_print ("WARNING: Test is known to fail\n");
|
g_print ("WARNING: Test is known to fail\n");
|
||||||
|
|
||||||
return (!missing_requirement && !known_failure);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -252,17 +250,7 @@ void
|
|||||||
test_utils_check_pixel_rgb (CoglFramebuffer *test_fb,
|
test_utils_check_pixel_rgb (CoglFramebuffer *test_fb,
|
||||||
int x, int y, int r, int g, int b)
|
int x, int y, int r, int g, int b)
|
||||||
{
|
{
|
||||||
g_return_if_fail (r >= 0);
|
test_utils_check_pixel (test_fb, x, y, (r << 24) | (g << 16) | (b << 8));
|
||||||
g_return_if_fail (g >= 0);
|
|
||||||
g_return_if_fail (b >= 0);
|
|
||||||
g_return_if_fail (r <= 0xFF);
|
|
||||||
g_return_if_fail (g <= 0xFF);
|
|
||||||
g_return_if_fail (b <= 0xFF);
|
|
||||||
|
|
||||||
test_utils_check_pixel (test_fb, x, y,
|
|
||||||
(((guint32) r) << 24) |
|
|
||||||
(((guint32) g) << 16) |
|
|
||||||
(((guint32) b) << 8));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ typedef enum
|
|||||||
extern CoglContext *test_ctx;
|
extern CoglContext *test_ctx;
|
||||||
extern CoglFramebuffer *test_fb;
|
extern CoglFramebuffer *test_fb;
|
||||||
|
|
||||||
gboolean
|
void
|
||||||
test_utils_init (TestFlags requirement_flags,
|
test_utils_init (TestFlags requirement_flags,
|
||||||
TestFlags known_failure_flags);
|
TestFlags known_failure_flags);
|
||||||
|
|
||||||
|
|||||||
@@ -99,9 +99,9 @@ verify_texture (CoglTexture *texture, int size)
|
|||||||
};
|
};
|
||||||
|
|
||||||
test_utils_compare_pixel (p,
|
test_utils_compare_pixel (p,
|
||||||
(((guint32) real_color.red) << 24) |
|
(real_color.red << 24) |
|
||||||
(((guint32) real_color.green) << 16) |
|
(real_color.green << 16) |
|
||||||
(((guint32) real_color.blue) << 8) |
|
(real_color.blue << 8) |
|
||||||
opacity);
|
opacity);
|
||||||
g_assert_cmpint (p[3], ==, opacity);
|
g_assert_cmpint (p[3], ==, opacity);
|
||||||
|
|
||||||
|
|||||||
@@ -15,17 +15,10 @@
|
|||||||
G_STMT_START { \
|
G_STMT_START { \
|
||||||
if (strcmp (#FUNC, argv[1]) == 0) \
|
if (strcmp (#FUNC, argv[1]) == 0) \
|
||||||
{ \
|
{ \
|
||||||
if (test_utils_init (REQUIREMENTS, KNOWN_FAIL_REQUIREMENTS) \
|
test_utils_init (REQUIREMENTS, KNOWN_FAIL_REQUIREMENTS); \
|
||||||
|| g_getenv ("COGL_TEST_TRY_EVERYTHING") != NULL) \
|
FUNC (); \
|
||||||
{ \
|
test_utils_fini (); \
|
||||||
FUNC (); \
|
exit (0); \
|
||||||
test_utils_fini (); \
|
|
||||||
exit (0); \
|
|
||||||
} \
|
|
||||||
else \
|
|
||||||
{ \
|
|
||||||
exit (1); \
|
|
||||||
} \
|
|
||||||
} \
|
} \
|
||||||
} G_STMT_END
|
} G_STMT_END
|
||||||
|
|
||||||
@@ -62,7 +55,7 @@ main (int argc, char **argv)
|
|||||||
ADD_TEST (test_pipeline_user_matrix, 0, 0);
|
ADD_TEST (test_pipeline_user_matrix, 0, 0);
|
||||||
ADD_TEST (test_blend_strings, 0, 0);
|
ADD_TEST (test_blend_strings, 0, 0);
|
||||||
ADD_TEST (test_blend, 0, 0);
|
ADD_TEST (test_blend, 0, 0);
|
||||||
ADD_TEST (test_premult, 0, 0);
|
ADD_TEST (test_premult, 0, TEST_KNOWN_FAILURE);
|
||||||
UNPORTED_TEST (test_readpixels);
|
UNPORTED_TEST (test_readpixels);
|
||||||
ADD_TEST (test_depth_test, 0, 0);
|
ADD_TEST (test_depth_test, 0, 0);
|
||||||
ADD_TEST (test_backface_culling, 0, TEST_REQUIREMENT_NPOT);
|
ADD_TEST (test_backface_culling, 0, TEST_REQUIREMENT_NPOT);
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ make_texture (uint32_t color,
|
|||||||
CoglPixelFormat src_format,
|
CoglPixelFormat src_format,
|
||||||
MakeTextureFlags flags)
|
MakeTextureFlags flags)
|
||||||
{
|
{
|
||||||
static CoglUserDataKey bitmap_free_key;
|
|
||||||
CoglTexture2D *tex_2d;
|
CoglTexture2D *tex_2d;
|
||||||
guchar *tex_data = gen_tex_data (color);
|
guchar *tex_data = gen_tex_data (color);
|
||||||
CoglBitmap *bmp = cogl_bitmap_new_for_data (test_ctx,
|
CoglBitmap *bmp = cogl_bitmap_new_for_data (test_ctx,
|
||||||
@@ -59,10 +58,6 @@ make_texture (uint32_t color,
|
|||||||
src_format,
|
src_format,
|
||||||
QUAD_WIDTH * 4,
|
QUAD_WIDTH * 4,
|
||||||
tex_data);
|
tex_data);
|
||||||
cogl_object_set_user_data (COGL_OBJECT (bmp),
|
|
||||||
&bitmap_free_key,
|
|
||||||
tex_data,
|
|
||||||
g_free);
|
|
||||||
|
|
||||||
tex_2d = cogl_texture_2d_new_from_bitmap (bmp);
|
tex_2d = cogl_texture_2d_new_from_bitmap (bmp);
|
||||||
|
|
||||||
@@ -72,6 +67,7 @@ make_texture (uint32_t color,
|
|||||||
cogl_texture_set_premultiplied (tex_2d, FALSE);
|
cogl_texture_set_premultiplied (tex_2d, FALSE);
|
||||||
|
|
||||||
cogl_object_unref (bmp);
|
cogl_object_unref (bmp);
|
||||||
|
g_free (tex_data);
|
||||||
|
|
||||||
return tex_2d;
|
return tex_2d;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,16 +36,10 @@ main (int argc, char **argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (test_utils_init (unit_test->requirement_flags,
|
test_utils_init (unit_test->requirement_flags,
|
||||||
unit_test->known_failure_flags)
|
unit_test->known_failure_flags);
|
||||||
|| g_getenv ("COGL_TEST_TRY_EVERYTHING") != NULL)
|
unit_test->run ();
|
||||||
{
|
test_utils_fini ();
|
||||||
unit_test->run ();
|
|
||||||
test_utils_fini ();
|
return 0;
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
project('mutter', 'c',
|
project('mutter', 'c',
|
||||||
version: '3.37.2',
|
version: '3.37.1',
|
||||||
meson_version: '>= 0.50.0',
|
meson_version: '>= 0.50.0',
|
||||||
license: 'GPLv2+'
|
license: 'GPLv2+'
|
||||||
)
|
)
|
||||||
@@ -487,7 +487,6 @@ output = [
|
|||||||
' Cogl tests............... ' + have_cogl_tests.to_string(),
|
' Cogl tests............... ' + have_cogl_tests.to_string(),
|
||||||
' Clutter tests............ ' + have_clutter_tests.to_string(),
|
' Clutter tests............ ' + have_clutter_tests.to_string(),
|
||||||
' Installed tests.......... ' + have_installed_tests.to_string(),
|
' Installed tests.......... ' + have_installed_tests.to_string(),
|
||||||
' Coverage................. ' + get_option('b_coverage').to_string(),
|
|
||||||
'',
|
'',
|
||||||
' Now type \'ninja -C ' + meson.build_root() + '\' to build ' + meson.project_name(),
|
' Now type \'ninja -C ' + meson.build_root() + '\' to build ' + meson.project_name(),
|
||||||
'',
|
'',
|
||||||
|
|||||||
@@ -108,14 +108,6 @@ struct _MetaBackendClass
|
|||||||
|
|
||||||
void meta_init_backend (GType backend_gtype);
|
void meta_init_backend (GType backend_gtype);
|
||||||
|
|
||||||
#ifdef HAVE_WAYLAND
|
|
||||||
MetaWaylandCompositor * meta_backend_get_wayland_compositor (MetaBackend *backend);
|
|
||||||
|
|
||||||
void meta_backend_init_wayland_display (MetaBackend *backend);
|
|
||||||
|
|
||||||
void meta_backend_init_wayland (MetaBackend *backend);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ClutterBackend * meta_backend_get_clutter_backend (MetaBackend *backend);
|
ClutterBackend * meta_backend_get_clutter_backend (MetaBackend *backend);
|
||||||
|
|
||||||
MetaIdleMonitor * meta_backend_get_idle_monitor (MetaBackend *backend,
|
MetaIdleMonitor * meta_backend_get_idle_monitor (MetaBackend *backend,
|
||||||
|
|||||||
@@ -54,6 +54,4 @@ typedef struct _MetaScreenCast MetaScreenCast;
|
|||||||
typedef struct _MetaScreenCastSession MetaScreenCastSession;
|
typedef struct _MetaScreenCastSession MetaScreenCastSession;
|
||||||
typedef struct _MetaScreenCastStream MetaScreenCastStream;
|
typedef struct _MetaScreenCastStream MetaScreenCastStream;
|
||||||
|
|
||||||
typedef struct _MetaWaylandCompositor MetaWaylandCompositor;
|
|
||||||
|
|
||||||
#endif /* META_BACKEND_TYPE_H */
|
#endif /* META_BACKEND_TYPE_H */
|
||||||
|
|||||||
@@ -81,10 +81,6 @@
|
|||||||
#include "backends/native/meta-backend-native.h"
|
#include "backends/native/meta-backend-native.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_WAYLAND
|
|
||||||
#include "wayland/meta-wayland.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
KEYMAP_CHANGED,
|
KEYMAP_CHANGED,
|
||||||
@@ -134,10 +130,6 @@ struct _MetaBackendPrivate
|
|||||||
MetaRemoteDesktop *remote_desktop;
|
MetaRemoteDesktop *remote_desktop;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_WAYLAND
|
|
||||||
MetaWaylandCompositor *wayland_compositor;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_PROFILER
|
#ifdef HAVE_PROFILER
|
||||||
MetaProfiler *profiler;
|
MetaProfiler *profiler;
|
||||||
#endif
|
#endif
|
||||||
@@ -872,120 +864,6 @@ system_bus_gotten_cb (GObject *object,
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_WAYLAND
|
|
||||||
MetaWaylandCompositor *
|
|
||||||
meta_backend_get_wayland_compositor (MetaBackend *backend)
|
|
||||||
{
|
|
||||||
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
|
|
||||||
|
|
||||||
return priv->wayland_compositor;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
meta_backend_init_wayland_display (MetaBackend *backend)
|
|
||||||
{
|
|
||||||
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
|
|
||||||
|
|
||||||
priv->wayland_compositor = meta_wayland_compositor_new (backend);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
meta_backend_init_wayland (MetaBackend *backend)
|
|
||||||
{
|
|
||||||
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
|
|
||||||
|
|
||||||
meta_wayland_compositor_setup (priv->wayland_compositor);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Mutter is responsible for pulling events off the X queue, so Clutter
|
|
||||||
* doesn't need (and shouldn't) run its normal event source which polls
|
|
||||||
* the X fd, but we do have to deal with dispatching events that accumulate
|
|
||||||
* in the clutter queue. This happens, for example, when clutter generate
|
|
||||||
* enter/leave events on mouse motion - several events are queued in the
|
|
||||||
* clutter queue but only one dispatched. It could also happen because of
|
|
||||||
* explicit calls to clutter_event_put(). We add a very simple custom
|
|
||||||
* event loop source which is simply responsible for pulling events off
|
|
||||||
* of the queue and dispatching them before we block for new events.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
clutter_source_prepare (GSource *source,
|
|
||||||
int *timeout)
|
|
||||||
{
|
|
||||||
*timeout = -1;
|
|
||||||
|
|
||||||
return clutter_events_pending ();
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
clutter_source_check (GSource *source)
|
|
||||||
{
|
|
||||||
return clutter_events_pending ();
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
clutter_source_dispatch (GSource *source,
|
|
||||||
GSourceFunc callback,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
ClutterEvent *event = clutter_event_get ();
|
|
||||||
|
|
||||||
if (event)
|
|
||||||
{
|
|
||||||
clutter_do_event (event);
|
|
||||||
clutter_event_free (event);
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GSourceFuncs clutter_source_funcs = {
|
|
||||||
clutter_source_prepare,
|
|
||||||
clutter_source_check,
|
|
||||||
clutter_source_dispatch
|
|
||||||
};
|
|
||||||
|
|
||||||
static ClutterBackend *
|
|
||||||
meta_get_clutter_backend (void)
|
|
||||||
{
|
|
||||||
MetaBackend *backend = meta_get_backend ();
|
|
||||||
|
|
||||||
return meta_backend_get_clutter_backend (backend);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
init_clutter (MetaBackend *backend,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
GSource *source;
|
|
||||||
|
|
||||||
clutter_set_custom_backend_func (meta_get_clutter_backend);
|
|
||||||
|
|
||||||
if (clutter_init (NULL, NULL) != CLUTTER_INIT_SUCCESS)
|
|
||||||
{
|
|
||||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
|
||||||
"Unable to initialize Clutter");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
source = g_source_new (&clutter_source_funcs, sizeof (GSource));
|
|
||||||
g_source_attach (source, NULL);
|
|
||||||
g_source_unref (source);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
meta_backend_post_init (MetaBackend *backend)
|
|
||||||
{
|
|
||||||
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
|
|
||||||
|
|
||||||
META_BACKEND_GET_CLASS (backend)->post_init (backend);
|
|
||||||
|
|
||||||
meta_settings_post_init (priv->settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
meta_backend_initable_init (GInitable *initable,
|
meta_backend_initable_init (GInitable *initable,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
@@ -1024,11 +902,6 @@ meta_backend_initable_init (GInitable *initable,
|
|||||||
priv->profiler = meta_profiler_new ();
|
priv->profiler = meta_profiler_new ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!init_clutter (backend, error))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
meta_backend_post_init (backend);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1044,6 +917,16 @@ meta_backend_init (MetaBackend *backend)
|
|||||||
_backend = backend;
|
_backend = backend;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_backend_post_init (MetaBackend *backend)
|
||||||
|
{
|
||||||
|
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
|
||||||
|
|
||||||
|
META_BACKEND_GET_CLASS (backend)->post_init (backend);
|
||||||
|
|
||||||
|
meta_settings_post_init (priv->settings);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* meta_backend_get_idle_monitor: (skip)
|
* meta_backend_get_idle_monitor: (skip)
|
||||||
*/
|
*/
|
||||||
@@ -1375,6 +1258,54 @@ meta_backend_set_client_pointer_constraint (MetaBackend *backend,
|
|||||||
priv->client_pointer_constraint = g_object_ref (constraint);
|
priv->client_pointer_constraint = g_object_ref (constraint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Mutter is responsible for pulling events off the X queue, so Clutter
|
||||||
|
* doesn't need (and shouldn't) run its normal event source which polls
|
||||||
|
* the X fd, but we do have to deal with dispatching events that accumulate
|
||||||
|
* in the clutter queue. This happens, for example, when clutter generate
|
||||||
|
* enter/leave events on mouse motion - several events are queued in the
|
||||||
|
* clutter queue but only one dispatched. It could also happen because of
|
||||||
|
* explicit calls to clutter_event_put(). We add a very simple custom
|
||||||
|
* event loop source which is simply responsible for pulling events off
|
||||||
|
* of the queue and dispatching them before we block for new events.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
event_prepare (GSource *source,
|
||||||
|
gint *timeout_)
|
||||||
|
{
|
||||||
|
*timeout_ = -1;
|
||||||
|
|
||||||
|
return clutter_events_pending ();
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
event_check (GSource *source)
|
||||||
|
{
|
||||||
|
return clutter_events_pending ();
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
event_dispatch (GSource *source,
|
||||||
|
GSourceFunc callback,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
ClutterEvent *event = clutter_event_get ();
|
||||||
|
|
||||||
|
if (event)
|
||||||
|
{
|
||||||
|
clutter_do_event (event);
|
||||||
|
clutter_event_free (event);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GSourceFuncs event_funcs = {
|
||||||
|
event_prepare,
|
||||||
|
event_check,
|
||||||
|
event_dispatch
|
||||||
|
};
|
||||||
|
|
||||||
ClutterBackend *
|
ClutterBackend *
|
||||||
meta_backend_get_clutter_backend (MetaBackend *backend)
|
meta_backend_get_clutter_backend (MetaBackend *backend)
|
||||||
{
|
{
|
||||||
@@ -1389,6 +1320,14 @@ meta_backend_get_clutter_backend (MetaBackend *backend)
|
|||||||
return priv->clutter_backend;
|
return priv->clutter_backend;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ClutterBackend *
|
||||||
|
meta_get_clutter_backend (void)
|
||||||
|
{
|
||||||
|
MetaBackend *backend = meta_get_backend ();
|
||||||
|
|
||||||
|
return meta_backend_get_clutter_backend (backend);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_init_backend (GType backend_gtype)
|
meta_init_backend (GType backend_gtype)
|
||||||
{
|
{
|
||||||
@@ -1405,6 +1344,29 @@ meta_init_backend (GType backend_gtype)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* meta_clutter_init: (skip)
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
meta_clutter_init (void)
|
||||||
|
{
|
||||||
|
GSource *source;
|
||||||
|
|
||||||
|
clutter_set_custom_backend_func (meta_get_clutter_backend);
|
||||||
|
|
||||||
|
if (clutter_init (NULL, NULL) != CLUTTER_INIT_SUCCESS)
|
||||||
|
{
|
||||||
|
g_warning ("Unable to initialize Clutter.\n");
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
source = g_source_new (&event_funcs, sizeof (GSource));
|
||||||
|
g_source_attach (source, NULL);
|
||||||
|
g_source_unref (source);
|
||||||
|
|
||||||
|
meta_backend_post_init (_backend);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* meta_is_stage_views_enabled:
|
* meta_is_stage_views_enabled:
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -84,7 +84,6 @@ translate_meta_cursor (MetaCursor cursor)
|
|||||||
return "crosshair";
|
return "crosshair";
|
||||||
case META_CURSOR_IBEAM:
|
case META_CURSOR_IBEAM:
|
||||||
return "xterm";
|
return "xterm";
|
||||||
case META_CURSOR_BLANK:
|
|
||||||
case META_CURSOR_NONE:
|
case META_CURSOR_NONE:
|
||||||
case META_CURSOR_LAST:
|
case META_CURSOR_LAST:
|
||||||
break;
|
break;
|
||||||
@@ -94,48 +93,6 @@ translate_meta_cursor (MetaCursor cursor)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Cursor
|
|
||||||
create_blank_cursor (Display *xdisplay)
|
|
||||||
{
|
|
||||||
Pixmap pixmap;
|
|
||||||
XColor color;
|
|
||||||
Cursor cursor;
|
|
||||||
XGCValues gc_values;
|
|
||||||
GC gc;
|
|
||||||
|
|
||||||
pixmap = XCreatePixmap (xdisplay, DefaultRootWindow (xdisplay), 1, 1, 1);
|
|
||||||
|
|
||||||
gc_values.foreground = BlackPixel (xdisplay, DefaultScreen (xdisplay));
|
|
||||||
gc = XCreateGC (xdisplay, pixmap, GCForeground, &gc_values);
|
|
||||||
|
|
||||||
XFillRectangle (xdisplay, pixmap, gc, 0, 0, 1, 1);
|
|
||||||
|
|
||||||
color.pixel = 0;
|
|
||||||
color.red = color.blue = color.green = 0;
|
|
||||||
|
|
||||||
cursor = XCreatePixmapCursor (xdisplay, pixmap, pixmap, &color, &color, 1, 1);
|
|
||||||
|
|
||||||
XFreeGC (xdisplay, gc);
|
|
||||||
XFreePixmap (xdisplay, pixmap);
|
|
||||||
|
|
||||||
return cursor;
|
|
||||||
}
|
|
||||||
|
|
||||||
static XcursorImages *
|
|
||||||
create_blank_cursor_images (void)
|
|
||||||
{
|
|
||||||
XcursorImages *images;
|
|
||||||
|
|
||||||
images = XcursorImagesCreate (1);
|
|
||||||
images->images[0] = XcursorImageCreate (1, 1);
|
|
||||||
|
|
||||||
images->images[0]->xhot = 0;
|
|
||||||
images->images[0]->yhot = 0;
|
|
||||||
memset (images->images[0]->pixels, 0, sizeof(int32_t));
|
|
||||||
|
|
||||||
return images;
|
|
||||||
}
|
|
||||||
|
|
||||||
MetaCursor
|
MetaCursor
|
||||||
meta_cursor_sprite_xcursor_get_cursor (MetaCursorSpriteXcursor *sprite_xcursor)
|
meta_cursor_sprite_xcursor_get_cursor (MetaCursorSpriteXcursor *sprite_xcursor)
|
||||||
{
|
{
|
||||||
@@ -146,18 +103,12 @@ Cursor
|
|||||||
meta_create_x_cursor (Display *xdisplay,
|
meta_create_x_cursor (Display *xdisplay,
|
||||||
MetaCursor cursor)
|
MetaCursor cursor)
|
||||||
{
|
{
|
||||||
if (cursor == META_CURSOR_BLANK)
|
|
||||||
return create_blank_cursor (xdisplay);
|
|
||||||
|
|
||||||
return XcursorLibraryLoadCursor (xdisplay, translate_meta_cursor (cursor));
|
return XcursorLibraryLoadCursor (xdisplay, translate_meta_cursor (cursor));
|
||||||
}
|
}
|
||||||
|
|
||||||
static XcursorImages *
|
static XcursorImages *
|
||||||
load_cursor_on_client (MetaCursor cursor, int scale)
|
load_cursor_on_client (MetaCursor cursor, int scale)
|
||||||
{
|
{
|
||||||
if (cursor == META_CURSOR_BLANK)
|
|
||||||
return create_blank_cursor_images ();
|
|
||||||
|
|
||||||
return XcursorLibraryLoadImages (translate_meta_cursor (cursor),
|
return XcursorLibraryLoadImages (translate_meta_cursor (cursor),
|
||||||
meta_prefs_get_cursor_theme (),
|
meta_prefs_get_cursor_theme (),
|
||||||
meta_prefs_get_cursor_size () * scale);
|
meta_prefs_get_cursor_size () * scale);
|
||||||
|
|||||||
@@ -90,7 +90,6 @@ float meta_logical_monitor_get_scale (MetaLogicalMonitor *logical_monitor);
|
|||||||
|
|
||||||
MetaMonitorTransform meta_logical_monitor_get_transform (MetaLogicalMonitor *logical_monitor);
|
MetaMonitorTransform meta_logical_monitor_get_transform (MetaLogicalMonitor *logical_monitor);
|
||||||
|
|
||||||
META_EXPORT_TEST
|
|
||||||
MetaRectangle meta_logical_monitor_get_layout (MetaLogicalMonitor *logical_monitor);
|
MetaRectangle meta_logical_monitor_get_layout (MetaLogicalMonitor *logical_monitor);
|
||||||
|
|
||||||
META_EXPORT_TEST
|
META_EXPORT_TEST
|
||||||
|
|||||||
@@ -49,10 +49,9 @@ meta_monitor_transform_is_rotated (MetaMonitorTransform transform)
|
|||||||
static inline gboolean
|
static inline gboolean
|
||||||
meta_monitor_transform_is_flipped (MetaMonitorTransform transform)
|
meta_monitor_transform_is_flipped (MetaMonitorTransform transform)
|
||||||
{
|
{
|
||||||
return (transform >= META_MONITOR_TRANSFORM_FLIPPED);
|
return (abs(transform) >= META_MONITOR_TRANSFORM_FLIPPED);
|
||||||
}
|
}
|
||||||
|
|
||||||
META_EXPORT_TEST
|
|
||||||
MetaMonitorTransform meta_monitor_transform_invert (MetaMonitorTransform transform);
|
MetaMonitorTransform meta_monitor_transform_invert (MetaMonitorTransform transform);
|
||||||
|
|
||||||
META_EXPORT_TEST
|
META_EXPORT_TEST
|
||||||
|
|||||||
@@ -35,12 +35,6 @@ meta_output_get_gpu (MetaOutput *output)
|
|||||||
return output->gpu;
|
return output->gpu;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
|
||||||
meta_output_get_name (MetaOutput *output)
|
|
||||||
{
|
|
||||||
return output->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_output_assign_crtc (MetaOutput *output,
|
meta_output_assign_crtc (MetaOutput *output,
|
||||||
MetaCrtc *crtc)
|
MetaCrtc *crtc)
|
||||||
|
|||||||
@@ -122,8 +122,6 @@ META_EXPORT_TEST G_DECLARE_FINAL_TYPE (MetaOutput, meta_output, META, OUTPUT, GO
|
|||||||
META_EXPORT_TEST
|
META_EXPORT_TEST
|
||||||
MetaGpu * meta_output_get_gpu (MetaOutput *output);
|
MetaGpu * meta_output_get_gpu (MetaOutput *output);
|
||||||
|
|
||||||
const char * meta_output_get_name (MetaOutput *output);
|
|
||||||
|
|
||||||
META_EXPORT_TEST
|
META_EXPORT_TEST
|
||||||
void meta_output_assign_crtc (MetaOutput *output,
|
void meta_output_assign_crtc (MetaOutput *output,
|
||||||
MetaCrtc *crtc);
|
MetaCrtc *crtc);
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ struct _MetaRemoteDesktopSession
|
|||||||
|
|
||||||
MetaScreenCastSession *screen_cast_session;
|
MetaScreenCastSession *screen_cast_session;
|
||||||
gulong screen_cast_session_closed_handler_id;
|
gulong screen_cast_session_closed_handler_id;
|
||||||
guint started : 1;
|
|
||||||
|
|
||||||
ClutterVirtualInputDevice *virtual_pointer;
|
ClutterVirtualInputDevice *virtual_pointer;
|
||||||
ClutterVirtualInputDevice *virtual_keyboard;
|
ClutterVirtualInputDevice *virtual_keyboard;
|
||||||
@@ -120,7 +119,7 @@ meta_remote_desktop_session_start (MetaRemoteDesktopSession *session,
|
|||||||
ClutterBackend *backend = clutter_get_default_backend ();
|
ClutterBackend *backend = clutter_get_default_backend ();
|
||||||
ClutterSeat *seat = clutter_backend_get_default_seat (backend);
|
ClutterSeat *seat = clutter_backend_get_default_seat (backend);
|
||||||
|
|
||||||
g_assert (!session->started);
|
g_assert (!session->virtual_pointer && !session->virtual_keyboard);
|
||||||
|
|
||||||
if (session->screen_cast_session)
|
if (session->screen_cast_session)
|
||||||
{
|
{
|
||||||
@@ -136,7 +135,6 @@ meta_remote_desktop_session_start (MetaRemoteDesktopSession *session,
|
|||||||
clutter_seat_create_virtual_device (seat, CLUTTER_TOUCHSCREEN_DEVICE);
|
clutter_seat_create_virtual_device (seat, CLUTTER_TOUCHSCREEN_DEVICE);
|
||||||
|
|
||||||
init_remote_access_handle (session);
|
init_remote_access_handle (session);
|
||||||
session->started = TRUE;
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -147,8 +145,6 @@ meta_remote_desktop_session_close (MetaRemoteDesktopSession *session)
|
|||||||
MetaDBusRemoteDesktopSession *skeleton =
|
MetaDBusRemoteDesktopSession *skeleton =
|
||||||
META_DBUS_REMOTE_DESKTOP_SESSION (session);
|
META_DBUS_REMOTE_DESKTOP_SESSION (session);
|
||||||
|
|
||||||
session->started = FALSE;
|
|
||||||
|
|
||||||
if (session->screen_cast_session)
|
if (session->screen_cast_session)
|
||||||
{
|
{
|
||||||
g_clear_signal_handler (&session->screen_cast_session_closed_handler_id,
|
g_clear_signal_handler (&session->screen_cast_session_closed_handler_id,
|
||||||
@@ -253,37 +249,6 @@ check_permission (MetaRemoteDesktopSession *session,
|
|||||||
g_dbus_method_invocation_get_sender (invocation)) == 0;
|
g_dbus_method_invocation_get_sender (invocation)) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
meta_remote_desktop_session_check_can_notify (MetaRemoteDesktopSession *session,
|
|
||||||
GDBusMethodInvocation *invocation)
|
|
||||||
{
|
|
||||||
if (!session->started)
|
|
||||||
{
|
|
||||||
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
||||||
G_DBUS_ERROR_FAILED,
|
|
||||||
"Session not started");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!check_permission (session, invocation))
|
|
||||||
{
|
|
||||||
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
||||||
G_DBUS_ERROR_ACCESS_DENIED,
|
|
||||||
"Permission denied");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!session->screen_cast_session)
|
|
||||||
{
|
|
||||||
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
||||||
G_DBUS_ERROR_FAILED,
|
|
||||||
"No screen cast active");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
handle_start (MetaDBusRemoteDesktopSession *skeleton,
|
handle_start (MetaDBusRemoteDesktopSession *skeleton,
|
||||||
GDBusMethodInvocation *invocation)
|
GDBusMethodInvocation *invocation)
|
||||||
@@ -291,14 +256,6 @@ handle_start (MetaDBusRemoteDesktopSession *skeleton,
|
|||||||
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
if (session->started)
|
|
||||||
{
|
|
||||||
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
||||||
G_DBUS_ERROR_FAILED,
|
|
||||||
"Already started");
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!check_permission (session, invocation))
|
if (!check_permission (session, invocation))
|
||||||
{
|
{
|
||||||
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
||||||
@@ -331,14 +288,6 @@ handle_stop (MetaDBusRemoteDesktopSession *skeleton,
|
|||||||
{
|
{
|
||||||
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
||||||
|
|
||||||
if (!session->started)
|
|
||||||
{
|
|
||||||
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
|
||||||
G_DBUS_ERROR_FAILED,
|
|
||||||
"Session not started");
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!check_permission (session, invocation))
|
if (!check_permission (session, invocation))
|
||||||
{
|
{
|
||||||
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
||||||
@@ -363,8 +312,13 @@ handle_notify_keyboard_keycode (MetaDBusRemoteDesktopSession *skeleton,
|
|||||||
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
||||||
ClutterKeyState state;
|
ClutterKeyState state;
|
||||||
|
|
||||||
if (!meta_remote_desktop_session_check_can_notify (session, invocation))
|
if (!check_permission (session, invocation))
|
||||||
return TRUE;
|
{
|
||||||
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
||||||
|
G_DBUS_ERROR_ACCESS_DENIED,
|
||||||
|
"Permission denied");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (pressed)
|
if (pressed)
|
||||||
state = CLUTTER_KEY_STATE_PRESSED;
|
state = CLUTTER_KEY_STATE_PRESSED;
|
||||||
@@ -390,8 +344,13 @@ handle_notify_keyboard_keysym (MetaDBusRemoteDesktopSession *skeleton,
|
|||||||
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
||||||
ClutterKeyState state;
|
ClutterKeyState state;
|
||||||
|
|
||||||
if (!meta_remote_desktop_session_check_can_notify (session, invocation))
|
if (!check_permission (session, invocation))
|
||||||
return TRUE;
|
{
|
||||||
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
||||||
|
G_DBUS_ERROR_ACCESS_DENIED,
|
||||||
|
"Permission denied");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (pressed)
|
if (pressed)
|
||||||
state = CLUTTER_KEY_STATE_PRESSED;
|
state = CLUTTER_KEY_STATE_PRESSED;
|
||||||
@@ -439,8 +398,13 @@ handle_notify_pointer_button (MetaDBusRemoteDesktopSession *skeleton,
|
|||||||
uint32_t button;
|
uint32_t button;
|
||||||
ClutterButtonState state;
|
ClutterButtonState state;
|
||||||
|
|
||||||
if (!meta_remote_desktop_session_check_can_notify (session, invocation))
|
if (!check_permission (session, invocation))
|
||||||
return TRUE;
|
{
|
||||||
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
||||||
|
G_DBUS_ERROR_ACCESS_DENIED,
|
||||||
|
"Permission denied");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
button = translate_to_clutter_button (button_code);
|
button = translate_to_clutter_button (button_code);
|
||||||
|
|
||||||
@@ -470,8 +434,13 @@ handle_notify_pointer_axis (MetaDBusRemoteDesktopSession *skeleton,
|
|||||||
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
||||||
ClutterScrollFinishFlags finish_flags = CLUTTER_SCROLL_FINISHED_NONE;
|
ClutterScrollFinishFlags finish_flags = CLUTTER_SCROLL_FINISHED_NONE;
|
||||||
|
|
||||||
if (!meta_remote_desktop_session_check_can_notify (session, invocation))
|
if (!check_permission (session, invocation))
|
||||||
return TRUE;
|
{
|
||||||
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
||||||
|
G_DBUS_ERROR_ACCESS_DENIED,
|
||||||
|
"Permission denied");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (flags & META_REMOTE_DESKTOP_NOTIFY_AXIS_FLAGS_FINISH)
|
if (flags & META_REMOTE_DESKTOP_NOTIFY_AXIS_FLAGS_FINISH)
|
||||||
{
|
{
|
||||||
@@ -518,8 +487,13 @@ handle_notify_pointer_axis_discrete (MetaDBusRemoteDesktopSession *skeleton,
|
|||||||
ClutterScrollDirection direction;
|
ClutterScrollDirection direction;
|
||||||
int step_count;
|
int step_count;
|
||||||
|
|
||||||
if (!meta_remote_desktop_session_check_can_notify (session, invocation))
|
if (!check_permission (session, invocation))
|
||||||
return TRUE;
|
{
|
||||||
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
||||||
|
G_DBUS_ERROR_ACCESS_DENIED,
|
||||||
|
"Permission denied");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (axis > 1)
|
if (axis > 1)
|
||||||
{
|
{
|
||||||
@@ -564,8 +538,13 @@ handle_notify_pointer_motion_relative (MetaDBusRemoteDesktopSession *skeleton,
|
|||||||
{
|
{
|
||||||
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
||||||
|
|
||||||
if (!meta_remote_desktop_session_check_can_notify (session, invocation))
|
if (!check_permission (session, invocation))
|
||||||
return TRUE;
|
{
|
||||||
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
||||||
|
G_DBUS_ERROR_ACCESS_DENIED,
|
||||||
|
"Permission denied");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
clutter_virtual_input_device_notify_relative_motion (session->virtual_pointer,
|
clutter_virtual_input_device_notify_relative_motion (session->virtual_pointer,
|
||||||
CLUTTER_CURRENT_TIME,
|
CLUTTER_CURRENT_TIME,
|
||||||
@@ -588,8 +567,21 @@ handle_notify_pointer_motion_absolute (MetaDBusRemoteDesktopSession *skeleton,
|
|||||||
MetaScreenCastStream *stream;
|
MetaScreenCastStream *stream;
|
||||||
double abs_x, abs_y;
|
double abs_x, abs_y;
|
||||||
|
|
||||||
if (!meta_remote_desktop_session_check_can_notify (session, invocation))
|
if (!check_permission (session, invocation))
|
||||||
return TRUE;
|
{
|
||||||
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
||||||
|
G_DBUS_ERROR_ACCESS_DENIED,
|
||||||
|
"Permission denied");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!session->screen_cast_session)
|
||||||
|
{
|
||||||
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
||||||
|
G_DBUS_ERROR_FAILED,
|
||||||
|
"No screen cast active");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
stream = meta_screen_cast_session_get_stream (session->screen_cast_session,
|
stream = meta_screen_cast_session_get_stream (session->screen_cast_session,
|
||||||
stream_path);
|
stream_path);
|
||||||
@@ -625,8 +617,21 @@ handle_notify_touch_down (MetaDBusRemoteDesktopSession *skeleton,
|
|||||||
MetaScreenCastStream *stream;
|
MetaScreenCastStream *stream;
|
||||||
double abs_x, abs_y;
|
double abs_x, abs_y;
|
||||||
|
|
||||||
if (!meta_remote_desktop_session_check_can_notify (session, invocation))
|
if (!check_permission (session, invocation))
|
||||||
return TRUE;
|
{
|
||||||
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
||||||
|
G_DBUS_ERROR_ACCESS_DENIED,
|
||||||
|
"Permission denied");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!session->screen_cast_session)
|
||||||
|
{
|
||||||
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
||||||
|
G_DBUS_ERROR_FAILED,
|
||||||
|
"No screen cast active");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
stream = meta_screen_cast_session_get_stream (session->screen_cast_session,
|
stream = meta_screen_cast_session_get_stream (session->screen_cast_session,
|
||||||
stream_path);
|
stream_path);
|
||||||
@@ -663,8 +668,21 @@ handle_notify_touch_motion (MetaDBusRemoteDesktopSession *skeleton,
|
|||||||
MetaScreenCastStream *stream;
|
MetaScreenCastStream *stream;
|
||||||
double abs_x, abs_y;
|
double abs_x, abs_y;
|
||||||
|
|
||||||
if (!meta_remote_desktop_session_check_can_notify (session, invocation))
|
if (!check_permission (session, invocation))
|
||||||
return TRUE;
|
{
|
||||||
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
||||||
|
G_DBUS_ERROR_ACCESS_DENIED,
|
||||||
|
"Permission denied");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!session->screen_cast_session)
|
||||||
|
{
|
||||||
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
||||||
|
G_DBUS_ERROR_FAILED,
|
||||||
|
"No screen cast active");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
stream = meta_screen_cast_session_get_stream (session->screen_cast_session,
|
stream = meta_screen_cast_session_get_stream (session->screen_cast_session,
|
||||||
stream_path);
|
stream_path);
|
||||||
@@ -696,8 +714,13 @@ handle_notify_touch_up (MetaDBusRemoteDesktopSession *skeleton,
|
|||||||
{
|
{
|
||||||
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
||||||
|
|
||||||
if (!meta_remote_desktop_session_check_can_notify (session, invocation))
|
if (!check_permission (session, invocation))
|
||||||
return TRUE;
|
{
|
||||||
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
||||||
|
G_DBUS_ERROR_ACCESS_DENIED,
|
||||||
|
"Permission denied");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
clutter_virtual_input_device_notify_touch_up (session->virtual_touchscreen,
|
clutter_virtual_input_device_notify_touch_up (session->virtual_touchscreen,
|
||||||
CLUTTER_CURRENT_TIME,
|
CLUTTER_CURRENT_TIME,
|
||||||
|
|||||||
@@ -34,7 +34,6 @@
|
|||||||
|
|
||||||
#include "backends/meta-renderer.h"
|
#include "backends/meta-renderer.h"
|
||||||
#include "clutter/clutter-mutter.h"
|
#include "clutter/clutter-mutter.h"
|
||||||
#include "compositor/region-utils.h"
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@@ -118,25 +117,6 @@ meta_renderer_view_setup_offscreen_blit_pipeline (ClutterStageView *view,
|
|||||||
cogl_pipeline_set_layer_matrix (pipeline, 0, &matrix);
|
cogl_pipeline_set_layer_matrix (pipeline, 0, &matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
meta_renderer_view_transform_rect_to_onscreen (ClutterStageView *view,
|
|
||||||
const cairo_rectangle_int_t *src_rect,
|
|
||||||
int dst_width,
|
|
||||||
int dst_height,
|
|
||||||
cairo_rectangle_int_t *dst_rect)
|
|
||||||
{
|
|
||||||
MetaRendererView *renderer_view = META_RENDERER_VIEW (view);
|
|
||||||
MetaMonitorTransform inverted_transform;
|
|
||||||
|
|
||||||
inverted_transform =
|
|
||||||
meta_monitor_transform_invert (renderer_view->transform);
|
|
||||||
return meta_rectangle_transform (src_rect,
|
|
||||||
inverted_transform,
|
|
||||||
dst_width,
|
|
||||||
dst_height,
|
|
||||||
dst_rect);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_renderer_view_set_transform (MetaRendererView *view,
|
meta_renderer_view_set_transform (MetaRendererView *view,
|
||||||
MetaMonitorTransform transform)
|
MetaMonitorTransform transform)
|
||||||
@@ -201,8 +181,6 @@ meta_renderer_view_class_init (MetaRendererViewClass *klass)
|
|||||||
meta_renderer_view_setup_offscreen_blit_pipeline;
|
meta_renderer_view_setup_offscreen_blit_pipeline;
|
||||||
view_class->get_offscreen_transformation_matrix =
|
view_class->get_offscreen_transformation_matrix =
|
||||||
meta_renderer_view_get_offscreen_transformation_matrix;
|
meta_renderer_view_get_offscreen_transformation_matrix;
|
||||||
view_class->transform_rect_to_onscreen =
|
|
||||||
meta_renderer_view_transform_rect_to_onscreen;
|
|
||||||
|
|
||||||
object_class->get_property = meta_renderer_view_get_property;
|
object_class->get_property = meta_renderer_view_get_property;
|
||||||
object_class->set_property = meta_renderer_view_set_property;
|
object_class->set_property = meta_renderer_view_set_property;
|
||||||
|
|||||||
@@ -160,12 +160,14 @@ meta_renderer_real_rebuild_views (MetaRenderer *renderer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_renderer_add_view (MetaRenderer *renderer,
|
meta_renderer_set_legacy_view (MetaRenderer *renderer,
|
||||||
MetaRendererView *view)
|
MetaRendererView *legacy_view)
|
||||||
{
|
{
|
||||||
MetaRendererPrivate *priv = meta_renderer_get_instance_private (renderer);
|
MetaRendererPrivate *priv = meta_renderer_get_instance_private (renderer);
|
||||||
|
|
||||||
priv->views = g_list_append (priv->views, view);
|
g_assert (!priv->views);
|
||||||
|
|
||||||
|
priv->views = g_list_append (priv->views, legacy_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -54,8 +54,8 @@ CoglRenderer * meta_renderer_create_cogl_renderer (MetaRenderer *renderer);
|
|||||||
|
|
||||||
void meta_renderer_rebuild_views (MetaRenderer *renderer);
|
void meta_renderer_rebuild_views (MetaRenderer *renderer);
|
||||||
|
|
||||||
void meta_renderer_add_view (MetaRenderer *renderer,
|
void meta_renderer_set_legacy_view (MetaRenderer *renderer,
|
||||||
MetaRendererView *view);
|
MetaRendererView *legacy_view);
|
||||||
|
|
||||||
META_EXPORT_TEST
|
META_EXPORT_TEST
|
||||||
GList * meta_renderer_get_views (MetaRenderer *renderer);
|
GList * meta_renderer_get_views (MetaRenderer *renderer);
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ typedef struct _MetaPipeWireSource
|
|||||||
{
|
{
|
||||||
GSource base;
|
GSource base;
|
||||||
|
|
||||||
MetaScreenCastStreamSrc *src;
|
|
||||||
struct pw_loop *pipewire_loop;
|
struct pw_loop *pipewire_loop;
|
||||||
} MetaPipeWireSource;
|
} MetaPipeWireSource;
|
||||||
|
|
||||||
@@ -82,7 +81,6 @@ typedef struct _MetaScreenCastStreamSrcPrivate
|
|||||||
struct spa_hook pipewire_core_listener;
|
struct spa_hook pipewire_core_listener;
|
||||||
|
|
||||||
gboolean is_enabled;
|
gboolean is_enabled;
|
||||||
gboolean emit_closed_after_dispatch;
|
|
||||||
|
|
||||||
struct pw_stream *pipewire_stream;
|
struct pw_stream *pipewire_stream;
|
||||||
struct spa_hook pipewire_stream_listener;
|
struct spa_hook pipewire_stream_listener;
|
||||||
@@ -447,8 +445,7 @@ meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src)
|
|||||||
uint64_t now_us;
|
uint64_t now_us;
|
||||||
|
|
||||||
now_us = g_get_monotonic_time ();
|
now_us = g_get_monotonic_time ();
|
||||||
if (priv->video_format.max_framerate.num > 0 &&
|
if (priv->last_frame_timestamp_us != 0 &&
|
||||||
priv->last_frame_timestamp_us != 0 &&
|
|
||||||
(now_us - priv->last_frame_timestamp_us <
|
(now_us - priv->last_frame_timestamp_us <
|
||||||
((1000000 * priv->video_format.max_framerate.denom) /
|
((1000000 * priv->video_format.max_framerate.denom) /
|
||||||
priv->video_format.max_framerate.num)))
|
priv->video_format.max_framerate.num)))
|
||||||
@@ -542,6 +539,12 @@ meta_screen_cast_stream_src_disable (MetaScreenCastStreamSrc *src)
|
|||||||
priv->is_enabled = FALSE;
|
priv->is_enabled = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_screen_cast_stream_src_notify_closed (MetaScreenCastStreamSrc *src)
|
||||||
|
{
|
||||||
|
g_signal_emit (src, signals[CLOSED], 0);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_stream_state_changed (void *data,
|
on_stream_state_changed (void *data,
|
||||||
enum pw_stream_state old,
|
enum pw_stream_state old,
|
||||||
@@ -556,9 +559,7 @@ on_stream_state_changed (void *data,
|
|||||||
{
|
{
|
||||||
case PW_STREAM_STATE_ERROR:
|
case PW_STREAM_STATE_ERROR:
|
||||||
g_warning ("pipewire stream error: %s", error_message);
|
g_warning ("pipewire stream error: %s", error_message);
|
||||||
if (meta_screen_cast_stream_src_is_enabled (src))
|
meta_screen_cast_stream_src_notify_closed (src);
|
||||||
meta_screen_cast_stream_src_disable (src);
|
|
||||||
priv->emit_closed_after_dispatch = TRUE;
|
|
||||||
break;
|
break;
|
||||||
case PW_STREAM_STATE_PAUSED:
|
case PW_STREAM_STATE_PAUSED:
|
||||||
if (priv->node_id == SPA_ID_INVALID && priv->pipewire_stream)
|
if (priv->node_id == SPA_ID_INVALID && priv->pipewire_stream)
|
||||||
@@ -826,17 +827,11 @@ on_core_error (void *data,
|
|||||||
const char *message)
|
const char *message)
|
||||||
{
|
{
|
||||||
MetaScreenCastStreamSrc *src = data;
|
MetaScreenCastStreamSrc *src = data;
|
||||||
MetaScreenCastStreamSrcPrivate *priv =
|
|
||||||
meta_screen_cast_stream_src_get_instance_private (src);
|
|
||||||
|
|
||||||
g_warning ("pipewire remote error: id:%u %s", id, message);
|
g_warning ("pipewire remote error: id:%u %s", id, message);
|
||||||
|
|
||||||
if (id == PW_ID_CORE && res == -EPIPE)
|
if (id == PW_ID_CORE && res == -EPIPE)
|
||||||
{
|
meta_screen_cast_stream_src_notify_closed (src);
|
||||||
if (meta_screen_cast_stream_src_is_enabled (src))
|
|
||||||
meta_screen_cast_stream_src_disable (src);
|
|
||||||
priv->emit_closed_after_dispatch = TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@@ -853,18 +848,12 @@ pipewire_loop_source_dispatch (GSource *source,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MetaPipeWireSource *pipewire_source = (MetaPipeWireSource *) source;
|
MetaPipeWireSource *pipewire_source = (MetaPipeWireSource *) source;
|
||||||
MetaScreenCastStreamSrc *src = pipewire_source->src;
|
|
||||||
MetaScreenCastStreamSrcPrivate *priv =
|
|
||||||
meta_screen_cast_stream_src_get_instance_private (src);
|
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
result = pw_loop_iterate (pipewire_source->pipewire_loop, 0);
|
result = pw_loop_iterate (pipewire_source->pipewire_loop, 0);
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
g_warning ("pipewire_loop_iterate failed: %s", spa_strerror (result));
|
g_warning ("pipewire_loop_iterate failed: %s", spa_strerror (result));
|
||||||
|
|
||||||
if (priv->emit_closed_after_dispatch)
|
|
||||||
g_signal_emit (src, signals[CLOSED], 0);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -886,14 +875,13 @@ static GSourceFuncs pipewire_source_funcs =
|
|||||||
};
|
};
|
||||||
|
|
||||||
static MetaPipeWireSource *
|
static MetaPipeWireSource *
|
||||||
create_pipewire_source (MetaScreenCastStreamSrc *src)
|
create_pipewire_source (void)
|
||||||
{
|
{
|
||||||
MetaPipeWireSource *pipewire_source;
|
MetaPipeWireSource *pipewire_source;
|
||||||
|
|
||||||
pipewire_source =
|
pipewire_source =
|
||||||
(MetaPipeWireSource *) g_source_new (&pipewire_source_funcs,
|
(MetaPipeWireSource *) g_source_new (&pipewire_source_funcs,
|
||||||
sizeof (MetaPipeWireSource));
|
sizeof (MetaPipeWireSource));
|
||||||
pipewire_source->src = src;
|
|
||||||
pipewire_source->pipewire_loop = pw_loop_new (NULL);
|
pipewire_source->pipewire_loop = pw_loop_new (NULL);
|
||||||
if (!pipewire_source->pipewire_loop)
|
if (!pipewire_source->pipewire_loop)
|
||||||
{
|
{
|
||||||
@@ -925,7 +913,7 @@ meta_screen_cast_stream_src_initable_init (GInitable *initable,
|
|||||||
MetaScreenCastStreamSrcPrivate *priv =
|
MetaScreenCastStreamSrcPrivate *priv =
|
||||||
meta_screen_cast_stream_src_get_instance_private (src);
|
meta_screen_cast_stream_src_get_instance_private (src);
|
||||||
|
|
||||||
priv->pipewire_source = create_pipewire_source (src);
|
priv->pipewire_source = create_pipewire_source ();
|
||||||
if (!priv->pipewire_source)
|
if (!priv->pipewire_source)
|
||||||
{
|
{
|
||||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||||
@@ -996,8 +984,8 @@ meta_screen_cast_stream_src_finalize (GObject *object)
|
|||||||
if (meta_screen_cast_stream_src_is_enabled (src))
|
if (meta_screen_cast_stream_src_is_enabled (src))
|
||||||
meta_screen_cast_stream_src_disable (src);
|
meta_screen_cast_stream_src_disable (src);
|
||||||
|
|
||||||
g_clear_pointer (&priv->pipewire_stream, pw_stream_destroy);
|
|
||||||
g_clear_pointer (&priv->dmabuf_handles, g_hash_table_destroy);
|
g_clear_pointer (&priv->dmabuf_handles, g_hash_table_destroy);
|
||||||
|
g_clear_pointer (&priv->pipewire_stream, pw_stream_destroy);
|
||||||
g_clear_pointer (&priv->pipewire_core, pw_core_disconnect);
|
g_clear_pointer (&priv->pipewire_core, pw_core_disconnect);
|
||||||
g_clear_pointer (&priv->pipewire_context, pw_context_destroy);
|
g_clear_pointer (&priv->pipewire_context, pw_context_destroy);
|
||||||
g_source_destroy (&priv->pipewire_source->base);
|
g_source_destroy (&priv->pipewire_source->base);
|
||||||
|
|||||||
@@ -366,10 +366,6 @@ meta_backend_native_post_init (MetaBackend *backend)
|
|||||||
if (retval != 0)
|
if (retval != 0)
|
||||||
g_warning ("Failed to set RT scheduler: %m");
|
g_warning ("Failed to set RT scheduler: %m");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_WAYLAND
|
|
||||||
meta_backend_init_wayland (backend);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static MetaMonitorManager *
|
static MetaMonitorManager *
|
||||||
@@ -651,10 +647,6 @@ meta_backend_native_initable_init (GInitable *initable,
|
|||||||
if (!native->launcher)
|
if (!native->launcher)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
#ifdef HAVE_WAYLAND
|
|
||||||
meta_backend_init_wayland_display (META_BACKEND (native));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
native->udev = meta_udev_new (native);
|
native->udev = meta_udev_new (native);
|
||||||
native->barrier_manager = meta_barrier_manager_native_new ();
|
native->barrier_manager = meta_barrier_manager_native_new ();
|
||||||
|
|
||||||
|
|||||||
@@ -2168,11 +2168,7 @@ meta_renderer_native_create_dma_buf (CoglRenderer *cogl_renderer,
|
|||||||
case META_RENDERER_NATIVE_MODE_GBM:
|
case META_RENDERER_NATIVE_MODE_GBM:
|
||||||
{
|
{
|
||||||
CoglFramebuffer *dmabuf_fb;
|
CoglFramebuffer *dmabuf_fb;
|
||||||
CoglDmaBufHandle *dmabuf_handle;
|
|
||||||
struct gbm_bo *new_bo;
|
struct gbm_bo *new_bo;
|
||||||
int stride;
|
|
||||||
int offset;
|
|
||||||
int bpp;
|
|
||||||
int dmabuf_fd = -1;
|
int dmabuf_fd = -1;
|
||||||
|
|
||||||
new_bo = gbm_bo_create (renderer_gpu_data->gbm.device,
|
new_bo = gbm_bo_create (renderer_gpu_data->gbm.device,
|
||||||
@@ -2196,14 +2192,11 @@ meta_renderer_native_create_dma_buf (CoglRenderer *cogl_renderer,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
stride = gbm_bo_get_stride (new_bo);
|
|
||||||
offset = gbm_bo_get_offset (new_bo, 0);
|
|
||||||
bpp = 4;
|
|
||||||
dmabuf_fb = create_dma_buf_framebuffer (renderer_native,
|
dmabuf_fb = create_dma_buf_framebuffer (renderer_native,
|
||||||
dmabuf_fd,
|
dmabuf_fd,
|
||||||
width, height,
|
width, height,
|
||||||
stride,
|
gbm_bo_get_stride (new_bo),
|
||||||
offset,
|
gbm_bo_get_offset (new_bo, 0),
|
||||||
DRM_FORMAT_MOD_LINEAR,
|
DRM_FORMAT_MOD_LINEAR,
|
||||||
DRM_FORMAT_XRGB8888,
|
DRM_FORMAT_XRGB8888,
|
||||||
error);
|
error);
|
||||||
@@ -2211,13 +2204,8 @@ meta_renderer_native_create_dma_buf (CoglRenderer *cogl_renderer,
|
|||||||
if (!dmabuf_fb)
|
if (!dmabuf_fb)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
dmabuf_handle =
|
return cogl_dma_buf_handle_new (dmabuf_fb, dmabuf_fd, new_bo,
|
||||||
cogl_dma_buf_handle_new (dmabuf_fb, dmabuf_fd,
|
(GDestroyNotify) gbm_bo_destroy);
|
||||||
width, height, stride, offset, bpp,
|
|
||||||
new_bo,
|
|
||||||
(GDestroyNotify) gbm_bo_destroy);
|
|
||||||
cogl_object_unref (dmabuf_fb);
|
|
||||||
return dmabuf_handle;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#ifdef HAVE_EGL_DEVICE
|
#ifdef HAVE_EGL_DEVICE
|
||||||
@@ -3109,17 +3097,12 @@ should_force_shadow_fb (MetaRendererNative *renderer_native,
|
|||||||
MetaGpuKms *primary_gpu)
|
MetaGpuKms *primary_gpu)
|
||||||
{
|
{
|
||||||
MetaRenderer *renderer = META_RENDERER (renderer_native);
|
MetaRenderer *renderer = META_RENDERER (renderer_native);
|
||||||
CoglContext *cogl_context =
|
|
||||||
cogl_context_from_renderer_native (renderer_native);
|
|
||||||
int kms_fd;
|
int kms_fd;
|
||||||
uint64_t prefer_shadow = 0;
|
uint64_t prefer_shadow = 0;
|
||||||
|
|
||||||
if (meta_renderer_is_hardware_accelerated (renderer))
|
if (meta_renderer_is_hardware_accelerated (renderer))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!cogl_has_feature (cogl_context, COGL_FEATURE_ID_BLIT_FRAMEBUFFER))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
kms_fd = meta_gpu_kms_get_fd (primary_gpu);
|
kms_fd = meta_gpu_kms_get_fd (primary_gpu);
|
||||||
if (drmGetCap (kms_fd, DRM_CAP_DUMB_PREFER_SHADOW, &prefer_shadow) == 0)
|
if (drmGetCap (kms_fd, DRM_CAP_DUMB_PREFER_SHADOW, &prefer_shadow) == 0)
|
||||||
{
|
{
|
||||||
@@ -3159,7 +3142,7 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
|
|||||||
MetaMonitorTransform view_transform;
|
MetaMonitorTransform view_transform;
|
||||||
CoglOnscreen *onscreen = NULL;
|
CoglOnscreen *onscreen = NULL;
|
||||||
CoglOffscreen *offscreen = NULL;
|
CoglOffscreen *offscreen = NULL;
|
||||||
gboolean use_shadowfb;
|
CoglOffscreen *shadowfb = NULL;
|
||||||
float scale;
|
float scale;
|
||||||
int onscreen_width;
|
int onscreen_width;
|
||||||
int onscreen_height;
|
int onscreen_height;
|
||||||
@@ -3211,8 +3194,24 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
|
|||||||
g_error ("Failed to allocate back buffer texture: %s", error->message);
|
g_error ("Failed to allocate back buffer texture: %s", error->message);
|
||||||
}
|
}
|
||||||
|
|
||||||
use_shadowfb = should_force_shadow_fb (renderer_native,
|
if (should_force_shadow_fb (renderer_native,
|
||||||
renderer_native->primary_gpu_kms);
|
renderer_native->primary_gpu_kms))
|
||||||
|
{
|
||||||
|
int shadow_width;
|
||||||
|
int shadow_height;
|
||||||
|
|
||||||
|
/* The shadowfb must be the same size as the on-screen framebuffer */
|
||||||
|
shadow_width = cogl_framebuffer_get_width (COGL_FRAMEBUFFER (onscreen));
|
||||||
|
shadow_height = cogl_framebuffer_get_height (COGL_FRAMEBUFFER (onscreen));
|
||||||
|
|
||||||
|
shadowfb = meta_renderer_native_create_offscreen (renderer_native,
|
||||||
|
cogl_context,
|
||||||
|
shadow_width,
|
||||||
|
shadow_height,
|
||||||
|
&error);
|
||||||
|
if (!shadowfb)
|
||||||
|
g_error ("Failed to allocate shadow buffer texture: %s", error->message);
|
||||||
|
}
|
||||||
|
|
||||||
if (meta_is_stage_views_scaled ())
|
if (meta_is_stage_views_scaled ())
|
||||||
scale = meta_logical_monitor_get_scale (logical_monitor);
|
scale = meta_logical_monitor_get_scale (logical_monitor);
|
||||||
@@ -3223,15 +3222,15 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
|
|||||||
META_ROUNDING_STRATEGY_ROUND,
|
META_ROUNDING_STRATEGY_ROUND,
|
||||||
&view_layout);
|
&view_layout);
|
||||||
view = g_object_new (META_TYPE_RENDERER_VIEW,
|
view = g_object_new (META_TYPE_RENDERER_VIEW,
|
||||||
"name", meta_output_get_name (output),
|
|
||||||
"layout", &view_layout,
|
"layout", &view_layout,
|
||||||
"scale", scale,
|
"scale", scale,
|
||||||
"framebuffer", onscreen,
|
"framebuffer", onscreen,
|
||||||
"offscreen", offscreen,
|
"offscreen", offscreen,
|
||||||
"use-shadowfb", use_shadowfb,
|
"shadowfb", shadowfb,
|
||||||
"transform", view_transform,
|
"transform", view_transform,
|
||||||
NULL);
|
NULL);
|
||||||
g_clear_pointer (&offscreen, cogl_object_unref);
|
g_clear_pointer (&offscreen, cogl_object_unref);
|
||||||
|
g_clear_pointer (&shadowfb, cogl_object_unref);
|
||||||
|
|
||||||
meta_onscreen_native_set_view (onscreen, view);
|
meta_onscreen_native_set_view (onscreen, view);
|
||||||
|
|
||||||
|
|||||||
@@ -1380,6 +1380,35 @@ has_touchscreen (MetaSeatNative *seat)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
has_external_keyboard (MetaSeatNative *seat)
|
||||||
|
{
|
||||||
|
GList *devices, *l;
|
||||||
|
gboolean has_external = FALSE;
|
||||||
|
|
||||||
|
devices = g_udev_client_query_by_subsystem (seat->udev_client, "input");
|
||||||
|
|
||||||
|
for (l = devices; l; l = l->next)
|
||||||
|
{
|
||||||
|
if (!g_udev_device_has_property (l->data, "ID_INPUT_KEYBOARD"))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* May be "hid" or something else, we don't care. This property
|
||||||
|
* will not be present in virtual "AT Translated Set 2 keyboard"
|
||||||
|
* devices.
|
||||||
|
*/
|
||||||
|
if (!g_udev_device_has_property (l->data, "ID_TYPE"))
|
||||||
|
break;
|
||||||
|
|
||||||
|
has_external = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_list_free_full (devices, g_object_unref);
|
||||||
|
|
||||||
|
return has_external;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_touch_mode (MetaSeatNative *seat)
|
update_touch_mode (MetaSeatNative *seat)
|
||||||
{
|
{
|
||||||
@@ -1392,10 +1421,10 @@ update_touch_mode (MetaSeatNative *seat)
|
|||||||
else if (seat->has_tablet_switch && !seat->tablet_mode_switch_state)
|
else if (seat->has_tablet_switch && !seat->tablet_mode_switch_state)
|
||||||
touch_mode = FALSE;
|
touch_mode = FALSE;
|
||||||
/* If tablet mode is enabled, or if there is no tablet mode switch
|
/* If tablet mode is enabled, or if there is no tablet mode switch
|
||||||
* (eg. kiosk machines), assume touch-mode.
|
* (eg. kiosk machines), check availability of external keyboards.
|
||||||
*/
|
*/
|
||||||
else
|
else
|
||||||
touch_mode = TRUE;
|
touch_mode = !seat->has_external_keyboard;
|
||||||
|
|
||||||
if (seat->touch_mode != touch_mode)
|
if (seat->touch_mode != touch_mode)
|
||||||
{
|
{
|
||||||
@@ -1436,7 +1465,12 @@ evdev_add_device (MetaSeatNative *seat,
|
|||||||
|
|
||||||
g_signal_emit_by_name (seat, "device-added", device);
|
g_signal_emit_by_name (seat, "device-added", device);
|
||||||
|
|
||||||
if (type == CLUTTER_TOUCHSCREEN_DEVICE)
|
if (type == CLUTTER_KEYBOARD_DEVICE)
|
||||||
|
{
|
||||||
|
seat->has_external_keyboard = has_external_keyboard (seat);
|
||||||
|
check_touch_mode = TRUE;
|
||||||
|
}
|
||||||
|
else if (type == CLUTTER_TOUCHSCREEN_DEVICE)
|
||||||
{
|
{
|
||||||
seat->has_touchscreen = TRUE;
|
seat->has_touchscreen = TRUE;
|
||||||
check_touch_mode = TRUE;
|
check_touch_mode = TRUE;
|
||||||
@@ -1469,7 +1503,12 @@ evdev_remove_device (MetaSeatNative *seat,
|
|||||||
|
|
||||||
device_type = clutter_input_device_get_device_type (device);
|
device_type = clutter_input_device_get_device_type (device);
|
||||||
|
|
||||||
if (device_type == CLUTTER_TOUCHSCREEN_DEVICE)
|
if (device_type == CLUTTER_KEYBOARD_DEVICE)
|
||||||
|
{
|
||||||
|
seat->has_external_keyboard = has_external_keyboard (seat);
|
||||||
|
update_touch_mode (seat);
|
||||||
|
}
|
||||||
|
else if (device_type == CLUTTER_TOUCHSCREEN_DEVICE)
|
||||||
{
|
{
|
||||||
seat->has_touchscreen = has_touchscreen (seat);
|
seat->has_touchscreen = has_touchscreen (seat);
|
||||||
update_touch_mode (seat);
|
update_touch_mode (seat);
|
||||||
@@ -2514,6 +2553,7 @@ meta_seat_native_constructed (GObject *object)
|
|||||||
xkb_keymap_led_get_index (xkb_keymap, XKB_LED_NAME_SCROLL);
|
xkb_keymap_led_get_index (xkb_keymap, XKB_LED_NAME_SCROLL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
seat->has_external_keyboard = has_external_keyboard (seat);
|
||||||
seat->has_touchscreen = has_touchscreen (seat);
|
seat->has_touchscreen = has_touchscreen (seat);
|
||||||
update_touch_mode (seat);
|
update_touch_mode (seat);
|
||||||
|
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ struct _MetaSeatNative
|
|||||||
|
|
||||||
GUdevClient *udev_client;
|
GUdevClient *udev_client;
|
||||||
guint tablet_mode_switch_state : 1;
|
guint tablet_mode_switch_state : 1;
|
||||||
|
guint has_external_keyboard : 1;
|
||||||
guint has_touchscreen : 1;
|
guint has_touchscreen : 1;
|
||||||
guint has_tablet_switch : 1;
|
guint has_tablet_switch : 1;
|
||||||
guint touch_mode : 1;
|
guint touch_mode : 1;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user