Skip to content
Commits on Source (513)
# SPDX-FileCopyrightText: 2021 The GTK Authors
# SPDX-License-Identifier: CC0-1.0
root = true
[*]
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
[*.[ch]]
indent_size = 2
indent_style = space
insert_final_newline = true
# For the legacy tabs which still exist in the code:
tab_width = 8
[*.xml]
indent_size = 2
indent_style = space
[meson.build]
indent_size = 2
indent_style = space
[*.md]
max_line_length = 80
......@@ -3,6 +3,15 @@ include:
- remote: 'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/34f4ade99434043f88e164933f570301fd18b125/templates/ci-fairy.yml'
- project: 'Infrastructure/openshift-images/gnome-release-service'
file: '/ci-templates/release-module.yml'
- component: gitlab.gnome.org/GNOME/citemplates/gnomeos-build-sysext@1.0.0-alpha
inputs:
meson-options:
-Dxwayland_initfd=enabled
-Dprofiler=true
build-sysext:
before_script:
- .gitlab-ci/install-gnomeos-sysext-dependencies.sh $CI_PROJECT_DIR/extension
stages:
- review
......@@ -87,7 +96,7 @@ variables:
- .skip-git-clone
variables:
FDO_DISTRIBUTION_VERSION: 40
BASE_TAG: '2024-04-29.0'
BASE_TAG: '2024-07-16.0'
MUTTER_USER: 'meta-user'
FDO_DISTRIBUTION_PACKAGES:
asciidoc
......@@ -122,6 +131,7 @@ variables:
dnf builddep -y gnome-shell --setopt=install_weak_deps=False
dnf builddep -y kernel --setopt=install_weak_deps=False
dnf builddep -y gi-docgen --setopt=install_weak_deps=False
dnf builddep -y wayland --setopt=install_weak_deps=False
./.gitlab-ci/install-meson-project.sh \
https://gitlab.gnome.org/jadahl/catch.git \
......@@ -131,9 +141,17 @@ variables:
https://gitlab.gnome.org/GNOME/gi-docgen.git \
main
./.gitlab-ci/install-common-dependencies.sh
rpm -e --nodeps gnome-bluetooth-libs-devel \
mutter mutter-devel \
gnome-shell
gnome-shell \
gtk3
# Contains fixes needed for tests not included in 3.24.33
./.gitlab-ci/install-meson-project.sh \
https://gitlab.gnome.org/GNOME/gtk.git \
gtk-3-24 46fe3224dd771b91e6976d5a632b452e2179a4f0
# Work-around for podman-push aborting on permission issue
# https://gitlab.gnome.org/Infrastructure/Infrastructure/-/issues/1247
......@@ -355,6 +373,7 @@ check-code-style:
--warnlevel 2
-Dbuildtype=debugoptimized
-Db_coverage=true
-Ddocs=true
$BASE_MESON_OPTIONS
$EXTRA_MESON_OPTIONS
- meson compile -C build
......@@ -422,8 +441,29 @@ build-without-native-backend-and-wayland@x86_64:
-Dudev=false
-Dwayland=false
-Dxwayland=false
-Dcore_tests=false
-Dnative_tests=false
-Dtests=disabled
-Dintrospection=false
- meson compile -C build
- sudo meson install --no-rebuild -C build
artifacts:
paths:
- build/meson-logs
build-wayland-xwayland@x86_64:
extends:
- .mutter.distribution-image
- .mutter.fedora@x86_64
stage: build
needs:
- job: build-fedora-container@x86_64
artifacts: false
script:
- meson setup . build --werror --prefix /usr
-Dbuildtype=debugoptimized
-Dwayland=true
-Dxwayland=true
-Dx11=false
-Dtests=disabled
-Dintrospection=false
- meson compile -C build
- sudo meson install --no-rebuild -C build
......@@ -444,8 +484,8 @@ build-wayland-only@x86_64:
-Dbuildtype=debugoptimized
-Dwayland=true
-Dxwayland=false
-Dcore_tests=false
-Dnative_tests=false
-Dx11=false
-Dtests=disabled
-Dintrospection=false
- meson compile -C build
- sudo meson install --no-rebuild -C build
......@@ -455,7 +495,6 @@ build-wayland-only@x86_64:
.test-setup:
variables:
XDG_RUNTIME_DIR: "$CI_PROJECT_DIR/runtime-dir"
GSETTINGS_SCHEMA_DIR: "$CI_PROJECT_DIR/build/data"
MUTTER_DEBUG_DUMMY_MODE_SPECS: "800x600@10.0"
PIPEWIRE_DEBUG: 2
......@@ -467,9 +506,6 @@ build-wayland-only@x86_64:
GTK_A11Y: "none"
before_script:
- !reference [.mutter.git-clone, before_script]
# Disable e.g. audio support to not dead lock screen cast tests
- mkdir -m 700 $XDG_RUNTIME_DIR
- pipewire & sleep 2
.test-mutter-base:
extends:
......@@ -500,9 +536,11 @@ build-wayland-only@x86_64:
- .test-mutter-base
script:
- glib-compile-schemas $GSETTINGS_SCHEMA_DIR
- xvfb-run -a -s "$XVFB_SERVER_ARGS"
./src/tests/meta-dbus-runner.py
- mkdir -m 1777 /tmp/.X11-unix
- ./src/tests/meta-dbus-runner.py
--launch=pipewire
--launch=wireplumber
--
meson test
-C build
--setup plain
......@@ -596,7 +634,14 @@ can-run-gnome-shell@x86_64:
- .gitlab-ci/checkout-gnome-shell.sh
- meson setup gnome-shell gnome-shell/build --prefix /usr -Dbuildtype=debugoptimized -Dman=false --werror --fatal-meson-warnings
- sudo meson install -C gnome-shell/build
- dbus-run-session -- xvfb-run meson test -C gnome-shell/build --no-rebuild --timeout-multiplier 5
- mkdir -m 1777 /tmp/.X11-unix
- dbus-run-session -- meson test -C gnome-shell/build --no-rebuild --timeout-multiplier 5
artifacts:
expire_in: 7 day
name: "mutter-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: on_failure
paths:
- gnome-shell/build/meson-logs
test-mutter-coverity:
rules:
......@@ -661,9 +706,11 @@ dist-mutter:
- meson setup . build --werror --prefix /usr
-Dbuildtype=debugoptimized
- glib-compile-schemas $GSETTINGS_SCHEMA_DIR
- xvfb-run -a -s "$XVFB_SERVER_ARGS"
./src/tests/meta-dbus-runner.py
- mkdir -m 1777 /tmp/.X11-unix
- ./src/tests/meta-dbus-runner.py
--launch=pipewire
--launch=wireplumber
--
meson dist -C build
artifacts:
expire_in: 7 day
......@@ -711,11 +758,8 @@ reference:
- .mutter.fedora@x86_64
stage: docs
needs:
- job: build-fedora-container@x86_64
artifacts: false
- build-mutter@x86_64
script:
- meson setup . build --werror -Ddocs=true -Dtests=false
- ninja -C build
- mkdir references
- cp -r doc/website/* ./references
- mv build/doc/reference/{cally/cally,clutter/clutter,cogl/cogl,cogl-pango/cogl-pango,meta/meta,mtk/mtk} references/
......
#!/bin/bash
set -e
usage() {
cat <<-EOF
Usage: $(basename $0) [OPTION…]
Install common dependencies to a base image or system extension
Options:
--libdir Setup the projects with a different libdir
--destdir Install the projects to an additional destdir
-h, --help Display this help
EOF
}
TEMP=$(getopt \
--name=$(basename $0) \
--options='' \
--longoptions='libdir:' \
--longoptions='destdir:' \
--longoptions='help' \
-- "$@")
eval set -- "$TEMP"
unset TEMP
OPTIONS=()
while true; do
case "$1" in
--libdir)
OPTIONS+=( --libdir=$2 )
shift 2
;;
--destdir)
OPTIONS+=( --destdir=$2 )
shift 2
;;
-h|--help)
usage
exit 0
;;
--)
shift
break
;;
esac
done
SCRIPTS_DIR="$(dirname $0)"
if ! pkgconf --atleast-version 1.23.0 wayland-server
then
./$SCRIPTS_DIR/install-meson-project.sh \
"${OPTIONS[@]}" \
https://gitlab.freedesktop.org/wayland/wayland.git \
1.23.0
fi
if ! pkgconf --atleast-version 1.36 wayland-protocols
then
./$SCRIPTS_DIR/install-meson-project.sh \
"${OPTIONS[@]}" \
https://gitlab.freedesktop.org/wayland/wayland-protocols.git \
1.36
fi
if ! gsettings get org.gnome.desktop.interface accent-color >/dev/null 2>&1
then
./$SCRIPTS_DIR/install-meson-project.sh \
"${OPTIONS[@]}" \
https://gitlab.gnome.org/GNOME/gsettings-desktop-schemas.git \
master
fi
#!/bin/bash
set -e
SCRIPTS_DIR="$(dirname $0)"
# Location for dependencies to be bundled with the extension
DESTDIR="$(realpath $1)"
# GNOME OS specific setup arguments
LIBDIR="lib/$(gcc -print-multiarch)"
# Install common dependencies
./$SCRIPTS_DIR/install-common-dependencies.sh --libdir=$LIBDIR --destdir=$DESTDIR
# Install below missing dependencies that are exclusive to GNOME OS
......@@ -12,6 +12,8 @@ usage() {
-Dkey=val Option to pass on to meson
--subdir Build subdirectory instead of whole project
--prepare Script to run before build
--libdir Setup the project with a different libdir
--destdir Install the project to an additional destdir
-h, --help Display this help
......@@ -23,6 +25,8 @@ TEMP=$(getopt \
--options='D:h' \
--longoptions='subdir:' \
--longoptions='prepare:' \
--longoptions='libdir:' \
--longoptions='destdir:' \
--longoptions='help' \
-- "$@")
......@@ -32,6 +36,7 @@ unset TEMP
MESON_OPTIONS=()
SUBDIR=.
PREPARE=:
DESTDIR=""
while true; do
case "$1" in
......@@ -50,6 +55,16 @@ while true; do
shift 2
;;
--libdir)
MESON_OPTIONS+=( --libdir=$2 )
shift 2
;;
--destdir)
DESTDIR=$2
shift 2
;;
-h|--help)
usage
exit 0
......@@ -78,5 +93,11 @@ git clone --depth 1 "$REPO_URL" -b "$COMMIT" "$CHECKOUT_DIR"
pushd "$CHECKOUT_DIR/$SUBDIR"
sh -c "$PREPARE"
meson setup --prefix=/usr _build "${MESON_OPTIONS[@]}"
meson install -C _build
# Install it to an additional directory e.g., system extension directory
if [ -n "${DESTDIR}" ]; then
sudo meson install -C _build --destdir=$DESTDIR
fi
sudo meson install -C _build
popd
46.4
====
* Fix nested popovers on wayland [Carlos; !3874]
* Misc. bug fixes and cleanups [Robert, Jonas; !3906, !3329]
Contributors:
Jonas Ådahl, Carlos Garnacho, Robert Mader
Translators:
Jürgen Benvenuti [de], Chao-Hsiung Liao [zh_TW]
46.3.1
======
47.beta
=======
* Fix visibility of Xwayland windows [Michel; !3862]
* Misc. bug fixes [Marco; !2959]
Contributors:
Michel Dänzer, Marco Trevisan (Treviño)
46.3
====
* Fix performance issues with second virtual monitor [Jonas; !3803]
* Fix missing unmap animation of some windows [Michel; !3840]
* Fix placement/resizing regression [Jonas; #2616]
* Fix possible out of sync primary selections and clipboard [Carlos; !3789]
* Fix ibus support in popups [Sebastian K.; !3787]
* Fix hardware accelerated rendering when headless [Jonas; !3805]
* Add back support for legacy X11 cursor themes [Daniel; !3718]
* Fix preedit offsets [Orko; !3845]
* Use character offsets to specify surrounding text [Shiki; !3719]
* Don't force titlebar on screen on all interactive resizes [Jeffrey; !3764]
* Fixed crashes [Carlos, Sebastian W., Michel; !3729, !3783, !3849]
* Misc. bug fixes and cleanups [Daniel, Philip, Marco, José, Jonas, Pascal,
Corentin; #3368, !3770, !3788, !3791, !3809, !3811, !3827, !3790]
Contributors:
Jonas Ådahl, Michel Dänzer, José Expósito, Orko Garai, Carlos Garnacho,
Sebastian Keller, Jeffrey Knockel, Corentin Noël, Pascal Nowack,
Shiki Okasaka, Marco Trevisan (Treviño), Daniel van Vugt, Sebastian Wick,
Philip Withnall
* Add plumbing for transforming color state [Jonas; !3433]
* Build and publish GNOME OS systemd-sysext extensions [Martin; !3843]
* Implement support for tablet tool keybindings and actions [Peter; !3649]
* Add support for tablet tool pressure ranges [Peter; !3794]
* Improve sticky behavior with transient dialogs [Jonas; !3870]
* Improve placement and focus logic with always-on-top windows [Jonas; !3879]
* Expose Orientationmanager to introspection [Ivan; !3880]
* Recover from secondary GPU update failures [Daniel; !3817]
* Plugged leaks [Sebastian K.; !3884, !3888]
* Misc. bug fixes and cleanups [Carlos, Michel, Sebastian W., Pascal, Florian,
Martin, Bilal, Daniel, Jonas, Robert; !3860, !3848, !3867, !3869, !3871,
!3740, !3872, !3883, !3857, !3885, !3891, !3895, !3898, !3896, !3887, !3901,
!3897, !3902, !3329, !3894, !3903, !3906, !3909, !3905, !3910]
Contributors:
Jonas Ådahl, Michel Dänzer, Bilal Elmoussaoui, Carlos Garnacho,
Peter Hutterer, Sebastian Keller, Ivan Kuzmenko, Martin Abente Lahaye,
Robert Mader, Florian Müllner, Pascal Nowack, Daniel van Vugt, Sebastian Wick
Translators:
Scrambled 777 [hi], Jose Riha [sk], Pawan Chitrakar [ne], Милош Поповић [sr]
Chao-Hsiung Liao [zh_TW]
46.2
====
* Fix hardware cursor with non-atomic KMS drivers [Daniel; !3676]
* Fix night light state getting stuck on monitor changes [Michel; !3742]
47.alpha
========
* Fix sending preferred buffer transform [Robert; !3717]
* Fix key press events with immediate release being ignored [Carlos; !3721]
* Fix hardware cursor with non-atomic KMS drivers [Daniel; !3676]
* Fix night light state getting stuck on monitor changes [Michel; !3742]
* Fix unsetting clipboard on screen lock [Florian; !3752]
* Fix wrong input region of undecorated X11 windows [Sebastian K.; !3720]
* Fix windows potentially shrinking unexpectedly on configure [Jonas Å.; !3755]
* Implement XDG dialog protocol [Carlos; !3557]
* Fix popup menus sometimes closing immediately [Jonas D.; !3631]
* Fixed crashes [Michel, Carlos, Keyu, Jonas Å., Sebastian K.; !3725, !3763,
!3715, !3711, !3758, !3749]
* Misc. bug fixes and cleanups [Florian, Echo, Michel, Jonas Å., Sebastian W.,
Corentin, Bilal; !3723, !3744, !3737, !3743, !3735, !3731, !3700, !3750,
!3757, !3754, !3748, !3730, !3775]
Contributors:
Jonas Ådahl, Michel Dänzer, Jonas Dreßler, Bilal Elmoussaoui, Carlos Garnacho,
Echo J, Sebastian Keller, Robert Mader, Florian Müllner, Corentin Noël,
Keyu Tao, Marco Trevisan (Treviño), Daniel van Vugt, Sebastian Wick
* Allow building without X11 support [Bilal; !3607, !3765, !3254, !3776, !3853]
* Emit signal when accelerator is deactivated [dcz; !3680]
* Fix wrong pointer cursor during compositor grabs [Carlos; !3736]
* Fix possible out of sync primary selections and clipboard [Carlos; !3789]
* Improve monitor matching when restoring windows on hotplug [Jonas Å.; !3753]
* Add support for SIZE_HINTS cursor plane property [adarshgm; !3165]
* Fix ibus support in popups [Sebastian K.; !3787]
* Delay xdg-activation requests until window is mapped [Sebastian W.; !3728]
* Fix hardware accelerated rendering when headless [Jonas Å.; !3805]
* Merge ClutterColor and CoglColor [Bilal; !3796, !3802, !3544]
* Fix performance issues with second virtual monitor [Jonas Å.; !3803]
* Add back support for legacy X11 cursor themes [Daniel; !3718]
* Add support for DRM lease protocol [Sebastian W., Jonas Å., José; !3746]
* Base test backend on native backend instead of X11 [Jonas Å.; !3812]
* Fix missing unmap animation of some windows [Michel; !3840]
* Fix preedit offsets [Orko; !3845]
* Use character offsets to specify surrounding text [Shiki; !3719]
* Don't force titlebar on screen on all interactive resizes [Jeffrey; !3764]
* Fixed crashes [Carlos, Michel, Keyu, Jonas Å., Sebastian K., Marco, Georges,
Sebastian W.; !3715, !3725, !3711, !3758, !3763, !3749, !3732, !3729, !3828,
!3783, !3849]
* Misc. bug fixes and cleanups [Mart, Florian, Marco, Jonas Å., Sebastian W.,
Bilal, Michel, Corentin, Georges, Philip, Daniel, Jonas D., José, Pascal,
Carlos; !3716, !3723, !3727, !3735, !3731, !3378, !3700, !3743, !3750, !3701,
!3757, !3754, !3748, !3759, !3761, !3762, !3730, !3737, !3771, !3775, !3770,
!3768, !3781, !3782, !3784, !3788, !3791, !2959, !3792, !3265, !3801, !3804,
!3795, !3693, !3793, !3800, !3115, !3806, !3809, !3810, !3816, !3811, !3667,
!3799, !3823, !3818, !3813, !3814, !3807, !3827, !3826, !3831, !3829, !3830,
!3798, !3833, !3836, !3837, !3835, !3820, !3822, #3540, !3842, !3851, !3747,
!3790]
Contributors:
Jonas Ådahl, adarshgm, Michel Dänzer, dcz, Jonas Dreßler, Bilal Elmoussaoui,
José Expósito, Orko Garai, Carlos Garnacho, Sebastian Keller, Jeffrey Knockel,
Robert Mader, Florian Müllner, Georges Basile Stavracas Neto, Corentin Noël,
Pascal Nowack, Shiki Okasaka, Mart Raudsepp, Keyu Tao,
Marco Trevisan (Treviño), Daniel van Vugt, Sebastian Wick, Philip Withnall
Translators:
Hugo Carvalho [pt], Leônidas Araújo [pt_BR]
Hugo Carvalho [pt], Leônidas Araújo [pt_BR], Scrambled 777 [hi],
Jose Riha [sk], Милош Поповић [sr]
46.1
====
......
......@@ -48,6 +48,11 @@ documentation and API references below first.
- CoglPango: <https://mutter.gnome.org/cogl-pango/>
- Mtk: <https://mutter.gnome.org/mtk/>
## Meetings
There are [recurring meetings](https://hedgedoc.gnome.org/s/ymP_L5MUs) to
discuss development of GNOME Shell, mutter and related components.
## License
Mutter is distributed under the terms of the GNU General Public License,
......
......@@ -78,31 +78,6 @@
#include "cally/cally-actor.h"
#include "cally/cally-actor-private.h"
typedef struct _CallyActorActionInfo CallyActorActionInfo;
/*< private >
* CallyActorActionInfo:
* @name: name of the action
* @description: description of the action
* @keybinding: keybinding related to the action
* @do_action_func: callback
* @user_data: data to be passed to @do_action_func
* @notify: function to be called when removing the action
*
* Utility structure to maintain the different actions added to the
* #CallyActor
*/
struct _CallyActorActionInfo
{
gchar *name;
gchar *description;
gchar *keybinding;
CallyActionCallback do_action_func;
gpointer user_data;
GDestroyNotify notify;
};
static void cally_actor_initialize (AtkObject *obj,
gpointer data);
static void cally_actor_finalize (GObject *obj);
......@@ -123,12 +98,6 @@ static gint cally_actor_add_actor (ClutterActor *container,
static gint cally_actor_remove_actor (ClutterActor *container,
ClutterActor *actor,
gpointer data);
static gint cally_actor_real_add_actor (ClutterActor *container,
ClutterActor *actor,
gpointer data);
static gint cally_actor_real_remove_actor (ClutterActor *container,
ClutterActor *actor,
gpointer data);
/* AtkComponent.h */
static void cally_actor_component_interface_init (AtkComponentIface *iface);
......@@ -141,27 +110,6 @@ static void cally_actor_get_extents (AtkComponent *component,
static gint cally_actor_get_mdi_zorder (AtkComponent *component);
static gboolean cally_actor_grab_focus (AtkComponent *component);
/* AtkAction.h */
static void cally_actor_action_interface_init (AtkActionIface *iface);
static gboolean cally_actor_action_do_action (AtkAction *action,
gint i);
static gboolean idle_do_action (gpointer data);
static gint cally_actor_action_get_n_actions (AtkAction *action);
static const gchar* cally_actor_action_get_description (AtkAction *action,
gint i);
static const gchar* cally_actor_action_get_keybinding (AtkAction *action,
gint i);
static const gchar* cally_actor_action_get_name (AtkAction *action,
gint i);
static gboolean cally_actor_action_set_description (AtkAction *action,
gint i,
const gchar *desc);
static void _cally_actor_destroy_action_info (gpointer action_info,
gpointer user_data);
static void _cally_actor_clean_action_list (CallyActor *cally_actor);
static CallyActorActionInfo* _cally_actor_get_action_info (CallyActor *cally_actor,
gint index);
/* Misc functions */
static void cally_actor_notify_clutter (GObject *obj,
GParamSpec *pspec);
......@@ -170,10 +118,6 @@ static void cally_actor_real_notify_clutter (GObject *obj,
struct _CallyActorPrivate
{
GQueue *action_queue;
guint action_idle_handler;
GList *action_list;
GList *children;
};
......@@ -182,9 +126,7 @@ G_DEFINE_TYPE_WITH_CODE (CallyActor,
ATK_TYPE_GOBJECT_ACCESSIBLE,
G_ADD_PRIVATE (CallyActor)
G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT,
cally_actor_component_interface_init)
G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION,
cally_actor_action_interface_init));
cally_actor_component_interface_init));
/**
* cally_actor_new:
......@@ -263,8 +205,6 @@ cally_actor_class_init (CallyActorClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
klass->notify_clutter = cally_actor_real_notify_clutter;
klass->add_actor = cally_actor_real_add_actor;
klass->remove_actor = cally_actor_real_remove_actor;
/* GObject */
gobject_class->finalize = cally_actor_finalize;
......@@ -283,12 +223,6 @@ static void
cally_actor_init (CallyActor *cally_actor)
{
CallyActorPrivate *priv = cally_actor_get_instance_private (cally_actor);
priv->action_queue = NULL;
priv->action_idle_handler = 0;
priv->action_list = NULL;
priv->children = NULL;
}
......@@ -301,15 +235,6 @@ cally_actor_finalize (GObject *obj)
cally_actor = CALLY_ACTOR (obj);
priv = cally_actor_get_instance_private (cally_actor);
_cally_actor_clean_action_list (cally_actor);
g_clear_handle_id (&priv->action_idle_handler, g_source_remove);
if (priv->action_queue)
{
g_queue_free (priv->action_queue);
}
if (priv->children)
{
g_list_free (priv->children);
......@@ -523,43 +448,9 @@ cally_actor_add_actor (ClutterActor *container,
ClutterActor *actor,
gpointer data)
{
CallyActor *cally_actor = CALLY_ACTOR (data);
CallyActorClass *klass = NULL;
klass = CALLY_ACTOR_GET_CLASS (cally_actor);
if (klass->add_actor)
return klass->add_actor (container, actor, data);
else
return 1;
}
static gint
cally_actor_remove_actor (ClutterActor *container,
ClutterActor *actor,
gpointer data)
{
CallyActor *cally_actor = CALLY_ACTOR (data);
CallyActorClass *klass = NULL;
klass = CALLY_ACTOR_GET_CLASS (cally_actor);
if (klass->remove_actor)
return klass->remove_actor (container, actor, data);
else
return 1;
}
static gint
cally_actor_real_add_actor (ClutterActor *container,
ClutterActor *actor,
gpointer data)
{
AtkObject *atk_parent = ATK_OBJECT (data);
AtkObject *atk_parent = clutter_actor_get_accessible (container);
AtkObject *atk_child = clutter_actor_get_accessible (actor);
CallyActor *cally_actor = CALLY_ACTOR (atk_parent);
CallyActorPrivate *priv = cally_actor_get_instance_private (cally_actor);
CallyActorPrivate *priv = cally_actor_get_instance_private (CALLY_ACTOR (atk_parent));
gint index;
g_return_val_if_fail (CLUTTER_IS_ACTOR (container), 0);
......@@ -579,34 +470,35 @@ cally_actor_real_add_actor (ClutterActor *container,
}
static gint
cally_actor_real_remove_actor (ClutterActor *container,
cally_actor_remove_actor (ClutterActor *container,
ClutterActor *actor,
gpointer data)
{
g_autoptr (AtkObject) atk_child = NULL;
AtkPropertyValues values = { NULL };
AtkObject *atk_parent = NULL;
AtkObject *atk_child = NULL;
CallyActorPrivate *priv = NULL;
gint index;
g_return_val_if_fail (CLUTTER_IS_ACTOR (container), 0);
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), 0);
atk_parent = ATK_OBJECT (data);
atk_parent = clutter_actor_get_accessible (container);
if (clutter_actor_has_accessible (actor))
{
atk_child = clutter_actor_get_accessible (actor);
g_assert (ATK_IS_OBJECT (atk_child));
g_object_ref (atk_child);
g_value_init (&values.old_value, G_TYPE_POINTER);
g_value_set_pointer (&values.old_value, atk_parent);
values.property_name = "accessible-parent";
g_object_ref (atk_child);
g_signal_emit_by_name (atk_child,
"property_change::accessible-parent", &values, NULL);
g_object_unref (atk_child);
}
priv = cally_actor_get_instance_private (CALLY_ACTOR (atk_parent));
......@@ -666,10 +558,10 @@ cally_actor_get_extents (AtkComponent *component,
clutter_actor_get_abs_allocation_vertices (actor, verts);
clutter_actor_get_transformed_size (actor, &f_width, &f_height);
*x = verts[0].x;
*y = verts[0].y;
*width = ceilf (f_width);
*height = ceilf (f_height);
*x = (int) verts[0].x;
*y = (int) verts[0].y;
*width = (int) ceilf (f_width);
*height = (int) ceilf (f_height);
}
static gint
......@@ -683,7 +575,7 @@ cally_actor_get_mdi_zorder (AtkComponent *component)
cally_actor = CALLY_ACTOR(component);
actor = CALLY_GET_CLUTTER_ACTOR (cally_actor);
return clutter_actor_get_z_position (actor);
return (int) clutter_actor_get_z_position (actor);
}
static gboolean
......@@ -706,179 +598,6 @@ cally_actor_grab_focus (AtkComponent *component)
return TRUE;
}
/* AtkAction implementation */
static void
cally_actor_action_interface_init (AtkActionIface *iface)
{
g_return_if_fail (iface != NULL);
iface->do_action = cally_actor_action_do_action;
iface->get_n_actions = cally_actor_action_get_n_actions;
iface->get_description = cally_actor_action_get_description;
iface->get_keybinding = cally_actor_action_get_keybinding;
iface->get_name = cally_actor_action_get_name;
iface->set_description = cally_actor_action_set_description;
}
static gboolean
cally_actor_action_do_action (AtkAction *action,
gint index)
{
CallyActor *cally_actor = NULL;
AtkStateSet *set = NULL;
CallyActorPrivate *priv = NULL;
CallyActorActionInfo *info = NULL;
gboolean did_action = FALSE;
cally_actor = CALLY_ACTOR (action);
priv = cally_actor_get_instance_private (cally_actor);
set = atk_object_ref_state_set (ATK_OBJECT (cally_actor));
if (atk_state_set_contains_state (set, ATK_STATE_DEFUNCT))
goto out;
if (!atk_state_set_contains_state (set, ATK_STATE_SENSITIVE) ||
!atk_state_set_contains_state (set, ATK_STATE_SHOWING))
goto out;
info = _cally_actor_get_action_info (cally_actor, index);
if (info == NULL)
goto out;
if (info->do_action_func == NULL)
goto out;
if (!priv->action_queue)
priv->action_queue = g_queue_new ();
g_queue_push_head (priv->action_queue, info);
if (!priv->action_idle_handler)
priv->action_idle_handler = g_idle_add (idle_do_action, cally_actor);
did_action = TRUE;
out:
g_clear_object (&set);
return did_action;
}
static gboolean
idle_do_action (gpointer data)
{
CallyActor *cally_actor = NULL;
CallyActorPrivate *priv = NULL;
ClutterActor *actor = NULL;
cally_actor = CALLY_ACTOR (data);
priv = cally_actor_get_instance_private (cally_actor);
actor = CALLY_GET_CLUTTER_ACTOR (cally_actor);
priv->action_idle_handler = 0;
if (actor == NULL) /* state is defunct*/
return FALSE;
while (!g_queue_is_empty (priv->action_queue))
{
CallyActorActionInfo *info = NULL;
info = (CallyActorActionInfo *) g_queue_pop_head (priv->action_queue);
info->do_action_func (cally_actor, info->user_data);
}
return FALSE;
}
static gint
cally_actor_action_get_n_actions (AtkAction *action)
{
CallyActor *cally_actor = NULL;
CallyActorPrivate *priv = NULL;
g_return_val_if_fail (CALLY_IS_ACTOR (action), 0);
cally_actor = CALLY_ACTOR (action);
priv = cally_actor_get_instance_private (cally_actor);
return g_list_length (priv->action_list);
}
static const gchar*
cally_actor_action_get_name (AtkAction *action,
gint i)
{
CallyActor *cally_actor = NULL;
CallyActorActionInfo *info = NULL;
g_return_val_if_fail (CALLY_IS_ACTOR (action), NULL);
cally_actor = CALLY_ACTOR (action);
info = _cally_actor_get_action_info (cally_actor, i);
if (info == NULL)
return NULL;
return info->name;
}
static const gchar*
cally_actor_action_get_description (AtkAction *action,
gint i)
{
CallyActor *cally_actor = NULL;
CallyActorActionInfo *info = NULL;
g_return_val_if_fail (CALLY_IS_ACTOR (action), NULL);
cally_actor = CALLY_ACTOR (action);
info = _cally_actor_get_action_info (cally_actor, i);
if (info == NULL)
return NULL;
return info->description;
}
static gboolean
cally_actor_action_set_description (AtkAction *action,
gint i,
const gchar *desc)
{
CallyActor *cally_actor = NULL;
CallyActorActionInfo *info = NULL;
g_return_val_if_fail (CALLY_IS_ACTOR (action), FALSE);
cally_actor = CALLY_ACTOR (action);
info = _cally_actor_get_action_info (cally_actor, i);
if (info == NULL)
return FALSE;
g_free (info->description);
info->description = g_strdup (desc);
return TRUE;
}
static const gchar*
cally_actor_action_get_keybinding (AtkAction *action,
gint i)
{
CallyActor *cally_actor = NULL;
CallyActorActionInfo *info = NULL;
g_return_val_if_fail (CALLY_IS_ACTOR (action), NULL);
cally_actor = CALLY_ACTOR (action);
info = _cally_actor_get_action_info (cally_actor, i);
if (info == NULL)
return NULL;
return info->keybinding;
}
/* Misc functions */
/*
......@@ -945,202 +664,3 @@ cally_actor_real_notify_clutter (GObject *obj,
atk_object_notify_state_change (atk_obj, state, value);
}
static void
_cally_actor_clean_action_list (CallyActor *cally_actor)
{
CallyActorPrivate *priv = NULL;
priv = cally_actor_get_instance_private (cally_actor);
if (priv->action_list)
{
g_list_free_full (priv->action_list,
(GDestroyNotify) _cally_actor_destroy_action_info);
priv->action_list = NULL;
}
}
static CallyActorActionInfo *
_cally_actor_get_action_info (CallyActor *cally_actor,
gint index)
{
CallyActorPrivate *priv = NULL;
GList *node = NULL;
g_return_val_if_fail (CALLY_IS_ACTOR (cally_actor), NULL);
priv = cally_actor_get_instance_private (cally_actor);
if (priv->action_list == NULL)
return NULL;
node = g_list_nth (priv->action_list, index);
if (node == NULL)
return NULL;
return (CallyActorActionInfo *)(node->data);
}
/**
* cally_actor_add_action: (skip)
* @cally_actor: a #CallyActor
* @action_name: the action name
* @action_description: the action description
* @action_keybinding: the action keybinding
* @action_func: the callback of the action, to be executed with do_action
*
* Adds a new action to be accessed with the #AtkAction interface.
*
* Return value: added action id, or -1 if failure
*/
guint
cally_actor_add_action (CallyActor *cally_actor,
const gchar *action_name,
const gchar *action_description,
const gchar *action_keybinding,
CallyActionFunc action_func)
{
return cally_actor_add_action_full (cally_actor,
action_name,
action_description,
action_keybinding,
(CallyActionCallback) action_func,
NULL, NULL);
}
/**
* cally_actor_add_action_full: (rename-to cally_actor_add_action)
* @cally_actor: a #CallyActor
* @action_name: the action name
* @action_description: the action description
* @action_keybinding: the action keybinding
* @callback: (scope notified): the callback of the action
* @user_data: (closure): data to be passed to @callback
* @notify: function to be called when removing the action
*
* Adds a new action to be accessed with the #AtkAction interface.
*
* Return value: added action id, or -1 if failure
*/
guint
cally_actor_add_action_full (CallyActor *cally_actor,
const gchar *action_name,
const gchar *action_description,
const gchar *action_keybinding,
CallyActionCallback callback,
gpointer user_data,
GDestroyNotify notify)
{
CallyActorActionInfo *info = NULL;
CallyActorPrivate *priv = NULL;
g_return_val_if_fail (CALLY_IS_ACTOR (cally_actor), -1);
g_return_val_if_fail (callback != NULL, -1);
priv = cally_actor_get_instance_private (cally_actor);
info = g_new0 (CallyActorActionInfo, 1);
info->name = g_strdup (action_name);
info->description = g_strdup (action_description);
info->keybinding = g_strdup (action_keybinding);
info->do_action_func = callback;
info->user_data = user_data;
info->notify = notify;
priv->action_list = g_list_append (priv->action_list, info);
return g_list_length (priv->action_list);
}
/**
* cally_actor_remove_action:
* @cally_actor: a #CallyActor
* @action_id: the action id
*
* Removes a action, using the @action_id returned by [method@Actor.add_action]
*
* Return value: %TRUE if the operation was successful, %FALSE otherwise
*/
gboolean
cally_actor_remove_action (CallyActor *cally_actor,
gint action_id)
{
GList *list_node = NULL;
CallyActorPrivate *priv = NULL;
g_return_val_if_fail (CALLY_IS_ACTOR (cally_actor), FALSE);
priv = cally_actor_get_instance_private (cally_actor);
list_node = g_list_nth (priv->action_list, action_id - 1);
if (!list_node)
return FALSE;
_cally_actor_destroy_action_info (list_node->data, NULL);
priv->action_list = g_list_remove_link (priv->action_list, list_node);
return TRUE;
}
/**
* cally_actor_remove_action_by_name:
* @cally_actor: a #CallyActor
* @action_name: the name of the action to remove
*
* Removes an action, using the @action_name used when the action was added
* with [method@Actor.add_action]
*
* Return value: %TRUE if the operation was successful, %FALSE otherwise
*/
gboolean
cally_actor_remove_action_by_name (CallyActor *cally_actor,
const gchar *action_name)
{
GList *node = NULL;
gboolean action_found = FALSE;
CallyActorPrivate *priv = NULL;
g_return_val_if_fail (CALLY_IS_ACTOR (cally_actor), FALSE);
priv = cally_actor_get_instance_private (cally_actor);
for (node = priv->action_list; node && !action_found;
node = node->next)
{
CallyActorActionInfo *ainfo = node->data;
if (!g_ascii_strcasecmp (ainfo->name, action_name))
{
action_found = TRUE;
break;
}
}
if (!action_found)
return FALSE;
_cally_actor_destroy_action_info (node->data, NULL);
priv->action_list = g_list_remove_link (priv->action_list, node);
return TRUE;
}
static void
_cally_actor_destroy_action_info (gpointer action_info,
gpointer user_data)
{
CallyActorActionInfo *info = action_info;
g_assert (info != NULL);
g_free (info->name);
g_free (info->description);
g_free (info->keybinding);
if (info->notify)
info->notify (info->user_data);
g_free (info);
}
......@@ -47,34 +47,10 @@ typedef struct _CallyActor CallyActor;
typedef struct _CallyActorClass CallyActorClass;
typedef struct _CallyActorPrivate CallyActorPrivate;
/**
* CallyActionFunc:
* @cally_actor: a #CallyActor
*
* Action function, to be used on #AtkAction implementations as a individual
* action
*/
typedef void (* CallyActionFunc) (CallyActor *cally_actor);
/**
* CallyActionCallback:
* @cally_actor: a #CallyActor
* @user_data: user data passed to the function
*
* Action function, to be used on #AtkAction implementations as
* an individual action.
*
* Unlike #CallyActionFunc, this function uses the @user_data
* argument passed to [method@Actor.add_action_full].
*/
typedef void (* CallyActionCallback) (CallyActor *cally_actor,
gpointer user_data);
/**
* CallyActorClass:
* @notify_clutter: Signal handler for notify signal on Clutter actor
* @add_actor: Signal handler for child-added signal on Clutter actor
* @remove_actor: Signal handler for child-removed signal on Clutter actor
*/
struct _CallyActorClass
{
......@@ -84,40 +60,10 @@ struct _CallyActorClass
/*< public >*/
void (*notify_clutter) (GObject *object,
GParamSpec *pspec);
gint (*add_actor) (ClutterActor *container,
ClutterActor *actor,
gpointer data);
gint (*remove_actor) (ClutterActor *container,
ClutterActor *actor,
gpointer data);
};
CLUTTER_EXPORT
AtkObject* cally_actor_new (ClutterActor *actor);
CLUTTER_EXPORT
guint cally_actor_add_action (CallyActor *cally_actor,
const gchar *action_name,
const gchar *action_description,
const gchar *action_keybinding,
CallyActionFunc action_func);
CLUTTER_EXPORT
guint cally_actor_add_action_full (CallyActor *cally_actor,
const gchar *action_name,
const gchar *action_description,
const gchar *action_keybinding,
CallyActionCallback callback,
gpointer user_data,
GDestroyNotify notify);
CLUTTER_EXPORT
gboolean cally_actor_remove_action (CallyActor *cally_actor,
gint action_id);
CLUTTER_EXPORT
gboolean cally_actor_remove_action_by_name (CallyActor *cally_actor,
const gchar *action_name);
G_END_DECLS
......@@ -40,7 +40,6 @@
#include "cally/cally-text.h"
#include "cally/cally-actor-private.h"
#include "clutter/clutter-color.h"
#include "clutter/clutter-main.h"
#include "clutter/clutter-text.h"
......@@ -168,6 +167,42 @@ static int _cally_misc_get_index_at_point (ClutterText *clutter
gint y,
AtkCoordType coords);
/* AtkAction.h */
static void cally_text_action_interface_init (AtkActionIface *iface);
static gboolean cally_text_action_do_action (AtkAction *action,
gint i);
static gint cally_text_action_get_n_actions (AtkAction *action);
static const gchar * cally_text_action_get_name (AtkAction *action,
gint i);
/**
* CallyActionFunc:
* @cally_actor: a #CallyActor
*
* Action function, to be used on #AtkAction implementations as a individual
* action
*/
typedef void (* CallyActionFunc) (CallyActor *cally_actor);
/*< private >
* CallyTextActionInfo:
* @name: name of the action
* @do_action_func: callback
*
* Utility structure to maintain the different actions added to the
* #CallyActor
*/
typedef struct _CallyTextActionInfo
{
gchar *name;
CallyActionFunc do_action_func;
} CallyTextActionInfo;
typedef struct _CallyTextPrivate
{
/* Cached ClutterText values*/
......@@ -186,7 +221,9 @@ typedef struct _CallyTextPrivate
gint length_delete;
/* action */
guint activate_action_id;
CallyTextActionInfo *activate_action;
GQueue *action_queue;
guint action_idle_handler;
} CallyTextPrivate;
G_DEFINE_TYPE_WITH_CODE (CallyText,
......@@ -195,6 +232,8 @@ G_DEFINE_TYPE_WITH_CODE (CallyText,
G_ADD_PRIVATE (CallyText)
G_IMPLEMENT_INTERFACE (ATK_TYPE_TEXT,
cally_text_text_interface_init)
G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION,
cally_text_action_interface_init)
G_IMPLEMENT_INTERFACE (ATK_TYPE_EDITABLE_TEXT,
cally_text_editable_text_interface_init));
......@@ -229,8 +268,7 @@ cally_text_init (CallyText *cally_text)
priv->signal_name_delete = NULL;
priv->position_delete = -1;
priv->length_delete = -1;
priv->activate_action_id = 0;
priv->action_queue = g_queue_new ();
}
static void
......@@ -240,10 +278,9 @@ cally_text_finalize (GObject *obj)
CallyTextPrivate *priv =
cally_text_get_instance_private (cally_text);
/* g_object_unref (priv->textutil); */
/* priv->textutil = NULL; */
g_clear_handle_id (&priv->insert_idle_handler, g_source_remove);
g_clear_handle_id (&priv->action_idle_handler, g_source_remove);
g_clear_pointer (&priv->action_queue, g_queue_free);
G_OBJECT_CLASS (cally_text_parent_class)->finalize (obj);
}
......@@ -1460,8 +1497,8 @@ static void cally_text_get_character_extents (AtkText *text,
}
clutter_actor_get_abs_allocation_vertices (actor, verts);
x_window = verts[0].x;
y_window = verts[0].y;
x_window = (int) verts[0].x;
y_window = (int) verts[0].y;
clutter_text_get_layout_offsets (clutter_text, &x_layout, &y_layout);
......@@ -1827,24 +1864,119 @@ _check_activate_action (CallyText *cally_text,
cally_text_get_instance_private (cally_text);
if (clutter_text_get_activatable (clutter_text))
{
if (priv->activate_action_id != 0)
if (priv->activate_action != NULL)
return;
priv->activate_action_id = cally_actor_add_action (CALLY_ACTOR (cally_text),
"activate", NULL, NULL,
_cally_text_activate_action);
priv->activate_action = g_new0 (CallyTextActionInfo, 1);
priv->activate_action->name = g_strdup ("activate");
priv->activate_action->do_action_func = _cally_text_activate_action;
}
else
{
if (priv->activate_action_id == 0)
if (priv->activate_action == NULL)
return;
if (cally_actor_remove_action (CALLY_ACTOR (cally_text),
priv->activate_action_id))
g_clear_pointer (&priv->activate_action->name, g_free);
g_clear_pointer (&priv->activate_action, g_free);
}
}
/* AtkAction implementation */
static void
cally_text_action_interface_init (AtkActionIface *iface)
{
priv->activate_action_id = 0;
iface->do_action = cally_text_action_do_action;
iface->get_n_actions = cally_text_action_get_n_actions;
iface->get_name = cally_text_action_get_name;
}
static gboolean
idle_do_action (gpointer data)
{
CallyActor *cally_actor = NULL;
CallyTextPrivate *priv = NULL;
cally_actor = CALLY_ACTOR (data);
priv = cally_text_get_instance_private (CALLY_TEXT (cally_actor));
priv->action_idle_handler = 0;
/* state is defunct*/
g_assert (CALLY_GET_CLUTTER_ACTOR (cally_actor) != NULL);
while (!g_queue_is_empty (priv->action_queue))
{
CallyTextActionInfo *info = NULL;
info = (CallyTextActionInfo *) g_queue_pop_head (priv->action_queue);
info->do_action_func (cally_actor);
}
return FALSE;
}
static gboolean
cally_text_action_do_action (AtkAction *action,
gint index)
{
g_autoptr (AtkStateSet) set = NULL;
CallyText *cally_actor;
CallyTextPrivate *priv;
/* Only activate action is supported*/
g_return_val_if_fail (index != 0, FALSE);
g_return_val_if_fail (CALLY_IS_TEXT (action), FALSE);
cally_actor = CALLY_TEXT (action);
priv = cally_text_get_instance_private (cally_actor);
set = atk_object_ref_state_set (ATK_OBJECT (cally_actor));
if (atk_state_set_contains_state (set, ATK_STATE_DEFUNCT))
return FALSE;
if (!atk_state_set_contains_state (set, ATK_STATE_SENSITIVE) ||
!atk_state_set_contains_state (set, ATK_STATE_SHOWING))
return FALSE;
if (priv->activate_action == NULL)
return FALSE;
if (priv->activate_action->do_action_func == NULL)
return FALSE;
g_queue_push_head (priv->action_queue, priv->activate_action);
if (!priv->action_idle_handler)
priv->action_idle_handler = g_idle_add (idle_do_action, cally_actor);
return TRUE;
}
static gint
cally_text_action_get_n_actions (AtkAction *action)
{
g_return_val_if_fail (CALLY_IS_ACTOR (action), 0);
/* We only support activate action*/
return 1;
}
static const gchar*
cally_text_action_get_name (AtkAction *action,
gint i)
{
CallyTextPrivate *priv;
g_return_val_if_fail (CALLY_IS_ACTOR (action), NULL);
priv = cally_text_get_instance_private (CALLY_TEXT (action));
if (priv->activate_action == NULL)
return NULL;
return priv->activate_action->name;
}
/* GailTextUtil/GailMisc reimplementation methods */
......@@ -2024,7 +2156,7 @@ static AtkAttributeSet*
_cally_misc_add_actor_color_to_attribute_set (AtkAttributeSet *attrib_set,
ClutterText *clutter_text)
{
ClutterColor color;
CoglColor color;
gchar *value;
clutter_text_get_color (clutter_text, &color);
......@@ -2306,8 +2438,8 @@ _cally_misc_get_index_at_point (ClutterText *clutter_text,
clutter_text_get_layout_offsets (clutter_text, &x_layout, &y_layout);
clutter_actor_get_abs_allocation_vertices (CLUTTER_ACTOR (clutter_text), verts);
x_window = verts[0].x;
y_window = verts[0].y;
x_window = (int) verts[0].x;
y_window = (int) verts[0].y;
x_temp = x - x_layout - x_window;
y_temp = y - y_layout - y_window;
......
......@@ -393,10 +393,10 @@ clutter_actor_box_interpolate (const ClutterActorBox *initial,
g_return_if_fail (final != NULL);
g_return_if_fail (result != NULL);
result->x1 = initial->x1 + (final->x1 - initial->x1) * progress;
result->y1 = initial->y1 + (final->y1 - initial->y1) * progress;
result->x2 = initial->x2 + (final->x2 - initial->x2) * progress;
result->y2 = initial->y2 + (final->y2 - initial->y2) * progress;
result->x1 = (float) (initial->x1 + (final->x1 - initial->x1) * progress);
result->y1 = (float) (initial->y1 + (final->y1 - initial->y1) * progress);
result->x2 = (float) (initial->x2 + (final->x2 - initial->x2) * progress);
result->y2 = (float) (initial->y2 + (final->y2 - initial->y2) * progress);
}
/**
......@@ -539,8 +539,8 @@ _clutter_actor_box_enlarge_for_effects (ClutterActorBox *box)
* here is 1.75px in total if you consider that the 0.75 padding could
* just cross an integer boundary and so ceil will effectively add 1.
*/
box->x2 = ceilf (box->x2 + 0.75);
box->y2 = ceilf (box->y2 + 0.75);
box->x2 = ceilf (box->x2 + 0.75f);
box->y2 = ceilf (box->y2 + 0.75f);
/* Now we redefine the top-left relative to the bottom right based on the
* rounded width/height determined above + a constant so that the overall
......
This diff is collapsed.
......@@ -222,7 +222,8 @@ struct _ClutterActorClass
gboolean (* has_overlaps) (ClutterActor *self);
void (* paint_node) (ClutterActor *self,
ClutterPaintNode *root);
ClutterPaintNode *root,
ClutterPaintContext *paint_context);
gboolean (* touch_event) (ClutterActor *self,
ClutterEvent *event);
......@@ -564,6 +565,10 @@ ClutterContentRepeat clutter_actor_get_content_repeat
CLUTTER_EXPORT
void clutter_actor_set_color_state (ClutterActor *self,
ClutterColorState *color_state);
CLUTTER_EXPORT
void clutter_actor_unset_color_state (ClutterActor *self);
CLUTTER_EXPORT
ClutterColorState * clutter_actor_get_color_state (ClutterActor *self);
......@@ -572,10 +577,10 @@ void clutter_actor_get_content_box
ClutterActorBox *box);
CLUTTER_EXPORT
void clutter_actor_set_background_color (ClutterActor *self,
const ClutterColor *color);
const CoglColor *color);
CLUTTER_EXPORT
void clutter_actor_get_background_color (ClutterActor *self,
ClutterColor *color);
CoglColor *color);
CLUTTER_EXPORT
const ClutterPaintVolume * clutter_actor_get_paint_volume (ClutterActor *self);
CLUTTER_EXPORT
......@@ -662,6 +667,10 @@ gboolean clutter_actor_contains
ClutterActor *descendant);
CLUTTER_EXPORT
ClutterActor* clutter_actor_get_stage (ClutterActor *actor);
CLUTTER_EXPORT
ClutterContext * clutter_actor_get_context (ClutterActor *actor);
CLUTTER_EXPORT
void clutter_actor_set_child_below_sibling (ClutterActor *self,
ClutterActor *child,
......
......@@ -582,7 +582,7 @@ clutter_align_constraint_set_factor (ClutterAlignConstraint *align,
{
g_return_if_fail (CLUTTER_IS_ALIGN_CONSTRAINT (align));
align->factor = CLAMP (factor, 0.0, 1.0);
align->factor = CLAMP (factor, 0.0f, 1.0f);
if (align->actor != NULL)
clutter_actor_queue_relayout (align->actor);
......
......@@ -69,7 +69,6 @@ struct _ClutterBackendClass
GError **error);
CoglDisplay * (* get_display) (ClutterBackend *backend,
CoglRenderer *renderer,
CoglSwapChain *swap_chain,
GError **error);
gboolean (* create_context) (ClutterBackend *backend,
GError **error);
......
......@@ -52,8 +52,6 @@
#include "cogl/cogl.h"
#define DEFAULT_FONT_NAME "Sans 10"
enum
{
RESOLUTION_CHANGED,
......@@ -118,12 +116,10 @@ clutter_backend_do_real_create_context (ClutterBackend *backend,
GError **error)
{
ClutterBackendClass *klass;
CoglSwapChain *swap_chain;
klass = CLUTTER_BACKEND_GET_CLASS (backend);
swap_chain = NULL;
cogl_init ();
klass = CLUTTER_BACKEND_GET_CLASS (backend);
CLUTTER_NOTE (BACKEND, "Creating Cogl renderer");
backend->cogl_renderer = klass->get_renderer (backend, error);
......@@ -135,15 +131,11 @@ clutter_backend_do_real_create_context (ClutterBackend *backend,
if (!cogl_renderer_connect (backend->cogl_renderer, error))
goto error;
CLUTTER_NOTE (BACKEND, "Creating Cogl swap chain");
swap_chain = cogl_swap_chain_new ();
CLUTTER_NOTE (BACKEND, "Creating Cogl display");
if (klass->get_display != NULL)
{
backend->cogl_display = klass->get_display (backend,
backend->cogl_renderer,
swap_chain,
error);
}
else
......@@ -151,7 +143,7 @@ clutter_backend_do_real_create_context (ClutterBackend *backend,
CoglOnscreenTemplate *tmpl;
gboolean res;
tmpl = cogl_onscreen_template_new (swap_chain);
tmpl = cogl_onscreen_template_new ();
/* XXX: I have some doubts that this is a good design.
*
......@@ -185,7 +177,6 @@ clutter_backend_do_real_create_context (ClutterBackend *backend,
/* the display owns the renderer and the swap chain */
g_object_unref (backend->cogl_renderer);
g_object_unref (swap_chain);
return TRUE;
......@@ -193,9 +184,6 @@ error:
g_clear_object (&backend->cogl_display);
g_clear_object (&backend->cogl_renderer);
if (swap_chain != NULL)
g_object_unref (swap_chain);
return FALSE;
}
......@@ -267,7 +255,7 @@ clutter_backend_real_create_context (ClutterBackend *backend,
return FALSE;
}
backend->cogl_source = cogl_glib_source_new (backend->cogl_context, G_PRIORITY_DEFAULT);
backend->cogl_source = cogl_glib_source_new (backend->cogl_renderer, G_PRIORITY_DEFAULT);
g_source_attach (backend->cogl_source, NULL);
return TRUE;
......
......@@ -171,6 +171,8 @@ clutter_blur_effect_init (ClutterBlurEffect *self)
clutter_backend_get_cogl_context (clutter_get_default_backend ());
klass->base_pipeline = cogl_pipeline_new (ctx);
cogl_pipeline_set_static_name (klass->base_pipeline,
"ClutterBlurEffect (base pipeline)");
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_TEXTURE_LOOKUP,
box_blur_glsl_declarations,
......
......@@ -150,6 +150,7 @@ create_blur_pipeline (void)
CoglSnippet *snippet;
blur_pipeline = cogl_pipeline_new (ctx);
cogl_pipeline_set_static_name (blur_pipeline, "ClutterBlur");
cogl_pipeline_set_layer_null_texture (blur_pipeline, 0);
cogl_pipeline_set_layer_filters (blur_pipeline,
0,
......@@ -242,8 +243,8 @@ create_fbo (ClutterBlur *blur,
scaled_height = floorf (height / blur->downscale_factor);
pass->texture = cogl_texture_2d_new_with_size (ctx,
scaled_width,
scaled_height);
(int) scaled_width,
(int) scaled_height);
if (!pass->texture)
return FALSE;
......@@ -354,19 +355,19 @@ clutter_blur_new (CoglTexture *texture,
BlurPass *vpass;
g_return_val_if_fail (texture != NULL, NULL);
g_return_val_if_fail (radius >= 0.0, NULL);
g_return_val_if_fail (radius >= 0.0f, NULL);
width = cogl_texture_get_width (texture);
height = cogl_texture_get_height (texture);
blur = g_new0 (ClutterBlur, 1);
blur->sigma = radius / 2.0;
blur->sigma = radius / 2.0f;
blur->source_texture = g_object_ref (texture);
blur->downscale_factor = calculate_downscale_factor (width,
height,
blur->sigma);
if (G_APPROX_VALUE (blur->sigma, 0.0, FLT_EPSILON))
if (G_APPROX_VALUE (blur->sigma, 0.0f, FLT_EPSILON))
goto out;
vpass = &blur->pass[VERTICAL];
......
......@@ -519,10 +519,10 @@ compare_gap (gconstpointer p1,
const guint *c1 = p1;
const guint *c2 = p2;
const gint d1 = MAX (sizes[*c1].natural_size -
const int d1 = (int) MAX (sizes[*c1].natural_size -
sizes[*c1].minimum_size,
0);
const gint d2 = MAX (sizes[*c2].natural_size -
const int d2 = (int) MAX (sizes[*c2].natural_size -
sizes[*c2].minimum_size,
0);
......@@ -601,7 +601,7 @@ distribute_natural_allocation (float extra_space,
* Sort order and reducing remaining space by assigned space
* ensures that space is distributed equally.
*/
float glue = (extra_space + i) / (i + 1.0);
float glue = (extra_space + i) / (i + 1.0f);
float gap =
sizes[(spreading[i])].natural_size - sizes[(spreading[i])].minimum_size;
......@@ -654,9 +654,9 @@ clutter_box_layout_allocate (ClutterLayoutManager *layout,
sizes = g_newa (RequestedSize, nvis_children);
if (priv->orientation == CLUTTER_ORIENTATION_VERTICAL)
size = box->y2 - box->y1 - (nvis_children - 1) * priv->spacing;
size = (int) (box->y2 - box->y1 - (nvis_children - 1) * priv->spacing);
else
size = box->x2 - box->x1 - (nvis_children - 1) * priv->spacing;
size = (int) (box->x2 - box->x1 - (nvis_children - 1) * priv->spacing);
actor = CLUTTER_ACTOR (container);
......@@ -710,7 +710,7 @@ clutter_box_layout_allocate (ClutterLayoutManager *layout,
? box->x2 - box->x1
: box->y2 - box->y1);
size -= sizes[i].minimum_size;
size -= (int) sizes[i].minimum_size;
sizes[i].actor = child;
......@@ -723,9 +723,9 @@ clutter_box_layout_allocate (ClutterLayoutManager *layout,
* minimum sizes for children that are not going to fill
*/
if (priv->orientation == CLUTTER_ORIENTATION_VERTICAL)
size = box->y2 - box->y1 - (nvis_children - 1) * priv->spacing;
size = (int) (box->y2 - box->y1 - (nvis_children - 1) * priv->spacing);
else
size = box->x2 - box->x1 - (nvis_children - 1) * priv->spacing;
size = (int) (box->x2 - box->x1 - (nvis_children - 1) * priv->spacing);
extra = size / nvis_children;
n_extra_widgets = size % nvis_children;
......@@ -763,14 +763,14 @@ clutter_box_layout_allocate (ClutterLayoutManager *layout,
if (priv->orientation == CLUTTER_ORIENTATION_VERTICAL)
{
child_allocation.x1 = box->x1;
child_allocation.x2 = MAX (1.0, box->x2);
y = box->y1;
child_allocation.x2 = MAX (1.0f, box->x2);
y = (int) box->y1;
}
else
{
child_allocation.y1 = box->y1;
child_allocation.y2 = MAX (1.0, box->y2);
x = box->x1;
child_allocation.y2 = MAX (1.0f, box->y2);
x = (int) box->x1;
}
i = 0;
......@@ -814,7 +814,7 @@ clutter_box_layout_allocate (ClutterLayoutManager *layout,
if (clutter_actor_needs_expand (child, priv->orientation))
{
child_allocation.y1 = y;
child_allocation.y2 = child_allocation.y1 + MAX (1.0, child_size);
child_allocation.y2 = child_allocation.y1 + MAX (1.0f, child_size);
}
else
{
......@@ -822,14 +822,14 @@ clutter_box_layout_allocate (ClutterLayoutManager *layout,
child_allocation.y2 = child_allocation.y1 + sizes[i].minimum_size;
}
y += child_size + priv->spacing;
y += (int) (child_size + priv->spacing);
}
else /* CLUTTER_ORIENTATION_HORIZONTAL */
{
if (clutter_actor_needs_expand (child, priv->orientation))
{
child_allocation.x1 = x;
child_allocation.x2 = child_allocation.x1 + MAX (1.0, child_size);
child_allocation.x2 = child_allocation.x1 + MAX (1.0f, child_size);
}
else
{
......@@ -837,7 +837,7 @@ clutter_box_layout_allocate (ClutterLayoutManager *layout,
child_allocation.x2 = child_allocation.x1 + sizes[i].minimum_size;
}
x += child_size + priv->spacing;
x += (int) (child_size + priv->spacing);
if (is_rtl)
{
......
......@@ -76,8 +76,8 @@ static const gchar *brightness_contrast_source =
"cogl_color_out.rgb = ((cogl_color_out.rgb - 0.5 * cogl_color_out.a) *\n"
" contrast + 0.5 * cogl_color_out.a);\n";
static const ClutterColor no_brightness_change = { 0x7f, 0x7f, 0x7f, 0xff };
static const ClutterColor no_contrast_change = { 0x7f, 0x7f, 0x7f, 0xff };
static const CoglColor no_brightness_change = { 0x7f, 0x7f, 0x7f, 0xff };
static const CoglColor no_contrast_change = { 0x7f, 0x7f, 0x7f, 0xff };
static const gfloat no_change = 0.0f;
enum
......@@ -165,7 +165,7 @@ clutter_brightness_contrast_effect_set_property (GObject *gobject,
{
case PROP_BRIGHTNESS:
{
const ClutterColor *color = clutter_value_get_color (value);
const CoglColor *color = cogl_value_get_color (value);
clutter_brightness_contrast_effect_set_brightness_full (effect,
color->red / 127.0f - 1.0f,
color->green / 127.0f - 1.0f,
......@@ -175,7 +175,7 @@ clutter_brightness_contrast_effect_set_property (GObject *gobject,
case PROP_CONTRAST:
{
const ClutterColor *color = clutter_value_get_color (value);
const CoglColor *color = cogl_value_get_color (value);
clutter_brightness_contrast_effect_set_contrast_full (effect,
color->red / 127.0f - 1.0f,
color->green / 127.0f - 1.0f,
......@@ -198,29 +198,29 @@ clutter_brightness_contrast_effect_get_property (GObject *gobject,
ClutterBrightnessContrastEffect *effect = CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (gobject);
ClutterBrightnessContrastEffectPrivate *priv =
clutter_brightness_contrast_effect_get_instance_private (effect);
ClutterColor color;
CoglColor color;
switch (prop_id)
{
case PROP_BRIGHTNESS:
{
color.red = (priv->brightness_red + 1.0f) * 127.0f;
color.green = (priv->brightness_green + 1.0f) * 127.0f;
color.blue = (priv->brightness_blue + 1.0f) * 127.0f;
color.red = (uint8_t) ((priv->brightness_red + 1.0f) * 127.0f);
color.green = (uint8_t) ((priv->brightness_green + 1.0f) * 127.0f);
color.blue = (uint8_t) ((priv->brightness_blue + 1.0f) * 127.0f);
color.alpha = 0xff;
clutter_value_set_color (value, &color);
cogl_value_set_color (value, &color);
}
break;
case PROP_CONTRAST:
{
color.red = (priv->contrast_red + 1.0f) * 127.0f;
color.green = (priv->contrast_green + 1.0f) * 127.0f;
color.blue = (priv->contrast_blue + 1.0f) * 127.0f;
color.red = (uint8_t) ((priv->contrast_red + 1.0f) * 127.0f);
color.green = (uint8_t) ((priv->contrast_green + 1.0f) * 127.0f);
color.blue = (uint8_t) ((priv->contrast_blue + 1.0f) * 127.0f);
color.alpha = 0xff;
clutter_value_set_color (value, &color);
cogl_value_set_color (value, &color);
}
break;
......@@ -251,14 +251,14 @@ clutter_brightness_contrast_effect_class_init (ClutterBrightnessContrastEffectCl
*
* The brightness change to apply to the effect.
*
* This property uses a #ClutterColor to represent the changes to each
* This property uses a #CoglColor to represent the changes to each
* color channel. The range is [ 0, 255 ], with 127 as the value used
* to indicate no change; values smaller than 127 indicate a decrease
* in brightness, and values larger than 127 indicate an increase in
* brightness.
*/
obj_props[PROP_BRIGHTNESS] =
clutter_param_spec_color ("brightness", NULL, NULL,
cogl_param_spec_color ("brightness", NULL, NULL,
&no_brightness_change,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
......@@ -268,14 +268,14 @@ clutter_brightness_contrast_effect_class_init (ClutterBrightnessContrastEffectCl
*
* The contrast change to apply to the effect.
*
* This property uses a #ClutterColor to represent the changes to each
* This property uses a #CoglColor to represent the changes to each
* color channel. The range is [ 0, 255 ], with 127 as the value used
* to indicate no change; values smaller than 127 indicate a decrease
* in contrast, and values larger than 127 indicate an increase in
* contrast.
*/
obj_props[PROP_CONTRAST] =
clutter_param_spec_color ("contrast", NULL, NULL,
cogl_param_spec_color ("contrast", NULL, NULL,
&no_contrast_change,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
......@@ -337,9 +337,9 @@ update_uniforms (ClutterBrightnessContrastEffect *self)
if (priv->contrast_uniform > -1)
{
float contrast[3] = {
tan ((priv->contrast_red + 1) * G_PI_4),
tan ((priv->contrast_green + 1) * G_PI_4),
tan ((priv->contrast_blue + 1) * G_PI_4)
(float) tan ((priv->contrast_red + 1) * G_PI_4),
(float) tan ((priv->contrast_green + 1) * G_PI_4),
(float) tan ((priv->contrast_blue + 1) * G_PI_4)
};
cogl_pipeline_set_uniform_float (priv->pipeline,
......@@ -374,6 +374,8 @@ clutter_brightness_contrast_effect_init (ClutterBrightnessContrastEffect *self)
clutter_backend_get_cogl_context (clutter_get_default_backend ());
klass->base_pipeline = cogl_pipeline_new (ctx);
cogl_pipeline_set_static_name (klass->base_pipeline,
"ClutterBrightnessContrast");
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT,
brightness_contrast_decls,
......