Compare commits

..

1 Commits

Author SHA1 Message Date
f1484fa6c2 Add dcvviewer to xwayland_grab_default_access_rules
dcvviewer does not have native wayland support yet

https://gitlab.gnome.org/GNOME/mutter/merge_requests/587
2019-05-22 14:55:03 +00:00
773 changed files with 37047 additions and 30759 deletions

View File

@ -28,20 +28,6 @@ build-mutter:
- merge_requests
- /^.*$/
build-without-native-backend-and-wayland:
stage: build
script:
- meson . build -Dbuildtype=debugoptimized -Dnative_backend=false -Dudev=false -Dwayland=false -Dcore_tests=false --werror --prefix /usr
- ninja -C build
- ninja -C build install
artifacts:
expire_in: 1 day
paths:
- build
only:
- merge_requests
- /^.*$/
test-mutter:
stage: test
dependencies:
@ -49,17 +35,15 @@ test-mutter:
variables:
XDG_RUNTIME_DIR: "$CI_PROJECT_DIR/runtime-dir"
GSETTINGS_SCHEMA_DIR: "$CI_PROJECT_DIR/build/data"
G_SLICE: "always-malloc"
MALLOC_CHECK_: "3"
NO_AT_BRIDGE: "1"
MALLOC_PERTURB_: "123"
script:
- dconf update
- mkdir -m 700 $XDG_RUNTIME_DIR
- glib-compile-schemas $GSETTINGS_SCHEMA_DIR
- >
env MALLOC_PERTURB_="$((RANDOM % 256 + 1))"
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 --wrap catchsegv
only:
- merge_requests
- /^.*$/
@ -72,7 +56,7 @@ can-build-gnome-shell:
- meson install --no-rebuild -C build
script:
- .gitlab-ci/checkout-gnome-shell.sh
- meson gnome-shell gnome-shell/build --prefix /usr -Dman=false
- meson gnome-shell gnome-shell/build --prefix /usr
- ninja -C gnome-shell/build install
only:
- merge_requests

View File

@ -1,39 +1,25 @@
# Rebuild and push with
#
# cd .gitlab-ci/
# docker build --no-cache -t registry.gitlab.gnome.org/gnome/mutter/master:v2 .
# docker push registry.gitlab.gnome.org/gnome/mutter/master:v2
#
FROM fedora:30
RUN dnf -y update && dnf -y upgrade && \
dnf install -y 'dnf-command(builddep)' && \
dnf install -y 'dnf-command(copr)' && \
dnf copr enable -y fmuellner/gnome-shell-ci && \
dnf copr enable -y jadahl/mutter-ci && \
dnf copr enable -y hergertme/sysprof-3 && \
dnf -y update && dnf -y upgrade && \
dnf builddep -y mutter && \
# Until Fedora catches up with meson build-deps
dnf install -y meson xorg-x11-server-Xorg gnome-settings-daemon-devel egl-wayland-devel xorg-x11-server-Xwayland graphene-devel && \
# Until Fedora catches up with mesa bug fixes
dnf upgrade -y mesa-dri-drivers mesa-libEGL && \
dnf install -y meson xorg-x11-server-Xorg gnome-settings-daemon-devel egl-wayland-devel xorg-x11-server-Xwayland && \
# For running unit tests
dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 '*/xvfb-run' gdm-lib accountsservice-libs && \
dnf install -y sysprof-devel && \
# Unpackaged versions
dnf install -y https://copr-be.cloud.fedoraproject.org/results/jadahl/mutter-ci/fedora-29-x86_64/00834984-gsettings-desktop-schemas/gsettings-desktop-schemas-3.30.1-1.20181206git918efdd69be53.fc29.x86_64.rpm https://copr-be.cloud.fedoraproject.org/results/jadahl/mutter-ci/fedora-29-x86_64/00834984-gsettings-desktop-schemas/gsettings-desktop-schemas-devel-3.30.1-1.20181206git918efdd69be53.fc29.x86_64.rpm && \
dnf install -y intltool redhat-rpm-config make && \
# GNOME Shell
dnf builddep -y gnome-shell --setopt=install_weak_deps=False && \
# New dep this cycle
dnf install -y 'pkgconfig(gnome-autoar-0)' && \
dnf remove -y gnome-bluetooth-libs-devel dbus-glib-devel upower-devel python3-devel && \
dnf remove -y --noautoremove mutter mutter-devel && \

207
NEWS
View File

@ -1,210 +1,3 @@
3.35.1
======
* Fix immediate screen blank after releaseing inhibitor [Tim; #573]
* Respond to frame callbacks regardless of damage [Jonas; !839]
* selection [Carlos; !842]
* Fix Night Light on wayland [Jonas; !840]
* Fix various copy+paste/DND regressions [Carlos; !848, #789, #842,
#793, #845, #854]
* Misc. bug fixes and cleanups [Daniel, Marco, Jonas, Georges;
!841, !764, !837, !846]
Contributors:
Marco Trevisan (Treviño), Carlos Garnacho, Tim Klocke,
Georges Basile Stavracas Neto, Daniel van Vugt, Jonas Ådahl
3.34.1
======
* Fix startup of X11 session services on wayland [Carlos; #771]
* Fix _NET_ACTIVE_WINDOW emission [Carlos; #751]
* Fix initial view perspective [Marco; !803]
* Fix screenshots and window animations when scaled [Robert; !758]
* Re-enable coredumps when capabilities are set [Jonas; !811]
* Fix scaling of DND surface actors [Robert; !780]
* Optimize blitting of untransformed offscreen stage views [Olivier; !809, !820]
* Fix freeze of pointer event delivery on X11 [Olivier; !821]
* Fix scaling of stylus input coordinates with HiDPI [Dorian; !830]
* Fix memory leak when using implicit animations [Jonas; !828]
* Fix numlock state for native backend [Carlos; #769]
* Fixed crashes [Marco, Olivier, Jonas Å.; !805, #823, !808, !825,
#844, !826, #779]
* Misc. bug fixes and cleanups [Jonas Å., Georges, Jonas D., Michal, Daniel,
Iain, Adam, Marco, Carlos, Ting-Wei, Hans, Robert; !787, !795, !791, !797,
!772, !775, !799, !778, !785, !782, !796, #819, !814, !769, !817, !783, !786,
!829, !774, #822]
Contributors:
Marco Trevisan (Treviño), Jonas Dreßler, Olivier Fourdan, Carlos Garnacho,
Hans de Goede, Adam Jackson, Ting-Wei Lan, Iain Lane, Michal Lazo,
Robert Mader, Georges Basile Stavracas Neto, Dorian Stoll, Daniel van Vugt,
Jonas Ådahl
Translators:
Milo Casagrande [it], Nathan Follens [nl], Matej Urbančič [sl],
Ask Hjorth Larsen [da], Alan Mortensen [da], Jordi Mas [ca]
3.34.0
======
* Fix xdg-output v3 support [Olivier; !771]
* Fix crash when changing decoration state [Jonas; !773]
* Add and remove connectors on hot-plug [Jonas; !743]
Contributors:
Olivier Fourdan, Jonas Ådahl
Translators:
Rafael Fontenelle [pt_BR], Gwan-gyeong Mun [ko], Christian Kirbach [de],
Claude Paroz [fr], Milo Casagrande [it], Emin Tufan Çetin [tr],
Ryuta Fujii [ja]
3.33.92
=======
* Turn MetaShapedTexture into a ClutterContent implementation [Georges; !409]
* Restore inhibit shortcut for overlay key [Olivier; #734]
* Misc. pointer a11y improvements [Jonas D., Olivier; !746, !747, !745, !761]
* Fix position of drag surfaces [Robert; !684]
* Implement subsurface.place_below() for parents [Robert; !664]
* Add meta_window_actor_get_image() [Jonas Å.; !752]
* Revert faulty optimization from !719 [Jonas Å.; #735]
* Add additional sysprof trace points [Jonas Å.; !757, !765]
* Remove GLX "threaded swap wait" used on Nvidia [Daniel; !602]
* Implement geometric picking [Daniel; !189]
* Fix lost keyboard focus after DND [Olivier; #747]
* Misc. bug fixes and cleanups [Florian, Carlos, Piotr, Hans, Georges, Robert,
Ray, Mart, Rémi; !740, !672, !749, !751, !753, !730, !755, !756, !750, !715,
#738944, !657, !768]
Contributors:
Jonas Ådahl, Rémi Bernon, Piotr Drąg, Jonas Dreßler, Olivier Fourdan,
Carlos Garnacho, Hans de Goede, Robert Mader, Florian Müllner,
Georges Basile Stavracas Neto, Mart Raudsepp, Ray Strode, Daniel van Vugt
Translators:
Piotr Drąg [pl], Марко Костић [sr], Rūdolfs Mazurs [lv], Matej Urbančič [sl],
Balázs Úr [hu], Fran Dieguez [gl], Jordi Mas [ca], Anders Jonsson [sv],
Trần Ngọc Quân [vi], Tim Sabsch [de], Fabio Tomat [fur], Goran Vidović [hr],
Marek Černocký [cs]
3.33.91
=======
* Fix primary selection copy and paste between X11 and wayland [Hans; #702]
* Improve monitor hotplug support [Hans; !713]
* Remove a source of frame skips [Daniel; !719]
* Fix windows being lowered after unmaximizing with double click [Olivier; #88]
* Remove Clutter API for global grabs [Jonas D.; !536]
* Improve processing of incompressible events [Daniel; !711]
* Add xdg-output v3 support [Olivier; !704]
* Misc. bug fixes and cleanups [Jonas Å., Marco, Carlos, Adam, Albert, Niels,
Olivier, Florian; !722, !385, !728, !726, !500, !731, !727, !700, !735, !738]
Contributors:
Jonas Ådahl, Albert Vaca Cintora, Jonas Dreßler, Olivier Fourdan,
Carlos Garnacho, Hans de Goede, Niels De Graef, Adam Jackson, Florian Müllner,
Marco Trevisan (Treviño), Daniel van Vugt
Translators:
Asier Sarasua Garmendia [eu], Kukuh Syafaat [id], Florentina Mușat [ro],
Aurimas Černius [lt], Daniel Mustieles [es]
3.33.90
=======
* Fix visibility of clones with hidden source [Florian; #683]
* Reduce freezes when opening some popup windows [Carlos; #556]
* Be more thorough when excluding obscured areas from painting [Carlos; !698]
* Make it possible to start Xwayland on demand [Carlos; !709]
* clutter: Expose layout_manager to transitions [Florian; !716]
* Misc. bug fixes and cleanups [Mark, Florian, Iain, Niels, Carlos, Ray; !671,
!691, !694, !696, !703, !707, !697, !710, !708, !714, #719, !721]
Contributors:
Mark Blakeney, Carlos Garnacho, Niels De Graef, Iain Lane, Florian Müllner,
Ray Strode
Translators:
Asier Sarasua Garmendia [eu], Rafael Fontenelle [pt_BR], Fabio Tomat [fur],
Florentina Mușat [ro]
3.33.4
======
* Discard page flip retries on hotplug [Jonas; !630]
* Add xdg-output v2 support [Olivier; #645]
* Restore DRM format fallbacks [Jonas; !662]
* Don't emit ::size-changed when only position changed [Daniel; !568]
* Expose workspace layout properties [Florian; !618]
* Don't use grab modifiers when shortcuts are inhibited [Olivier; #642]
* Fix stuttering due to unchanged power save mode notifications [Georges; !674]
* Add API to reorder workspaces [Adam; !670]
* Make picking a new focus window more reliable [Marco; !669]
* Defer actor allocation till shown [Carlos; !677]
* Try to use primary GPU for copy instead of glReadPixels [Pekka; !615]
* Unset pointer focus when the cursor is hidden [Jonas D.; !448]
* Fix modifier-drag on wayland subsurfaces [Robert; !604]
* Fix background corruption on Nvidia after resuming from suspend [Daniel; !600]
* Only grab the locate-pointer key when necessary [Olivier; !685, #647]
* Misc. bug fixes and cleanups [Florian, Jonas, Daniel, Robert, Olivier,
Georges, Marco, Carlos, Emmanuele; !648, !650, !647, !656, !658, !637,
!663, !660, !659, !665, !666, !668, !667, #667, !676, !678, #672, !680,
!683, !688, !689, !687]
Contributors:
Jonas Ådahl, Emmanuele Bassi, Adam Bieńkowski, Piotr Drąg, Jonas Dreßler,
Olivier Fourdan, Carlos Garnacho, Robert Mader, Florian Müllner,
Georges Basile Stavracas Neto, Pekka Paalanen, Marco Trevisan (Treviño),
Daniel van Vugt
Translators:
Fabio Tomat [fur], Kukuh Syafaat [id]
3.33.3
======
* Prepare for running Xwayland on demand [Carlos; !420]
* Fix text selection color rendering [Florian; #494]
* Fix black shadows when using fractional scaling [Robert; #609]
* Honor startup sequence workspace on wayland [Carlos; gnome-shell#674]
* Only emit 'grab-op-end` signal after dropping grabs [Marco; !596]
* Add a Sysprof-based profiler [Jonas, Georges; !197, !603]
* Relax "xwayland-allow-grabs" setting [Olivier; #597]
* Implement locate-pointer accessibility feature [Olivier; !453]
* Implement mouse accessibility [Olivier; !512]
* Consolidate frame throttling [Daniel, Georges; !363]
* Fix setting blank cursor under wayland [Jonas; #630]
* Pixel-align OpenGL cursors [Jonas; !610]
* Handle returning from fullscreen/maximization better [Jonas; !621]
* Improve screencast support on multi-monitor systems [Georges; !623]
* Fix running X11 applications with sudo under wayland [Hans; #643]
* Implement toggle-keys notification [Olivier; #637]
* Add initial KMS transactional support [Jonas; !525]
* Improve finding new focus window when the old one is closed [Marco; #308]
* Misc. bug fixes and cleanups [Jonas, Carlos, Marco, Florian, Pekka, Robert,
Douglas, Georges, Daniel, Emil, Niels, Hans, Olivier, Ting-Wei, Corentin;
!591, #398, !592, !581, !597, !598, !593, !497, #591, !545, gtk#1675, !601,
#568, !564, !605, !609, !115, !214, !611, !617, !616, !619, !624, !622, !627,
!628, !629, !632, !633, !631, !636, !639, !638, !634, !640, !529, !644, !590]
Contributors:
Jonas Ådahl, Piotr Drąg, Olivier Fourdan, Carlos Garnacho, Hans de Goede,
Niels De Graef, Ting-Wei Lan, Robert Mader, Florian Müllner,
Georges Basile Stavracas Neto, Corentin Noël, Pekka Paalanen, Douglas R. Reno,
Marco Trevisan (Treviño), Emil Velikov, Daniel van Vugt
Translators:
Balázs Úr [hu], Daniel Mustieles [es], Nathan Follens [nl], Goran Vidović [hr]
3.33.2
======
* Fix rendering lag on Xorg [Daniel; !520, !281]
* Misc. bug fixes and cleanups [Carlos, Marco, Jonas D., Florian, Niels,
Daniel, Benjamin, Jonas Å., Ignacio, Vasilis; #598, !576, !547, !578,
!583, !582, !469, !524, !119, !571, !584, !585, !586, #425]
Contributors:
Jonas Ådahl, Benjamin Berg, Jonas Dreßler, Carlos Garnacho, Niels De Graef,
Vasilis Liaskovitis, Florian Müllner, Ignacio Casal Quinteiro,
Marco Trevisan (Treviño), Daniel van Vugt
Translators:
Daniel Mustieles [es]
3.33.1
======
* Remove unused APIs and outdated driver support

View File

@ -657,7 +657,7 @@ cally_actor_get_extents (AtkComponent *component,
ClutterActor *actor = NULL;
gint top_level_x, top_level_y;
gfloat f_width, f_height;
graphene_point3d_t verts[4];
ClutterVertex verts[4];
ClutterActor *stage = NULL;
g_return_if_fail (CALLY_IS_ACTOR (component));
@ -737,7 +737,11 @@ cally_actor_grab_focus (AtkComponent *component)
*
* This gets the top level origin, it is, the position of the stage in
* the global screen. You can see it as the absolute display position
* of the stage. This is 0,0 for a compositor.
* of the stage.
*
* FIXME: only the case with x11 is implemented, other backends are
* required
*
*/
void
_cally_actor_get_top_level_origin (ClutterActor *actor,
@ -745,11 +749,54 @@ _cally_actor_get_top_level_origin (ClutterActor *actor,
gint *yp)
{
/* default values */
gint x = 0;
gint y = 0;
#ifdef CLUTTER_WINDOWING_X11
if (clutter_check_windowing_backend (CLUTTER_WINDOWING_X11))
{
ClutterActor *stage = NULL;
Display *display = NULL;
Window root_window;
Window stage_window;
Window child;
gint return_val = 0;
stage = clutter_actor_get_stage (actor);
/* FIXME: what happens if you use another display with
clutter_backend_x11_set_display ?*/
display = clutter_x11_get_default_display ();
root_window = clutter_x11_get_root_window ();
stage_window = clutter_x11_get_stage_window (CLUTTER_STAGE (stage));
return_val = XTranslateCoordinates (display, stage_window, root_window,
0, 0, &x, &y,
&child);
if (!return_val)
g_warning ("[x11] We were not able to get proper absolute "
"position of the stage");
}
else
#endif
{
static gboolean yet_warned = FALSE;
if (!yet_warned)
{
yet_warned = TRUE;
g_warning ("The current Clutter backend does not support using "
"atk_component_get_extents() with ATK_XY_SCREEN.");
}
}
if (xp)
*xp = 0;
*xp = x;
if (yp)
*yp = 0;
*yp = y;
}
/* AtkAction implementation */

View File

@ -1438,7 +1438,7 @@ static void cally_text_get_character_extents (AtkText *text,
PangoLayout *layout;
PangoRectangle extents;
const gchar *text_value;
graphene_point3d_t verts[4];
ClutterVertex verts[4];
actor = CALLY_GET_CLUTTER_ACTOR (text);
if (actor == NULL) /* State is defunct */
@ -2294,7 +2294,7 @@ _cally_misc_get_index_at_point (ClutterText *clutter_text,
gint index, x_window, y_window, x_toplevel, y_toplevel;
gint x_temp, y_temp;
gboolean ret;
graphene_point3d_t verts[4];
ClutterVertex verts[4];
PangoLayout *layout;
gint x_layout, y_layout;

View File

@ -340,7 +340,7 @@ clutter_actor_box_contains (const ClutterActorBox *box,
/**
* clutter_actor_box_from_vertices:
* @box: a #ClutterActorBox
* @verts: (array fixed-size=4): array of four #graphene_point3d_t
* @verts: (array fixed-size=4): array of four #ClutterVertex
*
* Calculates the bounding box represented by the four vertices; for details
* of the vertex array see clutter_actor_get_abs_allocation_vertices().
@ -348,8 +348,8 @@ clutter_actor_box_contains (const ClutterActorBox *box,
* Since: 1.0
*/
void
clutter_actor_box_from_vertices (ClutterActorBox *box,
const graphene_point3d_t verts[])
clutter_actor_box_from_vertices (ClutterActorBox *box,
const ClutterVertex verts[])
{
gfloat x_1, x_2, y_1, y_2;

View File

@ -135,7 +135,7 @@ struct _AnchorCoord
} fraction;
/* Use when is_fractional == FALSE */
graphene_point3d_t units;
ClutterVertex units;
} v;
};
@ -163,7 +163,7 @@ struct _SizeRequest
struct _ClutterLayoutInfo
{
/* fixed position coordinates */
graphene_point_t fixed_pos;
ClutterPoint fixed_pos;
ClutterMargin margin;
@ -173,8 +173,8 @@ struct _ClutterLayoutInfo
guint x_expand : 1;
guint y_expand : 1;
graphene_size_t minimum;
graphene_size_t natural;
ClutterSize minimum;
ClutterSize natural;
};
const ClutterLayoutInfo * _clutter_actor_get_layout_info_or_defaults (ClutterActor *self);
@ -203,13 +203,13 @@ struct _ClutterTransformInfo
AnchorCoord anchor;
/* translation */
graphene_point3d_t translation;
ClutterVertex translation;
/* z_position */
gfloat z_position;
/* transformation center */
graphene_point_t pivot;
ClutterPoint pivot;
gfloat pivot_z;
CoglMatrix transform;
@ -242,6 +242,9 @@ ClutterAnimationInfo * _clutter_actor_get_animation_info
ClutterTransition * _clutter_actor_create_transition (ClutterActor *self,
GParamSpec *pspec,
...);
ClutterTransition * _clutter_actor_get_transition (ClutterActor *self,
GParamSpec *pspec);
gboolean _clutter_actor_foreach_child (ClutterActor *self,
ClutterForeachCallback callback,
gpointer user_data);
@ -274,9 +277,6 @@ void _clutter_actor_set_enable_paint_unmapped
void _clutter_actor_set_has_pointer (ClutterActor *self,
gboolean has_pointer);
void _clutter_actor_set_has_key_focus (ClutterActor *self,
gboolean has_key_focus);
void _clutter_actor_queue_redraw_with_clip (ClutterActor *self,
ClutterRedrawFlags flags,
const ClutterPaintVolume *clip_volume);
@ -297,6 +297,8 @@ const gchar * _clutter_actor_get_debug_name
void _clutter_actor_push_clone_paint (void);
void _clutter_actor_pop_clone_paint (void);
guint32 _clutter_actor_get_pick_id (ClutterActor *self);
void _clutter_actor_shader_pre_paint (ClutterActor *actor,
gboolean repeat);
void _clutter_actor_shader_post_paint (ClutterActor *actor);

File diff suppressed because it is too large Load Diff

View File

@ -233,7 +233,8 @@ struct _ClutterActorClass
ClutterActor *old_parent);
void (* destroy) (ClutterActor *self);
void (* pick) (ClutterActor *actor);
void (* pick) (ClutterActor *actor,
const ClutterColor *color);
gboolean (* queue_redraw) (ClutterActor *actor,
ClutterActor *leaf_that_queued,
@ -430,7 +431,7 @@ void clutter_actor_get_allocation_box
CLUTTER_EXPORT
void clutter_actor_get_allocation_vertices (ClutterActor *self,
ClutterActor *ancestor,
graphene_point3d_t *verts);
ClutterVertex verts[]);
CLUTTER_EXPORT
gboolean clutter_actor_has_allocation (ClutterActor *self);
CLUTTER_EXPORT
@ -816,16 +817,16 @@ gboolean clutter_actor_transform_stage_point
gfloat *y_out);
CLUTTER_EXPORT
void clutter_actor_get_abs_allocation_vertices (ClutterActor *self,
graphene_point3d_t *verts);
ClutterVertex verts[]);
CLUTTER_EXPORT
void clutter_actor_apply_transform_to_point (ClutterActor *self,
const graphene_point3d_t *point,
graphene_point3d_t *vertex);
const ClutterVertex *point,
ClutterVertex *vertex);
CLUTTER_EXPORT
void clutter_actor_apply_relative_transform_to_point (ClutterActor *self,
ClutterActor *ancestor,
const graphene_point3d_t *point,
graphene_point3d_t *vertex);
const ClutterVertex *point,
ClutterVertex *vertex);
/* Implicit animations */
CLUTTER_EXPORT
@ -901,10 +902,6 @@ void clutter_actor_bind_model_with_properties
const char *first_model_property,
...);
CLUTTER_EXPORT
void clutter_actor_pick_box (ClutterActor *self,
const ClutterActorBox *box);
G_END_DECLS
#endif /* __CLUTTER_ACTOR_H__ */

View File

@ -50,6 +50,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterConstraint, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterContainer, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDeformEffect, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDesaturateEffect, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDeviceManager, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDragAction, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDropAction, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterEffect, g_object_unref)
@ -93,6 +94,10 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterMatrix, clutter_matrix_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintNode, clutter_paint_node_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintVolume, clutter_paint_volume_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPathNode, clutter_path_node_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPoint, clutter_point_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterRect, clutter_rect_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterSize, clutter_size_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterVertex, clutter_vertex_free)
#endif /* __GI_SCANNER__ */

View File

@ -27,6 +27,8 @@
#include <clutter/clutter-keymap.h>
#include <clutter/clutter-stage-window.h>
#include "clutter-event-translator.h"
#define CLUTTER_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BACKEND, ClutterBackendClass))
#define CLUTTER_IS_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BACKEND))
#define CLUTTER_BACKEND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BACKEND, ClutterBackendClass))
@ -56,7 +58,7 @@ struct _ClutterBackend
gfloat units_per_em;
gint32 units_serial;
ClutterStageWindow *stage_window;
GList *event_translators;
ClutterInputMethod *input_method;
@ -91,6 +93,12 @@ struct _ClutterBackendClass
GError **error);
ClutterDeviceManager *(* get_device_manager) (ClutterBackend *backend);
void (* copy_event_data) (ClutterBackend *backend,
const ClutterEvent *src,
ClutterEvent *dest);
void (* free_event_data) (ClutterBackend *backend,
ClutterEvent *event);
gboolean (* translate_event) (ClutterBackend *backend,
gpointer native,
ClutterEvent *event);
@ -128,11 +136,17 @@ void _clutter_backend_copy_event_data (Clutter
ClutterEvent *dest);
void _clutter_backend_free_event_data (ClutterBackend *backend,
ClutterEvent *event);
CLUTTER_EXPORT
gboolean _clutter_backend_translate_event (ClutterBackend *backend,
gpointer native,
ClutterEvent *event);
CLUTTER_EXPORT
void _clutter_backend_add_event_translator (ClutterBackend *backend,
ClutterEventTranslator *translator);
void _clutter_backend_remove_event_translator (ClutterBackend *backend,
ClutterEventTranslator *translator);
ClutterFeatureFlags _clutter_backend_get_features (ClutterBackend *backend);
gfloat _clutter_backend_get_units_per_em (ClutterBackend *backend,
@ -146,9 +160,6 @@ void _clutter_backend_reset_cogl_framebuffer (Clutter
void clutter_set_allowed_drivers (const char *drivers);
CLUTTER_EXPORT
ClutterStageWindow * clutter_backend_get_stage_window (ClutterBackend *backend);
G_END_DECLS
#endif /* __CLUTTER_BACKEND_PRIVATE_H__ */

View File

@ -62,6 +62,9 @@
#ifdef CLUTTER_INPUT_X11
#include "x11/clutter-backend-x11.h"
#endif
#ifdef CLUTTER_INPUT_EVDEV
#include "evdev/clutter-device-manager-evdev.h"
#endif
#ifdef CLUTTER_WINDOWING_EGL
#include "egl/clutter-backend-eglnative.h"
#endif
@ -101,12 +104,10 @@ clutter_backend_dispose (GObject *gobject)
/* clear the events still in the queue of the main context */
_clutter_clear_events_queue ();
/* remove all event translators */
g_clear_pointer (&backend->event_translators, g_list_free);
g_clear_pointer (&backend->dummy_onscreen, cogl_object_unref);
if (backend->stage_window)
{
g_object_remove_weak_pointer (G_OBJECT (backend->stage_window),
(gpointer *) &backend->stage_window);
}
G_OBJECT_CLASS (clutter_backend_parent_class)->dispose (gobject);
}
@ -396,7 +397,7 @@ clutter_backend_real_create_context (ClutterBackend *backend,
else
g_set_error_literal (error, CLUTTER_INIT_ERROR,
CLUTTER_INIT_ERROR_BACKEND,
"Unable to initialize the Clutter backend: no available drivers found.");
_("Unable to initialize the Clutter backend: no available drivers found."));
return FALSE;
}
@ -525,7 +526,40 @@ _clutter_create_backend (void)
static void
clutter_backend_real_init_events (ClutterBackend *backend)
{
g_error ("Unknown input backend");
const char *input_backend = NULL;
input_backend = g_getenv ("CLUTTER_INPUT_BACKEND");
if (input_backend != NULL)
input_backend = g_intern_string (input_backend);
#ifdef CLUTTER_INPUT_X11
if (clutter_check_windowing_backend (CLUTTER_WINDOWING_X11) &&
(input_backend == NULL || input_backend == I_(CLUTTER_INPUT_X11)))
{
_clutter_backend_x11_events_init (backend);
}
else
#endif
#ifdef CLUTTER_INPUT_EVDEV
/* Evdev can be used regardless of the windowing system */
if ((input_backend != NULL && strcmp (input_backend, CLUTTER_INPUT_EVDEV) == 0)
#ifdef CLUTTER_WINDOWING_EGL
/* but we do want to always use it for EGL native */
|| clutter_check_windowing_backend (CLUTTER_WINDOWING_EGL)
#endif
)
{
_clutter_events_evdev_init (backend);
}
else
#endif
if (input_backend != NULL)
{
if (input_backend != I_(CLUTTER_INPUT_NULL))
g_error ("Unrecognized input backend '%s'", input_backend);
}
else
g_error ("Unknown input backend");
}
static ClutterDeviceManager *
@ -552,6 +586,34 @@ clutter_backend_real_get_keymap (ClutterBackend *backend)
return backend->keymap;
}
static gboolean
clutter_backend_real_translate_event (ClutterBackend *backend,
gpointer native,
ClutterEvent *event)
{
GList *l;
for (l = backend->event_translators;
l != NULL;
l = l->next)
{
ClutterEventTranslator *translator = l->data;
ClutterTranslateReturn retval;
retval = _clutter_event_translator_translate_event (translator,
native,
event);
if (retval == CLUTTER_TRANSLATE_QUEUE)
return TRUE;
if (retval == CLUTTER_TRANSLATE_REMOVE)
return FALSE;
}
return FALSE;
}
static void
clutter_backend_class_init (ClutterBackendClass *klass)
{
@ -574,7 +636,8 @@ clutter_backend_class_init (ClutterBackendClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (ClutterBackendClass, resolution_changed),
NULL, NULL, NULL,
NULL, NULL,
_clutter_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
@ -591,7 +654,8 @@ clutter_backend_class_init (ClutterBackendClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (ClutterBackendClass, font_changed),
NULL, NULL, NULL,
NULL, NULL,
_clutter_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
@ -608,7 +672,8 @@ clutter_backend_class_init (ClutterBackendClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (ClutterBackendClass, settings_changed),
NULL, NULL, NULL,
NULL, NULL,
_clutter_marshal_VOID__VOID,
G_TYPE_NONE, 0);
klass->resolution_changed = clutter_backend_real_resolution_changed;
@ -616,6 +681,7 @@ clutter_backend_class_init (ClutterBackendClass *klass)
klass->init_events = clutter_backend_real_init_events;
klass->get_device_manager = clutter_backend_real_get_device_manager;
klass->translate_event = clutter_backend_real_translate_event;
klass->create_context = clutter_backend_real_create_context;
klass->get_features = clutter_backend_real_get_features;
klass->get_keymap = clutter_backend_real_get_keymap;
@ -627,7 +693,7 @@ clutter_backend_init (ClutterBackend *self)
self->units_per_em = -1.0;
self->units_serial = 1;
self->dummy_onscreen = NULL;
self->dummy_onscreen = COGL_INVALID_HANDLE;
}
void
@ -695,10 +761,6 @@ _clutter_backend_create_stage (ClutterBackend *backend,
g_assert (CLUTTER_IS_STAGE_WINDOW (stage_window));
backend->stage_window = stage_window;
g_object_add_weak_pointer (G_OBJECT (backend->stage_window),
(gpointer *) &backend->stage_window);
return stage_window;
}
@ -783,24 +845,37 @@ _clutter_backend_copy_event_data (ClutterBackend *backend,
const ClutterEvent *src,
ClutterEvent *dest)
{
ClutterDeviceManagerClass *device_manager_class;
ClutterDeviceManager *device_manager;
ClutterEventExtenderInterface *iface;
ClutterBackendClass *klass;
device_manager = clutter_device_manager_get_default ();
device_manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
device_manager_class->copy_event_data (device_manager, src, dest);
klass = CLUTTER_BACKEND_GET_CLASS (backend);
if (CLUTTER_IS_EVENT_EXTENDER (backend->device_manager))
{
iface = CLUTTER_EVENT_EXTENDER_GET_IFACE (backend->device_manager);
iface->copy_event_data (CLUTTER_EVENT_EXTENDER (backend->device_manager),
src, dest);
}
else if (klass->copy_event_data != NULL)
klass->copy_event_data (backend, src, dest);
}
void
_clutter_backend_free_event_data (ClutterBackend *backend,
ClutterEvent *event)
{
ClutterDeviceManagerClass *device_manager_class;
ClutterDeviceManager *device_manager;
ClutterEventExtenderInterface *iface;
ClutterBackendClass *klass;
device_manager = clutter_device_manager_get_default ();
device_manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
device_manager_class->free_event_data (device_manager, event);
klass = CLUTTER_BACKEND_GET_CLASS (backend);
if (CLUTTER_IS_EVENT_EXTENDER (backend->device_manager))
{
iface = CLUTTER_EVENT_EXTENDER_GET_IFACE (backend->device_manager);
iface->free_event_data (CLUTTER_EVENT_EXTENDER (backend->device_manager),
event);
}
else if (klass->free_event_data != NULL)
klass->free_event_data (backend, event);
}
/**
@ -946,6 +1021,28 @@ _clutter_backend_translate_event (ClutterBackend *backend,
event);
}
void
_clutter_backend_add_event_translator (ClutterBackend *backend,
ClutterEventTranslator *translator)
{
if (g_list_find (backend->event_translators, translator) != NULL)
return;
backend->event_translators =
g_list_prepend (backend->event_translators, translator);
}
void
_clutter_backend_remove_event_translator (ClutterBackend *backend,
ClutterEventTranslator *translator)
{
if (g_list_find (backend->event_translators, translator) == NULL)
return;
backend->event_translators =
g_list_remove (backend->event_translators, translator);
}
/**
* clutter_backend_get_cogl_context: (skip)
* @backend: a #ClutterBackend
@ -1012,9 +1109,9 @@ _clutter_backend_get_keymap_direction (ClutterBackend *backend)
void
_clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend)
{
if (backend->dummy_onscreen == NULL)
if (backend->dummy_onscreen == COGL_INVALID_HANDLE)
{
GError *internal_error = NULL;
CoglError *internal_error = NULL;
backend->dummy_onscreen = cogl_onscreen_new (backend->cogl_context, 1, 1);
@ -1022,7 +1119,7 @@ _clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend)
&internal_error))
{
g_critical ("Unable to create dummy onscreen: %s", internal_error->message);
g_error_free (internal_error);
cogl_error_free (internal_error);
return;
}
}
@ -1093,9 +1190,3 @@ clutter_backend_get_keymap (ClutterBackend *backend)
{
return CLUTTER_BACKEND_GET_CLASS (backend)->get_keymap (backend);
}
ClutterStageWindow *
clutter_backend_get_stage_window (ClutterBackend *backend)
{
return backend->stage_window;
}

File diff suppressed because it is too large Load Diff

View File

@ -152,9 +152,7 @@ clutter_bind_constraint_update_allocation (ClutterConstraint *constraint,
ClutterBindConstraint *bind = CLUTTER_BIND_CONSTRAINT (constraint);
gfloat source_width, source_height;
gfloat actor_width, actor_height;
graphene_point3d_t source_position;
source_position = GRAPHENE_POINT3D_INIT (0.f, 0.f, 0.f);
ClutterVertex source_position = { 0., };
if (bind->source == NULL)
return;

View File

@ -178,11 +178,11 @@ clutter_blur_effect_paint_target (ClutterOffscreenEffect *effect)
}
static gboolean
clutter_blur_effect_modify_paint_volume (ClutterEffect *effect,
ClutterPaintVolume *volume)
clutter_blur_effect_get_paint_volume (ClutterEffect *effect,
ClutterPaintVolume *volume)
{
gfloat cur_width, cur_height;
graphene_point3d_t origin;
ClutterVertex origin;
clutter_paint_volume_get_origin (volume, &origin);
cur_width = clutter_paint_volume_get_width (volume);
@ -223,7 +223,7 @@ clutter_blur_effect_class_init (ClutterBlurEffectClass *klass)
gobject_class->dispose = clutter_blur_effect_dispose;
effect_class->pre_paint = clutter_blur_effect_pre_paint;
effect_class->modify_paint_volume = clutter_blur_effect_modify_paint_volume;
effect_class->get_paint_volume = clutter_blur_effect_get_paint_volume;
offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass);
offscreen_class->paint_target = clutter_blur_effect_paint_target;

View File

@ -666,7 +666,8 @@ clutter_click_action_class_init (ClutterClickActionClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterClickActionClass, clicked),
NULL, NULL, NULL,
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);

View File

@ -252,13 +252,6 @@ clutter_clone_allocate (ClutterActor *self,
if (priv->clone_source == NULL)
return;
/* ClutterActor delays allocating until the actor is shown; however
* we cannot paint it correctly in that case, so force an allocation.
*/
if (clutter_actor_get_parent (priv->clone_source) != NULL &&
!clutter_actor_has_allocation (priv->clone_source))
clutter_actor_allocate_preferred_size (priv->clone_source, flags);
#if 0
/* XXX - this is wrong: ClutterClone cannot clone unparented
* actors, as it will break all invariants

View File

@ -118,6 +118,37 @@ container_real_remove (ClutterContainer *container,
clutter_actor_remove_child (CLUTTER_ACTOR (container), actor);
}
typedef struct {
ClutterCallback callback;
gpointer data;
} ForeachClosure;
static gboolean
foreach_cb (ClutterActor *actor,
gpointer data)
{
ForeachClosure *clos = data;
clos->callback (actor, clos->data);
return TRUE;
}
static void
container_real_foreach (ClutterContainer *container,
ClutterCallback callback,
gpointer user_data)
{
ForeachClosure clos;
clos.callback = callback;
clos.data = user_data;
_clutter_actor_foreach_child (CLUTTER_ACTOR (container),
foreach_cb,
&clos);
}
static void
container_real_raise (ClutterContainer *container,
ClutterActor *child,
@ -166,7 +197,8 @@ clutter_container_default_init (ClutterContainerInterface *iface)
iface_type,
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (ClutterContainerIface, actor_added),
NULL, NULL, NULL,
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);
/**
@ -184,7 +216,8 @@ clutter_container_default_init (ClutterContainerInterface *iface)
iface_type,
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (ClutterContainerIface, actor_removed),
NULL, NULL, NULL,
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);
@ -212,6 +245,7 @@ clutter_container_default_init (ClutterContainerInterface *iface)
iface->add = container_real_add;
iface->remove = container_real_remove;
iface->foreach = container_real_foreach;
iface->raise = container_real_raise;
iface->lower = container_real_lower;
iface->sort_depth_order = container_real_sort_depth_order;
@ -501,6 +535,15 @@ clutter_container_remove_valist (ClutterContainer *container,
container_remove_valist (container, first_actor, var_args);
}
static void
get_children_cb (ClutterActor *child,
gpointer data)
{
GList **children = data;
*children = g_list_prepend (*children, child);
}
/**
* clutter_container_get_children:
* @container: a #ClutterContainer
@ -518,9 +561,108 @@ clutter_container_remove_valist (ClutterContainer *container,
GList *
clutter_container_get_children (ClutterContainer *container)
{
GList *retval;
g_return_val_if_fail (CLUTTER_IS_CONTAINER (container), NULL);
return clutter_actor_get_children (CLUTTER_ACTOR (container));
retval = NULL;
clutter_container_foreach (container, get_children_cb, &retval);
return g_list_reverse (retval);
}
/**
* clutter_container_foreach:
* @container: a #ClutterContainer
* @callback: (scope call): a function to be called for each child
* @user_data: data to be passed to the function, or %NULL
*
* Calls @callback for each child of @container that was added
* by the application (with clutter_container_add_actor()). Does
* not iterate over "internal" children that are part of the
* container's own implementation, if any.
*
* This function calls the #ClutterContainerIface.foreach()
* virtual function, which has been deprecated.
*
* Since: 0.4
*
* Deprecated: 1.10: Use clutter_actor_get_first_child() or
* clutter_actor_get_last_child() to retrieve the beginning of
* the list of children, and clutter_actor_get_next_sibling()
* and clutter_actor_get_previous_sibling() to iterate over it;
* alternatively, use the #ClutterActorIter API.
*/
void
clutter_container_foreach (ClutterContainer *container,
ClutterCallback callback,
gpointer user_data)
{
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
g_return_if_fail (callback != NULL);
#ifdef CLUTTER_ENABLE_DEBUG
if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
{
ClutterContainerIface *iface = CLUTTER_CONTAINER_GET_IFACE (container);
if (iface->foreach != container_real_foreach)
_clutter_diagnostic_message ("The ClutterContainer::foreach() "
"virtual function has been deprecated "
"and it should not be overridden by "
"newly written code");
}
#endif /* CLUTTER_ENABLE_DEBUG */
CLUTTER_CONTAINER_GET_IFACE (container)->foreach (container,
callback,
user_data);
}
/**
* clutter_container_foreach_with_internals:
* @container: a #ClutterContainer
* @callback: (scope call): a function to be called for each child
* @user_data: data to be passed to the function, or %NULL
*
* Calls @callback for each child of @container, including "internal"
* children built in to the container itself that were never added
* by the application.
*
* This function calls the #ClutterContainerIface.foreach_with_internals()
* virtual function, which has been deprecated.
*
* Since: 1.0
*
* Deprecated: 1.10: See clutter_container_foreach().
*/
void
clutter_container_foreach_with_internals (ClutterContainer *container,
ClutterCallback callback,
gpointer user_data)
{
ClutterContainerIface *iface;
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
g_return_if_fail (callback != NULL);
iface = CLUTTER_CONTAINER_GET_IFACE (container);
#ifdef CLUTTER_ENABLE_DEBUG
if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
{
if (iface->foreach_with_internals != NULL)
_clutter_diagnostic_message ("The ClutterContainer::foreach_with_internals() "
"virtual function has been deprecated "
"and it should not be overridden by "
"newly written code");
}
#endif /* CLUTTER_ENABLE_DEBUG */
if (iface->foreach_with_internals != NULL)
iface->foreach_with_internals (container, callback, user_data);
else
iface->foreach (container, callback, user_data);
}
/**

View File

@ -59,6 +59,14 @@ typedef struct _ClutterContainerIface ClutterContainerIface;
* function is deprecated, and it should not be overridden.
* @remove: virtual function for removing an actor from the container. This
* virtual function is deprecated, and it should not be overridden.
* @foreach: virtual function for iterating over the container's children.
* This virtual function is deprecated, and it should not be overridden.
* @foreach_with_internals: virtual functions for iterating over the
* container's children, both added using the #ClutterContainer API
* and internal children. The implementation of this virtual function
* is required only if the #ClutterContainer implementation has
* internal children. This virtual function is deprecated, and it should
* not be overridden.
* @raise: virtual function for raising a child. This virtual function is
* deprecated and it should not be overridden.
* @lower: virtual function for lowering a child. This virtual function is
@ -80,7 +88,7 @@ typedef struct _ClutterContainerIface ClutterContainerIface;
* @actor_removed: class handler for #ClutterContainer::actor-removed
* @child_notify: class handler for #ClutterContainer::child-notify
*
* Base interface for container actors. The @add and @remove
* Base interface for container actors. The @add, @remove and @foreach
* virtual functions must be provided by any implementation; the other
* virtual functions are optional.
*
@ -96,6 +104,13 @@ struct _ClutterContainerIface
ClutterActor *actor);
void (* remove) (ClutterContainer *container,
ClutterActor *actor);
void (* foreach) (ClutterContainer *container,
ClutterCallback callback,
gpointer user_data);
void (* foreach_with_internals) (ClutterContainer *container,
ClutterCallback callback,
gpointer user_data);
/* child stacking */
void (* raise) (ClutterContainer *container,

View File

@ -129,7 +129,8 @@ clutter_content_default_init (ClutterContentInterface *iface)
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (ClutterContentInterface, attached),
NULL, NULL, NULL,
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);
@ -148,7 +149,8 @@ clutter_content_default_init (ClutterContentInterface *iface)
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (ClutterContentInterface, detached),
NULL, NULL, NULL,
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);
}

View File

@ -30,6 +30,7 @@ typedef enum
typedef enum
{
CLUTTER_DEBUG_NOP_PICKING = 1 << 0,
CLUTTER_DEBUG_DUMP_PICK_BUFFERS = 1 << 1
} ClutterPickDebugFlag;
typedef enum

View File

@ -177,7 +177,7 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect)
if (priv->is_dirty)
{
graphene_rect_t rect;
ClutterRect rect;
gboolean mapped_buffer;
CoglVertexP3T2C4 *verts;
ClutterActor *actor;
@ -193,8 +193,8 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect)
*/
if (clutter_offscreen_effect_get_target_rect (effect, &rect))
{
width = graphene_rect_get_width (&rect);
height = graphene_rect_get_height (&rect);
width = clutter_rect_get_width (&rect);
height = clutter_rect_get_height (&rect);
}
else
clutter_actor_get_size (actor, &width, &height);

View File

@ -17,6 +17,7 @@
#include "deprecated/clutter-container.h"
#include "deprecated/clutter-group.h"
#include "deprecated/clutter-keysyms.h"
#include "deprecated/clutter-main.h"
#include "deprecated/clutter-rectangle.h"
#include "deprecated/clutter-stage-manager.h"
#include "deprecated/clutter-stage.h"

View File

@ -69,23 +69,6 @@ typedef struct _ClutterTouchInfo
gfloat current_y;
} ClutterTouchInfo;
typedef struct _ClutterPtrA11yData
{
int n_btn_pressed;
float current_x;
float current_y;
float dwell_x;
float dwell_y;
gboolean dwell_drag_started;
gboolean dwell_gesture_started;
guint dwell_timer;
guint dwell_position_timer;
guint secondary_click_timer;
gboolean secondary_click_triggered;
} ClutterPtrA11yData;
struct _ClutterInputDevice
{
GObject parent_instance;
@ -160,10 +143,6 @@ struct _ClutterInputDevice
guint has_cursor : 1;
guint is_enabled : 1;
/* Accessiblity */
ClutterVirtualInputDevice *accessibility_virtual_device;
ClutterPtrA11yData *ptr_a11y_data;
};
typedef void (*ClutterEmitInputDeviceEvent) (ClutterEvent *event,
@ -194,15 +173,34 @@ struct _ClutterInputDeviceClass
ClutterEmitInputDeviceEvent emit_event_func);
};
/* Platform-dependent interface */
typedef struct _ClutterEventExtender ClutterEventExtender;
typedef struct _ClutterEventExtenderInterface ClutterEventExtenderInterface;
#define CLUTTER_TYPE_EVENT_EXTENDER (clutter_event_extender_get_type ())
#define CLUTTER_EVENT_EXTENDER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CLUTTER_TYPE_EVENT_EXTENDER, ClutterEventExtender))
#define CLUTTER_IS_EVENT_EXTENDER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CLUTTER_TYPE_EVENT_EXTENDER))
#define CLUTTER_EVENT_EXTENDER_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), CLUTTER_TYPE_EVENT_EXTENDER, ClutterEventExtenderInterface))
struct _ClutterEventExtenderInterface
{
GTypeInterface g_iface;
void (* copy_event_data) (ClutterEventExtender *event_extender,
const ClutterEvent *src,
ClutterEvent *dest);
void (* free_event_data) (ClutterEventExtender *event_extender,
ClutterEvent *event);
};
GType clutter_event_extender_get_type (void) G_GNUC_CONST;
/* device manager */
CLUTTER_EXPORT
void _clutter_device_manager_add_device (ClutterDeviceManager *device_manager,
ClutterInputDevice *device);
CLUTTER_EXPORT
void _clutter_device_manager_remove_device (ClutterDeviceManager *device_manager,
ClutterInputDevice *device);
void _clutter_device_manager_update_devices (ClutterDeviceManager *device_manager);
CLUTTER_EXPORT
void _clutter_device_manager_select_stage_events (ClutterDeviceManager *device_manager,
ClutterStage *stage);
ClutterBackend *_clutter_device_manager_get_backend (ClutterDeviceManager *device_manager);
@ -210,35 +208,25 @@ ClutterBackend *_clutter_device_manager_get_backend (ClutterDeviceMa
void _clutter_device_manager_compress_motion (ClutterDeviceManager *device_manger,
ClutterEvent *event,
const ClutterEvent *to_discard);
CLUTTER_EXPORT
void clutter_device_manager_ensure_a11y_state (ClutterDeviceManager *device_manager);
/* input device */
CLUTTER_EXPORT
gboolean _clutter_input_device_has_sequence (ClutterInputDevice *device,
ClutterEventSequence *sequence);
CLUTTER_EXPORT
void _clutter_input_device_add_event_sequence (ClutterInputDevice *device,
ClutterEvent *event);
CLUTTER_EXPORT
void _clutter_input_device_remove_event_sequence (ClutterInputDevice *device,
ClutterEvent *event);
CLUTTER_EXPORT
void _clutter_input_device_set_coords (ClutterInputDevice *device,
ClutterEventSequence *sequence,
gfloat x,
gfloat y,
ClutterStage *stage);
CLUTTER_EXPORT
void _clutter_input_device_set_state (ClutterInputDevice *device,
ClutterModifierType state);
CLUTTER_EXPORT
void _clutter_input_device_set_time (ClutterInputDevice *device,
guint32 time_);
CLUTTER_EXPORT
void _clutter_input_device_set_stage (ClutterInputDevice *device,
ClutterStage *stage);
CLUTTER_EXPORT
ClutterStage * _clutter_input_device_get_stage (ClutterInputDevice *device);
void _clutter_input_device_set_actor (ClutterInputDevice *device,
ClutterEventSequence *sequence,
@ -247,57 +235,44 @@ void _clutter_input_device_set_actor (ClutterInputDev
ClutterActor * _clutter_input_device_update (ClutterInputDevice *device,
ClutterEventSequence *sequence,
gboolean emit_crossing);
CLUTTER_EXPORT
void _clutter_input_device_set_n_keys (ClutterInputDevice *device,
guint n_keys);
CLUTTER_EXPORT
guint _clutter_input_device_add_axis (ClutterInputDevice *device,
ClutterInputAxis axis,
gdouble min_value,
gdouble max_value,
gdouble resolution);
CLUTTER_EXPORT
void _clutter_input_device_reset_axes (ClutterInputDevice *device);
CLUTTER_EXPORT
void _clutter_input_device_set_associated_device (ClutterInputDevice *device,
ClutterInputDevice *associated);
CLUTTER_EXPORT
void _clutter_input_device_add_slave (ClutterInputDevice *master,
ClutterInputDevice *slave);
CLUTTER_EXPORT
void _clutter_input_device_remove_slave (ClutterInputDevice *master,
ClutterInputDevice *slave);
CLUTTER_EXPORT
gboolean _clutter_input_device_translate_axis (ClutterInputDevice *device,
guint index_,
gdouble value,
gdouble *axis_value);
CLUTTER_EXPORT
void _clutter_input_device_add_scroll_info (ClutterInputDevice *device,
guint index_,
ClutterScrollDirection direction,
gdouble increment);
CLUTTER_EXPORT
void _clutter_input_device_reset_scroll_info (ClutterInputDevice *device);
CLUTTER_EXPORT
gboolean _clutter_input_device_get_scroll_delta (ClutterInputDevice *device,
guint index_,
gdouble value,
ClutterScrollDirection *direction_p,
gdouble *delta_p);
CLUTTER_EXPORT
ClutterInputDeviceTool * clutter_input_device_lookup_tool (ClutterInputDevice *device,
guint64 serial,
ClutterInputDeviceToolType type);
CLUTTER_EXPORT
void clutter_input_device_add_tool (ClutterInputDevice *device,
ClutterInputDeviceTool *tool);
CLUTTER_EXPORT
void clutter_input_device_update_from_tool (ClutterInputDevice *device,
ClutterInputDeviceTool *tool);

View File

@ -47,7 +47,6 @@
#include "clutter-stage-private.h"
#include "clutter-virtual-input-device.h"
#include "clutter-input-device-tool.h"
#include "clutter-input-pointer-a11y-private.h"
struct _ClutterDeviceManagerPrivate
{
@ -56,8 +55,6 @@ struct _ClutterDeviceManagerPrivate
/* Keyboard a11y */
ClutterKbdA11ySettings kbd_a11y_settings;
/* Pointer a11y */
ClutterPointerA11ySettings pointer_a11y_settings;
};
enum
@ -78,9 +75,6 @@ enum
TOOL_CHANGED,
KBD_A11Y_MASK_CHANGED,
KBD_A11Y_FLAGS_CHANGED,
PTR_A11Y_DWELL_CLICK_TYPE_CHANGED,
PTR_A11Y_TIMEOUT_STARTED,
PTR_A11Y_TIMEOUT_STOPPED,
LAST_SIGNAL
};
@ -91,14 +85,22 @@ G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterDeviceManager,
clutter_device_manager,
G_TYPE_OBJECT)
G_DEFINE_INTERFACE (ClutterEventExtender,
clutter_event_extender,
CLUTTER_TYPE_DEVICE_MANAGER)
static void
clutter_event_extender_default_init (ClutterEventExtenderInterface *iface)
{
}
static void
clutter_device_manager_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterDeviceManager *self = CLUTTER_DEVICE_MANAGER (gobject);
ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (self);
ClutterDeviceManagerPrivate *priv = CLUTTER_DEVICE_MANAGER (gobject)->priv;
switch (prop_id)
{
@ -117,8 +119,7 @@ clutter_device_manager_get_property (GObject *gobject,
GValue *value,
GParamSpec *pspec)
{
ClutterDeviceManager *self = CLUTTER_DEVICE_MANAGER (gobject);
ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (self);
ClutterDeviceManagerPrivate *priv = CLUTTER_DEVICE_MANAGER (gobject)->priv;
switch (prop_id)
{
@ -164,7 +165,8 @@ clutter_device_manager_class_init (ClutterDeviceManagerClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
CLUTTER_TYPE_INPUT_DEVICE);
@ -183,7 +185,8 @@ clutter_device_manager_class_init (ClutterDeviceManagerClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
CLUTTER_TYPE_INPUT_DEVICE);
@ -236,74 +239,12 @@ clutter_device_manager_class_init (ClutterDeviceManagerClass *klass)
G_TYPE_NONE, 2,
G_TYPE_UINT,
G_TYPE_UINT);
/**
* ClutterDeviceManager::ptr-a11y-dwell-click-type-changed:
* @manager: the #ClutterDeviceManager that emitted the signal
* @click_type: the new #ClutterPointerA11yDwellClickType mode
*
* The ::ptr-a11y-dwell-click-type-changed signal is emitted each time
* the ClutterPointerA11yDwellClickType mode is changed as the result
* of pointer accessibility operations.
*/
manager_signals[PTR_A11Y_DWELL_CLICK_TYPE_CHANGED] =
g_signal_new (I_("ptr-a11y-dwell-click-type-changed"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
g_cclosure_marshal_VOID__FLAGS,
G_TYPE_NONE, 1,
CLUTTER_TYPE_POINTER_A11Y_DWELL_CLICK_TYPE);
/**
* ClutterDeviceManager::ptr-a11y-timeout-started:
* @manager: the #ClutterDeviceManager that emitted the signal
* @device: the core pointer #ClutterInputDevice
* @timeout_type: the type of timeout #ClutterPointerA11yTimeoutType
* @delay: the delay in ms before secondary-click is triggered.
*
* The ::ptr-a11y-timeout-started signal is emitted when a
* pointer accessibility timeout delay is started, so that upper
* layers can notify the user with some visual feedback.
*/
manager_signals[PTR_A11Y_TIMEOUT_STARTED] =
g_signal_new (I_("ptr-a11y-timeout-started"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
_clutter_marshal_VOID__OBJECT_FLAGS_UINT,
G_TYPE_NONE, 3,
CLUTTER_TYPE_INPUT_DEVICE,
CLUTTER_TYPE_POINTER_A11Y_TIMEOUT_TYPE,
G_TYPE_UINT);
/**
* ClutterDeviceManager::ptr-a11y-timeout-stopped:
* @manager: the #ClutterDeviceManager that emitted the signal
* @device: the core pointer #ClutterInputDevice
* @timeout_type: the type of timeout #ClutterPointerA11yTimeoutType
* @clicked: %TRUE if the timeout finished and triggered a click
*
* The ::ptr-a11y-timeout-stopped signal is emitted when a running
* pointer accessibility timeout delay is stopped, either because
* it's triggered at the end of the delay or cancelled, so that
* upper layers can notify the user with some visual feedback.
*/
manager_signals[PTR_A11Y_TIMEOUT_STOPPED] =
g_signal_new (I_("ptr-a11y-timeout-stopped"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
_clutter_marshal_VOID__OBJECT_FLAGS_BOOLEAN,
G_TYPE_NONE, 3,
CLUTTER_TYPE_INPUT_DEVICE,
CLUTTER_TYPE_POINTER_A11Y_TIMEOUT_TYPE,
G_TYPE_BOOLEAN);
}
static void
clutter_device_manager_init (ClutterDeviceManager *self)
{
self->priv = clutter_device_manager_get_instance_private (self);
}
/**
@ -322,7 +263,7 @@ clutter_device_manager_get_default (void)
{
ClutterBackend *backend = clutter_get_default_backend ();
return CLUTTER_BACKEND_GET_CLASS (backend)->get_device_manager (backend);
return backend->device_manager;
}
/**
@ -546,11 +487,9 @@ _clutter_device_manager_update_devices (ClutterDeviceManager *device_manager)
ClutterBackend *
_clutter_device_manager_get_backend (ClutterDeviceManager *manager)
{
ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (manager);
g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER (manager), NULL);
return priv->backend;
return manager->priv->backend;
}
/**
@ -607,20 +546,6 @@ _clutter_device_manager_compress_motion (ClutterDeviceManager *device_manager,
manager_class->compress_motion (device_manager, event, to_discard);
}
void
clutter_device_manager_ensure_a11y_state (ClutterDeviceManager *device_manager)
{
ClutterInputDevice *core_pointer;
core_pointer = clutter_device_manager_get_core_device (device_manager,
CLUTTER_POINTER_DEVICE);
if (core_pointer)
{
if (_clutter_is_input_pointer_a11y_enabled (core_pointer))
_clutter_input_pointer_a11y_add_device (core_pointer);
}
}
static gboolean
are_kbd_a11y_settings_equal (ClutterKbdA11ySettings *a,
ClutterKbdA11ySettings *b)
@ -633,14 +558,13 @@ clutter_device_manager_set_kbd_a11y_settings (ClutterDeviceManager *device_man
ClutterKbdA11ySettings *settings)
{
ClutterDeviceManagerClass *manager_class;
ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (device_manager);
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
if (are_kbd_a11y_settings_equal (&priv->kbd_a11y_settings, settings))
if (are_kbd_a11y_settings_equal (&device_manager->priv->kbd_a11y_settings, settings))
return;
priv->kbd_a11y_settings = *settings;
device_manager->priv->kbd_a11y_settings = *settings;
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
if (manager_class->apply_kbd_a11y_settings)
@ -651,103 +575,7 @@ void
clutter_device_manager_get_kbd_a11y_settings (ClutterDeviceManager *device_manager,
ClutterKbdA11ySettings *settings)
{
ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (device_manager);
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
*settings = priv->kbd_a11y_settings;
}
static gboolean
are_pointer_a11y_settings_equal (ClutterPointerA11ySettings *a,
ClutterPointerA11ySettings *b)
{
return (memcmp (a, b, sizeof (ClutterPointerA11ySettings)) == 0);
}
static void
clutter_device_manager_enable_pointer_a11y (ClutterDeviceManager *device_manager)
{
ClutterInputDevice *core_pointer;
core_pointer = clutter_device_manager_get_core_device (device_manager,
CLUTTER_POINTER_DEVICE);
_clutter_input_pointer_a11y_add_device (core_pointer);
}
static void
clutter_device_manager_disable_pointer_a11y (ClutterDeviceManager *device_manager)
{
ClutterInputDevice *core_pointer;
core_pointer = clutter_device_manager_get_core_device (device_manager,
CLUTTER_POINTER_DEVICE);
_clutter_input_pointer_a11y_remove_device (core_pointer);
}
/**
* clutter_device_manager_set_pointer_a11y_settings:
* @device_manager: a #ClutterDeviceManager
* @settings: a pointer to a #ClutterPointerA11ySettings
*
* Sets the pointer accessibility settings
**/
void
clutter_device_manager_set_pointer_a11y_settings (ClutterDeviceManager *device_manager,
ClutterPointerA11ySettings *settings)
{
ClutterDeviceManagerPrivate *priv =
clutter_device_manager_get_instance_private (device_manager);
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
if (are_pointer_a11y_settings_equal (&priv->pointer_a11y_settings, settings))
return;
if (priv->pointer_a11y_settings.controls == 0 && settings->controls != 0)
clutter_device_manager_enable_pointer_a11y (device_manager);
else if (priv->pointer_a11y_settings.controls != 0 && settings->controls == 0)
clutter_device_manager_disable_pointer_a11y (device_manager);
priv->pointer_a11y_settings = *settings;
}
/**
* clutter_device_manager_get_pointer_a11y_settings:
* @device_manager: a #ClutterDeviceManager
* @settings: a pointer to a #ClutterPointerA11ySettings
*
* Gets the current pointer accessibility settings
**/
void
clutter_device_manager_get_pointer_a11y_settings (ClutterDeviceManager *device_manager,
ClutterPointerA11ySettings *settings)
{
ClutterDeviceManagerPrivate *priv =
clutter_device_manager_get_instance_private (device_manager);
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
*settings = priv->pointer_a11y_settings;
}
/**
* clutter_device_manager_set_pointer_a11y_dwell_click_type:
* @device_manager: a #ClutterDeviceManager
* @click_type: type of click as #ClutterPointerA11yDwellClickType
*
* Sets the dwell click type
**/
void
clutter_device_manager_set_pointer_a11y_dwell_click_type (ClutterDeviceManager *device_manager,
ClutterPointerA11yDwellClickType click_type)
{
ClutterDeviceManagerPrivate *priv =
clutter_device_manager_get_instance_private (device_manager);
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
priv->pointer_a11y_settings.dwell_click_type = click_type;
*settings = device_manager->priv->kbd_a11y_settings;
}

View File

@ -33,12 +33,16 @@
G_BEGIN_DECLS
#define CLUTTER_TYPE_DEVICE_MANAGER (clutter_device_manager_get_type ())
CLUTTER_EXPORT
G_DECLARE_DERIVABLE_TYPE (ClutterDeviceManager, clutter_device_manager,
CLUTTER, DEVICE_MANAGER, GObject)
#define CLUTTER_TYPE_DEVICE_MANAGER (clutter_device_manager_get_type ())
#define CLUTTER_DEVICE_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_DEVICE_MANAGER, ClutterDeviceManager))
#define CLUTTER_IS_DEVICE_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_DEVICE_MANAGER))
#define CLUTTER_DEVICE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_DEVICE_MANAGER, ClutterDeviceManagerClass))
#define CLUTTER_IS_DEVICE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_DEVICE_MANAGER))
#define CLUTTER_DEVICE_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_DEVICE_MANAGER, ClutterDeviceManagerClass))
typedef struct _ClutterDeviceManager ClutterDeviceManager;
typedef struct _ClutterDeviceManagerPrivate ClutterDeviceManagerPrivate;
typedef struct _ClutterDeviceManagerClass ClutterDeviceManagerClass;
/**
* ClutterVirtualDeviceType:
@ -70,25 +74,19 @@ typedef struct _ClutterKbdA11ySettings
} ClutterKbdA11ySettings;
/**
* ClutterPointerA11ySettings:
* ClutterDeviceManager:
*
* The #ClutterPointerA11ySettings structure contains pointer accessibility
* settings
* The #ClutterDeviceManager structure contains only private data
*
* Since: 1.2
*/
typedef struct _ClutterPointerA11ySettings
struct _ClutterDeviceManager
{
ClutterPointerA11yFlags controls;
ClutterPointerA11yDwellClickType dwell_click_type;
ClutterPointerA11yDwellMode dwell_mode;
ClutterPointerA11yDwellDirection dwell_gesture_single;
ClutterPointerA11yDwellDirection dwell_gesture_double;
ClutterPointerA11yDwellDirection dwell_gesture_drag;
ClutterPointerA11yDwellDirection dwell_gesture_secondary;
gint secondary_click_delay;
gint dwell_delay;
gint dwell_threshold;
} ClutterPointerA11ySettings;
/*< private >*/
GObject parent_instance;
ClutterDeviceManagerPrivate *priv;
};
/**
* ClutterDeviceManagerClass:
@ -123,18 +121,13 @@ struct _ClutterDeviceManagerClass
/* Keyboard accessbility */
void (* apply_kbd_a11y_settings) (ClutterDeviceManager *device_manger,
ClutterKbdA11ySettings *settings);
/* Event platform data */
void (* copy_event_data) (ClutterDeviceManager *device_manager,
const ClutterEvent *src,
ClutterEvent *dest);
void (* free_event_data) (ClutterDeviceManager *device_manager,
ClutterEvent *event);
/* padding */
gpointer _padding[4];
gpointer _padding[6];
};
CLUTTER_EXPORT
GType clutter_device_manager_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
ClutterDeviceManager *clutter_device_manager_get_default (void);
CLUTTER_EXPORT
@ -159,23 +152,10 @@ ClutterVirtualDeviceType clutter_device_manager_get_supported_virtual_device_typ
CLUTTER_EXPORT
void clutter_device_manager_set_kbd_a11y_settings (ClutterDeviceManager *device_manager,
ClutterKbdA11ySettings *settings);
CLUTTER_EXPORT
void clutter_device_manager_get_kbd_a11y_settings (ClutterDeviceManager *device_manager,
ClutterKbdA11ySettings *settings);
CLUTTER_EXPORT
void clutter_device_manager_set_pointer_a11y_settings (ClutterDeviceManager *device_manager,
ClutterPointerA11ySettings *settings);
CLUTTER_EXPORT
void clutter_device_manager_get_pointer_a11y_settings (ClutterDeviceManager *device_manager,
ClutterPointerA11ySettings *settings);
CLUTTER_EXPORT
void clutter_device_manager_set_pointer_a11y_dwell_click_type (ClutterDeviceManager *device_manager,
ClutterPointerA11yDwellClickType click_type);
G_END_DECLS
#endif /* __CLUTTER_DEVICE_MANAGER_H__ */

View File

@ -81,7 +81,7 @@ struct _ClutterDragActionPrivate
gint y_drag_threshold;
ClutterActor *drag_handle;
ClutterDragAxis drag_axis;
graphene_rect_t drag_area;
ClutterRect drag_area;
ClutterInputDevice *device;
ClutterEventSequence *sequence;
@ -542,7 +542,7 @@ clutter_drag_action_real_drag_motion (ClutterDragAction *action,
if (action->priv->drag_area_set)
{
graphene_rect_t *drag_area = &action->priv->drag_area;
ClutterRect *drag_area = &action->priv->drag_area;
x = CLAMP (x, drag_area->origin.x, drag_area->origin.x + drag_area->size.width);
y = CLAMP (y, drag_area->origin.y, drag_area->origin.y + drag_area->size.height);
@ -811,7 +811,7 @@ clutter_drag_action_class_init (ClutterDragActionClass *klass)
g_param_spec_boxed ("drag-area",
P_("Drag Area"),
P_("Constrains the dragging to a rectangle"),
GRAPHENE_TYPE_RECT,
CLUTTER_TYPE_RECT,
CLUTTER_PARAM_READWRITE);
/**
@ -1267,10 +1267,10 @@ clutter_drag_action_get_motion_coords (ClutterDragAction *action,
/**
* clutter_drag_action_get_drag_area:
* @action: a #ClutterDragAction
* @drag_area: (out caller-allocates): a #graphene_rect_t to be filled
* @drag_area: (out caller-allocates): a #ClutterRect to be filled
*
* Retrieves the "drag area" associated with @action, that
* is a #graphene_rect_t that constrains the actor movements,
* is a #ClutterRect that constrains the actor movements,
* in parents coordinates.
*
* Returns: %TRUE if the actor is actually constrained (and thus
@ -1278,7 +1278,7 @@ clutter_drag_action_get_motion_coords (ClutterDragAction *action,
*/
gboolean
clutter_drag_action_get_drag_area (ClutterDragAction *action,
graphene_rect_t *drag_area)
ClutterRect *drag_area)
{
g_return_val_if_fail (CLUTTER_IS_DRAG_ACTION (action), FALSE);
@ -1298,8 +1298,8 @@ clutter_drag_action_get_drag_area (ClutterDragAction *action,
* If @drag_area is %NULL, the actor is not constrained.
*/
void
clutter_drag_action_set_drag_area (ClutterDragAction *action,
const graphene_rect_t *drag_area)
clutter_drag_action_set_drag_area (ClutterDragAction *action,
const ClutterRect *drag_area)
{
ClutterDragActionPrivate *priv;

View File

@ -141,11 +141,11 @@ void clutter_drag_action_get_motion_coords (ClutterDragAction *actio
CLUTTER_EXPORT
gboolean clutter_drag_action_get_drag_area (ClutterDragAction *action,
graphene_rect_t *drag_area);
ClutterRect *drag_area);
CLUTTER_EXPORT
void clutter_drag_action_set_drag_area (ClutterDragAction *action,
const graphene_rect_t *drag_area);
void clutter_drag_action_set_drag_area (ClutterDragAction *action,
const ClutterRect *drag_area);
G_END_DECLS

View File

@ -428,7 +428,8 @@ clutter_drop_action_class_init (ClutterDropActionClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterDropActionClass, over_in),
NULL, NULL, NULL,
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);
@ -447,7 +448,8 @@ clutter_drop_action_class_init (ClutterDropActionClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterDropActionClass, over_out),
NULL, NULL, NULL,
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);

View File

@ -7,7 +7,7 @@ G_BEGIN_DECLS
gboolean _clutter_effect_pre_paint (ClutterEffect *effect);
void _clutter_effect_post_paint (ClutterEffect *effect);
gboolean _clutter_effect_modify_paint_volume (ClutterEffect *effect,
gboolean _clutter_effect_get_paint_volume (ClutterEffect *effect,
ClutterPaintVolume *volume);
gboolean _clutter_effect_has_custom_paint_volume (ClutterEffect *effect);
void _clutter_effect_paint (ClutterEffect *effect,

View File

@ -100,13 +100,13 @@
* // Clear the previous state //
* if (self->rect_1)
* {
* cogl_object_unref (self->rect_1);
* cogl_handle_unref (self->rect_1);
* self->rect_1 = NULL;
* }
*
* if (self->rect_2)
* {
* cogl_object_unref (self->rect_2);
* cogl_handle_unref (self->rect_2);
* self->rect_2 = NULL;
* }
*
@ -188,8 +188,8 @@ clutter_effect_real_post_paint (ClutterEffect *effect)
}
static gboolean
clutter_effect_real_modify_paint_volume (ClutterEffect *effect,
ClutterPaintVolume *volume)
clutter_effect_real_get_paint_volume (ClutterEffect *effect,
ClutterPaintVolume *volume)
{
return TRUE;
}
@ -252,7 +252,7 @@ clutter_effect_class_init (ClutterEffectClass *klass)
klass->pre_paint = clutter_effect_real_pre_paint;
klass->post_paint = clutter_effect_real_post_paint;
klass->modify_paint_volume = clutter_effect_real_modify_paint_volume;
klass->get_paint_volume = clutter_effect_real_get_paint_volume;
klass->paint = clutter_effect_real_paint;
klass->pick = clutter_effect_real_pick;
}
@ -297,14 +297,13 @@ _clutter_effect_pick (ClutterEffect *effect,
}
gboolean
_clutter_effect_modify_paint_volume (ClutterEffect *effect,
ClutterPaintVolume *volume)
_clutter_effect_get_paint_volume (ClutterEffect *effect,
ClutterPaintVolume *volume)
{
g_return_val_if_fail (CLUTTER_IS_EFFECT (effect), FALSE);
g_return_val_if_fail (volume != NULL, FALSE);
return CLUTTER_EFFECT_GET_CLASS (effect)->modify_paint_volume (effect,
volume);
return CLUTTER_EFFECT_GET_CLASS (effect)->get_paint_volume (effect, volume);
}
gboolean
@ -312,7 +311,7 @@ _clutter_effect_has_custom_paint_volume (ClutterEffect *effect)
{
g_return_val_if_fail (CLUTTER_IS_EFFECT (effect), FALSE);
return CLUTTER_EFFECT_GET_CLASS (effect)->modify_paint_volume != clutter_effect_real_modify_paint_volume;
return CLUTTER_EFFECT_GET_CLASS (effect)->get_paint_volume != clutter_effect_real_get_paint_volume;
}
/**

View File

@ -60,7 +60,7 @@ struct _ClutterEffect
* ClutterEffectClass:
* @pre_paint: virtual function
* @post_paint: virtual function
* @modify_paint_volume: virtual function
* @get_paint_volume: virtual function
* @paint: virtual function
* @pick: virtual function
*
@ -74,16 +74,16 @@ struct _ClutterEffectClass
ClutterActorMetaClass parent_class;
/*< public >*/
gboolean (* pre_paint) (ClutterEffect *effect);
void (* post_paint) (ClutterEffect *effect);
gboolean (* pre_paint) (ClutterEffect *effect);
void (* post_paint) (ClutterEffect *effect);
gboolean (* modify_paint_volume) (ClutterEffect *effect,
ClutterPaintVolume *volume);
gboolean (* get_paint_volume) (ClutterEffect *effect,
ClutterPaintVolume *volume);
void (* paint) (ClutterEffect *effect,
ClutterEffectPaintFlags flags);
void (* pick) (ClutterEffect *effect,
ClutterEffectPaintFlags flags);
void (* paint) (ClutterEffect *effect,
ClutterEffectPaintFlags flags);
void (* pick) (ClutterEffect *effect,
ClutterEffectPaintFlags flags);
/*< private >*/
void (* _clutter_effect4) (void);

View File

@ -13,7 +13,7 @@ G_BEGIN_DECLS
/*** END file-header ***/
/*** BEGIN file-production ***/
/* enumerations from "@basename@" */
/* enumerations from "@filename@" */
/*** END file-production ***/
/*** BEGIN value-header ***/

View File

@ -277,6 +277,24 @@ typedef enum
CLUTTER_ANIMATION_LAST
} ClutterAnimationMode;
/**
* ClutterFontFlags:
* @CLUTTER_FONT_MIPMAPPING: Set to use mipmaps for the glyph cache textures.
* @CLUTTER_FONT_HINTING: Set to enable hinting on the glyphs.
*
* Runtime flags to change the font quality. To be used with
* clutter_set_font_flags().
*
* Since: 1.0
*
* Deprecated: 1.22: Use #cairo_font_options_t instead
*/
typedef enum /*< prefix=CLUTTER_FONT >*/
{
CLUTTER_FONT_MIPMAPPING = (1 << 0),
CLUTTER_FONT_HINTING = (1 << 1)
} ClutterFontFlags;
/**
* ClutterTextDirection:
* @CLUTTER_TEXT_DIRECTION_DEFAULT: Use the default setting, as returned
@ -425,88 +443,6 @@ typedef enum
CLUTTER_A11Y_FEATURE_STATE_CHANGE_BEEP = 1 << 13,
} ClutterKeyboardA11yFlags;
/**
* ClutterPointerA11yFlags:
* @CLUTTER_A11Y_POINTER_ENABLED:
* @CLUTTER_A11Y_SECONDARY_CLICK_ENABLED:
* @CLUTTER_A11Y_DWELL_ENABLED:
*
* Pointer accessibility features applied to a ClutterInputDevice pointer.
*
*/
typedef enum {
CLUTTER_A11Y_SECONDARY_CLICK_ENABLED = 1 << 0,
CLUTTER_A11Y_DWELL_ENABLED = 1 << 1,
} ClutterPointerA11yFlags;
/**
* ClutterPointerA11yDwellClickType:
* @CLUTTER_A11Y_DWELL_CLICK_TYPE_NONE: Internal use only
* @CLUTTER_A11Y_DWELL_CLICK_TYPE_PRIMARY:
* @CLUTTER_A11Y_DWELL_CLICK_TYPE_SECONDARY:
* @CLUTTER_A11Y_DWELL_CLICK_TYPE_MIDDLE:
* @CLUTTER_A11Y_DWELL_CLICK_TYPE_DOUBLE:
* @CLUTTER_A11Y_DWELL_CLICK_TYPE_DRAG:
*
* Dwell click types.
*
*/
typedef enum {
CLUTTER_A11Y_DWELL_CLICK_TYPE_NONE,
CLUTTER_A11Y_DWELL_CLICK_TYPE_PRIMARY,
CLUTTER_A11Y_DWELL_CLICK_TYPE_SECONDARY,
CLUTTER_A11Y_DWELL_CLICK_TYPE_MIDDLE,
CLUTTER_A11Y_DWELL_CLICK_TYPE_DOUBLE,
CLUTTER_A11Y_DWELL_CLICK_TYPE_DRAG,
} ClutterPointerA11yDwellClickType;
/**
* ClutterPointerA11yDwellDirection:
* @CLUTTER_A11Y_DWELL_DIRECTION_NONE:
* @CLUTTER_A11Y_DWELL_DIRECTION_LEFT:
* @CLUTTER_A11Y_DWELL_DIRECTION_RIGHT:
* @CLUTTER_A11Y_DWELL_DIRECTION_UP:
* @CLUTTER_A11Y_DWELL_DIRECTION_DOWN:
*
* Dwell gesture directions.
*
*/
typedef enum {
CLUTTER_A11Y_DWELL_DIRECTION_NONE,
CLUTTER_A11Y_DWELL_DIRECTION_LEFT,
CLUTTER_A11Y_DWELL_DIRECTION_RIGHT,
CLUTTER_A11Y_DWELL_DIRECTION_UP,
CLUTTER_A11Y_DWELL_DIRECTION_DOWN,
} ClutterPointerA11yDwellDirection;
/**
* ClutterPointerA11yDwellMode:
* @CLUTTER_A11Y_DWELL_MODE_WINDOW:
* @CLUTTER_A11Y_DWELL_MODE_GESTURE:
*
* Dwell mode.
*
*/
typedef enum {
CLUTTER_A11Y_DWELL_MODE_WINDOW,
CLUTTER_A11Y_DWELL_MODE_GESTURE,
} ClutterPointerA11yDwellMode;
/**
* ClutterPointerA11yTimeoutType:
* @CLUTTER_A11Y_TIMEOUT_TYPE_SECONDARY_CLICK:
* @CLUTTER_A11Y_TIMEOUT_TYPE_DWELL:
* @CLUTTER_A11Y_TIMEOUT_TYPE_GESTURE:
*
* Pointer accessibility timeout type.
*
*/
typedef enum {
CLUTTER_A11Y_TIMEOUT_TYPE_SECONDARY_CLICK,
CLUTTER_A11Y_TIMEOUT_TYPE_DWELL,
CLUTTER_A11Y_TIMEOUT_TYPE_GESTURE,
} ClutterPointerA11yTimeoutType;
/**
* ClutterActorFlags:
* @CLUTTER_ACTOR_MAPPED: the actor will be painted (is visible, and inside
@ -956,6 +892,8 @@ typedef enum /*< prefix=CLUTTER_SCROLL >*/
/**
* ClutterStageState:
* @CLUTTER_STAGE_STATE_FULLSCREEN: Fullscreen mask
* @CLUTTER_STAGE_STATE_OFFSCREEN: Offscreen mask (deprecated)
* @CLUTTER_STAGE_STATE_ACTIVATED: Activated mask
*
* Stage state masks, used by the #ClutterEvent of type %CLUTTER_STAGE_STATE.
@ -964,6 +902,8 @@ typedef enum /*< prefix=CLUTTER_SCROLL >*/
*/
typedef enum
{
CLUTTER_STAGE_STATE_FULLSCREEN = (1 << 1),
CLUTTER_STAGE_STATE_OFFSCREEN = (1 << 2),
CLUTTER_STAGE_STATE_ACTIVATED = (1 << 3)
} ClutterStageState;
@ -973,6 +913,7 @@ typedef enum
* @CLUTTER_FEATURE_TEXTURE_YUV: Set if YUV based textures supported.
* @CLUTTER_FEATURE_TEXTURE_READ_PIXELS: Set if texture pixels can be read.
* @CLUTTER_FEATURE_STAGE_STATIC: Set if stage size if fixed (i.e framebuffer)
* @CLUTTER_FEATURE_STAGE_USER_RESIZE: Set if stage is able to be user resized.
* @CLUTTER_FEATURE_STAGE_CURSOR: Set if stage has a graphical cursor.
* @CLUTTER_FEATURE_SHADERS_GLSL: Set if the backend supports GLSL shaders.
* @CLUTTER_FEATURE_OFFSCREEN: Set if the backend supports offscreen rendering.
@ -990,6 +931,7 @@ typedef enum
CLUTTER_FEATURE_TEXTURE_YUV = (1 << 4),
CLUTTER_FEATURE_TEXTURE_READ_PIXELS = (1 << 5),
CLUTTER_FEATURE_STAGE_STATIC = (1 << 6),
CLUTTER_FEATURE_STAGE_USER_RESIZE = (1 << 7),
CLUTTER_FEATURE_STAGE_CURSOR = (1 << 8),
CLUTTER_FEATURE_SHADERS_GLSL = (1 << 9),
CLUTTER_FEATURE_OFFSCREEN = (1 << 10),

View File

@ -5,28 +5,22 @@
G_BEGIN_DECLS
CLUTTER_EXPORT
void _clutter_event_set_pointer_emulated (ClutterEvent *event,
gboolean is_emulated);
/* Reinjecting queued events for processing */
CLUTTER_EXPORT
void _clutter_process_event (ClutterEvent *event);
CLUTTER_EXPORT
gboolean _clutter_event_process_filters (ClutterEvent *event);
/* clears the event queue inside the main context */
void _clutter_clear_events_queue (void);
void _clutter_clear_events_queue_for_stage (ClutterStage *stage);
CLUTTER_EXPORT
void _clutter_event_set_platform_data (ClutterEvent *event,
gpointer data);
CLUTTER_EXPORT
gpointer _clutter_event_get_platform_data (const ClutterEvent *event);
CLUTTER_EXPORT
void _clutter_event_set_state_full (ClutterEvent *event,
ClutterModifierType button_state,
ClutterModifierType base_state,
@ -34,7 +28,6 @@ void _clutter_event_set_state_full (ClutterEvent *ev
ClutterModifierType locked_state,
ClutterModifierType effective_state);
CLUTTER_EXPORT
void _clutter_event_push (const ClutterEvent *event,
gboolean do_copy);

View File

@ -0,0 +1,38 @@
#include "clutter-build-config.h"
#include "clutter-event-translator.h"
#include "clutter-backend.h"
#include "clutter-private.h"
#define clutter_event_translator_get_type _clutter_event_translator_get_type
typedef ClutterEventTranslatorIface ClutterEventTranslatorInterface;
G_DEFINE_INTERFACE (ClutterEventTranslator, clutter_event_translator, G_TYPE_OBJECT);
static ClutterTranslateReturn
default_translate_event (ClutterEventTranslator *translator,
gpointer native,
ClutterEvent *event)
{
return CLUTTER_TRANSLATE_CONTINUE;
}
static void
clutter_event_translator_default_init (ClutterEventTranslatorIface *iface)
{
iface->translate_event = default_translate_event;
}
ClutterTranslateReturn
_clutter_event_translator_translate_event (ClutterEventTranslator *translator,
gpointer native,
ClutterEvent *translated)
{
ClutterEventTranslatorIface *iface;
iface = CLUTTER_EVENT_TRANSLATOR_GET_IFACE (translator);
return iface->translate_event (translator, native, translated);
}

View File

@ -0,0 +1,42 @@
#ifndef __CLUTTER_EVENT_TRANSLATOR_H__
#define __CLUTTER_EVENT_TRANSLATOR_H__
#include <glib-object.h>
#include <clutter/clutter-event.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_EVENT_TRANSLATOR (_clutter_event_translator_get_type ())
#define CLUTTER_EVENT_TRANSLATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_EVENT_TRANSLATOR, ClutterEventTranslator))
#define CLUTTER_IS_EVENT_TRANSLATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_EVENT_TRANSLATOR))
#define CLUTTER_EVENT_TRANSLATOR_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CLUTTER_TYPE_EVENT_TRANSLATOR, ClutterEventTranslatorIface))
typedef struct _ClutterEventTranslator ClutterEventTranslator;
typedef struct _ClutterEventTranslatorIface ClutterEventTranslatorIface;
typedef enum
{
CLUTTER_TRANSLATE_CONTINUE,
CLUTTER_TRANSLATE_REMOVE,
CLUTTER_TRANSLATE_QUEUE
} ClutterTranslateReturn;
struct _ClutterEventTranslatorIface
{
GTypeInterface g_iface;
ClutterTranslateReturn (* translate_event) (ClutterEventTranslator *translator,
gpointer native,
ClutterEvent *translated);
};
CLUTTER_EXPORT
GType _clutter_event_translator_get_type (void) G_GNUC_CONST;
ClutterTranslateReturn _clutter_event_translator_translate_event (ClutterEventTranslator *translator,
gpointer native,
ClutterEvent *translated);
G_END_DECLS
#endif /* __CLUTTER_EVENT_TRANSLATOR_H__ */

View File

@ -370,7 +370,7 @@ clutter_event_get_coords (const ClutterEvent *event,
gfloat *x,
gfloat *y)
{
graphene_point_t coords;
ClutterPoint coords;
g_return_if_fail (event != NULL);
@ -386,15 +386,15 @@ clutter_event_get_coords (const ClutterEvent *event,
/**
* clutter_event_get_position:
* @event: a #ClutterEvent
* @position: a #graphene_point_t
* @position: a #ClutterPoint
*
* Retrieves the event coordinates as a #graphene_point_t.
* Retrieves the event coordinates as a #ClutterPoint.
*
* Since: 1.12
*/
void
clutter_event_get_position (const ClutterEvent *event,
graphene_point_t *position)
ClutterPoint *position)
{
g_return_if_fail (event != NULL);
g_return_if_fail (position != NULL);
@ -415,42 +415,42 @@ clutter_event_get_position (const ClutterEvent *event,
case CLUTTER_PAD_BUTTON_RELEASE:
case CLUTTER_PAD_STRIP:
case CLUTTER_PAD_RING:
graphene_point_init (position, 0.f, 0.f);
clutter_point_init (position, 0.f, 0.f);
break;
case CLUTTER_ENTER:
case CLUTTER_LEAVE:
graphene_point_init (position, event->crossing.x, event->crossing.y);
clutter_point_init (position, event->crossing.x, event->crossing.y);
break;
case CLUTTER_BUTTON_PRESS:
case CLUTTER_BUTTON_RELEASE:
graphene_point_init (position, event->button.x, event->button.y);
clutter_point_init (position, event->button.x, event->button.y);
break;
case CLUTTER_MOTION:
graphene_point_init (position, event->motion.x, event->motion.y);
clutter_point_init (position, event->motion.x, event->motion.y);
break;
case CLUTTER_TOUCH_BEGIN:
case CLUTTER_TOUCH_UPDATE:
case CLUTTER_TOUCH_END:
case CLUTTER_TOUCH_CANCEL:
graphene_point_init (position, event->touch.x, event->touch.y);
clutter_point_init (position, event->touch.x, event->touch.y);
break;
case CLUTTER_SCROLL:
graphene_point_init (position, event->scroll.x, event->scroll.y);
clutter_point_init (position, event->scroll.x, event->scroll.y);
break;
case CLUTTER_TOUCHPAD_PINCH:
graphene_point_init (position, event->touchpad_pinch.x,
event->touchpad_pinch.y);
clutter_point_init (position, event->touchpad_pinch.x,
event->touchpad_pinch.y);
break;
case CLUTTER_TOUCHPAD_SWIPE:
graphene_point_init (position, event->touchpad_swipe.x,
event->touchpad_swipe.y);
clutter_point_init (position, event->touchpad_swipe.x,
event->touchpad_swipe.y);
break;
}
@ -1796,12 +1796,12 @@ float
clutter_event_get_distance (const ClutterEvent *source,
const ClutterEvent *target)
{
graphene_point_t p0, p1;
ClutterPoint p0, p1;
clutter_event_get_position (source, &p0);
clutter_event_get_position (source, &p1);
return graphene_point_distance (&p0, &p1, NULL, NULL);
return clutter_point_distance (&p0, &p1, NULL, NULL);
}
/**
@ -1822,17 +1822,17 @@ double
clutter_event_get_angle (const ClutterEvent *source,
const ClutterEvent *target)
{
graphene_point_t p0, p1;
ClutterPoint p0, p1;
float x_distance, y_distance;
double angle;
clutter_event_get_position (source, &p0);
clutter_event_get_position (target, &p1);
if (graphene_point_equal (&p0, &p1))
if (clutter_point_equals (&p0, &p1))
return 0;
graphene_point_distance (&p0, &p1, &x_distance, &y_distance);
clutter_point_distance (&p0, &p1, &x_distance, &y_distance);
angle = atan2 (x_distance, y_distance);

View File

@ -686,7 +686,7 @@ void clutter_event_get_coords (const ClutterEv
gfloat *y);
CLUTTER_EXPORT
void clutter_event_get_position (const ClutterEvent *event,
graphene_point_t *position);
ClutterPoint *position);
CLUTTER_EXPORT
float clutter_event_get_distance (const ClutterEvent *source,
const ClutterEvent *target);

View File

@ -804,7 +804,8 @@ clutter_gesture_action_class_init (ClutterGestureActionClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterGestureActionClass, gesture_end),
NULL, NULL, NULL,
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);
@ -826,7 +827,8 @@ clutter_gesture_action_class_init (ClutterGestureActionClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterGestureActionClass, gesture_cancel),
NULL, NULL, NULL,
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);
}

View File

@ -1,111 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
*
* Copyright (C) 2019 Endless, Inc
* 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/>.
*/
#include "clutter-build-config.h"
#include "clutter-graphene.h"
#include "clutter-private.h"
#include "clutter-types.h"
static gboolean
graphene_point_progress (const GValue *a,
const GValue *b,
double progress,
GValue *retval)
{
const graphene_point_t *ap = g_value_get_boxed (a);
const graphene_point_t *bp = g_value_get_boxed (b);
graphene_point_t res;
graphene_point_interpolate (ap, bp, progress, &res);
g_value_set_boxed (retval, &res);
return TRUE;
}
static gboolean
graphene_point3d_progress (const GValue *a,
const GValue *b,
double progress,
GValue *retval)
{
const graphene_point3d_t *av = g_value_get_boxed (a);
const graphene_point3d_t *bv = g_value_get_boxed (b);
graphene_point3d_t res;
graphene_point3d_interpolate (av, bv, progress, &res);
g_value_set_boxed (retval, &res);
return TRUE;
}
static gboolean
graphene_rect_progress (const GValue *a,
const GValue *b,
double progress,
GValue *retval)
{
const graphene_rect_t *rect_a = g_value_get_boxed (a);
const graphene_rect_t *rect_b = g_value_get_boxed (b);
graphene_rect_t res;
graphene_rect_interpolate (rect_a, rect_b, progress, &res);
g_value_set_boxed (retval, &res);
return TRUE;
}
static gboolean
graphene_size_progress (const GValue *a,
const GValue *b,
double progress,
GValue *retval)
{
const graphene_size_t *as = g_value_get_boxed (a);
const graphene_size_t *bs = g_value_get_boxed (b);
graphene_size_t res;
graphene_size_interpolate (as, bs, progress, &res);
g_value_set_boxed (retval, &res);
return TRUE;
}
void
clutter_graphene_init (void)
{
clutter_interval_register_progress_func (GRAPHENE_TYPE_POINT,
graphene_point_progress);
clutter_interval_register_progress_func (GRAPHENE_TYPE_POINT3D,
graphene_point3d_progress);
clutter_interval_register_progress_func (GRAPHENE_TYPE_RECT,
graphene_rect_progress);
clutter_interval_register_progress_func (GRAPHENE_TYPE_SIZE,
graphene_size_progress);
}

View File

@ -1,30 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
*
* Copyright (C) 2019 Endless, Inc
* 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/>.
*/
#ifndef CLUTTER_GRAPHENE_H
#define CLUTTER_GRAPHENE_H
void clutter_graphene_init (void);
#endif

View File

@ -256,7 +256,7 @@ clutter_image_set_data (ClutterImage *image,
{
g_set_error_literal (error, CLUTTER_IMAGE_ERROR,
CLUTTER_IMAGE_ERROR_INVALID_DATA,
"Unable to load image data");
_("Unable to load image data"));
return FALSE;
}
@ -325,7 +325,7 @@ clutter_image_set_bytes (ClutterImage *image,
{
g_set_error_literal (error, CLUTTER_IMAGE_ERROR,
CLUTTER_IMAGE_ERROR_INVALID_DATA,
"Unable to load image data");
_("Unable to load image data"));
return FALSE;
}
@ -419,7 +419,7 @@ clutter_image_set_area (ClutterImage *image,
{
g_set_error_literal (error, CLUTTER_IMAGE_ERROR,
CLUTTER_IMAGE_ERROR_INVALID_DATA,
"Unable to load image data");
_("Unable to load image data"));
return FALSE;
}

View File

@ -107,9 +107,6 @@ clutter_input_device_dispose (GObject *gobject)
device->associated = NULL;
}
if (device->accessibility_virtual_device)
g_clear_object (&device->accessibility_virtual_device);
g_clear_pointer (&device->axes, g_array_unref);
g_clear_pointer (&device->keys, g_array_unref);
g_clear_pointer (&device->scroll_info, g_array_unref);
@ -991,7 +988,7 @@ clutter_input_device_get_enabled (ClutterInputDevice *device)
gboolean
clutter_input_device_get_coords (ClutterInputDevice *device,
ClutterEventSequence *sequence,
graphene_point_t *point)
ClutterPoint *point)
{
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE);
g_return_val_if_fail (point != NULL, FALSE);
@ -1038,7 +1035,7 @@ _clutter_input_device_update (ClutterInputDevice *device,
ClutterStage *stage;
ClutterActor *new_cursor_actor;
ClutterActor *old_cursor_actor;
graphene_point_t point = GRAPHENE_POINT_INIT (-1.0f, -1.0f);
ClutterPoint point = { -1, -1 };
ClutterInputDeviceType device_type = device->device_type;
g_assert (device_type != CLUTTER_KEYBOARD_DEVICE &&
@ -1925,157 +1922,6 @@ _clutter_input_device_reset_scroll_info (ClutterInputDevice *device)
}
}
static void
on_grab_actor_destroy (ClutterActor *actor,
ClutterInputDevice *device)
{
switch (device->device_type)
{
case CLUTTER_POINTER_DEVICE:
case CLUTTER_TABLET_DEVICE:
device->pointer_grab_actor = NULL;
break;
case CLUTTER_KEYBOARD_DEVICE:
device->keyboard_grab_actor = NULL;
break;
default:
g_assert_not_reached ();
}
}
/**
* clutter_input_device_grab:
* @device: a #ClutterInputDevice
* @actor: a #ClutterActor
*
* Acquires a grab on @actor for the given @device.
*
* Any event coming from @device will be delivered to @actor, bypassing
* the usual event delivery mechanism, until the grab is released by
* calling clutter_input_device_ungrab().
*
* The grab is client-side: even if the windowing system used by the Clutter
* backend has the concept of "device grabs", Clutter will not use them.
*
* Only #ClutterInputDevice of types %CLUTTER_POINTER_DEVICE,
* %CLUTTER_TABLET_DEVICE and %CLUTTER_KEYBOARD_DEVICE can hold a grab.
*
* Since: 1.10
*/
void
clutter_input_device_grab (ClutterInputDevice *device,
ClutterActor *actor)
{
ClutterActor **grab_actor;
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
switch (device->device_type)
{
case CLUTTER_POINTER_DEVICE:
case CLUTTER_TABLET_DEVICE:
grab_actor = &device->pointer_grab_actor;
break;
case CLUTTER_KEYBOARD_DEVICE:
grab_actor = &device->keyboard_grab_actor;
break;
default:
g_critical ("Only pointer and keyboard devices can grab an actor");
return;
}
if (*grab_actor != NULL)
{
g_signal_handlers_disconnect_by_func (*grab_actor,
G_CALLBACK (on_grab_actor_destroy),
device);
}
*grab_actor = actor;
g_signal_connect (*grab_actor,
"destroy",
G_CALLBACK (on_grab_actor_destroy),
device);
}
/**
* clutter_input_device_ungrab:
* @device: a #ClutterInputDevice
*
* Releases the grab on the @device, if one is in place.
*
* Since: 1.10
*/
void
clutter_input_device_ungrab (ClutterInputDevice *device)
{
ClutterActor **grab_actor;
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
switch (device->device_type)
{
case CLUTTER_POINTER_DEVICE:
case CLUTTER_TABLET_DEVICE:
grab_actor = &device->pointer_grab_actor;
break;
case CLUTTER_KEYBOARD_DEVICE:
grab_actor = &device->keyboard_grab_actor;
break;
default:
return;
}
if (*grab_actor == NULL)
return;
g_signal_handlers_disconnect_by_func (*grab_actor,
G_CALLBACK (on_grab_actor_destroy),
device);
*grab_actor = NULL;
}
/**
* clutter_input_device_get_grabbed_actor:
* @device: a #ClutterInputDevice
*
* Retrieves a pointer to the #ClutterActor currently grabbing all
* the events coming from @device.
*
* Return value: (transfer none): a #ClutterActor, or %NULL
*
* Since: 1.10
*/
ClutterActor *
clutter_input_device_get_grabbed_actor (ClutterInputDevice *device)
{
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
switch (device->device_type)
{
case CLUTTER_POINTER_DEVICE:
case CLUTTER_TABLET_DEVICE:
return device->pointer_grab_actor;
case CLUTTER_KEYBOARD_DEVICE:
return device->keyboard_grab_actor;
default:
g_critical ("Only pointer and keyboard devices can grab an actor");
}
return NULL;
}
static void
on_grab_sequence_actor_destroy (ClutterActor *actor,
ClutterInputDevice *device)

View File

@ -58,7 +58,7 @@ gint clutter_input_device_get_device_id (ClutterInputDev
CLUTTER_EXPORT
gboolean clutter_input_device_get_coords (ClutterInputDevice *device,
ClutterEventSequence *sequence,
graphene_point_t *point);
ClutterPoint *point);
CLUTTER_EXPORT
ClutterModifierType clutter_input_device_get_modifier_state (ClutterInputDevice *device);
CLUTTER_EXPORT

View File

@ -89,8 +89,8 @@ clutter_input_focus_reset (ClutterInputFocus *focus)
}
void
clutter_input_focus_set_cursor_location (ClutterInputFocus *focus,
const graphene_rect_t *rect)
clutter_input_focus_set_cursor_location (ClutterInputFocus *focus,
const ClutterRect *rect)
{
ClutterInputFocusPrivate *priv;

View File

@ -57,8 +57,8 @@ gboolean clutter_input_focus_is_focused (ClutterInputFocus *focus);
CLUTTER_EXPORT
void clutter_input_focus_reset (ClutterInputFocus *focus);
CLUTTER_EXPORT
void clutter_input_focus_set_cursor_location (ClutterInputFocus *focus,
const graphene_rect_t *rect);
void clutter_input_focus_set_cursor_location (ClutterInputFocus *focus,
const ClutterRect *rect);
CLUTTER_EXPORT
void clutter_input_focus_set_surrounding (ClutterInputFocus *focus,

View File

@ -26,8 +26,8 @@ ClutterInputFocus * clutter_input_method_get_focus (ClutterInputMethod *method);
void clutter_input_method_reset (ClutterInputMethod *method);
void clutter_input_method_set_cursor_location (ClutterInputMethod *method,
const graphene_rect_t *rect);
void clutter_input_method_set_cursor_location (ClutterInputMethod *method,
const ClutterRect *rect);
void clutter_input_method_set_surrounding (ClutterInputMethod *method,
const gchar *text,
guint cursor,

View File

@ -187,7 +187,7 @@ clutter_input_method_class_init (ClutterInputMethodClass *klass)
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL,
G_TYPE_NONE, 1, GRAPHENE_TYPE_RECT);
G_TYPE_NONE, 1, CLUTTER_TYPE_RECT);
pspecs[PROP_CONTENT_HINTS] =
g_param_spec_flags ("content-hints",
@ -377,8 +377,8 @@ clutter_input_method_reset (ClutterInputMethod *im)
}
void
clutter_input_method_set_cursor_location (ClutterInputMethod *im,
const graphene_rect_t *rect)
clutter_input_method_set_cursor_location (ClutterInputMethod *im,
const ClutterRect *rect)
{
g_return_if_fail (CLUTTER_IS_INPUT_METHOD (im));

View File

@ -42,8 +42,8 @@ struct _ClutterInputMethodClass
void (* reset) (ClutterInputMethod *im);
void (* set_cursor_location) (ClutterInputMethod *im,
const graphene_rect_t *rect);
void (* set_cursor_location) (ClutterInputMethod *im,
const ClutterRect *rect);
void (* set_surrounding) (ClutterInputMethod *im,
const gchar *text,
guint cursor,

View File

@ -1,47 +0,0 @@
/*
* Copyright (C) 2019 Red Hat
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Author: Olivier Fourdan <ofourdan@redhat.com>
*/
#ifndef __CLUTTER_INPUT_POINTER_A11Y_H__
#define __CLUTTER_INPUT_POINTER_A11Y_H__
#include <clutter/clutter-types.h>
#include "clutter-enum-types.h"
G_BEGIN_DECLS
CLUTTER_EXPORT
void _clutter_input_pointer_a11y_add_device (ClutterInputDevice *device);
CLUTTER_EXPORT
void _clutter_input_pointer_a11y_remove_device (ClutterInputDevice *device);
CLUTTER_EXPORT
void _clutter_input_pointer_a11y_on_motion_event (ClutterInputDevice *device,
float x,
float y);
CLUTTER_EXPORT
void _clutter_input_pointer_a11y_on_button_event (ClutterInputDevice *device,
int button,
gboolean pressed);
CLUTTER_EXPORT
gboolean _clutter_is_input_pointer_a11y_enabled (ClutterInputDevice *device);
G_END_DECLS
#endif /* __CLUTTER_INPUT_POINTER_A11Y_H__ */

View File

@ -1,710 +0,0 @@
/*
* Copyright (C) 2019 Red Hat
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Author: Olivier Fourdan <ofourdan@redhat.com>
*
* This reimplements in Clutter the same behavior as mousetweaks original
* implementation by Gerd Kohlberger <gerdko gmail com>
* mousetweaks Copyright (C) 2007-2010 Gerd Kohlberger <gerdko gmail com>
*/
#include "clutter-build-config.h"
#include "clutter-device-manager.h"
#include "clutter-device-manager-private.h"
#include "clutter-enum-types.h"
#include "clutter-input-device.h"
#include "clutter-input-pointer-a11y-private.h"
#include "clutter-main.h"
#include "clutter-virtual-input-device.h"
static gboolean
is_secondary_click_enabled (ClutterInputDevice *device)
{
ClutterPointerA11ySettings settings;
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
return (settings.controls & CLUTTER_A11Y_SECONDARY_CLICK_ENABLED);
}
static gboolean
is_dwell_click_enabled (ClutterInputDevice *device)
{
ClutterPointerA11ySettings settings;
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
return (settings.controls & CLUTTER_A11Y_DWELL_ENABLED);
}
static unsigned int
get_secondary_click_delay (ClutterInputDevice *device)
{
ClutterPointerA11ySettings settings;
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
return settings.secondary_click_delay;
}
static unsigned int
get_dwell_delay (ClutterInputDevice *device)
{
ClutterPointerA11ySettings settings;
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
return settings.dwell_delay;
}
static unsigned int
get_dwell_threshold (ClutterInputDevice *device)
{
ClutterPointerA11ySettings settings;
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
return settings.dwell_threshold;
}
static ClutterPointerA11yDwellMode
get_dwell_mode (ClutterInputDevice *device)
{
ClutterPointerA11ySettings settings;
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
return settings.dwell_mode;
}
static ClutterPointerA11yDwellClickType
get_dwell_click_type (ClutterInputDevice *device)
{
ClutterPointerA11ySettings settings;
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
return settings.dwell_click_type;
}
static ClutterPointerA11yDwellClickType
get_dwell_click_type_for_direction (ClutterInputDevice *device,
ClutterPointerA11yDwellDirection direction)
{
ClutterPointerA11ySettings settings;
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
if (direction == settings.dwell_gesture_single)
return CLUTTER_A11Y_DWELL_CLICK_TYPE_PRIMARY;
else if (direction == settings.dwell_gesture_double)
return CLUTTER_A11Y_DWELL_CLICK_TYPE_DOUBLE;
else if (direction == settings.dwell_gesture_drag)
return CLUTTER_A11Y_DWELL_CLICK_TYPE_DRAG;
else if (direction == settings.dwell_gesture_secondary)
return CLUTTER_A11Y_DWELL_CLICK_TYPE_SECONDARY;
return CLUTTER_A11Y_DWELL_CLICK_TYPE_NONE;
}
static void
emit_button_press (ClutterInputDevice *device,
gint button)
{
clutter_virtual_input_device_notify_button (device->accessibility_virtual_device,
g_get_monotonic_time (),
button,
CLUTTER_BUTTON_STATE_PRESSED);
}
static void
emit_button_release (ClutterInputDevice *device,
gint button)
{
clutter_virtual_input_device_notify_button (device->accessibility_virtual_device,
g_get_monotonic_time (),
button,
CLUTTER_BUTTON_STATE_RELEASED);
}
static void
emit_button_click (ClutterInputDevice *device,
gint button)
{
emit_button_press (device, button);
emit_button_release (device, button);
}
static void
restore_dwell_position (ClutterInputDevice *device)
{
clutter_virtual_input_device_notify_absolute_motion (device->accessibility_virtual_device,
g_get_monotonic_time (),
device->ptr_a11y_data->dwell_x,
device->ptr_a11y_data->dwell_y);
}
static gboolean
trigger_secondary_click (gpointer data)
{
ClutterInputDevice *device = data;
device->ptr_a11y_data->secondary_click_triggered = TRUE;
device->ptr_a11y_data->secondary_click_timer = 0;
g_signal_emit_by_name (device->device_manager,
"ptr-a11y-timeout-stopped",
device,
CLUTTER_A11Y_TIMEOUT_TYPE_SECONDARY_CLICK,
TRUE);
return G_SOURCE_REMOVE;
}
static void
start_secondary_click_timeout (ClutterInputDevice *device)
{
unsigned int delay = get_secondary_click_delay (device);
device->ptr_a11y_data->secondary_click_timer =
clutter_threads_add_timeout (delay, trigger_secondary_click, device);
g_signal_emit_by_name (device->device_manager,
"ptr-a11y-timeout-started",
device,
CLUTTER_A11Y_TIMEOUT_TYPE_SECONDARY_CLICK,
delay);
}
static void
stop_secondary_click_timeout (ClutterInputDevice *device)
{
if (device->ptr_a11y_data->secondary_click_timer)
{
g_source_remove (device->ptr_a11y_data->secondary_click_timer);
device->ptr_a11y_data->secondary_click_timer = 0;
g_signal_emit_by_name (device->device_manager,
"ptr-a11y-timeout-stopped",
device,
CLUTTER_A11Y_TIMEOUT_TYPE_SECONDARY_CLICK,
FALSE);
}
device->ptr_a11y_data->secondary_click_triggered = FALSE;
}
static gboolean
pointer_has_moved (ClutterInputDevice *device)
{
float dx, dy;
gint threshold;
dx = device->ptr_a11y_data->dwell_x - device->ptr_a11y_data->current_x;
dy = device->ptr_a11y_data->dwell_y - device->ptr_a11y_data->current_y;
threshold = get_dwell_threshold (device);
/* Pythagorean theorem */
return ((dx * dx) + (dy * dy)) > (threshold * threshold);
}
static gboolean
is_secondary_click_pending (ClutterInputDevice *device)
{
return device->ptr_a11y_data->secondary_click_timer != 0;
}
static gboolean
is_secondary_click_triggered (ClutterInputDevice *device)
{
return device->ptr_a11y_data->secondary_click_triggered;
}
static gboolean
is_dwell_click_pending (ClutterInputDevice *device)
{
return device->ptr_a11y_data->dwell_timer != 0;
}
static gboolean
is_dwell_dragging (ClutterInputDevice *device)
{
return device->ptr_a11y_data->dwell_drag_started;
}
static gboolean
is_dwell_gesturing (ClutterInputDevice *device)
{
return device->ptr_a11y_data->dwell_gesture_started;
}
static gboolean
has_button_pressed (ClutterInputDevice *device)
{
return device->ptr_a11y_data->n_btn_pressed > 0;
}
static gboolean
should_start_secondary_click_timeout (ClutterInputDevice *device)
{
return !is_dwell_dragging (device);
}
static gboolean
should_start_dwell (ClutterInputDevice *device)
{
/* We should trigger a dwell if we've not already started one, and if
* no button is currently pressed or we are in the middle of a dwell
* drag action.
*/
return !is_dwell_click_pending (device) &&
(is_dwell_dragging (device) ||
!has_button_pressed (device));
}
static gboolean
should_stop_dwell (ClutterInputDevice *device)
{
/* We should stop a dwell if the motion exceeds the threshold, unless
* we've started a gesture, because we want to keep the original dwell
* location to both detect a gesture and restore the original pointer
* location once the gesture is finished.
*/
return pointer_has_moved (device) &&
!is_dwell_gesturing (device);
}
static gboolean
should_update_dwell_position (ClutterInputDevice *device)
{
return !is_dwell_gesturing (device) &&
!is_dwell_click_pending (device) &&
!is_secondary_click_pending (device);
}
static void
update_dwell_click_type (ClutterInputDevice *device)
{
ClutterPointerA11ySettings settings;
ClutterPointerA11yDwellClickType dwell_click_type;
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
dwell_click_type = settings.dwell_click_type;
switch (dwell_click_type)
{
case CLUTTER_A11Y_DWELL_CLICK_TYPE_DOUBLE:
case CLUTTER_A11Y_DWELL_CLICK_TYPE_SECONDARY:
case CLUTTER_A11Y_DWELL_CLICK_TYPE_MIDDLE:
dwell_click_type = CLUTTER_A11Y_DWELL_CLICK_TYPE_PRIMARY;
break;
case CLUTTER_A11Y_DWELL_CLICK_TYPE_DRAG:
if (!is_dwell_dragging (device))
dwell_click_type = CLUTTER_A11Y_DWELL_CLICK_TYPE_PRIMARY;
break;
case CLUTTER_A11Y_DWELL_CLICK_TYPE_PRIMARY:
case CLUTTER_A11Y_DWELL_CLICK_TYPE_NONE:
default:
break;
}
if (dwell_click_type != settings.dwell_click_type)
{
settings.dwell_click_type = dwell_click_type;
clutter_device_manager_set_pointer_a11y_settings (device->device_manager,
&settings);
g_signal_emit_by_name (device->device_manager,
"ptr-a11y-dwell-click-type-changed",
dwell_click_type);
}
}
static void
emit_dwell_click (ClutterInputDevice *device,
ClutterPointerA11yDwellClickType dwell_click_type)
{
switch (dwell_click_type)
{
case CLUTTER_A11Y_DWELL_CLICK_TYPE_PRIMARY:
emit_button_click (device, CLUTTER_BUTTON_PRIMARY);
break;
case CLUTTER_A11Y_DWELL_CLICK_TYPE_DOUBLE:
emit_button_click (device, CLUTTER_BUTTON_PRIMARY);
emit_button_click (device, CLUTTER_BUTTON_PRIMARY);
break;
case CLUTTER_A11Y_DWELL_CLICK_TYPE_DRAG:
if (is_dwell_dragging (device))
{
emit_button_release (device, CLUTTER_BUTTON_PRIMARY);
device->ptr_a11y_data->dwell_drag_started = FALSE;
}
else
{
emit_button_press (device, CLUTTER_BUTTON_PRIMARY);
device->ptr_a11y_data->dwell_drag_started = TRUE;
}
break;
case CLUTTER_A11Y_DWELL_CLICK_TYPE_SECONDARY:
emit_button_click (device, CLUTTER_BUTTON_SECONDARY);
break;
case CLUTTER_A11Y_DWELL_CLICK_TYPE_MIDDLE:
emit_button_click (device, CLUTTER_BUTTON_MIDDLE);
break;
case CLUTTER_A11Y_DWELL_CLICK_TYPE_NONE:
default:
break;
}
}
static ClutterPointerA11yDwellDirection
get_dwell_direction (ClutterInputDevice *device)
{
float dx, dy;
dx = ABS (device->ptr_a11y_data->dwell_x - device->ptr_a11y_data->current_x);
dy = ABS (device->ptr_a11y_data->dwell_y - device->ptr_a11y_data->current_y);
/* The pointer hasn't moved */
if (!pointer_has_moved (device))
return CLUTTER_A11Y_DWELL_DIRECTION_NONE;
if (device->ptr_a11y_data->dwell_x < device->ptr_a11y_data->current_x)
{
if (dx > dy)
return CLUTTER_A11Y_DWELL_DIRECTION_LEFT;
}
else
{
if (dx > dy)
return CLUTTER_A11Y_DWELL_DIRECTION_RIGHT;
}
if (device->ptr_a11y_data->dwell_y < device->ptr_a11y_data->current_y)
return CLUTTER_A11Y_DWELL_DIRECTION_UP;
return CLUTTER_A11Y_DWELL_DIRECTION_DOWN;
}
static gboolean
trigger_clear_dwell_gesture (gpointer data)
{
ClutterInputDevice *device = data;
device->ptr_a11y_data->dwell_timer = 0;
device->ptr_a11y_data->dwell_gesture_started = FALSE;
return G_SOURCE_REMOVE;
}
static gboolean
trigger_dwell_gesture (gpointer data)
{
ClutterInputDevice *device = data;
ClutterPointerA11yDwellDirection direction;
unsigned int delay = get_dwell_delay (device);
restore_dwell_position (device);
direction = get_dwell_direction (device);
emit_dwell_click (device,
get_dwell_click_type_for_direction (device,
direction));
/* Do not clear the gesture right away, otherwise we'll start another one */
device->ptr_a11y_data->dwell_timer =
clutter_threads_add_timeout (delay, trigger_clear_dwell_gesture, device);
g_signal_emit_by_name (device->device_manager,
"ptr-a11y-timeout-stopped",
device,
CLUTTER_A11Y_TIMEOUT_TYPE_GESTURE,
TRUE);
return G_SOURCE_REMOVE;
}
static void
start_dwell_gesture_timeout (ClutterInputDevice *device)
{
unsigned int delay = get_dwell_delay (device);
device->ptr_a11y_data->dwell_timer =
clutter_threads_add_timeout (delay, trigger_dwell_gesture, device);
device->ptr_a11y_data->dwell_gesture_started = TRUE;
g_signal_emit_by_name (device->device_manager,
"ptr-a11y-timeout-started",
device,
CLUTTER_A11Y_TIMEOUT_TYPE_GESTURE,
delay);
}
static gboolean
trigger_dwell_click (gpointer data)
{
ClutterInputDevice *device = data;
device->ptr_a11y_data->dwell_timer = 0;
g_signal_emit_by_name (device->device_manager,
"ptr-a11y-timeout-stopped",
device,
CLUTTER_A11Y_TIMEOUT_TYPE_DWELL,
TRUE);
if (get_dwell_mode (device) == CLUTTER_A11Y_DWELL_MODE_GESTURE)
{
if (is_dwell_dragging (device))
emit_dwell_click (device, CLUTTER_A11Y_DWELL_CLICK_TYPE_DRAG);
else
start_dwell_gesture_timeout (device);
}
else
{
emit_dwell_click (device, get_dwell_click_type (device));
update_dwell_click_type (device);
}
return G_SOURCE_REMOVE;
}
static void
start_dwell_timeout (ClutterInputDevice *device)
{
unsigned int delay = get_dwell_delay (device);
device->ptr_a11y_data->dwell_timer =
clutter_threads_add_timeout (delay, trigger_dwell_click, device);
g_signal_emit_by_name (device->device_manager,
"ptr-a11y-timeout-started",
device,
CLUTTER_A11Y_TIMEOUT_TYPE_DWELL,
delay);
}
static void
stop_dwell_timeout (ClutterInputDevice *device)
{
if (device->ptr_a11y_data->dwell_timer)
{
g_source_remove (device->ptr_a11y_data->dwell_timer);
device->ptr_a11y_data->dwell_timer = 0;
device->ptr_a11y_data->dwell_gesture_started = FALSE;
g_signal_emit_by_name (device->device_manager,
"ptr-a11y-timeout-stopped",
device,
CLUTTER_A11Y_TIMEOUT_TYPE_DWELL,
FALSE);
}
}
static gboolean
trigger_dwell_position_timeout (gpointer data)
{
ClutterInputDevice *device = data;
device->ptr_a11y_data->dwell_position_timer = 0;
if (is_dwell_click_enabled (device))
{
if (!pointer_has_moved (device))
start_dwell_timeout (device);
}
return G_SOURCE_REMOVE;
}
static void
start_dwell_position_timeout (ClutterInputDevice *device)
{
device->ptr_a11y_data->dwell_position_timer =
clutter_threads_add_timeout (100, trigger_dwell_position_timeout, device);
}
static void
stop_dwell_position_timeout (ClutterInputDevice *device)
{
g_clear_handle_id (&device->ptr_a11y_data->dwell_position_timer,
g_source_remove);
}
static void
update_dwell_position (ClutterInputDevice *device)
{
device->ptr_a11y_data->dwell_x = device->ptr_a11y_data->current_x;
device->ptr_a11y_data->dwell_y = device->ptr_a11y_data->current_y;
}
static void
update_current_position (ClutterInputDevice *device,
float x,
float y)
{
device->ptr_a11y_data->current_x = x;
device->ptr_a11y_data->current_y = y;
}
static gboolean
is_device_core_pointer (ClutterInputDevice *device)
{
ClutterInputDevice *core_pointer;
core_pointer = clutter_device_manager_get_core_device (device->device_manager,
CLUTTER_POINTER_DEVICE);
if (core_pointer == NULL)
return FALSE;
return (core_pointer == device);
}
void
_clutter_input_pointer_a11y_add_device (ClutterInputDevice *device)
{
if (!is_device_core_pointer (device))
return;
device->accessibility_virtual_device =
clutter_device_manager_create_virtual_device (device->device_manager,
CLUTTER_POINTER_DEVICE);
device->ptr_a11y_data = g_new0 (ClutterPtrA11yData, 1);
}
void
_clutter_input_pointer_a11y_remove_device (ClutterInputDevice *device)
{
if (!is_device_core_pointer (device))
return;
/* Terminate a drag if started */
if (is_dwell_dragging (device))
emit_dwell_click (device, CLUTTER_A11Y_DWELL_CLICK_TYPE_DRAG);
stop_dwell_position_timeout (device);
stop_dwell_timeout (device);
stop_secondary_click_timeout (device);
g_clear_pointer (&device->ptr_a11y_data, g_free);
}
void
_clutter_input_pointer_a11y_on_motion_event (ClutterInputDevice *device,
float x,
float y)
{
if (!is_device_core_pointer (device))
return;
if (!_clutter_is_input_pointer_a11y_enabled (device))
return;
update_current_position (device, x, y);
if (is_secondary_click_enabled (device))
{
if (pointer_has_moved (device))
stop_secondary_click_timeout (device);
}
if (is_dwell_click_enabled (device))
{
stop_dwell_position_timeout (device);
if (should_stop_dwell (device))
stop_dwell_timeout (device);
if (should_start_dwell (device))
start_dwell_position_timeout (device);
}
if (should_update_dwell_position (device))
update_dwell_position (device);
}
void
_clutter_input_pointer_a11y_on_button_event (ClutterInputDevice *device,
int button,
gboolean pressed)
{
if (!is_device_core_pointer (device))
return;
if (!_clutter_is_input_pointer_a11y_enabled (device))
return;
if (pressed)
{
device->ptr_a11y_data->n_btn_pressed++;
stop_dwell_position_timeout (device);
if (is_dwell_click_enabled (device))
stop_dwell_timeout (device);
if (is_dwell_dragging (device))
stop_dwell_timeout (device);
if (is_secondary_click_enabled (device))
{
if (button == CLUTTER_BUTTON_PRIMARY)
{
if (should_start_secondary_click_timeout (device))
start_secondary_click_timeout (device);
}
else if (is_secondary_click_pending (device))
{
stop_secondary_click_timeout (device);
}
}
}
else
{
if (has_button_pressed (device))
device->ptr_a11y_data->n_btn_pressed--;
if (is_secondary_click_triggered (device))
{
emit_button_click (device, CLUTTER_BUTTON_SECONDARY);
stop_secondary_click_timeout (device);
}
if (is_secondary_click_pending (device))
stop_secondary_click_timeout (device);
if (is_dwell_dragging (device))
emit_dwell_click (device, CLUTTER_A11Y_DWELL_CLICK_TYPE_DRAG);
}
}
gboolean
_clutter_is_input_pointer_a11y_enabled (ClutterInputDevice *device)
{
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE);
return (is_secondary_click_enabled (device) || is_dwell_click_enabled (device));
}

View File

@ -444,7 +444,8 @@ clutter_layout_manager_class_init (ClutterLayoutManagerClass *klass)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterLayoutManagerClass,
layout_changed),
NULL, NULL, NULL,
NULL, NULL,
_clutter_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}

File diff suppressed because it is too large Load Diff

View File

@ -117,6 +117,9 @@ void clutter_disable_accessibility (void);
/* Threading functions */
CLUTTER_EXPORT
void clutter_threads_set_lock_functions (GCallback enter_fn,
GCallback leave_fn);
CLUTTER_EXPORT
guint clutter_threads_add_idle (GSourceFunc func,
gpointer data);
CLUTTER_EXPORT
@ -146,6 +149,19 @@ guint clutter_threads_add_repaint_func_full (ClutterRepaintF
CLUTTER_EXPORT
void clutter_threads_remove_repaint_func (guint handle_id);
CLUTTER_EXPORT
void clutter_grab_pointer (ClutterActor *actor);
CLUTTER_EXPORT
void clutter_ungrab_pointer (void);
CLUTTER_EXPORT
ClutterActor * clutter_get_pointer_grab (void);
CLUTTER_EXPORT
void clutter_grab_keyboard (ClutterActor *actor);
CLUTTER_EXPORT
void clutter_ungrab_keyboard (void);
CLUTTER_EXPORT
ClutterActor * clutter_get_keyboard_grab (void);
CLUTTER_EXPORT
PangoFontMap * clutter_get_font_map (void);

View File

@ -12,24 +12,29 @@ BOOLEAN:OBJECT,FLOAT,FLOAT
BOXED:UINT,UINT
DOUBLE:VOID
UINT:VOID
VOID:BOOLEAN
VOID:BOXED
VOID:BOXED,FLAGS
VOID:INT
VOID:INT64,INT64,FLOAT,BOOLEAN
VOID:INT,INT
VOID:INT,POINTER
VOID:FLOAT,FLOAT
VOID:INT,INT,INT,INT
VOID:OBJECT
VOID:OBJECT,FLAGS
VOID:OBJECT,FLAGS,BOOLEAN
VOID:OBJECT,FLAGS,UINT
VOID:OBJECT,FLOAT,FLOAT
VOID:OBJECT,FLOAT,FLOAT,FLAGS
VOID:OBJECT,OBJECT
VOID:OBJECT,PARAM
VOID:OBJECT,POINTER
VOID:OBJECT,UINT
VOID:POINTER
VOID:STRING,BOOLEAN
VOID:STRING,BOOLEAN,BOOLEAN
VOID:STRING,INT
VOID:UINT
VOID:UINT,STRING,UINT
VOID:UINT,UINT
VOID:VOID
VOID:STRING,INT,POINTER

View File

@ -64,6 +64,9 @@ struct _ClutterMasterClockDefault
/* the current state of the clock, in usecs */
gint64 cur_tick;
/* the previous state of the clock, in usecs, used to compute the delta */
gint64 prev_tick;
#ifdef CLUTTER_ENABLE_DEBUG
gint64 frame_budget;
gint64 remaining_budget;
@ -74,6 +77,12 @@ struct _ClutterMasterClockDefault
*/
GSource *source;
/* If the master clock is idle that means it has
* fallen back to idle polling for timeline
* progressions and it may have been some time since
* the last real stage update.
*/
guint idle : 1;
guint ensure_next_iteration : 1;
guint paused : 1;
@ -266,12 +275,78 @@ master_clock_reschedule_stage_updates (ClutterMasterClockDefault *master_clock,
static gint
master_clock_next_frame_delay (ClutterMasterClockDefault *master_clock)
{
gint64 now, next;
gint swap_delay;
if (!master_clock_is_running (master_clock))
return -1;
/* If all of the stages are busy waiting for a swap-buffers to complete
* then we wait for one to be ready.. */
return master_clock_get_swap_wait_time (master_clock);
swap_delay = master_clock_get_swap_wait_time (master_clock);
if (swap_delay != 0)
return swap_delay;
/* When we have sync-to-vblank, we count on swap-buffer requests (or
* swap-buffer-complete events if supported in the backend) to throttle our
* frame rate so no additional delay is needed to start the next frame.
*
* If the master-clock has become idle due to no timeline progression causing
* redraws then we can no longer rely on vblank synchronization because the
* last real stage update/redraw may have happened a long time ago and so we
* fallback to polling for timeline progressions every 1/frame_rate seconds.
*
* (NB: if there aren't even any timelines running then the master clock will
* be completely stopped in master_clock_is_running())
*/
if (clutter_feature_available (CLUTTER_FEATURE_SWAP_THROTTLE) &&
!master_clock->idle)
{
CLUTTER_NOTE (SCHEDULER, "swap throttling available and updated stages");
return 0;
}
if (master_clock->prev_tick == 0)
{
/* If we weren't previously running, then draw the next frame
* immediately
*/
CLUTTER_NOTE (SCHEDULER, "draw the first frame immediately");
return 0;
}
/* Otherwise, wait at least 1/frame_rate seconds since we last
* started a frame
*/
now = g_source_get_time (master_clock->source);
next = master_clock->prev_tick;
/* If time has gone backwards then there's no way of knowing how
long we should wait so let's just dispatch immediately */
if (now <= next)
{
CLUTTER_NOTE (SCHEDULER, "Time has gone backwards");
return 0;
}
next += (1000000L / clutter_get_default_frame_rate ());
if (next <= now)
{
CLUTTER_NOTE (SCHEDULER, "Less than %lu microsecs",
1000000L / (gulong) clutter_get_default_frame_rate ());
return 0;
}
else
{
CLUTTER_NOTE (SCHEDULER, "Waiting %" G_GINT64_FORMAT " msecs",
(next - now) / 1000);
return (next - now) / 1000;
}
}
static void
@ -455,6 +530,7 @@ clutter_clock_dispatch (GSource *source,
{
ClutterClockSource *clock_source = (ClutterClockSource *) source;
ClutterMasterClockDefault *master_clock = clock_source->master_clock;
gboolean stages_updated = FALSE;
GSList *stages;
CLUTTER_NOTE (SCHEDULER, "Master clock [tick]");
@ -474,6 +550,8 @@ clutter_clock_dispatch (GSource *source,
*/
stages = master_clock_list_ready_stages (master_clock);
master_clock->idle = FALSE;
/* Each frame is split into three separate phases: */
/* 1. process all the events; each stage goes through its events queue
@ -486,12 +564,19 @@ clutter_clock_dispatch (GSource *source,
master_clock_advance_timelines (master_clock);
/* 3. relayout and redraw the stages */
master_clock_update_stages (master_clock, stages);
stages_updated = master_clock_update_stages (master_clock, stages);
/* The master clock goes idle if no stages were updated and falls back
* to polling for timeline progressions... */
if (!stages_updated)
master_clock->idle = TRUE;
master_clock_reschedule_stage_updates (master_clock, stages);
g_slist_free_full (stages, g_object_unref);
master_clock->prev_tick = master_clock->cur_tick;
_clutter_threads_release_lock ();
return TRUE;
@ -523,6 +608,7 @@ clutter_master_clock_default_init (ClutterMasterClockDefault *self)
source = clutter_clock_source_new (self);
self->source = source;
self->idle = FALSE;
self->ensure_next_iteration = FALSE;
self->paused = FALSE;

View File

@ -26,15 +26,10 @@
#define __CLUTTER_H_INSIDE__
#include "clutter-backend.h"
#include "clutter-device-manager-private.h"
#include "clutter-event-private.h"
#include "clutter-input-pointer-a11y-private.h"
#include "clutter-macros.h"
#include "clutter-private.h"
#include "clutter-stage-private.h"
#include "clutter-stage-view.h"
#include "cogl/clutter-stage-cogl.h"
#include "clutter/x11/clutter-backend-x11.h"
#include "x11/clutter-stage-x11.h"
CLUTTER_EXPORT
void clutter_set_custom_backend_func (ClutterBackend *(* func) (void));

View File

@ -86,7 +86,7 @@ struct _ClutterOffscreenEffectPrivate
ClutterActor *actor;
ClutterActor *stage;
graphene_point3d_t position;
ClutterVertex position;
int fbo_offset_x;
int fbo_offset_y;
@ -119,7 +119,7 @@ clutter_offscreen_effect_set_actor (ClutterActorMeta *meta,
/* clear out the previous state */
if (priv->offscreen != NULL)
{
cogl_object_unref (priv->offscreen);
cogl_handle_unref (priv->offscreen);
priv->offscreen = NULL;
}
@ -199,13 +199,13 @@ update_fbo (ClutterEffect *effect,
if (priv->texture != NULL)
{
cogl_object_unref (priv->texture);
cogl_handle_unref (priv->texture);
priv->texture = NULL;
}
if (priv->offscreen != NULL)
{
cogl_object_unref (priv->offscreen);
cogl_handle_unref (priv->offscreen);
priv->offscreen = NULL;
}
@ -224,7 +224,7 @@ update_fbo (ClutterEffect *effect,
{
g_warning ("%s: Unable to create an Offscreen buffer", G_STRLOC);
cogl_object_unref (priv->target);
cogl_handle_unref (priv->target);
priv->target = NULL;
priv->target_width = 0;
@ -250,11 +250,9 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
gfloat target_width = -1, target_height = -1;
gfloat resource_scale;
gfloat ceiled_resource_scale;
graphene_point3d_t local_offset;
ClutterVertex local_offset = { 0.f, 0.f, 0.f };
gfloat old_viewport[4];
local_offset = GRAPHENE_POINT3D_INIT (0.0f, 0.0f, 0.0f);
if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (effect)))
return FALSE;
@ -489,13 +487,13 @@ clutter_offscreen_effect_finalize (GObject *gobject)
ClutterOffscreenEffectPrivate *priv = self->priv;
if (priv->offscreen)
cogl_object_unref (priv->offscreen);
cogl_handle_unref (priv->offscreen);
if (priv->target)
cogl_object_unref (priv->target);
cogl_handle_unref (priv->target);
if (priv->texture)
cogl_object_unref (priv->texture);
cogl_handle_unref (priv->texture);
G_OBJECT_CLASS (clutter_offscreen_effect_parent_class)->finalize (gobject);
}
@ -539,7 +537,7 @@ clutter_offscreen_effect_init (ClutterOffscreenEffect *self)
* used instead of clutter_offscreen_effect_get_target() when the
* effect subclass wants to paint using its own material.
*
* Return value: (transfer none): a #CoglHandle or %NULL. The
* Return value: (transfer none): a #CoglHandle or %COGL_INVALID_HANDLE. The
* returned texture is owned by Clutter and it should not be
* modified or freed
*
@ -604,7 +602,7 @@ clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect)
* Calls the create_texture() virtual function of the @effect
*
* Return value: (transfer full): a handle to a Cogl texture, or
* %NULL. The returned handle has its reference
* %COGL_INVALID_HANDLE. The returned handle has its reference
* count increased.
*
* Since: 1.4
@ -684,7 +682,7 @@ clutter_offscreen_effect_get_target_size (ClutterOffscreenEffect *effect,
*/
gboolean
clutter_offscreen_effect_get_target_rect (ClutterOffscreenEffect *effect,
graphene_rect_t *rect)
ClutterRect *rect)
{
ClutterOffscreenEffectPrivate *priv;
@ -696,11 +694,11 @@ clutter_offscreen_effect_get_target_rect (ClutterOffscreenEffect *effect,
if (priv->texture == NULL)
return FALSE;
graphene_rect_init (rect,
priv->position.x,
priv->position.y,
cogl_texture_get_width (priv->texture),
cogl_texture_get_height (priv->texture));
clutter_rect_init (rect,
priv->position.x,
priv->position.y,
cogl_texture_get_width (priv->texture),
cogl_texture_get_height (priv->texture));
return TRUE;
}

View File

@ -114,7 +114,7 @@ gboolean clutter_offscreen_effect_get_target_size (ClutterOffscree
CLUTTER_EXPORT
gboolean clutter_offscreen_effect_get_target_rect (ClutterOffscreenEffect *effect,
graphene_rect_t *rect);
ClutterRect *rect);
G_END_DECLS

View File

@ -138,6 +138,8 @@ G_GNUC_INTERNAL
ClutterPaintNode * clutter_paint_node_get_last_child (ClutterPaintNode *node);
G_GNUC_INTERNAL
ClutterPaintNode * clutter_paint_node_get_parent (ClutterPaintNode *node);
G_GNUC_INTERNAL
CoglFramebuffer * clutter_paint_node_get_framebuffer (ClutterPaintNode *node);
#define CLUTTER_TYPE_LAYER_NODE (_clutter_layer_node_get_type ())
#define CLUTTER_LAYER_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_LAYER_NODE, ClutterLayerNode))

View File

@ -1099,12 +1099,12 @@ clutter_paint_node_to_json (ClutterPaintNode *node)
case PAINT_OP_PATH:
json_builder_set_member_name (builder, "path");
json_builder_add_int_value (builder, (intptr_t) op->op.path);
json_builder_add_int_value (builder, (gint64) op->op.path);
break;
case PAINT_OP_PRIMITIVE:
json_builder_set_member_name (builder, "primitive");
json_builder_add_int_value (builder, (intptr_t) op->op.primitive);
json_builder_add_int_value (builder, (gint64) op->op.primitive);
break;
case PAINT_OP_INVALID:
@ -1194,15 +1194,6 @@ clutter_paint_node_get_root (ClutterPaintNode *node)
return iter;
}
/**
* clutter_paint_node_get_framebuffer:
* @node: a #ClutterPaintNode
*
* Retrieves the #CoglFramebuffer that @node will draw
* into.
*
* Returns: (transfer none): a #CoglFramebuffer
*/
CoglFramebuffer *
clutter_paint_node_get_framebuffer (ClutterPaintNode *node)
{

View File

@ -56,9 +56,6 @@ CLUTTER_EXPORT
void clutter_paint_node_set_name (ClutterPaintNode *node,
const char *name);
CLUTTER_EXPORT
CoglFramebuffer * clutter_paint_node_get_framebuffer (ClutterPaintNode *node);
CLUTTER_EXPORT
void clutter_paint_node_add_child (ClutterPaintNode *node,
ClutterPaintNode *child);

View File

@ -58,7 +58,7 @@ struct _ClutterPaintVolume
* elements 4, 5, 6 and 7 most of the time for 2D actors when
* calculating the projected paint box.
*/
graphene_point3d_t vertices[8];
ClutterVertex vertices[8];
/* As an optimization for internally managed PaintVolumes we allow
* initializing ClutterPaintVolume variables allocated on the stack

View File

@ -63,7 +63,7 @@ _clutter_paint_volume_new (ClutterActor *actor)
pv->actor = actor;
memset (pv->vertices, 0, 8 * sizeof (graphene_point3d_t));
memset (pv->vertices, 0, 8 * sizeof (ClutterVertex));
pv->is_static = FALSE;
pv->is_empty = TRUE;
@ -96,7 +96,7 @@ _clutter_paint_volume_init_static (ClutterPaintVolume *pv,
{
pv->actor = actor;
memset (pv->vertices, 0, 8 * sizeof (graphene_point3d_t));
memset (pv->vertices, 0, 8 * sizeof (ClutterVertex));
pv->is_static = TRUE;
pv->is_empty = TRUE;
@ -170,7 +170,7 @@ clutter_paint_volume_free (ClutterPaintVolume *pv)
/**
* clutter_paint_volume_set_origin:
* @pv: a #ClutterPaintVolume
* @origin: a #graphene_point3d_t
* @origin: a #ClutterVertex
*
* Sets the origin of the paint volume.
*
@ -182,8 +182,8 @@ clutter_paint_volume_free (ClutterPaintVolume *pv)
* Since: 1.6
*/
void
clutter_paint_volume_set_origin (ClutterPaintVolume *pv,
const graphene_point3d_t *origin)
clutter_paint_volume_set_origin (ClutterPaintVolume *pv,
const ClutterVertex *origin)
{
static const int key_vertices[4] = { 0, 1, 3, 4 };
float dx, dy, dz;
@ -210,7 +210,7 @@ clutter_paint_volume_set_origin (ClutterPaintVolume *pv,
/**
* clutter_paint_volume_get_origin:
* @pv: a #ClutterPaintVolume
* @vertex: (out): the return location for a #graphene_point3d_t
* @vertex: (out): the return location for a #ClutterVertex
*
* Retrieves the origin of the #ClutterPaintVolume.
*
@ -218,7 +218,7 @@ clutter_paint_volume_set_origin (ClutterPaintVolume *pv,
*/
void
clutter_paint_volume_get_origin (const ClutterPaintVolume *pv,
graphene_point3d_t *vertex)
ClutterVertex *vertex)
{
g_return_if_fail (pv != NULL);
g_return_if_fail (vertex != NULL);
@ -659,7 +659,7 @@ clutter_paint_volume_union_box (ClutterPaintVolume *pv,
const ClutterActorBox *box)
{
ClutterPaintVolume volume;
graphene_point3d_t origin;
ClutterVertex origin;
g_return_if_fail (pv != NULL);
g_return_if_fail (box != NULL);
@ -757,7 +757,7 @@ _clutter_paint_volume_get_bounding_box (ClutterPaintVolume *pv,
ClutterActorBox *box)
{
gfloat x_min, y_min, x_max, y_max;
graphene_point3d_t *vertices;
ClutterVertex *vertices;
int count;
gint i;
@ -878,9 +878,9 @@ _clutter_paint_volume_transform (ClutterPaintVolume *pv,
cogl_matrix_transform_points (matrix,
3,
sizeof (graphene_point3d_t),
sizeof (ClutterVertex),
pv->vertices,
sizeof (graphene_point3d_t),
sizeof (ClutterVertex),
pv->vertices,
transform_count);
@ -896,7 +896,7 @@ _clutter_paint_volume_axis_align (ClutterPaintVolume *pv)
{
int count;
int i;
graphene_point3d_t origin;
ClutterVertex origin;
float max_x;
float max_y;
float max_z;
@ -1075,7 +1075,7 @@ _clutter_paint_volume_cull (ClutterPaintVolume *pv,
const ClutterPlane *planes)
{
int vertex_count;
graphene_point3d_t *vertices = pv->vertices;
ClutterVertex *vertices = pv->vertices;
gboolean partial = FALSE;
int i;
int j;
@ -1097,18 +1097,24 @@ _clutter_paint_volume_cull (ClutterPaintVolume *pv,
for (i = 0; i < 4; i++)
{
const ClutterPlane *plane = &planes[i];
int out = 0;
for (j = 0; j < vertex_count; j++)
{
graphene_vec3_t v;
ClutterVertex p;
float distance;
graphene_vec3_init (&v,
vertices[j].x - graphene_vec3_get_x (&plane->v0),
vertices[j].y - graphene_vec3_get_y (&plane->v0),
vertices[j].z - graphene_vec3_get_z (&plane->v0));
/* XXX: for perspective projections this can be optimized
* out because all the planes should pass through the origin
* so (0,0,0) is a valid v0. */
p.x = vertices[j].x - planes[i].v0[0];
p.y = vertices[j].y - planes[i].v0[1];
p.z = vertices[j].z - planes[i].v0[2];
if (graphene_vec3_dot (&plane->n, &v) < 0)
distance = (planes[i].n[0] * p.x +
planes[i].n[1] * p.y +
planes[i].n[2] * p.z);
if (distance < 0)
out++;
}

View File

@ -579,7 +579,8 @@ clutter_pan_action_class_init (ClutterPanActionClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterPanActionClass, pan_stopped),
NULL, NULL, NULL,
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);
}

View File

@ -64,6 +64,7 @@ typedef struct _ClutterVertex4 ClutterVertex4;
#define CLUTTER_UNSET_PRIVATE_FLAGS(a,f) (CLUTTER_PRIVATE_FLAGS (a) &= ~(f))
#define CLUTTER_ACTOR_IS_TOPLEVEL(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IS_TOPLEVEL) != FALSE)
#define CLUTTER_ACTOR_IS_INTERNAL_CHILD(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_INTERNAL_CHILD) != 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)
@ -84,6 +85,7 @@ typedef struct _ClutterVertex4 ClutterVertex4;
/* keep this for source compatibility with clutter */
#define P_(String) (String)
#define N_(String) (String)
#define _(String) (String)
/* This is a replacement for the nearbyint function which always rounds to the
* nearest integer. nearbyint is apparently a C99 function so it might not
@ -107,6 +109,9 @@ typedef enum
/* Used to avoid recursion */
CLUTTER_IN_RELAYOUT = 1 << 6,
/* a flag for internal children of Containers (DEPRECATED) */
CLUTTER_INTERNAL_CHILD = 1 << 7
} ClutterPrivateFlags;
/*
@ -137,6 +142,13 @@ struct _ClutterMainContext
/* default FPS; this is only used if we cannot sync to vblank */
guint frame_rate;
/* actors with a grab on all devices */
ClutterActor *pointer_grab_actor;
ClutterActor *keyboard_grab_actor;
/* stack of actors with shaders during paint */
GSList *shaders;
/* fb bit masks for col<->id mapping in picking */
gint fb_r_mask;
gint fb_g_mask;
@ -161,6 +173,7 @@ struct _ClutterMainContext
/* boolean flags */
guint is_initialized : 1;
guint motion_events_per_actor : 1;
guint defer_display_setup : 1;
guint options_parsed : 1;
guint show_fps : 1;
@ -177,9 +190,7 @@ typedef struct
gboolean _clutter_threads_dispatch (gpointer data);
void _clutter_threads_dispatch_free (gpointer data);
CLUTTER_EXPORT
void _clutter_threads_acquire_lock (void);
CLUTTER_EXPORT
void _clutter_threads_release_lock (void);
ClutterMainContext * _clutter_context_get_default (void);
@ -187,6 +198,10 @@ void _clutter_context_lock (void);
void _clutter_context_unlock (void);
gboolean _clutter_context_is_initialized (void);
ClutterPickMode _clutter_context_get_pick_mode (void);
void _clutter_context_push_shader_stack (ClutterActor *actor);
ClutterActor * _clutter_context_pop_shader_stack (ClutterActor *actor);
ClutterActor * _clutter_context_peek_shader_stack (void);
gboolean _clutter_context_get_motion_events_enabled (void);
gboolean _clutter_context_get_show_fps (void);
gboolean _clutter_feature_init (GError **error);
@ -195,7 +210,11 @@ gboolean _clutter_feature_init (GError **error);
gboolean _clutter_diagnostic_enabled (void);
void _clutter_diagnostic_message (const char *fmt, ...) G_GNUC_PRINTF (1, 2);
CLUTTER_EXPORT
/* Picking code */
guint _clutter_pixel_to_id (guchar pixel[4]);
void _clutter_id_to_color (guint id,
ClutterColor *col);
void _clutter_set_sync_to_vblank (gboolean sync_to_vblank);
/* use this function as the accumulator if you have a signal with
@ -220,17 +239,17 @@ void _clutter_run_repaint_functions (ClutterRepaintFlags flags);
GType _clutter_layout_manager_get_child_meta_type (ClutterLayoutManager *manager);
void _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
const CoglMatrix *projection,
const float *viewport,
const graphene_point3d_t *vertices_in,
graphene_point3d_t *vertices_out,
int n_vertices);
void _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
const CoglMatrix *projection,
const float *viewport,
const ClutterVertex *vertices_in,
ClutterVertex *vertices_out,
int n_vertices);
void _clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src,
graphene_rect_t *dest);
ClutterRect *dest);
void _clutter_util_rectangle_int_extents (const graphene_rect_t *src,
void _clutter_util_rectangle_int_extents (const ClutterRect *src,
cairo_rectangle_int_t *dest);
void _clutter_util_rectangle_offset (const cairo_rectangle_int_t *src,
@ -278,13 +297,12 @@ void _clutter_util_matrix_skew_yz (ClutterMatrix *matrix,
float factor);
gboolean _clutter_util_matrix_decompose (const ClutterMatrix *src,
graphene_point3d_t *scale_p,
ClutterVertex *scale_p,
float shear_p[3],
graphene_point3d_t *rotate_p,
graphene_point3d_t *translate_p,
ClutterVertex *rotate_p,
ClutterVertex *translate_p,
ClutterVertex4 *perspective_p);
CLUTTER_EXPORT
PangoDirection _clutter_pango_unichar_direction (gunichar ch);
PangoDirection _clutter_pango_find_base_dir (const gchar *text,
@ -292,8 +310,8 @@ PangoDirection _clutter_pango_find_base_dir (const gchar *text,
typedef struct _ClutterPlane
{
graphene_vec3_t v0;
graphene_vec3_t n;
float v0[3];
float n[3];
} ClutterPlane;
typedef enum _ClutterCullResult
@ -311,8 +329,6 @@ gboolean _clutter_run_progress_function (GType gtype,
gdouble progress,
GValue *retval);
void clutter_timeline_cancel_delay (ClutterTimeline *timeline);
G_END_DECLS
#endif /* __CLUTTER_PRIVATE_H__ */

View File

@ -352,64 +352,63 @@ _clutter_script_parse_knot (ClutterScript *script,
}
static gboolean
parse_rect_from_array (JsonArray *array,
graphene_rect_t *rect)
parse_geometry_from_array (JsonArray *array,
ClutterGeometry *geometry)
{
if (json_array_get_length (array) != 4)
return FALSE;
graphene_rect_init (rect,
json_array_get_int_element (array, 0),
json_array_get_int_element (array, 1),
json_array_get_int_element (array, 2),
json_array_get_int_element (array, 3));
geometry->x = json_array_get_int_element (array, 0);
geometry->y = json_array_get_int_element (array, 1);
geometry->width = json_array_get_int_element (array, 2);
geometry->height = json_array_get_int_element (array, 3);
return TRUE;
}
static gboolean
parse_rect_from_object (JsonObject *object,
graphene_rect_t *rect)
parse_geometry_from_object (JsonObject *object,
ClutterGeometry *geometry)
{
if (json_object_has_member (object, "x"))
rect->origin.x = json_object_get_int_member (object, "x");
geometry->x = json_object_get_int_member (object, "x");
else
rect->origin.x = 0;
geometry->x = 0;
if (json_object_has_member (object, "y"))
rect->origin.y = json_object_get_int_member (object, "y");
geometry->y = json_object_get_int_member (object, "y");
else
rect->origin.y = 0;
geometry->y = 0;
if (json_object_has_member (object, "width"))
rect->size.width = json_object_get_int_member (object, "width");
geometry->width = json_object_get_int_member (object, "width");
else
rect->size.width = 0;
geometry->width = 0;
if (json_object_has_member (object, "height"))
rect->size.height = json_object_get_int_member (object, "height");
geometry->height = json_object_get_int_member (object, "height");
else
rect->size.height = 0;
geometry->height = 0;
return TRUE;
}
gboolean
_clutter_script_parse_rect (ClutterScript *script,
JsonNode *node,
graphene_rect_t *rect)
_clutter_script_parse_geometry (ClutterScript *script,
JsonNode *node,
ClutterGeometry *geometry)
{
g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), FALSE);
g_return_val_if_fail (node != NULL, FALSE);
g_return_val_if_fail (rect != NULL, FALSE);
g_return_val_if_fail (geometry != NULL, FALSE);
switch (JSON_NODE_TYPE (node))
{
case JSON_NODE_ARRAY:
return parse_rect_from_array (json_node_get_array (node), rect);
return parse_geometry_from_array (json_node_get_array (node), geometry);
case JSON_NODE_OBJECT:
return parse_rect_from_object (json_node_get_object (node), rect);
return parse_geometry_from_object (json_node_get_object (node), geometry);
default:
break;
@ -493,8 +492,8 @@ _clutter_script_parse_color (ClutterScript *script,
}
static gboolean
parse_point_from_array (JsonArray *array,
graphene_point_t *point)
parse_point_from_array (JsonArray *array,
ClutterPoint *point)
{
if (json_array_get_length (array) != 2)
return FALSE;
@ -506,8 +505,8 @@ parse_point_from_array (JsonArray *array,
}
static gboolean
parse_point_from_object (JsonObject *object,
graphene_point_t *point)
parse_point_from_object (JsonObject *object,
ClutterPoint *point)
{
if (json_object_has_member (object, "x"))
point->x = json_object_get_double_member (object, "x");
@ -523,9 +522,9 @@ parse_point_from_object (JsonObject *object,
}
gboolean
_clutter_script_parse_point (ClutterScript *script,
JsonNode *node,
graphene_point_t *point)
_clutter_script_parse_point (ClutterScript *script,
JsonNode *node,
ClutterPoint *point)
{
g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), FALSE);
g_return_val_if_fail (node != NULL, FALSE);
@ -547,8 +546,8 @@ _clutter_script_parse_point (ClutterScript *script,
}
static gboolean
parse_size_from_array (JsonArray *array,
graphene_size_t *size)
parse_size_from_array (JsonArray *array,
ClutterSize *size)
{
if (json_array_get_length (array) != 2)
return FALSE;
@ -560,8 +559,8 @@ parse_size_from_array (JsonArray *array,
}
static gboolean
parse_size_from_object (JsonObject *object,
graphene_size_t *size)
parse_size_from_object (JsonObject *object,
ClutterSize *size)
{
if (json_object_has_member (object, "width"))
size->width = json_object_get_double_member (object, "width");
@ -577,9 +576,9 @@ parse_size_from_object (JsonObject *object,
}
gboolean
_clutter_script_parse_size (ClutterScript *script,
JsonNode *node,
graphene_size_t *size)
_clutter_script_parse_size (ClutterScript *script,
JsonNode *node,
ClutterSize *size)
{
g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), FALSE);
g_return_val_if_fail (node != NULL, FALSE);
@ -1329,11 +1328,11 @@ _clutter_script_parse_node (ClutterScript *script,
return TRUE;
}
}
else if (p_type == GRAPHENE_TYPE_RECT)
else if (p_type == CLUTTER_TYPE_GEOMETRY)
{
graphene_rect_t rect = GRAPHENE_RECT_INIT_ZERO;
ClutterGeometry geom = { 0, };
/* rect := {
/* geometry := {
* "x" : (int),
* "y" : (int),
* "width" : (int),
@ -1341,9 +1340,9 @@ _clutter_script_parse_node (ClutterScript *script,
* }
*/
if (_clutter_script_parse_rect (script, node, &rect))
if (_clutter_script_parse_geometry (script, node, &geom))
{
g_value_set_boxed (value, &rect);
g_value_set_boxed (value, &geom);
return TRUE;
}
}
@ -1365,9 +1364,9 @@ _clutter_script_parse_node (ClutterScript *script,
return TRUE;
}
}
else if (p_type == GRAPHENE_TYPE_POINT)
else if (p_type == CLUTTER_TYPE_POINT)
{
graphene_point_t point = GRAPHENE_POINT_INIT_ZERO;
ClutterPoint point = CLUTTER_POINT_INIT_ZERO;
if (_clutter_script_parse_point (script, node, &point))
{
@ -1375,9 +1374,9 @@ _clutter_script_parse_node (ClutterScript *script,
return TRUE;
}
}
else if (p_type == GRAPHENE_TYPE_SIZE)
else if (p_type == CLUTTER_TYPE_SIZE)
{
graphene_size_t size = GRAPHENE_SIZE_INIT_ZERO;
ClutterSize size = CLUTTER_SIZE_INIT_ZERO;
if (_clutter_script_parse_size (script, node, &size))
{
@ -1418,15 +1417,15 @@ _clutter_script_parse_node (ClutterScript *script,
return TRUE;
}
}
else if (G_VALUE_HOLDS (value, GRAPHENE_TYPE_RECT))
else if (G_VALUE_HOLDS (value, CLUTTER_TYPE_GEOMETRY))
{
graphene_rect_t rect = GRAPHENE_RECT_INIT_ZERO;
ClutterGeometry geom = { 0, };
/* rect := [ (int), (int), (int), (int) ] */
/* geometry := [ (int), (int), (int), (int) ] */
if (_clutter_script_parse_rect (script, node, &rect))
if (_clutter_script_parse_geometry (script, node, &geom))
{
g_value_set_boxed (value, &rect);
g_value_set_boxed (value, &geom);
return TRUE;
}
}
@ -1442,9 +1441,9 @@ _clutter_script_parse_node (ClutterScript *script,
return TRUE;
}
}
else if (G_VALUE_HOLDS (value, GRAPHENE_TYPE_POINT))
else if (G_VALUE_HOLDS (value, CLUTTER_TYPE_POINT))
{
graphene_point_t point = GRAPHENE_POINT_INIT_ZERO;
ClutterPoint point = CLUTTER_POINT_INIT_ZERO;
if (_clutter_script_parse_point (script, node, &point))
{
@ -1452,9 +1451,9 @@ _clutter_script_parse_node (ClutterScript *script,
return TRUE;
}
}
else if (G_VALUE_HOLDS (value, GRAPHENE_TYPE_SIZE))
else if (G_VALUE_HOLDS (value, CLUTTER_TYPE_SIZE))
{
graphene_size_t size = GRAPHENE_SIZE_INIT_ZERO;
ClutterSize size = CLUTTER_SIZE_INIT_ZERO;
if (_clutter_script_parse_size (script, node, &size))
{
@ -1637,17 +1636,14 @@ clutter_script_translate_parameters (ClutterScript *script,
GObject *object,
const gchar *name,
GList *properties,
GPtrArray **param_names,
GArray **param_values)
GArray **params)
{
ClutterScriptable *scriptable = NULL;
ClutterScriptableIface *iface = NULL;
GList *l, *unparsed;
gboolean parse_custom = FALSE;
*param_names = g_ptr_array_new_with_free_func (g_free);
*param_values = g_array_new (FALSE, FALSE, sizeof (GValue));
g_array_set_clear_func (*param_values, (GDestroyNotify) g_value_unset);
*params = g_array_new (FALSE, FALSE, sizeof (GParameter));
if (CLUTTER_IS_SCRIPTABLE (object))
{
@ -1663,7 +1659,7 @@ clutter_script_translate_parameters (ClutterScript *script,
for (l = properties; l != NULL; l = l->next)
{
PropertyInfo *pinfo = l->data;
GValue value = G_VALUE_INIT;
GParameter param = { NULL };
gboolean res = FALSE;
if (pinfo->is_child || pinfo->is_layout)
@ -1680,12 +1676,12 @@ clutter_script_translate_parameters (ClutterScript *script,
pinfo->name);
if (parse_custom)
res = iface->parse_custom_node (scriptable, script, &value,
res = iface->parse_custom_node (scriptable, script, &param.value,
pinfo->name,
pinfo->node);
if (!res)
res = _clutter_script_parse_node (script, &value,
res = _clutter_script_parse_node (script, &param.value,
pinfo->name,
pinfo->node,
pinfo->pspec);
@ -1697,8 +1693,9 @@ clutter_script_translate_parameters (ClutterScript *script,
continue;
}
g_ptr_array_add (*param_names, g_strdup (pinfo->name));
g_array_append_val (*param_values, value);
param.name = g_strdup (pinfo->name);
g_array_append_val (*params, param);
property_info_free (pinfo);
}
@ -1713,8 +1710,7 @@ clutter_script_construct_parameters (ClutterScript *script,
GType gtype,
const gchar *name,
GList *properties,
GPtrArray **construct_param_names,
GArray **construct_param_values)
GArray **construct_params)
{
GObjectClass *klass;
GList *l, *unparsed;
@ -1722,17 +1718,14 @@ clutter_script_construct_parameters (ClutterScript *script,
klass = g_type_class_ref (gtype);
g_assert (klass != NULL);
*construct_param_names = g_ptr_array_new_with_free_func (g_free);
*construct_param_values = g_array_new (FALSE, FALSE, sizeof (GValue));
g_array_set_clear_func (*construct_param_values,
(GDestroyNotify) g_value_unset);
*construct_params = g_array_new (FALSE, FALSE, sizeof (GParameter));
unparsed = NULL;
for (l = properties; l != NULL; l = l->next)
{
PropertyInfo *pinfo = l->data;
GValue value = G_VALUE_INIT;
GParameter param = { NULL };
GParamSpec *pspec = NULL;
/* we allow custom property names for classes, so if we
@ -1756,7 +1749,9 @@ clutter_script_construct_parameters (ClutterScript *script,
continue;
}
if (!_clutter_script_parse_node (script, &value,
param.name = g_strdup (pinfo->name);
if (!_clutter_script_parse_node (script, &param.value,
pinfo->name,
pinfo->node,
pinfo->pspec))
@ -1765,8 +1760,7 @@ clutter_script_construct_parameters (ClutterScript *script,
continue;
}
g_ptr_array_add (*construct_param_names, g_strdup (pinfo->name));
g_array_append_val (*construct_param_values, value);
g_array_append_val (*construct_params, param);
property_info_free (pinfo);
}
@ -2093,8 +2087,7 @@ _clutter_script_apply_properties (ClutterScript *script,
gboolean set_custom_property = FALSE;
GObject *object = oinfo->object;
GList *properties;
g_autoptr (GPtrArray) param_names = NULL;
g_autoptr (GArray) param_values = NULL;
GArray *params;
guint i;
if (!oinfo->has_unresolved)
@ -2118,31 +2111,34 @@ _clutter_script_apply_properties (ClutterScript *script,
object,
oinfo->id,
properties,
&param_names,
&param_values);
&params);
/* consume all the properties we could translate in this pass */
for (i = 0; i < param_names->len; i++)
for (i = 0; i < params->len; i++)
{
char *name = g_ptr_array_index (param_names, i);
GValue *value = &g_array_index (param_values, GValue, i);
GParameter *param = &g_array_index (params, GParameter, i);
CLUTTER_NOTE (SCRIPT,
"Setting %s property '%s' (type:%s) to object '%s' (id:%s)",
set_custom_property ? "custom" : "regular",
name,
g_type_name (G_VALUE_TYPE (value)),
param->name,
g_type_name (G_VALUE_TYPE (&param->value)),
g_type_name (oinfo->gtype),
oinfo->id);
if (set_custom_property)
iface->set_custom_property (scriptable, script,
name,
value);
param->name,
&param->value);
else
g_object_set_property (object, name, value);
g_object_set_property (object, param->name, &param->value);
g_free ((gchar *) param->name);
g_value_unset (&param->value);
}
g_array_free (params, TRUE);
_clutter_script_check_unresolved (script, oinfo);
}
@ -2150,8 +2146,8 @@ void
_clutter_script_construct_object (ClutterScript *script,
ObjectInfo *oinfo)
{
g_autoptr (GPtrArray) param_names = NULL;
g_autoptr (GArray) param_values = NULL;
GArray *params = NULL;
guint i;
/* we have completely updated the object */
if (oinfo->object != NULL)
@ -2194,14 +2190,25 @@ _clutter_script_construct_object (ClutterScript *script,
oinfo->gtype,
oinfo->id,
properties,
&param_names,
&param_values);
&params);
default_stage = clutter_stage_manager_get_default_stage (manager);
oinfo->object = G_OBJECT (default_stage);
for (i = 0; i < params->len; i++)
{
GParameter *param = &g_array_index (params, GParameter, i);
g_free ((gchar *) param->name);
g_value_unset (&param->value);
}
g_array_free (params, TRUE);
}
else
{
g_autoptr (GPtrArray) param_names = NULL;
GArray *param_values;
GList *properties = oinfo->properties;
/* every other object: first, we get the construction parameters */
@ -2210,11 +2217,22 @@ _clutter_script_construct_object (ClutterScript *script,
oinfo->gtype,
oinfo->id,
properties,
&param_names,
&param_values);
&params);
/* Convert GParameter → (GStrv, GValue[]) */
param_names = g_ptr_array_sized_new (params->len);
param_values = g_array_sized_new (TRUE, FALSE, sizeof (GValue), params->len);
for (i = 0; i < params->len; i++)
{
GParameter *param = &g_array_index (params, GParameter, i);
g_ptr_array_add (param_names, (gchar *) param->name);
g_array_append_val (param_values, param->value);
}
g_ptr_array_add (param_names, NULL);
oinfo->object = g_object_new_with_properties (oinfo->gtype,
param_names->len,
params->len,
(const gchar **) param_names->pdata,
(const GValue *) param_values->data);
@ -2223,6 +2241,17 @@ _clutter_script_construct_object (ClutterScript *script,
* else too or only by this ClutterScript object.
*/
g_object_ref_sink (oinfo->object);
for (i = 0; i < params->len; i++)
{
GParameter *param = &g_array_index (params, GParameter, i);
g_free ((gchar *) param->name);
g_value_unset (&param->value);
}
g_array_free (param_values, FALSE);
g_array_free (params, TRUE);
}
g_assert (oinfo->object != NULL);

View File

@ -122,20 +122,20 @@ gboolean _clutter_script_flags_from_string (GType gtype,
gboolean _clutter_script_parse_knot (ClutterScript *script,
JsonNode *node,
ClutterKnot *knot);
gboolean _clutter_script_parse_rect (ClutterScript *script,
gboolean _clutter_script_parse_geometry (ClutterScript *script,
JsonNode *node,
graphene_rect_t *rect);
ClutterGeometry *geometry);
gboolean _clutter_script_parse_color (ClutterScript *script,
JsonNode *node,
ClutterColor *color);
GObject *_clutter_script_parse_alpha (ClutterScript *script,
JsonNode *node);
gboolean _clutter_script_parse_point (ClutterScript *script,
JsonNode *node,
graphene_point_t *point);
gboolean _clutter_script_parse_point (ClutterScript *script,
JsonNode *node,
ClutterPoint *point);
gboolean _clutter_script_parse_size (ClutterScript *script,
JsonNode *node,
graphene_size_t *size);
ClutterSize *size);
gboolean _clutter_script_parse_translatable_string (ClutterScript *script,
JsonNode *node,

View File

@ -263,6 +263,8 @@ enum
static GParamSpec *obj_props[PROP_LAST];
#define CLUTTER_SCRIPT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_SCRIPT, ClutterScriptPrivate))
struct _ClutterScriptPrivate
{
GHashTable *objects;
@ -375,7 +377,7 @@ object_info_free (gpointer data)
static void
clutter_script_finalize (GObject *gobject)
{
ClutterScriptPrivate *priv = CLUTTER_SCRIPT (gobject)->priv;
ClutterScriptPrivate *priv = CLUTTER_SCRIPT_GET_PRIVATE (gobject);
g_object_unref (priv->parser);
g_hash_table_destroy (priv->objects);

View File

@ -56,7 +56,7 @@
struct _ClutterScrollActorPrivate
{
graphene_point_t scroll_to;
ClutterPoint scroll_to;
ClutterScrollMode scroll_mode;
@ -94,19 +94,19 @@ G_DEFINE_TYPE_WITH_CODE (ClutterScrollActor, clutter_scroll_actor, CLUTTER_TYPE_
clutter_animatable_iface_init))
static void
clutter_scroll_actor_set_scroll_to_internal (ClutterScrollActor *self,
const graphene_point_t *point)
clutter_scroll_actor_set_scroll_to_internal (ClutterScrollActor *self,
const ClutterPoint *point)
{
ClutterScrollActorPrivate *priv = self->priv;
ClutterActor *actor = CLUTTER_ACTOR (self);
ClutterMatrix m = CLUTTER_MATRIX_INIT_IDENTITY;
float dx, dy;
if (graphene_point_equal (&priv->scroll_to, point))
if (clutter_point_equals (&priv->scroll_to, point))
return;
if (point == NULL)
graphene_point_init (&priv->scroll_to, 0.f, 0.f);
clutter_point_init (&priv->scroll_to, 0.f, 0.f);
else
priv->scroll_to = *point;
@ -216,7 +216,7 @@ clutter_scroll_actor_set_final_state (ClutterAnimatable *animatable,
if (strcmp (property_name, "scroll-to") == 0)
{
ClutterScrollActor *self = CLUTTER_SCROLL_ACTOR (animatable);
const graphene_point_t *point = g_value_get_boxed (value);
const ClutterPoint *point = g_value_get_boxed (value);
clutter_scroll_actor_set_scroll_to_internal (self, point);
}
@ -248,7 +248,7 @@ clutter_animatable_iface_init (ClutterAnimatableInterface *iface)
g_param_spec_boxed ("scroll-to",
"Scroll To",
"The point to scroll the actor to",
GRAPHENE_TYPE_POINT,
CLUTTER_TYPE_POINT,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS |
CLUTTER_PARAM_ANIMATABLE);
@ -322,7 +322,7 @@ clutter_scroll_actor_get_scroll_mode (ClutterScrollActor *actor)
/**
* clutter_scroll_actor_scroll_to_point:
* @actor: a #ClutterScrollActor
* @point: a #graphene_point_t
* @point: a #ClutterPoint
*
* Scrolls the contents of @actor so that @point is the new origin
* of the visible area.
@ -335,8 +335,8 @@ clutter_scroll_actor_get_scroll_mode (ClutterScrollActor *actor)
* Since: 1.12
*/
void
clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor,
const graphene_point_t *point)
clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor,
const ClutterPoint *point)
{
ClutterScrollActorPrivate *priv;
const ClutterAnimationInfo *info;
@ -390,10 +390,10 @@ clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor,
/* if a transition already exist, update its bounds */
clutter_transition_set_from (priv->transition,
GRAPHENE_TYPE_POINT,
CLUTTER_TYPE_POINT,
&priv->scroll_to);
clutter_transition_set_to (priv->transition,
GRAPHENE_TYPE_POINT,
CLUTTER_TYPE_POINT,
point);
/* always use the current easing state */
@ -417,10 +417,10 @@ clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor,
* Since: 1.12
*/
void
clutter_scroll_actor_scroll_to_rect (ClutterScrollActor *actor,
const graphene_rect_t *rect)
clutter_scroll_actor_scroll_to_rect (ClutterScrollActor *actor,
const ClutterRect *rect)
{
graphene_rect_t n_rect;
ClutterRect n_rect;
g_return_if_fail (CLUTTER_IS_SCROLL_ACTOR (actor));
g_return_if_fail (rect != NULL);
@ -428,7 +428,7 @@ clutter_scroll_actor_scroll_to_rect (ClutterScrollActor *actor,
n_rect = *rect;
/* normalize, so that we have a valid origin */
graphene_rect_normalize (&n_rect);
clutter_rect_normalize (&n_rect);
clutter_scroll_actor_scroll_to_point (actor, &n_rect.origin);
}

View File

@ -86,11 +86,11 @@ CLUTTER_EXPORT
ClutterScrollMode clutter_scroll_actor_get_scroll_mode (ClutterScrollActor *actor);
CLUTTER_EXPORT
void clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor,
const graphene_point_t *point);
void clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor,
const ClutterPoint *point);
CLUTTER_EXPORT
void clutter_scroll_actor_scroll_to_rect (ClutterScrollActor *actor,
const graphene_rect_t *rect);
void clutter_scroll_actor_scroll_to_rect (ClutterScrollActor *actor,
const ClutterRect *rect);
G_END_DECLS

View File

@ -177,18 +177,18 @@ clutter_shader_effect_clear (ClutterShaderEffect *self,
{
ClutterShaderEffectPrivate *priv = self->priv;
if (priv->shader != NULL)
if (priv->shader != COGL_INVALID_HANDLE)
{
cogl_object_unref (priv->shader);
cogl_handle_unref (priv->shader);
priv->shader = NULL;
priv->shader = COGL_INVALID_HANDLE;
}
if (priv->program != NULL)
if (priv->program != COGL_INVALID_HANDLE)
{
cogl_object_unref (priv->program);
cogl_handle_unref (priv->program);
priv->program = NULL;
priv->program = COGL_INVALID_HANDLE;
}
if (reset_uniforms && priv->uniforms != NULL)
@ -208,7 +208,7 @@ clutter_shader_effect_update_uniforms (ClutterShaderEffect *effect)
gpointer key, value;
gsize size;
if (priv->program == NULL)
if (priv->program == COGL_INVALID_HANDLE)
return;
if (priv->uniforms == NULL)
@ -333,7 +333,7 @@ clutter_shader_effect_create_shader (ClutterShaderEffect *self)
default:
g_assert_not_reached ();
return NULL;
return COGL_INVALID_HANDLE;
}
}
@ -353,7 +353,7 @@ clutter_shader_effect_try_static_source (ClutterShaderEffect *self)
CLUTTER_TYPE_SHADER_EFFECT,
ClutterShaderEffectClassPrivate);
if (class_priv->shader == NULL)
if (class_priv->shader == COGL_INVALID_HANDLE)
{
gchar *source;
@ -387,10 +387,10 @@ clutter_shader_effect_try_static_source (ClutterShaderEffect *self)
}
}
priv->shader = cogl_object_ref (class_priv->shader);
priv->shader = cogl_handle_ref (class_priv->shader);
if (class_priv->program != NULL)
priv->program = cogl_object_ref (class_priv->program);
if (class_priv->program != COGL_INVALID_HANDLE)
priv->program = cogl_handle_ref (class_priv->program);
}
}
@ -404,13 +404,13 @@ clutter_shader_effect_paint_target (ClutterOffscreenEffect *effect)
/* If the source hasn't been set then we'll try to get it from the
static source instead */
if (priv->shader == NULL)
if (priv->shader == COGL_INVALID_HANDLE)
clutter_shader_effect_try_static_source (self);
/* we haven't been prepared or we don't have support for
* GLSL shaders in Clutter
*/
if (priv->program == NULL)
if (priv->program == COGL_INVALID_HANDLE)
goto out;
CLUTTER_NOTE (SHADER, "Applying the shader effect of type '%s'",
@ -500,7 +500,6 @@ static void
clutter_shader_effect_init (ClutterShaderEffect *effect)
{
effect->priv = clutter_shader_effect_get_instance_private (effect);
effect->priv->shader_type = CLUTTER_FRAGMENT_SHADER;
}
/**
@ -534,7 +533,7 @@ clutter_shader_effect_new (ClutterShaderType shader_type)
* Retrieves a pointer to the shader's handle
*
* Return value: (transfer none): a pointer to the shader's handle,
* or %NULL
* or %COGL_INVALID_HANDLE
*
* Since: 1.4
*/
@ -542,7 +541,7 @@ CoglHandle
clutter_shader_effect_get_shader (ClutterShaderEffect *effect)
{
g_return_val_if_fail (CLUTTER_IS_SHADER_EFFECT (effect),
NULL);
COGL_INVALID_HANDLE);
return effect->priv->shader;
}
@ -554,7 +553,7 @@ clutter_shader_effect_get_shader (ClutterShaderEffect *effect)
* Retrieves a pointer to the program's handle
*
* Return value: (transfer none): a pointer to the program's handle,
* or %NULL
* or %COGL_INVALID_HANDLE
*
* Since: 1.4
*/
@ -562,7 +561,7 @@ CoglHandle
clutter_shader_effect_get_program (ClutterShaderEffect *effect)
{
g_return_val_if_fail (CLUTTER_IS_SHADER_EFFECT (effect),
NULL);
COGL_INVALID_HANDLE);
return effect->priv->program;
}
@ -892,7 +891,7 @@ clutter_shader_effect_set_shader_source (ClutterShaderEffect *effect,
priv = effect->priv;
if (priv->shader != NULL)
if (priv->shader != COGL_INVALID_HANDLE)
return TRUE;
priv->shader = clutter_shader_effect_create_shader (effect);

View File

@ -134,7 +134,8 @@ clutter_stage_manager_class_init (ClutterStageManagerClass *klass)
G_OBJECT_CLASS_TYPE (gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterStageManagerClass, stage_added),
NULL, NULL, NULL,
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
CLUTTER_TYPE_STAGE);
/**
@ -152,7 +153,8 @@ clutter_stage_manager_class_init (ClutterStageManagerClass *klass)
G_OBJECT_CLASS_TYPE (gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterStageManagerClass, stage_removed),
NULL, NULL, NULL,
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
CLUTTER_TYPE_STAGE);
}

View File

@ -40,12 +40,8 @@ void _clutter_stage_paint_view (ClutterStage
ClutterStageView *view,
const cairo_rectangle_int_t *clip);
void _clutter_stage_emit_after_paint (ClutterStage *stage);
CLUTTER_EXPORT
void _clutter_stage_set_window (ClutterStage *stage,
ClutterStageWindow *stage_window);
CLUTTER_EXPORT
ClutterStageWindow *_clutter_stage_get_window (ClutterStage *stage);
void _clutter_stage_get_projection_matrix (ClutterStage *stage,
CoglMatrix *projection);
@ -67,7 +63,6 @@ void _clutter_stage_maybe_relayout (ClutterActor
gboolean _clutter_stage_needs_update (ClutterStage *stage);
gboolean _clutter_stage_do_update (ClutterStage *stage);
CLUTTER_EXPORT
void _clutter_stage_queue_event (ClutterStage *stage,
ClutterEvent *event,
gboolean copy_event);
@ -79,18 +74,9 @@ gint64 _clutter_stage_get_update_time (ClutterStage *stage);
void _clutter_stage_clear_update_time (ClutterStage *stage);
gboolean _clutter_stage_has_full_redraw_queued (ClutterStage *stage);
void clutter_stage_log_pick (ClutterStage *stage,
const graphene_point_t *vertices,
ClutterActor *actor);
void clutter_stage_push_pick_clip (ClutterStage *stage,
const graphene_point_t *vertices);
void clutter_stage_pop_pick_clip (ClutterStage *stage);
ClutterActor *_clutter_stage_do_pick (ClutterStage *stage,
float x,
float y,
gint x,
gint y,
ClutterPickMode mode);
ClutterPaintVolume *_clutter_stage_paint_volume_stack_allocate (ClutterStage *stage);
@ -106,6 +92,13 @@ void _clutter_stage_queue_redraw_entry_invalidate (Clut
CoglFramebuffer *_clutter_stage_get_active_framebuffer (ClutterStage *stage);
gint32 _clutter_stage_acquire_pick_id (ClutterStage *stage,
ClutterActor *actor);
void _clutter_stage_release_pick_id (ClutterStage *stage,
gint32 pick_id);
ClutterActor * _clutter_stage_get_actor_by_pick_id (ClutterStage *stage,
gint32 pick_id);
void _clutter_stage_add_pointer_drag_actor (ClutterStage *stage,
ClutterInputDevice *device,
ClutterActor *actor);
@ -122,20 +115,18 @@ ClutterActor * _clutter_stage_get_touch_drag_actor (ClutterStage *st
void _clutter_stage_remove_touch_drag_actor (ClutterStage *stage,
ClutterEventSequence *sequence);
CLUTTER_EXPORT
ClutterStageState _clutter_stage_get_state (ClutterStage *stage);
CLUTTER_EXPORT
gboolean _clutter_stage_is_activated (ClutterStage *stage);
CLUTTER_EXPORT
gboolean _clutter_stage_is_fullscreen (ClutterStage *stage);
gboolean _clutter_stage_update_state (ClutterStage *stage,
ClutterStageState unset_state,
ClutterStageState set_state);
void _clutter_stage_set_scale_factor (ClutterStage *stage,
int factor);
gboolean _clutter_stage_get_max_view_scale_factor_for_rect (ClutterStage *stage,
graphene_rect_t *rect,
float *view_scale);
gboolean _clutter_stage_get_max_view_scale_factor_for_rect (ClutterStage *stage,
ClutterRect *rect,
float *view_scale);
void _clutter_stage_presented (ClutterStage *stage,
CoglFrameEvent frame_event,

View File

@ -1,37 +0,0 @@
/*
* Copyright (C) 2019 Red Hat Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __CLUTTER_STAGE_VIEW_PRIVATE_H__
#define __CLUTTER_STAGE_VIEW_PRIVATE_H__
#include "clutter/clutter-stage-view.h"
void clutter_stage_view_blit_offscreen (ClutterStageView *view,
const cairo_rectangle_int_t *clip);
gboolean clutter_stage_view_is_dirty_viewport (ClutterStageView *view);
void clutter_stage_view_set_dirty_viewport (ClutterStageView *view,
gboolean dirty);
gboolean clutter_stage_view_is_dirty_projection (ClutterStageView *view);
void clutter_stage_view_set_dirty_projection (ClutterStageView *view,
gboolean dirty);
#endif /* __CLUTTER_STAGE_VIEW_PRIVATE_H__ */

View File

@ -18,7 +18,6 @@
#include "clutter-build-config.h"
#include "clutter/clutter-stage-view.h"
#include "clutter/clutter-stage-view-private.h"
#include <cairo-gobject.h>
#include <math.h>
@ -62,14 +61,6 @@ clutter_stage_view_get_layout (ClutterStageView *view,
*rect = priv->layout;
}
/**
* clutter_stage_view_get_framebuffer:
* @view: a #ClutterStageView
*
* Retrieves the framebuffer of @view to draw to.
*
* Returns: (transfer none): a #CoglFramebuffer
*/
CoglFramebuffer *
clutter_stage_view_get_framebuffer (ClutterStageView *view)
{
@ -82,14 +73,6 @@ clutter_stage_view_get_framebuffer (ClutterStageView *view)
return priv->framebuffer;
}
/**
* clutter_stage_view_get_onscreen:
* @view: a #ClutterStageView
*
* Retrieves the onscreen framebuffer of @view if available.
*
* Returns: (transfer none): a #CoglFramebuffer
*/
CoglFramebuffer *
clutter_stage_view_get_onscreen (ClutterStageView *view)
{
@ -143,21 +126,6 @@ clutter_stage_view_blit_offscreen (ClutterStageView *view,
clutter_stage_view_get_instance_private (view);
CoglMatrix matrix;
clutter_stage_view_get_offscreen_transformation_matrix (view, &matrix);
if (cogl_matrix_is_identity (&matrix))
{
int fb_width = cogl_framebuffer_get_width (priv->framebuffer);
int fb_height = cogl_framebuffer_get_height (priv->framebuffer);
if (cogl_blit_framebuffer (priv->offscreen,
priv->framebuffer,
0, 0,
0, 0,
fb_width, fb_height,
NULL))
return;
}
clutter_stage_view_ensure_offscreen_blit_pipeline (view);
cogl_framebuffer_push_matrix (priv->framebuffer);

View File

@ -18,10 +18,6 @@
#ifndef __CLUTTER_STAGE_VIEW_H__
#define __CLUTTER_STAGE_VIEW_H__
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#include <cairo.h>
#include <glib-object.h>
#include <cogl/cogl.h>
@ -61,9 +57,22 @@ void clutter_stage_view_transform_to_onscreen (ClutterStageView *vie
gfloat *x,
gfloat *y);
void clutter_stage_view_blit_offscreen (ClutterStageView *view,
const cairo_rectangle_int_t *clip);
CLUTTER_EXPORT
float clutter_stage_view_get_scale (ClutterStageView *view);
gboolean clutter_stage_view_is_dirty_viewport (ClutterStageView *view);
void clutter_stage_view_set_dirty_viewport (ClutterStageView *view,
gboolean dirty);
gboolean clutter_stage_view_is_dirty_projection (ClutterStageView *view);
void clutter_stage_view_set_dirty_projection (ClutterStageView *view,
gboolean dirty);
CLUTTER_EXPORT
void clutter_stage_view_get_offscreen_transformation_matrix (ClutterStageView *view,
CoglMatrix *matrix);

View File

@ -62,6 +62,16 @@ _clutter_stage_window_set_title (ClutterStageWindow *window,
iface->set_title (window, title);
}
void
_clutter_stage_window_set_fullscreen (ClutterStageWindow *window,
gboolean is_fullscreen)
{
ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
if (iface->set_fullscreen)
iface->set_fullscreen (window, is_fullscreen);
}
void
_clutter_stage_window_set_cursor_visible (ClutterStageWindow *window,
gboolean is_visible)
@ -72,6 +82,14 @@ _clutter_stage_window_set_cursor_visible (ClutterStageWindow *window,
iface->set_cursor_visible (window, is_visible);
}
void
_clutter_stage_window_set_user_resizable (ClutterStageWindow *window,
gboolean is_resizable)
{
CLUTTER_STAGE_WINDOW_GET_IFACE (window)->set_user_resizable (window,
is_resizable);
}
gboolean
_clutter_stage_window_realize (ClutterStageWindow *window)
{
@ -275,6 +293,24 @@ _clutter_stage_window_redraw (ClutterStageWindow *window)
iface->redraw (window);
}
void
_clutter_stage_window_get_dirty_pixel (ClutterStageWindow *window,
ClutterStageView *view,
int *x, int *y)
{
ClutterStageWindowInterface *iface;
*x = 0;
*y = 0;
g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
if (iface->get_dirty_pixel)
iface->get_dirty_pixel (window, view, x, y);
}
gboolean
_clutter_stage_window_can_clip_redraws (ClutterStageWindow *window)
{

View File

@ -30,8 +30,12 @@ struct _ClutterStageWindowInterface
void (* set_title) (ClutterStageWindow *stage_window,
const gchar *title);
void (* set_fullscreen) (ClutterStageWindow *stage_window,
gboolean is_fullscreen);
void (* set_cursor_visible) (ClutterStageWindow *stage_window,
gboolean cursor_visible);
void (* set_user_resizable) (ClutterStageWindow *stage_window,
gboolean is_resizable);
gboolean (* realize) (ClutterStageWindow *stage_window);
void (* unrealize) (ClutterStageWindow *stage_window);
@ -64,6 +68,10 @@ struct _ClutterStageWindowInterface
void (* redraw) (ClutterStageWindow *stage_window);
void (* get_dirty_pixel) (ClutterStageWindow *stage_window,
ClutterStageView *view,
int *x, int *y);
gboolean (* can_clip_redraws) (ClutterStageWindow *stage_window);
GList *(* get_views) (ClutterStageWindow *stage_window);
@ -75,8 +83,12 @@ ClutterActor * _clutter_stage_window_get_wrapper (ClutterStageWindow *
void _clutter_stage_window_set_title (ClutterStageWindow *window,
const gchar *title);
void _clutter_stage_window_set_fullscreen (ClutterStageWindow *window,
gboolean is_fullscreen);
void _clutter_stage_window_set_cursor_visible (ClutterStageWindow *window,
gboolean is_visible);
void _clutter_stage_window_set_user_resizable (ClutterStageWindow *window,
gboolean is_resizable);
gboolean _clutter_stage_window_realize (ClutterStageWindow *window);
void _clutter_stage_window_unrealize (ClutterStageWindow *window);
@ -88,7 +100,6 @@ void _clutter_stage_window_hide (ClutterStageWin
void _clutter_stage_window_resize (ClutterStageWindow *window,
gint width,
gint height);
CLUTTER_EXPORT
void _clutter_stage_window_get_geometry (ClutterStageWindow *window,
cairo_rectangle_int_t *geometry);
void _clutter_stage_window_schedule_update (ClutterStageWindow *window,
@ -108,6 +119,10 @@ void _clutter_stage_window_set_accept_focus (ClutterStageWin
void _clutter_stage_window_redraw (ClutterStageWindow *window);
void _clutter_stage_window_get_dirty_pixel (ClutterStageWindow *window,
ClutterStageView *view,
int *x, int *y);
gboolean _clutter_stage_window_can_clip_redraws (ClutterStageWindow *window);
GList * _clutter_stage_window_get_views (ClutterStageWindow *window);

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,6 @@
#include <clutter/clutter-types.h>
#include <clutter/clutter-group.h>
#include <clutter/clutter-stage-view.h>
G_BEGIN_DECLS
@ -62,6 +61,8 @@ struct _ClutterStage
};
/**
* ClutterStageClass:
* @fullscreen: handler for the #ClutterStage::fullscreen signal
* @unfullscreen: handler for the #ClutterStage::unfullscreen signal
* @activate: handler for the #ClutterStage::activate signal
* @deactivate: handler for the #ClutterStage::deactivate signal
* @delete_event: handler for the #ClutterStage::delete-event signal
@ -78,18 +79,17 @@ struct _ClutterStageClass
/*< public >*/
/* signals */
void (* fullscreen) (ClutterStage *stage);
void (* unfullscreen) (ClutterStage *stage);
void (* activate) (ClutterStage *stage);
void (* deactivate) (ClutterStage *stage);
gboolean (* delete_event) (ClutterStage *stage,
ClutterEvent *event);
void (* paint_view) (ClutterStage *stage,
ClutterStageView *view);
/*< private >*/
/* padding for future expansion */
gpointer _padding_dummy[30];
gpointer _padding_dummy[31];
};
/**
@ -115,6 +115,26 @@ struct _ClutterPerspective
gfloat z_far;
};
/**
* ClutterFog:
* @z_near: starting distance from the viewer to the near clipping
* plane (always positive)
* @z_far: final distance from the viewer to the far clipping
* plane (always positive)
*
* Fog settings used to create the depth cueing effect.
*
* Since: 0.6
*
* Deprecated: 1.10: The fog-related API in #ClutterStage has been
* deprecated as well.
*/
struct _ClutterFog
{
gfloat z_near;
gfloat z_far;
};
/**
* ClutterFrameInfo: (skip)
*/
@ -133,6 +153,8 @@ typedef struct _ClutterCapture
CLUTTER_EXPORT
GType clutter_perspective_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED
GType clutter_fog_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
GType clutter_stage_get_type (void) G_GNUC_CONST;
@ -146,6 +168,11 @@ CLUTTER_EXPORT
void clutter_stage_get_perspective (ClutterStage *stage,
ClutterPerspective *perspective);
CLUTTER_EXPORT
void clutter_stage_set_fullscreen (ClutterStage *stage,
gboolean fullscreen);
CLUTTER_EXPORT
gboolean clutter_stage_get_fullscreen (ClutterStage *stage);
CLUTTER_EXPORT
void clutter_stage_show_cursor (ClutterStage *stage);
CLUTTER_EXPORT
void clutter_stage_hide_cursor (ClutterStage *stage);
@ -154,6 +181,11 @@ void clutter_stage_set_title (ClutterStage
const gchar *title);
CLUTTER_EXPORT
const gchar * clutter_stage_get_title (ClutterStage *stage);
CLUTTER_EXPORT
void clutter_stage_set_user_resizable (ClutterStage *stage,
gboolean resizable);
CLUTTER_EXPORT
gboolean clutter_stage_get_user_resizable (ClutterStage *stage);
CLUTTER_EXPORT
void clutter_stage_set_minimum_size (ClutterStage *stage,
@ -201,8 +233,8 @@ gboolean clutter_stage_event (ClutterStage
CLUTTER_EXPORT
ClutterActor * clutter_stage_get_actor_at_pos (ClutterStage *stage,
ClutterPickMode pick_mode,
float x,
float y);
gint x,
gint y);
CLUTTER_EXPORT
guchar * clutter_stage_read_pixels (ClutterStage *stage,
gint x,
@ -242,10 +274,6 @@ gboolean clutter_stage_capture (ClutterStage *stage,
cairo_rectangle_int_t *rect,
ClutterCapture **captures,
int *n_captures);
CLUTTER_EXPORT
ClutterStageView * clutter_stage_get_view_at (ClutterStage *stage,
float x,
float y);
G_END_DECLS

View File

@ -122,7 +122,8 @@ clutter_tap_action_class_init (ClutterTapActionClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterTapActionClass, tap),
NULL, NULL, NULL,
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);
}

View File

@ -1,8 +1,17 @@
#include "clutter-build-config.h"
#include "clutter-test-utils.h"
#include <stdlib.h>
#include <glib-object.h>
#include <clutter/clutter.h>
#include "clutter-actor.h"
#include "clutter-color.h"
#include "clutter-event.h"
#include "clutter-keysyms.h"
#include "clutter-main.h"
#include "clutter-private.h"
#include "clutter-stage.h"
typedef struct {
ClutterActor *stage;
@ -264,7 +273,7 @@ clutter_test_run (void)
typedef struct {
ClutterActor *stage;
graphene_point_t point;
ClutterPoint point;
gpointer result;
@ -339,10 +348,10 @@ on_key_press_event (ClutterActor *stage,
* Since: 1.18
*/
gboolean
clutter_test_check_actor_at_point (ClutterActor *stage,
const graphene_point_t *point,
ClutterActor *actor,
ClutterActor **result)
clutter_test_check_actor_at_point (ClutterActor *stage,
const ClutterPoint *point,
ClutterActor *actor,
ClutterActor **result)
{
ValidateData *data;
guint press_id = 0;
@ -401,10 +410,10 @@ clutter_test_check_actor_at_point (ClutterActor *stage,
* Since: 1.18
*/
gboolean
clutter_test_check_color_at_point (ClutterActor *stage,
const graphene_point_t *point,
const ClutterColor *color,
ClutterColor *result)
clutter_test_check_color_at_point (ClutterActor *stage,
const ClutterPoint *point,
const ClutterColor *color,
ClutterColor *result)
{
ValidateData *data;
gboolean retval;

View File

@ -19,23 +19,16 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#ifndef __CLUTTER_TEST_UTILS_H__
#define __CLUTTER_TEST_UTILS_H__
#define __CLUTTER_H_INSIDE__
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#include "clutter/clutter-types.h"
#include "clutter/clutter-actor.h"
#include "clutter/clutter-color.h"
#include "clutter/clutter-private.h"
#include "core/main-private.h"
#include "meta/common.h"
#include "meta/main.h"
#include "backends/x11/nested/meta-backend-x11-nested.h"
#include "wayland/meta-wayland.h"
#include "wayland/meta-xwayland.h"
#include <clutter/clutter-types.h>
#include <clutter/clutter-actor.h>
#include <clutter/clutter-color.h>
G_BEGIN_DECLS
@ -86,8 +79,6 @@ G_BEGIN_DECLS
int \
main (int argc, char *argv[]) \
{ \
meta_test_init ();\
\
clutter_test_init (&argc, &argv); \
\
{ \
@ -121,7 +112,7 @@ ClutterActor * clutter_test_get_stage (void);
#define clutter_test_assert_actor_at_point(stage,point,actor) \
G_STMT_START { \
const graphene_point_t *__p = (point); \
const ClutterPoint *__p = (point); \
ClutterActor *__actor = (actor); \
ClutterActor *__stage = (stage); \
ClutterActor *__res; \
@ -141,7 +132,7 @@ G_STMT_START { \
#define clutter_test_assert_color_at_point(stage,point,color) \
G_STMT_START { \
const graphene_point_t *__p = (point); \
const ClutterPoint *__p = (point); \
const ClutterColor *__c = (color); \
ClutterActor *__stage = (stage); \
ClutterColor __res; \
@ -158,15 +149,15 @@ G_STMT_START { \
} G_STMT_END
CLUTTER_EXPORT
gboolean clutter_test_check_actor_at_point (ClutterActor *stage,
const graphene_point_t *point,
ClutterActor *actor,
ClutterActor **result);
gboolean clutter_test_check_actor_at_point (ClutterActor *stage,
const ClutterPoint *point,
ClutterActor *actor,
ClutterActor **result);
CLUTTER_EXPORT
gboolean clutter_test_check_color_at_point (ClutterActor *stage,
const graphene_point_t *point,
const ClutterColor *color,
ClutterColor *result);
gboolean clutter_test_check_color_at_point (ClutterActor *stage,
const ClutterPoint *point,
const ClutterColor *color,
ClutterColor *result);
G_END_DECLS

View File

@ -171,7 +171,7 @@ clutter_text_buffer_normal_insert_text (ClutterTextBuffer *buffer,
/* Actual text insertion */
at = g_utf8_offset_to_pointer (pv->normal_text, position) - pv->normal_text;
memmove (pv->normal_text + at + n_bytes, pv->normal_text + at, pv->normal_text_bytes - at);
g_memmove (pv->normal_text + at + n_bytes, pv->normal_text + at, pv->normal_text_bytes - at);
memcpy (pv->normal_text + at, chars, n_bytes);
/* Book keeping */
@ -201,7 +201,7 @@ clutter_text_buffer_normal_delete_text (ClutterTextBuffer *buffer,
start = g_utf8_offset_to_pointer (pv->normal_text, position) - pv->normal_text;
end = g_utf8_offset_to_pointer (pv->normal_text, position + n_chars) - pv->normal_text;
memmove (pv->normal_text + start, pv->normal_text + end, pv->normal_text_bytes + 1 - end);
g_memmove (pv->normal_text + start, pv->normal_text + end, pv->normal_text_bytes + 1 - end);
pv->normal_text_chars -= n_chars;
pv->normal_text_bytes -= (end - start);
@ -228,8 +228,8 @@ clutter_text_buffer_real_inserted_text (ClutterTextBuffer *buffer,
const gchar *chars,
guint n_chars)
{
g_object_notify_by_pspec (G_OBJECT (buffer), obj_props[PROP_TEXT]);
g_object_notify_by_pspec (G_OBJECT (buffer), obj_props[PROP_LENGTH]);
g_object_notify (G_OBJECT (buffer), "text");
g_object_notify (G_OBJECT (buffer), "length");
}
static void
@ -237,8 +237,8 @@ clutter_text_buffer_real_deleted_text (ClutterTextBuffer *buffer,
guint position,
guint n_chars)
{
g_object_notify_by_pspec (G_OBJECT (buffer), obj_props[PROP_TEXT]);
g_object_notify_by_pspec (G_OBJECT (buffer), obj_props[PROP_LENGTH]);
g_object_notify (G_OBJECT (buffer), "text");
g_object_notify (G_OBJECT (buffer), "length");
}
/* --------------------------------------------------------------------------------
@ -598,7 +598,7 @@ clutter_text_buffer_set_max_length (ClutterTextBuffer *buffer,
clutter_text_buffer_delete_text (buffer, max_length, -1);
buffer->priv->max_length = max_length;
g_object_notify_by_pspec (G_OBJECT (buffer), obj_props[PROP_MAX_LENGTH]);
g_object_notify (G_OBJECT (buffer), "max-length");
}
/**

View File

@ -157,7 +157,7 @@ struct _ClutterTextPrivate
gint text_logical_y;
/* Where to draw the cursor */
graphene_rect_t cursor_rect;
ClutterRect cursor_rect;
ClutterColor cursor_color;
guint cursor_size;
@ -1304,7 +1304,7 @@ static inline void
update_cursor_location (ClutterText *self)
{
ClutterTextPrivate *priv = self->priv;
graphene_rect_t rect;
ClutterRect rect;
float x, y;
if (!priv->editable)
@ -1312,7 +1312,7 @@ update_cursor_location (ClutterText *self)
rect = priv->cursor_rect;
clutter_actor_get_transformed_position (CLUTTER_ACTOR (self), &x, &y);
graphene_rect_offset (&rect, x, y);
clutter_rect_offset (&rect, x, y);
clutter_input_focus_set_cursor_location (priv->input_focus, &rect);
}
@ -1322,7 +1322,7 @@ clutter_text_ensure_cursor_position (ClutterText *self,
{
ClutterTextPrivate *priv = self->priv;
gfloat x, y, cursor_height;
graphene_rect_t cursor_rect = GRAPHENE_RECT_INIT_ZERO;
ClutterRect cursor_rect = CLUTTER_RECT_INIT_ZERO;
gint position;
position = priv->position;
@ -1345,17 +1345,25 @@ clutter_text_ensure_cursor_position (ClutterText *self,
&x, &y,
&cursor_height);
graphene_rect_init (&cursor_rect,
x,
y + CURSOR_Y_PADDING * scale,
priv->cursor_size * scale,
cursor_height - 2 * CURSOR_Y_PADDING * scale);
clutter_rect_init (&cursor_rect,
x,
y + CURSOR_Y_PADDING * scale,
priv->cursor_size * scale,
cursor_height - 2 * CURSOR_Y_PADDING * scale);
if (!graphene_rect_equal (&priv->cursor_rect, &cursor_rect))
if (!clutter_rect_equals (&priv->cursor_rect, &cursor_rect))
{
ClutterGeometry cursor_pos;
priv->cursor_rect = cursor_rect;
g_signal_emit (self, text_signals[CURSOR_EVENT], 0, &cursor_rect);
/* XXX:2.0 - remove */
cursor_pos.x = clutter_rect_get_x (&priv->cursor_rect);
cursor_pos.y = clutter_rect_get_y (&priv->cursor_rect);
cursor_pos.width = clutter_rect_get_width (&priv->cursor_rect);
cursor_pos.height = clutter_rect_get_height (&priv->cursor_rect);
g_signal_emit (self, text_signals[CURSOR_EVENT], 0, &cursor_pos);
g_signal_emit (self, text_signals[CURSOR_CHANGED], 0);
update_cursor_location (self);
@ -1967,7 +1975,6 @@ selection_paint (ClutterText *self,
else
{
/* Paint selection background first */
CoglPipeline *color_pipeline = cogl_pipeline_copy (default_color_pipeline);
PangoLayout *layout = clutter_text_get_layout (self);
CoglPath *selection_path = cogl_path_new ();
CoglColor cogl_color = { 0, };
@ -1980,19 +1987,11 @@ selection_paint (ClutterText *self,
else
color = &priv->text_color;
cogl_color_init_from_4ub (&cogl_color,
color->red,
color->green,
color->blue,
paint_opacity * color->alpha / 255);
cogl_color_premultiply (&cogl_color);
cogl_pipeline_set_color (color_pipeline, &cogl_color);
clutter_text_foreach_selection_rectangle_prescaled (self,
add_selection_rectangle_to_path,
selection_path);
cogl_framebuffer_fill_path (fb, color_pipeline, selection_path);
cogl_path_fill (selection_path);
/* Paint selected text */
cogl_framebuffer_push_path_clip (fb, selection_path);
@ -2252,10 +2251,7 @@ clutter_text_press (ClutterActor *actor,
priv->in_select_drag = TRUE;
if (type == CLUTTER_BUTTON_PRESS)
{
clutter_input_device_grab (clutter_event_get_device (event),
actor);
}
clutter_grab_pointer (actor);
else
{
clutter_input_device_sequence_grab (clutter_event_get_device (event),
@ -2313,7 +2309,7 @@ clutter_text_release (ClutterActor *actor,
{
if (!priv->in_select_touch)
{
clutter_input_device_ungrab (clutter_event_get_device (event));
clutter_ungrab_pointer ();
priv->in_select_drag = FALSE;
return CLUTTER_EVENT_STOP;
@ -2704,7 +2700,7 @@ clutter_text_paint (ClutterActor *self)
if (actor_width < text_width)
{
gint cursor_x = graphene_rect_get_x (&priv->cursor_rect);
gint cursor_x = clutter_rect_get_x (&priv->cursor_rect);
if (priv->position == -1)
{
@ -2791,7 +2787,7 @@ add_selection_to_paint_volume (ClutterText *text,
{
ClutterPaintVolume *total_volume = user_data;
ClutterPaintVolume rect_volume;
graphene_point3d_t vertex;
ClutterVertex vertex;
_clutter_paint_volume_init_static (&rect_volume, CLUTTER_ACTOR (text));
@ -2813,7 +2809,7 @@ clutter_text_get_paint_volume_for_cursor (ClutterText *text,
ClutterPaintVolume *volume)
{
ClutterTextPrivate *priv = text->priv;
graphene_point3d_t origin;
ClutterVertex origin;
clutter_text_ensure_cursor_position (text, resource_scale);
@ -2856,7 +2852,7 @@ clutter_text_get_paint_volume (ClutterActor *self,
{
PangoLayout *layout;
PangoRectangle ink_rect;
graphene_point3d_t origin;
ClutterVertex origin;
float resource_scale;
/* If the text is single line editable then it gets clipped to
@ -4335,7 +4331,8 @@ clutter_text_class_init (ClutterTextClass *klass)
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterTextClass, text_changed),
NULL, NULL, NULL,
NULL, NULL,
_clutter_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
@ -4391,10 +4388,10 @@ clutter_text_class_init (ClutterTextClass *klass)
/**
* ClutterText::cursor-event:
* @self: the #ClutterText that emitted the signal
* @rect: the coordinates of the cursor
* @geometry: the coordinates of the cursor
*
* The ::cursor-event signal is emitted whenever the cursor position
* changes inside a #ClutterText actor. Inside @rect it is stored
* changes inside a #ClutterText actor. Inside @geometry it is stored
* the current position and size of the cursor, relative to the actor
* itself.
*
@ -4407,9 +4404,10 @@ clutter_text_class_init (ClutterTextClass *klass)
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_DEPRECATED,
G_STRUCT_OFFSET (ClutterTextClass, cursor_event),
NULL, NULL, NULL,
NULL, NULL,
_clutter_marshal_VOID__BOXED,
G_TYPE_NONE, 1,
GRAPHENE_TYPE_RECT | G_SIGNAL_TYPE_STATIC_SCOPE);
CLUTTER_TYPE_GEOMETRY | G_SIGNAL_TYPE_STATIC_SCOPE);
/**
* ClutterText::cursor-changed:
@ -4425,7 +4423,8 @@ clutter_text_class_init (ClutterTextClass *klass)
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterTextClass, cursor_changed),
NULL, NULL, NULL,
NULL, NULL,
_clutter_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
@ -4443,7 +4442,8 @@ clutter_text_class_init (ClutterTextClass *klass)
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterTextClass, activate),
NULL, NULL, NULL,
NULL, NULL,
_clutter_marshal_VOID__VOID,
G_TYPE_NONE, 0);
binding_pool = clutter_binding_pool_get_for_class (klass);
@ -4812,7 +4812,7 @@ buffer_notify_max_length (ClutterTextBuffer *buffer,
GParamSpec *spec,
ClutterText *self)
{
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_MAX_LENGTH]);
g_object_notify (G_OBJECT (self), "max-length");
}
static void
@ -4911,9 +4911,9 @@ clutter_text_set_buffer (ClutterText *self,
obj = G_OBJECT (self);
g_object_freeze_notify (obj);
g_object_notify_by_pspec (obj, obj_props[PROP_BUFFER]);
g_object_notify_by_pspec (obj, obj_props[PROP_TEXT]);
g_object_notify_by_pspec (obj, obj_props[PROP_MAX_LENGTH]);
g_object_notify (obj, "buffer");
g_object_notify (obj, "text");
g_object_notify (obj, "max-length");
g_object_thaw_notify (obj);
}
@ -6772,8 +6772,8 @@ clutter_text_get_layout_offsets (ClutterText *self,
* Since: 1.16
*/
void
clutter_text_get_cursor_rect (ClutterText *self,
graphene_rect_t *rect)
clutter_text_get_cursor_rect (ClutterText *self,
ClutterRect *rect)
{
g_return_if_fail (CLUTTER_IS_TEXT (self));
g_return_if_fail (rect != NULL);

View File

@ -82,7 +82,7 @@ struct _ClutterTextClass
void (* text_changed) (ClutterText *self);
void (* activate) (ClutterText *self);
void (* cursor_event) (ClutterText *self,
const graphene_rect_t *rect);
const ClutterGeometry *geometry);
void (* cursor_changed) (ClutterText *self);
/*< private >*/
@ -230,7 +230,7 @@ CLUTTER_EXPORT
guint clutter_text_get_cursor_size (ClutterText *self);
CLUTTER_EXPORT
void clutter_text_get_cursor_rect (ClutterText *self,
graphene_rect_t *rect);
ClutterRect *rect);
CLUTTER_EXPORT
void clutter_text_set_selectable (ClutterText *self,
gboolean selectable);

View File

@ -145,8 +145,8 @@ struct _ClutterTimelinePrivate
ClutterStepMode step_mode;
/* cubic-bezier() parameters */
graphene_point_t cb_1;
graphene_point_t cb_2;
ClutterPoint cb_1;
ClutterPoint cb_2;
guint is_playing : 1;
@ -424,11 +424,6 @@ clutter_timeline_set_custom_property (ClutterScriptable *scriptable,
g_object_set_property (G_OBJECT (scriptable), name, value);
}
void
clutter_timeline_cancel_delay (ClutterTimeline *timeline)
{
g_clear_handle_id (&timeline->priv->delay_id, g_source_remove);
}
static void
clutter_scriptable_iface_init (ClutterScriptableIface *iface)
@ -555,7 +550,11 @@ clutter_timeline_dispose (GObject *object)
priv = self->priv;
clutter_timeline_cancel_delay (self);
if (priv->delay_id)
{
g_source_remove (priv->delay_id);
priv->delay_id = 0;
}
if (priv->progress_notify != NULL)
{
@ -710,7 +709,8 @@ clutter_timeline_class_init (ClutterTimelineClass *klass)
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterTimelineClass, new_frame),
NULL, NULL, NULL,
NULL, NULL,
_clutter_marshal_VOID__INT,
G_TYPE_NONE,
1, G_TYPE_INT);
/**
@ -733,7 +733,8 @@ clutter_timeline_class_init (ClutterTimelineClass *klass)
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterTimelineClass, completed),
NULL, NULL, NULL,
NULL, NULL,
_clutter_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
* ClutterTimeline::started:
@ -749,7 +750,8 @@ clutter_timeline_class_init (ClutterTimelineClass *klass)
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterTimelineClass, started),
NULL, NULL, NULL,
NULL, NULL,
_clutter_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
* ClutterTimeline::paused:
@ -762,7 +764,8 @@ clutter_timeline_class_init (ClutterTimelineClass *klass)
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterTimelineClass, paused),
NULL, NULL, NULL,
NULL, NULL,
_clutter_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
* ClutterTimeline::marker-reached:
@ -829,7 +832,8 @@ clutter_timeline_class_init (ClutterTimelineClass *klass)
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterTimelineClass, stopped),
NULL, NULL, NULL,
NULL, NULL,
_clutter_marshal_VOID__BOOLEAN,
G_TYPE_NONE, 1,
G_TYPE_BOOLEAN);
}
@ -846,8 +850,8 @@ clutter_timeline_init (ClutterTimeline *self)
self->priv->step_mode = CLUTTER_STEP_MODE_END;
/* default cubic-bezier() paramereters are (0, 0, 1, 1) */
graphene_point_init (&self->priv->cb_1, 0, 0);
graphene_point_init (&self->priv->cb_2, 1, 1);
clutter_point_init (&self->priv->cb_1, 0, 0);
clutter_point_init (&self->priv->cb_2, 1, 1);
}
struct CheckIfMarkerHitClosure
@ -1214,11 +1218,15 @@ clutter_timeline_pause (ClutterTimeline *timeline)
priv = timeline->priv;
clutter_timeline_cancel_delay (timeline);
if (!priv->is_playing)
if (priv->delay_id == 0 && !priv->is_playing)
return;
if (priv->delay_id)
{
g_source_remove (priv->delay_id);
priv->delay_id = 0;
}
priv->msecs_delta = 0;
set_is_playing (timeline, FALSE);
@ -2485,9 +2493,9 @@ clutter_timeline_get_step_progress (ClutterTimeline *timeline,
* Since: 1.12
*/
void
clutter_timeline_set_cubic_bezier_progress (ClutterTimeline *timeline,
const graphene_point_t *c_1,
const graphene_point_t *c_2)
clutter_timeline_set_cubic_bezier_progress (ClutterTimeline *timeline,
const ClutterPoint *c_1,
const ClutterPoint *c_2)
{
ClutterTimelinePrivate *priv;
@ -2522,9 +2530,9 @@ clutter_timeline_set_cubic_bezier_progress (ClutterTimeline *timeline,
* Since: 1.12
*/
gboolean
clutter_timeline_get_cubic_bezier_progress (ClutterTimeline *timeline,
graphene_point_t *c_1,
graphene_point_t *c_2)
clutter_timeline_get_cubic_bezier_progress (ClutterTimeline *timeline,
ClutterPoint *c_1,
ClutterPoint *c_2)
{
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), FALSE);

View File

@ -208,13 +208,13 @@ gboolean clutter_timeline_get_step_progress
gint *n_steps,
ClutterStepMode *step_mode);
CLUTTER_EXPORT
void clutter_timeline_set_cubic_bezier_progress (ClutterTimeline *timeline,
const graphene_point_t *c_1,
const graphene_point_t *c_2);
void clutter_timeline_set_cubic_bezier_progress (ClutterTimeline *timeline,
const ClutterPoint *c_1,
const ClutterPoint *c_2);
CLUTTER_EXPORT
gboolean clutter_timeline_get_cubic_bezier_progress (ClutterTimeline *timeline,
graphene_point_t *c_1,
graphene_point_t *c_2);
gboolean clutter_timeline_get_cubic_bezier_progress (ClutterTimeline *timeline,
ClutterPoint *c_1,
ClutterPoint *c_2);
CLUTTER_EXPORT
gint64 clutter_timeline_get_duration_hint (ClutterTimeline *timeline);

View File

@ -134,6 +134,7 @@ clutter_transition_stopped (ClutterTimeline *timeline,
clutter_transition_detach (CLUTTER_TRANSITION (timeline),
priv->animatable);
g_clear_object (&priv->animatable);
g_object_unref (timeline);
}
}

View File

@ -33,16 +33,20 @@
#include <clutter/clutter-macros.h>
#include <clutter/clutter-enums.h>
#include <graphene-gobject.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_ACTOR_BOX (clutter_actor_box_get_type ())
#define CLUTTER_TYPE_FOG (clutter_fog_get_type ())
#define CLUTTER_TYPE_GEOMETRY (clutter_geometry_get_type ())
#define CLUTTER_TYPE_KNOT (clutter_knot_get_type ())
#define CLUTTER_TYPE_MARGIN (clutter_margin_get_type ())
#define CLUTTER_TYPE_MATRIX (clutter_matrix_get_type ())
#define CLUTTER_TYPE_PAINT_VOLUME (clutter_paint_volume_get_type ())
#define CLUTTER_TYPE_PERSPECTIVE (clutter_perspective_get_type ())
#define CLUTTER_TYPE_VERTEX (clutter_vertex_get_type ())
#define CLUTTER_TYPE_POINT (clutter_point_get_type ())
#define CLUTTER_TYPE_SIZE (clutter_size_get_type ())
#define CLUTTER_TYPE_RECT (clutter_rect_get_type ())
typedef struct _ClutterActor ClutterActor;
@ -75,9 +79,14 @@ typedef struct _ClutterPathNode ClutterPathNode;
typedef struct _ClutterActorBox ClutterActorBox;
typedef struct _ClutterColor ClutterColor;
typedef struct _ClutterGeometry ClutterGeometry; /* XXX:2.0 - remove */
typedef struct _ClutterKnot ClutterKnot;
typedef struct _ClutterMargin ClutterMargin;
typedef struct _ClutterPerspective ClutterPerspective;
typedef struct _ClutterPoint ClutterPoint;
typedef struct _ClutterRect ClutterRect;
typedef struct _ClutterSize ClutterSize;
typedef struct _ClutterVertex ClutterVertex;
typedef struct _ClutterAlpha ClutterAlpha;
typedef struct _ClutterAnimation ClutterAnimation;
@ -104,6 +113,7 @@ typedef union _ClutterEvent ClutterEvent;
*/
typedef struct _ClutterEventSequence ClutterEventSequence;
typedef struct _ClutterFog ClutterFog; /* deprecated */
typedef struct _ClutterBehaviour ClutterBehaviour; /* deprecated */
typedef struct _ClutterShader ClutterShader; /* deprecated */
@ -127,6 +137,307 @@ typedef struct _ClutterShader ClutterShader; /* deprecated */
*/
typedef struct _ClutterPaintVolume ClutterPaintVolume;
/**
* ClutterPoint:
* @x: X coordinate, in pixels
* @y: Y coordinate, in pixels
*
* A point in 2D space.
*
* Since: 1.12
*/
struct _ClutterPoint
{
float x;
float y;
};
/**
* CLUTTER_POINT_INIT:
* @x: X coordinate
* @y: Y coordinate
*
* A simple macro for initializing a #ClutterPoint when declaring it, e.g.:
*
* |[
* ClutterPoint p = CLUTTER_POINT_INIT (100, 100);
* ]|
*
* Since: 1.12
*/
#define CLUTTER_POINT_INIT(x,y) { (x), (y) }
/**
* CLUTTER_POINT_INIT_ZERO:
*
* A simple macro for initializing a #ClutterPoint to (0, 0) when
* declaring it.
*
* Since: 1.12
*/
#define CLUTTER_POINT_INIT_ZERO CLUTTER_POINT_INIT (0.f, 0.f)
CLUTTER_EXPORT
GType clutter_point_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
const ClutterPoint * clutter_point_zero (void);
CLUTTER_EXPORT
ClutterPoint * clutter_point_alloc (void);
CLUTTER_EXPORT
ClutterPoint * clutter_point_init (ClutterPoint *point,
float x,
float y);
CLUTTER_EXPORT
ClutterPoint * clutter_point_copy (const ClutterPoint *point);
CLUTTER_EXPORT
void clutter_point_free (ClutterPoint *point);
CLUTTER_EXPORT
gboolean clutter_point_equals (const ClutterPoint *a,
const ClutterPoint *b);
CLUTTER_EXPORT
float clutter_point_distance (const ClutterPoint *a,
const ClutterPoint *b,
float *x_distance,
float *y_distance);
/**
* ClutterSize:
* @width: the width, in pixels
* @height: the height, in pixels
*
* A size, in 2D space.
*
* Since: 1.12
*/
struct _ClutterSize
{
float width;
float height;
};
/**
* CLUTTER_SIZE_INIT:
* @width: the width
* @height: the height
*
* A simple macro for initializing a #ClutterSize when declaring it, e.g.:
*
* |[
* ClutterSize s = CLUTTER_SIZE_INIT (200, 200);
* ]|
*
* Since: 1.12
*/
#define CLUTTER_SIZE_INIT(width,height) { (width), (height) }
/**
* CLUTTER_SIZE_INIT_ZERO:
*
* A simple macro for initializing a #ClutterSize to (0, 0) when
* declaring it.
*
* Since: 1.12
*/
#define CLUTTER_SIZE_INIT_ZERO CLUTTER_SIZE_INIT (0.f, 0.f)
CLUTTER_EXPORT
GType clutter_size_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
ClutterSize * clutter_size_alloc (void);
CLUTTER_EXPORT
ClutterSize * clutter_size_init (ClutterSize *size,
float width,
float height);
CLUTTER_EXPORT
ClutterSize * clutter_size_copy (const ClutterSize *size);
CLUTTER_EXPORT
void clutter_size_free (ClutterSize *size);
CLUTTER_EXPORT
gboolean clutter_size_equals (const ClutterSize *a,
const ClutterSize *b);
/**
* ClutterRect:
* @origin: the origin of the rectangle
* @size: the size of the rectangle
*
* The location and size of a rectangle.
*
* The width and height of a #ClutterRect can be negative; Clutter considers
* a rectangle with an origin of [ 0.0, 0.0 ] and a size of [ 10.0, 10.0 ] to
* be equivalent to a rectangle with origin of [ 10.0, 10.0 ] and size of
* [ -10.0, -10.0 ].
*
* Application code can normalize rectangles using clutter_rect_normalize():
* this function will ensure that the width and height of a #ClutterRect are
* positive values. All functions taking a #ClutterRect as an argument will
* implicitly normalize it before computing eventual results. For this reason
* it is safer to access the contents of a #ClutterRect by using the provided
* API at all times, instead of directly accessing the structure members.
*
* Since: 1.12
*/
struct _ClutterRect
{
ClutterPoint origin;
ClutterSize size;
};
/**
* CLUTTER_RECT_INIT:
* @x: the X coordinate
* @y: the Y coordinate
* @width: the width
* @height: the height
*
* A simple macro for initializing a #ClutterRect when declaring it, e.g.:
*
* |[
* ClutterRect r = CLUTTER_RECT_INIT (100, 100, 200, 200);
* ]|
*
* Since: 1.12
*/
#define CLUTTER_RECT_INIT(x,y,width,height) { { (x), (y) }, { (width), (height) } }
/**
* CLUTTER_RECT_INIT_ZERO:
*
* A simple macro for initializing a #ClutterRect to (0, 0, 0, 0) when
* declaring it.
*
* Since: 1.12
*/
#define CLUTTER_RECT_INIT_ZERO CLUTTER_RECT_INIT (0.f, 0.f, 0.f, 0.f)
CLUTTER_EXPORT
GType clutter_rect_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
const ClutterRect * clutter_rect_zero (void);
CLUTTER_EXPORT
ClutterRect * clutter_rect_alloc (void);
CLUTTER_EXPORT
ClutterRect * clutter_rect_init (ClutterRect *rect,
float x,
float y,
float width,
float height);
CLUTTER_EXPORT
ClutterRect * clutter_rect_copy (const ClutterRect *rect);
CLUTTER_EXPORT
void clutter_rect_free (ClutterRect *rect);
CLUTTER_EXPORT
gboolean clutter_rect_equals (ClutterRect *a,
ClutterRect *b);
CLUTTER_EXPORT
ClutterRect * clutter_rect_normalize (ClutterRect *rect);
CLUTTER_EXPORT
void clutter_rect_get_center (ClutterRect *rect,
ClutterPoint *center);
CLUTTER_EXPORT
gboolean clutter_rect_contains_point (ClutterRect *rect,
ClutterPoint *point);
CLUTTER_EXPORT
gboolean clutter_rect_contains_rect (ClutterRect *a,
ClutterRect *b);
CLUTTER_EXPORT
void clutter_rect_union (ClutterRect *a,
ClutterRect *b,
ClutterRect *res);
CLUTTER_EXPORT
gboolean clutter_rect_intersection (ClutterRect *a,
ClutterRect *b,
ClutterRect *res);
CLUTTER_EXPORT
void clutter_rect_offset (ClutterRect *rect,
float d_x,
float d_y);
CLUTTER_EXPORT
void clutter_rect_inset (ClutterRect *rect,
float d_x,
float d_y);
CLUTTER_EXPORT
void clutter_rect_scale (ClutterRect *rect,
float s_x,
float s_y);
CLUTTER_EXPORT
void clutter_rect_clamp_to_pixel (ClutterRect *rect);
CLUTTER_EXPORT
float clutter_rect_get_x (ClutterRect *rect);
CLUTTER_EXPORT
float clutter_rect_get_y (ClutterRect *rect);
CLUTTER_EXPORT
float clutter_rect_get_width (ClutterRect *rect);
CLUTTER_EXPORT
float clutter_rect_get_height (ClutterRect *rect);
/**
* ClutterVertex:
* @x: X coordinate of the vertex
* @y: Y coordinate of the vertex
* @z: Z coordinate of the vertex
*
* A point in 3D space, expressed in pixels
*
* Since: 0.4
*/
struct _ClutterVertex
{
gfloat x;
gfloat y;
gfloat z;
};
/**
* CLUTTER_VERTEX_INIT:
* @x: the X coordinate of the vertex
* @y: the Y coordinate of the vertex
* @z: the Z coordinate of the vertex
*
* A simple macro for initializing a #ClutterVertex when declaring it, e.g.:
*
* |[
* ClutterVertex v = CLUTTER_VERTEX_INIT (x, y, z);
* ]|
*
* Since: 1.10
*/
#define CLUTTER_VERTEX_INIT(x,y,z) { (x), (y), (z) }
/**
* CLUTTER_VERTEX_INIT_ZERO:
*
* A simple macro for initializing a #ClutterVertex to (0, 0, 0).
*
* Since: 1.12
*/
#define CLUTTER_VERTEX_INIT_ZERO CLUTTER_VERTEX_INIT (0.f, 0.f, 0.f)
CLUTTER_EXPORT
GType clutter_vertex_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
ClutterVertex *clutter_vertex_new (gfloat x,
gfloat y,
gfloat z);
CLUTTER_EXPORT
ClutterVertex *clutter_vertex_alloc (void);
CLUTTER_EXPORT
ClutterVertex *clutter_vertex_init (ClutterVertex *vertex,
gfloat x,
gfloat y,
gfloat z);
CLUTTER_EXPORT
ClutterVertex *clutter_vertex_copy (const ClutterVertex *vertex);
CLUTTER_EXPORT
void clutter_vertex_free (ClutterVertex *vertex);
CLUTTER_EXPORT
gboolean clutter_vertex_equal (const ClutterVertex *vertex_a,
const ClutterVertex *vertex_b);
/**
* ClutterActorBox:
* @x1: X coordinate of the top left corner
@ -230,8 +541,8 @@ gboolean clutter_actor_box_contains (const ClutterActorBox *box,
gfloat x,
gfloat y);
CLUTTER_EXPORT
void clutter_actor_box_from_vertices (ClutterActorBox *box,
const graphene_point3d_t verts[]);
void clutter_actor_box_from_vertices (ClutterActorBox *box,
const ClutterVertex verts[]);
CLUTTER_EXPORT
void clutter_actor_box_interpolate (const ClutterActorBox *initial,
const ClutterActorBox *final,
@ -257,6 +568,41 @@ CLUTTER_EXPORT
void clutter_actor_box_scale (ClutterActorBox *box,
gfloat scale);
/**
* ClutterGeometry:
* @x: X coordinate of the top left corner of an actor
* @y: Y coordinate of the top left corner of an actor
* @width: width of an actor
* @height: height of an actor
*
* The rectangle containing an actor's bounding box, measured in pixels.
*
* You should not use #ClutterGeometry, or operate on its fields
* directly; you should use #cairo_rectangle_int_t or #ClutterRect if you
* need a rectangle type, depending on the precision required.
*
* Deprecated: 1.16
*/
struct _ClutterGeometry
{
/*< public >*/
gint x;
gint y;
guint width;
guint height;
};
CLUTTER_EXPORT
GType clutter_geometry_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED
void clutter_geometry_union (const ClutterGeometry *geometry_a,
const ClutterGeometry *geometry_b,
ClutterGeometry *result);
CLUTTER_DEPRECATED
gboolean clutter_geometry_intersects (const ClutterGeometry *geometry0,
const ClutterGeometry *geometry1);
/**
* ClutterKnot:
* @x: X coordinate of the knot
@ -328,10 +674,10 @@ void clutter_paint_volume_free (ClutterPaintVolume
CLUTTER_EXPORT
void clutter_paint_volume_set_origin (ClutterPaintVolume *pv,
const graphene_point3d_t *origin);
const ClutterVertex *origin);
CLUTTER_EXPORT
void clutter_paint_volume_get_origin (const ClutterPaintVolume *pv,
graphene_point3d_t *vertex);
ClutterVertex *vertex);
CLUTTER_EXPORT
void clutter_paint_volume_set_width (ClutterPaintVolume *pv,
gfloat width);

View File

@ -51,8 +51,8 @@ void
_clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
const CoglMatrix *projection,
const float *viewport,
const graphene_point3d_t *vertices_in,
graphene_point3d_t *vertices_out,
const ClutterVertex *vertices_in,
ClutterVertex *vertices_out,
int n_vertices)
{
CoglMatrix modelview_projection;
@ -69,7 +69,7 @@ _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
modelview);
cogl_matrix_project_points (&modelview_projection,
3,
sizeof (graphene_point3d_t),
sizeof (ClutterVertex),
vertices_in,
sizeof (ClutterVertex4),
vertices_tmp,
@ -79,7 +79,7 @@ _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
{
cogl_matrix_transform_points (modelview,
3,
sizeof (graphene_point3d_t),
sizeof (ClutterVertex),
vertices_in,
sizeof (ClutterVertex4),
vertices_tmp,
@ -97,7 +97,7 @@ _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
for (i = 0; i < n_vertices; i++)
{
ClutterVertex4 vertex_tmp = vertices_tmp[i];
graphene_point3d_t *vertex_out = &vertices_out[i];
ClutterVertex *vertex_out = &vertices_out[i];
/* Finally translate from OpenGL coords to window coords */
vertex_out->x = MTX_GL_SCALE_X (vertex_tmp.x, vertex_tmp.w,
viewport[2], viewport[0]);
@ -108,9 +108,9 @@ _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
void
_clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src,
graphene_rect_t *dest)
ClutterRect *dest)
{
*dest = (graphene_rect_t) {
*dest = (ClutterRect) {
.origin = {
.x = src->x,
.y = src->y
@ -123,12 +123,12 @@ _clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src,
}
void
_clutter_util_rectangle_int_extents (const graphene_rect_t *src,
_clutter_util_rectangle_int_extents (const ClutterRect *src,
cairo_rectangle_int_t *dest)
{
graphene_rect_t tmp = *src;
ClutterRect tmp = *src;
graphene_rect_round_extents (&tmp, &tmp);
clutter_rect_clamp_to_pixel (&tmp);
*dest = (cairo_rectangle_int_t) {
.x = tmp.origin.x,
@ -299,12 +299,48 @@ _clutter_util_matrix_skew_yz (ClutterMatrix *matrix,
matrix->zw += matrix->yw * factor;
}
static float
_clutter_util_vertex_length (const ClutterVertex *vertex)
{
return sqrtf (vertex->x * vertex->x + vertex->y * vertex->y + vertex->z * vertex->z);
}
static void
_clutter_util_vertex_combine (const graphene_point3d_t *a,
const graphene_point3d_t *b,
double ascl,
double bscl,
graphene_point3d_t *res)
_clutter_util_vertex_normalize (ClutterVertex *vertex)
{
float factor = _clutter_util_vertex_length (vertex);
if (factor == 0.f)
return;
vertex->x /= factor;
vertex->y /= factor;
vertex->z /= factor;
}
static float
_clutter_util_vertex_dot (const ClutterVertex *v1,
const ClutterVertex *v2)
{
return v1->x * v2->x + v1->y * v2->y + v1->z * v2->z;
}
static void
_clutter_util_vertex_cross (const ClutterVertex *v1,
const ClutterVertex *v2,
ClutterVertex *res)
{
res->x = v1->y * v2->z - v2->y * v1->z;
res->y = v1->z * v2->x - v2->z * v1->x;
res->z = v1->x * v2->y - v2->x * v1->y;
}
static void
_clutter_util_vertex_combine (const ClutterVertex *a,
const ClutterVertex *b,
double ascl,
double bscl,
ClutterVertex *res)
{
res->x = (ascl * a->x) + (bscl * b->x);
res->y = (ascl * a->y) + (bscl * b->y);
@ -352,16 +388,16 @@ _clutter_util_vertex4_interpolate (const ClutterVertex4 *a,
*/
gboolean
_clutter_util_matrix_decompose (const ClutterMatrix *src,
graphene_point3d_t *scale_p,
ClutterVertex *scale_p,
float shear_p[3],
graphene_point3d_t *rotate_p,
graphene_point3d_t *translate_p,
ClutterVertex *rotate_p,
ClutterVertex *translate_p,
ClutterVertex4 *perspective_p)
{
CoglMatrix matrix = *src;
CoglMatrix perspective;
ClutterVertex4 vertex_tmp;
graphene_point3d_t row[3], pdum;
ClutterVertex row[3], pdum;
int i, j;
#define XY_SHEAR 0
@ -449,34 +485,34 @@ _clutter_util_matrix_decompose (const ClutterMatrix *src,
}
/* compute scale.x and normalize the first row */
scale_p->x = graphene_point3d_length (&row[0]);
graphene_point3d_normalize (&row[0], &row[0]);
scale_p->x = _clutter_util_vertex_length (&row[0]);
_clutter_util_vertex_normalize (&row[0]);
/* compute XY shear and make the second row orthogonal to the first */
shear_p[XY_SHEAR] = graphene_point3d_dot (&row[0], &row[1]);
shear_p[XY_SHEAR] = _clutter_util_vertex_dot (&row[0], &row[1]);
_clutter_util_vertex_combine (&row[1], &row[0],
1.0, -shear_p[XY_SHEAR],
&row[1]);
/* compute the Y scale and normalize the second row */
scale_p->y = graphene_point3d_length (&row[1]);
graphene_point3d_normalize (&row[1], &row[1]);
scale_p->y = _clutter_util_vertex_length (&row[1]);
_clutter_util_vertex_normalize (&row[1]);
shear_p[XY_SHEAR] /= scale_p->y;
/* compute XZ and YZ shears, orthogonalize the third row */
shear_p[XZ_SHEAR] = graphene_point3d_dot (&row[0], &row[2]);
shear_p[XZ_SHEAR] = _clutter_util_vertex_dot (&row[0], &row[2]);
_clutter_util_vertex_combine (&row[2], &row[0],
1.0, -shear_p[XZ_SHEAR],
&row[2]);
shear_p[YZ_SHEAR] = graphene_point3d_dot (&row[1], &row[2]);
shear_p[YZ_SHEAR] = _clutter_util_vertex_dot (&row[1], &row[2]);
_clutter_util_vertex_combine (&row[2], &row[1],
1.0, -shear_p[YZ_SHEAR],
&row[2]);
/* get the Z scale and normalize the third row*/
scale_p->z = graphene_point3d_length (&row[2]);
graphene_point3d_normalize (&row[2], &row[2]);
scale_p->z = _clutter_util_vertex_length (&row[2]);
_clutter_util_vertex_normalize (&row[2]);
shear_p[XZ_SHEAR] /= scale_p->z;
shear_p[YZ_SHEAR] /= scale_p->z;
@ -484,8 +520,8 @@ _clutter_util_matrix_decompose (const ClutterMatrix *src,
* check for a coordinate system flip; if the determinant
* is -1, then negate the matrix and scaling factors
*/
graphene_point3d_cross (&row[1], &row[2], &pdum);
if (graphene_point3d_dot (&row[0], &pdum) < 0.f)
_clutter_util_vertex_cross (&row[1], &row[2], &pdum);
if (_clutter_util_vertex_dot (&row[0], &pdum) < 0.f)
{
scale_p->x *= -1.f;

View File

@ -172,7 +172,6 @@ void clutter_virtual_input_device_notify_touch_up (ClutterVirtualInputDevice *vi
CLUTTER_EXPORT
ClutterDeviceManager * clutter_virtual_input_device_get_manager (ClutterVirtualInputDevice *virtual_device);
CLUTTER_EXPORT
int clutter_virtual_input_device_get_device_type (ClutterVirtualInputDevice *virtual_device);
#endif /* __CLUTTER_VIRTUAL_INPUT_DEVICE_H__ */

View File

@ -80,9 +80,9 @@ struct _ClutterZoomActionPrivate
ZoomPoint points[2];
graphene_point_t initial_focal_point;
graphene_point_t focal_point;
graphene_point_t transformed_focal_point;
ClutterPoint initial_focal_point;
ClutterPoint focal_point;
ClutterPoint transformed_focal_point;
gfloat initial_x;
gfloat initial_y;
@ -238,13 +238,13 @@ clutter_zoom_action_gesture_cancel (ClutterGestureAction *action,
static gboolean
clutter_zoom_action_real_zoom (ClutterZoomAction *action,
ClutterActor *actor,
graphene_point_t *focal_point,
ClutterPoint *focal_point,
gdouble factor)
{
ClutterZoomActionPrivate *priv = action->priv;
gfloat x, y, z;
gdouble scale_x, scale_y;
graphene_point3d_t out, in;
ClutterVertex out, in;
in.x = priv->transformed_focal_point.x;
in.y = priv->transformed_focal_point.y;
@ -400,7 +400,7 @@ clutter_zoom_action_class_init (ClutterZoomActionClass *klass)
_clutter_marshal_BOOLEAN__OBJECT_BOXED_DOUBLE,
G_TYPE_BOOLEAN, 3,
CLUTTER_TYPE_ACTOR,
GRAPHENE_TYPE_POINT,
CLUTTER_TYPE_POINT,
G_TYPE_DOUBLE);
}
@ -478,7 +478,7 @@ clutter_zoom_action_get_zoom_axis (ClutterZoomAction *action)
/**
* clutter_zoom_action_get_focal_point:
* @action: a #ClutterZoomAction
* @point: (out): a #graphene_point_t
* @point: (out): a #ClutterPoint
*
* Retrieves the focal point of the current zoom
*
@ -486,7 +486,7 @@ clutter_zoom_action_get_zoom_axis (ClutterZoomAction *action)
*/
void
clutter_zoom_action_get_focal_point (ClutterZoomAction *action,
graphene_point_t *point)
ClutterPoint *point)
{
g_return_if_fail (CLUTTER_IS_ZOOM_ACTION (action));
g_return_if_fail (point != NULL);
@ -497,7 +497,7 @@ clutter_zoom_action_get_focal_point (ClutterZoomAction *action,
/**
* clutter_zoom_action_get_transformed_focal_point:
* @action: a #ClutterZoomAction
* @point: (out): a #graphene_point_t
* @point: (out): a #ClutterPoint
*
* Retrieves the focal point relative to the actor's coordinates of
* the current zoom
@ -506,7 +506,7 @@ clutter_zoom_action_get_focal_point (ClutterZoomAction *action,
*/
void
clutter_zoom_action_get_transformed_focal_point (ClutterZoomAction *action,
graphene_point_t *point)
ClutterPoint *point)
{
g_return_if_fail (CLUTTER_IS_ZOOM_ACTION (action));
g_return_if_fail (point != NULL);

View File

@ -79,7 +79,7 @@ struct _ClutterZoomActionClass
/*< public >*/
gboolean (* zoom) (ClutterZoomAction *action,
ClutterActor *actor,
graphene_point_t *focal_point,
ClutterPoint *focal_point,
gdouble factor);
/*< private >*/
@ -104,10 +104,10 @@ ClutterZoomAxis clutter_zoom_action_get_zoom_axis (ClutterZoomActi
CLUTTER_EXPORT
void clutter_zoom_action_get_focal_point (ClutterZoomAction *action,
graphene_point_t *point);
ClutterPoint *point);
CLUTTER_EXPORT
void clutter_zoom_action_get_transformed_focal_point (ClutterZoomAction *action,
graphene_point_t *point);
ClutterPoint *point);
G_END_DECLS

View File

@ -101,8 +101,8 @@
#include "clutter-snap-constraint.h"
#include "clutter-stage.h"
#include "clutter-stage-manager.h"
#include "clutter-stage-view.h"
#include "clutter-tap-action.h"
#include "clutter-test-utils.h"
#include "clutter-texture.h"
#include "clutter-text.h"
#include "clutter-timeline.h"

View File

@ -45,9 +45,6 @@
#include "clutter-main.h"
#include "clutter-private.h"
#include "clutter-stage-private.h"
#include "clutter-stage-view-private.h"
#include "cogl/cogl-trace.h"
typedef struct _ClutterStageViewCoglPrivate
{
@ -186,56 +183,38 @@ clutter_stage_cogl_schedule_update (ClutterStageWindow *stage_window,
return;
}
refresh_rate = stage_cogl->refresh_rate;
if (refresh_rate <= 0.0)
refresh_rate = clutter_get_default_frame_rate ();
refresh_interval = (gint64) (0.5 + G_USEC_PER_SEC / refresh_rate);
if (refresh_interval == 0)
/* We only extrapolate presentation times for 150ms - this is somewhat
* arbitrary. The reasons it might not be accurate for larger times are
* that the refresh interval might be wrong or the vertical refresh
* might be downclocked if nothing is going on onscreen.
*/
if (stage_cogl->last_presentation_time == 0||
stage_cogl->last_presentation_time < now - 150000)
{
stage_cogl->update_time = now;
return;
}
refresh_rate = stage_cogl->refresh_rate;
if (refresh_rate == 0.0)
refresh_rate = 60.0;
refresh_interval = (gint64) (0.5 + 1000000 / refresh_rate);
if (refresh_interval == 0)
refresh_interval = 16667; /* 1/60th second */
min_render_time_allowed = refresh_interval / 2;
max_render_time_allowed = refresh_interval - 1000 * sync_delay;
/* Be robust in the case of incredibly bogus refresh rate */
if (max_render_time_allowed <= 0)
{
g_warning ("Unsupported monitor refresh rate detected. "
"(Refresh rate: %.3f, refresh interval: %" G_GINT64_FORMAT ")",
refresh_rate,
refresh_interval);
stage_cogl->update_time = now;
return;
}
if (min_render_time_allowed > max_render_time_allowed)
min_render_time_allowed = max_render_time_allowed;
next_presentation_time = stage_cogl->last_presentation_time + refresh_interval;
/* Get next_presentation_time closer to its final value, to reduce
* the number of while iterations below.
*/
if (next_presentation_time < now)
{
int64_t last_virtual_presentation_time = now - now % refresh_interval;
int64_t hardware_clock_phase =
stage_cogl->last_presentation_time % refresh_interval;
next_presentation_time =
last_virtual_presentation_time + hardware_clock_phase;
}
while (next_presentation_time < now + min_render_time_allowed)
next_presentation_time += refresh_interval;
stage_cogl->update_time = next_presentation_time - max_render_time_allowed;
if (stage_cogl->update_time == stage_cogl->last_update_time)
stage_cogl->update_time = stage_cogl->last_update_time + refresh_interval;
}
static gint64
@ -254,7 +233,6 @@ clutter_stage_cogl_clear_update_time (ClutterStageWindow *stage_window)
{
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
stage_cogl->last_update_time = stage_cogl->update_time;
stage_cogl->update_time = -1;
}
@ -625,14 +603,14 @@ is_buffer_age_enabled (void)
}
static void
scale_and_clamp_rect (const graphene_rect_t *rect,
scale_and_clamp_rect (const ClutterRect *rect,
float scale,
cairo_rectangle_int_t *dest)
{
graphene_rect_t tmp = *rect;
ClutterRect tmp = *rect;
graphene_rect_scale (&tmp, scale, scale, &tmp);
clutter_rect_scale (&tmp, scale, scale);
_clutter_util_rectangle_int_extents (&tmp, dest);
}
@ -699,12 +677,12 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
* frames when starting up... */
cogl_onscreen_get_frame_counter (COGL_ONSCREEN (fb)) > 3)
{
graphene_rect_t rect;
ClutterRect rect;
may_use_clipped_redraw = TRUE;
_clutter_util_rect_from_rectangle (&redraw_clip, &rect);
graphene_rect_offset (&rect, -view_rect.x, -view_rect.y);
clutter_rect_offset (&rect, -view_rect.x, -view_rect.y);
scale_and_clamp_rect (&rect, fb_scale, &fb_clip_region);
if (fb_scale != floorf (fb_scale))
@ -742,7 +720,7 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
if (valid_buffer_age (view_cogl, age))
{
graphene_rect_t rect;
ClutterRect rect;
cairo_rectangle_int_t damage_region;
*current_fb_damage = fb_clip_region;
@ -802,7 +780,7 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
}
else if (use_clipped_redraw)
{
graphene_rect_t rect;
ClutterRect rect;
cairo_rectangle_int_t scissor_rect;
cairo_rectangle_int_t paint_rect;
@ -848,7 +826,7 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
may_use_clipped_redraw &&
!clip_region_empty)
{
graphene_rect_t rect;
ClutterRect rect;
cairo_rectangle_int_t scissor_rect;
cairo_rectangle_int_t paint_rect;
@ -927,16 +905,26 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
*/
if (use_clipped_redraw)
{
if (clip_region_empty)
if (use_clipped_redraw && clip_region_empty)
{
do_swap_buffer = FALSE;
}
else
else if (use_clipped_redraw)
{
swap_region = fb_clip_region;
g_assert (swap_region.width > 0);
do_swap_buffer = TRUE;
}
else
{
swap_region = (cairo_rectangle_int_t) {
.x = 0,
.y = 0,
.width = view_rect.width * fb_scale,
.height = view_rect.height * fb_scale,
};
do_swap_buffer = TRUE;
}
}
else
{
@ -946,9 +934,6 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
if (do_swap_buffer)
{
COGL_TRACE_BEGIN_SCOPED (ClutterStageCoglRedrawViewSwapFramebuffer,
"Paint (swap framebuffer)");
if (clutter_stage_view_get_onscreen (view) !=
clutter_stage_view_get_framebuffer (view))
{
@ -973,8 +958,6 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
gboolean swap_event = FALSE;
GList *l;
COGL_TRACE_BEGIN (ClutterStageCoglRedraw, "Paint (Cogl Redraw)");
for (l = _clutter_stage_window_get_views (stage_window); l; l = l->next)
{
ClutterStageView *view = l->data;
@ -983,8 +966,6 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
clutter_stage_cogl_redraw_view (stage_window, view) || swap_event;
}
_clutter_stage_emit_after_paint (stage_cogl->wrapper);
_clutter_stage_window_finish_frame (stage_window);
if (swap_event)
@ -1000,8 +981,55 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
stage_cogl->initialized_redraw_clip = FALSE;
stage_cogl->frame_count++;
}
COGL_TRACE_END (ClutterStageCoglRedraw);
static void
clutter_stage_cogl_get_dirty_pixel (ClutterStageWindow *stage_window,
ClutterStageView *view,
int *x,
int *y)
{
CoglFramebuffer *framebuffer = clutter_stage_view_get_framebuffer (view);
gboolean has_buffer_age =
cogl_is_onscreen (framebuffer) &&
is_buffer_age_enabled ();
float fb_scale;
gboolean scale_is_fractional;
fb_scale = clutter_stage_view_get_scale (view);
if (fb_scale != floorf (fb_scale))
scale_is_fractional = TRUE;
else
scale_is_fractional = FALSE;
/*
* Buffer damage is tracked in the framebuffer coordinate space
* using the damage history. When fractional scaling is used, a
* coordinate on the stage might not correspond to the exact position of any
* physical pixel, which causes issues when painting using the pick mode.
*
* For now, always use the (0, 0) pixel for picking when using fractional
* framebuffer scaling.
*/
if (!has_buffer_age || scale_is_fractional)
{
*x = 0;
*y = 0;
}
else
{
ClutterStageViewCogl *view_cogl = CLUTTER_STAGE_VIEW_COGL (view);
ClutterStageViewCoglPrivate *view_priv =
clutter_stage_view_cogl_get_instance_private (view_cogl);
cairo_rectangle_int_t view_layout;
cairo_rectangle_int_t *fb_damage;
clutter_stage_view_get_layout (view, &view_layout);
fb_damage = &view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index - 1)];
*x = fb_damage->x / fb_scale;
*y = fb_damage->y / fb_scale;
}
}
static void
@ -1021,6 +1049,7 @@ clutter_stage_window_iface_init (ClutterStageWindowInterface *iface)
iface->ignoring_redraw_clips = clutter_stage_cogl_ignoring_redraw_clips;
iface->get_redraw_clip_bounds = clutter_stage_cogl_get_redraw_clip_bounds;
iface->redraw = clutter_stage_cogl_redraw;
iface->get_dirty_pixel = clutter_stage_cogl_get_dirty_pixel;
}
static void

View File

@ -53,7 +53,6 @@ struct _ClutterStageCogl
gint64 last_presentation_time;
gint64 update_time;
int64_t last_update_time;
/* We only enable clipped redraws after 2 frames, since we've seen
* a lot of drivers can struggle to get going and may output some

View File

@ -0,0 +1,44 @@
#include "clutter-build-config.h"
#include <glib-object.h>
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "deprecated/clutter-actor.h"
#include "clutter-actor-private.h"
#include "clutter-private.h"
/**
* clutter_actor_get_allocation_geometry:
* @self: A #ClutterActor
* @geom: (out): allocation geometry in pixels
*
* Gets the layout box an actor has been assigned. The allocation can
* only be assumed valid inside a paint() method; anywhere else, it
* may be out-of-date.
*
* An allocation does not incorporate the actor's scale or anchor point;
* those transformations do not affect layout, only rendering.
*
* The returned rectangle is in pixels.
*
* Since: 0.8
*
* Deprecated: 1.12: Use clutter_actor_get_allocation_box() instead.
*/
void
clutter_actor_get_allocation_geometry (ClutterActor *self,
ClutterGeometry *geom)
{
ClutterActorBox box;
g_return_if_fail (CLUTTER_IS_ACTOR (self));
g_return_if_fail (geom != NULL);
clutter_actor_get_allocation_box (self, &box);
geom->x = CLUTTER_NEARBYINT (clutter_actor_box_get_x (&box));
geom->y = CLUTTER_NEARBYINT (clutter_actor_box_get_y (&box));
geom->width = CLUTTER_NEARBYINT (clutter_actor_box_get_width (&box));
geom->height = CLUTTER_NEARBYINT (clutter_actor_box_get_height (&box));
}

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