summaryrefslogtreecommitdiff
path: root/clutter/clutter
diff options
context:
space:
mode:
Diffstat (limited to 'clutter/clutter')
-rw-r--r--clutter/clutter/cally/ChangeLog.pre-cally-merge986
-rw-r--r--clutter/clutter/cally/cally-actor-private.h42
-rw-r--r--clutter/clutter/cally/cally-actor.c1195
-rw-r--r--clutter/clutter/cally/cally-actor.h160
-rw-r--r--clutter/clutter/cally/cally-clone.c132
-rw-r--r--clutter/clutter/cally/cally-clone.h84
-rw-r--r--clutter/clutter/cally/cally-factory.h117
-rw-r--r--clutter/clutter/cally/cally-main.h44
-rw-r--r--clutter/clutter/cally/cally-root.c292
-rw-r--r--clutter/clutter/cally/cally-root.h84
-rw-r--r--clutter/clutter/cally/cally-stage.c266
-rw-r--r--clutter/clutter/cally/cally-stage.h84
-rw-r--r--clutter/clutter/cally/cally-text.c2328
-rw-r--r--clutter/clutter/cally/cally-text.h84
-rw-r--r--clutter/clutter/cally/cally-util.c452
-rw-r--r--clutter/clutter/cally/cally-util.h84
-rw-r--r--clutter/clutter/cally/cally.c97
-rw-r--r--clutter/clutter/cally/cally.h37
-rw-r--r--clutter/clutter/clutter-action.c61
-rw-r--r--clutter/clutter/clutter-action.h91
-rw-r--r--clutter/clutter/clutter-actor-box-private.h12
-rw-r--r--clutter/clutter/clutter-actor-box.c647
-rw-r--r--clutter/clutter/clutter-actor-meta-private.h97
-rw-r--r--clutter/clutter/clutter-actor-meta.c723
-rw-r--r--clutter/clutter/clutter-actor-meta.h100
-rw-r--r--clutter/clutter/clutter-actor-private.h276
-rw-r--r--clutter/clutter/clutter-actor.c19559
-rw-r--r--clutter/clutter/clutter-actor.h939
-rw-r--r--clutter/clutter/clutter-align-constraint.c640
-rw-r--r--clutter/clutter/clutter-align-constraint.h83
-rw-r--r--clutter/clutter/clutter-animatable.c218
-rw-r--r--clutter/clutter/clutter-animatable.h102
-rw-r--r--clutter/clutter/clutter-autocleanups.h93
-rw-r--r--clutter/clutter/clutter-backend-private.h147
-rw-r--r--clutter/clutter/clutter-backend.c886
-rw-r--r--clutter/clutter/clutter-backend.h86
-rw-r--r--clutter/clutter/clutter-base-types.c103
-rw-r--r--clutter/clutter/clutter-bezier.c514
-rw-r--r--clutter/clutter/clutter-bezier.h65
-rw-r--r--clutter/clutter/clutter-bin-layout.c698
-rw-r--r--clutter/clutter/clutter-bin-layout.h86
-rw-r--r--clutter/clutter/clutter-bind-constraint.c648
-rw-r--r--clutter/clutter/clutter-bind-constraint.h77
-rw-r--r--clutter/clutter/clutter-binding-pool.c935
-rw-r--r--clutter/clutter/clutter-binding-pool.h135
-rw-r--r--clutter/clutter/clutter-blur-effect.c243
-rw-r--r--clutter/clutter/clutter-blur-effect.h59
-rw-r--r--clutter/clutter/clutter-blur-private.h40
-rw-r--r--clutter/clutter/clutter-blur.c431
-rw-r--r--clutter/clutter/clutter-box-layout.c1267
-rw-r--r--clutter/clutter/clutter-box-layout.h110
-rw-r--r--clutter/clutter/clutter-brightness-contrast-effect.c623
-rw-r--r--clutter/clutter/clutter-brightness-contrast-effect.h88
-rw-r--r--clutter/clutter/clutter-build-config.h.meson8
-rw-r--r--clutter/clutter/clutter-cairo.c90
-rw-r--r--clutter/clutter/clutter-cairo.h61
-rw-r--r--clutter/clutter/clutter-canvas.c644
-rw-r--r--clutter/clutter/clutter-canvas.h106
-rw-r--r--clutter/clutter/clutter-child-meta.c191
-rw-r--r--clutter/clutter/clutter-child-meta.h122
-rw-r--r--clutter/clutter/clutter-click-action.c850
-rw-r--r--clutter/clutter/clutter-click-action.h98
-rw-r--r--clutter/clutter/clutter-clone.c469
-rw-r--r--clutter/clutter/clutter-clone.h94
-rw-r--r--clutter/clutter/clutter-color-static.h79
-rw-r--r--clutter/clutter/clutter-color.c1193
-rw-r--r--clutter/clutter/clutter-color.h200
-rw-r--r--clutter/clutter/clutter-colorize-effect.c335
-rw-r--r--clutter/clutter/clutter-colorize-effect.h67
-rw-r--r--clutter/clutter/clutter-constraint-private.h35
-rw-r--r--clutter/clutter/clutter-constraint.c250
-rw-r--r--clutter/clutter/clutter-constraint.h137
-rw-r--r--clutter/clutter/clutter-container-private.h36
-rw-r--r--clutter/clutter/clutter-container.c1273
-rw-r--r--clutter/clutter/clutter-container.h181
-rw-r--r--clutter/clutter/clutter-content-private.h44
-rw-r--r--clutter/clutter/clutter-content.c349
-rw-r--r--clutter/clutter/clutter-content.h95
-rw-r--r--clutter/clutter/clutter-damage-history.c92
-rw-r--r--clutter/clutter/clutter-damage-history.h50
-rw-r--r--clutter/clutter/clutter-debug.h53
-rw-r--r--clutter/clutter/clutter-deform-effect.c826
-rw-r--r--clutter/clutter/clutter-deform-effect.h117
-rw-r--r--clutter/clutter/clutter-deprecated.h10
-rw-r--r--clutter/clutter/clutter-desaturate-effect.c343
-rw-r--r--clutter/clutter/clutter-desaturate-effect.h65
-rw-r--r--clutter/clutter/clutter-easing.c555
-rw-r--r--clutter/clutter/clutter-easing.h142
-rw-r--r--clutter/clutter/clutter-effect-private.h20
-rw-r--r--clutter/clutter/clutter-effect.c397
-rw-r--r--clutter/clutter/clutter-effect.h142
-rw-r--r--clutter/clutter/clutter-enum-types.c.in40
-rw-r--r--clutter/clutter/clutter-enum-types.h.in29
-rw-r--r--clutter/clutter/clutter-enums.h1643
-rw-r--r--clutter/clutter/clutter-event-private.h42
-rw-r--r--clutter/clutter/clutter-event.c2220
-rw-r--r--clutter/clutter/clutter-event.h829
-rw-r--r--clutter/clutter/clutter-feature.c148
-rw-r--r--clutter/clutter/clutter-feature.h42
-rw-r--r--clutter/clutter/clutter-fixed-layout.c181
-rw-r--r--clutter/clutter/clutter-fixed-layout.h82
-rw-r--r--clutter/clutter/clutter-flatten-effect.c54
-rw-r--r--clutter/clutter/clutter-flatten-effect.h73
-rw-r--r--clutter/clutter/clutter-flow-layout.c1534
-rw-r--r--clutter/clutter/clutter-flow-layout.h129
-rw-r--r--clutter/clutter/clutter-frame-clock.c843
-rw-r--r--clutter/clutter/clutter-frame-clock.h99
-rw-r--r--clutter/clutter/clutter-frame-private.h33
-rw-r--r--clutter/clutter/clutter-frame.c42
-rw-r--r--clutter/clutter/clutter-frame.h36
-rw-r--r--clutter/clutter/clutter-gesture-action-private.h31
-rw-r--r--clutter/clutter/clutter-gesture-action.c1455
-rw-r--r--clutter/clutter/clutter-gesture-action.h157
-rw-r--r--clutter/clutter/clutter-graphene.c130
-rw-r--r--clutter/clutter/clutter-graphene.h30
-rw-r--r--clutter/clutter/clutter-grid-layout.c2203
-rw-r--r--clutter/clutter/clutter-grid-layout.h161
-rw-r--r--clutter/clutter/clutter-id-pool.c129
-rw-r--r--clutter/clutter/clutter-id-pool.h50
-rw-r--r--clutter/clutter/clutter-image.c452
-rw-r--r--clutter/clutter/clutter-image.h140
-rw-r--r--clutter/clutter/clutter-input-device-private.h77
-rw-r--r--clutter/clutter/clutter-input-device-tool.c233
-rw-r--r--clutter/clutter/clutter-input-device-tool.h72
-rw-r--r--clutter/clutter/clutter-input-device.c1030
-rw-r--r--clutter/clutter/clutter-input-device.h145
-rw-r--r--clutter/clutter/clutter-input-focus-private.h40
-rw-r--r--clutter/clutter/clutter-input-focus.c267
-rw-r--r--clutter/clutter/clutter-input-focus.h84
-rw-r--r--clutter/clutter/clutter-input-method-private.h46
-rw-r--r--clutter/clutter/clutter-input-method.c507
-rw-r--r--clutter/clutter/clutter-input-method.h97
-rw-r--r--clutter/clutter/clutter-input-pointer-a11y-private.h47
-rw-r--r--clutter/clutter/clutter-input-pointer-a11y.c728
-rw-r--r--clutter/clutter/clutter-interval.c1229
-rw-r--r--clutter/clutter/clutter-interval.h159
-rw-r--r--clutter/clutter/clutter-keyframe-transition.c729
-rw-r--r--clutter/clutter/clutter-keyframe-transition.h122
-rw-r--r--clutter/clutter/clutter-keymap-private.h31
-rw-r--r--clutter/clutter/clutter-keymap.c192
-rw-r--r--clutter/clutter/clutter-keymap.h58
-rw-r--r--clutter/clutter/clutter-keysyms-table.c1681
-rwxr-xr-xclutter/clutter/clutter-keysyms-update.pl180
-rw-r--r--clutter/clutter/clutter-keysyms.h2309
-rw-r--r--clutter/clutter/clutter-layout-manager.c1010
-rw-r--r--clutter/clutter/clutter-layout-manager.h207
-rw-r--r--clutter/clutter/clutter-layout-meta.c146
-rw-r--r--clutter/clutter/clutter-layout-meta.h103
-rw-r--r--clutter/clutter/clutter-macros.h128
-rw-r--r--clutter/clutter/clutter-main.c2288
-rw-r--r--clutter/clutter/clutter-main.h200
-rw-r--r--clutter/clutter/clutter-marshal.list35
-rw-r--r--clutter/clutter/clutter-mutter.h113
-rw-r--r--clutter/clutter/clutter-offscreen-effect-private.h10
-rw-r--r--clutter/clutter/clutter-offscreen-effect.c749
-rw-r--r--clutter/clutter/clutter-offscreen-effect.h123
-rw-r--r--clutter/clutter/clutter-page-turn-effect.c422
-rw-r--r--clutter/clutter/clutter-page-turn-effect.h80
-rw-r--r--clutter/clutter/clutter-paint-context-private.h36
-rw-r--r--clutter/clutter/clutter-paint-context.c198
-rw-r--r--clutter/clutter/clutter-paint-context.h78
-rw-r--r--clutter/clutter/clutter-paint-node-private.h167
-rw-r--r--clutter/clutter/clutter-paint-node.c1289
-rw-r--r--clutter/clutter/clutter-paint-node.h123
-rw-r--r--clutter/clutter/clutter-paint-nodes.c1972
-rw-r--r--clutter/clutter/clutter-paint-nodes.h289
-rw-r--r--clutter/clutter/clutter-paint-volume-private.h141
-rw-r--r--clutter/clutter/clutter-paint-volume.c1155
-rw-r--r--clutter/clutter/clutter-pan-action.c1048
-rw-r--r--clutter/clutter/clutter-pan-action.h152
-rw-r--r--clutter/clutter/clutter-path-constraint.c394
-rw-r--r--clutter/clutter/clutter-path-constraint.h72
-rw-r--r--clutter/clutter/clutter-path.c1593
-rw-r--r--clutter/clutter/clutter-path.h181
-rw-r--r--clutter/clutter/clutter-pick-context-private.h37
-rw-r--r--clutter/clutter/clutter-pick-context.c199
-rw-r--r--clutter/clutter/clutter-pick-context.h72
-rw-r--r--clutter/clutter/clutter-pick-stack-private.h68
-rw-r--r--clutter/clutter/clutter-pick-stack.c436
-rw-r--r--clutter/clutter/clutter-private.h338
-rw-r--r--clutter/clutter/clutter-property-transition.c378
-rw-r--r--clutter/clutter/clutter-property-transition.h96
-rw-r--r--clutter/clutter/clutter-rotate-action.c250
-rw-r--r--clutter/clutter/clutter-rotate-action.h100
-rw-r--r--clutter/clutter/clutter-script-parser.c2011
-rw-r--r--clutter/clutter/clutter-script-private.h168
-rw-r--r--clutter/clutter/clutter-script.c1388
-rw-r--r--clutter/clutter/clutter-script.h212
-rw-r--r--clutter/clutter/clutter-scriptable.c183
-rw-r--r--clutter/clutter/clutter-scriptable.h112
-rw-r--r--clutter/clutter/clutter-scroll-actor.c435
-rw-r--r--clutter/clutter/clutter-scroll-actor.h97
-rw-r--r--clutter/clutter/clutter-seat-private.h31
-rw-r--r--clutter/clutter/clutter-seat.c707
-rw-r--r--clutter/clutter/clutter-seat.h167
-rw-r--r--clutter/clutter/clutter-settings-private.h21
-rw-r--r--clutter/clutter/clutter-settings.c1082
-rw-r--r--clutter/clutter/clutter-settings.h27
-rw-r--r--clutter/clutter/clutter-shader-effect.c904
-rw-r--r--clutter/clutter/clutter-shader-effect.h121
-rw-r--r--clutter/clutter/clutter-shader-types.c567
-rw-r--r--clutter/clutter/clutter-shader-types.h104
-rw-r--r--clutter/clutter/clutter-snap-constraint.c602
-rw-r--r--clutter/clutter/clutter-snap-constraint.h81
-rw-r--r--clutter/clutter/clutter-stage-manager-private.h49
-rw-r--r--clutter/clutter/clutter-stage-manager.c299
-rw-r--r--clutter/clutter/clutter-stage-manager.h86
-rw-r--r--clutter/clutter/clutter-stage-private.h145
-rw-r--r--clutter/clutter/clutter-stage-view-private.h82
-rw-r--r--clutter/clutter/clutter-stage-view.c1522
-rw-r--r--clutter/clutter/clutter-stage-view.h85
-rw-r--r--clutter/clutter/clutter-stage-window.c175
-rw-r--r--clutter/clutter/clutter-stage-window.h108
-rw-r--r--clutter/clutter/clutter-stage.c3599
-rw-r--r--clutter/clutter/clutter-stage.h267
-rw-r--r--clutter/clutter/clutter-swipe-action.c278
-rw-r--r--clutter/clutter/clutter-swipe-action.h109
-rw-r--r--clutter/clutter/clutter-tap-action.c148
-rw-r--r--clutter/clutter/clutter-tap-action.h102
-rw-r--r--clutter/clutter/clutter-text-buffer.c766
-rw-r--r--clutter/clutter/clutter-text-buffer.h172
-rw-r--r--clutter/clutter/clutter-text.c6857
-rw-r--r--clutter/clutter/clutter-text.h321
-rw-r--r--clutter/clutter/clutter-texture-content.c169
-rw-r--r--clutter/clutter/clutter-texture-content.h53
-rw-r--r--clutter/clutter/clutter-timeline-private.h33
-rw-r--r--clutter/clutter/clutter-timeline.c2752
-rw-r--r--clutter/clutter/clutter-timeline.h245
-rw-r--r--clutter/clutter/clutter-transition-group.c251
-rw-r--r--clutter/clutter/clutter-transition-group.h95
-rw-r--r--clutter/clutter/clutter-transition.c684
-rw-r--r--clutter/clutter/clutter-transition.h132
-rw-r--r--clutter/clutter/clutter-types.h435
-rw-r--r--clutter/clutter/clutter-units.c932
-rw-r--r--clutter/clutter/clutter-units.h184
-rw-r--r--clutter/clutter/clutter-util.c427
-rw-r--r--clutter/clutter/clutter-virtual-input-device.c283
-rw-r--r--clutter/clutter/clutter-virtual-input-device.h177
-rw-r--r--clutter/clutter/clutter-zoom-action.c515
-rw-r--r--clutter/clutter/clutter-zoom-action.h114
-rw-r--r--clutter/clutter/clutter.h118
-rw-r--r--clutter/clutter/deprecated/clutter-container.h73
-rw-r--r--clutter/clutter/deprecated/clutter-timeline.h34
-rw-r--r--clutter/clutter/meson.build410
-rw-r--r--clutter/clutter/mutter-clutter.pc.in24
245 files changed, 0 insertions, 119175 deletions
diff --git a/clutter/clutter/cally/ChangeLog.pre-cally-merge b/clutter/clutter/cally/ChangeLog.pre-cally-merge
deleted file mode 100644
index d77a9f776..000000000
--- a/clutter/clutter/cally/ChangeLog.pre-cally-merge
+++ /dev/null
@@ -1,986 +0,0 @@
-# DO NOT MODIFY THIS FILE
-#
-# Clutter uses the Git commit log to generate the ChangeLog files when
-# creating the tarball for releases and snapshots. This file is maintained
-# only for historical reasons.
-
-2010-07-05 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Cleaning ClutterText
-
- * Removing superfluous g_return_if_fail
- * Removing unused ClutterText::text-changed callback
-
-2010-07-05 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Refactoring "window:create" and "window:destroy" emission code
-
-Previously "window:create" and "window:destroy" were emitted on
-CallyUtil. Although it works, and CallyUtil already have callbacks to
-stage_added/removed signals, I think that it is more tidy/clear to do
-that on CallyRoot:
-
- * CallyRoot already has code to manage ClutterStage addition/removal
-
- * In fact, we can see CallyRoot as the object exposing the a11y
- information from ClutterStageManager, so it fits better here.
-
- * CallyUtil callbacks these signals are related to key event
- listeners (key snooper simulation). One of the main CallyUtil
- responsabilities is managing event (connecting, emitting), so I
- would prefer to not start to add/mix more functionalities here.
-
-Ideally it would be better to emit all CallyStage methods from
-CallyStage, but it is clear that "create" and "destroy" are more easy
-to emit from a external object.
-
-2010-06-25 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Cleaning clutter-actor
-
-Some cleaning changes:
- * Using CallyActionFunc instead of ACTION_FUNC
- * Removing a extra * on cally-actor-private macro documentation, to
- avoid gtk-doc warnings
- * Using g_strcmp0 instead of strcmp
-
-Changes to be applied on clutter (see CB#2097 and CB#2098), applied
-also here to maintain the sync. My intention is keep this developing line
-until the real integration, in order to make a final independent cally
-release.
-
-2010-06-14 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Adding -Wshadow option and solving warnings related
-
-
-2010-06-14 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Added dummy padding for future vt expasion
-
-Added dummy padding on the different classes structures, to allow
-future expansion of virtual methods.
-
-I decided to add this on all the classes, although it would be
-really unlikely in some cases (ie, CallyGroup)
-
-2010-06-10 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Adding and emitting "window:xxx" methods on CallyStage
-
-Added some window related signals on CallyStage:
-
- * window:activate and window:deactivate emitted from CallyStage
- * window:create and window:destroy emitted from CallyUtil
-
-ClutterStage doesn't fulfill 100% the window concept, but some of
-these signals are important in order to identify the object which
-could emit global/key events.
-
-The current implementation is equivalent to GailWindow one, supposing
-CallyStage as the only window related window. This likely would change
-in any clutter-based toolkit implement a real Window object, so a more
-flexible procedure would be required. But we would solve problems step
-by step.
-
-BTW: as I explain here [1] I really think that the current way to
-implement "window:xxx" signals (not defined in ATK but expected from
-the a11y implementation toolkit) somewhat hacky and undocumented (you
-need to check at-spi2 idls to know that you require to emit this
-events)
-
-Related to bug CB#2147 (Orca doesn't speech out properly non
-printable chars on some environments), as solves this problem
-in a specific case.
-
-[1] https://bugzilla.gnome.org/show_bug.cgi?id=620977#c1
-
-2010-06-04 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Avoiding clutter_stage_get_key_focus warning
-
-For any reason, in some cases, a clutter actor doesn't have a stage
-associated. We use the default one as fallback.
-
-2010-06-02 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Added a defunct check on cally_group_get_n_children
-
-Some warnings appeared when we tried to get the number
-of children of a defunct object.
-
-2010-06-02 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Update TODO file
-
-Use Bugzilla to setting missing features.
-
-2010-06-01 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Removing heuristics to decide CallyRectable/CallyTexture role
-
-Previously CallyRectangle and CallyTexture used some heuristics in
-order to decide the default role: ATK_ROLE_IMAGE or
-ATK_PUSH_BUTTON, as in practice most applications using these
-objects as buttons were not applying the proper role.
-
-As this is a hack, and a application responsibility, finally we
-have decided to remove this, so the default role is ATK_ROLE_IMAGE.
-
-Fixes CB#1732 (CallyTexture and CallyRectangle uses some heuristics to
-decide the role)
-
-2010-05-28 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Post-release version bump, after release 1.2.0
-
-I wrongly added the last commit on the 1.1 branch, when in fact it
-requires clutter 1.3.3, and on the README it is explained that
-cally versioning is tied to clutter versioning. In order to solve
-that a clutter-1.2 release branch is created, and bumped the version.
-
-This versioning tyding will be obsolete when the integration with
-clutter become a reality, but in the same way, this is the way to
-tidy this thinking in this integration.
-
-2010-04-13 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Use clutter_actor_get_accessible
-
-The method clutter_actor_get_accessible was added due work on
-bug 2070, and should be used to get the accessibility object,
-instead of atk_gobject_accessible_for_object
-
-This would allow to implement a11y support directly on
-any clutter based toolkit object (ie StLabel).
-
-2010-05-13 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Added CallyClone example
-
-
-2010-05-13 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Added a11y support for ClutterClone
-
-Resolved in the most simplified way, just as a image and a
-default description to identify cloned objects.
-
-More information:
-http://lists.o-hand.com/clutter/3797.html
-
-2010-04-14 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Remove gail dependency
-
-Removed to avoid gdk/gtk dependency on cally.
-
-Part of bug CB#2072 solution
-
-2010-04-14 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Avoid gdk functions filling AtkKeyEventStruct
-
-Now when AtkKeyEventStruct is filled in order to emit any key event
-signal, it is not used any gdk function on the keyval or the
-string fields.
-
-event_string is filled with the printable character if possible, if
-not (Ctrl, Alt, etc) it is set as NULL.
-
-Now the AT should take care of that, at least until we define atk key
-event struct in a more agnostic way (not tied to gdk/gtk). See orca
-bug bgo#616206 as a example.
-
-Part of bug CB#2072 solution.
-
-2010-04-15 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Added gail_misc_layout_get_run_attributes implementation
-
-Part of bug CB#2072 solution
-
-2010-04-14 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Remove gailutil/gailmisc functions calls
-
-This is because gailutil/gailmisc added a gdk/gtk dependency, and
-this dependency is being removed. New cally-specific implementation
-are required.
-
-Related to bug CB#1733
-
-Part of bug CB#2072 solution
-
-2010-04-13 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Fixing the libdir directory in some examples
-
-
-2010-03-26 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Previous cally.pc.in update was incomplete
-
-The previous commit was not tested properly, and it was missing one
-detail. Sorry for the noise.
-
-2010-03-26 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Update cally.pc.in after module relocation
-
-Previous commit places cally module in a different directory.
-It also corrects where the include directory is placed.
-
-2010-03-15 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Use a proper clutter module directory
-
-Use a proper clutter module directory, instead of keep being
-installed on a gtk directory.
-
-Improve the cally-examples-util, in order to keep using
-hardcoded values.
-
-Fixes CB#1737 (Wrong cally module directory)
-
-2010-03-15 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Proper UTF-8 headers
-
-
-2010-02-25 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Change "--with-dbus" option for "atk-bridge-dir" on examples
-
-The atk-adaptor in the dbus at-spi was renamed to atk-bridge due
-some apps hardcoding the name. So right now the only difference
-is the final directory.
-
-So the option was removed, and atk-bridge-dir added. This also allows
-to use the system atk-bridge or the compiled in any developing environment,
-so it is really more flexible.
-
-See the README (updated with this commit) for more information.
-
-2010-02-19 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Added .gitignore file
-
-
-2010-02-19 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Release 1.1.1
-
-
-2010-02-19 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Using clutter_threads_idle_add instead of the gdk one
-
-The idea is being as less gdk dependent as possible. Right now
-it is inviable to remove the dependency (gailutil and so on) but
-hypothetically, the ideal is remove this dependency in the future,
-and being "clutter pure".
-
-2010-02-15 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Check if the state is defunct on cally_text_get_name
-
-Check if the state is defunct on cally_text_get_name, in order
-to avoid warnings cally clutter_text_get_text when the clutter
-object is NULL
-
-2010-01-26 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Update on configure.ac after autoupdate call
-
-
-2010-02-02 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Try to apply the key modifiers to event->keyval like GDK does
-
-ClutterKeyEvent defines the keyval without taking into account the
-modifiers. GDK defines this keyval taking into account the modifiers.
-
-AtkKeyEventStruct expects the keyval in a GDK fashion, so a
-translation is required.
-
-This patch tries to do that using using
-gdk_keymap_translate_keyboard_state.
-
-This functions only works correctly if gtk has been initialized, so
-the fallback is create the AtkKeyEventStruct with the keyval
-provided by Clutter.
-
-More information:
-http://library.gnome.org/devel/atk/stable/AtkUtil.html#AtkKeyEventStruct
-http://bugzilla.openedhand.com/show_bug.cgi?id=1961
-
-2010-02-02 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Filling AtkKeyEventStruct->string used on the atk key event listeners
-
-Finally we use directly gdk_keyval_name. Not the ideal solution, but works,
-and more important, it avoids to reimplement this issue on clutter or cally.
-
-More information on Bug 1952
-
-Fixes http://bugzilla.openedhand.com/show_bug.cgi?id=1952
-
-2010-01-22 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Added AM_PROG_CC_C_O option to avoid a warning running configure
-
-
-2010-01-22 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Fix clutter version required on the pc files
-
-
-2010-01-22 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Check on configure time if any x11 clutter backend is in use
-
-It uses AC_CHECK_LIB in order to check if x11 backend is in use.
-It also modifies cally-actor in order to use the information
-retrieved.
-
-So now cally has a minimum multi-backend support. It only manages
-a x11 (glx or eglx) backend, but at least, it checks it, so you
-can compile cally without this backend. It probably will not work
-properly, but at least you can compile and execute it.
-
-Solves http://bugzilla.openedhand.com/show_bug.cgi?id=1736
-
-2010-01-21 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Fix the perspective problems computing the on-screen extensions
-
-Use clutter_actor_get_abs_allocation_vertices and
-clutter_actor_get_transformed_size to get the real on-screen
-position and size, instead of compute that using the geometry
-and the anchor point.
-
-It also update cally-atkcomponent-example, adding a actor inside
-a nested ClutterGroup hierarchy.
-
-Fixes: http://bugzilla.openedhand.com/show_bug.cgi?id=1731
-
-2010-01-13 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Added extra button on cally-atkeditabletext-example
-
-Added a button to print the current cursor position, and also
-extend the size of the buttons
-
-2010-01-12 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Remove superfluous g_print on CallyStage
-
-
-2009-12-03 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Use clutter_stage_manager_peek_stages to avoid a leak
-
-
-2009-12-03 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Added ATK_STATE_SELECTABLE_TEXT management
-
-
-2009-11-26 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Manage properly ATK_STATE_ACTIVE on CallyStage
-
-* cally/cally-stage.c
-Added private struct
-(cally_stage_class_init),(cally_stage_init),(cally_stage_real_initalize):
-Initialization stuff
-(cally_stage_activate_cb)
-(cally_stage_deactivate_cb): new ClutterStage signal callbacks, change
-the internal value of active, and notify the atk state change
-(cally_stage_ref_state_set): manage ATK_STATE_ACTIVATE
-* examples/cally-atktext-example2.c
-If possible, creates two stage, in order to test ATK_STATE_ACTIVATE
-
-2009-11-24 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Focused state change and focused object notification
-
-* cally/cally-actor.h
-(focus_clutter): added virtual method for the focus management
-* cally/cally-actor.c
-(cally_actor_component_interface_init)
-(cally_actor_add_focus_handler)
-(cally_actor_remove_focus_handler):
-Implementation of the AtkComponent methods add_focus_handler and
-remove_focus_handler
-(cally_actor_focus_event): CallyActor specific focus handler, notify
-the state focused change
-(cally_actor_focus_clutter)
-(cally_actor_real_focus_clutter):
-Handlers for the ClutterActor "key-focus-in" and "key-focus-out"
-signals. Emit the signal AtkObject "focus_event" and set the focus
-object with atk_focus_tracker_notify.
-(cally_actor_initialize):
-Connect to the signals "key-focus-in" and "key-focus-out", use
-atk_component_add_focus_handler to add cally_actor_focus_event
-
-Note: The focus management is more simplified that the gail one. The
-main reason is that the focus management in GTK is really more complex
-that the Clutter one.
-
-2009-11-24 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Modify cally-atkeditabletext-example.c to manage "activatable" status
-
-
-2009-11-24 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Added "activate" action in ClutterText
-
-* cally/cally-actor.h
-* cally/cally-actor.c
-cally_actor_add_action now returns the action id added. Documentation
-added in order to explain the return values and others.
-
-* cally/cally-text.c
-Added action "activate". This action is only available if the ClutterText is
-activatable, so the "activatable" property is tracked in the notify
-
-2009-11-20 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Signal event emission
-
-Emits the signals "text_selection_changed", "text_caret_moved",
-"text_changed::insert", "text_changed::delete", and notify the
-ATK_STATE_EDITABLE state change.
-
-It also adds the ATK_STATE_EDITABLE in the ref_state_set, includes a
-finalize to clean the new private data used, and move part of the
-initialization from the _init to the _real_initialization.
-
-2009-12-03 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Remove the ATK_STATE_DEFUNCT emission
-
-Remove the ATK_STATE_DEFUNCT emission, as this is already made by
-AtkGObjectAccessible.
-
-It also removes the clutter actor from the private structure, as we
-can use the AtkGObjectAccessible API to obtain it. This makes the code
-more coherent, with respect of the rest of the Cally classes
-implementation.
-
-2009-11-26 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Remove ; from the CALLY_GET_CLUTTER_ACTOR macro
-
-
-2009-11-25 Alejandro Piñeiro <apinheiro@igalia.com>
-
-TODO cleanup and more implementation notes
-
-* TODO: removed the data that we have in the bugzilla or in the implementation
- notes on the cally source
-* cally/cally-actor.c: complete implementations notes
-* cally/Makefile.am: add a comment related to the public headers, and include
- Makefile.in in the MAINTAINERCLEANFILES
-
-2009-11-13 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Adding new tips on CODING_STYLE
-
-
-2009-11-09 Alejandro Piñeiro <apinheiro@igalia.com>
-
-AtkEditableText implementation on CallyText
-
-* examples/Makefile.am
-* examples/cally-atkeditabletext-example.c: New example added
-* cally/cally-text.c
-
-Interface AtkEditableText implemented, except some methods:
- * Missing ClipBoard feature on Clutter:
- paste_text
- copy_text
- cut_text
- * Missing a equivalent GtkTextTag on Clutter (so the possibility to
- set run attributes in a range):
- set_run_attributes
-
-Fixes bug CB#1734
-
-2009-11-03 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Removed DG_DISABLE_CHECKS and DG_DISABLE_CAST_CHECKS from CFLAGS
-
-* configure.ac: Removed DG_DISABLE_CHECKS and DG_DISABLE_CAST_CHECKS
- from the common CFLAGS options
-* cally/cally-actor.c: fixed cast errors on some return values, not
- detected previously because of the use of relaxed compilation
- options
-
-Problem detected by Mario Sánchez Prada <msanchez@igalia.com>
-
-2009-10-28 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Support for multiple stages
-
-* cally-root.c
-* cally-stage.c
-* cally-util.c
-Implemented the support for multiple stages, by tracking the signals
-stage-added and stage-removed of the ClutterStageManager.
-
-In the same way CallyRoot has implement properly the atk_object_initialize,
-and in general now is more tied to ClutterStageManager (CallyRoot is now
-the a11y object of ClutterStageManager), but factory not required anyway,
-as it is instanced on the CallyUtil atk_get_root
-
-Fixes: CB#1754 (Missing multi-stage support)
-
-2009-10-27 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Implemented atk_[add/remove]_key_event_listener on CallyUtil
-
-* cally/cally-util.c:
- Implemented atk_[add/remove]_key_event_listener
-* examples/cally-atktext-example2.c:
- Modified in order to install and remove key event listeners,
- for testing purposes
-
-Fixes CB#1852 (AtkUtil implementation misses
-atk_[add/remove]_key_event_listener)
-
-2009-10-21 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Implemented atk-[add/remove]-global-event-listener on CallyUtil
-
- * cally/cally-util.c:
- Implemented atk-[add/remove]-global-event-listener on CallyUtil
- * examples/Makefile.am
- * examples/cally-atktext-example2.c
- New example in order to test easier the event emission on focus
- change (not working right now)
-
-2009-10-12 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Add --with-dbus option executing the examples
-
-The replacement for atk-bridge on at-spi-dbus has a different name
-(atk-adaptor), and it has not defined the method gnome_accessibility_init.
-The --with-dbus option allow to load the correct library and use the
-correct hook method if you are using at-spi-dbus.
-
-Anyway, take into account that this is just an example, and in a final
-environment, this should be made in a more general way.
-
-More information: CB#1738, CB#1737
-
-2009-09-25 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Symplifying shave support.
-
-
-2009-09-25 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Cleanup on the compilation and installation process
-
-* cally/Makefile.am:
- Added libcallydir and libcally_HEADERS in order to publish all cally
- headers, as the current policy is use the cally headers as public.
-* configure.ac:
- Change API_VERSION_MAJOR for CALLY_API_VERSION, as was the real
- meaning, and define CALLY_VERSION.
- Change CALLY_OBJ_CFLAGS and CALLY_OBJ_LIBS, used to compile the
- tests, as was not required to compile against the cally module (the
- example only required to compile against Clutter, as the cally
- module was just a module loaded by GModule).
- Support for Shave.
-
-2009-07-31 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Be able to run the examples without installing Cally
-
-Before that, the examples searched the cally module from the final installed
-directory. This means that you should install the library to use the examples.
-On development this is not desirable. Now it is loaded from ../cally/.libs
-
-This is a little hackish, but more useful, and in the end, it is just a example.
-Probably a best option could be configure that on the command line.
- $ ./example --cally-dir="mydir"
-
-But just a nitpick.
-
-2009-07-29 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Upgrade to cally-1.0, using clutter-1.0
-
-* NEWS
-* TODO: removed several items, waiting to be moved to the bugzilla
-* configure.ac
-* examples/cally-examples-util.c
-
-2009-07-27 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Fixed return value of cally_actor_get_index_in_parent
-
-Bug and solutiond pointed by Gerd Kohlberger
-
-2009-06-30 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Added the implementation of most AtkText methods for CluttetText (CallyText)
-
-It remains some methods:
- get_default_attributes
- get_character_extents
- get_offset_at_point
-
-The current gail implementation delegate on gailmisc, but this is tied to
-GtkWidget so an equivalent functionality would be implemented (something like
-callymisc), and in the case of get_character_extents, not sure about the layout
-position (see gtk_entry_get_layout_offsets).
-
-I think that worth manage this in a different commit.
-
-In the same way is still missing AtkEditableText support.
-
-2009-07-07 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Added CALLY_GET_CLUTTER_ACTOR macro
-
-This macro was created to simplify how do you get the clutter actor object
-related to the cally object. On CallyActor a private attributte maintains it
-(for convenience, as it is heavily used) but outside, atkgobject methods can
-be used. Note that there is a possibility on the future to change it. Two
-options:
- * Add a public method to get the clutter object
- * Use this method on CallyActor too
-
-This macro simplifies this:
-
-CLUTTER_ACTOR (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (cally_object)))
-
-2009-06-24 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Renamed examples/cally-util.[ch] to examples/cally-examples-util.[ch]
-
-Renamed examples/cally-util.[ch] to examples/cally-examples-util.[ch] to avoid
-confusion with cally/cally-util.[ch], implementation of the AtkUtil interface
-
-2009-06-23 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Adding examples directory
-
-* NEWS: Updates
-* configure.ac
-* Makefile.am
-* cally/Makefile.am
-* examples/Makefile.am: New
-* examples/cally-util.[ch]: New
-* examples/example1.c: New
-Added a directory in order to put examples. In this way we don't require any
-external clutter app to make the basic a11y functionality checks. At this
-moment only an example was added, but all the compiling structure is working.
-By default the examples are not compiled, use "--enable-examples" on configure
-time in order to enable their compilation.
-
-This basic example basically shows several objects, with different depth, in
-order to check that AtkComponent returns the correct screen position.
-
-Other minor changes done on the building infrastructure.
-
-2009-06-23 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Fix clutter version required
-
-
-2009-06-23 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Solve a problem calling clutter_actor_get_anchor_point
-
-* cally/cally-actor.c:
-(_get_actor_extents): use gfloat instead of gint, as now this clutter_actor_get_anchor_point
-use floats
-
-2009-06-11 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Minor fixes
-
- * Update TODO
- * Fix .pc files, to use clutter-0.9 version
-
-2009-05-20 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Library renamed from cail to cally
-
-
-2009-05-08 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Removed cail-clone-texture.h from cail.h
-
-* cail/cail.h: Removed reference to cail-clone-texture.h
-
-2009-05-08 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Upgrade to cail-0.9, using clutter-0.9, first compilable version
-
-* NEWS: new file with the information of the releases
-* TODO: updated
-* configure.ac: updated clutter version to compile against
-* cail/cail-clone-texture.[ch]: Removed as ClutterCloneTexture was removed on Clutter 0.9.0
-* cail/cail-label.[ch]: Removed as ClutterLabel was removed on Clutter 0.9.0
-* cail/Makefile.am: updated due the source files removed
-* cail/cail-actor.c: removed include to <clutter/clutter-actor.h>
-* cail/cail.c: removed the factories for CailLabel and CailCloneTexture
-
-2009-05-07 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Reflect change on the version number policy
-
-* README: correct some typos and explain that the cail version number
-is tied to the clutter version number and how
-* configure.ac
-Set the version number to 0.8.0
-
-2009-05-07 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Edit the ChangeLog file, to show that now we are using git
-
-* ChangeLog.SVN: new file, with the ChangeLog used while cail was
-using a Subversion repository
-* ChangeLog: now is empty, and only maintains a reference to use git log
-
-2009-04-29 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Coding style review
-
-* CODING_STYLE
-* cail/Makefile.am
-* cail/cail-actor-private.[ch]
-* cail/cail-actor.h
-* cail/cail-clone-texture.[ch]
-* cail/cail-group.[ch]
-* cail/cail-label.[ch]
-* cail/cail-rectangle.[ch]
-* cail/cail-root.[ch]
-* cail/cail-stage.[ch]
-* cail/cail-texture.[ch]
-* cail/cail-util.[ch]
-* cail/cail.c
-
-2009-04-28 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Coding style review: cail-actor.c
-
-
-2009-04-21 Alejandro Piñeiro <apinheiro@igalia.com>
-
-2009-04-21 Alejandro Pinheiro <apinheiro@igalia.com>
-
- * TODO: updated TODO file
-
-2009-04-21 Alejandro Piñeiro <apinheiro@igalia.com>
-
-2009-03-06 Alejandro Pinheiro <apinheiro@igalia.com>
-
- * AUTHORS: update authors file to public release
-
-2009-03-06 Alejandro Piñeiro <apinheiro@igalia.com>
-
-2009-03-06 Alejandro Pinheiro <apinheiro@igalia.com>
-
- * debian/control
- Added cdbs dependency, renamed debugging package
- * debian/libcail-common-dbg.dirs: new file
- * debian/libcail-common.dirs
- * debian/libcail-common.install
- Minor changes
-
-2009-03-05 Alejandro Piñeiro <apinheiro@igalia.com>
-
-2009-03-05 Alejandro Pinheiro <apinheiro@igalia.com>
-
- * TODO
- Added TODO file, in order to list the remaining tasks.
-
-2009-03-05 Alejandro Piñeiro <apinheiro@igalia.com>
-
-2009-03-05 Alejandro Pinheiro <apinheiro@igalia.com>
-
- * configure.ac
- * cail/cail.c
- * cail/cail-util.c
- * Makefile.am
- Removed all the missing gtk related stuff
-
-2009-03-05 Alejandro Piñeiro <apinheiro@igalia.com>
-
-2009-03-05 Alejandro Pinheiro <apinheiro@igalia.com>
-
- * cail/cail-actor.c
- (_get_actor_extents): managing too the anchor point to compute the position
- (_get_top_level_origin): reimplemented using x11 functions, removed
- gtk/gdk related functions, and taking into account the relative position
- inside the parent (previous position calculation was wrong if a child
- was not a direct stage child)
- * cail/clutter-gtk/cail-clutter-embed.[ch]
- * cail/clutter-gtk/cail-gtk-factory.h
- Removed, in order to remove any gtk dependency
- * cail/debian/control: removed gtk dependency
-
-2009-03-03 Alejandro Piñeiro <apinheiro@igalia.com>
-
-2009-03-03 Alejandro Pinheiro <apinheiro@igalia.com>
-
- * cail/cail-actor-private.[ch]: new files to private utility functions
- (_cail_actor_pushable): new function, that checks if a cail actor is
- pushable by checking if the clutter actor related has a handler for
- a release event
- * cail/cail-texture.c
- * cail/cail-clone-texture.c
- * cail/cail-rectangle.c
- Use of new function _cail_actor_pushable
- * cail-actor.c: Added some documentation related to current implementation
- * cail-util.c: Code style review
-
-2009-03-02 Alejandro Piñeiro <apinheiro@igalia.com>
-
-2009-03-02 Alejandro Pinheiro <apinheiro@igalia.com>
-
- * cail/cail-label.[ch]: new
- * cail/cail.[ch]
- (cail_accessibility_module_init)
- * cail/Makefile.am
- Added CailLabel, a11y object for ClutterLabel
-
-2009-02-27 Alejandro Piñeiro <apinheiro@igalia.com>
-
-2009-02-27 Alejandro Pinheiro <apinheiro@igalia.com>
-
- * cail/cail-actor.c
- (cail_actor_real_remove_actor)
- Fixed a typo that causes a crash while removing the actor from a
- container
-
-2009-02-26 Alejandro Piñeiro <apinheiro@igalia.com>
-
-2009-02-26 Alejandro Pinheiro <apinheiro@igalia.com>
-
- * cail/cail-actor.c
- (cail_actor_remove_actor)
- (cail_actor_add_actor)
- Fixed a typo calling klass->add_actor and klass->remove_actor that causes
- a crash in some (container,actor) combinations
-
- (cail_actor_real_add_actor)
- Additional parameter check
-
-2009-02-25 Alejandro Piñeiro <apinheiro@igalia.com>
-
-Missing cail-rectangle.[ch] files, according 2009-02-23 entry at Changelog
-
-
-2009-02-23 Alejandro Piñeiro <apinheiro@igalia.com>
-
-2009-02-23 Alejandro Pinheiro <apinheiro@igalia.com>
-
- * cail/cail-rectangle.[ch]
- * cail/cail.[ch]
- * cail/Makefile.am
-
- Added CailRectangle, a11y object for ClutterRectangle
-
- * cail/cail-group.c
- * cail/cail-texture.c
- * cail/cail-stage.c
-
- Avoid to add a empty private structure, to avoid the glib warning. Anyway
- the pointer to the private structure is still on the .h, to allow future
- add-on.
-
-2009-02-20 Alejandro Piñeiro <apinheiro@igalia.com>
-
-2009-02-20 Alejandro Pinheiro <apinheiro@igalia.com>
-
- * cail-actor.[ch]
- * cail-group.[ch]
-
- Moved most of the ClutterContainer a11y support from cail-group to
- cail-actor, in order to generalize this support.
-
- * cail-stage.[ch]
- * cail-util.[ch]
- Normalize the private structure to avoid future problems with missing
- gaps
-
-2009-02-20 Alejandro Piñeiro <apinheiro@igalia.com>
-
-2009-02-20 Alejandro Pinheiro <apinheiro@igalia.com>
-
- * cail/cail-actor.c
- (cail_actor_connect_actor_destroyed): connects to the clutter actor
- destroy signal
- (cail_actor_clutter_actor_destroyed): handler to the clutter actor
- destroy signal, update the priv->actor pointer and notify a state change
-
- This change allows to be sure about the priv->actor correct value, so we
- can use directly priv->actor instead of atk_gobject_accessible_get_object
- in the next functions:
- (cail_actor_get_parent)
- (cail_actor_get_index_in_parent)
- (cail_actor_ref_state_set)
- (cail_actor_get_extents)
-
-2009-02-19 Alejandro Piñeiro <apinheiro@igalia.com>
-
-2009-02-19 Alejandro Pinheiro <apinheiro@igalia.com>
-
- * cail/cail-texture.[ch]
- * cail/cail-clone-texture.[ch]
- * cail/cail.[ch]
- * cail/Makefile.am
-
- Added CailTexture and CailCloneTexture a11y objects for ClutterTexture
- and ClutterCloneTexture
-
- * cail/cail-util.c
-
- Added private structure
-
-2009-02-18 Alejandro Piñeiro <apinheiro@igalia.com>
-
-2009-02-18 Alejandro Pinheiro <apinheiro@igalia.com>
-
- * cail/cail-actor.c:
- (cail_actor_get_parent)
- Return the accessible object of the clutter actor if accessible_parent
- is not available. Previously it only took into account the these object
- as a possible parent to return (you can set it with atk_object_set_parent)
-
-2009-02-18 Alejandro Piñeiro <apinheiro@igalia.com>
-
-2009-02-18 Alejandro Pinheiro <apinheiro@igalia.com>
-
- * cail/cail-group.[ch]: code style review
- * cail/cail-actor.[ch]: implemented basic support for ClutterContainer
-
-2009-02-18 Alejandro Piñeiro <apinheiro@igalia.com>
-
-2009-02-18 Alejandro Pinheiro <apinheiro@igalia.com>
-
- * debian/control: updating dependencies
-
-2009-02-18 Alejandro Piñeiro <apinheiro@igalia.com>
-
-2009-02-18 Alejandro Pinheiro <apinheiro@igalia.com>
-
- * configure.ac: added aditional compile flags
- * cail/cail-actor.[ch]: Reimplemented support for AtkAction interface
- * cail/cail-root.[ch]: code style review
-
-2009-02-16 Alejandro Piñeiro <apinheiro@igalia.com>
-
-2009-02-16 Alejandro Pinheiro <apinheiro@igalia.com>
-
- * First release.
diff --git a/clutter/clutter/cally/cally-actor-private.h b/clutter/clutter/cally/cally-actor-private.h
deleted file mode 100644
index 23884bb27..000000000
--- a/clutter/clutter/cally/cally-actor-private.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* CALLY - The Clutter Accessibility Implementation Library
- *
- * Copyright (C) 2008 Igalia, S.L.
- *
- * Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
- *
- * Some parts are based on GailWidget from GAIL
- * GAIL - The GNOME Accessibility Implementation Library
- * Copyright 2001, 2002, 2003 Sun Microsystems Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __CALLY_ACTOR_PRIVATE_H__
-#define __CALLY_ACTOR_PRIVATE_H__
-
-#include "cally-actor.h"
-
-/*
- * Auxiliary define, in order to get the clutter actor from the AtkObject using
- * AtkGObject methods
- *
- */
-#define CALLY_GET_CLUTTER_ACTOR(cally_object) \
- (CLUTTER_ACTOR (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (cally_object))))
-
-void _cally_actor_get_top_level_origin (ClutterActor *actor,
- gint *x,
- gint *y);
-
-#endif /* __CALLY_ACTOR_PRIVATE_H__ */
diff --git a/clutter/clutter/cally/cally-actor.c b/clutter/clutter/cally/cally-actor.c
deleted file mode 100644
index bc7c3fa8f..000000000
--- a/clutter/clutter/cally/cally-actor.c
+++ /dev/null
@@ -1,1195 +0,0 @@
-/* CALLY - The Clutter Accessibility Implementation Library
- *
- * Copyright (C) 2008 Igalia, S.L.
- *
- * Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
- *
- * Some parts are based on GailWidget from GAIL
- * GAIL - The GNOME Accessibility Implementation Library
- * Copyright 2001, 2002, 2003 Sun Microsystems Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * SECTION:cally-actor
- * @Title: CallyActor
- * @short_description: Implementation of the ATK interfaces for #ClutterActor
- * @see_also: #ClutterActor
- *
- * #CallyActor implements the required ATK interfaces of #ClutterActor
- * exposing the common elements on each actor (position, extents, etc).
- */
-
-/*
- *
- * IMPLEMENTATION NOTES:
- *
- * ####
- *
- * Focus: clutter hasn't got the focus concept in the same way that GTK, but it
- * has a key focus managed by the stage. Basically any actor can be focused using
- * clutter_stage_set_key_focus. So, we will use this approach: all actors are
- * focusable, and we get the currently focused using clutter_stage_get_key_focus
- * This affects focus related stateset and some atk_componenet focus methods (like
- * grab focus).
- *
- * In the same way, we will manage the focus state change management
- * on the cally-stage object. The reason is avoid missing a focus
- * state change event if the object is focused just before the
- * accessibility object being created.
- *
- * #AtkAction implementation: on previous releases ClutterActor added
- * the actions "press", "release" and "click", as at that time some
- * general-purpose actors like textures were directly used as buttons.
- *
- * But now, new toolkits appeared, providing high-level widgets, like
- * buttons. So in this environment, it doesn't make sense to keep
- * adding them as default.
- *
- * Anyway, current implementation of AtkAction is done at CallyActor
- * providing methods to add and remove actions. This is based on the
- * one used at gailcell, and proposed as a change on #AtkAction
- * interface:
- *
- * https://bugzilla.gnome.org/show_bug.cgi?id=649804
- *
- */
-
-#include "clutter-build-config.h"
-
-#include <glib.h>
-#include <clutter/clutter.h>
-
-#include "clutter/clutter-actor-private.h"
-
-#include <math.h>
-
-#include "cally-actor.h"
-#include "cally-actor-private.h"
-
-typedef struct _CallyActorActionInfo CallyActorActionInfo;
-
-/*< private >
- * CallyActorActionInfo:
- * @name: name of the action
- * @description: description of the action
- * @keybinding: keybinding related to the action
- * @do_action_func: callback
- * @user_data: data to be passed to @do_action_func
- * @notify: function to be called when removing the action
- *
- * Utility structure to maintain the different actions added to the
- * #CallyActor
- */
-struct _CallyActorActionInfo
-{
- gchar *name;
- gchar *description;
- gchar *keybinding;
-
- CallyActionCallback do_action_func;
- gpointer user_data;
- GDestroyNotify notify;
-};
-
-static void cally_actor_initialize (AtkObject *obj,
- gpointer data);
-static void cally_actor_finalize (GObject *obj);
-
-/* AtkObject.h */
-static AtkObject* cally_actor_get_parent (AtkObject *obj);
-static gint cally_actor_get_index_in_parent (AtkObject *obj);
-static AtkStateSet* cally_actor_ref_state_set (AtkObject *obj);
-static gint cally_actor_get_n_children (AtkObject *obj);
-static AtkObject* cally_actor_ref_child (AtkObject *obj,
- gint i);
-static AtkAttributeSet * cally_actor_get_attributes (AtkObject *obj);
-
-/* ClutterContainer */
-static gint cally_actor_add_actor (ClutterActor *container,
- ClutterActor *actor,
- gpointer data);
-static gint cally_actor_remove_actor (ClutterActor *container,
- ClutterActor *actor,
- gpointer data);
-static gint cally_actor_real_add_actor (ClutterActor *container,
- ClutterActor *actor,
- gpointer data);
-static gint cally_actor_real_remove_actor (ClutterActor *container,
- ClutterActor *actor,
- gpointer data);
-
-/* AtkComponent.h */
-static void cally_actor_component_interface_init (AtkComponentIface *iface);
-static void cally_actor_get_extents (AtkComponent *component,
- gint *x,
- gint *y,
- gint *width,
- gint *height,
- AtkCoordType coord_type);
-static gint cally_actor_get_mdi_zorder (AtkComponent *component);
-static gboolean cally_actor_grab_focus (AtkComponent *component);
-
-/* AtkAction.h */
-static void cally_actor_action_interface_init (AtkActionIface *iface);
-static gboolean cally_actor_action_do_action (AtkAction *action,
- gint i);
-static gboolean idle_do_action (gpointer data);
-static gint cally_actor_action_get_n_actions (AtkAction *action);
-static const gchar* cally_actor_action_get_description (AtkAction *action,
- gint i);
-static const gchar* cally_actor_action_get_keybinding (AtkAction *action,
- gint i);
-static const gchar* cally_actor_action_get_name (AtkAction *action,
- gint i);
-static gboolean cally_actor_action_set_description (AtkAction *action,
- gint i,
- const gchar *desc);
-static void _cally_actor_destroy_action_info (gpointer action_info,
- gpointer user_data);
-static void _cally_actor_clean_action_list (CallyActor *cally_actor);
-
-static CallyActorActionInfo* _cally_actor_get_action_info (CallyActor *cally_actor,
- gint index);
-/* Misc functions */
-static void cally_actor_notify_clutter (GObject *obj,
- GParamSpec *pspec);
-static void cally_actor_real_notify_clutter (GObject *obj,
- GParamSpec *pspec);
-
-struct _CallyActorPrivate
-{
- GQueue *action_queue;
- guint action_idle_handler;
- GList *action_list;
-
- GList *children;
-};
-
-G_DEFINE_TYPE_WITH_CODE (CallyActor,
- cally_actor,
- ATK_TYPE_GOBJECT_ACCESSIBLE,
- G_ADD_PRIVATE (CallyActor)
- G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT,
- cally_actor_component_interface_init)
- G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION,
- cally_actor_action_interface_init));
-
-/**
- * cally_actor_new:
- * @actor: a #ClutterActor
- *
- * Creates a new #CallyActor for the given @actor
- *
- * Return value: the newly created #AtkObject
- *
- * Since: 1.4
- */
-AtkObject *
-cally_actor_new (ClutterActor *actor)
-{
- gpointer object;
- AtkObject *atk_object;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), NULL);
-
- object = g_object_new (CALLY_TYPE_ACTOR, NULL);
-
- atk_object = ATK_OBJECT (object);
- atk_object_initialize (atk_object, actor);
-
- return atk_object;
-}
-
-static void
-cally_actor_initialize (AtkObject *obj,
- gpointer data)
-{
- CallyActor *self = NULL;
- CallyActorPrivate *priv = NULL;
- ClutterActor *actor = NULL;
- guint handler_id;
-
- ATK_OBJECT_CLASS (cally_actor_parent_class)->initialize (obj, data);
-
- self = CALLY_ACTOR(obj);
- priv = self->priv;
- actor = CLUTTER_ACTOR (data);
-
- g_signal_connect (actor,
- "notify",
- G_CALLBACK (cally_actor_notify_clutter),
- NULL);
-
- g_object_set_data (G_OBJECT (obj), "atk-component-layer",
- GINT_TO_POINTER (ATK_LAYER_MDI));
-
- priv->children = clutter_actor_get_children (actor);
-
- /*
- * We store the handler ids for these signals in case some objects
- * need to remove these handlers.
- */
- handler_id = g_signal_connect (actor,
- "actor-added",
- G_CALLBACK (cally_actor_add_actor),
- obj);
- g_object_set_data (G_OBJECT (obj), "cally-add-handler-id",
- GUINT_TO_POINTER (handler_id));
- handler_id = g_signal_connect (actor,
- "actor-removed",
- G_CALLBACK (cally_actor_remove_actor),
- obj);
- g_object_set_data (G_OBJECT (obj), "cally-remove-handler-id",
- GUINT_TO_POINTER (handler_id));
-
- obj->role = ATK_ROLE_PANEL; /* typically objects implementing ClutterContainer
- interface would be a panel */
-}
-
-static void
-cally_actor_class_init (CallyActorClass *klass)
-{
- AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- klass->notify_clutter = cally_actor_real_notify_clutter;
- klass->add_actor = cally_actor_real_add_actor;
- klass->remove_actor = cally_actor_real_remove_actor;
-
- /* GObject */
- gobject_class->finalize = cally_actor_finalize;
-
- /* AtkObject */
- class->get_parent = cally_actor_get_parent;
- class->get_index_in_parent = cally_actor_get_index_in_parent;
- class->ref_state_set = cally_actor_ref_state_set;
- class->initialize = cally_actor_initialize;
- class->get_n_children = cally_actor_get_n_children;
- class->ref_child = cally_actor_ref_child;
- class->get_attributes = cally_actor_get_attributes;
-}
-
-static void
-cally_actor_init (CallyActor *cally_actor)
-{
- CallyActorPrivate *priv = cally_actor_get_instance_private (cally_actor);
-
- cally_actor->priv = priv;
-
- priv->action_queue = NULL;
- priv->action_idle_handler = 0;
-
- priv->action_list = NULL;
-
- priv->children = NULL;
-}
-
-static void
-cally_actor_finalize (GObject *obj)
-{
- CallyActor *cally_actor = NULL;
- CallyActorPrivate *priv = NULL;
-
- cally_actor = CALLY_ACTOR (obj);
- priv = cally_actor->priv;
-
- _cally_actor_clean_action_list (cally_actor);
-
- g_clear_handle_id (&priv->action_idle_handler, g_source_remove);
-
- if (priv->action_queue)
- {
- g_queue_free (priv->action_queue);
- }
-
- if (priv->children)
- {
- g_list_free (priv->children);
- priv->children = NULL;
- }
-
- G_OBJECT_CLASS (cally_actor_parent_class)->finalize (obj);
-}
-
-/* AtkObject */
-
-static AtkObject *
-cally_actor_get_parent (AtkObject *obj)
-{
- ClutterActor *parent_actor = NULL;
- AtkObject *parent = NULL;
- ClutterActor *actor = NULL;
- CallyActor *cally_actor = NULL;
-
- g_return_val_if_fail (CALLY_IS_ACTOR (obj), NULL);
-
- /* Check if we have and assigned parent */
- if (obj->accessible_parent)
- return obj->accessible_parent;
-
- /* Try to get it from the clutter parent */
- cally_actor = CALLY_ACTOR (obj);
- actor = CALLY_GET_CLUTTER_ACTOR (cally_actor);
- if (actor == NULL) /* Object is defunct */
- return NULL;
-
- parent_actor = clutter_actor_get_parent (actor);
- if (parent_actor == NULL)
- return NULL;
-
- parent = clutter_actor_get_accessible (parent_actor);
-
- /* FIXME: I need to review the clutter-embed, to check if in this case I
- * should get the widget accessible
- */
-
- return parent;
-}
-
-static gint
-cally_actor_get_index_in_parent (AtkObject *obj)
-{
- CallyActor *cally_actor = NULL;
- ClutterActor *actor = NULL;
- ClutterActor *parent_actor = NULL;
- ClutterActor *iter;
- gint index = -1;
-
- g_return_val_if_fail (CALLY_IS_ACTOR (obj), -1);
-
- if (obj->accessible_parent)
- {
- gint n_children, i;
- gboolean found = FALSE;
-
- n_children = atk_object_get_n_accessible_children (obj->accessible_parent);
- for (i = 0; i < n_children; i++)
- {
- AtkObject *child;
-
- child = atk_object_ref_accessible_child (obj->accessible_parent, i);
- if (child == obj)
- found = TRUE;
-
- g_object_unref (child);
- if (found)
- return i;
- }
- return -1;
- }
-
- cally_actor = CALLY_ACTOR (obj);
- actor = CALLY_GET_CLUTTER_ACTOR (cally_actor);
- if (actor == NULL) /* Object is defunct */
- return -1;
-
- index = 0;
- parent_actor = clutter_actor_get_parent (actor);
- if (parent_actor == NULL)
- return -1;
-
- for (iter = clutter_actor_get_first_child (parent_actor);
- iter != NULL && iter != actor;
- iter = clutter_actor_get_next_sibling (iter))
- {
- index += 1;
- }
-
- return index;
-}
-
-static AtkStateSet*
-cally_actor_ref_state_set (AtkObject *obj)
-{
- ClutterActor *actor = NULL;
- AtkStateSet *state_set = NULL;
- ClutterStage *stage = NULL;
- ClutterActor *focus_actor = NULL;
- CallyActor *cally_actor = NULL;
-
- g_return_val_if_fail (CALLY_IS_ACTOR (obj), NULL);
- cally_actor = CALLY_ACTOR (obj);
-
- state_set = ATK_OBJECT_CLASS (cally_actor_parent_class)->ref_state_set (obj);
-
- actor = CALLY_GET_CLUTTER_ACTOR (cally_actor);
-
- if (actor == NULL) /* Object is defunct */
- {
- atk_state_set_add_state (state_set, ATK_STATE_DEFUNCT);
- }
- else
- {
- if (clutter_actor_get_reactive (actor))
- {
- atk_state_set_add_state (state_set, ATK_STATE_SENSITIVE);
- atk_state_set_add_state (state_set, ATK_STATE_ENABLED);
- }
-
- if (clutter_actor_is_visible (actor))
- {
- atk_state_set_add_state (state_set, ATK_STATE_VISIBLE);
-
- /* It would be good to also check if the actor is on screen,
- like the old and removed clutter_actor_is_on_stage*/
- if (clutter_actor_get_paint_visibility (actor))
- atk_state_set_add_state (state_set, ATK_STATE_SHOWING);
-
- }
-
- /* See focus section on implementation notes */
- atk_state_set_add_state (state_set, ATK_STATE_FOCUSABLE);
-
- stage = CLUTTER_STAGE (clutter_actor_get_stage (actor));
- if (stage != NULL)
- {
- focus_actor = clutter_stage_get_key_focus (stage);
- if (focus_actor == actor)
- atk_state_set_add_state (state_set, ATK_STATE_FOCUSED);
- }
- }
-
- return state_set;
-}
-
-static gint
-cally_actor_get_n_children (AtkObject *obj)
-{
- ClutterActor *actor = NULL;
-
- g_return_val_if_fail (CALLY_IS_ACTOR (obj), 0);
-
- actor = CALLY_GET_CLUTTER_ACTOR (obj);
-
- if (actor == NULL) /* State is defunct */
- return 0;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), 0);
-
- return clutter_actor_get_n_children (actor);
-}
-
-static AtkObject*
-cally_actor_ref_child (AtkObject *obj,
- gint i)
-{
- ClutterActor *actor = NULL;
- ClutterActor *child = NULL;
-
- g_return_val_if_fail (CALLY_IS_ACTOR (obj), NULL);
-
- actor = CALLY_GET_CLUTTER_ACTOR (obj);
- if (actor == NULL) /* State is defunct */
- return NULL;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), NULL);
-
- if (i >= clutter_actor_get_n_children (actor))
- return NULL;
-
- child = clutter_actor_get_child_at_index (actor, i);
- if (child == NULL)
- return NULL;
-
- return g_object_ref (clutter_actor_get_accessible (child));
-}
-
-static AtkAttributeSet *
-cally_actor_get_attributes (AtkObject *obj)
-{
- AtkAttributeSet *attributes;
- AtkAttribute *toolkit;
-
- toolkit = g_new (AtkAttribute, 1);
- toolkit->name = g_strdup ("toolkit");
- toolkit->value = g_strdup ("clutter");
-
- attributes = g_slist_append (NULL, toolkit);
-
- return attributes;
-}
-
-/* ClutterContainer */
-static gint
-cally_actor_add_actor (ClutterActor *container,
- ClutterActor *actor,
- gpointer data)
-{
- CallyActor *cally_actor = CALLY_ACTOR (data);
- CallyActorClass *klass = NULL;
-
- klass = CALLY_ACTOR_GET_CLASS (cally_actor);
-
- if (klass->add_actor)
- return klass->add_actor (container, actor, data);
- else
- return 1;
-}
-
-static gint
-cally_actor_remove_actor (ClutterActor *container,
- ClutterActor *actor,
- gpointer data)
-{
- CallyActor *cally_actor = CALLY_ACTOR (data);
- CallyActorClass *klass = NULL;
-
- klass = CALLY_ACTOR_GET_CLASS (cally_actor);
-
- if (klass->remove_actor)
- return klass->remove_actor (container, actor, data);
- else
- return 1;
-}
-
-
-static gint
-cally_actor_real_add_actor (ClutterActor *container,
- ClutterActor *actor,
- gpointer data)
-{
- AtkObject *atk_parent = ATK_OBJECT (data);
- AtkObject *atk_child = clutter_actor_get_accessible (actor);
- CallyActor *cally_actor = CALLY_ACTOR (atk_parent);
- CallyActorPrivate *priv = cally_actor->priv;
- gint index;
-
- g_return_val_if_fail (CLUTTER_IS_CONTAINER (container), 0);
- g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), 0);
-
- g_object_notify (G_OBJECT (atk_child), "accessible_parent");
-
- g_list_free (priv->children);
-
- priv->children = clutter_actor_get_children (CLUTTER_ACTOR (container));
-
- index = g_list_index (priv->children, actor);
- g_signal_emit_by_name (atk_parent, "children_changed::add",
- index, atk_child, NULL);
-
- return 1;
-}
-
-static gint
-cally_actor_real_remove_actor (ClutterActor *container,
- ClutterActor *actor,
- gpointer data)
-{
- AtkPropertyValues values = { NULL };
- AtkObject* atk_parent = NULL;
- AtkObject *atk_child = NULL;
- CallyActorPrivate *priv = NULL;
- gint index;
-
- g_return_val_if_fail (CLUTTER_IS_CONTAINER (container), 0);
- g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), 0);
-
- atk_parent = ATK_OBJECT (data);
-
- if (clutter_actor_has_accessible (actor))
- {
- atk_child = clutter_actor_get_accessible (actor);
-
- g_value_init (&values.old_value, G_TYPE_POINTER);
- g_value_set_pointer (&values.old_value, atk_parent);
-
- values.property_name = "accessible-parent";
-
- g_object_ref (atk_child);
- g_signal_emit_by_name (atk_child,
- "property_change::accessible-parent", &values, NULL);
- g_object_unref (atk_child);
- }
-
- priv = CALLY_ACTOR (atk_parent)->priv;
- index = g_list_index (priv->children, actor);
- g_list_free (priv->children);
-
- priv->children = clutter_actor_get_children (CLUTTER_ACTOR (container));
-
- if (index >= 0 && index <= g_list_length (priv->children))
- g_signal_emit_by_name (atk_parent, "children_changed::remove",
- index, atk_child, NULL);
-
- return 1;
-}
-
-/* AtkComponent implementation */
-static void
-cally_actor_component_interface_init (AtkComponentIface *iface)
-{
- g_return_if_fail (iface != NULL);
-
- iface->get_extents = cally_actor_get_extents;
- iface->get_mdi_zorder = cally_actor_get_mdi_zorder;
-
- /* focus management */
- iface->grab_focus = cally_actor_grab_focus;
-}
-
-static void
-cally_actor_get_extents (AtkComponent *component,
- gint *x,
- gint *y,
- gint *width,
- gint *height,
- AtkCoordType coord_type)
-{
- CallyActor *cally_actor = NULL;
- ClutterActor *actor = NULL;
- gint top_level_x, top_level_y;
- gfloat f_width, f_height;
- graphene_point3d_t verts[4];
- ClutterActor *stage = NULL;
-
- g_return_if_fail (CALLY_IS_ACTOR (component));
-
- cally_actor = CALLY_ACTOR (component);
- actor = CALLY_GET_CLUTTER_ACTOR (cally_actor);
-
- if (actor == NULL) /* actor is defunct */
- return;
-
- /* If the actor is not placed in any stage, we can't compute the
- * extents */
- stage = clutter_actor_get_stage (actor);
- if (stage == NULL)
- return;
-
- clutter_actor_get_abs_allocation_vertices (actor, verts);
- clutter_actor_get_transformed_size (actor, &f_width, &f_height);
-
- *x = verts[0].x;
- *y = verts[0].y;
- *width = ceilf (f_width);
- *height = ceilf (f_height);
-
- /* In the ATK_XY_WINDOW case, we consider the stage as the
- * "top-level-window"
- *
- * http://library.gnome.org/devel/atk/stable/AtkUtil.html#AtkCoordType
- */
-
- if (coord_type == ATK_XY_SCREEN)
- {
- _cally_actor_get_top_level_origin (actor, &top_level_x, &top_level_y);
-
- *x += top_level_x;
- *y += top_level_y;
- }
-
- return;
-}
-
-static gint
-cally_actor_get_mdi_zorder (AtkComponent *component)
-{
- CallyActor *cally_actor = NULL;
- ClutterActor *actor = NULL;
-
- g_return_val_if_fail (CALLY_IS_ACTOR (component), G_MININT);
-
- cally_actor = CALLY_ACTOR(component);
- actor = CALLY_GET_CLUTTER_ACTOR (cally_actor);
-
- return clutter_actor_get_z_position (actor);
-}
-
-static gboolean
-cally_actor_grab_focus (AtkComponent *component)
-{
- ClutterActor *actor = NULL;
- ClutterActor *stage = NULL;
- CallyActor *cally_actor = NULL;
-
- g_return_val_if_fail (CALLY_IS_ACTOR (component), FALSE);
-
- /* See focus section on implementation notes */
- cally_actor = CALLY_ACTOR(component);
- actor = CALLY_GET_CLUTTER_ACTOR (cally_actor);
- stage = clutter_actor_get_stage (actor);
-
- clutter_stage_set_key_focus (CLUTTER_STAGE (stage),
- actor);
-
- return TRUE;
-}
-
-/*
- *
- * 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.
- */
-void
-_cally_actor_get_top_level_origin (ClutterActor *actor,
- gint *xp,
- gint *yp)
-{
- /* default values */
- if (xp)
- *xp = 0;
-
- if (yp)
- *yp = 0;
-}
-
-/* AtkAction implementation */
-static void
-cally_actor_action_interface_init (AtkActionIface *iface)
-{
- g_return_if_fail (iface != NULL);
-
- iface->do_action = cally_actor_action_do_action;
- iface->get_n_actions = cally_actor_action_get_n_actions;
- iface->get_description = cally_actor_action_get_description;
- iface->get_keybinding = cally_actor_action_get_keybinding;
- iface->get_name = cally_actor_action_get_name;
- iface->set_description = cally_actor_action_set_description;
-}
-
-static gboolean
-cally_actor_action_do_action (AtkAction *action,
- gint index)
-{
- CallyActor *cally_actor = NULL;
- AtkStateSet *set = NULL;
- CallyActorPrivate *priv = NULL;
- CallyActorActionInfo *info = NULL;
- gboolean did_action = FALSE;
-
- cally_actor = CALLY_ACTOR (action);
- priv = cally_actor->priv;
-
- set = atk_object_ref_state_set (ATK_OBJECT (cally_actor));
-
- if (atk_state_set_contains_state (set, ATK_STATE_DEFUNCT))
- goto out;
-
- if (!atk_state_set_contains_state (set, ATK_STATE_SENSITIVE) ||
- !atk_state_set_contains_state (set, ATK_STATE_SHOWING))
- goto out;
-
- info = _cally_actor_get_action_info (cally_actor, index);
-
- if (info == NULL)
- goto out;
-
- if (info->do_action_func == NULL)
- goto out;
-
- if (!priv->action_queue)
- priv->action_queue = g_queue_new ();
-
- g_queue_push_head (priv->action_queue, info);
-
- if (!priv->action_idle_handler)
- priv->action_idle_handler = g_idle_add (idle_do_action, cally_actor);
-
- did_action = TRUE;
-
-out:
- g_clear_object (&set);
-
- return did_action;
-}
-
-static gboolean
-idle_do_action (gpointer data)
-{
- CallyActor *cally_actor = NULL;
- CallyActorPrivate *priv = NULL;
- ClutterActor *actor = NULL;
-
- cally_actor = CALLY_ACTOR (data);
- priv = cally_actor->priv;
- actor = CALLY_GET_CLUTTER_ACTOR (cally_actor);
- priv->action_idle_handler = 0;
-
- if (actor == NULL) /* state is defunct*/
- return FALSE;
-
- while (!g_queue_is_empty (priv->action_queue))
- {
- CallyActorActionInfo *info = NULL;
-
- info = (CallyActorActionInfo *) g_queue_pop_head (priv->action_queue);
-
- info->do_action_func (cally_actor, info->user_data);
- }
-
- return FALSE;
-}
-
-static gint
-cally_actor_action_get_n_actions (AtkAction *action)
-{
- CallyActor *cally_actor = NULL;
- CallyActorPrivate *priv = NULL;
-
- g_return_val_if_fail (CALLY_IS_ACTOR (action), 0);
-
- cally_actor = CALLY_ACTOR (action);
- priv = cally_actor->priv;
-
- return g_list_length (priv->action_list);
-}
-
-static const gchar*
-cally_actor_action_get_name (AtkAction *action,
- gint i)
-{
- CallyActor *cally_actor = NULL;
- CallyActorActionInfo *info = NULL;
-
- g_return_val_if_fail (CALLY_IS_ACTOR (action), NULL);
- cally_actor = CALLY_ACTOR (action);
- info = _cally_actor_get_action_info (cally_actor, i);
-
- if (info == NULL)
- return NULL;
-
- return info->name;
-}
-
-static const gchar*
-cally_actor_action_get_description (AtkAction *action,
- gint i)
-{
- CallyActor *cally_actor = NULL;
- CallyActorActionInfo *info = NULL;
-
- g_return_val_if_fail (CALLY_IS_ACTOR (action), NULL);
- cally_actor = CALLY_ACTOR (action);
- info = _cally_actor_get_action_info (cally_actor, i);
-
- if (info == NULL)
- return NULL;
-
- return info->description;
-}
-
-static gboolean
-cally_actor_action_set_description (AtkAction *action,
- gint i,
- const gchar *desc)
-{
- CallyActor *cally_actor = NULL;
- CallyActorActionInfo *info = NULL;
-
- g_return_val_if_fail (CALLY_IS_ACTOR (action), FALSE);
- cally_actor = CALLY_ACTOR (action);
- info = _cally_actor_get_action_info (cally_actor, i);
-
- if (info == NULL)
- return FALSE;
-
- g_free (info->description);
- info->description = g_strdup (desc);
-
- return TRUE;
-}
-
-static const gchar*
-cally_actor_action_get_keybinding (AtkAction *action,
- gint i)
-{
- CallyActor *cally_actor = NULL;
- CallyActorActionInfo *info = NULL;
-
- g_return_val_if_fail (CALLY_IS_ACTOR (action), NULL);
- cally_actor = CALLY_ACTOR (action);
- info = _cally_actor_get_action_info (cally_actor, i);
-
- if (info == NULL)
- return NULL;
-
- return info->keybinding;
-}
-
-/* Misc functions */
-
-/*
- * This function is a signal handler for notify signal which gets emitted
- * when a property changes value on the ClutterActor associated with the object.
- *
- * It calls a function for the CallyActor type
- */
-static void
-cally_actor_notify_clutter (GObject *obj,
- GParamSpec *pspec)
-{
- CallyActor *cally_actor = NULL;
- CallyActorClass *klass = NULL;
-
- cally_actor = CALLY_ACTOR (clutter_actor_get_accessible (CLUTTER_ACTOR (obj)));
- klass = CALLY_ACTOR_GET_CLASS (cally_actor);
-
- if (klass->notify_clutter)
- klass->notify_clutter (obj, pspec);
-}
-
-/*
- * This function is a signal handler for notify signal which gets emitted
- * when a property changes value on the ClutterActor associated with a CallyActor
- *
- * It constructs an AtkPropertyValues structure and emits a "property_changed"
- * signal which causes the user specified AtkPropertyChangeHandler
- * to be called.
- */
-static void
-cally_actor_real_notify_clutter (GObject *obj,
- GParamSpec *pspec)
-{
- ClutterActor* actor = CLUTTER_ACTOR (obj);
- AtkObject* atk_obj = clutter_actor_get_accessible (CLUTTER_ACTOR(obj));
- AtkState state;
- gboolean value;
-
- if (g_strcmp0 (pspec->name, "visible") == 0)
- {
- state = ATK_STATE_VISIBLE;
- value = clutter_actor_is_visible (actor);
- }
- else if (g_strcmp0 (pspec->name, "mapped") == 0)
- {
- /* Clones may temporarily map an actor in order to
- * paint it; we don't want this to generate an ATK
- * state change
- */
- if (clutter_actor_is_painting_unmapped (actor))
- return;
-
- state = ATK_STATE_SHOWING;
- value = clutter_actor_is_mapped (actor);
- }
- else if (g_strcmp0 (pspec->name, "reactive") == 0)
- {
- state = ATK_STATE_SENSITIVE;
- value = clutter_actor_get_reactive (actor);
- }
- else
- return;
-
- atk_object_notify_state_change (atk_obj, state, value);
-}
-
-static void
-_cally_actor_clean_action_list (CallyActor *cally_actor)
-{
- CallyActorPrivate *priv = NULL;
-
- priv = cally_actor->priv;
-
- if (priv->action_list)
- {
- g_list_free_full (priv->action_list,
- (GDestroyNotify) _cally_actor_destroy_action_info);
- priv->action_list = NULL;
- }
-}
-
-static CallyActorActionInfo *
-_cally_actor_get_action_info (CallyActor *cally_actor,
- gint index)
-{
- CallyActorPrivate *priv = NULL;
- GList *node = NULL;
-
- g_return_val_if_fail (CALLY_IS_ACTOR (cally_actor), NULL);
-
- priv = cally_actor->priv;
-
- if (priv->action_list == NULL)
- return NULL;
-
- node = g_list_nth (priv->action_list, index);
-
- if (node == NULL)
- return NULL;
-
- return (CallyActorActionInfo *)(node->data);
-}
-
-/**
- * cally_actor_add_action: (skip)
- * @cally_actor: a #CallyActor
- * @action_name: the action name
- * @action_description: the action description
- * @action_keybinding: the action keybinding
- * @action_func: the callback of the action, to be executed with do_action
- *
- * Adds a new action to be accessed with the #AtkAction interface.
- *
- * Return value: added action id, or -1 if failure
- *
- * Since: 1.4
- */
-guint
-cally_actor_add_action (CallyActor *cally_actor,
- const gchar *action_name,
- const gchar *action_description,
- const gchar *action_keybinding,
- CallyActionFunc action_func)
-{
- return cally_actor_add_action_full (cally_actor,
- action_name,
- action_description,
- action_keybinding,
- (CallyActionCallback) action_func,
- NULL, NULL);
-}
-
-/**
- * cally_actor_add_action_full: (rename-to cally_actor_add_action)
- * @cally_actor: a #CallyActor
- * @action_name: the action name
- * @action_description: the action description
- * @action_keybinding: the action keybinding
- * @callback: (scope notified): the callback of the action
- * @user_data: (closure): data to be passed to @callback
- * @notify: function to be called when removing the action
- *
- * Adds a new action to be accessed with the #AtkAction interface.
- *
- * Return value: added action id, or -1 if failure
- *
- * Since: 1.6
- */
-guint
-cally_actor_add_action_full (CallyActor *cally_actor,
- const gchar *action_name,
- const gchar *action_description,
- const gchar *action_keybinding,
- CallyActionCallback callback,
- gpointer user_data,
- GDestroyNotify notify)
-{
- CallyActorActionInfo *info = NULL;
- CallyActorPrivate *priv = NULL;
-
- g_return_val_if_fail (CALLY_IS_ACTOR (cally_actor), -1);
- g_return_val_if_fail (callback != NULL, -1);
-
- priv = cally_actor->priv;
-
- info = g_new0 (CallyActorActionInfo, 1);
- info->name = g_strdup (action_name);
- info->description = g_strdup (action_description);
- info->keybinding = g_strdup (action_keybinding);
- info->do_action_func = callback;
- info->user_data = user_data;
- info->notify = notify;
-
- priv->action_list = g_list_append (priv->action_list, info);
-
- return g_list_length (priv->action_list);
-}
-
-/**
- * cally_actor_remove_action:
- * @cally_actor: a #CallyActor
- * @action_id: the action id
- *
- * Removes a action, using the @action_id returned by cally_actor_add_action()
- *
- * Return value: %TRUE if the operation was successful, %FALSE otherwise
- *
- * Since: 1.4
- */
-gboolean
-cally_actor_remove_action (CallyActor *cally_actor,
- gint action_id)
-{
- GList *list_node = NULL;
- CallyActorPrivate *priv = NULL;
-
- g_return_val_if_fail (CALLY_IS_ACTOR (cally_actor), FALSE);
- priv = cally_actor->priv;
-
- list_node = g_list_nth (priv->action_list, action_id - 1);
-
- if (!list_node)
- return FALSE;
-
- _cally_actor_destroy_action_info (list_node->data, NULL);
-
- priv->action_list = g_list_remove_link (priv->action_list, list_node);
-
- return TRUE;
-}
-
-/**
- * cally_actor_remove_action_by_name:
- * @cally_actor: a #CallyActor
- * @action_name: the name of the action to remove
- *
- * Removes an action, using the @action_name used when the action was added
- * with cally_actor_add_action()
- *
- * Return value: %TRUE if the operation was successful, %FALSE otherwise
- *
- * Since: 1.4
- */
-gboolean
-cally_actor_remove_action_by_name (CallyActor *cally_actor,
- const gchar *action_name)
-{
- GList *node = NULL;
- gboolean action_found = FALSE;
- CallyActorPrivate *priv = NULL;
-
- g_return_val_if_fail (CALLY_IS_ACTOR (cally_actor), FALSE);
- priv = CALLY_ACTOR (cally_actor)->priv;
-
- for (node = priv->action_list; node && !action_found;
- node = node->next)
- {
- CallyActorActionInfo *ainfo = node->data;
-
- if (!g_ascii_strcasecmp (ainfo->name, action_name))
- {
- action_found = TRUE;
- break;
- }
- }
- if (!action_found)
- return FALSE;
-
- _cally_actor_destroy_action_info (node->data, NULL);
- priv->action_list = g_list_remove_link (priv->action_list, node);
-
- return TRUE;
-}
-
-
-static void
-_cally_actor_destroy_action_info (gpointer action_info,
- gpointer user_data)
-{
- CallyActorActionInfo *info = action_info;
-
- g_assert (info != NULL);
-
- g_free (info->name);
- g_free (info->description);
- g_free (info->keybinding);
-
- if (info->notify)
- info->notify (info->user_data);
-
- g_free (info);
-}
diff --git a/clutter/clutter/cally/cally-actor.h b/clutter/clutter/cally/cally-actor.h
deleted file mode 100644
index f67bcafb2..000000000
--- a/clutter/clutter/cally/cally-actor.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/* CALLY - The Clutter Accessibility Implementation Library
- *
- * Copyright (C) 2008 Igalia, S.L.
- *
- * Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
- *
- * Some parts are based on GailWidget from GAIL
- * GAIL - The GNOME Accessibility Implementation Library
- * Copyright 2001, 2002, 2003 Sun Microsystems Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __CALLY_ACTOR_H__
-#define __CALLY_ACTOR_H__
-
-#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <cally/cally.h> can be included directly."
-#endif
-
-#include <atk/atk.h>
-#include <clutter/clutter.h>
-
-G_BEGIN_DECLS
-
-#define CALLY_TYPE_ACTOR (cally_actor_get_type ())
-#define CALLY_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_ACTOR, CallyActor))
-#define CALLY_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_ACTOR, CallyActorClass))
-#define CALLY_IS_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_ACTOR))
-#define CALLY_IS_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_ACTOR))
-#define CALLY_ACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_ACTOR, CallyActorClass))
-
-typedef struct _CallyActor CallyActor;
-typedef struct _CallyActorClass CallyActorClass;
-typedef struct _CallyActorPrivate CallyActorPrivate;
-
-/**
- * CallyActionFunc:
- * @cally_actor: a #CallyActor
- *
- * Action function, to be used on #AtkAction implementations as a individual
- * action
- *
- * Since: 1.4
- */
-typedef void (* CallyActionFunc) (CallyActor *cally_actor);
-
-/**
- * CallyActionCallback:
- * @cally_actor: a #CallyActor
- * @user_data: user data passed to the function
- *
- * Action function, to be used on #AtkAction implementations as
- * an individual action. Unlike #CallyActionFunc, this function
- * uses the @user_data argument passed to cally_actor_add_action_full().
- *
- * Since: 1.6
- */
-typedef void (* CallyActionCallback) (CallyActor *cally_actor,
- gpointer user_data);
-
-/**
- * CallyActor:
- *
- * The <structname>CallyActor</structname> structure contains only private
- * data and should be accessed using the provided API
- *
- * Since: 1.4
- */
-struct _CallyActor
-{
- /*< private >*/
- AtkGObjectAccessible parent;
-
- CallyActorPrivate *priv;
-};
-
-/**
- * CallyActorClass:
- * @notify_clutter: Signal handler for notify signal on Clutter actor
- * @focus_clutter: Signal handler for key-focus-in and key-focus-out
- * signal on Clutter actor. This virtual functions is deprecated.
- * @add_actor: Signal handler for actor-added signal on
- * ClutterContainer interface
- * @remove_actor: Signal handler for actor-added signal on
- * ClutterContainer interface
- *
- * The <structname>CallyActorClass</structname> structure contains
- * only private data
- *
- * Since: 1.4
- */
-struct _CallyActorClass
-{
- /*< private >*/
- AtkGObjectAccessibleClass parent_class;
-
- /*< public >*/
- void (*notify_clutter) (GObject *object,
- GParamSpec *pspec);
-
- gboolean (*focus_clutter) (ClutterActor *actor,
- gpointer data);
-
- gint (*add_actor) (ClutterActor *container,
- ClutterActor *actor,
- gpointer data);
-
- gint (*remove_actor) (ClutterActor *container,
- ClutterActor *actor,
- gpointer data);
-
- /*< private >*/
- /* padding for future expansion */
- gpointer _padding_dummy[32];
-};
-
-CLUTTER_EXPORT
-GType cally_actor_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-AtkObject* cally_actor_new (ClutterActor *actor);
-
-CLUTTER_EXPORT
-guint cally_actor_add_action (CallyActor *cally_actor,
- const gchar *action_name,
- const gchar *action_description,
- const gchar *action_keybinding,
- CallyActionFunc action_func);
-CLUTTER_EXPORT
-guint cally_actor_add_action_full (CallyActor *cally_actor,
- const gchar *action_name,
- const gchar *action_description,
- const gchar *action_keybinding,
- CallyActionCallback callback,
- gpointer user_data,
- GDestroyNotify notify);
-
-CLUTTER_EXPORT
-gboolean cally_actor_remove_action (CallyActor *cally_actor,
- gint action_id);
-
-CLUTTER_EXPORT
-gboolean cally_actor_remove_action_by_name (CallyActor *cally_actor,
- const gchar *action_name);
-
-G_END_DECLS
-
-#endif /* __CALLY_ACTOR_H__ */
diff --git a/clutter/clutter/cally/cally-clone.c b/clutter/clutter/cally/cally-clone.c
deleted file mode 100644
index f1832a50d..000000000
--- a/clutter/clutter/cally/cally-clone.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/* CALLY - The Clutter Accessibility Implementation Library
- *
- * Copyright (C) 2010 Igalia, S.L.
- *
- * Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:cally-clone
- * @Title: CallyClone
- * @short_description: Implementation of the ATK interfaces for a #ClutterClone
- * @see_also: #ClutterClone
- *
- * #CallyClone implements the required ATK interfaces of #ClutterClone
- *
- * In particular it sets a proper role for the clone, as just a image,
- * as it is the sanest and simplest approach.
- */
-
-/* Design rationale for CallyClone:
- *
- * In the old times, it was just ClutterCloneTexture. So, from a a11y POV
- * CallyCloneTexture was just another image, like ClutterTexture, and if
- * it was a clone was irrevelant. So on cally-0.8, CallyCloneTexture
- * expose a object with role ATK_ROLE_IMAGE. But now, ClutterClone is more
- * general. You can clone any object, including groups, and made things
- * like have one text entry, and a clone with different properties in the
- * same window, updated both at once.
- *
- * The question is if the idea is have a ClutterClone as a "first-class"
- * citizen inside the stage hierarchy (full clone), or it is just supposed
- * to be a mirror image of the original object.
- *
- * In the case of the a11y POV this would mean that if the text changes on
- * the source, the clone should emit as well the text-changing signals.
- *
- * As ClutterClone smartly just paint the same object with different
- * parameters, this would mean that it should be the cally object the one
- * that should replicate the source clutter hierarchy to do that,
- * something that just sound crazy.
- *
- * Taking into account that:
- *
- * - ClutterClone doesn't re-emit mirrored signals from the source
- * I think that likely the answer would be "yes, it is just a
- * mirrored image, not a real full clone".
- *
- * - You can't interact directly with the clone (ie: focus, and so on).
- * Its basic usage (right now) is clone textures.
- *
- * Any other solution could be overwhelming.
- *
- * I think that the final solution would be that ClutterClone from the
- * a11y POV should still be managed as a image (with the proper properties,
- * position, size, etc.).
- */
-#include "clutter-build-config.h"
-
-#include "cally-clone.h"
-#include "cally-actor-private.h"
-
-/* AtkObject */
-static void cally_clone_real_initialize (AtkObject *obj,
- gpointer data);
-
-G_DEFINE_TYPE (CallyClone, cally_clone, CALLY_TYPE_ACTOR)
-
-static void
-cally_clone_class_init (CallyCloneClass *klass)
-{
-/* GObjectClass *gobject_class = G_OBJECT_CLASS (klass); */
- AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
-
- class->initialize = cally_clone_real_initialize;
-}
-
-static void
-cally_clone_init (CallyClone *clone)
-{
- /* nothing to do yet */
-}
-
-/**
- * cally_clone_new:
- * @actor: a #ClutterActor
- *
- * Creates a new #CallyClone for the given @actor. @actor must be a
- * #ClutterClone.
- *
- * Return value: the newly created #AtkObject
- *
- * Since: 1.4
- */
-AtkObject*
-cally_clone_new (ClutterActor *actor)
-{
- GObject *object = NULL;
- AtkObject *accessible = NULL;
-
- g_return_val_if_fail (CLUTTER_IS_CLONE (actor), NULL);
-
- object = g_object_new (CALLY_TYPE_CLONE, NULL);
-
- accessible = ATK_OBJECT (object);
- atk_object_initialize (accessible, actor);
-
- return accessible;
-}
-
-static void
-cally_clone_real_initialize (AtkObject *obj,
- gpointer data)
-{
- ATK_OBJECT_CLASS (cally_clone_parent_class)->initialize (obj, data);
-
- obj->role = ATK_ROLE_IMAGE;
-}
diff --git a/clutter/clutter/cally/cally-clone.h b/clutter/clutter/cally/cally-clone.h
deleted file mode 100644
index 24b0def86..000000000
--- a/clutter/clutter/cally/cally-clone.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* CALLY - The Clutter Accessibility Implementation Library
- *
- * Copyright (C) 2010 Igalia, S.L.
- *
- * Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __CALLY_CLONE_H__
-#define __CALLY_CLONE_H__
-
-#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <cally/cally.h> can be included directly."
-#endif
-
-#include <clutter/clutter.h>
-#include <cally/cally-actor.h>
-
-G_BEGIN_DECLS
-
-#define CALLY_TYPE_CLONE (cally_clone_get_type ())
-#define CALLY_CLONE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_CLONE, CallyClone))
-#define CALLY_CLONE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_CLONE, CallyCloneClass))
-#define CALLY_IS_CLONE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_CLONE))
-#define CALLY_IS_CLONE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_CLONE))
-#define CALLY_CLONE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_CLONE, CallyCloneClass))
-
-typedef struct _CallyClone CallyClone;
-typedef struct _CallyCloneClass CallyCloneClass;
-typedef struct _CallyClonePrivate CallyClonePrivate;
-
-/**
- * CallyClone:
- *
- * The <structname>CallyClone</structname> structure contains only private
- * data and should be accessed using the provided API
- *
- * Since: 1.4
- */
-struct _CallyClone
-{
- /*< private >*/
- CallyActor parent;
-
- CallyClonePrivate *priv;
-};
-
-/**
- * CallyCloneClass:
- *
- * The <structname>CallyCloneClass</structname> structure contains only
- * private data
- *
- * Since: 1.4
- */
-struct _CallyCloneClass
-{
- /*< private >*/
- CallyActorClass parent_class;
-
- /* padding for future expansion */
- gpointer _padding_dummy[8];
-};
-
-CLUTTER_EXPORT
-GType cally_clone_get_type (void) G_GNUC_CONST;
-CLUTTER_EXPORT
-AtkObject *cally_clone_new (ClutterActor *actor);
-
-G_END_DECLS
-
-#endif /* __CALLY_CLONE_H__ */
diff --git a/clutter/clutter/cally/cally-factory.h b/clutter/clutter/cally/cally-factory.h
deleted file mode 100644
index 432844fb6..000000000
--- a/clutter/clutter/cally/cally-factory.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/* CALLY - The Clutter Accessibility Implementation Library
- *
- * Copyright (C) 2008 Igalia, S.L.
- *
- * Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
- *
- * Based on gailfactory.h from GAIL
- * Copyright 2001, 2002, 2003 Sun Microsystems Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef _CALLY_FACTORY_H__
-#define _CALLY_FACTORY_H__
-
-#include <glib-object.h>
-#include <atk/atkobject.h>
-
-/**
- * CALLY_ACCESSIBLE_FACTORY:
- * @type: GType of the accessible which is created by the factory
- * @type_as_function: prefix of the accessible object methods
- * @opt_create_accessible: method to instantiate the accessibility object
- *
- * Defines a new #AtkObjectFactory factory to create accessible
- * objects of a specific GType. It defines the factory GType and also
- * overrides the proper #AtkObjectFactory methods.
- *
- * It assumes that the accessibility object provides a
- * @opt_create_accessible method in order to create the accessibility
- * object. It returns a @type GType object.
- *
- * Since: 1.4
- */
-#define CALLY_ACCESSIBLE_FACTORY(type, type_as_function, opt_create_accessible) \
- \
-static GType \
-type_as_function ## _factory_get_accessible_type (void) \
-{ \
- return type; \
-} \
- \
-static AtkObject* \
-type_as_function ## _factory_create_accessible (GObject *obj) \
-{ \
- ClutterActor *actor; \
- AtkObject *accessible; \
- \
- g_return_val_if_fail (CLUTTER_ACTOR (obj), NULL); \
- \
- actor = CLUTTER_ACTOR (obj); \
- \
- accessible = opt_create_accessible (actor); \
- \
- return accessible; \
-} \
- \
-static void \
-type_as_function ## _factory_class_init (AtkObjectFactoryClass *klass) \
-{ \
- klass->create_accessible = type_as_function ## _factory_create_accessible; \
- klass->get_accessible_type = type_as_function ## _factory_get_accessible_type;\
-} \
- \
-static GType \
-type_as_function ## _factory_get_type (void) \
-{ \
- static GType t = 0; \
- \
- if (!t) \
- { \
- char *name; \
- static const GTypeInfo tinfo = \
- { \
- sizeof (AtkObjectFactoryClass), \
- NULL, NULL, (GClassInitFunc) type_as_function ## _factory_class_init, \
- NULL, NULL, sizeof (AtkObjectFactory), 0, NULL, NULL \
- }; \
- \
- name = g_strconcat (g_type_name (type), "Factory", NULL); \
- t = g_type_register_static ( \
- ATK_TYPE_OBJECT_FACTORY, name, &tinfo, 0); \
- g_free (name); \
- } \
- \
- return t; \
-}
-
-/**
- * CALLY_ACTOR_SET_FACTORY:
- * @widget_type: GType of the clutter actor
- * @type_as_function: prefix of the accessible object methods
- *
- * Sets the #AtkObjectFactory to be used in order to instantiate
- * accessibility objects for the actor which GType is @widget_type.
- *
- * Since: 1.4
- */
-#define CALLY_ACTOR_SET_FACTORY(widget_type, type_as_function) \
- atk_registry_set_factory_type (atk_get_default_registry (), \
- widget_type, \
- type_as_function ## _factory_get_type ())
-
-#endif /* _CALLY_FACTORY_H__ */
diff --git a/clutter/clutter/cally/cally-main.h b/clutter/clutter/cally/cally-main.h
deleted file mode 100644
index 07d668b03..000000000
--- a/clutter/clutter/cally/cally-main.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* CALLY - The Clutter Accessibility Implementation Library
- *
- * Copyright (C) 2008 Igalia, S.L.
- *
- * Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
- *
- * Some parts are based on GailWidget from GAIL
- * GAIL - The GNOME Accessibility Implementation Library
- * Copyright 2001, 2002, 2003 Sun Microsystems Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __CALLY_MAIN_H__
-#define __CALLY_MAIN_H__
-
-#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <cally/cally.h> can be included directly."
-#endif
-
-#include <glib.h>
-#include <atk/atk.h>
-
-G_BEGIN_DECLS
-
-CLUTTER_EXPORT
-gboolean cally_get_cally_initialized (void);
-CLUTTER_EXPORT
-gboolean cally_accessibility_init (void);
-
-G_END_DECLS
-
-#endif /* __CALLY_MAIN_H__ */
diff --git a/clutter/clutter/cally/cally-root.c b/clutter/clutter/cally/cally-root.c
deleted file mode 100644
index 34473fcd7..000000000
--- a/clutter/clutter/cally/cally-root.c
+++ /dev/null
@@ -1,292 +0,0 @@
-/* CALLY - The Clutter Accessibility Implementation Library
- *
- * Copyright (C) 2008 Igalia, S.L.
- *
- * Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:cally-root
- * @short_description: Root object for the Cally toolkit
- * @see_also: #ClutterStage
- *
- * #CallyRoot is the root object of the accessibility tree-like
- * hierarchy, exposing the application level.
- *
- * Somewhat equivalent to #GailTopLevel. We consider that this class
- * expose the a11y information of the #ClutterStageManager, as the
- * children of this object are the different ClutterStage managed (so
- * the #GObject used in the atk_object_initialize() is the
- * #ClutterStageManager).
- */
-
-#include "clutter-build-config.h"
-
-#include "cally-root.h"
-
-#include "clutter-actor.h"
-#include "clutter-stage-private.h"
-#include "clutter-stage-manager.h"
-
-
-/* GObject */
-static void cally_root_finalize (GObject *object);
-
-/* AtkObject.h */
-static void cally_root_initialize (AtkObject *accessible,
- gpointer data);
-static gint cally_root_get_n_children (AtkObject *obj);
-static AtkObject * cally_root_ref_child (AtkObject *obj,
- gint i);
-static AtkObject * cally_root_get_parent (AtkObject *obj);
-static const char * cally_root_get_name (AtkObject *obj);
-
-/* Private */
-static void cally_util_stage_added_cb (ClutterStageManager *stage_manager,
- ClutterStage *stage,
- gpointer data);
-static void cally_util_stage_removed_cb (ClutterStageManager *stage_manager,
- ClutterStage *stage,
- gpointer data);
-
-struct _CallyRootPrivate
-{
-/* We save the CallyStage objects. Other option could save the stage
- * list, and then just get the a11y object on the ref_child, etc. But
- * the ref_child is more common that the init and the stage-add,
- * stage-remove, so we avoid getting the accessible object
- * constantly
- */
- GSList *stage_list;
-
- /* signals id */
- gulong stage_added_id;
- gulong stage_removed_id;
-};
-
-G_DEFINE_TYPE_WITH_PRIVATE (CallyRoot, cally_root, ATK_TYPE_GOBJECT_ACCESSIBLE)
-
-static void
-cally_root_class_init (CallyRootClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
-
- gobject_class->finalize = cally_root_finalize;
-
- /* AtkObject */
- class->get_n_children = cally_root_get_n_children;
- class->ref_child = cally_root_ref_child;
- class->get_parent = cally_root_get_parent;
- class->initialize = cally_root_initialize;
- class->get_name = cally_root_get_name;
-}
-
-static void
-cally_root_init (CallyRoot *root)
-{
- root->priv = cally_root_get_instance_private (root);
-
- root->priv->stage_list = NULL;
- root->priv->stage_added_id = 0;
- root->priv->stage_removed_id = 0;
-}
-
-/**
- * cally_root_new:
- *
- * Creates a new #CallyRoot object.
- *
- * Return value: the newly created #AtkObject
- *
- * Since: 1.4
- */
-AtkObject*
-cally_root_new (void)
-{
- GObject *object = NULL;
- AtkObject *accessible = NULL;
- ClutterStageManager *stage_manager = NULL;
-
- object = g_object_new (CALLY_TYPE_ROOT, NULL);
-
- accessible = ATK_OBJECT (object);
- stage_manager = clutter_stage_manager_get_default ();
-
- atk_object_initialize (accessible, stage_manager);
-
- return accessible;
-}
-
-static void
-cally_root_finalize (GObject *object)
-{
- CallyRoot *root = CALLY_ROOT (object);
- GObject *stage_manager = NULL;
-
- g_return_if_fail (CALLY_IS_ROOT (object));
-
- if (root->priv->stage_list)
- {
- g_slist_free (root->priv->stage_list);
- root->priv->stage_list = NULL;
- }
-
- stage_manager = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (root));
-
- g_clear_signal_handler (&root->priv->stage_added_id, stage_manager);
-
- g_clear_signal_handler (&root->priv->stage_removed_id, stage_manager);
-
- G_OBJECT_CLASS (cally_root_parent_class)->finalize (object);
-}
-
-/* AtkObject.h */
-static void
-cally_root_initialize (AtkObject *accessible,
- gpointer data)
-{
- ClutterStageManager *stage_manager = NULL;
- const GSList *iter = NULL;
- const GSList *stage_list = NULL;
- ClutterStage *clutter_stage = NULL;
- AtkObject *cally_stage = NULL;
- CallyRoot *root = NULL;
-
- accessible->role = ATK_ROLE_APPLICATION;
- accessible->accessible_parent = NULL;
-
- /* children initialization */
- root = CALLY_ROOT (accessible);
- stage_manager = CLUTTER_STAGE_MANAGER (data);
- stage_list = clutter_stage_manager_peek_stages (stage_manager);
-
- for (iter = stage_list; iter != NULL; iter = g_slist_next (iter))
- {
- clutter_stage = CLUTTER_STAGE (iter->data);
- cally_stage = clutter_actor_get_accessible (CLUTTER_ACTOR (clutter_stage));
-
- atk_object_set_parent (cally_stage, ATK_OBJECT (root));
-
- root->priv->stage_list = g_slist_append (root->priv->stage_list,
- cally_stage);
- }
-
- root->priv->stage_added_id =
- g_signal_connect (G_OBJECT (stage_manager), "stage-added",
- G_CALLBACK (cally_util_stage_added_cb), root);
-
- root->priv->stage_removed_id =
- g_signal_connect (G_OBJECT (stage_manager), "stage-removed",
- G_CALLBACK (cally_util_stage_removed_cb), root);
-
- ATK_OBJECT_CLASS (cally_root_parent_class)->initialize (accessible, data);
-}
-
-
-static gint
-cally_root_get_n_children (AtkObject *obj)
-{
- CallyRoot *root = CALLY_ROOT (obj);
-
- return g_slist_length (root->priv->stage_list);
-}
-
-static AtkObject*
-cally_root_ref_child (AtkObject *obj,
- gint i)
-{
- CallyRoot *cally_root = NULL;
- GSList *stage_list = NULL;
- gint num = 0;
- AtkObject *item = NULL;
-
- cally_root = CALLY_ROOT (obj);
- stage_list = cally_root->priv->stage_list;
- num = g_slist_length (stage_list);
-
- g_return_val_if_fail ((i < num)&&(i >= 0), NULL);
-
- item = g_slist_nth_data (stage_list, i);
- if (!item)
- {
- return NULL;
- }
-
- g_object_ref (item);
-
- return item;
-}
-
-static AtkObject*
-cally_root_get_parent (AtkObject *obj)
-{
- return NULL;
-}
-
-static const char *
-cally_root_get_name (AtkObject *obj)
-{
- return g_get_prgname ();
-}
-
-/* -------------------------------- PRIVATE --------------------------------- */
-
-static void
-cally_util_stage_added_cb (ClutterStageManager *stage_manager,
- ClutterStage *stage,
- gpointer data)
-{
- CallyRoot *root = CALLY_ROOT (data);
- AtkObject *cally_stage = NULL;
- gint index = -1;
-
- cally_stage = clutter_actor_get_accessible (CLUTTER_ACTOR (stage));
-
- atk_object_set_parent (cally_stage, ATK_OBJECT (root));
-
- root->priv->stage_list = g_slist_append (root->priv->stage_list,
- cally_stage);
-
- index = g_slist_index (root->priv->stage_list, cally_stage);
- g_signal_emit_by_name (root, "children_changed::add",
- index, cally_stage, NULL);
- g_signal_emit_by_name (cally_stage, "create", 0);
-}
-
-static void
-cally_util_stage_removed_cb (ClutterStageManager *stage_manager,
- ClutterStage *stage,
- gpointer data)
-{
- CallyRoot *root = CALLY_ROOT (data);
- AtkObject *cally_stage = NULL;
- gint index = -1;
-
- cally_stage = clutter_actor_get_accessible (CLUTTER_ACTOR (stage));
-
- index = g_slist_index (root->priv->stage_list, cally_stage);
-
- root->priv->stage_list = g_slist_remove (root->priv->stage_list,
- cally_stage);
-
- index = g_slist_index (root->priv->stage_list, cally_stage);
- g_signal_emit_by_name (root, "children_changed::remove",
- index, cally_stage, NULL);
- g_signal_emit_by_name (cally_stage, "destroy", 0);
-}
diff --git a/clutter/clutter/cally/cally-root.h b/clutter/clutter/cally/cally-root.h
deleted file mode 100644
index 16bba36ef..000000000
--- a/clutter/clutter/cally/cally-root.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* CALLY - The Clutter Accessibility Implementation Library
- *
- * Copyright (C) 2009 Igalia, S.L.
- *
- * Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __CALLY_ROOT_H__
-#define __CALLY_ROOT_H__
-
-#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <cally/cally.h> can be included directly."
-#endif
-
-#include <atk/atk.h>
-#include <clutter/clutter.h>
-
-G_BEGIN_DECLS
-
-#define CALLY_TYPE_ROOT (cally_root_get_type ())
-#define CALLY_ROOT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_ROOT, CallyRoot))
-#define CALLY_ROOT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_ROOT, CallyRootClass))
-#define CALLY_IS_ROOT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_ROOT))
-#define CALLY_IS_ROOT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_ROOT))
-#define CALLY_ROOT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_ROOT, CallyRootClass))
-
-typedef struct _CallyRoot CallyRoot;
-typedef struct _CallyRootClass CallyRootClass;
-typedef struct _CallyRootPrivate CallyRootPrivate;
-
-/**
- * CallyRoot:
- *
- * The <structname>CallyRoot</structname> structure contains only private
- * data and should be accessed using the provided API
- *
- * Since: 1.4
- */
-struct _CallyRoot
-{
- /*< private >*/
- AtkGObjectAccessible parent;
-
- CallyRootPrivate *priv;
-};
-
-/**
- * CallyRootClass:
- *
- * The <structname>CallyRootClass</structname> structure contains only
- * private data
- *
- * Since: 1.4
- */
-struct _CallyRootClass
-{
- /*< private >*/
- AtkGObjectAccessibleClass parent_class;
-
- /* padding for future expansion */
- gpointer _padding_dummy[16];
-};
-
-CLUTTER_EXPORT
-GType cally_root_get_type (void) G_GNUC_CONST;
-CLUTTER_EXPORT
-AtkObject *cally_root_new (void);
-
-G_END_DECLS
-
-#endif /* __CALLY_ROOT_H__ */
diff --git a/clutter/clutter/cally/cally-stage.c b/clutter/clutter/cally/cally-stage.c
deleted file mode 100644
index c00ada46e..000000000
--- a/clutter/clutter/cally/cally-stage.c
+++ /dev/null
@@ -1,266 +0,0 @@
-/* CALLY - The Clutter Accessibility Implementation Library
- *
- * Copyright (C) 2008 Igalia, S.L.
- *
- * Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:cally-stage
- * @Title: CallyStage
- * @short_description: Implementation of the ATK interfaces for a #ClutterStage
- * @see_also: #ClutterStage
- *
- * #CallyStage implements the required ATK interfaces for #ClutterStage
- *
- * Some implementation details: at this moment #CallyStage is used as
- * the most similar Window object in this toolkit (ie: emitting window
- * related signals), although the real purpose of #ClutterStage is
- * being a canvas. Anyway, this is required for applications using
- * just clutter, or directly #ClutterStage
- */
-#include "clutter-build-config.h"
-
-#include "cally-stage.h"
-#include "cally-actor-private.h"
-
-/* AtkObject.h */
-static void cally_stage_real_initialize (AtkObject *obj,
- gpointer data);
-static AtkStateSet* cally_stage_ref_state_set (AtkObject *obj);
-
-/* AtkWindow */
-static void cally_stage_window_interface_init (AtkWindowIface *iface);
-
-/* Auxiliary */
-static void cally_stage_activate_cb (ClutterStage *stage,
- gpointer data);
-static void cally_stage_deactivate_cb (ClutterStage *stage,
- gpointer data);
-
-struct _CallyStagePrivate
-{
- /* NULL means that the stage will receive the focus */
- ClutterActor *key_focus;
-
- gboolean active;
-};
-
-G_DEFINE_TYPE_WITH_CODE (CallyStage,
- cally_stage,
- CALLY_TYPE_ACTOR,
- G_ADD_PRIVATE (CallyStage)
- G_IMPLEMENT_INTERFACE (ATK_TYPE_WINDOW,
- cally_stage_window_interface_init));
-
-static void
-cally_stage_class_init (CallyStageClass *klass)
-{
- AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
-
- /* AtkObject */
- class->initialize = cally_stage_real_initialize;
- class->ref_state_set = cally_stage_ref_state_set;
-}
-
-static void
-cally_stage_init (CallyStage *cally_stage)
-{
- CallyStagePrivate *priv = cally_stage_get_instance_private (cally_stage);
-
- cally_stage->priv = priv;
-
- priv->active = FALSE;
-}
-
-/**
- * cally_stage_new:
- * @actor: a #ClutterActor
- *
- * Creates a new #CallyStage for the given @actor. @actor should be a
- * #ClutterStage.
- *
- * Return value: the newly created #AtkObject
- *
- * Since: 1.4
- */
-AtkObject*
-cally_stage_new (ClutterActor *actor)
-{
- GObject *object = NULL;
- AtkObject *accessible = NULL;
-
- g_return_val_if_fail (CLUTTER_IS_STAGE (actor), NULL);
-
- object = g_object_new (CALLY_TYPE_STAGE, NULL);
-
- accessible = ATK_OBJECT (object);
- atk_object_initialize (accessible, actor);
-
- return accessible;
-}
-
-static void
-cally_stage_notify_key_focus_cb (ClutterStage *stage,
- GParamSpec *pspec,
- CallyStage *self)
-{
- ClutterActor *key_focus = NULL;
- AtkObject *new = NULL;
-
- if (self->priv->active == FALSE)
- return;
-
- key_focus = clutter_stage_get_key_focus (stage);
-
- if (key_focus != self->priv->key_focus)
- {
- AtkObject *old = NULL;
-
- if (self->priv->key_focus != NULL)
- {
- if (self->priv->key_focus != CLUTTER_ACTOR (stage))
- {
- g_object_remove_weak_pointer (G_OBJECT (self->priv->key_focus),
- (gpointer *) &self->priv->key_focus);
- }
- old = clutter_actor_get_accessible (self->priv->key_focus);
- }
- else
- old = clutter_actor_get_accessible (CLUTTER_ACTOR (stage));
-
- atk_object_notify_state_change (old,
- ATK_STATE_FOCUSED,
- FALSE);
- }
-
- /* we keep notifying the focus gain without checking previous
- * key-focus to avoid some missing events due timing
- */
- self->priv->key_focus = key_focus;
-
- if (key_focus != NULL)
- {
- /* ensure that if the key focus goes away, the field inside
- * CallyStage is reset. see bug:
- *
- * https://bugzilla.gnome.org/show_bug.cgi?id=692706
- *
- * we remove the weak pointer above.
- */
- if (key_focus != CLUTTER_ACTOR (stage))
- {
- g_object_add_weak_pointer (G_OBJECT (self->priv->key_focus),
- (gpointer *) &self->priv->key_focus);
- }
-
- new = clutter_actor_get_accessible (key_focus);
- }
- else
- new = clutter_actor_get_accessible (CLUTTER_ACTOR (stage));
-
- atk_object_notify_state_change (new,
- ATK_STATE_FOCUSED,
- TRUE);
-}
-
-static void
-cally_stage_real_initialize (AtkObject *obj,
- gpointer data)
-{
- ClutterStage *stage = NULL;
-
- g_return_if_fail (CALLY_IS_STAGE (obj));
-
- ATK_OBJECT_CLASS (cally_stage_parent_class)->initialize (obj, data);
-
- stage = CLUTTER_STAGE (CALLY_GET_CLUTTER_ACTOR (obj));
-
- g_signal_connect (stage, "activate", G_CALLBACK (cally_stage_activate_cb), obj);
- g_signal_connect (stage, "deactivate", G_CALLBACK (cally_stage_deactivate_cb), obj);
- g_signal_connect (stage, "notify::key-focus",
- G_CALLBACK (cally_stage_notify_key_focus_cb), obj);
-
- atk_object_set_role (obj, ATK_ROLE_WINDOW);
-}
-
-static AtkStateSet*
-cally_stage_ref_state_set (AtkObject *obj)
-{
- CallyStage *cally_stage = NULL;
- AtkStateSet *state_set = NULL;
- ClutterStage *stage = NULL;
-
- g_return_val_if_fail (CALLY_IS_STAGE (obj), NULL);
- cally_stage = CALLY_STAGE (obj);
-
- state_set = ATK_OBJECT_CLASS (cally_stage_parent_class)->ref_state_set (obj);
- stage = CLUTTER_STAGE (CALLY_GET_CLUTTER_ACTOR (cally_stage));
-
- if (stage == NULL)
- return state_set;
-
- if (cally_stage->priv->active)
- atk_state_set_add_state (state_set, ATK_STATE_ACTIVE);
-
- return state_set;
-}
-
-/* AtkWindow */
-static void
-cally_stage_window_interface_init (AtkWindowIface *iface)
-{
- /* At this moment AtkWindow is just about signals */
-}
-
-/* Auxiliary */
-static void
-cally_stage_activate_cb (ClutterStage *stage,
- gpointer data)
-{
- CallyStage *cally_stage = NULL;
-
- g_return_if_fail (CALLY_IS_STAGE (data));
-
- cally_stage = CALLY_STAGE (data);
-
- cally_stage->priv->active = TRUE;
-
- atk_object_notify_state_change (ATK_OBJECT (cally_stage),
- ATK_STATE_ACTIVE, TRUE);
-
- g_signal_emit_by_name (cally_stage, "activate", 0);
-}
-
-static void
-cally_stage_deactivate_cb (ClutterStage *stage,
- gpointer data)
-{
- CallyStage *cally_stage = NULL;
-
- g_return_if_fail (CALLY_IS_STAGE (data));
-
- cally_stage = CALLY_STAGE (data);
-
- cally_stage->priv->active = FALSE;
-
- atk_object_notify_state_change (ATK_OBJECT (cally_stage),
- ATK_STATE_ACTIVE, FALSE);
-
- g_signal_emit_by_name (cally_stage, "deactivate", 0);
-}
diff --git a/clutter/clutter/cally/cally-stage.h b/clutter/clutter/cally/cally-stage.h
deleted file mode 100644
index 576ba6b81..000000000
--- a/clutter/clutter/cally/cally-stage.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* CALLY - The Clutter Accessibility Implementation Library
- *
- * Copyright (C) 2008 Igalia, S.L.
- *
- * Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __CALLY_STAGE_H__
-#define __CALLY_STAGE_H__
-
-#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <cally/cally.h> can be included directly."
-#endif
-
-#include <cally/cally-actor.h>
-#include <clutter/clutter.h>
-
-G_BEGIN_DECLS
-
-#define CALLY_TYPE_STAGE (cally_stage_get_type ())
-#define CALLY_STAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_STAGE, CallyStage))
-#define CALLY_STAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_STAGE, CallyStageClass))
-#define CALLY_IS_STAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_STAGE))
-#define CALLY_IS_STAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_STAGE))
-#define CALLY_STAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_STAGE, CallyStageClass))
-
-typedef struct _CallyStage CallyStage;
-typedef struct _CallyStageClass CallyStageClass;
-typedef struct _CallyStagePrivate CallyStagePrivate;
-
-/**
- * CallyStage:
- *
- * The <structname>CallyStage</structname> structure contains only
- * private data and should be accessed using the provided API
- *
- * Since: 1.4
- */
-struct _CallyStage
-{
- /*< private >*/
- CallyActor parent;
-
- CallyStagePrivate *priv;
-};
-
-/**
- * CallyStageClass:
- *
- * The <structname>CallyStageClass</structname> structure contains only
- * private data
- *
- * Since: 1.4
- */
-struct _CallyStageClass
-{
- /*< private >*/
- CallyActorClass parent_class;
-
- /* padding for future expansion */
- gpointer _padding_dummy[16];
-};
-
-CLUTTER_EXPORT
-GType cally_stage_get_type (void) G_GNUC_CONST;
-CLUTTER_EXPORT
-AtkObject *cally_stage_new (ClutterActor *actor);
-
-G_END_DECLS
-
-#endif /* __CALLY_STAGE_H__ */
diff --git a/clutter/clutter/cally/cally-text.c b/clutter/clutter/cally/cally-text.c
deleted file mode 100644
index fe4abb710..000000000
--- a/clutter/clutter/cally/cally-text.c
+++ /dev/null
@@ -1,2328 +0,0 @@
-/* CALLY - The Clutter Accessibility Implementation Library
- *
- * Copyright (C) 2009 Igalia, S.L.
- *
- * Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
- *
- * Some parts are based on GailLabel, GailEntry, GailTextView from GAIL
- * GAIL - The GNOME Accessibility Implementation Library
- * Copyright 2001, 2002, 2003 Sun Microsystems Inc.
- *
- * Implementation of atk_text_get_text_[before/at/after]_offset
- * copied from gtkpango.c, part of GTK+ project
- * Copyright (c) 2010 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, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:cally-text
- * @short_description: Implementation of the ATK interfaces for a #ClutterText
- * @see_also: #ClutterText
- *
- * #CallyText implements the required ATK interfaces of
- * #ClutterText, #AtkText and #AtkEditableText
- *
- *
- */
-
-#include "clutter-build-config.h"
-
-#include "cally-text.h"
-#include "cally-actor-private.h"
-
-#include "clutter-color.h"
-#include "clutter-main.h"
-#include "clutter-text.h"
-
-static void cally_text_finalize (GObject *obj);
-
-/* AtkObject */
-static void cally_text_real_initialize (AtkObject *obj,
- gpointer data);
-static AtkStateSet* cally_text_ref_state_set (AtkObject *obj);
-
-/* atkaction */
-
-static void _cally_text_activate_action (CallyActor *cally_actor);
-static void _check_activate_action (CallyText *cally_text,
- ClutterText *clutter_text);
-
-/* AtkText */
-static void cally_text_text_interface_init (AtkTextIface *iface);
-static gchar* cally_text_get_text (AtkText *text,
- gint start_offset,
- gint end_offset);
-static gunichar cally_text_get_character_at_offset (AtkText *text,
- gint offset);
-static gchar* cally_text_get_text_before_offset (AtkText *text,
- gint offset,
- AtkTextBoundary boundary_type,
- gint *start_offset,
- gint *end_offset);
-static gchar* cally_text_get_text_at_offset (AtkText *text,
- gint offset,
- AtkTextBoundary boundary_type,
- gint *start_offset,
- gint *end_offset);
-static gchar* cally_text_get_text_after_offset (AtkText *text,
- gint offset,
- AtkTextBoundary boundary_type,
- gint *start_offset,
- gint *end_offset);
-static gint cally_text_get_caret_offset (AtkText *text);
-static gboolean cally_text_set_caret_offset (AtkText *text,
- gint offset);
-static gint cally_text_get_character_count (AtkText *text);
-static gint cally_text_get_n_selections (AtkText *text);
-static gchar* cally_text_get_selection (AtkText *text,
- gint selection_num,
- gint *start_offset,
- gint *end_offset);
-static gboolean cally_text_add_selection (AtkText *text,
- gint start_offset,
- gint end_offset);
-static gboolean cally_text_remove_selection (AtkText *text,
- gint selection_num);
-static gboolean cally_text_set_selection (AtkText *text,
- gint selection_num,
- gint start_offset,
- gint end_offset);
-static AtkAttributeSet* cally_text_get_run_attributes (AtkText *text,
- gint offset,
- gint *start_offset,
- gint *end_offset);
-static AtkAttributeSet* cally_text_get_default_attributes (AtkText *text);
-static void cally_text_get_character_extents (AtkText *text,
- gint offset,
- gint *x,
- gint *y,
- gint *width,
- gint *height,
- AtkCoordType coords);
-static gint cally_text_get_offset_at_point (AtkText *text,
- gint x,
- gint y,
- AtkCoordType coords);
-
-static void _cally_text_get_selection_bounds (ClutterText *clutter_text,
- gint *start_offset,
- gint *end_offset);
-static void _cally_text_insert_text_cb (ClutterText *clutter_text,
- gchar *new_text,
- gint new_text_length,
- gint *position,
- gpointer data);
-static void _cally_text_delete_text_cb (ClutterText *clutter_text,
- gint start_pos,
- gint end_pos,
- gpointer data);
-static gboolean _idle_notify_insert (gpointer data);
-static void _notify_insert (CallyText *cally_text);
-static void _notify_delete (CallyText *cally_text);
-
-/* AtkEditableText */
-static void cally_text_editable_text_interface_init (AtkEditableTextIface *iface);
-static void cally_text_set_text_contents (AtkEditableText *text,
- const gchar *string);
-static void cally_text_insert_text (AtkEditableText *text,
- const gchar *string,
- gint length,
- gint *position);
-static void cally_text_delete_text (AtkEditableText *text,
- gint start_pos,
- gint end_pos);
-
-/* CallyActor */
-static void cally_text_notify_clutter (GObject *obj,
- GParamSpec *pspec);
-
-static gboolean _check_for_selection_change (CallyText *cally_text,
- ClutterText *clutter_text);
-
-/* Misc functions */
-static AtkAttributeSet* _cally_misc_add_attribute (AtkAttributeSet *attrib_set,
- AtkTextAttribute attr,
- gchar *value);
-
-static AtkAttributeSet* _cally_misc_layout_get_run_attributes (AtkAttributeSet *attrib_set,
- ClutterText *clutter_text,
- gint offset,
- gint *start_offset,
- gint *end_offset);
-
-static AtkAttributeSet* _cally_misc_layout_get_default_attributes (AtkAttributeSet *attrib_set,
- ClutterText *text);
-
-static int _cally_misc_get_index_at_point (ClutterText *clutter_text,
- gint x,
- gint y,
- AtkCoordType coords);
-
-struct _CallyTextPrivate
-{
- /* Cached ClutterText values*/
- gint cursor_position;
- gint selection_bound;
-
- /* text_changed::insert stuff */
- const gchar *signal_name_insert;
- gint position_insert;
- gint length_insert;
- guint insert_idle_handler;
-
- /* text_changed::delete stuff */
- const gchar *signal_name_delete;
- gint position_delete;
- gint length_delete;
-
- /* action */
- guint activate_action_id;
-};
-
-G_DEFINE_TYPE_WITH_CODE (CallyText,
- cally_text,
- CALLY_TYPE_ACTOR,
- G_ADD_PRIVATE (CallyText)
- G_IMPLEMENT_INTERFACE (ATK_TYPE_TEXT,
- cally_text_text_interface_init)
- G_IMPLEMENT_INTERFACE (ATK_TYPE_EDITABLE_TEXT,
- cally_text_editable_text_interface_init));
-
-static void
-cally_text_class_init (CallyTextClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
- CallyActorClass *cally_class = CALLY_ACTOR_CLASS (klass);
-
- gobject_class->finalize = cally_text_finalize;
-
- class->initialize = cally_text_real_initialize;
- class->ref_state_set = cally_text_ref_state_set;
-
- cally_class->notify_clutter = cally_text_notify_clutter;
-}
-
-static void
-cally_text_init (CallyText *cally_text)
-{
- CallyTextPrivate *priv = cally_text_get_instance_private (cally_text);
-
- cally_text->priv = priv;
-
- priv->cursor_position = 0;
- priv->selection_bound = 0;
-
- priv->signal_name_insert = NULL;
- priv->position_insert = -1;
- priv->length_insert = -1;
- priv->insert_idle_handler = 0;
-
- priv->signal_name_delete = NULL;
- priv->position_delete = -1;
- priv->length_delete = -1;
-
- priv->activate_action_id = 0;
-}
-
-static void
-cally_text_finalize (GObject *obj)
-{
- CallyText *cally_text = CALLY_TEXT (obj);
-
-/* g_object_unref (cally_text->priv->textutil); */
-/* cally_text->priv->textutil = NULL; */
-
- g_clear_handle_id (&cally_text->priv->insert_idle_handler, g_source_remove);
-
- G_OBJECT_CLASS (cally_text_parent_class)->finalize (obj);
-}
-
-/**
- * cally_text_new:
- * @actor: a #ClutterActor
- *
- * Creates a new #CallyText for the given @actor. @actor must be a
- * #ClutterText.
- *
- * Return value: the newly created #AtkObject
- *
- * Since: 1.4
- */
-AtkObject*
-cally_text_new (ClutterActor *actor)
-{
- GObject *object = NULL;
- AtkObject *accessible = NULL;
-
- g_return_val_if_fail (CLUTTER_IS_TEXT (actor), NULL);
-
- object = g_object_new (CALLY_TYPE_TEXT, NULL);
-
- accessible = ATK_OBJECT (object);
- atk_object_initialize (accessible, actor);
-
- return accessible;
-}
-
-/* atkobject.h */
-
-static void
-cally_text_real_initialize(AtkObject *obj,
- gpointer data)
-{
- ClutterText *clutter_text = NULL;
- CallyText *cally_text = NULL;
-
- ATK_OBJECT_CLASS (cally_text_parent_class)->initialize (obj, data);
-
- g_return_if_fail (CLUTTER_TEXT (data));
-
- cally_text = CALLY_TEXT (obj);
- clutter_text = CLUTTER_TEXT (data);
-
- cally_text->priv->cursor_position = clutter_text_get_cursor_position (clutter_text);
- cally_text->priv->selection_bound = clutter_text_get_selection_bound (clutter_text);
-
- g_signal_connect (clutter_text, "insert-text",
- G_CALLBACK (_cally_text_insert_text_cb),
- cally_text);
- g_signal_connect (clutter_text, "delete-text",
- G_CALLBACK (_cally_text_delete_text_cb),
- cally_text);
-
- _check_activate_action (cally_text, clutter_text);
-
- if (clutter_text_get_password_char (clutter_text) != 0)
- atk_object_set_role (obj, ATK_ROLE_PASSWORD_TEXT);
- else
- atk_object_set_role (obj, ATK_ROLE_TEXT);
-}
-
-static AtkStateSet*
-cally_text_ref_state_set (AtkObject *obj)
-{
- AtkStateSet *result = NULL;
- ClutterActor *actor = NULL;
-
- result = ATK_OBJECT_CLASS (cally_text_parent_class)->ref_state_set (obj);
-
- actor = CALLY_GET_CLUTTER_ACTOR (obj);
-
- if (actor == NULL)
- return result;
-
- if (clutter_text_get_editable (CLUTTER_TEXT (actor)))
- atk_state_set_add_state (result, ATK_STATE_EDITABLE);
-
- if (clutter_text_get_selectable (CLUTTER_TEXT (actor)))
- atk_state_set_add_state (result, ATK_STATE_SELECTABLE_TEXT);
-
- return result;
-}
-
-/***** pango stuff ****
- *
- * FIXME: all this pango related code used to implement
- * atk_text_get_text_[before/at/after]_offset was copied from GTK, and
- * should be on a common library (like pango itself).
- *
- *********************/
-
-/*
- * _gtk_pango_move_chars:
- * @layout: a #PangoLayout
- * @offset: a character offset in @layout
- * @count: the number of characters to move from @offset
- *
- * Returns the position that is @count characters from the
- * given @offset. @count may be positive or negative.
- *
- * For the purpose of this function, characters are defined
- * by what Pango considers cursor positions.
- *
- * Returns: the new position
- */
-static gint
-_gtk_pango_move_chars (PangoLayout *layout,
- gint offset,
- gint count)
-{
- const PangoLogAttr *attrs;
- gint n_attrs;
-
- attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs);
-
- while (count > 0 && offset < n_attrs - 1)
- {
- do
- offset++;
- while (offset < n_attrs - 1 && !attrs[offset].is_cursor_position);
-
- count--;
- }
- while (count < 0 && offset > 0)
- {
- do
- offset--;
- while (offset > 0 && !attrs[offset].is_cursor_position);
-
- count++;
- }
-
- return offset;
-}
-
-/*
- * _gtk_pango_move_words:
- * @layout: a #PangoLayout
- * @offset: a character offset in @layout
- * @count: the number of words to move from @offset
- *
- * Returns the position that is @count words from the
- * given @offset. @count may be positive or negative.
- *
- * If @count is positive, the returned position will
- * be a word end, otherwise it will be a word start.
- * See the Pango documentation for details on how
- * word starts and ends are defined.
- *
- * Returns: the new position
- */
-static gint
-_gtk_pango_move_words (PangoLayout *layout,
- gint offset,
- gint count)
-{
- const PangoLogAttr *attrs;
- gint n_attrs;
-
- attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs);
-
- while (count > 0 && offset < n_attrs - 1)
- {
- do
- offset++;
- while (offset < n_attrs - 1 && !attrs[offset].is_word_end);
-
- count--;
- }
- while (count < 0 && offset > 0)
- {
- do
- offset--;
- while (offset > 0 && !attrs[offset].is_word_start);
-
- count++;
- }
-
- return offset;
-}
-
-/*
- * _gtk_pango_move_sentences:
- * @layout: a #PangoLayout
- * @offset: a character offset in @layout
- * @count: the number of sentences to move from @offset
- *
- * Returns the position that is @count sentences from the
- * given @offset. @count may be positive or negative.
- *
- * If @count is positive, the returned position will
- * be a sentence end, otherwise it will be a sentence start.
- * See the Pango documentation for details on how
- * sentence starts and ends are defined.
- *
- * Returns: the new position
- */
-static gint
-_gtk_pango_move_sentences (PangoLayout *layout,
- gint offset,
- gint count)
-{
- const PangoLogAttr *attrs;
- gint n_attrs;
-
- attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs);
-
- while (count > 0 && offset < n_attrs - 1)
- {
- do
- offset++;
- while (offset < n_attrs - 1 && !attrs[offset].is_sentence_end);
-
- count--;
- }
- while (count < 0 && offset > 0)
- {
- do
- offset--;
- while (offset > 0 && !attrs[offset].is_sentence_start);
-
- count++;
- }
-
- return offset;
-}
-
-/*
- * _gtk_pango_is_inside_word:
- * @layout: a #PangoLayout
- * @offset: a character offset in @layout
- *
- * Returns whether the given position is inside
- * a word.
- *
- * Returns: %TRUE if @offset is inside a word
- */
-static gboolean
-_gtk_pango_is_inside_word (PangoLayout *layout,
- gint offset)
-{
- const PangoLogAttr *attrs;
- gint n_attrs;
-
- attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs);
-
- while (offset >= 0 &&
- !(attrs[offset].is_word_start || attrs[offset].is_word_end))
- offset--;
-
- if (offset >= 0)
- return attrs[offset].is_word_start;
-
- return FALSE;
-}
-
-/*
- * _gtk_pango_is_inside_sentence:
- * @layout: a #PangoLayout
- * @offset: a character offset in @layout
- *
- * Returns whether the given position is inside
- * a sentence.
- *
- * Returns: %TRUE if @offset is inside a sentence
- */
-static gboolean
-_gtk_pango_is_inside_sentence (PangoLayout *layout,
- gint offset)
-{
- const PangoLogAttr *attrs;
- gint n_attrs;
-
- attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs);
-
- while (offset >= 0 &&
- !(attrs[offset].is_sentence_start || attrs[offset].is_sentence_end))
- offset--;
-
- if (offset >= 0)
- return attrs[offset].is_sentence_start;
-
- return FALSE;
-}
-
-static void
-pango_layout_get_line_before (PangoLayout *layout,
- AtkTextBoundary boundary_type,
- gint offset,
- gint *start_offset,
- gint *end_offset)
-{
- PangoLayoutIter *iter;
- PangoLayoutLine *line, *prev_line = NULL, *prev_prev_line = NULL;
- gint index, start_index, end_index;
- const gchar *text;
- gboolean found = FALSE;
-
- text = pango_layout_get_text (layout);
- index = g_utf8_offset_to_pointer (text, offset) - text;
- iter = pango_layout_get_iter (layout);
- do
- {
- line = pango_layout_iter_get_line (iter);
- start_index = line->start_index;
- end_index = start_index + line->length;
-
- if (index >= start_index && index <= end_index)
- {
- /* Found line for offset */
- if (prev_line)
- {
- switch (boundary_type)
- {
- case ATK_TEXT_BOUNDARY_LINE_START:
- end_index = start_index;
- start_index = prev_line->start_index;
- break;
- case ATK_TEXT_BOUNDARY_LINE_END:
- if (prev_prev_line)
- start_index = prev_prev_line->start_index + prev_prev_line->length;
- else
- start_index = 0;
- end_index = prev_line->start_index + prev_line->length;
- break;
- default:
- g_assert_not_reached();
- }
- }
- else
- start_index = end_index = 0;
-
- found = TRUE;
- break;
- }
-
- prev_prev_line = prev_line;
- prev_line = line;
- }
- while (pango_layout_iter_next_line (iter));
-
- if (!found)
- {
- start_index = prev_line->start_index + prev_line->length;
- end_index = start_index;
- }
- pango_layout_iter_free (iter);
-
- *start_offset = g_utf8_pointer_to_offset (text, text + start_index);
- *end_offset = g_utf8_pointer_to_offset (text, text + end_index);
-}
-
-static void
-pango_layout_get_line_at (PangoLayout *layout,
- AtkTextBoundary boundary_type,
- gint offset,
- gint *start_offset,
- gint *end_offset)
-{
- PangoLayoutIter *iter;
- PangoLayoutLine *line, *prev_line = NULL;
- gint index, start_index, end_index;
- const gchar *text;
- gboolean found = FALSE;
-
- text = pango_layout_get_text (layout);
- index = g_utf8_offset_to_pointer (text, offset) - text;
- iter = pango_layout_get_iter (layout);
- do
- {
- line = pango_layout_iter_get_line (iter);
- start_index = line->start_index;
- end_index = start_index + line->length;
-
- if (index >= start_index && index <= end_index)
- {
- /* Found line for offset */
- switch (boundary_type)
- {
- case ATK_TEXT_BOUNDARY_LINE_START:
- if (pango_layout_iter_next_line (iter))
- end_index = pango_layout_iter_get_line (iter)->start_index;
- break;
- case ATK_TEXT_BOUNDARY_LINE_END:
- if (prev_line)
- start_index = prev_line->start_index + prev_line->length;
- break;
- default:
- g_assert_not_reached();
- }
-
- found = TRUE;
- break;
- }
-
- prev_line = line;
- }
- while (pango_layout_iter_next_line (iter));
-
- if (!found)
- {
- start_index = prev_line->start_index + prev_line->length;
- end_index = start_index;
- }
- pango_layout_iter_free (iter);
-
- *start_offset = g_utf8_pointer_to_offset (text, text + start_index);
- *end_offset = g_utf8_pointer_to_offset (text, text + end_index);
-}
-
-static void
-pango_layout_get_line_after (PangoLayout *layout,
- AtkTextBoundary boundary_type,
- gint offset,
- gint *start_offset,
- gint *end_offset)
-{
- PangoLayoutIter *iter;
- PangoLayoutLine *line, *prev_line = NULL;
- gint index, start_index, end_index;
- const gchar *text;
- gboolean found = FALSE;
-
- text = pango_layout_get_text (layout);
- index = g_utf8_offset_to_pointer (text, offset) - text;
- iter = pango_layout_get_iter (layout);
- do
- {
- line = pango_layout_iter_get_line (iter);
- start_index = line->start_index;
- end_index = start_index + line->length;
-
- if (index >= start_index && index <= end_index)
- {
- /* Found line for offset */
- if (pango_layout_iter_next_line (iter))
- {
- line = pango_layout_iter_get_line (iter);
- switch (boundary_type)
- {
- case ATK_TEXT_BOUNDARY_LINE_START:
- start_index = line->start_index;
- if (pango_layout_iter_next_line (iter))
- end_index = pango_layout_iter_get_line (iter)->start_index;
- else
- end_index = start_index + line->length;
- break;
- case ATK_TEXT_BOUNDARY_LINE_END:
- start_index = end_index;
- end_index = line->start_index + line->length;
- break;
- default:
- g_assert_not_reached();
- }
- }
- else
- start_index = end_index;
-
- found = TRUE;
- break;
- }
-
- prev_line = line;
- }
- while (pango_layout_iter_next_line (iter));
-
- if (!found)
- {
- start_index = prev_line->start_index + prev_line->length;
- end_index = start_index;
- }
- pango_layout_iter_free (iter);
-
- *start_offset = g_utf8_pointer_to_offset (text, text + start_index);
- *end_offset = g_utf8_pointer_to_offset (text, text + end_index);
-}
-
-/*
- * _gtk_pango_get_text_at:
- * @layout: a #PangoLayout
- * @boundary_type: a #AtkTextBoundary
- * @offset: a character offset in @layout
- * @start_offset: return location for the start of the returned text
- * @end_offset: return location for the end of the return text
- *
- * Gets a slice of the text from @layout at @offset.
- *
- * The @boundary_type determines the size of the returned slice of
- * text. For the exact semantics of this function, see
- * atk_text_get_text_after_offset().
- *
- * Returns: a newly allocated string containing a slice of text
- * from layout. Free with g_free().
- */
-static gchar *
-_gtk_pango_get_text_at (PangoLayout *layout,
- AtkTextBoundary boundary_type,
- gint offset,
- gint *start_offset,
- gint *end_offset)
-{
- const gchar *text;
- gint start, end;
- const PangoLogAttr *attrs;
- gint n_attrs;
-
- text = pango_layout_get_text (layout);
-
- if (text[0] == 0)
- {
- *start_offset = 0;
- *end_offset = 0;
- return g_strdup ("");
- }
-
- attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs);
-
- start = offset;
- end = start;
-
- switch (boundary_type)
- {
- case ATK_TEXT_BOUNDARY_CHAR:
- end = _gtk_pango_move_chars (layout, end, 1);
- break;
-
- case ATK_TEXT_BOUNDARY_WORD_START:
- if (!attrs[start].is_word_start)
- start = _gtk_pango_move_words (layout, start, -1);
- if (_gtk_pango_is_inside_word (layout, end))
- end = _gtk_pango_move_words (layout, end, 1);
- while (!attrs[end].is_word_start && end < n_attrs - 1)
- end = _gtk_pango_move_chars (layout, end, 1);
- break;
-
- case ATK_TEXT_BOUNDARY_WORD_END:
- if (_gtk_pango_is_inside_word (layout, start) &&
- !attrs[start].is_word_start)
- start = _gtk_pango_move_words (layout, start, -1);
- while (!attrs[start].is_word_end && start > 0)
- start = _gtk_pango_move_chars (layout, start, -1);
- end = _gtk_pango_move_words (layout, end, 1);
- break;
-
- case ATK_TEXT_BOUNDARY_SENTENCE_START:
- if (!attrs[start].is_sentence_start)
- start = _gtk_pango_move_sentences (layout, start, -1);
- if (_gtk_pango_is_inside_sentence (layout, end))
- end = _gtk_pango_move_sentences (layout, end, 1);
- while (!attrs[end].is_sentence_start && end < n_attrs - 1)
- end = _gtk_pango_move_chars (layout, end, 1);
- break;
-
- case ATK_TEXT_BOUNDARY_SENTENCE_END:
- if (_gtk_pango_is_inside_sentence (layout, start) &&
- !attrs[start].is_sentence_start)
- start = _gtk_pango_move_sentences (layout, start, -1);
- while (!attrs[start].is_sentence_end && start > 0)
- start = _gtk_pango_move_chars (layout, start, -1);
- end = _gtk_pango_move_sentences (layout, end, 1);
- break;
-
- case ATK_TEXT_BOUNDARY_LINE_START:
- case ATK_TEXT_BOUNDARY_LINE_END:
- pango_layout_get_line_at (layout, boundary_type, offset, &start, &end);
- break;
- }
-
- *start_offset = start;
- *end_offset = end;
-
- g_assert (start <= end);
-
- return g_utf8_substring (text, start, end);
-}
-
-/*
- * _gtk_pango_get_text_before:
- * @layout: a #PangoLayout
- * @boundary_type: a #AtkTextBoundary
- * @offset: a character offset in @layout
- * @start_offset: return location for the start of the returned text
- * @end_offset: return location for the end of the return text
- *
- * Gets a slice of the text from @layout before @offset.
- *
- * The @boundary_type determines the size of the returned slice of
- * text. For the exact semantics of this function, see
- * atk_text_get_text_before_offset().
- *
- * Returns: a newly allocated string containing a slice of text
- * from layout. Free with g_free().
- */
-static gchar *
-_gtk_pango_get_text_before (PangoLayout *layout,
- AtkTextBoundary boundary_type,
- gint offset,
- gint *start_offset,
- gint *end_offset)
-{
- const gchar *text;
- gint start, end;
- const PangoLogAttr *attrs;
- gint n_attrs;
-
- text = pango_layout_get_text (layout);
-
- if (text[0] == 0)
- {
- *start_offset = 0;
- *end_offset = 0;
- return g_strdup ("");
- }
-
- attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs);
-
- start = offset;
- end = start;
-
- switch (boundary_type)
- {
- case ATK_TEXT_BOUNDARY_CHAR:
- start = _gtk_pango_move_chars (layout, start, -1);
- break;
-
- case ATK_TEXT_BOUNDARY_WORD_START:
- if (!attrs[start].is_word_start)
- start = _gtk_pango_move_words (layout, start, -1);
- end = start;
- start = _gtk_pango_move_words (layout, start, -1);
- break;
-
- case ATK_TEXT_BOUNDARY_WORD_END:
- if (_gtk_pango_is_inside_word (layout, start) &&
- !attrs[start].is_word_start)
- start = _gtk_pango_move_words (layout, start, -1);
- while (!attrs[start].is_word_end && start > 0)
- start = _gtk_pango_move_chars (layout, start, -1);
- end = start;
- start = _gtk_pango_move_words (layout, start, -1);
- while (!attrs[start].is_word_end && start > 0)
- start = _gtk_pango_move_chars (layout, start, -1);
- break;
-
- case ATK_TEXT_BOUNDARY_SENTENCE_START:
- if (!attrs[start].is_sentence_start)
- start = _gtk_pango_move_sentences (layout, start, -1);
- end = start;
- start = _gtk_pango_move_sentences (layout, start, -1);
- break;
-
- case ATK_TEXT_BOUNDARY_SENTENCE_END:
- if (_gtk_pango_is_inside_sentence (layout, start) &&
- !attrs[start].is_sentence_start)
- start = _gtk_pango_move_sentences (layout, start, -1);
- while (!attrs[start].is_sentence_end && start > 0)
- start = _gtk_pango_move_chars (layout, start, -1);
- end = start;
- start = _gtk_pango_move_sentences (layout, start, -1);
- while (!attrs[start].is_sentence_end && start > 0)
- start = _gtk_pango_move_chars (layout, start, -1);
- break;
-
- case ATK_TEXT_BOUNDARY_LINE_START:
- case ATK_TEXT_BOUNDARY_LINE_END:
- pango_layout_get_line_before (layout, boundary_type, offset, &start, &end);
- break;
- }
-
- *start_offset = start;
- *end_offset = end;
-
- g_assert (start <= end);
-
- return g_utf8_substring (text, start, end);
-}
-
-/*
- * _gtk_pango_get_text_after:
- * @layout: a #PangoLayout
- * @boundary_type: a #AtkTextBoundary
- * @offset: a character offset in @layout
- * @start_offset: return location for the start of the returned text
- * @end_offset: return location for the end of the return text
- *
- * Gets a slice of the text from @layout after @offset.
- *
- * The @boundary_type determines the size of the returned slice of
- * text. For the exact semantics of this function, see
- * atk_text_get_text_after_offset().
- *
- * Returns: a newly allocated string containing a slice of text
- * from layout. Free with g_free().
- */
-static gchar *
-_gtk_pango_get_text_after (PangoLayout *layout,
- AtkTextBoundary boundary_type,
- gint offset,
- gint *start_offset,
- gint *end_offset)
-{
- const gchar *text;
- gint start, end;
- const PangoLogAttr *attrs;
- gint n_attrs;
-
- text = pango_layout_get_text (layout);
-
- if (text[0] == 0)
- {
- *start_offset = 0;
- *end_offset = 0;
- return g_strdup ("");
- }
-
- attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs);
-
- start = offset;
- end = start;
-
- switch (boundary_type)
- {
- case ATK_TEXT_BOUNDARY_CHAR:
- start = _gtk_pango_move_chars (layout, start, 1);
- end = start;
- end = _gtk_pango_move_chars (layout, end, 1);
- break;
-
- case ATK_TEXT_BOUNDARY_WORD_START:
- if (_gtk_pango_is_inside_word (layout, end))
- end = _gtk_pango_move_words (layout, end, 1);
- while (!attrs[end].is_word_start && end < n_attrs - 1)
- end = _gtk_pango_move_chars (layout, end, 1);
- start = end;
- if (end < n_attrs - 1)
- {
- end = _gtk_pango_move_words (layout, end, 1);
- while (!attrs[end].is_word_start && end < n_attrs - 1)
- end = _gtk_pango_move_chars (layout, end, 1);
- }
- break;
-
- case ATK_TEXT_BOUNDARY_WORD_END:
- end = _gtk_pango_move_words (layout, end, 1);
- start = end;
- if (end < n_attrs - 1)
- end = _gtk_pango_move_words (layout, end, 1);
- break;
-
- case ATK_TEXT_BOUNDARY_SENTENCE_START:
- if (_gtk_pango_is_inside_sentence (layout, end))
- end = _gtk_pango_move_sentences (layout, end, 1);
- while (!attrs[end].is_sentence_start && end < n_attrs - 1)
- end = _gtk_pango_move_chars (layout, end, 1);
- start = end;
- if (end < n_attrs - 1)
- {
- end = _gtk_pango_move_sentences (layout, end, 1);
- while (!attrs[end].is_sentence_start && end < n_attrs - 1)
- end = _gtk_pango_move_chars (layout, end, 1);
- }
- break;
-
- case ATK_TEXT_BOUNDARY_SENTENCE_END:
- end = _gtk_pango_move_sentences (layout, end, 1);
- start = end;
- if (end < n_attrs - 1)
- end = _gtk_pango_move_sentences (layout, end, 1);
- break;
-
- case ATK_TEXT_BOUNDARY_LINE_START:
- case ATK_TEXT_BOUNDARY_LINE_END:
- pango_layout_get_line_after (layout, boundary_type, offset, &start, &end);
- break;
- }
-
- *start_offset = start;
- *end_offset = end;
-
- g_assert (start <= end);
-
- return g_utf8_substring (text, start, end);
-}
-
-/***** atktext.h ******/
-
-static void
-cally_text_text_interface_init (AtkTextIface *iface)
-{
- g_return_if_fail (iface != NULL);
-
- iface->get_text = cally_text_get_text;
- iface->get_character_at_offset = cally_text_get_character_at_offset;
- iface->get_text_before_offset = cally_text_get_text_before_offset;
- iface->get_text_at_offset = cally_text_get_text_at_offset;
- iface->get_text_after_offset = cally_text_get_text_after_offset;
- iface->get_character_count = cally_text_get_character_count;
- iface->get_caret_offset = cally_text_get_caret_offset;
- iface->set_caret_offset = cally_text_set_caret_offset;
- iface->get_n_selections = cally_text_get_n_selections;
- iface->get_selection = cally_text_get_selection;
- iface->add_selection = cally_text_add_selection;
- iface->remove_selection = cally_text_remove_selection;
- iface->set_selection = cally_text_set_selection;
- iface->get_run_attributes = cally_text_get_run_attributes;
- iface->get_default_attributes = cally_text_get_default_attributes;
- iface->get_character_extents = cally_text_get_character_extents;
- iface->get_offset_at_point = cally_text_get_offset_at_point;
-
-}
-
-static gchar*
-cally_text_get_text (AtkText *text,
- gint start_offset,
- gint end_offset)
-{
- ClutterActor *actor = NULL;
- PangoLayout *layout = NULL;
- const gchar *string = NULL;
- gint character_count = 0;
-
- actor = CALLY_GET_CLUTTER_ACTOR (text);
- if (actor == NULL) /* Object is defunct */
- return NULL;
-
- /* we use the pango layout instead of clutter_text_get_chars because
- it take into account password-char */
-
- layout = clutter_text_get_layout (CLUTTER_TEXT (actor));
- string = pango_layout_get_text (layout);
- character_count = pango_layout_get_character_count (layout);
-
- if (end_offset == -1 || end_offset > character_count)
- end_offset = character_count;
-
- if (string[0] == 0)
- return g_strdup("");
- else
- return g_utf8_substring (string, start_offset, end_offset);
-}
-
-static gunichar
-cally_text_get_character_at_offset (AtkText *text,
- gint offset)
-{
- ClutterActor *actor = NULL;
- const gchar *string = NULL;
- gchar *index = NULL;
- gunichar unichar;
- PangoLayout *layout = NULL;
-
- actor = CALLY_GET_CLUTTER_ACTOR (text);
- if (actor == NULL) /* State is defunct */
- return '\0';
-
- /* we use the pango layout instead of clutter_text_get_chars because
- it take into account password-char */
-
- layout = clutter_text_get_layout (CLUTTER_TEXT (actor));
- string = pango_layout_get_text (layout);
-
- if (offset >= g_utf8_strlen (string, -1))
- {
- unichar = '\0';
- }
- else
- {
- index = g_utf8_offset_to_pointer (string, offset);
-
- unichar = g_utf8_get_char (index);
- }
-
- return unichar;
-}
-
-static gchar*
-cally_text_get_text_before_offset (AtkText *text,
- gint offset,
- AtkTextBoundary boundary_type,
- gint *start_offset,
- gint *end_offset)
-{
- ClutterActor *actor = NULL;
-
- actor = CALLY_GET_CLUTTER_ACTOR (text);
- if (actor == NULL) /* State is defunct */
- return NULL;
-
- return _gtk_pango_get_text_before (clutter_text_get_layout (CLUTTER_TEXT (actor)),
- boundary_type, offset,
- start_offset, end_offset);
-}
-
-static gchar*
-cally_text_get_text_at_offset (AtkText *text,
- gint offset,
- AtkTextBoundary boundary_type,
- gint *start_offset,
- gint *end_offset)
-{
- ClutterActor *actor = NULL;
-
- actor = CALLY_GET_CLUTTER_ACTOR (text);
- if (actor == NULL) /* State is defunct */
- return NULL;
-
- return _gtk_pango_get_text_at (clutter_text_get_layout (CLUTTER_TEXT (actor)),
- boundary_type, offset,
- start_offset, end_offset);
-}
-
-static gchar*
-cally_text_get_text_after_offset (AtkText *text,
- gint offset,
- AtkTextBoundary boundary_type,
- gint *start_offset,
- gint *end_offset)
-{
- ClutterActor *actor = NULL;
-
- actor = CALLY_GET_CLUTTER_ACTOR (text);
- if (actor == NULL) /* State is defunct */
- return NULL;
-
- return _gtk_pango_get_text_after (clutter_text_get_layout (CLUTTER_TEXT (actor)),
- boundary_type, offset,
- start_offset, end_offset);
-}
-
-static gint
-cally_text_get_caret_offset (AtkText *text)
-{
- ClutterActor *actor = NULL;
-
- actor = CALLY_GET_CLUTTER_ACTOR (text);
- if (actor == NULL) /* State is defunct */
- return -1;
-
- return clutter_text_get_cursor_position (CLUTTER_TEXT (actor));
-}
-
-static gboolean
-cally_text_set_caret_offset (AtkText *text,
- gint offset)
-{
- ClutterActor *actor = NULL;
-
- actor = CALLY_GET_CLUTTER_ACTOR (text);
- if (actor == NULL) /* State is defunct */
- return FALSE;
-
- clutter_text_set_cursor_position (CLUTTER_TEXT (actor), offset);
-
- /* like in gailentry, we suppose that this always works, as clutter text
- doesn't return anything */
- return TRUE;
-}
-
-static gint
-cally_text_get_character_count (AtkText *text)
-{
- ClutterActor *actor = NULL;
- ClutterText *clutter_text = NULL;
-
- actor = CALLY_GET_CLUTTER_ACTOR (text);
- if (actor == NULL) /* State is defunct */
- return 0;
-
- clutter_text = CLUTTER_TEXT (actor);
- return g_utf8_strlen (clutter_text_get_text (clutter_text), -1);
-}
-
-static gint
-cally_text_get_n_selections (AtkText *text)
-{
- ClutterActor *actor = NULL;
- gint selection_bound = -1;
- gint cursor_position = -1;
-
- actor = CALLY_GET_CLUTTER_ACTOR (text);
- if (actor == NULL) /* State is defunct */
- return 0;
-
- if (!clutter_text_get_selectable (CLUTTER_TEXT (actor)))
- return 0;
-
- selection_bound = clutter_text_get_selection_bound (CLUTTER_TEXT (actor));
- cursor_position = clutter_text_get_cursor_position (CLUTTER_TEXT (actor));
-
- if (selection_bound == cursor_position)
- return 0;
- else
- return 1;
-}
-
-static gchar*
-cally_text_get_selection (AtkText *text,
- gint selection_num,
- gint *start_offset,
- gint *end_offset)
-{
- ClutterActor *actor = NULL;
-
- actor = CALLY_GET_CLUTTER_ACTOR (text);
- if (actor == NULL) /* State is defunct */
- return NULL;
-
- /* As in gailentry, only let the user get the selection if one is set, and if
- * the selection_num is 0.
- */
- if (selection_num != 0)
- return NULL;
-
- _cally_text_get_selection_bounds (CLUTTER_TEXT (actor), start_offset, end_offset);
-
- if (*start_offset != *end_offset)
- return clutter_text_get_selection (CLUTTER_TEXT (actor));
- else
- return NULL;
-}
-
-/* ClutterText only allows one selection. So this method will set the selection
- if no selection exists, but as in gailentry, it will not change the current
- selection */
-static gboolean
-cally_text_add_selection (AtkText *text,
- gint start_offset,
- gint end_offset)
-{
- ClutterActor *actor;
- gint select_start, select_end;
-
- actor = CALLY_GET_CLUTTER_ACTOR (text);
- if (actor == NULL) /* State is defunct */
- return FALSE;
-
- _cally_text_get_selection_bounds (CLUTTER_TEXT (actor),
- &select_start, &select_end);
-
- /* Like in gailentry, if there is already a selection, then don't allow another
- * to be added, since ClutterText only supports one selected region.
- */
- if (select_start == select_end)
- {
- clutter_text_set_selection (CLUTTER_TEXT (actor),
- start_offset, end_offset);
-
- return TRUE;
- }
- else
- return FALSE;
-}
-
-
-static gboolean
-cally_text_remove_selection (AtkText *text,
- gint selection_num)
-{
- ClutterActor *actor = NULL;
- gint caret_pos = -1;
- gint select_start = -1;
- gint select_end = -1;
-
- actor = CALLY_GET_CLUTTER_ACTOR (text);
- if (actor == NULL) /* State is defunct */
- return FALSE;
-
- /* only one selection is allowed */
- if (selection_num != 0)
- return FALSE;
-
- _cally_text_get_selection_bounds (CLUTTER_TEXT (actor),
- &select_start, &select_end);
-
- if (select_start != select_end)
- {
- /* Setting the start & end of the selected region to the caret position
- * turns off the selection.
- */
- caret_pos = clutter_text_get_cursor_position (CLUTTER_TEXT (actor));
- clutter_text_set_selection (CLUTTER_TEXT (actor),
- caret_pos, caret_pos);
- return TRUE;
- }
- else
- return FALSE;
-}
-
-static gboolean
-cally_text_set_selection (AtkText *text,
- gint selection_num,
- gint start_offset,
- gint end_offset)
-{
- ClutterActor *actor = NULL;
- gint select_start = -1;
- gint select_end = -1;
-
- actor = CALLY_GET_CLUTTER_ACTOR (text);
- if (actor == NULL) /* State is defunct */
- return FALSE;
-
- /* Like in gailentry, only let the user move the selection if one is set,
- * and if the selection_num is 0
- */
- if (selection_num != 0)
- return FALSE;
-
- _cally_text_get_selection_bounds (CLUTTER_TEXT (actor),
- &select_start, &select_end);
-
- if (select_start != select_end)
- {
- clutter_text_set_selection (CLUTTER_TEXT (actor),
- start_offset, end_offset);
- return TRUE;
- }
- else
- return FALSE;
-}
-
-static AtkAttributeSet*
-cally_text_get_run_attributes (AtkText *text,
- gint offset,
- gint *start_offset,
- gint *end_offset)
-{
- ClutterActor *actor = NULL;
- ClutterText *clutter_text = NULL;
- AtkAttributeSet *at_set = NULL;
-
- actor = CALLY_GET_CLUTTER_ACTOR (text);
- if (actor == NULL) /* State is defunct */
- return NULL;
-
- /* Clutter don't have any reference to the direction*/
-
- clutter_text = CLUTTER_TEXT (actor);
-
- at_set = _cally_misc_layout_get_run_attributes (at_set,
- clutter_text,
- offset,
- start_offset,
- end_offset);
-
- return at_set;
-}
-
-static AtkAttributeSet*
-cally_text_get_default_attributes (AtkText *text)
-{
- ClutterActor *actor = NULL;
- ClutterText *clutter_text = NULL;
- AtkAttributeSet *at_set = NULL;
-
- actor = CALLY_GET_CLUTTER_ACTOR (text);
- if (actor == NULL) /* State is defunct */
- return NULL;
-
- clutter_text = CLUTTER_TEXT (actor);
-
- at_set = _cally_misc_layout_get_default_attributes (at_set, clutter_text);
-
- return at_set;
-}
-
-static void cally_text_get_character_extents (AtkText *text,
- gint offset,
- gint *xp,
- gint *yp,
- gint *widthp,
- gint *heightp,
- AtkCoordType coords)
-{
- ClutterActor *actor = NULL;
- ClutterText *clutter_text = NULL;
- gint x = 0, y = 0, width = 0, height = 0;
- gint index, x_window, y_window, x_toplevel, y_toplevel;
- gint x_layout, y_layout;
- PangoLayout *layout;
- PangoRectangle extents;
- const gchar *text_value;
- graphene_point3d_t verts[4];
-
- actor = CALLY_GET_CLUTTER_ACTOR (text);
- if (actor == NULL) /* State is defunct */
- goto done;
-
- clutter_text = CLUTTER_TEXT (actor);
-
- text_value = clutter_text_get_text (clutter_text);
- index = g_utf8_offset_to_pointer (text_value, offset) - text_value;
-
- layout = clutter_text_get_layout (clutter_text);
- pango_layout_index_to_pos (layout, index, &extents);
-
- /* handle RTL text layout */
- if (extents.width < 0)
- {
- extents.x += extents.width;
- extents.width = -extents.width;
- }
-
- clutter_actor_get_abs_allocation_vertices (actor, verts);
- x_window = verts[0].x;
- y_window = verts[0].y;
-
- clutter_text_get_layout_offsets (clutter_text, &x_layout, &y_layout);
-
- x = (extents.x / PANGO_SCALE) + x_layout + x_window;
- y = (extents.y / PANGO_SCALE) + y_layout + y_window;
- width = extents.width / PANGO_SCALE;
- height = extents.height / PANGO_SCALE;
-
- if (coords == ATK_XY_SCREEN)
- {
- _cally_actor_get_top_level_origin (actor, &x_toplevel, &y_toplevel);
- x += x_toplevel;
- y += y_toplevel;
- }
-
-done:
- if (widthp)
- *widthp = width;
-
- if (heightp)
- *heightp = height;
-
- if (xp)
- *xp = x;
-
- if (yp)
- *yp = y;
-}
-
-static gint
-cally_text_get_offset_at_point (AtkText *text,
- gint x,
- gint y,
- AtkCoordType coords)
-{
- ClutterActor *actor = NULL;
- ClutterText *clutter_text = NULL;
- const gchar *text_value;
- gint index;
-
- actor = CALLY_GET_CLUTTER_ACTOR (text);
- if (actor == NULL) /* State is defunct */
- return -1;
-
- clutter_text = CLUTTER_TEXT (actor);
-
- index = _cally_misc_get_index_at_point (clutter_text, x, y, coords);
- text_value = clutter_text_get_text (clutter_text);
- if (index == -1)
- return g_utf8_strlen (text_value, -1);
- else
- return g_utf8_pointer_to_offset (text_value, text_value + index);
-}
-
-
-/******** Auxiliary private methods ******/
-
-/* ClutterText only maintains the current cursor position and a extra selection
- bound, but this could be before or after the cursor. This method returns
- the start and end positions in a proper order (so start<=end). This is
- similar to the function gtk_editable_get_selection_bounds */
-static void
-_cally_text_get_selection_bounds (ClutterText *clutter_text,
- gint *start_offset,
- gint *end_offset)
-{
- gint pos = -1;
- gint selection_bound = -1;
-
- pos = clutter_text_get_cursor_position (clutter_text);
- selection_bound = clutter_text_get_selection_bound (clutter_text);
-
- if (pos < selection_bound)
- {
- *start_offset = pos;
- *end_offset = selection_bound;
- }
- else
- {
- *start_offset = selection_bound;
- *end_offset = pos;
- }
-}
-
-static void
-_cally_text_delete_text_cb (ClutterText *clutter_text,
- gint start_pos,
- gint end_pos,
- gpointer data)
-{
- CallyText *cally_text = NULL;
-
- g_return_if_fail (CALLY_IS_TEXT (data));
-
- /* Ignore zero length deletions */
- if (end_pos - start_pos == 0)
- return;
-
- cally_text = CALLY_TEXT (data);
-
- if (!cally_text->priv->signal_name_delete)
- {
- cally_text->priv->signal_name_delete = "text_changed::delete";
- cally_text->priv->position_delete = start_pos;
- cally_text->priv->length_delete = end_pos - start_pos;
- }
-
- _notify_delete (cally_text);
-}
-
-static void
-_cally_text_insert_text_cb (ClutterText *clutter_text,
- gchar *new_text,
- gint new_text_length,
- gint *position,
- gpointer data)
-{
- CallyText *cally_text = NULL;
-
- g_return_if_fail (CALLY_IS_TEXT (data));
-
- cally_text = CALLY_TEXT (data);
-
- if (!cally_text->priv->signal_name_insert)
- {
- cally_text->priv->signal_name_insert = "text_changed::insert";
- cally_text->priv->position_insert = *position;
- cally_text->priv->length_insert = g_utf8_strlen (new_text, new_text_length);
- }
-
- /*
- * The signal will be emitted when the cursor position is updated,
- * or in an idle handler if it not updated.
- */
- if (cally_text->priv->insert_idle_handler == 0)
- cally_text->priv->insert_idle_handler = clutter_threads_add_idle (_idle_notify_insert,
- cally_text);
-}
-
-/***** atkeditabletext.h ******/
-
-static void
-cally_text_editable_text_interface_init (AtkEditableTextIface *iface)
-{
- g_return_if_fail (iface != NULL);
-
- iface->set_text_contents = cally_text_set_text_contents;
- iface->insert_text = cally_text_insert_text;
- iface->delete_text = cally_text_delete_text;
-
- iface->set_run_attributes = NULL;
- iface->copy_text = NULL;
- iface->cut_text = NULL;
- iface->paste_text = NULL;
-}
-
-static void
-cally_text_set_text_contents (AtkEditableText *text,
- const gchar *string)
-{
- ClutterActor *actor = NULL;
-
- actor = CALLY_GET_CLUTTER_ACTOR (text);
- if (actor == NULL)
- return;
-
- if (!clutter_text_get_editable (CLUTTER_TEXT (actor)))
- return;
-
- clutter_text_set_text (CLUTTER_TEXT (actor),
- string);
-}
-
-
-static void
-cally_text_insert_text (AtkEditableText *text,
- const gchar *string,
- gint length,
- gint *position)
-{
- ClutterActor *actor = NULL;
-
- actor = CALLY_GET_CLUTTER_ACTOR (text);
- if (actor == NULL)
- return;
-
- if (!clutter_text_get_editable (CLUTTER_TEXT (actor)))
- return;
-
- if (length < 0)
- length = g_utf8_strlen (string, -1);
-
- clutter_text_insert_text (CLUTTER_TEXT (actor),
- string, *position);
-
- /* we suppose that the text insertion will be successful,
- clutter-text doesn't warn about it. A option would be search for
- the text, but it seems not really required */
- *position += length;
-}
-
-static void cally_text_delete_text (AtkEditableText *text,
- gint start_pos,
- gint end_pos)
-{
- ClutterActor *actor = NULL;
-
- actor = CALLY_GET_CLUTTER_ACTOR (text);
- if (actor == NULL)
- return;
-
- if (!clutter_text_get_editable (CLUTTER_TEXT (actor)))
- return;
-
- clutter_text_delete_text (CLUTTER_TEXT (actor),
- start_pos, end_pos);
-}
-
-/* CallyActor */
-static void
-cally_text_notify_clutter (GObject *obj,
- GParamSpec *pspec)
-{
- ClutterText *clutter_text = NULL;
- CallyText *cally_text = NULL;
- AtkObject *atk_obj = NULL;
-
- clutter_text = CLUTTER_TEXT (obj);
- atk_obj = clutter_actor_get_accessible (CLUTTER_ACTOR (obj));
- cally_text = CALLY_TEXT (atk_obj);
-
- if (g_strcmp0 (pspec->name, "position") == 0)
- {
- /* the selection can change also for the cursor position */
- if (_check_for_selection_change (cally_text, clutter_text))
- g_signal_emit_by_name (atk_obj, "text_selection_changed");
-
- g_signal_emit_by_name (atk_obj, "text_caret_moved",
- clutter_text_get_cursor_position (clutter_text));
- }
- else if (g_strcmp0 (pspec->name, "selection-bound") == 0)
- {
- if (_check_for_selection_change (cally_text, clutter_text))
- g_signal_emit_by_name (atk_obj, "text_selection_changed");
- }
- else if (g_strcmp0 (pspec->name, "editable") == 0)
- {
- atk_object_notify_state_change (atk_obj, ATK_STATE_EDITABLE,
- clutter_text_get_editable (clutter_text));
- }
- else if (g_strcmp0 (pspec->name, "activatable") == 0)
- {
- _check_activate_action (cally_text, clutter_text);
- }
- else if (g_strcmp0 (pspec->name, "password-char") == 0)
- {
- if (clutter_text_get_password_char (clutter_text) != 0)
- atk_object_set_role (atk_obj, ATK_ROLE_PASSWORD_TEXT);
- else
- atk_object_set_role (atk_obj, ATK_ROLE_TEXT);
- }
- else
- {
- CALLY_ACTOR_CLASS (cally_text_parent_class)->notify_clutter (obj, pspec);
- }
-}
-
-static gboolean
-_check_for_selection_change (CallyText *cally_text,
- ClutterText *clutter_text)
-{
- gboolean ret_val = FALSE;
- gint clutter_pos = -1;
- gint clutter_bound = -1;
-
- clutter_pos = clutter_text_get_cursor_position (clutter_text);
- clutter_bound = clutter_text_get_selection_bound (clutter_text);
-
- if (clutter_pos != clutter_bound)
- {
- if (clutter_pos != cally_text->priv->cursor_position ||
- clutter_bound != cally_text->priv->selection_bound)
- /*
- * This check is here as this function can be called for
- * notification of selection_bound and current_pos. The
- * values of current_pos and selection_bound may be the same
- * for both notifications and we only want to generate one
- * text_selection_changed signal.
- */
- ret_val = TRUE;
- }
- else
- {
- /* We had a selection */
- ret_val = (cally_text->priv->cursor_position != cally_text->priv->selection_bound);
- }
-
- cally_text->priv->cursor_position = clutter_pos;
- cally_text->priv->selection_bound = clutter_bound;
-
- return ret_val;
-}
-
-static gboolean
-_idle_notify_insert (gpointer data)
-{
- CallyText *cally_text = NULL;
-
- cally_text = CALLY_TEXT (data);
- cally_text->priv->insert_idle_handler = 0;
-
- _notify_insert (cally_text);
-
- return FALSE;
-}
-
-static void
-_notify_insert (CallyText *cally_text)
-{
- if (cally_text->priv->signal_name_insert)
- {
- g_signal_emit_by_name (cally_text,
- cally_text->priv->signal_name_insert,
- cally_text->priv->position_insert,
- cally_text->priv->length_insert);
- cally_text->priv->signal_name_insert = NULL;
- }
-}
-
-static void
-_notify_delete (CallyText *cally_text)
-{
- if (cally_text->priv->signal_name_delete)
- {
- g_signal_emit_by_name (cally_text,
- cally_text->priv->signal_name_delete,
- cally_text->priv->position_delete,
- cally_text->priv->length_delete);
- cally_text->priv->signal_name_delete = NULL;
- }
-}
-/* atkaction */
-
-static void
-_cally_text_activate_action (CallyActor *cally_actor)
-{
- ClutterActor *actor = NULL;
-
- actor = CALLY_GET_CLUTTER_ACTOR (cally_actor);
-
- clutter_text_activate (CLUTTER_TEXT (actor));
-}
-
-static void
-_check_activate_action (CallyText *cally_text,
- ClutterText *clutter_text)
-{
-
- if (clutter_text_get_activatable (clutter_text))
- {
- if (cally_text->priv->activate_action_id != 0)
- return;
-
- cally_text->priv->activate_action_id = cally_actor_add_action (CALLY_ACTOR (cally_text),
- "activate", NULL, NULL,
- _cally_text_activate_action);
- }
- else
- {
- if (cally_text->priv->activate_action_id == 0)
- return;
-
- if (cally_actor_remove_action (CALLY_ACTOR (cally_text),
- cally_text->priv->activate_action_id))
- {
- cally_text->priv->activate_action_id = 0;
- }
- }
-}
-
-/* GailTextUtil/GailMisc reimplementation methods */
-
-/**
- * _cally_misc_add_attribute:
- *
- * Reimplementation of gail_misc_layout_get_run_attributes (check this
- * function for more documentation).
- *
- * Returns: A pointer to the new #AtkAttributeSet.
- **/
-static AtkAttributeSet*
-_cally_misc_add_attribute (AtkAttributeSet *attrib_set,
- AtkTextAttribute attr,
- gchar *value)
-{
- AtkAttributeSet *return_set;
- AtkAttribute *at = g_malloc (sizeof (AtkAttribute));
- at->name = g_strdup (atk_text_attribute_get_name (attr));
- at->value = value;
- return_set = g_slist_prepend(attrib_set, at);
- return return_set;
-}
-
-
-static gint
-_cally_atk_attribute_lookup_func (gconstpointer data,
- gconstpointer user_data)
-{
- AtkTextAttribute attr = (AtkTextAttribute) GPOINTER_TO_INT (user_data);
- AtkAttribute *at = (AtkAttribute *) data;
- if (!g_strcmp0 (at->name, atk_text_attribute_get_name (attr)))
- return 0;
- return -1;
-}
-
-static gboolean
-_cally_misc_find_atk_attribute (AtkAttributeSet *attrib_set,
- AtkTextAttribute attr)
-{
- GSList* result = g_slist_find_custom ((GSList*) attrib_set,
- (gconstpointer) attr,
- _cally_atk_attribute_lookup_func);
- return (result != NULL);
-}
-
-/**
- * _cally_misc_layout_atk_attributes_from_pango:
- *
- * Store the pango attributes as their ATK equivalent in an existing
- * #AtkAttributeSet.
- *
- * Returns: A pointer to the updated #AtkAttributeSet.
- **/
-static AtkAttributeSet*
-_cally_misc_layout_atk_attributes_from_pango (AtkAttributeSet *attrib_set,
- PangoAttrIterator *iter)
-{
- PangoAttrString *pango_string;
- PangoAttrInt *pango_int;
- PangoAttrColor *pango_color;
- PangoAttrLanguage *pango_lang;
- PangoAttrFloat *pango_float;
- gchar *value = NULL;
-
- if ((pango_string = (PangoAttrString*) pango_attr_iterator_get (iter,
- PANGO_ATTR_FAMILY)) != NULL)
- {
- value = g_strdup_printf("%s", pango_string->value);
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_FAMILY_NAME,
- value);
- }
- if ((pango_int = (PangoAttrInt*) pango_attr_iterator_get (iter,
- PANGO_ATTR_STYLE)) != NULL)
- {
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_STYLE,
- g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_STYLE, pango_int->value)));
- }
- if ((pango_int = (PangoAttrInt*) pango_attr_iterator_get (iter,
- PANGO_ATTR_WEIGHT)) != NULL)
- {
- value = g_strdup_printf("%i", pango_int->value);
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_WEIGHT,
- value);
- }
- if ((pango_int = (PangoAttrInt*) pango_attr_iterator_get (iter,
- PANGO_ATTR_VARIANT)) != NULL)
- {
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_VARIANT,
- g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_VARIANT, pango_int->value)));
- }
- if ((pango_int = (PangoAttrInt*) pango_attr_iterator_get (iter,
- PANGO_ATTR_STRETCH)) != NULL)
- {
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_STRETCH,
- g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_STRETCH, pango_int->value)));
- }
- if ((pango_int = (PangoAttrInt*) pango_attr_iterator_get (iter,
- PANGO_ATTR_SIZE)) != NULL)
- {
- value = g_strdup_printf("%i", pango_int->value / PANGO_SCALE);
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_SIZE,
- value);
- }
- if ((pango_int = (PangoAttrInt*) pango_attr_iterator_get (iter,
- PANGO_ATTR_UNDERLINE)) != NULL)
- {
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_UNDERLINE,
- g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_UNDERLINE, pango_int->value)));
- }
- if ((pango_int = (PangoAttrInt*) pango_attr_iterator_get (iter,
- PANGO_ATTR_STRIKETHROUGH)) != NULL)
- {
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_STRIKETHROUGH,
- g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_STRIKETHROUGH, pango_int->value)));
- }
- if ((pango_int = (PangoAttrInt*) pango_attr_iterator_get (iter,
- PANGO_ATTR_RISE)) != NULL)
- {
- value = g_strdup_printf("%i", pango_int->value);
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_RISE,
- value);
- }
- if ((pango_lang = (PangoAttrLanguage*) pango_attr_iterator_get (iter,
- PANGO_ATTR_LANGUAGE)) != NULL)
- {
- value = g_strdup( pango_language_to_string( pango_lang->value));
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_LANGUAGE,
- value);
- }
- if ((pango_float = (PangoAttrFloat*) pango_attr_iterator_get (iter,
- PANGO_ATTR_SCALE)) != NULL)
- {
- value = g_strdup_printf("%g", pango_float->value);
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_SCALE,
- value);
- }
- if ((pango_color = (PangoAttrColor*) pango_attr_iterator_get (iter,
- PANGO_ATTR_FOREGROUND)) != NULL)
- {
- value = g_strdup_printf ("%u,%u,%u",
- pango_color->color.red,
- pango_color->color.green,
- pango_color->color.blue);
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_FG_COLOR,
- value);
- }
- if ((pango_color = (PangoAttrColor*) pango_attr_iterator_get (iter,
- PANGO_ATTR_BACKGROUND)) != NULL)
- {
- value = g_strdup_printf ("%u,%u,%u",
- pango_color->color.red,
- pango_color->color.green,
- pango_color->color.blue);
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_BG_COLOR,
- value);
- }
-
- return attrib_set;
-}
-
-static AtkAttributeSet*
-_cally_misc_add_actor_color_to_attribute_set (AtkAttributeSet *attrib_set,
- ClutterText *clutter_text)
-{
- ClutterColor color;
- gchar *value;
-
- clutter_text_get_color (clutter_text, &color);
- value = g_strdup_printf ("%u,%u,%u",
- (guint) (color.red * 65535 / 255),
- (guint) (color.green * 65535 / 255),
- (guint) (color.blue * 65535 / 255));
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_FG_COLOR,
- value);
- return attrib_set;
-}
-
-
-/**
- * _cally_misc_layout_get_run_attributes:
- *
- * Reimplementation of gail_misc_layout_get_run_attributes (check this
- * function for more documentation).
- *
- * Returns: A pointer to the #AtkAttributeSet.
- **/
-static AtkAttributeSet*
-_cally_misc_layout_get_run_attributes (AtkAttributeSet *attrib_set,
- ClutterText *clutter_text,
- gint offset,
- gint *start_offset,
- gint *end_offset)
-{
- PangoAttrIterator *iter;
- PangoAttrList *attr;
- gint index, start_index, end_index;
- gboolean is_next = TRUE;
- glong len;
- PangoLayout *layout = clutter_text_get_layout (clutter_text);
- gchar *text = (gchar*) clutter_text_get_text (clutter_text);
-
- len = g_utf8_strlen (text, -1);
- /* Grab the attributes of the PangoLayout, if any */
- if ((attr = pango_layout_get_attributes (layout)) == NULL)
- {
- *start_offset = 0;
- *end_offset = len;
- _cally_misc_add_actor_color_to_attribute_set (attrib_set, clutter_text);
- }
- else
- {
- iter = pango_attr_list_get_iterator (attr);
- /* Get invariant range offsets */
- /* If offset out of range, set offset in range */
- if (offset > len)
- offset = len;
- else if (offset < 0)
- offset = 0;
-
- index = g_utf8_offset_to_pointer (text, offset) - text;
- pango_attr_iterator_range (iter, &start_index, &end_index);
- while (is_next)
- {
- if (index >= start_index && index < end_index)
- {
- *start_offset = g_utf8_pointer_to_offset (text,
- text + start_index);
- if (end_index == G_MAXINT)
- /* Last iterator */
- end_index = len;
-
- *end_offset = g_utf8_pointer_to_offset (text,
- text + end_index);
- break;
- }
- is_next = pango_attr_iterator_next (iter);
- pango_attr_iterator_range (iter, &start_index, &end_index);
- }
-
- /* Get attributes */
- attrib_set = _cally_misc_layout_atk_attributes_from_pango (attrib_set, iter);
- pango_attr_iterator_destroy (iter);
- }
-
- if (!_cally_misc_find_atk_attribute (attrib_set, ATK_TEXT_ATTR_FG_COLOR))
- attrib_set = _cally_misc_add_actor_color_to_attribute_set (attrib_set, clutter_text);
-
- return attrib_set;
-}
-
-
-/**
- * _cally_misc_layout_get_default_attributes:
- *
- * Reimplementation of gail_misc_layout_get_default_attributes (check this
- * function for more documentation).
- *
- * Returns: A pointer to the #AtkAttributeSet.
- **/
-static AtkAttributeSet*
-_cally_misc_layout_get_default_attributes (AtkAttributeSet *attrib_set,
- ClutterText *clutter_text)
-{
- PangoLayout *layout;
- PangoContext *context;
- PangoLanguage* language;
- PangoFontDescription* font;
- PangoWrapMode mode;
- gchar *value = NULL;
- gint int_value;
- ClutterTextDirection text_direction;
- PangoAttrIterator *iter;
- PangoAttrList *attr;
-
- text_direction = clutter_actor_get_text_direction (CLUTTER_ACTOR (clutter_text));
- switch (text_direction)
- {
- case CLUTTER_TEXT_DIRECTION_DEFAULT:
- value = g_strdup ("none");
- break;
-
- case CLUTTER_TEXT_DIRECTION_LTR:
- value = g_strdup ("ltr");
- break;
-
- case CLUTTER_TEXT_DIRECTION_RTL:
- value = g_strdup ("rtl");
- break;
-
- default:
- value = g_strdup ("none");
- break;
- }
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_DIRECTION,
- value);
-
- layout = clutter_text_get_layout (clutter_text);
- context = pango_layout_get_context (layout);
- if (context)
- {
- if ((language = pango_context_get_language (context)))
- {
- value = g_strdup (pango_language_to_string (language));
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_LANGUAGE, value);
- }
-
- if ((font = pango_context_get_font_description (context)))
- {
- value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_STYLE,
- pango_font_description_get_style (font)));
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_STYLE,
- value);
-
- value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_VARIANT,
- pango_font_description_get_variant (font)));
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_VARIANT, value);
-
- value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_STRETCH,
- pango_font_description_get_stretch (font)));
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_STRETCH, value);
-
- value = g_strdup (pango_font_description_get_family (font));
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_FAMILY_NAME, value);
- value = g_strdup_printf ("%d", pango_font_description_get_weight (font));
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_WEIGHT, value);
-
- value = g_strdup_printf ("%i", pango_font_description_get_size (font) / PANGO_SCALE);
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_SIZE, value);
-
- }
-
- }
-
- if (pango_layout_get_justify (layout))
- int_value = 3;
- else
- {
- PangoAlignment align;
-
- align = pango_layout_get_alignment (layout);
- if (align == PANGO_ALIGN_LEFT)
- int_value = 0;
- else if (align == PANGO_ALIGN_CENTER)
- int_value = 2;
- else /* if (align == PANGO_ALIGN_RIGHT) */
- int_value = 1;
- }
- value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_JUSTIFICATION,
- int_value));
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_JUSTIFICATION,
- value);
-
- mode = pango_layout_get_wrap (layout);
- if (mode == PANGO_WRAP_WORD)
- int_value = 2;
- else /* if (mode == PANGO_WRAP_CHAR) */
- int_value = 1;
- value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_WRAP_MODE,
- int_value));
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_WRAP_MODE, value);
-
- if ((attr = clutter_text_get_attributes (clutter_text)))
- {
- iter = pango_attr_list_get_iterator (attr);
- /* Get attributes */
- attrib_set = _cally_misc_layout_atk_attributes_from_pango (attrib_set, iter);
- pango_attr_iterator_destroy (iter);
- }
-
-
- if (!_cally_misc_find_atk_attribute (attrib_set, ATK_TEXT_ATTR_FG_COLOR))
- attrib_set = _cally_misc_add_actor_color_to_attribute_set (attrib_set,
- clutter_text);
-
- value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_FG_STIPPLE, 0));
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_FG_STIPPLE,
- value);
-
- value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_BG_STIPPLE, 0));
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_BG_STIPPLE,
- value);
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_BG_FULL_HEIGHT,
- g_strdup_printf ("%i", 0));
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_PIXELS_INSIDE_WRAP,
- g_strdup_printf ("%i", 0));
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_PIXELS_BELOW_LINES,
- g_strdup_printf ("%i", 0));
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_PIXELS_ABOVE_LINES,
- g_strdup_printf ("%i", 0));
- value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_EDITABLE,
- clutter_text_get_editable (clutter_text)));
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_EDITABLE,
- value);
-
- value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_INVISIBLE,
- !clutter_actor_is_visible (CLUTTER_ACTOR (clutter_text))));
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_INVISIBLE, value);
-
- value = g_strdup_printf ("%i", pango_layout_get_indent (layout));
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_INDENT, value);
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_RIGHT_MARGIN,
- g_strdup_printf ("%i", 0));
- attrib_set = _cally_misc_add_attribute (attrib_set,
- ATK_TEXT_ATTR_LEFT_MARGIN,
- g_strdup_printf ("%i", 0));
-
- return attrib_set;
-}
-
-static int
-_cally_misc_get_index_at_point (ClutterText *clutter_text,
- gint x,
- gint y,
- AtkCoordType coords)
-{
- gint index, x_window, y_window, x_toplevel, y_toplevel;
- gint x_temp, y_temp;
- gboolean ret;
- graphene_point3d_t verts[4];
- PangoLayout *layout;
- gint x_layout, y_layout;
-
- clutter_text_get_layout_offsets (clutter_text, &x_layout, &y_layout);
-
- clutter_actor_get_abs_allocation_vertices (CLUTTER_ACTOR (clutter_text), verts);
- x_window = verts[0].x;
- y_window = verts[0].y;
-
- x_temp = x - x_layout - x_window;
- y_temp = y - y_layout - y_window;
-
- if (coords == ATK_XY_SCREEN)
- {
- _cally_actor_get_top_level_origin (CLUTTER_ACTOR (clutter_text), &x_toplevel,
- &y_toplevel);
- x_temp -= x_toplevel;
- y_temp -= y_toplevel;
- }
-
- layout = clutter_text_get_layout (clutter_text);
- ret = pango_layout_xy_to_index (layout,
- x_temp * PANGO_SCALE,
- y_temp * PANGO_SCALE,
- &index, NULL);
-
- if (!ret)
- {
- if (x_temp < 0 || y_temp < 0)
- index = 0;
- else
- index = -1;
- }
- return index;
-}
diff --git a/clutter/clutter/cally/cally-text.h b/clutter/clutter/cally/cally-text.h
deleted file mode 100644
index 070ac9139..000000000
--- a/clutter/clutter/cally/cally-text.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* CALLY - The Clutter Accessibility Implementation Library
- *
- * Copyright (C) 2009 Igalia, S.L.
- *
- * Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __CALLY_TEXT_H__
-#define __CALLY_TEXT_H__
-
-#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <cally/cally.h> can be included directly."
-#endif
-
-#include <clutter/clutter.h>
-#include <cally/cally-actor.h>
-
-G_BEGIN_DECLS
-
-#define CALLY_TYPE_TEXT (cally_text_get_type ())
-#define CALLY_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_TEXT, CallyText))
-#define CALLY_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_TEXT, CallyTextClass))
-#define CALLY_IS_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_TEXT))
-#define CALLY_IS_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_TEXT))
-#define CALLY_TEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_TEXT, CallyTextClass))
-
-typedef struct _CallyText CallyText;
-typedef struct _CallyTextClass CallyTextClass;
-typedef struct _CallyTextPrivate CallyTextPrivate;
-
-/**
- * CallyText:
- *
- * The <structname>CallyText</structname> structure contains only private
- * data and should be accessed using the provided API
- *
- * Since: 1.4
- */
-struct _CallyText
-{
- /*< private >*/
- CallyActor parent;
-
- CallyTextPrivate *priv;
-};
-
-/**
- * CallyTextClass:
- *
- * The <structname>CallyTextClass</structname> structure contains only
- * private data
- *
- * Since: 1.4
- */
-struct _CallyTextClass
-{
- /*< private >*/
- CallyActorClass parent_class;
-
- /* padding for future expansion */
- gpointer _padding_dummy[8];
-};
-
-CLUTTER_EXPORT
-GType cally_text_get_type (void) G_GNUC_CONST;
-CLUTTER_EXPORT
-AtkObject* cally_text_new (ClutterActor *actor);
-
-G_END_DECLS
-
-#endif /* __CALLY_TEXT_H__ */
diff --git a/clutter/clutter/cally/cally-util.c b/clutter/clutter/cally/cally-util.c
deleted file mode 100644
index ebb69f8ee..000000000
--- a/clutter/clutter/cally/cally-util.c
+++ /dev/null
@@ -1,452 +0,0 @@
-/* CALLY - The Clutter Accessibility Implementation Library
- *
- * Copyright (C) 2008 Igalia, S.L.
- *
- * Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
- *
- * Based on GailUtil from GAIL
- * Copyright 2001, 2002, 2003 Sun Microsystems Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:cally-util
- * @Title: CallyUtil
- * @short_description: #AtkUtil implementation
- * @see_also: #ClutterActor
- *
- * #CallyUtil implements #AtkUtil abstract methods. Although it
- * includes the name "Util" it is in fact one of the most important
- * interfaces to be implemented in any ATK toolkit implementation.
-
- * For instance, it defines atk_get_root(), the method that returns
- * the root object in the hierarchy. Without it, you don't have
- * available any accessible object.
- */
-
-#include "clutter-build-config.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <clutter/clutter.h>
-
-#include "cally-util.h"
-#include "cally-root.h"
-#include "cally-stage.h"
-
-#define DEFAULT_PASSWORD_CHAR '*'
-
-/* atkutil.h */
-
-static guint cally_util_add_key_event_listener (AtkKeySnoopFunc listener,
- gpointer data);
-static void cally_util_remove_key_event_listener (guint remove_listener);
-static AtkObject* cally_util_get_root (void);
-static const gchar * cally_util_get_toolkit_name (void);
-static const gchar * cally_util_get_toolkit_version (void);
-
-/* private */
-static void cally_util_simulate_snooper_install (void);
-static void cally_util_simulate_snooper_remove (void);
-static gboolean cally_key_snooper (ClutterActor *actor,
- ClutterEvent *event,
- gpointer user_data);
-static void cally_util_stage_added_cb (ClutterStageManager *stage_manager,
- ClutterStage *stage,
- gpointer data);
-static void cally_util_stage_removed_cb (ClutterStageManager *stage_manager,
- ClutterStage *stage,
- gpointer data);
-static gboolean notify_hf (gpointer key,
- gpointer value,
- gpointer data);
-static void insert_hf (gpointer key,
- gpointer value,
- gpointer data);
-
-/* This is just a copy of the Gail one, a shared library or place to
- define it could be a good idea. */
-typedef struct _CallyKeyEventInfo CallyKeyEventInfo;
-
-struct _CallyKeyEventInfo
-{
- AtkKeySnoopFunc listener;
- gpointer func_data;
-};
-
-static AtkObject* root = NULL;
-static GHashTable *key_listener_list = NULL;
-
-
-G_DEFINE_TYPE (CallyUtil, cally_util, ATK_TYPE_UTIL);
-
-static void
-cally_util_class_init (CallyUtilClass *klass)
-{
- AtkUtilClass *atk_class;
- gpointer data;
-
- data = g_type_class_peek (ATK_TYPE_UTIL);
- atk_class = ATK_UTIL_CLASS (data);
-
- atk_class->add_key_event_listener = cally_util_add_key_event_listener;
- atk_class->remove_key_event_listener = cally_util_remove_key_event_listener;
- atk_class->get_root = cally_util_get_root;
- atk_class->get_toolkit_name = cally_util_get_toolkit_name;
- atk_class->get_toolkit_version = cally_util_get_toolkit_version;
-
- /* FIXME: Instead of create this on the class, I think that would
- worth to implement CallyUtil as a singleton instance, so the
- class methods will access this instance. This will be a good
- future enhancement, meanwhile, just using the same *working*
- implementation used on GailUtil */
-}
-
-static void
-cally_util_init (CallyUtil *cally_util)
-{
- /* instance init: usually not required */
-}
-
-/* ------------------------------ ATK UTIL METHODS -------------------------- */
-
-static AtkObject*
-cally_util_get_root (void)
-{
- if (!root)
- root = cally_root_new ();
-
- return root;
-}
-
-static const gchar *
-cally_util_get_toolkit_name (void)
-{
- return "clutter";
-}
-
-static const gchar *
-cally_util_get_toolkit_version (void)
-{
- return MUTTER_VERSION;
-}
-
-static guint
-cally_util_add_key_event_listener (AtkKeySnoopFunc listener,
- gpointer data)
-{
- static guint key = 1;
- CallyKeyEventInfo *event_info = NULL;
-
- if (!key_listener_list)
- {
- key_listener_list = g_hash_table_new_full (NULL, NULL, NULL, g_free);
-
- cally_util_simulate_snooper_install ();
- }
-
- event_info = g_new (CallyKeyEventInfo, 1);
- event_info->listener = listener;
- event_info->func_data = data;
-
- g_hash_table_insert (key_listener_list, GUINT_TO_POINTER (key++), event_info);
- /* XXX: we don't check to see if n_listeners > MAXUINT */
- return key - 1;
-}
-
-static void
-cally_util_remove_key_event_listener (guint remove_listener)
-{
- if (!g_hash_table_remove (key_listener_list, GUINT_TO_POINTER (remove_listener))) {
- g_warning ("Not able to remove listener with id %i", remove_listener);
- }
-
- if (g_hash_table_size (key_listener_list) == 0)
- {
- g_hash_table_destroy (key_listener_list);
- key_listener_list = NULL;
- cally_util_simulate_snooper_remove ();
- }
-}
-
-/* ------------------------------ PRIVATE FUNCTIONS ------------------------- */
-
-/* Trying to emulate gtk_key_snooper install (a kind of wrapper). This
- could be implemented without it, but I will maintain it in this
- way, so if in the future clutter implements it natively it would be
- easier the transition */
-static void
-cally_util_simulate_snooper_install (void)
-{
- ClutterStageManager *stage_manager = NULL;
- ClutterStage *stage = NULL;
- GSList *stage_list = NULL;
- GSList *iter = NULL;
-
- stage_manager = clutter_stage_manager_get_default ();
- stage_list = clutter_stage_manager_list_stages (stage_manager);
-
- for (iter = stage_list; iter != NULL; iter = g_slist_next (iter))
- {
- stage = CLUTTER_STAGE (iter->data);
-
- g_signal_connect (G_OBJECT (stage), "captured-event",
- G_CALLBACK (cally_key_snooper), NULL);
- }
-
- g_signal_connect (G_OBJECT (stage_manager), "stage-added",
- G_CALLBACK (cally_util_stage_added_cb), cally_key_snooper);
- g_signal_connect (G_OBJECT (stage_manager), "stage-removed",
- G_CALLBACK (cally_util_stage_removed_cb), cally_key_snooper);
-
- g_slist_free (stage_list);
-}
-
-static void
-cally_util_simulate_snooper_remove (void)
-{
- ClutterStageManager *stage_manager = NULL;
- ClutterStage *stage = NULL;
- GSList *stage_list = NULL;
- GSList *iter = NULL;
- gint num = 0;
-
- stage_manager = clutter_stage_manager_get_default ();
- stage_list = clutter_stage_manager_list_stages (stage_manager);
-
- for (iter = stage_list; iter != NULL; iter = g_slist_next (iter))
- {
- stage = CLUTTER_STAGE (iter->data);
-
- num += g_signal_handlers_disconnect_by_func (stage, cally_key_snooper, NULL);
- }
-
- g_signal_handlers_disconnect_by_func (G_OBJECT (stage_manager),
- G_CALLBACK (cally_util_stage_added_cb),
- cally_key_snooper);
-
- g_signal_handlers_disconnect_by_func (G_OBJECT (stage_manager),
- G_CALLBACK (cally_util_stage_removed_cb),
- cally_key_snooper);
-
-#ifdef CALLY_DEBUG
- g_print ("Number of snooper callbacks disconnected: %i\n", num);
-#endif
-}
-
-static AtkKeyEventStruct *
-atk_key_event_from_clutter_event_key (ClutterKeyEvent *clutter_event,
- gunichar password_char)
-{
- AtkKeyEventStruct *atk_event = g_new0 (AtkKeyEventStruct, 1);
- gunichar key_unichar;
-
- switch (clutter_event->type)
- {
- case CLUTTER_KEY_PRESS:
- atk_event->type = ATK_KEY_EVENT_PRESS;
- break;
- case CLUTTER_KEY_RELEASE:
- atk_event->type = ATK_KEY_EVENT_RELEASE;
- break;
- default:
- g_assert_not_reached ();
- return NULL;
- }
-
- if (password_char)
- atk_event->state = 0;
- else
- atk_event->state = clutter_event->modifier_state;
-
- /* We emit the clutter keyval. This is not exactly the one expected
- by AtkKeyEventStruct, as it expects a Gdk-like event, with the
- modifiers applied. But to avoid a dependency to gdk, we delegate
- that on the AT application.
- More information: Bug 1952 and bug 2072
- */
- if (password_char)
- atk_event->keyval = clutter_unicode_to_keysym (password_char);
- else
- atk_event->keyval = clutter_event->keyval;
-
- /* It is expected to store a key defining string here (ie "Space" in
- case you press a space). Anyway, there are no function on clutter
- to obtain that, and we want to avoid a gdk dependency here, so we
- delegate on the AT application to obtain that string using the
- rest of the data on the ATK event struct.
-
- More information: Bug 1952 and 2072
- */
-
- if (password_char)
- key_unichar = password_char;
- else
- key_unichar = clutter_event_get_key_unicode ((ClutterEvent *) clutter_event);
-
- if (g_unichar_validate (key_unichar) && !g_unichar_iscntrl (key_unichar))
- {
- GString *new = NULL;
-
- new = g_string_new ("");
- new = g_string_insert_unichar (new, 0, key_unichar);
- atk_event->string = new->str;
- g_string_free (new, FALSE);
- }
- else
- atk_event->string = NULL;
-
- atk_event->length = 0;
-
- /* Computing the hardware keycode from the password-char is
- difficult. But we are in a password situation. We are already a
- unichar that it is not the original one. Providing a "almost
- real" keycode is irrelevant */
- if (password_char)
- atk_event->keycode = 0;
- else
- atk_event->keycode = clutter_event->hardware_keycode;
-
- atk_event->timestamp = clutter_event->time;
-
-#ifdef CALLY_DEBUG
-
- g_debug ("CallyKeyEvent:\tsym 0x%x\n\t\tmods %x\n\t\tcode %u\n\t\ttime %lx \n\t\tstring %s\n",
- (unsigned int) atk_event->keyval,
- (unsigned int) atk_event->state,
- (unsigned int) atk_event->keycode,
- (unsigned long int) atk_event->timestamp,
- atk_event->string);
-#endif
-
- return atk_event;
-}
-
-
-static gboolean
-notify_hf (gpointer key, gpointer value, gpointer data)
-{
- CallyKeyEventInfo *info = (CallyKeyEventInfo *) value;
- AtkKeyEventStruct *key_event = (AtkKeyEventStruct *)data;
-
- return (*(AtkKeySnoopFunc) info->listener) (key_event, info->func_data) ? TRUE : FALSE;
-}
-
-static void
-insert_hf (gpointer key, gpointer value, gpointer data)
-{
- GHashTable *new_table = (GHashTable *) data;
- g_hash_table_insert (new_table, key, value);
-}
-
-
-/*
- * 0 if the key of that event is visible, in other case the password
- * char
- */
-static gunichar
-check_key_visibility (ClutterEvent *event)
-{
- ClutterKeyEvent *key_event = (ClutterKeyEvent *)event;
- AtkObject *accessible = clutter_actor_get_accessible (key_event->source);
-
- g_return_val_if_fail (accessible != NULL, 0);
-
- if (atk_object_get_role (accessible) != ATK_ROLE_PASSWORD_TEXT)
- return 0;
-
- /* If it is a clutter text, we use his password char. Note that
- although at Clutter toolkit itself, only ClutterText exposes a
- password role, nothing prevents on any derived toolkit (like st)
- to create a new actor that can behave like a password entry. And
- the key event will still be emitted here. Although in that case
- we would lose any password char from the derived toolkit, it is
- still better fill this with a default unichar that the original
- one */
-
- if (CLUTTER_IS_TEXT (key_event->source))
- return clutter_text_get_password_char (CLUTTER_TEXT (key_event->source));
- else
- return DEFAULT_PASSWORD_CHAR;
-}
-
-static gboolean
-cally_key_snooper (ClutterActor *actor,
- ClutterEvent *event,
- gpointer user_data)
-{
- AtkKeyEventStruct *key_event = NULL;
- gint consumed = 0;
- gunichar password_char = 0;
-
- /* filter key events */
- if ((event->type != CLUTTER_KEY_PRESS) && (event->type != CLUTTER_KEY_RELEASE))
- {
- return FALSE;
- }
-
- password_char = check_key_visibility (event);
-
- if (key_listener_list)
- {
- GHashTable *new_hash = g_hash_table_new (NULL, NULL);
-
- g_hash_table_foreach (key_listener_list, insert_hf, new_hash);
- key_event = atk_key_event_from_clutter_event_key ((ClutterKeyEvent *)event,
- password_char);
- /* func data is inside the hash table */
- consumed = g_hash_table_foreach_steal (new_hash, notify_hf, key_event);
- g_hash_table_destroy (new_hash);
-
- g_free (key_event->string);
- g_free (key_event);
- }
-
- return (consumed ? 1 : 0);
-}
-
-static void
-cally_util_stage_added_cb (ClutterStageManager *stage_manager,
- ClutterStage *stage,
- gpointer data)
-{
- GCallback cally_key_snooper_cb = G_CALLBACK (data);
-
- g_signal_connect (G_OBJECT (stage), "captured-event", cally_key_snooper_cb, NULL);
-}
-
-static void
-cally_util_stage_removed_cb (ClutterStageManager *stage_manager,
- ClutterStage *stage,
- gpointer data)
-{
- GCallback cally_key_snooper_cb = G_CALLBACK (data);
-
- g_signal_handlers_disconnect_by_func (stage, cally_key_snooper_cb, NULL);
-}
-
-void
-_cally_util_override_atk_util (void)
-{
- AtkUtilClass *atk_class = ATK_UTIL_CLASS (g_type_class_ref (ATK_TYPE_UTIL));
-
- atk_class->add_key_event_listener = cally_util_add_key_event_listener;
- atk_class->remove_key_event_listener = cally_util_remove_key_event_listener;
- atk_class->get_root = cally_util_get_root;
- atk_class->get_toolkit_name = cally_util_get_toolkit_name;
- atk_class->get_toolkit_version = cally_util_get_toolkit_version;
-}
diff --git a/clutter/clutter/cally/cally-util.h b/clutter/clutter/cally/cally-util.h
deleted file mode 100644
index dcc5deb1d..000000000
--- a/clutter/clutter/cally/cally-util.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* CALLY - The Clutter Accessibility Implementation Library
- *
- * Copyright (C) 2008 Igalia, S.L.
- *
- * Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __CALLY_UTIL_H__
-#define __CALLY_UTIL_H__
-
-#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <cally/cally.h> can be included directly."
-#endif
-
-#include <clutter/clutter.h>
-#include <atk/atk.h>
-
-G_BEGIN_DECLS
-
-#define CALLY_TYPE_UTIL (cally_util_get_type ())
-#define CALLY_UTIL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_UTIL, CallyUtil))
-#define CALLY_UTIL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_UTIL, CallyUtilClass))
-#define CALLY_IS_UTIL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_UTIL))
-#define CALLY_IS_UTIL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_UTIL))
-#define CALLY_UTIL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_UTIL, CallyUtilClass))
-
-typedef struct _CallyUtil CallyUtil;
-typedef struct _CallyUtilClass CallyUtilClass;
-typedef struct _CallyUtilPrivate CallyUtilPrivate;
-
-/**
- * CallyUtil:
- *
- * The <structname>CallyUtil</structname> structure contains only
- * private data and should be accessed using the provided API
- *
- * Since: 1.4
- */
-struct _CallyUtil
-{
- /*< private >*/
- AtkUtil parent;
-
- CallyUtilPrivate *priv;
-};
-
-/**
- * CallyUtilClass:
- *
- * The <structname>CallyUtilClass</structname> structure contains only
- * private data
- *
- * Since: 1.4
- */
-struct _CallyUtilClass
-{
- /*< private >*/
- AtkUtilClass parent_class;
-
- /* padding for future expansion */
- gpointer _padding_dummy[8];
-};
-
-CLUTTER_EXPORT
-GType cally_util_get_type (void) G_GNUC_CONST;
-
-void _cally_util_override_atk_util (void);
-
-G_END_DECLS
-
-#endif /* __CALLY_UTIL_H__ */
diff --git a/clutter/clutter/cally/cally.c b/clutter/clutter/cally/cally.c
deleted file mode 100644
index 223aa39e0..000000000
--- a/clutter/clutter/cally/cally.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/* CALLY - The Clutter Accessibility Implementation Library
- *
- * Copyright (C) 2008 Igalia, S.L.
- *
- * Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:cally
- * @Title: Cally
- * @short_description: Cally initialization methods.
- *
- * Cally initialization methods.
- *
- */
-
-#include "clutter-build-config.h"
-
-#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
-
-#include "cally.h"
-
-#include "cally-actor.h"
-#include "cally-stage.h"
-#include "cally-text.h"
-#include "cally-clone.h"
-
-#include "cally-factory.h"
-#include "cally-util.h"
-
-#include "clutter.h"
-
-#include "clutter-debug.h"
-#include "clutter-private.h"
-
-/* factories initialization*/
-CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_ACTOR, cally_actor, cally_actor_new)
-CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_STAGE, cally_stage, cally_stage_new)
-CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_TEXT, cally_text, cally_text_new)
-CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_CLONE, cally_clone, cally_clone_new)
-
-/**
- * cally_accessibility_init:
- *
- * Initializes the accessibility support.
- *
- * Return value: %TRUE if accessibility support has been correctly
- * initialized.
- *
- * Since: 1.4
- */
-gboolean
-cally_accessibility_init (void)
-{
- /* setting the factories */
- CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_ACTOR, cally_actor);
- CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_STAGE, cally_stage);
- CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_TEXT, cally_text);
- CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_CLONE, cally_clone);
-
- /* Initialize the CallyUtility class */
- _cally_util_override_atk_util ();
-
- CLUTTER_NOTE (MISC, "Clutter Accessibility initialized");
-
- return TRUE;
-}
-
-/**
- * cally_get_cally_initialized:
- *
- * Returns if the accessibility support using cally is enabled.
- *
- * Return value: %TRUE if accessibility support has been correctly
- * initialized.
- *
- * Since: 1.4
- */
-gboolean cally_get_cally_initialized (void)
-{
- return !g_strcmp0 (atk_get_toolkit_name (), "clutter");
-}
diff --git a/clutter/clutter/cally/cally.h b/clutter/clutter/cally/cally.h
deleted file mode 100644
index 98c3a4499..000000000
--- a/clutter/clutter/cally/cally.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* CALLY - The Clutter Accessibility Implementation Library
- *
- * Copyright (C) 2008 Igalia, S.L.
- *
- * Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __CALLY_H__
-#define __CALLY_H__
-
-#define __CALLY_H_INSIDE__
-
-#include "cally-actor.h"
-#include "cally-clone.h"
-#include "cally-factory.h"
-#include "cally-main.h"
-#include "cally-root.h"
-#include "cally-stage.h"
-#include "cally-text.h"
-#include "cally-util.h"
-
-#undef __CALLY_H_INSIDE__
-
-#endif /* __CALLY_H__ */
diff --git a/clutter/clutter/clutter-action.c b/clutter/clutter/clutter-action.c
deleted file mode 100644
index a3410f184..000000000
--- a/clutter/clutter/clutter-action.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-action
- * @Title: ClutterAction
- * @Short_Description: Abstract class for event-related logic
- * @See_Also: #ClutterConstraint
- *
- * #ClutterAction is an abstract base class for event-related actions that
- * modify the user interaction of a #ClutterActor, just like
- * #ClutterConstraint is an abstract class for modifiers of an actor's
- * position or size.
- *
- * Implementations of #ClutterAction are associated to an actor and can
- * provide behavioral changes when dealing with user input - for instance
- * drag and drop capabilities, or scrolling, or panning - by using the
- * various event-related signals provided by #ClutterActor itself.
- *
- * #ClutterAction is available since Clutter 1.4
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-action.h"
-
-#include "clutter-debug.h"
-#include "clutter-private.h"
-
-G_DEFINE_ABSTRACT_TYPE (ClutterAction, clutter_action, CLUTTER_TYPE_ACTOR_META);
-
-static void
-clutter_action_class_init (ClutterActionClass *klass)
-{
-}
-
-static void
-clutter_action_init (ClutterAction *self)
-{
-}
diff --git a/clutter/clutter/clutter-action.h b/clutter/clutter/clutter-action.h
deleted file mode 100644
index 8e5ea6c30..000000000
--- a/clutter/clutter/clutter-action.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_ACTION_H__
-#define __CLUTTER_ACTION_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-actor-meta.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_ACTION (clutter_action_get_type ())
-
-CLUTTER_EXPORT
-G_DECLARE_DERIVABLE_TYPE (ClutterAction, clutter_action,
- CLUTTER, ACTION, ClutterActorMeta);
-
-/**
- * ClutterActionClass:
- *
- * The ClutterActionClass structure contains only private data
- *
- * Since: 1.4
- */
-struct _ClutterActionClass
-{
- /*< private >*/
- ClutterActorMetaClass parent_class;
-
- void (* _clutter_action1) (void);
- void (* _clutter_action2) (void);
- void (* _clutter_action3) (void);
- void (* _clutter_action4) (void);
- void (* _clutter_action5) (void);
- void (* _clutter_action6) (void);
- void (* _clutter_action7) (void);
- void (* _clutter_action8) (void);
-};
-
-/* ClutterActor API */
-CLUTTER_EXPORT
-void clutter_actor_add_action (ClutterActor *self,
- ClutterAction *action);
-CLUTTER_EXPORT
-void clutter_actor_add_action_with_name (ClutterActor *self,
- const gchar *name,
- ClutterAction *action);
-CLUTTER_EXPORT
-void clutter_actor_remove_action (ClutterActor *self,
- ClutterAction *action);
-CLUTTER_EXPORT
-void clutter_actor_remove_action_by_name (ClutterActor *self,
- const gchar *name);
-CLUTTER_EXPORT
-ClutterAction *clutter_actor_get_action (ClutterActor *self,
- const gchar *name);
-CLUTTER_EXPORT
-GList * clutter_actor_get_actions (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_clear_actions (ClutterActor *self);
-
-CLUTTER_EXPORT
-gboolean clutter_actor_has_actions (ClutterActor *self);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_ACTION_H__ */
diff --git a/clutter/clutter/clutter-actor-box-private.h b/clutter/clutter/clutter-actor-box-private.h
deleted file mode 100644
index e7aeb8857..000000000
--- a/clutter/clutter/clutter-actor-box-private.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef __CLUTTER_ACTOR_BOX_PRIVATE_H__
-#define __CLUTTER_ACTOR_BOX_PRIVATE_H__
-
-#include <clutter/clutter-types.h>
-
-G_BEGIN_DECLS
-
-void _clutter_actor_box_enlarge_for_effects (ClutterActorBox *box);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_ACTOR_BOX_PRIVATE_H__ */
diff --git a/clutter/clutter/clutter-actor-box.c b/clutter/clutter/clutter-actor-box.c
deleted file mode 100644
index 73f6443d0..000000000
--- a/clutter/clutter/clutter-actor-box.c
+++ /dev/null
@@ -1,647 +0,0 @@
-#include "clutter-build-config.h"
-
-#include <math.h>
-
-#include "clutter-types.h"
-#include "clutter-interval.h"
-#include "clutter-private.h"
-#include "clutter-actor-box-private.h"
-
-/**
- * clutter_actor_box_new:
- * @x_1: X coordinate of the top left point
- * @y_1: Y coordinate of the top left point
- * @x_2: X coordinate of the bottom right point
- * @y_2: Y coordinate of the bottom right point
- *
- * Allocates a new #ClutterActorBox using the passed coordinates
- * for the top left and bottom right points.
- *
- * This function is the logical equivalent of:
- *
- * |[
- * clutter_actor_box_init (clutter_actor_box_alloc (),
- * x_1, y_1,
- * x_2, y_2);
- * ]|
- *
- * Return value: (transfer full): the newly allocated #ClutterActorBox.
- * Use clutter_actor_box_free() to free the resources
- *
- * Since: 1.0
- */
-ClutterActorBox *
-clutter_actor_box_new (gfloat x_1,
- gfloat y_1,
- gfloat x_2,
- gfloat y_2)
-{
- return clutter_actor_box_init (clutter_actor_box_alloc (),
- x_1, y_1,
- x_2, y_2);
-}
-
-/**
- * clutter_actor_box_alloc:
- *
- * Allocates a new #ClutterActorBox.
- *
- * Return value: (transfer full): the newly allocated #ClutterActorBox.
- * Use clutter_actor_box_free() to free its resources
- *
- * Since: 1.12
- */
-ClutterActorBox *
-clutter_actor_box_alloc (void)
-{
- return g_new0 (ClutterActorBox, 1);
-}
-
-/**
- * clutter_actor_box_init:
- * @box: a #ClutterActorBox
- * @x_1: X coordinate of the top left point
- * @y_1: Y coordinate of the top left point
- * @x_2: X coordinate of the bottom right point
- * @y_2: Y coordinate of the bottom right point
- *
- * Initializes @box with the given coordinates.
- *
- * Return value: (transfer none): the initialized #ClutterActorBox
- *
- * Since: 1.10
- */
-ClutterActorBox *
-clutter_actor_box_init (ClutterActorBox *box,
- gfloat x_1,
- gfloat y_1,
- gfloat x_2,
- gfloat y_2)
-{
- g_return_val_if_fail (box != NULL, NULL);
-
- box->x1 = x_1;
- box->y1 = y_1;
- box->x2 = x_2;
- box->y2 = y_2;
-
- return box;
-}
-
-/**
- * clutter_actor_box_init_rect:
- * @box: a #ClutterActorBox
- * @x: X coordinate of the origin
- * @y: Y coordinate of the origin
- * @width: width of the box
- * @height: height of the box
- *
- * Initializes @box with the given origin and size.
- *
- * Since: 1.10
- */
-void
-clutter_actor_box_init_rect (ClutterActorBox *box,
- gfloat x,
- gfloat y,
- gfloat width,
- gfloat height)
-{
- g_return_if_fail (box != NULL);
-
- box->x1 = x;
- box->y1 = y;
- box->x2 = box->x1 + width;
- box->y2 = box->y1 + height;
-}
-
-/**
- * clutter_actor_box_copy:
- * @box: a #ClutterActorBox
- *
- * Copies @box
- *
- * Return value: a newly allocated copy of #ClutterActorBox. Use
- * clutter_actor_box_free() to free the allocated resources
- *
- * Since: 1.0
- */
-ClutterActorBox *
-clutter_actor_box_copy (const ClutterActorBox *box)
-{
- if (G_LIKELY (box != NULL))
- return g_memdup2 (box, sizeof (ClutterActorBox));
-
- return NULL;
-}
-
-/**
- * clutter_actor_box_free:
- * @box: a #ClutterActorBox
- *
- * Frees a #ClutterActorBox allocated using clutter_actor_box_new()
- * or clutter_actor_box_copy()
- *
- * Since: 1.0
- */
-void
-clutter_actor_box_free (ClutterActorBox *box)
-{
- if (G_LIKELY (box != NULL))
- g_free (box);
-}
-
-/**
- * clutter_actor_box_equal:
- * @box_a: a #ClutterActorBox
- * @box_b: a #ClutterActorBox
- *
- * Checks @box_a and @box_b for equality
- *
- * Return value: %TRUE if the passed #ClutterActorBox are equal
- *
- * Since: 1.0
- */
-gboolean
-clutter_actor_box_equal (const ClutterActorBox *box_a,
- const ClutterActorBox *box_b)
-{
- g_return_val_if_fail (box_a != NULL && box_b != NULL, FALSE);
-
- if (box_a == box_b)
- return TRUE;
-
- return box_a->x1 == box_b->x1 && box_a->y1 == box_b->y1 &&
- box_a->x2 == box_b->x2 && box_a->y2 == box_b->y2;
-}
-
-/**
- * clutter_actor_box_get_x:
- * @box: a #ClutterActorBox
- *
- * Retrieves the X coordinate of the origin of @box
- *
- * Return value: the X coordinate of the origin
- *
- * Since: 1.0
- */
-gfloat
-clutter_actor_box_get_x (const ClutterActorBox *box)
-{
- g_return_val_if_fail (box != NULL, 0.);
-
- return box->x1;
-}
-
-/**
- * clutter_actor_box_get_y:
- * @box: a #ClutterActorBox
- *
- * Retrieves the Y coordinate of the origin of @box
- *
- * Return value: the Y coordinate of the origin
- *
- * Since: 1.0
- */
-gfloat
-clutter_actor_box_get_y (const ClutterActorBox *box)
-{
- g_return_val_if_fail (box != NULL, 0.);
-
- return box->y1;
-}
-
-/**
- * clutter_actor_box_get_width:
- * @box: a #ClutterActorBox
- *
- * Retrieves the width of the @box
- *
- * Return value: the width of the box
- *
- * Since: 1.0
- */
-gfloat
-clutter_actor_box_get_width (const ClutterActorBox *box)
-{
- g_return_val_if_fail (box != NULL, 0.);
-
- return box->x2 - box->x1;
-}
-
-/**
- * clutter_actor_box_get_height:
- * @box: a #ClutterActorBox
- *
- * Retrieves the height of the @box
- *
- * Return value: the height of the box
- *
- * Since: 1.0
- */
-gfloat
-clutter_actor_box_get_height (const ClutterActorBox *box)
-{
- g_return_val_if_fail (box != NULL, 0.);
-
- return box->y2 - box->y1;
-}
-
-/**
- * clutter_actor_box_get_origin:
- * @box: a #ClutterActorBox
- * @x: (out) (allow-none): return location for the X coordinate, or %NULL
- * @y: (out) (allow-none): return location for the Y coordinate, or %NULL
- *
- * Retrieves the origin of @box
- *
- * Since: 1.0
- */
-void
-clutter_actor_box_get_origin (const ClutterActorBox *box,
- gfloat *x,
- gfloat *y)
-{
- g_return_if_fail (box != NULL);
-
- if (x)
- *x = box->x1;
-
- if (y)
- *y = box->y1;
-}
-
-/**
- * clutter_actor_box_get_size:
- * @box: a #ClutterActorBox
- * @width: (out) (allow-none): return location for the width, or %NULL
- * @height: (out) (allow-none): return location for the height, or %NULL
- *
- * Retrieves the size of @box
- *
- * Since: 1.0
- */
-void
-clutter_actor_box_get_size (const ClutterActorBox *box,
- gfloat *width,
- gfloat *height)
-{
- g_return_if_fail (box != NULL);
-
- if (width)
- *width = box->x2 - box->x1;
-
- if (height)
- *height = box->y2 - box->y1;
-}
-
-/**
- * clutter_actor_box_get_area:
- * @box: a #ClutterActorBox
- *
- * Retrieves the area of @box
- *
- * Return value: the area of a #ClutterActorBox, in pixels
- *
- * Since: 1.0
- */
-gfloat
-clutter_actor_box_get_area (const ClutterActorBox *box)
-{
- g_return_val_if_fail (box != NULL, 0.);
-
- return (box->x2 - box->x1) * (box->y2 - box->y1);
-}
-
-/**
- * clutter_actor_box_contains:
- * @box: a #ClutterActorBox
- * @x: X coordinate of the point
- * @y: Y coordinate of the point
- *
- * Checks whether a point with @x, @y coordinates is contained
- * within @box
- *
- * Return value: %TRUE if the point is contained by the #ClutterActorBox
- *
- * Since: 1.0
- */
-gboolean
-clutter_actor_box_contains (const ClutterActorBox *box,
- gfloat x,
- gfloat y)
-{
- g_return_val_if_fail (box != NULL, FALSE);
-
- return (x > box->x1 && x < box->x2) &&
- (y > box->y1 && y < box->y2);
-}
-
-/**
- * clutter_actor_box_from_vertices:
- * @box: a #ClutterActorBox
- * @verts: (array fixed-size=4): array of four #graphene_point3d_t
- *
- * Calculates the bounding box represented by the four vertices; for details
- * of the vertex array see clutter_actor_get_abs_allocation_vertices().
- *
- * Since: 1.0
- */
-void
-clutter_actor_box_from_vertices (ClutterActorBox *box,
- const graphene_point3d_t verts[])
-{
- gfloat x_1, x_2, y_1, y_2;
-
- g_return_if_fail (box != NULL);
- g_return_if_fail (verts != NULL);
-
- /* 4-way min/max */
- x_1 = verts[0].x;
- y_1 = verts[0].y;
-
- if (verts[1].x < x_1)
- x_1 = verts[1].x;
-
- if (verts[2].x < x_1)
- x_1 = verts[2].x;
-
- if (verts[3].x < x_1)
- x_1 = verts[3].x;
-
- if (verts[1].y < y_1)
- y_1 = verts[1].y;
-
- if (verts[2].y < y_1)
- y_1 = verts[2].y;
-
- if (verts[3].y < y_1)
- y_1 = verts[3].y;
-
- x_2 = verts[0].x;
- y_2 = verts[0].y;
-
- if (verts[1].x > x_2)
- x_2 = verts[1].x;
-
- if (verts[2].x > x_2)
- x_2 = verts[2].x;
-
- if (verts[3].x > x_2)
- x_2 = verts[3].x;
-
- if (verts[1].y > y_2)
- y_2 = verts[1].y;
-
- if (verts[2].y > y_2)
- y_2 = verts[2].y;
-
- if (verts[3].y > y_2)
- y_2 = verts[3].y;
-
- box->x1 = x_1;
- box->x2 = x_2;
- box->y1 = y_1;
- box->y2 = y_2;
-}
-
-/**
- * clutter_actor_box_interpolate:
- * @initial: the initial #ClutterActorBox
- * @final: the final #ClutterActorBox
- * @progress: the interpolation progress
- * @result: (out): return location for the interpolation
- *
- * Interpolates between @initial and @final #ClutterActorBox<!-- -->es
- * using @progress
- *
- * Since: 1.2
- */
-void
-clutter_actor_box_interpolate (const ClutterActorBox *initial,
- const ClutterActorBox *final,
- gdouble progress,
- ClutterActorBox *result)
-{
- g_return_if_fail (initial != NULL);
- g_return_if_fail (final != NULL);
- g_return_if_fail (result != NULL);
-
- result->x1 = initial->x1 + (final->x1 - initial->x1) * progress;
- result->y1 = initial->y1 + (final->y1 - initial->y1) * progress;
- result->x2 = initial->x2 + (final->x2 - initial->x2) * progress;
- result->y2 = initial->y2 + (final->y2 - initial->y2) * progress;
-}
-
-/**
- * clutter_actor_box_clamp_to_pixel:
- * @box: (inout): the #ClutterActorBox to clamp
- *
- * Clamps the components of @box to the nearest integer
- *
- * Since: 1.2
- */
-void
-clutter_actor_box_clamp_to_pixel (ClutterActorBox *box)
-{
- g_return_if_fail (box != NULL);
-
- box->x1 = floorf (box->x1);
- box->y1 = floorf (box->y1);
- box->x2 = ceilf (box->x2);
- box->y2 = ceilf (box->y2);
-}
-
-/**
- * clutter_actor_box_union:
- * @a: (in): the first #ClutterActorBox
- * @b: (in): the second #ClutterActorBox
- * @result: (out): the #ClutterActorBox representing a union
- * of @a and @b
- *
- * Unions the two boxes @a and @b and stores the result in @result.
- *
- * Since: 1.4
- */
-void
-clutter_actor_box_union (const ClutterActorBox *a,
- const ClutterActorBox *b,
- ClutterActorBox *result)
-{
- g_return_if_fail (a != NULL);
- g_return_if_fail (b != NULL);
- g_return_if_fail (result != NULL);
-
- result->x1 = MIN (a->x1, b->x1);
- result->y1 = MIN (a->y1, b->y1);
-
- result->x2 = MAX (a->x2, b->x2);
- result->y2 = MAX (a->y2, b->y2);
-}
-
-static gboolean
-clutter_actor_box_progress (const GValue *a,
- const GValue *b,
- gdouble factor,
- GValue *retval)
-{
- ClutterActorBox res = { 0, };
-
- clutter_actor_box_interpolate (g_value_get_boxed (a),
- g_value_get_boxed (b),
- factor,
- &res);
-
- g_value_set_boxed (retval, &res);
-
- return TRUE;
-}
-
-/**
- * clutter_actor_box_set_origin:
- * @box: a #ClutterActorBox
- * @x: the X coordinate of the new origin
- * @y: the Y coordinate of the new origin
- *
- * Changes the origin of @box, maintaining the size of the #ClutterActorBox.
- *
- * Since: 1.6
- */
-void
-clutter_actor_box_set_origin (ClutterActorBox *box,
- gfloat x,
- gfloat y)
-{
- gfloat width, height;
-
- g_return_if_fail (box != NULL);
-
- width = box->x2 - box->x1;
- height = box->y2 - box->y1;
-
- clutter_actor_box_init_rect (box, x, y, width, height);
-}
-
-/**
- * clutter_actor_box_set_size:
- * @box: a #ClutterActorBox
- * @width: the new width
- * @height: the new height
- *
- * Sets the size of @box, maintaining the origin of the #ClutterActorBox.
- *
- * Since: 1.6
- */
-void
-clutter_actor_box_set_size (ClutterActorBox *box,
- gfloat width,
- gfloat height)
-{
- g_return_if_fail (box != NULL);
-
- box->x2 = box->x1 + width;
- box->y2 = box->y1 + height;
-}
-
-void
-_clutter_actor_box_enlarge_for_effects (ClutterActorBox *box)
-{
- float width, height;
-
- /* The aim here is that for a given rectangle defined with floating point
- * coordinates we want to determine a stable quantized size in pixels
- * that doesn't vary due to the original box's sub-pixel position.
- *
- * The reason this is important is because effects will use this
- * API to determine the size of offscreen framebuffers and so for
- * a fixed-size object that may be animated across the screen we
- * want to make sure that the stage paint-box has an equally stable
- * size so that effects aren't made to continuously re-allocate
- * a corresponding fbo.
- *
- * The other thing we consider is that the calculation of this box is
- * subject to floating point precision issues that might be slightly
- * different to the precision issues involved with actually painting the
- * actor, which might result in painting slightly leaking outside the
- * user's calculated paint-volume. For this we simply aim to pad out the
- * paint-volume by at least half a pixel all the way around.
- */
- width = box->x2 - box->x1;
- height = box->y2 - box->y1;
- width = CLUTTER_NEARBYINT (width);
- height = CLUTTER_NEARBYINT (height);
- /* XXX: NB the width/height may now be up to 0.5px too small so we
- * must also pad by 0.25px all around to account for this. In total we
- * must padd by at least 0.75px around all sides. */
-
- /* XXX: The furthest that we can overshoot the bottom right corner by
- * here is 1.75px in total if you consider that the 0.75 padding could
- * just cross an integer boundary and so ceil will effectively add 1.
- */
- box->x2 = ceilf (box->x2 + 0.75);
- box->y2 = ceilf (box->y2 + 0.75);
-
- /* Now we redefine the top-left relative to the bottom right based on the
- * rounded width/height determined above + a constant so that the overall
- * size of the box will be stable and not dependent on the box's
- * position.
- *
- * Adding 3px to the width/height will ensure we cover the maximum of
- * 1.75px padding on the bottom/right and still ensure we have > 0.75px
- * padding on the top/left.
- */
- box->x1 = box->x2 - width - 3;
- box->y1 = box->y2 - height - 3;
-}
-
-/**
- * clutter_actor_box_scale:
- * @box: a #ClutterActorBox
- * @scale: scale factor for resizing this box
- *
- * Rescale the @box by provided @scale factor.
- *
- * Since: 1.6
- */
-void
-clutter_actor_box_scale (ClutterActorBox *box,
- gfloat scale)
-{
- g_return_if_fail (box != NULL);
-
- box->x1 *= scale;
- box->x2 *= scale;
- box->y1 *= scale;
- box->y2 *= scale;
-}
-
-/**
- * clutter_actor_box_is_initialized:
- * @box: a #ClutterActorBox
- *
- * Checks if @box has been initialized, a #ClutterActorBox is uninitialized
- * if it has a size of -1 at an origin of 0, 0.
- *
- * Returns: %TRUE if the box is uninitialized, %FALSE if it isn't
- */
-gboolean
-clutter_actor_box_is_initialized (ClutterActorBox *box)
-{
- gboolean x1_uninitialized, x2_uninitialized;
- gboolean y1_uninitialized, y2_uninitialized;
-
- g_return_val_if_fail (box != NULL, TRUE);
-
- x1_uninitialized = isinf (box->x1);
- x2_uninitialized = isinf (box->x2) && signbit (box->x2);
- y1_uninitialized = isinf (box->y1);
- y2_uninitialized = isinf (box->y2) && signbit (box->y2);
-
- return !x1_uninitialized || !x2_uninitialized ||
- !y1_uninitialized || !y2_uninitialized;
-}
-
-G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterActorBox, clutter_actor_box,
- clutter_actor_box_copy,
- clutter_actor_box_free,
- CLUTTER_REGISTER_INTERVAL_PROGRESS (clutter_actor_box_progress));
diff --git a/clutter/clutter/clutter-actor-meta-private.h b/clutter/clutter/clutter-actor-meta-private.h
deleted file mode 100644
index 661c352a5..000000000
--- a/clutter/clutter/clutter-actor-meta-private.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_ACTOR_META_PRIVATE_H__
-#define __CLUTTER_ACTOR_META_PRIVATE_H__
-
-#include <clutter/clutter-actor-meta.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_META_GROUP (_clutter_meta_group_get_type ())
-#define CLUTTER_META_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_META_GROUP, ClutterMetaGroup))
-#define CLUTTER_IS_META_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_META_GROUP))
-
-typedef struct _ClutterMetaGroup ClutterMetaGroup;
-typedef struct _ClutterMetaGroupClass ClutterMetaGroupClass;
-
-struct _ClutterMetaGroup
-{
- GObject parent_instance;
-
- ClutterActor *actor;
-
- GList *meta;
-};
-
-struct _ClutterMetaGroupClass
-{
- GObjectClass parent_class;
-};
-
-/* Each actor meta has a priority with zero as a default. A higher
- number means higher priority. Higher priority metas stay at the
- beginning of the list. The priority can be negative to give lower
- priority than the default. */
-
-#define CLUTTER_ACTOR_META_PRIORITY_DEFAULT 0
-
-/* Any value greater than this is considered an 'internal' priority
- and if we expose the priority property publicly then an application
- would not be able to use these values. */
-
-#define CLUTTER_ACTOR_META_PRIORITY_INTERNAL_HIGH (G_MAXINT / 2)
-#define CLUTTER_ACTOR_META_PRIORITY_INTERNAL_LOW (G_MININT / 2)
-
-GType _clutter_meta_group_get_type (void) G_GNUC_CONST;
-
-void _clutter_meta_group_add_meta (ClutterMetaGroup *group,
- ClutterActorMeta *meta);
-void _clutter_meta_group_remove_meta (ClutterMetaGroup *group,
- ClutterActorMeta *meta);
-const GList * _clutter_meta_group_peek_metas (ClutterMetaGroup *group);
-void _clutter_meta_group_clear_metas (ClutterMetaGroup *group);
-ClutterActorMeta * _clutter_meta_group_get_meta (ClutterMetaGroup *group,
- const gchar *name);
-
-gboolean _clutter_meta_group_has_metas_no_internal (ClutterMetaGroup *group);
-
-GList * _clutter_meta_group_get_metas_no_internal (ClutterMetaGroup *group);
-void _clutter_meta_group_clear_metas_no_internal (ClutterMetaGroup *group);
-
-/* ActorMeta */
-void _clutter_actor_meta_set_actor (ClutterActorMeta *meta,
- ClutterActor *actor);
-
-const gchar * _clutter_actor_meta_get_debug_name (ClutterActorMeta *meta);
-
-void _clutter_actor_meta_set_priority (ClutterActorMeta *meta,
- gint priority);
-int _clutter_actor_meta_get_priority (ClutterActorMeta *meta);
-
-gboolean _clutter_actor_meta_is_internal (ClutterActorMeta *meta);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_ACTOR_META_PRIVATE_H__ */
diff --git a/clutter/clutter/clutter-actor-meta.c b/clutter/clutter/clutter-actor-meta.c
deleted file mode 100644
index 02bbc0135..000000000
--- a/clutter/clutter/clutter-actor-meta.c
+++ /dev/null
@@ -1,723 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-actor-meta
- * @Title: ClutterActorMeta
- * @Short_Description: Base class of actor modifiers
- * @See_Also: #ClutterAction, #ClutterConstraint
- *
- * #ClutterActorMeta is an abstract class providing a common API for
- * modifiers of #ClutterActor behaviour, appearance or layout.
- *
- * A #ClutterActorMeta can only be owned by a single #ClutterActor at
- * any time.
- *
- * Every sub-class of #ClutterActorMeta should check if the
- * #ClutterActorMeta:enabled property is set to %TRUE before applying
- * any kind of modification.
- *
- * #ClutterActorMeta is available since Clutter 1.4
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-actor-meta-private.h"
-
-#include "clutter-debug.h"
-#include "clutter-private.h"
-
-struct _ClutterActorMetaPrivate
-{
- ClutterActor *actor;
- gulong destroy_id;
-
- gchar *name;
-
- guint is_enabled : 1;
-
- gint priority;
-};
-
-enum
-{
- PROP_0,
-
- PROP_ACTOR,
- PROP_NAME,
- PROP_ENABLED,
-
- PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST];
-
-G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterActorMeta,
- clutter_actor_meta,
- G_TYPE_INITIALLY_UNOWNED)
-
-static void
-on_actor_destroy (ClutterActor *actor,
- ClutterActorMeta *meta)
-{
- ClutterActorMetaPrivate *priv =
- clutter_actor_meta_get_instance_private (meta);
-
- priv->actor = NULL;
-}
-
-static void
-clutter_actor_meta_real_set_actor (ClutterActorMeta *meta,
- ClutterActor *actor)
-{
- ClutterActorMetaPrivate *priv =
- clutter_actor_meta_get_instance_private (meta);
-
- g_warn_if_fail (!priv->actor ||
- !CLUTTER_ACTOR_IN_PAINT (priv->actor));
- g_warn_if_fail (!actor || !CLUTTER_ACTOR_IN_PAINT (actor));
-
- if (priv->actor == actor)
- return;
-
- g_clear_signal_handler (&priv->destroy_id, priv->actor);
-
- priv->actor = actor;
-
- if (priv->actor != NULL)
- priv->destroy_id = g_signal_connect (priv->actor, "destroy",
- G_CALLBACK (on_actor_destroy),
- meta);
-}
-
-static void
-clutter_actor_meta_real_set_enabled (ClutterActorMeta *meta,
- gboolean is_enabled)
-{
- ClutterActorMetaPrivate *priv =
- clutter_actor_meta_get_instance_private (meta);
-
- g_warn_if_fail (!priv->actor ||
- !CLUTTER_ACTOR_IN_PAINT (priv->actor));
-
- priv->is_enabled = is_enabled;
-
- g_object_notify_by_pspec (G_OBJECT (meta), obj_props[PROP_ENABLED]);
-}
-
-static void
-clutter_actor_meta_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterActorMeta *meta = CLUTTER_ACTOR_META (gobject);
-
- switch (prop_id)
- {
- case PROP_NAME:
- clutter_actor_meta_set_name (meta, g_value_get_string (value));
- break;
-
- case PROP_ENABLED:
- clutter_actor_meta_set_enabled (meta, g_value_get_boolean (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_actor_meta_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterActorMetaPrivate *priv =
- clutter_actor_meta_get_instance_private (CLUTTER_ACTOR_META (gobject));
-
- switch (prop_id)
- {
- case PROP_ACTOR:
- g_value_set_object (value, priv->actor);
- break;
-
- case PROP_NAME:
- g_value_set_string (value, priv->name);
- break;
-
- case PROP_ENABLED:
- g_value_set_boolean (value, priv->is_enabled);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_actor_meta_finalize (GObject *gobject)
-{
- ClutterActorMetaPrivate *priv =
- clutter_actor_meta_get_instance_private (CLUTTER_ACTOR_META (gobject));
-
- if (priv->actor != NULL)
- g_clear_signal_handler (&priv->destroy_id, priv->actor);
-
- g_free (priv->name);
-
- G_OBJECT_CLASS (clutter_actor_meta_parent_class)->finalize (gobject);
-}
-
-void
-clutter_actor_meta_class_init (ClutterActorMetaClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- klass->set_actor = clutter_actor_meta_real_set_actor;
- klass->set_enabled = clutter_actor_meta_real_set_enabled;
-
- /**
- * ClutterActorMeta:actor:
- *
- * The #ClutterActor attached to the #ClutterActorMeta instance
- *
- * Since: 1.4
- */
- obj_props[PROP_ACTOR] =
- g_param_spec_object ("actor",
- P_("Actor"),
- P_("The actor attached to the meta"),
- CLUTTER_TYPE_ACTOR,
- CLUTTER_PARAM_READABLE);
-
- /**
- * ClutterActorMeta:name:
- *
- * The unique name to access the #ClutterActorMeta
- *
- * Since: 1.4
- */
- obj_props[PROP_NAME] =
- g_param_spec_string ("name",
- P_("Name"),
- P_("The name of the meta"),
- NULL,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterActorMeta:enabled:
- *
- * Whether or not the #ClutterActorMeta is enabled
- *
- * Since: 1.4
- */
- obj_props[PROP_ENABLED] =
- g_param_spec_boolean ("enabled",
- P_("Enabled"),
- P_("Whether the meta is enabled"),
- TRUE,
- CLUTTER_PARAM_READWRITE);
-
- gobject_class->finalize = clutter_actor_meta_finalize;
- gobject_class->set_property = clutter_actor_meta_set_property;
- gobject_class->get_property = clutter_actor_meta_get_property;
- g_object_class_install_properties (gobject_class,
- PROP_LAST,
- obj_props);
-}
-
-void
-clutter_actor_meta_init (ClutterActorMeta *self)
-{
- ClutterActorMetaPrivate *priv =
- clutter_actor_meta_get_instance_private (self);
-
- priv->is_enabled = TRUE;
- priv->priority = CLUTTER_ACTOR_META_PRIORITY_DEFAULT;
-}
-
-/**
- * clutter_actor_meta_set_name:
- * @meta: a #ClutterActorMeta
- * @name: the name of @meta
- *
- * Sets the name of @meta
- *
- * The name can be used to identify the #ClutterActorMeta instance
- *
- * Since: 1.4
- */
-void
-clutter_actor_meta_set_name (ClutterActorMeta *meta,
- const gchar *name)
-{
- ClutterActorMetaPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_ACTOR_META (meta));
-
- priv = clutter_actor_meta_get_instance_private (meta);
-
- if (g_strcmp0 (priv->name, name) == 0)
- return;
-
- g_free (priv->name);
- priv->name = g_strdup (name);
-
- g_object_notify_by_pspec (G_OBJECT (meta), obj_props[PROP_NAME]);
-}
-
-/**
- * clutter_actor_meta_get_name:
- * @meta: a #ClutterActorMeta
- *
- * Retrieves the name set using clutter_actor_meta_set_name()
- *
- * Return value: (transfer none): the name of the #ClutterActorMeta
- * instance, or %NULL if none was set. The returned string is owned
- * by the #ClutterActorMeta instance and it should not be modified
- * or freed
- *
- * Since: 1.4
- */
-const gchar *
-clutter_actor_meta_get_name (ClutterActorMeta *meta)
-{
- ClutterActorMetaPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), NULL);
-
- priv = clutter_actor_meta_get_instance_private (meta);
-
- return priv->name;
-}
-
-/**
- * clutter_actor_meta_set_enabled:
- * @meta: a #ClutterActorMeta
- * @is_enabled: whether @meta is enabled
- *
- * Sets whether @meta should be enabled or not
- *
- * Since: 1.4
- */
-void
-clutter_actor_meta_set_enabled (ClutterActorMeta *meta,
- gboolean is_enabled)
-{
- ClutterActorMetaPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_ACTOR_META (meta));
-
- priv = clutter_actor_meta_get_instance_private (meta);
- is_enabled = !!is_enabled;
-
- if (priv->is_enabled == is_enabled)
- return;
-
- CLUTTER_ACTOR_META_GET_CLASS (meta)->set_enabled (meta, is_enabled);
-}
-
-/**
- * clutter_actor_meta_get_enabled:
- * @meta: a #ClutterActorMeta
- *
- * Retrieves whether @meta is enabled
- *
- * Return value: %TRUE if the #ClutterActorMeta instance is enabled
- *
- * Since: 1.4
- */
-gboolean
-clutter_actor_meta_get_enabled (ClutterActorMeta *meta)
-{
- ClutterActorMetaPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), FALSE);
-
- priv = clutter_actor_meta_get_instance_private (meta);
-
- return priv->is_enabled;
-}
-
-/*
- * _clutter_actor_meta_set_actor
- * @meta: a #ClutterActorMeta
- * @actor: a #ClutterActor or %NULL
- *
- * Sets or unsets a back pointer to the #ClutterActor that owns
- * the @meta
- *
- * Since: 1.4
- */
-void
-_clutter_actor_meta_set_actor (ClutterActorMeta *meta,
- ClutterActor *actor)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR_META (meta));
- g_return_if_fail (actor == NULL || CLUTTER_IS_ACTOR (actor));
-
- CLUTTER_ACTOR_META_GET_CLASS (meta)->set_actor (meta, actor);
-}
-
-/**
- * clutter_actor_meta_get_actor:
- * @meta: a #ClutterActorMeta
- *
- * Retrieves a pointer to the #ClutterActor that owns @meta
- *
- * Return value: (transfer none): a pointer to a #ClutterActor or %NULL
- *
- * Since: 1.4
- */
-ClutterActor *
-clutter_actor_meta_get_actor (ClutterActorMeta *meta)
-{
- ClutterActorMetaPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), NULL);
-
- priv = clutter_actor_meta_get_instance_private (meta);
-
- return priv->actor;
-}
-
-void
-_clutter_actor_meta_set_priority (ClutterActorMeta *meta,
- gint priority)
-{
- ClutterActorMetaPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_ACTOR_META (meta));
-
- priv = clutter_actor_meta_get_instance_private (meta);
-
- /* This property shouldn't be modified after the actor meta is in
- use because ClutterMetaGroup doesn't resort the list when it
- changes. If we made the priority public then we could either make
- the priority a construct-only property or listen for
- notifications on the property from the ClutterMetaGroup and
- resort. */
- g_return_if_fail (priv->actor == NULL);
-
- priv->priority = priority;
-}
-
-gint
-_clutter_actor_meta_get_priority (ClutterActorMeta *meta)
-{
- ClutterActorMetaPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), 0);
-
- priv = clutter_actor_meta_get_instance_private (meta);
-
- return priv->priority;
-}
-
-gboolean
-_clutter_actor_meta_is_internal (ClutterActorMeta *meta)
-{
- ClutterActorMetaPrivate *priv =
- clutter_actor_meta_get_instance_private (meta);
- gint priority = priv->priority;
-
- return (priority <= CLUTTER_ACTOR_META_PRIORITY_INTERNAL_LOW ||
- priority >= CLUTTER_ACTOR_META_PRIORITY_INTERNAL_HIGH);
-}
-
-/*
- * ClutterMetaGroup: a collection of ClutterActorMeta instances
- */
-
-G_DEFINE_TYPE (ClutterMetaGroup, _clutter_meta_group, G_TYPE_OBJECT);
-
-static void
-_clutter_meta_group_dispose (GObject *gobject)
-{
- _clutter_meta_group_clear_metas (CLUTTER_META_GROUP (gobject));
-
- G_OBJECT_CLASS (_clutter_meta_group_parent_class)->dispose (gobject);
-}
-
-static void
-_clutter_meta_group_class_init (ClutterMetaGroupClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- gobject_class->dispose = _clutter_meta_group_dispose;
-}
-
-static void
-_clutter_meta_group_init (ClutterMetaGroup *self)
-{
-}
-
-/*
- * _clutter_meta_group_add_meta:
- * @group: a #ClutterMetaGroup
- * @meta: a #ClutterActorMeta to add
- *
- * Adds @meta to @group
- *
- * This function will remove the floating reference of @meta or, if the
- * floating reference has already been sunk, add a reference to it
- */
-void
-_clutter_meta_group_add_meta (ClutterMetaGroup *group,
- ClutterActorMeta *meta)
-{
- ClutterActorMetaPrivate *priv =
- clutter_actor_meta_get_instance_private (meta);
- GList *prev = NULL, *l;
-
- if (priv->actor != NULL)
- {
- g_warning ("The meta of type '%s' with name '%s' is "
- "already attached to actor '%s'",
- G_OBJECT_TYPE_NAME (meta),
- priv->name != NULL
- ? priv->name
- : "<unknown>",
- clutter_actor_get_name (priv->actor) != NULL
- ? clutter_actor_get_name (priv->actor)
- : G_OBJECT_TYPE_NAME (priv->actor));
- return;
- }
-
- /* Find a meta that has lower priority and insert before that */
- for (l = group->meta; l; l = l->next)
- if (_clutter_actor_meta_get_priority (l->data) <
- _clutter_actor_meta_get_priority (meta))
- break;
- else
- prev = l;
-
- if (prev == NULL)
- group->meta = g_list_prepend (group->meta, meta);
- else
- {
- prev->next = g_list_prepend (prev->next, meta);
- prev->next->prev = prev;
- }
-
- g_object_ref_sink (meta);
-
- _clutter_actor_meta_set_actor (meta, group->actor);
-}
-
-/*
- * _clutter_meta_group_remove_meta:
- * @group: a #ClutterMetaGroup
- * @meta: a #ClutterActorMeta to remove
- *
- * Removes @meta from @group and releases the reference being held on it
- */
-void
-_clutter_meta_group_remove_meta (ClutterMetaGroup *group,
- ClutterActorMeta *meta)
-{
- ClutterActorMetaPrivate *priv =
- clutter_actor_meta_get_instance_private (meta);
-
- if (priv->actor != group->actor)
- {
- g_warning ("The meta of type '%s' with name '%s' is not "
- "attached to the actor '%s'",
- G_OBJECT_TYPE_NAME (meta),
- priv->name != NULL
- ? priv->name
- : "<unknown>",
- clutter_actor_get_name (group->actor) != NULL
- ? clutter_actor_get_name (group->actor)
- : G_OBJECT_TYPE_NAME (group->actor));
- return;
- }
-
- _clutter_actor_meta_set_actor (meta, NULL);
-
- group->meta = g_list_remove (group->meta, meta);
- g_object_unref (meta);
-}
-
-/*
- * _clutter_meta_group_peek_metas:
- * @group: a #ClutterMetaGroup
- *
- * Returns a pointer to the #ClutterActorMeta list
- *
- * Return value: a const pointer to the #GList of #ClutterActorMeta
- */
-const GList *
-_clutter_meta_group_peek_metas (ClutterMetaGroup *group)
-{
- return group->meta;
-}
-
-/*
- * _clutter_meta_group_get_metas_no_internal:
- * @group: a #ClutterMetaGroup
- *
- * Returns a new allocated list containing all of the metas that don't
- * have an internal priority.
- *
- * Return value: A GList containing non-internal metas. Free with
- * g_list_free.
- */
-GList *
-_clutter_meta_group_get_metas_no_internal (ClutterMetaGroup *group)
-{
- GList *ret = NULL;
- GList *l;
-
- /* Build a new list filtering out the internal metas */
- for (l = group->meta; l; l = l->next)
- if (!_clutter_actor_meta_is_internal (l->data))
- ret = g_list_prepend (ret, l->data);
-
- return g_list_reverse (ret);
-}
-
-/*
- * _clutter_meta_group_has_metas_no_internal:
- * @group: a #ClutterMetaGroup
- *
- * Returns whether the group has any metas that don't have an internal priority.
- *
- * Return value: %TRUE if metas without internal priority exist
- * %FALSE otherwise
- */
-gboolean
-_clutter_meta_group_has_metas_no_internal (ClutterMetaGroup *group)
-{
- GList *l;
-
- for (l = group->meta; l; l = l->next)
- if (!_clutter_actor_meta_is_internal (l->data))
- return TRUE;
-
- return FALSE;
-}
-
-/*
- * _clutter_meta_group_clear_metas:
- * @group: a #ClutterMetaGroup
- *
- * Clears @group of all #ClutterActorMeta instances and releases
- * the reference on them
- */
-void
-_clutter_meta_group_clear_metas (ClutterMetaGroup *group)
-{
- g_list_foreach (group->meta, (GFunc) _clutter_actor_meta_set_actor, NULL);
-
- g_list_free_full (group->meta, g_object_unref);
- group->meta = NULL;
-}
-
-/*
- * _clutter_meta_group_clear_metas_no_internal:
- * @group: a #ClutterMetaGroup
- *
- * Clears @group of all #ClutterActorMeta instances that don't have an
- * internal priority and releases the reference on them
- */
-void
-_clutter_meta_group_clear_metas_no_internal (ClutterMetaGroup *group)
-{
- GList *internal_list = NULL;
- GList *l, *next;
-
- for (l = group->meta; l; l = next)
- {
- next = l->next;
-
- if (_clutter_actor_meta_is_internal (l->data))
- {
- if (internal_list)
- internal_list->prev = l;
- l->next = internal_list;
- l->prev = NULL;
- internal_list = l;
- }
- else
- {
- _clutter_actor_meta_set_actor (l->data, NULL);
- g_object_unref (l->data);
- g_list_free_1 (l);
- }
- }
-
- group->meta = g_list_reverse (internal_list);
-}
-
-/*
- * _clutter_meta_group_get_meta:
- * @group: a #ClutterMetaGroup
- * @name: the name of the #ClutterActorMeta to retrieve
- *
- * Retrieves a named #ClutterActorMeta from @group
- *
- * Return value: a #ClutterActorMeta for the given name, or %NULL
- */
-ClutterActorMeta *
-_clutter_meta_group_get_meta (ClutterMetaGroup *group,
- const gchar *name)
-{
- GList *l;
-
- for (l = group->meta; l != NULL; l = l->next)
- {
- ClutterActorMeta *meta = l->data;
- ClutterActorMetaPrivate *priv =
- clutter_actor_meta_get_instance_private (meta);
-
- if (g_strcmp0 (priv->name, name) == 0)
- return meta;
- }
-
- return NULL;
-}
-
-/*< private >
- * clutter_actor_meta_get_debug_name:
- * @meta: a #ClutterActorMeta
- *
- * Retrieves the name of the @meta for debugging purposes.
- *
- * Return value: (transfer none): the name of the @meta. The returned
- * string is owned by the @meta instance and it should not be
- * modified or freed
- */
-const gchar *
-_clutter_actor_meta_get_debug_name (ClutterActorMeta *meta)
-{
- ClutterActorMetaPrivate *priv =
- clutter_actor_meta_get_instance_private (meta);
-
- return priv->name != NULL ? priv->name : G_OBJECT_TYPE_NAME (meta);
-}
diff --git a/clutter/clutter/clutter-actor-meta.h b/clutter/clutter/clutter-actor-meta.h
deleted file mode 100644
index ca337c90d..000000000
--- a/clutter/clutter/clutter-actor-meta.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_ACTOR_META_H__
-#define __CLUTTER_ACTOR_META_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-types.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_ACTOR_META (clutter_actor_meta_get_type ())
-
-CLUTTER_EXPORT
-G_DECLARE_DERIVABLE_TYPE (ClutterActorMeta, clutter_actor_meta,
- CLUTTER, ACTOR_META, GInitiallyUnowned);
-
-typedef struct _ClutterActorMetaPrivate ClutterActorMetaPrivate;
-
-/**
- * ClutterActorMetaClass:
- * @set_actor: virtual function, invoked when attaching and detaching
- * a #ClutterActorMeta instance to a #ClutterActor
- *
- * The #ClutterActorMetaClass structure contains
- * only private data
- *
- * Since: 1.4
- */
-struct _ClutterActorMetaClass
-{
- /*< private >*/
- GInitiallyUnownedClass parent_class;
-
- /*< public >*/
-
- /**
- * ClutterActorMetaClass::set_actor:
- * @meta: a #ClutterActorMeta
- * @actor: (allow-none): the actor attached to @meta, or %NULL
- *
- * Virtual function, called when @meta is attached or detached
- * from a #ClutterActor.
- */
- void (* set_actor) (ClutterActorMeta *meta,
- ClutterActor *actor);
-
- void (* set_enabled) (ClutterActorMeta *meta,
- gboolean is_enabled);
-
- /*< private >*/
- void (* _clutter_meta1) (void);
- void (* _clutter_meta2) (void);
- void (* _clutter_meta3) (void);
- void (* _clutter_meta4) (void);
- void (* _clutter_meta5) (void);
- void (* _clutter_meta6) (void);
-};
-
-CLUTTER_EXPORT
-void clutter_actor_meta_set_name (ClutterActorMeta *meta,
- const gchar *name);
-CLUTTER_EXPORT
-const gchar * clutter_actor_meta_get_name (ClutterActorMeta *meta);
-CLUTTER_EXPORT
-void clutter_actor_meta_set_enabled (ClutterActorMeta *meta,
- gboolean is_enabled);
-CLUTTER_EXPORT
-gboolean clutter_actor_meta_get_enabled (ClutterActorMeta *meta);
-
-CLUTTER_EXPORT
-ClutterActor * clutter_actor_meta_get_actor (ClutterActorMeta *meta);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_ACTOR_META_H__ */
diff --git a/clutter/clutter/clutter-actor-private.h b/clutter/clutter/clutter-actor-private.h
deleted file mode 100644
index 46505777a..000000000
--- a/clutter/clutter/clutter-actor-private.h
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __CLUTTER_ACTOR_PRIVATE_H__
-#define __CLUTTER_ACTOR_PRIVATE_H__
-
-#include <clutter/clutter-actor.h>
-
-G_BEGIN_DECLS
-
-/*< private >
- * ClutterActorTraverseFlags:
- * CLUTTER_ACTOR_TRAVERSE_DEPTH_FIRST: Traverse the graph in
- * a depth first order.
- * CLUTTER_ACTOR_TRAVERSE_BREADTH_FIRST: Traverse the graph in a
- * breadth first order.
- *
- * Controls some options for how clutter_actor_traverse() iterates
- * through the graph.
- */
-typedef enum
-{
- CLUTTER_ACTOR_TRAVERSE_DEPTH_FIRST = 1L<<0,
- CLUTTER_ACTOR_TRAVERSE_BREADTH_FIRST = 1L<<1
-} ClutterActorTraverseFlags;
-
-/*< private >
- * ClutterActorTraverseVisitFlags:
- * CLUTTER_ACTOR_TRAVERSE_VISIT_CONTINUE: Continue traversing as
- * normal
- * CLUTTER_ACTOR_TRAVERSE_VISIT_SKIP_CHILDREN: Don't traverse the
- * children of the last visited actor. (Not applicable when using
- * %CLUTTER_ACTOR_TRAVERSE_DEPTH_FIRST_POST_ORDER since the children
- * are visited before having an opportunity to bail out)
- * CLUTTER_ACTOR_TRAVERSE_VISIT_BREAK: Immediately bail out without
- * visiting any more actors.
- *
- * Each time an actor is visited during a scenegraph traversal the
- * ClutterTraverseCallback can return a set of flags that may affect
- * the continuing traversal. It may stop traversal completely, just
- * skip over children for the current actor or continue as normal.
- */
-typedef enum
-{
- CLUTTER_ACTOR_TRAVERSE_VISIT_CONTINUE = 1L<<0,
- CLUTTER_ACTOR_TRAVERSE_VISIT_SKIP_CHILDREN = 1L<<1,
- CLUTTER_ACTOR_TRAVERSE_VISIT_BREAK = 1L<<2
-} ClutterActorTraverseVisitFlags;
-
-/*< private >
- * ClutterTraverseCallback:
- *
- * The callback prototype used with clutter_actor_traverse. The
- * returned flags can be used to affect the continuing traversal
- * either by continuing as normal, skipping over children of an
- * actor or bailing out completely.
- */
-typedef ClutterActorTraverseVisitFlags (*ClutterTraverseCallback) (ClutterActor *actor,
- gint depth,
- gpointer user_data);
-
-/*< private >
- * ClutterForeachCallback:
- * @actor: The actor being iterated
- * @user_data: The private data specified when starting the iteration
- *
- * A generic callback for iterating over actor, such as with
- * _clutter_actor_foreach_child. The difference when compared to
- * #ClutterCallback is that it returns a boolean so it is possible to break
- * out of an iteration early.
- *
- * Return value: %TRUE to continue iterating or %FALSE to break iteration
- * early.
- */
-typedef gboolean (*ClutterForeachCallback) (ClutterActor *actor,
- gpointer user_data);
-
-typedef struct _SizeRequest SizeRequest;
-
-typedef struct _ClutterLayoutInfo ClutterLayoutInfo;
-typedef struct _ClutterTransformInfo ClutterTransformInfo;
-typedef struct _ClutterAnimationInfo ClutterAnimationInfo;
-
-struct _SizeRequest
-{
- guint age;
- gfloat for_size;
- gfloat min_size;
- gfloat natural_size;
-};
-
-/*< private >
- * ClutterLayoutInfo:
- * @fixed_pos: the fixed position of the actor
- * @margin: the composed margin of the actor
- * @x_align: the horizontal alignment, if the actor expands horizontally
- * @y_align: the vertical alignment, if the actor expands vertically
- * @x_expand: whether the actor should expand horizontally
- * @y_expand: whether the actor should expand vertically
- * @minimum: the fixed minimum size
- * @natural: the fixed natural size
- *
- * Ancillary layout information for an actor.
- */
-struct _ClutterLayoutInfo
-{
- /* fixed position coordinates */
- graphene_point_t fixed_pos;
-
- ClutterMargin margin;
-
- guint x_align : 4;
- guint y_align : 4;
-
- guint x_expand : 1;
- guint y_expand : 1;
-
- graphene_size_t minimum;
- graphene_size_t natural;
-};
-
-const ClutterLayoutInfo * _clutter_actor_get_layout_info_or_defaults (ClutterActor *self);
-ClutterLayoutInfo * _clutter_actor_get_layout_info (ClutterActor *self);
-ClutterLayoutInfo * _clutter_actor_peek_layout_info (ClutterActor *self);
-
-struct _ClutterTransformInfo
-{
- /* rotation */
- gdouble rx_angle;
- gdouble ry_angle;
- gdouble rz_angle;
-
- /* scaling */
- gdouble scale_x;
- gdouble scale_y;
- gdouble scale_z;
-
- /* translation */
- graphene_point3d_t translation;
-
- /* z_position */
- gfloat z_position;
-
- /* transformation center */
- graphene_point_t pivot;
- gfloat pivot_z;
-
- graphene_matrix_t transform;
- guint transform_set : 1;
-
- graphene_matrix_t child_transform;
- guint child_transform_set : 1;
-};
-
-const ClutterTransformInfo * _clutter_actor_get_transform_info_or_defaults (ClutterActor *self);
-ClutterTransformInfo * _clutter_actor_get_transform_info (ClutterActor *self);
-
-typedef struct _AState {
- guint easing_duration;
- guint easing_delay;
- ClutterAnimationMode easing_mode;
-} AState;
-
-struct _ClutterAnimationInfo
-{
- GArray *states;
- AState *cur_state;
-
- GHashTable *transitions;
-};
-
-const ClutterAnimationInfo * _clutter_actor_get_animation_info_or_defaults (ClutterActor *self);
-ClutterAnimationInfo * _clutter_actor_get_animation_info (ClutterActor *self);
-
-ClutterTransition * _clutter_actor_create_transition (ClutterActor *self,
- GParamSpec *pspec,
- ...);
-gboolean _clutter_actor_foreach_child (ClutterActor *self,
- ClutterForeachCallback callback,
- gpointer user_data);
-void _clutter_actor_traverse (ClutterActor *actor,
- ClutterActorTraverseFlags flags,
- ClutterTraverseCallback before_children_callback,
- ClutterTraverseCallback after_children_callback,
- gpointer user_data);
-ClutterActor * _clutter_actor_get_stage_internal (ClutterActor *actor);
-
-void _clutter_actor_apply_modelview_transform (ClutterActor *self,
- graphene_matrix_t *matrix);
-void _clutter_actor_apply_relative_transformation_matrix (ClutterActor *self,
- ClutterActor *ancestor,
- graphene_matrix_t *matrix);
-
-void _clutter_actor_rerealize (ClutterActor *self,
- ClutterCallback callback,
- gpointer data);
-
-void _clutter_actor_set_in_clone_paint (ClutterActor *self,
- gboolean is_in_clone_paint);
-
-void _clutter_actor_set_enable_model_view_transform (ClutterActor *self,
- gboolean enable);
-
-void _clutter_actor_set_enable_paint_unmapped (ClutterActor *self,
- gboolean enable);
-
-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_full (ClutterActor *self,
- const ClutterPaintVolume *volume,
- ClutterEffect *effect);
-
-void _clutter_actor_finish_queue_redraw (ClutterActor *self);
-
-gboolean _clutter_actor_set_default_paint_volume (ClutterActor *self,
- GType check_gtype,
- ClutterPaintVolume *volume);
-
-const gchar * _clutter_actor_get_debug_name (ClutterActor *self);
-
-void _clutter_actor_push_clone_paint (void);
-void _clutter_actor_pop_clone_paint (void);
-
-ClutterActorAlign _clutter_actor_get_effective_x_align (ClutterActor *self);
-
-void _clutter_actor_handle_event (ClutterActor *actor,
- const ClutterEvent *event);
-
-void _clutter_actor_attach_clone (ClutterActor *actor,
- ClutterActor *clone);
-void _clutter_actor_detach_clone (ClutterActor *actor,
- ClutterActor *clone);
-void _clutter_actor_queue_only_relayout (ClutterActor *actor);
-void clutter_actor_clear_stage_views_recursive (ClutterActor *actor);
-
-float clutter_actor_get_real_resource_scale (ClutterActor *actor);
-
-ClutterPaintNode * clutter_actor_create_texture_paint_node (ClutterActor *self,
- CoglTexture *texture);
-
-void clutter_actor_finish_layout (ClutterActor *self,
- int phase);
-
-void clutter_actor_queue_immediate_relayout (ClutterActor *self);
-
-gboolean clutter_actor_is_painting_unmapped (ClutterActor *self);
-
-gboolean clutter_actor_get_redraw_clip (ClutterActor *self,
- ClutterPaintVolume *dst_old_pv,
- ClutterPaintVolume *dst_new_pv);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_ACTOR_PRIVATE_H__ */
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
deleted file mode 100644
index 989e479a8..000000000
--- a/clutter/clutter/clutter-actor.c
+++ /dev/null
@@ -1,19559 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- *
- * Copyright (C) 2006, 2007, 2008 OpenedHand Ltd
- * Copyright (C) 2009, 2010, 2011, 2012 Intel Corp
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * SECTION:clutter-actor
- * @short_description: The basic element of the scene graph
- *
- * The ClutterActor class is the basic element of the scene graph in Clutter,
- * and it encapsulates the position, size, and transformations of a node in
- * the graph.
- *
- * ## Actor transformations ## {#clutter-actor-transformations}
- *
- * Each actor can be transformed using methods like clutter_actor_set_scale()
- * or clutter_actor_set_rotation(). The order in which the transformations are
- * applied is decided by Clutter and it is the following:
- *
- * 1. translation by the origin of the #ClutterActor:allocation property
- * 2. translation by the actor's #ClutterActor:z-position property
- * 3. translation by the actor's #ClutterActor:pivot-point property
- * 4. scaling by the #ClutterActor:scale-x and #ClutterActor:scale-y factors
- * 5. rotation around the #ClutterActor:rotation-angle-x and #ClutterActor:rotation-center-x
- * 6. rotation around the #ClutterActor:rotation-angle-y and #ClutterActor:rotation-center-y
- * 7. rotation around the #ClutterActor:rotation-angle-z and #ClutterActor:rotation-center-z
- * 8. negative translation by the actor's #ClutterActor:pivot-point
- *
- * ## Modifying an actor's geometry ## {#clutter-actor-geometry}
- *
- * Each actor has a bounding box, called #ClutterActor:allocation
- * which is either set by its parent or explicitly through the
- * clutter_actor_set_position() and clutter_actor_set_size() methods.
- * Each actor also has an implicit preferred size.
- *
- * An actor’s preferred size can be defined by any subclass by
- * overriding the #ClutterActorClass.get_preferred_width() and the
- * #ClutterActorClass.get_preferred_height() virtual functions, or it can
- * be explicitly set by using clutter_actor_set_width() and
- * clutter_actor_set_height().
- *
- * An actor’s position can be set explicitly by using
- * clutter_actor_set_x() and clutter_actor_set_y(); the coordinates are
- * relative to the origin of the actor’s parent.
- *
- * ## Managing actor children ## {#clutter-actor-children}
- *
- * Each actor can have multiple children, by calling
- * clutter_actor_add_child() to add a new child actor, and
- * clutter_actor_remove_child() to remove an existing child. #ClutterActor
- * will hold a reference on each child actor, which will be released when
- * the child is removed from its parent, or destroyed using
- * clutter_actor_destroy().
- *
- * |[<!-- language="C" -->
- * ClutterActor *actor = clutter_actor_new ();
- *
- * // set the bounding box of the actor
- * clutter_actor_set_position (actor, 0, 0);
- * clutter_actor_set_size (actor, 480, 640);
- *
- * // set the background color of the actor
- * clutter_actor_set_background_color (actor, CLUTTER_COLOR_Orange);
- *
- * // set the bounding box of the child, relative to the parent
- * ClutterActor *child = clutter_actor_new ();
- * clutter_actor_set_position (child, 20, 20);
- * clutter_actor_set_size (child, 80, 240);
- *
- * // set the background color of the child
- * clutter_actor_set_background_color (child, CLUTTER_COLOR_Blue);
- *
- * // add the child to the actor
- * clutter_actor_add_child (actor, child);
- * ]|
- *
- * Children can be inserted at a given index, or above and below
- * another child actor. The order of insertion determines the order of the
- * children when iterating over them. Iterating over children is performed
- * by using clutter_actor_get_first_child(), clutter_actor_get_previous_sibling(),
- * clutter_actor_get_next_sibling(), and clutter_actor_get_last_child(). It is
- * also possible to retrieve a list of children by using
- * clutter_actor_get_children(), as well as retrieving a specific child at a
- * given index by using clutter_actor_get_child_at_index().
- *
- * If you need to track additions of children to a #ClutterActor, use
- * the #ClutterContainer::actor-added signal; similarly, to track removals
- * of children from a ClutterActor, use the #ClutterContainer::actor-removed
- * signal.
- *
- * See [basic-actor.c](https://git.gnome.org/browse/clutter/tree/examples/basic-actor.c?h=clutter-1.18).
- *
- * ## Painting an actor ## {#clutter-actor-painting}
- *
- * There are three ways to paint an actor:
- *
- * - set a delegate #ClutterContent as the value for the #ClutterActor:content property of the actor
- * - subclass #ClutterActor and override the #ClutterActorClass.paint_node() virtual function
- * - subclass #ClutterActor and override the #ClutterActorClass.paint() virtual function.
- *
- * A #ClutterContent is a delegate object that takes over the painting
- * operations of one, or more actors. The #ClutterContent painting will
- * be performed on top of the #ClutterActor:background-color of the actor,
- * and before calling the actor's own implementation of the
- * #ClutterActorClass.paint_node() virtual function.
- *
- * |[<!-- language="C" -->
- * ClutterActor *actor = clutter_actor_new ();
- *
- * // set the bounding box
- * clutter_actor_set_position (actor, 50, 50);
- * clutter_actor_set_size (actor, 100, 100);
- *
- * // set the content; the image_content variable is set elsewhere
- * clutter_actor_set_content (actor, image_content);
- * ]|
- *
- * The #ClutterActorClass.paint_node() virtual function is invoked whenever
- * an actor needs to be painted. The implementation of the virtual function
- * must only paint the contents of the actor itself, and not the contents of
- * its children, if the actor has any.
- *
- * The #ClutterPaintNode passed to the virtual function is the local root of
- * the render tree; any node added to it will be rendered at the correct
- * position, as defined by the actor's #ClutterActor:allocation.
- *
- * |[<!-- language="C" -->
- * static void
- * my_actor_paint_node (ClutterActor *actor,
- * ClutterPaintNode *root)
- * {
- * ClutterPaintNode *node;
- * ClutterActorBox box;
- *
- * // where the content of the actor should be painted
- * clutter_actor_get_allocation_box (actor, &box);
- *
- * // the cogl_texture variable is set elsewhere
- * node = clutter_texture_node_new (cogl_texture, CLUTTER_COLOR_White,
- * CLUTTER_SCALING_FILTER_TRILINEAR,
- * CLUTTER_SCALING_FILTER_LINEAR);
- *
- * // paint the content of the node using the allocation
- * clutter_paint_node_add_rectangle (node, &box);
- *
- * // add the node, and transfer ownership
- * clutter_paint_node_add_child (root, node);
- * clutter_paint_node_unref (node);
- * }
- *
- * The #ClutterActorClass.paint() virtual function function gives total
- * control to the paint sequence of the actor itself, including the
- * children of the actor, if any. It is strongly discouraged to override
- * the #ClutterActorClass.paint() virtual function and it will be removed
- * when the Clutter API changes.
- *
- * ## Handling events on an actor ## {#clutter-actor-event-handling}
- *
- * A #ClutterActor can receive and handle input device events, for
- * instance pointer events and key events, as long as its
- * #ClutterActor:reactive property is set to %TRUE.
- *
- * Once an actor has been determined to be the source of an event,
- * Clutter will traverse the scene graph from the top-level actor towards the
- * event source, emitting the #ClutterActor::captured-event signal on each
- * ancestor until it reaches the source; this phase is also called
- * the "capture" phase. If the event propagation was not stopped, the graph
- * is walked backwards, from the source actor to the top-level, and the
- * #ClutterActor::event signal is emitted, alongside eventual event-specific
- * signals like #ClutterActor::button-press-event or #ClutterActor::motion-event;
- * this phase is also called the "bubble" phase.
- *
- * At any point of the signal emission, signal handlers can stop the propagation
- * through the scene graph by returning %CLUTTER_EVENT_STOP; otherwise, they can
- * continue the propagation by returning %CLUTTER_EVENT_PROPAGATE.
- *
- * ## Animation ## {#clutter-actor-animation}
- *
- * Animation is a core concept of modern user interfaces; Clutter provides a
- * complete and powerful animation framework that automatically tweens the
- * actor's state without requiring direct, frame by frame manipulation from
- * your application code. You have two models at your disposal:
- *
- * - an implicit animation model
- * - an explicit animation model
- *
- * The implicit animation model of Clutter assumes that all the
- * changes in an actor state should be gradual and asynchronous; Clutter
- * will automatically transition an actor's property change between the
- * current state and the desired one without manual intervention, if the
- * property is defined to be animatable in its documentation.
- *
- * By default, in the 1.0 API series, the transition happens with a duration
- * of zero milliseconds, and the implicit animation is an opt in feature to
- * retain backwards compatibility.
- *
- * Implicit animations depend on the current easing state; in order to use
- * the default easing state for an actor you should call the
- * clutter_actor_save_easing_state() function:
- *
- * |[<!-- language="C" -->
- * // assume that the actor is currently positioned at (100, 100)
- *
- * // store the current easing state and reset the new easing state to
- * // its default values
- * clutter_actor_save_easing_state (actor);
- *
- * // change the actor's position
- * clutter_actor_set_position (actor, 500, 500);
- *
- * // restore the previously saved easing state
- * clutter_actor_restore_easing_state (actor);
- * ]|
- *
- * The example above will trigger an implicit animation of the
- * actor between its current position to a new position.
- *
- * Implicit animations use a default duration of 250 milliseconds,
- * and a default easing mode of %CLUTTER_EASE_OUT_CUBIC, unless you call
- * clutter_actor_set_easing_mode() and clutter_actor_set_easing_duration()
- * after changing the easing state of the actor.
- *
- * It is possible to animate multiple properties of an actor
- * at the same time, and you can animate multiple actors at the same
- * time as well, for instance:
- *
- * |[<!-- language="C" -->
- * clutter_actor_save_easing_state (actor);
- *
- * // animate the actor's opacity and depth
- * clutter_actor_set_opacity (actor, 0);
- * clutter_actor_set_z_position (actor, -100);
- *
- * clutter_actor_restore_easing_state (actor);
- *
- * clutter_actor_save_easing_state (another_actor);
- *
- * // animate another actor's opacity
- * clutter_actor_set_opacity (another_actor, 255);
- * clutter_actor_set_z_position (another_actor, 100);
- *
- * clutter_actor_restore_easing_state (another_actor);
- * ]|
- *
- * Changing the easing state will affect all the following property
- * transitions, but will not affect existing transitions.
- *
- * It is important to note that if you modify the state on an
- * animatable property while a transition is in flight, the transition's
- * final value will be updated, as well as its duration and progress
- * mode by using the current easing state; for instance, in the following
- * example:
- *
- * |[<!-- language="C" -->
- * clutter_actor_save_easing_state (actor);
- * clutter_actor_set_easing_duration (actor, 1000);
- * clutter_actor_set_x (actor, 200);
- * clutter_actor_restore_easing_state (actor);
- *
- * clutter_actor_save_easing_state (actor);
- * clutter_actor_set_easing_duration (actor, 500);
- * clutter_actor_set_x (actor, 100);
- * clutter_actor_restore_easing_state (actor);
- * ]|
- *
- * the first call to clutter_actor_set_x() will begin a transition
- * of the #ClutterActor:x property from the current value to the value of
- * 200 over a duration of one second; the second call to clutter_actor_set_x()
- * will change the transition's final value to 100 and the duration to 500
- * milliseconds.
- *
- * It is possible to receive a notification of the completion of an
- * implicit transition by using the #ClutterActor::transition-stopped
- * signal, decorated with the name of the property. In case you want to
- * know when all the currently in flight transitions are complete, use
- * the #ClutterActor::transitions-completed signal instead.
- *
- * It is possible to retrieve the #ClutterTransition used by the
- * animatable properties by using clutter_actor_get_transition() and using
- * the property name as the transition name.
- *
- * The explicit animation model supported by Clutter requires that
- * you create a #ClutterTransition object, and optionally set the initial
- * and final values. The transition will not start unless you add it to the
- * #ClutterActor.
- *
- * |[<!-- language="C" -->
- * ClutterTransition *transition;
- *
- * transition = clutter_property_transition_new_for_actor (actor, "opacity");
- * clutter_timeline_set_duration (CLUTTER_TIMELINE (transition), 3000);
- * clutter_timeline_set_repeat_count (CLUTTER_TIMELINE (transition), 2);
- * clutter_timeline_set_auto_reverse (CLUTTER_TIMELINE (transition), TRUE);
- * clutter_transition_set_from (transition, G_TYPE_UINT, 255);
- * clutter_transition_set_to (transition, G_TYPE_UINT, 0);
- *
- * clutter_actor_add_transition (actor, "animate-opacity", transition);
- * ]|
- *
- * The example above will animate the #ClutterActor:opacity property
- * of an actor between fully opaque and fully transparent, and back, over
- * a span of 3 seconds. The animation does not begin until it is added to
- * the actor.
- *
- * The explicit animation API applies to all #GObject properties,
- * as well as the custom properties defined through the #ClutterAnimatable
- * interface, regardless of whether they are defined as implicitly
- * animatable or not.
- *
- * The explicit animation API should also be used when using custom
- * animatable properties for #ClutterAction, #ClutterConstraint, and
- * #ClutterEffect instances associated to an actor; see the section on
- * custom animatable properties below for an example.
- *
- * Finally, explicit animations are useful for creating animations
- * that run continuously, for instance:
- *
- * |[<!-- language="C" -->
- * // this animation will pulse the actor's opacity continuously
- * ClutterTransition *transition;
- * ClutterInterval *interval;
- *
- * transition = clutter_property_transition_new_for_actor (actor, "opacity");
- *
- * // we want to animate the opacity between 0 and 255
- * clutter_transition_set_from (transition, G_TYPE_UINT, 0);
- * clutter_transition_set_to (transition, G_TYPE_UINT, 255);
- *
- * // over a one second duration, running an infinite amount of times
- * clutter_timeline_set_duration (CLUTTER_TIMELINE (transition), 1000);
- * clutter_timeline_set_repeat_count (CLUTTER_TIMELINE (transition), -1);
- *
- * // we want to fade in and out, so we need to auto-reverse the transition
- * clutter_timeline_set_auto_reverse (CLUTTER_TIMELINE (transition), TRUE);
- *
- * // and we want to use an easing function that eases both in and out
- * clutter_timeline_set_progress_mode (CLUTTER_TIMELINE (transition),
- * CLUTTER_EASE_IN_OUT_CUBIC);
- *
- * // add the transition to the desired actor to start it
- * clutter_actor_add_transition (actor, "opacityAnimation", transition);
- * ]|
- *
- * ## Implementing an actor ## {#clutter-actor-implementing}
- *
- * Careful consideration should be given when deciding to implement
- * a #ClutterActor sub-class. It is generally recommended to implement a
- * sub-class of #ClutterActor only for actors that should be used as leaf
- * nodes of a scene graph.
- *
- * By overriding the #ClutterActorClass.get_preferred_width() and
- * #ClutterActorClass.get_preferred_height() virtual functions it is
- * possible to change or provide the preferred size of an actor; similarly,
- * by overriding the #ClutterActorClass.allocate() virtual function it is
- * possible to control the layout of the children of an actor. Make sure to
- * always chain up to the parent implementation of the
- * #ClutterActorClass.allocate() virtual function.
- *
- * In general, it is strongly encouraged to use delegation and composition
- * instead of direct subclassing.
- *
- * ## ClutterActor custom properties for ClutterScript ## {#clutter-actor-custom-script}
- *
- * #ClutterActor defines a custom "rotation" property which allows a short-hand
- * description of the rotations to be applied to an actor.
- *
- * The syntax of the "rotation" property is the following:
- *
- * |[
- * "rotation" : [ { "<axis>" : [ <angle>, [ <center-point> ] ] } ]
- * ]|
- *
- * where:
- *
- * - axis is the name of an enumeration value of type #ClutterRotateAxis
- * - angle is a floating point value representing the rotation angle on the given axis in degrees
- * - center-point is an optional array, and if present it must contain the center of rotation as described by two coordinates:
- * - Y and Z for "x-axis"
- * - X and Z for "y-axis"
- * - X and Y for "z-axis".
- *
- * #ClutterActor also defines a scriptable "margin" property which follows the CSS "margin" shorthand.
- *
- * |[
- * // 4 values
- * "margin" : [ top, right, bottom, left ]
- * // 3 values
- * "margin" : [ top, left/right, bottom ]
- * // 2 values
- * "margin" : [ top/bottom, left/right ]
- * // 1 value
- * "margin" : [ top/right/bottom/left ]
- * ]|
- *
- * #ClutterActor will also parse every positional and dimensional
- * property defined as a string through clutter_units_from_string(); you
- * should read the documentation for the #ClutterUnits parser format for
- * the valid units and syntax.
- *
- * ## Custom animatable properties
- *
- * #ClutterActor allows accessing properties of #ClutterAction,
- * #ClutterEffect, and #ClutterConstraint instances associated to an actor
- * instance for animation purposes, as well as its #ClutterLayoutManager.
- *
- * In order to access a specific #ClutterAction or a #ClutterConstraint
- * property it is necessary to set the #ClutterActorMeta:name property on the
- * given action or constraint.
- *
- * The property can be accessed using the following syntax:
- *
- * |[
- * @<section>.<meta-name>.<property-name>
- * ]|
- *
- * - the initial `@` is mandatory
- * - the `section` fragment can be one between "actions", "constraints", "content",
- * and "effects"
- * - the `meta-name` fragment is the name of the action, effect, or constraint, as
- * specified by the #ClutterActorMeta:name property of #ClutterActorMeta
- * - the `property-name` fragment is the name of the action, effect, or constraint
- * property to be animated.
- *
- * The example below animates a #ClutterBindConstraint applied to an actor
- * using an explicit transition. The `rect` actor has a binding constraint
- * on the `origin` actor, and in its initial state is overlapping the actor
- * to which is bound to.
- *
- * As the actor has only one #ClutterLayoutManager, the syntax for accessing its
- * properties is simpler:
- *
- * |[
- * @layout.<property-name>
- * ]|
- *
- * |[<!-- language="C" -->
- * constraint = clutter_bind_constraint_new (origin, CLUTTER_BIND_X, 0.0);
- * clutter_actor_meta_set_name (CLUTTER_ACTOR_META (constraint), "bind-x");
- * clutter_actor_add_constraint (rect, constraint);
- *
- * constraint = clutter_bind_constraint_new (origin, CLUTTER_BIND_Y, 0.0);
- * clutter_actor_meta_set_name (CLUTTER_ACTOR_META (constraint), "bind-y");
- * clutter_actor_add_constraint (rect, constraint);
- *
- * clutter_actor_set_reactive (origin, TRUE);
- *
- * g_signal_connect (origin, "button-press-event",
- * G_CALLBACK (on_button_press),
- * rect);
- * ]|
- *
- * On button press, the rectangle "slides" from behind the actor to
- * which is bound to, using the #ClutterBindConstraint:offset property to
- * achieve the effect:
- *
- * |[<!-- language="C" -->
- * gboolean
- * on_button_press (ClutterActor *origin,
- * ClutterEvent *event,
- * ClutterActor *rect)
- * {
- * ClutterTransition *transition;
- *
- * // the offset that we want to apply; this will make the actor
- * // slide in from behind the origin and rest at the right of
- * // the origin, plus a padding value
- * float new_offset = clutter_actor_get_width (origin) + h_padding;
- *
- * // the property we wish to animate; the "@constraints" section
- * // tells Clutter to check inside the constraints associated
- * // with the actor; the "bind-x" section is the name of the
- * // constraint; and the "offset" is the name of the property
- * // on the constraint
- * const char *prop = "@constraints.bind-x.offset";
- *
- * // create a new transition for the given property
- * transition = clutter_property_transition_new_for_actor (rect, prop);
- *
- * // set the easing mode and duration
- * clutter_timeline_set_progress_mode (CLUTTER_TIMELINE (transition),
- * CLUTTER_EASE_OUT_CUBIC);
- * clutter_timeline_set_duration (CLUTTER_TIMELINE (transition), 500);
- *
- * // create the interval with the initial and final values
- * clutter_transition_set_from (transition, G_TYPE_FLOAT, 0.f);
- * clutter_transition_set_to (transition, G_TYPE_FLOAT, new_offset);
- *
- * // add the transition to the actor; this causes the animation
- * // to start. the name "offsetAnimation" can be used to retrieve
- * // the transition later
- * clutter_actor_add_transition (rect, "offsetAnimation", transition);
- *
- * // we handled the event
- * return CLUTTER_EVENT_STOP;
- * }
- * ]|
- */
-
-/**
- * CLUTTER_ACTOR_IS_MAPPED:
- * @a: a #ClutterActor
- *
- * Evaluates to %TRUE if the %CLUTTER_ACTOR_MAPPED flag is set.
- *
- * The mapped state is set when the actor is visible and all its parents up
- * to a top-level (e.g. a #ClutterStage) are visible, realized, and mapped.
- *
- * This check can be used to see if an actor is going to be painted, as only
- * actors with the %CLUTTER_ACTOR_MAPPED flag set are going to be painted.
- *
- * The %CLUTTER_ACTOR_MAPPED flag is managed by Clutter itself, and it should
- * not be checked directly; instead, the recommended usage is to connect a
- * handler on the #GObject::notify signal for the #ClutterActor:mapped
- * property of #ClutterActor, and check the presence of
- * the %CLUTTER_ACTOR_MAPPED flag on state changes.
- *
- * It is also important to note that Clutter may delay the changes of
- * the %CLUTTER_ACTOR_MAPPED flag on top-levels due to backend-specific
- * limitations, or during the reparenting of an actor, to optimize
- * unnecessary (and potentially expensive) state changes.
- *
- * Since: 0.2
- *
- * Deprecated: 1.24: Use clutter_actor_is_mapped() or the #ClutterActor:mapped
- * property instead of this macro.
- */
-
-/**
- * CLUTTER_ACTOR_IS_REALIZED:
- * @a: a #ClutterActor
- *
- * Evaluates to %TRUE if the %CLUTTER_ACTOR_REALIZED flag is set.
- *
- * The realized state has an actor-dependant interpretation. If an
- * actor wants to delay allocating resources until it is attached to a
- * stage, it may use the realize state to do so. However it is
- * perfectly acceptable for an actor to allocate Cogl resources before
- * being realized because there is only one drawing context used by Clutter
- * so any resources will work on any stage. If an actor is mapped it
- * must also be realized, but an actor can be realized and unmapped
- * (this is so hiding an actor temporarily doesn't do an expensive
- * unrealize/realize).
- *
- * To be realized an actor must be inside a stage, and all its parents
- * must be realized.
- *
- * Since: 0.2
- *
- * Deprecated: 1.24: Use clutter_actor_is_realized() or the #ClutterActor:realized
- * property instead of this macro.
- */
-
-/**
- * CLUTTER_ACTOR_IS_VISIBLE:
- * @a: a #ClutterActor
- *
- * Evaluates to %TRUE if the actor has been shown, %FALSE if it's hidden.
- * Equivalent to the ClutterActor::visible object property.
- *
- * Note that an actor is only painted onscreen if it's mapped, which
- * means it's visible, and all its parents are visible, and one of the
- * parents is a toplevel stage; see also %CLUTTER_ACTOR_IS_MAPPED.
- *
- * Since: 0.2
- *
- * Deprecated: 1.24: Use clutter_actor_is_visible() or the #ClutterActor:visible
- * property instead of this macro.
- */
-
-/**
- * CLUTTER_ACTOR_IS_REACTIVE:
- * @a: a #ClutterActor
- *
- * Evaluates to %TRUE if the %CLUTTER_ACTOR_REACTIVE flag is set.
- *
- * Only reactive actors will receive event-related signals.
- *
- * Since: 0.6
- *
- * Deprecated: 1.24: Use clutter_actor_get_reactive() or the
- * #ClutterActor:reactive property instead of this macro.
- */
-
-#include "clutter-build-config.h"
-
-#include <math.h>
-
-#include <gobject/gvaluecollector.h>
-
-#include <cogl/cogl.h>
-
-#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
-
-#include "clutter-actor-private.h"
-
-#include "clutter-action.h"
-#include "clutter-actor-meta-private.h"
-#include "clutter-animatable.h"
-#include "clutter-color-static.h"
-#include "clutter-color.h"
-#include "clutter-constraint-private.h"
-#include "clutter-container-private.h"
-#include "clutter-content-private.h"
-#include "clutter-debug.h"
-#include "clutter-easing.h"
-#include "clutter-effect-private.h"
-#include "clutter-enum-types.h"
-#include "clutter-fixed-layout.h"
-#include "clutter-flatten-effect.h"
-#include "clutter-interval.h"
-#include "clutter-main.h"
-#include "clutter-marshal.h"
-#include "clutter-mutter.h"
-#include "clutter-paint-context-private.h"
-#include "clutter-paint-nodes.h"
-#include "clutter-paint-node-private.h"
-#include "clutter-paint-volume-private.h"
-#include "clutter-pick-context-private.h"
-#include "clutter-private.h"
-#include "clutter-property-transition.h"
-#include "clutter-scriptable.h"
-#include "clutter-script-private.h"
-#include "clutter-stage-private.h"
-#include "clutter-stage-view-private.h"
-#include "clutter-timeline.h"
-#include "clutter-transition.h"
-#include "clutter-units.h"
-
-#include "deprecated/clutter-container.h"
-
-/* Internal enum used to control mapped state update. This is a hint
- * which indicates when to do something other than just enforce
- * invariants.
- */
-typedef enum
-{
- MAP_STATE_CHECK, /* just enforce invariants. */
- MAP_STATE_MAKE_UNREALIZED, /* force unrealize, ignoring invariants,
- * used when about to unparent.
- */
- MAP_STATE_MAKE_MAPPED, /* set mapped, error if invariants not met;
- * used to set mapped on toplevels.
- */
- MAP_STATE_MAKE_UNMAPPED /* set unmapped, even if parent is mapped,
- * used just before unmapping parent.
- */
-} MapStateChange;
-
-/* 3 entries should be a good compromise, few layout managers
- * will ask for 3 different preferred size in each allocation cycle */
-#define N_CACHED_SIZE_REQUESTS 3
-
-struct _ClutterActorPrivate
-{
- /* request mode */
- ClutterRequestMode request_mode;
-
- /* our cached size requests for different width / height */
- SizeRequest width_requests[N_CACHED_SIZE_REQUESTS];
- SizeRequest height_requests[N_CACHED_SIZE_REQUESTS];
-
- /* An age of 0 means the entry is not set */
- guint cached_height_age;
- guint cached_width_age;
-
- /* the bounding box of the actor, relative to the parent's
- * allocation
- */
- ClutterActorBox allocation;
-
- /* clip, in actor coordinates */
- graphene_rect_t clip;
-
- /* the cached transformation matrix; see apply_transform() */
- graphene_matrix_t transform;
-
- float resource_scale;
-
- guint8 opacity;
- gint opacity_override;
- unsigned int inhibit_culling_counter;
-
- ClutterOffscreenRedirect offscreen_redirect;
-
- /* This is an internal effect used to implement the
- offscreen-redirect property */
- ClutterEffect *flatten_effect;
-
- /* scene graph */
- ClutterActor *parent;
- ClutterActor *prev_sibling;
- ClutterActor *next_sibling;
- ClutterActor *first_child;
- ClutterActor *last_child;
-
- gint n_children;
-
- /* tracks whenever the children of an actor are changed; the
- * age is incremented by 1 whenever an actor is added or
- * removed. the age is not incremented when the first or the
- * last child pointers are changed, or when grandchildren of
- * an actor are changed.
- */
- gint age;
-
- gchar *name; /* a non-unique name, used for debugging */
-
- /* a back-pointer to the Pango context that we can use
- * to create pre-configured PangoLayout
- */
- PangoContext *pango_context;
-
- /* the text direction configured for this child - either by
- * application code, or by the actor's parent
- */
- ClutterTextDirection text_direction;
-
- /* meta classes */
- ClutterMetaGroup *actions;
- ClutterMetaGroup *constraints;
- ClutterMetaGroup *effects;
-
- /* delegate object used to allocate the children of this actor */
- ClutterLayoutManager *layout_manager;
-
- /* delegate object used to paint the contents of this actor */
- ClutterContent *content;
-
- ClutterActorBox content_box;
- ClutterContentGravity content_gravity;
- ClutterScalingFilter min_filter;
- ClutterScalingFilter mag_filter;
- ClutterContentRepeat content_repeat;
-
- /* used when painting, to update the paint volume */
- ClutterEffect *current_effect;
-
- /* This is used to store an effect which needs to be redrawn. A
- redraw can be queued to start from a particular effect. This is
- used by parametrised effects that can cache an image of the
- actor. If a parameter of the effect changes then it only needs to
- redraw the cached image, not the actual actor. The pointer is
- only valid if is_dirty == TRUE. If the pointer is NULL then the
- whole actor is dirty. */
- ClutterEffect *effect_to_redraw;
-
- /* This is used when painting effects to implement the
- clutter_actor_continue_paint() function. It points to the node in
- the list of effects that is next in the chain */
- const GList *next_effect_to_paint;
-
- ClutterPaintVolume paint_volume;
-
- /* NB: This volume isn't relative to this actor, it is in eye
- * coordinates so that it can remain valid after the actor changes.
- */
- ClutterPaintVolume last_paint_volume;
-
- ClutterColor bg_color;
-
-#ifdef CLUTTER_ENABLE_DEBUG
- /* a string used for debugging messages */
- gchar *debug_name;
-#endif
-
- /* a set of clones of the actor */
- GHashTable *clones;
-
- /* whether the actor is inside a cloned branch; this
- * value is propagated to all the actor's children
- */
- gulong in_cloned_branch;
-
- guint unmapped_paint_branch_counter;
-
- GListModel *child_model;
- ClutterActorCreateChildFunc create_child_func;
- gpointer create_child_data;
- GDestroyNotify create_child_notify;
-
- gulong resolution_changed_id;
- gulong font_changed_id;
- gulong layout_changed_id;
-
- GList *stage_views;
-
- /* bitfields: KEEP AT THE END */
-
- /* fixed position and sizes */
- guint position_set : 1;
- guint min_width_set : 1;
- guint min_height_set : 1;
- guint natural_width_set : 1;
- guint natural_height_set : 1;
- /* cached request is invalid (implies allocation is too) */
- guint needs_width_request : 1;
- /* cached request is invalid (implies allocation is too) */
- guint needs_height_request : 1;
- /* cached allocation is invalid (request has changed, probably) */
- guint needs_allocation : 1;
- guint show_on_set_parent : 1;
- guint has_clip : 1;
- guint clip_to_allocation : 1;
- guint enable_model_view_transform : 1;
- guint enable_paint_unmapped : 1;
- guint has_pointer : 1;
- guint has_key_focus : 1;
- guint propagated_one_redraw : 1;
- guint paint_volume_valid : 1;
- guint last_paint_volume_valid : 1;
- guint in_clone_paint : 1;
- guint transform_valid : 1;
- /* This is TRUE if anything has queued a redraw since we were last
- painted. In this case effect_to_redraw will point to an effect
- the redraw was queued from or it will be NULL if the redraw was
- queued without an effect. */
- guint is_dirty : 1;
- guint bg_color_set : 1;
- guint content_box_valid : 1;
- guint x_expand_set : 1;
- guint y_expand_set : 1;
- guint needs_compute_expand : 1;
- guint needs_x_expand : 1;
- guint needs_y_expand : 1;
- guint needs_paint_volume_update : 1;
- guint had_effects_on_last_paint_volume_update : 1;
- guint needs_update_stage_views : 1;
-};
-
-enum
-{
- PROP_0,
-
- PROP_NAME,
-
- /* X, Y, WIDTH, HEIGHT are "do what I mean" properties;
- * when set they force a size request, when gotten they
- * get the allocation if the allocation is valid, and the
- * request otherwise
- */
- PROP_X,
- PROP_Y,
- PROP_WIDTH,
- PROP_HEIGHT,
-
- PROP_POSITION,
- PROP_SIZE,
-
- /* Then the rest of these size-related properties are the "actual"
- * underlying properties set or gotten by X, Y, WIDTH, HEIGHT
- */
- PROP_FIXED_X,
- PROP_FIXED_Y,
-
- PROP_FIXED_POSITION_SET,
-
- PROP_MIN_WIDTH,
- PROP_MIN_WIDTH_SET,
-
- PROP_MIN_HEIGHT,
- PROP_MIN_HEIGHT_SET,
-
- PROP_NATURAL_WIDTH,
- PROP_NATURAL_WIDTH_SET,
-
- PROP_NATURAL_HEIGHT,
- PROP_NATURAL_HEIGHT_SET,
-
- PROP_REQUEST_MODE,
-
- /* Allocation properties are read-only */
- PROP_ALLOCATION,
-
- PROP_Z_POSITION,
-
- PROP_CLIP_RECT,
- PROP_HAS_CLIP,
- PROP_CLIP_TO_ALLOCATION,
-
- PROP_OPACITY,
-
- PROP_OFFSCREEN_REDIRECT,
-
- PROP_VISIBLE,
- PROP_MAPPED,
- PROP_REALIZED,
- PROP_REACTIVE,
-
- PROP_PIVOT_POINT,
- PROP_PIVOT_POINT_Z,
-
- PROP_SCALE_X,
- PROP_SCALE_Y,
- PROP_SCALE_Z,
-
- PROP_ROTATION_ANGLE_X, /* XXX:2.0 rename to rotation-x */
- PROP_ROTATION_ANGLE_Y, /* XXX:2.0 rename to rotation-y */
- PROP_ROTATION_ANGLE_Z, /* XXX:2.0 rename to rotation-z */
-
- PROP_TRANSLATION_X,
- PROP_TRANSLATION_Y,
- PROP_TRANSLATION_Z,
-
- PROP_TRANSFORM,
- PROP_TRANSFORM_SET,
- PROP_CHILD_TRANSFORM,
- PROP_CHILD_TRANSFORM_SET,
-
- PROP_SHOW_ON_SET_PARENT, /*XXX:2.0 remove */
-
- PROP_TEXT_DIRECTION,
- PROP_HAS_POINTER,
-
- PROP_ACTIONS,
- PROP_CONSTRAINTS,
- PROP_EFFECT,
-
- PROP_LAYOUT_MANAGER,
-
- PROP_X_EXPAND,
- PROP_Y_EXPAND,
- PROP_X_ALIGN,
- PROP_Y_ALIGN,
- PROP_MARGIN_TOP,
- PROP_MARGIN_BOTTOM,
- PROP_MARGIN_LEFT,
- PROP_MARGIN_RIGHT,
-
- PROP_BACKGROUND_COLOR,
- PROP_BACKGROUND_COLOR_SET,
-
- PROP_FIRST_CHILD,
- PROP_LAST_CHILD,
-
- PROP_CONTENT,
- PROP_CONTENT_GRAVITY,
- PROP_CONTENT_BOX,
- PROP_MINIFICATION_FILTER,
- PROP_MAGNIFICATION_FILTER,
- PROP_CONTENT_REPEAT,
-
- PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST];
-
-enum
-{
- SHOW,
- HIDE,
- DESTROY,
- PARENT_SET,
- KEY_FOCUS_IN,
- KEY_FOCUS_OUT,
- PAINT,
- PICK,
- REALIZE,
- UNREALIZE,
- QUEUE_RELAYOUT,
- EVENT,
- CAPTURED_EVENT,
- BUTTON_PRESS_EVENT,
- BUTTON_RELEASE_EVENT,
- SCROLL_EVENT,
- KEY_PRESS_EVENT,
- KEY_RELEASE_EVENT,
- MOTION_EVENT,
- ENTER_EVENT,
- LEAVE_EVENT,
- TRANSITIONS_COMPLETED,
- TOUCH_EVENT,
- TRANSITION_STOPPED,
- STAGE_VIEWS_CHANGED,
- RESOURCE_SCALE_CHANGED,
-
- LAST_SIGNAL
-};
-
-static guint actor_signals[LAST_SIGNAL] = { 0, };
-
-typedef struct _TransitionClosure
-{
- ClutterActor *actor;
- ClutterTransition *transition;
- gchar *name;
- gulong completed_id;
-} TransitionClosure;
-
-static void clutter_container_iface_init (ClutterContainerIface *iface);
-static void clutter_scriptable_iface_init (ClutterScriptableIface *iface);
-static void clutter_animatable_iface_init (ClutterAnimatableInterface *iface);
-static void atk_implementor_iface_init (AtkImplementorIface *iface);
-
-/* These setters are all static for now, maybe they should be in the
- * public API, but they are perhaps obscure enough to leave only as
- * properties
- */
-static void clutter_actor_set_min_width (ClutterActor *self,
- gfloat min_width);
-static void clutter_actor_set_min_height (ClutterActor *self,
- gfloat min_height);
-static void clutter_actor_set_natural_width (ClutterActor *self,
- gfloat natural_width);
-static void clutter_actor_set_natural_height (ClutterActor *self,
- gfloat natural_height);
-static void clutter_actor_set_min_width_set (ClutterActor *self,
- gboolean use_min_width);
-static void clutter_actor_set_min_height_set (ClutterActor *self,
- gboolean use_min_height);
-static void clutter_actor_set_natural_width_set (ClutterActor *self,
- gboolean use_natural_width);
-static void clutter_actor_set_natural_height_set (ClutterActor *self,
- gboolean use_natural_height);
-static void clutter_actor_update_map_state (ClutterActor *self,
- MapStateChange change);
-static void clutter_actor_unrealize_not_hiding (ClutterActor *self);
-
-static void _clutter_actor_get_relative_transformation_matrix (ClutterActor *self,
- ClutterActor *ancestor,
- graphene_matrix_t *matrix);
-
-static ClutterPaintVolume *_clutter_actor_get_paint_volume_mutable (ClutterActor *self);
-
-static guint8 clutter_actor_get_paint_opacity_internal (ClutterActor *self);
-
-static inline void clutter_actor_set_background_color_internal (ClutterActor *self,
- const ClutterColor *color);
-
-static void on_layout_manager_changed (ClutterLayoutManager *manager,
- ClutterActor *self);
-
-static inline void clutter_actor_queue_compute_expand (ClutterActor *self);
-
-static inline void clutter_actor_set_margin_internal (ClutterActor *self,
- gfloat margin,
- GParamSpec *pspec);
-
-static void clutter_actor_set_transform_internal (ClutterActor *self,
- const graphene_matrix_t *transform);
-static void clutter_actor_set_child_transform_internal (ClutterActor *self,
- const graphene_matrix_t *transform);
-
-static void clutter_actor_realize_internal (ClutterActor *self);
-static void clutter_actor_unrealize_internal (ClutterActor *self);
-
-static void clutter_actor_push_in_cloned_branch (ClutterActor *self,
- gulong count);
-static void clutter_actor_pop_in_cloned_branch (ClutterActor *self,
- gulong count);
-static void ensure_valid_actor_transform (ClutterActor *actor);
-
-static void push_in_paint_unmapped_branch (ClutterActor *self,
- guint count);
-static void pop_in_paint_unmapped_branch (ClutterActor *self,
- guint count);
-
-static GQuark quark_actor_layout_info = 0;
-static GQuark quark_actor_transform_info = 0;
-static GQuark quark_actor_animation_info = 0;
-
-static GQuark quark_key = 0;
-static GQuark quark_motion = 0;
-static GQuark quark_pointer_focus = 0;
-static GQuark quark_button = 0;
-static GQuark quark_scroll = 0;
-static GQuark quark_stage = 0;
-static GQuark quark_touch = 0;
-static GQuark quark_touchpad = 0;
-static GQuark quark_proximity = 0;
-static GQuark quark_pad = 0;
-static GQuark quark_im = 0;
-
-G_DEFINE_TYPE_WITH_CODE (ClutterActor,
- clutter_actor,
- G_TYPE_INITIALLY_UNOWNED,
- G_ADD_PRIVATE (ClutterActor)
- G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTAINER,
- clutter_container_iface_init)
- G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE,
- clutter_scriptable_iface_init)
- G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_ANIMATABLE,
- clutter_animatable_iface_init)
- G_IMPLEMENT_INTERFACE (ATK_TYPE_IMPLEMENTOR,
- atk_implementor_iface_init));
-
-/*< private >
- * clutter_actor_get_debug_name:
- * @actor: a #ClutterActor
- *
- * Retrieves a printable name of @actor for debugging messages
- *
- * Return value: a string with a printable name
- */
-const gchar *
-_clutter_actor_get_debug_name (ClutterActor *actor)
-{
- ClutterActorPrivate *priv = actor->priv;
- const gchar *retval;
-
-#ifdef CLUTTER_ENABLE_DEBUG
- if (G_UNLIKELY (priv->debug_name == NULL))
- {
- priv->debug_name = g_strdup_printf ("<%s>[<%s>:%p]",
- priv->name != NULL ? priv->name
- : "unnamed",
- G_OBJECT_TYPE_NAME (actor),
- actor);
- }
-
- retval = priv->debug_name;
-#else
- retval = priv->name != NULL
- ? priv->name
- : G_OBJECT_TYPE_NAME (actor);
-#endif
-
- return retval;
-}
-
-#ifdef CLUTTER_ENABLE_DEBUG
-/* XXX - this is for debugging only, remove once working (or leave
- * in only in some debug mode). Should leave it for a little while
- * until we're confident in the new map/realize/visible handling.
- */
-static inline void
-clutter_actor_verify_map_state (ClutterActor *self)
-{
- ClutterActorPrivate *priv = self->priv;
-
- if (CLUTTER_ACTOR_IS_REALIZED (self))
- {
- if (priv->parent == NULL)
- {
- if (!CLUTTER_ACTOR_IS_TOPLEVEL (self))
- {
- g_warning ("Realized non-toplevel actor '%s' should "
- "have a parent",
- _clutter_actor_get_debug_name (self));
- }
- }
- else if (!CLUTTER_ACTOR_IS_REALIZED (priv->parent))
- {
- g_warning ("Realized actor %s has an unrealized parent %s",
- _clutter_actor_get_debug_name (self),
- _clutter_actor_get_debug_name (priv->parent));
- }
- }
-
- if (CLUTTER_ACTOR_IS_MAPPED (self))
- {
- if (!CLUTTER_ACTOR_IS_REALIZED (self))
- g_warning ("Actor '%s' is mapped but not realized",
- _clutter_actor_get_debug_name (self));
-
- if (priv->parent == NULL)
- {
- if (CLUTTER_ACTOR_IS_TOPLEVEL (self))
- {
- if (!CLUTTER_ACTOR_IS_VISIBLE (self) &&
- !CLUTTER_ACTOR_IN_DESTRUCTION (self))
- {
- g_warning ("Toplevel actor '%s' is mapped "
- "but not visible",
- _clutter_actor_get_debug_name (self));
- }
- }
- else
- {
- g_warning ("Mapped actor '%s' should have a parent",
- _clutter_actor_get_debug_name (self));
- }
- }
- else
- {
- ClutterActor *iter = self;
-
- /* check for the enable_paint_unmapped flag on the actor
- * and parents; if the flag is enabled at any point of this
- * branch of the scene graph then all the later checks
- * become pointless
- */
- while (iter != NULL)
- {
- if (iter->priv->enable_paint_unmapped)
- return;
-
- iter = iter->priv->parent;
- }
-
- if (!CLUTTER_ACTOR_IS_VISIBLE (priv->parent))
- {
- g_warning ("Actor '%s' should not be mapped if parent '%s'"
- "is not visible",
- _clutter_actor_get_debug_name (self),
- _clutter_actor_get_debug_name (priv->parent));
- }
-
- if (!CLUTTER_ACTOR_IS_REALIZED (priv->parent))
- {
- g_warning ("Actor '%s' should not be mapped if parent '%s'"
- "is not realized",
- _clutter_actor_get_debug_name (self),
- _clutter_actor_get_debug_name (priv->parent));
- }
-
- if (!CLUTTER_ACTOR_IS_TOPLEVEL (priv->parent))
- {
- if (!CLUTTER_ACTOR_IS_MAPPED (priv->parent))
- g_warning ("Actor '%s' is mapped but its non-toplevel "
- "parent '%s' is not mapped",
- _clutter_actor_get_debug_name (self),
- _clutter_actor_get_debug_name (priv->parent));
- }
- }
- }
-}
-
-#endif /* CLUTTER_ENABLE_DEBUG */
-
-/**
- * clutter_actor_pick_box:
- * @self: The #ClutterActor being "pick" painted.
- * @pick_context: The #ClutterPickContext
- * @box: A rectangle in the actor's own local coordinates.
- *
- * Logs (does a virtual paint of) a rectangle for picking. Note that @box is
- * in the actor's own local coordinates, so is usually {0,0,width,height}
- * to include the whole actor. That is unless the actor has a shaped input
- * region in which case you may wish to log the (multiple) smaller rectangles
- * that make up the input region.
- */
-void
-clutter_actor_pick_box (ClutterActor *self,
- ClutterPickContext *pick_context,
- const ClutterActorBox *box)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (box != NULL);
-
- if (box->x1 >= box->x2 || box->y1 >= box->y2)
- return;
-
- clutter_pick_context_log_pick (pick_context, box, self);
-}
-
-static void
-clutter_actor_set_mapped (ClutterActor *self,
- gboolean mapped)
-{
- if (CLUTTER_ACTOR_IS_MAPPED (self) == mapped)
- return;
-
- if (mapped)
- {
- CLUTTER_ACTOR_GET_CLASS (self)->map (self);
- g_assert (CLUTTER_ACTOR_IS_MAPPED (self));
- }
- else
- {
- CLUTTER_ACTOR_GET_CLASS (self)->unmap (self);
- g_assert (!CLUTTER_ACTOR_IS_MAPPED (self));
- }
-}
-
-/* this function updates the mapped and realized states according to
- * invariants, in the appropriate order.
- */
-static void
-clutter_actor_update_map_state (ClutterActor *self,
- MapStateChange change)
-{
- gboolean was_mapped;
-
- was_mapped = CLUTTER_ACTOR_IS_MAPPED (self);
-
- if (CLUTTER_ACTOR_IS_TOPLEVEL (self))
- {
- /* the mapped flag on top-level actors must be set by the
- * per-backend implementation because it might be asynchronous.
- *
- * That is, the MAPPED flag on toplevels currently tracks the X
- * server mapped-ness of the window, while the expected behavior
- * (if used to GTK) may be to track WM_STATE!=WithdrawnState.
- * This creates some weird complexity by breaking the invariant
- * that if we're visible and all ancestors shown then we are
- * also mapped - instead, we are mapped if all ancestors
- * _possibly excepting_ the stage are mapped. The stage
- * will map/unmap for example when it is minimized or
- * moved to another workspace.
- *
- * So, the only invariant on the stage is that if visible it
- * should be realized, and that it has to be visible to be
- * mapped.
- */
- if (CLUTTER_ACTOR_IS_VISIBLE (self))
- clutter_actor_realize (self);
-
- switch (change)
- {
- case MAP_STATE_CHECK:
- break;
-
- case MAP_STATE_MAKE_MAPPED:
- g_assert (!was_mapped);
- clutter_actor_set_mapped (self, TRUE);
- break;
-
- case MAP_STATE_MAKE_UNMAPPED:
- g_assert (was_mapped);
- clutter_actor_set_mapped (self, FALSE);
- break;
-
- case MAP_STATE_MAKE_UNREALIZED:
- /* we only use MAKE_UNREALIZED in unparent,
- * and unparenting a stage isn't possible.
- * If someone wants to just unrealize a stage
- * then clutter_actor_unrealize() doesn't
- * go through this codepath.
- */
- g_warning ("Trying to force unrealize stage is not allowed");
- break;
- }
-
- if (CLUTTER_ACTOR_IS_MAPPED (self) &&
- !CLUTTER_ACTOR_IS_VISIBLE (self) &&
- !CLUTTER_ACTOR_IN_DESTRUCTION (self))
- {
- g_warning ("Clutter toplevel of type '%s' is not visible, but "
- "it is somehow still mapped",
- _clutter_actor_get_debug_name (self));
- }
- }
- else
- {
- ClutterActorPrivate *priv = self->priv;
- ClutterActor *parent = priv->parent;
- gboolean should_be_mapped;
- gboolean may_be_realized;
- gboolean must_be_realized;
-
- should_be_mapped = FALSE;
- may_be_realized = TRUE;
- must_be_realized = FALSE;
-
- if (parent == NULL || change == MAP_STATE_MAKE_UNREALIZED)
- {
- may_be_realized = FALSE;
- }
- else
- {
- /* Maintain invariant that if parent is mapped, and we are
- * visible, then we are mapped ... unless parent is a
- * stage, in which case we map regardless of parent's map
- * state but do require stage to be visible and realized.
- *
- * If parent is realized, that does not force us to be
- * realized; but if parent is unrealized, that does force
- * us to be unrealized.
- *
- * The reason we don't force children to realize with
- * parents is _clutter_actor_rerealize(); if we require that
- * a realized parent means children are realized, then to
- * unrealize an actor we would have to unrealize its
- * parents, which would end up meaning unrealizing and
- * hiding the entire stage. So we allow unrealizing a
- * child (as long as that child is not mapped) while that
- * child still has a realized parent.
- *
- * Also, if we unrealize from leaf nodes to root, and
- * realize from root to leaf, the invariants are never
- * violated if we allow children to be unrealized
- * while parents are realized.
- *
- * When unmapping, MAP_STATE_MAKE_UNMAPPED is specified
- * to force us to unmap, even though parent is still
- * mapped. This is because we're unmapping from leaf nodes
- * up to root nodes.
- */
- if (CLUTTER_ACTOR_IS_VISIBLE (self) &&
- change != MAP_STATE_MAKE_UNMAPPED)
- {
- gboolean parent_is_visible_realized_toplevel;
-
- parent_is_visible_realized_toplevel =
- (CLUTTER_ACTOR_IS_TOPLEVEL (parent) &&
- CLUTTER_ACTOR_IS_VISIBLE (parent) &&
- CLUTTER_ACTOR_IS_REALIZED (parent));
-
- if (CLUTTER_ACTOR_IS_MAPPED (parent) ||
- parent_is_visible_realized_toplevel)
- {
- must_be_realized = TRUE;
- should_be_mapped = TRUE;
- }
- }
-
- /* if the actor has been set to be painted even if unmapped
- * then we should map it and check for realization as well;
- * this is an override for the branch of the scene graph
- * which begins with this node
- */
- if (priv->enable_paint_unmapped)
- {
- should_be_mapped = TRUE;
- must_be_realized = TRUE;
- }
-
- if (!CLUTTER_ACTOR_IS_REALIZED (parent))
- may_be_realized = FALSE;
- }
-
- if (change == MAP_STATE_MAKE_MAPPED && !should_be_mapped)
- {
- if (parent == NULL)
- g_warning ("Attempting to map a child that does not "
- "meet the necessary invariants: the actor '%s' "
- "has no parent",
- _clutter_actor_get_debug_name (self));
- else
- g_warning ("Attempting to map a child that does not "
- "meet the necessary invariants: the actor '%s' "
- "is parented to an unmapped actor '%s'",
- _clutter_actor_get_debug_name (self),
- _clutter_actor_get_debug_name (priv->parent));
- }
-
- /* We want to go in the order "realize, map" and "unmap, unrealize" */
-
- /* Unmap */
- if (!should_be_mapped)
- clutter_actor_set_mapped (self, FALSE);
-
- /* Realize */
- if (must_be_realized)
- clutter_actor_realize (self);
-
- /* if we must be realized then we may be, presumably */
- g_assert (!(must_be_realized && !may_be_realized));
-
- /* Unrealize */
- if (!may_be_realized)
- clutter_actor_unrealize_not_hiding (self);
-
- /* Map */
- if (should_be_mapped)
- {
- if (!must_be_realized)
- g_warning ("Somehow we think actor '%s' should be mapped but "
- "not realized, which isn't allowed",
- _clutter_actor_get_debug_name (self));
-
- /* realization is allowed to fail (though I don't know what
- * an app is supposed to do about that - shouldn't it just
- * be a g_error? anyway, we have to avoid mapping if this
- * happens)
- */
- if (CLUTTER_ACTOR_IS_REALIZED (self))
- clutter_actor_set_mapped (self, TRUE);
- }
- }
-
-#ifdef CLUTTER_ENABLE_DEBUG
- /* check all invariants were kept */
- clutter_actor_verify_map_state (self);
-#endif
-}
-
-static void
-queue_update_stage_views (ClutterActor *actor)
-{
- while (actor && !actor->priv->needs_update_stage_views)
- {
- actor->priv->needs_update_stage_views = TRUE;
-
- /* We don't really need to update the stage-views of the actors up the
- * hierarchy, we set the flag anyway though so we can avoid traversing
- * the whole scenegraph when looking for actors which need an update
- * in clutter_actor_finish_layout().
- */
- actor = actor->priv->parent;
- }
-}
-
-static void queue_update_paint_volume (ClutterActor *actor);
-
-static void
-queue_update_paint_volume_on_clones (ClutterActor *self)
-{
- ClutterActorPrivate *priv = self->priv;
- GHashTableIter iter;
- gpointer key;
-
- if (priv->clones == NULL)
- return;
-
- g_hash_table_iter_init (&iter, priv->clones);
- while (g_hash_table_iter_next (&iter, &key, NULL))
- queue_update_paint_volume (key);
-}
-
-void
-queue_update_paint_volume (ClutterActor *actor)
-{
- queue_update_paint_volume_on_clones (actor);
-
- while (actor)
- {
- actor->priv->needs_paint_volume_update = TRUE;
- actor = actor->priv->parent;
- }
-}
-
-static void
-clutter_actor_real_map (ClutterActor *self)
-{
- ClutterActorPrivate *priv = self->priv;
- ClutterActor *iter;
-
- g_assert (!CLUTTER_ACTOR_IS_MAPPED (self));
-
- CLUTTER_NOTE (ACTOR, "Mapping actor '%s'",
- _clutter_actor_get_debug_name (self));
-
- CLUTTER_ACTOR_SET_FLAGS (self, CLUTTER_ACTOR_MAPPED);
-
- if (priv->unmapped_paint_branch_counter == 0)
- {
- /* We skip unmapped actors when updating the stage-views list, so if
- * an actors list got invalidated while it was unmapped make sure to
- * set priv->needs_update_stage_views to TRUE for all actors up the
- * hierarchy now.
- */
- if (priv->needs_update_stage_views)
- {
- /* Avoid the early return in queue_update_stage_views() */
- priv->needs_update_stage_views = FALSE;
- queue_update_stage_views (self);
- }
-
- /* Avoid the early return in clutter_actor_queue_relayout() */
- priv->needs_width_request = FALSE;
- priv->needs_height_request = FALSE;
- priv->needs_allocation = FALSE;
-
- clutter_actor_queue_relayout (self);
- }
-
- /* notify on parent mapped before potentially mapping
- * children, so apps see a top-down notification.
- */
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_MAPPED]);
-
- for (iter = priv->first_child;
- iter != NULL;
- iter = iter->priv->next_sibling)
- {
- clutter_actor_map (iter);
- }
-}
-
-/**
- * clutter_actor_map:
- * @self: A #ClutterActor
- *
- * Sets the %CLUTTER_ACTOR_MAPPED flag on the actor and possibly maps
- * and realizes its children if they are visible. Does nothing if the
- * actor is not visible.
- *
- * Calling this function is strongly discouraged: the default
- * implementation of #ClutterActorClass.map() will map all the children
- * of an actor when mapping its parent.
- *
- * When overriding map, it is mandatory to chain up to the parent
- * implementation.
- *
- * Since: 1.0
- */
-void
-clutter_actor_map (ClutterActor *self)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- if (CLUTTER_ACTOR_IS_MAPPED (self))
- return;
-
- if (!CLUTTER_ACTOR_IS_VISIBLE (self))
- return;
-
- clutter_actor_update_map_state (self, MAP_STATE_MAKE_MAPPED);
-}
-
-/**
- * clutter_actor_is_mapped:
- * @self: a #ClutterActor
- *
- * Checks whether a #ClutterActor has been set as mapped.
- *
- * See also %CLUTTER_ACTOR_IS_MAPPED and #ClutterActor:mapped
- *
- * Returns: %TRUE if the actor is mapped
- *
- * Since: 1.24
- */
-gboolean
-clutter_actor_is_mapped (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- return CLUTTER_ACTOR_IS_MAPPED (self);
-}
-
-static void
-maybe_unset_key_focus (ClutterActor *self)
-{
- ClutterActor *stage;
-
- if (!self->priv->has_key_focus)
- return;
-
- stage = _clutter_actor_get_stage_internal (self);
-
- if (stage)
- clutter_stage_set_key_focus (CLUTTER_STAGE (stage), NULL);
-}
-
-static void
-clutter_actor_real_unmap (ClutterActor *self)
-{
- ClutterActorPrivate *priv = self->priv;
- ClutterActor *iter;
-
- g_assert (CLUTTER_ACTOR_IS_MAPPED (self));
-
- CLUTTER_NOTE (ACTOR, "Unmapping actor '%s'",
- _clutter_actor_get_debug_name (self));
-
- for (iter = priv->first_child;
- iter != NULL;
- iter = iter->priv->next_sibling)
- {
- clutter_actor_unmap (iter);
- }
-
- CLUTTER_ACTOR_UNSET_FLAGS (self, CLUTTER_ACTOR_MAPPED);
-
- if (priv->unmapped_paint_branch_counter == 0)
- {
- /* clear the contents of the last paint volume, so that hiding + moving +
- * showing will not result in the wrong area being repainted
- */
- _clutter_paint_volume_init_static (&priv->last_paint_volume, NULL);
- priv->last_paint_volume_valid = TRUE;
-
- if (priv->parent && !CLUTTER_ACTOR_IN_DESTRUCTION (priv->parent))
- {
- if (G_UNLIKELY (priv->parent->flags & CLUTTER_ACTOR_NO_LAYOUT))
- clutter_actor_queue_redraw (priv->parent);
- else
- clutter_actor_queue_relayout (priv->parent);
- }
- }
-
- /* notify on parent mapped after potentially unmapping
- * children, so apps see a bottom-up notification.
- */
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_MAPPED]);
-
- /* relinquish keyboard focus if we were unmapped while owning it */
- if (!CLUTTER_ACTOR_IS_TOPLEVEL (self))
- maybe_unset_key_focus (self);
-}
-
-/**
- * clutter_actor_unmap:
- * @self: A #ClutterActor
- *
- * Unsets the %CLUTTER_ACTOR_MAPPED flag on the actor and possibly
- * unmaps its children if they were mapped.
- *
- * Calling this function is not encouraged: the default #ClutterActor
- * implementation of #ClutterActorClass.unmap() will also unmap any
- * eventual children by default when their parent is unmapped.
- *
- * When overriding #ClutterActorClass.unmap(), it is mandatory to
- * chain up to the parent implementation.
- *
- * It is important to note that the implementation of the
- * #ClutterActorClass.unmap() virtual function may be called after
- * the #ClutterActorClass.destroy() or the #GObjectClass.dispose()
- * implementation, but it is guaranteed to be called before the
- * #GObjectClass.finalize() implementation.
- *
- * Since: 1.0
- */
-void
-clutter_actor_unmap (ClutterActor *self)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- if (!CLUTTER_ACTOR_IS_MAPPED (self))
- return;
-
- clutter_actor_update_map_state (self, MAP_STATE_MAKE_UNMAPPED);
-}
-
-static void
-clutter_actor_queue_shallow_relayout (ClutterActor *self)
-{
- ClutterActor *stage = _clutter_actor_get_stage_internal (self);
-
- if (stage != NULL)
- clutter_stage_queue_actor_relayout (CLUTTER_STAGE (stage), self);
-}
-
-static void
-clutter_actor_real_show (ClutterActor *self)
-{
- if (CLUTTER_ACTOR_IS_VISIBLE (self))
- return;
-
- CLUTTER_ACTOR_SET_FLAGS (self, CLUTTER_ACTOR_VISIBLE);
-
- /* we notify on the "visible" flag in the clutter_actor_show()
- * wrapper so the entire show signal emission completes first,
- * and the branch of the scene graph is in a stable state
- */
- clutter_actor_update_map_state (self, MAP_STATE_CHECK);
-}
-
-static inline void
-set_show_on_set_parent (ClutterActor *self,
- gboolean set_show)
-{
- ClutterActorPrivate *priv = self->priv;
-
- set_show = !!set_show;
-
- if (priv->show_on_set_parent == set_show)
- return;
-
- if (priv->parent == NULL)
- {
- priv->show_on_set_parent = set_show;
- g_object_notify_by_pspec (G_OBJECT (self),
- obj_props[PROP_SHOW_ON_SET_PARENT]);
- }
-}
-
-static void
-clutter_actor_queue_redraw_on_parent (ClutterActor *self)
-{
- const ClutterPaintVolume *pv;
-
- if (!self->priv->parent)
- return;
-
- /* A relayout/redraw is underway */
- if (self->priv->needs_allocation)
- return;
-
- pv = clutter_actor_get_transformed_paint_volume (self, self->priv->parent);
- _clutter_actor_queue_redraw_full (self->priv->parent, pv, NULL);
-}
-
-/**
- * clutter_actor_show:
- * @self: A #ClutterActor
- *
- * Flags an actor to be displayed. An actor that isn't shown will not
- * be rendered on the stage.
- *
- * Actors are visible by default.
- *
- * If this function is called on an actor without a parent, the
- * #ClutterActor:show-on-set-parent will be set to %TRUE as a side
- * effect.
- */
-void
-clutter_actor_show (ClutterActor *self)
-{
- ClutterActorPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- /* simple optimization */
- if (CLUTTER_ACTOR_IS_VISIBLE (self))
- {
- /* we still need to set the :show-on-set-parent property, in
- * case show() is called on an unparented actor
- */
- set_show_on_set_parent (self, TRUE);
- return;
- }
-
-#ifdef CLUTTER_ENABLE_DEBUG
- clutter_actor_verify_map_state (self);
-#endif
-
- priv = self->priv;
-
- g_object_freeze_notify (G_OBJECT (self));
-
- set_show_on_set_parent (self, TRUE);
-
- /* if we're showing a child that needs to expand, or may
- * expand, then we need to recompute the expand flags for
- * its parent as well
- */
- if (priv->needs_compute_expand ||
- priv->needs_x_expand ||
- priv->needs_y_expand)
- {
- clutter_actor_queue_compute_expand (self);
- }
-
- g_signal_emit (self, actor_signals[SHOW], 0);
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_VISIBLE]);
-
- if (priv->parent != NULL)
- clutter_actor_queue_redraw (self);
-
- g_object_thaw_notify (G_OBJECT (self));
-}
-
-/**
- * clutter_actor_is_visible:
- * @self: a #ClutterActor
- *
- * Checks whether an actor is marked as visible.
- *
- * See also %CLUTTER_ACTOR_IS_VISIBLE and #ClutterActor:visible.
- *
- * Returns: %TRUE if the actor visible
- *
- * Since: 1.24
- */
-gboolean
-clutter_actor_is_visible (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- return CLUTTER_ACTOR_IS_VISIBLE (self);
-}
-
-static void
-clutter_actor_real_hide (ClutterActor *self)
-{
- if (!CLUTTER_ACTOR_IS_VISIBLE (self))
- return;
-
- CLUTTER_ACTOR_UNSET_FLAGS (self, CLUTTER_ACTOR_VISIBLE);
-
- /* we notify on the "visible" flag in the clutter_actor_hide()
- * wrapper so the entire hide signal emission completes first,
- * and the branch of the scene graph is in a stable state
- */
- clutter_actor_update_map_state (self, MAP_STATE_CHECK);
-}
-
-/**
- * clutter_actor_hide:
- * @self: A #ClutterActor
- *
- * Flags an actor to be hidden. A hidden actor will not be
- * rendered on the stage.
- *
- * Actors are visible by default.
- *
- * If this function is called on an actor without a parent, the
- * #ClutterActor:show-on-set-parent property will be set to %FALSE
- * as a side-effect.
- */
-void
-clutter_actor_hide (ClutterActor *self)
-{
- ClutterActorPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- /* simple optimization */
- if (!CLUTTER_ACTOR_IS_VISIBLE (self))
- {
- /* we still need to set the :show-on-set-parent property, in
- * case hide() is called on an unparented actor
- */
- set_show_on_set_parent (self, FALSE);
- return;
- }
-
-#ifdef CLUTTER_ENABLE_DEBUG
- clutter_actor_verify_map_state (self);
-#endif
-
- priv = self->priv;
-
- g_object_freeze_notify (G_OBJECT (self));
-
- set_show_on_set_parent (self, FALSE);
-
- /* if we're hiding a child that needs to expand, or may
- * expand, then we need to recompute the expand flags for
- * its parent as well
- */
- if (priv->needs_compute_expand ||
- priv->needs_x_expand ||
- priv->needs_y_expand)
- {
- clutter_actor_queue_compute_expand (self);
- }
-
- g_signal_emit (self, actor_signals[HIDE], 0);
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_VISIBLE]);
-
- if (priv->parent != NULL && priv->needs_allocation)
- clutter_actor_queue_redraw (priv->parent);
- else
- clutter_actor_queue_redraw_on_parent (self);
-
- g_object_thaw_notify (G_OBJECT (self));
-}
-
-/**
- * clutter_actor_realize:
- * @self: A #ClutterActor
- *
- * Realization informs the actor that it is attached to a stage. It
- * can use this to allocate resources if it wanted to delay allocation
- * until it would be rendered. However it is perfectly acceptable for
- * an actor to create resources before being realized because Clutter
- * only ever has a single rendering context so that actor is free to
- * be moved from one stage to another.
- *
- * This function does nothing if the actor is already realized.
- *
- * Because a realized actor must have realized parent actors, calling
- * clutter_actor_realize() will also realize all parents of the actor.
- *
- * This function does not realize child actors, except in the special
- * case that realizing the stage, when the stage is visible, will
- * suddenly map (and thus realize) the children of the stage.
- *
- * Deprecated: 1.16: Actors are automatically realized, and nothing
- * requires explicit realization.
- */
-void
-clutter_actor_realize (ClutterActor *self)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- clutter_actor_realize_internal (self);
-}
-
-/**
- * clutter_actor_is_realized:
- * @self: a #ClutterActor
- *
- * Checks whether a #ClutterActor is realized.
- *
- * See also %CLUTTER_ACTOR_IS_REALIZED and #ClutterActor:realized.
- *
- * Returns: %TRUE if the actor is realized
- *
- * Since: 1.24
- */
-gboolean
-clutter_actor_is_realized (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- return CLUTTER_ACTOR_IS_REALIZED (self);
-}
-
-static void
-clutter_actor_realize_internal (ClutterActor *self)
-{
- ClutterActorPrivate *priv = self->priv;
-
-#ifdef CLUTTER_ENABLE_DEBUG
- clutter_actor_verify_map_state (self);
-#endif
-
- if (CLUTTER_ACTOR_IS_REALIZED (self))
- return;
-
- /* To be realized, our parent actors must be realized first.
- * This will only succeed if we're inside a toplevel.
- */
- if (priv->parent != NULL)
- clutter_actor_realize (priv->parent);
-
- if (CLUTTER_ACTOR_IS_TOPLEVEL (self))
- {
- /* toplevels can be realized at any time */
- }
- else
- {
- /* "Fail" the realization if parent is missing or unrealized;
- * this should really be a g_warning() not some kind of runtime
- * failure; how can an app possibly recover? Instead it's a bug
- * in the app and the app should get an explanatory warning so
- * someone can fix it. But for now it's too hard to fix this
- * because e.g. ClutterTexture needs reworking.
- */
- if (priv->parent == NULL ||
- !CLUTTER_ACTOR_IS_REALIZED (priv->parent))
- return;
- }
-
- CLUTTER_NOTE (ACTOR, "Realizing actor '%s'", _clutter_actor_get_debug_name (self));
-
- CLUTTER_ACTOR_SET_FLAGS (self, CLUTTER_ACTOR_REALIZED);
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_REALIZED]);
-
- g_signal_emit (self, actor_signals[REALIZE], 0);
-
- /* Stage actor is allowed to unset the realized flag again in its
- * default signal handler, though that is a pathological situation.
- */
-
- /* If realization "failed" we'll have to update child state. */
- clutter_actor_update_map_state (self, MAP_STATE_CHECK);
-}
-
-static void
-clutter_actor_real_unrealize (ClutterActor *self)
-{
- /* we must be unmapped (implying our children are also unmapped) */
- g_assert (!CLUTTER_ACTOR_IS_MAPPED (self));
-}
-
-/**
- * clutter_actor_unrealize:
- * @self: A #ClutterActor
- *
- * Unrealization informs the actor that it may be being destroyed or
- * moved to another stage. The actor may want to destroy any
- * underlying graphics resources at this point. However it is
- * perfectly acceptable for it to retain the resources until the actor
- * is destroyed because Clutter only ever uses a single rendering
- * context and all of the graphics resources are valid on any stage.
- *
- * Because mapped actors must be realized, actors may not be
- * unrealized if they are mapped. This function hides the actor to be
- * sure it isn't mapped, an application-visible side effect that you
- * may not be expecting.
- *
- * This function should not be called by application code.
- *
- * This function should not really be in the public API, because
- * there isn't a good reason to call it. ClutterActor will already
- * unrealize things for you when it's important to do so.
- *
- * If you were using clutter_actor_unrealize() in a dispose
- * implementation, then don't, just chain up to ClutterActor's
- * dispose.
- *
- * If you were using clutter_actor_unrealize() to implement
- * unrealizing children of your container, then don't, ClutterActor
- * will already take care of that.
- *
- * Deprecated: 1.16: Actors are automatically unrealized, and nothing
- * requires explicit realization.
- */
-void
-clutter_actor_unrealize (ClutterActor *self)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (!CLUTTER_ACTOR_IS_MAPPED (self));
-
- clutter_actor_unrealize_internal (self);
-}
-
-/* If you were using clutter_actor_unrealize() to re-realize to
- * create your resources in a different way, then use
- * _clutter_actor_rerealize() (inside Clutter) or just call your
- * code that recreates your resources directly (outside Clutter).
- */
-static void
-clutter_actor_unrealize_internal (ClutterActor *self)
-{
-#ifdef CLUTTER_ENABLE_DEBUG
- clutter_actor_verify_map_state (self);
-#endif
-
- clutter_actor_hide (self);
-
- clutter_actor_unrealize_not_hiding (self);
-}
-
-static ClutterActorTraverseVisitFlags
-unrealize_actor_before_children_cb (ClutterActor *self,
- int depth,
- void *user_data)
-{
- /* If an actor is already unrealized we know its children have also
- * already been unrealized... */
- if (!CLUTTER_ACTOR_IS_REALIZED (self))
- return CLUTTER_ACTOR_TRAVERSE_VISIT_SKIP_CHILDREN;
-
- g_signal_emit (self, actor_signals[UNREALIZE], 0);
-
- return CLUTTER_ACTOR_TRAVERSE_VISIT_CONTINUE;
-}
-
-static ClutterActorTraverseVisitFlags
-unrealize_actor_after_children_cb (ClutterActor *self,
- int depth,
- void *user_data)
-{
- ClutterActorPrivate *priv = self->priv;
- ClutterActor *stage = user_data;
-
- /* We want to unset the realized flag only _after_
- * child actors are unrealized, to maintain invariants.
- */
- CLUTTER_ACTOR_UNSET_FLAGS (self, CLUTTER_ACTOR_REALIZED);
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_REALIZED]);
-
- if (stage != NULL &&
- priv->parent != NULL &&
- priv->parent->flags & CLUTTER_ACTOR_NO_LAYOUT)
- clutter_stage_dequeue_actor_relayout (CLUTTER_STAGE (stage), self);
-
- if (stage != NULL)
- clutter_stage_dequeue_actor_redraw (CLUTTER_STAGE (stage), self);
-
- if (priv->unmapped_paint_branch_counter == 0)
- priv->allocation = (ClutterActorBox) CLUTTER_ACTOR_BOX_UNINITIALIZED;
-
- return CLUTTER_ACTOR_TRAVERSE_VISIT_CONTINUE;
-}
-
-/*
- * clutter_actor_unrealize_not_hiding:
- * @self: A #ClutterActor
- *
- * Unrealization informs the actor that it may be being destroyed or
- * moved to another stage. The actor may want to destroy any
- * underlying graphics resources at this point. However it is
- * perfectly acceptable for it to retain the resources until the actor
- * is destroyed because Clutter only ever uses a single rendering
- * context and all of the graphics resources are valid on any stage.
- *
- * Because mapped actors must be realized, actors may not be
- * unrealized if they are mapped. You must hide the actor or one of
- * its parents before attempting to unrealize.
- *
- * This function is separate from clutter_actor_unrealize() because it
- * does not automatically hide the actor.
- * Actors need not be hidden to be unrealized, they just need to
- * be unmapped. In fact we don't want to mess up the application's
- * setting of the "visible" flag, so hiding is very undesirable.
- *
- * clutter_actor_unrealize() does a clutter_actor_hide() just for
- * backward compatibility.
- */
-static void
-clutter_actor_unrealize_not_hiding (ClutterActor *self)
-{
- ClutterActor *stage = _clutter_actor_get_stage_internal (self);
-
- _clutter_actor_traverse (self,
- CLUTTER_ACTOR_TRAVERSE_DEPTH_FIRST,
- unrealize_actor_before_children_cb,
- unrealize_actor_after_children_cb,
- stage);
-}
-
-/*
- * _clutter_actor_rerealize:
- * @self: A #ClutterActor
- * @callback: Function to call while unrealized
- * @data: data for callback
- *
- * If an actor is already unrealized, this just calls the callback.
- *
- * If it is realized, it unrealizes temporarily, calls the callback,
- * and then re-realizes the actor.
- *
- * As a side effect, leaves all children of the actor unrealized if
- * the actor was realized but not showing. This is because when we
- * unrealize the actor temporarily we must unrealize its children
- * (e.g. children of a stage can't be realized if stage window is
- * gone). And we aren't clever enough to save the realization state of
- * all children. In most cases this should not matter, because
- * the children will automatically realize when they next become mapped.
- */
-void
-_clutter_actor_rerealize (ClutterActor *self,
- ClutterCallback callback,
- void *data)
-{
- gboolean was_mapped;
- gboolean was_showing;
- gboolean was_realized;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
-#ifdef CLUTTER_ENABLE_DEBUG
- clutter_actor_verify_map_state (self);
-#endif
-
- was_realized = CLUTTER_ACTOR_IS_REALIZED (self);
- was_mapped = CLUTTER_ACTOR_IS_MAPPED (self);
- was_showing = CLUTTER_ACTOR_IS_VISIBLE (self);
-
- /* Must be unmapped to unrealize. Note we only have to hide this
- * actor if it was mapped (if all parents were showing). If actor
- * is merely visible (but not mapped), then that's fine, we can
- * leave it visible.
- */
- if (was_mapped)
- clutter_actor_hide (self);
-
- g_assert (!CLUTTER_ACTOR_IS_MAPPED (self));
-
- /* unrealize self and all children */
- clutter_actor_unrealize_not_hiding (self);
-
- if (callback != NULL)
- {
- (* callback) (self, data);
- }
-
- if (was_showing)
- clutter_actor_show (self); /* will realize only if mapping implies it */
- else if (was_realized)
- clutter_actor_realize (self); /* realize self and all parents */
-}
-
-static void
-clutter_actor_real_pick (ClutterActor *self,
- ClutterPickContext *pick_context)
-{
- ClutterActorPrivate *priv = self->priv;
-
- if (clutter_actor_should_pick (self, pick_context))
- {
- ClutterActorBox box = {
- .x1 = 0,
- .y1 = 0,
- .x2 = priv->allocation.x2 - priv->allocation.x1,
- .y2 = priv->allocation.y2 - priv->allocation.y1,
- };
-
- clutter_actor_pick_box (self, pick_context, &box);
- }
-
- /* XXX - this thoroughly sucks, but we need to maintain compatibility
- * with existing container classes that override the pick() virtual
- * and chain up to the default implementation - otherwise we'll end up
- * painting our children twice.
- *
- * this has to go away for 2.0; hopefully along the pick() itself.
- */
- if (CLUTTER_ACTOR_GET_CLASS (self)->pick == clutter_actor_real_pick)
- {
- ClutterActor *iter;
-
- for (iter = self->priv->first_child;
- iter != NULL;
- iter = iter->priv->next_sibling)
- clutter_actor_pick (iter, pick_context);
- }
-}
-
-/**
- * clutter_actor_should_pick:
- * @self: A #ClutterActor
- * @pick_context: a #ClutterPickContext
- *
- * Should be called inside the implementation of the
- * #ClutterActor::pick virtual function in order to check whether
- * the actor should be picked or not.
- *
- * This function should never be called directly by applications.
- *
- * Return value: %TRUE if the actor should be picked, %FALSE otherwise
- */
-gboolean
-clutter_actor_should_pick (ClutterActor *self,
- ClutterPickContext *pick_context)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- if (CLUTTER_ACTOR_IS_MAPPED (self) &&
- clutter_actor_box_is_initialized (&self->priv->allocation) &&
- (clutter_pick_context_get_mode (pick_context) == CLUTTER_PICK_ALL ||
- CLUTTER_ACTOR_IS_REACTIVE (self)))
- return TRUE;
-
- return FALSE;
-}
-
-static void
-clutter_actor_real_get_preferred_width (ClutterActor *self,
- gfloat for_height,
- gfloat *min_width_p,
- gfloat *natural_width_p)
-{
- ClutterActorPrivate *priv = self->priv;
-
- if (priv->layout_manager != NULL)
- {
- ClutterContainer *container = CLUTTER_CONTAINER (self);
-
- CLUTTER_NOTE (LAYOUT, "Querying the layout manager '%s'[%p] "
- "for the preferred width",
- G_OBJECT_TYPE_NAME (priv->layout_manager),
- priv->layout_manager);
-
- clutter_layout_manager_get_preferred_width (priv->layout_manager,
- container,
- for_height,
- min_width_p,
- natural_width_p);
-
- return;
- }
-
- /* Default implementation is always 0x0, usually an actor
- * using this default is relying on someone to set the
- * request manually
- */
- CLUTTER_NOTE (LAYOUT, "Default preferred width: 0, 0");
-
- if (min_width_p)
- *min_width_p = 0;
-
- if (natural_width_p)
- *natural_width_p = 0;
-}
-
-static void
-clutter_actor_real_get_preferred_height (ClutterActor *self,
- gfloat for_width,
- gfloat *min_height_p,
- gfloat *natural_height_p)
-{
- ClutterActorPrivate *priv = self->priv;
-
- if (priv->layout_manager != NULL)
- {
- ClutterContainer *container = CLUTTER_CONTAINER (self);
-
- CLUTTER_NOTE (LAYOUT, "Querying the layout manager '%s'[%p] "
- "for the preferred height",
- G_OBJECT_TYPE_NAME (priv->layout_manager),
- priv->layout_manager);
-
- clutter_layout_manager_get_preferred_height (priv->layout_manager,
- container,
- for_width,
- min_height_p,
- natural_height_p);
-
- return;
- }
- /* Default implementation is always 0x0, usually an actor
- * using this default is relying on someone to set the
- * request manually
- */
- CLUTTER_NOTE (LAYOUT, "Default preferred height: 0, 0");
-
- if (min_height_p)
- *min_height_p = 0;
-
- if (natural_height_p)
- *natural_height_p = 0;
-}
-
-static void
-clutter_actor_store_old_geometry (ClutterActor *self,
- ClutterActorBox *box)
-{
- *box = self->priv->allocation;
-}
-
-static inline void
-clutter_actor_notify_if_geometry_changed (ClutterActor *self,
- const ClutterActorBox *old)
-{
- ClutterActorPrivate *priv = self->priv;
- GObject *obj = G_OBJECT (self);
-
- g_object_freeze_notify (obj);
-
- /* to avoid excessive requisition or allocation cycles we
- * use the cached values.
- *
- * - if we don't have an allocation we assume that we need
- * to notify anyway
- * - if we don't have a width or a height request we notify
- * width and height
- * - if we have a valid allocation then we check the old
- * bounding box with the current allocation and we notify
- * the changes
- */
- if (priv->needs_allocation)
- {
- g_object_notify_by_pspec (obj, obj_props[PROP_X]);
- g_object_notify_by_pspec (obj, obj_props[PROP_Y]);
- g_object_notify_by_pspec (obj, obj_props[PROP_POSITION]);
- g_object_notify_by_pspec (obj, obj_props[PROP_WIDTH]);
- g_object_notify_by_pspec (obj, obj_props[PROP_HEIGHT]);
- g_object_notify_by_pspec (obj, obj_props[PROP_SIZE]);
- }
- else if (priv->needs_width_request || priv->needs_height_request)
- {
- g_object_notify_by_pspec (obj, obj_props[PROP_WIDTH]);
- g_object_notify_by_pspec (obj, obj_props[PROP_HEIGHT]);
- g_object_notify_by_pspec (obj, obj_props[PROP_SIZE]);
- }
- else
- {
- gfloat x, y;
- gfloat width, height;
-
- x = priv->allocation.x1;
- y = priv->allocation.y1;
- width = priv->allocation.x2 - priv->allocation.x1;
- height = priv->allocation.y2 - priv->allocation.y1;
-
- if (x != old->x1)
- {
- g_object_notify_by_pspec (obj, obj_props[PROP_X]);
- g_object_notify_by_pspec (obj, obj_props[PROP_POSITION]);
- }
-
- if (y != old->y1)
- {
- g_object_notify_by_pspec (obj, obj_props[PROP_Y]);
- g_object_notify_by_pspec (obj, obj_props[PROP_POSITION]);
- }
-
- if (width != (old->x2 - old->x1))
- {
- g_object_notify_by_pspec (obj, obj_props[PROP_WIDTH]);
- g_object_notify_by_pspec (obj, obj_props[PROP_SIZE]);
- }
-
- if (height != (old->y2 - old->y1))
- {
- g_object_notify_by_pspec (obj, obj_props[PROP_HEIGHT]);
- g_object_notify_by_pspec (obj, obj_props[PROP_SIZE]);
- }
- }
-
- g_object_thaw_notify (obj);
-}
-
-static void
-absolute_geometry_changed (ClutterActor *actor)
-{
- queue_update_stage_views (actor);
-}
-
-static ClutterActorTraverseVisitFlags
-absolute_geometry_changed_cb (ClutterActor *actor,
- int depth,
- gpointer user_data)
-{
- absolute_geometry_changed (actor);
-
- return CLUTTER_ACTOR_TRAVERSE_VISIT_CONTINUE;
-}
-
-static void
-transform_changed (ClutterActor *actor)
-{
- actor->priv->transform_valid = FALSE;
-
- if (actor->priv->parent)
- queue_update_paint_volume (actor->priv->parent);
-
- _clutter_actor_traverse (actor,
- CLUTTER_ACTOR_TRAVERSE_DEPTH_FIRST,
- absolute_geometry_changed_cb,
- NULL,
- NULL);
-}
-
-/*< private >
- * clutter_actor_set_allocation_internal:
- * @self: a #ClutterActor
- * @box: a #ClutterActorBox
- * @flags: allocation flags
- *
- * Stores the allocation of @self.
- *
- * This function only performs basic storage and property notification.
- *
- * This function should be called by clutter_actor_set_allocation()
- * and by the default implementation of #ClutterActorClass.allocate().
- *
- * Return value: %TRUE if the allocation of the #ClutterActor has been
- * changed, and %FALSE otherwise
- */
-static inline void
-clutter_actor_set_allocation_internal (ClutterActor *self,
- const ClutterActorBox *box)
-{
- ClutterActorPrivate *priv = self->priv;
- GObject *obj;
- gboolean origin_changed, size_changed;
- ClutterActorBox old_alloc = { 0, };
-
- g_return_if_fail (!isnan (box->x1) && !isnan (box->x2) &&
- !isnan (box->y1) && !isnan (box->y2));
-
- obj = G_OBJECT (self);
-
- g_object_freeze_notify (obj);
-
- clutter_actor_store_old_geometry (self, &old_alloc);
-
- origin_changed =
- priv->allocation.x1 != box->x1 || priv->allocation.y1 != box->y1;
- size_changed =
- priv->allocation.x2 - priv->allocation.x1 != box->x2 - box->x1 ||
- priv->allocation.y2 - priv->allocation.y1 != box->y2 - box->y1;
-
- priv->allocation = *box;
-
- /* allocation is authoritative */
- priv->needs_width_request = FALSE;
- priv->needs_height_request = FALSE;
- priv->needs_allocation = FALSE;
-
- if (origin_changed || size_changed)
- {
- CLUTTER_NOTE (LAYOUT, "Allocation for '%s' changed",
- _clutter_actor_get_debug_name (self));
-
- /* This will also call absolute_geometry_changed() on the subtree */
- transform_changed (self);
-
- if (size_changed)
- queue_update_paint_volume (self);
-
- g_object_notify_by_pspec (obj, obj_props[PROP_ALLOCATION]);
-
- /* if the allocation changes, so does the content box */
- if (priv->content != NULL)
- {
- priv->content_box_valid = FALSE;
- g_object_notify_by_pspec (obj, obj_props[PROP_CONTENT_BOX]);
- }
- }
-
- clutter_actor_notify_if_geometry_changed (self, &old_alloc);
-
- g_object_thaw_notify (obj);
-}
-
-static void
-clutter_actor_real_allocate (ClutterActor *self,
- const ClutterActorBox *box)
-{
- ClutterActorPrivate *priv = self->priv;
-
- g_object_freeze_notify (G_OBJECT (self));
-
- clutter_actor_set_allocation_internal (self, box);
-
- /* we allocate our children before we notify changes in our geometry,
- * so that people connecting to properties will be able to get valid
- * data out of the sub-tree of the scene graph that has this actor at
- * the root.
- */
- if (priv->n_children != 0 &&
- priv->layout_manager != NULL)
- {
- ClutterActorBox children_box;
-
- /* normalize the box passed to the layout manager */
- children_box.x1 = children_box.y1 = 0.f;
- children_box.x2 = box->x2 - box->x1;
- children_box.y2 = box->y2 - box->y1;
-
- CLUTTER_NOTE (LAYOUT,
- "Allocating %d children of %s "
- "at { %.2f, %.2f - %.2f x %.2f } "
- "using %s",
- priv->n_children,
- _clutter_actor_get_debug_name (self),
- box->x1,
- box->y1,
- (box->x2 - box->x1),
- (box->y2 - box->y1),
- G_OBJECT_TYPE_NAME (priv->layout_manager));
-
- clutter_layout_manager_allocate (priv->layout_manager,
- CLUTTER_CONTAINER (self),
- &children_box);
- }
-
- g_object_thaw_notify (G_OBJECT (self));
-}
-
-static void
-_clutter_actor_queue_redraw_on_clones (ClutterActor *self)
-{
- ClutterActorPrivate *priv = self->priv;
- GHashTableIter iter;
- gpointer key;
-
- if (priv->clones == NULL)
- return;
-
- g_hash_table_iter_init (&iter, priv->clones);
- while (g_hash_table_iter_next (&iter, &key, NULL))
- clutter_actor_queue_redraw (key);
-}
-
-static void
-_clutter_actor_propagate_queue_redraw (ClutterActor *self,
- ClutterActor *origin)
-{
- while (self)
- {
- /* no point in queuing a redraw on a destroyed actor */
- if (CLUTTER_ACTOR_IN_DESTRUCTION (self))
- break;
-
- _clutter_actor_queue_redraw_on_clones (self);
-
- /* If the queue redraw is coming from a child then the actor has
- become dirty and any queued effect is no longer valid */
- if (self != origin)
- {
- self->priv->is_dirty = TRUE;
- self->priv->effect_to_redraw = NULL;
- }
-
- /* If the actor isn't visible, we still had to emit the signal
- * to allow for a ClutterClone, but the appearance of the parent
- * won't change so we don't have to propagate up the hierarchy.
- */
- if (!CLUTTER_ACTOR_IS_VISIBLE (self))
- break;
-
- /* We guarantee that we will propagate a queue-redraw up the tree
- * at least once so that all clones can get notified.
- */
- if (self->priv->propagated_one_redraw)
- break;
-
- self->priv->propagated_one_redraw = TRUE;
-
- self = self->priv->parent;
- }
-}
-
-static inline gboolean
-clutter_actor_needs_relayout (ClutterActor *self)
-{
- ClutterActorPrivate *priv = self->priv;
-
- return (priv->needs_width_request ||
- priv->needs_height_request ||
- priv->needs_allocation);
-}
-
-static void
-clutter_actor_real_queue_relayout (ClutterActor *self)
-{
- ClutterActorPrivate *priv = self->priv;
-
- /* no point in queueing a redraw on a destroyed actor */
- if (CLUTTER_ACTOR_IN_DESTRUCTION (self))
- return;
-
- priv->needs_width_request = TRUE;
- priv->needs_height_request = TRUE;
- priv->needs_allocation = TRUE;
-
- /* reset the cached size requests */
- memset (priv->width_requests, 0,
- N_CACHED_SIZE_REQUESTS * sizeof (SizeRequest));
- memset (priv->height_requests, 0,
- N_CACHED_SIZE_REQUESTS * sizeof (SizeRequest));
-
- /* We may need to go all the way up the hierarchy */
- if (priv->parent != NULL)
- {
- if (priv->parent->flags & CLUTTER_ACTOR_NO_LAYOUT)
- clutter_actor_queue_shallow_relayout (self);
- else
- _clutter_actor_queue_only_relayout (priv->parent);
- }
-}
-
-/**
- * clutter_actor_apply_relative_transform_to_point:
- * @self: A #ClutterActor
- * @ancestor: (allow-none): A #ClutterActor ancestor, or %NULL to use the
- * default #ClutterStage
- * @point: A point as #graphene_point3d_t
- * @vertex: (out caller-allocates): The translated #graphene_point3d_t
- *
- * Transforms @point in coordinates relative to the actor into
- * ancestor-relative coordinates using the relevant transform
- * stack (i.e. scale, rotation, etc).
- *
- * If @ancestor is %NULL the ancestor will be the #ClutterStage. In
- * this case, the coordinates returned will be the coordinates on
- * the stage before the projection is applied. This is different from
- * the behaviour of clutter_actor_apply_transform_to_point().
- *
- * Since: 0.6
- */
-void
-clutter_actor_apply_relative_transform_to_point (ClutterActor *self,
- ClutterActor *ancestor,
- const graphene_point3d_t *point,
- graphene_point3d_t *vertex)
-{
- gfloat w;
- graphene_matrix_t matrix;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (ancestor == NULL || CLUTTER_IS_ACTOR (ancestor));
- g_return_if_fail (point != NULL);
- g_return_if_fail (vertex != NULL);
-
- *vertex = *point;
- w = 1.0;
-
- if (ancestor == NULL)
- ancestor = _clutter_actor_get_stage_internal (self);
-
- if (ancestor == NULL)
- {
- *vertex = *point;
- return;
- }
-
- _clutter_actor_get_relative_transformation_matrix (self, ancestor, &matrix);
- cogl_graphene_matrix_project_point (&matrix,
- &vertex->x,
- &vertex->y,
- &vertex->z,
- &w);
-}
-
-static gboolean
-_clutter_actor_fully_transform_vertices (ClutterActor *self,
- const graphene_point3d_t *vertices_in,
- graphene_point3d_t *vertices_out,
- int n_vertices)
-{
- ClutterActor *stage;
- graphene_matrix_t modelview;
- graphene_matrix_t projection;
- float viewport[4];
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- stage = _clutter_actor_get_stage_internal (self);
-
- /* We really can't do anything meaningful in this case so don't try
- * to do any transform */
- if (stage == NULL)
- return FALSE;
-
- /* Note: we pass NULL as the ancestor because we don't just want the modelview
- * that gets us to stage coordinates, we want to go all the way to eye
- * coordinates */
- _clutter_actor_get_relative_transformation_matrix (self, NULL, &modelview);
-
- /* Fetch the projection and viewport */
- _clutter_stage_get_projection_matrix (CLUTTER_STAGE (stage), &projection);
- _clutter_stage_get_viewport (CLUTTER_STAGE (stage),
- &viewport[0],
- &viewport[1],
- &viewport[2],
- &viewport[3]);
-
- _clutter_util_fully_transform_vertices (&modelview,
- &projection,
- viewport,
- vertices_in,
- vertices_out,
- n_vertices);
-
- return TRUE;
-}
-
-/**
- * clutter_actor_apply_transform_to_point:
- * @self: A #ClutterActor
- * @point: A point as #graphene_point3d_t
- * @vertex: (out caller-allocates): The translated #graphene_point3d_t
- *
- * Transforms @point in coordinates relative to the actor
- * into screen-relative coordinates with the current actor
- * transformation (i.e. scale, rotation, etc)
- *
- * Since: 0.4
- **/
-void
-clutter_actor_apply_transform_to_point (ClutterActor *self,
- const graphene_point3d_t *point,
- graphene_point3d_t *vertex)
-{
- g_return_if_fail (point != NULL);
- g_return_if_fail (vertex != NULL);
- _clutter_actor_fully_transform_vertices (self, point, vertex, 1);
-}
-
-/*
- * _clutter_actor_get_relative_transformation_matrix:
- * @self: The actor whose coordinate space you want to transform from.
- * @ancestor: The ancestor actor whose coordinate space you want to transform too
- * or %NULL if you want to transform all the way to eye coordinates.
- * @matrix: A #graphene_matrix_t to store the transformation
- *
- * This gets a transformation @matrix that will transform coordinates from the
- * coordinate space of @self into the coordinate space of @ancestor.
- *
- * For example if you need a matrix that can transform the local actor
- * coordinates of @self into stage coordinates you would pass the actor's stage
- * pointer as the @ancestor.
- *
- * If you pass %NULL then the transformation will take you all the way through
- * to eye coordinates. This can be useful if you want to extract the entire
- * modelview transform that Clutter applies before applying the projection
- * transformation. If you want to explicitly set a modelview on a CoglFramebuffer
- * using cogl_set_modelview_matrix() for example then you would want a matrix
- * that transforms into eye coordinates.
- *
- * Note: This function explicitly initializes the given @matrix. If you just
- * want clutter to multiply a relative transformation with an existing matrix
- * you can use clutter_actor_apply_relative_transformation_matrix()
- * instead.
- *
- */
-/* XXX: We should consider caching the stage relative modelview along with
- * the actor itself */
-static void
-_clutter_actor_get_relative_transformation_matrix (ClutterActor *self,
- ClutterActor *ancestor,
- graphene_matrix_t *matrix)
-{
- graphene_matrix_init_identity (matrix);
-
- _clutter_actor_apply_relative_transformation_matrix (self, ancestor, matrix);
-}
-
-/* Project the given @box into stage window coordinates, writing the
- * transformed vertices to @verts[]. */
-static gboolean
-_clutter_actor_transform_and_project_box (ClutterActor *self,
- const ClutterActorBox *box,
- graphene_point3d_t *verts)
-{
- graphene_point3d_t box_vertices[4];
-
- box_vertices[0].x = box->x1;
- box_vertices[0].y = box->y1;
- box_vertices[0].z = 0;
- box_vertices[1].x = box->x2;
- box_vertices[1].y = box->y1;
- box_vertices[1].z = 0;
- box_vertices[2].x = box->x1;
- box_vertices[2].y = box->y2;
- box_vertices[2].z = 0;
- box_vertices[3].x = box->x2;
- box_vertices[3].y = box->y2;
- box_vertices[3].z = 0;
-
- return
- _clutter_actor_fully_transform_vertices (self, box_vertices, verts, 4);
-}
-
-/**
- * clutter_actor_get_abs_allocation_vertices:
- * @self: A #ClutterActor
- * @verts: (out) (array fixed-size=4): Pointer to a location of an array
- * of 4 #graphene_point3d_t where to store the result.
- *
- * Calculates the transformed screen coordinates of the four corners of
- * the actor; the returned vertices relate to the #ClutterActorBox
- * coordinates as follows:
- *
- * - v[0] contains (x1, y1)
- * - v[1] contains (x2, y1)
- * - v[2] contains (x1, y2)
- * - v[3] contains (x2, y2)
- *
- * Since: 0.4
- */
-void
-clutter_actor_get_abs_allocation_vertices (ClutterActor *self,
- graphene_point3d_t *verts)
-{
- ClutterActorPrivate *priv;
- ClutterActorBox actor_space_allocation;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- priv = self->priv;
-
- /* if the actor needs to be allocated we force a relayout, so that
- * the actor allocation box will be valid for
- * _clutter_actor_transform_and_project_box()
- */
- if (priv->needs_allocation)
- {
- ClutterActor *stage = _clutter_actor_get_stage_internal (self);
- /* There's nothing meaningful we can do now */
- if (!stage)
- return;
-
- clutter_stage_maybe_relayout (stage);
- }
-
- /* NB: _clutter_actor_transform_and_project_box expects a box in the actor's
- * own coordinate space... */
- actor_space_allocation.x1 = 0;
- actor_space_allocation.y1 = 0;
- actor_space_allocation.x2 = priv->allocation.x2 - priv->allocation.x1;
- actor_space_allocation.y2 = priv->allocation.y2 - priv->allocation.y1;
- _clutter_actor_transform_and_project_box (self,
- &actor_space_allocation,
- verts);
-}
-
-static void
-clutter_actor_real_apply_transform (ClutterActor *self,
- graphene_matrix_t *matrix)
-{
- ClutterActorPrivate *priv = self->priv;
- const ClutterTransformInfo *info;
- graphene_point3d_t p;
- float pivot_x = 0.f, pivot_y = 0.f;
-
- info = _clutter_actor_get_transform_info_or_defaults (self);
-
- /* compute the pivot point given the allocated size */
- pivot_x = (priv->allocation.x2 - priv->allocation.x1)
- * info->pivot.x;
- pivot_y = (priv->allocation.y2 - priv->allocation.y1)
- * info->pivot.y;
-
- CLUTTER_NOTE (PAINT,
- "Allocation: (%.2f, %2.f), "
- "pivot: (%.2f, %.2f), "
- "translation: (%.2f, %.2f) -> "
- "new origin: (%.2f, %.2f)",
- priv->allocation.x1, priv->allocation.y1,
- info->pivot.x, info->pivot.y,
- info->translation.x, info->translation.y,
- priv->allocation.x1 + pivot_x + info->translation.x,
- priv->allocation.y1 + pivot_y + info->translation.y);
-
- /* roll back the pivot translation */
- if (pivot_x != 0.f || pivot_y != 0.f || info->pivot_z != 0.f)
- {
- graphene_point3d_init (&p, -pivot_x, -pivot_y, -info->pivot_z);
- graphene_matrix_translate (matrix, &p);
- }
-
- /* if we have an overriding transformation, we use that, and get out */
- if (info->transform_set)
- {
- graphene_matrix_multiply (matrix, &info->transform, matrix);
-
- /* we still need to apply the :allocation's origin and :pivot-point
- * translations, since :transform is relative to the actor's coordinate
- * space, and to the pivot point
- */
- graphene_point3d_init (&p,
- priv->allocation.x1 + pivot_x,
- priv->allocation.y1 + pivot_y,
- info->pivot_z);
- graphene_matrix_translate (matrix, &p);
- goto roll_back;
- }
-
- if (info->rx_angle)
- graphene_matrix_rotate (matrix, info->rx_angle, graphene_vec3_x_axis ());
-
- if (info->ry_angle)
- graphene_matrix_rotate (matrix, info->ry_angle, graphene_vec3_y_axis ());
-
- if (info->rz_angle)
- graphene_matrix_rotate (matrix, info->rz_angle, graphene_vec3_z_axis ());
-
- if (info->scale_x != 1.0 || info->scale_y != 1.0 || info->scale_z != 1.0)
- graphene_matrix_scale (matrix, info->scale_x, info->scale_y, info->scale_z);
-
- /* basic translation: :allocation's origin and :z-position; instead
- * of decomposing the pivot and translation info separate operations,
- * we just compose everything into a single translation
- */
- graphene_point3d_init (&p,
- priv->allocation.x1 + pivot_x + info->translation.x,
- priv->allocation.y1 + pivot_y + info->translation.y,
- info->z_position + info->pivot_z + info->translation.z);
- graphene_matrix_translate (matrix, &p);
-
-roll_back:
- /* we apply the :child-transform from the parent actor, if we have one */
- if (priv->parent != NULL)
- {
- const ClutterTransformInfo *parent_info;
-
- parent_info = _clutter_actor_get_transform_info_or_defaults (priv->parent);
- graphene_matrix_multiply (matrix, &parent_info->child_transform, matrix);
- }
-}
-
-/* Applies the transforms associated with this actor to the given
- * matrix. */
-
-static void
-ensure_valid_actor_transform (ClutterActor *actor)
-{
- ClutterActorPrivate *priv = actor->priv;
-
- if (priv->transform_valid)
- return;
-
- graphene_matrix_init_identity (&priv->transform);
-
- CLUTTER_ACTOR_GET_CLASS (actor)->apply_transform (actor, &priv->transform);
-
- priv->transform_valid = TRUE;
-}
-
-void
-_clutter_actor_apply_modelview_transform (ClutterActor *self,
- graphene_matrix_t *matrix)
-{
- ClutterActorPrivate *priv = self->priv;
-
- ensure_valid_actor_transform (self);
- graphene_matrix_multiply (&priv->transform, matrix, matrix);
-}
-
-/*
- * clutter_actor_apply_relative_transformation_matrix:
- * @self: The actor whose coordinate space you want to transform from.
- * @ancestor: The ancestor actor whose coordinate space you want to transform too
- * or %NULL if you want to transform all the way to eye coordinates.
- * @matrix: A #graphene_matrix_t to apply the transformation too.
- *
- * This multiplies a transform with @matrix that will transform coordinates
- * from the coordinate space of @self into the coordinate space of @ancestor.
- *
- * For example if you need a matrix that can transform the local actor
- * coordinates of @self into stage coordinates you would pass the actor's stage
- * pointer as the @ancestor.
- *
- * If you pass %NULL then the transformation will take you all the way through
- * to eye coordinates. This can be useful if you want to extract the entire
- * modelview transform that Clutter applies before applying the projection
- * transformation. If you want to explicitly set a modelview on a CoglFramebuffer
- * using cogl_set_modelview_matrix() for example then you would want a matrix
- * that transforms into eye coordinates.
- *
- * This function doesn't initialize the given @matrix, it simply
- * multiplies the requested transformation matrix with the existing contents of
- * @matrix. You can use graphene_matrix_init_identity() to initialize the @matrix
- * before calling this function, or you can use
- * clutter_actor_get_relative_transformation_matrix() instead.
- */
-void
-_clutter_actor_apply_relative_transformation_matrix (ClutterActor *self,
- ClutterActor *ancestor,
- graphene_matrix_t *matrix)
-{
- /* Note we terminate before ever calling stage->apply_transform()
- * since that would conceptually be relative to the underlying
- * window OpenGL coordinates so we'd need a special @ancestor
- * value to represent the fake parent of the stage. */
- if (self == ancestor)
- return;
-
- if (self->priv->parent != NULL)
- _clutter_actor_apply_relative_transformation_matrix (self->priv->parent,
- ancestor,
- matrix);
-
- _clutter_actor_apply_modelview_transform (self, matrix);
-}
-
-static void
-_clutter_actor_draw_paint_volume_full (ClutterActor *self,
- ClutterPaintVolume *pv,
- const char *label,
- const ClutterColor *color,
- ClutterPaintNode *node)
-{
- g_autoptr (ClutterPaintNode) pipeline_node = NULL;
- static CoglPipeline *outline = NULL;
- CoglPrimitive *prim;
- graphene_point3d_t line_ends[12 * 2];
- int n_vertices;
- CoglContext *ctx =
- clutter_backend_get_cogl_context (clutter_get_default_backend ());
- CoglColor cogl_color;
-
- if (outline == NULL)
- outline = cogl_pipeline_new (ctx);
-
- _clutter_paint_volume_complete (pv);
-
- n_vertices = pv->is_2d ? 4 * 2 : 12 * 2;
-
- /* Front face */
- line_ends[0] = pv->vertices[0]; line_ends[1] = pv->vertices[1];
- line_ends[2] = pv->vertices[1]; line_ends[3] = pv->vertices[2];
- line_ends[4] = pv->vertices[2]; line_ends[5] = pv->vertices[3];
- line_ends[6] = pv->vertices[3]; line_ends[7] = pv->vertices[0];
-
- if (!pv->is_2d)
- {
- /* Back face */
- line_ends[8] = pv->vertices[4]; line_ends[9] = pv->vertices[5];
- line_ends[10] = pv->vertices[5]; line_ends[11] = pv->vertices[6];
- line_ends[12] = pv->vertices[6]; line_ends[13] = pv->vertices[7];
- line_ends[14] = pv->vertices[7]; line_ends[15] = pv->vertices[4];
-
- /* Lines connecting front face to back face */
- line_ends[16] = pv->vertices[0]; line_ends[17] = pv->vertices[4];
- line_ends[18] = pv->vertices[1]; line_ends[19] = pv->vertices[5];
- line_ends[20] = pv->vertices[2]; line_ends[21] = pv->vertices[6];
- line_ends[22] = pv->vertices[3]; line_ends[23] = pv->vertices[7];
- }
-
- prim = cogl_primitive_new_p3 (ctx, COGL_VERTICES_MODE_LINES,
- n_vertices,
- (CoglVertexP3 *)line_ends);
-
- cogl_color_init_from_4ub (&cogl_color,
- color->red,
- color->green,
- color->blue,
- color->alpha);
- cogl_pipeline_set_color (outline, &cogl_color);
-
- pipeline_node = clutter_pipeline_node_new (outline);
- clutter_paint_node_set_static_name (pipeline_node,
- "ClutterActor (paint volume outline)");
- clutter_paint_node_add_primitive (pipeline_node, prim);
- clutter_paint_node_add_child (node, pipeline_node);
- cogl_object_unref (prim);
-
- if (label)
- {
- g_autoptr (ClutterPaintNode) text_node = NULL;
- PangoLayout *layout;
-
- layout = pango_layout_new (clutter_actor_get_pango_context (self));
- pango_layout_set_text (layout, label, -1);
-
- text_node = clutter_text_node_new (layout, color);
- clutter_paint_node_set_static_name (text_node,
- "ClutterActor (paint volume label)");
- clutter_paint_node_add_rectangle (text_node,
- &(ClutterActorBox) {
- .x1 = pv->vertices[0].x,
- .y1 = pv->vertices[0].y,
- .x2 = pv->vertices[2].x,
- .y2 = pv->vertices[2].y,
- });
- clutter_paint_node_add_child (node, text_node);
-
- g_object_unref (layout);
- }
-}
-
-static void
-_clutter_actor_draw_paint_volume (ClutterActor *self,
- ClutterPaintNode *node)
-{
- ClutterPaintVolume *pv;
- ClutterColor color;
-
- pv = _clutter_actor_get_paint_volume_mutable (self);
- if (!pv)
- {
- gfloat width, height;
- ClutterPaintVolume fake_pv;
-
- ClutterActor *stage = _clutter_actor_get_stage_internal (self);
- _clutter_paint_volume_init_static (&fake_pv, stage);
-
- clutter_actor_get_size (self, &width, &height);
- clutter_paint_volume_set_width (&fake_pv, width);
- clutter_paint_volume_set_height (&fake_pv, height);
-
- clutter_color_init (&color, 0, 0, 255, 255);
- _clutter_actor_draw_paint_volume_full (self, &fake_pv,
- _clutter_actor_get_debug_name (self),
- &color,
- node);
-
- clutter_paint_volume_free (&fake_pv);
- }
- else
- {
- clutter_color_init (&color, 0, 255, 0, 255);
- _clutter_actor_draw_paint_volume_full (self, pv,
- _clutter_actor_get_debug_name (self),
- &color,
- node);
- }
-}
-
-static void
-_clutter_actor_paint_cull_result (ClutterActor *self,
- gboolean success,
- ClutterCullResult result,
- ClutterPaintNode *node)
-{
- ClutterActorPrivate *priv = self->priv;
- ClutterPaintVolume *pv;
- ClutterColor color;
-
- if (success)
- {
- switch (result)
- {
- case CLUTTER_CULL_RESULT_IN:
- clutter_color_init (&color, 0, 255, 0, 255);
- break;
- case CLUTTER_CULL_RESULT_OUT:
- clutter_color_init (&color, 0, 0, 255, 255);
- break;
- default:
- clutter_color_init (&color, 0, 255, 255, 255);
- break;
- }
- }
- else
- clutter_color_init (&color, 255, 255, 255, 255);
-
- if (success && (pv = _clutter_actor_get_paint_volume_mutable (self)))
- _clutter_actor_draw_paint_volume_full (self, pv,
- _clutter_actor_get_debug_name (self),
- &color,
- node);
- else
- {
- g_autoptr (ClutterPaintNode) text_node = NULL;
- PangoLayout *layout;
- float width;
- float height;
- char *label =
- g_strdup_printf ("CULL FAILURE: %s", _clutter_actor_get_debug_name (self));
- clutter_color_init (&color, 255, 255, 255, 255);
-
- width = clutter_actor_box_get_width (&priv->allocation);
- height = clutter_actor_box_get_height (&priv->allocation);
-
- layout = pango_layout_new (clutter_actor_get_pango_context (self));
- pango_layout_set_text (layout, label, -1);
-
- text_node = clutter_text_node_new (layout, &color);
- clutter_paint_node_set_static_name (text_node,
- "ClutterActor (paint volume text)");
- clutter_paint_node_add_rectangle (text_node,
- &(ClutterActorBox) {
- .x1 = 0.f,
- .y1 = 0.f,
- .x2 = width,
- .y2 = height,
- });
- clutter_paint_node_add_child (node, text_node);
-
- g_free (label);
- g_object_unref (layout);
- }
-}
-
-static int clone_paint_level = 0;
-
-void
-_clutter_actor_push_clone_paint (void)
-{
- clone_paint_level++;
-}
-
-void
-_clutter_actor_pop_clone_paint (void)
-{
- clone_paint_level--;
-}
-
-static gboolean
-in_clone_paint (void)
-{
- return clone_paint_level > 0;
-}
-
-/* Returns TRUE if the actor can be ignored */
-/* FIXME: we should return a ClutterCullResult, and
- * clutter_actor_paint should understand that a CLUTTER_CULL_RESULT_IN
- * means there's no point in trying to cull descendants of the current
- * node. */
-static gboolean
-cull_actor (ClutterActor *self,
- ClutterPaintContext *paint_context,
- ClutterCullResult *result_out)
-{
- ClutterActorPrivate *priv = self->priv;
- const GArray *clip_frusta;
- ClutterCullResult result = CLUTTER_CULL_RESULT_IN;
- int i;
-
- if (!priv->last_paint_volume_valid)
- {
- CLUTTER_NOTE (CLIPPING, "Bail from cull_actor without culling (%s): "
- "->last_paint_volume_valid == FALSE",
- _clutter_actor_get_debug_name (self));
- return FALSE;
- }
-
- if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_DISABLE_CULLING))
- return FALSE;
-
- if (clutter_paint_context_is_drawing_off_stage (paint_context))
- {
- CLUTTER_NOTE (CLIPPING, "Bail from cull_actor without culling (%s): "
- "Drawing off stage",
- _clutter_actor_get_debug_name (self));
- return FALSE;
- }
-
- clip_frusta = clutter_paint_context_get_clip_frusta (paint_context);
- if (!clip_frusta)
- {
- *result_out = result;
- return TRUE;
- }
-
- for (i = 0; i < clip_frusta->len; i++)
- {
- const graphene_frustum_t *clip_frustum =
- &g_array_index (clip_frusta, graphene_frustum_t, i);
-
- result = _clutter_paint_volume_cull (&priv->last_paint_volume,
- clip_frustum);
-
- if (result != CLUTTER_CULL_RESULT_OUT)
- break;
- }
-
- *result_out = result;
-
- return TRUE;
-}
-
-static void
-_clutter_actor_update_last_paint_volume (ClutterActor *self)
-{
- ClutterActorPrivate *priv = self->priv;
- const ClutterPaintVolume *pv;
-
- if (priv->last_paint_volume_valid)
- {
- clutter_paint_volume_free (&priv->last_paint_volume);
- priv->last_paint_volume_valid = FALSE;
- }
-
- pv = clutter_actor_get_paint_volume (self);
- if (!pv)
- {
- CLUTTER_NOTE (CLIPPING, "Bail from update_last_paint_volume (%s): "
- "Actor failed to report a paint volume",
- _clutter_actor_get_debug_name (self));
- return;
- }
-
- _clutter_paint_volume_copy_static (pv, &priv->last_paint_volume);
-
- _clutter_paint_volume_transform_relative (&priv->last_paint_volume,
- NULL); /* eye coordinates */
-
- priv->last_paint_volume_valid = TRUE;
-}
-
-/* This is the same as clutter_actor_add_effect except that it doesn't
- queue a redraw and it doesn't notify on the effect property */
-static void
-_clutter_actor_add_effect_internal (ClutterActor *self,
- ClutterEffect *effect)
-{
- ClutterActorPrivate *priv = self->priv;
-
- if (priv->effects == NULL)
- {
- priv->effects = g_object_new (CLUTTER_TYPE_META_GROUP, NULL);
- priv->effects->actor = self;
- }
-
- _clutter_meta_group_add_meta (priv->effects, CLUTTER_ACTOR_META (effect));
-}
-
-/* This is the same as clutter_actor_remove_effect except that it doesn't
- queue a redraw and it doesn't notify on the effect property */
-static void
-_clutter_actor_remove_effect_internal (ClutterActor *self,
- ClutterEffect *effect)
-{
- ClutterActorPrivate *priv = self->priv;
-
- if (priv->effects == NULL)
- return;
-
- _clutter_meta_group_remove_meta (priv->effects, CLUTTER_ACTOR_META (effect));
-
- if (_clutter_meta_group_peek_metas (priv->effects) == NULL)
- g_clear_object (&priv->effects);
-}
-
-static gboolean
-needs_flatten_effect (ClutterActor *self)
-{
- ClutterActorPrivate *priv = self->priv;
-
- if (G_UNLIKELY (clutter_paint_debug_flags &
- CLUTTER_DEBUG_DISABLE_OFFSCREEN_REDIRECT))
- return FALSE;
-
- /* We need to enable the effect immediately even in ON_IDLE because that can
- * only be implemented efficiently within the effect itself.
- * If it was implemented here using just priv->is_dirty then we would lose
- * the ability to animate opacity without repaints.
- */
- if ((priv->offscreen_redirect & CLUTTER_OFFSCREEN_REDIRECT_ALWAYS) ||
- (priv->offscreen_redirect & CLUTTER_OFFSCREEN_REDIRECT_ON_IDLE))
- return TRUE;
- else if (priv->offscreen_redirect & CLUTTER_OFFSCREEN_REDIRECT_AUTOMATIC_FOR_OPACITY)
- {
- if (clutter_actor_get_paint_opacity (self) < 255 &&
- clutter_actor_has_overlaps (self))
- return TRUE;
- }
-
- return FALSE;
-}
-
-static void
-add_or_remove_flatten_effect (ClutterActor *self)
-{
- ClutterActorPrivate *priv = self->priv;
-
- /* Add or remove the flatten effect depending on the
- offscreen-redirect property. */
- if (needs_flatten_effect (self))
- {
- if (priv->flatten_effect == NULL)
- {
- ClutterActorMeta *actor_meta;
- gint priority;
-
- priv->flatten_effect = _clutter_flatten_effect_new ();
- /* Keep a reference to the effect so that we can queue
- redraws from it */
- g_object_ref_sink (priv->flatten_effect);
-
- /* Set the priority of the effect to high so that it will
- always be applied to the actor first. It uses an internal
- priority so that it won't be visible to applications */
- actor_meta = CLUTTER_ACTOR_META (priv->flatten_effect);
- priority = CLUTTER_ACTOR_META_PRIORITY_INTERNAL_HIGH;
- _clutter_actor_meta_set_priority (actor_meta, priority);
-
- /* This will add the effect without queueing a redraw */
- _clutter_actor_add_effect_internal (self, priv->flatten_effect);
- }
- }
- else
- {
- if (priv->flatten_effect != NULL)
- {
- /* Destroy the effect so that it will lose its fbo cache of
- the actor */
- _clutter_actor_remove_effect_internal (self, priv->flatten_effect);
- g_clear_object (&priv->flatten_effect);
- }
- }
-}
-
-static void
-clutter_actor_real_paint (ClutterActor *actor,
- ClutterPaintContext *paint_context)
-{
- ClutterActorPrivate *priv = actor->priv;
- ClutterActor *iter;
-
- for (iter = priv->first_child;
- iter != NULL;
- iter = iter->priv->next_sibling)
- {
- CLUTTER_NOTE (PAINT, "Painting %s, child of %s, at { %.2f, %.2f - %.2f x %.2f }",
- _clutter_actor_get_debug_name (iter),
- _clutter_actor_get_debug_name (actor),
- iter->priv->allocation.x1,
- iter->priv->allocation.y1,
- iter->priv->allocation.x2 - iter->priv->allocation.x1,
- iter->priv->allocation.y2 - iter->priv->allocation.y1);
-
- clutter_actor_paint (iter, paint_context);
- }
-}
-
-static gboolean
-clutter_actor_paint_node (ClutterActor *actor,
- ClutterPaintNode *root,
- ClutterPaintContext *paint_context)
-{
- ClutterActorPrivate *priv = actor->priv;
- ClutterActorBox box;
- ClutterColor bg_color;
-
- box.x1 = 0.f;
- box.y1 = 0.f;
- box.x2 = clutter_actor_box_get_width (&priv->allocation);
- box.y2 = clutter_actor_box_get_height (&priv->allocation);
-
- bg_color = priv->bg_color;
-
- if (CLUTTER_ACTOR_IS_TOPLEVEL (actor))
- {
- ClutterPaintNode *node;
- CoglFramebuffer *fb;
- CoglBufferBit clear_flags;
-
- fb = clutter_paint_context_get_base_framebuffer (paint_context);
-
- bg_color.alpha = 255;
-
- CLUTTER_NOTE (PAINT, "Stage clear color: (%d, %d, %d, %d)",
- bg_color.red,
- bg_color.green,
- bg_color.blue,
- bg_color.alpha);
-
- clear_flags = COGL_BUFFER_BIT_DEPTH;
-
- node = clutter_root_node_new (fb, &bg_color, clear_flags);
- clutter_paint_node_set_static_name (node, "stageClear");
- clutter_paint_node_add_rectangle (node, &box);
- clutter_paint_node_add_child (root, node);
- clutter_paint_node_unref (node);
- }
- else if (priv->bg_color_set &&
- !clutter_color_equal (&priv->bg_color, CLUTTER_COLOR_Transparent))
- {
- ClutterPaintNode *node;
-
- bg_color.alpha = clutter_actor_get_paint_opacity_internal (actor)
- * priv->bg_color.alpha
- / 255;
-
- node = clutter_color_node_new (&bg_color);
- clutter_paint_node_set_static_name (node, "backgroundColor");
- clutter_paint_node_add_rectangle (node, &box);
- clutter_paint_node_add_child (root, node);
- clutter_paint_node_unref (node);
- }
-
- if (priv->content != NULL)
- _clutter_content_paint_content (priv->content, actor, root, paint_context);
-
- if (CLUTTER_ACTOR_GET_CLASS (actor)->paint_node != NULL)
- CLUTTER_ACTOR_GET_CLASS (actor)->paint_node (actor, root);
-
- if (clutter_paint_node_get_n_children (root) == 0)
- return FALSE;
-
-#ifdef CLUTTER_ENABLE_DEBUG
- if (CLUTTER_HAS_DEBUG (PAINT))
- {
- /* dump the tree only if we have one */
- _clutter_paint_node_dump_tree (root);
- }
-#endif /* CLUTTER_ENABLE_DEBUG */
-
- clutter_paint_node_paint (root, paint_context);
-
- return TRUE;
-}
-
-/**
- * clutter_actor_paint:
- * @self: A #ClutterActor
- *
- * Renders the actor to display.
- *
- * This function should not be called directly by applications.
- * Call clutter_actor_queue_redraw() to queue paints, instead.
- *
- * This function is context-aware, and will either cause a
- * regular paint or a pick paint.
- *
- * This function will call the #ClutterActorClass.paint() virtual
- * function.
- *
- * This function does not paint the actor if the actor is set to 0,
- * unless it is performing a pick paint.
- */
-void
-clutter_actor_paint (ClutterActor *self,
- ClutterPaintContext *paint_context)
-{
- g_autoptr (ClutterPaintNode) actor_node = NULL;
- g_autoptr (ClutterPaintNode) root_node = NULL;
- ClutterActorPrivate *priv;
- ClutterActorBox clip;
- gboolean culling_inhibited;
- gboolean clip_set = FALSE;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- if (CLUTTER_ACTOR_IN_DESTRUCTION (self))
- return;
-
- priv = self->priv;
- priv->propagated_one_redraw = FALSE;
-
- /* It's an important optimization that we consider painting of
- * actors with 0 opacity to be a NOP... */
- if (/* ignore top-levels, since they might be transparent */
- !CLUTTER_ACTOR_IS_TOPLEVEL (self) &&
- /* Use the override opacity if its been set */
- ((priv->opacity_override >= 0) ?
- priv->opacity_override : priv->opacity) == 0)
- return;
-
- /* if we aren't paintable (not in a toplevel with all
- * parents paintable) then do nothing.
- */
- if (!CLUTTER_ACTOR_IS_MAPPED (self))
- return;
-
- actor_node = clutter_actor_node_new (self, -1);
- root_node = clutter_paint_node_ref (actor_node);
-
- if (priv->has_clip)
- {
- clip.x1 = priv->clip.origin.x;
- clip.y1 = priv->clip.origin.y;
- clip.x2 = priv->clip.origin.x + priv->clip.size.width;
- clip.y2 = priv->clip.origin.y + priv->clip.size.height;
- clip_set = TRUE;
- }
- else if (priv->clip_to_allocation)
- {
- clip.x1 = 0.f;
- clip.y1 = 0.f;
- clip.x2 = priv->allocation.x2 - priv->allocation.x1;
- clip.y2 = priv->allocation.y2 - priv->allocation.y1;
- clip_set = TRUE;
- }
-
- if (clip_set)
- {
- ClutterPaintNode *clip_node;
-
- clip_node = clutter_clip_node_new ();
- clutter_paint_node_add_rectangle (clip_node, &clip);
- clutter_paint_node_add_child (clip_node, root_node);
- clutter_paint_node_unref (root_node);
-
- root_node = g_steal_pointer (&clip_node);
- }
-
- if (priv->enable_model_view_transform)
- {
- ClutterPaintNode *transform_node;
- graphene_matrix_t transform;
-
- clutter_actor_get_transform (self, &transform);
-
- if (!graphene_matrix_is_identity (&transform))
- {
- transform_node = clutter_transform_node_new (&transform);
- clutter_paint_node_add_child (transform_node, root_node);
- clutter_paint_node_unref (root_node);
-
- root_node = g_steal_pointer (&transform_node);
- }
-
-#ifdef CLUTTER_ENABLE_DEBUG
- /* Catch when out-of-band transforms have been made by actors not as part
- * of an apply_transform vfunc... */
- if (G_UNLIKELY (clutter_debug_flags & CLUTTER_DEBUG_OOB_TRANSFORMS))
- {
- graphene_matrix_t expected_matrix;
-
- _clutter_actor_get_relative_transformation_matrix (self, NULL,
- &expected_matrix);
-
- if (!graphene_matrix_equal_fast (&transform, &expected_matrix))
- {
- GString *buf = g_string_sized_new (1024);
- ClutterActor *parent;
-
- parent = self;
- while (parent != NULL)
- {
- g_string_append (buf, _clutter_actor_get_debug_name (parent));
-
- if (parent->priv->parent != NULL)
- g_string_append (buf, "->");
-
- parent = parent->priv->parent;
- }
-
- g_warning ("Unexpected transform found when painting actor "
- "\"%s\". This will be caused by one of the actor's "
- "ancestors (%s) using the Cogl API directly to transform "
- "children instead of using ::apply_transform().",
- _clutter_actor_get_debug_name (self),
- buf->str);
-
- g_string_free (buf, TRUE);
- }
- }
-#endif /* CLUTTER_ENABLE_DEBUG */
- }
-
- /* We check whether we need to add the flatten effect before
- * each paint so that we can avoid having a mechanism for
- * applications to notify when the value of the
- * has_overlaps virtual changes.
- */
- add_or_remove_flatten_effect (self);
-
- /* We save the current paint volume so that the next time the
- * actor queues a redraw we can constrain the redraw to just
- * cover the union of the new bounding box and the old.
- *
- * We also fetch the current paint volume to perform culling so
- * we can avoid painting actors outside the current clip region.
- *
- * If we are painting inside a clone, we should neither update
- * the paint volume or use it to cull painting, since the paint
- * box represents the location of the source actor on the
- * screen.
- *
- * XXX: We are starting to do a lot of vertex transforms on
- * the CPU in a typical paint, so at some point we should
- * audit these and consider caching some things.
- *
- * NB: We don't perform culling while picking at this point because
- * clutter-stage.c doesn't setup the clipping planes appropriately.
- *
- * NB: We don't want to update the last-paint-volume during picking
- * because the last-paint-volume is used to determine the old screen
- * space location of an actor that has moved so we can know the
- * minimal region to redraw to clear an old view of the actor. If we
- * update this during picking then by the time we come around to
- * paint then the last-paint-volume would likely represent the new
- * actor position not the old.
- */
- culling_inhibited = priv->inhibit_culling_counter > 0;
- if (!culling_inhibited && !in_clone_paint ())
- {
- gboolean success;
- gboolean should_cull_out = (clutter_paint_debug_flags &
- (CLUTTER_DEBUG_DISABLE_CULLING |
- CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS)) !=
- (CLUTTER_DEBUG_DISABLE_CULLING |
- CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS);
- /* annoyingly gcc warns if uninitialized even though
- * the initialization is redundant :-( */
- ClutterCullResult result = CLUTTER_CULL_RESULT_IN;
-
- success = should_cull_out
- ? cull_actor (self, paint_context, &result)
- : FALSE;
-
- if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_REDRAWS))
- _clutter_actor_paint_cull_result (self, success, result, actor_node);
- else if (result == CLUTTER_CULL_RESULT_OUT && success)
- return;
- }
-
- if (priv->effects == NULL)
- priv->next_effect_to_paint = NULL;
- else
- priv->next_effect_to_paint =
- _clutter_meta_group_peek_metas (priv->effects);
-
- if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_VOLUMES))
- _clutter_actor_draw_paint_volume (self, actor_node);
-
- clutter_paint_node_paint (root_node, paint_context);
-
- /* If we make it here then the actor has run through a complete
- paint run including all the effects so it's no longer dirty */
- priv->is_dirty = FALSE;
-}
-
-/**
- * clutter_actor_continue_paint:
- * @self: A #ClutterActor
- *
- * Run the next stage of the paint sequence. This function should only
- * be called within the implementation of the ‘run’ virtual of a
- * #ClutterEffect. It will cause the run method of the next effect to
- * be applied, or it will paint the actual actor if the current effect
- * is the last effect in the chain.
- *
- * Since: 1.8
- */
-void
-clutter_actor_continue_paint (ClutterActor *self,
- ClutterPaintContext *paint_context)
-{
- ClutterActorPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- /* This should only be called from with in the ‘run’ implementation
- of a ClutterEffect */
- g_return_if_fail (CLUTTER_ACTOR_IN_PAINT (self));
-
- priv = self->priv;
-
- /* Skip any effects that are disabled */
- while (priv->next_effect_to_paint &&
- !clutter_actor_meta_get_enabled (priv->next_effect_to_paint->data))
- priv->next_effect_to_paint = priv->next_effect_to_paint->next;
-
- /* If this has come from the last effect then we'll just paint the
- actual actor */
- if (priv->next_effect_to_paint == NULL)
- {
- CoglFramebuffer *framebuffer;
- ClutterPaintNode *dummy;
-
- /* XXX - this will go away in 2.0, when we can get rid of this
- * stuff and switch to a pure retained render tree of PaintNodes
- * for the entire frame, starting from the Stage; the paint()
- * virtual function can then be called directly.
- */
- framebuffer = clutter_paint_context_get_base_framebuffer (paint_context);
- dummy = _clutter_dummy_node_new (self, framebuffer);
- clutter_paint_node_set_static_name (dummy, "Root");
-
- /* XXX - for 1.12, we use the return value of paint_node() to
- * decide whether we should call the paint() vfunc.
- */
- clutter_actor_paint_node (self, dummy, paint_context);
- clutter_paint_node_unref (dummy);
-
- CLUTTER_ACTOR_GET_CLASS (self)->paint (self, paint_context);
- }
- else
- {
- g_autoptr (ClutterPaintNode) effect_node = NULL;
- ClutterEffect *old_current_effect;
- ClutterEffectPaintFlags run_flags = 0;
-
- /* Cache the current effect so that we can put it back before
- returning */
- old_current_effect = priv->current_effect;
-
- priv->current_effect = priv->next_effect_to_paint->data;
- priv->next_effect_to_paint = priv->next_effect_to_paint->next;
-
- if (priv->is_dirty)
- {
- /* If there's an effect queued with this redraw then all
- * effects up to that one will be considered dirty. It
- * is expected the queued effect will paint the cached
- * image and not call clutter_actor_continue_paint again
- * (although it should work ok if it does)
- */
- if (priv->effect_to_redraw == NULL ||
- priv->current_effect != priv->effect_to_redraw)
- run_flags |= CLUTTER_EFFECT_PAINT_ACTOR_DIRTY;
- }
-
- if (priv->current_effect == priv->flatten_effect &&
- priv->offscreen_redirect & CLUTTER_OFFSCREEN_REDIRECT_ON_IDLE &&
- run_flags & CLUTTER_EFFECT_PAINT_ACTOR_DIRTY)
- run_flags |= CLUTTER_EFFECT_PAINT_BYPASS_EFFECT;
-
- effect_node = clutter_effect_node_new (priv->current_effect);
-
- _clutter_effect_paint (priv->current_effect,
- effect_node,
- paint_context,
- run_flags);
-
- clutter_paint_node_paint (effect_node, paint_context);
-
- priv->current_effect = old_current_effect;
- }
-}
-
-/**
- * clutter_actor_pick:
- * @actor: A #ClutterActor
- *
- * Asks @actor to perform a pick.
- */
-void
-clutter_actor_pick (ClutterActor *actor,
- ClutterPickContext *pick_context)
-{
- ClutterActorPrivate *priv;
- ClutterActorBox clip;
- gboolean transform_pushed = FALSE;
- gboolean clip_set = FALSE;
- gboolean should_cull = (clutter_paint_debug_flags &
- (CLUTTER_DEBUG_DISABLE_CULLING |
- CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS)) !=
- (CLUTTER_DEBUG_DISABLE_CULLING |
- CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS);
-
- if (CLUTTER_ACTOR_IN_DESTRUCTION (actor))
- return;
-
- priv = actor->priv;
-
- /* if we aren't paintable (not in a toplevel with all
- * parents paintable) then do nothing.
- */
- if (!CLUTTER_ACTOR_IS_MAPPED (actor))
- return;
-
- /* mark that we are in the paint process */
- CLUTTER_SET_PRIVATE_FLAGS (actor, CLUTTER_IN_PICK);
-
- if (should_cull && priv->paint_volume_valid && priv->last_paint_volume_valid)
- {
- graphene_box_t box;
-
- clutter_paint_volume_to_box (&priv->last_paint_volume, &box);
- if (!clutter_pick_context_intersects_box (pick_context, &box))
- goto out;
- }
-
- if (priv->enable_model_view_transform)
- {
- graphene_matrix_t matrix;
-
- graphene_matrix_init_identity (&matrix);
- _clutter_actor_apply_modelview_transform (actor, &matrix);
- if (!graphene_matrix_is_identity (&matrix))
- {
- clutter_pick_context_push_transform (pick_context, &matrix);
- transform_pushed = TRUE;
- }
- }
-
- if (priv->has_clip)
- {
- clip.x1 = priv->clip.origin.x;
- clip.y1 = priv->clip.origin.y;
- clip.x2 = priv->clip.origin.x + priv->clip.size.width;
- clip.y2 = priv->clip.origin.y + priv->clip.size.height;
- clip_set = TRUE;
- }
- else if (priv->clip_to_allocation)
- {
- clip.x1 = 0.f;
- clip.y1 = 0.f;
- clip.x2 = priv->allocation.x2 - priv->allocation.x1;
- clip.y2 = priv->allocation.y2 - priv->allocation.y1;
- clip_set = TRUE;
- }
-
- if (clip_set)
- clutter_pick_context_push_clip (pick_context, &clip);
-
- priv->next_effect_to_paint = NULL;
- if (priv->effects)
- {
- priv->next_effect_to_paint =
- _clutter_meta_group_peek_metas (priv->effects);
- }
-
- clutter_actor_continue_pick (actor, pick_context);
-
- if (clip_set)
- clutter_pick_context_pop_clip (pick_context);
-
- if (transform_pushed)
- clutter_pick_context_pop_transform (pick_context);
-
-out:
- /* paint sequence complete */
- CLUTTER_UNSET_PRIVATE_FLAGS (actor, CLUTTER_IN_PICK);
-}
-
-/**
- * clutter_actor_continue_pick:
- * @actor: A #ClutterActor
- *
- * Run the next stage of the pick sequence. This function should only
- * be called within the implementation of the ‘pick’ virtual of a
- * #ClutterEffect. It will cause the run method of the next effect to
- * be applied, or it will pick the actual actor if the current effect
- * is the last effect in the chain.
- */
-void
-clutter_actor_continue_pick (ClutterActor *actor,
- ClutterPickContext *pick_context)
-{
- ClutterActorPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (actor));
-
- g_return_if_fail (CLUTTER_ACTOR_IN_PICK (actor));
-
- priv = actor->priv;
-
- /* Skip any effects that are disabled */
- while (priv->next_effect_to_paint &&
- !clutter_actor_meta_get_enabled (priv->next_effect_to_paint->data))
- priv->next_effect_to_paint = priv->next_effect_to_paint->next;
-
- /* If this has come from the last effect then we'll just pick the
- * actual actor.
- */
- if (priv->next_effect_to_paint == NULL)
- {
- /* The actor will log a silhouette of itself to the stage pick log.
- *
- * XXX:2.0 - Call the pick() virtual directly
- */
- if (g_signal_has_handler_pending (actor, actor_signals[PICK],
- 0, TRUE))
- g_signal_emit (actor, actor_signals[PICK], 0, pick_context);
- else
- CLUTTER_ACTOR_GET_CLASS (actor)->pick (actor, pick_context);
- }
- else
- {
- ClutterEffect *old_current_effect;
-
- /* Cache the current effect so that we can put it back before
- * returning.
- */
- old_current_effect = priv->current_effect;
-
- priv->current_effect = priv->next_effect_to_paint->data;
- priv->next_effect_to_paint = priv->next_effect_to_paint->next;
-
- _clutter_effect_pick (priv->current_effect, pick_context);
-
- priv->current_effect = old_current_effect;
- }
-}
-
-static void
-_clutter_actor_stop_transitions (ClutterActor *self)
-{
- const ClutterAnimationInfo *info;
- GHashTableIter iter;
- gpointer value;
-
- info = _clutter_actor_get_animation_info_or_defaults (self);
- if (info->transitions == NULL)
- return;
-
- g_hash_table_iter_init (&iter, info->transitions);
- while (g_hash_table_iter_next (&iter, NULL, &value))
- {
- TransitionClosure *closure = value;
-
- if (clutter_transition_get_remove_on_complete (closure->transition))
- {
- g_hash_table_iter_remove (&iter);
- }
- else
- {
- /* otherwise we stop it, and the transition will be removed
- * later, either by the actor's destruction or by explicit
- * removal
- */
- clutter_timeline_stop (CLUTTER_TIMELINE (closure->transition));
- }
- }
-}
-
-static inline void
-remove_child (ClutterActor *self,
- ClutterActor *child)
-{
- ClutterActor *prev_sibling, *next_sibling;
-
- prev_sibling = child->priv->prev_sibling;
- next_sibling = child->priv->next_sibling;
-
- if (prev_sibling != NULL)
- prev_sibling->priv->next_sibling = next_sibling;
-
- if (next_sibling != NULL)
- next_sibling->priv->prev_sibling = prev_sibling;
-
- if (self->priv->first_child == child)
- self->priv->first_child = next_sibling;
-
- if (self->priv->last_child == child)
- self->priv->last_child = prev_sibling;
-
- child->priv->parent = NULL;
- child->priv->prev_sibling = NULL;
- child->priv->next_sibling = NULL;
-}
-
-typedef enum
-{
- REMOVE_CHILD_DESTROY_META = 1 << 0,
- REMOVE_CHILD_EMIT_PARENT_SET = 1 << 1,
- REMOVE_CHILD_EMIT_ACTOR_REMOVED = 1 << 2,
- REMOVE_CHILD_CHECK_STATE = 1 << 3,
- REMOVE_CHILD_NOTIFY_FIRST_LAST = 1 << 4,
- REMOVE_CHILD_STOP_TRANSITIONS = 1 << 5,
- REMOVE_CHILD_CLEAR_STAGE_VIEWS = 1 << 6,
-
- /* default flags for public API */
- REMOVE_CHILD_DEFAULT_FLAGS = REMOVE_CHILD_STOP_TRANSITIONS |
- REMOVE_CHILD_DESTROY_META |
- REMOVE_CHILD_EMIT_PARENT_SET |
- REMOVE_CHILD_EMIT_ACTOR_REMOVED |
- REMOVE_CHILD_CHECK_STATE |
- REMOVE_CHILD_NOTIFY_FIRST_LAST |
- REMOVE_CHILD_CLEAR_STAGE_VIEWS,
-} ClutterActorRemoveChildFlags;
-
-/*< private >
- * clutter_actor_remove_child_internal:
- * @self: a #ClutterActor
- * @child: the child of @self that has to be removed
- * @flags: control the removal operations
- *
- * Removes @child from the list of children of @self.
- */
-static void
-clutter_actor_remove_child_internal (ClutterActor *self,
- ClutterActor *child,
- ClutterActorRemoveChildFlags flags)
-{
- ClutterActor *old_first, *old_last;
- gboolean destroy_meta, emit_parent_set, emit_actor_removed, check_state;
- gboolean notify_first_last;
- gboolean stop_transitions;
- gboolean clear_stage_views;
- GObject *obj;
-
- if (self == child)
- {
- g_warning ("Cannot remove actor '%s' from itself.",
- _clutter_actor_get_debug_name (self));
- return;
- }
-
- destroy_meta = (flags & REMOVE_CHILD_DESTROY_META) != 0;
- emit_parent_set = (flags & REMOVE_CHILD_EMIT_PARENT_SET) != 0;
- emit_actor_removed = (flags & REMOVE_CHILD_EMIT_ACTOR_REMOVED) != 0;
- check_state = (flags & REMOVE_CHILD_CHECK_STATE) != 0;
- notify_first_last = (flags & REMOVE_CHILD_NOTIFY_FIRST_LAST) != 0;
- stop_transitions = (flags & REMOVE_CHILD_STOP_TRANSITIONS) != 0;
- clear_stage_views = (flags & REMOVE_CHILD_CLEAR_STAGE_VIEWS) != 0;
-
- obj = G_OBJECT (self);
- g_object_freeze_notify (obj);
-
- if (stop_transitions)
- _clutter_actor_stop_transitions (child);
-
- if (destroy_meta)
- clutter_container_destroy_child_meta (CLUTTER_CONTAINER (self), child);
-
- if (check_state)
- {
- /* we need to unrealize *before* we set parent_actor to NULL,
- * because in an unrealize method actors are dissociating from the
- * stage, which means they need to be able to
- * clutter_actor_get_stage().
- *
- * yhis should unmap and unrealize, unless we're reparenting.
- */
- clutter_actor_update_map_state (child, MAP_STATE_MAKE_UNREALIZED);
- }
-
- old_first = self->priv->first_child;
- old_last = self->priv->last_child;
-
- remove_child (self, child);
-
- self->priv->n_children -= 1;
-
- self->priv->age += 1;
-
- if (self->priv->in_cloned_branch)
- clutter_actor_pop_in_cloned_branch (child, self->priv->in_cloned_branch);
-
- if (self->priv->unmapped_paint_branch_counter)
- pop_in_paint_unmapped_branch (child, self->priv->unmapped_paint_branch_counter);
-
- /* if the child that got removed was visible and set to
- * expand then we want to reset the parent's state in
- * case the child was the only thing that was making it
- * expand.
- */
- if (CLUTTER_ACTOR_IS_VISIBLE (child) &&
- (child->priv->needs_compute_expand ||
- child->priv->needs_x_expand ||
- child->priv->needs_y_expand))
- {
- clutter_actor_queue_compute_expand (self);
- }
-
- /* Only actors which are attached to a stage get notified about changes
- * to the stage views, so make sure all the stage-views lists are
- * cleared as the child and its children leave the actor tree.
- */
- if (clear_stage_views && !CLUTTER_ACTOR_IN_DESTRUCTION (child))
- clutter_actor_clear_stage_views_recursive (child);
-
- if (emit_parent_set && !CLUTTER_ACTOR_IN_DESTRUCTION (child))
- g_signal_emit (child, actor_signals[PARENT_SET], 0, self);
-
- /* we need to emit the signal before dropping the reference */
- if (emit_actor_removed)
- _clutter_container_emit_actor_removed (CLUTTER_CONTAINER (self), child);
-
- if (notify_first_last)
- {
- if (old_first != self->priv->first_child)
- g_object_notify_by_pspec (obj, obj_props[PROP_FIRST_CHILD]);
-
- if (old_last != self->priv->last_child)
- g_object_notify_by_pspec (obj, obj_props[PROP_LAST_CHILD]);
- }
-
- g_object_thaw_notify (obj);
-
- /* remove the reference we acquired in clutter_actor_add_child() */
- g_object_unref (child);
-}
-
-static ClutterTransformInfo default_transform_info = {
- 0.0, /* rotation-x */
- 0.0, /* rotation-y */
- 0.0, /* rotation-z */
-
- 1.0, 1.0, 1.0, /* scale */
-
- GRAPHENE_POINT3D_INIT_ZERO, /* translation */
-
- 0.f, /* z-position */
-
- GRAPHENE_POINT_INIT_ZERO, /* pivot */
- 0.f, /* pivot-z */
-
- { },
- FALSE, /* transform */
- { },
- FALSE, /* child-transform */
-};
-
-static inline const ClutterTransformInfo *
-get_default_transform_info (void)
-{
- static gsize initialized = FALSE;
-
- if (G_UNLIKELY (g_once_init_enter (&initialized)))
- {
- graphene_matrix_init_identity (&default_transform_info.transform);
- graphene_matrix_init_identity (&default_transform_info.child_transform);
- g_once_init_leave (&initialized, TRUE);
- }
-
- return &default_transform_info;
-}
-
-/*< private >
- * _clutter_actor_get_transform_info_or_defaults:
- * @self: a #ClutterActor
- *
- * Retrieves the ClutterTransformInfo structure associated to an actor.
- *
- * If the actor does not have a ClutterTransformInfo structure associated
- * to it, then the default structure will be returned.
- *
- * This function should only be used for getters.
- *
- * Return value: a const pointer to the ClutterTransformInfo structure
- */
-const ClutterTransformInfo *
-_clutter_actor_get_transform_info_or_defaults (ClutterActor *self)
-{
- ClutterTransformInfo *info;
-
- info = g_object_get_qdata (G_OBJECT (self), quark_actor_transform_info);
- if (info != NULL)
- return info;
-
- return get_default_transform_info ();
-}
-
-static void
-clutter_transform_info_free (gpointer data)
-{
- if (data != NULL)
- g_free (data);
-}
-
-/*< private >
- * _clutter_actor_get_transform_info:
- * @self: a #ClutterActor
- *
- * Retrieves a pointer to the ClutterTransformInfo structure.
- *
- * If the actor does not have a ClutterTransformInfo associated to it, one
- * will be created and initialized to the default values.
- *
- * This function should be used for setters.
- *
- * For getters, you should use _clutter_actor_get_transform_info_or_defaults()
- * instead.
- *
- * Return value: (transfer none): a pointer to the ClutterTransformInfo
- * structure
- */
-ClutterTransformInfo *
-_clutter_actor_get_transform_info (ClutterActor *self)
-{
- ClutterTransformInfo *info;
-
- info = g_object_get_qdata (G_OBJECT (self), quark_actor_transform_info);
- if (info == NULL)
- {
- info = g_new0 (ClutterTransformInfo, 1);
-
- *info = *get_default_transform_info ();
-
- g_object_set_qdata_full (G_OBJECT (self), quark_actor_transform_info,
- info,
- clutter_transform_info_free);
- }
-
- return info;
-}
-
-static inline void
-clutter_actor_set_pivot_point_internal (ClutterActor *self,
- const graphene_point_t *pivot)
-{
- ClutterTransformInfo *info;
-
- info = _clutter_actor_get_transform_info (self);
- info->pivot = *pivot;
-
- transform_changed (self);
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_PIVOT_POINT]);
-
- clutter_actor_queue_redraw (self);
-}
-
-static inline void
-clutter_actor_set_pivot_point_z_internal (ClutterActor *self,
- float pivot_z)
-{
- ClutterTransformInfo *info;
-
- info = _clutter_actor_get_transform_info (self);
- info->pivot_z = pivot_z;
-
- transform_changed (self);
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_PIVOT_POINT_Z]);
-
- clutter_actor_queue_redraw (self);
-}
-
-/*< private >
- * clutter_actor_set_translation_internal:
- * @self: a #ClutterActor
- * @axis: the axis of the translation to change
- * @angle: the translation as a value along @axis
- *
- * Sets the translation on the given @axis
- */
-static void
-clutter_actor_set_translation_internal (ClutterActor *self,
- gfloat value,
- GParamSpec *pspec)
-{
- GObject *obj = G_OBJECT (self);
- ClutterTransformInfo *info;
-
- info = _clutter_actor_get_transform_info (self);
-
- if (pspec == obj_props[PROP_TRANSLATION_X])
- info->translation.x = value;
- else if (pspec == obj_props[PROP_TRANSLATION_Y])
- info->translation.y = value;
- else if (pspec == obj_props[PROP_TRANSLATION_Z])
- info->translation.z = value;
- else
- g_assert_not_reached ();
-
- transform_changed (self);
-
- clutter_actor_queue_redraw (self);
- g_object_notify_by_pspec (obj, pspec);
-}
-
-static inline void
-clutter_actor_set_translation_factor (ClutterActor *self,
- ClutterRotateAxis axis,
- gdouble value)
-{
- const ClutterTransformInfo *info;
- const float *translate_p = NULL;
- GParamSpec *pspec = NULL;
-
- info = _clutter_actor_get_transform_info_or_defaults (self);
-
- switch (axis)
- {
- case CLUTTER_X_AXIS:
- pspec = obj_props[PROP_TRANSLATION_X];
- translate_p = &info->translation.x;
- break;
-
- case CLUTTER_Y_AXIS:
- pspec = obj_props[PROP_TRANSLATION_Y];
- translate_p = &info->translation.y;
- break;
-
- case CLUTTER_Z_AXIS:
- pspec = obj_props[PROP_TRANSLATION_Z];
- translate_p = &info->translation.z;
- break;
- }
-
- g_assert (pspec != NULL);
- g_assert (translate_p != NULL);
-
- _clutter_actor_create_transition (self, pspec, *translate_p, value);
-}
-
-/**
- * clutter_actor_set_translation:
- * @self: a #ClutterActor
- * @translate_x: the translation along the X axis
- * @translate_y: the translation along the Y axis
- * @translate_z: the translation along the Z axis
- *
- * Sets an additional translation transformation on a #ClutterActor,
- * relative to the #ClutterActor:pivot-point.
- *
- * Since: 1.12
- */
-void
-clutter_actor_set_translation (ClutterActor *self,
- gfloat translate_x,
- gfloat translate_y,
- gfloat translate_z)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- g_object_freeze_notify (G_OBJECT (self));
-
- clutter_actor_set_translation_factor (self, CLUTTER_X_AXIS, translate_x);
- clutter_actor_set_translation_factor (self, CLUTTER_Y_AXIS, translate_y);
- clutter_actor_set_translation_factor (self, CLUTTER_Z_AXIS, translate_z);
-
- g_object_thaw_notify (G_OBJECT (self));
-}
-
-/**
- * clutter_actor_get_translation:
- * @self: a #ClutterActor
- * @translate_x: (out) (allow-none): return location for the X component
- * of the translation, or %NULL
- * @translate_y: (out) (allow-none): return location for the Y component
- * of the translation, or %NULL
- * @translate_z: (out) (allow-none): return location for the Z component
- * of the translation, or %NULL
- *
- * Retrieves the translation set using clutter_actor_set_translation().
- *
- * Since: 1.12
- */
-void
-clutter_actor_get_translation (ClutterActor *self,
- gfloat *translate_x,
- gfloat *translate_y,
- gfloat *translate_z)
-{
- const ClutterTransformInfo *info;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- info = _clutter_actor_get_transform_info_or_defaults (self);
-
- if (translate_x != NULL)
- *translate_x = info->translation.x;
-
- if (translate_y != NULL)
- *translate_y = info->translation.y;
-
- if (translate_z != NULL)
- *translate_z = info->translation.z;
-}
-
-/*< private >
- * clutter_actor_set_rotation_angle_internal:
- * @self: a #ClutterActor
- * @angle: the angle of rotation
- * @pspec: the #GParamSpec of the property
- *
- * Sets the rotation angle on the given axis without affecting the
- * rotation center point.
- */
-static inline void
-clutter_actor_set_rotation_angle_internal (ClutterActor *self,
- gdouble angle,
- GParamSpec *pspec)
-{
- ClutterTransformInfo *info;
-
- info = _clutter_actor_get_transform_info (self);
-
- if (pspec == obj_props[PROP_ROTATION_ANGLE_X])
- info->rx_angle = angle;
- else if (pspec == obj_props[PROP_ROTATION_ANGLE_Y])
- info->ry_angle = angle;
- else if (pspec == obj_props[PROP_ROTATION_ANGLE_Z])
- info->rz_angle = angle;
- else
- g_assert_not_reached ();
-
- transform_changed (self);
-
- clutter_actor_queue_redraw (self);
-
- g_object_notify_by_pspec (G_OBJECT (self), pspec);
-}
-
-/**
- * clutter_actor_set_rotation_angle:
- * @self: a #ClutterActor
- * @axis: the axis to set the angle one
- * @angle: the angle of rotation, in degrees
- *
- * Sets the @angle of rotation of a #ClutterActor on the given @axis.
- *
- * This function is a convenience for setting the rotation properties
- * #ClutterActor:rotation-angle-x, #ClutterActor:rotation-angle-y,
- * and #ClutterActor:rotation-angle-z.
- *
- * The center of rotation is established by the #ClutterActor:pivot-point
- * property.
- *
- * Since: 1.12
- */
-void
-clutter_actor_set_rotation_angle (ClutterActor *self,
- ClutterRotateAxis axis,
- gdouble angle)
-{
- const ClutterTransformInfo *info;
- const double *cur_angle_p = NULL;
- GParamSpec *pspec = NULL;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- info = _clutter_actor_get_transform_info_or_defaults (self);
-
- switch (axis)
- {
- case CLUTTER_X_AXIS:
- cur_angle_p = &info->rx_angle;
- pspec = obj_props[PROP_ROTATION_ANGLE_X];
- break;
-
- case CLUTTER_Y_AXIS:
- cur_angle_p = &info->ry_angle;
- pspec = obj_props[PROP_ROTATION_ANGLE_Y];
- break;
-
- case CLUTTER_Z_AXIS:
- cur_angle_p = &info->rz_angle;
- pspec = obj_props[PROP_ROTATION_ANGLE_Z];
- break;
- }
-
- g_assert (pspec != NULL);
- g_assert (cur_angle_p != NULL);
-
- _clutter_actor_create_transition (self, pspec, *cur_angle_p, angle);
-}
-
-/**
- * clutter_actor_get_rotation_angle:
- * @self: a #ClutterActor
- * @axis: the axis of the rotation
- *
- * Retrieves the angle of rotation set by clutter_actor_set_rotation_angle().
- *
- * Return value: the angle of rotation, in degrees
- *
- * Since: 1.12
- */
-gdouble
-clutter_actor_get_rotation_angle (ClutterActor *self,
- ClutterRotateAxis axis)
-{
- const ClutterTransformInfo *info;
- gdouble retval;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0.0);
-
- info = _clutter_actor_get_transform_info_or_defaults (self);
-
- switch (axis)
- {
- case CLUTTER_X_AXIS:
- retval = info->rx_angle;
- break;
-
- case CLUTTER_Y_AXIS:
- retval = info->ry_angle;
- break;
-
- case CLUTTER_Z_AXIS:
- retval = info->rz_angle;
- break;
-
- default:
- g_warn_if_reached ();
- retval = 0.0;
- break;
- }
-
- return retval;
-}
-
-static void
-clutter_actor_set_scale_factor_internal (ClutterActor *self,
- double factor,
- GParamSpec *pspec)
-{
- GObject *obj = G_OBJECT (self);
- ClutterTransformInfo *info;
-
- info = _clutter_actor_get_transform_info (self);
-
- if (pspec == obj_props[PROP_SCALE_X])
- info->scale_x = factor;
- else if (pspec == obj_props[PROP_SCALE_Y])
- info->scale_y = factor;
- else if (pspec == obj_props[PROP_SCALE_Z])
- info->scale_z = factor;
- else
- g_assert_not_reached ();
-
- transform_changed (self);
-
- clutter_actor_queue_redraw (self);
- g_object_notify_by_pspec (obj, pspec);
-}
-
-static inline void
-clutter_actor_set_scale_factor (ClutterActor *self,
- ClutterRotateAxis axis,
- gdouble factor)
-{
- const ClutterTransformInfo *info;
- const double *scale_p = NULL;
- GParamSpec *pspec = NULL;
-
- info = _clutter_actor_get_transform_info_or_defaults (self);
-
- switch (axis)
- {
- case CLUTTER_X_AXIS:
- pspec = obj_props[PROP_SCALE_X];
- scale_p = &info->scale_x;
- break;
-
- case CLUTTER_Y_AXIS:
- pspec = obj_props[PROP_SCALE_Y];
- scale_p = &info->scale_y;
- break;
-
- case CLUTTER_Z_AXIS:
- pspec = obj_props[PROP_SCALE_Z];
- scale_p = &info->scale_z;
- break;
- }
-
- g_assert (pspec != NULL);
- g_assert (scale_p != NULL);
-
- if (*scale_p != factor)
- _clutter_actor_create_transition (self, pspec, *scale_p, factor);
-}
-
-static void
-clutter_actor_set_clip_rect (ClutterActor *self,
- const graphene_rect_t *clip)
-{
- ClutterActorPrivate *priv = self->priv;
- GObject *obj = G_OBJECT (self);
-
- if (clip != NULL)
- {
- priv->clip = *clip;
- priv->has_clip = TRUE;
- }
- else
- priv->has_clip = FALSE;
-
- queue_update_paint_volume (self);
- clutter_actor_queue_redraw (self);
-
- g_object_notify_by_pspec (obj, obj_props[PROP_CLIP_RECT]);
- g_object_notify_by_pspec (obj, obj_props[PROP_HAS_CLIP]);
-}
-
-static void
-clutter_actor_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterActor *actor = CLUTTER_ACTOR (object);
- ClutterActorPrivate *priv = actor->priv;
-
- switch (prop_id)
- {
- case PROP_X:
- clutter_actor_set_x (actor, g_value_get_float (value));
- break;
-
- case PROP_Y:
- clutter_actor_set_y (actor, g_value_get_float (value));
- break;
-
- case PROP_POSITION:
- {
- const graphene_point_t *pos = g_value_get_boxed (value);
-
- if (pos != NULL)
- clutter_actor_set_position (actor, pos->x, pos->y);
- else
- clutter_actor_set_fixed_position_set (actor, FALSE);
- }
- break;
-
- case PROP_WIDTH:
- clutter_actor_set_width (actor, g_value_get_float (value));
- break;
-
- case PROP_HEIGHT:
- clutter_actor_set_height (actor, g_value_get_float (value));
- break;
-
- case PROP_SIZE:
- {
- const graphene_size_t *size = g_value_get_boxed (value);
-
- if (size != NULL)
- clutter_actor_set_size (actor, size->width, size->height);
- else
- clutter_actor_set_size (actor, -1, -1);
- }
- break;
-
- case PROP_FIXED_X:
- clutter_actor_set_x (actor, g_value_get_float (value));
- break;
-
- case PROP_FIXED_Y:
- clutter_actor_set_y (actor, g_value_get_float (value));
- break;
-
- case PROP_FIXED_POSITION_SET:
- clutter_actor_set_fixed_position_set (actor, g_value_get_boolean (value));
- break;
-
- case PROP_MIN_WIDTH:
- clutter_actor_set_min_width (actor, g_value_get_float (value));
- break;
-
- case PROP_MIN_HEIGHT:
- clutter_actor_set_min_height (actor, g_value_get_float (value));
- break;
-
- case PROP_NATURAL_WIDTH:
- clutter_actor_set_natural_width (actor, g_value_get_float (value));
- break;
-
- case PROP_NATURAL_HEIGHT:
- clutter_actor_set_natural_height (actor, g_value_get_float (value));
- break;
-
- case PROP_MIN_WIDTH_SET:
- clutter_actor_set_min_width_set (actor, g_value_get_boolean (value));
- break;
-
- case PROP_MIN_HEIGHT_SET:
- clutter_actor_set_min_height_set (actor, g_value_get_boolean (value));
- break;
-
- case PROP_NATURAL_WIDTH_SET:
- clutter_actor_set_natural_width_set (actor, g_value_get_boolean (value));
- break;
-
- case PROP_NATURAL_HEIGHT_SET:
- clutter_actor_set_natural_height_set (actor, g_value_get_boolean (value));
- break;
-
- case PROP_REQUEST_MODE:
- clutter_actor_set_request_mode (actor, g_value_get_enum (value));
- break;
-
- case PROP_Z_POSITION:
- clutter_actor_set_z_position (actor, g_value_get_float (value));
- break;
-
- case PROP_OPACITY:
- clutter_actor_set_opacity (actor, g_value_get_uint (value));
- break;
-
- case PROP_OFFSCREEN_REDIRECT:
- clutter_actor_set_offscreen_redirect (actor, g_value_get_flags (value));
- break;
-
- case PROP_NAME:
- clutter_actor_set_name (actor, g_value_get_string (value));
- break;
-
- case PROP_VISIBLE:
- if (g_value_get_boolean (value) == TRUE)
- clutter_actor_show (actor);
- else
- clutter_actor_hide (actor);
- break;
-
- case PROP_PIVOT_POINT:
- {
- const graphene_point_t *pivot = g_value_get_boxed (value);
-
- if (pivot == NULL)
- pivot = graphene_point_zero ();
-
- clutter_actor_set_pivot_point (actor, pivot->x, pivot->y);
- }
- break;
-
- case PROP_PIVOT_POINT_Z:
- clutter_actor_set_pivot_point_z (actor, g_value_get_float (value));
- break;
-
- case PROP_TRANSLATION_X:
- clutter_actor_set_translation_factor (actor, CLUTTER_X_AXIS,
- g_value_get_float (value));
- break;
-
- case PROP_TRANSLATION_Y:
- clutter_actor_set_translation_factor (actor, CLUTTER_Y_AXIS,
- g_value_get_float (value));
- break;
-
- case PROP_TRANSLATION_Z:
- clutter_actor_set_translation_factor (actor, CLUTTER_Z_AXIS,
- g_value_get_float (value));
- break;
-
- case PROP_SCALE_X:
- clutter_actor_set_scale_factor (actor, CLUTTER_X_AXIS,
- g_value_get_double (value));
- break;
-
- case PROP_SCALE_Y:
- clutter_actor_set_scale_factor (actor, CLUTTER_Y_AXIS,
- g_value_get_double (value));
- break;
-
- case PROP_SCALE_Z:
- clutter_actor_set_scale_factor (actor, CLUTTER_Z_AXIS,
- g_value_get_double (value));
- break;
-
- case PROP_CLIP_RECT:
- clutter_actor_set_clip_rect (actor, g_value_get_boxed (value));
- break;
-
- case PROP_CLIP_TO_ALLOCATION:
- clutter_actor_set_clip_to_allocation (actor, g_value_get_boolean (value));
- break;
-
- case PROP_REACTIVE:
- clutter_actor_set_reactive (actor, g_value_get_boolean (value));
- break;
-
- case PROP_ROTATION_ANGLE_X:
- clutter_actor_set_rotation_angle (actor,
- CLUTTER_X_AXIS,
- g_value_get_double (value));
- break;
-
- case PROP_ROTATION_ANGLE_Y:
- clutter_actor_set_rotation_angle (actor,
- CLUTTER_Y_AXIS,
- g_value_get_double (value));
- break;
-
- case PROP_ROTATION_ANGLE_Z:
- clutter_actor_set_rotation_angle (actor,
- CLUTTER_Z_AXIS,
- g_value_get_double (value));
- break;
-
- case PROP_TRANSFORM:
- clutter_actor_set_transform (actor, g_value_get_boxed (value));
- break;
-
- case PROP_CHILD_TRANSFORM:
- clutter_actor_set_child_transform (actor, g_value_get_boxed (value));
- break;
-
- case PROP_SHOW_ON_SET_PARENT: /* XXX:2.0 - remove */
- priv->show_on_set_parent = g_value_get_boolean (value);
- break;
-
- case PROP_TEXT_DIRECTION:
- clutter_actor_set_text_direction (actor, g_value_get_enum (value));
- break;
-
- case PROP_ACTIONS:
- clutter_actor_add_action (actor, g_value_get_object (value));
- break;
-
- case PROP_CONSTRAINTS:
- clutter_actor_add_constraint (actor, g_value_get_object (value));
- break;
-
- case PROP_EFFECT:
- clutter_actor_add_effect (actor, g_value_get_object (value));
- break;
-
- case PROP_LAYOUT_MANAGER:
- clutter_actor_set_layout_manager (actor, g_value_get_object (value));
- break;
-
- case PROP_X_EXPAND:
- clutter_actor_set_x_expand (actor, g_value_get_boolean (value));
- break;
-
- case PROP_Y_EXPAND:
- clutter_actor_set_y_expand (actor, g_value_get_boolean (value));
- break;
-
- case PROP_X_ALIGN:
- clutter_actor_set_x_align (actor, g_value_get_enum (value));
- break;
-
- case PROP_Y_ALIGN:
- clutter_actor_set_y_align (actor, g_value_get_enum (value));
- break;
-
- case PROP_MARGIN_TOP:
- clutter_actor_set_margin_top (actor, g_value_get_float (value));
- break;
-
- case PROP_MARGIN_BOTTOM:
- clutter_actor_set_margin_bottom (actor, g_value_get_float (value));
- break;
-
- case PROP_MARGIN_LEFT:
- clutter_actor_set_margin_left (actor, g_value_get_float (value));
- break;
-
- case PROP_MARGIN_RIGHT:
- clutter_actor_set_margin_right (actor, g_value_get_float (value));
- break;
-
- case PROP_BACKGROUND_COLOR:
- clutter_actor_set_background_color (actor, g_value_get_boxed (value));
- break;
-
- case PROP_CONTENT:
- clutter_actor_set_content (actor, g_value_get_object (value));
- break;
-
- case PROP_CONTENT_GRAVITY:
- clutter_actor_set_content_gravity (actor, g_value_get_enum (value));
- break;
-
- case PROP_MINIFICATION_FILTER:
- clutter_actor_set_content_scaling_filters (actor,
- g_value_get_enum (value),
- actor->priv->mag_filter);
- break;
-
- case PROP_MAGNIFICATION_FILTER:
- clutter_actor_set_content_scaling_filters (actor,
- actor->priv->min_filter,
- g_value_get_enum (value));
- break;
-
- case PROP_CONTENT_REPEAT:
- clutter_actor_set_content_repeat (actor, g_value_get_flags (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_actor_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterActor *actor = CLUTTER_ACTOR (object);
- ClutterActorPrivate *priv = actor->priv;
-
- switch (prop_id)
- {
- case PROP_X:
- g_value_set_float (value, clutter_actor_get_x (actor));
- break;
-
- case PROP_Y:
- g_value_set_float (value, clutter_actor_get_y (actor));
- break;
-
- case PROP_POSITION:
- {
- graphene_point_t position;
-
- graphene_point_init (&position,
- clutter_actor_get_x (actor),
- clutter_actor_get_y (actor));
- g_value_set_boxed (value, &position);
- }
- break;
-
- case PROP_WIDTH:
- g_value_set_float (value, clutter_actor_get_width (actor));
- break;
-
- case PROP_HEIGHT:
- g_value_set_float (value, clutter_actor_get_height (actor));
- break;
-
- case PROP_SIZE:
- {
- graphene_size_t size;
-
- graphene_size_init (&size,
- clutter_actor_get_width (actor),
- clutter_actor_get_height (actor));
- g_value_set_boxed (value, &size);
- }
- break;
-
- case PROP_FIXED_X:
- {
- const ClutterLayoutInfo *info;
-
- info = _clutter_actor_get_layout_info_or_defaults (actor);
- g_value_set_float (value, info->fixed_pos.x);
- }
- break;
-
- case PROP_FIXED_Y:
- {
- const ClutterLayoutInfo *info;
-
- info = _clutter_actor_get_layout_info_or_defaults (actor);
- g_value_set_float (value, info->fixed_pos.y);
- }
- break;
-
- case PROP_FIXED_POSITION_SET:
- g_value_set_boolean (value, priv->position_set);
- break;
-
- case PROP_MIN_WIDTH:
- {
- const ClutterLayoutInfo *info;
-
- info = _clutter_actor_get_layout_info_or_defaults (actor);
- g_value_set_float (value, info->minimum.width);
- }
- break;
-
- case PROP_MIN_HEIGHT:
- {
- const ClutterLayoutInfo *info;
-
- info = _clutter_actor_get_layout_info_or_defaults (actor);
- g_value_set_float (value, info->minimum.height);
- }
- break;
-
- case PROP_NATURAL_WIDTH:
- {
- const ClutterLayoutInfo *info;
-
- info = _clutter_actor_get_layout_info_or_defaults (actor);
- g_value_set_float (value, info->natural.width);
- }
- break;
-
- case PROP_NATURAL_HEIGHT:
- {
- const ClutterLayoutInfo *info;
-
- info = _clutter_actor_get_layout_info_or_defaults (actor);
- g_value_set_float (value, info->natural.height);
- }
- break;
-
- case PROP_MIN_WIDTH_SET:
- g_value_set_boolean (value, priv->min_width_set);
- break;
-
- case PROP_MIN_HEIGHT_SET:
- g_value_set_boolean (value, priv->min_height_set);
- break;
-
- case PROP_NATURAL_WIDTH_SET:
- g_value_set_boolean (value, priv->natural_width_set);
- break;
-
- case PROP_NATURAL_HEIGHT_SET:
- g_value_set_boolean (value, priv->natural_height_set);
- break;
-
- case PROP_REQUEST_MODE:
- g_value_set_enum (value, priv->request_mode);
- break;
-
- case PROP_ALLOCATION:
- g_value_set_boxed (value, &priv->allocation);
- break;
-
- case PROP_Z_POSITION:
- g_value_set_float (value, clutter_actor_get_z_position (actor));
- break;
-
- case PROP_OPACITY:
- g_value_set_uint (value, priv->opacity);
- break;
-
- case PROP_OFFSCREEN_REDIRECT:
- g_value_set_flags (value, priv->offscreen_redirect);
- break;
-
- case PROP_NAME:
- g_value_set_string (value, priv->name);
- break;
-
- case PROP_VISIBLE:
- g_value_set_boolean (value, CLUTTER_ACTOR_IS_VISIBLE (actor));
- break;
-
- case PROP_MAPPED:
- g_value_set_boolean (value, CLUTTER_ACTOR_IS_MAPPED (actor));
- break;
-
- case PROP_REALIZED:
- g_value_set_boolean (value, CLUTTER_ACTOR_IS_REALIZED (actor));
- break;
-
- case PROP_HAS_CLIP:
- g_value_set_boolean (value, priv->has_clip);
- break;
-
- case PROP_CLIP_RECT:
- g_value_set_boxed (value, &priv->clip);
- break;
-
- case PROP_CLIP_TO_ALLOCATION:
- g_value_set_boolean (value, priv->clip_to_allocation);
- break;
-
- case PROP_PIVOT_POINT:
- {
- const ClutterTransformInfo *info;
-
- info = _clutter_actor_get_transform_info_or_defaults (actor);
- g_value_set_boxed (value, &info->pivot);
- }
- break;
-
- case PROP_PIVOT_POINT_Z:
- {
- const ClutterTransformInfo *info;
-
- info = _clutter_actor_get_transform_info_or_defaults (actor);
- g_value_set_float (value, info->pivot_z);
- }
- break;
-
- case PROP_TRANSLATION_X:
- {
- const ClutterTransformInfo *info;
-
- info = _clutter_actor_get_transform_info_or_defaults (actor);
- g_value_set_float (value, info->translation.x);
- }
- break;
-
- case PROP_TRANSLATION_Y:
- {
- const ClutterTransformInfo *info;
-
- info = _clutter_actor_get_transform_info_or_defaults (actor);
- g_value_set_float (value, info->translation.y);
- }
- break;
-
- case PROP_TRANSLATION_Z:
- {
- const ClutterTransformInfo *info;
-
- info = _clutter_actor_get_transform_info_or_defaults (actor);
- g_value_set_float (value, info->translation.z);
- }
- break;
-
- case PROP_SCALE_X:
- {
- const ClutterTransformInfo *info;
-
- info = _clutter_actor_get_transform_info_or_defaults (actor);
- g_value_set_double (value, info->scale_x);
- }
- break;
-
- case PROP_SCALE_Y:
- {
- const ClutterTransformInfo *info;
-
- info = _clutter_actor_get_transform_info_or_defaults (actor);
- g_value_set_double (value, info->scale_y);
- }
- break;
-
- case PROP_SCALE_Z:
- {
- const ClutterTransformInfo *info;
-
- info = _clutter_actor_get_transform_info_or_defaults (actor);
- g_value_set_double (value, info->scale_z);
- }
- break;
-
- case PROP_REACTIVE:
- g_value_set_boolean (value, clutter_actor_get_reactive (actor));
- break;
-
- case PROP_ROTATION_ANGLE_X:
- {
- const ClutterTransformInfo *info;
-
- info = _clutter_actor_get_transform_info_or_defaults (actor);
- g_value_set_double (value, info->rx_angle);
- }
- break;
-
- case PROP_ROTATION_ANGLE_Y:
- {
- const ClutterTransformInfo *info;
-
- info = _clutter_actor_get_transform_info_or_defaults (actor);
- g_value_set_double (value, info->ry_angle);
- }
- break;
-
- case PROP_ROTATION_ANGLE_Z:
- {
- const ClutterTransformInfo *info;
-
- info = _clutter_actor_get_transform_info_or_defaults (actor);
- g_value_set_double (value, info->rz_angle);
- }
- break;
-
- case PROP_TRANSFORM:
- {
- graphene_matrix_t m;
-
- clutter_actor_get_transform (actor, &m);
- g_value_set_boxed (value, &m);
- }
- break;
-
- case PROP_TRANSFORM_SET:
- {
- const ClutterTransformInfo *info;
-
- info = _clutter_actor_get_transform_info_or_defaults (actor);
- g_value_set_boolean (value, info->transform_set);
- }
- break;
-
- case PROP_CHILD_TRANSFORM:
- {
- graphene_matrix_t m;
-
- clutter_actor_get_child_transform (actor, &m);
- g_value_set_boxed (value, &m);
- }
- break;
-
- case PROP_CHILD_TRANSFORM_SET:
- {
- const ClutterTransformInfo *info;
-
- info = _clutter_actor_get_transform_info_or_defaults (actor);
- g_value_set_boolean (value, info->child_transform_set);
- }
- break;
-
- case PROP_SHOW_ON_SET_PARENT: /* XXX:2.0 - remove */
- g_value_set_boolean (value, priv->show_on_set_parent);
- break;
-
- case PROP_TEXT_DIRECTION:
- g_value_set_enum (value, priv->text_direction);
- break;
-
- case PROP_HAS_POINTER:
- g_value_set_boolean (value, priv->has_pointer);
- break;
-
- case PROP_LAYOUT_MANAGER:
- g_value_set_object (value, priv->layout_manager);
- break;
-
- case PROP_X_EXPAND:
- {
- const ClutterLayoutInfo *info;
-
- info = _clutter_actor_get_layout_info_or_defaults (actor);
- g_value_set_boolean (value, info->x_expand);
- }
- break;
-
- case PROP_Y_EXPAND:
- {
- const ClutterLayoutInfo *info;
-
- info = _clutter_actor_get_layout_info_or_defaults (actor);
- g_value_set_boolean (value, info->y_expand);
- }
- break;
-
- case PROP_X_ALIGN:
- {
- const ClutterLayoutInfo *info;
-
- info = _clutter_actor_get_layout_info_or_defaults (actor);
- g_value_set_enum (value, info->x_align);
- }
- break;
-
- case PROP_Y_ALIGN:
- {
- const ClutterLayoutInfo *info;
-
- info = _clutter_actor_get_layout_info_or_defaults (actor);
- g_value_set_enum (value, info->y_align);
- }
- break;
-
- case PROP_MARGIN_TOP:
- {
- const ClutterLayoutInfo *info;
-
- info = _clutter_actor_get_layout_info_or_defaults (actor);
- g_value_set_float (value, info->margin.top);
- }
- break;
-
- case PROP_MARGIN_BOTTOM:
- {
- const ClutterLayoutInfo *info;
-
- info = _clutter_actor_get_layout_info_or_defaults (actor);
- g_value_set_float (value, info->margin.bottom);
- }
- break;
-
- case PROP_MARGIN_LEFT:
- {
- const ClutterLayoutInfo *info;
-
- info = _clutter_actor_get_layout_info_or_defaults (actor);
- g_value_set_float (value, info->margin.left);
- }
- break;
-
- case PROP_MARGIN_RIGHT:
- {
- const ClutterLayoutInfo *info;
-
- info = _clutter_actor_get_layout_info_or_defaults (actor);
- g_value_set_float (value, info->margin.right);
- }
- break;
-
- case PROP_BACKGROUND_COLOR_SET:
- g_value_set_boolean (value, priv->bg_color_set);
- break;
-
- case PROP_BACKGROUND_COLOR:
- g_value_set_boxed (value, &priv->bg_color);
- break;
-
- case PROP_FIRST_CHILD:
- g_value_set_object (value, priv->first_child);
- break;
-
- case PROP_LAST_CHILD:
- g_value_set_object (value, priv->last_child);
- break;
-
- case PROP_CONTENT:
- g_value_set_object (value, priv->content);
- break;
-
- case PROP_CONTENT_GRAVITY:
- g_value_set_enum (value, priv->content_gravity);
- break;
-
- case PROP_CONTENT_BOX:
- {
- ClutterActorBox box = { 0, };
-
- clutter_actor_get_content_box (actor, &box);
- g_value_set_boxed (value, &box);
- }
- break;
-
- case PROP_MINIFICATION_FILTER:
- g_value_set_enum (value, priv->min_filter);
- break;
-
- case PROP_MAGNIFICATION_FILTER:
- g_value_set_enum (value, priv->mag_filter);
- break;
-
- case PROP_CONTENT_REPEAT:
- g_value_set_flags (value, priv->content_repeat);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_actor_dispose (GObject *object)
-{
- ClutterActor *self = CLUTTER_ACTOR (object);
- ClutterActorPrivate *priv = self->priv;
- ClutterBackend *backend = clutter_get_default_backend ();
-
- CLUTTER_NOTE (MISC, "Dispose actor (name='%s', ref_count:%d) of type '%s'",
- _clutter_actor_get_debug_name (self),
- object->ref_count,
- g_type_name (G_OBJECT_TYPE (self)));
-
- maybe_unset_key_focus (self);
-
- /* Stop the emission of any property change */
- g_object_freeze_notify (object);
-
- g_signal_emit (self, actor_signals[DESTROY], 0);
-
- /* avoid recursing when called from clutter_actor_destroy() */
- if (priv->parent != NULL)
- {
- ClutterActor *parent = priv->parent;
- clutter_container_remove_actor (CLUTTER_CONTAINER (parent), self);
- }
-
- /* parent must be gone at this point */
- g_assert (priv->parent == NULL);
-
- if (!CLUTTER_ACTOR_IS_TOPLEVEL (self))
- {
- /* can't be mapped or realized with no parent */
- g_assert (!CLUTTER_ACTOR_IS_MAPPED (self));
- g_assert (!CLUTTER_ACTOR_IS_REALIZED (self));
- }
-
- g_clear_signal_handler (&priv->resolution_changed_id, backend);
- g_clear_signal_handler (&priv->font_changed_id, backend);
-
- g_clear_object (&priv->pango_context);
- g_clear_object (&priv->actions);
- g_clear_object (&priv->constraints);
- g_clear_object (&priv->effects);
- g_clear_object (&priv->flatten_effect);
-
- if (priv->child_model != NULL)
- {
- if (priv->create_child_notify != NULL)
- priv->create_child_notify (priv->create_child_data);
-
- priv->create_child_func = NULL;
- priv->create_child_data = NULL;
- priv->create_child_notify = NULL;
-
- g_clear_object (&priv->child_model);
- }
-
- if (priv->layout_manager != NULL)
- {
- g_clear_signal_handler (&priv->layout_changed_id, priv->layout_manager);
- clutter_layout_manager_set_container (priv->layout_manager, NULL);
- g_clear_object (&priv->layout_manager);
- }
-
- if (priv->content != NULL)
- {
- _clutter_content_detached (priv->content, self);
- g_clear_object (&priv->content);
- }
-
- if (priv->clones != NULL)
- {
- g_hash_table_unref (priv->clones);
- priv->clones = NULL;
- }
-
- g_clear_pointer (&priv->stage_views, g_list_free);
-
- G_OBJECT_CLASS (clutter_actor_parent_class)->dispose (object);
-}
-
-static void
-clutter_actor_finalize (GObject *object)
-{
- ClutterActorPrivate *priv = CLUTTER_ACTOR (object)->priv;
-
- CLUTTER_NOTE (MISC, "Finalize actor (name='%s') of type '%s'",
- _clutter_actor_get_debug_name ((ClutterActor *) object),
- g_type_name (G_OBJECT_TYPE (object)));
-
- g_free (priv->name);
-
-#ifdef CLUTTER_ENABLE_DEBUG
- g_free (priv->debug_name);
-#endif
-
- G_OBJECT_CLASS (clutter_actor_parent_class)->finalize (object);
-}
-
-
-/**
- * clutter_actor_get_accessible:
- * @self: a #ClutterActor
- *
- * Returns the accessible object that describes the actor to an
- * assistive technology.
- *
- * If no class-specific #AtkObject implementation is available for the
- * actor instance in question, it will inherit an #AtkObject
- * implementation from the first ancestor class for which such an
- * implementation is defined.
- *
- * The documentation of the <ulink
- * url="http://developer.gnome.org/doc/API/2.0/atk/index.html">ATK</ulink>
- * library contains more information about accessible objects and
- * their uses.
- *
- * Returns: (transfer none): the #AtkObject associated with @actor
- */
-AtkObject *
-clutter_actor_get_accessible (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
-
- return CLUTTER_ACTOR_GET_CLASS (self)->get_accessible (self);
-}
-
-static AtkObject *
-clutter_actor_real_get_accessible (ClutterActor *actor)
-{
- return atk_gobject_accessible_for_object (G_OBJECT (actor));
-}
-
-static AtkObject *
-_clutter_actor_ref_accessible (AtkImplementor *implementor)
-{
- AtkObject *accessible;
-
- accessible = clutter_actor_get_accessible (CLUTTER_ACTOR (implementor));
- if (accessible != NULL)
- g_object_ref (accessible);
-
- return accessible;
-}
-
-static void
-atk_implementor_iface_init (AtkImplementorIface *iface)
-{
- iface->ref_accessible = _clutter_actor_ref_accessible;
-}
-
-static gboolean
-clutter_actor_update_default_paint_volume (ClutterActor *self,
- ClutterPaintVolume *volume)
-{
- ClutterActorPrivate *priv = self->priv;
- gboolean res = TRUE;
-
- /* this should be checked before we call this function, but it's a
- * good idea to be explicit when it costs us nothing
- */
- if (priv->needs_allocation)
- return FALSE;
-
- if (priv->has_clip)
- {
- graphene_point3d_t origin;
-
- origin.x = priv->clip.origin.x;
- origin.y = priv->clip.origin.y;
- origin.z = 0;
-
- clutter_paint_volume_set_origin (volume, &origin);
- clutter_paint_volume_set_width (volume, priv->clip.size.width);
- clutter_paint_volume_set_height (volume, priv->clip.size.height);
-
- return TRUE;
- }
-
- /* we start from the allocation */
- clutter_paint_volume_set_width (volume,
- priv->allocation.x2 - priv->allocation.x1);
- clutter_paint_volume_set_height (volume,
- priv->allocation.y2 - priv->allocation.y1);
-
- /* if the actor has a clip set then we have a pretty definite
- * size for the paint volume: the actor cannot possibly paint
- * outside the clip region.
- */
- if (priv->clip_to_allocation)
- {
- /* the allocation has already been set, so we just flip the
- * return value
- */
- res = TRUE;
- }
- else
- {
- ClutterActor *child;
-
- /* if we don't have children we just bail out here... */
- if (priv->n_children == 0)
- return res;
-
- /* ...but if we have children then we ask for their paint volume in
- * our coordinates. if any of our children replies that it doesn't
- * have a paint volume, we bail out
- */
- for (child = priv->first_child;
- child != NULL;
- child = child->priv->next_sibling)
- {
- const ClutterPaintVolume *child_volume;
-
- /* we ignore unmapped children, since they won't be painted.
- *
- * XXX: we also have to ignore mapped children without a valid
- * allocation, because apparently some code above Clutter allows
- * them.
- */
- if (!CLUTTER_ACTOR_IS_MAPPED (child) || !clutter_actor_has_allocation (child))
- continue;
-
- child_volume = clutter_actor_get_transformed_paint_volume (child, self);
- if (child_volume == NULL)
- {
- res = FALSE;
- break;
- }
-
- clutter_paint_volume_union (volume, child_volume);
- res = TRUE;
- }
- }
-
- return res;
-
-}
-
-static gboolean
-clutter_actor_real_get_paint_volume (ClutterActor *self,
- ClutterPaintVolume *volume)
-{
- ClutterActorClass *klass;
- gboolean res;
-
- klass = CLUTTER_ACTOR_GET_CLASS (self);
-
- /* XXX - this thoroughly sucks, but we don't want to penalize users
- * who use ClutterActor as a "new ClutterGroup" by forcing a full-stage
- * redraw. This should go away in 2.0.
- */
- if (klass->paint == clutter_actor_real_paint &&
- klass->get_paint_volume == clutter_actor_real_get_paint_volume)
- {
- res = TRUE;
- }
- else
- {
- /* this is the default return value: we cannot know if a class
- * is going to paint outside its allocation, so we take the
- * conservative approach.
- */
- res = FALSE;
- }
-
- /* update_default_paint_volume() should only fail if one of the children
- * reported an invalid, or no, paint volume
- */
- if (!clutter_actor_update_default_paint_volume (self, volume))
- return FALSE;
-
- return res;
-}
-
-/**
- * clutter_actor_get_default_paint_volume:
- * @self: a #ClutterActor
- *
- * Retrieves the default paint volume for @self.
- *
- * This function provides the same #ClutterPaintVolume that would be
- * computed by the default implementation inside #ClutterActor of the
- * #ClutterActorClass.get_paint_volume() virtual function.
- *
- * This function should only be used by #ClutterActor subclasses that
- * cannot chain up to the parent implementation when computing their
- * paint volume.
- *
- * Return value: (transfer none): a pointer to the default
- * #ClutterPaintVolume, relative to the #ClutterActor, or %NULL if
- * the actor could not compute a valid paint volume. The returned value
- * is not guaranteed to be stable across multiple frames, so if you
- * want to retain it, you will need to copy it using
- * clutter_paint_volume_copy().
- *
- * Since: 1.10
- */
-const ClutterPaintVolume *
-clutter_actor_get_default_paint_volume (ClutterActor *self)
-{
- ClutterPaintVolume volume;
- ClutterPaintVolume *res;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
-
- res = NULL;
- _clutter_paint_volume_init_static (&volume, self);
- if (clutter_actor_update_default_paint_volume (self, &volume))
- {
- ClutterActor *stage = _clutter_actor_get_stage_internal (self);
-
- if (stage != NULL)
- {
- res = _clutter_stage_paint_volume_stack_allocate (CLUTTER_STAGE (stage));
- _clutter_paint_volume_copy_static (&volume, res);
- }
- }
-
- clutter_paint_volume_free (&volume);
-
- return res;
-}
-
-static gboolean
-clutter_actor_real_has_overlaps (ClutterActor *self)
-{
- /* By default we'll assume that all actors need an offscreen redirect to get
- * the correct opacity. Actors such as ClutterTexture that would never need
- * an offscreen redirect can override this to return FALSE. */
- return TRUE;
-}
-
-static float
-clutter_actor_real_calculate_resource_scale (ClutterActor *self,
- int phase)
-{
- ClutterActorPrivate *priv = self->priv;
- GList *l;
- float new_resource_scale = -1.f;
-
- for (l = priv->stage_views; l; l = l->next)
- {
- ClutterStageView *view = l->data;
-
- new_resource_scale = MAX (clutter_stage_view_get_scale (view),
- new_resource_scale);
- }
-
- return new_resource_scale;
-}
-
-static void
-clutter_actor_real_destroy (ClutterActor *actor)
-{
- ClutterActorIter iter;
-
- g_object_freeze_notify (G_OBJECT (actor));
-
- clutter_actor_iter_init (&iter, actor);
- while (clutter_actor_iter_next (&iter, NULL))
- clutter_actor_iter_destroy (&iter);
-
- g_object_thaw_notify (G_OBJECT (actor));
-}
-
-static GObject *
-clutter_actor_constructor (GType gtype,
- guint n_props,
- GObjectConstructParam *props)
-{
- GObjectClass *gobject_class;
- ClutterActor *self;
- GObject *retval;
-
- gobject_class = G_OBJECT_CLASS (clutter_actor_parent_class);
- retval = gobject_class->constructor (gtype, n_props, props);
- self = CLUTTER_ACTOR (retval);
-
- if (self->priv->layout_manager == NULL)
- {
- ClutterLayoutManager *default_layout;
-
- CLUTTER_NOTE (LAYOUT, "Creating default layout manager");
-
- default_layout = clutter_fixed_layout_new ();
- clutter_actor_set_layout_manager (self, default_layout);
- }
-
- return retval;
-}
-
-static void
-clutter_actor_class_init (ClutterActorClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- quark_actor_layout_info = g_quark_from_static_string ("-clutter-actor-layout-info");
- quark_actor_transform_info = g_quark_from_static_string ("-clutter-actor-transform-info");
- quark_actor_animation_info = g_quark_from_static_string ("-clutter-actor-animation-info");
-
- quark_key = g_quark_from_static_string ("key");
- quark_motion = g_quark_from_static_string ("motion");
- quark_pointer_focus = g_quark_from_static_string ("pointer-focus");
- quark_button = g_quark_from_static_string ("button");
- quark_scroll = g_quark_from_static_string ("scroll");
- quark_stage = g_quark_from_static_string ("stage");
- quark_touch = g_quark_from_static_string ("touch");
- quark_touchpad = g_quark_from_static_string ("touchpad");
- quark_proximity = g_quark_from_static_string ("proximity");
- quark_pad = g_quark_from_static_string ("pad");
- quark_im = g_quark_from_static_string ("im");
-
- object_class->constructor = clutter_actor_constructor;
- object_class->set_property = clutter_actor_set_property;
- object_class->get_property = clutter_actor_get_property;
- object_class->dispose = clutter_actor_dispose;
- object_class->finalize = clutter_actor_finalize;
-
- klass->show = clutter_actor_real_show;
- klass->hide = clutter_actor_real_hide;
- klass->hide_all = clutter_actor_hide;
- klass->map = clutter_actor_real_map;
- klass->unmap = clutter_actor_real_unmap;
- klass->unrealize = clutter_actor_real_unrealize;
- klass->pick = clutter_actor_real_pick;
- klass->get_preferred_width = clutter_actor_real_get_preferred_width;
- klass->get_preferred_height = clutter_actor_real_get_preferred_height;
- klass->allocate = clutter_actor_real_allocate;
- klass->queue_relayout = clutter_actor_real_queue_relayout;
- klass->apply_transform = clutter_actor_real_apply_transform;
- klass->get_accessible = clutter_actor_real_get_accessible;
- klass->get_paint_volume = clutter_actor_real_get_paint_volume;
- klass->has_overlaps = clutter_actor_real_has_overlaps;
- klass->calculate_resource_scale = clutter_actor_real_calculate_resource_scale;
- klass->paint = clutter_actor_real_paint;
- klass->destroy = clutter_actor_real_destroy;
-
- /**
- * ClutterActor:x:
- *
- * X coordinate of the actor in pixels. If written, forces a fixed
- * position for the actor. If read, returns the fixed position if any,
- * otherwise the allocation if available, otherwise 0.
- *
- * The #ClutterActor:x property is animatable.
- */
- obj_props[PROP_X] =
- g_param_spec_float ("x",
- P_("X coordinate"),
- P_("X coordinate of the actor"),
- -G_MAXFLOAT, G_MAXFLOAT,
- 0.0,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY |
- CLUTTER_PARAM_ANIMATABLE);
-
- /**
- * ClutterActor:y:
- *
- * Y coordinate of the actor in pixels. If written, forces a fixed
- * position for the actor. If read, returns the fixed position if
- * any, otherwise the allocation if available, otherwise 0.
- *
- * The #ClutterActor:y property is animatable.
- */
- obj_props[PROP_Y] =
- g_param_spec_float ("y",
- P_("Y coordinate"),
- P_("Y coordinate of the actor"),
- -G_MAXFLOAT, G_MAXFLOAT,
- 0.0,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY |
- CLUTTER_PARAM_ANIMATABLE);
-
- /**
- * ClutterActor:position:
- *
- * The position of the origin of the actor.
- *
- * This property is a shorthand for setting and getting the
- * #ClutterActor:x and #ClutterActor:y properties at the same
- * time.
- *
- * The #ClutterActor:position property is animatable.
- *
- * Since: 1.12
- */
- obj_props[PROP_POSITION] =
- g_param_spec_boxed ("position",
- P_("Position"),
- P_("The position of the origin of the actor"),
- GRAPHENE_TYPE_POINT,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY |
- CLUTTER_PARAM_ANIMATABLE);
-
- /**
- * ClutterActor:width:
- *
- * Width of the actor (in pixels). If written, forces the minimum and
- * natural size request of the actor to the given width. If read, returns
- * the allocated width if available, otherwise the width request.
- *
- * The #ClutterActor:width property is animatable.
- */
- obj_props[PROP_WIDTH] =
- g_param_spec_float ("width",
- P_("Width"),
- P_("Width of the actor"),
- -1.0f, G_MAXFLOAT,
- 0.0,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY |
- CLUTTER_PARAM_ANIMATABLE);
-
- /**
- * ClutterActor:height:
- *
- * Height of the actor (in pixels). If written, forces the minimum and
- * natural size request of the actor to the given height. If read, returns
- * the allocated height if available, otherwise the height request.
- *
- * The #ClutterActor:height property is animatable.
- */
- obj_props[PROP_HEIGHT] =
- g_param_spec_float ("height",
- P_("Height"),
- P_("Height of the actor"),
- -1.0f, G_MAXFLOAT,
- 0.0,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY |
- CLUTTER_PARAM_ANIMATABLE);
-
- /**
- * ClutterActor:size:
- *
- * The size of the actor.
- *
- * This property is a shorthand for setting and getting the
- * #ClutterActor:width and #ClutterActor:height at the same time.
- *
- * The #ClutterActor:size property is animatable.
- *
- * Since: 1.12
- */
- obj_props[PROP_SIZE] =
- g_param_spec_boxed ("size",
- P_("Size"),
- P_("The size of the actor"),
- GRAPHENE_TYPE_SIZE,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY |
- CLUTTER_PARAM_ANIMATABLE);
-
- /**
- * ClutterActor:fixed-x:
- *
- * The fixed X position of the actor in pixels.
- *
- * Writing this property sets #ClutterActor:fixed-position-set
- * property as well, as a side effect
- *
- * Since: 0.8
- */
- obj_props[PROP_FIXED_X] =
- g_param_spec_float ("fixed-x",
- P_("Fixed X"),
- P_("Forced X position of the actor"),
- -G_MAXFLOAT, G_MAXFLOAT,
- 0.0,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:fixed-y:
- *
- * The fixed Y position of the actor in pixels.
- *
- * Writing this property sets the #ClutterActor:fixed-position-set
- * property as well, as a side effect
- *
- * Since: 0.8
- */
- obj_props[PROP_FIXED_Y] =
- g_param_spec_float ("fixed-y",
- P_("Fixed Y"),
- P_("Forced Y position of the actor"),
- -G_MAXFLOAT, G_MAXFLOAT,
- 0,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:fixed-position-set:
- *
- * This flag controls whether the #ClutterActor:fixed-x and
- * #ClutterActor:fixed-y properties are used
- *
- * Since: 0.8
- */
- obj_props[PROP_FIXED_POSITION_SET] =
- g_param_spec_boolean ("fixed-position-set",
- P_("Fixed position set"),
- P_("Whether to use fixed positioning for the actor"),
- FALSE,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:min-width:
- *
- * A forced minimum width request for the actor, in pixels
- *
- * Writing this property sets the #ClutterActor:min-width-set property
- * as well, as a side effect.
- *
- *This property overrides the usual width request of the actor.
- *
- * Since: 0.8
- */
- obj_props[PROP_MIN_WIDTH] =
- g_param_spec_float ("min-width",
- P_("Min Width"),
- P_("Forced minimum width request for the actor"),
- 0.0, G_MAXFLOAT,
- 0.0,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:min-height:
- *
- * A forced minimum height request for the actor, in pixels
- *
- * Writing this property sets the #ClutterActor:min-height-set property
- * as well, as a side effect. This property overrides the usual height
- * request of the actor.
- *
- * Since: 0.8
- */
- obj_props[PROP_MIN_HEIGHT] =
- g_param_spec_float ("min-height",
- P_("Min Height"),
- P_("Forced minimum height request for the actor"),
- 0.0, G_MAXFLOAT,
- 0.0,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:natural-width:
- *
- * A forced natural width request for the actor, in pixels
- *
- * Writing this property sets the #ClutterActor:natural-width-set
- * property as well, as a side effect. This property overrides the
- * usual width request of the actor
- *
- * Since: 0.8
- */
- obj_props[PROP_NATURAL_WIDTH] =
- g_param_spec_float ("natural-width",
- P_("Natural Width"),
- P_("Forced natural width request for the actor"),
- 0.0, G_MAXFLOAT,
- 0.0,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:natural-height:
- *
- * A forced natural height request for the actor, in pixels
- *
- * Writing this property sets the #ClutterActor:natural-height-set
- * property as well, as a side effect. This property overrides the
- * usual height request of the actor
- *
- * Since: 0.8
- */
- obj_props[PROP_NATURAL_HEIGHT] =
- g_param_spec_float ("natural-height",
- P_("Natural Height"),
- P_("Forced natural height request for the actor"),
- 0.0, G_MAXFLOAT,
- 0.0,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:min-width-set:
- *
- * This flag controls whether the #ClutterActor:min-width property
- * is used
- *
- * Since: 0.8
- */
- obj_props[PROP_MIN_WIDTH_SET] =
- g_param_spec_boolean ("min-width-set",
- P_("Minimum width set"),
- P_("Whether to use the min-width property"),
- FALSE,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:min-height-set:
- *
- * This flag controls whether the #ClutterActor:min-height property
- * is used
- *
- * Since: 0.8
- */
- obj_props[PROP_MIN_HEIGHT_SET] =
- g_param_spec_boolean ("min-height-set",
- P_("Minimum height set"),
- P_("Whether to use the min-height property"),
- FALSE,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:natural-width-set:
- *
- * This flag controls whether the #ClutterActor:natural-width property
- * is used
- *
- * Since: 0.8
- */
- obj_props[PROP_NATURAL_WIDTH_SET] =
- g_param_spec_boolean ("natural-width-set",
- P_("Natural width set"),
- P_("Whether to use the natural-width property"),
- FALSE,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:natural-height-set:
- *
- * This flag controls whether the #ClutterActor:natural-height property
- * is used
- *
- * Since: 0.8
- */
- obj_props[PROP_NATURAL_HEIGHT_SET] =
- g_param_spec_boolean ("natural-height-set",
- P_("Natural height set"),
- P_("Whether to use the natural-height property"),
- FALSE,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:allocation:
- *
- * The allocation for the actor, in pixels
- *
- * This is property is read-only, but you might monitor it to know when an
- * actor moves or resizes
- *
- * Since: 0.8
- */
- obj_props[PROP_ALLOCATION] =
- g_param_spec_boxed ("allocation",
- P_("Allocation"),
- P_("The actor's allocation"),
- CLUTTER_TYPE_ACTOR_BOX,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY |
- CLUTTER_PARAM_ANIMATABLE);
-
- /**
- * ClutterActor:request-mode:
- *
- * Request mode for the #ClutterActor. The request mode determines the
- * type of geometry management used by the actor, either height for width
- * (the default) or width for height.
- *
- * For actors implementing height for width, the parent container should get
- * the preferred width first, and then the preferred height for that width.
- *
- * For actors implementing width for height, the parent container should get
- * the preferred height first, and then the preferred width for that height.
- *
- * For instance:
- *
- * |[<!-- language="C" -->
- * ClutterRequestMode mode;
- * gfloat natural_width, min_width;
- * gfloat natural_height, min_height;
- *
- * mode = clutter_actor_get_request_mode (child);
- * if (mode == CLUTTER_REQUEST_HEIGHT_FOR_WIDTH)
- * {
- * clutter_actor_get_preferred_width (child, -1,
- * &min_width,
- * &natural_width);
- * clutter_actor_get_preferred_height (child, natural_width,
- * &min_height,
- * &natural_height);
- * }
- * else if (mode == CLUTTER_REQUEST_WIDTH_FOR_HEIGHT)
- * {
- * clutter_actor_get_preferred_height (child, -1,
- * &min_height,
- * &natural_height);
- * clutter_actor_get_preferred_width (child, natural_height,
- * &min_width,
- * &natural_width);
- * }
- * else if (mode == CLUTTER_REQUEST_CONTENT_SIZE)
- * {
- * ClutterContent *content = clutter_actor_get_content (child);
- *
- * min_width, min_height = 0;
- * natural_width = natural_height = 0;
- *
- * if (content != NULL)
- * clutter_content_get_preferred_size (content, &natural_width, &natural_height);
- * }
- * ]|
- *
- * will retrieve the minimum and natural width and height depending on the
- * preferred request mode of the #ClutterActor "child".
- *
- * The clutter_actor_get_preferred_size() function will implement this
- * check for you.
- *
- * Since: 0.8
- */
- obj_props[PROP_REQUEST_MODE] =
- g_param_spec_enum ("request-mode",
- P_("Request Mode"),
- P_("The actor's request mode"),
- CLUTTER_TYPE_REQUEST_MODE,
- CLUTTER_REQUEST_HEIGHT_FOR_WIDTH,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:z-position:
- *
- * The actor's position on the Z axis, relative to the parent's
- * transformations.
- *
- * Positive values will bring the actor's position nearer to the user,
- * whereas negative values will bring the actor's position farther from
- * the user.
- *
- * The #ClutterActor:z-position does not affect the paint or allocation
- * order.
- *
- * The #ClutterActor:z-position property is animatable.
- *
- * Since: 1.12
- */
- obj_props[PROP_Z_POSITION] =
- g_param_spec_float ("z-position",
- P_("Z Position"),
- P_("The actor's position on the Z axis"),
- -G_MAXFLOAT, G_MAXFLOAT,
- 0.0f,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY |
- CLUTTER_PARAM_ANIMATABLE);
-
- /**
- * ClutterActor:opacity:
- *
- * Opacity of an actor, between 0 (fully transparent) and
- * 255 (fully opaque)
- *
- * The #ClutterActor:opacity property is animatable.
- */
- obj_props[PROP_OPACITY] =
- g_param_spec_uint ("opacity",
- P_("Opacity"),
- P_("Opacity of an actor"),
- 0, 255,
- 255,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY |
- CLUTTER_PARAM_ANIMATABLE);
-
- /**
- * ClutterActor:offscreen-redirect:
- *
- * Determines the conditions in which the actor will be redirected
- * to an offscreen framebuffer while being painted. For example this
- * can be used to cache an actor in a framebuffer or for improved
- * handling of transparent actors. See
- * clutter_actor_set_offscreen_redirect() for details.
- *
- * Since: 1.8
- */
- obj_props[PROP_OFFSCREEN_REDIRECT] =
- g_param_spec_flags ("offscreen-redirect",
- P_("Offscreen redirect"),
- P_("Flags controlling when to flatten the actor into a single image"),
- CLUTTER_TYPE_OFFSCREEN_REDIRECT,
- 0,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterActor:visible:
- *
- * Whether the actor is set to be visible or not
- *
- * See also #ClutterActor:mapped
- */
- obj_props[PROP_VISIBLE] =
- g_param_spec_boolean ("visible",
- P_("Visible"),
- P_("Whether the actor is visible or not"),
- FALSE,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:mapped:
- *
- * Whether the actor is mapped (will be painted when the stage
- * to which it belongs is mapped)
- *
- * Since: 1.0
- */
- obj_props[PROP_MAPPED] =
- g_param_spec_boolean ("mapped",
- P_("Mapped"),
- P_("Whether the actor will be painted"),
- FALSE,
- CLUTTER_PARAM_READABLE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:realized:
- *
- * Whether the actor has been realized
- *
- * Since: 1.0
- */
- obj_props[PROP_REALIZED] =
- g_param_spec_boolean ("realized",
- P_("Realized"),
- P_("Whether the actor has been realized"),
- FALSE,
- CLUTTER_PARAM_READABLE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:reactive:
- *
- * Whether the actor is reactive to events or not
- *
- * Only reactive actors will emit event-related signals
- *
- * Since: 0.6
- */
- obj_props[PROP_REACTIVE] =
- g_param_spec_boolean ("reactive",
- P_("Reactive"),
- P_("Whether the actor is reactive to events"),
- FALSE,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:has-clip:
- *
- * Whether the actor has the #ClutterActor:clip property set or not
- */
- obj_props[PROP_HAS_CLIP] =
- g_param_spec_boolean ("has-clip",
- P_("Has Clip"),
- P_("Whether the actor has a clip set"),
- FALSE,
- CLUTTER_PARAM_READABLE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:clip-rect:
- *
- * The visible region of the actor, in actor-relative coordinates,
- * expressed as a #graphene_rect_t.
- *
- * Setting this property to %NULL will unset the existing clip.
- *
- * Setting this property will change the #ClutterActor:has-clip
- * property as a side effect.
- *
- * Since: 1.12
- */
- obj_props[PROP_CLIP_RECT] =
- g_param_spec_boxed ("clip-rect",
- P_("Clip Rectangle"),
- P_("The visible region of the actor"),
- GRAPHENE_TYPE_RECT,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:name:
- *
- * The name of the actor
- *
- * Since: 0.2
- */
- obj_props[PROP_NAME] =
- g_param_spec_string ("name",
- P_("Name"),
- P_("Name of the actor"),
- NULL,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:pivot-point:
- *
- * The point around which the scaling and rotation transformations occur.
- *
- * The pivot point is expressed in normalized coordinates space, with (0, 0)
- * being the top left corner of the actor and (1, 1) the bottom right corner
- * of the actor.
- *
- * The default pivot point is located at (0, 0).
- *
- * The #ClutterActor:pivot-point property is animatable.
- *
- * Since: 1.12
- */
- obj_props[PROP_PIVOT_POINT] =
- g_param_spec_boxed ("pivot-point",
- P_("Pivot Point"),
- P_("The point around which the scaling and rotation occur"),
- GRAPHENE_TYPE_POINT,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY |
- CLUTTER_PARAM_ANIMATABLE);
-
- /**
- * ClutterActor:pivot-point-z:
- *
- * The Z component of the #ClutterActor:pivot-point, expressed as a value
- * along the Z axis.
- *
- * The #ClutterActor:pivot-point-z property is animatable.
- *
- * Since: 1.12
- */
- obj_props[PROP_PIVOT_POINT_Z] =
- g_param_spec_float ("pivot-point-z",
- P_("Pivot Point Z"),
- P_("Z component of the pivot point"),
- -G_MAXFLOAT, G_MAXFLOAT,
- 0.f,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY |
- CLUTTER_PARAM_ANIMATABLE);
-
- /**
- * ClutterActor:scale-x:
- *
- * The horizontal scale of the actor.
- *
- * The #ClutterActor:scale-x property is animatable.
- *
- * Since: 0.6
- */
- obj_props[PROP_SCALE_X] =
- g_param_spec_double ("scale-x",
- P_("Scale X"),
- P_("Scale factor on the X axis"),
- -G_MAXDOUBLE, G_MAXDOUBLE,
- 1.0,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY |
- CLUTTER_PARAM_ANIMATABLE);
-
- /**
- * ClutterActor:scale-y:
- *
- * The vertical scale of the actor.
- *
- * The #ClutterActor:scale-y property is animatable.
- *
- * Since: 0.6
- */
- obj_props[PROP_SCALE_Y] =
- g_param_spec_double ("scale-y",
- P_("Scale Y"),
- P_("Scale factor on the Y axis"),
- -G_MAXDOUBLE, G_MAXDOUBLE,
- 1.0,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY |
- CLUTTER_PARAM_ANIMATABLE);
-
- /**
- * ClutterActor:scale-z:
- *
- * The scale factor of the actor along the Z axis.
- *
- * The #ClutterActor:scale-y property is animatable.
- *
- * Since: 1.12
- */
- obj_props[PROP_SCALE_Z] =
- g_param_spec_double ("scale-z",
- P_("Scale Z"),
- P_("Scale factor on the Z axis"),
- -G_MAXDOUBLE, G_MAXDOUBLE,
- 1.0,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY |
- CLUTTER_PARAM_ANIMATABLE);
-
- /**
- * ClutterActor:rotation-angle-x:
- *
- * The rotation angle on the X axis.
- *
- * The #ClutterActor:rotation-angle-x property is animatable.
- *
- * Since: 0.6
- */
- obj_props[PROP_ROTATION_ANGLE_X] =
- g_param_spec_double ("rotation-angle-x",
- P_("Rotation Angle X"),
- P_("The rotation angle on the X axis"),
- -G_MAXDOUBLE, G_MAXDOUBLE,
- 0.0,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY |
- CLUTTER_PARAM_ANIMATABLE);
-
- /**
- * ClutterActor:rotation-angle-y:
- *
- * The rotation angle on the Y axis
- *
- * The #ClutterActor:rotation-angle-y property is animatable.
- *
- * Since: 0.6
- */
- obj_props[PROP_ROTATION_ANGLE_Y] =
- g_param_spec_double ("rotation-angle-y",
- P_("Rotation Angle Y"),
- P_("The rotation angle on the Y axis"),
- -G_MAXDOUBLE, G_MAXDOUBLE,
- 0.0,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY |
- CLUTTER_PARAM_ANIMATABLE);
-
- /**
- * ClutterActor:rotation-angle-z:
- *
- * The rotation angle on the Z axis
- *
- * The #ClutterActor:rotation-angle-z property is animatable.
- *
- * Since: 0.6
- */
- obj_props[PROP_ROTATION_ANGLE_Z] =
- g_param_spec_double ("rotation-angle-z",
- P_("Rotation Angle Z"),
- P_("The rotation angle on the Z axis"),
- -G_MAXDOUBLE, G_MAXDOUBLE,
- 0.0,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- CLUTTER_PARAM_ANIMATABLE);
-
- /**
- * ClutterActor:translation-x:
- *
- * An additional translation applied along the X axis, relative
- * to the actor's #ClutterActor:pivot-point.
- *
- * The #ClutterActor:translation-x property is animatable.
- *
- * Since: 1.12
- */
- obj_props[PROP_TRANSLATION_X] =
- g_param_spec_float ("translation-x",
- P_("Translation X"),
- P_("Translation along the X axis"),
- -G_MAXFLOAT, G_MAXFLOAT,
- 0.f,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY |
- CLUTTER_PARAM_ANIMATABLE);
-
- /**
- * ClutterActor:translation-y:
- *
- * An additional translation applied along the Y axis, relative
- * to the actor's #ClutterActor:pivot-point.
- *
- * The #ClutterActor:translation-y property is animatable.
- *
- * Since: 1.12
- */
- obj_props[PROP_TRANSLATION_Y] =
- g_param_spec_float ("translation-y",
- P_("Translation Y"),
- P_("Translation along the Y axis"),
- -G_MAXFLOAT, G_MAXFLOAT,
- 0.f,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY |
- CLUTTER_PARAM_ANIMATABLE);
-
- /**
- * ClutterActor:translation-z:
- *
- * An additional translation applied along the Z axis, relative
- * to the actor's #ClutterActor:pivot-point.
- *
- * The #ClutterActor:translation-z property is animatable.
- *
- * Since: 1.12
- */
- obj_props[PROP_TRANSLATION_Z] =
- g_param_spec_float ("translation-z",
- P_("Translation Z"),
- P_("Translation along the Z axis"),
- -G_MAXFLOAT, G_MAXFLOAT,
- 0.f,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY |
- CLUTTER_PARAM_ANIMATABLE);
-
- /**
- * ClutterActor:transform:
- *
- * Overrides the transformations of a #ClutterActor with a custom
- * matrix.
- *
- * The matrix specified by the #ClutterActor:transform property is
- * applied to the actor and its children relative to the actor's
- * #ClutterActor:allocation and #ClutterActor:pivot-point.
- *
- * Application code should rarely need to use this function directly.
- *
- * Setting this property with a #graphene_matrix_t will set the
- * #ClutterActor:transform-set property to %TRUE as a side effect;
- * setting this property with %NULL will set the
- * #ClutterActor:transform-set property to %FALSE.
- *
- * The #ClutterActor:transform property is animatable.
- *
- * Since: 1.12
- */
- obj_props[PROP_TRANSFORM] =
- g_param_spec_boxed ("transform",
- P_("Transform"),
- P_("Transformation matrix"),
- GRAPHENE_TYPE_MATRIX,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY |
- CLUTTER_PARAM_ANIMATABLE);
-
- /**
- * ClutterActor:transform-set:
- *
- * Whether the #ClutterActor:transform property is set.
- *
- * Since: 1.12
- */
- obj_props[PROP_TRANSFORM_SET] =
- g_param_spec_boolean ("transform-set",
- P_("Transform Set"),
- P_("Whether the transform property is set"),
- FALSE,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:child-transform:
- *
- * Applies a transformation matrix on each child of an actor.
- *
- * Setting this property with a #graphene_matrix_t will set the
- * #ClutterActor:child-transform-set property to %TRUE as a side effect;
- * setting this property with %NULL will set the
- * #ClutterActor:child-transform-set property to %FALSE.
- *
- * The #ClutterActor:child-transform property is animatable.
- *
- * Since: 1.12
- */
- obj_props[PROP_CHILD_TRANSFORM] =
- g_param_spec_boxed ("child-transform",
- P_("Child Transform"),
- P_("Children transformation matrix"),
- GRAPHENE_TYPE_MATRIX,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY |
- CLUTTER_PARAM_ANIMATABLE);
-
- /**
- * ClutterActor:child-transform-set:
- *
- * Whether the #ClutterActor:child-transform property is set.
- *
- * Since: 1.12
- */
- obj_props[PROP_CHILD_TRANSFORM_SET] =
- g_param_spec_boolean ("child-transform-set",
- P_("Child Transform Set"),
- P_("Whether the child-transform property is set"),
- FALSE,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:show-on-set-parent:
- *
- * If %TRUE, the actor is automatically shown when parented.
- *
- * Calling clutter_actor_hide() on an actor which has not been
- * parented will set this property to %FALSE as a side effect.
- *
- * Since: 0.8
- */
- obj_props[PROP_SHOW_ON_SET_PARENT] = /* XXX:2.0 - remove */
- g_param_spec_boolean ("show-on-set-parent",
- P_("Show on set parent"),
- P_("Whether the actor is shown when parented"),
- TRUE,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterActor:clip-to-allocation:
- *
- * Whether the clip region should track the allocated area
- * of the actor.
- *
- * This property is ignored if a clip area has been explicitly
- * set using clutter_actor_set_clip().
- *
- * Since: 1.0
- */
- obj_props[PROP_CLIP_TO_ALLOCATION] =
- g_param_spec_boolean ("clip-to-allocation",
- P_("Clip to Allocation"),
- P_("Sets the clip region to track the actor's allocation"),
- FALSE,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:text-direction:
- *
- * The direction of the text inside a #ClutterActor.
- *
- * Since: 1.0
- */
- obj_props[PROP_TEXT_DIRECTION] =
- g_param_spec_enum ("text-direction",
- P_("Text Direction"),
- P_("Direction of the text"),
- CLUTTER_TYPE_TEXT_DIRECTION,
- CLUTTER_TEXT_DIRECTION_LTR,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:has-pointer:
- *
- * Whether the actor contains the pointer of a #ClutterInputDevice
- * or not.
- *
- * Since: 1.2
- */
- obj_props[PROP_HAS_POINTER] =
- g_param_spec_boolean ("has-pointer",
- P_("Has Pointer"),
- P_("Whether the actor contains the pointer of an input device"),
- FALSE,
- CLUTTER_PARAM_READABLE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:actions:
- *
- * Adds a #ClutterAction to the actor
- *
- * Since: 1.4
- */
- obj_props[PROP_ACTIONS] =
- g_param_spec_object ("actions",
- P_("Actions"),
- P_("Adds an action to the actor"),
- CLUTTER_TYPE_ACTION,
- CLUTTER_PARAM_WRITABLE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:constraints:
- *
- * Adds a #ClutterConstraint to the actor
- *
- * Since: 1.4
- */
- obj_props[PROP_CONSTRAINTS] =
- g_param_spec_object ("constraints",
- P_("Constraints"),
- P_("Adds a constraint to the actor"),
- CLUTTER_TYPE_CONSTRAINT,
- CLUTTER_PARAM_WRITABLE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:effect:
- *
- * Adds #ClutterEffect to the list of effects be applied on a #ClutterActor
- *
- * Since: 1.4
- */
- obj_props[PROP_EFFECT] =
- g_param_spec_object ("effect",
- P_("Effect"),
- P_("Add an effect to be applied on the actor"),
- CLUTTER_TYPE_EFFECT,
- CLUTTER_PARAM_WRITABLE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:layout-manager:
- *
- * A delegate object for controlling the layout of the children of
- * an actor.
- *
- * Since: 1.10
- */
- obj_props[PROP_LAYOUT_MANAGER] =
- g_param_spec_object ("layout-manager",
- P_("Layout Manager"),
- P_("The object controlling the layout of an actor's children"),
- CLUTTER_TYPE_LAYOUT_MANAGER,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:x-expand:
- *
- * Whether a layout manager should assign more space to the actor on
- * the X axis.
- *
- * Since: 1.12
- */
- obj_props[PROP_X_EXPAND] =
- g_param_spec_boolean ("x-expand",
- P_("X Expand"),
- P_("Whether extra horizontal space should be assigned to the actor"),
- FALSE,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:y-expand:
- *
- * Whether a layout manager should assign more space to the actor on
- * the Y axis.
- *
- * Since: 1.12
- */
- obj_props[PROP_Y_EXPAND] =
- g_param_spec_boolean ("y-expand",
- P_("Y Expand"),
- P_("Whether extra vertical space should be assigned to the actor"),
- FALSE,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:x-align:
- *
- * The alignment of an actor on the X axis, if the actor has been given
- * extra space for its allocation. See also the #ClutterActor:x-expand
- * property.
- *
- * Since: 1.10
- */
- obj_props[PROP_X_ALIGN] =
- g_param_spec_enum ("x-align",
- P_("X Alignment"),
- P_("The alignment of the actor on the X axis within its allocation"),
- CLUTTER_TYPE_ACTOR_ALIGN,
- CLUTTER_ACTOR_ALIGN_FILL,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:y-align:
- *
- * The alignment of an actor on the Y axis, if the actor has been given
- * extra space for its allocation.
- *
- * Since: 1.10
- */
- obj_props[PROP_Y_ALIGN] =
- g_param_spec_enum ("y-align",
- P_("Y Alignment"),
- P_("The alignment of the actor on the Y axis within its allocation"),
- CLUTTER_TYPE_ACTOR_ALIGN,
- CLUTTER_ACTOR_ALIGN_FILL,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:margin-top:
- *
- * The margin (in pixels) from the top of the actor.
- *
- * This property adds a margin to the actor's preferred size; the margin
- * will be automatically taken into account when allocating the actor.
- *
- * The #ClutterActor:margin-top property is animatable.
- *
- * Since: 1.10
- */
- obj_props[PROP_MARGIN_TOP] =
- g_param_spec_float ("margin-top",
- P_("Margin Top"),
- P_("Extra space at the top"),
- 0.0, G_MAXFLOAT,
- 0.0,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY |
- CLUTTER_PARAM_ANIMATABLE);
-
- /**
- * ClutterActor:margin-bottom:
- *
- * The margin (in pixels) from the bottom of the actor.
- *
- * This property adds a margin to the actor's preferred size; the margin
- * will be automatically taken into account when allocating the actor.
- *
- * The #ClutterActor:margin-bottom property is animatable.
- *
- * Since: 1.10
- */
- obj_props[PROP_MARGIN_BOTTOM] =
- g_param_spec_float ("margin-bottom",
- P_("Margin Bottom"),
- P_("Extra space at the bottom"),
- 0.0, G_MAXFLOAT,
- 0.0,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY |
- CLUTTER_PARAM_ANIMATABLE);
-
- /**
- * ClutterActor:margin-left:
- *
- * The margin (in pixels) from the left of the actor.
- *
- * This property adds a margin to the actor's preferred size; the margin
- * will be automatically taken into account when allocating the actor.
- *
- * The #ClutterActor:margin-left property is animatable.
- *
- * Since: 1.10
- */
- obj_props[PROP_MARGIN_LEFT] =
- g_param_spec_float ("margin-left",
- P_("Margin Left"),
- P_("Extra space at the left"),
- 0.0, G_MAXFLOAT,
- 0.0,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY |
- CLUTTER_PARAM_ANIMATABLE);
-
- /**
- * ClutterActor:margin-right:
- *
- * The margin (in pixels) from the right of the actor.
- *
- * This property adds a margin to the actor's preferred size; the margin
- * will be automatically taken into account when allocating the actor.
- *
- * The #ClutterActor:margin-right property is animatable.
- *
- * Since: 1.10
- */
- obj_props[PROP_MARGIN_RIGHT] =
- g_param_spec_float ("margin-right",
- P_("Margin Right"),
- P_("Extra space at the right"),
- 0.0, G_MAXFLOAT,
- 0.0,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY |
- CLUTTER_PARAM_ANIMATABLE);
-
- /**
- * ClutterActor:background-color-set:
- *
- * Whether the #ClutterActor:background-color property has been set.
- *
- * Since: 1.10
- */
- obj_props[PROP_BACKGROUND_COLOR_SET] =
- g_param_spec_boolean ("background-color-set",
- P_("Background Color Set"),
- P_("Whether the background color is set"),
- FALSE,
- CLUTTER_PARAM_READABLE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:background-color:
- *
- * Paints a solid fill of the actor's allocation using the specified
- * color.
- *
- * The #ClutterActor:background-color property is animatable.
- *
- * Since: 1.10
- */
- obj_props[PROP_BACKGROUND_COLOR] =
- clutter_param_spec_color ("background-color",
- P_("Background color"),
- P_("The actor's background color"),
- CLUTTER_COLOR_Transparent,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY |
- CLUTTER_PARAM_ANIMATABLE);
-
- /**
- * ClutterActor:first-child:
- *
- * The actor's first child.
- *
- * Since: 1.10
- */
- obj_props[PROP_FIRST_CHILD] =
- g_param_spec_object ("first-child",
- P_("First Child"),
- P_("The actor's first child"),
- CLUTTER_TYPE_ACTOR,
- CLUTTER_PARAM_READABLE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:last-child:
- *
- * The actor's last child.
- *
- * Since: 1.10
- */
- obj_props[PROP_LAST_CHILD] =
- g_param_spec_object ("last-child",
- P_("Last Child"),
- P_("The actor's last child"),
- CLUTTER_TYPE_ACTOR,
- CLUTTER_PARAM_READABLE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:content:
- *
- * The #ClutterContent implementation that controls the content
- * of the actor.
- *
- * Since: 1.10
- */
- obj_props[PROP_CONTENT] =
- g_param_spec_object ("content",
- P_("Content"),
- P_("Delegate object for painting the actor's content"),
- CLUTTER_TYPE_CONTENT,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:content-gravity:
- *
- * The alignment that should be honoured by the #ClutterContent
- * set with the #ClutterActor:content property.
- *
- * Changing the value of this property will change the bounding box of
- * the content; you can use the #ClutterActor:content-box property to
- * get the position and size of the content within the actor's
- * allocation.
- *
- * This property is meaningful only for #ClutterContent implementations
- * that have a preferred size, and if the preferred size is smaller than
- * the actor's allocation.
- *
- * The #ClutterActor:content-gravity property is animatable.
- *
- * Since: 1.10
- */
- obj_props[PROP_CONTENT_GRAVITY] =
- g_param_spec_enum ("content-gravity",
- P_("Content Gravity"),
- P_("Alignment of the actor's content"),
- CLUTTER_TYPE_CONTENT_GRAVITY,
- CLUTTER_CONTENT_GRAVITY_RESIZE_FILL,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:content-box:
- *
- * The bounding box for the #ClutterContent used by the actor.
- *
- * The value of this property is controlled by the #ClutterActor:allocation
- * and #ClutterActor:content-gravity properties of #ClutterActor.
- *
- * The bounding box for the content is guaranteed to never exceed the
- * allocation's of the actor.
- *
- * Since: 1.10
- */
- obj_props[PROP_CONTENT_BOX] =
- g_param_spec_boxed ("content-box",
- P_("Content Box"),
- P_("The bounding box of the actor's content"),
- CLUTTER_TYPE_ACTOR_BOX,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY |
- CLUTTER_PARAM_ANIMATABLE);
-
- obj_props[PROP_MINIFICATION_FILTER] =
- g_param_spec_enum ("minification-filter",
- P_("Minification Filter"),
- P_("The filter used when reducing the size of the content"),
- CLUTTER_TYPE_SCALING_FILTER,
- CLUTTER_SCALING_FILTER_LINEAR,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- obj_props[PROP_MAGNIFICATION_FILTER] =
- g_param_spec_enum ("magnification-filter",
- P_("Magnification Filter"),
- P_("The filter used when increasing the size of the content"),
- CLUTTER_TYPE_SCALING_FILTER,
- CLUTTER_SCALING_FILTER_LINEAR,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterActor:content-repeat:
- *
- * The repeat policy for the actor's #ClutterActor:content.
- *
- * Since: 1.12
- */
- obj_props[PROP_CONTENT_REPEAT] =
- g_param_spec_flags ("content-repeat",
- P_("Content Repeat"),
- P_("The repeat policy for the actor's content"),
- CLUTTER_TYPE_CONTENT_REPEAT,
- CLUTTER_REPEAT_NONE,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_EXPLICIT_NOTIFY);
-
- g_object_class_install_properties (object_class, PROP_LAST, obj_props);
-
- /**
- * ClutterActor::destroy:
- * @actor: the #ClutterActor which emitted the signal
- *
- * The ::destroy signal notifies that all references held on the
- * actor which emitted it should be released.
- *
- * The ::destroy signal should be used by all holders of a reference
- * on @actor.
- *
- * This signal might result in the finalization of the #ClutterActor
- * if all references are released.
- *
- * Composite actors and actors implementing the #ClutterContainer
- * interface should override the default implementation of the
- * class handler of this signal and call clutter_actor_destroy() on
- * their children. When overriding the default class handler, it is
- * required to chain up to the parent's implementation.
- *
- * Since: 0.2
- */
- actor_signals[DESTROY] =
- g_signal_new (I_("destroy"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_CLEANUP | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS,
- G_STRUCT_OFFSET (ClutterActorClass, destroy),
- NULL, NULL, NULL,
- G_TYPE_NONE, 0);
- /**
- * ClutterActor::show:
- * @actor: the object which received the signal
- *
- * The ::show signal is emitted when an actor is visible and
- * rendered on the stage.
- *
- * Since: 0.2
- */
- actor_signals[SHOW] =
- g_signal_new (I_("show"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (ClutterActorClass, show),
- NULL, NULL, NULL,
- G_TYPE_NONE, 0);
- /**
- * ClutterActor::hide:
- * @actor: the object which received the signal
- *
- * The ::hide signal is emitted when an actor is no longer rendered
- * on the stage.
- *
- * Since: 0.2
- */
- actor_signals[HIDE] =
- g_signal_new (I_("hide"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (ClutterActorClass, hide),
- NULL, NULL, NULL,
- G_TYPE_NONE, 0);
- /**
- * ClutterActor::parent-set:
- * @actor: the object which received the signal
- * @old_parent: (allow-none): the previous parent of the actor, or %NULL
- *
- * This signal is emitted when the parent of the actor changes.
- *
- * Since: 0.2
- */
- actor_signals[PARENT_SET] =
- g_signal_new (I_("parent-set"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterActorClass, parent_set),
- NULL, NULL, NULL,
- G_TYPE_NONE, 1,
- CLUTTER_TYPE_ACTOR);
-
- /**
- * ClutterActor::queue-relayout:
- * @actor: the actor being queued for relayout
- *
- * The ::queue_layout signal is emitted when clutter_actor_queue_relayout()
- * is called on an actor.
- *
- * The default implementation for #ClutterActor chains up to the
- * parent actor and queues a relayout on the parent, thus "bubbling"
- * the relayout queue up through the actor graph.
- *
- * The main purpose of this signal is to allow relayout to be propagated
- * properly in the procense of #ClutterClone actors. Applications will
- * not normally need to connect to this signal.
- *
- * Since: 1.2
- */
- actor_signals[QUEUE_RELAYOUT] =
- g_signal_new (I_("queue-relayout"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST |
- G_SIGNAL_NO_HOOKS,
- G_STRUCT_OFFSET (ClutterActorClass, queue_relayout),
- NULL, NULL, NULL,
- G_TYPE_NONE, 0);
-
- /**
- * ClutterActor::event:
- * @actor: the actor which received the event
- * @event: a #ClutterEvent
- *
- * The ::event signal is emitted each time an event is received
- * by the @actor. This signal will be emitted on every actor,
- * following the hierarchy chain, until it reaches the top-level
- * container (the #ClutterStage).
- *
- * Return value: %TRUE if the event has been handled by the actor,
- * or %FALSE to continue the emission.
- *
- * Since: 0.6
- */
- actor_signals[EVENT] =
- g_signal_new (I_("event"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterActorClass, event),
- _clutter_boolean_handled_accumulator, NULL,
- _clutter_marshal_BOOLEAN__BOXED,
- G_TYPE_BOOLEAN, 1,
- CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
- g_signal_set_va_marshaller (actor_signals[EVENT],
- G_TYPE_FROM_CLASS (object_class),
- _clutter_marshal_BOOLEAN__BOXEDv);
- /**
- * ClutterActor::button-press-event:
- * @actor: the actor which received the event
- * @event: (type ClutterButtonEvent): a #ClutterButtonEvent
- *
- * The ::button-press-event signal is emitted each time a mouse button
- * is pressed on @actor.
- *
- * Return value: %TRUE if the event has been handled by the actor,
- * or %FALSE to continue the emission.
- *
- * Since: 0.6
- */
- actor_signals[BUTTON_PRESS_EVENT] =
- g_signal_new (I_("button-press-event"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterActorClass, button_press_event),
- _clutter_boolean_handled_accumulator, NULL,
- _clutter_marshal_BOOLEAN__BOXED,
- G_TYPE_BOOLEAN, 1,
- CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
- g_signal_set_va_marshaller (actor_signals[BUTTON_PRESS_EVENT],
- G_TYPE_FROM_CLASS (object_class),
- _clutter_marshal_BOOLEAN__BOXEDv);
- /**
- * ClutterActor::button-release-event:
- * @actor: the actor which received the event
- * @event: (type ClutterButtonEvent): a #ClutterButtonEvent
- *
- * The ::button-release-event signal is emitted each time a mouse button
- * is released on @actor.
- *
- * Return value: %TRUE if the event has been handled by the actor,
- * or %FALSE to continue the emission.
- *
- * Since: 0.6
- */
- actor_signals[BUTTON_RELEASE_EVENT] =
- g_signal_new (I_("button-release-event"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterActorClass, button_release_event),
- _clutter_boolean_handled_accumulator, NULL,
- _clutter_marshal_BOOLEAN__BOXED,
- G_TYPE_BOOLEAN, 1,
- CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
- g_signal_set_va_marshaller (actor_signals[BUTTON_RELEASE_EVENT],
- G_TYPE_FROM_CLASS (object_class),
- _clutter_marshal_BOOLEAN__BOXEDv);
- /**
- * ClutterActor::scroll-event:
- * @actor: the actor which received the event
- * @event: (type ClutterScrollEvent): a #ClutterScrollEvent
- *
- * The ::scroll-event signal is emitted each time the mouse is
- * scrolled on @actor
- *
- * Return value: %TRUE if the event has been handled by the actor,
- * or %FALSE to continue the emission.
- *
- * Since: 0.6
- */
- actor_signals[SCROLL_EVENT] =
- g_signal_new (I_("scroll-event"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterActorClass, scroll_event),
- _clutter_boolean_handled_accumulator, NULL,
- _clutter_marshal_BOOLEAN__BOXED,
- G_TYPE_BOOLEAN, 1,
- CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
- g_signal_set_va_marshaller (actor_signals[SCROLL_EVENT],
- G_TYPE_FROM_CLASS (object_class),
- _clutter_marshal_BOOLEAN__BOXEDv);
- /**
- * ClutterActor::key-press-event:
- * @actor: the actor which received the event
- * @event: (type ClutterKeyEvent): a #ClutterKeyEvent
- *
- * The ::key-press-event signal is emitted each time a keyboard button
- * is pressed while @actor has key focus (see clutter_stage_set_key_focus()).
- *
- * Return value: %TRUE if the event has been handled by the actor,
- * or %FALSE to continue the emission.
- *
- * Since: 0.6
- */
- actor_signals[KEY_PRESS_EVENT] =
- g_signal_new (I_("key-press-event"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterActorClass, key_press_event),
- _clutter_boolean_handled_accumulator, NULL,
- _clutter_marshal_BOOLEAN__BOXED,
- G_TYPE_BOOLEAN, 1,
- CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
- g_signal_set_va_marshaller (actor_signals[KEY_PRESS_EVENT],
- G_TYPE_FROM_CLASS (object_class),
- _clutter_marshal_BOOLEAN__BOXEDv);
- /**
- * ClutterActor::key-release-event:
- * @actor: the actor which received the event
- * @event: (type ClutterKeyEvent): a #ClutterKeyEvent
- *
- * The ::key-release-event signal is emitted each time a keyboard button
- * is released while @actor has key focus (see
- * clutter_stage_set_key_focus()).
- *
- * Return value: %TRUE if the event has been handled by the actor,
- * or %FALSE to continue the emission.
- *
- * Since: 0.6
- */
- actor_signals[KEY_RELEASE_EVENT] =
- g_signal_new (I_("key-release-event"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterActorClass, key_release_event),
- _clutter_boolean_handled_accumulator, NULL,
- _clutter_marshal_BOOLEAN__BOXED,
- G_TYPE_BOOLEAN, 1,
- CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
- g_signal_set_va_marshaller (actor_signals[KEY_RELEASE_EVENT],
- G_TYPE_FROM_CLASS (object_class),
- _clutter_marshal_BOOLEAN__BOXEDv);
- /**
- * ClutterActor::motion-event:
- * @actor: the actor which received the event
- * @event: (type ClutterMotionEvent): a #ClutterMotionEvent
- *
- * The ::motion-event signal is emitted each time the mouse pointer is
- * moved over @actor.
- *
- * Return value: %TRUE if the event has been handled by the actor,
- * or %FALSE to continue the emission.
- *
- * Since: 0.6
- */
- actor_signals[MOTION_EVENT] =
- g_signal_new (I_("motion-event"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterActorClass, motion_event),
- _clutter_boolean_handled_accumulator, NULL,
- _clutter_marshal_BOOLEAN__BOXED,
- G_TYPE_BOOLEAN, 1,
- CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
- g_signal_set_va_marshaller (actor_signals[MOTION_EVENT],
- G_TYPE_FROM_CLASS (object_class),
- _clutter_marshal_BOOLEAN__BOXEDv);
-
- /**
- * ClutterActor::key-focus-in:
- * @actor: the actor which now has key focus
- *
- * The ::key-focus-in signal is emitted when @actor receives key focus.
- *
- * Since: 0.6
- */
- actor_signals[KEY_FOCUS_IN] =
- g_signal_new (I_("key-focus-in"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterActorClass, key_focus_in),
- NULL, NULL, NULL,
- G_TYPE_NONE, 0);
-
- /**
- * ClutterActor::key-focus-out:
- * @actor: the actor which now has key focus
- *
- * The ::key-focus-out signal is emitted when @actor loses key focus.
- *
- * Since: 0.6
- */
- actor_signals[KEY_FOCUS_OUT] =
- g_signal_new (I_("key-focus-out"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterActorClass, key_focus_out),
- NULL, NULL, NULL,
- G_TYPE_NONE, 0);
-
- /**
- * ClutterActor::enter-event:
- * @actor: the actor which the pointer has entered.
- * @event: (type ClutterCrossingEvent): a #ClutterCrossingEvent
- *
- * The ::enter-event signal is emitted when the pointer enters the @actor
- *
- * Return value: %TRUE if the event has been handled by the actor,
- * or %FALSE to continue the emission.
- *
- * Since: 0.6
- */
- actor_signals[ENTER_EVENT] =
- g_signal_new (I_("enter-event"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterActorClass, enter_event),
- _clutter_boolean_handled_accumulator, NULL,
- _clutter_marshal_BOOLEAN__BOXED,
- G_TYPE_BOOLEAN, 1,
- CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
- g_signal_set_va_marshaller (actor_signals[ENTER_EVENT],
- G_TYPE_FROM_CLASS (object_class),
- _clutter_marshal_BOOLEAN__BOXEDv);
-
- /**
- * ClutterActor::leave-event:
- * @actor: the actor which the pointer has left
- * @event: (type ClutterCrossingEvent): a #ClutterCrossingEvent
- *
- * The ::leave-event signal is emitted when the pointer leaves the @actor.
- *
- * Return value: %TRUE if the event has been handled by the actor,
- * or %FALSE to continue the emission.
- *
- * Since: 0.6
- */
- actor_signals[LEAVE_EVENT] =
- g_signal_new (I_("leave-event"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterActorClass, leave_event),
- _clutter_boolean_handled_accumulator, NULL,
- _clutter_marshal_BOOLEAN__BOXED,
- G_TYPE_BOOLEAN, 1,
- CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
- g_signal_set_va_marshaller (actor_signals[LEAVE_EVENT],
- G_TYPE_FROM_CLASS (object_class),
- _clutter_marshal_BOOLEAN__BOXEDv);
-
- /**
- * ClutterActor::captured-event:
- * @actor: the actor which received the signal
- * @event: a #ClutterEvent
- *
- * The ::captured-event signal is emitted when an event is captured
- * by Clutter. This signal will be emitted starting from the top-level
- * container (the #ClutterStage) to the actor which received the event
- * going down the hierarchy. This signal can be used to intercept every
- * event before the specialized events (like
- * ClutterActor::button-press-event or ::key-released-event) are
- * emitted.
- *
- * Return value: %TRUE if the event has been handled by the actor,
- * or %FALSE to continue the emission.
- *
- * Since: 0.6
- */
- actor_signals[CAPTURED_EVENT] =
- g_signal_new (I_("captured-event"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
- G_STRUCT_OFFSET (ClutterActorClass, captured_event),
- _clutter_boolean_handled_accumulator, NULL,
- _clutter_marshal_BOOLEAN__BOXED,
- G_TYPE_BOOLEAN, 1,
- CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
- g_signal_set_va_marshaller (actor_signals[CAPTURED_EVENT],
- G_TYPE_FROM_CLASS (object_class),
- _clutter_marshal_BOOLEAN__BOXEDv);
-
- /**
- * ClutterActor::realize:
- * @actor: the #ClutterActor that received the signal
- *
- * The ::realize signal is emitted each time an actor is being
- * realized.
- *
- * Since: 0.8
- *
- * Deprecated: 1.16: The signal should not be used in newly
- * written code
- */
- actor_signals[REALIZE] =
- g_signal_new (I_("realize"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_DEPRECATED,
- G_STRUCT_OFFSET (ClutterActorClass, realize),
- NULL, NULL, NULL,
- G_TYPE_NONE, 0);
- /**
- * ClutterActor::unrealize:
- * @actor: the #ClutterActor that received the signal
- *
- * The ::unrealize signal is emitted each time an actor is being
- * unrealized.
- *
- * Since: 0.8
- *
- * Deprecated: 1.16: The signal should not be used in newly
- * written code
- */
- actor_signals[UNREALIZE] =
- g_signal_new (I_("unrealize"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_DEPRECATED,
- G_STRUCT_OFFSET (ClutterActorClass, unrealize),
- NULL, NULL, NULL,
- G_TYPE_NONE, 0);
-
- /**
- * ClutterActor::pick:
- * @actor: the #ClutterActor that received the signal
- * @pick_context: a #ClutterPickContext
- *
- * The ::pick signal is emitted each time an actor is being painted
- * in "pick mode". The pick mode is used to identify the actor during
- * the event handling phase, or by clutter_stage_get_actor_at_pos().
- *
- * Subclasses of #ClutterActor should override the class signal handler
- * and paint themselves in that function.
- *
- * It is possible to connect a handler to the ::pick signal in order
- * to set up some custom aspect of a paint in pick mode.
- *
- * Since: 1.0
- * Deprecated: 1.12: Override the #ClutterActorClass.pick virtual function
- * instead.
- */
- actor_signals[PICK] =
- g_signal_new (I_("pick"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_DEPRECATED,
- G_STRUCT_OFFSET (ClutterActorClass, pick),
- NULL, NULL, NULL,
- G_TYPE_NONE, 1,
- CLUTTER_TYPE_PICK_CONTEXT);
-
- /**
- * ClutterActor::transitions-completed:
- * @actor: a #ClutterActor
- *
- * The ::transitions-completed signal is emitted once all transitions
- * involving @actor are complete.
- *
- * Since: 1.10
- */
- actor_signals[TRANSITIONS_COMPLETED] =
- g_signal_new (I_("transitions-completed"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL, NULL,
- G_TYPE_NONE, 0);
-
- /**
- * ClutterActor::transition-stopped:
- * @actor: a #ClutterActor
- * @name: the name of the transition
- * @is_finished: whether the transition was finished, or stopped
- *
- * The ::transition-stopped signal is emitted once a transition
- * is stopped; a transition is stopped once it reached its total
- * duration (including eventual repeats), it has been stopped
- * using clutter_timeline_stop(), or it has been removed from the
- * transitions applied on @actor, using clutter_actor_remove_transition().
- *
- * Since: 1.12
- */
- actor_signals[TRANSITION_STOPPED] =
- g_signal_new (I_("transition-stopped"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE |
- G_SIGNAL_NO_HOOKS | G_SIGNAL_DETAILED,
- 0,
- NULL, NULL,
- _clutter_marshal_VOID__STRING_BOOLEAN,
- G_TYPE_NONE, 2,
- G_TYPE_STRING,
- G_TYPE_BOOLEAN);
- g_signal_set_va_marshaller (actor_signals[TRANSITION_STOPPED],
- G_TYPE_FROM_CLASS (object_class),
- _clutter_marshal_VOID__STRING_BOOLEANv);
-
- /**
- * ClutterActor::touch-event:
- * @actor: a #ClutterActor
- * @event: a #ClutterEvent
- *
- * The ::touch-event signal is emitted each time a touch
- * begin/end/update/cancel event.
- *
- * Return value: %CLUTTER_EVENT_STOP if the event has been handled by
- * the actor, or %CLUTTER_EVENT_PROPAGATE to continue the emission.
- *
- * Since: 1.12
- */
- actor_signals[TOUCH_EVENT] =
- g_signal_new (I_("touch-event"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterActorClass, touch_event),
- _clutter_boolean_handled_accumulator, NULL,
- _clutter_marshal_BOOLEAN__BOXED,
- G_TYPE_BOOLEAN, 1,
- CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
- g_signal_set_va_marshaller (actor_signals[TOUCH_EVENT],
- G_TYPE_FROM_CLASS (object_class),
- _clutter_marshal_BOOLEAN__BOXEDv);
-
- /**
- * ClutterActor::stage-views-changed:
- * @actor: a #ClutterActor
- *
- * The ::stage-views-changed signal is emitted when the position or
- * size an actor is being painted at have changed so that it's visible
- * on different stage views.
- *
- * This signal is also emitted when the actor gets detached from the stage
- * or when the views of the stage have been invalidated and will be
- * replaced; it's not emitted when the actor gets hidden.
- */
- actor_signals[STAGE_VIEWS_CHANGED] =
- g_signal_new (I_("stage-views-changed"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL, NULL,
- G_TYPE_NONE, 0);
-
- /**
- * ClutterActor::resource-scale-changed:
- * @actor: a #ClutterActor
- *
- * The ::resource-scale-changed signal is emitted when the resource scale
- * value returned by clutter_actor_get_resource_scale() changes.
- *
- * This signal can be used to get notified about the correct resource scale
- * when the scale had to be queried outside of the paint cycle.
- */
- actor_signals[RESOURCE_SCALE_CHANGED] =
- g_signal_new (I_("resource-scale-changed"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterActorClass, resource_scale_changed),
- NULL, NULL, NULL,
- G_TYPE_NONE, 0);
-}
-
-static void
-clutter_actor_init (ClutterActor *self)
-{
- ClutterActorPrivate *priv;
-
- self->priv = priv = clutter_actor_get_instance_private (self);
-
- priv->allocation = (ClutterActorBox) CLUTTER_ACTOR_BOX_UNINITIALIZED;
-
- priv->opacity = 0xff;
- priv->show_on_set_parent = TRUE;
- priv->resource_scale = -1.0f;
-
- priv->needs_width_request = TRUE;
- priv->needs_height_request = TRUE;
- priv->needs_allocation = TRUE;
- priv->needs_paint_volume_update = TRUE;
- priv->needs_update_stage_views = TRUE;
-
- priv->cached_width_age = 1;
- priv->cached_height_age = 1;
-
- priv->opacity_override = -1;
- priv->enable_model_view_transform = TRUE;
-
- /* Initialize an empty paint volume to start with */
- _clutter_paint_volume_init_static (&priv->last_paint_volume, NULL);
- priv->last_paint_volume_valid = TRUE;
-
- priv->transform_valid = FALSE;
-
- /* the default is to stretch the content, to match the
- * current behaviour of basically all actors. also, it's
- * the easiest thing to compute.
- */
- priv->content_gravity = CLUTTER_CONTENT_GRAVITY_RESIZE_FILL;
- priv->min_filter = CLUTTER_SCALING_FILTER_LINEAR;
- priv->mag_filter = CLUTTER_SCALING_FILTER_LINEAR;
-
- /* this flag will be set to TRUE if the actor gets a child
- * or if the [xy]-expand flags are explicitly set; until
- * then, the actor does not need to expand.
- *
- * this also allows us to avoid computing the expand flag
- * when building up a scene.
- */
- priv->needs_compute_expand = FALSE;
-
- /* we start with an easing state with duration forcibly set
- * to 0, for backward compatibility.
- */
- clutter_actor_save_easing_state (self);
- clutter_actor_set_easing_duration (self, 0);
-}
-
-/**
- * clutter_actor_new:
- *
- * Creates a new #ClutterActor.
- *
- * A newly created actor has a floating reference, which will be sunk
- * when it is added to another actor.
- *
- * Return value: the newly created #ClutterActor
- *
- * Since: 1.10
- */
-ClutterActor *
-clutter_actor_new (void)
-{
- return g_object_new (CLUTTER_TYPE_ACTOR, NULL);
-}
-
-/**
- * clutter_actor_destroy:
- * @self: a #ClutterActor
- *
- * Destroys an actor. When an actor is destroyed, it will break any
- * references it holds to other objects. If the actor is inside a
- * container, the actor will be removed.
- *
- * When you destroy a container, its children will be destroyed as well.
- */
-void
-clutter_actor_destroy (ClutterActor *self)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- g_object_ref (self);
-
- /* avoid recursion while destroying */
- if (!CLUTTER_ACTOR_IN_DESTRUCTION (self))
- {
- CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IN_DESTRUCTION);
-
- g_object_run_dispose (G_OBJECT (self));
-
- CLUTTER_UNSET_PRIVATE_FLAGS (self, CLUTTER_IN_DESTRUCTION);
- }
-
- g_object_unref (self);
-}
-
-void
-_clutter_actor_queue_redraw_full (ClutterActor *self,
- const ClutterPaintVolume *volume,
- ClutterEffect *effect)
-{
- ClutterActorPrivate *priv = self->priv;
- ClutterActor *stage;
-
- /* Here's an outline of the actor queue redraw mechanism:
- *
- * The process starts in clutter_actor_queue_redraw() which is a
- * wrapper for this function. Additionally, an effect can queue a
- * redraw by wrapping this function in clutter_effect_queue_repaint().
- *
- * This functions queues an entry in a list associated with the
- * stage which is a list of actors that queued a redraw while
- * updating the timelines, performing layouting and processing other
- * mainloop sources before the next paint starts.
- *
- * When all updates are complete and we come to paint the stage then
- * we iterate this list and build the redraw clip of the stage by
- * either using the clip that was supplied to
- * _clutter_actor_queue_redraw_full() or by asking the actor for its
- * redraw clip using clutter_actor_get_redraw_clip().
- *
- * Doing this later during the stage update instead of now is an
- * important optimization, because later it's more likely we will be
- * able to determine the paint volume of an actor (its allocation
- * should be up to date).
- */
-
- /* ignore queueing a redraw for actors being destroyed */
- if (CLUTTER_ACTOR_IN_DESTRUCTION (self))
- return;
-
- /* we can ignore unmapped actors, unless they are inside a cloned branch
- * of the scene graph, as unmapped actors will simply be left unpainted.
- *
- * this allows us to ignore redraws queued on leaf nodes when one
- * of their parents has been hidden
- */
- if (!CLUTTER_ACTOR_IS_MAPPED (self) &&
- !clutter_actor_has_mapped_clones (self))
- {
- CLUTTER_NOTE (PAINT,
- "Skipping queue_redraw('%s'): mapped=%s, "
- "has_mapped_clones=%s",
- _clutter_actor_get_debug_name (self),
- CLUTTER_ACTOR_IS_MAPPED (self) ? "yes" : "no",
- clutter_actor_has_mapped_clones (self) ? "yes" : "no");
- return;
- }
-
- /* given the check above we could end up queueing a redraw on an
- * unmapped actor with mapped clones, so we cannot assume that
- * get_stage() will return a Stage
- */
- stage = _clutter_actor_get_stage_internal (self);
- if (stage == NULL)
- return;
-
- /* ignore queueing a redraw on stages that are being destroyed */
- if (CLUTTER_ACTOR_IN_DESTRUCTION (stage))
- return;
-
- clutter_stage_queue_actor_redraw (CLUTTER_STAGE (stage),
- self,
- volume);
-
- /* If this is the first redraw queued then we can directly use the
- effect parameter */
- if (!priv->is_dirty)
- priv->effect_to_redraw = effect;
- /* Otherwise we need to merge it with the existing effect parameter */
- else if (effect != NULL)
- {
- /* If there's already an effect then we need to use whichever is
- later in the chain of actors. Otherwise a full redraw has
- already been queued on the actor so we need to ignore the
- effect parameter */
- if (priv->effect_to_redraw != NULL)
- {
- if (priv->effects == NULL)
- g_warning ("Redraw queued with an effect that is "
- "not applied to the actor");
- else
- {
- const GList *l;
-
- for (l = _clutter_meta_group_peek_metas (priv->effects);
- l != NULL;
- l = l->next)
- {
- if (l->data == priv->effect_to_redraw ||
- l->data == effect)
- priv->effect_to_redraw = l->data;
- }
- }
- }
- }
- else
- {
- /* If no effect is specified then we need to redraw the whole
- actor */
- priv->effect_to_redraw = NULL;
- }
-
- priv->is_dirty = TRUE;
-
- if (!priv->propagated_one_redraw)
- _clutter_actor_propagate_queue_redraw (self, self);
-}
-
-/**
- * clutter_actor_queue_redraw:
- * @self: A #ClutterActor
- *
- * Queues up a redraw of an actor and any children. The redraw occurs
- * once the main loop becomes idle (after the current batch of events
- * has been processed, roughly).
- *
- * Applications rarely need to call this, as redraws are handled
- * automatically by modification functions.
- *
- * This function will not do anything if @self is not visible, or
- * if the actor is inside an invisible part of the scenegraph.
- *
- * Also be aware that painting is a NOP for actors with an opacity of
- * 0
- *
- * When you are implementing a custom actor you must queue a redraw
- * whenever some private state changes that will affect painting or
- * picking of your actor.
- */
-void
-clutter_actor_queue_redraw (ClutterActor *self)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- _clutter_actor_queue_redraw_full (self,
- NULL, /* clip volume */
- NULL /* effect */);
-}
-
-static void
-_clutter_actor_queue_relayout_on_clones (ClutterActor *self)
-{
- ClutterActorPrivate *priv = self->priv;
- GHashTableIter iter;
- gpointer key;
-
- if (priv->clones == NULL)
- return;
-
- g_hash_table_iter_init (&iter, priv->clones);
- while (g_hash_table_iter_next (&iter, &key, NULL))
- clutter_actor_queue_relayout (key);
-}
-
-void
-_clutter_actor_queue_only_relayout (ClutterActor *self)
-{
- ClutterActorPrivate *priv = self->priv;
-
- if (CLUTTER_ACTOR_IN_DESTRUCTION (self))
- return;
-
- if (priv->needs_width_request &&
- priv->needs_height_request &&
- priv->needs_allocation)
- return; /* save some cpu cycles */
-
-#ifdef CLUTTER_ENABLE_DEBUG
- if (!CLUTTER_ACTOR_IS_TOPLEVEL (self) && CLUTTER_ACTOR_IN_RELAYOUT (self))
- {
- g_warning ("The actor '%s' is currently inside an allocation "
- "cycle; calling clutter_actor_queue_relayout() is "
- "not recommended",
- _clutter_actor_get_debug_name (self));
- }
-#endif /* CLUTTER_ENABLE_DEBUG */
-
- _clutter_actor_queue_relayout_on_clones (self);
-
- g_signal_emit (self, actor_signals[QUEUE_RELAYOUT], 0);
-}
-
-/**
- * clutter_actor_queue_redraw_with_clip:
- * @self: a #ClutterActor
- * @clip: (allow-none): a rectangular clip region, or %NULL
- *
- * Queues a redraw on @self limited to a specific, actor-relative
- * rectangular area.
- *
- * If @clip is %NULL this function is equivalent to
- * clutter_actor_queue_redraw().
- *
- * Since: 1.10
- */
-void
-clutter_actor_queue_redraw_with_clip (ClutterActor *self,
- const cairo_rectangle_int_t *clip)
-{
- ClutterPaintVolume volume;
- graphene_point3d_t origin;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- if (clip == NULL)
- {
- clutter_actor_queue_redraw (self);
- return;
- }
-
- _clutter_paint_volume_init_static (&volume, self);
-
- origin.x = clip->x;
- origin.y = clip->y;
- origin.z = 0.0f;
-
- clutter_paint_volume_set_origin (&volume, &origin);
- clutter_paint_volume_set_width (&volume, clip->width);
- clutter_paint_volume_set_height (&volume, clip->height);
-
- _clutter_actor_queue_redraw_full (self, &volume, NULL);
-
- clutter_paint_volume_free (&volume);
-}
-
-/**
- * clutter_actor_queue_relayout:
- * @self: A #ClutterActor
- *
- * Indicates that the actor's size request or other layout-affecting
- * properties may have changed. This function is used inside #ClutterActor
- * subclass implementations, not by applications directly.
- *
- * Queueing a new layout automatically queues a redraw as well.
- *
- * Since: 0.8
- */
-void
-clutter_actor_queue_relayout (ClutterActor *self)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- _clutter_actor_queue_only_relayout (self);
- clutter_actor_queue_redraw (self);
-}
-
-/**
- * clutter_actor_get_preferred_size:
- * @self: a #ClutterActor
- * @min_width_p: (out) (allow-none): return location for the minimum
- * width, or %NULL
- * @min_height_p: (out) (allow-none): return location for the minimum
- * height, or %NULL
- * @natural_width_p: (out) (allow-none): return location for the natural
- * width, or %NULL
- * @natural_height_p: (out) (allow-none): return location for the natural
- * height, or %NULL
- *
- * Computes the preferred minimum and natural size of an actor, taking into
- * account the actor's geometry management (either height-for-width
- * or width-for-height).
- *
- * The width and height used to compute the preferred height and preferred
- * width are the actor's natural ones.
- *
- * If you need to control the height for the preferred width, or the width for
- * the preferred height, you should use clutter_actor_get_preferred_width()
- * and clutter_actor_get_preferred_height(), and check the actor's preferred
- * geometry management using the #ClutterActor:request-mode property.
- *
- * Since: 0.8
- */
-void
-clutter_actor_get_preferred_size (ClutterActor *self,
- gfloat *min_width_p,
- gfloat *min_height_p,
- gfloat *natural_width_p,
- gfloat *natural_height_p)
-{
- ClutterActorPrivate *priv;
- gfloat min_width, min_height;
- gfloat natural_width, natural_height;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- priv = self->priv;
-
- min_width = min_height = 0;
- natural_width = natural_height = 0;
-
- if (priv->request_mode == CLUTTER_REQUEST_HEIGHT_FOR_WIDTH)
- {
- CLUTTER_NOTE (LAYOUT, "Preferred size (height-for-width)");
- clutter_actor_get_preferred_width (self, -1,
- &min_width,
- &natural_width);
- clutter_actor_get_preferred_height (self, natural_width,
- &min_height,
- &natural_height);
- }
- else if (priv->request_mode == CLUTTER_REQUEST_WIDTH_FOR_HEIGHT)
- {
- CLUTTER_NOTE (LAYOUT, "Preferred size (width-for-height)");
- clutter_actor_get_preferred_height (self, -1,
- &min_height,
- &natural_height);
- clutter_actor_get_preferred_width (self, natural_height,
- &min_width,
- &natural_width);
- }
- else if (priv->request_mode == CLUTTER_REQUEST_CONTENT_SIZE)
- {
- CLUTTER_NOTE (LAYOUT, "Preferred size (content-size)");
-
- if (priv->content != NULL)
- clutter_content_get_preferred_size (priv->content, &natural_width, &natural_height);
- }
- else
- {
- CLUTTER_NOTE (LAYOUT, "Unknown request mode");
- }
-
- if (min_width_p)
- *min_width_p = min_width;
-
- if (min_height_p)
- *min_height_p = min_height;
-
- if (natural_width_p)
- *natural_width_p = natural_width;
-
- if (natural_height_p)
- *natural_height_p = natural_height;
-}
-
-/*< private >
- * effective_align:
- * @align: a #ClutterActorAlign
- * @direction: a #ClutterTextDirection
- *
- * Retrieves the correct alignment depending on the text direction
- *
- * Return value: the effective alignment
- */
-static ClutterActorAlign
-effective_align (ClutterActorAlign align,
- ClutterTextDirection direction)
-{
- ClutterActorAlign res;
-
- switch (align)
- {
- case CLUTTER_ACTOR_ALIGN_START:
- res = (direction == CLUTTER_TEXT_DIRECTION_RTL)
- ? CLUTTER_ACTOR_ALIGN_END
- : CLUTTER_ACTOR_ALIGN_START;
- break;
-
- case CLUTTER_ACTOR_ALIGN_END:
- res = (direction == CLUTTER_TEXT_DIRECTION_RTL)
- ? CLUTTER_ACTOR_ALIGN_START
- : CLUTTER_ACTOR_ALIGN_END;
- break;
-
- default:
- res = align;
- break;
- }
-
- return res;
-}
-
-/*< private >
- * _clutter_actor_get_effective_x_align:
- * @self: a #ClutterActor
- *
- * Retrieves the effective horizontal alignment, taking into
- * consideration the text direction of @self.
- *
- * Return value: the effective horizontal alignment
- */
-ClutterActorAlign
-_clutter_actor_get_effective_x_align (ClutterActor *self)
-{
- return effective_align (clutter_actor_get_x_align (self),
- clutter_actor_get_text_direction (self));
-}
-
-static inline void
-adjust_for_margin (float margin_start,
- float margin_end,
- float *minimum_size,
- float *natural_size,
- float *allocated_start,
- float *allocated_end)
-{
- float min_size = *minimum_size;
- float nat_size = *natural_size;
- float start = *allocated_start;
- float end = *allocated_end;
-
- min_size = MAX (min_size - (margin_start + margin_end), 0);
- nat_size = MAX (nat_size - (margin_start + margin_end), 0);
-
- *minimum_size = min_size;
- *natural_size = nat_size;
-
- start += margin_start;
- end -= margin_end;
-
- if (end - start >= 0)
- {
- *allocated_start = start;
- *allocated_end = end;
- }
-}
-
-static inline void
-adjust_for_alignment (ClutterActorAlign alignment,
- float natural_size,
- float *allocated_start,
- float *allocated_end)
-{
- float allocated_size = *allocated_end - *allocated_start;
-
- if (allocated_size <= 0.f)
- return;
-
- switch (alignment)
- {
- case CLUTTER_ACTOR_ALIGN_FILL:
- /* do nothing */
- break;
-
- case CLUTTER_ACTOR_ALIGN_START:
- /* keep start */
- *allocated_end = *allocated_start + MIN (natural_size, allocated_size);
- break;
-
- case CLUTTER_ACTOR_ALIGN_END:
- if (allocated_size > natural_size)
- {
- *allocated_start += (allocated_size - natural_size);
- *allocated_end = *allocated_start + natural_size;
- }
- break;
-
- case CLUTTER_ACTOR_ALIGN_CENTER:
- if (allocated_size > natural_size)
- {
- *allocated_start += floorf ((allocated_size - natural_size) / 2);
- *allocated_end = *allocated_start + MIN (allocated_size, natural_size);
- }
- break;
- }
-}
-
-/*< private >
- * clutter_actor_adjust_width:
- * @self: a #ClutterActor
- * @minimum_width: (inout): the actor's preferred minimum width, which
- * will be adjusted depending on the margin
- * @natural_width: (inout): the actor's preferred natural width, which
- * will be adjusted depending on the margin
- * @adjusted_x1: (out): the adjusted x1 for the actor's bounding box
- * @adjusted_x2: (out): the adjusted x2 for the actor's bounding box
- *
- * Adjusts the preferred and allocated position and size of an actor,
- * depending on the margin and alignment properties.
- */
-static void
-clutter_actor_adjust_width (ClutterActor *self,
- gfloat *minimum_width,
- gfloat *natural_width,
- gfloat *adjusted_x1,
- gfloat *adjusted_x2)
-{
- ClutterTextDirection text_dir;
- const ClutterLayoutInfo *info;
-
- info = _clutter_actor_get_layout_info_or_defaults (self);
- text_dir = clutter_actor_get_text_direction (self);
-
- CLUTTER_NOTE (LAYOUT, "Adjusting allocated X and width");
-
- /* this will tweak natural_width to remove the margin, so that
- * adjust_for_alignment() will use the correct size
- */
- adjust_for_margin (info->margin.left, info->margin.right,
- minimum_width, natural_width,
- adjusted_x1, adjusted_x2);
-
- adjust_for_alignment (effective_align (info->x_align, text_dir),
- *natural_width,
- adjusted_x1, adjusted_x2);
-}
-
-/*< private >
- * clutter_actor_adjust_height:
- * @self: a #ClutterActor
- * @minimum_height: (inout): the actor's preferred minimum height, which
- * will be adjusted depending on the margin
- * @natural_height: (inout): the actor's preferred natural height, which
- * will be adjusted depending on the margin
- * @adjusted_y1: (out): the adjusted y1 for the actor's bounding box
- * @adjusted_y2: (out): the adjusted y2 for the actor's bounding box
- *
- * Adjusts the preferred and allocated position and size of an actor,
- * depending on the margin and alignment properties.
- */
-static void
-clutter_actor_adjust_height (ClutterActor *self,
- gfloat *minimum_height,
- gfloat *natural_height,
- gfloat *adjusted_y1,
- gfloat *adjusted_y2)
-{
- const ClutterLayoutInfo *info;
-
- info = _clutter_actor_get_layout_info_or_defaults (self);
-
- CLUTTER_NOTE (LAYOUT, "Adjusting allocated Y and height");
-
- /* this will tweak natural_height to remove the margin, so that
- * adjust_for_alignment() will use the correct size
- */
- adjust_for_margin (info->margin.top, info->margin.bottom,
- minimum_height, natural_height,
- adjusted_y1,
- adjusted_y2);
-
- /* we don't use effective_align() here, because text direction
- * only affects the horizontal axis
- */
- adjust_for_alignment (info->y_align,
- *natural_height,
- adjusted_y1,
- adjusted_y2);
-
-}
-
-/* looks for a cached size request for this for_size. If not
- * found, returns the oldest entry so it can be overwritten */
-static gboolean
-_clutter_actor_get_cached_size_request (gfloat for_size,
- SizeRequest *cached_size_requests,
- SizeRequest **result)
-{
- guint i;
-
- *result = &cached_size_requests[0];
-
- for (i = 0; i < N_CACHED_SIZE_REQUESTS; i++)
- {
- SizeRequest *sr;
-
- sr = &cached_size_requests[i];
-
- if (sr->age > 0 &&
- sr->for_size == for_size)
- {
- CLUTTER_NOTE (LAYOUT, "Size cache hit for size: %.2f", for_size);
- *result = sr;
- return TRUE;
- }
- else if (sr->age < (*result)->age)
- {
- *result = sr;
- }
- }
-
- CLUTTER_NOTE (LAYOUT, "Size cache miss for size: %.2f", for_size);
-
- return FALSE;
-}
-
-static void
-clutter_actor_update_preferred_size_for_constraints (ClutterActor *self,
- ClutterOrientation direction,
- float for_size,
- float *minimum_size,
- float *natural_size)
-{
- ClutterActorPrivate *priv = self->priv;
- const GList *constraints, *l;
-
- if (priv->constraints == NULL)
- return;
-
- constraints = _clutter_meta_group_peek_metas (priv->constraints);
- for (l = constraints; l != NULL; l = l->next)
- {
- ClutterConstraint *constraint = l->data;
- ClutterActorMeta *meta = l->data;
-
- if (!clutter_actor_meta_get_enabled (meta))
- continue;
-
- clutter_constraint_update_preferred_size (constraint, self,
- direction,
- for_size,
- minimum_size,
- natural_size);
-
- CLUTTER_NOTE (LAYOUT,
- "Preferred %s of '%s' after constraint '%s': "
- "{ min:%.2f, nat:%.2f }",
- direction == CLUTTER_ORIENTATION_HORIZONTAL
- ? "width"
- : "height",
- _clutter_actor_get_debug_name (self),
- _clutter_actor_meta_get_debug_name (meta),
- *minimum_size, *natural_size);
- }
-}
-
-/**
- * clutter_actor_get_preferred_width:
- * @self: A #ClutterActor
- * @for_height: available height when computing the preferred width,
- * or a negative value to indicate that no height is defined
- * @min_width_p: (out) (allow-none): return location for minimum width,
- * or %NULL
- * @natural_width_p: (out) (allow-none): return location for the natural
- * width, or %NULL
- *
- * Computes the requested minimum and natural widths for an actor,
- * optionally depending on the specified height, or if they are
- * already computed, returns the cached values.
- *
- * An actor may not get its request - depending on the layout
- * manager that's in effect.
- *
- * A request should not incorporate the actor's scaleor translation;
- * those transformations do not affect layout, only rendering.
- *
- * Since: 0.8
- */
-void
-clutter_actor_get_preferred_width (ClutterActor *self,
- gfloat for_height,
- gfloat *min_width_p,
- gfloat *natural_width_p)
-{
- float request_min_width, request_natural_width;
- SizeRequest *cached_size_request;
- const ClutterLayoutInfo *info;
- ClutterActorPrivate *priv;
- gboolean found_in_cache;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- priv = self->priv;
-
- info = _clutter_actor_get_layout_info_or_defaults (self);
-
- /* we shortcircuit the case of a fixed size set using set_width() */
- if (priv->min_width_set && priv->natural_width_set)
- {
- if (min_width_p != NULL)
- *min_width_p = info->minimum.width + (info->margin.left + info->margin.right);
-
- if (natural_width_p != NULL)
- *natural_width_p = info->natural.width + (info->margin.left + info->margin.right);
-
- return;
- }
-
- /* if the request mode is CONTENT_SIZE we simply return the content width */
- if (priv->request_mode == CLUTTER_REQUEST_CONTENT_SIZE)
- {
- float content_width = 0.f;
-
- if (priv->content != NULL)
- clutter_content_get_preferred_size (priv->content, &content_width, NULL);
-
- if (min_width_p != NULL)
- *min_width_p = content_width;
-
- if (natural_width_p != NULL)
- *natural_width_p = content_width;
-
- return;
- }
-
- CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IN_PREF_WIDTH);
-
- /* the remaining cases are:
- *
- * - either min_width or natural_width have been set
- * - neither min_width or natural_width have been set
- *
- * in both cases, we go through the cache (and through the actor in case
- * of cache misses) and determine the authoritative value depending on
- * the *_set flags.
- */
-
- if (!priv->needs_width_request)
- {
- found_in_cache =
- _clutter_actor_get_cached_size_request (for_height,
- priv->width_requests,
- &cached_size_request);
- }
- else
- {
- /* if the actor needs a width request we use the first slot */
- found_in_cache = FALSE;
- cached_size_request = &priv->width_requests[0];
- }
-
- if (!found_in_cache)
- {
- gfloat minimum_width, natural_width;
- ClutterActorClass *klass;
-
- minimum_width = natural_width = 0;
-
- /* adjust for the margin */
- if (for_height >= 0)
- {
- for_height -= (info->margin.top + info->margin.bottom);
- if (for_height < 0)
- for_height = 0;
- }
-
- CLUTTER_NOTE (LAYOUT, "Width request for %.2f px", for_height);
-
- klass = CLUTTER_ACTOR_GET_CLASS (self);
- klass->get_preferred_width (self, for_height,
- &minimum_width,
- &natural_width);
-
- /* adjust for constraints */
- clutter_actor_update_preferred_size_for_constraints (self,
- CLUTTER_ORIENTATION_HORIZONTAL,
- for_height,
- &minimum_width,
- &natural_width);
-
- /* adjust for the margin */
- minimum_width += (info->margin.left + info->margin.right);
- natural_width += (info->margin.left + info->margin.right);
-
- /* Due to accumulated float errors, it's better not to warn
- * on this, but just fix it.
- */
- if (natural_width < minimum_width)
- natural_width = minimum_width;
-
- cached_size_request->min_size = minimum_width;
- cached_size_request->natural_size = natural_width;
- cached_size_request->for_size = for_height;
- cached_size_request->age = priv->cached_width_age;
-
- priv->cached_width_age += 1;
- priv->needs_width_request = FALSE;
- }
-
- if (!priv->min_width_set)
- request_min_width = cached_size_request->min_size;
- else
- request_min_width = info->margin.left
- + info->minimum.width
- + info->margin.right;
-
- if (!priv->natural_width_set)
- request_natural_width = cached_size_request->natural_size;
- else
- request_natural_width = info->margin.left
- + info->natural.width
- + info->margin.right;
-
- if (min_width_p)
- *min_width_p = request_min_width;
-
- if (natural_width_p)
- *natural_width_p = request_natural_width;
-
- CLUTTER_UNSET_PRIVATE_FLAGS (self, CLUTTER_IN_PREF_WIDTH);
-}
-
-/**
- * clutter_actor_get_preferred_height:
- * @self: A #ClutterActor
- * @for_width: available width to assume in computing desired height,
- * or a negative value to indicate that no width is defined
- * @min_height_p: (out) (allow-none): return location for minimum height,
- * or %NULL
- * @natural_height_p: (out) (allow-none): return location for natural
- * height, or %NULL
- *
- * Computes the requested minimum and natural heights for an actor,
- * or if they are already computed, returns the cached values.
- *
- * An actor may not get its request - depending on the layout
- * manager that's in effect.
- *
- * A request should not incorporate the actor's scale or translation;
- * those transformations do not affect layout, only rendering.
- *
- * Since: 0.8
- */
-void
-clutter_actor_get_preferred_height (ClutterActor *self,
- gfloat for_width,
- gfloat *min_height_p,
- gfloat *natural_height_p)
-{
- float request_min_height, request_natural_height;
- SizeRequest *cached_size_request;
- const ClutterLayoutInfo *info;
- ClutterActorPrivate *priv;
- gboolean found_in_cache;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- priv = self->priv;
-
- info = _clutter_actor_get_layout_info_or_defaults (self);
-
- /* we shortcircuit the case of a fixed size set using set_height() */
- if (priv->min_height_set && priv->natural_height_set)
- {
- if (min_height_p != NULL)
- *min_height_p = info->minimum.height + (info->margin.top + info->margin.bottom);
-
- if (natural_height_p != NULL)
- *natural_height_p = info->natural.height + (info->margin.top + info->margin.bottom);
-
- return;
- }
-
- /* if the request mode is CONTENT_SIZE we simply return the content height */
- if (priv->request_mode == CLUTTER_REQUEST_CONTENT_SIZE)
- {
- float content_height = 0.f;
-
- if (priv->content != NULL)
- clutter_content_get_preferred_size (priv->content, NULL, &content_height);
-
- if (min_height_p != NULL)
- *min_height_p = content_height;
-
- if (natural_height_p != NULL)
- *natural_height_p = content_height;
-
- return;
- }
-
- CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IN_PREF_HEIGHT);
-
- /* the remaining cases are:
- *
- * - either min_height or natural_height have been set
- * - neither min_height or natural_height have been set
- *
- * in both cases, we go through the cache (and through the actor in case
- * of cache misses) and determine the authoritative value depending on
- * the *_set flags.
- */
-
- if (!priv->needs_height_request)
- {
- found_in_cache =
- _clutter_actor_get_cached_size_request (for_width,
- priv->height_requests,
- &cached_size_request);
- }
- else
- {
- found_in_cache = FALSE;
- cached_size_request = &priv->height_requests[0];
- }
-
- if (!found_in_cache)
- {
- gfloat minimum_height, natural_height;
- ClutterActorClass *klass;
-
- minimum_height = natural_height = 0;
-
- CLUTTER_NOTE (LAYOUT, "Height request for %.2f px", for_width);
-
- /* adjust for margin */
- if (for_width >= 0)
- {
- for_width -= (info->margin.left + info->margin.right);
- if (for_width < 0)
- for_width = 0;
- }
-
- klass = CLUTTER_ACTOR_GET_CLASS (self);
- klass->get_preferred_height (self, for_width,
- &minimum_height,
- &natural_height);
-
- /* adjust for constraints */
- clutter_actor_update_preferred_size_for_constraints (self,
- CLUTTER_ORIENTATION_VERTICAL,
- for_width,
- &minimum_height,
- &natural_height);
-
- /* adjust for margin */
- minimum_height += (info->margin.top + info->margin.bottom);
- natural_height += (info->margin.top + info->margin.bottom);
-
- /* Due to accumulated float errors, it's better not to warn
- * on this, but just fix it.
- */
- if (natural_height < minimum_height)
- natural_height = minimum_height;
-
- cached_size_request->min_size = minimum_height;
- cached_size_request->natural_size = natural_height;
- cached_size_request->for_size = for_width;
- cached_size_request->age = priv->cached_height_age;
-
- priv->cached_height_age += 1;
- priv->needs_height_request = FALSE;
- }
-
- if (!priv->min_height_set)
- request_min_height = cached_size_request->min_size;
- else
- request_min_height = info->margin.top
- + info->minimum.height
- + info->margin.bottom;
-
- if (!priv->natural_height_set)
- request_natural_height = cached_size_request->natural_size;
- else
- request_natural_height = info->margin.top
- + info->natural.height
- + info->margin.bottom;
-
- if (min_height_p)
- *min_height_p = request_min_height;
-
- if (natural_height_p)
- *natural_height_p = request_natural_height;
-
- CLUTTER_UNSET_PRIVATE_FLAGS (self, CLUTTER_IN_PREF_HEIGHT);
-}
-
-/**
- * clutter_actor_get_allocation_box:
- * @self: A #ClutterActor
- * @box: (out): the function fills this in with the actor's allocation
- *
- * 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 translation;
- * those transformations do not affect layout, only rendering.
- *
- * Do not call any of the clutter_actor_get_allocation_*() family
- * of functions inside the implementation of the get_preferred_width()
- * or get_preferred_height() virtual functions.
- *
- * Since: 0.8
- */
-void
-clutter_actor_get_allocation_box (ClutterActor *self,
- ClutterActorBox *box)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- /* XXX - if needs_allocation=TRUE, we can either 1) g_return_if_fail,
- * which limits calling get_allocation to inside paint() basically; or
- * we can 2) force a layout, which could be expensive if someone calls
- * get_allocation somewhere silly; or we can 3) just return the latest
- * value, allowing it to be out-of-date, and assume people know what
- * they are doing.
- *
- * The least-surprises approach that keeps existing code working is
- * likely to be 2). People can end up doing some inefficient things,
- * though, and in general code that requires 2) is probably broken.
- */
-
- /* this implements 2) */
- if (G_UNLIKELY (self->priv->needs_allocation))
- {
- ClutterActor *stage = _clutter_actor_get_stage_internal (self);
-
- /* do not queue a relayout on an unparented actor */
- if (stage)
- clutter_stage_maybe_relayout (stage);
- }
-
- /* commenting out the code above and just keeping this assignment
- * implements 3)
- */
- *box = self->priv->allocation;
-}
-
-static void
-clutter_actor_update_constraints (ClutterActor *self,
- ClutterActorBox *allocation)
-{
- ClutterActorPrivate *priv = self->priv;
- const GList *constraints, *l;
-
- if (priv->constraints == NULL)
- return;
-
- constraints = _clutter_meta_group_peek_metas (priv->constraints);
- for (l = constraints; l != NULL; l = l->next)
- {
- ClutterConstraint *constraint = l->data;
- ClutterActorMeta *meta = l->data;
- gboolean changed = FALSE;
-
- if (clutter_actor_meta_get_enabled (meta))
- {
- changed |=
- clutter_constraint_update_allocation (constraint,
- self,
- allocation);
-
- CLUTTER_NOTE (LAYOUT,
- "Allocation of '%s' after constraint '%s': "
- "{ %.2f, %.2f, %.2f, %.2f } (changed:%s)",
- _clutter_actor_get_debug_name (self),
- _clutter_actor_meta_get_debug_name (meta),
- allocation->x1,
- allocation->y1,
- allocation->x2,
- allocation->y2,
- changed ? "yes" : "no");
- }
- }
-}
-
-/*< private >
- * clutter_actor_adjust_allocation:
- * @self: a #ClutterActor
- * @allocation: (inout): the allocation to adjust
- *
- * Adjusts the passed allocation box taking into account the actor's
- * layout information, like alignment, expansion, and margin.
- */
-static void
-clutter_actor_adjust_allocation (ClutterActor *self,
- ClutterActorBox *allocation)
-{
- ClutterActorBox adj_allocation;
- float alloc_width, alloc_height;
- float min_width, min_height;
- float nat_width, nat_height;
- ClutterRequestMode req_mode;
-
- adj_allocation = *allocation;
-
- clutter_actor_box_get_size (allocation, &alloc_width, &alloc_height);
-
- /* There's no point in trying to adjust a zero-sized actor */
- if (alloc_width == 0.f && alloc_height == 0.f)
- return;
-
- /* we want to hit the cache, so we use the public API */
- req_mode = clutter_actor_get_request_mode (self);
-
- if (req_mode == CLUTTER_REQUEST_HEIGHT_FOR_WIDTH)
- {
- clutter_actor_get_preferred_width (self, -1,
- &min_width,
- &nat_width);
- clutter_actor_get_preferred_height (self, alloc_width,
- &min_height,
- &nat_height);
- }
- else if (req_mode == CLUTTER_REQUEST_WIDTH_FOR_HEIGHT)
- {
- clutter_actor_get_preferred_height (self, -1,
- &min_height,
- &nat_height);
- clutter_actor_get_preferred_width (self, alloc_height,
- &min_width,
- &nat_width);
- }
- else if (req_mode == CLUTTER_REQUEST_CONTENT_SIZE)
- {
- min_width = min_height = 0;
- nat_width = nat_height = 0;
-
- if (self->priv->content != NULL)
- clutter_content_get_preferred_size (self->priv->content, &nat_width, &nat_height);
- }
-
-#ifdef CLUTTER_ENABLE_DEBUG
- /* warn about underallocations */
- if (_clutter_diagnostic_enabled () &&
- (floorf (min_width - alloc_width) > 0 ||
- floorf (min_height - alloc_height) > 0))
- {
- ClutterActor *parent = clutter_actor_get_parent (self);
-
- /* the only actors that are allowed to be underallocated are the Stage,
- * as it doesn't have an implicit size, and Actors that specifically
- * told us that they want to opt-out from layout control mechanisms
- * through the NO_LAYOUT escape hatch.
- */
- if (parent != NULL &&
- !(self->flags & CLUTTER_ACTOR_NO_LAYOUT) != 0)
- {
- g_warning (G_STRLOC ": The actor '%s' is getting an allocation "
- "of %.2f x %.2f from its parent actor '%s', but its "
- "requested minimum size is of %.2f x %.2f",
- _clutter_actor_get_debug_name (self),
- alloc_width, alloc_height,
- _clutter_actor_get_debug_name (parent),
- min_width, min_height);
- }
- }
-#endif
-
- clutter_actor_adjust_width (self,
- &min_width,
- &nat_width,
- &adj_allocation.x1,
- &adj_allocation.x2);
-
- clutter_actor_adjust_height (self,
- &min_height,
- &nat_height,
- &adj_allocation.y1,
- &adj_allocation.y2);
-
- /* we maintain the invariant that an allocation cannot be adjusted
- * to be outside the parent-given box
- */
- if (adj_allocation.x1 < allocation->x1 ||
- adj_allocation.y1 < allocation->y1 ||
- adj_allocation.x2 > allocation->x2 ||
- adj_allocation.y2 > allocation->y2)
- {
- g_warning (G_STRLOC ": The actor '%s' tried to adjust its allocation "
- "to { %.2f, %.2f, %.2f, %.2f }, which is outside of its "
- "original allocation of { %.2f, %.2f, %.2f, %.2f }",
- _clutter_actor_get_debug_name (self),
- adj_allocation.x1, adj_allocation.y1,
- adj_allocation.x2 - adj_allocation.x1,
- adj_allocation.y2 - adj_allocation.y1,
- allocation->x1, allocation->y1,
- allocation->x2 - allocation->x1,
- allocation->y2 - allocation->y1);
- return;
- }
-
- *allocation = adj_allocation;
-}
-
-static void
-clutter_actor_allocate_internal (ClutterActor *self,
- const ClutterActorBox *allocation)
-{
- ClutterActorClass *klass;
-
- CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IN_RELAYOUT);
-
- CLUTTER_NOTE (LAYOUT, "Calling %s::allocate()",
- _clutter_actor_get_debug_name (self));
-
- klass = CLUTTER_ACTOR_GET_CLASS (self);
- klass->allocate (self, allocation);
-
- CLUTTER_UNSET_PRIVATE_FLAGS (self, CLUTTER_IN_RELAYOUT);
-
- /* Caller should call clutter_actor_queue_redraw() if needed
- * for that particular case.
- */
-}
-
-/**
- * clutter_actor_allocate:
- * @self: A #ClutterActor
- * @box: new allocation of the actor, in parent-relative coordinates
- *
- * Assigns the size of a #ClutterActor from the given @box.
- *
- * This function should only be called on the children of an actor when
- * overriding the #ClutterActorClass.allocate() virtual function.
- *
- * This function will adjust the stored allocation to take into account
- * the alignment flags set in the #ClutterActor:x-align and
- * #ClutterActor:y-align properties, as well as the margin values set in
- * the #ClutterActor:margin-top, #ClutterActor:margin-right,
- * #ClutterActor:margin-bottom, and #ClutterActor:margin-left properties.
- *
- * This function will respect the easing state of the #ClutterActor and
- * interpolate between the current allocation and the new one if the
- * easing state duration is a positive value.
- *
- * Actors can know from their allocation box whether they have moved
- * with respect to their parent actor. The @flags parameter describes
- * additional information about the allocation, for instance whether
- * the parent has moved with respect to the stage, for example because
- * a grandparent's origin has moved.
- *
- * Since: 0.8
- */
-void
-clutter_actor_allocate (ClutterActor *self,
- const ClutterActorBox *box)
-{
- ClutterActorBox old_allocation, real_allocation;
- gboolean origin_changed, size_changed;
- ClutterActorPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- if (G_UNLIKELY (_clutter_actor_get_stage_internal (self) == NULL))
- {
- g_warning ("Spurious clutter_actor_allocate called for actor %p/%s "
- "which isn't a descendent of the stage!\n",
- self, _clutter_actor_get_debug_name (self));
- return;
- }
-
- priv = self->priv;
-
- if (!CLUTTER_ACTOR_IS_TOPLEVEL (self) &&
- !CLUTTER_ACTOR_IS_MAPPED (self) &&
- !clutter_actor_has_mapped_clones (self))
- return;
-
- old_allocation = priv->allocation;
- real_allocation = *box;
-
- g_return_if_fail (!isnan (real_allocation.x1) &&
- !isnan (real_allocation.x2) &&
- !isnan (real_allocation.y1) &&
- !isnan (real_allocation.y2));
-
- /* constraints are allowed to modify the allocation only here; we do
- * this prior to all the other checks so that we can bail out if the
- * allocation did not change
- */
- clutter_actor_update_constraints (self, &real_allocation);
-
- /* adjust the allocation depending on the align/margin properties */
- clutter_actor_adjust_allocation (self, &real_allocation);
-
- if (real_allocation.x2 < real_allocation.x1 ||
- real_allocation.y2 < real_allocation.y1)
- {
- g_warning (G_STRLOC ": Actor '%s' tried to allocate a size of %.2f x %.2f",
- _clutter_actor_get_debug_name (self),
- real_allocation.x2 - real_allocation.x1,
- real_allocation.y2 - real_allocation.y1);
- }
-
- /* we allow 0-sized actors, but not negative-sized ones */
- real_allocation.x2 = MAX (real_allocation.x2, real_allocation.x1);
- real_allocation.y2 = MAX (real_allocation.y2, real_allocation.y1);
-
- origin_changed = (real_allocation.x1 != old_allocation.x1 ||
- real_allocation.y1 != old_allocation.y1);
-
- size_changed = (real_allocation.x2 != old_allocation.x2 ||
- real_allocation.y2 != old_allocation.y2);
-
- /* When needs_allocation is set but we didn't move nor resize, we still
- * want to call the allocate() vfunc because a child probably called
- * queue_relayout() and needs a new allocation.
- *
- * In case needs_allocation isn't set and we didn't move nor resize, we
- * can safely stop allocating.
- */
- if (!priv->needs_allocation && !origin_changed && !size_changed)
- {
- CLUTTER_NOTE (LAYOUT, "No allocation needed");
- return;
- }
-
- if (!origin_changed && !size_changed)
- {
- /* If the actor didn't move but needs_allocation is set, we just
- * need to allocate the children (see comment above) */
- clutter_actor_allocate_internal (self, &real_allocation);
- return;
- }
-
- if (_clutter_actor_create_transition (self, obj_props[PROP_ALLOCATION],
- &priv->allocation,
- &real_allocation))
- clutter_actor_allocate_internal (self, &priv->allocation);
-}
-
-/**
- * clutter_actor_set_allocation:
- * @self: a #ClutterActor
- * @box: a #ClutterActorBox
- *
- * Stores the allocation of @self as defined by @box.
- *
- * This function can only be called from within the implementation of
- * the #ClutterActorClass.allocate() virtual function.
- *
- * The allocation @box should have been adjusted to take into account
- * constraints, alignment, and margin properties.
- *
- * This function should only be used by subclasses of #ClutterActor
- * that wish to store their allocation but cannot chain up to the
- * parent's implementation; the default implementation of the
- * #ClutterActorClass.allocate() virtual function will call this
- * function.
- *
- * Since: 1.10
- */
-void
-clutter_actor_set_allocation (ClutterActor *self,
- const ClutterActorBox *box)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (box != NULL);
-
- if (G_UNLIKELY (!CLUTTER_ACTOR_IN_RELAYOUT (self)))
- {
- g_critical (G_STRLOC ": The clutter_actor_set_allocation() function "
- "can only be called from within the implementation of "
- "the ClutterActor::allocate() virtual function.");
- return;
- }
-
- g_object_freeze_notify (G_OBJECT (self));
-
- clutter_actor_set_allocation_internal (self, box);
-
- g_object_thaw_notify (G_OBJECT (self));
-}
-
-/**
- * clutter_actor_set_position:
- * @self: A #ClutterActor
- * @x: New left position of actor in pixels.
- * @y: New top position of actor in pixels.
- *
- * Sets the actor's fixed position in pixels relative to any parent
- * actor.
- *
- * If a layout manager is in use, this position will override the
- * layout manager and force a fixed position.
- */
-void
-clutter_actor_set_position (ClutterActor *self,
- gfloat x,
- gfloat y)
-{
- graphene_point_t new_position;
- graphene_point_t cur_position;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- graphene_point_init (&new_position, x, y);
-
- cur_position.x = clutter_actor_get_x (self);
- cur_position.y = clutter_actor_get_y (self);
-
- if (!graphene_point_equal (&cur_position, &new_position))
- _clutter_actor_create_transition (self, obj_props[PROP_POSITION],
- &cur_position,
- &new_position);
-}
-
-/**
- * clutter_actor_get_fixed_position_set:
- * @self: A #ClutterActor
- *
- * Checks whether an actor has a fixed position set (and will thus be
- * unaffected by any layout manager).
- *
- * Return value: %TRUE if the fixed position is set on the actor
- *
- * Since: 0.8
- */
-gboolean
-clutter_actor_get_fixed_position_set (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- return self->priv->position_set;
-}
-
-/**
- * clutter_actor_set_fixed_position_set:
- * @self: A #ClutterActor
- * @is_set: whether to use fixed position
- *
- * Sets whether an actor has a fixed position set (and will thus be
- * unaffected by any layout manager).
- *
- * Since: 0.8
- */
-void
-clutter_actor_set_fixed_position_set (ClutterActor *self,
- gboolean is_set)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- if (self->priv->position_set == (is_set != FALSE))
- return;
-
- if (!is_set)
- {
- ClutterLayoutInfo *info;
-
- /* Ensure we set back the default fixed position of 0,0 so that setting
- just one of x/y always atomically gets 0 for the other */
- info = _clutter_actor_peek_layout_info (self);
- if (info != NULL)
- {
- info->fixed_pos.x = 0;
- info->fixed_pos.y = 0;
- }
- }
-
- self->priv->position_set = is_set != FALSE;
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_FIXED_POSITION_SET]);
-
- clutter_actor_queue_relayout (self);
-}
-
-/**
- * clutter_actor_move_by:
- * @self: A #ClutterActor
- * @dx: Distance to move Actor on X axis.
- * @dy: Distance to move Actor on Y axis.
- *
- * Moves an actor by the specified distance relative to its current
- * position in pixels.
- *
- * This function modifies the fixed position of an actor and thus removes
- * it from any layout management. Another way to move an actor is with an
- * additional translation, using clutter_actor_set_translation().
- *
- * Since: 0.2
- */
-void
-clutter_actor_move_by (ClutterActor *self,
- gfloat dx,
- gfloat dy)
-{
- const ClutterLayoutInfo *info;
- gfloat x, y;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- info = _clutter_actor_get_layout_info_or_defaults (self);
- x = info->fixed_pos.x;
- y = info->fixed_pos.y;
-
- clutter_actor_set_position (self, x + dx, y + dy);
-}
-
-static void
-clutter_actor_set_min_width (ClutterActor *self,
- gfloat min_width)
-{
- ClutterActorPrivate *priv = self->priv;
- ClutterActorBox old = { 0, };
- ClutterLayoutInfo *info;
-
- /* if we are setting the size on a top-level actor and the
- * backend only supports static top-levels (e.g. framebuffers)
- * then we ignore the passed value and we override it with
- * the stage implementation's preferred size.
- */
- if (CLUTTER_ACTOR_IS_TOPLEVEL (self) &&
- clutter_feature_available (CLUTTER_FEATURE_STAGE_STATIC))
- return;
-
- info = _clutter_actor_get_layout_info (self);
-
- if (priv->min_width_set && min_width == info->minimum.width)
- return;
-
- g_object_freeze_notify (G_OBJECT (self));
-
- clutter_actor_store_old_geometry (self, &old);
-
- info->minimum.width = min_width;
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_MIN_WIDTH]);
- clutter_actor_set_min_width_set (self, TRUE);
-
- clutter_actor_notify_if_geometry_changed (self, &old);
-
- g_object_thaw_notify (G_OBJECT (self));
-
- clutter_actor_queue_relayout (self);
-}
-
-static void
-clutter_actor_set_min_height (ClutterActor *self,
- gfloat min_height)
-
-{
- ClutterActorPrivate *priv = self->priv;
- ClutterActorBox old = { 0, };
- ClutterLayoutInfo *info;
-
- /* if we are setting the size on a top-level actor and the
- * backend only supports static top-levels (e.g. framebuffers)
- * then we ignore the passed value and we override it with
- * the stage implementation's preferred size.
- */
- if (CLUTTER_ACTOR_IS_TOPLEVEL (self) &&
- clutter_feature_available (CLUTTER_FEATURE_STAGE_STATIC))
- return;
-
- info = _clutter_actor_get_layout_info (self);
-
- if (priv->min_height_set && min_height == info->minimum.height)
- return;
-
- g_object_freeze_notify (G_OBJECT (self));
-
- clutter_actor_store_old_geometry (self, &old);
-
- info->minimum.height = min_height;
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_MIN_HEIGHT]);
- clutter_actor_set_min_height_set (self, TRUE);
-
- clutter_actor_notify_if_geometry_changed (self, &old);
-
- g_object_thaw_notify (G_OBJECT (self));
-
- clutter_actor_queue_relayout (self);
-}
-
-static void
-clutter_actor_set_natural_width (ClutterActor *self,
- gfloat natural_width)
-{
- ClutterActorPrivate *priv = self->priv;
- ClutterActorBox old = { 0, };
- ClutterLayoutInfo *info;
-
- /* if we are setting the size on a top-level actor and the
- * backend only supports static top-levels (e.g. framebuffers)
- * then we ignore the passed value and we override it with
- * the stage implementation's preferred size.
- */
- if (CLUTTER_ACTOR_IS_TOPLEVEL (self) &&
- clutter_feature_available (CLUTTER_FEATURE_STAGE_STATIC))
- return;
-
- info = _clutter_actor_get_layout_info (self);
-
- if (priv->natural_width_set && natural_width == info->natural.width)
- return;
-
- g_object_freeze_notify (G_OBJECT (self));
-
- clutter_actor_store_old_geometry (self, &old);
-
- info->natural.width = natural_width;
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_NATURAL_WIDTH]);
- clutter_actor_set_natural_width_set (self, TRUE);
-
- clutter_actor_notify_if_geometry_changed (self, &old);
-
- g_object_thaw_notify (G_OBJECT (self));
-
- clutter_actor_queue_relayout (self);
-}
-
-static void
-clutter_actor_set_natural_height (ClutterActor *self,
- gfloat natural_height)
-{
- ClutterActorPrivate *priv = self->priv;
- ClutterActorBox old = { 0, };
- ClutterLayoutInfo *info;
-
- /* if we are setting the size on a top-level actor and the
- * backend only supports static top-levels (e.g. framebuffers)
- * then we ignore the passed value and we override it with
- * the stage implementation's preferred size.
- */
- if (CLUTTER_ACTOR_IS_TOPLEVEL (self) &&
- clutter_feature_available (CLUTTER_FEATURE_STAGE_STATIC))
- return;
-
- info = _clutter_actor_get_layout_info (self);
-
- if (priv->natural_height_set && natural_height == info->natural.height)
- return;
-
- g_object_freeze_notify (G_OBJECT (self));
-
- clutter_actor_store_old_geometry (self, &old);
-
- info->natural.height = natural_height;
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_NATURAL_HEIGHT]);
- clutter_actor_set_natural_height_set (self, TRUE);
-
- clutter_actor_notify_if_geometry_changed (self, &old);
-
- g_object_thaw_notify (G_OBJECT (self));
-
- clutter_actor_queue_relayout (self);
-}
-
-static void
-clutter_actor_set_min_width_set (ClutterActor *self,
- gboolean use_min_width)
-{
- ClutterActorPrivate *priv = self->priv;
- ClutterActorBox old = { 0, };
-
- if (priv->min_width_set == (use_min_width != FALSE))
- return;
-
- clutter_actor_store_old_geometry (self, &old);
-
- priv->min_width_set = use_min_width != FALSE;
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_MIN_WIDTH_SET]);
-
- clutter_actor_notify_if_geometry_changed (self, &old);
-
- clutter_actor_queue_relayout (self);
-}
-
-static void
-clutter_actor_set_min_height_set (ClutterActor *self,
- gboolean use_min_height)
-{
- ClutterActorPrivate *priv = self->priv;
- ClutterActorBox old = { 0, };
-
- if (priv->min_height_set == (use_min_height != FALSE))
- return;
-
- clutter_actor_store_old_geometry (self, &old);
-
- priv->min_height_set = use_min_height != FALSE;
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_MIN_HEIGHT_SET]);
-
- clutter_actor_notify_if_geometry_changed (self, &old);
-
- clutter_actor_queue_relayout (self);
-}
-
-static void
-clutter_actor_set_natural_width_set (ClutterActor *self,
- gboolean use_natural_width)
-{
- ClutterActorPrivate *priv = self->priv;
- ClutterActorBox old = { 0, };
-
- if (priv->natural_width_set == (use_natural_width != FALSE))
- return;
-
- clutter_actor_store_old_geometry (self, &old);
-
- priv->natural_width_set = use_natural_width != FALSE;
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_NATURAL_WIDTH_SET]);
-
- clutter_actor_notify_if_geometry_changed (self, &old);
-
- clutter_actor_queue_relayout (self);
-}
-
-static void
-clutter_actor_set_natural_height_set (ClutterActor *self,
- gboolean use_natural_height)
-{
- ClutterActorPrivate *priv = self->priv;
- ClutterActorBox old = { 0, };
-
- if (priv->natural_height_set == (use_natural_height != FALSE))
- return;
-
- clutter_actor_store_old_geometry (self, &old);
-
- priv->natural_height_set = use_natural_height != FALSE;
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_NATURAL_HEIGHT_SET]);
-
- clutter_actor_notify_if_geometry_changed (self, &old);
-
- clutter_actor_queue_relayout (self);
-}
-
-/**
- * clutter_actor_set_request_mode:
- * @self: a #ClutterActor
- * @mode: the request mode
- *
- * Sets the geometry request mode of @self.
- *
- * The @mode determines the order for invoking
- * clutter_actor_get_preferred_width() and
- * clutter_actor_get_preferred_height()
- *
- * Since: 1.2
- */
-void
-clutter_actor_set_request_mode (ClutterActor *self,
- ClutterRequestMode mode)
-{
- ClutterActorPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- priv = self->priv;
-
- if (priv->request_mode == mode)
- return;
-
- priv->request_mode = mode;
-
- priv->needs_width_request = TRUE;
- priv->needs_height_request = TRUE;
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_REQUEST_MODE]);
-
- clutter_actor_queue_relayout (self);
-}
-
-/**
- * clutter_actor_get_request_mode:
- * @self: a #ClutterActor
- *
- * Retrieves the geometry request mode of @self
- *
- * Return value: the request mode for the actor
- *
- * Since: 1.2
- */
-ClutterRequestMode
-clutter_actor_get_request_mode (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self),
- CLUTTER_REQUEST_HEIGHT_FOR_WIDTH);
-
- return self->priv->request_mode;
-}
-
-/* variant of set_width() without checks and without notification
- * freeze+thaw, for internal usage only
- */
-static inline void
-clutter_actor_set_width_internal (ClutterActor *self,
- gfloat width)
-{
- if (width >= 0)
- {
- /* the Stage will use the :min-width to control the minimum
- * width to be resized to, so we should not be setting it
- * along with the :natural-width
- */
- if (!CLUTTER_ACTOR_IS_TOPLEVEL (self))
- clutter_actor_set_min_width (self, width);
-
- clutter_actor_set_natural_width (self, width);
- }
- else
- {
- /* we only unset the :natural-width for the Stage */
- if (!CLUTTER_ACTOR_IS_TOPLEVEL (self))
- clutter_actor_set_min_width_set (self, FALSE);
-
- clutter_actor_set_natural_width_set (self, FALSE);
- }
-}
-
-/* variant of set_height() without checks and without notification
- * freeze+thaw, for internal usage only
- */
-static inline void
-clutter_actor_set_height_internal (ClutterActor *self,
- gfloat height)
-{
- if (height >= 0)
- {
- /* see the comment above in set_width_internal() */
- if (!CLUTTER_ACTOR_IS_TOPLEVEL (self))
- clutter_actor_set_min_height (self, height);
-
- clutter_actor_set_natural_height (self, height);
- }
- else
- {
- /* see the comment above in set_width_internal() */
- if (!CLUTTER_ACTOR_IS_TOPLEVEL (self))
- clutter_actor_set_min_height_set (self, FALSE);
-
- clutter_actor_set_natural_height_set (self, FALSE);
- }
-}
-
-static void
-clutter_actor_set_size_internal (ClutterActor *self,
- const graphene_size_t *size)
-{
- if (size != NULL)
- {
- clutter_actor_set_width_internal (self, size->width);
- clutter_actor_set_height_internal (self, size->height);
- }
- else
- {
- clutter_actor_set_width_internal (self, -1);
- clutter_actor_set_height_internal (self, -1);
- }
-}
-
-/**
- * clutter_actor_set_size:
- * @self: A #ClutterActor
- * @width: New width of actor in pixels, or -1
- * @height: New height of actor in pixels, or -1
- *
- * Sets the actor's size request in pixels. This overrides any
- * "normal" size request the actor would have. For example
- * a text actor might normally request the size of the text;
- * this function would force a specific size instead.
- *
- * If @width and/or @height are -1 the actor will use its
- * "normal" size request instead of overriding it, i.e.
- * you can "unset" the size with -1.
- *
- * This function sets or unsets both the minimum and natural size.
- */
-void
-clutter_actor_set_size (ClutterActor *self,
- gfloat width,
- gfloat height)
-{
- graphene_size_t new_size;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- graphene_size_init (&new_size, width, height);
-
- /* minor optimization: if we don't have a duration then we can
- * skip the get_size() below, to avoid the chance of going through
- * get_preferred_width() and get_preferred_height() just to jump to
- * a new desired size
- */
- if (clutter_actor_get_easing_duration (self) == 0)
- {
- g_object_freeze_notify (G_OBJECT (self));
-
- clutter_actor_set_size_internal (self, &new_size);
-
- g_object_thaw_notify (G_OBJECT (self));
-
- return;
- }
- else
- {
- graphene_size_t cur_size;
-
- graphene_size_init (&cur_size,
- clutter_actor_get_width (self),
- clutter_actor_get_height (self));
-
- _clutter_actor_create_transition (self,
- obj_props[PROP_SIZE],
- &cur_size,
- &new_size);
- }
-}
-
-/**
- * clutter_actor_get_size:
- * @self: A #ClutterActor
- * @width: (out) (allow-none): return location for the width, or %NULL.
- * @height: (out) (allow-none): return location for the height, or %NULL.
- *
- * This function tries to "do what you mean" and return
- * the size an actor will have. If the actor has a valid
- * allocation, the allocation will be returned; otherwise,
- * the actors natural size request will be returned.
- *
- * If you care whether you get the request vs. the allocation, you
- * should probably call a different function like
- * clutter_actor_get_allocation_box() or
- * clutter_actor_get_preferred_width().
- *
- * Since: 0.2
- */
-void
-clutter_actor_get_size (ClutterActor *self,
- gfloat *width,
- gfloat *height)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- if (width)
- *width = clutter_actor_get_width (self);
-
- if (height)
- *height = clutter_actor_get_height (self);
-}
-
-/**
- * clutter_actor_get_position:
- * @self: a #ClutterActor
- * @x: (out) (allow-none): return location for the X coordinate, or %NULL
- * @y: (out) (allow-none): return location for the Y coordinate, or %NULL
- *
- * This function tries to "do what you mean" and tell you where the
- * actor is, prior to any transformations. Retrieves the fixed
- * position of an actor in pixels, if one has been set; otherwise, if
- * the allocation is valid, returns the actor's allocated position;
- * otherwise, returns 0,0.
- *
- * The returned position is in pixels.
- *
- * Since: 0.6
- */
-void
-clutter_actor_get_position (ClutterActor *self,
- gfloat *x,
- gfloat *y)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- if (x)
- *x = clutter_actor_get_x (self);
-
- if (y)
- *y = clutter_actor_get_y (self);
-}
-
-/**
- * clutter_actor_get_fixed_position:
- * @self: a #ClutterActor
- * @x: (out) (allow-none): return location for the X coordinate, or %NULL
- * @y: (out) (allow-none): return location for the Y coordinate, or %NULL
- *
- * This function gets the fixed position of the actor, if set. If there
- * is no fixed position set, this function returns %FALSE and doesn't set
- * the x and y coordinates.
- *
- * Returns: %TRUE if the fixed position is set, %FALSE if it isn't
- */
-gboolean
-clutter_actor_get_fixed_position (ClutterActor *self,
- float *x,
- float *y)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- if (self->priv->position_set)
- {
- const ClutterLayoutInfo *info;
-
- info = _clutter_actor_get_layout_info_or_defaults (self);
-
- if (x)
- *x = info->fixed_pos.x;
-
- if (y)
- *y = info->fixed_pos.y;
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-/**
- * clutter_actor_get_transformed_extents:
- * @self: A #ClutterActor
- * @rect: (out): return location for the transformed bounding rect
- *
- * Gets the transformed bounding rect of an actor, in pixels relative to the stage.
- */
-void
-clutter_actor_get_transformed_extents (ClutterActor *self,
- graphene_rect_t *rect)
-{
- graphene_quad_t quad;
- graphene_point3d_t v[4];
- ClutterActorBox box;
-
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = clutter_actor_box_get_width (&self->priv->allocation);
- box.y2 = clutter_actor_box_get_height (&self->priv->allocation);
- if (_clutter_actor_transform_and_project_box (self, &box, v))
- {
- graphene_quad_init (&quad,
- (graphene_point_t *) &v[0],
- (graphene_point_t *) &v[1],
- (graphene_point_t *) &v[2],
- (graphene_point_t *) &v[3]);
-
- if (rect)
- graphene_quad_bounds (&quad, rect);
- }
-}
-
-/**
- * clutter_actor_get_transformed_position:
- * @self: A #ClutterActor
- * @x: (out) (allow-none): return location for the X coordinate, or %NULL
- * @y: (out) (allow-none): return location for the Y coordinate, or %NULL
- *
- * Gets the absolute position of an actor, in pixels relative to the stage.
- *
- * Since: 0.8
- */
-void
-clutter_actor_get_transformed_position (ClutterActor *self,
- gfloat *x,
- gfloat *y)
-{
- graphene_point3d_t v1;
- graphene_point3d_t v2;
-
- v1.x = v1.y = v1.z = 0;
- clutter_actor_apply_transform_to_point (self, &v1, &v2);
-
- if (x)
- *x = v2.x;
-
- if (y)
- *y = v2.y;
-}
-
-/**
- * clutter_actor_get_transformed_size:
- * @self: A #ClutterActor
- * @width: (out) (allow-none): return location for the width, or %NULL
- * @height: (out) (allow-none): return location for the height, or %NULL
- *
- * Gets the absolute size of an actor in pixels, taking into account the
- * scaling factors.
- *
- * If the actor has a valid allocation, the allocated size will be used.
- * If the actor has not a valid allocation then the preferred size will
- * be transformed and returned.
- *
- * If you want the transformed allocation, see
- * clutter_actor_get_abs_allocation_vertices() instead.
- *
- * When the actor (or one of its ancestors) is rotated around the
- * X or Y axis, it no longer appears as on the stage as a rectangle, but
- * as a generic quadrangle; in that case this function returns the size
- * of the smallest rectangle that encapsulates the entire quad. Please
- * note that in this case no assumptions can be made about the relative
- * position of this envelope to the absolute position of the actor, as
- * returned by clutter_actor_get_transformed_position(); if you need this
- * information, you need to use clutter_actor_get_abs_allocation_vertices()
- * to get the coords of the actual quadrangle.
- *
- * Since: 0.8
- */
-void
-clutter_actor_get_transformed_size (ClutterActor *self,
- gfloat *width,
- gfloat *height)
-{
- ClutterActorPrivate *priv;
- graphene_point3d_t v[4];
- gfloat x_min, x_max, y_min, y_max;
- gint i;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- priv = self->priv;
-
- /* if the actor hasn't been allocated yet, get the preferred
- * size and transform that
- */
- if (priv->needs_allocation)
- {
- gfloat natural_width, natural_height;
- ClutterActorBox box;
-
- /* Make a fake allocation to transform.
- *
- * NB: _clutter_actor_transform_and_project_box expects a box in
- * the actor's coordinate space... */
-
- box.x1 = 0;
- box.y1 = 0;
-
- natural_width = natural_height = 0;
- clutter_actor_get_preferred_size (self, NULL, NULL,
- &natural_width,
- &natural_height);
-
- box.x2 = natural_width;
- box.y2 = natural_height;
-
- _clutter_actor_transform_and_project_box (self, &box, v);
- }
- else
- clutter_actor_get_abs_allocation_vertices (self, v);
-
- x_min = x_max = v[0].x;
- y_min = y_max = v[0].y;
-
- for (i = 1; i < G_N_ELEMENTS (v); ++i)
- {
- if (v[i].x < x_min)
- x_min = v[i].x;
-
- if (v[i].x > x_max)
- x_max = v[i].x;
-
- if (v[i].y < y_min)
- y_min = v[i].y;
-
- if (v[i].y > y_max)
- y_max = v[i].y;
- }
-
- if (width)
- *width = x_max - x_min;
-
- if (height)
- *height = y_max - y_min;
-}
-
-/**
- * clutter_actor_get_width:
- * @self: A #ClutterActor
- *
- * Retrieves the width of a #ClutterActor.
- *
- * If the actor has a valid allocation, this function will return the
- * width of the allocated area given to the actor.
- *
- * If the actor does not have a valid allocation, this function will
- * return the actor's natural width, that is the preferred width of
- * the actor.
- *
- * If you care whether you get the preferred width or the width that
- * has been assigned to the actor, you should probably call a different
- * function like clutter_actor_get_allocation_box() to retrieve the
- * allocated size or clutter_actor_get_preferred_width() to retrieve the
- * preferred width.
- *
- * If an actor has a fixed width, for instance a width that has been
- * assigned using clutter_actor_set_width(), the width returned will
- * be the same value.
- *
- * Return value: the width of the actor, in pixels
- */
-gfloat
-clutter_actor_get_width (ClutterActor *self)
-{
- ClutterActorPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
-
- priv = self->priv;
-
- if (priv->needs_allocation)
- {
- gfloat natural_width = 0;
-
- if (priv->request_mode == CLUTTER_REQUEST_HEIGHT_FOR_WIDTH)
- {
- clutter_actor_get_preferred_width (self, -1, NULL, &natural_width);
- }
- else if (priv->request_mode == CLUTTER_REQUEST_WIDTH_FOR_HEIGHT)
- {
- gfloat natural_height = 0;
-
- clutter_actor_get_preferred_height (self, -1, NULL, &natural_height);
- clutter_actor_get_preferred_width (self, natural_height,
- NULL,
- &natural_width);
- }
- else if (priv->request_mode == CLUTTER_REQUEST_CONTENT_SIZE && priv->content != NULL)
- {
- clutter_content_get_preferred_size (priv->content, &natural_width, NULL);
- }
-
- return natural_width;
- }
- else
- return priv->allocation.x2 - priv->allocation.x1;
-}
-
-/**
- * clutter_actor_get_height:
- * @self: A #ClutterActor
- *
- * Retrieves the height of a #ClutterActor.
- *
- * If the actor has a valid allocation, this function will return the
- * height of the allocated area given to the actor.
- *
- * If the actor does not have a valid allocation, this function will
- * return the actor's natural height, that is the preferred height of
- * the actor.
- *
- * If you care whether you get the preferred height or the height that
- * has been assigned to the actor, you should probably call a different
- * function like clutter_actor_get_allocation_box() to retrieve the
- * allocated size or clutter_actor_get_preferred_height() to retrieve the
- * preferred height.
- *
- * If an actor has a fixed height, for instance a height that has been
- * assigned using clutter_actor_set_height(), the height returned will
- * be the same value.
- *
- * Return value: the height of the actor, in pixels
- */
-gfloat
-clutter_actor_get_height (ClutterActor *self)
-{
- ClutterActorPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
-
- priv = self->priv;
-
- if (priv->needs_allocation)
- {
- gfloat natural_height = 0;
-
- if (priv->request_mode == CLUTTER_REQUEST_HEIGHT_FOR_WIDTH)
- {
- gfloat natural_width = 0;
-
- clutter_actor_get_preferred_width (self, -1, NULL, &natural_width);
- clutter_actor_get_preferred_height (self, natural_width,
- NULL, &natural_height);
- }
- else if (priv->request_mode == CLUTTER_REQUEST_WIDTH_FOR_HEIGHT)
- {
- clutter_actor_get_preferred_height (self, -1, NULL, &natural_height);
- }
- else if (priv->request_mode == CLUTTER_REQUEST_CONTENT_SIZE && priv->content != NULL)
- {
- clutter_content_get_preferred_size (priv->content, NULL, &natural_height);
- }
-
- return natural_height;
- }
- else
- return priv->allocation.y2 - priv->allocation.y1;
-}
-
-/**
- * clutter_actor_set_width:
- * @self: A #ClutterActor
- * @width: Requested new width for the actor, in pixels, or -1
- *
- * Forces a width on an actor, causing the actor's preferred width
- * and height (if any) to be ignored.
- *
- * If @width is -1 the actor will use its preferred width request
- * instead of overriding it, i.e. you can "unset" the width with -1.
- *
- * This function sets both the minimum and natural size of the actor.
- *
- * since: 0.2
- */
-void
-clutter_actor_set_width (ClutterActor *self,
- gfloat width)
-{
- float cur_size;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- /* minor optimization: if we don't have a duration
- * then we can skip the get_width() below, to avoid
- * the chance of going through get_preferred_width()
- * just to jump to a new desired width.
- */
- if (clutter_actor_get_easing_duration (self) == 0)
- {
- g_object_freeze_notify (G_OBJECT (self));
-
- clutter_actor_set_width_internal (self, width);
-
- g_object_thaw_notify (G_OBJECT (self));
-
- return;
- }
- else
- cur_size = clutter_actor_get_width (self);
-
- _clutter_actor_create_transition (self,
- obj_props[PROP_WIDTH],
- cur_size,
- width);
-}
-
-/**
- * clutter_actor_set_height:
- * @self: A #ClutterActor
- * @height: Requested new height for the actor, in pixels, or -1
- *
- * Forces a height on an actor, causing the actor's preferred width
- * and height (if any) to be ignored.
- *
- * If @height is -1 the actor will use its preferred height instead of
- * overriding it, i.e. you can "unset" the height with -1.
- *
- * This function sets both the minimum and natural size of the actor.
- *
- * since: 0.2
- */
-void
-clutter_actor_set_height (ClutterActor *self,
- gfloat height)
-{
- float cur_size;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- /* see the comment in clutter_actor_set_width() above */
- if (clutter_actor_get_easing_duration (self) == 0)
- {
- g_object_freeze_notify (G_OBJECT (self));
-
- clutter_actor_set_height_internal (self, height);
-
- g_object_thaw_notify (G_OBJECT (self));
-
- return;
- }
- else
- cur_size = clutter_actor_get_height (self);
-
- _clutter_actor_create_transition (self,
- obj_props[PROP_HEIGHT],
- cur_size,
- height);
-}
-
-static inline void
-clutter_actor_set_x_internal (ClutterActor *self,
- float x)
-{
- ClutterActorPrivate *priv = self->priv;
- ClutterLayoutInfo *linfo;
- ClutterActorBox old = { 0, };
-
- linfo = _clutter_actor_get_layout_info (self);
-
- if (priv->position_set && linfo->fixed_pos.x == x)
- return;
-
- clutter_actor_store_old_geometry (self, &old);
-
- linfo->fixed_pos.x = x;
- clutter_actor_set_fixed_position_set (self, TRUE);
-
- clutter_actor_notify_if_geometry_changed (self, &old);
-
- clutter_actor_queue_relayout (self);
-}
-
-static inline void
-clutter_actor_set_y_internal (ClutterActor *self,
- float y)
-{
- ClutterActorPrivate *priv = self->priv;
- ClutterLayoutInfo *linfo;
- ClutterActorBox old = { 0, };
-
- linfo = _clutter_actor_get_layout_info (self);
-
- if (priv->position_set && linfo->fixed_pos.y == y)
- return;
-
- clutter_actor_store_old_geometry (self, &old);
-
- linfo->fixed_pos.y = y;
- clutter_actor_set_fixed_position_set (self, TRUE);
-
- clutter_actor_notify_if_geometry_changed (self, &old);
-
- clutter_actor_queue_relayout (self);
-}
-
-static void
-clutter_actor_set_position_internal (ClutterActor *self,
- const graphene_point_t *position)
-{
- ClutterActorPrivate *priv = self->priv;
- ClutterLayoutInfo *linfo;
- ClutterActorBox old = { 0, };
-
- linfo = _clutter_actor_get_layout_info (self);
-
- if (priv->position_set &&
- graphene_point_equal (position, &linfo->fixed_pos))
- return;
-
- clutter_actor_store_old_geometry (self, &old);
-
- if (position != NULL)
- {
- linfo->fixed_pos = *position;
- clutter_actor_set_fixed_position_set (self, TRUE);
- }
- else
- clutter_actor_set_fixed_position_set (self, FALSE);
-
- clutter_actor_notify_if_geometry_changed (self, &old);
-
- clutter_actor_queue_relayout (self);
-}
-
-/**
- * clutter_actor_set_x:
- * @self: a #ClutterActor
- * @x: the actor's position on the X axis
- *
- * Sets the actor's X coordinate, relative to its parent, in pixels.
- *
- * Overrides any layout manager and forces a fixed position for
- * the actor.
- *
- * The #ClutterActor:x property is animatable.
- *
- * Since: 0.6
- */
-void
-clutter_actor_set_x (ClutterActor *self,
- gfloat x)
-{
- float cur_position = clutter_actor_get_x (self);
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- _clutter_actor_create_transition (self, obj_props[PROP_X],
- cur_position,
- x);
-}
-
-/**
- * clutter_actor_set_y:
- * @self: a #ClutterActor
- * @y: the actor's position on the Y axis
- *
- * Sets the actor's Y coordinate, relative to its parent, in pixels.#
- *
- * Overrides any layout manager and forces a fixed position for
- * the actor.
- *
- * The #ClutterActor:y property is animatable.
- *
- * Since: 0.6
- */
-void
-clutter_actor_set_y (ClutterActor *self,
- gfloat y)
-{
- float cur_position = clutter_actor_get_y (self);
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- _clutter_actor_create_transition (self, obj_props[PROP_Y],
- cur_position,
- y);
-}
-
-/**
- * clutter_actor_get_x:
- * @self: A #ClutterActor
- *
- * Retrieves the X coordinate of a #ClutterActor.
- *
- * This function tries to "do what you mean", by returning the
- * correct value depending on the actor's state.
- *
- * If the actor has a valid allocation, this function will return
- * the X coordinate of the origin of the allocation box.
- *
- * If the actor has any fixed coordinate set using clutter_actor_set_x(),
- * clutter_actor_set_position(), this function will return that coordinate.
- *
- * If both the allocation and a fixed position are missing, this function
- * will return 0.
- *
- * Return value: the X coordinate, in pixels, ignoring any
- * transformation (i.e. scaling, rotation)
- */
-gfloat
-clutter_actor_get_x (ClutterActor *self)
-{
- ClutterActorPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
-
- priv = self->priv;
-
- if (priv->needs_allocation)
- {
- if (priv->position_set)
- {
- const ClutterLayoutInfo *info;
-
- info = _clutter_actor_get_layout_info_or_defaults (self);
-
- return info->fixed_pos.x;
- }
- else
- return 0;
- }
- else
- return priv->allocation.x1;
-}
-
-/**
- * clutter_actor_get_y:
- * @self: A #ClutterActor
- *
- * Retrieves the Y coordinate of a #ClutterActor.
- *
- * This function tries to "do what you mean", by returning the
- * correct value depending on the actor's state.
- *
- * If the actor has a valid allocation, this function will return
- * the Y coordinate of the origin of the allocation box.
- *
- * If the actor has any fixed coordinate set using clutter_actor_set_y(),
- * clutter_actor_set_position(), this function will return that coordinate.
- *
- * If both the allocation and a fixed position are missing, this function
- * will return 0.
- *
- * Return value: the Y coordinate, in pixels, ignoring any
- * transformation (i.e. scaling, rotation)
- */
-gfloat
-clutter_actor_get_y (ClutterActor *self)
-{
- ClutterActorPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
-
- priv = self->priv;
-
- if (priv->needs_allocation)
- {
- if (priv->position_set)
- {
- const ClutterLayoutInfo *info;
-
- info = _clutter_actor_get_layout_info_or_defaults (self);
-
- return info->fixed_pos.y;
- }
- else
- return 0;
- }
- else
- return priv->allocation.y1;
-}
-
-/**
- * clutter_actor_set_scale:
- * @self: A #ClutterActor
- * @scale_x: double factor to scale actor by horizontally.
- * @scale_y: double factor to scale actor by vertically.
- *
- * Scales an actor with the given factors.
- *
- * The scale transformation is relative the the #ClutterActor:pivot-point.
- *
- * The #ClutterActor:scale-x and #ClutterActor:scale-y properties are
- * animatable.
- *
- * Since: 0.2
- */
-void
-clutter_actor_set_scale (ClutterActor *self,
- gdouble scale_x,
- gdouble scale_y)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- g_object_freeze_notify (G_OBJECT (self));
-
- clutter_actor_set_scale_factor (self, CLUTTER_X_AXIS, scale_x);
- clutter_actor_set_scale_factor (self, CLUTTER_Y_AXIS, scale_y);
-
- g_object_thaw_notify (G_OBJECT (self));
-}
-
-/**
- * clutter_actor_set_scale_z:
- * @self: a #ClutterActor
- * @scale_z: the scaling factor along the Z axis
- *
- * Scales an actor on the Z axis by the given @scale_z factor.
- *
- * The scale transformation is relative the the #ClutterActor:pivot-point.
- *
- * The #ClutterActor:scale-z property is animatable.
- *
- * Since: 1.12
- */
-void
-clutter_actor_set_scale_z (ClutterActor *self,
- gdouble scale_z)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- clutter_actor_set_scale_factor (self, CLUTTER_Z_AXIS, scale_z);
-}
-
-/**
- * clutter_actor_get_scale:
- * @self: A #ClutterActor
- * @scale_x: (out) (allow-none): Location to store horizontal
- * scale factor, or %NULL.
- * @scale_y: (out) (allow-none): Location to store vertical
- * scale factor, or %NULL.
- *
- * Retrieves an actors scale factors.
- *
- * Since: 0.2
- */
-void
-clutter_actor_get_scale (ClutterActor *self,
- gdouble *scale_x,
- gdouble *scale_y)
-{
- const ClutterTransformInfo *info;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- info = _clutter_actor_get_transform_info_or_defaults (self);
-
- if (scale_x)
- *scale_x = info->scale_x;
-
- if (scale_y)
- *scale_y = info->scale_y;
-}
-
-/**
- * clutter_actor_get_scale_z:
- * @self: A #ClutterActor
- *
- * Retrieves the scaling factor along the Z axis, as set using
- * clutter_actor_set_scale_z().
- *
- * Return value: the scaling factor along the Z axis
- *
- * Since: 1.12
- */
-gdouble
-clutter_actor_get_scale_z (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 1.0);
-
- return _clutter_actor_get_transform_info_or_defaults (self)->scale_z;
-}
-
-static inline void
-clutter_actor_set_opacity_internal (ClutterActor *self,
- guint8 opacity)
-{
- ClutterActorPrivate *priv = self->priv;
-
- if (priv->opacity != opacity)
- {
- priv->opacity = opacity;
-
- /* Queue a redraw from the flatten effect so that it can use
- its cached image if available instead of having to redraw the
- actual actor. If it doesn't end up using the FBO then the
- effect is still able to continue the paint anyway. If there
- is no flatten effect yet then this is equivalent to queueing
- a full redraw */
- _clutter_actor_queue_redraw_full (self,
- NULL, /* clip */
- priv->flatten_effect);
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_OPACITY]);
- }
-}
-
-/**
- * clutter_actor_set_opacity:
- * @self: A #ClutterActor
- * @opacity: New opacity value for the actor.
- *
- * Sets the actor's opacity, with zero being completely transparent and
- * 255 (0xff) being fully opaque.
- *
- * The #ClutterActor:opacity property is animatable.
- */
-void
-clutter_actor_set_opacity (ClutterActor *self,
- guint8 opacity)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- _clutter_actor_create_transition (self, obj_props[PROP_OPACITY],
- self->priv->opacity,
- opacity);
-}
-
-/*
- * clutter_actor_get_paint_opacity_internal:
- * @self: a #ClutterActor
- *
- * Retrieves the absolute opacity of the actor, as it appears on the stage
- *
- * This function does not do type checks
- *
- * Return value: the absolute opacity of the actor
- */
-static guint8
-clutter_actor_get_paint_opacity_internal (ClutterActor *self)
-{
- ClutterActorPrivate *priv = self->priv;
- ClutterActor *parent;
-
- /* override the top-level opacity to always be 255; even in
- * case of ClutterStage:use-alpha being TRUE we want the rest
- * of the scene to be painted
- */
- if (CLUTTER_ACTOR_IS_TOPLEVEL (self))
- return 255;
-
- if (priv->opacity_override >= 0)
- return priv->opacity_override;
-
- parent = priv->parent;
-
- /* Factor in the actual actors opacity with parents */
- if (parent != NULL)
- {
- guint8 opacity = clutter_actor_get_paint_opacity_internal (parent);
-
- if (opacity != 0xff)
- return (opacity * priv->opacity) / 0xff;
- }
-
- return priv->opacity;
-
-}
-
-/**
- * clutter_actor_get_paint_opacity:
- * @self: A #ClutterActor
- *
- * Retrieves the absolute opacity of the actor, as it appears on the stage.
- *
- * This function traverses the hierarchy chain and composites the opacity of
- * the actor with that of its parents.
- *
- * This function is intended for subclasses to use in the paint virtual
- * function, to paint themselves with the correct opacity.
- *
- * Return value: The actor opacity value.
- *
- * Since: 0.8
- */
-guint8
-clutter_actor_get_paint_opacity (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
-
- return clutter_actor_get_paint_opacity_internal (self);
-}
-
-/**
- * clutter_actor_get_opacity:
- * @self: a #ClutterActor
- *
- * Retrieves the opacity value of an actor, as set by
- * clutter_actor_set_opacity().
- *
- * For retrieving the absolute opacity of the actor inside a paint
- * virtual function, see clutter_actor_get_paint_opacity().
- *
- * Return value: the opacity of the actor
- */
-guint8
-clutter_actor_get_opacity (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
-
- return self->priv->opacity;
-}
-
-/**
- * clutter_actor_set_offscreen_redirect:
- * @self: A #ClutterActor
- * @redirect: New offscreen redirect flags for the actor.
- *
- * Defines the circumstances where the actor should be redirected into
- * an offscreen image. The offscreen image is used to flatten the
- * actor into a single image while painting for two main reasons.
- * Firstly, when the actor is painted a second time without any of its
- * contents changing it can simply repaint the cached image without
- * descending further down the actor hierarchy. Secondly, it will make
- * the opacity look correct even if there are overlapping primitives
- * in the actor.
- *
- * Caching the actor could in some cases be a performance win and in
- * some cases be a performance lose so it is important to determine
- * which value is right for an actor before modifying this value. For
- * example, there is never any reason to flatten an actor that is just
- * a single texture (such as a #ClutterTexture) because it is
- * effectively already cached in an image so the offscreen would be
- * redundant. Also if the actor contains primitives that are far apart
- * with a large transparent area in the middle (such as a large
- * CluterGroup with a small actor in the top left and a small actor in
- * the bottom right) then the cached image will contain the entire
- * image of the large area and the paint will waste time blending all
- * of the transparent pixels in the middle.
- *
- * The default method of implementing opacity on a container simply
- * forwards on the opacity to all of the children. If the children are
- * overlapping then it will appear as if they are two separate glassy
- * objects and there will be a break in the color where they
- * overlap. By redirecting to an offscreen buffer it will be as if the
- * two opaque objects are combined into one and then made transparent
- * which is usually what is expected.
- *
- * The image below demonstrates the difference between redirecting and
- * not. The image shows two Clutter groups, each containing a red and
- * a green rectangle which overlap. The opacity on the group is set to
- * 128 (which is 50%). When the offscreen redirect is not used, the
- * red rectangle can be seen through the blue rectangle as if the two
- * rectangles were separately transparent. When the redirect is used
- * the group as a whole is transparent instead so the red rectangle is
- * not visible where they overlap.
- *
- * <figure id="offscreen-redirect">
- * <title>Sample of using an offscreen redirect for transparency</title>
- * <graphic fileref="offscreen-redirect.png" format="PNG"/>
- * </figure>
- *
- * The default value for this property is 0, so we effectively will
- * never redirect an actor offscreen by default. This means that there
- * are times that transparent actors may look glassy as described
- * above. The reason this is the default is because there is a
- * performance trade off between quality and performance here. In many
- * cases the default form of glassy opacity looks good enough, but if
- * it's not you will need to set the
- * %CLUTTER_OFFSCREEN_REDIRECT_AUTOMATIC_FOR_OPACITY flag to enable
- * redirection for opacity.
- *
- * Custom actors that don't contain any overlapping primitives are
- * recommended to override the has_overlaps() virtual to return %FALSE
- * for maximum efficiency.
- *
- * Since: 1.8
- */
-void
-clutter_actor_set_offscreen_redirect (ClutterActor *self,
- ClutterOffscreenRedirect redirect)
-{
- ClutterActorPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- priv = self->priv;
-
- if (priv->offscreen_redirect != redirect)
- {
- priv->offscreen_redirect = redirect;
-
- /* Queue a redraw from the effect so that it can use its cached
- image if available instead of having to redraw the actual
- actor. If it doesn't end up using the FBO then the effect is
- still able to continue the paint anyway. If there is no
- effect then this is equivalent to queuing a full redraw */
- _clutter_actor_queue_redraw_full (self,
- NULL, /* clip */
- priv->flatten_effect);
-
- g_object_notify_by_pspec (G_OBJECT (self),
- obj_props[PROP_OFFSCREEN_REDIRECT]);
- }
-}
-
-/**
- * clutter_actor_get_offscreen_redirect:
- * @self: a #ClutterActor
- *
- * Retrieves whether to redirect the actor to an offscreen buffer, as
- * set by clutter_actor_set_offscreen_redirect().
- *
- * Return value: the value of the offscreen-redirect property of the actor
- *
- * Since: 1.8
- */
-ClutterOffscreenRedirect
-clutter_actor_get_offscreen_redirect (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
-
- return self->priv->offscreen_redirect;
-}
-
-/**
- * clutter_actor_set_name:
- * @self: A #ClutterActor
- * @name: Textual tag to apply to actor
- *
- * Sets the given name to @self. The name can be used to identify
- * a #ClutterActor.
- */
-void
-clutter_actor_set_name (ClutterActor *self,
- const gchar *name)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- g_free (self->priv->name);
- self->priv->name = g_strdup (name);
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_NAME]);
-}
-
-/**
- * clutter_actor_get_name:
- * @self: A #ClutterActor
- *
- * Retrieves the name of @self.
- *
- * Return value: the name of the actor, or %NULL. The returned string is
- * owned by the actor and should not be modified or freed.
- */
-const gchar *
-clutter_actor_get_name (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
-
- return self->priv->name;
-}
-
-static inline void
-clutter_actor_set_z_position_internal (ClutterActor *self,
- float z_position)
-{
- ClutterTransformInfo *info;
-
- info = _clutter_actor_get_transform_info (self);
-
- if (memcmp (&info->z_position, &z_position, sizeof (float)) != 0)
- {
- info->z_position = z_position;
-
- transform_changed (self);
-
- clutter_actor_queue_redraw (self);
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_Z_POSITION]);
- }
-}
-
-/**
- * clutter_actor_set_z_position:
- * @self: a #ClutterActor
- * @z_position: the position on the Z axis
- *
- * Sets the actor's position on the Z axis.
- *
- * See #ClutterActor:z-position.
- *
- * Since: 1.12
- */
-void
-clutter_actor_set_z_position (ClutterActor *self,
- gfloat z_position)
-{
- const ClutterTransformInfo *info;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- info = _clutter_actor_get_transform_info_or_defaults (self);
-
- _clutter_actor_create_transition (self, obj_props[PROP_Z_POSITION],
- info->z_position,
- z_position);
-}
-
-/**
- * clutter_actor_get_z_position:
- * @self: a #ClutterActor
- *
- * Retrieves the actor's position on the Z axis.
- *
- * Return value: the position on the Z axis.
- *
- * Since: 1.12
- */
-gfloat
-clutter_actor_get_z_position (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0.f);
-
- return _clutter_actor_get_transform_info_or_defaults (self)->z_position;
-}
-
-/**
- * clutter_actor_set_pivot_point:
- * @self: a #ClutterActor
- * @pivot_x: the normalized X coordinate of the pivot point
- * @pivot_y: the normalized Y coordinate of the pivot point
- *
- * Sets the position of the #ClutterActor:pivot-point around which the
- * scaling and rotation transformations occur.
- *
- * The pivot point's coordinates are in normalized space, with the (0, 0)
- * point being the top left corner of the actor, and the (1, 1) point being
- * the bottom right corner.
- *
- * Since: 1.12
- */
-void
-clutter_actor_set_pivot_point (ClutterActor *self,
- gfloat pivot_x,
- gfloat pivot_y)
-{
- graphene_point_t pivot = GRAPHENE_POINT_INIT (pivot_x, pivot_y);
- const ClutterTransformInfo *info;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- info = _clutter_actor_get_transform_info_or_defaults (self);
- _clutter_actor_create_transition (self, obj_props[PROP_PIVOT_POINT],
- &info->pivot,
- &pivot);
-}
-
-/**
- * clutter_actor_get_pivot_point:
- * @self: a #ClutterActor
- * @pivot_x: (out) (allow-none): return location for the normalized X
- * coordinate of the pivot point, or %NULL
- * @pivot_y: (out) (allow-none): return location for the normalized Y
- * coordinate of the pivot point, or %NULL
- *
- * Retrieves the coordinates of the #ClutterActor:pivot-point.
- *
- * Since: 1.12
- */
-void
-clutter_actor_get_pivot_point (ClutterActor *self,
- gfloat *pivot_x,
- gfloat *pivot_y)
-{
- const ClutterTransformInfo *info;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- info = _clutter_actor_get_transform_info_or_defaults (self);
-
- if (pivot_x != NULL)
- *pivot_x = info->pivot.x;
-
- if (pivot_y != NULL)
- *pivot_y = info->pivot.y;
-}
-
-/**
- * clutter_actor_set_pivot_point_z:
- * @self: a #ClutterActor
- * @pivot_z: the Z coordinate of the actor's pivot point
- *
- * Sets the component on the Z axis of the #ClutterActor:pivot-point around
- * which the scaling and rotation transformations occur.
- *
- * The @pivot_z value is expressed as a distance along the Z axis.
- *
- * Since: 1.12
- */
-void
-clutter_actor_set_pivot_point_z (ClutterActor *self,
- gfloat pivot_z)
-{
- const ClutterTransformInfo *info;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- info = _clutter_actor_get_transform_info_or_defaults (self);
- _clutter_actor_create_transition (self, obj_props[PROP_PIVOT_POINT_Z],
- info->pivot_z,
- pivot_z);
-}
-
-/**
- * clutter_actor_get_pivot_point_z:
- * @self: a #ClutterActor
- *
- * Retrieves the Z component of the #ClutterActor:pivot-point.
- *
- * Since: 1.12
- */
-gfloat
-clutter_actor_get_pivot_point_z (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0.f);
-
- return _clutter_actor_get_transform_info_or_defaults (self)->pivot_z;
-}
-
-/**
- * clutter_actor_set_clip:
- * @self: A #ClutterActor
- * @xoff: X offset of the clip rectangle
- * @yoff: Y offset of the clip rectangle
- * @width: Width of the clip rectangle
- * @height: Height of the clip rectangle
- *
- * Sets clip area for @self. The clip area is always computed from the
- * upper left corner of the actor.
- *
- * Since: 0.6
- */
-void
-clutter_actor_set_clip (ClutterActor *self,
- gfloat xoff,
- gfloat yoff,
- gfloat width,
- gfloat height)
-{
- ClutterActorPrivate *priv;
- GObject *obj;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- priv = self->priv;
-
- if (priv->has_clip &&
- priv->clip.origin.x == xoff &&
- priv->clip.origin.y == yoff &&
- priv->clip.size.width == width &&
- priv->clip.size.height == height)
- return;
-
- obj = G_OBJECT (self);
-
- priv->clip.origin.x = xoff;
- priv->clip.origin.y = yoff;
- priv->clip.size.width = width;
- priv->clip.size.height = height;
-
- priv->has_clip = TRUE;
-
- queue_update_paint_volume (self);
- clutter_actor_queue_redraw (self);
-
- g_object_notify_by_pspec (obj, obj_props[PROP_CLIP_RECT]);
- g_object_notify_by_pspec (obj, obj_props[PROP_HAS_CLIP]);
-}
-
-/**
- * clutter_actor_remove_clip:
- * @self: A #ClutterActor
- *
- * Removes clip area from @self.
- */
-void
-clutter_actor_remove_clip (ClutterActor *self)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- if (!self->priv->has_clip)
- return;
-
- self->priv->has_clip = FALSE;
-
- queue_update_paint_volume (self);
- clutter_actor_queue_redraw (self);
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_HAS_CLIP]);
-}
-
-/**
- * clutter_actor_has_clip:
- * @self: a #ClutterActor
- *
- * Determines whether the actor has a clip area set or not.
- *
- * Return value: %TRUE if the actor has a clip area set.
- *
- * Since: 0.2
- */
-gboolean
-clutter_actor_has_clip (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- return self->priv->has_clip;
-}
-
-/**
- * clutter_actor_get_clip:
- * @self: a #ClutterActor
- * @xoff: (out) (allow-none): return location for the X offset of
- * the clip rectangle, or %NULL
- * @yoff: (out) (allow-none): return location for the Y offset of
- * the clip rectangle, or %NULL
- * @width: (out) (allow-none): return location for the width of
- * the clip rectangle, or %NULL
- * @height: (out) (allow-none): return location for the height of
- * the clip rectangle, or %NULL
- *
- * Gets the clip area for @self, if any is set.
- *
- * Since: 0.6
- */
-void
-clutter_actor_get_clip (ClutterActor *self,
- gfloat *xoff,
- gfloat *yoff,
- gfloat *width,
- gfloat *height)
-{
- ClutterActorPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- priv = self->priv;
-
- if (!priv->has_clip)
- return;
-
- if (xoff != NULL)
- *xoff = priv->clip.origin.x;
-
- if (yoff != NULL)
- *yoff = priv->clip.origin.y;
-
- if (width != NULL)
- *width = priv->clip.size.width;
-
- if (height != NULL)
- *height = priv->clip.size.height;
-}
-
-/**
- * clutter_actor_get_children:
- * @self: a #ClutterActor
- *
- * Retrieves the list of children of @self.
- *
- * Return value: (transfer container) (element-type ClutterActor): A newly
- * allocated #GList of #ClutterActor<!-- -->s. Use g_list_free() when
- * done.
- *
- * Since: 1.10
- */
-GList *
-clutter_actor_get_children (ClutterActor *self)
-{
- ClutterActor *iter;
- GList *res;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
-
- /* we walk the list backward so that we can use prepend(),
- * which is O(1)
- */
- for (iter = self->priv->last_child, res = NULL;
- iter != NULL;
- iter = iter->priv->prev_sibling)
- {
- res = g_list_prepend (res, iter);
- }
-
- return res;
-}
-
-/*< private >
- * insert_child_at_depth:
- * @self: a #ClutterActor
- * @child: a #ClutterActor
- *
- * Inserts @child inside the list of children held by @self, using
- * the depth as the insertion criteria.
- *
- * This sadly makes the insertion not O(1), but we can keep the
- * list sorted so that the painters algorithm we use for painting
- * the children will work correctly.
- */
-static void
-insert_child_at_depth (ClutterActor *self,
- ClutterActor *child,
- gpointer dummy G_GNUC_UNUSED)
-{
- ClutterActor *iter;
- float child_depth;
-
- child->priv->parent = self;
-
- child_depth =
- _clutter_actor_get_transform_info_or_defaults (child)->z_position;
-
- /* special-case the first child */
- if (self->priv->n_children == 0)
- {
- self->priv->first_child = child;
- self->priv->last_child = child;
-
- child->priv->next_sibling = NULL;
- child->priv->prev_sibling = NULL;
-
- return;
- }
-
- /* Find the right place to insert the child so that it will still be
- sorted and the child will be after all of the actors at the same
- dept */
- for (iter = self->priv->first_child;
- iter != NULL;
- iter = iter->priv->next_sibling)
- {
- float iter_depth;
-
- iter_depth =
- _clutter_actor_get_transform_info_or_defaults (iter)->z_position;
-
- if (iter_depth > child_depth)
- break;
- }
-
- if (iter != NULL)
- {
- ClutterActor *tmp = iter->priv->prev_sibling;
-
- if (tmp != NULL)
- tmp->priv->next_sibling = child;
-
- /* Insert the node before the found one */
- child->priv->prev_sibling = iter->priv->prev_sibling;
- child->priv->next_sibling = iter;
- iter->priv->prev_sibling = child;
- }
- else
- {
- ClutterActor *tmp = self->priv->last_child;
-
- if (tmp != NULL)
- tmp->priv->next_sibling = child;
-
- /* insert the node at the end of the list */
- child->priv->prev_sibling = self->priv->last_child;
- child->priv->next_sibling = NULL;
- }
-
- if (child->priv->prev_sibling == NULL)
- self->priv->first_child = child;
-
- if (child->priv->next_sibling == NULL)
- self->priv->last_child = child;
-}
-
-static void
-insert_child_at_index (ClutterActor *self,
- ClutterActor *child,
- gpointer data_)
-{
- gint index_ = GPOINTER_TO_INT (data_);
-
- child->priv->parent = self;
-
- if (index_ == 0)
- {
- ClutterActor *tmp = self->priv->first_child;
-
- if (tmp != NULL)
- tmp->priv->prev_sibling = child;
-
- child->priv->prev_sibling = NULL;
- child->priv->next_sibling = tmp;
- }
- else if (index_ < 0 || index_ >= self->priv->n_children)
- {
- ClutterActor *tmp = self->priv->last_child;
-
- if (tmp != NULL)
- tmp->priv->next_sibling = child;
-
- child->priv->prev_sibling = tmp;
- child->priv->next_sibling = NULL;
- }
- else
- {
- ClutterActor *iter;
- int i;
-
- for (iter = self->priv->first_child, i = 0;
- iter != NULL;
- iter = iter->priv->next_sibling, i += 1)
- {
- if (index_ == i)
- {
- ClutterActor *tmp = iter->priv->prev_sibling;
-
- child->priv->prev_sibling = tmp;
- child->priv->next_sibling = iter;
-
- iter->priv->prev_sibling = child;
-
- if (tmp != NULL)
- tmp->priv->next_sibling = child;
-
- break;
- }
- }
- }
-
- if (child->priv->prev_sibling == NULL)
- self->priv->first_child = child;
-
- if (child->priv->next_sibling == NULL)
- self->priv->last_child = child;
-}
-
-static void
-insert_child_above (ClutterActor *self,
- ClutterActor *child,
- gpointer data)
-{
- ClutterActor *sibling = data;
-
- child->priv->parent = self;
-
- if (sibling == NULL)
- sibling = self->priv->last_child;
-
- child->priv->prev_sibling = sibling;
-
- if (sibling != NULL)
- {
- ClutterActor *tmp = sibling->priv->next_sibling;
-
- child->priv->next_sibling = tmp;
-
- if (tmp != NULL)
- tmp->priv->prev_sibling = child;
-
- sibling->priv->next_sibling = child;
- }
- else
- child->priv->next_sibling = NULL;
-
- if (child->priv->prev_sibling == NULL)
- self->priv->first_child = child;
-
- if (child->priv->next_sibling == NULL)
- self->priv->last_child = child;
-}
-
-static void
-insert_child_below (ClutterActor *self,
- ClutterActor *child,
- gpointer data)
-{
- ClutterActor *sibling = data;
-
- child->priv->parent = self;
-
- if (sibling == NULL)
- sibling = self->priv->first_child;
-
- child->priv->next_sibling = sibling;
-
- if (sibling != NULL)
- {
- ClutterActor *tmp = sibling->priv->prev_sibling;
-
- child->priv->prev_sibling = tmp;
-
- if (tmp != NULL)
- tmp->priv->next_sibling = child;
-
- sibling->priv->prev_sibling = child;
- }
- else
- child->priv->prev_sibling = NULL;
-
- if (child->priv->prev_sibling == NULL)
- self->priv->first_child = child;
-
- if (child->priv->next_sibling == NULL)
- self->priv->last_child = child;
-}
-
-typedef void (* ClutterActorAddChildFunc) (ClutterActor *parent,
- ClutterActor *child,
- gpointer data);
-
-typedef enum
-{
- ADD_CHILD_CREATE_META = 1 << 0,
- ADD_CHILD_EMIT_PARENT_SET = 1 << 1,
- ADD_CHILD_EMIT_ACTOR_ADDED = 1 << 2,
- ADD_CHILD_CHECK_STATE = 1 << 3,
- ADD_CHILD_NOTIFY_FIRST_LAST = 1 << 4,
- ADD_CHILD_SHOW_ON_SET_PARENT = 1 << 5,
-
- /* default flags for public API */
- ADD_CHILD_DEFAULT_FLAGS = ADD_CHILD_CREATE_META |
- ADD_CHILD_EMIT_PARENT_SET |
- ADD_CHILD_EMIT_ACTOR_ADDED |
- ADD_CHILD_CHECK_STATE |
- ADD_CHILD_NOTIFY_FIRST_LAST |
- ADD_CHILD_SHOW_ON_SET_PARENT,
-} ClutterActorAddChildFlags;
-
-/*< private >
- * clutter_actor_add_child_internal:
- * @self: a #ClutterActor
- * @child: a #ClutterActor
- * @flags: control flags for actions
- * @add_func: delegate function
- * @data: (closure): data to pass to @add_func
- *
- * Adds @child to the list of children of @self.
- *
- * The actual insertion inside the list is delegated to @add_func: this
- * function will just set up the state, perform basic checks, and emit
- * signals.
- *
- * The @flags argument is used to perform additional operations.
- */
-static inline void
-clutter_actor_add_child_internal (ClutterActor *self,
- ClutterActor *child,
- ClutterActorAddChildFlags flags,
- ClutterActorAddChildFunc add_func,
- gpointer data)
-{
- ClutterTextDirection text_dir;
- gboolean create_meta;
- gboolean emit_parent_set, emit_actor_added;
- gboolean check_state;
- gboolean notify_first_last;
- gboolean show_on_set_parent;
- ClutterActor *old_first_child, *old_last_child;
- GObject *obj;
-
- if (self == child)
- {
- g_warning ("Cannot add the actor '%s' to itself.",
- _clutter_actor_get_debug_name (self));
- return;
- }
-
- if (child->priv->parent != NULL)
- {
- g_warning ("The actor '%s' already has a parent, '%s'. You must "
- "use clutter_actor_remove_child() first.",
- _clutter_actor_get_debug_name (child),
- _clutter_actor_get_debug_name (child->priv->parent));
- return;
- }
-
- if (CLUTTER_ACTOR_IS_TOPLEVEL (child))
- {
- g_warning ("The actor '%s' is a top-level actor, and cannot be "
- "a child of another actor.",
- _clutter_actor_get_debug_name (child));
- return;
- }
-
- /* the following check disallows calling methods that change the stacking
- * order within the destruction sequence, by triggering a critical
- * warning first, and leaving the actor in an undefined state, which
- * then ends up being caught by an assertion.
- *
- * the reproducible sequence is:
- *
- * - actor gets destroyed;
- * - another actor, linked to the first, will try to change the
- * stacking order of the first actor;
- * - changing the stacking order is a composite operation composed
- * by the following steps:
- * 1. ref() the child;
- * 2. remove_child_internal(), which removes the reference;
- * 3. add_child_internal(), which adds a reference;
- * - the state of the actor is not changed between (2) and (3), as
- * it could be an expensive recomputation;
- * - if (3) bails out, then the actor is in an undefined state, but
- * still alive;
- * - the destruction sequence terminates, but the actor is unparented
- * while its state indicates being parented instead.
- * - assertion failure.
- *
- * the obvious fix would be to decompose each set_child_*_sibling()
- * method into proper remove_child()/add_child(), with state validation;
- * this may cause excessive work, though, and trigger a cascade of other
- * bugs in code that assumes that a change in the stacking order is an
- * atomic operation.
- *
- * another potential fix is to just remove this check here, and let
- * code doing stacking order changes inside the destruction sequence
- * of an actor continue doing the stacking changes as before; this
- * option still performs more work than necessary.
- *
- * the third fix is to silently bail out early from every
- * set_child_*_sibling() and set_child_at_index() method, and avoid
- * doing stack changes altogether; Clutter implements this last option.
- *
- * see bug: https://bugzilla.gnome.org/show_bug.cgi?id=670647
- */
- if (CLUTTER_ACTOR_IN_DESTRUCTION (child))
- {
- g_warning ("The actor '%s' is currently being destroyed, and "
- "cannot be added as a child of another actor.",
- _clutter_actor_get_debug_name (child));
- return;
- }
-
- create_meta = (flags & ADD_CHILD_CREATE_META) != 0;
- emit_parent_set = (flags & ADD_CHILD_EMIT_PARENT_SET) != 0;
- emit_actor_added = (flags & ADD_CHILD_EMIT_ACTOR_ADDED) != 0;
- check_state = (flags & ADD_CHILD_CHECK_STATE) != 0;
- notify_first_last = (flags & ADD_CHILD_NOTIFY_FIRST_LAST) != 0;
- show_on_set_parent = (flags & ADD_CHILD_SHOW_ON_SET_PARENT) != 0;
-
- old_first_child = self->priv->first_child;
- old_last_child = self->priv->last_child;
-
- obj = G_OBJECT (self);
- g_object_freeze_notify (obj);
-
- if (create_meta)
- clutter_container_create_child_meta (CLUTTER_CONTAINER (self), child);
-
- g_object_ref_sink (child);
- child->priv->parent = NULL;
- child->priv->next_sibling = NULL;
- child->priv->prev_sibling = NULL;
-
- /* delegate the actual insertion */
- add_func (self, child, data);
-
- g_assert (child->priv->parent == self);
-
- self->priv->n_children += 1;
-
- self->priv->age += 1;
-
- if (self->priv->in_cloned_branch)
- clutter_actor_push_in_cloned_branch (child, self->priv->in_cloned_branch);
-
- if (self->priv->unmapped_paint_branch_counter)
- push_in_paint_unmapped_branch (child, self->priv->unmapped_paint_branch_counter);
-
- /* children may cause their parent to expand, if they are set
- * to expand; if a child is not expanded then it cannot change
- * its parent's state. any further change later on will queue
- * an expand state check.
- *
- * this check, with the initial state of the needs_compute_expand
- * flag set to FALSE, should avoid recomputing the expand flags
- * state while building the actor tree.
- */
- if (CLUTTER_ACTOR_IS_VISIBLE (child) &&
- (child->priv->needs_compute_expand ||
- child->priv->needs_x_expand ||
- child->priv->needs_y_expand))
- {
- clutter_actor_queue_compute_expand (self);
- }
-
- if (emit_parent_set)
- g_signal_emit (child, actor_signals[PARENT_SET], 0, NULL);
-
- if (check_state)
- {
- /* If parent is mapped or realized, we need to also be mapped or
- * realized once we're inside the parent.
- */
- clutter_actor_update_map_state (child, MAP_STATE_CHECK);
-
- /* propagate the parent's text direction to the child */
- text_dir = clutter_actor_get_text_direction (self);
- clutter_actor_set_text_direction (child, text_dir);
- }
-
- /* this may end up queueing a redraw, in case the actor is
- * not visible but the show-on-set-parent property is still
- * set.
- *
- * XXX:2.0 - remove this check and unconditionally show() the
- * actor once we remove the show-on-set-parent property
- */
- if (show_on_set_parent && child->priv->show_on_set_parent)
- clutter_actor_show (child);
-
- /* on the other hand, this will catch any other case where
- * the actor is supposed to be visible when it's added
- */
- if (CLUTTER_ACTOR_IS_MAPPED (child))
- clutter_actor_queue_redraw (child);
-
- if (emit_actor_added)
- _clutter_container_emit_actor_added (CLUTTER_CONTAINER (self), child);
-
- if (notify_first_last)
- {
- if (old_first_child != self->priv->first_child)
- g_object_notify_by_pspec (obj, obj_props[PROP_FIRST_CHILD]);
-
- if (old_last_child != self->priv->last_child)
- g_object_notify_by_pspec (obj, obj_props[PROP_LAST_CHILD]);
- }
-
- g_object_thaw_notify (obj);
-}
-
-/**
- * clutter_actor_add_child:
- * @self: a #ClutterActor
- * @child: a #ClutterActor
- *
- * Adds @child to the children of @self.
- *
- * This function will acquire a reference on @child that will only
- * be released when calling clutter_actor_remove_child().
- *
- * This function will take into consideration the #ClutterActor:depth
- * of @child, and will keep the list of children sorted.
- *
- * This function will emit the #ClutterContainer::actor-added signal
- * on @self.
- *
- * Since: 1.10
- */
-void
-clutter_actor_add_child (ClutterActor *self,
- ClutterActor *child)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (CLUTTER_IS_ACTOR (child));
- g_return_if_fail (self != child);
- g_return_if_fail (child->priv->parent == NULL);
-
- clutter_actor_add_child_internal (self, child,
- ADD_CHILD_DEFAULT_FLAGS,
- insert_child_at_depth,
- NULL);
-}
-
-/**
- * clutter_actor_insert_child_at_index:
- * @self: a #ClutterActor
- * @child: a #ClutterActor
- * @index_: the index
- *
- * Inserts @child into the list of children of @self, using the
- * given @index_. If @index_ is greater than the number of children
- * in @self, or is less than 0, then the new child is added at the end.
- *
- * This function will acquire a reference on @child that will only
- * be released when calling clutter_actor_remove_child().
- *
- * This function will not take into consideration the #ClutterActor:depth
- * of @child.
- *
- * This function will emit the #ClutterContainer::actor-added signal
- * on @self.
- *
- * Since: 1.10
- */
-void
-clutter_actor_insert_child_at_index (ClutterActor *self,
- ClutterActor *child,
- gint index_)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (CLUTTER_IS_ACTOR (child));
- g_return_if_fail (self != child);
- g_return_if_fail (child->priv->parent == NULL);
-
- clutter_actor_add_child_internal (self, child,
- ADD_CHILD_DEFAULT_FLAGS,
- insert_child_at_index,
- GINT_TO_POINTER (index_));
-}
-
-/**
- * clutter_actor_insert_child_above:
- * @self: a #ClutterActor
- * @child: a #ClutterActor
- * @sibling: (allow-none): a child of @self, or %NULL
- *
- * Inserts @child into the list of children of @self, above another
- * child of @self or, if @sibling is %NULL, above all the children
- * of @self.
- *
- * This function will acquire a reference on @child that will only
- * be released when calling clutter_actor_remove_child().
- *
- * This function will not take into consideration the #ClutterActor:depth
- * of @child.
- *
- * This function will emit the #ClutterContainer::actor-added signal
- * on @self.
- *
- * Since: 1.10
- */
-void
-clutter_actor_insert_child_above (ClutterActor *self,
- ClutterActor *child,
- ClutterActor *sibling)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (CLUTTER_IS_ACTOR (child));
- g_return_if_fail (self != child);
- g_return_if_fail (child != sibling);
- g_return_if_fail (child->priv->parent == NULL);
- g_return_if_fail (sibling == NULL ||
- (CLUTTER_IS_ACTOR (sibling) &&
- sibling->priv->parent == self));
-
- clutter_actor_add_child_internal (self, child,
- ADD_CHILD_DEFAULT_FLAGS,
- insert_child_above,
- sibling);
-}
-
-/**
- * clutter_actor_insert_child_below:
- * @self: a #ClutterActor
- * @child: a #ClutterActor
- * @sibling: (allow-none): a child of @self, or %NULL
- *
- * Inserts @child into the list of children of @self, below another
- * child of @self or, if @sibling is %NULL, below all the children
- * of @self.
- *
- * This function will acquire a reference on @child that will only
- * be released when calling clutter_actor_remove_child().
- *
- * This function will not take into consideration the #ClutterActor:depth
- * of @child.
- *
- * This function will emit the #ClutterContainer::actor-added signal
- * on @self.
- *
- * Since: 1.10
- */
-void
-clutter_actor_insert_child_below (ClutterActor *self,
- ClutterActor *child,
- ClutterActor *sibling)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (CLUTTER_IS_ACTOR (child));
- g_return_if_fail (self != child);
- g_return_if_fail (child != sibling);
- g_return_if_fail (child->priv->parent == NULL);
- g_return_if_fail (sibling == NULL ||
- (CLUTTER_IS_ACTOR (sibling) &&
- sibling->priv->parent == self));
-
- clutter_actor_add_child_internal (self, child,
- ADD_CHILD_DEFAULT_FLAGS,
- insert_child_below,
- sibling);
-}
-
-/**
- * clutter_actor_get_parent:
- * @self: A #ClutterActor
- *
- * Retrieves the parent of @self.
- *
- * Return Value: (transfer none): The #ClutterActor parent, or %NULL
- * if no parent is set
- */
-ClutterActor *
-clutter_actor_get_parent (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
-
- return self->priv->parent;
-}
-
-/**
- * clutter_actor_get_paint_visibility:
- * @self: A #ClutterActor
- *
- * Retrieves the 'paint' visibility of an actor recursively checking for non
- * visible parents.
- *
- * This is by definition the same as %CLUTTER_ACTOR_IS_MAPPED.
- *
- * Return Value: %TRUE if the actor is visible and will be painted.
- *
- * Since: 0.8
- */
-gboolean
-clutter_actor_get_paint_visibility (ClutterActor *actor)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), FALSE);
-
- return CLUTTER_ACTOR_IS_MAPPED (actor);
-}
-
-/**
- * clutter_actor_remove_child:
- * @self: a #ClutterActor
- * @child: a #ClutterActor
- *
- * Removes @child from the children of @self.
- *
- * This function will release the reference added by
- * clutter_actor_add_child(), so if you want to keep using @child
- * you will have to acquire a referenced on it before calling this
- * function.
- *
- * This function will emit the #ClutterContainer::actor-removed
- * signal on @self.
- *
- * Since: 1.10
- */
-void
-clutter_actor_remove_child (ClutterActor *self,
- ClutterActor *child)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (CLUTTER_IS_ACTOR (child));
- g_return_if_fail (self != child);
- g_return_if_fail (child->priv->parent != NULL);
- g_return_if_fail (child->priv->parent == self);
-
- clutter_actor_remove_child_internal (self, child,
- REMOVE_CHILD_DEFAULT_FLAGS);
-}
-
-/**
- * clutter_actor_remove_all_children:
- * @self: a #ClutterActor
- *
- * Removes all children of @self.
- *
- * This function releases the reference added by inserting a child actor
- * in the list of children of @self.
- *
- * If the reference count of a child drops to zero, the child will be
- * destroyed. If you want to ensure the destruction of all the children
- * of @self, use clutter_actor_destroy_all_children().
- *
- * Since: 1.10
- */
-void
-clutter_actor_remove_all_children (ClutterActor *self)
-{
- ClutterActorIter iter;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- if (self->priv->n_children == 0)
- return;
-
- g_object_freeze_notify (G_OBJECT (self));
-
- clutter_actor_iter_init (&iter, self);
- while (clutter_actor_iter_next (&iter, NULL))
- clutter_actor_iter_remove (&iter);
-
- g_object_thaw_notify (G_OBJECT (self));
-
- /* sanity check */
- g_assert (self->priv->first_child == NULL);
- g_assert (self->priv->last_child == NULL);
- g_assert (self->priv->n_children == 0);
-}
-
-/**
- * clutter_actor_destroy_all_children:
- * @self: a #ClutterActor
- *
- * Destroys all children of @self.
- *
- * This function releases the reference added by inserting a child
- * actor in the list of children of @self, and ensures that the
- * #ClutterActor::destroy signal is emitted on each child of the
- * actor.
- *
- * By default, #ClutterActor will emit the #ClutterActor::destroy signal
- * when its reference count drops to 0; the default handler of the
- * #ClutterActor::destroy signal will destroy all the children of an
- * actor. This function ensures that all children are destroyed, instead
- * of just removed from @self, unlike clutter_actor_remove_all_children()
- * which will merely release the reference and remove each child.
- *
- * Unless you acquired an additional reference on each child of @self
- * prior to calling clutter_actor_remove_all_children() and want to reuse
- * the actors, you should use clutter_actor_destroy_all_children() in
- * order to make sure that children are destroyed and signal handlers
- * are disconnected even in cases where circular references prevent this
- * from automatically happening through reference counting alone.
- *
- * Since: 1.10
- */
-void
-clutter_actor_destroy_all_children (ClutterActor *self)
-{
- ClutterActorIter iter;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- if (self->priv->n_children == 0)
- return;
-
- g_object_freeze_notify (G_OBJECT (self));
-
- clutter_actor_iter_init (&iter, self);
- while (clutter_actor_iter_next (&iter, NULL))
- clutter_actor_iter_destroy (&iter);
-
- g_object_thaw_notify (G_OBJECT (self));
-
- /* sanity check */
- g_assert (self->priv->first_child == NULL);
- g_assert (self->priv->last_child == NULL);
- g_assert (self->priv->n_children == 0);
-}
-
-typedef struct _InsertBetweenData {
- ClutterActor *prev_sibling;
- ClutterActor *next_sibling;
-} InsertBetweenData;
-
-static void
-insert_child_between (ClutterActor *self,
- ClutterActor *child,
- gpointer data_)
-{
- InsertBetweenData *data = data_;
- ClutterActor *prev_sibling = data->prev_sibling;
- ClutterActor *next_sibling = data->next_sibling;
-
- child->priv->parent = self;
- child->priv->prev_sibling = prev_sibling;
- child->priv->next_sibling = next_sibling;
-
- if (prev_sibling != NULL)
- prev_sibling->priv->next_sibling = child;
-
- if (next_sibling != NULL)
- next_sibling->priv->prev_sibling = child;
-
- if (child->priv->prev_sibling == NULL)
- self->priv->first_child = child;
-
- if (child->priv->next_sibling == NULL)
- self->priv->last_child = child;
-}
-
-/**
- * clutter_actor_replace_child:
- * @self: a #ClutterActor
- * @old_child: the child of @self to replace
- * @new_child: the #ClutterActor to replace @old_child
- *
- * Replaces @old_child with @new_child in the list of children of @self.
- *
- * Since: 1.10
- */
-void
-clutter_actor_replace_child (ClutterActor *self,
- ClutterActor *old_child,
- ClutterActor *new_child)
-{
- ClutterActor *prev_sibling, *next_sibling;
- InsertBetweenData clos;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (CLUTTER_IS_ACTOR (old_child));
- g_return_if_fail (old_child->priv->parent == self);
- g_return_if_fail (CLUTTER_IS_ACTOR (new_child));
- g_return_if_fail (old_child != new_child);
- g_return_if_fail (new_child != self);
- g_return_if_fail (new_child->priv->parent == NULL);
-
- prev_sibling = old_child->priv->prev_sibling;
- next_sibling = old_child->priv->next_sibling;
- clutter_actor_remove_child_internal (self, old_child,
- REMOVE_CHILD_DEFAULT_FLAGS);
-
- clos.prev_sibling = prev_sibling;
- clos.next_sibling = next_sibling;
- clutter_actor_add_child_internal (self, new_child,
- ADD_CHILD_DEFAULT_FLAGS,
- insert_child_between,
- &clos);
-}
-
-/**
- * clutter_actor_contains:
- * @self: A #ClutterActor
- * @descendant: A #ClutterActor, possibly contained in @self
- *
- * Determines if @descendant is contained inside @self (either as an
- * immediate child, or as a deeper descendant). If @self and
- * @descendant point to the same actor then it will also return %TRUE.
- *
- * Return value: whether @descendent is contained within @self
- *
- * Since: 1.4
- */
-gboolean
-clutter_actor_contains (ClutterActor *self,
- ClutterActor *descendant)
-{
- ClutterActor *actor;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
- g_return_val_if_fail (CLUTTER_IS_ACTOR (descendant), FALSE);
-
- for (actor = descendant; actor; actor = actor->priv->parent)
- if (actor == self)
- return TRUE;
-
- return FALSE;
-}
-
-/**
- * clutter_actor_set_child_above_sibling:
- * @self: a #ClutterActor
- * @child: a #ClutterActor child of @self
- * @sibling: (allow-none): a #ClutterActor child of @self, or %NULL
- *
- * Sets @child to be above @sibling in the list of children of @self.
- *
- * If @sibling is %NULL, @child will be the new last child of @self.
- *
- * This function is logically equivalent to removing @child and using
- * clutter_actor_insert_child_above(), but it will not emit signals
- * or change state on @child.
- *
- * Since: 1.10
- */
-void
-clutter_actor_set_child_above_sibling (ClutterActor *self,
- ClutterActor *child,
- ClutterActor *sibling)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (CLUTTER_IS_ACTOR (child));
- g_return_if_fail (child->priv->parent == self);
- g_return_if_fail (child != sibling);
- g_return_if_fail (sibling == NULL || CLUTTER_IS_ACTOR (sibling));
-
- if (sibling != NULL)
- g_return_if_fail (sibling->priv->parent == self);
-
- if (CLUTTER_ACTOR_IN_DESTRUCTION (self) ||
- CLUTTER_ACTOR_IN_DESTRUCTION (child) ||
- (sibling != NULL && CLUTTER_ACTOR_IN_DESTRUCTION (sibling)))
- return;
-
- /* we don't want to change the state of child, or emit signals, or
- * regenerate ChildMeta instances here, but we still want to follow
- * the correct sequence of steps encoded in remove_child() and
- * add_child(), so that correctness is ensured, and we only go
- * through one known code path.
- */
- g_object_ref (child);
- clutter_actor_remove_child_internal (self, child, 0);
- clutter_actor_add_child_internal (self, child,
- ADD_CHILD_NOTIFY_FIRST_LAST,
- insert_child_above,
- sibling);
- g_object_unref(child);
-
- clutter_actor_queue_relayout (self);
-}
-
-/**
- * clutter_actor_set_child_below_sibling:
- * @self: a #ClutterActor
- * @child: a #ClutterActor child of @self
- * @sibling: (allow-none): a #ClutterActor child of @self, or %NULL
- *
- * Sets @child to be below @sibling in the list of children of @self.
- *
- * If @sibling is %NULL, @child will be the new first child of @self.
- *
- * This function is logically equivalent to removing @self and using
- * clutter_actor_insert_child_below(), but it will not emit signals
- * or change state on @child.
- *
- * Since: 1.10
- */
-void
-clutter_actor_set_child_below_sibling (ClutterActor *self,
- ClutterActor *child,
- ClutterActor *sibling)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (CLUTTER_IS_ACTOR (child));
- g_return_if_fail (child->priv->parent == self);
- g_return_if_fail (child != sibling);
- g_return_if_fail (sibling == NULL || CLUTTER_IS_ACTOR (sibling));
-
- if (sibling != NULL)
- g_return_if_fail (sibling->priv->parent == self);
-
- if (CLUTTER_ACTOR_IN_DESTRUCTION (self) ||
- CLUTTER_ACTOR_IN_DESTRUCTION (child) ||
- (sibling != NULL && CLUTTER_ACTOR_IN_DESTRUCTION (sibling)))
- return;
-
- /* see the comment in set_child_above_sibling() */
- g_object_ref (child);
- clutter_actor_remove_child_internal (self, child, 0);
- clutter_actor_add_child_internal (self, child,
- ADD_CHILD_NOTIFY_FIRST_LAST,
- insert_child_below,
- sibling);
- g_object_unref(child);
-
- clutter_actor_queue_relayout (self);
-}
-
-/**
- * clutter_actor_set_child_at_index:
- * @self: a #ClutterActor
- * @child: a #ClutterActor child of @self
- * @index_: the new index for @child
- *
- * Changes the index of @child in the list of children of @self.
- *
- * This function is logically equivalent to removing @child and
- * calling clutter_actor_insert_child_at_index(), but it will not
- * emit signals or change state on @child.
- *
- * Since: 1.10
- */
-void
-clutter_actor_set_child_at_index (ClutterActor *self,
- ClutterActor *child,
- gint index_)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (CLUTTER_IS_ACTOR (child));
- g_return_if_fail (child->priv->parent == self);
- g_return_if_fail (index_ <= self->priv->n_children);
-
- if (CLUTTER_ACTOR_IN_DESTRUCTION (self) ||
- CLUTTER_ACTOR_IN_DESTRUCTION (child))
- return;
-
- g_object_ref (child);
- clutter_actor_remove_child_internal (self, child, 0);
- clutter_actor_add_child_internal (self, child,
- ADD_CHILD_NOTIFY_FIRST_LAST,
- insert_child_at_index,
- GINT_TO_POINTER (index_));
- g_object_unref (child);
-
- clutter_actor_queue_relayout (self);
-}
-
-/*
- * Event handling
- */
-
-/**
- * clutter_actor_event:
- * @actor: a #ClutterActor
- * @event: a #ClutterEvent
- * @capture: %TRUE if event in in capture phase, %FALSE otherwise.
- *
- * This function is used to emit an event on the main stage.
- * You should rarely need to use this function, except for
- * synthetising events.
- *
- * Return value: the return value from the signal emission: %TRUE
- * if the actor handled the event, or %FALSE if the event was
- * not handled
- *
- * Since: 0.6
- */
-gboolean
-clutter_actor_event (ClutterActor *actor,
- const ClutterEvent *event,
- gboolean capture)
-{
- gboolean retval = FALSE;
- gint signal_num = -1;
- GQuark detail = 0;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- g_object_ref (actor);
-
- switch (event->type)
- {
- case CLUTTER_NOTHING:
- break;
- case CLUTTER_BUTTON_PRESS:
- signal_num = BUTTON_PRESS_EVENT;
- detail = quark_button;
- break;
- case CLUTTER_BUTTON_RELEASE:
- signal_num = BUTTON_RELEASE_EVENT;
- detail = quark_button;
- break;
- case CLUTTER_SCROLL:
- signal_num = SCROLL_EVENT;
- detail = quark_scroll;
- break;
- case CLUTTER_KEY_PRESS:
- signal_num = KEY_PRESS_EVENT;
- detail = quark_key;
- break;
- case CLUTTER_KEY_RELEASE:
- signal_num = KEY_RELEASE_EVENT;
- detail = quark_key;
- break;
- case CLUTTER_MOTION:
- signal_num = MOTION_EVENT;
- detail = quark_motion;
- break;
- case CLUTTER_ENTER:
- signal_num = ENTER_EVENT;
- detail = quark_pointer_focus;
- break;
- case CLUTTER_LEAVE:
- signal_num = LEAVE_EVENT;
- detail = quark_pointer_focus;
- break;
- case CLUTTER_TOUCH_BEGIN:
- case CLUTTER_TOUCH_END:
- case CLUTTER_TOUCH_UPDATE:
- case CLUTTER_TOUCH_CANCEL:
- signal_num = TOUCH_EVENT;
- detail = quark_touch;
- break;
- case CLUTTER_TOUCHPAD_PINCH:
- case CLUTTER_TOUCHPAD_SWIPE:
- signal_num = -1;
- detail = quark_touchpad;
- break;
- case CLUTTER_PROXIMITY_IN:
- case CLUTTER_PROXIMITY_OUT:
- signal_num = -1;
- detail = quark_proximity;
- break;
- case CLUTTER_PAD_BUTTON_PRESS:
- case CLUTTER_PAD_BUTTON_RELEASE:
- case CLUTTER_PAD_STRIP:
- case CLUTTER_PAD_RING:
- signal_num = -1;
- detail = quark_pad;
- break;
- case CLUTTER_IM_COMMIT:
- case CLUTTER_IM_DELETE:
- case CLUTTER_IM_PREEDIT:
- signal_num = -1;
- detail = quark_im;
- case CLUTTER_DEVICE_ADDED:
- case CLUTTER_DEVICE_REMOVED:
- break;
- case CLUTTER_EVENT_LAST: /* Just keep compiler warnings quiet */
- break;
- }
-
- if (capture)
- g_signal_emit (actor, actor_signals[CAPTURED_EVENT], detail, event, &retval);
- else
- {
- g_signal_emit (actor, actor_signals[EVENT], 0, event, &retval);
-
- if (!retval && signal_num != -1)
- g_signal_emit (actor, actor_signals[signal_num], 0, event, &retval);
- }
-
- g_object_unref (actor);
-
- return retval;
-}
-
-/**
- * clutter_actor_set_reactive:
- * @actor: a #ClutterActor
- * @reactive: whether the actor should be reactive to events
- *
- * Sets @actor as reactive. Reactive actors will receive events.
- *
- * Since: 0.6
- */
-void
-clutter_actor_set_reactive (ClutterActor *actor,
- gboolean reactive)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (actor));
-
- if (reactive == CLUTTER_ACTOR_IS_REACTIVE (actor))
- return;
-
- if (reactive)
- CLUTTER_ACTOR_SET_FLAGS (actor, CLUTTER_ACTOR_REACTIVE);
- else
- CLUTTER_ACTOR_UNSET_FLAGS (actor, CLUTTER_ACTOR_REACTIVE);
-
- g_object_notify_by_pspec (G_OBJECT (actor), obj_props[PROP_REACTIVE]);
-}
-
-/**
- * clutter_actor_get_reactive:
- * @actor: a #ClutterActor
- *
- * Checks whether @actor is marked as reactive.
- *
- * Return value: %TRUE if the actor is reactive
- *
- * Since: 0.6
- */
-gboolean
-clutter_actor_get_reactive (ClutterActor *actor)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), FALSE);
-
- return CLUTTER_ACTOR_IS_REACTIVE (actor) ? TRUE : FALSE;
-}
-
-static void
-clutter_actor_store_content_box (ClutterActor *self,
- const ClutterActorBox *box)
-{
- if (box != NULL)
- {
- self->priv->content_box = *box;
- self->priv->content_box_valid = TRUE;
- }
- else
- self->priv->content_box_valid = FALSE;
-
- clutter_actor_queue_redraw (self);
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_CONTENT_BOX]);
-}
-
-static void
-clutter_container_iface_init (ClutterContainerIface *iface)
-{
- /* we don't override anything, as ClutterContainer already has a default
- * implementation that we can use, and which calls into our own API.
- */
-}
-
-typedef enum
-{
- PARSE_X,
- PARSE_Y,
- PARSE_WIDTH,
- PARSE_HEIGHT,
-} ParseDimension;
-
-static gfloat
-parse_units (ClutterActor *self,
- ParseDimension dimension,
- JsonNode *node)
-{
- GValue value = G_VALUE_INIT;
- gfloat retval = 0;
-
- if (JSON_NODE_TYPE (node) != JSON_NODE_VALUE)
- return 0;
-
- json_node_get_value (node, &value);
-
- if (G_VALUE_HOLDS (&value, G_TYPE_INT64))
- {
- retval = (gfloat) g_value_get_int64 (&value);
- }
- else if (G_VALUE_HOLDS (&value, G_TYPE_DOUBLE))
- {
- retval = g_value_get_double (&value);
- }
- else if (G_VALUE_HOLDS (&value, G_TYPE_STRING))
- {
- ClutterUnits units;
- gboolean res;
-
- res = clutter_units_from_string (&units, g_value_get_string (&value));
- if (res)
- retval = clutter_units_to_pixels (&units);
- else
- {
- g_warning ("Invalid value '%s': integers, strings or floating point "
- "values can be used for the x, y, width and height "
- "properties. Valid modifiers for strings are 'px', 'mm', "
- "'pt' and 'em'.",
- g_value_get_string (&value));
- retval = 0;
- }
- }
- else
- {
- g_warning ("Invalid value of type '%s': integers, strings of floating "
- "point values can be used for the x, y, width, and height "
- "properties.",
- g_type_name (G_VALUE_TYPE (&value)));
- }
-
- g_value_unset (&value);
-
- return retval;
-}
-
-typedef struct {
- ClutterRotateAxis axis;
-
- gdouble angle;
-
- gfloat center_x;
- gfloat center_y;
- gfloat center_z;
-} RotationInfo;
-
-static inline gboolean
-parse_rotation_array (ClutterActor *actor,
- JsonArray *array,
- RotationInfo *info)
-{
- JsonNode *element;
-
- if (json_array_get_length (array) != 2)
- return FALSE;
-
- /* angle */
- element = json_array_get_element (array, 0);
- if (JSON_NODE_TYPE (element) == JSON_NODE_VALUE)
- info->angle = json_node_get_double (element);
- else
- return FALSE;
-
- /* center */
- element = json_array_get_element (array, 1);
- if (JSON_NODE_TYPE (element) == JSON_NODE_ARRAY)
- {
- JsonArray *center = json_node_get_array (element);
-
- if (json_array_get_length (center) != 2)
- return FALSE;
-
- switch (info->axis)
- {
- case CLUTTER_X_AXIS:
- info->center_y = parse_units (actor, PARSE_Y,
- json_array_get_element (center, 0));
- info->center_z = parse_units (actor, PARSE_Y,
- json_array_get_element (center, 1));
- return TRUE;
-
- case CLUTTER_Y_AXIS:
- info->center_x = parse_units (actor, PARSE_X,
- json_array_get_element (center, 0));
- info->center_z = parse_units (actor, PARSE_X,
- json_array_get_element (center, 1));
- return TRUE;
-
- case CLUTTER_Z_AXIS:
- info->center_x = parse_units (actor, PARSE_X,
- json_array_get_element (center, 0));
- info->center_y = parse_units (actor, PARSE_Y,
- json_array_get_element (center, 1));
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-static gboolean
-parse_rotation (ClutterActor *actor,
- JsonNode *node,
- RotationInfo *info)
-{
- JsonArray *array;
- guint len, i;
- gboolean retval = FALSE;
-
- if (JSON_NODE_TYPE (node) != JSON_NODE_ARRAY)
- {
- g_warning ("Invalid node of type '%s' found, expecting an array",
- json_node_type_name (node));
- return FALSE;
- }
-
- array = json_node_get_array (node);
- len = json_array_get_length (array);
-
- for (i = 0; i < len; i++)
- {
- JsonNode *element = json_array_get_element (array, i);
- JsonObject *object;
- JsonNode *member;
-
- if (JSON_NODE_TYPE (element) != JSON_NODE_OBJECT)
- {
- g_warning ("Invalid node of type '%s' found, expecting an object",
- json_node_type_name (element));
- return FALSE;
- }
-
- object = json_node_get_object (element);
-
- if (json_object_has_member (object, "x-axis"))
- {
- member = json_object_get_member (object, "x-axis");
-
- info->axis = CLUTTER_X_AXIS;
-
- if (JSON_NODE_TYPE (member) == JSON_NODE_VALUE)
- {
- info->angle = json_node_get_double (member);
- retval = TRUE;
- }
- else if (JSON_NODE_TYPE (member) == JSON_NODE_ARRAY)
- retval = parse_rotation_array (actor,
- json_node_get_array (member),
- info);
- else
- retval = FALSE;
- }
- else if (json_object_has_member (object, "y-axis"))
- {
- member = json_object_get_member (object, "y-axis");
-
- info->axis = CLUTTER_Y_AXIS;
-
- if (JSON_NODE_TYPE (member) == JSON_NODE_VALUE)
- {
- info->angle = json_node_get_double (member);
- retval = TRUE;
- }
- else if (JSON_NODE_TYPE (member) == JSON_NODE_ARRAY)
- retval = parse_rotation_array (actor,
- json_node_get_array (member),
- info);
- else
- retval = FALSE;
- }
- else if (json_object_has_member (object, "z-axis"))
- {
- member = json_object_get_member (object, "z-axis");
-
- info->axis = CLUTTER_Z_AXIS;
-
- if (JSON_NODE_TYPE (member) == JSON_NODE_VALUE)
- {
- info->angle = json_node_get_double (member);
- retval = TRUE;
- }
- else if (JSON_NODE_TYPE (member) == JSON_NODE_ARRAY)
- retval = parse_rotation_array (actor,
- json_node_get_array (member),
- info);
- else
- retval = FALSE;
- }
- }
-
- return retval;
-}
-
-static GSList *
-parse_actor_metas (ClutterScript *script,
- ClutterActor *actor,
- JsonNode *node)
-{
- GList *elements, *l;
- GSList *retval = NULL;
-
- if (!JSON_NODE_HOLDS_ARRAY (node))
- return NULL;
-
- elements = json_array_get_elements (json_node_get_array (node));
-
- for (l = elements; l != NULL; l = l->next)
- {
- JsonNode *element = l->data;
- const gchar *id_ = _clutter_script_get_id_from_node (element);
- GObject *meta;
-
- if (id_ == NULL || *id_ == '\0')
- continue;
-
- meta = clutter_script_get_object (script, id_);
- if (meta == NULL)
- continue;
-
- retval = g_slist_prepend (retval, meta);
- }
-
- g_list_free (elements);
-
- return g_slist_reverse (retval);
-}
-
-static ClutterMargin *
-parse_margin (ClutterActor *self,
- JsonNode *node)
-{
- ClutterMargin *margin;
- JsonArray *array;
-
- if (!JSON_NODE_HOLDS_ARRAY (node))
- {
- g_warning ("The margin property must be an array of 1 to 4 elements");
- return NULL;
- }
-
- margin = clutter_margin_new ();
- array = json_node_get_array (node);
- switch (json_array_get_length (array))
- {
- case 1:
- margin->top = margin->right = margin->bottom = margin->left =
- parse_units (self, 0, json_array_get_element (array, 0));
- break;
-
- case 2:
- margin->top = margin->bottom =
- parse_units (self, 0, json_array_get_element (array, 0));
- margin->right = margin->left =
- parse_units (self, 0, json_array_get_element (array, 1));
- break;
-
- case 3:
- margin->top =
- parse_units (self, 0, json_array_get_element (array, 0));
- margin->right = margin->left =
- parse_units (self, 0, json_array_get_element (array, 1));
- margin->bottom =
- parse_units (self, 0, json_array_get_element (array, 2));
- break;
-
- case 4:
- margin->top =
- parse_units (self, 0, json_array_get_element (array, 0));
- margin->right =
- parse_units (self, 0, json_array_get_element (array, 1));
- margin->bottom =
- parse_units (self, 0, json_array_get_element (array, 2));
- margin->left =
- parse_units (self, 0, json_array_get_element (array, 3));
- break;
-
- default:
- g_warning ("The margin property must be an array of 1 to 4 elements");
- clutter_margin_free (margin);
- return NULL;
- }
- return margin;
-}
-
-static gboolean
-clutter_actor_parse_custom_node (ClutterScriptable *scriptable,
- ClutterScript *script,
- GValue *value,
- const gchar *name,
- JsonNode *node)
-{
- ClutterActor *actor = CLUTTER_ACTOR (scriptable);
- gboolean retval = FALSE;
-
- if ((name[0] == 'x' && name[1] == '\0') ||
- (name[0] == 'y' && name[1] == '\0') ||
- (strcmp (name, "width") == 0) ||
- (strcmp (name, "height") == 0))
- {
- ParseDimension dimension;
- gfloat units;
-
- if (name[0] == 'x')
- dimension = PARSE_X;
- else if (name[0] == 'y')
- dimension = PARSE_Y;
- else if (name[0] == 'w')
- dimension = PARSE_WIDTH;
- else if (name[0] == 'h')
- dimension = PARSE_HEIGHT;
- else
- return FALSE;
-
- units = parse_units (actor, dimension, node);
-
- /* convert back to pixels: all properties are pixel-based */
- g_value_init (value, G_TYPE_FLOAT);
- g_value_set_float (value, units);
-
- retval = TRUE;
- }
- else if (strcmp (name, "rotation") == 0)
- {
- RotationInfo *info;
-
- info = g_new0 (RotationInfo, 1);
- retval = parse_rotation (actor, node, info);
-
- if (retval)
- {
- g_value_init (value, G_TYPE_POINTER);
- g_value_set_pointer (value, info);
- }
- else
- g_free (info);
- }
- else if (strcmp (name, "actions") == 0 ||
- strcmp (name, "constraints") == 0 ||
- strcmp (name, "effects") == 0)
- {
- GSList *l;
-
- l = parse_actor_metas (script, actor, node);
-
- g_value_init (value, G_TYPE_POINTER);
- g_value_set_pointer (value, l);
-
- retval = TRUE;
- }
- else if (strcmp (name, "margin") == 0)
- {
- ClutterMargin *margin = parse_margin (actor, node);
-
- if (margin)
- {
- g_value_init (value, CLUTTER_TYPE_MARGIN);
- g_value_set_boxed (value, margin);
- retval = TRUE;
- }
- }
-
- return retval;
-}
-
-static void
-clutter_actor_set_custom_property (ClutterScriptable *scriptable,
- ClutterScript *script,
- const gchar *name,
- const GValue *value)
-{
- ClutterActor *actor = CLUTTER_ACTOR (scriptable);
-
-#ifdef CLUTTER_ENABLE_DEBUG
- if (G_UNLIKELY (CLUTTER_HAS_DEBUG (SCRIPT)))
- {
- gchar *tmp = g_strdup_value_contents (value);
-
- CLUTTER_NOTE (SCRIPT,
- "in ClutterActor::set_custom_property('%s') = %s",
- name,
- tmp);
-
- g_free (tmp);
- }
-#endif /* CLUTTER_ENABLE_DEBUG */
-
- if (strcmp (name, "rotation") == 0)
- {
- RotationInfo *info;
-
- if (!G_VALUE_HOLDS (value, G_TYPE_POINTER))
- return;
-
- info = g_value_get_pointer (value);
-
- clutter_actor_set_rotation_angle (actor, info->axis, info->angle);
-
- g_free (info);
-
- return;
- }
-
- if (strcmp (name, "actions") == 0 ||
- strcmp (name, "constraints") == 0 ||
- strcmp (name, "effects") == 0)
- {
- GSList *metas, *l;
-
- if (!G_VALUE_HOLDS (value, G_TYPE_POINTER))
- return;
-
- metas = g_value_get_pointer (value);
- for (l = metas; l != NULL; l = l->next)
- {
- if (name[0] == 'a')
- clutter_actor_add_action (actor, l->data);
-
- if (name[0] == 'c')
- clutter_actor_add_constraint (actor, l->data);
-
- if (name[0] == 'e')
- clutter_actor_add_effect (actor, l->data);
- }
-
- g_slist_free (metas);
-
- return;
- }
- if (strcmp (name, "margin") == 0)
- {
- clutter_actor_set_margin (actor, g_value_get_boxed (value));
- return;
- }
-
- g_object_set_property (G_OBJECT (scriptable), name, value);
-}
-
-static void
-clutter_scriptable_iface_init (ClutterScriptableIface *iface)
-{
- iface->parse_custom_node = clutter_actor_parse_custom_node;
- iface->set_custom_property = clutter_actor_set_custom_property;
-}
-
-static gboolean
-get_layout_from_animation_property (ClutterActor *actor,
- const gchar *name,
- gchar **name_p)
-{
- g_auto (GStrv) tokens = NULL;
-
- if (!g_str_has_prefix (name, "@layout"))
- return FALSE;
-
- tokens = g_strsplit (name, ".", -1);
- if (tokens == NULL || g_strv_length (tokens) != 2)
- {
- CLUTTER_NOTE (ANIMATION, "Invalid property name '%s'",
- name + 1);
- return FALSE;
- }
-
- if (name_p != NULL)
- *name_p = g_strdup (tokens[1]);
-
- return TRUE;
-}
-
-static gboolean
-get_content_from_animation_property (ClutterActor *actor,
- const gchar *name,
- gchar **name_p)
-{
- g_auto (GStrv) tokens = NULL;
-
- if (!g_str_has_prefix (name, "@content"))
- return FALSE;
-
- if (!actor->priv->content)
- {
- CLUTTER_NOTE (ANIMATION, "No ClutterContent available for '%s'",
- name + 1);
- return FALSE;
- }
-
- tokens = g_strsplit (name, ".", -1);
- if (tokens == NULL || g_strv_length (tokens) != 2)
- {
- CLUTTER_NOTE (ANIMATION, "Invalid property name '%s'",
- name + 1);
- return FALSE;
- }
-
- if (name_p != NULL)
- *name_p = g_strdup (tokens[1]);
-
- return TRUE;
-}
-
-static ClutterActorMeta *
-get_meta_from_animation_property (ClutterActor *actor,
- const gchar *name,
- gchar **name_p)
-{
- ClutterActorPrivate *priv = actor->priv;
- ClutterActorMeta *meta = NULL;
- gchar **tokens;
-
- /* if this is not a special property, fall through */
- if (name[0] != '@')
- return NULL;
-
- /* detect the properties named using the following spec:
- *
- * @<section>.<meta-name>.<property-name>
- *
- * where <section> can be one of the following:
- *
- * - actions
- * - constraints
- * - effects
- *
- * and <meta-name> is the name set on a specific ActorMeta
- */
-
- tokens = g_strsplit (name + 1, ".", -1);
- if (tokens == NULL || g_strv_length (tokens) != 3)
- {
- CLUTTER_NOTE (ANIMATION, "Invalid property name '%s'",
- name + 1);
- g_strfreev (tokens);
- return NULL;
- }
-
- if (strcmp (tokens[0], "actions") == 0)
- meta = _clutter_meta_group_get_meta (priv->actions, tokens[1]);
-
- if (strcmp (tokens[0], "constraints") == 0)
- meta = _clutter_meta_group_get_meta (priv->constraints, tokens[1]);
-
- if (strcmp (tokens[0], "effects") == 0)
- meta = _clutter_meta_group_get_meta (priv->effects, tokens[1]);
-
- if (name_p != NULL)
- *name_p = g_strdup (tokens[2]);
-
- CLUTTER_NOTE (ANIMATION,
- "Looking for property '%s' of object '%s' in section '%s'",
- tokens[2],
- tokens[1],
- tokens[0]);
-
- g_strfreev (tokens);
-
- return meta;
-}
-
-static GParamSpec *
-clutter_actor_find_property (ClutterAnimatable *animatable,
- const gchar *property_name)
-{
- ClutterActor *actor = CLUTTER_ACTOR (animatable);
- ClutterActorMeta *meta = NULL;
- GObjectClass *klass = NULL;
- GParamSpec *pspec = NULL;
- gchar *p_name = NULL;
- gboolean use_content = FALSE;
- gboolean use_layout;
-
- use_layout = get_layout_from_animation_property (actor,
- property_name,
- &p_name);
-
- if (!use_layout)
- use_content = get_content_from_animation_property (actor,
- property_name,
- &p_name);
-
- if (!use_layout && !use_content)
- meta = get_meta_from_animation_property (actor,
- property_name,
- &p_name);
-
- if (meta != NULL)
- {
- klass = G_OBJECT_GET_CLASS (meta);
-
- pspec = g_object_class_find_property (klass, p_name);
- }
- else if (use_layout)
- {
- klass = G_OBJECT_GET_CLASS (actor->priv->layout_manager);
-
- pspec = g_object_class_find_property (klass, p_name);
- }
- else if (use_content)
- {
- klass = G_OBJECT_GET_CLASS (actor->priv->content);
-
- pspec = g_object_class_find_property (klass, p_name);
- }
- else
- {
- klass = G_OBJECT_GET_CLASS (animatable);
-
- pspec = g_object_class_find_property (klass, property_name);
- }
-
- g_free (p_name);
-
- return pspec;
-}
-
-static void
-clutter_actor_get_initial_state (ClutterAnimatable *animatable,
- const gchar *property_name,
- GValue *initial)
-{
- ClutterActor *actor = CLUTTER_ACTOR (animatable);
- ClutterActorMeta *meta = NULL;
- gchar *p_name = NULL;
- gboolean use_content = FALSE;
- gboolean use_layout;
-
- use_layout = get_layout_from_animation_property (actor,
- property_name,
- &p_name);
-
- if (!use_layout)
- use_content = get_content_from_animation_property (actor,
- property_name,
- &p_name);
-
- if (!use_layout && !use_content)
- meta = get_meta_from_animation_property (actor,
- property_name,
- &p_name);
-
- if (meta != NULL)
- g_object_get_property (G_OBJECT (meta), p_name, initial);
- else if (use_layout)
- g_object_get_property (G_OBJECT (actor->priv->layout_manager), p_name, initial);
- else if (use_content)
- g_object_get_property (G_OBJECT (actor->priv->content), p_name, initial);
- else
- g_object_get_property (G_OBJECT (animatable), property_name, initial);
-
- g_free (p_name);
-}
-
-/*
- * clutter_actor_set_animatable_property:
- * @actor: a #ClutterActor
- * @prop_id: the paramspec id
- * @value: the value to set
- * @pspec: the paramspec
- *
- * Sets values of animatable properties.
- *
- * This is a variant of clutter_actor_set_property() that gets called
- * by the #ClutterAnimatable implementation of #ClutterActor for the
- * properties with the %CLUTTER_PARAM_ANIMATABLE flag set on their
- * #GParamSpec.
- *
- * Unlike the implementation of #GObjectClass.set_property(), this
- * function will not update the interval if a transition involving an
- * animatable property is in progress - this avoids cycles with the
- * transition API calling the public API.
- */
-static void
-clutter_actor_set_animatable_property (ClutterActor *actor,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GObject *obj = G_OBJECT (actor);
-
- g_object_freeze_notify (obj);
-
- switch (prop_id)
- {
- case PROP_X:
- clutter_actor_set_x_internal (actor, g_value_get_float (value));
- break;
-
- case PROP_Y:
- clutter_actor_set_y_internal (actor, g_value_get_float (value));
- break;
-
- case PROP_POSITION:
- clutter_actor_set_position_internal (actor, g_value_get_boxed (value));
- break;
-
- case PROP_WIDTH:
- clutter_actor_set_width_internal (actor, g_value_get_float (value));
- break;
-
- case PROP_HEIGHT:
- clutter_actor_set_height_internal (actor, g_value_get_float (value));
- break;
-
- case PROP_SIZE:
- clutter_actor_set_size_internal (actor, g_value_get_boxed (value));
- break;
-
- case PROP_ALLOCATION:
- clutter_actor_allocate_internal (actor, g_value_get_boxed (value));
- clutter_actor_queue_redraw (actor);
- break;
-
- case PROP_Z_POSITION:
- clutter_actor_set_z_position_internal (actor, g_value_get_float (value));
- break;
-
- case PROP_OPACITY:
- clutter_actor_set_opacity_internal (actor, g_value_get_uint (value));
- break;
-
- case PROP_BACKGROUND_COLOR:
- clutter_actor_set_background_color_internal (actor, clutter_value_get_color (value));
- break;
-
- case PROP_PIVOT_POINT:
- clutter_actor_set_pivot_point_internal (actor, g_value_get_boxed (value));
- break;
-
- case PROP_PIVOT_POINT_Z:
- clutter_actor_set_pivot_point_z_internal (actor, g_value_get_float (value));
- break;
-
- case PROP_TRANSLATION_X:
- case PROP_TRANSLATION_Y:
- case PROP_TRANSLATION_Z:
- clutter_actor_set_translation_internal (actor,
- g_value_get_float (value),
- pspec);
- break;
-
- case PROP_SCALE_X:
- case PROP_SCALE_Y:
- case PROP_SCALE_Z:
- clutter_actor_set_scale_factor_internal (actor,
- g_value_get_double (value),
- pspec);
- break;
-
- case PROP_ROTATION_ANGLE_X:
- case PROP_ROTATION_ANGLE_Y:
- case PROP_ROTATION_ANGLE_Z:
- clutter_actor_set_rotation_angle_internal (actor,
- g_value_get_double (value),
- pspec);
- break;
-
- case PROP_CONTENT_BOX:
- clutter_actor_store_content_box (actor, g_value_get_boxed (value));
- break;
-
- case PROP_MARGIN_TOP:
- case PROP_MARGIN_BOTTOM:
- case PROP_MARGIN_LEFT:
- case PROP_MARGIN_RIGHT:
- clutter_actor_set_margin_internal (actor, g_value_get_float (value),
- pspec);
- break;
-
- case PROP_TRANSFORM:
- clutter_actor_set_transform_internal (actor, g_value_get_boxed (value));
- break;
-
- case PROP_CHILD_TRANSFORM:
- clutter_actor_set_child_transform_internal (actor, g_value_get_boxed (value));
- break;
-
- default:
- g_object_set_property (obj, pspec->name, value);
- break;
- }
-
- g_object_thaw_notify (obj);
-}
-
-static void
-clutter_actor_set_final_state (ClutterAnimatable *animatable,
- const gchar *property_name,
- const GValue *final)
-{
- ClutterActor *actor = CLUTTER_ACTOR (animatable);
- ClutterActorMeta *meta = NULL;
- gchar *p_name = NULL;
- gboolean use_content = FALSE;
- gboolean use_layout;
-
- use_layout = get_layout_from_animation_property (actor,
- property_name,
- &p_name);
-
- if (!use_layout)
- use_content = get_content_from_animation_property (actor,
- property_name,
- &p_name);
-
- if (!use_layout && !use_content)
- meta = get_meta_from_animation_property (actor,
- property_name,
- &p_name);
-
- if (meta != NULL)
- g_object_set_property (G_OBJECT (meta), p_name, final);
- else if (use_layout)
- g_object_set_property (G_OBJECT (actor->priv->layout_manager), p_name, final);
- else if (use_content)
- g_object_set_property (G_OBJECT (actor->priv->content), p_name, final);
- else
- {
- GObjectClass *obj_class = G_OBJECT_GET_CLASS (animatable);
- GParamSpec *pspec;
-
- pspec = g_object_class_find_property (obj_class, property_name);
-
- if (pspec != NULL)
- {
- if ((pspec->flags & CLUTTER_PARAM_ANIMATABLE) != 0)
- {
- /* XXX - I'm going to the special hell for this */
- clutter_actor_set_animatable_property (actor, pspec->param_id, final, pspec);
- }
- else
- g_object_set_property (G_OBJECT (animatable), pspec->name, final);
- }
- }
-
- g_free (p_name);
-}
-
-static ClutterActor *
-clutter_actor_get_actor (ClutterAnimatable *animatable)
-{
- return CLUTTER_ACTOR (animatable);
-}
-
-static void
-clutter_animatable_iface_init (ClutterAnimatableInterface *iface)
-{
- iface->find_property = clutter_actor_find_property;
- iface->get_initial_state = clutter_actor_get_initial_state;
- iface->set_final_state = clutter_actor_set_final_state;
- iface->get_actor = clutter_actor_get_actor;
-}
-
-/**
- * clutter_actor_transform_stage_point:
- * @self: A #ClutterActor
- * @x: (in): x screen coordinate of the point to unproject
- * @y: (in): y screen coordinate of the point to unproject
- * @x_out: (out): return location for the unprojected x coordinance
- * @y_out: (out): return location for the unprojected y coordinance
- *
- * This function translates screen coordinates (@x, @y) to
- * coordinates relative to the actor. For example, it can be used to translate
- * screen events from global screen coordinates into actor-local coordinates.
- *
- * The conversion can fail, notably if the transform stack results in the
- * actor being projected on the screen as a mere line.
- *
- * The conversion should not be expected to be pixel-perfect due to the
- * nature of the operation. In general the error grows when the skewing
- * of the actor rectangle on screen increases.
- *
- * This function can be computationally intensive.
- *
- * This function only works when the allocation is up-to-date, i.e. inside of
- * the #ClutterActorClass.paint() implementation
- *
- * Return value: %TRUE if conversion was successful.
- *
- * Since: 0.6
- */
-gboolean
-clutter_actor_transform_stage_point (ClutterActor *self,
- gfloat x,
- gfloat y,
- gfloat *x_out,
- gfloat *y_out)
-{
- graphene_point3d_t v[4];
- double ST[3][3];
- double RQ[3][3];
- int du, dv;
- double px, py;
- double det;
- float xf, yf, wf;
- ClutterActorPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- priv = self->priv;
-
- /* This implementation is based on the quad -> quad projection algorithm
- * described by Paul Heckbert in:
- *
- * http://www.cs.cmu.edu/~ph/texfund/texfund.pdf
- *
- * and the sample implementation at:
- *
- * http://www.cs.cmu.edu/~ph/src/texfund/
- *
- * Our texture is a rectangle with origin [0, 0], so we are mapping from
- * quad to rectangle only, which significantly simplifies things.
- * Function calls have been unrolled.
- */
- clutter_actor_get_abs_allocation_vertices (self, v);
-
- /* Keeping these as ints simplifies the multiplication (no significant
- * loss of precision here).
- */
- du = ceilf (priv->allocation.x2 - priv->allocation.x1);
- dv = ceilf (priv->allocation.y2 - priv->allocation.y1);
-
- if (du == 0 || dv == 0)
- return FALSE;
-
-#define DET(a,b,c,d) (((a) * (d)) - ((b) * (c)))
-
- /* First, find mapping from unit uv square to xy quadrilateral; this
- * equivalent to the pmap_square_quad() functions in the sample
- * implementation, which we can simplify, since our target is always
- * a rectangle.
- */
- px = v[0].x - v[1].x + v[3].x - v[2].x;
- py = v[0].y - v[1].y + v[3].y - v[2].y;
-
- if ((int) px == 0 && (int) py == 0)
- {
- /* affine transform */
- RQ[0][0] = v[1].x - v[0].x;
- RQ[1][0] = v[3].x - v[1].x;
- RQ[2][0] = v[0].x;
- RQ[0][1] = v[1].y - v[0].y;
- RQ[1][1] = v[3].y - v[1].y;
- RQ[2][1] = v[0].y;
- RQ[0][2] = 0.0;
- RQ[1][2] = 0.0;
- RQ[2][2] = 1.0;
- }
- else
- {
- /* projective transform */
- double dx1, dx2, dy1, dy2;
-
- dx1 = v[1].x - v[3].x;
- dx2 = v[2].x - v[3].x;
- dy1 = v[1].y - v[3].y;
- dy2 = v[2].y - v[3].y;
-
- det = DET (dx1, dx2, dy1, dy2);
- if (fabs (det) <= DBL_EPSILON)
- return FALSE;
-
- RQ[0][2] = DET (px, dx2, py, dy2) / det;
- RQ[1][2] = DET (dx1, px, dy1, py) / det;
- RQ[2][2] = 1.0;
- RQ[0][0] = v[1].x - v[0].x + (RQ[0][2] * v[1].x);
- RQ[1][0] = v[2].x - v[0].x + (RQ[1][2] * v[2].x);
- RQ[2][0] = v[0].x;
- RQ[0][1] = v[1].y - v[0].y + (RQ[0][2] * v[1].y);
- RQ[1][1] = v[2].y - v[0].y + (RQ[1][2] * v[2].y);
- RQ[2][1] = v[0].y;
- }
-
- /*
- * Now combine with transform from our rectangle (u0,v0,u1,v1) to unit
- * square. Since our rectangle is based at 0,0 we only need to scale.
- */
- RQ[0][0] /= du;
- RQ[1][0] /= dv;
- RQ[0][1] /= du;
- RQ[1][1] /= dv;
- RQ[0][2] /= du;
- RQ[1][2] /= dv;
-
- /*
- * Now RQ is transform from uv rectangle to xy quadrilateral; we need an
- * inverse of that.
- */
- ST[0][0] = DET (RQ[1][1], RQ[1][2], RQ[2][1], RQ[2][2]);
- ST[1][0] = DET (RQ[1][2], RQ[1][0], RQ[2][2], RQ[2][0]);
- ST[2][0] = DET (RQ[1][0], RQ[1][1], RQ[2][0], RQ[2][1]);
- ST[0][1] = DET (RQ[2][1], RQ[2][2], RQ[0][1], RQ[0][2]);
- ST[1][1] = DET (RQ[2][2], RQ[2][0], RQ[0][2], RQ[0][0]);
- ST[2][1] = DET (RQ[2][0], RQ[2][1], RQ[0][0], RQ[0][1]);
- ST[0][2] = DET (RQ[0][1], RQ[0][2], RQ[1][1], RQ[1][2]);
- ST[1][2] = DET (RQ[0][2], RQ[0][0], RQ[1][2], RQ[1][0]);
- ST[2][2] = DET (RQ[0][0], RQ[0][1], RQ[1][0], RQ[1][1]);
-
- /*
- * Check the resulting matrix is OK.
- */
- det = (RQ[0][0] * ST[0][0])
- + (RQ[0][1] * ST[0][1])
- + (RQ[0][2] * ST[0][2]);
- if (fabs (det) <= DBL_EPSILON)
- return FALSE;
-
- /*
- * Now transform our point with the ST matrix; the notional w
- * coordinate is 1, hence the last part is simply added.
- */
- xf = x * ST[0][0] + y * ST[1][0] + ST[2][0];
- yf = x * ST[0][1] + y * ST[1][1] + ST[2][1];
- wf = x * ST[0][2] + y * ST[1][2] + ST[2][2];
-
- if (x_out)
- *x_out = xf / wf;
-
- if (y_out)
- *y_out = yf / wf;
-
-#undef DET
-
- return TRUE;
-}
-
-/**
- * clutter_actor_is_rotated:
- * @self: a #ClutterActor
- *
- * Checks whether any rotation is applied to the actor.
- *
- * Return value: %TRUE if the actor is rotated.
- *
- * Since: 0.6
- */
-gboolean
-clutter_actor_is_rotated (ClutterActor *self)
-{
- const ClutterTransformInfo *info;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- info = _clutter_actor_get_transform_info_or_defaults (self);
-
- if (info->rx_angle || info->ry_angle || info->rz_angle)
- return TRUE;
-
- return FALSE;
-}
-
-/**
- * clutter_actor_is_scaled:
- * @self: a #ClutterActor
- *
- * Checks whether the actor is scaled in either dimension.
- *
- * Return value: %TRUE if the actor is scaled.
- *
- * Since: 0.6
- */
-gboolean
-clutter_actor_is_scaled (ClutterActor *self)
-{
- const ClutterTransformInfo *info;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- info = _clutter_actor_get_transform_info_or_defaults (self);
-
- if (info->scale_x != 1.0 || info->scale_y != 1.0)
- return TRUE;
-
- return FALSE;
-}
-
-ClutterActor *
-_clutter_actor_get_stage_internal (ClutterActor *actor)
-{
- while (actor && !CLUTTER_ACTOR_IS_TOPLEVEL (actor))
- actor = actor->priv->parent;
-
- return actor;
-}
-
-/**
- * clutter_actor_get_stage:
- * @actor: a #ClutterActor
- *
- * Retrieves the #ClutterStage where @actor is contained.
- *
- * Return value: (transfer none) (type Clutter.Stage): the stage
- * containing the actor, or %NULL
- *
- * Since: 0.8
- */
-ClutterActor *
-clutter_actor_get_stage (ClutterActor *actor)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), NULL);
-
- return _clutter_actor_get_stage_internal (actor);
-}
-
-/**
- * clutter_actor_allocate_available_size:
- * @self: a #ClutterActor
- * @x: the actor's X coordinate
- * @y: the actor's Y coordinate
- * @available_width: the maximum available width, or -1 to use the
- * actor's natural width
- * @available_height: the maximum available height, or -1 to use the
- * actor's natural height
- *
- * Allocates @self taking into account the #ClutterActor's
- * preferred size, but limiting it to the maximum available width
- * and height provided.
- *
- * This function will do the right thing when dealing with the
- * actor's request mode.
- *
- * The implementation of this function is equivalent to:
- *
- * |[<!-- language="C" -->
- * if (request_mode == CLUTTER_REQUEST_HEIGHT_FOR_WIDTH)
- * {
- * clutter_actor_get_preferred_width (self, available_height,
- * &min_width,
- * &natural_width);
- * width = CLAMP (natural_width, min_width, available_width);
- *
- * clutter_actor_get_preferred_height (self, width,
- * &min_height,
- * &natural_height);
- * height = CLAMP (natural_height, min_height, available_height);
- * }
- * else if (request_mode == CLUTTER_REQUEST_WIDTH_FOR_HEIGHT)
- * {
- * clutter_actor_get_preferred_height (self, available_width,
- * &min_height,
- * &natural_height);
- * height = CLAMP (natural_height, min_height, available_height);
- *
- * clutter_actor_get_preferred_width (self, height,
- * &min_width,
- * &natural_width);
- * width = CLAMP (natural_width, min_width, available_width);
- * }
- * else if (request_mode == CLUTTER_REQUEST_CONTENT_SIZE)
- * {
- * clutter_content_get_preferred_size (content, &natural_width, &natural_height);
- *
- * width = CLAMP (natural_width, 0, available_width);
- * height = CLAMP (natural_height, 0, available_height);
- * }
- *
- * box.x1 = x; box.y1 = y;
- * box.x2 = box.x1 + available_width;
- * box.y2 = box.y1 + available_height;
- * clutter_actor_allocate (self, &box);
- * ]|
- *
- * This function can be used by fluid layout managers to allocate
- * an actor's preferred size without making it bigger than the area
- * available for the container.
- *
- * Since: 1.0
- */
-void
-clutter_actor_allocate_available_size (ClutterActor *self,
- gfloat x,
- gfloat y,
- gfloat available_width,
- gfloat available_height)
-{
- ClutterActorPrivate *priv;
- gfloat width, height;
- gfloat min_width, min_height;
- gfloat natural_width, natural_height;
- ClutterActorBox box;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- priv = self->priv;
-
- width = height = 0.0;
-
- switch (priv->request_mode)
- {
- case CLUTTER_REQUEST_HEIGHT_FOR_WIDTH:
- clutter_actor_get_preferred_width (self, available_height,
- &min_width,
- &natural_width);
- width = CLAMP (natural_width, min_width, available_width);
-
- clutter_actor_get_preferred_height (self, width,
- &min_height,
- &natural_height);
- height = CLAMP (natural_height, min_height, available_height);
- break;
-
- case CLUTTER_REQUEST_WIDTH_FOR_HEIGHT:
- clutter_actor_get_preferred_height (self, available_width,
- &min_height,
- &natural_height);
- height = CLAMP (natural_height, min_height, available_height);
-
- clutter_actor_get_preferred_width (self, height,
- &min_width,
- &natural_width);
- width = CLAMP (natural_width, min_width, available_width);
- break;
-
- case CLUTTER_REQUEST_CONTENT_SIZE:
- if (priv->content != NULL)
- {
- clutter_content_get_preferred_size (priv->content, &natural_width, &natural_height);
-
- width = CLAMP (natural_width, 0, available_width);
- height = CLAMP (natural_height, 0, available_height);
- }
- break;
- }
-
-
- box.x1 = x;
- box.y1 = y;
- box.x2 = box.x1 + width;
- box.y2 = box.y1 + height;
- clutter_actor_allocate (self, &box);
-}
-
-/**
- * clutter_actor_allocate_preferred_size:
- * @self: a #ClutterActor
- * @x: the actor's X coordinate
- * @y: the actor's Y coordinate
- *
- * Allocates the natural size of @self.
- *
- * This function is a utility call for #ClutterActor implementations
- * that allocates the actor's preferred natural size. It can be used
- * by fixed layout managers (like #ClutterGroup or so called
- * 'composite actors') inside the ClutterActor::allocate
- * implementation to give each child exactly how much space it
- * requires, regardless of the size of the parent.
- *
- * This function is not meant to be used by applications. It is also
- * not meant to be used outside the implementation of the
- * #ClutterActorClass.allocate virtual function.
- *
- * Since: 0.8
- */
-void
-clutter_actor_allocate_preferred_size (ClutterActor *self,
- float x,
- float y)
-{
- gfloat natural_width, natural_height;
- ClutterActorBox actor_box;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- clutter_actor_get_preferred_size (self,
- NULL, NULL,
- &natural_width,
- &natural_height);
-
- actor_box.x1 = x;
- actor_box.y1 = y;
- actor_box.x2 = actor_box.x1 + natural_width;
- actor_box.y2 = actor_box.y1 + natural_height;
-
- clutter_actor_allocate (self, &actor_box);
-}
-
-/**
- * clutter_actor_allocate_align_fill:
- * @self: a #ClutterActor
- * @box: a #ClutterActorBox, containing the available width and height
- * @x_align: the horizontal alignment, between 0 and 1
- * @y_align: the vertical alignment, between 0 and 1
- * @x_fill: whether the actor should fill horizontally
- * @y_fill: whether the actor should fill vertically
- *
- * Allocates @self by taking into consideration the available allocation
- * area; an alignment factor on either axis; and whether the actor should
- * fill the allocation on either axis.
- *
- * The @box should contain the available allocation width and height;
- * if the x1 and y1 members of #ClutterActorBox are not set to 0, the
- * allocation will be offset by their value.
- *
- * This function takes into consideration the geometry request specified by
- * the #ClutterActor:request-mode property, and the text direction.
- *
- * This function is useful for fluid layout managers using legacy alignment
- * flags. Newly written layout managers should use the #ClutterActor:x-align
- * and #ClutterActor:y-align properties, instead, and just call
- * clutter_actor_allocate() inside their #ClutterActorClass.allocate()
- * implementation.
- *
- * Since: 1.4
- */
-void
-clutter_actor_allocate_align_fill (ClutterActor *self,
- const ClutterActorBox *box,
- gdouble x_align,
- gdouble y_align,
- gboolean x_fill,
- gboolean y_fill)
-{
- ClutterActorPrivate *priv;
- ClutterActorBox allocation = CLUTTER_ACTOR_BOX_INIT_ZERO;
- gfloat x_offset, y_offset;
- gfloat available_width, available_height;
- gfloat child_width = 0.f, child_height = 0.f;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (box != NULL);
- g_return_if_fail (x_align >= 0.0 && x_align <= 1.0);
- g_return_if_fail (y_align >= 0.0 && y_align <= 1.0);
-
- priv = self->priv;
-
- clutter_actor_box_get_origin (box, &x_offset, &y_offset);
- clutter_actor_box_get_size (box, &available_width, &available_height);
-
- if (available_width <= 0)
- available_width = 0.f;
-
- if (available_height <= 0)
- available_height = 0.f;
-
- allocation.x1 = x_offset;
- allocation.y1 = y_offset;
-
- if (available_width == 0.f && available_height == 0.f)
- goto out;
-
- if (x_fill)
- child_width = available_width;
-
- if (y_fill)
- child_height = available_height;
-
- /* if we are filling horizontally and vertically then we're done */
- if (x_fill && y_fill)
- goto out;
-
- if (priv->request_mode == CLUTTER_REQUEST_HEIGHT_FOR_WIDTH)
- {
- gfloat min_width, natural_width;
- gfloat min_height, natural_height;
-
- if (!x_fill)
- {
- clutter_actor_get_preferred_width (self, available_height,
- &min_width,
- &natural_width);
-
- child_width = CLAMP (natural_width, min_width, available_width);
- }
-
- if (!y_fill)
- {
- clutter_actor_get_preferred_height (self, child_width,
- &min_height,
- &natural_height);
-
- child_height = CLAMP (natural_height, min_height, available_height);
- }
- }
- else if (priv->request_mode == CLUTTER_REQUEST_WIDTH_FOR_HEIGHT)
- {
- gfloat min_width, natural_width;
- gfloat min_height, natural_height;
-
- if (!y_fill)
- {
- clutter_actor_get_preferred_height (self, available_width,
- &min_height,
- &natural_height);
-
- child_height = CLAMP (natural_height, min_height, available_height);
- }
-
- if (!x_fill)
- {
- clutter_actor_get_preferred_width (self, child_height,
- &min_width,
- &natural_width);
-
- child_width = CLAMP (natural_width, min_width, available_width);
- }
- }
- else if (priv->request_mode == CLUTTER_REQUEST_CONTENT_SIZE && priv->content != NULL)
- {
- gfloat natural_width, natural_height;
-
- clutter_content_get_preferred_size (priv->content, &natural_width, &natural_height);
-
- if (!x_fill)
- child_width = CLAMP (natural_width, 0, available_width);
-
- if (!y_fill)
- child_height = CLAMP (natural_height, 0, available_height);
- }
-
- /* invert the horizontal alignment for RTL languages */
- if (priv->text_direction == CLUTTER_TEXT_DIRECTION_RTL)
- x_align = 1.0 - x_align;
-
- if (!x_fill)
- allocation.x1 += ((available_width - child_width) * x_align);
-
- if (!y_fill)
- allocation.y1 += ((available_height - child_height) * y_align);
-
-out:
-
- allocation.x1 = floorf (allocation.x1);
- allocation.y1 = floorf (allocation.y1);
- allocation.x2 = ceilf (allocation.x1 + MAX (child_width, 0));
- allocation.y2 = ceilf (allocation.y1 + MAX (child_height, 0));
-
- clutter_actor_allocate (self, &allocation);
-}
-
-/**
- * clutter_actor_grab_key_focus:
- * @self: a #ClutterActor
- *
- * Sets the key focus of the #ClutterStage including @self
- * to this #ClutterActor.
- *
- * Since: 1.0
- */
-void
-clutter_actor_grab_key_focus (ClutterActor *self)
-{
- ClutterActor *stage;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- if (self->priv->has_key_focus)
- return;
-
- stage = _clutter_actor_get_stage_internal (self);
- if (stage != NULL)
- clutter_stage_set_key_focus (CLUTTER_STAGE (stage), self);
-}
-
-static void
-update_pango_context (ClutterBackend *backend,
- PangoContext *context)
-{
- ClutterSettings *settings;
- PangoFontDescription *font_desc;
- const cairo_font_options_t *font_options;
- gchar *font_name;
- PangoDirection pango_dir;
- gdouble resolution;
-
- settings = clutter_settings_get_default ();
-
- /* update the text direction */
- if (clutter_get_default_text_direction () == CLUTTER_TEXT_DIRECTION_RTL)
- pango_dir = PANGO_DIRECTION_RTL;
- else
- pango_dir = PANGO_DIRECTION_LTR;
-
- pango_context_set_base_dir (context, pango_dir);
-
- g_object_get (settings, "font-name", &font_name, NULL);
-
- /* get the configuration for the PangoContext from the backend */
- font_options = clutter_backend_get_font_options (backend);
- resolution = clutter_backend_get_resolution (backend);
-
- font_desc = pango_font_description_from_string (font_name);
-
- if (resolution < 0)
- resolution = 96.0; /* fall back */
-
- pango_context_set_font_description (context, font_desc);
- pango_cairo_context_set_font_options (context, font_options);
- pango_cairo_context_set_resolution (context, resolution);
-
- pango_font_description_free (font_desc);
- g_free (font_name);
-}
-
-/**
- * clutter_actor_get_pango_context:
- * @self: a #ClutterActor
- *
- * Retrieves the #PangoContext for @self. The actor's #PangoContext
- * is already configured using the appropriate font map, resolution
- * and font options.
- *
- * Unlike clutter_actor_create_pango_context(), this context is owend
- * by the #ClutterActor and it will be updated each time the options
- * stored by the #ClutterBackend change.
- *
- * You can use the returned #PangoContext to create a #PangoLayout
- * and render text using cogl_pango_show_layout() to reuse the
- * glyphs cache also used by Clutter.
- *
- * Return value: (transfer none): the #PangoContext for a #ClutterActor.
- * The returned #PangoContext is owned by the actor and should not be
- * unreferenced by the application code
- *
- * Since: 1.0
- */
-PangoContext *
-clutter_actor_get_pango_context (ClutterActor *self)
-{
- ClutterActorPrivate *priv;
- ClutterBackend *backend = clutter_get_default_backend ();
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
-
- priv = self->priv;
-
- if (G_UNLIKELY (priv->pango_context == NULL))
- {
- priv->pango_context = clutter_actor_create_pango_context (self);
-
- priv->resolution_changed_id =
- g_signal_connect_object (backend, "resolution-changed",
- G_CALLBACK (update_pango_context), priv->pango_context, 0);
- priv->font_changed_id =
- g_signal_connect_object (backend, "font-changed",
- G_CALLBACK (update_pango_context), priv->pango_context, 0);
- }
- else
- update_pango_context (backend, priv->pango_context);
-
- return priv->pango_context;
-}
-
-/**
- * clutter_actor_create_pango_context:
- * @self: a #ClutterActor
- *
- * Creates a #PangoContext for the given actor. The #PangoContext
- * is already configured using the appropriate font map, resolution
- * and font options.
- *
- * See also clutter_actor_get_pango_context().
- *
- * Return value: (transfer full): the newly created #PangoContext.
- * Use g_object_unref() on the returned value to deallocate its
- * resources
- *
- * Since: 1.0
- */
-PangoContext *
-clutter_actor_create_pango_context (ClutterActor *self)
-{
- CoglPangoFontMap *font_map;
- PangoContext *context;
-
- font_map = COGL_PANGO_FONT_MAP (clutter_get_font_map ());
-
- context = cogl_pango_font_map_create_context (font_map);
- update_pango_context (clutter_get_default_backend (), context);
- pango_context_set_language (context, pango_language_get_default ());
-
- return context;
-}
-
-/**
- * clutter_actor_create_pango_layout:
- * @self: a #ClutterActor
- * @text: (allow-none): the text to set on the #PangoLayout, or %NULL
- *
- * Creates a new #PangoLayout from the same #PangoContext used
- * by the #ClutterActor. The #PangoLayout is already configured
- * with the font map, resolution and font options, and the
- * given @text.
- *
- * If you want to keep around a #PangoLayout created by this
- * function you will have to connect to the #ClutterBackend::font-changed
- * and #ClutterBackend::resolution-changed signals, and call
- * pango_layout_context_changed() in response to them.
- *
- * Return value: (transfer full): the newly created #PangoLayout.
- * Use g_object_unref() when done
- *
- * Since: 1.0
- */
-PangoLayout *
-clutter_actor_create_pango_layout (ClutterActor *self,
- const gchar *text)
-{
- PangoContext *context;
- PangoLayout *layout;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
-
- context = clutter_actor_get_pango_context (self);
- layout = pango_layout_new (context);
-
- if (text)
- pango_layout_set_text (layout, text, -1);
-
- return layout;
-}
-
-/**
- * clutter_actor_set_opacity_override:
- * @self: a #ClutterActor
- * @opacity: the override opacity value, or -1 to reset
- *
- * Allows overriding the calculated paint opacity (as returned by
- * clutter_actor_get_paint_opacity()). This is used internally by
- * ClutterClone and ClutterOffscreenEffect, and should be used by
- * actors that need to mimic those.
- *
- * In almost all cases this should not used by applications.
- *
- * Stability: unstable
- */
-void
-clutter_actor_set_opacity_override (ClutterActor *self,
- gint opacity)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- /* ensure bounds */
- if (opacity >= 0)
- opacity = CLAMP (opacity, 0, 255);
- else
- opacity = -1;
-
- self->priv->opacity_override = opacity;
-}
-
-/**
- * clutter_actor_get_opacity_override:
- * @self: a #ClutterActor
- *
- * See clutter_actor_set_opacity_override()
- *
- * Returns: the override value for the actor's opacity, or -1 if no override
- * is set.
- *
- * Since: 1.22
- *
- * Stability: unstable
- */
-gint
-clutter_actor_get_opacity_override (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), -1);
-
- return self->priv->opacity_override;
-}
-
-/**
- * clutter_actor_inhibit_culling:
- * @actor: a #ClutterActor
- *
- * Increases the culling inhibitor counter. Inhibiting culling
- * forces the actor to be painted even when outside the visible
- * bounds of the stage view.
- *
- * This is usually necessary when an actor is being painted on
- * another paint context.
- *
- * Pair with clutter_actor_uninhibit_culling() when the actor doesn't
- * need to be painted anymore.
- */
-void
-clutter_actor_inhibit_culling (ClutterActor *actor)
-{
- ClutterActorPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (actor));
-
- priv = actor->priv;
-
- priv->inhibit_culling_counter++;
- _clutter_actor_set_enable_paint_unmapped (actor, TRUE);
-}
-
-/**
- * clutter_actor_uninhibit_culling:
- * @actor: a #ClutterActor
- *
- * Decreases the culling inhibitor counter. See clutter_actor_inhibit_culling()
- * for when inhibit culling is necessary.
- *
- * Calling this function without a matching call to
- * clutter_actor_inhibit_culling() is a programming error.
- */
-void
-clutter_actor_uninhibit_culling (ClutterActor *actor)
-{
- ClutterActorPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (actor));
-
- priv = actor->priv;
-
- if (priv->inhibit_culling_counter == 0)
- {
- g_critical ("Unpaired call to clutter_actor_uninhibit_culling");
- return;
- }
-
- priv->inhibit_culling_counter--;
- if (priv->inhibit_culling_counter == 0)
- _clutter_actor_set_enable_paint_unmapped (actor, FALSE);
-}
-
-/* Allows you to disable applying the actors model view transform during
- * a paint. Used by ClutterClone. */
-void
-_clutter_actor_set_enable_model_view_transform (ClutterActor *self,
- gboolean enable)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- self->priv->enable_model_view_transform = enable;
-}
-
-void
-_clutter_actor_set_enable_paint_unmapped (ClutterActor *self,
- gboolean enable)
-{
- ClutterActorPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- priv = self->priv;
-
- if (priv->enable_paint_unmapped == enable)
- return;
-
- priv->enable_paint_unmapped = enable;
-
- if (enable)
- {
- push_in_paint_unmapped_branch (self, 1);
-
- /* Make sure that the parents of the widget are realized first;
- * otherwise checks in clutter_actor_update_map_state() will
- * fail.
- */
- clutter_actor_realize (self);
-
- /* If the actor isn't ultimately connected to a toplevel, it can't be
- * realized or painted.
- */
- if (CLUTTER_ACTOR_IS_REALIZED (self))
- clutter_actor_update_map_state (self, MAP_STATE_MAKE_MAPPED);
- }
- else
- {
- clutter_actor_update_map_state (self, MAP_STATE_CHECK);
- pop_in_paint_unmapped_branch (self, 1);
- }
-}
-
-/**
- * clutter_actor_get_flags:
- * @self: a #ClutterActor
- *
- * Retrieves the flags set on @self
- *
- * Return value: a bitwise or of #ClutterActorFlags or 0
- *
- * Since: 1.0
- */
-ClutterActorFlags
-clutter_actor_get_flags (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
-
- return self->flags;
-}
-
-/**
- * clutter_actor_set_flags:
- * @self: a #ClutterActor
- * @flags: the flags to set
- *
- * Sets @flags on @self
- *
- * This function will emit notifications for the changed properties
- *
- * Since: 1.0
- */
-void
-clutter_actor_set_flags (ClutterActor *self,
- ClutterActorFlags flags)
-{
- ClutterActorFlags old_flags;
- GObject *obj;
- gboolean was_reactive_set, reactive_set;
- gboolean was_realized_set, realized_set;
- gboolean was_mapped_set, mapped_set;
- gboolean was_visible_set, visible_set;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- if (self->flags == flags)
- return;
-
- obj = G_OBJECT (self);
- g_object_ref (obj);
- g_object_freeze_notify (obj);
-
- old_flags = self->flags;
-
- was_reactive_set = ((old_flags & CLUTTER_ACTOR_REACTIVE) != 0);
- was_realized_set = ((old_flags & CLUTTER_ACTOR_REALIZED) != 0);
- was_mapped_set = ((old_flags & CLUTTER_ACTOR_MAPPED) != 0);
- was_visible_set = ((old_flags & CLUTTER_ACTOR_VISIBLE) != 0);
-
- self->flags |= flags;
-
- reactive_set = ((self->flags & CLUTTER_ACTOR_REACTIVE) != 0);
- realized_set = ((self->flags & CLUTTER_ACTOR_REALIZED) != 0);
- mapped_set = ((self->flags & CLUTTER_ACTOR_MAPPED) != 0);
- visible_set = ((self->flags & CLUTTER_ACTOR_VISIBLE) != 0);
-
- if (reactive_set != was_reactive_set)
- g_object_notify_by_pspec (obj, obj_props[PROP_REACTIVE]);
-
- if (realized_set != was_realized_set)
- g_object_notify_by_pspec (obj, obj_props[PROP_REALIZED]);
-
- if (mapped_set != was_mapped_set)
- g_object_notify_by_pspec (obj, obj_props[PROP_MAPPED]);
-
- if (visible_set != was_visible_set)
- g_object_notify_by_pspec (obj, obj_props[PROP_VISIBLE]);
-
- g_object_thaw_notify (obj);
- g_object_unref (obj);
-}
-
-/**
- * clutter_actor_unset_flags:
- * @self: a #ClutterActor
- * @flags: the flags to unset
- *
- * Unsets @flags on @self
- *
- * This function will emit notifications for the changed properties
- *
- * Since: 1.0
- */
-void
-clutter_actor_unset_flags (ClutterActor *self,
- ClutterActorFlags flags)
-{
- ClutterActorFlags old_flags;
- GObject *obj;
- gboolean was_reactive_set, reactive_set;
- gboolean was_realized_set, realized_set;
- gboolean was_mapped_set, mapped_set;
- gboolean was_visible_set, visible_set;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- obj = G_OBJECT (self);
- g_object_freeze_notify (obj);
-
- old_flags = self->flags;
-
- was_reactive_set = ((old_flags & CLUTTER_ACTOR_REACTIVE) != 0);
- was_realized_set = ((old_flags & CLUTTER_ACTOR_REALIZED) != 0);
- was_mapped_set = ((old_flags & CLUTTER_ACTOR_MAPPED) != 0);
- was_visible_set = ((old_flags & CLUTTER_ACTOR_VISIBLE) != 0);
-
- self->flags &= ~flags;
-
- if (self->flags == old_flags)
- return;
-
- reactive_set = ((self->flags & CLUTTER_ACTOR_REACTIVE) != 0);
- realized_set = ((self->flags & CLUTTER_ACTOR_REALIZED) != 0);
- mapped_set = ((self->flags & CLUTTER_ACTOR_MAPPED) != 0);
- visible_set = ((self->flags & CLUTTER_ACTOR_VISIBLE) != 0);
-
- if (reactive_set != was_reactive_set)
- g_object_notify_by_pspec (obj, obj_props[PROP_REACTIVE]);
-
- if (realized_set != was_realized_set)
- g_object_notify_by_pspec (obj, obj_props[PROP_REALIZED]);
-
- if (mapped_set != was_mapped_set)
- g_object_notify_by_pspec (obj, obj_props[PROP_MAPPED]);
-
- if (visible_set != was_visible_set)
- g_object_notify_by_pspec (obj, obj_props[PROP_VISIBLE]);
-
- g_object_thaw_notify (obj);
-}
-
-static void
-clutter_actor_set_transform_internal (ClutterActor *self,
- const graphene_matrix_t *transform)
-{
- ClutterTransformInfo *info;
- gboolean was_set;
- GObject *obj;
-
- obj = G_OBJECT (self);
-
- info = _clutter_actor_get_transform_info (self);
-
- was_set = info->transform_set;
-
- info->transform = *transform;
- info->transform_set = !graphene_matrix_is_identity (&info->transform);
-
- transform_changed (self);
-
- clutter_actor_queue_redraw (self);
-
- g_object_notify_by_pspec (obj, obj_props[PROP_TRANSFORM]);
-
- if (was_set != info->transform_set)
- g_object_notify_by_pspec (obj, obj_props[PROP_TRANSFORM_SET]);
-}
-
-/**
- * clutter_actor_set_transform:
- * @self: a #ClutterActor
- * @transform: (allow-none): a #graphene_matrix_t, or %NULL to
- * unset a custom transformation
- *
- * Overrides the transformations of a #ClutterActor with a custom
- * matrix, which will be applied relative to the origin of the
- * actor's allocation and to the actor's pivot point.
- *
- * The #ClutterActor:transform property is animatable.
- *
- * Since: 1.12
- */
-void
-clutter_actor_set_transform (ClutterActor *self,
- const graphene_matrix_t *transform)
-{
- const ClutterTransformInfo *info;
- graphene_matrix_t new_transform;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- info = _clutter_actor_get_transform_info_or_defaults (self);
-
- if (transform != NULL)
- graphene_matrix_init_from_matrix (&new_transform, transform);
- else
- graphene_matrix_init_identity (&new_transform);
-
- _clutter_actor_create_transition (self, obj_props[PROP_TRANSFORM],
- &info->transform,
- &new_transform);
-}
-
-/**
- * clutter_actor_get_transform:
- * @self: a #ClutterActor
- * @transform: (out caller-allocates): a #graphene_matrix_t
- *
- * Retrieves the current transformation matrix of a #ClutterActor.
- *
- * Since: 1.12
- */
-void
-clutter_actor_get_transform (ClutterActor *self,
- graphene_matrix_t *transform)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (transform != NULL);
-
- graphene_matrix_init_identity (transform);
- _clutter_actor_apply_modelview_transform (self, transform);
-}
-
-void
-_clutter_actor_set_in_clone_paint (ClutterActor *self,
- gboolean is_in_clone_paint)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- self->priv->in_clone_paint = is_in_clone_paint;
-}
-
-/**
- * clutter_actor_is_in_clone_paint:
- * @self: a #ClutterActor
- *
- * Checks whether @self is being currently painted by a #ClutterClone
- *
- * This function is useful only inside implementations of the
- * #ClutterActorClass.paint() virtual function.
- *
- * This function should not be used by applications
- *
- * Return value: %TRUE if the #ClutterActor is currently being painted
- * by a #ClutterClone, and %FALSE otherwise
- *
- * Since: 1.0
- */
-gboolean
-clutter_actor_is_in_clone_paint (ClutterActor *self)
-{
- ClutterActor *parent;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- if (self->priv->in_clone_paint)
- return TRUE;
-
- if (self->priv->in_cloned_branch == 0)
- return FALSE;
-
- parent = self->priv->parent;
- while (parent != NULL)
- {
- if (parent->priv->in_cloned_branch == 0)
- break;
-
- if (parent->priv->in_clone_paint)
- return TRUE;
-
- parent = parent->priv->parent;
- }
-
- return FALSE;
-}
-
-gboolean
-clutter_actor_is_painting_unmapped (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- return self->priv->unmapped_paint_branch_counter > 0;
-}
-
-gboolean
-clutter_actor_has_damage (ClutterActor *actor)
-{
- return actor->priv->is_dirty;
-}
-
-static gboolean
-set_direction_recursive (ClutterActor *actor,
- gpointer user_data)
-{
- ClutterTextDirection text_dir = GPOINTER_TO_INT (user_data);
-
- clutter_actor_set_text_direction (actor, text_dir);
-
- return TRUE;
-}
-
-/**
- * clutter_actor_set_text_direction:
- * @self: a #ClutterActor
- * @text_dir: the text direction for @self
- *
- * Sets the #ClutterTextDirection for an actor
- *
- * The passed text direction must not be %CLUTTER_TEXT_DIRECTION_DEFAULT
- *
- * If @self implements #ClutterContainer then this function will recurse
- * inside all the children of @self (including the internal ones).
- *
- * Composite actors not implementing #ClutterContainer, or actors requiring
- * special handling when the text direction changes, should connect to
- * the #GObject::notify signal for the #ClutterActor:text-direction property
- *
- * Since: 1.2
- */
-void
-clutter_actor_set_text_direction (ClutterActor *self,
- ClutterTextDirection text_dir)
-{
- ClutterActorPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (text_dir != CLUTTER_TEXT_DIRECTION_DEFAULT);
-
- priv = self->priv;
-
- if (priv->text_direction != text_dir)
- {
- priv->text_direction = text_dir;
-
- /* we need to emit the notify::text-direction first, so that
- * the sub-classes can catch that and do specific handling of
- * the text direction; see clutter_text_direction_changed_cb()
- * inside clutter-text.c
- */
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_TEXT_DIRECTION]);
-
- _clutter_actor_foreach_child (self, set_direction_recursive,
- GINT_TO_POINTER (text_dir));
-
- clutter_actor_queue_relayout (self);
- }
-}
-
-void
-_clutter_actor_set_has_pointer (ClutterActor *self,
- gboolean has_pointer)
-{
- ClutterActorPrivate *priv = self->priv;
-
- if (priv->has_pointer != has_pointer)
- {
- priv->has_pointer = has_pointer;
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_HAS_POINTER]);
- }
-}
-
-void
-_clutter_actor_set_has_key_focus (ClutterActor *self,
- gboolean has_key_focus)
-{
- ClutterActorPrivate *priv = self->priv;
-
- if (priv->has_key_focus != has_key_focus)
- {
- priv->has_key_focus = has_key_focus;
-
- if (CLUTTER_ACTOR_IN_DESTRUCTION (self))
- return;
-
- if (has_key_focus)
- g_signal_emit (self, actor_signals[KEY_FOCUS_IN], 0);
- else
- g_signal_emit (self, actor_signals[KEY_FOCUS_OUT], 0);
- }
-}
-
-/**
- * clutter_actor_get_text_direction:
- * @self: a #ClutterActor
- *
- * Retrieves the value set using clutter_actor_set_text_direction()
- *
- * If no text direction has been previously set, the default text
- * direction, as returned by clutter_get_default_text_direction(), will
- * be returned instead
- *
- * Return value: the #ClutterTextDirection for the actor
- *
- * Since: 1.2
- */
-ClutterTextDirection
-clutter_actor_get_text_direction (ClutterActor *self)
-{
- ClutterActorPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self),
- CLUTTER_TEXT_DIRECTION_LTR);
-
- priv = self->priv;
-
- /* if no direction has been set yet use the default */
- if (priv->text_direction == CLUTTER_TEXT_DIRECTION_DEFAULT)
- priv->text_direction = clutter_get_default_text_direction ();
-
- return priv->text_direction;
-}
-
-/**
- * clutter_actor_has_pointer:
- * @self: a #ClutterActor
- *
- * Checks whether an actor contains the pointer of a
- * #ClutterInputDevice
- *
- * Return value: %TRUE if the actor contains the pointer, and
- * %FALSE otherwise
- *
- * Since: 1.2
- */
-gboolean
-clutter_actor_has_pointer (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- return self->priv->has_pointer;
-}
-
-/**
- * clutter_actor_has_allocation:
- * @self: a #ClutterActor
- *
- * Checks if the actor has an up-to-date allocation assigned to
- * it. This means that the actor should have an allocation: it's
- * visible and has a parent. It also means that there is no
- * outstanding relayout request in progress for the actor or its
- * children (There might be other outstanding layout requests in
- * progress that will cause the actor to get a new allocation
- * when the stage is laid out, however).
- *
- * If this function returns %FALSE, then the actor will normally
- * be allocated before it is next drawn on the screen.
- *
- * Return value: %TRUE if the actor has an up-to-date allocation
- *
- * Since: 1.4
- */
-gboolean
-clutter_actor_has_allocation (ClutterActor *self)
-{
- ClutterActorPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- priv = self->priv;
-
- return priv->parent != NULL &&
- CLUTTER_ACTOR_IS_VISIBLE (self) &&
- !priv->needs_allocation;
-}
-
-/**
- * clutter_actor_add_action:
- * @self: a #ClutterActor
- * @action: a #ClutterAction
- *
- * Adds @action to the list of actions applied to @self
- *
- * A #ClutterAction can only belong to one actor at a time
- *
- * The #ClutterActor will hold a reference on @action until either
- * clutter_actor_remove_action() or clutter_actor_clear_actions()
- * is called
- *
- * Since: 1.4
- */
-void
-clutter_actor_add_action (ClutterActor *self,
- ClutterAction *action)
-{
- ClutterActorPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (CLUTTER_IS_ACTION (action));
-
- priv = self->priv;
-
- if (priv->actions == NULL)
- {
- priv->actions = g_object_new (CLUTTER_TYPE_META_GROUP, NULL);
- priv->actions->actor = self;
- }
-
- _clutter_meta_group_add_meta (priv->actions, CLUTTER_ACTOR_META (action));
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ACTIONS]);
-}
-
-/**
- * clutter_actor_add_action_with_name:
- * @self: a #ClutterActor
- * @name: the name to set on the action
- * @action: a #ClutterAction
- *
- * A convenience function for setting the name of a #ClutterAction
- * while adding it to the list of actions applied to @self
- *
- * This function is the logical equivalent of:
- *
- * |[<!-- language="C" -->
- * clutter_actor_meta_set_name (CLUTTER_ACTOR_META (action), name);
- * clutter_actor_add_action (self, action);
- * ]|
- *
- * Since: 1.4
- */
-void
-clutter_actor_add_action_with_name (ClutterActor *self,
- const gchar *name,
- ClutterAction *action)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (name != NULL);
- g_return_if_fail (CLUTTER_IS_ACTION (action));
-
- clutter_actor_meta_set_name (CLUTTER_ACTOR_META (action), name);
- clutter_actor_add_action (self, action);
-}
-
-/**
- * clutter_actor_remove_action:
- * @self: a #ClutterActor
- * @action: a #ClutterAction
- *
- * Removes @action from the list of actions applied to @self
- *
- * The reference held by @self on the #ClutterAction will be released
- *
- * Since: 1.4
- */
-void
-clutter_actor_remove_action (ClutterActor *self,
- ClutterAction *action)
-{
- ClutterActorPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (CLUTTER_IS_ACTION (action));
-
- priv = self->priv;
-
- if (priv->actions == NULL)
- return;
-
- _clutter_meta_group_remove_meta (priv->actions, CLUTTER_ACTOR_META (action));
-
- if (_clutter_meta_group_peek_metas (priv->actions) == NULL)
- g_clear_object (&priv->actions);
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ACTIONS]);
-}
-
-/**
- * clutter_actor_remove_action_by_name:
- * @self: a #ClutterActor
- * @name: the name of the action to remove
- *
- * Removes the #ClutterAction with the given name from the list
- * of actions applied to @self
- *
- * Since: 1.4
- */
-void
-clutter_actor_remove_action_by_name (ClutterActor *self,
- const gchar *name)
-{
- ClutterActorPrivate *priv;
- ClutterActorMeta *meta;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (name != NULL);
-
- priv = self->priv;
-
- if (priv->actions == NULL)
- return;
-
- meta = _clutter_meta_group_get_meta (priv->actions, name);
- if (meta == NULL)
- return;
-
- _clutter_meta_group_remove_meta (priv->actions, meta);
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ACTIONS]);
-}
-
-/**
- * clutter_actor_get_actions:
- * @self: a #ClutterActor
- *
- * Retrieves the list of actions applied to @self
- *
- * Return value: (transfer container) (element-type Clutter.Action): a copy
- * of the list of #ClutterAction<!-- -->s. The contents of the list are
- * owned by the #ClutterActor. Use g_list_free() to free the resources
- * allocated by the returned #GList
- *
- * Since: 1.4
- */
-GList *
-clutter_actor_get_actions (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
-
- if (self->priv->actions == NULL)
- return NULL;
-
- return _clutter_meta_group_get_metas_no_internal (self->priv->actions);
-}
-
-/**
- * clutter_actor_get_action:
- * @self: a #ClutterActor
- * @name: the name of the action to retrieve
- *
- * Retrieves the #ClutterAction with the given name in the list
- * of actions applied to @self
- *
- * Return value: (transfer none): a #ClutterAction for the given
- * name, or %NULL. The returned #ClutterAction is owned by the
- * actor and it should not be unreferenced directly
- *
- * Since: 1.4
- */
-ClutterAction *
-clutter_actor_get_action (ClutterActor *self,
- const gchar *name)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
- g_return_val_if_fail (name != NULL, NULL);
-
- if (self->priv->actions == NULL)
- return NULL;
-
- return CLUTTER_ACTION (_clutter_meta_group_get_meta (self->priv->actions, name));
-}
-
-/**
- * clutter_actor_clear_actions:
- * @self: a #ClutterActor
- *
- * Clears the list of actions applied to @self
- *
- * Since: 1.4
- */
-void
-clutter_actor_clear_actions (ClutterActor *self)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- if (self->priv->actions == NULL)
- return;
-
- _clutter_meta_group_clear_metas_no_internal (self->priv->actions);
-}
-
-/**
- * clutter_actor_add_constraint:
- * @self: a #ClutterActor
- * @constraint: a #ClutterConstraint
- *
- * Adds @constraint to the list of #ClutterConstraint<!-- -->s applied
- * to @self
- *
- * The #ClutterActor will hold a reference on the @constraint until
- * either clutter_actor_remove_constraint() or
- * clutter_actor_clear_constraints() is called.
- *
- * Since: 1.4
- */
-void
-clutter_actor_add_constraint (ClutterActor *self,
- ClutterConstraint *constraint)
-{
- ClutterActorPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (CLUTTER_IS_CONSTRAINT (constraint));
-
- priv = self->priv;
-
- if (priv->constraints == NULL)
- {
- priv->constraints = g_object_new (CLUTTER_TYPE_META_GROUP, NULL);
- priv->constraints->actor = self;
- }
-
- _clutter_meta_group_add_meta (priv->constraints,
- CLUTTER_ACTOR_META (constraint));
- clutter_actor_queue_relayout (self);
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_CONSTRAINTS]);
-}
-
-/**
- * clutter_actor_add_constraint_with_name:
- * @self: a #ClutterActor
- * @name: the name to set on the constraint
- * @constraint: a #ClutterConstraint
- *
- * A convenience function for setting the name of a #ClutterConstraint
- * while adding it to the list of constraints applied to @self
- *
- * This function is the logical equivalent of:
- *
- * |[<!-- language="C" -->
- * clutter_actor_meta_set_name (CLUTTER_ACTOR_META (constraint), name);
- * clutter_actor_add_constraint (self, constraint);
- * ]|
- *
- * Since: 1.4
- */
-void
-clutter_actor_add_constraint_with_name (ClutterActor *self,
- const gchar *name,
- ClutterConstraint *constraint)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (name != NULL);
- g_return_if_fail (CLUTTER_IS_CONSTRAINT (constraint));
-
- clutter_actor_meta_set_name (CLUTTER_ACTOR_META (constraint), name);
- clutter_actor_add_constraint (self, constraint);
-}
-
-/**
- * clutter_actor_remove_constraint:
- * @self: a #ClutterActor
- * @constraint: a #ClutterConstraint
- *
- * Removes @constraint from the list of constraints applied to @self
- *
- * The reference held by @self on the #ClutterConstraint will be released
- *
- * Since: 1.4
- */
-void
-clutter_actor_remove_constraint (ClutterActor *self,
- ClutterConstraint *constraint)
-{
- ClutterActorPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (CLUTTER_IS_CONSTRAINT (constraint));
-
- priv = self->priv;
-
- if (priv->constraints == NULL)
- return;
-
- _clutter_meta_group_remove_meta (priv->constraints,
- CLUTTER_ACTOR_META (constraint));
-
- if (_clutter_meta_group_peek_metas (priv->constraints) == NULL)
- g_clear_object (&priv->constraints);
-
- clutter_actor_queue_relayout (self);
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_CONSTRAINTS]);
-}
-
-/**
- * clutter_actor_remove_constraint_by_name:
- * @self: a #ClutterActor
- * @name: the name of the constraint to remove
- *
- * Removes the #ClutterConstraint with the given name from the list
- * of constraints applied to @self
- *
- * Since: 1.4
- */
-void
-clutter_actor_remove_constraint_by_name (ClutterActor *self,
- const gchar *name)
-{
- ClutterActorPrivate *priv;
- ClutterActorMeta *meta;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (name != NULL);
-
- priv = self->priv;
-
- if (priv->constraints == NULL)
- return;
-
- meta = _clutter_meta_group_get_meta (priv->constraints, name);
- if (meta == NULL)
- return;
-
- _clutter_meta_group_remove_meta (priv->constraints, meta);
- clutter_actor_queue_relayout (self);
-}
-
-/**
- * clutter_actor_get_constraints:
- * @self: a #ClutterActor
- *
- * Retrieves the list of constraints applied to @self
- *
- * Return value: (transfer container) (element-type Clutter.Constraint): a copy
- * of the list of #ClutterConstraint<!-- -->s. The contents of the list are
- * owned by the #ClutterActor. Use g_list_free() to free the resources
- * allocated by the returned #GList
- *
- * Since: 1.4
- */
-GList *
-clutter_actor_get_constraints (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
-
- if (self->priv->constraints == NULL)
- return NULL;
-
- return _clutter_meta_group_get_metas_no_internal (self->priv->constraints);
-}
-
-/**
- * clutter_actor_get_constraint:
- * @self: a #ClutterActor
- * @name: the name of the constraint to retrieve
- *
- * Retrieves the #ClutterConstraint with the given name in the list
- * of constraints applied to @self
- *
- * Return value: (transfer none): a #ClutterConstraint for the given
- * name, or %NULL. The returned #ClutterConstraint is owned by the
- * actor and it should not be unreferenced directly
- *
- * Since: 1.4
- */
-ClutterConstraint *
-clutter_actor_get_constraint (ClutterActor *self,
- const gchar *name)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
- g_return_val_if_fail (name != NULL, NULL);
-
- if (self->priv->constraints == NULL)
- return NULL;
-
- return CLUTTER_CONSTRAINT (_clutter_meta_group_get_meta (self->priv->constraints, name));
-}
-
-/**
- * clutter_actor_clear_constraints:
- * @self: a #ClutterActor
- *
- * Clears the list of constraints applied to @self
- *
- * Since: 1.4
- */
-void
-clutter_actor_clear_constraints (ClutterActor *self)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- if (self->priv->constraints == NULL)
- return;
-
- _clutter_meta_group_clear_metas_no_internal (self->priv->constraints);
-
- clutter_actor_queue_relayout (self);
-}
-
-/**
- * clutter_actor_set_clip_to_allocation:
- * @self: a #ClutterActor
- * @clip_set: %TRUE to apply a clip tracking the allocation
- *
- * Sets whether @self should be clipped to the same size as its
- * allocation
- *
- * Since: 1.4
- */
-void
-clutter_actor_set_clip_to_allocation (ClutterActor *self,
- gboolean clip_set)
-{
- ClutterActorPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- clip_set = !!clip_set;
-
- priv = self->priv;
-
- if (priv->clip_to_allocation != clip_set)
- {
- priv->clip_to_allocation = clip_set;
-
- queue_update_paint_volume (self);
- clutter_actor_queue_redraw (self);
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_CLIP_TO_ALLOCATION]);
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_HAS_CLIP]);
- }
-}
-
-/**
- * clutter_actor_get_clip_to_allocation:
- * @self: a #ClutterActor
- *
- * Retrieves the value set using clutter_actor_set_clip_to_allocation()
- *
- * Return value: %TRUE if the #ClutterActor is clipped to its allocation
- *
- * Since: 1.4
- */
-gboolean
-clutter_actor_get_clip_to_allocation (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- return self->priv->clip_to_allocation;
-}
-
-/**
- * clutter_actor_add_effect:
- * @self: a #ClutterActor
- * @effect: a #ClutterEffect
- *
- * Adds @effect to the list of #ClutterEffect<!-- -->s applied to @self
- *
- * The #ClutterActor will hold a reference on the @effect until either
- * clutter_actor_remove_effect() or clutter_actor_clear_effects() is
- * called.
- *
- * Since: 1.4
- */
-void
-clutter_actor_add_effect (ClutterActor *self,
- ClutterEffect *effect)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (CLUTTER_IS_EFFECT (effect));
-
- _clutter_actor_add_effect_internal (self, effect);
-
- clutter_actor_queue_redraw (self);
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_EFFECT]);
-}
-
-/**
- * clutter_actor_add_effect_with_name:
- * @self: a #ClutterActor
- * @name: the name to set on the effect
- * @effect: a #ClutterEffect
- *
- * A convenience function for setting the name of a #ClutterEffect
- * while adding it to the list of effectss applied to @self
- *
- * This function is the logical equivalent of:
- *
- * |[<!-- language="C" -->
- * clutter_actor_meta_set_name (CLUTTER_ACTOR_META (effect), name);
- * clutter_actor_add_effect (self, effect);
- * ]|
- *
- * Since: 1.4
- */
-void
-clutter_actor_add_effect_with_name (ClutterActor *self,
- const gchar *name,
- ClutterEffect *effect)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (name != NULL);
- g_return_if_fail (CLUTTER_IS_EFFECT (effect));
-
- clutter_actor_meta_set_name (CLUTTER_ACTOR_META (effect), name);
- clutter_actor_add_effect (self, effect);
-}
-
-/**
- * clutter_actor_remove_effect:
- * @self: a #ClutterActor
- * @effect: a #ClutterEffect
- *
- * Removes @effect from the list of effects applied to @self
- *
- * The reference held by @self on the #ClutterEffect will be released
- *
- * Since: 1.4
- */
-void
-clutter_actor_remove_effect (ClutterActor *self,
- ClutterEffect *effect)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (CLUTTER_IS_EFFECT (effect));
-
- _clutter_actor_remove_effect_internal (self, effect);
-
- clutter_actor_queue_redraw (self);
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_EFFECT]);
-}
-
-/**
- * clutter_actor_remove_effect_by_name:
- * @self: a #ClutterActor
- * @name: the name of the effect to remove
- *
- * Removes the #ClutterEffect with the given name from the list
- * of effects applied to @self
- *
- * Since: 1.4
- */
-void
-clutter_actor_remove_effect_by_name (ClutterActor *self,
- const gchar *name)
-{
- ClutterActorPrivate *priv;
- ClutterActorMeta *meta;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (name != NULL);
-
- priv = self->priv;
-
- if (priv->effects == NULL)
- return;
-
- meta = _clutter_meta_group_get_meta (priv->effects, name);
- if (meta == NULL)
- return;
-
- clutter_actor_remove_effect (self, CLUTTER_EFFECT (meta));
-}
-
-/**
- * clutter_actor_get_effects:
- * @self: a #ClutterActor
- *
- * Retrieves the #ClutterEffect<!-- -->s applied on @self, if any
- *
- * Return value: (transfer container) (element-type Clutter.Effect): a list
- * of #ClutterEffect<!-- -->s, or %NULL. The elements of the returned
- * list are owned by Clutter and they should not be freed. You should
- * free the returned list using g_list_free() when done
- *
- * Since: 1.4
- */
-GList *
-clutter_actor_get_effects (ClutterActor *self)
-{
- ClutterActorPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
-
- priv = self->priv;
-
- if (priv->effects == NULL)
- return NULL;
-
- return _clutter_meta_group_get_metas_no_internal (priv->effects);
-}
-
-/**
- * clutter_actor_get_effect:
- * @self: a #ClutterActor
- * @name: the name of the effect to retrieve
- *
- * Retrieves the #ClutterEffect with the given name in the list
- * of effects applied to @self
- *
- * Return value: (transfer none): a #ClutterEffect for the given
- * name, or %NULL. The returned #ClutterEffect is owned by the
- * actor and it should not be unreferenced directly
- *
- * Since: 1.4
- */
-ClutterEffect *
-clutter_actor_get_effect (ClutterActor *self,
- const gchar *name)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
- g_return_val_if_fail (name != NULL, NULL);
-
- if (self->priv->effects == NULL)
- return NULL;
-
- return CLUTTER_EFFECT (_clutter_meta_group_get_meta (self->priv->effects, name));
-}
-
-/**
- * clutter_actor_clear_effects:
- * @self: a #ClutterActor
- *
- * Clears the list of effects applied to @self
- *
- * Since: 1.4
- */
-void
-clutter_actor_clear_effects (ClutterActor *self)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- if (self->priv->effects == NULL)
- return;
-
- _clutter_meta_group_clear_metas_no_internal (self->priv->effects);
-
- clutter_actor_queue_redraw (self);
-}
-
-/**
- * clutter_actor_has_key_focus:
- * @self: a #ClutterActor
- *
- * Checks whether @self is the #ClutterActor that has key focus
- *
- * Return value: %TRUE if the actor has key focus, and %FALSE otherwise
- *
- * Since: 1.4
- */
-gboolean
-clutter_actor_has_key_focus (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- return self->priv->has_key_focus;
-}
-
-static gboolean
-_clutter_actor_get_paint_volume_real (ClutterActor *self,
- ClutterPaintVolume *pv)
-{
- ClutterActorPrivate *priv = self->priv;
-
- /* Actors are only expected to report a valid paint volume
- * while they have a valid allocation. */
- if (G_UNLIKELY (priv->needs_allocation))
- {
- CLUTTER_NOTE (CLIPPING, "Bail from get_paint_volume (%s): "
- "Actor needs allocation",
- _clutter_actor_get_debug_name (self));
- return FALSE;
- }
-
- _clutter_paint_volume_init_static (pv, self);
-
- if (!CLUTTER_ACTOR_GET_CLASS (self)->get_paint_volume (self, pv))
- {
- clutter_paint_volume_free (pv);
- CLUTTER_NOTE (CLIPPING, "Bail from get_paint_volume (%s): "
- "Actor failed to report a volume",
- _clutter_actor_get_debug_name (self));
- return FALSE;
- }
-
- /* since effects can modify the paint volume, we allow them to actually
- * do this by making get_paint_volume() "context sensitive"
- */
- if (priv->effects != NULL)
- {
- if (priv->current_effect != NULL)
- {
- const GList *effects, *l;
-
- /* if we are being called from within the paint sequence of
- * an actor, get the paint volume up to the current effect
- */
- effects = _clutter_meta_group_peek_metas (priv->effects);
- for (l = effects;
- l != NULL && l->data != priv->current_effect;
- l = l->next)
- {
- if (!_clutter_effect_modify_paint_volume (l->data, pv))
- {
- clutter_paint_volume_free (pv);
- CLUTTER_NOTE (CLIPPING, "Bail from get_paint_volume (%s): "
- "Effect (%s) failed to report a volume",
- _clutter_actor_get_debug_name (self),
- _clutter_actor_meta_get_debug_name (l->data));
- return FALSE;
- }
- }
- }
- else
- {
- const GList *effects, *l;
-
- /* otherwise, get the cumulative volume */
- effects = _clutter_meta_group_peek_metas (priv->effects);
- for (l = effects; l != NULL; l = l->next)
- if (!_clutter_effect_modify_paint_volume (l->data, pv))
- {
- clutter_paint_volume_free (pv);
- CLUTTER_NOTE (CLIPPING, "Bail from get_paint_volume (%s): "
- "Effect (%s) failed to report a volume",
- _clutter_actor_get_debug_name (self),
- _clutter_actor_meta_get_debug_name (l->data));
- return FALSE;
- }
- }
- }
-
- return TRUE;
-}
-
-static gboolean
-_clutter_actor_has_active_paint_volume_override_effects (ClutterActor *self)
-{
- const GList *l;
-
- if (self->priv->effects == NULL)
- return FALSE;
-
- /* We just need to all effects current effect to see
- * if anyone wants to override the paint volume. If so, then
- * we need to recompute, since the paint volume returned can
- * change from call to call. */
- for (l = _clutter_meta_group_peek_metas (self->priv->effects);
- l != NULL;
- l = l->next)
- {
- ClutterEffect *effect = l->data;
-
- if (clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (effect)) &&
- _clutter_effect_has_custom_paint_volume (effect))
- return TRUE;
- }
-
- return FALSE;
-}
-
-/* The public clutter_actor_get_paint_volume API returns a const
- * pointer since we return a pointer directly to the cached
- * PaintVolume associated with the actor and don't want the user to
- * inadvertently modify it, but for internal uses we sometimes need
- * access to the same PaintVolume but need to apply some book-keeping
- * modifications to it so we don't want a const pointer.
- */
-static ClutterPaintVolume *
-_clutter_actor_get_paint_volume_mutable (ClutterActor *self)
-{
- gboolean has_paint_volume_override_effects;
- ClutterActorPrivate *priv;
-
- priv = self->priv;
-
- has_paint_volume_override_effects = _clutter_actor_has_active_paint_volume_override_effects (self);
-
- if (priv->paint_volume_valid)
- {
- /* If effects are applied, the actor paint volume
- * needs to be recomputed on each paint, since those
- * paint volumes could change over the duration of the
- * effect.
- *
- * We also need to update the paint volume if we went
- * from having effects to not having effects on the last
- * paint volume update. */
- if (!priv->needs_paint_volume_update &&
- priv->current_effect == NULL &&
- !has_paint_volume_override_effects &&
- !priv->had_effects_on_last_paint_volume_update)
- return &priv->paint_volume;
- clutter_paint_volume_free (&priv->paint_volume);
- }
-
- priv->had_effects_on_last_paint_volume_update = has_paint_volume_override_effects;
-
- if (_clutter_actor_get_paint_volume_real (self, &priv->paint_volume))
- {
- priv->paint_volume_valid = TRUE;
- priv->needs_paint_volume_update = FALSE;
- return &priv->paint_volume;
- }
- else
- {
- priv->paint_volume_valid = FALSE;
- return NULL;
- }
-}
-
-/**
- * clutter_actor_get_paint_volume:
- * @self: a #ClutterActor
- *
- * Retrieves the paint volume of the passed #ClutterActor, or %NULL
- * when a paint volume can't be determined.
- *
- * The paint volume is defined as the 3D space occupied by an actor
- * when being painted.
- *
- * This function will call the #ClutterActorClass.get_paint_volume()
- * virtual function of the #ClutterActor class. Sub-classes of #ClutterActor
- * should not usually care about overriding the default implementation,
- * unless they are, for instance: painting outside their allocation, or
- * actors with a depth factor (not in terms of #ClutterActor:depth but real
- * 3D depth).
- *
- * Note: 2D actors overriding #ClutterActorClass.get_paint_volume()
- * should ensure that their volume has a depth of 0. (This will be true
- * as long as you don't call clutter_paint_volume_set_depth().)
- *
- * Return value: (transfer none): a pointer to a #ClutterPaintVolume,
- * or %NULL if no volume could be determined. The returned pointer
- * is not guaranteed to be valid across multiple frames; if you want
- * to keep it, you will need to copy it using clutter_paint_volume_copy().
- *
- * Since: 1.6
- */
-const ClutterPaintVolume *
-clutter_actor_get_paint_volume (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
-
- return _clutter_actor_get_paint_volume_mutable (self);
-}
-
-/**
- * clutter_actor_get_transformed_paint_volume:
- * @self: a #ClutterActor
- * @relative_to_ancestor: A #ClutterActor that is an ancestor of @self
- * (or %NULL for the stage)
- *
- * Retrieves the 3D paint volume of an actor like
- * clutter_actor_get_paint_volume() does (Please refer to the
- * documentation of clutter_actor_get_paint_volume() for more
- * details.) and it additionally transforms the paint volume into the
- * coordinate space of @relative_to_ancestor. (Or the stage if %NULL
- * is passed for @relative_to_ancestor)
- *
- * This can be used by containers that base their paint volume on
- * the volume of their children. Such containers can query the
- * transformed paint volume of all of its children and union them
- * together using clutter_paint_volume_union().
- *
- * Return value: (transfer none): a pointer to a #ClutterPaintVolume,
- * or %NULL if no volume could be determined. The returned pointer is
- * not guaranteed to be valid across multiple frames; if you wish to
- * keep it, you will have to copy it using clutter_paint_volume_copy().
- *
- * Since: 1.6
- */
-const ClutterPaintVolume *
-clutter_actor_get_transformed_paint_volume (ClutterActor *self,
- ClutterActor *relative_to_ancestor)
-{
- const ClutterPaintVolume *volume;
- ClutterActor *stage;
- ClutterPaintVolume *transformed_volume;
-
- stage = _clutter_actor_get_stage_internal (self);
- if (G_UNLIKELY (stage == NULL))
- return NULL;
-
- if (relative_to_ancestor == NULL)
- relative_to_ancestor = stage;
-
- volume = clutter_actor_get_paint_volume (self);
- if (volume == NULL)
- return NULL;
-
- transformed_volume =
- _clutter_stage_paint_volume_stack_allocate (CLUTTER_STAGE (stage));
-
- _clutter_paint_volume_copy_static (volume, transformed_volume);
-
- _clutter_paint_volume_transform_relative (transformed_volume,
- relative_to_ancestor);
-
- return transformed_volume;
-}
-
-/**
- * clutter_actor_get_paint_box:
- * @self: a #ClutterActor
- * @box: (out): return location for a #ClutterActorBox
- *
- * Retrieves the paint volume of the passed #ClutterActor, and
- * transforms it into a 2D bounding box in stage coordinates.
- *
- * This function is useful to determine the on screen area occupied by
- * the actor. The box is only an approximation and may often be
- * considerably larger due to the optimizations used to calculate the
- * box. The box is never smaller though, so it can reliably be used
- * for culling.
- *
- * There are times when a 2D paint box can't be determined, e.g.
- * because the actor isn't yet parented under a stage or because
- * the actor is unable to determine a paint volume.
- *
- * Return value: %TRUE if a 2D paint box could be determined, else
- * %FALSE.
- *
- * Since: 1.6
- */
-gboolean
-clutter_actor_get_paint_box (ClutterActor *self,
- ClutterActorBox *box)
-{
- ClutterActor *stage;
- ClutterPaintVolume *pv;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
- g_return_val_if_fail (box != NULL, FALSE);
-
- stage = _clutter_actor_get_stage_internal (self);
- if (G_UNLIKELY (!stage))
- return FALSE;
-
- pv = _clutter_actor_get_paint_volume_mutable (self);
- if (G_UNLIKELY (!pv))
- return FALSE;
-
- _clutter_paint_volume_get_stage_paint_box (pv, CLUTTER_STAGE (stage), box);
-
- return TRUE;
-}
-
-static ClutterActorTraverseVisitFlags
-clear_stage_views_cb (ClutterActor *actor,
- int depth,
- gpointer user_data)
-{
- g_autoptr (GList) old_stage_views = NULL;
-
- actor->priv->needs_update_stage_views = TRUE;
-
- old_stage_views = g_steal_pointer (&actor->priv->stage_views);
-
- if (old_stage_views)
- g_signal_emit (actor, actor_signals[STAGE_VIEWS_CHANGED], 0);
-
- return CLUTTER_ACTOR_TRAVERSE_VISIT_CONTINUE;
-}
-
-void
-clutter_actor_clear_stage_views_recursive (ClutterActor *self)
-{
- _clutter_actor_traverse (self,
- CLUTTER_ACTOR_TRAVERSE_DEPTH_FIRST,
- clear_stage_views_cb,
- NULL,
- NULL);
-}
-
-float
-clutter_actor_get_real_resource_scale (ClutterActor *self)
-{
- ClutterActorPrivate *priv = self->priv;
- float guessed_scale;
-
- if (priv->resource_scale != -1.f)
- return priv->resource_scale;
-
- /* If the scale hasn't been computed yet, we return a best guess */
-
- if (priv->parent != NULL)
- {
- /* If the scale hasn't been calculated yet, assume this actor is located
- * inside its parents box and go up the hierarchy.
- */
- guessed_scale = clutter_actor_get_real_resource_scale (priv->parent);
- }
- else if (CLUTTER_ACTOR_IS_TOPLEVEL (self))
- {
- /* This must be the first allocation cycle and the resource scale of
- * the stage has not been updated yet, so return it manually.
- */
- GList *l;
- ClutterStage *stage = CLUTTER_STAGE (self);
- float max_scale = -1.f;
-
- for (l = clutter_stage_peek_stage_views (stage); l; l = l->next)
- {
- ClutterStageView *view = l->data;
-
- max_scale = MAX (clutter_stage_view_get_scale (view), max_scale);
- }
-
- guessed_scale = max_scale;
- }
- else
- {
- ClutterBackend *backend = clutter_get_default_backend ();
-
- guessed_scale = clutter_backend_get_fallback_resource_scale (backend);
- }
-
- g_assert (guessed_scale >= 1.f);
-
- /* Always return this value until we compute the correct one later.
- * If our guess turns out to be wrong, we'll emit "resource-scale-changed"
- * and correct it before painting.
- */
- priv->resource_scale = guessed_scale;
-
- return priv->resource_scale;
-}
-
-/**
- * clutter_actor_get_resource_scale:
- * @self: A #ClutterActor
- *
- * Retrieves the resource scale for this actor.
- *
- * The resource scale refers to the scale the actor should use for its resources.
- * For example if an actor draws a a picture of size 100 x 100 in the stage
- * coordinate space, it should use a texture of twice the size (i.e. 200 x 200)
- * if the resource scale is 2.
- *
- * The resource scale is determined by calculating the highest #ClutterStageView
- * scale the actor will get painted on.
- *
- * Note that the scale returned by this function is only guaranteed to be
- * correct when queried during the paint cycle, in all other cases this
- * function will only return a best guess. If your implementation really
- * needs to get a resource scale outside of the paint cycle, make sure to
- * subscribe to the "resource-scale-changed" signal to get notified about
- * the new, correct resource scale before painting.
- *
- * Also avoid getting the resource scale for actors that are not attached
- * to a stage. There's no sane way for Clutter to guess which #ClutterStageView
- * the actor is going to be painted on, so you'll probably end up receiving
- * the "resource-scale-changed" signal and having to rebuild your resources.
- *
- * The best guess this function may return is usually just the last resource
- * scale the actor got painted with. If this resource scale couldn't be found
- * because the actor was never painted so far or Clutter was unable to
- * determine its position and size, this function will return the resource
- * scale of a parent.
- *
- * Returns: The resource scale the actor should use for its textures
- */
-float
-clutter_actor_get_resource_scale (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 1.f);
-
- return ceilf (clutter_actor_get_real_resource_scale (self));
-}
-
-static gboolean
-sorted_lists_equal (GList *list_a,
- GList *list_b)
-{
- GList *a, *b;
-
- if (!list_a && !list_b)
- return TRUE;
-
- for (a = list_a, b = list_b;
- a && b;
- a = a->next, b = b->next)
- {
- if (a->data != b->data)
- break;
-
- if (!a->next && !b->next)
- return TRUE;
- }
-
- return FALSE;
-}
-
-static void
-update_stage_views (ClutterActor *self)
-{
- ClutterActorPrivate *priv = self->priv;
- g_autoptr (GList) old_stage_views = NULL;
- ClutterStage *stage;
- graphene_rect_t bounding_rect;
-
- old_stage_views = g_steal_pointer (&priv->stage_views);
-
- if (priv->needs_allocation)
- {
- g_warning ("Can't update stage views actor %s is on because it needs an "
- "allocation.", _clutter_actor_get_debug_name (self));
- goto out;
- }
-
- stage = CLUTTER_STAGE (_clutter_actor_get_stage_internal (self));
- g_return_if_fail (stage);
-
- clutter_actor_get_transformed_extents (self, &bounding_rect);
-
- if (bounding_rect.size.width == 0.0 ||
- bounding_rect.size.height == 0.0)
- goto out;
-
- priv->stage_views = clutter_stage_get_views_for_rect (stage,
- &bounding_rect);
-
-out:
- if (!sorted_lists_equal (old_stage_views, priv->stage_views))
- g_signal_emit (self, actor_signals[STAGE_VIEWS_CHANGED], 0);
-}
-
-static void
-update_resource_scale (ClutterActor *self,
- int phase)
-{
- ClutterActorPrivate *priv = self->priv;
- float new_resource_scale, old_resource_scale;
-
- new_resource_scale =
- CLUTTER_ACTOR_GET_CLASS (self)->calculate_resource_scale (self, phase);
-
- if (priv->resource_scale == new_resource_scale)
- return;
-
- /* If the actor moved out of the stage, simply keep the last scale */
- if (new_resource_scale == -1.f)
- return;
-
- old_resource_scale = priv->resource_scale;
- priv->resource_scale = new_resource_scale;
-
- /* Never notify the initial change, otherwise, to be consistent,
- * we'd also have to notify if we guessed correctly in
- * clutter_actor_get_real_resource_scale().
- */
- if (old_resource_scale == -1.f)
- return;
-
- if (ceilf (old_resource_scale) != ceilf (priv->resource_scale))
- g_signal_emit (self, actor_signals[RESOURCE_SCALE_CHANGED], 0);
-}
-
-void
-clutter_actor_finish_layout (ClutterActor *self,
- gboolean use_max_scale)
-{
- ClutterActorPrivate *priv = self->priv;
- ClutterActor *child;
-
- if (!CLUTTER_ACTOR_IS_MAPPED (self) ||
- CLUTTER_ACTOR_IN_DESTRUCTION (self))
- return;
-
- _clutter_actor_update_last_paint_volume (self);
-
- if (priv->needs_update_stage_views)
- {
- update_stage_views (self);
- update_resource_scale (self, use_max_scale);
-
- priv->needs_update_stage_views = FALSE;
- }
-
- for (child = priv->first_child; child; child = child->priv->next_sibling)
- clutter_actor_finish_layout (child, use_max_scale);
-}
-
-/**
- * clutter_actor_peek_stage_views:
- * @self: A #ClutterActor
- *
- * Retrieves the list of #ClutterStageView<!-- -->s the actor is being
- * painted on.
- *
- * If this function is called during the paint cycle, the list is guaranteed
- * to be up-to-date, if called outside the paint cycle, the list will
- * contain the views the actor was painted on last.
- *
- * The list returned by this function is not updated when the actors
- * visibility changes: If an actor gets hidden and is not being painted
- * anymore, this function will return the list of views the actor was
- * painted on last.
- *
- * If an actor is not attached to a stage (realized), this function will
- * always return an empty list.
- *
- * Returns: (transfer none) (element-type Clutter.StageView): The list of
- * #ClutterStageView<!-- -->s the actor is being painted on. The list and
- * its contents are owned by the #ClutterActor and the list may not be
- * freed or modified.
- */
-GList *
-clutter_actor_peek_stage_views (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- return self->priv->stage_views;
-}
-
-gboolean
-clutter_actor_is_effectively_on_stage_view (ClutterActor *self,
- ClutterStageView *view)
-{
- ClutterActor *actor;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- if (g_list_find (self->priv->stage_views, view))
- return TRUE;
-
- for (actor = self; actor; actor = actor->priv->parent)
- {
- if (actor->priv->clones)
- {
- GHashTableIter iter;
- gpointer key;
-
- g_hash_table_iter_init (&iter, actor->priv->clones);
- while (g_hash_table_iter_next (&iter, &key, NULL))
- {
- ClutterActor *clone = key;
- GList *clone_views;
-
- clone_views = clutter_actor_peek_stage_views (clone);
- if (g_list_find (clone_views, view))
- return TRUE;
- }
- }
- }
-
- return FALSE;
-}
-
-/**
- * clutter_actor_pick_frame_clock: (skip)
- * @self: a #ClutterActor
- * @out_actor: (nullable): a pointer to an #ClutterActor
- *
- * Pick the most suitable frame clock for driving animations for this actor.
- *
- * The #ClutterActor used for picking the frame clock is written @out_actor.
- *
- * Returns: (transfer none): a #ClutterFrameClock
- */
-ClutterFrameClock *
-clutter_actor_pick_frame_clock (ClutterActor *self,
- ClutterActor **out_actor)
-{
- ClutterActorPrivate *priv = self->priv;
- GList *stage_views_list;
- float max_refresh_rate = 0.0;
- ClutterStageView *best_view = NULL;
- GList *l;
-
- stage_views_list = CLUTTER_IS_STAGE (self)
- ? clutter_stage_peek_stage_views (CLUTTER_STAGE (self))
- : priv->stage_views;
-
- if (!stage_views_list)
- {
- if (priv->parent)
- return clutter_actor_pick_frame_clock (priv->parent, out_actor);
- else
- return NULL;
- }
-
- for (l = stage_views_list; l; l = l->next)
- {
- ClutterStageView *view = l->data;
- float refresh_rate;
-
- refresh_rate = clutter_stage_view_get_refresh_rate (view);
- if (refresh_rate > max_refresh_rate)
- {
- best_view = view;
- max_refresh_rate = refresh_rate;
- }
- }
-
- if (best_view)
- {
- if (out_actor)
- *out_actor = self;
- return clutter_stage_view_get_frame_clock (best_view);
- }
- else
- {
- return NULL;
- }
-}
-
-/**
- * clutter_actor_has_overlaps:
- * @self: A #ClutterActor
- *
- * Asks the actor's implementation whether it may contain overlapping
- * primitives.
- *
- * For example; Clutter may use this to determine whether the painting
- * should be redirected to an offscreen buffer to correctly implement
- * the opacity property.
- *
- * Custom actors can override the default response by implementing the
- * #ClutterActorClass.has_overlaps() virtual function. See
- * clutter_actor_set_offscreen_redirect() for more information.
- *
- * Return value: %TRUE if the actor may have overlapping primitives, and
- * %FALSE otherwise
- *
- * Since: 1.8
- */
-gboolean
-clutter_actor_has_overlaps (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), TRUE);
-
- return CLUTTER_ACTOR_GET_CLASS (self)->has_overlaps (self);
-}
-
-/**
- * clutter_actor_has_effects:
- * @self: A #ClutterActor
- *
- * Returns whether the actor has any effects applied.
- *
- * Return value: %TRUE if the actor has any effects,
- * %FALSE otherwise
- *
- * Since: 1.10
- */
-gboolean
-clutter_actor_has_effects (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- if (self->priv->effects == NULL)
- return FALSE;
-
- return _clutter_meta_group_has_metas_no_internal (self->priv->effects);
-}
-
-/**
- * clutter_actor_has_constraints:
- * @self: A #ClutterActor
- *
- * Returns whether the actor has any constraints applied.
- *
- * Return value: %TRUE if the actor has any constraints,
- * %FALSE otherwise
- *
- * Since: 1.10
- */
-gboolean
-clutter_actor_has_constraints (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- if (self->priv->constraints == NULL)
- return FALSE;
-
- return _clutter_meta_group_has_metas_no_internal (self->priv->constraints);
-}
-
-/**
- * clutter_actor_has_actions:
- * @self: A #ClutterActor
- *
- * Returns whether the actor has any actions applied.
- *
- * Return value: %TRUE if the actor has any actions,
- * %FALSE otherwise
- *
- * Since: 1.10
- */
-gboolean
-clutter_actor_has_actions (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- if (self->priv->actions == NULL)
- return FALSE;
-
- return _clutter_meta_group_has_metas_no_internal (self->priv->actions);
-}
-
-/**
- * clutter_actor_get_n_children:
- * @self: a #ClutterActor
- *
- * Retrieves the number of children of @self.
- *
- * Return value: the number of children of an actor
- *
- * Since: 1.10
- */
-gint
-clutter_actor_get_n_children (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
-
- return self->priv->n_children;
-}
-
-/**
- * clutter_actor_get_child_at_index:
- * @self: a #ClutterActor
- * @index_: the position in the list of children
- *
- * Retrieves the actor at the given @index_ inside the list of
- * children of @self.
- *
- * Return value: (transfer none): a pointer to a #ClutterActor, or %NULL
- *
- * Since: 1.10
- */
-ClutterActor *
-clutter_actor_get_child_at_index (ClutterActor *self,
- gint index_)
-{
- ClutterActor *iter;
- int i;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
- g_return_val_if_fail (index_ <= self->priv->n_children, NULL);
-
- for (iter = self->priv->first_child, i = 0;
- iter != NULL && i < index_;
- iter = iter->priv->next_sibling, i += 1)
- ;
-
- return iter;
-}
-
-/*< private >
- * _clutter_actor_foreach_child:
- * @actor: The actor whose children you want to iterate
- * @callback: The function to call for each child
- * @user_data: Private data to pass to @callback
- *
- * Calls a given @callback once for each child of the specified @actor and
- * passing the @user_data pointer each time.
- *
- * Return value: returns %TRUE if all children were iterated, else
- * %FALSE if a callback broke out of iteration early.
- */
-gboolean
-_clutter_actor_foreach_child (ClutterActor *self,
- ClutterForeachCallback callback,
- gpointer user_data)
-{
- ClutterActor *iter;
- gboolean cont;
-
- if (self->priv->first_child == NULL)
- return TRUE;
-
- cont = TRUE;
- iter = self->priv->first_child;
-
- /* we use this form so that it's safe to change the children
- * list while iterating it
- */
- while (cont && iter != NULL)
- {
- ClutterActor *next = iter->priv->next_sibling;
-
- cont = callback (iter, user_data);
-
- iter = next;
- }
-
- return cont;
-}
-
-#if 0
-/* For debugging purposes this gives us a simple way to print out
- * the scenegraph e.g in gdb using:
- * [|
- * _clutter_actor_traverse (stage,
- * 0,
- * clutter_debug_print_actor_cb,
- * NULL,
- * NULL);
- * |]
- */
-static ClutterActorTraverseVisitFlags
-clutter_debug_print_actor_cb (ClutterActor *actor,
- int depth,
- void *user_data)
-{
- g_print ("%*s%s:%p\n",
- depth * 2, "",
- _clutter_actor_get_debug_name (actor),
- actor);
-
- return CLUTTER_ACTOR_TRAVERSE_VISIT_CONTINUE;
-}
-#endif
-
-static void
-_clutter_actor_traverse_breadth (ClutterActor *actor,
- ClutterTraverseCallback callback,
- gpointer user_data)
-{
- GQueue *queue = g_queue_new ();
- ClutterActor dummy;
- int current_depth = 0;
-
- g_queue_push_tail (queue, actor);
- g_queue_push_tail (queue, &dummy); /* use to delimit depth changes */
-
- while ((actor = g_queue_pop_head (queue)))
- {
- ClutterActorTraverseVisitFlags flags;
-
- if (actor == &dummy)
- {
- current_depth++;
- g_queue_push_tail (queue, &dummy);
- continue;
- }
-
- flags = callback (actor, current_depth, user_data);
- if (flags & CLUTTER_ACTOR_TRAVERSE_VISIT_BREAK)
- break;
- else if (!(flags & CLUTTER_ACTOR_TRAVERSE_VISIT_SKIP_CHILDREN))
- {
- ClutterActor *iter;
-
- for (iter = actor->priv->first_child;
- iter != NULL;
- iter = iter->priv->next_sibling)
- {
- g_queue_push_tail (queue, iter);
- }
- }
- }
-
- g_queue_free (queue);
-}
-
-static ClutterActorTraverseVisitFlags
-_clutter_actor_traverse_depth (ClutterActor *actor,
- ClutterTraverseCallback before_children_callback,
- ClutterTraverseCallback after_children_callback,
- int current_depth,
- gpointer user_data)
-{
- ClutterActorTraverseVisitFlags flags;
-
- flags = before_children_callback (actor, current_depth, user_data);
- if (flags & CLUTTER_ACTOR_TRAVERSE_VISIT_BREAK)
- return CLUTTER_ACTOR_TRAVERSE_VISIT_BREAK;
-
- if (!(flags & CLUTTER_ACTOR_TRAVERSE_VISIT_SKIP_CHILDREN))
- {
- ClutterActor *iter;
-
- for (iter = actor->priv->first_child;
- iter != NULL;
- iter = iter->priv->next_sibling)
- {
- flags = _clutter_actor_traverse_depth (iter,
- before_children_callback,
- after_children_callback,
- current_depth + 1,
- user_data);
-
- if (flags & CLUTTER_ACTOR_TRAVERSE_VISIT_BREAK)
- return CLUTTER_ACTOR_TRAVERSE_VISIT_BREAK;
- }
- }
-
- if (after_children_callback)
- return after_children_callback (actor, current_depth, user_data);
- else
- return CLUTTER_ACTOR_TRAVERSE_VISIT_CONTINUE;
-}
-
-/* _clutter_actor_traverse:
- * @actor: The actor to start traversing the graph from
- * @flags: These flags may affect how the traversal is done
- * @before_children_callback: A function to call before visiting the
- * children of the current actor.
- * @after_children_callback: A function to call after visiting the
- * children of the current actor. (Ignored if
- * %CLUTTER_ACTOR_TRAVERSE_BREADTH_FIRST is passed to @flags.)
- * @user_data: The private data to pass to the callbacks
- *
- * Traverses the scenegraph starting at the specified @actor and
- * descending through all its children and its children's children.
- * For each actor traversed @before_children_callback and
- * @after_children_callback are called with the specified
- * @user_data, before and after visiting that actor's children.
- *
- * The callbacks can return flags that affect the ongoing traversal
- * such as by skipping over an actors children or bailing out of
- * any further traversing.
- */
-void
-_clutter_actor_traverse (ClutterActor *actor,
- ClutterActorTraverseFlags flags,
- ClutterTraverseCallback before_children_callback,
- ClutterTraverseCallback after_children_callback,
- gpointer user_data)
-{
- if (flags & CLUTTER_ACTOR_TRAVERSE_BREADTH_FIRST)
- _clutter_actor_traverse_breadth (actor,
- before_children_callback,
- user_data);
- else /* DEPTH_FIRST */
- _clutter_actor_traverse_depth (actor,
- before_children_callback,
- after_children_callback,
- 0, /* start depth */
- user_data);
-}
-
-static void
-on_layout_manager_changed (ClutterLayoutManager *manager,
- ClutterActor *self)
-{
- clutter_actor_queue_relayout (self);
-}
-
-/**
- * clutter_actor_set_layout_manager:
- * @self: a #ClutterActor
- * @manager: (allow-none): a #ClutterLayoutManager, or %NULL to unset it
- *
- * Sets the #ClutterLayoutManager delegate object that will be used to
- * lay out the children of @self.
- *
- * The #ClutterActor will take a reference on the passed @manager which
- * will be released either when the layout manager is removed, or when
- * the actor is destroyed.
- *
- * Since: 1.10
- */
-void
-clutter_actor_set_layout_manager (ClutterActor *self,
- ClutterLayoutManager *manager)
-{
- ClutterActorPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (manager == NULL || CLUTTER_IS_LAYOUT_MANAGER (manager));
-
- priv = self->priv;
-
- if (priv->layout_manager != NULL)
- {
- g_clear_signal_handler (&priv->layout_changed_id, priv->layout_manager);
- clutter_layout_manager_set_container (priv->layout_manager, NULL);
- g_clear_object (&priv->layout_manager);
- }
-
- priv->layout_manager = manager;
-
- if (priv->layout_manager != NULL)
- {
- g_object_ref_sink (priv->layout_manager);
- clutter_layout_manager_set_container (priv->layout_manager,
- CLUTTER_CONTAINER (self));
- priv->layout_changed_id =
- g_signal_connect (priv->layout_manager, "layout-changed",
- G_CALLBACK (on_layout_manager_changed),
- self);
- }
-
- clutter_actor_queue_relayout (self);
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_LAYOUT_MANAGER]);
-}
-
-/**
- * clutter_actor_get_layout_manager:
- * @self: a #ClutterActor
- *
- * Retrieves the #ClutterLayoutManager used by @self.
- *
- * Return value: (transfer none): a pointer to the #ClutterLayoutManager,
- * or %NULL
- *
- * Since: 1.10
- */
-ClutterLayoutManager *
-clutter_actor_get_layout_manager (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
-
- return self->priv->layout_manager;
-}
-
-static const ClutterLayoutInfo default_layout_info = {
- GRAPHENE_POINT_INIT_ZERO, /* fixed-pos */
- { 0, 0, 0, 0 }, /* margin */
- CLUTTER_ACTOR_ALIGN_FILL, /* x-align */
- CLUTTER_ACTOR_ALIGN_FILL, /* y-align */
- FALSE, FALSE, /* expand */
- GRAPHENE_SIZE_INIT_ZERO, /* minimum */
- GRAPHENE_SIZE_INIT_ZERO, /* natural */
-};
-
-static void
-layout_info_free (gpointer data)
-{
- if (G_LIKELY (data != NULL))
- g_free (data);
-}
-
-/*< private >
- * _clutter_actor_peek_layout_info:
- * @self: a #ClutterActor
- *
- * Retrieves a pointer to the ClutterLayoutInfo structure.
- *
- * If the actor does not have a ClutterLayoutInfo associated to it, %NULL is returned.
- *
- * Return value: (transfer none): a pointer to the ClutterLayoutInfo structure
- */
-ClutterLayoutInfo *
-_clutter_actor_peek_layout_info (ClutterActor *self)
-{
- return g_object_get_qdata (G_OBJECT (self), quark_actor_layout_info);
-}
-
-/*< private >
- * _clutter_actor_get_layout_info:
- * @self: a #ClutterActor
- *
- * Retrieves a pointer to the ClutterLayoutInfo structure.
- *
- * If the actor does not have a ClutterLayoutInfo associated to it, one
- * will be created and initialized to the default values.
- *
- * This function should be used for setters.
- *
- * For getters, you should use _clutter_actor_get_layout_info_or_defaults()
- * instead.
- *
- * Return value: (transfer none): a pointer to the ClutterLayoutInfo structure
- */
-ClutterLayoutInfo *
-_clutter_actor_get_layout_info (ClutterActor *self)
-{
- ClutterLayoutInfo *retval;
-
- retval = _clutter_actor_peek_layout_info (self);
- if (retval == NULL)
- {
- retval = g_new0 (ClutterLayoutInfo, 1);
-
- *retval = default_layout_info;
-
- g_object_set_qdata_full (G_OBJECT (self), quark_actor_layout_info,
- retval,
- layout_info_free);
- }
-
- return retval;
-}
-
-/*< private >
- * _clutter_actor_get_layout_info_or_defaults:
- * @self: a #ClutterActor
- *
- * Retrieves the ClutterLayoutInfo structure associated to an actor.
- *
- * If the actor does not have a ClutterLayoutInfo structure associated to it,
- * then the default structure will be returned.
- *
- * This function should only be used for getters.
- *
- * Return value: a const pointer to the ClutterLayoutInfo structure
- */
-const ClutterLayoutInfo *
-_clutter_actor_get_layout_info_or_defaults (ClutterActor *self)
-{
- const ClutterLayoutInfo *info;
-
- info = _clutter_actor_peek_layout_info (self);
- if (info == NULL)
- return &default_layout_info;
-
- return info;
-}
-
-/**
- * clutter_actor_set_x_align:
- * @self: a #ClutterActor
- * @x_align: the horizontal alignment policy
- *
- * Sets the horizontal alignment policy of a #ClutterActor, in case the
- * actor received extra horizontal space.
- *
- * See also the #ClutterActor:x-align property.
- *
- * Since: 1.10
- */
-void
-clutter_actor_set_x_align (ClutterActor *self,
- ClutterActorAlign x_align)
-{
- ClutterLayoutInfo *info;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- info = _clutter_actor_get_layout_info (self);
-
- if (info->x_align != x_align)
- {
- info->x_align = x_align;
-
- clutter_actor_queue_relayout (self);
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_X_ALIGN]);
- }
-}
-
-/**
- * clutter_actor_get_x_align:
- * @self: a #ClutterActor
- *
- * Retrieves the horizontal alignment policy set using
- * clutter_actor_set_x_align().
- *
- * Return value: the horizontal alignment policy.
- *
- * Since: 1.10
- */
-ClutterActorAlign
-clutter_actor_get_x_align (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), CLUTTER_ACTOR_ALIGN_FILL);
-
- return _clutter_actor_get_layout_info_or_defaults (self)->x_align;
-}
-
-/**
- * clutter_actor_set_y_align:
- * @self: a #ClutterActor
- * @y_align: the vertical alignment policy
- *
- * Sets the vertical alignment policy of a #ClutterActor, in case the
- * actor received extra vertical space.
- *
- * See also the #ClutterActor:y-align property.
- *
- * Since: 1.10
- */
-void
-clutter_actor_set_y_align (ClutterActor *self,
- ClutterActorAlign y_align)
-{
- ClutterLayoutInfo *info;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- info = _clutter_actor_get_layout_info (self);
-
- if (info->y_align != y_align)
- {
- info->y_align = y_align;
-
- clutter_actor_queue_relayout (self);
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_Y_ALIGN]);
- }
-}
-
-/**
- * clutter_actor_get_y_align:
- * @self: a #ClutterActor
- *
- * Retrieves the vertical alignment policy set using
- * clutter_actor_set_y_align().
- *
- * Return value: the vertical alignment policy.
- *
- * Since: 1.10
- */
-ClutterActorAlign
-clutter_actor_get_y_align (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), CLUTTER_ACTOR_ALIGN_FILL);
-
- return _clutter_actor_get_layout_info_or_defaults (self)->y_align;
-}
-
-static inline void
-clutter_actor_set_margin_internal (ClutterActor *self,
- gfloat margin,
- GParamSpec *pspec)
-{
- ClutterLayoutInfo *info;
-
- info = _clutter_actor_get_layout_info (self);
-
- if (pspec == obj_props[PROP_MARGIN_TOP])
- info->margin.top = margin;
- else if (pspec == obj_props[PROP_MARGIN_RIGHT])
- info->margin.right = margin;
- else if (pspec == obj_props[PROP_MARGIN_BOTTOM])
- info->margin.bottom = margin;
- else
- info->margin.left = margin;
-
- clutter_actor_queue_relayout (self);
- g_object_notify_by_pspec (G_OBJECT (self), pspec);
-}
-
-/**
- * clutter_actor_set_margin:
- * @self: a #ClutterActor
- * @margin: a #ClutterMargin
- *
- * Sets all the components of the margin of a #ClutterActor.
- *
- * Since: 1.10
- */
-void
-clutter_actor_set_margin (ClutterActor *self,
- const ClutterMargin *margin)
-{
- ClutterLayoutInfo *info;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (margin != NULL);
-
- info = _clutter_actor_get_layout_info (self);
-
- if (info->margin.top != margin->top)
- clutter_actor_set_margin_top (self, margin->top);
-
- if (info->margin.right != margin->right)
- clutter_actor_set_margin_right (self, margin->right);
-
- if (info->margin.bottom != margin->bottom)
- clutter_actor_set_margin_bottom (self, margin->bottom);
-
- if (info->margin.left != margin->left)
- clutter_actor_set_margin_left (self, margin->left);
-}
-
-/**
- * clutter_actor_get_margin:
- * @self: a #ClutterActor
- * @margin: (out caller-allocates): return location for a #ClutterMargin
- *
- * Retrieves all the components of the margin of a #ClutterActor.
- *
- * Since: 1.10
- */
-void
-clutter_actor_get_margin (ClutterActor *self,
- ClutterMargin *margin)
-{
- const ClutterLayoutInfo *info;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (margin != NULL);
-
- info = _clutter_actor_get_layout_info_or_defaults (self);
-
- *margin = info->margin;
-}
-
-/**
- * clutter_actor_set_margin_top:
- * @self: a #ClutterActor
- * @margin: the top margin
- *
- * Sets the margin from the top of a #ClutterActor.
- *
- * The #ClutterActor:margin-top property is animatable.
- *
- * Since: 1.10
- */
-void
-clutter_actor_set_margin_top (ClutterActor *self,
- gfloat margin)
-{
- const ClutterLayoutInfo *info;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (margin >= 0.f);
-
- info = _clutter_actor_get_layout_info_or_defaults (self);
-
- if (info->margin.top == margin)
- return;
-
- _clutter_actor_create_transition (self, obj_props[PROP_MARGIN_TOP],
- info->margin.top,
- margin);
-}
-
-/**
- * clutter_actor_get_margin_top:
- * @self: a #ClutterActor
- *
- * Retrieves the top margin of a #ClutterActor.
- *
- * Return value: the top margin
- *
- * Since: 1.10
- */
-gfloat
-clutter_actor_get_margin_top (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0.f);
-
- return _clutter_actor_get_layout_info_or_defaults (self)->margin.top;
-}
-
-/**
- * clutter_actor_set_margin_bottom:
- * @self: a #ClutterActor
- * @margin: the bottom margin
- *
- * Sets the margin from the bottom of a #ClutterActor.
- *
- * The #ClutterActor:margin-bottom property is animatable.
- *
- * Since: 1.10
- */
-void
-clutter_actor_set_margin_bottom (ClutterActor *self,
- gfloat margin)
-{
- const ClutterLayoutInfo *info;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (margin >= 0.f);
-
- info = _clutter_actor_get_layout_info_or_defaults (self);
-
- if (info->margin.bottom == margin)
- return;
-
- _clutter_actor_create_transition (self, obj_props[PROP_MARGIN_BOTTOM],
- info->margin.bottom,
- margin);
-}
-
-/**
- * clutter_actor_get_margin_bottom:
- * @self: a #ClutterActor
- *
- * Retrieves the bottom margin of a #ClutterActor.
- *
- * Return value: the bottom margin
- *
- * Since: 1.10
- */
-gfloat
-clutter_actor_get_margin_bottom (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0.f);
-
- return _clutter_actor_get_layout_info_or_defaults (self)->margin.bottom;
-}
-
-/**
- * clutter_actor_set_margin_left:
- * @self: a #ClutterActor
- * @margin: the left margin
- *
- * Sets the margin from the left of a #ClutterActor.
- *
- * The #ClutterActor:margin-left property is animatable.
- *
- * Since: 1.10
- */
-void
-clutter_actor_set_margin_left (ClutterActor *self,
- gfloat margin)
-{
- const ClutterLayoutInfo *info;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (margin >= 0.f);
-
- info = _clutter_actor_get_layout_info_or_defaults (self);
-
- if (info->margin.left == margin)
- return;
-
- _clutter_actor_create_transition (self, obj_props[PROP_MARGIN_LEFT],
- info->margin.left,
- margin);
-}
-
-/**
- * clutter_actor_get_margin_left:
- * @self: a #ClutterActor
- *
- * Retrieves the left margin of a #ClutterActor.
- *
- * Return value: the left margin
- *
- * Since: 1.10
- */
-gfloat
-clutter_actor_get_margin_left (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0.f);
-
- return _clutter_actor_get_layout_info_or_defaults (self)->margin.left;
-}
-
-/**
- * clutter_actor_set_margin_right:
- * @self: a #ClutterActor
- * @margin: the right margin
- *
- * Sets the margin from the right of a #ClutterActor.
- *
- * The #ClutterActor:margin-right property is animatable.
- *
- * Since: 1.10
- */
-void
-clutter_actor_set_margin_right (ClutterActor *self,
- gfloat margin)
-{
- const ClutterLayoutInfo *info;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (margin >= 0.f);
-
- info = _clutter_actor_get_layout_info_or_defaults (self);
-
- if (info->margin.right == margin)
- return;
-
- _clutter_actor_create_transition (self, obj_props[PROP_MARGIN_RIGHT],
- info->margin.right,
- margin);
-}
-
-/**
- * clutter_actor_get_margin_right:
- * @self: a #ClutterActor
- *
- * Retrieves the right margin of a #ClutterActor.
- *
- * Return value: the right margin
- *
- * Since: 1.10
- */
-gfloat
-clutter_actor_get_margin_right (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0.f);
-
- return _clutter_actor_get_layout_info_or_defaults (self)->margin.right;
-}
-
-static inline void
-clutter_actor_set_background_color_internal (ClutterActor *self,
- const ClutterColor *color)
-{
- ClutterActorPrivate *priv = self->priv;
- GObject *obj;
-
- if (priv->bg_color_set && clutter_color_equal (color, &priv->bg_color))
- return;
-
- obj = G_OBJECT (self);
-
- priv->bg_color = *color;
- priv->bg_color_set = TRUE;
-
- clutter_actor_queue_redraw (self);
-
- g_object_notify_by_pspec (obj, obj_props[PROP_BACKGROUND_COLOR_SET]);
- g_object_notify_by_pspec (obj, obj_props[PROP_BACKGROUND_COLOR]);
-}
-
-/**
- * clutter_actor_set_background_color:
- * @self: a #ClutterActor
- * @color: (allow-none): a #ClutterColor, or %NULL to unset a previously
- * set color
- *
- * Sets the background color of a #ClutterActor.
- *
- * The background color will be used to cover the whole allocation of the
- * actor. The default background color of an actor is transparent.
- *
- * To check whether an actor has a background color, you can use the
- * #ClutterActor:background-color-set actor property.
- *
- * The #ClutterActor:background-color property is animatable.
- *
- * Since: 1.10
- */
-void
-clutter_actor_set_background_color (ClutterActor *self,
- const ClutterColor *color)
-{
- ClutterActorPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- priv = self->priv;
-
- if (color == NULL)
- {
- GObject *obj = G_OBJECT (self);
-
- priv->bg_color_set = FALSE;
-
- clutter_actor_queue_redraw (self);
-
- g_object_notify_by_pspec (obj, obj_props[PROP_BACKGROUND_COLOR_SET]);
- }
- else
- _clutter_actor_create_transition (self,
- obj_props[PROP_BACKGROUND_COLOR],
- &priv->bg_color,
- color);
-}
-
-/**
- * clutter_actor_get_background_color:
- * @self: a #ClutterActor
- * @color: (out caller-allocates): return location for a #ClutterColor
- *
- * Retrieves the color set using clutter_actor_set_background_color().
- *
- * Since: 1.10
- */
-void
-clutter_actor_get_background_color (ClutterActor *self,
- ClutterColor *color)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (color != NULL);
-
- *color = self->priv->bg_color;
-}
-
-/**
- * clutter_actor_get_previous_sibling:
- * @self: a #ClutterActor
- *
- * Retrieves the sibling of @self that comes before it in the list
- * of children of @self's parent.
- *
- * The returned pointer is only valid until the scene graph changes; it
- * is not safe to modify the list of children of @self while iterating
- * it.
- *
- * Return value: (transfer none): a pointer to a #ClutterActor, or %NULL
- *
- * Since: 1.10
- */
-ClutterActor *
-clutter_actor_get_previous_sibling (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
-
- return self->priv->prev_sibling;
-}
-
-/**
- * clutter_actor_get_next_sibling:
- * @self: a #ClutterActor
- *
- * Retrieves the sibling of @self that comes after it in the list
- * of children of @self's parent.
- *
- * The returned pointer is only valid until the scene graph changes; it
- * is not safe to modify the list of children of @self while iterating
- * it.
- *
- * Return value: (transfer none): a pointer to a #ClutterActor, or %NULL
- *
- * Since: 1.10
- */
-ClutterActor *
-clutter_actor_get_next_sibling (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
-
- return self->priv->next_sibling;
-}
-
-/**
- * clutter_actor_get_first_child:
- * @self: a #ClutterActor
- *
- * Retrieves the first child of @self.
- *
- * The returned pointer is only valid until the scene graph changes; it
- * is not safe to modify the list of children of @self while iterating
- * it.
- *
- * Return value: (transfer none): a pointer to a #ClutterActor, or %NULL
- *
- * Since: 1.10
- */
-ClutterActor *
-clutter_actor_get_first_child (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
-
- return self->priv->first_child;
-}
-
-/**
- * clutter_actor_get_last_child:
- * @self: a #ClutterActor
- *
- * Retrieves the last child of @self.
- *
- * The returned pointer is only valid until the scene graph changes; it
- * is not safe to modify the list of children of @self while iterating
- * it.
- *
- * Return value: (transfer none): a pointer to a #ClutterActor, or %NULL
- *
- * Since: 1.10
- */
-ClutterActor *
-clutter_actor_get_last_child (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
-
- return self->priv->last_child;
-}
-
-/* easy way to have properly named fields instead of the dummy ones
- * we use in the public structure
- */
-typedef struct _RealActorIter
-{
- ClutterActor *root; /* dummy1 */
- ClutterActor *current; /* dummy2 */
- gpointer padding_1; /* dummy3 */
- gint age; /* dummy4 */
- gpointer padding_2; /* dummy5 */
-} RealActorIter;
-
-/**
- * clutter_actor_iter_init:
- * @iter: a #ClutterActorIter
- * @root: a #ClutterActor
- *
- * Initializes a #ClutterActorIter, which can then be used to iterate
- * efficiently over a section of the scene graph, and associates it
- * with @root.
- *
- * Modifying the scene graph section that contains @root will invalidate
- * the iterator.
- *
- * |[<!-- language="C" -->
- * ClutterActorIter iter;
- * ClutterActor *child;
- *
- * clutter_actor_iter_init (&iter, container);
- * while (clutter_actor_iter_next (&iter, &child))
- * {
- * // do something with child
- * }
- * ]|
- *
- * Since: 1.10
- */
-void
-clutter_actor_iter_init (ClutterActorIter *iter,
- ClutterActor *root)
-{
- RealActorIter *ri = (RealActorIter *) iter;
-
- g_return_if_fail (iter != NULL);
- g_return_if_fail (CLUTTER_IS_ACTOR (root));
-
- ri->root = root;
- ri->current = NULL;
- ri->age = root->priv->age;
-}
-
-/**
- * clutter_actor_iter_is_valid:
- * @iter: a #ClutterActorIter
- *
- * Checks whether a #ClutterActorIter is still valid.
- *
- * An iterator is considered valid if it has been initialized, and
- * if the #ClutterActor that it refers to hasn't been modified after
- * the initialization.
- *
- * Return value: %TRUE if the iterator is valid, and %FALSE otherwise
- *
- * Since: 1.12
- */
-gboolean
-clutter_actor_iter_is_valid (const ClutterActorIter *iter)
-{
- RealActorIter *ri = (RealActorIter *) iter;
-
- g_return_val_if_fail (iter != NULL, FALSE);
-
- if (ri->root == NULL)
- return FALSE;
-
- return ri->root->priv->age == ri->age;
-}
-
-/**
- * clutter_actor_iter_next:
- * @iter: a #ClutterActorIter
- * @child: (out) (transfer none): return location for a #ClutterActor
- *
- * Advances the @iter and retrieves the next child of the root #ClutterActor
- * that was used to initialize the #ClutterActorIterator.
- *
- * If the iterator can advance, this function returns %TRUE and sets the
- * @child argument.
- *
- * If the iterator cannot advance, this function returns %FALSE, and
- * the contents of @child are undefined.
- *
- * Return value: %TRUE if the iterator could advance, and %FALSE otherwise.
- *
- * Since: 1.10
- */
-gboolean
-clutter_actor_iter_next (ClutterActorIter *iter,
- ClutterActor **child)
-{
- RealActorIter *ri = (RealActorIter *) iter;
-
- g_return_val_if_fail (iter != NULL, FALSE);
- g_return_val_if_fail (ri->root != NULL, FALSE);
-#ifndef G_DISABLE_ASSERT
- g_return_val_if_fail (ri->age == ri->root->priv->age, FALSE);
-#endif
-
- if (ri->current == NULL)
- ri->current = ri->root->priv->first_child;
- else
- ri->current = ri->current->priv->next_sibling;
-
- if (child != NULL)
- *child = ri->current;
-
- return ri->current != NULL;
-}
-
-/**
- * clutter_actor_iter_prev:
- * @iter: a #ClutterActorIter
- * @child: (out) (transfer none): return location for a #ClutterActor
- *
- * Advances the @iter and retrieves the previous child of the root
- * #ClutterActor that was used to initialize the #ClutterActorIterator.
- *
- * If the iterator can advance, this function returns %TRUE and sets the
- * @child argument.
- *
- * If the iterator cannot advance, this function returns %FALSE, and
- * the contents of @child are undefined.
- *
- * Return value: %TRUE if the iterator could advance, and %FALSE otherwise.
- *
- * Since: 1.10
- */
-gboolean
-clutter_actor_iter_prev (ClutterActorIter *iter,
- ClutterActor **child)
-{
- RealActorIter *ri = (RealActorIter *) iter;
-
- g_return_val_if_fail (iter != NULL, FALSE);
- g_return_val_if_fail (ri->root != NULL, FALSE);
-#ifndef G_DISABLE_ASSERT
- g_return_val_if_fail (ri->age == ri->root->priv->age, FALSE);
-#endif
-
- if (ri->current == NULL)
- ri->current = ri->root->priv->last_child;
- else
- ri->current = ri->current->priv->prev_sibling;
-
- if (child != NULL)
- *child = ri->current;
-
- return ri->current != NULL;
-}
-
-/**
- * clutter_actor_iter_remove:
- * @iter: a #ClutterActorIter
- *
- * Safely removes the #ClutterActor currently pointer to by the iterator
- * from its parent.
- *
- * This function can only be called after clutter_actor_iter_next() or
- * clutter_actor_iter_prev() returned %TRUE, and cannot be called more
- * than once for the same actor.
- *
- * This function will call clutter_actor_remove_child() internally.
- *
- * Since: 1.10
- */
-void
-clutter_actor_iter_remove (ClutterActorIter *iter)
-{
- RealActorIter *ri = (RealActorIter *) iter;
- ClutterActor *cur;
-
- g_return_if_fail (iter != NULL);
- g_return_if_fail (ri->root != NULL);
-#ifndef G_DISABLE_ASSERT
- g_return_if_fail (ri->age == ri->root->priv->age);
-#endif
- g_return_if_fail (ri->current != NULL);
-
- cur = ri->current;
-
- if (cur != NULL)
- {
- ri->current = cur->priv->prev_sibling;
-
- clutter_actor_remove_child_internal (ri->root, cur,
- REMOVE_CHILD_DEFAULT_FLAGS);
-
- ri->age += 1;
- }
-}
-
-/**
- * clutter_actor_iter_destroy:
- * @iter: a #ClutterActorIter
- *
- * Safely destroys the #ClutterActor currently pointer to by the iterator
- * from its parent.
- *
- * This function can only be called after clutter_actor_iter_next() or
- * clutter_actor_iter_prev() returned %TRUE, and cannot be called more
- * than once for the same actor.
- *
- * This function will call clutter_actor_destroy() internally.
- *
- * Since: 1.10
- */
-void
-clutter_actor_iter_destroy (ClutterActorIter *iter)
-{
- RealActorIter *ri = (RealActorIter *) iter;
- ClutterActor *cur;
-
- g_return_if_fail (iter != NULL);
- g_return_if_fail (ri->root != NULL);
-#ifndef G_DISABLE_ASSERT
- g_return_if_fail (ri->age == ri->root->priv->age);
-#endif
- g_return_if_fail (ri->current != NULL);
-
- cur = ri->current;
-
- if (cur != NULL)
- {
- ri->current = cur->priv->prev_sibling;
-
- clutter_actor_destroy (cur);
-
- ri->age += 1;
- }
-}
-
-static const ClutterAnimationInfo default_animation_info = {
- NULL, /* states */
- NULL, /* cur_state */
- NULL, /* transitions */
-};
-
-static void
-clutter_animation_info_free (gpointer data)
-{
- if (data != NULL)
- {
- ClutterAnimationInfo *info = data;
-
- if (info->transitions != NULL)
- g_hash_table_unref (info->transitions);
-
- if (info->states != NULL)
- g_array_unref (info->states);
-
- g_free (info);
- }
-}
-
-const ClutterAnimationInfo *
-_clutter_actor_get_animation_info_or_defaults (ClutterActor *self)
-{
- const ClutterAnimationInfo *res;
- GObject *obj = G_OBJECT (self);
-
- res = g_object_get_qdata (obj, quark_actor_animation_info);
- if (res != NULL)
- return res;
-
- return &default_animation_info;
-}
-
-ClutterAnimationInfo *
-_clutter_actor_get_animation_info (ClutterActor *self)
-{
- GObject *obj = G_OBJECT (self);
- ClutterAnimationInfo *res;
-
- res = g_object_get_qdata (obj, quark_actor_animation_info);
- if (res == NULL)
- {
- res = g_new0 (ClutterAnimationInfo, 1);
-
- *res = default_animation_info;
-
- g_object_set_qdata_full (obj, quark_actor_animation_info,
- res,
- clutter_animation_info_free);
- }
-
- return res;
-}
-
-static void
-transition_closure_free (gpointer data)
-{
- if (G_LIKELY (data != NULL))
- {
- TransitionClosure *clos = data;
- ClutterTimeline *timeline;
-
- timeline = CLUTTER_TIMELINE (clos->transition);
-
- /* we disconnect the signal handler before stopping the timeline,
- * so that we don't end up inside on_transition_stopped() from
- * a call to g_hash_table_remove().
- */
- g_clear_signal_handler (&clos->completed_id, clos->transition);
-
- if (clutter_timeline_is_playing (timeline))
- clutter_timeline_stop (timeline);
- else if (clutter_timeline_get_delay (timeline) > 0)
- clutter_timeline_cancel_delay (timeline);
-
- /* remove the reference added in add_transition_internal() */
- g_object_unref (clos->transition);
-
- g_free (clos->name);
-
- g_free (clos);
- }
-}
-
-static void
-on_transition_stopped (ClutterTransition *transition,
- gboolean is_finished,
- TransitionClosure *clos)
-{
- ClutterActor *actor = clos->actor;
- ClutterAnimationInfo *info;
- GQuark t_quark;
- gchar *t_name;
-
- if (clos->name == NULL)
- return;
-
- /* reset the caches used by animations */
- clutter_actor_store_content_box (actor, NULL);
-
- info = _clutter_actor_get_animation_info (actor);
-
- /* we need copies because we emit the signal after the
- * TransitionClosure data structure has been freed
- */
- t_quark = g_quark_from_string (clos->name);
- t_name = g_strdup (clos->name);
-
- if (clutter_transition_get_remove_on_complete (transition))
- {
- /* this is safe, because the timeline has now stopped,
- * so we won't recurse; the reference on the Animatable
- * will be dropped by the ::stopped signal closure in
- * ClutterTransition, which is RUN_LAST, and thus will
- * be called after this handler
- */
- g_hash_table_remove (info->transitions, clos->name);
- }
-
- /* we emit the ::transition-stopped after removing the
- * transition, so that we can chain up new transitions
- * without interfering with the one that just finished
- */
- g_signal_emit (actor, actor_signals[TRANSITION_STOPPED], t_quark,
- t_name,
- is_finished);
-
- g_free (t_name);
-
- /* if it's the last transition then we clean up */
- if (g_hash_table_size (info->transitions) == 0)
- {
- g_hash_table_unref (info->transitions);
- info->transitions = NULL;
-
- CLUTTER_NOTE (ANIMATION, "Transitions for '%s' completed",
- _clutter_actor_get_debug_name (actor));
-
- g_signal_emit (actor, actor_signals[TRANSITIONS_COMPLETED], 0);
- }
-}
-
-static void
-clutter_actor_add_transition_internal (ClutterActor *self,
- const gchar *name,
- ClutterTransition *transition)
-{
- ClutterTimeline *timeline;
- TransitionClosure *clos;
- ClutterAnimationInfo *info;
-
- info = _clutter_actor_get_animation_info (self);
-
- if (info->transitions == NULL)
- info->transitions = g_hash_table_new_full (g_str_hash, g_str_equal,
- NULL,
- transition_closure_free);
-
- if (g_hash_table_lookup (info->transitions, name) != NULL)
- {
- g_warning ("A transition with name '%s' already exists for "
- "the actor '%s'",
- name,
- _clutter_actor_get_debug_name (self));
- return;
- }
-
- clutter_transition_set_animatable (transition, CLUTTER_ANIMATABLE (self));
-
- timeline = CLUTTER_TIMELINE (transition);
-
- clos = g_new0 (TransitionClosure, 1);
- clos->actor = self;
- clos->transition = g_object_ref (transition);
- clos->name = g_strdup (name);
- clos->completed_id = g_signal_connect (timeline, "stopped",
- G_CALLBACK (on_transition_stopped),
- clos);
-
- CLUTTER_NOTE (ANIMATION,
- "Adding transition '%s' [%p] to actor '%s'",
- clos->name,
- clos->transition,
- _clutter_actor_get_debug_name (self));
-
- g_hash_table_insert (info->transitions, clos->name, clos);
- clutter_timeline_start (timeline);
-}
-
-static gboolean
-should_skip_implicit_transition (ClutterActor *self,
- GParamSpec *pspec)
-{
- ClutterActorPrivate *priv = self->priv;
- const ClutterAnimationInfo *info;
-
- /* this function is called from _clutter_actor_create_transition() which
- * calls _clutter_actor_get_animation_info() first, so we're guaranteed
- * to have the correct ClutterAnimationInfo pointer
- */
- info = _clutter_actor_get_animation_info_or_defaults (self);
-
- /* if the easing state has a non-zero duration we always want an
- * implicit transition to occur
- */
- if (info->cur_state->easing_duration == 0)
- return TRUE;
-
- /* on the other hand, if the actor hasn't been allocated yet, we want to
- * skip all transitions on the :allocation, to avoid actors "flying in"
- * into their new position and size
- */
- if (pspec == obj_props[PROP_ALLOCATION] &&
- !clutter_actor_box_is_initialized (&priv->allocation))
- return TRUE;
-
- /* if the actor is not mapped and is not part of a branch of the scene
- * graph that is being cloned, then we always skip implicit transitions
- * on the account of the fact that the actor is not going to be visible
- * when those transitions happen
- */
- if (!CLUTTER_ACTOR_IS_MAPPED (self) &&
- !clutter_actor_has_mapped_clones (self))
- return TRUE;
-
- return FALSE;
-}
-
-/*< private >*
- * _clutter_actor_create_transition:
- * @actor: a #ClutterActor
- * @pspec: the property used for the transition
- * @...: initial and final state
- *
- * Creates a #ClutterTransition for the property represented by @pspec.
- *
- * Return value: a #ClutterTransition
- */
-ClutterTransition *
-_clutter_actor_create_transition (ClutterActor *actor,
- GParamSpec *pspec,
- ...)
-{
- ClutterTimeline *timeline;
- ClutterInterval *interval;
- ClutterAnimationInfo *info;
- ClutterTransition *res = NULL;
- gboolean call_restore = FALSE;
- TransitionClosure *clos;
- va_list var_args;
- g_auto (GValue) initial = G_VALUE_INIT;
- g_auto (GValue) final = G_VALUE_INIT;
- GType ptype;
- char *error;
-
- g_assert (pspec != NULL);
- g_assert ((pspec->flags & CLUTTER_PARAM_ANIMATABLE) != 0);
-
- info = _clutter_actor_get_animation_info (actor);
-
- /* XXX - this will go away in 2.0
- *
- * if no state has been pushed, we assume that the easing state is
- * in "compatibility mode": all transitions have a duration of 0
- * msecs, which means that they happen immediately. in Clutter 2.0
- * this will turn into a g_assert(info->states != NULL), as every
- * actor will start with a predefined easing state
- */
- if (info->states == NULL)
- {
- clutter_actor_save_easing_state (actor);
- clutter_actor_set_easing_duration (actor, 0);
- call_restore = TRUE;
- }
-
- if (info->transitions == NULL)
- info->transitions = g_hash_table_new_full (g_str_hash, g_str_equal,
- NULL,
- transition_closure_free);
-
- va_start (var_args, pspec);
-
- ptype = G_PARAM_SPEC_VALUE_TYPE (pspec);
-
- G_VALUE_COLLECT_INIT (&initial, ptype,
- var_args, 0,
- &error);
- if (error != NULL)
- {
- g_critical ("%s: %s", G_STRLOC, error);
- g_free (error);
- goto out;
- }
-
- G_VALUE_COLLECT_INIT (&final, ptype,
- var_args, 0,
- &error);
- if (error != NULL)
- {
- g_critical ("%s: %s", G_STRLOC, error);
- g_free (error);
- goto out;
- }
-
- if (should_skip_implicit_transition (actor, pspec))
- {
- CLUTTER_NOTE (ANIMATION, "Skipping implicit transition for '%s::%s'",
- _clutter_actor_get_debug_name (actor),
- pspec->name);
-
- /* remove a transition, if one exists */
- clutter_actor_remove_transition (actor, pspec->name);
-
- /* we don't go through the Animatable interface because we
- * already know we got here through an animatable property.
- */
- clutter_actor_set_animatable_property (actor,
- pspec->param_id,
- &final,
- pspec);
-
- goto out;
- }
-
- clos = g_hash_table_lookup (info->transitions, pspec->name);
- if (clos == NULL)
- {
- res = clutter_property_transition_new (pspec->name);
-
- clutter_transition_set_remove_on_complete (res, TRUE);
-
- interval = clutter_interval_new_with_values (ptype, &initial, &final);
- clutter_transition_set_interval (res, interval);
-
- timeline = CLUTTER_TIMELINE (res);
- clutter_timeline_set_delay (timeline, info->cur_state->easing_delay);
- clutter_timeline_set_duration (timeline, info->cur_state->easing_duration);
- clutter_timeline_set_progress_mode (timeline, info->cur_state->easing_mode);
-
-#ifdef CLUTTER_ENABLE_DEBUG
- if (CLUTTER_HAS_DEBUG (ANIMATION))
- {
- gchar *initial_v, *final_v;
-
- initial_v = g_strdup_value_contents (&initial);
- final_v = g_strdup_value_contents (&final);
-
- CLUTTER_NOTE (ANIMATION,
- "Created transition for %s:%s "
- "(len:%u, mode:%s, delay:%u) "
- "initial:%s, final:%s",
- _clutter_actor_get_debug_name (actor),
- pspec->name,
- info->cur_state->easing_duration,
- clutter_get_easing_name_for_mode (info->cur_state->easing_mode),
- info->cur_state->easing_delay,
- initial_v, final_v);
-
- g_free (initial_v);
- g_free (final_v);
- }
-#endif /* CLUTTER_ENABLE_DEBUG */
-
- /* this will start the transition as well */
- clutter_actor_add_transition_internal (actor, pspec->name, res);
-
- /* the actor now owns the transition */
- g_object_unref (res);
- }
- else
- {
- ClutterAnimationMode cur_mode;
- guint cur_duration;
-
- CLUTTER_NOTE (ANIMATION, "Existing transition for %s:%s",
- _clutter_actor_get_debug_name (actor),
- pspec->name);
-
- timeline = CLUTTER_TIMELINE (clos->transition);
-
- cur_duration = clutter_timeline_get_duration (timeline);
- if (cur_duration != info->cur_state->easing_duration)
- clutter_timeline_set_duration (timeline, info->cur_state->easing_duration);
-
- cur_mode = clutter_timeline_get_progress_mode (timeline);
- if (cur_mode != info->cur_state->easing_mode)
- clutter_timeline_set_progress_mode (timeline, info->cur_state->easing_mode);
-
- clutter_timeline_rewind (timeline);
-
- interval = clutter_transition_get_interval (clos->transition);
- clutter_interval_set_initial_value (interval, &initial);
- clutter_interval_set_final_value (interval, &final);
-
- res = clos->transition;
- }
-
-out:
- if (call_restore)
- clutter_actor_restore_easing_state (actor);
-
- va_end (var_args);
-
- return res;
-}
-
-/**
- * clutter_actor_add_transition:
- * @self: a #ClutterActor
- * @name: the name of the transition to add
- * @transition: the #ClutterTransition to add
- *
- * Adds a @transition to the #ClutterActor's list of animations.
- *
- * The @name string is a per-actor unique identifier of the @transition: only
- * one #ClutterTransition can be associated to the specified @name.
- *
- * The @transition will be started once added.
- *
- * This function will take a reference on the @transition.
- *
- * This function is usually called implicitly when modifying an animatable
- * property.
- *
- * Since: 1.10
- */
-void
-clutter_actor_add_transition (ClutterActor *self,
- const char *name,
- ClutterTransition *transition)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (name != NULL);
- g_return_if_fail (CLUTTER_IS_TRANSITION (transition));
-
- clutter_actor_add_transition_internal (self, name, transition);
-}
-
-/**
- * clutter_actor_remove_transition:
- * @self: a #ClutterActor
- * @name: the name of the transition to remove
- *
- * Removes the transition stored inside a #ClutterActor using @name
- * identifier.
- *
- * If the transition is currently in progress, it will be stopped.
- *
- * This function releases the reference acquired when the transition
- * was added to the #ClutterActor.
- *
- * Since: 1.10
- */
-void
-clutter_actor_remove_transition (ClutterActor *self,
- const char *name)
-{
- const ClutterAnimationInfo *info;
- TransitionClosure *clos;
- gboolean was_playing;
- GQuark t_quark;
- gchar *t_name;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (name != NULL);
-
- info = _clutter_actor_get_animation_info_or_defaults (self);
-
- if (info->transitions == NULL)
- return;
-
- clos = g_hash_table_lookup (info->transitions, name);
- if (clos == NULL)
- return;
-
- was_playing =
- clutter_timeline_is_playing (CLUTTER_TIMELINE (clos->transition));
- t_quark = g_quark_from_string (clos->name);
- t_name = g_strdup (clos->name);
-
- g_hash_table_remove (info->transitions, name);
-
- /* we want to maintain the invariant that ::transition-stopped is
- * emitted after the transition has been removed, to allow replacing
- * or chaining; removing the transition from the hash table will
- * stop it, but transition_closure_free() will disconnect the signal
- * handler we install in add_transition_internal(), to avoid loops
- * or segfaults.
- *
- * since we know already that a transition will stop once it's removed
- * from an actor, we can simply emit the ::transition-stopped here
- * ourselves, if the timeline was playing (if it wasn't, then the
- * signal was already emitted at least once).
- */
- if (was_playing)
- {
- g_signal_emit (self, actor_signals[TRANSITION_STOPPED],
- t_quark,
- t_name,
- FALSE);
- }
-
- g_free (t_name);
-}
-
-/**
- * clutter_actor_remove_all_transitions:
- * @self: a #ClutterActor
- *
- * Removes all transitions associated to @self.
- *
- * Since: 1.10
- */
-void
-clutter_actor_remove_all_transitions (ClutterActor *self)
-{
- const ClutterAnimationInfo *info;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- info = _clutter_actor_get_animation_info_or_defaults (self);
- if (info->transitions == NULL)
- return;
-
- g_hash_table_remove_all (info->transitions);
-}
-
-/**
- * clutter_actor_set_easing_duration:
- * @self: a #ClutterActor
- * @msecs: the duration of the easing, or %NULL
- *
- * Sets the duration of the tweening for animatable properties
- * of @self for the current easing state.
- *
- * Since: 1.10
- */
-void
-clutter_actor_set_easing_duration (ClutterActor *self,
- guint msecs)
-{
- ClutterAnimationInfo *info;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- info = _clutter_actor_get_animation_info (self);
-
- if (info->cur_state == NULL)
- {
- g_warning ("You must call clutter_actor_save_easing_state() prior "
- "to calling clutter_actor_set_easing_duration().");
- return;
- }
-
- if (info->cur_state->easing_duration != msecs)
- info->cur_state->easing_duration = msecs;
-}
-
-/**
- * clutter_actor_get_easing_duration:
- * @self: a #ClutterActor
- *
- * Retrieves the duration of the tweening for animatable
- * properties of @self for the current easing state.
- *
- * Return value: the duration of the tweening, in milliseconds
- *
- * Since: 1.10
- */
-guint
-clutter_actor_get_easing_duration (ClutterActor *self)
-{
- const ClutterAnimationInfo *info;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
-
- info = _clutter_actor_get_animation_info_or_defaults (self);
-
- if (info->cur_state != NULL)
- return info->cur_state->easing_duration;
-
- return 0;
-}
-
-/**
- * clutter_actor_set_easing_mode:
- * @self: a #ClutterActor
- * @mode: an easing mode, excluding %CLUTTER_CUSTOM_MODE
- *
- * Sets the easing mode for the tweening of animatable properties
- * of @self.
- *
- * Since: 1.10
- */
-void
-clutter_actor_set_easing_mode (ClutterActor *self,
- ClutterAnimationMode mode)
-{
- ClutterAnimationInfo *info;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (mode != CLUTTER_CUSTOM_MODE);
- g_return_if_fail (mode < CLUTTER_ANIMATION_LAST);
-
- info = _clutter_actor_get_animation_info (self);
-
- if (info->cur_state == NULL)
- {
- g_warning ("You must call clutter_actor_save_easing_state() prior "
- "to calling clutter_actor_set_easing_mode().");
- return;
- }
-
- if (info->cur_state->easing_mode != mode)
- info->cur_state->easing_mode = mode;
-}
-
-/**
- * clutter_actor_get_easing_mode:
- * @self: a #ClutterActor
- *
- * Retrieves the easing mode for the tweening of animatable properties
- * of @self for the current easing state.
- *
- * Return value: an easing mode
- *
- * Since: 1.10
- */
-ClutterAnimationMode
-clutter_actor_get_easing_mode (ClutterActor *self)
-{
- const ClutterAnimationInfo *info;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), CLUTTER_EASE_OUT_CUBIC);
-
- info = _clutter_actor_get_animation_info_or_defaults (self);
-
- if (info->cur_state != NULL)
- return info->cur_state->easing_mode;
-
- return CLUTTER_EASE_OUT_CUBIC;
-}
-
-/**
- * clutter_actor_set_easing_delay:
- * @self: a #ClutterActor
- * @msecs: the delay before the start of the tweening, in milliseconds
- *
- * Sets the delay that should be applied before tweening animatable
- * properties.
- *
- * Since: 1.10
- */
-void
-clutter_actor_set_easing_delay (ClutterActor *self,
- guint msecs)
-{
- ClutterAnimationInfo *info;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- info = _clutter_actor_get_animation_info (self);
-
- if (info->cur_state == NULL)
- {
- g_warning ("You must call clutter_actor_save_easing_state() prior "
- "to calling clutter_actor_set_easing_delay().");
- return;
- }
-
- if (info->cur_state->easing_delay != msecs)
- info->cur_state->easing_delay = msecs;
-}
-
-/**
- * clutter_actor_get_easing_delay:
- * @self: a #ClutterActor
- *
- * Retrieves the delay that should be applied when tweening animatable
- * properties.
- *
- * Return value: a delay, in milliseconds
- *
- * Since: 1.10
- */
-guint
-clutter_actor_get_easing_delay (ClutterActor *self)
-{
- const ClutterAnimationInfo *info;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
-
- info = _clutter_actor_get_animation_info_or_defaults (self);
-
- if (info->cur_state != NULL)
- return info->cur_state->easing_delay;
-
- return 0;
-}
-
-/**
- * clutter_actor_get_transition:
- * @self: a #ClutterActor
- * @name: the name of the transition
- *
- * Retrieves the #ClutterTransition of a #ClutterActor by using the
- * transition @name.
- *
- * Transitions created for animatable properties use the name of the
- * property itself, for instance the code below:
- *
- * |[<!-- language="C" -->
- * clutter_actor_set_easing_duration (actor, 1000);
- * clutter_actor_set_rotation_angle (actor, CLUTTER_Y_AXIS, 360.0);
- *
- * transition = clutter_actor_get_transition (actor, "rotation-angle-y");
- * g_signal_connect (transition, "stopped",
- * G_CALLBACK (on_transition_stopped),
- * actor);
- * ]|
- *
- * will call the `on_transition_stopped` callback when the transition
- * is finished.
- *
- * If you just want to get notifications of the completion of a transition,
- * you should use the #ClutterActor::transition-stopped signal, using the
- * transition name as the signal detail.
- *
- * Return value: (transfer none): a #ClutterTransition, or %NULL is none
- * was found to match the passed name; the returned instance is owned
- * by Clutter and it should not be freed
- *
- * Since: 1.10
- */
-ClutterTransition *
-clutter_actor_get_transition (ClutterActor *self,
- const char *name)
-{
- TransitionClosure *clos;
- const ClutterAnimationInfo *info;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
- g_return_val_if_fail (name != NULL, NULL);
-
- info = _clutter_actor_get_animation_info_or_defaults (self);
- if (info->transitions == NULL)
- return NULL;
-
- clos = g_hash_table_lookup (info->transitions, name);
- if (clos == NULL)
- return NULL;
-
- return clos->transition;
-}
-
-/**
- * clutter_actor_has_transitions: (skip)
- */
-gboolean
-clutter_actor_has_transitions (ClutterActor *self)
-{
- const ClutterAnimationInfo *info;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- info = _clutter_actor_get_animation_info_or_defaults (self);
- if (info->transitions == NULL)
- return FALSE;
-
- return g_hash_table_size (info->transitions) > 0;
-}
-
-/**
- * clutter_actor_save_easing_state:
- * @self: a #ClutterActor
- *
- * Saves the current easing state for animatable properties, and creates
- * a new state with the default values for easing mode and duration.
- *
- * New transitions created after calling this function will inherit the
- * duration, easing mode, and delay of the new easing state; this also
- * applies to transitions modified in flight.
- *
- * Since: 1.10
- */
-void
-clutter_actor_save_easing_state (ClutterActor *self)
-{
- ClutterAnimationInfo *info;
- AState new_state;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- info = _clutter_actor_get_animation_info (self);
-
- if (info->states == NULL)
- info->states = g_array_new (FALSE, FALSE, sizeof (AState));
-
- new_state.easing_mode = CLUTTER_EASE_OUT_CUBIC;
- new_state.easing_duration = 250;
- new_state.easing_delay = 0;
-
- g_array_append_val (info->states, new_state);
-
- info->cur_state = &g_array_index (info->states, AState, info->states->len - 1);
-}
-
-/**
- * clutter_actor_restore_easing_state:
- * @self: a #ClutterActor
- *
- * Restores the easing state as it was prior to a call to
- * clutter_actor_save_easing_state().
- *
- * Since: 1.10
- */
-void
-clutter_actor_restore_easing_state (ClutterActor *self)
-{
- ClutterAnimationInfo *info;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- info = _clutter_actor_get_animation_info (self);
-
- if (info->states == NULL)
- {
- g_critical ("The function clutter_actor_restore_easing_state() has "
- "been called without a previous call to "
- "clutter_actor_save_easing_state().");
- return;
- }
-
- g_array_remove_index (info->states, info->states->len - 1);
-
- if (info->states->len > 0)
- info->cur_state = &g_array_index (info->states, AState, info->states->len - 1);
- else
- {
- g_array_unref (info->states);
- info->states = NULL;
- info->cur_state = NULL;
- }
-}
-
-/**
- * clutter_actor_set_content:
- * @self: a #ClutterActor
- * @content: (allow-none): a #ClutterContent, or %NULL
- *
- * Sets the contents of a #ClutterActor.
- *
- * Since: 1.10
- */
-void
-clutter_actor_set_content (ClutterActor *self,
- ClutterContent *content)
-{
- ClutterActorPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (content == NULL || CLUTTER_IS_CONTENT (content));
-
- priv = self->priv;
-
- if (priv->content == content)
- return;
-
- if (priv->content != NULL)
- {
- _clutter_content_detached (priv->content, self);
- g_clear_object (&priv->content);
- }
-
- priv->content = content;
-
- if (priv->content != NULL)
- {
- g_object_ref (priv->content);
- _clutter_content_attached (priv->content, self);
- }
-
- /* if the actor's preferred size is the content's preferred size,
- * then we need to conditionally queue a relayout here...
- */
- if (priv->request_mode == CLUTTER_REQUEST_CONTENT_SIZE)
- _clutter_actor_queue_only_relayout (self);
-
- clutter_actor_queue_redraw (self);
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_CONTENT]);
-
- /* if the content gravity is not resize-fill, and the new content has a
- * different preferred size than the previous one, then the content box
- * may have been changed. since we compute that lazily, we just notify
- * here, and let whomever watches :content-box do whatever they need to
- * do.
- */
- if (priv->content_gravity != CLUTTER_CONTENT_GRAVITY_RESIZE_FILL)
- {
- if (priv->content_box_valid)
- {
- ClutterActorBox from_box, to_box;
-
- clutter_actor_get_content_box (self, &from_box);
-
- /* invalidate the cached content box */
- priv->content_box_valid = FALSE;
- clutter_actor_get_content_box (self, &to_box);
-
- if (!clutter_actor_box_equal (&from_box, &to_box))
- _clutter_actor_create_transition (self, obj_props[PROP_CONTENT_BOX],
- &from_box,
- &to_box);
- }
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_CONTENT_BOX]);
- }
-}
-
-/**
- * clutter_actor_get_content:
- * @self: a #ClutterActor
- *
- * Retrieves the contents of @self.
- *
- * Return value: (transfer none): a pointer to the #ClutterContent instance,
- * or %NULL if none was set
- *
- * Since: 1.10
- */
-ClutterContent *
-clutter_actor_get_content (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
-
- return self->priv->content;
-}
-
-/**
- * clutter_actor_set_content_gravity:
- * @self: a #ClutterActor
- * @gravity: the #ClutterContentGravity
- *
- * Sets the gravity of the #ClutterContent used by @self.
- *
- * See the description of the #ClutterActor:content-gravity property for
- * more information.
- *
- * The #ClutterActor:content-gravity property is animatable.
- *
- * Since: 1.10
- */
-void
-clutter_actor_set_content_gravity (ClutterActor *self,
- ClutterContentGravity gravity)
-{
- ClutterActorPrivate *priv;
- ClutterActorBox from_box, to_box;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- priv = self->priv;
-
- if (priv->content_gravity == gravity)
- return;
-
- priv->content_box_valid = FALSE;
-
- clutter_actor_get_content_box (self, &from_box);
-
- priv->content_gravity = gravity;
-
- clutter_actor_get_content_box (self, &to_box);
-
- _clutter_actor_create_transition (self, obj_props[PROP_CONTENT_BOX],
- &from_box,
- &to_box);
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_CONTENT_GRAVITY]);
-}
-
-/**
- * clutter_actor_get_content_gravity:
- * @self: a #ClutterActor
- *
- * Retrieves the content gravity as set using
- * clutter_actor_set_content_gravity().
- *
- * Return value: the content gravity
- *
- * Since: 1.10
- */
-ClutterContentGravity
-clutter_actor_get_content_gravity (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self),
- CLUTTER_CONTENT_GRAVITY_RESIZE_FILL);
-
- return self->priv->content_gravity;
-}
-
-/**
- * clutter_actor_get_content_box:
- * @self: a #ClutterActor
- * @box: (out caller-allocates): the return location for the bounding
- * box for the #ClutterContent
- *
- * Retrieves the bounding box for the #ClutterContent of @self.
- *
- * The bounding box is relative to the actor's allocation.
- *
- * If no #ClutterContent is set for @self, or if @self has not been
- * allocated yet, then the result is undefined.
- *
- * The content box is guaranteed to be, at most, as big as the allocation
- * of the #ClutterActor.
- *
- * If the #ClutterContent used by the actor has a preferred size, then
- * it is possible to modify the content box by using the
- * #ClutterActor:content-gravity property.
- *
- * Since: 1.10
- */
-void
-clutter_actor_get_content_box (ClutterActor *self,
- ClutterActorBox *box)
-{
- ClutterActorPrivate *priv;
- gfloat content_w, content_h;
- gfloat alloc_w, alloc_h;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (box != NULL);
-
- priv = self->priv;
-
- box->x1 = 0.f;
- box->y1 = 0.f;
- box->x2 = priv->allocation.x2 - priv->allocation.x1;
- box->y2 = priv->allocation.y2 - priv->allocation.y1;
-
- if (priv->content_box_valid)
- {
- *box = priv->content_box;
- return;
- }
-
- /* no need to do any more work */
- if (priv->content_gravity == CLUTTER_CONTENT_GRAVITY_RESIZE_FILL)
- return;
-
- if (priv->content == NULL)
- return;
-
- /* if the content does not have a preferred size then there is
- * no point in computing the content box
- */
- if (!clutter_content_get_preferred_size (priv->content,
- &content_w,
- &content_h))
- return;
-
- alloc_w = box->x2;
- alloc_h = box->y2;
-
- switch (priv->content_gravity)
- {
- case CLUTTER_CONTENT_GRAVITY_TOP_LEFT:
- box->x2 = box->x1 + MIN (content_w, alloc_w);
- box->y2 = box->y1 + MIN (content_h, alloc_h);
- break;
-
- case CLUTTER_CONTENT_GRAVITY_TOP:
- if (alloc_w > content_w)
- {
- box->x1 += ceilf ((alloc_w - content_w) / 2.0);
- box->x2 = box->x1 + content_w;
- }
- box->y2 = box->y1 + MIN (content_h, alloc_h);
- break;
-
- case CLUTTER_CONTENT_GRAVITY_TOP_RIGHT:
- if (alloc_w > content_w)
- {
- box->x1 += (alloc_w - content_w);
- box->x2 = box->x1 + content_w;
- }
- box->y2 = box->y1 + MIN (content_h, alloc_h);
- break;
-
- case CLUTTER_CONTENT_GRAVITY_LEFT:
- box->x2 = box->x1 + MIN (content_w, alloc_w);
- if (alloc_h > content_h)
- {
- box->y1 += ceilf ((alloc_h - content_h) / 2.0);
- box->y2 = box->y1 + content_h;
- }
- break;
-
- case CLUTTER_CONTENT_GRAVITY_CENTER:
- if (alloc_w > content_w)
- {
- box->x1 += ceilf ((alloc_w - content_w) / 2.0);
- box->x2 = box->x1 + content_w;
- }
- if (alloc_h > content_h)
- {
- box->y1 += ceilf ((alloc_h - content_h) / 2.0);
- box->y2 = box->y1 + content_h;
- }
- break;
-
- case CLUTTER_CONTENT_GRAVITY_RIGHT:
- if (alloc_w > content_w)
- {
- box->x1 += (alloc_w - content_w);
- box->x2 = box->x1 + content_w;
- }
- if (alloc_h > content_h)
- {
- box->y1 += ceilf ((alloc_h - content_h) / 2.0);
- box->y2 = box->y1 + content_h;
- }
- break;
-
- case CLUTTER_CONTENT_GRAVITY_BOTTOM_LEFT:
- box->x2 = box->x1 + MIN (content_w, alloc_w);
- if (alloc_h > content_h)
- {
- box->y1 += (alloc_h - content_h);
- box->y2 = box->y1 + content_h;
- }
- break;
-
- case CLUTTER_CONTENT_GRAVITY_BOTTOM:
- if (alloc_w > content_w)
- {
- box->x1 += ceilf ((alloc_w - content_w) / 2.0);
- box->x2 = box->x1 + content_w;
- }
- if (alloc_h > content_h)
- {
- box->y1 += (alloc_h - content_h);
- box->y2 = box->y1 + content_h;
- }
- break;
-
- case CLUTTER_CONTENT_GRAVITY_BOTTOM_RIGHT:
- if (alloc_w > content_w)
- {
- box->x1 += (alloc_w - content_w);
- box->x2 = box->x1 + content_w;
- }
- if (alloc_h > content_h)
- {
- box->y1 += (alloc_h - content_h);
- box->y2 = box->y1 + content_h;
- }
- break;
-
- case CLUTTER_CONTENT_GRAVITY_RESIZE_FILL:
- g_assert_not_reached ();
- break;
-
- case CLUTTER_CONTENT_GRAVITY_RESIZE_ASPECT:
- {
- double r_c = content_w / content_h;
-
- if ((alloc_w / r_c) > alloc_h)
- {
- box->y1 = 0.f;
- box->y2 = alloc_h;
-
- box->x1 = (alloc_w - (alloc_h * r_c)) / 2.0f;
- box->x2 = box->x1 + (alloc_h * r_c);
- }
- else
- {
- box->x1 = 0.f;
- box->x2 = alloc_w;
-
- box->y1 = (alloc_h - (alloc_w / r_c)) / 2.0f;
- box->y2 = box->y1 + (alloc_w / r_c);
- }
-
- CLUTTER_NOTE (LAYOUT,
- "r_c: %.3f, r_a: %.3f\t"
- "a: [%.2fx%.2f], c: [%.2fx%.2f]\t"
- "b: [%.2f, %.2f, %.2f, %.2f]",
- r_c, alloc_w / alloc_h,
- alloc_w, alloc_h,
- content_w, content_h,
- box->x1, box->y1, box->x2, box->y2);
- }
- break;
- }
-}
-
-/**
- * clutter_actor_set_content_scaling_filters:
- * @self: a #ClutterActor
- * @min_filter: the minification filter for the content
- * @mag_filter: the magnification filter for the content
- *
- * Sets the minification and magnification filter to be applied when
- * scaling the #ClutterActor:content of a #ClutterActor.
- *
- * The #ClutterActor:minification-filter will be used when reducing
- * the size of the content; the #ClutterActor:magnification-filter
- * will be used when increasing the size of the content.
- *
- * Since: 1.10
- */
-void
-clutter_actor_set_content_scaling_filters (ClutterActor *self,
- ClutterScalingFilter min_filter,
- ClutterScalingFilter mag_filter)
-{
- ClutterActorPrivate *priv;
- gboolean changed;
- GObject *obj;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- priv = self->priv;
- obj = G_OBJECT (self);
-
- g_object_freeze_notify (obj);
-
- changed = FALSE;
-
- if (priv->min_filter != min_filter)
- {
- priv->min_filter = min_filter;
- changed = TRUE;
-
- g_object_notify_by_pspec (obj, obj_props[PROP_MINIFICATION_FILTER]);
- }
-
- if (priv->mag_filter != mag_filter)
- {
- priv->mag_filter = mag_filter;
- changed = TRUE;
-
- g_object_notify_by_pspec (obj, obj_props[PROP_MAGNIFICATION_FILTER]);
- }
-
- if (changed)
- clutter_actor_queue_redraw (self);
-
- g_object_thaw_notify (obj);
-}
-
-/**
- * clutter_actor_get_content_scaling_filters:
- * @self: a #ClutterActor
- * @min_filter: (out) (allow-none): return location for the minification
- * filter, or %NULL
- * @mag_filter: (out) (allow-none): return location for the magnification
- * filter, or %NULL
- *
- * Retrieves the values set using clutter_actor_set_content_scaling_filters().
- *
- * Since: 1.10
- */
-void
-clutter_actor_get_content_scaling_filters (ClutterActor *self,
- ClutterScalingFilter *min_filter,
- ClutterScalingFilter *mag_filter)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- if (min_filter != NULL)
- *min_filter = self->priv->min_filter;
-
- if (mag_filter != NULL)
- *mag_filter = self->priv->mag_filter;
-}
-
-/*
- * clutter_actor_queue_compute_expand:
- * @self: a #ClutterActor
- *
- * Invalidates the needs_x_expand and needs_y_expand flags on @self
- * and its parents up to the top-level actor.
- *
- * This function also queues a relayout if anything changed.
- */
-static inline void
-clutter_actor_queue_compute_expand (ClutterActor *self)
-{
- ClutterActor *parent;
- gboolean changed;
-
- if (self->priv->needs_compute_expand)
- return;
-
- changed = FALSE;
- parent = self;
- while (parent != NULL)
- {
- if (!parent->priv->needs_compute_expand)
- {
- parent->priv->needs_compute_expand = TRUE;
- changed = TRUE;
- }
-
- parent = parent->priv->parent;
- }
-
- if (changed)
- clutter_actor_queue_relayout (self);
-}
-
-/**
- * clutter_actor_set_x_expand:
- * @self: a #ClutterActor
- * @expand: whether the actor should expand horizontally
- *
- * Sets whether a #ClutterActor should expand horizontally; this means
- * that layout manager should allocate extra space for the actor, if
- * possible.
- *
- * Setting an actor to expand will also make all its parent expand, so
- * that it's possible to build an actor tree and only set this flag on
- * its leaves and not on every single actor.
- *
- * Since: 1.12
- */
-void
-clutter_actor_set_x_expand (ClutterActor *self,
- gboolean expand)
-{
- ClutterLayoutInfo *info;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- expand = !!expand;
-
- info = _clutter_actor_get_layout_info (self);
- if (info->x_expand != expand)
- {
- info->x_expand = expand;
-
- self->priv->x_expand_set = TRUE;
-
- clutter_actor_queue_compute_expand (self);
-
- g_object_notify_by_pspec (G_OBJECT (self),
- obj_props[PROP_X_EXPAND]);
- }
-}
-
-/**
- * clutter_actor_get_x_expand:
- * @self: a #ClutterActor
- *
- * Retrieves the value set with clutter_actor_set_x_expand().
- *
- * See also: clutter_actor_needs_expand()
- *
- * Return value: %TRUE if the actor has been set to expand
- *
- * Since: 1.12
- */
-gboolean
-clutter_actor_get_x_expand (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- return _clutter_actor_get_layout_info_or_defaults (self)->x_expand;
-}
-
-/**
- * clutter_actor_set_y_expand:
- * @self: a #ClutterActor
- * @expand: whether the actor should expand vertically
- *
- * Sets whether a #ClutterActor should expand horizontally; this means
- * that layout manager should allocate extra space for the actor, if
- * possible.
- *
- * Setting an actor to expand will also make all its parent expand, so
- * that it's possible to build an actor tree and only set this flag on
- * its leaves and not on every single actor.
- *
- * Since: 1.12
- */
-void
-clutter_actor_set_y_expand (ClutterActor *self,
- gboolean expand)
-{
- ClutterLayoutInfo *info;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- expand = !!expand;
-
- info = _clutter_actor_get_layout_info (self);
- if (info->y_expand != expand)
- {
- info->y_expand = expand;
-
- self->priv->y_expand_set = TRUE;
-
- clutter_actor_queue_compute_expand (self);
-
- g_object_notify_by_pspec (G_OBJECT (self),
- obj_props[PROP_Y_EXPAND]);
- }
-}
-
-/**
- * clutter_actor_get_y_expand:
- * @self: a #ClutterActor
- *
- * Retrieves the value set with clutter_actor_set_y_expand().
- *
- * See also: clutter_actor_needs_expand()
- *
- * Return value: %TRUE if the actor has been set to expand
- *
- * Since: 1.12
- */
-gboolean
-clutter_actor_get_y_expand (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- return _clutter_actor_get_layout_info_or_defaults (self)->y_expand;
-}
-
-static void
-clutter_actor_compute_expand_recursive (ClutterActor *self,
- gboolean *x_expand_p,
- gboolean *y_expand_p)
-{
- ClutterActorIter iter;
- ClutterActor *child;
- gboolean x_expand, y_expand;
-
- x_expand = y_expand = FALSE;
-
- /* note that we don't recurse into children if we're already set to expand;
- * this avoids traversing the whole actor tree, even if it may lead to some
- * child left with the needs_compute_expand flag set.
- */
- clutter_actor_iter_init (&iter, self);
- while (clutter_actor_iter_next (&iter, &child))
- {
- x_expand = x_expand ||
- clutter_actor_needs_expand (child, CLUTTER_ORIENTATION_HORIZONTAL);
-
- y_expand = y_expand ||
- clutter_actor_needs_expand (child, CLUTTER_ORIENTATION_VERTICAL);
- }
-
- *x_expand_p = x_expand;
- *y_expand_p = y_expand;
-}
-
-static void
-clutter_actor_compute_expand (ClutterActor *self)
-{
- if (self->priv->needs_compute_expand)
- {
- const ClutterLayoutInfo *info;
- gboolean x_expand, y_expand;
-
- info = _clutter_actor_get_layout_info_or_defaults (self);
-
- if (self->priv->x_expand_set)
- x_expand = info->x_expand;
- else
- x_expand = FALSE;
-
- if (self->priv->y_expand_set)
- y_expand = info->y_expand;
- else
- y_expand = FALSE;
-
- /* we don't need to recurse down to the children if the
- * actor has been forcibly set to expand
- */
- if (!(self->priv->x_expand_set && self->priv->y_expand_set))
- {
- if (self->priv->n_children != 0)
- {
- gboolean *x_expand_p, *y_expand_p;
- gboolean ignored = FALSE;
-
- x_expand_p = self->priv->x_expand_set ? &ignored : &x_expand;
- y_expand_p = self->priv->y_expand_set ? &ignored : &y_expand;
-
- clutter_actor_compute_expand_recursive (self,
- x_expand_p,
- y_expand_p);
- }
- }
-
- self->priv->needs_compute_expand = FALSE;
- self->priv->needs_x_expand = (x_expand != FALSE);
- self->priv->needs_y_expand = (y_expand != FALSE);
- }
-}
-
-/**
- * clutter_actor_needs_expand:
- * @self: a #ClutterActor
- * @orientation: the direction of expansion
- *
- * Checks whether an actor, or any of its children, is set to expand
- * horizontally or vertically.
- *
- * This function should only be called by layout managers that can
- * assign extra space to their children.
- *
- * If you want to know whether the actor was explicitly set to expand,
- * use clutter_actor_get_x_expand() or clutter_actor_get_y_expand().
- *
- * Return value: %TRUE if the actor should expand
- *
- * Since: 1.12
- */
-gboolean
-clutter_actor_needs_expand (ClutterActor *self,
- ClutterOrientation orientation)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- if (!CLUTTER_ACTOR_IS_VISIBLE (self))
- return FALSE;
-
- if (CLUTTER_ACTOR_IN_DESTRUCTION (self))
- return FALSE;
-
- clutter_actor_compute_expand (self);
-
- switch (orientation)
- {
- case CLUTTER_ORIENTATION_HORIZONTAL:
- return self->priv->needs_x_expand;
-
- case CLUTTER_ORIENTATION_VERTICAL:
- return self->priv->needs_y_expand;
- }
-
- return FALSE;
-}
-
-/**
- * clutter_actor_set_content_repeat:
- * @self: a #ClutterActor
- * @repeat: the repeat policy
- *
- * Sets the policy for repeating the #ClutterActor:content of a
- * #ClutterActor. The behaviour is deferred to the #ClutterContent
- * implementation.
- *
- * Since: 1.12
- */
-void
-clutter_actor_set_content_repeat (ClutterActor *self,
- ClutterContentRepeat repeat)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- if (self->priv->content_repeat == repeat)
- return;
-
- self->priv->content_repeat = repeat;
-
- clutter_actor_queue_redraw (self);
-}
-
-/**
- * clutter_actor_get_content_repeat:
- * @self: a #ClutterActor
- *
- * Retrieves the repeat policy for a #ClutterActor set by
- * clutter_actor_set_content_repeat().
- *
- * Return value: the content repeat policy
- *
- * Since: 1.12
- */
-ClutterContentRepeat
-clutter_actor_get_content_repeat (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), CLUTTER_REPEAT_NONE);
-
- return self->priv->content_repeat;
-}
-
-void
-_clutter_actor_handle_event (ClutterActor *self,
- const ClutterEvent *event)
-{
- GPtrArray *event_tree;
- ClutterActor *iter;
- gboolean is_key_event;
- gint i = 0;
-
- /* XXX - for historical reasons that are now lost in the mists of time,
- * key events are delivered regardless of whether an actor is set as
- * reactive; this should be changed for 2.0.
- */
- is_key_event = event->type == CLUTTER_KEY_PRESS ||
- event->type == CLUTTER_KEY_RELEASE;
-
- event_tree = g_ptr_array_sized_new (64);
- g_ptr_array_set_free_func (event_tree, (GDestroyNotify) g_object_unref);
-
- /* build the list of of emitters for the event */
- iter = self;
- while (iter != NULL)
- {
- ClutterActor *parent = iter->priv->parent;
-
- if (CLUTTER_ACTOR_IS_REACTIVE (iter) || /* an actor must be reactive */
- parent == NULL || /* unless it's the stage */
- is_key_event) /* or this is a key event */
- {
- /* keep a reference on the actor, so that it remains valid
- * for the duration of the signal emission
- */
- g_ptr_array_add (event_tree, g_object_ref (iter));
- }
-
- iter = parent;
- }
-
- /* Capture: from top-level downwards */
- for (i = event_tree->len - 1; i >= 0; i--)
- if (clutter_actor_event (g_ptr_array_index (event_tree, i), event, TRUE))
- goto done;
-
- /* Bubble: from source upwards */
- for (i = 0; i < event_tree->len; i++)
- if (clutter_actor_event (g_ptr_array_index (event_tree, i), event, FALSE))
- goto done;
-
-done:
- g_ptr_array_free (event_tree, TRUE);
-}
-
-static void
-clutter_actor_set_child_transform_internal (ClutterActor *self,
- const graphene_matrix_t *transform)
-{
- ClutterTransformInfo *info = _clutter_actor_get_transform_info (self);
- ClutterActorIter iter;
- ClutterActor *child;
- GObject *obj;
- gboolean was_set = info->child_transform_set;
-
- graphene_matrix_init_from_matrix (&info->child_transform, transform);
-
- /* if it's the identity matrix, we need to toggle the boolean flag */
- info->child_transform_set = !graphene_matrix_is_identity (transform);
-
- /* we need to reset the transform_valid flag on each child */
- clutter_actor_iter_init (&iter, self);
- while (clutter_actor_iter_next (&iter, &child))
- transform_changed (child);
-
- clutter_actor_queue_redraw (self);
-
- obj = G_OBJECT (self);
- g_object_notify_by_pspec (obj, obj_props[PROP_CHILD_TRANSFORM]);
-
- if (was_set != info->child_transform_set)
- g_object_notify_by_pspec (obj, obj_props[PROP_CHILD_TRANSFORM_SET]);
-}
-
-/**
- * clutter_actor_set_child_transform:
- * @self: a #ClutterActor
- * @transform: (allow-none): a #graphene_matrix_t, or %NULL
- *
- * Sets the transformation matrix to be applied to all the children
- * of @self prior to their own transformations. The default child
- * transformation is the identity matrix.
- *
- * If @transform is %NULL, the child transform will be unset.
- *
- * The #ClutterActor:child-transform property is animatable.
- *
- * Since: 1.12
- */
-void
-clutter_actor_set_child_transform (ClutterActor *self,
- const graphene_matrix_t *transform)
-{
- const ClutterTransformInfo *info;
- graphene_matrix_t new_transform;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- info = _clutter_actor_get_transform_info_or_defaults (self);
-
- if (transform != NULL)
- graphene_matrix_init_from_matrix (&new_transform, transform);
- else
- graphene_matrix_init_identity (&new_transform);
-
- _clutter_actor_create_transition (self, obj_props[PROP_CHILD_TRANSFORM],
- &info->child_transform,
- &new_transform);
-}
-
-/**
- * clutter_actor_get_child_transform:
- * @self: a #ClutterActor
- * @transform: (out caller-allocates): a #graphene_matrix_t
- *
- * Retrieves the child transformation matrix set using
- * clutter_actor_set_child_transform(); if none is currently set,
- * the @transform matrix will be initialized to the identity matrix.
- *
- * Since: 1.12
- */
-void
-clutter_actor_get_child_transform (ClutterActor *self,
- graphene_matrix_t *transform)
-{
- const ClutterTransformInfo *info;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (transform != NULL);
-
- info = _clutter_actor_get_transform_info_or_defaults (self);
-
- if (info->child_transform_set)
- graphene_matrix_init_from_matrix (transform, &info->child_transform);
- else
- graphene_matrix_init_identity (transform);
-}
-
-static void
-clutter_actor_push_in_cloned_branch (ClutterActor *self,
- gulong count)
-{
- ClutterActor *iter;
-
- for (iter = self->priv->first_child;
- iter != NULL;
- iter = iter->priv->next_sibling)
- clutter_actor_push_in_cloned_branch (iter, count);
-
- self->priv->in_cloned_branch += count;
-}
-
-static void
-clutter_actor_pop_in_cloned_branch (ClutterActor *self,
- gulong count)
-{
- ClutterActor *iter;
-
- self->priv->in_cloned_branch -= count;
-
- for (iter = self->priv->first_child;
- iter != NULL;
- iter = iter->priv->next_sibling)
- clutter_actor_pop_in_cloned_branch (iter, count);
-}
-
-void
-_clutter_actor_attach_clone (ClutterActor *actor,
- ClutterActor *clone)
-{
- ClutterActorPrivate *priv = actor->priv;
-
- g_assert (clone != NULL);
-
- if (priv->clones == NULL)
- priv->clones = g_hash_table_new (NULL, NULL);
-
- g_hash_table_add (priv->clones, clone);
-
- clutter_actor_push_in_cloned_branch (actor, 1);
-}
-
-void
-_clutter_actor_detach_clone (ClutterActor *actor,
- ClutterActor *clone)
-{
- ClutterActorPrivate *priv = actor->priv;
-
- g_assert (clone != NULL);
-
- if (priv->clones == NULL ||
- g_hash_table_lookup (priv->clones, clone) == NULL)
- return;
-
- clutter_actor_pop_in_cloned_branch (actor, 1);
-
- g_hash_table_remove (priv->clones, clone);
-
- if (g_hash_table_size (priv->clones) == 0)
- {
- g_hash_table_unref (priv->clones);
- priv->clones = NULL;
- }
-}
-
-/**
- * clutter_actor_has_mapped_clones:
- * @self: a #ClutterActor
- *
- * Returns whether a #ClutterActor or any parent actors have mapped clones
- * that are clone-painting @self.
- *
- * Returns: %TRUE if the actor has mapped clones, %FALSE otherwise
- */
-gboolean
-clutter_actor_has_mapped_clones (ClutterActor *self)
-{
- ClutterActor *actor;
- GHashTableIter iter;
- gpointer key;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- if (self->priv->in_cloned_branch == 0)
- return FALSE;
-
- for (actor = self; actor; actor = actor->priv->parent)
- {
- if (actor->priv->clones)
- {
- g_hash_table_iter_init (&iter, actor->priv->clones);
- while (g_hash_table_iter_next (&iter, &key, NULL))
- {
- if (CLUTTER_ACTOR_IS_MAPPED (key))
- return TRUE;
- }
- }
-
- /* Clones will force-show their own source actor but not children of
- * it, so if we're hidden and an actor up the hierarchy has a clone,
- * we won't be visible.
- */
- if (!CLUTTER_ACTOR_IS_VISIBLE (actor))
- return FALSE;
- }
-
- return FALSE;
-}
-
-static void
-push_in_paint_unmapped_branch (ClutterActor *self,
- guint count)
-{
- ClutterActor *iter;
-
- for (iter = self->priv->first_child;
- iter != NULL;
- iter = iter->priv->next_sibling)
- push_in_paint_unmapped_branch (iter, count);
-
- self->priv->unmapped_paint_branch_counter += count;
-}
-
-static void
-pop_in_paint_unmapped_branch (ClutterActor *self,
- guint count)
-{
- ClutterActor *iter;
-
- self->priv->unmapped_paint_branch_counter -= count;
-
- for (iter = self->priv->first_child;
- iter != NULL;
- iter = iter->priv->next_sibling)
- pop_in_paint_unmapped_branch (iter, count);
-}
-
-static void
-clutter_actor_child_model__items_changed (GListModel *model,
- guint position,
- guint removed,
- guint added,
- gpointer user_data)
-{
- ClutterActor *parent = user_data;
- ClutterActorPrivate *priv = parent->priv;
- guint i;
-
- while (removed--)
- {
- ClutterActor *child = clutter_actor_get_child_at_index (parent, position);
- clutter_actor_destroy (child);
- }
-
- for (i = 0; i < added; i++)
- {
- GObject *item = g_list_model_get_item (model, position + i);
- ClutterActor *child = priv->create_child_func (item, priv->create_child_data);
-
- /* The actor returned by the function can have a floating reference,
- * if the implementation is in pure C, or have a full reference, usually
- * the case for language bindings. To avoid leaking references, we
- * try to assume ownership of the instance, and release the reference
- * at the end unconditionally, leaving the only reference to the actor
- * itself.
- */
- if (g_object_is_floating (child))
- g_object_ref_sink (child);
-
- clutter_actor_insert_child_at_index (parent, child, position + i);
-
- g_object_unref (child);
- g_object_unref (item);
- }
-}
-
-/**
- * clutter_actor_bind_model:
- * @self: a #ClutterActor
- * @model: (nullable): a #GListModel
- * @create_child_func: a function that creates #ClutterActor instances
- * from the contents of the @model
- * @user_data: user data passed to @create_child_func
- * @notify: function called when unsetting the @model
- *
- * Binds a #GListModel to a #ClutterActor.
- *
- * If the #ClutterActor was already bound to a #GListModel, the previous
- * binding is destroyed.
- *
- * The existing children of #ClutterActor are destroyed when setting a
- * model, and new children are created and added, representing the contents
- * of the @model. The #ClutterActor is updated whenever the @model changes.
- * If @model is %NULL, the #ClutterActor is left empty.
- *
- * When a #ClutterActor is bound to a model, adding and removing children
- * directly is undefined behaviour.
- *
- * Since: 1.24
- */
-void
-clutter_actor_bind_model (ClutterActor *self,
- GListModel *model,
- ClutterActorCreateChildFunc create_child_func,
- gpointer user_data,
- GDestroyNotify notify)
-{
- ClutterActorPrivate *priv = clutter_actor_get_instance_private (self);
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (model == NULL || G_IS_LIST_MODEL (model));
- g_return_if_fail (model == NULL || create_child_func != NULL);
-
- if (priv->child_model != NULL)
- {
- if (priv->create_child_notify != NULL)
- priv->create_child_notify (priv->create_child_data);
-
- g_signal_handlers_disconnect_by_func (priv->child_model,
- clutter_actor_child_model__items_changed,
- self);
- g_clear_object (&priv->child_model);
- priv->create_child_func = NULL;
- priv->create_child_data = NULL;
- priv->create_child_notify = NULL;
- }
-
- clutter_actor_destroy_all_children (self);
-
- if (model == NULL)
- return;
-
- priv->child_model = g_object_ref (model);
- priv->create_child_func = create_child_func;
- priv->create_child_data = user_data;
- priv->create_child_notify = notify;
-
- g_signal_connect (priv->child_model, "items-changed",
- G_CALLBACK (clutter_actor_child_model__items_changed),
- self);
-
- clutter_actor_child_model__items_changed (priv->child_model,
- 0,
- 0,
- g_list_model_get_n_items (priv->child_model),
- self);
-}
-
-typedef struct {
- GType child_type;
- GArray *props;
-} BindClosure;
-
-typedef struct {
- const char *model_property;
- const char *child_property;
- GBindingFlags flags;
-} BindProperty;
-
-static void
-bind_closure_free (gpointer data_)
-{
- BindClosure *data = data_;
-
- if (data == NULL)
- return;
-
- g_array_unref (data->props);
- g_free (data);
-}
-
-static ClutterActor *
-bind_child_with_properties (gpointer item,
- gpointer data_)
-{
- BindClosure *data = data_;
- ClutterActor *res;
- guint i;
-
- res = g_object_new (data->child_type, NULL);
-
- for (i = 0; i < data->props->len; i++)
- {
- const BindProperty *prop = &g_array_index (data->props, BindProperty, i);
-
- g_object_bind_property (item, prop->model_property,
- res, prop->child_property,
- prop->flags);
- }
-
- return res;
-}
-
-/**
- * clutter_actor_bind_model_with_properties:
- * @self: a #ClutterActor
- * @model: a #GListModel
- * @child_type: the type of #ClutterActor to use when creating
- * children mapping to items inside the @model
- * @first_model_property: the first property of @model to bind
- * @...: tuples of property names on the @model, on the child, and the
- * #GBindingFlags used to bind them, terminated by %NULL
- *
- * Binds a #GListModel to a #ClutterActor.
- *
- * Unlike clutter_actor_bind_model(), this function automatically creates
- * a child #ClutterActor of type @child_type, and binds properties on the
- * items inside the @model to the corresponding properties on the child,
- * for instance:
- *
- * |[<!-- language="C" -->
- * clutter_actor_bind_model_with_properties (actor, model,
- * MY_TYPE_CHILD_VIEW,
- * "label", "text", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE,
- * "icon", "image", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE,
- * "selected", "selected", G_BINDING_BIDIRECTIONAL,
- * "active", "active", G_BINDING_BIDIRECTIONAL,
- * NULL);
- * ]|
- *
- * is the equivalent of calling clutter_actor_bind_model() with a
- * #ClutterActorCreateChildFunc of:
- *
- * |[<!-- language="C" -->
- * ClutterActor *res = g_object_new (MY_TYPE_CHILD_VIEW, NULL);
- *
- * g_object_bind_property (item, "label", res, "text", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
- * g_object_bind_property (item, "icon", res, "image", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
- * g_object_bind_property (item, "selected", res, "selected", G_BINDING_BIDIRECTIONAL);
- * g_object_bind_property (item, "active", res, "active", G_BINDING_BIDIRECTIONAL);
- *
- * return res;
- * ]|
- *
- * If the #ClutterActor was already bound to a #GListModel, the previous
- * binding is destroyed.
- *
- * When a #ClutterActor is bound to a model, adding and removing children
- * directly is undefined behaviour.
- *
- * See also: clutter_actor_bind_model()
- *
- * Since: 1.24
- */
-void
-clutter_actor_bind_model_with_properties (ClutterActor *self,
- GListModel *model,
- GType child_type,
- const char *first_model_property,
- ...)
-{
- va_list args;
- BindClosure *clos;
- const char *model_property;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
- g_return_if_fail (G_IS_LIST_MODEL (model));
- g_return_if_fail (g_type_is_a (child_type, CLUTTER_TYPE_ACTOR));
-
- clos = g_new0 (BindClosure, 1);
- clos->child_type = child_type;
- clos->props = g_array_new (FALSE, FALSE, sizeof (BindProperty));
-
- va_start (args, first_model_property);
- model_property = first_model_property;
- while (model_property != NULL)
- {
- const char *child_property = va_arg (args, char *);
- GBindingFlags binding_flags = va_arg (args, guint);
- BindProperty bind;
-
- bind.model_property = g_intern_string (model_property);
- bind.child_property = g_intern_string (child_property);
- bind.flags = binding_flags;
-
- g_array_append_val (clos->props, bind);
-
- model_property = va_arg (args, char *);
- }
- va_end (args);
-
- clutter_actor_bind_model (self, model, bind_child_with_properties, clos, bind_closure_free);
-}
-
-/*< private >
- * clutter_actor_create_texture_paint_node:
- * @self: a #ClutterActor
- * @texture: a #CoglTexture
- *
- * Creates a #ClutterPaintNode initialized using the state of the
- * given #ClutterActor, ready to be used inside the implementation
- * of the #ClutterActorClass.paint_node virtual function.
- *
- * The returned paint node has the geometry set to the size of the
- * #ClutterActor:content-box property; it uses the filters specified
- * in the #ClutterActor:minification-filter and #ClutterActor:magnification-filter
- * properties; and respects the #ClutterActor:content-repeat property.
- *
- * Returns: (transfer full): The newly created #ClutterPaintNode
- *
- * Since: 1.24
- */
-ClutterPaintNode *
-clutter_actor_create_texture_paint_node (ClutterActor *self,
- CoglTexture *texture)
-{
- ClutterActorPrivate *priv = clutter_actor_get_instance_private (self);
- ClutterPaintNode *node;
- ClutterActorBox box;
- ClutterColor color;
-
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
- g_return_val_if_fail (texture != NULL, NULL);
-
- clutter_actor_get_content_box (self, &box);
-
- /* ClutterTextureNode will premultiply the blend color, so we
- * want it to be white with the paint opacity
- */
- color.red = 255;
- color.green = 255;
- color.blue = 255;
- color.alpha = clutter_actor_get_paint_opacity_internal (self);
-
- node = clutter_texture_node_new (texture, &color, priv->min_filter, priv->mag_filter);
- clutter_paint_node_set_static_name (node, "Texture");
-
- if (priv->content_repeat == CLUTTER_REPEAT_NONE)
- clutter_paint_node_add_rectangle (node, &box);
- else
- {
- float t_w = 1.f, t_h = 1.f;
-
- if ((priv->content_repeat & CLUTTER_REPEAT_X_AXIS) != FALSE)
- t_w = (box.x2 - box.x1) / cogl_texture_get_width (texture);
-
- if ((priv->content_repeat & CLUTTER_REPEAT_Y_AXIS) != FALSE)
- t_h = (box.y2 - box.y1) / cogl_texture_get_height (texture);
-
- clutter_paint_node_add_texture_rectangle (node, &box,
- 0.f, 0.f,
- t_w, t_h);
- }
-
- return node;
-}
-
-gboolean
-clutter_actor_has_accessible (ClutterActor *actor)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), FALSE);
-
- if (CLUTTER_ACTOR_GET_CLASS (actor)->has_accessible)
- return CLUTTER_ACTOR_GET_CLASS (actor)->has_accessible (actor);
-
- return TRUE;
-}
-
-void
-clutter_actor_queue_immediate_relayout (ClutterActor *self)
-{
- ClutterStage *stage;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- clutter_actor_queue_relayout (self);
-
- stage = CLUTTER_STAGE (_clutter_actor_get_stage_internal (self));
- if (stage)
- clutter_stage_set_actor_needs_immediate_relayout (stage);
-}
-
-/**
- * clutter_actor_invalidate_transform:
- * @self: A #ClutterActor
- *
- * Invalidate the cached transformation matrix of @self.
- * This is needed for implementations overriding the apply_transform()
- * vfunc and has to be called if the matrix returned by apply_transform()
- * would change.
- */
-void
-clutter_actor_invalidate_transform (ClutterActor *self)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- transform_changed (self);
-}
-
-/**
- * clutter_actor_invalidate_paint_volume:
- * @self: A #ClutterActor
- *
- * Invalidates the cached paint volume of @self. This is needed for
- * implementations overriding the #ClutterActorClass.get_paint_volume()
- * virtual function and has to be called every time the paint volume
- * returned by that function would change.
- */
-void
-clutter_actor_invalidate_paint_volume (ClutterActor *self)
-{
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- queue_update_paint_volume (self);
-}
-
-gboolean
-clutter_actor_get_redraw_clip (ClutterActor *self,
- ClutterPaintVolume *dst_old_pv,
- ClutterPaintVolume *dst_new_pv)
-{
- ClutterActorPrivate *priv = self->priv;
- ClutterPaintVolume *paint_volume;
-
- paint_volume = _clutter_actor_get_paint_volume_mutable (self);
- if (!paint_volume || !priv->last_paint_volume_valid)
- return FALSE;
-
- _clutter_paint_volume_set_from_volume (dst_old_pv, &priv->last_paint_volume);
- _clutter_paint_volume_set_from_volume (dst_new_pv, paint_volume);
-
- return TRUE;
-}
diff --git a/clutter/clutter/clutter-actor.h b/clutter/clutter/clutter-actor.h
deleted file mode 100644
index 10b0a2174..000000000
--- a/clutter/clutter/clutter-actor.h
+++ /dev/null
@@ -1,939 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- *
- * Copyright (C) 2006, 2007, 2008 OpenedHand Ltd
- * 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_ACTOR_H__
-#define __CLUTTER_ACTOR_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-/* clutter-actor.h */
-
-#include <gio/gio.h>
-#include <pango/pango.h>
-#include <atk/atk.h>
-
-#include <cogl/cogl.h>
-
-#include <clutter/clutter-types.h>
-#include <clutter/clutter-event.h>
-#include <clutter/clutter-paint-context.h>
-#include <clutter/clutter-pick-context.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_ACTOR (clutter_actor_get_type ())
-#define CLUTTER_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ACTOR, ClutterActor))
-#define CLUTTER_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_ACTOR, ClutterActorClass))
-#define CLUTTER_IS_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ACTOR))
-#define CLUTTER_IS_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_ACTOR))
-#define CLUTTER_ACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ACTOR, ClutterActorClass))
-
-/**
- * CLUTTER_ACTOR_SET_FLAGS:
- * @a: a #ClutterActor
- * @f: the #ClutterActorFlags to set
- *
- * Sets the given flags on a #ClutterActor
- *
- * Deprecated: 1.24: Changing flags directly is heavily discouraged in
- * newly written code. #ClutterActor will take care of setting the
- * internal state.
- */
-#define CLUTTER_ACTOR_SET_FLAGS(a,f) \
- CLUTTER_MACRO_DEPRECATED \
- (((ClutterActor*)(a))->flags |= (f))
-
-/**
- * CLUTTER_ACTOR_UNSET_FLAGS:
- * @a: a #ClutterActor
- * @f: the #ClutterActorFlags to unset
- *
- * Unsets the given flags on a #ClutterActor
- *
- * Deprecated: 1.24: Changing flags directly is heavily discouraged in
- * newly written code. #ClutterActor will take care of unsetting the
- * internal state.
- */
-#define CLUTTER_ACTOR_UNSET_FLAGS(a,f) \
- CLUTTER_MACRO_DEPRECATED \
- (((ClutterActor*)(a))->flags &= ~(f))
-
-#define CLUTTER_ACTOR_IS_MAPPED(a) \
- CLUTTER_MACRO_DEPRECATED_FOR ("Deprecated macro. Use clutter_actor_is_mapped instead") \
- ((((ClutterActor*)(a))->flags & CLUTTER_ACTOR_MAPPED) != FALSE)
-
-#define CLUTTER_ACTOR_IS_REALIZED(a) \
- CLUTTER_MACRO_DEPRECATED_FOR ("Deprecated macro. Use clutter_actor_is_realized instead") \
- ((((ClutterActor*)(a))->flags & CLUTTER_ACTOR_REALIZED) != FALSE)
-
-#define CLUTTER_ACTOR_IS_VISIBLE(a) \
- CLUTTER_MACRO_DEPRECATED_FOR ("Deprecated macro. Use clutter_actor_is_visible instead") \
- ((((ClutterActor*)(a))->flags & CLUTTER_ACTOR_VISIBLE) != FALSE)
-
-#define CLUTTER_ACTOR_IS_REACTIVE(a) \
- CLUTTER_MACRO_DEPRECATED_FOR ("Deprecated macro. Use clutter_actor_get_reactive instead") \
- ((((ClutterActor*)(a))->flags & CLUTTER_ACTOR_REACTIVE) != FALSE)
-
-typedef struct _ClutterActorClass ClutterActorClass;
-typedef struct _ClutterActorPrivate ClutterActorPrivate;
-
-/**
- * ClutterCallback:
- * @actor: a #ClutterActor
- * @data: (closure): user data
- *
- * Generic callback
- */
-typedef void (*ClutterCallback) (ClutterActor *actor,
- gpointer data);
-
-/**
- * CLUTTER_CALLBACK:
- * @f: a function
- *
- * Convenience macro to cast a function to #ClutterCallback
- */
-#define CLUTTER_CALLBACK(f) ((ClutterCallback) (f))
-
-/**
- * ClutterActor:
- * @flags: #ClutterActorFlags
- *
- * Base class for actors.
- */
-struct _ClutterActor
-{
- /*< private >*/
- GInitiallyUnowned parent_instance;
-
- /*< public >*/
- guint32 flags;
-
- /*< private >*/
- guint32 private_flags;
-
- ClutterActorPrivate *priv;
-};
-
-/**
- * ClutterActorClass:
- * @show: signal class handler for #ClutterActor::show; it must chain
- * up to the parent's implementation
- * @hide: signal class handler for #ClutterActor::hide; it must chain
- * up to the parent's implementation
- * @hide_all: virtual function for containers and composite actors, to
- * determine which children should be shown when calling
- * clutter_actor_hide_all() on the actor. Defaults to calling
- * clutter_actor_hide(). This virtual function is deprecated and it
- * should not be overridden.
- * @realize: virtual function, used to allocate resources for the actor;
- * it should chain up to the parent's implementation. This virtual
- * function is deprecated and should not be overridden in newly
- * written code.
- * @unrealize: virtual function, used to deallocate resources allocated
- * in ::realize; it should chain up to the parent's implementation. This
- * function is deprecated and should not be overridden in newly
- * written code.
- * @map: virtual function for containers and composite actors, to
- * map their children; it must chain up to the parent's implementation.
- * Overriding this function is optional.
- * @unmap: virtual function for containers and composite actors, to
- * unmap their children; it must chain up to the parent's implementation.
- * Overriding this function is optional.
- * @paint: virtual function, used to paint the actor
- * @get_preferred_width: virtual function, used when querying the minimum
- * and natural widths of an actor for a given height; it is used by
- * clutter_actor_get_preferred_width()
- * @get_preferred_height: virtual function, used when querying the minimum
- * and natural heights of an actor for a given width; it is used by
- * clutter_actor_get_preferred_height()
- * @allocate: virtual function, used when setting the coordinates of an
- * actor; it is used by clutter_actor_allocate(); when overriding this
- * function without chaining up, clutter_actor_set_allocation() must be
- * called and children must be allocated by the implementation, when
- * chaining up though, those things will be done by the parent's
- * implementation.
- * @apply_transform: virtual function, used when applying the transformations
- * to an actor before painting it or when transforming coordinates or
- * the allocation; if the transformation calculated by this function may
- * have changed, the cached transformation must be invalidated by calling
- * clutter_actor_invalidate_transform(); it must chain up to the parent's
- * implementation
- * @parent_set: signal class handler for the #ClutterActor::parent-set
- * @destroy: signal class handler for #ClutterActor::destroy. It must
- * chain up to the parent's implementation
- * @pick: virtual function, used to draw an outline of the actor with
- * the given color
- * @event: class handler for #ClutterActor::event
- * @button_press_event: class handler for #ClutterActor::button-press-event
- * @button_release_event: class handler for
- * #ClutterActor::button-release-event
- * @scroll_event: signal class closure for #ClutterActor::scroll-event
- * @key_press_event: signal class closure for #ClutterActor::key-press-event
- * @key_release_event: signal class closure for
- * #ClutterActor::key-release-event
- * @motion_event: signal class closure for #ClutterActor::motion-event
- * @enter_event: signal class closure for #ClutterActor::enter-event
- * @leave_event: signal class closure for #ClutterActor::leave-event
- * @captured_event: signal class closure for #ClutterActor::captured-event
- * @key_focus_in: signal class closure for #ClutterActor::key-focus-in
- * @key_focus_out: signal class closure for #ClutterActor::key-focus-out
- * @queue_relayout: class handler for #ClutterActor::queue-relayout
- * @get_accessible: virtual function, returns the accessible object that
- * describes the actor to an assistive technology.
- * @get_paint_volume: virtual function, for sub-classes to define their
- * #ClutterPaintVolume
- * @has_overlaps: virtual function for
- * sub-classes to advertise whether they need an offscreen redirect
- * to get the correct opacity. See
- * clutter_actor_set_offscreen_redirect() for details.
- * @paint_node: virtual function for creating paint nodes and attaching
- * them to the render tree
- * @touch_event: signal class closure for #ClutterActor::touch-event
- *
- * Base class for actors.
- */
-struct _ClutterActorClass
-{
- /*< private >*/
- GInitiallyUnownedClass parent_class;
-
- /*< public >*/
- void (* show) (ClutterActor *self);
- void (* hide) (ClutterActor *self);
- void (* hide_all) (ClutterActor *self);
- void (* realize) (ClutterActor *self);
- void (* unrealize) (ClutterActor *self);
- void (* map) (ClutterActor *self);
- void (* unmap) (ClutterActor *self);
- void (* paint) (ClutterActor *self,
- ClutterPaintContext *paint_context);
- void (* parent_set) (ClutterActor *actor,
- ClutterActor *old_parent);
-
- void (* destroy) (ClutterActor *self);
- void (* pick) (ClutterActor *actor,
- ClutterPickContext *pick_context);
-
- /* size negotiation */
- void (* get_preferred_width) (ClutterActor *self,
- gfloat for_height,
- gfloat *min_width_p,
- gfloat *natural_width_p);
- void (* get_preferred_height) (ClutterActor *self,
- gfloat for_width,
- gfloat *min_height_p,
- gfloat *natural_height_p);
- void (* allocate) (ClutterActor *self,
- const ClutterActorBox *box);
-
- /* transformations */
- void (* apply_transform) (ClutterActor *actor,
- graphene_matrix_t *matrix);
-
- /* event signals */
- gboolean (* event) (ClutterActor *actor,
- ClutterEvent *event);
- gboolean (* button_press_event) (ClutterActor *actor,
- ClutterButtonEvent *event);
- gboolean (* button_release_event) (ClutterActor *actor,
- ClutterButtonEvent *event);
- gboolean (* scroll_event) (ClutterActor *actor,
- ClutterScrollEvent *event);
- gboolean (* key_press_event) (ClutterActor *actor,
- ClutterKeyEvent *event);
- gboolean (* key_release_event) (ClutterActor *actor,
- ClutterKeyEvent *event);
- gboolean (* motion_event) (ClutterActor *actor,
- ClutterMotionEvent *event);
- gboolean (* enter_event) (ClutterActor *actor,
- ClutterCrossingEvent *event);
- gboolean (* leave_event) (ClutterActor *actor,
- ClutterCrossingEvent *event);
- gboolean (* captured_event) (ClutterActor *actor,
- ClutterEvent *event);
- void (* key_focus_in) (ClutterActor *actor);
- void (* key_focus_out) (ClutterActor *actor);
-
- void (* queue_relayout) (ClutterActor *self);
-
- /* accessibility support */
- AtkObject * (* get_accessible) (ClutterActor *self);
-
- gboolean (* get_paint_volume) (ClutterActor *actor,
- ClutterPaintVolume *volume);
-
- gboolean (* has_overlaps) (ClutterActor *self);
-
- void (* paint_node) (ClutterActor *self,
- ClutterPaintNode *root);
-
- gboolean (* touch_event) (ClutterActor *self,
- ClutterTouchEvent *event);
- gboolean (* has_accessible) (ClutterActor *self);
- void (* resource_scale_changed) (ClutterActor *self);
- float (* calculate_resource_scale) (ClutterActor *self,
- int phase);
-
- /*< private >*/
- /* padding for future expansion */
- gpointer _padding_dummy[25];
-};
-
-/**
- * ClutterActorIter:
- *
- * An iterator structure that allows to efficiently iterate over a
- * section of the scene graph.
- *
- * The contents of the #ClutterActorIter structure
- * are private and should only be accessed using the provided API.
- *
- * Since: 1.10
- */
-struct _ClutterActorIter
-{
- /*< private >*/
- gpointer CLUTTER_PRIVATE_FIELD (dummy1);
- gpointer CLUTTER_PRIVATE_FIELD (dummy2);
- gpointer CLUTTER_PRIVATE_FIELD (dummy3);
- gint CLUTTER_PRIVATE_FIELD (dummy4);
- gpointer CLUTTER_PRIVATE_FIELD (dummy5);
-};
-
-CLUTTER_EXPORT
-GType clutter_actor_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterActor * clutter_actor_new (void);
-
-CLUTTER_EXPORT
-void clutter_actor_set_flags (ClutterActor *self,
- ClutterActorFlags flags);
-CLUTTER_EXPORT
-void clutter_actor_unset_flags (ClutterActor *self,
- ClutterActorFlags flags);
-CLUTTER_EXPORT
-ClutterActorFlags clutter_actor_get_flags (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_show (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_hide (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_realize (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_unrealize (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_map (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_unmap (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_paint (ClutterActor *self,
- ClutterPaintContext *paint_context);
-CLUTTER_EXPORT
-void clutter_actor_continue_paint (ClutterActor *self,
- ClutterPaintContext *paint_context);
-CLUTTER_EXPORT
-void clutter_actor_pick (ClutterActor *actor,
- ClutterPickContext *pick_context);
-CLUTTER_EXPORT
-void clutter_actor_continue_pick (ClutterActor *actor,
- ClutterPickContext *pick_context);
-CLUTTER_EXPORT
-void clutter_actor_queue_redraw (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_queue_redraw_with_clip (ClutterActor *self,
- const cairo_rectangle_int_t *clip);
-CLUTTER_EXPORT
-void clutter_actor_queue_relayout (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_destroy (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_set_name (ClutterActor *self,
- const gchar *name);
-CLUTTER_EXPORT
-const gchar * clutter_actor_get_name (ClutterActor *self);
-CLUTTER_EXPORT
-AtkObject * clutter_actor_get_accessible (ClutterActor *self);
-CLUTTER_EXPORT
-gboolean clutter_actor_has_accessible (ClutterActor *self);
-
-CLUTTER_EXPORT
-gboolean clutter_actor_is_visible (ClutterActor *self);
-CLUTTER_EXPORT
-gboolean clutter_actor_is_mapped (ClutterActor *self);
-CLUTTER_EXPORT
-gboolean clutter_actor_is_realized (ClutterActor *self);
-
-/* Size negotiation */
-CLUTTER_EXPORT
-void clutter_actor_set_request_mode (ClutterActor *self,
- ClutterRequestMode mode);
-CLUTTER_EXPORT
-ClutterRequestMode clutter_actor_get_request_mode (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_get_preferred_width (ClutterActor *self,
- gfloat for_height,
- gfloat *min_width_p,
- gfloat *natural_width_p);
-CLUTTER_EXPORT
-void clutter_actor_get_preferred_height (ClutterActor *self,
- gfloat for_width,
- gfloat *min_height_p,
- gfloat *natural_height_p);
-CLUTTER_EXPORT
-void clutter_actor_get_preferred_size (ClutterActor *self,
- gfloat *min_width_p,
- gfloat *min_height_p,
- gfloat *natural_width_p,
- gfloat *natural_height_p);
-CLUTTER_EXPORT
-void clutter_actor_allocate (ClutterActor *self,
- const ClutterActorBox *box);
-CLUTTER_EXPORT
-void clutter_actor_allocate_preferred_size (ClutterActor *self,
- float x,
- float y);
-CLUTTER_EXPORT
-void clutter_actor_allocate_available_size (ClutterActor *self,
- gfloat x,
- gfloat y,
- gfloat available_width,
- gfloat available_height);
-CLUTTER_EXPORT
-void clutter_actor_allocate_align_fill (ClutterActor *self,
- const ClutterActorBox *box,
- gdouble x_align,
- gdouble y_align,
- gboolean x_fill,
- gboolean y_fill);
-CLUTTER_EXPORT
-void clutter_actor_set_allocation (ClutterActor *self,
- const ClutterActorBox *box);
-CLUTTER_EXPORT
-void clutter_actor_get_allocation_box (ClutterActor *self,
- ClutterActorBox *box);
-CLUTTER_EXPORT
-gboolean clutter_actor_has_allocation (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_set_size (ClutterActor *self,
- gfloat width,
- gfloat height);
-CLUTTER_EXPORT
-void clutter_actor_get_size (ClutterActor *self,
- gfloat *width,
- gfloat *height);
-CLUTTER_EXPORT
-void clutter_actor_set_position (ClutterActor *self,
- gfloat x,
- gfloat y);
-CLUTTER_EXPORT
-gboolean clutter_actor_get_fixed_position (ClutterActor *self,
- float *x,
- float *y);
-CLUTTER_EXPORT
-void clutter_actor_get_position (ClutterActor *self,
- gfloat *x,
- gfloat *y);
-CLUTTER_EXPORT
-gboolean clutter_actor_get_fixed_position_set (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_set_fixed_position_set (ClutterActor *self,
- gboolean is_set);
-CLUTTER_EXPORT
-void clutter_actor_move_by (ClutterActor *self,
- gfloat dx,
- gfloat dy);
-
-/* Actor geometry */
-CLUTTER_EXPORT
-gfloat clutter_actor_get_width (ClutterActor *self);
-CLUTTER_EXPORT
-gfloat clutter_actor_get_height (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_set_width (ClutterActor *self,
- gfloat width);
-CLUTTER_EXPORT
-void clutter_actor_set_height (ClutterActor *self,
- gfloat height);
-CLUTTER_EXPORT
-gfloat clutter_actor_get_x (ClutterActor *self);
-CLUTTER_EXPORT
-gfloat clutter_actor_get_y (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_set_x (ClutterActor *self,
- gfloat x);
-CLUTTER_EXPORT
-void clutter_actor_set_y (ClutterActor *self,
- gfloat y);
-CLUTTER_EXPORT
-void clutter_actor_set_z_position (ClutterActor *self,
- gfloat z_position);
-CLUTTER_EXPORT
-gfloat clutter_actor_get_z_position (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_set_layout_manager (ClutterActor *self,
- ClutterLayoutManager *manager);
-CLUTTER_EXPORT
-ClutterLayoutManager * clutter_actor_get_layout_manager (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_set_x_align (ClutterActor *self,
- ClutterActorAlign x_align);
-CLUTTER_EXPORT
-ClutterActorAlign clutter_actor_get_x_align (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_set_y_align (ClutterActor *self,
- ClutterActorAlign y_align);
-CLUTTER_EXPORT
-ClutterActorAlign clutter_actor_get_y_align (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_set_margin_top (ClutterActor *self,
- gfloat margin);
-CLUTTER_EXPORT
-gfloat clutter_actor_get_margin_top (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_set_margin_bottom (ClutterActor *self,
- gfloat margin);
-CLUTTER_EXPORT
-gfloat clutter_actor_get_margin_bottom (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_set_margin_left (ClutterActor *self,
- gfloat margin);
-CLUTTER_EXPORT
-gfloat clutter_actor_get_margin_left (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_set_margin_right (ClutterActor *self,
- gfloat margin);
-CLUTTER_EXPORT
-gfloat clutter_actor_get_margin_right (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_set_margin (ClutterActor *self,
- const ClutterMargin *margin);
-CLUTTER_EXPORT
-void clutter_actor_get_margin (ClutterActor *self,
- ClutterMargin *margin);
-CLUTTER_EXPORT
-void clutter_actor_set_x_expand (ClutterActor *self,
- gboolean expand);
-CLUTTER_EXPORT
-gboolean clutter_actor_get_x_expand (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_set_y_expand (ClutterActor *self,
- gboolean expand);
-CLUTTER_EXPORT
-gboolean clutter_actor_get_y_expand (ClutterActor *self);
-CLUTTER_EXPORT
-gboolean clutter_actor_needs_expand (ClutterActor *self,
- ClutterOrientation orientation);
-
-/* Paint */
-CLUTTER_EXPORT
-void clutter_actor_set_clip (ClutterActor *self,
- gfloat xoff,
- gfloat yoff,
- gfloat width,
- gfloat height);
-CLUTTER_EXPORT
-void clutter_actor_remove_clip (ClutterActor *self);
-CLUTTER_EXPORT
-gboolean clutter_actor_has_clip (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_get_clip (ClutterActor *self,
- gfloat *xoff,
- gfloat *yoff,
- gfloat *width,
- gfloat *height);
-CLUTTER_EXPORT
-void clutter_actor_set_clip_to_allocation (ClutterActor *self,
- gboolean clip_set);
-CLUTTER_EXPORT
-gboolean clutter_actor_get_clip_to_allocation (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_set_opacity (ClutterActor *self,
- guint8 opacity);
-CLUTTER_EXPORT
-guint8 clutter_actor_get_opacity (ClutterActor *self);
-CLUTTER_EXPORT
-guint8 clutter_actor_get_paint_opacity (ClutterActor *self);
-CLUTTER_EXPORT
-gboolean clutter_actor_get_paint_visibility (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_set_offscreen_redirect (ClutterActor *self,
- ClutterOffscreenRedirect redirect);
-CLUTTER_EXPORT
-ClutterOffscreenRedirect clutter_actor_get_offscreen_redirect (ClutterActor *self);
-CLUTTER_EXPORT
-gboolean clutter_actor_should_pick (ClutterActor *self,
- ClutterPickContext *pick_context);
-CLUTTER_EXPORT
-gboolean clutter_actor_is_in_clone_paint (ClutterActor *self);
-CLUTTER_EXPORT
-gboolean clutter_actor_get_paint_box (ClutterActor *self,
- ClutterActorBox *box);
-
-CLUTTER_EXPORT
-float clutter_actor_get_resource_scale (ClutterActor *self);
-
-CLUTTER_EXPORT
-gboolean clutter_actor_has_overlaps (ClutterActor *self);
-
-/* Content */
-CLUTTER_EXPORT
-void clutter_actor_set_content (ClutterActor *self,
- ClutterContent *content);
-CLUTTER_EXPORT
-ClutterContent * clutter_actor_get_content (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_set_content_gravity (ClutterActor *self,
- ClutterContentGravity gravity);
-CLUTTER_EXPORT
-ClutterContentGravity clutter_actor_get_content_gravity (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_set_content_scaling_filters (ClutterActor *self,
- ClutterScalingFilter min_filter,
- ClutterScalingFilter mag_filter);
-CLUTTER_EXPORT
-void clutter_actor_get_content_scaling_filters (ClutterActor *self,
- ClutterScalingFilter *min_filter,
- ClutterScalingFilter *mag_filter);
-CLUTTER_EXPORT
-void clutter_actor_set_content_repeat (ClutterActor *self,
- ClutterContentRepeat repeat);
-CLUTTER_EXPORT
-ClutterContentRepeat clutter_actor_get_content_repeat (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_get_content_box (ClutterActor *self,
- ClutterActorBox *box);
-CLUTTER_EXPORT
-void clutter_actor_set_background_color (ClutterActor *self,
- const ClutterColor *color);
-CLUTTER_EXPORT
-void clutter_actor_get_background_color (ClutterActor *self,
- ClutterColor *color);
-CLUTTER_EXPORT
-const ClutterPaintVolume * clutter_actor_get_paint_volume (ClutterActor *self);
-CLUTTER_EXPORT
-const ClutterPaintVolume * clutter_actor_get_transformed_paint_volume (ClutterActor *self,
- ClutterActor *relative_to_ancestor);
-CLUTTER_EXPORT
-const ClutterPaintVolume * clutter_actor_get_default_paint_volume (ClutterActor *self);
-
-/* Events */
-CLUTTER_EXPORT
-void clutter_actor_set_reactive (ClutterActor *actor,
- gboolean reactive);
-CLUTTER_EXPORT
-gboolean clutter_actor_get_reactive (ClutterActor *actor);
-CLUTTER_EXPORT
-gboolean clutter_actor_has_key_focus (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_grab_key_focus (ClutterActor *self);
-CLUTTER_EXPORT
-gboolean clutter_actor_event (ClutterActor *actor,
- const ClutterEvent *event,
- gboolean capture);
-CLUTTER_EXPORT
-gboolean clutter_actor_has_pointer (ClutterActor *self);
-
-/* Text */
-CLUTTER_EXPORT
-PangoContext * clutter_actor_get_pango_context (ClutterActor *self);
-CLUTTER_EXPORT
-PangoContext * clutter_actor_create_pango_context (ClutterActor *self);
-CLUTTER_EXPORT
-PangoLayout * clutter_actor_create_pango_layout (ClutterActor *self,
- const gchar *text);
-CLUTTER_EXPORT
-void clutter_actor_set_text_direction (ClutterActor *self,
- ClutterTextDirection text_dir);
-CLUTTER_EXPORT
-ClutterTextDirection clutter_actor_get_text_direction (ClutterActor *self);
-
-/* Actor hierarchy */
-CLUTTER_EXPORT
-void clutter_actor_add_child (ClutterActor *self,
- ClutterActor *child);
-CLUTTER_EXPORT
-void clutter_actor_insert_child_at_index (ClutterActor *self,
- ClutterActor *child,
- gint index_);
-CLUTTER_EXPORT
-void clutter_actor_insert_child_above (ClutterActor *self,
- ClutterActor *child,
- ClutterActor *sibling);
-CLUTTER_EXPORT
-void clutter_actor_insert_child_below (ClutterActor *self,
- ClutterActor *child,
- ClutterActor *sibling);
-CLUTTER_EXPORT
-void clutter_actor_replace_child (ClutterActor *self,
- ClutterActor *old_child,
- ClutterActor *new_child);
-CLUTTER_EXPORT
-void clutter_actor_remove_child (ClutterActor *self,
- ClutterActor *child);
-CLUTTER_EXPORT
-void clutter_actor_remove_all_children (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_destroy_all_children (ClutterActor *self);
-CLUTTER_EXPORT
-GList * clutter_actor_get_children (ClutterActor *self);
-CLUTTER_EXPORT
-gint clutter_actor_get_n_children (ClutterActor *self);
-CLUTTER_EXPORT
-ClutterActor * clutter_actor_get_child_at_index (ClutterActor *self,
- gint index_);
-CLUTTER_EXPORT
-ClutterActor * clutter_actor_get_previous_sibling (ClutterActor *self);
-CLUTTER_EXPORT
-ClutterActor * clutter_actor_get_next_sibling (ClutterActor *self);
-CLUTTER_EXPORT
-ClutterActor * clutter_actor_get_first_child (ClutterActor *self);
-CLUTTER_EXPORT
-ClutterActor * clutter_actor_get_last_child (ClutterActor *self);
-CLUTTER_EXPORT
-ClutterActor * clutter_actor_get_parent (ClutterActor *self);
-CLUTTER_EXPORT
-gboolean clutter_actor_contains (ClutterActor *self,
- ClutterActor *descendant);
-CLUTTER_EXPORT
-ClutterActor* clutter_actor_get_stage (ClutterActor *actor);
-CLUTTER_EXPORT
-void clutter_actor_set_child_below_sibling (ClutterActor *self,
- ClutterActor *child,
- ClutterActor *sibling);
-CLUTTER_EXPORT
-void clutter_actor_set_child_above_sibling (ClutterActor *self,
- ClutterActor *child,
- ClutterActor *sibling);
-CLUTTER_EXPORT
-void clutter_actor_set_child_at_index (ClutterActor *self,
- ClutterActor *child,
- gint index_);
-CLUTTER_EXPORT
-void clutter_actor_iter_init (ClutterActorIter *iter,
- ClutterActor *root);
-CLUTTER_EXPORT
-gboolean clutter_actor_iter_next (ClutterActorIter *iter,
- ClutterActor **child);
-CLUTTER_EXPORT
-gboolean clutter_actor_iter_prev (ClutterActorIter *iter,
- ClutterActor **child);
-CLUTTER_EXPORT
-void clutter_actor_iter_remove (ClutterActorIter *iter);
-CLUTTER_EXPORT
-void clutter_actor_iter_destroy (ClutterActorIter *iter);
-CLUTTER_EXPORT
-gboolean clutter_actor_iter_is_valid (const ClutterActorIter *iter);
-
-/* Transformations */
-CLUTTER_EXPORT
-gboolean clutter_actor_is_rotated (ClutterActor *self);
-CLUTTER_EXPORT
-gboolean clutter_actor_is_scaled (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_set_pivot_point (ClutterActor *self,
- gfloat pivot_x,
- gfloat pivot_y);
-CLUTTER_EXPORT
-void clutter_actor_get_pivot_point (ClutterActor *self,
- gfloat *pivot_x,
- gfloat *pivot_y);
-CLUTTER_EXPORT
-void clutter_actor_set_pivot_point_z (ClutterActor *self,
- gfloat pivot_z);
-CLUTTER_EXPORT
-gfloat clutter_actor_get_pivot_point_z (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_set_rotation_angle (ClutterActor *self,
- ClutterRotateAxis axis,
- gdouble angle);
-CLUTTER_EXPORT
-gdouble clutter_actor_get_rotation_angle (ClutterActor *self,
- ClutterRotateAxis axis);
-CLUTTER_EXPORT
-void clutter_actor_set_scale (ClutterActor *self,
- gdouble scale_x,
- gdouble scale_y);
-CLUTTER_EXPORT
-void clutter_actor_get_scale (ClutterActor *self,
- gdouble *scale_x,
- gdouble *scale_y);
-CLUTTER_EXPORT
-void clutter_actor_set_scale_z (ClutterActor *self,
- gdouble scale_z);
-CLUTTER_EXPORT
-gdouble clutter_actor_get_scale_z (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_set_translation (ClutterActor *self,
- gfloat translate_x,
- gfloat translate_y,
- gfloat translate_z);
-CLUTTER_EXPORT
-void clutter_actor_get_translation (ClutterActor *self,
- gfloat *translate_x,
- gfloat *translate_y,
- gfloat *translate_z);
-CLUTTER_EXPORT
-void clutter_actor_set_transform (ClutterActor *self,
- const graphene_matrix_t *transform);
-CLUTTER_EXPORT
-void clutter_actor_get_transform (ClutterActor *self,
- graphene_matrix_t *transform);
-CLUTTER_EXPORT
-void clutter_actor_set_child_transform (ClutterActor *self,
- const graphene_matrix_t *transform);
-CLUTTER_EXPORT
-void clutter_actor_get_child_transform (ClutterActor *self,
- graphene_matrix_t *transform);
-
-CLUTTER_EXPORT
-void clutter_actor_get_transformed_extents (ClutterActor *self,
- graphene_rect_t *rect);
-
-CLUTTER_EXPORT
-void clutter_actor_get_transformed_position (ClutterActor *self,
- gfloat *x,
- gfloat *y);
-CLUTTER_EXPORT
-void clutter_actor_get_transformed_size (ClutterActor *self,
- gfloat *width,
- gfloat *height);
-CLUTTER_EXPORT
-gboolean clutter_actor_transform_stage_point (ClutterActor *self,
- gfloat x,
- gfloat y,
- gfloat *x_out,
- gfloat *y_out);
-CLUTTER_EXPORT
-void clutter_actor_get_abs_allocation_vertices (ClutterActor *self,
- graphene_point3d_t *verts);
-CLUTTER_EXPORT
-void clutter_actor_apply_transform_to_point (ClutterActor *self,
- const graphene_point3d_t *point,
- graphene_point3d_t *vertex);
-CLUTTER_EXPORT
-void clutter_actor_apply_relative_transform_to_point (ClutterActor *self,
- ClutterActor *ancestor,
- const graphene_point3d_t *point,
- graphene_point3d_t *vertex);
-
-/* Implicit animations */
-CLUTTER_EXPORT
-void clutter_actor_save_easing_state (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_restore_easing_state (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_set_easing_mode (ClutterActor *self,
- ClutterAnimationMode mode);
-CLUTTER_EXPORT
-ClutterAnimationMode clutter_actor_get_easing_mode (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_set_easing_duration (ClutterActor *self,
- guint msecs);
-CLUTTER_EXPORT
-guint clutter_actor_get_easing_duration (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_set_easing_delay (ClutterActor *self,
- guint msecs);
-CLUTTER_EXPORT
-guint clutter_actor_get_easing_delay (ClutterActor *self);
-CLUTTER_EXPORT
-ClutterTransition * clutter_actor_get_transition (ClutterActor *self,
- const char *name);
-CLUTTER_EXPORT
-void clutter_actor_add_transition (ClutterActor *self,
- const char *name,
- ClutterTransition *transition);
-CLUTTER_EXPORT
-void clutter_actor_remove_transition (ClutterActor *self,
- const char *name);
-CLUTTER_EXPORT
-void clutter_actor_remove_all_transitions (ClutterActor *self);
-
-
-CLUTTER_EXPORT
-gboolean clutter_actor_has_mapped_clones (ClutterActor *self);
-CLUTTER_EXPORT
-void clutter_actor_set_opacity_override (ClutterActor *self,
- gint opacity);
-CLUTTER_EXPORT
-gint clutter_actor_get_opacity_override (ClutterActor *self);
-
-CLUTTER_EXPORT
-void clutter_actor_inhibit_culling (ClutterActor *actor);
-CLUTTER_EXPORT
-void clutter_actor_uninhibit_culling (ClutterActor *actor);
-
-/**
- * ClutterActorCreateChildFunc:
- * @item: (type GObject): the item in the model
- * @user_data: Data passed to clutter_actor_bind_model()
- *
- * Creates a #ClutterActor using the @item in the model.
- *
- * The usual way to implement this function is to create a #ClutterActor
- * instance and then bind the #GObject properties to the actor properties
- * of interest, using g_object_bind_property(). This way, when the @item
- * in the #GListModel changes, the #ClutterActor changes as well.
- *
- * Returns: (transfer full): The newly created child #ClutterActor
- *
- * Since: 1.24
- */
-typedef ClutterActor * (* ClutterActorCreateChildFunc) (gpointer item,
- gpointer user_data);
-
-CLUTTER_EXPORT
-void clutter_actor_bind_model (ClutterActor *self,
- GListModel *model,
- ClutterActorCreateChildFunc create_child_func,
- gpointer user_data,
- GDestroyNotify notify);
-CLUTTER_EXPORT
-void clutter_actor_bind_model_with_properties (ClutterActor *self,
- GListModel *model,
- GType child_type,
- const char *first_model_property,
- ...);
-
-CLUTTER_EXPORT
-void clutter_actor_pick_box (ClutterActor *self,
- ClutterPickContext *pick_context,
- const ClutterActorBox *box);
-
-CLUTTER_EXPORT
-GList * clutter_actor_peek_stage_views (ClutterActor *self);
-
-CLUTTER_EXPORT
-void clutter_actor_invalidate_transform (ClutterActor *self);
-
-CLUTTER_EXPORT
-void clutter_actor_invalidate_paint_volume (ClutterActor *self);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_ACTOR_H__ */
diff --git a/clutter/clutter/clutter-align-constraint.c b/clutter/clutter/clutter-align-constraint.c
deleted file mode 100644
index 46cf44073..000000000
--- a/clutter/clutter/clutter-align-constraint.c
+++ /dev/null
@@ -1,640 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-align-constraint
- * @Title: ClutterAlignConstraint
- * @Short_Description: A constraint aligning the position of an actor
- *
- * #ClutterAlignConstraint is a #ClutterConstraint that aligns the position
- * of the #ClutterActor to which it is applied to the size of another
- * #ClutterActor using an alignment factor
- *
- * #ClutterAlignConstraint is available since Clutter 1.4
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-align-constraint.h"
-
-#include "clutter-actor-meta-private.h"
-#include "clutter-actor-private.h"
-#include "clutter-constraint.h"
-#include "clutter-debug.h"
-#include "clutter-enum-types.h"
-#include "clutter-private.h"
-
-#include <math.h>
-
-#define CLUTTER_ALIGN_CONSTRAINT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_ALIGN_CONSTRAINT, ClutterAlignConstraintClass))
-#define CLUTTER_IS_ALIGN_CONSTRAINT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_ALIGN_CONSTRAINT))
-#define CLUTTER_ALIGN_CONSTRAINT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ALIGN_CONSTRAINT, ClutterAlignConstraintClass))
-
-struct _ClutterAlignConstraint
-{
- ClutterConstraint parent_instance;
-
- ClutterActor *actor;
- ClutterActor *source;
- ClutterAlignAxis align_axis;
- graphene_point_t pivot;
- gfloat factor;
-};
-
-struct _ClutterAlignConstraintClass
-{
- ClutterConstraintClass parent_class;
-};
-
-enum
-{
- PROP_0,
-
- PROP_SOURCE,
- PROP_ALIGN_AXIS,
- PROP_PIVOT_POINT,
- PROP_FACTOR,
-
- PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST];
-
-G_DEFINE_TYPE (ClutterAlignConstraint,
- clutter_align_constraint,
- CLUTTER_TYPE_CONSTRAINT);
-
-static void
-source_queue_relayout (ClutterActor *actor,
- ClutterAlignConstraint *align)
-{
- if (align->actor != NULL)
- _clutter_actor_queue_only_relayout (align->actor);
-}
-
-static void
-source_destroyed (ClutterActor *actor,
- ClutterAlignConstraint *align)
-{
- align->source = NULL;
-}
-
-static void
-clutter_align_constraint_set_actor (ClutterActorMeta *meta,
- ClutterActor *new_actor)
-{
- ClutterAlignConstraint *align = CLUTTER_ALIGN_CONSTRAINT (meta);
- ClutterActorMetaClass *parent;
-
- if (new_actor != NULL &&
- align->source != NULL &&
- clutter_actor_contains (new_actor, align->source))
- {
- g_warning (G_STRLOC ": The source actor '%s' is contained "
- "by the actor '%s' associated to the constraint "
- "'%s'",
- _clutter_actor_get_debug_name (align->source),
- _clutter_actor_get_debug_name (new_actor),
- _clutter_actor_meta_get_debug_name (meta));
- return;
- }
-
- /* store the pointer to the actor, for later use */
- align->actor = new_actor;
-
- parent = CLUTTER_ACTOR_META_CLASS (clutter_align_constraint_parent_class);
- parent->set_actor (meta, new_actor);
-}
-
-static void
-clutter_align_constraint_update_allocation (ClutterConstraint *constraint,
- ClutterActor *actor,
- ClutterActorBox *allocation)
-{
- ClutterAlignConstraint *align = CLUTTER_ALIGN_CONSTRAINT (constraint);
- gfloat source_width, source_height;
- gfloat actor_width, actor_height;
- gfloat offset_x_start, offset_y_start;
- gfloat pivot_x, pivot_y;
-
- if (align->source == NULL)
- return;
-
- clutter_actor_box_get_size (allocation, &actor_width, &actor_height);
-
- clutter_actor_get_size (align->source, &source_width, &source_height);
-
- pivot_x = align->pivot.x == -1.f
- ? align->factor
- : align->pivot.x;
- pivot_y = align->pivot.y == -1.f
- ? align->factor
- : align->pivot.y;
-
- offset_x_start = pivot_x * -actor_width;
- offset_y_start = pivot_y * -actor_height;
-
- switch (align->align_axis)
- {
- case CLUTTER_ALIGN_X_AXIS:
- allocation->x1 += offset_x_start + (source_width * align->factor);
- allocation->x2 = allocation->x1 + actor_width;
- break;
-
- case CLUTTER_ALIGN_Y_AXIS:
- allocation->y1 += offset_y_start + (source_height * align->factor);
- allocation->y2 = allocation->y1 + actor_height;
- break;
-
- case CLUTTER_ALIGN_BOTH:
- allocation->x1 += offset_x_start + (source_width * align->factor);
- allocation->y1 += offset_y_start + (source_height * align->factor);
- allocation->x2 = allocation->x1 + actor_width;
- allocation->y2 = allocation->y1 + actor_height;
- break;
-
- default:
- g_assert_not_reached ();
- break;
- }
-
- clutter_actor_box_clamp_to_pixel (allocation);
-}
-
-static void
-clutter_align_constraint_dispose (GObject *gobject)
-{
- ClutterAlignConstraint *align = CLUTTER_ALIGN_CONSTRAINT (gobject);
-
- if (align->source != NULL)
- {
- g_signal_handlers_disconnect_by_func (align->source,
- G_CALLBACK (source_destroyed),
- align);
- g_signal_handlers_disconnect_by_func (align->source,
- G_CALLBACK (source_queue_relayout),
- align);
- align->source = NULL;
- }
-
- G_OBJECT_CLASS (clutter_align_constraint_parent_class)->dispose (gobject);
-}
-
-static void
-clutter_align_constraint_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterAlignConstraint *align = CLUTTER_ALIGN_CONSTRAINT (gobject);
-
- switch (prop_id)
- {
- case PROP_SOURCE:
- clutter_align_constraint_set_source (align, g_value_get_object (value));
- break;
-
- case PROP_ALIGN_AXIS:
- clutter_align_constraint_set_align_axis (align, g_value_get_enum (value));
- break;
-
- case PROP_PIVOT_POINT:
- clutter_align_constraint_set_pivot_point (align, g_value_get_boxed (value));
- break;
-
- case PROP_FACTOR:
- clutter_align_constraint_set_factor (align, g_value_get_float (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_align_constraint_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterAlignConstraint *align = CLUTTER_ALIGN_CONSTRAINT (gobject);
-
- switch (prop_id)
- {
- case PROP_SOURCE:
- g_value_set_object (value, align->source);
- break;
-
- case PROP_ALIGN_AXIS:
- g_value_set_enum (value, align->align_axis);
- break;
-
- case PROP_PIVOT_POINT:
- {
- graphene_point_t point;
-
- clutter_align_constraint_get_pivot_point (align, &point);
-
- g_value_set_boxed (value, &point);
- }
- break;
-
- case PROP_FACTOR:
- g_value_set_float (value, align->factor);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_align_constraint_class_init (ClutterAlignConstraintClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
- ClutterConstraintClass *constraint_class = CLUTTER_CONSTRAINT_CLASS (klass);
-
- meta_class->set_actor = clutter_align_constraint_set_actor;
-
- constraint_class->update_allocation = clutter_align_constraint_update_allocation;
-
- /**
- * ClutterAlignConstraint:source:
- *
- * The #ClutterActor used as the source for the alignment.
- *
- * The #ClutterActor must not be a child or a grandchild of the actor
- * using the constraint.
- *
- * Since: 1.4
- */
- obj_props[PROP_SOURCE] =
- g_param_spec_object ("source",
- P_("Source"),
- P_("The source of the alignment"),
- CLUTTER_TYPE_ACTOR,
- CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);
-
- /**
- * ClutterAlignConstraint:align-axis:
- *
- * The axis to be used to compute the alignment
- *
- * Since: 1.4
- */
- obj_props[PROP_ALIGN_AXIS] =
- g_param_spec_enum ("align-axis",
- P_("Align Axis"),
- P_("The axis to align the position to"),
- CLUTTER_TYPE_ALIGN_AXIS,
- CLUTTER_ALIGN_X_AXIS,
- CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);
-
- /**
- * ClutterAlignConstraint:pivot-point:
- *
- * The pivot point used by the constraint. The pivot point is the
- * point in the constraint actor around which the aligning is applied,
- * with (0, 0) being the top left corner of the actor and (1, 1) the
- * bottom right corner of the actor.
- *
- * For example, setting the pivot point to (0.5, 0.5) and using a factor
- * of 1 for both axes will align the actors horizontal and vertical
- * center point with the bottom right corner of the source actor.
- *
- * By default, the pivot point is set to (-1, -1), which means it's not
- * used and the constrained actor will be aligned to always stay inside
- * the source actor.
- */
- obj_props[PROP_PIVOT_POINT] =
- g_param_spec_boxed ("pivot-point",
- P_("Pivot point"),
- P_("The pivot point"),
- GRAPHENE_TYPE_POINT,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
-
- /**
- * ClutterAlignConstraint:factor:
- *
- * The alignment factor, as a normalized value between 0.0 and 1.0
- *
- * The factor depends on the #ClutterAlignConstraint:align-axis property:
- * with an align-axis value of %CLUTTER_ALIGN_X_AXIS, 0.0 means left and
- * 1.0 means right; with a value of %CLUTTER_ALIGN_Y_AXIS, 0.0 means top
- * and 1.0 means bottom.
- *
- * Since: 1.4
- */
- obj_props[PROP_FACTOR] =
- g_param_spec_float ("factor",
- P_("Factor"),
- P_("The alignment factor, between 0.0 and 1.0"),
- 0.0, 1.0,
- 0.0,
- CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);
-
- gobject_class->dispose = clutter_align_constraint_dispose;
- gobject_class->set_property = clutter_align_constraint_set_property;
- gobject_class->get_property = clutter_align_constraint_get_property;
- g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
-}
-
-static void
-clutter_align_constraint_init (ClutterAlignConstraint *self)
-{
- self->actor = NULL;
- self->source = NULL;
- self->align_axis = CLUTTER_ALIGN_X_AXIS;
- self->pivot.x = -1.f;
- self->pivot.y = -1.f;
- self->factor = 0.0f;
-}
-
-/**
- * clutter_align_constraint_new:
- * @source: (allow-none): the #ClutterActor to use as the source of the
- * alignment, or %NULL
- * @axis: the axis to be used to compute the alignment
- * @factor: the alignment factor, between 0.0 and 1.0
- *
- * Creates a new constraint, aligning a #ClutterActor's position with
- * regards of the size of the actor to @source, with the given
- * alignment @factor
- *
- * Return value: the newly created #ClutterAlignConstraint
- *
- * Since: 1.4
- */
-ClutterConstraint *
-clutter_align_constraint_new (ClutterActor *source,
- ClutterAlignAxis axis,
- gfloat factor)
-{
- g_return_val_if_fail (source == NULL || CLUTTER_IS_ACTOR (source), NULL);
-
- return g_object_new (CLUTTER_TYPE_ALIGN_CONSTRAINT,
- "source", source,
- "align-axis", axis,
- "factor", factor,
- NULL);
-}
-
-/**
- * clutter_align_constraint_set_source:
- * @align: a #ClutterAlignConstraint
- * @source: (allow-none): a #ClutterActor, or %NULL to unset the source
- *
- * Sets the source of the alignment constraint
- *
- * Since: 1.4
- */
-void
-clutter_align_constraint_set_source (ClutterAlignConstraint *align,
- ClutterActor *source)
-{
- ClutterActor *old_source, *actor;
- ClutterActorMeta *meta;
-
- g_return_if_fail (CLUTTER_IS_ALIGN_CONSTRAINT (align));
- g_return_if_fail (source == NULL || CLUTTER_IS_ACTOR (source));
-
- if (align->source == source)
- return;
-
- meta = CLUTTER_ACTOR_META (align);
- actor = clutter_actor_meta_get_actor (meta);
- if (actor != NULL && source != NULL)
- {
- if (clutter_actor_contains (actor, source))
- {
- g_warning (G_STRLOC ": The source actor '%s' is contained "
- "by the actor '%s' associated to the constraint "
- "'%s'",
- _clutter_actor_get_debug_name (source),
- _clutter_actor_get_debug_name (actor),
- _clutter_actor_meta_get_debug_name (meta));
- return;
- }
- }
-
- old_source = align->source;
- if (old_source != NULL)
- {
- g_signal_handlers_disconnect_by_func (old_source,
- G_CALLBACK (source_destroyed),
- align);
- g_signal_handlers_disconnect_by_func (old_source,
- G_CALLBACK (source_queue_relayout),
- align);
- }
-
- align->source = source;
- if (align->source != NULL)
- {
- g_signal_connect (align->source, "queue-relayout",
- G_CALLBACK (source_queue_relayout),
- align);
- g_signal_connect (align->source, "destroy",
- G_CALLBACK (source_destroyed),
- align);
-
- if (align->actor != NULL)
- clutter_actor_queue_relayout (align->actor);
- }
-
- g_object_notify_by_pspec (G_OBJECT (align), obj_props[PROP_SOURCE]);
-}
-
-/**
- * clutter_align_constraint_get_source:
- * @align: a #ClutterAlignConstraint
- *
- * Retrieves the source of the alignment
- *
- * Return value: (transfer none): the #ClutterActor used as the source
- * of the alignment
- *
- * Since: 1.4
- */
-ClutterActor *
-clutter_align_constraint_get_source (ClutterAlignConstraint *align)
-{
- g_return_val_if_fail (CLUTTER_IS_ALIGN_CONSTRAINT (align), NULL);
-
- return align->source;
-}
-
-/**
- * clutter_align_constraint_set_align_axis:
- * @align: a #ClutterAlignConstraint
- * @axis: the axis to which the alignment refers to
- *
- * Sets the axis to which the alignment refers to
- *
- * Since: 1.4
- */
-void
-clutter_align_constraint_set_align_axis (ClutterAlignConstraint *align,
- ClutterAlignAxis axis)
-{
- g_return_if_fail (CLUTTER_IS_ALIGN_CONSTRAINT (align));
-
- if (align->align_axis == axis)
- return;
-
- align->align_axis = axis;
-
- if (align->actor != NULL)
- clutter_actor_queue_relayout (align->actor);
-
- g_object_notify_by_pspec (G_OBJECT (align), obj_props[PROP_ALIGN_AXIS]);
-}
-
-/**
- * clutter_align_constraint_get_align_axis:
- * @align: a #ClutterAlignConstraint
- *
- * Retrieves the value set using clutter_align_constraint_set_align_axis()
- *
- * Return value: the alignment axis
- *
- * Since: 1.4
- */
-ClutterAlignAxis
-clutter_align_constraint_get_align_axis (ClutterAlignConstraint *align)
-{
- g_return_val_if_fail (CLUTTER_IS_ALIGN_CONSTRAINT (align),
- CLUTTER_ALIGN_X_AXIS);
-
- return align->align_axis;
-}
-
-/**
- * clutter_align_constraint_set_pivot_point:
- * @align: a #ClutterAlignConstraint
- * @pivot_point: A #GraphenePoint
- *
- * Sets the pivot point used by the constraint, the pivot point is the
- * point in the constraint actor around which the aligning is applied,
- * with (0, 0) being the top left corner of the actor and (1, 1) the
- * bottom right corner of the actor.
- *
- * If -1 is used, the pivot point is unset and the constrained actor
- * will be aligned to always stay inside the source actor.
- */
-void
-clutter_align_constraint_set_pivot_point (ClutterAlignConstraint *align,
- const graphene_point_t *pivot_point)
-{
- g_return_if_fail (CLUTTER_IS_ALIGN_CONSTRAINT (align));
- g_return_if_fail (pivot_point != NULL);
- g_return_if_fail (pivot_point->x == -1.f ||
- (pivot_point->x >= 0.f && pivot_point->x <= 1.f));
- g_return_if_fail (pivot_point->y == -1.f ||
- (pivot_point->y >= 0.f && pivot_point->y <= 1.f));
-
- if (graphene_point_equal (&align->pivot, pivot_point))
- return;
-
- align->pivot = *pivot_point;
-
- if (align->actor != NULL)
- clutter_actor_queue_relayout (align->actor);
-
- g_object_notify_by_pspec (G_OBJECT (align), obj_props[PROP_PIVOT_POINT]);
-}
-
-/**
- * clutter_align_constraint_get_pivot_point
- * @align: a #ClutterAlignConstraint
- * @pivot_point: (out caller-allocates): return location for a #GraphenePoint
- *
- * Gets the pivot point used by the constraint set with
- * clutter_align_constraint_set_pivot_point(). If no custom pivot
- * point is set, -1 is set.
- */
-void
-clutter_align_constraint_get_pivot_point (ClutterAlignConstraint *align,
- graphene_point_t *pivot_point)
-{
- g_return_if_fail (CLUTTER_IS_ALIGN_CONSTRAINT (align));
- g_return_if_fail (pivot_point != NULL);
-
- *pivot_point = align->pivot;
-}
-
-/**
- * clutter_align_constraint_set_factor:
- * @align: a #ClutterAlignConstraint
- * @factor: the alignment factor, between 0.0 and 1.0
- *
- * Sets the alignment factor of the constraint
- *
- * The factor depends on the #ClutterAlignConstraint:align-axis property
- * and it is a value between 0.0 (meaning left, when
- * #ClutterAlignConstraint:align-axis is set to %CLUTTER_ALIGN_X_AXIS; or
- * meaning top, when #ClutterAlignConstraint:align-axis is set to
- * %CLUTTER_ALIGN_Y_AXIS) and 1.0 (meaning right, when
- * #ClutterAlignConstraint:align-axis is set to %CLUTTER_ALIGN_X_AXIS; or
- * meaning bottom, when #ClutterAlignConstraint:align-axis is set to
- * %CLUTTER_ALIGN_Y_AXIS). A value of 0.5 aligns in the middle in either
- * cases
- *
- * Since: 1.4
- */
-void
-clutter_align_constraint_set_factor (ClutterAlignConstraint *align,
- gfloat factor)
-{
- g_return_if_fail (CLUTTER_IS_ALIGN_CONSTRAINT (align));
-
- align->factor = CLAMP (factor, 0.0, 1.0);
-
- if (align->actor != NULL)
- clutter_actor_queue_relayout (align->actor);
-
- g_object_notify_by_pspec (G_OBJECT (align), obj_props[PROP_FACTOR]);
-}
-
-/**
- * clutter_align_constraint_get_factor:
- * @align: a #ClutterAlignConstraint
- *
- * Retrieves the factor set using clutter_align_constraint_set_factor()
- *
- * Return value: the alignment factor
- *
- * Since: 1.4
- */
-gfloat
-clutter_align_constraint_get_factor (ClutterAlignConstraint *align)
-{
- g_return_val_if_fail (CLUTTER_IS_ALIGN_CONSTRAINT (align), 0.0);
-
- return align->factor;
-}
diff --git a/clutter/clutter/clutter-align-constraint.h b/clutter/clutter/clutter-align-constraint.h
deleted file mode 100644
index 7e316ce45..000000000
--- a/clutter/clutter/clutter-align-constraint.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_ALIGN_CONSTRAINT_H__
-#define __CLUTTER_ALIGN_CONSTRAINT_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-constraint.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_ALIGN_CONSTRAINT (clutter_align_constraint_get_type ())
-#define CLUTTER_ALIGN_CONSTRAINT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ALIGN_CONSTRAINT, ClutterAlignConstraint))
-#define CLUTTER_IS_ALIGN_CONSTRAINT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ALIGN_CONSTRAINT))
-
-/**
- * ClutterAlignConstraint:
- *
- * #ClutterAlignConstraint is an opaque structure
- * whose members cannot be directly accesses
- *
- * Since: 1.4
- */
-typedef struct _ClutterAlignConstraint ClutterAlignConstraint;
-typedef struct _ClutterAlignConstraintClass ClutterAlignConstraintClass;
-
-CLUTTER_EXPORT
-GType clutter_align_constraint_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterConstraint *clutter_align_constraint_new (ClutterActor *source,
- ClutterAlignAxis axis,
- gfloat factor);
-
-CLUTTER_EXPORT
-void clutter_align_constraint_set_source (ClutterAlignConstraint *align,
- ClutterActor *source);
-CLUTTER_EXPORT
-ClutterActor * clutter_align_constraint_get_source (ClutterAlignConstraint *align);
-CLUTTER_EXPORT
-void clutter_align_constraint_set_align_axis (ClutterAlignConstraint *align,
- ClutterAlignAxis axis);
-CLUTTER_EXPORT
-ClutterAlignAxis clutter_align_constraint_get_align_axis (ClutterAlignConstraint *align);
-CLUTTER_EXPORT
-void clutter_align_constraint_set_pivot_point (ClutterAlignConstraint *align,
- const graphene_point_t *pivot_point);
-CLUTTER_EXPORT
-void clutter_align_constraint_get_pivot_point (ClutterAlignConstraint *align,
- graphene_point_t *pivot_point);
-CLUTTER_EXPORT
-void clutter_align_constraint_set_factor (ClutterAlignConstraint *align,
- gfloat factor);
-CLUTTER_EXPORT
-gfloat clutter_align_constraint_get_factor (ClutterAlignConstraint *align);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_ALIGN_CONSTRAINT_H__ */
diff --git a/clutter/clutter/clutter-animatable.c b/clutter/clutter/clutter-animatable.c
deleted file mode 100644
index 8ea28de77..000000000
--- a/clutter/clutter/clutter-animatable.c
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2009 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-animatable
- * @short_description: Interface for animatable classes
- *
- * #ClutterAnimatable is an interface that allows a #GObject class
- * to control how an actor will animate a property.
- *
- * Each #ClutterAnimatable should implement the
- * #ClutterAnimatableInterface.interpolate_property() virtual function of the
- * interface to compute the animation state between two values of an interval
- * depending on a progress factor, expressed as a floating point value.
- *
- * #ClutterAnimatable is available since Clutter 1.0
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-animatable.h"
-#include "clutter-interval.h"
-#include "clutter-debug.h"
-#include "clutter-private.h"
-
-G_DEFINE_INTERFACE (ClutterAnimatable, clutter_animatable, G_TYPE_OBJECT);
-
-static void
-clutter_animatable_default_init (ClutterAnimatableInterface *iface)
-{
-}
-
-/**
- * clutter_animatable_find_property:
- * @animatable: a #ClutterAnimatable
- * @property_name: the name of the animatable property to find
- *
- * Finds the #GParamSpec for @property_name
- *
- * Return value: (transfer none): The #GParamSpec for the given property
- * or %NULL
- *
- * Since: 1.4
- */
-GParamSpec *
-clutter_animatable_find_property (ClutterAnimatable *animatable,
- const gchar *property_name)
-{
- ClutterAnimatableInterface *iface;
-
- g_return_val_if_fail (CLUTTER_IS_ANIMATABLE (animatable), NULL);
- g_return_val_if_fail (property_name != NULL, NULL);
-
- CLUTTER_NOTE (ANIMATION, "Looking for property '%s'", property_name);
-
- iface = CLUTTER_ANIMATABLE_GET_IFACE (animatable);
- if (iface->find_property != NULL)
- return iface->find_property (animatable, property_name);
-
- return g_object_class_find_property (G_OBJECT_GET_CLASS (animatable),
- property_name);
-}
-
-/**
- * clutter_animatable_get_initial_state:
- * @animatable: a #ClutterAnimatable
- * @property_name: the name of the animatable property to retrieve
- * @value: a #GValue initialized to the type of the property to retrieve
- *
- * Retrieves the current state of @property_name and sets @value with it
- *
- * Since: 1.4
- */
-void
-clutter_animatable_get_initial_state (ClutterAnimatable *animatable,
- const gchar *property_name,
- GValue *value)
-{
- ClutterAnimatableInterface *iface;
-
- g_return_if_fail (CLUTTER_IS_ANIMATABLE (animatable));
- g_return_if_fail (property_name != NULL);
-
- CLUTTER_NOTE (ANIMATION, "Getting initial state of '%s'", property_name);
-
- iface = CLUTTER_ANIMATABLE_GET_IFACE (animatable);
- if (iface->get_initial_state != NULL)
- iface->get_initial_state (animatable, property_name, value);
- else
- g_object_get_property (G_OBJECT (animatable), property_name, value);
-}
-
-/**
- * clutter_animatable_set_final_state:
- * @animatable: a #ClutterAnimatable
- * @property_name: the name of the animatable property to set
- * @value: the value of the animatable property to set
- *
- * Sets the current state of @property_name to @value
- *
- * Since: 1.4
- */
-void
-clutter_animatable_set_final_state (ClutterAnimatable *animatable,
- const gchar *property_name,
- const GValue *value)
-{
- ClutterAnimatableInterface *iface;
-
- g_return_if_fail (CLUTTER_IS_ANIMATABLE (animatable));
- g_return_if_fail (property_name != NULL);
-
- CLUTTER_NOTE (ANIMATION, "Setting state of property '%s'", property_name);
-
- iface = CLUTTER_ANIMATABLE_GET_IFACE (animatable);
- if (iface->set_final_state != NULL)
- iface->set_final_state (animatable, property_name, value);
- else
- g_object_set_property (G_OBJECT (animatable), property_name, value);
-}
-
-/**
- * clutter_animatable_interpolate_value:
- * @animatable: a #ClutterAnimatable
- * @property_name: the name of the property to interpolate
- * @interval: a #ClutterInterval with the animation range
- * @progress: the progress to use to interpolate between the
- * initial and final values of the @interval
- * @value: (out): return location for an initialized #GValue
- * using the same type of the @interval
- *
- * Asks a #ClutterAnimatable implementation to interpolate a
- * a named property between the initial and final values of
- * a #ClutterInterval, using @progress as the interpolation
- * value, and store the result inside @value.
- *
- * This function should be used for every property animation
- * involving #ClutterAnimatable<!-- -->s.
- *
- * This function replaces clutter_animatable_animate_property().
- *
- * Return value: %TRUE if the interpolation was successful,
- * and %FALSE otherwise
- *
- * Since: 1.8
- */
-gboolean
-clutter_animatable_interpolate_value (ClutterAnimatable *animatable,
- const gchar *property_name,
- ClutterInterval *interval,
- gdouble progress,
- GValue *value)
-{
- ClutterAnimatableInterface *iface;
-
- g_return_val_if_fail (CLUTTER_IS_ANIMATABLE (animatable), FALSE);
- g_return_val_if_fail (property_name != NULL, FALSE);
- g_return_val_if_fail (CLUTTER_IS_INTERVAL (interval), FALSE);
- g_return_val_if_fail (value != NULL, FALSE);
-
- CLUTTER_NOTE (ANIMATION, "Interpolating '%s' (progress: %.3f)",
- property_name,
- progress);
-
- iface = CLUTTER_ANIMATABLE_GET_IFACE (animatable);
- if (iface->interpolate_value != NULL)
- {
- return iface->interpolate_value (animatable, property_name,
- interval,
- progress,
- value);
- }
- else
- return clutter_interval_compute_value (interval, progress, value);
-}
-
-/**
- * clutter_animatable_get_actor:
- * @animatable: a #ClutterAnimatable
- *
- * Get animated actor.
- *
- * Return value: (transfer none): a #ClutterActor
- */
-ClutterActor *
-clutter_animatable_get_actor (ClutterAnimatable *animatable)
-{
- ClutterAnimatableInterface *iface;
-
- g_return_val_if_fail (CLUTTER_IS_ANIMATABLE (animatable), NULL);
-
- iface = CLUTTER_ANIMATABLE_GET_IFACE (animatable);
-
- g_return_val_if_fail (iface->get_actor, NULL);
-
- return iface->get_actor (animatable);
-}
diff --git a/clutter/clutter/clutter-animatable.h b/clutter/clutter/clutter-animatable.h
deleted file mode 100644
index 5b18f3795..000000000
--- a/clutter/clutter/clutter-animatable.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2009 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_ANIMATABLE_H__
-#define __CLUTTER_ANIMATABLE_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-types.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_ANIMATABLE (clutter_animatable_get_type ())
-
-CLUTTER_EXPORT
-G_DECLARE_INTERFACE (ClutterAnimatable, clutter_animatable,
- CLUTTER, ANIMATABLE,
- GObject)
-
-/**
- * ClutterAnimatableInterface:
- * @find_property: virtual function for retrieving the #GParamSpec of
- * an animatable property
- * @get_initial_state: virtual function for retrieving the initial
- * state of an animatable property
- * @set_final_state: virtual function for setting the state of an
- * animatable property
- * @interpolate_value: virtual function for interpolating the progress
- * of a property
- * @get_actor: virtual function for getting associated actor
- *
- * Since: 1.0
- */
-struct _ClutterAnimatableInterface
-{
- /*< private >*/
- GTypeInterface parent_iface;
-
- /*< public >*/
- GParamSpec *(* find_property) (ClutterAnimatable *animatable,
- const gchar *property_name);
- void (* get_initial_state) (ClutterAnimatable *animatable,
- const gchar *property_name,
- GValue *value);
- void (* set_final_state) (ClutterAnimatable *animatable,
- const gchar *property_name,
- const GValue *value);
- gboolean (* interpolate_value) (ClutterAnimatable *animatable,
- const gchar *property_name,
- ClutterInterval *interval,
- gdouble progress,
- GValue *value);
- ClutterActor * (* get_actor) (ClutterAnimatable *animatable);
-};
-
-CLUTTER_EXPORT
-GParamSpec *clutter_animatable_find_property (ClutterAnimatable *animatable,
- const gchar *property_name);
-CLUTTER_EXPORT
-void clutter_animatable_get_initial_state (ClutterAnimatable *animatable,
- const gchar *property_name,
- GValue *value);
-CLUTTER_EXPORT
-void clutter_animatable_set_final_state (ClutterAnimatable *animatable,
- const gchar *property_name,
- const GValue *value);
-CLUTTER_EXPORT
-gboolean clutter_animatable_interpolate_value (ClutterAnimatable *animatable,
- const gchar *property_name,
- ClutterInterval *interval,
- gdouble progress,
- GValue *value);
-
-CLUTTER_EXPORT
-ClutterActor * clutter_animatable_get_actor (ClutterAnimatable *animatable);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_ANIMATABLE_H__ */
diff --git a/clutter/clutter/clutter-autocleanups.h b/clutter/clutter/clutter-autocleanups.h
deleted file mode 100644
index 1d5af5ef8..000000000
--- a/clutter/clutter/clutter-autocleanups.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright 2015 Emmanuele Bassi
- *
- * 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_AUTO_CLEANUPS_H__
-#define __CLUTTER_AUTO_CLEANUPS_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#ifndef __GI_SCANNER__
-
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActor, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterAlignConstraint, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBackend, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBindConstraint, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBindingPool, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBinLayout, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBlurEffect, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBoxLayout, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBrightnessContrastEffect, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterCanvas, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterChildMeta, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterClone, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColorizeEffect, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (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 (ClutterEffect, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterFixedLayout, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterFlowLayout, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterGridLayout, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterImage, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterInputDevice, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterInterval, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterKeyframeTransition, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterLayoutManager, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterLayoutMeta, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterOffscreenEffect, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPageTurnEffect, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPanAction, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPathConstraint, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPath, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPropertyTransition, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterRotateAction, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterScriptable, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterScript, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterScrollActor, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterSettings, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterShaderEffect, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterSnapConstraint, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterStage, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterSwipeAction, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterTapAction, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterTextBuffer, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterText, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterTimeline, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterTransitionGroup, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterTransition, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterZoomAction, g_object_unref)
-
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActorBox, clutter_actor_box_free)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColor, clutter_color_free)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterMargin, clutter_margin_free)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintContext, clutter_paint_context_unref)
-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)
-
-#endif /* __GI_SCANNER__ */
-
-#endif /* __CLUTTER_AUTO_CLEANUPS_H__ */
diff --git a/clutter/clutter/clutter-backend-private.h b/clutter/clutter/clutter-backend-private.h
deleted file mode 100644
index 9309bdd01..000000000
--- a/clutter/clutter/clutter-backend-private.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __CLUTTER_BACKEND_PRIVATE_H__
-#define __CLUTTER_BACKEND_PRIVATE_H__
-
-#include <clutter/clutter-backend.h>
-#include <clutter/clutter-seat.h>
-#include <clutter/clutter-stage-window.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))
-
-G_BEGIN_DECLS
-
-typedef struct _ClutterBackendPrivate ClutterBackendPrivate;
-
-struct _ClutterBackend
-{
- /*< private >*/
- GObject parent_instance;
-
- CoglRenderer *cogl_renderer;
- CoglDisplay *cogl_display;
- CoglContext *cogl_context;
- GSource *cogl_source;
-
- CoglOnscreen *dummy_onscreen;
-
- cairo_font_options_t *font_options;
-
- gchar *font_name;
-
- gfloat units_per_em;
- gint32 units_serial;
-
- float fallback_resource_scale;
-
- ClutterStageWindow *stage_window;
-
- ClutterInputMethod *input_method;
-};
-
-struct _ClutterBackendClass
-{
- /*< private >*/
- GObjectClass parent_class;
-
- /* vfuncs */
- gboolean (* pre_parse) (ClutterBackend *backend,
- GError **error);
- gboolean (* post_parse) (ClutterBackend *backend,
- GError **error);
- ClutterStageWindow * (* create_stage) (ClutterBackend *backend,
- ClutterStage *wrapper,
- GError **error);
- void (* init_features) (ClutterBackend *backend);
- void (* add_options) (ClutterBackend *backend,
- GOptionGroup *group);
- ClutterFeatureFlags (* get_features) (ClutterBackend *backend);
- CoglRenderer * (* get_renderer) (ClutterBackend *backend,
- GError **error);
- CoglDisplay * (* get_display) (ClutterBackend *backend,
- CoglRenderer *renderer,
- CoglSwapChain *swap_chain,
- GError **error);
- gboolean (* create_context) (ClutterBackend *backend,
- GError **error);
-
- gboolean (* translate_event) (ClutterBackend *backend,
- gpointer native,
- ClutterEvent *event);
-
- ClutterSeat * (* get_default_seat) (ClutterBackend *backend);
-
- gboolean (* is_display_server) (ClutterBackend *backend);
-
- /* signals */
- void (* resolution_changed) (ClutterBackend *backend);
- void (* font_changed) (ClutterBackend *backend);
- void (* settings_changed) (ClutterBackend *backend);
-};
-
-ClutterBackend * _clutter_create_backend (void);
-
-ClutterStageWindow * _clutter_backend_create_stage (ClutterBackend *backend,
- ClutterStage *wrapper,
- GError **error);
-gboolean _clutter_backend_create_context (ClutterBackend *backend,
- GError **error);
-
-void _clutter_backend_add_options (ClutterBackend *backend,
- GOptionGroup *group);
-gboolean _clutter_backend_pre_parse (ClutterBackend *backend,
- GError **error);
-gboolean _clutter_backend_post_parse (ClutterBackend *backend,
- GError **error);
-
-CLUTTER_EXPORT
-gboolean _clutter_backend_translate_event (ClutterBackend *backend,
- gpointer native,
- ClutterEvent *event);
-
-ClutterFeatureFlags _clutter_backend_get_features (ClutterBackend *backend);
-
-gfloat _clutter_backend_get_units_per_em (ClutterBackend *backend,
- PangoFontDescription *font_desc);
-gint32 _clutter_backend_get_units_serial (ClutterBackend *backend);
-
-void clutter_set_allowed_drivers (const char *drivers);
-
-CLUTTER_EXPORT
-ClutterStageWindow * clutter_backend_get_stage_window (ClutterBackend *backend);
-
-CLUTTER_EXPORT
-void clutter_backend_set_fallback_resource_scale (ClutterBackend *backend,
- float fallback_resource_scale);
-
-float clutter_backend_get_fallback_resource_scale (ClutterBackend *backend);
-
-gboolean clutter_backend_is_display_server (ClutterBackend *backend);
-
-CLUTTER_EXPORT
-void clutter_backend_destroy (ClutterBackend *backend);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_BACKEND_PRIVATE_H__ */
diff --git a/clutter/clutter/clutter-backend.c b/clutter/clutter/clutter-backend.c
deleted file mode 100644
index af806c051..000000000
--- a/clutter/clutter/clutter-backend.c
+++ /dev/null
@@ -1,886 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By:
- * Matthew Allum <mallum@openedhand.com>
- * Emmanuele Bassi <ebassi@linux.intel.com>
- *
- * Copyright (C) 2006, 2007, 2008 OpenedHand Ltd
- * Copyright (C) 2009, 2010 Intel Corp
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * SECTION:clutter-backend
- * @short_description: Backend abstraction
- *
- * Clutter can be compiled against different backends. Each backend
- * has to implement a set of functions, in order to be used by Clutter.
- *
- * #ClutterBackend is the base class abstracting the various implementation;
- * it provides a basic API to query the backend for generic information
- * and settings.
- *
- * #ClutterBackend is available since Clutter 0.4
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-backend-private.h"
-#include "clutter-debug.h"
-#include "clutter-event-private.h"
-#include "clutter-marshal.h"
-#include "clutter-mutter.h"
-#include "clutter-private.h"
-#include "clutter-stage-manager-private.h"
-#include "clutter-stage-private.h"
-#include "clutter-stage-window.h"
-
-#include <cogl/cogl.h>
-
-#define DEFAULT_FONT_NAME "Sans 10"
-
-enum
-{
- RESOLUTION_CHANGED,
- FONT_CHANGED,
- SETTINGS_CHANGED,
-
- LAST_SIGNAL
-};
-
-G_DEFINE_ABSTRACT_TYPE (ClutterBackend, clutter_backend, G_TYPE_OBJECT)
-
-static guint backend_signals[LAST_SIGNAL] = { 0, };
-
-static void
-clutter_backend_dispose (GObject *gobject)
-{
- ClutterBackend *backend = CLUTTER_BACKEND (gobject);
-
- /* clear the events still in the queue of the main context */
- _clutter_clear_events_queue ();
-
- g_clear_object (&backend->dummy_onscreen);
- if (backend->stage_window)
- {
- g_object_remove_weak_pointer (G_OBJECT (backend->stage_window),
- (gpointer *) &backend->stage_window);
- backend->stage_window = NULL;
- }
-
- g_clear_pointer (&backend->cogl_source, g_source_destroy);
- g_clear_pointer (&backend->font_name, g_free);
- g_clear_pointer (&backend->font_options, cairo_font_options_destroy);
- g_clear_object (&backend->input_method);
-
- G_OBJECT_CLASS (clutter_backend_parent_class)->dispose (gobject);
-}
-
-static gfloat
-get_units_per_em (ClutterBackend *backend,
- PangoFontDescription *font_desc)
-{
- gfloat units_per_em = -1.0;
- gboolean free_font_desc = FALSE;
- gdouble dpi;
-
- dpi = clutter_backend_get_resolution (backend);
-
- if (font_desc == NULL)
- {
- ClutterSettings *settings;
- gchar *font_name = NULL;
-
- settings = clutter_settings_get_default ();
- g_object_get (settings, "font-name", &font_name, NULL);
-
- if (G_LIKELY (font_name != NULL && *font_name != '\0'))
- {
- font_desc = pango_font_description_from_string (font_name);
- free_font_desc = TRUE;
-
- g_free (font_name);
- }
- }
-
- if (font_desc != NULL)
- {
- gdouble font_size = 0;
- gint pango_size;
- gboolean is_absolute;
-
- pango_size = pango_font_description_get_size (font_desc);
- is_absolute = pango_font_description_get_size_is_absolute (font_desc);
-
- /* "absolute" means "device units" (usually, pixels); otherwise,
- * it means logical units (points)
- */
- if (is_absolute)
- font_size = (gdouble) pango_size / PANGO_SCALE;
- else
- font_size = dpi * ((gdouble) pango_size / PANGO_SCALE) / 72.0f;
-
- /* 10 points at 96 DPI is 13.3 pixels */
- units_per_em = (1.2f * font_size) * dpi / 96.0f;
- }
- else
- units_per_em = -1.0f;
-
- if (free_font_desc)
- pango_font_description_free (font_desc);
-
- return units_per_em;
-}
-
-static void
-clutter_backend_real_resolution_changed (ClutterBackend *backend)
-{
- ClutterMainContext *context;
- ClutterSettings *settings;
- gdouble resolution;
- gint dpi;
-
- settings = clutter_settings_get_default ();
- g_object_get (settings, "font-dpi", &dpi, NULL);
-
- if (dpi < 0)
- resolution = 96.0;
- else
- resolution = dpi / 1024.0;
-
- context = _clutter_context_get_default ();
- if (context->font_map != NULL)
- cogl_pango_font_map_set_resolution (context->font_map, resolution);
-
- backend->units_per_em = get_units_per_em (backend, NULL);
- backend->units_serial += 1;
-
- CLUTTER_NOTE (BACKEND, "Units per em: %.2f", backend->units_per_em);
-}
-
-static void
-clutter_backend_real_font_changed (ClutterBackend *backend)
-{
- backend->units_per_em = get_units_per_em (backend, NULL);
- backend->units_serial += 1;
-
- CLUTTER_NOTE (BACKEND, "Units per em: %.2f", backend->units_per_em);
-}
-
-static gboolean
-clutter_backend_do_real_create_context (ClutterBackend *backend,
- CoglDriver driver_id,
- GError **error)
-{
- ClutterBackendClass *klass;
- CoglSwapChain *swap_chain;
- GError *internal_error;
-
- klass = CLUTTER_BACKEND_GET_CLASS (backend);
-
- swap_chain = NULL;
- internal_error = NULL;
-
- CLUTTER_NOTE (BACKEND, "Creating Cogl renderer");
- backend->cogl_renderer = klass->get_renderer (backend, &internal_error);
-
- if (backend->cogl_renderer == NULL)
- goto error;
-
- CLUTTER_NOTE (BACKEND, "Connecting the renderer");
- cogl_renderer_set_driver (backend->cogl_renderer, driver_id);
- if (!cogl_renderer_connect (backend->cogl_renderer, &internal_error))
- goto error;
-
- CLUTTER_NOTE (BACKEND, "Creating Cogl swap chain");
- swap_chain = cogl_swap_chain_new ();
-
- CLUTTER_NOTE (BACKEND, "Creating Cogl display");
- if (klass->get_display != NULL)
- {
- backend->cogl_display = klass->get_display (backend,
- backend->cogl_renderer,
- swap_chain,
- &internal_error);
- }
- else
- {
- CoglOnscreenTemplate *tmpl;
- gboolean res;
-
- tmpl = cogl_onscreen_template_new (swap_chain);
-
- /* XXX: I have some doubts that this is a good design.
- *
- * Conceptually should we be able to check an onscreen_template
- * without more details about the CoglDisplay configuration?
- */
- res = cogl_renderer_check_onscreen_template (backend->cogl_renderer,
- tmpl,
- &internal_error);
-
- if (!res)
- goto error;
-
- backend->cogl_display = cogl_display_new (backend->cogl_renderer, tmpl);
-
- /* the display owns the template */
- cogl_object_unref (tmpl);
- }
-
- if (backend->cogl_display == NULL)
- goto error;
-
- CLUTTER_NOTE (BACKEND, "Setting up the display");
- if (!cogl_display_setup (backend->cogl_display, &internal_error))
- goto error;
-
- CLUTTER_NOTE (BACKEND, "Creating the Cogl context");
- backend->cogl_context = cogl_context_new (backend->cogl_display, &internal_error);
- if (backend->cogl_context == NULL)
- goto error;
-
- /* the display owns the renderer and the swap chain */
- cogl_object_unref (backend->cogl_renderer);
- cogl_object_unref (swap_chain);
-
- return TRUE;
-
-error:
- if (backend->cogl_display != NULL)
- {
- cogl_object_unref (backend->cogl_display);
- backend->cogl_display = NULL;
- }
-
- if (backend->cogl_renderer != NULL)
- {
- cogl_object_unref (backend->cogl_renderer);
- backend->cogl_renderer = NULL;
- }
-
- if (swap_chain != NULL)
- cogl_object_unref (swap_chain);
-
- return FALSE;
-}
-
-static const struct {
- const char *driver_name;
- const char *driver_desc;
- CoglDriver driver_id;
-} all_known_drivers[] = {
- { "gl3", "OpenGL 3.2 core profile", COGL_DRIVER_GL3 },
- { "gl", "OpenGL legacy profile", COGL_DRIVER_GL },
- { "gles2", "OpenGL ES 2.0", COGL_DRIVER_GLES2 },
- { "any", "Default Cogl driver", COGL_DRIVER_ANY },
-};
-
-static const char *allowed_drivers;
-
-static gboolean
-clutter_backend_real_create_context (ClutterBackend *backend,
- GError **error)
-{
- GError *internal_error = NULL;
- const char *drivers_list;
- char **known_drivers;
- gboolean allow_any;
- int i;
-
- if (backend->cogl_context != NULL)
- return TRUE;
-
- if (allowed_drivers == NULL)
- allowed_drivers = CLUTTER_DRIVERS;
-
- allow_any = strstr (allowed_drivers, "*") != NULL;
-
- drivers_list = g_getenv ("CLUTTER_DRIVER");
- if (drivers_list == NULL)
- drivers_list = allowed_drivers;
-
- known_drivers = g_strsplit (drivers_list, ",", 0);
-
- for (i = 0; backend->cogl_context == NULL && known_drivers[i] != NULL; i++)
- {
- const char *driver_name = known_drivers[i];
- gboolean is_any = g_str_equal (driver_name, "*");
- int j;
-
- for (j = 0; j < G_N_ELEMENTS (all_known_drivers); j++)
- {
- if (!allow_any && !is_any && !strstr (driver_name, all_known_drivers[j].driver_name))
- continue;
-
- if ((allow_any && is_any) ||
- (is_any && strstr (allowed_drivers, all_known_drivers[j].driver_name)) ||
- g_str_equal (all_known_drivers[j].driver_name, driver_name))
- {
- CLUTTER_NOTE (BACKEND, "Checking for the %s driver", all_known_drivers[j].driver_desc);
-
- if (clutter_backend_do_real_create_context (backend, all_known_drivers[j].driver_id, &internal_error))
- break;
-
- if (internal_error)
- {
- CLUTTER_NOTE (BACKEND, "Unable to use the %s driver: %s",
- all_known_drivers[j].driver_desc,
- internal_error->message);
- g_clear_error (&internal_error);
- }
- }
- }
- }
-
- g_strfreev (known_drivers);
-
- if (backend->cogl_context == NULL)
- {
- if (internal_error != NULL)
- g_propagate_error (error, internal_error);
- else
- g_set_error_literal (error, CLUTTER_INIT_ERROR,
- CLUTTER_INIT_ERROR_BACKEND,
- "Unable to initialize the Clutter backend: no available drivers found.");
-
- return FALSE;
- }
-
- backend->cogl_source = cogl_glib_source_new (backend->cogl_context, G_PRIORITY_DEFAULT);
- g_source_attach (backend->cogl_source, NULL);
-
- return TRUE;
-}
-
-static ClutterFeatureFlags
-clutter_backend_real_get_features (ClutterBackend *backend)
-{
- ClutterFeatureFlags flags = 0;
-
- if (cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_MULTIPLE_ONSCREEN))
- {
- CLUTTER_NOTE (BACKEND, "Cogl supports multiple onscreen framebuffers");
- flags |= CLUTTER_FEATURE_STAGE_MULTIPLE;
- }
- else
- {
- CLUTTER_NOTE (BACKEND, "Cogl only supports one onscreen framebuffer");
- flags |= CLUTTER_FEATURE_STAGE_STATIC;
- }
-
- if (cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_BUFFERS_EVENT))
- {
- CLUTTER_NOTE (BACKEND, "Cogl supports swap buffers complete events");
- flags |= CLUTTER_FEATURE_SWAP_EVENTS;
- }
-
- return flags;
-}
-
-static ClutterBackend * (* custom_backend_func) (void);
-
-void
-clutter_set_custom_backend_func (ClutterBackend *(* func) (void))
-{
- custom_backend_func = func;
-}
-
-ClutterBackend *
-_clutter_create_backend (void)
-{
- ClutterBackend *retval;
-
- g_return_val_if_fail (custom_backend_func, NULL);
-
- retval = custom_backend_func ();
- if (!retval)
- g_error ("Failed to create custom backend.");
-
- return retval;
-}
-
-static void
-clutter_backend_class_init (ClutterBackendClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- gobject_class->dispose = clutter_backend_dispose;
-
- /**
- * ClutterBackend::resolution-changed:
- * @backend: the #ClutterBackend that emitted the signal
- *
- * The ::resolution-changed signal is emitted each time the font
- * resolutions has been changed through #ClutterSettings.
- *
- * Since: 1.0
- */
- backend_signals[RESOLUTION_CHANGED] =
- g_signal_new (I_("resolution-changed"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (ClutterBackendClass, resolution_changed),
- NULL, NULL, NULL,
- G_TYPE_NONE, 0);
-
- /**
- * ClutterBackend::font-changed:
- * @backend: the #ClutterBackend that emitted the signal
- *
- * The ::font-changed signal is emitted each time the font options
- * have been changed through #ClutterSettings.
- *
- * Since: 1.0
- */
- backend_signals[FONT_CHANGED] =
- g_signal_new (I_("font-changed"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (ClutterBackendClass, font_changed),
- NULL, NULL, NULL,
- G_TYPE_NONE, 0);
-
- /**
- * ClutterBackend::settings-changed:
- * @backend: the #ClutterBackend that emitted the signal
- *
- * The ::settings-changed signal is emitted each time the #ClutterSettings
- * properties have been changed.
- *
- * Since: 1.4
- */
- backend_signals[SETTINGS_CHANGED] =
- g_signal_new (I_("settings-changed"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (ClutterBackendClass, settings_changed),
- NULL, NULL, NULL,
- G_TYPE_NONE, 0);
-
- klass->resolution_changed = clutter_backend_real_resolution_changed;
- klass->font_changed = clutter_backend_real_font_changed;
-
- klass->create_context = clutter_backend_real_create_context;
- klass->get_features = clutter_backend_real_get_features;
-}
-
-static void
-clutter_backend_init (ClutterBackend *self)
-{
- self->units_per_em = -1.0;
- self->units_serial = 1;
-
- self->dummy_onscreen = NULL;
-
- self->fallback_resource_scale = 1.f;
-}
-
-void
-_clutter_backend_add_options (ClutterBackend *backend,
- GOptionGroup *group)
-{
- ClutterBackendClass *klass;
-
- g_assert (CLUTTER_IS_BACKEND (backend));
-
- klass = CLUTTER_BACKEND_GET_CLASS (backend);
- if (klass->add_options)
- klass->add_options (backend, group);
-}
-
-gboolean
-_clutter_backend_pre_parse (ClutterBackend *backend,
- GError **error)
-{
- ClutterBackendClass *klass;
-
- g_assert (CLUTTER_IS_BACKEND (backend));
-
- klass = CLUTTER_BACKEND_GET_CLASS (backend);
- if (klass->pre_parse)
- return klass->pre_parse (backend, error);
-
- return TRUE;
-}
-
-gboolean
-_clutter_backend_post_parse (ClutterBackend *backend,
- GError **error)
-{
- ClutterBackendClass *klass;
-
- g_assert (CLUTTER_IS_BACKEND (backend));
-
- klass = CLUTTER_BACKEND_GET_CLASS (backend);
- if (klass->post_parse)
- return klass->post_parse (backend, error);
-
- return TRUE;
-}
-
-ClutterStageWindow *
-_clutter_backend_create_stage (ClutterBackend *backend,
- ClutterStage *wrapper,
- GError **error)
-{
- ClutterBackendClass *klass;
- ClutterStageWindow *stage_window;
-
- g_assert (CLUTTER_IS_BACKEND (backend));
- g_assert (CLUTTER_IS_STAGE (wrapper));
-
- klass = CLUTTER_BACKEND_GET_CLASS (backend);
- if (klass->create_stage != NULL)
- stage_window = klass->create_stage (backend, wrapper, error);
- else
- stage_window = NULL;
-
- if (stage_window == NULL)
- return NULL;
-
- 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;
-}
-
-gboolean
-_clutter_backend_create_context (ClutterBackend *backend,
- GError **error)
-{
- ClutterBackendClass *klass;
-
- klass = CLUTTER_BACKEND_GET_CLASS (backend);
-
- return klass->create_context (backend, error);
-}
-
-ClutterFeatureFlags
-_clutter_backend_get_features (ClutterBackend *backend)
-{
- ClutterBackendClass *klass;
- GError *error;
-
- g_assert (CLUTTER_IS_BACKEND (backend));
-
- klass = CLUTTER_BACKEND_GET_CLASS (backend);
-
- /* we need to have a context here; so we create the
- * GL context first and the ask for features. if the
- * context already exists this should be a no-op
- */
- error = NULL;
- if (klass->create_context != NULL)
- {
- gboolean res;
-
- res = klass->create_context (backend, &error);
- if (!res)
- {
- if (error)
- {
- g_critical ("Unable to create a context: %s", error->message);
- g_error_free (error);
- }
- else
- g_critical ("Unable to create a context: unknown error");
-
- return 0;
- }
- }
-
- if (klass->get_features)
- return klass->get_features (backend);
-
- return 0;
-}
-
-gfloat
-_clutter_backend_get_units_per_em (ClutterBackend *backend,
- PangoFontDescription *font_desc)
-{
- /* recompute for the font description, but do not cache the result */
- if (font_desc != NULL)
- return get_units_per_em (backend, font_desc);
-
- if (backend->units_per_em < 0)
- backend->units_per_em = get_units_per_em (backend, NULL);
-
- return backend->units_per_em;
-}
-
-/**
- * clutter_get_default_backend:
- *
- * Retrieves the default #ClutterBackend used by Clutter. The
- * #ClutterBackend holds backend-specific configuration options.
- *
- * Return value: (transfer none): the default backend. You should
- * not ref or unref the returned object. Applications should rarely
- * need to use this.
- *
- * Since: 0.4
- */
-ClutterBackend *
-clutter_get_default_backend (void)
-{
- ClutterMainContext *clutter_context;
-
- clutter_context = _clutter_context_get_default ();
-
- return clutter_context->backend;
-}
-
-/**
- * clutter_backend_get_resolution:
- * @backend: a #ClutterBackend
- *
- * Gets the resolution for font handling on the screen.
- *
- * The resolution is a scale factor between points specified in a
- * #PangoFontDescription and cairo units. The default value is 96.0,
- * meaning that a 10 point font will be 13 units
- * high (10 * 96. / 72. = 13.3).
- *
- * Clutter will set the resolution using the current backend when
- * initializing; the resolution is also stored in the
- * #ClutterSettings:font-dpi property.
- *
- * Return value: the current resolution, or -1 if no resolution
- * has been set.
- *
- * Since: 0.4
- */
-gdouble
-clutter_backend_get_resolution (ClutterBackend *backend)
-{
- ClutterSettings *settings;
- gint resolution;
-
- g_return_val_if_fail (CLUTTER_IS_BACKEND (backend), -1.0);
-
- settings = clutter_settings_get_default ();
- g_object_get (settings, "font-dpi", &resolution, NULL);
-
- if (resolution < 0)
- return 96.0;
-
- return resolution / 1024.0;
-}
-
-/**
- * clutter_backend_set_font_options:
- * @backend: a #ClutterBackend
- * @options: Cairo font options for the backend, or %NULL
- *
- * Sets the new font options for @backend. The #ClutterBackend will
- * copy the #cairo_font_options_t.
- *
- * If @options is %NULL, the first following call to
- * clutter_backend_get_font_options() will return the default font
- * options for @backend.
- *
- * This function is intended for actors creating a Pango layout
- * using the PangoCairo API.
- *
- * Since: 0.8
- */
-void
-clutter_backend_set_font_options (ClutterBackend *backend,
- const cairo_font_options_t *options)
-{
- g_return_if_fail (CLUTTER_IS_BACKEND (backend));
-
- if (backend->font_options != options)
- {
- if (backend->font_options)
- cairo_font_options_destroy (backend->font_options);
-
- if (options)
- backend->font_options = cairo_font_options_copy (options);
- else
- backend->font_options = NULL;
-
- g_signal_emit (backend, backend_signals[FONT_CHANGED], 0);
- }
-}
-
-/**
- * clutter_backend_get_font_options:
- * @backend: a #ClutterBackend
- *
- * Retrieves the font options for @backend.
- *
- * Return value: (transfer none): the font options of the #ClutterBackend.
- * The returned #cairo_font_options_t is owned by the backend and should
- * not be modified or freed
- *
- * Since: 0.8
- */
-const cairo_font_options_t *
-clutter_backend_get_font_options (ClutterBackend *backend)
-{
- g_return_val_if_fail (CLUTTER_IS_BACKEND (backend), NULL);
-
- if (G_LIKELY (backend->font_options))
- return backend->font_options;
-
- backend->font_options = cairo_font_options_create ();
-
- cairo_font_options_set_hint_style (backend->font_options, CAIRO_HINT_STYLE_NONE);
- cairo_font_options_set_subpixel_order (backend->font_options, CAIRO_SUBPIXEL_ORDER_DEFAULT);
- cairo_font_options_set_antialias (backend->font_options, CAIRO_ANTIALIAS_DEFAULT);
-
- g_signal_emit (backend, backend_signals[FONT_CHANGED], 0);
-
- return backend->font_options;
-}
-
-gint32
-_clutter_backend_get_units_serial (ClutterBackend *backend)
-{
- return backend->units_serial;
-}
-
-gboolean
-_clutter_backend_translate_event (ClutterBackend *backend,
- gpointer native,
- ClutterEvent *event)
-{
- return CLUTTER_BACKEND_GET_CLASS (backend)->translate_event (backend,
- native,
- event);
-}
-
-/**
- * clutter_backend_get_cogl_context: (skip)
- * @backend: a #ClutterBackend
- *
- * Retrieves the #CoglContext associated with the given clutter
- * @backend. A #CoglContext is required when using some of the
- * experimental 2.0 Cogl API.
- *
- * Since CoglContext is itself experimental API this API should
- * be considered experimental too.
- *
- * This API is not yet supported on OSX because OSX still
- * uses the stub Cogl winsys and the Clutter backend doesn't
- * explicitly create a CoglContext.
- *
- * Return value: (transfer none): The #CoglContext associated with @backend.
- *
- * Since: 1.8
- * Stability: unstable
- */
-CoglContext *
-clutter_backend_get_cogl_context (ClutterBackend *backend)
-{
- return backend->cogl_context;
-}
-
-void
-clutter_set_allowed_drivers (const char *drivers)
-{
- if (_clutter_context_is_initialized ())
- {
- g_warning ("Clutter has already been initialized.\n");
- return;
- }
-
- allowed_drivers = g_strdup (drivers);
-}
-
-/**
- * clutter_backend_get_input_method:
- * @backend: the #CLutterBackend
- *
- * Returns the input method used by Clutter
- *
- * Returns: (transfer none): the input method
- **/
-ClutterInputMethod *
-clutter_backend_get_input_method (ClutterBackend *backend)
-{
- return backend->input_method;
-}
-
-/**
- * clutter_backend_set_input_method:
- * @backend: the #ClutterBackend
- * @method: the input method
- *
- * Sets the input method to be used by Clutter
- **/
-void
-clutter_backend_set_input_method (ClutterBackend *backend,
- ClutterInputMethod *method)
-{
- g_set_object (&backend->input_method, method);
-}
-
-ClutterStageWindow *
-clutter_backend_get_stage_window (ClutterBackend *backend)
-{
- return backend->stage_window;
-}
-
-/**
- * clutter_backend_get_default_seat:
- * @backend: the #ClutterBackend
- *
- * Returns the default seat
- *
- * Returns: (transfer none): the default seat
- **/
-ClutterSeat *
-clutter_backend_get_default_seat (ClutterBackend *backend)
-{
- g_return_val_if_fail (CLUTTER_IS_BACKEND (backend), NULL);
-
- return CLUTTER_BACKEND_GET_CLASS (backend)->get_default_seat (backend);
-}
-
-void
-clutter_backend_set_fallback_resource_scale (ClutterBackend *backend,
- float fallback_resource_scale)
-{
- backend->fallback_resource_scale = fallback_resource_scale;
-}
-
-float
-clutter_backend_get_fallback_resource_scale (ClutterBackend *backend)
-{
- return backend->fallback_resource_scale;
-}
-
-gboolean
-clutter_backend_is_display_server (ClutterBackend *backend)
-{
- return CLUTTER_BACKEND_GET_CLASS (backend)->is_display_server (backend);
-}
-
-void
-clutter_backend_destroy (ClutterBackend *backend)
-{
- g_object_run_dispose (G_OBJECT (backend));
- g_object_unref (backend);
-}
diff --git a/clutter/clutter/clutter-backend.h b/clutter/clutter/clutter-backend.h
deleted file mode 100644
index 570fd96a4..000000000
--- a/clutter/clutter/clutter-backend.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- *
- * Copyright (C) 2006 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 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_BACKEND_H__
-#define __CLUTTER_BACKEND_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <cairo.h>
-#include <pango/pango.h>
-
-#include <cogl/cogl.h>
-
-#include <clutter/clutter-keymap.h>
-#include <clutter/clutter-types.h>
-#include <clutter/clutter-seat.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_BACKEND (clutter_backend_get_type ())
-#define CLUTTER_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BACKEND, ClutterBackend))
-#define CLUTTER_IS_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BACKEND))
-
-/**
- * ClutterBackend:
- *
- * #ClutterBackend is an opaque structure whose
- * members cannot be directly accessed.
- *
- * Since: 0.4
- */
-typedef struct _ClutterBackend ClutterBackend;
-typedef struct _ClutterBackendClass ClutterBackendClass;
-
-CLUTTER_EXPORT
-GType clutter_backend_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterBackend * clutter_get_default_backend (void);
-
-CLUTTER_EXPORT
-gdouble clutter_backend_get_resolution (ClutterBackend *backend);
-
-CLUTTER_EXPORT
-void clutter_backend_set_font_options (ClutterBackend *backend,
- const cairo_font_options_t *options);
-CLUTTER_EXPORT
-const cairo_font_options_t * clutter_backend_get_font_options (ClutterBackend *backend);
-
-CLUTTER_EXPORT
-CoglContext * clutter_backend_get_cogl_context (ClutterBackend *backend);
-
-CLUTTER_EXPORT
-ClutterInputMethod * clutter_backend_get_input_method (ClutterBackend *backend);
-
-CLUTTER_EXPORT
-void clutter_backend_set_input_method (ClutterBackend *backend,
- ClutterInputMethod *method);
-CLUTTER_EXPORT
-ClutterSeat * clutter_backend_get_default_seat (ClutterBackend *backend);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_BACKEND_H__ */
diff --git a/clutter/clutter/clutter-base-types.c b/clutter/clutter/clutter-base-types.c
deleted file mode 100644
index bf8213812..000000000
--- a/clutter/clutter/clutter-base-types.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- *
- * Copyright (C) 2006 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * SECTION:clutter-geometric-types
- * @Title: Base geometric types
- * @Short_Description: Common geometric data types used by Clutter
- *
- * Clutter defines a set of geometric data structures that are commonly used
- * across the whole API.
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-types.h"
-#include "clutter-private.h"
-
-#include <math.h>
-
-#define FLOAT_EPSILON (1e-15)
-
-
-
-/*
- * ClutterMargin
- */
-
-/**
- * clutter_margin_new:
- *
- * Creates a new #ClutterMargin.
- *
- * Return value: (transfer full): a newly allocated #ClutterMargin. Use
- * clutter_margin_free() to free the resources associated with it when
- * done.
- *
- * Since: 1.10
- */
-ClutterMargin *
-clutter_margin_new (void)
-{
- return g_new0 (ClutterMargin, 1);
-}
-
-/**
- * clutter_margin_copy:
- * @margin_: a #ClutterMargin
- *
- * Creates a new #ClutterMargin and copies the contents of @margin_ into
- * the newly created structure.
- *
- * Return value: (transfer full): a copy of the #ClutterMargin.
- *
- * Since: 1.10
- */
-ClutterMargin *
-clutter_margin_copy (const ClutterMargin *margin_)
-{
- if (G_LIKELY (margin_ != NULL))
- return g_memdup2 (margin_, sizeof (ClutterMargin));
-
- return NULL;
-}
-
-/**
- * clutter_margin_free:
- * @margin_: a #ClutterMargin
- *
- * Frees the resources allocated by clutter_margin_new() and
- * clutter_margin_copy().
- *
- * Since: 1.10
- */
-void
-clutter_margin_free (ClutterMargin *margin_)
-{
- if (G_LIKELY (margin_ != NULL))
- g_free (margin_);
-}
-
-G_DEFINE_BOXED_TYPE (ClutterMargin, clutter_margin,
- clutter_margin_copy,
- clutter_margin_free)
diff --git a/clutter/clutter/clutter-bezier.c b/clutter/clutter/clutter-bezier.c
deleted file mode 100644
index 84a10cb67..000000000
--- a/clutter/clutter/clutter-bezier.c
+++ /dev/null
@@ -1,514 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Tomas Frydrych <tf@openedhand.com>
- *
- * Copyright (C) 2007 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "clutter-build-config.h"
-
-#include <glib.h>
-#include <string.h>
-#include "clutter-bezier.h"
-#include "clutter-debug.h"
-
-/*
- * We have some experimental code here to allow for constant velocity
- * movement of actors along the bezier path, this macro enables it.
- */
-#undef CBZ_L2T_INTERPOLATION
-
-/****************************************************************************
- * ClutterBezier -- representation of a cubic bezier curve *
- * (private; a building block for the public bspline object) *
- ****************************************************************************/
-
-/*
- * The t parameter of the bezier is from interval <0,1>, so we can use
- * 14.18 format and special multiplication functions that preserve
- * more of the least significant bits but would overflow if the value
- * is > 1
- */
-#define CBZ_T_Q 18
-#define CBZ_T_ONE (1 << CBZ_T_Q)
-#define CBZ_T_MUL(x,y) ((((x) >> 3) * ((y) >> 3)) >> 12)
-#define CBZ_T_POW2(x) CBZ_T_MUL (x, x)
-#define CBZ_T_POW3(x) CBZ_T_MUL (CBZ_T_POW2 (x), x)
-#define CBZ_T_DIV(x,y) ((((x) << 9)/(y)) << 9)
-
-/*
- * Constants for sampling of the bezier
- */
-#define CBZ_T_SAMPLES 128
-#define CBZ_T_STEP (CBZ_T_ONE / CBZ_T_SAMPLES)
-#define CBZ_L_STEP (CBZ_T_ONE / CBZ_T_SAMPLES)
-
-#define FIXED_BITS (32)
-#define FIXED_Q (FIXED_BITS - 16)
-#define FIXED_FROM_INT(x) ((x) << FIXED_Q)
-
-typedef gint32 _FixedT;
-
-/*
- * This is a private type representing a single cubic bezier
- */
-struct _ClutterBezier
-{
- /*
- * bezier coefficients -- these are calculated using multiplication and
- * addition from integer input, so these are also integers
- */
- gint ax;
- gint bx;
- gint cx;
- gint dx;
-
- gint ay;
- gint by;
- gint cy;
- gint dy;
-
- /* length of the bezier */
- guint length;
-
-#ifdef CBZ_L2T_INTERPOLATION
- /*
- * coefficients for the L -> t bezier; these are calculated from fixed
- * point input, and more specifically numbers that have been normalised
- * to fit <0,1>, so these are also fixed point, and we can used the
- * _FixedT type here.
- */
- _FixedT La;
- _FixedT Lb;
- _FixedT Lc;
- /* _FixedT Ld; == 0 */
-#endif
-};
-
-ClutterBezier *
-_clutter_bezier_new (void)
-{
- return g_new0 (ClutterBezier, 1);
-}
-
-void
-_clutter_bezier_free (ClutterBezier * b)
-{
- if (G_LIKELY (b))
- {
- g_free (b);
- }
-}
-
-ClutterBezier *
-_clutter_bezier_clone_and_move (const ClutterBezier *b, gint x, gint y)
-{
- ClutterBezier * b2 = _clutter_bezier_new ();
- memcpy (b2, b, sizeof (ClutterBezier));
-
- b2->dx += x;
- b2->dy += y;
-
- return b2;
-}
-
-#ifdef CBZ_L2T_INTERPOLATION
-/*
- * L is relative advance along the bezier curve from interval <0,1>
- */
-static _FixedT
-_clutter_bezier_L2t (const ClutterBezier *b, _FixedT L)
-{
- _FixedT t = CBZ_T_MUL (b->La, CBZ_T_POW3(L))
- + CBZ_T_MUL (b->Lb, CBZ_T_POW2(L))
- + CBZ_T_MUL (b->Lc, L);
-
- if (t > CBZ_T_ONE)
- t = CBZ_T_ONE;
- else if (t < 0)
- t = 0;
-
- return t;
-}
-#endif
-
-static gint
-_clutter_bezier_t2x (const ClutterBezier * b, _FixedT t)
-{
- /*
- * NB -- the int coefficients can be at most 8192 for the multiplication
- * to work in this fashion due to the limits of the 14.18 fixed.
- */
- return ((b->ax*CBZ_T_POW3(t) + b->bx*CBZ_T_POW2(t) + b->cx*t) >> CBZ_T_Q)
- + b->dx;
-}
-
-static gint
-_clutter_bezier_t2y (const ClutterBezier * b, _FixedT t)
-{
- /*
- * NB -- the int coefficients can be at most 8192 for the multiplication
- * to work in this fashion due to the limits of the 14.18 fixed.
- */
- return ((b->ay*CBZ_T_POW3(t) + b->by*CBZ_T_POW2(t) + b->cy*t) >> CBZ_T_Q)
- + b->dy;
-}
-
-/*
- * Advances along the bezier to relative length L and returns the coordinances
- * in knot
- */
-void
-_clutter_bezier_advance (const ClutterBezier *b, gint L, ClutterKnot * knot)
-{
-#ifdef CBZ_L2T_INTERPOLATION
- _FixedT t = clutter_bezier_L2t (b, L);
-#else
- _FixedT t = L;
-#endif
-
- knot->x = _clutter_bezier_t2x (b, t);
- knot->y = _clutter_bezier_t2y (b, t);
-
- CLUTTER_NOTE (MISC, "advancing to relative pt %f: t %f, {%d,%d}",
- (double) L / (double) CBZ_T_ONE,
- (double) t / (double) CBZ_T_ONE,
- knot->x, knot->y);
-}
-
-static int
-sqrti (int number)
-{
-#if defined __SSE2__
- /* The GCC built-in with SSE2 (sqrtsd) is up to twice as fast as
- * the pure integer code below. It is also more accurate.
- */
- return __builtin_sqrt (number);
-#else
- /* This is a fixed point implementation of the Quake III sqrt algorithm,
- * described, for example, at
- * http://www.codemaestro.com/reviews/review00000105.html
- *
- * While the original QIII is extremely fast, the use of floating division
- * and multiplication makes it perform very on arm processors without FPU.
- *
- * The key to successfully replacing the floating point operations with
- * fixed point is in the choice of the fixed point format. The QIII
- * algorithm does not calculate the square root, but its reciprocal ('y'
- * below), which is only at the end turned to the inverse value. In order
- * for the algorithm to produce satisfactory results, the reciprocal value
- * must be represented with sufficient precision; the 16.16 we use
- * elsewhere in clutter is not good enough, and 10.22 is used instead.
- */
- _FixedT x;
- uint32_t y_1; /* 10.22 fixed point */
- uint32_t f = 0x600000; /* '1.5' as 10.22 fixed */
-
- union
- {
- float f;
- uint32_t i;
- } flt, flt2;
-
- flt.f = number;
-
- x = FIXED_FROM_INT (number) / 2;
-
- /* The QIII initial estimate */
- flt.i = 0x5f3759df - ( flt.i >> 1 );
-
- /* Now, we convert the float to 10.22 fixed. We exploit the mechanism
- * described at http://www.d6.com/users/checker/pdfs/gdmfp.pdf.
- *
- * We want 22 bit fraction; a single precision float uses 23 bit
- * mantisa, so we only need to add 2^(23-22) (no need for the 1.5
- * multiplier as we are only dealing with positive numbers).
- *
- * Note: we have to use two separate variables here -- for some reason,
- * if we try to use just the flt variable, gcc on ARM optimises the whole
- * addition out, and it all goes pear shape, since without it, the bits
- * in the float will not be correctly aligned.
- */
- flt2.f = flt.f + 2.0;
- flt2.i &= 0x7FFFFF;
-
- /* Now we correct the estimate */
- y_1 = (flt2.i >> 11) * (flt2.i >> 11);
- y_1 = (y_1 >> 8) * (x >> 8);
-
- y_1 = f - y_1;
- flt2.i = (flt2.i >> 11) * (y_1 >> 11);
-
- /* If the original argument is less than 342, we do another
- * iteration to improve precision (for arguments >= 342, the single
- * iteration produces generally better results).
- */
- if (x < 171)
- {
- y_1 = (flt2.i >> 11) * (flt2.i >> 11);
- y_1 = (y_1 >> 8) * (x >> 8);
-
- y_1 = f - y_1;
- flt2.i = (flt2.i >> 11) * (y_1 >> 11);
- }
-
- /* Invert, round and convert from 10.22 to an integer
- * 0x1e3c68 is a magical rounding constant that produces slightly
- * better results than 0x200000.
- */
- return (number * flt2.i + 0x1e3c68) >> 22;
-#endif
-}
-
-void
-_clutter_bezier_init (ClutterBezier *b,
- gint x_0, gint y_0,
- gint x_1, gint y_1,
- gint x_2, gint y_2,
- gint x_3, gint y_3)
-{
- _FixedT t;
- int i;
- int xp = x_0;
- int yp = y_0;
- _FixedT length [CBZ_T_SAMPLES + 1];
-
-#ifdef CBZ_L2T_INTERPOLATION
- int j, k;
- _FixedT L;
- _FixedT t_equalized [CBZ_T_SAMPLES + 1];
-#endif
-
-#if 0
- g_debug ("Initializing bezier at {{%d,%d},{%d,%d},{%d,%d},{%d,%d}}",
- x0, y0, x1, y1, x2, y2, x3, y3);
-#endif
-
- b->dx = x_0;
- b->dy = y_0;
-
- b->cx = 3 * (x_1 - x_0);
- b->cy = 3 * (y_1 - y_0);
-
- b->bx = 3 * (x_2 - x_1) - b->cx;
- b->by = 3 * (y_2 - y_1) - b->cy;
-
- b->ax = x_3 - 3 * x_2 + 3 * x_1 - x_0;
- b->ay = y_3 - 3 * y_2 + 3 * y_1 - y_0;
-
-#if 0
- g_debug ("Cooeficients {{%d,%d},{%d,%d},{%d,%d},{%d,%d}}",
- b->ax, b->ay, b->bx, b->by, b->cx, b->cy, b->dx, b->dy);
-#endif
-
- /*
- * Because of the way we do the multiplication in bezeir_t2x,y
- * these coefficients need to be at most 0x1fff; this should be the case,
- * I think, but have added this warning to catch any problems -- if it
- * triggers, we need to change those two functions a bit.
- */
- if (b->ax > 0x1fff || b->bx > 0x1fff || b->cx > 0x1fff)
- g_warning ("Calculated coefficients will result in multiplication "
- "overflow in clutter_bezier_t2x and clutter_bezier_t2y.");
-
- /*
- * Sample the bezier with CBZ_T_SAMPLES and calculate length at
- * each point.
- *
- * We are working with integers here, so we use the fast sqrti function.
- */
- length[0] = 0;
-
- for (t = CBZ_T_STEP, i = 1; i <= CBZ_T_SAMPLES; ++i, t += CBZ_T_STEP)
- {
- int x = _clutter_bezier_t2x (b, t);
- int y = _clutter_bezier_t2y (b, t);
-
- guint l = sqrti ((y - yp)*(y - yp) + (x - xp)*(x - xp));
-
- l += length[i-1];
-
- length[i] = l;
-
- xp = x;
- yp = y;
- }
-
- b->length = length[CBZ_T_SAMPLES];
-
-#if 0
- g_debug ("length %d", b->length);
-#endif
-
-#ifdef CBZ_L2T_INTERPOLATION
- /*
- * Now normalize the length values, converting them into _FixedT
- */
- for (i = 0; i <= CBZ_T_SAMPLES; ++i)
- {
- length[i] = (length[i] << CBZ_T_Q) / b->length;
- }
-
- /*
- * Now generate a L -> t table such that the L will equidistant
- * over <0,1>
- */
- t_equalized[0] = 0;
-
- for (i = 1, j = 1, L = CBZ_L_STEP; i < CBZ_T_SAMPLES; ++i, L += CBZ_L_STEP)
- {
- _FixedT l1, l2;
- _FixedT d1, d2, d;
- _FixedT t1, t2;
-
- /* find the band for our L */
- for (k = j; k < CBZ_T_SAMPLES; ++k)
- {
- if (L < length[k])
- break;
- }
-
- /*
- * Now we know that L is from (length[k-1],length[k]>
- * We remember k-1 in order not to have to iterate over the
- * whole length array in the next iteration of the main loop
- */
- j = k - 1;
-
- /*
- * Now interpolate equlised t as a weighted average
- */
- l1 = length[k-1];
- l2 = length[k];
- d1 = l2 - L;
- d2 = L - l1;
- d = l2 - l1;
- t1 = (k - 1) * CBZ_T_STEP;
- t2 = k * CBZ_T_STEP;
-
- t_equalized[i] = (t1*d1 + t2*d2)/d;
-
- if (t_equalized[i] < t_equalized[i-1])
- g_debug ("wrong t: L %f, l1 %f, l2 %f, t1 %f, t2 %f",
- (double) (L)/(double)CBZ_T_ONE,
- (double) (l1)/(double)CBZ_T_ONE,
- (double) (l2)/(double)CBZ_T_ONE,
- (double) (t1)/(double)CBZ_T_ONE,
- (double) (t2)/(double)CBZ_T_ONE);
-
- }
-
- t_equalized[CBZ_T_SAMPLES] = CBZ_T_ONE;
-
- /* We now fit a bezier -- at this stage, do a single fit through our values
- * at 0, 1/3, 2/3 and 1
- *
- * FIXME -- do we need to use a better fitting approach to choose the best
- * beziere. The actual curve we acquire this way is not too bad shapwise,
- * but (probably due to rounding errors) the resulting curve no longer
- * satisfies the necessary condition that for L2 > L1, t2 > t1, which
- * causes oscilation.
- */
-
-#if 0
- /*
- * These are the control points we use to calculate the curve coefficients
- * for bezier t(L); these are not needed directly, but are implied in the
- * calculations below.
- *
- * (p0 is 0,0, and p3 is 1,1)
- */
- p1 = (18 * t_equalized[CBZ_T_SAMPLES/3] -
- 9 * t_equalized[2*CBZ_T_SAMPLES/3] +
- 2 << CBZ_T_Q) / 6;
-
- p2 = (18 * t_equalized[2*CBZ_T_SAMPLES/3] -
- 9 * t_equalized[CBZ_T_SAMPLES/3] -
- (5 << CBZ_T_Q)) / 6;
-#endif
-
- b->Lc = (18 * t_equalized[CBZ_T_SAMPLES/3] -
- 9 * t_equalized[2*CBZ_T_SAMPLES/3] +
- (2 << CBZ_T_Q)) >> 1;
-
- b->Lb = (36 * t_equalized[2*CBZ_T_SAMPLES/3] -
- 45 * t_equalized[CBZ_T_SAMPLES/3] -
- (9 << CBZ_T_Q)) >> 1;
-
- b->La = ((27 * (t_equalized[CBZ_T_SAMPLES/3] -
- t_equalized[2*CBZ_T_SAMPLES/3]) +
- (7 << CBZ_T_Q)) >> 1) + CBZ_T_ONE;
-
- g_debug ("t(1/3) %f, t(2/3) %f",
- (double)t_equalized[CBZ_T_SAMPLES/3]/(double)CBZ_T_ONE,
- (double)t_equalized[2*CBZ_T_SAMPLES/3]/(double)CBZ_T_ONE);
-
- g_debug ("L -> t coefficients: %f, %f, %f",
- (double)b->La/(double)CBZ_T_ONE,
- (double)b->Lb/(double)CBZ_T_ONE,
- (double)b->Lc/(double)CBZ_T_ONE);
-
-
- /*
- * For debugging, you can load these values into a spreadsheet and graph
- * them to see how well the approximation matches the data
- */
- for (i = 0; i < CBZ_T_SAMPLES; ++i)
- {
- g_print ("%f, %f, %f\n",
- (double)(i*CBZ_T_STEP)/(double)CBZ_T_ONE,
- (double)(t_equalized[i])/(double)CBZ_T_ONE,
- (double)(clutter_bezier_L2t(b,i*CBZ_T_STEP))/(double)CBZ_T_ONE);
- }
-#endif
-}
-
-/*
- * Moves a control point at indx to location represented by knot
- */
-void
-_clutter_bezier_adjust (ClutterBezier * b, ClutterKnot * knot, guint indx)
-{
- guint x[4], y[4];
-
- g_assert (indx < 4);
-
- x[0] = b->dx;
- y[0] = b->dy;
-
- x[1] = b->cx / 3 + x[0];
- y[1] = b->cy / 3 + y[0];
-
- x[2] = b->bx / 3 + b->cx + x[1];
- y[2] = b->by / 3 + b->cy + y[1];
-
- x[3] = b->ax + x[0] + b->cx + b->bx;
- y[3] = b->ay + y[0] + b->cy + b->by;
-
- x[indx] = knot->x;
- y[indx] = knot->y;
-
- _clutter_bezier_init (b, x[0], y[0], x[1], y[1], x[2], y[2], x[3], y[3]);
-}
-
-guint
-_clutter_bezier_get_length (const ClutterBezier *b)
-{
- return b->length;
-}
diff --git a/clutter/clutter/clutter-bezier.h b/clutter/clutter/clutter-bezier.h
deleted file mode 100644
index a58c589c2..000000000
--- a/clutter/clutter/clutter-bezier.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Tomas Frydrych <tf@openedhand.com>
- *
- * Copyright (C) 2006, 2007 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __CLUTTER_BEZIER_H__
-#define __CLUTTER_BEZIER_H__
-
-#include <glib.h>
-#include "clutter-types.h"
-
-G_BEGIN_DECLS
-
-/* This is used in _clutter_bezier_advance to represent the full
- length of the bezier curve. Anything less than that represents a
- fraction of the length */
-#define CLUTTER_BEZIER_MAX_LENGTH (1 << 18)
-
-typedef struct _ClutterBezier ClutterBezier;
-
-ClutterBezier *_clutter_bezier_new (void);
-
-void _clutter_bezier_free (ClutterBezier * b);
-
-ClutterBezier *_clutter_bezier_clone_and_move (const ClutterBezier *b,
- gint x,
- gint y);
-
-void _clutter_bezier_advance (const ClutterBezier *b,
- gint L,
- ClutterKnot *knot);
-
-void _clutter_bezier_init (ClutterBezier *b,
- gint x_0, gint y_0,
- gint x_1, gint y_1,
- gint x_2, gint y_2,
- gint x_3, gint y_3);
-
-void _clutter_bezier_adjust (ClutterBezier *b,
- ClutterKnot *knot,
- guint indx);
-
-guint _clutter_bezier_get_length (const ClutterBezier *b);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_BEZIER_H__ */
diff --git a/clutter/clutter/clutter-bin-layout.c b/clutter/clutter/clutter-bin-layout.c
deleted file mode 100644
index a17393c48..000000000
--- a/clutter/clutter/clutter-bin-layout.c
+++ /dev/null
@@ -1,698 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2009 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-bin-layout
- * @short_description: A simple layout manager
- *
- * #ClutterBinLayout is a layout manager which implements the following
- * policy:
- *
- * - the preferred size is the maximum preferred size
- * between all the children of the container using the
- * layout;
- * - each child is allocated in "layers", on on top
- * of the other;
- * - for each layer there are horizontal and vertical
- * alignment policies.
- *
- * The [bin-layout example](https://git.gnome.org/browse/clutter/tree/examples/bin-layout.c?h=clutter-1.18)
- * shows how to pack actors inside a #ClutterBinLayout.
- *
- * #ClutterBinLayout is available since Clutter 1.2
- */
-
-#include "clutter-build-config.h"
-
-#include <math.h>
-
-#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
-#include "deprecated/clutter-container.h"
-
-#include "clutter-actor-private.h"
-#include "clutter-animatable.h"
-#include "clutter-bin-layout.h"
-#include "clutter-child-meta.h"
-#include "clutter-debug.h"
-#include "clutter-enum-types.h"
-#include "clutter-layout-meta.h"
-#include "clutter-private.h"
-
-#define CLUTTER_TYPE_BIN_LAYER (clutter_bin_layer_get_type ())
-#define CLUTTER_BIN_LAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BIN_LAYER, ClutterBinLayer))
-#define CLUTTER_IS_BIN_LAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BIN_LAYER))
-
-typedef struct _ClutterBinLayer ClutterBinLayer;
-typedef struct _ClutterLayoutMetaClass ClutterBinLayerClass;
-
-struct _ClutterBinLayoutPrivate
-{
- ClutterBinAlignment x_align;
- ClutterBinAlignment y_align;
-
- ClutterContainer *container;
-};
-
-struct _ClutterBinLayer
-{
- ClutterLayoutMeta parent_instance;
-
- ClutterBinAlignment x_align;
- ClutterBinAlignment y_align;
-};
-
-enum
-{
- PROP_LAYER_0,
-
- PROP_LAYER_X_ALIGN,
- PROP_LAYER_Y_ALIGN,
-
- PROP_LAYER_LAST
-};
-
-enum
-{
- PROP_0,
-
- PROP_X_ALIGN,
- PROP_Y_ALIGN,
-
- PROP_LAST
-};
-
-static GParamSpec *layer_props[PROP_LAYER_LAST] = { NULL, };
-static GParamSpec *bin_props[PROP_LAST] = { NULL, };
-
-GType clutter_bin_layer_get_type (void);
-
-G_DEFINE_TYPE (ClutterBinLayer,
- clutter_bin_layer,
- CLUTTER_TYPE_LAYOUT_META)
-
-G_DEFINE_TYPE_WITH_PRIVATE (ClutterBinLayout,
- clutter_bin_layout,
- CLUTTER_TYPE_LAYOUT_MANAGER)
-
-/*
- * ClutterBinLayer
- */
-
-static void
-set_layer_x_align (ClutterBinLayer *self,
- ClutterBinAlignment alignment)
-{
- ClutterLayoutManager *manager;
- ClutterLayoutMeta *meta;
-
- if (self->x_align == alignment)
- return;
-
- self->x_align = alignment;
-
- meta = CLUTTER_LAYOUT_META (self);
- manager = clutter_layout_meta_get_manager (meta);
- clutter_layout_manager_layout_changed (manager);
-
- g_object_notify_by_pspec (G_OBJECT (self), layer_props[PROP_LAYER_X_ALIGN]);
-}
-
-static void
-set_layer_y_align (ClutterBinLayer *self,
- ClutterBinAlignment alignment)
-{
- ClutterLayoutManager *manager;
- ClutterLayoutMeta *meta;
-
- if (self->y_align == alignment)
- return;
-
- self->y_align = alignment;
-
- meta = CLUTTER_LAYOUT_META (self);
- manager = clutter_layout_meta_get_manager (meta);
- clutter_layout_manager_layout_changed (manager);
-
- g_object_notify_by_pspec (G_OBJECT (self), layer_props[PROP_LAYER_Y_ALIGN]);
-}
-
-static void
-clutter_bin_layer_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterBinLayer *layer = CLUTTER_BIN_LAYER (gobject);
-
- switch (prop_id)
- {
- case PROP_LAYER_X_ALIGN:
- set_layer_x_align (layer, g_value_get_enum (value));
- break;
-
- case PROP_LAYER_Y_ALIGN:
- set_layer_y_align (layer, g_value_get_enum (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_bin_layer_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterBinLayer *layer = CLUTTER_BIN_LAYER (gobject);
-
- switch (prop_id)
- {
- case PROP_LAYER_X_ALIGN:
- g_value_set_enum (value, layer->x_align);
- break;
-
- case PROP_LAYER_Y_ALIGN:
- g_value_set_enum (value, layer->y_align);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_bin_layer_class_init (ClutterBinLayerClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- gobject_class->set_property = clutter_bin_layer_set_property;
- gobject_class->get_property = clutter_bin_layer_get_property;
-
- layer_props[PROP_LAYER_X_ALIGN] =
- g_param_spec_enum ("x-align",
- P_("Horizontal Alignment"),
- P_("Horizontal alignment for the actor "
- "inside the layout manager"),
- CLUTTER_TYPE_BIN_ALIGNMENT,
- CLUTTER_BIN_ALIGNMENT_CENTER,
- CLUTTER_PARAM_READWRITE);
-
- layer_props[PROP_LAYER_Y_ALIGN] =
- g_param_spec_enum ("y-align",
- P_("Vertical Alignment"),
- P_("Vertical alignment for the actor "
- "inside the layout manager"),
- CLUTTER_TYPE_BIN_ALIGNMENT,
- CLUTTER_BIN_ALIGNMENT_CENTER,
- CLUTTER_PARAM_READWRITE);
-
- g_object_class_install_properties (gobject_class,
- PROP_LAYER_LAST,
- layer_props);
-}
-
-static void
-clutter_bin_layer_init (ClutterBinLayer *layer)
-{
- layer->x_align = CLUTTER_BIN_ALIGNMENT_CENTER;
- layer->y_align = CLUTTER_BIN_ALIGNMENT_CENTER;
-}
-
-/*
- * ClutterBinLayout
- */
-
-static void
-set_x_align (ClutterBinLayout *self,
- ClutterBinAlignment alignment)
-{
- ClutterBinLayoutPrivate *priv = self->priv;
-
- if (priv->x_align != alignment)
- {
- ClutterLayoutManager *manager;
-
- priv->x_align = alignment;
-
- manager = CLUTTER_LAYOUT_MANAGER (self);
- clutter_layout_manager_layout_changed (manager);
-
- g_object_notify_by_pspec (G_OBJECT (self), bin_props[PROP_X_ALIGN]);
- }
-}
-
-static void
-set_y_align (ClutterBinLayout *self,
- ClutterBinAlignment alignment)
-{
- ClutterBinLayoutPrivate *priv = self->priv;
-
- if (priv->y_align != alignment)
- {
- ClutterLayoutManager *manager;
-
- priv->y_align = alignment;
-
- manager = CLUTTER_LAYOUT_MANAGER (self);
- clutter_layout_manager_layout_changed (manager);
-
- g_object_notify_by_pspec (G_OBJECT (self), bin_props[PROP_Y_ALIGN]);
- }
-}
-
-static void
-clutter_bin_layout_get_preferred_width (ClutterLayoutManager *manager,
- ClutterContainer *container,
- gfloat for_height,
- gfloat *min_width_p,
- gfloat *nat_width_p)
-{
- ClutterActor *actor = CLUTTER_ACTOR (container);
- ClutterActorIter iter;
- ClutterActor *child;
- gfloat min_width, nat_width;
-
- min_width = nat_width = 0.0;
-
- clutter_actor_iter_init (&iter, actor);
- while (clutter_actor_iter_next (&iter, &child))
- {
- gfloat minimum, natural;
-
- if (!clutter_actor_is_visible (child))
- continue;
-
- clutter_actor_get_preferred_width (child, for_height,
- &minimum,
- &natural);
-
- min_width = MAX (min_width, minimum);
- nat_width = MAX (nat_width, natural);
- }
-
- if (min_width_p)
- *min_width_p = min_width;
-
- if (nat_width_p)
- *nat_width_p = nat_width;
-}
-
-static void
-clutter_bin_layout_get_preferred_height (ClutterLayoutManager *manager,
- ClutterContainer *container,
- gfloat for_width,
- gfloat *min_height_p,
- gfloat *nat_height_p)
-{
- ClutterActor *actor = CLUTTER_ACTOR (container);
- ClutterActorIter iter;
- ClutterActor *child;
- gfloat min_height, nat_height;
-
- min_height = nat_height = 0.0;
-
- clutter_actor_iter_init (&iter, actor);
- while (clutter_actor_iter_next (&iter, &child))
- {
- gfloat minimum, natural;
-
- if (!clutter_actor_is_visible (child))
- continue;
-
- clutter_actor_get_preferred_height (child, for_width,
- &minimum,
- &natural);
-
- min_height = MAX (min_height, minimum);
- nat_height = MAX (nat_height, natural);
- }
-
- if (min_height_p)
- *min_height_p = min_height;
-
- if (nat_height_p)
- *nat_height_p = nat_height;
-}
-
-static gdouble
-get_bin_alignment_factor (ClutterBinAlignment alignment,
- ClutterTextDirection text_dir)
-{
- switch (alignment)
- {
- case CLUTTER_BIN_ALIGNMENT_CENTER:
- return 0.5;
-
- case CLUTTER_BIN_ALIGNMENT_START:
- return text_dir == CLUTTER_TEXT_DIRECTION_LTR ? 0.0 : 1.0;
-
- case CLUTTER_BIN_ALIGNMENT_END:
- return text_dir == CLUTTER_TEXT_DIRECTION_LTR ? 1.0 : 0.0;
-
- case CLUTTER_BIN_ALIGNMENT_FIXED:
- case CLUTTER_BIN_ALIGNMENT_FILL:
- return 0.0;
- }
-
- return 0.0;
-}
-
-static gdouble
-get_actor_align_factor (ClutterActorAlign alignment)
-{
- switch (alignment)
- {
- case CLUTTER_ACTOR_ALIGN_CENTER:
- return 0.5;
-
- case CLUTTER_ACTOR_ALIGN_START:
- return 0.0;
-
- case CLUTTER_ACTOR_ALIGN_END:
- return 1.0;
-
- case CLUTTER_ACTOR_ALIGN_FILL:
- return 0.0;
- }
-
- return 0.0;
-}
-
-static void
-clutter_bin_layout_allocate (ClutterLayoutManager *manager,
- ClutterContainer *container,
- const ClutterActorBox *allocation)
-{
- gfloat allocation_x, allocation_y;
- gfloat available_w, available_h;
- ClutterActor *actor, *child;
- ClutterActorIter iter;
-
- clutter_actor_box_get_origin (allocation, &allocation_x, &allocation_y);
- clutter_actor_box_get_size (allocation, &available_w, &available_h);
-
- actor = CLUTTER_ACTOR (container);
-
- clutter_actor_iter_init (&iter, actor);
- while (clutter_actor_iter_next (&iter, &child))
- {
- ClutterLayoutMeta *meta;
- ClutterBinLayer *layer;
- ClutterActorBox child_alloc = { 0, };
- gdouble x_align, y_align;
- gboolean x_fill, y_fill, is_fixed_position_set;
- float fixed_x, fixed_y;
-
- if (!clutter_actor_is_visible (child))
- continue;
-
- meta = clutter_layout_manager_get_child_meta (manager,
- container,
- child);
- layer = CLUTTER_BIN_LAYER (meta);
-
- fixed_x = fixed_y = 0.f;
- g_object_get (child,
- "fixed-position-set", &is_fixed_position_set,
- "fixed-x", &fixed_x,
- "fixed-y", &fixed_y,
- NULL);
-
- /* XXX:2.0 - remove the FIXED alignment, and just use the fixed position
- * of the actor if one is set
- */
- if (is_fixed_position_set ||
- layer->x_align == CLUTTER_BIN_ALIGNMENT_FIXED)
- {
- if (is_fixed_position_set)
- child_alloc.x1 = fixed_x;
- else
- child_alloc.x1 = clutter_actor_get_x (child);
- }
- else
- child_alloc.x1 = allocation_x;
-
- if (is_fixed_position_set ||
- layer->y_align == CLUTTER_BIN_ALIGNMENT_FIXED)
- {
- if (is_fixed_position_set)
- child_alloc.y1 = fixed_y;
- else
- child_alloc.y1 = clutter_actor_get_y (child);
- }
- else
- child_alloc.y1 = allocation_y;
-
- child_alloc.x2 = allocation_x + available_w;
- child_alloc.y2 = allocation_y + available_h;
-
- if (clutter_actor_needs_expand (child, CLUTTER_ORIENTATION_HORIZONTAL))
- {
- ClutterActorAlign align;
-
- align = clutter_actor_get_x_align (child);
- x_fill = align == CLUTTER_ACTOR_ALIGN_FILL;
- x_align = get_actor_align_factor (align);
- }
- else
- {
- ClutterTextDirection text_dir;
-
- x_fill = (layer->x_align == CLUTTER_BIN_ALIGNMENT_FILL);
-
- text_dir = clutter_actor_get_text_direction (child);
-
- if (!is_fixed_position_set)
- x_align = get_bin_alignment_factor (layer->x_align, text_dir);
- else
- x_align = 0.0;
- }
-
- if (clutter_actor_needs_expand (child, CLUTTER_ORIENTATION_VERTICAL))
- {
- ClutterActorAlign align;
-
- align = clutter_actor_get_y_align (child);
- y_fill = align == CLUTTER_ACTOR_ALIGN_FILL;
- y_align = get_actor_align_factor (align);
- }
- else
- {
- y_fill = (layer->y_align == CLUTTER_BIN_ALIGNMENT_FILL);
-
- if (!is_fixed_position_set)
- y_align = get_bin_alignment_factor (layer->y_align,
- CLUTTER_TEXT_DIRECTION_LTR);
- else
- y_align = 0.0;
- }
-
- clutter_actor_allocate_align_fill (child, &child_alloc,
- x_align, y_align,
- x_fill, y_fill);
- }
-}
-
-static GType
-clutter_bin_layout_get_child_meta_type (ClutterLayoutManager *manager)
-{
- return CLUTTER_TYPE_BIN_LAYER;
-}
-
-static ClutterLayoutMeta *
-clutter_bin_layout_create_child_meta (ClutterLayoutManager *manager,
- ClutterContainer *container,
- ClutterActor *actor)
-{
- ClutterBinLayoutPrivate *priv;
-
- priv = CLUTTER_BIN_LAYOUT (manager)->priv;
-
- return g_object_new (CLUTTER_TYPE_BIN_LAYER,
- "container", container,
- "actor", actor,
- "manager", manager,
- "x-align", priv->x_align,
- "y_align", priv->y_align,
- NULL);
-}
-
-static void
-clutter_bin_layout_set_container (ClutterLayoutManager *manager,
- ClutterContainer *container)
-{
- ClutterBinLayoutPrivate *priv;
- ClutterLayoutManagerClass *parent_class;
-
- priv = CLUTTER_BIN_LAYOUT (manager)->priv;
- priv->container = container;
-
- parent_class = CLUTTER_LAYOUT_MANAGER_CLASS (clutter_bin_layout_parent_class);
- parent_class->set_container (manager, container);
-}
-
-static void
-clutter_bin_layout_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterBinLayout *layout = CLUTTER_BIN_LAYOUT (gobject);
-
- switch (prop_id)
- {
- case PROP_X_ALIGN:
- set_x_align (layout, g_value_get_enum (value));
- break;
-
- case PROP_Y_ALIGN:
- set_y_align (layout, g_value_get_enum (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_bin_layout_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterBinLayoutPrivate *priv;
-
- priv = CLUTTER_BIN_LAYOUT (gobject)->priv;
-
- switch (prop_id)
- {
- case PROP_X_ALIGN:
- g_value_set_enum (value, priv->x_align);
- break;
-
- case PROP_Y_ALIGN:
- g_value_set_enum (value, priv->y_align);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_bin_layout_class_init (ClutterBinLayoutClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- ClutterLayoutManagerClass *layout_class =
- CLUTTER_LAYOUT_MANAGER_CLASS (klass);
-
- /**
- * ClutterBinLayout:x-align:
- *
- * The default horizontal alignment policy for actors managed
- * by the #ClutterBinLayout
- *
- * Since: 1.2
- *
- * Deprecated: 1.12: Use the #ClutterActor:x-expand and the
- * #ClutterActor:x-align properties on #ClutterActor instead.
- */
- bin_props[PROP_X_ALIGN] =
- g_param_spec_enum ("x-align",
- P_("Horizontal Alignment"),
- P_("Default horizontal alignment for the actors "
- "inside the layout manager"),
- CLUTTER_TYPE_BIN_ALIGNMENT,
- CLUTTER_BIN_ALIGNMENT_CENTER,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterBinLayout:y-align:
- *
- * The default vertical alignment policy for actors managed
- * by the #ClutterBinLayout
- *
- * Since: 1.2
- *
- * Deprecated: 1.12: Use the #ClutterActor:y-expand and the
- * #ClutterActor:y-align properties on #ClutterActor instead.
- */
- bin_props[PROP_Y_ALIGN] =
- g_param_spec_enum ("y-align",
- P_("Vertical Alignment"),
- P_("Default vertical alignment for the actors "
- "inside the layout manager"),
- CLUTTER_TYPE_BIN_ALIGNMENT,
- CLUTTER_BIN_ALIGNMENT_CENTER,
- CLUTTER_PARAM_READWRITE);
-
- gobject_class->set_property = clutter_bin_layout_set_property;
- gobject_class->get_property = clutter_bin_layout_get_property;
- g_object_class_install_properties (gobject_class, PROP_LAST, bin_props);
-
- layout_class->get_preferred_width = clutter_bin_layout_get_preferred_width;
- layout_class->get_preferred_height = clutter_bin_layout_get_preferred_height;
- layout_class->allocate = clutter_bin_layout_allocate;
- layout_class->create_child_meta = clutter_bin_layout_create_child_meta;
- layout_class->get_child_meta_type = clutter_bin_layout_get_child_meta_type;
- layout_class->set_container = clutter_bin_layout_set_container;
-}
-
-static void
-clutter_bin_layout_init (ClutterBinLayout *self)
-{
- self->priv = clutter_bin_layout_get_instance_private (self);
-
- self->priv->x_align = CLUTTER_BIN_ALIGNMENT_CENTER;
- self->priv->y_align = CLUTTER_BIN_ALIGNMENT_CENTER;
-}
-
-/**
- * clutter_bin_layout_new:
- * @x_align: the default alignment policy to be used on the
- * horizontal axis
- * @y_align: the default alignment policy to be used on the
- * vertical axis
- *
- * Creates a new #ClutterBinLayout layout manager
- *
- * Return value: the newly created layout manager
- *
- * Since: 1.2
- */
-ClutterLayoutManager *
-clutter_bin_layout_new (ClutterBinAlignment x_align,
- ClutterBinAlignment y_align)
-{
- return g_object_new (CLUTTER_TYPE_BIN_LAYOUT,
- "x-align", x_align,
- "y-align", y_align,
- NULL);
-}
diff --git a/clutter/clutter/clutter-bin-layout.h b/clutter/clutter/clutter-bin-layout.h
deleted file mode 100644
index fa826d628..000000000
--- a/clutter/clutter/clutter-bin-layout.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2009 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_BIN_LAYOUT_H__
-#define __CLUTTER_BIN_LAYOUT_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-layout-manager.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_BIN_LAYOUT (clutter_bin_layout_get_type ())
-#define CLUTTER_BIN_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BIN_LAYOUT, ClutterBinLayout))
-#define CLUTTER_IS_BIN_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BIN_LAYOUT))
-#define CLUTTER_BIN_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BIN_LAYOUT, ClutterBinLayoutClass))
-#define CLUTTER_IS_BIN_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BIN_LAYOUT))
-#define CLUTTER_BIN_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BIN_LAYOUT, ClutterBinLayoutClass))
-
-typedef struct _ClutterBinLayout ClutterBinLayout;
-typedef struct _ClutterBinLayoutPrivate ClutterBinLayoutPrivate;
-typedef struct _ClutterBinLayoutClass ClutterBinLayoutClass;
-
-/**
- * ClutterBinLayout:
- *
- * The #ClutterBinLayout structure contains only private data
- * and should be accessed using the provided API
- *
- * Since: 1.2
- */
-struct _ClutterBinLayout
-{
- /*< private >*/
- ClutterLayoutManager parent_instance;
-
- ClutterBinLayoutPrivate *priv;
-};
-
-/**
- * ClutterBinLayoutClass:
- *
- * The #ClutterBinLayoutClass structure contains only private
- * data and should be accessed using the provided API
- *
- * Since: 1.2
- */
-struct _ClutterBinLayoutClass
-{
- /*< private >*/
- ClutterLayoutManagerClass parent_class;
-};
-
-CLUTTER_EXPORT
-GType clutter_bin_layout_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterLayoutManager * clutter_bin_layout_new (ClutterBinAlignment x_align,
- ClutterBinAlignment y_align);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_BIN_LAYOUT_H__ */
diff --git a/clutter/clutter/clutter-bind-constraint.c b/clutter/clutter/clutter-bind-constraint.c
deleted file mode 100644
index 6a5ab57d2..000000000
--- a/clutter/clutter/clutter-bind-constraint.c
+++ /dev/null
@@ -1,648 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-bind-constraint
- * @Title: ClutterBindConstraint
- * @Short_Description: A constraint binding the position or size of an actor
- *
- * #ClutterBindConstraint is a #ClutterConstraint that binds the
- * position or the size of the #ClutterActor to which it is applied
- * to the the position or the size of another #ClutterActor, or
- * "source".
- *
- * An offset can be applied to the constraint, to avoid overlapping. The offset
- * can also be animated. For instance, the following code will set up three
- * actors to be bound to the same origin:
- *
- * |[<!-- language="C" -->
- * // source
- * rect[0] = clutter_actor_new ();
- * clutter_actor_set_background_color (rect[0], &red_color);
- * clutter_actor_set_position (rect[0], x_pos, y_pos);
- * clutter_actor_set_size (rect[0], 100, 100);
- *
- * // second rectangle
- * rect[1] = clutter_actor_new ();
- * clutter_actor_set_background_color (rect[1], &green_color);
- * clutter_actor_set_size (rect[1], 100, 100);
- * clutter_actor_set_opacity (rect[1], 0);
- *
- * constraint = clutter_bind_constraint_new (rect[0], CLUTTER_BIND_X, 0.0);
- * clutter_actor_add_constraint_with_name (rect[1], "green-x", constraint);
- * constraint = clutter_bind_constraint_new (rect[0], CLUTTER_BIND_Y, 0.0);
- * clutter_actor_add_constraint_with_name (rect[1], "green-y", constraint);
- *
- * // third rectangle
- * rect[2] = clutter_actor_new ();
- * clutter_actor_set_background_color (rect[2], &blue_color);
- * clutter_actor_set_size (rect[2], 100, 100);
- * clutter_actor_set_opacity (rect[2], 0);
- *
- * constraint = clutter_bind_constraint_new (rect[0], CLUTTER_BIND_X, 0.0);
- * clutter_actor_add_constraint_with_name (rect[2], "blue-x", constraint);
- * constraint = clutter_bind_constraint_new (rect[0], CLUTTER_BIND_Y, 0.0);
- * clutter_actor_add_constraint_with_name (rect[2], "blue-y", constraint);
- * ]|
- *
- * The following code animates the second and third rectangles to "expand"
- * them horizontally from underneath the first rectangle:
- *
- * |[<!-- language="C" -->
- * clutter_actor_animate (rect[1], CLUTTER_EASE_OUT_CUBIC, 250,
- * "@constraints.green-x.offset", 100.0,
- * "opacity", 255,
- * NULL);
- * clutter_actor_animate (rect[2], CLUTTER_EASE_OUT_CUBIC, 250,
- * "@constraints.blue-x.offset", 200.0,
- * "opacity", 255,
- * NULL);
- * ]|
- *
- * #ClutterBindConstraint is available since Clutter 1.4
- */
-
-#include "clutter-build-config.h"
-
-#include <math.h>
-
-#include "clutter-bind-constraint.h"
-
-#include "clutter-actor-meta-private.h"
-#include "clutter-actor-private.h"
-#include "clutter-constraint.h"
-#include "clutter-debug.h"
-#include "clutter-enum-types.h"
-#include "clutter-private.h"
-
-#define CLUTTER_BIND_CONSTRAINT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BIND_CONSTRAINT, ClutterBindConstraintClass))
-#define CLUTTER_IS_BIND_CONSTRAINT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BIND_CONSTRAINT))
-#define CLUTTER_BIND_CONSTRAINT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BIND_CONSTRAINT, ClutterBindConstraintClass))
-
-struct _ClutterBindConstraint
-{
- ClutterConstraint parent_instance;
-
- ClutterActor *actor;
- ClutterActor *source;
- ClutterBindCoordinate coordinate;
- gfloat offset;
-};
-
-struct _ClutterBindConstraintClass
-{
- ClutterConstraintClass parent_class;
-};
-
-enum
-{
- PROP_0,
-
- PROP_SOURCE,
- PROP_COORDINATE,
- PROP_OFFSET,
-
- PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST];
-
-G_DEFINE_TYPE (ClutterBindConstraint,
- clutter_bind_constraint,
- CLUTTER_TYPE_CONSTRAINT);
-
-static void
-source_queue_relayout (ClutterActor *source,
- ClutterBindConstraint *bind)
-{
- if (bind->actor != NULL)
- _clutter_actor_queue_only_relayout (bind->actor);
-}
-
-static void
-source_destroyed (ClutterActor *actor,
- ClutterBindConstraint *bind)
-{
- bind->source = NULL;
-}
-
-static void
-clutter_bind_constraint_update_preferred_size (ClutterConstraint *constraint,
- ClutterActor *actor,
- ClutterOrientation direction,
- float for_size,
- float *minimum_size,
- float *natural_size)
-{
- ClutterBindConstraint *bind = CLUTTER_BIND_CONSTRAINT (constraint);
- float source_min, source_nat;
-
- if (bind->source == NULL)
- return;
-
- /* only these bindings affect the preferred size */
- if (!(bind->coordinate == CLUTTER_BIND_WIDTH ||
- bind->coordinate == CLUTTER_BIND_HEIGHT ||
- bind->coordinate == CLUTTER_BIND_SIZE ||
- bind->coordinate == CLUTTER_BIND_ALL))
- return;
-
- if (clutter_actor_contains (bind->source, actor))
- return;
-
- switch (direction)
- {
- case CLUTTER_ORIENTATION_HORIZONTAL:
- if (bind->coordinate != CLUTTER_BIND_HEIGHT)
- {
- clutter_actor_get_preferred_width (bind->source, for_size,
- &source_min,
- &source_nat);
-
- *minimum_size = source_min;
- *natural_size = source_nat;
- }
- break;
-
- case CLUTTER_ORIENTATION_VERTICAL:
- if (bind->coordinate != CLUTTER_BIND_WIDTH)
- {
- clutter_actor_get_preferred_height (bind->source, for_size,
- &source_min,
- &source_nat);
-
- *minimum_size = source_min;
- *natural_size = source_nat;
- }
- break;
- }
-}
-
-static void
-clutter_bind_constraint_update_allocation (ClutterConstraint *constraint,
- ClutterActor *actor,
- ClutterActorBox *allocation)
-{
- 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);
-
- if (bind->source == NULL)
- return;
-
- source_position.x = clutter_actor_get_x (bind->source);
- source_position.y = clutter_actor_get_y (bind->source);
- clutter_actor_get_size (bind->source, &source_width, &source_height);
-
- clutter_actor_box_get_size (allocation, &actor_width, &actor_height);
-
- switch (bind->coordinate)
- {
- case CLUTTER_BIND_X:
- allocation->x1 = source_position.x + bind->offset;
- allocation->x2 = allocation->x1 + actor_width;
- break;
-
- case CLUTTER_BIND_Y:
- allocation->y1 = source_position.y + bind->offset;
- allocation->y2 = allocation->y1 + actor_height;
- break;
-
- case CLUTTER_BIND_POSITION:
- allocation->x1 = source_position.x + bind->offset;
- allocation->y1 = source_position.y + bind->offset;
- allocation->x2 = allocation->x1 + actor_width;
- allocation->y2 = allocation->y1 + actor_height;
- break;
-
- case CLUTTER_BIND_WIDTH:
- allocation->x2 = allocation->x1 + source_width + bind->offset;
- break;
-
- case CLUTTER_BIND_HEIGHT:
- allocation->y2 = allocation->y1 + source_height + bind->offset;
- break;
-
- case CLUTTER_BIND_SIZE:
- allocation->x2 = allocation->x1 + source_width + bind->offset;
- allocation->y2 = allocation->y1 + source_height + bind->offset;
- break;
-
- case CLUTTER_BIND_ALL:
- allocation->x1 = source_position.x + bind->offset;
- allocation->y1 = source_position.y + bind->offset;
- allocation->x2 = allocation->x1 + source_width + bind->offset;
- allocation->y2 = allocation->y1 + source_height + bind->offset;
- break;
-
- default:
- g_assert_not_reached ();
- break;
- }
-
- clutter_actor_box_clamp_to_pixel (allocation);
-}
-
-static void
-clutter_bind_constraint_set_actor (ClutterActorMeta *meta,
- ClutterActor *new_actor)
-{
- ClutterBindConstraint *bind = CLUTTER_BIND_CONSTRAINT (meta);
- ClutterActorMetaClass *parent;
-
- if (new_actor != NULL &&
- bind->source != NULL &&
- clutter_actor_contains (new_actor, bind->source))
- {
- g_warning (G_STRLOC ": The source actor '%s' is contained "
- "by the actor '%s' associated to the constraint "
- "'%s'",
- _clutter_actor_get_debug_name (bind->source),
- _clutter_actor_get_debug_name (new_actor),
- _clutter_actor_meta_get_debug_name (meta));
- return;
- }
-
- /* store the pointer to the actor, for later use */
- bind->actor = new_actor;
-
- parent = CLUTTER_ACTOR_META_CLASS (clutter_bind_constraint_parent_class);
- parent->set_actor (meta, new_actor);
-}
-
-static void
-clutter_bind_constraint_dispose (GObject *gobject)
-{
- ClutterBindConstraint *bind = CLUTTER_BIND_CONSTRAINT (gobject);
-
- if (bind->source != NULL)
- {
- g_signal_handlers_disconnect_by_func (bind->source,
- G_CALLBACK (source_destroyed),
- bind);
- g_signal_handlers_disconnect_by_func (bind->source,
- G_CALLBACK (source_queue_relayout),
- bind);
- bind->source = NULL;
- }
-
- G_OBJECT_CLASS (clutter_bind_constraint_parent_class)->dispose (gobject);
-}
-
-static void
-clutter_bind_constraint_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterBindConstraint *bind = CLUTTER_BIND_CONSTRAINT (gobject);
-
- switch (prop_id)
- {
- case PROP_SOURCE:
- clutter_bind_constraint_set_source (bind, g_value_get_object (value));
- break;
-
- case PROP_COORDINATE:
- clutter_bind_constraint_set_coordinate (bind, g_value_get_enum (value));
- break;
-
- case PROP_OFFSET:
- clutter_bind_constraint_set_offset (bind, g_value_get_float (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_bind_constraint_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterBindConstraint *bind = CLUTTER_BIND_CONSTRAINT (gobject);
-
- switch (prop_id)
- {
- case PROP_SOURCE:
- g_value_set_object (value, bind->source);
- break;
-
- case PROP_COORDINATE:
- g_value_set_enum (value, bind->coordinate);
- break;
-
- case PROP_OFFSET:
- g_value_set_float (value, bind->offset);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_bind_constraint_class_init (ClutterBindConstraintClass *klass)
-{
- ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
- ClutterConstraintClass *constraint_class = CLUTTER_CONSTRAINT_CLASS (klass);
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- gobject_class->set_property = clutter_bind_constraint_set_property;
- gobject_class->get_property = clutter_bind_constraint_get_property;
- gobject_class->dispose = clutter_bind_constraint_dispose;
-
- meta_class->set_actor = clutter_bind_constraint_set_actor;
-
- constraint_class->update_allocation = clutter_bind_constraint_update_allocation;
- constraint_class->update_preferred_size = clutter_bind_constraint_update_preferred_size;
-
- /**
- * ClutterBindConstraint:source:
- *
- * The #ClutterActor used as the source for the binding.
- *
- * The #ClutterActor must not be contained inside the actor associated
- * to the constraint.
- *
- * Since: 1.4
- */
- obj_props[PROP_SOURCE] =
- g_param_spec_object ("source",
- P_("Source"),
- P_("The source of the binding"),
- CLUTTER_TYPE_ACTOR,
- CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);
-
- /**
- * ClutterBindConstraint:coordinate:
- *
- * The coordinate to be bound
- *
- * Since: 1.4
- */
- obj_props[PROP_COORDINATE] =
- g_param_spec_enum ("coordinate",
- P_("Coordinate"),
- P_("The coordinate to bind"),
- CLUTTER_TYPE_BIND_COORDINATE,
- CLUTTER_BIND_X,
- CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);
-
- /**
- * ClutterBindConstraint:offset:
- *
- * The offset, in pixels, to be applied to the binding
- *
- * Since: 1.4
- */
- obj_props[PROP_OFFSET] =
- g_param_spec_float ("offset",
- P_("Offset"),
- P_("The offset in pixels to apply to the binding"),
- -G_MAXFLOAT, G_MAXFLOAT,
- 0.0f,
- CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);
-
- g_object_class_install_properties (gobject_class,
- PROP_LAST,
- obj_props);
-}
-
-static void
-clutter_bind_constraint_init (ClutterBindConstraint *self)
-{
- self->actor = NULL;
- self->source = NULL;
- self->coordinate = CLUTTER_BIND_X;
- self->offset = 0.0f;
-}
-
-/**
- * clutter_bind_constraint_new:
- * @source: (allow-none): the #ClutterActor to use as the source of
- * the binding, or %NULL
- * @coordinate: the coordinate to bind
- * @offset: the offset to apply to the binding, in pixels
- *
- * Creates a new constraint, binding a #ClutterActor's position to
- * the given @coordinate of the position of @source
- *
- * Return value: the newly created #ClutterBindConstraint
- *
- * Since: 1.4
- */
-ClutterConstraint *
-clutter_bind_constraint_new (ClutterActor *source,
- ClutterBindCoordinate coordinate,
- gfloat offset)
-{
- g_return_val_if_fail (source == NULL || CLUTTER_IS_ACTOR (source), NULL);
-
- return g_object_new (CLUTTER_TYPE_BIND_CONSTRAINT,
- "source", source,
- "coordinate", coordinate,
- "offset", offset,
- NULL);
-}
-
-/**
- * clutter_bind_constraint_set_source:
- * @constraint: a #ClutterBindConstraint
- * @source: (allow-none): a #ClutterActor, or %NULL to unset the source
- *
- * Sets the source #ClutterActor for the constraint
- *
- * Since: 1.4
- */
-void
-clutter_bind_constraint_set_source (ClutterBindConstraint *constraint,
- ClutterActor *source)
-{
- ClutterActor *old_source, *actor;
- ClutterActorMeta *meta;
-
- g_return_if_fail (CLUTTER_IS_BIND_CONSTRAINT (constraint));
- g_return_if_fail (source == NULL || CLUTTER_IS_ACTOR (source));
-
- if (constraint->source == source)
- return;
-
- meta = CLUTTER_ACTOR_META (constraint);
- actor = clutter_actor_meta_get_actor (meta);
- if (source != NULL && actor != NULL)
- {
- if (clutter_actor_contains (actor, source))
- {
- g_warning (G_STRLOC ": The source actor '%s' is contained "
- "by the actor '%s' associated to the constraint "
- "'%s'",
- _clutter_actor_get_debug_name (source),
- _clutter_actor_get_debug_name (actor),
- _clutter_actor_meta_get_debug_name (meta));
- return;
- }
- }
-
- old_source = constraint->source;
- if (old_source != NULL)
- {
- g_signal_handlers_disconnect_by_func (old_source,
- G_CALLBACK (source_destroyed),
- constraint);
- g_signal_handlers_disconnect_by_func (old_source,
- G_CALLBACK (source_queue_relayout),
- constraint);
- }
-
- constraint->source = source;
- if (constraint->source != NULL)
- {
- g_signal_connect (constraint->source, "queue-relayout",
- G_CALLBACK (source_queue_relayout),
- constraint);
- g_signal_connect (constraint->source, "destroy",
- G_CALLBACK (source_destroyed),
- constraint);
-
- if (constraint->actor != NULL)
- clutter_actor_queue_relayout (constraint->actor);
- }
-
- g_object_notify_by_pspec (G_OBJECT (constraint), obj_props[PROP_SOURCE]);
-}
-
-/**
- * clutter_bind_constraint_get_source:
- * @constraint: a #ClutterBindConstraint
- *
- * Retrieves the #ClutterActor set using clutter_bind_constraint_set_source()
- *
- * Return value: (transfer none): a pointer to the source actor
- *
- * Since: 1.4
- */
-ClutterActor *
-clutter_bind_constraint_get_source (ClutterBindConstraint *constraint)
-{
- g_return_val_if_fail (CLUTTER_IS_BIND_CONSTRAINT (constraint), NULL);
-
- return constraint->source;
-}
-
-/**
- * clutter_bind_constraint_set_coordinate:
- * @constraint: a #ClutterBindConstraint
- * @coordinate: the coordinate to bind
- *
- * Sets the coordinate to bind in the constraint
- *
- * Since: 1.4
- */
-void
-clutter_bind_constraint_set_coordinate (ClutterBindConstraint *constraint,
- ClutterBindCoordinate coordinate)
-{
- g_return_if_fail (CLUTTER_IS_BIND_CONSTRAINT (constraint));
-
- if (constraint->coordinate == coordinate)
- return;
-
- constraint->coordinate = coordinate;
-
- if (constraint->actor != NULL)
- clutter_actor_queue_relayout (constraint->actor);
-
- g_object_notify_by_pspec (G_OBJECT (constraint), obj_props[PROP_COORDINATE]);
-}
-
-/**
- * clutter_bind_constraint_get_coordinate:
- * @constraint: a #ClutterBindConstraint
- *
- * Retrieves the bound coordinate of the constraint
- *
- * Return value: the bound coordinate
- *
- * Since: 1.4
- */
-ClutterBindCoordinate
-clutter_bind_constraint_get_coordinate (ClutterBindConstraint *constraint)
-{
- g_return_val_if_fail (CLUTTER_IS_BIND_CONSTRAINT (constraint),
- CLUTTER_BIND_X);
-
- return constraint->coordinate;
-}
-
-/**
- * clutter_bind_constraint_set_offset:
- * @constraint: a #ClutterBindConstraint
- * @offset: the offset to apply, in pixels
- *
- * Sets the offset to be applied to the constraint
- *
- * Since: 1.4
- */
-void
-clutter_bind_constraint_set_offset (ClutterBindConstraint *constraint,
- gfloat offset)
-{
- g_return_if_fail (CLUTTER_IS_BIND_CONSTRAINT (constraint));
-
- if (fabs (constraint->offset - offset) < 0.00001f)
- return;
-
- constraint->offset = offset;
-
- if (constraint->actor != NULL)
- clutter_actor_queue_relayout (constraint->actor);
-
- g_object_notify_by_pspec (G_OBJECT (constraint), obj_props[PROP_OFFSET]);
-}
-
-/**
- * clutter_bind_constraint_get_offset:
- * @constraint: a #ClutterBindConstraint
- *
- * Retrieves the offset set using clutter_bind_constraint_set_offset()
- *
- * Return value: the offset, in pixels
- *
- * Since: 1.4
- */
-gfloat
-clutter_bind_constraint_get_offset (ClutterBindConstraint *bind)
-{
- g_return_val_if_fail (CLUTTER_IS_BIND_CONSTRAINT (bind), 0.0);
-
- return bind->offset;
-}
diff --git a/clutter/clutter/clutter-bind-constraint.h b/clutter/clutter/clutter-bind-constraint.h
deleted file mode 100644
index 16bf47899..000000000
--- a/clutter/clutter/clutter-bind-constraint.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_BIND_CONSTRAINT_H__
-#define __CLUTTER_BIND_CONSTRAINT_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-constraint.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_BIND_CONSTRAINT (clutter_bind_constraint_get_type ())
-#define CLUTTER_BIND_CONSTRAINT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BIND_CONSTRAINT, ClutterBindConstraint))
-#define CLUTTER_IS_BIND_CONSTRAINT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BIND_CONSTRAINT))
-
-/**
- * ClutterBindConstraint:
- *
- * #ClutterBindConstraint is an opaque structure
- * whose members cannot be directly accessed
- *
- * Since: 1.4
- */
-typedef struct _ClutterBindConstraint ClutterBindConstraint;
-typedef struct _ClutterBindConstraintClass ClutterBindConstraintClass;
-
-CLUTTER_EXPORT
-GType clutter_bind_constraint_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterConstraint * clutter_bind_constraint_new (ClutterActor *source,
- ClutterBindCoordinate coordinate,
- gfloat offset);
-
-CLUTTER_EXPORT
-void clutter_bind_constraint_set_source (ClutterBindConstraint *constraint,
- ClutterActor *source);
-CLUTTER_EXPORT
-ClutterActor * clutter_bind_constraint_get_source (ClutterBindConstraint *constraint);
-CLUTTER_EXPORT
-void clutter_bind_constraint_set_coordinate (ClutterBindConstraint *constraint,
- ClutterBindCoordinate coordinate);
-CLUTTER_EXPORT
-ClutterBindCoordinate clutter_bind_constraint_get_coordinate (ClutterBindConstraint *constraint);
-CLUTTER_EXPORT
-void clutter_bind_constraint_set_offset (ClutterBindConstraint *constraint,
- gfloat offset);
-CLUTTER_EXPORT
-gfloat clutter_bind_constraint_get_offset (ClutterBindConstraint *constraint);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_BIND_CONSTRAINT_H__ */
diff --git a/clutter/clutter/clutter-binding-pool.c b/clutter/clutter/clutter-binding-pool.c
deleted file mode 100644
index 347ad6d7c..000000000
--- a/clutter/clutter/clutter-binding-pool.c
+++ /dev/null
@@ -1,935 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2008 Intel Corporation.
- *
- * Authored By: Emmanuele Bassi <ebassi@linux.intel.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * SECTION:clutter-binding-pool
- * @short_description: Pool for key bindings
- *
- * #ClutterBindingPool is a data structure holding a set of key bindings.
- * Each key binding associates a key symbol (eventually with modifiers)
- * to an action. A callback function is associated to each action.
- *
- * For a given key symbol and modifier mask combination there can be only one
- * action; for each action there can be only one callback. There can be
- * multiple actions with the same name, and the same callback can be used
- * to handle multiple key bindings.
- *
- * Actors requiring key bindings should create a new #ClutterBindingPool
- * inside their class initialization function and then install actions
- * like this:
- *
- * |[<!-- language="C" -->
- * static void
- * foo_class_init (FooClass *klass)
- * {
- * ClutterBindingPool *binding_pool;
- *
- * binding_pool = clutter_binding_pool_get_for_class (klass);
- *
- * clutter_binding_pool_install_action (binding_pool, "move-up",
- * CLUTTER_Up, 0,
- * G_CALLBACK (foo_action_move_up),
- * NULL, NULL);
- * clutter_binding_pool_install_action (binding_pool, "move-up",
- * CLUTTER_KP_Up, 0,
- * G_CALLBACK (foo_action_move_up),
- * NULL, NULL);
- * }
- * ]|
- *
- * The callback has a signature of:
- *
- * |[<!-- language="C" -->
- * gboolean (* callback) (GObject *instance,
- * const gchar *action_name,
- * guint key_val,
- * ClutterModifierType modifiers,
- * gpointer user_data);
- * ]|
- *
- * The actor should then override the #ClutterActor::key-press-event and
- * use clutter_binding_pool_activate() to match a #ClutterKeyEvent structure
- * to one of the actions:
- *
- * |[<!-- language="C" -->
- * ClutterBindingPool *pool;
- *
- * // retrieve the binding pool for the type of the actor
- * pool = clutter_binding_pool_find (G_OBJECT_TYPE_NAME (actor));
- *
- * // activate any callback matching the key symbol and modifiers
- * // mask of the key event. the returned value can be directly
- * // used to signal that the actor has handled the event.
- * return clutter_binding_pool_activate (pool,
- * key_event->keyval,
- * key_event->modifier_state,
- * G_OBJECT (actor));
- * ]|
- *
- * The clutter_binding_pool_activate() function will return %FALSE if
- * no action for the given key binding was found, if the action was
- * blocked (using clutter_binding_pool_block_action()) or if the
- * key binding handler returned %FALSE.
- *
- * #ClutterBindingPool is available since Clutter 1.0
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-binding-pool.h"
-#include "clutter-debug.h"
-#include "clutter-enum-types.h"
-#include "clutter-marshal.h"
-#include "clutter-private.h"
-
-#define CLUTTER_BINDING_POOL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), CLUTTER_TYPE_BINDING_POOL, ClutterBindingPoolClass))
-#define CLUTTER_IS_BINDING_POOL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CLUTTER_TYPE_BINDING_POOL))
-#define CLUTTER_BINDING_POOL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CLUTTER_TYPE_BINDING_POOL, ClutterBindingPoolClass))
-
-#define BINDING_MOD_MASK ((CLUTTER_SHIFT_MASK | \
- CLUTTER_CONTROL_MASK | \
- CLUTTER_MOD1_MASK | \
- CLUTTER_SUPER_MASK | \
- CLUTTER_HYPER_MASK | \
- CLUTTER_META_MASK) | CLUTTER_RELEASE_MASK)
-
-typedef struct _ClutterBindingEntry ClutterBindingEntry;
-
-static GSList *clutter_binding_pools = NULL;
-static GQuark key_class_bindings = 0;
-
-struct _ClutterBindingPool
-{
- GObject parent_instance;
-
- gchar *name; /* interned string, do not free */
-
- GSList *entries;
- GHashTable *entries_hash;
-};
-
-struct _ClutterBindingPoolClass
-{
- GObjectClass parent_class;
-};
-
-struct _ClutterBindingEntry
-{
- gchar *name; /* interned string, do not free */
-
- guint key_val;
- ClutterModifierType modifiers;
-
- GClosure *closure;
-
- guint is_blocked : 1;
-};
-
-enum
-{
- PROP_0,
-
- PROP_NAME,
-
- PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST];
-
-G_DEFINE_TYPE (ClutterBindingPool, clutter_binding_pool, G_TYPE_OBJECT);
-
-static guint
-binding_entry_hash (gconstpointer v)
-{
- const ClutterBindingEntry *e = v;
- guint h;
-
- h = e->key_val;
- h ^= e->modifiers;
-
- return h;
-}
-
-static gint
-binding_entry_compare (gconstpointer v1,
- gconstpointer v2)
-{
- const ClutterBindingEntry *e1 = v1;
- const ClutterBindingEntry *e2 = v2;
-
- return (e1->key_val == e2->key_val && e1->modifiers == e2->modifiers);
-}
-
-static ClutterBindingEntry *
-binding_entry_new (const gchar *name,
- guint key_val,
- ClutterModifierType modifiers)
-{
- ClutterBindingEntry *entry;
-
- modifiers = modifiers & BINDING_MOD_MASK;
-
- entry = g_new0 (ClutterBindingEntry, 1);
- entry->key_val = key_val;
- entry->modifiers = modifiers;
- entry->name = (gchar *) g_intern_string (name);
- entry->closure = NULL;
- entry->is_blocked = FALSE;
-
- return entry;
-}
-
-static ClutterBindingEntry *
-binding_pool_lookup_entry (ClutterBindingPool *pool,
- guint key_val,
- ClutterModifierType modifiers)
-{
- ClutterBindingEntry lookup_entry = { 0, };
-
- lookup_entry.key_val = key_val;
- lookup_entry.modifiers = modifiers;
-
- return g_hash_table_lookup (pool->entries_hash, &lookup_entry);
-}
-
-static void
-binding_entry_free (gpointer data)
-{
- if (G_LIKELY (data))
- {
- ClutterBindingEntry *entry = data;
-
- g_closure_unref (entry->closure);
-
- g_free (entry);
- }
-}
-
-static void
-clutter_binding_pool_finalize (GObject *gobject)
-{
- ClutterBindingPool *pool = CLUTTER_BINDING_POOL (gobject);
-
- /* remove from the pools */
- clutter_binding_pools = g_slist_remove (clutter_binding_pools, pool);
-
- g_hash_table_destroy (pool->entries_hash);
-
- g_slist_free_full (pool->entries, (GDestroyNotify) binding_entry_free);
-
- G_OBJECT_CLASS (clutter_binding_pool_parent_class)->finalize (gobject);
-}
-
-static void
-clutter_binding_pool_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterBindingPool *pool = CLUTTER_BINDING_POOL (gobject);
-
- switch (prop_id)
- {
- case PROP_NAME:
- pool->name = (gchar *) g_intern_string (g_value_get_string (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_binding_pool_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterBindingPool *pool = CLUTTER_BINDING_POOL (gobject);
-
- switch (prop_id)
- {
- case PROP_NAME:
- g_value_set_string (value, pool->name);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_binding_pool_constructed (GObject *gobject)
-{
- ClutterBindingPool *pool = CLUTTER_BINDING_POOL (gobject);
-
- /* bad monkey! bad, bad monkey! */
- if (G_UNLIKELY (pool->name == NULL))
- g_critical ("No name set for ClutterBindingPool %p", pool);
-
- if (G_OBJECT_CLASS (clutter_binding_pool_parent_class)->constructed)
- G_OBJECT_CLASS (clutter_binding_pool_parent_class)->constructed (gobject);
-}
-
-static void
-clutter_binding_pool_class_init (ClutterBindingPoolClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- gobject_class->constructed = clutter_binding_pool_constructed;
- gobject_class->set_property = clutter_binding_pool_set_property;
- gobject_class->get_property = clutter_binding_pool_get_property;
- gobject_class->finalize = clutter_binding_pool_finalize;
-
- /**
- * ClutterBindingPool:name:
- *
- * The unique name of the #ClutterBindingPool.
- *
- * Since: 1.0
- */
- obj_props[PROP_NAME] =
- g_param_spec_string ("name",
- P_("Name"),
- P_("The unique name of the binding pool"),
- NULL,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY);
-
- g_object_class_install_properties (gobject_class,
- PROP_LAST,
- obj_props);
-}
-
-static void
-clutter_binding_pool_init (ClutterBindingPool *pool)
-{
- pool->name = NULL;
- pool->entries = NULL;
- pool->entries_hash = g_hash_table_new (binding_entry_hash,
- binding_entry_compare);
-
- clutter_binding_pools = g_slist_prepend (clutter_binding_pools, pool);
-}
-
-/**
- * clutter_binding_pool_new:
- * @name: the name of the binding pool
- *
- * Creates a new #ClutterBindingPool that can be used to store
- * key bindings for an actor. The @name must be a unique identifier
- * for the binding pool, so that clutter_binding_pool_find() will
- * be able to return the correct binding pool.
- *
- * Return value: the newly created binding pool with the given
- * name. Use g_object_unref() when done.
- *
- * Since: 1.0
- */
-ClutterBindingPool *
-clutter_binding_pool_new (const gchar *name)
-{
- ClutterBindingPool *pool;
-
- g_return_val_if_fail (name != NULL, NULL);
-
- pool = clutter_binding_pool_find (name);
- if (G_UNLIKELY (pool))
- {
- g_warning ("A binding pool named '%s' is already present "
- "in the binding pools list",
- pool->name);
- return NULL;
- }
-
- return g_object_new (CLUTTER_TYPE_BINDING_POOL, "name", name, NULL);
-}
-
-/**
- * clutter_binding_pool_get_for_class:
- * @klass: a #GObjectClass pointer
- *
- * Retrieves the #ClutterBindingPool for the given #GObject class
- * and, eventually, creates it. This function is a wrapper around
- * clutter_binding_pool_new() and uses the class type name as the
- * unique name for the binding pool.
- *
- * Calling this function multiple times will return the same
- * #ClutterBindingPool.
- *
- * A binding pool for a class can also be retrieved using
- * clutter_binding_pool_find() with the class type name:
- *
- * |[
- * pool = clutter_binding_pool_find (G_OBJECT_TYPE_NAME (instance));
- * ]|
- *
- * Return value: (transfer none): the binding pool for the given class.
- * The returned #ClutterBindingPool is owned by Clutter and should not
- * be freed directly
- *
- * Since: 1.0
- */
-ClutterBindingPool *
-clutter_binding_pool_get_for_class (gpointer klass)
-{
- ClutterBindingPool *pool;
-
- g_return_val_if_fail (G_IS_OBJECT_CLASS (klass), NULL);
-
- if (G_UNLIKELY (key_class_bindings == 0))
- key_class_bindings = g_quark_from_static_string ("clutter-bindings-set");
-
- pool = g_dataset_id_get_data (klass, key_class_bindings);
- if (pool)
- return pool;
-
- pool = clutter_binding_pool_new (G_OBJECT_CLASS_NAME (klass));
- g_dataset_id_set_data_full (klass, key_class_bindings,
- pool,
- g_object_unref);
-
- return pool;
-}
-
-/**
- * clutter_binding_pool_find:
- * @name: the name of the binding pool to find
- *
- * Finds the #ClutterBindingPool with @name.
- *
- * Return value: (transfer none): a pointer to the #ClutterBindingPool, or %NULL
- *
- * Since: 1.0
- */
-ClutterBindingPool *
-clutter_binding_pool_find (const gchar *name)
-{
- GSList *l;
-
- g_return_val_if_fail (name != NULL, NULL);
-
- for (l = clutter_binding_pools; l != NULL; l = l->next)
- {
- ClutterBindingPool *pool = l->data;
-
- if (g_str_equal (pool->name, (gpointer) name))
- return pool;
- }
-
- return NULL;
-}
-
-/**
- * clutter_binding_pool_install_action:
- * @pool: a #ClutterBindingPool
- * @action_name: the name of the action
- * @key_val: key symbol
- * @modifiers: bitmask of modifiers
- * @callback: (type Clutter.BindingActionFunc): function to be called
- * when the action is activated
- * @data: data to be passed to @callback
- * @notify: function to be called when the action is removed
- * from the pool
- *
- * Installs a new action inside a #ClutterBindingPool. The action
- * is bound to @key_val and @modifiers.
- *
- * The same action name can be used for multiple @key_val, @modifiers
- * pairs.
- *
- * When an action has been activated using clutter_binding_pool_activate()
- * the passed @callback will be invoked (with @data).
- *
- * Actions can be blocked with clutter_binding_pool_block_action()
- * and then unblocked using clutter_binding_pool_unblock_action().
- *
- * Since: 1.0
- */
-void
-clutter_binding_pool_install_action (ClutterBindingPool *pool,
- const gchar *action_name,
- guint key_val,
- ClutterModifierType modifiers,
- GCallback callback,
- gpointer data,
- GDestroyNotify notify)
-{
- ClutterBindingEntry *entry;
- GClosure *closure;
-
- g_return_if_fail (pool != NULL);
- g_return_if_fail (action_name != NULL);
- g_return_if_fail (key_val != 0);
- g_return_if_fail (callback != NULL);
-
- entry = binding_pool_lookup_entry (pool, key_val, modifiers);
- if (G_UNLIKELY (entry))
- {
- g_warning ("There already is an action '%s' for the given "
- "key symbol of %d (modifiers: %d) installed inside "
- "the binding pool.",
- entry->name,
- entry->key_val, entry->modifiers);
- return;
- }
- else
- entry = binding_entry_new (action_name, key_val, modifiers);
-
- closure = g_cclosure_new (callback, data, (GClosureNotify) notify);
- entry->closure = g_closure_ref (closure);
- g_closure_sink (closure);
-
- if (G_CLOSURE_NEEDS_MARSHAL (closure))
- {
- GClosureMarshal marshal;
-
- marshal = _clutter_marshal_BOOLEAN__STRING_UINT_FLAGS;
- g_closure_set_marshal (closure, marshal);
- }
-
- pool->entries = g_slist_prepend (pool->entries, entry);
- g_hash_table_insert (pool->entries_hash, entry, entry);
-}
-
-/**
- * clutter_binding_pool_install_closure:
- * @pool: a #ClutterBindingPool
- * @action_name: the name of the action
- * @key_val: key symbol
- * @modifiers: bitmask of modifiers
- * @closure: a #GClosure
- *
- * A #GClosure variant of clutter_binding_pool_install_action().
- *
- * Installs a new action inside a #ClutterBindingPool. The action
- * is bound to @key_val and @modifiers.
- *
- * The same action name can be used for multiple @key_val, @modifiers
- * pairs.
- *
- * When an action has been activated using clutter_binding_pool_activate()
- * the passed @closure will be invoked.
- *
- * Actions can be blocked with clutter_binding_pool_block_action()
- * and then unblocked using clutter_binding_pool_unblock_action().
- *
- * Since: 1.0
- */
-void
-clutter_binding_pool_install_closure (ClutterBindingPool *pool,
- const gchar *action_name,
- guint key_val,
- ClutterModifierType modifiers,
- GClosure *closure)
-{
- ClutterBindingEntry *entry;
-
- g_return_if_fail (pool != NULL);
- g_return_if_fail (action_name != NULL);
- g_return_if_fail (key_val != 0);
- g_return_if_fail (closure != NULL);
-
- entry = binding_pool_lookup_entry (pool, key_val, modifiers);
- if (G_UNLIKELY (entry))
- {
- g_warning ("There already is an action '%s' for the given "
- "key symbol of %d (modifiers: %d) installed inside "
- "the binding pool.",
- entry->name,
- entry->key_val, entry->modifiers);
- return;
- }
- else
- entry = binding_entry_new (action_name, key_val, modifiers);
-
- entry->closure = g_closure_ref (closure);
- g_closure_sink (closure);
-
- if (G_CLOSURE_NEEDS_MARSHAL (closure))
- {
- GClosureMarshal marshal;
-
- marshal = _clutter_marshal_BOOLEAN__STRING_UINT_FLAGS;
- g_closure_set_marshal (closure, marshal);
- }
-
- pool->entries = g_slist_prepend (pool->entries, entry);
- g_hash_table_insert (pool->entries_hash, entry, entry);
-}
-
-/**
- * clutter_binding_pool_override_action:
- * @pool: a #ClutterBindingPool
- * @key_val: key symbol
- * @modifiers: bitmask of modifiers
- * @callback: function to be called when the action is activated
- * @data: data to be passed to @callback
- * @notify: function to be called when the action is removed
- * from the pool
- *
- * Allows overriding the action for @key_val and @modifiers inside a
- * #ClutterBindingPool. See clutter_binding_pool_install_action().
- *
- * When an action has been activated using clutter_binding_pool_activate()
- * the passed @callback will be invoked (with @data).
- *
- * Actions can be blocked with clutter_binding_pool_block_action()
- * and then unblocked using clutter_binding_pool_unblock_action().
- *
- * Since: 1.0
- */
-void
-clutter_binding_pool_override_action (ClutterBindingPool *pool,
- guint key_val,
- ClutterModifierType modifiers,
- GCallback callback,
- gpointer data,
- GDestroyNotify notify)
-{
- ClutterBindingEntry *entry;
- GClosure *closure;
-
- g_return_if_fail (pool != NULL);
- g_return_if_fail (key_val != 0);
- g_return_if_fail (callback != NULL);
-
- entry = binding_pool_lookup_entry (pool, key_val, modifiers);
- if (G_UNLIKELY (entry == NULL))
- {
- g_warning ("There is no action for the given key symbol "
- "of %d (modifiers: %d) installed inside the "
- "binding pool.",
- key_val, modifiers);
- return;
- }
-
- if (entry->closure)
- {
- g_closure_unref (entry->closure);
- entry->closure = NULL;
- }
-
- closure = g_cclosure_new (callback, data, (GClosureNotify) notify);
- entry->closure = g_closure_ref (closure);
- g_closure_sink (closure);
-
- if (G_CLOSURE_NEEDS_MARSHAL (closure))
- {
- GClosureMarshal marshal;
-
- marshal = _clutter_marshal_BOOLEAN__STRING_UINT_FLAGS;
- g_closure_set_marshal (closure, marshal);
- }
-}
-
-/**
- * clutter_binding_pool_override_closure:
- * @pool: a #ClutterBindingPool
- * @key_val: key symbol
- * @modifiers: bitmask of modifiers
- * @closure: a #GClosure
- *
- * A #GClosure variant of clutter_binding_pool_override_action().
- *
- * Allows overriding the action for @key_val and @modifiers inside a
- * #ClutterBindingPool. See clutter_binding_pool_install_closure().
- *
- * When an action has been activated using clutter_binding_pool_activate()
- * the passed @callback will be invoked (with @data).
- *
- * Actions can be blocked with clutter_binding_pool_block_action()
- * and then unblocked using clutter_binding_pool_unblock_action().
- *
- * Since: 1.0
- */
-void
-clutter_binding_pool_override_closure (ClutterBindingPool *pool,
- guint key_val,
- ClutterModifierType modifiers,
- GClosure *closure)
-{
- ClutterBindingEntry *entry;
-
- g_return_if_fail (pool != NULL);
- g_return_if_fail (key_val != 0);
- g_return_if_fail (closure != NULL);
-
- entry = binding_pool_lookup_entry (pool, key_val, modifiers);
- if (G_UNLIKELY (entry == NULL))
- {
- g_warning ("There is no action for the given key symbol "
- "of %d (modifiers: %d) installed inside the "
- "binding pool.",
- key_val, modifiers);
- return;
- }
-
- if (entry->closure)
- {
- g_closure_unref (entry->closure);
- entry->closure = NULL;
- }
-
- entry->closure = g_closure_ref (closure);
- g_closure_sink (closure);
-
- if (G_CLOSURE_NEEDS_MARSHAL (closure))
- {
- GClosureMarshal marshal;
-
- marshal = _clutter_marshal_BOOLEAN__STRING_UINT_FLAGS;
- g_closure_set_marshal (closure, marshal);
- }
-}
-
-/**
- * clutter_binding_pool_find_action:
- * @pool: a #ClutterBindingPool
- * @key_val: a key symbol
- * @modifiers: a bitmask for the modifiers
- *
- * Retrieves the name of the action matching the given key symbol
- * and modifiers bitmask.
- *
- * Return value: the name of the action, if found, or %NULL. The
- * returned string is owned by the binding pool and should never
- * be modified or freed
- *
- * Since: 1.0
- */
-const gchar *
-clutter_binding_pool_find_action (ClutterBindingPool *pool,
- guint key_val,
- ClutterModifierType modifiers)
-{
- ClutterBindingEntry *entry;
-
- g_return_val_if_fail (pool != NULL, NULL);
- g_return_val_if_fail (key_val != 0, NULL);
-
- entry = binding_pool_lookup_entry (pool, key_val, modifiers);
- if (!entry)
- return NULL;
-
- return entry->name;
-}
-
-/**
- * clutter_binding_pool_remove_action:
- * @pool: a #ClutterBindingPool
- * @key_val: a key symbol
- * @modifiers: a bitmask for the modifiers
- *
- * Removes the action matching the given @key_val, @modifiers pair,
- * if any exists.
- *
- * Since: 1.0
- */
-void
-clutter_binding_pool_remove_action (ClutterBindingPool *pool,
- guint key_val,
- ClutterModifierType modifiers)
-{
- ClutterBindingEntry remove_entry = { 0, };
- GSList *l;
-
- g_return_if_fail (pool != NULL);
- g_return_if_fail (key_val != 0);
-
- modifiers = modifiers & BINDING_MOD_MASK;
-
- remove_entry.key_val = key_val;
- remove_entry.modifiers = modifiers;
-
- for (l = pool->entries; l != NULL; l = l->data)
- {
- ClutterBindingEntry *e = l->data;
-
- if (e->key_val == remove_entry.key_val &&
- e->modifiers == remove_entry.modifiers)
- {
- pool->entries = g_slist_remove_link (pool->entries, l);
- break;
- }
- }
-
- g_hash_table_remove (pool->entries_hash, &remove_entry);
-}
-
-static gboolean
-clutter_binding_entry_invoke (ClutterBindingEntry *entry,
- GObject *gobject)
-{
- GValue params[4] = {
- G_VALUE_INIT,
- G_VALUE_INIT,
- G_VALUE_INIT,
- G_VALUE_INIT
- };
- GValue result = G_VALUE_INIT;
- gboolean retval = TRUE;
-
- g_value_init (&params[0], G_TYPE_OBJECT);
- g_value_set_object (&params[0], gobject);
-
- g_value_init (&params[1], G_TYPE_STRING);
- g_value_set_static_string (&params[1], entry->name);
-
- g_value_init (&params[2], G_TYPE_UINT);
- g_value_set_uint (&params[2], entry->key_val);
-
- g_value_init (&params[3], CLUTTER_TYPE_MODIFIER_TYPE);
- g_value_set_flags (&params[3], entry->modifiers);
-
- g_value_init (&result, G_TYPE_BOOLEAN);
-
- g_closure_invoke (entry->closure, &result, 4, params, NULL);
-
- retval = g_value_get_boolean (&result);
-
- g_value_unset (&result);
-
- g_value_unset (&params[0]);
- g_value_unset (&params[1]);
- g_value_unset (&params[2]);
- g_value_unset (&params[3]);
-
- return retval;
-}
-
-/**
- * clutter_binding_pool_activate:
- * @pool: a #ClutterBindingPool
- * @key_val: the key symbol
- * @modifiers: bitmask for the modifiers
- * @gobject: a #GObject
- *
- * Activates the callback associated to the action that is
- * bound to the @key_val and @modifiers pair.
- *
- * The callback has the following signature:
- *
- * |[
- * void (* callback) (GObject *gobject,
- * const gchar *action_name,
- * guint key_val,
- * ClutterModifierType modifiers,
- * gpointer user_data);
- * ]|
- *
- * Where the #GObject instance is @gobject and the user data
- * is the one passed when installing the action with
- * clutter_binding_pool_install_action().
- *
- * If the action bound to the @key_val, @modifiers pair has been
- * blocked using clutter_binding_pool_block_action(), the callback
- * will not be invoked, and this function will return %FALSE.
- *
- * Return value: %TRUE if an action was found and was activated
- *
- * Since: 1.0
- */
-gboolean
-clutter_binding_pool_activate (ClutterBindingPool *pool,
- guint key_val,
- ClutterModifierType modifiers,
- GObject *gobject)
-{
- ClutterBindingEntry *entry = NULL;
-
- g_return_val_if_fail (pool != NULL, FALSE);
- g_return_val_if_fail (key_val != 0, FALSE);
- g_return_val_if_fail (G_IS_OBJECT (gobject), FALSE);
-
- modifiers = (modifiers & BINDING_MOD_MASK);
-
- entry = binding_pool_lookup_entry (pool, key_val, modifiers);
- if (!entry)
- return FALSE;
-
- if (!entry->is_blocked)
- return clutter_binding_entry_invoke (entry, gobject);
-
- return FALSE;
-}
-
-/**
- * clutter_binding_pool_block_action:
- * @pool: a #ClutterBindingPool
- * @action_name: an action name
- *
- * Blocks all the actions with name @action_name inside @pool.
- *
- * Since: 1.0
- */
-void
-clutter_binding_pool_block_action (ClutterBindingPool *pool,
- const gchar *action_name)
-{
- GSList *l;
-
- g_return_if_fail (pool != NULL);
- g_return_if_fail (action_name != NULL);
-
- for (l = pool->entries; l != NULL; l = l->next)
- {
- ClutterBindingEntry *entry = l->data;
-
- if (g_str_equal (entry->name, (gpointer) action_name))
- entry->is_blocked = TRUE;
- }
-}
-
-/**
- * clutter_binding_pool_unblock_action:
- * @pool: a #ClutterBindingPool
- * @action_name: an action name
- *
- * Unblockes all the actions with name @action_name inside @pool.
- *
- * Unblocking an action does not cause the callback bound to it to
- * be invoked in case clutter_binding_pool_activate() was called on
- * an action previously blocked with clutter_binding_pool_block_action().
- *
- * Since: 1.0
- */
-void
-clutter_binding_pool_unblock_action (ClutterBindingPool *pool,
- const gchar *action_name)
-{
- GSList *l;
-
- g_return_if_fail (pool != NULL);
- g_return_if_fail (action_name != NULL);
-
- for (l = pool->entries; l != NULL; l = l->next)
- {
- ClutterBindingEntry *entry = l->data;
-
- if (g_str_equal (entry->name, (gpointer) action_name))
- entry->is_blocked = FALSE;
- }
-}
diff --git a/clutter/clutter/clutter-binding-pool.h b/clutter/clutter/clutter-binding-pool.h
deleted file mode 100644
index dcf771d24..000000000
--- a/clutter/clutter/clutter-binding-pool.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2008 Intel Corporation.
- *
- * Authored By: Emmanuele Bassi <ebassi@linux.intel.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __CLUTTER_BINDING_POOL_H__
-#define __CLUTTER_BINDING_POOL_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <glib-object.h>
-#include <clutter/clutter-event.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_BINDING_POOL (clutter_binding_pool_get_type ())
-#define CLUTTER_BINDING_POOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BINDING_POOL, ClutterBindingPool))
-#define CLUTTER_IS_BINDING_POOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BINDING_POOL))
-
-/**
- * ClutterBindingPool:
- *
- * Container of key bindings. The #ClutterBindingPool struct is
- * private.
- *
- * Since: 1.0
- */
-typedef struct _ClutterBindingPool ClutterBindingPool;
-typedef struct _ClutterBindingPoolClass ClutterBindingPoolClass;
-
-/**
- * ClutterBindingActionFunc:
- * @gobject: a #GObject
- * @action_name: the name of the action
- * @key_val: the key symbol
- * @modifiers: bitmask of the modifier flags
- * @user_data: data passed to the function
- *
- * The prototype for the callback function registered with
- * clutter_binding_pool_install_action() and invoked by
- * clutter_binding_pool_activate().
- *
- * Return value: the function should return %TRUE if the key
- * binding has been handled, and return %FALSE otherwise
- *
- * Since: 1.0
- */
-typedef gboolean (* ClutterBindingActionFunc) (GObject *gobject,
- const gchar *action_name,
- guint key_val,
- ClutterModifierType modifiers,
- gpointer user_data);
-
-CLUTTER_EXPORT
-GType clutter_binding_pool_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterBindingPool * clutter_binding_pool_new (const gchar *name);
-CLUTTER_EXPORT
-ClutterBindingPool * clutter_binding_pool_get_for_class (gpointer klass);
-CLUTTER_EXPORT
-ClutterBindingPool * clutter_binding_pool_find (const gchar *name);
-
-CLUTTER_EXPORT
-void clutter_binding_pool_install_action (ClutterBindingPool *pool,
- const gchar *action_name,
- guint key_val,
- ClutterModifierType modifiers,
- GCallback callback,
- gpointer data,
- GDestroyNotify notify);
-CLUTTER_EXPORT
-void clutter_binding_pool_install_closure (ClutterBindingPool *pool,
- const gchar *action_name,
- guint key_val,
- ClutterModifierType modifiers,
- GClosure *closure);
-CLUTTER_EXPORT
-void clutter_binding_pool_override_action (ClutterBindingPool *pool,
- guint key_val,
- ClutterModifierType modifiers,
- GCallback callback,
- gpointer data,
- GDestroyNotify notify);
-CLUTTER_EXPORT
-void clutter_binding_pool_override_closure (ClutterBindingPool *pool,
- guint key_val,
- ClutterModifierType modifiers,
- GClosure *closure);
-
-CLUTTER_EXPORT
-const gchar * clutter_binding_pool_find_action (ClutterBindingPool *pool,
- guint key_val,
- ClutterModifierType modifiers);
-CLUTTER_EXPORT
-void clutter_binding_pool_remove_action (ClutterBindingPool *pool,
- guint key_val,
- ClutterModifierType modifiers);
-
-CLUTTER_EXPORT
-gboolean clutter_binding_pool_activate (ClutterBindingPool *pool,
- guint key_val,
- ClutterModifierType modifiers,
- GObject *gobject);
-
-CLUTTER_EXPORT
-void clutter_binding_pool_block_action (ClutterBindingPool *pool,
- const gchar *action_name);
-CLUTTER_EXPORT
-void clutter_binding_pool_unblock_action (ClutterBindingPool *pool,
- const gchar *action_name);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_BINDING_POOL_H__ */
diff --git a/clutter/clutter/clutter-blur-effect.c b/clutter/clutter/clutter-blur-effect.c
deleted file mode 100644
index d3e7ddca6..000000000
--- a/clutter/clutter/clutter-blur-effect.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-blur-effect
- * @short_description: A blur effect
- * @see_also: #ClutterEffect, #ClutterOffscreenEffect
- *
- * #ClutterBlurEffect is a sub-class of #ClutterEffect that allows blurring a
- * actor and its contents.
- *
- * #ClutterBlurEffect is available since Clutter 1.4
- */
-
-#define CLUTTER_BLUR_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BLUR_EFFECT, ClutterBlurEffectClass))
-#define CLUTTER_IS_BLUR_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BLUR_EFFECT))
-#define CLUTTER_BLUR_EFFECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BLUR_EFFECT, ClutterBlurEffectClass))
-
-#include "clutter-build-config.h"
-
-#include "clutter-blur-effect.h"
-
-#include "cogl/cogl.h"
-
-#include "clutter-debug.h"
-#include "clutter-offscreen-effect.h"
-#include "clutter-private.h"
-
-#define BLUR_PADDING 2
-
-/* FIXME - lame shader; we should really have a decoupled
- * horizontal/vertical two pass shader for the gaussian blur
- */
-static const gchar *box_blur_glsl_declarations =
-"uniform vec2 pixel_step;\n";
-#define SAMPLE(offx, offy) \
- "cogl_texel += texture2D (cogl_sampler, cogl_tex_coord.st + pixel_step * " \
- "vec2 (" G_STRINGIFY (offx) ", " G_STRINGIFY (offy) "));\n"
-static const gchar *box_blur_glsl_shader =
-" cogl_texel = texture2D (cogl_sampler, cogl_tex_coord.st);\n"
- SAMPLE (-1.0, -1.0)
- SAMPLE ( 0.0, -1.0)
- SAMPLE (+1.0, -1.0)
- SAMPLE (-1.0, 0.0)
- SAMPLE (+1.0, 0.0)
- SAMPLE (-1.0, +1.0)
- SAMPLE ( 0.0, +1.0)
- SAMPLE (+1.0, +1.0)
-" cogl_texel /= 9.0;\n";
-#undef SAMPLE
-
-struct _ClutterBlurEffect
-{
- ClutterOffscreenEffect parent_instance;
-
- /* a back pointer to our actor, so that we can query it */
- ClutterActor *actor;
-
- gint pixel_step_uniform;
-
- CoglPipeline *pipeline;
-};
-
-struct _ClutterBlurEffectClass
-{
- ClutterOffscreenEffectClass parent_class;
-
- CoglPipeline *base_pipeline;
-};
-
-G_DEFINE_TYPE (ClutterBlurEffect,
- clutter_blur_effect,
- CLUTTER_TYPE_OFFSCREEN_EFFECT);
-
-static CoglPipeline *
-clutter_blur_effect_create_pipeline (ClutterOffscreenEffect *effect,
- CoglTexture *texture)
-{
- ClutterBlurEffect *blur_effect = CLUTTER_BLUR_EFFECT (effect);
-
- if (blur_effect->pixel_step_uniform > -1)
- {
- float pixel_step[2];
- int tex_width, tex_height;
-
- tex_width = cogl_texture_get_width (texture);
- tex_height = cogl_texture_get_height (texture);
-
- pixel_step[0] = 1.0f / tex_width;
- pixel_step[1] = 1.0f / tex_height;
-
- cogl_pipeline_set_uniform_float (blur_effect->pipeline,
- blur_effect->pixel_step_uniform,
- 2, /* n_components */
- 1, /* count */
- pixel_step);
- }
-
- cogl_pipeline_set_layer_texture (blur_effect->pipeline, 0, texture);
-
- return cogl_object_ref (blur_effect->pipeline);
-}
-
-static gboolean
-clutter_blur_effect_pre_paint (ClutterEffect *effect,
- ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- ClutterEffectClass *parent_class;
-
- if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
- {
- /* if we don't have support for GLSL shaders then we
- * forcibly disable the ActorMeta
- */
- g_warning ("Unable to use the ShaderEffect: the graphics hardware "
- "or the current GL driver does not implement support "
- "for the GLSL shading language.");
- clutter_actor_meta_set_enabled (CLUTTER_ACTOR_META (effect), FALSE);
- return FALSE;
- }
-
- parent_class = CLUTTER_EFFECT_CLASS (clutter_blur_effect_parent_class);
- return parent_class->pre_paint (effect, node, paint_context);
-}
-
-static gboolean
-clutter_blur_effect_modify_paint_volume (ClutterEffect *effect,
- ClutterPaintVolume *volume)
-{
- gfloat cur_width, cur_height;
- graphene_point3d_t origin;
-
- clutter_paint_volume_get_origin (volume, &origin);
- cur_width = clutter_paint_volume_get_width (volume);
- cur_height = clutter_paint_volume_get_height (volume);
-
- origin.x -= BLUR_PADDING;
- origin.y -= BLUR_PADDING;
- cur_width += 2 * BLUR_PADDING;
- cur_height += 2 * BLUR_PADDING;
- clutter_paint_volume_set_origin (volume, &origin);
- clutter_paint_volume_set_width (volume, cur_width);
- clutter_paint_volume_set_height (volume, cur_height);
-
- return TRUE;
-}
-
-static void
-clutter_blur_effect_dispose (GObject *gobject)
-{
- ClutterBlurEffect *self = CLUTTER_BLUR_EFFECT (gobject);
-
- if (self->pipeline != NULL)
- {
- cogl_object_unref (self->pipeline);
- self->pipeline = NULL;
- }
-
- G_OBJECT_CLASS (clutter_blur_effect_parent_class)->dispose (gobject);
-}
-
-static void
-clutter_blur_effect_class_init (ClutterBlurEffectClass *klass)
-{
- ClutterEffectClass *effect_class = CLUTTER_EFFECT_CLASS (klass);
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- ClutterOffscreenEffectClass *offscreen_class;
-
- 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;
-
- offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass);
- offscreen_class->create_pipeline = clutter_blur_effect_create_pipeline;
-}
-
-static void
-clutter_blur_effect_init (ClutterBlurEffect *self)
-{
- ClutterBlurEffectClass *klass = CLUTTER_BLUR_EFFECT_GET_CLASS (self);
-
- if (G_UNLIKELY (klass->base_pipeline == NULL))
- {
- CoglSnippet *snippet;
- CoglContext *ctx =
- clutter_backend_get_cogl_context (clutter_get_default_backend ());
-
- klass->base_pipeline = cogl_pipeline_new (ctx);
-
- snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_TEXTURE_LOOKUP,
- box_blur_glsl_declarations,
- NULL);
- cogl_snippet_set_replace (snippet, box_blur_glsl_shader);
- cogl_pipeline_add_layer_snippet (klass->base_pipeline, 0, snippet);
- cogl_object_unref (snippet);
-
- cogl_pipeline_set_layer_null_texture (klass->base_pipeline, 0);
- }
-
- self->pipeline = cogl_pipeline_copy (klass->base_pipeline);
-
- self->pixel_step_uniform =
- cogl_pipeline_get_uniform_location (self->pipeline, "pixel_step");
-}
-
-/**
- * clutter_blur_effect_new:
- *
- * Creates a new #ClutterBlurEffect to be used with
- * clutter_actor_add_effect()
- *
- * Return value: the newly created #ClutterBlurEffect or %NULL
- *
- * Since: 1.4
- */
-ClutterEffect *
-clutter_blur_effect_new (void)
-{
- return g_object_new (CLUTTER_TYPE_BLUR_EFFECT, NULL);
-}
diff --git a/clutter/clutter/clutter-blur-effect.h b/clutter/clutter/clutter-blur-effect.h
deleted file mode 100644
index 0739a75bd..000000000
--- a/clutter/clutter/clutter-blur-effect.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_BLUR_EFFECT_H__
-#define __CLUTTER_BLUR_EFFECT_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-effect.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_BLUR_EFFECT (clutter_blur_effect_get_type ())
-#define CLUTTER_BLUR_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BLUR_EFFECT, ClutterBlurEffect))
-#define CLUTTER_IS_BLUR_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BLUR_EFFECT))
-
-/**
- * ClutterBlurEffect:
- *
- * #ClutterBlurEffect is an opaque structure
- * whose members cannot be accessed directly
- *
- * Since: 1.4
- */
-typedef struct _ClutterBlurEffect ClutterBlurEffect;
-typedef struct _ClutterBlurEffectClass ClutterBlurEffectClass;
-
-CLUTTER_EXPORT
-GType clutter_blur_effect_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterEffect *clutter_blur_effect_new (void);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_BLUR_EFFECT_H__ */
diff --git a/clutter/clutter/clutter-blur-private.h b/clutter/clutter/clutter-blur-private.h
deleted file mode 100644
index cf7cfd2f5..000000000
--- a/clutter/clutter/clutter-blur-private.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2020 Endless OS Foundation, LLC
- *
- * 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_BLUR_PRIVATE_H
-#define CLUTTER_BLUR_PRIVATE_H
-
-#include <glib-object.h>
-
-#include <cogl/cogl.h>
-
-G_BEGIN_DECLS
-
-typedef struct _ClutterBlur ClutterBlur;
-
-ClutterBlur * clutter_blur_new (CoglTexture *texture,
- float sigma);
-
-void clutter_blur_apply (ClutterBlur *blur);
-
-CoglTexture * clutter_blur_get_texture (ClutterBlur *blur);
-
-void clutter_blur_free (ClutterBlur *blur);
-
-G_END_DECLS
-
-#endif /* CLUTTER_BLUR_PRIVATE_H */
diff --git a/clutter/clutter/clutter-blur.c b/clutter/clutter/clutter-blur.c
deleted file mode 100644
index 1f0d394dd..000000000
--- a/clutter/clutter/clutter-blur.c
+++ /dev/null
@@ -1,431 +0,0 @@
-/*
- * Copyright (C) 2020 Endless OS Foundation, LLC
- *
- * 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-blur-private.h"
-
-#include "clutter-backend.h"
-
-/**
- * SECTION:clutter-blur
- * @short_description: Blur textures
- *
- * #ClutterBlur is a moderately fast gaussian blur implementation.
- *
- * # Optimizations
- *
- * There are a number of optimizations in place to make this blur implementation
- * real-time. All in all, the implementation performs best when using large
- * blur-radii that allow downscaling the texture to smaller sizes, at small
- * radii where no downscaling is possible this can easily halve the framerate.
- *
- * ## Multipass
- *
- * It is implemented in 2 passes: vertical and horizontal.
- *
- * ## Downscaling
- *
- * #ClutterBlur uses dynamic downscaling to speed up blurring. Downscaling
- * happens in factors of 2 (the image is downscaled either by 2, 4, 8, 16, …)
- * and depends on the blur radius, the texture size, among others.
- *
- * The texture is drawn into a downscaled framebuffer; the blur passes are
- * applied on the downscaled texture contents; and finally, the blurred
- * contents are drawn
- * upscaled again.
- *
- * ## Hardware Interpolation
- *
- * This blur implementation cuts down the number of sampling operations by
- * exploiting the hardware interpolation that is performed when sampling between
- * pixel boundaries. This technique is described at:
- *
- * http://rastergrid.com/blog/2010/09/efficient-gaussian-blur-with-linear-sampling/
- *
- * ## Incremental gauss-factor calculation
- *
- * The kernel values for the gaussian kernel are computed incrementally instead
- * of running the expensive calculations multiple times inside the blur shader.
- * The implementation is based on the algorithm presented by K. Turkowski in
- * GPU Gems 3, chapter 40:
- *
- * https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch40.html
- *
- */
-
-static const char *gaussian_blur_glsl_declarations =
-"uniform float sigma; \n"
-"uniform float pixel_step; \n"
-"uniform vec2 direction; \n";
-
-static const char *gaussian_blur_glsl =
-" vec2 uv = vec2 (cogl_tex_coord.st); \n"
-" \n"
-" vec3 gauss_coefficient; \n"
-" gauss_coefficient.x = 1.0 / (sqrt (2.0 * 3.14159265) * sigma); \n"
-" gauss_coefficient.y = exp (-0.5 / (sigma * sigma)); \n"
-" gauss_coefficient.z = gauss_coefficient.y * gauss_coefficient.y; \n"
-" \n"
-" float gauss_coefficient_total = gauss_coefficient.x; \n"
-" \n"
-" vec4 ret = texture2D (cogl_sampler, uv) * gauss_coefficient.x; \n"
-" gauss_coefficient.xy *= gauss_coefficient.yz; \n"
-" \n"
-" int n_steps = int (ceil (1.5 * sigma)) * 2; \n"
-" \n"
-" for (int i = 1; i <= n_steps; i += 2) { \n"
-" float coefficient_subtotal = gauss_coefficient.x; \n"
-" gauss_coefficient.xy *= gauss_coefficient.yz; \n"
-" coefficient_subtotal += gauss_coefficient.x; \n"
-" \n"
-" float gauss_ratio = gauss_coefficient.x / coefficient_subtotal; \n"
-" \n"
-" float foffset = float (i) + gauss_ratio; \n"
-" vec2 offset = direction * foffset * pixel_step; \n"
-" \n"
-" ret += texture2D (cogl_sampler, uv + offset) * coefficient_subtotal; \n"
-" ret += texture2D (cogl_sampler, uv - offset) * coefficient_subtotal; \n"
-" \n"
-" gauss_coefficient_total += 2.0 * coefficient_subtotal; \n"
-" gauss_coefficient.xy *= gauss_coefficient.yz; \n"
-" } \n"
-" \n"
-" cogl_texel = ret / gauss_coefficient_total; \n";
-
-#define MIN_DOWNSCALE_SIZE 256.f
-#define MAX_SIGMA 6.f
-
-enum
-{
- VERTICAL,
- HORIZONTAL,
-};
-
-typedef struct
-{
- CoglFramebuffer *framebuffer;
- CoglPipeline *pipeline;
- CoglTexture *texture;
- int orientation;
-} BlurPass;
-
-struct _ClutterBlur
-{
- CoglTexture *source_texture;
- float sigma;
- float downscale_factor;
-
- BlurPass pass[2];
-};
-
-static CoglPipeline*
-create_blur_pipeline (void)
-{
- static CoglPipelineKey blur_pipeline_key = "clutter-blur-pipeline-private";
- CoglContext *ctx =
- clutter_backend_get_cogl_context (clutter_get_default_backend ());
- CoglPipeline *blur_pipeline;
-
- blur_pipeline =
- cogl_context_get_named_pipeline (ctx, &blur_pipeline_key);
-
- if (G_UNLIKELY (blur_pipeline == NULL))
- {
- CoglSnippet *snippet;
-
- blur_pipeline = cogl_pipeline_new (ctx);
- cogl_pipeline_set_layer_null_texture (blur_pipeline, 0);
- cogl_pipeline_set_layer_filters (blur_pipeline,
- 0,
- COGL_PIPELINE_FILTER_LINEAR,
- COGL_PIPELINE_FILTER_LINEAR);
- cogl_pipeline_set_layer_wrap_mode (blur_pipeline,
- 0,
- COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE);
-
- snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_TEXTURE_LOOKUP,
- gaussian_blur_glsl_declarations,
- NULL);
- cogl_snippet_set_replace (snippet, gaussian_blur_glsl);
- cogl_pipeline_add_layer_snippet (blur_pipeline, 0, snippet);
- cogl_object_unref (snippet);
-
- cogl_context_set_named_pipeline (ctx, &blur_pipeline_key, blur_pipeline);
- }
-
- return cogl_pipeline_copy (blur_pipeline);
-}
-
-static void
-update_blur_uniforms (ClutterBlur *blur,
- BlurPass *pass)
-{
- gboolean vertical = pass->orientation == VERTICAL;
- int sigma_uniform;
- int pixel_step_uniform;
- int direction_uniform;
-
- pixel_step_uniform =
- cogl_pipeline_get_uniform_location (pass->pipeline, "pixel_step");
- if (pixel_step_uniform > -1)
- {
- float pixel_step;
-
- if (vertical)
- pixel_step = 1.f / cogl_texture_get_height (pass->texture);
- else
- pixel_step = 1.f / cogl_texture_get_width (pass->texture);
-
- cogl_pipeline_set_uniform_1f (pass->pipeline,
- pixel_step_uniform,
- pixel_step);
- }
-
- sigma_uniform = cogl_pipeline_get_uniform_location (pass->pipeline, "sigma");
- if (sigma_uniform > -1)
- {
- cogl_pipeline_set_uniform_1f (pass->pipeline,
- sigma_uniform,
- blur->sigma / blur->downscale_factor);
- }
-
- direction_uniform =
- cogl_pipeline_get_uniform_location (pass->pipeline, "direction");
- if (direction_uniform > -1)
- {
- gboolean horizontal = !vertical;
- float direction[2] = {
- horizontal,
- vertical,
- };
-
- cogl_pipeline_set_uniform_float (pass->pipeline,
- direction_uniform,
- 2, 1,
- direction);
- }
-}
-
-static gboolean
-create_fbo (ClutterBlur *blur,
- BlurPass *pass)
-{
- CoglContext *ctx =
- clutter_backend_get_cogl_context (clutter_get_default_backend ());
- float scaled_height;
- float scaled_width;
- float height;
- float width;
-
- g_clear_pointer (&pass->texture, cogl_object_unref);
- g_clear_object (&pass->framebuffer);
-
- width = cogl_texture_get_width (blur->source_texture);
- height = cogl_texture_get_height (blur->source_texture);
- scaled_width = floorf (width / blur->downscale_factor);
- scaled_height = floorf (height / blur->downscale_factor);
-
- pass->texture = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx,
- scaled_width,
- scaled_height));
- if (!pass->texture)
- return FALSE;
-
- pass->framebuffer =
- COGL_FRAMEBUFFER (cogl_offscreen_new_with_texture (pass->texture));
- if (!pass->framebuffer)
- {
- g_warning ("%s: Unable to create an Offscreen buffer", G_STRLOC);
- return FALSE;
- }
-
- cogl_framebuffer_orthographic (pass->framebuffer,
- 0.0, 0.0,
- scaled_width,
- scaled_height,
- 0.0, 1.0);
- return TRUE;
-}
-
-static gboolean
-setup_blur_pass (ClutterBlur *blur,
- BlurPass *pass,
- int orientation,
- CoglTexture *texture)
-{
- pass->orientation = orientation;
- pass->pipeline = create_blur_pipeline ();
- cogl_pipeline_set_layer_texture (pass->pipeline, 0, texture);
-
- if (!create_fbo (blur, pass))
- return FALSE;
-
- update_blur_uniforms (blur, pass);
- return TRUE;
-}
-
-static float
-calculate_downscale_factor (float width,
- float height,
- float sigma)
-{
- float downscale_factor = 1.f;
- float scaled_width = width;
- float scaled_height = height;
- float scaled_sigma = sigma;
-
- /* This is the algorithm used by Firefox; keep downscaling until either the
- * blur radius is lower than the threshold, or the downscaled texture is too
- * small.
- */
- while (scaled_sigma > MAX_SIGMA &&
- scaled_width > MIN_DOWNSCALE_SIZE &&
- scaled_height > MIN_DOWNSCALE_SIZE)
- {
- downscale_factor *= 2.f;
-
- scaled_width = width / downscale_factor;
- scaled_height = height / downscale_factor;
- scaled_sigma = sigma / downscale_factor;
- }
-
- return downscale_factor;
-}
-
-static void
-apply_blur_pass (BlurPass *pass)
-{
- CoglColor transparent;
-
- cogl_color_init_from_4ub (&transparent, 0, 0, 0, 0);
-
- cogl_framebuffer_clear (pass->framebuffer,
- COGL_BUFFER_BIT_COLOR,
- &transparent);
-
- cogl_framebuffer_draw_rectangle (pass->framebuffer,
- pass->pipeline,
- 0, 0,
- cogl_texture_get_width (pass->texture),
- cogl_texture_get_height (pass->texture));
-}
-
-static void
-clear_blur_pass (BlurPass *pass)
-{
- g_clear_pointer (&pass->pipeline, cogl_object_unref);
- g_clear_pointer (&pass->texture, cogl_object_unref);
- g_clear_object (&pass->framebuffer);
-}
-
-/**
- * clutter_blur_new:
- * @texture: a #CoglTexture
- * @sigma: blur sigma
- *
- * Creates a new #ClutterBlur.
- *
- * Returns: (transfer full) (nullable): A newly created #ClutterBlur
- */
-ClutterBlur *
-clutter_blur_new (CoglTexture *texture,
- float sigma)
-{
- ClutterBlur *blur;
- unsigned int height;
- unsigned int width;
- BlurPass *hpass;
- BlurPass *vpass;
-
- g_return_val_if_fail (texture != NULL, NULL);
- g_return_val_if_fail (sigma >= 0.0, NULL);
-
- width = cogl_texture_get_width (texture);
- height = cogl_texture_get_height (texture);
-
- blur = g_new0 (ClutterBlur, 1);
- blur->sigma = sigma;
- blur->source_texture = cogl_object_ref (texture);
- blur->downscale_factor = calculate_downscale_factor (width, height, sigma);
-
- if (G_APPROX_VALUE (sigma, 0.0, FLT_EPSILON))
- goto out;
-
- vpass = &blur->pass[VERTICAL];
- hpass = &blur->pass[HORIZONTAL];
-
- if (!setup_blur_pass (blur, vpass, VERTICAL, texture) ||
- !setup_blur_pass (blur, hpass, HORIZONTAL, vpass->texture))
- {
- clutter_blur_free (blur);
- return NULL;
- }
-
-out:
- return g_steal_pointer (&blur);
-}
-
-/**
- * clutter_blur_apply:
- * @blur: a #ClutterBlur
- *
- * Applies the blur. The resulting texture can be retrieved by
- * clutter_blur_get_texture().
- */
-void
-clutter_blur_apply (ClutterBlur *blur)
-{
- if (G_APPROX_VALUE (blur->sigma, 0.0, FLT_EPSILON))
- return;
-
- apply_blur_pass (&blur->pass[VERTICAL]);
- apply_blur_pass (&blur->pass[HORIZONTAL]);
-}
-
-/**
- * clutter_blur_get_texture:
- * @blur: a #ClutterBlur
- *
- * Retrieves the texture where the blurred contents are stored. The
- * contents are undefined until clutter_blur_apply() is called.
- *
- * Returns: (transfer none): a #CoglTexture
- */
-CoglTexture *
-clutter_blur_get_texture (ClutterBlur *blur)
-{
- if (G_APPROX_VALUE (blur->sigma, 0.0, FLT_EPSILON))
- return blur->source_texture;
- else
- return blur->pass[HORIZONTAL].texture;
-}
-
-/**
- * clutter_blur_free:
- * @blur: A #ClutterBlur
- *
- * Frees @blur.
- */
-void
-clutter_blur_free (ClutterBlur *blur)
-{
- g_assert (blur);
-
- clear_blur_pass (&blur->pass[VERTICAL]);
- clear_blur_pass (&blur->pass[HORIZONTAL]);
- cogl_clear_object (&blur->source_texture);
- g_free (blur);
-}
diff --git a/clutter/clutter/clutter-box-layout.c b/clutter/clutter/clutter-box-layout.c
deleted file mode 100644
index 4a2164fb6..000000000
--- a/clutter/clutter/clutter-box-layout.c
+++ /dev/null
@@ -1,1267 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2009 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- *
- * Based on the NBTK NbtkBoxLayout actor by:
- * Thomas Wood <thomas.wood@intel.com>
- */
-
-/**
- * SECTION:clutter-box-layout
- * @short_description: A layout manager arranging children on a single line
- *
- * The #ClutterBoxLayout is a #ClutterLayoutManager implementing the
- * following layout policy:
- *
- * - all children are arranged on a single line
- * - the axis used is controlled by the #ClutterBoxLayout:orientation property
- * - the order of the packing is determined by the #ClutterBoxLayout:pack-start boolean property
- * - each child will be allocated to its natural size or, if #ClutterActor:x-expand or
- * #ClutterActor:y-expand are set, the available size
- * - honours the #ClutterActor's #ClutterActor:x-align and #ClutterActor:y-align properties
- * to fill the available size
- * - if the #ClutterBoxLayout:homogeneous boolean property is set, then all widgets will
- * get the same size, ignoring expand settings and the preferred sizes
- *
- * It is possible to control the spacing between children of a
- * #ClutterBoxLayout by using clutter_box_layout_set_spacing().
- *
- * #ClutterBoxLayout is available since Clutter 1.2
- */
-
-#include "clutter-build-config.h"
-
-#include <math.h>
-
-#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
-#include "deprecated/clutter-container.h"
-
-#include "clutter-box-layout.h"
-
-#include "clutter-actor-private.h"
-#include "clutter-debug.h"
-#include "clutter-enum-types.h"
-#include "clutter-layout-meta.h"
-#include "clutter-private.h"
-#include "clutter-types.h"
-
-struct _ClutterBoxLayoutPrivate
-{
- ClutterContainer *container;
-
- guint spacing;
-
- ClutterAnimationMode easing_mode;
- guint easing_duration;
-
- ClutterOrientation orientation;
-
- guint is_pack_start : 1;
- guint is_homogeneous : 1;
-};
-
-enum
-{
- PROP_0,
-
- PROP_SPACING,
- PROP_HOMOGENEOUS,
- PROP_PACK_START,
- PROP_ORIENTATION,
-
- PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST] = { NULL, };
-
-G_DEFINE_TYPE_WITH_PRIVATE (ClutterBoxLayout,
- clutter_box_layout,
- CLUTTER_TYPE_LAYOUT_MANAGER)
-
-
-typedef struct _RequestedSize
-{
- ClutterActor *actor;
-
- gfloat minimum_size;
- gfloat natural_size;
-} RequestedSize;
-
-static float distribute_natural_allocation (float extra_space,
- unsigned int n_requested_sizes,
- RequestedSize *sizes);
-static void count_expand_children (ClutterLayoutManager *layout,
- ClutterContainer *container,
- gint *visible_children,
- gint *expand_children);
-
-static void
-clutter_box_layout_set_container (ClutterLayoutManager *layout,
- ClutterContainer *container)
-{
- ClutterBoxLayoutPrivate *priv = CLUTTER_BOX_LAYOUT (layout)->priv;
- ClutterLayoutManagerClass *parent_class;
-
- priv->container = container;
-
- if (priv->container != NULL)
- {
- ClutterRequestMode request_mode;
-
- /* we need to change the :request-mode of the container
- * to match the orientation
- */
- request_mode = priv->orientation == CLUTTER_ORIENTATION_VERTICAL
- ? CLUTTER_REQUEST_HEIGHT_FOR_WIDTH
- : CLUTTER_REQUEST_WIDTH_FOR_HEIGHT;
- clutter_actor_set_request_mode (CLUTTER_ACTOR (priv->container),
- request_mode);
- }
-
- parent_class = CLUTTER_LAYOUT_MANAGER_CLASS (clutter_box_layout_parent_class);
- parent_class->set_container (layout, container);
-}
-
-static void
-get_child_size (ClutterActor *actor,
- ClutterOrientation orientation,
- gfloat for_size,
- gfloat *min_size_p,
- gfloat *natural_size_p)
-{
- if (orientation == CLUTTER_ORIENTATION_HORIZONTAL)
- clutter_actor_get_preferred_width (actor, for_size, min_size_p, natural_size_p);
- else
- clutter_actor_get_preferred_height (actor, for_size, min_size_p, natural_size_p);
-}
-
-/* Handle the request in the orientation of the box (i.e. width request of horizontal box) */
-static void
-get_preferred_size_for_orientation (ClutterBoxLayout *self,
- ClutterActor *container,
- gfloat for_size,
- gfloat *min_size_p,
- gfloat *natural_size_p)
-{
- ClutterBoxLayoutPrivate *priv = self->priv;
- ClutterActorIter iter;
- ClutterActor *child;
- gint n_children = 0;
- gfloat minimum, natural;
- float largest_min_size, largest_nat_size;
-
- minimum = natural = 0;
- largest_min_size = largest_nat_size = 0;
-
- clutter_actor_iter_init (&iter, container);
- while (clutter_actor_iter_next (&iter, &child))
- {
- gfloat child_min = 0, child_nat = 0;
-
- if (!clutter_actor_is_visible (child))
- continue;
-
- n_children++;
-
- get_child_size (child, priv->orientation,
- for_size, &child_min, &child_nat);
-
- if (priv->is_homogeneous)
- {
- largest_min_size = MAX (largest_min_size, child_min);
- largest_nat_size = MAX (largest_nat_size, child_nat);
- }
- else
- {
- minimum += child_min;
- natural += child_nat;
- }
- }
-
- if (priv->is_homogeneous)
- {
- minimum = largest_min_size * n_children;
- natural = largest_nat_size * n_children;
- }
-
- if (n_children > 1)
- {
- minimum += priv->spacing * (n_children - 1);
- natural += priv->spacing * (n_children - 1);
- }
-
- if (min_size_p)
- *min_size_p = minimum;
-
- if (natural_size_p)
- *natural_size_p = natural;
-}
-
-static void
-get_base_size_for_opposite_orientation (ClutterBoxLayout *self,
- ClutterActor *container,
- gfloat *min_size_p,
- gfloat *natural_size_p)
-{
- ClutterBoxLayoutPrivate *priv = self->priv;
- ClutterActorIter iter;
- ClutterActor *child;
- gint n_children = 0;
- gfloat minimum, natural;
- ClutterOrientation opposite_orientation =
- priv->orientation == CLUTTER_ORIENTATION_HORIZONTAL
- ? CLUTTER_ORIENTATION_VERTICAL
- : CLUTTER_ORIENTATION_HORIZONTAL;
-
- minimum = natural = 0;
-
- clutter_actor_iter_init (&iter, container);
- while (clutter_actor_iter_next (&iter, &child))
- {
- gfloat child_min = 0, child_nat = 0;
-
- if (!clutter_actor_is_visible (child))
- continue;
-
- n_children++;
-
- get_child_size (child, opposite_orientation, -1, &child_min, &child_nat);
-
- minimum = MAX (minimum, child_min);
- natural = MAX (natural, child_nat);
- }
-
- if (min_size_p)
- *min_size_p = minimum;
-
- if (natural_size_p)
- *natural_size_p = natural;
-}
-
-
-/* Handle the request in the opposite orientation of the box
- * (i.e. height request of horizontal box)
- *
- * This operation requires a virtual allocation in the natural
- * orientation of the box, after that each element must be asked
- * for the size-for-virtually-allocated-size and the maximums of
- * each child sample will be reported as the overall
- * "size-for-size-in-opposite-orientation"
- */
-static void
-get_preferred_size_for_opposite_orientation (ClutterBoxLayout *self,
- ClutterActor *container,
- gfloat for_size,
- gfloat *min_size_p,
- gfloat *natural_size_p)
-{
- ClutterLayoutManager *layout = CLUTTER_LAYOUT_MANAGER (self);
- ClutterBoxLayoutPrivate *priv = self->priv;
- ClutterContainer *real_container = CLUTTER_CONTAINER (container);
- ClutterActor *child;
- ClutterActorIter iter;
- gint nvis_children = 0, n_extra_widgets = 0;
- gint nexpand_children = 0, i;
- RequestedSize *sizes;
- gfloat minimum, natural, size, extra = 0;
- ClutterOrientation opposite_orientation =
- priv->orientation == CLUTTER_ORIENTATION_HORIZONTAL
- ? CLUTTER_ORIENTATION_VERTICAL
- : CLUTTER_ORIENTATION_HORIZONTAL;
-
- minimum = natural = 0;
-
- count_expand_children (layout, real_container,
- &nvis_children, &nexpand_children);
-
- if (nvis_children < 1)
- {
- if (min_size_p)
- *min_size_p = 0;
-
- if (natural_size_p)
- *natural_size_p = 0;
-
- return;
- }
-
- /* First collect the requested sizes in the natural orientation of the box */
- sizes = g_newa (RequestedSize, nvis_children);
- size = for_size;
-
- i = 0;
- clutter_actor_iter_init (&iter, container);
- while (clutter_actor_iter_next (&iter, &child))
- {
- if (!clutter_actor_is_visible (child))
- continue;
-
- get_child_size (child, priv->orientation, -1,
- &sizes[i].minimum_size,
- &sizes[i].natural_size);
-
- size -= sizes[i].minimum_size;
- i++;
- }
-
- if (priv->is_homogeneous)
- {
- size = for_size - (nvis_children - 1) * priv->spacing;
- extra = size / nvis_children;
- n_extra_widgets = ((gint)size) % nvis_children;
- }
- else
- {
- size -= (nvis_children - 1) * priv->spacing;
-
- /* Bring children up to size first */
- if (isnormal (size) || size == 0)
- {
- size = distribute_natural_allocation (MAX (0, size),
- nvis_children,
- sizes);
- }
- else
- {
- g_critical ("Actor %s (%p) received the invalid "
- "value %f as minimum/natural size\n",
- G_OBJECT_TYPE_NAME (container), container, size);
- size = 0;
- }
-
- /* Calculate space which hasn't distributed yet,
- * and is available for expanding children.
- */
- if (nexpand_children > 0)
- {
- extra = size / nexpand_children;
- n_extra_widgets = ((gint)size) % nexpand_children;
- }
- }
-
- /* Distribute expand space to children */
- i = 0;
- clutter_actor_iter_init (&iter, container);
- while (clutter_actor_iter_next (&iter, &child))
- {
- /* If widget is not visible, skip it. */
- if (!clutter_actor_is_visible (child))
- continue;
-
- if (priv->is_homogeneous)
- {
- sizes[i].minimum_size = extra;
-
- if (n_extra_widgets > 0)
- {
- sizes[i].minimum_size++;
- n_extra_widgets--;
- }
- }
- else
- {
- if (clutter_actor_needs_expand (child, priv->orientation))
- {
- sizes[i].minimum_size += extra;
-
- if (n_extra_widgets > 0)
- {
- sizes[i].minimum_size++;
- n_extra_widgets--;
- }
- }
- }
- i++;
- }
-
- /* Virtual allocation finished, now we can finally ask for the right size-for-size */
- i = 0;
- clutter_actor_iter_init (&iter, container);
- while (clutter_actor_iter_next (&iter, &child))
- {
- gfloat child_min = 0, child_nat = 0;
-
- if (!clutter_actor_is_visible (child))
- continue;
-
- get_child_size (child, opposite_orientation,
- sizes[i].minimum_size,
- &child_min, &child_nat);
-
- minimum = MAX (minimum, child_min);
- natural = MAX (natural, child_nat);
-
- i++;
- }
-
- if (min_size_p)
- *min_size_p = minimum;
-
- if (natural_size_p)
- *natural_size_p = natural;
-}
-
-
-static void
-allocate_box_child (ClutterBoxLayout *self,
- ClutterContainer *container,
- ClutterActor *child,
- ClutterActorBox *child_box)
-{
- CLUTTER_NOTE (LAYOUT, "Allocation for %s { %.2f, %.2f, %.2f, %.2f }",
- _clutter_actor_get_debug_name (child),
- child_box->x1, child_box->y1,
- child_box->x2 - child_box->x1,
- child_box->y2 - child_box->y1);
-
- clutter_actor_allocate (child, child_box);
-}
-
-static void
-clutter_box_layout_get_preferred_width (ClutterLayoutManager *layout,
- ClutterContainer *container,
- gfloat for_height,
- gfloat *min_width_p,
- gfloat *natural_width_p)
-{
- ClutterBoxLayout *self = CLUTTER_BOX_LAYOUT (layout);
- ClutterBoxLayoutPrivate *priv = self->priv;
-
- if (priv->orientation == CLUTTER_ORIENTATION_VERTICAL)
- {
- if (for_height < 0)
- get_base_size_for_opposite_orientation (self, CLUTTER_ACTOR (container),
- min_width_p, natural_width_p);
- else
- get_preferred_size_for_opposite_orientation (self, CLUTTER_ACTOR (container), for_height,
- min_width_p, natural_width_p);
- }
- else
- get_preferred_size_for_orientation (self, CLUTTER_ACTOR (container), for_height,
- min_width_p, natural_width_p);
-}
-
-static void
-clutter_box_layout_get_preferred_height (ClutterLayoutManager *layout,
- ClutterContainer *container,
- gfloat for_width,
- gfloat *min_height_p,
- gfloat *natural_height_p)
-{
- ClutterBoxLayout *self = CLUTTER_BOX_LAYOUT (layout);
- ClutterBoxLayoutPrivate *priv = self->priv;
-
- if (priv->orientation == CLUTTER_ORIENTATION_HORIZONTAL)
- {
- if (for_width < 0)
- get_base_size_for_opposite_orientation (self, CLUTTER_ACTOR (container),
- min_height_p, natural_height_p);
- else
- get_preferred_size_for_opposite_orientation (self, CLUTTER_ACTOR (container), for_width,
- min_height_p, natural_height_p);
- }
- else
- get_preferred_size_for_orientation (self, CLUTTER_ACTOR (container), for_width,
- min_height_p, natural_height_p);
-}
-
-static void
-count_expand_children (ClutterLayoutManager *layout,
- ClutterContainer *container,
- gint *visible_children,
- gint *expand_children)
-{
- ClutterBoxLayoutPrivate *priv = CLUTTER_BOX_LAYOUT (layout)->priv;
- ClutterActor *actor, *child;
- ClutterActorIter iter;
-
- actor = CLUTTER_ACTOR (container);
-
- *visible_children = *expand_children = 0;
-
- clutter_actor_iter_init (&iter, actor);
- while (clutter_actor_iter_next (&iter, &child))
- {
- if (clutter_actor_is_visible (child))
- {
- *visible_children += 1;
-
- if (clutter_actor_needs_expand (child, priv->orientation))
- *expand_children += 1;
- }
- }
-}
-
-/* Pulled from gtksizerequest.c from Gtk+ */
-static gint
-compare_gap (gconstpointer p1,
- gconstpointer p2,
- gpointer data)
-{
- RequestedSize *sizes = data;
- const guint *c1 = p1;
- const guint *c2 = p2;
-
- const gint d1 = MAX (sizes[*c1].natural_size -
- sizes[*c1].minimum_size,
- 0);
- const gint d2 = MAX (sizes[*c2].natural_size -
- sizes[*c2].minimum_size,
- 0);
-
- gint delta = (d2 - d1);
-
- if (0 == delta)
- delta = (*c2 - *c1);
-
- return delta;
-}
-
-/*
- * distribute_natural_allocation:
- * @extra_space: Extra space to redistribute among children after subtracting
- * minimum sizes and any child padding from the overall allocation
- * @n_requested_sizes: Number of requests to fit into the allocation
- * @sizes: An array of structs with a client pointer and a minimum/natural size
- * in the orientation of the allocation.
- *
- * Distributes @extra_space to child @sizes by bringing smaller
- * children up to natural size first.
- *
- * The remaining space will be added to the @minimum_size member of the
- * RequestedSize struct. If all sizes reach their natural size then
- * the remaining space is returned.
- *
- * Returns: The remainder of @extra_space after redistributing space
- * to @sizes.
- *
- * Pulled from gtksizerequest.c from Gtk+
- */
-static float
-distribute_natural_allocation (float extra_space,
- unsigned int n_requested_sizes,
- RequestedSize *sizes)
-{
- unsigned int *spreading;
- int i;
-
- g_return_val_if_fail (isnormal (extra_space) || extra_space == 0, 0);
- g_return_val_if_fail (extra_space >= 0, 0);
-
- spreading = g_newa (unsigned int, n_requested_sizes);
-
- for (i = 0; i < n_requested_sizes; i++)
- spreading[i] = i;
-
- /* Distribute the container's extra space c_gap. We want to assign
- * this space such that the sum of extra space assigned to children
- * (c^i_gap) is equal to c_cap. The case that there's not enough
- * space for all children to take their natural size needs some
- * attention. The goals we want to achieve are:
- *
- * a) Maximize number of children taking their natural size.
- * b) The allocated size of children should be a continuous
- * function of c_gap. That is, increasing the container size by
- * one pixel should never make drastic changes in the distribution.
- * c) If child i takes its natural size and child j doesn't,
- * child j should have received at least as much gap as child i.
- *
- * The following code distributes the additional space by following
- * these rules.
- */
-
- /* Sort descending by gap and position. */
- g_qsort_with_data (spreading,
- n_requested_sizes, sizeof (unsigned int),
- compare_gap, sizes);
-
- /* Distribute available space.
- * This master piece of a loop was conceived by Behdad Esfahbod.
- */
- for (i = n_requested_sizes - 1; extra_space > 0 && i >= 0; --i)
- {
- /* Divide remaining space by number of remaining children.
- * Sort order and reducing remaining space by assigned space
- * ensures that space is distributed equally.
- */
- int glue = (extra_space + i) / (i + 1);
- int gap = sizes[(spreading[i])].natural_size
- - sizes[(spreading[i])].minimum_size;
-
- int extra = MIN (glue, gap);
-
- sizes[spreading[i]].minimum_size += extra;
-
- extra_space -= extra;
- }
-
- return extra_space;
-}
-
-/* Pulled from gtkbox.c from Gtk+ */
-
-static void
-clutter_box_layout_allocate (ClutterLayoutManager *layout,
- ClutterContainer *container,
- const ClutterActorBox *box)
-{
- ClutterBoxLayoutPrivate *priv = CLUTTER_BOX_LAYOUT (layout)->priv;
- ClutterActor *actor, *child;
- gint nvis_children;
- gint nexpand_children;
- gboolean is_rtl;
- ClutterActorIter iter;
-
- ClutterActorBox child_allocation;
- RequestedSize *sizes;
-
- gint size;
- gint extra;
- gint n_extra_widgets = 0; /* Number of widgets that receive 1 extra px */
- gint x = 0, y = 0, i;
- gfloat child_size;
-
- count_expand_children (layout, container, &nvis_children, &nexpand_children);
-
- CLUTTER_NOTE (LAYOUT, "BoxLayout for %s: visible=%d, expand=%d",
- _clutter_actor_get_debug_name (CLUTTER_ACTOR (container)),
- nvis_children,
- nexpand_children);
-
- /* If there is no visible child, simply return. */
- if (nvis_children <= 0)
- return;
-
- sizes = g_newa (RequestedSize, nvis_children);
-
- if (priv->orientation == CLUTTER_ORIENTATION_VERTICAL)
- size = box->y2 - box->y1 - (nvis_children - 1) * priv->spacing;
- else
- size = box->x2 - box->x1 - (nvis_children - 1) * priv->spacing;
-
- actor = CLUTTER_ACTOR (container);
-
- /* Retrieve desired size for visible children. */
- i = 0;
- clutter_actor_iter_init (&iter, actor);
- while (clutter_actor_iter_next (&iter, &child))
- {
- if (!clutter_actor_is_visible (child))
- continue;
-
- if (priv->orientation == CLUTTER_ORIENTATION_VERTICAL)
- clutter_actor_get_preferred_height (child,
- box->x2 - box->x1,
- &sizes[i].minimum_size,
- &sizes[i].natural_size);
- else
- clutter_actor_get_preferred_width (child,
- box->y2 - box->y1,
- &sizes[i].minimum_size,
- &sizes[i].natural_size);
-
-
- /* Assert the api is working properly */
- if (sizes[i].minimum_size < 0)
- g_error ("ClutterBoxLayout child %s minimum %s: %f < 0 for %s %f",
- _clutter_actor_get_debug_name (child),
- priv->orientation == CLUTTER_ORIENTATION_VERTICAL
- ? "height"
- : "width",
- sizes[i].minimum_size,
- priv->orientation == CLUTTER_ORIENTATION_VERTICAL
- ? "width"
- : "height",
- priv->orientation == CLUTTER_ORIENTATION_VERTICAL
- ? box->x2 - box->x1
- : box->y2 - box->y1);
-
- if (sizes[i].natural_size < sizes[i].minimum_size)
- g_error ("ClutterBoxLayout child %s natural %s: %f < minimum %f for %s %f",
- _clutter_actor_get_debug_name (child),
- priv->orientation == CLUTTER_ORIENTATION_VERTICAL
- ? "height"
- : "width",
- sizes[i].natural_size,
- sizes[i].minimum_size,
- priv->orientation == CLUTTER_ORIENTATION_VERTICAL
- ? "width"
- : "height",
- priv->orientation == CLUTTER_ORIENTATION_VERTICAL
- ? box->x2 - box->x1
- : box->y2 - box->y1);
-
- size -= sizes[i].minimum_size;
-
- sizes[i].actor = child;
-
- i += 1;
- }
-
- if (priv->is_homogeneous)
- {
- /* If were homogeneous we still need to run the above loop to get the
- * minimum sizes for children that are not going to fill
- */
- if (priv->orientation == CLUTTER_ORIENTATION_VERTICAL)
- size = box->y2 - box->y1 - (nvis_children - 1) * priv->spacing;
- else
- size = box->x2 - box->x1 - (nvis_children - 1) * priv->spacing;
-
- extra = size / nvis_children;
- n_extra_widgets = size % nvis_children;
- }
- else
- {
- /* Bring children up to size first */
- size = (gint) distribute_natural_allocation (MAX (0, (float) size),
- nvis_children,
- sizes);
-
- /* Calculate space which hasn't distributed yet,
- * and is available for expanding children.
- */
- if (nexpand_children > 0)
- {
- extra = size / nexpand_children;
- n_extra_widgets = size % nexpand_children;
- }
- else
- extra = 0;
- }
-
- if (priv->orientation == CLUTTER_ORIENTATION_HORIZONTAL)
- {
- ClutterTextDirection text_dir;
-
- text_dir = clutter_actor_get_text_direction (CLUTTER_ACTOR (container));
- is_rtl = (text_dir == CLUTTER_TEXT_DIRECTION_RTL) ? TRUE : FALSE;
- }
- else
- is_rtl = FALSE;
-
- /* Allocate child positions. */
- if (priv->orientation == CLUTTER_ORIENTATION_VERTICAL)
- {
- child_allocation.x1 = box->x1;
- child_allocation.x2 = MAX (1.0, box->x2);
- if (priv->is_pack_start)
- y = box->y2 - box->y1;
- else
- y = box->y1;
- }
- else
- {
- child_allocation.y1 = box->y1;
- child_allocation.y2 = MAX (1.0, box->y2);
- if (priv->is_pack_start)
- x = box->x2 - box->x1;
- else
- x = box->x1;
- }
-
- i = 0;
- clutter_actor_iter_init (&iter, actor);
- while (clutter_actor_iter_next (&iter, &child))
- {
- /* If widget is not visible, skip it. */
- if (!clutter_actor_is_visible (child))
- continue;
-
- /* Assign the child's size. */
- if (priv->is_homogeneous)
- {
- child_size = extra;
-
- if (n_extra_widgets > 0)
- {
- child_size++;
- n_extra_widgets--;
- }
- }
- else
- {
- child_size = sizes[i].minimum_size;
-
- if (clutter_actor_needs_expand (child, priv->orientation))
- {
- child_size += extra;
-
- if (n_extra_widgets > 0)
- {
- child_size++;
- n_extra_widgets--;
- }
- }
- }
-
- /* Assign the child's position. */
- if (priv->orientation == CLUTTER_ORIENTATION_VERTICAL)
- {
- if (clutter_actor_needs_expand (child, priv->orientation))
- {
- child_allocation.y1 = y;
- child_allocation.y2 = child_allocation.y1 + MAX (1.0, child_size);
- }
- else
- {
- child_allocation.y1 = y + (child_size - sizes[i].minimum_size) / 2;
- child_allocation.y2 = child_allocation.y1 + sizes[i].minimum_size;
- }
-
- if (priv->is_pack_start)
- {
- y -= child_size + priv->spacing;
-
- child_allocation.y1 -= child_size;
- child_allocation.y2 -= child_size;
- }
- else
- {
- y += child_size + priv->spacing;
- }
- }
- else /* CLUTTER_ORIENTATION_HORIZONTAL */
- {
- if (clutter_actor_needs_expand (child, priv->orientation))
- {
- child_allocation.x1 = x;
- child_allocation.x2 = child_allocation.x1 + MAX (1.0, child_size);
- }
- else
- {
- child_allocation.x1 = x + (child_size - sizes[i].minimum_size) / 2;
- child_allocation.x2 = child_allocation.x1 + sizes[i].minimum_size;
- }
-
- if (priv->is_pack_start)
- {
- x -= child_size + priv->spacing;
-
- child_allocation.x1 -= child_size;
- child_allocation.x2 -= child_size;
- }
- else
- {
- x += child_size + priv->spacing;
- }
-
- if (is_rtl)
- {
- gfloat width = child_allocation.x2 - child_allocation.x1;
-
- child_allocation.x2 = box->x1 + (box->x2 - child_allocation.x1);
- child_allocation.x1 = child_allocation.x2 - width;
- }
-
- }
-
- allocate_box_child (CLUTTER_BOX_LAYOUT (layout),
- container,
- child,
- &child_allocation);
-
- i += 1;
- }
-}
-
-static void
-clutter_box_layout_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterBoxLayout *self = CLUTTER_BOX_LAYOUT (gobject);
-
- switch (prop_id)
- {
- case PROP_ORIENTATION:
- clutter_box_layout_set_orientation (self, g_value_get_enum (value));
- break;
-
- case PROP_HOMOGENEOUS:
- clutter_box_layout_set_homogeneous (self, g_value_get_boolean (value));
- break;
-
- case PROP_SPACING:
- clutter_box_layout_set_spacing (self, g_value_get_uint (value));
- break;
-
- case PROP_PACK_START:
- clutter_box_layout_set_pack_start (self, g_value_get_boolean (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_box_layout_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterBoxLayoutPrivate *priv = CLUTTER_BOX_LAYOUT (gobject)->priv;
-
- switch (prop_id)
- {
- case PROP_ORIENTATION:
- g_value_set_enum (value, priv->orientation);
- break;
-
- case PROP_HOMOGENEOUS:
- g_value_set_boolean (value, priv->is_homogeneous);
- break;
-
- case PROP_SPACING:
- g_value_set_uint (value, priv->spacing);
- break;
-
- case PROP_PACK_START:
- g_value_set_boolean (value, priv->is_pack_start);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_box_layout_class_init (ClutterBoxLayoutClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- ClutterLayoutManagerClass *layout_class;
-
- layout_class = CLUTTER_LAYOUT_MANAGER_CLASS (klass);
-
- layout_class->get_preferred_width = clutter_box_layout_get_preferred_width;
- layout_class->get_preferred_height = clutter_box_layout_get_preferred_height;
- layout_class->allocate = clutter_box_layout_allocate;
- layout_class->set_container = clutter_box_layout_set_container;
-
- /**
- * ClutterBoxLayout:orientation:
- *
- * The orientation of the #ClutterBoxLayout, either horizontal
- * or vertical
- *
- * Since: 1.12
- */
- obj_props[PROP_ORIENTATION] =
- g_param_spec_enum ("orientation",
- P_("Orientation"),
- P_("The orientation of the layout"),
- CLUTTER_TYPE_ORIENTATION,
- CLUTTER_ORIENTATION_HORIZONTAL,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
-
- /**
- * ClutterBoxLayout:homogeneous:
- *
- * Whether the #ClutterBoxLayout should arrange its children
- * homogeneously, i.e. all children get the same size
- *
- * Since: 1.4
- */
- obj_props[PROP_HOMOGENEOUS] =
- g_param_spec_boolean ("homogeneous",
- P_("Homogeneous"),
- P_("Whether the layout should be homogeneous, "
- "i.e. all children get the same size"),
- FALSE,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterBoxLayout:pack-start:
- *
- * Whether the #ClutterBoxLayout should pack items at the start
- * or append them at the end
- *
- * Since: 1.2
- */
- obj_props[PROP_PACK_START] =
- g_param_spec_boolean ("pack-start",
- P_("Pack Start"),
- P_("Whether to pack items at the start of the box"),
- FALSE,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterBoxLayout:spacing:
- *
- * The spacing between children of the #ClutterBoxLayout, in pixels
- *
- * Since: 1.2
- */
- obj_props[PROP_SPACING] =
- g_param_spec_uint ("spacing",
- P_("Spacing"),
- P_("Spacing between children"),
- 0, G_MAXUINT, 0,
- CLUTTER_PARAM_READWRITE);
-
- gobject_class->set_property = clutter_box_layout_set_property;
- gobject_class->get_property = clutter_box_layout_get_property;
- g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
-}
-
-static void
-clutter_box_layout_init (ClutterBoxLayout *self)
-{
- self->priv = clutter_box_layout_get_instance_private (self);
-
- self->priv->orientation = CLUTTER_ORIENTATION_HORIZONTAL;
- self->priv->is_homogeneous = FALSE;
- self->priv->is_pack_start = FALSE;
- self->priv->spacing = 0;
-
- self->priv->easing_mode = CLUTTER_EASE_OUT_CUBIC;
- self->priv->easing_duration = 500;
-}
-
-/**
- * clutter_box_layout_new:
- *
- * Creates a new #ClutterBoxLayout layout manager
- *
- * Return value: the newly created #ClutterBoxLayout
- *
- * Since: 1.2
- */
-ClutterLayoutManager *
-clutter_box_layout_new (void)
-{
- return g_object_new (CLUTTER_TYPE_BOX_LAYOUT, NULL);
-}
-
-/**
- * clutter_box_layout_set_spacing:
- * @layout: a #ClutterBoxLayout
- * @spacing: the spacing between children of the layout, in pixels
- *
- * Sets the spacing between children of @layout
- *
- * Since: 1.2
- */
-void
-clutter_box_layout_set_spacing (ClutterBoxLayout *layout,
- guint spacing)
-{
- ClutterBoxLayoutPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_BOX_LAYOUT (layout));
-
- priv = layout->priv;
-
- if (priv->spacing != spacing)
- {
- ClutterLayoutManager *manager;
-
- priv->spacing = spacing;
-
- manager = CLUTTER_LAYOUT_MANAGER (layout);
-
- clutter_layout_manager_layout_changed (manager);
-
- g_object_notify (G_OBJECT (layout), "spacing");
- }
-}
-
-/**
- * clutter_box_layout_get_spacing:
- * @layout: a #ClutterBoxLayout
- *
- * Retrieves the spacing set using clutter_box_layout_set_spacing()
- *
- * Return value: the spacing between children of the #ClutterBoxLayout
- *
- * Since: 1.2
- */
-guint
-clutter_box_layout_get_spacing (ClutterBoxLayout *layout)
-{
- g_return_val_if_fail (CLUTTER_IS_BOX_LAYOUT (layout), 0);
-
- return layout->priv->spacing;
-}
-
-/**
- * clutter_box_layout_set_orientation:
- * @layout: a #ClutterBoxLayout
- * @orientation: the orientation of the #ClutterBoxLayout
- *
- * Sets the orientation of the #ClutterBoxLayout layout manager.
- *
- * Since: 1.12
- */
-void
-clutter_box_layout_set_orientation (ClutterBoxLayout *layout,
- ClutterOrientation orientation)
-{
- ClutterBoxLayoutPrivate *priv;
- ClutterLayoutManager *manager;
-
- g_return_if_fail (CLUTTER_IS_BOX_LAYOUT (layout));
-
- priv = layout->priv;
-
- if (priv->orientation == orientation)
- return;
-
- priv->orientation = orientation;
-
- manager = CLUTTER_LAYOUT_MANAGER (layout);
-
- clutter_layout_manager_layout_changed (manager);
-
- g_object_notify_by_pspec (G_OBJECT (layout), obj_props[PROP_ORIENTATION]);
-}
-
-/**
- * clutter_box_layout_get_orientation:
- * @layout: a #ClutterBoxLayout
- *
- * Retrieves the orientation of the @layout.
- *
- * Return value: the orientation of the layout
- *
- * Since: 1.12
- */
-ClutterOrientation
-clutter_box_layout_get_orientation (ClutterBoxLayout *layout)
-{
- g_return_val_if_fail (CLUTTER_IS_BOX_LAYOUT (layout),
- CLUTTER_ORIENTATION_HORIZONTAL);
-
- return layout->priv->orientation;
-}
-
-/**
- * clutter_box_layout_set_homogeneous:
- * @layout: a #ClutterBoxLayout
- * @homogeneous: %TRUE if the layout should be homogeneous
- *
- * Sets whether the size of @layout children should be
- * homogeneous
- *
- * Since: 1.4
- */
-void
-clutter_box_layout_set_homogeneous (ClutterBoxLayout *layout,
- gboolean homogeneous)
-{
- ClutterBoxLayoutPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_BOX_LAYOUT (layout));
-
- priv = layout->priv;
-
- if (priv->is_homogeneous != homogeneous)
- {
- ClutterLayoutManager *manager;
-
- priv->is_homogeneous = !!homogeneous;
-
- manager = CLUTTER_LAYOUT_MANAGER (layout);
-
- clutter_layout_manager_layout_changed (manager);
-
- g_object_notify (G_OBJECT (layout), "homogeneous");
- }
-}
-
-/**
- * clutter_box_layout_get_homogeneous:
- * @layout: a #ClutterBoxLayout
- *
- * Retrieves if the children sizes are allocated homogeneously.
- *
- * Return value: %TRUE if the #ClutterBoxLayout is arranging its children
- * homogeneously, and %FALSE otherwise
- *
- * Since: 1.4
- */
-gboolean
-clutter_box_layout_get_homogeneous (ClutterBoxLayout *layout)
-{
- g_return_val_if_fail (CLUTTER_IS_BOX_LAYOUT (layout), FALSE);
-
- return layout->priv->is_homogeneous;
-}
-
-/**
- * clutter_box_layout_set_pack_start:
- * @layout: a #ClutterBoxLayout
- * @pack_start: %TRUE if the @layout should pack children at the
- * beginning of the layout
- *
- * Sets whether children of @layout should be laid out by appending
- * them or by prepending them
- *
- * Since: 1.2
- */
-void
-clutter_box_layout_set_pack_start (ClutterBoxLayout *layout,
- gboolean pack_start)
-{
- ClutterBoxLayoutPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_BOX_LAYOUT (layout));
-
- priv = layout->priv;
-
- if (priv->is_pack_start != pack_start)
- {
- ClutterLayoutManager *manager;
-
- priv->is_pack_start = pack_start ? TRUE : FALSE;
-
- manager = CLUTTER_LAYOUT_MANAGER (layout);
-
- clutter_layout_manager_layout_changed (manager);
-
- g_object_notify (G_OBJECT (layout), "pack-start");
- }
-}
-
-/**
- * clutter_box_layout_get_pack_start:
- * @layout: a #ClutterBoxLayout
- *
- * Retrieves the value set using clutter_box_layout_set_pack_start()
- *
- * Return value: %TRUE if the #ClutterBoxLayout should pack children
- * at the beginning of the layout, and %FALSE otherwise
- *
- * Since: 1.2
- */
-gboolean
-clutter_box_layout_get_pack_start (ClutterBoxLayout *layout)
-{
- g_return_val_if_fail (CLUTTER_IS_BOX_LAYOUT (layout), FALSE);
-
- return layout->priv->is_pack_start;
-}
diff --git a/clutter/clutter/clutter-box-layout.h b/clutter/clutter/clutter-box-layout.h
deleted file mode 100644
index 92c0476e1..000000000
--- a/clutter/clutter/clutter-box-layout.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2009 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- *
- * Based on the NBTK NbtkBoxLayout actor by:
- * Thomas Wood <thomas.wood@intel.com>
- */
-
-#ifndef __CLUTTER_BOX_LAYOUT_H__
-#define __CLUTTER_BOX_LAYOUT_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-layout-manager.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_BOX_LAYOUT (clutter_box_layout_get_type ())
-#define CLUTTER_BOX_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BOX_LAYOUT, ClutterBoxLayout))
-#define CLUTTER_IS_BOX_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BOX_LAYOUT))
-#define CLUTTER_BOX_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BOX_LAYOUT, ClutterBoxLayoutClass))
-#define CLUTTER_IS_BOX_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BOX_LAYOUT))
-#define CLUTTER_BOX_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BOX_LAYOUT, ClutterBoxLayoutClass))
-
-typedef struct _ClutterBoxLayout ClutterBoxLayout;
-typedef struct _ClutterBoxLayoutPrivate ClutterBoxLayoutPrivate;
-typedef struct _ClutterBoxLayoutClass ClutterBoxLayoutClass;
-
-/**
- * ClutterBoxLayout:
- *
- * The #ClutterBoxLayout structure contains only private data
- * and should be accessed using the provided API
- *
- * Since: 1.2
- */
-struct _ClutterBoxLayout
-{
- /*< private >*/
- ClutterLayoutManager parent_instance;
-
- ClutterBoxLayoutPrivate *priv;
-};
-
-/**
- * ClutterBoxLayoutClass:
- *
- * The #ClutterBoxLayoutClass structure contains only private
- * data and should be accessed using the provided API
- *
- * Since: 1.2
- */
-struct _ClutterBoxLayoutClass
-{
- /*< private >*/
- ClutterLayoutManagerClass parent_class;
-};
-
-CLUTTER_EXPORT
-GType clutter_box_layout_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterLayoutManager * clutter_box_layout_new (void);
-
-CLUTTER_EXPORT
-void clutter_box_layout_set_orientation (ClutterBoxLayout *layout,
- ClutterOrientation orientation);
-CLUTTER_EXPORT
-ClutterOrientation clutter_box_layout_get_orientation (ClutterBoxLayout *layout);
-
-CLUTTER_EXPORT
-void clutter_box_layout_set_spacing (ClutterBoxLayout *layout,
- guint spacing);
-CLUTTER_EXPORT
-guint clutter_box_layout_get_spacing (ClutterBoxLayout *layout);
-CLUTTER_EXPORT
-void clutter_box_layout_set_homogeneous (ClutterBoxLayout *layout,
- gboolean homogeneous);
-CLUTTER_EXPORT
-gboolean clutter_box_layout_get_homogeneous (ClutterBoxLayout *layout);
-CLUTTER_EXPORT
-void clutter_box_layout_set_pack_start (ClutterBoxLayout *layout,
- gboolean pack_start);
-CLUTTER_EXPORT
-gboolean clutter_box_layout_get_pack_start (ClutterBoxLayout *layout);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_BOX_LAYOUT_H__ */
diff --git a/clutter/clutter/clutter-brightness-contrast-effect.c b/clutter/clutter/clutter-brightness-contrast-effect.c
deleted file mode 100644
index 4f0ce2e5e..000000000
--- a/clutter/clutter/clutter-brightness-contrast-effect.c
+++ /dev/null
@@ -1,623 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010-2012 Inclusive Design Research Centre, OCAD University.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Joseph Scheuhammer <clown@alum.mit.edu>
- */
-
-/**
- * SECTION:clutter-brightness-contrast-effect
- * @short_description: Increase/decrease brightness and/or contrast of actor.
- * @see_also: #ClutterEffect, #ClutterOffscreenEffect
- *
- * #ClutterBrightnessContrastEffect is a sub-class of #ClutterEffect that
- * changes the overall brightness of a #ClutterActor.
- *
- * #ClutterBrightnessContrastEffect is available since Clutter 1.10
- */
-
-#define CLUTTER_BRIGHTNESS_CONTRAST_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BRIGHTNESS_CONTRAST_EFFECT, ClutterBrightnessContrastEffectClass))
-#define CLUTTER_IS_BRIGHTNESS_CONTRAST_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BRIGHTNESS_CONTRAST_EFFECT))
-#define CLUTTER_BRIGHTNESS_CONTRAST_EFFECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BRIGHTNESS_CONTRAST_EFFECT, ClutterBrightnessContrastEffectClass))
-
-#include "clutter-build-config.h"
-
-#include <math.h>
-
-#include "clutter-brightness-contrast-effect.h"
-
-#include <cogl/cogl.h>
-
-#include "clutter-debug.h"
-#include "clutter-enum-types.h"
-#include "clutter-offscreen-effect.h"
-#include "clutter-private.h"
-
-struct _ClutterBrightnessContrastEffect
-{
- ClutterOffscreenEffect parent_instance;
-
- /* Brightness and contrast changes. */
- gfloat brightness_red;
- gfloat brightness_green;
- gfloat brightness_blue;
-
- gfloat contrast_red;
- gfloat contrast_green;
- gfloat contrast_blue;
-
- gint brightness_multiplier_uniform;
- gint brightness_offset_uniform;
- gint contrast_uniform;
-
- CoglPipeline *pipeline;
-};
-
-struct _ClutterBrightnessContrastEffectClass
-{
- ClutterOffscreenEffectClass parent_class;
-
- CoglPipeline *base_pipeline;
-};
-
-/* Brightness effects in GLSL.
- */
-static const gchar *brightness_contrast_decls =
- "uniform vec3 brightness_multiplier;\n"
- "uniform vec3 brightness_offset;\n"
- "uniform vec3 contrast;\n";
-
-static const gchar *brightness_contrast_source =
- /* Apply the brightness. The brightness_offset is multiplied by the
- alpha to keep the color pre-multiplied */
- "cogl_color_out.rgb = (cogl_color_out.rgb * brightness_multiplier +\n"
- " brightness_offset * cogl_color_out.a);\n"
- /* Apply the contrast */
- "cogl_color_out.rgb = ((cogl_color_out.rgb - 0.5 * cogl_color_out.a) *\n"
- " contrast + 0.5 * cogl_color_out.a);\n";
-
-static const ClutterColor no_brightness_change = { 0x7f, 0x7f, 0x7f, 0xff };
-static const ClutterColor no_contrast_change = { 0x7f, 0x7f, 0x7f, 0xff };
-static const gfloat no_change = 0.0f;
-
-enum
-{
- PROP_0,
-
- PROP_BRIGHTNESS,
- PROP_CONTRAST,
-
- PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST];
-
-G_DEFINE_TYPE (ClutterBrightnessContrastEffect,
- clutter_brightness_contrast_effect,
- CLUTTER_TYPE_OFFSCREEN_EFFECT);
-
-static gboolean
-will_have_no_effect (ClutterBrightnessContrastEffect *self)
-{
- return (G_APPROX_VALUE (self->brightness_red, no_change, FLT_EPSILON) &&
- G_APPROX_VALUE (self->brightness_green, no_change, FLT_EPSILON) &&
- G_APPROX_VALUE (self->brightness_blue, no_change, FLT_EPSILON) &&
- G_APPROX_VALUE (self->contrast_red, no_change, FLT_EPSILON) &&
- G_APPROX_VALUE (self->contrast_green, no_change, FLT_EPSILON) &&
- G_APPROX_VALUE (self->contrast_blue, no_change, FLT_EPSILON));
-}
-
-static CoglPipeline *
-clutter_brightness_contrast_effect_create_pipeline (ClutterOffscreenEffect *effect,
- CoglTexture *texture)
-{
- ClutterBrightnessContrastEffect *self =
- CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (effect);
-
- cogl_pipeline_set_layer_texture (self->pipeline, 0, texture);
-
- return cogl_object_ref (self->pipeline);
-}
-
-static gboolean
-clutter_brightness_contrast_effect_pre_paint (ClutterEffect *effect,
- ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- ClutterBrightnessContrastEffect *self = CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (effect);
- ClutterEffectClass *parent_class;
-
- if (will_have_no_effect (self))
- return FALSE;
-
- if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
- {
- /* if we don't have support for GLSL shaders then we
- * forcibly disable the ActorMeta
- */
- g_warning ("Unable to use the ClutterBrightnessContrastEffect: the "
- "graphics hardware or the current GL driver does not "
- "implement support for the GLSL shading language. The "
- "effect will be disabled.");
- clutter_actor_meta_set_enabled (CLUTTER_ACTOR_META (effect), FALSE);
- return FALSE;
- }
-
- parent_class =
- CLUTTER_EFFECT_CLASS (clutter_brightness_contrast_effect_parent_class);
-
- return parent_class->pre_paint (effect, node, paint_context);
-}
-
-static void
-clutter_brightness_contrast_effect_dispose (GObject *gobject)
-{
- ClutterBrightnessContrastEffect *self = CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (gobject);
-
- if (self->pipeline != NULL)
- {
- cogl_object_unref (self->pipeline);
- self->pipeline = NULL;
- }
-
- G_OBJECT_CLASS (clutter_brightness_contrast_effect_parent_class)->dispose (gobject);
-}
-
-static void
-clutter_brightness_contrast_effect_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterBrightnessContrastEffect *effect = CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (gobject);
-
- switch (prop_id)
- {
- case PROP_BRIGHTNESS:
- {
- const ClutterColor *color = clutter_value_get_color (value);
- clutter_brightness_contrast_effect_set_brightness_full (effect,
- color->red / 127.0f - 1.0f,
- color->green / 127.0f - 1.0f,
- color->blue / 127.0f - 1.0f);
- }
- break;
-
- case PROP_CONTRAST:
- {
- const ClutterColor *color = clutter_value_get_color (value);
- clutter_brightness_contrast_effect_set_contrast_full (effect,
- color->red / 127.0f - 1.0f,
- color->green / 127.0f - 1.0f,
- color->blue / 127.0f - 1.0f);
- }
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_brightness_contrast_effect_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterBrightnessContrastEffect *effect = CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (gobject);
- ClutterColor color;
-
- switch (prop_id)
- {
- case PROP_BRIGHTNESS:
- {
- color.red = (effect->brightness_red + 1.0f) * 127.0f;
- color.green = (effect->brightness_green + 1.0f) * 127.0f;
- color.blue = (effect->brightness_blue + 1.0f) * 127.0f;
- color.alpha = 0xff;
-
- clutter_value_set_color (value, &color);
- }
- break;
-
- case PROP_CONTRAST:
- {
- color.red = (effect->contrast_red + 1.0f) * 127.0f;
- color.green = (effect->contrast_green + 1.0f) * 127.0f;
- color.blue = (effect->contrast_blue + 1.0f) * 127.0f;
- color.alpha = 0xff;
-
- clutter_value_set_color (value, &color);
- }
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_brightness_contrast_effect_class_init (ClutterBrightnessContrastEffectClass *klass)
-{
- ClutterEffectClass *effect_class = CLUTTER_EFFECT_CLASS (klass);
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- ClutterOffscreenEffectClass *offscreen_class;
-
- offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass);
- offscreen_class->create_pipeline = clutter_brightness_contrast_effect_create_pipeline;
-
- effect_class->pre_paint = clutter_brightness_contrast_effect_pre_paint;
-
- gobject_class->set_property = clutter_brightness_contrast_effect_set_property;
- gobject_class->get_property = clutter_brightness_contrast_effect_get_property;
- gobject_class->dispose = clutter_brightness_contrast_effect_dispose;
-
- /**
- * ClutterBrightnessContrastEffect:brightness:
- *
- * The brightness change to apply to the effect.
- *
- * This property uses a #ClutterColor to represent the changes to each
- * color channel. The range is [ 0, 255 ], with 127 as the value used
- * to indicate no change; values smaller than 127 indicate a decrease
- * in brightness, and values larger than 127 indicate an increase in
- * brightness.
- *
- * Since: 1.10
- */
- obj_props[PROP_BRIGHTNESS] =
- clutter_param_spec_color ("brightness",
- P_("Brightness"),
- P_("The brightness change to apply"),
- &no_brightness_change,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterBrightnessContrastEffect:contrast:
- *
- * The contrast change to apply to the effect.
- *
- * This property uses a #ClutterColor to represent the changes to each
- * color channel. The range is [ 0, 255 ], with 127 as the value used
- * to indicate no change; values smaller than 127 indicate a decrease
- * in contrast, and values larger than 127 indicate an increase in
- * contrast.
- *
- * Since: 1.10
- */
- obj_props[PROP_CONTRAST] =
- clutter_param_spec_color ("contrast",
- P_("Contrast"),
- P_("The contrast change to apply"),
- &no_contrast_change,
- CLUTTER_PARAM_READWRITE);
-
- g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
-}
-
-static void
-get_brightness_values (gfloat value,
- gfloat *multiplier,
- gfloat *offset)
-{
- if (value < 0.0f)
- {
- *multiplier = 1.0f + value;
- *offset = 0.0f;
- }
- else
- {
- *multiplier = 1.0f - value;
- *offset = value;
- }
-}
-
-static inline void
-update_uniforms (ClutterBrightnessContrastEffect *self)
-{
- if (self->brightness_multiplier_uniform > -1 &&
- self->brightness_offset_uniform > -1)
- {
- float brightness_multiplier[3];
- float brightness_offset[3];
-
- get_brightness_values (self->brightness_red,
- brightness_multiplier + 0,
- brightness_offset + 0);
- get_brightness_values (self->brightness_green,
- brightness_multiplier + 1,
- brightness_offset + 1);
- get_brightness_values (self->brightness_blue,
- brightness_multiplier + 2,
- brightness_offset + 2);
-
- cogl_pipeline_set_uniform_float (self->pipeline,
- self->brightness_multiplier_uniform,
- 3, /* n_components */
- 1, /* count */
- brightness_multiplier);
- cogl_pipeline_set_uniform_float (self->pipeline,
- self->brightness_offset_uniform,
- 3, /* n_components */
- 1, /* count */
- brightness_offset);
- }
-
- if (self->contrast_uniform > -1)
- {
- float contrast[3] = {
- tan ((self->contrast_red + 1) * G_PI_4),
- tan ((self->contrast_green + 1) * G_PI_4),
- tan ((self->contrast_blue + 1) * G_PI_4)
- };
-
- cogl_pipeline_set_uniform_float (self->pipeline,
- self->contrast_uniform,
- 3, /* n_components */
- 1, /* count */
- contrast);
- }
-}
-
-static void
-clutter_brightness_contrast_effect_init (ClutterBrightnessContrastEffect *self)
-{
- ClutterBrightnessContrastEffectClass *klass;
-
- self->brightness_red = no_change;
- self->brightness_green = no_change;
- self->brightness_blue = no_change;
-
- self->contrast_red = no_change;
- self->contrast_green = no_change;
- self->contrast_blue = no_change;
-
- klass = CLUTTER_BRIGHTNESS_CONTRAST_EFFECT_GET_CLASS (self);
-
- if (G_UNLIKELY (klass->base_pipeline == NULL))
- {
- CoglSnippet *snippet;
- CoglContext *ctx =
- clutter_backend_get_cogl_context (clutter_get_default_backend ());
-
- klass->base_pipeline = cogl_pipeline_new (ctx);
-
- snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT,
- brightness_contrast_decls,
- brightness_contrast_source);
- cogl_pipeline_add_snippet (klass->base_pipeline, snippet);
- cogl_object_unref (snippet);
-
- cogl_pipeline_set_layer_null_texture (klass->base_pipeline, 0);
- }
-
- self->pipeline = cogl_pipeline_copy (klass->base_pipeline);
-
- self->brightness_multiplier_uniform =
- cogl_pipeline_get_uniform_location (self->pipeline,
- "brightness_multiplier");
- self->brightness_offset_uniform =
- cogl_pipeline_get_uniform_location (self->pipeline,
- "brightness_offset");
- self->contrast_uniform =
- cogl_pipeline_get_uniform_location (self->pipeline, "contrast");
-
- update_uniforms (self);
-}
-
-/**
- * clutter_brightness_contrast_effect_new:
- *
- * Creates a new #ClutterBrightnessContrastEffect to be used with
- * clutter_actor_add_effect()
- *
- * Return value: (transfer full): the newly created
- * #ClutterBrightnessContrastEffect or %NULL. Use g_object_unref() when
- * done.
- *
- * Since: 1.10
- */
-ClutterEffect *
-clutter_brightness_contrast_effect_new (void)
-{
- return g_object_new (CLUTTER_TYPE_BRIGHTNESS_CONTRAST_EFFECT, NULL);
-}
-
-/**
- * clutter_brightness_contrast_effect_set_brightness_full:
- * @effect: a #ClutterBrightnessContrastEffect
- * @red: red component of the change in brightness
- * @green: green component of the change in brightness
- * @blue: blue component of the change in brightness
- *
- * The range for each component is [-1.0, 1.0] where 0.0 designates no change,
- * values below 0.0 mean a decrease in brightness, and values above indicate
- * an increase.
- *
- * Since: 1.10
- */
-void
-clutter_brightness_contrast_effect_set_brightness_full (ClutterBrightnessContrastEffect *effect,
- gfloat red,
- gfloat green,
- gfloat blue)
-{
- g_return_if_fail (CLUTTER_IS_BRIGHTNESS_CONTRAST_EFFECT (effect));
-
- if (G_APPROX_VALUE (red, effect->brightness_red, FLT_EPSILON) &&
- G_APPROX_VALUE (green, effect->brightness_green, FLT_EPSILON) &&
- G_APPROX_VALUE (blue, effect->brightness_blue, FLT_EPSILON))
- return;
-
- effect->brightness_red = red;
- effect->brightness_green = green;
- effect->brightness_blue = blue;
-
- update_uniforms (effect);
-
- clutter_effect_queue_repaint (CLUTTER_EFFECT (effect));
-
- g_object_notify_by_pspec (G_OBJECT (effect), obj_props[PROP_BRIGHTNESS]);
-}
-
-/**
- * clutter_brightness_contrast_effect_get_brightness:
- * @effect: a #ClutterBrightnessContrastEffect
- * @red: (out) (allow-none): return location for red component of the
- * change in brightness
- * @green: (out) (allow-none): return location for green component of the
- * change in brightness
- * @blue: (out) (allow-none): return location for blue component of the
- * change in brightness
- *
- * Retrieves the change in brightness used by @effect.
- *
- * Since: 1.10
- */
-void
-clutter_brightness_contrast_effect_get_brightness (ClutterBrightnessContrastEffect *effect,
- gfloat *red,
- gfloat *green,
- gfloat *blue)
-{
- g_return_if_fail (CLUTTER_IS_BRIGHTNESS_CONTRAST_EFFECT (effect));
-
- if (red != NULL)
- *red = effect->brightness_red;
-
- if (green != NULL)
- *green = effect->brightness_green;
-
- if (blue != NULL)
- *blue = effect->brightness_blue;
-}
-
-/**
- * clutter_brightness_contrast_effect_set_brightness:
- * @effect: a #ClutterBrightnessContrastEffect
- * @brightness: the brightness change for all three components (r, g, b)
- *
- * The range of @brightness is [-1.0, 1.0], where 0.0 designates no change;
- * a value below 0.0 indicates a decrease in brightness; and a value
- * above 0.0 indicates an increase of brightness.
- *
- * Since: 1.10
- */
-void
-clutter_brightness_contrast_effect_set_brightness (ClutterBrightnessContrastEffect *effect,
- gfloat brightness)
-{
- clutter_brightness_contrast_effect_set_brightness_full (effect,
- brightness,
- brightness,
- brightness);
-}
-
-/**
- * clutter_brightness_contrast_effect_set_contrast_full:
- * @effect: a #ClutterBrightnessContrastEffect
- * @red: red component of the change in contrast
- * @green: green component of the change in contrast
- * @blue: blue component of the change in contrast
- *
- * The range for each component is [-1.0, 1.0] where 0.0 designates no change,
- * values below 0.0 mean a decrease in contrast, and values above indicate
- * an increase.
- *
- * Since: 1.10
- */
-void
-clutter_brightness_contrast_effect_set_contrast_full (ClutterBrightnessContrastEffect *effect,
- gfloat red,
- gfloat green,
- gfloat blue)
-{
- g_return_if_fail (CLUTTER_IS_BRIGHTNESS_CONTRAST_EFFECT (effect));
-
- if (G_APPROX_VALUE (red, effect->contrast_red, FLT_EPSILON) &&
- G_APPROX_VALUE (green, effect->contrast_green, FLT_EPSILON) &&
- G_APPROX_VALUE (blue, effect->contrast_blue, FLT_EPSILON))
- return;
-
- effect->contrast_red = red;
- effect->contrast_green = green;
- effect->contrast_blue = blue;
-
- update_uniforms (effect);
-
- clutter_effect_queue_repaint (CLUTTER_EFFECT (effect));
-
- g_object_notify_by_pspec (G_OBJECT (effect), obj_props[PROP_CONTRAST]);
-}
-
-/**
- * clutter_brightness_contrast_effect_get_contrast:
- * @effect: a #ClutterBrightnessContrastEffect
- * @red: (out) (allow-none): return location for red component of the
- * change in contrast
- * @green: (out) (allow-none): return location for green component of the
- * change in contrast
- * @blue: (out) (allow-none): return location for blue component of the
- * change in contrast
- *
- * Retrieves the contrast value used by @effect.
- *
- * Since: 1.10
- */
-void
-clutter_brightness_contrast_effect_get_contrast (ClutterBrightnessContrastEffect *effect,
- gfloat *red,
- gfloat *green,
- gfloat *blue)
-{
- g_return_if_fail (CLUTTER_IS_BRIGHTNESS_CONTRAST_EFFECT (effect));
-
- if (red != NULL)
- *red = effect->contrast_red;
-
- if (green != NULL)
- *green = effect->contrast_green;
-
- if (blue != NULL)
- *blue = effect->contrast_blue;
-}
-
-/**
- * clutter_brightness_contrast_effect_set_contrast:
- * @effect: a #ClutterBrightnessContrastEffect
- * @contrast: contrast change for all three channels
- *
- * The range for @contrast is [-1.0, 1.0], where 0.0 designates no change;
- * a value below 0.0 indicates a decrease in contrast; and a value above
- * 0.0 indicates an increase.
- *
- * Since: 1.10
- */
-void
-clutter_brightness_contrast_effect_set_contrast (ClutterBrightnessContrastEffect *effect,
- gfloat contrast)
-{
- clutter_brightness_contrast_effect_set_contrast_full (effect,
- contrast,
- contrast,
- contrast);
-}
diff --git a/clutter/clutter/clutter-brightness-contrast-effect.h b/clutter/clutter/clutter-brightness-contrast-effect.h
deleted file mode 100644
index d474ed5b8..000000000
--- a/clutter/clutter/clutter-brightness-contrast-effect.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010-2012 Inclusive Design Research Centre, OCAD University.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Joseph Scheuhammer <clown@alum.mit.edu>
- */
-
-#ifndef __CLUTTER_BRIGHTNESS_CONTRAST_EFFECT_H__
-#define __CLUTTER_BRIGHTNESS_CONTRAST_EFFECT_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-color.h>
-#include <clutter/clutter-effect.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_BRIGHTNESS_CONTRAST_EFFECT (clutter_brightness_contrast_effect_get_type ())
-#define CLUTTER_BRIGHTNESS_CONTRAST_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BRIGHTNESS_CONTRAST_EFFECT, ClutterBrightnessContrastEffect))
-#define CLUTTER_IS_BRIGHTNESS_CONTRAST_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BRIGHTNESS_CONTRAST_EFFECT))
-
-/**
- * ClutterBrightnessContrastEffect:
- *
- * #ClutterBrightnessContrastEffect is an opaque structure
- * whose members cannot be directly accessed
- *
- * Since: 1.10
- */
-typedef struct _ClutterBrightnessContrastEffect ClutterBrightnessContrastEffect;
-typedef struct _ClutterBrightnessContrastEffectClass ClutterBrightnessContrastEffectClass;
-
-CLUTTER_EXPORT
-GType clutter_brightness_contrast_effect_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterEffect * clutter_brightness_contrast_effect_new (void);
-
-CLUTTER_EXPORT
-void clutter_brightness_contrast_effect_set_brightness_full (ClutterBrightnessContrastEffect *effect,
- float red,
- float green,
- float blue);
-CLUTTER_EXPORT
-void clutter_brightness_contrast_effect_set_brightness (ClutterBrightnessContrastEffect *effect,
- float brightness);
-CLUTTER_EXPORT
-void clutter_brightness_contrast_effect_get_brightness (ClutterBrightnessContrastEffect *effect,
- float *red,
- float *green,
- float *blue);
-
-CLUTTER_EXPORT
-void clutter_brightness_contrast_effect_set_contrast_full (ClutterBrightnessContrastEffect *effect,
- float red,
- float green,
- float blue);
-CLUTTER_EXPORT
-void clutter_brightness_contrast_effect_set_contrast (ClutterBrightnessContrastEffect *effect,
- float contrast);
-CLUTTER_EXPORT
-void clutter_brightness_contrast_effect_get_contrast (ClutterBrightnessContrastEffect *effect,
- float *red,
- float *green,
- float *blue);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_BRIGHTNESS_CONTRAST_EFFECT_H__ */
diff --git a/clutter/clutter/clutter-build-config.h.meson b/clutter/clutter/clutter-build-config.h.meson
deleted file mode 100644
index 7ca19deab..000000000
--- a/clutter/clutter/clutter-build-config.h.meson
+++ /dev/null
@@ -1,8 +0,0 @@
-/* Mutter version */
-#mesondefine MUTTER_VERSION
-
-/* List of Cogl drivers */
-#mesondefine CLUTTER_DRIVERS
-
-/* Supports PangoFt2 */
-#mesondefine HAVE_PANGO_FT2
diff --git a/clutter/clutter/clutter-cairo.c b/clutter/clutter/clutter-cairo.c
deleted file mode 100644
index 164eac310..000000000
--- a/clutter/clutter/clutter-cairo.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2012 Intel Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * SECTION:clutter-cairo
- * @Title: Cairo integration
- * @Short_Description: Functions for interoperating with Cairo
- *
- * Clutter provides some utility functions for using Cairo.
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-cairo.h"
-#include "clutter-color.h"
-
-/**
- * clutter_cairo_set_source_color:
- * @cr: a Cairo context
- * @color: a #ClutterColor
- *
- * Utility function for setting the source color of @cr using
- * a #ClutterColor. This function is the equivalent of:
- *
- * |[
- * cairo_set_source_rgba (cr,
- * color->red / 255.0,
- * color->green / 255.0,
- * color->blue / 255.0,
- * color->alpha / 255.0);
- * ]|
- *
- * Since: 1.0
- */
-void
-clutter_cairo_set_source_color (cairo_t *cr,
- const ClutterColor *color)
-{
- g_return_if_fail (cr != NULL);
- g_return_if_fail (color != NULL);
-
- if (color->alpha == 0xff)
- cairo_set_source_rgb (cr,
- color->red / 255.0,
- color->green / 255.0,
- color->blue / 255.0);
- else
- cairo_set_source_rgba (cr,
- color->red / 255.0,
- color->green / 255.0,
- color->blue / 255.0,
- color->alpha / 255.0);
-}
-
-/**
- * clutter_cairo_clear:
- * @cr: a Cairo context
- *
- * Utility function to clear a Cairo context.
- *
- * Since: 1.12
- */
-void
-clutter_cairo_clear (cairo_t *cr)
-{
- cairo_save (cr);
-
- cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
- cairo_paint (cr);
-
- cairo_restore (cr);
-}
diff --git a/clutter/clutter/clutter-cairo.h b/clutter/clutter/clutter-cairo.h
deleted file mode 100644
index 5fba04d10..000000000
--- a/clutter/clutter/clutter-cairo.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2012 Intel Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __CLUTTER_CAIRO_H__
-#define __CLUTTER_CAIRO_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-types.h>
-
-G_BEGIN_DECLS
-
-/**
- * CLUTTER_CAIRO_FORMAT_ARGB32:
- *
- * The #CoglPixelFormat to be used when uploading image data from
- * and to a Cairo image surface using %CAIRO_FORMAT_ARGB32 and
- * %CAIRO_FORMAT_RGB24 as #cairo_format_t.
- *
- * Since: 1.8
- */
-
-/* Cairo stores the data in native byte order as ARGB but Cogl's pixel
- * formats specify the actual byte order. Therefore we need to use a
- * different format depending on the architecture
- */
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
-#define CLUTTER_CAIRO_FORMAT_ARGB32 (COGL_PIXEL_FORMAT_BGRA_8888_PRE)
-#else
-#define CLUTTER_CAIRO_FORMAT_ARGB32 (COGL_PIXEL_FORMAT_ARGB_8888_PRE)
-#endif
-
-CLUTTER_EXPORT
-void clutter_cairo_clear (cairo_t *cr);
-CLUTTER_EXPORT
-void clutter_cairo_set_source_color (cairo_t *cr,
- const ClutterColor *color);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_CAIRO_H__ */
diff --git a/clutter/clutter/clutter-canvas.c b/clutter/clutter/clutter-canvas.c
deleted file mode 100644
index 220daa7b2..000000000
--- a/clutter/clutter/clutter-canvas.c
+++ /dev/null
@@ -1,644 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2012 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-canvas
- * @Title: ClutterCanvas
- * @Short_Description: Content for 2D painting
- * @See_Also: #ClutterContent
- *
- * The #ClutterCanvas class is a #ClutterContent implementation that allows
- * drawing using the Cairo API on a 2D surface.
- *
- * In order to draw on a #ClutterCanvas, you should connect a handler to the
- * #ClutterCanvas::draw signal; the signal will receive a #cairo_t context
- * that can be used to draw. #ClutterCanvas will emit the #ClutterCanvas::draw
- * signal when invalidated using clutter_content_invalidate().
- *
- * See [canvas.c](https://git.gnome.org/browse/clutter/tree/examples/canvas.c?h=clutter-1.18)
- * for an example of how to use #ClutterCanvas.
- *
- * #ClutterCanvas is available since Clutter 1.10.
- */
-
-#include "clutter-build-config.h"
-
-#include <math.h>
-#include <cogl/cogl.h>
-#include <cairo-gobject.h>
-
-#include "clutter-canvas.h"
-
-#include "clutter-actor-private.h"
-#include "clutter-backend.h"
-#include "clutter-cairo.h"
-#include "clutter-color.h"
-#include "clutter-content-private.h"
-#include "clutter-debug.h"
-#include "clutter-marshal.h"
-#include "clutter-paint-node.h"
-#include "clutter-paint-nodes.h"
-#include "clutter-private.h"
-#include "clutter-settings.h"
-
-struct _ClutterCanvasPrivate
-{
- cairo_t *cr;
-
- int width;
- int height;
- float scale_factor;
-
- CoglTexture *texture;
- gboolean dirty;
-
- CoglBitmap *buffer;
-};
-
-enum
-{
- PROP_0,
-
- PROP_WIDTH,
- PROP_HEIGHT,
- PROP_SCALE_FACTOR,
-
- LAST_PROP
-};
-
-static GParamSpec *obj_props[LAST_PROP] = { NULL, };
-
-enum
-{
- DRAW,
-
- LAST_SIGNAL
-};
-
-static guint canvas_signals[LAST_SIGNAL] = { 0, };
-
-static void clutter_content_iface_init (ClutterContentInterface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (ClutterCanvas, clutter_canvas, G_TYPE_OBJECT,
- G_ADD_PRIVATE (ClutterCanvas)
- G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTENT,
- clutter_content_iface_init))
-
-static void
-clutter_cairo_context_draw_marshaller (GClosure *closure,
- GValue *return_value,
- guint n_param_values,
- const GValue *param_values,
- gpointer invocation_hint,
- gpointer marshal_data)
-{
- cairo_t *cr = g_value_get_boxed (&param_values[1]);
-
- cairo_save (cr);
-
- _clutter_marshal_BOOLEAN__BOXED_INT_INT (closure,
- return_value,
- n_param_values,
- param_values,
- invocation_hint,
- marshal_data);
-
- cairo_restore (cr);
-}
-
-static void
-clutter_canvas_finalize (GObject *gobject)
-{
- ClutterCanvasPrivate *priv = CLUTTER_CANVAS (gobject)->priv;
-
- if (priv->buffer != NULL)
- {
- cogl_object_unref (priv->buffer);
- priv->buffer = NULL;
- }
-
- g_clear_pointer (&priv->texture, cogl_object_unref);
-
- G_OBJECT_CLASS (clutter_canvas_parent_class)->finalize (gobject);
-}
-
-static void
-clutter_canvas_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterCanvasPrivate *priv = CLUTTER_CANVAS (gobject)->priv;
-
- switch (prop_id)
- {
- case PROP_WIDTH:
- {
- gint new_size = g_value_get_int (value);
-
- if (priv->width != new_size)
- {
- priv->width = new_size;
-
- clutter_content_invalidate (CLUTTER_CONTENT (gobject));
- }
- }
- break;
-
- case PROP_HEIGHT:
- {
- gint new_size = g_value_get_int (value);
-
- if (priv->height != new_size)
- {
- priv->height = new_size;
-
- clutter_content_invalidate (CLUTTER_CONTENT (gobject));
- }
- }
- break;
-
- case PROP_SCALE_FACTOR:
- {
- gfloat new_scale_factor = g_value_get_float (value);
-
- if (priv->scale_factor != new_scale_factor)
- {
- priv->scale_factor = new_scale_factor;
-
- clutter_content_invalidate (CLUTTER_CONTENT (gobject));
- }
- }
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_canvas_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterCanvasPrivate *priv = CLUTTER_CANVAS (gobject)->priv;
-
- switch (prop_id)
- {
- case PROP_WIDTH:
- g_value_set_int (value, priv->width);
- break;
-
- case PROP_HEIGHT:
- g_value_set_int (value, priv->height);
- break;
-
- case PROP_SCALE_FACTOR:
- g_value_set_float (value, priv->scale_factor);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_canvas_class_init (ClutterCanvasClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- /**
- * ClutterCanvas:width:
- *
- * The width of the canvas.
- *
- * Since: 1.10
- */
- obj_props[PROP_WIDTH] =
- g_param_spec_int ("width",
- P_("Width"),
- P_("The width of the canvas"),
- -1, G_MAXINT,
- -1,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
-
- /**
- * ClutterCanvas:height:
- *
- * The height of the canvas.
- *
- * Since: 1.10
- */
- obj_props[PROP_HEIGHT] =
- g_param_spec_int ("height",
- P_("Height"),
- P_("The height of the canvas"),
- -1, G_MAXINT,
- -1,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
-
- /**
- * ClutterCanvas:scale-factor:
- *
- * The height of the canvas.
- */
- obj_props[PROP_SCALE_FACTOR] =
- g_param_spec_float ("scale-factor",
- P_("Scale Factor"),
- P_("The Scale factor of the canvas"),
- 0.01f, G_MAXFLOAT,
- 1.0f,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
-
- /**
- * ClutterCanvas::draw:
- * @canvas: the #ClutterCanvas that emitted the signal
- * @cr: the Cairo context used to draw
- * @width: the width of the @canvas
- * @height: the height of the @canvas
- *
- * The #ClutterCanvas::draw signal is emitted each time a canvas is
- * invalidated.
- *
- * It is safe to connect multiple handlers to this signal: each
- * handler invocation will be automatically protected by cairo_save()
- * and cairo_restore() pairs.
- *
- * Return value: %TRUE if the signal emission should stop, and
- * %FALSE otherwise
- *
- * Since: 1.10
- */
- canvas_signals[DRAW] =
- g_signal_new (I_("draw"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE,
- G_STRUCT_OFFSET (ClutterCanvasClass, draw),
- _clutter_boolean_handled_accumulator, NULL,
- clutter_cairo_context_draw_marshaller,
- G_TYPE_BOOLEAN, 3,
- CAIRO_GOBJECT_TYPE_CONTEXT,
- G_TYPE_INT,
- G_TYPE_INT);
-
- gobject_class->set_property = clutter_canvas_set_property;
- gobject_class->get_property = clutter_canvas_get_property;
- gobject_class->finalize = clutter_canvas_finalize;
-
- g_object_class_install_properties (gobject_class, LAST_PROP, obj_props);
-}
-
-static void
-clutter_canvas_init (ClutterCanvas *self)
-{
- self->priv = clutter_canvas_get_instance_private (self);
-
- self->priv->width = -1;
- self->priv->height = -1;
- self->priv->scale_factor = 1.0f;
-}
-
-static void
-clutter_canvas_paint_content (ClutterContent *content,
- ClutterActor *actor,
- ClutterPaintNode *root,
- ClutterPaintContext *paint_context)
-{
- ClutterCanvas *self = CLUTTER_CANVAS (content);
- ClutterCanvasPrivate *priv = self->priv;
- ClutterPaintNode *node;
-
- if (priv->buffer == NULL)
- return;
-
- if (priv->dirty)
- g_clear_pointer (&priv->texture, cogl_object_unref);
-
- if (priv->texture == NULL)
- priv->texture = cogl_texture_new_from_bitmap (priv->buffer,
- COGL_TEXTURE_NO_SLICING,
- CLUTTER_CAIRO_FORMAT_ARGB32);
-
- if (priv->texture == NULL)
- return;
-
- node = clutter_actor_create_texture_paint_node (actor, priv->texture);
- clutter_paint_node_set_static_name (node, "Canvas Content");
- clutter_paint_node_add_child (root, node);
- clutter_paint_node_unref (node);
-
- priv->dirty = FALSE;
-}
-
-static void
-clutter_canvas_emit_draw (ClutterCanvas *self)
-{
- ClutterCanvasPrivate *priv = self->priv;
- int real_width, real_height;
- cairo_surface_t *surface;
- gboolean mapped_buffer;
- unsigned char *data;
- CoglBuffer *buffer;
- gboolean res;
- cairo_t *cr;
-
- g_assert (priv->height > 0 && priv->width > 0);
-
- priv->dirty = TRUE;
-
- real_width = ceilf (priv->width * priv->scale_factor);
- real_height = ceilf (priv->height * priv->scale_factor);
-
- CLUTTER_NOTE (MISC, "Creating Cairo surface with size %d x %d",
- priv->width, priv->height);
-
- if (priv->buffer == NULL)
- {
- CoglContext *ctx;
-
- ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
- priv->buffer = cogl_bitmap_new_with_size (ctx,
- real_width,
- real_height,
- CLUTTER_CAIRO_FORMAT_ARGB32);
- }
-
- buffer = COGL_BUFFER (cogl_bitmap_get_buffer (priv->buffer));
- if (buffer == NULL)
- return;
-
- cogl_buffer_set_update_hint (buffer, COGL_BUFFER_UPDATE_HINT_DYNAMIC);
-
- data = cogl_buffer_map (buffer,
- COGL_BUFFER_ACCESS_READ_WRITE,
- COGL_BUFFER_MAP_HINT_DISCARD);
-
- if (data != NULL)
- {
- int bitmap_stride = cogl_bitmap_get_rowstride (priv->buffer);
-
- surface = cairo_image_surface_create_for_data (data,
- CAIRO_FORMAT_ARGB32,
- real_width,
- real_height,
- bitmap_stride);
- mapped_buffer = TRUE;
- }
- else
- {
- surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
- real_width,
- real_height);
-
- mapped_buffer = FALSE;
- }
-
- cairo_surface_set_device_scale (surface,
- priv->scale_factor,
- priv->scale_factor);
-
- self->priv->cr = cr = cairo_create (surface);
-
- g_signal_emit (self, canvas_signals[DRAW], 0,
- cr, priv->width, priv->height,
- &res);
-
-#ifdef CLUTTER_ENABLE_DEBUG
- if (_clutter_diagnostic_enabled () && cairo_status (cr))
- {
- g_warning ("Drawing failed for <ClutterCanvas>[%p]: %s",
- self,
- cairo_status_to_string (cairo_status (cr)));
- }
-#endif
-
- self->priv->cr = NULL;
- cairo_destroy (cr);
-
- if (mapped_buffer)
- cogl_buffer_unmap (buffer);
- else
- {
- int size = cairo_image_surface_get_stride (surface) * priv->height;
- cogl_buffer_set_data (buffer,
- 0,
- cairo_image_surface_get_data (surface),
- size);
- }
-
- cairo_surface_destroy (surface);
-}
-
-static void
-clutter_canvas_invalidate (ClutterContent *content)
-{
- ClutterCanvas *self = CLUTTER_CANVAS (content);
- ClutterCanvasPrivate *priv = self->priv;
-
- if (priv->buffer != NULL)
- {
- cogl_object_unref (priv->buffer);
- priv->buffer = NULL;
- }
-
- if (priv->width <= 0 || priv->height <= 0)
- return;
-
- clutter_canvas_emit_draw (self);
-}
-
-static gboolean
-clutter_canvas_get_preferred_size (ClutterContent *content,
- gfloat *width,
- gfloat *height)
-{
- ClutterCanvasPrivate *priv = CLUTTER_CANVAS (content)->priv;
-
- if (priv->width < 0 || priv->height < 0)
- return FALSE;
-
- if (width != NULL)
- *width = ceilf (priv->width * priv->scale_factor);
-
- if (height != NULL)
- *height = ceilf (priv->height * priv->scale_factor);
-
- return TRUE;
-}
-
-static void
-clutter_content_iface_init (ClutterContentInterface *iface)
-{
- iface->invalidate = clutter_canvas_invalidate;
- iface->paint_content = clutter_canvas_paint_content;
- iface->get_preferred_size = clutter_canvas_get_preferred_size;
-}
-
-/**
- * clutter_canvas_new:
- *
- * Creates a new instance of #ClutterCanvas.
- *
- * You should call clutter_canvas_set_size() to set the size of the canvas.
- *
- * You should call clutter_content_invalidate() every time you wish to
- * draw the contents of the canvas.
- *
- * Return value: (transfer full): The newly allocated instance of
- * #ClutterCanvas. Use g_object_unref() when done.
- *
- * Since: 1.10
- */
-ClutterContent *
-clutter_canvas_new (void)
-{
- return g_object_new (CLUTTER_TYPE_CANVAS, NULL);
-}
-
-static gboolean
-clutter_canvas_invalidate_internal (ClutterCanvas *canvas,
- int width,
- int height)
-{
- gboolean width_changed = FALSE, height_changed = FALSE;
- gboolean res = FALSE;
- GObject *obj;
-
- obj = G_OBJECT (canvas);
-
- g_object_freeze_notify (obj);
-
- if (canvas->priv->width != width)
- {
- canvas->priv->width = width;
- width_changed = TRUE;
-
- g_object_notify_by_pspec (obj, obj_props[PROP_WIDTH]);
- }
-
- if (canvas->priv->height != height)
- {
- canvas->priv->height = height;
- height_changed = TRUE;
-
- g_object_notify_by_pspec (obj, obj_props[PROP_HEIGHT]);
- }
-
- if (width_changed || height_changed)
- {
- clutter_content_invalidate (CLUTTER_CONTENT (canvas));
- res = TRUE;
- }
-
- g_object_thaw_notify (obj);
-
- return res;
-}
-
-/**
- * clutter_canvas_set_size:
- * @canvas: a #ClutterCanvas
- * @width: the width of the canvas, in pixels
- * @height: the height of the canvas, in pixels
- *
- * Sets the size of the @canvas, and invalidates the content.
- *
- * This function will cause the @canvas to be invalidated only
- * if the size of the canvas surface has changed.
- *
- * If you want to invalidate the contents of the @canvas when setting
- * the size, you can use the return value of the function to conditionally
- * call clutter_content_invalidate():
- *
- * |[
- * if (!clutter_canvas_set_size (canvas, width, height))
- * clutter_content_invalidate (CLUTTER_CONTENT (canvas));
- * ]|
- *
- * Return value: this function returns %TRUE if the size change
- * caused a content invalidation, and %FALSE otherwise
- *
- * Since: 1.10
- */
-gboolean
-clutter_canvas_set_size (ClutterCanvas *canvas,
- int width,
- int height)
-{
- g_return_val_if_fail (CLUTTER_IS_CANVAS (canvas), FALSE);
- g_return_val_if_fail (width >= -1 && height >= -1, FALSE);
-
- return clutter_canvas_invalidate_internal (canvas, width, height);
-}
-
-/**
- * clutter_canvas_set_scale_factor:
- * @canvas: a #ClutterCanvas
- * @scale: the integer scaling factor of the canvas
- *
- * Sets the scaling factor of the @canvas, and invalidates the content.
- *
- * This function will cause the @canvas to be invalidated only
- * if the scale factor of the canvas surface has changed.
- */
-void
-clutter_canvas_set_scale_factor (ClutterCanvas *canvas,
- float scale)
-{
- g_return_if_fail (CLUTTER_IS_CANVAS (canvas));
- g_return_if_fail (scale > 0.0f);
-
- if (canvas->priv->scale_factor != scale)
- {
- canvas->priv->scale_factor = scale;
-
- g_object_freeze_notify (G_OBJECT (canvas));
- clutter_content_invalidate (CLUTTER_CONTENT (canvas));
- g_object_thaw_notify (G_OBJECT (canvas));
-
- g_object_notify_by_pspec (G_OBJECT (canvas), obj_props[PROP_SCALE_FACTOR]);
- }
-}
-
-/**
- * clutter_canvas_get_scale_factor:
- * @canvas: a #ClutterCanvas
- *
- * Gets the scale factor of the @canvas.
- *
- * Return value: the current @canvas scale factor or -1 if invalid
- */
-float
-clutter_canvas_get_scale_factor (ClutterCanvas *canvas)
-{
- g_return_val_if_fail (CLUTTER_IS_CANVAS (canvas), -1.0f);
-
- return canvas->priv->scale_factor;
-}
diff --git a/clutter/clutter/clutter-canvas.h b/clutter/clutter/clutter-canvas.h
deleted file mode 100644
index ed13f49e3..000000000
--- a/clutter/clutter/clutter-canvas.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2012 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_CANVAS_H__
-#define __CLUTTER_CANVAS_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-types.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_CANVAS (clutter_canvas_get_type ())
-#define CLUTTER_CANVAS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_CANVAS, ClutterCanvas))
-#define CLUTTER_IS_CANVAS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_CANVAS))
-#define CLUTTER_CANVAS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_CANVAS, ClutterCanvasClass))
-#define CLUTTER_IS_CANVAS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_CANVAS))
-#define CLUTTER_CANVAS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_CANVAS, ClutterCanvasClass))
-
-typedef struct _ClutterCanvas ClutterCanvas;
-typedef struct _ClutterCanvasPrivate ClutterCanvasPrivate;
-typedef struct _ClutterCanvasClass ClutterCanvasClass;
-
-/**
- * ClutterCanvas:
- *
- * The #ClutterCanvas structure contains
- * private data and should only be accessed using the provided
- * API.
- *
- * Since: 1.10
- */
-struct _ClutterCanvas
-{
- /*< private >*/
- GObject parent_instance;
-
- ClutterCanvasPrivate *priv;
-};
-
-/**
- * ClutterCanvasClass:
- * @draw: class handler for the #ClutterCanvas::draw signal
- *
- * The #ClutterCanvasClass structure contains
- * private data.
- *
- * Since: 1.10
- */
-struct _ClutterCanvasClass
-{
- /*< private >*/
- GObjectClass parent_class;
-
- /*< public >*/
- gboolean (* draw) (ClutterCanvas *canvas,
- cairo_t *cr,
- int width,
- int height);
-
- /*< private >*/
- gpointer _padding[16];
-};
-
-CLUTTER_EXPORT
-GType clutter_canvas_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterContent * clutter_canvas_new (void);
-CLUTTER_EXPORT
-gboolean clutter_canvas_set_size (ClutterCanvas *canvas,
- int width,
- int height);
-
-CLUTTER_EXPORT
-void clutter_canvas_set_scale_factor (ClutterCanvas *canvas,
- float scale);
-CLUTTER_EXPORT
-float clutter_canvas_get_scale_factor (ClutterCanvas *canvas);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_CANVAS_H__ */
diff --git a/clutter/clutter/clutter-child-meta.c b/clutter/clutter/clutter-child-meta.c
deleted file mode 100644
index b0fe5611f..000000000
--- a/clutter/clutter/clutter-child-meta.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- * Jorn Baayen <jorn@openedhand.com>
- * Emmanuele Bassi <ebassi@openedhand.com>
- * Tomas Frydrych <tf@openedhand.com>
- * Øyvind Kolås <ok@openedhand.com>
- *
- * Copyright (C) 2008 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * SECTION:clutter-child-meta
- * @short_description: Wrapper for actors inside a container
- *
- * #ClutterChildMeta is a wrapper object created by #ClutterContainer
- * implementations in order to store child-specific data and properties.
- *
- * A #ClutterChildMeta wraps a #ClutterActor inside a #ClutterContainer.
- *
- * #ClutterChildMeta is available since Clutter 0.8
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-child-meta.h"
-#include "clutter-container.h"
-#include "clutter-debug.h"
-#include "clutter-private.h"
-
-G_DEFINE_ABSTRACT_TYPE (ClutterChildMeta, clutter_child_meta, G_TYPE_OBJECT);
-
-enum
-{
- PROP_0,
-
- PROP_CONTAINER,
- PROP_ACTOR,
-
- PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST];
-
-static void
-clutter_child_meta_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterChildMeta *child_meta = CLUTTER_CHILD_META (object);
-
- switch (prop_id)
- {
- case PROP_CONTAINER:
- child_meta->container = g_value_get_object (value);
- break;
-
- case PROP_ACTOR:
- child_meta->actor = g_value_get_object (value);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_child_meta_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterChildMeta *child_meta = CLUTTER_CHILD_META (object);
-
- switch (prop_id)
- {
- case PROP_CONTAINER:
- g_value_set_object (value, child_meta->container);
- break;
-
- case PROP_ACTOR:
- g_value_set_object (value, child_meta->actor);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_child_meta_class_init (ClutterChildMetaClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- gobject_class->set_property = clutter_child_meta_set_property;
- gobject_class->get_property = clutter_child_meta_get_property;
-
- /**
- * ClutterChildMeta:container:
- *
- * The #ClutterContainer that created this #ClutterChildMeta.
- *
- * Since: 0.8
- */
- obj_props[PROP_CONTAINER] =
- g_param_spec_object ("container",
- P_("Container"),
- P_("The container that created this data"),
- CLUTTER_TYPE_CONTAINER,
- G_PARAM_CONSTRUCT_ONLY |
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterChildMeta:actor:
- *
- * The #ClutterActor being wrapped by this #ClutterChildMeta
- *
- * Since: 0.8
- */
- obj_props[PROP_ACTOR] =
- g_param_spec_object ("actor",
- P_("Actor"),
- P_("The actor wrapped by this data"),
- CLUTTER_TYPE_ACTOR,
- G_PARAM_CONSTRUCT_ONLY |
- CLUTTER_PARAM_READWRITE);
-
- g_object_class_install_properties (gobject_class,
- PROP_LAST,
- obj_props);
-}
-
-static void
-clutter_child_meta_init (ClutterChildMeta *self)
-{
-}
-
-/**
- * clutter_child_meta_get_container:
- * @data: a #ClutterChildMeta
- *
- * Retrieves the container using @data
- *
- * Return value: (transfer none): a #ClutterContainer
- *
- * Since: 0.8
- */
-ClutterContainer *
-clutter_child_meta_get_container (ClutterChildMeta *data)
-{
- g_return_val_if_fail (CLUTTER_IS_CHILD_META (data), NULL);
-
- return data->container;
-}
-
-/**
- * clutter_child_meta_get_actor:
- * @data: a #ClutterChildMeta
- *
- * Retrieves the actor wrapped by @data
- *
- * Return value: (transfer none): a #ClutterActor
- *
- * Since: 0.8
- */
-ClutterActor *
-clutter_child_meta_get_actor (ClutterChildMeta *data)
-{
- g_return_val_if_fail (CLUTTER_IS_CHILD_META (data), NULL);
-
- return data->actor;
-}
diff --git a/clutter/clutter/clutter-child-meta.h b/clutter/clutter/clutter-child-meta.h
deleted file mode 100644
index 1c473bd32..000000000
--- a/clutter/clutter/clutter-child-meta.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- * Jorn Baayen <jorn@openedhand.com>
- * Emmanuele Bassi <ebassi@openedhand.com>
- * Tomas Frydrych <tf@openedhand.com>
- * Øyvind Kolås <ok@openedhand.com>
- *
- * Copyright (C) 2008 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __CLUTTER_CHILD_META_H__
-#define __CLUTTER_CHILD_META_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <glib-object.h>
-#include <clutter/clutter-types.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_CHILD_META (clutter_child_meta_get_type ())
-#define CLUTTER_CHILD_META(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_CHILD_META, ClutterChildMeta))
-#define CLUTTER_CHILD_META_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_CHILD_META, ClutterChildMetaClass))
-#define CLUTTER_IS_CHILD_META(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_CHILD_META))
-#define CLUTTER_IS_CHILD_META_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_CHILD_META))
-#define CLUTTER_CHILD_META_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_CHILD_META, ClutterChildMetaClass))
-
-typedef struct _ClutterChildMetaClass ClutterChildMetaClass;
-
-/**
- * ClutterChildMeta:
- * @container: the container handling this data
- * @actor: the actor wrapped by this data
- *
- * Base interface for container specific state for child actors. A child
- * data is meant to be used when you need to keep track of information
- * about each individual child added to a container.
- *
- * In order to use it you should create your own subclass of
- * #ClutterChildMeta and set the #ClutterContainerIface child_meta_type
- * interface member to your subclass type, like:
- *
- * |[
- * static void
- * my_container_iface_init (ClutterContainerIface *iface)
- * {
- * // set the rest of the #ClutterContainer vtable
- *
- * container_iface->child_meta_type = MY_TYPE_CHILD_META;
- * }
- * ]|
- *
- * This will automatically create a #ClutterChildMeta of type
- * `MY_TYPE_CHILD_META` for every actor that is added to the container.
- *
- * The child data for an actor can be retrieved using the
- * clutter_container_get_child_meta() function.
- *
- * The properties of the data and your subclass can be manipulated with
- * clutter_container_child_set() and clutter_container_child_get() which
- * act like g_object_set() and g_object_get().
- *
- * You can provide hooks for your own storage as well as control the
- * instantiation by overriding the #ClutterContainerIface virtual functions
- * #ClutterContainerIface.create_child_meta(), #ClutterContainerIface.destroy_child_meta(),
- * and #ClutterContainerIface.get_child_meta().
- *
- * Since: 0.8
- */
-struct _ClutterChildMeta
-{
- /*< private >*/
- GObject parent_instance;
-
- /*< public >*/
- ClutterContainer *container;
- ClutterActor *actor;
-};
-
-/**
- * ClutterChildMetaClass:
- *
- * The #ClutterChildMetaClass contains only private data
- *
- * Since: 0.8
- */
-struct _ClutterChildMetaClass
-{
- /*< private >*/
- GObjectClass parent_class;
-};
-
-CLUTTER_EXPORT
-GType clutter_child_meta_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterContainer * clutter_child_meta_get_container (ClutterChildMeta *data);
-CLUTTER_EXPORT
-ClutterActor * clutter_child_meta_get_actor (ClutterChildMeta *data);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_CHILD_META_H__ */
diff --git a/clutter/clutter/clutter-click-action.c b/clutter/clutter/clutter-click-action.c
deleted file mode 100644
index 45d87e809..000000000
--- a/clutter/clutter/clutter-click-action.c
+++ /dev/null
@@ -1,850 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-click-action
- * @Title: ClutterClickAction
- * @Short_Description: Action for clickable actors
- *
- * #ClutterClickAction is a sub-class of #ClutterAction that implements
- * the logic for clickable actors, by using the low level events of
- * #ClutterActor, such as #ClutterActor::button-press-event and
- * #ClutterActor::button-release-event, to synthesize the high level
- * #ClutterClickAction::clicked signal.
- *
- * To use #ClutterClickAction you just need to apply it to a #ClutterActor
- * using clutter_actor_add_action() and connect to the
- * #ClutterClickAction::clicked signal:
- *
- * |[
- * ClutterAction *action = clutter_click_action_new ();
- *
- * clutter_actor_add_action (actor, action);
- *
- * g_signal_connect (action, "clicked", G_CALLBACK (on_clicked), NULL);
- * ]|
- *
- * #ClutterClickAction also supports long press gestures: a long press is
- * activated if the pointer remains pressed within a certain threshold (as
- * defined by the #ClutterClickAction:long-press-threshold property) for a
- * minimum amount of time (as the defined by the
- * #ClutterClickAction:long-press-duration property).
- * The #ClutterClickAction::long-press signal is emitted multiple times,
- * using different #ClutterLongPressState values; to handle long presses
- * you should connect to the #ClutterClickAction::long-press signal and
- * handle the different states:
- *
- * |[
- * static gboolean
- * on_long_press (ClutterClickAction *action,
- * ClutterActor *actor,
- * ClutterLongPressState state)
- * {
- * switch (state)
- * {
- * case CLUTTER_LONG_PRESS_QUERY:
- * /&ast; return TRUE if the actor should support long press
- * &ast; gestures, and FALSE otherwise; this state will be
- * &ast; emitted on button presses
- * &ast;/
- * return TRUE;
- *
- * case CLUTTER_LONG_PRESS_ACTIVATE:
- * /&ast; this state is emitted if the minimum duration has
- * &ast; been reached without the gesture being cancelled.
- * &ast; the return value is not used
- * &ast;/
- * return TRUE;
- *
- * case CLUTTER_LONG_PRESS_CANCEL:
- * /&ast; this state is emitted if the long press was cancelled;
- * &ast; for instance, the pointer went outside the actor or the
- * &ast; allowed threshold, or the button was released before
- * &ast; the minimum duration was reached. the return value is
- * &ast; not used
- * &ast;/
- * return FALSE;
- * }
- * }
- * ]|
- *
- * #ClutterClickAction is available since Clutter 1.4
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-click-action.h"
-
-#include "clutter-debug.h"
-#include "clutter-enum-types.h"
-#include "clutter-marshal.h"
-#include "clutter-private.h"
-
-struct _ClutterClickActionPrivate
-{
- ClutterActor *stage;
-
- gulong event_id;
- gulong capture_id;
- guint long_press_id;
-
- gint long_press_threshold;
- gint long_press_duration;
- gint drag_threshold;
-
- guint press_button;
- ClutterInputDevice *press_device;
- ClutterEventSequence *press_sequence;
- ClutterModifierType modifier_state;
- gfloat press_x;
- gfloat press_y;
-
- guint is_held : 1;
- guint is_pressed : 1;
-};
-
-enum
-{
- PROP_0,
-
- PROP_HELD,
- PROP_PRESSED,
- PROP_LONG_PRESS_THRESHOLD,
- PROP_LONG_PRESS_DURATION,
-
- PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST] = { NULL, };
-
-enum
-{
- CLICKED,
- LONG_PRESS,
-
- LAST_SIGNAL
-};
-
-static guint click_signals[LAST_SIGNAL] = { 0, };
-
-G_DEFINE_TYPE_WITH_PRIVATE (ClutterClickAction, clutter_click_action, CLUTTER_TYPE_ACTION)
-
-/* forward declaration */
-static gboolean on_captured_event (ClutterActor *stage,
- ClutterEvent *event,
- ClutterClickAction *action);
-
-static inline void
-click_action_set_pressed (ClutterClickAction *action,
- gboolean is_pressed)
-{
- ClutterClickActionPrivate *priv =
- clutter_click_action_get_instance_private (action);
-
- is_pressed = !!is_pressed;
-
- if (priv->is_pressed == is_pressed)
- return;
-
- priv->is_pressed = is_pressed;
- g_object_notify_by_pspec (G_OBJECT (action), obj_props[PROP_PRESSED]);
-}
-
-static inline void
-click_action_set_held (ClutterClickAction *action,
- gboolean is_held)
-{
- ClutterClickActionPrivate *priv =
- clutter_click_action_get_instance_private (action);
-
- is_held = !!is_held;
-
- if (priv->is_held == is_held)
- return;
-
- priv->is_held = is_held;
- g_object_notify_by_pspec (G_OBJECT (action), obj_props[PROP_HELD]);
-}
-
-static gboolean
-click_action_emit_long_press (gpointer data)
-{
- ClutterClickAction *action = data;
- ClutterClickActionPrivate *priv =
- clutter_click_action_get_instance_private (action);
- ClutterActor *actor;
- gboolean result;
-
- priv->long_press_id = 0;
-
- actor = clutter_actor_meta_get_actor (data);
-
- g_signal_emit (action, click_signals[LONG_PRESS], 0,
- actor,
- CLUTTER_LONG_PRESS_ACTIVATE,
- &result);
-
- g_clear_signal_handler (&priv->capture_id, priv->stage);
-
- click_action_set_pressed (action, FALSE);
- click_action_set_held (action, FALSE);
-
- return FALSE;
-}
-
-static inline void
-click_action_query_long_press (ClutterClickAction *action)
-{
- ClutterClickActionPrivate *priv =
- clutter_click_action_get_instance_private (action);
- ClutterActor *actor;
- gboolean result = FALSE;
- gint timeout;
-
- if (priv->long_press_duration < 0)
- {
- ClutterSettings *settings = clutter_settings_get_default ();
-
- g_object_get (settings,
- "long-press-duration", &timeout,
- NULL);
- }
- else
- timeout = priv->long_press_duration;
-
- actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
-
- g_signal_emit (action, click_signals[LONG_PRESS], 0,
- actor,
- CLUTTER_LONG_PRESS_QUERY,
- &result);
-
- if (result)
- {
- g_clear_handle_id (&priv->long_press_id, g_source_remove);
- priv->long_press_id =
- clutter_threads_add_timeout (timeout,
- click_action_emit_long_press,
- action);
- }
-}
-
-static inline void
-click_action_cancel_long_press (ClutterClickAction *action)
-{
- ClutterClickActionPrivate *priv =
- clutter_click_action_get_instance_private (action);
-
- if (priv->long_press_id != 0)
- {
- ClutterActor *actor;
- gboolean result;
-
- actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
-
- g_clear_handle_id (&priv->long_press_id, g_source_remove);
-
- g_signal_emit (action, click_signals[LONG_PRESS], 0,
- actor,
- CLUTTER_LONG_PRESS_CANCEL,
- &result);
- }
-}
-
-static inline gboolean
-event_within_drag_threshold (ClutterClickAction *click_action,
- ClutterEvent *event)
-{
- ClutterClickActionPrivate *priv =
- clutter_click_action_get_instance_private (click_action);
- float motion_x, motion_y;
- float delta_x, delta_y;
-
- clutter_event_get_coords (event, &motion_x, &motion_y);
-
- delta_x = ABS (motion_x - priv->press_x);
- delta_y = ABS (motion_y - priv->press_y);
-
- return delta_x <= priv->drag_threshold && delta_y <= priv->drag_threshold;
-}
-
-static gboolean
-on_event (ClutterActor *actor,
- ClutterEvent *event,
- ClutterClickAction *action)
-{
- ClutterClickActionPrivate *priv =
- clutter_click_action_get_instance_private (action);
- gboolean has_button = TRUE;
-
- if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (action)))
- return CLUTTER_EVENT_PROPAGATE;
-
- switch (clutter_event_type (event))
- {
- case CLUTTER_TOUCH_BEGIN:
- has_button = FALSE;
- case CLUTTER_BUTTON_PRESS:
- if (has_button && clutter_event_get_click_count (event) != 1)
- return CLUTTER_EVENT_PROPAGATE;
-
- if (priv->is_held)
- return CLUTTER_EVENT_STOP;
-
- if (!clutter_actor_contains (actor, clutter_event_get_source (event)))
- return CLUTTER_EVENT_PROPAGATE;
-
- priv->press_button = has_button ? clutter_event_get_button (event) : 0;
- priv->press_device = clutter_event_get_device (event);
- priv->press_sequence = clutter_event_get_event_sequence (event);
- priv->modifier_state = clutter_event_get_state (event);
- clutter_event_get_coords (event, &priv->press_x, &priv->press_y);
-
- if (priv->long_press_threshold < 0)
- {
- ClutterSettings *settings = clutter_settings_get_default ();
-
- g_object_get (settings,
- "dnd-drag-threshold", &priv->drag_threshold,
- NULL);
- }
- else
- priv->drag_threshold = priv->long_press_threshold;
-
- if (priv->stage == NULL)
- priv->stage = clutter_actor_get_stage (actor);
-
- priv->capture_id = g_signal_connect_after (priv->stage, "captured-event",
- G_CALLBACK (on_captured_event),
- action);
-
- click_action_set_pressed (action, TRUE);
- click_action_set_held (action, TRUE);
- click_action_query_long_press (action);
- break;
-
- case CLUTTER_ENTER:
- click_action_set_pressed (action, priv->is_held);
- break;
-
- case CLUTTER_LEAVE:
- click_action_set_pressed (action, priv->is_held);
- click_action_cancel_long_press (action);
- break;
-
- default:
- break;
- }
-
- return CLUTTER_EVENT_PROPAGATE;
-}
-
-static gboolean
-on_captured_event (ClutterActor *stage,
- ClutterEvent *event,
- ClutterClickAction *action)
-{
- ClutterClickActionPrivate *priv =
- clutter_click_action_get_instance_private (action);
- ClutterActor *actor;
- ClutterModifierType modifier_state;
- gboolean has_button = TRUE;
-
- actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
-
- switch (clutter_event_type (event))
- {
- case CLUTTER_TOUCH_CANCEL:
- clutter_click_action_release (action);
- break;
-
- case CLUTTER_TOUCH_END:
- has_button = FALSE;
- case CLUTTER_BUTTON_RELEASE:
- if (!priv->is_held)
- return CLUTTER_EVENT_STOP;
-
- if ((has_button && clutter_event_get_button (event) != priv->press_button) ||
- (has_button && clutter_event_get_click_count (event) != 1) ||
- clutter_event_get_device (event) != priv->press_device ||
- clutter_event_get_event_sequence (event) != priv->press_sequence)
- return CLUTTER_EVENT_PROPAGATE;
-
- click_action_set_held (action, FALSE);
- click_action_cancel_long_press (action);
-
- /* disconnect the capture */
- g_clear_signal_handler (&priv->capture_id, priv->stage);
-
- g_clear_handle_id (&priv->long_press_id, g_source_remove);
-
- if (!clutter_actor_contains (actor, clutter_event_get_source (event)))
- return CLUTTER_EVENT_PROPAGATE;
-
- /* exclude any button-mask so that we can compare
- * the press and release states properly */
- modifier_state = clutter_event_get_state (event) &
- ~(CLUTTER_BUTTON1_MASK |
- CLUTTER_BUTTON2_MASK |
- CLUTTER_BUTTON3_MASK |
- CLUTTER_BUTTON4_MASK |
- CLUTTER_BUTTON5_MASK);
-
- /* if press and release states don't match we
- * simply ignore modifier keys. i.e. modifier keys
- * are expected to be pressed throughout the whole
- * click */
- if (modifier_state != priv->modifier_state)
- priv->modifier_state = 0;
-
- click_action_set_pressed (action, FALSE);
-
- if (event_within_drag_threshold (action, event))
- g_signal_emit (action, click_signals[CLICKED], 0, actor);
- break;
-
- case CLUTTER_MOTION:
- case CLUTTER_TOUCH_UPDATE:
- {
- if (clutter_event_get_device (event) != priv->press_device ||
- clutter_event_get_event_sequence (event) != priv->press_sequence)
- return CLUTTER_EVENT_PROPAGATE;
-
- if (!priv->is_held)
- return CLUTTER_EVENT_PROPAGATE;
-
- if (!event_within_drag_threshold (action, event))
- clutter_click_action_release (action);
- }
- break;
-
- default:
- break;
- }
-
- return CLUTTER_EVENT_STOP;
-}
-
-static void
-clutter_click_action_set_actor (ClutterActorMeta *meta,
- ClutterActor *actor)
-{
- ClutterClickAction *action = CLUTTER_CLICK_ACTION (meta);
- ClutterClickActionPrivate *priv =
- clutter_click_action_get_instance_private (action);
-
- if (priv->event_id != 0)
- {
- ClutterActor *old_actor = clutter_actor_meta_get_actor (meta);
-
- if (old_actor != NULL)
- g_clear_signal_handler (&priv->event_id, old_actor);
-
- priv->event_id = 0;
- }
-
- if (priv->capture_id != 0)
- {
- if (priv->stage != NULL)
- g_clear_signal_handler (&priv->capture_id, priv->stage);
-
- priv->capture_id = 0;
- priv->stage = NULL;
- }
-
- g_clear_handle_id (&priv->long_press_id, g_source_remove);
-
- click_action_set_pressed (action, FALSE);
- click_action_set_held (action, FALSE);
-
- if (actor != NULL)
- priv->event_id = g_signal_connect (actor, "event",
- G_CALLBACK (on_event),
- action);
-
- CLUTTER_ACTOR_META_CLASS (clutter_click_action_parent_class)->set_actor (meta, actor);
-}
-
-static void
-clutter_click_action_set_enabled (ClutterActorMeta *meta,
- gboolean is_enabled)
-{
- ClutterClickAction *click_action = CLUTTER_CLICK_ACTION (meta);
- ClutterActorMetaClass *parent_class =
- CLUTTER_ACTOR_META_CLASS (clutter_click_action_parent_class);
-
- if (!is_enabled)
- clutter_click_action_release (click_action);
-
- parent_class->set_enabled (meta, is_enabled);
-}
-
-static void
-clutter_click_action_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterClickActionPrivate *priv =
- clutter_click_action_get_instance_private (CLUTTER_CLICK_ACTION (gobject));
-
- switch (prop_id)
- {
- case PROP_LONG_PRESS_DURATION:
- priv->long_press_duration = g_value_get_int (value);
- break;
-
- case PROP_LONG_PRESS_THRESHOLD:
- priv->long_press_threshold = g_value_get_int (value);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_click_action_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterClickActionPrivate *priv =
- clutter_click_action_get_instance_private (CLUTTER_CLICK_ACTION (gobject));
-
- switch (prop_id)
- {
- case PROP_HELD:
- g_value_set_boolean (value, priv->is_held);
- break;
-
- case PROP_PRESSED:
- g_value_set_boolean (value, priv->is_pressed);
- break;
-
- case PROP_LONG_PRESS_DURATION:
- g_value_set_int (value, priv->long_press_duration);
- break;
-
- case PROP_LONG_PRESS_THRESHOLD:
- g_value_set_int (value, priv->long_press_threshold);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_click_action_dispose (GObject *gobject)
-{
- ClutterClickActionPrivate *priv =
- clutter_click_action_get_instance_private (CLUTTER_CLICK_ACTION (gobject));
-
- g_clear_signal_handler (&priv->event_id,
- clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (gobject)));
-
- g_clear_signal_handler (&priv->capture_id, priv->stage);
-
- g_clear_handle_id (&priv->long_press_id, g_source_remove);
-
- G_OBJECT_CLASS (clutter_click_action_parent_class)->dispose (gobject);
-}
-
-
-static void
-clutter_click_action_class_init (ClutterClickActionClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
-
- meta_class->set_actor = clutter_click_action_set_actor;
- meta_class->set_enabled = clutter_click_action_set_enabled;
-
- gobject_class->dispose = clutter_click_action_dispose;
- gobject_class->set_property = clutter_click_action_set_property;
- gobject_class->get_property = clutter_click_action_get_property;
-
- /**
- * ClutterClickAction:pressed:
- *
- * Whether the clickable actor should be in "pressed" state
- *
- * Since: 1.4
- */
- obj_props[PROP_PRESSED] =
- g_param_spec_boolean ("pressed",
- P_("Pressed"),
- P_("Whether the clickable should be in pressed state"),
- FALSE,
- CLUTTER_PARAM_READABLE);
-
- /**
- * ClutterClickAction:held:
- *
- * Whether the clickable actor has the pointer grabbed
- *
- * Since: 1.4
- */
- obj_props[PROP_HELD] =
- g_param_spec_boolean ("held",
- P_("Held"),
- P_("Whether the clickable has a grab"),
- FALSE,
- CLUTTER_PARAM_READABLE);
-
- /**
- * ClutterClickAction:long-press-duration:
- *
- * The minimum duration of a press for it to be recognized as a long
- * press gesture, in milliseconds.
- *
- * A value of -1 will make the #ClutterClickAction use the value of
- * the #ClutterSettings:long-press-duration property.
- *
- * Since: 1.8
- */
- obj_props[PROP_LONG_PRESS_DURATION] =
- g_param_spec_int ("long-press-duration",
- P_("Long Press Duration"),
- P_("The minimum duration of a long press to recognize the gesture"),
- -1, G_MAXINT,
- -1,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterClickAction:long-press-threshold:
- *
- * The maximum allowed distance that can be covered (on both axes) before
- * a long press gesture is cancelled, in pixels.
- *
- * A value of -1 will make the #ClutterClickAction use the value of
- * the #ClutterSettings:dnd-drag-threshold property.
- *
- * Since: 1.8
- */
- obj_props[PROP_LONG_PRESS_THRESHOLD] =
- g_param_spec_int ("long-press-threshold",
- P_("Long Press Threshold"),
- P_("The maximum threshold before a long press is cancelled"),
- -1, G_MAXINT,
- -1,
- CLUTTER_PARAM_READWRITE);
-
- g_object_class_install_properties (gobject_class,
- PROP_LAST,
- obj_props);
-
- /**
- * ClutterClickAction::clicked:
- * @action: the #ClutterClickAction that emitted the signal
- * @actor: the #ClutterActor attached to the @action
- *
- * The ::clicked signal is emitted when the #ClutterActor to which
- * a #ClutterClickAction has been applied should respond to a
- * pointer button press and release events
- *
- * Since: 1.4
- */
- click_signals[CLICKED] =
- g_signal_new (I_("clicked"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterClickActionClass, clicked),
- NULL, NULL, NULL,
- G_TYPE_NONE, 1,
- CLUTTER_TYPE_ACTOR);
-
- /**
- * ClutterClickAction::long-press:
- * @action: the #ClutterClickAction that emitted the signal
- * @actor: the #ClutterActor attached to the @action
- * @state: the long press state
- *
- * The ::long-press signal is emitted during the long press gesture
- * handling.
- *
- * This signal can be emitted multiple times with different states.
- *
- * The %CLUTTER_LONG_PRESS_QUERY state will be emitted on button presses,
- * and its return value will determine whether the long press handling
- * should be initiated. If the signal handlers will return %TRUE, the
- * %CLUTTER_LONG_PRESS_QUERY state will be followed either by a signal
- * emission with the %CLUTTER_LONG_PRESS_ACTIVATE state if the long press
- * constraints were respected, or by a signal emission with the
- * %CLUTTER_LONG_PRESS_CANCEL state if the long press was cancelled.
- *
- * It is possible to forcibly cancel a long press detection using
- * clutter_click_action_release().
- *
- * Return value: Only the %CLUTTER_LONG_PRESS_QUERY state uses the
- * returned value of the handler; other states will ignore it
- *
- * Since: 1.8
- */
- click_signals[LONG_PRESS] =
- g_signal_new (I_("long-press"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterClickActionClass, long_press),
- NULL, NULL,
- _clutter_marshal_BOOLEAN__OBJECT_ENUM,
- G_TYPE_BOOLEAN, 2,
- CLUTTER_TYPE_ACTOR,
- CLUTTER_TYPE_LONG_PRESS_STATE);
-}
-
-static void
-clutter_click_action_init (ClutterClickAction *self)
-{
- ClutterClickActionPrivate *priv =
- clutter_click_action_get_instance_private (self);
-
- priv->long_press_threshold = -1;
- priv->long_press_duration = -1;
-}
-
-/**
- * clutter_click_action_new:
- *
- * Creates a new #ClutterClickAction instance
- *
- * Return value: the newly created #ClutterClickAction
- *
- * Since: 1.4
- */
-ClutterAction *
-clutter_click_action_new (void)
-{
- return g_object_new (CLUTTER_TYPE_CLICK_ACTION, NULL);
-}
-
-/**
- * clutter_click_action_release:
- * @action: a #ClutterClickAction
- *
- * Emulates a release of the pointer button, which ungrabs the pointer
- * and unsets the #ClutterClickAction:pressed state.
- *
- * This function will also cancel the long press gesture if one was
- * initiated.
- *
- * This function is useful to break a grab, for instance after a certain
- * amount of time has passed.
- *
- * Since: 1.4
- */
-void
-clutter_click_action_release (ClutterClickAction *action)
-{
- ClutterClickActionPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_CLICK_ACTION (action));
-
- priv = clutter_click_action_get_instance_private (action);
-
- if (!priv->is_held)
- return;
-
- /* disconnect the capture */
- g_clear_signal_handler (&priv->capture_id, priv->stage);
-
- click_action_cancel_long_press (action);
- click_action_set_held (action, FALSE);
- click_action_set_pressed (action, FALSE);
-}
-
-/**
- * clutter_click_action_get_button:
- * @action: a #ClutterClickAction
- *
- * Retrieves the button that was pressed.
- *
- * Return value: the button value
- *
- * Since: 1.4
- */
-guint
-clutter_click_action_get_button (ClutterClickAction *action)
-{
- ClutterClickActionPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_CLICK_ACTION (action), 0);
-
- priv = clutter_click_action_get_instance_private (action);
-
- return priv->press_button;
-}
-
-/**
- * clutter_click_action_get_state:
- * @action: a #ClutterClickAction
- *
- * Retrieves the modifier state of the click action.
- *
- * Return value: the modifier state parameter, or 0
- *
- * Since: 1.6
- */
-ClutterModifierType
-clutter_click_action_get_state (ClutterClickAction *action)
-{
- ClutterClickActionPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_CLICK_ACTION (action), 0);
-
- priv = clutter_click_action_get_instance_private (action);
-
- return priv->modifier_state;
-}
-
-/**
- * clutter_click_action_get_coords:
- * @action: a #ClutterClickAction
- * @press_x: (out): return location for the X coordinate, or %NULL
- * @press_y: (out): return location for the Y coordinate, or %NULL
- *
- * Retrieves the screen coordinates of the button press.
- *
- * Since: 1.8
- */
-void
-clutter_click_action_get_coords (ClutterClickAction *action,
- gfloat *press_x,
- gfloat *press_y)
-{
- ClutterClickActionPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_ACTION (action));
-
- priv = clutter_click_action_get_instance_private (action);
-
- if (press_x != NULL)
- *press_x = priv->press_x;
-
- if (press_y != NULL)
- *press_y = priv->press_y;
-}
diff --git a/clutter/clutter/clutter-click-action.h b/clutter/clutter/clutter-click-action.h
deleted file mode 100644
index 92fab76cc..000000000
--- a/clutter/clutter/clutter-click-action.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- *
- * Inspired by the StClickable class in GNOME Shell, written by:
- * Colin Walters <walters@verbum.org>
- */
-
-#ifndef __CLUTTER_CLICK_ACTION_H__
-#define __CLUTTER_CLICK_ACTION_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-action.h>
-#include <clutter/clutter-event.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_CLICK_ACTION (clutter_click_action_get_type ())
-
-CLUTTER_EXPORT
-G_DECLARE_DERIVABLE_TYPE (ClutterClickAction, clutter_click_action,
- CLUTTER, CLICK_ACTION, ClutterAction);
-
-typedef struct _ClutterClickActionPrivate ClutterClickActionPrivate;
-
-/**
- * ClutterClickActionClass:
- * @clicked: class handler for the #ClutterClickAction::clicked signal
- * @long_press: class handler for the #ClutterClickAction::long-press signal
- *
- * The #ClutterClickActionClass structure
- * contains only private data
- *
- * Since: 1.4
- */
-struct _ClutterClickActionClass
-{
- /*< private >*/
- ClutterActionClass parent_class;
-
- /*< public >*/
- void (* clicked) (ClutterClickAction *action,
- ClutterActor *actor);
-
- gboolean (* long_press) (ClutterClickAction *action,
- ClutterActor *actor,
- ClutterLongPressState state);
-
- /*< private >*/
- void (* _clutter_click_action1) (void);
- void (* _clutter_click_action2) (void);
- void (* _clutter_click_action3) (void);
- void (* _clutter_click_action4) (void);
- void (* _clutter_click_action5) (void);
- void (* _clutter_click_action6) (void);
- void (* _clutter_click_action7) (void);
-};
-
-CLUTTER_EXPORT
-ClutterAction * clutter_click_action_new (void);
-
-CLUTTER_EXPORT
-guint clutter_click_action_get_button (ClutterClickAction *action);
-CLUTTER_EXPORT
-ClutterModifierType clutter_click_action_get_state (ClutterClickAction *action);
-CLUTTER_EXPORT
-void clutter_click_action_get_coords (ClutterClickAction *action,
- gfloat *press_x,
- gfloat *press_y);
-
-CLUTTER_EXPORT
-void clutter_click_action_release (ClutterClickAction *action);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_CLICK_ACTION_H__ */
diff --git a/clutter/clutter/clutter-clone.c b/clutter/clutter/clutter-clone.c
deleted file mode 100644
index 42e3e07cd..000000000
--- a/clutter/clutter/clutter-clone.c
+++ /dev/null
@@ -1,469 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2008 Intel Corporation.
- *
- * Authored By: Robert Bragg <robert@linux.intel.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * SECTION:clutter-clone
- * @short_description: An actor that displays a clone of a source actor
- *
- * #ClutterClone is a #ClutterActor which draws with the paint
- * function of another actor, scaled to fit its own allocation.
- *
- * #ClutterClone can be used to efficiently clone any other actor.
- *
- * Unlike clutter_texture_new_from_actor(), #ClutterClone does not require
- * the presence of support for FBOs in the underlying GL or GLES
- * implementation.
- *
- * #ClutterClone is available since Clutter 1.0
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-actor-private.h"
-#include "clutter-clone.h"
-#include "clutter-debug.h"
-#include "clutter-main.h"
-#include "clutter-paint-volume-private.h"
-#include "clutter-private.h"
-
-#include "cogl/cogl.h"
-
-struct _ClutterClonePrivate
-{
- ClutterActor *clone_source;
- float x_scale, y_scale;
-
- gulong source_destroy_id;
-};
-
-G_DEFINE_TYPE_WITH_PRIVATE (ClutterClone, clutter_clone, CLUTTER_TYPE_ACTOR)
-
-enum
-{
- PROP_0,
-
- PROP_SOURCE,
-
- PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST];
-
-static void clutter_clone_set_source_internal (ClutterClone *clone,
- ClutterActor *source);
-static void
-clutter_clone_get_preferred_width (ClutterActor *self,
- gfloat for_height,
- gfloat *min_width_p,
- gfloat *natural_width_p)
-{
- ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv;
- ClutterActor *clone_source = priv->clone_source;
-
- if (clone_source == NULL)
- {
- if (min_width_p)
- *min_width_p = 0;
-
- if (natural_width_p)
- *natural_width_p = 0;
- }
- else
- clutter_actor_get_preferred_width (clone_source,
- for_height,
- min_width_p,
- natural_width_p);
-}
-
-static void
-clutter_clone_get_preferred_height (ClutterActor *self,
- gfloat for_width,
- gfloat *min_height_p,
- gfloat *natural_height_p)
-{
- ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv;
- ClutterActor *clone_source = priv->clone_source;
-
- if (clone_source == NULL)
- {
- if (min_height_p)
- *min_height_p = 0;
-
- if (natural_height_p)
- *natural_height_p = 0;
- }
- else
- clutter_actor_get_preferred_height (clone_source,
- for_width,
- min_height_p,
- natural_height_p);
-}
-
-static void
-clutter_clone_apply_transform (ClutterActor *self,
- graphene_matrix_t *matrix)
-{
- ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv;
-
-
- if (priv->clone_source)
- graphene_matrix_scale (matrix, priv->x_scale, priv->y_scale, 1.f);
-
- CLUTTER_ACTOR_CLASS (clutter_clone_parent_class)->apply_transform (self,
- matrix);
-}
-
-static void
-clutter_clone_paint (ClutterActor *actor,
- ClutterPaintContext *paint_context)
-{
- ClutterClone *self = CLUTTER_CLONE (actor);
- ClutterClonePrivate *priv = self->priv;
- gboolean was_unmapped = FALSE;
-
- if (priv->clone_source == NULL)
- return;
-
- CLUTTER_NOTE (PAINT, "painting clone actor '%s'",
- _clutter_actor_get_debug_name (actor));
-
- /* The final bits of magic:
- * - We need to override the paint opacity of the actor with our own
- * opacity.
- * - We need to inform the actor that it's in a clone paint (for the function
- * clutter_actor_is_in_clone_paint())
- * - We need to stop clutter_actor_paint applying the model view matrix of
- * the clone source actor.
- */
- _clutter_actor_set_in_clone_paint (priv->clone_source, TRUE);
- clutter_actor_set_opacity_override (priv->clone_source,
- clutter_actor_get_paint_opacity (actor));
- _clutter_actor_set_enable_model_view_transform (priv->clone_source, FALSE);
-
- if (!clutter_actor_is_mapped (priv->clone_source))
- {
- _clutter_actor_set_enable_paint_unmapped (priv->clone_source, TRUE);
- was_unmapped = TRUE;
- }
-
- /* If the source isn't ultimately parented to a toplevel, it can't be
- * realized or painted.
- */
- if (clutter_actor_is_realized (priv->clone_source))
- {
- _clutter_actor_push_clone_paint ();
- clutter_actor_paint (priv->clone_source, paint_context);
- _clutter_actor_pop_clone_paint ();
- }
-
- if (was_unmapped)
- _clutter_actor_set_enable_paint_unmapped (priv->clone_source, FALSE);
-
- _clutter_actor_set_enable_model_view_transform (priv->clone_source, TRUE);
- clutter_actor_set_opacity_override (priv->clone_source, -1);
- _clutter_actor_set_in_clone_paint (priv->clone_source, FALSE);
-}
-
-static gboolean
-clutter_clone_get_paint_volume (ClutterActor *actor,
- ClutterPaintVolume *volume)
-{
- ClutterClonePrivate *priv = CLUTTER_CLONE (actor)->priv;
- const ClutterPaintVolume *source_volume;
-
- /* if the source is not set the paint volume is defined to be empty */
- if (priv->clone_source == NULL)
- return TRUE;
-
- /* query the volume of the source actor and simply masquerade it as
- * the clones volume... */
- source_volume = clutter_actor_get_paint_volume (priv->clone_source);
- if (source_volume == NULL)
- return FALSE;
-
- _clutter_paint_volume_set_from_volume (volume, source_volume);
- _clutter_paint_volume_set_reference_actor (volume, actor);
-
- return TRUE;
-}
-
-static gboolean
-clutter_clone_has_overlaps (ClutterActor *actor)
-{
- ClutterClonePrivate *priv = CLUTTER_CLONE (actor)->priv;
-
- /* The clone has overlaps iff the source has overlaps */
-
- if (priv->clone_source == NULL)
- return FALSE;
-
- return clutter_actor_has_overlaps (priv->clone_source);
-}
-
-static void
-clutter_clone_allocate (ClutterActor *self,
- const ClutterActorBox *box)
-{
- ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv;
- ClutterActorClass *parent_class;
- ClutterActorBox source_box;
- float x_scale, y_scale;
-
- /* chain up */
- parent_class = CLUTTER_ACTOR_CLASS (clutter_clone_parent_class);
- parent_class->allocate (self, box);
-
- 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))
- {
- float x = 0.f;
- float y = 0.f;
-
- clutter_actor_get_fixed_position (priv->clone_source, &x, &y);
- clutter_actor_allocate_preferred_size (priv->clone_source, x, y);
- }
-
- clutter_actor_get_allocation_box (priv->clone_source, &source_box);
-
- /* We need to scale what the clone-source actor paints to fill our own
- * allocation...
- */
- x_scale = clutter_actor_box_get_width (box)
- / clutter_actor_box_get_width (&source_box);
- y_scale = clutter_actor_box_get_height (box)
- / clutter_actor_box_get_height (&source_box);
-
- if (!G_APPROX_VALUE (priv->x_scale, x_scale, FLT_EPSILON) ||
- !G_APPROX_VALUE (priv->y_scale, y_scale, FLT_EPSILON))
- {
- priv->x_scale = x_scale;
- priv->y_scale = y_scale;
- clutter_actor_invalidate_transform (CLUTTER_ACTOR (self));
- }
-
-#if 0
- /* XXX - this is wrong: ClutterClone cannot clone unparented
- * actors, as it will break all invariants
- */
-
- /* we act like a "foster parent" for the source we are cloning;
- * if the source has not been parented we have to force an
- * allocation on it, so that we can paint it correctly from
- * within our paint() implementation. since the actor does not
- * have a parent, and thus it won't be painted by the usual
- * paint cycle, we can safely give it as much size as it requires
- */
- if (clutter_actor_get_parent (priv->clone_source) == NULL)
- clutter_actor_allocate_preferred_size (priv->clone_source);
-#endif
-}
-
-static void
-clutter_clone_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterClone *self = CLUTTER_CLONE (gobject);
-
- switch (prop_id)
- {
- case PROP_SOURCE:
- clutter_clone_set_source (self, g_value_get_object (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_clone_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterClonePrivate *priv = CLUTTER_CLONE (gobject)->priv;
-
- switch (prop_id)
- {
- case PROP_SOURCE:
- g_value_set_object (value, priv->clone_source);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_clone_dispose (GObject *gobject)
-{
- clutter_clone_set_source_internal (CLUTTER_CLONE (gobject), NULL);
-
- G_OBJECT_CLASS (clutter_clone_parent_class)->dispose (gobject);
-}
-
-static void
-clutter_clone_class_init (ClutterCloneClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
-
- actor_class->apply_transform = clutter_clone_apply_transform;
- actor_class->paint = clutter_clone_paint;
- actor_class->get_paint_volume = clutter_clone_get_paint_volume;
- actor_class->get_preferred_width = clutter_clone_get_preferred_width;
- actor_class->get_preferred_height = clutter_clone_get_preferred_height;
- actor_class->allocate = clutter_clone_allocate;
- actor_class->has_overlaps = clutter_clone_has_overlaps;
-
- gobject_class->dispose = clutter_clone_dispose;
- gobject_class->set_property = clutter_clone_set_property;
- gobject_class->get_property = clutter_clone_get_property;
-
- /**
- * ClutterClone:source:
- *
- * This property specifies the source actor being cloned.
- *
- * Since: 1.0
- */
- obj_props[PROP_SOURCE] =
- g_param_spec_object ("source",
- P_("Source"),
- P_("Specifies the actor to be cloned"),
- CLUTTER_TYPE_ACTOR,
- G_PARAM_CONSTRUCT |
- CLUTTER_PARAM_READWRITE);
-
- g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
-}
-
-static void
-clutter_clone_init (ClutterClone *self)
-{
- self->priv = clutter_clone_get_instance_private (self);
-
- self->priv->x_scale = 1.f;
- self->priv->y_scale = 1.f;
-}
-
-/**
- * clutter_clone_new:
- * @source: a #ClutterActor, or %NULL
- *
- * Creates a new #ClutterActor which clones @source/
- *
- * Return value: the newly created #ClutterClone
- *
- * Since: 1.0
- */
-ClutterActor *
-clutter_clone_new (ClutterActor *source)
-{
- return g_object_new (CLUTTER_TYPE_CLONE, "source", source, NULL);
-}
-
-static void
-on_source_destroyed (ClutterActor *source,
- ClutterClone *self)
-{
- clutter_clone_set_source_internal (self, NULL);
-}
-
-static void
-clutter_clone_set_source_internal (ClutterClone *self,
- ClutterActor *source)
-{
- ClutterClonePrivate *priv = self->priv;
-
- if (priv->clone_source == source)
- return;
-
- if (priv->clone_source != NULL)
- {
- g_clear_signal_handler (&priv->source_destroy_id, priv->clone_source);
- _clutter_actor_detach_clone (priv->clone_source, CLUTTER_ACTOR (self));
- g_object_unref (priv->clone_source);
- priv->clone_source = NULL;
- }
-
- if (source != NULL)
- {
- priv->clone_source = g_object_ref (source);
- _clutter_actor_attach_clone (priv->clone_source, CLUTTER_ACTOR (self));
- priv->source_destroy_id = g_signal_connect (priv->clone_source, "destroy",
- G_CALLBACK (on_source_destroyed), self);
- }
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SOURCE]);
-
- clutter_actor_queue_relayout (CLUTTER_ACTOR (self));
-}
-
-/**
- * clutter_clone_set_source:
- * @self: a #ClutterClone
- * @source: (allow-none): a #ClutterActor, or %NULL
- *
- * Sets @source as the source actor to be cloned by @self.
- *
- * Since: 1.0
- */
-void
-clutter_clone_set_source (ClutterClone *self,
- ClutterActor *source)
-{
- g_return_if_fail (CLUTTER_IS_CLONE (self));
- g_return_if_fail (source == NULL || CLUTTER_IS_ACTOR (source));
-
- clutter_clone_set_source_internal (self, source);
- clutter_actor_queue_relayout (CLUTTER_ACTOR (self));
-}
-
-/**
- * clutter_clone_get_source:
- * @self: a #ClutterClone
- *
- * Retrieves the source #ClutterActor being cloned by @self.
- *
- * Return value: (transfer none): the actor source for the clone
- *
- * Since: 1.0
- */
-ClutterActor *
-clutter_clone_get_source (ClutterClone *self)
-{
- g_return_val_if_fail (CLUTTER_IS_CLONE (self), NULL);
-
- return self->priv->clone_source;
-}
diff --git a/clutter/clutter/clutter-clone.h b/clutter/clutter/clutter-clone.h
deleted file mode 100644
index ce4e6f43f..000000000
--- a/clutter/clutter/clutter-clone.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2008 Intel Corporation.
- *
- * Authored By: Robert Bragg <robert@linux.intel.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __CLUTTER_CLONE_H__
-#define __CLUTTER_CLONE_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-actor.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_CLONE (clutter_clone_get_type())
-#define CLUTTER_CLONE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_CLONE, ClutterClone))
-#define CLUTTER_CLONE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_CLONE, ClutterCloneClass))
-#define CLUTTER_IS_CLONE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_CLONE))
-#define CLUTTER_IS_CLONE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_CLONE))
-#define CLUTTER_CLONE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_CLONE, ClutterCloneClass))
-
-typedef struct _ClutterClone ClutterClone;
-typedef struct _ClutterCloneClass ClutterCloneClass;
-typedef struct _ClutterClonePrivate ClutterClonePrivate;
-
-/**
- * ClutterClone:
- *
- * The #ClutterClone structure contains only private data
- * and should be accessed using the provided API
- *
- * Since: 1.0
- */
-struct _ClutterClone
-{
- /*< private >*/
- ClutterActor parent_instance;
-
- ClutterClonePrivate *priv;
-};
-
-/**
- * ClutterCloneClass:
- *
- * The #ClutterCloneClass structure contains only private data
- *
- * Since: 1.0
- */
-struct _ClutterCloneClass
-{
- /*< private >*/
- ClutterActorClass parent_class;
-
- /* padding for future expansion */
- void (*_clutter_actor_clone1) (void);
- void (*_clutter_actor_clone2) (void);
- void (*_clutter_actor_clone3) (void);
- void (*_clutter_actor_clone4) (void);
-};
-
-CLUTTER_EXPORT
-GType clutter_clone_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterActor * clutter_clone_new (ClutterActor *source);
-CLUTTER_EXPORT
-void clutter_clone_set_source (ClutterClone *self,
- ClutterActor *source);
-CLUTTER_EXPORT
-ClutterActor * clutter_clone_get_source (ClutterClone *self);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_CLONE_H__ */
diff --git a/clutter/clutter/clutter-color-static.h b/clutter/clutter/clutter-color-static.h
deleted file mode 100644
index 766864c88..000000000
--- a/clutter/clutter/clutter-color-static.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __CLUTTER_COLOR_STATIC_H__
-#define __CLUTTER_COLOR_STATIC_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#define __CLUTTER_COLOR_SYM(x) (clutter_color_get_static (CLUTTER_COLOR_##x))
-
-#define CLUTTER_COLOR_White (__CLUTTER_COLOR_SYM (WHITE))
-#define CLUTTER_COLOR_Black (__CLUTTER_COLOR_SYM (BLACK))
-#define CLUTTER_COLOR_Red (__CLUTTER_COLOR_SYM (RED))
-#define CLUTTER_COLOR_DarkRed (__CLUTTER_COLOR_SYM (DARK_RED))
-#define CLUTTER_COLOR_Green (__CLUTTER_COLOR_SYM (GREEN))
-#define CLUTTER_COLOR_DarkGreen (__CLUTTER_COLOR_SYM (DARK_GREEN))
-#define CLUTTER_COLOR_Blue (__CLUTTER_COLOR_SYM (BLUE))
-#define CLUTTER_COLOR_DarkBlue (__CLUTTER_COLOR_SYM (DARK_BLUE))
-#define CLUTTER_COLOR_Cyan (__CLUTTER_COLOR_SYM (CYAN))
-#define CLUTTER_COLOR_DarkCyan (__CLUTTER_COLOR_SYM (DARK_CYAN))
-#define CLUTTER_COLOR_Magenta (__CLUTTER_COLOR_SYM (MAGENTA))
-#define CLUTTER_COLOR_DarkMagenta (__CLUTTER_COLOR_SYM (DARK_MAGENTA))
-#define CLUTTER_COLOR_Yellow (__CLUTTER_COLOR_SYM (YELLOW))
-#define CLUTTER_COLOR_DarkYellow (__CLUTTER_COLOR_SYM (DARK_YELLOW))
-#define CLUTTER_COLOR_Gray (__CLUTTER_COLOR_SYM (GRAY))
-#define CLUTTER_COLOR_DarkGray (__CLUTTER_COLOR_SYM (DARK_GRAY))
-#define CLUTTER_COLOR_LightGray (__CLUTTER_COLOR_SYM (LIGHT_GRAY))
-
-#define CLUTTER_COLOR_Butter (__CLUTTER_COLOR_SYM (BUTTER))
-#define CLUTTER_COLOR_LightButter (__CLUTTER_COLOR_SYM (BUTTER_LIGHT))
-#define CLUTTER_COLOR_DarkButter (__CLUTTER_COLOR_SYM (BUTTER_DARK))
-#define CLUTTER_COLOR_Orange (__CLUTTER_COLOR_SYM (ORANGE))
-#define CLUTTER_COLOR_LightOrange (__CLUTTER_COLOR_SYM (ORANGE_LIGHT))
-#define CLUTTER_COLOR_DarkOrange (__CLUTTER_COLOR_SYM (ORANGE_DARK))
-#define CLUTTER_COLOR_Chocolate (__CLUTTER_COLOR_SYM (CHOCOLATE))
-#define CLUTTER_COLOR_LightChocolate (__CLUTTER_COLOR_SYM (CHOCOLATE_LIGHT))
-#define CLUTTER_COLOR_DarkChocolate (__CLUTTER_COLOR_SYM (CHOCOLATE_DARK))
-#define CLUTTER_COLOR_Chameleon (__CLUTTER_COLOR_SYM (CHAMELEON))
-#define CLUTTER_COLOR_LightChameleon (__CLUTTER_COLOR_SYM (CHAMELEON_LIGHT))
-#define CLUTTER_COLOR_DarkChameleon (__CLUTTER_COLOR_SYM (CHAMELEON_DARK))
-#define CLUTTER_COLOR_SkyBlue (__CLUTTER_COLOR_SYM (SKY_BLUE))
-#define CLUTTER_COLOR_LightSkyBlue (__CLUTTER_COLOR_SYM (SKY_BLUE_LIGHT))
-#define CLUTTER_COLOR_DarkSkyBlue (__CLUTTER_COLOR_SYM (SKY_BLUE_DARK))
-#define CLUTTER_COLOR_Plum (__CLUTTER_COLOR_SYM (PLUM))
-#define CLUTTER_COLOR_LightPlum (__CLUTTER_COLOR_SYM (PLUM_LIGHT))
-#define CLUTTER_COLOR_DarkPlum (__CLUTTER_COLOR_SYM (PLUM_DARK))
-#define CLUTTER_COLOR_ScarletRed (__CLUTTER_COLOR_SYM (SCARLET_RED))
-#define CLUTTER_COLOR_LightScarletRed (__CLUTTER_COLOR_SYM (SCARLET_RED_LIGHT))
-#define CLUTTER_COLOR_DarkScarletRed (__CLUTTER_COLOR_SYM (SCARLET_RED_DARK))
-#define CLUTTER_COLOR_Aluminium1 (__CLUTTER_COLOR_SYM (ALUMINIUM_1))
-#define CLUTTER_COLOR_Aluminium2 (__CLUTTER_COLOR_SYM (ALUMINIUM_2))
-#define CLUTTER_COLOR_Aluminium3 (__CLUTTER_COLOR_SYM (ALUMINIUM_3))
-#define CLUTTER_COLOR_Aluminium4 (__CLUTTER_COLOR_SYM (ALUMINIUM_4))
-#define CLUTTER_COLOR_Aluminium5 (__CLUTTER_COLOR_SYM (ALUMINIUM_5))
-#define CLUTTER_COLOR_Aluminium6 (__CLUTTER_COLOR_SYM (ALUMINIUM_6))
-
-#define CLUTTER_COLOR_Transparent (__CLUTTER_COLOR_SYM (TRANSPARENT))
-
-#endif /* __CLUTTER_COLOR_STATIC_H__ */
diff --git a/clutter/clutter/clutter-color.c b/clutter/clutter/clutter-color.c
deleted file mode 100644
index ddd41a253..000000000
--- a/clutter/clutter/clutter-color.c
+++ /dev/null
@@ -1,1193 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- *
- * Copyright (C) 2006 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * SECTION:clutter-color
- * @short_description: Color management and manipulation.
- *
- * #ClutterColor is a simple type for representing colors in Clutter.
- *
- * A #ClutterColor is expressed as a 4-tuple of values ranging from
- * zero to 255, one for each color channel plus one for the alpha.
- *
- * The alpha channel is fully opaque at 255 and fully transparent at 0.
- */
-
-#include "clutter-build-config.h"
-
-#include <math.h>
-
-#include <pango/pango-attributes.h>
-
-#include "clutter-interval.h"
-#include "clutter-main.h"
-#include "clutter-color.h"
-#include "clutter-private.h"
-#include "clutter-debug.h"
-
-/* XXX - keep in sync with the ClutterStaticColor enumeration order */
-static const ClutterColor static_colors[] = {
- /* CGA/EGA color palette */
- { 0xff, 0xff, 0xff, 0xff }, /* white */
- { 0x00, 0x00, 0x00, 0xff }, /* black */
- { 0xff, 0x00, 0x00, 0xff }, /* red */
- { 0x80, 0x00, 0x00, 0xff }, /* dark red */
- { 0x00, 0xff, 0x00, 0xff }, /* green */
- { 0x00, 0x80, 0x00, 0xff }, /* dark green */
- { 0x00, 0x00, 0xff, 0xff }, /* blue */
- { 0x00, 0x00, 0x80, 0xff }, /* dark blue */
- { 0x00, 0xff, 0xff, 0xff }, /* cyan */
- { 0x00, 0x80, 0x80, 0xff }, /* dark cyan */
- { 0xff, 0x00, 0xff, 0xff }, /* magenta */
- { 0x80, 0x00, 0x80, 0xff }, /* dark magenta */
- { 0xff, 0xff, 0x00, 0xff }, /* yellow */
- { 0x80, 0x80, 0x00, 0xff }, /* dark yellow */
- { 0xa0, 0xa0, 0xa4, 0xff }, /* gray */
- { 0x80, 0x80, 0x80, 0xff }, /* dark gray */
- { 0xc0, 0xc0, 0xc0, 0xff }, /* light gray */
-
- /* Tango Icon color palette */
- { 0xed, 0xd4, 0x00, 0xff }, /* butter */
- { 0xfc, 0xe9, 0x4f, 0xff }, /* butter light */
- { 0xc4, 0xa0, 0x00, 0xff }, /* butter dark */
- { 0xf5, 0x79, 0x00, 0xff }, /* orange */
- { 0xfc, 0xaf, 0x3e, 0xff }, /* orange light */
- { 0xce, 0x5c, 0x00, 0xff }, /* orange dark */
- { 0xc1, 0x7d, 0x11, 0xff }, /* chocolate */
- { 0xe9, 0xb9, 0x6e, 0xff }, /* chocolate light */
- { 0x8f, 0x59, 0x02, 0xff }, /* chocolate dark */
- { 0x73, 0xd2, 0x16, 0xff }, /* chameleon */
- { 0x8a, 0xe2, 0x34, 0xff }, /* chameleon light */
- { 0x4e, 0x9a, 0x06, 0xff }, /* chameleon dark */
- { 0x34, 0x65, 0xa4, 0xff }, /* sky blue */
- { 0x72, 0x9f, 0xcf, 0xff }, /* sky blue light */
- { 0x20, 0x4a, 0x87, 0xff }, /* sky blue dark */
- { 0x75, 0x50, 0x7b, 0xff }, /* plum */
- { 0xad, 0x7f, 0xa8, 0xff }, /* plum light */
- { 0x5c, 0x35, 0x66, 0xff }, /* plum dark */
- { 0xcc, 0x00, 0x00, 0xff }, /* scarlet red */
- { 0xef, 0x29, 0x29, 0xff }, /* scarlet red light */
- { 0xa4, 0x00, 0x00, 0xff }, /* scarlet red dark */
- { 0xee, 0xee, 0xec, 0xff }, /* aluminium 1 */
- { 0xd3, 0xd7, 0xcf, 0xff }, /* aluminium 2 */
- { 0xba, 0xbd, 0xb6, 0xff }, /* aluminium 3 */
- { 0x88, 0x8a, 0x85, 0xff }, /* aluminium 4 */
- { 0x55, 0x57, 0x53, 0xff }, /* aluminium 5 */
- { 0x2e, 0x34, 0x36, 0xff }, /* aluminium 6 */
-
- /* last color */
- { 0x00, 0x00, 0x00, 0x00 } /* transparent */
-};
-
-/**
- * clutter_color_get_static:
- * @color: the named global color
- *
- * Retrieves a static color for the given @color name
- *
- * Static colors are created by Clutter and are guaranteed to always be
- * available and valid
- *
- * Return value: a pointer to a static color; the returned pointer
- * is owned by Clutter and it should never be modified or freed
- *
- * Since: 1.6
- */
-const ClutterColor *
-clutter_color_get_static (ClutterStaticColor color)
-{
- g_return_val_if_fail (color >= CLUTTER_COLOR_WHITE &&
- color <= CLUTTER_COLOR_TRANSPARENT, NULL);
-
- return &static_colors[color];
-}
-
-/**
- * clutter_color_add:
- * @a: a #ClutterColor
- * @b: a #ClutterColor
- * @result: (out caller-allocates): return location for the result
- *
- * Adds @a to @b and saves the resulting color inside @result.
- *
- * The alpha channel of @result is set as as the maximum value
- * between the alpha channels of @a and @b.
- */
-void
-clutter_color_add (const ClutterColor *a,
- const ClutterColor *b,
- ClutterColor *result)
-{
- g_return_if_fail (a != NULL);
- g_return_if_fail (b != NULL);
- g_return_if_fail (result != NULL);
-
- result->red = CLAMP (a->red + b->red, 0, 255);
- result->green = CLAMP (a->green + b->green, 0, 255);
- result->blue = CLAMP (a->blue + b->blue, 0, 255);
-
- result->alpha = MAX (a->alpha, b->alpha);
-}
-
-/**
- * clutter_color_subtract:
- * @a: a #ClutterColor
- * @b: a #ClutterColor
- * @result: (out caller-allocates): return location for the result
- *
- * Subtracts @b from @a and saves the resulting color inside @result.
- *
- * This function assumes that the components of @a are greater than the
- * components of @b; the result is, otherwise, undefined.
- *
- * The alpha channel of @result is set as the minimum value
- * between the alpha channels of @a and @b.
- */
-void
-clutter_color_subtract (const ClutterColor *a,
- const ClutterColor *b,
- ClutterColor *result)
-{
- g_return_if_fail (a != NULL);
- g_return_if_fail (b != NULL);
- g_return_if_fail (result != NULL);
-
- result->red = CLAMP (a->red - b->red, 0, 255);
- result->green = CLAMP (a->green - b->green, 0, 255);
- result->blue = CLAMP (a->blue - b->blue, 0, 255);
-
- result->alpha = MIN (a->alpha, b->alpha);
-}
-
-/**
- * clutter_color_lighten:
- * @color: a #ClutterColor
- * @result: (out caller-allocates): return location for the lighter color
- *
- * Lightens @color by a fixed amount, and saves the changed color
- * in @result.
- */
-void
-clutter_color_lighten (const ClutterColor *color,
- ClutterColor *result)
-{
- clutter_color_shade (color, 1.3, result);
-}
-
-/**
- * clutter_color_darken:
- * @color: a #ClutterColor
- * @result: (out caller-allocates): return location for the darker color
- *
- * Darkens @color by a fixed amount, and saves the changed color
- * in @result.
- */
-void
-clutter_color_darken (const ClutterColor *color,
- ClutterColor *result)
-{
- clutter_color_shade (color, 0.7, result);
-}
-
-/**
- * clutter_color_to_hls:
- * @color: a #ClutterColor
- * @hue: (out): return location for the hue value or %NULL
- * @luminance: (out): return location for the luminance value or %NULL
- * @saturation: (out): return location for the saturation value or %NULL
- *
- * Converts @color to the HLS format.
- *
- * The @hue value is in the 0 .. 360 range. The @luminance and
- * @saturation values are in the 0 .. 1 range.
- */
-void
-clutter_color_to_hls (const ClutterColor *color,
- float *hue,
- float *luminance,
- float *saturation)
-{
- float red, green, blue;
- float min, max, delta;
- float h, l, s;
-
- g_return_if_fail (color != NULL);
-
- red = color->red / 255.0;
- green = color->green / 255.0;
- blue = color->blue / 255.0;
-
- if (red > green)
- {
- if (red > blue)
- max = red;
- else
- max = blue;
-
- if (green < blue)
- min = green;
- else
- min = blue;
- }
- else
- {
- if (green > blue)
- max = green;
- else
- max = blue;
-
- if (red < blue)
- min = red;
- else
- min = blue;
- }
-
- l = (max + min) / 2;
- s = 0;
- h = 0;
-
- if (max != min)
- {
- if (l <= 0.5)
- s = (max - min) / (max + min);
- else
- s = (max - min) / (2.0 - max - min);
-
- delta = max - min;
-
- if (red == max)
- h = (green - blue) / delta;
- else if (green == max)
- h = 2.0 + (blue - red) / delta;
- else if (blue == max)
- h = 4.0 + (red - green) / delta;
-
- h *= 60;
-
- if (h < 0)
- h += 360.0;
- }
-
- if (hue)
- *hue = h;
-
- if (luminance)
- *luminance = l;
-
- if (saturation)
- *saturation = s;
-}
-
-/**
- * clutter_color_from_hls:
- * @color: (out): return location for a #ClutterColor
- * @hue: hue value, in the 0 .. 360 range
- * @luminance: luminance value, in the 0 .. 1 range
- * @saturation: saturation value, in the 0 .. 1 range
- *
- * Converts a color expressed in HLS (hue, luminance and saturation)
- * values into a #ClutterColor.
- */
-void
-clutter_color_from_hls (ClutterColor *color,
- float hue,
- float luminance,
- float saturation)
-{
- float tmp1, tmp2;
- float tmp3[3];
- float clr[3];
- int i;
-
- hue /= 360.0;
-
- if (saturation == 0)
- {
- color->red = color->green = color->blue = (luminance * 255);
-
- return;
- }
-
- if (luminance <= 0.5)
- tmp2 = luminance * (1.0 + saturation);
- else
- tmp2 = luminance + saturation - (luminance * saturation);
-
- tmp1 = 2.0 * luminance - tmp2;
-
- tmp3[0] = hue + 1.0 / 3.0;
- tmp3[1] = hue;
- tmp3[2] = hue - 1.0 / 3.0;
-
- for (i = 0; i < 3; i++)
- {
- if (tmp3[i] < 0)
- tmp3[i] += 1.0;
-
- if (tmp3[i] > 1)
- tmp3[i] -= 1.0;
-
- if (6.0 * tmp3[i] < 1.0)
- clr[i] = tmp1 + (tmp2 - tmp1) * tmp3[i] * 6.0;
- else if (2.0 * tmp3[i] < 1.0)
- clr[i] = tmp2;
- else if (3.0 * tmp3[i] < 2.0)
- clr[i] = (tmp1 + (tmp2 - tmp1) * ((2.0 / 3.0) - tmp3[i]) * 6.0);
- else
- clr[i] = tmp1;
- }
-
- color->red = floorf (clr[0] * 255.0 + 0.5);
- color->green = floorf (clr[1] * 255.0 + 0.5);
- color->blue = floorf (clr[2] * 255.0 + 0.5);
-}
-
-/**
- * clutter_color_shade:
- * @color: a #ClutterColor
- * @factor: the shade factor to apply
- * @result: (out caller-allocates): return location for the shaded color
- *
- * Shades @color by @factor and saves the modified color into @result.
- */
-void
-clutter_color_shade (const ClutterColor *color,
- gdouble factor,
- ClutterColor *result)
-{
- float h, l, s;
-
- g_return_if_fail (color != NULL);
- g_return_if_fail (result != NULL);
-
- clutter_color_to_hls (color, &h, &l, &s);
-
- l = CLAMP (l * factor, 0.0, 1.0);
- s = CLAMP (s * factor, 0.0, 1.0);
-
- clutter_color_from_hls (result, h, l, s);
-
- result->alpha = color->alpha;
-}
-
-/**
- * clutter_color_to_pixel:
- * @color: a #ClutterColor
- *
- * Converts @color into a packed 32 bit integer, containing
- * all the four 8 bit channels used by #ClutterColor.
- *
- * Return value: a packed color
- */
-guint32
-clutter_color_to_pixel (const ClutterColor *color)
-{
- g_return_val_if_fail (color != NULL, 0);
-
- return (color->alpha |
- color->blue << 8 |
- color->green << 16 |
- color->red << 24);
-}
-
-/**
- * clutter_color_from_pixel:
- * @color: (out caller-allocates): return location for a #ClutterColor
- * @pixel: a 32 bit packed integer containing a color
- *
- * Converts @pixel from the packed representation of a four 8 bit channel
- * color to a #ClutterColor.
- */
-void
-clutter_color_from_pixel (ClutterColor *color,
- guint32 pixel)
-{
- g_return_if_fail (color != NULL);
-
- color->red = pixel >> 24;
- color->green = (pixel >> 16) & 0xff;
- color->blue = (pixel >> 8) & 0xff;
- color->alpha = pixel & 0xff;
-}
-
-static inline void
-skip_whitespace (gchar **str)
-{
- while (g_ascii_isspace (**str))
- *str += 1;
-}
-
-static inline void
-parse_rgb_value (gchar *str,
- guint8 *color,
- gchar **endp)
-{
- gdouble number;
- gchar *p;
-
- skip_whitespace (&str);
-
- number = g_ascii_strtod (str, endp);
-
- p = *endp;
-
- skip_whitespace (&p);
-
- if (*p == '%')
- {
- *endp = (gchar *) (p + 1);
-
- *color = CLAMP (number / 100.0, 0.0, 1.0) * 255;
- }
- else
- *color = CLAMP (number, 0, 255);
-}
-
-static gboolean
-parse_rgba (ClutterColor *color,
- gchar *str,
- gboolean has_alpha)
-{
- skip_whitespace (&str);
-
- if (*str != '(')
- return FALSE;
-
- str += 1;
-
- /* red */
- parse_rgb_value (str, &color->red, &str);
- skip_whitespace (&str);
- if (*str != ',')
- return FALSE;
-
- str += 1;
-
- /* green */
- parse_rgb_value (str, &color->green, &str);
- skip_whitespace (&str);
- if (*str != ',')
- return FALSE;
-
- str += 1;
-
- /* blue */
- parse_rgb_value (str, &color->blue, &str);
- skip_whitespace (&str);
-
- /* alpha (optional); since the alpha channel value can only
- * be between 0 and 1 we don't use the parse_rgb_value()
- * function
- */
- if (has_alpha)
- {
- gdouble number;
-
- if (*str != ',')
- return FALSE;
-
- str += 1;
-
- skip_whitespace (&str);
- number = g_ascii_strtod (str, &str);
-
- color->alpha = CLAMP (number * 255.0, 0, 255);
- }
- else
- color->alpha = 255;
-
- skip_whitespace (&str);
- if (*str != ')')
- return FALSE;
-
- return TRUE;
-}
-
-static gboolean
-parse_hsla (ClutterColor *color,
- gchar *str,
- gboolean has_alpha)
-{
- gdouble number;
- gdouble h, l, s;
-
- skip_whitespace (&str);
-
- if (*str != '(')
- return FALSE;
-
- str += 1;
-
- /* hue */
- skip_whitespace (&str);
- /* we don't do any angle normalization here because
- * clutter_color_from_hls() will do it for us
- */
- number = g_ascii_strtod (str, &str);
- skip_whitespace (&str);
- if (*str != ',')
- return FALSE;
-
- h = number;
-
- str += 1;
-
- /* saturation */
- skip_whitespace (&str);
- number = g_ascii_strtod (str, &str);
- skip_whitespace (&str);
- if (*str != '%')
- return FALSE;
-
- str += 1;
-
- s = CLAMP (number / 100.0, 0.0, 1.0);
- skip_whitespace (&str);
- if (*str != ',')
- return FALSE;
-
- str += 1;
-
- /* luminance */
- skip_whitespace (&str);
- number = g_ascii_strtod (str, &str);
- skip_whitespace (&str);
- if (*str != '%')
- return FALSE;
-
- str += 1;
-
- l = CLAMP (number / 100.0, 0.0, 1.0);
- skip_whitespace (&str);
-
- /* alpha (optional); since the alpha channel value can only
- * be between 0 and 1 we don't use the parse_rgb_value()
- * function
- */
- if (has_alpha)
- {
- if (*str != ',')
- return FALSE;
-
- str += 1;
-
- skip_whitespace (&str);
- number = g_ascii_strtod (str, &str);
-
- color->alpha = CLAMP (number * 255.0, 0, 255);
- }
- else
- color->alpha = 255;
-
- skip_whitespace (&str);
- if (*str != ')')
- return FALSE;
-
- clutter_color_from_hls (color, h, l, s);
-
- return TRUE;
-}
-
-/**
- * clutter_color_from_string:
- * @color: (out caller-allocates): return location for a #ClutterColor
- * @str: a string specifying a color
- *
- * Parses a string definition of a color, filling the #ClutterColor.red,
- * #ClutterColor.green, #ClutterColor.blue and #ClutterColor.alpha fields
- * of @color.
- *
- * The @color is not allocated.
- *
- * The format of @str can be either one of:
- *
- * - a standard name (as taken from the X11 rgb.txt file)
- * - an hexadecimal value in the form: `#rgb`, `#rrggbb`, `#rgba`, or `#rrggbbaa`
- * - a RGB color in the form: `rgb(r, g, b)`
- * - a RGB color in the form: `rgba(r, g, b, a)`
- * - a HSL color in the form: `hsl(h, s, l)`
- * -a HSL color in the form: `hsla(h, s, l, a)`
- *
- * where 'r', 'g', 'b' and 'a' are (respectively) the red, green, blue color
- * intensities and the opacity. The 'h', 's' and 'l' are (respectively) the
- * hue, saturation and luminance values.
- *
- * In the rgb() and rgba() formats, the 'r', 'g', and 'b' values are either
- * integers between 0 and 255, or percentage values in the range between 0%
- * and 100%; the percentages require the '%' character. The 'a' value, if
- * specified, can only be a floating point value between 0.0 and 1.0.
- *
- * In the hls() and hlsa() formats, the 'h' value (hue) is an angle between
- * 0 and 360.0 degrees; the 'l' and 's' values (luminance and saturation) are
- * percentage values in the range between 0% and 100%. The 'a' value, if specified,
- * can only be a floating point value between 0.0 and 1.0.
- *
- * Whitespace inside the definitions is ignored; no leading whitespace
- * is allowed.
- *
- * If the alpha component is not specified then it is assumed to be set to
- * be fully opaque.
- *
- * Return value: %TRUE if parsing succeeded, and %FALSE otherwise
- *
- * Since: 1.0
- */
-gboolean
-clutter_color_from_string (ClutterColor *color,
- const gchar *str)
-{
- PangoColor pango_color = { 0, };
-
- g_return_val_if_fail (color != NULL, FALSE);
- g_return_val_if_fail (str != NULL, FALSE);
-
- if (strncmp (str, "rgb", 3) == 0)
- {
- gchar *s = (gchar *) str;
- gboolean res;
-
- if (strncmp (str, "rgba", 4) == 0)
- res = parse_rgba (color, s + 4, TRUE);
- else
- res = parse_rgba (color, s + 3, FALSE);
-
- return res;
- }
-
- if (strncmp (str, "hsl", 3) == 0)
- {
- gchar *s = (gchar *) str;
- gboolean res;
-
- if (strncmp (str, "hsla", 4) == 0)
- res = parse_hsla (color, s + 4, TRUE);
- else
- res = parse_hsla (color, s + 3, FALSE);
-
- return res;
- }
-
- /* if the string contains a color encoded using the hexadecimal
- * notations (#rrggbbaa or #rgba) we attempt a rough pass at
- * parsing the color ourselves, as we need the alpha channel that
- * Pango can't retrieve.
- */
- if (str[0] == '#' && str[1] != '\0')
- {
- gsize length = strlen (str + 1);
- gint32 result;
-
- if (sscanf (str + 1, "%x", &result) == 1)
- {
- switch (length)
- {
- case 8: /* rrggbbaa */
- color->red = (result >> 24) & 0xff;
- color->green = (result >> 16) & 0xff;
- color->blue = (result >> 8) & 0xff;
-
- color->alpha = result & 0xff;
-
- return TRUE;
-
- case 6: /* #rrggbb */
- color->red = (result >> 16) & 0xff;
- color->green = (result >> 8) & 0xff;
- color->blue = result & 0xff;
-
- color->alpha = 0xff;
-
- return TRUE;
-
- case 4: /* #rgba */
- color->red = ((result >> 12) & 0xf);
- color->green = ((result >> 8) & 0xf);
- color->blue = ((result >> 4) & 0xf);
- color->alpha = result & 0xf;
-
- color->red = (color->red << 4) | color->red;
- color->green = (color->green << 4) | color->green;
- color->blue = (color->blue << 4) | color->blue;
- color->alpha = (color->alpha << 4) | color->alpha;
-
- return TRUE;
-
- case 3: /* #rgb */
- color->red = ((result >> 8) & 0xf);
- color->green = ((result >> 4) & 0xf);
- color->blue = result & 0xf;
-
- color->red = (color->red << 4) | color->red;
- color->green = (color->green << 4) | color->green;
- color->blue = (color->blue << 4) | color->blue;
-
- color->alpha = 0xff;
-
- return TRUE;
-
- default:
- return FALSE;
- }
- }
- }
-
- /* fall back to pango for X11-style named colors; see:
- *
- * http://en.wikipedia.org/wiki/X11_color_names
- *
- * for a list. at some point we might even ship with our own list generated
- * from X11/rgb.txt, like we generate the key symbols.
- */
- if (pango_color_parse (&pango_color, str))
- {
- color->red = pango_color.red;
- color->green = pango_color.green;
- color->blue = pango_color.blue;
-
- color->alpha = 0xff;
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-/**
- * clutter_color_to_string:
- * @color: a #ClutterColor
- *
- * Returns a textual specification of @color in the hexadecimal form
- * <literal>&num;rrggbbaa</literal>, where <literal>r</literal>,
- * <literal>g</literal>, <literal>b</literal> and <literal>a</literal> are
- * hexadecimal digits representing the red, green, blue and alpha components
- * respectively.
- *
- * Return value: (transfer full): a newly-allocated text string
- *
- * Since: 0.2
- */
-gchar *
-clutter_color_to_string (const ClutterColor *color)
-{
- g_return_val_if_fail (color != NULL, NULL);
-
- return g_strdup_printf ("#%02x%02x%02x%02x",
- color->red,
- color->green,
- color->blue,
- color->alpha);
-}
-
-/**
- * clutter_color_equal:
- * @v1: (type Clutter.Color): a #ClutterColor
- * @v2: (type Clutter.Color): a #ClutterColor
- *
- * Compares two #ClutterColor<!-- -->s and checks if they are the same.
- *
- * This function can be passed to g_hash_table_new() as the @key_equal_func
- * parameter, when using #ClutterColor<!-- -->s as keys in a #GHashTable.
- *
- * Return value: %TRUE if the two colors are the same.
- *
- * Since: 0.2
- */
-gboolean
-clutter_color_equal (gconstpointer v1,
- gconstpointer v2)
-{
- const ClutterColor *a, *b;
-
- g_return_val_if_fail (v1 != NULL, FALSE);
- g_return_val_if_fail (v2 != NULL, FALSE);
-
- if (v1 == v2)
- return TRUE;
-
- a = v1;
- b = v2;
-
- return (a->red == b->red &&
- a->green == b->green &&
- a->blue == b->blue &&
- a->alpha == b->alpha);
-}
-
-/**
- * clutter_color_hash:
- * @v: (type Clutter.Color): a #ClutterColor
- *
- * Converts a #ClutterColor to a hash value.
- *
- * This function can be passed to g_hash_table_new() as the @hash_func
- * parameter, when using #ClutterColor<!-- -->s as keys in a #GHashTable.
- *
- * Return value: a hash value corresponding to the color
- *
- * Since: 1.0
- */
-guint
-clutter_color_hash (gconstpointer v)
-{
- return clutter_color_to_pixel ((const ClutterColor *) v);
-}
-
-/**
- * clutter_color_interpolate:
- * @initial: the initial #ClutterColor
- * @final: the final #ClutterColor
- * @progress: the interpolation progress
- * @result: (out): return location for the interpolation
- *
- * Interpolates between @initial and @final #ClutterColor<!-- -->s
- * using @progress
- *
- * Since: 1.6
- */
-void
-clutter_color_interpolate (const ClutterColor *initial,
- const ClutterColor *final,
- gdouble progress,
- ClutterColor *result)
-{
- g_return_if_fail (initial != NULL);
- g_return_if_fail (final != NULL);
- g_return_if_fail (result != NULL);
-
- result->red = initial->red + (final->red - initial->red) * progress;
- result->green = initial->green + (final->green - initial->green) * progress;
- result->blue = initial->blue + (final->blue - initial->blue) * progress;
- result->alpha = initial->alpha + (final->alpha - initial->alpha) * progress;
-}
-
-static gboolean
-clutter_color_progress (const GValue *a,
- const GValue *b,
- gdouble progress,
- GValue *retval)
-{
- const ClutterColor *a_color = clutter_value_get_color (a);
- const ClutterColor *b_color = clutter_value_get_color (b);
- ClutterColor res = { 0, };
-
- clutter_color_interpolate (a_color, b_color, progress, &res);
- clutter_value_set_color (retval, &res);
-
- return TRUE;
-}
-
-/**
- * clutter_color_copy:
- * @color: a #ClutterColor
- *
- * Makes a copy of the color structure. The result must be
- * freed using clutter_color_free().
- *
- * Return value: (transfer full): an allocated copy of @color.
- *
- * Since: 0.2
- */
-ClutterColor *
-clutter_color_copy (const ClutterColor *color)
-{
- if (G_LIKELY (color != NULL))
- return g_memdup2 (color, sizeof (ClutterColor));
-
- return NULL;
-}
-
-/**
- * clutter_color_free:
- * @color: a #ClutterColor
- *
- * Frees a color structure created with clutter_color_copy().
- *
- * Since: 0.2
- */
-void
-clutter_color_free (ClutterColor *color)
-{
- if (G_LIKELY (color != NULL))
- g_free (color);
-}
-
-/**
- * clutter_color_new:
- * @red: red component of the color, between 0 and 255
- * @green: green component of the color, between 0 and 255
- * @blue: blue component of the color, between 0 and 255
- * @alpha: alpha component of the color, between 0 and 255
- *
- * Creates a new #ClutterColor with the given values.
- *
- * This function is the equivalent of:
- *
- * |[
- * clutter_color_init (clutter_color_alloc (), red, green, blue, alpha);
- * ]|
- *
- * Return value: (transfer full): the newly allocated color.
- * Use clutter_color_free() when done
- *
- * Since: 0.8
- */
-ClutterColor *
-clutter_color_new (guint8 red,
- guint8 green,
- guint8 blue,
- guint8 alpha)
-{
- return clutter_color_init (clutter_color_alloc (),
- red,
- green,
- blue,
- alpha);
-}
-
-/**
- * clutter_color_alloc: (constructor)
- *
- * Allocates a new, transparent black #ClutterColor.
- *
- * Return value: (transfer full): the newly allocated #ClutterColor; use
- * clutter_color_free() to free its resources
- *
- * Since: 1.12
- */
-ClutterColor *
-clutter_color_alloc (void)
-{
- return g_new0 (ClutterColor, 1);
-}
-
-/**
- * clutter_color_init:
- * @color: a #ClutterColor
- * @red: red component of the color, between 0 and 255
- * @green: green component of the color, between 0 and 255
- * @blue: blue component of the color, between 0 and 255
- * @alpha: alpha component of the color, between 0 and 255
- *
- * Initializes @color with the given values.
- *
- * Return value: (transfer none): the initialized #ClutterColor
- *
- * Since: 1.12
- */
-ClutterColor *
-clutter_color_init (ClutterColor *color,
- guint8 red,
- guint8 green,
- guint8 blue,
- guint8 alpha)
-{
- g_return_val_if_fail (color != NULL, NULL);
-
- color->red = red;
- color->green = green;
- color->blue = blue;
- color->alpha = alpha;
-
- return color;
-}
-
-static void
-clutter_value_transform_color_string (const GValue *src,
- GValue *dest)
-{
- const ClutterColor *color = g_value_get_boxed (src);
-
- if (color)
- {
- gchar *string = clutter_color_to_string (color);
-
- g_value_take_string (dest, string);
- }
- else
- g_value_set_string (dest, NULL);
-}
-
-static void
-clutter_value_transform_string_color (const GValue *src,
- GValue *dest)
-{
- const char *str = g_value_get_string (src);
-
- if (str)
- {
- ClutterColor color = { 0, };
-
- clutter_color_from_string (&color, str);
-
- clutter_value_set_color (dest, &color);
- }
- else
- clutter_value_set_color (dest, NULL);
-}
-
-G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterColor, clutter_color,
- clutter_color_copy,
- clutter_color_free,
- CLUTTER_REGISTER_VALUE_TRANSFORM_TO (G_TYPE_STRING, clutter_value_transform_color_string)
- CLUTTER_REGISTER_VALUE_TRANSFORM_FROM (G_TYPE_STRING, clutter_value_transform_string_color)
- CLUTTER_REGISTER_INTERVAL_PROGRESS (clutter_color_progress));
-
-/**
- * clutter_value_set_color:
- * @value: a #GValue initialized to #CLUTTER_TYPE_COLOR
- * @color: the color to set
- *
- * Sets @value to @color.
- *
- * Since: 0.8
- */
-void
-clutter_value_set_color (GValue *value,
- const ClutterColor *color)
-{
- g_return_if_fail (CLUTTER_VALUE_HOLDS_COLOR (value));
-
- g_value_set_boxed (value, color);
-}
-
-/**
- * clutter_value_get_color:
- * @value: a #GValue initialized to #CLUTTER_TYPE_COLOR
- *
- * Gets the #ClutterColor contained in @value.
- *
- * Return value: (transfer none): the color inside the passed #GValue
- *
- * Since: 0.8
- */
-const ClutterColor *
-clutter_value_get_color (const GValue *value)
-{
- g_return_val_if_fail (CLUTTER_VALUE_HOLDS_COLOR (value), NULL);
-
- return g_value_get_boxed (value);
-}
-
-static void
-param_color_init (GParamSpec *pspec)
-{
- ClutterParamSpecColor *cspec = CLUTTER_PARAM_SPEC_COLOR (pspec);
-
- cspec->default_value = NULL;
-}
-
-static void
-param_color_finalize (GParamSpec *pspec)
-{
- ClutterParamSpecColor *cspec = CLUTTER_PARAM_SPEC_COLOR (pspec);
-
- clutter_color_free (cspec->default_value);
-}
-
-static void
-param_color_set_default (GParamSpec *pspec,
- GValue *value)
-{
- const ClutterColor *default_value =
- CLUTTER_PARAM_SPEC_COLOR (pspec)->default_value;
- clutter_value_set_color (value, default_value);
-}
-
-static gint
-param_color_values_cmp (GParamSpec *pspec,
- const GValue *value1,
- const GValue *value2)
-{
- const ClutterColor *color1 = g_value_get_boxed (value1);
- const ClutterColor *color2 = g_value_get_boxed (value2);
- int pixel1, pixel2;
-
- if (color1 == NULL)
- return color2 == NULL ? 0 : -1;
-
- pixel1 = clutter_color_to_pixel (color1);
- pixel2 = clutter_color_to_pixel (color2);
-
- if (pixel1 < pixel2)
- return -1;
- else if (pixel1 == pixel2)
- return 0;
- else
- return 1;
-}
-
-GType
-clutter_param_color_get_type (void)
-{
- static GType pspec_type = 0;
-
- if (G_UNLIKELY (pspec_type == 0))
- {
- const GParamSpecTypeInfo pspec_info = {
- sizeof (ClutterParamSpecColor),
- 16,
- param_color_init,
- CLUTTER_TYPE_COLOR,
- param_color_finalize,
- param_color_set_default,
- NULL,
- param_color_values_cmp,
- };
-
- pspec_type = g_param_type_register_static (I_("ClutterParamSpecColor"),
- &pspec_info);
- }
-
- return pspec_type;
-}
-
-/**
- * clutter_param_spec_color: (skip)
- * @name: name of the property
- * @nick: short name
- * @blurb: description (can be translatable)
- * @default_value: default value
- * @flags: flags for the param spec
- *
- * Creates a #GParamSpec for properties using #ClutterColor.
- *
- * Return value: the newly created #GParamSpec
- *
- * Since: 0.8
- */
-GParamSpec *
-clutter_param_spec_color (const gchar *name,
- const gchar *nick,
- const gchar *blurb,
- const ClutterColor *default_value,
- GParamFlags flags)
-{
- ClutterParamSpecColor *cspec;
-
- cspec = g_param_spec_internal (CLUTTER_TYPE_PARAM_COLOR,
- name, nick, blurb, flags);
-
- cspec->default_value = clutter_color_copy (default_value);
-
- return G_PARAM_SPEC (cspec);
-}
diff --git a/clutter/clutter/clutter-color.h b/clutter/clutter/clutter-color.h
deleted file mode 100644
index cff493789..000000000
--- a/clutter/clutter/clutter-color.h
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By: Matthew Allum <mallum@openedhand.com>
- * Emmanuele Bassi <ebassi@linux.intel.com>
- *
- * Copyright (C) 2006, 2007, 2008 OpenedHand
- * Copyright (C) 2009 Intel Corp.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __CLUTTER_COLOR_H__
-#define __CLUTTER_COLOR_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-types.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_COLOR (clutter_color_get_type ())
-
-/**
- * ClutterColor:
- * @red: red component, between 0 and 255
- * @green: green component, between 0 and 255
- * @blue: blue component, between 0 and 255
- * @alpha: alpha component, between 0 and 255
- *
- * Color representation.
- */
-struct _ClutterColor
-{
- /*< public >*/
- guint8 red;
- guint8 green;
- guint8 blue;
-
- guint8 alpha;
-};
-
-/**
- * CLUTTER_COLOR_INIT:
- * @r: value for the red channel, between 0 and 255
- * @g: value for the green channel, between 0 and 255
- * @b: value for the blue channel, between 0 and 255
- * @a: value for the alpha channel, between 0 and 255
- *
- * A macro that initializes a #ClutterColor, to be used when declaring it.
- *
- * Since: 1.12
- */
-#define CLUTTER_COLOR_INIT(r,g,b,a) { (r), (g), (b), (a) }
-
-CLUTTER_EXPORT
-GType clutter_color_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterColor *clutter_color_new (guint8 red,
- guint8 green,
- guint8 blue,
- guint8 alpha);
-CLUTTER_EXPORT
-ClutterColor *clutter_color_alloc (void);
-CLUTTER_EXPORT
-ClutterColor *clutter_color_init (ClutterColor *color,
- guint8 red,
- guint8 green,
- guint8 blue,
- guint8 alpha);
-CLUTTER_EXPORT
-ClutterColor *clutter_color_copy (const ClutterColor *color);
-CLUTTER_EXPORT
-void clutter_color_free (ClutterColor *color);
-
-CLUTTER_EXPORT
-void clutter_color_add (const ClutterColor *a,
- const ClutterColor *b,
- ClutterColor *result);
-CLUTTER_EXPORT
-void clutter_color_subtract (const ClutterColor *a,
- const ClutterColor *b,
- ClutterColor *result);
-CLUTTER_EXPORT
-void clutter_color_lighten (const ClutterColor *color,
- ClutterColor *result);
-CLUTTER_EXPORT
-void clutter_color_darken (const ClutterColor *color,
- ClutterColor *result);
-CLUTTER_EXPORT
-void clutter_color_shade (const ClutterColor *color,
- gdouble factor,
- ClutterColor *result);
-
-CLUTTER_EXPORT
-gchar * clutter_color_to_string (const ClutterColor *color);
-CLUTTER_EXPORT
-gboolean clutter_color_from_string (ClutterColor *color,
- const gchar *str);
-
-CLUTTER_EXPORT
-void clutter_color_to_hls (const ClutterColor *color,
- gfloat *hue,
- gfloat *luminance,
- gfloat *saturation);
-CLUTTER_EXPORT
-void clutter_color_from_hls (ClutterColor *color,
- gfloat hue,
- gfloat luminance,
- gfloat saturation);
-
-CLUTTER_EXPORT
-guint32 clutter_color_to_pixel (const ClutterColor *color);
-CLUTTER_EXPORT
-void clutter_color_from_pixel (ClutterColor *color,
- guint32 pixel);
-
-CLUTTER_EXPORT
-guint clutter_color_hash (gconstpointer v);
-CLUTTER_EXPORT
-gboolean clutter_color_equal (gconstpointer v1,
- gconstpointer v2);
-
-CLUTTER_EXPORT
-void clutter_color_interpolate (const ClutterColor *initial,
- const ClutterColor *final,
- gdouble progress,
- ClutterColor *result);
-
-#define CLUTTER_TYPE_PARAM_COLOR (clutter_param_color_get_type ())
-#define CLUTTER_PARAM_SPEC_COLOR(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), CLUTTER_TYPE_PARAM_COLOR, ClutterParamSpecColor))
-#define CLUTTER_IS_PARAM_SPEC_COLOR(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), CLUTTER_TYPE_PARAM_COLOR))
-
-/**
- * CLUTTER_VALUE_HOLDS_COLOR:
- * @x: a #GValue
- *
- * Evaluates to %TRUE if @x holds a #ClutterColor<!-- -->.
- *
- * Since: 1.0
- */
-#define CLUTTER_VALUE_HOLDS_COLOR(x) (G_VALUE_HOLDS ((x), CLUTTER_TYPE_COLOR))
-
-typedef struct _ClutterParamSpecColor ClutterParamSpecColor;
-
-/**
- * ClutterParamSpecColor: (skip)
- * @default_value: default color value
- *
- * A #GParamSpec subclass for defining properties holding
- * a #ClutterColor.
- *
- * Since: 1.0
- */
-struct _ClutterParamSpecColor
-{
- /*< private >*/
- GParamSpec parent_instance;
-
- /*< public >*/
- ClutterColor *default_value;
-};
-
-CLUTTER_EXPORT
-void clutter_value_set_color (GValue *value,
- const ClutterColor *color);
-CLUTTER_EXPORT
-const ClutterColor * clutter_value_get_color (const GValue *value);
-
-CLUTTER_EXPORT
-GType clutter_param_color_get_type (void) G_GNUC_CONST;
-CLUTTER_EXPORT
-GParamSpec * clutter_param_spec_color (const gchar *name,
- const gchar *nick,
- const gchar *blurb,
- const ClutterColor *default_value,
- GParamFlags flags);
-
-CLUTTER_EXPORT
-const ClutterColor *clutter_color_get_static (ClutterStaticColor color);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_COLOR_H__ */
diff --git a/clutter/clutter/clutter-colorize-effect.c b/clutter/clutter/clutter-colorize-effect.c
deleted file mode 100644
index 6f7de95bd..000000000
--- a/clutter/clutter/clutter-colorize-effect.c
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-colorize-effect
- * @short_description: A colorization effect
- * @see_also: #ClutterEffect, #ClutterOffscreenEffect
- *
- * #ClutterColorizeEffect is a sub-class of #ClutterEffect that
- * colorizes an actor with the given tint.
- *
- * #ClutterColorizeEffect is available since Clutter 1.4
- */
-
-#define CLUTTER_COLORIZE_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_COLORIZE_EFFECT, ClutterColorizeEffectClass))
-#define CLUTTER_IS_COLORIZE_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_COLORIZE_EFFECT))
-#define CLUTTER_COLORIZE_EFFECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_COLORIZE_EFFECT, ClutterColorizeEffectClass))
-
-#include "clutter-build-config.h"
-
-#include "clutter-colorize-effect.h"
-
-#include "cogl/cogl.h"
-
-#include "clutter-debug.h"
-#include "clutter-enum-types.h"
-#include "clutter-offscreen-effect.h"
-#include "clutter-private.h"
-
-struct _ClutterColorizeEffect
-{
- ClutterOffscreenEffect parent_instance;
-
- /* the tint of the colorization */
- ClutterColor tint;
-
- gint tint_uniform;
-
- CoglPipeline *pipeline;
-};
-
-struct _ClutterColorizeEffectClass
-{
- ClutterOffscreenEffectClass parent_class;
-
- CoglPipeline *base_pipeline;
-};
-
-/* the magic gray vec3 has been taken from the NTSC conversion weights
- * as defined by:
- *
- * "OpenGL Superbible, 4th Edition"
- * -- Richard S. Wright Jr, Benjamin Lipchak, Nicholas Haemel
- * Addison-Wesley
- */
-static const gchar *colorize_glsl_declarations =
-"uniform vec3 tint;\n";
-
-static const gchar *colorize_glsl_source =
-"float gray = dot (cogl_color_out.rgb, vec3 (0.299, 0.587, 0.114));\n"
-"cogl_color_out.rgb = gray * tint;\n";
-
-/* a lame sepia */
-static const ClutterColor default_tint = { 255, 204, 153, 255 };
-
-enum
-{
- PROP_0,
-
- PROP_TINT,
-
- PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST];
-
-G_DEFINE_TYPE (ClutterColorizeEffect,
- clutter_colorize_effect,
- CLUTTER_TYPE_OFFSCREEN_EFFECT);
-
-static CoglPipeline *
-clutter_colorize_effect_create_pipeline (ClutterOffscreenEffect *effect,
- CoglTexture *texture)
-{
- ClutterColorizeEffect *colorize_effect = CLUTTER_COLORIZE_EFFECT (effect);
-
- cogl_pipeline_set_layer_texture (colorize_effect->pipeline, 0, texture);
-
- return cogl_object_ref (colorize_effect->pipeline);
-}
-
-static gboolean
-clutter_colorize_effect_pre_paint (ClutterEffect *effect,
- ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- ClutterEffectClass *parent_class;
-
- if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
- {
- /* if we don't have support for GLSL shaders then we
- * forcibly disable the ActorMeta
- */
- g_warning ("Unable to use the ShaderEffect: the graphics hardware "
- "or the current GL driver does not implement support "
- "for the GLSL shading language.");
- clutter_actor_meta_set_enabled (CLUTTER_ACTOR_META (effect), FALSE);
- return FALSE;
- }
-
- parent_class = CLUTTER_EFFECT_CLASS (clutter_colorize_effect_parent_class);
- return parent_class->pre_paint (effect, node, paint_context);
-}
-
-static void
-clutter_colorize_effect_dispose (GObject *gobject)
-{
- ClutterColorizeEffect *self = CLUTTER_COLORIZE_EFFECT (gobject);
-
- if (self->pipeline != NULL)
- {
- cogl_object_unref (self->pipeline);
- self->pipeline = NULL;
- }
-
- G_OBJECT_CLASS (clutter_colorize_effect_parent_class)->dispose (gobject);
-}
-
-static void
-clutter_colorize_effect_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterColorizeEffect *effect = CLUTTER_COLORIZE_EFFECT (gobject);
-
- switch (prop_id)
- {
- case PROP_TINT:
- clutter_colorize_effect_set_tint (effect,
- clutter_value_get_color (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_colorize_effect_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterColorizeEffect *effect = CLUTTER_COLORIZE_EFFECT (gobject);
-
- switch (prop_id)
- {
- case PROP_TINT:
- clutter_value_set_color (value, &effect->tint);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_colorize_effect_class_init (ClutterColorizeEffectClass *klass)
-{
- ClutterEffectClass *effect_class = CLUTTER_EFFECT_CLASS (klass);
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- ClutterOffscreenEffectClass *offscreen_class;
-
- offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass);
- offscreen_class->create_pipeline = clutter_colorize_effect_create_pipeline;
-
- effect_class->pre_paint = clutter_colorize_effect_pre_paint;
-
- gobject_class->set_property = clutter_colorize_effect_set_property;
- gobject_class->get_property = clutter_colorize_effect_get_property;
- gobject_class->dispose = clutter_colorize_effect_dispose;
-
- /**
- * ClutterColorizeEffect:tint:
- *
- * The tint to apply to the actor
- *
- * Since: 1.4
- */
- obj_props[PROP_TINT] =
- clutter_param_spec_color ("tint",
- P_("Tint"),
- P_("The tint to apply"),
- &default_tint,
- CLUTTER_PARAM_READWRITE);
-
- g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
-}
-
-static void
-update_tint_uniform (ClutterColorizeEffect *self)
-{
- if (self->tint_uniform > -1)
- {
- float tint[3] = {
- self->tint.red / 255.0,
- self->tint.green / 255.0,
- self->tint.blue / 255.0
- };
-
- cogl_pipeline_set_uniform_float (self->pipeline,
- self->tint_uniform,
- 3, /* n_components */
- 1, /* count */
- tint);
- }
-}
-
-static void
-clutter_colorize_effect_init (ClutterColorizeEffect *self)
-{
- ClutterColorizeEffectClass *klass = CLUTTER_COLORIZE_EFFECT_GET_CLASS (self);
-
- if (G_UNLIKELY (klass->base_pipeline == NULL))
- {
- CoglSnippet *snippet;
- CoglContext *ctx =
- clutter_backend_get_cogl_context (clutter_get_default_backend ());
-
- klass->base_pipeline = cogl_pipeline_new (ctx);
-
- snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT,
- colorize_glsl_declarations,
- colorize_glsl_source);
- cogl_pipeline_add_snippet (klass->base_pipeline, snippet);
- cogl_object_unref (snippet);
-
- cogl_pipeline_set_layer_null_texture (klass->base_pipeline, 0);
- }
-
- self->pipeline = cogl_pipeline_copy (klass->base_pipeline);
-
- self->tint_uniform =
- cogl_pipeline_get_uniform_location (self->pipeline, "tint");
-
- self->tint = default_tint;
-
- update_tint_uniform (self);
-}
-
-/**
- * clutter_colorize_effect_new:
- * @tint: the color to be used
- *
- * Creates a new #ClutterColorizeEffect to be used with
- * clutter_actor_add_effect()
- *
- * Return value: the newly created #ClutterColorizeEffect or %NULL
- *
- * Since: 1.4
- */
-ClutterEffect *
-clutter_colorize_effect_new (const ClutterColor *tint)
-{
- return g_object_new (CLUTTER_TYPE_COLORIZE_EFFECT,
- "tint", tint,
- NULL);
-}
-
-/**
- * clutter_colorize_effect_set_tint:
- * @effect: a #ClutterColorizeEffect
- * @tint: the color to be used
- *
- * Sets the tint to be used when colorizing
- *
- * Since: 1.4
- */
-void
-clutter_colorize_effect_set_tint (ClutterColorizeEffect *effect,
- const ClutterColor *tint)
-{
- g_return_if_fail (CLUTTER_IS_COLORIZE_EFFECT (effect));
-
- effect->tint = *tint;
-
- update_tint_uniform (effect);
-
- clutter_effect_queue_repaint (CLUTTER_EFFECT (effect));
-
- g_object_notify_by_pspec (G_OBJECT (effect), obj_props[PROP_TINT]);
-}
-
-/**
- * clutter_colorize_effect_get_tint:
- * @effect: a #ClutterColorizeEffect
- * @tint: (out caller-allocates): return location for the color used
- *
- * Retrieves the tint used by @effect
- *
- * Since: 1.4
- */
-void
-clutter_colorize_effect_get_tint (ClutterColorizeEffect *effect,
- ClutterColor *tint)
-{
- g_return_if_fail (CLUTTER_IS_COLORIZE_EFFECT (effect));
- g_return_if_fail (tint != NULL);
-
- *tint = effect->tint;
-}
diff --git a/clutter/clutter/clutter-colorize-effect.h b/clutter/clutter/clutter-colorize-effect.h
deleted file mode 100644
index 92e878735..000000000
--- a/clutter/clutter/clutter-colorize-effect.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_COLORIZE_EFFECT_H__
-#define __CLUTTER_COLORIZE_EFFECT_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-color.h>
-#include <clutter/clutter-effect.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_COLORIZE_EFFECT (clutter_colorize_effect_get_type ())
-#define CLUTTER_COLORIZE_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_COLORIZE_EFFECT, ClutterColorizeEffect))
-#define CLUTTER_IS_COLORIZE_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_COLORIZE_EFFECT))
-
-/**
- * ClutterColorizeEffect:
- *
- * #ClutterColorizeEffect is an opaque structure
- * whose members cannot be directly accessed
- *
- * Since: 1.4
- */
-typedef struct _ClutterColorizeEffect ClutterColorizeEffect;
-typedef struct _ClutterColorizeEffectClass ClutterColorizeEffectClass;
-
-CLUTTER_EXPORT
-GType clutter_colorize_effect_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterEffect *clutter_colorize_effect_new (const ClutterColor *tint);
-
-CLUTTER_EXPORT
-void clutter_colorize_effect_set_tint (ClutterColorizeEffect *effect,
- const ClutterColor *tint);
-CLUTTER_EXPORT
-void clutter_colorize_effect_get_tint (ClutterColorizeEffect *effect,
- ClutterColor *tint);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_COLORIZE_EFFECT_H__ */
diff --git a/clutter/clutter/clutter-constraint-private.h b/clutter/clutter/clutter-constraint-private.h
deleted file mode 100644
index 5fbddef00..000000000
--- a/clutter/clutter/clutter-constraint-private.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __CLUTTER_CONSTRAINT_PRIVATE_H__
-#define __CLUTTER_CONSTRAINT_PRIVATE_H__
-
-#include "clutter-constraint.h"
-
-G_BEGIN_DECLS
-
-gboolean clutter_constraint_update_allocation (ClutterConstraint *constraint,
- ClutterActor *actor,
- ClutterActorBox *allocation);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_CONSTRAINT_PRIVATE_H__ */
diff --git a/clutter/clutter/clutter-constraint.c b/clutter/clutter/clutter-constraint.c
deleted file mode 100644
index fc0590744..000000000
--- a/clutter/clutter/clutter-constraint.c
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-constraint
- * @Title: ClutterConstraint
- * @Short_Description: Abstract class for constraints on position or size
- * @See_Also: #ClutterAction
- *
- * #ClutterConstraint is a base abstract class for modifiers of a #ClutterActor
- * position or size.
- *
- * A #ClutterConstraint sub-class should contain the logic for modifying
- * the position or size of the #ClutterActor to which it is applied, by
- * updating the actor's allocation. Each #ClutterConstraint can change the
- * allocation of the actor to which they are applied by overriding the
- * #ClutterConstraintClass.update_allocation() virtual function.
- *
- * #ClutterConstraint is available since Clutter 1.4
- *
- * ## Using Constraints
- *
- * Constraints can be used with fixed layout managers, like
- * #ClutterFixedLayout, or with actors implicitly using a fixed layout
- * manager, like #ClutterGroup and #ClutterStage.
- *
- * Constraints provide a way to build user interfaces by using
- * relations between #ClutterActors, without explicit fixed
- * positioning and sizing, similarly to how fluid layout managers like
- * #ClutterBoxLayout lay out their children.
- *
- * Constraints are attached to a #ClutterActor, and are available
- * for inspection using clutter_actor_get_constraints().
- *
- * Clutter provides different implementation of the #ClutterConstraint
- * abstract class, for instance:
- *
- * - #ClutterAlignConstraint, a constraint that can be used to align
- * an actor to another one on either the horizontal or the vertical
- * axis, using a normalized value between 0 and 1.
- * - #ClutterBindConstraint, a constraint binds the X, Y, width or height
- * of an actor to the corresponding position or size of a source actor,
- * with or without an offset.
- * - #ClutterSnapConstraint, a constraint that "snaps" together the edges
- * of two #ClutterActors; if an actor uses two constraints on both its
- * horizontal or vertical edges then it can also expand to fit the empty
- * space.
- *
- * The [constraints example](https://git.gnome.org/browse/clutter/tree/examples/constraints.c?h=clutter-1.18)
- * uses various types of #ClutterConstraints to lay out three actors on a
- * resizable stage. Only the central actor has an explicit size, and no
- * actor has an explicit position.
- *
- * - The #ClutterActor with #ClutterActor:name `layerA` is explicitly
- * sized to 100 pixels by 25 pixels, and it's added to the #ClutterStage
- * - two #ClutterAlignConstraints are used to anchor `layerA` to the
- * center of the stage, by using 0.5 as the alignment #ClutterAlignConstraint:factor on
- * both the X and Y axis
- * - the #ClutterActor with #ClutterActor:name `layerB` is added to the
- * #ClutterStage with no explicit size
- * - the #ClutterActor:x and #ClutterActor:width of `layerB` are bound
- * to the same properties of `layerA` using two #ClutterBindConstraint
- * objects, thus keeping `layerB` aligned to `layerA`
- * - the top edge of `layerB` is snapped together with the bottom edge
- * of `layerA`; the bottom edge of `layerB` is also snapped together with
- * the bottom edge of the #ClutterStage; an offset is given to the two
- * #ClutterSnapConstraintss to allow for some padding; since `layerB` is
- * snapped between two different #ClutterActors, its height is stretched
- * to match the gap
- * - the #ClutterActor with #ClutterActor:name `layerC` mirrors `layerB`,
- * snapping the top edge of the #ClutterStage to the top edge of `layerC`
- * and the top edge of `layerA` to the bottom edge of `layerC`
- *
- * You can try resizing interactively the #ClutterStage and verify
- * that the three #ClutterActors maintain the same position and
- * size relative to each other, and to the #ClutterStage.
- *
- * It is important to note that Clutter does not avoid loops or
- * competing constraints; if two or more #ClutterConstraints
- * are operating on the same positional or dimensional attributes of an
- * actor, or if the constraints on two different actors depend on each
- * other, then the behavior is undefined.
- *
- * ## Implementing a ClutterConstraint
- *
- * Creating a sub-class of #ClutterConstraint requires the
- * implementation of the #ClutterConstraintClass.update_allocation()
- * virtual function.
- *
- * The `update_allocation()` virtual function is called during the
- * allocation sequence of a #ClutterActor, and allows any #ClutterConstraint
- * attached to that actor to modify the allocation before it is passed to
- * the actor's #ClutterActorClass.allocate() implementation.
- *
- * The #ClutterActorBox passed to the `update_allocation()` implementation
- * contains the original allocation of the #ClutterActor, plus the eventual
- * modifications applied by the other #ClutterConstraints, in the same order
- * the constraints have been applied to the actor.
- *
- * It is not necessary for a #ClutterConstraint sub-class to chain
- * up to the parent's implementation.
- *
- * If a #ClutterConstraint is parametrized - i.e. if it contains
- * properties that affect the way the constraint is implemented - it should
- * call clutter_actor_queue_relayout() on the actor to which it is attached
- * to whenever any parameter is changed. The actor to which it is attached
- * can be recovered at any point using clutter_actor_meta_get_actor().
- */
-
-#include "clutter-build-config.h"
-
-#include <string.h>
-
-#include "clutter-constraint-private.h"
-
-#include "clutter-actor.h"
-#include "clutter-actor-meta-private.h"
-#include "clutter-private.h"
-
-G_DEFINE_ABSTRACT_TYPE (ClutterConstraint,
- clutter_constraint,
- CLUTTER_TYPE_ACTOR_META);
-
-static void
-constraint_update_allocation (ClutterConstraint *constraint,
- ClutterActor *actor,
- ClutterActorBox *allocation)
-{
-}
-
-static void
-constraint_update_preferred_size (ClutterConstraint *constraint,
- ClutterActor *actor,
- ClutterOrientation direction,
- float for_size,
- float *minimum_size,
- float *natural_size)
-{
-}
-
-static void
-clutter_constraint_set_enabled (ClutterActorMeta *meta,
- gboolean is_enabled)
-{
- ClutterActorMetaClass *parent_class =
- CLUTTER_ACTOR_META_CLASS (clutter_constraint_parent_class);
- ClutterActor *actor;
-
- actor = clutter_actor_meta_get_actor (meta);
- if (actor)
- clutter_actor_queue_relayout (actor);
-
- parent_class->set_enabled (meta, is_enabled);
-}
-
-static void
-clutter_constraint_class_init (ClutterConstraintClass *klass)
-{
- ClutterActorMetaClass *actor_meta_class = CLUTTER_ACTOR_META_CLASS (klass);
-
- actor_meta_class->set_enabled = clutter_constraint_set_enabled;
-
- klass->update_allocation = constraint_update_allocation;
- klass->update_preferred_size = constraint_update_preferred_size;
-}
-
-static void
-clutter_constraint_init (ClutterConstraint *self)
-{
-}
-
-/*< private >
- * clutter_constraint_update_allocation:
- * @constraint: a #ClutterConstraint
- * @actor: a #ClutterActor
- * @allocation: (inout): the allocation to modify
- *
- * Asks the @constraint to update the @allocation of a #ClutterActor.
- *
- * Returns: %TRUE if the allocation was updated
- */
-gboolean
-clutter_constraint_update_allocation (ClutterConstraint *constraint,
- ClutterActor *actor,
- ClutterActorBox *allocation)
-{
- ClutterActorBox old_alloc;
-
- g_return_val_if_fail (CLUTTER_IS_CONSTRAINT (constraint), FALSE);
- g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), FALSE);
- g_return_val_if_fail (allocation != NULL, FALSE);
-
- old_alloc = *allocation;
-
- CLUTTER_CONSTRAINT_GET_CLASS (constraint)->update_allocation (constraint,
- actor,
- allocation);
-
- return !clutter_actor_box_equal (allocation, &old_alloc);
-}
-
-/**
- * clutter_constraint_update_preferred_size:
- * @constraint: a #ClutterConstraint
- * @actor: a #ClutterActor
- * @direction: a #ClutterOrientation
- * @for_size: the size in the opposite direction
- * @minimum_size: (inout): the minimum size to modify
- * @natural_size: (inout): the natural size to modify
- *
- * Asks the @constraint to update the size request of a #ClutterActor.
- */
-void
-clutter_constraint_update_preferred_size (ClutterConstraint *constraint,
- ClutterActor *actor,
- ClutterOrientation direction,
- float for_size,
- float *minimum_size,
- float *natural_size)
-{
- g_return_if_fail (CLUTTER_IS_CONSTRAINT (constraint));
- g_return_if_fail (CLUTTER_IS_ACTOR (actor));
-
- CLUTTER_CONSTRAINT_GET_CLASS (constraint)->update_preferred_size (constraint, actor,
- direction,
- for_size,
- minimum_size,
- natural_size);
-}
diff --git a/clutter/clutter/clutter-constraint.h b/clutter/clutter/clutter-constraint.h
deleted file mode 100644
index 420e7de75..000000000
--- a/clutter/clutter/clutter-constraint.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_CONSTRAINT_H__
-#define __CLUTTER_CONSTRAINT_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-actor-meta.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_CONSTRAINT (clutter_constraint_get_type ())
-#define CLUTTER_CONSTRAINT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_CONSTRAINT, ClutterConstraint))
-#define CLUTTER_IS_CONSTRAINT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_CONSTRAINT))
-#define CLUTTER_CONSTRAINT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_CONSTRAINT, ClutterConstraintClass))
-#define CLUTTER_IS_CONSTRAINT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_CONSTRAINT))
-#define CLUTTER_CONSTRAINT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_CONSTRAINT, ClutterConstraintClass))
-
-typedef struct _ClutterConstraintClass ClutterConstraintClass;
-
-/**
- * ClutterConstraint:
- *
- * The #ClutterConstraint structure contains only
- * private data and should be accessed using the provided API
- *
- * Since: 1.4
- */
-struct _ClutterConstraint
-{
- /*< private >*/
- ClutterActorMeta parent_instance;
-};
-
-/**
- * ClutterConstraintClass:
- * @update_allocation: virtual function used to update the allocation
- * of the #ClutterActor using the #ClutterConstraint
- * @update_preferred_size: virtual function used to update the preferred
- * size of the #ClutterActor using the #ClutterConstraint; optional,
- * since 1.22
- *
- * The #ClutterConstraintClass structure contains
- * only private data
- *
- * Since: 1.4
- */
-struct _ClutterConstraintClass
-{
- /*< private >*/
- ClutterActorMetaClass parent_class;
-
- /*< public >*/
- void (* update_allocation) (ClutterConstraint *constraint,
- ClutterActor *actor,
- ClutterActorBox *allocation);
-
- void (* update_preferred_size) (ClutterConstraint *constraint,
- ClutterActor *actor,
- ClutterOrientation direction,
- float for_size,
- float *minimum_size,
- float *natural_size);
-
- /*< private >*/
- void (* _clutter_constraint1) (void);
- void (* _clutter_constraint2) (void);
- void (* _clutter_constraint3) (void);
- void (* _clutter_constraint4) (void);
- void (* _clutter_constraint5) (void);
- void (* _clutter_constraint6) (void);
- void (* _clutter_constraint7) (void);
-};
-
-CLUTTER_EXPORT
-GType clutter_constraint_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-void clutter_constraint_update_preferred_size (ClutterConstraint *constraint,
- ClutterActor *actor,
- ClutterOrientation direction,
- float for_size,
- float *minimum_size,
- float *natural_size);
-
-/* ClutterActor API */
-CLUTTER_EXPORT
-void clutter_actor_add_constraint (ClutterActor *self,
- ClutterConstraint *constraint);
-CLUTTER_EXPORT
-void clutter_actor_add_constraint_with_name (ClutterActor *self,
- const gchar *name,
- ClutterConstraint *constraint);
-CLUTTER_EXPORT
-void clutter_actor_remove_constraint (ClutterActor *self,
- ClutterConstraint *constraint);
-CLUTTER_EXPORT
-void clutter_actor_remove_constraint_by_name (ClutterActor *self,
- const gchar *name);
-CLUTTER_EXPORT
-GList * clutter_actor_get_constraints (ClutterActor *self);
-CLUTTER_EXPORT
-ClutterConstraint *clutter_actor_get_constraint (ClutterActor *self,
- const gchar *name);
-CLUTTER_EXPORT
-void clutter_actor_clear_constraints (ClutterActor *self);
-
-CLUTTER_EXPORT
-gboolean clutter_actor_has_constraints (ClutterActor *self);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_CONSTRAINT_H__ */
diff --git a/clutter/clutter/clutter-container-private.h b/clutter/clutter/clutter-container-private.h
deleted file mode 100644
index d619a6531..000000000
--- a/clutter/clutter/clutter-container-private.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright 2020 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __CLUTTER_CONTAINER_PRIVATE_H__
-#define __CLUTTER_CONTAINER_PRIVATE_H__
-
-#include <clutter/clutter-container.h>
-
-G_BEGIN_DECLS
-
-void _clutter_container_emit_actor_added (ClutterContainer *container,
- ClutterActor *actor);
-void _clutter_container_emit_actor_removed (ClutterContainer *container,
- ClutterActor *actor);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_CONTAINER_PRIVATE_H__ */
diff --git a/clutter/clutter/clutter-container.c b/clutter/clutter/clutter-container.c
deleted file mode 100644
index 23169332f..000000000
--- a/clutter/clutter/clutter-container.c
+++ /dev/null
@@ -1,1273 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- *
- * Copyright (C) 2006 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 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/>.
- *
- *
- *
- * ClutterContainer: Generic actor container interface.
- * Author: Emmanuele Bassi <ebassi@openedhand.com>
- */
-
-#include "clutter-build-config.h"
-
-#include <stdarg.h>
-#include <glib-object.h>
-#include <gobject/gvaluecollector.h>
-
-#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
-#include "deprecated/clutter-container.h"
-
-#include "clutter-actor-private.h"
-#include "clutter-child-meta.h"
-#include "clutter-container-private.h"
-#include "clutter-debug.h"
-#include "clutter-main.h"
-#include "clutter-marshal.h"
-#include "clutter-private.h"
-#include "clutter-enum-types.h"
-
-#define CLUTTER_CONTAINER_WARN_NOT_IMPLEMENTED(container,vfunc) \
- G_STMT_START { \
- g_warning ("Container of type '%s' does not implement " \
- "the required ClutterContainer::%s virtual " \
- "function.", \
- G_OBJECT_TYPE_NAME ((container)), \
- (vfunc)); \
- } G_STMT_END
-
-#define CLUTTER_CONTAINER_NOTE_NOT_IMPLEMENTED(container,vfunc) \
- G_STMT_START { \
- CLUTTER_NOTE (ACTOR, "Container of type '%s' does not " \
- "implement the ClutterContainer::%s " \
- "virtual function.", \
- G_OBJECT_TYPE_NAME ((container)), \
- (vfunc)); \
- } G_STMT_END
-
-/**
- * SECTION:clutter-container
- * @short_description: An interface for container actors
- *
- * #ClutterContainer is an interface implemented by #ClutterActor, and
- * it provides some common API for notifying when a child actor is added
- * or removed, as well as the infrastructure for accessing child properties
- * through #ClutterChildMeta.
- *
- * Until Clutter 1.10, the #ClutterContainer interface was also the public
- * API for implementing container actors; this part of the interface has
- * been deprecated: #ClutterContainer has a default implementation which
- * defers to #ClutterActor the child addition and removal, as well as the
- * iteration. See the documentation of #ClutterContainerIface for the list
- * of virtual functions that should be overridden.
- */
-
-enum
-{
- ACTOR_ADDED,
- ACTOR_REMOVED,
- CHILD_NOTIFY,
-
- LAST_SIGNAL
-};
-
-static guint container_signals[LAST_SIGNAL] = { 0, };
-static GQuark quark_child_meta = 0;
-
-static ClutterChildMeta *get_child_meta (ClutterContainer *container,
- ClutterActor *actor);
-static void create_child_meta (ClutterContainer *container,
- ClutterActor *actor);
-static void destroy_child_meta (ClutterContainer *container,
- ClutterActor *actor);
-static void child_notify (ClutterContainer *container,
- ClutterActor *child,
- GParamSpec *pspec);
-
-typedef ClutterContainerIface ClutterContainerInterface;
-
-G_DEFINE_INTERFACE (ClutterContainer, clutter_container, G_TYPE_OBJECT);
-
-static void
-container_real_add (ClutterContainer *container,
- ClutterActor *actor)
-{
- clutter_actor_add_child (CLUTTER_ACTOR (container), actor);
-}
-
-static void
-container_real_remove (ClutterContainer *container,
- ClutterActor *actor)
-{
- clutter_actor_remove_child (CLUTTER_ACTOR (container), actor);
-}
-
-static void
-container_real_raise (ClutterContainer *container,
- ClutterActor *child,
- ClutterActor *sibling)
-{
- ClutterActor *self = CLUTTER_ACTOR (container);
-
- clutter_actor_set_child_above_sibling (self, child, sibling);
-}
-
-static void
-container_real_lower (ClutterContainer *container,
- ClutterActor *child,
- ClutterActor *sibling)
-{
- ClutterActor *self = CLUTTER_ACTOR (container);
-
- clutter_actor_set_child_below_sibling (self, child, sibling);
-}
-
-static void
-container_real_sort_depth_order (ClutterContainer *container)
-{
-}
-
-static void
-clutter_container_default_init (ClutterContainerInterface *iface)
-{
- GType iface_type = G_TYPE_FROM_INTERFACE (iface);
-
- quark_child_meta =
- g_quark_from_static_string ("clutter-container-child-data");
-
- /**
- * ClutterContainer::actor-added:
- * @container: the actor which received the signal
- * @actor: the new child that has been added to @container
- *
- * The ::actor-added signal is emitted each time an actor
- * has been added to @container.
- *
- * Since: 0.4
- */
- container_signals[ACTOR_ADDED] =
- g_signal_new (I_("actor-added"),
- iface_type,
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (ClutterContainerIface, actor_added),
- NULL, NULL, NULL,
- G_TYPE_NONE, 1,
- CLUTTER_TYPE_ACTOR);
- /**
- * ClutterContainer::actor-removed:
- * @container: the actor which received the signal
- * @actor: the child that has been removed from @container
- *
- * The ::actor-removed signal is emitted each time an actor
- * is removed from @container.
- *
- * Since: 0.4
- */
- container_signals[ACTOR_REMOVED] =
- g_signal_new (I_("actor-removed"),
- iface_type,
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (ClutterContainerIface, actor_removed),
- NULL, NULL, NULL,
- G_TYPE_NONE, 1,
- CLUTTER_TYPE_ACTOR);
-
- /**
- * ClutterContainer::child-notify:
- * @container: the container which received the signal
- * @actor: the child that has had a property set
- * @pspec: (type GParamSpec): the #GParamSpec of the property set
- *
- * The ::child-notify signal is emitted each time a property is
- * being set through the clutter_container_child_set() and
- * clutter_container_child_set_property() calls.
- *
- * Since: 0.8
- */
- container_signals[CHILD_NOTIFY] =
- g_signal_new (I_("child-notify"),
- iface_type,
- G_SIGNAL_RUN_FIRST | G_SIGNAL_DETAILED,
- G_STRUCT_OFFSET (ClutterContainerIface, child_notify),
- NULL, NULL,
- _clutter_marshal_VOID__OBJECT_PARAM,
- G_TYPE_NONE, 2,
- CLUTTER_TYPE_ACTOR, G_TYPE_PARAM);
-
- iface->add = container_real_add;
- iface->remove = container_real_remove;
- iface->raise = container_real_raise;
- iface->lower = container_real_lower;
- iface->sort_depth_order = container_real_sort_depth_order;
-
- iface->child_meta_type = G_TYPE_INVALID;
- iface->create_child_meta = create_child_meta;
- iface->destroy_child_meta = destroy_child_meta;
- iface->get_child_meta = get_child_meta;
- iface->child_notify = child_notify;
-}
-
-static inline void
-container_add_actor (ClutterContainer *container,
- ClutterActor *actor)
-{
- ClutterActor *parent;
-
- parent = clutter_actor_get_parent (actor);
- if (G_UNLIKELY (parent != NULL))
- {
- g_warning ("Attempting to add actor of type '%s' to a "
- "container of type '%s', but the actor has "
- "already a parent of type '%s'.",
- g_type_name (G_OBJECT_TYPE (actor)),
- g_type_name (G_OBJECT_TYPE (container)),
- g_type_name (G_OBJECT_TYPE (parent)));
- return;
- }
-
- clutter_container_create_child_meta (container, actor);
-
-#ifdef CLUTTER_ENABLE_DEBUG
- if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
- {
- ClutterContainerIface *iface = CLUTTER_CONTAINER_GET_IFACE (container);
-
- if (iface->add != container_real_add)
- _clutter_diagnostic_message ("The ClutterContainer::add() virtual "
- "function has been deprecated and it "
- "should not be overridden by newly "
- "written code");
- }
-#endif /* CLUTTER_ENABLE_DEBUG */
-
- CLUTTER_CONTAINER_GET_IFACE (container)->add (container, actor);
-}
-
-static inline void
-container_remove_actor (ClutterContainer *container,
- ClutterActor *actor)
-{
- ClutterActor *parent;
-
- parent = clutter_actor_get_parent (actor);
- if (parent != CLUTTER_ACTOR (container))
- {
- g_warning ("Attempting to remove actor of type '%s' from "
- "group of class '%s', but the container is not "
- "the actor's parent.",
- g_type_name (G_OBJECT_TYPE (actor)),
- g_type_name (G_OBJECT_TYPE (container)));
- return;
- }
-
- clutter_container_destroy_child_meta (container, actor);
-
-#ifdef CLUTTER_ENABLE_DEBUG
- if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
- {
- ClutterContainerIface *iface = CLUTTER_CONTAINER_GET_IFACE (container);
-
- if (iface->remove != container_real_remove)
- _clutter_diagnostic_message ("The ClutterContainer::remove() virtual "
- "function has been deprecated and it "
- "should not be overridden by newly "
- "written code");
- }
-#endif /* CLUTTER_ENABLE_DEBUG */
-
- CLUTTER_CONTAINER_GET_IFACE (container)->remove (container, actor);
-}
-
-static inline void
-container_add_valist (ClutterContainer *container,
- ClutterActor *first_actor,
- va_list args)
-{
- ClutterActor *actor = first_actor;
-
- while (actor != NULL)
- {
- container_add_actor (container, actor);
- actor = va_arg (args, ClutterActor *);
- }
-}
-
-static inline void
-container_remove_valist (ClutterContainer *container,
- ClutterActor *first_actor,
- va_list args)
-{
- ClutterActor *actor = first_actor;
-
- while (actor != NULL)
- {
- container_remove_actor (container, actor);
- actor = va_arg (args, ClutterActor *);
- }
-}
-
-/**
- * clutter_container_add: (skip)
- * @container: a #ClutterContainer
- * @first_actor: the first #ClutterActor to add
- * @...: %NULL terminated list of actors to add
- *
- * Adds a list of #ClutterActor<!-- -->s to @container. Each time and
- * actor is added, the "actor-added" signal is emitted. Each actor should
- * be parented to @container, which takes a reference on the actor. You
- * cannot add a #ClutterActor to more than one #ClutterContainer.
- *
- * This function will call #ClutterContainerIface.add(), which is a
- * deprecated virtual function. The default implementation will
- * call clutter_actor_add_child().
- *
- * Since: 0.4
- *
- * Deprecated: 1.10: Use clutter_actor_add_child() instead.
- */
-void
-clutter_container_add (ClutterContainer *container,
- ClutterActor *first_actor,
- ...)
-{
- va_list args;
-
- g_return_if_fail (CLUTTER_IS_CONTAINER (container));
- g_return_if_fail (CLUTTER_IS_ACTOR (first_actor));
-
- va_start (args, first_actor);
- container_add_valist (container, first_actor, args);
- va_end (args);
-}
-
-/**
- * clutter_container_add_actor: (virtual add)
- * @container: a #ClutterContainer
- * @actor: the first #ClutterActor to add
- *
- * Adds a #ClutterActor to @container. This function will emit the
- * "actor-added" signal. The actor should be parented to
- * @container. You cannot add a #ClutterActor to more than one
- * #ClutterContainer.
- *
- * This function will call #ClutterContainerIface.add(), which is a
- * deprecated virtual function. The default implementation will
- * call clutter_actor_add_child().
- *
- * Since: 0.4
- *
- * Deprecated: 1.10: Use clutter_actor_add_child() instead.
- */
-void
-clutter_container_add_actor (ClutterContainer *container,
- ClutterActor *actor)
-{
- g_return_if_fail (CLUTTER_IS_CONTAINER (container));
- g_return_if_fail (CLUTTER_IS_ACTOR (actor));
-
- container_add_actor (container, actor);
-}
-
-/**
- * clutter_container_remove: (skip)
- * @container: a #ClutterContainer
- * @first_actor: first #ClutterActor to remove
- * @...: a %NULL-terminated list of actors to remove
- *
- * Removes a %NULL terminated list of #ClutterActor<!-- -->s from
- * @container. Each actor should be unparented, so if you want to keep it
- * around you must hold a reference to it yourself, using g_object_ref().
- * Each time an actor is removed, the "actor-removed" signal is
- * emitted by @container.
- *
- * This function will call #ClutterContainerIface.remove(), which is a
- * deprecated virtual function. The default implementation will call
- * clutter_actor_remove_child().
- *
- * Since: 0.4
- *
- * Deprecated: 1.10: Use clutter_actor_remove_child() instead.
- */
-void
-clutter_container_remove (ClutterContainer *container,
- ClutterActor *first_actor,
- ...)
-{
- va_list var_args;
-
- g_return_if_fail (CLUTTER_IS_CONTAINER (container));
- g_return_if_fail (CLUTTER_IS_ACTOR (first_actor));
-
- va_start (var_args, first_actor);
- container_remove_valist (container, first_actor, var_args);
- va_end (var_args);
-}
-
-/**
- * clutter_container_remove_actor: (virtual remove)
- * @container: a #ClutterContainer
- * @actor: a #ClutterActor
- *
- * Removes @actor from @container. The actor should be unparented, so
- * if you want to keep it around you must hold a reference to it
- * yourself, using g_object_ref(). When the actor has been removed,
- * the "actor-removed" signal is emitted by @container.
- *
- * This function will call #ClutterContainerIface.remove(), which is a
- * deprecated virtual function. The default implementation will call
- * clutter_actor_remove_child().
- *
- * Since: 0.4
- *
- * Deprecated: 1.10: Use clutter_actor_remove_child() instead.
- */
-void
-clutter_container_remove_actor (ClutterContainer *container,
- ClutterActor *actor)
-{
- g_return_if_fail (CLUTTER_IS_CONTAINER (container));
- g_return_if_fail (CLUTTER_IS_ACTOR (actor));
-
- container_remove_actor (container, actor);
-}
-
-/**
- * clutter_container_get_children:
- * @container: a #ClutterContainer
- *
- * Retrieves all the children of @container.
- *
- * Return value: (element-type Clutter.Actor) (transfer container): a list
- * of #ClutterActor<!-- -->s. Use g_list_free() on the returned
- * list when done.
- *
- * Since: 0.4
- *
- * Deprecated: 1.10: Use clutter_actor_get_children() instead.
- */
-GList *
-clutter_container_get_children (ClutterContainer *container)
-{
- g_return_val_if_fail (CLUTTER_IS_CONTAINER (container), NULL);
-
- return clutter_actor_get_children (CLUTTER_ACTOR (container));
-}
-
-/**
- * clutter_container_raise_child: (virtual raise)
- * @container: a #ClutterContainer
- * @actor: the actor to raise
- * @sibling: (allow-none): the sibling to raise to, or %NULL to raise
- * to the top
- *
- * Raises @actor to @sibling level, in the depth ordering.
- *
- * This function calls the #ClutterContainerIface.raise() virtual function,
- * which has been deprecated. The default implementation will call
- * clutter_actor_set_child_above_sibling().
- *
- * Since: 0.6
- *
- * Deprecated: 1.10: Use clutter_actor_set_child_above_sibling() instead.
- */
-void
-clutter_container_raise_child (ClutterContainer *container,
- ClutterActor *actor,
- ClutterActor *sibling)
-{
- ClutterContainerIface *iface;
- ClutterActor *self;
-
- g_return_if_fail (CLUTTER_IS_CONTAINER (container));
- g_return_if_fail (CLUTTER_IS_ACTOR (actor));
- g_return_if_fail (sibling == NULL || CLUTTER_IS_ACTOR (sibling));
-
- if (actor == sibling)
- return;
-
- self = CLUTTER_ACTOR (container);
-
- if (clutter_actor_get_parent (actor) != self)
- {
- g_warning ("Actor of type '%s' is not a child of the container "
- "of type '%s'",
- g_type_name (G_OBJECT_TYPE (actor)),
- g_type_name (G_OBJECT_TYPE (container)));
- return;
- }
-
- if (sibling != NULL &&
- clutter_actor_get_parent (sibling) != self)
- {
- g_warning ("Actor of type '%s' is not a child of the container "
- "of type '%s'",
- g_type_name (G_OBJECT_TYPE (sibling)),
- g_type_name (G_OBJECT_TYPE (container)));
- return;
- }
-
- iface = CLUTTER_CONTAINER_GET_IFACE (container);
-
-#ifdef CLUTTER_ENABLE_DEBUG
- if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
- {
- if (iface->raise != container_real_raise)
- _clutter_diagnostic_message ("The ClutterContainer::raise() "
- "virtual function has been deprecated "
- "and it should not be overridden by "
- "newly written code");
- }
-#endif /* CLUTTER_ENABLE_DEBUG */
-
- iface->raise (container, actor, sibling);
-}
-
-/**
- * clutter_container_lower_child: (virtual lower)
- * @container: a #ClutterContainer
- * @actor: the actor to raise
- * @sibling: (allow-none): the sibling to lower to, or %NULL to lower
- * to the bottom
- *
- * Lowers @actor to @sibling level, in the depth ordering.
- *
- * This function calls the #ClutterContainerIface.lower() virtual function,
- * which has been deprecated. The default implementation will call
- * clutter_actor_set_child_below_sibling().
- *
- * Since: 0.6
- *
- * Deprecated: 1.10: Use clutter_actor_set_child_below_sibling() instead.
- */
-void
-clutter_container_lower_child (ClutterContainer *container,
- ClutterActor *actor,
- ClutterActor *sibling)
-{
- ClutterContainerIface *iface;
- ClutterActor *self;
-
- g_return_if_fail (CLUTTER_IS_CONTAINER (container));
- g_return_if_fail (CLUTTER_IS_ACTOR (actor));
- g_return_if_fail (sibling == NULL || CLUTTER_IS_ACTOR (sibling));
-
- if (actor == sibling)
- return;
-
- self = CLUTTER_ACTOR (container);
-
- if (clutter_actor_get_parent (actor) != self)
- {
- g_warning ("Actor of type '%s' is not a child of the container "
- "of type '%s'",
- g_type_name (G_OBJECT_TYPE (actor)),
- g_type_name (G_OBJECT_TYPE (container)));
- return;
- }
-
- if (sibling != NULL&&
- clutter_actor_get_parent (sibling) != self)
- {
- g_warning ("Actor of type '%s' is not a child of the container "
- "of type '%s'",
- g_type_name (G_OBJECT_TYPE (sibling)),
- g_type_name (G_OBJECT_TYPE (container)));
- return;
- }
-
- iface = CLUTTER_CONTAINER_GET_IFACE (container);
-
-#ifdef CLUTTER_ENABLE_DEBUG
- if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
- {
- if (iface->lower != container_real_lower)
- _clutter_diagnostic_message ("The ClutterContainer::lower() "
- "virtual function has been deprecated "
- "and it should not be overridden by "
- "newly written code");
- }
-#endif /* CLUTTER_ENABLE_DEBUG */
-
- iface->lower (container, actor, sibling);
-}
-
-/**
- * clutter_container_sort_depth_order:
- * @container: a #ClutterContainer
- *
- * Sorts a container's children using their depth. This function should not
- * be normally used by applications.
- *
- * Since: 0.6
- *
- * Deprecated: 1.10: The #ClutterContainerIface.sort_depth_order() virtual
- * function should not be used any more; the default implementation in
- * #ClutterContainer does not do anything.
- */
-void
-clutter_container_sort_depth_order (ClutterContainer *container)
-{
- ClutterContainerIface *iface;
-
- g_return_if_fail (CLUTTER_IS_CONTAINER (container));
-
- iface = CLUTTER_CONTAINER_GET_IFACE (container);
-
-#ifdef CLUTTER_ENABLE_DEBUG
- if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
- {
- if (iface->sort_depth_order != container_real_sort_depth_order)
- _clutter_diagnostic_message ("The ClutterContainer::sort_depth_order() "
- "virtual function has been deprecated "
- "and it should not be overridden by "
- "newly written code");
- }
-#endif /* CLUTTER_ENABLE_DEBUG */
-
- iface->sort_depth_order (container);
-}
-
-/**
- * clutter_container_find_child_by_name:
- * @container: a #ClutterContainer
- * @child_name: the name of the requested child.
- *
- * Finds a child actor of a container by its name. Search recurses
- * into any child container.
- *
- * Return value: (transfer none): The child actor with the requested name,
- * or %NULL if no actor with that name was found.
- *
- * Since: 0.6
- */
-ClutterActor *
-clutter_container_find_child_by_name (ClutterContainer *container,
- const gchar *child_name)
-{
- GList *children;
- GList *iter;
- ClutterActor *actor = NULL;
-
- g_return_val_if_fail (CLUTTER_IS_CONTAINER (container), NULL);
- g_return_val_if_fail (child_name != NULL, NULL);
-
- children = clutter_container_get_children (container);
-
- for (iter = children; iter; iter = g_list_next (iter))
- {
- ClutterActor *a;
- const gchar *iter_name;
-
- a = CLUTTER_ACTOR (iter->data);
- iter_name = clutter_actor_get_name (a);
-
- if (iter_name && !strcmp (iter_name, child_name))
- {
- actor = a;
- break;
- }
-
- if (CLUTTER_IS_CONTAINER (a))
- {
- ClutterContainer *c = CLUTTER_CONTAINER (a);
-
- actor = clutter_container_find_child_by_name (c, child_name);
- if (actor)
- break;
- }
- }
-
- g_list_free (children);
-
- return actor;
-}
-
-static ClutterChildMeta *
-get_child_meta (ClutterContainer *container,
- ClutterActor *actor)
-{
- ClutterContainerIface *iface = CLUTTER_CONTAINER_GET_IFACE (container);
- ClutterChildMeta *meta;
-
- if (iface->child_meta_type == G_TYPE_INVALID)
- return NULL;
-
- meta = g_object_get_qdata (G_OBJECT (actor), quark_child_meta);
- if (meta != NULL && meta->actor == actor)
- return meta;
-
- return NULL;
-}
-
-static void
-create_child_meta (ClutterContainer *container,
- ClutterActor *actor)
-{
- ClutterContainerIface *iface = CLUTTER_CONTAINER_GET_IFACE (container);
- ClutterChildMeta *child_meta = NULL;
-
- if (iface->child_meta_type == G_TYPE_INVALID)
- return;
-
- if (!g_type_is_a (iface->child_meta_type, CLUTTER_TYPE_CHILD_META))
- {
- g_warning ("%s: Child data of type '%s' is not a ClutterChildMeta",
- G_STRLOC, g_type_name (iface->child_meta_type));
- return;
- }
-
- child_meta = g_object_new (iface->child_meta_type,
- "container", container,
- "actor", actor,
- NULL);
-
- g_object_set_qdata_full (G_OBJECT (actor), quark_child_meta,
- child_meta,
- (GDestroyNotify) g_object_unref);
-}
-
-static void
-destroy_child_meta (ClutterContainer *container,
- ClutterActor *actor)
-{
- ClutterContainerIface *iface = CLUTTER_CONTAINER_GET_IFACE (container);
-
- if (iface->child_meta_type == G_TYPE_INVALID)
- return;
-
- g_object_set_qdata (G_OBJECT (actor), quark_child_meta, NULL);
-}
-
-/**
- * clutter_container_get_child_meta:
- * @container: a #ClutterContainer
- * @actor: a #ClutterActor that is a child of @container.
- *
- * Retrieves the #ClutterChildMeta which contains the data about the
- * @container specific state for @actor.
- *
- * Return value: (transfer none): the #ClutterChildMeta for the @actor child
- * of @container or %NULL if the specifiec actor does not exist or the
- * container is not configured to provide #ClutterChildMeta<!-- -->s
- *
- * Since: 0.8
- */
-ClutterChildMeta *
-clutter_container_get_child_meta (ClutterContainer *container,
- ClutterActor *actor)
-{
- ClutterContainerIface *iface = CLUTTER_CONTAINER_GET_IFACE (container);
-
- if (iface->child_meta_type == G_TYPE_INVALID)
- return NULL;
-
- if (G_LIKELY (iface->get_child_meta))
- return iface->get_child_meta (container, actor);
-
- return NULL;
-}
-
-/**
- * clutter_container_create_child_meta:
- * @container: a #ClutterContainer
- * @actor: a #ClutterActor
- *
- * Creates the #ClutterChildMeta wrapping @actor inside the
- * @container, if the #ClutterContainerIface::child_meta_type
- * class member is not set to %G_TYPE_INVALID.
- *
- * This function is only useful when adding a #ClutterActor to
- * a #ClutterContainer implementation outside of the
- * #ClutterContainer::add() virtual function implementation.
- *
- * Applications should not call this function.
- *
- * Since: 1.2
- */
-void
-clutter_container_create_child_meta (ClutterContainer *container,
- ClutterActor *actor)
-{
- ClutterContainerIface *iface;
-
- g_return_if_fail (CLUTTER_IS_CONTAINER (container));
- g_return_if_fail (CLUTTER_IS_ACTOR (actor));
-
- iface = CLUTTER_CONTAINER_GET_IFACE (container);
-
- if (iface->child_meta_type == G_TYPE_INVALID)
- return;
-
- g_assert (g_type_is_a (iface->child_meta_type, CLUTTER_TYPE_CHILD_META));
-
- if (G_LIKELY (iface->create_child_meta))
- iface->create_child_meta (container, actor);
-}
-
-/**
- * clutter_container_destroy_child_meta:
- * @container: a #ClutterContainer
- * @actor: a #ClutterActor
- *
- * Destroys the #ClutterChildMeta wrapping @actor inside the
- * @container, if any.
- *
- * This function is only useful when removing a #ClutterActor to
- * a #ClutterContainer implementation outside of the
- * #ClutterContainer::add() virtual function implementation.
- *
- * Applications should not call this function.
- *
- * Since: 1.2
- */
-void
-clutter_container_destroy_child_meta (ClutterContainer *container,
- ClutterActor *actor)
-{
- ClutterContainerIface *iface;
-
- g_return_if_fail (CLUTTER_IS_CONTAINER (container));
- g_return_if_fail (CLUTTER_IS_ACTOR (actor));
-
- iface = CLUTTER_CONTAINER_GET_IFACE (container);
-
- if (iface->child_meta_type == G_TYPE_INVALID)
- return;
-
- if (G_LIKELY (iface->destroy_child_meta))
- iface->destroy_child_meta (container, actor);
-}
-
-/**
- * clutter_container_class_find_child_property:
- * @klass: a #GObjectClass implementing the #ClutterContainer interface.
- * @property_name: a property name.
- *
- * Looks up the #GParamSpec for a child property of @klass.
- *
- * Return value: (transfer none): The #GParamSpec for the property or %NULL
- * if no such property exist.
- *
- * Since: 0.8
- */
-GParamSpec *
-clutter_container_class_find_child_property (GObjectClass *klass,
- const gchar *property_name)
-{
- ClutterContainerIface *iface;
- GObjectClass *child_class;
- GParamSpec *pspec;
-
- g_return_val_if_fail (G_IS_OBJECT_CLASS (klass), NULL);
- g_return_val_if_fail (property_name != NULL, NULL);
- g_return_val_if_fail (g_type_is_a (G_TYPE_FROM_CLASS (klass),
- CLUTTER_TYPE_CONTAINER),
- NULL);
-
- iface = g_type_interface_peek (klass, CLUTTER_TYPE_CONTAINER);
- g_return_val_if_fail (iface != NULL, NULL);
-
- if (iface->child_meta_type == G_TYPE_INVALID)
- return NULL;
-
- child_class = g_type_class_ref (iface->child_meta_type);
- pspec = g_object_class_find_property (child_class, property_name);
- g_type_class_unref (child_class);
-
- return pspec;
-}
-
-/**
- * clutter_container_class_list_child_properties:
- * @klass: a #GObjectClass implementing the #ClutterContainer interface.
- * @n_properties: return location for length of returned array.
- *
- * Returns an array of #GParamSpec for all child properties.
- *
- * Return value: (array length=n_properties) (transfer full): an array
- * of #GParamSpec<!-- -->s which should be freed after use.
- *
- * Since: 0.8
- */
-GParamSpec **
-clutter_container_class_list_child_properties (GObjectClass *klass,
- guint *n_properties)
-{
- ClutterContainerIface *iface;
- GObjectClass *child_class;
- GParamSpec **retval;
-
- g_return_val_if_fail (G_IS_OBJECT_CLASS (klass), NULL);
- g_return_val_if_fail (g_type_is_a (G_TYPE_FROM_CLASS (klass),
- CLUTTER_TYPE_CONTAINER),
- NULL);
-
- iface = g_type_interface_peek (klass, CLUTTER_TYPE_CONTAINER);
- g_return_val_if_fail (iface != NULL, NULL);
-
- if (iface->child_meta_type == G_TYPE_INVALID)
- return NULL;
-
- child_class = g_type_class_ref (iface->child_meta_type);
- retval = g_object_class_list_properties (child_class, n_properties);
- g_type_class_unref (child_class);
-
- return retval;
-}
-
-static void
-child_notify (ClutterContainer *container,
- ClutterActor *actor,
- GParamSpec *pspec)
-{
-}
-
-static inline void
-container_set_child_property (ClutterContainer *container,
- ClutterActor *actor,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterChildMeta *data;
-
- data = clutter_container_get_child_meta (container, actor);
- g_object_set_property (G_OBJECT (data), pspec->name, value);
-
- g_signal_emit (container, container_signals[CHILD_NOTIFY],
- (pspec->flags & G_PARAM_STATIC_NAME)
- ? g_quark_from_static_string (pspec->name)
- : g_quark_from_string (pspec->name),
- actor, pspec);
-}
-
-/**
- * clutter_container_child_set_property:
- * @container: a #ClutterContainer
- * @child: a #ClutterActor that is a child of @container.
- * @property: the name of the property to set.
- * @value: the value.
- *
- * Sets a container-specific property on a child of @container.
- *
- * Since: 0.8
- */
-void
-clutter_container_child_set_property (ClutterContainer *container,
- ClutterActor *child,
- const gchar *property,
- const GValue *value)
-{
- GObjectClass *klass;
- GParamSpec *pspec;
-
- g_return_if_fail (CLUTTER_IS_CONTAINER (container));
- g_return_if_fail (CLUTTER_IS_ACTOR (child));
- g_return_if_fail (property != NULL);
- g_return_if_fail (value != NULL);
-
- klass = G_OBJECT_GET_CLASS (container);
-
- pspec = clutter_container_class_find_child_property (klass, property);
- if (!pspec)
- {
- g_warning ("%s: Containers of type '%s' have no child "
- "property named '%s'",
- G_STRLOC, G_OBJECT_TYPE_NAME (container), property);
- return;
- }
-
- if (!(pspec->flags & G_PARAM_WRITABLE))
- {
- g_warning ("%s: Child property '%s' of the container '%s' "
- "is not writable",
- G_STRLOC, pspec->name, G_OBJECT_TYPE_NAME (container));
- return;
- }
-
- container_set_child_property (container, child, value, pspec);
-}
-
-/**
- * clutter_container_child_set:
- * @container: a #ClutterContainer
- * @actor: a #ClutterActor that is a child of @container.
- * @first_prop: name of the first property to be set.
- * @...: value for the first property, followed optionally by more name/value
- * pairs terminated with NULL.
- *
- * Sets container specific properties on the child of a container.
- *
- * Since: 0.8
- */
-void
-clutter_container_child_set (ClutterContainer *container,
- ClutterActor *actor,
- const gchar *first_prop,
- ...)
-{
- GObjectClass *klass;
- const gchar *name;
- va_list var_args;
-
- g_return_if_fail (CLUTTER_IS_CONTAINER (container));
- g_return_if_fail (CLUTTER_IS_ACTOR (actor));
-
- klass = G_OBJECT_GET_CLASS (container);
-
- va_start (var_args, first_prop);
-
- name = first_prop;
- while (name)
- {
- GValue value = G_VALUE_INIT;
- gchar *error = NULL;
- GParamSpec *pspec;
-
- pspec = clutter_container_class_find_child_property (klass, name);
- if (!pspec)
- {
- g_warning ("%s: Containers of type '%s' have no child "
- "property named '%s'",
- G_STRLOC, G_OBJECT_TYPE_NAME (container), name);
- break;
- }
-
- if (!(pspec->flags & G_PARAM_WRITABLE))
- {
- g_warning ("%s: Child property '%s' of the container '%s' "
- "is not writable",
- G_STRLOC, pspec->name, G_OBJECT_TYPE_NAME (container));
- break;
- }
-
- G_VALUE_COLLECT_INIT (&value, G_PARAM_SPEC_VALUE_TYPE (pspec),
- var_args, 0,
- &error);
-
- if (error)
- {
- /* we intentionally leak the GValue because it might
- * be in an undefined state and calling g_value_unset()
- * on it might crash
- */
- g_warning ("%s: %s", G_STRLOC, error);
- g_free (error);
- break;
- }
-
- container_set_child_property (container, actor, &value, pspec);
-
- g_value_unset (&value);
-
- name = va_arg (var_args, gchar*);
- }
-
- va_end (var_args);
-}
-
-static inline void
-container_get_child_property (ClutterContainer *container,
- ClutterActor *actor,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterChildMeta *data;
-
- data = clutter_container_get_child_meta (container, actor);
- g_object_get_property (G_OBJECT (data), pspec->name, value);
-}
-
-/**
- * clutter_container_child_get_property:
- * @container: a #ClutterContainer
- * @child: a #ClutterActor that is a child of @container.
- * @property: the name of the property to set.
- * @value: the value.
- *
- * Gets a container specific property of a child of @container, In general,
- * a copy is made of the property contents and the caller is responsible for
- * freeing the memory by calling g_value_unset().
- *
- * Note that clutter_container_child_set_property() is really intended for
- * language bindings, clutter_container_child_set() is much more convenient
- * for C programming.
- *
- * Since: 0.8
- */
-void
-clutter_container_child_get_property (ClutterContainer *container,
- ClutterActor *child,
- const gchar *property,
- GValue *value)
-{
- GObjectClass *klass;
- GParamSpec *pspec;
-
- g_return_if_fail (CLUTTER_IS_CONTAINER (container));
- g_return_if_fail (CLUTTER_IS_ACTOR (child));
- g_return_if_fail (property != NULL);
- g_return_if_fail (value != NULL);
-
- klass = G_OBJECT_GET_CLASS (container);
-
- pspec = clutter_container_class_find_child_property (klass, property);
- if (!pspec)
- {
- g_warning ("%s: Containers of type '%s' have no child "
- "property named '%s'",
- G_STRLOC, G_OBJECT_TYPE_NAME (container), property);
- return;
- }
-
- if (!(pspec->flags & G_PARAM_READABLE))
- {
- g_warning ("%s: Child property '%s' of the container '%s' "
- "is not writable",
- G_STRLOC, pspec->name, G_OBJECT_TYPE_NAME (container));
- return;
- }
-
- container_get_child_property (container, child, value, pspec);
-}
-
-
-/**
- * clutter_container_child_get:
- * @container: a #ClutterContainer
- * @actor: a #ClutterActor that is a child of @container.
- * @first_prop: name of the first property to be set.
- * @...: value for the first property, followed optionally by more name/value
- * pairs terminated with NULL.
- *
- * Gets @container specific properties of an actor.
- *
- * In general, a copy is made of the property contents and the caller is
- * responsible for freeing the memory in the appropriate manner for the type, for
- * instance by calling g_free() or g_object_unref().
- *
- * Since: 0.8
- */
-void
-clutter_container_child_get (ClutterContainer *container,
- ClutterActor *actor,
- const gchar *first_prop,
- ...)
-{
- GObjectClass *klass;
- const gchar *name;
- va_list var_args;
-
- g_return_if_fail (CLUTTER_IS_CONTAINER (container));
- g_return_if_fail (CLUTTER_IS_ACTOR (actor));
-
- klass = G_OBJECT_GET_CLASS (container);
-
- va_start (var_args, first_prop);
-
- name = first_prop;
- while (name)
- {
- GValue value = G_VALUE_INIT;
- gchar *error = NULL;
- GParamSpec *pspec;
-
- pspec = clutter_container_class_find_child_property (klass, name);
- if (!pspec)
- {
- g_warning ("%s: container '%s' has no child property named '%s'",
- G_STRLOC, G_OBJECT_TYPE_NAME (container), name);
- break;
- }
-
- if (!(pspec->flags & G_PARAM_READABLE))
- {
- g_warning ("%s: child property '%s' of container '%s' is not readable",
- G_STRLOC, pspec->name, G_OBJECT_TYPE_NAME (container));
- break;
- }
-
- g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
-
- container_get_child_property (container, actor, &value, pspec);
-
- G_VALUE_LCOPY (&value, var_args, 0, &error);
- if (error)
- {
- g_warning ("%s: %s", G_STRLOC, error);
- g_free (error);
- g_value_unset (&value);
- break;
- }
-
- g_value_unset (&value);
-
- name = va_arg (var_args, gchar*);
- }
-
- va_end (var_args);
-}
-
-/**
- * clutter_container_child_notify:
- * @container: a #ClutterContainer
- * @child: a #ClutterActor
- * @pspec: a #GParamSpec
- *
- * Calls the #ClutterContainerIface.child_notify() virtual function
- * of #ClutterContainer. The default implementation will emit the
- * #ClutterContainer::child-notify signal.
- *
- * Since: 1.6
- */
-void
-clutter_container_child_notify (ClutterContainer *container,
- ClutterActor *child,
- GParamSpec *pspec)
-{
- g_return_if_fail (CLUTTER_IS_CONTAINER (container));
- g_return_if_fail (CLUTTER_IS_ACTOR (child));
- g_return_if_fail (pspec != NULL);
-
- g_return_if_fail (clutter_actor_get_parent (child) == CLUTTER_ACTOR (container));
-
- CLUTTER_CONTAINER_GET_IFACE (container)->child_notify (container,
- child,
- pspec);
-}
-
-void
-_clutter_container_emit_actor_added (ClutterContainer *container,
- ClutterActor *actor)
-{
- g_return_if_fail (CLUTTER_IS_CONTAINER (container));
- g_return_if_fail (CLUTTER_IS_ACTOR (actor));
-
- g_signal_emit (container, container_signals[ACTOR_ADDED], 0, actor);
-}
-
-void
-_clutter_container_emit_actor_removed (ClutterContainer *container,
- ClutterActor *actor)
-{
- g_return_if_fail (CLUTTER_IS_CONTAINER (container));
- g_return_if_fail (CLUTTER_IS_ACTOR (actor));
-
- g_signal_emit (container, container_signals[ACTOR_REMOVED], 0, actor);
-}
diff --git a/clutter/clutter/clutter-container.h b/clutter/clutter/clutter-container.h
deleted file mode 100644
index 6575569db..000000000
--- a/clutter/clutter/clutter-container.h
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- *
- * Copyright (C) 2006 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 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/>.
- *
- * ClutterContainer: Generic actor container interface.
- * Author: Emmanuele Bassi <ebassi@openedhand.com>
- */
-
-#ifndef __CLUTTER_CONTAINER_H__
-#define __CLUTTER_CONTAINER_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-actor.h>
-#include <clutter/clutter-child-meta.h>
-#include <clutter/clutter-types.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_CONTAINER (clutter_container_get_type ())
-#define CLUTTER_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_CONTAINER, ClutterContainer))
-#define CLUTTER_IS_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_CONTAINER))
-#define CLUTTER_CONTAINER_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CLUTTER_TYPE_CONTAINER, ClutterContainerIface))
-
-typedef struct _ClutterContainerIface ClutterContainerIface;
-
-/**
- * ClutterContainer:
- *
- * #ClutterContainer is an opaque structure whose members cannot be directly
- * accessed
- *
- * Since: 0.4
- */
-
-/**
- * ClutterContainerIface:
- * @add: virtual function for adding an actor to the container. This virtual
- * 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.
- * @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
- * deprecated and it should not be overridden.
- * @sort_depth_order: virtual function for sorting the children of a
- * container depending on their depth. This virtual function is deprecated
- * and it should not be overridden.
- * @child_meta_type: The GType used for storing auxiliary information about
- * each of the containers children.
- * @create_child_meta: virtual function that gets called for each added
- * child, the function should instantiate an object of type
- * #ClutterContainerIface::child_meta_type, set the container and actor
- * fields in the instance and add the record to a data structure for
- * subsequent access for #ClutterContainerIface::get_child_meta
- * @destroy_child_meta: virtual function that gets called when a child is
- * removed; it should release all resources held by the record
- * @get_child_meta: return the record for a container child
- * @actor_added: class handler for #ClutterContainer::actor-added
- * @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
- * virtual functions must be provided by any implementation; the other
- * virtual functions are optional.
- *
- * Since: 0.4
- */
-struct _ClutterContainerIface
-{
- /*< private >*/
- GTypeInterface g_iface;
-
- /*< public >*/
- void (* add) (ClutterContainer *container,
- ClutterActor *actor);
- void (* remove) (ClutterContainer *container,
- ClutterActor *actor);
-
- /* child stacking */
- void (* raise) (ClutterContainer *container,
- ClutterActor *actor,
- ClutterActor *sibling);
- void (* lower) (ClutterContainer *container,
- ClutterActor *actor,
- ClutterActor *sibling);
- void (* sort_depth_order) (ClutterContainer *container);
-
- /* ClutterChildMeta management */
- GType child_meta_type;
- void (* create_child_meta) (ClutterContainer *container,
- ClutterActor *actor);
- void (* destroy_child_meta) (ClutterContainer *container,
- ClutterActor *actor);
- ClutterChildMeta *(* get_child_meta) (ClutterContainer *container,
- ClutterActor *actor);
-
- /* signals */
- void (* actor_added) (ClutterContainer *container,
- ClutterActor *actor);
- void (* actor_removed) (ClutterContainer *container,
- ClutterActor *actor);
-
- void (* child_notify) (ClutterContainer *container,
- ClutterActor *child,
- GParamSpec *pspec);
-};
-
-CLUTTER_EXPORT
-GType clutter_container_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterActor * clutter_container_find_child_by_name (ClutterContainer *container,
- const gchar *child_name);
-
-CLUTTER_EXPORT
-GParamSpec * clutter_container_class_find_child_property (GObjectClass *klass,
- const gchar *property_name);
-CLUTTER_EXPORT
-GParamSpec ** clutter_container_class_list_child_properties (GObjectClass *klass,
- guint *n_properties);
-
-CLUTTER_EXPORT
-void clutter_container_create_child_meta (ClutterContainer *container,
- ClutterActor *actor);
-CLUTTER_EXPORT
-void clutter_container_destroy_child_meta (ClutterContainer *container,
- ClutterActor *actor);
-CLUTTER_EXPORT
-ClutterChildMeta * clutter_container_get_child_meta (ClutterContainer *container,
- ClutterActor *actor);
-
-CLUTTER_EXPORT
-void clutter_container_child_set_property (ClutterContainer *container,
- ClutterActor *child,
- const gchar * property,
- const GValue *value);
-CLUTTER_EXPORT
-void clutter_container_child_get_property (ClutterContainer *container,
- ClutterActor *child,
- const gchar *property,
- GValue *value);
-CLUTTER_EXPORT
-void clutter_container_child_set (ClutterContainer *container,
- ClutterActor *actor,
- const gchar *first_prop,
- ...) G_GNUC_NULL_TERMINATED;
-CLUTTER_EXPORT
-void clutter_container_child_get (ClutterContainer *container,
- ClutterActor *actor,
- const gchar *first_prop,
- ...) G_GNUC_NULL_TERMINATED;
-
-CLUTTER_EXPORT
-void clutter_container_child_notify (ClutterContainer *container,
- ClutterActor *child,
- GParamSpec *pspec);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_CONTAINER_H__ */
diff --git a/clutter/clutter/clutter-content-private.h b/clutter/clutter/clutter-content-private.h
deleted file mode 100644
index 1654b3bbf..000000000
--- a/clutter/clutter/clutter-content-private.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2011 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_CONTENT_PRIVATE_H__
-#define __CLUTTER_CONTENT_PRIVATE_H__
-
-#include <clutter/clutter-content.h>
-
-G_BEGIN_DECLS
-
-void _clutter_content_attached (ClutterContent *content,
- ClutterActor *actor);
-void _clutter_content_detached (ClutterContent *content,
- ClutterActor *actor);
-
-void _clutter_content_paint_content (ClutterContent *content,
- ClutterActor *actor,
- ClutterPaintNode *node,
- ClutterPaintContext *paint_context);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_CONTENT_PRIVATE_H__ */
diff --git a/clutter/clutter/clutter-content.c b/clutter/clutter/clutter-content.c
deleted file mode 100644
index 31abd1135..000000000
--- a/clutter/clutter/clutter-content.c
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2011 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-content
- * @Title: ClutterContent
- * @Short_Description: Delegate for painting the content of an actor
- *
- * #ClutterContent is an interface to implement types responsible for
- * painting the content of a #ClutterActor.
- *
- * Multiple actors can use the same #ClutterContent instance, in order
- * to share the resources associated with painting the same content.
- *
- * #ClutterContent is available since Clutter 1.10.
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-actor-private.h"
-#include "clutter-content-private.h"
-
-#include "clutter-debug.h"
-#include "clutter-marshal.h"
-#include "clutter-private.h"
-
-enum
-{
- ATTACHED,
- DETACHED,
-
- LAST_SIGNAL
-};
-
-static GQuark quark_content_actors = 0;
-
-static guint content_signals[LAST_SIGNAL] = { 0, };
-
-G_DEFINE_INTERFACE (ClutterContent, clutter_content, G_TYPE_OBJECT)
-
-static gboolean
-clutter_content_real_get_preferred_size (ClutterContent *content,
- gfloat *width,
- gfloat *height)
-{
- if (width != NULL)
- *width = 0.f;
-
- if (height != NULL)
- *height = 0.f;
-
- return FALSE;
-}
-
-static void
-clutter_content_real_attached (ClutterContent *content,
- ClutterActor *actor)
-{
-}
-
-static void
-clutter_content_real_detached (ClutterContent *content,
- ClutterActor *actor)
-{
-}
-
-static void
-clutter_content_real_invalidate (ClutterContent *content)
-{
-}
-
-static void
-clutter_content_real_invalidate_size (ClutterContent *content)
-{
-}
-
-static void
-clutter_content_real_paint_content (ClutterContent *content,
- ClutterActor *actor,
- ClutterPaintNode *context,
- ClutterPaintContext *paint_context)
-{
-}
-
-static void
-clutter_content_default_init (ClutterContentInterface *iface)
-{
- quark_content_actors = g_quark_from_static_string ("-clutter-content-actors");
-
- iface->get_preferred_size = clutter_content_real_get_preferred_size;
- iface->paint_content = clutter_content_real_paint_content;
- iface->attached = clutter_content_real_attached;
- iface->detached = clutter_content_real_detached;
- iface->invalidate = clutter_content_real_invalidate;
- iface->invalidate_size = clutter_content_real_invalidate_size;
-
- /**
- * ClutterContent::attached:
- * @content: the object that emitted the signal
- * @actor: a #ClutterActor
- *
- * This signal is emitted each time a #ClutterContent implementation is
- * assigned to a #ClutterActor.
- *
- * Since: 1.10
- */
- content_signals[ATTACHED] =
- g_signal_new (I_("attached"),
- G_TYPE_FROM_INTERFACE (iface),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (ClutterContentInterface, attached),
- NULL, NULL, NULL,
- G_TYPE_NONE, 1,
- CLUTTER_TYPE_ACTOR);
-
- /**
- * ClutterContent::detached:
- * @content: the object that emitted the signal
- * @actor: a #ClutterActor
- *
- * This signal is emitted each time a #ClutterContent implementation is
- * removed from a #ClutterActor.
- *
- * Since: 1.10
- */
- content_signals[DETACHED] =
- g_signal_new (I_("detached"),
- G_TYPE_FROM_INTERFACE (iface),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (ClutterContentInterface, detached),
- NULL, NULL, NULL,
- G_TYPE_NONE, 1,
- CLUTTER_TYPE_ACTOR);
-}
-
-/**
- * clutter_content_invalidate:
- * @content: a #ClutterContent
- *
- * Invalidates a #ClutterContent.
- *
- * This function should be called by #ClutterContent implementations when
- * they change the way a the content should be painted regardless of the
- * actor state.
- *
- * Since: 1.10
- */
-void
-clutter_content_invalidate (ClutterContent *content)
-{
- GHashTable *actors;
- GHashTableIter iter;
- gpointer key_p, value_p;
-
- g_return_if_fail (CLUTTER_IS_CONTENT (content));
-
- CLUTTER_CONTENT_GET_IFACE (content)->invalidate (content);
-
- actors = g_object_get_qdata (G_OBJECT (content), quark_content_actors);
- if (actors == NULL)
- return;
-
- g_hash_table_iter_init (&iter, actors);
- while (g_hash_table_iter_next (&iter, &key_p, &value_p))
- {
- ClutterActor *actor = key_p;
-
- g_assert (actor != NULL);
-
- clutter_actor_queue_redraw (actor);
- }
-}
-
-/**
- * clutter_content_invalidate_size:
- * @content: a #ClutterContent
- *
- * Signals that @content's size changed. Attached actors with request mode
- * set to %CLUTTER_REQUEST_CONTENT_SIZE will have a relayout queued.
- *
- * Attached actors with other request modes are not redrawn. To redraw them
- * too, use clutter_content_invalidate().
- */
-void
-clutter_content_invalidate_size (ClutterContent *content)
-{
- ClutterActor *actor;
- GHashTable *actors;
- GHashTableIter iter;
-
- g_return_if_fail (CLUTTER_IS_CONTENT (content));
-
- CLUTTER_CONTENT_GET_IFACE (content)->invalidate_size (content);
-
- actors = g_object_get_qdata (G_OBJECT (content), quark_content_actors);
- if (actors == NULL)
- return;
-
- g_hash_table_iter_init (&iter, actors);
- while (g_hash_table_iter_next (&iter, (gpointer *) &actor, NULL))
- {
- ClutterRequestMode request_mode;
-
- g_assert (actor != NULL);
-
- request_mode = clutter_actor_get_request_mode (actor);
-
- if (request_mode == CLUTTER_REQUEST_CONTENT_SIZE)
- _clutter_actor_queue_only_relayout (actor);
- }
-}
-
-/*< private >
- * _clutter_content_attached:
- * @content: a #ClutterContent
- * @actor: a #ClutterActor
- *
- * Attaches @actor to the @content.
- *
- * This function should be used internally every time a #ClutterActor
- * is associated to a #ClutterContent, to set up a backpointer from
- * the @content to the @actor.
- *
- * This function will invoke the #ClutterContentInterface.attached() virtual
- * function.
- */
-void
-_clutter_content_attached (ClutterContent *content,
- ClutterActor *actor)
-{
- GObject *obj = G_OBJECT (content);
- GHashTable *actors;
-
- actors = g_object_get_qdata (obj, quark_content_actors);
- if (actors == NULL)
- {
- actors = g_hash_table_new (NULL, NULL);
- g_object_set_qdata_full (obj, quark_content_actors,
- actors,
- (GDestroyNotify) g_hash_table_unref);
- }
-
- g_hash_table_insert (actors, actor, actor);
-
- g_signal_emit (content, content_signals[ATTACHED], 0, actor);
-}
-
-/*< private >
- * _clutter_content_detached:
- * @content: a #ClutterContent
- * @actor: a #ClutterActor
- *
- * Detaches @actor from @content.
- *
- * This function should be used internally every time a #ClutterActor
- * removes the association with a #ClutterContent.
- *
- * This function will invoke the #ClutterContentInterface.detached() virtual
- * function.
- */
-void
-_clutter_content_detached (ClutterContent *content,
- ClutterActor *actor)
-{
- GObject *obj = G_OBJECT (content);
- GHashTable *actors;
-
- actors = g_object_get_qdata (obj, quark_content_actors);
- g_assert (actors != NULL);
-
- g_hash_table_remove (actors, actor);
-
- if (g_hash_table_size (actors) == 0)
- g_object_set_qdata (obj, quark_content_actors, NULL);
-
- g_signal_emit (content, content_signals[DETACHED], 0, actor);
-}
-
-/*< private >
- * _clutter_content_paint_content:
- * @content: a #ClutterContent
- * @actor: a #ClutterActor
- * @node: a #ClutterPaintNode
- * @paint_context: a #ClutterPaintContext
- *
- * Creates the render tree for the @content and @actor.
- *
- * This function will invoke the #ClutterContentInterface.paint_content()
- * virtual function.
- */
-void
-_clutter_content_paint_content (ClutterContent *content,
- ClutterActor *actor,
- ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- CLUTTER_CONTENT_GET_IFACE (content)->paint_content (content, actor, node,
- paint_context);
-}
-
-/**
- * clutter_content_get_preferred_size:
- * @content: a #ClutterContent
- * @width: (out): return location for the natural width of the content
- * @height: (out): return location for the natural height of the content
- *
- * Retrieves the natural size of the @content, if any.
- *
- * The natural size of a #ClutterContent is defined as the size the content
- * would have regardless of the allocation of the actor that is painting it,
- * for instance the size of an image data.
- *
- * Return value: %TRUE if the content has a preferred size, and %FALSE
- * otherwise
- *
- * Since: 1.10
- */
-gboolean
-clutter_content_get_preferred_size (ClutterContent *content,
- gfloat *width,
- gfloat *height)
-{
- g_return_val_if_fail (CLUTTER_IS_CONTENT (content), FALSE);
-
- return CLUTTER_CONTENT_GET_IFACE (content)->get_preferred_size (content,
- width,
- height);
-}
diff --git a/clutter/clutter/clutter-content.h b/clutter/clutter/clutter-content.h
deleted file mode 100644
index 77b44dc3f..000000000
--- a/clutter/clutter/clutter-content.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2012 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_CONTENT_H__
-#define __CLUTTER_CONTENT_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-types.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_CONTENT (clutter_content_get_type ())
-
-CLUTTER_EXPORT
-G_DECLARE_INTERFACE (ClutterContent, clutter_content, CLUTTER, CONTENT, GObject)
-
-/**
- * ClutterContentInterface:
- * @get_preferred_size: virtual function; should be overridden by subclasses
- * of #ClutterContent that have a natural size
- * @paint_content: virtual function; called each time the content needs to
- * paint itself
- * @attached: virtual function; called each time a #ClutterContent is attached
- * to a #ClutterActor.
- * @detached: virtual function; called each time a #ClutterContent is detached
- * from a #ClutterActor.
- * @invalidate: virtual function; called each time a #ClutterContent state
- * is changed.
- *
- * The #ClutterContentInterface structure contains only
- * private data.
- *
- * Since: 1.10
- */
-struct _ClutterContentInterface
-{
- /*< private >*/
- GTypeInterface g_iface;
-
- /*< public >*/
- gboolean (* get_preferred_size) (ClutterContent *content,
- gfloat *width,
- gfloat *height);
- void (* paint_content) (ClutterContent *content,
- ClutterActor *actor,
- ClutterPaintNode *node,
- ClutterPaintContext *paint_context);
-
- void (* attached) (ClutterContent *content,
- ClutterActor *actor);
- void (* detached) (ClutterContent *content,
- ClutterActor *actor);
-
- void (* invalidate) (ClutterContent *content);
-
- void (* invalidate_size) (ClutterContent *content);
-};
-
-CLUTTER_EXPORT
-gboolean clutter_content_get_preferred_size (ClutterContent *content,
- gfloat *width,
- gfloat *height);
-CLUTTER_EXPORT
-void clutter_content_invalidate (ClutterContent *content);
-
-CLUTTER_EXPORT
-void clutter_content_invalidate_size (ClutterContent *content);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_CONTENT_H__ */
diff --git a/clutter/clutter/clutter-damage-history.c b/clutter/clutter/clutter-damage-history.c
deleted file mode 100644
index d5e86f1b7..000000000
--- a/clutter/clutter/clutter-damage-history.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2007,2008,2009,2010,2011 Intel Corporation.
- * Copyright (C) 2020 Red Hat Inc
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-damage-history.h"
-
-#define DAMAGE_HISTORY_LENGTH 0x10
-
-struct _ClutterDamageHistory
-{
- cairo_region_t *damages[DAMAGE_HISTORY_LENGTH];
- int index;
-};
-
-ClutterDamageHistory *
-clutter_damage_history_new (void)
-{
- ClutterDamageHistory *history;
-
- history = g_new0 (ClutterDamageHistory, 1);
-
- return history;
-}
-
-void
-clutter_damage_history_free (ClutterDamageHistory *history)
-{
- int i;
-
- for (i = 0; i < G_N_ELEMENTS (history->damages); i++)
- g_clear_pointer (&history->damages[i], cairo_region_destroy);
-
- g_free (history);
-}
-
-gboolean
-clutter_damage_history_is_age_valid (ClutterDamageHistory *history,
- int age)
-{
- if (age >= DAMAGE_HISTORY_LENGTH ||
- age < 1)
- return FALSE;
-
- if (!clutter_damage_history_lookup (history, age))
- return FALSE;
-
- return TRUE;
-}
-
-void
-clutter_damage_history_record (ClutterDamageHistory *history,
- const cairo_region_t *damage)
-{
- g_clear_pointer (&history->damages[history->index], cairo_region_destroy);
- history->damages[history->index] = cairo_region_copy (damage);
-}
-
-static inline int
-step_damage_index (int current,
- int diff)
-{
- return (current + diff) & (DAMAGE_HISTORY_LENGTH - 1);
-}
-
-void
-clutter_damage_history_step (ClutterDamageHistory *history)
-{
- history->index = step_damage_index (history->index, 1);
-}
-
-const cairo_region_t *
-clutter_damage_history_lookup (ClutterDamageHistory *history,
- int age)
-{
- return history->damages[step_damage_index (history->index, -age)];
-}
diff --git a/clutter/clutter/clutter-damage-history.h b/clutter/clutter/clutter-damage-history.h
deleted file mode 100644
index b249d2e17..000000000
--- a/clutter/clutter/clutter-damage-history.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2007,2008,2009,2010,2011 Intel Corporation.
- * Copyright (C) 2020 Red Hat Inc
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef CLUTTER_DAMAGE_HISTORY_H
-#define CLUTTER_DAMAGE_HISTORY_H
-
-#include <cairo.h>
-#include <glib.h>
-
-#include "clutter-macros.h"
-
-typedef struct _ClutterDamageHistory ClutterDamageHistory;
-
-CLUTTER_EXPORT
-ClutterDamageHistory * clutter_damage_history_new (void);
-
-CLUTTER_EXPORT
-void clutter_damage_history_free (ClutterDamageHistory *history);
-
-CLUTTER_EXPORT
-gboolean clutter_damage_history_is_age_valid (ClutterDamageHistory *history,
- int age);
-
-CLUTTER_EXPORT
-void clutter_damage_history_record (ClutterDamageHistory *history,
- const cairo_region_t *damage);
-
-CLUTTER_EXPORT
-void clutter_damage_history_step (ClutterDamageHistory *history);
-
-CLUTTER_EXPORT
-const cairo_region_t * clutter_damage_history_lookup (ClutterDamageHistory *history,
- int age);
-
-#endif /* CLUTTER_DAMAGE_HISTORY_H */
diff --git a/clutter/clutter/clutter-debug.h b/clutter/clutter/clutter-debug.h
deleted file mode 100644
index 677bed107..000000000
--- a/clutter/clutter/clutter-debug.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifndef __CLUTTER_DEBUG_H__
-#define __CLUTTER_DEBUG_H__
-
-#include <glib.h>
-#include "clutter-main.h"
-
-G_BEGIN_DECLS
-
-#ifdef CLUTTER_ENABLE_DEBUG
-
-#define CLUTTER_HAS_DEBUG(type) ((clutter_debug_flags & CLUTTER_DEBUG_##type) != FALSE)
-
-#ifdef __GNUC__
-
-/* Try the GCC extension for valists in macros */
-#define CLUTTER_NOTE(type,x,a...) G_STMT_START { \
- if (G_UNLIKELY (CLUTTER_HAS_DEBUG (type))) { \
- _clutter_debug_message ("[" #type "]:" G_STRLOC ": " x, ##a); \
- } } G_STMT_END
-
-#else /* !__GNUC__ */
-/* Try the C99 version; unfortunately, this does not allow us to pass
- * empty arguments to the macro, which means we have to
- * do an intemediate printf.
- */
-#define CLUTTER_NOTE(type,...) G_STMT_START { \
- if (G_UNLIKELY (CLUTTER_HAS_DEBUG (type))) { \
- gchar *_fmt = g_strdup_printf (__VA_ARGS__); \
- _clutter_debug_message ("[" #type "]:" G_STRLOC ": %s", _fmt); \
- g_free (_fmt); \
- } } G_STMT_END
-#endif
-
-#else /* !CLUTTER_ENABLE_DEBUG */
-
-#define CLUTTER_NOTE(type,...) G_STMT_START { } G_STMT_END
-#define CLUTTER_HAS_DEBUG(type) FALSE
-
-#endif /* CLUTTER_ENABLE_DEBUG */
-
-extern guint clutter_debug_flags;
-extern guint clutter_pick_debug_flags;
-extern guint clutter_paint_debug_flags;
-extern int clutter_max_render_time_constant_us;
-
-void _clutter_debug_messagev (const char *format,
- va_list var_args) G_GNUC_PRINTF (1, 0);
-void _clutter_debug_message (const char *format,
- ...) G_GNUC_PRINTF (1, 2);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_DEBUG_H__ */
diff --git a/clutter/clutter/clutter-deform-effect.c b/clutter/clutter/clutter-deform-effect.c
deleted file mode 100644
index 039ce014b..000000000
--- a/clutter/clutter/clutter-deform-effect.c
+++ /dev/null
@@ -1,826 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- *
- * Based on the MxDeformTexture class, written by:
- * Chris Lord <chris@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-deform-effect
- * @Title: ClutterDeformEffect
- * @Short_Description: A base class for effects deforming the geometry
- * of an actor
- *
- * #ClutterDeformEffect is an abstract class providing all the plumbing
- * for creating effects that result in the deformation of an actor's
- * geometry.
- *
- * #ClutterDeformEffect uses offscreen buffers to render the contents of
- * a #ClutterActor and then the Cogl vertex buffers API to submit the
- * geometry to the GPU.
- *
- * #ClutterDeformEffect is available since Clutter 1.4
- *
- * ## Implementing ClutterDeformEffect
- *
- * Sub-classes of #ClutterDeformEffect should override the
- * #ClutterDeformEffectClass.deform_vertex() virtual function; this function
- * is called on every vertex that needs to be deformed by the effect.
- * Each passed vertex is an in-out parameter that initially contains the
- * position of the vertex and should be modified according to a specific
- * deformation algorithm.
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-deform-effect.h"
-
-#include <cogl/cogl.h>
-
-#include "clutter-color.h"
-#include "clutter-debug.h"
-#include "clutter-enum-types.h"
-#include "clutter-offscreen-effect-private.h"
-#include "clutter-paint-node.h"
-#include "clutter-paint-nodes.h"
-#include "clutter-private.h"
-
-#define DEFAULT_N_TILES 32
-
-struct _ClutterDeformEffectPrivate
-{
- CoglPipeline *back_pipeline;
-
- gint x_tiles;
- gint y_tiles;
-
- CoglAttributeBuffer *buffer;
-
- CoglPrimitive *primitive;
-
- CoglPrimitive *lines_primitive;
-
- gint n_vertices;
-
- gulong allocation_id;
-
- guint is_dirty : 1;
-};
-
-enum
-{
- PROP_0,
-
- PROP_X_TILES,
- PROP_Y_TILES,
-
- PROP_BACK_MATERIAL,
-
- PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST];
-
-G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterDeformEffect,
- clutter_deform_effect,
- CLUTTER_TYPE_OFFSCREEN_EFFECT)
-
-static void
-clutter_deform_effect_real_deform_vertex (ClutterDeformEffect *effect,
- gfloat width,
- gfloat height,
- CoglTextureVertex *vertex)
-{
- g_warning ("%s: Deformation effect of type '%s' does not implement "
- "the required ClutterDeformEffect::deform_vertex virtual "
- "function.",
- G_STRLOC,
- G_OBJECT_TYPE_NAME (effect));
-}
-
-static void
-clutter_deform_effect_deform_vertex (ClutterDeformEffect *effect,
- gfloat width,
- gfloat height,
- CoglTextureVertex *vertex)
-{
- CLUTTER_DEFORM_EFFECT_GET_CLASS (effect)->deform_vertex (effect,
- width, height,
- vertex);
-}
-
-static void
-vbo_invalidate (ClutterActor *actor,
- GParamSpec *pspec,
- ClutterDeformEffect *effect)
-{
- effect->priv->is_dirty = TRUE;
-}
-
-static void
-clutter_deform_effect_set_actor (ClutterActorMeta *meta,
- ClutterActor *actor)
-{
- ClutterDeformEffectPrivate *priv = CLUTTER_DEFORM_EFFECT (meta)->priv;
-
- if (priv->allocation_id != 0)
- {
- ClutterActor *old_actor = clutter_actor_meta_get_actor (meta);
-
- if (old_actor != NULL)
- g_clear_signal_handler (&priv->allocation_id, old_actor);
-
- priv->allocation_id = 0;
- }
-
- /* we need to invalidate the VBO whenever the allocation of the actor
- * changes
- */
- if (actor != NULL)
- priv->allocation_id = g_signal_connect (actor, "notify::allocation",
- G_CALLBACK (vbo_invalidate),
- meta);
-
- priv->is_dirty = TRUE;
-
- CLUTTER_ACTOR_META_CLASS (clutter_deform_effect_parent_class)->set_actor (meta, actor);
-}
-
-static void
-clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect,
- ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- ClutterDeformEffect *self= CLUTTER_DEFORM_EFFECT (effect);
- ClutterDeformEffectPrivate *priv = self->priv;
- CoglPipeline *pipeline;
- CoglDepthState depth_state;
-
- if (priv->is_dirty)
- {
- gboolean mapped_buffer;
- CoglVertexP3T2C4 *verts;
- ClutterActor *actor;
- gfloat width, height;
- guint opacity;
- gint i, j;
-
- actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (effect));
- opacity = clutter_actor_get_paint_opacity (actor);
-
- /* if we don't have a target size, fall back to the actor's
- * allocation, though wrong it might be
- */
- if (!clutter_offscreen_effect_get_target_size (effect, &width, &height))
- clutter_actor_get_size (actor, &width, &height);
-
- /* XXX ideally, the sub-classes should tell us what they
- * changed in the texture vertices; we then would be able to
- * avoid resubmitting the same data, if it did not change. for
- * the time being, we resubmit everything
- */
- verts = cogl_buffer_map (COGL_BUFFER (priv->buffer),
- COGL_BUFFER_ACCESS_WRITE,
- COGL_BUFFER_MAP_HINT_DISCARD);
-
- /* If the map failed then we'll resort to allocating a temporary
- buffer */
- if (verts == NULL)
- {
- mapped_buffer = FALSE;
- verts = g_malloc (sizeof (*verts) * priv->n_vertices);
- }
- else
- mapped_buffer = TRUE;
-
- for (i = 0; i < priv->y_tiles + 1; i++)
- {
- for (j = 0; j < priv->x_tiles + 1; j++)
- {
- CoglVertexP3T2C4 *vertex_out;
- CoglTextureVertex vertex;
-
- /* CoglTextureVertex isn't an ideal structure to use for
- this because it contains a CoglColor. The internal
- layout of CoglColor is mean to be private so Clutter
- can not pass a pointer to it as a vertex
- attribute. Also it contains padding so we end up
- storing more data in the vertex buffer than we need
- to. Instead we let the application modify a dummy
- vertex and then copy the details back out to a more
- well-defined struct */
-
- vertex.tx = (float) j / priv->x_tiles;
- vertex.ty = (float) i / priv->y_tiles;
-
- vertex.x = width * vertex.tx;
- vertex.y = height * vertex.ty;
- vertex.z = 0.0f;
-
- cogl_color_init_from_4ub (&vertex.color, 255, 255, 255, opacity);
-
- clutter_deform_effect_deform_vertex (self,
- width, height,
- &vertex);
-
- vertex_out = verts + i * (priv->x_tiles + 1) + j;
-
- vertex_out->x = vertex.x;
- vertex_out->y = vertex.y;
- vertex_out->z = vertex.z;
- vertex_out->s = vertex.tx;
- vertex_out->t = vertex.ty;
- vertex_out->r = cogl_color_get_red_byte (&vertex.color);
- vertex_out->g = cogl_color_get_green_byte (&vertex.color);
- vertex_out->b = cogl_color_get_blue_byte (&vertex.color);
- vertex_out->a = cogl_color_get_alpha_byte (&vertex.color);
- }
- }
-
- if (mapped_buffer)
- cogl_buffer_unmap (COGL_BUFFER (priv->buffer));
- else
- {
- cogl_buffer_set_data (COGL_BUFFER (priv->buffer),
- 0, /* offset */
- verts,
- sizeof (*verts) * priv->n_vertices);
- g_free (verts);
- }
-
- priv->is_dirty = FALSE;
- }
-
- pipeline = clutter_offscreen_effect_get_pipeline (effect);
-
- /* enable depth testing */
- cogl_depth_state_init (&depth_state);
- cogl_depth_state_set_test_enabled (&depth_state, TRUE);
- cogl_depth_state_set_test_function (&depth_state, COGL_DEPTH_TEST_FUNCTION_LEQUAL);
- cogl_pipeline_set_depth_state (pipeline, &depth_state, NULL);
-
- /* enable backface culling if we have a back material */
- if (priv->back_pipeline != NULL)
- cogl_pipeline_set_cull_face_mode (pipeline,
- COGL_PIPELINE_CULL_FACE_MODE_BACK);
-
- /* draw the front */
- if (pipeline != NULL)
- {
- ClutterPaintNode *front_node;
-
- front_node = clutter_pipeline_node_new (pipeline);
- clutter_paint_node_set_static_name (front_node,
- "ClutterDeformEffect (front)");
- clutter_paint_node_add_child (node, front_node);
- clutter_paint_node_add_primitive (front_node, priv->primitive);
- clutter_paint_node_unref (front_node);
- }
-
- /* draw the back */
- if (priv->back_pipeline != NULL)
- {
- ClutterPaintNode *back_node;
- CoglPipeline *back_pipeline;
-
- /* We probably shouldn't be modifying the user's material so
- instead we make a temporary copy */
- back_pipeline = cogl_pipeline_copy (priv->back_pipeline);
- cogl_pipeline_set_depth_state (back_pipeline, &depth_state, NULL);
- cogl_pipeline_set_cull_face_mode (back_pipeline,
- COGL_PIPELINE_CULL_FACE_MODE_FRONT);
-
-
- back_node = clutter_pipeline_node_new (back_pipeline);
- clutter_paint_node_set_static_name (back_node,
- "ClutterDeformEffect (back)");
- clutter_paint_node_add_child (node, back_node);
- clutter_paint_node_add_primitive (back_node, priv->primitive);
-
- clutter_paint_node_unref (back_node);
- cogl_object_unref (back_pipeline);
- }
-
- if (G_UNLIKELY (priv->lines_primitive != NULL))
- {
- const ClutterColor *red;
- ClutterPaintNode *lines_node;
-
- red = clutter_color_get_static (CLUTTER_COLOR_RED);
-
- lines_node = clutter_color_node_new (red);
- clutter_paint_node_set_static_name (lines_node,
- "ClutterDeformEffect (lines)");
- clutter_paint_node_add_child (node, lines_node);
- clutter_paint_node_add_primitive (lines_node, priv->lines_primitive);
- clutter_paint_node_unref (lines_node);
- }
-}
-
-static inline void
-clutter_deform_effect_free_arrays (ClutterDeformEffect *self)
-{
- ClutterDeformEffectPrivate *priv = self->priv;
-
- if (priv->buffer)
- {
- cogl_object_unref (priv->buffer);
- priv->buffer = NULL;
- }
-
- if (priv->primitive)
- {
- cogl_object_unref (priv->primitive);
- priv->primitive = NULL;
- }
-
- if (priv->lines_primitive)
- {
- cogl_object_unref (priv->lines_primitive);
- priv->lines_primitive = NULL;
- }
-}
-
-static void
-clutter_deform_effect_init_arrays (ClutterDeformEffect *self)
-{
- ClutterDeformEffectPrivate *priv = self->priv;
- gint x, y, direction, n_indices;
- CoglAttribute *attributes[3];
- guint16 *static_indices;
- CoglContext *ctx =
- clutter_backend_get_cogl_context (clutter_get_default_backend ());
- CoglIndices *indices;
- guint16 *idx;
- int i;
-
- clutter_deform_effect_free_arrays (self);
-
- n_indices = ((2 + 2 * priv->x_tiles)
- * priv->y_tiles
- + (priv->y_tiles - 1));
-
- static_indices = g_new (guint16, n_indices);
-
-#define MESH_INDEX(x,y) ((y) * (priv->x_tiles + 1) + (x))
-
- /* compute all the triangles from the various tiles */
- direction = 1;
-
- idx = static_indices;
- idx[0] = MESH_INDEX (0, 0);
- idx[1] = MESH_INDEX (0, 1);
- idx += 2;
-
- for (y = 0; y < priv->y_tiles; y++)
- {
- for (x = 0; x < priv->x_tiles; x++)
- {
- if (direction)
- {
- idx[0] = MESH_INDEX (x + 1, y);
- idx[1] = MESH_INDEX (x + 1, y + 1);
- }
- else
- {
- idx[0] = MESH_INDEX (priv->x_tiles - x - 1, y);
- idx[1] = MESH_INDEX (priv->x_tiles - x - 1, y + 1);
- }
-
- idx += 2;
- }
-
- if (y == (priv->y_tiles - 1))
- break;
-
- if (direction)
- {
- idx[0] = MESH_INDEX (priv->x_tiles, y + 1);
- idx[1] = MESH_INDEX (priv->x_tiles, y + 1);
- idx[2] = MESH_INDEX (priv->x_tiles, y + 2);
- }
- else
- {
- idx[0] = MESH_INDEX (0, y + 1);
- idx[1] = MESH_INDEX (0, y + 1);
- idx[2] = MESH_INDEX (0, y + 2);
- }
-
- idx += 3;
-
- direction = !direction;
- }
-
-#undef MESH_INDEX
-
- indices = cogl_indices_new (ctx,
- COGL_INDICES_TYPE_UNSIGNED_SHORT,
- static_indices,
- n_indices);
-
- g_free (static_indices);
-
- priv->n_vertices = (priv->x_tiles + 1) * (priv->y_tiles + 1);
-
- priv->buffer =
- cogl_attribute_buffer_new (ctx,
- sizeof (CoglVertexP3T2C4) *
- priv->n_vertices,
- NULL);
-
- /* The application is expected to continuously modify the vertices
- so we should give a hint to Cogl about that */
- cogl_buffer_set_update_hint (COGL_BUFFER (priv->buffer),
- COGL_BUFFER_UPDATE_HINT_DYNAMIC);
-
- attributes[0] = cogl_attribute_new (priv->buffer,
- "cogl_position_in",
- sizeof (CoglVertexP3T2C4),
- G_STRUCT_OFFSET (CoglVertexP3T2C4, x),
- 3, /* n_components */
- COGL_ATTRIBUTE_TYPE_FLOAT);
- attributes[1] = cogl_attribute_new (priv->buffer,
- "cogl_tex_coord0_in",
- sizeof (CoglVertexP3T2C4),
- G_STRUCT_OFFSET (CoglVertexP3T2C4, s),
- 2, /* n_components */
- COGL_ATTRIBUTE_TYPE_FLOAT);
- attributes[2] = cogl_attribute_new (priv->buffer,
- "cogl_color_in",
- sizeof (CoglVertexP3T2C4),
- G_STRUCT_OFFSET (CoglVertexP3T2C4, r),
- 4, /* n_components */
- COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE);
-
- priv->primitive =
- cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_TRIANGLE_STRIP,
- priv->n_vertices,
- attributes,
- 3 /* n_attributes */);
- cogl_primitive_set_indices (priv->primitive,
- indices,
- n_indices);
-
- if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_DEFORM_TILES))
- {
- priv->lines_primitive =
- cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_LINE_STRIP,
- priv->n_vertices,
- attributes,
- 2 /* n_attributes */);
- cogl_primitive_set_indices (priv->lines_primitive,
- indices,
- n_indices);
- }
-
- cogl_object_unref (indices);
-
- for (i = 0; i < 3; i++)
- cogl_object_unref (attributes[i]);
-
- priv->is_dirty = TRUE;
-}
-
-static inline void
-clutter_deform_effect_free_back_pipeline (ClutterDeformEffect *self)
-{
- ClutterDeformEffectPrivate *priv = self->priv;
-
- if (priv->back_pipeline != NULL)
- {
- cogl_object_unref (priv->back_pipeline);
- priv->back_pipeline = NULL;
- }
-}
-
-static void
-clutter_deform_effect_finalize (GObject *gobject)
-{
- ClutterDeformEffect *self = CLUTTER_DEFORM_EFFECT (gobject);
-
- clutter_deform_effect_free_arrays (self);
- clutter_deform_effect_free_back_pipeline (self);
-
- G_OBJECT_CLASS (clutter_deform_effect_parent_class)->finalize (gobject);
-}
-
-static void
-clutter_deform_effect_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterDeformEffect *self = CLUTTER_DEFORM_EFFECT (gobject);
-
- switch (prop_id)
- {
- case PROP_X_TILES:
- clutter_deform_effect_set_n_tiles (self, g_value_get_uint (value),
- self->priv->y_tiles);
- break;
-
- case PROP_Y_TILES:
- clutter_deform_effect_set_n_tiles (self, self->priv->x_tiles,
- g_value_get_uint (value));
- break;
-
- case PROP_BACK_MATERIAL:
- clutter_deform_effect_set_back_material (self, g_value_get_boxed (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_deform_effect_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterDeformEffectPrivate *priv = CLUTTER_DEFORM_EFFECT (gobject)->priv;
-
- switch (prop_id)
- {
- case PROP_X_TILES:
- g_value_set_uint (value, priv->x_tiles);
- break;
-
- case PROP_Y_TILES:
- g_value_set_uint (value, priv->y_tiles);
- break;
-
- case PROP_BACK_MATERIAL:
- g_value_set_boxed (value, priv->back_pipeline);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_deform_effect_class_init (ClutterDeformEffectClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
- ClutterOffscreenEffectClass *offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass);
-
- klass->deform_vertex = clutter_deform_effect_real_deform_vertex;
-
- /**
- * ClutterDeformEffect:x-tiles:
- *
- * The number of horizontal tiles. The bigger the number, the
- * smaller the tiles
- *
- * Since: 1.4
- */
- obj_props[PROP_X_TILES] =
- g_param_spec_uint ("x-tiles",
- P_("Horizontal Tiles"),
- P_("The number of horizontal tiles"),
- 1, G_MAXUINT,
- DEFAULT_N_TILES,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterDeformEffect:y-tiles:
- *
- * The number of vertical tiles. The bigger the number, the
- * smaller the tiles
- *
- * Since: 1.4
- */
- obj_props[PROP_Y_TILES] =
- g_param_spec_uint ("y-tiles",
- P_("Vertical Tiles"),
- P_("The number of vertical tiles"),
- 1, G_MAXUINT,
- DEFAULT_N_TILES,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterDeformEffect:back-material:
- *
- * A material to be used when painting the back of the actor
- * to which this effect has been applied
- *
- * By default, no material will be used
- *
- * Since: 1.4
- */
- obj_props[PROP_BACK_MATERIAL] =
- g_param_spec_boxed ("back-material",
- P_("Back Material"),
- P_("The material to be used when painting the back of the actor"),
- COGL_TYPE_HANDLE,
- CLUTTER_PARAM_READWRITE);
-
- gobject_class->finalize = clutter_deform_effect_finalize;
- gobject_class->set_property = clutter_deform_effect_set_property;
- gobject_class->get_property = clutter_deform_effect_get_property;
- g_object_class_install_properties (gobject_class,
- PROP_LAST,
- obj_props);
-
- meta_class->set_actor = clutter_deform_effect_set_actor;
-
- offscreen_class->paint_target = clutter_deform_effect_paint_target;
-}
-
-static void
-clutter_deform_effect_init (ClutterDeformEffect *self)
-{
- self->priv = clutter_deform_effect_get_instance_private (self);
- self->priv->x_tiles = self->priv->y_tiles = DEFAULT_N_TILES;
- self->priv->back_pipeline = NULL;
-
- clutter_deform_effect_init_arrays (self);
-}
-
-/**
- * clutter_deform_effect_set_back_material:
- * @effect: a #ClutterDeformEffect
- * @material: (allow-none): a handle to a Cogl material
- *
- * Sets the material that should be used when drawing the back face
- * of the actor during a deformation
- *
- * The #ClutterDeformEffect will take a reference on the material's
- * handle
- *
- * Since: 1.4
- */
-void
-clutter_deform_effect_set_back_material (ClutterDeformEffect *effect,
- CoglHandle material)
-{
- ClutterDeformEffectPrivate *priv;
- CoglPipeline *pipeline = COGL_PIPELINE (material);
-
- g_return_if_fail (CLUTTER_IS_DEFORM_EFFECT (effect));
- g_return_if_fail (pipeline == NULL || cogl_is_pipeline (pipeline));
-
- priv = effect->priv;
-
- clutter_deform_effect_free_back_pipeline (effect);
-
- priv->back_pipeline = material;
- if (priv->back_pipeline != NULL)
- cogl_object_ref (priv->back_pipeline);
-
- clutter_deform_effect_invalidate (effect);
-}
-
-/**
- * clutter_deform_effect_get_back_material:
- * @effect: a #ClutterDeformEffect
- *
- * Retrieves the handle to the back face material used by @effect
- *
- * Return value: (transfer none): a handle for the material, or %NULL.
- * The returned material is owned by the #ClutterDeformEffect and it
- * should not be freed directly
- *
- * Since: 1.4
- */
-CoglHandle
-clutter_deform_effect_get_back_material (ClutterDeformEffect *effect)
-{
- g_return_val_if_fail (CLUTTER_IS_DEFORM_EFFECT (effect), NULL);
-
- return effect->priv->back_pipeline;
-}
-
-/**
- * clutter_deform_effect_set_n_tiles:
- * @effect: a #ClutterDeformEffect
- * @x_tiles: number of horizontal tiles
- * @y_tiles: number of vertical tiles
- *
- * Sets the number of horizontal and vertical tiles to be used
- * when applying the effect
- *
- * More tiles allow a finer grained deformation at the expenses
- * of computation
- *
- * Since: 1.4
- */
-void
-clutter_deform_effect_set_n_tiles (ClutterDeformEffect *effect,
- guint x_tiles,
- guint y_tiles)
-{
- ClutterDeformEffectPrivate *priv;
- gboolean tiles_changed = FALSE;
-
- g_return_if_fail (CLUTTER_IS_DEFORM_EFFECT (effect));
- g_return_if_fail (x_tiles > 0 && y_tiles > 0);
-
- priv = effect->priv;
-
- g_object_freeze_notify (G_OBJECT (effect));
-
- if (priv->x_tiles != x_tiles)
- {
- priv->x_tiles = x_tiles;
-
- g_object_notify_by_pspec (G_OBJECT (effect), obj_props[PROP_X_TILES]);
-
- tiles_changed = TRUE;
- }
-
- if (priv->y_tiles != y_tiles)
- {
- priv->y_tiles = y_tiles;
-
- g_object_notify_by_pspec (G_OBJECT (effect), obj_props[PROP_Y_TILES]);
-
- tiles_changed = TRUE;
- }
-
- if (tiles_changed)
- {
- clutter_deform_effect_init_arrays (effect);
- clutter_deform_effect_invalidate (effect);
- }
-
- g_object_thaw_notify (G_OBJECT (effect));
-}
-
-/**
- * clutter_deform_effect_get_n_tiles:
- * @effect: a #ClutterDeformEffect
- * @x_tiles: (out): return location for the number of horizontal tiles,
- * or %NULL
- * @y_tiles: (out): return location for the number of vertical tiles,
- * or %NULL
- *
- * Retrieves the number of horizontal and vertical tiles used to sub-divide
- * the actor's geometry during the effect
- *
- * Since: 1.4
- */
-void
-clutter_deform_effect_get_n_tiles (ClutterDeformEffect *effect,
- guint *x_tiles,
- guint *y_tiles)
-{
- g_return_if_fail (CLUTTER_IS_DEFORM_EFFECT (effect));
-
- if (x_tiles != NULL)
- *x_tiles = effect->priv->x_tiles;
-
- if (y_tiles != NULL)
- *y_tiles = effect->priv->y_tiles;
-}
-
-/**
- * clutter_deform_effect_invalidate:
- * @effect: a #ClutterDeformEffect
- *
- * Invalidates the @effect<!-- -->'s vertices and, if it is associated
- * to an actor, it will queue a redraw
- *
- * Since: 1.4
- */
-void
-clutter_deform_effect_invalidate (ClutterDeformEffect *effect)
-{
- ClutterActor *actor;
-
- g_return_if_fail (CLUTTER_IS_DEFORM_EFFECT (effect));
-
- if (effect->priv->is_dirty)
- return;
-
- effect->priv->is_dirty = TRUE;
-
- actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (effect));
- if (actor != NULL)
- clutter_effect_queue_repaint (CLUTTER_EFFECT (effect));
-}
diff --git a/clutter/clutter/clutter-deform-effect.h b/clutter/clutter/clutter-deform-effect.h
deleted file mode 100644
index bc0fa210d..000000000
--- a/clutter/clutter/clutter-deform-effect.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_DEFORM_EFFECT_H__
-#define __CLUTTER_DEFORM_EFFECT_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <cogl/cogl.h>
-#include <clutter/clutter-offscreen-effect.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_DEFORM_EFFECT (clutter_deform_effect_get_type ())
-#define CLUTTER_DEFORM_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_DEFORM_EFFECT, ClutterDeformEffect))
-#define CLUTTER_IS_DEFORM_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_DEFORM_EFFECT))
-#define CLUTTER_DEFORM_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_DEFORM_EFFECT, ClutterDeformEffectClass))
-#define CLUTTER_IS_DEFORM_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_DEFORM_EFFECT))
-#define CLUTTER_DEFORM_EFFECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_DEFORM_EFFECT, ClutterDeformEffectClass))
-
-typedef struct _ClutterDeformEffect ClutterDeformEffect;
-typedef struct _ClutterDeformEffectPrivate ClutterDeformEffectPrivate;
-typedef struct _ClutterDeformEffectClass ClutterDeformEffectClass;
-
-/**
- * ClutterDeformEffect:
- *
- * The #ClutterDeformEffect structure contains
- * only private data and should be accessed using the provided API
- *
- * Since: 1.4
- */
-struct _ClutterDeformEffect
-{
- /*< private >*/
- ClutterOffscreenEffect parent_instance;
-
- ClutterDeformEffectPrivate *priv;
-};
-
-/**
- * ClutterDeformEffectClass:
- * @deform_vertex: virtual function; sub-classes should override this
- * function to compute the deformation of each vertex
- *
- * The #ClutterDeformEffectClass structure contains
- * only private data
- *
- * Since: 1.4
- */
-struct _ClutterDeformEffectClass
-{
- /*< private >*/
- ClutterOffscreenEffectClass parent_class;
-
- /*< public >*/
- void (* deform_vertex) (ClutterDeformEffect *effect,
- gfloat width,
- gfloat height,
- CoglTextureVertex *vertex);
-
- /*< private >*/
- void (*_clutter_deform1) (void);
- void (*_clutter_deform2) (void);
- void (*_clutter_deform3) (void);
- void (*_clutter_deform4) (void);
- void (*_clutter_deform5) (void);
- void (*_clutter_deform6) (void);
- void (*_clutter_deform7) (void);
-};
-
-CLUTTER_EXPORT
-GType clutter_deform_effect_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-void clutter_deform_effect_set_back_material (ClutterDeformEffect *effect,
- CoglHandle material);
-CLUTTER_EXPORT
-CoglHandle clutter_deform_effect_get_back_material (ClutterDeformEffect *effect);
-CLUTTER_EXPORT
-void clutter_deform_effect_set_n_tiles (ClutterDeformEffect *effect,
- guint x_tiles,
- guint y_tiles);
-CLUTTER_EXPORT
-void clutter_deform_effect_get_n_tiles (ClutterDeformEffect *effect,
- guint *x_tiles,
- guint *y_tiles);
-
-CLUTTER_EXPORT
-void clutter_deform_effect_invalidate (ClutterDeformEffect *effect);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_DEFORM_EFFECT_H__ */
diff --git a/clutter/clutter/clutter-deprecated.h b/clutter/clutter/clutter-deprecated.h
deleted file mode 100644
index 8d790660c..000000000
--- a/clutter/clutter/clutter-deprecated.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef __CLUTTER_DEPRECATED_H__
-#define __CLUTTER_DEPRECATED_H__
-
-#define __CLUTTER_DEPRECATED_H_INSIDE__
-
-#include "deprecated/clutter-container.h"
-
-#undef __CLUTTER_DEPRECATED_H_INSIDE__
-
-#endif /* __CLUTTER_DEPRECATED_H__ */
diff --git a/clutter/clutter/clutter-desaturate-effect.c b/clutter/clutter/clutter-desaturate-effect.c
deleted file mode 100644
index 4ac60d0e0..000000000
--- a/clutter/clutter/clutter-desaturate-effect.c
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-desaturate-effect
- * @short_description: A desaturation effect
- * @see_also: #ClutterEffect, #ClutterOffscreenEffect
- *
- * #ClutterDesaturateEffect is a sub-class of #ClutterEffect that
- * desaturates the color of an actor and its contents. The strength
- * of the desaturation effect is controllable and animatable through
- * the #ClutterDesaturateEffect:factor property.
- *
- * #ClutterDesaturateEffect is available since Clutter 1.4
- */
-
-#define CLUTTER_DESATURATE_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_DESATURATE_EFFECT, ClutterDesaturateEffectClass))
-#define CLUTTER_IS_DESATURATE_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_DESATURATE_EFFECT))
-#define CLUTTER_DESATURATE_EFFECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_DESATURATE_EFFECT, ClutterDesaturateEffectClass))
-
-#include "clutter-build-config.h"
-
-#include <math.h>
-
-#include "clutter-desaturate-effect.h"
-
-#include "cogl/cogl.h"
-
-#include "clutter-debug.h"
-#include "clutter-enum-types.h"
-#include "clutter-offscreen-effect.h"
-#include "clutter-private.h"
-
-struct _ClutterDesaturateEffect
-{
- ClutterOffscreenEffect parent_instance;
-
- /* the desaturation factor, also known as "strength" */
- gdouble factor;
-
- gint factor_uniform;
-
- gint tex_width;
- gint tex_height;
-
- CoglPipeline *pipeline;
-};
-
-struct _ClutterDesaturateEffectClass
-{
- ClutterOffscreenEffectClass parent_class;
-
- CoglPipeline *base_pipeline;
-};
-
-/* the magic gray vec3 has been taken from the NTSC conversion weights
- * as defined by:
- *
- * "OpenGL Superbible, 4th edition"
- * -- Richard S. Wright Jr, Benjamin Lipchak, Nicholas Haemel
- * Addison-Wesley
- */
-static const gchar *desaturate_glsl_declarations =
- "uniform float factor;\n"
- "\n"
- "vec3 desaturate (const vec3 color, const float desaturation)\n"
- "{\n"
- " const vec3 gray_conv = vec3 (0.299, 0.587, 0.114);\n"
- " vec3 gray = vec3 (dot (gray_conv, color));\n"
- " return vec3 (mix (color.rgb, gray, desaturation));\n"
- "}\n";
-
-static const gchar *desaturate_glsl_source =
- " cogl_color_out.rgb = desaturate (cogl_color_out.rgb, factor);\n";
-
-enum
-{
- PROP_0,
-
- PROP_FACTOR,
-
- PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST];
-
-G_DEFINE_TYPE (ClutterDesaturateEffect,
- clutter_desaturate_effect,
- CLUTTER_TYPE_OFFSCREEN_EFFECT);
-
-static CoglPipeline *
-clutter_desaturate_effect_create_pipeline (ClutterOffscreenEffect *effect,
- CoglTexture *texture)
-{
- ClutterDesaturateEffect *desaturate_effect =
- CLUTTER_DESATURATE_EFFECT (effect);
-
- cogl_pipeline_set_layer_texture (desaturate_effect->pipeline, 0, texture);
-
- return cogl_object_ref (desaturate_effect->pipeline);
-}
-
-static gboolean
-clutter_desaturate_effect_pre_paint (ClutterEffect *effect,
- ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- ClutterEffectClass *parent_class;
-
- if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
- {
- /* if we don't have support for GLSL shaders then we
- * forcibly disable the ActorMeta
- */
- g_warning ("Unable to use the ShaderEffect: the graphics hardware "
- "or the current GL driver does not implement support "
- "for the GLSL shading language.");
- clutter_actor_meta_set_enabled (CLUTTER_ACTOR_META (effect), FALSE);
- return FALSE;
- }
-
- parent_class = CLUTTER_EFFECT_CLASS (clutter_desaturate_effect_parent_class);
- return parent_class->pre_paint (effect, node, paint_context);
-}
-
-static void
-clutter_desaturate_effect_dispose (GObject *gobject)
-{
- ClutterDesaturateEffect *self = CLUTTER_DESATURATE_EFFECT (gobject);
-
- if (self->pipeline != NULL)
- {
- cogl_object_unref (self->pipeline);
- self->pipeline = NULL;
- }
-
- G_OBJECT_CLASS (clutter_desaturate_effect_parent_class)->dispose (gobject);
-}
-
-static void
-clutter_desaturate_effect_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterDesaturateEffect *effect = CLUTTER_DESATURATE_EFFECT (gobject);
-
- switch (prop_id)
- {
- case PROP_FACTOR:
- clutter_desaturate_effect_set_factor (effect,
- g_value_get_double (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_desaturate_effect_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterDesaturateEffect *effect = CLUTTER_DESATURATE_EFFECT (gobject);
-
- switch (prop_id)
- {
- case PROP_FACTOR:
- g_value_set_double (value, effect->factor);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-update_factor_uniform (ClutterDesaturateEffect *self)
-{
- if (self->factor_uniform > -1)
- cogl_pipeline_set_uniform_1f (self->pipeline,
- self->factor_uniform,
- self->factor);
-}
-
-static void
-clutter_desaturate_effect_class_init (ClutterDesaturateEffectClass *klass)
-{
- ClutterEffectClass *effect_class = CLUTTER_EFFECT_CLASS (klass);
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- ClutterOffscreenEffectClass *offscreen_class;
-
- offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass);
- offscreen_class->create_pipeline = clutter_desaturate_effect_create_pipeline;
-
- effect_class->pre_paint = clutter_desaturate_effect_pre_paint;
-
- /**
- * ClutterDesaturateEffect:factor:
- *
- * The desaturation factor, between 0.0 (no desaturation) and 1.0 (full
- * desaturation).
- *
- * Since: 1.4
- */
- obj_props[PROP_FACTOR] =
- g_param_spec_double ("factor",
- P_("Factor"),
- P_("The desaturation factor"),
- 0.0, 1.0,
- 1.0,
- CLUTTER_PARAM_READWRITE);
-
- gobject_class->dispose = clutter_desaturate_effect_dispose;
- gobject_class->set_property = clutter_desaturate_effect_set_property;
- gobject_class->get_property = clutter_desaturate_effect_get_property;
-
- g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
-}
-
-static void
-clutter_desaturate_effect_init (ClutterDesaturateEffect *self)
-{
- ClutterDesaturateEffectClass *klass = CLUTTER_DESATURATE_EFFECT_GET_CLASS (self);
-
- if (G_UNLIKELY (klass->base_pipeline == NULL))
- {
- CoglContext *ctx =
- clutter_backend_get_cogl_context (clutter_get_default_backend ());
- CoglSnippet *snippet;
-
- klass->base_pipeline = cogl_pipeline_new (ctx);
-
- snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT,
- desaturate_glsl_declarations,
- desaturate_glsl_source);
- cogl_pipeline_add_snippet (klass->base_pipeline, snippet);
- cogl_object_unref (snippet);
-
- cogl_pipeline_set_layer_null_texture (klass->base_pipeline, 0);
- }
-
- self->pipeline = cogl_pipeline_copy (klass->base_pipeline);
-
- self->factor_uniform =
- cogl_pipeline_get_uniform_location (self->pipeline, "factor");
-
- self->factor = 1.0;
-
- update_factor_uniform (self);
-}
-
-/**
- * clutter_desaturate_effect_new:
- * @factor: the desaturation factor, between 0.0 and 1.0
- *
- * Creates a new #ClutterDesaturateEffect to be used with
- * clutter_actor_add_effect()
- *
- * Return value: the newly created #ClutterDesaturateEffect or %NULL
- *
- * Since: 1.4
- */
-ClutterEffect *
-clutter_desaturate_effect_new (gdouble factor)
-{
- g_return_val_if_fail (factor >= 0.0 && factor <= 1.0, NULL);
-
- return g_object_new (CLUTTER_TYPE_DESATURATE_EFFECT,
- "factor", factor,
- NULL);
-}
-
-/**
- * clutter_desaturate_effect_set_factor:
- * @effect: a #ClutterDesaturateEffect
- * @factor: the desaturation factor, between 0.0 and 1.0
- *
- * Sets the desaturation factor for @effect, with 0.0 being "do not desaturate"
- * and 1.0 being "fully desaturate"
- *
- * Since: 1.4
- */
-void
-clutter_desaturate_effect_set_factor (ClutterDesaturateEffect *effect,
- gdouble factor)
-{
- g_return_if_fail (CLUTTER_IS_DESATURATE_EFFECT (effect));
- g_return_if_fail (factor >= 0.0 && factor <= 1.0);
-
- if (fabsf (effect->factor - factor) >= 0.00001)
- {
- effect->factor = factor;
- update_factor_uniform (effect);
-
- clutter_effect_queue_repaint (CLUTTER_EFFECT (effect));
-
- g_object_notify_by_pspec (G_OBJECT (effect), obj_props[PROP_FACTOR]);
- }
-}
-
-/**
- * clutter_desaturate_effect_get_factor:
- * @effect: a #ClutterDesaturateEffect
- *
- * Retrieves the desaturation factor of @effect
- *
- * Return value: the desaturation factor
- *
- * Since: 1.4
- */
-gdouble
-clutter_desaturate_effect_get_factor (ClutterDesaturateEffect *effect)
-{
- g_return_val_if_fail (CLUTTER_IS_DESATURATE_EFFECT (effect), 0.0);
-
- return effect->factor;
-}
diff --git a/clutter/clutter/clutter-desaturate-effect.h b/clutter/clutter/clutter-desaturate-effect.h
deleted file mode 100644
index b832dbaca..000000000
--- a/clutter/clutter/clutter-desaturate-effect.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_DESATURATE_EFFECT_H__
-#define __CLUTTER_DESATURATE_EFFECT_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-effect.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_DESATURATE_EFFECT (clutter_desaturate_effect_get_type ())
-#define CLUTTER_DESATURATE_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_DESATURATE_EFFECT, ClutterDesaturateEffect))
-#define CLUTTER_IS_DESATURATE_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_DESATURATE_EFFECT))
-
-/**
- * ClutterDesaturateEffect:
- *
- * #ClutterDesaturateEffect is an opaque structure
- * whose members cannot be directly accessed
- *
- * Since: 1.4
- */
-typedef struct _ClutterDesaturateEffect ClutterDesaturateEffect;
-typedef struct _ClutterDesaturateEffectClass ClutterDesaturateEffectClass;
-
-CLUTTER_EXPORT
-GType clutter_desaturate_effect_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterEffect *clutter_desaturate_effect_new (gdouble factor);
-
-CLUTTER_EXPORT
-void clutter_desaturate_effect_set_factor (ClutterDesaturateEffect *effect,
- gdouble factor);
-CLUTTER_EXPORT
-gdouble clutter_desaturate_effect_get_factor (ClutterDesaturateEffect *effect);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_DESATURATE_EFFECT_H__ */
diff --git a/clutter/clutter/clutter-easing.c b/clutter/clutter/clutter-easing.c
deleted file mode 100644
index 544994d46..000000000
--- a/clutter/clutter/clutter-easing.c
+++ /dev/null
@@ -1,555 +0,0 @@
-#include "clutter-build-config.h"
-
-#include "clutter-easing.h"
-
-#include <math.h>
-
-double
-clutter_linear (double t,
- double d)
-{
- return t / d;
-}
-
-double
-clutter_ease_in_quad (double t,
- double d)
-{
- double p = t / d;
-
- return p * p;
-}
-
-double
-clutter_ease_out_quad (double t,
- double d)
-{
- double p = t / d;
-
- return -1.0 * p * (p - 2);
-}
-
-double
-clutter_ease_in_out_quad (double t,
- double d)
-{
- double p = t / (d / 2);
-
- if (p < 1)
- return 0.5 * p * p;
-
- p -= 1;
-
- return -0.5 * (p * (p - 2) - 1);
-}
-
-double
-clutter_ease_in_cubic (double t,
- double d)
-{
- double p = t / d;
-
- return p * p * p;
-}
-
-double
-clutter_ease_out_cubic (double t,
- double d)
-{
- double p = t / d - 1;
-
- return p * p * p + 1;
-}
-
-double
-clutter_ease_in_out_cubic (double t,
- double d)
-{
- double p = t / (d / 2);
-
- if (p < 1)
- return 0.5 * p * p * p;
-
- p -= 2;
-
- return 0.5 * (p * p * p + 2);
-}
-
-double
-clutter_ease_in_quart (double t,
- double d)
-{
- double p = t / d;
-
- return p * p * p * p;
-}
-
-double
-clutter_ease_out_quart (double t,
- double d)
-{
- double p = t / d - 1;
-
- return -1.0 * (p * p * p * p - 1);
-}
-
-double
-clutter_ease_in_out_quart (double t,
- double d)
-{
- double p = t / (d / 2);
-
- if (p < 1)
- return 0.5 * p * p * p * p;
-
- p -= 2;
-
- return -0.5 * (p * p * p * p - 2);
-}
-
-double
-clutter_ease_in_quint (double t,
- double d)
- {
- double p = t / d;
-
- return p * p * p * p * p;
-}
-
-double
-clutter_ease_out_quint (double t,
- double d)
-{
- double p = t / d - 1;
-
- return p * p * p * p * p + 1;
-}
-
-double
-clutter_ease_in_out_quint (double t,
- double d)
-{
- double p = t / (d / 2);
-
- if (p < 1)
- return 0.5 * p * p * p * p * p;
-
- p -= 2;
-
- return 0.5 * (p * p * p * p * p + 2);
-}
-
-double
-clutter_ease_in_sine (double t,
- double d)
-{
- return -1.0 * cos (t / d * G_PI_2) + 1.0;
-}
-
-double
-clutter_ease_out_sine (double t,
- double d)
-{
- return sin (t / d * G_PI_2);
-}
-
-double
-clutter_ease_in_out_sine (double t,
- double d)
-{
- return -0.5 * (cos (G_PI * t / d) - 1);
-}
-
-double
-clutter_ease_in_expo (double t,
- double d)
-{
- return (t == 0) ? 0.0 : pow (2, 10 * (t / d - 1));
-}
-
-double
-clutter_ease_out_expo (double t,
- double d)
-{
- return (t == d) ? 1.0 : -pow (2, -10 * t / d) + 1;
-}
-
-double
-clutter_ease_in_out_expo (double t,
- double d)
-{
- double p;
-
- if (t == 0)
- return 0.0;
-
- if (t == d)
- return 1.0;
-
- p = t / (d / 2);
-
- if (p < 1)
- return 0.5 * pow (2, 10 * (p - 1));
-
- p -= 1;
-
- return 0.5 * (-pow (2, -10 * p) + 2);
-}
-
-double
-clutter_ease_in_circ (double t,
- double d)
-{
- double p = t / d;
-
- return -1.0 * (sqrt (1 - p * p) - 1);
-}
-
-double
-clutter_ease_out_circ (double t,
- double d)
-{
- double p = t / d - 1;
-
- return sqrt (1 - p * p);
-}
-
-double
-clutter_ease_in_out_circ (double t,
- double d)
-{
- double p = t / (d / 2);
-
- if (p < 1)
- return -0.5 * (sqrt (1 - p * p) - 1);
-
- p -= 2;
-
- return 0.5 * (sqrt (1 - p * p) + 1);
-}
-
-double
-clutter_ease_in_elastic (double t,
- double d)
-{
- double p = d * .3;
- double s = p / 4;
- double q = t / d;
-
- if (q == 1)
- return 1.0;
-
- q -= 1;
-
- return -(pow (2, 10 * q) * sin ((q * d - s) * (2 * G_PI) / p));
-}
-
-double
-clutter_ease_out_elastic (double t,
- double d)
-{
- double p = d * .3;
- double s = p / 4;
- double q = t / d;
-
- if (q == 1)
- return 1.0;
-
- return pow (2, -10 * q) * sin ((q * d - s) * (2 * G_PI) / p) + 1.0;
-}
-
-double
-clutter_ease_in_out_elastic (double t,
- double d)
-{
- double p = d * (.3 * 1.5);
- double s = p / 4;
- double q = t / (d / 2);
-
- if (q == 2)
- return 1.0;
-
- if (q < 1)
- {
- q -= 1;
-
- return -.5 * (pow (2, 10 * q) * sin ((q * d - s) * (2 * G_PI) / p));
- }
- else
- {
- q -= 1;
-
- return pow (2, -10 * q)
- * sin ((q * d - s) * (2 * G_PI) / p)
- * .5 + 1.0;
- }
-}
-
-double
-clutter_ease_in_back (double t,
- double d)
-{
- double p = t / d;
-
- return p * p * ((1.70158 + 1) * p - 1.70158);
-}
-
-double
-clutter_ease_out_back (double t,
- double d)
-{
- double p = t / d - 1;
-
- return p * p * ((1.70158 + 1) * p + 1.70158) + 1;
-}
-
-double
-clutter_ease_in_out_back (double t,
- double d)
-{
- double p = t / (d / 2);
- double s = 1.70158 * 1.525;
-
- if (p < 1)
- return 0.5 * (p * p * ((s + 1) * p - s));
-
- p -= 2;
-
- return 0.5 * (p * p * ((s + 1) * p + s) + 2);
-}
-
-static inline double
-ease_out_bounce_internal (double t,
- double d)
-{
- double p = t / d;
-
- if (p < (1 / 2.75))
- {
- return 7.5625 * p * p;
- }
- else if (p < (2 / 2.75))
- {
- p -= (1.5 / 2.75);
-
- return 7.5625 * p * p + .75;
- }
- else if (p < (2.5 / 2.75))
- {
- p -= (2.25 / 2.75);
-
- return 7.5625 * p * p + .9375;
- }
- else
- {
- p -= (2.625 / 2.75);
-
- return 7.5625 * p * p + .984375;
- }
-}
-
-static inline double
-ease_in_bounce_internal (double t,
- double d)
-{
- return 1.0 - ease_out_bounce_internal (d - t, d);
-}
-
-double
-clutter_ease_in_bounce (double t,
- double d)
-{
- return ease_in_bounce_internal (t, d);
-}
-
-double
-clutter_ease_out_bounce (double t,
- double d)
-{
- return ease_out_bounce_internal (t, d);
-}
-
-double
-clutter_ease_in_out_bounce (double t,
- double d)
-{
- if (t < d / 2)
- return ease_in_bounce_internal (t * 2, d) * 0.5;
- else
- return ease_out_bounce_internal (t * 2 - d, d) * 0.5 + 1.0 * 0.5;
-}
-
-static inline double
-ease_steps_end (double p,
- int n_steps)
-{
- return floor (p * (double) n_steps) / (double) n_steps;
-}
-
-double
-clutter_ease_steps_start (double t,
- double d,
- int n_steps)
-{
- return 1.0 - ease_steps_end (1.0 - (t / d), n_steps);
-}
-
-double
-clutter_ease_steps_end (double t,
- double d,
- int n_steps)
-{
- return ease_steps_end ((t / d), n_steps);
-}
-
-static inline double
-x_for_t (double t,
- double x_1,
- double x_2)
-{
- double omt = 1.0 - t;
-
- return 3.0 * omt * omt * t * x_1
- + 3.0 * omt * t * t * x_2
- + t * t * t;
-}
-
-static inline double
-y_for_t (double t,
- double y_1,
- double y_2)
-{
- double omt = 1.0 - t;
-
- return 3.0 * omt * omt * t * y_1
- + 3.0 * omt * t * t * y_2
- + t * t * t;
-}
-
-static inline double
-t_for_x (double x,
- double x_1,
- double x_2)
-{
- double min_t = 0, max_t = 1;
- int i;
-
- for (i = 0; i < 30; ++i)
- {
- double guess_t = (min_t + max_t) / 2.0;
- double guess_x = x_for_t (guess_t, x_1, x_2);
-
- if (x < guess_x)
- max_t = guess_t;
- else
- min_t = guess_t;
- }
-
- return (min_t + max_t) / 2.0;
-}
-
-double
-clutter_ease_cubic_bezier (double t,
- double d,
- double x_1,
- double y_1,
- double x_2,
- double y_2)
-{
- double p = t / d;
-
- if (p == 0.0)
- return 0.0;
-
- if (p == 1.0)
- return 1.0;
-
- return y_for_t (t_for_x (p, x_1, x_2), y_1, y_2);
-}
-
-/*< private >
- * _clutter_animation_modes:
- *
- * A mapping of animation modes and easing functions.
- */
-static const struct {
- ClutterAnimationMode mode;
- ClutterEasingFunc func;
- const char *name;
-} _clutter_animation_modes[] = {
- { CLUTTER_CUSTOM_MODE, NULL, "custom" },
-
- { CLUTTER_LINEAR, clutter_linear, "linear" },
- { CLUTTER_EASE_IN_QUAD, clutter_ease_in_quad, "easeInQuad" },
- { CLUTTER_EASE_OUT_QUAD, clutter_ease_out_quad, "easeOutQuad" },
- { CLUTTER_EASE_IN_OUT_QUAD, clutter_ease_in_out_quad, "easeInOutQuad" },
- { CLUTTER_EASE_IN_CUBIC, clutter_ease_in_cubic, "easeInCubic" },
- { CLUTTER_EASE_OUT_CUBIC, clutter_ease_out_cubic, "easeOutCubic" },
- { CLUTTER_EASE_IN_OUT_CUBIC, clutter_ease_in_out_cubic, "easeInOutCubic" },
- { CLUTTER_EASE_IN_QUART, clutter_ease_in_quart, "easeInQuart" },
- { CLUTTER_EASE_OUT_QUART, clutter_ease_out_quart, "easeOutQuart" },
- { CLUTTER_EASE_IN_OUT_QUART, clutter_ease_in_out_quart, "easeInOutQuart" },
- { CLUTTER_EASE_IN_QUINT, clutter_ease_in_quint, "easeInQuint" },
- { CLUTTER_EASE_OUT_QUINT, clutter_ease_out_quint, "easeOutQuint" },
- { CLUTTER_EASE_IN_OUT_QUINT, clutter_ease_in_out_quint, "easeInOutQuint" },
- { CLUTTER_EASE_IN_SINE, clutter_ease_in_sine, "easeInSine" },
- { CLUTTER_EASE_OUT_SINE, clutter_ease_out_sine, "easeOutSine" },
- { CLUTTER_EASE_IN_OUT_SINE, clutter_ease_in_out_sine, "easeInOutSine" },
- { CLUTTER_EASE_IN_EXPO, clutter_ease_in_expo, "easeInExpo" },
- { CLUTTER_EASE_OUT_EXPO, clutter_ease_out_expo, "easeOutExpo" },
- { CLUTTER_EASE_IN_OUT_EXPO, clutter_ease_in_out_expo, "easeInOutExpo" },
- { CLUTTER_EASE_IN_CIRC, clutter_ease_in_circ, "easeInCirc" },
- { CLUTTER_EASE_OUT_CIRC, clutter_ease_out_circ, "easeOutCirc" },
- { CLUTTER_EASE_IN_OUT_CIRC, clutter_ease_in_out_circ, "easeInOutCirc" },
- { CLUTTER_EASE_IN_ELASTIC, clutter_ease_in_elastic, "easeInElastic" },
- { CLUTTER_EASE_OUT_ELASTIC, clutter_ease_out_elastic, "easeOutElastic" },
- { CLUTTER_EASE_IN_OUT_ELASTIC, clutter_ease_in_out_elastic, "easeInOutElastic" },
- { CLUTTER_EASE_IN_BACK, clutter_ease_in_back, "easeInBack" },
- { CLUTTER_EASE_OUT_BACK, clutter_ease_out_back, "easeOutBack" },
- { CLUTTER_EASE_IN_OUT_BACK, clutter_ease_in_out_back, "easeInOutBack" },
- { CLUTTER_EASE_IN_BOUNCE, clutter_ease_in_bounce, "easeInBounce" },
- { CLUTTER_EASE_OUT_BOUNCE, clutter_ease_out_bounce, "easeOutBounce" },
- { CLUTTER_EASE_IN_OUT_BOUNCE, clutter_ease_in_out_bounce, "easeInOutBounce" },
-
- /* the parametrized functions need a cast */
- { CLUTTER_STEPS, (ClutterEasingFunc) clutter_ease_steps_end, "steps" },
- { CLUTTER_STEP_START, (ClutterEasingFunc) clutter_ease_steps_start, "stepStart" },
- { CLUTTER_STEP_END, (ClutterEasingFunc) clutter_ease_steps_end, "stepEnd" },
-
- { CLUTTER_CUBIC_BEZIER, (ClutterEasingFunc) clutter_ease_cubic_bezier, "cubicBezier" },
- { CLUTTER_EASE, (ClutterEasingFunc) clutter_ease_cubic_bezier, "ease" },
- { CLUTTER_EASE_IN, (ClutterEasingFunc) clutter_ease_cubic_bezier, "easeIn" },
- { CLUTTER_EASE_OUT, (ClutterEasingFunc) clutter_ease_cubic_bezier, "easeOut" },
- { CLUTTER_EASE_IN_OUT, (ClutterEasingFunc) clutter_ease_cubic_bezier, "easeInOut" },
-
- { CLUTTER_ANIMATION_LAST, NULL, "sentinel" },
-};
-
-ClutterEasingFunc
-clutter_get_easing_func_for_mode (ClutterAnimationMode mode)
-{
- g_assert (_clutter_animation_modes[mode].mode == mode);
- g_assert (_clutter_animation_modes[mode].func != NULL);
-
- return _clutter_animation_modes[mode].func;
-}
-
-const char *
-clutter_get_easing_name_for_mode (ClutterAnimationMode mode)
-{
- g_assert (_clutter_animation_modes[mode].mode == mode);
- g_assert (_clutter_animation_modes[mode].func != NULL);
-
- return _clutter_animation_modes[mode].name;
-}
-
-double
-clutter_easing_for_mode (ClutterAnimationMode mode,
- double t,
- double d)
-{
- g_assert (_clutter_animation_modes[mode].mode == mode);
- g_assert (_clutter_animation_modes[mode].func != NULL);
-
- return _clutter_animation_modes[mode].func (t, d);
-}
diff --git a/clutter/clutter/clutter-easing.h b/clutter/clutter/clutter-easing.h
deleted file mode 100644
index f7e6dccfb..000000000
--- a/clutter/clutter/clutter-easing.h
+++ /dev/null
@@ -1,142 +0,0 @@
-#ifndef __CLUTTER_EASING_H__
-#define __CLUTTER_EASING_H__
-
-#include <clutter/clutter-types.h>
-
-G_BEGIN_DECLS
-
-/*< private >
- * ClutterEasingFunc:
- * @t: elapsed time
- * @d: total duration
- *
- * Internal type for the easing functions used by Clutter.
- *
- * Return value: the interpolated value, between -1.0 and 2.0
- */
-typedef double (* ClutterEasingFunc) (double t, double d);
-
-G_GNUC_INTERNAL
-ClutterEasingFunc clutter_get_easing_func_for_mode (ClutterAnimationMode mode);
-
-G_GNUC_INTERNAL
-const char * clutter_get_easing_name_for_mode (ClutterAnimationMode mode);
-
-G_GNUC_INTERNAL
-double clutter_easing_for_mode (ClutterAnimationMode mode,
- double t,
- double d);
-
-G_GNUC_INTERNAL
-double clutter_linear (double t,
- double d);
-G_GNUC_INTERNAL
-double clutter_ease_in_quad (double t,
- double d);
-G_GNUC_INTERNAL
-double clutter_ease_out_quad (double t,
- double d);
-G_GNUC_INTERNAL
-double clutter_ease_in_out_quad (double t,
- double d);
-G_GNUC_INTERNAL
-double clutter_ease_in_cubic (double t,
- double d);
-G_GNUC_INTERNAL
-double clutter_ease_out_cubic (double t,
- double d);
-G_GNUC_INTERNAL
-double clutter_ease_in_out_cubic (double t,
- double d);
-G_GNUC_INTERNAL
-double clutter_ease_in_quart (double t,
- double d);
-G_GNUC_INTERNAL
-double clutter_ease_out_quart (double t,
- double d);
-G_GNUC_INTERNAL
-double clutter_ease_in_out_quart (double t,
- double d);
-G_GNUC_INTERNAL
-double clutter_ease_in_quint (double t,
- double d);
-G_GNUC_INTERNAL
-double clutter_ease_out_quint (double t,
- double d);
-G_GNUC_INTERNAL
-double clutter_ease_in_out_quint (double t,
- double d);
-G_GNUC_INTERNAL
-double clutter_ease_in_sine (double t,
- double d);
-G_GNUC_INTERNAL
-double clutter_ease_out_sine (double t,
- double d);
-G_GNUC_INTERNAL
-double clutter_ease_in_out_sine (double t,
- double d);
-G_GNUC_INTERNAL
-double clutter_ease_in_expo (double t,
- double d);
-G_GNUC_INTERNAL
-double clutter_ease_out_expo (double t,
- double d);
-G_GNUC_INTERNAL
-double clutter_ease_in_out_expo (double t,
- double d);
-G_GNUC_INTERNAL
-double clutter_ease_in_circ (double t,
- double d);
-G_GNUC_INTERNAL
-double clutter_ease_out_circ (double t,
- double d);
-G_GNUC_INTERNAL
-double clutter_ease_in_out_circ (double t,
- double d);
-G_GNUC_INTERNAL
-double clutter_ease_in_elastic (double t,
- double d);
-G_GNUC_INTERNAL
-double clutter_ease_out_elastic (double t,
- double d);
-G_GNUC_INTERNAL
-double clutter_ease_in_out_elastic (double t,
- double d);
-G_GNUC_INTERNAL
-double clutter_ease_in_back (double t,
- double d);
-G_GNUC_INTERNAL
-double clutter_ease_out_back (double t,
- double d);
-G_GNUC_INTERNAL
-double clutter_ease_in_out_back (double t,
- double d);
-G_GNUC_INTERNAL
-double clutter_ease_in_bounce (double t,
- double d);
-G_GNUC_INTERNAL
-double clutter_ease_out_bounce (double t,
- double d);
-G_GNUC_INTERNAL
-double clutter_ease_in_out_bounce (double t,
- double d);
-
-G_GNUC_INTERNAL
-double clutter_ease_steps_start (double t,
- double d,
- int steps);
-G_GNUC_INTERNAL
-double clutter_ease_steps_end (double t,
- double d,
- int steps);
-G_GNUC_INTERNAL
-double clutter_ease_cubic_bezier (double t,
- double d,
- double x_1,
- double y_1,
- double x_2,
- double y_2);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_EASING_H__ */
diff --git a/clutter/clutter/clutter-effect-private.h b/clutter/clutter/clutter-effect-private.h
deleted file mode 100644
index 85a32552f..000000000
--- a/clutter/clutter/clutter-effect-private.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef __CLUTTER_EFFECT_PRIVATE_H__
-#define __CLUTTER_EFFECT_PRIVATE_H__
-
-#include <clutter/clutter-effect.h>
-
-G_BEGIN_DECLS
-
-gboolean _clutter_effect_modify_paint_volume (ClutterEffect *effect,
- ClutterPaintVolume *volume);
-gboolean _clutter_effect_has_custom_paint_volume (ClutterEffect *effect);
-void _clutter_effect_paint (ClutterEffect *effect,
- ClutterPaintNode *node,
- ClutterPaintContext *paint_context,
- ClutterEffectPaintFlags flags);
-void _clutter_effect_pick (ClutterEffect *effect,
- ClutterPickContext *pick_context);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_EFFECT_PRIVATE_H__ */
diff --git a/clutter/clutter/clutter-effect.c b/clutter/clutter/clutter-effect.c
deleted file mode 100644
index 012037f61..000000000
--- a/clutter/clutter/clutter-effect.c
+++ /dev/null
@@ -1,397 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-effect
- * @short_description: Base class for actor effects
- *
- * The #ClutterEffect class provides a default type and API for creating
- * effects for generic actors.
- *
- * Effects are a #ClutterActorMeta sub-class that modify the way an actor
- * is painted in a way that is not part of the actor's implementation.
- *
- * Effects should be the preferred way to affect the paint sequence of an
- * actor without sub-classing the actor itself and overriding the
- * #ClutterActorClass.paint()_ virtual function.
- *
- * ## Implementing a ClutterEffect
- *
- * Creating a sub-class of #ClutterEffect requires overriding the
- * #ClutterEffectClass.paint() method. The implementation of the function should look
- * something like this:
- *
- * |[
- * void effect_paint (ClutterEffect *effect, ClutterEffectPaintFlags flags)
- * {
- * // Set up initialisation of the paint such as binding a
- * // CoglOffscreen or other operations
- *
- * // Chain to the next item in the paint sequence. This will either call
- * // ‘paint’ on the next effect or just paint the actor if this is
- * // the last effect.
- * ClutterActor *actor =
- * clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (effect));
- *
- * clutter_actor_continue_paint (actor);
- *
- * // perform any cleanup of state, such as popping the CoglOffscreen
- * }
- * ]|
- *
- * The effect can optionally avoid calling clutter_actor_continue_paint() to skip any
- * further stages of the paint sequence. This is useful for example if the effect
- * contains a cached image of the actor. In that case it can optimise painting by
- * avoiding the actor paint and instead painting the cached image.
- *
- * The %CLUTTER_EFFECT_PAINT_ACTOR_DIRTY flag is useful in this case. Clutter will set
- * this flag when a redraw has been queued on the actor since it was last painted. The
- * effect can use this information to decide if the cached image is still valid.
- *
- * ## A simple ClutterEffect implementation
- *
- * The example below creates two rectangles: one will be painted "behind" the actor,
- * while another will be painted "on top" of the actor.
- *
- * The #ClutterActorMetaClass.set_actor() implementation will create the two materials
- * used for the two different rectangles; the #ClutterEffectClass.paint() implementation
- * will paint the first material using cogl_rectangle(), before continuing and then it
- * will paint paint the second material after.
- *
- * |[
- * typedef struct {
- * ClutterEffect parent_instance;
- *
- * CoglHandle rect_1;
- * CoglHandle rect_2;
- * } MyEffect;
- *
- * typedef struct _ClutterEffectClass MyEffectClass;
- *
- * G_DEFINE_TYPE (MyEffect, my_effect, CLUTTER_TYPE_EFFECT);
- *
- * static void
- * my_effect_set_actor (ClutterActorMeta *meta,
- * ClutterActor *actor)
- * {
- * MyEffect *self = MY_EFFECT (meta);
- *
- * // Clear the previous state //
- * if (self->rect_1)
- * {
- * cogl_object_unref (self->rect_1);
- * self->rect_1 = NULL;
- * }
- *
- * if (self->rect_2)
- * {
- * cogl_object_unref (self->rect_2);
- * self->rect_2 = NULL;
- * }
- *
- * // Maintain a pointer to the actor
- * self->actor = actor;
- *
- * // If we've been detached by the actor then we should just bail out here
- * if (self->actor == NULL)
- * return;
- *
- * // Create a red material
- * self->rect_1 = cogl_material_new ();
- * cogl_material_set_color4f (self->rect_1, 1.0, 0.0, 0.0, 1.0);
- *
- * // Create a green material
- * self->rect_2 = cogl_material_new ();
- * cogl_material_set_color4f (self->rect_2, 0.0, 1.0, 0.0, 1.0);
- * }
- *
- * static gboolean
- * my_effect_paint (ClutterEffect *effect)
- * {
- * MyEffect *self = MY_EFFECT (effect);
- * gfloat width, height;
- *
- * clutter_actor_get_size (self->actor, &width, &height);
- *
- * // Paint the first rectangle in the upper left quadrant
- * cogl_set_source (self->rect_1);
- * cogl_rectangle (0, 0, width / 2, height / 2);
- *
- * // Continue to the rest of the paint sequence
- * clutter_actor_continue_paint (self->actor);
- *
- * // Paint the second rectangle in the lower right quadrant
- * cogl_set_source (self->rect_2);
- * cogl_rectangle (width / 2, height / 2, width, height);
- * }
- *
- * static void
- * my_effect_class_init (MyEffectClass *klass)
- * {
- * ClutterActorMetaClas *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
- *
- * meta_class->set_actor = my_effect_set_actor;
- *
- * klass->paint = my_effect_paint;
- * }
- * ]|
- *
- * #ClutterEffect is available since Clutter 1.4
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-effect.h"
-
-#include "clutter-actor-meta-private.h"
-#include "clutter-debug.h"
-#include "clutter-effect-private.h"
-#include "clutter-enum-types.h"
-#include "clutter-marshal.h"
-#include "clutter-paint-node-private.h"
-#include "clutter-paint-nodes.h"
-#include "clutter-private.h"
-#include "clutter-actor-private.h"
-
-G_DEFINE_ABSTRACT_TYPE (ClutterEffect,
- clutter_effect,
- CLUTTER_TYPE_ACTOR_META);
-
-static gboolean
-clutter_effect_real_pre_paint (ClutterEffect *effect,
- ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- return TRUE;
-}
-
-static void
-clutter_effect_real_post_paint (ClutterEffect *effect,
- ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
-}
-
-static gboolean
-clutter_effect_real_modify_paint_volume (ClutterEffect *effect,
- ClutterPaintVolume *volume)
-{
- return TRUE;
-}
-
-static void
-add_actor_node (ClutterEffect *effect,
- ClutterPaintNode *node)
-{
- ClutterPaintNode *actor_node;
- ClutterActor *actor;
-
- actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (effect));
-
- actor_node = clutter_actor_node_new (actor, -1);
- clutter_paint_node_add_child (node, actor_node);
- clutter_paint_node_unref (actor_node);
-}
-
-static void
-clutter_effect_real_paint_node (ClutterEffect *effect,
- ClutterPaintNode *node,
- ClutterPaintContext *paint_context,
- ClutterEffectPaintFlags flags)
-{
- add_actor_node (effect, node);
-}
-
-static void
-clutter_effect_real_paint (ClutterEffect *effect,
- ClutterPaintNode *node,
- ClutterPaintContext *paint_context,
- ClutterEffectPaintFlags flags)
-{
- ClutterEffectClass *effect_class = CLUTTER_EFFECT_GET_CLASS (effect);
- gboolean pre_paint_succeeded;
-
- /* The default implementation provides a compatibility wrapper for
- effects that haven't migrated to use the 'paint' virtual yet. This
- just calls the old pre and post virtuals before chaining on */
-
- pre_paint_succeeded = effect_class->pre_paint (effect, node,paint_context);
-
- if (pre_paint_succeeded)
- {
- effect_class->paint_node (effect, node, paint_context, flags);
- effect_class->post_paint (effect, node, paint_context);
- }
- else
- {
- /* Just paint the actor as fallback */
- add_actor_node (effect, node);
- }
-}
-
-static void
-clutter_effect_real_pick (ClutterEffect *effect,
- ClutterPickContext *pick_context)
-{
- ClutterActorMeta *actor_meta = CLUTTER_ACTOR_META (effect);
- ClutterActor *actor;
-
- actor = clutter_actor_meta_get_actor (actor_meta);
- clutter_actor_continue_pick (actor, pick_context);
-}
-
-static void
-clutter_effect_set_enabled (ClutterActorMeta *meta,
- gboolean is_enabled)
-{
- ClutterActorMetaClass *parent_class =
- CLUTTER_ACTOR_META_CLASS (clutter_effect_parent_class);
- ClutterActor *actor;
-
- actor = clutter_actor_meta_get_actor (meta);
- if (actor)
- clutter_actor_queue_redraw (actor);
-
- parent_class->set_enabled (meta, is_enabled);
-}
-
-static void
-clutter_effect_class_init (ClutterEffectClass *klass)
-{
- ClutterActorMetaClass *actor_meta_class = CLUTTER_ACTOR_META_CLASS (klass);
-
- actor_meta_class->set_enabled = clutter_effect_set_enabled;
-
- 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->paint = clutter_effect_real_paint;
- klass->paint_node = clutter_effect_real_paint_node;
- klass->pick = clutter_effect_real_pick;
-}
-
-static void
-clutter_effect_init (ClutterEffect *self)
-{
-}
-
-void
-_clutter_effect_paint (ClutterEffect *effect,
- ClutterPaintNode *node,
- ClutterPaintContext *paint_context,
- ClutterEffectPaintFlags flags)
-{
- g_return_if_fail (CLUTTER_IS_EFFECT (effect));
-
- CLUTTER_EFFECT_GET_CLASS (effect)->paint (effect,
- node,
- paint_context,
- flags);
-}
-
-void
-_clutter_effect_pick (ClutterEffect *effect,
- ClutterPickContext *pick_context)
-{
- g_return_if_fail (CLUTTER_IS_EFFECT (effect));
-
- CLUTTER_EFFECT_GET_CLASS (effect)->pick (effect, pick_context);
-}
-
-gboolean
-_clutter_effect_modify_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);
-}
-
-gboolean
-_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;
-}
-
-/**
- * clutter_effect_queue_repaint:
- * @effect: A #ClutterEffect which needs redrawing
- *
- * Queues a repaint of the effect. The effect can detect when the ‘paint’
- * method is called as a result of this function because it will not
- * have the %CLUTTER_EFFECT_PAINT_ACTOR_DIRTY flag set. In that case the
- * effect is free to assume that the actor has not changed its
- * appearance since the last time it was painted so it doesn't need to
- * call clutter_actor_continue_paint() if it can draw a cached
- * image. This is mostly intended for effects that are using a
- * %CoglOffscreen to redirect the actor (such as
- * %ClutterOffscreenEffect). In that case the effect can save a bit of
- * rendering time by painting the cached texture without causing the
- * entire actor to be painted.
- *
- * This function can be used by effects that have their own animatable
- * parameters. For example, an effect which adds a varying degree of a
- * red tint to an actor by redirecting it through a CoglOffscreen
- * might have a property to specify the level of tint. When this value
- * changes, the underlying actor doesn't need to be redrawn so the
- * effect can call clutter_effect_queue_repaint() to make sure the
- * effect is repainted.
- *
- * Note however that modifying the position of the parent of an actor
- * may change the appearance of the actor because its transformation
- * matrix would change. In this case a redraw wouldn't be queued on
- * the actor itself so the %CLUTTER_EFFECT_PAINT_ACTOR_DIRTY would still
- * not be set. The effect can detect this case by keeping track of the
- * last modelview matrix that was used to render the actor and
- * verifying that it remains the same in the next paint.
- *
- * Any other effects that are layered on top of the passed in effect
- * will still be passed the %CLUTTER_EFFECT_PAINT_ACTOR_DIRTY flag. If
- * anything queues a redraw on the actor without specifying an effect
- * or with an effect that is lower in the chain of effects than this
- * one then that will override this call. In that case this effect
- * will instead be called with the %CLUTTER_EFFECT_PAINT_ACTOR_DIRTY
- * flag set.
- *
- * Since: 1.8
- */
-void
-clutter_effect_queue_repaint (ClutterEffect *effect)
-{
- ClutterActor *actor;
-
- g_return_if_fail (CLUTTER_IS_EFFECT (effect));
-
- actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (effect));
-
- /* If the effect has no actor then nothing needs to be done */
- if (actor != NULL)
- _clutter_actor_queue_redraw_full (actor,
- NULL, /* clip volume */
- effect /* effect */);
-}
diff --git a/clutter/clutter/clutter-effect.h b/clutter/clutter/clutter-effect.h
deleted file mode 100644
index 8969fcd78..000000000
--- a/clutter/clutter/clutter-effect.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_EFFECT_H__
-#define __CLUTTER_EFFECT_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-actor-meta.h>
-#include <clutter/clutter-paint-context.h>
-#include <clutter/clutter-pick-context.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_EFFECT (clutter_effect_get_type ())
-#define CLUTTER_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_EFFECT, ClutterEffect))
-#define CLUTTER_IS_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_EFFECT))
-#define CLUTTER_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_EFFECT, ClutterEffectClass))
-#define CLUTTER_IS_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_EFFECT))
-#define CLUTTER_EFFECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_EFFECT, ClutterEffectClass))
-
-typedef struct _ClutterEffectClass ClutterEffectClass;
-
-/**
- * ClutterEffect:
- *
- * The #ClutterEffect structure contains only private data and should
- * be accessed using the provided API
- *
- * Since: 1.4
- */
-struct _ClutterEffect
-{
- /*< private >*/
- ClutterActorMeta parent_instance;
-};
-
-/**
- * ClutterEffectClass:
- * @pre_paint: virtual function
- * @post_paint: virtual function
- * @modify_paint_volume: virtual function
- * @paint: virtual function
- * @pick: virtual function
- *
- * The #ClutterEffectClass structure contains only private data
- *
- * Since: 1.4
- */
-struct _ClutterEffectClass
-{
- /*< private >*/
- ClutterActorMetaClass parent_class;
-
- /*< public >*/
- gboolean (* pre_paint) (ClutterEffect *effect,
- ClutterPaintNode *node,
- ClutterPaintContext *paint_context);
- void (* post_paint) (ClutterEffect *effect,
- ClutterPaintNode *node,
- ClutterPaintContext *paint_context);
-
- gboolean (* modify_paint_volume) (ClutterEffect *effect,
- ClutterPaintVolume *volume);
-
- void (* paint) (ClutterEffect *effect,
- ClutterPaintNode *node,
- ClutterPaintContext *paint_context,
- ClutterEffectPaintFlags flags);
- void (* paint_node) (ClutterEffect *effect,
- ClutterPaintNode *node,
- ClutterPaintContext *paint_context,
- ClutterEffectPaintFlags flags);
- void (* pick) (ClutterEffect *effect,
- ClutterPickContext *pick_context);
-
- /*< private >*/
- void (* _clutter_effect4) (void);
- void (* _clutter_effect5) (void);
- void (* _clutter_effect6) (void);
-};
-
-CLUTTER_EXPORT
-GType clutter_effect_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-void clutter_effect_queue_repaint (ClutterEffect *effect);
-
-/*
- * ClutterActor API
- */
-
-CLUTTER_EXPORT
-void clutter_actor_add_effect (ClutterActor *self,
- ClutterEffect *effect);
-CLUTTER_EXPORT
-void clutter_actor_add_effect_with_name (ClutterActor *self,
- const gchar *name,
- ClutterEffect *effect);
-CLUTTER_EXPORT
-void clutter_actor_remove_effect (ClutterActor *self,
- ClutterEffect *effect);
-CLUTTER_EXPORT
-void clutter_actor_remove_effect_by_name (ClutterActor *self,
- const gchar *name);
-CLUTTER_EXPORT
-GList * clutter_actor_get_effects (ClutterActor *self);
-CLUTTER_EXPORT
-ClutterEffect *clutter_actor_get_effect (ClutterActor *self,
- const gchar *name);
-CLUTTER_EXPORT
-void clutter_actor_clear_effects (ClutterActor *self);
-
-CLUTTER_EXPORT
-gboolean clutter_actor_has_effects (ClutterActor *self);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_EFFECT_H__ */
diff --git a/clutter/clutter/clutter-enum-types.c.in b/clutter/clutter/clutter-enum-types.c.in
deleted file mode 100644
index 9b6d778c4..000000000
--- a/clutter/clutter/clutter-enum-types.c.in
+++ /dev/null
@@ -1,40 +0,0 @@
-/*** BEGIN file-header ***/
-#include "clutter-build-config.h"
-#include "clutter-enum-types.h"
-/*** END file-header ***/
-
-/*** BEGIN file-production ***/
-
-/* enumerations from "@filename@" */
-#include "@filename@"
-
-/*** END file-production ***/
-
-/*** BEGIN value-header ***/
-GType
-@enum_name@_get_type (void)
-{
- static size_t g_enum_type_id = 0;
-
- if (g_once_init_enter (&g_enum_type_id))
- {
- static const G@Type@Value values[] = {
-/*** END value-header ***/
-
-/*** BEGIN value-production ***/
- { @VALUENAME@, "@VALUENAME@", "@valuenick@" },
-/*** END value-production ***/
-
-/*** BEGIN value-tail ***/
- { 0, NULL, NULL }
- };
- GType id;
-
- id = g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
-
- g_once_init_leave (&g_enum_type_id, id);
- }
-
- return g_enum_type_id;
-}
-/*** END value-tail ***/
diff --git a/clutter/clutter/clutter-enum-types.h.in b/clutter/clutter/clutter-enum-types.h.in
deleted file mode 100644
index 17f9ee644..000000000
--- a/clutter/clutter/clutter-enum-types.h.in
+++ /dev/null
@@ -1,29 +0,0 @@
-/*** BEGIN file-header ***/
-#ifndef __CLUTTER_ENUM_TYPES_H__
-#define __CLUTTER_ENUM_TYPES_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-types.h>
-
-G_BEGIN_DECLS
-
-/*** END file-header ***/
-
-/*** BEGIN file-production ***/
-/* enumerations from "@basename@" */
-/*** END file-production ***/
-
-/*** BEGIN value-header ***/
-CLUTTER_EXPORT GType @enum_name@_get_type (void) G_GNUC_CONST;
-#define CLUTTER_TYPE_@ENUMSHORT@ (@enum_name@_get_type())
-
-/*** END value-header ***/
-
-/*** BEGIN file-tail ***/
-G_END_DECLS
-
-#endif /* !__CLUTTER_ENUM_TYPES_H__ */
-/*** END file-tail ***/
diff --git a/clutter/clutter/clutter-enums.h b/clutter/clutter/clutter-enums.h
deleted file mode 100644
index 458d0fd2c..000000000
--- a/clutter/clutter/clutter-enums.h
+++ /dev/null
@@ -1,1643 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2011 Intel Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __CLUTTER_ENUMS_H__
-#define __CLUTTER_ENUMS_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-/**
- * ClutterGravity:
- * @CLUTTER_GRAVITY_NONE: Do not apply any gravity
- * @CLUTTER_GRAVITY_NORTH: Scale from topmost downwards
- * @CLUTTER_GRAVITY_NORTH_EAST: Scale from the top right corner
- * @CLUTTER_GRAVITY_EAST: Scale from the right side
- * @CLUTTER_GRAVITY_SOUTH_EAST: Scale from the bottom right corner
- * @CLUTTER_GRAVITY_SOUTH: Scale from the bottom upwards
- * @CLUTTER_GRAVITY_SOUTH_WEST: Scale from the bottom left corner
- * @CLUTTER_GRAVITY_WEST: Scale from the left side
- * @CLUTTER_GRAVITY_NORTH_WEST: Scale from the top left corner
- * @CLUTTER_GRAVITY_CENTER: Scale from the center.
- *
- * Gravity of the scaling operations. When a gravity different than
- * %CLUTTER_GRAVITY_NONE is used, an actor is scaled keeping the position
- * of the specified portion at the same coordinates.
- *
- * Since: 0.2
- *
- * Deprecated: 1.22: Use the normalized #ClutterActor pivot point instead
- */
-typedef enum /*< prefix=CLUTTER_GRAVITY >*/
-{
- CLUTTER_GRAVITY_NONE = 0,
- CLUTTER_GRAVITY_NORTH,
- CLUTTER_GRAVITY_NORTH_EAST,
- CLUTTER_GRAVITY_EAST,
- CLUTTER_GRAVITY_SOUTH_EAST,
- CLUTTER_GRAVITY_SOUTH,
- CLUTTER_GRAVITY_SOUTH_WEST,
- CLUTTER_GRAVITY_WEST,
- CLUTTER_GRAVITY_NORTH_WEST,
- CLUTTER_GRAVITY_CENTER
-} ClutterGravity;
-
-/**
- * ClutterRotateAxis:
- * @CLUTTER_X_AXIS: Rotate around the X axis
- * @CLUTTER_Y_AXIS: Rotate around the Y axis
- * @CLUTTER_Z_AXIS: Rotate around the Z axis
- *
- * Axis of a rotation.
- *
- * Since: 0.4
- */
-typedef enum /*< prefix=CLUTTER >*/
-{
- CLUTTER_X_AXIS,
- CLUTTER_Y_AXIS,
- CLUTTER_Z_AXIS
-} ClutterRotateAxis;
-
-/**
- * ClutterRotateDirection:
- * @CLUTTER_ROTATE_CW: Clockwise rotation
- * @CLUTTER_ROTATE_CCW: Counter-clockwise rotation
- *
- * Direction of a rotation.
- *
- * Since: 0.4
- *
- * Deprecated: 1.22
- */
-typedef enum /*< prefix=CLUTTER_ROTATE >*/
-{
- CLUTTER_ROTATE_CW,
- CLUTTER_ROTATE_CCW
-} ClutterRotateDirection;
-
-/**
- * ClutterRequestMode:
- * @CLUTTER_REQUEST_HEIGHT_FOR_WIDTH: Height for width requests
- * @CLUTTER_REQUEST_WIDTH_FOR_HEIGHT: Width for height requests
- * @CLUTTER_REQUEST_CONTENT_SIZE: Use the preferred size of the
- * #ClutterContent, if it has any (available since 1.22)
- *
- * Specifies the type of requests for a #ClutterActor.
- *
- * Since: 0.8
- */
-typedef enum /*< prefix=CLUTTER_REQUEST >*/
-{
- CLUTTER_REQUEST_HEIGHT_FOR_WIDTH,
- CLUTTER_REQUEST_WIDTH_FOR_HEIGHT,
- CLUTTER_REQUEST_CONTENT_SIZE
-} ClutterRequestMode;
-
-/**
- * ClutterAnimationMode:
- * @CLUTTER_CUSTOM_MODE: custom progress function
- * @CLUTTER_LINEAR: linear tweening
- * @CLUTTER_EASE_IN_QUAD: quadratic tweening
- * @CLUTTER_EASE_OUT_QUAD: quadratic tweening, inverse of
- * %CLUTTER_EASE_IN_QUAD
- * @CLUTTER_EASE_IN_OUT_QUAD: quadratic tweening, combininig
- * %CLUTTER_EASE_IN_QUAD and %CLUTTER_EASE_OUT_QUAD
- * @CLUTTER_EASE_IN_CUBIC: cubic tweening
- * @CLUTTER_EASE_OUT_CUBIC: cubic tweening, inverse of
- * %CLUTTER_EASE_IN_CUBIC
- * @CLUTTER_EASE_IN_OUT_CUBIC: cubic tweening, combining
- * %CLUTTER_EASE_IN_CUBIC and %CLUTTER_EASE_OUT_CUBIC
- * @CLUTTER_EASE_IN_QUART: quartic tweening
- * @CLUTTER_EASE_OUT_QUART: quartic tweening, inverse of
- * %CLUTTER_EASE_IN_QUART
- * @CLUTTER_EASE_IN_OUT_QUART: quartic tweening, combining
- * %CLUTTER_EASE_IN_QUART and %CLUTTER_EASE_OUT_QUART
- * @CLUTTER_EASE_IN_QUINT: quintic tweening
- * @CLUTTER_EASE_OUT_QUINT: quintic tweening, inverse of
- * %CLUTTER_EASE_IN_QUINT
- * @CLUTTER_EASE_IN_OUT_QUINT: fifth power tweening, combining
- * %CLUTTER_EASE_IN_QUINT and %CLUTTER_EASE_OUT_QUINT
- * @CLUTTER_EASE_IN_SINE: sinusoidal tweening
- * @CLUTTER_EASE_OUT_SINE: sinusoidal tweening, inverse of
- * %CLUTTER_EASE_IN_SINE
- * @CLUTTER_EASE_IN_OUT_SINE: sine wave tweening, combining
- * %CLUTTER_EASE_IN_SINE and %CLUTTER_EASE_OUT_SINE
- * @CLUTTER_EASE_IN_EXPO: exponential tweening
- * @CLUTTER_EASE_OUT_EXPO: exponential tweening, inverse of
- * %CLUTTER_EASE_IN_EXPO
- * @CLUTTER_EASE_IN_OUT_EXPO: exponential tweening, combining
- * %CLUTTER_EASE_IN_EXPO and %CLUTTER_EASE_OUT_EXPO
- * @CLUTTER_EASE_IN_CIRC: circular tweening
- * @CLUTTER_EASE_OUT_CIRC: circular tweening, inverse of
- * %CLUTTER_EASE_IN_CIRC
- * @CLUTTER_EASE_IN_OUT_CIRC: circular tweening, combining
- * %CLUTTER_EASE_IN_CIRC and %CLUTTER_EASE_OUT_CIRC
- * @CLUTTER_EASE_IN_ELASTIC: elastic tweening, with offshoot on start
- * @CLUTTER_EASE_OUT_ELASTIC: elastic tweening, with offshoot on end
- * @CLUTTER_EASE_IN_OUT_ELASTIC: elastic tweening with offshoot on both ends
- * @CLUTTER_EASE_IN_BACK: overshooting cubic tweening, with
- * backtracking on start
- * @CLUTTER_EASE_OUT_BACK: overshooting cubic tweening, with
- * backtracking on end
- * @CLUTTER_EASE_IN_OUT_BACK: overshooting cubic tweening, with
- * backtracking on both ends
- * @CLUTTER_EASE_IN_BOUNCE: exponentially decaying parabolic (bounce)
- * tweening, with bounce on start
- * @CLUTTER_EASE_OUT_BOUNCE: exponentially decaying parabolic (bounce)
- * tweening, with bounce on end
- * @CLUTTER_EASE_IN_OUT_BOUNCE: exponentially decaying parabolic (bounce)
- * tweening, with bounce on both ends
- * @CLUTTER_STEPS: parametrized step function; see clutter_timeline_set_step_progress()
- * for further details. (Since 1.12)
- * @CLUTTER_STEP_START: equivalent to %CLUTTER_STEPS with a number of steps
- * equal to 1, and a step mode of %CLUTTER_STEP_MODE_START. (Since 1.12)
- * @CLUTTER_STEP_END: equivalent to %CLUTTER_STEPS with a number of steps
- * equal to 1, and a step mode of %CLUTTER_STEP_MODE_END. (Since 1.12)
- * @CLUTTER_CUBIC_BEZIER: cubic bezier between (0, 0) and (1, 1) with two
- * control points; see clutter_timeline_set_cubic_bezier_progress(). (Since 1.12)
- * @CLUTTER_EASE: equivalent to %CLUTTER_CUBIC_BEZIER with control points
- * in (0.25, 0.1) and (0.25, 1.0). (Since 1.12)
- * @CLUTTER_EASE_IN: equivalent to %CLUTTER_CUBIC_BEZIER with control points
- * in (0.42, 0) and (1.0, 1.0). (Since 1.12)
- * @CLUTTER_EASE_OUT: equivalent to %CLUTTER_CUBIC_BEZIER with control points
- * in (0, 0) and (0.58, 1.0). (Since 1.12)
- * @CLUTTER_EASE_IN_OUT: equivalent to %CLUTTER_CUBIC_BEZIER with control points
- * in (0.42, 0) and (0.58, 1.0). (Since 1.12)
- * @CLUTTER_ANIMATION_LAST: last animation mode, used as a guard for
- * registered global alpha functions
- *
- * The animation modes used by #ClutterAnimatable. This
- * enumeration can be expanded in later versions of Clutter.
- *
- * <figure id="easing-modes">
- * <title>Easing modes provided by Clutter</title>
- * <graphic fileref="easing-modes.png" format="PNG"/>
- * </figure>
- *
- * Every global alpha function registered using clutter_alpha_register_func()
- * or clutter_alpha_register_closure() will have a logical id greater than
- * %CLUTTER_ANIMATION_LAST.
- *
- * Since: 1.0
- */
-typedef enum
-{
- CLUTTER_CUSTOM_MODE = 0,
-
- /* linear */
- CLUTTER_LINEAR,
-
- /* quadratic */
- CLUTTER_EASE_IN_QUAD,
- CLUTTER_EASE_OUT_QUAD,
- CLUTTER_EASE_IN_OUT_QUAD,
-
- /* cubic */
- CLUTTER_EASE_IN_CUBIC,
- CLUTTER_EASE_OUT_CUBIC,
- CLUTTER_EASE_IN_OUT_CUBIC,
-
- /* quartic */
- CLUTTER_EASE_IN_QUART,
- CLUTTER_EASE_OUT_QUART,
- CLUTTER_EASE_IN_OUT_QUART,
-
- /* quintic */
- CLUTTER_EASE_IN_QUINT,
- CLUTTER_EASE_OUT_QUINT,
- CLUTTER_EASE_IN_OUT_QUINT,
-
- /* sinusoidal */
- CLUTTER_EASE_IN_SINE,
- CLUTTER_EASE_OUT_SINE,
- CLUTTER_EASE_IN_OUT_SINE,
-
- /* exponential */
- CLUTTER_EASE_IN_EXPO,
- CLUTTER_EASE_OUT_EXPO,
- CLUTTER_EASE_IN_OUT_EXPO,
-
- /* circular */
- CLUTTER_EASE_IN_CIRC,
- CLUTTER_EASE_OUT_CIRC,
- CLUTTER_EASE_IN_OUT_CIRC,
-
- /* elastic */
- CLUTTER_EASE_IN_ELASTIC,
- CLUTTER_EASE_OUT_ELASTIC,
- CLUTTER_EASE_IN_OUT_ELASTIC,
-
- /* overshooting cubic */
- CLUTTER_EASE_IN_BACK,
- CLUTTER_EASE_OUT_BACK,
- CLUTTER_EASE_IN_OUT_BACK,
-
- /* exponentially decaying parabolic */
- CLUTTER_EASE_IN_BOUNCE,
- CLUTTER_EASE_OUT_BOUNCE,
- CLUTTER_EASE_IN_OUT_BOUNCE,
-
- /* step functions (see css3-transitions) */
- CLUTTER_STEPS,
- CLUTTER_STEP_START, /* steps(1, start) */
- CLUTTER_STEP_END, /* steps(1, end) */
-
- /* cubic bezier (see css3-transitions) */
- CLUTTER_CUBIC_BEZIER,
- CLUTTER_EASE,
- CLUTTER_EASE_IN,
- CLUTTER_EASE_OUT,
- CLUTTER_EASE_IN_OUT,
-
- /* guard, before registered alpha functions */
- CLUTTER_ANIMATION_LAST
-} ClutterAnimationMode;
-
-/**
- * ClutterTextDirection:
- * @CLUTTER_TEXT_DIRECTION_DEFAULT: Use the default setting, as returned
- * by clutter_get_default_text_direction()
- * @CLUTTER_TEXT_DIRECTION_LTR: Use left-to-right text direction
- * @CLUTTER_TEXT_DIRECTION_RTL: Use right-to-left text direction
- *
- * The text direction to be used by #ClutterActor<!-- -->s
- *
- * Since: 1.2
- */
-typedef enum
-{
- CLUTTER_TEXT_DIRECTION_DEFAULT,
- CLUTTER_TEXT_DIRECTION_LTR,
- CLUTTER_TEXT_DIRECTION_RTL
-} ClutterTextDirection;
-
-/**
- * ClutterShaderType:
- * @CLUTTER_VERTEX_SHADER: a vertex shader
- * @CLUTTER_FRAGMENT_SHADER: a fragment shader
- *
- * The type of GLSL shader program
- *
- * Since: 1.4
- */
-typedef enum
-{
- CLUTTER_VERTEX_SHADER,
- CLUTTER_FRAGMENT_SHADER
-} ClutterShaderType;
-
-/**
- * ClutterModifierType:
- * @CLUTTER_SHIFT_MASK: Mask applied by the Shift key
- * @CLUTTER_LOCK_MASK: Mask applied by the Caps Lock key
- * @CLUTTER_CONTROL_MASK: Mask applied by the Control key
- * @CLUTTER_MOD1_MASK: Mask applied by the first Mod key
- * @CLUTTER_MOD2_MASK: Mask applied by the second Mod key
- * @CLUTTER_MOD3_MASK: Mask applied by the third Mod key
- * @CLUTTER_MOD4_MASK: Mask applied by the fourth Mod key
- * @CLUTTER_MOD5_MASK: Mask applied by the fifth Mod key
- * @CLUTTER_BUTTON1_MASK: Mask applied by the first pointer button
- * @CLUTTER_BUTTON2_MASK: Mask applied by the second pointer button
- * @CLUTTER_BUTTON3_MASK: Mask applied by the third pointer button
- * @CLUTTER_BUTTON4_MASK: Mask applied by the fourth pointer button
- * @CLUTTER_BUTTON5_MASK: Mask applied by the fifth pointer button
- * @CLUTTER_SUPER_MASK: Mask applied by the Super key
- * @CLUTTER_HYPER_MASK: Mask applied by the Hyper key
- * @CLUTTER_META_MASK: Mask applied by the Meta key
- * @CLUTTER_RELEASE_MASK: Mask applied during release
- * @CLUTTER_MODIFIER_MASK: A mask covering all modifier types
- *
- * Masks applied to a #ClutterEvent by modifiers.
- *
- * Note that Clutter may add internal values to events which include
- * reserved values such as %CLUTTER_MODIFIER_RESERVED_13_MASK. Your code
- * should preserve and ignore them. You can use %CLUTTER_MODIFIER_MASK to
- * remove all reserved values.
- *
- * Since: 0.4
- */
-typedef enum
-{
- CLUTTER_SHIFT_MASK = 1 << 0,
- CLUTTER_LOCK_MASK = 1 << 1,
- CLUTTER_CONTROL_MASK = 1 << 2,
- CLUTTER_MOD1_MASK = 1 << 3,
- CLUTTER_MOD2_MASK = 1 << 4,
- CLUTTER_MOD3_MASK = 1 << 5,
- CLUTTER_MOD4_MASK = 1 << 6,
- CLUTTER_MOD5_MASK = 1 << 7,
- CLUTTER_BUTTON1_MASK = 1 << 8,
- CLUTTER_BUTTON2_MASK = 1 << 9,
- CLUTTER_BUTTON3_MASK = 1 << 10,
- CLUTTER_BUTTON4_MASK = 1 << 11,
- CLUTTER_BUTTON5_MASK = 1 << 12,
-
-#ifndef __GTK_DOC_IGNORE__
- CLUTTER_MODIFIER_RESERVED_13_MASK = 1 << 13,
- CLUTTER_MODIFIER_RESERVED_14_MASK = 1 << 14,
- CLUTTER_MODIFIER_RESERVED_15_MASK = 1 << 15,
- CLUTTER_MODIFIER_RESERVED_16_MASK = 1 << 16,
- CLUTTER_MODIFIER_RESERVED_17_MASK = 1 << 17,
- CLUTTER_MODIFIER_RESERVED_18_MASK = 1 << 18,
- CLUTTER_MODIFIER_RESERVED_19_MASK = 1 << 19,
- CLUTTER_MODIFIER_RESERVED_20_MASK = 1 << 20,
- CLUTTER_MODIFIER_RESERVED_21_MASK = 1 << 21,
- CLUTTER_MODIFIER_RESERVED_22_MASK = 1 << 22,
- CLUTTER_MODIFIER_RESERVED_23_MASK = 1 << 23,
- CLUTTER_MODIFIER_RESERVED_24_MASK = 1 << 24,
- CLUTTER_MODIFIER_RESERVED_25_MASK = 1 << 25,
-#endif
-
- CLUTTER_SUPER_MASK = 1 << 26,
- CLUTTER_HYPER_MASK = 1 << 27,
- CLUTTER_META_MASK = 1 << 28,
-
-#ifndef __GTK_DOC_IGNORE__
- CLUTTER_MODIFIER_RESERVED_29_MASK = 1 << 29,
-#endif
-
- CLUTTER_RELEASE_MASK = 1 << 30,
-
- /* Combination of CLUTTER_SHIFT_MASK..CLUTTER_BUTTON5_MASK + CLUTTER_SUPER_MASK
- + CLUTTER_HYPER_MASK + CLUTTER_META_MASK + CLUTTER_RELEASE_MASK */
- CLUTTER_MODIFIER_MASK = 0x5c001fff
-} ClutterModifierType;
-
-/**
- * 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
- * a toplevel, and all parents visible)
- * @CLUTTER_ACTOR_REALIZED: the resources associated to the actor have been
- * allocated
- * @CLUTTER_ACTOR_REACTIVE: the actor 'reacts' to mouse events emitting event
- * signals
- * @CLUTTER_ACTOR_VISIBLE: the actor has been shown by the application program
- * @CLUTTER_ACTOR_NO_LAYOUT: the actor provides an explicit layout management
- * policy for its children; this flag will prevent Clutter from automatic
- * queueing of relayout and will defer all layouting to the actor itself
- *
- * Flags used to signal the state of an actor.
- */
-typedef enum /*< prefix=CLUTTER_ACTOR >*/
-{
- CLUTTER_ACTOR_MAPPED = 1 << 1,
- CLUTTER_ACTOR_REALIZED = 1 << 2,
- CLUTTER_ACTOR_REACTIVE = 1 << 3,
- CLUTTER_ACTOR_VISIBLE = 1 << 4,
- CLUTTER_ACTOR_NO_LAYOUT = 1 << 5
-} ClutterActorFlags;
-
-/**
- * ClutterOffscreenRedirect:
- * @CLUTTER_OFFSCREEN_REDIRECT_AUTOMATIC_FOR_OPACITY: Only redirect
- * the actor if it is semi-transparent and its has_overlaps()
- * virtual returns %TRUE.
- * @CLUTTER_OFFSCREEN_REDIRECT_ALWAYS: Always redirect the actor to an
- * offscreen buffer even if it is fully opaque.
- * @CLUTTER_OFFSCREEN_REDIRECT_ON_IDLE: Only redirect the actor if it is the
- * most efficient thing to do based on its recent repaint behaviour. That
- * means when its contents are changing less frequently than it's being used
- * on stage.
- *
- * Possible flags to pass to clutter_actor_set_offscreen_redirect().
- *
- * Since: 1.8
- */
-typedef enum /*< prefix=CLUTTER_OFFSCREEN_REDIRECT >*/
-{
- CLUTTER_OFFSCREEN_REDIRECT_AUTOMATIC_FOR_OPACITY = 1 << 0,
- CLUTTER_OFFSCREEN_REDIRECT_ALWAYS = 1 << 1,
- CLUTTER_OFFSCREEN_REDIRECT_ON_IDLE = 1 << 2
-} ClutterOffscreenRedirect;
-
-/**
- * ClutterAlignAxis:
- * @CLUTTER_ALIGN_X_AXIS: Maintain the alignment on the X axis
- * @CLUTTER_ALIGN_Y_AXIS: Maintain the alignment on the Y axis
- * @CLUTTER_ALIGN_BOTH: Maintain the alignment on both the X and Y axis
- *
- * Specifies the axis on which #ClutterAlignConstraint should maintain
- * the alignment.
- *
- * Since: 1.4
- */
-typedef enum /*< prefix=CLUTTER_ALIGN >*/
-{
- CLUTTER_ALIGN_X_AXIS,
- CLUTTER_ALIGN_Y_AXIS,
- CLUTTER_ALIGN_BOTH
-} ClutterAlignAxis;
-
-/**
- * ClutterInterpolation:
- * @CLUTTER_INTERPOLATION_LINEAR: linear interpolation
- * @CLUTTER_INTERPOLATION_CUBIC: cubic interpolation
- *
- * The mode of interpolation between key frames
- *
- * Since: 1.2
- *
- * Deprecated: 1.22
- */
-typedef enum
-{
- CLUTTER_INTERPOLATION_LINEAR,
- CLUTTER_INTERPOLATION_CUBIC
-} ClutterInterpolation;
-
-/**
- * ClutterBinAlignment:
- * @CLUTTER_BIN_ALIGNMENT_FIXED: Fixed position alignment; the
- * #ClutterBinLayout will honour the fixed position provided
- * by the actors themselves when allocating them
- * @CLUTTER_BIN_ALIGNMENT_FILL: Fill the allocation size
- * @CLUTTER_BIN_ALIGNMENT_START: Position the actors at the top
- * or left side of the container, depending on the axis
- * @CLUTTER_BIN_ALIGNMENT_END: Position the actors at the bottom
- * or right side of the container, depending on the axis
- * @CLUTTER_BIN_ALIGNMENT_CENTER: Position the actors at the
- * center of the container, depending on the axis
- *
- * The alignment policies available on each axis for #ClutterBinLayout
- *
- * Since: 1.2
- *
- * Deprecated: 1.12: Use #ClutterActorAlign and the #ClutterActor
- * API instead
- */
-typedef enum
-{
- CLUTTER_BIN_ALIGNMENT_FIXED,
- CLUTTER_BIN_ALIGNMENT_FILL,
- CLUTTER_BIN_ALIGNMENT_START,
- CLUTTER_BIN_ALIGNMENT_END,
- CLUTTER_BIN_ALIGNMENT_CENTER
-} ClutterBinAlignment;
-
-/**
- * ClutterBindCoordinate:
- * @CLUTTER_BIND_X: Bind the X coordinate
- * @CLUTTER_BIND_Y: Bind the Y coordinate
- * @CLUTTER_BIND_WIDTH: Bind the width
- * @CLUTTER_BIND_HEIGHT: Bind the height
- * @CLUTTER_BIND_POSITION: Equivalent to to %CLUTTER_BIND_X and
- * %CLUTTER_BIND_Y (added in Clutter 1.6)
- * @CLUTTER_BIND_SIZE: Equivalent to %CLUTTER_BIND_WIDTH and
- * %CLUTTER_BIND_HEIGHT (added in Clutter 1.6)
- * @CLUTTER_BIND_ALL: Equivalent to %CLUTTER_BIND_POSITION and
- * %CLUTTER_BIND_SIZE (added in Clutter 1.10)
- *
- * Specifies which property should be used in a binding
- *
- * Since: 1.4
- */
-typedef enum /*< prefix=CLUTTER_BIND >*/
-{
- CLUTTER_BIND_X,
- CLUTTER_BIND_Y,
- CLUTTER_BIND_WIDTH,
- CLUTTER_BIND_HEIGHT,
- CLUTTER_BIND_POSITION,
- CLUTTER_BIND_SIZE,
- CLUTTER_BIND_ALL
-} ClutterBindCoordinate;
-
-/**
- * ClutterEffectPaintFlags:
- * @CLUTTER_EFFECT_PAINT_ACTOR_DIRTY: The actor or one of its children
- * has queued a redraw before this paint. This implies that the effect
- * should call clutter_actor_continue_paint() to chain to the next
- * effect and can not cache any results from a previous paint.
- * @CLUTTER_EFFECT_PAINT_BYPASS_EFFECT: The effect should not be used
- * on this frame, but it will be asked to paint the actor still.
- *
- * Flags passed to the ‘paint’ or ‘pick’ method of #ClutterEffect.
- */
-typedef enum /*< prefix=CLUTTER_EFFECT_PAINT >*/
-{
- CLUTTER_EFFECT_PAINT_ACTOR_DIRTY = (1 << 0),
- CLUTTER_EFFECT_PAINT_BYPASS_EFFECT = (1 << 1)
-} ClutterEffectPaintFlags;
-
-/**
- * ClutterBoxAlignment:
- * @CLUTTER_BOX_ALIGNMENT_START: Align the child to the top or to
- * to the left, depending on the used axis
- * @CLUTTER_BOX_ALIGNMENT_CENTER: Align the child to the center
- * @CLUTTER_BOX_ALIGNMENT_END: Align the child to the bottom or to
- * the right, depending on the used axis
- *
- * The alignment policies available on each axis of the #ClutterBoxLayout
- *
- * Since: 1.2
- */
-typedef enum
-{
- CLUTTER_BOX_ALIGNMENT_START,
- CLUTTER_BOX_ALIGNMENT_END,
- CLUTTER_BOX_ALIGNMENT_CENTER
-} ClutterBoxAlignment;
-
-/**
- * ClutterLongPressState:
- * @CLUTTER_LONG_PRESS_QUERY: Queries the action whether it supports
- * long presses
- * @CLUTTER_LONG_PRESS_ACTIVATE: Activates the action on a long press
- * @CLUTTER_LONG_PRESS_CANCEL: The long press was cancelled
- *
- * The states for the #ClutterClickAction::long-press signal.
- *
- * Since: 1.8
- */
-typedef enum /*< prefix=CLUTTER_LONG_PRESS >*/
-{
- CLUTTER_LONG_PRESS_QUERY,
- CLUTTER_LONG_PRESS_ACTIVATE,
- CLUTTER_LONG_PRESS_CANCEL
-} ClutterLongPressState;
-
-/**
- * ClutterStaticColor:
- * @CLUTTER_COLOR_WHITE: White color (ffffffff)
- * @CLUTTER_COLOR_BLACK: Black color (000000ff)
- * @CLUTTER_COLOR_RED: Red color (ff0000ff)
- * @CLUTTER_COLOR_DARK_RED: Dark red color (800000ff)
- * @CLUTTER_COLOR_GREEN: Green color (00ff00ff)
- * @CLUTTER_COLOR_DARK_GREEN: Dark green color (008000ff)
- * @CLUTTER_COLOR_BLUE: Blue color (0000ffff)
- * @CLUTTER_COLOR_DARK_BLUE: Dark blue color (000080ff)
- * @CLUTTER_COLOR_CYAN: Cyan color (00ffffff)
- * @CLUTTER_COLOR_DARK_CYAN: Dark cyan color (008080ff)
- * @CLUTTER_COLOR_MAGENTA: Magenta color (ff00ffff)
- * @CLUTTER_COLOR_DARK_MAGENTA: Dark magenta color (800080ff)
- * @CLUTTER_COLOR_YELLOW: Yellow color (ffff00ff)
- * @CLUTTER_COLOR_DARK_YELLOW: Dark yellow color (808000ff)
- * @CLUTTER_COLOR_GRAY: Gray color (a0a0a4ff)
- * @CLUTTER_COLOR_DARK_GRAY: Dark Gray color (808080ff)
- * @CLUTTER_COLOR_LIGHT_GRAY: Light gray color (c0c0c0ff)
- * @CLUTTER_COLOR_BUTTER: Butter color (edd400ff)
- * @CLUTTER_COLOR_BUTTER_LIGHT: Light butter color (fce94fff)
- * @CLUTTER_COLOR_BUTTER_DARK: Dark butter color (c4a000ff)
- * @CLUTTER_COLOR_ORANGE: Orange color (f57900ff)
- * @CLUTTER_COLOR_ORANGE_LIGHT: Light orange color (fcaf3fff)
- * @CLUTTER_COLOR_ORANGE_DARK: Dark orange color (ce5c00ff)
- * @CLUTTER_COLOR_CHOCOLATE: Chocolate color (c17d11ff)
- * @CLUTTER_COLOR_CHOCOLATE_LIGHT: Light chocolate color (e9b96eff)
- * @CLUTTER_COLOR_CHOCOLATE_DARK: Dark chocolate color (8f5902ff)
- * @CLUTTER_COLOR_CHAMELEON: Chameleon color (73d216ff)
- * @CLUTTER_COLOR_CHAMELEON_LIGHT: Light chameleon color (8ae234ff)
- * @CLUTTER_COLOR_CHAMELEON_DARK: Dark chameleon color (4e9a06ff)
- * @CLUTTER_COLOR_SKY_BLUE: Sky color (3465a4ff)
- * @CLUTTER_COLOR_SKY_BLUE_LIGHT: Light sky color (729fcfff)
- * @CLUTTER_COLOR_SKY_BLUE_DARK: Dark sky color (204a87ff)
- * @CLUTTER_COLOR_PLUM: Plum color (75507bff)
- * @CLUTTER_COLOR_PLUM_LIGHT: Light plum color (ad7fa8ff)
- * @CLUTTER_COLOR_PLUM_DARK: Dark plum color (5c3566ff)
- * @CLUTTER_COLOR_SCARLET_RED: Scarlet red color (cc0000ff)
- * @CLUTTER_COLOR_SCARLET_RED_LIGHT: Light scarlet red color (ef2929ff)
- * @CLUTTER_COLOR_SCARLET_RED_DARK: Dark scarlet red color (a40000ff)
- * @CLUTTER_COLOR_ALUMINIUM_1: Aluminium, first variant (eeeeecff)
- * @CLUTTER_COLOR_ALUMINIUM_2: Aluminium, second variant (d3d7cfff)
- * @CLUTTER_COLOR_ALUMINIUM_3: Aluminium, third variant (babdb6ff)
- * @CLUTTER_COLOR_ALUMINIUM_4: Aluminium, fourth variant (888a85ff)
- * @CLUTTER_COLOR_ALUMINIUM_5: Aluminium, fifth variant (555753ff)
- * @CLUTTER_COLOR_ALUMINIUM_6: Aluminium, sixth variant (2e3436ff)
- * @CLUTTER_COLOR_TRANSPARENT: Transparent color (00000000)
- *
- * Named colors, for accessing global colors defined by Clutter
- *
- * Since: 1.6
- */
-typedef enum /*< prefix=CLUTTER_COLOR >*/
-{
- /* CGA/EGA-like palette */
- CLUTTER_COLOR_WHITE = 0,
- CLUTTER_COLOR_BLACK,
- CLUTTER_COLOR_RED,
- CLUTTER_COLOR_DARK_RED,
- CLUTTER_COLOR_GREEN,
- CLUTTER_COLOR_DARK_GREEN,
- CLUTTER_COLOR_BLUE,
- CLUTTER_COLOR_DARK_BLUE,
- CLUTTER_COLOR_CYAN,
- CLUTTER_COLOR_DARK_CYAN,
- CLUTTER_COLOR_MAGENTA,
- CLUTTER_COLOR_DARK_MAGENTA,
- CLUTTER_COLOR_YELLOW,
- CLUTTER_COLOR_DARK_YELLOW,
- CLUTTER_COLOR_GRAY,
- CLUTTER_COLOR_DARK_GRAY,
- CLUTTER_COLOR_LIGHT_GRAY,
-
- /* Tango icon palette */
- CLUTTER_COLOR_BUTTER,
- CLUTTER_COLOR_BUTTER_LIGHT,
- CLUTTER_COLOR_BUTTER_DARK,
- CLUTTER_COLOR_ORANGE,
- CLUTTER_COLOR_ORANGE_LIGHT,
- CLUTTER_COLOR_ORANGE_DARK,
- CLUTTER_COLOR_CHOCOLATE,
- CLUTTER_COLOR_CHOCOLATE_LIGHT,
- CLUTTER_COLOR_CHOCOLATE_DARK,
- CLUTTER_COLOR_CHAMELEON,
- CLUTTER_COLOR_CHAMELEON_LIGHT,
- CLUTTER_COLOR_CHAMELEON_DARK,
- CLUTTER_COLOR_SKY_BLUE,
- CLUTTER_COLOR_SKY_BLUE_LIGHT,
- CLUTTER_COLOR_SKY_BLUE_DARK,
- CLUTTER_COLOR_PLUM,
- CLUTTER_COLOR_PLUM_LIGHT,
- CLUTTER_COLOR_PLUM_DARK,
- CLUTTER_COLOR_SCARLET_RED,
- CLUTTER_COLOR_SCARLET_RED_LIGHT,
- CLUTTER_COLOR_SCARLET_RED_DARK,
- CLUTTER_COLOR_ALUMINIUM_1,
- CLUTTER_COLOR_ALUMINIUM_2,
- CLUTTER_COLOR_ALUMINIUM_3,
- CLUTTER_COLOR_ALUMINIUM_4,
- CLUTTER_COLOR_ALUMINIUM_5,
- CLUTTER_COLOR_ALUMINIUM_6,
-
- /* Fully transparent black */
- CLUTTER_COLOR_TRANSPARENT
-} ClutterStaticColor;
-
-/**
- * ClutterDragAxis:
- * @CLUTTER_DRAG_AXIS_NONE: No constraint
- * @CLUTTER_DRAG_X_AXIS: Set a constraint on the X axis
- * @CLUTTER_DRAG_Y_AXIS: Set a constraint on the Y axis
- *
- * The axis of the constraint that should be applied on the
- * dragging action
- *
- * Since: 1.4
- */
-typedef enum /*< prefix=CLUTTER_DRAG >*/
-{
- CLUTTER_DRAG_AXIS_NONE = 0,
-
- CLUTTER_DRAG_X_AXIS,
- CLUTTER_DRAG_Y_AXIS
-} ClutterDragAxis;
-
-/**
- * ClutterEventFlags:
- * @CLUTTER_EVENT_NONE: No flag set
- * @CLUTTER_EVENT_FLAG_SYNTHETIC: Synthetic event
- * @CLUTTER_EVENT_FLAG_REPEATED: Auto-repeated event
- *
- * Flags for the #ClutterEvent
- *
- * Since: 0.6
- */
-typedef enum /*< flags prefix=CLUTTER_EVENT >*/
-{
- CLUTTER_EVENT_NONE = 0,
- CLUTTER_EVENT_FLAG_SYNTHETIC = 1 << 0,
- CLUTTER_EVENT_FLAG_INPUT_METHOD = 1 << 1,
- CLUTTER_EVENT_FLAG_REPEATED = 1 << 2,
- CLUTTER_EVENT_FLAG_RELATIVE_MOTION = 1 << 3,
-} ClutterEventFlags;
-
-/**
- * ClutterEventType:
- * @CLUTTER_NOTHING: Empty event
- * @CLUTTER_KEY_PRESS: Key press event
- * @CLUTTER_KEY_RELEASE: Key release event
- * @CLUTTER_MOTION: Pointer motion event
- * @CLUTTER_ENTER: Actor enter event
- * @CLUTTER_LEAVE: Actor leave event
- * @CLUTTER_BUTTON_PRESS: Pointer button press event
- * @CLUTTER_BUTTON_RELEASE: Pointer button release event
- * @CLUTTER_SCROLL: Pointer scroll event
- * @CLUTTER_TOUCH_BEGIN: A new touch event sequence has started;
- * event added in 1.10
- * @CLUTTER_TOUCH_UPDATE: A touch event sequence has been updated;
- * event added in 1.10
- * @CLUTTER_TOUCH_END: A touch event sequence has finished;
- * event added in 1.10
- * @CLUTTER_TOUCH_CANCEL: A touch event sequence has been canceled;
- * event added in 1.10
- * @CLUTTER_TOUCHPAD_PINCH: A pinch gesture event, the current state is
- * determined by its phase field; event added in 1.24
- * @CLUTTER_TOUCHPAD_SWIPE: A swipe gesture event, the current state is
- * determined by its phase field; event added in 1.24
- * @CLUTTER_PROXIMITY_IN: A tool entered in proximity to a tablet;
- * event added in 1.28
- * @CLUTTER_PROXIMITY_OUT: A tool left from the proximity area of a tablet;
- * event added in 1.28
- * @CLUTTER_EVENT_LAST: Marks the end of the #ClutterEventType enumeration;
- * added in 1.10
- *
- * Types of events.
- *
- * Since: 0.4
- */
-typedef enum /*< prefix=CLUTTER >*/
-{
- CLUTTER_NOTHING = 0,
- CLUTTER_KEY_PRESS,
- CLUTTER_KEY_RELEASE,
- CLUTTER_MOTION,
- CLUTTER_ENTER,
- CLUTTER_LEAVE,
- CLUTTER_BUTTON_PRESS,
- CLUTTER_BUTTON_RELEASE,
- CLUTTER_SCROLL,
- CLUTTER_TOUCH_BEGIN,
- CLUTTER_TOUCH_UPDATE,
- CLUTTER_TOUCH_END,
- CLUTTER_TOUCH_CANCEL,
- CLUTTER_TOUCHPAD_PINCH,
- CLUTTER_TOUCHPAD_SWIPE,
- CLUTTER_PROXIMITY_IN,
- CLUTTER_PROXIMITY_OUT,
- CLUTTER_PAD_BUTTON_PRESS,
- CLUTTER_PAD_BUTTON_RELEASE,
- CLUTTER_PAD_STRIP,
- CLUTTER_PAD_RING,
- CLUTTER_DEVICE_ADDED,
- CLUTTER_DEVICE_REMOVED,
- CLUTTER_IM_COMMIT,
- CLUTTER_IM_DELETE,
- CLUTTER_IM_PREEDIT,
-
- CLUTTER_EVENT_LAST /* helper */
-} ClutterEventType;
-
-/**
- * ClutterScrollDirection:
- * @CLUTTER_SCROLL_UP: Scroll up
- * @CLUTTER_SCROLL_DOWN: Scroll down
- * @CLUTTER_SCROLL_LEFT: Scroll left
- * @CLUTTER_SCROLL_RIGHT: Scroll right
- * @CLUTTER_SCROLL_SMOOTH: Precise scrolling delta (available in 1.10)
- *
- * Direction of a pointer scroll event.
- *
- * The %CLUTTER_SCROLL_SMOOTH value implies that the #ClutterScrollEvent
- * has precise scrolling delta information.
- *
- * Since: 0.4
- */
-typedef enum /*< prefix=CLUTTER_SCROLL >*/
-{
- CLUTTER_SCROLL_UP,
- CLUTTER_SCROLL_DOWN,
- CLUTTER_SCROLL_LEFT,
- CLUTTER_SCROLL_RIGHT,
- CLUTTER_SCROLL_SMOOTH
-} ClutterScrollDirection;
-
-/**
- * ClutterFeatureFlags:
- * @CLUTTER_FEATURE_STAGE_STATIC: Set if stage size if fixed (i.e framebuffer)
- * @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.
- * @CLUTTER_FEATURE_STAGE_MULTIPLE: Set if multiple stages are supported.
- * @CLUTTER_FEATURE_SWAP_EVENTS: Set if the GLX_INTEL_swap_event is supported.
- *
- * Runtime flags indicating specific features available via Clutter window
- * system and graphics backend.
- *
- * Since: 0.4
- */
-typedef enum
-{
- CLUTTER_FEATURE_STAGE_STATIC = (1 << 6),
- CLUTTER_FEATURE_STAGE_CURSOR = (1 << 8),
- CLUTTER_FEATURE_SHADERS_GLSL = (1 << 9),
- CLUTTER_FEATURE_OFFSCREEN = (1 << 10),
- CLUTTER_FEATURE_STAGE_MULTIPLE = (1 << 11),
- CLUTTER_FEATURE_SWAP_EVENTS = (1 << 12)
-} ClutterFeatureFlags;
-
-/**
- * ClutterFlowOrientation:
- * @CLUTTER_FLOW_HORIZONTAL: Arrange the children of the flow layout
- * horizontally first
- * @CLUTTER_FLOW_VERTICAL: Arrange the children of the flow layout
- * vertically first
- *
- * The direction of the arrangement of the children inside
- * a #ClutterFlowLayout
- *
- * Since: 1.2
- */
-typedef enum /*< prefix=CLUTTER_FLOW >*/
-{
- CLUTTER_FLOW_HORIZONTAL,
- CLUTTER_FLOW_VERTICAL
-} ClutterFlowOrientation;
-
-/**
- * ClutterInputDeviceType:
- * @CLUTTER_POINTER_DEVICE: A pointer device
- * @CLUTTER_KEYBOARD_DEVICE: A keyboard device
- * @CLUTTER_EXTENSION_DEVICE: A generic extension device
- * @CLUTTER_JOYSTICK_DEVICE: A joystick device
- * @CLUTTER_TABLET_DEVICE: A tablet device
- * @CLUTTER_TOUCHPAD_DEVICE: A touchpad device
- * @CLUTTER_TOUCHSCREEN_DEVICE: A touch screen device
- * @CLUTTER_PEN_DEVICE: A pen device
- * @CLUTTER_ERASER_DEVICE: An eraser device
- * @CLUTTER_CURSOR_DEVICE: A cursor device
- * @CLUTTER_PAD_DEVICE: A tablet pad
- * @CLUTTER_N_DEVICE_TYPES: The number of device types
- *
- * The types of input devices available.
- *
- * The #ClutterInputDeviceType enumeration can be extended at later
- * date; not every platform supports every input device type.
- *
- * Since: 1.0
- */
-typedef enum
-{
- CLUTTER_POINTER_DEVICE,
- CLUTTER_KEYBOARD_DEVICE,
- CLUTTER_EXTENSION_DEVICE,
- CLUTTER_JOYSTICK_DEVICE,
- CLUTTER_TABLET_DEVICE,
- CLUTTER_TOUCHPAD_DEVICE,
- CLUTTER_TOUCHSCREEN_DEVICE,
- CLUTTER_PEN_DEVICE,
- CLUTTER_ERASER_DEVICE,
- CLUTTER_CURSOR_DEVICE,
- CLUTTER_PAD_DEVICE,
-
- CLUTTER_N_DEVICE_TYPES
-} ClutterInputDeviceType;
-
-/**
- * ClutterInputMode:
- * @CLUTTER_INPUT_MODE_LOGICAL: A logical, virtual device
- * @CLUTTER_INPUT_MODE_PHYSICAL: A physical device, attached to
- * a logical device
- * @CLUTTER_INPUT_MODE_FLOATING: A physical device, not attached
- * to a logical device
- *
- * The mode for input devices available.
- *
- * Since: 1.6
- */
-typedef enum
-{
- CLUTTER_INPUT_MODE_LOGICAL,
- CLUTTER_INPUT_MODE_PHYSICAL,
- CLUTTER_INPUT_MODE_FLOATING
-} ClutterInputMode;
-
-/**
- * ClutterInputAxis:
- * @CLUTTER_INPUT_AXIS_IGNORE: Unused axis
- * @CLUTTER_INPUT_AXIS_X: The position on the X axis
- * @CLUTTER_INPUT_AXIS_Y: The position of the Y axis
- * @CLUTTER_INPUT_AXIS_PRESSURE: The pressure information
- * @CLUTTER_INPUT_AXIS_XTILT: The tilt on the X axis
- * @CLUTTER_INPUT_AXIS_YTILT: The tile on the Y axis
- * @CLUTTER_INPUT_AXIS_WHEEL: A wheel
- * @CLUTTER_INPUT_AXIS_DISTANCE: Distance (Since 1.12)
- * @CLUTTER_INPUT_AXIS_ROTATION: Rotation along the z-axis (Since 1.28)
- * @CLUTTER_INPUT_AXIS_SLIDER: A slider (Since 1.28)
- * @CLUTTER_INPUT_AXIS_LAST: Last value of the enumeration; this value is
- * useful when iterating over the enumeration values (Since 1.12)
- *
- * The type of axes Clutter recognizes on a #ClutterInputDevice
- *
- * Since: 1.6
- */
-typedef enum
-{
- CLUTTER_INPUT_AXIS_IGNORE,
-
- CLUTTER_INPUT_AXIS_X,
- CLUTTER_INPUT_AXIS_Y,
- CLUTTER_INPUT_AXIS_PRESSURE,
- CLUTTER_INPUT_AXIS_XTILT,
- CLUTTER_INPUT_AXIS_YTILT,
- CLUTTER_INPUT_AXIS_WHEEL,
- CLUTTER_INPUT_AXIS_DISTANCE,
- CLUTTER_INPUT_AXIS_ROTATION,
- CLUTTER_INPUT_AXIS_SLIDER,
-
- CLUTTER_INPUT_AXIS_LAST
-} ClutterInputAxis;
-
-typedef enum
-{
- CLUTTER_INPUT_AXIS_FLAG_NONE = 0,
- CLUTTER_INPUT_AXIS_FLAG_X = 1 << CLUTTER_INPUT_AXIS_X,
- CLUTTER_INPUT_AXIS_FLAG_Y = 1 << CLUTTER_INPUT_AXIS_Y,
- CLUTTER_INPUT_AXIS_FLAG_PRESSURE = 1 << CLUTTER_INPUT_AXIS_PRESSURE,
- CLUTTER_INPUT_AXIS_FLAG_XTILT = 1 << CLUTTER_INPUT_AXIS_XTILT,
- CLUTTER_INPUT_AXIS_FLAG_YTILT = 1 << CLUTTER_INPUT_AXIS_YTILT,
- CLUTTER_INPUT_AXIS_FLAG_WHEEL = 1 << CLUTTER_INPUT_AXIS_WHEEL,
- CLUTTER_INPUT_AXIS_FLAG_DISTANCE = 1 << CLUTTER_INPUT_AXIS_DISTANCE,
- CLUTTER_INPUT_AXIS_FLAG_ROTATION = 1 << CLUTTER_INPUT_AXIS_ROTATION,
- CLUTTER_INPUT_AXIS_FLAG_SLIDER = 1 << CLUTTER_INPUT_AXIS_SLIDER,
-} ClutterInputAxisFlags;
-
-/**
- * ClutterSnapEdge:
- * @CLUTTER_SNAP_EDGE_TOP: the top edge
- * @CLUTTER_SNAP_EDGE_RIGHT: the right edge
- * @CLUTTER_SNAP_EDGE_BOTTOM: the bottom edge
- * @CLUTTER_SNAP_EDGE_LEFT: the left edge
- *
- * The edge to snap
- *
- * Since: 1.6
- */
-typedef enum
-{
- CLUTTER_SNAP_EDGE_TOP,
- CLUTTER_SNAP_EDGE_RIGHT,
- CLUTTER_SNAP_EDGE_BOTTOM,
- CLUTTER_SNAP_EDGE_LEFT
-} ClutterSnapEdge;
-
-/**
- * ClutterPickMode:
- * @CLUTTER_PICK_NONE: Do not paint any actor
- * @CLUTTER_PICK_REACTIVE: Paint only the reactive actors
- * @CLUTTER_PICK_ALL: Paint all actors
- *
- * Controls the paint cycle of the scene graph when in pick mode
- *
- * Since: 1.0
- */
-typedef enum
-{
- CLUTTER_PICK_NONE = 0,
- CLUTTER_PICK_REACTIVE,
- CLUTTER_PICK_ALL
-} ClutterPickMode;
-
-/**
- * ClutterSwipeDirection:
- * @CLUTTER_SWIPE_DIRECTION_UP: Upwards swipe gesture
- * @CLUTTER_SWIPE_DIRECTION_DOWN: Downwards swipe gesture
- * @CLUTTER_SWIPE_DIRECTION_LEFT: Leftwards swipe gesture
- * @CLUTTER_SWIPE_DIRECTION_RIGHT: Rightwards swipe gesture
- *
- * The main direction of the swipe gesture
- *
- * Since: 1.8
- */
-typedef enum /*< prefix=CLUTTER_SWIPE_DIRECTION >*/
-{
- CLUTTER_SWIPE_DIRECTION_UP = 1 << 0,
- CLUTTER_SWIPE_DIRECTION_DOWN = 1 << 1,
- CLUTTER_SWIPE_DIRECTION_LEFT = 1 << 2,
- CLUTTER_SWIPE_DIRECTION_RIGHT = 1 << 3
-} ClutterSwipeDirection;
-
-/**
- * ClutterPanAxis:
- * @CLUTTER_PAN_AXIS_NONE: No constraint
- * @CLUTTER_PAN_X_AXIS: Set a constraint on the X axis
- * @CLUTTER_PAN_Y_AXIS: Set a constraint on the Y axis
- * @CLUTTER_PAN_AXIS_AUTO: Constrain panning automatically based on initial
- * movement (available since 1.24)
- *
- * The axis of the constraint that should be applied on the
- * panning action
- *
- * Since: 1.12
- */
-typedef enum /*< prefix=CLUTTER_PAN >*/
-{
- CLUTTER_PAN_AXIS_NONE = 0,
-
- CLUTTER_PAN_X_AXIS,
- CLUTTER_PAN_Y_AXIS,
-
- CLUTTER_PAN_AXIS_AUTO
-} ClutterPanAxis;
-
-/**
- * ClutterTextureFlags:
- * @CLUTTER_TEXTURE_NONE: No flags
- * @CLUTTER_TEXTURE_RGB_FLAG_BGR: Unused flag
- * @CLUTTER_TEXTURE_RGB_FLAG_PREMULT: Unused flag
- * @CLUTTER_TEXTURE_YUV_FLAG_YUV2: Unused flag
- *
- * Flags for clutter_texture_set_from_rgb_data().
- *
- * Since: 0.4
- *
- * Deprecated: 1.22: The #ClutterTexture class was the only user of
- * this API
- */
-typedef enum /*< prefix=CLUTTER_TEXTURE >*/
-{
- CLUTTER_TEXTURE_NONE = 0,
- CLUTTER_TEXTURE_RGB_FLAG_BGR = 1 << 1,
- CLUTTER_TEXTURE_RGB_FLAG_PREMULT = 1 << 2, /* FIXME: not handled */
- CLUTTER_TEXTURE_YUV_FLAG_YUV2 = 1 << 3
-} ClutterTextureFlags;
-
-/**
- * ClutterTextureQuality:
- * @CLUTTER_TEXTURE_QUALITY_LOW: fastest rendering will use nearest neighbour
- * interpolation when rendering. good setting.
- * @CLUTTER_TEXTURE_QUALITY_MEDIUM: higher quality rendering without using
- * extra resources.
- * @CLUTTER_TEXTURE_QUALITY_HIGH: render the texture with the best quality
- * available using extra memory.
- *
- * Enumaration controlling the texture quality.
- *
- * Since: 0.8
- *
- * Deprecated: 1.22: The #ClutterTexture class was the only user of
- * this API; use #ClutterImage and clutter_actor_set_content_scaling_filters()
- * instead.
- */
-typedef enum /*< prefix=CLUTTER_TEXTURE_QUALITY >*/
-{
- CLUTTER_TEXTURE_QUALITY_LOW,
- CLUTTER_TEXTURE_QUALITY_MEDIUM,
- CLUTTER_TEXTURE_QUALITY_HIGH
-} ClutterTextureQuality;
-
-/**
- * ClutterTimelineDirection:
- * @CLUTTER_TIMELINE_FORWARD: forward direction for a timeline
- * @CLUTTER_TIMELINE_BACKWARD: backward direction for a timeline
- *
- * The direction of a #ClutterTimeline
- *
- * Since: 0.6
- */
-typedef enum
-{
- CLUTTER_TIMELINE_FORWARD,
- CLUTTER_TIMELINE_BACKWARD
-} ClutterTimelineDirection;
-
-/**
- * ClutterUnitType:
- * @CLUTTER_UNIT_PIXEL: Unit expressed in pixels (with subpixel precision)
- * @CLUTTER_UNIT_EM: Unit expressed in em
- * @CLUTTER_UNIT_MM: Unit expressed in millimeters
- * @CLUTTER_UNIT_POINT: Unit expressed in points
- * @CLUTTER_UNIT_CM: Unit expressed in centimeters
- *
- * The type of unit in which a value is expressed
- *
- * This enumeration might be expanded at later date
- *
- * Since: 1.0
- */
-typedef enum /*< prefix=CLUTTER_UNIT >*/
-{
- CLUTTER_UNIT_PIXEL,
- CLUTTER_UNIT_EM,
- CLUTTER_UNIT_MM,
- CLUTTER_UNIT_POINT,
- CLUTTER_UNIT_CM
-} ClutterUnitType;
-
-#define CLUTTER_PATH_RELATIVE (32)
-
-/**
- * ClutterPathNodeType:
- * @CLUTTER_PATH_MOVE_TO: jump to the given position
- * @CLUTTER_PATH_LINE_TO: create a line from the last node to the
- * given position
- * @CLUTTER_PATH_CURVE_TO: bezier curve using the last position and
- * three control points.
- * @CLUTTER_PATH_CLOSE: create a line from the last node to the last
- * %CLUTTER_PATH_MOVE_TO node.
- * @CLUTTER_PATH_REL_MOVE_TO: same as %CLUTTER_PATH_MOVE_TO but with
- * coordinates relative to the last node.
- * @CLUTTER_PATH_REL_LINE_TO: same as %CLUTTER_PATH_LINE_TO but with
- * coordinates relative to the last node.
- * @CLUTTER_PATH_REL_CURVE_TO: same as %CLUTTER_PATH_CURVE_TO but with
- * coordinates relative to the last node.
- *
- * Types of nodes in a #ClutterPath.
- *
- * Since: 1.0
- */
-typedef enum
-{
- CLUTTER_PATH_MOVE_TO = 0,
- CLUTTER_PATH_LINE_TO = 1,
- CLUTTER_PATH_CURVE_TO = 2,
- CLUTTER_PATH_CLOSE = 3,
-
- CLUTTER_PATH_REL_MOVE_TO = CLUTTER_PATH_MOVE_TO | CLUTTER_PATH_RELATIVE,
- CLUTTER_PATH_REL_LINE_TO = CLUTTER_PATH_LINE_TO | CLUTTER_PATH_RELATIVE,
- CLUTTER_PATH_REL_CURVE_TO = CLUTTER_PATH_CURVE_TO | CLUTTER_PATH_RELATIVE
-} ClutterPathNodeType;
-
-/**
- * ClutterActorAlign:
- * @CLUTTER_ACTOR_ALIGN_FILL: Stretch to cover the whole allocated space
- * @CLUTTER_ACTOR_ALIGN_START: Snap to left or top side, leaving space
- * to the right or bottom. For horizontal layouts, in right-to-left
- * locales this should be reversed.
- * @CLUTTER_ACTOR_ALIGN_CENTER: Center the actor inside the allocation
- * @CLUTTER_ACTOR_ALIGN_END: Snap to right or bottom side, leaving space
- * to the left or top. For horizontal layouts, in right-to-left locales
- * this should be reversed.
- *
- * Controls how a #ClutterActor should align itself inside the extra space
- * assigned to it during the allocation.
- *
- * Alignment only matters if the allocated space given to an actor is
- * bigger than its natural size; for example, when the #ClutterActor:x-expand
- * or the #ClutterActor:y-expand properties of #ClutterActor are set to %TRUE.
- *
- * Since: 1.10
- */
-typedef enum
-{
- CLUTTER_ACTOR_ALIGN_FILL,
- CLUTTER_ACTOR_ALIGN_START,
- CLUTTER_ACTOR_ALIGN_CENTER,
- CLUTTER_ACTOR_ALIGN_END
-} ClutterActorAlign;
-
-/**
- * ClutterRepaintFlags:
- * @CLUTTER_REPAINT_FLAGS_PRE_PAINT: Run the repaint function prior to
- * painting the stages
- * @CLUTTER_REPAINT_FLAGS_POST_PAINT: Run the repaint function after
- * painting the stages
- *
- * Flags to pass to clutter_threads_add_repaint_func_full().
- *
- * Since: 1.10
- */
-typedef enum
-{
- CLUTTER_REPAINT_FLAGS_PRE_PAINT = 1 << 0,
- CLUTTER_REPAINT_FLAGS_POST_PAINT = 1 << 1,
-} ClutterRepaintFlags;
-
-/**
- * ClutterContentGravity:
- * @CLUTTER_CONTENT_GRAVITY_TOP_LEFT: Align the content to the top left corner
- * @CLUTTER_CONTENT_GRAVITY_TOP: Align the content to the top edge
- * @CLUTTER_CONTENT_GRAVITY_TOP_RIGHT: Align the content to the top right corner
- * @CLUTTER_CONTENT_GRAVITY_LEFT: Align the content to the left edge
- * @CLUTTER_CONTENT_GRAVITY_CENTER: Align the content to the center
- * @CLUTTER_CONTENT_GRAVITY_RIGHT: Align the content to the right edge
- * @CLUTTER_CONTENT_GRAVITY_BOTTOM_LEFT: Align the content to the bottom left corner
- * @CLUTTER_CONTENT_GRAVITY_BOTTOM: Align the content to the bottom edge
- * @CLUTTER_CONTENT_GRAVITY_BOTTOM_RIGHT: Align the content to the bottom right corner
- * @CLUTTER_CONTENT_GRAVITY_RESIZE_FILL: Resize the content to fill the allocation
- * @CLUTTER_CONTENT_GRAVITY_RESIZE_ASPECT: Resize the content to remain within the
- * allocation, while maintaining the aspect ratio
- *
- * Controls the alignment of the #ClutterContent inside a #ClutterActor.
- *
- * Since: 1.10
- */
-typedef enum
-{
- CLUTTER_CONTENT_GRAVITY_TOP_LEFT,
- CLUTTER_CONTENT_GRAVITY_TOP,
- CLUTTER_CONTENT_GRAVITY_TOP_RIGHT,
-
- CLUTTER_CONTENT_GRAVITY_LEFT,
- CLUTTER_CONTENT_GRAVITY_CENTER,
- CLUTTER_CONTENT_GRAVITY_RIGHT,
-
- CLUTTER_CONTENT_GRAVITY_BOTTOM_LEFT,
- CLUTTER_CONTENT_GRAVITY_BOTTOM,
- CLUTTER_CONTENT_GRAVITY_BOTTOM_RIGHT,
-
- CLUTTER_CONTENT_GRAVITY_RESIZE_FILL,
- CLUTTER_CONTENT_GRAVITY_RESIZE_ASPECT
-} ClutterContentGravity;
-
-/**
- * ClutterScalingFilter:
- * @CLUTTER_SCALING_FILTER_LINEAR: Linear interpolation filter
- * @CLUTTER_SCALING_FILTER_NEAREST: Nearest neighbor interpolation filter
- * @CLUTTER_SCALING_FILTER_TRILINEAR: Trilinear minification filter, with
- * mipmap generation; this filter linearly interpolates on every axis,
- * as well as between mipmap levels.
- *
- * The scaling filters to be used with the #ClutterActor:minification-filter
- * and #ClutterActor:magnification-filter properties.
- *
- * Since: 1.10
- */
-typedef enum
-{
- CLUTTER_SCALING_FILTER_LINEAR,
- CLUTTER_SCALING_FILTER_NEAREST,
- CLUTTER_SCALING_FILTER_TRILINEAR
-} ClutterScalingFilter;
-
-/**
- * ClutterOrientation:
- * @CLUTTER_ORIENTATION_HORIZONTAL: An horizontal orientation
- * @CLUTTER_ORIENTATION_VERTICAL: A vertical orientation
- *
- * Represents the orientation of actors or layout managers.
- *
- * Since: 1.12
- */
-typedef enum
-{
- CLUTTER_ORIENTATION_HORIZONTAL,
- CLUTTER_ORIENTATION_VERTICAL
-} ClutterOrientation;
-
-/**
- * ClutterScrollMode:
- * @CLUTTER_SCROLL_NONE: Ignore scrolling
- * @CLUTTER_SCROLL_HORIZONTALLY: Scroll only horizontally
- * @CLUTTER_SCROLL_VERTICALLY: Scroll only vertically
- * @CLUTTER_SCROLL_BOTH: Scroll in both directions
- *
- * Scroll modes.
- *
- * Since: 1.12
- */
-typedef enum /*< prefix=CLUTTER_SCROLL >*/
-{
- CLUTTER_SCROLL_NONE = 0,
-
- CLUTTER_SCROLL_HORIZONTALLY = 1 << 0,
- CLUTTER_SCROLL_VERTICALLY = 1 << 1,
-
- CLUTTER_SCROLL_BOTH = CLUTTER_SCROLL_HORIZONTALLY | CLUTTER_SCROLL_VERTICALLY
-} ClutterScrollMode;
-
-/**
- * ClutterGridPosition:
- * @CLUTTER_GRID_POSITION_LEFT: left position
- * @CLUTTER_GRID_POSITION_RIGHT: right position
- * @CLUTTER_GRID_POSITION_TOP: top position
- * @CLUTTER_GRID_POSITION_BOTTOM: bottom position
- *
- * Grid position modes.
- *
- * Since: 1.12
- */
-typedef enum
-{
- CLUTTER_GRID_POSITION_LEFT,
- CLUTTER_GRID_POSITION_RIGHT,
- CLUTTER_GRID_POSITION_TOP,
- CLUTTER_GRID_POSITION_BOTTOM
-} ClutterGridPosition;
-
-/**
- * ClutterContentRepeat:
- * @CLUTTER_REPEAT_NONE: No repeat
- * @CLUTTER_REPEAT_X_AXIS: Repeat the content on the X axis
- * @CLUTTER_REPEAT_Y_AXIS: Repeat the content on the Y axis
- * @CLUTTER_REPEAT_BOTH: Repeat the content on both axis
- *
- * Content repeat modes.
- *
- * Since: 1.12
- */
-typedef enum
-{
- CLUTTER_REPEAT_NONE = 0,
- CLUTTER_REPEAT_X_AXIS = 1 << 0,
- CLUTTER_REPEAT_Y_AXIS = 1 << 1,
- CLUTTER_REPEAT_BOTH = CLUTTER_REPEAT_X_AXIS | CLUTTER_REPEAT_Y_AXIS
-} ClutterContentRepeat;
-
-/**
- * ClutterStepMode:
- * @CLUTTER_STEP_MODE_START: The change in the value of a
- * %CLUTTER_STEP progress mode should occur at the start of
- * the transition
- * @CLUTTER_STEP_MODE_END: The change in the value of a
- * %CLUTTER_STEP progress mode should occur at the end of
- * the transition
- *
- * Change the value transition of a step function.
- *
- * See clutter_timeline_set_step_progress().
- *
- * Since: 1.12
- */
-typedef enum
-{
- CLUTTER_STEP_MODE_START,
- CLUTTER_STEP_MODE_END
-} ClutterStepMode;
-
-/**
- * ClutterZoomAxis:
- * @CLUTTER_ZOOM_X_AXIS: Scale only on the X axis
- * @CLUTTER_ZOOM_Y_AXIS: Scale only on the Y axis
- * @CLUTTER_ZOOM_BOTH: Scale on both axis
- *
- * The axis of the constraint that should be applied by the
- * zooming action.
- *
- * Since: 1.12
- */
-typedef enum /*< prefix=CLUTTER_ZOOM >*/
-{
- CLUTTER_ZOOM_X_AXIS,
- CLUTTER_ZOOM_Y_AXIS,
- CLUTTER_ZOOM_BOTH
-} ClutterZoomAxis;
-
-/**
- * ClutterGestureTriggerEdge:
- * @CLUTTER_GESTURE_TRIGGER_EDGE_NONE: Tell #ClutterGestureAction that
- * the gesture must begin immediately and there's no drag limit that
- * will cause its cancellation;
- * @CLUTTER_GESTURE_TRIGGER_EDGE_AFTER: Tell #ClutterGestureAction that
- * it needs to wait until the drag threshold has been exceeded before
- * considering that the gesture has begun;
- * @CLUTTER_GESTURE_TRIGGER_EDGE_BEFORE: Tell #ClutterGestureAction that
- * the gesture must begin immediately and that it must be cancelled
- * once the drag exceed the configured threshold.
- *
- * Enum passed to the clutter_gesture_action_set_threshold_trigger_edge()
- * function.
- *
- * Since: 1.18
- */
-typedef enum
-{
- CLUTTER_GESTURE_TRIGGER_EDGE_NONE = 0,
- CLUTTER_GESTURE_TRIGGER_EDGE_AFTER,
- CLUTTER_GESTURE_TRIGGER_EDGE_BEFORE
-} ClutterGestureTriggerEdge;
-
-/**
- * ClutterTouchpadGesturePhase:
- * @CLUTTER_TOUCHPAD_GESTURE_PHASE_BEGIN: The gesture has begun.
- * @CLUTTER_TOUCHPAD_GESTURE_PHASE_UPDATE: The gesture has been updated.
- * @CLUTTER_TOUCHPAD_GESTURE_PHASE_END: The gesture was finished, changes
- * should be permanently applied.
- * @CLUTTER_TOUCHPAD_GESTURE_PHASE_CANCEL: The gesture was cancelled, all
- * changes should be undone.
- *
- * The phase of a touchpad gesture event. All gestures are guaranteed to
- * begin with an event of type %CLUTTER_TOUCHPAD_GESTURE_PHASE_BEGIN,
- * followed by a number of %CLUTTER_TOUCHPAD_GESTURE_PHASE_UPDATE (possibly 0).
- *
- * A finished gesture may have 2 possible outcomes, an event with phase
- * %CLUTTER_TOUCHPAD_GESTURE_PHASE_END will be emitted when the gesture is
- * considered successful, this should be used as the hint to perform any
- * permanent changes.
-
- * Cancelled gestures may be so for a variety of reasons, due to hardware,
- * or due to the gesture recognition layers hinting the gesture did not
- * finish resolutely (eg. a 3rd finger being added during a pinch gesture).
- * In these cases, the last event with report the phase
- * %CLUTTER_TOUCHPAD_GESTURE_PHASE_CANCEL, this should be used as a hint
- * to undo any visible/permanent changes that were done throughout the
- * progress of the gesture.
- *
- * See also #ClutterTouchpadPinchEvent and #ClutterTouchpadPinchEvent.
- *
- * Since: 1.24
- */
-typedef enum
-{
- CLUTTER_TOUCHPAD_GESTURE_PHASE_BEGIN,
- CLUTTER_TOUCHPAD_GESTURE_PHASE_UPDATE,
- CLUTTER_TOUCHPAD_GESTURE_PHASE_END,
- CLUTTER_TOUCHPAD_GESTURE_PHASE_CANCEL
-} ClutterTouchpadGesturePhase;
-
-/**
- * ClutterScrollSource:
- * @CLUTTER_SCROLL_SOURCE_UNKNOWN: Source of scroll events is unknown.
- * @CLUTTER_SCROLL_SOURCE_WHEEL: The scroll event is originated by a mouse wheel.
- * @CLUTTER_SCROLL_SOURCE_FINGER: The scroll event is originated by one or more
- * fingers on the device (eg. touchpads).
- * @CLUTTER_SCROLL_SOURCE_CONTINUOUS: The scroll event is originated by the
- * motion of some device (eg. a scroll button is set).
- *
- * The scroll source determines the source of the scroll event. Keep in mind
- * that the source device #ClutterInputDeviceType is not enough to infer
- * the scroll source.
- *
- * Since: 1.26
- */
-typedef enum
-{
- CLUTTER_SCROLL_SOURCE_UNKNOWN,
- CLUTTER_SCROLL_SOURCE_WHEEL,
- CLUTTER_SCROLL_SOURCE_FINGER,
- CLUTTER_SCROLL_SOURCE_CONTINUOUS
-} ClutterScrollSource;
-
-/**
- * ClutterScrollFinishFlags:
- * @CLUTTER_SCROLL_FINISHED_NONE: no axis was stopped.
- * @CLUTTER_SCROLL_FINISHED_HORIZONTAL: The horizontal axis stopped.
- * @CLUTTER_SCROLL_FINISHED_VERTICAL: The vertical axis stopped.
- *
- * Flags used to notify the axes that were stopped in a #ClutterScrollEvent.
- * These can be used to trigger post-scroll effects like kinetic scrolling.
- *
- * Since: 1.26
- */
-typedef enum
-{
- CLUTTER_SCROLL_FINISHED_NONE = 0,
- CLUTTER_SCROLL_FINISHED_HORIZONTAL = 1 << 0,
- CLUTTER_SCROLL_FINISHED_VERTICAL = 1 << 1
-} ClutterScrollFinishFlags;
-
-/**
- * ClutterInputDeviceToolType:
- * @CLUTTER_INPUT_DEVICE_TOOL_NONE: No tool
- * @CLUTTER_INPUT_DEVICE_TOOL_PEN: The tool is a pen
- * @CLUTTER_INPUT_DEVICE_TOOL_ERASER: The tool is an eraser
- * @CLUTTER_INPUT_DEVICE_TOOL_BRUSH: The tool is a brush
- * @CLUTTER_INPUT_DEVICE_TOOL_PENCIL: The tool is a pencil
- * @CLUTTER_INPUT_DEVICE_TOOL_AIRBRUSH: The tool is an airbrush
- * @CLUTTER_INPUT_DEVICE_TOOL_MOUSE: The tool is a mouse
- * @CLUTTER_INPUT_DEVICE_TOOL_LENS: The tool is a lens
- *
- * Defines the type of tool that a #ClutterInputDeviceTool represents.
- *
- * Since: 1.28
- */
-typedef enum
-{
- CLUTTER_INPUT_DEVICE_TOOL_NONE,
- CLUTTER_INPUT_DEVICE_TOOL_PEN,
- CLUTTER_INPUT_DEVICE_TOOL_ERASER,
- CLUTTER_INPUT_DEVICE_TOOL_BRUSH,
- CLUTTER_INPUT_DEVICE_TOOL_PENCIL,
- CLUTTER_INPUT_DEVICE_TOOL_AIRBRUSH,
- CLUTTER_INPUT_DEVICE_TOOL_MOUSE,
- CLUTTER_INPUT_DEVICE_TOOL_LENS
-} ClutterInputDeviceToolType;
-
-typedef enum
-{
- CLUTTER_INPUT_DEVICE_PAD_SOURCE_UNKNOWN,
- CLUTTER_INPUT_DEVICE_PAD_SOURCE_FINGER,
-} ClutterInputDevicePadSource;
-
-typedef enum
-{
- CLUTTER_PAD_FEATURE_BUTTON,
- CLUTTER_PAD_FEATURE_RING,
- CLUTTER_PAD_FEATURE_STRIP,
-} ClutterInputDevicePadFeature;
-
-typedef enum
-{
- CLUTTER_INPUT_CONTENT_HINT_COMPLETION = 1 << 0,
- CLUTTER_INPUT_CONTENT_HINT_SPELLCHECK = 1 << 1,
- CLUTTER_INPUT_CONTENT_HINT_AUTO_CAPITALIZATION = 1 << 2,
- CLUTTER_INPUT_CONTENT_HINT_LOWERCASE = 1 << 3,
- CLUTTER_INPUT_CONTENT_HINT_UPPERCASE = 1 << 4,
- CLUTTER_INPUT_CONTENT_HINT_TITLECASE = 1 << 5,
- CLUTTER_INPUT_CONTENT_HINT_HIDDEN_TEXT = 1 << 6,
- CLUTTER_INPUT_CONTENT_HINT_SENSITIVE_DATA = 1 << 7,
- CLUTTER_INPUT_CONTENT_HINT_LATIN = 1 << 8,
- CLUTTER_INPUT_CONTENT_HINT_MULTILINE = 1 << 9,
-} ClutterInputContentHintFlags;
-
-typedef enum
-{
- CLUTTER_INPUT_CONTENT_PURPOSE_NORMAL,
- CLUTTER_INPUT_CONTENT_PURPOSE_ALPHA,
- CLUTTER_INPUT_CONTENT_PURPOSE_DIGITS,
- CLUTTER_INPUT_CONTENT_PURPOSE_NUMBER,
- CLUTTER_INPUT_CONTENT_PURPOSE_PHONE,
- CLUTTER_INPUT_CONTENT_PURPOSE_URL,
- CLUTTER_INPUT_CONTENT_PURPOSE_EMAIL,
- CLUTTER_INPUT_CONTENT_PURPOSE_NAME,
- CLUTTER_INPUT_CONTENT_PURPOSE_PASSWORD,
- CLUTTER_INPUT_CONTENT_PURPOSE_DATE,
- CLUTTER_INPUT_CONTENT_PURPOSE_TIME,
- CLUTTER_INPUT_CONTENT_PURPOSE_DATETIME,
- CLUTTER_INPUT_CONTENT_PURPOSE_TERMINAL,
-} ClutterInputContentPurpose;
-
-typedef enum
-{
- CLUTTER_INPUT_PANEL_STATE_OFF,
- CLUTTER_INPUT_PANEL_STATE_ON,
- CLUTTER_INPUT_PANEL_STATE_TOGGLE,
-} ClutterInputPanelState;
-
-G_END_DECLS
-
-#endif /* __CLUTTER_ENUMS_H__ */
diff --git a/clutter/clutter/clutter-event-private.h b/clutter/clutter/clutter-event-private.h
deleted file mode 100644
index 011241ce1..000000000
--- a/clutter/clutter/clutter-event-private.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef __CLUTTER_EVENT_PRIVATE_H__
-#define __CLUTTER_EVENT_PRIVATE_H__
-
-#include <clutter/clutter-event.h>
-
-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);
-
-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,
- ClutterModifierType latched_state,
- ClutterModifierType locked_state,
- ClutterModifierType effective_state);
-
-CLUTTER_EXPORT
-void _clutter_event_push (const ClutterEvent *event,
- gboolean do_copy);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_EVENT_PRIVATE_H__ */
diff --git a/clutter/clutter/clutter-event.c b/clutter/clutter/clutter-event.c
deleted file mode 100644
index 8cfa983a4..000000000
--- a/clutter/clutter/clutter-event.c
+++ /dev/null
@@ -1,2220 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- *
- * Copyright (C) 2006 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 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-backend-private.h"
-#include "clutter-debug.h"
-#include "clutter-event-private.h"
-#include "clutter-keysyms.h"
-#include "clutter-private.h"
-
-#include <math.h>
-
-/**
- * SECTION:clutter-event
- * @short_description: User and window system events
- *
- * Windowing events handled by Clutter.
- *
- * The events usually come from the windowing backend, but can also
- * be synthesized by Clutter itself or by the application code.
- */
-
-typedef struct _ClutterEventPrivate {
- ClutterEvent base;
-
- ClutterInputDevice *device;
- ClutterInputDevice *source_device;
-
- gdouble delta_x;
- gdouble delta_y;
-
- ClutterInputDeviceTool *tool;
-
- gpointer platform_data;
-
- ClutterModifierType button_state;
- ClutterModifierType base_state;
- ClutterModifierType latched_state;
- ClutterModifierType locked_state;
-
- guint is_pointer_emulated : 1;
-} ClutterEventPrivate;
-
-typedef struct _ClutterEventFilter {
- int id;
-
- ClutterStage *stage;
- ClutterEventFilterFunc func;
- GDestroyNotify notify;
- gpointer user_data;
-} ClutterEventFilter;
-
-G_DEFINE_BOXED_TYPE (ClutterEvent, clutter_event,
- clutter_event_copy,
- clutter_event_free);
-
-static ClutterEventSequence *
-clutter_event_sequence_copy (ClutterEventSequence *sequence)
-{
- /* Nothing to copy here */
- return sequence;
-}
-
-static void
-clutter_event_sequence_free (ClutterEventSequence *sequence)
-{
- /* Nothing to free here */
-}
-
-G_DEFINE_BOXED_TYPE (ClutterEventSequence, clutter_event_sequence,
- clutter_event_sequence_copy,
- clutter_event_sequence_free);
-
-/*
- * _clutter_event_get_platform_data:
- * @event: a #ClutterEvent
- *
- * Retrieves the pointer to platform-specific data inside an event
- *
- * Return value: a pointer to platform-specific data
- *
- * Since: 1.4
- */
-gpointer
-_clutter_event_get_platform_data (const ClutterEvent *event)
-{
- return ((ClutterEventPrivate *) event)->platform_data;
-}
-
-/*< private >
- * _clutter_event_set_platform_data:
- * @event: a #ClutterEvent
- * @data: a pointer to platform-specific data
- *
- * Sets the pointer to platform-specific data inside an event
- *
- * Since: 1.4
- */
-void
-_clutter_event_set_platform_data (ClutterEvent *event,
- gpointer data)
-{
- ((ClutterEventPrivate *) event)->platform_data = data;
-}
-
-void
-_clutter_event_set_pointer_emulated (ClutterEvent *event,
- gboolean is_emulated)
-{
- ((ClutterEventPrivate *) event)->is_pointer_emulated = !!is_emulated;
-}
-
-/**
- * clutter_event_type:
- * @event: a #ClutterEvent
- *
- * Retrieves the type of the event.
- *
- * Return value: a #ClutterEventType
- */
-ClutterEventType
-clutter_event_type (const ClutterEvent *event)
-{
- g_return_val_if_fail (event != NULL, CLUTTER_NOTHING);
-
- return event->type;
-}
-
-/**
- * clutter_event_get_time:
- * @event: a #ClutterEvent
- *
- * Retrieves the time of the event.
- *
- * Return value: the time of the event, or %CLUTTER_CURRENT_TIME
- *
- * Since: 0.4
- */
-guint32
-clutter_event_get_time (const ClutterEvent *event)
-{
- g_return_val_if_fail (event != NULL, CLUTTER_CURRENT_TIME);
-
- return event->any.time;
-}
-
-/**
- * clutter_event_set_time:
- * @event: a #ClutterEvent
- * @time_: the time of the event
- *
- * Sets the time of the event.
- *
- * Since: 1.8
- */
-void
-clutter_event_set_time (ClutterEvent *event,
- guint32 time_)
-{
- g_return_if_fail (event != NULL);
-
- event->any.time = time_;
-}
-
-/**
- * clutter_event_get_state:
- * @event: a #ClutterEvent
- *
- * Retrieves the modifier state of the event. In case the window system
- * supports reporting latched and locked modifiers, this function returns
- * the effective state.
- *
- * Return value: the modifier state parameter, or 0
- *
- * Since: 0.4
- */
-ClutterModifierType
-clutter_event_get_state (const ClutterEvent *event)
-{
- g_return_val_if_fail (event != NULL, 0);
-
- switch (event->type)
- {
- case CLUTTER_KEY_PRESS:
- case CLUTTER_KEY_RELEASE:
- return event->key.modifier_state;
-
- case CLUTTER_BUTTON_PRESS:
- case CLUTTER_BUTTON_RELEASE:
- return event->button.modifier_state;
-
- case CLUTTER_TOUCH_BEGIN:
- case CLUTTER_TOUCH_UPDATE:
- case CLUTTER_TOUCH_END:
- case CLUTTER_TOUCH_CANCEL:
- return event->touch.modifier_state;
-
- case CLUTTER_MOTION:
- return event->motion.modifier_state;
-
- case CLUTTER_SCROLL:
- return event->scroll.modifier_state;
-
- default:
- break;
- }
-
- return 0;
-}
-
-/**
- * clutter_event_set_state:
- * @event: a #ClutterEvent
- * @state: the modifier state to set
- *
- * Sets the modifier state of the event.
- *
- * Since: 1.8
- */
-void
-clutter_event_set_state (ClutterEvent *event,
- ClutterModifierType state)
-{
- g_return_if_fail (event != NULL);
-
- switch (event->type)
- {
- case CLUTTER_KEY_PRESS:
- case CLUTTER_KEY_RELEASE:
- event->key.modifier_state = state;
- break;
-
- case CLUTTER_BUTTON_PRESS:
- case CLUTTER_BUTTON_RELEASE:
- event->button.modifier_state = state;
- break;
-
- case CLUTTER_MOTION:
- event->motion.modifier_state = state;
- break;
-
- case CLUTTER_TOUCH_BEGIN:
- case CLUTTER_TOUCH_UPDATE:
- case CLUTTER_TOUCH_END:
- case CLUTTER_TOUCH_CANCEL:
- event->touch.modifier_state = state;
- break;
-
- case CLUTTER_SCROLL:
- event->scroll.modifier_state = state;
- break;
-
- default:
- break;
- }
-}
-
-void
-_clutter_event_set_state_full (ClutterEvent *event,
- ClutterModifierType button_state,
- ClutterModifierType base_state,
- ClutterModifierType latched_state,
- ClutterModifierType locked_state,
- ClutterModifierType effective_state)
-{
- ClutterEventPrivate *private = (ClutterEventPrivate*) event;
-
- private->button_state = button_state;
- private->base_state = base_state;
- private->latched_state = latched_state;
- private->locked_state = locked_state;
-
- clutter_event_set_state (event, effective_state);
-}
-
-/**
- * clutter_event_get_state_full:
- * @event: a #ClutterEvent
- * @button_state: (out) (allow-none): the pressed buttons as a mask
- * @base_state: (out) (allow-none): the regular pressed modifier keys
- * @latched_state: (out) (allow-none): the latched modifier keys (currently released but still valid for one key press/release)
- * @locked_state: (out) (allow-none): the locked modifier keys (valid until the lock key is pressed and released again)
- * @effective_state: (out) (allow-none): the logical OR of all the state bits above
- *
- * Retrieves the decomposition of the keyboard state into button, base,
- * latched, locked and effective. This can be used to transmit to other
- * applications, for example when implementing a wayland compositor.
- *
- * Since: 1.16
- */
-void
-clutter_event_get_state_full (const ClutterEvent *event,
- ClutterModifierType *button_state,
- ClutterModifierType *base_state,
- ClutterModifierType *latched_state,
- ClutterModifierType *locked_state,
- ClutterModifierType *effective_state)
-{
- const ClutterEventPrivate *private = (const ClutterEventPrivate*) event;
-
- g_return_if_fail (event != NULL);
-
- if (button_state)
- *button_state = private->button_state;
- if (base_state)
- *base_state = private->base_state;
- if (latched_state)
- *latched_state = private->latched_state;
- if (locked_state)
- *locked_state = private->locked_state;
- if (effective_state)
- *effective_state = clutter_event_get_state (event);
-}
-
-/**
- * clutter_event_get_coords:
- * @event: a #ClutterEvent
- * @x: (out): return location for the X coordinate, or %NULL
- * @y: (out): return location for the Y coordinate, or %NULL
- *
- * Retrieves the coordinates of @event and puts them into @x and @y.
- *
- * Since: 0.4
- */
-void
-clutter_event_get_coords (const ClutterEvent *event,
- gfloat *x,
- gfloat *y)
-{
- graphene_point_t coords;
-
- g_return_if_fail (event != NULL);
-
- clutter_event_get_position (event, &coords);
-
- if (x != NULL)
- *x = coords.x;
-
- if (y != NULL)
- *y = coords.y;
-}
-
-/**
- * clutter_event_get_position:
- * @event: a #ClutterEvent
- * @position: a #graphene_point_t
- *
- * Retrieves the event coordinates as a #graphene_point_t.
- *
- * Since: 1.12
- */
-void
-clutter_event_get_position (const ClutterEvent *event,
- graphene_point_t *position)
-{
- g_return_if_fail (event != NULL);
- g_return_if_fail (position != NULL);
-
- switch (event->type)
- {
- case CLUTTER_NOTHING:
- case CLUTTER_KEY_PRESS:
- case CLUTTER_KEY_RELEASE:
- case CLUTTER_EVENT_LAST:
- case CLUTTER_PROXIMITY_IN:
- case CLUTTER_PROXIMITY_OUT:
- case CLUTTER_PAD_BUTTON_PRESS:
- case CLUTTER_PAD_BUTTON_RELEASE:
- case CLUTTER_PAD_STRIP:
- case CLUTTER_PAD_RING:
- case CLUTTER_DEVICE_ADDED:
- case CLUTTER_DEVICE_REMOVED:
- case CLUTTER_IM_COMMIT:
- case CLUTTER_IM_DELETE:
- case CLUTTER_IM_PREEDIT:
- graphene_point_init (position, 0.f, 0.f);
- break;
-
- case CLUTTER_ENTER:
- case CLUTTER_LEAVE:
- graphene_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);
- break;
-
- case CLUTTER_MOTION:
- graphene_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);
- break;
-
- case CLUTTER_SCROLL:
- graphene_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);
- break;
-
- case CLUTTER_TOUCHPAD_SWIPE:
- graphene_point_init (position, event->touchpad_swipe.x,
- event->touchpad_swipe.y);
- break;
- }
-
-}
-
-/**
- * clutter_event_set_coords:
- * @event: a #ClutterEvent
- * @x: the X coordinate of the event
- * @y: the Y coordinate of the event
- *
- * Sets the coordinates of the @event.
- *
- * Since: 1.8
- */
-void
-clutter_event_set_coords (ClutterEvent *event,
- gfloat x,
- gfloat y)
-{
- g_return_if_fail (event != NULL);
-
- switch (event->type)
- {
- case CLUTTER_NOTHING:
- case CLUTTER_KEY_PRESS:
- case CLUTTER_KEY_RELEASE:
- case CLUTTER_EVENT_LAST:
- case CLUTTER_PROXIMITY_IN:
- case CLUTTER_PROXIMITY_OUT:
- case CLUTTER_PAD_BUTTON_PRESS:
- case CLUTTER_PAD_BUTTON_RELEASE:
- case CLUTTER_PAD_STRIP:
- case CLUTTER_PAD_RING:
- case CLUTTER_DEVICE_ADDED:
- case CLUTTER_DEVICE_REMOVED:
- case CLUTTER_IM_COMMIT:
- case CLUTTER_IM_DELETE:
- case CLUTTER_IM_PREEDIT:
- break;
-
- case CLUTTER_ENTER:
- case CLUTTER_LEAVE:
- event->crossing.x = x;
- event->crossing.y = y;
- break;
-
- case CLUTTER_BUTTON_PRESS:
- case CLUTTER_BUTTON_RELEASE:
- event->button.x = x;
- event->button.y = y;
- break;
-
- case CLUTTER_MOTION:
- event->motion.x = x;
- event->motion.y = y;
- break;
-
- case CLUTTER_TOUCH_BEGIN:
- case CLUTTER_TOUCH_UPDATE:
- case CLUTTER_TOUCH_END:
- case CLUTTER_TOUCH_CANCEL:
- event->touch.x = x;
- event->touch.y = y;
- break;
-
- case CLUTTER_SCROLL:
- event->scroll.x = x;
- event->scroll.y = y;
- break;
-
- case CLUTTER_TOUCHPAD_PINCH:
- event->touchpad_pinch.x = x;
- event->touchpad_pinch.y = y;
- break;
-
- case CLUTTER_TOUCHPAD_SWIPE:
- event->touchpad_swipe.x = x;
- event->touchpad_swipe.y = y;
- break;
- }
-}
-
-/**
- * clutter_event_get_source:
- * @event: a #ClutterEvent
- *
- * Retrieves the source #ClutterActor the event originated from, or
- * NULL if the event has no source.
- *
- * Return value: (transfer none): a #ClutterActor
- *
- * Since: 0.6
- */
-ClutterActor *
-clutter_event_get_source (const ClutterEvent *event)
-{
- g_return_val_if_fail (event != NULL, NULL);
-
- return event->any.source;
-}
-
-/**
- * clutter_event_set_source:
- * @event: a #ClutterEvent
- * @actor: (allow-none): a #ClutterActor, or %NULL
- *
- * Sets the source #ClutterActor of @event.
- *
- * Since: 1.8
- */
-void
-clutter_event_set_source (ClutterEvent *event,
- ClutterActor *actor)
-{
- g_return_if_fail (event != NULL);
- g_return_if_fail (actor == NULL || CLUTTER_IS_ACTOR (actor));
-
- event->any.source = actor;
-}
-
-/**
- * clutter_event_get_stage:
- * @event: a #ClutterEvent
- *
- * Retrieves the source #ClutterStage the event originated for, or
- * %NULL if the event has no stage.
- *
- * Return value: (transfer none): a #ClutterStage
- *
- * Since: 0.8
- */
-ClutterStage *
-clutter_event_get_stage (const ClutterEvent *event)
-{
- g_return_val_if_fail (event != NULL, NULL);
-
- return event->any.stage;
-}
-
-/**
- * clutter_event_set_stage:
- * @event: a #ClutterEvent
- * @stage: (allow-none): a #ClutterStage, or %NULL
- *
- * Sets the source #ClutterStage of the event.
- *
- * Since: 1.8
- */
-void
-clutter_event_set_stage (ClutterEvent *event,
- ClutterStage *stage)
-{
- g_return_if_fail (event != NULL);
- g_return_if_fail (stage == NULL || CLUTTER_IS_STAGE (stage));
-
- if (event->any.stage == stage)
- return;
-
- event->any.stage = stage;
-}
-
-/**
- * clutter_event_get_flags:
- * @event: a #ClutterEvent
- *
- * Retrieves the #ClutterEventFlags of @event
- *
- * Return value: the event flags
- *
- * Since: 1.0
- */
-ClutterEventFlags
-clutter_event_get_flags (const ClutterEvent *event)
-{
- g_return_val_if_fail (event != NULL, CLUTTER_EVENT_NONE);
-
- return event->any.flags;
-}
-
-/**
- * clutter_event_set_flags:
- * @event: a #ClutterEvent
- * @flags: a binary OR of #ClutterEventFlags values
- *
- * Sets the #ClutterEventFlags of @event
- *
- * Since: 1.8
- */
-void
-clutter_event_set_flags (ClutterEvent *event,
- ClutterEventFlags flags)
-{
- g_return_if_fail (event != NULL);
-
- if (event->any.flags == flags)
- return;
-
- event->any.flags = flags;
- event->any.flags |= CLUTTER_EVENT_FLAG_SYNTHETIC;
-}
-
-/**
- * clutter_event_get_related:
- * @event: a #ClutterEvent of type %CLUTTER_ENTER or of
- * type %CLUTTER_LEAVE
- *
- * Retrieves the related actor of a crossing event.
- *
- * Return value: (transfer none): the related #ClutterActor, or %NULL
- *
- * Since: 1.0
- */
-ClutterActor *
-clutter_event_get_related (const ClutterEvent *event)
-{
- g_return_val_if_fail (event != NULL, NULL);
- g_return_val_if_fail (event->type == CLUTTER_ENTER ||
- event->type == CLUTTER_LEAVE, NULL);
-
- return event->crossing.related;
-}
-
-/**
- * clutter_event_set_related:
- * @event: a #ClutterEvent of type %CLUTTER_ENTER or %CLUTTER_LEAVE
- * @actor: (allow-none): a #ClutterActor or %NULL
- *
- * Sets the related actor of a crossing event
- *
- * Since: 1.8
- */
-void
-clutter_event_set_related (ClutterEvent *event,
- ClutterActor *actor)
-{
- g_return_if_fail (event != NULL);
- g_return_if_fail (event->type == CLUTTER_ENTER ||
- event->type == CLUTTER_LEAVE);
- g_return_if_fail (actor == NULL || CLUTTER_IS_ACTOR (actor));
-
- if (event->crossing.related == actor)
- return;
-
- event->crossing.related = actor;
-}
-
-/**
- * clutter_event_set_scroll_delta:
- * @event: a #ClutterEvent of type %CLUTTER_SCROLL
- * @dx: delta on the horizontal axis
- * @dy: delta on the vertical axis
- *
- * Sets the precise scrolling information of @event.
- *
- * Since: 1.10
- */
-void
-clutter_event_set_scroll_delta (ClutterEvent *event,
- gdouble dx,
- gdouble dy)
-{
- g_return_if_fail (event != NULL);
- g_return_if_fail (event->type == CLUTTER_SCROLL);
-
- event->scroll.direction = CLUTTER_SCROLL_SMOOTH;
-
- ((ClutterEventPrivate *) event)->delta_x = dx;
- ((ClutterEventPrivate *) event)->delta_y = dy;
-}
-
-/**
- * clutter_event_get_scroll_delta:
- * @event: a #ClutterEvent of type %CLUTTER_SCROLL
- * @dx: (out): return location for the delta on the horizontal axis
- * @dy: (out): return location for the delta on the vertical axis
- *
- * Retrieves the precise scrolling information of @event.
- *
- * The @event has to have a #ClutterScrollEvent.direction value
- * of %CLUTTER_SCROLL_SMOOTH.
- *
- * Since: 1.10
- */
-void
-clutter_event_get_scroll_delta (const ClutterEvent *event,
- gdouble *dx,
- gdouble *dy)
-{
- gdouble delta_x, delta_y;
-
- g_return_if_fail (event != NULL);
- g_return_if_fail (event->type == CLUTTER_SCROLL);
- g_return_if_fail (event->scroll.direction == CLUTTER_SCROLL_SMOOTH);
-
- delta_x = ((ClutterEventPrivate *) event)->delta_x;
- delta_y = ((ClutterEventPrivate *) event)->delta_y;
-
- if (dx != NULL)
- *dx = delta_x;
-
- if (dy != NULL)
- *dy = delta_y;
-}
-
-/**
- * clutter_event_get_scroll_direction:
- * @event: a #ClutterEvent of type %CLUTTER_SCROLL
- *
- * Retrieves the direction of the scrolling of @event
- *
- * Return value: the scrolling direction
- *
- * Since: 1.0
- */
-ClutterScrollDirection
-clutter_event_get_scroll_direction (const ClutterEvent *event)
-{
- g_return_val_if_fail (event != NULL, CLUTTER_SCROLL_UP);
- g_return_val_if_fail (event->type == CLUTTER_SCROLL, CLUTTER_SCROLL_UP);
-
- return event->scroll.direction;
-}
-
-/**
- * clutter_event_set_scroll_direction:
- * @event: a #ClutterEvent
- * @direction: the scrolling direction
- *
- * Sets the direction of the scrolling of @event
- *
- * Since: 1.8
- */
-void
-clutter_event_set_scroll_direction (ClutterEvent *event,
- ClutterScrollDirection direction)
-{
- g_return_if_fail (event != NULL);
- g_return_if_fail (event->type == CLUTTER_SCROLL);
-
- event->scroll.direction = direction;
-}
-
-/**
- * clutter_event_get_button:
- * @event: a #ClutterEvent of type %CLUTTER_BUTTON_PRESS or
- * of type %CLUTTER_BUTTON_RELEASE
- *
- * Retrieves the button number of @event
- *
- * Return value: the button number
- *
- * Since: 1.0
- */
-guint32
-clutter_event_get_button (const ClutterEvent *event)
-{
- g_return_val_if_fail (event != NULL, 0);
- g_return_val_if_fail (event->type == CLUTTER_BUTTON_PRESS ||
- event->type == CLUTTER_BUTTON_RELEASE ||
- event->type == CLUTTER_PAD_BUTTON_PRESS ||
- event->type == CLUTTER_PAD_BUTTON_RELEASE, 0);
-
- if (event->type == CLUTTER_BUTTON_PRESS ||
- event->type == CLUTTER_BUTTON_RELEASE)
- return event->button.button;
- else
- return event->pad_button.button;
-}
-
-/**
- * clutter_event_set_button:
- * @event: a #ClutterEvent or type %CLUTTER_BUTTON_PRESS or
- * of type %CLUTTER_BUTTON_RELEASE
- * @button: the button number
- *
- * Sets the button number of @event
- *
- * Since: 1.8
- */
-void
-clutter_event_set_button (ClutterEvent *event,
- guint32 button)
-{
- g_return_if_fail (event != NULL);
- g_return_if_fail (event->type == CLUTTER_BUTTON_PRESS ||
- event->type == CLUTTER_BUTTON_RELEASE);
-
- event->button.button = button;
-}
-
-/**
- * clutter_event_get_click_count:
- * @event: a #ClutterEvent of type %CLUTTER_BUTTON_PRESS or
- * of type %CLUTTER_BUTTON_RELEASE
- *
- * Retrieves the number of clicks of @event
- *
- * Return value: the click count
- *
- * Since: 1.0
- */
-guint32
-clutter_event_get_click_count (const ClutterEvent *event)
-{
- g_return_val_if_fail (event != NULL, 0);
- g_return_val_if_fail (event->type == CLUTTER_BUTTON_PRESS ||
- event->type == CLUTTER_BUTTON_RELEASE, 0);
-
- return event->button.click_count;
-}
-
-/* keys */
-
-/**
- * clutter_event_get_key_symbol:
- * @event: a #ClutterEvent of type %CLUTTER_KEY_PRESS or
- * of type %CLUTTER_KEY_RELEASE
- *
- * Retrieves the key symbol of @event
- *
- * Return value: the key symbol representing the key
- *
- * Since: 1.0
- */
-guint
-clutter_event_get_key_symbol (const ClutterEvent *event)
-{
- g_return_val_if_fail (event != NULL, 0);
- g_return_val_if_fail (event->type == CLUTTER_KEY_PRESS ||
- event->type == CLUTTER_KEY_RELEASE, 0);
-
- return event->key.keyval;
-}
-
-/**
- * clutter_event_set_key_symbol:
- * @event: a #ClutterEvent of type %CLUTTER_KEY_PRESS
- * or %CLUTTER_KEY_RELEASE
- * @key_sym: the key symbol representing the key
- *
- * Sets the key symbol of @event.
- *
- * Since: 1.8
- */
-void
-clutter_event_set_key_symbol (ClutterEvent *event,
- guint key_sym)
-{
- g_return_if_fail (event != NULL);
- g_return_if_fail (event->type == CLUTTER_KEY_PRESS ||
- event->type == CLUTTER_KEY_RELEASE);
-
- event->key.keyval = key_sym;
-}
-
-/**
- * clutter_event_get_key_code:
- * @event: a #ClutterEvent of type %CLUTTER_KEY_PRESS or
- * of type %CLUTTER_KEY_RELEASE
- *
- * Retrieves the keycode of the key that caused @event
- *
- * Return value: The keycode representing the key
- *
- * Since: 1.0
- */
-guint16
-clutter_event_get_key_code (const ClutterEvent *event)
-{
- g_return_val_if_fail (event != NULL, 0);
- g_return_val_if_fail (event->type == CLUTTER_KEY_PRESS ||
- event->type == CLUTTER_KEY_RELEASE, 0);
-
- return event->key.hardware_keycode;
-}
-
-/**
- * clutter_event_set_key_code:
- * @event: a #ClutterEvent of type %CLUTTER_KEY_PRESS
- * or %CLUTTER_KEY_RELEASE
- * @key_code: the keycode representing the key
- *
- * Sets the keycode of the @event.
- *
- * Since: 1.8
- */
-void
-clutter_event_set_key_code (ClutterEvent *event,
- guint16 key_code)
-{
- g_return_if_fail (event != NULL);
- g_return_if_fail (event->type == CLUTTER_KEY_PRESS ||
- event->type == CLUTTER_KEY_RELEASE);
-
- event->key.hardware_keycode = key_code;
-}
-
-/**
- * clutter_event_get_key_unicode:
- * @event: a #ClutterEvent of type %CLUTTER_KEY_PRESS
- * or %CLUTTER_KEY_RELEASE
- *
- * Retrieves the unicode value for the key that caused @keyev.
- *
- * Return value: The unicode value representing the key
- */
-gunichar
-clutter_event_get_key_unicode (const ClutterEvent *event)
-{
- g_return_val_if_fail (event != NULL, 0);
- g_return_val_if_fail (event->type == CLUTTER_KEY_PRESS ||
- event->type == CLUTTER_KEY_RELEASE, 0);
-
- if (event->key.unicode_value)
- return event->key.unicode_value;
- else
- return clutter_keysym_to_unicode (event->key.keyval);
-}
-
-/**
- * clutter_event_set_key_unicode:
- * @event: a #ClutterEvent of type %CLUTTER_KEY_PRESS
- * or %CLUTTER_KEY_RELEASE
- * @key_unicode: the Unicode value representing the key
- *
- * Sets the Unicode value of @event.
- *
- * Since: 1.8
- */
-void
-clutter_event_set_key_unicode (ClutterEvent *event,
- gunichar key_unicode)
-{
- g_return_if_fail (event != NULL);
- g_return_if_fail (event->type == CLUTTER_KEY_PRESS ||
- event->type == CLUTTER_KEY_RELEASE);
-
- event->key.unicode_value = key_unicode;
-}
-
-/**
- * clutter_event_get_event_sequence:
- * @event: a #ClutterEvent of type %CLUTTER_TOUCH_BEGIN,
- * %CLUTTER_TOUCH_UPDATE, %CLUTTER_TOUCH_END, or
- * %CLUTTER_TOUCH_CANCEL
- *
- * Retrieves the #ClutterEventSequence of @event.
- *
- * Return value: (transfer none): the event sequence, or %NULL
- *
- * Since: 1.10
- */
-ClutterEventSequence *
-clutter_event_get_event_sequence (const ClutterEvent *event)
-{
- g_return_val_if_fail (event != NULL, NULL);
-
- if (event->type == CLUTTER_TOUCH_BEGIN ||
- event->type == CLUTTER_TOUCH_UPDATE ||
- event->type == CLUTTER_TOUCH_END ||
- event->type == CLUTTER_TOUCH_CANCEL)
- return event->touch.sequence;
- else if (event->type == CLUTTER_ENTER ||
- event->type == CLUTTER_LEAVE)
- return event->crossing.sequence;
-
- return NULL;
-}
-
-/**
- * clutter_event_get_device_type:
- * @event: a #ClutterEvent
- *
- * Retrieves the type of the device for @event
- *
- * Return value: the #ClutterInputDeviceType for the device, if
- * any is set
- *
- * Since: 1.0
- */
-ClutterInputDeviceType
-clutter_event_get_device_type (const ClutterEvent *event)
-{
- ClutterInputDevice *device = NULL;
-
- g_return_val_if_fail (event != NULL, CLUTTER_POINTER_DEVICE);
-
- device = clutter_event_get_device (event);
- if (device != NULL)
- return clutter_input_device_get_device_type (device);
-
- return CLUTTER_POINTER_DEVICE;
-}
-
-/**
- * clutter_event_set_device:
- * @event: a #ClutterEvent
- * @device: (allow-none): a #ClutterInputDevice, or %NULL
- *
- * Sets the device for @event.
- *
- * Since: 1.6
- */
-void
-clutter_event_set_device (ClutterEvent *event,
- ClutterInputDevice *device)
-{
- ClutterEventPrivate *real_event = (ClutterEventPrivate *) event;
-
- g_return_if_fail (event != NULL);
- g_return_if_fail (device == NULL || CLUTTER_IS_INPUT_DEVICE (device));
-
- g_set_object (&real_event->device, device);
-
- switch (event->type)
- {
- case CLUTTER_NOTHING:
- case CLUTTER_EVENT_LAST:
- case CLUTTER_IM_COMMIT:
- case CLUTTER_IM_DELETE:
- case CLUTTER_IM_PREEDIT:
- break;
-
- case CLUTTER_ENTER:
- case CLUTTER_LEAVE:
- event->crossing.device = device;
- break;
-
- case CLUTTER_BUTTON_PRESS:
- case CLUTTER_BUTTON_RELEASE:
- event->button.device = device;
- break;
-
- case CLUTTER_MOTION:
- event->motion.device = device;
- break;
-
- case CLUTTER_SCROLL:
- event->scroll.device = device;
- break;
-
- case CLUTTER_TOUCH_BEGIN:
- case CLUTTER_TOUCH_UPDATE:
- case CLUTTER_TOUCH_END:
- case CLUTTER_TOUCH_CANCEL:
- event->touch.device = device;
- break;
-
- case CLUTTER_KEY_PRESS:
- case CLUTTER_KEY_RELEASE:
- event->key.device = device;
- break;
-
- case CLUTTER_TOUCHPAD_PINCH:
- case CLUTTER_TOUCHPAD_SWIPE:
- /* Rely on priv data for these */
- break;
-
- case CLUTTER_PROXIMITY_IN:
- case CLUTTER_PROXIMITY_OUT:
- event->proximity.device = device;
- break;
-
- case CLUTTER_PAD_BUTTON_PRESS:
- case CLUTTER_PAD_BUTTON_RELEASE:
- event->pad_button.device = device;
- break;
-
- case CLUTTER_PAD_STRIP:
- event->pad_strip.device = device;
- break;
-
- case CLUTTER_PAD_RING:
- event->pad_ring.device = device;
- break;
-
- case CLUTTER_DEVICE_ADDED:
- case CLUTTER_DEVICE_REMOVED:
- event->device.device = device;
- break;
- }
-}
-
-/**
- * clutter_event_get_device:
- * @event: a #ClutterEvent
- *
- * Retrieves the #ClutterInputDevice for the event.
- * If you want the physical device the event originated from, use
- * clutter_event_get_source_device().
- *
- * The #ClutterInputDevice structure is completely opaque and should
- * be cast to the platform-specific implementation.
- *
- * Return value: (transfer none): the #ClutterInputDevice or %NULL. The
- * returned device is owned by the #ClutterEvent and it should not
- * be unreferenced
- *
- * Since: 1.0
- */
-ClutterInputDevice *
-clutter_event_get_device (const ClutterEvent *event)
-{
- ClutterInputDevice *device = NULL;
- ClutterEventPrivate *real_event = (ClutterEventPrivate *) event;
-
- g_return_val_if_fail (event != NULL, NULL);
-
- if (real_event->device != NULL)
- return real_event->device;
-
- switch (event->type)
- {
- case CLUTTER_NOTHING:
- case CLUTTER_IM_COMMIT:
- case CLUTTER_IM_DELETE:
- case CLUTTER_IM_PREEDIT:
- case CLUTTER_EVENT_LAST:
- break;
-
- case CLUTTER_ENTER:
- case CLUTTER_LEAVE:
- device = event->crossing.device;
- break;
-
- case CLUTTER_BUTTON_PRESS:
- case CLUTTER_BUTTON_RELEASE:
- device = event->button.device;
- break;
-
- case CLUTTER_MOTION:
- device = event->motion.device;
- break;
-
- case CLUTTER_SCROLL:
- device = event->scroll.device;
- break;
-
- case CLUTTER_TOUCH_BEGIN:
- case CLUTTER_TOUCH_UPDATE:
- case CLUTTER_TOUCH_END:
- case CLUTTER_TOUCH_CANCEL:
- device = event->touch.device;
- break;
-
- case CLUTTER_KEY_PRESS:
- case CLUTTER_KEY_RELEASE:
- device = event->key.device;
- break;
-
- case CLUTTER_TOUCHPAD_PINCH:
- case CLUTTER_TOUCHPAD_SWIPE:
- /* Rely on priv data for these */
- break;
-
- case CLUTTER_PROXIMITY_IN:
- case CLUTTER_PROXIMITY_OUT:
- device = event->proximity.device;
- break;
-
- case CLUTTER_PAD_BUTTON_PRESS:
- case CLUTTER_PAD_BUTTON_RELEASE:
- device = event->pad_button.device;
- break;
-
- case CLUTTER_PAD_STRIP:
- device = event->pad_strip.device;
- break;
-
- case CLUTTER_PAD_RING:
- device = event->pad_ring.device;
- break;
-
- case CLUTTER_DEVICE_ADDED:
- case CLUTTER_DEVICE_REMOVED:
- device = event->device.device;
- break;
- }
-
- return device;
-}
-
-/**
- * clutter_event_set_device_tool:
- * @event: a #ClutterEvent
- * @tool: (nullable): a #ClutterInputDeviceTool
- *
- * Sets the tool in use for this event
- *
- * Since: 1.28
- **/
-void
-clutter_event_set_device_tool (ClutterEvent *event,
- ClutterInputDeviceTool *tool)
-{
- ClutterEventPrivate *real_event = (ClutterEventPrivate *) event;
-
- g_return_if_fail (event != NULL);
-
- real_event->tool = tool;
-}
-
-/**
- * clutter_event_get_device_tool:
- * @event: a #ClutterEvent
- *
- * Returns the device tool that originated this event
- *
- * Returns: (transfer none): The tool of this event
- *
- * Since: 1.28
- **/
-ClutterInputDeviceTool *
-clutter_event_get_device_tool (const ClutterEvent *event)
-{
- ClutterEventPrivate *real_event = (ClutterEventPrivate *) event;
-
- g_return_val_if_fail (event != NULL, NULL);
-
- return real_event->tool;
-}
-
-/**
- * clutter_event_new:
- * @type: The type of event.
- *
- * Creates a new #ClutterEvent of the specified type.
- *
- * Return value: (transfer full): A newly allocated #ClutterEvent.
- */
-ClutterEvent *
-clutter_event_new (ClutterEventType type)
-{
- ClutterEvent *new_event;
- ClutterEventPrivate *priv;
-
- priv = g_new0 (ClutterEventPrivate, 1);
-
- new_event = (ClutterEvent *) priv;
- new_event->type = new_event->any.type = type;
-
- return new_event;
-}
-
-/**
- * clutter_event_copy:
- * @event: A #ClutterEvent.
- *
- * Copies @event.
- *
- * Return value: (transfer full): A newly allocated #ClutterEvent
- */
-ClutterEvent *
-clutter_event_copy (const ClutterEvent *event)
-{
- ClutterEvent *new_event;
- ClutterEventPrivate *new_real_event;
- ClutterEventPrivate *real_event = (ClutterEventPrivate *) event;
-
- g_return_val_if_fail (event != NULL, NULL);
-
- new_event = clutter_event_new (CLUTTER_NOTHING);
- new_real_event = (ClutterEventPrivate *) new_event;
-
- *new_event = *event;
-
- g_set_object (&new_real_event->device, real_event->device);
- g_set_object (&new_real_event->source_device, real_event->source_device);
- new_real_event->delta_x = real_event->delta_x;
- new_real_event->delta_y = real_event->delta_y;
- new_real_event->is_pointer_emulated = real_event->is_pointer_emulated;
- new_real_event->base_state = real_event->base_state;
- new_real_event->button_state = real_event->button_state;
- new_real_event->latched_state = real_event->latched_state;
- new_real_event->locked_state = real_event->locked_state;
- new_real_event->tool = real_event->tool;
-
- switch (event->type)
- {
- case CLUTTER_BUTTON_PRESS:
- case CLUTTER_BUTTON_RELEASE:
- if (event->button.axes != NULL)
- {
- new_event->button.axes =
- g_memdup2 (event->button.axes,
- sizeof (double) * CLUTTER_INPUT_AXIS_LAST);
- }
- break;
-
- case CLUTTER_SCROLL:
- if (event->scroll.axes != NULL)
- {
- new_event->scroll.axes =
- g_memdup2 (event->scroll.axes,
- sizeof (double) * CLUTTER_INPUT_AXIS_LAST);
- }
- break;
-
- case CLUTTER_MOTION:
- if (event->motion.axes != NULL)
- {
- new_event->motion.axes =
- g_memdup2 (event->motion.axes,
- sizeof (double) * CLUTTER_INPUT_AXIS_LAST);
- }
- break;
-
- case CLUTTER_TOUCH_BEGIN:
- case CLUTTER_TOUCH_UPDATE:
- case CLUTTER_TOUCH_END:
- case CLUTTER_TOUCH_CANCEL:
- if (event->touch.axes != NULL)
- {
- new_event->touch.axes =
- g_memdup2 (event->touch.axes,
- sizeof (double) * CLUTTER_INPUT_AXIS_LAST);
- }
- break;
-
- case CLUTTER_DEVICE_ADDED:
- case CLUTTER_DEVICE_REMOVED:
- new_event->device.device = event->device.device;
- break;
- case CLUTTER_IM_COMMIT:
- case CLUTTER_IM_PREEDIT:
- new_event->im.text = g_strdup (event->im.text);
- break;
-
- default:
- break;
- }
-
- return new_event;
-}
-
-/**
- * clutter_event_free:
- * @event: A #ClutterEvent.
- *
- * Frees all resources used by @event.
- */
-void
-clutter_event_free (ClutterEvent *event)
-{
- if (G_LIKELY (event != NULL))
- {
- ClutterEventPrivate *real_event = (ClutterEventPrivate *) event;
-
- g_clear_object (&real_event->device);
- g_clear_object (&real_event->source_device);
-
- switch (event->type)
- {
- case CLUTTER_BUTTON_PRESS:
- case CLUTTER_BUTTON_RELEASE:
- g_free (event->button.axes);
- break;
-
- case CLUTTER_MOTION:
- g_free (event->motion.axes);
- break;
-
- case CLUTTER_SCROLL:
- g_free (event->scroll.axes);
- break;
-
- case CLUTTER_TOUCH_BEGIN:
- case CLUTTER_TOUCH_UPDATE:
- case CLUTTER_TOUCH_END:
- case CLUTTER_TOUCH_CANCEL:
- g_free (event->touch.axes);
- break;
-
- case CLUTTER_IM_COMMIT:
- case CLUTTER_IM_PREEDIT:
- g_free (event->im.text);
- break;
-
- default:
- break;
- }
-
- g_free ((ClutterEventPrivate *) event);
- }
-}
-
-/**
- * clutter_event_get:
- *
- * Pops an event off the event queue. Applications should not need to call
- * this.
- *
- * Return value: A #ClutterEvent or NULL if queue empty
- *
- * Since: 0.4
- */
-ClutterEvent *
-clutter_event_get (void)
-{
- ClutterMainContext *context = _clutter_context_get_default ();
- ClutterEvent *event;
-
- event = g_async_queue_try_pop (context->events_queue);
-
- return event;
-}
-
-void
-_clutter_event_push (const ClutterEvent *event,
- gboolean do_copy)
-{
- ClutterMainContext *context = _clutter_context_get_default ();
-
- g_assert (context != NULL);
-
- if (do_copy)
- {
- ClutterEvent *copy;
-
- copy = clutter_event_copy (event);
- event = copy;
- }
-
- g_async_queue_push (context->events_queue, (gpointer) event);
- g_main_context_wakeup (NULL);
-}
-
-/**
- * clutter_event_put:
- * @event: a #ClutterEvent
- *
- * Puts a copy of the event on the back of the event queue. The event will
- * have the %CLUTTER_EVENT_FLAG_SYNTHETIC flag set. If the source is set
- * event signals will be emitted for this source and capture/bubbling for
- * its ancestors. If the source is not set it will be generated by picking
- * or use the actor that currently has keyboard focus
- *
- * Since: 0.6
- */
-void
-clutter_event_put (const ClutterEvent *event)
-{
- _clutter_event_push (event, TRUE);
-}
-
-/**
- * clutter_events_pending:
- *
- * Checks if events are pending in the event queue.
- *
- * Return value: TRUE if there are pending events, FALSE otherwise.
- *
- * Since: 0.4
- */
-gboolean
-clutter_events_pending (void)
-{
- ClutterMainContext *context = _clutter_context_get_default ();
-
- g_return_val_if_fail (context != NULL, FALSE);
-
- return g_async_queue_length (context->events_queue) > 0;
-}
-
-/**
- * clutter_get_current_event_time:
- *
- * Retrieves the timestamp of the last event, if there is an
- * event or if the event has a timestamp.
- *
- * Return value: the event timestamp, or %CLUTTER_CURRENT_TIME
- *
- * Since: 1.0
- */
-guint32
-clutter_get_current_event_time (void)
-{
- const ClutterEvent* event;
-
- event = clutter_get_current_event ();
-
- if (event != NULL)
- return clutter_event_get_time (event);
-
- return CLUTTER_CURRENT_TIME;
-}
-
-/**
- * clutter_get_current_event:
- *
- * If an event is currently being processed, return that event.
- * This function is intended to be used to access event state
- * that might not be exposed by higher-level widgets. For
- * example, to get the key modifier state from a Button 'clicked'
- * event.
- *
- * Return value: (transfer none): The current ClutterEvent, or %NULL if none
- *
- * Since: 1.2
- */
-const ClutterEvent *
-clutter_get_current_event (void)
-{
- ClutterMainContext *context = _clutter_context_get_default ();
-
- g_return_val_if_fail (context != NULL, NULL);
-
- return context->current_event != NULL ? context->current_event->data : NULL;
-}
-
-/**
- * clutter_event_get_source_device:
- * @event: a #ClutterEvent
- *
- * Retrieves the hardware device that originated the event.
- *
- * If you need the virtual device, use clutter_event_get_device().
- *
- * If no hardware device originated this event, this function will
- * return the same device as clutter_event_get_device().
- *
- * Return value: (transfer none): a pointer to a #ClutterInputDevice
- * or %NULL
- *
- * Since: 1.6
- */
-ClutterInputDevice *
-clutter_event_get_source_device (const ClutterEvent *event)
-{
- ClutterEventPrivate *real_event;
-
- real_event = (ClutterEventPrivate *) event;
-
- if (real_event->source_device != NULL)
- return real_event->source_device;
-
- return clutter_event_get_device (event);
-}
-
-/**
- * clutter_event_set_source_device:
- * @event: a #ClutterEvent
- * @device: (allow-none): a #ClutterInputDevice
- *
- * Sets the source #ClutterInputDevice for @event.
- *
- * The #ClutterEvent must have been created using clutter_event_new().
- *
- * Since: 1.8
- */
-void
-clutter_event_set_source_device (ClutterEvent *event,
- ClutterInputDevice *device)
-{
- ClutterEventPrivate *real_event;
-
- g_return_if_fail (event != NULL);
- g_return_if_fail (device == NULL || CLUTTER_IS_INPUT_DEVICE (device));
-
- real_event = (ClutterEventPrivate *) event;
- g_set_object (&real_event->source_device, device);
-}
-
-/**
- * clutter_event_get_axes:
- * @event: a #ClutterEvent
- * @n_axes: (out): return location for the number of axes returned
- *
- * Retrieves the array of axes values attached to the event.
- *
- * Return value: (transfer none): an array of axis values
- *
- * Since: 1.6
- */
-gdouble *
-clutter_event_get_axes (const ClutterEvent *event,
- guint *n_axes)
-{
- gdouble *retval = NULL;
-
- switch (event->type)
- {
- case CLUTTER_NOTHING:
- case CLUTTER_ENTER:
- case CLUTTER_LEAVE:
- case CLUTTER_KEY_PRESS:
- case CLUTTER_KEY_RELEASE:
- case CLUTTER_EVENT_LAST:
- case CLUTTER_PROXIMITY_IN:
- case CLUTTER_PROXIMITY_OUT:
- case CLUTTER_DEVICE_ADDED:
- case CLUTTER_DEVICE_REMOVED:
- break;
-
- case CLUTTER_SCROLL:
- retval = event->scroll.axes;
- break;
-
- case CLUTTER_BUTTON_PRESS:
- case CLUTTER_BUTTON_RELEASE:
- retval = event->button.axes;
- break;
-
- case CLUTTER_TOUCH_BEGIN:
- case CLUTTER_TOUCH_UPDATE:
- case CLUTTER_TOUCH_END:
- case CLUTTER_TOUCH_CANCEL:
- retval = event->touch.axes;
- break;
-
- case CLUTTER_MOTION:
- retval = event->motion.axes;
- break;
-
- case CLUTTER_TOUCHPAD_PINCH:
- case CLUTTER_TOUCHPAD_SWIPE:
- case CLUTTER_PAD_BUTTON_PRESS:
- case CLUTTER_PAD_BUTTON_RELEASE:
- case CLUTTER_PAD_STRIP:
- case CLUTTER_PAD_RING:
- case CLUTTER_IM_COMMIT:
- case CLUTTER_IM_DELETE:
- case CLUTTER_IM_PREEDIT:
- break;
- }
-
- if (n_axes)
- *n_axes = CLUTTER_INPUT_AXIS_LAST;
-
- return retval;
-}
-
-/**
- * clutter_event_get_distance:
- * @source: a #ClutterEvent
- * @target: a #ClutterEvent
- *
- * Retrieves the distance between two events, a @source and a @target.
- *
- * Return value: the distance between two #ClutterEvent
- *
- * Since: 1.12
- */
-float
-clutter_event_get_distance (const ClutterEvent *source,
- const ClutterEvent *target)
-{
- graphene_point_t p0, p1;
-
- clutter_event_get_position (source, &p0);
- clutter_event_get_position (source, &p1);
-
- return graphene_point_distance (&p0, &p1, NULL, NULL);
-}
-
-/**
- * clutter_event_get_angle:
- * @source: a #ClutterEvent
- * @target: a #ClutterEvent
- *
- * Retrieves the angle relative from @source to @target.
- *
- * The direction of the angle is from the position X axis towards
- * the positive Y axis.
- *
- * Return value: the angle between two #ClutterEvent
- *
- * Since: 1.12
- */
-double
-clutter_event_get_angle (const ClutterEvent *source,
- const ClutterEvent *target)
-{
- graphene_point_t 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))
- return 0;
-
- graphene_point_distance (&p0, &p1, &x_distance, &y_distance);
-
- angle = atan2 (x_distance, y_distance);
-
- /* invert the angle, and shift it by 90 degrees */
- angle = (2.0 * G_PI) - angle;
- angle += G_PI / 2.0;
-
- /* keep the angle within the [ 0, 360 ] interval */
- angle = fmod (angle, 2.0 * G_PI);
-
- return angle;
-}
-
-/**
- * clutter_event_has_shift_modifier:
- * @event: a #ClutterEvent
- *
- * Checks whether @event has the Shift modifier mask set.
- *
- * Return value: %TRUE if the event has the Shift modifier mask set
- *
- * Since: 1.12
- */
-gboolean
-clutter_event_has_shift_modifier (const ClutterEvent *event)
-{
- return (clutter_event_get_state (event) & CLUTTER_SHIFT_MASK) != FALSE;
-}
-
-/**
- * clutter_event_has_control_modifier:
- * @event: a #ClutterEvent
- *
- * Checks whether @event has the Control modifier mask set.
- *
- * Return value: %TRUE if the event has the Control modifier mask set
- *
- * Since: 1.12
- */
-gboolean
-clutter_event_has_control_modifier (const ClutterEvent *event)
-{
- return (clutter_event_get_state (event) & CLUTTER_CONTROL_MASK) != FALSE;
-}
-
-/**
- * clutter_event_is_pointer_emulated:
- * @event: a #ClutterEvent
- *
- * Checks whether a pointer @event has been generated by the windowing
- * system. The returned value can be used to distinguish between events
- * synthesized by the windowing system itself (as opposed by Clutter).
- *
- * Return value: %TRUE if the event is pointer emulated
- *
- * Since: 1.12
- */
-gboolean
-clutter_event_is_pointer_emulated (const ClutterEvent *event)
-{
- g_return_val_if_fail (event != NULL, FALSE);
-
- return ((ClutterEventPrivate *) event)->is_pointer_emulated;
-}
-
-gboolean
-_clutter_event_process_filters (ClutterEvent *event)
-{
- ClutterMainContext *context = _clutter_context_get_default ();
- GList *l, *next;
-
- /* Event filters are handled in order from least recently added to
- * most recently added */
-
- for (l = context->event_filters; l; l = next)
- {
- ClutterEventFilter *event_filter = l->data;
-
- next = l->next;
-
- if (event_filter->stage && event_filter->stage != event->any.stage)
- continue;
-
- if (event_filter->func (event, event_filter->user_data) == CLUTTER_EVENT_STOP)
- return CLUTTER_EVENT_STOP;
- }
-
- return CLUTTER_EVENT_PROPAGATE;
-}
-
-/**
- * clutter_event_add_filter:
- * @stage: (allow-none): The #ClutterStage to capture events for
- * @func: The callback function which will be passed all events.
- * @notify: A #GDestroyNotify
- * @user_data: A data pointer to pass to the function.
- *
- * Adds a function which will be called for all events that Clutter
- * processes. The function will be called before any signals are
- * emitted for the event and it will take precedence over any grabs.
- *
- * Return value: an identifier for the event filter, to be used
- * with clutter_event_remove_filter().
- *
- * Since: 1.18
- */
-guint
-clutter_event_add_filter (ClutterStage *stage,
- ClutterEventFilterFunc func,
- GDestroyNotify notify,
- gpointer user_data)
-{
- ClutterMainContext *context = _clutter_context_get_default ();
- ClutterEventFilter *event_filter = g_new0 (ClutterEventFilter, 1);
- static guint event_filter_id = 0;
-
- event_filter->stage = stage;
- event_filter->id = ++event_filter_id;
- event_filter->func = func;
- event_filter->notify = notify;
- event_filter->user_data = user_data;
-
- /* The event filters are kept in order from least recently added to
- * most recently added so we must add it to the end */
- context->event_filters = g_list_append (context->event_filters, event_filter);
-
- return event_filter->id;
-}
-
-/**
- * clutter_event_remove_filter:
- * @id: The ID of the event filter, as returned from clutter_event_add_filter()
- *
- * Removes an event filter that was previously added with
- * clutter_event_add_filter().
- *
- * Since: 1.18
- */
-void
-clutter_event_remove_filter (guint id)
-{
- ClutterMainContext *context = _clutter_context_get_default ();
- GList *l;
-
- for (l = context->event_filters; l; l = l->next)
- {
- ClutterEventFilter *event_filter = l->data;
-
- if (event_filter->id == id)
- {
- if (event_filter->notify)
- event_filter->notify (event_filter->user_data);
-
- context->event_filters = g_list_delete_link (context->event_filters, l);
- g_free (event_filter);
- return;
- }
- }
-
- g_warning ("No event filter found for id: %d\n", id);
-}
-
-/**
- * clutter_event_get_touchpad_gesture_finger_count:
- * @event: a touchpad swipe/pinch event
- *
- * Returns the number of fingers that is triggering the touchpad gesture.
- *
- * Returns: the number of fingers in the gesture.
- *
- * Since: 1.24
- **/
-guint
-clutter_event_get_touchpad_gesture_finger_count (const ClutterEvent *event)
-{
- g_return_val_if_fail (event != NULL, 0);
- g_return_val_if_fail (event->type == CLUTTER_TOUCHPAD_SWIPE ||
- event->type == CLUTTER_TOUCHPAD_PINCH, 0);
-
- if (event->type == CLUTTER_TOUCHPAD_SWIPE)
- return event->touchpad_swipe.n_fingers;
- else if (event->type == CLUTTER_TOUCHPAD_PINCH)
- return event->touchpad_pinch.n_fingers;
-
- return 0;
-}
-
-/**
- * clutter_event_get_gesture_pinch_angle_delta:
- * @event: a touchpad pinch event
- *
- * Returns the angle delta reported by this specific event.
- *
- * Returns: The angle delta relative to the previous event.
- *
- * Since: 1.24
- **/
-gdouble
-clutter_event_get_gesture_pinch_angle_delta (const ClutterEvent *event)
-{
- g_return_val_if_fail (event != NULL, 0);
- g_return_val_if_fail (event->type == CLUTTER_TOUCHPAD_PINCH, 0);
-
- return event->touchpad_pinch.angle_delta;
-}
-
-/**
- * clutter_event_get_gesture_pinch_scale:
- * @event: a touchpad pinch event
- *
- * Returns the current scale as reported by @event, 1.0 being the original
- * distance at the time the corresponding event with phase
- * %CLUTTER_TOUCHPAD_GESTURE_PHASE_BEGIN is received.
- * is received.
- *
- * Returns: the current pinch gesture scale
- *
- * Since: 1.24
- **/
-gdouble
-clutter_event_get_gesture_pinch_scale (const ClutterEvent *event)
-{
- g_return_val_if_fail (event != NULL, 0);
- g_return_val_if_fail (event->type == CLUTTER_TOUCHPAD_PINCH, 0);
-
- return event->touchpad_pinch.scale;
-}
-
-/**
- * clutter_event_get_gesture_phase:
- * @event: a touchpad gesture event
- *
- * Returns the phase of the event, See #ClutterTouchpadGesturePhase.
- *
- * Returns: the phase of the gesture event.
- **/
-ClutterTouchpadGesturePhase
-clutter_event_get_gesture_phase (const ClutterEvent *event)
-{
- g_return_val_if_fail (event != NULL, 0);
- g_return_val_if_fail (event->type == CLUTTER_TOUCHPAD_PINCH ||
- event->type == CLUTTER_TOUCHPAD_SWIPE, 0);
-
- if (event->type == CLUTTER_TOUCHPAD_PINCH)
- return event->touchpad_pinch.phase;
- else if (event->type == CLUTTER_TOUCHPAD_SWIPE)
- return event->touchpad_swipe.phase;
-
- /* Shouldn't ever happen */
- return CLUTTER_TOUCHPAD_GESTURE_PHASE_BEGIN;
-};
-
-/**
- * clutter_event_get_gesture_motion_delta:
- * @event: A clutter touchpad gesture event
- * @dx: (out) (allow-none): the displacement relative to the pointer
- * position in the X axis, or %NULL
- * @dy: (out) (allow-none): the displacement relative to the pointer
- * position in the Y axis, or %NULL
- *
- * Returns the gesture motion deltas relative to the current pointer
- * position.
- *
- * Since: 1.24
- **/
-void
-clutter_event_get_gesture_motion_delta (const ClutterEvent *event,
- gdouble *dx,
- gdouble *dy)
-{
- g_return_if_fail (event != NULL);
- g_return_if_fail (event->type == CLUTTER_TOUCHPAD_PINCH ||
- event->type == CLUTTER_TOUCHPAD_SWIPE);
-
- if (event->type == CLUTTER_TOUCHPAD_PINCH)
- {
- if (dx)
- *dx = event->touchpad_pinch.dx;
- if (dy)
- *dy = event->touchpad_pinch.dy;
- }
- else if (event->type == CLUTTER_TOUCHPAD_SWIPE)
- {
- if (dx)
- *dx = event->touchpad_swipe.dx;
- if (dy)
- *dy = event->touchpad_swipe.dy;
- }
-}
-
-/**
- * clutter_event_get_gesture_motion_delta_unaccelerated:
- * @event: A clutter touchpad gesture event
- * @dx: (out) (allow-none): the displacement relative to the pointer
- * position in the X axis, or %NULL
- * @dy: (out) (allow-none): the displacement relative to the pointer
- * position in the Y axis, or %NULL
- *
- * Returns the unaccelerated gesture motion deltas relative to the current
- * pointer position. Unlike clutter_event_get_gesture_motion_delta(),
- * pointer acceleration is ignored.
- **/
-void
-clutter_event_get_gesture_motion_delta_unaccelerated (const ClutterEvent *event,
- gdouble *dx,
- gdouble *dy)
-{
- g_return_if_fail (event != NULL);
- g_return_if_fail (event->type == CLUTTER_TOUCHPAD_PINCH ||
- event->type == CLUTTER_TOUCHPAD_SWIPE);
-
- if (event->type == CLUTTER_TOUCHPAD_PINCH)
- {
- if (dx)
- *dx = event->touchpad_pinch.dx_unaccel;
- if (dy)
- *dy = event->touchpad_pinch.dy_unaccel;
- }
- else if (event->type == CLUTTER_TOUCHPAD_SWIPE)
- {
- if (dx)
- *dx = event->touchpad_swipe.dx_unaccel;
- if (dy)
- *dy = event->touchpad_swipe.dy_unaccel;
- }
-}
-/**
- * clutter_event_get_scroll_source:
- * @event: an scroll event
- *
- * Returns the #ClutterScrollSource that applies to an scroll event.
- *
- * Returns: The source of scroll events
- *
- * Since: 1.26
- **/
-ClutterScrollSource
-clutter_event_get_scroll_source (const ClutterEvent *event)
-{
- g_return_val_if_fail (event != NULL, CLUTTER_SCROLL_SOURCE_UNKNOWN);
- g_return_val_if_fail (event->type == CLUTTER_SCROLL,
- CLUTTER_SCROLL_SOURCE_UNKNOWN);
-
- return event->scroll.scroll_source;
-}
-
-/**
- * clutter_event_get_scroll_finish_flags:
- * @event: an scroll event
- *
- * Returns the #ClutterScrollFinishFlags of an scroll event. Those
- * can be used to determine whether post-scroll effects like kinetic
- * scrolling should be applied.
- *
- * Returns: The scroll finish flags
- *
- * Since: 1.26
- **/
-ClutterScrollFinishFlags
-clutter_event_get_scroll_finish_flags (const ClutterEvent *event)
-{
- g_return_val_if_fail (event != NULL, CLUTTER_SCROLL_FINISHED_NONE);
- g_return_val_if_fail (event->type == CLUTTER_SCROLL,
- CLUTTER_SCROLL_FINISHED_NONE);
-
- return event->scroll.finish_flags;
-}
-
-guint
-clutter_event_get_mode_group (const ClutterEvent *event)
-{
- g_return_val_if_fail (event->type == CLUTTER_PAD_BUTTON_PRESS ||
- event->type == CLUTTER_PAD_BUTTON_RELEASE ||
- event->type == CLUTTER_PAD_RING ||
- event->type == CLUTTER_PAD_STRIP, 0);
- switch (event->type)
- {
- case CLUTTER_PAD_BUTTON_PRESS:
- case CLUTTER_PAD_BUTTON_RELEASE:
- return event->pad_button.group;
- case CLUTTER_PAD_RING:
- return event->pad_ring.group;
- case CLUTTER_PAD_STRIP:
- return event->pad_strip.group;
- default:
- return 0;
- }
-}
-
-/**
- * clutter_event_get_pad_event_details:
- * @event: a pad event
- * @number: (out) (optional): ring/strip/button number
- * @mode: (out) (optional): pad mode as per the event
- * @value: (out) (optional): event axis value
- *
- * Returns the details of a pad event.
- *
- * Returns: #TRUE if event details could be obtained
- **/
-gboolean
-clutter_event_get_pad_event_details (const ClutterEvent *event,
- guint *number,
- guint *mode,
- gdouble *value)
-{
- guint n, m;
- gdouble v;
-
- g_return_val_if_fail (event != NULL, FALSE);
- g_return_val_if_fail (event->type == CLUTTER_PAD_BUTTON_PRESS ||
- event->type == CLUTTER_PAD_BUTTON_RELEASE ||
- event->type == CLUTTER_PAD_RING ||
- event->type == CLUTTER_PAD_STRIP, FALSE);
-
- switch (event->type)
- {
- case CLUTTER_PAD_BUTTON_PRESS:
- case CLUTTER_PAD_BUTTON_RELEASE:
- n = event->pad_button.button;
- m = event->pad_button.mode;
- v = 0.0;
- break;
- case CLUTTER_PAD_RING:
- n = event->pad_ring.ring_number;
- m = event->pad_ring.mode;
- v = event->pad_ring.angle;
- break;
- case CLUTTER_PAD_STRIP:
- n = event->pad_strip.strip_number;
- m = event->pad_strip.mode;
- v = event->pad_strip.value;
- break;
- default:
- return FALSE;
- }
-
- if (number)
- *number = n;
- if (mode)
- *mode = m;
- if (value)
- *value = v;
-
- return TRUE;
-}
-
-uint32_t
-clutter_event_get_event_code (const ClutterEvent *event)
-{
- if (event->type == CLUTTER_KEY_PRESS ||
- event->type == CLUTTER_KEY_RELEASE)
- return event->key.evdev_code;
- else if (event->type == CLUTTER_BUTTON_PRESS ||
- event->type == CLUTTER_BUTTON_RELEASE)
- return event->button.evdev_code;
-
- return 0;
-}
-
-int32_t
-clutter_event_sequence_get_slot (const ClutterEventSequence *sequence)
-{
- g_return_val_if_fail (sequence != NULL, -1);
-
- return GPOINTER_TO_INT (sequence) - 1;
-}
-
-int64_t
-clutter_event_get_time_us (const ClutterEvent *event)
-{
- if (event->type == CLUTTER_MOTION)
- return event->motion.time_us;
-
- return 0;
-}
-
-gboolean
-clutter_event_get_relative_motion (const ClutterEvent *event,
- double *dx,
- double *dy,
- double *dx_unaccel,
- double *dy_unaccel)
-{
- if (event->type == CLUTTER_MOTION &&
- event->motion.flags & CLUTTER_EVENT_FLAG_RELATIVE_MOTION)
- {
- if (dx)
- *dx = event->motion.dx;
- if (dy)
- *dy = event->motion.dy;
- if (dx_unaccel)
- *dx_unaccel = event->motion.dx_unaccel;
- if (dy_unaccel)
- *dy_unaccel = event->motion.dy_unaccel;
-
- return TRUE;
- }
- else
- return FALSE;
-}
diff --git a/clutter/clutter/clutter-event.h b/clutter/clutter/clutter-event.h
deleted file mode 100644
index b77e64d15..000000000
--- a/clutter/clutter/clutter-event.h
+++ /dev/null
@@ -1,829 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- *
- * Copyright (C) 2006 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 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_EVENT_H__
-#define __CLUTTER_EVENT_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-types.h>
-#include <clutter/clutter-input-device.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_EVENT (clutter_event_get_type ())
-#define CLUTTER_TYPE_EVENT_SEQUENCE (clutter_event_sequence_get_type ())
-
-/**
- * CLUTTER_PRIORITY_EVENTS:
- *
- * Priority for event handling.
- *
- * Since: 0.4
- */
-#define CLUTTER_PRIORITY_EVENTS (G_PRIORITY_DEFAULT)
-
-/**
- * CLUTTER_CURRENT_TIME:
- *
- * Default value for "now".
- *
- * Since: 0.4
- */
-#define CLUTTER_CURRENT_TIME (0L)
-
-/**
- * CLUTTER_EVENT_PROPAGATE:
- *
- * Continues the propagation of an event; this macro should be
- * used in event-related signals.
- *
- * Since: 1.10
- */
-#define CLUTTER_EVENT_PROPAGATE (FALSE)
-
-/**
- * CLUTTER_EVENT_STOP:
- *
- * Stops the propagation of an event; this macro should be used
- * in event-related signals.
- *
- * Since: 1.10
- */
-#define CLUTTER_EVENT_STOP (TRUE)
-
-/**
- * CLUTTER_BUTTON_PRIMARY:
- *
- * The primary button of a pointer device.
- *
- * This is typically the left mouse button in a right-handed
- * mouse configuration.
- *
- * Since: 1.10
- */
-#define CLUTTER_BUTTON_PRIMARY (1)
-
-/**
- * CLUTTER_BUTTON_MIDDLE:
- *
- * The middle button of a pointer device.
- *
- * Since: 1.10
- */
-#define CLUTTER_BUTTON_MIDDLE (2)
-
-/**
- * CLUTTER_BUTTON_SECONDARY:
- *
- * The secondary button of a pointer device.
- *
- * This is typically the right mouse button in a right-handed
- * mouse configuration.
- *
- * Since: 1.10
- */
-#define CLUTTER_BUTTON_SECONDARY (3)
-
-typedef struct _ClutterAnyEvent ClutterAnyEvent;
-typedef struct _ClutterButtonEvent ClutterButtonEvent;
-typedef struct _ClutterKeyEvent ClutterKeyEvent;
-typedef struct _ClutterMotionEvent ClutterMotionEvent;
-typedef struct _ClutterScrollEvent ClutterScrollEvent;
-typedef struct _ClutterCrossingEvent ClutterCrossingEvent;
-typedef struct _ClutterTouchEvent ClutterTouchEvent;
-typedef struct _ClutterTouchpadPinchEvent ClutterTouchpadPinchEvent;
-typedef struct _ClutterTouchpadSwipeEvent ClutterTouchpadSwipeEvent;
-typedef struct _ClutterProximityEvent ClutterProximityEvent;
-typedef struct _ClutterPadButtonEvent ClutterPadButtonEvent;
-typedef struct _ClutterPadStripEvent ClutterPadStripEvent;
-typedef struct _ClutterPadRingEvent ClutterPadRingEvent;
-typedef struct _ClutterDeviceEvent ClutterDeviceEvent;
-typedef struct _ClutterIMEvent ClutterIMEvent;
-
-/**
- * ClutterAnyEvent:
- * @type: event type
- * @time: event time
- * @flags: event flags
- * @source: event source actor
- *
- * Common members for a #ClutterEvent
- *
- * Since: 0.2
- */
-struct _ClutterAnyEvent
-{
- ClutterEventType type;
- guint32 time;
- ClutterEventFlags flags;
- ClutterStage *stage;
- ClutterActor *source;
-};
-
-/**
- * ClutterKeyEvent:
- * @type: event type
- * @time: event time
- * @flags: event flags
- * @stage: event source stage
- * @source: event source actor
- * @modifier_state: key modifiers
- * @keyval: raw key value
- * @hardware_keycode: raw hardware key value
- * @unicode_value: Unicode representation
- * @device: the device that originated the event. If you want the physical
- * device the event originated from, use clutter_event_get_source_device()
- *
- * Key event
- *
- * Since: 0.2
- */
-struct _ClutterKeyEvent
-{
- ClutterEventType type;
- guint32 time;
- ClutterEventFlags flags;
- ClutterStage *stage;
- ClutterActor *source;
-
- ClutterModifierType modifier_state;
- guint keyval;
- guint16 hardware_keycode;
- gunichar unicode_value;
- uint32_t evdev_code;
- ClutterInputDevice *device;
-};
-
-/**
- * ClutterButtonEvent:
- * @type: event type
- * @time: event time
- * @flags: event flags
- * @stage: event source stage
- * @source: event source actor
- * @x: event X coordinate, relative to the stage
- * @y: event Y coordinate, relative to the stage
- * @modifier_state: button modifiers
- * @button: event button
- * @click_count: number of button presses within the default time
- * and radius
- * @axes: reserved for future use
- * @device: the device that originated the event. If you want the physical
- * device the event originated from, use clutter_event_get_source_device()
- *
- * Button event.
- *
- * The event coordinates are relative to the stage that received the
- * event, and can be transformed into actor-relative coordinates by
- * using clutter_actor_transform_stage_point().
- *
- * Since: 0.2
- */
-struct _ClutterButtonEvent
-{
- ClutterEventType type;
- guint32 time;
- ClutterEventFlags flags;
- ClutterStage *stage;
- ClutterActor *source;
-
- gfloat x;
- gfloat y;
- ClutterModifierType modifier_state;
- guint32 button;
- guint click_count;
- gdouble *axes; /* Future use */
- ClutterInputDevice *device;
- uint32_t evdev_code;
-};
-
-/**
- * ClutterProximityEvent:
- * @type: event type
- * @time: event time
- * @flags: event flags
- * @stage: event source stage
- * @source: event source actor
- * @device: the device that originated the event. If you want the physical
- * device the event originated from, use clutter_event_get_source_device()
- *
- * Event for tool proximity in tablet devices
- *
- * Since: 1.28
- */
-struct _ClutterProximityEvent
-{
- ClutterEventType type;
- guint32 time;
- ClutterEventFlags flags;
- ClutterStage *stage;
- ClutterActor *source;
- ClutterInputDevice *device;
-};
-
-/**
- * ClutterCrossingEvent:
- * @type: event type
- * @time: event time
- * @flags: event flags
- * @stage: event source stage
- * @source: event source actor
- * @x: event X coordinate
- * @y: event Y coordinate
- * @related: actor related to the crossing
- * @device: the device that originated the event. If you want the physical
- * device the event originated from, use clutter_event_get_source_device()
- *
- * Event for the movement of the pointer across different actors
- *
- * Since: 0.2
- */
-struct _ClutterCrossingEvent
-{
- ClutterEventType type;
- guint32 time;
- ClutterEventFlags flags;
- ClutterStage *stage;
- ClutterActor *source;
-
- gfloat x;
- gfloat y;
- ClutterInputDevice *device;
- ClutterEventSequence *sequence;
- ClutterActor *related;
-};
-
-/**
- * ClutterMotionEvent:
- * @type: event type
- * @time: event time
- * @flags: event flags
- * @stage: event source stage
- * @source: event source actor
- * @x: event X coordinate
- * @y: event Y coordinate
- * @modifier_state: button modifiers
- * @axes: reserved for future use
- * @device: the device that originated the event. If you want the physical
- * device the event originated from, use clutter_event_get_source_device()
- *
- * Event for the pointer motion
- *
- * Since: 0.2
- */
-struct _ClutterMotionEvent
-{
- ClutterEventType type;
- guint32 time;
- ClutterEventFlags flags;
- ClutterStage *stage;
- ClutterActor *source;
-
- gfloat x;
- gfloat y;
- ClutterModifierType modifier_state;
- gdouble *axes; /* Future use */
- ClutterInputDevice *device;
-
- int64_t time_us;
- double dx;
- double dy;
- double dx_unaccel;
- double dy_unaccel;
-};
-
-/**
- * ClutterScrollEvent:
- * @type: event type
- * @time: event time
- * @flags: event flags
- * @stage: event source stage
- * @source: event source actor
- * @x: event X coordinate
- * @y: event Y coordinate
- * @direction: direction of the scrolling
- * @modifier_state: button modifiers
- * @axes: reserved for future use
- * @device: the device that originated the event. If you want the physical
- * device the event originated from, use clutter_event_get_source_device()
- * @scroll_source: the source of scroll events. This field is available since 1.26
- * @finish_flags: the axes that were stopped in this event. This field is available since 1.26
- *
- * Scroll wheel (or similar device) event
- *
- * Since: 0.2
- */
-struct _ClutterScrollEvent
-{
- ClutterEventType type;
- guint32 time;
- ClutterEventFlags flags;
- ClutterStage *stage;
- ClutterActor *source;
-
- gfloat x;
- gfloat y;
- ClutterScrollDirection direction;
- ClutterModifierType modifier_state;
- gdouble *axes; /* future use */
- ClutterInputDevice *device;
- ClutterScrollSource scroll_source;
- ClutterScrollFinishFlags finish_flags;
-};
-
-/**
- * ClutterTouchEvent:
- * @type: event type
- * @time: event time
- * @flags: event flags
- * @stage: event source stage
- * @source: event source actor (unused)
- * @x: the X coordinate of the pointer, relative to the stage
- * @y: the Y coordinate of the pointer, relative to the stage
- * @sequence: the event sequence that this event belongs to
- * @modifier_state: (type ClutterModifierType): a bit-mask representing the state
- * of modifier keys (e.g. Control, Shift, and Alt) and the pointer
- * buttons. See #ClutterModifierType
- * @axes: reserved
- * @device: the device that originated the event. If you want the physical
- * device the event originated from, use clutter_event_get_source_device()
- *
- * Used for touch events.
- *
- * The @type field will be one of %CLUTTER_TOUCH_BEGIN, %CLUTTER_TOUCH_END,
- * %CLUTTER_TOUCH_UPDATE, or %CLUTTER_TOUCH_CANCEL.
- *
- * Touch events are grouped into sequences; each touch sequence will begin
- * with a %CLUTTER_TOUCH_BEGIN event, progress with %CLUTTER_TOUCH_UPDATE
- * events, and end either with a %CLUTTER_TOUCH_END event or with a
- * %CLUTTER_TOUCH_CANCEL event.
- *
- * With multi-touch capable devices there can be multiple event sequence
- * running at the same time.
- *
- * Since: 1.10
- */
-struct _ClutterTouchEvent
-{
- ClutterEventType type;
- guint32 time;
- ClutterEventFlags flags;
- ClutterStage *stage;
- ClutterActor *source;
-
- gfloat x;
- gfloat y;
- ClutterEventSequence *sequence;
- ClutterModifierType modifier_state;
- gdouble *axes; /* reserved */
- ClutterInputDevice *device;
-};
-
-/**
- * ClutterTouchpadPinchEvent:
- * @type: event type
- * @time: event time
- * @flags: event flags
- * @stage: event source stage
- * @source: event source actor (unused)
- * @phase: the current phase of the gesture
- * @x: the X coordinate of the pointer, relative to the stage
- * @y: the Y coordinate of the pointer, relative to the stage
- * @dx: movement delta of the pinch focal point in the X axis
- * @dy: movement delta of the pinch focal point in the Y axis
- * @dx_unaccel: unaccelerated movement delta of the pinch focal
- * point in the X axis
- * @dy_unaccel: unaccelerated movement delta of the pinch focal
- * point in the Y axis
- * @angle_delta: angle delta in degrees, clockwise rotations are
- * represented by positive deltas
- * @scale: the current scale
- *
- * Used for touchpad pinch gesture events. The current state of the
- * gesture will be determined by the @phase field.
- *
- * Each event with phase %CLUTTER_TOUCHPAD_GESTURE_PHASE_BEGIN
- * will report a @scale of 1.0, all later phases in the gesture
- * report the current scale relative to the initial 1.0 value
- * (eg. 0.5 being half the size, 2.0 twice as big).
- *
- * Since: 1.24
- */
-struct _ClutterTouchpadPinchEvent
-{
- ClutterEventType type;
- guint32 time;
- ClutterEventFlags flags;
- ClutterStage *stage;
- ClutterActor *source;
-
- ClutterTouchpadGesturePhase phase;
- gfloat x;
- gfloat y;
- gfloat dx;
- gfloat dy;
- gfloat dx_unaccel;
- gfloat dy_unaccel;
- gfloat angle_delta;
- gfloat scale;
- guint n_fingers;
-};
-
-/**
- * ClutterTouchpadSwipeEvent
- * @type: event type
- * @time: event time
- * @flags: event flags
- * @stage: event source stage
- * @source: event source actor (unused)
- * @phase: the current phase of the gesture
- * @n_fingers: the number of fingers triggering the swipe
- * @x: the X coordinate of the pointer, relative to the stage
- * @y: the Y coordinate of the pointer, relative to the stage
- * @dx: movement delta of the swipe center point in the X axis
- * @dy: movement delta of the swipe center point in the Y axis
- * @dx_unaccel: unaccelerated movement delta of the swipe center
- * point in the X axis
- * @dy_unaccel: unaccelerated movement delta of the swipe center
- * point in the Y axis
- *
- * Used for touchpad swipe gesture events. The current state of the
- * gesture will be determined by the @phase field.
- *
- * Since: 1.24
- */
-struct _ClutterTouchpadSwipeEvent
-{
- ClutterEventType type;
- guint32 time;
- ClutterEventFlags flags;
- ClutterStage *stage;
- ClutterActor *source;
-
- ClutterTouchpadGesturePhase phase;
- guint n_fingers;
- gfloat x;
- gfloat y;
- gfloat dx;
- gfloat dy;
- gfloat dx_unaccel;
- gfloat dy_unaccel;
-};
-
-struct _ClutterPadButtonEvent
-{
- ClutterEventType type;
- guint32 time;
- ClutterEventFlags flags;
- ClutterStage *stage;
- ClutterActor *source;
-
- guint32 button;
- guint32 group;
- ClutterInputDevice *device;
- guint32 mode;
-};
-
-struct _ClutterPadStripEvent
-{
- ClutterEventType type;
- guint32 time;
- ClutterEventFlags flags;
- ClutterStage *stage;
- ClutterActor *source;
-
- ClutterInputDevice *device;
- ClutterInputDevicePadSource strip_source;
- guint32 strip_number;
- guint32 group;
- gdouble value;
- guint32 mode;
-};
-
-struct _ClutterPadRingEvent
-{
- ClutterEventType type;
- guint32 time;
- ClutterEventFlags flags;
- ClutterStage *stage;
- ClutterActor *source;
-
- ClutterInputDevice *device;
- ClutterInputDevicePadSource ring_source;
- guint32 ring_number;
- guint32 group;
- gdouble angle;
- guint32 mode;
-};
-
-struct _ClutterDeviceEvent
-{
- ClutterEventType type;
- guint32 time;
- ClutterEventFlags flags;
- ClutterStage *stage;
- ClutterActor *source;
-
- ClutterInputDevice *device;
-};
-
-struct _ClutterIMEvent
-{
- ClutterEventType type;
- uint32_t time;
- ClutterEventFlags flags;
- ClutterStage *stage;
- ClutterActor *source;
-
- char *text;
- int32_t offset;
- uint32_t len;
-};
-
-/**
- * ClutterEvent:
- *
- * Generic event wrapper.
- *
- * Since: 0.2
- */
-union _ClutterEvent
-{
- /*< private >*/
- ClutterEventType type;
-
- ClutterAnyEvent any;
- ClutterButtonEvent button;
- ClutterKeyEvent key;
- ClutterMotionEvent motion;
- ClutterScrollEvent scroll;
- ClutterCrossingEvent crossing;
- ClutterTouchEvent touch;
- ClutterTouchpadPinchEvent touchpad_pinch;
- ClutterTouchpadSwipeEvent touchpad_swipe;
- ClutterProximityEvent proximity;
- ClutterPadButtonEvent pad_button;
- ClutterPadStripEvent pad_strip;
- ClutterPadRingEvent pad_ring;
- ClutterDeviceEvent device;
- ClutterIMEvent im;
-};
-
-/**
- * ClutterEventFilterFunc:
- * @event: the event that is going to be emitted
- * @user_data: the data pointer passed to clutter_event_add_filter()
- *
- * A function pointer type used by event filters that are added with
- * clutter_event_add_filter().
- *
- * Return value: %CLUTTER_EVENT_STOP to indicate that the event
- * has been handled or %CLUTTER_EVENT_PROPAGATE otherwise.
- * Returning %CLUTTER_EVENT_STOP skips any further filter
- * functions and prevents the signal emission for the event.
- *
- * Since: 1.18
- */
-typedef gboolean (* ClutterEventFilterFunc) (const ClutterEvent *event,
- gpointer user_data);
-
-CLUTTER_EXPORT
-GType clutter_event_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-GType clutter_event_sequence_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-gboolean clutter_events_pending (void);
-CLUTTER_EXPORT
-ClutterEvent * clutter_event_get (void);
-CLUTTER_EXPORT
-void clutter_event_put (const ClutterEvent *event);
-
-CLUTTER_EXPORT
-guint clutter_event_add_filter (ClutterStage *stage,
- ClutterEventFilterFunc func,
- GDestroyNotify notify,
- gpointer user_data);
-CLUTTER_EXPORT
-void clutter_event_remove_filter (guint id);
-
-CLUTTER_EXPORT
-ClutterEvent * clutter_event_new (ClutterEventType type);
-CLUTTER_EXPORT
-ClutterEvent * clutter_event_copy (const ClutterEvent *event);
-CLUTTER_EXPORT
-void clutter_event_free (ClutterEvent *event);
-
-CLUTTER_EXPORT
-ClutterEventType clutter_event_type (const ClutterEvent *event);
-CLUTTER_EXPORT
-void clutter_event_set_flags (ClutterEvent *event,
- ClutterEventFlags flags);
-CLUTTER_EXPORT
-ClutterEventFlags clutter_event_get_flags (const ClutterEvent *event);
-CLUTTER_EXPORT
-void clutter_event_set_time (ClutterEvent *event,
- guint32 time_);
-CLUTTER_EXPORT
-guint32 clutter_event_get_time (const ClutterEvent *event);
-CLUTTER_EXPORT
-void clutter_event_set_state (ClutterEvent *event,
- ClutterModifierType state);
-CLUTTER_EXPORT
-ClutterModifierType clutter_event_get_state (const ClutterEvent *event);
-CLUTTER_EXPORT
-void clutter_event_get_state_full (const ClutterEvent *event,
- ClutterModifierType *button_state,
- ClutterModifierType *base_state,
- ClutterModifierType *latched_state,
- ClutterModifierType *locked_state,
- ClutterModifierType *effective_state);
-CLUTTER_EXPORT
-void clutter_event_set_device (ClutterEvent *event,
- ClutterInputDevice *device);
-CLUTTER_EXPORT
-ClutterInputDevice * clutter_event_get_device (const ClutterEvent *event);
-CLUTTER_EXPORT
-void clutter_event_set_source_device (ClutterEvent *event,
- ClutterInputDevice *device);
-
-CLUTTER_EXPORT
-ClutterInputDevice * clutter_event_get_source_device (const ClutterEvent *event);
-
-CLUTTER_EXPORT
-void clutter_event_set_device_tool (ClutterEvent *event,
- ClutterInputDeviceTool *tool);
-CLUTTER_EXPORT
-ClutterInputDeviceTool *clutter_event_get_device_tool (const ClutterEvent *event);
-
-CLUTTER_EXPORT
-void clutter_event_set_source (ClutterEvent *event,
- ClutterActor *actor);
-CLUTTER_EXPORT
-ClutterActor * clutter_event_get_source (const ClutterEvent *event);
-CLUTTER_EXPORT
-void clutter_event_set_stage (ClutterEvent *event,
- ClutterStage *stage);
-CLUTTER_EXPORT
-ClutterStage * clutter_event_get_stage (const ClutterEvent *event);
-CLUTTER_EXPORT
-ClutterInputDeviceType clutter_event_get_device_type (const ClutterEvent *event);
-CLUTTER_EXPORT
-void clutter_event_set_coords (ClutterEvent *event,
- gfloat x,
- gfloat y);
-CLUTTER_EXPORT
-void clutter_event_get_coords (const ClutterEvent *event,
- gfloat *x,
- gfloat *y);
-CLUTTER_EXPORT
-void clutter_event_get_position (const ClutterEvent *event,
- graphene_point_t *position);
-CLUTTER_EXPORT
-float clutter_event_get_distance (const ClutterEvent *source,
- const ClutterEvent *target);
-CLUTTER_EXPORT
-double clutter_event_get_angle (const ClutterEvent *source,
- const ClutterEvent *target);
-CLUTTER_EXPORT
-gdouble * clutter_event_get_axes (const ClutterEvent *event,
- guint *n_axes);
-CLUTTER_EXPORT
-gboolean clutter_event_has_shift_modifier (const ClutterEvent *event);
-CLUTTER_EXPORT
-gboolean clutter_event_has_control_modifier (const ClutterEvent *event);
-CLUTTER_EXPORT
-gboolean clutter_event_is_pointer_emulated (const ClutterEvent *event);
-CLUTTER_EXPORT
-void clutter_event_set_key_symbol (ClutterEvent *event,
- guint key_sym);
-CLUTTER_EXPORT
-guint clutter_event_get_key_symbol (const ClutterEvent *event);
-CLUTTER_EXPORT
-void clutter_event_set_key_code (ClutterEvent *event,
- guint16 key_code);
-CLUTTER_EXPORT
-guint16 clutter_event_get_key_code (const ClutterEvent *event);
-CLUTTER_EXPORT
-void clutter_event_set_key_unicode (ClutterEvent *event,
- gunichar key_unicode);
-CLUTTER_EXPORT
-gunichar clutter_event_get_key_unicode (const ClutterEvent *event);
-CLUTTER_EXPORT
-void clutter_event_set_button (ClutterEvent *event,
- guint32 button);
-CLUTTER_EXPORT
-guint32 clutter_event_get_button (const ClutterEvent *event);
-CLUTTER_EXPORT
-guint clutter_event_get_click_count (const ClutterEvent *event);
-CLUTTER_EXPORT
-void clutter_event_set_related (ClutterEvent *event,
- ClutterActor *actor);
-CLUTTER_EXPORT
-ClutterActor * clutter_event_get_related (const ClutterEvent *event);
-CLUTTER_EXPORT
-void clutter_event_set_scroll_direction (ClutterEvent *event,
- ClutterScrollDirection direction);
-CLUTTER_EXPORT
-ClutterScrollDirection clutter_event_get_scroll_direction (const ClutterEvent *event);
-CLUTTER_EXPORT
-void clutter_event_set_scroll_delta (ClutterEvent *event,
- gdouble dx,
- gdouble dy);
-CLUTTER_EXPORT
-void clutter_event_get_scroll_delta (const ClutterEvent *event,
- gdouble *dx,
- gdouble *dy);
-
-CLUTTER_EXPORT
-ClutterEventSequence * clutter_event_get_event_sequence (const ClutterEvent *event);
-
-CLUTTER_EXPORT
-guint32 clutter_keysym_to_unicode (guint keyval);
-CLUTTER_EXPORT
-guint clutter_unicode_to_keysym (guint32 wc);
-
-CLUTTER_EXPORT
-guint32 clutter_get_current_event_time (void);
-CLUTTER_EXPORT
-const ClutterEvent * clutter_get_current_event (void);
-
-CLUTTER_EXPORT
-guint clutter_event_get_touchpad_gesture_finger_count (const ClutterEvent *event);
-
-CLUTTER_EXPORT
-gdouble clutter_event_get_gesture_pinch_angle_delta (const ClutterEvent *event);
-
-CLUTTER_EXPORT
-gdouble clutter_event_get_gesture_pinch_scale (const ClutterEvent *event);
-
-CLUTTER_EXPORT
-ClutterTouchpadGesturePhase clutter_event_get_gesture_phase (const ClutterEvent *event);
-
-CLUTTER_EXPORT
-void clutter_event_get_gesture_motion_delta (const ClutterEvent *event,
- gdouble *dx,
- gdouble *dy);
-
-CLUTTER_EXPORT
-void clutter_event_get_gesture_motion_delta_unaccelerated (const ClutterEvent *event,
- gdouble *dx,
- gdouble *dy);
-
-CLUTTER_EXPORT
-ClutterScrollSource clutter_event_get_scroll_source (const ClutterEvent *event);
-
-CLUTTER_EXPORT
-ClutterScrollFinishFlags clutter_event_get_scroll_finish_flags (const ClutterEvent *event);
-
-CLUTTER_EXPORT
-guint clutter_event_get_mode_group (const ClutterEvent *event);
-
-CLUTTER_EXPORT
-gboolean clutter_event_get_pad_event_details (const ClutterEvent *event,
- guint *number,
- guint *mode,
- gdouble *value);
-CLUTTER_EXPORT
-uint32_t clutter_event_get_event_code (const ClutterEvent *event);
-
-CLUTTER_EXPORT
-int32_t clutter_event_sequence_get_slot (const ClutterEventSequence *sequence);
-
-CLUTTER_EXPORT
-int64_t clutter_event_get_time_us (const ClutterEvent *event);
-CLUTTER_EXPORT
-gboolean clutter_event_get_relative_motion (const ClutterEvent *event,
- double *dx,
- double *dy,
- double *dx_unaccel,
- double *dy_unaccel);
-
-
-G_END_DECLS
-
-#endif /* __CLUTTER_EVENT_H__ */
diff --git a/clutter/clutter/clutter-feature.c b/clutter/clutter/clutter-feature.c
deleted file mode 100644
index 663d1c089..000000000
--- a/clutter/clutter/clutter-feature.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- *
- * Copyright (C) 2006 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- *
- */
-
-/**
- * SECTION:clutter-feature
- * @short_description: Run-time detection of Clutter features
- *
- * Parts of Clutter depend on the underlying platform, including the
- * capabilities of the backend used and the OpenGL features exposed through the
- * Clutter and COGL API.
- *
- * It is possible to ask whether Clutter has support for specific features at
- * run-time.
- */
-
-#include "clutter-build-config.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-
-#include "clutter-backend-private.h"
-#include "clutter-feature.h"
-#include "clutter-main.h"
-#include "clutter-private.h"
-#include "clutter-debug.h"
-
-#include "cogl/cogl.h"
-
-typedef struct ClutterFeatures
-{
- ClutterFeatureFlags flags;
- guint features_set : 1;
-} ClutterFeatures;
-
-static ClutterFeatures* __features = NULL;
-
-static ClutterFeatureFlags
-clutter_features_from_cogl (void)
-{
- ClutterFeatureFlags clutter_flags = 0;
-
- clutter_flags |= CLUTTER_FEATURE_SHADERS_GLSL;
-
- clutter_flags |= CLUTTER_FEATURE_OFFSCREEN;
-
- return clutter_flags;
-}
-
-gboolean
-_clutter_feature_init (GError **error)
-{
- ClutterMainContext *context;
-
- CLUTTER_NOTE (MISC, "checking features");
-
- if (!__features)
- {
- CLUTTER_NOTE (MISC, "allocating features data");
- __features = g_new0 (ClutterFeatures, 1);
- __features->features_set = FALSE; /* don't rely on zero-ing */
- }
-
- if (__features->features_set)
- return TRUE;
-
- context = _clutter_context_get_default ();
-
- /* makes sure we have a GL context; if we have, this is a no-op */
- if (!_clutter_backend_create_context (context->backend, error))
- return FALSE;
-
- __features->flags = (clutter_features_from_cogl ()
- | _clutter_backend_get_features (context->backend));
-
- __features->features_set = TRUE;
-
- CLUTTER_NOTE (MISC, "features checked");
-
- return TRUE;
-}
-
-/**
- * clutter_feature_available:
- * @feature: a #ClutterFeatureFlags
- *
- * Checks whether @feature is available. @feature can be a logical
- * OR of #ClutterFeatureFlags.
- *
- * Return value: %TRUE if a feature is available
- *
- * Since: 0.2
- */
-gboolean
-clutter_feature_available (ClutterFeatureFlags feature)
-{
- if (G_UNLIKELY (!__features))
- {
- g_critical ("Unable to check features. Have you initialized Clutter?");
- return FALSE;
- }
-
- return (__features->flags & feature);
-}
-
-/**
- * clutter_feature_get_all:
- *
- * Returns all the supported features.
- *
- * Return value: a logical OR of all the supported features.
- *
- * Since: 0.2
- */
-ClutterFeatureFlags
-clutter_feature_get_all (void)
-{
- if (G_UNLIKELY (!__features))
- {
- g_critical ("Unable to check features. Have you initialized Clutter?");
- return FALSE;
- }
-
- return __features->flags;
-}
-
diff --git a/clutter/clutter/clutter-feature.h b/clutter/clutter/clutter-feature.h
deleted file mode 100644
index 5c1b12449..000000000
--- a/clutter/clutter/clutter-feature.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- *
- * Copyright (C) 2006 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 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_FEATURE_H__
-#define __CLUTTER_FEATURE_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-types.h>
-
-G_BEGIN_DECLS
-
-CLUTTER_EXPORT
-gboolean clutter_feature_available (ClutterFeatureFlags feature);
-CLUTTER_EXPORT
-ClutterFeatureFlags clutter_feature_get_all (void);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_FEATURE_H__ */
diff --git a/clutter/clutter/clutter-fixed-layout.c b/clutter/clutter/clutter-fixed-layout.c
deleted file mode 100644
index 095f2d752..000000000
--- a/clutter/clutter/clutter-fixed-layout.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2009 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- *
- * Based on the fixed layout code inside clutter-group.c
- */
-
-/**
- * SECTION:clutter-fixed-layout
- * @short_description: A fixed layout manager
- *
- * #ClutterFixedLayout is a layout manager implementing the same
- * layout policies as #ClutterGroup.
- *
- * #ClutterFixedLayout is available since Clutter 1.2
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-debug.h"
-#include "clutter-fixed-layout.h"
-#include "clutter-private.h"
-
-G_DEFINE_TYPE (ClutterFixedLayout,
- clutter_fixed_layout,
- CLUTTER_TYPE_LAYOUT_MANAGER);
-
-static void
-clutter_fixed_layout_get_preferred_width (ClutterLayoutManager *manager,
- ClutterContainer *container,
- gfloat for_height,
- gfloat *min_width_p,
- gfloat *nat_width_p)
-{
- ClutterActor *actor, *child;
- gdouble min_right;
- gdouble natural_right;
-
- min_right = 0;
- natural_right = 0;
-
- actor = CLUTTER_ACTOR (container);
-
- for (child = clutter_actor_get_first_child (actor);
- child != NULL;
- child = clutter_actor_get_next_sibling (child))
- {
- gfloat child_x, child_min, child_natural;
-
- child_x = clutter_actor_get_x (child);
-
- clutter_actor_get_preferred_size (child,
- &child_min, NULL,
- &child_natural, NULL);
-
- if (child_x + child_min > min_right)
- min_right = child_x + child_min;
-
- if (child_x + child_natural > natural_right)
- natural_right = child_x + child_natural;
- }
-
- if (min_width_p)
- *min_width_p = min_right;
-
- if (nat_width_p)
- *nat_width_p = natural_right;
-}
-
-static void
-clutter_fixed_layout_get_preferred_height (ClutterLayoutManager *manager,
- ClutterContainer *container,
- gfloat for_width,
- gfloat *min_height_p,
- gfloat *nat_height_p)
-{
- ClutterActor *actor, *child;
- gdouble min_bottom;
- gdouble natural_bottom;
-
- min_bottom = 0;
- natural_bottom = 0;
-
- actor = CLUTTER_ACTOR (container);
-
- for (child = clutter_actor_get_first_child (actor);
- child != NULL;
- child = clutter_actor_get_next_sibling (child))
- {
- gfloat child_y, child_min, child_natural;
-
- child_y = clutter_actor_get_y (child);
-
- clutter_actor_get_preferred_size (child,
- NULL, &child_min,
- NULL, &child_natural);
-
- if (child_y + child_min > min_bottom)
- min_bottom = child_y + child_min;
-
- if (child_y + child_natural > natural_bottom)
- natural_bottom = child_y + child_natural;
- }
-
- if (min_height_p)
- *min_height_p = min_bottom;
-
- if (nat_height_p)
- *nat_height_p = natural_bottom;
-}
-
-static void
-clutter_fixed_layout_allocate (ClutterLayoutManager *manager,
- ClutterContainer *container,
- const ClutterActorBox *allocation)
-{
- ClutterActor *child;
-
- for (child = clutter_actor_get_first_child (CLUTTER_ACTOR (container));
- child != NULL;
- child = clutter_actor_get_next_sibling (child))
- {
- float x = 0.f;
- float y = 0.f;
-
- clutter_actor_get_fixed_position (child, &x, &y);
- clutter_actor_allocate_preferred_size (child, x, y);
- }
-}
-
-static void
-clutter_fixed_layout_class_init (ClutterFixedLayoutClass *klass)
-{
- ClutterLayoutManagerClass *manager_class =
- CLUTTER_LAYOUT_MANAGER_CLASS (klass);
-
- manager_class->get_preferred_width =
- clutter_fixed_layout_get_preferred_width;
- manager_class->get_preferred_height =
- clutter_fixed_layout_get_preferred_height;
- manager_class->allocate = clutter_fixed_layout_allocate;
-}
-
-static void
-clutter_fixed_layout_init (ClutterFixedLayout *self)
-{
-}
-
-/**
- * clutter_fixed_layout_new:
- *
- * Creates a new #ClutterFixedLayout
- *
- * Return value: the newly created #ClutterFixedLayout
- *
- * Since: 1.2
- */
-ClutterLayoutManager *
-clutter_fixed_layout_new (void)
-{
- return g_object_new (CLUTTER_TYPE_FIXED_LAYOUT, NULL);
-}
diff --git a/clutter/clutter/clutter-fixed-layout.h b/clutter/clutter/clutter-fixed-layout.h
deleted file mode 100644
index d67e4a8d7..000000000
--- a/clutter/clutter/clutter-fixed-layout.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2009 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_FIXED_LAYOUT_H__
-#define __CLUTTER_FIXED_LAYOUT_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-layout-manager.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_FIXED_LAYOUT (clutter_fixed_layout_get_type ())
-#define CLUTTER_FIXED_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_FIXED_LAYOUT, ClutterFixedLayout))
-#define CLUTTER_IS_FIXED_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_FIXED_LAYOUT))
-#define CLUTTER_FIXED_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_FIXED_LAYOUT, ClutterFixedLayoutClass))
-#define CLUTTER_IS_FIXED_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_FIXED_LAYOUT))
-#define CLUTTER_FIXED_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_FIXED_LAYOUT, ClutterFixedLayoutClass))
-
-typedef struct _ClutterFixedLayout ClutterFixedLayout;
-typedef struct _ClutterFixedLayoutClass ClutterFixedLayoutClass;
-
-/**
- * ClutterFixedLayout:
- *
- * The #ClutterFixedLayout structure contains only private data and
- * it should be accessed using the provided API
- *
- * Since: 1.2
- */
-struct _ClutterFixedLayout
-{
- /*< private >*/
- ClutterLayoutManager parent_instance;
-};
-
-/**
- * ClutterFixedLayoutClass:
- *
- * The #ClutterFixedLayoutClass structure contains only private data
- * and it should be accessed using the provided API
- *
- * Since: 1.2
- */
-struct _ClutterFixedLayoutClass
-{
- /*< private >*/
- ClutterLayoutManagerClass parent_class;
-};
-
-CLUTTER_EXPORT
-GType clutter_fixed_layout_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterLayoutManager *clutter_fixed_layout_new (void);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_FIXED_LAYOUT_H__ */
diff --git a/clutter/clutter/clutter-flatten-effect.c b/clutter/clutter/clutter-flatten-effect.c
deleted file mode 100644
index e35485da8..000000000
--- a/clutter/clutter/clutter-flatten-effect.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2011 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Authors:
- * Neil Roberts <neil@linux.intel.com>
- */
-
-/* This is an internal-only effect used to implement the
- 'offscreen-redirect' property of ClutterActor. It doesn't actually
- need to do anything on top of the ClutterOffscreenEffect class so
- it only exists because that class is abstract */
-
-#include "clutter-build-config.h"
-
-#include "clutter-flatten-effect.h"
-#include "clutter-private.h"
-#include "clutter-actor-private.h"
-
-G_DEFINE_TYPE (ClutterFlattenEffect,
- _clutter_flatten_effect,
- CLUTTER_TYPE_OFFSCREEN_EFFECT);
-
-static void
-_clutter_flatten_effect_class_init (ClutterFlattenEffectClass *klass)
-{
-}
-
-static void
-_clutter_flatten_effect_init (ClutterFlattenEffect *self)
-{
-}
-
-ClutterEffect *
-_clutter_flatten_effect_new (void)
-{
- return g_object_new (CLUTTER_TYPE_FLATTEN_EFFECT, NULL);
-}
diff --git a/clutter/clutter/clutter-flatten-effect.h b/clutter/clutter/clutter-flatten-effect.h
deleted file mode 100644
index 03b2df6eb..000000000
--- a/clutter/clutter/clutter-flatten-effect.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2011 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Authors:
- * Neil Roberts <neil@linux.intel.com>
- */
-
-#ifndef __CLUTTER_FLATTEN_EFFECT_H__
-#define __CLUTTER_FLATTEN_EFFECT_H__
-
-#include <clutter/clutter-offscreen-effect.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_FLATTEN_EFFECT \
- (_clutter_flatten_effect_get_type())
-#define CLUTTER_FLATTEN_EFFECT(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- CLUTTER_TYPE_FLATTEN_EFFECT, \
- ClutterFlattenEffect))
-#define CLUTTER_FLATTEN_EFFECT_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- CLUTTER_TYPE_FLATTEN_EFFECT, \
- ClutterFlattenEffectClass))
-#define CLUTTER_IS_FLATTEN_EFFECT(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- CLUTTER_TYPE_FLATTEN_EFFECT))
-#define CLUTTER_IS_FLATTEN_EFFECT_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- CLUTTER_TYPE_FLATTEN_EFFECT))
-#define CLUTTER_FLATTEN_EFFECT_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- CLUTTER_FLATTEN_EFFECT, \
- ClutterFlattenEffectClass))
-
-typedef struct _ClutterFlattenEffect ClutterFlattenEffect;
-typedef struct _ClutterFlattenEffectClass ClutterFlattenEffectClass;
-typedef struct _ClutterFlattenEffectPrivate ClutterFlattenEffectPrivate;
-
-struct _ClutterFlattenEffectClass
-{
- ClutterOffscreenEffectClass parent_class;
-};
-
-struct _ClutterFlattenEffect
-{
- ClutterOffscreenEffect parent;
-};
-
-GType _clutter_flatten_effect_get_type (void) G_GNUC_CONST;
-
-ClutterEffect *_clutter_flatten_effect_new (void);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_FLATTEN_EFFECT_H__ */
diff --git a/clutter/clutter/clutter-flow-layout.c b/clutter/clutter/clutter-flow-layout.c
deleted file mode 100644
index 29919ad33..000000000
--- a/clutter/clutter/clutter-flow-layout.c
+++ /dev/null
@@ -1,1534 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2009 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-flow-layout
- * @short_description: A reflowing layout manager
- *
- * #ClutterFlowLayout is a layout manager which implements the following
- * policy:
- *
- * - the preferred natural size depends on the value
- * of the #ClutterFlowLayout:orientation property; the layout will try
- * to maintain all its children on a single row or
- * column;
- * - if either the width or the height allocated are
- * smaller than the preferred ones, the layout will wrap; in this case,
- * the preferred height or width, respectively, will take into account
- * the amount of columns and rows;
- * - each line (either column or row) in reflowing will
- * have the size of the biggest cell on that line; if the
- * #ClutterFlowLayout:homogeneous property is set to %FALSE the actor
- * will be allocated within that area, and if set to %TRUE instead the
- * actor will be given exactly that area;
- * - the size of the columns or rows can be controlled
- * for both minimum and maximum; the spacing can also be controlled
- * in both columns and rows.
- *
- * The [flow-layout example](https://git.gnome.org/browse/clutter/tree/examples/flow-layout.c?h=clutter-1.18)
- * shows how to use the #ClutterFlowLayout.
- *
- * #ClutterFlowLayout is available since Clutter 1.2
- */
-
-#include "clutter-build-config.h"
-
-#include <math.h>
-
-#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
-#include "deprecated/clutter-container.h"
-
-#include "clutter-actor.h"
-#include "clutter-animatable.h"
-#include "clutter-child-meta.h"
-#include "clutter-debug.h"
-#include "clutter-enum-types.h"
-#include "clutter-flow-layout.h"
-#include "clutter-layout-meta.h"
-#include "clutter-private.h"
-
-struct _ClutterFlowLayoutPrivate
-{
- ClutterContainer *container;
-
- ClutterFlowOrientation orientation;
-
- gfloat col_spacing;
- gfloat row_spacing;
-
- gfloat min_col_width;
- gfloat max_col_width;
- gfloat col_width;
-
- gfloat min_row_height;
- gfloat max_row_height;
- gfloat row_height;
-
- /* per-line size */
- GArray *line_min;
- GArray *line_natural;
- gfloat req_width;
- gfloat req_height;
-
- guint line_count;
-
- guint is_homogeneous : 1;
- guint snap_to_grid : 1;
-};
-
-enum
-{
- PROP_0,
-
- PROP_ORIENTATION,
-
- PROP_HOMOGENEOUS,
-
- PROP_COLUMN_SPACING,
- PROP_ROW_SPACING,
-
- PROP_MIN_COLUMN_WIDTH,
- PROP_MAX_COLUMN_WIDTH,
- PROP_MIN_ROW_HEGHT,
- PROP_MAX_ROW_HEIGHT,
-
- PROP_SNAP_TO_GRID,
-
- N_PROPERTIES
-};
-
-static GParamSpec *flow_properties[N_PROPERTIES] = { NULL, };
-
-G_DEFINE_TYPE_WITH_PRIVATE (ClutterFlowLayout,
- clutter_flow_layout,
- CLUTTER_TYPE_LAYOUT_MANAGER)
-
-static gint
-get_columns (ClutterFlowLayout *self,
- gfloat for_width)
-{
- ClutterFlowLayoutPrivate *priv = self->priv;
- gint n_columns;
-
- if (for_width < 0)
- return 1;
-
- if (priv->col_width == 0)
- return 1;
-
- n_columns = (gint) (for_width + priv->col_spacing)
- / (priv->col_width + priv->col_spacing);
-
- if (n_columns == 0)
- return 1;
-
- return n_columns;
-}
-
-static gint
-get_rows (ClutterFlowLayout *self,
- gfloat for_height)
-{
- ClutterFlowLayoutPrivate *priv = self->priv;
- gint n_rows;
-
- if (for_height < 0)
- return 1;
-
- if (priv->row_height == 0)
- return 1;
-
- n_rows = (gint) (for_height + priv->row_spacing)
- / (priv->row_height + priv->row_spacing);
-
- if (n_rows == 0)
- return 1;
-
- return n_rows;
-}
-
-static gint
-compute_lines (ClutterFlowLayout *self,
- gfloat avail_width,
- gfloat avail_height)
-{
- ClutterFlowLayoutPrivate *priv = self->priv;
-
- if (priv->orientation == CLUTTER_FLOW_HORIZONTAL)
- return get_columns (self, avail_width);
- else
- return get_rows (self, avail_height);
-}
-
-static void
-clutter_flow_layout_get_preferred_width (ClutterLayoutManager *manager,
- ClutterContainer *container,
- gfloat for_height,
- gfloat *min_width_p,
- gfloat *nat_width_p)
-{
- ClutterFlowLayoutPrivate *priv = CLUTTER_FLOW_LAYOUT (manager)->priv;
- gint n_rows, line_item_count, line_count;
- gfloat total_min_width, total_natural_width;
- gfloat line_min_width, line_natural_width;
- gfloat max_min_width, max_natural_width;
- ClutterActor *actor, *child;
- ClutterActorIter iter;
- gfloat item_y;
-
- n_rows = get_rows (CLUTTER_FLOW_LAYOUT (manager), for_height);
-
- total_min_width = 0;
- total_natural_width = 0;
-
- line_min_width = 0;
- line_natural_width = 0;
-
- line_item_count = 0;
- line_count = 0;
-
- item_y = 0;
-
- actor = CLUTTER_ACTOR (container);
-
- /* clear the line width arrays */
- if (priv->line_min != NULL)
- g_array_free (priv->line_min, TRUE);
-
- if (priv->line_natural != NULL)
- g_array_free (priv->line_natural, TRUE);
-
- priv->line_min = g_array_sized_new (FALSE, FALSE,
- sizeof (gfloat),
- 16);
- priv->line_natural = g_array_sized_new (FALSE, FALSE,
- sizeof (gfloat),
- 16);
-
- if (clutter_actor_get_n_children (actor) != 0)
- line_count = 1;
-
- max_min_width = max_natural_width = 0;
-
- clutter_actor_iter_init (&iter, actor);
- while (clutter_actor_iter_next (&iter, &child))
- {
- gfloat child_min, child_natural;
- gfloat new_y, item_height;
-
- if (!clutter_actor_is_visible (child))
- continue;
-
- if (priv->orientation == CLUTTER_FLOW_VERTICAL && for_height > 0)
- {
- clutter_actor_get_preferred_height (child, -1,
- &child_min,
- &child_natural);
-
- if ((priv->snap_to_grid && line_item_count == n_rows) ||
- (!priv->snap_to_grid && item_y + child_natural > for_height))
- {
- total_min_width += line_min_width;
- total_natural_width += line_natural_width;
-
- g_array_append_val (priv->line_min,
- line_min_width);
- g_array_append_val (priv->line_natural,
- line_natural_width);
-
- line_min_width = line_natural_width = 0;
-
- line_item_count = 0;
- line_count += 1;
- item_y = 0;
- }
-
- if (priv->snap_to_grid)
- {
- new_y = ((line_item_count + 1) * (for_height + priv->row_spacing))
- / n_rows;
- item_height = new_y - item_y - priv->row_spacing;
- }
- else
- {
- new_y = item_y + child_natural + priv->row_spacing;
- item_height = child_natural;
- }
-
- clutter_actor_get_preferred_width (child, item_height,
- &child_min,
- &child_natural);
-
- line_min_width = MAX (line_min_width, child_min);
- line_natural_width = MAX (line_natural_width, child_natural);
-
- item_y = new_y;
- line_item_count += 1;
-
- max_min_width = MAX (max_min_width, line_min_width);
- max_natural_width = MAX (max_natural_width, line_natural_width);
- }
- else
- {
- clutter_actor_get_preferred_width (child, for_height,
- &child_min,
- &child_natural);
-
- max_min_width = MAX (max_min_width, child_min);
- max_natural_width = MAX (max_natural_width, child_natural);
-
- total_min_width += max_min_width;
- total_natural_width += max_natural_width;
- line_count += 1;
- }
- }
-
- priv->col_width = max_natural_width;
-
- if (priv->max_col_width > 0 && priv->col_width > priv->max_col_width)
- priv->col_width = MAX (priv->max_col_width, max_min_width);
-
- if (priv->col_width < priv->min_col_width)
- priv->col_width = priv->min_col_width;
-
- if (priv->orientation == CLUTTER_FLOW_VERTICAL && for_height > 0)
- {
- /* if we have a non-full row we need to add it */
- if (line_item_count > 0)
- {
- total_min_width += line_min_width;
- total_natural_width += line_natural_width;
-
- g_array_append_val (priv->line_min,
- line_min_width);
- g_array_append_val (priv->line_natural,
- line_natural_width);
- }
-
- priv->line_count = line_count;
-
- if (priv->line_count > 0)
- {
- gfloat total_spacing;
-
- total_spacing = priv->col_spacing * (priv->line_count - 1);
-
- total_min_width += total_spacing;
- total_natural_width += total_spacing;
- }
- }
- else
- {
- g_array_append_val (priv->line_min, line_min_width);
- g_array_append_val (priv->line_natural, line_natural_width);
-
- priv->line_count = line_count;
-
- if (priv->line_count > 0)
- {
- gfloat total_spacing;
-
- total_spacing = priv->col_spacing * (priv->line_count - 1);
-
- total_min_width += total_spacing;
- total_natural_width += total_spacing;
- }
- }
-
- CLUTTER_NOTE (LAYOUT,
- "Flow[w]: %d lines (%d per line): w [ %.2f, %.2f ] for h %.2f",
- n_rows, priv->line_count,
- total_min_width,
- total_natural_width,
- for_height);
-
- priv->req_height = for_height;
-
- if (min_width_p)
- *min_width_p = max_min_width;
-
- if (nat_width_p)
- *nat_width_p = total_natural_width;
-}
-
-static void
-clutter_flow_layout_get_preferred_height (ClutterLayoutManager *manager,
- ClutterContainer *container,
- gfloat for_width,
- gfloat *min_height_p,
- gfloat *nat_height_p)
-{
- ClutterFlowLayoutPrivate *priv = CLUTTER_FLOW_LAYOUT (manager)->priv;
- gint n_columns, line_item_count, line_count;
- gfloat total_min_height, total_natural_height;
- gfloat line_min_height, line_natural_height;
- gfloat max_min_height, max_natural_height;
- ClutterActor *actor, *child;
- ClutterActorIter iter;
- gfloat item_x;
-
- n_columns = get_columns (CLUTTER_FLOW_LAYOUT (manager), for_width);
-
- total_min_height = 0;
- total_natural_height = 0;
-
- line_min_height = 0;
- line_natural_height = 0;
-
- line_item_count = 0;
- line_count = 0;
-
- item_x = 0;
-
- actor = CLUTTER_ACTOR (container);
-
- /* clear the line height arrays */
- if (priv->line_min != NULL)
- g_array_free (priv->line_min, TRUE);
-
- if (priv->line_natural != NULL)
- g_array_free (priv->line_natural, TRUE);
-
- priv->line_min = g_array_sized_new (FALSE, FALSE,
- sizeof (gfloat),
- 16);
- priv->line_natural = g_array_sized_new (FALSE, FALSE,
- sizeof (gfloat),
- 16);
-
- if (clutter_actor_get_n_children (actor) != 0)
- line_count = 1;
-
- max_min_height = max_natural_height = 0;
-
- clutter_actor_iter_init (&iter, actor);
- while (clutter_actor_iter_next (&iter, &child))
- {
- gfloat child_min, child_natural;
- gfloat new_x, item_width;
-
- if (!clutter_actor_is_visible (child))
- continue;
-
- if (priv->orientation == CLUTTER_FLOW_HORIZONTAL && for_width > 0)
- {
- clutter_actor_get_preferred_width (child, -1,
- &child_min,
- &child_natural);
-
- if ((priv->snap_to_grid && line_item_count == n_columns) ||
- (!priv->snap_to_grid && item_x + child_natural > for_width))
- {
- total_min_height += line_min_height;
- total_natural_height += line_natural_height;
-
- g_array_append_val (priv->line_min,
- line_min_height);
- g_array_append_val (priv->line_natural,
- line_natural_height);
-
- line_min_height = line_natural_height = 0;
-
- line_item_count = 0;
- line_count += 1;
- item_x = 0;
- }
-
- if (priv->snap_to_grid)
- {
- new_x = ((line_item_count + 1) * (for_width + priv->col_spacing))
- / n_columns;
- item_width = new_x - item_x - priv->col_spacing;
- }
- else
- {
- new_x = item_x + child_natural + priv->col_spacing;
- item_width = child_natural;
- }
-
- clutter_actor_get_preferred_height (child, item_width,
- &child_min,
- &child_natural);
-
- line_min_height = MAX (line_min_height, child_min);
- line_natural_height = MAX (line_natural_height, child_natural);
-
- item_x = new_x;
- line_item_count += 1;
-
- max_min_height = MAX (max_min_height, line_min_height);
- max_natural_height = MAX (max_natural_height, line_natural_height);
- }
- else
- {
- clutter_actor_get_preferred_height (child, for_width,
- &child_min,
- &child_natural);
-
- max_min_height = MAX (max_min_height, child_min);
- max_natural_height = MAX (max_natural_height, child_natural);
-
- total_min_height += max_min_height;
- total_natural_height += max_natural_height;
-
- line_count += 1;
- }
- }
-
- priv->row_height = max_natural_height;
-
- if (priv->max_row_height > 0 && priv->row_height > priv->max_row_height)
- priv->row_height = MAX (priv->max_row_height, max_min_height);
-
- if (priv->row_height < priv->min_row_height)
- priv->row_height = priv->min_row_height;
-
- if (priv->orientation == CLUTTER_FLOW_HORIZONTAL && for_width > 0)
- {
- /* if we have a non-full row we need to add it */
- if (line_item_count > 0)
- {
- total_min_height += line_min_height;
- total_natural_height += line_natural_height;
-
- g_array_append_val (priv->line_min,
- line_min_height);
- g_array_append_val (priv->line_natural,
- line_natural_height);
- }
-
- priv->line_count = line_count;
- if (priv->line_count > 0)
- {
- gfloat total_spacing;
-
- total_spacing = priv->row_spacing * (priv->line_count - 1);
-
- total_min_height += total_spacing;
- total_natural_height += total_spacing;
- }
- }
- else
- {
- g_array_append_val (priv->line_min, line_min_height);
- g_array_append_val (priv->line_natural, line_natural_height);
-
- priv->line_count = line_count;
-
- if (priv->line_count > 0)
- {
- gfloat total_spacing;
-
- total_spacing = priv->col_spacing * priv->line_count;
-
- total_min_height += total_spacing;
- total_natural_height += total_spacing;
- }
- }
-
- CLUTTER_NOTE (LAYOUT,
- "Flow[h]: %d lines (%d per line): w [ %.2f, %.2f ] for h %.2f",
- n_columns, priv->line_count,
- total_min_height,
- total_natural_height,
- for_width);
-
- priv->req_width = for_width;
-
- if (min_height_p)
- *min_height_p = max_min_height;
-
- if (nat_height_p)
- *nat_height_p = total_natural_height;
-}
-
-static void
-clutter_flow_layout_allocate (ClutterLayoutManager *manager,
- ClutterContainer *container,
- const ClutterActorBox *allocation)
-{
- ClutterFlowLayoutPrivate *priv = CLUTTER_FLOW_LAYOUT (manager)->priv;
- ClutterActor *actor, *child;
- ClutterActorIter iter;
- gfloat x_off, y_off;
- gfloat avail_width, avail_height;
- gfloat item_x, item_y;
- gint line_item_count;
- gint items_per_line;
- gint line_index;
-
- actor = CLUTTER_ACTOR (container);
- if (clutter_actor_get_n_children (actor) == 0)
- return;
-
- clutter_actor_box_get_origin (allocation, &x_off, &y_off);
- clutter_actor_box_get_size (allocation, &avail_width, &avail_height);
-
- /* blow the cached preferred size and re-compute with the given
- * available size in case the FlowLayout wasn't given the exact
- * size it requested
- */
- if ((priv->req_width >= 0 && avail_width != priv->req_width) ||
- (priv->req_height >= 0 && avail_height != priv->req_height))
- {
- clutter_flow_layout_get_preferred_width (manager, container,
- avail_height,
- NULL, NULL);
- clutter_flow_layout_get_preferred_height (manager, container,
- avail_width,
- NULL, NULL);
- }
-
- items_per_line = compute_lines (CLUTTER_FLOW_LAYOUT (manager),
- avail_width, avail_height);
-
- item_x = x_off;
- item_y = y_off;
-
- line_item_count = 0;
- line_index = 0;
-
- clutter_actor_iter_init (&iter, actor);
- while (clutter_actor_iter_next (&iter, &child))
- {
- ClutterActorBox child_alloc;
- gfloat item_width, item_height;
- gfloat new_x, new_y;
- gfloat child_min, child_natural;
-
- if (!clutter_actor_is_visible (child))
- continue;
-
- new_x = new_y = 0;
-
- if (!priv->snap_to_grid)
- clutter_actor_get_preferred_size (child,
- NULL, NULL,
- &item_width,
- &item_height);
-
- if (priv->orientation == CLUTTER_FLOW_HORIZONTAL)
- {
- if ((priv->snap_to_grid &&
- line_item_count == items_per_line && line_item_count > 0) ||
- (!priv->snap_to_grid && item_x + item_width > avail_width))
- {
- item_y += g_array_index (priv->line_natural,
- gfloat,
- line_index);
-
- if (line_index >= 0)
- item_y += priv->row_spacing;
-
- line_item_count = 0;
- line_index += 1;
-
- item_x = x_off;
- }
-
- if (priv->snap_to_grid)
- {
- new_x = x_off + ((line_item_count + 1) * (avail_width + priv->col_spacing))
- / items_per_line;
- item_width = new_x - item_x - priv->col_spacing;
- }
- else
- {
- new_x = item_x + item_width + priv->col_spacing;
- }
-
- item_height = g_array_index (priv->line_natural,
- gfloat,
- line_index);
-
- }
- else
- {
- if ((priv->snap_to_grid &&
- line_item_count == items_per_line && line_item_count > 0) ||
- (!priv->snap_to_grid && item_y + item_height > avail_height))
- {
- item_x += g_array_index (priv->line_natural,
- gfloat,
- line_index);
-
- if (line_index >= 0)
- item_x += priv->col_spacing;
-
- line_item_count = 0;
- line_index += 1;
-
- item_y = y_off;
- }
-
- if (priv->snap_to_grid)
- {
- new_y = y_off + ((line_item_count + 1) * (avail_height + priv->row_spacing))
- / items_per_line;
- item_height = new_y - item_y - priv->row_spacing;
- }
- else
- {
- new_y = item_y + item_height + priv->row_spacing;
- }
-
- item_width = g_array_index (priv->line_natural,
- gfloat,
- line_index);
- }
-
- if (!priv->is_homogeneous &&
- !clutter_actor_needs_expand (child,
- CLUTTER_ORIENTATION_HORIZONTAL))
- {
- clutter_actor_get_preferred_width (child, item_height,
- &child_min,
- &child_natural);
- item_width = MIN (item_width, child_natural);
- }
-
- if (!priv->is_homogeneous &&
- !clutter_actor_needs_expand (child,
- CLUTTER_ORIENTATION_VERTICAL))
- {
- clutter_actor_get_preferred_height (child, item_width,
- &child_min,
- &child_natural);
- item_height = MIN (item_height, child_natural);
- }
-
- CLUTTER_NOTE (LAYOUT,
- "flow[line:%d, item:%d/%d] ="
- "{ %.2f, %.2f, %.2f, %.2f }",
- line_index, line_item_count + 1, items_per_line,
- item_x, item_y, item_width, item_height);
-
- child_alloc.x1 = ceil (item_x);
- child_alloc.y1 = ceil (item_y);
- child_alloc.x2 = ceil (child_alloc.x1 + item_width);
- child_alloc.y2 = ceil (child_alloc.y1 + item_height);
- clutter_actor_allocate (child, &child_alloc);
-
- if (priv->orientation == CLUTTER_FLOW_HORIZONTAL)
- item_x = new_x;
- else
- item_y = new_y;
-
- line_item_count += 1;
- }
-}
-
-static void
-clutter_flow_layout_set_container (ClutterLayoutManager *manager,
- ClutterContainer *container)
-{
- ClutterFlowLayoutPrivate *priv = CLUTTER_FLOW_LAYOUT (manager)->priv;
- ClutterLayoutManagerClass *parent_class;
-
- priv->container = container;
-
- if (priv->container != NULL)
- {
- ClutterRequestMode request_mode;
-
- /* we need to change the :request-mode of the container
- * to match the orientation
- */
- request_mode = (priv->orientation == CLUTTER_FLOW_HORIZONTAL)
- ? CLUTTER_REQUEST_HEIGHT_FOR_WIDTH
- : CLUTTER_REQUEST_WIDTH_FOR_HEIGHT;
- clutter_actor_set_request_mode (CLUTTER_ACTOR (priv->container),
- request_mode);
- }
-
- parent_class = CLUTTER_LAYOUT_MANAGER_CLASS (clutter_flow_layout_parent_class);
- parent_class->set_container (manager, container);
-}
-
-static void
-clutter_flow_layout_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterFlowLayout *self = CLUTTER_FLOW_LAYOUT (gobject);
-
- switch (prop_id)
- {
- case PROP_ORIENTATION:
- clutter_flow_layout_set_orientation (self, g_value_get_enum (value));
- break;
-
- case PROP_HOMOGENEOUS:
- clutter_flow_layout_set_homogeneous (self, g_value_get_boolean (value));
- break;
-
- case PROP_COLUMN_SPACING:
- clutter_flow_layout_set_column_spacing (self, g_value_get_float (value));
- break;
-
- case PROP_ROW_SPACING:
- clutter_flow_layout_set_row_spacing (self, g_value_get_float (value));
- break;
-
- case PROP_MIN_COLUMN_WIDTH:
- clutter_flow_layout_set_column_width (self,
- g_value_get_float (value),
- self->priv->max_col_width);
- break;
-
- case PROP_MAX_COLUMN_WIDTH:
- clutter_flow_layout_set_column_width (self,
- self->priv->min_col_width,
- g_value_get_float (value));
- break;
-
- case PROP_MIN_ROW_HEGHT:
- clutter_flow_layout_set_row_height (self,
- g_value_get_float (value),
- self->priv->max_row_height);
- break;
-
- case PROP_MAX_ROW_HEIGHT:
- clutter_flow_layout_set_row_height (self,
- self->priv->min_row_height,
- g_value_get_float (value));
- break;
-
- case PROP_SNAP_TO_GRID:
- clutter_flow_layout_set_snap_to_grid (self,
- g_value_get_boolean (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_flow_layout_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterFlowLayoutPrivate *priv = CLUTTER_FLOW_LAYOUT (gobject)->priv;
-
- switch (prop_id)
- {
- case PROP_ORIENTATION:
- g_value_set_enum (value, priv->orientation);
- break;
-
- case PROP_HOMOGENEOUS:
- g_value_set_boolean (value, priv->is_homogeneous);
- break;
-
- case PROP_COLUMN_SPACING:
- g_value_set_float (value, priv->col_spacing);
- break;
-
- case PROP_ROW_SPACING:
- g_value_set_float (value, priv->row_spacing);
- break;
-
- case PROP_MIN_COLUMN_WIDTH:
- g_value_set_float (value, priv->min_col_width);
- break;
-
- case PROP_MAX_COLUMN_WIDTH:
- g_value_set_float (value, priv->max_col_width);
- break;
-
- case PROP_MIN_ROW_HEGHT:
- g_value_set_float (value, priv->min_row_height);
- break;
-
- case PROP_MAX_ROW_HEIGHT:
- g_value_set_float (value, priv->max_row_height);
- break;
-
- case PROP_SNAP_TO_GRID:
- g_value_set_boolean (value, priv->snap_to_grid);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_flow_layout_finalize (GObject *gobject)
-{
- ClutterFlowLayoutPrivate *priv = CLUTTER_FLOW_LAYOUT (gobject)->priv;
-
- if (priv->line_min != NULL)
- g_array_free (priv->line_min, TRUE);
-
- if (priv->line_natural != NULL)
- g_array_free (priv->line_natural, TRUE);
-
- G_OBJECT_CLASS (clutter_flow_layout_parent_class)->finalize (gobject);
-}
-
-static void
-clutter_flow_layout_class_init (ClutterFlowLayoutClass *klass)
-{
- GObjectClass *gobject_class;
- ClutterLayoutManagerClass *layout_class;
-
- gobject_class = G_OBJECT_CLASS (klass);
- layout_class = CLUTTER_LAYOUT_MANAGER_CLASS (klass);
-
- layout_class->get_preferred_width =
- clutter_flow_layout_get_preferred_width;
- layout_class->get_preferred_height =
- clutter_flow_layout_get_preferred_height;
- layout_class->allocate = clutter_flow_layout_allocate;
- layout_class->set_container = clutter_flow_layout_set_container;
-
- /**
- * ClutterFlowLayout:orientation:
- *
- * The orientation of the #ClutterFlowLayout. The children
- * of the layout will be laid out following the orientation.
- *
- * This property also controls the overflowing directions
- *
- * Since: 1.2
- */
- flow_properties[PROP_ORIENTATION] =
- g_param_spec_enum ("orientation",
- P_("Orientation"),
- P_("The orientation of the layout"),
- CLUTTER_TYPE_FLOW_ORIENTATION,
- CLUTTER_FLOW_HORIZONTAL,
- CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);
-
- /**
- * ClutterFlowLayout:homogeneous:
- *
- * Whether each child inside the #ClutterFlowLayout should receive
- * the same allocation
- *
- * Since: 1.2
- */
- flow_properties[PROP_HOMOGENEOUS] =
- g_param_spec_boolean ("homogeneous",
- P_("Homogeneous"),
- P_("Whether each item should receive the same allocation"),
- FALSE,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterFlowLayout:column-spacing:
- *
- * The spacing between columns, in pixels; the value of this
- * property is honoured by horizontal non-overflowing layouts
- * and by vertical overflowing layouts
- *
- * Since: 1.2
- */
- flow_properties[PROP_COLUMN_SPACING] =
- g_param_spec_float ("column-spacing",
- P_("Column Spacing"),
- P_("The spacing between columns"),
- 0.0, G_MAXFLOAT,
- 0.0,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterFlowLayout:row-spacing:
- *
- * The spacing between rows, in pixels; the value of this
- * property is honoured by vertical non-overflowing layouts and
- * by horizontal overflowing layouts
- *
- * Since: 1.2
- */
- flow_properties[PROP_ROW_SPACING] =
- g_param_spec_float ("row-spacing",
- P_("Row Spacing"),
- P_("The spacing between rows"),
- 0.0, G_MAXFLOAT,
- 0.0,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterFlowLayout:min-column-width:
- *
- * Minimum width for each column in the layout, in pixels
- *
- * Since: 1.2
- */
- flow_properties[PROP_MIN_COLUMN_WIDTH] =
- g_param_spec_float ("min-column-width",
- P_("Minimum Column Width"),
- P_("Minimum width for each column"),
- 0.0, G_MAXFLOAT,
- 0.0,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterFlowLayout:max-column-width:
- *
- * Maximum width for each column in the layout, in pixels. If
- * set to -1 the width will be the maximum child width
- *
- * Since: 1.2
- */
- flow_properties[PROP_MAX_COLUMN_WIDTH] =
- g_param_spec_float ("max-column-width",
- P_("Maximum Column Width"),
- P_("Maximum width for each column"),
- -1.0, G_MAXFLOAT,
- -1.0,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterFlowLayout:min-row-height:
- *
- * Minimum height for each row in the layout, in pixels
- *
- * Since: 1.2
- */
- flow_properties[PROP_MIN_ROW_HEGHT] =
- g_param_spec_float ("min-row-height",
- P_("Minimum Row Height"),
- P_("Minimum height for each row"),
- 0.0, G_MAXFLOAT,
- 0.0,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterFlowLayout:max-row-height:
- *
- * Maximum height for each row in the layout, in pixels. If
- * set to -1 the width will be the maximum child height
- *
- * Since: 1.2
- */
- flow_properties[PROP_MAX_ROW_HEIGHT] =
- g_param_spec_float ("max-row-height",
- P_("Maximum Row Height"),
- P_("Maximum height for each row"),
- -1.0, G_MAXFLOAT,
- -1.0,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterFlowLayout:snap-to-grid:
- *
- * Whether the #ClutterFlowLayout should arrange its children
- * on a grid
- *
- * Since: 1.16
- */
- flow_properties[PROP_SNAP_TO_GRID] =
- g_param_spec_boolean ("snap-to-grid",
- P_("Snap to grid"),
- P_("Snap to grid"),
- TRUE,
- CLUTTER_PARAM_READWRITE);
-
- gobject_class->finalize = clutter_flow_layout_finalize;
- gobject_class->set_property = clutter_flow_layout_set_property;
- gobject_class->get_property = clutter_flow_layout_get_property;
- g_object_class_install_properties (gobject_class,
- N_PROPERTIES,
- flow_properties);
-}
-
-static void
-clutter_flow_layout_init (ClutterFlowLayout *self)
-{
- ClutterFlowLayoutPrivate *priv;
-
- self->priv = priv = clutter_flow_layout_get_instance_private (self);
-
- priv->orientation = CLUTTER_FLOW_HORIZONTAL;
-
- priv->col_spacing = 0;
- priv->row_spacing = 0;
-
- priv->min_col_width = priv->min_row_height = 0;
- priv->max_col_width = priv->max_row_height = -1;
-
- priv->line_min = NULL;
- priv->line_natural = NULL;
- priv->snap_to_grid = TRUE;
-}
-
-/**
- * clutter_flow_layout_new:
- * @orientation: the orientation of the flow layout
- *
- * Creates a new #ClutterFlowLayout with the given @orientation
- *
- * Return value: the newly created #ClutterFlowLayout
- *
- * Since: 1.2
- */
-ClutterLayoutManager *
-clutter_flow_layout_new (ClutterFlowOrientation orientation)
-{
- return g_object_new (CLUTTER_TYPE_FLOW_LAYOUT,
- "orientation", orientation,
- NULL);
-}
-
-/**
- * clutter_flow_layout_set_orientation:
- * @layout: a #ClutterFlowLayout
- * @orientation: the orientation of the layout
- *
- * Sets the orientation of the flow layout
- *
- * The orientation controls the direction used to allocate
- * the children: either horizontally or vertically. The
- * orientation also controls the direction of the overflowing
- *
- * Since: 1.2
- */
-void
-clutter_flow_layout_set_orientation (ClutterFlowLayout *layout,
- ClutterFlowOrientation orientation)
-{
- ClutterFlowLayoutPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_FLOW_LAYOUT (layout));
-
- priv = layout->priv;
-
- if (priv->orientation != orientation)
- {
- ClutterLayoutManager *manager;
-
- priv->orientation = orientation;
-
- if (priv->container != NULL)
- {
- ClutterRequestMode request_mode;
-
- /* we need to change the :request-mode of the container
- * to match the orientation
- */
- request_mode = (priv->orientation == CLUTTER_FLOW_HORIZONTAL)
- ? CLUTTER_REQUEST_HEIGHT_FOR_WIDTH
- : CLUTTER_REQUEST_WIDTH_FOR_HEIGHT;
- clutter_actor_set_request_mode (CLUTTER_ACTOR (priv->container),
- request_mode);
- }
-
- manager = CLUTTER_LAYOUT_MANAGER (layout);
- clutter_layout_manager_layout_changed (manager);
-
- g_object_notify_by_pspec (G_OBJECT (layout),
- flow_properties[PROP_ORIENTATION]);
- }
-}
-
-/**
- * clutter_flow_layout_get_orientation:
- * @layout: a #ClutterFlowLayout
- *
- * Retrieves the orientation of the @layout
- *
- * Return value: the orientation of the #ClutterFlowLayout
- *
- * Since: 1.2
- */
-ClutterFlowOrientation
-clutter_flow_layout_get_orientation (ClutterFlowLayout *layout)
-{
- g_return_val_if_fail (CLUTTER_IS_FLOW_LAYOUT (layout),
- CLUTTER_FLOW_HORIZONTAL);
-
- return layout->priv->orientation;
-}
-
-/**
- * clutter_flow_layout_set_homogeneous:
- * @layout: a #ClutterFlowLayout
- * @homogeneous: whether the layout should be homogeneous or not
- *
- * Sets whether the @layout should allocate the same space for
- * each child
- *
- * Since: 1.2
- */
-void
-clutter_flow_layout_set_homogeneous (ClutterFlowLayout *layout,
- gboolean homogeneous)
-{
- ClutterFlowLayoutPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_FLOW_LAYOUT (layout));
-
- priv = layout->priv;
-
- if (priv->is_homogeneous != homogeneous)
- {
- ClutterLayoutManager *manager;
-
- priv->is_homogeneous = homogeneous;
-
- manager = CLUTTER_LAYOUT_MANAGER (layout);
- clutter_layout_manager_layout_changed (manager);
-
- g_object_notify_by_pspec (G_OBJECT (layout),
- flow_properties[PROP_HOMOGENEOUS]);
- }
-}
-
-/**
- * clutter_flow_layout_get_homogeneous:
- * @layout: a #ClutterFlowLayout
- *
- * Retrieves whether the @layout is homogeneous
- *
- * Return value: %TRUE if the #ClutterFlowLayout is homogeneous
- *
- * Since: 1.2
- */
-gboolean
-clutter_flow_layout_get_homogeneous (ClutterFlowLayout *layout)
-{
- g_return_val_if_fail (CLUTTER_IS_FLOW_LAYOUT (layout), FALSE);
-
- return layout->priv->is_homogeneous;
-}
-
-/**
- * clutter_flow_layout_set_column_spacing:
- * @layout: a #ClutterFlowLayout
- * @spacing: the space between columns
- *
- * Sets the space between columns, in pixels
- *
- * Since: 1.2
- */
-void
-clutter_flow_layout_set_column_spacing (ClutterFlowLayout *layout,
- gfloat spacing)
-{
- ClutterFlowLayoutPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_FLOW_LAYOUT (layout));
-
- priv = layout->priv;
-
- if (priv->col_spacing != spacing)
- {
- ClutterLayoutManager *manager;
-
- priv->col_spacing = spacing;
-
- manager = CLUTTER_LAYOUT_MANAGER (layout);
- clutter_layout_manager_layout_changed (manager);
-
- g_object_notify_by_pspec (G_OBJECT (layout),
- flow_properties[PROP_COLUMN_SPACING]);
- }
-}
-
-/**
- * clutter_flow_layout_get_column_spacing:
- * @layout: a #ClutterFlowLayout
- *
- * Retrieves the spacing between columns
- *
- * Return value: the spacing between columns of the #ClutterFlowLayout,
- * in pixels
- *
- * Since: 1.2
- */
-gfloat
-clutter_flow_layout_get_column_spacing (ClutterFlowLayout *layout)
-{
- g_return_val_if_fail (CLUTTER_IS_FLOW_LAYOUT (layout), 0.0);
-
- return layout->priv->col_spacing;
-}
-
-/**
- * clutter_flow_layout_set_row_spacing:
- * @layout: a #ClutterFlowLayout
- * @spacing: the space between rows
- *
- * Sets the spacing between rows, in pixels
- *
- * Since: 1.2
- */
-void
-clutter_flow_layout_set_row_spacing (ClutterFlowLayout *layout,
- gfloat spacing)
-{
- ClutterFlowLayoutPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_FLOW_LAYOUT (layout));
-
- priv = layout->priv;
-
- if (priv->row_spacing != spacing)
- {
- ClutterLayoutManager *manager;
-
- priv->row_spacing = spacing;
-
- manager = CLUTTER_LAYOUT_MANAGER (layout);
- clutter_layout_manager_layout_changed (manager);
-
- g_object_notify_by_pspec (G_OBJECT (layout),
- flow_properties[PROP_ROW_SPACING]);
- }
-}
-
-/**
- * clutter_flow_layout_get_row_spacing:
- * @layout: a #ClutterFlowLayout
- *
- * Retrieves the spacing between rows
- *
- * Return value: the spacing between rows of the #ClutterFlowLayout,
- * in pixels
- *
- * Since: 1.2
- */
-gfloat
-clutter_flow_layout_get_row_spacing (ClutterFlowLayout *layout)
-{
- g_return_val_if_fail (CLUTTER_IS_FLOW_LAYOUT (layout), 0.0);
-
- return layout->priv->row_spacing;
-}
-
-/**
- * clutter_flow_layout_set_column_width:
- * @layout: a #ClutterFlowLayout
- * @min_width: minimum width of a column
- * @max_width: maximum width of a column
- *
- * Sets the minimum and maximum widths that a column can have
- *
- * Since: 1.2
- */
-void
-clutter_flow_layout_set_column_width (ClutterFlowLayout *layout,
- gfloat min_width,
- gfloat max_width)
-{
- ClutterFlowLayoutPrivate *priv;
- gboolean notify_min = FALSE, notify_max = FALSE;
-
- g_return_if_fail (CLUTTER_IS_FLOW_LAYOUT (layout));
-
- priv = layout->priv;
-
- if (priv->min_col_width != min_width)
- {
- priv->min_col_width = min_width;
-
- notify_min = TRUE;
- }
-
- if (priv->max_col_width != max_width)
- {
- priv->max_col_width = max_width;
-
- notify_max = TRUE;
- }
-
- g_object_freeze_notify (G_OBJECT (layout));
-
- if (notify_min || notify_max)
- {
- ClutterLayoutManager *manager = CLUTTER_LAYOUT_MANAGER (layout);
-
- clutter_layout_manager_layout_changed (manager);
- }
-
- if (notify_min)
- g_object_notify_by_pspec (G_OBJECT (layout),
- flow_properties[PROP_MIN_COLUMN_WIDTH]);
-
- if (notify_max)
- g_object_notify_by_pspec (G_OBJECT (layout),
- flow_properties[PROP_MAX_COLUMN_WIDTH]);
-
- g_object_thaw_notify (G_OBJECT (layout));
-}
-
-/**
- * clutter_flow_layout_get_column_width:
- * @layout: a #ClutterFlowLayout
- * @min_width: (out): return location for the minimum column width, or %NULL
- * @max_width: (out): return location for the maximum column width, or %NULL
- *
- * Retrieves the minimum and maximum column widths
- *
- * Since: 1.2
- */
-void
-clutter_flow_layout_get_column_width (ClutterFlowLayout *layout,
- gfloat *min_width,
- gfloat *max_width)
-{
- g_return_if_fail (CLUTTER_IS_FLOW_LAYOUT (layout));
-
- if (min_width)
- *min_width = layout->priv->min_col_width;
-
- if (max_width)
- *max_width = layout->priv->max_col_width;
-}
-
-/**
- * clutter_flow_layout_set_row_height:
- * @layout: a #ClutterFlowLayout
- * @min_height: the minimum height of a row
- * @max_height: the maximum height of a row
- *
- * Sets the minimum and maximum heights that a row can have
- *
- * Since: 1.2
- */
-void
-clutter_flow_layout_set_row_height (ClutterFlowLayout *layout,
- gfloat min_height,
- gfloat max_height)
-{
- ClutterFlowLayoutPrivate *priv;
- gboolean notify_min = FALSE, notify_max = FALSE;
-
- g_return_if_fail (CLUTTER_IS_FLOW_LAYOUT (layout));
-
- priv = layout->priv;
-
- if (priv->min_row_height != min_height)
- {
- priv->min_row_height = min_height;
-
- notify_min = TRUE;
- }
-
- if (priv->max_row_height != max_height)
- {
- priv->max_row_height = max_height;
-
- notify_max = TRUE;
- }
-
- g_object_freeze_notify (G_OBJECT (layout));
-
- if (notify_min || notify_max)
- {
- ClutterLayoutManager *manager = CLUTTER_LAYOUT_MANAGER (layout);
-
- clutter_layout_manager_layout_changed (manager);
- }
-
- if (notify_min)
- g_object_notify_by_pspec (G_OBJECT (layout),
- flow_properties[PROP_MIN_ROW_HEGHT]);
-
- if (notify_max)
- g_object_notify_by_pspec (G_OBJECT (layout),
- flow_properties[PROP_MAX_ROW_HEIGHT]);
-
- g_object_thaw_notify (G_OBJECT (layout));
-}
-
-/**
- * clutter_flow_layout_get_row_height:
- * @layout: a #ClutterFlowLayout
- * @min_height: (out): return location for the minimum row height, or %NULL
- * @max_height: (out): return location for the maximum row height, or %NULL
- *
- * Retrieves the minimum and maximum row heights
- *
- * Since: 1.2
- */
-void
-clutter_flow_layout_get_row_height (ClutterFlowLayout *layout,
- gfloat *min_height,
- gfloat *max_height)
-{
- g_return_if_fail (CLUTTER_IS_FLOW_LAYOUT (layout));
-
- if (min_height)
- *min_height = layout->priv->min_row_height;
-
- if (max_height)
- *max_height = layout->priv->max_row_height;
-}
-
-/**
- * clutter_flow_layout_set_snap_to_grid:
- * @layout: a #ClutterFlowLayout
- * @snap_to_grid: %TRUE if @layout should place its children on a grid
- *
- * Whether the @layout should place its children on a grid.
- *
- * Since: 1.16
- */
-void
-clutter_flow_layout_set_snap_to_grid (ClutterFlowLayout *layout,
- gboolean snap_to_grid)
-{
- ClutterFlowLayoutPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_FLOW_LAYOUT (layout));
-
- priv = layout->priv;
-
- if (priv->snap_to_grid != snap_to_grid)
- {
- priv->snap_to_grid = snap_to_grid;
-
- clutter_layout_manager_layout_changed (CLUTTER_LAYOUT_MANAGER (layout));
-
- g_object_notify_by_pspec (G_OBJECT (layout),
- flow_properties[PROP_SNAP_TO_GRID]);
- }
-}
-
-/**
- * clutter_flow_layout_get_snap_to_grid:
- * @layout: a #ClutterFlowLayout
- *
- * Retrieves the value of #ClutterFlowLayout:snap-to-grid property
- *
- * Return value: %TRUE if the @layout is placing its children on a grid
- *
- * Since: 1.16
- */
-gboolean
-clutter_flow_layout_get_snap_to_grid (ClutterFlowLayout *layout)
-{
- g_return_val_if_fail (CLUTTER_IS_FLOW_LAYOUT (layout), FALSE);
-
- return layout->priv->snap_to_grid;
-}
diff --git a/clutter/clutter/clutter-flow-layout.h b/clutter/clutter/clutter-flow-layout.h
deleted file mode 100644
index 0980bc3cb..000000000
--- a/clutter/clutter/clutter-flow-layout.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2009 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_FLOW_LAYOUT_H__
-#define __CLUTTER_FLOW_LAYOUT_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-layout-manager.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_FLOW_LAYOUT (clutter_flow_layout_get_type ())
-#define CLUTTER_FLOW_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_FLOW_LAYOUT, ClutterFlowLayout))
-#define CLUTTER_IS_FLOW_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_FLOW_LAYOUT))
-#define CLUTTER_FLOW_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_FLOW_LAYOUT, ClutterFlowLayoutClass))
-#define CLUTTER_IS_FLOW_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_FLOW_LAYOUT))
-#define CLUTTER_FLOW_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_FLOW_LAYOUT, ClutterFlowLayoutClass))
-
-typedef struct _ClutterFlowLayout ClutterFlowLayout;
-typedef struct _ClutterFlowLayoutPrivate ClutterFlowLayoutPrivate;
-typedef struct _ClutterFlowLayoutClass ClutterFlowLayoutClass;
-
-/**
- * ClutterFlowLayout:
- *
- * The #ClutterFlowLayout structure contains only private data
- * and should be accessed using the provided API
- *
- * Since: 1.2
- */
-struct _ClutterFlowLayout
-{
- /*< private >*/
- ClutterLayoutManager parent_instance;
-
- ClutterFlowLayoutPrivate *priv;
-};
-
-/**
- * ClutterFlowLayoutClass:
- *
- * The #ClutterFlowLayoutClass structure contains only private data
- * and should be accessed using the provided API
- *
- * Since: 1.2
- */
-struct _ClutterFlowLayoutClass
-{
- /*< private >*/
- ClutterLayoutManagerClass parent_class;
-};
-
-CLUTTER_EXPORT
-GType clutter_flow_layout_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterLayoutManager * clutter_flow_layout_new (ClutterFlowOrientation orientation);
-
-CLUTTER_EXPORT
-void clutter_flow_layout_set_orientation (ClutterFlowLayout *layout,
- ClutterFlowOrientation orientation);
-CLUTTER_EXPORT
-ClutterFlowOrientation clutter_flow_layout_get_orientation (ClutterFlowLayout *layout);
-CLUTTER_EXPORT
-void clutter_flow_layout_set_homogeneous (ClutterFlowLayout *layout,
- gboolean homogeneous);
-CLUTTER_EXPORT
-gboolean clutter_flow_layout_get_homogeneous (ClutterFlowLayout *layout);
-
-CLUTTER_EXPORT
-void clutter_flow_layout_set_column_spacing (ClutterFlowLayout *layout,
- gfloat spacing);
-CLUTTER_EXPORT
-gfloat clutter_flow_layout_get_column_spacing (ClutterFlowLayout *layout);
-CLUTTER_EXPORT
-void clutter_flow_layout_set_row_spacing (ClutterFlowLayout *layout,
- gfloat spacing);
-CLUTTER_EXPORT
-gfloat clutter_flow_layout_get_row_spacing (ClutterFlowLayout *layout);
-
-CLUTTER_EXPORT
-void clutter_flow_layout_set_column_width (ClutterFlowLayout *layout,
- gfloat min_width,
- gfloat max_width);
-CLUTTER_EXPORT
-void clutter_flow_layout_get_column_width (ClutterFlowLayout *layout,
- gfloat *min_width,
- gfloat *max_width);
-CLUTTER_EXPORT
-void clutter_flow_layout_set_row_height (ClutterFlowLayout *layout,
- gfloat min_height,
- gfloat max_height);
-CLUTTER_EXPORT
-void clutter_flow_layout_get_row_height (ClutterFlowLayout *layout,
- gfloat *min_height,
- gfloat *max_height);
-CLUTTER_EXPORT
-void clutter_flow_layout_set_snap_to_grid (ClutterFlowLayout *layout,
- gboolean snap_to_grid);
-CLUTTER_EXPORT
-gboolean clutter_flow_layout_get_snap_to_grid (ClutterFlowLayout *layout);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_FLOW_LAYOUT_H__ */
diff --git a/clutter/clutter/clutter-frame-clock.c b/clutter/clutter/clutter-frame-clock.c
deleted file mode 100644
index 65f6229b0..000000000
--- a/clutter/clutter/clutter-frame-clock.c
+++ /dev/null
@@ -1,843 +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/>.
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter/clutter-frame-clock.h"
-
-#include "clutter/clutter-debug.h"
-#include "clutter/clutter-main.h"
-#include "clutter/clutter-private.h"
-#include "clutter/clutter-timeline-private.h"
-#include "cogl/cogl-trace.h"
-
-enum
-{
- DESTROY,
-
- N_SIGNALS
-};
-
-static guint signals[N_SIGNALS];
-
-/* An estimate queue holds several int64_t values. Adding a new value to the
- * queue overwrites the oldest value.
- */
-#define ESTIMATE_QUEUE_LENGTH 16
-
-typedef struct _EstimateQueue
-{
- int64_t values[ESTIMATE_QUEUE_LENGTH];
- int next_index;
-} EstimateQueue;
-
-/* When heuristic render time is off,
- * wait 2ms after vblank before starting to draw next frame.
- */
-#define SYNC_DELAY_FALLBACK_US ms2us (2)
-
-typedef struct _ClutterFrameListener
-{
- const ClutterFrameListenerIface *iface;
- gpointer user_data;
-} ClutterFrameListener;
-
-typedef struct _ClutterClockSource
-{
- GSource source;
-
- ClutterFrameClock *frame_clock;
-} ClutterClockSource;
-
-typedef enum _ClutterFrameClockState
-{
- CLUTTER_FRAME_CLOCK_STATE_INIT,
- CLUTTER_FRAME_CLOCK_STATE_IDLE,
- CLUTTER_FRAME_CLOCK_STATE_SCHEDULED,
- CLUTTER_FRAME_CLOCK_STATE_DISPATCHING,
- CLUTTER_FRAME_CLOCK_STATE_PENDING_PRESENTED,
-} ClutterFrameClockState;
-
-struct _ClutterFrameClock
-{
- GObject parent;
-
- float refresh_rate;
- int64_t refresh_interval_us;
- ClutterFrameListener listener;
-
- GSource *source;
-
- int64_t frame_count;
-
- ClutterFrameClockState state;
- int64_t last_dispatch_time_us;
- int64_t last_dispatch_lateness_us;
- int64_t last_presentation_time_us;
-
- gboolean is_next_presentation_time_valid;
- int64_t next_presentation_time_us;
-
- /* Buffer must be submitted to KMS and GPU rendering must be finished
- * this amount of time before the next presentation time.
- */
- int64_t vblank_duration_us;
- /* Last KMS buffer submission time. */
- int64_t last_flip_time_us;
-
- /* Last few durations between dispatch start and buffer swap. */
- EstimateQueue dispatch_to_swap_us;
- /* Last few durations between buffer swap and GPU rendering finish. */
- EstimateQueue swap_to_rendering_done_us;
- /* Last few durations between buffer swap and KMS submission. */
- EstimateQueue swap_to_flip_us;
- /* If we got new measurements last frame. */
- gboolean got_measurements_last_frame;
-
- gboolean pending_reschedule;
- gboolean pending_reschedule_now;
-
- int inhibit_count;
-
- GList *timelines;
-};
-
-G_DEFINE_TYPE (ClutterFrameClock, clutter_frame_clock,
- G_TYPE_OBJECT)
-
-static void
-estimate_queue_add_value (EstimateQueue *queue,
- int64_t value)
-{
- queue->values[queue->next_index] = value;
- queue->next_index = (queue->next_index + 1) % ESTIMATE_QUEUE_LENGTH;
-}
-
-float
-clutter_frame_clock_get_refresh_rate (ClutterFrameClock *frame_clock)
-{
- return frame_clock->refresh_rate;
-}
-
-static void
-clutter_frame_clock_set_refresh_rate (ClutterFrameClock *frame_clock,
- float refresh_rate)
-{
- frame_clock->refresh_rate = refresh_rate;
- frame_clock->refresh_interval_us =
- (int64_t) (0.5 + G_USEC_PER_SEC / refresh_rate);
-}
-
-void
-clutter_frame_clock_add_timeline (ClutterFrameClock *frame_clock,
- ClutterTimeline *timeline)
-{
- gboolean is_first;
-
- if (g_list_find (frame_clock->timelines, timeline))
- return;
-
- is_first = !frame_clock->timelines;
-
- frame_clock->timelines = g_list_prepend (frame_clock->timelines, timeline);
-
- if (is_first)
- clutter_frame_clock_schedule_update (frame_clock);
-}
-
-void
-clutter_frame_clock_remove_timeline (ClutterFrameClock *frame_clock,
- ClutterTimeline *timeline)
-{
- frame_clock->timelines = g_list_remove (frame_clock->timelines, timeline);
-}
-
-static void
-advance_timelines (ClutterFrameClock *frame_clock,
- int64_t time_us)
-{
- GList *timelines;
- GList *l;
-
- /* we protect ourselves from timelines being removed during
- * the advancement by other timelines by copying the list of
- * timelines, taking a reference on them, iterating over the
- * copied list and then releasing the reference.
- *
- * we cannot simply take a reference on the timelines and still
- * use the list held by the master clock because the do_tick()
- * might result in the creation of a new timeline, which gets
- * added at the end of the list with no reference increase and
- * thus gets disposed at the end of the iteration.
- *
- * this implies that a newly added timeline will not be advanced
- * by this clock iteration, which is perfectly fine since we're
- * in its first cycle.
- *
- * we also cannot steal the frame clock timelines list because
- * a timeline might be removed as the direct result of do_tick()
- * and remove_timeline() would not find the timeline, failing
- * and leaving a dangling pointer behind.
- */
-
- timelines = g_list_copy (frame_clock->timelines);
- g_list_foreach (timelines, (GFunc) g_object_ref, NULL);
-
- for (l = timelines; l; l = l->next)
- {
- ClutterTimeline *timeline = l->data;
-
- _clutter_timeline_do_tick (timeline, time_us / 1000);
- }
-
- g_list_free_full (timelines, g_object_unref);
-}
-
-static void
-maybe_reschedule_update (ClutterFrameClock *frame_clock)
-{
- if (frame_clock->pending_reschedule ||
- frame_clock->timelines)
- {
- frame_clock->pending_reschedule = FALSE;
-
- if (frame_clock->pending_reschedule_now)
- {
- frame_clock->pending_reschedule_now = FALSE;
- clutter_frame_clock_schedule_update_now (frame_clock);
- }
- else
- {
- clutter_frame_clock_schedule_update (frame_clock);
- }
- }
-}
-
-void
-clutter_frame_clock_notify_presented (ClutterFrameClock *frame_clock,
- ClutterFrameInfo *frame_info)
-{
- frame_clock->last_presentation_time_us = frame_info->presentation_time;
-
- frame_clock->got_measurements_last_frame = FALSE;
-
- if (frame_info->cpu_time_before_buffer_swap_us != 0 &&
- frame_info->gpu_rendering_duration_ns != 0)
- {
- int64_t dispatch_to_swap_us, swap_to_rendering_done_us, swap_to_flip_us;
-
- dispatch_to_swap_us =
- frame_info->cpu_time_before_buffer_swap_us -
- frame_clock->last_dispatch_time_us;
- swap_to_rendering_done_us =
- frame_info->gpu_rendering_duration_ns / 1000;
- swap_to_flip_us =
- frame_clock->last_flip_time_us -
- frame_info->cpu_time_before_buffer_swap_us;
-
- CLUTTER_NOTE (FRAME_TIMINGS,
- "dispatch2swap %ld µs, swap2render %ld µs, swap2flip %ld µs",
- dispatch_to_swap_us,
- swap_to_rendering_done_us,
- swap_to_flip_us);
-
- estimate_queue_add_value (&frame_clock->dispatch_to_swap_us,
- dispatch_to_swap_us);
- estimate_queue_add_value (&frame_clock->swap_to_rendering_done_us,
- swap_to_rendering_done_us);
- estimate_queue_add_value (&frame_clock->swap_to_flip_us,
- swap_to_flip_us);
-
- frame_clock->got_measurements_last_frame = TRUE;
- }
-
- if (frame_info->refresh_rate > 1)
- {
- clutter_frame_clock_set_refresh_rate (frame_clock,
- frame_info->refresh_rate);
- }
-
- switch (frame_clock->state)
- {
- case CLUTTER_FRAME_CLOCK_STATE_INIT:
- case CLUTTER_FRAME_CLOCK_STATE_IDLE:
- case CLUTTER_FRAME_CLOCK_STATE_SCHEDULED:
- g_warn_if_reached ();
- break;
- case CLUTTER_FRAME_CLOCK_STATE_DISPATCHING:
- case CLUTTER_FRAME_CLOCK_STATE_PENDING_PRESENTED:
- frame_clock->state = CLUTTER_FRAME_CLOCK_STATE_IDLE;
- maybe_reschedule_update (frame_clock);
- break;
- }
-}
-
-void
-clutter_frame_clock_notify_ready (ClutterFrameClock *frame_clock)
-{
- switch (frame_clock->state)
- {
- case CLUTTER_FRAME_CLOCK_STATE_INIT:
- case CLUTTER_FRAME_CLOCK_STATE_IDLE:
- case CLUTTER_FRAME_CLOCK_STATE_SCHEDULED:
- g_warn_if_reached ();
- break;
- case CLUTTER_FRAME_CLOCK_STATE_DISPATCHING:
- case CLUTTER_FRAME_CLOCK_STATE_PENDING_PRESENTED:
- frame_clock->state = CLUTTER_FRAME_CLOCK_STATE_IDLE;
- maybe_reschedule_update (frame_clock);
- break;
- }
-}
-
-static int64_t
-clutter_frame_clock_compute_max_render_time_us (ClutterFrameClock *frame_clock)
-{
- int64_t refresh_interval_us;
- int64_t max_dispatch_to_swap_us = 0;
- int64_t max_swap_to_rendering_done_us = 0;
- int64_t max_swap_to_flip_us = 0;
- int64_t max_render_time_us;
- int i;
-
- refresh_interval_us =
- (int64_t) (0.5 + G_USEC_PER_SEC / frame_clock->refresh_rate);
-
- if (!frame_clock->got_measurements_last_frame ||
- G_UNLIKELY (clutter_paint_debug_flags &
- CLUTTER_DEBUG_DISABLE_DYNAMIC_MAX_RENDER_TIME))
- return refresh_interval_us - SYNC_DELAY_FALLBACK_US;
-
- for (i = 0; i < ESTIMATE_QUEUE_LENGTH; ++i)
- {
- max_dispatch_to_swap_us =
- MAX (max_dispatch_to_swap_us,
- frame_clock->dispatch_to_swap_us.values[i]);
- max_swap_to_rendering_done_us =
- MAX (max_swap_to_rendering_done_us,
- frame_clock->swap_to_rendering_done_us.values[i]);
- max_swap_to_flip_us =
- MAX (max_swap_to_flip_us,
- frame_clock->swap_to_flip_us.values[i]);
- }
-
- /* Max render time shows how early the frame clock needs to be dispatched
- * to make it to the predicted next presentation time. It is composed of:
- * - An estimate of duration from dispatch start to buffer swap.
- * - Maximum between estimates of duration from buffer swap to GPU rendering
- * finish and duration from buffer swap to buffer submission to KMS. This
- * is because both of these things need to happen before the vblank, and
- * they are done in parallel.
- * - Duration of the vblank.
- * - A constant to account for variations in the above estimates.
- */
- max_render_time_us =
- max_dispatch_to_swap_us +
- MAX (max_swap_to_rendering_done_us, max_swap_to_flip_us) +
- frame_clock->vblank_duration_us +
- clutter_max_render_time_constant_us;
-
- max_render_time_us = CLAMP (max_render_time_us, 0, refresh_interval_us);
-
- return max_render_time_us;
-}
-
-static void
-calculate_next_update_time_us (ClutterFrameClock *frame_clock,
- int64_t *out_next_update_time_us,
- int64_t *out_next_presentation_time_us)
-{
- int64_t last_presentation_time_us;
- int64_t now_us;
- int64_t refresh_interval_us;
- int64_t min_render_time_allowed_us;
- int64_t max_render_time_allowed_us;
- int64_t last_next_presentation_time_us;
- int64_t time_since_last_next_presentation_time_us;
- int64_t next_presentation_time_us;
- int64_t next_update_time_us;
-
- now_us = g_get_monotonic_time ();
-
- refresh_interval_us = frame_clock->refresh_interval_us;
-
- if (frame_clock->last_presentation_time_us == 0)
- {
- *out_next_update_time_us =
- frame_clock->last_dispatch_time_us ?
- ((frame_clock->last_dispatch_time_us -
- frame_clock->last_dispatch_lateness_us) + refresh_interval_us) :
- now_us;
-
- *out_next_presentation_time_us = 0;
- return;
- }
-
- min_render_time_allowed_us = refresh_interval_us / 2;
- max_render_time_allowed_us =
- clutter_frame_clock_compute_max_render_time_us (frame_clock);
-
- if (min_render_time_allowed_us > max_render_time_allowed_us)
- min_render_time_allowed_us = max_render_time_allowed_us;
-
- /*
- * The common case is that the next presentation happens 1 refresh interval
- * after the last presentation:
- *
- * last_presentation_time_us
- * / next_presentation_time_us
- * / /
- * / /
- * |--|--o----|-------|--> presentation times
- * | | \ |
- * | | now_us
- * | \______/
- * | refresh_interval_us
- * |
- * 0
- *
- */
- last_presentation_time_us = frame_clock->last_presentation_time_us;
- next_presentation_time_us = last_presentation_time_us + refresh_interval_us;
-
- /*
- * However, the last presentation could have happened more than a frame ago.
- * For example, due to idling (nothing on screen changed, so no need to
- * redraw) or due to frames missing deadlines (GPU busy with heavy rendering).
- * The following code adjusts next_presentation_time_us to be in the future,
- * but still aligned to display presentation times. Instead of
- * next presentation = last presentation + 1 * refresh interval, it will be
- * next presentation = last presentation + N * refresh interval.
- */
- if (next_presentation_time_us < now_us)
- {
- int64_t presentation_phase_us;
- int64_t current_phase_us;
- int64_t current_refresh_interval_start_us;
-
- /*
- * Let's say we're just past next_presentation_time_us.
- *
- * First, we compute presentation_phase_us. Real presentation times don't
- * have to be exact multiples of refresh_interval_us and
- * presentation_phase_us represents this difference. Next, we compute
- * current phase and the refresh interval start corresponding to now_us.
- * Finally, add presentation_phase_us and a refresh interval to get the
- * next presentation after now_us.
- *
- * last_presentation_time_us
- * / next_presentation_time_us
- * / / now_us
- * / / / new next_presentation_time_us
- * |--|-------|---o---|-------|--> presentation times
- * | __|
- * | |presentation_phase_us
- * | |
- * | | now_us - presentation_phase_us
- * | | /
- * |-------|---o---|-------|-----> integer multiples of refresh_interval_us
- * | \__/
- * | |current_phase_us
- * | \
- * | current_refresh_interval_start_us
- * 0
- *
- */
-
- presentation_phase_us = last_presentation_time_us % refresh_interval_us;
- current_phase_us = (now_us - presentation_phase_us) % refresh_interval_us;
- current_refresh_interval_start_us =
- now_us - presentation_phase_us - current_phase_us;
-
- next_presentation_time_us =
- current_refresh_interval_start_us +
- presentation_phase_us +
- refresh_interval_us;
- }
-
- /*
- * Skip one interval if we got an early presented event.
- *
- * last frame this was last_presentation_time
- * / frame_clock->next_presentation_time_us
- * / /
- * |---|-o-----|-x----->
- * | \
- * \ next_presentation_time_us is thus right after the last one
- * but got an unexpected early presentation
- * \_/
- * time_since_last_next_presentation_time_us
- *
- */
- last_next_presentation_time_us = frame_clock->next_presentation_time_us;
- time_since_last_next_presentation_time_us =
- next_presentation_time_us - last_next_presentation_time_us;
- if (frame_clock->is_next_presentation_time_valid &&
- time_since_last_next_presentation_time_us < (refresh_interval_us / 2))
- {
- next_presentation_time_us =
- frame_clock->next_presentation_time_us + refresh_interval_us;
- }
-
- while (next_presentation_time_us < now_us + min_render_time_allowed_us)
- next_presentation_time_us += refresh_interval_us;
-
- next_update_time_us = next_presentation_time_us - max_render_time_allowed_us;
-
- *out_next_update_time_us = next_update_time_us;
- *out_next_presentation_time_us = next_presentation_time_us;
-}
-
-void
-clutter_frame_clock_inhibit (ClutterFrameClock *frame_clock)
-{
- frame_clock->inhibit_count++;
-
- if (frame_clock->inhibit_count == 1)
- {
- switch (frame_clock->state)
- {
- case CLUTTER_FRAME_CLOCK_STATE_INIT:
- case CLUTTER_FRAME_CLOCK_STATE_IDLE:
- break;
- case CLUTTER_FRAME_CLOCK_STATE_SCHEDULED:
- frame_clock->pending_reschedule = TRUE;
- frame_clock->state = CLUTTER_FRAME_CLOCK_STATE_IDLE;
- break;
- case CLUTTER_FRAME_CLOCK_STATE_DISPATCHING:
- case CLUTTER_FRAME_CLOCK_STATE_PENDING_PRESENTED:
- break;
- }
-
- g_source_set_ready_time (frame_clock->source, -1);
- }
-}
-
-void
-clutter_frame_clock_uninhibit (ClutterFrameClock *frame_clock)
-{
- g_return_if_fail (frame_clock->inhibit_count > 0);
-
- frame_clock->inhibit_count--;
-
- if (frame_clock->inhibit_count == 0)
- maybe_reschedule_update (frame_clock);
-}
-
-void
-clutter_frame_clock_schedule_update_now (ClutterFrameClock *frame_clock)
-{
- int64_t next_update_time_us = -1;
-
- if (frame_clock->inhibit_count > 0)
- {
- frame_clock->pending_reschedule = TRUE;
- frame_clock->pending_reschedule_now = TRUE;
- return;
- }
-
- switch (frame_clock->state)
- {
- case CLUTTER_FRAME_CLOCK_STATE_INIT:
- case CLUTTER_FRAME_CLOCK_STATE_IDLE:
- next_update_time_us = g_get_monotonic_time ();
- break;
- case CLUTTER_FRAME_CLOCK_STATE_SCHEDULED:
- return;
- case CLUTTER_FRAME_CLOCK_STATE_DISPATCHING:
- case CLUTTER_FRAME_CLOCK_STATE_PENDING_PRESENTED:
- frame_clock->pending_reschedule = TRUE;
- frame_clock->pending_reschedule_now = TRUE;
- return;
- }
-
- g_warn_if_fail (next_update_time_us != -1);
-
- g_source_set_ready_time (frame_clock->source, next_update_time_us);
- frame_clock->state = CLUTTER_FRAME_CLOCK_STATE_SCHEDULED;
- frame_clock->is_next_presentation_time_valid = FALSE;
-}
-
-void
-clutter_frame_clock_schedule_update (ClutterFrameClock *frame_clock)
-{
- int64_t next_update_time_us = -1;
-
- if (frame_clock->inhibit_count > 0)
- {
- frame_clock->pending_reschedule = TRUE;
- return;
- }
-
- switch (frame_clock->state)
- {
- case CLUTTER_FRAME_CLOCK_STATE_INIT:
- next_update_time_us = g_get_monotonic_time ();
- break;
- case CLUTTER_FRAME_CLOCK_STATE_IDLE:
- calculate_next_update_time_us (frame_clock,
- &next_update_time_us,
- &frame_clock->next_presentation_time_us);
- frame_clock->is_next_presentation_time_valid =
- (frame_clock->next_presentation_time_us != 0);
- break;
- case CLUTTER_FRAME_CLOCK_STATE_SCHEDULED:
- return;
- case CLUTTER_FRAME_CLOCK_STATE_DISPATCHING:
- case CLUTTER_FRAME_CLOCK_STATE_PENDING_PRESENTED:
- frame_clock->pending_reschedule = TRUE;
- return;
- }
-
- g_warn_if_fail (next_update_time_us != -1);
-
- g_source_set_ready_time (frame_clock->source, next_update_time_us);
- frame_clock->state = CLUTTER_FRAME_CLOCK_STATE_SCHEDULED;
-}
-
-static void
-clutter_frame_clock_dispatch (ClutterFrameClock *frame_clock,
- int64_t time_us)
-{
- int64_t frame_count;
- ClutterFrameResult result;
- int64_t ideal_dispatch_time_us, lateness_us;
-
- COGL_TRACE_BEGIN_SCOPED (ClutterFrameClockDispatch, "Frame Clock (dispatch)");
-
- ideal_dispatch_time_us = (frame_clock->last_dispatch_time_us -
- frame_clock->last_dispatch_lateness_us) +
- frame_clock->refresh_interval_us;
-
- lateness_us = time_us - ideal_dispatch_time_us;
- if (lateness_us < 0 || lateness_us >= frame_clock->refresh_interval_us)
- frame_clock->last_dispatch_lateness_us = 0;
- else
- frame_clock->last_dispatch_lateness_us = lateness_us;
-
- frame_clock->last_dispatch_time_us = time_us;
- g_source_set_ready_time (frame_clock->source, -1);
-
- frame_clock->state = CLUTTER_FRAME_CLOCK_STATE_DISPATCHING;
-
- frame_count = frame_clock->frame_count++;
-
- COGL_TRACE_BEGIN (ClutterFrameClockEvents, "Frame Clock (before frame)");
- if (frame_clock->listener.iface->before_frame)
- {
- frame_clock->listener.iface->before_frame (frame_clock,
- frame_count,
- frame_clock->listener.user_data);
- }
- COGL_TRACE_END (ClutterFrameClockEvents);
-
- COGL_TRACE_BEGIN (ClutterFrameClockTimelines, "Frame Clock (timelines)");
- advance_timelines (frame_clock, time_us);
- COGL_TRACE_END (ClutterFrameClockTimelines);
-
- COGL_TRACE_BEGIN (ClutterFrameClockFrame, "Frame Clock (frame)");
- result = frame_clock->listener.iface->frame (frame_clock,
- frame_count,
- time_us,
- frame_clock->listener.user_data);
- COGL_TRACE_END (ClutterFrameClockFrame);
-
- switch (frame_clock->state)
- {
- case CLUTTER_FRAME_CLOCK_STATE_INIT:
- case CLUTTER_FRAME_CLOCK_STATE_PENDING_PRESENTED:
- g_warn_if_reached ();
- break;
- case CLUTTER_FRAME_CLOCK_STATE_IDLE:
- case CLUTTER_FRAME_CLOCK_STATE_SCHEDULED:
- break;
- case CLUTTER_FRAME_CLOCK_STATE_DISPATCHING:
- switch (result)
- {
- case CLUTTER_FRAME_RESULT_PENDING_PRESENTED:
- frame_clock->state = CLUTTER_FRAME_CLOCK_STATE_PENDING_PRESENTED;
- break;
- case CLUTTER_FRAME_RESULT_IDLE:
- frame_clock->state = CLUTTER_FRAME_CLOCK_STATE_IDLE;
- maybe_reschedule_update (frame_clock);
- break;
- }
- break;
- }
-}
-
-static gboolean
-frame_clock_source_dispatch (GSource *source,
- GSourceFunc callback,
- gpointer user_data)
-{
- ClutterClockSource *clock_source = (ClutterClockSource *) source;
- ClutterFrameClock *frame_clock = clock_source->frame_clock;
- int64_t dispatch_time_us;
-
- dispatch_time_us = g_source_get_time (source);
- clutter_frame_clock_dispatch (frame_clock, dispatch_time_us);
-
- return G_SOURCE_CONTINUE;
-}
-
-void
-clutter_frame_clock_record_flip_time (ClutterFrameClock *frame_clock,
- int64_t flip_time_us)
-{
- frame_clock->last_flip_time_us = flip_time_us;
-}
-
-GString *
-clutter_frame_clock_get_max_render_time_debug_info (ClutterFrameClock *frame_clock)
-{
- int64_t max_dispatch_to_swap_us = 0;
- int64_t max_swap_to_rendering_done_us = 0;
- int64_t max_swap_to_flip_us = 0;
- int i;
- GString *string;
-
- string = g_string_new (NULL);
- g_string_append_printf (string, "Max render time: %ld µs",
- clutter_frame_clock_compute_max_render_time_us (frame_clock));
-
- if (frame_clock->got_measurements_last_frame)
- g_string_append_printf (string, " =");
- else
- g_string_append_printf (string, " (no measurements last frame)");
-
- for (i = 0; i < ESTIMATE_QUEUE_LENGTH; ++i)
- {
- max_dispatch_to_swap_us =
- MAX (max_dispatch_to_swap_us,
- frame_clock->dispatch_to_swap_us.values[i]);
- max_swap_to_rendering_done_us =
- MAX (max_swap_to_rendering_done_us,
- frame_clock->swap_to_rendering_done_us.values[i]);
- max_swap_to_flip_us =
- MAX (max_swap_to_flip_us,
- frame_clock->swap_to_flip_us.values[i]);
- }
-
- g_string_append_printf (string, "\nVblank duration: %ld µs +",
- frame_clock->vblank_duration_us);
- g_string_append_printf (string, "\nDispatch to swap: %ld µs +",
- max_dispatch_to_swap_us);
- g_string_append_printf (string, "\nmax(Swap to rendering done: %ld µs,",
- max_swap_to_rendering_done_us);
- g_string_append_printf (string, "\nSwap to flip: %ld µs) +",
- max_swap_to_flip_us);
- g_string_append_printf (string, "\nConstant: %d µs",
- clutter_max_render_time_constant_us);
-
- return string;
-}
-
-static GSourceFuncs frame_clock_source_funcs = {
- NULL,
- NULL,
- frame_clock_source_dispatch,
- NULL
-};
-
-static void
-init_frame_clock_source (ClutterFrameClock *frame_clock)
-{
- GSource *source;
- ClutterClockSource *clock_source;
- g_autofree char *name = NULL;
-
- source = g_source_new (&frame_clock_source_funcs, sizeof (ClutterClockSource));
- clock_source = (ClutterClockSource *) source;
-
- name = g_strdup_printf ("Clutter frame clock (%p)", frame_clock);
- g_source_set_name (source, name);
- g_source_set_priority (source, CLUTTER_PRIORITY_REDRAW);
- g_source_set_can_recurse (source, FALSE);
- clock_source->frame_clock = frame_clock;
-
- frame_clock->source = source;
- g_source_attach (source, NULL);
-}
-
-ClutterFrameClock *
-clutter_frame_clock_new (float refresh_rate,
- int64_t vblank_duration_us,
- const ClutterFrameListenerIface *iface,
- gpointer user_data)
-{
- ClutterFrameClock *frame_clock;
-
- g_assert_cmpfloat (refresh_rate, >, 0.0);
-
- frame_clock = g_object_new (CLUTTER_TYPE_FRAME_CLOCK, NULL);
-
- frame_clock->listener.iface = iface;
- frame_clock->listener.user_data = user_data;
-
- init_frame_clock_source (frame_clock);
-
- clutter_frame_clock_set_refresh_rate (frame_clock, refresh_rate);
- frame_clock->vblank_duration_us = vblank_duration_us;
-
- return frame_clock;
-}
-
-void
-clutter_frame_clock_destroy (ClutterFrameClock *frame_clock)
-{
- g_object_run_dispose (G_OBJECT (frame_clock));
- g_object_unref (frame_clock);
-}
-
-static void
-clutter_frame_clock_dispose (GObject *object)
-{
- ClutterFrameClock *frame_clock = CLUTTER_FRAME_CLOCK (object);
-
- if (frame_clock->source)
- {
- g_signal_emit (frame_clock, signals[DESTROY], 0);
- g_source_destroy (frame_clock->source);
- g_clear_pointer (&frame_clock->source, g_source_unref);
- }
-
- G_OBJECT_CLASS (clutter_frame_clock_parent_class)->dispose (object);
-}
-
-static void
-clutter_frame_clock_init (ClutterFrameClock *frame_clock)
-{
- frame_clock->state = CLUTTER_FRAME_CLOCK_STATE_INIT;
-}
-
-static void
-clutter_frame_clock_class_init (ClutterFrameClockClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->dispose = clutter_frame_clock_dispose;
-
- signals[DESTROY] =
- g_signal_new (I_("destroy"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL, NULL,
- G_TYPE_NONE,
- 0);
-}
diff --git a/clutter/clutter/clutter-frame-clock.h b/clutter/clutter/clutter-frame-clock.h
deleted file mode 100644
index e71b54987..000000000
--- a/clutter/clutter/clutter-frame-clock.h
+++ /dev/null
@@ -1,99 +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_FRAME_CLOCK_H
-#define CLUTTER_FRAME_CLOCK_H
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <glib.h>
-#include <glib-object.h>
-#include <stdint.h>
-
-#include "clutter/clutter-types.h"
-
-typedef enum _ClutterFrameResult
-{
- CLUTTER_FRAME_RESULT_PENDING_PRESENTED,
- CLUTTER_FRAME_RESULT_IDLE,
-} ClutterFrameResult;
-
-#define CLUTTER_TYPE_FRAME_CLOCK (clutter_frame_clock_get_type ())
-CLUTTER_EXPORT
-G_DECLARE_FINAL_TYPE (ClutterFrameClock, clutter_frame_clock,
- CLUTTER, FRAME_CLOCK,
- GObject)
-
-/**
- * ClutterFrameListenerIface: (skip)
- */
-typedef struct _ClutterFrameListenerIface
-{
- void (* before_frame) (ClutterFrameClock *frame_clock,
- int64_t frame_count,
- gpointer user_data);
- ClutterFrameResult (* frame) (ClutterFrameClock *frame_clock,
- int64_t frame_count,
- int64_t time_us,
- gpointer user_data);
-} ClutterFrameListenerIface;
-
-CLUTTER_EXPORT
-ClutterFrameClock * clutter_frame_clock_new (float refresh_rate,
- int64_t vblank_duration_us,
- const ClutterFrameListenerIface *iface,
- gpointer user_data);
-
-CLUTTER_EXPORT
-void clutter_frame_clock_destroy (ClutterFrameClock *frame_clock);
-
-CLUTTER_EXPORT
-void clutter_frame_clock_notify_presented (ClutterFrameClock *frame_clock,
- ClutterFrameInfo *frame_info);
-
-CLUTTER_EXPORT
-void clutter_frame_clock_notify_ready (ClutterFrameClock *frame_clock);
-
-CLUTTER_EXPORT
-void clutter_frame_clock_schedule_update (ClutterFrameClock *frame_clock);
-
-CLUTTER_EXPORT
-void clutter_frame_clock_schedule_update_now (ClutterFrameClock *frame_clock);
-
-CLUTTER_EXPORT
-void clutter_frame_clock_inhibit (ClutterFrameClock *frame_clock);
-
-CLUTTER_EXPORT
-void clutter_frame_clock_uninhibit (ClutterFrameClock *frame_clock);
-
-void clutter_frame_clock_add_timeline (ClutterFrameClock *frame_clock,
- ClutterTimeline *timeline);
-
-void clutter_frame_clock_remove_timeline (ClutterFrameClock *frame_clock,
- ClutterTimeline *timeline);
-
-CLUTTER_EXPORT
-float clutter_frame_clock_get_refresh_rate (ClutterFrameClock *frame_clock);
-
-void clutter_frame_clock_record_flip_time (ClutterFrameClock *frame_clock,
- int64_t flip_time_us);
-
-GString * clutter_frame_clock_get_max_render_time_debug_info (ClutterFrameClock *frame_clock);
-
-#endif /* CLUTTER_FRAME_CLOCK_H */
diff --git a/clutter/clutter/clutter-frame-private.h b/clutter/clutter/clutter-frame-private.h
deleted file mode 100644
index e0088564f..000000000
--- a/clutter/clutter/clutter-frame-private.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2020 Red Hat Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef CLUTTER_FRAME_PRIVATE_H
-#define CLUTTER_FRAME_PRIVATE_H
-
-#include "clutter/clutter-frame.h"
-
-struct _ClutterFrame
-{
- gboolean has_result;
- ClutterFrameResult result;
-};
-
-#define CLUTTER_FRAME_INIT ((ClutterFrame) { 0 })
-
-ClutterFrameResult clutter_frame_get_result (ClutterFrame *frame);
-
-#endif /* CLUTTER_FRAME_PRIVATE_H */
diff --git a/clutter/clutter/clutter-frame.c b/clutter/clutter/clutter-frame.c
deleted file mode 100644
index 3c708da9d..000000000
--- a/clutter/clutter/clutter-frame.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2020 Red Hat Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "clutter/clutter-frame-private.h"
-
-ClutterFrameResult
-clutter_frame_get_result (ClutterFrame *frame)
-{
- g_return_val_if_fail (frame->has_result, CLUTTER_FRAME_RESULT_IDLE);
-
- return frame->result;
-}
-
-gboolean
-clutter_frame_has_result (ClutterFrame *frame)
-{
- return frame->has_result;
-}
-
-void
-clutter_frame_set_result (ClutterFrame *frame,
- ClutterFrameResult result)
-{
- g_warn_if_fail (!frame->has_result);
-
- frame->result = result;
- frame->has_result = TRUE;
-}
diff --git a/clutter/clutter/clutter-frame.h b/clutter/clutter/clutter-frame.h
deleted file mode 100644
index d3608e81c..000000000
--- a/clutter/clutter/clutter-frame.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2020 Red Hat Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef CLUTTER_FRAME_H
-#define CLUTTER_FRAME_H
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include "clutter/clutter-frame-clock.h"
-
-typedef struct _ClutterFrame ClutterFrame;
-
-CLUTTER_EXPORT
-void clutter_frame_set_result (ClutterFrame *frame,
- ClutterFrameResult result);
-
-CLUTTER_EXPORT
-gboolean clutter_frame_has_result (ClutterFrame *frame);
-
-#endif /* CLUTTER_FRAME_H */
diff --git a/clutter/clutter/clutter-gesture-action-private.h b/clutter/clutter/clutter-gesture-action-private.h
deleted file mode 100644
index cd804abc7..000000000
--- a/clutter/clutter/clutter-gesture-action-private.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2012 Collabora Ltd..
- *
- * 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_GESTURE_ACTION_PRIVATE_H__
-#define __CLUTTER_GESTURE_ACTION_PRIVATE_H__
-
-#include <clutter/clutter-gesture-action.h>
-
-G_BEGIN_DECLS
-
-G_END_DECLS
-
-#endif /* __CLUTTER_GESTURE_ACTION_PRIVATE_H__ */
diff --git a/clutter/clutter/clutter-gesture-action.c b/clutter/clutter/clutter-gesture-action.c
deleted file mode 100644
index f938a549a..000000000
--- a/clutter/clutter/clutter-gesture-action.c
+++ /dev/null
@@ -1,1455 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- * Copyright (C) 2011 Robert Bosch Car Multimedia GmbH.
- * Copyright (C) 2012 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Tomeu Vizoso <tomeu.vizoso@collabora.co.uk>
- */
-
-/**
- * SECTION:clutter-gesture-action
- * @Title: ClutterGestureAction
- * @Short_Description: Action for gesture gestures
- *
- * #ClutterGestureAction is a sub-class of #ClutterAction that implements
- * the logic for recognizing gesture gestures. It listens for low level events
- * such as #ClutterButtonEvent and #ClutterMotionEvent on the stage to raise
- * the #ClutterGestureAction::gesture-begin, #ClutterGestureAction::gesture-progress,
- * and #ClutterGestureAction::gesture-end signals.
- *
- * To use #ClutterGestureAction you just need to apply it to a #ClutterActor
- * using clutter_actor_add_action() and connect to the signals:
- *
- * |[<!-- language="C" -->
- * ClutterAction *action = clutter_gesture_action_new ();
- *
- * clutter_actor_add_action (actor, action);
- *
- * g_signal_connect (action, "gesture-begin", G_CALLBACK (on_gesture_begin), NULL);
- * g_signal_connect (action, "gesture-progress", G_CALLBACK (on_gesture_progress), NULL);
- * g_signal_connect (action, "gesture-end", G_CALLBACK (on_gesture_end), NULL);
- * ]|
- *
- * ## Creating Gesture actions
- *
- * A #ClutterGestureAction provides four separate states that can be
- * used to recognize or ignore gestures when writing a new action class:
- *
- * - Prepare -> Cancel
- * - Prepare -> Begin -> Cancel
- * - Prepare -> Begin -> End
- * - Prepare -> Begin -> Progress -> Cancel
- * - Prepare -> Begin -> Progress -> End
- *
- * Each #ClutterGestureAction starts in the "prepare" state, and calls
- * the #ClutterGestureActionClass.gesture_prepare() virtual function; this
- * state can be used to reset the internal state of a #ClutterGestureAction
- * subclass, but it can also immediately cancel a gesture without going
- * through the rest of the states.
- *
- * The "begin" state follows the "prepare" state, and calls the
- * #ClutterGestureActionClass.gesture_begin() virtual function. This state
- * signals the start of a gesture recognizing process. From the "begin" state
- * the gesture recognition process can successfully end, by going to the
- * "end" state; it can continue in the "progress" state, in case of a
- * continuous gesture; or it can be terminated, by moving to the "cancel"
- * state.
- *
- * In case of continuous gestures, the #ClutterGestureAction will use
- * the "progress" state, calling the #ClutterGestureActionClass.gesture_progress()
- * virtual function; the "progress" state will continue until the end of the
- * gesture, in which case the "end" state will be reached, or until the
- * gesture is cancelled, in which case the "cancel" gesture will be used
- * instead.
- *
- * Since: 1.8
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-gesture-action-private.h"
-
-#include "clutter-debug.h"
-#include "clutter-enum-types.h"
-#include "clutter-marshal.h"
-#include "clutter-private.h"
-
-#include <math.h>
-
-#define MAX_GESTURE_POINTS (10)
-#define FLOAT_EPSILON (1e-15)
-
-typedef struct
-{
- ClutterInputDevice *device;
- ClutterEventSequence *sequence;
- ClutterEvent *last_event;
-
- gfloat press_x, press_y;
- gint64 last_motion_time;
- gfloat last_motion_x, last_motion_y;
- gint64 last_delta_time;
- gfloat last_delta_x, last_delta_y;
- gfloat release_x, release_y;
-} GesturePoint;
-
-struct _ClutterGestureActionPrivate
-{
- ClutterActor *stage;
-
- gint requested_nb_points;
- GArray *points;
-
- gulong actor_capture_id;
- gulong stage_capture_id;
-
- ClutterGestureTriggerEdge edge;
- float distance_x, distance_y;
-
- guint in_gesture : 1;
-};
-
-enum
-{
- PROP_0,
-
- PROP_N_TOUCH_POINTS,
- PROP_THRESHOLD_TRIGGER_EDGE,
- PROP_THRESHOLD_TRIGGER_DISTANCE_X,
- PROP_THRESHOLD_TRIGGER_DISTANCE_Y,
-
- PROP_LAST
-};
-
-enum
-{
- GESTURE_BEGIN,
- GESTURE_PROGRESS,
- GESTURE_END,
- GESTURE_CANCEL,
-
- LAST_SIGNAL
-};
-
-static GParamSpec *gesture_props[PROP_LAST];
-static guint gesture_signals[LAST_SIGNAL] = { 0, };
-
-G_DEFINE_TYPE_WITH_PRIVATE (ClutterGestureAction, clutter_gesture_action, CLUTTER_TYPE_ACTION)
-
-static GesturePoint *
-gesture_register_point (ClutterGestureAction *action, ClutterEvent *event)
-{
- ClutterGestureActionPrivate *priv =
- clutter_gesture_action_get_instance_private (action);
- GesturePoint *point = NULL;
-
- if (priv->points->len >= MAX_GESTURE_POINTS)
- return NULL;
-
- g_array_set_size (priv->points, priv->points->len + 1);
- point = &g_array_index (priv->points, GesturePoint, priv->points->len - 1);
-
- point->last_event = clutter_event_copy (event);
- point->device = clutter_event_get_device (event);
-
- clutter_event_get_coords (event, &point->press_x, &point->press_y);
- point->last_motion_x = point->press_x;
- point->last_motion_y = point->press_y;
- point->last_motion_time = clutter_event_get_time (event);
-
- point->last_delta_x = point->last_delta_y = 0;
- point->last_delta_time = 0;
-
- if (clutter_event_type (event) != CLUTTER_BUTTON_PRESS)
- point->sequence = clutter_event_get_event_sequence (event);
- else
- point->sequence = NULL;
-
- return point;
-}
-
-static GesturePoint *
-gesture_find_point (ClutterGestureAction *action,
- ClutterEvent *event,
- gint *position)
-{
- ClutterGestureActionPrivate *priv =
- clutter_gesture_action_get_instance_private (action);
- GesturePoint *point = NULL;
- ClutterEventType type = clutter_event_type (event);
- ClutterInputDevice *device = clutter_event_get_device (event);
- ClutterEventSequence *sequence = NULL;
- gint i;
-
- if ((type != CLUTTER_BUTTON_PRESS) &&
- (type != CLUTTER_BUTTON_RELEASE) &&
- (type != CLUTTER_MOTION))
- sequence = clutter_event_get_event_sequence (event);
-
- for (i = 0; i < priv->points->len; i++)
- {
- if ((g_array_index (priv->points, GesturePoint, i).device == device) &&
- (g_array_index (priv->points, GesturePoint, i).sequence == sequence))
- {
- if (position != NULL)
- *position = i;
- point = &g_array_index (priv->points, GesturePoint, i);
- break;
- }
- }
-
- return point;
-}
-
-static void
-gesture_unregister_point (ClutterGestureAction *action, gint position)
-{
- ClutterGestureActionPrivate *priv =
- clutter_gesture_action_get_instance_private (action);
-
- if (priv->points->len == 0)
- return;
-
- g_array_remove_index (priv->points, position);
-}
-
-static void
-gesture_update_motion_point (GesturePoint *point,
- ClutterEvent *event)
-{
- gfloat motion_x, motion_y;
- gint64 _time;
-
- clutter_event_get_coords (event, &motion_x, &motion_y);
-
- clutter_event_free (point->last_event);
- point->last_event = clutter_event_copy (event);
-
- point->last_delta_x = motion_x - point->last_motion_x;
- point->last_delta_y = motion_y - point->last_motion_y;
- point->last_motion_x = motion_x;
- point->last_motion_y = motion_y;
-
- _time = clutter_event_get_time (event);
- point->last_delta_time = _time - point->last_motion_time;
- point->last_motion_time = _time;
-}
-
-static void
-gesture_update_release_point (GesturePoint *point,
- ClutterEvent *event)
-{
- gint64 _time;
-
- clutter_event_get_coords (event, &point->release_x, &point->release_y);
-
- clutter_event_free (point->last_event);
- point->last_event = clutter_event_copy (event);
-
- /* Treat the release event as the continuation of the last motion,
- * in case the user keeps the pointer still for a while before
- * releasing it. */
- _time = clutter_event_get_time (event);
- point->last_delta_time += _time - point->last_motion_time;
-}
-
-static gint
-gesture_get_default_threshold (void)
-{
- gint threshold;
- ClutterSettings *settings = clutter_settings_get_default ();
- g_object_get (settings, "dnd-drag-threshold", &threshold, NULL);
- return threshold;
-}
-
-static gboolean
-gesture_point_pass_threshold (ClutterGestureAction *action,
- GesturePoint *point,
- ClutterEvent *event)
-{
- float threshold_x, threshold_y;
- gfloat motion_x, motion_y;
-
- clutter_event_get_coords (event, &motion_x, &motion_y);
- clutter_gesture_action_get_threshold_trigger_distance (action, &threshold_x, &threshold_y);
-
- if ((fabsf (point->press_y - motion_y) < threshold_y) &&
- (fabsf (point->press_x - motion_x) < threshold_x))
- return TRUE;
- return FALSE;
-}
-
-static void
-gesture_point_unset (GesturePoint *point)
-{
- clutter_event_free (point->last_event);
-}
-
-static void
-cancel_gesture (ClutterGestureAction *action)
-{
- ClutterGestureActionPrivate *priv =
- clutter_gesture_action_get_instance_private (action);
- ClutterActor *actor;
-
- priv->in_gesture = FALSE;
-
- g_clear_signal_handler (&priv->stage_capture_id, priv->stage);
-
- actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
- g_signal_emit (action, gesture_signals[GESTURE_CANCEL], 0, actor);
-
- g_array_set_size (priv->points, 0);
-}
-
-static gboolean
-begin_gesture (ClutterGestureAction *action,
- ClutterActor *actor)
-{
- ClutterGestureActionPrivate *priv =
- clutter_gesture_action_get_instance_private (action);
- gboolean return_value;
-
- priv->in_gesture = TRUE;
-
- if (!CLUTTER_GESTURE_ACTION_GET_CLASS (action)->gesture_prepare (action, actor))
- {
- cancel_gesture (action);
- return FALSE;
- }
-
- /* clutter_gesture_action_cancel() may have been called during
- * gesture_prepare(), check that the gesture is still active. */
- if (!priv->in_gesture)
- return FALSE;
-
- g_signal_emit (action, gesture_signals[GESTURE_BEGIN], 0, actor,
- &return_value);
-
- if (!return_value)
- {
- cancel_gesture (action);
- return FALSE;
- }
-
- return TRUE;
-}
-
-static gboolean
-stage_captured_event_cb (ClutterActor *stage,
- ClutterEvent *event,
- ClutterGestureAction *action)
-{
- ClutterGestureActionPrivate *priv =
- clutter_gesture_action_get_instance_private (action);
- ClutterActor *actor;
- gint position;
- float threshold_x, threshold_y;
- gboolean return_value;
- GesturePoint *point;
- ClutterEventType event_type;
-
- event_type = clutter_event_type (event);
- if (event_type != CLUTTER_TOUCH_CANCEL &&
- event_type != CLUTTER_TOUCH_UPDATE &&
- event_type != CLUTTER_TOUCH_END &&
- event_type != CLUTTER_MOTION &&
- event_type != CLUTTER_BUTTON_RELEASE)
- return CLUTTER_EVENT_PROPAGATE;
-
- if ((point = gesture_find_point (action, event, &position)) == NULL)
- return CLUTTER_EVENT_PROPAGATE;
-
- actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
-
- switch (clutter_event_type (event))
- {
- case CLUTTER_MOTION:
- {
- ClutterModifierType mods = clutter_event_get_state (event);
-
- /* we might miss a button-release event in case of grabs,
- * so we need to check whether the button is still down
- * during a motion event
- */
- if (!(mods & CLUTTER_BUTTON1_MASK))
- {
- cancel_gesture (action);
- return CLUTTER_EVENT_PROPAGATE;
- }
- }
- /* Follow same code path as a touch event update */
-
- case CLUTTER_TOUCH_UPDATE:
- if (!priv->in_gesture)
- {
- if (priv->points->len < priv->requested_nb_points)
- {
- gesture_update_motion_point (point, event);
- return CLUTTER_EVENT_PROPAGATE;
- }
-
- /* Wait until the drag threshold has been exceeded
- * before starting _TRIGGER_EDGE_AFTER gestures. */
- if (priv->edge == CLUTTER_GESTURE_TRIGGER_EDGE_AFTER &&
- gesture_point_pass_threshold (action, point, event))
- {
- gesture_update_motion_point (point, event);
- return CLUTTER_EVENT_PROPAGATE;
- }
-
- gesture_update_motion_point (point, event);
-
- if (!begin_gesture (action, actor))
- return CLUTTER_EVENT_PROPAGATE;
-
- if ((point = gesture_find_point (action, event, &position)) == NULL)
- return CLUTTER_EVENT_PROPAGATE;
- }
-
- gesture_update_motion_point (point, event);
-
- g_signal_emit (action, gesture_signals[GESTURE_PROGRESS], 0, actor,
- &return_value);
- if (!return_value)
- {
- cancel_gesture (action);
- return CLUTTER_EVENT_PROPAGATE;
- }
-
- /* Check if a _TRIGGER_EDGE_BEFORE gesture needs to be cancelled because
- * the drag threshold has been exceeded. */
- clutter_gesture_action_get_threshold_trigger_distance (action, &threshold_x, &threshold_y);
- if (priv->edge == CLUTTER_GESTURE_TRIGGER_EDGE_BEFORE &&
- ((fabsf (point->press_y - point->last_motion_y) > threshold_y) ||
- (fabsf (point->press_x - point->last_motion_x) > threshold_x)))
- {
- cancel_gesture (action);
- return CLUTTER_EVENT_PROPAGATE;
- }
- break;
-
- case CLUTTER_BUTTON_RELEASE:
- case CLUTTER_TOUCH_END:
- {
- gesture_update_release_point (point, event);
-
- if (priv->in_gesture &&
- ((priv->points->len - 1) < priv->requested_nb_points))
- {
- priv->in_gesture = FALSE;
- g_signal_emit (action, gesture_signals[GESTURE_END], 0, actor);
- }
-
- gesture_unregister_point (action, position);
- }
- break;
-
- case CLUTTER_TOUCH_CANCEL:
- {
- gesture_update_release_point (point, event);
-
- if (priv->in_gesture)
- {
- priv->in_gesture = FALSE;
- cancel_gesture (action);
- }
-
- gesture_unregister_point (action, position);
- }
- break;
-
- default:
- break;
- }
-
- if (priv->points->len == 0)
- g_clear_signal_handler (&priv->stage_capture_id, priv->stage);
-
- return CLUTTER_EVENT_PROPAGATE;
-}
-
-static gboolean
-actor_captured_event_cb (ClutterActor *actor,
- ClutterEvent *event,
- ClutterGestureAction *action)
-{
- ClutterGestureActionPrivate *priv =
- clutter_gesture_action_get_instance_private (action);
- GesturePoint *point G_GNUC_UNUSED;
-
- if ((clutter_event_type (event) != CLUTTER_BUTTON_PRESS) &&
- (clutter_event_type (event) != CLUTTER_TOUCH_BEGIN))
- return CLUTTER_EVENT_PROPAGATE;
-
- if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (action)))
- return CLUTTER_EVENT_PROPAGATE;
-
- point = gesture_register_point (action, event);
-
- if (priv->stage == NULL)
- priv->stage = clutter_actor_get_stage (actor);
-
- if (priv->stage_capture_id == 0)
- priv->stage_capture_id =
- g_signal_connect_after (priv->stage, "captured-event",
- G_CALLBACK (stage_captured_event_cb),
- action);
-
- /* Start the gesture immediately if the gesture has no
- * _TRIGGER_EDGE_AFTER drag threshold. */
- if ((priv->points->len >= priv->requested_nb_points) &&
- (priv->edge != CLUTTER_GESTURE_TRIGGER_EDGE_AFTER))
- begin_gesture (action, actor);
-
- return CLUTTER_EVENT_PROPAGATE;
-}
-
-static void
-clutter_gesture_action_set_actor (ClutterActorMeta *meta,
- ClutterActor *actor)
-{
- ClutterGestureActionPrivate *priv =
- clutter_gesture_action_get_instance_private (CLUTTER_GESTURE_ACTION (meta));
- ClutterActorMetaClass *meta_class =
- CLUTTER_ACTOR_META_CLASS (clutter_gesture_action_parent_class);
-
- if (priv->actor_capture_id != 0)
- {
- ClutterActor *old_actor = clutter_actor_meta_get_actor (meta);
-
- if (old_actor != NULL)
- g_clear_signal_handler (&priv->actor_capture_id, old_actor);
-
- priv->actor_capture_id = 0;
- }
-
- if (priv->stage_capture_id != 0)
- {
- if (priv->stage != NULL)
- g_clear_signal_handler (&priv->stage_capture_id, priv->stage);
-
- priv->stage_capture_id = 0;
- priv->stage = NULL;
- }
-
- if (actor != NULL)
- {
- priv->actor_capture_id =
- g_signal_connect (actor, "captured-event",
- G_CALLBACK (actor_captured_event_cb),
- meta);
- }
-
- meta_class->set_actor (meta, actor);
-}
-
-static void
-clutter_gesture_action_set_enabled (ClutterActorMeta *meta,
- gboolean is_enabled)
-{
- ClutterActorMetaClass *meta_class =
- CLUTTER_ACTOR_META_CLASS (clutter_gesture_action_parent_class);
- ClutterGestureAction *gesture_action = CLUTTER_GESTURE_ACTION (meta);
- ClutterGestureActionPrivate *priv =
- clutter_gesture_action_get_instance_private (gesture_action);
-
- if (!is_enabled)
- {
- if (priv->in_gesture)
- cancel_gesture (gesture_action);
- else
- g_array_set_size (priv->points, 0);
- }
-
- meta_class->set_enabled (meta, is_enabled);
-}
-
-static gboolean
-default_event_handler (ClutterGestureAction *action,
- ClutterActor *actor)
-{
- return TRUE;
-}
-
-static void
-clutter_gesture_action_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterGestureAction *self = CLUTTER_GESTURE_ACTION (gobject);
- ClutterGestureActionPrivate *priv =
- clutter_gesture_action_get_instance_private (self);
-
- switch (prop_id)
- {
- case PROP_N_TOUCH_POINTS:
- clutter_gesture_action_set_n_touch_points (self, g_value_get_int (value));
- break;
-
- case PROP_THRESHOLD_TRIGGER_EDGE:
- clutter_gesture_action_set_threshold_trigger_edge (self, g_value_get_enum (value));
- break;
-
- case PROP_THRESHOLD_TRIGGER_DISTANCE_X:
- clutter_gesture_action_set_threshold_trigger_distance (self,
- g_value_get_float (value),
- priv->distance_y);
- break;
-
- case PROP_THRESHOLD_TRIGGER_DISTANCE_Y:
- clutter_gesture_action_set_threshold_trigger_distance (self,
- priv->distance_x,
- g_value_get_float (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_gesture_action_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterGestureActionPrivate *priv =
- clutter_gesture_action_get_instance_private (CLUTTER_GESTURE_ACTION (gobject));
-
- switch (prop_id)
- {
- case PROP_N_TOUCH_POINTS:
- g_value_set_int (value, priv->requested_nb_points);
- break;
-
- case PROP_THRESHOLD_TRIGGER_EDGE:
- g_value_set_enum (value, priv->edge);
- break;
-
- case PROP_THRESHOLD_TRIGGER_DISTANCE_X:
- if (priv->distance_x > 0.0)
- g_value_set_float (value, priv->distance_x);
- else
- g_value_set_float (value, gesture_get_default_threshold ());
- break;
-
- case PROP_THRESHOLD_TRIGGER_DISTANCE_Y:
- if (priv->distance_y > 0.0)
- g_value_set_float (value, priv->distance_y);
- else
- g_value_set_float (value, gesture_get_default_threshold ());
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_gesture_action_finalize (GObject *gobject)
-{
- ClutterGestureActionPrivate *priv =
- clutter_gesture_action_get_instance_private (CLUTTER_GESTURE_ACTION (gobject));
-
- g_array_unref (priv->points);
-
- G_OBJECT_CLASS (clutter_gesture_action_parent_class)->finalize (gobject);
-}
-
-static void
-clutter_gesture_action_class_init (ClutterGestureActionClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
-
- gobject_class->finalize = clutter_gesture_action_finalize;
- gobject_class->set_property = clutter_gesture_action_set_property;
- gobject_class->get_property = clutter_gesture_action_get_property;
-
- meta_class->set_actor = clutter_gesture_action_set_actor;
- meta_class->set_enabled = clutter_gesture_action_set_enabled;
-
- klass->gesture_begin = default_event_handler;
- klass->gesture_progress = default_event_handler;
- klass->gesture_prepare = default_event_handler;
-
- /**
- * ClutterGestureAction:n-touch-points:
- *
- * Number of touch points to trigger a gesture action.
- *
- * Since: 1.16
- */
- gesture_props[PROP_N_TOUCH_POINTS] =
- g_param_spec_int ("n-touch-points",
- P_("Number touch points"),
- P_("Number of touch points"),
- 1, G_MAXINT, 1,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterGestureAction:threshold-trigger-edge:
- *
- * The trigger edge to be used by the action to either emit the
- * #ClutterGestureAction::gesture-begin signal or to emit the
- * #ClutterGestureAction::gesture-cancel signal.
- *
- * Since: 1.18
- */
- gesture_props[PROP_THRESHOLD_TRIGGER_EDGE] =
- g_param_spec_enum ("threshold-trigger-edge",
- P_("Threshold Trigger Edge"),
- P_("The trigger edge used by the action"),
- CLUTTER_TYPE_GESTURE_TRIGGER_EDGE,
- CLUTTER_GESTURE_TRIGGER_EDGE_NONE,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY);
-
- /**
- * ClutterGestureAction:threshold-trigger-distance-x:
- *
- * The horizontal trigger distance to be used by the action to either
- * emit the #ClutterGestureAction::gesture-begin signal or to emit
- * the #ClutterGestureAction::gesture-cancel signal.
- *
- * A negative value will be interpreted as the default drag threshold.
- *
- * Since: 1.18
- */
- gesture_props[PROP_THRESHOLD_TRIGGER_DISTANCE_X] =
- g_param_spec_float ("threshold-trigger-distance-x",
- P_("Threshold Trigger Horizontal Distance"),
- P_("The horizontal trigger distance used by the action"),
- -1.0, G_MAXFLOAT, -1.0,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY);
-
- /**
- * ClutterGestureAction:threshold-trigger-distance-y:
- *
- * The vertical trigger distance to be used by the action to either
- * emit the #ClutterGestureAction::gesture-begin signal or to emit
- * the #ClutterGestureAction::gesture-cancel signal.
- *
- * A negative value will be interpreted as the default drag threshold.
- *
- * Since: 1.18
- */
- gesture_props[PROP_THRESHOLD_TRIGGER_DISTANCE_Y] =
- g_param_spec_float ("threshold-trigger-distance-y",
- P_("Threshold Trigger Vertical Distance"),
- P_("The vertical trigger distance used by the action"),
- -1.0, G_MAXFLOAT, -1.0,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY);
-
- g_object_class_install_properties (gobject_class,
- PROP_LAST,
- gesture_props);
-
- /**
- * ClutterGestureAction::gesture-begin:
- * @action: the #ClutterGestureAction that emitted the signal
- * @actor: the #ClutterActor attached to the @action
- *
- * The ::gesture_begin signal is emitted when the #ClutterActor to which
- * a #ClutterGestureAction has been applied starts receiving a gesture.
- *
- * Return value: %TRUE if the gesture should start, and %FALSE if
- * the gesture should be ignored.
- *
- * Since: 1.8
- */
- gesture_signals[GESTURE_BEGIN] =
- g_signal_new (I_("gesture-begin"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterGestureActionClass, gesture_begin),
- _clutter_boolean_continue_accumulator, NULL,
- _clutter_marshal_BOOLEAN__OBJECT,
- G_TYPE_BOOLEAN, 1,
- CLUTTER_TYPE_ACTOR);
-
- /**
- * ClutterGestureAction::gesture-progress:
- * @action: the #ClutterGestureAction that emitted the signal
- * @actor: the #ClutterActor attached to the @action
- *
- * The ::gesture-progress signal is emitted for each motion event after
- * the #ClutterGestureAction::gesture-begin signal has been emitted.
- *
- * Return value: %TRUE if the gesture should continue, and %FALSE if
- * the gesture should be cancelled.
- *
- * Since: 1.8
- */
- gesture_signals[GESTURE_PROGRESS] =
- g_signal_new (I_("gesture-progress"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterGestureActionClass, gesture_progress),
- _clutter_boolean_continue_accumulator, NULL,
- _clutter_marshal_BOOLEAN__OBJECT,
- G_TYPE_BOOLEAN, 1,
- CLUTTER_TYPE_ACTOR);
-
- /**
- * ClutterGestureAction::gesture-end:
- * @action: the #ClutterGestureAction that emitted the signal
- * @actor: the #ClutterActor attached to the @action
- *
- * The ::gesture-end signal is emitted at the end of the gesture gesture,
- * when the pointer's button is released
- *
- * This signal is emitted if and only if the #ClutterGestureAction::gesture-begin
- * signal has been emitted first.
- *
- * Since: 1.8
- */
- gesture_signals[GESTURE_END] =
- g_signal_new (I_("gesture-end"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterGestureActionClass, gesture_end),
- NULL, NULL, NULL,
- G_TYPE_NONE, 1,
- CLUTTER_TYPE_ACTOR);
-
- /**
- * ClutterGestureAction::gesture-cancel:
- * @action: the #ClutterGestureAction that emitted the signal
- * @actor: the #ClutterActor attached to the @action
- *
- * The ::gesture-cancel signal is emitted when the ongoing gesture gets
- * cancelled from the #ClutterGestureAction::gesture-progress signal handler.
- *
- * This signal is emitted if and only if the #ClutterGestureAction::gesture-begin
- * signal has been emitted first.
- *
- * Since: 1.8
- */
- gesture_signals[GESTURE_CANCEL] =
- g_signal_new (I_("gesture-cancel"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterGestureActionClass, gesture_cancel),
- NULL, NULL, NULL,
- G_TYPE_NONE, 1,
- CLUTTER_TYPE_ACTOR);
-}
-
-static void
-clutter_gesture_action_init (ClutterGestureAction *self)
-{
- ClutterGestureActionPrivate *priv =
- clutter_gesture_action_get_instance_private (self);
-
- priv->points = g_array_sized_new (FALSE, TRUE, sizeof (GesturePoint), 3);
- g_array_set_clear_func (priv->points, (GDestroyNotify) gesture_point_unset);
-
- priv->requested_nb_points = 1;
- priv->edge = CLUTTER_GESTURE_TRIGGER_EDGE_NONE;
-}
-
-/**
- * clutter_gesture_action_new:
- *
- * Creates a new #ClutterGestureAction instance.
- *
- * Return value: the newly created #ClutterGestureAction
- *
- * Since: 1.8
- */
-ClutterAction *
-clutter_gesture_action_new (void)
-{
- return g_object_new (CLUTTER_TYPE_GESTURE_ACTION, NULL);
-}
-
-/**
- * clutter_gesture_action_get_press_coords:
- * @action: a #ClutterGestureAction
- * @point: the touch point index, with 0 being the first touch
- * point received by the action
- * @press_x: (out) (allow-none): return location for the press
- * event's X coordinate
- * @press_y: (out) (allow-none): return location for the press
- * event's Y coordinate
- *
- * Retrieves the coordinates, in stage space, of the press event
- * that started the dragging for a specific touch point.
- *
- * Since: 1.8
- */
-void
-clutter_gesture_action_get_press_coords (ClutterGestureAction *action,
- guint point,
- gfloat *press_x,
- gfloat *press_y)
-{
- ClutterGestureActionPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
-
- priv = clutter_gesture_action_get_instance_private (action);
-
- g_return_if_fail (priv->points->len > point);
-
- if (press_x)
- *press_x = g_array_index (priv->points,
- GesturePoint,
- point).press_x;
-
- if (press_y)
- *press_y = g_array_index (priv->points,
- GesturePoint,
- point).press_y;
-}
-
-/**
- * clutter_gesture_action_get_motion_coords:
- * @action: a #ClutterGestureAction
- * @point: the touch point index, with 0 being the first touch
- * point received by the action
- * @motion_x: (out) (allow-none): return location for the latest motion
- * event's X coordinate
- * @motion_y: (out) (allow-none): return location for the latest motion
- * event's Y coordinate
- *
- * Retrieves the coordinates, in stage space, of the latest motion
- * event during the dragging.
- *
- * Since: 1.8
- */
-void
-clutter_gesture_action_get_motion_coords (ClutterGestureAction *action,
- guint point,
- gfloat *motion_x,
- gfloat *motion_y)
-{
- ClutterGestureActionPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
-
- priv = clutter_gesture_action_get_instance_private (action);
-
- g_return_if_fail (priv->points->len > point);
-
- if (motion_x)
- *motion_x = g_array_index (priv->points,
- GesturePoint,
- point).last_motion_x;
-
- if (motion_y)
- *motion_y = g_array_index (priv->points,
- GesturePoint,
- point).last_motion_y;
-}
-
-/**
- * clutter_gesture_action_get_motion_delta:
- * @action: a #ClutterGestureAction
- * @point: the touch point index, with 0 being the first touch
- * point received by the action
- * @delta_x: (out) (allow-none): return location for the X axis
- * component of the incremental motion delta
- * @delta_y: (out) (allow-none): return location for the Y axis
- * component of the incremental motion delta
- *
- * Retrieves the incremental delta since the last motion event
- * during the dragging.
- *
- * Return value: the distance since last motion event
- *
- * Since: 1.12
- */
-gfloat
-clutter_gesture_action_get_motion_delta (ClutterGestureAction *action,
- guint point,
- gfloat *delta_x,
- gfloat *delta_y)
-{
- ClutterGestureActionPrivate *priv;
- gfloat d_x, d_y;
-
- g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), 0);
-
- priv = clutter_gesture_action_get_instance_private (action);
-
- g_return_val_if_fail (priv->points->len > point, 0);
-
- d_x = g_array_index (priv->points,
- GesturePoint,
- point).last_delta_x;
- d_y = g_array_index (priv->points,
- GesturePoint,
- point).last_delta_y;
-
- if (delta_x)
- *delta_x = d_x;
-
- if (delta_y)
- *delta_y = d_y;
-
- return sqrt ((d_x * d_x) + (d_y * d_y));
-}
-
-/**
- * clutter_gesture_action_get_release_coords:
- * @action: a #ClutterGestureAction
- * @point: the touch point index, with 0 being the first touch
- * point received by the action
- * @release_x: (out) (allow-none): return location for the X coordinate of
- * the last release
- * @release_y: (out) (allow-none): return location for the Y coordinate of
- * the last release
- *
- * Retrieves the coordinates, in stage space, where the touch point was
- * last released.
- *
- * Since: 1.8
- */
-void
-clutter_gesture_action_get_release_coords (ClutterGestureAction *action,
- guint point,
- gfloat *release_x,
- gfloat *release_y)
-{
- ClutterGestureActionPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
-
- priv = clutter_gesture_action_get_instance_private (action);
-
- g_return_if_fail (priv->points->len > point);
-
- if (release_x)
- *release_x = g_array_index (priv->points,
- GesturePoint,
- point).release_x;
-
- if (release_y)
- *release_y = g_array_index (priv->points,
- GesturePoint,
- point).release_y;
-}
-
-/**
- * clutter_gesture_action_get_velocity:
- * @action: a #ClutterGestureAction
- * @point: the touch point index, with 0 being the first touch
- * point received by the action
- * @velocity_x: (out) (allow-none): return location for the latest motion
- * event's X velocity
- * @velocity_y: (out) (allow-none): return location for the latest motion
- * event's Y velocity
- *
- * Retrieves the velocity, in stage pixels per millisecond, of the
- * latest motion event during the dragging.
- *
- * Since: 1.12
- */
-gfloat
-clutter_gesture_action_get_velocity (ClutterGestureAction *action,
- guint point,
- gfloat *velocity_x,
- gfloat *velocity_y)
-{
- ClutterGestureActionPrivate *priv;
- gfloat d_x, d_y, distance, velocity;
- gint64 d_t;
-
- g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), 0);
-
- priv = clutter_gesture_action_get_instance_private (action);
-
- g_return_val_if_fail (priv->points->len > point, 0);
-
- distance = clutter_gesture_action_get_motion_delta (action, point,
- &d_x, &d_y);
-
- d_t = g_array_index (priv->points,
- GesturePoint,
- point).last_delta_time;
-
- if (velocity_x)
- *velocity_x = d_t > FLOAT_EPSILON ? d_x / d_t : 0;
-
- if (velocity_y)
- *velocity_y = d_t > FLOAT_EPSILON ? d_y / d_t : 0;
-
- velocity = d_t > FLOAT_EPSILON ? distance / d_t : 0;
- return velocity;
-}
-
-/**
- * clutter_gesture_action_get_n_touch_points:
- * @action: a #ClutterGestureAction
- *
- * Retrieves the number of requested points to trigger the gesture.
- *
- * Return value: the number of points to trigger the gesture.
- *
- * Since: 1.12
- */
-gint
-clutter_gesture_action_get_n_touch_points (ClutterGestureAction *action)
-{
- ClutterGestureActionPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), 0);
-
- priv = clutter_gesture_action_get_instance_private (action);
-
- return priv->requested_nb_points;
-}
-
-/**
- * clutter_gesture_action_set_n_touch_points:
- * @action: a #ClutterGestureAction
- * @nb_points: a number of points
- *
- * Sets the number of points needed to trigger the gesture.
- *
- * Since: 1.12
- */
-void
-clutter_gesture_action_set_n_touch_points (ClutterGestureAction *action,
- gint nb_points)
-{
- ClutterGestureActionPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
- g_return_if_fail (nb_points >= 1);
-
- priv = clutter_gesture_action_get_instance_private (action);
-
- if (priv->requested_nb_points == nb_points)
- return;
-
- priv->requested_nb_points = nb_points;
-
- if (priv->in_gesture)
- {
- if (priv->points->len < priv->requested_nb_points)
- cancel_gesture (action);
- }
- else if (priv->edge == CLUTTER_GESTURE_TRIGGER_EDGE_AFTER)
- {
- if (priv->points->len >= priv->requested_nb_points)
- {
- ClutterActor *actor =
- clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
- gint i;
- float threshold_x, threshold_y;
-
- clutter_gesture_action_get_threshold_trigger_distance (action, &threshold_x, &threshold_y);
-
- for (i = 0; i < priv->points->len; i++)
- {
- GesturePoint *point = &g_array_index (priv->points, GesturePoint, i);
-
- if ((fabsf (point->press_y - point->last_motion_y) >= threshold_y) ||
- (fabsf (point->press_x - point->last_motion_x) >= threshold_x))
- {
- begin_gesture (action, actor);
- break;
- }
- }
- }
- }
-
- g_object_notify_by_pspec (G_OBJECT (action),
- gesture_props[PROP_N_TOUCH_POINTS]);
-}
-
-/**
- * clutter_gesture_action_get_n_current_points:
- * @action: a #ClutterGestureAction
- *
- * Retrieves the number of points currently active.
- *
- * Return value: the number of points currently active.
- *
- * Since: 1.12
- */
-guint
-clutter_gesture_action_get_n_current_points (ClutterGestureAction *action)
-{
- ClutterGestureActionPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), 0);
-
- priv = clutter_gesture_action_get_instance_private (action);
-
- return priv->points->len;
-}
-
-/**
- * clutter_gesture_action_get_sequence:
- * @action: a #ClutterGestureAction
- * @point: index of a point currently active
- *
- * Retrieves the #ClutterEventSequence of a touch point.
- *
- * Return value: (transfer none): the #ClutterEventSequence of a touch point.
- *
- * Since: 1.12
- */
-ClutterEventSequence *
-clutter_gesture_action_get_sequence (ClutterGestureAction *action,
- guint point)
-{
- ClutterGestureActionPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), NULL);
-
- priv = clutter_gesture_action_get_instance_private (action);
-
- g_return_val_if_fail (priv->points->len > point, NULL);
-
- return g_array_index (priv->points, GesturePoint, point).sequence;
-}
-
-/**
- * clutter_gesture_action_get_device:
- * @action: a #ClutterGestureAction
- * @point: the touch point index, with 0 being the first touch
- * point received by the action
- *
- * Retrieves the #ClutterInputDevice of a touch point.
- *
- * Return value: (transfer none): the #ClutterInputDevice of a touch point.
- *
- * Since: 1.12
- */
-ClutterInputDevice *
-clutter_gesture_action_get_device (ClutterGestureAction *action,
- guint point)
-{
- ClutterGestureActionPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), NULL);
-
- priv = clutter_gesture_action_get_instance_private (action);
-
- g_return_val_if_fail (priv->points->len > point, NULL);
-
- return g_array_index (priv->points, GesturePoint, point).device;
-}
-
-/**
- * clutter_gesture_action_get_last_event:
- * @action: a #ClutterGestureAction
- * @point: index of a point currently active
- *
- * Retrieves a reference to the last #ClutterEvent for a touch point. Call
- * clutter_event_copy() if you need to store the reference somewhere.
- *
- * Return value: (transfer none): the last #ClutterEvent for a touch point.
- *
- * Since: 1.14
- */
-const ClutterEvent *
-clutter_gesture_action_get_last_event (ClutterGestureAction *action,
- guint point)
-{
- GesturePoint *gesture_point;
- ClutterGestureActionPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), NULL);
-
- priv = clutter_gesture_action_get_instance_private (action);
-
- g_return_val_if_fail (priv->points->len > point, NULL);
-
- gesture_point = &g_array_index (priv->points, GesturePoint, point);
-
- return gesture_point->last_event;
-}
-
-/**
- * clutter_gesture_action_cancel:
- * @action: a #ClutterGestureAction
- *
- * Cancel a #ClutterGestureAction before it begins
- *
- * Since: 1.12
- */
-void
-clutter_gesture_action_cancel (ClutterGestureAction *action)
-{
- g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
-
- cancel_gesture (action);
-}
-
-/**
- * clutter_gesture_action_set_threshold_trigger_edge:
- * @action: a #ClutterGestureAction
- * @edge: the %ClutterGestureTriggerEdge
- *
- * Sets the edge trigger for the gesture drag threshold, if any.
- *
- * This function should only be called by sub-classes of
- * #ClutterGestureAction during their construction phase.
- *
- * Since: 1.18
- */
-void
-clutter_gesture_action_set_threshold_trigger_edge (ClutterGestureAction *action,
- ClutterGestureTriggerEdge edge)
-{
- ClutterGestureActionPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
-
- priv = clutter_gesture_action_get_instance_private (action);
-
- if (priv->edge == edge)
- return;
-
- priv->edge = edge;
-
- g_object_notify_by_pspec (G_OBJECT (action), gesture_props[PROP_THRESHOLD_TRIGGER_EDGE]);
-}
-
-/**
- * clutter_gesture_action_get_threshold_trigger_edge:
- * @action: a #ClutterGestureAction
- *
- * Retrieves the edge trigger of the gesture @action, as set using
- * clutter_gesture_action_set_threshold_trigger_edge().
- *
- * Return value: the edge trigger
- *
- * Since: 1.20
- */
-ClutterGestureTriggerEdge
-clutter_gesture_action_get_threshold_trigger_edge (ClutterGestureAction *action)
-{
- ClutterGestureActionPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action),
- CLUTTER_GESTURE_TRIGGER_EDGE_NONE);
-
- priv = clutter_gesture_action_get_instance_private (action);
-
- return priv->edge;
-}
-
-/**
- * clutter_gesture_action_get_threshold_trigger_egde:
- * @action: a #ClutterGestureAction
- *
- * Retrieves the edge trigger of the gesture @action, as set using
- * clutter_gesture_action_set_threshold_trigger_edge().
- *
- * Return value: the edge trigger
- *
- * Since: 1.18
- *
- * Deprecated: 1.20: Use clutter_gesture_action_get_threshold_trigger_edge() instead.
- */
-ClutterGestureTriggerEdge
-clutter_gesture_action_get_threshold_trigger_egde (ClutterGestureAction *action)
-{
- return clutter_gesture_action_get_threshold_trigger_edge (action);
-}
-
-/**
- * clutter_gesture_action_set_threshold_trigger_distance:
- * @action: a #ClutterGestureAction
- * @x: the distance on the horizontal axis
- * @y: the distance on the vertical axis
- *
- * Sets the threshold trigger distance for the gesture drag threshold, if any.
- *
- * This function should only be called by sub-classes of
- * #ClutterGestureAction during their construction phase.
- *
- * Since: 1.18
- */
-void
-clutter_gesture_action_set_threshold_trigger_distance (ClutterGestureAction *action,
- float x,
- float y)
-{
- ClutterGestureActionPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
-
- priv = clutter_gesture_action_get_instance_private (action);
-
- if (fabsf (x - priv->distance_x) > FLOAT_EPSILON)
- {
- priv->distance_x = x;
- g_object_notify_by_pspec (G_OBJECT (action), gesture_props[PROP_THRESHOLD_TRIGGER_DISTANCE_X]);
- }
-
- if (fabsf (y - priv->distance_y) > FLOAT_EPSILON)
- {
- priv->distance_y = y;
- g_object_notify_by_pspec (G_OBJECT (action), gesture_props[PROP_THRESHOLD_TRIGGER_DISTANCE_Y]);
- }
-}
-
-/**
- * clutter_gesture_action_get_threshold_trigger_distance:
- * @action: a #ClutterGestureAction
- * @x: (out) (allow-none): The return location for the horizontal distance, or %NULL
- * @y: (out) (allow-none): The return location for the vertical distance, or %NULL
- *
- * Retrieves the threshold trigger distance of the gesture @action,
- * as set using clutter_gesture_action_set_threshold_trigger_distance().
- *
- * Since: 1.18
- */
-void
-clutter_gesture_action_get_threshold_trigger_distance (ClutterGestureAction *action,
- float *x,
- float *y)
-{
- ClutterGestureActionPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
-
- priv = clutter_gesture_action_get_instance_private (action);
-
- if (x != NULL)
- {
- if (priv->distance_x > 0.0)
- *x = priv->distance_x;
- else
- *x = gesture_get_default_threshold ();
- }
- if (y != NULL)
- {
- if (priv->distance_y > 0.0)
- *y = priv->distance_y;
- else
- *y = gesture_get_default_threshold ();
- }
-}
diff --git a/clutter/clutter/clutter-gesture-action.h b/clutter/clutter/clutter-gesture-action.h
deleted file mode 100644
index 2bb760b52..000000000
--- a/clutter/clutter/clutter-gesture-action.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- * Copyright (C) 2011 Robert Bosch Car Multimedia GmbH.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Tomeu Vizoso <tomeu.vizoso@collabora.co.uk>
- */
-
-#ifndef __CLUTTER_GESTURE_ACTION_H__
-#define __CLUTTER_GESTURE_ACTION_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-action.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_GESTURE_ACTION (clutter_gesture_action_get_type ())
-
-CLUTTER_EXPORT
-G_DECLARE_DERIVABLE_TYPE (ClutterGestureAction, clutter_gesture_action,
- CLUTTER, GESTURE_ACTION, ClutterAction);
-
-typedef struct _ClutterGestureActionPrivate ClutterGestureActionPrivate;
-
-/**
- * ClutterGestureActionClass:
- * @gesture_begin: class handler for the #ClutterGestureAction::gesture-begin signal
- * @gesture_progress: class handler for the #ClutterGestureAction::gesture-progress signal
- * @gesture_end: class handler for the #ClutterGestureAction::gesture-end signal
- * @gesture_cancel: class handler for the #ClutterGestureAction::gesture-cancel signal
- * @gesture_prepare: virtual function called before emitting the
- * #ClutterGestureAction::gesture-cancel signal
- *
- * The #ClutterGestureClass structure contains only
- * private data.
- *
- * Since: 1.8
- */
-struct _ClutterGestureActionClass
-{
- /*< private >*/
- ClutterActionClass parent_class;
-
- /*< public >*/
- gboolean (* gesture_begin) (ClutterGestureAction *action,
- ClutterActor *actor);
- gboolean (* gesture_progress) (ClutterGestureAction *action,
- ClutterActor *actor);
- void (* gesture_end) (ClutterGestureAction *action,
- ClutterActor *actor);
- void (* gesture_cancel) (ClutterGestureAction *action,
- ClutterActor *actor);
- gboolean (* gesture_prepare) (ClutterGestureAction *action,
- ClutterActor *actor);
-
- /*< private >*/
- void (* _clutter_gesture_action1) (void);
- void (* _clutter_gesture_action2) (void);
- void (* _clutter_gesture_action3) (void);
- void (* _clutter_gesture_action4) (void);
- void (* _clutter_gesture_action5) (void);
- void (* _clutter_gesture_action6) (void);
-};
-
-CLUTTER_EXPORT
-ClutterAction * clutter_gesture_action_new (void);
-
-CLUTTER_EXPORT
-gint clutter_gesture_action_get_n_touch_points (ClutterGestureAction *action);
-CLUTTER_EXPORT
-void clutter_gesture_action_set_n_touch_points (ClutterGestureAction *action,
- gint nb_points);
-CLUTTER_EXPORT
-void clutter_gesture_action_get_press_coords (ClutterGestureAction *action,
- guint point,
- gfloat *press_x,
- gfloat *press_y);
-CLUTTER_EXPORT
-void clutter_gesture_action_get_motion_coords (ClutterGestureAction *action,
- guint point,
- gfloat *motion_x,
- gfloat *motion_y);
-CLUTTER_EXPORT
-gfloat clutter_gesture_action_get_motion_delta (ClutterGestureAction *action,
- guint point,
- gfloat *delta_x,
- gfloat *delta_y);
-CLUTTER_EXPORT
-void clutter_gesture_action_get_release_coords (ClutterGestureAction *action,
- guint point,
- gfloat *release_x,
- gfloat *release_y);
-CLUTTER_EXPORT
-gfloat clutter_gesture_action_get_velocity (ClutterGestureAction *action,
- guint point,
- gfloat *velocity_x,
- gfloat *velocity_y);
-
-CLUTTER_EXPORT
-guint clutter_gesture_action_get_n_current_points (ClutterGestureAction *action);
-
-CLUTTER_EXPORT
-ClutterEventSequence * clutter_gesture_action_get_sequence (ClutterGestureAction *action,
- guint point);
-
-CLUTTER_EXPORT
-ClutterInputDevice * clutter_gesture_action_get_device (ClutterGestureAction *action,
- guint point);
-
-CLUTTER_EXPORT
-const ClutterEvent * clutter_gesture_action_get_last_event (ClutterGestureAction *action,
- guint point);
-
-CLUTTER_EXPORT
-void clutter_gesture_action_cancel (ClutterGestureAction *action);
-
-CLUTTER_EXPORT
-void clutter_gesture_action_set_threshold_trigger_edge (ClutterGestureAction *action,
- ClutterGestureTriggerEdge edge);
-CLUTTER_DEPRECATED_FOR(clutter_gesture_action_get_threshold_trigger_edge)
-ClutterGestureTriggerEdge clutter_gesture_action_get_threshold_trigger_egde (ClutterGestureAction *action);
-CLUTTER_EXPORT
-ClutterGestureTriggerEdge clutter_gesture_action_get_threshold_trigger_edge (ClutterGestureAction *action);
-
-CLUTTER_EXPORT
-void clutter_gesture_action_set_threshold_trigger_distance (ClutterGestureAction *action,
- float x,
- float y);
-
-CLUTTER_EXPORT
-void clutter_gesture_action_get_threshold_trigger_distance (ClutterGestureAction *action,
- float *x,
- float *y);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_GESTURE_ACTION_H__ */
diff --git a/clutter/clutter/clutter-graphene.c b/clutter/clutter/clutter-graphene.c
deleted file mode 100644
index 409c189b0..000000000
--- a/clutter/clutter/clutter-graphene.c
+++ /dev/null
@@ -1,130 +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_matrix_progress (const GValue *a,
- const GValue *b,
- double progress,
- GValue *retval)
-{
- const graphene_matrix_t *am = g_value_get_boxed (a);
- const graphene_matrix_t *bm = g_value_get_boxed (b);
- graphene_matrix_t res;
-
- graphene_matrix_interpolate (am, bm, progress, &res);
-
- g_value_set_boxed (retval, &res);
-
- return TRUE;
-}
-
-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_MATRIX,
- graphene_matrix_progress);
- 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);
-}
diff --git a/clutter/clutter/clutter-graphene.h b/clutter/clutter/clutter-graphene.h
deleted file mode 100644
index ddea3ca4a..000000000
--- a/clutter/clutter/clutter-graphene.h
+++ /dev/null
@@ -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
diff --git a/clutter/clutter/clutter-grid-layout.c b/clutter/clutter/clutter-grid-layout.c
deleted file mode 100644
index ebc022eb7..000000000
--- a/clutter/clutter/clutter-grid-layout.c
+++ /dev/null
@@ -1,2203 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Red Hat, Inc.
- * Copyright (C) 2012 Bastian Winkler <buz@netbuz.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Bastian Winkler <buz@netbuz.org>
- *
- * Based on GtkGrid widget by:
- * Matthias Clasen
- */
-
-#include "clutter-build-config.h"
-
-#include <string.h>
-#include <math.h>
-
-#include "clutter-grid-layout.h"
-
-#include "clutter-actor-private.h"
-#include "clutter-container.h"
-#include "clutter-debug.h"
-#include "clutter-enum-types.h"
-#include "clutter-layout-meta.h"
-#include "clutter-private.h"
-
-/**
- * SECTION:clutter-grid-layout
- * @Short_description: A layout manager for a grid of actors
- * @Title: ClutterGridLayout
- * @See_also: #ClutterBoxLayout
- *
- * #ClutterGridLayout is a layout manager which arranges its child widgets in
- * rows and columns. It is a very similar to #ClutterBoxLayout, but it
- * consistently uses #ClutterActor's alignment and expansion flags instead of
- * custom child properties.
- *
- * Children are added using clutter_grid_layout_attach(). They can span
- * multiple rows or columns. It is also possible to add a child next to an
- * existing child, using clutter_grid_layout_attach_next_to(). The behaviour of
- * #ClutterGridLayout when several children occupy the same grid cell is undefined.
- *
- * #ClutterGridLayout can be used like a #ClutterBoxLayout by just using
- * clutter_actor_add_child(), which will place children next to each other in
- * the direction determined by the #ClutterGridLayout:orientation property.
- */
-
-#define CLUTTER_TYPE_GRID_CHILD (clutter_grid_child_get_type ())
-#define CLUTTER_GRID_CHILD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_GRID_CHILD, ClutterGridChild))
-#define CLUTTER_IS_GRID_CHILD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_GRID_CHILD))
-
-typedef struct _ClutterGridChild ClutterGridChild;
-typedef struct _ClutterLayoutMetaClass ClutterGridChildClass;
-
-typedef struct _ClutterGridAttach ClutterGridAttach;
-typedef struct _ClutterGridLine ClutterGridLine;
-typedef struct _ClutterGridLines ClutterGridLines;
-typedef struct _ClutterGridLineData ClutterGridLineData;
-typedef struct _ClutterGridRequest ClutterGridRequest;
-
-
-struct _ClutterGridAttach
-{
- gint pos;
- gint span;
-};
-
-struct _ClutterGridChild
-{
- ClutterLayoutMeta parent_instance;
-
- ClutterGridAttach attach[2];
-};
-
-#define CHILD_LEFT(child) ((child)->attach[CLUTTER_ORIENTATION_HORIZONTAL].pos)
-#define CHILD_WIDTH(child) ((child)->attach[CLUTTER_ORIENTATION_HORIZONTAL].span)
-#define CHILD_TOP(child) ((child)->attach[CLUTTER_ORIENTATION_VERTICAL].pos)
-#define CHILD_HEIGHT(child) ((child)->attach[CLUTTER_ORIENTATION_VERTICAL].span)
-
-/* A ClutterGridLineData struct contains row/column specific parts
- * of the grid.
- */
-struct _ClutterGridLineData
-{
- gfloat spacing;
- guint homogeneous : 1;
-};
-
-struct _ClutterGridLayoutPrivate
-{
- ClutterContainer *container;
- ClutterOrientation orientation;
-
- ClutterGridLineData linedata[2];
-};
-
-#define ROWS(priv) (&(priv)->linedata[CLUTTER_ORIENTATION_HORIZONTAL])
-#define COLUMNS(priv) (&(priv)->linedata[CLUTTER_ORIENTATION_VERTICAL])
-
-/* A ClutterGridLine struct represents a single row or column
- * during size requests
- */
-struct _ClutterGridLine
-{
- gfloat minimum;
- gfloat natural;
- gfloat position;
- gfloat allocation;
-
- guint need_expand : 1;
- guint expand : 1;
- guint empty : 1;
-};
-
-struct _ClutterGridLines
-{
- ClutterGridLine *lines;
- gint min, max;
-};
-
-struct _ClutterGridRequest
-{
- ClutterGridLayout *grid;
- ClutterGridLines lines[2];
-};
-
-enum
-{
- PROP_0,
-
- PROP_ORIENTATION,
- PROP_ROW_SPACING,
- PROP_COLUMN_SPACING,
- PROP_ROW_HOMOGENEOUS,
- PROP_COLUMN_HOMOGENEOUS,
-
- PROP_LAST
-};
-static GParamSpec *obj_props[PROP_LAST];
-
-enum
-{
- PROP_CHILD_0,
-
- PROP_CHILD_LEFT_ATTACH,
- PROP_CHILD_TOP_ATTACH,
- PROP_CHILD_WIDTH,
- PROP_CHILD_HEIGHT,
-
- PROP_CHILD_LAST
-};
-static GParamSpec *child_props[PROP_CHILD_LAST];
-
-GType clutter_grid_child_get_type (void);
-
-G_DEFINE_TYPE (ClutterGridChild, clutter_grid_child,
- CLUTTER_TYPE_LAYOUT_META)
-
-G_DEFINE_TYPE_WITH_PRIVATE (ClutterGridLayout,
- clutter_grid_layout,
- CLUTTER_TYPE_LAYOUT_MANAGER)
-
-
-#define GET_GRID_CHILD(grid, child) \
- (CLUTTER_GRID_CHILD(clutter_layout_manager_get_child_meta \
- (CLUTTER_LAYOUT_MANAGER((grid)),\
- CLUTTER_GRID_LAYOUT((grid))->priv->container,(child))))
-
-static void
-grid_attach (ClutterGridLayout *self,
- ClutterActor *actor,
- gint left,
- gint top,
- gint width,
- gint height)
-{
- ClutterGridChild *grid_child;
-
- grid_child = GET_GRID_CHILD (self, actor);
-
- CHILD_LEFT (grid_child) = left;
- CHILD_TOP (grid_child) = top;
- CHILD_WIDTH (grid_child) = width;
- CHILD_HEIGHT (grid_child) = height;
-}
-
-/* Find the position 'touching' existing
- * children. @orientation and @max determine
- * from which direction to approach (horizontal
- * + max = right, vertical + !max = top, etc).
- * @op_pos, @op_span determine the rows/columns
- * in which the touching has to happen.
- */
-static gint
-find_attach_position (ClutterGridLayout *self,
- ClutterOrientation orientation,
- gint op_pos,
- gint op_span,
- gboolean max)
-{
- ClutterGridLayoutPrivate *priv = self->priv;
- ClutterGridChild *grid_child;
- ClutterGridAttach *attach;
- ClutterGridAttach *opposite;
- ClutterActorIter iter;
- ClutterActor *child;
- gint pos;
- gboolean hit;
-
- if (max)
- pos = -G_MAXINT;
- else
- pos = G_MAXINT;
-
- hit = FALSE;
-
- if (!priv->container)
- return -1;
-
- clutter_actor_iter_init (&iter, CLUTTER_ACTOR (priv->container));
- while (clutter_actor_iter_next (&iter, &child))
- {
- grid_child = GET_GRID_CHILD (self, child);
-
- attach = &grid_child->attach[orientation];
- opposite = &grid_child->attach[1 - orientation];
-
- /* check if the ranges overlap */
- if (opposite->pos <= op_pos + op_span && op_pos <= opposite->pos + opposite->span)
- {
- hit = TRUE;
-
- if (max)
- pos = MAX (pos, attach->pos + attach->span);
- else
- pos = MIN (pos, attach->pos);
- }
- }
-
- if (!hit)
- pos = 0;
-
- return pos;
-}
-static void
-grid_attach_next_to (ClutterGridLayout *layout,
- ClutterActor *child,
- ClutterActor *sibling,
- ClutterGridPosition side,
- gint width,
- gint height)
-{
- ClutterGridChild *grid_sibling;
- gint left, top;
-
- if (sibling)
- {
- grid_sibling = GET_GRID_CHILD (layout, sibling);
-
- switch (side)
- {
- case CLUTTER_GRID_POSITION_LEFT:
- left = CHILD_LEFT (grid_sibling) - width;
- top = CHILD_TOP (grid_sibling);
- break;
-
- case CLUTTER_GRID_POSITION_RIGHT:
- left = CHILD_LEFT (grid_sibling) + CHILD_WIDTH (grid_sibling);
- top = CHILD_TOP (grid_sibling);
- break;
-
- case CLUTTER_GRID_POSITION_TOP:
- left = CHILD_LEFT (grid_sibling);
- top = CHILD_TOP (grid_sibling) - height;
- break;
-
- case CLUTTER_GRID_POSITION_BOTTOM:
- left = CHILD_LEFT (grid_sibling);
- top = CHILD_TOP (grid_sibling) + CHILD_HEIGHT (grid_sibling);
- break;
-
- default:
- g_assert_not_reached ();
- }
- }
- else
- {
- switch (side)
- {
- case CLUTTER_GRID_POSITION_LEFT:
- left = find_attach_position (layout, CLUTTER_ORIENTATION_HORIZONTAL,
- 0, height, FALSE);
- left -= width;
- top = 0;
- break;
-
- case CLUTTER_GRID_POSITION_RIGHT:
- left = find_attach_position (layout, CLUTTER_ORIENTATION_HORIZONTAL,
- 0, height, TRUE);
- top = 0;
- break;
-
- case CLUTTER_GRID_POSITION_TOP:
- left = 0;
- top = find_attach_position (layout, CLUTTER_ORIENTATION_VERTICAL,
- 0, width, FALSE);
- top -= height;
- break;
-
- case CLUTTER_GRID_POSITION_BOTTOM:
- left = 0;
- top = find_attach_position (layout, CLUTTER_ORIENTATION_VERTICAL,
- 0, width, TRUE);
- break;
-
- default:
- g_assert_not_reached ();
- }
- }
-
- grid_attach (layout, child, left, top, width, height);
-}
-
-static void
-clutter_grid_request_update_child_attach (ClutterGridRequest *request,
- ClutterActor *actor)
-{
- ClutterGridLayoutPrivate *priv = request->grid->priv;
- ClutterGridChild *grid_child;
-
- grid_child = GET_GRID_CHILD (request->grid, actor);
-
- if (CHILD_LEFT (grid_child) == -1 || CHILD_TOP (grid_child) == -1)
- {
- ClutterGridPosition side;
- ClutterActor *sibling;
-
- if (priv->orientation == CLUTTER_ORIENTATION_HORIZONTAL)
- {
- ClutterTextDirection td;
- gboolean rtl;
- ClutterActor *container = CLUTTER_ACTOR (priv->container);
-
- td = clutter_actor_get_text_direction (container);
- rtl = (td == CLUTTER_TEXT_DIRECTION_RTL) ? TRUE : FALSE;
- side = rtl ? CLUTTER_GRID_POSITION_LEFT : CLUTTER_GRID_POSITION_RIGHT;
- }
- else
- {
- /* XXX: maybe we should also add a :pack-start property to modify
- * this */
- side = CLUTTER_GRID_POSITION_BOTTOM;
- }
-
- sibling = clutter_actor_get_previous_sibling (actor);
- if (sibling)
- clutter_grid_layout_insert_next_to (request->grid, sibling, side);
- grid_attach_next_to (request->grid, actor, sibling, side,
- CHILD_WIDTH (grid_child),
- CHILD_HEIGHT (grid_child));
- }
-}
-
-static void
-clutter_grid_request_update_attach (ClutterGridRequest *request)
-{
- ClutterGridLayoutPrivate *priv = request->grid->priv;
- ClutterActorIter iter;
- ClutterActor *child;
-
- clutter_actor_iter_init (&iter, CLUTTER_ACTOR (priv->container));
- while (clutter_actor_iter_next (&iter, &child))
- clutter_grid_request_update_child_attach (request, child);
-}
-
-/* Calculates the min and max numbers for both orientations.
- */
-static void
-clutter_grid_request_count_lines (ClutterGridRequest *request)
-{
- ClutterGridLayoutPrivate *priv = request->grid->priv;
- ClutterGridChild *grid_child;
- ClutterGridAttach *attach;
- ClutterActorIter iter;
- ClutterActor *child;
- gint min[2];
- gint max[2];
-
- min[0] = min[1] = G_MAXINT;
- max[0] = max[1] = G_MININT;
-
- clutter_actor_iter_init (&iter, CLUTTER_ACTOR (priv->container));
- while (clutter_actor_iter_next (&iter, &child))
- {
- grid_child = GET_GRID_CHILD (request->grid, child);
- attach = grid_child->attach;
-
- min[0] = MIN (min[0], attach[0].pos);
- max[0] = MAX (max[0], attach[0].pos + attach[0].span);
- min[1] = MIN (min[1], attach[1].pos);
- max[1] = MAX (max[1], attach[1].pos + attach[1].span);
- }
-
- request->lines[0].min = min[0];
- request->lines[0].max = max[0];
- request->lines[1].min = min[1];
- request->lines[1].max = max[1];
-}
-
-/* Sets line sizes to 0 and marks lines as expand
- * if they have a non-spanning expanding child.
- */
-static void
-clutter_grid_request_init (ClutterGridRequest *request,
- ClutterOrientation orientation)
-{
- ClutterGridLayoutPrivate *priv = request->grid->priv;
- ClutterGridChild *grid_child;
- ClutterGridAttach *attach;
- ClutterGridLines *lines;
- ClutterActorIter iter;
- ClutterActor *child;
- gint i;
-
- lines = &request->lines[orientation];
-
- for (i = 0; i < lines->max - lines->min; i++)
- {
- lines->lines[i].minimum = 0;
- lines->lines[i].natural = 0;
- lines->lines[i].expand = FALSE;
- }
-
- clutter_actor_iter_init (&iter, CLUTTER_ACTOR (priv->container));
- while (clutter_actor_iter_next (&iter, &child))
- {
- grid_child = GET_GRID_CHILD (request->grid, child);
- attach = &grid_child->attach[orientation];
- if (attach->span == 1 && clutter_actor_needs_expand (child, orientation))
- lines->lines[attach->pos - lines->min].expand = TRUE;
- }
-}
-
-/* Sums allocations for lines spanned by child and their spacing.
- */
-static gfloat
-compute_allocation_for_child (ClutterGridRequest *request,
- ClutterActor *child,
- ClutterOrientation orientation)
-{
- ClutterGridLayoutPrivate *priv = request->grid->priv;
- ClutterGridChild *grid_child;
- ClutterGridLineData *linedata;
- ClutterGridLines *lines;
- ClutterGridLine *line;
- ClutterGridAttach *attach;
- gfloat size;
- gint i;
-
- grid_child = GET_GRID_CHILD (request->grid, child);
- linedata = &priv->linedata[orientation];
- lines = &request->lines[orientation];
- attach = &grid_child->attach[orientation];
-
- size = (attach->span - 1) * linedata->spacing;
- for (i = 0; i < attach->span; i++)
- {
- line = &lines->lines[attach->pos - lines->min + i];
- size += line->allocation;
- }
-
- return size;
-}
-
-static void
-compute_request_for_child (ClutterGridRequest *request,
- ClutterActor *child,
- ClutterOrientation orientation,
- gboolean contextual,
- gfloat *minimum,
- gfloat *natural)
-{
- if (contextual)
- {
- gfloat size;
-
- size = compute_allocation_for_child (request, child, 1 - orientation);
- if (orientation == CLUTTER_ORIENTATION_HORIZONTAL)
- clutter_actor_get_preferred_width (child, size, minimum, natural);
- else
- clutter_actor_get_preferred_height (child, size, minimum, natural);
- }
- else
- {
- if (orientation == CLUTTER_ORIENTATION_HORIZONTAL)
- clutter_actor_get_preferred_width (child, -1, minimum, natural);
- else
- clutter_actor_get_preferred_height (child, -1, minimum, natural);
- }
-}
-
-/* Sets requisition to max. of non-spanning children.
- * If contextual is TRUE, requires allocations of
- * lines in the opposite orientation to be set.
- */
-static void
-clutter_grid_request_non_spanning (ClutterGridRequest *request,
- ClutterOrientation orientation,
- gboolean contextual)
-{
- ClutterGridLayoutPrivate *priv = request->grid->priv;
- ClutterGridChild *grid_child;
- ClutterGridAttach *attach;
- ClutterGridLines *lines;
- ClutterGridLine *line;
- ClutterActorIter iter;
- ClutterActor *child;
- gfloat minimum;
- gfloat natural;
-
- lines = &request->lines[orientation];
-
- clutter_actor_iter_init (&iter, CLUTTER_ACTOR (priv->container));
- while (clutter_actor_iter_next (&iter, &child))
- {
- if (!clutter_actor_is_visible (child))
- continue;
-
- grid_child = GET_GRID_CHILD (request->grid, child);
-
- attach = &grid_child->attach[orientation];
- if (attach->span != 1)
- continue;
-
- compute_request_for_child (request, child, orientation, contextual, &minimum, &natural);
-
- line = &lines->lines[attach->pos - lines->min];
- line->minimum = MAX (line->minimum, minimum);
- line->natural = MAX (line->natural, natural);
- }
-}
-
-/* Enforce homogeneous sizes.
- */
-static void
-clutter_grid_request_homogeneous (ClutterGridRequest *request,
- ClutterOrientation orientation)
-{
- ClutterGridLayoutPrivate *priv = request->grid->priv;
- ClutterGridLineData *linedata;
- ClutterGridLines *lines;
- gfloat minimum, natural;
- gint i;
-
- linedata = &priv->linedata[orientation];
- lines = &request->lines[orientation];
-
- if (!linedata->homogeneous)
- return;
-
- minimum = 0.0f;
- natural = 0.0f;
-
- for (i = 0; i < lines->max - lines->min; i++)
- {
- minimum = MAX (minimum, lines->lines[i].minimum);
- natural = MAX (natural, lines->lines[i].natural);
- }
-
- for (i = 0; i < lines->max - lines->min; i++)
- {
- lines->lines[i].minimum = minimum;
- lines->lines[i].natural = natural;
- }
-}
-
-/* Deals with spanning children.
- * Requires expand fields of lines to be set for
- * non-spanning children.
- */
-static void
-clutter_grid_request_spanning (ClutterGridRequest *request,
- ClutterOrientation orientation,
- gboolean contextual)
-{
- ClutterGridLayoutPrivate *priv = request->grid->priv;
- ClutterGridChild *grid_child;
- ClutterActor *child;
- ClutterActorIter iter;
- ClutterGridAttach *attach;
- ClutterGridLineData *linedata;
- ClutterGridLines *lines;
- ClutterGridLine *line;
- gfloat minimum;
- gfloat natural;
- gint span_minimum;
- gint span_natural;
- gint span_expand;
- gboolean force_expand;
- gint extra;
- gint expand;
- gint line_extra;
- gint i;
-
- linedata = &priv->linedata[orientation];
- lines = &request->lines[orientation];
-
- clutter_actor_iter_init (&iter, CLUTTER_ACTOR (priv->container));
- while (clutter_actor_iter_next (&iter, &child))
- {
- if (!clutter_actor_is_visible (child))
- continue;
-
- grid_child = GET_GRID_CHILD (request->grid, child);
-
- attach = &grid_child->attach[orientation];
- if (attach->span == 1)
- continue;
-
- compute_request_for_child (request, child, orientation, contextual,
- &minimum, &natural);
-
- span_minimum = (attach->span - 1) * linedata->spacing;
- span_natural = (attach->span - 1) * linedata->spacing;
- span_expand = 0;
- force_expand = FALSE;
- for (i = 0; i < attach->span; i++)
- {
- line = &lines->lines[attach->pos - lines->min + i];
- span_minimum += line->minimum;
- span_natural += line->natural;
- if (line->expand)
- span_expand += 1;
- }
- if (span_expand == 0)
- {
- span_expand = attach->span;
- force_expand = TRUE;
- }
-
- /* If we need to request more space for this child to fill
- * its requisition, then divide up the needed space amongst the
- * lines it spans, favoring expandable lines if any.
- *
- * When doing homogeneous allocation though, try to keep the
- * line allocations even, since we're going to force them to
- * be the same anyway, and we don't want to introduce unnecessary
- * extra space.
- */
- if (span_minimum < minimum)
- {
- if (linedata->homogeneous)
- {
- gint total, m;
-
- total = minimum - (attach->span - 1) * linedata->spacing;
- m = total / attach->span + (total % attach->span ? 1 : 0);
- for (i = 0; i < attach->span; i++)
- {
- line = &lines->lines[attach->pos - lines->min + i];
- line->minimum = MAX(line->minimum, m);
- }
- }
- else
- {
- extra = minimum - span_minimum;
- expand = span_expand;
- for (i = 0; i < attach->span; i++)
- {
- line = &lines->lines[attach->pos - lines->min + i];
- if (force_expand || line->expand)
- {
- line_extra = extra / expand;
- line->minimum += line_extra;
- extra -= line_extra;
- expand -= 1;
- }
- }
- }
- }
-
- if (span_natural < natural)
- {
- if (linedata->homogeneous)
- {
- gint total, n;
-
- total = natural - (attach->span - 1) * linedata->spacing;
- n = total / attach->span + (total % attach->span ? 1 : 0);
- for (i = 0; i < attach->span; i++)
- {
- line = &lines->lines[attach->pos - lines->min + i];
- line->natural = MAX(line->natural, n);
- }
- }
- else
- {
- extra = natural - span_natural;
- expand = span_expand;
- for (i = 0; i < attach->span; i++)
- {
- line = &lines->lines[attach->pos - lines->min + i];
- if (force_expand || line->expand)
- {
- line_extra = extra / expand;
- line->natural += line_extra;
- extra -= line_extra;
- expand -= 1;
- }
- }
- }
- }
- }
-}
-
-/* Marks empty and expanding lines and counts them.
- */
-static void
-clutter_grid_request_compute_expand (ClutterGridRequest *request,
- ClutterOrientation orientation,
- gint *nonempty_lines,
- gint *expand_lines)
-{
- ClutterGridLayoutPrivate *priv = request->grid->priv;
- ClutterGridChild *grid_child;
- ClutterGridAttach *attach;
- ClutterActorIter iter;
- ClutterActor *child;
- gint i;
- ClutterGridLines *lines;
- ClutterGridLine *line;
- gboolean has_expand;
- gint expand;
- gint empty;
-
- lines = &request->lines[orientation];
-
- for (i = 0; i < lines->max - lines->min; i++)
- {
- lines->lines[i].need_expand = FALSE;
- lines->lines[i].expand = FALSE;
- lines->lines[i].empty = TRUE;
- }
-
- clutter_actor_iter_init (&iter, CLUTTER_ACTOR (priv->container));
- while (clutter_actor_iter_next (&iter, &child))
- {
- if (!clutter_actor_is_visible (child))
- continue;
-
- grid_child = GET_GRID_CHILD (request->grid, child);
-
- attach = &grid_child->attach[orientation];
- if (attach->span != 1)
- continue;
-
- line = &lines->lines[attach->pos - lines->min];
- line->empty = FALSE;
- if (clutter_actor_needs_expand (child, orientation))
- line->expand = TRUE;
- }
-
-
- clutter_actor_iter_init (&iter, CLUTTER_ACTOR (priv->container));
- while (clutter_actor_iter_next (&iter, &child))
- {
- if (!clutter_actor_is_visible (child))
- continue;
-
- grid_child = GET_GRID_CHILD (request->grid, child);
-
- attach = &grid_child->attach[orientation];
- if (attach->span == 1)
- continue;
-
- has_expand = FALSE;
- for (i = 0; i < attach->span; i++)
- {
- line = &lines->lines[attach->pos - lines->min + i];
- line->empty = FALSE;
- if (line->expand)
- has_expand = TRUE;
- }
-
- if (!has_expand && clutter_actor_needs_expand (child, orientation))
- {
- for (i = 0; i < attach->span; i++)
- {
- line = &lines->lines[attach->pos - lines->min + i];
- line->need_expand = TRUE;
- }
- }
- }
-
- empty = 0;
- expand = 0;
- for (i = 0; i < lines->max - lines->min; i++)
- {
- line = &lines->lines[i];
-
- if (line->need_expand)
- line->expand = TRUE;
-
- if (line->empty)
- empty += 1;
-
- if (line->expand)
- expand += 1;
- }
-
- if (nonempty_lines)
- *nonempty_lines = lines->max - lines->min - empty;
-
- if (expand_lines)
- *expand_lines = expand;
-}
-
-/* Sums the minimum and natural fields of lines and their spacing.
- */
-static void
-clutter_grid_request_sum (ClutterGridRequest *request,
- ClutterOrientation orientation,
- gfloat *minimum,
- gfloat *natural)
-{
- ClutterGridLayoutPrivate *priv = request->grid->priv;
- ClutterGridLineData *linedata;
- ClutterGridLines *lines;
- gint i;
- gfloat min, nat;
- gint nonempty;
-
- clutter_grid_request_compute_expand (request, orientation, &nonempty, NULL);
-
- linedata = &priv->linedata[orientation];
- lines = &request->lines[orientation];
-
- min = 0;
- nat = 0;
- if (nonempty > 0)
- {
- min = (nonempty - 1) * linedata->spacing;
- nat = (nonempty - 1) * linedata->spacing;
- }
-
- for (i = 0; i < lines->max - lines->min; i++)
- {
- min += lines->lines[i].minimum;
- nat += lines->lines[i].natural;
- }
-
- if (minimum)
- *minimum = min;
-
- if (natural)
- *natural = nat;
-}
-
-/* Computes minimum and natural fields of lines.
- * When contextual is TRUE, requires allocation of
- * lines in the opposite orientation to be set.
- */
-static void
-clutter_grid_request_run (ClutterGridRequest *request,
- ClutterOrientation orientation,
- gboolean contextual)
-{
- clutter_grid_request_init (request, orientation);
- clutter_grid_request_non_spanning (request, orientation, contextual);
- clutter_grid_request_homogeneous (request, orientation);
- clutter_grid_request_spanning (request, orientation, contextual);
- clutter_grid_request_homogeneous (request, orientation);
-}
-
-typedef struct _RequestedSize
-{
- gpointer data;
-
- gfloat minimum_size;
- gfloat natural_size;
-} RequestedSize;
-
-
-/* Pulled from gtksizerequest.c from Gtk+ */
-static gint
-compare_gap (gconstpointer p1,
- gconstpointer p2,
- gpointer data)
-{
- RequestedSize *sizes = data;
- const guint *c1 = p1;
- const guint *c2 = p2;
-
- const gint d1 = MAX (sizes[*c1].natural_size -
- sizes[*c1].minimum_size,
- 0);
- const gint d2 = MAX (sizes[*c2].natural_size -
- sizes[*c2].minimum_size,
- 0);
-
- gint delta = (d2 - d1);
-
- if (0 == delta)
- delta = (*c2 - *c1);
-
- return delta;
-}
-
-/*
- * distribute_natural_allocation:
- * @extra_space: Extra space to redistribute among children after subtracting
- * minimum sizes and any child padding from the overall allocation
- * @n_requested_sizes: Number of requests to fit into the allocation
- * @sizes: An array of structs with a client pointer and a minimum/natural size
- * in the orientation of the allocation.
- *
- * Distributes @extra_space to child @sizes by bringing smaller
- * children up to natural size first.
- *
- * The remaining space will be added to the @minimum_size member of the
- * RequestedSize struct. If all sizes reach their natural size then
- * the remaining space is returned.
- *
- * Returns: The remainder of @extra_space after redistributing space
- * to @sizes.
- *
- * Pulled from gtksizerequest.c from Gtk+
- */
-static gint
-distribute_natural_allocation (gint extra_space,
- guint n_requested_sizes,
- RequestedSize *sizes)
-{
- guint *spreading;
- gint i;
-
- g_return_val_if_fail (extra_space >= 0, 0);
-
- spreading = g_newa (guint, n_requested_sizes);
-
- for (i = 0; i < n_requested_sizes; i++)
- spreading[i] = i;
-
- /* Distribute the container's extra space c_gap. We want to assign
- * this space such that the sum of extra space assigned to children
- * (c^i_gap) is equal to c_cap. The case that there's not enough
- * space for all children to take their natural size needs some
- * attention. The goals we want to achieve are:
- *
- * a) Maximize number of children taking their natural size.
- * b) The allocated size of children should be a continuous
- * function of c_gap. That is, increasing the container size by
- * one pixel should never make drastic changes in the distribution.
- * c) If child i takes its natural size and child j doesn't,
- * child j should have received at least as much gap as child i.
- *
- * The following code distributes the additional space by following
- * these rules.
- */
-
- /* Sort descending by gap and position. */
- g_qsort_with_data (spreading,
- n_requested_sizes, sizeof (guint),
- compare_gap, sizes);
-
- /* Distribute available space.
- * This master piece of a loop was conceived by Behdad Esfahbod.
- */
- for (i = n_requested_sizes - 1; extra_space > 0 && i >= 0; --i)
- {
- /* Divide remaining space by number of remaining children.
- * Sort order and reducing remaining space by assigned space
- * ensures that space is distributed equally.
- */
- gint glue = (extra_space + i) / (i + 1);
- gint gap = sizes[(spreading[i])].natural_size
- - sizes[(spreading[i])].minimum_size;
-
- gint extra = MIN (glue, gap);
-
- sizes[spreading[i]].minimum_size += extra;
-
- extra_space -= extra;
- }
-
- return extra_space;
-}
-
-/* Requires that the minimum and natural fields of lines
- * have been set, computes the allocation field of lines
- * by distributing total_size among lines.
- */
-static void
-clutter_grid_request_allocate (ClutterGridRequest *request,
- ClutterOrientation orientation,
- gfloat total_size)
-{
- ClutterGridLayoutPrivate *priv = request->grid->priv;
- ClutterGridLineData *linedata;
- ClutterGridLines *lines;
- ClutterGridLine *line;
- gint nonempty;
- gint expand;
- gint i, j;
- RequestedSize *sizes;
- gint extra;
- gint rest;
- gint size;
-
- clutter_grid_request_compute_expand (request, orientation, &nonempty, &expand);
-
- if (nonempty == 0)
- return;
-
- linedata = &priv->linedata[orientation];
- lines = &request->lines[orientation];
-
- size = total_size - (nonempty - 1) * linedata->spacing;
-
- if (linedata->homogeneous)
- {
- extra = size / nonempty;
- rest = size % nonempty;
-
- for (i = 0; i < lines->max - lines->min; i++)
- {
- line = &lines->lines[i];
- if (line->empty)
- continue;
-
- line->allocation = extra;
- if (rest > 0)
- {
- line->allocation += 1;
- rest -= 1;
- }
- }
- }
- else
- {
- sizes = g_newa (RequestedSize, nonempty);
-
- j = 0;
- for (i = 0; i < lines->max - lines->min; i++)
- {
- line = &lines->lines[i];
- if (line->empty)
- continue;
-
- size -= line->minimum;
-
- sizes[j].minimum_size = line->minimum;
- sizes[j].natural_size = line->natural;
- sizes[j].data = line;
- j++;
- }
-
- size = distribute_natural_allocation (MAX (0, size), nonempty, sizes);
-
- if (expand > 0)
- {
- extra = size / expand;
- rest = size % expand;
- }
- else
- {
- extra = 0;
- rest = 0;
- }
-
- j = 0;
- for (i = 0; i < lines->max - lines->min; i++)
- {
- line = &lines->lines[i];
- if (line->empty)
- continue;
-
- g_assert (line == sizes[j].data);
-
- line->allocation = sizes[j].minimum_size;
- if (line->expand)
- {
- line->allocation += extra;
- if (rest > 0)
- {
- line->allocation += 1;
- rest -= 1;
- }
- }
-
- j++;
- }
- }
-}
-
-/* Computes the position fields from allocation and spacing.
- */
-static void
-clutter_grid_request_position (ClutterGridRequest *request,
- ClutterOrientation orientation)
-{
- ClutterGridLayoutPrivate *priv = request->grid->priv;
- ClutterGridLineData *linedata;
- ClutterGridLines *lines;
- ClutterGridLine *line;
- gfloat position;
- gint i;
-
- linedata = &priv->linedata[orientation];
- lines = &request->lines[orientation];
-
- position = 0.f;
- for (i = 0; i < lines->max - lines->min; i++)
- {
- line = &lines->lines[i];
- if (!line->empty)
- {
- line->position = position;
- position += line->allocation + linedata->spacing;
- }
- }
-}
-
-static void
-clutter_grid_child_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterGridChild *grid_child = CLUTTER_GRID_CHILD (gobject);
- ClutterLayoutManager *manager;
-
- manager = clutter_layout_meta_get_manager (CLUTTER_LAYOUT_META (gobject));
-
- switch (prop_id)
- {
- case PROP_CHILD_LEFT_ATTACH:
- CHILD_LEFT (grid_child) = g_value_get_int (value);
- clutter_layout_manager_layout_changed (manager);
- break;
-
- case PROP_CHILD_TOP_ATTACH:
- CHILD_TOP (grid_child) = g_value_get_int (value);
- clutter_layout_manager_layout_changed (manager);
- break;
-
- case PROP_CHILD_WIDTH:
- CHILD_WIDTH (grid_child) = g_value_get_int (value);
- clutter_layout_manager_layout_changed (manager);
- break;
-
- case PROP_CHILD_HEIGHT:
- CHILD_HEIGHT (grid_child) = g_value_get_int (value);
- clutter_layout_manager_layout_changed (manager);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_grid_child_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterGridChild *grid_child = CLUTTER_GRID_CHILD (gobject);
-
- switch (prop_id)
- {
- case PROP_CHILD_LEFT_ATTACH:
- g_value_set_int (value, CHILD_LEFT (grid_child));
- break;
-
- case PROP_CHILD_TOP_ATTACH:
- g_value_set_int (value, CHILD_TOP (grid_child));
- break;
-
- case PROP_CHILD_WIDTH:
- g_value_set_int (value, CHILD_WIDTH (grid_child));
- break;
-
- case PROP_CHILD_HEIGHT:
- g_value_set_int (value, CHILD_HEIGHT (grid_child));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_grid_child_class_init (ClutterGridChildClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- gobject_class->set_property = clutter_grid_child_set_property;
- gobject_class->get_property = clutter_grid_child_get_property;
-
- child_props[PROP_CHILD_LEFT_ATTACH] =
- g_param_spec_int ("left-attach",
- P_("Left attachment"),
- P_("The column number to attach the left side of the "
- "child to"),
- -G_MAXINT, G_MAXINT, 0,
- G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE);
-
- child_props[PROP_CHILD_TOP_ATTACH] =
- g_param_spec_int ("top-attach",
- P_("Top attachment"),
- P_("The row number to attach the top side of a child "
- "widget to"),
- -G_MAXINT, G_MAXINT, 0,
- G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE);
-
- child_props[PROP_CHILD_WIDTH] =
- g_param_spec_int ("width",
- P_("Width"),
- P_("The number of columns that a child spans"),
- -G_MAXINT, G_MAXINT, 1,
- G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE);
-
- child_props[PROP_CHILD_HEIGHT] =
- g_param_spec_int ("height",
- P_("Height"),
- P_("The number of rows that a child spans"),
- -G_MAXINT, G_MAXINT, 1,
- G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE);
-
- g_object_class_install_properties (gobject_class, PROP_CHILD_LAST,
- child_props);
-}
-
-static void
-clutter_grid_child_init (ClutterGridChild *self)
-{
- CHILD_LEFT (self) = -1;
- CHILD_TOP (self) = -1;
- CHILD_WIDTH (self) = 1;
- CHILD_HEIGHT (self) = 1;
-}
-
-static void
-clutter_grid_layout_set_container (ClutterLayoutManager *self,
- ClutterContainer *container)
-{
- ClutterGridLayoutPrivate *priv = CLUTTER_GRID_LAYOUT (self)->priv;
- ClutterLayoutManagerClass *parent_class;
-
- priv->container = container;
-
- if (priv->container != NULL)
- {
- ClutterRequestMode request_mode;
-
- /* we need to change the :request-mode of the container
- * to match the orientation
- */
- request_mode = priv->orientation == CLUTTER_ORIENTATION_VERTICAL
- ? CLUTTER_REQUEST_HEIGHT_FOR_WIDTH
- : CLUTTER_REQUEST_WIDTH_FOR_HEIGHT;
- clutter_actor_set_request_mode (CLUTTER_ACTOR (priv->container),
- request_mode);
- }
-
- parent_class = CLUTTER_LAYOUT_MANAGER_CLASS (clutter_grid_layout_parent_class);
- parent_class->set_container (self, container);
-}
-
-static void
-clutter_grid_layout_get_size_for_size (ClutterGridLayout *self,
- ClutterOrientation orientation,
- float size,
- float *minimum,
- float *natural)
-{
- ClutterGridRequest request;
- ClutterGridLines *lines;
- float min_size, nat_size;
-
- request.grid = self;
- clutter_grid_request_update_attach (&request);
- clutter_grid_request_count_lines (&request);
-
- lines = &request.lines[0];
- lines->lines = g_newa (ClutterGridLine, lines->max - lines->min);
- memset (lines->lines, 0, (lines->max - lines->min) * sizeof (ClutterGridLine));
-
- lines = &request.lines[1];
- lines->lines = g_newa (ClutterGridLine, lines->max - lines->min);
- memset (lines->lines, 0, (lines->max - lines->min) * sizeof (ClutterGridLine));
-
- clutter_grid_request_run (&request, 1 - orientation, FALSE);
- clutter_grid_request_sum (&request, 1 - orientation, &min_size, &nat_size);
- clutter_grid_request_allocate (&request, 1 - orientation, MAX (size, nat_size));
-
- clutter_grid_request_run (&request, orientation, TRUE);
- clutter_grid_request_sum (&request, orientation, minimum, natural);
-}
-
-static void
-clutter_grid_layout_get_preferred_width (ClutterLayoutManager *manager,
- ClutterContainer *container,
- gfloat for_height,
- gfloat *min_width_p,
- gfloat *nat_width_p)
-{
- ClutterGridLayout *self = CLUTTER_GRID_LAYOUT (manager);
-
- if (min_width_p)
- *min_width_p = 0.0f;
- if (nat_width_p)
- *nat_width_p = 0.0f;
-
- clutter_grid_layout_get_size_for_size (self, CLUTTER_ORIENTATION_HORIZONTAL,
- for_height,
- min_width_p, nat_width_p);
-}
-
-static void
-clutter_grid_layout_get_preferred_height (ClutterLayoutManager *manager,
- ClutterContainer *container,
- gfloat for_width,
- gfloat *min_height_p,
- gfloat *nat_height_p)
-{
- ClutterGridLayout *self = CLUTTER_GRID_LAYOUT (manager);
-
- if (min_height_p)
- *min_height_p = 0.0f;
- if (nat_height_p)
- *nat_height_p = 0.0f;
-
- clutter_grid_layout_get_size_for_size (self, CLUTTER_ORIENTATION_VERTICAL,
- for_width,
- min_height_p, nat_height_p);
-}
-
-static void
-allocate_child (ClutterGridRequest *request,
- ClutterOrientation orientation,
- ClutterGridChild *child,
- gfloat *position,
- gfloat *size)
-{
- ClutterGridLayoutPrivate *priv = request->grid->priv;
- ClutterGridLineData *linedata;
- ClutterGridLines *lines;
- ClutterGridLine *line;
- ClutterGridAttach *attach;
- gint i;
-
- linedata = &priv->linedata[orientation];
- lines = &request->lines[orientation];
- attach = &child->attach[orientation];
-
- *position = lines->lines[attach->pos - lines->min].position;
-
- *size = (attach->span - 1) * linedata->spacing;
- for (i = 0; i < attach->span; i++)
- {
- line = &lines->lines[attach->pos - lines->min + i];
- *size += line->allocation;
- }
-}
-
-#define GET_SIZE(allocation, orientation) \
- (orientation == CLUTTER_ORIENTATION_HORIZONTAL \
- ? clutter_actor_box_get_width ((allocation)) \
- : clutter_actor_box_get_height ((allocation)))
-
-static void
-clutter_grid_layout_allocate (ClutterLayoutManager *layout,
- ClutterContainer *container,
- const ClutterActorBox *allocation)
-{
- ClutterGridLayout *self = CLUTTER_GRID_LAYOUT (layout);
- ClutterOrientation orientation;
- ClutterGridRequest request;
- ClutterGridLines *lines;
- ClutterActorIter iter;
- ClutterActor *child;
-
- request.grid = self;
-
- clutter_grid_request_update_attach (&request);
- clutter_grid_request_count_lines (&request);
- lines = &request.lines[0];
- lines->lines = g_newa (ClutterGridLine, lines->max - lines->min);
- memset (lines->lines, 0, (lines->max - lines->min) * sizeof (ClutterGridLine));
- lines = &request.lines[1];
- lines->lines = g_newa (ClutterGridLine, lines->max - lines->min);
- memset (lines->lines, 0, (lines->max - lines->min) * sizeof (ClutterGridLine));
-
- if (clutter_actor_get_request_mode (CLUTTER_ACTOR (container)) == CLUTTER_REQUEST_WIDTH_FOR_HEIGHT)
- orientation = CLUTTER_ORIENTATION_HORIZONTAL;
- else
- orientation = CLUTTER_ORIENTATION_VERTICAL;
-
- clutter_grid_request_run (&request, 1 - orientation, FALSE);
- clutter_grid_request_allocate (&request, 1 - orientation, GET_SIZE (allocation, 1 - orientation));
- clutter_grid_request_run (&request, orientation, TRUE);
-
- clutter_grid_request_allocate (&request, orientation, GET_SIZE (allocation, orientation));
-
- clutter_grid_request_position (&request, 0);
- clutter_grid_request_position (&request, 1);
-
- clutter_actor_iter_init (&iter, CLUTTER_ACTOR (container));
- while (clutter_actor_iter_next (&iter, &child))
- {
- ClutterActorBox child_allocation;
- gfloat x, y, width, height;
- ClutterGridChild *grid_child;
-
- if (!clutter_actor_is_visible (child))
- continue;
-
- grid_child = GET_GRID_CHILD (self, child);
- allocate_child (&request, CLUTTER_ORIENTATION_HORIZONTAL, grid_child,
- &x, &width);
- allocate_child (&request, CLUTTER_ORIENTATION_VERTICAL, grid_child,
- &y, &height);
- x += allocation->x1;
- y += allocation->y1;
-
- CLUTTER_NOTE (LAYOUT, "Allocation for %s { %.2f, %.2f - %.2f x %.2f }",
- _clutter_actor_get_debug_name (child),
- x, y, width, height);
-
- child_allocation.x1 = x;
- child_allocation.y1 = y;
- child_allocation.x2 = child_allocation.x1 + width;
- child_allocation.y2 = child_allocation.y1 + height;
-
- clutter_actor_allocate (child, &child_allocation);
- }
-}
-
-static GType
-clutter_grid_layout_get_child_meta_type (ClutterLayoutManager *self)
-{
- return CLUTTER_TYPE_GRID_CHILD;
-}
-
-static void
-clutter_grid_layout_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterGridLayout *self = CLUTTER_GRID_LAYOUT (gobject);
-
- switch (prop_id)
- {
- case PROP_ORIENTATION:
- clutter_grid_layout_set_orientation (self, g_value_get_enum (value));
- break;
-
- case PROP_ROW_SPACING:
- clutter_grid_layout_set_row_spacing (self, g_value_get_uint (value));
- break;
-
- case PROP_COLUMN_SPACING:
- clutter_grid_layout_set_column_spacing (self, g_value_get_uint (value));
- break;
-
- case PROP_ROW_HOMOGENEOUS:
- clutter_grid_layout_set_row_homogeneous (self,
- g_value_get_boolean (value));
- break;
-
- case PROP_COLUMN_HOMOGENEOUS:
- clutter_grid_layout_set_column_homogeneous (self,
- g_value_get_boolean (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_grid_layout_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterGridLayoutPrivate *priv = CLUTTER_GRID_LAYOUT (gobject)->priv;
-
- switch (prop_id)
- {
- case PROP_ORIENTATION:
- g_value_set_enum (value, priv->orientation);
- break;
-
- case PROP_ROW_SPACING:
- g_value_set_uint (value, COLUMNS (priv)->spacing);
- break;
-
- case PROP_COLUMN_SPACING:
- g_value_set_uint (value, ROWS (priv)->spacing);
- break;
-
- case PROP_ROW_HOMOGENEOUS:
- g_value_set_boolean (value, COLUMNS (priv)->homogeneous);
- break;
-
- case PROP_COLUMN_HOMOGENEOUS:
- g_value_set_boolean (value, ROWS (priv)->homogeneous);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_grid_layout_class_init (ClutterGridLayoutClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- ClutterLayoutManagerClass *layout_class;
-
- layout_class = CLUTTER_LAYOUT_MANAGER_CLASS (klass);
-
- object_class->set_property = clutter_grid_layout_set_property;
- object_class->get_property = clutter_grid_layout_get_property;
-
- layout_class->set_container = clutter_grid_layout_set_container;
- layout_class->get_preferred_width = clutter_grid_layout_get_preferred_width;
- layout_class->get_preferred_height = clutter_grid_layout_get_preferred_height;
- layout_class->allocate = clutter_grid_layout_allocate;
- layout_class->get_child_meta_type = clutter_grid_layout_get_child_meta_type;
-
- /**
- * ClutterGridLayout:orientation:
- *
- * The orientation of the layout, either horizontal or vertical
- *
- * Since: 1.12
- */
- obj_props[PROP_ORIENTATION] =
- g_param_spec_enum ("orientation",
- P_("Orientation"),
- P_("The orientation of the layout"),
- CLUTTER_TYPE_ORIENTATION,
- CLUTTER_ORIENTATION_HORIZONTAL,
- G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE);
-
- /**
- * ClutterGridLayout:row-spacing:
- *
- * The amount of space in pixels between two consecutive rows
- *
- * Since: 1.12
- */
- obj_props[PROP_ROW_SPACING] =
- g_param_spec_uint ("row-spacing",
- P_("Row spacing"),
- P_("The amount of space between two consecutive rows"),
- 0, G_MAXUINT, 0,
- G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE);
-
- /**
- * ClutterGridLayout:column-spacing:
- *
- * The amount of space in pixels between two consecutive columns
- *
- * Since: 1.12
- */
- obj_props[PROP_COLUMN_SPACING] =
- g_param_spec_uint ("column-spacing",
- P_("Column spacing"),
- P_("The amount of space between two consecutive "
- "columns"),
- 0, G_MAXUINT, 0,
- G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE);
-
- /**
- * ClutterGridLayout:row-homogeneous:
- *
- * Whether all rows of the layout should have the same height
- *
- * Since: 1.12
- */
- obj_props[PROP_ROW_HOMOGENEOUS] =
- g_param_spec_boolean ("row-homogeneous",
- P_("Row Homogeneous"),
- P_("If TRUE, the rows are all the same height"),
- FALSE,
- G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE);
-
- /**
- * ClutterGridLayout:column-homogeneous:
- *
- * Whether all columns of the layout should have the same width
- *
- * Since: 1.12
- */
- obj_props[PROP_COLUMN_HOMOGENEOUS] =
- g_param_spec_boolean ("column-homogeneous",
- P_("Column Homogeneous"),
- P_("If TRUE, the columns are all the same width"),
- FALSE,
- G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE);
-
- g_object_class_install_properties (object_class, PROP_LAST, obj_props);
-}
-
-static void
-clutter_grid_layout_init (ClutterGridLayout *self)
-{
- self->priv = clutter_grid_layout_get_instance_private (self);
-
- self->priv->orientation = CLUTTER_ORIENTATION_HORIZONTAL;
-
- self->priv->linedata[0].spacing = 0;
- self->priv->linedata[1].spacing = 0;
-
- self->priv->linedata[0].homogeneous = FALSE;
- self->priv->linedata[1].homogeneous = FALSE;
-}
-
-/**
- * clutter_grid_layout_new:
- *
- * Creates a new #ClutterGridLayout
- *
- * Return value: the new #ClutterGridLayout
- */
-ClutterLayoutManager *
-clutter_grid_layout_new (void)
-{
- return g_object_new (CLUTTER_TYPE_GRID_LAYOUT, NULL);
-}
-
-/**
- * clutter_grid_layout_attach:
- * @layout: a #ClutterGridLayout
- * @child: the #ClutterActor to add
- * @left: the column number to attach the left side of @child to
- * @top: the row number to attach the top side of @child to
- * @width: the number of columns that @child will span
- * @height: the number of rows that @child will span
- *
- * Adds a widget to the grid.
- *
- * The position of @child is determined by @left and @top. The
- * number of 'cells' that @child will occupy is determined by
- * @width and @height.
- *
- * Since: 1.12
- */
-void
-clutter_grid_layout_attach (ClutterGridLayout *layout,
- ClutterActor *child,
- gint left,
- gint top,
- gint width,
- gint height)
-{
- ClutterGridLayoutPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_GRID_LAYOUT (layout));
-
- priv = layout->priv;
-
- if (!priv->container)
- return;
-
- grid_attach (layout, child, left, top, width, height);
- clutter_actor_add_child (CLUTTER_ACTOR (priv->container), child);
-}
-
-/**
- * clutter_grid_layout_attach_next_to:
- * @layout: a #ClutterGridLayout
- * @child: the actor to add
- * @sibling: (allow-none): the child of @layout that @child will be placed
- * next to, or %NULL to place @child at the beginning or end
- * @side: the side of @sibling that @child is positioned next to
- * @width: the number of columns that @child will span
- * @height: the number of rows that @child will span
- *
- * Adds a actor to the grid.
- *
- * The actor is placed next to @sibling, on the side determined by
- * @side. When @sibling is %NULL, the actor is placed in row (for
- * left or right placement) or column 0 (for top or bottom placement),
- * at the end indicated by @side.
- *
- * Attaching widgets labeled [1], [2], [3] with @sibling == %NULL and
- * @side == %CLUTTER_GRID_POSITION_LEFT yields a layout of [3][2][1].
- *
- * Since: 1.12
- */
-void
-clutter_grid_layout_attach_next_to (ClutterGridLayout *layout,
- ClutterActor *child,
- ClutterActor *sibling,
- ClutterGridPosition side,
- gint width,
- gint height)
-{
- ClutterGridLayoutPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_GRID_LAYOUT (layout));
- g_return_if_fail (CLUTTER_IS_ACTOR (child));
- g_return_if_fail (clutter_actor_get_parent (child) == NULL);
- g_return_if_fail (sibling == NULL || CLUTTER_IS_ACTOR (sibling));
- g_return_if_fail (width > 0);
- g_return_if_fail (height > 0);
-
- priv = layout->priv;
-
- if (!priv->container)
- return;
-
- grid_attach_next_to (layout, child, sibling, side, width, height);
- clutter_actor_add_child (CLUTTER_ACTOR (priv->container), child);
-}
-
-/**
- * clutter_grid_layout_set_orientation:
- * @layout: a #ClutterGridLayout
- * @orientation: the orientation of the #ClutterGridLayout
- *
- * Sets the orientation of the @layout.
- *
- * #ClutterGridLayout uses the orientation as a hint when adding
- * children to the #ClutterActor using it as a layout manager via
- * clutter_actor_add_child(); changing this value will not have
- * any effect on children that are already part of the layout.
- *
- * Since: 1.12
- */
-void
-clutter_grid_layout_set_orientation (ClutterGridLayout *layout,
- ClutterOrientation orientation)
-{
- ClutterGridLayoutPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_GRID_LAYOUT (layout));
-
- priv = layout->priv;
-
- if (priv->orientation != orientation)
- {
- priv->orientation = orientation;
-
- clutter_layout_manager_layout_changed (CLUTTER_LAYOUT_MANAGER (layout));
- g_object_notify_by_pspec (G_OBJECT (layout), obj_props[PROP_ORIENTATION]);
- }
-}
-
-/**
- * clutter_grid_layout_get_child_at:
- * @layout: a #ClutterGridLayout
- * @left: the left edge of the cell
- * @top: the top edge of the cell
- *
- * Gets the child of @layout whose area covers the grid
- * cell whose upper left corner is at @left, @top.
- *
- * Returns: (transfer none): the child at the given position, or %NULL
- *
- * Since: 1.12
- */
-ClutterActor *
-clutter_grid_layout_get_child_at (ClutterGridLayout *layout,
- gint left,
- gint top)
-{
- ClutterGridLayoutPrivate *priv;
- ClutterGridChild *grid_child;
- ClutterActorIter iter;
- ClutterActor *child;
-
- g_return_val_if_fail (CLUTTER_IS_GRID_LAYOUT (layout), NULL);
-
- priv = layout->priv;
-
- if (!priv->container)
- return NULL;
-
- clutter_actor_iter_init (&iter, CLUTTER_ACTOR (priv->container));
- while (clutter_actor_iter_next (&iter, &child))
- {
- grid_child = GET_GRID_CHILD (layout, child);
-
- if (CHILD_LEFT (grid_child) <= left &&
- CHILD_LEFT (grid_child) + CHILD_WIDTH (grid_child) > left &&
- CHILD_TOP (grid_child) <= top &&
- CHILD_TOP (grid_child) + CHILD_HEIGHT (grid_child) > top)
- return child;
- }
-
- return NULL;
-}
-
-/**
- * clutter_grid_layout_insert_row:
- * @layout: a #ClutterGridLayout
- * @position: the position to insert the row at
- *
- * Inserts a row at the specified position.
- *
- * Children which are attached at or below this position
- * are moved one row down. Children which span across this
- * position are grown to span the new row.
- *
- * Since: 1.12
- */
-void
-clutter_grid_layout_insert_row (ClutterGridLayout *layout,
- gint position)
-{
- ClutterGridLayoutPrivate *priv;
- ClutterGridChild *grid_child;
- ClutterActorIter iter;
- ClutterActor *child;
- gint top, height;
-
- g_return_if_fail (CLUTTER_IS_GRID_LAYOUT (layout));
-
- priv = layout->priv;
-
- if (!priv->container)
- return;
-
- clutter_actor_iter_init (&iter, CLUTTER_ACTOR (priv->container));
- while (clutter_actor_iter_next (&iter, &child))
- {
- grid_child = GET_GRID_CHILD (layout, child);
-
- top = CHILD_TOP (grid_child);
- height = CHILD_HEIGHT (grid_child);
-
- if (top >= position)
- {
- CHILD_TOP (grid_child) = top + 1;
- g_object_notify_by_pspec (G_OBJECT (grid_child),
- child_props[PROP_CHILD_TOP_ATTACH]);
- }
- else if (top + height > position)
- {
- CHILD_HEIGHT (grid_child) = height + 1;
- g_object_notify_by_pspec (G_OBJECT (grid_child),
- child_props[PROP_CHILD_HEIGHT]);
- }
- }
- clutter_layout_manager_layout_changed (CLUTTER_LAYOUT_MANAGER (layout));
-}
-
-/**
- * clutter_grid_layout_insert_column:
- * @layout: a #ClutterGridLayout
- * @position: the position to insert the column at
- *
- * Inserts a column at the specified position.
- *
- * Children which are attached at or to the right of this position
- * are moved one column to the right. Children which span across this
- * position are grown to span the new column.
- *
- * Since: 1.12
- */
-void
-clutter_grid_layout_insert_column (ClutterGridLayout *layout,
- gint position)
-{
- ClutterGridLayoutPrivate *priv;
- ClutterGridChild *grid_child;
- ClutterActorIter iter;
- ClutterActor *child;
- gint left, width;
-
- g_return_if_fail (CLUTTER_IS_GRID_LAYOUT (layout));
-
- priv = layout->priv;
-
- if (!priv->container)
- return;
-
- clutter_actor_iter_init (&iter, CLUTTER_ACTOR (priv->container));
- while (clutter_actor_iter_next (&iter, &child))
- {
- grid_child = GET_GRID_CHILD (layout, child);
-
- left = CHILD_LEFT (grid_child);
- width = CHILD_WIDTH (grid_child);
-
- if (left >= position)
- {
- CHILD_LEFT (grid_child) = left + 1;
- g_object_notify_by_pspec (G_OBJECT (grid_child),
- child_props[PROP_CHILD_LEFT_ATTACH]);
- }
- else if (left + width > position)
- {
- CHILD_WIDTH (grid_child) = width + 1;
- g_object_notify_by_pspec (G_OBJECT (grid_child),
- child_props[PROP_CHILD_WIDTH]);
- }
- }
- clutter_layout_manager_layout_changed (CLUTTER_LAYOUT_MANAGER (layout));
-}
-
-/**
- * clutter_grid_layout_insert_next_to:
- * @layout: a #ClutterGridLayout
- * @sibling: the child of @layout that the new row or column will be
- * placed next to
- * @side: the side of @sibling that @child is positioned next to
- *
- * Inserts a row or column at the specified position.
- *
- * The new row or column is placed next to @sibling, on the side
- * determined by @side. If @side is %CLUTTER_GRID_POSITION_LEFT or
- * %CLUTTER_GRID_POSITION_BOTTOM, a row is inserted. If @side is
- * %CLUTTER_GRID_POSITION_LEFT of %CLUTTER_GRID_POSITION_RIGHT,
- * a column is inserted.
- *
- * Since: 1.12
- */
-void
-clutter_grid_layout_insert_next_to (ClutterGridLayout *layout,
- ClutterActor *sibling,
- ClutterGridPosition side)
-{
- ClutterGridChild *grid_child;
-
- g_return_if_fail (CLUTTER_IS_GRID_LAYOUT (layout));
- g_return_if_fail (CLUTTER_IS_ACTOR (sibling));
-
- grid_child = GET_GRID_CHILD (layout, sibling);
-
- switch (side)
- {
- case CLUTTER_GRID_POSITION_LEFT:
- clutter_grid_layout_insert_column (layout, CHILD_LEFT (grid_child));
- break;
-
- case CLUTTER_GRID_POSITION_RIGHT:
- clutter_grid_layout_insert_column (layout, CHILD_LEFT (grid_child) +
- CHILD_WIDTH (grid_child));
- break;
-
- case CLUTTER_GRID_POSITION_TOP:
- clutter_grid_layout_insert_row (layout, CHILD_TOP (grid_child));
- break;
-
- case CLUTTER_GRID_POSITION_BOTTOM:
- clutter_grid_layout_insert_row (layout, CHILD_TOP (grid_child) +
- CHILD_HEIGHT (grid_child));
- break;
-
- default:
- g_assert_not_reached ();
- }
-}
-
-/**
- * clutter_grid_layout_get_orientation:
- * @layout: a #ClutterGridLayout
- *
- * Retrieves the orientation of the @layout.
- *
- * Return value: the orientation of the layout
- *
- * Since: 1.12
- */
-ClutterOrientation
-clutter_grid_layout_get_orientation (ClutterGridLayout *layout)
-{
- g_return_val_if_fail (CLUTTER_IS_GRID_LAYOUT (layout),
- CLUTTER_ORIENTATION_HORIZONTAL);
-
- return layout->priv->orientation;
-}
-
-/**
- * clutter_grid_layout_set_row_spacing:
- * @layout: a #ClutterGridLayout
- * @spacing: the spacing between rows of the layout, in pixels
- *
- * Sets the spacing between rows of @layout
- *
- * Since: 1.12
- */
-void
-clutter_grid_layout_set_row_spacing (ClutterGridLayout *layout,
- guint spacing)
-{
- ClutterGridLayoutPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_GRID_LAYOUT (layout));
-
- priv = layout->priv;
-
- if (COLUMNS (priv)->spacing != spacing)
- {
- COLUMNS (priv)->spacing = spacing;
-
- clutter_layout_manager_layout_changed (CLUTTER_LAYOUT_MANAGER (layout));
- g_object_notify_by_pspec (G_OBJECT (layout),
- obj_props[PROP_ROW_SPACING]);
- }
-}
-
-/**
- * clutter_grid_layout_get_row_spacing:
- * @layout: a #ClutterGridLayout
- *
- * Retrieves the spacing set using clutter_grid_layout_set_row_spacing()
- *
- * Return value: the spacing between rows of @layout
- *
- * Since: 1.12
- */
-guint
-clutter_grid_layout_get_row_spacing (ClutterGridLayout *layout)
-{
- ClutterGridLayoutPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_GRID_LAYOUT (layout), 0);
-
- priv = layout->priv;
-
- return COLUMNS (priv)->spacing;
-}
-
-/**
- * clutter_grid_layout_set_column_spacing:
- * @layout: a #ClutterGridLayout
- * @spacing: the spacing between columns of the layout, in pixels
- *
- * Sets the spacing between columns of @layout
- *
- * Since: 1.12
- */
-void
-clutter_grid_layout_set_column_spacing (ClutterGridLayout *layout,
- guint spacing)
-{
- ClutterGridLayoutPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_GRID_LAYOUT (layout));
-
- priv = layout->priv;
-
- if (ROWS (priv)->spacing != spacing)
- {
- ROWS (priv)->spacing = spacing;
-
- clutter_layout_manager_layout_changed (CLUTTER_LAYOUT_MANAGER (layout));
- g_object_notify_by_pspec (G_OBJECT (layout),
- obj_props[PROP_COLUMN_SPACING]);
- }
-}
-
-/**
- * clutter_grid_layout_get_column_spacing:
- * @layout: a #ClutterGridLayout
- *
- * Retrieves the spacing set using clutter_grid_layout_set_column_spacing()
- *
- * Return value: the spacing between coluns of @layout
- *
- * Since: 1.12
- */
-guint
-clutter_grid_layout_get_column_spacing (ClutterGridLayout *layout)
-{
- ClutterGridLayoutPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_GRID_LAYOUT (layout), 0);
-
- priv = layout->priv;
-
- return ROWS (priv)->spacing;
-}
-
-/**
- * clutter_grid_layout_set_column_homogeneous:
- * @layout: a #ClutterGridLayout
- * @homogeneous: %TRUE to make columns homogeneous
- *
- * Sets whether all columns of @layout will have the same width.
- *
- * Since: 1.12
- */
-void
-clutter_grid_layout_set_column_homogeneous (ClutterGridLayout *layout,
- gboolean homogeneous)
-{
- ClutterGridLayoutPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_GRID_LAYOUT (layout));
-
- priv = layout->priv;
-
- if (ROWS (priv)->homogeneous != homogeneous)
- {
- ROWS (priv)->homogeneous = homogeneous;
-
- clutter_layout_manager_layout_changed (CLUTTER_LAYOUT_MANAGER (layout));
- g_object_notify_by_pspec (G_OBJECT (layout),
- obj_props[PROP_COLUMN_HOMOGENEOUS]);
- }
-}
-
-/**
- * clutter_grid_layout_get_column_homogeneous:
- * @layout: a #ClutterGridLayout
- *
- * Returns whether all columns of @layout have the same width.
- *
- * Returns: whether all columns of @layout have the same width.
- */
-gboolean
-clutter_grid_layout_get_column_homogeneous (ClutterGridLayout *layout)
-{
- ClutterGridLayoutPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_GRID_LAYOUT (layout), FALSE);
-
- priv = layout->priv;
-
- return ROWS (priv)->homogeneous;
-}
-
-/**
- * clutter_grid_layout_set_row_homogeneous:
- * @layout: a #ClutterGridLayout
- * @homogeneous: %TRUE to make rows homogeneous
- *
- * Sets whether all rows of @layout will have the same height.
- *
- * Since: 1.12
- */
-void
-clutter_grid_layout_set_row_homogeneous (ClutterGridLayout *layout,
- gboolean homogeneous)
-{
- ClutterGridLayoutPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_GRID_LAYOUT (layout));
-
- priv = layout->priv;
-
- if (COLUMNS (priv)->homogeneous != homogeneous)
- {
- COLUMNS (priv)->homogeneous = homogeneous;
-
- clutter_layout_manager_layout_changed (CLUTTER_LAYOUT_MANAGER (layout));
- g_object_notify_by_pspec (G_OBJECT (layout),
- obj_props[PROP_ROW_HOMOGENEOUS]);
- }
-}
-
-/**
- * clutter_grid_layout_get_row_homogeneous:
- * @layout: a #ClutterGridLayout
- *
- * Returns whether all rows of @layout have the same height.
- *
- * Returns: whether all rows of @layout have the same height.
- *
- * Since: 1.12
- */
-gboolean
-clutter_grid_layout_get_row_homogeneous (ClutterGridLayout *layout)
-{
- ClutterGridLayoutPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_GRID_LAYOUT (layout), FALSE);
-
- priv = layout->priv;
-
- return COLUMNS (priv)->homogeneous;
-}
diff --git a/clutter/clutter/clutter-grid-layout.h b/clutter/clutter/clutter-grid-layout.h
deleted file mode 100644
index 88603265d..000000000
--- a/clutter/clutter/clutter-grid-layout.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Red Hat, Inc.
- * Copyright (C) 2012 Bastian Winkler <buz@netbuz.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Bastian Winkler <buz@netbuz.org>
- *
- * Based on GtkGrid widget by:
- * Matthias Clasen
- */
-
-#ifndef __CLUTTER_GRID_LAYOUT_H__
-#define __CLUTTER_GRID_LAYOUT_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-layout-manager.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_GRID_LAYOUT (clutter_grid_layout_get_type ())
-#define CLUTTER_GRID_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_GRID_LAYOUT, ClutterGridLayout))
-#define CLUTTER_IS_GRID_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_GRID_LAYOUT))
-#define CLUTTER_GRID_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_GRID_LAYOUT, ClutterGridLayoutClass))
-#define CLUTTER_IS_GRID_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_GRID_LAYOUT))
-#define CLUTTER_GRID_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_GRID_LAYOUT, ClutterGridLayoutClass))
-
-typedef struct _ClutterGridLayout ClutterGridLayout;
-typedef struct _ClutterGridLayoutPrivate ClutterGridLayoutPrivate;
-typedef struct _ClutterGridLayoutClass ClutterGridLayoutClass;
-
-/**
- * ClutterGridLayout:
- *
- * The #ClutterGridLayout structure contains only private data
- * and should be accessed using the provided API
- *
- * Since: 1.12
- */
-struct _ClutterGridLayout
-{
- /*< private >*/
- ClutterLayoutManager parent_instance;
-
- ClutterGridLayoutPrivate *priv;
-};
-
-/**
- * ClutterGridLayoutClass:
- *
- * The #ClutterGridLayoutClass structure contains only private
- * data and should be accessed using the provided API
- *
- * Since: 1.12
- */
-struct _ClutterGridLayoutClass
-{
- /*< private >*/
- ClutterLayoutManagerClass parent_class;
-
- gpointer _padding[8];
-};
-
-CLUTTER_EXPORT
-GType clutter_grid_layout_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterLayoutManager * clutter_grid_layout_new (void);
-
-CLUTTER_EXPORT
-void clutter_grid_layout_attach (ClutterGridLayout *layout,
- ClutterActor *child,
- gint left,
- gint top,
- gint width,
- gint height);
-
-CLUTTER_EXPORT
-void clutter_grid_layout_attach_next_to (ClutterGridLayout *layout,
- ClutterActor *child,
- ClutterActor *sibling,
- ClutterGridPosition side,
- gint width,
- gint height);
-
-CLUTTER_EXPORT
-ClutterActor * clutter_grid_layout_get_child_at (ClutterGridLayout *layout,
- gint left,
- gint top);
-
-CLUTTER_EXPORT
-void clutter_grid_layout_insert_row (ClutterGridLayout *layout,
- gint position);
-
-CLUTTER_EXPORT
-void clutter_grid_layout_insert_column (ClutterGridLayout *layout,
- gint position);
-
-CLUTTER_EXPORT
-void clutter_grid_layout_insert_next_to (ClutterGridLayout *layout,
- ClutterActor *sibling,
- ClutterGridPosition side);
-
-CLUTTER_EXPORT
-void clutter_grid_layout_set_orientation (ClutterGridLayout *layout,
- ClutterOrientation orientation);
-
-CLUTTER_EXPORT
-ClutterOrientation clutter_grid_layout_get_orientation (ClutterGridLayout *layout);
-
-CLUTTER_EXPORT
-void clutter_grid_layout_set_column_spacing (ClutterGridLayout *layout,
- guint spacing);
-
-CLUTTER_EXPORT
-guint clutter_grid_layout_get_column_spacing (ClutterGridLayout *layout);
-
-CLUTTER_EXPORT
-void clutter_grid_layout_set_row_spacing (ClutterGridLayout *layout,
- guint spacing);
-
-CLUTTER_EXPORT
-guint clutter_grid_layout_get_row_spacing (ClutterGridLayout *layout);
-
-CLUTTER_EXPORT
-void clutter_grid_layout_set_column_homogeneous (ClutterGridLayout *layout,
- gboolean homogeneous);
-
-CLUTTER_EXPORT
-gboolean clutter_grid_layout_get_column_homogeneous (ClutterGridLayout *layout);
-
-
-CLUTTER_EXPORT
-void clutter_grid_layout_set_row_homogeneous (ClutterGridLayout *layout,
- gboolean homogeneous);
-
-CLUTTER_EXPORT
-gboolean clutter_grid_layout_get_row_homogeneous (ClutterGridLayout *layout);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_GRID_LAYOUT_H__ */
diff --git a/clutter/clutter/clutter-id-pool.c b/clutter/clutter/clutter-id-pool.c
deleted file mode 100644
index c71729443..000000000
--- a/clutter/clutter/clutter-id-pool.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- *
- * Copyright (C) 2006-2008 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- *
- *
- * ClutterIDPool: pool of reusable integer ids associated with pointers.
- *
- * Author: Øyvind Kolås <pippin@o-hand-com>
- *
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-debug.h"
-#include "clutter-id-pool.h"
-
-struct _ClutterIDPool
-{
- GArray *array; /* Array of pointers */
- GSList *free_ids; /* A stack of freed ids */
-};
-
-ClutterIDPool *
-_clutter_id_pool_new (guint initial_size)
-{
- ClutterIDPool *self;
-
- self = g_new0 (ClutterIDPool, 1);
-
- self->array = g_array_sized_new (FALSE, FALSE,
- sizeof (gpointer), initial_size);
- self->free_ids = NULL;
- return self;
-}
-
-void
-_clutter_id_pool_free (ClutterIDPool *id_pool)
-{
- g_return_if_fail (id_pool != NULL);
-
- g_array_free (id_pool->array, TRUE);
- g_slist_free (id_pool->free_ids);
- g_free (id_pool);
-}
-
-guint32
-_clutter_id_pool_add (ClutterIDPool *id_pool,
- gpointer ptr)
-{
- gpointer *array;
- guint32 retval;
-
- g_return_val_if_fail (id_pool != NULL, 0);
-
- if (id_pool->free_ids) /* There are items on our freelist, reuse one */
- {
- array = (void*) id_pool->array->data;
- retval = GPOINTER_TO_UINT (id_pool->free_ids->data);
-
- id_pool->free_ids = g_slist_remove (id_pool->free_ids,
- id_pool->free_ids->data);
- array[retval] = ptr;
- return retval;
- }
-
- /* Allocate new id */
- retval = id_pool->array->len;
- g_array_append_val (id_pool->array, ptr);
-
- return retval;
-}
-
-void
-_clutter_id_pool_remove (ClutterIDPool *id_pool,
- guint32 id_)
-{
- gpointer *array;
-
- g_return_if_fail (id_pool != NULL);
-
- array = (void*) id_pool->array->data;
-
- array[id_] = NULL;
-
- id_pool->free_ids = g_slist_prepend (id_pool->free_ids,
- GUINT_TO_POINTER (id_));
-}
-
-gpointer
-_clutter_id_pool_lookup (ClutterIDPool *id_pool,
- guint32 id_)
-{
- gpointer *array;
-
- g_return_val_if_fail (id_pool != NULL, NULL);
- g_return_val_if_fail (id_pool->array != NULL, NULL);
-
- array = (void*) id_pool->array->data;
-
- if (id_ >= id_pool->array->len || array[id_] == NULL)
- {
- g_warning ("The required ID of %u does not refer to an existing actor; "
- "this usually implies that the pick() of an actor is not "
- "correctly implemented or that there is an error in the "
- "glReadPixels() implementation of the GL driver.", id_);
- return NULL;
- }
-
- return array[id_];
-}
diff --git a/clutter/clutter/clutter-id-pool.h b/clutter/clutter/clutter-id-pool.h
deleted file mode 100644
index 2c41363ae..000000000
--- a/clutter/clutter/clutter-id-pool.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- *
- * Copyright (C) 2008 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * ClutterIDPool: pool of reusable integer ids associated with pointers.
- *
- * Author: Øyvind Kolås <pippin@o-hand.com>
- */
-
-#ifndef __CLUTTER_ID_POOL_H__
-#define __CLUTTER_ID_POOL_H__
-
-#include <glib.h>
-
-G_BEGIN_DECLS
-
-typedef struct _ClutterIDPool ClutterIDPool;
-
-ClutterIDPool * _clutter_id_pool_new (guint initial_size);
-void _clutter_id_pool_free (ClutterIDPool *id_pool);
-
-guint32 _clutter_id_pool_add (ClutterIDPool *id_pool,
- gpointer ptr);
-void _clutter_id_pool_remove (ClutterIDPool *id_pool,
- guint32 id_);
-gpointer _clutter_id_pool_lookup (ClutterIDPool *id_pool,
- guint32 id_);
-
-
-G_END_DECLS
-
-#endif /* __CLUTTER_ID_POOL_H__ */
diff --git a/clutter/clutter/clutter-image.c b/clutter/clutter/clutter-image.c
deleted file mode 100644
index 9d368e68d..000000000
--- a/clutter/clutter/clutter-image.c
+++ /dev/null
@@ -1,452 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive image' library.
- *
- * Copyright (C) 2012 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-image
- * @Title: ClutterImage
- * @Short_Description: Image data content
- *
- * #ClutterImage is a #ClutterContent implementation that displays
- * image data inside a #ClutterActor.
- *
- * See [image.c](https://git.gnome.org/browse/clutter/tree/examples/image-content.c?h=clutter-1.18)
- * for an example of how to use #ClutterImage.
- *
- * #ClutterImage is available since Clutter 1.10.
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-image.h"
-
-#include "clutter-actor-private.h"
-#include "clutter-color.h"
-#include "clutter-content-private.h"
-#include "clutter-debug.h"
-#include "clutter-paint-node.h"
-#include "clutter-paint-nodes.h"
-#include "clutter-private.h"
-
-struct _ClutterImagePrivate
-{
- CoglTexture *texture;
- gint width;
- gint height;
-};
-
-static void clutter_content_iface_init (ClutterContentInterface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (ClutterImage, clutter_image, G_TYPE_OBJECT,
- G_ADD_PRIVATE (ClutterImage)
- G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTENT,
- clutter_content_iface_init))
-
-GQuark
-clutter_image_error_quark (void)
-{
- return g_quark_from_static_string ("clutter-image-error-quark");
-}
-
-static void
-update_image_size (ClutterImage *self)
-{
- gint width, height;
-
- if (self->priv->texture == NULL)
- return;
-
- width = cogl_texture_get_width (self->priv->texture);
- height = cogl_texture_get_height (self->priv->texture);
-
- if (self->priv->width == width &&
- self->priv->height == height)
- return;
-
- self->priv->width = width;
- self->priv->height = height;
-
- clutter_content_invalidate_size (CLUTTER_CONTENT (self));
-}
-
-static void
-clutter_image_finalize (GObject *gobject)
-{
- ClutterImagePrivate *priv = CLUTTER_IMAGE (gobject)->priv;
-
- if (priv->texture != NULL)
- {
- cogl_object_unref (priv->texture);
- priv->texture = NULL;
- }
-
- G_OBJECT_CLASS (clutter_image_parent_class)->finalize (gobject);
-}
-
-static void
-clutter_image_class_init (ClutterImageClass *klass)
-{
- G_OBJECT_CLASS (klass)->finalize = clutter_image_finalize;
-}
-
-static void
-clutter_image_init (ClutterImage *self)
-{
- self->priv = clutter_image_get_instance_private (self);
-}
-
-static void
-clutter_image_paint_content (ClutterContent *content,
- ClutterActor *actor,
- ClutterPaintNode *root,
- ClutterPaintContext *paint_context)
-{
- ClutterImagePrivate *priv = CLUTTER_IMAGE (content)->priv;
- ClutterPaintNode *node;
-
- if (priv->texture == NULL)
- return;
-
- node = clutter_actor_create_texture_paint_node (actor, priv->texture);
- clutter_paint_node_set_static_name (node, "Image Content");
- clutter_paint_node_add_child (root, node);
- clutter_paint_node_unref (node);
-}
-
-static gboolean
-clutter_image_get_preferred_size (ClutterContent *content,
- gfloat *width,
- gfloat *height)
-{
- ClutterImagePrivate *priv = CLUTTER_IMAGE (content)->priv;
-
- if (priv->texture == NULL)
- return FALSE;
-
- if (width != NULL)
- *width = cogl_texture_get_width (priv->texture);
-
- if (height != NULL)
- *height = cogl_texture_get_height (priv->texture);
-
- return TRUE;
-}
-
-static void
-clutter_content_iface_init (ClutterContentInterface *iface)
-{
- iface->get_preferred_size = clutter_image_get_preferred_size;
- iface->paint_content = clutter_image_paint_content;
-}
-
-/**
- * clutter_image_new:
- *
- * Creates a new #ClutterImage instance.
- *
- * Return value: (transfer full): the newly created #ClutterImage instance.
- * Use g_object_unref() when done.
- *
- * Since: 1.10
- */
-ClutterContent *
-clutter_image_new (void)
-{
- return g_object_new (CLUTTER_TYPE_IMAGE, NULL);
-}
-
-/**
- * clutter_image_set_data:
- * @image: a #ClutterImage
- * @data: (array): the image data, as an array of bytes
- * @pixel_format: the Cogl pixel format of the image data
- * @width: the width of the image data
- * @height: the height of the image data
- * @row_stride: the length of each row inside @data
- * @error: return location for a #GError, or %NULL
- *
- * Sets the image data to be displayed by @image.
- *
- * If the image data was successfully loaded, the @image will be invalidated.
- *
- * In case of error, the @error value will be set, and this function will
- * return %FALSE.
- *
- * The image data is copied in texture memory.
- *
- * The image data is expected to be a linear array of RGBA or RGB pixel data;
- * how to retrieve that data is left to platform specific image loaders. For
- * instance, if you use the GdkPixbuf library:
- *
- * |[<!-- language="C" -->
- * ClutterContent *image = clutter_image_new ();
- *
- * GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
- *
- * clutter_image_set_data (CLUTTER_IMAGE (image),
- * gdk_pixbuf_get_pixels (pixbuf),
- * gdk_pixbuf_get_has_alpha (pixbuf)
- * ? COGL_PIXEL_FORMAT_RGBA_8888
- * : COGL_PIXEL_FORMAT_RGB_888,
- * gdk_pixbuf_get_width (pixbuf),
- * gdk_pixbuf_get_height (pixbuf),
- * gdk_pixbuf_get_rowstride (pixbuf),
- * &error);
- *
- * g_object_unref (pixbuf);
- * ]|
- *
- * Return value: %TRUE if the image data was successfully loaded,
- * and %FALSE otherwise.
- *
- * Since: 1.10
- */
-gboolean
-clutter_image_set_data (ClutterImage *image,
- const guint8 *data,
- CoglPixelFormat pixel_format,
- guint width,
- guint height,
- guint row_stride,
- GError **error)
-{
- ClutterImagePrivate *priv;
- CoglTextureFlags flags;
-
- g_return_val_if_fail (CLUTTER_IS_IMAGE (image), FALSE);
- g_return_val_if_fail (data != NULL, FALSE);
-
- priv = image->priv;
-
- if (priv->texture != NULL)
- cogl_object_unref (priv->texture);
-
- flags = COGL_TEXTURE_NONE;
- if (width >= 512 && height >= 512)
- flags |= COGL_TEXTURE_NO_ATLAS;
-
- priv->texture = cogl_texture_new_from_data (width, height,
- flags,
- pixel_format,
- COGL_PIXEL_FORMAT_ANY,
- row_stride,
- data);
- if (priv->texture == NULL)
- {
- g_set_error_literal (error, CLUTTER_IMAGE_ERROR,
- CLUTTER_IMAGE_ERROR_INVALID_DATA,
- "Unable to load image data");
- return FALSE;
- }
-
- clutter_content_invalidate (CLUTTER_CONTENT (image));
- update_image_size (image);
-
- return TRUE;
-}
-
-/**
- * clutter_image_set_bytes:
- * @image: a #ClutterImage
- * @data: the image data, as a #GBytes
- * @pixel_format: the Cogl pixel format of the image data
- * @width: the width of the image data
- * @height: the height of the image data
- * @row_stride: the length of each row inside @data
- * @error: return location for a #GError, or %NULL
- *
- * Sets the image data stored inside a #GBytes to be displayed by @image.
- *
- * If the image data was successfully loaded, the @image will be invalidated.
- *
- * In case of error, the @error value will be set, and this function will
- * return %FALSE.
- *
- * The image data contained inside the #GBytes is copied in texture memory,
- * and no additional reference is acquired on the @data.
- *
- * Return value: %TRUE if the image data was successfully loaded,
- * and %FALSE otherwise.
- *
- * Since: 1.12
- */
-gboolean
-clutter_image_set_bytes (ClutterImage *image,
- GBytes *data,
- CoglPixelFormat pixel_format,
- guint width,
- guint height,
- guint row_stride,
- GError **error)
-{
- ClutterImagePrivate *priv;
- CoglTextureFlags flags;
-
- g_return_val_if_fail (CLUTTER_IS_IMAGE (image), FALSE);
- g_return_val_if_fail (data != NULL, FALSE);
-
- priv = image->priv;
-
- if (priv->texture != NULL)
- cogl_object_unref (priv->texture);
-
- flags = COGL_TEXTURE_NONE;
- if (width >= 512 && height >= 512)
- flags |= COGL_TEXTURE_NO_ATLAS;
-
- priv->texture = cogl_texture_new_from_data (width, height,
- flags,
- pixel_format,
- COGL_PIXEL_FORMAT_ANY,
- row_stride,
- g_bytes_get_data (data, NULL));
- if (priv->texture == NULL)
- {
- g_set_error_literal (error, CLUTTER_IMAGE_ERROR,
- CLUTTER_IMAGE_ERROR_INVALID_DATA,
- "Unable to load image data");
- return FALSE;
- }
-
- clutter_content_invalidate (CLUTTER_CONTENT (image));
- update_image_size (image);
-
- return TRUE;
-}
-
-/**
- * clutter_image_set_area:
- * @image: a #ClutterImage
- * @data: (array): the image data, as an array of bytes
- * @pixel_format: the Cogl pixel format of the image data
- * @rect: a rectangle indicating the area that should be set
- * @row_stride: the length of each row inside @data
- * @error: return location for a #GError, or %NULL
- *
- * Sets the image data to be display by @image, using @rect to indicate
- * the position and size of the image data to be set.
- *
- * If the @image does not have any image data set when this function is
- * called, a new texture will be created with the size of the width and
- * height of the rectangle, i.e. calling this function on a newly created
- * #ClutterImage will be the equivalent of calling clutter_image_set_data().
- *
- * If the image data was successfully loaded, the @image will be invalidated.
- *
- * In case of error, the @error value will be set, and this function will
- * return %FALSE.
- *
- * The image data is copied in texture memory.
- *
- * Return value: %TRUE if the image data was successfully loaded,
- * and %FALSE otherwise.
- *
- * Since: 1.10
- */
-gboolean
-clutter_image_set_area (ClutterImage *image,
- const guint8 *data,
- CoglPixelFormat pixel_format,
- const cairo_rectangle_int_t *area,
- guint row_stride,
- GError **error)
-{
- ClutterImagePrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_IMAGE (image), FALSE);
- g_return_val_if_fail (data != NULL, FALSE);
- g_return_val_if_fail (area != NULL, FALSE);
-
- priv = image->priv;
-
- if (priv->texture == NULL)
- {
- CoglTextureFlags flags = COGL_TEXTURE_NONE;
-
- if (area->width >= 512 && area->height >= 512)
- flags |= COGL_TEXTURE_NO_ATLAS;
-
- priv->texture = cogl_texture_new_from_data (area->width,
- area->height,
- flags,
- pixel_format,
- COGL_PIXEL_FORMAT_ANY,
- row_stride,
- data);
- }
- else
- {
- gboolean res;
-
- res = cogl_texture_set_region (priv->texture,
- 0, 0,
- area->x, area->y,
- area->width, area->height,
- area->width, area->height,
- pixel_format,
- row_stride,
- data);
-
- if (!res)
- {
- cogl_object_unref (priv->texture);
- priv->texture = NULL;
- }
- }
-
- if (priv->texture == NULL)
- {
- g_set_error_literal (error, CLUTTER_IMAGE_ERROR,
- CLUTTER_IMAGE_ERROR_INVALID_DATA,
- "Unable to load image data");
- return FALSE;
- }
-
- clutter_content_invalidate (CLUTTER_CONTENT (image));
- update_image_size (image);
-
- return TRUE;
-}
-
-/**
- * clutter_image_get_texture:
- * @image: a #ClutterImage
- *
- * Retrieves a pointer to the Cogl texture used by @image.
- *
- * If you change the contents of the returned Cogl texture you will need
- * to manually invalidate the @image with clutter_content_invalidate()
- * in order to update the actors using @image as their content.
- *
- * Return value: (transfer none): a pointer to the Cogl texture, or %NULL
- *
- * Since: 1.10
- * Stability: unstable
- */
-CoglTexture *
-clutter_image_get_texture (ClutterImage *image)
-{
- g_return_val_if_fail (CLUTTER_IS_IMAGE (image), NULL);
-
- return image->priv->texture;
-}
diff --git a/clutter/clutter/clutter-image.h b/clutter/clutter/clutter-image.h
deleted file mode 100644
index 7f02099e6..000000000
--- a/clutter/clutter/clutter-image.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive image' library.
- *
- * Copyright (C) 2012 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_IMAGE_H__
-#define __CLUTTER_IMAGE_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <cogl/cogl.h>
-#include <clutter/clutter-types.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_IMAGE (clutter_image_get_type ())
-#define CLUTTER_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_IMAGE, ClutterImage))
-#define CLUTTER_IS_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_IMAGE))
-#define CLUTTER_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_IMAGE, ClutterImageClass))
-#define CLUTTER_IS_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_IMAGE))
-#define CLUTTER_IMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_IMAGE, ClutterImageClass))
-
-/**
- * CLUTTER_IMAGE_ERROR:
- *
- * Error domain for the #ClutterImageError enumeration.
- *
- * Since: 1.10
- */
-#define CLUTTER_IMAGE_ERROR (clutter_image_error_quark ())
-
-typedef struct _ClutterImage ClutterImage;
-typedef struct _ClutterImagePrivate ClutterImagePrivate;
-typedef struct _ClutterImageClass ClutterImageClass;
-
-/**
- * ClutterImageError:
- * @CLUTTER_IMAGE_ERROR_INVALID_DATA: Invalid data passed to the
- * clutter_image_set_data() function.
- *
- * Error enumeration for #ClutterImage.
- *
- * Since: 1.10
- */
-typedef enum
-{
- CLUTTER_IMAGE_ERROR_INVALID_DATA
-} ClutterImageError;
-
-/**
- * ClutterImage:
- *
- * The #ClutterImage structure contains
- * private data and should only be accessed using the provided
- * API.
- *
- * Since: 1.10
- */
-struct _ClutterImage
-{
- /*< private >*/
- GObject parent_instance;
-
- ClutterImagePrivate *priv;
-};
-
-/**
- * ClutterImageClass:
- *
- * The #ClutterImageClass structure contains
- * private data.
- *
- * Since: 1.10
- */
-struct _ClutterImageClass
-{
- /*< private >*/
- GObjectClass parent_class;
-
- gpointer _padding[16];
-};
-
-CLUTTER_EXPORT
-GQuark clutter_image_error_quark (void);
-CLUTTER_EXPORT
-GType clutter_image_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterContent * clutter_image_new (void);
-CLUTTER_EXPORT
-gboolean clutter_image_set_data (ClutterImage *image,
- const guint8 *data,
- CoglPixelFormat pixel_format,
- guint width,
- guint height,
- guint row_stride,
- GError **error);
-CLUTTER_EXPORT
-gboolean clutter_image_set_area (ClutterImage *image,
- const guint8 *data,
- CoglPixelFormat pixel_format,
- const cairo_rectangle_int_t *rect,
- guint row_stride,
- GError **error);
-CLUTTER_EXPORT
-gboolean clutter_image_set_bytes (ClutterImage *image,
- GBytes *data,
- CoglPixelFormat pixel_format,
- guint width,
- guint height,
- guint row_stride,
- GError **error);
-
-CLUTTER_EXPORT
-CoglTexture * clutter_image_get_texture (ClutterImage *image);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_IMAGE_H__ */
diff --git a/clutter/clutter/clutter-input-device-private.h b/clutter/clutter/clutter-input-device-private.h
deleted file mode 100644
index a2168cc07..000000000
--- a/clutter/clutter/clutter-input-device-private.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright © 2009, 2010, 2011 Intel Corp.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author: Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef CLUTTER_INPUT_DEVICE_PRIVATE_H
-#define CLUTTER_INPUT_DEVICE_PRIVATE_H
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-input-device.h>
-
-G_BEGIN_DECLS
-
-typedef struct _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;
-
- /* the actor that has a grab in place for the device */
- ClutterActor *pointer_grab_actor;
- ClutterActor *keyboard_grab_actor;
- GHashTable *sequence_grab_actors;
- GHashTable *inv_sequence_grab_actors;
-
- /* the current click count */
- int click_count;
- int current_button_number;
-
- /* the previous state, used for click count generation */
- int previous_x;
- int previous_y;
- uint32_t previous_time;
- int previous_button_number;
-
- /* Accessiblity */
- ClutterVirtualInputDevice *accessibility_virtual_device;
- ClutterPtrA11yData *ptr_a11y_data;
-};
-
-#endif /* CLUTTER_INPUT_DEVICE_PRIVATE_H */
diff --git a/clutter/clutter/clutter-input-device-tool.c b/clutter/clutter/clutter-input-device-tool.c
deleted file mode 100644
index 2582a695c..000000000
--- a/clutter/clutter/clutter-input-device-tool.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright © 2009, 2010, 2011 Intel Corp.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author: Carlos Garnacho <carlosg@gnome.org>
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-input-device-tool.h"
-#include "clutter-private.h"
-
-typedef struct _ClutterInputDeviceToolPrivate ClutterInputDeviceToolPrivate;
-
-struct _ClutterInputDeviceToolPrivate
-{
- ClutterInputDeviceToolType type;
- guint64 serial;
- guint64 id;
- ClutterInputAxisFlags axes;
-};
-
-enum
-{
- PROP_0,
- PROP_TYPE,
- PROP_SERIAL,
- PROP_ID,
- PROP_AXES,
- PROP_LAST
-};
-
-static GParamSpec *props[PROP_LAST] = { NULL, };
-
-G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterInputDeviceTool, clutter_input_device_tool, G_TYPE_OBJECT)
-
-static void
-clutter_input_device_tool_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterInputDeviceTool *tool = CLUTTER_INPUT_DEVICE_TOOL (object);
- ClutterInputDeviceToolPrivate *priv;
-
- priv = clutter_input_device_tool_get_instance_private (tool);
-
- switch (prop_id)
- {
- case PROP_TYPE:
- priv->type = g_value_get_enum (value);
- break;
- case PROP_SERIAL:
- priv->serial = g_value_get_uint64 (value);
- break;
- case PROP_ID:
- priv->id = g_value_get_uint64 (value);
- break;
- case PROP_AXES:
- priv->axes = g_value_get_flags (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
-}
-
-static void
-clutter_input_device_tool_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterInputDeviceTool *tool = CLUTTER_INPUT_DEVICE_TOOL (object);
- ClutterInputDeviceToolPrivate *priv;
-
- priv = clutter_input_device_tool_get_instance_private (tool);
-
- switch (prop_id)
- {
- case PROP_TYPE:
- g_value_set_enum (value, priv->type);
- break;
- case PROP_SERIAL:
- g_value_set_uint64 (value, priv->serial);
- break;
- case PROP_ID:
- g_value_set_uint64 (value, priv->id);
- break;
- case PROP_AXES:
- g_value_set_flags (value, priv->axes);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
-}
-
-static void
-clutter_input_device_tool_class_init (ClutterInputDeviceToolClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- gobject_class->set_property = clutter_input_device_tool_set_property;
- gobject_class->get_property = clutter_input_device_tool_get_property;
-
- props[PROP_TYPE] =
- g_param_spec_enum ("type",
- P_("Tool type"),
- P_("Tool type"),
- CLUTTER_TYPE_INPUT_DEVICE_TOOL_TYPE,
- CLUTTER_INPUT_DEVICE_TOOL_NONE,
- CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
- props[PROP_SERIAL] =
- g_param_spec_uint64 ("serial",
- P_("Tool serial"),
- P_("Tool serial"),
- 0, G_MAXUINT64, 0,
- CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
- props[PROP_ID] =
- g_param_spec_uint64 ("id",
- P_("Tool ID"),
- P_("Tool ID"),
- 0, G_MAXUINT64, 0,
- CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
- props[PROP_AXES] =
- g_param_spec_flags ("axes",
- P_("Axes"),
- P_("Axes"),
- CLUTTER_TYPE_INPUT_AXIS_FLAGS,
- CLUTTER_INPUT_AXIS_FLAG_NONE,
- CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
-
- g_object_class_install_properties (gobject_class, PROP_LAST, props);
-}
-
-static void
-clutter_input_device_tool_init (ClutterInputDeviceTool *tool)
-{
-}
-
-/**
- * clutter_input_device_tool_get_serial:
- * @tool: a #ClutterInputDeviceTool
- *
- * Gets the serial of this tool, this value can be used to identify a
- * physical tool (eg. a tablet pen) across program executions.
- *
- * Returns: The serial ID for this tool
- *
- * Since: 1.28
- **/
-guint64
-clutter_input_device_tool_get_serial (ClutterInputDeviceTool *tool)
-{
- ClutterInputDeviceToolPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE_TOOL (tool), 0);
-
- priv = clutter_input_device_tool_get_instance_private (tool);
-
- return priv->serial;
-}
-
-
-/**
- * clutter_input_device_tool_get_tool_type:
- * @tool: a #ClutterInputDeviceTool
- *
- * Gets the tool type of this tool.
- *
- * Returns: The tool type of this tool
- *
- * Since: 1.28
- **/
-ClutterInputDeviceToolType
-clutter_input_device_tool_get_tool_type (ClutterInputDeviceTool *tool)
-{
- ClutterInputDeviceToolPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE_TOOL (tool), 0);
-
- priv = clutter_input_device_tool_get_instance_private (tool);
-
- return priv->type;
-}
-
-/**
- * clutter_input_device_tool_get_id:
- * @tool: a #ClutterInputDeviceTool
- *
- * Gets the ID of this tool, this value can be used to identify a
- * physical tool (eg. a tablet pen) across program executions.
- *
- * Returns: The tool ID for this tool
- **/
-guint64
-clutter_input_device_tool_get_id (ClutterInputDeviceTool *tool)
-{
- ClutterInputDeviceToolPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE_TOOL (tool), 0);
-
- priv = clutter_input_device_tool_get_instance_private (tool);
-
- return priv->id;
-}
-
-ClutterInputAxisFlags
-clutter_input_device_tool_get_axes (ClutterInputDeviceTool *tool)
-{
- ClutterInputDeviceToolPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE_TOOL (tool), 0);
-
- priv = clutter_input_device_tool_get_instance_private (tool);
-
- return priv->axes;
-}
diff --git a/clutter/clutter/clutter-input-device-tool.h b/clutter/clutter/clutter-input-device-tool.h
deleted file mode 100644
index df5c8201d..000000000
--- a/clutter/clutter/clutter-input-device-tool.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright © 2009, 2010, 2011 Intel Corp.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author: Carlos Garnacho <carlosg@gnome.org>
- */
-
-#ifndef __CLUTTER_INPUT_DEVICE_TOOL_H__
-#define __CLUTTER_INPUT_DEVICE_TOOL_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-types.h>
-#include "clutter-enum-types.h"
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_INPUT_DEVICE_TOOL (clutter_input_device_tool_get_type ())
-#define CLUTTER_INPUT_DEVICE_TOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_INPUT_DEVICE_TOOL, ClutterInputDeviceTool))
-#define CLUTTER_IS_INPUT_DEVICE_TOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_INPUT_DEVICE_TOOL))
-#define CLUTTER_INPUT_DEVICE_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_INPUT_DEVICE_TOOL, ClutterInputDeviceToolClass))
-#define CLUTTER_IS_INPUT_DEVICE_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_INPUT_DEVICE_TOOL))
-#define CLUTTER_INPUT_DEVICE_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_INPUT_DEVICE_TOOL, ClutterInputDeviceToolClass))
-
-typedef struct _ClutterInputDeviceToolClass ClutterInputDeviceToolClass;
-
-struct _ClutterInputDeviceTool
-{
- GObject parent_instance;
-};
-
-struct _ClutterInputDeviceToolClass
-{
- GObjectClass parent_class;
-};
-
-CLUTTER_EXPORT
-GType clutter_input_device_tool_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-guint64 clutter_input_device_tool_get_serial (ClutterInputDeviceTool *tool);
-
-CLUTTER_EXPORT
-ClutterInputDeviceToolType clutter_input_device_tool_get_tool_type (ClutterInputDeviceTool *tool);
-
-CLUTTER_EXPORT
-guint64 clutter_input_device_tool_get_id (ClutterInputDeviceTool *tool);
-
-CLUTTER_EXPORT
-ClutterInputAxisFlags clutter_input_device_tool_get_axes (ClutterInputDeviceTool *tool);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_INPUT_DEVICE_TOOL_H__ */
diff --git a/clutter/clutter/clutter-input-device.c b/clutter/clutter/clutter-input-device.c
deleted file mode 100644
index 3a31cdc80..000000000
--- a/clutter/clutter/clutter-input-device.c
+++ /dev/null
@@ -1,1030 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright © 2009, 2010, 2011 Intel Corp.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author: Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-input-device
- * @short_description: An input device managed by Clutter
- *
- * #ClutterInputDevice represents an input device known to Clutter.
- *
- * The #ClutterInputDevice class holds the state of the device, but
- * its contents are usually defined by the Clutter backend in use.
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-input-device.h"
-
-#include "clutter-actor-private.h"
-#include "clutter-debug.h"
-#include "clutter-enum-types.h"
-#include "clutter-event-private.h"
-#include "clutter-marshal.h"
-#include "clutter-private.h"
-#include "clutter-stage-private.h"
-#include "clutter-input-device-private.h"
-#include "clutter-input-device-tool.h"
-
-#include <math.h>
-
-enum
-{
- PROP_0,
-
- PROP_BACKEND,
-
- PROP_NAME,
-
- PROP_DEVICE_TYPE,
- PROP_SEAT,
- PROP_DEVICE_MODE,
-
- PROP_HAS_CURSOR,
-
- PROP_VENDOR_ID,
- PROP_PRODUCT_ID,
-
- PROP_N_STRIPS,
- PROP_N_RINGS,
- PROP_N_MODE_GROUPS,
- PROP_N_BUTTONS,
- PROP_DEVICE_NODE,
-
- PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST] = { NULL, };
-
-typedef struct _ClutterInputDevicePrivate ClutterInputDevicePrivate;
-
-struct _ClutterInputDevicePrivate
-{
- ClutterInputDeviceType device_type;
- ClutterInputMode device_mode;
-
- char *device_name;
-
- ClutterSeat *seat;
-
- ClutterBackend *backend;
-
- char *vendor_id;
- char *product_id;
- char *node_path;
-
- int n_rings;
- int n_strips;
- int n_mode_groups;
- int n_buttons;
-
- gboolean has_cursor;
-};
-
-G_DEFINE_TYPE_WITH_PRIVATE (ClutterInputDevice, clutter_input_device, G_TYPE_OBJECT);
-
-static void
-clutter_input_device_dispose (GObject *gobject)
-{
- ClutterInputDevice *device = CLUTTER_INPUT_DEVICE (gobject);
- ClutterInputDevicePrivate *priv =
- clutter_input_device_get_instance_private (device);
-
- g_clear_pointer (&priv->device_name, g_free);
- g_clear_pointer (&priv->vendor_id, g_free);
- g_clear_pointer (&priv->product_id, g_free);
- g_clear_pointer (&priv->node_path, g_free);
-
- if (device->accessibility_virtual_device)
- g_clear_object (&device->accessibility_virtual_device);
-
- G_OBJECT_CLASS (clutter_input_device_parent_class)->dispose (gobject);
-}
-
-static void
-clutter_input_device_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterInputDevice *self = CLUTTER_INPUT_DEVICE (gobject);
- ClutterInputDevicePrivate *priv =
- clutter_input_device_get_instance_private (self);
-
- switch (prop_id)
- {
- case PROP_DEVICE_TYPE:
- priv->device_type = g_value_get_enum (value);
- break;
-
- case PROP_SEAT:
- priv->seat = g_value_get_object (value);
- break;
-
- case PROP_DEVICE_MODE:
- priv->device_mode = g_value_get_enum (value);
- break;
-
- case PROP_BACKEND:
- priv->backend = g_value_get_object (value);
- break;
-
- case PROP_NAME:
- priv->device_name = g_value_dup_string (value);
- break;
-
- case PROP_HAS_CURSOR:
- priv->has_cursor = g_value_get_boolean (value);
- break;
-
- case PROP_VENDOR_ID:
- priv->vendor_id = g_value_dup_string (value);
- break;
-
- case PROP_PRODUCT_ID:
- priv->product_id = g_value_dup_string (value);
- break;
-
- case PROP_N_RINGS:
- priv->n_rings = g_value_get_int (value);
- break;
-
- case PROP_N_STRIPS:
- priv->n_strips = g_value_get_int (value);
- break;
-
- case PROP_N_MODE_GROUPS:
- priv->n_mode_groups = g_value_get_int (value);
- break;
-
- case PROP_N_BUTTONS:
- priv->n_buttons = g_value_get_int (value);
- break;
-
- case PROP_DEVICE_NODE:
- priv->node_path = g_value_dup_string (value);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_input_device_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterInputDevice *self = CLUTTER_INPUT_DEVICE (gobject);
- ClutterInputDevicePrivate *priv =
- clutter_input_device_get_instance_private (self);
-
- switch (prop_id)
- {
- case PROP_DEVICE_TYPE:
- g_value_set_enum (value, priv->device_type);
- break;
-
- case PROP_SEAT:
- g_value_set_object (value, priv->seat);
- break;
-
- case PROP_DEVICE_MODE:
- g_value_set_enum (value, priv->device_mode);
- break;
-
- case PROP_BACKEND:
- g_value_set_object (value, priv->backend);
- break;
-
- case PROP_NAME:
- g_value_set_string (value, priv->device_name);
- break;
-
- case PROP_HAS_CURSOR:
- g_value_set_boolean (value, priv->has_cursor);
- break;
-
- case PROP_VENDOR_ID:
- g_value_set_string (value, priv->vendor_id);
- break;
-
- case PROP_PRODUCT_ID:
- g_value_set_string (value, priv->product_id);
- break;
-
- case PROP_N_RINGS:
- g_value_set_int (value, priv->n_rings);
- break;
-
- case PROP_N_STRIPS:
- g_value_set_int (value, priv->n_strips);
- break;
-
- case PROP_N_MODE_GROUPS:
- g_value_set_int (value, priv->n_mode_groups);
- break;
-
- case PROP_N_BUTTONS:
- g_value_set_int (value, priv->n_buttons);
- break;
-
- case PROP_DEVICE_NODE:
- g_value_set_string (value, priv->node_path);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_input_device_class_init (ClutterInputDeviceClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- /**
- * ClutterInputDevice:name:
- *
- * The name of the device
- *
- * Since: 1.2
- */
- obj_props[PROP_NAME] =
- g_param_spec_string ("name",
- P_("Name"),
- P_("The name of the device"),
- NULL,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY);
-
- /**
- * ClutterInputDevice:device-type:
- *
- * The type of the device
- *
- * Since: 1.2
- */
- obj_props[PROP_DEVICE_TYPE] =
- g_param_spec_enum ("device-type",
- P_("Device Type"),
- P_("The type of the device"),
- CLUTTER_TYPE_INPUT_DEVICE_TYPE,
- CLUTTER_POINTER_DEVICE,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY);
-
- /**
- * ClutterInputDevice:seat:
- *
- * The #ClutterSeat instance which owns the device
- */
- obj_props[PROP_SEAT] =
- g_param_spec_object ("seat",
- P_("Seat"),
- P_("Seat"),
- CLUTTER_TYPE_SEAT,
- CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
-
- /**
- * ClutterInputDevice:mode:
- *
- * The mode of the device.
- *
- * Since: 1.6
- */
- obj_props[PROP_DEVICE_MODE] =
- g_param_spec_enum ("device-mode",
- P_("Device Mode"),
- P_("The mode of the device"),
- CLUTTER_TYPE_INPUT_MODE,
- CLUTTER_INPUT_MODE_FLOATING,
- CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
-
- /**
- * ClutterInputDevice:has-cursor:
- *
- * Whether the device has an on screen cursor following its movement.
- *
- * Since: 1.6
- */
- obj_props[PROP_HAS_CURSOR] =
- g_param_spec_boolean ("has-cursor",
- P_("Has Cursor"),
- P_("Whether the device has a cursor"),
- FALSE,
- CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
-
- /**
- * ClutterInputDevice:backend:
- *
- * The #ClutterBackend that created the device.
- *
- * Since: 1.6
- */
- obj_props[PROP_BACKEND] =
- g_param_spec_object ("backend",
- P_("Backend"),
- P_("The backend instance"),
- CLUTTER_TYPE_BACKEND,
- CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
-
- /**
- * ClutterInputDevice:vendor-id:
- *
- * Vendor ID of this device.
- *
- * Since: 1.22
- */
- obj_props[PROP_VENDOR_ID] =
- g_param_spec_string ("vendor-id",
- P_("Vendor ID"),
- P_("Vendor ID"),
- NULL,
- CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
-
- /**
- * ClutterInputDevice:product-id:
- *
- * Product ID of this device.
- *
- * Since: 1.22
- */
- obj_props[PROP_PRODUCT_ID] =
- g_param_spec_string ("product-id",
- P_("Product ID"),
- P_("Product ID"),
- NULL,
- CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
-
- obj_props[PROP_N_RINGS] =
- g_param_spec_int ("n-rings",
- P_("Number of rings"),
- P_("Number of rings (circular sliders) in this device"),
- 0, G_MAXINT, 0,
- CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
-
- obj_props[PROP_N_STRIPS] =
- g_param_spec_int ("n-strips",
- P_("Number of strips"),
- P_("Number of strips (linear sliders) in this device"),
- 0, G_MAXINT, 0,
- CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
-
- obj_props[PROP_N_MODE_GROUPS] =
- g_param_spec_int ("n-mode-groups",
- P_("Number of mode groups"),
- P_("Number of mode groups"),
- 0, G_MAXINT, 0,
- CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
-
- obj_props[PROP_N_BUTTONS] =
- g_param_spec_int ("n-buttons",
- P_("Number of buttons"),
- P_("Number of buttons"),
- 0, G_MAXINT, 0,
- CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
-
- obj_props[PROP_DEVICE_NODE] =
- g_param_spec_string ("device-node",
- P_("Device node path"),
- P_("Device node path"),
- NULL,
- CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
-
- gobject_class->dispose = clutter_input_device_dispose;
- gobject_class->set_property = clutter_input_device_set_property;
- gobject_class->get_property = clutter_input_device_get_property;
- g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
-}
-
-static void
-clutter_input_device_init (ClutterInputDevice *self)
-{
- ClutterInputDevicePrivate *priv =
- clutter_input_device_get_instance_private (self);
-
- priv->device_type = CLUTTER_POINTER_DEVICE;
-
- self->click_count = 0;
-
- self->previous_time = CLUTTER_CURRENT_TIME;
- self->previous_x = -1;
- self->previous_y = -1;
- self->current_button_number = self->previous_button_number = -1;
-}
-
-/**
- * clutter_input_device_get_device_type:
- * @device: a #ClutterInputDevice
- *
- * Retrieves the type of @device
- *
- * Return value: the type of the device
- *
- * Since: 1.0
- */
-ClutterInputDeviceType
-clutter_input_device_get_device_type (ClutterInputDevice *device)
-{
- ClutterInputDevicePrivate *priv =
- clutter_input_device_get_instance_private (device);
-
- g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device),
- CLUTTER_POINTER_DEVICE);
-
- return priv->device_type;
-}
-
-/**
- * clutter_input_device_get_device_name:
- * @device: a #ClutterInputDevice
- *
- * Retrieves the name of the @device
- *
- * Return value: the name of the device, or %NULL. The returned string
- * is owned by the #ClutterInputDevice and should never be modified
- * or freed
- *
- * Since: 1.2
- */
-const gchar *
-clutter_input_device_get_device_name (ClutterInputDevice *device)
-{
- ClutterInputDevicePrivate *priv =
- clutter_input_device_get_instance_private (device);
-
- g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
-
- return priv->device_name;
-}
-
-/**
- * clutter_input_device_get_has_cursor:
- * @device: a #ClutterInputDevice
- *
- * Retrieves whether @device has a pointer that follows the
- * device motion.
- *
- * Return value: %TRUE if the device has a cursor
- *
- * Since: 1.6
- */
-gboolean
-clutter_input_device_get_has_cursor (ClutterInputDevice *device)
-{
- ClutterInputDevicePrivate *priv =
- clutter_input_device_get_instance_private (device);
-
- g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE);
-
- return priv->has_cursor;
-}
-
-/**
- * clutter_input_device_get_device_mode:
- * @device: a #ClutterInputDevice
- *
- * Retrieves the #ClutterInputMode of @device.
- *
- * Return value: the device mode
- *
- * Since: 1.6
- */
-ClutterInputMode
-clutter_input_device_get_device_mode (ClutterInputDevice *device)
-{
- ClutterInputDevicePrivate *priv =
- clutter_input_device_get_instance_private (device);
-
- g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device),
- CLUTTER_INPUT_MODE_FLOATING);
-
- return priv->device_mode;
-}
-
-static void
-on_grab_actor_destroy (ClutterActor *actor,
- ClutterInputDevice *device)
-{
- ClutterInputDevicePrivate *priv =
- clutter_input_device_get_instance_private (device);
-
- switch (priv->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;
- ClutterInputDevicePrivate *priv =
- clutter_input_device_get_instance_private (device);
-
- g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
- g_return_if_fail (CLUTTER_IS_ACTOR (actor));
-
- switch (priv->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;
- ClutterInputDevicePrivate *priv =
- clutter_input_device_get_instance_private (device);
-
- g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
-
- switch (priv->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)
-{
- ClutterInputDevicePrivate *priv =
- clutter_input_device_get_instance_private (device);
-
- g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
-
- switch (priv->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)
-{
- ClutterEventSequence *sequence =
- g_hash_table_lookup (device->inv_sequence_grab_actors, actor);
-
- if (sequence != NULL)
- {
- g_hash_table_remove (device->sequence_grab_actors, sequence);
- g_hash_table_remove (device->inv_sequence_grab_actors, actor);
- }
-}
-
-/**
- * clutter_input_device_sequence_grab:
- * @device: a #ClutterInputDevice
- * @sequence: a #ClutterEventSequence
- * @actor: a #ClutterActor
- *
- * Acquires a grab on @actor for the given @device and the given touch
- * @sequence.
- *
- * Any touch event coming from @device and from @sequence will be
- * delivered to @actor, bypassing the usual event delivery mechanism,
- * until the grab is released by calling
- * clutter_input_device_sequence_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.
- *
- * Since: 1.12
- */
-void
-clutter_input_device_sequence_grab (ClutterInputDevice *device,
- ClutterEventSequence *sequence,
- ClutterActor *actor)
-{
- ClutterActor *grab_actor;
-
- g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
- g_return_if_fail (CLUTTER_IS_ACTOR (actor));
-
- if (device->sequence_grab_actors == NULL)
- {
- grab_actor = NULL;
- device->sequence_grab_actors = g_hash_table_new (NULL, NULL);
- device->inv_sequence_grab_actors = g_hash_table_new (NULL, NULL);
- }
- else
- {
- grab_actor = g_hash_table_lookup (device->sequence_grab_actors, sequence);
- }
-
- if (grab_actor != NULL)
- {
- g_signal_handlers_disconnect_by_func (grab_actor,
- G_CALLBACK (on_grab_sequence_actor_destroy),
- device);
- g_hash_table_remove (device->sequence_grab_actors, sequence);
- g_hash_table_remove (device->inv_sequence_grab_actors, grab_actor);
- }
-
- g_hash_table_insert (device->sequence_grab_actors, sequence, actor);
- g_hash_table_insert (device->inv_sequence_grab_actors, actor, sequence);
- g_signal_connect (actor,
- "destroy",
- G_CALLBACK (on_grab_sequence_actor_destroy),
- device);
-}
-
-/**
- * clutter_input_device_sequence_ungrab:
- * @device: a #ClutterInputDevice
- * @sequence: a #ClutterEventSequence
- *
- * Releases the grab on the @device for the given @sequence, if one is
- * in place.
- *
- * Since: 1.12
- */
-void
-clutter_input_device_sequence_ungrab (ClutterInputDevice *device,
- ClutterEventSequence *sequence)
-{
- ClutterActor *grab_actor;
-
- g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
-
- if (device->sequence_grab_actors == NULL)
- return;
-
- grab_actor = g_hash_table_lookup (device->sequence_grab_actors, sequence);
-
- if (grab_actor == NULL)
- return;
-
- g_signal_handlers_disconnect_by_func (grab_actor,
- G_CALLBACK (on_grab_sequence_actor_destroy),
- device);
- g_hash_table_remove (device->sequence_grab_actors, sequence);
- g_hash_table_remove (device->inv_sequence_grab_actors, grab_actor);
-
- if (g_hash_table_size (device->sequence_grab_actors) == 0)
- {
- g_hash_table_destroy (device->sequence_grab_actors);
- device->sequence_grab_actors = NULL;
- g_hash_table_destroy (device->inv_sequence_grab_actors);
- device->inv_sequence_grab_actors = NULL;
- }
-}
-
-/**
- * clutter_input_device_sequence_get_grabbed_actor:
- * @device: a #ClutterInputDevice
- * @sequence: a #ClutterEventSequence
- *
- * Retrieves a pointer to the #ClutterActor currently grabbing the
- * touch events coming from @device given the @sequence.
- *
- * Return value: (transfer none): a #ClutterActor, or %NULL
- *
- * Since: 1.12
- */
-ClutterActor *
-clutter_input_device_sequence_get_grabbed_actor (ClutterInputDevice *device,
- ClutterEventSequence *sequence)
-{
- g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
-
- if (device->sequence_grab_actors == NULL)
- return NULL;
-
- return g_hash_table_lookup (device->sequence_grab_actors, sequence);
-}
-
-/**
- * clutter_input_device_get_vendor_id:
- * @device: a physical #ClutterInputDevice
- *
- * Gets the vendor ID of this device.
- *
- * Returns: the vendor ID
- *
- * Since: 1.22
- */
-const gchar *
-clutter_input_device_get_vendor_id (ClutterInputDevice *device)
-{
- ClutterInputDevicePrivate *priv =
- clutter_input_device_get_instance_private (device);
-
- g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
- g_return_val_if_fail (clutter_input_device_get_device_mode (device) != CLUTTER_INPUT_MODE_LOGICAL, NULL);
-
- return priv->vendor_id;
-}
-
-/**
- * clutter_input_device_get_product_id:
- * @device: a physical #ClutterInputDevice
- *
- * Gets the product ID of this device.
- *
- * Returns: the product ID
- *
- * Since: 1.22
- */
-const gchar *
-clutter_input_device_get_product_id (ClutterInputDevice *device)
-{
- ClutterInputDevicePrivate *priv =
- clutter_input_device_get_instance_private (device);
-
- g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
- g_return_val_if_fail (clutter_input_device_get_device_mode (device) != CLUTTER_INPUT_MODE_LOGICAL, NULL);
-
- return priv->product_id;
-}
-
-gint
-clutter_input_device_get_n_rings (ClutterInputDevice *device)
-{
- ClutterInputDevicePrivate *priv =
- clutter_input_device_get_instance_private (device);
-
- g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), 0);
-
- return priv->n_rings;
-}
-
-gint
-clutter_input_device_get_n_strips (ClutterInputDevice *device)
-{
- ClutterInputDevicePrivate *priv =
- clutter_input_device_get_instance_private (device);
-
- g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), 0);
-
- return priv->n_strips;
-}
-
-gint
-clutter_input_device_get_n_mode_groups (ClutterInputDevice *device)
-{
- ClutterInputDevicePrivate *priv =
- clutter_input_device_get_instance_private (device);
-
- g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), 0);
- g_return_val_if_fail (clutter_input_device_get_device_type (device) ==
- CLUTTER_PAD_DEVICE, 0);
-
- return priv->n_mode_groups;
-}
-
-gint
-clutter_input_device_get_n_buttons (ClutterInputDevice *device)
-{
- ClutterInputDevicePrivate *priv =
- clutter_input_device_get_instance_private (device);
-
- g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), 0);
- g_return_val_if_fail (clutter_input_device_get_device_type (device) ==
- CLUTTER_PAD_DEVICE, 0);
-
- return priv->n_buttons;
-}
-
-gint
-clutter_input_device_get_group_n_modes (ClutterInputDevice *device,
- gint group)
-{
- ClutterInputDeviceClass *device_class;
-
- g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), 0);
- g_return_val_if_fail (clutter_input_device_get_device_type (device) ==
- CLUTTER_PAD_DEVICE, 0);
- g_return_val_if_fail (group >= 0, 0);
-
- device_class = CLUTTER_INPUT_DEVICE_GET_CLASS (device);
-
- if (device_class->get_group_n_modes)
- return device_class->get_group_n_modes (device, group);
-
- return 0;
-}
-
-gboolean
-clutter_input_device_is_mode_switch_button (ClutterInputDevice *device,
- guint group,
- guint button)
-{
- ClutterInputDeviceClass *device_class;
-
- g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE);
- g_return_val_if_fail (clutter_input_device_get_device_type (device) ==
- CLUTTER_PAD_DEVICE, FALSE);
-
- device_class = CLUTTER_INPUT_DEVICE_GET_CLASS (device);
-
- if (device_class->is_mode_switch_button)
- return device_class->is_mode_switch_button (device, group, button);
-
- return FALSE;
-}
-
-gint
-clutter_input_device_get_mode_switch_button_group (ClutterInputDevice *device,
- guint button)
-{
- ClutterInputDevicePrivate *priv =
- clutter_input_device_get_instance_private (device);
- gint group;
-
- g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), -1);
- g_return_val_if_fail (clutter_input_device_get_device_type (device) ==
- CLUTTER_PAD_DEVICE, -1);
-
- for (group = 0; group < priv->n_mode_groups; group++)
- {
- if (clutter_input_device_is_mode_switch_button (device, group, button))
- return group;
- }
-
- return -1;
-}
-
-int
-clutter_input_device_get_pad_feature_group (ClutterInputDevice *device,
- ClutterInputDevicePadFeature feature,
- int n_feature)
-{
- ClutterInputDeviceClass *device_class;
-
- device_class = CLUTTER_INPUT_DEVICE_GET_CLASS (device);
- if (!device_class->get_pad_feature_group)
- return 0;
-
- return CLUTTER_INPUT_DEVICE_GET_CLASS (device)->get_pad_feature_group (device,
- feature,
- n_feature);
-}
-
-const gchar *
-clutter_input_device_get_device_node (ClutterInputDevice *device)
-{
- ClutterInputDevicePrivate *priv =
- clutter_input_device_get_instance_private (device);
-
- g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
-
- return priv->node_path;
-}
-
-gboolean
-clutter_input_device_is_grouped (ClutterInputDevice *device,
- ClutterInputDevice *other_device)
-{
- g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE);
- g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (other_device), FALSE);
-
- return CLUTTER_INPUT_DEVICE_GET_CLASS (device)->is_grouped (device, other_device);
-}
-
-/**
- * clutter_input_device_get_seat:
- * @device: a #ClutterInputDevice
- *
- * Returns the seat the device belongs to
- *
- * Returns: (transfer none): the device seat
- **/
-ClutterSeat *
-clutter_input_device_get_seat (ClutterInputDevice *device)
-{
- ClutterInputDevicePrivate *priv =
- clutter_input_device_get_instance_private (device);
-
- g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
-
- return priv->seat;
-}
diff --git a/clutter/clutter/clutter-input-device.h b/clutter/clutter/clutter-input-device.h
deleted file mode 100644
index 0a6a1c0ed..000000000
--- a/clutter/clutter/clutter-input-device.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright © 2009, 2010, 2011 Intel Corp.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author: Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_INPUT_DEVICE_H__
-#define __CLUTTER_INPUT_DEVICE_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-backend.h>
-#include <clutter/clutter-types.h>
-#include <clutter/clutter-seat.h>
-
-G_BEGIN_DECLS
-
-struct _ClutterInputDeviceClass
-{
- GObjectClass parent_class;
-
- gboolean (* is_mode_switch_button) (ClutterInputDevice *device,
- guint group,
- guint button);
- gint (* get_group_n_modes) (ClutterInputDevice *device,
- gint group);
-
- gboolean (* is_grouped) (ClutterInputDevice *device,
- ClutterInputDevice *other_device);
-
- int (* get_pad_feature_group) (ClutterInputDevice *device,
- ClutterInputDevicePadFeature feature,
- int n_feature);
-};
-
-#define CLUTTER_TYPE_INPUT_DEVICE (clutter_input_device_get_type ())
-#define CLUTTER_INPUT_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_INPUT_DEVICE, ClutterInputDevice))
-#define CLUTTER_IS_INPUT_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_INPUT_DEVICE))
-#define CLUTTER_INPUT_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_INPUT_DEVICE, ClutterInputDeviceClass))
-#define CLUTTER_IS_INPUT_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_INPUT_DEVICE))
-#define CLUTTER_INPUT_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_INPUT_DEVICE, ClutterInputDeviceClass))
-
-/**
- * ClutterInputDevice:
- *
- * Generic representation of an input device. The actual contents of this
- * structure depend on the backend used.
- */
-typedef struct _ClutterInputDeviceClass ClutterInputDeviceClass;
-
-CLUTTER_EXPORT
-GType clutter_input_device_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterInputDeviceType clutter_input_device_get_device_type (ClutterInputDevice *device);
-
-CLUTTER_EXPORT
-const gchar * clutter_input_device_get_device_name (ClutterInputDevice *device);
-CLUTTER_EXPORT
-ClutterInputMode clutter_input_device_get_device_mode (ClutterInputDevice *device);
-CLUTTER_EXPORT
-gboolean clutter_input_device_get_has_cursor (ClutterInputDevice *device);
-
-CLUTTER_EXPORT
-void clutter_input_device_grab (ClutterInputDevice *device,
- ClutterActor *actor);
-CLUTTER_EXPORT
-void clutter_input_device_ungrab (ClutterInputDevice *device);
-CLUTTER_EXPORT
-ClutterActor * clutter_input_device_get_grabbed_actor (ClutterInputDevice *device);
-
-CLUTTER_EXPORT
-void clutter_input_device_sequence_grab (ClutterInputDevice *device,
- ClutterEventSequence *sequence,
- ClutterActor *actor);
-CLUTTER_EXPORT
-void clutter_input_device_sequence_ungrab (ClutterInputDevice *device,
- ClutterEventSequence *sequence);
-CLUTTER_EXPORT
-ClutterActor * clutter_input_device_sequence_get_grabbed_actor (ClutterInputDevice *device,
- ClutterEventSequence *sequence);
-
-CLUTTER_EXPORT
-const gchar * clutter_input_device_get_vendor_id (ClutterInputDevice *device);
-CLUTTER_EXPORT
-const gchar * clutter_input_device_get_product_id (ClutterInputDevice *device);
-
-CLUTTER_EXPORT
-gint clutter_input_device_get_n_rings (ClutterInputDevice *device);
-CLUTTER_EXPORT
-gint clutter_input_device_get_n_strips (ClutterInputDevice *device);
-CLUTTER_EXPORT
-gint clutter_input_device_get_n_mode_groups (ClutterInputDevice *device);
-CLUTTER_EXPORT
-int clutter_input_device_get_n_buttons (ClutterInputDevice *device);
-
-
-CLUTTER_EXPORT
-gint clutter_input_device_get_group_n_modes (ClutterInputDevice *device,
- gint group);
-
-CLUTTER_EXPORT
-gboolean clutter_input_device_is_mode_switch_button (ClutterInputDevice *device,
- guint group,
- guint button);
-CLUTTER_EXPORT
-gint clutter_input_device_get_mode_switch_button_group (ClutterInputDevice *device,
- guint button);
-
-CLUTTER_EXPORT
-const gchar * clutter_input_device_get_device_node (ClutterInputDevice *device);
-
-CLUTTER_EXPORT
-gboolean clutter_input_device_is_grouped (ClutterInputDevice *device,
- ClutterInputDevice *other_device);
-CLUTTER_EXPORT
-ClutterSeat * clutter_input_device_get_seat (ClutterInputDevice *device);
-
-CLUTTER_EXPORT
-int clutter_input_device_get_pad_feature_group (ClutterInputDevice *device,
- ClutterInputDevicePadFeature feature,
- int n_feature);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_INPUT_DEVICE_H__ */
diff --git a/clutter/clutter/clutter-input-focus-private.h b/clutter/clutter/clutter-input-focus-private.h
deleted file mode 100644
index ccde45d0e..000000000
--- a/clutter/clutter/clutter-input-focus-private.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2017,2018 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: Carlos Garnacho <carlosg@gnome.org>
- */
-
-#ifndef __CLUTTER_INPUT_FOCUS_PRIVATE_H__
-#define __CLUTTER_INPUT_FOCUS_PRIVATE_H__
-
-void clutter_input_focus_focus_in (ClutterInputFocus *focus,
- ClutterInputMethod *method);
-void clutter_input_focus_focus_out (ClutterInputFocus *focus);
-
-void clutter_input_focus_commit (ClutterInputFocus *focus,
- const gchar *text);
-void clutter_input_focus_delete_surrounding (ClutterInputFocus *focus,
- int offset,
- guint len);
-void clutter_input_focus_request_surrounding (ClutterInputFocus *focus);
-
-void clutter_input_focus_set_preedit_text (ClutterInputFocus *focus,
- const gchar *preedit,
- guint cursor);
-
-#endif /* __CLUTTER_INPUT_FOCUS_PRIVATE_H__ */
diff --git a/clutter/clutter/clutter-input-focus.c b/clutter/clutter/clutter-input-focus.c
deleted file mode 100644
index 2aea51e24..000000000
--- a/clutter/clutter/clutter-input-focus.c
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * Copyright (C) 2017,2018 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: Carlos Garnacho <carlosg@gnome.org>
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter/clutter-input-focus.h"
-#include "clutter/clutter-input-focus-private.h"
-#include "clutter/clutter-input-method-private.h"
-
-typedef struct _ClutterInputFocusPrivate ClutterInputFocusPrivate;
-
-struct _ClutterInputFocusPrivate
-{
- ClutterInputMethod *im;
-};
-
-G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterInputFocus, clutter_input_focus, G_TYPE_OBJECT)
-
-static void
-clutter_input_focus_real_focus_in (ClutterInputFocus *focus,
- ClutterInputMethod *im)
-{
- ClutterInputFocusPrivate *priv;
-
- priv = clutter_input_focus_get_instance_private (focus);
- priv->im = im;
-}
-
-static void
-clutter_input_focus_real_focus_out (ClutterInputFocus *focus)
-{
- ClutterInputFocusPrivate *priv;
-
- priv = clutter_input_focus_get_instance_private (focus);
- priv->im = NULL;
-}
-
-static void
-clutter_input_focus_class_init (ClutterInputFocusClass *klass)
-{
- klass->focus_in = clutter_input_focus_real_focus_in;
- klass->focus_out = clutter_input_focus_real_focus_out;
-}
-
-static void
-clutter_input_focus_init (ClutterInputFocus *focus)
-{
-}
-
-gboolean
-clutter_input_focus_is_focused (ClutterInputFocus *focus)
-{
- ClutterInputFocusPrivate *priv;
-
- priv = clutter_input_focus_get_instance_private (focus);
-
- return !!priv->im;
-}
-
-void
-clutter_input_focus_reset (ClutterInputFocus *focus)
-{
- ClutterInputFocusPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_INPUT_FOCUS (focus));
- g_return_if_fail (clutter_input_focus_is_focused (focus));
-
- priv = clutter_input_focus_get_instance_private (focus);
-
- clutter_input_method_reset (priv->im);
-}
-
-void
-clutter_input_focus_set_cursor_location (ClutterInputFocus *focus,
- const graphene_rect_t *rect)
-{
- ClutterInputFocusPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_INPUT_FOCUS (focus));
- g_return_if_fail (clutter_input_focus_is_focused (focus));
-
- priv = clutter_input_focus_get_instance_private (focus);
-
- clutter_input_method_set_cursor_location (priv->im, rect);
-}
-
-void
-clutter_input_focus_set_surrounding (ClutterInputFocus *focus,
- const gchar *text,
- guint cursor,
- guint anchor)
-{
- ClutterInputFocusPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_INPUT_FOCUS (focus));
- g_return_if_fail (clutter_input_focus_is_focused (focus));
-
- priv = clutter_input_focus_get_instance_private (focus);
-
- clutter_input_method_set_surrounding (priv->im, text, cursor, anchor);
-}
-
-void
-clutter_input_focus_set_content_hints (ClutterInputFocus *focus,
- ClutterInputContentHintFlags hints)
-{
- ClutterInputFocusPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_INPUT_FOCUS (focus));
- g_return_if_fail (clutter_input_focus_is_focused (focus));
-
- priv = clutter_input_focus_get_instance_private (focus);
-
- clutter_input_method_set_content_hints (priv->im, hints);
-}
-
-void
-clutter_input_focus_set_content_purpose (ClutterInputFocus *focus,
- ClutterInputContentPurpose purpose)
-{
- ClutterInputFocusPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_INPUT_FOCUS (focus));
- g_return_if_fail (clutter_input_focus_is_focused (focus));
-
- priv = clutter_input_focus_get_instance_private (focus);
-
- clutter_input_method_set_content_purpose (priv->im, purpose);
-}
-
-gboolean
-clutter_input_focus_filter_event (ClutterInputFocus *focus,
- const ClutterEvent *event)
-{
- ClutterInputFocusPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_INPUT_FOCUS (focus), FALSE);
- g_return_val_if_fail (clutter_input_focus_is_focused (focus), FALSE);
-
- priv = clutter_input_focus_get_instance_private (focus);
-
- if (event->type == CLUTTER_KEY_PRESS ||
- event->type == CLUTTER_KEY_RELEASE)
- {
- return clutter_input_method_filter_key_event (priv->im, &event->key);
- }
- else if (event->type == CLUTTER_IM_COMMIT)
- {
- clutter_input_focus_commit (focus, event->im.text);
- return TRUE;
- }
- else if (event->type == CLUTTER_IM_DELETE)
- {
- clutter_input_focus_delete_surrounding (focus, event->im.offset,
- event->im.len);
- return TRUE;
- }
- else if (event->type == CLUTTER_IM_PREEDIT)
- {
- clutter_input_focus_set_preedit_text (focus, event->im.text,
- event->im.offset);
- return TRUE;
- }
-
- return FALSE;
-}
-
-void
-clutter_input_focus_set_can_show_preedit (ClutterInputFocus *focus,
- gboolean can_show_preedit)
-{
- ClutterInputFocusPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_INPUT_FOCUS (focus));
- g_return_if_fail (clutter_input_focus_is_focused (focus));
-
- priv = clutter_input_focus_get_instance_private (focus);
-
- clutter_input_method_set_can_show_preedit (priv->im, can_show_preedit);
-}
-
-void
-clutter_input_focus_set_input_panel_state (ClutterInputFocus *focus,
- ClutterInputPanelState state)
-{
- ClutterInputFocusPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_INPUT_FOCUS (focus));
- g_return_if_fail (clutter_input_focus_is_focused (focus));
-
- priv = clutter_input_focus_get_instance_private (focus);
-
- clutter_input_method_set_input_panel_state (priv->im, state);
-}
-
-void
-clutter_input_focus_focus_in (ClutterInputFocus *focus,
- ClutterInputMethod *im)
-{
- g_return_if_fail (CLUTTER_IS_INPUT_FOCUS (focus));
- g_return_if_fail (CLUTTER_IS_INPUT_METHOD (im));
-
- CLUTTER_INPUT_FOCUS_GET_CLASS (focus)->focus_in (focus, im);
-}
-
-void
-clutter_input_focus_focus_out (ClutterInputFocus *focus)
-{
- g_return_if_fail (CLUTTER_IS_INPUT_FOCUS (focus));
-
- CLUTTER_INPUT_FOCUS_GET_CLASS (focus)->focus_out (focus);
-}
-
-void
-clutter_input_focus_commit (ClutterInputFocus *focus,
- const gchar *text)
-{
- g_return_if_fail (CLUTTER_IS_INPUT_FOCUS (focus));
-
- CLUTTER_INPUT_FOCUS_GET_CLASS (focus)->commit_text (focus, text);
-}
-
-void
-clutter_input_focus_delete_surrounding (ClutterInputFocus *focus,
- int offset,
- guint len)
-{
- g_return_if_fail (CLUTTER_IS_INPUT_FOCUS (focus));
-
- CLUTTER_INPUT_FOCUS_GET_CLASS (focus)->delete_surrounding (focus, offset, len);
-}
-
-void
-clutter_input_focus_request_surrounding (ClutterInputFocus *focus)
-{
- g_return_if_fail (CLUTTER_IS_INPUT_FOCUS (focus));
-
- CLUTTER_INPUT_FOCUS_GET_CLASS (focus)->request_surrounding (focus);
-}
-
-void
-clutter_input_focus_set_preedit_text (ClutterInputFocus *focus,
- const gchar *preedit,
- guint cursor)
-{
- g_return_if_fail (CLUTTER_IS_INPUT_FOCUS (focus));
-
- CLUTTER_INPUT_FOCUS_GET_CLASS (focus)->set_preedit_text (focus, preedit, cursor);
-}
diff --git a/clutter/clutter/clutter-input-focus.h b/clutter/clutter/clutter-input-focus.h
deleted file mode 100644
index 77f5d9076..000000000
--- a/clutter/clutter/clutter-input-focus.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2017,2018 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: Carlos Garnacho <carlosg@gnome.org>
- */
-
-#ifndef __CLUTTER_INPUT_FOCUS_H__
-#define __CLUTTER_INPUT_FOCUS_H__
-
-#include <clutter/clutter.h>
-
-#define CLUTTER_TYPE_INPUT_FOCUS (clutter_input_focus_get_type ())
-
-CLUTTER_EXPORT
-G_DECLARE_DERIVABLE_TYPE (ClutterInputFocus, clutter_input_focus,
- CLUTTER, INPUT_FOCUS, GObject)
-
-struct _ClutterInputFocusClass
-{
- GObjectClass parent_class;
- GTypeInterface iface;
-
- void (* focus_in) (ClutterInputFocus *focus,
- ClutterInputMethod *input_method);
- void (* focus_out) (ClutterInputFocus *focus);
-
- void (* request_surrounding) (ClutterInputFocus *focus);
- void (* delete_surrounding) (ClutterInputFocus *focus,
- int offset,
- guint len);
- void (* commit_text) (ClutterInputFocus *focus,
- const gchar *text);
-
- void (* set_preedit_text) (ClutterInputFocus *focus,
- const gchar *preedit,
- guint cursor);
-};
-
-CLUTTER_EXPORT
-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);
-
-CLUTTER_EXPORT
-void clutter_input_focus_set_surrounding (ClutterInputFocus *focus,
- const gchar *text,
- guint cursor,
- guint anchor);
-CLUTTER_EXPORT
-void clutter_input_focus_set_content_hints (ClutterInputFocus *focus,
- ClutterInputContentHintFlags hint);
-CLUTTER_EXPORT
-void clutter_input_focus_set_content_purpose (ClutterInputFocus *focus,
- ClutterInputContentPurpose purpose);
-CLUTTER_EXPORT
-gboolean clutter_input_focus_filter_event (ClutterInputFocus *focus,
- const ClutterEvent *event);
-CLUTTER_EXPORT
-void clutter_input_focus_set_can_show_preedit (ClutterInputFocus *focus,
- gboolean can_show_preedit);
-CLUTTER_EXPORT
-void clutter_input_focus_set_input_panel_state (ClutterInputFocus *focus,
- ClutterInputPanelState state);
-
-#endif /* __CLUTTER_INPUT_FOCUS_H__ */
diff --git a/clutter/clutter/clutter-input-method-private.h b/clutter/clutter/clutter-input-method-private.h
deleted file mode 100644
index 61e575e7e..000000000
--- a/clutter/clutter/clutter-input-method-private.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2017,2018 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: Carlos Garnacho <carlosg@gnome.org>
- */
-
-#ifndef __CLUTTER_INPUT_METHOD_PRIVATE_H__
-#define __CLUTTER_INPUT_METHOD_PRIVATE_H__
-
-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_surrounding (ClutterInputMethod *method,
- const gchar *text,
- guint cursor,
- guint anchor);
-void clutter_input_method_set_content_hints (ClutterInputMethod *method,
- ClutterInputContentHintFlags hints);
-void clutter_input_method_set_content_purpose (ClutterInputMethod *method,
- ClutterInputContentPurpose purpose);
-void clutter_input_method_set_can_show_preedit (ClutterInputMethod *method,
- gboolean can_show_preedit);
-gboolean clutter_input_method_filter_key_event (ClutterInputMethod *method,
- const ClutterKeyEvent *key);
-
-void clutter_input_method_toggle_input_panel (ClutterInputMethod *method);
-
-#endif /* __CLUTTER_INPUT_METHOD_PRIVATE_H__ */
diff --git a/clutter/clutter/clutter-input-method.c b/clutter/clutter/clutter-input-method.c
deleted file mode 100644
index ff62925a5..000000000
--- a/clutter/clutter/clutter-input-method.c
+++ /dev/null
@@ -1,507 +0,0 @@
-/*
- * Copyright (C) 2017,2018 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: Carlos Garnacho <carlosg@gnome.org>
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-private.h"
-#include "clutter/clutter-input-device-private.h"
-#include "clutter/clutter-input-method.h"
-#include "clutter/clutter-input-method-private.h"
-#include "clutter/clutter-input-focus-private.h"
-
-typedef struct _ClutterInputMethodPrivate ClutterInputMethodPrivate;
-
-struct _ClutterInputMethodPrivate
-{
- ClutterInputFocus *focus;
- ClutterInputContentHintFlags content_hints;
- ClutterInputContentPurpose content_purpose;
- gboolean can_show_preedit;
-};
-
-enum
-{
- COMMIT,
- DELETE_SURROUNDING,
- REQUEST_SURROUNDING,
- INPUT_PANEL_STATE,
- CURSOR_LOCATION_CHANGED,
- N_SIGNALS,
-};
-
-enum
-{
- PROP_0,
- PROP_CONTENT_HINTS,
- PROP_CONTENT_PURPOSE,
- PROP_CAN_SHOW_PREEDIT,
- N_PROPS
-};
-
-static guint signals[N_SIGNALS] = { 0 };
-static GParamSpec *pspecs[N_PROPS] = { 0 };
-
-G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterInputMethod, clutter_input_method, G_TYPE_OBJECT)
-
-static void
-set_content_hints (ClutterInputMethod *im,
- ClutterInputContentHintFlags content_hints)
-{
- ClutterInputMethodPrivate *priv;
-
- priv = clutter_input_method_get_instance_private (im);
- priv->content_hints = content_hints;
- CLUTTER_INPUT_METHOD_GET_CLASS (im)->update_content_hints (im, content_hints);
-}
-
-static void
-set_content_purpose (ClutterInputMethod *im,
- ClutterInputContentPurpose content_purpose)
-{
- ClutterInputMethodPrivate *priv;
-
- priv = clutter_input_method_get_instance_private (im);
- priv->content_purpose = content_purpose;
- CLUTTER_INPUT_METHOD_GET_CLASS (im)->update_content_purpose (im,
- content_purpose);
-}
-
-static void
-set_can_show_preedit (ClutterInputMethod *im,
- gboolean can_show_preedit)
-{
- ClutterInputMethodPrivate *priv;
-
- priv = clutter_input_method_get_instance_private (im);
- priv->can_show_preedit = can_show_preedit;
-}
-
-static void
-clutter_input_method_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- switch (prop_id)
- {
- case PROP_CONTENT_HINTS:
- set_content_hints (CLUTTER_INPUT_METHOD (object),
- g_value_get_flags (value));
- break;
- case PROP_CONTENT_PURPOSE:
- set_content_purpose (CLUTTER_INPUT_METHOD (object),
- g_value_get_enum (value));
- break;
- case PROP_CAN_SHOW_PREEDIT:
- set_can_show_preedit (CLUTTER_INPUT_METHOD (object),
- g_value_get_boolean (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_input_method_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterInputMethodPrivate *priv;
- ClutterInputMethod *im;
-
- im = CLUTTER_INPUT_METHOD (object);
- priv = clutter_input_method_get_instance_private (im);
-
- switch (prop_id)
- {
- case PROP_CONTENT_HINTS:
- g_value_set_flags (value, priv->content_hints);
- break;
- case PROP_CONTENT_PURPOSE:
- g_value_set_enum (value, priv->content_purpose);
- break;
- case PROP_CAN_SHOW_PREEDIT:
- g_value_set_boolean (value, priv->can_show_preedit);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_input_method_class_init (ClutterInputMethodClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->set_property = clutter_input_method_set_property;
- object_class->get_property = clutter_input_method_get_property;
-
- signals[COMMIT] =
- g_signal_new ("commit",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, NULL,
- G_TYPE_NONE, 1, G_TYPE_STRING);
- signals[DELETE_SURROUNDING] =
- g_signal_new ("delete-surrounding",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, NULL,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_UINT);
- signals[REQUEST_SURROUNDING] =
- g_signal_new ("request-surrounding",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, NULL,
- G_TYPE_NONE, 0);
- signals[INPUT_PANEL_STATE] =
- g_signal_new ("input-panel-state",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, NULL,
- G_TYPE_NONE, 1,
- CLUTTER_TYPE_INPUT_PANEL_STATE);
- signals[CURSOR_LOCATION_CHANGED] =
- g_signal_new ("cursor-location-changed",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, NULL,
- G_TYPE_NONE, 1, GRAPHENE_TYPE_RECT);
-
- pspecs[PROP_CONTENT_HINTS] =
- g_param_spec_flags ("content-hints",
- P_("Content hints"),
- P_("Content hints"),
- CLUTTER_TYPE_INPUT_CONTENT_HINT_FLAGS, 0,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- pspecs[PROP_CONTENT_PURPOSE] =
- g_param_spec_enum ("content-purpose",
- P_("Content purpose"),
- P_("Content purpose"),
- CLUTTER_TYPE_INPUT_CONTENT_PURPOSE, 0,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- pspecs[PROP_CAN_SHOW_PREEDIT] =
- g_param_spec_boolean ("can-show-preedit",
- P_("Can show preedit"),
- P_("Can show preedit"),
- FALSE,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
-
- g_object_class_install_properties (object_class, N_PROPS, pspecs);
-}
-
-static void
-clutter_input_method_init (ClutterInputMethod *im)
-{
-}
-
-void
-clutter_input_method_focus_in (ClutterInputMethod *im,
- ClutterInputFocus *focus)
-{
- ClutterInputMethodPrivate *priv;
- ClutterInputMethodClass *klass;
-
- g_return_if_fail (CLUTTER_IS_INPUT_METHOD (im));
- g_return_if_fail (CLUTTER_IS_INPUT_FOCUS (focus));
-
- priv = clutter_input_method_get_instance_private (im);
-
- if (priv->focus == focus)
- return;
-
- if (priv->focus)
- clutter_input_method_focus_out (im);
-
- g_set_object (&priv->focus, focus);
-
- if (focus)
- {
- klass = CLUTTER_INPUT_METHOD_GET_CLASS (im);
- klass->focus_in (im, focus);
-
- clutter_input_focus_focus_in (priv->focus, im);
- }
-}
-
-void
-clutter_input_method_focus_out (ClutterInputMethod *im)
-{
- ClutterInputMethodPrivate *priv;
- ClutterInputMethodClass *klass;
-
- g_return_if_fail (CLUTTER_IS_INPUT_METHOD (im));
-
- priv = clutter_input_method_get_instance_private (im);
-
- if (!priv->focus)
- return;
-
- clutter_input_focus_focus_out (priv->focus);
- g_clear_object (&priv->focus);
-
- klass = CLUTTER_INPUT_METHOD_GET_CLASS (im);
- klass->focus_out (im);
-}
-
-ClutterInputFocus *
-clutter_input_method_get_focus (ClutterInputMethod *im)
-{
- ClutterInputMethodPrivate *priv;
-
- priv = clutter_input_method_get_instance_private (im);
- return priv->focus;
-}
-
-static void
-clutter_input_method_put_im_event (ClutterInputMethod *im,
- ClutterEventType event_type,
- const char *text,
- int32_t offset,
- uint32_t len)
-{
- ClutterInputDevice *keyboard;
- ClutterSeat *seat;
- ClutterStageManager *stage_manager;
- ClutterStage *stage;
- ClutterEvent *event;
-
- seat = clutter_backend_get_default_seat (clutter_get_default_backend ());
- keyboard = clutter_seat_get_keyboard (seat);
- stage_manager = clutter_stage_manager_get_default ();
- stage = clutter_stage_manager_get_default_stage (stage_manager);
-
- event = clutter_event_new (event_type);
- event->im.text = g_strdup (text);
- event->im.offset = offset;
- event->im.len = len;
- clutter_event_set_device (event, keyboard);
- clutter_event_set_source_device (event, keyboard);
- clutter_event_set_flags (event, CLUTTER_EVENT_FLAG_INPUT_METHOD);
-
- clutter_event_set_stage (event, stage);
-
- clutter_event_put (event);
- clutter_event_free (event);
-}
-
-void
-clutter_input_method_commit (ClutterInputMethod *im,
- const gchar *text)
-{
- g_return_if_fail (CLUTTER_IS_INPUT_METHOD (im));
-
- clutter_input_method_put_im_event (im, CLUTTER_IM_COMMIT, text, 0, 0);
-}
-
-void
-clutter_input_method_delete_surrounding (ClutterInputMethod *im,
- int offset,
- guint len)
-{
- g_return_if_fail (CLUTTER_IS_INPUT_METHOD (im));
-
- clutter_input_method_put_im_event (im, CLUTTER_IM_DELETE, NULL, offset, len);
-}
-
-void
-clutter_input_method_request_surrounding (ClutterInputMethod *im)
-{
- ClutterInputMethodPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_INPUT_METHOD (im));
-
- priv = clutter_input_method_get_instance_private (im);
- if (priv->focus)
- clutter_input_focus_request_surrounding (priv->focus);
-}
-
-/**
- * clutter_input_method_set_preedit_text:
- * @im: a #ClutterInputMethod
- * @preedit: (nullable): the preedit text, or %NULL
- * @cursor: the cursor
- *
- * Sets the preedit text on the current input focus.
- **/
-void
-clutter_input_method_set_preedit_text (ClutterInputMethod *im,
- const gchar *preedit,
- guint cursor)
-{
- g_return_if_fail (CLUTTER_IS_INPUT_METHOD (im));
-
- clutter_input_method_put_im_event (im, CLUTTER_IM_PREEDIT, preedit, cursor, 0);
-}
-
-void
-clutter_input_method_notify_key_event (ClutterInputMethod *im,
- const ClutterEvent *event,
- gboolean filtered)
-{
- if (!filtered)
- {
- ClutterEvent *copy;
-
- /* XXX: we rely on the IM implementation to notify back of
- * key events in the exact same order they were given.
- */
- copy = clutter_event_copy (event);
- clutter_event_set_flags (copy, clutter_event_get_flags (event) |
- CLUTTER_EVENT_FLAG_INPUT_METHOD);
- clutter_event_set_source_device (copy, clutter_event_get_device (copy));
- clutter_event_put (copy);
- clutter_event_free (copy);
- }
-}
-
-void
-clutter_input_method_set_input_panel_state (ClutterInputMethod *im,
- ClutterInputPanelState state)
-{
- g_return_if_fail (CLUTTER_IS_INPUT_METHOD (im));
-
- g_signal_emit (im, signals[INPUT_PANEL_STATE], 0, state);
-}
-
-void
-clutter_input_method_reset (ClutterInputMethod *im)
-{
- g_return_if_fail (CLUTTER_IS_INPUT_METHOD (im));
-
- CLUTTER_INPUT_METHOD_GET_CLASS (im)->reset (im);
-}
-
-void
-clutter_input_method_set_cursor_location (ClutterInputMethod *im,
- const graphene_rect_t *rect)
-{
- g_return_if_fail (CLUTTER_IS_INPUT_METHOD (im));
-
- CLUTTER_INPUT_METHOD_GET_CLASS (im)->set_cursor_location (im, rect);
-
- g_signal_emit (im, signals[CURSOR_LOCATION_CHANGED], 0, rect);
-}
-
-void
-clutter_input_method_set_surrounding (ClutterInputMethod *im,
- const gchar *text,
- guint cursor,
- guint anchor)
-{
- g_return_if_fail (CLUTTER_IS_INPUT_METHOD (im));
-
- CLUTTER_INPUT_METHOD_GET_CLASS (im)->set_surrounding (im, text,
- cursor, anchor);
-}
-
-void
-clutter_input_method_set_content_hints (ClutterInputMethod *im,
- ClutterInputContentHintFlags hints)
-{
- g_return_if_fail (CLUTTER_IS_INPUT_METHOD (im));
-
- g_object_set (G_OBJECT (im), "content-hints", hints, NULL);
-}
-
-void
-clutter_input_method_set_content_purpose (ClutterInputMethod *im,
- ClutterInputContentPurpose purpose)
-{
- g_return_if_fail (CLUTTER_IS_INPUT_METHOD (im));
-
- g_object_set (G_OBJECT (im), "content-purpose", purpose, NULL);
-}
-
-void
-clutter_input_method_set_can_show_preedit (ClutterInputMethod *im,
- gboolean can_show_preedit)
-{
- g_return_if_fail (CLUTTER_IS_INPUT_METHOD (im));
-
- g_object_set (G_OBJECT (im), "can-show-preedit", can_show_preedit, NULL);
-}
-
-gboolean
-clutter_input_method_filter_key_event (ClutterInputMethod *im,
- const ClutterKeyEvent *key)
-{
- ClutterInputMethodClass *im_class = CLUTTER_INPUT_METHOD_GET_CLASS (im);
-
- g_return_val_if_fail (CLUTTER_IS_INPUT_METHOD (im), FALSE);
- g_return_val_if_fail (key != NULL, FALSE);
-
- if (clutter_event_get_flags ((ClutterEvent *) key) & CLUTTER_EVENT_FLAG_INPUT_METHOD)
- return FALSE;
- if (!im_class->filter_key_event)
- return FALSE;
-
- return im_class->filter_key_event (im, (const ClutterEvent *) key);
-}
-
-void
-clutter_input_method_forward_key (ClutterInputMethod *im,
- uint32_t keyval,
- uint32_t keycode,
- uint32_t state,
- uint64_t time_,
- gboolean press)
-{
- ClutterInputMethodPrivate *priv;
- ClutterInputDevice *keyboard;
- ClutterSeat *seat;
- ClutterStageManager *stage_manager;
- ClutterStage *stage;
- ClutterEvent *event;
-
- g_return_if_fail (CLUTTER_IS_INPUT_METHOD (im));
-
- priv = clutter_input_method_get_instance_private (im);
- if (!priv->focus)
- return;
-
- seat = clutter_backend_get_default_seat (clutter_get_default_backend ());
- stage_manager = clutter_stage_manager_get_default ();
- stage = clutter_stage_manager_get_default_stage (stage_manager);
- keyboard = clutter_seat_get_keyboard (seat);
-
- event = clutter_event_new (press ? CLUTTER_KEY_PRESS : CLUTTER_KEY_RELEASE);
- event->key.time = time_;
- event->key.flags = CLUTTER_EVENT_FLAG_INPUT_METHOD;
- event->key.modifier_state = state;
- event->key.keyval = keyval;
- event->key.hardware_keycode = keycode;
- event->key.evdev_code = keycode - 8;
- event->key.unicode_value = clutter_keysym_to_unicode (keyval);
-
- clutter_event_set_device (event, keyboard);
- clutter_event_set_source_device (event, keyboard);
- clutter_event_set_stage (event, stage);
-
- clutter_event_put (event);
- clutter_event_free (event);
-}
diff --git a/clutter/clutter/clutter-input-method.h b/clutter/clutter/clutter-input-method.h
deleted file mode 100644
index b7f9a474e..000000000
--- a/clutter/clutter/clutter-input-method.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2017,2018 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: Carlos Garnacho <carlosg@gnome.org>
- */
-
-#ifndef __CLUTTER_INPUT_METHOD_H__
-#define __CLUTTER_INPUT_METHOD_H__
-
-#include <clutter/clutter.h>
-
-#define CLUTTER_TYPE_INPUT_METHOD (clutter_input_method_get_type ())
-
-CLUTTER_EXPORT
-G_DECLARE_DERIVABLE_TYPE (ClutterInputMethod, clutter_input_method,
- CLUTTER, INPUT_METHOD, GObject)
-
-typedef struct _ClutterInputMethodClass ClutterInputMethodClass;
-
-struct _ClutterInputMethodClass
-{
- GObjectClass parent_class;
-
- void (* focus_in) (ClutterInputMethod *im,
- ClutterInputFocus *actor);
- void (* focus_out) (ClutterInputMethod *im);
-
- void (* reset) (ClutterInputMethod *im);
-
- void (* set_cursor_location) (ClutterInputMethod *im,
- const graphene_rect_t *rect);
- void (* set_surrounding) (ClutterInputMethod *im,
- const gchar *text,
- guint cursor,
- guint anchor);
- void (* update_content_hints) (ClutterInputMethod *im,
- ClutterInputContentHintFlags hint);
- void (* update_content_purpose) (ClutterInputMethod *im,
- ClutterInputContentPurpose purpose);
-
- gboolean (* filter_key_event) (ClutterInputMethod *im,
- const ClutterEvent *key);
-};
-
-CLUTTER_EXPORT
-void clutter_input_method_focus_in (ClutterInputMethod *im,
- ClutterInputFocus *focus);
-CLUTTER_EXPORT
-void clutter_input_method_focus_out (ClutterInputMethod *im);
-
-CLUTTER_EXPORT
-void clutter_input_method_commit (ClutterInputMethod *im,
- const gchar *text);
-CLUTTER_EXPORT
-void clutter_input_method_delete_surrounding (ClutterInputMethod *im,
- int offset,
- guint len);
-CLUTTER_EXPORT
-void clutter_input_method_request_surrounding (ClutterInputMethod *im);
-
-CLUTTER_EXPORT
-void clutter_input_method_set_preedit_text (ClutterInputMethod *im,
- const gchar *preedit,
- guint cursor);
-
-CLUTTER_EXPORT
-void clutter_input_method_notify_key_event (ClutterInputMethod *im,
- const ClutterEvent *event,
- gboolean filtered);
-CLUTTER_EXPORT
-void clutter_input_method_set_input_panel_state (ClutterInputMethod *im,
- ClutterInputPanelState state);
-
-CLUTTER_EXPORT
-void clutter_input_method_forward_key (ClutterInputMethod *im,
- uint32_t keyval,
- uint32_t keycode,
- uint32_t state,
- uint64_t time_,
- gboolean press);
-
-#endif /* __CLUTTER_INPUT_METHOD_H__ */
diff --git a/clutter/clutter/clutter-input-pointer-a11y-private.h b/clutter/clutter/clutter-input-pointer-a11y-private.h
deleted file mode 100644
index fbbe04101..000000000
--- a/clutter/clutter/clutter-input-pointer-a11y-private.h
+++ /dev/null
@@ -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__ */
diff --git a/clutter/clutter/clutter-input-pointer-a11y.c b/clutter/clutter/clutter-input-pointer-a11y.c
deleted file mode 100644
index 365b85fd6..000000000
--- a/clutter/clutter/clutter-input-pointer-a11y.c
+++ /dev/null
@@ -1,728 +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-enum-types.h"
-#include "clutter-input-device.h"
-#include "clutter-input-device-private.h"
-#include "clutter-input-pointer-a11y-private.h"
-#include "clutter-main.h"
-#include "clutter-virtual-input-device.h"
-
-static gboolean
-is_secondary_click_enabled (ClutterInputDevice *device)
-{
- ClutterPointerA11ySettings settings;
- ClutterSeat *seat = clutter_input_device_get_seat (device);
-
- clutter_seat_get_pointer_a11y_settings (seat, &settings);
-
- return (settings.controls & CLUTTER_A11Y_SECONDARY_CLICK_ENABLED);
-}
-
-static gboolean
-is_dwell_click_enabled (ClutterInputDevice *device)
-{
- ClutterPointerA11ySettings settings;
- ClutterSeat *seat = clutter_input_device_get_seat (device);
-
- clutter_seat_get_pointer_a11y_settings (seat, &settings);
-
- return (settings.controls & CLUTTER_A11Y_DWELL_ENABLED);
-}
-
-static unsigned int
-get_secondary_click_delay (ClutterInputDevice *device)
-{
- ClutterPointerA11ySettings settings;
- ClutterSeat *seat = clutter_input_device_get_seat (device);
-
- clutter_seat_get_pointer_a11y_settings (seat, &settings);
-
- return settings.secondary_click_delay;
-}
-
-static unsigned int
-get_dwell_delay (ClutterInputDevice *device)
-{
- ClutterPointerA11ySettings settings;
- ClutterSeat *seat = clutter_input_device_get_seat (device);
-
- clutter_seat_get_pointer_a11y_settings (seat, &settings);
-
- return settings.dwell_delay;
-}
-
-static unsigned int
-get_dwell_threshold (ClutterInputDevice *device)
-{
- ClutterPointerA11ySettings settings;
- ClutterSeat *seat = clutter_input_device_get_seat (device);
-
- clutter_seat_get_pointer_a11y_settings (seat, &settings);
-
- return settings.dwell_threshold;
-}
-
-static ClutterPointerA11yDwellMode
-get_dwell_mode (ClutterInputDevice *device)
-{
- ClutterPointerA11ySettings settings;
- ClutterSeat *seat = clutter_input_device_get_seat (device);
-
- clutter_seat_get_pointer_a11y_settings (seat, &settings);
-
- return settings.dwell_mode;
-}
-
-static ClutterPointerA11yDwellClickType
-get_dwell_click_type (ClutterInputDevice *device)
-{
- ClutterPointerA11ySettings settings;
- ClutterSeat *seat = clutter_input_device_get_seat (device);
-
- clutter_seat_get_pointer_a11y_settings (seat, &settings);
-
- return settings.dwell_click_type;
-}
-
-static ClutterPointerA11yDwellClickType
-get_dwell_click_type_for_direction (ClutterInputDevice *device,
- ClutterPointerA11yDwellDirection direction)
-{
- ClutterPointerA11ySettings settings;
- ClutterSeat *seat = clutter_input_device_get_seat (device);
-
- clutter_seat_get_pointer_a11y_settings (seat, &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;
- ClutterSeat *seat = clutter_input_device_get_seat (device);
-
- device->ptr_a11y_data->secondary_click_triggered = TRUE;
- device->ptr_a11y_data->secondary_click_timer = 0;
-
- g_signal_emit_by_name (seat,
- "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);
- ClutterSeat *seat = clutter_input_device_get_seat (device);
-
- device->ptr_a11y_data->secondary_click_timer =
- clutter_threads_add_timeout (delay, trigger_secondary_click, device);
-
- g_signal_emit_by_name (seat,
- "ptr-a11y-timeout-started",
- device,
- CLUTTER_A11Y_TIMEOUT_TYPE_SECONDARY_CLICK,
- delay);
-}
-
-static void
-stop_secondary_click_timeout (ClutterInputDevice *device)
-{
- ClutterSeat *seat = clutter_input_device_get_seat (device);
-
- if (device->ptr_a11y_data->secondary_click_timer)
- {
- g_clear_handle_id (&device->ptr_a11y_data->secondary_click_timer,
- g_source_remove);
-
- g_signal_emit_by_name (seat,
- "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;
- ClutterSeat *seat = clutter_input_device_get_seat (device);
-
- clutter_seat_get_pointer_a11y_settings (seat, &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_seat_set_pointer_a11y_settings (seat, &settings);
-
- g_signal_emit_by_name (seat,
- "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);
- ClutterSeat *seat = clutter_input_device_get_seat (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 (seat,
- "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);
- ClutterSeat *seat = clutter_input_device_get_seat (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 (seat,
- "ptr-a11y-timeout-started",
- device,
- CLUTTER_A11Y_TIMEOUT_TYPE_GESTURE,
- delay);
-}
-
-static gboolean
-trigger_dwell_click (gpointer data)
-{
- ClutterInputDevice *device = data;
- ClutterSeat *seat = clutter_input_device_get_seat (device);
-
- device->ptr_a11y_data->dwell_timer = 0;
-
- g_signal_emit_by_name (seat,
- "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);
- ClutterSeat *seat = clutter_input_device_get_seat (device);
-
- device->ptr_a11y_data->dwell_timer =
- clutter_threads_add_timeout (delay, trigger_dwell_click, device);
-
- g_signal_emit_by_name (seat,
- "ptr-a11y-timeout-started",
- device,
- CLUTTER_A11Y_TIMEOUT_TYPE_DWELL,
- delay);
-}
-
-static void
-stop_dwell_timeout (ClutterInputDevice *device)
-{
- ClutterSeat *seat = clutter_input_device_get_seat (device);
-
- if (device->ptr_a11y_data->dwell_timer)
- {
- g_clear_handle_id (&device->ptr_a11y_data->dwell_timer, g_source_remove);
- device->ptr_a11y_data->dwell_gesture_started = FALSE;
-
- g_signal_emit_by_name (seat,
- "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;
- ClutterSeat *seat = clutter_input_device_get_seat (device);
-
- core_pointer = clutter_seat_get_pointer (seat);
- if (core_pointer == NULL)
- return FALSE;
-
- return (core_pointer == device);
-}
-
-void
-_clutter_input_pointer_a11y_add_device (ClutterInputDevice *device)
-{
- ClutterSeat *seat = clutter_input_device_get_seat (device);
-
- if (!is_device_core_pointer (device))
- return;
-
- device->accessibility_virtual_device =
- clutter_seat_create_virtual_device (seat,
- 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));
-}
diff --git a/clutter/clutter/clutter-interval.c b/clutter/clutter/clutter-interval.c
deleted file mode 100644
index b7d75a4bd..000000000
--- a/clutter/clutter/clutter-interval.c
+++ /dev/null
@@ -1,1229 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2008 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-interval
- * @short_description: An object holding an interval of two values
- *
- * #ClutterInterval is a simple object that can hold two values
- * defining an interval. #ClutterInterval can hold any value that
- * can be enclosed inside a #GValue.
- *
- * Once a #ClutterInterval for a specific #GType has been instantiated
- * the #ClutterInterval:value-type property cannot be changed anymore.
- *
- * #ClutterInterval starts with a floating reference; this means that
- * any object taking a reference on a #ClutterInterval instance should
- * also take ownership of the interval by using g_object_ref_sink().
- *
- * #ClutterInterval can be subclassed to override the validation
- * and value computation.
- *
- * #ClutterInterval is available since Clutter 1.0
- */
-
-#include "clutter-build-config.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <glib.h>
-#include <glib-object.h>
-#include <gobject/gvaluecollector.h>
-
-#include "clutter-color.h"
-#include "clutter-interval.h"
-#include "clutter-private.h"
-#include "clutter-units.h"
-#include "clutter-scriptable.h"
-#include "clutter-script-private.h"
-
-enum
-{
- PROP_0,
-
- PROP_VALUE_TYPE,
- PROP_INITIAL,
- PROP_FINAL,
-
- PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST];
-
-enum
-{
- INITIAL = 0,
- FINAL,
- RESULT,
-
- N_VALUES
-};
-
-struct _ClutterIntervalPrivate
-{
- GType value_type;
-
- GValue *values;
-};
-
-static void clutter_scriptable_iface_init (ClutterScriptableIface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (ClutterInterval,
- clutter_interval,
- G_TYPE_INITIALLY_UNOWNED,
- G_ADD_PRIVATE (ClutterInterval)
- G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE,
- clutter_scriptable_iface_init));
-
-
-static gboolean
-clutter_interval_real_validate (ClutterInterval *interval,
- GParamSpec *pspec)
-{
- GType pspec_gtype = G_PARAM_SPEC_VALUE_TYPE (pspec);
-
- /* then check the fundamental types */
- switch (G_TYPE_FUNDAMENTAL (pspec_gtype))
- {
- case G_TYPE_INT:
- {
- GParamSpecInt *pspec_int = G_PARAM_SPEC_INT (pspec);
- gint a, b;
-
- a = b = 0;
- clutter_interval_get_interval (interval, &a, &b);
- if ((a >= pspec_int->minimum && a <= pspec_int->maximum) &&
- (b >= pspec_int->minimum && b <= pspec_int->maximum))
- return TRUE;
- else
- return FALSE;
- }
- break;
-
- case G_TYPE_INT64:
- {
- GParamSpecInt64 *pspec_int = G_PARAM_SPEC_INT64 (pspec);
- gint64 a, b;
-
- a = b = 0;
- clutter_interval_get_interval (interval, &a, &b);
- if ((a >= pspec_int->minimum && a <= pspec_int->maximum) &&
- (b >= pspec_int->minimum && b <= pspec_int->maximum))
- return TRUE;
- else
- return FALSE;
- }
- break;
-
- case G_TYPE_UINT:
- {
- GParamSpecUInt *pspec_uint = G_PARAM_SPEC_UINT (pspec);
- guint a, b;
-
- a = b = 0;
- clutter_interval_get_interval (interval, &a, &b);
- if ((a >= pspec_uint->minimum && a <= pspec_uint->maximum) &&
- (b >= pspec_uint->minimum && b <= pspec_uint->maximum))
- return TRUE;
- else
- return FALSE;
- }
- break;
-
- case G_TYPE_UINT64:
- {
- GParamSpecUInt64 *pspec_int = G_PARAM_SPEC_UINT64 (pspec);
- guint64 a, b;
-
- a = b = 0;
- clutter_interval_get_interval (interval, &a, &b);
- if ((a >= pspec_int->minimum && a <= pspec_int->maximum) &&
- (b >= pspec_int->minimum && b <= pspec_int->maximum))
- return TRUE;
- else
- return FALSE;
- }
- break;
-
- case G_TYPE_CHAR:
- {
- GParamSpecChar *pspec_char = G_PARAM_SPEC_CHAR (pspec);
- guchar a, b;
-
- a = b = 0;
- clutter_interval_get_interval (interval, &a, &b);
- if ((a >= pspec_char->minimum && a <= pspec_char->maximum) &&
- (b >= pspec_char->minimum && b <= pspec_char->maximum))
- return TRUE;
- else
- return FALSE;
- }
- break;
-
- case G_TYPE_UCHAR:
- {
- GParamSpecUChar *pspec_uchar = G_PARAM_SPEC_UCHAR (pspec);
- guchar a, b;
-
- a = b = 0;
- clutter_interval_get_interval (interval, &a, &b);
- if ((a >= pspec_uchar->minimum && a <= pspec_uchar->maximum) &&
- (b >= pspec_uchar->minimum && b <= pspec_uchar->maximum))
- return TRUE;
- else
- return FALSE;
- }
- break;
-
- case G_TYPE_FLOAT:
- {
- GParamSpecFloat *pspec_flt = G_PARAM_SPEC_FLOAT (pspec);
- float a, b;
-
- a = b = 0.f;
- clutter_interval_get_interval (interval, &a, &b);
- if ((a >= pspec_flt->minimum && a <= pspec_flt->maximum) &&
- (b >= pspec_flt->minimum && b <= pspec_flt->maximum))
- return TRUE;
- else
- return FALSE;
- }
- break;
-
- case G_TYPE_DOUBLE:
- {
- GParamSpecDouble *pspec_flt = G_PARAM_SPEC_DOUBLE (pspec);
- double a, b;
-
- a = b = 0;
- clutter_interval_get_interval (interval, &a, &b);
- if ((a >= pspec_flt->minimum && a <= pspec_flt->maximum) &&
- (b >= pspec_flt->minimum && b <= pspec_flt->maximum))
- return TRUE;
- else
- return FALSE;
- }
- break;
-
- case G_TYPE_BOOLEAN:
- return TRUE;
-
- default:
- break;
- }
-
- return TRUE;
-}
-
-static gboolean
-clutter_interval_real_compute_value (ClutterInterval *interval,
- gdouble factor,
- GValue *value)
-{
- GValue *initial, *final;
- GType value_type;
- gboolean retval = FALSE;
-
- initial = clutter_interval_peek_initial_value (interval);
- final = clutter_interval_peek_final_value (interval);
-
- value_type = clutter_interval_get_value_type (interval);
-
- if (_clutter_has_progress_function (value_type))
- {
- retval = _clutter_run_progress_function (value_type,
- initial,
- final,
- factor,
- value);
- if (retval)
- return TRUE;
- }
-
- switch (G_TYPE_FUNDAMENTAL (value_type))
- {
- case G_TYPE_INT:
- {
- gint ia, ib, res;
-
- ia = g_value_get_int (initial);
- ib = g_value_get_int (final);
-
- res = (factor * (ib - ia)) + ia;
-
- g_value_set_int (value, res);
-
- retval = TRUE;
- }
- break;
-
- case G_TYPE_CHAR:
- {
- gchar ia, ib, res;
-
- ia = g_value_get_schar (initial);
- ib = g_value_get_schar (final);
-
- res = (factor * (ib - (gdouble) ia)) + ia;
-
- g_value_set_schar (value, res);
-
- retval = TRUE;
- }
- break;
-
- case G_TYPE_UINT:
- {
- guint ia, ib, res;
-
- ia = g_value_get_uint (initial);
- ib = g_value_get_uint (final);
-
- res = (factor * (ib - (gdouble) ia)) + ia;
-
- g_value_set_uint (value, res);
-
- retval = TRUE;
- }
- break;
-
- case G_TYPE_UCHAR:
- {
- guchar ia, ib, res;
-
- ia = g_value_get_uchar (initial);
- ib = g_value_get_uchar (final);
-
- res = (factor * (ib - (gdouble) ia)) + ia;
-
- g_value_set_uchar (value, res);
-
- retval = TRUE;
- }
- break;
-
- case G_TYPE_FLOAT:
- case G_TYPE_DOUBLE:
- {
- gdouble ia, ib, res;
-
- if (value_type == G_TYPE_DOUBLE)
- {
- ia = g_value_get_double (initial);
- ib = g_value_get_double (final);
- }
- else
- {
- ia = g_value_get_float (initial);
- ib = g_value_get_float (final);
- }
-
- res = (factor * (ib - ia)) + ia;
-
- if (value_type == G_TYPE_DOUBLE)
- g_value_set_double (value, res);
- else
- g_value_set_float (value, res);
-
- retval = TRUE;
- }
- break;
-
- case G_TYPE_BOOLEAN:
- if (factor > 0.5)
- g_value_set_boolean (value, TRUE);
- else
- g_value_set_boolean (value, FALSE);
-
- retval = TRUE;
- break;
-
- case G_TYPE_BOXED:
- break;
-
- default:
- break;
- }
-
- /* We're trying to animate a property without knowing how to do that. Issue
- * a warning with a hint to what could be done to fix that */
- if (G_UNLIKELY (retval == FALSE))
- {
- g_warning ("%s: Could not compute progress between two %s. You can "
- "register a progress function to instruct ClutterInterval "
- "how to deal with this GType",
- G_STRLOC,
- g_type_name (value_type));
- }
-
- return retval;
-}
-
-static void
-clutter_interval_finalize (GObject *gobject)
-{
- ClutterIntervalPrivate *priv = CLUTTER_INTERVAL (gobject)->priv;
-
- if (G_IS_VALUE (&priv->values[INITIAL]))
- g_value_unset (&priv->values[INITIAL]);
-
- if (G_IS_VALUE (&priv->values[FINAL]))
- g_value_unset (&priv->values[FINAL]);
-
- if (G_IS_VALUE (&priv->values[RESULT]))
- g_value_unset (&priv->values[RESULT]);
-
- g_free (priv->values);
-
- G_OBJECT_CLASS (clutter_interval_parent_class)->finalize (gobject);
-}
-
-static void
-clutter_interval_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterInterval *self = CLUTTER_INTERVAL (gobject);
- ClutterIntervalPrivate *priv = clutter_interval_get_instance_private (self);
-
- switch (prop_id)
- {
- case PROP_VALUE_TYPE:
- priv->value_type = g_value_get_gtype (value);
- break;
-
- case PROP_INITIAL:
- if (g_value_get_boxed (value) != NULL)
- clutter_interval_set_initial_value (self, g_value_get_boxed (value));
- else if (G_IS_VALUE (&priv->values[INITIAL]))
- g_value_unset (&priv->values[INITIAL]);
- break;
-
- case PROP_FINAL:
- if (g_value_get_boxed (value) != NULL)
- clutter_interval_set_final_value (self, g_value_get_boxed (value));
- else if (G_IS_VALUE (&priv->values[FINAL]))
- g_value_unset (&priv->values[FINAL]);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_interval_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterIntervalPrivate *priv;
-
- priv = clutter_interval_get_instance_private (CLUTTER_INTERVAL (gobject));
-
- switch (prop_id)
- {
- case PROP_VALUE_TYPE:
- g_value_set_gtype (value, priv->value_type);
- break;
-
- case PROP_INITIAL:
- if (G_IS_VALUE (&priv->values[INITIAL]))
- g_value_set_boxed (value, &priv->values[INITIAL]);
- break;
-
- case PROP_FINAL:
- if (G_IS_VALUE (&priv->values[FINAL]))
- g_value_set_boxed (value, &priv->values[FINAL]);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static gboolean
-clutter_interval_parse_custom_node (ClutterScriptable *scriptable,
- ClutterScript *script,
- GValue *value,
- const gchar *name,
- JsonNode *node)
-{
- ClutterIntervalPrivate *priv = CLUTTER_INTERVAL (scriptable)->priv;
-
- if ((strcmp (name, "initial") == 0) || (strcmp (name, "final") == 0))
- {
- g_value_init (value, priv->value_type);
- return _clutter_script_parse_node (script, value, name, node, NULL);
- }
-
- return FALSE;
-}
-
-static void
-clutter_interval_set_custom_property (ClutterScriptable *scriptable,
- ClutterScript *script,
- const gchar *name,
- const GValue *value)
-{
- ClutterInterval *self = CLUTTER_INTERVAL (scriptable);
-
- if (strcmp (name, "initial") == 0)
- clutter_interval_set_initial_value (self, value);
- else if (strcmp (name, "final") == 0)
- clutter_interval_set_final_value (self, value);
- else
- g_object_set_property (G_OBJECT (scriptable), name, value);
-}
-
-static void
-clutter_scriptable_iface_init (ClutterScriptableIface *iface)
-{
- iface->parse_custom_node = clutter_interval_parse_custom_node;
- iface->set_custom_property = clutter_interval_set_custom_property;
-}
-
-static void
-clutter_interval_class_init (ClutterIntervalClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- klass->validate = clutter_interval_real_validate;
- klass->compute_value = clutter_interval_real_compute_value;
-
- gobject_class->set_property = clutter_interval_set_property,
- gobject_class->get_property = clutter_interval_get_property;
- gobject_class->finalize = clutter_interval_finalize;
-
- /**
- * ClutterInterval:value-type:
- *
- * The type of the values in the interval.
- *
- * Since: 1.0
- */
- obj_props[PROP_VALUE_TYPE] =
- g_param_spec_gtype ("value-type",
- P_("Value Type"),
- P_("The type of the values in the interval"),
- G_TYPE_NONE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS);
-
- /**
- * ClutterInterval:initial:
- *
- * The initial value of the interval.
- *
- * Since: 1.12
- */
- obj_props[PROP_INITIAL] =
- g_param_spec_boxed ("initial",
- P_("Initial Value"),
- P_("Initial value of the interval"),
- G_TYPE_VALUE,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
-
- /**
- * ClutterInterval:final:
- *
- * The final value of the interval.
- *
- * Since: 1.12
- */
- obj_props[PROP_FINAL] =
- g_param_spec_boxed ("final",
- P_("Final Value"),
- P_("Final value of the interval"),
- G_TYPE_VALUE,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
-
- g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
-}
-
-static void
-clutter_interval_init (ClutterInterval *self)
-{
- self->priv = clutter_interval_get_instance_private (self);
-
- self->priv->value_type = G_TYPE_INVALID;
- self->priv->values = g_malloc0 (sizeof (GValue) * N_VALUES);
-}
-
-static inline void
-clutter_interval_set_value_internal (ClutterInterval *interval,
- gint index_,
- const GValue *value)
-{
- ClutterIntervalPrivate *priv = interval->priv;
- GType value_type;
-
- g_assert (index_ >= INITIAL && index_ <= RESULT);
-
- if (G_IS_VALUE (&priv->values[index_]))
- g_value_unset (&priv->values[index_]);
-
- g_value_init (&priv->values[index_], priv->value_type);
-
- value_type = G_VALUE_TYPE (value);
- if (value_type != priv->value_type ||
- !g_type_is_a (value_type, priv->value_type))
- {
- if (g_value_type_compatible (value_type, priv->value_type))
- {
- g_value_copy (value, &priv->values[index_]);
- return;
- }
-
- if (g_value_type_transformable (value_type, priv->value_type))
- {
- GValue transform = G_VALUE_INIT;
-
- g_value_init (&transform, priv->value_type);
-
- if (g_value_transform (value, &transform))
- g_value_copy (&transform, &priv->values[index_]);
- else
- {
- g_warning ("%s: Unable to convert a value of type '%s' into "
- "the value type '%s' of the interval.",
- G_STRLOC,
- g_type_name (value_type),
- g_type_name (priv->value_type));
- }
-
- g_value_unset (&transform);
- }
- }
- else
- g_value_copy (value, &priv->values[index_]);
-}
-
-static inline void
-clutter_interval_get_value_internal (ClutterInterval *interval,
- gint index_,
- GValue *value)
-{
- ClutterIntervalPrivate *priv = interval->priv;
-
- g_assert (index_ >= INITIAL && index_ <= RESULT);
-
- g_value_copy (&priv->values[index_], value);
-}
-
-static gboolean
-clutter_interval_set_initial_internal (ClutterInterval *interval,
- va_list *args)
-{
- GType gtype = interval->priv->value_type;
- GValue value = G_VALUE_INIT;
- gchar *error;
-
- /* initial value */
- G_VALUE_COLLECT_INIT (&value, gtype, *args, 0, &error);
-
- if (error)
- {
- g_warning ("%s: %s", G_STRLOC, error);
-
- /* we leak the value here as it might not be in a valid state
- * given the error and calling g_value_unset() might lead to
- * undefined behaviour
- */
- g_free (error);
- return FALSE;
- }
-
- clutter_interval_set_value_internal (interval, INITIAL, &value);
- g_value_unset (&value);
-
- return TRUE;
-}
-
-static gboolean
-clutter_interval_set_final_internal (ClutterInterval *interval,
- va_list *args)
-{
- GType gtype = interval->priv->value_type;
- GValue value = G_VALUE_INIT;
- gchar *error;
-
- /* initial value */
- G_VALUE_COLLECT_INIT (&value, gtype, *args, 0, &error);
-
- if (error)
- {
- g_warning ("%s: %s", G_STRLOC, error);
-
- /* we leak the value here as it might not be in a valid state
- * given the error and calling g_value_unset() might lead to
- * undefined behaviour
- */
- g_free (error);
- return FALSE;
- }
-
- clutter_interval_set_value_internal (interval, FINAL, &value);
- g_value_unset (&value);
-
- return TRUE;
-}
-
-static void
-clutter_interval_get_interval_valist (ClutterInterval *interval,
- va_list var_args)
-{
- GType gtype = interval->priv->value_type;
- GValue value = G_VALUE_INIT;
- gchar *error;
-
- /* initial value */
- g_value_init (&value, gtype);
- clutter_interval_get_initial_value (interval, &value);
- G_VALUE_LCOPY (&value, var_args, 0, &error);
- if (error)
- {
- g_warning ("%s: %s", G_STRLOC, error);
- g_free (error);
- g_value_unset (&value);
- return;
- }
-
- g_value_unset (&value);
-
- /* final value */
- g_value_init (&value, gtype);
- clutter_interval_get_final_value (interval, &value);
- G_VALUE_LCOPY (&value, var_args, 0, &error);
- if (error)
- {
- g_warning ("%s: %s", G_STRLOC, error);
- g_free (error);
- g_value_unset (&value);
- return;
- }
-
- g_value_unset (&value);
-}
-
-/**
- * clutter_interval_new:
- * @gtype: the type of the values in the interval
- * @...: the initial value and the final value of the interval
- *
- * Creates a new #ClutterInterval holding values of type @gtype.
- *
- * This function avoids using a #GValue for the initial and final values
- * of the interval:
- *
- * |[
- * interval = clutter_interval_new (G_TYPE_FLOAT, 0.0, 1.0);
- * interval = clutter_interval_new (G_TYPE_BOOLEAN, FALSE, TRUE);
- * interval = clutter_interval_new (G_TYPE_INT, 0, 360);
- * ]|
- *
- * Return value: the newly created #ClutterInterval
- *
- * Since: 1.0
- */
-ClutterInterval *
-clutter_interval_new (GType gtype,
- ...)
-{
- ClutterInterval *retval;
- va_list args;
-
- g_return_val_if_fail (gtype != G_TYPE_INVALID, NULL);
-
- retval = g_object_new (CLUTTER_TYPE_INTERVAL, "value-type", gtype, NULL);
-
- va_start (args, gtype);
-
- if (!clutter_interval_set_initial_internal (retval, &args))
- goto out;
-
- clutter_interval_set_final_internal (retval, &args);
-
-out:
- va_end (args);
-
- return retval;
-}
-
-/**
- * clutter_interval_new_with_values:
- * @gtype: the type of the values in the interval
- * @initial: (allow-none): a #GValue holding the initial value of the interval
- * @final: (allow-none): a #GValue holding the final value of the interval
- *
- * Creates a new #ClutterInterval of type @gtype, between @initial
- * and @final.
- *
- * This function is useful for language bindings.
- *
- * Return value: the newly created #ClutterInterval
- *
- * Since: 1.0
- */
-ClutterInterval *
-clutter_interval_new_with_values (GType gtype,
- const GValue *initial,
- const GValue *final)
-{
- g_return_val_if_fail (gtype != G_TYPE_INVALID, NULL);
- g_return_val_if_fail (initial == NULL || G_VALUE_TYPE (initial) == gtype, NULL);
- g_return_val_if_fail (final == NULL || G_VALUE_TYPE (final) == gtype, NULL);
-
- return g_object_new (CLUTTER_TYPE_INTERVAL,
- "value-type", gtype,
- "initial", initial,
- "final", final,
- NULL);
-}
-
-/**
- * clutter_interval_clone:
- * @interval: a #ClutterInterval
- *
- * Creates a copy of @interval.
- *
- * Return value: (transfer full): the newly created #ClutterInterval
- *
- * Since: 1.0
- */
-ClutterInterval *
-clutter_interval_clone (ClutterInterval *interval)
-{
- ClutterInterval *retval;
- GType gtype;
- GValue *tmp;
-
- g_return_val_if_fail (CLUTTER_IS_INTERVAL (interval), NULL);
- g_return_val_if_fail (interval->priv->value_type != G_TYPE_INVALID, NULL);
-
- gtype = interval->priv->value_type;
- retval = g_object_new (CLUTTER_TYPE_INTERVAL, "value-type", gtype, NULL);
-
- tmp = clutter_interval_peek_initial_value (interval);
- clutter_interval_set_initial_value (retval, tmp);
-
- tmp = clutter_interval_peek_final_value (interval);
- clutter_interval_set_final_value (retval, tmp);
-
- return retval;
-}
-
-/**
- * clutter_interval_get_value_type:
- * @interval: a #ClutterInterval
- *
- * Retrieves the #GType of the values inside @interval.
- *
- * Return value: the type of the value, or G_TYPE_INVALID
- *
- * Since: 1.0
- */
-GType
-clutter_interval_get_value_type (ClutterInterval *interval)
-{
- g_return_val_if_fail (CLUTTER_IS_INTERVAL (interval), G_TYPE_INVALID);
-
- return interval->priv->value_type;
-}
-
-/**
- * clutter_interval_set_initial_value: (rename-to clutter_interval_set_initial)
- * @interval: a #ClutterInterval
- * @value: a #GValue
- *
- * Sets the initial value of @interval to @value. The value is copied
- * inside the #ClutterInterval.
- *
- * Since: 1.0
- */
-void
-clutter_interval_set_initial_value (ClutterInterval *interval,
- const GValue *value)
-{
- g_return_if_fail (CLUTTER_IS_INTERVAL (interval));
- g_return_if_fail (value != NULL);
-
- clutter_interval_set_value_internal (interval, INITIAL, value);
-}
-
-/**
- * clutter_interval_set_initial: (skip)
- * @interval: a #ClutterInterval
- * @...: the initial value of the interval.
- *
- * Variadic arguments version of clutter_interval_set_initial_value().
- *
- * This function is meant as a convenience for the C API.
- *
- * Language bindings should use clutter_interval_set_initial_value()
- * instead.
- *
- * Since: 1.10
- */
-void
-clutter_interval_set_initial (ClutterInterval *interval,
- ...)
-{
- va_list args;
-
- g_return_if_fail (CLUTTER_IS_INTERVAL (interval));
-
- va_start (args, interval);
- clutter_interval_set_initial_internal (interval, &args);
- va_end (args);
-}
-
-/**
- * clutter_interval_get_initial_value:
- * @interval: a #ClutterInterval
- * @value: (out caller-allocates): a #GValue
- *
- * Retrieves the initial value of @interval and copies
- * it into @value.
- *
- * The passed #GValue must be initialized to the value held by
- * the #ClutterInterval.
- *
- * Since: 1.0
- */
-void
-clutter_interval_get_initial_value (ClutterInterval *interval,
- GValue *value)
-{
- g_return_if_fail (CLUTTER_IS_INTERVAL (interval));
- g_return_if_fail (value != NULL);
-
- clutter_interval_get_value_internal (interval, INITIAL, value);
-}
-
-/**
- * clutter_interval_peek_initial_value:
- * @interval: a #ClutterInterval
- *
- * Gets the pointer to the initial value of @interval
- *
- * Return value: (transfer none): the initial value of the interval.
- * The value is owned by the #ClutterInterval and it should not be
- * modified or freed
- *
- * Since: 1.0
- */
-GValue *
-clutter_interval_peek_initial_value (ClutterInterval *interval)
-{
- g_return_val_if_fail (CLUTTER_IS_INTERVAL (interval), NULL);
-
- return interval->priv->values + INITIAL;
-}
-
-/**
- * clutter_interval_set_final_value: (rename-to clutter_interval_set_final)
- * @interval: a #ClutterInterval
- * @value: a #GValue
- *
- * Sets the final value of @interval to @value. The value is
- * copied inside the #ClutterInterval.
- *
- * Since: 1.0
- */
-void
-clutter_interval_set_final_value (ClutterInterval *interval,
- const GValue *value)
-{
- g_return_if_fail (CLUTTER_IS_INTERVAL (interval));
- g_return_if_fail (value != NULL);
-
- clutter_interval_set_value_internal (interval, FINAL, value);
-}
-
-/**
- * clutter_interval_get_final_value:
- * @interval: a #ClutterInterval
- * @value: (out caller-allocates): a #GValue
- *
- * Retrieves the final value of @interval and copies
- * it into @value.
- *
- * The passed #GValue must be initialized to the value held by
- * the #ClutterInterval.
- *
- * Since: 1.0
- */
-void
-clutter_interval_get_final_value (ClutterInterval *interval,
- GValue *value)
-{
- g_return_if_fail (CLUTTER_IS_INTERVAL (interval));
- g_return_if_fail (value != NULL);
-
- clutter_interval_get_value_internal (interval, FINAL, value);
-}
-
-/**
- * clutter_interval_set_final: (skip)
- * @interval: a #ClutterInterval
- * @...: the final value of the interval
- *
- * Variadic arguments version of clutter_interval_set_final_value().
- *
- * This function is meant as a convenience for the C API.
- *
- * Language bindings should use clutter_interval_set_final_value() instead.
- *
- * Since: 1.10
- */
-void
-clutter_interval_set_final (ClutterInterval *interval,
- ...)
-{
- va_list args;
-
- g_return_if_fail (CLUTTER_IS_INTERVAL (interval));
-
- va_start (args, interval);
- clutter_interval_set_final_internal (interval, &args);
- va_end (args);
-}
-
-/**
- * clutter_interval_peek_final_value:
- * @interval: a #ClutterInterval
- *
- * Gets the pointer to the final value of @interval
- *
- * Return value: (transfer none): the final value of the interval.
- * The value is owned by the #ClutterInterval and it should not be
- * modified or freed
- *
- * Since: 1.0
- */
-GValue *
-clutter_interval_peek_final_value (ClutterInterval *interval)
-{
- g_return_val_if_fail (CLUTTER_IS_INTERVAL (interval), NULL);
-
- return interval->priv->values + FINAL;
-}
-
-/**
- * clutter_interval_set_interval:
- * @interval: a #ClutterInterval
- * @...: the initial and final values of the interval
- *
- * Variable arguments wrapper for clutter_interval_set_initial_value()
- * and clutter_interval_set_final_value() that avoids using the
- * #GValue arguments:
- *
- * |[
- * clutter_interval_set_interval (interval, 0, 50);
- * clutter_interval_set_interval (interval, 1.0, 0.0);
- * clutter_interval_set_interval (interval, FALSE, TRUE);
- * ]|
- *
- * This function is meant for the convenience of the C API; bindings
- * should reimplement this function using the #GValue-based API.
- *
- * Since: 1.0
- */
-void
-clutter_interval_set_interval (ClutterInterval *interval,
- ...)
-{
- va_list args;
-
- g_return_if_fail (CLUTTER_IS_INTERVAL (interval));
- g_return_if_fail (interval->priv->value_type != G_TYPE_INVALID);
-
- va_start (args, interval);
-
- if (!clutter_interval_set_initial_internal (interval, &args))
- goto out;
-
- clutter_interval_set_final_internal (interval, &args);
-
-out:
- va_end (args);
-}
-
-/**
- * clutter_interval_get_interval:
- * @interval: a #ClutterInterval
- * @...: return locations for the initial and final values of
- * the interval
- *
- * Variable arguments wrapper for clutter_interval_get_initial_value()
- * and clutter_interval_get_final_value() that avoids using the
- * #GValue arguments:
- *
- * |[
- * gint a = 0, b = 0;
- * clutter_interval_get_interval (interval, &a, &b);
- * ]|
- *
- * This function is meant for the convenience of the C API; bindings
- * should reimplement this function using the #GValue-based API.
- *
- * Since: 1.0
- */
-void
-clutter_interval_get_interval (ClutterInterval *interval,
- ...)
-{
- va_list args;
-
- g_return_if_fail (CLUTTER_IS_INTERVAL (interval));
- g_return_if_fail (interval->priv->value_type != G_TYPE_INVALID);
-
- va_start (args, interval);
- clutter_interval_get_interval_valist (interval, args);
- va_end (args);
-}
-
-/**
- * clutter_interval_validate:
- * @interval: a #ClutterInterval
- * @pspec: a #GParamSpec
- *
- * Validates the initial and final values of @interval against
- * a #GParamSpec.
- *
- * Return value: %TRUE if the #ClutterInterval is valid, %FALSE otherwise
- *
- * Since: 1.0
- */
-gboolean
-clutter_interval_validate (ClutterInterval *interval,
- GParamSpec *pspec)
-{
- g_return_val_if_fail (CLUTTER_IS_INTERVAL (interval), FALSE);
- g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE);
-
- return CLUTTER_INTERVAL_GET_CLASS (interval)->validate (interval, pspec);
-}
-
-/**
- * clutter_interval_compute_value:
- * @interval: a #ClutterInterval
- * @factor: the progress factor, between 0 and 1
- * @value: (out caller-allocates): return location for an initialized #GValue
- *
- * Computes the value between the @interval boundaries given the
- * progress @factor and copies it into @value.
- *
- * Return value: %TRUE if the operation was successful
- *
- * Since: 1.0
- */
-gboolean
-clutter_interval_compute_value (ClutterInterval *interval,
- gdouble factor,
- GValue *value)
-{
- g_return_val_if_fail (CLUTTER_IS_INTERVAL (interval), FALSE);
- g_return_val_if_fail (value != NULL, FALSE);
-
- return CLUTTER_INTERVAL_GET_CLASS (interval)->compute_value (interval,
- factor,
- value);
-}
-
-/**
- * clutter_interval_compute:
- * @interval: a #ClutterInterval
- * @factor: the progress factor, between 0 and 1
- *
- * Computes the value between the @interval boundaries given the
- * progress @factor
- *
- * Unlike clutter_interval_compute_value(), this function will
- * return a const pointer to the computed value
- *
- * You should use this function if you immediately pass the computed
- * value to another function that makes a copy of it, like
- * g_object_set_property()
- *
- * Return value: (transfer none): a pointer to the computed value,
- * or %NULL if the computation was not successful
- *
- * Since: 1.4
- */
-const GValue *
-clutter_interval_compute (ClutterInterval *interval,
- gdouble factor)
-{
- GValue *value;
- gboolean res;
-
- g_return_val_if_fail (CLUTTER_IS_INTERVAL (interval), NULL);
-
- value = &(interval->priv->values[RESULT]);
-
- if (G_VALUE_TYPE (value) == G_TYPE_INVALID)
- g_value_init (value, interval->priv->value_type);
-
- res = CLUTTER_INTERVAL_GET_CLASS (interval)->compute_value (interval,
- factor,
- value);
-
- if (res)
- return interval->priv->values + RESULT;
-
- return NULL;
-}
-
-/**
- * clutter_interval_is_valid:
- * @interval: a #ClutterInterval
- *
- * Checks if the @interval has a valid initial and final values.
- *
- * Return value: %TRUE if the #ClutterInterval has an initial and
- * final values, and %FALSE otherwise
- *
- * Since: 1.12
- */
-gboolean
-clutter_interval_is_valid (ClutterInterval *interval)
-{
- ClutterIntervalPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_INTERVAL (interval), FALSE);
-
- priv = interval->priv;
-
- return G_IS_VALUE (&priv->values[INITIAL]) &&
- G_IS_VALUE (&priv->values[FINAL]);
-}
diff --git a/clutter/clutter/clutter-interval.h b/clutter/clutter/clutter-interval.h
deleted file mode 100644
index 99b0cc099..000000000
--- a/clutter/clutter/clutter-interval.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2008 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_INTERVAL_H__
-#define __CLUTTER_INTERVAL_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-types.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_INTERVAL (clutter_interval_get_type ())
-#define CLUTTER_INTERVAL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_INTERVAL, ClutterInterval))
-#define CLUTTER_IS_INTERVAL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_INTERVAL))
-#define CLUTTER_INTERVAL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_INTERVAL, ClutterIntervalClass))
-#define CLUTTER_IS_INTERVAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_INTERVAL))
-#define CLUTTER_INTERVAL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_INTERVAL, ClutterIntervalClass))
-
-typedef struct _ClutterIntervalPrivate ClutterIntervalPrivate;
-typedef struct _ClutterIntervalClass ClutterIntervalClass;
-
-/**
- * ClutterInterval:
- *
- * The #ClutterInterval structure contains only private data and should
- * be accessed using the provided functions.
- *
- * Since: 1.0
- */
-struct _ClutterInterval
-{
- /*< private >*/
- GInitiallyUnowned parent_instance;
-
- ClutterIntervalPrivate *priv;
-};
-
-/**
- * ClutterIntervalClass:
- * @validate: virtual function for validating an interval
- * using a #GParamSpec
- * @compute_value: virtual function for computing the value
- * inside an interval using an adimensional factor between 0 and 1
- *
- * The #ClutterIntervalClass contains only private data.
- *
- * Since: 1.0
- */
-struct _ClutterIntervalClass
-{
- /*< private >*/
- GInitiallyUnownedClass parent_class;
-
- /*< public >*/
- gboolean (* validate) (ClutterInterval *interval,
- GParamSpec *pspec);
- gboolean (* compute_value) (ClutterInterval *interval,
- gdouble factor,
- GValue *value);
-
- /*< private >*/
- /* padding for future expansion */
- void (*_clutter_reserved1) (void);
- void (*_clutter_reserved2) (void);
- void (*_clutter_reserved3) (void);
- void (*_clutter_reserved4) (void);
- void (*_clutter_reserved5) (void);
- void (*_clutter_reserved6) (void);
-};
-
-CLUTTER_EXPORT
-GType clutter_interval_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterInterval *clutter_interval_new (GType gtype,
- ...);
-CLUTTER_EXPORT
-ClutterInterval *clutter_interval_new_with_values (GType gtype,
- const GValue *initial,
- const GValue *final);
-
-CLUTTER_EXPORT
-ClutterInterval *clutter_interval_clone (ClutterInterval *interval);
-
-CLUTTER_EXPORT
-GType clutter_interval_get_value_type (ClutterInterval *interval);
-
-CLUTTER_EXPORT
-void clutter_interval_set_initial (ClutterInterval *interval,
- ...);
-CLUTTER_EXPORT
-void clutter_interval_set_initial_value (ClutterInterval *interval,
- const GValue *value);
-CLUTTER_EXPORT
-void clutter_interval_get_initial_value (ClutterInterval *interval,
- GValue *value);
-CLUTTER_EXPORT
-GValue * clutter_interval_peek_initial_value (ClutterInterval *interval);
-CLUTTER_EXPORT
-void clutter_interval_set_final (ClutterInterval *interval,
- ...);
-CLUTTER_EXPORT
-void clutter_interval_set_final_value (ClutterInterval *interval,
- const GValue *value);
-CLUTTER_EXPORT
-void clutter_interval_get_final_value (ClutterInterval *interval,
- GValue *value);
-CLUTTER_EXPORT
-GValue * clutter_interval_peek_final_value (ClutterInterval *interval);
-
-CLUTTER_EXPORT
-void clutter_interval_set_interval (ClutterInterval *interval,
- ...);
-CLUTTER_EXPORT
-void clutter_interval_get_interval (ClutterInterval *interval,
- ...);
-
-CLUTTER_EXPORT
-gboolean clutter_interval_validate (ClutterInterval *interval,
- GParamSpec *pspec);
-CLUTTER_EXPORT
-gboolean clutter_interval_compute_value (ClutterInterval *interval,
- gdouble factor,
- GValue *value);
-
-CLUTTER_EXPORT
-const GValue * clutter_interval_compute (ClutterInterval *interval,
- gdouble factor);
-
-CLUTTER_EXPORT
-gboolean clutter_interval_is_valid (ClutterInterval *interval);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_INTERVAL_H__ */
diff --git a/clutter/clutter/clutter-keyframe-transition.c b/clutter/clutter/clutter-keyframe-transition.c
deleted file mode 100644
index d278109cb..000000000
--- a/clutter/clutter/clutter-keyframe-transition.c
+++ /dev/null
@@ -1,729 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2012 Intel Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author: Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-keyframe-transition
- * @Title: ClutterKeyframeTransition
- * @Short_Description: Keyframe property transition
- *
- * #ClutterKeyframeTransition allows animating a property by defining
- * "key frames": values at a normalized position on the transition
- * duration.
- *
- * The #ClutterKeyframeTransition interpolates the value of the property
- * to which it's bound across these key values.
- *
- * Setting up a #ClutterKeyframeTransition means providing the times,
- * values, and easing modes between these key frames, for instance:
- *
- * |[
- * ClutterTransition *keyframe;
- *
- * keyframe = clutter_keyframe_transition_new ("opacity");
- * clutter_transition_set_from (keyframe, G_TYPE_UINT, 255);
- * clutter_transition_set_to (keyframe, G_TYPE_UINT, 0);
- * clutter_keyframe_transition_set (CLUTTER_KEYFRAME_TRANSITION (keyframe),
- * G_TYPE_UINT,
- * 1, /&ast; number of key frames &ast;/
- * 0.5, 128, CLUTTER_EASE_IN_OUT_CUBIC);
- * ]|
- *
- * The example above sets up a keyframe transition for the #ClutterActor:opacity
- * property of a #ClutterActor; the transition starts and sets the value of the
- * property to fully transparent; between the start of the transition and its mid
- * point, it will animate the property to half opacity, using an easy in/easy out
- * progress. Once the transition reaches the mid point, it will linearly fade the
- * actor out until it reaches the end of the transition.
- *
- * The #ClutterKeyframeTransition will add an implicit key frame between the last
- * and the 1.0 value, to interpolate to the final value of the transition's
- * interval.
- *
- * #ClutterKeyframeTransition is available since Clutter 1.12.
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-keyframe-transition.h"
-
-#include "clutter-debug.h"
-#include "clutter-easing.h"
-#include "clutter-interval.h"
-#include "clutter-private.h"
-#include "clutter-timeline.h"
-
-#include <math.h>
-#include <gobject/gvaluecollector.h>
-
-typedef struct _KeyFrame
-{
- double key;
-
- double start;
- double end;
-
- ClutterAnimationMode mode;
-
- ClutterInterval *interval;
-} KeyFrame;
-
-struct _ClutterKeyframeTransitionPrivate
-{
- GArray *frames;
-
- gint current_frame;
-};
-
-G_DEFINE_TYPE_WITH_PRIVATE (ClutterKeyframeTransition,
- clutter_keyframe_transition,
- CLUTTER_TYPE_PROPERTY_TRANSITION)
-
-static void
-key_frame_free (gpointer data)
-{
- if (data != NULL)
- {
- KeyFrame *key = data;
-
- g_object_unref (key->interval);
- }
-}
-
-static int
-sort_by_key (gconstpointer a,
- gconstpointer b)
-{
- const KeyFrame *k_a = a;
- const KeyFrame *k_b = b;
-
- if (fabs (k_a->key - k_b->key) < 0.0001)
- return 0;
-
- if (k_a->key > k_b->key)
- return 1;
-
- return -1;
-}
-
-static inline void
-clutter_keyframe_transition_sort_frames (ClutterKeyframeTransition *transition)
-{
- if (transition->priv->frames != NULL)
- g_array_sort (transition->priv->frames, sort_by_key);
-}
-
-static inline void
-clutter_keyframe_transition_init_frames (ClutterKeyframeTransition *transition,
- gssize n_key_frames)
-{
- ClutterKeyframeTransitionPrivate *priv = transition->priv;
- guint i;
-
- priv->frames = g_array_sized_new (FALSE, FALSE,
- sizeof (KeyFrame),
- n_key_frames);
- g_array_set_clear_func (priv->frames, key_frame_free);
-
- /* we add an implicit key frame that goes to 1.0, so that the
- * user doesn't have to do that an can simply add key frames
- * in between 0.0 and 1.0
- */
- for (i = 0; i < n_key_frames + 1; i++)
- {
- KeyFrame frame;
-
- if (i == n_key_frames)
- frame.key = 1.0;
- else
- frame.key = 0.0;
-
- frame.mode = CLUTTER_LINEAR;
- frame.interval = NULL;
-
- g_array_insert_val (priv->frames, i, frame);
- }
-}
-
-static inline void
-clutter_keyframe_transition_update_frames (ClutterKeyframeTransition *transition)
-{
- ClutterKeyframeTransitionPrivate *priv = transition->priv;
- guint i;
-
- if (priv->frames == NULL)
- return;
-
- for (i = 0; i < priv->frames->len; i++)
- {
- KeyFrame *cur_frame = &g_array_index (priv->frames, KeyFrame, i);
- KeyFrame *prev_frame;
-
- if (i > 0)
- prev_frame = &g_array_index (priv->frames, KeyFrame, i - 1);
- else
- prev_frame = NULL;
-
- if (prev_frame != NULL)
- {
- cur_frame->start = prev_frame->key;
-
- if (prev_frame->interval != NULL)
- {
- const GValue *value;
-
- value = clutter_interval_peek_final_value (prev_frame->interval);
-
- if (cur_frame->interval != NULL)
- clutter_interval_set_initial_value (cur_frame->interval, value);
- else
- {
- cur_frame->interval =
- clutter_interval_new_with_values (G_VALUE_TYPE (value), value, NULL);
- }
- }
- }
- else
- cur_frame->start = 0.0;
-
- cur_frame->end = cur_frame->key;
- }
-}
-
-static void
-clutter_keyframe_transition_compute_value (ClutterTransition *transition,
- ClutterAnimatable *animatable,
- ClutterInterval *interval,
- gdouble progress)
-{
- ClutterKeyframeTransition *self = CLUTTER_KEYFRAME_TRANSITION (transition);
- ClutterTimeline *timeline = CLUTTER_TIMELINE (transition);
- ClutterKeyframeTransitionPrivate *priv = self->priv;
- ClutterTransitionClass *parent_class;
- ClutterTimelineDirection direction;
- ClutterInterval *real_interval;
- gdouble real_progress;
- double t, d, p;
- KeyFrame *cur_frame = NULL;
-
- real_interval = interval;
- real_progress = progress;
-
- /* if we don't have any keyframe, we behave like our parent class */
- if (priv->frames == NULL)
- goto out;
-
- direction = clutter_timeline_get_direction (timeline);
-
- /* we need a normalized linear value */
- t = clutter_timeline_get_elapsed_time (timeline);
- d = clutter_timeline_get_duration (timeline);
- p = t / d;
-
- if (priv->current_frame < 0)
- {
- if (direction == CLUTTER_TIMELINE_FORWARD)
- priv->current_frame = 0;
- else
- priv->current_frame = priv->frames->len - 1;
- }
-
- cur_frame = &g_array_index (priv->frames, KeyFrame, priv->current_frame);
-
- /* skip to the next key frame, depending on the direction of the timeline */
- if (direction == CLUTTER_TIMELINE_FORWARD)
- {
- if (p > cur_frame->end)
- {
- priv->current_frame = MIN (priv->current_frame + 1,
- priv->frames->len - 1);
-
- cur_frame = &g_array_index (priv->frames, KeyFrame, priv->current_frame);
- }
- }
- else
- {
- if (p < cur_frame->start)
- {
- priv->current_frame = MAX (priv->current_frame - 1, 0);
-
- cur_frame = &g_array_index (priv->frames, KeyFrame, priv->current_frame);
- }
- }
-
- /* if we are at the boundaries of the transition, use the from and to
- * value from the transition
- */
- if (priv->current_frame == 0)
- {
- const GValue *value;
-
- value = clutter_interval_peek_initial_value (interval);
- clutter_interval_set_initial_value (cur_frame->interval, value);
- }
- else if (priv->current_frame == priv->frames->len - 1)
- {
- const GValue *value;
-
- cur_frame->mode = clutter_timeline_get_progress_mode (timeline);
-
- value = clutter_interval_peek_final_value (interval);
- clutter_interval_set_final_value (cur_frame->interval, value);
- }
-
- /* update the interval to be used to interpolate the property */
- real_interval = cur_frame->interval;
-
- /* normalize the progress and apply the easing mode */
- real_progress = clutter_easing_for_mode ( cur_frame->mode, (p - cur_frame->start), (cur_frame->end - cur_frame->start));
-
-#ifdef CLUTTER_ENABLE_DEBUG
- if (CLUTTER_HAS_DEBUG (ANIMATION))
- {
- char *from, *to;
- const GValue *value;
-
- value = clutter_interval_peek_initial_value (cur_frame->interval);
- from = g_strdup_value_contents (value);
-
- value = clutter_interval_peek_final_value (cur_frame->interval);
- to = g_strdup_value_contents (value);
-
- CLUTTER_NOTE (ANIMATION,
- "cur_frame [%d] => { %g, %s, %s %s %s } - "
- "progress: %g, sub-progress: %g\n",
- priv->current_frame,
- cur_frame->key,
- clutter_get_easing_name_for_mode (cur_frame->mode),
- from,
- direction == CLUTTER_TIMELINE_FORWARD ? "->" : "<-",
- to,
- p, real_progress);
-
- g_free (from);
- g_free (to);
- }
-#endif /* CLUTTER_ENABLE_DEBUG */
-
-out:
- parent_class =
- CLUTTER_TRANSITION_CLASS (clutter_keyframe_transition_parent_class);
- parent_class->compute_value (transition, animatable, real_interval, real_progress);
-}
-
-static void
-clutter_keyframe_transition_started (ClutterTimeline *timeline)
-{
- ClutterKeyframeTransition *transition;
-
- transition = CLUTTER_KEYFRAME_TRANSITION (timeline);
-
- transition->priv->current_frame = -1;
-
- clutter_keyframe_transition_sort_frames (transition);
- clutter_keyframe_transition_update_frames (transition);
-}
-
-static void
-clutter_keyframe_transition_completed (ClutterTimeline *timeline)
-{
- ClutterKeyframeTransitionPrivate *priv;
-
- priv = CLUTTER_KEYFRAME_TRANSITION (timeline)->priv;
-
- priv->current_frame = -1;
-}
-
-static void
-clutter_keyframe_transition_finalize (GObject *gobject)
-{
- ClutterKeyframeTransitionPrivate *priv;
-
- priv = CLUTTER_KEYFRAME_TRANSITION (gobject)->priv;
-
- if (priv->frames != NULL)
- g_array_unref (priv->frames);
-
- G_OBJECT_CLASS (clutter_keyframe_transition_parent_class)->finalize (gobject);
-}
-
-static void
-clutter_keyframe_transition_class_init (ClutterKeyframeTransitionClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- ClutterTimelineClass *timeline_class = CLUTTER_TIMELINE_CLASS (klass);
- ClutterTransitionClass *transition_class = CLUTTER_TRANSITION_CLASS (klass);
-
- gobject_class->finalize = clutter_keyframe_transition_finalize;
-
- timeline_class->started = clutter_keyframe_transition_started;
- timeline_class->completed = clutter_keyframe_transition_completed;
-
- transition_class->compute_value = clutter_keyframe_transition_compute_value;
-}
-
-static void
-clutter_keyframe_transition_init (ClutterKeyframeTransition *self)
-{
- self->priv = clutter_keyframe_transition_get_instance_private (self);
-}
-
-/**
- * clutter_keyframe_transition_new:
- * @property_name: the property to animate
- *
- * Creates a new #ClutterKeyframeTransition for @property_name.
- *
- * Return value: (transfer full): the newly allocated
- * #ClutterKeyframeTransition instance. Use g_object_unref() when
- * done to free its resources.
- *
- * Since: 1.12
- */
-ClutterTransition *
-clutter_keyframe_transition_new (const char *property_name)
-{
- return g_object_new (CLUTTER_TYPE_KEYFRAME_TRANSITION,
- "property-name", property_name,
- NULL);
-}
-
-/**
- * clutter_keyframe_transition_set_key_frames:
- * @transition: a #ClutterKeyframeTransition
- * @n_key_frames: the number of values
- * @key_frames: (array length=n_key_frames): an array of keys between 0.0
- * and 1.0, one for each key frame
- *
- * Sets the keys for each key frame inside @transition.
- *
- * If @transition does not hold any key frame, @n_key_frames key frames
- * will be created; if @transition already has key frames, @key_frames must
- * have at least as many elements as the number of key frames.
- *
- * Since: 1.12
- */
-void
-clutter_keyframe_transition_set_key_frames (ClutterKeyframeTransition *transition,
- guint n_key_frames,
- const double *key_frames)
-{
- ClutterKeyframeTransitionPrivate *priv;
- guint i;
-
- g_return_if_fail (CLUTTER_IS_KEYFRAME_TRANSITION (transition));
- g_return_if_fail (n_key_frames > 0);
- g_return_if_fail (key_frames != NULL);
-
- priv = transition->priv;
-
- if (priv->frames == NULL)
- clutter_keyframe_transition_init_frames (transition, n_key_frames);
- else
- g_return_if_fail (n_key_frames == priv->frames->len - 1);
-
- for (i = 0; i < n_key_frames; i++)
- {
- KeyFrame *frame = &g_array_index (priv->frames, KeyFrame, i);
-
- frame->key = key_frames[i];
- }
-}
-
-/**
- * clutter_keyframe_transition_set_values:
- * @transition: a #ClutterKeyframeTransition
- * @n_values: the number of values
- * @values: (array length=n_values): an array of values, one for each
- * key frame
- *
- * Sets the values for each key frame inside @transition.
- *
- * If @transition does not hold any key frame, @n_values key frames will
- * be created; if @transition already has key frames, @values must have
- * at least as many elements as the number of key frames.
- *
- * Since: 1.12
- */
-void
-clutter_keyframe_transition_set_values (ClutterKeyframeTransition *transition,
- guint n_values,
- const GValue *values)
-{
- ClutterKeyframeTransitionPrivate *priv;
- guint i;
-
- g_return_if_fail (CLUTTER_IS_KEYFRAME_TRANSITION (transition));
- g_return_if_fail (n_values > 0);
- g_return_if_fail (values != NULL);
-
- priv = transition->priv;
-
- if (priv->frames == NULL)
- clutter_keyframe_transition_init_frames (transition, n_values);
- else
- g_return_if_fail (n_values == priv->frames->len - 1);
-
- for (i = 0; i < n_values; i++)
- {
- KeyFrame *frame = &g_array_index (priv->frames, KeyFrame, i);
-
- if (frame->interval)
- clutter_interval_set_final_value (frame->interval, &values[i]);
- else
- frame->interval =
- clutter_interval_new_with_values (G_VALUE_TYPE (&values[i]), NULL,
- &values[i]);
- }
-}
-
-/**
- * clutter_keyframe_transition_set_modes:
- * @transition: a #ClutterKeyframeTransition
- * @n_modes: the number of easing modes
- * @modes: (array length=n_modes): an array of easing modes, one for
- * each key frame
- *
- * Sets the easing modes for each key frame inside @transition.
- *
- * If @transition does not hold any key frame, @n_modes key frames will
- * be created; if @transition already has key frames, @modes must have
- * at least as many elements as the number of key frames.
- *
- * Since: 1.12
- */
-void
-clutter_keyframe_transition_set_modes (ClutterKeyframeTransition *transition,
- guint n_modes,
- const ClutterAnimationMode *modes)
-{
- ClutterKeyframeTransitionPrivate *priv;
- guint i;
-
- g_return_if_fail (CLUTTER_IS_KEYFRAME_TRANSITION (transition));
- g_return_if_fail (n_modes > 0);
- g_return_if_fail (modes != NULL);
-
- priv = transition->priv;
-
- if (priv->frames == NULL)
- clutter_keyframe_transition_init_frames (transition, n_modes);
- else
- g_return_if_fail (n_modes == priv->frames->len - 1);
-
- for (i = 0; i < n_modes; i++)
- {
- KeyFrame *frame = &g_array_index (priv->frames, KeyFrame, i);
-
- frame->mode = modes[i];
- }
-}
-
-/**
- * clutter_keyframe_transition_set: (skip)
- * @transition: a #ClutterKeyframeTransition
- * @gtype: the type of the values to use for the key frames
- * @n_key_frames: the number of key frames between the initial
- * and final values
- * @...: a list of tuples, containing the key frame index, the value
- * at the key frame, and the animation mode
- *
- * Sets the key frames of the @transition.
- *
- * This variadic arguments function is a convenience for C developers;
- * language bindings should use clutter_keyframe_transition_set_key_frames(),
- * clutter_keyframe_transition_set_modes(), and
- * clutter_keyframe_transition_set_values() instead.
- *
- * Since: 1.12
- */
-void
-clutter_keyframe_transition_set (ClutterKeyframeTransition *transition,
- GType gtype,
- guint n_key_frames,
- ...)
-{
- ClutterKeyframeTransitionPrivate *priv;
- va_list args;
- guint i;
-
- g_return_if_fail (CLUTTER_IS_KEYFRAME_TRANSITION (transition));
- g_return_if_fail (gtype != G_TYPE_INVALID);
- g_return_if_fail (n_key_frames > 0);
-
- priv = transition->priv;
-
- if (priv->frames == NULL)
- clutter_keyframe_transition_init_frames (transition, n_key_frames);
- else
- g_return_if_fail (n_key_frames == priv->frames->len - 1);
-
- va_start (args, n_key_frames);
-
- for (i = 0; i < n_key_frames; i++)
- {
- KeyFrame *frame = &g_array_index (priv->frames, KeyFrame, i);
- GValue value = G_VALUE_INIT;
- char *error = NULL;
-
- frame->key = va_arg (args, double);
-
- G_VALUE_COLLECT_INIT (&value, gtype, args, 0, &error);
- if (error != NULL)
- {
- g_warning ("%s: %s", G_STRLOC, error);
- g_free (error);
- break;
- }
-
- frame->mode = va_arg (args, ClutterAnimationMode);
-
- g_clear_object (&frame->interval);
- frame->interval = clutter_interval_new_with_values (gtype, NULL, &value);
-
- g_value_unset (&value);
- }
-
- va_end (args);
-}
-
-/**
- * clutter_keyframe_transition_clear:
- * @transition: a #ClutterKeyframeTransition
- *
- * Removes all key frames from @transition.
- *
- * Since: 1.12
- */
-void
-clutter_keyframe_transition_clear (ClutterKeyframeTransition *transition)
-{
- g_return_if_fail (CLUTTER_IS_KEYFRAME_TRANSITION (transition));
-
- if (transition->priv->frames != NULL)
- {
- g_array_unref (transition->priv->frames);
- transition->priv->frames = NULL;
- }
-}
-
-/**
- * clutter_keyframe_transition_get_n_key_frames:
- * @transition: a #ClutterKeyframeTransition
- *
- * Retrieves the number of key frames inside @transition.
- *
- * Return value: the number of key frames
- *
- * Since: 1.12
- */
-guint
-clutter_keyframe_transition_get_n_key_frames (ClutterKeyframeTransition *transition)
-{
- g_return_val_if_fail (CLUTTER_IS_KEYFRAME_TRANSITION (transition), 0);
-
- if (transition->priv->frames == NULL)
- return 0;
-
- return transition->priv->frames->len - 1;
-}
-
-/**
- * clutter_keyframe_transition_set_key_frame:
- * @transition: a #ClutterKeyframeTransition
- * @index_: the index of the key frame
- * @key: the key of the key frame
- * @mode: the easing mode of the key frame
- * @value: a #GValue containing the value of the key frame
- *
- * Sets the details of the key frame at @index_ inside @transition.
- *
- * The @transition must already have a key frame at @index_, and @index_
- * must be smaller than the number of key frames inside @transition.
- *
- * Since: 1.12
- */
-void
-clutter_keyframe_transition_set_key_frame (ClutterKeyframeTransition *transition,
- guint index_,
- double key,
- ClutterAnimationMode mode,
- const GValue *value)
-{
- ClutterKeyframeTransitionPrivate *priv;
- KeyFrame *frame;
-
- g_return_if_fail (CLUTTER_IS_KEYFRAME_TRANSITION (transition));
-
- priv = transition->priv;
- g_return_if_fail (priv->frames != NULL);
- g_return_if_fail (index_ < priv->frames->len - 1);
-
- frame = &g_array_index (priv->frames, KeyFrame, index_);
- frame->key = key;
- frame->mode = mode;
- clutter_interval_set_final_value (frame->interval, value);
-}
-
-/**
- * clutter_keyframe_transition_get_key_frame:
- * @transition: a #ClutterKeyframeTransition
- * @index_: the index of the key frame
- * @key: (out) (allow-none): return location for the key, or %NULL
- * @mode: (out) (allow-none): return location for the easing mode, or %NULL
- * @value: (out caller-allocates): a #GValue initialized with the type of
- * the values
- *
- * Retrieves the details of the key frame at @index_ inside @transition.
- *
- * The @transition must already have key frames set, and @index_ must be
- * smaller than the number of key frames.
- *
- * Since: 1.12
- */
-void
-clutter_keyframe_transition_get_key_frame (ClutterKeyframeTransition *transition,
- guint index_,
- double *key,
- ClutterAnimationMode *mode,
- GValue *value)
-{
- ClutterKeyframeTransitionPrivate *priv;
- const KeyFrame *frame;
-
- g_return_if_fail (CLUTTER_IS_KEYFRAME_TRANSITION (transition));
-
- priv = transition->priv;
- g_return_if_fail (priv->frames != NULL);
- g_return_if_fail (index_ < priv->frames->len - 1);
-
- frame = &g_array_index (priv->frames, KeyFrame, index_);
-
- if (key != NULL)
- *key = frame->key;
-
- if (mode != NULL)
- *mode = frame->mode;
-
- if (value != NULL)
- clutter_interval_get_final_value (frame->interval, value);
-}
diff --git a/clutter/clutter/clutter-keyframe-transition.h b/clutter/clutter/clutter-keyframe-transition.h
deleted file mode 100644
index 2b3746f71..000000000
--- a/clutter/clutter/clutter-keyframe-transition.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2012 Intel Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author: Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_KEYFRAME_TRANSITION_H__
-#define __CLUTTER_KEYFRAME_TRANSITION_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-types.h>
-#include <clutter/clutter-property-transition.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_KEYFRAME_TRANSITION (clutter_keyframe_transition_get_type ())
-#define CLUTTER_KEYFRAME_TRANSITION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_KEYFRAME_TRANSITION, ClutterKeyframeTransition))
-#define CLUTTER_IS_KEYFRAME_TRANSITION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_KEYFRAME_TRANSITION))
-#define CLUTTER_KEYFRAME_TRANSITION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_KEYFRAME_TRANSITION, ClutterKeyframeTransitionClass))
-#define CLUTTER_IS_KEYFRAME_TRANSITION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_KEYFRAME_TRANSITION))
-#define CLUTTER_KEYFRAME_TRANSITION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_KEYFRAME_TRANSITION, ClutterKeyframeTransitionClass))
-
-typedef struct _ClutterKeyframeTransitionPrivate ClutterKeyframeTransitionPrivate;
-typedef struct _ClutterKeyframeTransitionClass ClutterKeyframeTransitionClass;
-
-/**
- * ClutterKeyframeTransition:
- *
- * The `ClutterKeyframeTransition` structure contains only private
- * data and should be accessed using the provided API.
- *
- * Since: 1.12
- */
-struct _ClutterKeyframeTransition
-{
- /*< private >*/
- ClutterPropertyTransition parent_instance;
-
- ClutterKeyframeTransitionPrivate *priv;
-};
-
-/**
- * ClutterKeyframeTransitionClass:
- *
- * The `ClutterKeyframeTransitionClass` structure contains only
- * private data.
- *
- * Since: 1.12
- */
-struct _ClutterKeyframeTransitionClass
-{
- /*< private >*/
- ClutterPropertyTransitionClass parent_class;
-
- gpointer _padding[8];
-};
-
-CLUTTER_EXPORT
-GType clutter_keyframe_transition_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterTransition * clutter_keyframe_transition_new (const char *property_name);
-
-CLUTTER_EXPORT
-void clutter_keyframe_transition_set_key_frames (ClutterKeyframeTransition *transition,
- guint n_key_frames,
- const double *key_frames);
-CLUTTER_EXPORT
-void clutter_keyframe_transition_set_values (ClutterKeyframeTransition *transition,
- guint n_values,
- const GValue *values);
-CLUTTER_EXPORT
-void clutter_keyframe_transition_set_modes (ClutterKeyframeTransition *transition,
- guint n_modes,
- const ClutterAnimationMode *modes);
-CLUTTER_EXPORT
-void clutter_keyframe_transition_set (ClutterKeyframeTransition *transition,
- GType gtype,
- guint n_key_frames,
- ...);
-
-CLUTTER_EXPORT
-void clutter_keyframe_transition_set_key_frame (ClutterKeyframeTransition *transition,
- guint index_,
- double key,
- ClutterAnimationMode mode,
- const GValue *value);
-CLUTTER_EXPORT
-void clutter_keyframe_transition_get_key_frame (ClutterKeyframeTransition *transition,
- guint index_,
- double *key,
- ClutterAnimationMode *mode,
- GValue *value);
-CLUTTER_EXPORT
-guint clutter_keyframe_transition_get_n_key_frames (ClutterKeyframeTransition *transition);
-
-CLUTTER_EXPORT
-void clutter_keyframe_transition_clear (ClutterKeyframeTransition *transition);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_KEYFRAME_TRANSITION_H__ */
diff --git a/clutter/clutter/clutter-keymap-private.h b/clutter/clutter/clutter-keymap-private.h
deleted file mode 100644
index 2268e63f2..000000000
--- a/clutter/clutter/clutter-keymap-private.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2021 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.
- *
- */
-
-#ifndef CLUTTER_KEYMAP_PRIVATE_H
-#define CLUTTER_KEYMAP_PRIVATE_H
-
-#include "clutter/clutter-keymap.h"
-
-CLUTTER_EXPORT
-void clutter_keymap_set_lock_modifier_state (ClutterKeymap *keymap,
- gboolean caps_lock_state,
- gboolean num_lock_state);
-
-#endif /* CLUTTER_KEYMAP_PRIVATE_H */
diff --git a/clutter/clutter/clutter-keymap.c b/clutter/clutter/clutter-keymap.c
deleted file mode 100644
index 1f1041fe0..000000000
--- a/clutter/clutter/clutter-keymap.c
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright (C) 2018 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: Carlos Garnacho <carlosg@gnome.org>
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-keymap-private.h"
-#include "clutter-private.h"
-
-enum
-{
- PROP_0,
-
- PROP_CAPS_LOCK_STATE,
- PROP_NUM_LOCK_STATE,
-
- N_PROPS
-};
-
-static GParamSpec *obj_props[N_PROPS];
-
-typedef struct _ClutterKeymapPrivate
-{
- gboolean caps_lock_state;
- gboolean num_lock_state;
-} ClutterKeymapPrivate;
-
-G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterKeymap, clutter_keymap,
- G_TYPE_OBJECT)
-
-enum
-{
- STATE_CHANGED,
- N_SIGNALS
-};
-
-static guint signals[N_SIGNALS] = { 0, };
-
-static void
-clutter_keymap_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterKeymap *keymap = CLUTTER_KEYMAP (object);
- ClutterKeymapPrivate *priv = clutter_keymap_get_instance_private (keymap);
-
- switch (prop_id)
- {
- case PROP_CAPS_LOCK_STATE:
- g_value_set_boolean (value, priv->caps_lock_state);
- break;
- case PROP_NUM_LOCK_STATE:
- g_value_set_boolean (value, priv->num_lock_state);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_keymap_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterKeymap *keymap = CLUTTER_KEYMAP (object);
- ClutterKeymapPrivate *priv = clutter_keymap_get_instance_private (keymap);
-
- switch (prop_id)
- {
- case PROP_CAPS_LOCK_STATE:
- priv->caps_lock_state = g_value_get_boolean (value);
- break;
- case PROP_NUM_LOCK_STATE:
- priv->num_lock_state = g_value_get_boolean (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_keymap_class_init (ClutterKeymapClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->get_property = clutter_keymap_get_property;
- object_class->set_property = clutter_keymap_set_property;
-
- obj_props[PROP_CAPS_LOCK_STATE] =
- g_param_spec_boolean ("caps-lock-state",
- "Caps lock state",
- "Caps lock state",
- FALSE,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS);
- obj_props[PROP_NUM_LOCK_STATE] =
- g_param_spec_boolean ("num-lock-state",
- "Num lock state",
- "Num lock state",
- FALSE,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_properties (object_class, N_PROPS, obj_props);
-
- signals[STATE_CHANGED] =
- g_signal_new (I_("state-changed"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- 0, NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-}
-
-static void
-clutter_keymap_init (ClutterKeymap *keymap)
-{
-}
-
-gboolean
-clutter_keymap_get_num_lock_state (ClutterKeymap *keymap)
-{
- ClutterKeymapPrivate *priv = clutter_keymap_get_instance_private (keymap);
-
- return priv->num_lock_state;
-}
-
-gboolean
-clutter_keymap_get_caps_lock_state (ClutterKeymap *keymap)
-{
- ClutterKeymapPrivate *priv = clutter_keymap_get_instance_private (keymap);
-
- return priv->caps_lock_state;
-}
-
-PangoDirection
-clutter_keymap_get_direction (ClutterKeymap *keymap)
-{
- return CLUTTER_KEYMAP_GET_CLASS (keymap)->get_direction (keymap);
-}
-
-void
-clutter_keymap_set_lock_modifier_state (ClutterKeymap *keymap,
- gboolean caps_lock_state,
- gboolean num_lock_state)
-{
- ClutterKeymapPrivate *priv = clutter_keymap_get_instance_private (keymap);
-
- if (priv->caps_lock_state == caps_lock_state &&
- priv->num_lock_state == num_lock_state)
- return;
-
- if (priv->caps_lock_state != caps_lock_state)
- {
- priv->caps_lock_state = caps_lock_state;
- g_object_notify_by_pspec (G_OBJECT (keymap),
- obj_props[PROP_CAPS_LOCK_STATE]);
- }
-
- if (priv->num_lock_state != num_lock_state)
- {
- priv->num_lock_state = num_lock_state;
- g_object_notify_by_pspec (G_OBJECT (keymap),
- obj_props[PROP_NUM_LOCK_STATE]);
- }
-
- g_debug ("Locks state changed - Num: %s, Caps: %s",
- priv->num_lock_state ? "set" : "unset",
- priv->caps_lock_state ? "set" : "unset");
-
- g_signal_emit (keymap, signals[STATE_CHANGED], 0);
-}
diff --git a/clutter/clutter/clutter-keymap.h b/clutter/clutter/clutter-keymap.h
deleted file mode 100644
index 3e317f6a1..000000000
--- a/clutter/clutter/clutter-keymap.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2018 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: Carlos Garnacho <carlosg@gnome.org>
- */
-
-#ifndef CLUTTER_KEYMAP_H
-#define CLUTTER_KEYMAP_H
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-macros.h>
-
-#include <glib-object.h>
-#include <pango/pango.h>
-
-typedef struct _ClutterKeymap ClutterKeymap;
-typedef struct _ClutterKeymapClass ClutterKeymapClass;
-
-struct _ClutterKeymapClass
-{
- GObjectClass parent_class;
-
- PangoDirection (* get_direction) (ClutterKeymap *keymap);
-};
-
-#define CLUTTER_TYPE_KEYMAP (clutter_keymap_get_type ())
-CLUTTER_EXPORT
-G_DECLARE_DERIVABLE_TYPE (ClutterKeymap, clutter_keymap,
- CLUTTER, KEYMAP,
- GObject)
-
-CLUTTER_EXPORT
-gboolean clutter_keymap_get_num_lock_state (ClutterKeymap *keymap);
-
-CLUTTER_EXPORT
-gboolean clutter_keymap_get_caps_lock_state (ClutterKeymap *keymap);
-
-PangoDirection clutter_keymap_get_direction (ClutterKeymap *keymap);
-
-#endif /* CLUTTER_KEYMAP_H */
diff --git a/clutter/clutter/clutter-keysyms-table.c b/clutter/clutter/clutter-keysyms-table.c
deleted file mode 100644
index 47931f0b2..000000000
--- a/clutter/clutter/clutter-keysyms-table.c
+++ /dev/null
@@ -1,1681 +0,0 @@
-#include "clutter-build-config.h"
-
-#include <glib.h>
-
-#include "clutter-event.h"
-
-/* Code below from GDK, which contains following comment:
- *
- * Thanks to Markus G. Kuhn <mkuhn@acm.org> for the ksysym<->Unicode
- * mapping functions, from the xterm sources.
- */
-static const struct {
- unsigned short keysym;
- unsigned short ucs;
-} clutter_keysym_to_unicode_tab[] = {
- { 0x01a1, 0x0104 }, /* Aogonek Ä„ LATIN CAPITAL LETTER A WITH OGONEK */
- { 0x01a2, 0x02d8 }, /* breve ˘ BREVE */
- { 0x01a3, 0x0141 }, /* Lstroke Å LATIN CAPITAL LETTER L WITH STROKE */
- { 0x01a5, 0x013d }, /* Lcaron Ľ LATIN CAPITAL LETTER L WITH CARON */
- { 0x01a6, 0x015a }, /* Sacute Åš LATIN CAPITAL LETTER S WITH ACUTE */
- { 0x01a9, 0x0160 }, /* Scaron Å  LATIN CAPITAL LETTER S WITH CARON */
- { 0x01aa, 0x015e }, /* Scedilla Åž LATIN CAPITAL LETTER S WITH CEDILLA */
- { 0x01ab, 0x0164 }, /* Tcaron Ť LATIN CAPITAL LETTER T WITH CARON */
- { 0x01ac, 0x0179 }, /* Zacute Ź LATIN CAPITAL LETTER Z WITH ACUTE */
- { 0x01ae, 0x017d }, /* Zcaron Ž LATIN CAPITAL LETTER Z WITH CARON */
- { 0x01af, 0x017b }, /* Zabovedot Å» LATIN CAPITAL LETTER Z WITH DOT ABOVE */
- { 0x01b1, 0x0105 }, /* aogonek Ä… LATIN SMALL LETTER A WITH OGONEK */
- { 0x01b2, 0x02db }, /* ogonek Ë› OGONEK */
- { 0x01b3, 0x0142 }, /* lstroke Å‚ LATIN SMALL LETTER L WITH STROKE */
- { 0x01b5, 0x013e }, /* lcaron ľ LATIN SMALL LETTER L WITH CARON */
- { 0x01b6, 0x015b }, /* sacute Å› LATIN SMALL LETTER S WITH ACUTE */
- { 0x01b7, 0x02c7 }, /* caron ˇ CARON */
- { 0x01b9, 0x0161 }, /* scaron Å¡ LATIN SMALL LETTER S WITH CARON */
- { 0x01ba, 0x015f }, /* scedilla ÅŸ LATIN SMALL LETTER S WITH CEDILLA */
- { 0x01bb, 0x0165 }, /* tcaron ť LATIN SMALL LETTER T WITH CARON */
- { 0x01bc, 0x017a }, /* zacute ź LATIN SMALL LETTER Z WITH ACUTE */
- { 0x01bd, 0x02dd }, /* doubleacute Ë DOUBLE ACUTE ACCENT */
- { 0x01be, 0x017e }, /* zcaron ž LATIN SMALL LETTER Z WITH CARON */
- { 0x01bf, 0x017c }, /* zabovedot ż LATIN SMALL LETTER Z WITH DOT ABOVE */
- { 0x01c0, 0x0154 }, /* Racute Å” LATIN CAPITAL LETTER R WITH ACUTE */
- { 0x01c3, 0x0102 }, /* Abreve Ä‚ LATIN CAPITAL LETTER A WITH BREVE */
- { 0x01c5, 0x0139 }, /* Lacute Ĺ LATIN CAPITAL LETTER L WITH ACUTE */
- { 0x01c6, 0x0106 }, /* Cacute Ć LATIN CAPITAL LETTER C WITH ACUTE */
- { 0x01c8, 0x010c }, /* Ccaron Č LATIN CAPITAL LETTER C WITH CARON */
- { 0x01ca, 0x0118 }, /* Eogonek Ę LATIN CAPITAL LETTER E WITH OGONEK */
- { 0x01cc, 0x011a }, /* Ecaron Äš LATIN CAPITAL LETTER E WITH CARON */
- { 0x01cf, 0x010e }, /* Dcaron ÄŽ LATIN CAPITAL LETTER D WITH CARON */
- { 0x01d0, 0x0110 }, /* Dstroke Ä LATIN CAPITAL LETTER D WITH STROKE */
- { 0x01d1, 0x0143 }, /* Nacute Ń LATIN CAPITAL LETTER N WITH ACUTE */
- { 0x01d2, 0x0147 }, /* Ncaron Ň LATIN CAPITAL LETTER N WITH CARON */
- { 0x01d5, 0x0150 }, /* Odoubleacute Å LATIN CAPITAL LETTER O WITH DOUBLE ACUTE */
- { 0x01d8, 0x0158 }, /* Rcaron Ř LATIN CAPITAL LETTER R WITH CARON */
- { 0x01d9, 0x016e }, /* Uring Å® LATIN CAPITAL LETTER U WITH RING ABOVE */
- { 0x01db, 0x0170 }, /* Udoubleacute Å° LATIN CAPITAL LETTER U WITH DOUBLE ACUTE */
- { 0x01de, 0x0162 }, /* Tcedilla Ţ LATIN CAPITAL LETTER T WITH CEDILLA */
- { 0x01e0, 0x0155 }, /* racute Å• LATIN SMALL LETTER R WITH ACUTE */
- { 0x01e3, 0x0103 }, /* abreve ă LATIN SMALL LETTER A WITH BREVE */
- { 0x01e5, 0x013a }, /* lacute ĺ LATIN SMALL LETTER L WITH ACUTE */
- { 0x01e6, 0x0107 }, /* cacute ć LATIN SMALL LETTER C WITH ACUTE */
- { 0x01e8, 0x010d }, /* ccaron Ä LATIN SMALL LETTER C WITH CARON */
- { 0x01ea, 0x0119 }, /* eogonek Ä™ LATIN SMALL LETTER E WITH OGONEK */
- { 0x01ec, 0x011b }, /* ecaron Ä› LATIN SMALL LETTER E WITH CARON */
- { 0x01ef, 0x010f }, /* dcaron Ä LATIN SMALL LETTER D WITH CARON */
- { 0x01f0, 0x0111 }, /* dstroke Ä‘ LATIN SMALL LETTER D WITH STROKE */
- { 0x01f1, 0x0144 }, /* nacute Å„ LATIN SMALL LETTER N WITH ACUTE */
- { 0x01f2, 0x0148 }, /* ncaron ň LATIN SMALL LETTER N WITH CARON */
- { 0x01f5, 0x0151 }, /* odoubleacute Å‘ LATIN SMALL LETTER O WITH DOUBLE ACUTE */
- { 0x01f8, 0x0159 }, /* rcaron Å™ LATIN SMALL LETTER R WITH CARON */
- { 0x01f9, 0x016f }, /* uring ů LATIN SMALL LETTER U WITH RING ABOVE */
- { 0x01fb, 0x0171 }, /* udoubleacute ű LATIN SMALL LETTER U WITH DOUBLE ACUTE */
- { 0x01fe, 0x0163 }, /* tcedilla ţ LATIN SMALL LETTER T WITH CEDILLA */
- { 0x01ff, 0x02d9 }, /* abovedot Ë™ DOT ABOVE */
- { 0x02a1, 0x0126 }, /* Hstroke Ħ LATIN CAPITAL LETTER H WITH STROKE */
- { 0x02a6, 0x0124 }, /* Hcircumflex Ĥ LATIN CAPITAL LETTER H WITH CIRCUMFLEX */
- { 0x02a9, 0x0130 }, /* Iabovedot Ä° LATIN CAPITAL LETTER I WITH DOT ABOVE */
- { 0x02ab, 0x011e }, /* Gbreve Äž LATIN CAPITAL LETTER G WITH BREVE */
- { 0x02ac, 0x0134 }, /* Jcircumflex Ä´ LATIN CAPITAL LETTER J WITH CIRCUMFLEX */
- { 0x02b1, 0x0127 }, /* hstroke ħ LATIN SMALL LETTER H WITH STROKE */
- { 0x02b6, 0x0125 }, /* hcircumflex ĥ LATIN SMALL LETTER H WITH CIRCUMFLEX */
- { 0x02b9, 0x0131 }, /* idotless ı LATIN SMALL LETTER DOTLESS I */
- { 0x02bb, 0x011f }, /* gbreve ÄŸ LATIN SMALL LETTER G WITH BREVE */
- { 0x02bc, 0x0135 }, /* jcircumflex ĵ LATIN SMALL LETTER J WITH CIRCUMFLEX */
- { 0x02c5, 0x010a }, /* Cabovedot ÄŠ LATIN CAPITAL LETTER C WITH DOT ABOVE */
- { 0x02c6, 0x0108 }, /* Ccircumflex Ĉ LATIN CAPITAL LETTER C WITH CIRCUMFLEX */
- { 0x02d5, 0x0120 }, /* Gabovedot Ä  LATIN CAPITAL LETTER G WITH DOT ABOVE */
- { 0x02d8, 0x011c }, /* Gcircumflex Ĝ LATIN CAPITAL LETTER G WITH CIRCUMFLEX */
- { 0x02dd, 0x016c }, /* Ubreve Ŭ LATIN CAPITAL LETTER U WITH BREVE */
- { 0x02de, 0x015c }, /* Scircumflex Ŝ LATIN CAPITAL LETTER S WITH CIRCUMFLEX */
- { 0x02e5, 0x010b }, /* cabovedot Ä‹ LATIN SMALL LETTER C WITH DOT ABOVE */
- { 0x02e6, 0x0109 }, /* ccircumflex ĉ LATIN SMALL LETTER C WITH CIRCUMFLEX */
- { 0x02f5, 0x0121 }, /* gabovedot Ä¡ LATIN SMALL LETTER G WITH DOT ABOVE */
- { 0x02f8, 0x011d }, /* gcircumflex Ä LATIN SMALL LETTER G WITH CIRCUMFLEX */
- { 0x02fd, 0x016d }, /* ubreve Å­ LATIN SMALL LETTER U WITH BREVE */
- { 0x02fe, 0x015d }, /* scircumflex Å LATIN SMALL LETTER S WITH CIRCUMFLEX */
- { 0x03a2, 0x0138 }, /* kra ĸ LATIN SMALL LETTER KRA */
- { 0x03a3, 0x0156 }, /* Rcedilla Å– LATIN CAPITAL LETTER R WITH CEDILLA */
- { 0x03a5, 0x0128 }, /* Itilde Ĩ LATIN CAPITAL LETTER I WITH TILDE */
- { 0x03a6, 0x013b }, /* Lcedilla Ä» LATIN CAPITAL LETTER L WITH CEDILLA */
- { 0x03aa, 0x0112 }, /* Emacron Ä’ LATIN CAPITAL LETTER E WITH MACRON */
- { 0x03ab, 0x0122 }, /* Gcedilla Ģ LATIN CAPITAL LETTER G WITH CEDILLA */
- { 0x03ac, 0x0166 }, /* Tslash Ŧ LATIN CAPITAL LETTER T WITH STROKE */
- { 0x03b3, 0x0157 }, /* rcedilla Å— LATIN SMALL LETTER R WITH CEDILLA */
- { 0x03b5, 0x0129 }, /* itilde Ä© LATIN SMALL LETTER I WITH TILDE */
- { 0x03b6, 0x013c }, /* lcedilla ļ LATIN SMALL LETTER L WITH CEDILLA */
- { 0x03ba, 0x0113 }, /* emacron Ä“ LATIN SMALL LETTER E WITH MACRON */
- { 0x03bb, 0x0123 }, /* gcedilla ģ LATIN SMALL LETTER G WITH CEDILLA */
- { 0x03bc, 0x0167 }, /* tslash ŧ LATIN SMALL LETTER T WITH STROKE */
- { 0x03bd, 0x014a }, /* ENG ÅŠ LATIN CAPITAL LETTER ENG */
- { 0x03bf, 0x014b }, /* eng Å‹ LATIN SMALL LETTER ENG */
- { 0x03c0, 0x0100 }, /* Amacron Ā LATIN CAPITAL LETTER A WITH MACRON */
- { 0x03c7, 0x012e }, /* Iogonek Ä® LATIN CAPITAL LETTER I WITH OGONEK */
- { 0x03cc, 0x0116 }, /* Eabovedot Ä– LATIN CAPITAL LETTER E WITH DOT ABOVE */
- { 0x03cf, 0x012a }, /* Imacron Ī LATIN CAPITAL LETTER I WITH MACRON */
- { 0x03d1, 0x0145 }, /* Ncedilla Å… LATIN CAPITAL LETTER N WITH CEDILLA */
- { 0x03d2, 0x014c }, /* Omacron Ō LATIN CAPITAL LETTER O WITH MACRON */
- { 0x03d3, 0x0136 }, /* Kcedilla Ķ LATIN CAPITAL LETTER K WITH CEDILLA */
- { 0x03d9, 0x0172 }, /* Uogonek Ų LATIN CAPITAL LETTER U WITH OGONEK */
- { 0x03dd, 0x0168 }, /* Utilde Ũ LATIN CAPITAL LETTER U WITH TILDE */
- { 0x03de, 0x016a }, /* Umacron Ū LATIN CAPITAL LETTER U WITH MACRON */
- { 0x03e0, 0x0101 }, /* amacron Ä LATIN SMALL LETTER A WITH MACRON */
- { 0x03e7, 0x012f }, /* iogonek į LATIN SMALL LETTER I WITH OGONEK */
- { 0x03ec, 0x0117 }, /* eabovedot Ä— LATIN SMALL LETTER E WITH DOT ABOVE */
- { 0x03ef, 0x012b }, /* imacron Ä« LATIN SMALL LETTER I WITH MACRON */
- { 0x03f1, 0x0146 }, /* ncedilla ņ LATIN SMALL LETTER N WITH CEDILLA */
- { 0x03f2, 0x014d }, /* omacron Å LATIN SMALL LETTER O WITH MACRON */
- { 0x03f3, 0x0137 }, /* kcedilla Ä· LATIN SMALL LETTER K WITH CEDILLA */
- { 0x03f9, 0x0173 }, /* uogonek ų LATIN SMALL LETTER U WITH OGONEK */
- { 0x03fd, 0x0169 }, /* utilde Å© LATIN SMALL LETTER U WITH TILDE */
- { 0x03fe, 0x016b }, /* umacron Å« LATIN SMALL LETTER U WITH MACRON */
- { 0x047e, 0x203e }, /* overline ‾ OVERLINE */
- { 0x04a1, 0x3002 }, /* kana_fullstop 。 IDEOGRAPHIC FULL STOP */
- { 0x04a2, 0x300c }, /* kana_openingbracket 「 LEFT CORNER BRACKET */
- { 0x04a3, 0x300d }, /* kana_closingbracket 〠RIGHT CORNER BRACKET */
- { 0x04a4, 0x3001 }, /* kana_comma 〠IDEOGRAPHIC COMMA */
- { 0x04a5, 0x30fb }, /* kana_conjunctive ・ KATAKANA MIDDLE DOT */
- { 0x04a6, 0x30f2 }, /* kana_WO ヲ KATAKANA LETTER WO */
- { 0x04a7, 0x30a1 }, /* kana_a ã‚¡ KATAKANA LETTER SMALL A */
- { 0x04a8, 0x30a3 }, /* kana_i ã‚£ KATAKANA LETTER SMALL I */
- { 0x04a9, 0x30a5 }, /* kana_u ã‚¥ KATAKANA LETTER SMALL U */
- { 0x04aa, 0x30a7 }, /* kana_e ェ KATAKANA LETTER SMALL E */
- { 0x04ab, 0x30a9 }, /* kana_o ã‚© KATAKANA LETTER SMALL O */
- { 0x04ac, 0x30e3 }, /* kana_ya ャ KATAKANA LETTER SMALL YA */
- { 0x04ad, 0x30e5 }, /* kana_yu ュ KATAKANA LETTER SMALL YU */
- { 0x04ae, 0x30e7 }, /* kana_yo ョ KATAKANA LETTER SMALL YO */
- { 0x04af, 0x30c3 }, /* kana_tsu ッ KATAKANA LETTER SMALL TU */
- { 0x04b0, 0x30fc }, /* prolongedsound ー KATAKANA-HIRAGANA PROLONGED SOUND MARK */
- { 0x04b1, 0x30a2 }, /* kana_A ã‚¢ KATAKANA LETTER A */
- { 0x04b2, 0x30a4 }, /* kana_I イ KATAKANA LETTER I */
- { 0x04b3, 0x30a6 }, /* kana_U ウ KATAKANA LETTER U */
- { 0x04b4, 0x30a8 }, /* kana_E エ KATAKANA LETTER E */
- { 0x04b5, 0x30aa }, /* kana_O オ KATAKANA LETTER O */
- { 0x04b6, 0x30ab }, /* kana_KA ã‚« KATAKANA LETTER KA */
- { 0x04b7, 0x30ad }, /* kana_KI ã‚­ KATAKANA LETTER KI */
- { 0x04b8, 0x30af }, /* kana_KU ク KATAKANA LETTER KU */
- { 0x04b9, 0x30b1 }, /* kana_KE ケ KATAKANA LETTER KE */
- { 0x04ba, 0x30b3 }, /* kana_KO コ KATAKANA LETTER KO */
- { 0x04bb, 0x30b5 }, /* kana_SA サ KATAKANA LETTER SA */
- { 0x04bc, 0x30b7 }, /* kana_SHI ã‚· KATAKANA LETTER SI */
- { 0x04bd, 0x30b9 }, /* kana_SU ス KATAKANA LETTER SU */
- { 0x04be, 0x30bb }, /* kana_SE ã‚» KATAKANA LETTER SE */
- { 0x04bf, 0x30bd }, /* kana_SO ソ KATAKANA LETTER SO */
- { 0x04c0, 0x30bf }, /* kana_TA ã‚¿ KATAKANA LETTER TA */
- { 0x04c1, 0x30c1 }, /* kana_CHI ムKATAKANA LETTER TI */
- { 0x04c2, 0x30c4 }, /* kana_TSU ツ KATAKANA LETTER TU */
- { 0x04c3, 0x30c6 }, /* kana_TE テ KATAKANA LETTER TE */
- { 0x04c4, 0x30c8 }, /* kana_TO ト KATAKANA LETTER TO */
- { 0x04c5, 0x30ca }, /* kana_NA ナ KATAKANA LETTER NA */
- { 0x04c6, 0x30cb }, /* kana_NI ニ KATAKANA LETTER NI */
- { 0x04c7, 0x30cc }, /* kana_NU ヌ KATAKANA LETTER NU */
- { 0x04c8, 0x30cd }, /* kana_NE ムKATAKANA LETTER NE */
- { 0x04c9, 0x30ce }, /* kana_NO ノ KATAKANA LETTER NO */
- { 0x04ca, 0x30cf }, /* kana_HA ムKATAKANA LETTER HA */
- { 0x04cb, 0x30d2 }, /* kana_HI ヒ KATAKANA LETTER HI */
- { 0x04cc, 0x30d5 }, /* kana_FU フ KATAKANA LETTER HU */
- { 0x04cd, 0x30d8 }, /* kana_HE ヘ KATAKANA LETTER HE */
- { 0x04ce, 0x30db }, /* kana_HO ホ KATAKANA LETTER HO */
- { 0x04cf, 0x30de }, /* kana_MA マ KATAKANA LETTER MA */
- { 0x04d0, 0x30df }, /* kana_MI ミ KATAKANA LETTER MI */
- { 0x04d1, 0x30e0 }, /* kana_MU ム KATAKANA LETTER MU */
- { 0x04d2, 0x30e1 }, /* kana_ME メ KATAKANA LETTER ME */
- { 0x04d3, 0x30e2 }, /* kana_MO モ KATAKANA LETTER MO */
- { 0x04d4, 0x30e4 }, /* kana_YA ヤ KATAKANA LETTER YA */
- { 0x04d5, 0x30e6 }, /* kana_YU ユ KATAKANA LETTER YU */
- { 0x04d6, 0x30e8 }, /* kana_YO ヨ KATAKANA LETTER YO */
- { 0x04d7, 0x30e9 }, /* kana_RA ラ KATAKANA LETTER RA */
- { 0x04d8, 0x30ea }, /* kana_RI リ KATAKANA LETTER RI */
- { 0x04d9, 0x30eb }, /* kana_RU ル KATAKANA LETTER RU */
- { 0x04da, 0x30ec }, /* kana_RE レ KATAKANA LETTER RE */
- { 0x04db, 0x30ed }, /* kana_RO ロ KATAKANA LETTER RO */
- { 0x04dc, 0x30ef }, /* kana_WA ワ KATAKANA LETTER WA */
- { 0x04dd, 0x30f3 }, /* kana_N ン KATAKANA LETTER N */
- { 0x04de, 0x309b }, /* voicedsound ã‚› KATAKANA-HIRAGANA VOICED SOUND MARK */
- { 0x04df, 0x309c }, /* semivoicedsound ゜ KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK */
- { 0x05ac, 0x060c }, /* Arabic_comma ، ARABIC COMMA */
- { 0x05bb, 0x061b }, /* Arabic_semicolon Ø› ARABIC SEMICOLON */
- { 0x05bf, 0x061f }, /* Arabic_question_mark ØŸ ARABIC QUESTION MARK */
- { 0x05c1, 0x0621 }, /* Arabic_hamza Ø¡ ARABIC LETTER HAMZA */
- { 0x05c2, 0x0622 }, /* Arabic_maddaonalef آ ARABIC LETTER ALEF WITH MADDA ABOVE */
- { 0x05c3, 0x0623 }, /* Arabic_hamzaonalef أ ARABIC LETTER ALEF WITH HAMZA ABOVE */
- { 0x05c4, 0x0624 }, /* Arabic_hamzaonwaw ؤ ARABIC LETTER WAW WITH HAMZA ABOVE */
- { 0x05c5, 0x0625 }, /* Arabic_hamzaunderalef إ ARABIC LETTER ALEF WITH HAMZA BELOW */
- { 0x05c6, 0x0626 }, /* Arabic_hamzaonyeh ئ ARABIC LETTER YEH WITH HAMZA ABOVE */
- { 0x05c7, 0x0627 }, /* Arabic_alef ا ARABIC LETTER ALEF */
- { 0x05c8, 0x0628 }, /* Arabic_beh ب ARABIC LETTER BEH */
- { 0x05c9, 0x0629 }, /* Arabic_tehmarbuta Ø© ARABIC LETTER TEH MARBUTA */
- { 0x05ca, 0x062a }, /* Arabic_teh ت ARABIC LETTER TEH */
- { 0x05cb, 0x062b }, /* Arabic_theh Ø« ARABIC LETTER THEH */
- { 0x05cc, 0x062c }, /* Arabic_jeem ج ARABIC LETTER JEEM */
- { 0x05cd, 0x062d }, /* Arabic_hah Ø­ ARABIC LETTER HAH */
- { 0x05ce, 0x062e }, /* Arabic_khah Ø® ARABIC LETTER KHAH */
- { 0x05cf, 0x062f }, /* Arabic_dal د ARABIC LETTER DAL */
- { 0x05d0, 0x0630 }, /* Arabic_thal Ø° ARABIC LETTER THAL */
- { 0x05d1, 0x0631 }, /* Arabic_ra ر ARABIC LETTER REH */
- { 0x05d2, 0x0632 }, /* Arabic_zain ز ARABIC LETTER ZAIN */
- { 0x05d3, 0x0633 }, /* Arabic_seen س ARABIC LETTER SEEN */
- { 0x05d4, 0x0634 }, /* Arabic_sheen Ø´ ARABIC LETTER SHEEN */
- { 0x05d5, 0x0635 }, /* Arabic_sad ص ARABIC LETTER SAD */
- { 0x05d6, 0x0636 }, /* Arabic_dad ض ARABIC LETTER DAD */
- { 0x05d7, 0x0637 }, /* Arabic_tah Ø· ARABIC LETTER TAH */
- { 0x05d8, 0x0638 }, /* Arabic_zah ظ ARABIC LETTER ZAH */
- { 0x05d9, 0x0639 }, /* Arabic_ain ع ARABIC LETTER AIN */
- { 0x05da, 0x063a }, /* Arabic_ghain غ ARABIC LETTER GHAIN */
- { 0x05e0, 0x0640 }, /* Arabic_tatweel Ù€ ARABIC TATWEEL */
- { 0x05e1, 0x0641 }, /* Arabic_feh Ù ARABIC LETTER FEH */
- { 0x05e2, 0x0642 }, /* Arabic_qaf Ù‚ ARABIC LETTER QAF */
- { 0x05e3, 0x0643 }, /* Arabic_kaf Ùƒ ARABIC LETTER KAF */
- { 0x05e4, 0x0644 }, /* Arabic_lam Ù„ ARABIC LETTER LAM */
- { 0x05e5, 0x0645 }, /* Arabic_meem Ù… ARABIC LETTER MEEM */
- { 0x05e6, 0x0646 }, /* Arabic_noon Ù† ARABIC LETTER NOON */
- { 0x05e7, 0x0647 }, /* Arabic_ha Ù‡ ARABIC LETTER HEH */
- { 0x05e8, 0x0648 }, /* Arabic_waw Ùˆ ARABIC LETTER WAW */
- { 0x05e9, 0x0649 }, /* Arabic_alefmaksura Ù‰ ARABIC LETTER ALEF MAKSURA */
- { 0x05ea, 0x064a }, /* Arabic_yeh ÙŠ ARABIC LETTER YEH */
- { 0x05eb, 0x064b }, /* Arabic_fathatan Ù‹ ARABIC FATHATAN */
- { 0x05ec, 0x064c }, /* Arabic_dammatan ٌ ARABIC DAMMATAN */
- { 0x05ed, 0x064d }, /* Arabic_kasratan Ù ARABIC KASRATAN */
- { 0x05ee, 0x064e }, /* Arabic_fatha ÙŽ ARABIC FATHA */
- { 0x05ef, 0x064f }, /* Arabic_damma Ù ARABIC DAMMA */
- { 0x05f0, 0x0650 }, /* Arabic_kasra Ù ARABIC KASRA */
- { 0x05f1, 0x0651 }, /* Arabic_shadda Ù‘ ARABIC SHADDA */
- { 0x05f2, 0x0652 }, /* Arabic_sukun Ù’ ARABIC SUKUN */
- { 0x06a1, 0x0452 }, /* Serbian_dje Ñ’ CYRILLIC SMALL LETTER DJE */
- { 0x06a2, 0x0453 }, /* Macedonia_gje Ñ“ CYRILLIC SMALL LETTER GJE */
- { 0x06a3, 0x0451 }, /* Cyrillic_io Ñ‘ CYRILLIC SMALL LETTER IO */
- { 0x06a4, 0x0454 }, /* Ukrainian_ie Ñ” CYRILLIC SMALL LETTER UKRAINIAN IE */
- { 0x06a5, 0x0455 }, /* Macedonia_dse Ñ• CYRILLIC SMALL LETTER DZE */
- { 0x06a6, 0x0456 }, /* Ukrainian_i Ñ– CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I */
- { 0x06a7, 0x0457 }, /* Ukrainian_yi Ñ— CYRILLIC SMALL LETTER YI */
- { 0x06a8, 0x0458 }, /* Cyrillic_je ј CYRILLIC SMALL LETTER JE */
- { 0x06a9, 0x0459 }, /* Cyrillic_lje Ñ™ CYRILLIC SMALL LETTER LJE */
- { 0x06aa, 0x045a }, /* Cyrillic_nje Ñš CYRILLIC SMALL LETTER NJE */
- { 0x06ab, 0x045b }, /* Serbian_tshe Ñ› CYRILLIC SMALL LETTER TSHE */
- { 0x06ac, 0x045c }, /* Macedonia_kje ќ CYRILLIC SMALL LETTER KJE */
- { 0x06ad, 0x0491 }, /* Ukrainian_ghe_with_upturn Ò‘ CYRILLIC SMALL LETTER GHE WITH UPTURN */
- { 0x06ae, 0x045e }, /* Byelorussian_shortu Ñž CYRILLIC SMALL LETTER SHORT U */
- { 0x06af, 0x045f }, /* Cyrillic_dzhe ÑŸ CYRILLIC SMALL LETTER DZHE */
- { 0x06b0, 0x2116 }, /* numerosign â„– NUMERO SIGN */
- { 0x06b1, 0x0402 }, /* Serbian_DJE Ђ CYRILLIC CAPITAL LETTER DJE */
- { 0x06b2, 0x0403 }, /* Macedonia_GJE Ѓ CYRILLIC CAPITAL LETTER GJE */
- { 0x06b3, 0x0401 }, /* Cyrillic_IO Ð CYRILLIC CAPITAL LETTER IO */
- { 0x06b4, 0x0404 }, /* Ukrainian_IE Є CYRILLIC CAPITAL LETTER UKRAINIAN IE */
- { 0x06b5, 0x0405 }, /* Macedonia_DSE Ð… CYRILLIC CAPITAL LETTER DZE */
- { 0x06b6, 0x0406 }, /* Ukrainian_I І CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I */
- { 0x06b7, 0x0407 }, /* Ukrainian_YI Ї CYRILLIC CAPITAL LETTER YI */
- { 0x06b8, 0x0408 }, /* Cyrillic_JE Ј CYRILLIC CAPITAL LETTER JE */
- { 0x06b9, 0x0409 }, /* Cyrillic_LJE Љ CYRILLIC CAPITAL LETTER LJE */
- { 0x06ba, 0x040a }, /* Cyrillic_NJE Њ CYRILLIC CAPITAL LETTER NJE */
- { 0x06bb, 0x040b }, /* Serbian_TSHE Ћ CYRILLIC CAPITAL LETTER TSHE */
- { 0x06bc, 0x040c }, /* Macedonia_KJE Ќ CYRILLIC CAPITAL LETTER KJE */
- { 0x06bd, 0x0490 }, /* Ukrainian_GHE_WITH_UPTURN Ò CYRILLIC CAPITAL LETTER GHE WITH UPTURN */
- { 0x06be, 0x040e }, /* Byelorussian_SHORTU ÐŽ CYRILLIC CAPITAL LETTER SHORT U */
- { 0x06bf, 0x040f }, /* Cyrillic_DZHE Ð CYRILLIC CAPITAL LETTER DZHE */
- { 0x06c0, 0x044e }, /* Cyrillic_yu ÑŽ CYRILLIC SMALL LETTER YU */
- { 0x06c1, 0x0430 }, /* Cyrillic_a а CYRILLIC SMALL LETTER A */
- { 0x06c2, 0x0431 }, /* Cyrillic_be б CYRILLIC SMALL LETTER BE */
- { 0x06c3, 0x0446 }, /* Cyrillic_tse ц CYRILLIC SMALL LETTER TSE */
- { 0x06c4, 0x0434 }, /* Cyrillic_de д CYRILLIC SMALL LETTER DE */
- { 0x06c5, 0x0435 }, /* Cyrillic_ie е CYRILLIC SMALL LETTER IE */
- { 0x06c6, 0x0444 }, /* Cyrillic_ef Ñ„ CYRILLIC SMALL LETTER EF */
- { 0x06c7, 0x0433 }, /* Cyrillic_ghe г CYRILLIC SMALL LETTER GHE */
- { 0x06c8, 0x0445 }, /* Cyrillic_ha Ñ… CYRILLIC SMALL LETTER HA */
- { 0x06c9, 0x0438 }, /* Cyrillic_i и CYRILLIC SMALL LETTER I */
- { 0x06ca, 0x0439 }, /* Cyrillic_shorti й CYRILLIC SMALL LETTER SHORT I */
- { 0x06cb, 0x043a }, /* Cyrillic_ka к CYRILLIC SMALL LETTER KA */
- { 0x06cc, 0x043b }, /* Cyrillic_el л CYRILLIC SMALL LETTER EL */
- { 0x06cd, 0x043c }, /* Cyrillic_em м CYRILLIC SMALL LETTER EM */
- { 0x06ce, 0x043d }, /* Cyrillic_en н CYRILLIC SMALL LETTER EN */
- { 0x06cf, 0x043e }, /* Cyrillic_o о CYRILLIC SMALL LETTER O */
- { 0x06d0, 0x043f }, /* Cyrillic_pe п CYRILLIC SMALL LETTER PE */
- { 0x06d1, 0x044f }, /* Cyrillic_ya Ñ CYRILLIC SMALL LETTER YA */
- { 0x06d2, 0x0440 }, /* Cyrillic_er р CYRILLIC SMALL LETTER ER */
- { 0x06d3, 0x0441 }, /* Cyrillic_es Ñ CYRILLIC SMALL LETTER ES */
- { 0x06d4, 0x0442 }, /* Cyrillic_te Ñ‚ CYRILLIC SMALL LETTER TE */
- { 0x06d5, 0x0443 }, /* Cyrillic_u у CYRILLIC SMALL LETTER U */
- { 0x06d6, 0x0436 }, /* Cyrillic_zhe ж CYRILLIC SMALL LETTER ZHE */
- { 0x06d7, 0x0432 }, /* Cyrillic_ve в CYRILLIC SMALL LETTER VE */
- { 0x06d8, 0x044c }, /* Cyrillic_softsign ь CYRILLIC SMALL LETTER SOFT SIGN */
- { 0x06d9, 0x044b }, /* Cyrillic_yeru Ñ‹ CYRILLIC SMALL LETTER YERU */
- { 0x06da, 0x0437 }, /* Cyrillic_ze з CYRILLIC SMALL LETTER ZE */
- { 0x06db, 0x0448 }, /* Cyrillic_sha ш CYRILLIC SMALL LETTER SHA */
- { 0x06dc, 0x044d }, /* Cyrillic_e Ñ CYRILLIC SMALL LETTER E */
- { 0x06dd, 0x0449 }, /* Cyrillic_shcha щ CYRILLIC SMALL LETTER SHCHA */
- { 0x06de, 0x0447 }, /* Cyrillic_che ч CYRILLIC SMALL LETTER CHE */
- { 0x06df, 0x044a }, /* Cyrillic_hardsign ÑŠ CYRILLIC SMALL LETTER HARD SIGN */
- { 0x06e0, 0x042e }, /* Cyrillic_YU Ю CYRILLIC CAPITAL LETTER YU */
- { 0x06e1, 0x0410 }, /* Cyrillic_A Ð CYRILLIC CAPITAL LETTER A */
- { 0x06e2, 0x0411 }, /* Cyrillic_BE Б CYRILLIC CAPITAL LETTER BE */
- { 0x06e3, 0x0426 }, /* Cyrillic_TSE Ц CYRILLIC CAPITAL LETTER TSE */
- { 0x06e4, 0x0414 }, /* Cyrillic_DE Д CYRILLIC CAPITAL LETTER DE */
- { 0x06e5, 0x0415 }, /* Cyrillic_IE Е CYRILLIC CAPITAL LETTER IE */
- { 0x06e6, 0x0424 }, /* Cyrillic_EF Ф CYRILLIC CAPITAL LETTER EF */
- { 0x06e7, 0x0413 }, /* Cyrillic_GHE Г CYRILLIC CAPITAL LETTER GHE */
- { 0x06e8, 0x0425 }, /* Cyrillic_HA Х CYRILLIC CAPITAL LETTER HA */
- { 0x06e9, 0x0418 }, /* Cyrillic_I И CYRILLIC CAPITAL LETTER I */
- { 0x06ea, 0x0419 }, /* Cyrillic_SHORTI Й CYRILLIC CAPITAL LETTER SHORT I */
- { 0x06eb, 0x041a }, /* Cyrillic_KA К CYRILLIC CAPITAL LETTER KA */
- { 0x06ec, 0x041b }, /* Cyrillic_EL Л CYRILLIC CAPITAL LETTER EL */
- { 0x06ed, 0x041c }, /* Cyrillic_EM М CYRILLIC CAPITAL LETTER EM */
- { 0x06ee, 0x041d }, /* Cyrillic_EN Ð CYRILLIC CAPITAL LETTER EN */
- { 0x06ef, 0x041e }, /* Cyrillic_O О CYRILLIC CAPITAL LETTER O */
- { 0x06f0, 0x041f }, /* Cyrillic_PE П CYRILLIC CAPITAL LETTER PE */
- { 0x06f1, 0x042f }, /* Cyrillic_YA Я CYRILLIC CAPITAL LETTER YA */
- { 0x06f2, 0x0420 }, /* Cyrillic_ER Р CYRILLIC CAPITAL LETTER ER */
- { 0x06f3, 0x0421 }, /* Cyrillic_ES С CYRILLIC CAPITAL LETTER ES */
- { 0x06f4, 0x0422 }, /* Cyrillic_TE Т CYRILLIC CAPITAL LETTER TE */
- { 0x06f5, 0x0423 }, /* Cyrillic_U У CYRILLIC CAPITAL LETTER U */
- { 0x06f6, 0x0416 }, /* Cyrillic_ZHE Ж CYRILLIC CAPITAL LETTER ZHE */
- { 0x06f7, 0x0412 }, /* Cyrillic_VE Ð’ CYRILLIC CAPITAL LETTER VE */
- { 0x06f8, 0x042c }, /* Cyrillic_SOFTSIGN Ь CYRILLIC CAPITAL LETTER SOFT SIGN */
- { 0x06f9, 0x042b }, /* Cyrillic_YERU Ы CYRILLIC CAPITAL LETTER YERU */
- { 0x06fa, 0x0417 }, /* Cyrillic_ZE З CYRILLIC CAPITAL LETTER ZE */
- { 0x06fb, 0x0428 }, /* Cyrillic_SHA Ш CYRILLIC CAPITAL LETTER SHA */
- { 0x06fc, 0x042d }, /* Cyrillic_E Э CYRILLIC CAPITAL LETTER E */
- { 0x06fd, 0x0429 }, /* Cyrillic_SHCHA Щ CYRILLIC CAPITAL LETTER SHCHA */
- { 0x06fe, 0x0427 }, /* Cyrillic_CHE Ч CYRILLIC CAPITAL LETTER CHE */
- { 0x06ff, 0x042a }, /* Cyrillic_HARDSIGN Ъ CYRILLIC CAPITAL LETTER HARD SIGN */
- { 0x07a1, 0x0386 }, /* Greek_ALPHAaccent Ά GREEK CAPITAL LETTER ALPHA WITH TONOS */
- { 0x07a2, 0x0388 }, /* Greek_EPSILONaccent Έ GREEK CAPITAL LETTER EPSILON WITH TONOS */
- { 0x07a3, 0x0389 }, /* Greek_ETAaccent Ή GREEK CAPITAL LETTER ETA WITH TONOS */
- { 0x07a4, 0x038a }, /* Greek_IOTAaccent Ί GREEK CAPITAL LETTER IOTA WITH TONOS */
- { 0x07a5, 0x03aa }, /* Greek_IOTAdieresis Ϊ GREEK CAPITAL LETTER IOTA WITH DIALYTIKA */
- { 0x07a7, 0x038c }, /* Greek_OMICRONaccent Ό GREEK CAPITAL LETTER OMICRON WITH TONOS */
- { 0x07a8, 0x038e }, /* Greek_UPSILONaccent ÎŽ GREEK CAPITAL LETTER UPSILON WITH TONOS */
- { 0x07a9, 0x03ab }, /* Greek_UPSILONdieresis Ϋ GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA */
- { 0x07ab, 0x038f }, /* Greek_OMEGAaccent Î GREEK CAPITAL LETTER OMEGA WITH TONOS */
- { 0x07ae, 0x0385 }, /* Greek_accentdieresis Î… GREEK DIALYTIKA TONOS */
- { 0x07af, 0x2015 }, /* Greek_horizbar ― HORIZONTAL BAR */
- { 0x07b1, 0x03ac }, /* Greek_alphaaccent ά GREEK SMALL LETTER ALPHA WITH TONOS */
- { 0x07b2, 0x03ad }, /* Greek_epsilonaccent έ GREEK SMALL LETTER EPSILON WITH TONOS */
- { 0x07b3, 0x03ae }, /* Greek_etaaccent ή GREEK SMALL LETTER ETA WITH TONOS */
- { 0x07b4, 0x03af }, /* Greek_iotaaccent ί GREEK SMALL LETTER IOTA WITH TONOS */
- { 0x07b5, 0x03ca }, /* Greek_iotadieresis ÏŠ GREEK SMALL LETTER IOTA WITH DIALYTIKA */
- { 0x07b6, 0x0390 }, /* Greek_iotaaccentdieresis Î GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS */
- { 0x07b7, 0x03cc }, /* Greek_omicronaccent ό GREEK SMALL LETTER OMICRON WITH TONOS */
- { 0x07b8, 0x03cd }, /* Greek_upsilonaccent Ï GREEK SMALL LETTER UPSILON WITH TONOS */
- { 0x07b9, 0x03cb }, /* Greek_upsilondieresis Ï‹ GREEK SMALL LETTER UPSILON WITH DIALYTIKA */
- { 0x07ba, 0x03b0 }, /* Greek_upsilonaccentdieresis ΰ GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS */
- { 0x07bb, 0x03ce }, /* Greek_omegaaccent ÏŽ GREEK SMALL LETTER OMEGA WITH TONOS */
- { 0x07c1, 0x0391 }, /* Greek_ALPHA Α GREEK CAPITAL LETTER ALPHA */
- { 0x07c2, 0x0392 }, /* Greek_BETA Î’ GREEK CAPITAL LETTER BETA */
- { 0x07c3, 0x0393 }, /* Greek_GAMMA Γ GREEK CAPITAL LETTER GAMMA */
- { 0x07c4, 0x0394 }, /* Greek_DELTA Δ GREEK CAPITAL LETTER DELTA */
- { 0x07c5, 0x0395 }, /* Greek_EPSILON Ε GREEK CAPITAL LETTER EPSILON */
- { 0x07c6, 0x0396 }, /* Greek_ZETA Ζ GREEK CAPITAL LETTER ZETA */
- { 0x07c7, 0x0397 }, /* Greek_ETA Η GREEK CAPITAL LETTER ETA */
- { 0x07c8, 0x0398 }, /* Greek_THETA Θ GREEK CAPITAL LETTER THETA */
- { 0x07c9, 0x0399 }, /* Greek_IOTA Ι GREEK CAPITAL LETTER IOTA */
- { 0x07ca, 0x039a }, /* Greek_KAPPA Κ GREEK CAPITAL LETTER KAPPA */
- { 0x07cb, 0x039b }, /* Greek_LAMBDA Λ GREEK CAPITAL LETTER LAMDA */
- { 0x07cc, 0x039c }, /* Greek_MU Μ GREEK CAPITAL LETTER MU */
- { 0x07cd, 0x039d }, /* Greek_NU Î GREEK CAPITAL LETTER NU */
- { 0x07ce, 0x039e }, /* Greek_XI Ξ GREEK CAPITAL LETTER XI */
- { 0x07cf, 0x039f }, /* Greek_OMICRON Ο GREEK CAPITAL LETTER OMICRON */
- { 0x07d0, 0x03a0 }, /* Greek_PI Π GREEK CAPITAL LETTER PI */
- { 0x07d1, 0x03a1 }, /* Greek_RHO Ρ GREEK CAPITAL LETTER RHO */
- { 0x07d2, 0x03a3 }, /* Greek_SIGMA Σ GREEK CAPITAL LETTER SIGMA */
- { 0x07d4, 0x03a4 }, /* Greek_TAU Τ GREEK CAPITAL LETTER TAU */
- { 0x07d5, 0x03a5 }, /* Greek_UPSILON Υ GREEK CAPITAL LETTER UPSILON */
- { 0x07d6, 0x03a6 }, /* Greek_PHI Φ GREEK CAPITAL LETTER PHI */
- { 0x07d7, 0x03a7 }, /* Greek_CHI Χ GREEK CAPITAL LETTER CHI */
- { 0x07d8, 0x03a8 }, /* Greek_PSI Ψ GREEK CAPITAL LETTER PSI */
- { 0x07d9, 0x03a9 }, /* Greek_OMEGA Ω GREEK CAPITAL LETTER OMEGA */
- { 0x07e1, 0x03b1 }, /* Greek_alpha α GREEK SMALL LETTER ALPHA */
- { 0x07e2, 0x03b2 }, /* Greek_beta β GREEK SMALL LETTER BETA */
- { 0x07e3, 0x03b3 }, /* Greek_gamma γ GREEK SMALL LETTER GAMMA */
- { 0x07e4, 0x03b4 }, /* Greek_delta δ GREEK SMALL LETTER DELTA */
- { 0x07e5, 0x03b5 }, /* Greek_epsilon ε GREEK SMALL LETTER EPSILON */
- { 0x07e6, 0x03b6 }, /* Greek_zeta ζ GREEK SMALL LETTER ZETA */
- { 0x07e7, 0x03b7 }, /* Greek_eta η GREEK SMALL LETTER ETA */
- { 0x07e8, 0x03b8 }, /* Greek_theta θ GREEK SMALL LETTER THETA */
- { 0x07e9, 0x03b9 }, /* Greek_iota ι GREEK SMALL LETTER IOTA */
- { 0x07ea, 0x03ba }, /* Greek_kappa κ GREEK SMALL LETTER KAPPA */
- { 0x07eb, 0x03bb }, /* Greek_lambda λ GREEK SMALL LETTER LAMDA */
- { 0x07ec, 0x03bc }, /* Greek_mu μ GREEK SMALL LETTER MU */
- { 0x07ed, 0x03bd }, /* Greek_nu ν GREEK SMALL LETTER NU */
- { 0x07ee, 0x03be }, /* Greek_xi ξ GREEK SMALL LETTER XI */
- { 0x07ef, 0x03bf }, /* Greek_omicron ο GREEK SMALL LETTER OMICRON */
- { 0x07f0, 0x03c0 }, /* Greek_pi π GREEK SMALL LETTER PI */
- { 0x07f1, 0x03c1 }, /* Greek_rho Ï GREEK SMALL LETTER RHO */
- { 0x07f2, 0x03c3 }, /* Greek_sigma σ GREEK SMALL LETTER SIGMA */
- { 0x07f3, 0x03c2 }, /* Greek_finalsmallsigma Ï‚ GREEK SMALL LETTER FINAL SIGMA */
- { 0x07f4, 0x03c4 }, /* Greek_tau Ï„ GREEK SMALL LETTER TAU */
- { 0x07f5, 0x03c5 }, /* Greek_upsilon Ï… GREEK SMALL LETTER UPSILON */
- { 0x07f6, 0x03c6 }, /* Greek_phi φ GREEK SMALL LETTER PHI */
- { 0x07f7, 0x03c7 }, /* Greek_chi χ GREEK SMALL LETTER CHI */
- { 0x07f8, 0x03c8 }, /* Greek_psi ψ GREEK SMALL LETTER PSI */
- { 0x07f9, 0x03c9 }, /* Greek_omega ω GREEK SMALL LETTER OMEGA */
-/* 0x08a1 leftradical ? ??? */
-/* 0x08a2 topleftradical ? ??? */
-/* 0x08a3 horizconnector ? ??? */
- { 0x08a4, 0x2320 }, /* topintegral ⌠ TOP HALF INTEGRAL */
- { 0x08a5, 0x2321 }, /* botintegral ⌡ BOTTOM HALF INTEGRAL */
- { 0x08a6, 0x2502 }, /* vertconnector │ BOX DRAWINGS LIGHT VERTICAL */
-/* 0x08a7 topleftsqbracket ? ??? */
-/* 0x08a8 botleftsqbracket ? ??? */
-/* 0x08a9 toprightsqbracket ? ??? */
-/* 0x08aa botrightsqbracket ? ??? */
-/* 0x08ab topleftparens ? ??? */
-/* 0x08ac botleftparens ? ??? */
-/* 0x08ad toprightparens ? ??? */
-/* 0x08ae botrightparens ? ??? */
-/* 0x08af leftmiddlecurlybrace ? ??? */
-/* 0x08b0 rightmiddlecurlybrace ? ??? */
-/* 0x08b1 topleftsummation ? ??? */
-/* 0x08b2 botleftsummation ? ??? */
-/* 0x08b3 topvertsummationconnector ? ??? */
-/* 0x08b4 botvertsummationconnector ? ??? */
-/* 0x08b5 toprightsummation ? ??? */
-/* 0x08b6 botrightsummation ? ??? */
-/* 0x08b7 rightmiddlesummation ? ??? */
- { 0x08bc, 0x2264 }, /* lessthanequal ≤ LESS-THAN OR EQUAL TO */
- { 0x08bd, 0x2260 }, /* notequal ≠ NOT EQUAL TO */
- { 0x08be, 0x2265 }, /* greaterthanequal ≥ GREATER-THAN OR EQUAL TO */
- { 0x08bf, 0x222b }, /* integral ∫ INTEGRAL */
- { 0x08c0, 0x2234 }, /* therefore ∴ THEREFORE */
- { 0x08c1, 0x221d }, /* variation ∠PROPORTIONAL TO */
- { 0x08c2, 0x221e }, /* infinity ∞ INFINITY */
- { 0x08c5, 0x2207 }, /* nabla ∇ NABLA */
- { 0x08c8, 0x2245 }, /* approximate ≅ APPROXIMATELY EQUAL TO */
-/* 0x08c9 similarequal ? ??? */
- { 0x08cd, 0x21d4 }, /* ifonlyif ⇔ LEFT RIGHT DOUBLE ARROW */
- { 0x08ce, 0x21d2 }, /* implies ⇒ RIGHTWARDS DOUBLE ARROW */
- { 0x08cf, 0x2261 }, /* identical ≡ IDENTICAL TO */
- { 0x08d6, 0x221a }, /* radical √ SQUARE ROOT */
- { 0x08da, 0x2282 }, /* includedin ⊂ SUBSET OF */
- { 0x08db, 0x2283 }, /* includes ⊃ SUPERSET OF */
- { 0x08dc, 0x2229 }, /* intersection ∩ INTERSECTION */
- { 0x08dd, 0x222a }, /* union ∪ UNION */
- { 0x08de, 0x2227 }, /* logicaland ∧ LOGICAL AND */
- { 0x08df, 0x2228 }, /* logicalor ∨ LOGICAL OR */
- { 0x08ef, 0x2202 }, /* partialderivative ∂ PARTIAL DIFFERENTIAL */
- { 0x08f6, 0x0192 }, /* function Æ’ LATIN SMALL LETTER F WITH HOOK */
- { 0x08fb, 0x2190 }, /* leftarrow ↠LEFTWARDS ARROW */
- { 0x08fc, 0x2191 }, /* uparrow ↑ UPWARDS ARROW */
- { 0x08fd, 0x2192 }, /* rightarrow → RIGHTWARDS ARROW */
- { 0x08fe, 0x2193 }, /* downarrow ↓ DOWNWARDS ARROW */
- { 0x09df, 0x2422 }, /* blank ⢠BLANK SYMBOL */
- { 0x09e0, 0x25c6 }, /* soliddiamond â—† BLACK DIAMOND */
- { 0x09e1, 0x2592 }, /* checkerboard â–’ MEDIUM SHADE */
- { 0x09e2, 0x2409 }, /* ht ≠SYMBOL FOR HORIZONTAL TABULATION */
- { 0x09e3, 0x240c }, /* ff ⌠SYMBOL FOR FORM FEED */
- { 0x09e4, 0x240d }, /* cr â SYMBOL FOR CARRIAGE RETURN */
- { 0x09e5, 0x240a }, /* lf ⊠SYMBOL FOR LINE FEED */
- { 0x09e8, 0x2424 }, /* nl ⤠SYMBOL FOR NEWLINE */
- { 0x09e9, 0x240b }, /* vt â‹ SYMBOL FOR VERTICAL TABULATION */
- { 0x09ea, 0x2518 }, /* lowrightcorner ┘ BOX DRAWINGS LIGHT UP AND LEFT */
- { 0x09eb, 0x2510 }, /* uprightcorner â” BOX DRAWINGS LIGHT DOWN AND LEFT */
- { 0x09ec, 0x250c }, /* upleftcorner ┌ BOX DRAWINGS LIGHT DOWN AND RIGHT */
- { 0x09ed, 0x2514 }, /* lowleftcorner â”” BOX DRAWINGS LIGHT UP AND RIGHT */
- { 0x09ee, 0x253c }, /* crossinglines ┼ BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL */
-/* 0x09ef horizlinescan1 ? ??? */
-/* 0x09f0 horizlinescan3 ? ??? */
- { 0x09f1, 0x2500 }, /* horizlinescan5 ─ BOX DRAWINGS LIGHT HORIZONTAL */
-/* 0x09f2 horizlinescan7 ? ??? */
-/* 0x09f3 horizlinescan9 ? ??? */
- { 0x09f4, 0x251c }, /* leftt ├ BOX DRAWINGS LIGHT VERTICAL AND RIGHT */
- { 0x09f5, 0x2524 }, /* rightt ┤ BOX DRAWINGS LIGHT VERTICAL AND LEFT */
- { 0x09f6, 0x2534 }, /* bott â”´ BOX DRAWINGS LIGHT UP AND HORIZONTAL */
- { 0x09f7, 0x252c }, /* topt ┬ BOX DRAWINGS LIGHT DOWN AND HORIZONTAL */
- { 0x09f8, 0x2502 }, /* vertbar │ BOX DRAWINGS LIGHT VERTICAL */
- { 0x0aa1, 0x2003 }, /* emspace   EM SPACE */
- { 0x0aa2, 0x2002 }, /* enspace   EN SPACE */
- { 0x0aa3, 0x2004 }, /* em3space   THREE-PER-EM SPACE */
- { 0x0aa4, 0x2005 }, /* em4space   FOUR-PER-EM SPACE */
- { 0x0aa5, 0x2007 }, /* digitspace   FIGURE SPACE */
- { 0x0aa6, 0x2008 }, /* punctspace   PUNCTUATION SPACE */
- { 0x0aa7, 0x2009 }, /* thinspace   THIN SPACE */
- { 0x0aa8, 0x200a }, /* hairspace   HAIR SPACE */
- { 0x0aa9, 0x2014 }, /* emdash — EM DASH */
- { 0x0aaa, 0x2013 }, /* endash – EN DASH */
-/* 0x0aac signifblank ? ??? */
- { 0x0aae, 0x2026 }, /* ellipsis … HORIZONTAL ELLIPSIS */
-/* 0x0aaf doubbaselinedot ? ??? */
- { 0x0ab0, 0x2153 }, /* onethird â…“ VULGAR FRACTION ONE THIRD */
- { 0x0ab1, 0x2154 }, /* twothirds â…” VULGAR FRACTION TWO THIRDS */
- { 0x0ab2, 0x2155 }, /* onefifth â…• VULGAR FRACTION ONE FIFTH */
- { 0x0ab3, 0x2156 }, /* twofifths â…– VULGAR FRACTION TWO FIFTHS */
- { 0x0ab4, 0x2157 }, /* threefifths â…— VULGAR FRACTION THREE FIFTHS */
- { 0x0ab5, 0x2158 }, /* fourfifths â…˜ VULGAR FRACTION FOUR FIFTHS */
- { 0x0ab6, 0x2159 }, /* onesixth â…™ VULGAR FRACTION ONE SIXTH */
- { 0x0ab7, 0x215a }, /* fivesixths â…š VULGAR FRACTION FIVE SIXTHS */
- { 0x0ab8, 0x2105 }, /* careof â„… CARE OF */
- { 0x0abb, 0x2012 }, /* figdash ‒ FIGURE DASH */
- { 0x0abc, 0x2329 }, /* leftanglebracket 〈 LEFT-POINTING ANGLE BRACKET */
- { 0x0abd, 0x002e }, /* decimalpoint . FULL STOP */
- { 0x0abe, 0x232a }, /* rightanglebracket 〉 RIGHT-POINTING ANGLE BRACKET */
-/* 0x0abf marker ? ??? */
- { 0x0ac3, 0x215b }, /* oneeighth â…› VULGAR FRACTION ONE EIGHTH */
- { 0x0ac4, 0x215c }, /* threeeighths ⅜ VULGAR FRACTION THREE EIGHTHS */
- { 0x0ac5, 0x215d }, /* fiveeighths â… VULGAR FRACTION FIVE EIGHTHS */
- { 0x0ac6, 0x215e }, /* seveneighths â…ž VULGAR FRACTION SEVEN EIGHTHS */
- { 0x0ac9, 0x2122 }, /* trademark â„¢ TRADE MARK SIGN */
- { 0x0aca, 0x2613 }, /* signaturemark ☓ SALTIRE */
-/* 0x0acb trademarkincircle ? ??? */
- { 0x0acc, 0x25c1 }, /* leftopentriangle â— WHITE LEFT-POINTING TRIANGLE */
- { 0x0acd, 0x25b7 }, /* rightopentriangle â–· WHITE RIGHT-POINTING TRIANGLE */
- { 0x0ace, 0x25cb }, /* emopencircle â—‹ WHITE CIRCLE */
- { 0x0acf, 0x25a1 }, /* emopenrectangle â–¡ WHITE SQUARE */
- { 0x0ad0, 0x2018 }, /* leftsinglequotemark ‘ LEFT SINGLE QUOTATION MARK */
- { 0x0ad1, 0x2019 }, /* rightsinglequotemark ’ RIGHT SINGLE QUOTATION MARK */
- { 0x0ad2, 0x201c }, /* leftdoublequotemark “ LEFT DOUBLE QUOTATION MARK */
- { 0x0ad3, 0x201d }, /* rightdoublequotemark †RIGHT DOUBLE QUOTATION MARK */
- { 0x0ad4, 0x211e }, /* prescription â„ž PRESCRIPTION TAKE */
- { 0x0ad6, 0x2032 }, /* minutes ′ PRIME */
- { 0x0ad7, 0x2033 }, /* seconds ″ DOUBLE PRIME */
- { 0x0ad9, 0x271d }, /* latincross ✠LATIN CROSS */
-/* 0x0ada hexagram ? ??? */
- { 0x0adb, 0x25ac }, /* filledrectbullet â–¬ BLACK RECTANGLE */
- { 0x0adc, 0x25c0 }, /* filledlefttribullet â—€ BLACK LEFT-POINTING TRIANGLE */
- { 0x0add, 0x25b6 }, /* filledrighttribullet â–¶ BLACK RIGHT-POINTING TRIANGLE */
- { 0x0ade, 0x25cf }, /* emfilledcircle â— BLACK CIRCLE */
- { 0x0adf, 0x25a0 }, /* emfilledrect â–  BLACK SQUARE */
- { 0x0ae0, 0x25e6 }, /* enopencircbullet â—¦ WHITE BULLET */
- { 0x0ae1, 0x25ab }, /* enopensquarebullet â–« WHITE SMALL SQUARE */
- { 0x0ae2, 0x25ad }, /* openrectbullet â–­ WHITE RECTANGLE */
- { 0x0ae3, 0x25b3 }, /* opentribulletup â–³ WHITE UP-POINTING TRIANGLE */
- { 0x0ae4, 0x25bd }, /* opentribulletdown â–½ WHITE DOWN-POINTING TRIANGLE */
- { 0x0ae5, 0x2606 }, /* openstar ☆ WHITE STAR */
- { 0x0ae6, 0x2022 }, /* enfilledcircbullet • BULLET */
- { 0x0ae7, 0x25aa }, /* enfilledsqbullet â–ª BLACK SMALL SQUARE */
- { 0x0ae8, 0x25b2 }, /* filledtribulletup â–² BLACK UP-POINTING TRIANGLE */
- { 0x0ae9, 0x25bc }, /* filledtribulletdown â–¼ BLACK DOWN-POINTING TRIANGLE */
- { 0x0aea, 0x261c }, /* leftpointer ☜ WHITE LEFT POINTING INDEX */
- { 0x0aeb, 0x261e }, /* rightpointer ☞ WHITE RIGHT POINTING INDEX */
- { 0x0aec, 0x2663 }, /* club ♣ BLACK CLUB SUIT */
- { 0x0aed, 0x2666 }, /* diamond ♦ BLACK DIAMOND SUIT */
- { 0x0aee, 0x2665 }, /* heart ♥ BLACK HEART SUIT */
- { 0x0af0, 0x2720 }, /* maltesecross ✠ MALTESE CROSS */
- { 0x0af1, 0x2020 }, /* dagger † DAGGER */
- { 0x0af2, 0x2021 }, /* doubledagger ‡ DOUBLE DAGGER */
- { 0x0af3, 0x2713 }, /* checkmark ✓ CHECK MARK */
- { 0x0af4, 0x2717 }, /* ballotcross ✗ BALLOT X */
- { 0x0af5, 0x266f }, /* musicalsharp ♯ MUSIC SHARP SIGN */
- { 0x0af6, 0x266d }, /* musicalflat â™­ MUSIC FLAT SIGN */
- { 0x0af7, 0x2642 }, /* malesymbol ♂ MALE SIGN */
- { 0x0af8, 0x2640 }, /* femalesymbol ♀ FEMALE SIGN */
- { 0x0af9, 0x260e }, /* telephone ☎ BLACK TELEPHONE */
- { 0x0afa, 0x2315 }, /* telephonerecorder ⌕ TELEPHONE RECORDER */
- { 0x0afb, 0x2117 }, /* phonographcopyright â„— SOUND RECORDING COPYRIGHT */
- { 0x0afc, 0x2038 }, /* caret ‸ CARET */
- { 0x0afd, 0x201a }, /* singlelowquotemark ‚ SINGLE LOW-9 QUOTATION MARK */
- { 0x0afe, 0x201e }, /* doublelowquotemark „ DOUBLE LOW-9 QUOTATION MARK */
-/* 0x0aff cursor ? ??? */
- { 0x0ba3, 0x003c }, /* leftcaret < LESS-THAN SIGN */
- { 0x0ba6, 0x003e }, /* rightcaret > GREATER-THAN SIGN */
- { 0x0ba8, 0x2228 }, /* downcaret ∨ LOGICAL OR */
- { 0x0ba9, 0x2227 }, /* upcaret ∧ LOGICAL AND */
- { 0x0bc0, 0x00af }, /* overbar ¯ MACRON */
- { 0x0bc2, 0x22a4 }, /* downtack ⊤ DOWN TACK */
- { 0x0bc3, 0x2229 }, /* upshoe ∩ INTERSECTION */
- { 0x0bc4, 0x230a }, /* downstile ⌊ LEFT FLOOR */
- { 0x0bc6, 0x005f }, /* underbar _ LOW LINE */
- { 0x0bca, 0x2218 }, /* jot ∘ RING OPERATOR */
- { 0x0bcc, 0x2395 }, /* quad ⎕ APL FUNCTIONAL SYMBOL QUAD (Unicode 3.0) */
- { 0x0bce, 0x22a5 }, /* uptack ⊥ UP TACK */
- { 0x0bcf, 0x25cb }, /* circle â—‹ WHITE CIRCLE */
- { 0x0bd3, 0x2308 }, /* upstile ⌈ LEFT CEILING */
- { 0x0bd6, 0x222a }, /* downshoe ∪ UNION */
- { 0x0bd8, 0x2283 }, /* rightshoe ⊃ SUPERSET OF */
- { 0x0bda, 0x2282 }, /* leftshoe ⊂ SUBSET OF */
- { 0x0bdc, 0x22a3 }, /* lefttack ⊣ LEFT TACK */
- { 0x0bfc, 0x22a2 }, /* righttack ⊢ RIGHT TACK */
- { 0x0cdf, 0x2017 }, /* hebrew_doublelowline ‗ DOUBLE LOW LINE */
- { 0x0ce0, 0x05d0 }, /* hebrew_aleph × HEBREW LETTER ALEF */
- { 0x0ce1, 0x05d1 }, /* hebrew_bet ב HEBREW LETTER BET */
- { 0x0ce2, 0x05d2 }, /* hebrew_gimel ×’ HEBREW LETTER GIMEL */
- { 0x0ce3, 0x05d3 }, /* hebrew_dalet ד HEBREW LETTER DALET */
- { 0x0ce4, 0x05d4 }, /* hebrew_he ×” HEBREW LETTER HE */
- { 0x0ce5, 0x05d5 }, /* hebrew_waw ו HEBREW LETTER VAV */
- { 0x0ce6, 0x05d6 }, /* hebrew_zain ×– HEBREW LETTER ZAYIN */
- { 0x0ce7, 0x05d7 }, /* hebrew_chet ×— HEBREW LETTER HET */
- { 0x0ce8, 0x05d8 }, /* hebrew_tet ט HEBREW LETTER TET */
- { 0x0ce9, 0x05d9 }, /* hebrew_yod ×™ HEBREW LETTER YOD */
- { 0x0cea, 0x05da }, /* hebrew_finalkaph ך HEBREW LETTER FINAL KAF */
- { 0x0ceb, 0x05db }, /* hebrew_kaph ×› HEBREW LETTER KAF */
- { 0x0cec, 0x05dc }, /* hebrew_lamed ל HEBREW LETTER LAMED */
- { 0x0ced, 0x05dd }, /* hebrew_finalmem × HEBREW LETTER FINAL MEM */
- { 0x0cee, 0x05de }, /* hebrew_mem מ HEBREW LETTER MEM */
- { 0x0cef, 0x05df }, /* hebrew_finalnun ן HEBREW LETTER FINAL NUN */
- { 0x0cf0, 0x05e0 }, /* hebrew_nun ×  HEBREW LETTER NUN */
- { 0x0cf1, 0x05e1 }, /* hebrew_samech ס HEBREW LETTER SAMEKH */
- { 0x0cf2, 0x05e2 }, /* hebrew_ayin ×¢ HEBREW LETTER AYIN */
- { 0x0cf3, 0x05e3 }, /* hebrew_finalpe ×£ HEBREW LETTER FINAL PE */
- { 0x0cf4, 0x05e4 }, /* hebrew_pe פ HEBREW LETTER PE */
- { 0x0cf5, 0x05e5 }, /* hebrew_finalzade ×¥ HEBREW LETTER FINAL TSADI */
- { 0x0cf6, 0x05e6 }, /* hebrew_zade צ HEBREW LETTER TSADI */
- { 0x0cf7, 0x05e7 }, /* hebrew_qoph ק HEBREW LETTER QOF */
- { 0x0cf8, 0x05e8 }, /* hebrew_resh ר HEBREW LETTER RESH */
- { 0x0cf9, 0x05e9 }, /* hebrew_shin ש HEBREW LETTER SHIN */
- { 0x0cfa, 0x05ea }, /* hebrew_taw ת HEBREW LETTER TAV */
- { 0x0da1, 0x0e01 }, /* Thai_kokai ภTHAI CHARACTER KO KAI */
- { 0x0da2, 0x0e02 }, /* Thai_khokhai ข THAI CHARACTER KHO KHAI */
- { 0x0da3, 0x0e03 }, /* Thai_khokhuat ฃ THAI CHARACTER KHO KHUAT */
- { 0x0da4, 0x0e04 }, /* Thai_khokhwai ค THAI CHARACTER KHO KHWAI */
- { 0x0da5, 0x0e05 }, /* Thai_khokhon ฅ THAI CHARACTER KHO KHON */
- { 0x0da6, 0x0e06 }, /* Thai_khorakhang ฆ THAI CHARACTER KHO RAKHANG */
- { 0x0da7, 0x0e07 }, /* Thai_ngongu ง THAI CHARACTER NGO NGU */
- { 0x0da8, 0x0e08 }, /* Thai_chochan จ THAI CHARACTER CHO CHAN */
- { 0x0da9, 0x0e09 }, /* Thai_choching ฉ THAI CHARACTER CHO CHING */
- { 0x0daa, 0x0e0a }, /* Thai_chochang ช THAI CHARACTER CHO CHANG */
- { 0x0dab, 0x0e0b }, /* Thai_soso ซ THAI CHARACTER SO SO */
- { 0x0dac, 0x0e0c }, /* Thai_chochoe ฌ THAI CHARACTER CHO CHOE */
- { 0x0dad, 0x0e0d }, /* Thai_yoying ภTHAI CHARACTER YO YING */
- { 0x0dae, 0x0e0e }, /* Thai_dochada ฎ THAI CHARACTER DO CHADA */
- { 0x0daf, 0x0e0f }, /* Thai_topatak ภTHAI CHARACTER TO PATAK */
- { 0x0db0, 0x0e10 }, /* Thai_thothan ภTHAI CHARACTER THO THAN */
- { 0x0db1, 0x0e11 }, /* Thai_thonangmontho ฑ THAI CHARACTER THO NANGMONTHO */
- { 0x0db2, 0x0e12 }, /* Thai_thophuthao ฒ THAI CHARACTER THO PHUTHAO */
- { 0x0db3, 0x0e13 }, /* Thai_nonen ณ THAI CHARACTER NO NEN */
- { 0x0db4, 0x0e14 }, /* Thai_dodek ด THAI CHARACTER DO DEK */
- { 0x0db5, 0x0e15 }, /* Thai_totao ต THAI CHARACTER TO TAO */
- { 0x0db6, 0x0e16 }, /* Thai_thothung ถ THAI CHARACTER THO THUNG */
- { 0x0db7, 0x0e17 }, /* Thai_thothahan ท THAI CHARACTER THO THAHAN */
- { 0x0db8, 0x0e18 }, /* Thai_thothong ธ THAI CHARACTER THO THONG */
- { 0x0db9, 0x0e19 }, /* Thai_nonu น THAI CHARACTER NO NU */
- { 0x0dba, 0x0e1a }, /* Thai_bobaimai บ THAI CHARACTER BO BAIMAI */
- { 0x0dbb, 0x0e1b }, /* Thai_popla ป THAI CHARACTER PO PLA */
- { 0x0dbc, 0x0e1c }, /* Thai_phophung ผ THAI CHARACTER PHO PHUNG */
- { 0x0dbd, 0x0e1d }, /* Thai_fofa ภTHAI CHARACTER FO FA */
- { 0x0dbe, 0x0e1e }, /* Thai_phophan พ THAI CHARACTER PHO PHAN */
- { 0x0dbf, 0x0e1f }, /* Thai_fofan ฟ THAI CHARACTER FO FAN */
- { 0x0dc0, 0x0e20 }, /* Thai_phosamphao ภ THAI CHARACTER PHO SAMPHAO */
- { 0x0dc1, 0x0e21 }, /* Thai_moma ม THAI CHARACTER MO MA */
- { 0x0dc2, 0x0e22 }, /* Thai_yoyak ย THAI CHARACTER YO YAK */
- { 0x0dc3, 0x0e23 }, /* Thai_rorua ร THAI CHARACTER RO RUA */
- { 0x0dc4, 0x0e24 }, /* Thai_ru ฤ THAI CHARACTER RU */
- { 0x0dc5, 0x0e25 }, /* Thai_loling ล THAI CHARACTER LO LING */
- { 0x0dc6, 0x0e26 }, /* Thai_lu ฦ THAI CHARACTER LU */
- { 0x0dc7, 0x0e27 }, /* Thai_wowaen ว THAI CHARACTER WO WAEN */
- { 0x0dc8, 0x0e28 }, /* Thai_sosala ศ THAI CHARACTER SO SALA */
- { 0x0dc9, 0x0e29 }, /* Thai_sorusi ษ THAI CHARACTER SO RUSI */
- { 0x0dca, 0x0e2a }, /* Thai_sosua ส THAI CHARACTER SO SUA */
- { 0x0dcb, 0x0e2b }, /* Thai_hohip ห THAI CHARACTER HO HIP */
- { 0x0dcc, 0x0e2c }, /* Thai_lochula ฬ THAI CHARACTER LO CHULA */
- { 0x0dcd, 0x0e2d }, /* Thai_oang อ THAI CHARACTER O ANG */
- { 0x0dce, 0x0e2e }, /* Thai_honokhuk ฮ THAI CHARACTER HO NOKHUK */
- { 0x0dcf, 0x0e2f }, /* Thai_paiyannoi ฯ THAI CHARACTER PAIYANNOI */
- { 0x0dd0, 0x0e30 }, /* Thai_saraa ะ THAI CHARACTER SARA A */
- { 0x0dd1, 0x0e31 }, /* Thai_maihanakat ั THAI CHARACTER MAI HAN-AKAT */
- { 0x0dd2, 0x0e32 }, /* Thai_saraaa า THAI CHARACTER SARA AA */
- { 0x0dd3, 0x0e33 }, /* Thai_saraam ำ THAI CHARACTER SARA AM */
- { 0x0dd4, 0x0e34 }, /* Thai_sarai ิ THAI CHARACTER SARA I */
- { 0x0dd5, 0x0e35 }, /* Thai_saraii ี THAI CHARACTER SARA II */
- { 0x0dd6, 0x0e36 }, /* Thai_saraue ึ THAI CHARACTER SARA UE */
- { 0x0dd7, 0x0e37 }, /* Thai_sarauee ื THAI CHARACTER SARA UEE */
- { 0x0dd8, 0x0e38 }, /* Thai_sarau ุ THAI CHARACTER SARA U */
- { 0x0dd9, 0x0e39 }, /* Thai_sarauu ู THAI CHARACTER SARA UU */
- { 0x0dda, 0x0e3a }, /* Thai_phinthu ฺ THAI CHARACTER PHINTHU */
- { 0x0dde, 0x0e3e }, /* Thai_maihanakat_maitho ฾ ??? */
- { 0x0ddf, 0x0e3f }, /* Thai_baht ฿ THAI CURRENCY SYMBOL BAHT */
- { 0x0de0, 0x0e40 }, /* Thai_sarae เ THAI CHARACTER SARA E */
- { 0x0de1, 0x0e41 }, /* Thai_saraae ๠THAI CHARACTER SARA AE */
- { 0x0de2, 0x0e42 }, /* Thai_sarao โ THAI CHARACTER SARA O */
- { 0x0de3, 0x0e43 }, /* Thai_saraaimaimuan ใ THAI CHARACTER SARA AI MAIMUAN */
- { 0x0de4, 0x0e44 }, /* Thai_saraaimaimalai ไ THAI CHARACTER SARA AI MAIMALAI */
- { 0x0de5, 0x0e45 }, /* Thai_lakkhangyao ๅ THAI CHARACTER LAKKHANGYAO */
- { 0x0de6, 0x0e46 }, /* Thai_maiyamok ๆ THAI CHARACTER MAIYAMOK */
- { 0x0de7, 0x0e47 }, /* Thai_maitaikhu ็ THAI CHARACTER MAITAIKHU */
- { 0x0de8, 0x0e48 }, /* Thai_maiek ่ THAI CHARACTER MAI EK */
- { 0x0de9, 0x0e49 }, /* Thai_maitho ้ THAI CHARACTER MAI THO */
- { 0x0dea, 0x0e4a }, /* Thai_maitri ๊ THAI CHARACTER MAI TRI */
- { 0x0deb, 0x0e4b }, /* Thai_maichattawa ๋ THAI CHARACTER MAI CHATTAWA */
- { 0x0dec, 0x0e4c }, /* Thai_thanthakhat ์ THAI CHARACTER THANTHAKHAT */
- { 0x0ded, 0x0e4d }, /* Thai_nikhahit ๠THAI CHARACTER NIKHAHIT */
- { 0x0df0, 0x0e50 }, /* Thai_leksun ๠THAI DIGIT ZERO */
- { 0x0df1, 0x0e51 }, /* Thai_leknung ๑ THAI DIGIT ONE */
- { 0x0df2, 0x0e52 }, /* Thai_leksong ๒ THAI DIGIT TWO */
- { 0x0df3, 0x0e53 }, /* Thai_leksam ๓ THAI DIGIT THREE */
- { 0x0df4, 0x0e54 }, /* Thai_leksi ๔ THAI DIGIT FOUR */
- { 0x0df5, 0x0e55 }, /* Thai_lekha ๕ THAI DIGIT FIVE */
- { 0x0df6, 0x0e56 }, /* Thai_lekhok ๖ THAI DIGIT SIX */
- { 0x0df7, 0x0e57 }, /* Thai_lekchet ๗ THAI DIGIT SEVEN */
- { 0x0df8, 0x0e58 }, /* Thai_lekpaet ๘ THAI DIGIT EIGHT */
- { 0x0df9, 0x0e59 }, /* Thai_lekkao ๙ THAI DIGIT NINE */
- { 0x0ea1, 0x3131 }, /* Hangul_Kiyeog ㄱ HANGUL LETTER KIYEOK */
- { 0x0ea2, 0x3132 }, /* Hangul_SsangKiyeog ㄲ HANGUL LETTER SSANGKIYEOK */
- { 0x0ea3, 0x3133 }, /* Hangul_KiyeogSios ㄳ HANGUL LETTER KIYEOK-SIOS */
- { 0x0ea4, 0x3134 }, /* Hangul_Nieun ã„´ HANGUL LETTER NIEUN */
- { 0x0ea5, 0x3135 }, /* Hangul_NieunJieuj ㄵ HANGUL LETTER NIEUN-CIEUC */
- { 0x0ea6, 0x3136 }, /* Hangul_NieunHieuh ㄶ HANGUL LETTER NIEUN-HIEUH */
- { 0x0ea7, 0x3137 }, /* Hangul_Dikeud ã„· HANGUL LETTER TIKEUT */
- { 0x0ea8, 0x3138 }, /* Hangul_SsangDikeud ㄸ HANGUL LETTER SSANGTIKEUT */
- { 0x0ea9, 0x3139 }, /* Hangul_Rieul ㄹ HANGUL LETTER RIEUL */
- { 0x0eaa, 0x313a }, /* Hangul_RieulKiyeog ㄺ HANGUL LETTER RIEUL-KIYEOK */
- { 0x0eab, 0x313b }, /* Hangul_RieulMieum ã„» HANGUL LETTER RIEUL-MIEUM */
- { 0x0eac, 0x313c }, /* Hangul_RieulPieub ㄼ HANGUL LETTER RIEUL-PIEUP */
- { 0x0ead, 0x313d }, /* Hangul_RieulSios ㄽ HANGUL LETTER RIEUL-SIOS */
- { 0x0eae, 0x313e }, /* Hangul_RieulTieut ㄾ HANGUL LETTER RIEUL-THIEUTH */
- { 0x0eaf, 0x313f }, /* Hangul_RieulPhieuf ã„¿ HANGUL LETTER RIEUL-PHIEUPH */
- { 0x0eb0, 0x3140 }, /* Hangul_RieulHieuh ã…€ HANGUL LETTER RIEUL-HIEUH */
- { 0x0eb1, 0x3141 }, /* Hangul_Mieum ã… HANGUL LETTER MIEUM */
- { 0x0eb2, 0x3142 }, /* Hangul_Pieub ã…‚ HANGUL LETTER PIEUP */
- { 0x0eb3, 0x3143 }, /* Hangul_SsangPieub ã…ƒ HANGUL LETTER SSANGPIEUP */
- { 0x0eb4, 0x3144 }, /* Hangul_PieubSios ã…„ HANGUL LETTER PIEUP-SIOS */
- { 0x0eb5, 0x3145 }, /* Hangul_Sios ã…… HANGUL LETTER SIOS */
- { 0x0eb6, 0x3146 }, /* Hangul_SsangSios ã…† HANGUL LETTER SSANGSIOS */
- { 0x0eb7, 0x3147 }, /* Hangul_Ieung ã…‡ HANGUL LETTER IEUNG */
- { 0x0eb8, 0x3148 }, /* Hangul_Jieuj ã…ˆ HANGUL LETTER CIEUC */
- { 0x0eb9, 0x3149 }, /* Hangul_SsangJieuj ã…‰ HANGUL LETTER SSANGCIEUC */
- { 0x0eba, 0x314a }, /* Hangul_Cieuc ã…Š HANGUL LETTER CHIEUCH */
- { 0x0ebb, 0x314b }, /* Hangul_Khieuq ã…‹ HANGUL LETTER KHIEUKH */
- { 0x0ebc, 0x314c }, /* Hangul_Tieut ㅌ HANGUL LETTER THIEUTH */
- { 0x0ebd, 0x314d }, /* Hangul_Phieuf ã… HANGUL LETTER PHIEUPH */
- { 0x0ebe, 0x314e }, /* Hangul_Hieuh ã…Ž HANGUL LETTER HIEUH */
- { 0x0ebf, 0x314f }, /* Hangul_A ã… HANGUL LETTER A */
- { 0x0ec0, 0x3150 }, /* Hangul_AE ã… HANGUL LETTER AE */
- { 0x0ec1, 0x3151 }, /* Hangul_YA ã…‘ HANGUL LETTER YA */
- { 0x0ec2, 0x3152 }, /* Hangul_YAE ã…’ HANGUL LETTER YAE */
- { 0x0ec3, 0x3153 }, /* Hangul_EO ã…“ HANGUL LETTER EO */
- { 0x0ec4, 0x3154 }, /* Hangul_E ã…” HANGUL LETTER E */
- { 0x0ec5, 0x3155 }, /* Hangul_YEO ã…• HANGUL LETTER YEO */
- { 0x0ec6, 0x3156 }, /* Hangul_YE ã…– HANGUL LETTER YE */
- { 0x0ec7, 0x3157 }, /* Hangul_O ã…— HANGUL LETTER O */
- { 0x0ec8, 0x3158 }, /* Hangul_WA ã…˜ HANGUL LETTER WA */
- { 0x0ec9, 0x3159 }, /* Hangul_WAE ã…™ HANGUL LETTER WAE */
- { 0x0eca, 0x315a }, /* Hangul_OE ã…š HANGUL LETTER OE */
- { 0x0ecb, 0x315b }, /* Hangul_YO ã…› HANGUL LETTER YO */
- { 0x0ecc, 0x315c }, /* Hangul_U ㅜ HANGUL LETTER U */
- { 0x0ecd, 0x315d }, /* Hangul_WEO ã… HANGUL LETTER WEO */
- { 0x0ece, 0x315e }, /* Hangul_WE ã…ž HANGUL LETTER WE */
- { 0x0ecf, 0x315f }, /* Hangul_WI ã…Ÿ HANGUL LETTER WI */
- { 0x0ed0, 0x3160 }, /* Hangul_YU ã…  HANGUL LETTER YU */
- { 0x0ed1, 0x3161 }, /* Hangul_EU ã…¡ HANGUL LETTER EU */
- { 0x0ed2, 0x3162 }, /* Hangul_YI ã…¢ HANGUL LETTER YI */
- { 0x0ed3, 0x3163 }, /* Hangul_I ã…£ HANGUL LETTER I */
- { 0x0ed4, 0x11a8 }, /* Hangul_J_Kiyeog ᆨ HANGUL JONGSEONG KIYEOK */
- { 0x0ed5, 0x11a9 }, /* Hangul_J_SsangKiyeog ᆩ HANGUL JONGSEONG SSANGKIYEOK */
- { 0x0ed6, 0x11aa }, /* Hangul_J_KiyeogSios ᆪ HANGUL JONGSEONG KIYEOK-SIOS */
- { 0x0ed7, 0x11ab }, /* Hangul_J_Nieun ᆫ HANGUL JONGSEONG NIEUN */
- { 0x0ed8, 0x11ac }, /* Hangul_J_NieunJieuj ᆬ HANGUL JONGSEONG NIEUN-CIEUC */
- { 0x0ed9, 0x11ad }, /* Hangul_J_NieunHieuh ᆭ HANGUL JONGSEONG NIEUN-HIEUH */
- { 0x0eda, 0x11ae }, /* Hangul_J_Dikeud ᆮ HANGUL JONGSEONG TIKEUT */
- { 0x0edb, 0x11af }, /* Hangul_J_Rieul ᆯ HANGUL JONGSEONG RIEUL */
- { 0x0edc, 0x11b0 }, /* Hangul_J_RieulKiyeog ᆰ HANGUL JONGSEONG RIEUL-KIYEOK */
- { 0x0edd, 0x11b1 }, /* Hangul_J_RieulMieum ᆱ HANGUL JONGSEONG RIEUL-MIEUM */
- { 0x0ede, 0x11b2 }, /* Hangul_J_RieulPieub ᆲ HANGUL JONGSEONG RIEUL-PIEUP */
- { 0x0edf, 0x11b3 }, /* Hangul_J_RieulSios ᆳ HANGUL JONGSEONG RIEUL-SIOS */
- { 0x0ee0, 0x11b4 }, /* Hangul_J_RieulTieut ᆴ HANGUL JONGSEONG RIEUL-THIEUTH */
- { 0x0ee1, 0x11b5 }, /* Hangul_J_RieulPhieuf ᆵ HANGUL JONGSEONG RIEUL-PHIEUPH */
- { 0x0ee2, 0x11b6 }, /* Hangul_J_RieulHieuh ᆶ HANGUL JONGSEONG RIEUL-HIEUH */
- { 0x0ee3, 0x11b7 }, /* Hangul_J_Mieum ᆷ HANGUL JONGSEONG MIEUM */
- { 0x0ee4, 0x11b8 }, /* Hangul_J_Pieub ᆸ HANGUL JONGSEONG PIEUP */
- { 0x0ee5, 0x11b9 }, /* Hangul_J_PieubSios ᆹ HANGUL JONGSEONG PIEUP-SIOS */
- { 0x0ee6, 0x11ba }, /* Hangul_J_Sios ᆺ HANGUL JONGSEONG SIOS */
- { 0x0ee7, 0x11bb }, /* Hangul_J_SsangSios ᆻ HANGUL JONGSEONG SSANGSIOS */
- { 0x0ee8, 0x11bc }, /* Hangul_J_Ieung ᆼ HANGUL JONGSEONG IEUNG */
- { 0x0ee9, 0x11bd }, /* Hangul_J_Jieuj ᆽ HANGUL JONGSEONG CIEUC */
- { 0x0eea, 0x11be }, /* Hangul_J_Cieuc ᆾ HANGUL JONGSEONG CHIEUCH */
- { 0x0eeb, 0x11bf }, /* Hangul_J_Khieuq ᆿ HANGUL JONGSEONG KHIEUKH */
- { 0x0eec, 0x11c0 }, /* Hangul_J_Tieut ᇀ HANGUL JONGSEONG THIEUTH */
- { 0x0eed, 0x11c1 }, /* Hangul_J_Phieuf ᇠHANGUL JONGSEONG PHIEUPH */
- { 0x0eee, 0x11c2 }, /* Hangul_J_Hieuh ᇂ HANGUL JONGSEONG HIEUH */
- { 0x0eef, 0x316d }, /* Hangul_RieulYeorinHieuh ã…­ HANGUL LETTER RIEUL-YEORINHIEUH */
- { 0x0ef0, 0x3171 }, /* Hangul_SunkyeongeumMieum ã…± HANGUL LETTER KAPYEOUNMIEUM */
- { 0x0ef1, 0x3178 }, /* Hangul_SunkyeongeumPieub ã…¸ HANGUL LETTER KAPYEOUNPIEUP */
- { 0x0ef2, 0x317f }, /* Hangul_PanSios ã…¿ HANGUL LETTER PANSIOS */
-/* 0x0ef3 Hangul_KkogjiDalrinIeung ? ??? */
- { 0x0ef4, 0x3184 }, /* Hangul_SunkyeongeumPhieuf ㆄ HANGUL LETTER KAPYEOUNPHIEUPH */
- { 0x0ef5, 0x3186 }, /* Hangul_YeorinHieuh ㆆ HANGUL LETTER YEORINHIEUH */
- { 0x0ef6, 0x318d }, /* Hangul_AraeA ㆠHANGUL LETTER ARAEA */
- { 0x0ef7, 0x318e }, /* Hangul_AraeAE ㆎ HANGUL LETTER ARAEAE */
- { 0x0ef8, 0x11eb }, /* Hangul_J_PanSios ᇫ HANGUL JONGSEONG PANSIOS */
-/* 0x0ef9 Hangul_J_KkogjiDalrinIeung ? ??? */
- { 0x0efa, 0x11f9 }, /* Hangul_J_YeorinHieuh ᇹ HANGUL JONGSEONG YEORINHIEUH */
- { 0x0eff, 0x20a9 }, /* Korean_Won â‚© WON SIGN */
- { 0x13bc, 0x0152 }, /* OE Å’ LATIN CAPITAL LIGATURE OE */
- { 0x13bd, 0x0153 }, /* oe Å“ LATIN SMALL LIGATURE OE */
- { 0x13be, 0x0178 }, /* Ydiaeresis Ÿ LATIN CAPITAL LETTER Y WITH DIAERESIS */
- { 0x20a0, 0x20a0 }, /* EcuSign â‚  EURO-CURRENCY SIGN */
- { 0x20a1, 0x20a1 }, /* ColonSign â‚¡ COLON SIGN */
- { 0x20a2, 0x20a2 }, /* CruzeiroSign â‚¢ CRUZEIRO SIGN */
- { 0x20a3, 0x20a3 }, /* FFrancSign â‚£ FRENCH FRANC SIGN */
- { 0x20a4, 0x20a4 }, /* LiraSign ₤ LIRA SIGN */
- { 0x20a5, 0x20a5 }, /* MillSign â‚¥ MILL SIGN */
- { 0x20a6, 0x20a6 }, /* NairaSign ₦ NAIRA SIGN */
- { 0x20a7, 0x20a7 }, /* PesetaSign ₧ PESETA SIGN */
- { 0x20a8, 0x20a8 }, /* RupeeSign ₨ RUPEE SIGN */
- { 0x20a9, 0x20a9 }, /* WonSign â‚© WON SIGN */
- { 0x20aa, 0x20aa }, /* NewSheqelSign ₪ NEW SHEQEL SIGN */
- { 0x20ab, 0x20ab }, /* DongSign â‚« DONG SIGN */
- { 0x20ac, 0x20ac }, /* EuroSign € EURO SIGN */
-
-
- /* Following items added to GTK, not in the xterm table */
-
- /* Numeric keypad */
-
- { 0xFF80 /* Space */, ' ' },
- { 0xFFAA /* Multiply */, '*' },
- { 0xFFAB /* Add */, '+' },
- { 0xFFAC /* Separator */, ',' },
- { 0xFFAD /* Subtract */, '-' },
- { 0xFFAE /* Decimal */, '.' },
- { 0xFFAF /* Divide */, '/' },
- { 0xFFB0 /* 0 */, '0' },
- { 0xFFB1 /* 1 */, '1' },
- { 0xFFB2 /* 2 */, '2' },
- { 0xFFB3 /* 3 */, '3' },
- { 0xFFB4 /* 4 */, '4' },
- { 0xFFB5 /* 5 */, '5' },
- { 0xFFB6 /* 6 */, '6' },
- { 0xFFB7 /* 7 */, '7' },
- { 0xFFB8 /* 8 */, '8' },
- { 0xFFB9 /* 9 */, '9' },
- { 0xFFBD /* Equal */, '=' },
-
- /* End numeric keypad */
-};
-
-static const int clutter_keysym_to_unicode_tab_size =
- G_N_ELEMENTS (clutter_keysym_to_unicode_tab);
-
-/**
- * clutter_keysym_to_unicode:
- * @keyval: a key symbol
- *
- * Converts @keyval from a Clutter key symbol to the corresponding
- * ISO10646 (Unicode) character.
- *
- * Return value: a Unicode character, or 0 if there is no corresponding
- * character.
- */
-guint32
-clutter_keysym_to_unicode (guint keyval)
-{
- int min = 0;
- int max = clutter_keysym_to_unicode_tab_size - 1;
- int mid;
-
- /* First check for Latin-1 characters (1:1 mapping) */
- if ((keyval >= 0x0020 && keyval <= 0x007e) ||
- (keyval >= 0x00a0 && keyval <= 0x00ff))
- return keyval;
-
- /* Also check for directly encoded 24-bit UCS characters: */
- if ((keyval & 0xff000000) == 0x01000000)
- return keyval & 0x00ffffff;
-
- /* binary search in table */
- while (max >= min)
- {
- mid = (min + max) / 2;
-
- if (clutter_keysym_to_unicode_tab[mid].keysym < keyval)
- min = mid + 1;
- else if (clutter_keysym_to_unicode_tab[mid].keysym > keyval)
- max = mid - 1;
- else
- {
- /* found it */
- return clutter_keysym_to_unicode_tab[mid].ucs;
- }
- }
-
- /* No matching Unicode value found */
- return 0;
-}
-
-static const struct {
- unsigned short keysym;
- unsigned short ucs;
-} clutter_unicode_to_keysym_tab[] = {
- { 0x0abd, 0x002e }, /* decimalpoint . FULL STOP */
- { 0x0ba3, 0x003c }, /* leftcaret < LESS-THAN SIGN */
- { 0x0ba6, 0x003e }, /* rightcaret > GREATER-THAN SIGN */
- { 0x0bc6, 0x005f }, /* underbar _ LOW LINE */
- { 0x0bc0, 0x00af }, /* overbar ¯ MACRON */
- { 0x03c0, 0x0100 }, /* Amacron Ā LATIN CAPITAL LETTER A WITH MACRON */
- { 0x03e0, 0x0101 }, /* amacron Ä LATIN SMALL LETTER A WITH MACRON */
- { 0x01c3, 0x0102 }, /* Abreve Ä‚ LATIN CAPITAL LETTER A WITH BREVE */
- { 0x01e3, 0x0103 }, /* abreve ă LATIN SMALL LETTER A WITH BREVE */
- { 0x01a1, 0x0104 }, /* Aogonek Ä„ LATIN CAPITAL LETTER A WITH OGONEK */
- { 0x01b1, 0x0105 }, /* aogonek Ä… LATIN SMALL LETTER A WITH OGONEK */
- { 0x01c6, 0x0106 }, /* Cacute Ć LATIN CAPITAL LETTER C WITH ACUTE */
- { 0x01e6, 0x0107 }, /* cacute ć LATIN SMALL LETTER C WITH ACUTE */
- { 0x02c6, 0x0108 }, /* Ccircumflex Ĉ LATIN CAPITAL LETTER C WITH CIRCUMFLEX */
- { 0x02e6, 0x0109 }, /* ccircumflex ĉ LATIN SMALL LETTER C WITH CIRCUMFLEX */
- { 0x02c5, 0x010a }, /* Cabovedot ÄŠ LATIN CAPITAL LETTER C WITH DOT ABOVE */
- { 0x02e5, 0x010b }, /* cabovedot Ä‹ LATIN SMALL LETTER C WITH DOT ABOVE */
- { 0x01c8, 0x010c }, /* Ccaron Č LATIN CAPITAL LETTER C WITH CARON */
- { 0x01e8, 0x010d }, /* ccaron Ä LATIN SMALL LETTER C WITH CARON */
- { 0x01cf, 0x010e }, /* Dcaron ÄŽ LATIN CAPITAL LETTER D WITH CARON */
- { 0x01ef, 0x010f }, /* dcaron Ä LATIN SMALL LETTER D WITH CARON */
- { 0x01d0, 0x0110 }, /* Dstroke Ä LATIN CAPITAL LETTER D WITH STROKE */
- { 0x01f0, 0x0111 }, /* dstroke Ä‘ LATIN SMALL LETTER D WITH STROKE */
- { 0x03aa, 0x0112 }, /* Emacron Ä’ LATIN CAPITAL LETTER E WITH MACRON */
- { 0x03ba, 0x0113 }, /* emacron Ä“ LATIN SMALL LETTER E WITH MACRON */
- { 0x03cc, 0x0116 }, /* Eabovedot Ä– LATIN CAPITAL LETTER E WITH DOT ABOVE */
- { 0x03ec, 0x0117 }, /* eabovedot Ä— LATIN SMALL LETTER E WITH DOT ABOVE */
- { 0x01ca, 0x0118 }, /* Eogonek Ę LATIN CAPITAL LETTER E WITH OGONEK */
- { 0x01ea, 0x0119 }, /* eogonek Ä™ LATIN SMALL LETTER E WITH OGONEK */
- { 0x01cc, 0x011a }, /* Ecaron Äš LATIN CAPITAL LETTER E WITH CARON */
- { 0x01ec, 0x011b }, /* ecaron Ä› LATIN SMALL LETTER E WITH CARON */
- { 0x02d8, 0x011c }, /* Gcircumflex Ĝ LATIN CAPITAL LETTER G WITH CIRCUMFLEX */
- { 0x02f8, 0x011d }, /* gcircumflex Ä LATIN SMALL LETTER G WITH CIRCUMFLEX */
- { 0x02ab, 0x011e }, /* Gbreve Äž LATIN CAPITAL LETTER G WITH BREVE */
- { 0x02bb, 0x011f }, /* gbreve ÄŸ LATIN SMALL LETTER G WITH BREVE */
- { 0x02d5, 0x0120 }, /* Gabovedot Ä  LATIN CAPITAL LETTER G WITH DOT ABOVE */
- { 0x02f5, 0x0121 }, /* gabovedot Ä¡ LATIN SMALL LETTER G WITH DOT ABOVE */
- { 0x03ab, 0x0122 }, /* Gcedilla Ģ LATIN CAPITAL LETTER G WITH CEDILLA */
- { 0x03bb, 0x0123 }, /* gcedilla ģ LATIN SMALL LETTER G WITH CEDILLA */
- { 0x02a6, 0x0124 }, /* Hcircumflex Ĥ LATIN CAPITAL LETTER H WITH CIRCUMFLEX */
- { 0x02b6, 0x0125 }, /* hcircumflex ĥ LATIN SMALL LETTER H WITH CIRCUMFLEX */
- { 0x02a1, 0x0126 }, /* Hstroke Ħ LATIN CAPITAL LETTER H WITH STROKE */
- { 0x02b1, 0x0127 }, /* hstroke ħ LATIN SMALL LETTER H WITH STROKE */
- { 0x03a5, 0x0128 }, /* Itilde Ĩ LATIN CAPITAL LETTER I WITH TILDE */
- { 0x03b5, 0x0129 }, /* itilde Ä© LATIN SMALL LETTER I WITH TILDE */
- { 0x03cf, 0x012a }, /* Imacron Ī LATIN CAPITAL LETTER I WITH MACRON */
- { 0x03ef, 0x012b }, /* imacron Ä« LATIN SMALL LETTER I WITH MACRON */
- { 0x03c7, 0x012e }, /* Iogonek Ä® LATIN CAPITAL LETTER I WITH OGONEK */
- { 0x03e7, 0x012f }, /* iogonek į LATIN SMALL LETTER I WITH OGONEK */
- { 0x02a9, 0x0130 }, /* Iabovedot Ä° LATIN CAPITAL LETTER I WITH DOT ABOVE */
- { 0x02b9, 0x0131 }, /* idotless ı LATIN SMALL LETTER DOTLESS I */
- { 0x02ac, 0x0134 }, /* Jcircumflex Ä´ LATIN CAPITAL LETTER J WITH CIRCUMFLEX */
- { 0x02bc, 0x0135 }, /* jcircumflex ĵ LATIN SMALL LETTER J WITH CIRCUMFLEX */
- { 0x03d3, 0x0136 }, /* Kcedilla Ķ LATIN CAPITAL LETTER K WITH CEDILLA */
- { 0x03f3, 0x0137 }, /* kcedilla Ä· LATIN SMALL LETTER K WITH CEDILLA */
- { 0x03a2, 0x0138 }, /* kra ĸ LATIN SMALL LETTER KRA */
- { 0x01c5, 0x0139 }, /* Lacute Ĺ LATIN CAPITAL LETTER L WITH ACUTE */
- { 0x01e5, 0x013a }, /* lacute ĺ LATIN SMALL LETTER L WITH ACUTE */
- { 0x03a6, 0x013b }, /* Lcedilla Ä» LATIN CAPITAL LETTER L WITH CEDILLA */
- { 0x03b6, 0x013c }, /* lcedilla ļ LATIN SMALL LETTER L WITH CEDILLA */
- { 0x01a5, 0x013d }, /* Lcaron Ľ LATIN CAPITAL LETTER L WITH CARON */
- { 0x01b5, 0x013e }, /* lcaron ľ LATIN SMALL LETTER L WITH CARON */
- { 0x01a3, 0x0141 }, /* Lstroke Å LATIN CAPITAL LETTER L WITH STROKE */
- { 0x01b3, 0x0142 }, /* lstroke Å‚ LATIN SMALL LETTER L WITH STROKE */
- { 0x01d1, 0x0143 }, /* Nacute Ń LATIN CAPITAL LETTER N WITH ACUTE */
- { 0x01f1, 0x0144 }, /* nacute Å„ LATIN SMALL LETTER N WITH ACUTE */
- { 0x03d1, 0x0145 }, /* Ncedilla Å… LATIN CAPITAL LETTER N WITH CEDILLA */
- { 0x03f1, 0x0146 }, /* ncedilla ņ LATIN SMALL LETTER N WITH CEDILLA */
- { 0x01d2, 0x0147 }, /* Ncaron Ň LATIN CAPITAL LETTER N WITH CARON */
- { 0x01f2, 0x0148 }, /* ncaron ň LATIN SMALL LETTER N WITH CARON */
- { 0x03bd, 0x014a }, /* ENG ÅŠ LATIN CAPITAL LETTER ENG */
- { 0x03bf, 0x014b }, /* eng Å‹ LATIN SMALL LETTER ENG */
- { 0x03d2, 0x014c }, /* Omacron Ō LATIN CAPITAL LETTER O WITH MACRON */
- { 0x03f2, 0x014d }, /* omacron Å LATIN SMALL LETTER O WITH MACRON */
- { 0x01d5, 0x0150 }, /* Odoubleacute Å LATIN CAPITAL LETTER O WITH DOUBLE ACUTE */
- { 0x01f5, 0x0151 }, /* odoubleacute Å‘ LATIN SMALL LETTER O WITH DOUBLE ACUTE */
- { 0x13bc, 0x0152 }, /* OE Å’ LATIN CAPITAL LIGATURE OE */
- { 0x13bd, 0x0153 }, /* oe Å“ LATIN SMALL LIGATURE OE */
- { 0x01c0, 0x0154 }, /* Racute Å” LATIN CAPITAL LETTER R WITH ACUTE */
- { 0x01e0, 0x0155 }, /* racute Å• LATIN SMALL LETTER R WITH ACUTE */
- { 0x03a3, 0x0156 }, /* Rcedilla Å– LATIN CAPITAL LETTER R WITH CEDILLA */
- { 0x03b3, 0x0157 }, /* rcedilla Å— LATIN SMALL LETTER R WITH CEDILLA */
- { 0x01d8, 0x0158 }, /* Rcaron Ř LATIN CAPITAL LETTER R WITH CARON */
- { 0x01f8, 0x0159 }, /* rcaron Å™ LATIN SMALL LETTER R WITH CARON */
- { 0x01a6, 0x015a }, /* Sacute Åš LATIN CAPITAL LETTER S WITH ACUTE */
- { 0x01b6, 0x015b }, /* sacute Å› LATIN SMALL LETTER S WITH ACUTE */
- { 0x02de, 0x015c }, /* Scircumflex Ŝ LATIN CAPITAL LETTER S WITH CIRCUMFLEX */
- { 0x02fe, 0x015d }, /* scircumflex Å LATIN SMALL LETTER S WITH CIRCUMFLEX */
- { 0x01aa, 0x015e }, /* Scedilla Åž LATIN CAPITAL LETTER S WITH CEDILLA */
- { 0x01ba, 0x015f }, /* scedilla ÅŸ LATIN SMALL LETTER S WITH CEDILLA */
- { 0x01a9, 0x0160 }, /* Scaron Å  LATIN CAPITAL LETTER S WITH CARON */
- { 0x01b9, 0x0161 }, /* scaron Å¡ LATIN SMALL LETTER S WITH CARON */
- { 0x01de, 0x0162 }, /* Tcedilla Ţ LATIN CAPITAL LETTER T WITH CEDILLA */
- { 0x01fe, 0x0163 }, /* tcedilla ţ LATIN SMALL LETTER T WITH CEDILLA */
- { 0x01ab, 0x0164 }, /* Tcaron Ť LATIN CAPITAL LETTER T WITH CARON */
- { 0x01bb, 0x0165 }, /* tcaron ť LATIN SMALL LETTER T WITH CARON */
- { 0x03ac, 0x0166 }, /* Tslash Ŧ LATIN CAPITAL LETTER T WITH STROKE */
- { 0x03bc, 0x0167 }, /* tslash ŧ LATIN SMALL LETTER T WITH STROKE */
- { 0x03dd, 0x0168 }, /* Utilde Ũ LATIN CAPITAL LETTER U WITH TILDE */
- { 0x03fd, 0x0169 }, /* utilde Å© LATIN SMALL LETTER U WITH TILDE */
- { 0x03de, 0x016a }, /* Umacron Ū LATIN CAPITAL LETTER U WITH MACRON */
- { 0x03fe, 0x016b }, /* umacron Å« LATIN SMALL LETTER U WITH MACRON */
- { 0x02dd, 0x016c }, /* Ubreve Ŭ LATIN CAPITAL LETTER U WITH BREVE */
- { 0x02fd, 0x016d }, /* ubreve Å­ LATIN SMALL LETTER U WITH BREVE */
- { 0x01d9, 0x016e }, /* Uring Å® LATIN CAPITAL LETTER U WITH RING ABOVE */
- { 0x01f9, 0x016f }, /* uring ů LATIN SMALL LETTER U WITH RING ABOVE */
- { 0x01db, 0x0170 }, /* Udoubleacute Å° LATIN CAPITAL LETTER U WITH DOUBLE ACUTE */
- { 0x01fb, 0x0171 }, /* udoubleacute ű LATIN SMALL LETTER U WITH DOUBLE ACUTE */
- { 0x03d9, 0x0172 }, /* Uogonek Ų LATIN CAPITAL LETTER U WITH OGONEK */
- { 0x03f9, 0x0173 }, /* uogonek ų LATIN SMALL LETTER U WITH OGONEK */
- { 0x13be, 0x0178 }, /* Ydiaeresis Ÿ LATIN CAPITAL LETTER Y WITH DIAERESIS */
- { 0x01ac, 0x0179 }, /* Zacute Ź LATIN CAPITAL LETTER Z WITH ACUTE */
- { 0x01bc, 0x017a }, /* zacute ź LATIN SMALL LETTER Z WITH ACUTE */
- { 0x01af, 0x017b }, /* Zabovedot Å» LATIN CAPITAL LETTER Z WITH DOT ABOVE */
- { 0x01bf, 0x017c }, /* zabovedot ż LATIN SMALL LETTER Z WITH DOT ABOVE */
- { 0x01ae, 0x017d }, /* Zcaron Ž LATIN CAPITAL LETTER Z WITH CARON */
- { 0x01be, 0x017e }, /* zcaron ž LATIN SMALL LETTER Z WITH CARON */
- { 0x08f6, 0x0192 }, /* function Æ’ LATIN SMALL LETTER F WITH HOOK */
- { 0x01b7, 0x02c7 }, /* caron ˇ CARON */
- { 0x01a2, 0x02d8 }, /* breve ˘ BREVE */
- { 0x01ff, 0x02d9 }, /* abovedot Ë™ DOT ABOVE */
- { 0x01b2, 0x02db }, /* ogonek Ë› OGONEK */
- { 0x01bd, 0x02dd }, /* doubleacute Ë DOUBLE ACUTE ACCENT */
- { 0x07ae, 0x0385 }, /* Greek_accentdieresis Î… GREEK DIALYTIKA TONOS */
- { 0x07a1, 0x0386 }, /* Greek_ALPHAaccent Ά GREEK CAPITAL LETTER ALPHA WITH TONOS */
- { 0x07a2, 0x0388 }, /* Greek_EPSILONaccent Έ GREEK CAPITAL LETTER EPSILON WITH TONOS */
- { 0x07a3, 0x0389 }, /* Greek_ETAaccent Ή GREEK CAPITAL LETTER ETA WITH TONOS */
- { 0x07a4, 0x038a }, /* Greek_IOTAaccent Ί GREEK CAPITAL LETTER IOTA WITH TONOS */
- { 0x07a7, 0x038c }, /* Greek_OMICRONaccent Ό GREEK CAPITAL LETTER OMICRON WITH TONOS */
- { 0x07a8, 0x038e }, /* Greek_UPSILONaccent ÎŽ GREEK CAPITAL LETTER UPSILON WITH TONOS */
- { 0x07ab, 0x038f }, /* Greek_OMEGAaccent Î GREEK CAPITAL LETTER OMEGA WITH TONOS */
- { 0x07b6, 0x0390 }, /* Greek_iotaaccentdieresis Î GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS */
- { 0x07c1, 0x0391 }, /* Greek_ALPHA Α GREEK CAPITAL LETTER ALPHA */
- { 0x07c2, 0x0392 }, /* Greek_BETA Î’ GREEK CAPITAL LETTER BETA */
- { 0x07c3, 0x0393 }, /* Greek_GAMMA Γ GREEK CAPITAL LETTER GAMMA */
- { 0x07c4, 0x0394 }, /* Greek_DELTA Δ GREEK CAPITAL LETTER DELTA */
- { 0x07c5, 0x0395 }, /* Greek_EPSILON Ε GREEK CAPITAL LETTER EPSILON */
- { 0x07c6, 0x0396 }, /* Greek_ZETA Ζ GREEK CAPITAL LETTER ZETA */
- { 0x07c7, 0x0397 }, /* Greek_ETA Η GREEK CAPITAL LETTER ETA */
- { 0x07c8, 0x0398 }, /* Greek_THETA Θ GREEK CAPITAL LETTER THETA */
- { 0x07c9, 0x0399 }, /* Greek_IOTA Ι GREEK CAPITAL LETTER IOTA */
- { 0x07ca, 0x039a }, /* Greek_KAPPA Κ GREEK CAPITAL LETTER KAPPA */
- { 0x07cb, 0x039b }, /* Greek_LAMBDA Λ GREEK CAPITAL LETTER LAMDA */
- { 0x07cc, 0x039c }, /* Greek_MU Μ GREEK CAPITAL LETTER MU */
- { 0x07cd, 0x039d }, /* Greek_NU Î GREEK CAPITAL LETTER NU */
- { 0x07ce, 0x039e }, /* Greek_XI Ξ GREEK CAPITAL LETTER XI */
- { 0x07cf, 0x039f }, /* Greek_OMICRON Ο GREEK CAPITAL LETTER OMICRON */
- { 0x07d0, 0x03a0 }, /* Greek_PI Π GREEK CAPITAL LETTER PI */
- { 0x07d1, 0x03a1 }, /* Greek_RHO Ρ GREEK CAPITAL LETTER RHO */
- { 0x07d2, 0x03a3 }, /* Greek_SIGMA Σ GREEK CAPITAL LETTER SIGMA */
- { 0x07d4, 0x03a4 }, /* Greek_TAU Τ GREEK CAPITAL LETTER TAU */
- { 0x07d5, 0x03a5 }, /* Greek_UPSILON Υ GREEK CAPITAL LETTER UPSILON */
- { 0x07d6, 0x03a6 }, /* Greek_PHI Φ GREEK CAPITAL LETTER PHI */
- { 0x07d7, 0x03a7 }, /* Greek_CHI Χ GREEK CAPITAL LETTER CHI */
- { 0x07d8, 0x03a8 }, /* Greek_PSI Ψ GREEK CAPITAL LETTER PSI */
- { 0x07d9, 0x03a9 }, /* Greek_OMEGA Ω GREEK CAPITAL LETTER OMEGA */
- { 0x07a5, 0x03aa }, /* Greek_IOTAdieresis Ϊ GREEK CAPITAL LETTER IOTA WITH DIALYTIKA */
- { 0x07a9, 0x03ab }, /* Greek_UPSILONdieresis Ϋ GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA */
- { 0x07b1, 0x03ac }, /* Greek_alphaaccent ά GREEK SMALL LETTER ALPHA WITH TONOS */
- { 0x07b2, 0x03ad }, /* Greek_epsilonaccent έ GREEK SMALL LETTER EPSILON WITH TONOS */
- { 0x07b3, 0x03ae }, /* Greek_etaaccent ή GREEK SMALL LETTER ETA WITH TONOS */
- { 0x07b4, 0x03af }, /* Greek_iotaaccent ί GREEK SMALL LETTER IOTA WITH TONOS */
- { 0x07ba, 0x03b0 }, /* Greek_upsilonaccentdieresis ΰ GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS */
- { 0x07e1, 0x03b1 }, /* Greek_alpha α GREEK SMALL LETTER ALPHA */
- { 0x07e2, 0x03b2 }, /* Greek_beta β GREEK SMALL LETTER BETA */
- { 0x07e3, 0x03b3 }, /* Greek_gamma γ GREEK SMALL LETTER GAMMA */
- { 0x07e4, 0x03b4 }, /* Greek_delta δ GREEK SMALL LETTER DELTA */
- { 0x07e5, 0x03b5 }, /* Greek_epsilon ε GREEK SMALL LETTER EPSILON */
- { 0x07e6, 0x03b6 }, /* Greek_zeta ζ GREEK SMALL LETTER ZETA */
- { 0x07e7, 0x03b7 }, /* Greek_eta η GREEK SMALL LETTER ETA */
- { 0x07e8, 0x03b8 }, /* Greek_theta θ GREEK SMALL LETTER THETA */
- { 0x07e9, 0x03b9 }, /* Greek_iota ι GREEK SMALL LETTER IOTA */
- { 0x07ea, 0x03ba }, /* Greek_kappa κ GREEK SMALL LETTER KAPPA */
- { 0x07eb, 0x03bb }, /* Greek_lambda λ GREEK SMALL LETTER LAMDA */
- { 0x07ec, 0x03bc }, /* Greek_mu μ GREEK SMALL LETTER MU */
- { 0x07ed, 0x03bd }, /* Greek_nu ν GREEK SMALL LETTER NU */
- { 0x07ee, 0x03be }, /* Greek_xi ξ GREEK SMALL LETTER XI */
- { 0x07ef, 0x03bf }, /* Greek_omicron ο GREEK SMALL LETTER OMICRON */
- { 0x07f0, 0x03c0 }, /* Greek_pi π GREEK SMALL LETTER PI */
- { 0x07f1, 0x03c1 }, /* Greek_rho Ï GREEK SMALL LETTER RHO */
- { 0x07f3, 0x03c2 }, /* Greek_finalsmallsigma Ï‚ GREEK SMALL LETTER FINAL SIGMA */
- { 0x07f2, 0x03c3 }, /* Greek_sigma σ GREEK SMALL LETTER SIGMA */
- { 0x07f4, 0x03c4 }, /* Greek_tau Ï„ GREEK SMALL LETTER TAU */
- { 0x07f5, 0x03c5 }, /* Greek_upsilon Ï… GREEK SMALL LETTER UPSILON */
- { 0x07f6, 0x03c6 }, /* Greek_phi φ GREEK SMALL LETTER PHI */
- { 0x07f7, 0x03c7 }, /* Greek_chi χ GREEK SMALL LETTER CHI */
- { 0x07f8, 0x03c8 }, /* Greek_psi ψ GREEK SMALL LETTER PSI */
- { 0x07f9, 0x03c9 }, /* Greek_omega ω GREEK SMALL LETTER OMEGA */
- { 0x07b5, 0x03ca }, /* Greek_iotadieresis ÏŠ GREEK SMALL LETTER IOTA WITH DIALYTIKA */
- { 0x07b9, 0x03cb }, /* Greek_upsilondieresis Ï‹ GREEK SMALL LETTER UPSILON WITH DIALYTIKA */
- { 0x07b7, 0x03cc }, /* Greek_omicronaccent ό GREEK SMALL LETTER OMICRON WITH TONOS */
- { 0x07b8, 0x03cd }, /* Greek_upsilonaccent Ï GREEK SMALL LETTER UPSILON WITH TONOS */
- { 0x07bb, 0x03ce }, /* Greek_omegaaccent ÏŽ GREEK SMALL LETTER OMEGA WITH TONOS */
- { 0x06b3, 0x0401 }, /* Cyrillic_IO Ð CYRILLIC CAPITAL LETTER IO */
- { 0x06b1, 0x0402 }, /* Serbian_DJE Ђ CYRILLIC CAPITAL LETTER DJE */
- { 0x06b2, 0x0403 }, /* Macedonia_GJE Ѓ CYRILLIC CAPITAL LETTER GJE */
- { 0x06b4, 0x0404 }, /* Ukrainian_IE Є CYRILLIC CAPITAL LETTER UKRAINIAN IE */
- { 0x06b5, 0x0405 }, /* Macedonia_DSE Ð… CYRILLIC CAPITAL LETTER DZE */
- { 0x06b6, 0x0406 }, /* Ukrainian_I І CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I */
- { 0x06b7, 0x0407 }, /* Ukrainian_YI Ї CYRILLIC CAPITAL LETTER YI */
- { 0x06b8, 0x0408 }, /* Cyrillic_JE Ј CYRILLIC CAPITAL LETTER JE */
- { 0x06b9, 0x0409 }, /* Cyrillic_LJE Љ CYRILLIC CAPITAL LETTER LJE */
- { 0x06ba, 0x040a }, /* Cyrillic_NJE Њ CYRILLIC CAPITAL LETTER NJE */
- { 0x06bb, 0x040b }, /* Serbian_TSHE Ћ CYRILLIC CAPITAL LETTER TSHE */
- { 0x06bc, 0x040c }, /* Macedonia_KJE Ќ CYRILLIC CAPITAL LETTER KJE */
- { 0x06be, 0x040e }, /* Byelorussian_SHORTU ÐŽ CYRILLIC CAPITAL LETTER SHORT U */
- { 0x06bf, 0x040f }, /* Cyrillic_DZHE Ð CYRILLIC CAPITAL LETTER DZHE */
- { 0x06e1, 0x0410 }, /* Cyrillic_A Ð CYRILLIC CAPITAL LETTER A */
- { 0x06e2, 0x0411 }, /* Cyrillic_BE Б CYRILLIC CAPITAL LETTER BE */
- { 0x06f7, 0x0412 }, /* Cyrillic_VE Ð’ CYRILLIC CAPITAL LETTER VE */
- { 0x06e7, 0x0413 }, /* Cyrillic_GHE Г CYRILLIC CAPITAL LETTER GHE */
- { 0x06e4, 0x0414 }, /* Cyrillic_DE Д CYRILLIC CAPITAL LETTER DE */
- { 0x06e5, 0x0415 }, /* Cyrillic_IE Е CYRILLIC CAPITAL LETTER IE */
- { 0x06f6, 0x0416 }, /* Cyrillic_ZHE Ж CYRILLIC CAPITAL LETTER ZHE */
- { 0x06fa, 0x0417 }, /* Cyrillic_ZE З CYRILLIC CAPITAL LETTER ZE */
- { 0x06e9, 0x0418 }, /* Cyrillic_I И CYRILLIC CAPITAL LETTER I */
- { 0x06ea, 0x0419 }, /* Cyrillic_SHORTI Й CYRILLIC CAPITAL LETTER SHORT I */
- { 0x06eb, 0x041a }, /* Cyrillic_KA К CYRILLIC CAPITAL LETTER KA */
- { 0x06ec, 0x041b }, /* Cyrillic_EL Л CYRILLIC CAPITAL LETTER EL */
- { 0x06ed, 0x041c }, /* Cyrillic_EM М CYRILLIC CAPITAL LETTER EM */
- { 0x06ee, 0x041d }, /* Cyrillic_EN Ð CYRILLIC CAPITAL LETTER EN */
- { 0x06ef, 0x041e }, /* Cyrillic_O О CYRILLIC CAPITAL LETTER O */
- { 0x06f0, 0x041f }, /* Cyrillic_PE П CYRILLIC CAPITAL LETTER PE */
- { 0x06f2, 0x0420 }, /* Cyrillic_ER Р CYRILLIC CAPITAL LETTER ER */
- { 0x06f3, 0x0421 }, /* Cyrillic_ES С CYRILLIC CAPITAL LETTER ES */
- { 0x06f4, 0x0422 }, /* Cyrillic_TE Т CYRILLIC CAPITAL LETTER TE */
- { 0x06f5, 0x0423 }, /* Cyrillic_U У CYRILLIC CAPITAL LETTER U */
- { 0x06e6, 0x0424 }, /* Cyrillic_EF Ф CYRILLIC CAPITAL LETTER EF */
- { 0x06e8, 0x0425 }, /* Cyrillic_HA Х CYRILLIC CAPITAL LETTER HA */
- { 0x06e3, 0x0426 }, /* Cyrillic_TSE Ц CYRILLIC CAPITAL LETTER TSE */
- { 0x06fe, 0x0427 }, /* Cyrillic_CHE Ч CYRILLIC CAPITAL LETTER CHE */
- { 0x06fb, 0x0428 }, /* Cyrillic_SHA Ш CYRILLIC CAPITAL LETTER SHA */
- { 0x06fd, 0x0429 }, /* Cyrillic_SHCHA Щ CYRILLIC CAPITAL LETTER SHCHA */
- { 0x06ff, 0x042a }, /* Cyrillic_HARDSIGN Ъ CYRILLIC CAPITAL LETTER HARD SIGN */
- { 0x06f9, 0x042b }, /* Cyrillic_YERU Ы CYRILLIC CAPITAL LETTER YERU */
- { 0x06f8, 0x042c }, /* Cyrillic_SOFTSIGN Ь CYRILLIC CAPITAL LETTER SOFT SIGN */
- { 0x06fc, 0x042d }, /* Cyrillic_E Э CYRILLIC CAPITAL LETTER E */
- { 0x06e0, 0x042e }, /* Cyrillic_YU Ю CYRILLIC CAPITAL LETTER YU */
- { 0x06f1, 0x042f }, /* Cyrillic_YA Я CYRILLIC CAPITAL LETTER YA */
- { 0x06c1, 0x0430 }, /* Cyrillic_a а CYRILLIC SMALL LETTER A */
- { 0x06c2, 0x0431 }, /* Cyrillic_be б CYRILLIC SMALL LETTER BE */
- { 0x06d7, 0x0432 }, /* Cyrillic_ve в CYRILLIC SMALL LETTER VE */
- { 0x06c7, 0x0433 }, /* Cyrillic_ghe г CYRILLIC SMALL LETTER GHE */
- { 0x06c4, 0x0434 }, /* Cyrillic_de д CYRILLIC SMALL LETTER DE */
- { 0x06c5, 0x0435 }, /* Cyrillic_ie е CYRILLIC SMALL LETTER IE */
- { 0x06d6, 0x0436 }, /* Cyrillic_zhe ж CYRILLIC SMALL LETTER ZHE */
- { 0x06da, 0x0437 }, /* Cyrillic_ze з CYRILLIC SMALL LETTER ZE */
- { 0x06c9, 0x0438 }, /* Cyrillic_i и CYRILLIC SMALL LETTER I */
- { 0x06ca, 0x0439 }, /* Cyrillic_shorti й CYRILLIC SMALL LETTER SHORT I */
- { 0x06cb, 0x043a }, /* Cyrillic_ka к CYRILLIC SMALL LETTER KA */
- { 0x06cc, 0x043b }, /* Cyrillic_el л CYRILLIC SMALL LETTER EL */
- { 0x06cd, 0x043c }, /* Cyrillic_em м CYRILLIC SMALL LETTER EM */
- { 0x06ce, 0x043d }, /* Cyrillic_en н CYRILLIC SMALL LETTER EN */
- { 0x06cf, 0x043e }, /* Cyrillic_o о CYRILLIC SMALL LETTER O */
- { 0x06d0, 0x043f }, /* Cyrillic_pe п CYRILLIC SMALL LETTER PE */
- { 0x06d2, 0x0440 }, /* Cyrillic_er р CYRILLIC SMALL LETTER ER */
- { 0x06d3, 0x0441 }, /* Cyrillic_es Ñ CYRILLIC SMALL LETTER ES */
- { 0x06d4, 0x0442 }, /* Cyrillic_te Ñ‚ CYRILLIC SMALL LETTER TE */
- { 0x06d5, 0x0443 }, /* Cyrillic_u у CYRILLIC SMALL LETTER U */
- { 0x06c6, 0x0444 }, /* Cyrillic_ef Ñ„ CYRILLIC SMALL LETTER EF */
- { 0x06c8, 0x0445 }, /* Cyrillic_ha Ñ… CYRILLIC SMALL LETTER HA */
- { 0x06c3, 0x0446 }, /* Cyrillic_tse ц CYRILLIC SMALL LETTER TSE */
- { 0x06de, 0x0447 }, /* Cyrillic_che ч CYRILLIC SMALL LETTER CHE */
- { 0x06db, 0x0448 }, /* Cyrillic_sha ш CYRILLIC SMALL LETTER SHA */
- { 0x06dd, 0x0449 }, /* Cyrillic_shcha щ CYRILLIC SMALL LETTER SHCHA */
- { 0x06df, 0x044a }, /* Cyrillic_hardsign ÑŠ CYRILLIC SMALL LETTER HARD SIGN */
- { 0x06d9, 0x044b }, /* Cyrillic_yeru Ñ‹ CYRILLIC SMALL LETTER YERU */
- { 0x06d8, 0x044c }, /* Cyrillic_softsign ь CYRILLIC SMALL LETTER SOFT SIGN */
- { 0x06dc, 0x044d }, /* Cyrillic_e Ñ CYRILLIC SMALL LETTER E */
- { 0x06c0, 0x044e }, /* Cyrillic_yu ÑŽ CYRILLIC SMALL LETTER YU */
- { 0x06d1, 0x044f }, /* Cyrillic_ya Ñ CYRILLIC SMALL LETTER YA */
- { 0x06a3, 0x0451 }, /* Cyrillic_io Ñ‘ CYRILLIC SMALL LETTER IO */
- { 0x06a1, 0x0452 }, /* Serbian_dje Ñ’ CYRILLIC SMALL LETTER DJE */
- { 0x06a2, 0x0453 }, /* Macedonia_gje Ñ“ CYRILLIC SMALL LETTER GJE */
- { 0x06a4, 0x0454 }, /* Ukrainian_ie Ñ” CYRILLIC SMALL LETTER UKRAINIAN IE */
- { 0x06a5, 0x0455 }, /* Macedonia_dse Ñ• CYRILLIC SMALL LETTER DZE */
- { 0x06a6, 0x0456 }, /* Ukrainian_i Ñ– CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I */
- { 0x06a7, 0x0457 }, /* Ukrainian_yi Ñ— CYRILLIC SMALL LETTER YI */
- { 0x06a8, 0x0458 }, /* Cyrillic_je ј CYRILLIC SMALL LETTER JE */
- { 0x06a9, 0x0459 }, /* Cyrillic_lje Ñ™ CYRILLIC SMALL LETTER LJE */
- { 0x06aa, 0x045a }, /* Cyrillic_nje Ñš CYRILLIC SMALL LETTER NJE */
- { 0x06ab, 0x045b }, /* Serbian_tshe Ñ› CYRILLIC SMALL LETTER TSHE */
- { 0x06ac, 0x045c }, /* Macedonia_kje ќ CYRILLIC SMALL LETTER KJE */
- { 0x06ae, 0x045e }, /* Byelorussian_shortu Ñž CYRILLIC SMALL LETTER SHORT U */
- { 0x06af, 0x045f }, /* Cyrillic_dzhe ÑŸ CYRILLIC SMALL LETTER DZHE */
- { 0x0ce0, 0x05d0 }, /* hebrew_aleph × HEBREW LETTER ALEF */
- { 0x0ce1, 0x05d1 }, /* hebrew_bet ב HEBREW LETTER BET */
- { 0x0ce2, 0x05d2 }, /* hebrew_gimel ×’ HEBREW LETTER GIMEL */
- { 0x0ce3, 0x05d3 }, /* hebrew_dalet ד HEBREW LETTER DALET */
- { 0x0ce4, 0x05d4 }, /* hebrew_he ×” HEBREW LETTER HE */
- { 0x0ce5, 0x05d5 }, /* hebrew_waw ו HEBREW LETTER VAV */
- { 0x0ce6, 0x05d6 }, /* hebrew_zain ×– HEBREW LETTER ZAYIN */
- { 0x0ce7, 0x05d7 }, /* hebrew_chet ×— HEBREW LETTER HET */
- { 0x0ce8, 0x05d8 }, /* hebrew_tet ט HEBREW LETTER TET */
- { 0x0ce9, 0x05d9 }, /* hebrew_yod ×™ HEBREW LETTER YOD */
- { 0x0cea, 0x05da }, /* hebrew_finalkaph ך HEBREW LETTER FINAL KAF */
- { 0x0ceb, 0x05db }, /* hebrew_kaph ×› HEBREW LETTER KAF */
- { 0x0cec, 0x05dc }, /* hebrew_lamed ל HEBREW LETTER LAMED */
- { 0x0ced, 0x05dd }, /* hebrew_finalmem × HEBREW LETTER FINAL MEM */
- { 0x0cee, 0x05de }, /* hebrew_mem מ HEBREW LETTER MEM */
- { 0x0cef, 0x05df }, /* hebrew_finalnun ן HEBREW LETTER FINAL NUN */
- { 0x0cf0, 0x05e0 }, /* hebrew_nun ×  HEBREW LETTER NUN */
- { 0x0cf1, 0x05e1 }, /* hebrew_samech ס HEBREW LETTER SAMEKH */
- { 0x0cf2, 0x05e2 }, /* hebrew_ayin ×¢ HEBREW LETTER AYIN */
- { 0x0cf3, 0x05e3 }, /* hebrew_finalpe ×£ HEBREW LETTER FINAL PE */
- { 0x0cf4, 0x05e4 }, /* hebrew_pe פ HEBREW LETTER PE */
- { 0x0cf5, 0x05e5 }, /* hebrew_finalzade ×¥ HEBREW LETTER FINAL TSADI */
- { 0x0cf6, 0x05e6 }, /* hebrew_zade צ HEBREW LETTER TSADI */
- { 0x0cf7, 0x05e7 }, /* hebrew_qoph ק HEBREW LETTER QOF */
- { 0x0cf8, 0x05e8 }, /* hebrew_resh ר HEBREW LETTER RESH */
- { 0x0cf9, 0x05e9 }, /* hebrew_shin ש HEBREW LETTER SHIN */
- { 0x0cfa, 0x05ea }, /* hebrew_taw ת HEBREW LETTER TAV */
- { 0x05ac, 0x060c }, /* Arabic_comma ، ARABIC COMMA */
- { 0x05bb, 0x061b }, /* Arabic_semicolon Ø› ARABIC SEMICOLON */
- { 0x05bf, 0x061f }, /* Arabic_question_mark ØŸ ARABIC QUESTION MARK */
- { 0x05c1, 0x0621 }, /* Arabic_hamza Ø¡ ARABIC LETTER HAMZA */
- { 0x05c2, 0x0622 }, /* Arabic_maddaonalef آ ARABIC LETTER ALEF WITH MADDA ABOVE */
- { 0x05c3, 0x0623 }, /* Arabic_hamzaonalef أ ARABIC LETTER ALEF WITH HAMZA ABOVE */
- { 0x05c4, 0x0624 }, /* Arabic_hamzaonwaw ؤ ARABIC LETTER WAW WITH HAMZA ABOVE */
- { 0x05c5, 0x0625 }, /* Arabic_hamzaunderalef إ ARABIC LETTER ALEF WITH HAMZA BELOW */
- { 0x05c6, 0x0626 }, /* Arabic_hamzaonyeh ئ ARABIC LETTER YEH WITH HAMZA ABOVE */
- { 0x05c7, 0x0627 }, /* Arabic_alef ا ARABIC LETTER ALEF */
- { 0x05c8, 0x0628 }, /* Arabic_beh ب ARABIC LETTER BEH */
- { 0x05c9, 0x0629 }, /* Arabic_tehmarbuta Ø© ARABIC LETTER TEH MARBUTA */
- { 0x05ca, 0x062a }, /* Arabic_teh ت ARABIC LETTER TEH */
- { 0x05cb, 0x062b }, /* Arabic_theh Ø« ARABIC LETTER THEH */
- { 0x05cc, 0x062c }, /* Arabic_jeem ج ARABIC LETTER JEEM */
- { 0x05cd, 0x062d }, /* Arabic_hah Ø­ ARABIC LETTER HAH */
- { 0x05ce, 0x062e }, /* Arabic_khah Ø® ARABIC LETTER KHAH */
- { 0x05cf, 0x062f }, /* Arabic_dal د ARABIC LETTER DAL */
- { 0x05d0, 0x0630 }, /* Arabic_thal Ø° ARABIC LETTER THAL */
- { 0x05d1, 0x0631 }, /* Arabic_ra ر ARABIC LETTER REH */
- { 0x05d2, 0x0632 }, /* Arabic_zain ز ARABIC LETTER ZAIN */
- { 0x05d3, 0x0633 }, /* Arabic_seen س ARABIC LETTER SEEN */
- { 0x05d4, 0x0634 }, /* Arabic_sheen Ø´ ARABIC LETTER SHEEN */
- { 0x05d5, 0x0635 }, /* Arabic_sad ص ARABIC LETTER SAD */
- { 0x05d6, 0x0636 }, /* Arabic_dad ض ARABIC LETTER DAD */
- { 0x05d7, 0x0637 }, /* Arabic_tah Ø· ARABIC LETTER TAH */
- { 0x05d8, 0x0638 }, /* Arabic_zah ظ ARABIC LETTER ZAH */
- { 0x05d9, 0x0639 }, /* Arabic_ain ع ARABIC LETTER AIN */
- { 0x05da, 0x063a }, /* Arabic_ghain غ ARABIC LETTER GHAIN */
- { 0x05e0, 0x0640 }, /* Arabic_tatweel Ù€ ARABIC TATWEEL */
- { 0x05e1, 0x0641 }, /* Arabic_feh Ù ARABIC LETTER FEH */
- { 0x05e2, 0x0642 }, /* Arabic_qaf Ù‚ ARABIC LETTER QAF */
- { 0x05e3, 0x0643 }, /* Arabic_kaf Ùƒ ARABIC LETTER KAF */
- { 0x05e4, 0x0644 }, /* Arabic_lam Ù„ ARABIC LETTER LAM */
- { 0x05e5, 0x0645 }, /* Arabic_meem Ù… ARABIC LETTER MEEM */
- { 0x05e6, 0x0646 }, /* Arabic_noon Ù† ARABIC LETTER NOON */
- { 0x05e7, 0x0647 }, /* Arabic_ha Ù‡ ARABIC LETTER HEH */
- { 0x05e8, 0x0648 }, /* Arabic_waw Ùˆ ARABIC LETTER WAW */
- { 0x05e9, 0x0649 }, /* Arabic_alefmaksura Ù‰ ARABIC LETTER ALEF MAKSURA */
- { 0x05ea, 0x064a }, /* Arabic_yeh ÙŠ ARABIC LETTER YEH */
- { 0x05eb, 0x064b }, /* Arabic_fathatan Ù‹ ARABIC FATHATAN */
- { 0x05ec, 0x064c }, /* Arabic_dammatan ٌ ARABIC DAMMATAN */
- { 0x05ed, 0x064d }, /* Arabic_kasratan Ù ARABIC KASRATAN */
- { 0x05ee, 0x064e }, /* Arabic_fatha ÙŽ ARABIC FATHA */
- { 0x05ef, 0x064f }, /* Arabic_damma Ù ARABIC DAMMA */
- { 0x05f0, 0x0650 }, /* Arabic_kasra Ù ARABIC KASRA */
- { 0x05f1, 0x0651 }, /* Arabic_shadda Ù‘ ARABIC SHADDA */
- { 0x05f2, 0x0652 }, /* Arabic_sukun Ù’ ARABIC SUKUN */
- { 0x0da1, 0x0e01 }, /* Thai_kokai ภTHAI CHARACTER KO KAI */
- { 0x0da2, 0x0e02 }, /* Thai_khokhai ข THAI CHARACTER KHO KHAI */
- { 0x0da3, 0x0e03 }, /* Thai_khokhuat ฃ THAI CHARACTER KHO KHUAT */
- { 0x0da4, 0x0e04 }, /* Thai_khokhwai ค THAI CHARACTER KHO KHWAI */
- { 0x0da5, 0x0e05 }, /* Thai_khokhon ฅ THAI CHARACTER KHO KHON */
- { 0x0da6, 0x0e06 }, /* Thai_khorakhang ฆ THAI CHARACTER KHO RAKHANG */
- { 0x0da7, 0x0e07 }, /* Thai_ngongu ง THAI CHARACTER NGO NGU */
- { 0x0da8, 0x0e08 }, /* Thai_chochan จ THAI CHARACTER CHO CHAN */
- { 0x0da9, 0x0e09 }, /* Thai_choching ฉ THAI CHARACTER CHO CHING */
- { 0x0daa, 0x0e0a }, /* Thai_chochang ช THAI CHARACTER CHO CHANG */
- { 0x0dab, 0x0e0b }, /* Thai_soso ซ THAI CHARACTER SO SO */
- { 0x0dac, 0x0e0c }, /* Thai_chochoe ฌ THAI CHARACTER CHO CHOE */
- { 0x0dad, 0x0e0d }, /* Thai_yoying ภTHAI CHARACTER YO YING */
- { 0x0dae, 0x0e0e }, /* Thai_dochada ฎ THAI CHARACTER DO CHADA */
- { 0x0daf, 0x0e0f }, /* Thai_topatak ภTHAI CHARACTER TO PATAK */
- { 0x0db0, 0x0e10 }, /* Thai_thothan ภTHAI CHARACTER THO THAN */
- { 0x0db1, 0x0e11 }, /* Thai_thonangmontho ฑ THAI CHARACTER THO NANGMONTHO */
- { 0x0db2, 0x0e12 }, /* Thai_thophuthao ฒ THAI CHARACTER THO PHUTHAO */
- { 0x0db3, 0x0e13 }, /* Thai_nonen ณ THAI CHARACTER NO NEN */
- { 0x0db4, 0x0e14 }, /* Thai_dodek ด THAI CHARACTER DO DEK */
- { 0x0db5, 0x0e15 }, /* Thai_totao ต THAI CHARACTER TO TAO */
- { 0x0db6, 0x0e16 }, /* Thai_thothung ถ THAI CHARACTER THO THUNG */
- { 0x0db7, 0x0e17 }, /* Thai_thothahan ท THAI CHARACTER THO THAHAN */
- { 0x0db8, 0x0e18 }, /* Thai_thothong ธ THAI CHARACTER THO THONG */
- { 0x0db9, 0x0e19 }, /* Thai_nonu น THAI CHARACTER NO NU */
- { 0x0dba, 0x0e1a }, /* Thai_bobaimai บ THAI CHARACTER BO BAIMAI */
- { 0x0dbb, 0x0e1b }, /* Thai_popla ป THAI CHARACTER PO PLA */
- { 0x0dbc, 0x0e1c }, /* Thai_phophung ผ THAI CHARACTER PHO PHUNG */
- { 0x0dbd, 0x0e1d }, /* Thai_fofa ภTHAI CHARACTER FO FA */
- { 0x0dbe, 0x0e1e }, /* Thai_phophan พ THAI CHARACTER PHO PHAN */
- { 0x0dbf, 0x0e1f }, /* Thai_fofan ฟ THAI CHARACTER FO FAN */
- { 0x0dc0, 0x0e20 }, /* Thai_phosamphao ภ THAI CHARACTER PHO SAMPHAO */
- { 0x0dc1, 0x0e21 }, /* Thai_moma ม THAI CHARACTER MO MA */
- { 0x0dc2, 0x0e22 }, /* Thai_yoyak ย THAI CHARACTER YO YAK */
- { 0x0dc3, 0x0e23 }, /* Thai_rorua ร THAI CHARACTER RO RUA */
- { 0x0dc4, 0x0e24 }, /* Thai_ru ฤ THAI CHARACTER RU */
- { 0x0dc5, 0x0e25 }, /* Thai_loling ล THAI CHARACTER LO LING */
- { 0x0dc6, 0x0e26 }, /* Thai_lu ฦ THAI CHARACTER LU */
- { 0x0dc7, 0x0e27 }, /* Thai_wowaen ว THAI CHARACTER WO WAEN */
- { 0x0dc8, 0x0e28 }, /* Thai_sosala ศ THAI CHARACTER SO SALA */
- { 0x0dc9, 0x0e29 }, /* Thai_sorusi ษ THAI CHARACTER SO RUSI */
- { 0x0dca, 0x0e2a }, /* Thai_sosua ส THAI CHARACTER SO SUA */
- { 0x0dcb, 0x0e2b }, /* Thai_hohip ห THAI CHARACTER HO HIP */
- { 0x0dcc, 0x0e2c }, /* Thai_lochula ฬ THAI CHARACTER LO CHULA */
- { 0x0dcd, 0x0e2d }, /* Thai_oang อ THAI CHARACTER O ANG */
- { 0x0dce, 0x0e2e }, /* Thai_honokhuk ฮ THAI CHARACTER HO NOKHUK */
- { 0x0dcf, 0x0e2f }, /* Thai_paiyannoi ฯ THAI CHARACTER PAIYANNOI */
- { 0x0dd0, 0x0e30 }, /* Thai_saraa ะ THAI CHARACTER SARA A */
- { 0x0dd1, 0x0e31 }, /* Thai_maihanakat ั THAI CHARACTER MAI HAN-AKAT */
- { 0x0dd2, 0x0e32 }, /* Thai_saraaa า THAI CHARACTER SARA AA */
- { 0x0dd3, 0x0e33 }, /* Thai_saraam ำ THAI CHARACTER SARA AM */
- { 0x0dd4, 0x0e34 }, /* Thai_sarai ิ THAI CHARACTER SARA I */
- { 0x0dd5, 0x0e35 }, /* Thai_saraii ี THAI CHARACTER SARA II */
- { 0x0dd6, 0x0e36 }, /* Thai_saraue ึ THAI CHARACTER SARA UE */
- { 0x0dd7, 0x0e37 }, /* Thai_sarauee ื THAI CHARACTER SARA UEE */
- { 0x0dd8, 0x0e38 }, /* Thai_sarau ุ THAI CHARACTER SARA U */
- { 0x0dd9, 0x0e39 }, /* Thai_sarauu ู THAI CHARACTER SARA UU */
- { 0x0dda, 0x0e3a }, /* Thai_phinthu ฺ THAI CHARACTER PHINTHU */
- { 0x0ddf, 0x0e3f }, /* Thai_baht ฿ THAI CURRENCY SYMBOL BAHT */
- { 0x0de0, 0x0e40 }, /* Thai_sarae เ THAI CHARACTER SARA E */
- { 0x0de1, 0x0e41 }, /* Thai_saraae ๠THAI CHARACTER SARA AE */
- { 0x0de2, 0x0e42 }, /* Thai_sarao โ THAI CHARACTER SARA O */
- { 0x0de3, 0x0e43 }, /* Thai_saraaimaimuan ใ THAI CHARACTER SARA AI MAIMUAN */
- { 0x0de4, 0x0e44 }, /* Thai_saraaimaimalai ไ THAI CHARACTER SARA AI MAIMALAI */
- { 0x0de5, 0x0e45 }, /* Thai_lakkhangyao ๅ THAI CHARACTER LAKKHANGYAO */
- { 0x0de6, 0x0e46 }, /* Thai_maiyamok ๆ THAI CHARACTER MAIYAMOK */
- { 0x0de7, 0x0e47 }, /* Thai_maitaikhu ็ THAI CHARACTER MAITAIKHU */
- { 0x0de8, 0x0e48 }, /* Thai_maiek ่ THAI CHARACTER MAI EK */
- { 0x0de9, 0x0e49 }, /* Thai_maitho ้ THAI CHARACTER MAI THO */
- { 0x0dea, 0x0e4a }, /* Thai_maitri ๊ THAI CHARACTER MAI TRI */
- { 0x0deb, 0x0e4b }, /* Thai_maichattawa ๋ THAI CHARACTER MAI CHATTAWA */
- { 0x0dec, 0x0e4c }, /* Thai_thanthakhat ์ THAI CHARACTER THANTHAKHAT */
- { 0x0ded, 0x0e4d }, /* Thai_nikhahit ๠THAI CHARACTER NIKHAHIT */
- { 0x0df0, 0x0e50 }, /* Thai_leksun ๠THAI DIGIT ZERO */
- { 0x0df1, 0x0e51 }, /* Thai_leknung ๑ THAI DIGIT ONE */
- { 0x0df2, 0x0e52 }, /* Thai_leksong ๒ THAI DIGIT TWO */
- { 0x0df3, 0x0e53 }, /* Thai_leksam ๓ THAI DIGIT THREE */
- { 0x0df4, 0x0e54 }, /* Thai_leksi ๔ THAI DIGIT FOUR */
- { 0x0df5, 0x0e55 }, /* Thai_lekha ๕ THAI DIGIT FIVE */
- { 0x0df6, 0x0e56 }, /* Thai_lekhok ๖ THAI DIGIT SIX */
- { 0x0df7, 0x0e57 }, /* Thai_lekchet ๗ THAI DIGIT SEVEN */
- { 0x0df8, 0x0e58 }, /* Thai_lekpaet ๘ THAI DIGIT EIGHT */
- { 0x0df9, 0x0e59 }, /* Thai_lekkao ๙ THAI DIGIT NINE */
- { 0x0ed4, 0x11a8 }, /* Hangul_J_Kiyeog ᆨ HANGUL JONGSEONG KIYEOK */
- { 0x0ed5, 0x11a9 }, /* Hangul_J_SsangKiyeog ᆩ HANGUL JONGSEONG SSANGKIYEOK */
- { 0x0ed6, 0x11aa }, /* Hangul_J_KiyeogSios ᆪ HANGUL JONGSEONG KIYEOK-SIOS */
- { 0x0ed7, 0x11ab }, /* Hangul_J_Nieun ᆫ HANGUL JONGSEONG NIEUN */
- { 0x0ed8, 0x11ac }, /* Hangul_J_NieunJieuj ᆬ HANGUL JONGSEONG NIEUN-CIEUC */
- { 0x0ed9, 0x11ad }, /* Hangul_J_NieunHieuh ᆭ HANGUL JONGSEONG NIEUN-HIEUH */
- { 0x0eda, 0x11ae }, /* Hangul_J_Dikeud ᆮ HANGUL JONGSEONG TIKEUT */
- { 0x0edb, 0x11af }, /* Hangul_J_Rieul ᆯ HANGUL JONGSEONG RIEUL */
- { 0x0edc, 0x11b0 }, /* Hangul_J_RieulKiyeog ᆰ HANGUL JONGSEONG RIEUL-KIYEOK */
- { 0x0edd, 0x11b1 }, /* Hangul_J_RieulMieum ᆱ HANGUL JONGSEONG RIEUL-MIEUM */
- { 0x0ede, 0x11b2 }, /* Hangul_J_RieulPieub ᆲ HANGUL JONGSEONG RIEUL-PIEUP */
- { 0x0edf, 0x11b3 }, /* Hangul_J_RieulSios ᆳ HANGUL JONGSEONG RIEUL-SIOS */
- { 0x0ee0, 0x11b4 }, /* Hangul_J_RieulTieut ᆴ HANGUL JONGSEONG RIEUL-THIEUTH */
- { 0x0ee1, 0x11b5 }, /* Hangul_J_RieulPhieuf ᆵ HANGUL JONGSEONG RIEUL-PHIEUPH */
- { 0x0ee2, 0x11b6 }, /* Hangul_J_RieulHieuh ᆶ HANGUL JONGSEONG RIEUL-HIEUH */
- { 0x0ee3, 0x11b7 }, /* Hangul_J_Mieum ᆷ HANGUL JONGSEONG MIEUM */
- { 0x0ee4, 0x11b8 }, /* Hangul_J_Pieub ᆸ HANGUL JONGSEONG PIEUP */
- { 0x0ee5, 0x11b9 }, /* Hangul_J_PieubSios ᆹ HANGUL JONGSEONG PIEUP-SIOS */
- { 0x0ee6, 0x11ba }, /* Hangul_J_Sios ᆺ HANGUL JONGSEONG SIOS */
- { 0x0ee7, 0x11bb }, /* Hangul_J_SsangSios ᆻ HANGUL JONGSEONG SSANGSIOS */
- { 0x0ee8, 0x11bc }, /* Hangul_J_Ieung ᆼ HANGUL JONGSEONG IEUNG */
- { 0x0ee9, 0x11bd }, /* Hangul_J_Jieuj ᆽ HANGUL JONGSEONG CIEUC */
- { 0x0eea, 0x11be }, /* Hangul_J_Cieuc ᆾ HANGUL JONGSEONG CHIEUCH */
- { 0x0eeb, 0x11bf }, /* Hangul_J_Khieuq ᆿ HANGUL JONGSEONG KHIEUKH */
- { 0x0eec, 0x11c0 }, /* Hangul_J_Tieut ᇀ HANGUL JONGSEONG THIEUTH */
- { 0x0eed, 0x11c1 }, /* Hangul_J_Phieuf ᇠHANGUL JONGSEONG PHIEUPH */
- { 0x0eee, 0x11c2 }, /* Hangul_J_Hieuh ᇂ HANGUL JONGSEONG HIEUH */
- { 0x0ef8, 0x11eb }, /* Hangul_J_PanSios ᇫ HANGUL JONGSEONG PANSIOS */
- { 0x0efa, 0x11f9 }, /* Hangul_J_YeorinHieuh ᇹ HANGUL JONGSEONG YEORINHIEUH */
- { 0x0aa2, 0x2002 }, /* enspace   EN SPACE */
- { 0x0aa1, 0x2003 }, /* emspace   EM SPACE */
- { 0x0aa3, 0x2004 }, /* em3space   THREE-PER-EM SPACE */
- { 0x0aa4, 0x2005 }, /* em4space   FOUR-PER-EM SPACE */
- { 0x0aa5, 0x2007 }, /* digitspace   FIGURE SPACE */
- { 0x0aa6, 0x2008 }, /* punctspace   PUNCTUATION SPACE */
- { 0x0aa7, 0x2009 }, /* thinspace   THIN SPACE */
- { 0x0aa8, 0x200a }, /* hairspace   HAIR SPACE */
- { 0x0abb, 0x2012 }, /* figdash ‒ FIGURE DASH */
- { 0x0aaa, 0x2013 }, /* endash – EN DASH */
- { 0x0aa9, 0x2014 }, /* emdash — EM DASH */
- { 0x07af, 0x2015 }, /* Greek_horizbar ― HORIZONTAL BAR */
- { 0x0cdf, 0x2017 }, /* hebrew_doublelowline ‗ DOUBLE LOW LINE */
- { 0x0ad0, 0x2018 }, /* leftsinglequotemark ‘ LEFT SINGLE QUOTATION MARK */
- { 0x0ad1, 0x2019 }, /* rightsinglequotemark ’ RIGHT SINGLE QUOTATION MARK */
- { 0x0afd, 0x201a }, /* singlelowquotemark ‚ SINGLE LOW-9 QUOTATION MARK */
- { 0x0ad2, 0x201c }, /* leftdoublequotemark “ LEFT DOUBLE QUOTATION MARK */
- { 0x0ad3, 0x201d }, /* rightdoublequotemark †RIGHT DOUBLE QUOTATION MARK */
- { 0x0afe, 0x201e }, /* doublelowquotemark „ DOUBLE LOW-9 QUOTATION MARK */
- { 0x0af1, 0x2020 }, /* dagger † DAGGER */
- { 0x0af2, 0x2021 }, /* doubledagger ‡ DOUBLE DAGGER */
- { 0x0ae6, 0x2022 }, /* enfilledcircbullet • BULLET */
- { 0x0aae, 0x2026 }, /* ellipsis … HORIZONTAL ELLIPSIS */
- { 0x0ad6, 0x2032 }, /* minutes ′ PRIME */
- { 0x0ad7, 0x2033 }, /* seconds ″ DOUBLE PRIME */
- { 0x0afc, 0x2038 }, /* caret ‸ CARET */
- { 0x047e, 0x203e }, /* overline ‾ OVERLINE */
- { 0x20a0, 0x20a0 }, /* EcuSign â‚  EURO-CURRENCY SIGN */
- { 0x20a1, 0x20a1 }, /* ColonSign â‚¡ COLON SIGN */
- { 0x20a2, 0x20a2 }, /* CruzeiroSign â‚¢ CRUZEIRO SIGN */
- { 0x20a3, 0x20a3 }, /* FFrancSign â‚£ FRENCH FRANC SIGN */
- { 0x20a4, 0x20a4 }, /* LiraSign ₤ LIRA SIGN */
- { 0x20a5, 0x20a5 }, /* MillSign â‚¥ MILL SIGN */
- { 0x20a6, 0x20a6 }, /* NairaSign ₦ NAIRA SIGN */
- { 0x20a7, 0x20a7 }, /* PesetaSign ₧ PESETA SIGN */
- { 0x20a8, 0x20a8 }, /* RupeeSign ₨ RUPEE SIGN */
- { 0x0eff, 0x20a9 }, /* Korean_Won â‚© WON SIGN */
- { 0x20a9, 0x20a9 }, /* WonSign â‚© WON SIGN */
- { 0x20aa, 0x20aa }, /* NewSheqelSign ₪ NEW SHEQEL SIGN */
- { 0x20ab, 0x20ab }, /* DongSign â‚« DONG SIGN */
- { 0x20ac, 0x20ac }, /* EuroSign € EURO SIGN */
- { 0x0ab8, 0x2105 }, /* careof â„… CARE OF */
- { 0x06b0, 0x2116 }, /* numerosign â„– NUMERO SIGN */
- { 0x0afb, 0x2117 }, /* phonographcopyright â„— SOUND RECORDING COPYRIGHT */
- { 0x0ad4, 0x211e }, /* prescription â„ž PRESCRIPTION TAKE */
- { 0x0ac9, 0x2122 }, /* trademark â„¢ TRADE MARK SIGN */
- { 0x0ab0, 0x2153 }, /* onethird â…“ VULGAR FRACTION ONE THIRD */
- { 0x0ab1, 0x2154 }, /* twothirds â…” VULGAR FRACTION TWO THIRDS */
- { 0x0ab2, 0x2155 }, /* onefifth â…• VULGAR FRACTION ONE FIFTH */
- { 0x0ab3, 0x2156 }, /* twofifths â…– VULGAR FRACTION TWO FIFTHS */
- { 0x0ab4, 0x2157 }, /* threefifths â…— VULGAR FRACTION THREE FIFTHS */
- { 0x0ab5, 0x2158 }, /* fourfifths â…˜ VULGAR FRACTION FOUR FIFTHS */
- { 0x0ab6, 0x2159 }, /* onesixth â…™ VULGAR FRACTION ONE SIXTH */
- { 0x0ab7, 0x215a }, /* fivesixths â…š VULGAR FRACTION FIVE SIXTHS */
- { 0x0ac3, 0x215b }, /* oneeighth â…› VULGAR FRACTION ONE EIGHTH */
- { 0x0ac4, 0x215c }, /* threeeighths ⅜ VULGAR FRACTION THREE EIGHTHS */
- { 0x0ac5, 0x215d }, /* fiveeighths â… VULGAR FRACTION FIVE EIGHTHS */
- { 0x0ac6, 0x215e }, /* seveneighths â…ž VULGAR FRACTION SEVEN EIGHTHS */
- { 0x08fb, 0x2190 }, /* leftarrow ↠LEFTWARDS ARROW */
- { 0x08fc, 0x2191 }, /* uparrow ↑ UPWARDS ARROW */
- { 0x08fd, 0x2192 }, /* rightarrow → RIGHTWARDS ARROW */
- { 0x08fe, 0x2193 }, /* downarrow ↓ DOWNWARDS ARROW */
- { 0x08ce, 0x21d2 }, /* implies ⇒ RIGHTWARDS DOUBLE ARROW */
- { 0x08cd, 0x21d4 }, /* ifonlyif ⇔ LEFT RIGHT DOUBLE ARROW */
- { 0x08ef, 0x2202 }, /* partialderivative ∂ PARTIAL DIFFERENTIAL */
- { 0x08c5, 0x2207 }, /* nabla ∇ NABLA */
- { 0x0bca, 0x2218 }, /* jot ∘ RING OPERATOR */
- { 0x08d6, 0x221a }, /* radical √ SQUARE ROOT */
- { 0x08c1, 0x221d }, /* variation ∠PROPORTIONAL TO */
- { 0x08c2, 0x221e }, /* infinity ∞ INFINITY */
- { 0x08de, 0x2227 }, /* logicaland ∧ LOGICAL AND */
- { 0x0ba9, 0x2227 }, /* upcaret ∧ LOGICAL AND */
- { 0x08df, 0x2228 }, /* logicalor ∨ LOGICAL OR */
- { 0x0ba8, 0x2228 }, /* downcaret ∨ LOGICAL OR */
- { 0x08dc, 0x2229 }, /* intersection ∩ INTERSECTION */
- { 0x0bc3, 0x2229 }, /* upshoe ∩ INTERSECTION */
- { 0x08dd, 0x222a }, /* union ∪ UNION */
- { 0x0bd6, 0x222a }, /* downshoe ∪ UNION */
- { 0x08bf, 0x222b }, /* integral ∫ INTEGRAL */
- { 0x08c0, 0x2234 }, /* therefore ∴ THEREFORE */
- { 0x08c8, 0x2245 }, /* approximate ≅ APPROXIMATELY EQUAL TO */
- { 0x08bd, 0x2260 }, /* notequal ≠ NOT EQUAL TO */
- { 0x08cf, 0x2261 }, /* identical ≡ IDENTICAL TO */
- { 0x08bc, 0x2264 }, /* lessthanequal ≤ LESS-THAN OR EQUAL TO */
- { 0x08be, 0x2265 }, /* greaterthanequal ≥ GREATER-THAN OR EQUAL TO */
- { 0x08da, 0x2282 }, /* includedin ⊂ SUBSET OF */
- { 0x0bda, 0x2282 }, /* leftshoe ⊂ SUBSET OF */
- { 0x08db, 0x2283 }, /* includes ⊃ SUPERSET OF */
- { 0x0bd8, 0x2283 }, /* rightshoe ⊃ SUPERSET OF */
- { 0x0bfc, 0x22a2 }, /* righttack ⊢ RIGHT TACK */
- { 0x0bdc, 0x22a3 }, /* lefttack ⊣ LEFT TACK */
- { 0x0bc2, 0x22a4 }, /* downtack ⊤ DOWN TACK */
- { 0x0bce, 0x22a5 }, /* uptack ⊥ UP TACK */
- { 0x0bd3, 0x2308 }, /* upstile ⌈ LEFT CEILING */
- { 0x0bc4, 0x230a }, /* downstile ⌊ LEFT FLOOR */
- { 0x0afa, 0x2315 }, /* telephonerecorder ⌕ TELEPHONE RECORDER */
- { 0x08a4, 0x2320 }, /* topintegral ⌠ TOP HALF INTEGRAL */
- { 0x08a5, 0x2321 }, /* botintegral ⌡ BOTTOM HALF INTEGRAL */
- { 0x0abc, 0x2329 }, /* leftanglebracket 〈 LEFT-POINTING ANGLE BRACKET */
- { 0x0abe, 0x232a }, /* rightanglebracket 〉 RIGHT-POINTING ANGLE BRACKET */
- { 0x0bcc, 0x2395 }, /* quad ⎕ APL FUNCTIONAL SYMBOL QUAD (Unicode 3.0) */
- { 0x09e2, 0x2409 }, /* ht ≠SYMBOL FOR HORIZONTAL TABULATION */
- { 0x09e5, 0x240a }, /* lf ⊠SYMBOL FOR LINE FEED */
- { 0x09e9, 0x240b }, /* vt â‹ SYMBOL FOR VERTICAL TABULATION */
- { 0x09e3, 0x240c }, /* ff ⌠SYMBOL FOR FORM FEED */
- { 0x09e4, 0x240d }, /* cr â SYMBOL FOR CARRIAGE RETURN */
- { 0x09df, 0x2422 }, /* blank ⢠BLANK SYMBOL */
- { 0x09e8, 0x2424 }, /* nl ⤠SYMBOL FOR NEWLINE */
- { 0x09f1, 0x2500 }, /* horizlinescan5 ─ BOX DRAWINGS LIGHT HORIZONTAL */
- { 0x08a6, 0x2502 }, /* vertconnector │ BOX DRAWINGS LIGHT VERTICAL */
- { 0x09f8, 0x2502 }, /* vertbar │ BOX DRAWINGS LIGHT VERTICAL */
- { 0x09ec, 0x250c }, /* upleftcorner ┌ BOX DRAWINGS LIGHT DOWN AND RIGHT */
- { 0x09eb, 0x2510 }, /* uprightcorner â” BOX DRAWINGS LIGHT DOWN AND LEFT */
- { 0x09ed, 0x2514 }, /* lowleftcorner â”” BOX DRAWINGS LIGHT UP AND RIGHT */
- { 0x09ea, 0x2518 }, /* lowrightcorner ┘ BOX DRAWINGS LIGHT UP AND LEFT */
- { 0x09f4, 0x251c }, /* leftt ├ BOX DRAWINGS LIGHT VERTICAL AND RIGHT */
- { 0x09f5, 0x2524 }, /* rightt ┤ BOX DRAWINGS LIGHT VERTICAL AND LEFT */
- { 0x09f7, 0x252c }, /* topt ┬ BOX DRAWINGS LIGHT DOWN AND HORIZONTAL */
- { 0x09f6, 0x2534 }, /* bott â”´ BOX DRAWINGS LIGHT UP AND HORIZONTAL */
- { 0x09ee, 0x253c }, /* crossinglines ┼ BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL */
- { 0x09e1, 0x2592 }, /* checkerboard â–’ MEDIUM SHADE */
- { 0x0adf, 0x25a0 }, /* emfilledrect â–  BLACK SQUARE */
- { 0x0acf, 0x25a1 }, /* emopenrectangle â–¡ WHITE SQUARE */
- { 0x0ae7, 0x25aa }, /* enfilledsqbullet â–ª BLACK SMALL SQUARE */
- { 0x0ae1, 0x25ab }, /* enopensquarebullet â–« WHITE SMALL SQUARE */
- { 0x0adb, 0x25ac }, /* filledrectbullet â–¬ BLACK RECTANGLE */
- { 0x0ae2, 0x25ad }, /* openrectbullet â–­ WHITE RECTANGLE */
- { 0x0ae8, 0x25b2 }, /* filledtribulletup â–² BLACK UP-POINTING TRIANGLE */
- { 0x0ae3, 0x25b3 }, /* opentribulletup â–³ WHITE UP-POINTING TRIANGLE */
- { 0x0add, 0x25b6 }, /* filledrighttribullet â–¶ BLACK RIGHT-POINTING TRIANGLE */
- { 0x0acd, 0x25b7 }, /* rightopentriangle â–· WHITE RIGHT-POINTING TRIANGLE */
- { 0x0ae9, 0x25bc }, /* filledtribulletdown â–¼ BLACK DOWN-POINTING TRIANGLE */
- { 0x0ae4, 0x25bd }, /* opentribulletdown â–½ WHITE DOWN-POINTING TRIANGLE */
- { 0x0adc, 0x25c0 }, /* filledlefttribullet â—€ BLACK LEFT-POINTING TRIANGLE */
- { 0x0acc, 0x25c1 }, /* leftopentriangle â— WHITE LEFT-POINTING TRIANGLE */
- { 0x09e0, 0x25c6 }, /* soliddiamond â—† BLACK DIAMOND */
- { 0x0ace, 0x25cb }, /* emopencircle â—‹ WHITE CIRCLE */
- { 0x0bcf, 0x25cb }, /* circle â—‹ WHITE CIRCLE */
- { 0x0ade, 0x25cf }, /* emfilledcircle â— BLACK CIRCLE */
- { 0x0ae0, 0x25e6 }, /* enopencircbullet â—¦ WHITE BULLET */
- { 0x0ae5, 0x2606 }, /* openstar ☆ WHITE STAR */
- { 0x0af9, 0x260e }, /* telephone ☎ BLACK TELEPHONE */
- { 0x0aca, 0x2613 }, /* signaturemark ☓ SALTIRE */
- { 0x0aea, 0x261c }, /* leftpointer ☜ WHITE LEFT POINTING INDEX */
- { 0x0aeb, 0x261e }, /* rightpointer ☞ WHITE RIGHT POINTING INDEX */
- { 0x0af8, 0x2640 }, /* femalesymbol ♀ FEMALE SIGN */
- { 0x0af7, 0x2642 }, /* malesymbol ♂ MALE SIGN */
- { 0x0aec, 0x2663 }, /* club ♣ BLACK CLUB SUIT */
- { 0x0aee, 0x2665 }, /* heart ♥ BLACK HEART SUIT */
- { 0x0aed, 0x2666 }, /* diamond ♦ BLACK DIAMOND SUIT */
- { 0x0af6, 0x266d }, /* musicalflat â™­ MUSIC FLAT SIGN */
- { 0x0af5, 0x266f }, /* musicalsharp ♯ MUSIC SHARP SIGN */
- { 0x0af3, 0x2713 }, /* checkmark ✓ CHECK MARK */
- { 0x0af4, 0x2717 }, /* ballotcross ✗ BALLOT X */
- { 0x0ad9, 0x271d }, /* latincross ✠LATIN CROSS */
- { 0x0af0, 0x2720 }, /* maltesecross ✠ MALTESE CROSS */
- { 0x04a4, 0x3001 }, /* kana_comma 〠IDEOGRAPHIC COMMA */
- { 0x04a1, 0x3002 }, /* kana_fullstop 。 IDEOGRAPHIC FULL STOP */
- { 0x04a2, 0x300c }, /* kana_openingbracket 「 LEFT CORNER BRACKET */
- { 0x04a3, 0x300d }, /* kana_closingbracket 〠RIGHT CORNER BRACKET */
- { 0x04de, 0x309b }, /* voicedsound ã‚› KATAKANA-HIRAGANA VOICED SOUND MARK */
- { 0x04df, 0x309c }, /* semivoicedsound ゜ KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK */
- { 0x04a7, 0x30a1 }, /* kana_a ã‚¡ KATAKANA LETTER SMALL A */
- { 0x04b1, 0x30a2 }, /* kana_A ã‚¢ KATAKANA LETTER A */
- { 0x04a8, 0x30a3 }, /* kana_i ã‚£ KATAKANA LETTER SMALL I */
- { 0x04b2, 0x30a4 }, /* kana_I イ KATAKANA LETTER I */
- { 0x04a9, 0x30a5 }, /* kana_u ã‚¥ KATAKANA LETTER SMALL U */
- { 0x04b3, 0x30a6 }, /* kana_U ウ KATAKANA LETTER U */
- { 0x04aa, 0x30a7 }, /* kana_e ェ KATAKANA LETTER SMALL E */
- { 0x04b4, 0x30a8 }, /* kana_E エ KATAKANA LETTER E */
- { 0x04ab, 0x30a9 }, /* kana_o ã‚© KATAKANA LETTER SMALL O */
- { 0x04b5, 0x30aa }, /* kana_O オ KATAKANA LETTER O */
- { 0x04b6, 0x30ab }, /* kana_KA ã‚« KATAKANA LETTER KA */
- { 0x04b7, 0x30ad }, /* kana_KI ã‚­ KATAKANA LETTER KI */
- { 0x04b8, 0x30af }, /* kana_KU ク KATAKANA LETTER KU */
- { 0x04b9, 0x30b1 }, /* kana_KE ケ KATAKANA LETTER KE */
- { 0x04ba, 0x30b3 }, /* kana_KO コ KATAKANA LETTER KO */
- { 0x04bb, 0x30b5 }, /* kana_SA サ KATAKANA LETTER SA */
- { 0x04bc, 0x30b7 }, /* kana_SHI ã‚· KATAKANA LETTER SI */
- { 0x04bd, 0x30b9 }, /* kana_SU ス KATAKANA LETTER SU */
- { 0x04be, 0x30bb }, /* kana_SE ã‚» KATAKANA LETTER SE */
- { 0x04bf, 0x30bd }, /* kana_SO ソ KATAKANA LETTER SO */
- { 0x04c0, 0x30bf }, /* kana_TA ã‚¿ KATAKANA LETTER TA */
- { 0x04c1, 0x30c1 }, /* kana_CHI ムKATAKANA LETTER TI */
- { 0x04af, 0x30c3 }, /* kana_tsu ッ KATAKANA LETTER SMALL TU */
- { 0x04c2, 0x30c4 }, /* kana_TSU ツ KATAKANA LETTER TU */
- { 0x04c3, 0x30c6 }, /* kana_TE テ KATAKANA LETTER TE */
- { 0x04c4, 0x30c8 }, /* kana_TO ト KATAKANA LETTER TO */
- { 0x04c5, 0x30ca }, /* kana_NA ナ KATAKANA LETTER NA */
- { 0x04c6, 0x30cb }, /* kana_NI ニ KATAKANA LETTER NI */
- { 0x04c7, 0x30cc }, /* kana_NU ヌ KATAKANA LETTER NU */
- { 0x04c8, 0x30cd }, /* kana_NE ムKATAKANA LETTER NE */
- { 0x04c9, 0x30ce }, /* kana_NO ノ KATAKANA LETTER NO */
- { 0x04ca, 0x30cf }, /* kana_HA ムKATAKANA LETTER HA */
- { 0x04cb, 0x30d2 }, /* kana_HI ヒ KATAKANA LETTER HI */
- { 0x04cc, 0x30d5 }, /* kana_FU フ KATAKANA LETTER HU */
- { 0x04cd, 0x30d8 }, /* kana_HE ヘ KATAKANA LETTER HE */
- { 0x04ce, 0x30db }, /* kana_HO ホ KATAKANA LETTER HO */
- { 0x04cf, 0x30de }, /* kana_MA マ KATAKANA LETTER MA */
- { 0x04d0, 0x30df }, /* kana_MI ミ KATAKANA LETTER MI */
- { 0x04d1, 0x30e0 }, /* kana_MU ム KATAKANA LETTER MU */
- { 0x04d2, 0x30e1 }, /* kana_ME メ KATAKANA LETTER ME */
- { 0x04d3, 0x30e2 }, /* kana_MO モ KATAKANA LETTER MO */
- { 0x04ac, 0x30e3 }, /* kana_ya ャ KATAKANA LETTER SMALL YA */
- { 0x04d4, 0x30e4 }, /* kana_YA ヤ KATAKANA LETTER YA */
- { 0x04ad, 0x30e5 }, /* kana_yu ュ KATAKANA LETTER SMALL YU */
- { 0x04d5, 0x30e6 }, /* kana_YU ユ KATAKANA LETTER YU */
- { 0x04ae, 0x30e7 }, /* kana_yo ョ KATAKANA LETTER SMALL YO */
- { 0x04d6, 0x30e8 }, /* kana_YO ヨ KATAKANA LETTER YO */
- { 0x04d7, 0x30e9 }, /* kana_RA ラ KATAKANA LETTER RA */
- { 0x04d8, 0x30ea }, /* kana_RI リ KATAKANA LETTER RI */
- { 0x04d9, 0x30eb }, /* kana_RU ル KATAKANA LETTER RU */
- { 0x04da, 0x30ec }, /* kana_RE レ KATAKANA LETTER RE */
- { 0x04db, 0x30ed }, /* kana_RO ロ KATAKANA LETTER RO */
- { 0x04dc, 0x30ef }, /* kana_WA ワ KATAKANA LETTER WA */
- { 0x04a6, 0x30f2 }, /* kana_WO ヲ KATAKANA LETTER WO */
- { 0x04dd, 0x30f3 }, /* kana_N ン KATAKANA LETTER N */
- { 0x04a5, 0x30fb }, /* kana_conjunctive ・ KATAKANA MIDDLE DOT */
- { 0x04b0, 0x30fc }, /* prolongedsound ー KATAKANA-HIRAGANA PROLONGED SOUND MARK */
- { 0x0ea1, 0x3131 }, /* Hangul_Kiyeog ㄱ HANGUL LETTER KIYEOK */
- { 0x0ea2, 0x3132 }, /* Hangul_SsangKiyeog ㄲ HANGUL LETTER SSANGKIYEOK */
- { 0x0ea3, 0x3133 }, /* Hangul_KiyeogSios ㄳ HANGUL LETTER KIYEOK-SIOS */
- { 0x0ea4, 0x3134 }, /* Hangul_Nieun ã„´ HANGUL LETTER NIEUN */
- { 0x0ea5, 0x3135 }, /* Hangul_NieunJieuj ㄵ HANGUL LETTER NIEUN-CIEUC */
- { 0x0ea6, 0x3136 }, /* Hangul_NieunHieuh ㄶ HANGUL LETTER NIEUN-HIEUH */
- { 0x0ea7, 0x3137 }, /* Hangul_Dikeud ã„· HANGUL LETTER TIKEUT */
- { 0x0ea8, 0x3138 }, /* Hangul_SsangDikeud ㄸ HANGUL LETTER SSANGTIKEUT */
- { 0x0ea9, 0x3139 }, /* Hangul_Rieul ㄹ HANGUL LETTER RIEUL */
- { 0x0eaa, 0x313a }, /* Hangul_RieulKiyeog ㄺ HANGUL LETTER RIEUL-KIYEOK */
- { 0x0eab, 0x313b }, /* Hangul_RieulMieum ã„» HANGUL LETTER RIEUL-MIEUM */
- { 0x0eac, 0x313c }, /* Hangul_RieulPieub ㄼ HANGUL LETTER RIEUL-PIEUP */
- { 0x0ead, 0x313d }, /* Hangul_RieulSios ㄽ HANGUL LETTER RIEUL-SIOS */
- { 0x0eae, 0x313e }, /* Hangul_RieulTieut ㄾ HANGUL LETTER RIEUL-THIEUTH */
- { 0x0eaf, 0x313f }, /* Hangul_RieulPhieuf ã„¿ HANGUL LETTER RIEUL-PHIEUPH */
- { 0x0eb0, 0x3140 }, /* Hangul_RieulHieuh ã…€ HANGUL LETTER RIEUL-HIEUH */
- { 0x0eb1, 0x3141 }, /* Hangul_Mieum ã… HANGUL LETTER MIEUM */
- { 0x0eb2, 0x3142 }, /* Hangul_Pieub ã…‚ HANGUL LETTER PIEUP */
- { 0x0eb3, 0x3143 }, /* Hangul_SsangPieub ã…ƒ HANGUL LETTER SSANGPIEUP */
- { 0x0eb4, 0x3144 }, /* Hangul_PieubSios ã…„ HANGUL LETTER PIEUP-SIOS */
- { 0x0eb5, 0x3145 }, /* Hangul_Sios ã…… HANGUL LETTER SIOS */
- { 0x0eb6, 0x3146 }, /* Hangul_SsangSios ã…† HANGUL LETTER SSANGSIOS */
- { 0x0eb7, 0x3147 }, /* Hangul_Ieung ã…‡ HANGUL LETTER IEUNG */
- { 0x0eb8, 0x3148 }, /* Hangul_Jieuj ã…ˆ HANGUL LETTER CIEUC */
- { 0x0eb9, 0x3149 }, /* Hangul_SsangJieuj ã…‰ HANGUL LETTER SSANGCIEUC */
- { 0x0eba, 0x314a }, /* Hangul_Cieuc ã…Š HANGUL LETTER CHIEUCH */
- { 0x0ebb, 0x314b }, /* Hangul_Khieuq ã…‹ HANGUL LETTER KHIEUKH */
- { 0x0ebc, 0x314c }, /* Hangul_Tieut ㅌ HANGUL LETTER THIEUTH */
- { 0x0ebd, 0x314d }, /* Hangul_Phieuf ã… HANGUL LETTER PHIEUPH */
- { 0x0ebe, 0x314e }, /* Hangul_Hieuh ã…Ž HANGUL LETTER HIEUH */
- { 0x0ebf, 0x314f }, /* Hangul_A ã… HANGUL LETTER A */
- { 0x0ec0, 0x3150 }, /* Hangul_AE ã… HANGUL LETTER AE */
- { 0x0ec1, 0x3151 }, /* Hangul_YA ã…‘ HANGUL LETTER YA */
- { 0x0ec2, 0x3152 }, /* Hangul_YAE ã…’ HANGUL LETTER YAE */
- { 0x0ec3, 0x3153 }, /* Hangul_EO ã…“ HANGUL LETTER EO */
- { 0x0ec4, 0x3154 }, /* Hangul_E ã…” HANGUL LETTER E */
- { 0x0ec5, 0x3155 }, /* Hangul_YEO ã…• HANGUL LETTER YEO */
- { 0x0ec6, 0x3156 }, /* Hangul_YE ã…– HANGUL LETTER YE */
- { 0x0ec7, 0x3157 }, /* Hangul_O ã…— HANGUL LETTER O */
- { 0x0ec8, 0x3158 }, /* Hangul_WA ã…˜ HANGUL LETTER WA */
- { 0x0ec9, 0x3159 }, /* Hangul_WAE ã…™ HANGUL LETTER WAE */
- { 0x0eca, 0x315a }, /* Hangul_OE ã…š HANGUL LETTER OE */
- { 0x0ecb, 0x315b }, /* Hangul_YO ã…› HANGUL LETTER YO */
- { 0x0ecc, 0x315c }, /* Hangul_U ㅜ HANGUL LETTER U */
- { 0x0ecd, 0x315d }, /* Hangul_WEO ã… HANGUL LETTER WEO */
- { 0x0ece, 0x315e }, /* Hangul_WE ã…ž HANGUL LETTER WE */
- { 0x0ecf, 0x315f }, /* Hangul_WI ã…Ÿ HANGUL LETTER WI */
- { 0x0ed0, 0x3160 }, /* Hangul_YU ã…  HANGUL LETTER YU */
- { 0x0ed1, 0x3161 }, /* Hangul_EU ã…¡ HANGUL LETTER EU */
- { 0x0ed2, 0x3162 }, /* Hangul_YI ã…¢ HANGUL LETTER YI */
- { 0x0ed3, 0x3163 }, /* Hangul_I ã…£ HANGUL LETTER I */
- { 0x0eef, 0x316d }, /* Hangul_RieulYeorinHieuh ã…­ HANGUL LETTER RIEUL-YEORINHIEUH */
- { 0x0ef0, 0x3171 }, /* Hangul_SunkyeongeumMieum ã…± HANGUL LETTER KAPYEOUNMIEUM */
- { 0x0ef1, 0x3178 }, /* Hangul_SunkyeongeumPieub ã…¸ HANGUL LETTER KAPYEOUNPIEUP */
- { 0x0ef2, 0x317f }, /* Hangul_PanSios ã…¿ HANGUL LETTER PANSIOS */
- { 0x0ef4, 0x3184 }, /* Hangul_SunkyeongeumPhieuf ㆄ HANGUL LETTER KAPYEOUNPHIEUPH */
- { 0x0ef5, 0x3186 }, /* Hangul_YeorinHieuh ㆆ HANGUL LETTER YEORINHIEUH */
- { 0x0ef6, 0x318d }, /* Hangul_AraeA ㆠHANGUL LETTER ARAEA */
- { 0x0ef7, 0x318e }, /* Hangul_AraeAE ㆎ HANGUL LETTER ARAEAE */
-};
-
-static const int clutter_unicode_to_keysym_tab_size =
- G_N_ELEMENTS (clutter_unicode_to_keysym_tab);
-
-/**
- * clutter_unicode_to_keysym:
- * @wc: a ISO10646 encoded character
- *
- * Convert from a ISO10646 character to a key symbol.
- *
- * Return value: the corresponding Clutter key symbol, if one exists.
- * or, if there is no corresponding symbol, wc | 0x01000000
- *
- * Since: 1.10
- */
-guint
-clutter_unicode_to_keysym (guint32 wc)
-{
- int min = 0;
- int max = clutter_unicode_to_keysym_tab_size - 1;
- int mid;
-
- /* First check for Latin-1 characters (1:1 mapping) */
- if ((wc >= 0x0020 && wc <= 0x007e) ||
- (wc >= 0x00a0 && wc <= 0x00ff))
- return wc;
-
- /* Binary search in table */
- while (max >= min)
- {
- mid = (min + max) / 2;
-
- if (clutter_unicode_to_keysym_tab[mid].ucs < wc)
- min = mid + 1;
- else if (clutter_unicode_to_keysym_tab[mid].ucs > wc)
- max = mid - 1;
- else
- {
- /* found it */
- return clutter_unicode_to_keysym_tab[mid].keysym;
- }
- }
-
- /* No matching keysym value found, return Unicode value plus 0x01000000
- * (a convention introduced in the UTF-8 work on xterm).
- */
- return wc | 0x01000000;
-}
diff --git a/clutter/clutter/clutter-keysyms-update.pl b/clutter/clutter/clutter-keysyms-update.pl
deleted file mode 100755
index a37598140..000000000
--- a/clutter/clutter/clutter-keysyms-update.pl
+++ /dev/null
@@ -1,180 +0,0 @@
-#!/usr/bin/env perl
-
-# Author : Simos Xenitellis <simos at gnome dot org>.
-# Author : Bastien Nocera <hadess@hadess.net>
-# Version : 1.2
-#
-# Notes : It downloads keysymdef.h from the Internet, if not found locally,
-# Notes : and creates an updated clutter-keysyms.h
-
-use strict;
-
-my $update_url = 'http://git.clutter-project.org/clutter/plain/clutter/clutter-keysyms-update.pl';
-
-# Used for reading the keysymdef symbols.
-my @keysymelements;
-
-my $keysymdef_url = 'http://cgit.freedesktop.org/xorg/proto/x11proto/plain/keysymdef.h';
-
-if ( ! -f "keysymdef.h" )
-{
- print "Trying to download keysymdef.h from\n", $keysymdef_url, "\n";
- die "Unable to download keysymdef.h: $!"
- unless system("wget -c -O keysymdef.h \"$keysymdef_url\"") == 0;
- print " done.\n\n";
-}
-else
-{
- print "We are using existing keysymdef.h found in this directory.\n";
- print "It is assumed that you took care and it is a recent version\n";
-}
-
-my $XF86keysym_url = 'http://cgit.freedesktop.org/xorg/proto/x11proto/plain/XF86keysym.h';
-
-if ( ! -f "XF86keysym.h" )
-{
- print "Trying to download XF86keysym.h from\n", $XF86keysym_url, "\n";
- die "Unable to download keysymdef.h: $!\n"
- unless system("wget -c -O XF86keysym.h \"$XF86keysym_url\"") == 0;
- print " done.\n\n";
-}
-else
-{
- print "We are using existing XF86keysym.h found in this directory.\n";
- print "It is assumed that you took care and it is a recent version\n";
-}
-
-if ( -f "clutter-keysyms.h" )
-{
- print "There is already a clutter-keysyms.h file in this directory. We are not overwriting it.\n";
- print "Please move it somewhere else in order to run this script.\n";
- die "Exiting...\n\n";
-}
-
-die "Could not open file keysymdef.h: $!\n"
- unless open(IN_KEYSYMDEF, "<:utf8", "keysymdef.h");
-
-# Output: clutter/clutter/clutter-keysyms.h
-die "Could not open file clutter-keysyms.h: $!\n"
- unless open(OUT_KEYSYMS, ">:utf8", "clutter-keysyms.h");
-
-my $LICENSE_HEADER= <<EOF;
-/* Clutter
- *
- * Copyright (C) 2006, 2007, 2008 OpenedHand Ltd
- * 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>.
- */
-
-EOF
-
-print OUT_KEYSYMS $LICENSE_HEADER;
-
-print OUT_KEYSYMS<<EOF;
-
-/*
- * File auto-generated from script at:
- * $update_url
- *
- * using the input files:
- * $keysymdef_url
- * and
- * $XF86keysym_url
- */
-
-#ifndef __CLUTTER_KEYSYMS_H__
-#define __CLUTTER_KEYSYMS_H__
-
-EOF
-
-while (<IN_KEYSYMDEF>)
-{
- next if ( ! /^#define / );
-
- @keysymelements = split(/\s+/);
- die "Internal error, no \@keysymelements: $_\n" unless @keysymelements;
-
- $_ = $keysymelements[1];
- die "Internal error, was expecting \"XC_*\", found: $_\n" if ( ! /^XK_/ );
-
- $_ = $keysymelements[2];
- die "Internal error, was expecting \"0x*\", found: $_\n" if ( ! /^0x/ );
-
- my $element = $keysymelements[1];
- my $binding = $element;
- $binding =~ s/^XK_/CLUTTER_KEY_/g;
-
- printf OUT_KEYSYMS "#define %s 0x%03x\n", $binding, hex($keysymelements[2]);
-}
-
-close IN_KEYSYMDEF;
-
-#$cluttersyms{"0"} = "0000";
-
-# Source: http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob;f=XF86keysym.h
-die "Could not open file XF86keysym.h: $!\n" unless open(IN_XF86KEYSYM, "<:utf8", "XF86keysym.h");
-
-while (<IN_XF86KEYSYM>)
-{
- next if ( ! /^#define / );
-
- @keysymelements = split(/\s+/);
- die "Internal error, no \@keysymelements: $_\n" unless @keysymelements;
-
- $_ = $keysymelements[1];
- die "Internal error, was expecting \"XF86XK_*\", found: $_\n" if ( ! /^XF86XK_/ );
-
- # Work-around https://bugs.freedesktop.org/show_bug.cgi?id=11193
- if ($_ eq "XF86XK_XF86BackForward") {
- $keysymelements[1] = "XF86XK_AudioForward";
- }
- # XF86XK_Clear could end up a dupe of XK_Clear
- # XF86XK_Select could end up a dupe of XK_Select
- if ($_ eq "XF86XK_Clear") {
- $keysymelements[1] = "XF86XK_WindowClear";
- }
- if ($_ eq "XF86XK_Select") {
- $keysymelements[1] = "XF86XK_SelectButton";
- }
-
- # Ignore XF86XK_Q
- next if ( $_ eq "XF86XK_Q");
- # XF86XK_Calculater is misspelled, and a dupe
- next if ( $_ eq "XF86XK_Calculater");
-
- $_ = $keysymelements[2];
- die "Internal error, was expecting \"0x*\", found: $_\n" if ( ! /^0x/ );
-
- my $element = $keysymelements[1];
- my $binding = $element;
- $binding =~ s/^XF86XK_/CLUTTER_KEY_/g;
-
- printf OUT_KEYSYMS "#define %s 0x%03x\n", $binding, hex($keysymelements[2]);
-}
-
-close IN_XF86KEYSYM;
-
-
-print OUT_KEYSYMS<<EOF;
-
-#endif /* __CLUTTER_KEYSYMS_H__ */
-EOF
-
-foreach my $f (qw/ keysymdef.h XF86keysym.h /) {
- unlink $f or die "Unable to delete $f: $!";
-}
-
-printf "We just finished converting keysymdef.h to clutter-keysyms.h "
- . "and deprecated/clutter-keysyms.h\nThank you\n";
diff --git a/clutter/clutter/clutter-keysyms.h b/clutter/clutter/clutter-keysyms.h
deleted file mode 100644
index b128bab10..000000000
--- a/clutter/clutter/clutter-keysyms.h
+++ /dev/null
@@ -1,2309 +0,0 @@
-/* Clutter
- *
- * Copyright (C) 2006, 2007, 2008 OpenedHand Ltd
- * 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>.
- */
-
-
-/*
- * File auto-generated from script at:
- * http://git.clutter-project.org/clutter/plain/clutter/clutter-keysyms-update.pl
- *
- * using the input files:
- * http://cgit.freedesktop.org/xorg/proto/x11proto/plain/keysymdef.h
- * and
- * http://cgit.freedesktop.org/xorg/proto/x11proto/plain/XF86keysym.h
- */
-
-#ifndef __CLUTTER_KEYSYMS_H__
-#define __CLUTTER_KEYSYMS_H__
-
-#define CLUTTER_KEY_VoidSymbol 0xffffff
-#define CLUTTER_KEY_BackSpace 0xff08
-#define CLUTTER_KEY_Tab 0xff09
-#define CLUTTER_KEY_Linefeed 0xff0a
-#define CLUTTER_KEY_Clear 0xff0b
-#define CLUTTER_KEY_Return 0xff0d
-#define CLUTTER_KEY_Pause 0xff13
-#define CLUTTER_KEY_Scroll_Lock 0xff14
-#define CLUTTER_KEY_Sys_Req 0xff15
-#define CLUTTER_KEY_Escape 0xff1b
-#define CLUTTER_KEY_Delete 0xffff
-#define CLUTTER_KEY_Multi_key 0xff20
-#define CLUTTER_KEY_Codeinput 0xff37
-#define CLUTTER_KEY_SingleCandidate 0xff3c
-#define CLUTTER_KEY_MultipleCandidate 0xff3d
-#define CLUTTER_KEY_PreviousCandidate 0xff3e
-#define CLUTTER_KEY_Kanji 0xff21
-#define CLUTTER_KEY_Muhenkan 0xff22
-#define CLUTTER_KEY_Henkan_Mode 0xff23
-#define CLUTTER_KEY_Henkan 0xff23
-#define CLUTTER_KEY_Romaji 0xff24
-#define CLUTTER_KEY_Hiragana 0xff25
-#define CLUTTER_KEY_Katakana 0xff26
-#define CLUTTER_KEY_Hiragana_Katakana 0xff27
-#define CLUTTER_KEY_Zenkaku 0xff28
-#define CLUTTER_KEY_Hankaku 0xff29
-#define CLUTTER_KEY_Zenkaku_Hankaku 0xff2a
-#define CLUTTER_KEY_Touroku 0xff2b
-#define CLUTTER_KEY_Massyo 0xff2c
-#define CLUTTER_KEY_Kana_Lock 0xff2d
-#define CLUTTER_KEY_Kana_Shift 0xff2e
-#define CLUTTER_KEY_Eisu_Shift 0xff2f
-#define CLUTTER_KEY_Eisu_toggle 0xff30
-#define CLUTTER_KEY_Kanji_Bangou 0xff37
-#define CLUTTER_KEY_Zen_Koho 0xff3d
-#define CLUTTER_KEY_Mae_Koho 0xff3e
-#define CLUTTER_KEY_Home 0xff50
-#define CLUTTER_KEY_Left 0xff51
-#define CLUTTER_KEY_Up 0xff52
-#define CLUTTER_KEY_Right 0xff53
-#define CLUTTER_KEY_Down 0xff54
-#define CLUTTER_KEY_Prior 0xff55
-#define CLUTTER_KEY_Page_Up 0xff55
-#define CLUTTER_KEY_Next 0xff56
-#define CLUTTER_KEY_Page_Down 0xff56
-#define CLUTTER_KEY_End 0xff57
-#define CLUTTER_KEY_Begin 0xff58
-#define CLUTTER_KEY_Select 0xff60
-#define CLUTTER_KEY_Print 0xff61
-#define CLUTTER_KEY_Execute 0xff62
-#define CLUTTER_KEY_Insert 0xff63
-#define CLUTTER_KEY_Undo 0xff65
-#define CLUTTER_KEY_Redo 0xff66
-#define CLUTTER_KEY_Menu 0xff67
-#define CLUTTER_KEY_Find 0xff68
-#define CLUTTER_KEY_Cancel 0xff69
-#define CLUTTER_KEY_Help 0xff6a
-#define CLUTTER_KEY_Break 0xff6b
-#define CLUTTER_KEY_Mode_switch 0xff7e
-#define CLUTTER_KEY_script_switch 0xff7e
-#define CLUTTER_KEY_Num_Lock 0xff7f
-#define CLUTTER_KEY_KP_Space 0xff80
-#define CLUTTER_KEY_KP_Tab 0xff89
-#define CLUTTER_KEY_KP_Enter 0xff8d
-#define CLUTTER_KEY_KP_F1 0xff91
-#define CLUTTER_KEY_KP_F2 0xff92
-#define CLUTTER_KEY_KP_F3 0xff93
-#define CLUTTER_KEY_KP_F4 0xff94
-#define CLUTTER_KEY_KP_Home 0xff95
-#define CLUTTER_KEY_KP_Left 0xff96
-#define CLUTTER_KEY_KP_Up 0xff97
-#define CLUTTER_KEY_KP_Right 0xff98
-#define CLUTTER_KEY_KP_Down 0xff99
-#define CLUTTER_KEY_KP_Prior 0xff9a
-#define CLUTTER_KEY_KP_Page_Up 0xff9a
-#define CLUTTER_KEY_KP_Next 0xff9b
-#define CLUTTER_KEY_KP_Page_Down 0xff9b
-#define CLUTTER_KEY_KP_End 0xff9c
-#define CLUTTER_KEY_KP_Begin 0xff9d
-#define CLUTTER_KEY_KP_Insert 0xff9e
-#define CLUTTER_KEY_KP_Delete 0xff9f
-#define CLUTTER_KEY_KP_Equal 0xffbd
-#define CLUTTER_KEY_KP_Multiply 0xffaa
-#define CLUTTER_KEY_KP_Add 0xffab
-#define CLUTTER_KEY_KP_Separator 0xffac
-#define CLUTTER_KEY_KP_Subtract 0xffad
-#define CLUTTER_KEY_KP_Decimal 0xffae
-#define CLUTTER_KEY_KP_Divide 0xffaf
-#define CLUTTER_KEY_KP_0 0xffb0
-#define CLUTTER_KEY_KP_1 0xffb1
-#define CLUTTER_KEY_KP_2 0xffb2
-#define CLUTTER_KEY_KP_3 0xffb3
-#define CLUTTER_KEY_KP_4 0xffb4
-#define CLUTTER_KEY_KP_5 0xffb5
-#define CLUTTER_KEY_KP_6 0xffb6
-#define CLUTTER_KEY_KP_7 0xffb7
-#define CLUTTER_KEY_KP_8 0xffb8
-#define CLUTTER_KEY_KP_9 0xffb9
-#define CLUTTER_KEY_F1 0xffbe
-#define CLUTTER_KEY_F2 0xffbf
-#define CLUTTER_KEY_F3 0xffc0
-#define CLUTTER_KEY_F4 0xffc1
-#define CLUTTER_KEY_F5 0xffc2
-#define CLUTTER_KEY_F6 0xffc3
-#define CLUTTER_KEY_F7 0xffc4
-#define CLUTTER_KEY_F8 0xffc5
-#define CLUTTER_KEY_F9 0xffc6
-#define CLUTTER_KEY_F10 0xffc7
-#define CLUTTER_KEY_F11 0xffc8
-#define CLUTTER_KEY_L1 0xffc8
-#define CLUTTER_KEY_F12 0xffc9
-#define CLUTTER_KEY_L2 0xffc9
-#define CLUTTER_KEY_F13 0xffca
-#define CLUTTER_KEY_L3 0xffca
-#define CLUTTER_KEY_F14 0xffcb
-#define CLUTTER_KEY_L4 0xffcb
-#define CLUTTER_KEY_F15 0xffcc
-#define CLUTTER_KEY_L5 0xffcc
-#define CLUTTER_KEY_F16 0xffcd
-#define CLUTTER_KEY_L6 0xffcd
-#define CLUTTER_KEY_F17 0xffce
-#define CLUTTER_KEY_L7 0xffce
-#define CLUTTER_KEY_F18 0xffcf
-#define CLUTTER_KEY_L8 0xffcf
-#define CLUTTER_KEY_F19 0xffd0
-#define CLUTTER_KEY_L9 0xffd0
-#define CLUTTER_KEY_F20 0xffd1
-#define CLUTTER_KEY_L10 0xffd1
-#define CLUTTER_KEY_F21 0xffd2
-#define CLUTTER_KEY_R1 0xffd2
-#define CLUTTER_KEY_F22 0xffd3
-#define CLUTTER_KEY_R2 0xffd3
-#define CLUTTER_KEY_F23 0xffd4
-#define CLUTTER_KEY_R3 0xffd4
-#define CLUTTER_KEY_F24 0xffd5
-#define CLUTTER_KEY_R4 0xffd5
-#define CLUTTER_KEY_F25 0xffd6
-#define CLUTTER_KEY_R5 0xffd6
-#define CLUTTER_KEY_F26 0xffd7
-#define CLUTTER_KEY_R6 0xffd7
-#define CLUTTER_KEY_F27 0xffd8
-#define CLUTTER_KEY_R7 0xffd8
-#define CLUTTER_KEY_F28 0xffd9
-#define CLUTTER_KEY_R8 0xffd9
-#define CLUTTER_KEY_F29 0xffda
-#define CLUTTER_KEY_R9 0xffda
-#define CLUTTER_KEY_F30 0xffdb
-#define CLUTTER_KEY_R10 0xffdb
-#define CLUTTER_KEY_F31 0xffdc
-#define CLUTTER_KEY_R11 0xffdc
-#define CLUTTER_KEY_F32 0xffdd
-#define CLUTTER_KEY_R12 0xffdd
-#define CLUTTER_KEY_F33 0xffde
-#define CLUTTER_KEY_R13 0xffde
-#define CLUTTER_KEY_F34 0xffdf
-#define CLUTTER_KEY_R14 0xffdf
-#define CLUTTER_KEY_F35 0xffe0
-#define CLUTTER_KEY_R15 0xffe0
-#define CLUTTER_KEY_Shift_L 0xffe1
-#define CLUTTER_KEY_Shift_R 0xffe2
-#define CLUTTER_KEY_Control_L 0xffe3
-#define CLUTTER_KEY_Control_R 0xffe4
-#define CLUTTER_KEY_Caps_Lock 0xffe5
-#define CLUTTER_KEY_Shift_Lock 0xffe6
-#define CLUTTER_KEY_Meta_L 0xffe7
-#define CLUTTER_KEY_Meta_R 0xffe8
-#define CLUTTER_KEY_Alt_L 0xffe9
-#define CLUTTER_KEY_Alt_R 0xffea
-#define CLUTTER_KEY_Super_L 0xffeb
-#define CLUTTER_KEY_Super_R 0xffec
-#define CLUTTER_KEY_Hyper_L 0xffed
-#define CLUTTER_KEY_Hyper_R 0xffee
-#define CLUTTER_KEY_ISO_Lock 0xfe01
-#define CLUTTER_KEY_ISO_Level2_Latch 0xfe02
-#define CLUTTER_KEY_ISO_Level3_Shift 0xfe03
-#define CLUTTER_KEY_ISO_Level3_Latch 0xfe04
-#define CLUTTER_KEY_ISO_Level3_Lock 0xfe05
-#define CLUTTER_KEY_ISO_Level5_Shift 0xfe11
-#define CLUTTER_KEY_ISO_Level5_Latch 0xfe12
-#define CLUTTER_KEY_ISO_Level5_Lock 0xfe13
-#define CLUTTER_KEY_ISO_Group_Shift 0xff7e
-#define CLUTTER_KEY_ISO_Group_Latch 0xfe06
-#define CLUTTER_KEY_ISO_Group_Lock 0xfe07
-#define CLUTTER_KEY_ISO_Next_Group 0xfe08
-#define CLUTTER_KEY_ISO_Next_Group_Lock 0xfe09
-#define CLUTTER_KEY_ISO_Prev_Group 0xfe0a
-#define CLUTTER_KEY_ISO_Prev_Group_Lock 0xfe0b
-#define CLUTTER_KEY_ISO_First_Group 0xfe0c
-#define CLUTTER_KEY_ISO_First_Group_Lock 0xfe0d
-#define CLUTTER_KEY_ISO_Last_Group 0xfe0e
-#define CLUTTER_KEY_ISO_Last_Group_Lock 0xfe0f
-#define CLUTTER_KEY_ISO_Left_Tab 0xfe20
-#define CLUTTER_KEY_ISO_Move_Line_Up 0xfe21
-#define CLUTTER_KEY_ISO_Move_Line_Down 0xfe22
-#define CLUTTER_KEY_ISO_Partial_Line_Up 0xfe23
-#define CLUTTER_KEY_ISO_Partial_Line_Down 0xfe24
-#define CLUTTER_KEY_ISO_Partial_Space_Left 0xfe25
-#define CLUTTER_KEY_ISO_Partial_Space_Right 0xfe26
-#define CLUTTER_KEY_ISO_Set_Margin_Left 0xfe27
-#define CLUTTER_KEY_ISO_Set_Margin_Right 0xfe28
-#define CLUTTER_KEY_ISO_Release_Margin_Left 0xfe29
-#define CLUTTER_KEY_ISO_Release_Margin_Right 0xfe2a
-#define CLUTTER_KEY_ISO_Release_Both_Margins 0xfe2b
-#define CLUTTER_KEY_ISO_Fast_Cursor_Left 0xfe2c
-#define CLUTTER_KEY_ISO_Fast_Cursor_Right 0xfe2d
-#define CLUTTER_KEY_ISO_Fast_Cursor_Up 0xfe2e
-#define CLUTTER_KEY_ISO_Fast_Cursor_Down 0xfe2f
-#define CLUTTER_KEY_ISO_Continuous_Underline 0xfe30
-#define CLUTTER_KEY_ISO_Discontinuous_Underline 0xfe31
-#define CLUTTER_KEY_ISO_Emphasize 0xfe32
-#define CLUTTER_KEY_ISO_Center_Object 0xfe33
-#define CLUTTER_KEY_ISO_Enter 0xfe34
-#define CLUTTER_KEY_dead_grave 0xfe50
-#define CLUTTER_KEY_dead_acute 0xfe51
-#define CLUTTER_KEY_dead_circumflex 0xfe52
-#define CLUTTER_KEY_dead_tilde 0xfe53
-#define CLUTTER_KEY_dead_perispomeni 0xfe53
-#define CLUTTER_KEY_dead_macron 0xfe54
-#define CLUTTER_KEY_dead_breve 0xfe55
-#define CLUTTER_KEY_dead_abovedot 0xfe56
-#define CLUTTER_KEY_dead_diaeresis 0xfe57
-#define CLUTTER_KEY_dead_abovering 0xfe58
-#define CLUTTER_KEY_dead_doubleacute 0xfe59
-#define CLUTTER_KEY_dead_caron 0xfe5a
-#define CLUTTER_KEY_dead_cedilla 0xfe5b
-#define CLUTTER_KEY_dead_ogonek 0xfe5c
-#define CLUTTER_KEY_dead_iota 0xfe5d
-#define CLUTTER_KEY_dead_voiced_sound 0xfe5e
-#define CLUTTER_KEY_dead_semivoiced_sound 0xfe5f
-#define CLUTTER_KEY_dead_belowdot 0xfe60
-#define CLUTTER_KEY_dead_hook 0xfe61
-#define CLUTTER_KEY_dead_horn 0xfe62
-#define CLUTTER_KEY_dead_stroke 0xfe63
-#define CLUTTER_KEY_dead_abovecomma 0xfe64
-#define CLUTTER_KEY_dead_psili 0xfe64
-#define CLUTTER_KEY_dead_abovereversedcomma 0xfe65
-#define CLUTTER_KEY_dead_dasia 0xfe65
-#define CLUTTER_KEY_dead_doublegrave 0xfe66
-#define CLUTTER_KEY_dead_belowring 0xfe67
-#define CLUTTER_KEY_dead_belowmacron 0xfe68
-#define CLUTTER_KEY_dead_belowcircumflex 0xfe69
-#define CLUTTER_KEY_dead_belowtilde 0xfe6a
-#define CLUTTER_KEY_dead_belowbreve 0xfe6b
-#define CLUTTER_KEY_dead_belowdiaeresis 0xfe6c
-#define CLUTTER_KEY_dead_invertedbreve 0xfe6d
-#define CLUTTER_KEY_dead_belowcomma 0xfe6e
-#define CLUTTER_KEY_dead_currency 0xfe6f
-#define CLUTTER_KEY_dead_lowline 0xfe90
-#define CLUTTER_KEY_dead_aboveverticalline 0xfe91
-#define CLUTTER_KEY_dead_belowverticalline 0xfe92
-#define CLUTTER_KEY_dead_longsolidusoverlay 0xfe93
-#define CLUTTER_KEY_dead_a 0xfe80
-#define CLUTTER_KEY_dead_A 0xfe81
-#define CLUTTER_KEY_dead_e 0xfe82
-#define CLUTTER_KEY_dead_E 0xfe83
-#define CLUTTER_KEY_dead_i 0xfe84
-#define CLUTTER_KEY_dead_I 0xfe85
-#define CLUTTER_KEY_dead_o 0xfe86
-#define CLUTTER_KEY_dead_O 0xfe87
-#define CLUTTER_KEY_dead_u 0xfe88
-#define CLUTTER_KEY_dead_U 0xfe89
-#define CLUTTER_KEY_dead_small_schwa 0xfe8a
-#define CLUTTER_KEY_dead_capital_schwa 0xfe8b
-#define CLUTTER_KEY_dead_greek 0xfe8c
-#define CLUTTER_KEY_First_Virtual_Screen 0xfed0
-#define CLUTTER_KEY_Prev_Virtual_Screen 0xfed1
-#define CLUTTER_KEY_Next_Virtual_Screen 0xfed2
-#define CLUTTER_KEY_Last_Virtual_Screen 0xfed4
-#define CLUTTER_KEY_Terminate_Server 0xfed5
-#define CLUTTER_KEY_AccessX_Enable 0xfe70
-#define CLUTTER_KEY_AccessX_Feedback_Enable 0xfe71
-#define CLUTTER_KEY_RepeatKeys_Enable 0xfe72
-#define CLUTTER_KEY_SlowKeys_Enable 0xfe73
-#define CLUTTER_KEY_BounceKeys_Enable 0xfe74
-#define CLUTTER_KEY_StickyKeys_Enable 0xfe75
-#define CLUTTER_KEY_MouseKeys_Enable 0xfe76
-#define CLUTTER_KEY_MouseKeys_Accel_Enable 0xfe77
-#define CLUTTER_KEY_Overlay1_Enable 0xfe78
-#define CLUTTER_KEY_Overlay2_Enable 0xfe79
-#define CLUTTER_KEY_AudibleBell_Enable 0xfe7a
-#define CLUTTER_KEY_Pointer_Left 0xfee0
-#define CLUTTER_KEY_Pointer_Right 0xfee1
-#define CLUTTER_KEY_Pointer_Up 0xfee2
-#define CLUTTER_KEY_Pointer_Down 0xfee3
-#define CLUTTER_KEY_Pointer_UpLeft 0xfee4
-#define CLUTTER_KEY_Pointer_UpRight 0xfee5
-#define CLUTTER_KEY_Pointer_DownLeft 0xfee6
-#define CLUTTER_KEY_Pointer_DownRight 0xfee7
-#define CLUTTER_KEY_Pointer_Button_Dflt 0xfee8
-#define CLUTTER_KEY_Pointer_Button1 0xfee9
-#define CLUTTER_KEY_Pointer_Button2 0xfeea
-#define CLUTTER_KEY_Pointer_Button3 0xfeeb
-#define CLUTTER_KEY_Pointer_Button4 0xfeec
-#define CLUTTER_KEY_Pointer_Button5 0xfeed
-#define CLUTTER_KEY_Pointer_DblClick_Dflt 0xfeee
-#define CLUTTER_KEY_Pointer_DblClick1 0xfeef
-#define CLUTTER_KEY_Pointer_DblClick2 0xfef0
-#define CLUTTER_KEY_Pointer_DblClick3 0xfef1
-#define CLUTTER_KEY_Pointer_DblClick4 0xfef2
-#define CLUTTER_KEY_Pointer_DblClick5 0xfef3
-#define CLUTTER_KEY_Pointer_Drag_Dflt 0xfef4
-#define CLUTTER_KEY_Pointer_Drag1 0xfef5
-#define CLUTTER_KEY_Pointer_Drag2 0xfef6
-#define CLUTTER_KEY_Pointer_Drag3 0xfef7
-#define CLUTTER_KEY_Pointer_Drag4 0xfef8
-#define CLUTTER_KEY_Pointer_Drag5 0xfefd
-#define CLUTTER_KEY_Pointer_EnableKeys 0xfef9
-#define CLUTTER_KEY_Pointer_Accelerate 0xfefa
-#define CLUTTER_KEY_Pointer_DfltBtnNext 0xfefb
-#define CLUTTER_KEY_Pointer_DfltBtnPrev 0xfefc
-#define CLUTTER_KEY_ch 0xfea0
-#define CLUTTER_KEY_Ch 0xfea1
-#define CLUTTER_KEY_CH 0xfea2
-#define CLUTTER_KEY_c_h 0xfea3
-#define CLUTTER_KEY_C_h 0xfea4
-#define CLUTTER_KEY_C_H 0xfea5
-#define CLUTTER_KEY_3270_Duplicate 0xfd01
-#define CLUTTER_KEY_3270_FieldMark 0xfd02
-#define CLUTTER_KEY_3270_Right2 0xfd03
-#define CLUTTER_KEY_3270_Left2 0xfd04
-#define CLUTTER_KEY_3270_BackTab 0xfd05
-#define CLUTTER_KEY_3270_EraseEOF 0xfd06
-#define CLUTTER_KEY_3270_EraseInput 0xfd07
-#define CLUTTER_KEY_3270_Reset 0xfd08
-#define CLUTTER_KEY_3270_Quit 0xfd09
-#define CLUTTER_KEY_3270_PA1 0xfd0a
-#define CLUTTER_KEY_3270_PA2 0xfd0b
-#define CLUTTER_KEY_3270_PA3 0xfd0c
-#define CLUTTER_KEY_3270_Test 0xfd0d
-#define CLUTTER_KEY_3270_Attn 0xfd0e
-#define CLUTTER_KEY_3270_CursorBlink 0xfd0f
-#define CLUTTER_KEY_3270_AltCursor 0xfd10
-#define CLUTTER_KEY_3270_KeyClick 0xfd11
-#define CLUTTER_KEY_3270_Jump 0xfd12
-#define CLUTTER_KEY_3270_Ident 0xfd13
-#define CLUTTER_KEY_3270_Rule 0xfd14
-#define CLUTTER_KEY_3270_Copy 0xfd15
-#define CLUTTER_KEY_3270_Play 0xfd16
-#define CLUTTER_KEY_3270_Setup 0xfd17
-#define CLUTTER_KEY_3270_Record 0xfd18
-#define CLUTTER_KEY_3270_ChangeScreen 0xfd19
-#define CLUTTER_KEY_3270_DeleteWord 0xfd1a
-#define CLUTTER_KEY_3270_ExSelect 0xfd1b
-#define CLUTTER_KEY_3270_CursorSelect 0xfd1c
-#define CLUTTER_KEY_3270_PrintScreen 0xfd1d
-#define CLUTTER_KEY_3270_Enter 0xfd1e
-#define CLUTTER_KEY_space 0x020
-#define CLUTTER_KEY_exclam 0x021
-#define CLUTTER_KEY_quotedbl 0x022
-#define CLUTTER_KEY_numbersign 0x023
-#define CLUTTER_KEY_dollar 0x024
-#define CLUTTER_KEY_percent 0x025
-#define CLUTTER_KEY_ampersand 0x026
-#define CLUTTER_KEY_apostrophe 0x027
-#define CLUTTER_KEY_quoteright 0x027
-#define CLUTTER_KEY_parenleft 0x028
-#define CLUTTER_KEY_parenright 0x029
-#define CLUTTER_KEY_asterisk 0x02a
-#define CLUTTER_KEY_plus 0x02b
-#define CLUTTER_KEY_comma 0x02c
-#define CLUTTER_KEY_minus 0x02d
-#define CLUTTER_KEY_period 0x02e
-#define CLUTTER_KEY_slash 0x02f
-#define CLUTTER_KEY_0 0x030
-#define CLUTTER_KEY_1 0x031
-#define CLUTTER_KEY_2 0x032
-#define CLUTTER_KEY_3 0x033
-#define CLUTTER_KEY_4 0x034
-#define CLUTTER_KEY_5 0x035
-#define CLUTTER_KEY_6 0x036
-#define CLUTTER_KEY_7 0x037
-#define CLUTTER_KEY_8 0x038
-#define CLUTTER_KEY_9 0x039
-#define CLUTTER_KEY_colon 0x03a
-#define CLUTTER_KEY_semicolon 0x03b
-#define CLUTTER_KEY_less 0x03c
-#define CLUTTER_KEY_equal 0x03d
-#define CLUTTER_KEY_greater 0x03e
-#define CLUTTER_KEY_question 0x03f
-#define CLUTTER_KEY_at 0x040
-#define CLUTTER_KEY_A 0x041
-#define CLUTTER_KEY_B 0x042
-#define CLUTTER_KEY_C 0x043
-#define CLUTTER_KEY_D 0x044
-#define CLUTTER_KEY_E 0x045
-#define CLUTTER_KEY_F 0x046
-#define CLUTTER_KEY_G 0x047
-#define CLUTTER_KEY_H 0x048
-#define CLUTTER_KEY_I 0x049
-#define CLUTTER_KEY_J 0x04a
-#define CLUTTER_KEY_K 0x04b
-#define CLUTTER_KEY_L 0x04c
-#define CLUTTER_KEY_M 0x04d
-#define CLUTTER_KEY_N 0x04e
-#define CLUTTER_KEY_O 0x04f
-#define CLUTTER_KEY_P 0x050
-#define CLUTTER_KEY_Q 0x051
-#define CLUTTER_KEY_R 0x052
-#define CLUTTER_KEY_S 0x053
-#define CLUTTER_KEY_T 0x054
-#define CLUTTER_KEY_U 0x055
-#define CLUTTER_KEY_V 0x056
-#define CLUTTER_KEY_W 0x057
-#define CLUTTER_KEY_X 0x058
-#define CLUTTER_KEY_Y 0x059
-#define CLUTTER_KEY_Z 0x05a
-#define CLUTTER_KEY_bracketleft 0x05b
-#define CLUTTER_KEY_backslash 0x05c
-#define CLUTTER_KEY_bracketright 0x05d
-#define CLUTTER_KEY_asciicircum 0x05e
-#define CLUTTER_KEY_underscore 0x05f
-#define CLUTTER_KEY_grave 0x060
-#define CLUTTER_KEY_quoteleft 0x060
-#define CLUTTER_KEY_a 0x061
-#define CLUTTER_KEY_b 0x062
-#define CLUTTER_KEY_c 0x063
-#define CLUTTER_KEY_d 0x064
-#define CLUTTER_KEY_e 0x065
-#define CLUTTER_KEY_f 0x066
-#define CLUTTER_KEY_g 0x067
-#define CLUTTER_KEY_h 0x068
-#define CLUTTER_KEY_i 0x069
-#define CLUTTER_KEY_j 0x06a
-#define CLUTTER_KEY_k 0x06b
-#define CLUTTER_KEY_l 0x06c
-#define CLUTTER_KEY_m 0x06d
-#define CLUTTER_KEY_n 0x06e
-#define CLUTTER_KEY_o 0x06f
-#define CLUTTER_KEY_p 0x070
-#define CLUTTER_KEY_q 0x071
-#define CLUTTER_KEY_r 0x072
-#define CLUTTER_KEY_s 0x073
-#define CLUTTER_KEY_t 0x074
-#define CLUTTER_KEY_u 0x075
-#define CLUTTER_KEY_v 0x076
-#define CLUTTER_KEY_w 0x077
-#define CLUTTER_KEY_x 0x078
-#define CLUTTER_KEY_y 0x079
-#define CLUTTER_KEY_z 0x07a
-#define CLUTTER_KEY_braceleft 0x07b
-#define CLUTTER_KEY_bar 0x07c
-#define CLUTTER_KEY_braceright 0x07d
-#define CLUTTER_KEY_asciitilde 0x07e
-#define CLUTTER_KEY_nobreakspace 0x0a0
-#define CLUTTER_KEY_exclamdown 0x0a1
-#define CLUTTER_KEY_cent 0x0a2
-#define CLUTTER_KEY_sterling 0x0a3
-#define CLUTTER_KEY_currency 0x0a4
-#define CLUTTER_KEY_yen 0x0a5
-#define CLUTTER_KEY_brokenbar 0x0a6
-#define CLUTTER_KEY_section 0x0a7
-#define CLUTTER_KEY_diaeresis 0x0a8
-#define CLUTTER_KEY_copyright 0x0a9
-#define CLUTTER_KEY_ordfeminine 0x0aa
-#define CLUTTER_KEY_guillemotleft 0x0ab
-#define CLUTTER_KEY_notsign 0x0ac
-#define CLUTTER_KEY_hyphen 0x0ad
-#define CLUTTER_KEY_registered 0x0ae
-#define CLUTTER_KEY_macron 0x0af
-#define CLUTTER_KEY_degree 0x0b0
-#define CLUTTER_KEY_plusminus 0x0b1
-#define CLUTTER_KEY_twosuperior 0x0b2
-#define CLUTTER_KEY_threesuperior 0x0b3
-#define CLUTTER_KEY_acute 0x0b4
-#define CLUTTER_KEY_mu 0x0b5
-#define CLUTTER_KEY_paragraph 0x0b6
-#define CLUTTER_KEY_periodcentered 0x0b7
-#define CLUTTER_KEY_cedilla 0x0b8
-#define CLUTTER_KEY_onesuperior 0x0b9
-#define CLUTTER_KEY_masculine 0x0ba
-#define CLUTTER_KEY_guillemotright 0x0bb
-#define CLUTTER_KEY_onequarter 0x0bc
-#define CLUTTER_KEY_onehalf 0x0bd
-#define CLUTTER_KEY_threequarters 0x0be
-#define CLUTTER_KEY_questiondown 0x0bf
-#define CLUTTER_KEY_Agrave 0x0c0
-#define CLUTTER_KEY_Aacute 0x0c1
-#define CLUTTER_KEY_Acircumflex 0x0c2
-#define CLUTTER_KEY_Atilde 0x0c3
-#define CLUTTER_KEY_Adiaeresis 0x0c4
-#define CLUTTER_KEY_Aring 0x0c5
-#define CLUTTER_KEY_AE 0x0c6
-#define CLUTTER_KEY_Ccedilla 0x0c7
-#define CLUTTER_KEY_Egrave 0x0c8
-#define CLUTTER_KEY_Eacute 0x0c9
-#define CLUTTER_KEY_Ecircumflex 0x0ca
-#define CLUTTER_KEY_Ediaeresis 0x0cb
-#define CLUTTER_KEY_Igrave 0x0cc
-#define CLUTTER_KEY_Iacute 0x0cd
-#define CLUTTER_KEY_Icircumflex 0x0ce
-#define CLUTTER_KEY_Idiaeresis 0x0cf
-#define CLUTTER_KEY_ETH 0x0d0
-#define CLUTTER_KEY_Eth 0x0d0
-#define CLUTTER_KEY_Ntilde 0x0d1
-#define CLUTTER_KEY_Ograve 0x0d2
-#define CLUTTER_KEY_Oacute 0x0d3
-#define CLUTTER_KEY_Ocircumflex 0x0d4
-#define CLUTTER_KEY_Otilde 0x0d5
-#define CLUTTER_KEY_Odiaeresis 0x0d6
-#define CLUTTER_KEY_multiply 0x0d7
-#define CLUTTER_KEY_Oslash 0x0d8
-#define CLUTTER_KEY_Ooblique 0x0d8
-#define CLUTTER_KEY_Ugrave 0x0d9
-#define CLUTTER_KEY_Uacute 0x0da
-#define CLUTTER_KEY_Ucircumflex 0x0db
-#define CLUTTER_KEY_Udiaeresis 0x0dc
-#define CLUTTER_KEY_Yacute 0x0dd
-#define CLUTTER_KEY_THORN 0x0de
-#define CLUTTER_KEY_Thorn 0x0de
-#define CLUTTER_KEY_ssharp 0x0df
-#define CLUTTER_KEY_agrave 0x0e0
-#define CLUTTER_KEY_aacute 0x0e1
-#define CLUTTER_KEY_acircumflex 0x0e2
-#define CLUTTER_KEY_atilde 0x0e3
-#define CLUTTER_KEY_adiaeresis 0x0e4
-#define CLUTTER_KEY_aring 0x0e5
-#define CLUTTER_KEY_ae 0x0e6
-#define CLUTTER_KEY_ccedilla 0x0e7
-#define CLUTTER_KEY_egrave 0x0e8
-#define CLUTTER_KEY_eacute 0x0e9
-#define CLUTTER_KEY_ecircumflex 0x0ea
-#define CLUTTER_KEY_ediaeresis 0x0eb
-#define CLUTTER_KEY_igrave 0x0ec
-#define CLUTTER_KEY_iacute 0x0ed
-#define CLUTTER_KEY_icircumflex 0x0ee
-#define CLUTTER_KEY_idiaeresis 0x0ef
-#define CLUTTER_KEY_eth 0x0f0
-#define CLUTTER_KEY_ntilde 0x0f1
-#define CLUTTER_KEY_ograve 0x0f2
-#define CLUTTER_KEY_oacute 0x0f3
-#define CLUTTER_KEY_ocircumflex 0x0f4
-#define CLUTTER_KEY_otilde 0x0f5
-#define CLUTTER_KEY_odiaeresis 0x0f6
-#define CLUTTER_KEY_division 0x0f7
-#define CLUTTER_KEY_oslash 0x0f8
-#define CLUTTER_KEY_ooblique 0x0f8
-#define CLUTTER_KEY_ugrave 0x0f9
-#define CLUTTER_KEY_uacute 0x0fa
-#define CLUTTER_KEY_ucircumflex 0x0fb
-#define CLUTTER_KEY_udiaeresis 0x0fc
-#define CLUTTER_KEY_yacute 0x0fd
-#define CLUTTER_KEY_thorn 0x0fe
-#define CLUTTER_KEY_ydiaeresis 0x0ff
-#define CLUTTER_KEY_Aogonek 0x1a1
-#define CLUTTER_KEY_breve 0x1a2
-#define CLUTTER_KEY_Lstroke 0x1a3
-#define CLUTTER_KEY_Lcaron 0x1a5
-#define CLUTTER_KEY_Sacute 0x1a6
-#define CLUTTER_KEY_Scaron 0x1a9
-#define CLUTTER_KEY_Scedilla 0x1aa
-#define CLUTTER_KEY_Tcaron 0x1ab
-#define CLUTTER_KEY_Zacute 0x1ac
-#define CLUTTER_KEY_Zcaron 0x1ae
-#define CLUTTER_KEY_Zabovedot 0x1af
-#define CLUTTER_KEY_aogonek 0x1b1
-#define CLUTTER_KEY_ogonek 0x1b2
-#define CLUTTER_KEY_lstroke 0x1b3
-#define CLUTTER_KEY_lcaron 0x1b5
-#define CLUTTER_KEY_sacute 0x1b6
-#define CLUTTER_KEY_caron 0x1b7
-#define CLUTTER_KEY_scaron 0x1b9
-#define CLUTTER_KEY_scedilla 0x1ba
-#define CLUTTER_KEY_tcaron 0x1bb
-#define CLUTTER_KEY_zacute 0x1bc
-#define CLUTTER_KEY_doubleacute 0x1bd
-#define CLUTTER_KEY_zcaron 0x1be
-#define CLUTTER_KEY_zabovedot 0x1bf
-#define CLUTTER_KEY_Racute 0x1c0
-#define CLUTTER_KEY_Abreve 0x1c3
-#define CLUTTER_KEY_Lacute 0x1c5
-#define CLUTTER_KEY_Cacute 0x1c6
-#define CLUTTER_KEY_Ccaron 0x1c8
-#define CLUTTER_KEY_Eogonek 0x1ca
-#define CLUTTER_KEY_Ecaron 0x1cc
-#define CLUTTER_KEY_Dcaron 0x1cf
-#define CLUTTER_KEY_Dstroke 0x1d0
-#define CLUTTER_KEY_Nacute 0x1d1
-#define CLUTTER_KEY_Ncaron 0x1d2
-#define CLUTTER_KEY_Odoubleacute 0x1d5
-#define CLUTTER_KEY_Rcaron 0x1d8
-#define CLUTTER_KEY_Uring 0x1d9
-#define CLUTTER_KEY_Udoubleacute 0x1db
-#define CLUTTER_KEY_Tcedilla 0x1de
-#define CLUTTER_KEY_racute 0x1e0
-#define CLUTTER_KEY_abreve 0x1e3
-#define CLUTTER_KEY_lacute 0x1e5
-#define CLUTTER_KEY_cacute 0x1e6
-#define CLUTTER_KEY_ccaron 0x1e8
-#define CLUTTER_KEY_eogonek 0x1ea
-#define CLUTTER_KEY_ecaron 0x1ec
-#define CLUTTER_KEY_dcaron 0x1ef
-#define CLUTTER_KEY_dstroke 0x1f0
-#define CLUTTER_KEY_nacute 0x1f1
-#define CLUTTER_KEY_ncaron 0x1f2
-#define CLUTTER_KEY_odoubleacute 0x1f5
-#define CLUTTER_KEY_rcaron 0x1f8
-#define CLUTTER_KEY_uring 0x1f9
-#define CLUTTER_KEY_udoubleacute 0x1fb
-#define CLUTTER_KEY_tcedilla 0x1fe
-#define CLUTTER_KEY_abovedot 0x1ff
-#define CLUTTER_KEY_Hstroke 0x2a1
-#define CLUTTER_KEY_Hcircumflex 0x2a6
-#define CLUTTER_KEY_Iabovedot 0x2a9
-#define CLUTTER_KEY_Gbreve 0x2ab
-#define CLUTTER_KEY_Jcircumflex 0x2ac
-#define CLUTTER_KEY_hstroke 0x2b1
-#define CLUTTER_KEY_hcircumflex 0x2b6
-#define CLUTTER_KEY_idotless 0x2b9
-#define CLUTTER_KEY_gbreve 0x2bb
-#define CLUTTER_KEY_jcircumflex 0x2bc
-#define CLUTTER_KEY_Cabovedot 0x2c5
-#define CLUTTER_KEY_Ccircumflex 0x2c6
-#define CLUTTER_KEY_Gabovedot 0x2d5
-#define CLUTTER_KEY_Gcircumflex 0x2d8
-#define CLUTTER_KEY_Ubreve 0x2dd
-#define CLUTTER_KEY_Scircumflex 0x2de
-#define CLUTTER_KEY_cabovedot 0x2e5
-#define CLUTTER_KEY_ccircumflex 0x2e6
-#define CLUTTER_KEY_gabovedot 0x2f5
-#define CLUTTER_KEY_gcircumflex 0x2f8
-#define CLUTTER_KEY_ubreve 0x2fd
-#define CLUTTER_KEY_scircumflex 0x2fe
-#define CLUTTER_KEY_kra 0x3a2
-#define CLUTTER_KEY_kappa 0x3a2
-#define CLUTTER_KEY_Rcedilla 0x3a3
-#define CLUTTER_KEY_Itilde 0x3a5
-#define CLUTTER_KEY_Lcedilla 0x3a6
-#define CLUTTER_KEY_Emacron 0x3aa
-#define CLUTTER_KEY_Gcedilla 0x3ab
-#define CLUTTER_KEY_Tslash 0x3ac
-#define CLUTTER_KEY_rcedilla 0x3b3
-#define CLUTTER_KEY_itilde 0x3b5
-#define CLUTTER_KEY_lcedilla 0x3b6
-#define CLUTTER_KEY_emacron 0x3ba
-#define CLUTTER_KEY_gcedilla 0x3bb
-#define CLUTTER_KEY_tslash 0x3bc
-#define CLUTTER_KEY_ENG 0x3bd
-#define CLUTTER_KEY_eng 0x3bf
-#define CLUTTER_KEY_Amacron 0x3c0
-#define CLUTTER_KEY_Iogonek 0x3c7
-#define CLUTTER_KEY_Eabovedot 0x3cc
-#define CLUTTER_KEY_Imacron 0x3cf
-#define CLUTTER_KEY_Ncedilla 0x3d1
-#define CLUTTER_KEY_Omacron 0x3d2
-#define CLUTTER_KEY_Kcedilla 0x3d3
-#define CLUTTER_KEY_Uogonek 0x3d9
-#define CLUTTER_KEY_Utilde 0x3dd
-#define CLUTTER_KEY_Umacron 0x3de
-#define CLUTTER_KEY_amacron 0x3e0
-#define CLUTTER_KEY_iogonek 0x3e7
-#define CLUTTER_KEY_eabovedot 0x3ec
-#define CLUTTER_KEY_imacron 0x3ef
-#define CLUTTER_KEY_ncedilla 0x3f1
-#define CLUTTER_KEY_omacron 0x3f2
-#define CLUTTER_KEY_kcedilla 0x3f3
-#define CLUTTER_KEY_uogonek 0x3f9
-#define CLUTTER_KEY_utilde 0x3fd
-#define CLUTTER_KEY_umacron 0x3fe
-#define CLUTTER_KEY_Wcircumflex 0x1000174
-#define CLUTTER_KEY_wcircumflex 0x1000175
-#define CLUTTER_KEY_Ycircumflex 0x1000176
-#define CLUTTER_KEY_ycircumflex 0x1000177
-#define CLUTTER_KEY_Babovedot 0x1001e02
-#define CLUTTER_KEY_babovedot 0x1001e03
-#define CLUTTER_KEY_Dabovedot 0x1001e0a
-#define CLUTTER_KEY_dabovedot 0x1001e0b
-#define CLUTTER_KEY_Fabovedot 0x1001e1e
-#define CLUTTER_KEY_fabovedot 0x1001e1f
-#define CLUTTER_KEY_Mabovedot 0x1001e40
-#define CLUTTER_KEY_mabovedot 0x1001e41
-#define CLUTTER_KEY_Pabovedot 0x1001e56
-#define CLUTTER_KEY_pabovedot 0x1001e57
-#define CLUTTER_KEY_Sabovedot 0x1001e60
-#define CLUTTER_KEY_sabovedot 0x1001e61
-#define CLUTTER_KEY_Tabovedot 0x1001e6a
-#define CLUTTER_KEY_tabovedot 0x1001e6b
-#define CLUTTER_KEY_Wgrave 0x1001e80
-#define CLUTTER_KEY_wgrave 0x1001e81
-#define CLUTTER_KEY_Wacute 0x1001e82
-#define CLUTTER_KEY_wacute 0x1001e83
-#define CLUTTER_KEY_Wdiaeresis 0x1001e84
-#define CLUTTER_KEY_wdiaeresis 0x1001e85
-#define CLUTTER_KEY_Ygrave 0x1001ef2
-#define CLUTTER_KEY_ygrave 0x1001ef3
-#define CLUTTER_KEY_OE 0x13bc
-#define CLUTTER_KEY_oe 0x13bd
-#define CLUTTER_KEY_Ydiaeresis 0x13be
-#define CLUTTER_KEY_overline 0x47e
-#define CLUTTER_KEY_kana_fullstop 0x4a1
-#define CLUTTER_KEY_kana_openingbracket 0x4a2
-#define CLUTTER_KEY_kana_closingbracket 0x4a3
-#define CLUTTER_KEY_kana_comma 0x4a4
-#define CLUTTER_KEY_kana_conjunctive 0x4a5
-#define CLUTTER_KEY_kana_middledot 0x4a5
-#define CLUTTER_KEY_kana_WO 0x4a6
-#define CLUTTER_KEY_kana_a 0x4a7
-#define CLUTTER_KEY_kana_i 0x4a8
-#define CLUTTER_KEY_kana_u 0x4a9
-#define CLUTTER_KEY_kana_e 0x4aa
-#define CLUTTER_KEY_kana_o 0x4ab
-#define CLUTTER_KEY_kana_ya 0x4ac
-#define CLUTTER_KEY_kana_yu 0x4ad
-#define CLUTTER_KEY_kana_yo 0x4ae
-#define CLUTTER_KEY_kana_tsu 0x4af
-#define CLUTTER_KEY_kana_tu 0x4af
-#define CLUTTER_KEY_prolongedsound 0x4b0
-#define CLUTTER_KEY_kana_A 0x4b1
-#define CLUTTER_KEY_kana_I 0x4b2
-#define CLUTTER_KEY_kana_U 0x4b3
-#define CLUTTER_KEY_kana_E 0x4b4
-#define CLUTTER_KEY_kana_O 0x4b5
-#define CLUTTER_KEY_kana_KA 0x4b6
-#define CLUTTER_KEY_kana_KI 0x4b7
-#define CLUTTER_KEY_kana_KU 0x4b8
-#define CLUTTER_KEY_kana_KE 0x4b9
-#define CLUTTER_KEY_kana_KO 0x4ba
-#define CLUTTER_KEY_kana_SA 0x4bb
-#define CLUTTER_KEY_kana_SHI 0x4bc
-#define CLUTTER_KEY_kana_SU 0x4bd
-#define CLUTTER_KEY_kana_SE 0x4be
-#define CLUTTER_KEY_kana_SO 0x4bf
-#define CLUTTER_KEY_kana_TA 0x4c0
-#define CLUTTER_KEY_kana_CHI 0x4c1
-#define CLUTTER_KEY_kana_TI 0x4c1
-#define CLUTTER_KEY_kana_TSU 0x4c2
-#define CLUTTER_KEY_kana_TU 0x4c2
-#define CLUTTER_KEY_kana_TE 0x4c3
-#define CLUTTER_KEY_kana_TO 0x4c4
-#define CLUTTER_KEY_kana_NA 0x4c5
-#define CLUTTER_KEY_kana_NI 0x4c6
-#define CLUTTER_KEY_kana_NU 0x4c7
-#define CLUTTER_KEY_kana_NE 0x4c8
-#define CLUTTER_KEY_kana_NO 0x4c9
-#define CLUTTER_KEY_kana_HA 0x4ca
-#define CLUTTER_KEY_kana_HI 0x4cb
-#define CLUTTER_KEY_kana_FU 0x4cc
-#define CLUTTER_KEY_kana_HU 0x4cc
-#define CLUTTER_KEY_kana_HE 0x4cd
-#define CLUTTER_KEY_kana_HO 0x4ce
-#define CLUTTER_KEY_kana_MA 0x4cf
-#define CLUTTER_KEY_kana_MI 0x4d0
-#define CLUTTER_KEY_kana_MU 0x4d1
-#define CLUTTER_KEY_kana_ME 0x4d2
-#define CLUTTER_KEY_kana_MO 0x4d3
-#define CLUTTER_KEY_kana_YA 0x4d4
-#define CLUTTER_KEY_kana_YU 0x4d5
-#define CLUTTER_KEY_kana_YO 0x4d6
-#define CLUTTER_KEY_kana_RA 0x4d7
-#define CLUTTER_KEY_kana_RI 0x4d8
-#define CLUTTER_KEY_kana_RU 0x4d9
-#define CLUTTER_KEY_kana_RE 0x4da
-#define CLUTTER_KEY_kana_RO 0x4db
-#define CLUTTER_KEY_kana_WA 0x4dc
-#define CLUTTER_KEY_kana_N 0x4dd
-#define CLUTTER_KEY_voicedsound 0x4de
-#define CLUTTER_KEY_semivoicedsound 0x4df
-#define CLUTTER_KEY_kana_switch 0xff7e
-#define CLUTTER_KEY_Farsi_0 0x10006f0
-#define CLUTTER_KEY_Farsi_1 0x10006f1
-#define CLUTTER_KEY_Farsi_2 0x10006f2
-#define CLUTTER_KEY_Farsi_3 0x10006f3
-#define CLUTTER_KEY_Farsi_4 0x10006f4
-#define CLUTTER_KEY_Farsi_5 0x10006f5
-#define CLUTTER_KEY_Farsi_6 0x10006f6
-#define CLUTTER_KEY_Farsi_7 0x10006f7
-#define CLUTTER_KEY_Farsi_8 0x10006f8
-#define CLUTTER_KEY_Farsi_9 0x10006f9
-#define CLUTTER_KEY_Arabic_percent 0x100066a
-#define CLUTTER_KEY_Arabic_superscript_alef 0x1000670
-#define CLUTTER_KEY_Arabic_tteh 0x1000679
-#define CLUTTER_KEY_Arabic_peh 0x100067e
-#define CLUTTER_KEY_Arabic_tcheh 0x1000686
-#define CLUTTER_KEY_Arabic_ddal 0x1000688
-#define CLUTTER_KEY_Arabic_rreh 0x1000691
-#define CLUTTER_KEY_Arabic_comma 0x5ac
-#define CLUTTER_KEY_Arabic_fullstop 0x10006d4
-#define CLUTTER_KEY_Arabic_0 0x1000660
-#define CLUTTER_KEY_Arabic_1 0x1000661
-#define CLUTTER_KEY_Arabic_2 0x1000662
-#define CLUTTER_KEY_Arabic_3 0x1000663
-#define CLUTTER_KEY_Arabic_4 0x1000664
-#define CLUTTER_KEY_Arabic_5 0x1000665
-#define CLUTTER_KEY_Arabic_6 0x1000666
-#define CLUTTER_KEY_Arabic_7 0x1000667
-#define CLUTTER_KEY_Arabic_8 0x1000668
-#define CLUTTER_KEY_Arabic_9 0x1000669
-#define CLUTTER_KEY_Arabic_semicolon 0x5bb
-#define CLUTTER_KEY_Arabic_question_mark 0x5bf
-#define CLUTTER_KEY_Arabic_hamza 0x5c1
-#define CLUTTER_KEY_Arabic_maddaonalef 0x5c2
-#define CLUTTER_KEY_Arabic_hamzaonalef 0x5c3
-#define CLUTTER_KEY_Arabic_hamzaonwaw 0x5c4
-#define CLUTTER_KEY_Arabic_hamzaunderalef 0x5c5
-#define CLUTTER_KEY_Arabic_hamzaonyeh 0x5c6
-#define CLUTTER_KEY_Arabic_alef 0x5c7
-#define CLUTTER_KEY_Arabic_beh 0x5c8
-#define CLUTTER_KEY_Arabic_tehmarbuta 0x5c9
-#define CLUTTER_KEY_Arabic_teh 0x5ca
-#define CLUTTER_KEY_Arabic_theh 0x5cb
-#define CLUTTER_KEY_Arabic_jeem 0x5cc
-#define CLUTTER_KEY_Arabic_hah 0x5cd
-#define CLUTTER_KEY_Arabic_khah 0x5ce
-#define CLUTTER_KEY_Arabic_dal 0x5cf
-#define CLUTTER_KEY_Arabic_thal 0x5d0
-#define CLUTTER_KEY_Arabic_ra 0x5d1
-#define CLUTTER_KEY_Arabic_zain 0x5d2
-#define CLUTTER_KEY_Arabic_seen 0x5d3
-#define CLUTTER_KEY_Arabic_sheen 0x5d4
-#define CLUTTER_KEY_Arabic_sad 0x5d5
-#define CLUTTER_KEY_Arabic_dad 0x5d6
-#define CLUTTER_KEY_Arabic_tah 0x5d7
-#define CLUTTER_KEY_Arabic_zah 0x5d8
-#define CLUTTER_KEY_Arabic_ain 0x5d9
-#define CLUTTER_KEY_Arabic_ghain 0x5da
-#define CLUTTER_KEY_Arabic_tatweel 0x5e0
-#define CLUTTER_KEY_Arabic_feh 0x5e1
-#define CLUTTER_KEY_Arabic_qaf 0x5e2
-#define CLUTTER_KEY_Arabic_kaf 0x5e3
-#define CLUTTER_KEY_Arabic_lam 0x5e4
-#define CLUTTER_KEY_Arabic_meem 0x5e5
-#define CLUTTER_KEY_Arabic_noon 0x5e6
-#define CLUTTER_KEY_Arabic_ha 0x5e7
-#define CLUTTER_KEY_Arabic_heh 0x5e7
-#define CLUTTER_KEY_Arabic_waw 0x5e8
-#define CLUTTER_KEY_Arabic_alefmaksura 0x5e9
-#define CLUTTER_KEY_Arabic_yeh 0x5ea
-#define CLUTTER_KEY_Arabic_fathatan 0x5eb
-#define CLUTTER_KEY_Arabic_dammatan 0x5ec
-#define CLUTTER_KEY_Arabic_kasratan 0x5ed
-#define CLUTTER_KEY_Arabic_fatha 0x5ee
-#define CLUTTER_KEY_Arabic_damma 0x5ef
-#define CLUTTER_KEY_Arabic_kasra 0x5f0
-#define CLUTTER_KEY_Arabic_shadda 0x5f1
-#define CLUTTER_KEY_Arabic_sukun 0x5f2
-#define CLUTTER_KEY_Arabic_madda_above 0x1000653
-#define CLUTTER_KEY_Arabic_hamza_above 0x1000654
-#define CLUTTER_KEY_Arabic_hamza_below 0x1000655
-#define CLUTTER_KEY_Arabic_jeh 0x1000698
-#define CLUTTER_KEY_Arabic_veh 0x10006a4
-#define CLUTTER_KEY_Arabic_keheh 0x10006a9
-#define CLUTTER_KEY_Arabic_gaf 0x10006af
-#define CLUTTER_KEY_Arabic_noon_ghunna 0x10006ba
-#define CLUTTER_KEY_Arabic_heh_doachashmee 0x10006be
-#define CLUTTER_KEY_Farsi_yeh 0x10006cc
-#define CLUTTER_KEY_Arabic_farsi_yeh 0x10006cc
-#define CLUTTER_KEY_Arabic_yeh_baree 0x10006d2
-#define CLUTTER_KEY_Arabic_heh_goal 0x10006c1
-#define CLUTTER_KEY_Arabic_switch 0xff7e
-#define CLUTTER_KEY_Cyrillic_GHE_bar 0x1000492
-#define CLUTTER_KEY_Cyrillic_ghe_bar 0x1000493
-#define CLUTTER_KEY_Cyrillic_ZHE_descender 0x1000496
-#define CLUTTER_KEY_Cyrillic_zhe_descender 0x1000497
-#define CLUTTER_KEY_Cyrillic_KA_descender 0x100049a
-#define CLUTTER_KEY_Cyrillic_ka_descender 0x100049b
-#define CLUTTER_KEY_Cyrillic_KA_vertstroke 0x100049c
-#define CLUTTER_KEY_Cyrillic_ka_vertstroke 0x100049d
-#define CLUTTER_KEY_Cyrillic_EN_descender 0x10004a2
-#define CLUTTER_KEY_Cyrillic_en_descender 0x10004a3
-#define CLUTTER_KEY_Cyrillic_U_straight 0x10004ae
-#define CLUTTER_KEY_Cyrillic_u_straight 0x10004af
-#define CLUTTER_KEY_Cyrillic_U_straight_bar 0x10004b0
-#define CLUTTER_KEY_Cyrillic_u_straight_bar 0x10004b1
-#define CLUTTER_KEY_Cyrillic_HA_descender 0x10004b2
-#define CLUTTER_KEY_Cyrillic_ha_descender 0x10004b3
-#define CLUTTER_KEY_Cyrillic_CHE_descender 0x10004b6
-#define CLUTTER_KEY_Cyrillic_che_descender 0x10004b7
-#define CLUTTER_KEY_Cyrillic_CHE_vertstroke 0x10004b8
-#define CLUTTER_KEY_Cyrillic_che_vertstroke 0x10004b9
-#define CLUTTER_KEY_Cyrillic_SHHA 0x10004ba
-#define CLUTTER_KEY_Cyrillic_shha 0x10004bb
-#define CLUTTER_KEY_Cyrillic_SCHWA 0x10004d8
-#define CLUTTER_KEY_Cyrillic_schwa 0x10004d9
-#define CLUTTER_KEY_Cyrillic_I_macron 0x10004e2
-#define CLUTTER_KEY_Cyrillic_i_macron 0x10004e3
-#define CLUTTER_KEY_Cyrillic_O_bar 0x10004e8
-#define CLUTTER_KEY_Cyrillic_o_bar 0x10004e9
-#define CLUTTER_KEY_Cyrillic_U_macron 0x10004ee
-#define CLUTTER_KEY_Cyrillic_u_macron 0x10004ef
-#define CLUTTER_KEY_Serbian_dje 0x6a1
-#define CLUTTER_KEY_Macedonia_gje 0x6a2
-#define CLUTTER_KEY_Cyrillic_io 0x6a3
-#define CLUTTER_KEY_Ukrainian_ie 0x6a4
-#define CLUTTER_KEY_Ukranian_je 0x6a4
-#define CLUTTER_KEY_Macedonia_dse 0x6a5
-#define CLUTTER_KEY_Ukrainian_i 0x6a6
-#define CLUTTER_KEY_Ukranian_i 0x6a6
-#define CLUTTER_KEY_Ukrainian_yi 0x6a7
-#define CLUTTER_KEY_Ukranian_yi 0x6a7
-#define CLUTTER_KEY_Cyrillic_je 0x6a8
-#define CLUTTER_KEY_Serbian_je 0x6a8
-#define CLUTTER_KEY_Cyrillic_lje 0x6a9
-#define CLUTTER_KEY_Serbian_lje 0x6a9
-#define CLUTTER_KEY_Cyrillic_nje 0x6aa
-#define CLUTTER_KEY_Serbian_nje 0x6aa
-#define CLUTTER_KEY_Serbian_tshe 0x6ab
-#define CLUTTER_KEY_Macedonia_kje 0x6ac
-#define CLUTTER_KEY_Ukrainian_ghe_with_upturn 0x6ad
-#define CLUTTER_KEY_Byelorussian_shortu 0x6ae
-#define CLUTTER_KEY_Cyrillic_dzhe 0x6af
-#define CLUTTER_KEY_Serbian_dze 0x6af
-#define CLUTTER_KEY_numerosign 0x6b0
-#define CLUTTER_KEY_Serbian_DJE 0x6b1
-#define CLUTTER_KEY_Macedonia_GJE 0x6b2
-#define CLUTTER_KEY_Cyrillic_IO 0x6b3
-#define CLUTTER_KEY_Ukrainian_IE 0x6b4
-#define CLUTTER_KEY_Ukranian_JE 0x6b4
-#define CLUTTER_KEY_Macedonia_DSE 0x6b5
-#define CLUTTER_KEY_Ukrainian_I 0x6b6
-#define CLUTTER_KEY_Ukranian_I 0x6b6
-#define CLUTTER_KEY_Ukrainian_YI 0x6b7
-#define CLUTTER_KEY_Ukranian_YI 0x6b7
-#define CLUTTER_KEY_Cyrillic_JE 0x6b8
-#define CLUTTER_KEY_Serbian_JE 0x6b8
-#define CLUTTER_KEY_Cyrillic_LJE 0x6b9
-#define CLUTTER_KEY_Serbian_LJE 0x6b9
-#define CLUTTER_KEY_Cyrillic_NJE 0x6ba
-#define CLUTTER_KEY_Serbian_NJE 0x6ba
-#define CLUTTER_KEY_Serbian_TSHE 0x6bb
-#define CLUTTER_KEY_Macedonia_KJE 0x6bc
-#define CLUTTER_KEY_Ukrainian_GHE_WITH_UPTURN 0x6bd
-#define CLUTTER_KEY_Byelorussian_SHORTU 0x6be
-#define CLUTTER_KEY_Cyrillic_DZHE 0x6bf
-#define CLUTTER_KEY_Serbian_DZE 0x6bf
-#define CLUTTER_KEY_Cyrillic_yu 0x6c0
-#define CLUTTER_KEY_Cyrillic_a 0x6c1
-#define CLUTTER_KEY_Cyrillic_be 0x6c2
-#define CLUTTER_KEY_Cyrillic_tse 0x6c3
-#define CLUTTER_KEY_Cyrillic_de 0x6c4
-#define CLUTTER_KEY_Cyrillic_ie 0x6c5
-#define CLUTTER_KEY_Cyrillic_ef 0x6c6
-#define CLUTTER_KEY_Cyrillic_ghe 0x6c7
-#define CLUTTER_KEY_Cyrillic_ha 0x6c8
-#define CLUTTER_KEY_Cyrillic_i 0x6c9
-#define CLUTTER_KEY_Cyrillic_shorti 0x6ca
-#define CLUTTER_KEY_Cyrillic_ka 0x6cb
-#define CLUTTER_KEY_Cyrillic_el 0x6cc
-#define CLUTTER_KEY_Cyrillic_em 0x6cd
-#define CLUTTER_KEY_Cyrillic_en 0x6ce
-#define CLUTTER_KEY_Cyrillic_o 0x6cf
-#define CLUTTER_KEY_Cyrillic_pe 0x6d0
-#define CLUTTER_KEY_Cyrillic_ya 0x6d1
-#define CLUTTER_KEY_Cyrillic_er 0x6d2
-#define CLUTTER_KEY_Cyrillic_es 0x6d3
-#define CLUTTER_KEY_Cyrillic_te 0x6d4
-#define CLUTTER_KEY_Cyrillic_u 0x6d5
-#define CLUTTER_KEY_Cyrillic_zhe 0x6d6
-#define CLUTTER_KEY_Cyrillic_ve 0x6d7
-#define CLUTTER_KEY_Cyrillic_softsign 0x6d8
-#define CLUTTER_KEY_Cyrillic_yeru 0x6d9
-#define CLUTTER_KEY_Cyrillic_ze 0x6da
-#define CLUTTER_KEY_Cyrillic_sha 0x6db
-#define CLUTTER_KEY_Cyrillic_e 0x6dc
-#define CLUTTER_KEY_Cyrillic_shcha 0x6dd
-#define CLUTTER_KEY_Cyrillic_che 0x6de
-#define CLUTTER_KEY_Cyrillic_hardsign 0x6df
-#define CLUTTER_KEY_Cyrillic_YU 0x6e0
-#define CLUTTER_KEY_Cyrillic_A 0x6e1
-#define CLUTTER_KEY_Cyrillic_BE 0x6e2
-#define CLUTTER_KEY_Cyrillic_TSE 0x6e3
-#define CLUTTER_KEY_Cyrillic_DE 0x6e4
-#define CLUTTER_KEY_Cyrillic_IE 0x6e5
-#define CLUTTER_KEY_Cyrillic_EF 0x6e6
-#define CLUTTER_KEY_Cyrillic_GHE 0x6e7
-#define CLUTTER_KEY_Cyrillic_HA 0x6e8
-#define CLUTTER_KEY_Cyrillic_I 0x6e9
-#define CLUTTER_KEY_Cyrillic_SHORTI 0x6ea
-#define CLUTTER_KEY_Cyrillic_KA 0x6eb
-#define CLUTTER_KEY_Cyrillic_EL 0x6ec
-#define CLUTTER_KEY_Cyrillic_EM 0x6ed
-#define CLUTTER_KEY_Cyrillic_EN 0x6ee
-#define CLUTTER_KEY_Cyrillic_O 0x6ef
-#define CLUTTER_KEY_Cyrillic_PE 0x6f0
-#define CLUTTER_KEY_Cyrillic_YA 0x6f1
-#define CLUTTER_KEY_Cyrillic_ER 0x6f2
-#define CLUTTER_KEY_Cyrillic_ES 0x6f3
-#define CLUTTER_KEY_Cyrillic_TE 0x6f4
-#define CLUTTER_KEY_Cyrillic_U 0x6f5
-#define CLUTTER_KEY_Cyrillic_ZHE 0x6f6
-#define CLUTTER_KEY_Cyrillic_VE 0x6f7
-#define CLUTTER_KEY_Cyrillic_SOFTSIGN 0x6f8
-#define CLUTTER_KEY_Cyrillic_YERU 0x6f9
-#define CLUTTER_KEY_Cyrillic_ZE 0x6fa
-#define CLUTTER_KEY_Cyrillic_SHA 0x6fb
-#define CLUTTER_KEY_Cyrillic_E 0x6fc
-#define CLUTTER_KEY_Cyrillic_SHCHA 0x6fd
-#define CLUTTER_KEY_Cyrillic_CHE 0x6fe
-#define CLUTTER_KEY_Cyrillic_HARDSIGN 0x6ff
-#define CLUTTER_KEY_Greek_ALPHAaccent 0x7a1
-#define CLUTTER_KEY_Greek_EPSILONaccent 0x7a2
-#define CLUTTER_KEY_Greek_ETAaccent 0x7a3
-#define CLUTTER_KEY_Greek_IOTAaccent 0x7a4
-#define CLUTTER_KEY_Greek_IOTAdieresis 0x7a5
-#define CLUTTER_KEY_Greek_IOTAdiaeresis 0x7a5
-#define CLUTTER_KEY_Greek_OMICRONaccent 0x7a7
-#define CLUTTER_KEY_Greek_UPSILONaccent 0x7a8
-#define CLUTTER_KEY_Greek_UPSILONdieresis 0x7a9
-#define CLUTTER_KEY_Greek_OMEGAaccent 0x7ab
-#define CLUTTER_KEY_Greek_accentdieresis 0x7ae
-#define CLUTTER_KEY_Greek_horizbar 0x7af
-#define CLUTTER_KEY_Greek_alphaaccent 0x7b1
-#define CLUTTER_KEY_Greek_epsilonaccent 0x7b2
-#define CLUTTER_KEY_Greek_etaaccent 0x7b3
-#define CLUTTER_KEY_Greek_iotaaccent 0x7b4
-#define CLUTTER_KEY_Greek_iotadieresis 0x7b5
-#define CLUTTER_KEY_Greek_iotaaccentdieresis 0x7b6
-#define CLUTTER_KEY_Greek_omicronaccent 0x7b7
-#define CLUTTER_KEY_Greek_upsilonaccent 0x7b8
-#define CLUTTER_KEY_Greek_upsilondieresis 0x7b9
-#define CLUTTER_KEY_Greek_upsilonaccentdieresis 0x7ba
-#define CLUTTER_KEY_Greek_omegaaccent 0x7bb
-#define CLUTTER_KEY_Greek_ALPHA 0x7c1
-#define CLUTTER_KEY_Greek_BETA 0x7c2
-#define CLUTTER_KEY_Greek_GAMMA 0x7c3
-#define CLUTTER_KEY_Greek_DELTA 0x7c4
-#define CLUTTER_KEY_Greek_EPSILON 0x7c5
-#define CLUTTER_KEY_Greek_ZETA 0x7c6
-#define CLUTTER_KEY_Greek_ETA 0x7c7
-#define CLUTTER_KEY_Greek_THETA 0x7c8
-#define CLUTTER_KEY_Greek_IOTA 0x7c9
-#define CLUTTER_KEY_Greek_KAPPA 0x7ca
-#define CLUTTER_KEY_Greek_LAMDA 0x7cb
-#define CLUTTER_KEY_Greek_LAMBDA 0x7cb
-#define CLUTTER_KEY_Greek_MU 0x7cc
-#define CLUTTER_KEY_Greek_NU 0x7cd
-#define CLUTTER_KEY_Greek_XI 0x7ce
-#define CLUTTER_KEY_Greek_OMICRON 0x7cf
-#define CLUTTER_KEY_Greek_PI 0x7d0
-#define CLUTTER_KEY_Greek_RHO 0x7d1
-#define CLUTTER_KEY_Greek_SIGMA 0x7d2
-#define CLUTTER_KEY_Greek_TAU 0x7d4
-#define CLUTTER_KEY_Greek_UPSILON 0x7d5
-#define CLUTTER_KEY_Greek_PHI 0x7d6
-#define CLUTTER_KEY_Greek_CHI 0x7d7
-#define CLUTTER_KEY_Greek_PSI 0x7d8
-#define CLUTTER_KEY_Greek_OMEGA 0x7d9
-#define CLUTTER_KEY_Greek_alpha 0x7e1
-#define CLUTTER_KEY_Greek_beta 0x7e2
-#define CLUTTER_KEY_Greek_gamma 0x7e3
-#define CLUTTER_KEY_Greek_delta 0x7e4
-#define CLUTTER_KEY_Greek_epsilon 0x7e5
-#define CLUTTER_KEY_Greek_zeta 0x7e6
-#define CLUTTER_KEY_Greek_eta 0x7e7
-#define CLUTTER_KEY_Greek_theta 0x7e8
-#define CLUTTER_KEY_Greek_iota 0x7e9
-#define CLUTTER_KEY_Greek_kappa 0x7ea
-#define CLUTTER_KEY_Greek_lamda 0x7eb
-#define CLUTTER_KEY_Greek_lambda 0x7eb
-#define CLUTTER_KEY_Greek_mu 0x7ec
-#define CLUTTER_KEY_Greek_nu 0x7ed
-#define CLUTTER_KEY_Greek_xi 0x7ee
-#define CLUTTER_KEY_Greek_omicron 0x7ef
-#define CLUTTER_KEY_Greek_pi 0x7f0
-#define CLUTTER_KEY_Greek_rho 0x7f1
-#define CLUTTER_KEY_Greek_sigma 0x7f2
-#define CLUTTER_KEY_Greek_finalsmallsigma 0x7f3
-#define CLUTTER_KEY_Greek_tau 0x7f4
-#define CLUTTER_KEY_Greek_upsilon 0x7f5
-#define CLUTTER_KEY_Greek_phi 0x7f6
-#define CLUTTER_KEY_Greek_chi 0x7f7
-#define CLUTTER_KEY_Greek_psi 0x7f8
-#define CLUTTER_KEY_Greek_omega 0x7f9
-#define CLUTTER_KEY_Greek_switch 0xff7e
-#define CLUTTER_KEY_leftradical 0x8a1
-#define CLUTTER_KEY_topleftradical 0x8a2
-#define CLUTTER_KEY_horizconnector 0x8a3
-#define CLUTTER_KEY_topintegral 0x8a4
-#define CLUTTER_KEY_botintegral 0x8a5
-#define CLUTTER_KEY_vertconnector 0x8a6
-#define CLUTTER_KEY_topleftsqbracket 0x8a7
-#define CLUTTER_KEY_botleftsqbracket 0x8a8
-#define CLUTTER_KEY_toprightsqbracket 0x8a9
-#define CLUTTER_KEY_botrightsqbracket 0x8aa
-#define CLUTTER_KEY_topleftparens 0x8ab
-#define CLUTTER_KEY_botleftparens 0x8ac
-#define CLUTTER_KEY_toprightparens 0x8ad
-#define CLUTTER_KEY_botrightparens 0x8ae
-#define CLUTTER_KEY_leftmiddlecurlybrace 0x8af
-#define CLUTTER_KEY_rightmiddlecurlybrace 0x8b0
-#define CLUTTER_KEY_topleftsummation 0x8b1
-#define CLUTTER_KEY_botleftsummation 0x8b2
-#define CLUTTER_KEY_topvertsummationconnector 0x8b3
-#define CLUTTER_KEY_botvertsummationconnector 0x8b4
-#define CLUTTER_KEY_toprightsummation 0x8b5
-#define CLUTTER_KEY_botrightsummation 0x8b6
-#define CLUTTER_KEY_rightmiddlesummation 0x8b7
-#define CLUTTER_KEY_lessthanequal 0x8bc
-#define CLUTTER_KEY_notequal 0x8bd
-#define CLUTTER_KEY_greaterthanequal 0x8be
-#define CLUTTER_KEY_integral 0x8bf
-#define CLUTTER_KEY_therefore 0x8c0
-#define CLUTTER_KEY_variation 0x8c1
-#define CLUTTER_KEY_infinity 0x8c2
-#define CLUTTER_KEY_nabla 0x8c5
-#define CLUTTER_KEY_approximate 0x8c8
-#define CLUTTER_KEY_similarequal 0x8c9
-#define CLUTTER_KEY_ifonlyif 0x8cd
-#define CLUTTER_KEY_implies 0x8ce
-#define CLUTTER_KEY_identical 0x8cf
-#define CLUTTER_KEY_radical 0x8d6
-#define CLUTTER_KEY_includedin 0x8da
-#define CLUTTER_KEY_includes 0x8db
-#define CLUTTER_KEY_intersection 0x8dc
-#define CLUTTER_KEY_union 0x8dd
-#define CLUTTER_KEY_logicaland 0x8de
-#define CLUTTER_KEY_logicalor 0x8df
-#define CLUTTER_KEY_partialderivative 0x8ef
-#define CLUTTER_KEY_function 0x8f6
-#define CLUTTER_KEY_leftarrow 0x8fb
-#define CLUTTER_KEY_uparrow 0x8fc
-#define CLUTTER_KEY_rightarrow 0x8fd
-#define CLUTTER_KEY_downarrow 0x8fe
-#define CLUTTER_KEY_blank 0x9df
-#define CLUTTER_KEY_soliddiamond 0x9e0
-#define CLUTTER_KEY_checkerboard 0x9e1
-#define CLUTTER_KEY_ht 0x9e2
-#define CLUTTER_KEY_ff 0x9e3
-#define CLUTTER_KEY_cr 0x9e4
-#define CLUTTER_KEY_lf 0x9e5
-#define CLUTTER_KEY_nl 0x9e8
-#define CLUTTER_KEY_vt 0x9e9
-#define CLUTTER_KEY_lowrightcorner 0x9ea
-#define CLUTTER_KEY_uprightcorner 0x9eb
-#define CLUTTER_KEY_upleftcorner 0x9ec
-#define CLUTTER_KEY_lowleftcorner 0x9ed
-#define CLUTTER_KEY_crossinglines 0x9ee
-#define CLUTTER_KEY_horizlinescan1 0x9ef
-#define CLUTTER_KEY_horizlinescan3 0x9f0
-#define CLUTTER_KEY_horizlinescan5 0x9f1
-#define CLUTTER_KEY_horizlinescan7 0x9f2
-#define CLUTTER_KEY_horizlinescan9 0x9f3
-#define CLUTTER_KEY_leftt 0x9f4
-#define CLUTTER_KEY_rightt 0x9f5
-#define CLUTTER_KEY_bott 0x9f6
-#define CLUTTER_KEY_topt 0x9f7
-#define CLUTTER_KEY_vertbar 0x9f8
-#define CLUTTER_KEY_emspace 0xaa1
-#define CLUTTER_KEY_enspace 0xaa2
-#define CLUTTER_KEY_em3space 0xaa3
-#define CLUTTER_KEY_em4space 0xaa4
-#define CLUTTER_KEY_digitspace 0xaa5
-#define CLUTTER_KEY_punctspace 0xaa6
-#define CLUTTER_KEY_thinspace 0xaa7
-#define CLUTTER_KEY_hairspace 0xaa8
-#define CLUTTER_KEY_emdash 0xaa9
-#define CLUTTER_KEY_endash 0xaaa
-#define CLUTTER_KEY_signifblank 0xaac
-#define CLUTTER_KEY_ellipsis 0xaae
-#define CLUTTER_KEY_doubbaselinedot 0xaaf
-#define CLUTTER_KEY_onethird 0xab0
-#define CLUTTER_KEY_twothirds 0xab1
-#define CLUTTER_KEY_onefifth 0xab2
-#define CLUTTER_KEY_twofifths 0xab3
-#define CLUTTER_KEY_threefifths 0xab4
-#define CLUTTER_KEY_fourfifths 0xab5
-#define CLUTTER_KEY_onesixth 0xab6
-#define CLUTTER_KEY_fivesixths 0xab7
-#define CLUTTER_KEY_careof 0xab8
-#define CLUTTER_KEY_figdash 0xabb
-#define CLUTTER_KEY_leftanglebracket 0xabc
-#define CLUTTER_KEY_decimalpoint 0xabd
-#define CLUTTER_KEY_rightanglebracket 0xabe
-#define CLUTTER_KEY_marker 0xabf
-#define CLUTTER_KEY_oneeighth 0xac3
-#define CLUTTER_KEY_threeeighths 0xac4
-#define CLUTTER_KEY_fiveeighths 0xac5
-#define CLUTTER_KEY_seveneighths 0xac6
-#define CLUTTER_KEY_trademark 0xac9
-#define CLUTTER_KEY_signaturemark 0xaca
-#define CLUTTER_KEY_trademarkincircle 0xacb
-#define CLUTTER_KEY_leftopentriangle 0xacc
-#define CLUTTER_KEY_rightopentriangle 0xacd
-#define CLUTTER_KEY_emopencircle 0xace
-#define CLUTTER_KEY_emopenrectangle 0xacf
-#define CLUTTER_KEY_leftsinglequotemark 0xad0
-#define CLUTTER_KEY_rightsinglequotemark 0xad1
-#define CLUTTER_KEY_leftdoublequotemark 0xad2
-#define CLUTTER_KEY_rightdoublequotemark 0xad3
-#define CLUTTER_KEY_prescription 0xad4
-#define CLUTTER_KEY_permille 0xad5
-#define CLUTTER_KEY_minutes 0xad6
-#define CLUTTER_KEY_seconds 0xad7
-#define CLUTTER_KEY_latincross 0xad9
-#define CLUTTER_KEY_hexagram 0xada
-#define CLUTTER_KEY_filledrectbullet 0xadb
-#define CLUTTER_KEY_filledlefttribullet 0xadc
-#define CLUTTER_KEY_filledrighttribullet 0xadd
-#define CLUTTER_KEY_emfilledcircle 0xade
-#define CLUTTER_KEY_emfilledrect 0xadf
-#define CLUTTER_KEY_enopencircbullet 0xae0
-#define CLUTTER_KEY_enopensquarebullet 0xae1
-#define CLUTTER_KEY_openrectbullet 0xae2
-#define CLUTTER_KEY_opentribulletup 0xae3
-#define CLUTTER_KEY_opentribulletdown 0xae4
-#define CLUTTER_KEY_openstar 0xae5
-#define CLUTTER_KEY_enfilledcircbullet 0xae6
-#define CLUTTER_KEY_enfilledsqbullet 0xae7
-#define CLUTTER_KEY_filledtribulletup 0xae8
-#define CLUTTER_KEY_filledtribulletdown 0xae9
-#define CLUTTER_KEY_leftpointer 0xaea
-#define CLUTTER_KEY_rightpointer 0xaeb
-#define CLUTTER_KEY_club 0xaec
-#define CLUTTER_KEY_diamond 0xaed
-#define CLUTTER_KEY_heart 0xaee
-#define CLUTTER_KEY_maltesecross 0xaf0
-#define CLUTTER_KEY_dagger 0xaf1
-#define CLUTTER_KEY_doubledagger 0xaf2
-#define CLUTTER_KEY_checkmark 0xaf3
-#define CLUTTER_KEY_ballotcross 0xaf4
-#define CLUTTER_KEY_musicalsharp 0xaf5
-#define CLUTTER_KEY_musicalflat 0xaf6
-#define CLUTTER_KEY_malesymbol 0xaf7
-#define CLUTTER_KEY_femalesymbol 0xaf8
-#define CLUTTER_KEY_telephone 0xaf9
-#define CLUTTER_KEY_telephonerecorder 0xafa
-#define CLUTTER_KEY_phonographcopyright 0xafb
-#define CLUTTER_KEY_caret 0xafc
-#define CLUTTER_KEY_singlelowquotemark 0xafd
-#define CLUTTER_KEY_doublelowquotemark 0xafe
-#define CLUTTER_KEY_cursor 0xaff
-#define CLUTTER_KEY_leftcaret 0xba3
-#define CLUTTER_KEY_rightcaret 0xba6
-#define CLUTTER_KEY_downcaret 0xba8
-#define CLUTTER_KEY_upcaret 0xba9
-#define CLUTTER_KEY_overbar 0xbc0
-#define CLUTTER_KEY_downtack 0xbc2
-#define CLUTTER_KEY_upshoe 0xbc3
-#define CLUTTER_KEY_downstile 0xbc4
-#define CLUTTER_KEY_underbar 0xbc6
-#define CLUTTER_KEY_jot 0xbca
-#define CLUTTER_KEY_quad 0xbcc
-#define CLUTTER_KEY_uptack 0xbce
-#define CLUTTER_KEY_circle 0xbcf
-#define CLUTTER_KEY_upstile 0xbd3
-#define CLUTTER_KEY_downshoe 0xbd6
-#define CLUTTER_KEY_rightshoe 0xbd8
-#define CLUTTER_KEY_leftshoe 0xbda
-#define CLUTTER_KEY_lefttack 0xbdc
-#define CLUTTER_KEY_righttack 0xbfc
-#define CLUTTER_KEY_hebrew_doublelowline 0xcdf
-#define CLUTTER_KEY_hebrew_aleph 0xce0
-#define CLUTTER_KEY_hebrew_bet 0xce1
-#define CLUTTER_KEY_hebrew_beth 0xce1
-#define CLUTTER_KEY_hebrew_gimel 0xce2
-#define CLUTTER_KEY_hebrew_gimmel 0xce2
-#define CLUTTER_KEY_hebrew_dalet 0xce3
-#define CLUTTER_KEY_hebrew_daleth 0xce3
-#define CLUTTER_KEY_hebrew_he 0xce4
-#define CLUTTER_KEY_hebrew_waw 0xce5
-#define CLUTTER_KEY_hebrew_zain 0xce6
-#define CLUTTER_KEY_hebrew_zayin 0xce6
-#define CLUTTER_KEY_hebrew_chet 0xce7
-#define CLUTTER_KEY_hebrew_het 0xce7
-#define CLUTTER_KEY_hebrew_tet 0xce8
-#define CLUTTER_KEY_hebrew_teth 0xce8
-#define CLUTTER_KEY_hebrew_yod 0xce9
-#define CLUTTER_KEY_hebrew_finalkaph 0xcea
-#define CLUTTER_KEY_hebrew_kaph 0xceb
-#define CLUTTER_KEY_hebrew_lamed 0xcec
-#define CLUTTER_KEY_hebrew_finalmem 0xced
-#define CLUTTER_KEY_hebrew_mem 0xcee
-#define CLUTTER_KEY_hebrew_finalnun 0xcef
-#define CLUTTER_KEY_hebrew_nun 0xcf0
-#define CLUTTER_KEY_hebrew_samech 0xcf1
-#define CLUTTER_KEY_hebrew_samekh 0xcf1
-#define CLUTTER_KEY_hebrew_ayin 0xcf2
-#define CLUTTER_KEY_hebrew_finalpe 0xcf3
-#define CLUTTER_KEY_hebrew_pe 0xcf4
-#define CLUTTER_KEY_hebrew_finalzade 0xcf5
-#define CLUTTER_KEY_hebrew_finalzadi 0xcf5
-#define CLUTTER_KEY_hebrew_zade 0xcf6
-#define CLUTTER_KEY_hebrew_zadi 0xcf6
-#define CLUTTER_KEY_hebrew_qoph 0xcf7
-#define CLUTTER_KEY_hebrew_kuf 0xcf7
-#define CLUTTER_KEY_hebrew_resh 0xcf8
-#define CLUTTER_KEY_hebrew_shin 0xcf9
-#define CLUTTER_KEY_hebrew_taw 0xcfa
-#define CLUTTER_KEY_hebrew_taf 0xcfa
-#define CLUTTER_KEY_Hebrew_switch 0xff7e
-#define CLUTTER_KEY_Thai_kokai 0xda1
-#define CLUTTER_KEY_Thai_khokhai 0xda2
-#define CLUTTER_KEY_Thai_khokhuat 0xda3
-#define CLUTTER_KEY_Thai_khokhwai 0xda4
-#define CLUTTER_KEY_Thai_khokhon 0xda5
-#define CLUTTER_KEY_Thai_khorakhang 0xda6
-#define CLUTTER_KEY_Thai_ngongu 0xda7
-#define CLUTTER_KEY_Thai_chochan 0xda8
-#define CLUTTER_KEY_Thai_choching 0xda9
-#define CLUTTER_KEY_Thai_chochang 0xdaa
-#define CLUTTER_KEY_Thai_soso 0xdab
-#define CLUTTER_KEY_Thai_chochoe 0xdac
-#define CLUTTER_KEY_Thai_yoying 0xdad
-#define CLUTTER_KEY_Thai_dochada 0xdae
-#define CLUTTER_KEY_Thai_topatak 0xdaf
-#define CLUTTER_KEY_Thai_thothan 0xdb0
-#define CLUTTER_KEY_Thai_thonangmontho 0xdb1
-#define CLUTTER_KEY_Thai_thophuthao 0xdb2
-#define CLUTTER_KEY_Thai_nonen 0xdb3
-#define CLUTTER_KEY_Thai_dodek 0xdb4
-#define CLUTTER_KEY_Thai_totao 0xdb5
-#define CLUTTER_KEY_Thai_thothung 0xdb6
-#define CLUTTER_KEY_Thai_thothahan 0xdb7
-#define CLUTTER_KEY_Thai_thothong 0xdb8
-#define CLUTTER_KEY_Thai_nonu 0xdb9
-#define CLUTTER_KEY_Thai_bobaimai 0xdba
-#define CLUTTER_KEY_Thai_popla 0xdbb
-#define CLUTTER_KEY_Thai_phophung 0xdbc
-#define CLUTTER_KEY_Thai_fofa 0xdbd
-#define CLUTTER_KEY_Thai_phophan 0xdbe
-#define CLUTTER_KEY_Thai_fofan 0xdbf
-#define CLUTTER_KEY_Thai_phosamphao 0xdc0
-#define CLUTTER_KEY_Thai_moma 0xdc1
-#define CLUTTER_KEY_Thai_yoyak 0xdc2
-#define CLUTTER_KEY_Thai_rorua 0xdc3
-#define CLUTTER_KEY_Thai_ru 0xdc4
-#define CLUTTER_KEY_Thai_loling 0xdc5
-#define CLUTTER_KEY_Thai_lu 0xdc6
-#define CLUTTER_KEY_Thai_wowaen 0xdc7
-#define CLUTTER_KEY_Thai_sosala 0xdc8
-#define CLUTTER_KEY_Thai_sorusi 0xdc9
-#define CLUTTER_KEY_Thai_sosua 0xdca
-#define CLUTTER_KEY_Thai_hohip 0xdcb
-#define CLUTTER_KEY_Thai_lochula 0xdcc
-#define CLUTTER_KEY_Thai_oang 0xdcd
-#define CLUTTER_KEY_Thai_honokhuk 0xdce
-#define CLUTTER_KEY_Thai_paiyannoi 0xdcf
-#define CLUTTER_KEY_Thai_saraa 0xdd0
-#define CLUTTER_KEY_Thai_maihanakat 0xdd1
-#define CLUTTER_KEY_Thai_saraaa 0xdd2
-#define CLUTTER_KEY_Thai_saraam 0xdd3
-#define CLUTTER_KEY_Thai_sarai 0xdd4
-#define CLUTTER_KEY_Thai_saraii 0xdd5
-#define CLUTTER_KEY_Thai_saraue 0xdd6
-#define CLUTTER_KEY_Thai_sarauee 0xdd7
-#define CLUTTER_KEY_Thai_sarau 0xdd8
-#define CLUTTER_KEY_Thai_sarauu 0xdd9
-#define CLUTTER_KEY_Thai_phinthu 0xdda
-#define CLUTTER_KEY_Thai_maihanakat_maitho 0xdde
-#define CLUTTER_KEY_Thai_baht 0xddf
-#define CLUTTER_KEY_Thai_sarae 0xde0
-#define CLUTTER_KEY_Thai_saraae 0xde1
-#define CLUTTER_KEY_Thai_sarao 0xde2
-#define CLUTTER_KEY_Thai_saraaimaimuan 0xde3
-#define CLUTTER_KEY_Thai_saraaimaimalai 0xde4
-#define CLUTTER_KEY_Thai_lakkhangyao 0xde5
-#define CLUTTER_KEY_Thai_maiyamok 0xde6
-#define CLUTTER_KEY_Thai_maitaikhu 0xde7
-#define CLUTTER_KEY_Thai_maiek 0xde8
-#define CLUTTER_KEY_Thai_maitho 0xde9
-#define CLUTTER_KEY_Thai_maitri 0xdea
-#define CLUTTER_KEY_Thai_maichattawa 0xdeb
-#define CLUTTER_KEY_Thai_thanthakhat 0xdec
-#define CLUTTER_KEY_Thai_nikhahit 0xded
-#define CLUTTER_KEY_Thai_leksun 0xdf0
-#define CLUTTER_KEY_Thai_leknung 0xdf1
-#define CLUTTER_KEY_Thai_leksong 0xdf2
-#define CLUTTER_KEY_Thai_leksam 0xdf3
-#define CLUTTER_KEY_Thai_leksi 0xdf4
-#define CLUTTER_KEY_Thai_lekha 0xdf5
-#define CLUTTER_KEY_Thai_lekhok 0xdf6
-#define CLUTTER_KEY_Thai_lekchet 0xdf7
-#define CLUTTER_KEY_Thai_lekpaet 0xdf8
-#define CLUTTER_KEY_Thai_lekkao 0xdf9
-#define CLUTTER_KEY_Hangul 0xff31
-#define CLUTTER_KEY_Hangul_Start 0xff32
-#define CLUTTER_KEY_Hangul_End 0xff33
-#define CLUTTER_KEY_Hangul_Hanja 0xff34
-#define CLUTTER_KEY_Hangul_Jamo 0xff35
-#define CLUTTER_KEY_Hangul_Romaja 0xff36
-#define CLUTTER_KEY_Hangul_Codeinput 0xff37
-#define CLUTTER_KEY_Hangul_Jeonja 0xff38
-#define CLUTTER_KEY_Hangul_Banja 0xff39
-#define CLUTTER_KEY_Hangul_PreHanja 0xff3a
-#define CLUTTER_KEY_Hangul_PostHanja 0xff3b
-#define CLUTTER_KEY_Hangul_SingleCandidate 0xff3c
-#define CLUTTER_KEY_Hangul_MultipleCandidate 0xff3d
-#define CLUTTER_KEY_Hangul_PreviousCandidate 0xff3e
-#define CLUTTER_KEY_Hangul_Special 0xff3f
-#define CLUTTER_KEY_Hangul_switch 0xff7e
-#define CLUTTER_KEY_Hangul_Kiyeog 0xea1
-#define CLUTTER_KEY_Hangul_SsangKiyeog 0xea2
-#define CLUTTER_KEY_Hangul_KiyeogSios 0xea3
-#define CLUTTER_KEY_Hangul_Nieun 0xea4
-#define CLUTTER_KEY_Hangul_NieunJieuj 0xea5
-#define CLUTTER_KEY_Hangul_NieunHieuh 0xea6
-#define CLUTTER_KEY_Hangul_Dikeud 0xea7
-#define CLUTTER_KEY_Hangul_SsangDikeud 0xea8
-#define CLUTTER_KEY_Hangul_Rieul 0xea9
-#define CLUTTER_KEY_Hangul_RieulKiyeog 0xeaa
-#define CLUTTER_KEY_Hangul_RieulMieum 0xeab
-#define CLUTTER_KEY_Hangul_RieulPieub 0xeac
-#define CLUTTER_KEY_Hangul_RieulSios 0xead
-#define CLUTTER_KEY_Hangul_RieulTieut 0xeae
-#define CLUTTER_KEY_Hangul_RieulPhieuf 0xeaf
-#define CLUTTER_KEY_Hangul_RieulHieuh 0xeb0
-#define CLUTTER_KEY_Hangul_Mieum 0xeb1
-#define CLUTTER_KEY_Hangul_Pieub 0xeb2
-#define CLUTTER_KEY_Hangul_SsangPieub 0xeb3
-#define CLUTTER_KEY_Hangul_PieubSios 0xeb4
-#define CLUTTER_KEY_Hangul_Sios 0xeb5
-#define CLUTTER_KEY_Hangul_SsangSios 0xeb6
-#define CLUTTER_KEY_Hangul_Ieung 0xeb7
-#define CLUTTER_KEY_Hangul_Jieuj 0xeb8
-#define CLUTTER_KEY_Hangul_SsangJieuj 0xeb9
-#define CLUTTER_KEY_Hangul_Cieuc 0xeba
-#define CLUTTER_KEY_Hangul_Khieuq 0xebb
-#define CLUTTER_KEY_Hangul_Tieut 0xebc
-#define CLUTTER_KEY_Hangul_Phieuf 0xebd
-#define CLUTTER_KEY_Hangul_Hieuh 0xebe
-#define CLUTTER_KEY_Hangul_A 0xebf
-#define CLUTTER_KEY_Hangul_AE 0xec0
-#define CLUTTER_KEY_Hangul_YA 0xec1
-#define CLUTTER_KEY_Hangul_YAE 0xec2
-#define CLUTTER_KEY_Hangul_EO 0xec3
-#define CLUTTER_KEY_Hangul_E 0xec4
-#define CLUTTER_KEY_Hangul_YEO 0xec5
-#define CLUTTER_KEY_Hangul_YE 0xec6
-#define CLUTTER_KEY_Hangul_O 0xec7
-#define CLUTTER_KEY_Hangul_WA 0xec8
-#define CLUTTER_KEY_Hangul_WAE 0xec9
-#define CLUTTER_KEY_Hangul_OE 0xeca
-#define CLUTTER_KEY_Hangul_YO 0xecb
-#define CLUTTER_KEY_Hangul_U 0xecc
-#define CLUTTER_KEY_Hangul_WEO 0xecd
-#define CLUTTER_KEY_Hangul_WE 0xece
-#define CLUTTER_KEY_Hangul_WI 0xecf
-#define CLUTTER_KEY_Hangul_YU 0xed0
-#define CLUTTER_KEY_Hangul_EU 0xed1
-#define CLUTTER_KEY_Hangul_YI 0xed2
-#define CLUTTER_KEY_Hangul_I 0xed3
-#define CLUTTER_KEY_Hangul_J_Kiyeog 0xed4
-#define CLUTTER_KEY_Hangul_J_SsangKiyeog 0xed5
-#define CLUTTER_KEY_Hangul_J_KiyeogSios 0xed6
-#define CLUTTER_KEY_Hangul_J_Nieun 0xed7
-#define CLUTTER_KEY_Hangul_J_NieunJieuj 0xed8
-#define CLUTTER_KEY_Hangul_J_NieunHieuh 0xed9
-#define CLUTTER_KEY_Hangul_J_Dikeud 0xeda
-#define CLUTTER_KEY_Hangul_J_Rieul 0xedb
-#define CLUTTER_KEY_Hangul_J_RieulKiyeog 0xedc
-#define CLUTTER_KEY_Hangul_J_RieulMieum 0xedd
-#define CLUTTER_KEY_Hangul_J_RieulPieub 0xede
-#define CLUTTER_KEY_Hangul_J_RieulSios 0xedf
-#define CLUTTER_KEY_Hangul_J_RieulTieut 0xee0
-#define CLUTTER_KEY_Hangul_J_RieulPhieuf 0xee1
-#define CLUTTER_KEY_Hangul_J_RieulHieuh 0xee2
-#define CLUTTER_KEY_Hangul_J_Mieum 0xee3
-#define CLUTTER_KEY_Hangul_J_Pieub 0xee4
-#define CLUTTER_KEY_Hangul_J_PieubSios 0xee5
-#define CLUTTER_KEY_Hangul_J_Sios 0xee6
-#define CLUTTER_KEY_Hangul_J_SsangSios 0xee7
-#define CLUTTER_KEY_Hangul_J_Ieung 0xee8
-#define CLUTTER_KEY_Hangul_J_Jieuj 0xee9
-#define CLUTTER_KEY_Hangul_J_Cieuc 0xeea
-#define CLUTTER_KEY_Hangul_J_Khieuq 0xeeb
-#define CLUTTER_KEY_Hangul_J_Tieut 0xeec
-#define CLUTTER_KEY_Hangul_J_Phieuf 0xeed
-#define CLUTTER_KEY_Hangul_J_Hieuh 0xeee
-#define CLUTTER_KEY_Hangul_RieulYeorinHieuh 0xeef
-#define CLUTTER_KEY_Hangul_SunkyeongeumMieum 0xef0
-#define CLUTTER_KEY_Hangul_SunkyeongeumPieub 0xef1
-#define CLUTTER_KEY_Hangul_PanSios 0xef2
-#define CLUTTER_KEY_Hangul_KkogjiDalrinIeung 0xef3
-#define CLUTTER_KEY_Hangul_SunkyeongeumPhieuf 0xef4
-#define CLUTTER_KEY_Hangul_YeorinHieuh 0xef5
-#define CLUTTER_KEY_Hangul_AraeA 0xef6
-#define CLUTTER_KEY_Hangul_AraeAE 0xef7
-#define CLUTTER_KEY_Hangul_J_PanSios 0xef8
-#define CLUTTER_KEY_Hangul_J_KkogjiDalrinIeung 0xef9
-#define CLUTTER_KEY_Hangul_J_YeorinHieuh 0xefa
-#define CLUTTER_KEY_Korean_Won 0xeff
-#define CLUTTER_KEY_Armenian_ligature_ew 0x1000587
-#define CLUTTER_KEY_Armenian_full_stop 0x1000589
-#define CLUTTER_KEY_Armenian_verjaket 0x1000589
-#define CLUTTER_KEY_Armenian_separation_mark 0x100055d
-#define CLUTTER_KEY_Armenian_but 0x100055d
-#define CLUTTER_KEY_Armenian_hyphen 0x100058a
-#define CLUTTER_KEY_Armenian_yentamna 0x100058a
-#define CLUTTER_KEY_Armenian_exclam 0x100055c
-#define CLUTTER_KEY_Armenian_amanak 0x100055c
-#define CLUTTER_KEY_Armenian_accent 0x100055b
-#define CLUTTER_KEY_Armenian_shesht 0x100055b
-#define CLUTTER_KEY_Armenian_question 0x100055e
-#define CLUTTER_KEY_Armenian_paruyk 0x100055e
-#define CLUTTER_KEY_Armenian_AYB 0x1000531
-#define CLUTTER_KEY_Armenian_ayb 0x1000561
-#define CLUTTER_KEY_Armenian_BEN 0x1000532
-#define CLUTTER_KEY_Armenian_ben 0x1000562
-#define CLUTTER_KEY_Armenian_GIM 0x1000533
-#define CLUTTER_KEY_Armenian_gim 0x1000563
-#define CLUTTER_KEY_Armenian_DA 0x1000534
-#define CLUTTER_KEY_Armenian_da 0x1000564
-#define CLUTTER_KEY_Armenian_YECH 0x1000535
-#define CLUTTER_KEY_Armenian_yech 0x1000565
-#define CLUTTER_KEY_Armenian_ZA 0x1000536
-#define CLUTTER_KEY_Armenian_za 0x1000566
-#define CLUTTER_KEY_Armenian_E 0x1000537
-#define CLUTTER_KEY_Armenian_e 0x1000567
-#define CLUTTER_KEY_Armenian_AT 0x1000538
-#define CLUTTER_KEY_Armenian_at 0x1000568
-#define CLUTTER_KEY_Armenian_TO 0x1000539
-#define CLUTTER_KEY_Armenian_to 0x1000569
-#define CLUTTER_KEY_Armenian_ZHE 0x100053a
-#define CLUTTER_KEY_Armenian_zhe 0x100056a
-#define CLUTTER_KEY_Armenian_INI 0x100053b
-#define CLUTTER_KEY_Armenian_ini 0x100056b
-#define CLUTTER_KEY_Armenian_LYUN 0x100053c
-#define CLUTTER_KEY_Armenian_lyun 0x100056c
-#define CLUTTER_KEY_Armenian_KHE 0x100053d
-#define CLUTTER_KEY_Armenian_khe 0x100056d
-#define CLUTTER_KEY_Armenian_TSA 0x100053e
-#define CLUTTER_KEY_Armenian_tsa 0x100056e
-#define CLUTTER_KEY_Armenian_KEN 0x100053f
-#define CLUTTER_KEY_Armenian_ken 0x100056f
-#define CLUTTER_KEY_Armenian_HO 0x1000540
-#define CLUTTER_KEY_Armenian_ho 0x1000570
-#define CLUTTER_KEY_Armenian_DZA 0x1000541
-#define CLUTTER_KEY_Armenian_dza 0x1000571
-#define CLUTTER_KEY_Armenian_GHAT 0x1000542
-#define CLUTTER_KEY_Armenian_ghat 0x1000572
-#define CLUTTER_KEY_Armenian_TCHE 0x1000543
-#define CLUTTER_KEY_Armenian_tche 0x1000573
-#define CLUTTER_KEY_Armenian_MEN 0x1000544
-#define CLUTTER_KEY_Armenian_men 0x1000574
-#define CLUTTER_KEY_Armenian_HI 0x1000545
-#define CLUTTER_KEY_Armenian_hi 0x1000575
-#define CLUTTER_KEY_Armenian_NU 0x1000546
-#define CLUTTER_KEY_Armenian_nu 0x1000576
-#define CLUTTER_KEY_Armenian_SHA 0x1000547
-#define CLUTTER_KEY_Armenian_sha 0x1000577
-#define CLUTTER_KEY_Armenian_VO 0x1000548
-#define CLUTTER_KEY_Armenian_vo 0x1000578
-#define CLUTTER_KEY_Armenian_CHA 0x1000549
-#define CLUTTER_KEY_Armenian_cha 0x1000579
-#define CLUTTER_KEY_Armenian_PE 0x100054a
-#define CLUTTER_KEY_Armenian_pe 0x100057a
-#define CLUTTER_KEY_Armenian_JE 0x100054b
-#define CLUTTER_KEY_Armenian_je 0x100057b
-#define CLUTTER_KEY_Armenian_RA 0x100054c
-#define CLUTTER_KEY_Armenian_ra 0x100057c
-#define CLUTTER_KEY_Armenian_SE 0x100054d
-#define CLUTTER_KEY_Armenian_se 0x100057d
-#define CLUTTER_KEY_Armenian_VEV 0x100054e
-#define CLUTTER_KEY_Armenian_vev 0x100057e
-#define CLUTTER_KEY_Armenian_TYUN 0x100054f
-#define CLUTTER_KEY_Armenian_tyun 0x100057f
-#define CLUTTER_KEY_Armenian_RE 0x1000550
-#define CLUTTER_KEY_Armenian_re 0x1000580
-#define CLUTTER_KEY_Armenian_TSO 0x1000551
-#define CLUTTER_KEY_Armenian_tso 0x1000581
-#define CLUTTER_KEY_Armenian_VYUN 0x1000552
-#define CLUTTER_KEY_Armenian_vyun 0x1000582
-#define CLUTTER_KEY_Armenian_PYUR 0x1000553
-#define CLUTTER_KEY_Armenian_pyur 0x1000583
-#define CLUTTER_KEY_Armenian_KE 0x1000554
-#define CLUTTER_KEY_Armenian_ke 0x1000584
-#define CLUTTER_KEY_Armenian_O 0x1000555
-#define CLUTTER_KEY_Armenian_o 0x1000585
-#define CLUTTER_KEY_Armenian_FE 0x1000556
-#define CLUTTER_KEY_Armenian_fe 0x1000586
-#define CLUTTER_KEY_Armenian_apostrophe 0x100055a
-#define CLUTTER_KEY_Georgian_an 0x10010d0
-#define CLUTTER_KEY_Georgian_ban 0x10010d1
-#define CLUTTER_KEY_Georgian_gan 0x10010d2
-#define CLUTTER_KEY_Georgian_don 0x10010d3
-#define CLUTTER_KEY_Georgian_en 0x10010d4
-#define CLUTTER_KEY_Georgian_vin 0x10010d5
-#define CLUTTER_KEY_Georgian_zen 0x10010d6
-#define CLUTTER_KEY_Georgian_tan 0x10010d7
-#define CLUTTER_KEY_Georgian_in 0x10010d8
-#define CLUTTER_KEY_Georgian_kan 0x10010d9
-#define CLUTTER_KEY_Georgian_las 0x10010da
-#define CLUTTER_KEY_Georgian_man 0x10010db
-#define CLUTTER_KEY_Georgian_nar 0x10010dc
-#define CLUTTER_KEY_Georgian_on 0x10010dd
-#define CLUTTER_KEY_Georgian_par 0x10010de
-#define CLUTTER_KEY_Georgian_zhar 0x10010df
-#define CLUTTER_KEY_Georgian_rae 0x10010e0
-#define CLUTTER_KEY_Georgian_san 0x10010e1
-#define CLUTTER_KEY_Georgian_tar 0x10010e2
-#define CLUTTER_KEY_Georgian_un 0x10010e3
-#define CLUTTER_KEY_Georgian_phar 0x10010e4
-#define CLUTTER_KEY_Georgian_khar 0x10010e5
-#define CLUTTER_KEY_Georgian_ghan 0x10010e6
-#define CLUTTER_KEY_Georgian_qar 0x10010e7
-#define CLUTTER_KEY_Georgian_shin 0x10010e8
-#define CLUTTER_KEY_Georgian_chin 0x10010e9
-#define CLUTTER_KEY_Georgian_can 0x10010ea
-#define CLUTTER_KEY_Georgian_jil 0x10010eb
-#define CLUTTER_KEY_Georgian_cil 0x10010ec
-#define CLUTTER_KEY_Georgian_char 0x10010ed
-#define CLUTTER_KEY_Georgian_xan 0x10010ee
-#define CLUTTER_KEY_Georgian_jhan 0x10010ef
-#define CLUTTER_KEY_Georgian_hae 0x10010f0
-#define CLUTTER_KEY_Georgian_he 0x10010f1
-#define CLUTTER_KEY_Georgian_hie 0x10010f2
-#define CLUTTER_KEY_Georgian_we 0x10010f3
-#define CLUTTER_KEY_Georgian_har 0x10010f4
-#define CLUTTER_KEY_Georgian_hoe 0x10010f5
-#define CLUTTER_KEY_Georgian_fi 0x10010f6
-#define CLUTTER_KEY_Xabovedot 0x1001e8a
-#define CLUTTER_KEY_Ibreve 0x100012c
-#define CLUTTER_KEY_Zstroke 0x10001b5
-#define CLUTTER_KEY_Gcaron 0x10001e6
-#define CLUTTER_KEY_Ocaron 0x10001d1
-#define CLUTTER_KEY_Obarred 0x100019f
-#define CLUTTER_KEY_xabovedot 0x1001e8b
-#define CLUTTER_KEY_ibreve 0x100012d
-#define CLUTTER_KEY_zstroke 0x10001b6
-#define CLUTTER_KEY_gcaron 0x10001e7
-#define CLUTTER_KEY_ocaron 0x10001d2
-#define CLUTTER_KEY_obarred 0x1000275
-#define CLUTTER_KEY_SCHWA 0x100018f
-#define CLUTTER_KEY_schwa 0x1000259
-#define CLUTTER_KEY_EZH 0x10001b7
-#define CLUTTER_KEY_ezh 0x1000292
-#define CLUTTER_KEY_Lbelowdot 0x1001e36
-#define CLUTTER_KEY_lbelowdot 0x1001e37
-#define CLUTTER_KEY_Abelowdot 0x1001ea0
-#define CLUTTER_KEY_abelowdot 0x1001ea1
-#define CLUTTER_KEY_Ahook 0x1001ea2
-#define CLUTTER_KEY_ahook 0x1001ea3
-#define CLUTTER_KEY_Acircumflexacute 0x1001ea4
-#define CLUTTER_KEY_acircumflexacute 0x1001ea5
-#define CLUTTER_KEY_Acircumflexgrave 0x1001ea6
-#define CLUTTER_KEY_acircumflexgrave 0x1001ea7
-#define CLUTTER_KEY_Acircumflexhook 0x1001ea8
-#define CLUTTER_KEY_acircumflexhook 0x1001ea9
-#define CLUTTER_KEY_Acircumflextilde 0x1001eaa
-#define CLUTTER_KEY_acircumflextilde 0x1001eab
-#define CLUTTER_KEY_Acircumflexbelowdot 0x1001eac
-#define CLUTTER_KEY_acircumflexbelowdot 0x1001ead
-#define CLUTTER_KEY_Abreveacute 0x1001eae
-#define CLUTTER_KEY_abreveacute 0x1001eaf
-#define CLUTTER_KEY_Abrevegrave 0x1001eb0
-#define CLUTTER_KEY_abrevegrave 0x1001eb1
-#define CLUTTER_KEY_Abrevehook 0x1001eb2
-#define CLUTTER_KEY_abrevehook 0x1001eb3
-#define CLUTTER_KEY_Abrevetilde 0x1001eb4
-#define CLUTTER_KEY_abrevetilde 0x1001eb5
-#define CLUTTER_KEY_Abrevebelowdot 0x1001eb6
-#define CLUTTER_KEY_abrevebelowdot 0x1001eb7
-#define CLUTTER_KEY_Ebelowdot 0x1001eb8
-#define CLUTTER_KEY_ebelowdot 0x1001eb9
-#define CLUTTER_KEY_Ehook 0x1001eba
-#define CLUTTER_KEY_ehook 0x1001ebb
-#define CLUTTER_KEY_Etilde 0x1001ebc
-#define CLUTTER_KEY_etilde 0x1001ebd
-#define CLUTTER_KEY_Ecircumflexacute 0x1001ebe
-#define CLUTTER_KEY_ecircumflexacute 0x1001ebf
-#define CLUTTER_KEY_Ecircumflexgrave 0x1001ec0
-#define CLUTTER_KEY_ecircumflexgrave 0x1001ec1
-#define CLUTTER_KEY_Ecircumflexhook 0x1001ec2
-#define CLUTTER_KEY_ecircumflexhook 0x1001ec3
-#define CLUTTER_KEY_Ecircumflextilde 0x1001ec4
-#define CLUTTER_KEY_ecircumflextilde 0x1001ec5
-#define CLUTTER_KEY_Ecircumflexbelowdot 0x1001ec6
-#define CLUTTER_KEY_ecircumflexbelowdot 0x1001ec7
-#define CLUTTER_KEY_Ihook 0x1001ec8
-#define CLUTTER_KEY_ihook 0x1001ec9
-#define CLUTTER_KEY_Ibelowdot 0x1001eca
-#define CLUTTER_KEY_ibelowdot 0x1001ecb
-#define CLUTTER_KEY_Obelowdot 0x1001ecc
-#define CLUTTER_KEY_obelowdot 0x1001ecd
-#define CLUTTER_KEY_Ohook 0x1001ece
-#define CLUTTER_KEY_ohook 0x1001ecf
-#define CLUTTER_KEY_Ocircumflexacute 0x1001ed0
-#define CLUTTER_KEY_ocircumflexacute 0x1001ed1
-#define CLUTTER_KEY_Ocircumflexgrave 0x1001ed2
-#define CLUTTER_KEY_ocircumflexgrave 0x1001ed3
-#define CLUTTER_KEY_Ocircumflexhook 0x1001ed4
-#define CLUTTER_KEY_ocircumflexhook 0x1001ed5
-#define CLUTTER_KEY_Ocircumflextilde 0x1001ed6
-#define CLUTTER_KEY_ocircumflextilde 0x1001ed7
-#define CLUTTER_KEY_Ocircumflexbelowdot 0x1001ed8
-#define CLUTTER_KEY_ocircumflexbelowdot 0x1001ed9
-#define CLUTTER_KEY_Ohornacute 0x1001eda
-#define CLUTTER_KEY_ohornacute 0x1001edb
-#define CLUTTER_KEY_Ohorngrave 0x1001edc
-#define CLUTTER_KEY_ohorngrave 0x1001edd
-#define CLUTTER_KEY_Ohornhook 0x1001ede
-#define CLUTTER_KEY_ohornhook 0x1001edf
-#define CLUTTER_KEY_Ohorntilde 0x1001ee0
-#define CLUTTER_KEY_ohorntilde 0x1001ee1
-#define CLUTTER_KEY_Ohornbelowdot 0x1001ee2
-#define CLUTTER_KEY_ohornbelowdot 0x1001ee3
-#define CLUTTER_KEY_Ubelowdot 0x1001ee4
-#define CLUTTER_KEY_ubelowdot 0x1001ee5
-#define CLUTTER_KEY_Uhook 0x1001ee6
-#define CLUTTER_KEY_uhook 0x1001ee7
-#define CLUTTER_KEY_Uhornacute 0x1001ee8
-#define CLUTTER_KEY_uhornacute 0x1001ee9
-#define CLUTTER_KEY_Uhorngrave 0x1001eea
-#define CLUTTER_KEY_uhorngrave 0x1001eeb
-#define CLUTTER_KEY_Uhornhook 0x1001eec
-#define CLUTTER_KEY_uhornhook 0x1001eed
-#define CLUTTER_KEY_Uhorntilde 0x1001eee
-#define CLUTTER_KEY_uhorntilde 0x1001eef
-#define CLUTTER_KEY_Uhornbelowdot 0x1001ef0
-#define CLUTTER_KEY_uhornbelowdot 0x1001ef1
-#define CLUTTER_KEY_Ybelowdot 0x1001ef4
-#define CLUTTER_KEY_ybelowdot 0x1001ef5
-#define CLUTTER_KEY_Yhook 0x1001ef6
-#define CLUTTER_KEY_yhook 0x1001ef7
-#define CLUTTER_KEY_Ytilde 0x1001ef8
-#define CLUTTER_KEY_ytilde 0x1001ef9
-#define CLUTTER_KEY_Ohorn 0x10001a0
-#define CLUTTER_KEY_ohorn 0x10001a1
-#define CLUTTER_KEY_Uhorn 0x10001af
-#define CLUTTER_KEY_uhorn 0x10001b0
-#define CLUTTER_KEY_EcuSign 0x10020a0
-#define CLUTTER_KEY_ColonSign 0x10020a1
-#define CLUTTER_KEY_CruzeiroSign 0x10020a2
-#define CLUTTER_KEY_FFrancSign 0x10020a3
-#define CLUTTER_KEY_LiraSign 0x10020a4
-#define CLUTTER_KEY_MillSign 0x10020a5
-#define CLUTTER_KEY_NairaSign 0x10020a6
-#define CLUTTER_KEY_PesetaSign 0x10020a7
-#define CLUTTER_KEY_RupeeSign 0x10020a8
-#define CLUTTER_KEY_WonSign 0x10020a9
-#define CLUTTER_KEY_NewSheqelSign 0x10020aa
-#define CLUTTER_KEY_DongSign 0x10020ab
-#define CLUTTER_KEY_EuroSign 0x20ac
-#define CLUTTER_KEY_zerosuperior 0x1002070
-#define CLUTTER_KEY_foursuperior 0x1002074
-#define CLUTTER_KEY_fivesuperior 0x1002075
-#define CLUTTER_KEY_sixsuperior 0x1002076
-#define CLUTTER_KEY_sevensuperior 0x1002077
-#define CLUTTER_KEY_eightsuperior 0x1002078
-#define CLUTTER_KEY_ninesuperior 0x1002079
-#define CLUTTER_KEY_zerosubscript 0x1002080
-#define CLUTTER_KEY_onesubscript 0x1002081
-#define CLUTTER_KEY_twosubscript 0x1002082
-#define CLUTTER_KEY_threesubscript 0x1002083
-#define CLUTTER_KEY_foursubscript 0x1002084
-#define CLUTTER_KEY_fivesubscript 0x1002085
-#define CLUTTER_KEY_sixsubscript 0x1002086
-#define CLUTTER_KEY_sevensubscript 0x1002087
-#define CLUTTER_KEY_eightsubscript 0x1002088
-#define CLUTTER_KEY_ninesubscript 0x1002089
-#define CLUTTER_KEY_partdifferential 0x1002202
-#define CLUTTER_KEY_emptyset 0x1002205
-#define CLUTTER_KEY_elementof 0x1002208
-#define CLUTTER_KEY_notelementof 0x1002209
-#define CLUTTER_KEY_containsas 0x100220b
-#define CLUTTER_KEY_squareroot 0x100221a
-#define CLUTTER_KEY_cuberoot 0x100221b
-#define CLUTTER_KEY_fourthroot 0x100221c
-#define CLUTTER_KEY_dintegral 0x100222c
-#define CLUTTER_KEY_tintegral 0x100222d
-#define CLUTTER_KEY_because 0x1002235
-#define CLUTTER_KEY_approxeq 0x1002248
-#define CLUTTER_KEY_notapproxeq 0x1002247
-#define CLUTTER_KEY_notidentical 0x1002262
-#define CLUTTER_KEY_stricteq 0x1002263
-#define CLUTTER_KEY_braille_dot_1 0xfff1
-#define CLUTTER_KEY_braille_dot_2 0xfff2
-#define CLUTTER_KEY_braille_dot_3 0xfff3
-#define CLUTTER_KEY_braille_dot_4 0xfff4
-#define CLUTTER_KEY_braille_dot_5 0xfff5
-#define CLUTTER_KEY_braille_dot_6 0xfff6
-#define CLUTTER_KEY_braille_dot_7 0xfff7
-#define CLUTTER_KEY_braille_dot_8 0xfff8
-#define CLUTTER_KEY_braille_dot_9 0xfff9
-#define CLUTTER_KEY_braille_dot_10 0xfffa
-#define CLUTTER_KEY_braille_blank 0x1002800
-#define CLUTTER_KEY_braille_dots_1 0x1002801
-#define CLUTTER_KEY_braille_dots_2 0x1002802
-#define CLUTTER_KEY_braille_dots_12 0x1002803
-#define CLUTTER_KEY_braille_dots_3 0x1002804
-#define CLUTTER_KEY_braille_dots_13 0x1002805
-#define CLUTTER_KEY_braille_dots_23 0x1002806
-#define CLUTTER_KEY_braille_dots_123 0x1002807
-#define CLUTTER_KEY_braille_dots_4 0x1002808
-#define CLUTTER_KEY_braille_dots_14 0x1002809
-#define CLUTTER_KEY_braille_dots_24 0x100280a
-#define CLUTTER_KEY_braille_dots_124 0x100280b
-#define CLUTTER_KEY_braille_dots_34 0x100280c
-#define CLUTTER_KEY_braille_dots_134 0x100280d
-#define CLUTTER_KEY_braille_dots_234 0x100280e
-#define CLUTTER_KEY_braille_dots_1234 0x100280f
-#define CLUTTER_KEY_braille_dots_5 0x1002810
-#define CLUTTER_KEY_braille_dots_15 0x1002811
-#define CLUTTER_KEY_braille_dots_25 0x1002812
-#define CLUTTER_KEY_braille_dots_125 0x1002813
-#define CLUTTER_KEY_braille_dots_35 0x1002814
-#define CLUTTER_KEY_braille_dots_135 0x1002815
-#define CLUTTER_KEY_braille_dots_235 0x1002816
-#define CLUTTER_KEY_braille_dots_1235 0x1002817
-#define CLUTTER_KEY_braille_dots_45 0x1002818
-#define CLUTTER_KEY_braille_dots_145 0x1002819
-#define CLUTTER_KEY_braille_dots_245 0x100281a
-#define CLUTTER_KEY_braille_dots_1245 0x100281b
-#define CLUTTER_KEY_braille_dots_345 0x100281c
-#define CLUTTER_KEY_braille_dots_1345 0x100281d
-#define CLUTTER_KEY_braille_dots_2345 0x100281e
-#define CLUTTER_KEY_braille_dots_12345 0x100281f
-#define CLUTTER_KEY_braille_dots_6 0x1002820
-#define CLUTTER_KEY_braille_dots_16 0x1002821
-#define CLUTTER_KEY_braille_dots_26 0x1002822
-#define CLUTTER_KEY_braille_dots_126 0x1002823
-#define CLUTTER_KEY_braille_dots_36 0x1002824
-#define CLUTTER_KEY_braille_dots_136 0x1002825
-#define CLUTTER_KEY_braille_dots_236 0x1002826
-#define CLUTTER_KEY_braille_dots_1236 0x1002827
-#define CLUTTER_KEY_braille_dots_46 0x1002828
-#define CLUTTER_KEY_braille_dots_146 0x1002829
-#define CLUTTER_KEY_braille_dots_246 0x100282a
-#define CLUTTER_KEY_braille_dots_1246 0x100282b
-#define CLUTTER_KEY_braille_dots_346 0x100282c
-#define CLUTTER_KEY_braille_dots_1346 0x100282d
-#define CLUTTER_KEY_braille_dots_2346 0x100282e
-#define CLUTTER_KEY_braille_dots_12346 0x100282f
-#define CLUTTER_KEY_braille_dots_56 0x1002830
-#define CLUTTER_KEY_braille_dots_156 0x1002831
-#define CLUTTER_KEY_braille_dots_256 0x1002832
-#define CLUTTER_KEY_braille_dots_1256 0x1002833
-#define CLUTTER_KEY_braille_dots_356 0x1002834
-#define CLUTTER_KEY_braille_dots_1356 0x1002835
-#define CLUTTER_KEY_braille_dots_2356 0x1002836
-#define CLUTTER_KEY_braille_dots_12356 0x1002837
-#define CLUTTER_KEY_braille_dots_456 0x1002838
-#define CLUTTER_KEY_braille_dots_1456 0x1002839
-#define CLUTTER_KEY_braille_dots_2456 0x100283a
-#define CLUTTER_KEY_braille_dots_12456 0x100283b
-#define CLUTTER_KEY_braille_dots_3456 0x100283c
-#define CLUTTER_KEY_braille_dots_13456 0x100283d
-#define CLUTTER_KEY_braille_dots_23456 0x100283e
-#define CLUTTER_KEY_braille_dots_123456 0x100283f
-#define CLUTTER_KEY_braille_dots_7 0x1002840
-#define CLUTTER_KEY_braille_dots_17 0x1002841
-#define CLUTTER_KEY_braille_dots_27 0x1002842
-#define CLUTTER_KEY_braille_dots_127 0x1002843
-#define CLUTTER_KEY_braille_dots_37 0x1002844
-#define CLUTTER_KEY_braille_dots_137 0x1002845
-#define CLUTTER_KEY_braille_dots_237 0x1002846
-#define CLUTTER_KEY_braille_dots_1237 0x1002847
-#define CLUTTER_KEY_braille_dots_47 0x1002848
-#define CLUTTER_KEY_braille_dots_147 0x1002849
-#define CLUTTER_KEY_braille_dots_247 0x100284a
-#define CLUTTER_KEY_braille_dots_1247 0x100284b
-#define CLUTTER_KEY_braille_dots_347 0x100284c
-#define CLUTTER_KEY_braille_dots_1347 0x100284d
-#define CLUTTER_KEY_braille_dots_2347 0x100284e
-#define CLUTTER_KEY_braille_dots_12347 0x100284f
-#define CLUTTER_KEY_braille_dots_57 0x1002850
-#define CLUTTER_KEY_braille_dots_157 0x1002851
-#define CLUTTER_KEY_braille_dots_257 0x1002852
-#define CLUTTER_KEY_braille_dots_1257 0x1002853
-#define CLUTTER_KEY_braille_dots_357 0x1002854
-#define CLUTTER_KEY_braille_dots_1357 0x1002855
-#define CLUTTER_KEY_braille_dots_2357 0x1002856
-#define CLUTTER_KEY_braille_dots_12357 0x1002857
-#define CLUTTER_KEY_braille_dots_457 0x1002858
-#define CLUTTER_KEY_braille_dots_1457 0x1002859
-#define CLUTTER_KEY_braille_dots_2457 0x100285a
-#define CLUTTER_KEY_braille_dots_12457 0x100285b
-#define CLUTTER_KEY_braille_dots_3457 0x100285c
-#define CLUTTER_KEY_braille_dots_13457 0x100285d
-#define CLUTTER_KEY_braille_dots_23457 0x100285e
-#define CLUTTER_KEY_braille_dots_123457 0x100285f
-#define CLUTTER_KEY_braille_dots_67 0x1002860
-#define CLUTTER_KEY_braille_dots_167 0x1002861
-#define CLUTTER_KEY_braille_dots_267 0x1002862
-#define CLUTTER_KEY_braille_dots_1267 0x1002863
-#define CLUTTER_KEY_braille_dots_367 0x1002864
-#define CLUTTER_KEY_braille_dots_1367 0x1002865
-#define CLUTTER_KEY_braille_dots_2367 0x1002866
-#define CLUTTER_KEY_braille_dots_12367 0x1002867
-#define CLUTTER_KEY_braille_dots_467 0x1002868
-#define CLUTTER_KEY_braille_dots_1467 0x1002869
-#define CLUTTER_KEY_braille_dots_2467 0x100286a
-#define CLUTTER_KEY_braille_dots_12467 0x100286b
-#define CLUTTER_KEY_braille_dots_3467 0x100286c
-#define CLUTTER_KEY_braille_dots_13467 0x100286d
-#define CLUTTER_KEY_braille_dots_23467 0x100286e
-#define CLUTTER_KEY_braille_dots_123467 0x100286f
-#define CLUTTER_KEY_braille_dots_567 0x1002870
-#define CLUTTER_KEY_braille_dots_1567 0x1002871
-#define CLUTTER_KEY_braille_dots_2567 0x1002872
-#define CLUTTER_KEY_braille_dots_12567 0x1002873
-#define CLUTTER_KEY_braille_dots_3567 0x1002874
-#define CLUTTER_KEY_braille_dots_13567 0x1002875
-#define CLUTTER_KEY_braille_dots_23567 0x1002876
-#define CLUTTER_KEY_braille_dots_123567 0x1002877
-#define CLUTTER_KEY_braille_dots_4567 0x1002878
-#define CLUTTER_KEY_braille_dots_14567 0x1002879
-#define CLUTTER_KEY_braille_dots_24567 0x100287a
-#define CLUTTER_KEY_braille_dots_124567 0x100287b
-#define CLUTTER_KEY_braille_dots_34567 0x100287c
-#define CLUTTER_KEY_braille_dots_134567 0x100287d
-#define CLUTTER_KEY_braille_dots_234567 0x100287e
-#define CLUTTER_KEY_braille_dots_1234567 0x100287f
-#define CLUTTER_KEY_braille_dots_8 0x1002880
-#define CLUTTER_KEY_braille_dots_18 0x1002881
-#define CLUTTER_KEY_braille_dots_28 0x1002882
-#define CLUTTER_KEY_braille_dots_128 0x1002883
-#define CLUTTER_KEY_braille_dots_38 0x1002884
-#define CLUTTER_KEY_braille_dots_138 0x1002885
-#define CLUTTER_KEY_braille_dots_238 0x1002886
-#define CLUTTER_KEY_braille_dots_1238 0x1002887
-#define CLUTTER_KEY_braille_dots_48 0x1002888
-#define CLUTTER_KEY_braille_dots_148 0x1002889
-#define CLUTTER_KEY_braille_dots_248 0x100288a
-#define CLUTTER_KEY_braille_dots_1248 0x100288b
-#define CLUTTER_KEY_braille_dots_348 0x100288c
-#define CLUTTER_KEY_braille_dots_1348 0x100288d
-#define CLUTTER_KEY_braille_dots_2348 0x100288e
-#define CLUTTER_KEY_braille_dots_12348 0x100288f
-#define CLUTTER_KEY_braille_dots_58 0x1002890
-#define CLUTTER_KEY_braille_dots_158 0x1002891
-#define CLUTTER_KEY_braille_dots_258 0x1002892
-#define CLUTTER_KEY_braille_dots_1258 0x1002893
-#define CLUTTER_KEY_braille_dots_358 0x1002894
-#define CLUTTER_KEY_braille_dots_1358 0x1002895
-#define CLUTTER_KEY_braille_dots_2358 0x1002896
-#define CLUTTER_KEY_braille_dots_12358 0x1002897
-#define CLUTTER_KEY_braille_dots_458 0x1002898
-#define CLUTTER_KEY_braille_dots_1458 0x1002899
-#define CLUTTER_KEY_braille_dots_2458 0x100289a
-#define CLUTTER_KEY_braille_dots_12458 0x100289b
-#define CLUTTER_KEY_braille_dots_3458 0x100289c
-#define CLUTTER_KEY_braille_dots_13458 0x100289d
-#define CLUTTER_KEY_braille_dots_23458 0x100289e
-#define CLUTTER_KEY_braille_dots_123458 0x100289f
-#define CLUTTER_KEY_braille_dots_68 0x10028a0
-#define CLUTTER_KEY_braille_dots_168 0x10028a1
-#define CLUTTER_KEY_braille_dots_268 0x10028a2
-#define CLUTTER_KEY_braille_dots_1268 0x10028a3
-#define CLUTTER_KEY_braille_dots_368 0x10028a4
-#define CLUTTER_KEY_braille_dots_1368 0x10028a5
-#define CLUTTER_KEY_braille_dots_2368 0x10028a6
-#define CLUTTER_KEY_braille_dots_12368 0x10028a7
-#define CLUTTER_KEY_braille_dots_468 0x10028a8
-#define CLUTTER_KEY_braille_dots_1468 0x10028a9
-#define CLUTTER_KEY_braille_dots_2468 0x10028aa
-#define CLUTTER_KEY_braille_dots_12468 0x10028ab
-#define CLUTTER_KEY_braille_dots_3468 0x10028ac
-#define CLUTTER_KEY_braille_dots_13468 0x10028ad
-#define CLUTTER_KEY_braille_dots_23468 0x10028ae
-#define CLUTTER_KEY_braille_dots_123468 0x10028af
-#define CLUTTER_KEY_braille_dots_568 0x10028b0
-#define CLUTTER_KEY_braille_dots_1568 0x10028b1
-#define CLUTTER_KEY_braille_dots_2568 0x10028b2
-#define CLUTTER_KEY_braille_dots_12568 0x10028b3
-#define CLUTTER_KEY_braille_dots_3568 0x10028b4
-#define CLUTTER_KEY_braille_dots_13568 0x10028b5
-#define CLUTTER_KEY_braille_dots_23568 0x10028b6
-#define CLUTTER_KEY_braille_dots_123568 0x10028b7
-#define CLUTTER_KEY_braille_dots_4568 0x10028b8
-#define CLUTTER_KEY_braille_dots_14568 0x10028b9
-#define CLUTTER_KEY_braille_dots_24568 0x10028ba
-#define CLUTTER_KEY_braille_dots_124568 0x10028bb
-#define CLUTTER_KEY_braille_dots_34568 0x10028bc
-#define CLUTTER_KEY_braille_dots_134568 0x10028bd
-#define CLUTTER_KEY_braille_dots_234568 0x10028be
-#define CLUTTER_KEY_braille_dots_1234568 0x10028bf
-#define CLUTTER_KEY_braille_dots_78 0x10028c0
-#define CLUTTER_KEY_braille_dots_178 0x10028c1
-#define CLUTTER_KEY_braille_dots_278 0x10028c2
-#define CLUTTER_KEY_braille_dots_1278 0x10028c3
-#define CLUTTER_KEY_braille_dots_378 0x10028c4
-#define CLUTTER_KEY_braille_dots_1378 0x10028c5
-#define CLUTTER_KEY_braille_dots_2378 0x10028c6
-#define CLUTTER_KEY_braille_dots_12378 0x10028c7
-#define CLUTTER_KEY_braille_dots_478 0x10028c8
-#define CLUTTER_KEY_braille_dots_1478 0x10028c9
-#define CLUTTER_KEY_braille_dots_2478 0x10028ca
-#define CLUTTER_KEY_braille_dots_12478 0x10028cb
-#define CLUTTER_KEY_braille_dots_3478 0x10028cc
-#define CLUTTER_KEY_braille_dots_13478 0x10028cd
-#define CLUTTER_KEY_braille_dots_23478 0x10028ce
-#define CLUTTER_KEY_braille_dots_123478 0x10028cf
-#define CLUTTER_KEY_braille_dots_578 0x10028d0
-#define CLUTTER_KEY_braille_dots_1578 0x10028d1
-#define CLUTTER_KEY_braille_dots_2578 0x10028d2
-#define CLUTTER_KEY_braille_dots_12578 0x10028d3
-#define CLUTTER_KEY_braille_dots_3578 0x10028d4
-#define CLUTTER_KEY_braille_dots_13578 0x10028d5
-#define CLUTTER_KEY_braille_dots_23578 0x10028d6
-#define CLUTTER_KEY_braille_dots_123578 0x10028d7
-#define CLUTTER_KEY_braille_dots_4578 0x10028d8
-#define CLUTTER_KEY_braille_dots_14578 0x10028d9
-#define CLUTTER_KEY_braille_dots_24578 0x10028da
-#define CLUTTER_KEY_braille_dots_124578 0x10028db
-#define CLUTTER_KEY_braille_dots_34578 0x10028dc
-#define CLUTTER_KEY_braille_dots_134578 0x10028dd
-#define CLUTTER_KEY_braille_dots_234578 0x10028de
-#define CLUTTER_KEY_braille_dots_1234578 0x10028df
-#define CLUTTER_KEY_braille_dots_678 0x10028e0
-#define CLUTTER_KEY_braille_dots_1678 0x10028e1
-#define CLUTTER_KEY_braille_dots_2678 0x10028e2
-#define CLUTTER_KEY_braille_dots_12678 0x10028e3
-#define CLUTTER_KEY_braille_dots_3678 0x10028e4
-#define CLUTTER_KEY_braille_dots_13678 0x10028e5
-#define CLUTTER_KEY_braille_dots_23678 0x10028e6
-#define CLUTTER_KEY_braille_dots_123678 0x10028e7
-#define CLUTTER_KEY_braille_dots_4678 0x10028e8
-#define CLUTTER_KEY_braille_dots_14678 0x10028e9
-#define CLUTTER_KEY_braille_dots_24678 0x10028ea
-#define CLUTTER_KEY_braille_dots_124678 0x10028eb
-#define CLUTTER_KEY_braille_dots_34678 0x10028ec
-#define CLUTTER_KEY_braille_dots_134678 0x10028ed
-#define CLUTTER_KEY_braille_dots_234678 0x10028ee
-#define CLUTTER_KEY_braille_dots_1234678 0x10028ef
-#define CLUTTER_KEY_braille_dots_5678 0x10028f0
-#define CLUTTER_KEY_braille_dots_15678 0x10028f1
-#define CLUTTER_KEY_braille_dots_25678 0x10028f2
-#define CLUTTER_KEY_braille_dots_125678 0x10028f3
-#define CLUTTER_KEY_braille_dots_35678 0x10028f4
-#define CLUTTER_KEY_braille_dots_135678 0x10028f5
-#define CLUTTER_KEY_braille_dots_235678 0x10028f6
-#define CLUTTER_KEY_braille_dots_1235678 0x10028f7
-#define CLUTTER_KEY_braille_dots_45678 0x10028f8
-#define CLUTTER_KEY_braille_dots_145678 0x10028f9
-#define CLUTTER_KEY_braille_dots_245678 0x10028fa
-#define CLUTTER_KEY_braille_dots_1245678 0x10028fb
-#define CLUTTER_KEY_braille_dots_345678 0x10028fc
-#define CLUTTER_KEY_braille_dots_1345678 0x10028fd
-#define CLUTTER_KEY_braille_dots_2345678 0x10028fe
-#define CLUTTER_KEY_braille_dots_12345678 0x10028ff
-#define CLUTTER_KEY_Sinh_ng 0x1000d82
-#define CLUTTER_KEY_Sinh_h2 0x1000d83
-#define CLUTTER_KEY_Sinh_a 0x1000d85
-#define CLUTTER_KEY_Sinh_aa 0x1000d86
-#define CLUTTER_KEY_Sinh_ae 0x1000d87
-#define CLUTTER_KEY_Sinh_aee 0x1000d88
-#define CLUTTER_KEY_Sinh_i 0x1000d89
-#define CLUTTER_KEY_Sinh_ii 0x1000d8a
-#define CLUTTER_KEY_Sinh_u 0x1000d8b
-#define CLUTTER_KEY_Sinh_uu 0x1000d8c
-#define CLUTTER_KEY_Sinh_ri 0x1000d8d
-#define CLUTTER_KEY_Sinh_rii 0x1000d8e
-#define CLUTTER_KEY_Sinh_lu 0x1000d8f
-#define CLUTTER_KEY_Sinh_luu 0x1000d90
-#define CLUTTER_KEY_Sinh_e 0x1000d91
-#define CLUTTER_KEY_Sinh_ee 0x1000d92
-#define CLUTTER_KEY_Sinh_ai 0x1000d93
-#define CLUTTER_KEY_Sinh_o 0x1000d94
-#define CLUTTER_KEY_Sinh_oo 0x1000d95
-#define CLUTTER_KEY_Sinh_au 0x1000d96
-#define CLUTTER_KEY_Sinh_ka 0x1000d9a
-#define CLUTTER_KEY_Sinh_kha 0x1000d9b
-#define CLUTTER_KEY_Sinh_ga 0x1000d9c
-#define CLUTTER_KEY_Sinh_gha 0x1000d9d
-#define CLUTTER_KEY_Sinh_ng2 0x1000d9e
-#define CLUTTER_KEY_Sinh_nga 0x1000d9f
-#define CLUTTER_KEY_Sinh_ca 0x1000da0
-#define CLUTTER_KEY_Sinh_cha 0x1000da1
-#define CLUTTER_KEY_Sinh_ja 0x1000da2
-#define CLUTTER_KEY_Sinh_jha 0x1000da3
-#define CLUTTER_KEY_Sinh_nya 0x1000da4
-#define CLUTTER_KEY_Sinh_jnya 0x1000da5
-#define CLUTTER_KEY_Sinh_nja 0x1000da6
-#define CLUTTER_KEY_Sinh_tta 0x1000da7
-#define CLUTTER_KEY_Sinh_ttha 0x1000da8
-#define CLUTTER_KEY_Sinh_dda 0x1000da9
-#define CLUTTER_KEY_Sinh_ddha 0x1000daa
-#define CLUTTER_KEY_Sinh_nna 0x1000dab
-#define CLUTTER_KEY_Sinh_ndda 0x1000dac
-#define CLUTTER_KEY_Sinh_tha 0x1000dad
-#define CLUTTER_KEY_Sinh_thha 0x1000dae
-#define CLUTTER_KEY_Sinh_dha 0x1000daf
-#define CLUTTER_KEY_Sinh_dhha 0x1000db0
-#define CLUTTER_KEY_Sinh_na 0x1000db1
-#define CLUTTER_KEY_Sinh_ndha 0x1000db3
-#define CLUTTER_KEY_Sinh_pa 0x1000db4
-#define CLUTTER_KEY_Sinh_pha 0x1000db5
-#define CLUTTER_KEY_Sinh_ba 0x1000db6
-#define CLUTTER_KEY_Sinh_bha 0x1000db7
-#define CLUTTER_KEY_Sinh_ma 0x1000db8
-#define CLUTTER_KEY_Sinh_mba 0x1000db9
-#define CLUTTER_KEY_Sinh_ya 0x1000dba
-#define CLUTTER_KEY_Sinh_ra 0x1000dbb
-#define CLUTTER_KEY_Sinh_la 0x1000dbd
-#define CLUTTER_KEY_Sinh_va 0x1000dc0
-#define CLUTTER_KEY_Sinh_sha 0x1000dc1
-#define CLUTTER_KEY_Sinh_ssha 0x1000dc2
-#define CLUTTER_KEY_Sinh_sa 0x1000dc3
-#define CLUTTER_KEY_Sinh_ha 0x1000dc4
-#define CLUTTER_KEY_Sinh_lla 0x1000dc5
-#define CLUTTER_KEY_Sinh_fa 0x1000dc6
-#define CLUTTER_KEY_Sinh_al 0x1000dca
-#define CLUTTER_KEY_Sinh_aa2 0x1000dcf
-#define CLUTTER_KEY_Sinh_ae2 0x1000dd0
-#define CLUTTER_KEY_Sinh_aee2 0x1000dd1
-#define CLUTTER_KEY_Sinh_i2 0x1000dd2
-#define CLUTTER_KEY_Sinh_ii2 0x1000dd3
-#define CLUTTER_KEY_Sinh_u2 0x1000dd4
-#define CLUTTER_KEY_Sinh_uu2 0x1000dd6
-#define CLUTTER_KEY_Sinh_ru2 0x1000dd8
-#define CLUTTER_KEY_Sinh_e2 0x1000dd9
-#define CLUTTER_KEY_Sinh_ee2 0x1000dda
-#define CLUTTER_KEY_Sinh_ai2 0x1000ddb
-#define CLUTTER_KEY_Sinh_o2 0x1000ddc
-#define CLUTTER_KEY_Sinh_oo2 0x1000ddd
-#define CLUTTER_KEY_Sinh_au2 0x1000dde
-#define CLUTTER_KEY_Sinh_lu2 0x1000ddf
-#define CLUTTER_KEY_Sinh_ruu2 0x1000df2
-#define CLUTTER_KEY_Sinh_luu2 0x1000df3
-#define CLUTTER_KEY_Sinh_kunddaliya 0x1000df4
-#define CLUTTER_KEY_ModeLock 0x1008ff01
-#define CLUTTER_KEY_MonBrightnessUp 0x1008ff02
-#define CLUTTER_KEY_MonBrightnessDown 0x1008ff03
-#define CLUTTER_KEY_KbdLightOnOff 0x1008ff04
-#define CLUTTER_KEY_KbdBrightnessUp 0x1008ff05
-#define CLUTTER_KEY_KbdBrightnessDown 0x1008ff06
-#define CLUTTER_KEY_Standby 0x1008ff10
-#define CLUTTER_KEY_AudioLowerVolume 0x1008ff11
-#define CLUTTER_KEY_AudioMute 0x1008ff12
-#define CLUTTER_KEY_AudioRaiseVolume 0x1008ff13
-#define CLUTTER_KEY_AudioPlay 0x1008ff14
-#define CLUTTER_KEY_AudioStop 0x1008ff15
-#define CLUTTER_KEY_AudioPrev 0x1008ff16
-#define CLUTTER_KEY_AudioNext 0x1008ff17
-#define CLUTTER_KEY_HomePage 0x1008ff18
-#define CLUTTER_KEY_Mail 0x1008ff19
-#define CLUTTER_KEY_Start 0x1008ff1a
-#define CLUTTER_KEY_Search 0x1008ff1b
-#define CLUTTER_KEY_AudioRecord 0x1008ff1c
-#define CLUTTER_KEY_Calculator 0x1008ff1d
-#define CLUTTER_KEY_Memo 0x1008ff1e
-#define CLUTTER_KEY_ToDoList 0x1008ff1f
-#define CLUTTER_KEY_Calendar 0x1008ff20
-#define CLUTTER_KEY_PowerDown 0x1008ff21
-#define CLUTTER_KEY_ContrastAdjust 0x1008ff22
-#define CLUTTER_KEY_RockerUp 0x1008ff23
-#define CLUTTER_KEY_RockerDown 0x1008ff24
-#define CLUTTER_KEY_RockerEnter 0x1008ff25
-#define CLUTTER_KEY_Back 0x1008ff26
-#define CLUTTER_KEY_Forward 0x1008ff27
-#define CLUTTER_KEY_Stop 0x1008ff28
-#define CLUTTER_KEY_Refresh 0x1008ff29
-#define CLUTTER_KEY_PowerOff 0x1008ff2a
-#define CLUTTER_KEY_WakeUp 0x1008ff2b
-#define CLUTTER_KEY_Eject 0x1008ff2c
-#define CLUTTER_KEY_ScreenSaver 0x1008ff2d
-#define CLUTTER_KEY_WWW 0x1008ff2e
-#define CLUTTER_KEY_Sleep 0x1008ff2f
-#define CLUTTER_KEY_Favorites 0x1008ff30
-#define CLUTTER_KEY_AudioPause 0x1008ff31
-#define CLUTTER_KEY_AudioMedia 0x1008ff32
-#define CLUTTER_KEY_MyComputer 0x1008ff33
-#define CLUTTER_KEY_VendorHome 0x1008ff34
-#define CLUTTER_KEY_LightBulb 0x1008ff35
-#define CLUTTER_KEY_Shop 0x1008ff36
-#define CLUTTER_KEY_History 0x1008ff37
-#define CLUTTER_KEY_OpenURL 0x1008ff38
-#define CLUTTER_KEY_AddFavorite 0x1008ff39
-#define CLUTTER_KEY_HotLinks 0x1008ff3a
-#define CLUTTER_KEY_BrightnessAdjust 0x1008ff3b
-#define CLUTTER_KEY_Finance 0x1008ff3c
-#define CLUTTER_KEY_Community 0x1008ff3d
-#define CLUTTER_KEY_AudioRewind 0x1008ff3e
-#define CLUTTER_KEY_BackForward 0x1008ff3f
-#define CLUTTER_KEY_Launch0 0x1008ff40
-#define CLUTTER_KEY_Launch1 0x1008ff41
-#define CLUTTER_KEY_Launch2 0x1008ff42
-#define CLUTTER_KEY_Launch3 0x1008ff43
-#define CLUTTER_KEY_Launch4 0x1008ff44
-#define CLUTTER_KEY_Launch5 0x1008ff45
-#define CLUTTER_KEY_Launch6 0x1008ff46
-#define CLUTTER_KEY_Launch7 0x1008ff47
-#define CLUTTER_KEY_Launch8 0x1008ff48
-#define CLUTTER_KEY_Launch9 0x1008ff49
-#define CLUTTER_KEY_LaunchA 0x1008ff4a
-#define CLUTTER_KEY_LaunchB 0x1008ff4b
-#define CLUTTER_KEY_LaunchC 0x1008ff4c
-#define CLUTTER_KEY_LaunchD 0x1008ff4d
-#define CLUTTER_KEY_LaunchE 0x1008ff4e
-#define CLUTTER_KEY_LaunchF 0x1008ff4f
-#define CLUTTER_KEY_ApplicationLeft 0x1008ff50
-#define CLUTTER_KEY_ApplicationRight 0x1008ff51
-#define CLUTTER_KEY_Book 0x1008ff52
-#define CLUTTER_KEY_CD 0x1008ff53
-#define CLUTTER_KEY_WindowClear 0x1008ff55
-#define CLUTTER_KEY_Close 0x1008ff56
-#define CLUTTER_KEY_Copy 0x1008ff57
-#define CLUTTER_KEY_Cut 0x1008ff58
-#define CLUTTER_KEY_Display 0x1008ff59
-#define CLUTTER_KEY_DOS 0x1008ff5a
-#define CLUTTER_KEY_Documents 0x1008ff5b
-#define CLUTTER_KEY_Excel 0x1008ff5c
-#define CLUTTER_KEY_Explorer 0x1008ff5d
-#define CLUTTER_KEY_Game 0x1008ff5e
-#define CLUTTER_KEY_Go 0x1008ff5f
-#define CLUTTER_KEY_iTouch 0x1008ff60
-#define CLUTTER_KEY_LogOff 0x1008ff61
-#define CLUTTER_KEY_Market 0x1008ff62
-#define CLUTTER_KEY_Meeting 0x1008ff63
-#define CLUTTER_KEY_MenuKB 0x1008ff65
-#define CLUTTER_KEY_MenuPB 0x1008ff66
-#define CLUTTER_KEY_MySites 0x1008ff67
-#define CLUTTER_KEY_New 0x1008ff68
-#define CLUTTER_KEY_News 0x1008ff69
-#define CLUTTER_KEY_OfficeHome 0x1008ff6a
-#define CLUTTER_KEY_Open 0x1008ff6b
-#define CLUTTER_KEY_Option 0x1008ff6c
-#define CLUTTER_KEY_Paste 0x1008ff6d
-#define CLUTTER_KEY_Phone 0x1008ff6e
-#define CLUTTER_KEY_Reply 0x1008ff72
-#define CLUTTER_KEY_Reload 0x1008ff73
-#define CLUTTER_KEY_RotateWindows 0x1008ff74
-#define CLUTTER_KEY_RotationPB 0x1008ff75
-#define CLUTTER_KEY_RotationKB 0x1008ff76
-#define CLUTTER_KEY_Save 0x1008ff77
-#define CLUTTER_KEY_ScrollUp 0x1008ff78
-#define CLUTTER_KEY_ScrollDown 0x1008ff79
-#define CLUTTER_KEY_ScrollClick 0x1008ff7a
-#define CLUTTER_KEY_Send 0x1008ff7b
-#define CLUTTER_KEY_Spell 0x1008ff7c
-#define CLUTTER_KEY_SplitScreen 0x1008ff7d
-#define CLUTTER_KEY_Support 0x1008ff7e
-#define CLUTTER_KEY_TaskPane 0x1008ff7f
-#define CLUTTER_KEY_Terminal 0x1008ff80
-#define CLUTTER_KEY_Tools 0x1008ff81
-#define CLUTTER_KEY_Travel 0x1008ff82
-#define CLUTTER_KEY_UserPB 0x1008ff84
-#define CLUTTER_KEY_User1KB 0x1008ff85
-#define CLUTTER_KEY_User2KB 0x1008ff86
-#define CLUTTER_KEY_Video 0x1008ff87
-#define CLUTTER_KEY_WheelButton 0x1008ff88
-#define CLUTTER_KEY_Word 0x1008ff89
-#define CLUTTER_KEY_Xfer 0x1008ff8a
-#define CLUTTER_KEY_ZoomIn 0x1008ff8b
-#define CLUTTER_KEY_ZoomOut 0x1008ff8c
-#define CLUTTER_KEY_Away 0x1008ff8d
-#define CLUTTER_KEY_Messenger 0x1008ff8e
-#define CLUTTER_KEY_WebCam 0x1008ff8f
-#define CLUTTER_KEY_MailForward 0x1008ff90
-#define CLUTTER_KEY_Pictures 0x1008ff91
-#define CLUTTER_KEY_Music 0x1008ff92
-#define CLUTTER_KEY_Battery 0x1008ff93
-#define CLUTTER_KEY_Bluetooth 0x1008ff94
-#define CLUTTER_KEY_WLAN 0x1008ff95
-#define CLUTTER_KEY_UWB 0x1008ff96
-#define CLUTTER_KEY_AudioForward 0x1008ff97
-#define CLUTTER_KEY_AudioRepeat 0x1008ff98
-#define CLUTTER_KEY_AudioRandomPlay 0x1008ff99
-#define CLUTTER_KEY_Subtitle 0x1008ff9a
-#define CLUTTER_KEY_AudioCycleTrack 0x1008ff9b
-#define CLUTTER_KEY_CycleAngle 0x1008ff9c
-#define CLUTTER_KEY_FrameBack 0x1008ff9d
-#define CLUTTER_KEY_FrameForward 0x1008ff9e
-#define CLUTTER_KEY_Time 0x1008ff9f
-#define CLUTTER_KEY_SelectButton 0x1008ffa0
-#define CLUTTER_KEY_View 0x1008ffa1
-#define CLUTTER_KEY_TopMenu 0x1008ffa2
-#define CLUTTER_KEY_Red 0x1008ffa3
-#define CLUTTER_KEY_Green 0x1008ffa4
-#define CLUTTER_KEY_Yellow 0x1008ffa5
-#define CLUTTER_KEY_Blue 0x1008ffa6
-#define CLUTTER_KEY_Suspend 0x1008ffa7
-#define CLUTTER_KEY_Hibernate 0x1008ffa8
-#define CLUTTER_KEY_TouchpadToggle 0x1008ffa9
-#define CLUTTER_KEY_TouchpadOn 0x1008ffb0
-#define CLUTTER_KEY_TouchpadOff 0x1008ffb1
-#define CLUTTER_KEY_AudioMicMute 0x1008ffb2
-#define CLUTTER_KEY_Switch_VT_1 0x1008fe01
-#define CLUTTER_KEY_Switch_VT_2 0x1008fe02
-#define CLUTTER_KEY_Switch_VT_3 0x1008fe03
-#define CLUTTER_KEY_Switch_VT_4 0x1008fe04
-#define CLUTTER_KEY_Switch_VT_5 0x1008fe05
-#define CLUTTER_KEY_Switch_VT_6 0x1008fe06
-#define CLUTTER_KEY_Switch_VT_7 0x1008fe07
-#define CLUTTER_KEY_Switch_VT_8 0x1008fe08
-#define CLUTTER_KEY_Switch_VT_9 0x1008fe09
-#define CLUTTER_KEY_Switch_VT_10 0x1008fe0a
-#define CLUTTER_KEY_Switch_VT_11 0x1008fe0b
-#define CLUTTER_KEY_Switch_VT_12 0x1008fe0c
-#define CLUTTER_KEY_Ungrab 0x1008fe20
-#define CLUTTER_KEY_ClearGrab 0x1008fe21
-#define CLUTTER_KEY_Next_VMode 0x1008fe22
-#define CLUTTER_KEY_Prev_VMode 0x1008fe23
-#define CLUTTER_KEY_LogWindowTree 0x1008fe24
-#define CLUTTER_KEY_LogGrabInfo 0x1008fe25
-
-#endif /* __CLUTTER_KEYSYMS_H__ */
diff --git a/clutter/clutter/clutter-layout-manager.c b/clutter/clutter/clutter-layout-manager.c
deleted file mode 100644
index 3fe02a196..000000000
--- a/clutter/clutter/clutter-layout-manager.c
+++ /dev/null
@@ -1,1010 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2009 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-layout-manager
- * @short_description: Layout managers base class
- *
- * #ClutterLayoutManager is a base abstract class for layout managers. A
- * layout manager implements the layouting policy for a composite or a
- * container actor: it controls the preferred size of the actor to which
- * it has been paired, and it controls the allocation of its children.
- *
- * Any composite or container #ClutterActor subclass can delegate the
- * layouting of its children to a #ClutterLayoutManager.
- *
- * Clutter provides some simple #ClutterLayoutManager sub-classes, like
- * #ClutterFlowLayout and #ClutterBinLayout.
- *
- * ## Implementing a ClutterLayoutManager
- * The implementation of a layout manager does not differ from the
- * implementation of the size requisition and allocation bits of
- * #ClutterActor, so you should read the relative documentation
- * for subclassing #ClutterActor.
- *
- * The layout manager implementation can hold a back pointer to the
- * #ClutterContainer by implementing the #ClutterLayoutManagerClass.set_container()
- * virtual function. The layout manager should not hold a real reference (i.e.
- * call g_object_ref()) on the container actor, to avoid reference cycles.
- *
- * If a layout manager has properties affecting the layout policies then it should
- * emit the #ClutterLayoutManager::layout-changed signal on itself by using the
- * clutter_layout_manager_layout_changed() function whenever one of these properties
- * changes.
- *
- * ## Layout Properties
- *
- * If a layout manager has layout properties, that is properties that
- * should exist only as the result of the presence of a specific (layout
- * manager, container actor, child actor) combination, and it wishes to store
- * those properties inside a #ClutterLayoutMeta, then it should override the
- * #ClutterLayoutManagerClass.get_child_meta_type() virtual function to return
- * the #GType of the #ClutterLayoutMeta sub-class used to store the layout
- * properties; optionally, the #ClutterLayoutManager sub-class might also
- * override the #ClutterLayoutManagerClass.create_child_meta() virtual function
- * to control how the #ClutterLayoutMeta instance is created, otherwise the
- * default implementation will be equivalent to:
- *
- * |[
- * ClutterLayoutManagerClass *klass;
- * GType meta_type;
- *
- * klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
- * meta_type = klass->get_child_meta_type (manager);
- *
- * return g_object_new (meta_type,
- * "manager", manager,
- * "container", container,
- * "actor", actor,
- * NULL);
- * ]|
- *
- * Where `manager` is the #ClutterLayoutManager, `container` is the
- * #ClutterContainer using the #ClutterLayoutManager, and `actor` is
- * the #ClutterActor child of the #ClutterContainer.
- *
- * ## Using ClutterLayoutManager with ClutterScript
- *
- * #ClutterLayoutManager instances can be created in the same way
- * as other objects in #ClutterScript; properties can be set using the
- * common syntax.
- *
- * Layout properties can be set on children of a container with
- * a #ClutterLayoutManager using the `layout::` modifier on the property
- * name, for instance:
- *
- * |[
- * {
- * "type" : "ClutterActor",
- * "layout-manager" : { "type" : "ClutterGridLayout" },
- * "children" : [
- * {
- * "type" : "ClutterText",
- * "text" : "Some text",
- *
- * "layout::row" : 0,
- * "layout::column" : 0,
- * "layout::x-align" : "left",
- * "layout::y-align" : "center",
- * "layout::x-expand" : true,
- * "layout::y-expand" : true
- * },
- * {
- * "type" : "ClutterText",
- * "text" : "Some more text",
- *
- * "layout::row" : 0,
- * "layout::column" : 1,
- * "layout::x-align" : "right",
- * "layout::y-align" : "center",
- * "layout::x-expand" : true,
- * "layout::y-expand" : true
- * }
- * ]
- * }
- * ]|
- *
- * #ClutterLayoutManager is available since Clutter 1.2
- */
-
-#include "clutter-build-config.h"
-
-#include <glib-object.h>
-#include <gobject/gvaluecollector.h>
-
-#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
-#include "deprecated/clutter-container.h"
-
-#include "clutter-debug.h"
-#include "clutter-layout-manager.h"
-#include "clutter-layout-meta.h"
-#include "clutter-marshal.h"
-#include "clutter-private.h"
-#include "clutter-timeline.h"
-
-#define LAYOUT_MANAGER_WARN_NOT_IMPLEMENTED(m,method) G_STMT_START { \
- GObject *_obj = G_OBJECT (m); \
- g_warning ("Layout managers of type %s do not implement " \
- "the ClutterLayoutManager::%s method", \
- G_OBJECT_TYPE_NAME (_obj), \
- (method)); } G_STMT_END
-
-enum
-{
- LAYOUT_CHANGED,
-
- LAST_SIGNAL
-};
-
-G_DEFINE_ABSTRACT_TYPE (ClutterLayoutManager,
- clutter_layout_manager,
- G_TYPE_INITIALLY_UNOWNED)
-
-static GQuark quark_layout_meta = 0;
-
-static guint manager_signals[LAST_SIGNAL] = { 0, };
-
-static void
-layout_manager_freeze_layout_change (ClutterLayoutManager *manager)
-{
- gpointer is_frozen;
-
- CLUTTER_NOTE (LAYOUT, "Freezing changes for manager '%s'[%p]",
- G_OBJECT_TYPE_NAME (manager),
- manager);
-
- is_frozen = g_object_get_data (G_OBJECT (manager), "freeze-change");
- if (is_frozen == NULL)
- g_object_set_data (G_OBJECT (manager), "freeze-change",
- GUINT_TO_POINTER (1));
- else
- {
- guint level = GPOINTER_TO_UINT (is_frozen) + 1;
-
- g_object_set_data (G_OBJECT (manager), "freeze-change",
- GUINT_TO_POINTER (level));
- }
-}
-
-static void
-layout_manager_thaw_layout_change (ClutterLayoutManager *manager)
-{
- gpointer is_frozen;
-
- is_frozen = g_object_get_data (G_OBJECT (manager), "freeze-change");
- if (is_frozen == NULL)
- g_critical (G_STRLOC ": Mismatched thaw; you have to call "
- "clutter_layout_manager_freeze_layout_change() prior to "
- "calling clutter_layout_manager_thaw_layout_change()");
- else
- {
- guint level = GPOINTER_TO_UINT (is_frozen);
-
- g_assert (level > 0);
-
- CLUTTER_NOTE (LAYOUT, "Thawing changes for manager '%s'[%p]",
- G_OBJECT_TYPE_NAME (manager),
- manager);
-
- level -= 1;
- if (level == 0)
- g_object_set_data (G_OBJECT (manager), "freeze-change", NULL);
- else
- g_object_set_data (G_OBJECT (manager), "freeze-change",
- GUINT_TO_POINTER (level));
- }
-
-}
-
-static void
-layout_manager_real_get_preferred_width (ClutterLayoutManager *manager,
- ClutterContainer *container,
- gfloat for_height,
- gfloat *min_width_p,
- gfloat *nat_width_p)
-{
- LAYOUT_MANAGER_WARN_NOT_IMPLEMENTED (manager, "get_preferred_width");
-
- if (min_width_p)
- *min_width_p = 0.0;
-
- if (nat_width_p)
- *nat_width_p = 0.0;
-}
-
-static void
-layout_manager_real_get_preferred_height (ClutterLayoutManager *manager,
- ClutterContainer *container,
- gfloat for_width,
- gfloat *min_height_p,
- gfloat *nat_height_p)
-{
- LAYOUT_MANAGER_WARN_NOT_IMPLEMENTED (manager, "get_preferred_height");
-
- if (min_height_p)
- *min_height_p = 0.0;
-
- if (nat_height_p)
- *nat_height_p = 0.0;
-}
-
-static void
-layout_manager_real_allocate (ClutterLayoutManager *manager,
- ClutterContainer *container,
- const ClutterActorBox *allocation)
-{
- LAYOUT_MANAGER_WARN_NOT_IMPLEMENTED (manager, "allocate");
-}
-
-static void
-layout_manager_real_set_container (ClutterLayoutManager *manager,
- ClutterContainer *container)
-{
- if (container != NULL)
- g_object_set_data (G_OBJECT (container), "clutter-layout-manager", manager);
-}
-
-static ClutterLayoutMeta *
-layout_manager_real_create_child_meta (ClutterLayoutManager *manager,
- ClutterContainer *container,
- ClutterActor *actor)
-{
- ClutterLayoutManagerClass *klass;
- GType meta_type;
-
- klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
- meta_type = klass->get_child_meta_type (manager);
-
- /* provide a default implementation to reduce common code */
- if (meta_type != G_TYPE_INVALID)
- {
- g_assert (g_type_is_a (meta_type, CLUTTER_TYPE_LAYOUT_META));
-
- return g_object_new (meta_type,
- "manager", manager,
- "container", container,
- "actor", actor,
- NULL);
- }
-
- return NULL;
-}
-
-static GType
-layout_manager_real_get_child_meta_type (ClutterLayoutManager *manager)
-{
- return G_TYPE_INVALID;
-}
-
-static void
-clutter_layout_manager_class_init (ClutterLayoutManagerClass *klass)
-{
- quark_layout_meta =
- g_quark_from_static_string ("clutter-layout-manager-child-meta");
-
- klass->get_preferred_width = layout_manager_real_get_preferred_width;
- klass->get_preferred_height = layout_manager_real_get_preferred_height;
- klass->allocate = layout_manager_real_allocate;
- klass->create_child_meta = layout_manager_real_create_child_meta;
- klass->get_child_meta_type = layout_manager_real_get_child_meta_type;
-
- /* XXX:2.0 - Remove */
- klass->set_container = layout_manager_real_set_container;
-
- /**
- * ClutterLayoutManager::layout-changed:
- * @manager: the #ClutterLayoutManager that emitted the signal
- *
- * The ::layout-changed signal is emitted each time a layout manager
- * has been changed. Every #ClutterActor using the @manager instance
- * as a layout manager should connect a handler to the ::layout-changed
- * signal and queue a relayout on themselves:
- *
- * |[
- * static void layout_changed (ClutterLayoutManager *manager,
- * ClutterActor *self)
- * {
- * clutter_actor_queue_relayout (self);
- * }
- * ...
- * self->manager = g_object_ref_sink (manager);
- * g_signal_connect (self->manager, "layout-changed",
- * G_CALLBACK (layout_changed),
- * self);
- * ]|
- *
- * Sub-classes of #ClutterLayoutManager that implement a layout that
- * can be controlled or changed using parameters should emit the
- * ::layout-changed signal whenever one of the parameters changes,
- * by using clutter_layout_manager_layout_changed().
- *
- * Since: 1.2
- */
- manager_signals[LAYOUT_CHANGED] =
- g_signal_new (I_("layout-changed"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterLayoutManagerClass,
- layout_changed),
- NULL, NULL, NULL,
- G_TYPE_NONE, 0);
-}
-
-static void
-clutter_layout_manager_init (ClutterLayoutManager *manager)
-{
-}
-
-/**
- * clutter_layout_manager_get_preferred_width:
- * @manager: a #ClutterLayoutManager
- * @container: the #ClutterContainer using @manager
- * @for_height: the height for which the width should be computed, or -1
- * @min_width_p: (out) (allow-none): return location for the minimum width
- * of the layout, or %NULL
- * @nat_width_p: (out) (allow-none): return location for the natural width
- * of the layout, or %NULL
- *
- * Computes the minimum and natural widths of the @container according
- * to @manager.
- *
- * See also clutter_actor_get_preferred_width()
- *
- * Since: 1.2
- */
-void
-clutter_layout_manager_get_preferred_width (ClutterLayoutManager *manager,
- ClutterContainer *container,
- gfloat for_height,
- gfloat *min_width_p,
- gfloat *nat_width_p)
-{
- ClutterLayoutManagerClass *klass;
-
- g_return_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager));
- g_return_if_fail (CLUTTER_IS_CONTAINER (container));
-
- klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
- klass->get_preferred_width (manager, container, for_height,
- min_width_p,
- nat_width_p);
-}
-
-/**
- * clutter_layout_manager_get_preferred_height:
- * @manager: a #ClutterLayoutManager
- * @container: the #ClutterContainer using @manager
- * @for_width: the width for which the height should be computed, or -1
- * @min_height_p: (out) (allow-none): return location for the minimum height
- * of the layout, or %NULL
- * @nat_height_p: (out) (allow-none): return location for the natural height
- * of the layout, or %NULL
- *
- * Computes the minimum and natural heights of the @container according
- * to @manager.
- *
- * See also clutter_actor_get_preferred_height()
- *
- * Since: 1.2
- */
-void
-clutter_layout_manager_get_preferred_height (ClutterLayoutManager *manager,
- ClutterContainer *container,
- gfloat for_width,
- gfloat *min_height_p,
- gfloat *nat_height_p)
-{
- ClutterLayoutManagerClass *klass;
-
- g_return_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager));
- g_return_if_fail (CLUTTER_IS_CONTAINER (container));
-
- klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
- klass->get_preferred_height (manager, container, for_width,
- min_height_p,
- nat_height_p);
-}
-
-/**
- * clutter_layout_manager_allocate:
- * @manager: a #ClutterLayoutManager
- * @container: the #ClutterContainer using @manager
- * @allocation: the #ClutterActorBox containing the allocated area
- * of @container
- *
- * Allocates the children of @container given an area
- *
- * See also clutter_actor_allocate()
- *
- * Since: 1.2
- */
-void
-clutter_layout_manager_allocate (ClutterLayoutManager *manager,
- ClutterContainer *container,
- const ClutterActorBox *allocation)
-{
- ClutterLayoutManagerClass *klass;
-
- g_return_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager));
- g_return_if_fail (CLUTTER_IS_CONTAINER (container));
- g_return_if_fail (allocation != NULL);
-
- klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
- klass->allocate (manager, container, allocation);
-}
-
-/**
- * clutter_layout_manager_layout_changed:
- * @manager: a #ClutterLayoutManager
- *
- * Emits the #ClutterLayoutManager::layout-changed signal on @manager
- *
- * This function should only be called by implementations of the
- * #ClutterLayoutManager class
- *
- * Since: 1.2
- */
-void
-clutter_layout_manager_layout_changed (ClutterLayoutManager *manager)
-{
- gpointer is_frozen;
-
- g_return_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager));
-
- is_frozen = g_object_get_data (G_OBJECT (manager), "freeze-change");
- if (is_frozen == NULL)
- g_signal_emit (manager, manager_signals[LAYOUT_CHANGED], 0);
- else
- CLUTTER_NOTE (LAYOUT, "Layout manager '%s'[%p] has been frozen",
- G_OBJECT_TYPE_NAME (manager),
- manager);
-}
-
-/**
- * clutter_layout_manager_set_container:
- * @manager: a #ClutterLayoutManager
- * @container: (allow-none): a #ClutterContainer using @manager
- *
- * If the #ClutterLayoutManager sub-class allows it, allow
- * adding a weak reference of the @container using @manager
- * from within the layout manager
- *
- * The layout manager should not increase the reference
- * count of the @container
- *
- * Since: 1.2
- */
-void
-clutter_layout_manager_set_container (ClutterLayoutManager *manager,
- ClutterContainer *container)
-{
- ClutterLayoutManagerClass *klass;
-
- g_return_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager));
- g_return_if_fail (container == NULL || CLUTTER_IS_CONTAINER (container));
-
- klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
- if (klass->set_container)
- klass->set_container (manager, container);
-}
-
-GType
-_clutter_layout_manager_get_child_meta_type (ClutterLayoutManager *manager)
-{
- return CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager)->get_child_meta_type (manager);
-}
-
-static inline ClutterLayoutMeta *
-create_child_meta (ClutterLayoutManager *manager,
- ClutterContainer *container,
- ClutterActor *actor)
-{
- ClutterLayoutManagerClass *klass;
- ClutterLayoutMeta *meta = NULL;
-
- layout_manager_freeze_layout_change (manager);
-
- klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
- if (klass->get_child_meta_type (manager) != G_TYPE_INVALID)
- meta = klass->create_child_meta (manager, container, actor);
-
- layout_manager_thaw_layout_change (manager);
-
- return meta;
-}
-
-static inline ClutterLayoutMeta *
-get_child_meta (ClutterLayoutManager *manager,
- ClutterContainer *container,
- ClutterActor *actor)
-{
- ClutterLayoutMeta *layout = NULL;
-
- layout = g_object_get_qdata (G_OBJECT (actor), quark_layout_meta);
- if (layout != NULL)
- {
- ClutterChildMeta *child = CLUTTER_CHILD_META (layout);
-
- if (layout->manager == manager &&
- child->container == container &&
- child->actor == actor)
- return layout;
-
- /* if the LayoutMeta referenced is not attached to the
- * layout manager then we simply ask the layout manager
- * to replace it with the right one
- */
- }
-
- layout = create_child_meta (manager, container, actor);
- if (layout != NULL)
- {
- g_assert (CLUTTER_IS_LAYOUT_META (layout));
- g_object_set_qdata_full (G_OBJECT (actor), quark_layout_meta,
- layout,
- (GDestroyNotify) g_object_unref);
- return layout;
- }
-
- return NULL;
-}
-
-/**
- * clutter_layout_manager_get_child_meta:
- * @manager: a #ClutterLayoutManager
- * @container: a #ClutterContainer using @manager
- * @actor: a #ClutterActor child of @container
- *
- * Retrieves the #ClutterLayoutMeta that the layout @manager associated
- * to the @actor child of @container, eventually by creating one if the
- * #ClutterLayoutManager supports layout properties
- *
- * Return value: (transfer none): a #ClutterLayoutMeta, or %NULL if the
- * #ClutterLayoutManager does not have layout properties. The returned
- * layout meta instance is owned by the #ClutterLayoutManager and it
- * should not be unreferenced
- *
- * Since: 1.0
- */
-ClutterLayoutMeta *
-clutter_layout_manager_get_child_meta (ClutterLayoutManager *manager,
- ClutterContainer *container,
- ClutterActor *actor)
-{
- g_return_val_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager), NULL);
- g_return_val_if_fail (CLUTTER_IS_CONTAINER (container), NULL);
- g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), NULL);
-
- return get_child_meta (manager, container, actor);
-}
-
-static inline gboolean
-layout_set_property_internal (ClutterLayoutManager *manager,
- GObject *gobject,
- GParamSpec *pspec,
- const GValue *value)
-{
- if (pspec->flags & G_PARAM_CONSTRUCT_ONLY)
- {
- g_warning ("%s: Child property '%s' of the layout manager of "
- "type '%s' is constructor-only",
- G_STRLOC, pspec->name, G_OBJECT_TYPE_NAME (manager));
- return FALSE;
- }
-
- if (!(pspec->flags & G_PARAM_WRITABLE))
- {
- g_warning ("%s: Child property '%s' of the layout manager of "
- "type '%s' is not writable",
- G_STRLOC, pspec->name, G_OBJECT_TYPE_NAME (manager));
- return FALSE;
- }
-
- g_object_set_property (gobject, pspec->name, value);
-
- return TRUE;
-}
-
-static inline gboolean
-layout_get_property_internal (ClutterLayoutManager *manager,
- GObject *gobject,
- GParamSpec *pspec,
- GValue *value)
-{
- if (!(pspec->flags & G_PARAM_READABLE))
- {
- g_warning ("%s: Child property '%s' of the layout manager of "
- "type '%s' is not readable",
- G_STRLOC, pspec->name, G_OBJECT_TYPE_NAME (manager));
- return FALSE;
- }
-
- g_object_get_property (gobject, pspec->name, value);
-
- return TRUE;
-}
-
-/**
- * clutter_layout_manager_child_set:
- * @manager: a #ClutterLayoutManager
- * @container: a #ClutterContainer using @manager
- * @actor: a #ClutterActor child of @container
- * @first_property: the first property name
- * @...: a list of property name and value pairs
- *
- * Sets a list of properties and their values on the #ClutterLayoutMeta
- * associated by @manager to a child of @container
- *
- * Languages bindings should use clutter_layout_manager_child_set_property()
- * instead
- *
- * Since: 1.2
- */
-void
-clutter_layout_manager_child_set (ClutterLayoutManager *manager,
- ClutterContainer *container,
- ClutterActor *actor,
- const gchar *first_property,
- ...)
-{
- ClutterLayoutMeta *meta;
- GObjectClass *klass;
- const gchar *pname;
- va_list var_args;
-
- g_return_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager));
- g_return_if_fail (CLUTTER_IS_CONTAINER (container));
- g_return_if_fail (CLUTTER_IS_ACTOR (actor));
- g_return_if_fail (first_property != NULL);
-
- meta = get_child_meta (manager, container, actor);
- if (meta == NULL)
- {
- g_warning ("Layout managers of type '%s' do not support "
- "layout metadata",
- g_type_name (G_OBJECT_TYPE (manager)));
- return;
- }
-
- klass = G_OBJECT_GET_CLASS (meta);
-
- va_start (var_args, first_property);
-
- pname = first_property;
- while (pname)
- {
- GValue value = G_VALUE_INIT;
- GParamSpec *pspec;
- gchar *error;
- gboolean res;
-
- pspec = g_object_class_find_property (klass, pname);
- if (pspec == NULL)
- {
- g_warning ("%s: Layout managers of type '%s' have no layout "
- "property named '%s'",
- G_STRLOC, G_OBJECT_TYPE_NAME (manager), pname);
- break;
- }
-
- G_VALUE_COLLECT_INIT (&value, G_PARAM_SPEC_VALUE_TYPE (pspec),
- var_args, 0,
- &error);
-
- if (error)
- {
- g_warning ("%s: %s", G_STRLOC, error);
- g_free (error);
- break;
- }
-
- res = layout_set_property_internal (manager, G_OBJECT (meta),
- pspec,
- &value);
-
- g_value_unset (&value);
-
- if (!res)
- break;
-
- pname = va_arg (var_args, gchar*);
- }
-
- va_end (var_args);
-}
-
-/**
- * clutter_layout_manager_child_set_property:
- * @manager: a #ClutterLayoutManager
- * @container: a #ClutterContainer using @manager
- * @actor: a #ClutterActor child of @container
- * @property_name: the name of the property to set
- * @value: a #GValue with the value of the property to set
- *
- * Sets a property on the #ClutterLayoutMeta created by @manager and
- * attached to a child of @container
- *
- * Since: 1.2
- */
-void
-clutter_layout_manager_child_set_property (ClutterLayoutManager *manager,
- ClutterContainer *container,
- ClutterActor *actor,
- const gchar *property_name,
- const GValue *value)
-{
- ClutterLayoutMeta *meta;
- GObjectClass *klass;
- GParamSpec *pspec;
-
- g_return_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager));
- g_return_if_fail (CLUTTER_IS_CONTAINER (container));
- g_return_if_fail (CLUTTER_IS_ACTOR (actor));
- g_return_if_fail (property_name != NULL);
- g_return_if_fail (value != NULL);
-
- meta = get_child_meta (manager, container, actor);
- if (meta == NULL)
- {
- g_warning ("Layout managers of type '%s' do not support "
- "layout metadata",
- g_type_name (G_OBJECT_TYPE (manager)));
- return;
- }
-
- klass = G_OBJECT_GET_CLASS (meta);
-
- pspec = g_object_class_find_property (klass, property_name);
- if (pspec == NULL)
- {
- g_warning ("%s: Layout managers of type '%s' have no layout "
- "property named '%s'",
- G_STRLOC, G_OBJECT_TYPE_NAME (manager), property_name);
- return;
- }
-
- layout_set_property_internal (manager, G_OBJECT (meta), pspec, value);
-}
-
-/**
- * clutter_layout_manager_child_get:
- * @manager: a #ClutterLayoutManager
- * @container: a #ClutterContainer using @manager
- * @actor: a #ClutterActor child of @container
- * @first_property: the name of the first property
- * @...: a list of property name and return location for the value pairs
- *
- * Retrieves the values for a list of properties out of the
- * #ClutterLayoutMeta created by @manager and attached to the
- * child of a @container
- *
- * Since: 1.2
- */
-void
-clutter_layout_manager_child_get (ClutterLayoutManager *manager,
- ClutterContainer *container,
- ClutterActor *actor,
- const gchar *first_property,
- ...)
-{
- ClutterLayoutMeta *meta;
- GObjectClass *klass;
- const gchar *pname;
- va_list var_args;
-
- g_return_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager));
- g_return_if_fail (CLUTTER_IS_CONTAINER (container));
- g_return_if_fail (CLUTTER_IS_ACTOR (actor));
- g_return_if_fail (first_property != NULL);
-
- meta = get_child_meta (manager, container, actor);
- if (meta == NULL)
- {
- g_warning ("Layout managers of type '%s' do not support "
- "layout metadata",
- g_type_name (G_OBJECT_TYPE (manager)));
- return;
- }
-
- klass = G_OBJECT_GET_CLASS (meta);
-
- va_start (var_args, first_property);
-
- pname = first_property;
- while (pname)
- {
- GValue value = G_VALUE_INIT;
- GParamSpec *pspec;
- gchar *error;
- gboolean res;
-
- pspec = g_object_class_find_property (klass, pname);
- if (pspec == NULL)
- {
- g_warning ("%s: Layout managers of type '%s' have no layout "
- "property named '%s'",
- G_STRLOC, G_OBJECT_TYPE_NAME (manager), pname);
- break;
- }
-
- g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
-
- res = layout_get_property_internal (manager, G_OBJECT (meta),
- pspec,
- &value);
- if (!res)
- {
- g_value_unset (&value);
- break;
- }
-
- G_VALUE_LCOPY (&value, var_args, 0, &error);
- if (error)
- {
- g_warning ("%s: %s", G_STRLOC, error);
- g_free (error);
- g_value_unset (&value);
- break;
- }
-
- g_value_unset (&value);
-
- pname = va_arg (var_args, gchar*);
- }
-
- va_end (var_args);
-}
-
-/**
- * clutter_layout_manager_child_get_property:
- * @manager: a #ClutterLayoutManager
- * @container: a #ClutterContainer using @manager
- * @actor: a #ClutterActor child of @container
- * @property_name: the name of the property to get
- * @value: a #GValue with the value of the property to get
- *
- * Gets a property on the #ClutterLayoutMeta created by @manager and
- * attached to a child of @container
- *
- * The #GValue must already be initialized to the type of the property
- * and has to be unset with g_value_unset() after extracting the real
- * value out of it
- *
- * Since: 1.2
- */
-void
-clutter_layout_manager_child_get_property (ClutterLayoutManager *manager,
- ClutterContainer *container,
- ClutterActor *actor,
- const gchar *property_name,
- GValue *value)
-{
- ClutterLayoutMeta *meta;
- GObjectClass *klass;
- GParamSpec *pspec;
-
- g_return_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager));
- g_return_if_fail (CLUTTER_IS_CONTAINER (container));
- g_return_if_fail (CLUTTER_IS_ACTOR (actor));
- g_return_if_fail (property_name != NULL);
- g_return_if_fail (value != NULL);
-
- meta = get_child_meta (manager, container, actor);
- if (meta == NULL)
- {
- g_warning ("Layout managers of type %s do not support "
- "layout metadata",
- g_type_name (G_OBJECT_TYPE (manager)));
- return;
- }
-
- klass = G_OBJECT_GET_CLASS (meta);
-
- pspec = g_object_class_find_property (klass, property_name);
- if (pspec == NULL)
- {
- g_warning ("%s: Layout managers of type '%s' have no layout "
- "property named '%s'",
- G_STRLOC, G_OBJECT_TYPE_NAME (manager), property_name);
- return;
- }
-
- layout_get_property_internal (manager, G_OBJECT (meta), pspec, value);
-}
-
-/**
- * clutter_layout_manager_find_child_property:
- * @manager: a #ClutterLayoutManager
- * @name: the name of the property
- *
- * Retrieves the #GParamSpec for the layout property @name inside
- * the #ClutterLayoutMeta sub-class used by @manager
- *
- * Return value: (transfer none): a #GParamSpec describing the property,
- * or %NULL if no property with that name exists. The returned
- * #GParamSpec is owned by the layout manager and should not be
- * modified or freed
- *
- * Since: 1.2
- */
-GParamSpec *
-clutter_layout_manager_find_child_property (ClutterLayoutManager *manager,
- const gchar *name)
-{
- ClutterLayoutManagerClass *klass;
- GObjectClass *meta_klass;
- GParamSpec *pspec;
- GType meta_type;
-
- klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
- meta_type = klass->get_child_meta_type (manager);
- if (meta_type == G_TYPE_INVALID)
- return NULL;
-
- meta_klass = g_type_class_ref (meta_type);
-
- pspec = g_object_class_find_property (meta_klass, name);
-
- g_type_class_unref (meta_klass);
-
- return pspec;
-}
-
-/**
- * clutter_layout_manager_list_child_properties:
- * @manager: a #ClutterLayoutManager
- * @n_pspecs: (out): return location for the number of returned
- * #GParamSpec<!-- -->s
- *
- * Retrieves all the #GParamSpec<!-- -->s for the layout properties
- * stored inside the #ClutterLayoutMeta sub-class used by @manager
- *
- * Return value: (transfer full) (array length=n_pspecs): the newly-allocated,
- * %NULL-terminated array of #GParamSpec<!-- -->s. Use g_free() to free the
- * resources allocated for the array
- *
- * Since: 1.2
- */
-GParamSpec **
-clutter_layout_manager_list_child_properties (ClutterLayoutManager *manager,
- guint *n_pspecs)
-{
- ClutterLayoutManagerClass *klass;
- GObjectClass *meta_klass;
- GParamSpec **pspecs;
- GType meta_type;
-
- klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
- meta_type = klass->get_child_meta_type (manager);
- if (meta_type == G_TYPE_INVALID)
- return NULL;
-
- meta_klass = g_type_class_ref (meta_type);
-
- pspecs = g_object_class_list_properties (meta_klass, n_pspecs);
-
- g_type_class_unref (meta_klass);
-
- return pspecs;
-}
diff --git a/clutter/clutter/clutter-layout-manager.h b/clutter/clutter/clutter-layout-manager.h
deleted file mode 100644
index 4817f7c88..000000000
--- a/clutter/clutter/clutter-layout-manager.h
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2009 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_LAYOUT_MANAGER_H__
-#define __CLUTTER_LAYOUT_MANAGER_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-types.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_LAYOUT_MANAGER (clutter_layout_manager_get_type ())
-#define CLUTTER_LAYOUT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_LAYOUT_MANAGER, ClutterLayoutManager))
-#define CLUTTER_IS_LAYOUT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_LAYOUT_MANAGER))
-#define CLUTTER_LAYOUT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_LAYOUT_MANAGER, ClutterLayoutManagerClass))
-#define CLUTTER_IS_LAYOUT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_LAYOUT_MANAGER))
-#define CLUTTER_LAYOUT_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_LAYOUT_MANAGER, ClutterLayoutManagerClass))
-
-typedef struct _ClutterLayoutManagerClass ClutterLayoutManagerClass;
-
-/**
- * ClutterLayoutManager:
- *
- * The #ClutterLayoutManager structure contains only private data
- * and should be accessed using the provided API
- *
- * Since: 1.2
- */
-struct _ClutterLayoutManager
-{
- /*< private >*/
- GInitiallyUnowned parent_instance;
-
- gpointer CLUTTER_PRIVATE_FIELD (dummy);
-};
-
-/**
- * ClutterLayoutManagerClass:
- * @get_preferred_width: virtual function; override to provide a preferred
- * width for the layout manager. See also the get_preferred_width()
- * virtual function in #ClutterActor
- * @get_preferred_height: virtual function; override to provide a preferred
- * height for the layout manager. See also the get_preferred_height()
- * virtual function in #ClutterActor
- * @allocate: virtual function; override to allocate the children of the
- * layout manager. See also the allocate() virtual function in
- * #ClutterActor
- * @set_container: virtual function; override to set a back pointer
- * on the #ClutterContainer using the layout manager. The implementation
- * should not take a reference on the container, but just take a weak
- * reference, to avoid potential leaks due to reference cycles
- * @get_child_meta_type: virtual function; override to return the #GType
- * of the #ClutterLayoutMeta sub-class used by the #ClutterLayoutManager
- * @create_child_meta: virtual function; override to create a
- * #ClutterLayoutMeta instance associated to a #ClutterContainer and a
- * child #ClutterActor, used to maintain layout manager specific properties
- * @begin_animation: virtual function; override to control the animation
- * of a #ClutterLayoutManager with the given duration and easing mode.
- * This virtual function is deprecated, and it should not be overridden
- * in newly written code.
- * @end_animation: virtual function; override to end an animation started
- * by clutter_layout_manager_begin_animation(). This virtual function is
- * deprecated, and it should not be overridden in newly written code.
- * @get_animation_progress: virtual function; override to control the
- * progress of the animation of a #ClutterLayoutManager. This virtual
- * function is deprecated, and it should not be overridden in newly written
- * code.
- * @layout_changed: class handler for the #ClutterLayoutManager::layout-changed
- * signal
- *
- * The #ClutterLayoutManagerClass structure contains only private
- * data and should be accessed using the provided API
- *
- * Since: 1.2
- */
-struct _ClutterLayoutManagerClass
-{
- /*< private >*/
- GInitiallyUnownedClass parent_class;
-
- /*< public >*/
- void (* get_preferred_width) (ClutterLayoutManager *manager,
- ClutterContainer *container,
- gfloat for_height,
- gfloat *min_width_p,
- gfloat *nat_width_p);
- void (* get_preferred_height) (ClutterLayoutManager *manager,
- ClutterContainer *container,
- gfloat for_width,
- gfloat *min_height_p,
- gfloat *nat_height_p);
- void (* allocate) (ClutterLayoutManager *manager,
- ClutterContainer *container,
- const ClutterActorBox *allocation);
-
- void (* set_container) (ClutterLayoutManager *manager,
- ClutterContainer *container);
-
- GType (* get_child_meta_type) (ClutterLayoutManager *manager);
- ClutterLayoutMeta *(* create_child_meta) (ClutterLayoutManager *manager,
- ClutterContainer *container,
- ClutterActor *actor);
-
- void (* layout_changed) (ClutterLayoutManager *manager);
-
- /*< private >*/
- /* padding for future expansion */
- void (* _clutter_padding_1) (void);
- void (* _clutter_padding_2) (void);
- void (* _clutter_padding_3) (void);
- void (* _clutter_padding_4) (void);
- void (* _clutter_padding_5) (void);
- void (* _clutter_padding_6) (void);
- void (* _clutter_padding_7) (void);
- void (* _clutter_padding_8) (void);
-};
-
-CLUTTER_EXPORT
-GType clutter_layout_manager_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-void clutter_layout_manager_get_preferred_width (ClutterLayoutManager *manager,
- ClutterContainer *container,
- gfloat for_height,
- gfloat *min_width_p,
- gfloat *nat_width_p);
-CLUTTER_EXPORT
-void clutter_layout_manager_get_preferred_height (ClutterLayoutManager *manager,
- ClutterContainer *container,
- gfloat for_width,
- gfloat *min_height_p,
- gfloat *nat_height_p);
-CLUTTER_EXPORT
-void clutter_layout_manager_allocate (ClutterLayoutManager *manager,
- ClutterContainer *container,
- const ClutterActorBox *allocation);
-
-CLUTTER_EXPORT
-void clutter_layout_manager_set_container (ClutterLayoutManager *manager,
- ClutterContainer *container);
-CLUTTER_EXPORT
-void clutter_layout_manager_layout_changed (ClutterLayoutManager *manager);
-
-CLUTTER_EXPORT
-GParamSpec * clutter_layout_manager_find_child_property (ClutterLayoutManager *manager,
- const gchar *name);
-CLUTTER_EXPORT
-GParamSpec ** clutter_layout_manager_list_child_properties (ClutterLayoutManager *manager,
- guint *n_pspecs);
-
-CLUTTER_EXPORT
-ClutterLayoutMeta *clutter_layout_manager_get_child_meta (ClutterLayoutManager *manager,
- ClutterContainer *container,
- ClutterActor *actor);
-
-CLUTTER_EXPORT
-void clutter_layout_manager_child_set (ClutterLayoutManager *manager,
- ClutterContainer *container,
- ClutterActor *actor,
- const gchar *first_property,
- ...) G_GNUC_NULL_TERMINATED;
-CLUTTER_EXPORT
-void clutter_layout_manager_child_get (ClutterLayoutManager *manager,
- ClutterContainer *container,
- ClutterActor *actor,
- const gchar *first_property,
- ...) G_GNUC_NULL_TERMINATED;
-CLUTTER_EXPORT
-void clutter_layout_manager_child_set_property (ClutterLayoutManager *manager,
- ClutterContainer *container,
- ClutterActor *actor,
- const gchar *property_name,
- const GValue *value);
-CLUTTER_EXPORT
-void clutter_layout_manager_child_get_property (ClutterLayoutManager *manager,
- ClutterContainer *container,
- ClutterActor *actor,
- const gchar *property_name,
- GValue *value);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_LAYOUT_MANAGER_H__ */
diff --git a/clutter/clutter/clutter-layout-meta.c b/clutter/clutter/clutter-layout-meta.c
deleted file mode 100644
index 7360725ce..000000000
--- a/clutter/clutter/clutter-layout-meta.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2009 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-layout-meta
- * @short_description: Wrapper for actors inside a layout manager
- *
- * #ClutterLayoutMeta is a wrapper object created by #ClutterLayoutManager
- * implementations in order to store child-specific data and properties.
- *
- * A #ClutterLayoutMeta wraps a #ClutterActor inside a #ClutterContainer
- * using a #ClutterLayoutManager.
- *
- * #ClutterLayoutMeta is available since Clutter 1.2
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-layout-meta.h"
-#include "clutter-debug.h"
-#include "clutter-private.h"
-
-G_DEFINE_ABSTRACT_TYPE (ClutterLayoutMeta,
- clutter_layout_meta,
- CLUTTER_TYPE_CHILD_META);
-
-enum
-{
- PROP_0,
-
- PROP_MANAGER,
-
- PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST];
-
-static void
-clutter_layout_meta_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterLayoutMeta *layout_meta = CLUTTER_LAYOUT_META (object);
-
- switch (prop_id)
- {
- case PROP_MANAGER:
- layout_meta->manager = g_value_get_object (value);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_layout_meta_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterLayoutMeta *layout_meta = CLUTTER_LAYOUT_META (object);
-
- switch (prop_id)
- {
- case PROP_MANAGER:
- g_value_set_object (value, layout_meta->manager);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_layout_meta_class_init (ClutterLayoutMetaClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GParamSpec *pspec;
-
- gobject_class->set_property = clutter_layout_meta_set_property;
- gobject_class->get_property = clutter_layout_meta_get_property;
-
- /**
- * ClutterLayoutMeta:manager:
- *
- * The #ClutterLayoutManager that created this #ClutterLayoutMeta.
- *
- * Since: 1.2
- */
- pspec = g_param_spec_object ("manager",
- P_("Manager"),
- P_("The manager that created this data"),
- CLUTTER_TYPE_LAYOUT_MANAGER,
- G_PARAM_CONSTRUCT_ONLY |
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_MANAGER] = pspec;
- g_object_class_install_property (gobject_class, PROP_MANAGER, pspec);
-}
-
-static void
-clutter_layout_meta_init (ClutterLayoutMeta *self)
-{
-}
-
-/**
- * clutter_layout_meta_get_manager:
- * @data: a #ClutterLayoutMeta
- *
- * Retrieves the actor wrapped by @data
- *
- * Return value: (transfer none): a #ClutterLayoutManager
- *
- * Since: 1.2
- */
-ClutterLayoutManager *
-clutter_layout_meta_get_manager (ClutterLayoutMeta *data)
-{
- g_return_val_if_fail (CLUTTER_IS_LAYOUT_META (data), NULL);
-
- return data->manager;
-}
diff --git a/clutter/clutter/clutter-layout-meta.h b/clutter/clutter/clutter-layout-meta.h
deleted file mode 100644
index a4f6abe92..000000000
--- a/clutter/clutter/clutter-layout-meta.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2009 Intel Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_LAYOUT_META_H__
-#define __CLUTTER_LAYOUT_META_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-types.h>
-#include <clutter/clutter-child-meta.h>
-#include <clutter/clutter-layout-manager.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_LAYOUT_META (clutter_layout_meta_get_type ())
-#define CLUTTER_LAYOUT_META(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_LAYOUT_META, ClutterLayoutMeta))
-#define CLUTTER_IS_LAYOUT_META(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_LAYOUT_META))
-#define CLUTTER_LAYOUT_META_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_LAYOUT_META, ClutterLayoutMetaClass))
-#define CLUTTER_IS_LAYOUT_META_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_LAYOUT_META))
-#define CLUTTER_LAYOUT_META_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_LAYOUT_META, ClutterLayoutMetaClass))
-
-/* ClutterLayoutMeta is defined in clutter-types.h */
-
-typedef struct _ClutterLayoutMetaClass ClutterLayoutMetaClass;
-
-/**
- * ClutterLayoutMeta:
- * @manager: the layout manager handling this data
- *
- * Sub-class of #ClutterChildMeta specific for layout managers
- *
- * A #ClutterLayoutManager sub-class should create a #ClutterLayoutMeta
- * instance by overriding the #ClutterLayoutManager::create_child_meta()
- * virtual function
- *
- * Since: 1.2
- */
-struct _ClutterLayoutMeta
-{
- /*< private >*/
- ClutterChildMeta parent_instance;
-
- /*< public >*/
- ClutterLayoutManager *manager;
-
- /*< private >*/
- /* padding */
- gint32 dummy0;
- gpointer dummy1;
-};
-
-/**
- * ClutterLayoutMetaClass:
- *
- * The #ClutterLayoutMetaClass contains only private data and
- * should never be accessed directly
- *
- * Since: 1.2
- */
-struct _ClutterLayoutMetaClass
-{
- /*< private >*/
- ClutterChildMetaClass parent_class;
-
- /* padding, for expansion */
- void (*_clutter_padding1) (void);
- void (*_clutter_padding2) (void);
- void (*_clutter_padding3) (void);
- void (*_clutter_padding4) (void);
-};
-
-CLUTTER_EXPORT
-GType clutter_layout_meta_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterLayoutManager *clutter_layout_meta_get_manager (ClutterLayoutMeta *data);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_LAYOUT_META_H__ */
diff --git a/clutter/clutter/clutter-macros.h b/clutter/clutter/clutter-macros.h
deleted file mode 100644
index 8a6702194..000000000
--- a/clutter/clutter/clutter-macros.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2012 Intel Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __CLUTTER_MACROS_H__
-#define __CLUTTER_MACROS_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-/**
- * CLUTTER_FLAVOUR:
- *
- * GL Windowing system used
- *
- * Since: 0.4
- *
- * Deprecated: 1.10: The macro evaluates to "deprecated" as Clutter can be
- * compiled with multiple windowing system backends. Use the various
- * CLUTTER_WINDOWING_* macros to detect the windowing system that Clutter
- * is being compiled against, and the type check macros for the
- * #ClutterBackend for a run-time check.
- */
-#define CLUTTER_FLAVOUR "deprecated"
-
-/**
- * CLUTTER_COGL:
- *
- * Cogl (internal GL abstraction utility library) backend. Can be "gl" or
- * "gles" currently
- *
- * Since: 0.4
- *
- * Deprecated: 1.10: The macro evaluates to "deprecated" as Cogl can be
- * compiled against multiple GL implementations.
- */
-#define CLUTTER_COGL "deprecated"
-
-/**
- * CLUTTER_STAGE_TYPE:
- *
- * The default GObject type for the Clutter stage.
- *
- * Since: 0.8
- *
- * Deprecated: 1.10: The macro evaluates to "deprecated" as Clutter can
- * be compiled against multiple windowing systems. You can use the
- * CLUTTER_WINDOWING_* macros for compile-time checks, and the type
- * check macros for run-time checks.
- */
-#define CLUTTER_STAGE_TYPE "deprecated"
-
-/**
- * CLUTTER_NO_FPU:
- *
- * Set to 1 if Clutter was built without FPU (i.e fixed math), 0 otherwise
- *
- * Deprecated: 0.6: This macro is no longer defined (identical code is used
- * regardless the presence of FPU).
- */
-#define CLUTTER_NO_FPU (0)
-
-/* some structures are meant to be opaque and still be allocated on the stack;
- * in order to avoid people poking at their internals, we use this macro to
- * ensure that users don't accidentally access a struct private members.
- *
- * we use the CLUTTER_COMPILATION define to allow us easier access, though.
- */
-#ifdef CLUTTER_COMPILATION
-#define CLUTTER_PRIVATE_FIELD(x) x
-#else
-#define CLUTTER_PRIVATE_FIELD(x) clutter_private_ ## x
-#endif
-
-#define _CLUTTER_EXTERN __attribute__((visibility("default"))) extern
-
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || \
- __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 4)
-#define _CLUTTER_GNUC_DO_PRAGMA(x) _Pragma(G_STRINGIFY (x))
-#define _CLUTTER_DEPRECATED_MACRO _CLUTTER_GNUC_DO_PRAGMA(GCC warning "Deprecated macro")
-#define _CLUTTER_DEPRECATED_MACRO_FOR(f) _CLUTTER_GNUC_DO_PRAGMA(GCC warning #f)
-#else
-#define _CLUTTER_DEPRECATED_MACRO
-#define _CLUTTER_DEPRECATED_MACRO_FOR(f)
-#endif
-
-/* these macros are used to mark deprecated functions, and thus have to be
- * exposed in a public header.
- *
- * do *not* use them in other libraries depending on Clutter: use G_DEPRECATED
- * and G_DEPRECATED_FOR, or use your own wrappers around them.
- */
-#ifdef CLUTTER_DISABLE_DEPRECATION_WARNINGS
-#define CLUTTER_DEPRECATED _CLUTTER_EXTERN
-#define CLUTTER_DEPRECATED_FOR(f) _CLUTTER_EXTERN
-#define CLUTTER_DEPRECATED_MACRO
-#define CLUTTER_DEPRECATED_MACRO_FOR(f)
-#else
-#define CLUTTER_DEPRECATED G_DEPRECATED _CLUTTER_EXTERN
-#define CLUTTER_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _CLUTTER_EXTERN
-#define CLUTTER_DEPRECATED_MACRO _CLUTTER_DEPRECATED_MACRO
-#define CLUTTER_DEPRECATED_MACRO_FOR(f) _CLUTTER_DEPRECATED_MACRO_FOR(f)
-#endif
-
-#define CLUTTER_MACRO_DEPRECATED CLUTTER_DEPRECATED_MACRO
-#define CLUTTER_MACRO_DEPRECATED_FOR(f) CLUTTER_DEPRECATED_MACRO_FOR(f)
-
-#define CLUTTER_EXPORT _CLUTTER_EXTERN
-
-#endif /* __CLUTTER_MACROS_H__ */
diff --git a/clutter/clutter/clutter-main.c b/clutter/clutter/clutter-main.c
deleted file mode 100644
index b862f82a3..000000000
--- a/clutter/clutter/clutter-main.c
+++ /dev/null
@@ -1,2288 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- *
- * Copyright (C) 2006 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * SECTION:clutter-main
- * @short_description: Various 'global' Clutter functions.
- *
- * Functions to retrieve various global Clutter resources and other utility
- * functions for mainloops, events and threads
- *
- * ## The Clutter Threading Model
- *
- * Clutter is *thread-aware*: all operations performed by Clutter are assumed
- * to be under the Big Clutter Lock, which is created when the threading is
- * initialized through clutter_init(), and entered when calling user-related
- * code during event handling and actor drawing.
- *
- * The only safe and portable way to use the Clutter API in a multi-threaded
- * environment is to only access the Clutter API from a thread that did called
- * clutter_init() and clutter_main().
- *
- * The common pattern for using threads with Clutter is to use worker threads
- * to perform blocking operations and then install idle or timeout sources with
- * the result when the thread finishes, and update the UI from those callbacks.
- *
- * For a working example of how to use a worker thread to update the UI, see
- * [threads.c](https://git.gnome.org/browse/clutter/tree/examples/threads.c?h=clutter-1.18)
- */
-
-#include "clutter-build-config.h"
-
-#include <stdlib.h>
-
-#include "clutter-actor-private.h"
-#include "clutter-backend-private.h"
-#include "clutter-debug.h"
-#include "clutter-event-private.h"
-#include "clutter-feature.h"
-#include "clutter-input-device-private.h"
-#include "clutter-input-pointer-a11y-private.h"
-#include "clutter-graphene.h"
-#include "clutter-main.h"
-#include "clutter-mutter.h"
-#include "clutter-paint-node-private.h"
-#include "clutter-private.h"
-#include "clutter-settings-private.h"
-#include "clutter-stage.h"
-#include "clutter-stage-manager.h"
-#include "clutter-stage-private.h"
-#include "clutter-backend-private.h"
-
-#include <cogl/cogl.h>
-#include <cogl-pango/cogl-pango.h>
-
-#include "cally/cally.h" /* For accessibility support */
-
-/* main context */
-static ClutterMainContext *ClutterCntx = NULL;
-
-/* command line options */
-static gboolean clutter_is_initialized = FALSE;
-static gboolean clutter_show_fps = FALSE;
-static gboolean clutter_fatal_warnings = FALSE;
-static gboolean clutter_disable_mipmap_text = FALSE;
-static gboolean clutter_enable_accessibility = TRUE;
-static gboolean clutter_sync_to_vblank = TRUE;
-
-static guint clutter_default_fps = 60;
-
-static ClutterTextDirection clutter_text_direction = CLUTTER_TEXT_DIRECTION_LTR;
-
-/* debug flags */
-guint clutter_debug_flags = 0;
-guint clutter_paint_debug_flags = 0;
-guint clutter_pick_debug_flags = 0;
-
-/* A constant added to heuristic max render time to account for variations
- * in the estimates.
- */
-int clutter_max_render_time_constant_us = 2000;
-
-#ifdef CLUTTER_ENABLE_DEBUG
-static const GDebugKey clutter_debug_keys[] = {
- { "misc", CLUTTER_DEBUG_MISC },
- { "actor", CLUTTER_DEBUG_ACTOR },
- { "texture", CLUTTER_DEBUG_TEXTURE },
- { "event", CLUTTER_DEBUG_EVENT },
- { "paint", CLUTTER_DEBUG_PAINT },
- { "pick", CLUTTER_DEBUG_PICK },
- { "pango", CLUTTER_DEBUG_PANGO },
- { "backend", CLUTTER_DEBUG_BACKEND },
- { "scheduler", CLUTTER_DEBUG_SCHEDULER },
- { "script", CLUTTER_DEBUG_SCRIPT },
- { "shader", CLUTTER_DEBUG_SHADER },
- { "animation", CLUTTER_DEBUG_ANIMATION },
- { "layout", CLUTTER_DEBUG_LAYOUT },
- { "clipping", CLUTTER_DEBUG_CLIPPING },
- { "oob-transforms", CLUTTER_DEBUG_OOB_TRANSFORMS },
- { "frame-timings", CLUTTER_DEBUG_FRAME_TIMINGS },
-};
-#endif /* CLUTTER_ENABLE_DEBUG */
-
-static const GDebugKey clutter_pick_debug_keys[] = {
- { "nop-picking", CLUTTER_DEBUG_NOP_PICKING },
-};
-
-static const GDebugKey clutter_paint_debug_keys[] = {
- { "disable-swap-events", CLUTTER_DEBUG_DISABLE_SWAP_EVENTS },
- { "disable-clipped-redraws", CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS },
- { "redraws", CLUTTER_DEBUG_REDRAWS },
- { "paint-volumes", CLUTTER_DEBUG_PAINT_VOLUMES },
- { "disable-culling", CLUTTER_DEBUG_DISABLE_CULLING },
- { "disable-offscreen-redirect", CLUTTER_DEBUG_DISABLE_OFFSCREEN_REDIRECT },
- { "continuous-redraw", CLUTTER_DEBUG_CONTINUOUS_REDRAW },
- { "paint-deform-tiles", CLUTTER_DEBUG_PAINT_DEFORM_TILES },
- { "damage-region", CLUTTER_DEBUG_PAINT_DAMAGE_REGION },
- { "disable-dynamic-max-render-time", CLUTTER_DEBUG_DISABLE_DYNAMIC_MAX_RENDER_TIME },
- { "max-render-time", CLUTTER_DEBUG_PAINT_MAX_RENDER_TIME },
-};
-
-gboolean
-_clutter_context_get_show_fps (void)
-{
- ClutterMainContext *context = _clutter_context_get_default ();
-
- return context->show_fps;
-}
-
-/**
- * clutter_get_accessibility_enabled:
- *
- * Returns whether Clutter has accessibility support enabled. As
- * least, a value of TRUE means that there are a proper AtkUtil
- * implementation available
- *
- * Return value: %TRUE if Clutter has accessibility support enabled
- *
- * Since: 1.4
- */
-gboolean
-clutter_get_accessibility_enabled (void)
-{
- return cally_get_cally_initialized ();
-}
-
-/**
- * clutter_disable_accessibility:
- *
- * Disable loading the accessibility support. It has the same effect
- * as setting the environment variable
- * CLUTTER_DISABLE_ACCESSIBILITY. For the same reason, this method
- * should be called before clutter_init().
- *
- * Since: 1.14
- */
-void
-clutter_disable_accessibility (void)
-{
- if (clutter_is_initialized)
- {
- g_warning ("clutter_disable_accessibility() can only be called before "
- "initializing Clutter.");
- return;
- }
-
- clutter_enable_accessibility = FALSE;
-}
-
-static CoglPangoFontMap *
-clutter_context_get_pango_fontmap (void)
-{
- ClutterMainContext *self;
- CoglPangoFontMap *font_map;
- gdouble resolution;
- gboolean use_mipmapping;
-
- self = _clutter_context_get_default ();
- if (G_LIKELY (self->font_map != NULL))
- return self->font_map;
-
- font_map = COGL_PANGO_FONT_MAP (cogl_pango_font_map_new ());
-
- resolution = clutter_backend_get_resolution (self->backend);
- cogl_pango_font_map_set_resolution (font_map, resolution);
-
- use_mipmapping = !clutter_disable_mipmap_text;
- cogl_pango_font_map_set_use_mipmapping (font_map, use_mipmapping);
-
- self->font_map = font_map;
-
- return self->font_map;
-}
-
-static ClutterTextDirection
-clutter_get_text_direction (void)
-{
- ClutterTextDirection dir = CLUTTER_TEXT_DIRECTION_LTR;
- const gchar *direction;
-
- direction = g_getenv ("CLUTTER_TEXT_DIRECTION");
- if (direction && *direction != '\0')
- {
- if (strcmp (direction, "rtl") == 0)
- dir = CLUTTER_TEXT_DIRECTION_RTL;
- else if (strcmp (direction, "ltr") == 0)
- dir = CLUTTER_TEXT_DIRECTION_LTR;
- }
- else
- {
- /* Re-use GTK+'s LTR/RTL handling */
- const char *e = g_dgettext ("gtk30", "default:LTR");
-
- if (strcmp (e, "default:RTL") == 0)
- dir = CLUTTER_TEXT_DIRECTION_RTL;
- else if (strcmp (e, "default:LTR") == 0)
- dir = CLUTTER_TEXT_DIRECTION_LTR;
- else
- g_warning ("Whoever translated default:LTR did so wrongly.");
- }
-
- CLUTTER_NOTE (MISC, "Text direction: %s",
- dir == CLUTTER_TEXT_DIRECTION_RTL ? "rtl" : "ltr");
-
- return dir;
-}
-
-gboolean
-_clutter_threads_dispatch (gpointer data)
-{
- ClutterThreadsDispatch *dispatch = data;
- gboolean ret = FALSE;
-
- if (!g_source_is_destroyed (g_main_current_source ()))
- ret = dispatch->func (dispatch->data);
-
- return ret;
-}
-
-void
-_clutter_threads_dispatch_free (gpointer data)
-{
- ClutterThreadsDispatch *dispatch = data;
-
- /* XXX - we cannot hold the thread lock here because the main loop
- * might destroy a source while still in the dispatcher function; so
- * knowing whether the lock is being held or not is not known a priori.
- *
- * see bug: http://bugzilla.gnome.org/show_bug.cgi?id=459555
- */
- if (dispatch->notify)
- dispatch->notify (dispatch->data);
-
- g_free (dispatch);
-}
-
-/**
- * clutter_threads_add_idle_full: (rename-to clutter_threads_add_idle)
- * @priority: the priority of the timeout source. Typically this will be in the
- * range between #G_PRIORITY_DEFAULT_IDLE and #G_PRIORITY_HIGH_IDLE
- * @func: function to call
- * @data: data to pass to the function
- * @notify: functio to call when the idle source is removed
- *
- * Adds a function to be called whenever there are no higher priority
- * events pending. If the function returns %FALSE it is automatically
- * removed from the list of event sources and will not be called again.
- *
- * This function can be considered a thread-safe variant of g_idle_add_full():
- * it will call @function while holding the Clutter lock. It is logically
- * equivalent to the following implementation:
- *
- * |[
- * static gboolean
- * idle_safe_callback (gpointer data)
- * {
- * SafeClosure *closure = data;
- * gboolean res = FALSE;
- *
- * // the callback does not need to acquire the Clutter
- * / lock itself, as it is held by the this proxy handler
- * //
- * res = closure->callback (closure->data);
- *
- * return res;
- * }
- * static gulong
- * add_safe_idle (GSourceFunc callback,
- * gpointer data)
- * {
- * SafeClosure *closure = g_new0 (SafeClosure, 1);
- *
- * closure->callback = callback;
- * closure->data = data;
- *
- * return g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
- * idle_safe_callback,
- * closure,
- * g_free)
- * }
- *]|
- *
- * This function should be used by threaded applications to make sure
- * that @func is emitted under the Clutter threads lock and invoked
- * from the same thread that started the Clutter main loop. For instance,
- * it can be used to update the UI using the results from a worker
- * thread:
- *
- * |[
- * static gboolean
- * update_ui (gpointer data)
- * {
- * SomeClosure *closure = data;
- *
- * // it is safe to call Clutter API from this function because
- * / it is invoked from the same thread that started the main
- * / loop and under the Clutter thread lock
- * //
- * clutter_label_set_text (CLUTTER_LABEL (closure->label),
- * closure->text);
- *
- * g_object_unref (closure->label);
- * g_free (closure);
- *
- * return FALSE;
- * }
- *
- * // within another thread //
- * closure = g_new0 (SomeClosure, 1);
- * // always take a reference on GObject instances //
- * closure->label = g_object_ref (my_application->label);
- * closure->text = g_strdup (processed_text_to_update_the_label);
- *
- * clutter_threads_add_idle_full (G_PRIORITY_HIGH_IDLE,
- * update_ui,
- * closure,
- * NULL);
- * ]|
- *
- * Return value: the ID (greater than 0) of the event source.
- *
- * Since: 0.4
- */
-guint
-clutter_threads_add_idle_full (gint priority,
- GSourceFunc func,
- gpointer data,
- GDestroyNotify notify)
-{
- ClutterThreadsDispatch *dispatch;
-
- g_return_val_if_fail (func != NULL, 0);
-
- dispatch = g_new0 (ClutterThreadsDispatch, 1);
- dispatch->func = func;
- dispatch->data = data;
- dispatch->notify = notify;
-
- return g_idle_add_full (priority,
- _clutter_threads_dispatch, dispatch,
- _clutter_threads_dispatch_free);
-}
-
-/**
- * clutter_threads_add_idle: (skip)
- * @func: function to call
- * @data: data to pass to the function
- *
- * Simple wrapper around clutter_threads_add_idle_full() using the
- * default priority.
- *
- * Return value: the ID (greater than 0) of the event source.
- *
- * Since: 0.4
- */
-guint
-clutter_threads_add_idle (GSourceFunc func,
- gpointer data)
-{
- g_return_val_if_fail (func != NULL, 0);
-
- return clutter_threads_add_idle_full (G_PRIORITY_DEFAULT_IDLE,
- func, data,
- NULL);
-}
-
-/**
- * clutter_threads_add_timeout_full: (rename-to clutter_threads_add_timeout)
- * @priority: the priority of the timeout source. Typically this will be in the
- * range between #G_PRIORITY_DEFAULT and #G_PRIORITY_HIGH.
- * @interval: the time between calls to the function, in milliseconds
- * @func: function to call
- * @data: data to pass to the function
- * @notify: function to call when the timeout source is removed
- *
- * Sets a function to be called at regular intervals holding the Clutter
- * threads lock, with the given priority. The function is called repeatedly
- * until it returns %FALSE, at which point the timeout is automatically
- * removed and the function will not be called again. The @notify function
- * is called when the timeout is removed.
- *
- * The first call to the function will be at the end of the first @interval.
- *
- * It is important to note that, due to how the Clutter main loop is
- * implemented, the timing will not be accurate and it will not try to
- * "keep up" with the interval.
- *
- * See also clutter_threads_add_idle_full().
- *
- * Return value: the ID (greater than 0) of the event source.
- *
- * Since: 0.4
- */
-guint
-clutter_threads_add_timeout_full (gint priority,
- guint interval,
- GSourceFunc func,
- gpointer data,
- GDestroyNotify notify)
-{
- ClutterThreadsDispatch *dispatch;
-
- g_return_val_if_fail (func != NULL, 0);
-
- dispatch = g_new0 (ClutterThreadsDispatch, 1);
- dispatch->func = func;
- dispatch->data = data;
- dispatch->notify = notify;
-
- return g_timeout_add_full (priority,
- interval,
- _clutter_threads_dispatch, dispatch,
- _clutter_threads_dispatch_free);
-}
-
-/**
- * clutter_threads_add_timeout: (skip)
- * @interval: the time between calls to the function, in milliseconds
- * @func: function to call
- * @data: data to pass to the function
- *
- * Simple wrapper around clutter_threads_add_timeout_full().
- *
- * Return value: the ID (greater than 0) of the event source.
- *
- * Since: 0.4
- */
-guint
-clutter_threads_add_timeout (guint interval,
- GSourceFunc func,
- gpointer data)
-{
- g_return_val_if_fail (func != NULL, 0);
-
- return clutter_threads_add_timeout_full (G_PRIORITY_DEFAULT,
- interval,
- func, data,
- NULL);
-}
-
-gboolean
-_clutter_context_is_initialized (void)
-{
- if (ClutterCntx == NULL)
- return FALSE;
-
- return ClutterCntx->is_initialized;
-}
-
-ClutterMainContext *
-_clutter_context_get_default (void)
-{
- if (G_UNLIKELY (ClutterCntx == NULL))
- {
- ClutterMainContext *ctx;
-
- ClutterCntx = ctx = g_new0 (ClutterMainContext, 1);
-
- ctx->is_initialized = FALSE;
-
- /* create the windowing system backend */
- ctx->backend = _clutter_create_backend ();
-
- /* create the default settings object, and store a back pointer to
- * the backend singleton
- */
- ctx->settings = clutter_settings_get_default ();
- _clutter_settings_set_backend (ctx->settings, ctx->backend);
-
- ctx->events_queue = g_async_queue_new ();
-
- ctx->last_repaint_id = 1;
- }
-
- return ClutterCntx;
-}
-
-static gboolean
-clutter_arg_direction_cb (const char *key,
- const char *value,
- gpointer user_data)
-{
- clutter_text_direction =
- (strcmp (value, "rtl") == 0) ? CLUTTER_TEXT_DIRECTION_RTL
- : CLUTTER_TEXT_DIRECTION_LTR;
-
- return TRUE;
-}
-
-#ifdef CLUTTER_ENABLE_DEBUG
-static gboolean
-clutter_arg_debug_cb (const char *key,
- const char *value,
- gpointer user_data)
-{
- clutter_debug_flags |=
- g_parse_debug_string (value,
- clutter_debug_keys,
- G_N_ELEMENTS (clutter_debug_keys));
- return TRUE;
-}
-
-static gboolean
-clutter_arg_no_debug_cb (const char *key,
- const char *value,
- gpointer user_data)
-{
- clutter_debug_flags &=
- ~g_parse_debug_string (value,
- clutter_debug_keys,
- G_N_ELEMENTS (clutter_debug_keys));
- return TRUE;
-}
-#endif /* CLUTTER_ENABLE_DEBUG */
-
-GQuark
-clutter_init_error_quark (void)
-{
- return g_quark_from_static_string ("clutter-init-error-quark");
-}
-
-static ClutterInitError
-clutter_init_real (GError **error)
-{
- ClutterMainContext *ctx;
- ClutterBackend *backend;
-
- /* Note, creates backend if not already existing, though parse args will
- * have likely created it
- */
- ctx = _clutter_context_get_default ();
- backend = ctx->backend;
-
- if (!ctx->options_parsed)
- {
- if (error)
- g_set_error (error, CLUTTER_INIT_ERROR,
- CLUTTER_INIT_ERROR_INTERNAL,
- "When using clutter_get_option_group_without_init() "
- "you must parse options before calling clutter_init()");
- else
- g_critical ("When using clutter_get_option_group_without_init() "
- "you must parse options before calling clutter_init()");
-
- return CLUTTER_INIT_ERROR_INTERNAL;
- }
-
- /*
- * Call backend post parse hooks.
- */
- if (!_clutter_backend_post_parse (backend, error))
- return CLUTTER_INIT_ERROR_BACKEND;
-
- /* If we are displaying the regions that would get redrawn with clipped
- * redraws enabled we actually have to disable the clipped redrawing
- * because otherwise we end up with nasty trails of rectangles everywhere.
- */
- if (clutter_paint_debug_flags & CLUTTER_DEBUG_REDRAWS)
- clutter_paint_debug_flags |= CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS;
-
- /* The same is true when drawing the outlines of paint volumes... */
- if (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_VOLUMES)
- {
- clutter_paint_debug_flags |=
- CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS | CLUTTER_DEBUG_DISABLE_CULLING;
- }
-
- if (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_DAMAGE_REGION)
- g_message ("Enabling damaged region");
-
- /* this will take care of initializing Cogl's state and
- * query the GL machinery for features
- */
- if (!_clutter_feature_init (error))
- return CLUTTER_INIT_ERROR_BACKEND;
-
- clutter_text_direction = clutter_get_text_direction ();
-
- clutter_is_initialized = TRUE;
- ctx->is_initialized = TRUE;
-
- /* Initialize a11y */
- if (clutter_enable_accessibility)
- cally_accessibility_init ();
-
- /* Initialize types required for paint nodes */
- _clutter_paint_node_init_types ();
-
- return CLUTTER_INIT_SUCCESS;
-}
-
-static GOptionEntry clutter_args[] = {
- { "clutter-show-fps", 0, 0, G_OPTION_ARG_NONE, &clutter_show_fps,
- N_("Show frames per second"), NULL },
- { "clutter-default-fps", 0, 0, G_OPTION_ARG_INT, &clutter_default_fps,
- N_("Default frame rate"), "FPS" },
- { "g-fatal-warnings", 0, 0, G_OPTION_ARG_NONE, &clutter_fatal_warnings,
- N_("Make all warnings fatal"), NULL },
- { "clutter-text-direction", 0, 0, G_OPTION_ARG_CALLBACK,
- clutter_arg_direction_cb,
- N_("Direction for the text"), "DIRECTION" },
- { "clutter-disable-mipmapped-text", 0, 0, G_OPTION_ARG_NONE,
- &clutter_disable_mipmap_text,
- N_("Disable mipmapping on text"), NULL },
-#ifdef CLUTTER_ENABLE_DEBUG
- { "clutter-debug", 0, 0, G_OPTION_ARG_CALLBACK, clutter_arg_debug_cb,
- N_("Clutter debugging flags to set"), "FLAGS" },
- { "clutter-no-debug", 0, 0, G_OPTION_ARG_CALLBACK, clutter_arg_no_debug_cb,
- N_("Clutter debugging flags to unset"), "FLAGS" },
-#endif /* CLUTTER_ENABLE_DEBUG */
- { "clutter-enable-accessibility", 0, 0, G_OPTION_ARG_NONE, &clutter_enable_accessibility,
- N_("Enable accessibility"), NULL },
- { NULL, },
-};
-
-/* pre_parse_hook: initialise variables depending on environment
- * variables; these variables might be overridden by the command
- * line arguments that are going to be parsed after.
- */
-static gboolean
-pre_parse_hook (GOptionContext *context,
- GOptionGroup *group,
- gpointer data,
- GError **error)
-{
- ClutterMainContext *clutter_context;
- ClutterBackend *backend;
- const char *env_string;
-
- if (clutter_is_initialized)
- return TRUE;
-
- clutter_context = _clutter_context_get_default ();
-
- backend = clutter_context->backend;
- g_assert (CLUTTER_IS_BACKEND (backend));
-
-#ifdef CLUTTER_ENABLE_DEBUG
- env_string = g_getenv ("CLUTTER_DEBUG");
- if (env_string != NULL)
- {
- clutter_debug_flags =
- g_parse_debug_string (env_string,
- clutter_debug_keys,
- G_N_ELEMENTS (clutter_debug_keys));
- env_string = NULL;
- }
-#endif /* CLUTTER_ENABLE_DEBUG */
-
- env_string = g_getenv ("CLUTTER_PICK");
- if (env_string != NULL)
- {
- clutter_pick_debug_flags =
- g_parse_debug_string (env_string,
- clutter_pick_debug_keys,
- G_N_ELEMENTS (clutter_pick_debug_keys));
- env_string = NULL;
- }
-
- env_string = g_getenv ("CLUTTER_PAINT");
- if (env_string != NULL)
- {
- clutter_paint_debug_flags =
- g_parse_debug_string (env_string,
- clutter_paint_debug_keys,
- G_N_ELEMENTS (clutter_paint_debug_keys));
- env_string = NULL;
- }
-
- env_string = g_getenv ("CLUTTER_SHOW_FPS");
- if (env_string)
- clutter_show_fps = TRUE;
-
- env_string = g_getenv ("CLUTTER_DEFAULT_FPS");
- if (env_string)
- {
- gint default_fps = g_ascii_strtoll (env_string, NULL, 10);
-
- clutter_default_fps = CLAMP (default_fps, 1, 1000);
- }
-
- env_string = g_getenv ("CLUTTER_DISABLE_MIPMAPPED_TEXT");
- if (env_string)
- clutter_disable_mipmap_text = TRUE;
-
- return _clutter_backend_pre_parse (backend, error);
-}
-
-/* post_parse_hook: initialise the context and data structures
- * and opens the X display
- */
-static gboolean
-post_parse_hook (GOptionContext *context,
- GOptionGroup *group,
- gpointer data,
- GError **error)
-{
- ClutterMainContext *clutter_context;
- ClutterBackend *backend;
-
- if (clutter_is_initialized)
- return TRUE;
-
- clutter_context = _clutter_context_get_default ();
- backend = clutter_context->backend;
- g_assert (CLUTTER_IS_BACKEND (backend));
-
- if (clutter_fatal_warnings)
- {
- GLogLevelFlags fatal_mask;
-
- fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
- fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
- g_log_set_always_fatal (fatal_mask);
- }
-
- clutter_context->frame_rate = clutter_default_fps;
- clutter_context->show_fps = clutter_show_fps;
- clutter_context->options_parsed = TRUE;
-
- /* If not asked to defer display setup, call clutter_init_real(),
- * which in turn calls the backend post parse hooks.
- */
- if (!clutter_context->defer_display_setup)
- return clutter_init_real (error) == CLUTTER_INIT_SUCCESS;
-
- return TRUE;
-}
-
-/**
- * clutter_get_option_group: (skip)
- *
- * Returns a #GOptionGroup for the command line arguments recognized
- * by Clutter. You should add this group to your #GOptionContext with
- * g_option_context_add_group(), if you are using g_option_context_parse()
- * to parse your commandline arguments.
- *
- * Calling g_option_context_parse() with Clutter's #GOptionGroup will result
- * in Clutter's initialization. That is, the following code:
- *
- * |[
- * g_option_context_set_main_group (context, clutter_get_option_group ());
- * res = g_option_context_parse (context, &argc, &argc, NULL);
- * ]|
- *
- * is functionally equivalent to:
- *
- * |[
- * clutter_init (&argc, &argv);
- * ]|
- *
- * After g_option_context_parse() on a #GOptionContext containing the
- * Clutter #GOptionGroup has returned %TRUE, Clutter is guaranteed to be
- * initialized.
- *
- * Return value: (transfer full): a #GOptionGroup for the commandline arguments
- * recognized by Clutter
- *
- * Since: 0.2
- */
-GOptionGroup *
-clutter_get_option_group (void)
-{
- ClutterMainContext *context;
- GOptionGroup *group;
-
- clutter_base_init ();
-
- context = _clutter_context_get_default ();
-
- group = g_option_group_new ("clutter",
- "Clutter Options",
- "Show Clutter Options",
- NULL,
- NULL);
-
- g_option_group_set_parse_hooks (group, pre_parse_hook, post_parse_hook);
- g_option_group_add_entries (group, clutter_args);
-
- /* add backend-specific options */
- _clutter_backend_add_options (context->backend, group);
-
- return group;
-}
-
-/**
- * clutter_get_option_group_without_init: (skip)
- *
- * Returns a #GOptionGroup for the command line arguments recognized
- * by Clutter. You should add this group to your #GOptionContext with
- * g_option_context_add_group(), if you are using g_option_context_parse()
- * to parse your commandline arguments.
- *
- * Unlike clutter_get_option_group(), calling g_option_context_parse() with
- * the #GOptionGroup returned by this function requires a subsequent explicit
- * call to clutter_init(); use this function when needing to set foreign
- * display connection with clutter_x11_set_display(), or with
- * `gtk_clutter_init()`.
- *
- * Return value: (transfer full): a #GOptionGroup for the commandline arguments
- * recognized by Clutter
- *
- * Since: 0.8
- */
-GOptionGroup *
-clutter_get_option_group_without_init (void)
-{
- ClutterMainContext *context;
- GOptionGroup *group;
-
- clutter_base_init ();
-
- context = _clutter_context_get_default ();
- context->defer_display_setup = TRUE;
-
- group = clutter_get_option_group ();
-
- return group;
-}
-
-/* Note that the gobject-introspection annotations for the argc/argv
- * parameters do not produce the right result; however, they do
- * allow the common case of argc=NULL, argv=NULL to work.
- */
-
-
-static gboolean
-clutter_parse_args (int *argc,
- char ***argv,
- GError **error)
-{
- GOptionContext *option_context;
- GOptionGroup *clutter_group, *cogl_group;
- GError *internal_error = NULL;
- gboolean ret = TRUE;
-
- if (clutter_is_initialized)
- return TRUE;
-
- option_context = g_option_context_new (NULL);
- g_option_context_set_ignore_unknown_options (option_context, TRUE);
- g_option_context_set_help_enabled (option_context, FALSE);
-
- /* Initiate any command line options from the backend */
- clutter_group = clutter_get_option_group ();
- g_option_context_set_main_group (option_context, clutter_group);
-
- cogl_group = cogl_get_option_group ();
- g_option_context_add_group (option_context, cogl_group);
-
- if (!g_option_context_parse (option_context, argc, argv, &internal_error))
- {
- g_propagate_error (error, internal_error);
- ret = FALSE;
- }
-
- g_option_context_free (option_context);
-
- return ret;
-}
-
-/**
- * clutter_init:
- * @argc: (inout): The number of arguments in @argv
- * @argv: (array length=argc) (inout) (allow-none): A pointer to an array
- * of arguments.
- *
- * Initialises everything needed to operate with Clutter and parses some
- * standard command line options; @argc and @argv are adjusted accordingly
- * so your own code will never see those standard arguments.
- *
- * It is safe to call this function multiple times.
- *
- * This function will not abort in case of errors during
- * initialization; clutter_init() will print out the error message on
- * stderr, and will return an error code. It is up to the application
- * code to handle this case.
- *
- * If this function fails, and returns an error code, any subsequent
- * Clutter API will have undefined behaviour - including segmentation
- * faults and assertion failures. Make sure to handle the returned
- * #ClutterInitError enumeration value.
- *
- * Return value: a #ClutterInitError value
- */
-ClutterInitError
-clutter_init (int *argc,
- char ***argv)
-{
- ClutterMainContext *ctx;
- GError *error = NULL;
- ClutterInitError res;
-
- if (clutter_is_initialized)
- return CLUTTER_INIT_SUCCESS;
-
- clutter_base_init ();
-
- ctx = _clutter_context_get_default ();
-
- if (!ctx->defer_display_setup)
- {
-#if 0
- if (argc && *argc > 0 && *argv)
- g_set_prgname ((*argv)[0]);
-#endif
-
- /* parse_args will trigger backend creation and things like
- * DISPLAY connection etc.
- */
- if (!clutter_parse_args (argc, argv, &error))
- {
- g_critical ("Unable to initialize Clutter: %s", error->message);
- g_error_free (error);
-
- res = CLUTTER_INIT_ERROR_INTERNAL;
- }
- else
- res = CLUTTER_INIT_SUCCESS;
- }
- else
- {
- res = clutter_init_real (&error);
- if (error != NULL)
- {
- g_critical ("Unable to initialize Clutter: %s", error->message);
- g_error_free (error);
- }
- }
-
- return res;
-}
-
-gboolean
-_clutter_boolean_handled_accumulator (GSignalInvocationHint *ihint,
- GValue *return_accu,
- const GValue *handler_return,
- gpointer dummy)
-{
- gboolean continue_emission;
- gboolean signal_handled;
-
- signal_handled = g_value_get_boolean (handler_return);
- g_value_set_boolean (return_accu, signal_handled);
- continue_emission = !signal_handled;
-
- return continue_emission;
-}
-
-gboolean
-_clutter_boolean_continue_accumulator (GSignalInvocationHint *ihint,
- GValue *return_accu,
- const GValue *handler_return,
- gpointer dummy)
-{
- gboolean continue_emission;
-
- continue_emission = g_value_get_boolean (handler_return);
- g_value_set_boolean (return_accu, continue_emission);
-
- return continue_emission;
-}
-
-static void
-event_click_count_generate (ClutterEvent *event)
-{
- /* multiple button click detection */
- static gint click_count = 0;
- static gint previous_x = -1;
- static gint previous_y = -1;
- static guint32 previous_time = 0;
- static gint previous_button_number = -1;
-
- ClutterInputDevice *device = NULL;
- ClutterSettings *settings;
- guint double_click_time;
- guint double_click_distance;
-
- settings = clutter_settings_get_default ();
-
- g_object_get (settings,
- "double-click-distance", &double_click_distance,
- "double-click-time", &double_click_time,
- NULL);
-
- device = clutter_event_get_device (event);
- if (device != NULL)
- {
- click_count = device->click_count;
- previous_x = device->previous_x;
- previous_y = device->previous_y;
- previous_time = device->previous_time;
- previous_button_number = device->previous_button_number;
-
- CLUTTER_NOTE (EVENT,
- "Restoring previous click count:%d (device:%s, time:%u)",
- click_count,
- clutter_input_device_get_device_name (device),
- previous_time);
- }
- else
- {
- CLUTTER_NOTE (EVENT,
- "Restoring previous click count:%d (time:%u)",
- click_count,
- previous_time);
- }
-
- switch (clutter_event_type (event))
- {
- case CLUTTER_BUTTON_PRESS:
- /* check if we are in time and within distance to increment an
- * existing click count
- */
- if (event->button.button == previous_button_number &&
- event->button.time < (previous_time + double_click_time) &&
- (ABS (event->button.x - previous_x) <= double_click_distance) &&
- (ABS (event->button.y - previous_y) <= double_click_distance))
- {
- CLUTTER_NOTE (EVENT, "Increase click count (button: %d, time: %u)",
- event->button.button,
- event->button.time);
-
- click_count += 1;
- }
- else /* start a new click count*/
- {
- CLUTTER_NOTE (EVENT, "Reset click count (button: %d, time: %u)",
- event->button.button,
- event->button.time);
-
- click_count = 1;
- previous_button_number = event->button.button;
- }
-
- previous_x = event->button.x;
- previous_y = event->button.y;
- previous_time = event->button.time;
-
- G_GNUC_FALLTHROUGH;
- case CLUTTER_BUTTON_RELEASE:
- event->button.click_count = click_count;
- break;
-
- default:
- g_assert_not_reached ();
- break;
- }
-
- if (event->type == CLUTTER_BUTTON_PRESS && device != NULL)
- {
- CLUTTER_NOTE (EVENT, "Storing click count: %d (device:%s, time:%u)",
- click_count,
- clutter_input_device_get_device_name (device),
- previous_time);
-
- device->click_count = click_count;
- device->previous_x = previous_x;
- device->previous_y = previous_y;
- device->previous_time = previous_time;
- device->previous_button_number = previous_button_number;
- }
-}
-
-static inline void
-emit_event_chain (ClutterEvent *event)
-{
- if (event->any.source == NULL)
- {
- CLUTTER_NOTE (EVENT, "No source set, discarding event");
- return;
- }
-
- _clutter_actor_handle_event (event->any.source, event);
-}
-
-/*
- * Emits a pointer event after having prepared the event for delivery (setting
- * source, computing click_count, generating enter/leave etc.).
- */
-
-static inline void
-emit_pointer_event (ClutterEvent *event,
- ClutterInputDevice *device)
-{
- if (_clutter_event_process_filters (event))
- return;
-
- if (device != NULL && device->pointer_grab_actor != NULL)
- clutter_actor_event (device->pointer_grab_actor, event, FALSE);
- else
- emit_event_chain (event);
-}
-
-static inline void
-emit_crossing_event (ClutterEvent *event,
- ClutterInputDevice *device)
-{
- ClutterEventSequence *sequence = clutter_event_get_event_sequence (event);
- ClutterActor *grab_actor = NULL;
-
- if (_clutter_event_process_filters (event))
- return;
-
- if (sequence)
- {
- if (device->sequence_grab_actors != NULL)
- grab_actor = g_hash_table_lookup (device->sequence_grab_actors, sequence);
- }
- else
- {
- if (device != NULL && device->pointer_grab_actor != NULL)
- grab_actor = device->pointer_grab_actor;
- }
-
- if (grab_actor != NULL)
- clutter_actor_event (grab_actor, event, FALSE);
- else
- emit_event_chain (event);
-}
-
-static inline void
-emit_touch_event (ClutterEvent *event,
- ClutterInputDevice *device)
-{
- ClutterActor *grab_actor = NULL;
-
- if (_clutter_event_process_filters (event))
- return;
-
- if (device->sequence_grab_actors != NULL)
- {
- grab_actor = g_hash_table_lookup (device->sequence_grab_actors,
- event->touch.sequence);
- }
-
- if (grab_actor != NULL)
- {
- /* per-device sequence grab */
- clutter_actor_event (grab_actor, event, FALSE);
- }
- else
- {
- /* no grab, time to capture and bubble */
- emit_event_chain (event);
- }
-}
-
-static inline void
-process_key_event (ClutterEvent *event,
- ClutterInputDevice *device)
-{
- if (_clutter_event_process_filters (event))
- return;
-
- if (device != NULL && device->keyboard_grab_actor != NULL)
- clutter_actor_event (device->keyboard_grab_actor, event, FALSE);
- else
- emit_event_chain (event);
-}
-
-static gboolean
-is_off_stage (ClutterActor *stage,
- gfloat x,
- gfloat y)
-{
- gfloat width, height;
-
- clutter_actor_get_size (stage, &width, &height);
-
- return (x < 0 ||
- y < 0 ||
- x >= width ||
- y >= height);
-}
-
-/**
- * clutter_do_event:
- * @event: a #ClutterEvent.
- *
- * Processes an event.
- *
- * The @event must be a valid #ClutterEvent and have a #ClutterStage
- * associated to it.
- *
- * This function is only useful when embedding Clutter inside another
- * toolkit, and it should never be called by applications.
- *
- * Since: 0.4
- */
-void
-clutter_do_event (ClutterEvent *event)
-{
- /* we need the stage for the event */
- if (event->any.stage == NULL)
- {
- g_warning ("%s: Event does not have a stage: discarding.", G_STRFUNC);
- return;
- }
-
- /* stages in destruction do not process events */
- if (CLUTTER_ACTOR_IN_DESTRUCTION (event->any.stage))
- return;
-
- /* Instead of processing events when received, we queue them up to
- * handle per-frame before animations, layout, and drawing.
- *
- * This gives us the chance to reliably compress motion events
- * because we've "looked ahead" and know all motion events that
- * will occur before drawing the frame.
- */
- _clutter_stage_queue_event (event->any.stage, event, TRUE);
-}
-
-static void
-create_crossing_event (ClutterStage *stage,
- ClutterInputDevice *device,
- ClutterEventSequence *sequence,
- ClutterEventType event_type,
- ClutterActor *source,
- ClutterActor *related,
- graphene_point_t coords,
- uint32_t time)
-{
- ClutterEvent *event;
-
- event = clutter_event_new (event_type);
- event->crossing.time = time;
- event->crossing.flags = 0;
- event->crossing.stage = stage;
- event->crossing.source = source;
- event->crossing.x = coords.x;
- event->crossing.y = coords.y;
- event->crossing.related = related;
- event->crossing.sequence = sequence;
- clutter_event_set_device (event, device);
-
- /* we need to make sure that this event is processed
- * before any other event we might have queued up until
- * now, so we go on, and synthesize the event emission
- * ourselves
- */
- _clutter_process_event (event);
-
- clutter_event_free (event);
-}
-
-void
-clutter_stage_update_device (ClutterStage *stage,
- ClutterInputDevice *device,
- ClutterEventSequence *sequence,
- graphene_point_t point,
- uint32_t time,
- ClutterActor *new_actor,
- gboolean emit_crossing)
-{
- ClutterInputDeviceType device_type;
- ClutterActor *old_actor;
- gboolean device_actor_changed;
-
- device_type = clutter_input_device_get_device_type (device);
-
- g_assert (device_type != CLUTTER_KEYBOARD_DEVICE &&
- device_type != CLUTTER_PAD_DEVICE);
-
- old_actor = clutter_stage_get_device_actor (stage, device, sequence);
- device_actor_changed = new_actor != old_actor;
-
- clutter_stage_update_device_entry (stage,
- device, sequence,
- point,
- new_actor);
-
- if (device_actor_changed)
- {
- CLUTTER_NOTE (EVENT,
- "Updating actor under cursor (device %s, at %.2f, %.2f): %s",
- clutter_input_device_get_device_name (device),
- point.x,
- point.y,
- _clutter_actor_get_debug_name (new_actor));
-
- if (old_actor && emit_crossing)
- {
- create_crossing_event (stage,
- device, sequence,
- CLUTTER_LEAVE,
- old_actor, new_actor,
- point, time);
- }
-
- if (new_actor && emit_crossing)
- {
- create_crossing_event (stage,
- device, sequence,
- CLUTTER_ENTER,
- new_actor, old_actor,
- point, time);
- }
- }
-}
-
-void
-clutter_stage_repick_device (ClutterStage *stage,
- ClutterInputDevice *device)
-{
- graphene_point_t point;
- ClutterActor *new_actor;
-
- clutter_stage_get_device_coords (stage, device, NULL, &point);
- new_actor =
- clutter_stage_get_actor_at_pos (stage, CLUTTER_PICK_REACTIVE,
- point.x, point.y);
-
- clutter_stage_update_device (stage,
- device, NULL,
- point,
- CLUTTER_CURRENT_TIME,
- new_actor,
- TRUE);
-}
-
-static ClutterActor *
-update_device_for_event (ClutterStage *stage,
- ClutterEvent *event,
- gboolean emit_crossing)
-{
- ClutterInputDevice *device = clutter_event_get_device (event);
- ClutterEventSequence *sequence = clutter_event_get_event_sequence (event);
- ClutterActor *new_actor;
- graphene_point_t point;
- uint32_t time;
-
- clutter_event_get_coords (event, &point.x, &point.y);
- time = clutter_event_get_time (event);
-
- new_actor =
- _clutter_stage_do_pick (stage, point.x, point.y, CLUTTER_PICK_REACTIVE);
-
- /* Picking should never fail, but if it does, we bail out here */
- g_return_val_if_fail (new_actor != NULL, NULL);
-
- clutter_stage_update_device (stage,
- device, sequence,
- point,
- time,
- new_actor,
- emit_crossing);
-
- return new_actor;
-}
-
-static void
-remove_device_for_event (ClutterStage *stage,
- ClutterEvent *event,
- gboolean emit_crossing)
-{
- ClutterInputDevice *device = clutter_event_get_device (event);
- ClutterEventSequence *sequence = clutter_event_get_event_sequence (event);
- graphene_point_t point;
- uint32_t time;
-
- clutter_event_get_coords (event, &point.x, &point.y);
- time = clutter_event_get_time (event);
-
- clutter_stage_update_device (stage,
- device, sequence,
- point,
- time,
- NULL,
- TRUE);
-
- clutter_stage_remove_device_entry (stage, device, sequence);
-}
-
-
-static void
-_clutter_process_event_details (ClutterActor *stage,
- ClutterMainContext *context,
- ClutterEvent *event)
-{
- ClutterInputDevice *device = clutter_event_get_device (event);
- ClutterMainContext *clutter_context;
- ClutterBackend *backend;
-
- clutter_context = _clutter_context_get_default ();
- backend = clutter_context->backend;
-
- switch (event->type)
- {
- case CLUTTER_NOTHING:
- event->any.source = stage;
- break;
-
- case CLUTTER_KEY_PRESS:
- case CLUTTER_KEY_RELEASE:
- case CLUTTER_PAD_BUTTON_PRESS:
- case CLUTTER_PAD_BUTTON_RELEASE:
- case CLUTTER_PAD_STRIP:
- case CLUTTER_PAD_RING:
- case CLUTTER_IM_COMMIT:
- case CLUTTER_IM_DELETE:
- case CLUTTER_IM_PREEDIT:
- {
- ClutterActor *actor = NULL;
-
- /* check that we're not a synthetic event with source set */
- if (event->any.source == NULL)
- {
- actor = clutter_stage_get_key_focus (CLUTTER_STAGE (stage));
- event->any.source = actor;
- if (G_UNLIKELY (actor == NULL))
- {
- g_warning ("No key focus set, discarding");
- return;
- }
- }
-
- process_key_event (event, device);
- }
- break;
-
- case CLUTTER_ENTER:
- /* if we're entering from outside the stage we need
- * to check whether the pointer is actually on another
- * actor, and emit an additional pointer event
- */
- if (event->any.source == stage &&
- event->crossing.related == NULL)
- {
- ClutterActor *actor = NULL;
-
- emit_crossing_event (event, device);
-
- actor = update_device_for_event (CLUTTER_STAGE (stage), event, FALSE);
- if (actor != stage)
- {
- ClutterEvent *crossing;
-
- /* we emit the exact same event on the actor */
- crossing = clutter_event_copy (event);
- crossing->crossing.related = stage;
- crossing->crossing.source = actor;
-
- emit_crossing_event (crossing, device);
- clutter_event_free (crossing);
- }
- }
- else
- emit_crossing_event (event, device);
- break;
-
- case CLUTTER_LEAVE:
- /* same as CLUTTER_ENTER above: when leaving the stage
- * we need to also emit a CLUTTER_LEAVE event on the
- * actor currently underneath the device, unless it's the
- * stage
- */
- if (event->any.source == stage &&
- event->crossing.related == NULL &&
- clutter_stage_get_device_actor (CLUTTER_STAGE (stage), device, NULL) != stage)
- {
- ClutterEvent *crossing;
-
- crossing = clutter_event_copy (event);
- crossing->crossing.related = stage;
- crossing->crossing.source =
- clutter_stage_get_device_actor (CLUTTER_STAGE (stage), device, NULL);
-
- emit_crossing_event (crossing, device);
- clutter_event_free (crossing);
- }
- emit_crossing_event (event, device);
- break;
-
- case CLUTTER_MOTION:
- if (clutter_backend_is_display_server (backend) &&
- !(event->any.flags & CLUTTER_EVENT_FLAG_SYNTHETIC))
- {
- if (_clutter_is_input_pointer_a11y_enabled (device))
- {
- gfloat x, y;
-
- clutter_event_get_coords (event, &x, &y);
- _clutter_input_pointer_a11y_on_motion_event (device, x, y);
- }
- }
- /* only the stage gets motion events if they are enabled */
- if (!clutter_stage_get_motion_events_enabled (CLUTTER_STAGE (stage)) &&
- event->any.source == NULL)
- {
- /* Only stage gets motion events */
- event->any.source = stage;
-
- if (_clutter_event_process_filters (event))
- break;
-
- if (device != NULL && device->pointer_grab_actor != NULL)
- {
- clutter_actor_event (device->pointer_grab_actor,
- event,
- FALSE);
- break;
- }
-
- /* Trigger handlers on stage in both capture .. */
- if (!clutter_actor_event (stage, event, TRUE))
- {
- /* and bubbling phase */
- clutter_actor_event (stage, event, FALSE);
- }
- break;
- }
-
- G_GNUC_FALLTHROUGH;
- case CLUTTER_BUTTON_PRESS:
- case CLUTTER_BUTTON_RELEASE:
- if (clutter_backend_is_display_server (backend))
- {
- if (_clutter_is_input_pointer_a11y_enabled (device) && (event->type != CLUTTER_MOTION))
- {
- _clutter_input_pointer_a11y_on_button_event (device,
- event->button.button,
- event->type == CLUTTER_BUTTON_PRESS);
- }
- }
- case CLUTTER_SCROLL:
- case CLUTTER_TOUCHPAD_PINCH:
- case CLUTTER_TOUCHPAD_SWIPE:
- {
- gfloat x, y;
-
- clutter_event_get_coords (event, &x, &y);
-
- /* Only do a pick to find the source if source is not already set
- * (as it could be in a synthetic event)
- */
- if (event->any.source == NULL)
- {
- /* emulate X11 the implicit soft grab; the implicit soft grab
- * keeps relaying motion events when the stage is left with a
- * pointer button pressed. since this is what happens when we
- * disable per-actor motion events we need to maintain the same
- * behaviour when the per-actor motion events are enabled as
- * well
- */
- if (is_off_stage (stage, x, y))
- {
- if (event->type == CLUTTER_BUTTON_RELEASE)
- {
- CLUTTER_NOTE (EVENT,
- "Release off stage received at %.2f, %.2f",
- x, y);
-
- event->button.source = stage;
- event->button.click_count = 1;
-
- emit_pointer_event (event, device);
- }
- else if (event->type == CLUTTER_MOTION)
- {
- CLUTTER_NOTE (EVENT,
- "Motion off stage received at %.2f, %2.f",
- x, y);
-
- event->motion.source = stage;
-
- emit_pointer_event (event, device);
- }
-
- break;
- }
-
- /* We need to repick on both motion and button press events, the
- * latter is only needed for X11 (there the device actor might be
- * stale because we don't always receive motion events).
- */
- if (event->type == CLUTTER_BUTTON_PRESS ||
- event->type == CLUTTER_MOTION)
- {
- event->any.source =
- update_device_for_event (CLUTTER_STAGE (stage), event, TRUE);
- }
- else
- {
- event->any.source =
- clutter_stage_get_device_actor (CLUTTER_STAGE (stage),
- device,
- NULL);
- }
-
- if (event->any.source == NULL)
- break;
- }
-
- CLUTTER_NOTE (EVENT,
- "Reactive event received at %.2f, %.2f - actor: %p",
- x, y,
- event->any.source);
-
- /* button presses and releases need a click count */
- if (event->type == CLUTTER_BUTTON_PRESS ||
- event->type == CLUTTER_BUTTON_RELEASE)
- {
- /* Generate click count */
- event_click_count_generate (event);
- }
-
- emit_pointer_event (event, device);
- break;
- }
-
- case CLUTTER_TOUCH_UPDATE:
- /* only the stage gets motion events if they are enabled */
- if (!clutter_stage_get_motion_events_enabled (CLUTTER_STAGE (stage)) &&
- event->any.source == NULL)
- {
- ClutterActor *grab_actor = NULL;
-
- /* Only stage gets motion events */
- event->any.source = stage;
-
- if (_clutter_event_process_filters (event))
- break;
-
- /* global grabs */
- if (device->sequence_grab_actors != NULL)
- {
- grab_actor = g_hash_table_lookup (device->sequence_grab_actors,
- event->touch.sequence);
- }
-
- if (grab_actor != NULL)
- {
- clutter_actor_event (grab_actor, event, FALSE);
- break;
- }
-
- /* Trigger handlers on stage in both capture .. */
- if (!clutter_actor_event (stage, event, TRUE))
- {
- /* and bubbling phase */
- clutter_actor_event (stage, event, FALSE);
- }
- break;
- }
-
- G_GNUC_FALLTHROUGH;
- case CLUTTER_TOUCH_BEGIN:
- case CLUTTER_TOUCH_CANCEL:
- case CLUTTER_TOUCH_END:
- {
- gfloat x, y;
-
- clutter_event_get_coords (event, &x, &y);
-
- /* Only do a pick to find the source if source is not already set
- * (as it could be in a synthetic event)
- */
- if (event->any.source == NULL)
- {
- /* same as the mouse events above, emulate the X11 implicit
- * soft grab */
- if (is_off_stage (stage, x, y))
- {
- CLUTTER_NOTE (EVENT,
- "Touch %s off stage received at %.2f, %.2f",
- event->type == CLUTTER_TOUCH_UPDATE ? "update" :
- event->type == CLUTTER_TOUCH_END ? "end" :
- event->type == CLUTTER_TOUCH_CANCEL ? "cancel" :
- "?", x, y);
-
- event->touch.source = stage;
-
- emit_touch_event (event, device);
-
- if (event->type == CLUTTER_TOUCH_END ||
- event->type == CLUTTER_TOUCH_CANCEL)
- remove_device_for_event (CLUTTER_STAGE (stage), event, TRUE);
-
- break;
- }
-
- if (event->type == CLUTTER_TOUCH_BEGIN ||
- event->type == CLUTTER_TOUCH_UPDATE)
- {
- event->any.source =
- update_device_for_event (CLUTTER_STAGE (stage), event, TRUE);
- }
- else
- {
- event->any.source =
- clutter_stage_get_device_actor (CLUTTER_STAGE (stage),
- device,
- event->touch.sequence);
- }
-
- if (event->any.source == NULL)
- break;
- }
-
- CLUTTER_NOTE (EVENT,
- "Reactive event received at %.2f, %.2f - actor: %p",
- x, y,
- event->any.source);
-
- emit_touch_event (event, device);
-
- if (event->type == CLUTTER_TOUCH_END ||
- event->type == CLUTTER_TOUCH_CANCEL)
- remove_device_for_event (CLUTTER_STAGE (stage), event, TRUE);
-
- break;
- }
-
- case CLUTTER_PROXIMITY_IN:
- case CLUTTER_PROXIMITY_OUT:
- if (_clutter_event_process_filters (event))
- break;
-
- if (!clutter_actor_event (stage, event, TRUE))
- {
- /* and bubbling phase */
- clutter_actor_event (stage, event, FALSE);
- }
-
- break;
-
- case CLUTTER_DEVICE_ADDED:
- _clutter_event_process_filters (event);
- break;
-
- case CLUTTER_DEVICE_REMOVED:
- {
- ClutterInputDeviceType device_type;
-
- _clutter_event_process_filters (event);
-
- device_type = clutter_input_device_get_device_type (device);
- if (device_type == CLUTTER_POINTER_DEVICE ||
- device_type == CLUTTER_TABLET_DEVICE ||
- device_type == CLUTTER_PEN_DEVICE ||
- device_type == CLUTTER_ERASER_DEVICE ||
- device_type == CLUTTER_CURSOR_DEVICE)
- remove_device_for_event (CLUTTER_STAGE (stage), event, TRUE);
-
- break;
- }
-
- case CLUTTER_EVENT_LAST:
- break;
- }
-}
-
-/*
- * _clutter_process_event
- * @event: a #ClutterEvent.
- *
- * Does the actual work of processing an event that was queued earlier
- * out of clutter_do_event().
- */
-void
-_clutter_process_event (ClutterEvent *event)
-{
- ClutterMainContext *context;
- ClutterActor *stage;
- ClutterSeat *seat;
-
- context = _clutter_context_get_default ();
- seat = clutter_backend_get_default_seat (context->backend);
-
- stage = CLUTTER_ACTOR (event->any.stage);
- if (stage == NULL)
- {
- CLUTTER_NOTE (EVENT, "Discarding event without a stage set");
- return;
- }
-
- /* push events on a stack, so that we don't need to
- * add an event parameter to all signals that can be emitted within
- * an event chain
- */
- context->current_event = g_slist_prepend (context->current_event, event);
-
- clutter_seat_handle_event_post (seat, event);
- _clutter_process_event_details (stage, context, event);
-
- context->current_event = g_slist_delete_link (context->current_event, context->current_event);
-}
-
-void
-clutter_base_init (void)
-{
- static gboolean initialised = FALSE;
-
- if (!initialised)
- {
- initialised = TRUE;
-
-#if !GLIB_CHECK_VERSION (2, 35, 1)
- /* initialise GLib type system */
- g_type_init ();
-#endif
-
- clutter_graphene_init ();
- }
-}
-
-/**
- * clutter_get_default_frame_rate:
- *
- * Retrieves the default frame rate. See clutter_set_default_frame_rate().
- *
- * Return value: the default frame rate
- *
- * Since: 0.6
- */
-guint
-clutter_get_default_frame_rate (void)
-{
- ClutterMainContext *context;
-
- context = _clutter_context_get_default ();
-
- return context->frame_rate;
-}
-
-/**
- * clutter_get_font_map:
- *
- * Retrieves the #PangoFontMap instance used by Clutter.
- * You can use the global font map object with the COGL
- * Pango API.
- *
- * Return value: (transfer none): the #PangoFontMap instance. The returned
- * value is owned by Clutter and it should never be unreferenced.
- *
- * Since: 1.0
- */
-PangoFontMap *
-clutter_get_font_map (void)
-{
- return PANGO_FONT_MAP (clutter_context_get_pango_fontmap ());
-}
-
-typedef struct _ClutterRepaintFunction
-{
- guint id;
- ClutterRepaintFlags flags;
- GSourceFunc func;
- gpointer data;
- GDestroyNotify notify;
-} ClutterRepaintFunction;
-
-/**
- * clutter_threads_remove_repaint_func:
- * @handle_id: an unsigned integer greater than zero
- *
- * Removes the repaint function with @handle_id as its id
- *
- * Since: 1.0
- */
-void
-clutter_threads_remove_repaint_func (guint handle_id)
-{
- ClutterRepaintFunction *repaint_func;
- ClutterMainContext *context;
- GList *l;
-
- g_return_if_fail (handle_id > 0);
-
- context = _clutter_context_get_default ();
- l = context->repaint_funcs;
- while (l != NULL)
- {
- repaint_func = l->data;
-
- if (repaint_func->id == handle_id)
- {
- context->repaint_funcs =
- g_list_remove_link (context->repaint_funcs, l);
-
- g_list_free (l);
-
- if (repaint_func->notify)
- repaint_func->notify (repaint_func->data);
-
- g_free (repaint_func);
-
- break;
- }
-
- l = l->next;
- }
-}
-
-/**
- * clutter_threads_add_repaint_func:
- * @func: the function to be called within the paint cycle
- * @data: data to be passed to the function, or %NULL
- * @notify: function to be called when removing the repaint
- * function, or %NULL
- *
- * Adds a function to be called whenever Clutter is processing a new
- * frame.
- *
- * If the function returns %FALSE it is automatically removed from the
- * list of repaint functions and will not be called again.
- *
- * This function is guaranteed to be called from within the same thread
- * that called clutter_main(), and while the Clutter lock is being held;
- * the function will be called within the main loop, so it is imperative
- * that it does not block, otherwise the frame time budget may be lost.
- *
- * A repaint function is useful to ensure that an update of the scenegraph
- * is performed before the scenegraph is repainted. By default, a repaint
- * function added using this function will be invoked prior to the frame
- * being processed.
- *
- * Adding a repaint function does not automatically ensure that a new
- * frame will be queued.
- *
- * When the repaint function is removed (either because it returned %FALSE
- * or because clutter_threads_remove_repaint_func() has been called) the
- * @notify function will be called, if any is set.
- *
- * See also: clutter_threads_add_repaint_func_full()
- *
- * Return value: the ID (greater than 0) of the repaint function. You
- * can use the returned integer to remove the repaint function by
- * calling clutter_threads_remove_repaint_func().
- *
- * Since: 1.0
- */
-guint
-clutter_threads_add_repaint_func (GSourceFunc func,
- gpointer data,
- GDestroyNotify notify)
-{
- return clutter_threads_add_repaint_func_full (CLUTTER_REPAINT_FLAGS_PRE_PAINT,
- func,
- data, notify);
-}
-
-/**
- * clutter_threads_add_repaint_func_full:
- * @flags: flags for the repaint function
- * @func: the function to be called within the paint cycle
- * @data: data to be passed to the function, or %NULL
- * @notify: function to be called when removing the repaint
- * function, or %NULL
- *
- * Adds a function to be called whenever Clutter is processing a new
- * frame.
- *
- * If the function returns %FALSE it is automatically removed from the
- * list of repaint functions and will not be called again.
- *
- * This function is guaranteed to be called from within the same thread
- * that called clutter_main(), and while the Clutter lock is being held;
- * the function will be called within the main loop, so it is imperative
- * that it does not block, otherwise the frame time budget may be lost.
- *
- * A repaint function is useful to ensure that an update of the scenegraph
- * is performed before the scenegraph is repainted. The @flags passed to this
- * function will determine the section of the frame processing that will
- * result in @func being called.
- *
- * Adding a repaint function does not automatically ensure that a new
- * frame will be queued.
- *
- * When the repaint function is removed (either because it returned %FALSE
- * or because clutter_threads_remove_repaint_func() has been called) the
- * @notify function will be called, if any is set.
- *
- * Return value: the ID (greater than 0) of the repaint function. You
- * can use the returned integer to remove the repaint function by
- * calling clutter_threads_remove_repaint_func().
- *
- * Since: 1.10
- */
-guint
-clutter_threads_add_repaint_func_full (ClutterRepaintFlags flags,
- GSourceFunc func,
- gpointer data,
- GDestroyNotify notify)
-{
- ClutterMainContext *context;
- ClutterRepaintFunction *repaint_func;
-
- g_return_val_if_fail (func != NULL, 0);
-
- context = _clutter_context_get_default ();
-
- repaint_func = g_new0 (ClutterRepaintFunction, 1);
-
- repaint_func->id = context->last_repaint_id++;
-
- repaint_func->flags = flags;
- repaint_func->func = func;
- repaint_func->data = data;
- repaint_func->notify = notify;
-
- context->repaint_funcs = g_list_prepend (context->repaint_funcs,
- repaint_func);
-
- return repaint_func->id;
-}
-
-/*
- * _clutter_run_repaint_functions:
- * @flags: only run the repaint functions matching the passed flags
- *
- * Executes the repaint functions added using the
- * clutter_threads_add_repaint_func() function.
- *
- * Must be called with the Clutter thread lock held.
- */
-void
-_clutter_run_repaint_functions (ClutterRepaintFlags flags)
-{
- ClutterMainContext *context = _clutter_context_get_default ();
- ClutterRepaintFunction *repaint_func;
- GList *invoke_list, *reinvoke_list, *l;
-
- if (context->repaint_funcs == NULL)
- return;
-
- /* steal the list */
- invoke_list = context->repaint_funcs;
- context->repaint_funcs = NULL;
-
- reinvoke_list = NULL;
-
- /* consume the whole list while we execute the functions */
- while (invoke_list != NULL)
- {
- gboolean res = FALSE;
-
- repaint_func = invoke_list->data;
-
- l = invoke_list;
- invoke_list = g_list_remove_link (invoke_list, invoke_list);
-
- g_list_free (l);
-
- if ((repaint_func->flags & flags) != 0)
- res = repaint_func->func (repaint_func->data);
- else
- res = TRUE;
-
- if (res)
- reinvoke_list = g_list_prepend (reinvoke_list, repaint_func);
- else
- {
- if (repaint_func->notify != NULL)
- repaint_func->notify (repaint_func->data);
-
- g_free (repaint_func);
- }
- }
-
- if (context->repaint_funcs != NULL)
- {
- context->repaint_funcs = g_list_concat (context->repaint_funcs,
- g_list_reverse (reinvoke_list));
- }
- else
- context->repaint_funcs = g_list_reverse (reinvoke_list);
-}
-
-/**
- * clutter_get_default_text_direction:
- *
- * Retrieves the default direction for the text. The text direction is
- * determined by the locale and/or by the `CLUTTER_TEXT_DIRECTION`
- * environment variable.
- *
- * The default text direction can be overridden on a per-actor basis by using
- * clutter_actor_set_text_direction().
- *
- * Return value: the default text direction
- *
- * Since: 1.2
- */
-ClutterTextDirection
-clutter_get_default_text_direction (void)
-{
- return clutter_text_direction;
-}
-
-/*< private >
- * clutter_clear_events_queue:
- *
- * Clears the events queue stored in the main context.
- */
-void
-_clutter_clear_events_queue (void)
-{
- ClutterMainContext *context = _clutter_context_get_default ();
- ClutterEvent *event;
- GAsyncQueue *events_queue;
-
- if (!context->events_queue)
- return;
-
- g_async_queue_lock (context->events_queue);
-
- while ((event = g_async_queue_try_pop_unlocked (context->events_queue)))
- clutter_event_free (event);
-
- events_queue = context->events_queue;
- context->events_queue = NULL;
-
- g_async_queue_unlock (events_queue);
- g_async_queue_unref (events_queue);
-}
-
-/**
- * clutter_add_debug_flags: (skip)
- *
- * Adds the debug flags passed to the list of debug flags.
- */
-void
-clutter_add_debug_flags (ClutterDebugFlag debug_flags,
- ClutterDrawDebugFlag draw_flags,
- ClutterPickDebugFlag pick_flags)
-{
- clutter_debug_flags |= debug_flags;
- clutter_paint_debug_flags |= draw_flags;
- clutter_pick_debug_flags |= pick_flags;
-}
-
-/**
- * clutter_remove_debug_flags: (skip)
- *
- * Removes the debug flags passed from the list of debug flags.
- */
-void
-clutter_remove_debug_flags (ClutterDebugFlag debug_flags,
- ClutterDrawDebugFlag draw_flags,
- ClutterPickDebugFlag pick_flags)
-{
- clutter_debug_flags &= ~debug_flags;
- clutter_paint_debug_flags &= ~draw_flags;
- clutter_pick_debug_flags &= ~pick_flags;
-}
-
-void
-clutter_debug_set_max_render_time_constant (int max_render_time_constant_us)
-{
- clutter_max_render_time_constant_us = max_render_time_constant_us;
-}
-
-void
-clutter_get_debug_flags (ClutterDebugFlag *debug_flags,
- ClutterDrawDebugFlag *draw_flags,
- ClutterPickDebugFlag *pick_flags)
-{
- if (debug_flags)
- *debug_flags = clutter_debug_flags;
- if (draw_flags)
- *draw_flags = clutter_paint_debug_flags;
- if (pick_flags)
- *pick_flags = clutter_pick_debug_flags;
-}
-
-void
-_clutter_set_sync_to_vblank (gboolean sync_to_vblank)
-{
- clutter_sync_to_vblank = !!sync_to_vblank;
-}
-
-void
-_clutter_debug_messagev (const char *format,
- va_list var_args)
-{
- static gint64 last_debug_stamp;
- gchar *stamp, *fmt;
- gint64 cur_time, debug_stamp;
-
- cur_time = g_get_monotonic_time ();
-
- /* if the last debug message happened less than a second ago, just
- * show the increments instead of the full timestamp
- */
- if (last_debug_stamp == 0 ||
- cur_time - last_debug_stamp >= G_USEC_PER_SEC)
- {
- debug_stamp = cur_time;
- last_debug_stamp = debug_stamp;
-
- stamp = g_strdup_printf ("[%16" G_GINT64_FORMAT "]", debug_stamp);
- }
- else
- {
- debug_stamp = cur_time - last_debug_stamp;
-
- stamp = g_strdup_printf ("[%+16" G_GINT64_FORMAT "]", debug_stamp);
- }
-
- fmt = g_strconcat (stamp, ":", format, NULL);
- g_free (stamp);
-
- g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, fmt, var_args);
-
- g_free (fmt);
-}
-
-void
-_clutter_debug_message (const char *format, ...)
-{
- va_list args;
-
- va_start (args, format);
- _clutter_debug_messagev (format, args);
- va_end (args);
-}
-
-gboolean
-_clutter_diagnostic_enabled (void)
-{
- static const char *clutter_enable_diagnostic = NULL;
-
- if (G_UNLIKELY (clutter_enable_diagnostic == NULL))
- {
- clutter_enable_diagnostic = g_getenv ("CLUTTER_ENABLE_DIAGNOSTIC");
-
- if (clutter_enable_diagnostic == NULL)
- clutter_enable_diagnostic = "0";
- }
-
- return *clutter_enable_diagnostic != '0';
-}
-
-void
-_clutter_diagnostic_message (const char *format, ...)
-{
- va_list args;
- char *fmt;
-
- fmt = g_strconcat ("[DIAGNOSTIC]: ", format, NULL);
-
- va_start (args, format);
- g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, fmt, args);
- va_end (args);
-
- g_free (fmt);
-}
diff --git a/clutter/clutter/clutter-main.h b/clutter/clutter/clutter-main.h
deleted file mode 100644
index e59361eb7..000000000
--- a/clutter/clutter/clutter-main.h
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- *
- * Copyright (C) 2006 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 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_MAIN_H__
-#define __CLUTTER_MAIN_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-actor.h>
-#include <clutter/clutter-stage.h>
-#include <pango/pango.h>
-
-G_BEGIN_DECLS
-
-typedef enum
-{
- CLUTTER_DEBUG_MISC = 1 << 0,
- CLUTTER_DEBUG_ACTOR = 1 << 1,
- CLUTTER_DEBUG_TEXTURE = 1 << 2,
- CLUTTER_DEBUG_EVENT = 1 << 3,
- CLUTTER_DEBUG_PAINT = 1 << 4,
- CLUTTER_DEBUG_PANGO = 1 << 5,
- CLUTTER_DEBUG_BACKEND = 1 << 6,
- CLUTTER_DEBUG_SCHEDULER = 1 << 7,
- CLUTTER_DEBUG_SCRIPT = 1 << 8,
- CLUTTER_DEBUG_SHADER = 1 << 9,
- CLUTTER_DEBUG_MULTISTAGE = 1 << 10,
- CLUTTER_DEBUG_ANIMATION = 1 << 11,
- CLUTTER_DEBUG_LAYOUT = 1 << 12,
- CLUTTER_DEBUG_PICK = 1 << 13,
- CLUTTER_DEBUG_EVENTLOOP = 1 << 14,
- CLUTTER_DEBUG_CLIPPING = 1 << 15,
- CLUTTER_DEBUG_OOB_TRANSFORMS = 1 << 16,
- CLUTTER_DEBUG_FRAME_TIMINGS = 1 << 17,
-} ClutterDebugFlag;
-
-typedef enum
-{
- CLUTTER_DEBUG_NOP_PICKING = 1 << 0,
-} ClutterPickDebugFlag;
-
-typedef enum
-{
- CLUTTER_DEBUG_DISABLE_SWAP_EVENTS = 1 << 0,
- CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS = 1 << 1,
- CLUTTER_DEBUG_REDRAWS = 1 << 2,
- CLUTTER_DEBUG_PAINT_VOLUMES = 1 << 3,
- CLUTTER_DEBUG_DISABLE_CULLING = 1 << 4,
- CLUTTER_DEBUG_DISABLE_OFFSCREEN_REDIRECT = 1 << 5,
- CLUTTER_DEBUG_CONTINUOUS_REDRAW = 1 << 6,
- CLUTTER_DEBUG_PAINT_DEFORM_TILES = 1 << 7,
- CLUTTER_DEBUG_PAINT_DAMAGE_REGION = 1 << 8,
- CLUTTER_DEBUG_DISABLE_DYNAMIC_MAX_RENDER_TIME = 1 << 9,
- CLUTTER_DEBUG_PAINT_MAX_RENDER_TIME = 1 << 10,
-} ClutterDrawDebugFlag;
-
-/**
- * CLUTTER_INIT_ERROR:
- *
- * #GError domain for #ClutterInitError
- */
-#define CLUTTER_INIT_ERROR (clutter_init_error_quark ())
-
-/**
- * ClutterInitError:
- * @CLUTTER_INIT_SUCCESS: Initialisation successful
- * @CLUTTER_INIT_ERROR_UNKNOWN: Unknown error
- * @CLUTTER_INIT_ERROR_THREADS: Thread initialisation failed
- * @CLUTTER_INIT_ERROR_BACKEND: Backend initialisation failed
- * @CLUTTER_INIT_ERROR_INTERNAL: Internal error
- *
- * Error conditions returned by clutter_init().
- *
- * Since: 0.2
- */
-typedef enum
-{
- CLUTTER_INIT_SUCCESS = 1,
- CLUTTER_INIT_ERROR_UNKNOWN = 0,
- CLUTTER_INIT_ERROR_THREADS = -1,
- CLUTTER_INIT_ERROR_BACKEND = -2,
- CLUTTER_INIT_ERROR_INTERNAL = -3
-} ClutterInitError;
-
-CLUTTER_EXPORT
-GQuark clutter_init_error_quark (void);
-
-/**
- * CLUTTER_PRIORITY_REDRAW:
- *
- * Priority of the redraws. This is chosen to be lower than the GTK+
- * redraw and resize priorities, because in application with both
- * GTK+ and Clutter it's more likely that the Clutter part will be
- * continually animating (and thus able to starve GTK+) than
- * vice-versa.
- *
- * Since: 0.8
- */
-#define CLUTTER_PRIORITY_REDRAW (G_PRIORITY_HIGH_IDLE + 50)
-
-/* Initialisation */
-CLUTTER_EXPORT
-void clutter_base_init (void);
-CLUTTER_EXPORT
-ClutterInitError clutter_init (int *argc,
- char ***argv) G_GNUC_WARN_UNUSED_RESULT;
-
-CLUTTER_EXPORT
-GOptionGroup * clutter_get_option_group (void);
-CLUTTER_EXPORT
-GOptionGroup * clutter_get_option_group_without_init (void);
-
-CLUTTER_EXPORT
-void clutter_do_event (ClutterEvent *event);
-
-/* Debug utility functions */
-CLUTTER_EXPORT
-gboolean clutter_get_accessibility_enabled (void);
-
-CLUTTER_EXPORT
-void clutter_disable_accessibility (void);
-
-/* Threading functions */
-CLUTTER_EXPORT
-guint clutter_threads_add_idle (GSourceFunc func,
- gpointer data);
-CLUTTER_EXPORT
-guint clutter_threads_add_idle_full (gint priority,
- GSourceFunc func,
- gpointer data,
- GDestroyNotify notify);
-CLUTTER_EXPORT
-guint clutter_threads_add_timeout (guint interval,
- GSourceFunc func,
- gpointer data);
-CLUTTER_EXPORT
-guint clutter_threads_add_timeout_full (gint priority,
- guint interval,
- GSourceFunc func,
- gpointer data,
- GDestroyNotify notify);
-CLUTTER_EXPORT
-guint clutter_threads_add_repaint_func (GSourceFunc func,
- gpointer data,
- GDestroyNotify notify);
-CLUTTER_EXPORT
-guint clutter_threads_add_repaint_func_full (ClutterRepaintFlags flags,
- GSourceFunc func,
- gpointer data,
- GDestroyNotify notify);
-CLUTTER_EXPORT
-void clutter_threads_remove_repaint_func (guint handle_id);
-
-CLUTTER_EXPORT
-PangoFontMap * clutter_get_font_map (void);
-
-CLUTTER_EXPORT
-ClutterTextDirection clutter_get_default_text_direction (void);
-
-CLUTTER_EXPORT
-guint clutter_get_default_frame_rate (void);
-
-CLUTTER_EXPORT
-void clutter_add_debug_flags (ClutterDebugFlag debug_flags,
- ClutterDrawDebugFlag draw_flags,
- ClutterPickDebugFlag pick_flags);
-
-CLUTTER_EXPORT
-void clutter_remove_debug_flags (ClutterDebugFlag debug_flags,
- ClutterDrawDebugFlag draw_flags,
- ClutterPickDebugFlag pick_flags);
-
-CLUTTER_EXPORT
-void clutter_debug_set_max_render_time_constant (int max_render_time_constant_us);
-
-G_END_DECLS
-
-#endif /* _CLUTTER_MAIN_H__ */
diff --git a/clutter/clutter/clutter-marshal.list b/clutter/clutter/clutter-marshal.list
deleted file mode 100644
index cb64b2dfa..000000000
--- a/clutter/clutter/clutter-marshal.list
+++ /dev/null
@@ -1,35 +0,0 @@
-BOOLEAN:BOXED
-BOOLEAN:BOXED,INT,INT
-BOOLEAN:OBJECT,BOOLEAN
-BOOLEAN:OBJECT,BOXED
-BOOLEAN:OBJECT,BOXED,DOUBLE
-BOOLEAN:OBJECT,DOUBLE
-BOOLEAN:OBJECT,ENUM
-BOOLEAN:OBJECT,FLAGS
-BOOLEAN:STRING,UINT,FLAGS
-BOOLEAN:OBJECT
-BOOLEAN:OBJECT,FLOAT,FLOAT
-BOXED:UINT,UINT
-DOUBLE:VOID
-UINT:VOID
-VOID:BOXED,FLAGS
-VOID:INT64,INT64,FLOAT,BOOLEAN
-VOID:INT,INT
-VOID:INT,POINTER
-VOID:FLOAT,FLOAT
-VOID:INT,INT,INT,INT
-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:STRING,BOOLEAN
-VOID:STRING,BOOLEAN,BOOLEAN
-VOID:STRING,INT
-VOID:UINT,STRING,UINT
-VOID:UINT,UINT
-VOID:STRING,INT,POINTER
diff --git a/clutter/clutter/clutter-mutter.h b/clutter/clutter/clutter-mutter.h
deleted file mode 100644
index 95011aadd..000000000
--- a/clutter/clutter/clutter-mutter.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2016 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_MUTTER_H__
-#define __CLUTTER_MUTTER_H__
-
-#define __CLUTTER_H_INSIDE__
-
-#include "clutter-backend.h"
-#include "clutter-backend-private.h"
-#include "clutter-damage-history.h"
-#include "clutter-event-private.h"
-#include "clutter-input-device-private.h"
-#include "clutter-input-pointer-a11y-private.h"
-#include "clutter-macros.h"
-#include "clutter-private.h"
-#include "clutter-stage-private.h"
-#include "clutter-stage-view.h"
-#include "clutter-stage-view-private.h"
-#include "clutter.h"
-
-CLUTTER_EXPORT
-GList * clutter_stage_peek_stage_views (ClutterStage *stage);
-
-CLUTTER_EXPORT
-gboolean clutter_actor_is_effectively_on_stage_view (ClutterActor *self,
- ClutterStageView *view);
-
-CLUTTER_EXPORT
-void clutter_set_custom_backend_func (ClutterBackend *(* func) (void));
-
-CLUTTER_EXPORT
-int64_t clutter_stage_get_frame_counter (ClutterStage *stage);
-
-CLUTTER_EXPORT
-void clutter_stage_capture_into (ClutterStage *stage,
- cairo_rectangle_int_t *rect,
- float scale,
- uint8_t *data,
- int stride);
-
-CLUTTER_EXPORT
-void clutter_stage_capture_view_into (ClutterStage *stage,
- ClutterStageView *view,
- cairo_rectangle_int_t *rect,
- uint8_t *data,
- int stride);
-
-CLUTTER_EXPORT
-void clutter_stage_clear_stage_views (ClutterStage *stage);
-
-CLUTTER_EXPORT
-void clutter_stage_view_assign_next_scanout (ClutterStageView *stage_view,
- CoglScanout *scanout);
-
-CLUTTER_EXPORT
-gboolean clutter_actor_has_damage (ClutterActor *actor);
-
-CLUTTER_EXPORT
-gboolean clutter_actor_has_transitions (ClutterActor *actor);
-
-CLUTTER_EXPORT
-ClutterFrameClock * clutter_actor_pick_frame_clock (ClutterActor *self,
- ClutterActor **out_actor);
-CLUTTER_EXPORT
-gboolean clutter_seat_handle_event_post (ClutterSeat *seat,
- const ClutterEvent *event);
-
-CLUTTER_EXPORT
-void clutter_stage_update_device (ClutterStage *stage,
- ClutterInputDevice *device,
- ClutterEventSequence *sequence,
- graphene_point_t point,
- uint32_t time,
- ClutterActor *new_actor,
- gboolean emit_crossing);
-
-CLUTTER_EXPORT
-void clutter_stage_get_device_coords (ClutterStage *stage,
- ClutterInputDevice *device,
- ClutterEventSequence *sequence,
- graphene_point_t *coords);
-CLUTTER_EXPORT
-void clutter_stage_repick_device (ClutterStage *stage,
- ClutterInputDevice *device);
-
-CLUTTER_EXPORT
-void clutter_get_debug_flags (ClutterDebugFlag *debug_flags,
- ClutterDrawDebugFlag *draw_flags,
- ClutterPickDebugFlag *pick_flags);
-
-#undef __CLUTTER_H_INSIDE__
-
-#endif /* __CLUTTER_MUTTER_H__ */
diff --git a/clutter/clutter/clutter-offscreen-effect-private.h b/clutter/clutter/clutter-offscreen-effect-private.h
deleted file mode 100644
index a5249dad3..000000000
--- a/clutter/clutter/clutter-offscreen-effect-private.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef __CLUTTER_OFFSCREEN_EFFECT_PRIVATE_H__
-#define __CLUTTER_OFFSCREEN_EFFECT_PRIVATE_H__
-
-#include <clutter/clutter-offscreen-effect.h>
-
-G_BEGIN_DECLS
-
-G_END_DECLS
-
-#endif /* __CLUTTER_OFFSCREEN_EFFECT_PRIVATE_H__ */
diff --git a/clutter/clutter/clutter-offscreen-effect.c b/clutter/clutter/clutter-offscreen-effect.c
deleted file mode 100644
index 3e72d89fd..000000000
--- a/clutter/clutter/clutter-offscreen-effect.c
+++ /dev/null
@@ -1,749 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Authors:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- * Robert Bragg <robert@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-offscreen-effect
- * @short_description: Base class for effects using offscreen buffers
- * @see_also: #ClutterBlurEffect, #ClutterEffect
- *
- * #ClutterOffscreenEffect is an abstract class that can be used by
- * #ClutterEffect sub-classes requiring access to an offscreen buffer.
- *
- * Some effects, like the fragment shader based effects, can only use GL
- * textures, and in order to apply those effects to any kind of actor they
- * require that all drawing operations are applied to an offscreen framebuffer
- * that gets redirected to a texture.
- *
- * #ClutterOffscreenEffect provides all the heavy-lifting for creating the
- * offscreen framebuffer, the redirection and the final paint of the texture on
- * the desired stage.
- *
- * #ClutterOffscreenEffect is available since Clutter 1.4
- *
- * ## Implementing a ClutterOffscreenEffect
- *
- * Creating a sub-class of #ClutterOffscreenEffect requires, in case
- * of overriding the #ClutterEffect virtual functions, to chain up to the
- * #ClutterOffscreenEffect's implementation.
- *
- * On top of the #ClutterEffect's virtual functions,
- * #ClutterOffscreenEffect also provides a #ClutterOffscreenEffectClass.paint_target()
- * function, which encapsulates the effective painting of the texture that
- * contains the result of the offscreen redirection.
- *
- * The size of the target material is defined to be as big as the
- * transformed size of the #ClutterActor using the offscreen effect.
- * Sub-classes of #ClutterOffscreenEffect can change the texture creation
- * code to provide bigger textures by overriding the
- * #ClutterOffscreenEffectClass.create_texture() virtual function; no chain up
- * to the #ClutterOffscreenEffect implementation is required in this
- * case.
- *
- * ## Paint nodes
- *
- * #ClutterOffscreenEffect generates the following paint node tree:
- *
- * |[<!-- language="plain" -->
- * Effect
- * ├─────────â”
- * Layer Pipeline
- * │
- * Actor
- * ]|
- *
- * When the actor contents are cached, the generated paint node tree
- * looks like this:
- *
- * |[<!-- language="plain" -->
- * Effect
- * │
- * Pipeline
- * ]|
- *
- * In both cases, the "Pipeline" node is created with the return value
- * of #ClutterOffscreenEffectClass.create_pipeline().
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-offscreen-effect.h"
-
-#include <math.h>
-
-#include "cogl/cogl.h"
-
-#include "clutter-actor-private.h"
-#include "clutter-debug.h"
-#include "clutter-private.h"
-#include "clutter-stage-private.h"
-#include "clutter-paint-context-private.h"
-#include "clutter-paint-node-private.h"
-#include "clutter-paint-nodes.h"
-#include "clutter-paint-volume-private.h"
-#include "clutter-actor-box-private.h"
-
-struct _ClutterOffscreenEffectPrivate
-{
- CoglOffscreen *offscreen;
- CoglPipeline *pipeline;
- CoglHandle texture;
-
- ClutterActor *actor;
- ClutterActor *stage;
-
- int fbo_offset_x;
- int fbo_offset_y;
-
- /* This is the calculated size of the fbo before being passed
- through create_texture(). This needs to be tracked separately so
- that we can detect when a different size is calculated and
- regenerate the fbo */
- int target_width;
- int target_height;
-
- gulong purge_handler_id;
-};
-
-G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterOffscreenEffect,
- clutter_offscreen_effect,
- CLUTTER_TYPE_EFFECT)
-
-static void
-clutter_offscreen_effect_set_actor (ClutterActorMeta *meta,
- ClutterActor *actor)
-{
- ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (meta);
- ClutterOffscreenEffectPrivate *priv = self->priv;
- ClutterActorMetaClass *meta_class;
-
- meta_class = CLUTTER_ACTOR_META_CLASS (clutter_offscreen_effect_parent_class);
- meta_class->set_actor (meta, actor);
-
- /* clear out the previous state */
- g_clear_object (&priv->offscreen);
-
- /* we keep a back pointer here, to avoid going through the ActorMeta */
- priv->actor = clutter_actor_meta_get_actor (meta);
-}
-
-static CoglHandle
-clutter_offscreen_effect_real_create_texture (ClutterOffscreenEffect *effect,
- gfloat width,
- gfloat height)
-{
- return cogl_texture_new_with_size (MAX (width, 1), MAX (height, 1),
- COGL_TEXTURE_NO_SLICING,
- COGL_PIXEL_FORMAT_RGBA_8888_PRE);
-}
-
-static void
-ensure_pipeline_filter_for_scale (ClutterOffscreenEffect *self,
- float resource_scale)
-{
- CoglPipelineFilter filter;
-
- if (!self->priv->pipeline)
- return;
-
- /* If no fractional scaling is set, we're always going to render the texture
- at a 1:1 texel:pixel ratio so, in such case we can use 'nearest' filtering
- to decrease the effects of rounding errors in the geometry calculation;
- if instead we we're using a global fractional scaling we need to make sure
- that we're using the default linear effect, not to create artifacts when
- scaling down the texture */
- if (fmodf (resource_scale, 1.0f) == 0)
- filter = COGL_PIPELINE_FILTER_NEAREST;
- else
- filter = COGL_PIPELINE_FILTER_LINEAR;
-
- cogl_pipeline_set_layer_filters (self->priv->pipeline, 0 /* layer_index */,
- filter, filter);
-}
-
-static CoglPipeline *
-clutter_offscreen_effect_real_create_pipeline (ClutterOffscreenEffect *effect,
- CoglTexture *texture)
-{
- ClutterOffscreenEffectPrivate *priv = effect->priv;
- CoglContext *ctx =
- clutter_backend_get_cogl_context (clutter_get_default_backend ());
- CoglPipeline *pipeline;
- float resource_scale;
-
- resource_scale = clutter_actor_get_real_resource_scale (priv->actor);
-
- pipeline = cogl_pipeline_new (ctx);
- ensure_pipeline_filter_for_scale (effect, resource_scale);
- cogl_pipeline_set_layer_texture (pipeline, 0, texture);
-
- return pipeline;
-}
-
-static void
-video_memory_purged (ClutterOffscreenEffect *self)
-{
- g_clear_object (&self->priv->offscreen);
-}
-
-static gboolean
-update_fbo (ClutterEffect *effect,
- int target_width,
- int target_height,
- float resource_scale)
-{
- ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
- ClutterOffscreenEffectClass *offscreen_class =
- CLUTTER_OFFSCREEN_EFFECT_GET_CLASS (self);
- ClutterOffscreenEffectPrivate *priv = self->priv;
- ClutterActor *stage_actor;
- CoglOffscreen *offscreen;
- g_autoptr (GError) error = NULL;
-
- stage_actor = clutter_actor_get_stage (priv->actor);
- if (stage_actor != priv->stage)
- {
- g_clear_signal_handler (&priv->purge_handler_id, priv->stage);
-
- priv->stage = stage_actor;
-
- if (priv->stage)
- {
- priv->purge_handler_id =
- g_signal_connect_object (priv->stage,
- "gl-video-memory-purged",
- G_CALLBACK (video_memory_purged),
- self,
- G_CONNECT_SWAPPED);
- }
- }
-
- if (priv->stage == NULL)
- {
- CLUTTER_NOTE (MISC, "The actor '%s' is not part of a stage",
- clutter_actor_get_name (priv->actor) == NULL
- ? G_OBJECT_TYPE_NAME (priv->actor)
- : clutter_actor_get_name (priv->actor));
- return FALSE;
- }
-
- if (priv->target_width == target_width &&
- priv->target_height == target_height &&
- priv->offscreen != NULL)
- {
- ensure_pipeline_filter_for_scale (self, resource_scale);
- return TRUE;
- }
-
- g_clear_pointer (&priv->texture, cogl_object_unref);
- g_clear_object (&priv->offscreen);
-
- priv->texture =
- clutter_offscreen_effect_create_texture (self, target_width, target_height);
- if (priv->texture == NULL)
- return FALSE;
-
- priv->target_width = target_width;
- priv->target_height = target_height;
-
- offscreen = cogl_offscreen_new_with_texture (priv->texture);
- if (!cogl_framebuffer_allocate (COGL_FRAMEBUFFER (offscreen), &error))
- {
- g_warning ("Failed to create offscreen effect framebuffer: %s",
- error->message);
-
- g_object_unref (offscreen);
- cogl_clear_object (&priv->pipeline);
-
- priv->target_width = 0;
- priv->target_height = 0;
-
- return FALSE;
- }
-
- priv->offscreen = offscreen;
-
- cogl_clear_object (&priv->pipeline);
- priv->pipeline = offscreen_class->create_pipeline (self, priv->texture);
-
- return TRUE;
-}
-
-static gboolean
-clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
- ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
- ClutterOffscreenEffectPrivate *priv = self->priv;
- CoglFramebuffer *offscreen;
- ClutterActorBox raw_box, box;
- ClutterActor *stage;
- graphene_matrix_t projection, modelview, transform;
- const ClutterPaintVolume *volume;
- gfloat stage_width, stage_height;
- gfloat target_width = -1, target_height = -1;
- float resource_scale;
- float ceiled_resource_scale;
-
- if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (effect)))
- goto disable_effect;
-
- if (priv->actor == NULL)
- goto disable_effect;
-
- stage = _clutter_actor_get_stage_internal (priv->actor);
- clutter_actor_get_size (stage, &stage_width, &stage_height);
-
- resource_scale = clutter_actor_get_real_resource_scale (priv->actor);
-
- ceiled_resource_scale = ceilf (resource_scale);
- stage_width *= ceiled_resource_scale;
- stage_height *= ceiled_resource_scale;
-
- /* Get the minimal bounding box for what we want to paint, relative to the
- * parent of priv->actor. Note that we may actually be painting a clone of
- * priv->actor so we need to be careful to avoid querying the transformation
- * of priv->actor (like clutter_actor_get_paint_box would). Just stay in
- * local coordinates for now...
- */
- volume = clutter_actor_get_paint_volume (priv->actor);
- if (volume)
- {
- ClutterPaintVolume mutable_volume;
-
- _clutter_paint_volume_copy_static (volume, &mutable_volume);
- _clutter_paint_volume_get_bounding_box (&mutable_volume, &raw_box);
- clutter_paint_volume_free (&mutable_volume);
- }
- else
- {
- clutter_actor_get_allocation_box (priv->actor, &raw_box);
- }
-
- box = raw_box;
- _clutter_actor_box_enlarge_for_effects (&box);
-
- priv->fbo_offset_x = box.x1 - raw_box.x1;
- priv->fbo_offset_y = box.y1 - raw_box.y1;
-
- clutter_actor_box_scale (&box, ceiled_resource_scale);
- clutter_actor_box_get_size (&box, &target_width, &target_height);
-
- target_width = ceilf (target_width);
- target_height = ceilf (target_height);
-
- /* First assert that the framebuffer is the right size... */
- if (!update_fbo (effect, target_width, target_height, resource_scale))
- goto disable_effect;
-
- offscreen = COGL_FRAMEBUFFER (priv->offscreen);
-
- /* We don't want the FBO contents to be transformed. That could waste memory
- * (e.g. during zoom), or result in something that's not rectangular (clipped
- * incorrectly). So drop the modelview matrix of the current paint chain.
- * This is fine since paint_texture runs with the same modelview matrix,
- * so it will come out correctly whenever that is used to put the FBO
- * contents on screen...
- */
- clutter_actor_get_transform (priv->stage, &modelview);
- graphene_matrix_init_translate (&transform,
- &GRAPHENE_POINT3D_INIT (-priv->fbo_offset_x,
- -priv->fbo_offset_y,
- 0.0));
- graphene_matrix_scale (&transform,
- stage_width / target_width,
- stage_height / target_height,
- 1.0);
- graphene_matrix_multiply (&transform, &modelview, &modelview);
- cogl_framebuffer_set_modelview_matrix (offscreen, &modelview);
-
- /* Set up the viewport so that it has the minimal size required to render any
- * pixel in the FBO without clipping.
- */
- cogl_framebuffer_set_viewport (offscreen,
- 0,
- 0,
- target_width,
- target_height);
-
- /* Copy the stage's projection matrix across to the offscreen */
- _clutter_stage_get_projection_matrix (CLUTTER_STAGE (priv->stage),
- &projection);
-
- cogl_framebuffer_set_projection_matrix (offscreen, &projection);
-
- return TRUE;
-
-disable_effect:
- g_clear_object (&priv->offscreen);
- return FALSE;
-}
-
-static void
-clutter_offscreen_effect_real_paint_target (ClutterOffscreenEffect *effect,
- ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- ClutterOffscreenEffectPrivate *priv = effect->priv;
- ClutterPaintNode *pipeline_node;
- guint8 paint_opacity;
-
- paint_opacity = clutter_actor_get_paint_opacity (priv->actor);
-
- cogl_pipeline_set_color4ub (priv->pipeline,
- paint_opacity,
- paint_opacity,
- paint_opacity,
- paint_opacity);
-
- pipeline_node = clutter_pipeline_node_new (priv->pipeline);
- clutter_paint_node_set_static_name (pipeline_node,
- "ClutterOffscreenEffect (pipeline)");
- clutter_paint_node_add_child (node, pipeline_node);
-
- /* At this point we are in stage coordinates translated so if
- * we draw our texture using a textured quad the size of the paint
- * box then we will overlay where the actor would have drawn if it
- * hadn't been redirected offscreen.
- */
- clutter_paint_node_add_rectangle (pipeline_node,
- &(ClutterActorBox) {
- 0.f, 0.f,
- cogl_texture_get_width (priv->texture),
- cogl_texture_get_height (priv->texture),
- });
-
- clutter_paint_node_unref (pipeline_node);
-}
-
-static void
-clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect,
- ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- ClutterOffscreenEffectPrivate *priv = effect->priv;
- graphene_matrix_t transform;
- float unscale;
-
- unscale = 1.0 / clutter_actor_get_resource_scale (priv->actor);
- graphene_matrix_init_scale (&transform, unscale, unscale, 1.0);
- graphene_matrix_translate (&transform,
- &GRAPHENE_POINT3D_INIT (priv->fbo_offset_x,
- priv->fbo_offset_y,
- 0.0));
-
- if (!graphene_matrix_is_identity (&transform))
- {
- ClutterPaintNode *transform_node;
-
- transform_node = clutter_transform_node_new (&transform);
- clutter_paint_node_set_static_name (transform_node,
- "ClutterOffscreenEffect (transform)");
- clutter_paint_node_add_child (node, transform_node);
- clutter_paint_node_unref (transform_node);
-
- node = transform_node;
- }
-
- /* paint the target material; this is virtualized for
- * sub-classes that require special hand-holding
- */
- clutter_offscreen_effect_paint_target (effect, node, paint_context);
-}
-
-static void
-clutter_offscreen_effect_post_paint (ClutterEffect *effect,
- ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
- ClutterOffscreenEffectPrivate *priv = self->priv;
-
- g_warn_if_fail (priv->offscreen);
- g_warn_if_fail (priv->pipeline);
- g_warn_if_fail (priv->actor);
-
- clutter_offscreen_effect_paint_texture (self, node, paint_context);
-}
-
-static void
-add_actor_node (ClutterOffscreenEffect *offscreen_effect,
- ClutterPaintNode *node,
- int paint_opacity)
-{
- ClutterOffscreenEffectPrivate *priv = offscreen_effect->priv;
- ClutterPaintNode *actor_node;
-
- actor_node = clutter_actor_node_new (priv->actor, paint_opacity);
- clutter_paint_node_add_child (node, actor_node);
- clutter_paint_node_unref (actor_node);
-}
-
-static void
-clutter_offscreen_effect_paint_node (ClutterEffect *effect,
- ClutterPaintNode *node,
- ClutterPaintContext *paint_context,
- ClutterEffectPaintFlags flags)
-{
- ClutterOffscreenEffect *offscreen_effect = CLUTTER_OFFSCREEN_EFFECT (effect);
- ClutterOffscreenEffectPrivate *priv = offscreen_effect->priv;
- ClutterPaintNode *layer_node;
- CoglFramebuffer *fb;
-
- fb = COGL_FRAMEBUFFER (priv->offscreen);
- layer_node = clutter_layer_node_new_to_framebuffer (fb, priv->pipeline);
- clutter_paint_node_set_static_name (layer_node,
- "ClutterOffscreenEffect (actor offscreen)");
- clutter_paint_node_add_child (node, layer_node);
- clutter_paint_node_unref (layer_node);
-
- add_actor_node (offscreen_effect, layer_node, 255);
-}
-
-static void
-clutter_offscreen_effect_paint (ClutterEffect *effect,
- ClutterPaintNode *node,
- ClutterPaintContext *paint_context,
- ClutterEffectPaintFlags flags)
-{
- ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
- ClutterOffscreenEffectPrivate *priv = self->priv;
- ClutterEffectClass *parent_class =
- CLUTTER_EFFECT_CLASS (clutter_offscreen_effect_parent_class);
-
- if (flags & CLUTTER_EFFECT_PAINT_BYPASS_EFFECT)
- {
- add_actor_node (self, node, -1);
- g_clear_object (&priv->offscreen);
- return;
- }
-
- /* If we've already got a cached image and the actor hasn't been redrawn
- * then we can just use the cached image in the FBO.
- */
- if (priv->offscreen == NULL || (flags & CLUTTER_EFFECT_PAINT_ACTOR_DIRTY))
- parent_class->paint (effect, node, paint_context, flags);
- else
- clutter_offscreen_effect_paint_texture (self, node, paint_context);
-}
-
-static void
-clutter_offscreen_effect_set_enabled (ClutterActorMeta *meta,
- gboolean is_enabled)
-{
- ClutterActorMetaClass *parent_class =
- CLUTTER_ACTOR_META_CLASS (clutter_offscreen_effect_parent_class);
- ClutterOffscreenEffect *offscreen_effect = CLUTTER_OFFSCREEN_EFFECT (meta);
- ClutterOffscreenEffectPrivate *priv = offscreen_effect->priv;
-
- g_clear_object (&priv->offscreen);
-
- parent_class->set_enabled (meta, is_enabled);
-}
-
-static void
-clutter_offscreen_effect_finalize (GObject *gobject)
-{
- ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (gobject);
- ClutterOffscreenEffectPrivate *priv = self->priv;
-
- g_clear_object (&priv->offscreen);
- g_clear_pointer (&priv->texture, cogl_object_unref);
- g_clear_pointer (&priv->pipeline, cogl_object_unref);
-
- G_OBJECT_CLASS (clutter_offscreen_effect_parent_class)->finalize (gobject);
-}
-
-static void
-clutter_offscreen_effect_class_init (ClutterOffscreenEffectClass *klass)
-{
- ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
- ClutterEffectClass *effect_class = CLUTTER_EFFECT_CLASS (klass);
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- klass->create_texture = clutter_offscreen_effect_real_create_texture;
- klass->create_pipeline = clutter_offscreen_effect_real_create_pipeline;
- klass->paint_target = clutter_offscreen_effect_real_paint_target;
-
- meta_class->set_actor = clutter_offscreen_effect_set_actor;
- meta_class->set_enabled = clutter_offscreen_effect_set_enabled;
-
- effect_class->pre_paint = clutter_offscreen_effect_pre_paint;
- effect_class->post_paint = clutter_offscreen_effect_post_paint;
- effect_class->paint = clutter_offscreen_effect_paint;
- effect_class->paint_node = clutter_offscreen_effect_paint_node;
-
- gobject_class->finalize = clutter_offscreen_effect_finalize;
-}
-
-static void
-clutter_offscreen_effect_init (ClutterOffscreenEffect *self)
-{
- self->priv = clutter_offscreen_effect_get_instance_private (self);
-}
-
-/**
- * clutter_offscreen_effect_get_texture:
- * @effect: a #ClutterOffscreenEffect
- *
- * Retrieves the texture used as a render target for the offscreen
- * buffer created by @effect
- *
- * You should only use the returned texture when painting. The texture
- * may change after ClutterEffect::pre_paint is called so the effect
- * implementation should update any references to the texture after
- * chaining-up to the parent's pre_paint implementation. This can be
- * 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
- * returned texture is owned by Clutter and it should not be
- * modified or freed
- *
- * Since: 1.10
- */
-CoglHandle
-clutter_offscreen_effect_get_texture (ClutterOffscreenEffect *effect)
-{
- g_return_val_if_fail (CLUTTER_IS_OFFSCREEN_EFFECT (effect),
- NULL);
-
- return effect->priv->texture;
-}
-
-/**
- * clutter_offscreen_effect_get_pipeline:
- * @effect: a #ClutterOffscreenEffect
- *
- * Retrieves the pipeline used as a render target for the offscreen
- * buffer created by @effect
- *
- * You should only use the returned #CoglPipeline when painting. The
- * returned pipeline might change between different frames.
- *
- * Return value: (transfer none)(nullable): a #CoglPipeline. The
- * pipeline is owned by Clutter and it should not be modified
- * or freed
- *
- * Since: 1.4
- */
-CoglPipeline *
-clutter_offscreen_effect_get_pipeline (ClutterOffscreenEffect *effect)
-{
- g_return_val_if_fail (CLUTTER_IS_OFFSCREEN_EFFECT (effect),
- NULL);
-
- return effect->priv->pipeline;
-}
-
-/**
- * clutter_offscreen_effect_paint_target:
- * @effect: a #ClutterOffscreenEffect
- * @node: a #ClutterPaintNode
- * @paint_context: a #ClutterPaintContext
- *
- * Calls the paint_target() virtual function of the @effect
- *
- * Since: 1.4
- */
-void
-clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect,
- ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- g_return_if_fail (CLUTTER_IS_OFFSCREEN_EFFECT (effect));
-
- CLUTTER_OFFSCREEN_EFFECT_GET_CLASS (effect)->paint_target (effect,
- node,
- paint_context);
-}
-
-/**
- * clutter_offscreen_effect_create_texture:
- * @effect: a #ClutterOffscreenEffect
- * @width: the minimum width of the target texture
- * @height: the minimum height of the target texture
- *
- * 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
- * count increased.
- *
- * Since: 1.4
- */
-CoglHandle
-clutter_offscreen_effect_create_texture (ClutterOffscreenEffect *effect,
- gfloat width,
- gfloat height)
-{
- g_return_val_if_fail (CLUTTER_IS_OFFSCREEN_EFFECT (effect),
- NULL);
-
- return CLUTTER_OFFSCREEN_EFFECT_GET_CLASS (effect)->create_texture (effect,
- width,
- height);
-}
-
-/**
- * clutter_offscreen_effect_get_target_size:
- * @effect: a #ClutterOffscreenEffect
- * @width: (out): return location for the target width, or %NULL
- * @height: (out): return location for the target height, or %NULL
- *
- * Retrieves the size of the offscreen buffer used by @effect to
- * paint the actor to which it has been applied.
- *
- * This function should only be called by #ClutterOffscreenEffect
- * implementations, from within the #ClutterOffscreenEffectClass.paint_target()
- * virtual function.
- *
- * Return value: %TRUE if the offscreen buffer has a valid size,
- * and %FALSE otherwise
- *
- * Since: 1.8
- */
-gboolean
-clutter_offscreen_effect_get_target_size (ClutterOffscreenEffect *effect,
- gfloat *width,
- gfloat *height)
-{
- ClutterOffscreenEffectPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_OFFSCREEN_EFFECT (effect), FALSE);
-
- priv = effect->priv;
-
- if (priv->texture == NULL)
- return FALSE;
-
- if (width)
- *width = cogl_texture_get_width (priv->texture);
-
- if (height)
- *height = cogl_texture_get_height (priv->texture);
-
- return TRUE;
-}
diff --git a/clutter/clutter/clutter-offscreen-effect.h b/clutter/clutter/clutter-offscreen-effect.h
deleted file mode 100644
index b06bc34ed..000000000
--- a/clutter/clutter/clutter-offscreen-effect.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_OFFSCREEN_EFFECT_H__
-#define __CLUTTER_OFFSCREEN_EFFECT_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <cogl/cogl.h>
-#include <clutter/clutter-effect.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_OFFSCREEN_EFFECT (clutter_offscreen_effect_get_type ())
-#define CLUTTER_OFFSCREEN_EFFECT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CLUTTER_TYPE_OFFSCREEN_EFFECT, ClutterOffscreenEffect))
-#define CLUTTER_IS_OFFSCREEN_EFFECT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CLUTTER_TYPE_OFFSCREEN_EFFECT))
-#define CLUTTER_OFFSCREEN_EFFECT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), CLUTTER_TYPE_OFFSCREEN_EFFECT, ClutterOffscreenEffectClass))
-#define CLUTTER_IS_OFFSCREEN_EFFECT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CLUTTER_TYPE_OFFSCREEN_EFFECT))
-#define CLUTTER_OFFSCREEN_EFFECT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CLUTTER_TYPE_OFFSCREEN_EFFECT, ClutterOffscreenEffectClass))
-
-typedef struct _ClutterOffscreenEffect ClutterOffscreenEffect;
-typedef struct _ClutterOffscreenEffectPrivate ClutterOffscreenEffectPrivate;
-typedef struct _ClutterOffscreenEffectClass ClutterOffscreenEffectClass;
-
-/**
- * ClutterOffscreenEffect:
- *
- * The #ClutterOffscreenEffect structure contains only private data
- * and should be accessed using the provided API
- *
- * Since: 1.4
- */
-struct _ClutterOffscreenEffect
-{
- /*< private >*/
- ClutterEffect parent_instance;
-
- ClutterOffscreenEffectPrivate *priv;
-};
-
-/**
- * ClutterOffscreenEffectClass:
- * @create_texture: virtual function
- * @paint_target: virtual function
- *
- * The #ClutterOffscreenEffectClass structure contains only private data
- *
- * Since: 1.4
- */
-struct _ClutterOffscreenEffectClass
-{
- /*< private >*/
- ClutterEffectClass parent_class;
-
- /*< public >*/
- CoglHandle (* create_texture) (ClutterOffscreenEffect *effect,
- gfloat width,
- gfloat height);
- CoglPipeline* (* create_pipeline) (ClutterOffscreenEffect *effect,
- CoglTexture *texture);
- void (* paint_target) (ClutterOffscreenEffect *effect,
- ClutterPaintNode *node,
- ClutterPaintContext *paint_context);
-
- /*< private >*/
- void (* _clutter_offscreen1) (void);
- void (* _clutter_offscreen2) (void);
- void (* _clutter_offscreen3) (void);
- void (* _clutter_offscreen4) (void);
- void (* _clutter_offscreen5) (void);
- void (* _clutter_offscreen6) (void);
- void (* _clutter_offscreen7) (void);
-};
-
-CLUTTER_EXPORT
-GType clutter_offscreen_effect_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-CoglPipeline * clutter_offscreen_effect_get_pipeline (ClutterOffscreenEffect *effect);
-
-CLUTTER_EXPORT
-CoglHandle clutter_offscreen_effect_get_texture (ClutterOffscreenEffect *effect);
-
-CLUTTER_EXPORT
-void clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect,
- ClutterPaintNode *node,
- ClutterPaintContext *paint_context);
-CLUTTER_EXPORT
-CoglHandle clutter_offscreen_effect_create_texture (ClutterOffscreenEffect *effect,
- gfloat width,
- gfloat height);
-
-CLUTTER_EXPORT
-gboolean clutter_offscreen_effect_get_target_size (ClutterOffscreenEffect *effect,
- gfloat *width,
- gfloat *height);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_OFFSCREEN_EFFECT_H__ */
diff --git a/clutter/clutter/clutter-page-turn-effect.c b/clutter/clutter/clutter-page-turn-effect.c
deleted file mode 100644
index 2c0bc0ac6..000000000
--- a/clutter/clutter/clutter-page-turn-effect.c
+++ /dev/null
@@ -1,422 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- *
- * Based on MxDeformPageTurn, written by:
- * Chris Lord <chris@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-page-turn-effect
- * @Title: ClutterPageTurnEffect
- * @Short_Description: A page turning effect
- *
- * A simple page turning effect
- *
- * #ClutterPageTurnEffect is available since Clutter 1.4
- */
-
-#include "clutter-build-config.h"
-
-#include <math.h>
-
-#include "clutter-page-turn-effect.h"
-
-#include "clutter-debug.h"
-#include "clutter-private.h"
-
-#define CLUTTER_PAGE_TURN_EFFECT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), CLUTTER_TYPE_PAGE_TURN_EFFECT, ClutterPageTurnEffectClass))
-#define CLUTTER_IS_PAGE_TURN_EFFECT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CLUTTER_TYPE_PAGE_TURN_EFFECT))
-#define CLUTTER_PAGE_TURN_EFFECT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CLUTTER_TYPE_PAGE_TURN_EFFECT, ClutterPageTurnEffectClass))
-
-struct _ClutterPageTurnEffect
-{
- ClutterDeformEffect parent_instance;
-
- gdouble period;
- gdouble angle;
-
- gfloat radius;
-};
-
-struct _ClutterPageTurnEffectClass
-{
- ClutterDeformEffectClass parent_class;
-};
-
-enum
-{
- PROP_0,
-
- PROP_PERIOD,
- PROP_ANGLE,
- PROP_RADIUS,
-
- PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST];
-
-G_DEFINE_TYPE (ClutterPageTurnEffect,
- clutter_page_turn_effect,
- CLUTTER_TYPE_DEFORM_EFFECT);
-
-static void
-clutter_page_turn_effect_deform_vertex (ClutterDeformEffect *effect,
- gfloat width,
- gfloat height,
- CoglTextureVertex *vertex)
-{
- ClutterPageTurnEffect *self = CLUTTER_PAGE_TURN_EFFECT (effect);
- gfloat cx, cy, rx, ry, radians, turn_angle;
- guint shade;
-
- if (self->period == 0.0)
- return;
-
- radians = self->angle / (180.0f / G_PI);
-
- /* Rotate the point around the centre of the page-curl ray to align it with
- * the y-axis.
- */
- cx = (1.f - self->period) * width;
- cy = (1.f - self->period) * height;
-
- rx = ((vertex->x - cx) * cos (- radians))
- - ((vertex->y - cy) * sin (- radians))
- - self->radius;
- ry = ((vertex->x - cx) * sin (- radians))
- + ((vertex->y - cy) * cos (- radians));
-
- turn_angle = 0.f;
- if (rx > self->radius * -2.0f)
- {
- /* Calculate the curl angle as a function from the distance of the curl
- * ray (i.e. the page crease)
- */
- turn_angle = (rx / self->radius * G_PI_2) - G_PI_2;
- shade = (sin (turn_angle) * 96.0f) + 159.0f;
-
- /* Add a gradient that makes it look like lighting and hides the switch
- * between textures.
- */
- cogl_color_init_from_4ub (&vertex->color, shade, shade, shade, 0xff);
- }
-
- if (rx > 0)
- {
- /* Make the curl radius smaller as more circles are formed (stops
- * z-fighting and looks cool). Note that 10 is a semi-arbitrary
- * number here - divide it by two and it's the amount of space
- * between curled layers of the texture, in pixels.
- */
- gfloat small_radius;
-
- small_radius = self->radius
- - MIN (self->radius, (turn_angle * 10) / G_PI);
-
- /* Calculate a point on a cylinder (maybe make this a cone at some
- * point) and rotate it by the specified angle.
- */
- rx = (small_radius * cos (turn_angle)) + self->radius;
-
- vertex->x = (rx * cos (radians)) - (ry * sin (radians)) + cx;
- vertex->y = (rx * sin (radians)) + (ry * cos (radians)) + cy;
- vertex->z = (small_radius * sin (turn_angle)) + self->radius;
- }
-}
-
-static void
-clutter_page_turn_effect_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterPageTurnEffect *effect = CLUTTER_PAGE_TURN_EFFECT (gobject);
-
- switch (prop_id)
- {
- case PROP_PERIOD:
- clutter_page_turn_effect_set_period (effect, g_value_get_double (value));
- break;
-
- case PROP_ANGLE:
- clutter_page_turn_effect_set_angle (effect, g_value_get_double (value));
- break;
-
- case PROP_RADIUS:
- clutter_page_turn_effect_set_radius (effect, g_value_get_float (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_page_turn_effect_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterPageTurnEffect *effect = CLUTTER_PAGE_TURN_EFFECT (gobject);
-
- switch (prop_id)
- {
- case PROP_PERIOD:
- g_value_set_double (value, effect->period);
- break;
-
- case PROP_ANGLE:
- g_value_set_double (value, effect->angle);
- break;
-
- case PROP_RADIUS:
- g_value_set_float (value, effect->radius);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_page_turn_effect_class_init (ClutterPageTurnEffectClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- ClutterDeformEffectClass *deform_class = CLUTTER_DEFORM_EFFECT_CLASS (klass);
- GParamSpec *pspec;
-
- gobject_class->set_property = clutter_page_turn_effect_set_property;
- gobject_class->get_property = clutter_page_turn_effect_get_property;
-
- /**
- * ClutterPageTurnEffect:period:
- *
- * The period of the page turn, between 0.0 (no curling) and
- * 1.0 (fully curled)
- *
- * Since: 1.4
- */
- pspec = g_param_spec_double ("period",
- "Period",
- "The period of the page turn",
- 0.0, 1.0,
- 0.0,
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_PERIOD] = pspec;
- g_object_class_install_property (gobject_class, PROP_PERIOD, pspec);
-
- /**
- * ClutterPageTurnEffect:angle:
- *
- * The angle of the page rotation, in degrees, between 0.0 and 360.0
- *
- * Since: 1.4
- */
- pspec = g_param_spec_double ("angle",
- "Angle",
- "The angle of the page rotation, in degrees",
- 0.0, 360.0,
- 0.0,
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_ANGLE] = pspec;
- g_object_class_install_property (gobject_class, PROP_ANGLE, pspec);
-
- /**
- * ClutterPageTurnEffect:radius:
- *
- * The radius of the page curl, in pixels
- *
- * Since: 1.4
- */
- pspec = g_param_spec_float ("radius",
- "Radius",
- "The radius of the page curl",
- -G_MAXFLOAT, G_MAXFLOAT,
- 24.0,
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_RADIUS] = pspec;
- g_object_class_install_property (gobject_class, PROP_RADIUS, pspec);
-
- deform_class->deform_vertex = clutter_page_turn_effect_deform_vertex;
-}
-
-static void
-clutter_page_turn_effect_init (ClutterPageTurnEffect *self)
-{
- self->period = 0.0;
- self->angle = 0.0;
- self->radius = 24.0f;
-}
-
-/**
- * clutter_page_turn_effect_new:
- * @period: the period of the page curl, between 0.0 and 1.0
- * @angle: the angle of the page curl, between 0.0 and 360.0
- * @radius: the radius of the page curl, in pixels
- *
- * Creates a new #ClutterPageTurnEffect instance with the given parameters
- *
- * Return value: the newly created #ClutterPageTurnEffect
- *
- * Since: 1.4
- */
-ClutterEffect *
-clutter_page_turn_effect_new (gdouble period,
- gdouble angle,
- gfloat radius)
-{
- g_return_val_if_fail (period >= 0.0 && period <= 1.0, NULL);
- g_return_val_if_fail (angle >= 0.0 && angle <= 360.0, NULL);
-
- return g_object_new (CLUTTER_TYPE_PAGE_TURN_EFFECT,
- "period", period,
- "angle", angle,
- "radius", radius,
- NULL);
-}
-
-/**
- * clutter_page_turn_effect_set_period:
- * @effect: a #ClutterPageTurnEffect
- * @period: the period of the page curl, between 0.0 and 1.0
- *
- * Sets the period of the page curling, between 0.0 (no curling)
- * and 1.0 (fully curled)
- *
- * Since: 1.4
- */
-void
-clutter_page_turn_effect_set_period (ClutterPageTurnEffect *effect,
- gdouble period)
-{
- g_return_if_fail (CLUTTER_IS_PAGE_TURN_EFFECT (effect));
- g_return_if_fail (period >= 0.0 && period <= 1.0);
-
- effect->period = period;
-
- clutter_deform_effect_invalidate (CLUTTER_DEFORM_EFFECT (effect));
-
- g_object_notify_by_pspec (G_OBJECT (effect), obj_props[PROP_PERIOD]);
-}
-
-/**
- * clutter_page_turn_effect_get_period:
- * @effect: a #ClutterPageTurnEffect
- *
- * Retrieves the value set using clutter_page_turn_effect_get_period()
- *
- * Return value: the period of the page curling
- *
- * Since: 1.4
- */
-gdouble
-clutter_page_turn_effect_get_period (ClutterPageTurnEffect *effect)
-{
- g_return_val_if_fail (CLUTTER_IS_PAGE_TURN_EFFECT (effect), 0.0);
-
- return effect->period;
-}
-
-/**
- * clutter_page_turn_effect_set_angle:
- * @effect: #ClutterPageTurnEffect
- * @angle: the angle of the page curl, in degrees
- *
- * Sets the angle of the page curling, in degrees
- *
- * Since: 1.4
- */
-void
-clutter_page_turn_effect_set_angle (ClutterPageTurnEffect *effect,
- gdouble angle)
-{
- g_return_if_fail (CLUTTER_IS_PAGE_TURN_EFFECT (effect));
- g_return_if_fail (angle >= 0.0 && angle <= 360.0);
-
- effect->angle = angle;
-
- clutter_deform_effect_invalidate (CLUTTER_DEFORM_EFFECT (effect));
-
- g_object_notify_by_pspec (G_OBJECT (effect), obj_props[PROP_ANGLE]);
-}
-
-/**
- * clutter_page_turn_effect_get_angle:
- * @effect: a #ClutterPageTurnEffect:
- *
- * Retrieves the value set using clutter_page_turn_effect_get_angle()
- *
- * Return value: the angle of the page curling
- *
- * Since: 1.4
- */
-gdouble
-clutter_page_turn_effect_get_angle (ClutterPageTurnEffect *effect)
-{
- g_return_val_if_fail (CLUTTER_IS_PAGE_TURN_EFFECT (effect), 0.0);
-
- return effect->angle;
-}
-
-/**
- * clutter_page_turn_effect_set_radius:
- * @effect: a #ClutterPageTurnEffect:
- * @radius: the radius of the page curling, in pixels
- *
- * Sets the radius of the page curling
- *
- * Since: 1.4
- */
-void
-clutter_page_turn_effect_set_radius (ClutterPageTurnEffect *effect,
- gfloat radius)
-{
- g_return_if_fail (CLUTTER_IS_PAGE_TURN_EFFECT (effect));
-
- effect->radius = radius;
-
- clutter_deform_effect_invalidate (CLUTTER_DEFORM_EFFECT (effect));
-
- g_object_notify_by_pspec (G_OBJECT (effect), obj_props[PROP_RADIUS]);
-}
-
-/**
- * clutter_page_turn_effect_get_radius:
- * @effect: a #ClutterPageTurnEffect
- *
- * Retrieves the value set using clutter_page_turn_effect_set_radius()
- *
- * Return value: the radius of the page curling
- *
- * Since: 1.4
- */
-gfloat
-clutter_page_turn_effect_get_radius (ClutterPageTurnEffect *effect)
-{
- g_return_val_if_fail (CLUTTER_IS_PAGE_TURN_EFFECT (effect), 0.0);
-
- return effect->radius;
-}
diff --git a/clutter/clutter/clutter-page-turn-effect.h b/clutter/clutter/clutter-page-turn-effect.h
deleted file mode 100644
index dd036bac8..000000000
--- a/clutter/clutter/clutter-page-turn-effect.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- *
- * Based on MxDeformPageTurn, written by:
- * Chris Lord <chris@linux.intel.com>
- */
-
-#ifndef __CLUTTER_PAGE_TURN_EFFECT_H__
-#define __CLUTTER_PAGE_TURN_EFFECT_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-deform-effect.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_PAGE_TURN_EFFECT (clutter_page_turn_effect_get_type ())
-#define CLUTTER_PAGE_TURN_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_PAGE_TURN_EFFECT, ClutterPageTurnEffect))
-#define CLUTTER_IS_PAGE_TURN_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_PAGE_TURN_EFFECT))
-
-/**
- * ClutterPageTurnEffect:
- *
- * #ClutterPageTurnEffect is an opaque structure
- * whose members can only be accessed using the provided API
- *
- * Since: 1.4
- */
-typedef struct _ClutterPageTurnEffect ClutterPageTurnEffect;
-typedef struct _ClutterPageTurnEffectClass ClutterPageTurnEffectClass;
-
-CLUTTER_EXPORT
-GType clutter_page_turn_effect_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterEffect *clutter_page_turn_effect_new (gdouble period,
- gdouble angle,
- gfloat radius);
-
-CLUTTER_EXPORT
-void clutter_page_turn_effect_set_period (ClutterPageTurnEffect *effect,
- gdouble period);
-CLUTTER_EXPORT
-gdouble clutter_page_turn_effect_get_period (ClutterPageTurnEffect *effect);
-CLUTTER_EXPORT
-void clutter_page_turn_effect_set_angle (ClutterPageTurnEffect *effect,
- gdouble angle);
-CLUTTER_EXPORT
-gdouble clutter_page_turn_effect_get_angle (ClutterPageTurnEffect *effect);
-CLUTTER_EXPORT
-void clutter_page_turn_effect_set_radius (ClutterPageTurnEffect *effect,
- gfloat radius);
-CLUTTER_EXPORT
-gfloat clutter_page_turn_effect_get_radius (ClutterPageTurnEffect *effect);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_PAGE_TURN_EFFECT_H__ */
diff --git a/clutter/clutter/clutter-paint-context-private.h b/clutter/clutter/clutter-paint-context-private.h
deleted file mode 100644
index 25592a6fe..000000000
--- a/clutter/clutter/clutter-paint-context-private.h
+++ /dev/null
@@ -1,36 +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_PAINT_CONTEXT_PRIVATE_H
-#define CLUTTER_PAINT_CONTEXT_PRIVATE_H
-
-#include "clutter-paint-context.h"
-
-ClutterPaintContext *
-clutter_paint_context_new_for_view (ClutterStageView *view,
- const cairo_region_t *redraw_clip,
- GArray *clip_frusta,
- ClutterPaintFlag paint_flags);
-
-gboolean clutter_paint_context_is_drawing_off_stage (ClutterPaintContext *paint_context);
-
-CoglFramebuffer * clutter_paint_context_get_base_framebuffer (ClutterPaintContext *paint_context);
-
-const GArray *
-clutter_paint_context_get_clip_frusta (ClutterPaintContext *paint_context);
-
-#endif /* CLUTTER_PAINT_CONTEXT_PRIVATE_H */
diff --git a/clutter/clutter/clutter-paint-context.c b/clutter/clutter/clutter-paint-context.c
deleted file mode 100644
index b56d92aa7..000000000
--- a/clutter/clutter/clutter-paint-context.c
+++ /dev/null
@@ -1,198 +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/>.
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-paint-context-private.h"
-
-struct _ClutterPaintContext
-{
- grefcount ref_count;
-
- ClutterPaintFlag paint_flags;
-
- GList *framebuffers;
-
- ClutterStageView *view;
-
- cairo_region_t *redraw_clip;
- GArray *clip_frusta;
-};
-
-G_DEFINE_BOXED_TYPE (ClutterPaintContext, clutter_paint_context,
- clutter_paint_context_ref,
- clutter_paint_context_unref)
-
-ClutterPaintContext *
-clutter_paint_context_new_for_view (ClutterStageView *view,
- const cairo_region_t *redraw_clip,
- GArray *clip_frusta,
- ClutterPaintFlag paint_flags)
-{
- ClutterPaintContext *paint_context;
- CoglFramebuffer *framebuffer;
-
- paint_context = g_new0 (ClutterPaintContext, 1);
- g_ref_count_init (&paint_context->ref_count);
- paint_context->view = view;
- paint_context->redraw_clip = cairo_region_copy (redraw_clip);
- paint_context->clip_frusta = g_array_ref (clip_frusta);
- paint_context->paint_flags = paint_flags;
-
- framebuffer = clutter_stage_view_get_framebuffer (view);
- clutter_paint_context_push_framebuffer (paint_context, framebuffer);
-
- return paint_context;
-}
-
-/**
- * clutter_paint_context_new_for_framebuffer: (skip)
- */
-ClutterPaintContext *
-clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer,
- const cairo_region_t *redraw_clip,
- ClutterPaintFlag paint_flags)
-{
- ClutterPaintContext *paint_context;
-
- paint_context = g_new0 (ClutterPaintContext, 1);
- g_ref_count_init (&paint_context->ref_count);
- paint_context->redraw_clip = cairo_region_copy (redraw_clip);
- paint_context->paint_flags = paint_flags;
-
- clutter_paint_context_push_framebuffer (paint_context, framebuffer);
-
- return paint_context;
-}
-
-ClutterPaintContext *
-clutter_paint_context_ref (ClutterPaintContext *paint_context)
-{
- g_ref_count_inc (&paint_context->ref_count);
- return paint_context;
-}
-
-static void
-clutter_paint_context_dispose (ClutterPaintContext *paint_context)
-{
- g_list_free_full (paint_context->framebuffers, g_object_unref);
- paint_context->framebuffers = NULL;
- g_clear_pointer (&paint_context->redraw_clip, cairo_region_destroy);
- g_clear_pointer (&paint_context->clip_frusta, g_array_unref);
-}
-
-void
-clutter_paint_context_unref (ClutterPaintContext *paint_context)
-{
- if (g_ref_count_dec (&paint_context->ref_count))
- {
- clutter_paint_context_dispose (paint_context);
- g_free (paint_context);
- }
-}
-
-void
-clutter_paint_context_destroy (ClutterPaintContext *paint_context)
-{
- clutter_paint_context_dispose (paint_context);
- clutter_paint_context_unref (paint_context);
-}
-
-void
-clutter_paint_context_push_framebuffer (ClutterPaintContext *paint_context,
- CoglFramebuffer *framebuffer)
-{
- paint_context->framebuffers = g_list_prepend (paint_context->framebuffers,
- g_object_ref (framebuffer));
-}
-
-void
-clutter_paint_context_pop_framebuffer (ClutterPaintContext *paint_context)
-{
- g_return_if_fail (paint_context->framebuffers);
-
- g_object_unref (paint_context->framebuffers->data);
- paint_context->framebuffers =
- g_list_delete_link (paint_context->framebuffers,
- paint_context->framebuffers);
-}
-
-const cairo_region_t *
-clutter_paint_context_get_redraw_clip (ClutterPaintContext *paint_context)
-{
- return paint_context->redraw_clip;
-}
-
-const GArray *
-clutter_paint_context_get_clip_frusta (ClutterPaintContext *paint_context)
-{
- return paint_context->clip_frusta;
-}
-
-/**
- * clutter_paint_context_get_framebuffer:
- * @paint_context: The #ClutterPaintContext
- *
- * Returns: (transfer none): The #CoglFramebuffer used for drawing
- */
-CoglFramebuffer *
-clutter_paint_context_get_framebuffer (ClutterPaintContext *paint_context)
-{
- g_return_val_if_fail (paint_context->framebuffers, NULL);
-
- return paint_context->framebuffers->data;
-}
-
-CoglFramebuffer *
-clutter_paint_context_get_base_framebuffer (ClutterPaintContext *paint_context)
-{
- return g_list_last (paint_context->framebuffers)->data;
-}
-
-/**
- * clutter_paint_context_get_stage_view: (skip)
- */
-ClutterStageView *
-clutter_paint_context_get_stage_view (ClutterPaintContext *paint_context)
-{
- return paint_context->view;
-}
-
-/**
- * clutter_paint_context_is_drawing_off_stage: (skip)
- *
- * Return %TRUE if the paint context is currently drawing off stage.
- * This happens if there are any framebuffers pushed, and the base framebuffer
- * comes from the stage view.
- */
-gboolean
-clutter_paint_context_is_drawing_off_stage (ClutterPaintContext *paint_context)
-{
- if (g_list_length (paint_context->framebuffers) > 1)
- return TRUE;
-
- return !paint_context->view;
-}
-
-/**
- * clutter_paint_context_get_paint_flags: (skip)
- */
-ClutterPaintFlag
-clutter_paint_context_get_paint_flags (ClutterPaintContext *paint_context)
-{
- return paint_context->paint_flags;
-}
diff --git a/clutter/clutter/clutter-paint-context.h b/clutter/clutter/clutter-paint-context.h
deleted file mode 100644
index 2a36fe967..000000000
--- a/clutter/clutter/clutter-paint-context.h
+++ /dev/null
@@ -1,78 +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_PAINT_CONTEXT_H
-#define CLUTTER_PAINT_CONTEXT_H
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <glib-object.h>
-
-#include "clutter-macros.h"
-#include "clutter-stage-view.h"
-
-typedef struct _ClutterPaintContext ClutterPaintContext;
-
-typedef enum _ClutterPaintFlag
-{
- CLUTTER_PAINT_FLAG_NONE = 0,
- CLUTTER_PAINT_FLAG_NO_CURSORS = 1 << 0,
- CLUTTER_PAINT_FLAG_FORCE_CURSORS = 1 << 1,
- CLUTTER_PAINT_FLAG_CLEAR = 1 << 2,
-} ClutterPaintFlag;
-
-#define CLUTTER_TYPE_PAINT_CONTEXT (clutter_paint_context_get_type ())
-
-CLUTTER_EXPORT
-GType clutter_paint_context_get_type (void);
-
-CLUTTER_EXPORT
-ClutterPaintContext * clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer,
- const cairo_region_t *redraw_clip,
- ClutterPaintFlag paint_flags);
-
-CLUTTER_EXPORT
-ClutterPaintContext * clutter_paint_context_ref (ClutterPaintContext *paint_context);
-
-CLUTTER_EXPORT
-void clutter_paint_context_unref (ClutterPaintContext *paint_context);
-
-CLUTTER_EXPORT
-void clutter_paint_context_destroy (ClutterPaintContext *paint_context);
-
-CLUTTER_EXPORT
-CoglFramebuffer * clutter_paint_context_get_framebuffer (ClutterPaintContext *paint_context);
-
-CLUTTER_EXPORT
-ClutterStageView * clutter_paint_context_get_stage_view (ClutterPaintContext *paint_context);
-
-CLUTTER_EXPORT
-void clutter_paint_context_push_framebuffer (ClutterPaintContext *paint_context,
- CoglFramebuffer *framebuffer);
-
-CLUTTER_EXPORT
-void clutter_paint_context_pop_framebuffer (ClutterPaintContext *paint_context);
-
-CLUTTER_EXPORT
-const cairo_region_t * clutter_paint_context_get_redraw_clip (ClutterPaintContext *paint_context);
-
-CLUTTER_EXPORT
-ClutterPaintFlag clutter_paint_context_get_paint_flags (ClutterPaintContext *paint_context);
-
-#endif /* CLUTTER_PAINT_CONTEXT_H */
diff --git a/clutter/clutter/clutter-paint-node-private.h b/clutter/clutter/clutter-paint-node-private.h
deleted file mode 100644
index b084e81d4..000000000
--- a/clutter/clutter/clutter-paint-node-private.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2011 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_PAINT_NODE_PRIVATE_H__
-#define __CLUTTER_PAINT_NODE_PRIVATE_H__
-
-#include <glib-object.h>
-#include <json-glib/json-glib.h>
-#include <clutter/clutter-paint-context.h>
-#include <clutter/clutter-paint-node.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_PAINT_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_PAINT_NODE, ClutterPaintNodeClass))
-#define CLUTTER_IS_PAINT_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_PAINT_NODE))
-#define CLUTTER_PAINT_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_PAINT_NODE, ClutterPaintNodeClass))
-
-typedef struct _ClutterPaintOperation ClutterPaintOperation;
-
-struct _ClutterPaintNode
-{
- GTypeInstance parent_instance;
-
- ClutterPaintNode *parent;
-
- ClutterPaintNode *first_child;
- ClutterPaintNode *prev_sibling;
- ClutterPaintNode *next_sibling;
- ClutterPaintNode *last_child;
-
- GArray *operations;
-
- const gchar *name;
-
- guint n_children;
-
- volatile int ref_count;
-};
-
-struct _ClutterPaintNodeClass
-{
- GTypeClass base_class;
-
- void (* finalize) (ClutterPaintNode *node);
-
- gboolean (* pre_draw) (ClutterPaintNode *node,
- ClutterPaintContext *paint_context);
- void (* draw) (ClutterPaintNode *node,
- ClutterPaintContext *paint_context);
- void (* post_draw) (ClutterPaintNode *node,
- ClutterPaintContext *paint_context);
-
- JsonNode*(* serialize) (ClutterPaintNode *node);
-
- CoglFramebuffer *(* get_framebuffer) (ClutterPaintNode *node);
-};
-
-#define PAINT_OP_INIT { PAINT_OP_INVALID }
-
-typedef enum
-{
- PAINT_OP_INVALID = 0,
- PAINT_OP_TEX_RECT,
- PAINT_OP_TEX_RECTS,
- PAINT_OP_MULTITEX_RECT,
- PAINT_OP_PRIMITIVE
-} PaintOpCode;
-
-struct _ClutterPaintOperation
-{
- PaintOpCode opcode;
-
- GArray *coords;
-
- union {
- float texrect[8];
-
- CoglPrimitive *primitive;
- } op;
-};
-
-GType _clutter_transform_node_get_type (void) G_GNUC_CONST;
-GType _clutter_dummy_node_get_type (void) G_GNUC_CONST;
-
-void _clutter_paint_operation_paint_rectangle (const ClutterPaintOperation *op);
-void _clutter_paint_operation_clip_rectangle (const ClutterPaintOperation *op);
-void _clutter_paint_operation_paint_path (const ClutterPaintOperation *op);
-void _clutter_paint_operation_clip_path (const ClutterPaintOperation *op);
-void _clutter_paint_operation_paint_primitive (const ClutterPaintOperation *op);
-
-void _clutter_paint_node_init_types (void);
-gpointer _clutter_paint_node_create (GType gtype);
-
-ClutterPaintNode * _clutter_transform_node_new (const graphene_matrix_t *matrix);
-ClutterPaintNode * _clutter_dummy_node_new (ClutterActor *actor,
- CoglFramebuffer *framebuffer);
-
-void _clutter_paint_node_dump_tree (ClutterPaintNode *root);
-
-G_GNUC_INTERNAL
-void clutter_paint_node_remove_child (ClutterPaintNode *node,
- ClutterPaintNode *child);
-G_GNUC_INTERNAL
-void clutter_paint_node_replace_child (ClutterPaintNode *node,
- ClutterPaintNode *old_child,
- ClutterPaintNode *new_child);
-G_GNUC_INTERNAL
-void clutter_paint_node_remove_all (ClutterPaintNode *node);
-
-G_GNUC_INTERNAL
-guint clutter_paint_node_get_n_children (ClutterPaintNode *node);
-
-G_GNUC_INTERNAL
-ClutterPaintNode * clutter_paint_node_get_first_child (ClutterPaintNode *node);
-G_GNUC_INTERNAL
-ClutterPaintNode * clutter_paint_node_get_previous_sibling (ClutterPaintNode *node);
-G_GNUC_INTERNAL
-ClutterPaintNode * clutter_paint_node_get_next_sibling (ClutterPaintNode *node);
-G_GNUC_INTERNAL
-ClutterPaintNode * clutter_paint_node_get_last_child (ClutterPaintNode *node);
-G_GNUC_INTERNAL
-ClutterPaintNode * clutter_paint_node_get_parent (ClutterPaintNode *node);
-
-
-#define CLUTTER_TYPE_EFFECT_NODE (clutter_effect_node_get_type ())
-#define CLUTTER_EFFECT_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_EFFECT_NODE, ClutterEffectNode))
-#define CLUTTER_IS_EFFECT_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_EFFECT_NODE))
-
-/**
- * ClutterEffectNode:
- *
- * The #ClutterEffectNode structure is an opaque
- * type whose members cannot be directly accessed.
- */
-typedef struct _ClutterEffectNode ClutterEffectNode;
-typedef struct _ClutterEffectNode ClutterEffectNodeClass;
-
-CLUTTER_EXPORT
-GType clutter_effect_node_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterPaintNode * clutter_effect_node_new (ClutterEffect *effect);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_PAINT_NODE_PRIVATE_H__ */
diff --git a/clutter/clutter/clutter-paint-node.c b/clutter/clutter/clutter-paint-node.c
deleted file mode 100644
index 57b6b6589..000000000
--- a/clutter/clutter/clutter-paint-node.c
+++ /dev/null
@@ -1,1289 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2011 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-paint-node
- * @Title: ClutterPaintNode
- * @Short_Description: Paint objects
- *
- * #ClutterPaintNode is an element in the render graph.
- *
- * The render graph contains all the elements that need to be painted by
- * Clutter when submitting a frame to the graphics system.
- *
- * The render graph is distinct from the scene graph: the scene graph is
- * composed by actors, which can be visible or invisible; the scene graph
- * elements also respond to events. The render graph, instead, is only
- * composed by nodes that will be painted.
- *
- * Each #ClutterActor can submit multiple #ClutterPaintNode<!-- -->s to
- * the render graph.
- */
-
-/**
- * ClutterPaintNode: (ref-func clutter_paint_node_ref) (unref-func clutter_paint_node_unref) (set-value-func clutter_value_set_paint_node) (get-value-func clutter_value_get_paint_node)
- *
- * The `ClutterPaintNode` structure contains only private data
- * and it should be accessed using the provided API.
- *
- * Since: 1.10
- */
-
-/**
- * ClutterPaintNodeClass:
- *
- * The `ClutterPaintNodeClass` structure contains only private data.
- *
- * Since: 1.10
- */
-
-#include "clutter-build-config.h"
-
-#include <pango/pango.h>
-#include <cogl/cogl.h>
-#include <json-glib/json-glib.h>
-
-#include "clutter-paint-node-private.h"
-
-#include "clutter-debug.h"
-#include "clutter-private.h"
-
-#include <gobject/gvaluecollector.h>
-
-static inline void clutter_paint_operation_clear (ClutterPaintOperation *op);
-
-static void
-value_paint_node_init (GValue *value)
-{
- value->data[0].v_pointer = NULL;
-}
-
-static void
-value_paint_node_free_value (GValue *value)
-{
- if (value->data[0].v_pointer != NULL)
- clutter_paint_node_unref (value->data[0].v_pointer);
-}
-
-static void
-value_paint_node_copy_value (const GValue *src,
- GValue *dst)
-{
- if (src->data[0].v_pointer != NULL)
- dst->data[0].v_pointer = clutter_paint_node_ref (src->data[0].v_pointer);
- else
- dst->data[0].v_pointer = NULL;
-}
-
-static gpointer
-value_paint_node_peek_pointer (const GValue *value)
-{
- return value->data[0].v_pointer;
-}
-
-static gchar *
-value_paint_node_collect_value (GValue *value,
- guint n_collect_values,
- GTypeCValue *collect_values,
- guint collect_flags)
-{
- ClutterPaintNode *node;
-
- node = collect_values[0].v_pointer;
-
- if (node == NULL)
- {
- value->data[0].v_pointer = NULL;
- return NULL;
- }
-
- if (node->parent_instance.g_class == NULL)
- return g_strconcat ("invalid unclassed ClutterPaintNode pointer for "
- "value type '",
- G_VALUE_TYPE_NAME (value),
- "'",
- NULL);
-
- value->data[0].v_pointer = clutter_paint_node_ref (node);
-
- return NULL;
-}
-
-static gchar *
-value_paint_node_lcopy_value (const GValue *value,
- guint n_collect_values,
- GTypeCValue *collect_values,
- guint collect_flags)
-{
- ClutterPaintNode **node_p = collect_values[0].v_pointer;
-
- if (node_p == NULL)
- return g_strconcat ("value location for '",
- G_VALUE_TYPE_NAME (value),
- "' passed as NULL",
- NULL);
-
- if (value->data[0].v_pointer == NULL)
- *node_p = NULL;
- else if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
- *node_p = value->data[0].v_pointer;
- else
- *node_p = clutter_paint_node_ref (value->data[0].v_pointer);
-
- return NULL;
-}
-
-static void
-clutter_paint_node_class_base_init (ClutterPaintNodeClass *klass)
-{
-}
-
-static void
-clutter_paint_node_class_base_finalize (ClutterPaintNodeClass *klass)
-{
-}
-
-static void
-clutter_paint_node_real_finalize (ClutterPaintNode *node)
-{
- ClutterPaintNode *iter;
-
- if (node->operations != NULL)
- {
- guint i;
-
- for (i = 0; i < node->operations->len; i++)
- {
- ClutterPaintOperation *op;
-
- op = &g_array_index (node->operations, ClutterPaintOperation, i);
- clutter_paint_operation_clear (op);
- }
-
- g_array_unref (node->operations);
- }
-
- iter = node->first_child;
- while (iter != NULL)
- {
- ClutterPaintNode *next = iter->next_sibling;
-
- clutter_paint_node_remove_child (node, iter);
-
- iter = next;
- }
-
- g_type_free_instance ((GTypeInstance *) node);
-}
-
-static gboolean
-clutter_paint_node_real_pre_draw (ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- return FALSE;
-}
-
-static void
-clutter_paint_node_real_draw (ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
-}
-
-static void
-clutter_paint_node_real_post_draw (ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
-}
-
-static void
-clutter_paint_node_class_init (ClutterPaintNodeClass *klass)
-{
- klass->pre_draw = clutter_paint_node_real_pre_draw;
- klass->draw = clutter_paint_node_real_draw;
- klass->post_draw = clutter_paint_node_real_post_draw;
- klass->finalize = clutter_paint_node_real_finalize;
-}
-
-static void
-clutter_paint_node_init (ClutterPaintNode *self)
-{
- self->ref_count = 1;
-}
-
-GType
-clutter_paint_node_get_type (void)
-{
- static size_t paint_node_type_id = 0;
-
- if (g_once_init_enter (&paint_node_type_id))
- {
- static const GTypeFundamentalInfo finfo = {
- (G_TYPE_FLAG_CLASSED |
- G_TYPE_FLAG_INSTANTIATABLE |
- G_TYPE_FLAG_DERIVABLE |
- G_TYPE_FLAG_DEEP_DERIVABLE),
- };
-
- static const GTypeValueTable value_table = {
- value_paint_node_init,
- value_paint_node_free_value,
- value_paint_node_copy_value,
- value_paint_node_peek_pointer,
- "p",
- value_paint_node_collect_value,
- "p",
- value_paint_node_lcopy_value,
- };
-
- const GTypeInfo node_info = {
- sizeof (ClutterPaintNodeClass),
-
- (GBaseInitFunc) clutter_paint_node_class_base_init,
- (GBaseFinalizeFunc) clutter_paint_node_class_base_finalize,
- (GClassInitFunc) clutter_paint_node_class_init,
- (GClassFinalizeFunc) NULL,
- NULL,
-
- sizeof (ClutterPaintNode),
- 0,
- (GInstanceInitFunc) clutter_paint_node_init,
-
- &value_table,
- };
-
- GType id =
- g_type_register_fundamental (g_type_fundamental_next (),
- I_("ClutterPaintNode"),
- &node_info, &finfo,
- G_TYPE_FLAG_ABSTRACT);
-
- g_once_init_leave (&paint_node_type_id, id);
- }
-
- return paint_node_type_id;
-}
-
-/**
- * clutter_paint_node_set_name:
- * @node: a #ClutterPaintNode
- * @name: a string annotating the @node
- *
- * Sets a user-readable @name for @node.
- *
- * The @name will be used for debugging purposes.
- *
- * The @node will intern @name using g_intern_string(). If you have access to a
- * static string, use clutter_paint_node_set_static_name() instead.
- *
- * Since: 1.10
- */
-void
-clutter_paint_node_set_name (ClutterPaintNode *node,
- const char *name)
-{
- g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
-
- node->name = g_intern_string (name);
-}
-
-/**
- * clutter_paint_node_set_static_name: (skip)
- *
- * Like clutter_paint_node_set_name() but uses a static or interned string
- * containing the name.
- */
-void
-clutter_paint_node_set_static_name (ClutterPaintNode *node,
- const char *name)
-{
- g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
-
- node->name = name;
-}
-
-/**
- * clutter_paint_node_ref:
- * @node: a #ClutterPaintNode
- *
- * Acquires a reference on @node.
- *
- * Return value: (transfer full): the #ClutterPaintNode
- *
- * Since: 1.10
- */
-ClutterPaintNode *
-clutter_paint_node_ref (ClutterPaintNode *node)
-{
- g_return_val_if_fail (CLUTTER_IS_PAINT_NODE (node), NULL);
-
- g_atomic_int_inc (&node->ref_count);
-
- return node;
-}
-
-/**
- * clutter_paint_node_unref:
- * @node: a #ClutterPaintNode
- *
- * Releases a reference on @node.
- *
- * Since: 1.10
- */
-void
-clutter_paint_node_unref (ClutterPaintNode *node)
-{
- g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
-
- if (g_atomic_int_dec_and_test (&node->ref_count))
- {
- ClutterPaintNodeClass *klass = CLUTTER_PAINT_NODE_GET_CLASS (node);
-
- klass->finalize (node);
- }
-}
-
-/**
- * clutter_paint_node_add_child:
- * @node: a #ClutterPaintNode
- * @child: the child #ClutterPaintNode to add
- *
- * Adds @child to the list of children of @node.
- *
- * This function will acquire a reference on @child.
- *
- * Since: 1.10
- */
-void
-clutter_paint_node_add_child (ClutterPaintNode *node,
- ClutterPaintNode *child)
-{
- g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
- g_return_if_fail (CLUTTER_IS_PAINT_NODE (child));
- g_return_if_fail (node != child);
- g_return_if_fail (child->parent == NULL);
-
- child->parent = node;
- clutter_paint_node_ref (child);
-
- node->n_children += 1;
-
- child->prev_sibling = node->last_child;
-
- if (node->last_child != NULL)
- {
- ClutterPaintNode *tmp = node->last_child;
-
- tmp->next_sibling = child;
- }
-
- if (child->prev_sibling == NULL)
- node->first_child = child;
-
- if (child->next_sibling == NULL)
- node->last_child = child;
-}
-
-/**
- * clutter_paint_node_remove_child:
- * @node: a #ClutterPaintNode
- * @child: the #ClutterPaintNode to remove
- *
- * Removes @child from the list of children of @node.
- *
- * This function will release the reference on @child acquired by
- * using clutter_paint_node_add_child().
- *
- * Since: 1.10
- */
-void
-clutter_paint_node_remove_child (ClutterPaintNode *node,
- ClutterPaintNode *child)
-{
- ClutterPaintNode *prev, *next;
-
- g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
- g_return_if_fail (CLUTTER_IS_PAINT_NODE (child));
- g_return_if_fail (node != child);
- g_return_if_fail (child->parent == node);
-
- node->n_children -= 1;
-
- prev = child->prev_sibling;
- next = child->next_sibling;
-
- if (prev != NULL)
- prev->next_sibling = next;
-
- if (next != NULL)
- next->prev_sibling = prev;
-
- if (node->first_child == child)
- node->first_child = next;
-
- if (node->last_child == child)
- node->last_child = prev;
-
- child->prev_sibling = NULL;
- child->next_sibling = NULL;
- child->parent = NULL;
-
- clutter_paint_node_unref (child);
-}
-
-/**
- * clutter_paint_node_replace_child:
- * @node: a #ClutterPaintNode
- * @old_child: the child replaced by @new_child
- * @new_child: the child that replaces @old_child
- *
- * Atomically replaces @old_child with @new_child in the list of
- * children of @node.
- *
- * This function will release the reference on @old_child acquired
- * by @node, and will acquire a new reference on @new_child.
- *
- * Since: 1.10
- */
-void
-clutter_paint_node_replace_child (ClutterPaintNode *node,
- ClutterPaintNode *old_child,
- ClutterPaintNode *new_child)
-{
- ClutterPaintNode *prev, *next;
-
- g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
- g_return_if_fail (CLUTTER_IS_PAINT_NODE (old_child));
- g_return_if_fail (old_child->parent == node);
- g_return_if_fail (CLUTTER_IS_PAINT_NODE (new_child));
- g_return_if_fail (new_child->parent == NULL);
-
- prev = old_child->prev_sibling;
- next = old_child->next_sibling;
-
- new_child->parent = node;
- new_child->prev_sibling = prev;
- new_child->next_sibling = next;
- clutter_paint_node_ref (new_child);
-
- if (prev != NULL)
- prev->next_sibling = new_child;
-
- if (next != NULL)
- next->prev_sibling = new_child;
-
- if (node->first_child == old_child)
- node->first_child = new_child;
-
- if (node->last_child == old_child)
- node->last_child = new_child;
-
- old_child->prev_sibling = NULL;
- old_child->next_sibling = NULL;
- old_child->parent = NULL;
- clutter_paint_node_unref (old_child);
-}
-
-/**
- * clutter_paint_node_remove_all:
- * @node: a #ClutterPaintNode
- *
- * Removes all children of @node.
- *
- * This function releases the reference acquired by @node on its
- * children.
- *
- * Since: 1.10
- */
-void
-clutter_paint_node_remove_all (ClutterPaintNode *node)
-{
- ClutterPaintNode *iter;
-
- g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
-
- iter = node->first_child;
- while (iter != NULL)
- {
- ClutterPaintNode *next = iter->next_sibling;
-
- clutter_paint_node_remove_child (node, iter);
-
- iter = next;
- }
-}
-
-/**
- * clutter_paint_node_get_first_child:
- * @node: a #ClutterPaintNode
- *
- * Retrieves the first child of the @node.
- *
- * Return value: (transfer none): a pointer to the first child of
- * the #ClutterPaintNode.
- *
- * Since: 1.10
- */
-ClutterPaintNode *
-clutter_paint_node_get_first_child (ClutterPaintNode *node)
-{
- g_return_val_if_fail (CLUTTER_IS_PAINT_NODE (node), NULL);
-
- return node->first_child;
-}
-
-/**
- * clutter_paint_node_get_previous_sibling:
- * @node: a #ClutterPaintNode
- *
- * Retrieves the previous sibling of @node.
- *
- * Return value: (transfer none): a pointer to the previous sibling
- * of the #ClutterPaintNode.
- *
- * Since: 1.10
- */
-ClutterPaintNode *
-clutter_paint_node_get_previous_sibling (ClutterPaintNode *node)
-{
- g_return_val_if_fail (CLUTTER_IS_PAINT_NODE (node), NULL);
-
- return node->prev_sibling;
-}
-
-/**
- * clutter_paint_node_get_next_sibling:
- * @node: a #ClutterPaintNode
- *
- * Retrieves the next sibling of @node.
- *
- * Return value: (transfer none): a pointer to the next sibling
- * of a #ClutterPaintNode
- *
- * Since: 1.10
- */
-ClutterPaintNode *
-clutter_paint_node_get_next_sibling (ClutterPaintNode *node)
-{
- g_return_val_if_fail (CLUTTER_IS_PAINT_NODE (node), NULL);
-
- return node->next_sibling;
-}
-
-/**
- * clutter_paint_node_get_last_child:
- * @node: a #ClutterPaintNode
- *
- * Retrieves the last child of @node.
- *
- * Return value: (transfer none): a pointer to the last child
- * of a #ClutterPaintNode
- *
- * Since: 1.10
- */
-ClutterPaintNode *
-clutter_paint_node_get_last_child (ClutterPaintNode *node)
-{
- g_return_val_if_fail (CLUTTER_IS_PAINT_NODE (node), NULL);
-
- return node->last_child;
-}
-
-/**
- * clutter_paint_node_get_parent:
- * @node: a #ClutterPaintNode
- *
- * Retrieves the parent of @node.
- *
- * Return value: (transfer none): a pointer to the parent of
- * a #ClutterPaintNode
- *
- * Since: 1.10
- */
-ClutterPaintNode *
-clutter_paint_node_get_parent (ClutterPaintNode *node)
-{
- g_return_val_if_fail (CLUTTER_IS_PAINT_NODE (node), NULL);
-
- return node->parent;
-}
-
-/**
- * clutter_paint_node_get_n_children:
- * @node: a #ClutterPaintNode
- *
- * Retrieves the number of children of @node.
- *
- * Return value: the number of children of a #ClutterPaintNode
- *
- * Since: 1.10
- */
-guint
-clutter_paint_node_get_n_children (ClutterPaintNode *node)
-{
- g_return_val_if_fail (CLUTTER_IS_PAINT_NODE (node), 0);
-
- return node->n_children;
-}
-
-/**
- * clutter_value_set_paint_node:
- * @value: a #GValue initialized with %CLUTTER_TYPE_PAINT_NODE
- * @node: (type Clutter.PaintNode) (allow-none): a #ClutterPaintNode, or %NULL
- *
- * Sets the contents of a #GValue initialized with %CLUTTER_TYPE_PAINT_NODE.
- *
- * This function increased the reference count of @node; if you do not wish
- * to increase the reference count, use clutter_value_take_paint_node()
- * instead. The reference count will be released by g_value_unset().
- *
- * Since: 1.10
- */
-void
-clutter_value_set_paint_node (GValue *value,
- gpointer node)
-{
- ClutterPaintNode *old_node;
-
- g_return_if_fail (CLUTTER_VALUE_HOLDS_PAINT_NODE (value));
-
- old_node = value->data[0].v_pointer;
-
- if (node != NULL)
- {
- g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
-
- value->data[0].v_pointer = clutter_paint_node_ref (node);
- }
- else
- value->data[0].v_pointer = NULL;
-
- if (old_node != NULL)
- clutter_paint_node_unref (old_node);
-}
-
-/**
- * clutter_value_take_paint_node:
- * @value: a #GValue, initialized with %CLUTTER_TYPE_PAINT_NODE
- * @node: (type Clutter.PaintNode) (allow-none): a #ClutterPaintNode, or %NULL
- *
- * Sets the contents of a #GValue initialized with %CLUTTER_TYPE_PAINT_NODE.
- *
- * Unlike clutter_value_set_paint_node(), this function will not take a
- * reference on the passed @node: instead, it will take ownership of the
- * current reference count.
- *
- * Since: 1.10
- */
-void
-clutter_value_take_paint_node (GValue *value,
- gpointer node)
-{
- ClutterPaintNode *old_node;
-
- g_return_if_fail (CLUTTER_VALUE_HOLDS_PAINT_NODE (value));
-
- old_node = value->data[0].v_pointer;
-
- if (node != NULL)
- {
- g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
-
- /* take over ownership */
- value->data[0].v_pointer = node;
- }
- else
- value->data[0].v_pointer = NULL;
-
- if (old_node != NULL)
- clutter_paint_node_unref (old_node);
-}
-
-/**
- * clutter_value_get_paint_node:
- * @value: a #GValue initialized with %CLUTTER_TYPE_PAINT_NODE
- *
- * Retrieves a pointer to the #ClutterPaintNode contained inside
- * the passed #GValue.
- *
- * Return value: (transfer none) (type Clutter.PaintNode): a pointer to
- * a #ClutterPaintNode, or %NULL
- *
- * Since: 1.10
- */
-gpointer
-clutter_value_get_paint_node (const GValue *value)
-{
- g_return_val_if_fail (CLUTTER_VALUE_HOLDS_PAINT_NODE (value), NULL);
-
- return value->data[0].v_pointer;
-}
-
-/**
- * clutter_value_dup_paint_node:
- * @value: a #GValue initialized with %CLUTTER_TYPE_PAINT_NODE
- *
- * Retrieves a pointer to the #ClutterPaintNode contained inside
- * the passed #GValue, and if not %NULL it will increase the
- * reference count.
- *
- * Return value: (transfer full) (type Clutter.PaintNode): a pointer
- * to the #ClutterPaintNode, with its reference count increased,
- * or %NULL
- *
- * Since: 1.10
- */
-gpointer
-clutter_value_dup_paint_node (const GValue *value)
-{
- g_return_val_if_fail (CLUTTER_VALUE_HOLDS_PAINT_NODE (value), NULL);
-
- if (value->data[0].v_pointer != NULL)
- return clutter_paint_node_ref (value->data[0].v_pointer);
-
- return NULL;
-}
-
-static inline void
-clutter_paint_operation_clear (ClutterPaintOperation *op)
-{
- switch (op->opcode)
- {
- case PAINT_OP_INVALID:
- break;
-
- case PAINT_OP_TEX_RECT:
- break;
-
- case PAINT_OP_TEX_RECTS:
- case PAINT_OP_MULTITEX_RECT:
- g_clear_pointer (&op->coords, g_array_unref);
- break;
-
- case PAINT_OP_PRIMITIVE:
- if (op->op.primitive != NULL)
- cogl_object_unref (op->op.primitive);
- break;
- }
-}
-
-static inline void
-clutter_paint_op_init_tex_rect (ClutterPaintOperation *op,
- const ClutterActorBox *rect,
- float x_1,
- float y_1,
- float x_2,
- float y_2)
-{
- clutter_paint_operation_clear (op);
-
- op->opcode = PAINT_OP_TEX_RECT;
- op->op.texrect[0] = rect->x1;
- op->op.texrect[1] = rect->y1;
- op->op.texrect[2] = rect->x2;
- op->op.texrect[3] = rect->y2;
- op->op.texrect[4] = x_1;
- op->op.texrect[5] = y_1;
- op->op.texrect[6] = x_2;
- op->op.texrect[7] = y_2;
-}
-
-static inline void
-clutter_paint_op_init_tex_rects (ClutterPaintOperation *op,
- const float *coords,
- unsigned int n_rects,
- gboolean use_default_tex_coords)
-{
- const unsigned int n_floats = n_rects * 8;
-
- clutter_paint_operation_clear (op);
-
- op->opcode = PAINT_OP_TEX_RECTS;
- op->coords = g_array_sized_new (FALSE, FALSE, sizeof (float), n_floats);
-
- if (use_default_tex_coords)
- {
- const float default_tex_coords[4] = { 0.0, 0.0, 1.0, 1.0 };
- int i;
-
- for (i = 0; i < n_rects; i++)
- {
- g_array_append_vals (op->coords, &coords[i * 4], 4);
- g_array_append_vals (op->coords, default_tex_coords, 4);
- }
- }
- else
- {
- g_array_append_vals (op->coords, coords, n_floats);
- }
-}
-
-static inline void
-clutter_paint_op_init_multitex_rect (ClutterPaintOperation *op,
- const ClutterActorBox *rect,
- const float *tex_coords,
- unsigned int tex_coords_len)
-{
- clutter_paint_operation_clear (op);
-
- op->opcode = PAINT_OP_MULTITEX_RECT;
- op->coords = g_array_sized_new (FALSE, FALSE,
- sizeof (float),
- tex_coords_len);
-
- g_array_append_vals (op->coords, tex_coords, tex_coords_len);
-
- op->op.texrect[0] = rect->x1;
- op->op.texrect[1] = rect->y1;
- op->op.texrect[2] = rect->x2;
- op->op.texrect[3] = rect->y2;
-}
-
-static inline void
-clutter_paint_op_init_primitive (ClutterPaintOperation *op,
- CoglPrimitive *primitive)
-{
- clutter_paint_operation_clear (op);
-
- op->opcode = PAINT_OP_PRIMITIVE;
- op->op.primitive = cogl_object_ref (primitive);
-}
-
-static inline void
-clutter_paint_node_maybe_init_operations (ClutterPaintNode *node)
-{
- if (node->operations != NULL)
- return;
-
- node->operations =
- g_array_new (FALSE, FALSE, sizeof (ClutterPaintOperation));
-}
-
-/**
- * clutter_paint_node_add_rectangle:
- * @node: a #ClutterPaintNode
- * @rect: a #ClutterActorBox
- *
- * Adds a rectangle region to the @node, as described by the
- * passed @rect.
- *
- * Since: 1.10
- */
-void
-clutter_paint_node_add_rectangle (ClutterPaintNode *node,
- const ClutterActorBox *rect)
-{
- ClutterPaintOperation operation = PAINT_OP_INIT;
-
- g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
- g_return_if_fail (rect != NULL);
-
- clutter_paint_node_maybe_init_operations (node);
-
- clutter_paint_op_init_tex_rect (&operation, rect, 0.0, 0.0, 1.0, 1.0);
- g_array_append_val (node->operations, operation);
-}
-
-/**
- * clutter_paint_node_add_texture_rectangle:
- * @node: a #ClutterPaintNode
- * @rect: a #ClutterActorBox
- * @x_1: the left X coordinate of the texture
- * @y_1: the top Y coordinate of the texture
- * @x_2: the right X coordinate of the texture
- * @y_2: the bottom Y coordinate of the texture
- *
- * Adds a rectangle region to the @node, with texture coordinates.
- *
- * Since: 1.10
- */
-void
-clutter_paint_node_add_texture_rectangle (ClutterPaintNode *node,
- const ClutterActorBox *rect,
- float x_1,
- float y_1,
- float x_2,
- float y_2)
-{
- ClutterPaintOperation operation = PAINT_OP_INIT;
-
- g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
- g_return_if_fail (rect != NULL);
-
- clutter_paint_node_maybe_init_operations (node);
-
- clutter_paint_op_init_tex_rect (&operation, rect, x_1, y_1, x_2, y_2);
- g_array_append_val (node->operations, operation);
-}
-
-
-/**
- * clutter_paint_node_add_multitexture_rectangle:
- * @node: a #ClutterPaintNode
- * @rect: a #ClutterActorBox
- * @text_coords: array of multitexture values
- * @text_coords_len: number of items of @text_coords
- *
- * Adds a rectangle region to the @node, with multitexture coordinates.
- */
-void
-clutter_paint_node_add_multitexture_rectangle (ClutterPaintNode *node,
- const ClutterActorBox *rect,
- const float *text_coords,
- unsigned int text_coords_len)
-{
- ClutterPaintOperation operation = PAINT_OP_INIT;
-
- g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
- g_return_if_fail (rect != NULL);
-
- clutter_paint_node_maybe_init_operations (node);
-
- clutter_paint_op_init_multitex_rect (&operation, rect, text_coords, text_coords_len);
- g_array_append_val (node->operations, operation);
-}
-
-/**
- * clutter_paint_node_add_rectangles:
- * @node: a #ClutterPaintNode
- * @coords: (in) (array length=n_rects) (transfer none): array of
- * coordinates containing groups of 4 float values: [x_1, y_1, x_2, y_2] that
- * are interpreted as two position coordinates; one for the top left of the
- * rectangle (x1, y1), and one for the bottom right of the rectangle
- * (x2, y2).
- * @n_rects: number of rectangles defined in @coords.
- *
- * Adds a series of rectangles to @node.
- *
- * As a general rule for better performance its recommended to use this API
- * instead of calling clutter_paint_node_add_rectangle() separately for
- * multiple rectangles if all of the rectangles will be drawn together.
- *
- * See cogl_framebuffer_draw_rectangles().
- */
-void
-clutter_paint_node_add_rectangles (ClutterPaintNode *node,
- const float *coords,
- unsigned int n_rects)
-{
- ClutterPaintOperation operation = PAINT_OP_INIT;
-
- g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
- g_return_if_fail (coords != NULL);
-
- clutter_paint_node_maybe_init_operations (node);
-
- clutter_paint_op_init_tex_rects (&operation, coords, n_rects, TRUE);
- g_array_append_val (node->operations, operation);
-}
-
-/**
- * clutter_paint_node_add_texture_rectangles:
- * @node: a #ClutterPaintNode
- * @coords: (in) (array length=n_rects) (transfer none): array containing
- * groups of 8 float values: [x_1, y_1, x_2, y_2, s_1, t_1, s_2, t_2]
- * that have the same meaning as the arguments for
- * cogl_framebuffer_draw_textured_rectangle().
- * @n_rects: number of rectangles defined in @coords.
- *
- * Adds a series of rectangles to @node.
- *
- * The given texture coordinates should always be normalized such that
- * (0, 0) corresponds to the top left and (1, 1) corresponds to the
- * bottom right. To map an entire texture across the rectangle pass
- * in s_1=0, t_1=0, s_2=1, t_2=1.
- *
- * See cogl_framebuffer_draw_textured_rectangles().
- */
-void
-clutter_paint_node_add_texture_rectangles (ClutterPaintNode *node,
- const float *coords,
- unsigned int n_rects)
-{
- ClutterPaintOperation operation = PAINT_OP_INIT;
-
- g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
- g_return_if_fail (coords != NULL);
-
- clutter_paint_node_maybe_init_operations (node);
-
- clutter_paint_op_init_tex_rects (&operation, coords, n_rects, FALSE);
- g_array_append_val (node->operations, operation);
-}
-
-/**
- * clutter_paint_node_add_primitive: (skip)
- * @node: a #ClutterPaintNode
- * @primitive: a Cogl primitive
- *
- * Adds a region described by a Cogl primitive to the @node.
- *
- * This function acquires a reference on @primitive, so it is safe
- * to call cogl_object_unref() when it returns.
- *
- * Since: 1.10
- */
-void
-clutter_paint_node_add_primitive (ClutterPaintNode *node,
- CoglPrimitive *primitive)
-{
- ClutterPaintOperation operation = PAINT_OP_INIT;
-
- g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
- g_return_if_fail (cogl_is_primitive (primitive));
-
- clutter_paint_node_maybe_init_operations (node);
-
- clutter_paint_op_init_primitive (&operation, primitive);
- g_array_append_val (node->operations, operation);
-}
-
-/**
- * clutter_paint_node_paint:
- * @node: a #ClutterPaintNode
- *
- * Paints the @node using the class implementation, traversing
- * its children, if any.
- */
-void
-clutter_paint_node_paint (ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- ClutterPaintNodeClass *klass = CLUTTER_PAINT_NODE_GET_CLASS (node);
- ClutterPaintNode *iter;
- gboolean res;
-
- res = klass->pre_draw (node, paint_context);
-
- if (res)
- {
- klass->draw (node, paint_context);
- }
-
- for (iter = node->first_child;
- iter != NULL;
- iter = iter->next_sibling)
- {
- clutter_paint_node_paint (iter, paint_context);
- }
-
- if (res)
- {
- klass->post_draw (node, paint_context);
- }
-}
-
-#ifdef CLUTTER_ENABLE_DEBUG
-static JsonNode *
-clutter_paint_node_serialize (ClutterPaintNode *node)
-{
- ClutterPaintNodeClass *klass = CLUTTER_PAINT_NODE_GET_CLASS (node);
-
- if (klass->serialize != NULL)
- return klass->serialize (node);
-
- return json_node_new (JSON_NODE_NULL);
-}
-
-static JsonNode *
-clutter_paint_node_to_json (ClutterPaintNode *node)
-{
- JsonBuilder *builder;
- JsonNode *res;
-
- builder = json_builder_new ();
-
- json_builder_begin_object (builder);
-
- json_builder_set_member_name (builder, "type");
- json_builder_add_string_value (builder, g_type_name (G_TYPE_FROM_INSTANCE (node)));
-
- json_builder_set_member_name (builder, "name");
- json_builder_add_string_value (builder, node->name);
-
- json_builder_set_member_name (builder, "node-data");
- json_builder_add_value (builder, clutter_paint_node_serialize (node));
-
- json_builder_set_member_name (builder, "operations");
- json_builder_begin_array (builder);
-
- if (node->operations != NULL)
- {
- guint i, j;
-
- for (i = 0; i < node->operations->len; i++)
- {
- const ClutterPaintOperation *op;
-
- op = &g_array_index (node->operations, ClutterPaintOperation, i);
- json_builder_begin_object (builder);
-
- switch (op->opcode)
- {
- case PAINT_OP_TEX_RECT:
- json_builder_set_member_name (builder, "texrect");
- json_builder_begin_array (builder);
- json_builder_add_double_value (builder, op->op.texrect[0]);
- json_builder_add_double_value (builder, op->op.texrect[1]);
- json_builder_add_double_value (builder, op->op.texrect[2]);
- json_builder_add_double_value (builder, op->op.texrect[3]);
- json_builder_add_double_value (builder, op->op.texrect[4]);
- json_builder_add_double_value (builder, op->op.texrect[5]);
- json_builder_add_double_value (builder, op->op.texrect[6]);
- json_builder_add_double_value (builder, op->op.texrect[7]);
- json_builder_end_array (builder);
- break;
-
- case PAINT_OP_TEX_RECTS:
- json_builder_set_member_name (builder, "texrects");
- json_builder_begin_array (builder);
-
- for (j = 0; i < op->coords->len; j++)
- {
- float coord = g_array_index (op->coords, float, j);
- json_builder_add_double_value (builder, coord);
- }
-
- json_builder_end_array (builder);
- break;
-
- case PAINT_OP_MULTITEX_RECT:
- json_builder_set_member_name (builder, "texrect");
- json_builder_begin_array (builder);
-
- for (j = 0; i < op->coords->len; j++)
- {
- float coord = g_array_index (op->coords, float, j);
- json_builder_add_double_value (builder, coord);
- }
-
- json_builder_end_array (builder);
- break;
-
- case PAINT_OP_PRIMITIVE:
- json_builder_set_member_name (builder, "primitive");
- json_builder_add_int_value (builder, (intptr_t) op->op.primitive);
- break;
-
- case PAINT_OP_INVALID:
- break;
- }
-
- json_builder_end_object (builder);
- }
- }
-
- json_builder_end_array (builder);
-
- json_builder_set_member_name (builder, "children");
- json_builder_begin_array (builder);
-
- if (node->first_child != NULL)
- {
- ClutterPaintNode *child;
-
- for (child = node->first_child;
- child != NULL;
- child = child->next_sibling)
- {
- JsonNode *n = clutter_paint_node_to_json (child);
-
- json_builder_add_value (builder, n);
- }
- }
-
- json_builder_end_array (builder);
-
- json_builder_end_object (builder);
-
- res = json_builder_get_root (builder);
-
- g_object_unref (builder);
-
- return res;
-}
-#endif /* CLUTTER_ENABLE_DEBUG */
-
-void
-_clutter_paint_node_dump_tree (ClutterPaintNode *node)
-{
-#ifdef CLUTTER_ENABLE_DEBUG
- JsonGenerator *gen = json_generator_new ();
- char *str;
- gsize len;
-
- json_generator_set_root (gen, clutter_paint_node_to_json (node));
- str = json_generator_to_data (gen, &len);
-
- g_print ("Render tree starting from %p:\n%s\n", node, str);
-
- g_free (str);
-#endif /* CLUTTER_ENABLE_DEBUG */
-}
-
-/*< private >
- * _clutter_paint_node_create:
- * @gtype: a #ClutterPaintNode type
- *
- * Creates a new #ClutterPaintNode instance using @gtype
- *
- * Return value: (transfer full): the newly created #ClutterPaintNode
- * sub-class instance; use clutter_paint_node_unref() when done
- */
-gpointer
-_clutter_paint_node_create (GType gtype)
-{
- g_return_val_if_fail (g_type_is_a (gtype, CLUTTER_TYPE_PAINT_NODE), NULL);
-
- return (gpointer) g_type_create_instance (gtype);
-}
-
-/**
- * clutter_paint_node_get_framebuffer:
- * @node: a #ClutterPaintNode
- *
- * Retrieves the #CoglFramebuffer that @node will draw
- * into. If @node doesn't specify a custom framebuffer,
- * the first ancestor with a custom framebuffer will be
- * used.
- *
- * Returns: (transfer none): a #CoglFramebuffer or %NULL if no custom one is
- * set.
- */
-CoglFramebuffer *
-clutter_paint_node_get_framebuffer (ClutterPaintNode *node)
-{
- ClutterPaintNodeClass *klass;
-
- while (node)
- {
- klass = CLUTTER_PAINT_NODE_GET_CLASS (node);
-
- if (klass->get_framebuffer != NULL)
- return klass->get_framebuffer (node);
-
- node = node->parent;
- }
-
- return NULL;
-}
diff --git a/clutter/clutter/clutter-paint-node.h b/clutter/clutter/clutter-paint-node.h
deleted file mode 100644
index b9f174962..000000000
--- a/clutter/clutter/clutter-paint-node.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2011 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_PAINT_NODE_H__
-#define __CLUTTER_PAINT_NODE_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <cogl/cogl.h>
-#include <clutter/clutter-types.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_PAINT_NODE (clutter_paint_node_get_type ())
-#define CLUTTER_PAINT_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_PAINT_NODE, ClutterPaintNode))
-#define CLUTTER_IS_PAINT_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_PAINT_NODE))
-
-typedef struct _ClutterPaintNodePrivate ClutterPaintNodePrivate;
-typedef struct _ClutterPaintNodeClass ClutterPaintNodeClass;
-
-CLUTTER_EXPORT
-GType clutter_paint_node_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterPaintNode * clutter_paint_node_ref (ClutterPaintNode *node);
-CLUTTER_EXPORT
-void clutter_paint_node_unref (ClutterPaintNode *node);
-
-CLUTTER_EXPORT
-void clutter_paint_node_paint (ClutterPaintNode *node,
- ClutterPaintContext *paint_context);
-
-CLUTTER_EXPORT
-void clutter_paint_node_set_name (ClutterPaintNode *node,
- const char *name);
-CLUTTER_EXPORT
-void clutter_paint_node_set_static_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);
-CLUTTER_EXPORT
-void clutter_paint_node_add_rectangle (ClutterPaintNode *node,
- const ClutterActorBox *rect);
-CLUTTER_EXPORT
-void clutter_paint_node_add_texture_rectangle (ClutterPaintNode *node,
- const ClutterActorBox *rect,
- float x_1,
- float y_1,
- float x_2,
- float y_2);
-
-CLUTTER_EXPORT
-void clutter_paint_node_add_multitexture_rectangle (ClutterPaintNode *node,
- const ClutterActorBox *rect,
- const float *text_coords,
- unsigned int text_coords_len);
-
-CLUTTER_EXPORT
-void clutter_paint_node_add_rectangles (ClutterPaintNode *node,
- const float *coords,
- unsigned int n_rects);
-CLUTTER_EXPORT
-void clutter_paint_node_add_texture_rectangles (ClutterPaintNode *node,
- const float *coords,
- unsigned int n_rects);
-
-CLUTTER_EXPORT
-void clutter_paint_node_add_primitive (ClutterPaintNode *node,
- CoglPrimitive *primitive);
-
-/**
- * CLUTTER_VALUE_HOLDS_PAINT_NODE:
- * @value: a #GValue
- *
- * Evaluates to %TRUE if the @value has been initialized to hold
- * a #ClutterPaintNode.
- *
- * Since: 1.10
- */
-#define CLUTTER_VALUE_HOLDS_PAINT_NODE(value) (G_VALUE_HOLDS (value, CLUTTER_TYPE_PAINT_NODE))
-
-CLUTTER_EXPORT
-void clutter_value_set_paint_node (GValue *value,
- gpointer node);
-CLUTTER_EXPORT
-void clutter_value_take_paint_node (GValue *value,
- gpointer node);
-CLUTTER_EXPORT
-gpointer clutter_value_get_paint_node (const GValue *value);
-CLUTTER_EXPORT
-gpointer clutter_value_dup_paint_node (const GValue *value);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_PAINT_NODE_H__ */
diff --git a/clutter/clutter/clutter-paint-nodes.c b/clutter/clutter/clutter-paint-nodes.c
deleted file mode 100644
index f1f7fce31..000000000
--- a/clutter/clutter/clutter-paint-nodes.c
+++ /dev/null
@@ -1,1972 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2011 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-paint-nodes
- * @Title: Paint Nodes
- * @Short_Description: ClutterPaintNode implementations
- *
- * Clutter provides a set of predefined #ClutterPaintNode implementations
- * that cover all the state changes available.
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-paint-node-private.h"
-
-#include <pango/pango.h>
-#include <cogl/cogl.h>
-
-#include "clutter-actor-private.h"
-#include "clutter-blur-private.h"
-#include "clutter-color.h"
-#include "clutter-debug.h"
-#include "clutter-private.h"
-#include "clutter-paint-context-private.h"
-
-#include "clutter-paint-nodes.h"
-
-static CoglPipeline *default_color_pipeline = NULL;
-static CoglPipeline *default_texture_pipeline = NULL;
-
-/*< private >
- * _clutter_paint_node_init_types:
- *
- * Initializes the required types for ClutterPaintNode subclasses
- */
-void
-_clutter_paint_node_init_types (void)
-{
- CoglContext *ctx;
- CoglColor cogl_color;
- GType node_type G_GNUC_UNUSED;
-
- if (G_LIKELY (default_color_pipeline != NULL))
- return;
-
- ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
-
- node_type = clutter_paint_node_get_type ();
-
- cogl_color_init_from_4f (&cogl_color, 1.0, 1.0, 1.0, 1.0);
-
- default_color_pipeline = cogl_pipeline_new (ctx);
- cogl_pipeline_set_color (default_color_pipeline, &cogl_color);
-
- default_texture_pipeline = cogl_pipeline_new (ctx);
- cogl_pipeline_set_layer_null_texture (default_texture_pipeline, 0);
- cogl_pipeline_set_color (default_texture_pipeline, &cogl_color);
- cogl_pipeline_set_layer_wrap_mode (default_texture_pipeline, 0,
- COGL_PIPELINE_WRAP_MODE_AUTOMATIC);
-}
-
-/*
- * Root node
- *
- * any frame can only have a since RootNode instance for each
- * top-level actor.
- */
-
-#define clutter_root_node_get_type clutter_root_node_get_type
-
-struct _ClutterRootNode
-{
- ClutterPaintNode parent_instance;
-
- CoglFramebuffer *framebuffer;
-
- CoglBufferBit clear_flags;
- CoglColor clear_color;
-};
-
-G_DEFINE_TYPE (ClutterRootNode, clutter_root_node, CLUTTER_TYPE_PAINT_NODE)
-
-static gboolean
-clutter_root_node_pre_draw (ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- ClutterRootNode *rnode = (ClutterRootNode *) node;
-
- clutter_paint_context_push_framebuffer (paint_context, rnode->framebuffer);
-
- cogl_framebuffer_clear (rnode->framebuffer,
- rnode->clear_flags,
- &rnode->clear_color);
-
- return TRUE;
-}
-
-static void
-clutter_root_node_post_draw (ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- clutter_paint_context_pop_framebuffer (paint_context);
-}
-
-static void
-clutter_root_node_finalize (ClutterPaintNode *node)
-{
- ClutterRootNode *rnode = (ClutterRootNode *) node;
-
- g_object_unref (rnode->framebuffer);
-
- CLUTTER_PAINT_NODE_CLASS (clutter_root_node_parent_class)->finalize (node);
-}
-
-static CoglFramebuffer *
-clutter_root_node_get_framebuffer (ClutterPaintNode *node)
-{
- ClutterRootNode *rnode = (ClutterRootNode *) node;
-
- return rnode->framebuffer;
-}
-
-static void
-clutter_root_node_class_init (ClutterRootNodeClass *klass)
-{
- ClutterPaintNodeClass *node_class = CLUTTER_PAINT_NODE_CLASS (klass);
-
- node_class->pre_draw = clutter_root_node_pre_draw;
- node_class->post_draw = clutter_root_node_post_draw;
- node_class->finalize = clutter_root_node_finalize;
- node_class->get_framebuffer = clutter_root_node_get_framebuffer;
-}
-
-static void
-clutter_root_node_init (ClutterRootNode *self)
-{
-}
-
-ClutterPaintNode *
-clutter_root_node_new (CoglFramebuffer *framebuffer,
- const ClutterColor *clear_color,
- CoglBufferBit clear_flags)
-{
- ClutterRootNode *res;
-
- g_return_val_if_fail (framebuffer, NULL);
-
- res = _clutter_paint_node_create (CLUTTER_TYPE_ROOT_NODE);
-
- cogl_color_init_from_4ub (&res->clear_color,
- clear_color->red,
- clear_color->green,
- clear_color->blue,
- clear_color->alpha);
- cogl_color_premultiply (&res->clear_color);
-
- res->framebuffer = g_object_ref (framebuffer);
- res->clear_flags = clear_flags;
-
- return (ClutterPaintNode *) res;
-}
-
-/*
- * ClutterTransformNode
- */
-
-struct _ClutterTransformNode
-{
- ClutterPaintNode parent_instance;
-
- graphene_matrix_t transform;
-};
-
-struct _ClutterTransformNodeClass
-{
- ClutterPaintNodeClass parent_class;
-};
-
-G_DEFINE_TYPE (ClutterTransformNode, clutter_transform_node, CLUTTER_TYPE_PAINT_NODE)
-
-static gboolean
-clutter_transform_node_pre_draw (ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- ClutterTransformNode *transform_node = (ClutterTransformNode *) node;
- CoglFramebuffer *fb =
- clutter_paint_context_get_framebuffer (paint_context);
-
- cogl_framebuffer_push_matrix (fb);
- cogl_framebuffer_transform (fb, &transform_node->transform);
-
- return TRUE;
-}
-
-static void
-clutter_transform_node_post_draw (ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- CoglFramebuffer *fb =
- clutter_paint_context_get_framebuffer (paint_context);
-
- cogl_framebuffer_pop_matrix (fb);
-}
-
-static void
-clutter_transform_node_class_init (ClutterTransformNodeClass *klass)
-{
- ClutterPaintNodeClass *node_class;
-
- node_class = CLUTTER_PAINT_NODE_CLASS (klass);
- node_class->pre_draw = clutter_transform_node_pre_draw;
- node_class->post_draw = clutter_transform_node_post_draw;
-}
-
-static void
-clutter_transform_node_init (ClutterTransformNode *self)
-{
- graphene_matrix_init_identity (&self->transform);
-}
-
-/*
- * clutter_transform_node_new:
- * @transform: (nullable): the transform matrix to apply
- *
- * Return value: (transfer full): the newly created #ClutterTransformNode.
- * Use clutter_paint_node_unref() when done.
- */
-ClutterPaintNode *
-clutter_transform_node_new (const graphene_matrix_t *transform)
-{
- ClutterTransformNode *res;
-
- res = _clutter_paint_node_create (CLUTTER_TYPE_TRANSFORM_NODE);
- if (transform)
- graphene_matrix_init_from_matrix (&res->transform, transform);
-
- return (ClutterPaintNode *) res;
-}
-
-/*
- * Dummy node, private
- *
- * an empty node, used temporarily until we can drop API compatibility,
- * and we'll be able to build a full render tree for each frame.
- */
-
-#define clutter_dummy_node_get_type _clutter_dummy_node_get_type
-
-typedef struct _ClutterDummyNode ClutterDummyNode;
-typedef struct _ClutterPaintNodeClass ClutterDummyNodeClass;
-
-struct _ClutterDummyNode
-{
- ClutterPaintNode parent_instance;
-
- ClutterActor *actor;
- CoglFramebuffer *framebuffer;
-};
-
-G_DEFINE_TYPE (ClutterDummyNode, clutter_dummy_node, CLUTTER_TYPE_PAINT_NODE)
-
-static gboolean
-clutter_dummy_node_pre_draw (ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- return TRUE;
-}
-
-static JsonNode *
-clutter_dummy_node_serialize (ClutterPaintNode *node)
-{
- ClutterDummyNode *dnode = (ClutterDummyNode *) node;
- JsonBuilder *builder;
- JsonNode *res;
-
- if (dnode->actor == NULL)
- return json_node_new (JSON_NODE_NULL);
-
- builder = json_builder_new ();
- json_builder_begin_object (builder);
-
- json_builder_set_member_name (builder, "actor");
- json_builder_add_string_value (builder, _clutter_actor_get_debug_name (dnode->actor));
-
- json_builder_end_object (builder);
-
- res = json_builder_get_root (builder);
- g_object_unref (builder);
-
- return res;
-}
-
-static CoglFramebuffer *
-clutter_dummy_node_get_framebuffer (ClutterPaintNode *node)
-{
- ClutterDummyNode *dnode = (ClutterDummyNode *) node;
-
- return dnode->framebuffer;
-}
-
-static void
-clutter_dummy_node_finalize (ClutterPaintNode *node)
-{
- ClutterDummyNode *dnode = (ClutterDummyNode *) node;
-
- g_clear_object (&dnode->framebuffer);
-
- CLUTTER_PAINT_NODE_CLASS (clutter_dummy_node_parent_class)->finalize (node);
-}
-
-static void
-clutter_dummy_node_class_init (ClutterDummyNodeClass *klass)
-{
- ClutterPaintNodeClass *node_class = CLUTTER_PAINT_NODE_CLASS (klass);
-
- node_class->pre_draw = clutter_dummy_node_pre_draw;
- node_class->serialize = clutter_dummy_node_serialize;
- node_class->get_framebuffer = clutter_dummy_node_get_framebuffer;
- node_class->finalize = clutter_dummy_node_finalize;
-}
-
-static void
-clutter_dummy_node_init (ClutterDummyNode *self)
-{
-}
-
-ClutterPaintNode *
-_clutter_dummy_node_new (ClutterActor *actor,
- CoglFramebuffer *framebuffer)
-{
- ClutterPaintNode *res;
- ClutterDummyNode *dnode;
-
- res = _clutter_paint_node_create (_clutter_dummy_node_get_type ());
-
- dnode = (ClutterDummyNode *) res;
- dnode->actor = actor;
- dnode->framebuffer = g_object_ref (framebuffer);
-
- return res;
-}
-
-/*
- * Pipeline node
- */
-
-struct _ClutterPipelineNode
-{
- ClutterPaintNode parent_instance;
-
- CoglPipeline *pipeline;
-};
-
-/**
- * ClutterPipelineNodeClass:
- *
- * The `ClutterPipelineNodeClass` structure is an opaque
- * type whose members cannot be directly accessed.
- *
- * Since: 1.10
- */
-struct _ClutterPipelineNodeClass
-{
- ClutterPaintNodeClass parent_class;
-};
-
-G_DEFINE_TYPE (ClutterPipelineNode, clutter_pipeline_node, CLUTTER_TYPE_PAINT_NODE)
-
-static void
-clutter_pipeline_node_finalize (ClutterPaintNode *node)
-{
- ClutterPipelineNode *pnode = CLUTTER_PIPELINE_NODE (node);
-
- if (pnode->pipeline != NULL)
- cogl_object_unref (pnode->pipeline);
-
- CLUTTER_PAINT_NODE_CLASS (clutter_pipeline_node_parent_class)->finalize (node);
-}
-
-static gboolean
-clutter_pipeline_node_pre_draw (ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- ClutterPipelineNode *pnode = CLUTTER_PIPELINE_NODE (node);
-
- if (node->operations != NULL &&
- pnode->pipeline != NULL)
- return TRUE;
-
- return FALSE;
-}
-
-static CoglFramebuffer *
-get_target_framebuffer (ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- CoglFramebuffer *framebuffer;
-
- framebuffer = clutter_paint_node_get_framebuffer (node);
- if (framebuffer)
- return framebuffer;
-
- return clutter_paint_context_get_framebuffer (paint_context);
-}
-
-static void
-clutter_pipeline_node_draw (ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- ClutterPipelineNode *pnode = CLUTTER_PIPELINE_NODE (node);
- CoglFramebuffer *fb;
- guint i;
-
- if (pnode->pipeline == NULL)
- return;
-
- if (node->operations == NULL)
- return;
-
- fb = clutter_paint_context_get_framebuffer (paint_context);
-
- for (i = 0; i < node->operations->len; i++)
- {
- const ClutterPaintOperation *op;
-
- op = &g_array_index (node->operations, ClutterPaintOperation, i);
-
- switch (op->opcode)
- {
- case PAINT_OP_INVALID:
- break;
-
- case PAINT_OP_TEX_RECT:
- cogl_framebuffer_draw_textured_rectangle (fb,
- pnode->pipeline,
- op->op.texrect[0],
- op->op.texrect[1],
- op->op.texrect[2],
- op->op.texrect[3],
- op->op.texrect[4],
- op->op.texrect[5],
- op->op.texrect[6],
- op->op.texrect[7]);
- break;
-
- case PAINT_OP_TEX_RECTS:
- cogl_framebuffer_draw_textured_rectangles (fb,
- pnode->pipeline,
- (float *) op->coords->data,
- op->coords->len / 8);
- break;
-
- case PAINT_OP_MULTITEX_RECT:
- cogl_framebuffer_draw_multitextured_rectangle (fb,
- pnode->pipeline,
- op->op.texrect[0],
- op->op.texrect[1],
- op->op.texrect[2],
- op->op.texrect[3],
- (float *) op->coords->data,
- op->coords->len);
- break;
-
- case PAINT_OP_PRIMITIVE:
- cogl_framebuffer_draw_primitive (fb,
- pnode->pipeline,
- op->op.primitive);
- break;
- }
- }
-}
-
-static void
-clutter_pipeline_node_post_draw (ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
-}
-
-static JsonNode *
-clutter_pipeline_node_serialize (ClutterPaintNode *node)
-{
- ClutterPipelineNode *pnode = CLUTTER_PIPELINE_NODE (node);
- JsonBuilder *builder;
- CoglColor color;
- JsonNode *res;
-
- if (pnode->pipeline == NULL)
- return json_node_new (JSON_NODE_NULL);
-
- builder = json_builder_new ();
- json_builder_begin_object (builder);
-
- cogl_pipeline_get_color (pnode->pipeline, &color);
- json_builder_set_member_name (builder, "color");
- json_builder_begin_array (builder);
- json_builder_add_double_value (builder, cogl_color_get_red (&color));
- json_builder_add_double_value (builder, cogl_color_get_green (&color));
- json_builder_add_double_value (builder, cogl_color_get_blue (&color));
- json_builder_add_double_value (builder, cogl_color_get_alpha (&color));
- json_builder_end_array (builder);
-
-#if 0
- json_builder_set_member_name (builder, "layers");
- json_builder_begin_array (builder);
- cogl_pipeline_foreach_layer (pnode->pipeline,
- clutter_pipeline_node_serialize_layer,
- builder);
- json_builder_end_array (builder);
-#endif
-
- json_builder_end_object (builder);
-
- res = json_builder_get_root (builder);
- g_object_unref (builder);
-
- return res;
-}
-
-static void
-clutter_pipeline_node_class_init (ClutterPipelineNodeClass *klass)
-{
- ClutterPaintNodeClass *node_class;
-
- node_class = CLUTTER_PAINT_NODE_CLASS (klass);
- node_class->pre_draw = clutter_pipeline_node_pre_draw;
- node_class->draw = clutter_pipeline_node_draw;
- node_class->post_draw = clutter_pipeline_node_post_draw;
- node_class->finalize = clutter_pipeline_node_finalize;
- node_class->serialize = clutter_pipeline_node_serialize;
-}
-
-static void
-clutter_pipeline_node_init (ClutterPipelineNode *self)
-{
-}
-
-/**
- * clutter_pipeline_node_new:
- * @pipeline: (allow-none): a Cogl pipeline state object, or %NULL
- *
- * Creates a new #ClutterPaintNode that will use the @pipeline to
- * paint its contents.
- *
- * This function will acquire a reference on the passed @pipeline,
- * so it is safe to call cogl_object_unref() when it returns.
- *
- * Return value: (transfer full): the newly created #ClutterPaintNode.
- * Use clutter_paint_node_unref() when done.
- *
- * Since: 1.10
- */
-ClutterPaintNode *
-clutter_pipeline_node_new (CoglPipeline *pipeline)
-{
- ClutterPipelineNode *res;
-
- g_return_val_if_fail (pipeline == NULL || cogl_is_pipeline (pipeline), NULL);
-
- res = _clutter_paint_node_create (CLUTTER_TYPE_PIPELINE_NODE);
-
- if (pipeline != NULL)
- res->pipeline = cogl_object_ref (pipeline);
-
- return (ClutterPaintNode *) res;
-}
-
-/*
- * Color node
- */
-
-struct _ClutterColorNode
-{
- ClutterPipelineNode parent_instance;
-};
-
-/**
- * ClutterColorNodeClass:
- *
- * The `ClutterColorNodeClass` structure is an
- * opaque type whose members cannot be directly accessed.
- *
- * Since: 1.10
- */
-struct _ClutterColorNodeClass
-{
- ClutterPipelineNodeClass parent_class;
-};
-
-G_DEFINE_TYPE (ClutterColorNode, clutter_color_node, CLUTTER_TYPE_PIPELINE_NODE)
-
-static void
-clutter_color_node_class_init (ClutterColorNodeClass *klass)
-{
-
-}
-
-static void
-clutter_color_node_init (ClutterColorNode *cnode)
-{
- ClutterPipelineNode *pnode = CLUTTER_PIPELINE_NODE (cnode);
-
- g_assert (default_color_pipeline != NULL);
- pnode->pipeline = cogl_pipeline_copy (default_color_pipeline);
-}
-
-/**
- * clutter_color_node_new:
- * @color: (allow-none): the color to paint, or %NULL
- *
- * Creates a new #ClutterPaintNode that will paint a solid color
- * fill using @color.
- *
- * Return value: (transfer full): the newly created #ClutterPaintNode. Use
- * clutter_paint_node_unref() when done
- *
- * Since: 1.10
- */
-ClutterPaintNode *
-clutter_color_node_new (const ClutterColor *color)
-{
- ClutterPipelineNode *cnode;
-
- cnode = _clutter_paint_node_create (CLUTTER_TYPE_COLOR_NODE);
-
- if (color != NULL)
- {
- CoglColor cogl_color;
-
- cogl_color_init_from_4ub (&cogl_color,
- color->red,
- color->green,
- color->blue,
- color->alpha);
- cogl_color_premultiply (&cogl_color);
-
- cogl_pipeline_set_color (cnode->pipeline, &cogl_color);
- }
-
- return (ClutterPaintNode *) cnode;
-}
-
-/*
- * Texture node
- */
-
-struct _ClutterTextureNode
-{
- ClutterPipelineNode parent_instance;
-};
-
-/**
- * ClutterTextureNodeClass:
- *
- * The `ClutterTextureNodeClass` structure is an
- * opaque type whose members cannot be directly accessed.
- *
- * Since: 1.10
- */
-struct _ClutterTextureNodeClass
-{
- ClutterPipelineNodeClass parent_class;
-};
-
-G_DEFINE_TYPE (ClutterTextureNode, clutter_texture_node, CLUTTER_TYPE_PIPELINE_NODE)
-
-static void
-clutter_texture_node_class_init (ClutterTextureNodeClass *klass)
-{
-}
-
-static void
-clutter_texture_node_init (ClutterTextureNode *self)
-{
- ClutterPipelineNode *pnode = CLUTTER_PIPELINE_NODE (self);
-
- g_assert (default_texture_pipeline != NULL);
- pnode->pipeline = cogl_pipeline_copy (default_texture_pipeline);
-}
-
-static CoglPipelineFilter
-clutter_scaling_filter_to_cogl_pipeline_filter (ClutterScalingFilter filter)
-{
- switch (filter)
- {
- case CLUTTER_SCALING_FILTER_NEAREST:
- return COGL_PIPELINE_FILTER_NEAREST;
-
- case CLUTTER_SCALING_FILTER_LINEAR:
- return COGL_PIPELINE_FILTER_LINEAR;
-
- case CLUTTER_SCALING_FILTER_TRILINEAR:
- return COGL_PIPELINE_FILTER_LINEAR_MIPMAP_LINEAR;
- }
-
- return COGL_PIPELINE_FILTER_LINEAR;
-}
-
-/**
- * clutter_texture_node_new:
- * @texture: a #CoglTexture
- * @color: (allow-none): a #ClutterColor used for blending, or %NULL
- * @min_filter: the minification filter for the texture
- * @mag_filter: the magnification filter for the texture
- *
- * Creates a new #ClutterPaintNode that will paint the passed @texture.
- *
- * This function will take a reference on @texture, so it is safe to
- * call cogl_object_unref() on @texture when it returns.
- *
- * The @color must not be pre-multiplied with its #ClutterColor.alpha
- * channel value; if @color is %NULL, a fully opaque white color will
- * be used for blending.
- *
- * Return value: (transfer full): the newly created #ClutterPaintNode.
- * Use clutter_paint_node_unref() when done
- *
- * Since: 1.10
- */
-ClutterPaintNode *
-clutter_texture_node_new (CoglTexture *texture,
- const ClutterColor *color,
- ClutterScalingFilter min_filter,
- ClutterScalingFilter mag_filter)
-{
- ClutterPipelineNode *tnode;
- CoglColor cogl_color;
- CoglPipelineFilter min_f, mag_f;
-
- g_return_val_if_fail (cogl_is_texture (texture), NULL);
-
- tnode = _clutter_paint_node_create (CLUTTER_TYPE_TEXTURE_NODE);
-
- cogl_pipeline_set_layer_texture (tnode->pipeline, 0, texture);
-
- min_f = clutter_scaling_filter_to_cogl_pipeline_filter (min_filter);
- mag_f = clutter_scaling_filter_to_cogl_pipeline_filter (mag_filter);
- cogl_pipeline_set_layer_filters (tnode->pipeline, 0, min_f, mag_f);
-
- if (color != NULL)
- {
- cogl_color_init_from_4ub (&cogl_color,
- color->red,
- color->green,
- color->blue,
- color->alpha);
- cogl_color_premultiply (&cogl_color);
- }
- else
- cogl_color_init_from_4ub (&cogl_color, 255, 255, 255, 255);
-
- cogl_pipeline_set_color (tnode->pipeline, &cogl_color);
-
- return (ClutterPaintNode *) tnode;
-}
-
-/*
- * Text node
- */
-
-struct _ClutterTextNode
-{
- ClutterPaintNode parent_instance;
-
- PangoLayout *layout;
- CoglColor color;
-};
-
-/**
- * ClutterTextNodeClass:
- *
- * The `ClutterTextNodeClass` structure is an opaque
- * type whose contents cannot be directly accessed.
- *
- * Since: 1.10
- */
-struct _ClutterTextNodeClass
-{
- ClutterPaintNodeClass parent_class;
-};
-
-G_DEFINE_TYPE (ClutterTextNode, clutter_text_node, CLUTTER_TYPE_PAINT_NODE)
-
-static void
-clutter_text_node_finalize (ClutterPaintNode *node)
-{
- ClutterTextNode *tnode = CLUTTER_TEXT_NODE (node);
-
- if (tnode->layout != NULL)
- g_object_unref (tnode->layout);
-
- CLUTTER_PAINT_NODE_CLASS (clutter_text_node_parent_class)->finalize (node);
-}
-
-static gboolean
-clutter_text_node_pre_draw (ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- ClutterTextNode *tnode = CLUTTER_TEXT_NODE (node);
-
- return tnode->layout != NULL;
-}
-
-static void
-clutter_text_node_draw (ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- ClutterTextNode *tnode = CLUTTER_TEXT_NODE (node);
- PangoRectangle extents;
- CoglFramebuffer *fb;
- guint i;
-
- if (node->operations == NULL)
- return;
-
- fb = get_target_framebuffer (node, paint_context);
-
- pango_layout_get_pixel_extents (tnode->layout, NULL, &extents);
-
- for (i = 0; i < node->operations->len; i++)
- {
- const ClutterPaintOperation *op;
- float op_width, op_height;
- gboolean clipped = FALSE;
-
- op = &g_array_index (node->operations, ClutterPaintOperation, i);
-
- switch (op->opcode)
- {
- case PAINT_OP_TEX_RECT:
- op_width = op->op.texrect[2] - op->op.texrect[0];
- op_height = op->op.texrect[3] - op->op.texrect[1];
-
- /* if the primitive size was smaller than the layout,
- * we clip the layout when drawin, to avoid spilling
- * it out
- */
- if (extents.width > op_width ||
- extents.height > op_height)
- {
- cogl_framebuffer_push_rectangle_clip (fb,
- op->op.texrect[0],
- op->op.texrect[1],
- op->op.texrect[2],
- op->op.texrect[3]);
- clipped = TRUE;
- }
-
- cogl_pango_show_layout (fb,
- tnode->layout,
- op->op.texrect[0],
- op->op.texrect[1],
- &tnode->color);
-
- if (clipped)
- cogl_framebuffer_pop_clip (fb);
- break;
-
- case PAINT_OP_TEX_RECTS:
- case PAINT_OP_MULTITEX_RECT:
- case PAINT_OP_PRIMITIVE:
- case PAINT_OP_INVALID:
- break;
- }
- }
-}
-
-static JsonNode *
-clutter_text_node_serialize (ClutterPaintNode *node)
-{
- ClutterTextNode *tnode = CLUTTER_TEXT_NODE (node);
- JsonBuilder *builder;
- JsonNode *res;
-
- builder = json_builder_new ();
-
- json_builder_begin_object (builder);
-
- json_builder_set_member_name (builder, "layout");
-
- if (pango_layout_get_character_count (tnode->layout) > 12)
- {
- const char *text = pango_layout_get_text (tnode->layout);
- char *str;
-
- str = g_strndup (text, 12);
- json_builder_add_string_value (builder, str);
- g_free (str);
- }
- else
- json_builder_add_string_value (builder, pango_layout_get_text (tnode->layout));
-
- json_builder_set_member_name (builder, "color");
- json_builder_begin_array (builder);
- json_builder_add_double_value (builder, cogl_color_get_red (&tnode->color));
- json_builder_add_double_value (builder, cogl_color_get_green (&tnode->color));
- json_builder_add_double_value (builder, cogl_color_get_blue (&tnode->color));
- json_builder_add_double_value (builder, cogl_color_get_alpha (&tnode->color));
- json_builder_end_array (builder);
-
- json_builder_end_object (builder);
-
- res = json_builder_get_root (builder);
- g_object_unref (builder);
-
- return res;
-}
-
-static void
-clutter_text_node_class_init (ClutterTextNodeClass *klass)
-{
- ClutterPaintNodeClass *node_class = CLUTTER_PAINT_NODE_CLASS (klass);
-
- node_class->pre_draw = clutter_text_node_pre_draw;
- node_class->draw = clutter_text_node_draw;
- node_class->finalize = clutter_text_node_finalize;
- node_class->serialize = clutter_text_node_serialize;
-}
-
-static void
-clutter_text_node_init (ClutterTextNode *self)
-{
- cogl_color_init_from_4f (&self->color, 0.0, 0.0, 0.0, 1.0);
-}
-
-/**
- * clutter_text_node_new:
- * @layout: (allow-none): a #PangoLayout, or %NULL
- * @color: (allow-none): the color used to paint the layout,
- * or %NULL
- *
- * Creates a new #ClutterPaintNode that will paint a #PangoLayout
- * with the given color.
- *
- * This function takes a reference on the passed @layout, so it
- * is safe to call g_object_unref() after it returns.
- *
- * Return value: (transfer full): the newly created #ClutterPaintNode.
- * Use clutter_paint_node_unref() when done
- *
- * Since: 1.10
- */
-ClutterPaintNode *
-clutter_text_node_new (PangoLayout *layout,
- const ClutterColor *color)
-{
- ClutterTextNode *res;
-
- g_return_val_if_fail (layout == NULL || PANGO_IS_LAYOUT (layout), NULL);
-
- res = _clutter_paint_node_create (CLUTTER_TYPE_TEXT_NODE);
-
- if (layout != NULL)
- res->layout = g_object_ref (layout);
-
- if (color != NULL)
- {
- cogl_color_init_from_4ub (&res->color,
- color->red,
- color->green,
- color->blue,
- color->alpha);
- }
-
- return (ClutterPaintNode *) res;
-}
-
-/*
- * Clip node
- */
-struct _ClutterClipNode
-{
- ClutterPaintNode parent_instance;
-};
-
-/**
- * ClutterClipNodeClass:
- *
- * The `ClutterClipNodeClass` structure is an opaque
- * type whose members cannot be directly accessed.
- *
- * Since: 1.10
- */
-struct _ClutterClipNodeClass
-{
- ClutterPaintNodeClass parent_class;
-};
-
-G_DEFINE_TYPE (ClutterClipNode, clutter_clip_node, CLUTTER_TYPE_PAINT_NODE)
-
-static gboolean
-clutter_clip_node_pre_draw (ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- gboolean retval = FALSE;
- CoglFramebuffer *fb;
- guint i;
-
- if (node->operations == NULL)
- return FALSE;
-
- fb = get_target_framebuffer (node, paint_context);
-
- for (i = 0; i < node->operations->len; i++)
- {
- const ClutterPaintOperation *op;
-
- op = &g_array_index (node->operations, ClutterPaintOperation, i);
-
- switch (op->opcode)
- {
- case PAINT_OP_TEX_RECT:
- cogl_framebuffer_push_rectangle_clip (fb,
- op->op.texrect[0],
- op->op.texrect[1],
- op->op.texrect[2],
- op->op.texrect[3]);
- retval = TRUE;
- break;
-
- case PAINT_OP_TEX_RECTS:
- case PAINT_OP_MULTITEX_RECT:
- case PAINT_OP_PRIMITIVE:
- case PAINT_OP_INVALID:
- break;
- }
- }
-
- return retval;
-}
-
-static void
-clutter_clip_node_post_draw (ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- CoglFramebuffer *fb;
- guint i;
-
- if (node->operations == NULL)
- return;
-
- fb = get_target_framebuffer (node, paint_context);
-
- for (i = 0; i < node->operations->len; i++)
- {
- const ClutterPaintOperation *op;
-
- op = &g_array_index (node->operations, ClutterPaintOperation, i);
-
- switch (op->opcode)
- {
- case PAINT_OP_TEX_RECT:
- cogl_framebuffer_pop_clip (fb);
- break;
-
- case PAINT_OP_TEX_RECTS:
- case PAINT_OP_MULTITEX_RECT:
- case PAINT_OP_PRIMITIVE:
- case PAINT_OP_INVALID:
- break;
- }
- }
-}
-
-static void
-clutter_clip_node_class_init (ClutterClipNodeClass *klass)
-{
- ClutterPaintNodeClass *node_class;
-
- node_class = CLUTTER_PAINT_NODE_CLASS (klass);
- node_class->pre_draw = clutter_clip_node_pre_draw;
- node_class->post_draw = clutter_clip_node_post_draw;
-}
-
-static void
-clutter_clip_node_init (ClutterClipNode *self)
-{
-}
-
-/**
- * clutter_clip_node_new:
- *
- * Creates a new #ClutterPaintNode that will clip its child
- * nodes to the 2D regions added to it.
- *
- * Return value: (transfer full): the newly created #ClutterPaintNode.
- * Use clutter_paint_node_unref() when done.
- *
- * Since: 1.10
- */
-ClutterPaintNode *
-clutter_clip_node_new (void)
-{
- return _clutter_paint_node_create (CLUTTER_TYPE_CLIP_NODE);
-}
-
-/*
- * ClutterActorNode
- */
-
-struct _ClutterActorNode
-{
- ClutterPaintNode parent_instance;
-
- ClutterActor *actor;
- int opacity_override;
- int saved_opacity_override;
-};
-
-struct _ClutterActorNodeClass
-{
- ClutterPaintNodeClass parent_class;
-};
-
-G_DEFINE_TYPE (ClutterActorNode, clutter_actor_node, CLUTTER_TYPE_PAINT_NODE)
-
-static gboolean
-clutter_actor_node_pre_draw (ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
-
- if (actor_node->opacity_override != -1)
- {
- actor_node->saved_opacity_override =
- clutter_actor_get_opacity_override (actor_node->actor);
- clutter_actor_set_opacity_override (actor_node->actor,
- actor_node->opacity_override);
- }
-
- CLUTTER_SET_PRIVATE_FLAGS (actor_node->actor, CLUTTER_IN_PAINT);
-
- return TRUE;
-}
-
-static void
-clutter_actor_node_draw (ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
-
- clutter_actor_continue_paint (actor_node->actor, paint_context);
-}
-
-static void
-clutter_actor_node_post_draw (ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
-
- CLUTTER_UNSET_PRIVATE_FLAGS (actor_node->actor, CLUTTER_IN_PAINT);
-
- if (actor_node->opacity_override != -1)
- {
- clutter_actor_set_opacity_override (actor_node->actor,
- actor_node->saved_opacity_override);
- }
-}
-
-static JsonNode *
-clutter_actor_node_serialize (ClutterPaintNode *node)
-{
- ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
- g_autoptr (JsonBuilder) builder = NULL;
- const char *debug_name;
-
- debug_name = _clutter_actor_get_debug_name (actor_node->actor);
-
- builder = json_builder_new ();
-
- json_builder_begin_object (builder);
- json_builder_set_member_name (builder, "actor");
- json_builder_add_string_value (builder, debug_name);
- json_builder_end_object (builder);
-
- return json_builder_get_root (builder);
-}
-
-static void
-clutter_actor_node_class_init (ClutterActorNodeClass *klass)
-{
- ClutterPaintNodeClass *node_class;
-
- node_class = CLUTTER_PAINT_NODE_CLASS (klass);
- node_class->pre_draw = clutter_actor_node_pre_draw;
- node_class->draw = clutter_actor_node_draw;
- node_class->post_draw = clutter_actor_node_post_draw;
- node_class->serialize = clutter_actor_node_serialize;
-}
-
-static void
-clutter_actor_node_init (ClutterActorNode *self)
-{
-}
-
-/*
- * clutter_actor_node_new:
- * @actor: the actor to paint
- * @opacity: opacity to draw the actor with, or -1 to use the actor's opacity
- *
- * Creates a new #ClutterActorNode.
- *
- * The actor is painted together with any effects
- * applied to it. Children of this node will draw
- * over the actor contents.
- *
- * Return value: (transfer full): the newly created #ClutterActorNode.
- * Use clutter_paint_node_unref() when done.
- */
-ClutterPaintNode *
-clutter_actor_node_new (ClutterActor *actor,
- int opacity)
-{
- ClutterActorNode *res;
-
- g_assert (actor != NULL);
-
- res = _clutter_paint_node_create (CLUTTER_TYPE_ACTOR_NODE);
- res->actor = actor;
- res->opacity_override = CLAMP (opacity, -1, 255);
-
- return (ClutterPaintNode *) res;
-}
-
-
-/*
- * ClutterEffectNode
- */
-
-struct _ClutterEffectNode
-{
- ClutterPaintNode parent_instance;
-
- ClutterEffect *effect;
-};
-
-struct _ClutterEffectNodeClass
-{
- ClutterPaintNodeClass parent_class;
-};
-
-G_DEFINE_TYPE (ClutterEffectNode, clutter_effect_node, CLUTTER_TYPE_PAINT_NODE)
-
-static JsonNode *
-clutter_effect_node_serialize (ClutterPaintNode *node)
-{
- ClutterEffectNode *effect_node = CLUTTER_EFFECT_NODE (node);
- ClutterActorMeta *effect_meta = CLUTTER_ACTOR_META (effect_node->effect);
- g_autoptr (JsonBuilder) builder = NULL;
- g_autoptr (GString) string = NULL;
- const char *meta_name;
-
- meta_name = clutter_actor_meta_get_name (effect_meta);
-
- string = g_string_new (NULL);
- g_string_append (string, G_OBJECT_TYPE_NAME (effect_node->effect));
- g_string_append (string, " (");
- if (meta_name)
- g_string_append_printf (string, "\"%s\"", meta_name);
- else
- g_string_append (string, "unnamed");
- g_string_append (string, ")");
-
- builder = json_builder_new ();
-
- json_builder_begin_object (builder);
- json_builder_set_member_name (builder, "effect");
- json_builder_add_string_value (builder, string->str);
- json_builder_end_object (builder);
-
- return json_builder_get_root (builder);
-}
-
-static void
-clutter_effect_node_class_init (ClutterEffectNodeClass *klass)
-{
- ClutterPaintNodeClass *node_class;
-
- node_class = CLUTTER_PAINT_NODE_CLASS (klass);
- node_class->serialize = clutter_effect_node_serialize;
-}
-
-static void
-clutter_effect_node_init (ClutterEffectNode *self)
-{
-}
-
-/**
- * clutter_effect_node_new:
- * @effect: the actor to paint
- *
- * Creates a new #ClutterEffectNode.
- *
- * Return value: (transfer full): the newly created #ClutterEffectNode.
- * Use clutter_paint_node_unref() when done.
- */
-ClutterPaintNode *
-clutter_effect_node_new (ClutterEffect *effect)
-{
- ClutterEffectNode *res;
-
- g_assert (CLUTTER_IS_EFFECT (effect));
-
- res = _clutter_paint_node_create (CLUTTER_TYPE_EFFECT_NODE);
- res->effect = effect;
-
- return (ClutterPaintNode *) res;
-}
-
-/*
- * ClutterLayerNode
- */
-
-struct _ClutterLayerNode
-{
- ClutterPaintNode parent_instance;
-
- cairo_rectangle_t viewport;
-
- graphene_matrix_t projection;
-
- float fbo_width;
- float fbo_height;
-
- CoglPipeline *pipeline;
- CoglFramebuffer *offscreen;
-
- guint8 opacity;
-
- gboolean needs_fbo_setup : 1;
-};
-
-struct _ClutterLayerNodeClass
-{
- ClutterPaintNodeClass parent_class;
-};
-
-G_DEFINE_TYPE (ClutterLayerNode, clutter_layer_node, CLUTTER_TYPE_PAINT_NODE)
-
-static gboolean
-clutter_layer_node_pre_draw (ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- ClutterLayerNode *lnode = (ClutterLayerNode *) node;
- CoglFramebuffer *framebuffer;
- graphene_matrix_t matrix;
-
- /* if we were unable to create an offscreen buffer for this node, then
- * we simply ignore it
- */
- if (lnode->offscreen == NULL)
- return FALSE;
-
- if (lnode->needs_fbo_setup)
- {
- /* copy the same modelview from the current framebuffer to the one we
- * are going to use
- */
- framebuffer = clutter_paint_context_get_framebuffer (paint_context);
- cogl_framebuffer_get_modelview_matrix (framebuffer, &matrix);
- cogl_framebuffer_set_modelview_matrix (lnode->offscreen, &matrix);
-
- cogl_framebuffer_set_viewport (lnode->offscreen,
- lnode->viewport.x,
- lnode->viewport.y,
- lnode->viewport.width,
- lnode->viewport.height);
-
- cogl_framebuffer_set_projection_matrix (lnode->offscreen,
- &lnode->projection);
- }
-
- clutter_paint_context_push_framebuffer (paint_context, lnode->offscreen);
-
- /* clear out the target framebuffer */
- cogl_framebuffer_clear4f (lnode->offscreen,
- COGL_BUFFER_BIT_COLOR | COGL_BUFFER_BIT_DEPTH,
- 0.f, 0.f, 0.f, 0.f);
-
- cogl_framebuffer_push_matrix (lnode->offscreen);
-
- /* every draw operation after this point will happen an offscreen
- * framebuffer
- */
-
- return TRUE;
-}
-
-static void
-clutter_layer_node_post_draw (ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- ClutterLayerNode *lnode = CLUTTER_LAYER_NODE (node);
- CoglFramebuffer *fb;
- guint i;
-
- /* switch to the previous framebuffer */
- cogl_framebuffer_pop_matrix (lnode->offscreen);
- clutter_paint_context_pop_framebuffer (paint_context);
-
- if (!node->operations)
- return;
-
- fb = clutter_paint_context_get_framebuffer (paint_context);
-
- for (i = 0; i < node->operations->len; i++)
- {
- const ClutterPaintOperation *op;
-
- op = &g_array_index (node->operations, ClutterPaintOperation, i);
- switch (op->opcode)
- {
- case PAINT_OP_INVALID:
- break;
-
- case PAINT_OP_TEX_RECT:
- /* now we need to paint the texture */
- cogl_framebuffer_draw_textured_rectangle (fb,
- lnode->pipeline,
- op->op.texrect[0],
- op->op.texrect[1],
- op->op.texrect[2],
- op->op.texrect[3],
- op->op.texrect[4],
- op->op.texrect[5],
- op->op.texrect[6],
- op->op.texrect[7]);
- break;
-
- case PAINT_OP_TEX_RECTS:
- cogl_framebuffer_draw_textured_rectangles (fb,
- lnode->pipeline,
- (float *) op->coords->data,
- op->coords->len / 8);
- break;
-
- case PAINT_OP_MULTITEX_RECT:
- cogl_framebuffer_draw_multitextured_rectangle (fb,
- lnode->pipeline,
- op->op.texrect[0],
- op->op.texrect[1],
- op->op.texrect[2],
- op->op.texrect[3],
- (float *) op->coords->data,
- op->coords->len);
- break;
-
- case PAINT_OP_PRIMITIVE:
- cogl_framebuffer_draw_primitive (fb,
- lnode->pipeline,
- op->op.primitive);
- break;
- }
- }
-}
-
-static void
-clutter_layer_node_finalize (ClutterPaintNode *node)
-{
- ClutterLayerNode *lnode = CLUTTER_LAYER_NODE (node);
-
- if (lnode->pipeline != NULL)
- cogl_object_unref (lnode->pipeline);
-
- g_clear_object (&lnode->offscreen);
-
- CLUTTER_PAINT_NODE_CLASS (clutter_layer_node_parent_class)->finalize (node);
-}
-
-static JsonNode *
-clutter_layer_node_serialize (ClutterPaintNode *node)
-{
- ClutterLayerNode *layer_node = CLUTTER_LAYER_NODE (node);
- g_autoptr (JsonBuilder) builder = NULL;
- g_autofree char *framebuffer_ptr = NULL;
-
- builder = json_builder_new ();
-
- framebuffer_ptr = g_strdup_printf ("%p", layer_node->offscreen);
-
- json_builder_begin_object (builder);
- json_builder_set_member_name (builder, "framebuffer");
- json_builder_add_string_value (builder, framebuffer_ptr);
- json_builder_end_object (builder);
-
- return json_builder_get_root (builder);
-}
-
-static void
-clutter_layer_node_class_init (ClutterLayerNodeClass *klass)
-{
- ClutterPaintNodeClass *node_class;
-
- node_class = CLUTTER_PAINT_NODE_CLASS (klass);
- node_class->pre_draw = clutter_layer_node_pre_draw;
- node_class->post_draw = clutter_layer_node_post_draw;
- node_class->finalize = clutter_layer_node_finalize;
- node_class->serialize = clutter_layer_node_serialize;
-}
-
-static void
-clutter_layer_node_init (ClutterLayerNode *self)
-{
- graphene_matrix_init_identity (&self->projection);
-}
-
-/*
- * clutter_layer_node_new:
- * @projection: the projection matrix to use to set up the layer
- * @viewport: (type cairo.Rectangle): the viewport to use to set up the layer
- * @width: the width of the layer
- * @height: the height of the layer
- * @opacity: the opacity to be used when drawing the layer
- *
- * Creates a new #ClutterLayerNode.
- *
- * All children of this node will be painted inside a separate
- * framebuffer; the framebuffer will then be painted using the
- * given @opacity.
- *
- * Return value: (transfer full): the newly created #ClutterLayerNode.
- * Use clutter_paint_node_unref() when done.
- *
- * Since: 1.10
- */
-ClutterPaintNode *
-clutter_layer_node_new (const graphene_matrix_t *projection,
- const cairo_rectangle_t *viewport,
- float width,
- float height,
- guint8 opacity)
-{
- ClutterLayerNode *res;
- CoglContext *context;
- CoglTexture2D *tex_2d;
- CoglTexture *texture;
- CoglColor color;
- CoglOffscreen *offscreen;
- g_autoptr (GError) error = NULL;
-
- res = _clutter_paint_node_create (CLUTTER_TYPE_LAYER_NODE);
-
- res->needs_fbo_setup = TRUE;
- res->projection = *projection;
- res->viewport = *viewport;
- res->fbo_width = width;
- res->fbo_height = height;
- res->opacity = opacity;
-
- /* the texture backing the FBO */
- context = clutter_backend_get_cogl_context (clutter_get_default_backend ());
-
- tex_2d = cogl_texture_2d_new_with_size (context,
- MAX (res->fbo_width, 1),
- MAX (res->fbo_height, 1));
- texture = COGL_TEXTURE (tex_2d);
- cogl_texture_set_premultiplied (texture, TRUE);
-
- offscreen = cogl_offscreen_new_with_texture (texture);
- if (!cogl_framebuffer_allocate (COGL_FRAMEBUFFER (offscreen), &error))
- {
- g_warning ("Unable to create an allocate paint node offscreen: %s",
- error->message);
- g_object_unref (offscreen);
- goto out;
- }
-
- res->offscreen = COGL_FRAMEBUFFER (offscreen);
-
- cogl_color_init_from_4ub (&color, opacity, opacity, opacity, opacity);
-
- /* the pipeline used to paint the texture; we use nearest
- * interpolation filters because the texture is always
- * going to be painted at a 1:1 texel:pixel ratio
- */
- res->pipeline = cogl_pipeline_copy (default_texture_pipeline);
- cogl_pipeline_set_layer_filters (res->pipeline, 0,
- COGL_PIPELINE_FILTER_NEAREST,
- COGL_PIPELINE_FILTER_NEAREST);
- cogl_pipeline_set_layer_texture (res->pipeline, 0, texture);
- cogl_pipeline_set_color (res->pipeline, &color);
-
-out:
- cogl_object_unref (texture);
-
- return (ClutterPaintNode *) res;
-}
-
-/**
- * clutter_layer_node_new_to_framebuffer:
- * @framebuffer: a #CoglFramebuffer
- * @pipeline: a #CoglPipeline
- *
- * Creates a new #ClutterLayerNode that will redirect drawing at
- * @framebuffer. It will then use @pipeline to paint the stored
- * operations.
- *
- * When using this constructor, the caller is reponsible for setting
- * up @framebuffer, including its modelview and projection matrices,
- * and the viewport, and the @pipeline as well.
- *
- * Return value: (transfer full): the newly created #ClutterLayerNode.
- * Use clutter_paint_node_unref() when done.
- */
-ClutterPaintNode *
-clutter_layer_node_new_to_framebuffer (CoglFramebuffer *framebuffer,
- CoglPipeline *pipeline)
-{
- ClutterLayerNode *res;
-
- g_return_val_if_fail (COGL_IS_FRAMEBUFFER (framebuffer), NULL);
- g_return_val_if_fail (cogl_is_pipeline (pipeline), NULL);
-
- res = _clutter_paint_node_create (CLUTTER_TYPE_LAYER_NODE);
-
- res->needs_fbo_setup = FALSE;
- res->fbo_width = cogl_framebuffer_get_width (framebuffer);
- res->fbo_height = cogl_framebuffer_get_height (framebuffer);
- res->offscreen = g_object_ref (framebuffer);
- res->pipeline = cogl_pipeline_copy (pipeline);
-
- return (ClutterPaintNode *) res;
-}
-
-/*
- * ClutterBlitNode
- */
-
-struct _ClutterBlitNode
-{
- ClutterPaintNode parent_instance;
-
- CoglFramebuffer *src;
-};
-
-G_DEFINE_TYPE (ClutterBlitNode, clutter_blit_node, CLUTTER_TYPE_PAINT_NODE)
-
-static gboolean
-clutter_blit_node_pre_draw (ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- return TRUE;
-}
-
-static void
-clutter_blit_node_draw (ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- ClutterBlitNode *blit_node = CLUTTER_BLIT_NODE (node);
- g_autoptr (GError) error = NULL;
- CoglFramebuffer *framebuffer;
- unsigned int i;
-
- if (node->operations == NULL)
- return;
-
- framebuffer = get_target_framebuffer (node, paint_context);
-
- for (i = 0; i < node->operations->len; i++)
- {
- const ClutterPaintOperation *op;
- float op_width, op_height;
-
- op = &g_array_index (node->operations, ClutterPaintOperation, i);
-
- switch (op->opcode)
- {
- case PAINT_OP_INVALID:
- break;
-
- case PAINT_OP_TEX_RECT:
- op_width = op->op.texrect[6] - op->op.texrect[4];
- op_height = op->op.texrect[7] - op->op.texrect[5];
-
- cogl_blit_framebuffer (blit_node->src,
- framebuffer,
- op->op.texrect[0],
- op->op.texrect[1],
- op->op.texrect[4],
- op->op.texrect[5],
- op_width,
- op_height,
- &error);
-
- if (error)
- {
- g_warning ("Error blitting framebuffers: %s", error->message);
- return;
- }
- break;
-
- case PAINT_OP_TEX_RECTS:
- case PAINT_OP_MULTITEX_RECT:
- case PAINT_OP_PRIMITIVE:
- break;
- }
- }
-}
-
-static void
-clutter_blit_node_finalize (ClutterPaintNode *node)
-{
- ClutterBlitNode *blit_node = CLUTTER_BLIT_NODE (node);
-
- g_clear_object (&blit_node->src);
-
- CLUTTER_PAINT_NODE_CLASS (clutter_blit_node_parent_class)->finalize (node);
-}
-
-static JsonNode *
-clutter_blit_node_serialize (ClutterPaintNode *node)
-{
- ClutterBlitNode *blit_node = CLUTTER_BLIT_NODE (node);
- g_autoptr (JsonBuilder) builder = NULL;
- g_autofree char *src_ptr = NULL;
-
- src_ptr = g_strdup_printf ("%p", blit_node->src);
-
- builder = json_builder_new ();
- json_builder_begin_object (builder);
- json_builder_set_member_name (builder, "source");
- json_builder_add_string_value (builder, src_ptr);
- json_builder_end_object (builder);
-
- return json_builder_get_root (builder);
-}
-
-static void
-clutter_blit_node_class_init (ClutterBlitNodeClass *klass)
-{
- ClutterPaintNodeClass *node_class;
-
- node_class = CLUTTER_PAINT_NODE_CLASS (klass);
- node_class->pre_draw = clutter_blit_node_pre_draw;
- node_class->draw = clutter_blit_node_draw;
- node_class->finalize = clutter_blit_node_finalize;
- node_class->serialize = clutter_blit_node_serialize;
-}
-
-static void
-clutter_blit_node_init (ClutterBlitNode *self)
-{
-}
-
-/**
- * clutter_blit_node_new:
- * @src: the source #CoglFramebuffer
- *
- * Creates a new #ClutterBlitNode that blits @src into the current
- * draw framebuffer.
- *
- * You must only add rectangles using clutter_blit_node_add_blit_rectangle().
- *
- * Return value: (transfer full): the newly created #ClutterBlitNode.
- * Use clutter_paint_node_unref() when done.
- */
-ClutterPaintNode *
-clutter_blit_node_new (CoglFramebuffer *src)
-{
- ClutterBlitNode *res;
-
- g_return_val_if_fail (COGL_IS_FRAMEBUFFER (src), NULL);
-
- res = _clutter_paint_node_create (CLUTTER_TYPE_BLIT_NODE);
- res->src = g_object_ref (src);
-
- return (ClutterPaintNode *) res;
-}
-
-/**
- * clutter_blit_node_add_blit_rectangle:
- * @blit_node: a #ClutterBlitNode
- * @src_x: Source x position
- * @src_y: Source y position
- * @dst_x: Destination x position
- * @dst_y: Destination y position
- * @width: Width of region to copy
- * @height: Height of region to copy
- *
- * Adds a new blit rectangle to the stack of rectangles. All the
- * constraints of cogl_blit_framebuffer() apply here.
- */
-void
-clutter_blit_node_add_blit_rectangle (ClutterBlitNode *blit_node,
- int src_x,
- int src_y,
- int dst_x,
- int dst_y,
- int width,
- int height)
-{
- g_return_if_fail (CLUTTER_IS_BLIT_NODE (blit_node));
-
- clutter_paint_node_add_texture_rectangle (CLUTTER_PAINT_NODE (blit_node),
- &(ClutterActorBox) {
- .x1 = src_x,
- .y1 = src_y,
- .x2 = src_x + width,
- .y2 = src_y + height,
- },
- dst_x,
- dst_y,
- dst_x + width,
- dst_y + height);
-}
-
-/*
- * ClutterBlurNode
- */
-
-struct _ClutterBlurNode
-{
- ClutterLayerNode parent_instance;
-
- ClutterBlur *blur;
- unsigned int sigma;
-};
-
-G_DEFINE_TYPE (ClutterBlurNode, clutter_blur_node, CLUTTER_TYPE_LAYER_NODE)
-
-static void
-clutter_blur_node_post_draw (ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- ClutterPaintNodeClass *parent_class =
- CLUTTER_PAINT_NODE_CLASS (clutter_blur_node_parent_class);
- ClutterBlurNode *blur_node = CLUTTER_BLUR_NODE (node);
-
- clutter_blur_apply (blur_node->blur);
-
- parent_class->post_draw (node, paint_context);
-}
-
-static void
-clutter_blur_node_finalize (ClutterPaintNode *node)
-{
- ClutterBlurNode *blur_node = CLUTTER_BLUR_NODE (node);
-
- g_clear_pointer (&blur_node->blur, clutter_blur_free);
-
- CLUTTER_PAINT_NODE_CLASS (clutter_blur_node_parent_class)->finalize (node);
-}
-
-static JsonNode *
-clutter_blur_node_serialize (ClutterPaintNode *node)
-{
- ClutterBlurNode *blur_node = CLUTTER_BLUR_NODE (node);
- g_autoptr (JsonBuilder) builder = NULL;
- g_autofree char *src_ptr = NULL;
-
- src_ptr = g_strdup_printf ("%d", blur_node->sigma);
-
- builder = json_builder_new ();
- json_builder_begin_object (builder);
- json_builder_set_member_name (builder, "sigma");
- json_builder_add_string_value (builder, src_ptr);
- json_builder_end_object (builder);
-
- return json_builder_get_root (builder);
-}
-
-static void
-clutter_blur_node_class_init (ClutterBlurNodeClass *klass)
-{
- ClutterPaintNodeClass *node_class;
-
- node_class = CLUTTER_PAINT_NODE_CLASS (klass);
- node_class->post_draw = clutter_blur_node_post_draw;
- node_class->finalize = clutter_blur_node_finalize;
- node_class->serialize = clutter_blur_node_serialize;
-}
-
-static void
-clutter_blur_node_init (ClutterBlurNode *blur_node)
-{
-}
-
-/**
- * clutter_blur_node_new:
- * @width width of the blur layer
- * @height: height of the blur layer
- * @sigma: sigma value of the blur
- *
- * Creates a new #ClutterBlurNode.
- *
- * Children of this node will be painted inside a separate framebuffer,
- * which will be blurred and painted on the current draw framebuffer.
- *
- * Return value: (transfer full): the newly created #ClutterBlurNode.
- * Use clutter_paint_node_unref() when done.
- */
-ClutterPaintNode *
-clutter_blur_node_new (unsigned int width,
- unsigned int height,
- float sigma)
-{
- g_autoptr (CoglOffscreen) offscreen = NULL;
- g_autoptr (GError) error = NULL;
- ClutterLayerNode *layer_node;
- ClutterBlurNode *blur_node;
- CoglTexture2D *tex_2d;
- CoglContext *context;
- CoglTexture *texture;
- ClutterBlur *blur;
-
- g_return_val_if_fail (sigma >= 0.0, NULL);
-
- blur_node = _clutter_paint_node_create (CLUTTER_TYPE_BLUR_NODE);
- blur_node->sigma = sigma;
- context = clutter_backend_get_cogl_context (clutter_get_default_backend ());
- tex_2d = cogl_texture_2d_new_with_size (context, width, height);
-
- texture = COGL_TEXTURE (tex_2d);
- cogl_texture_set_premultiplied (texture, TRUE);
-
- offscreen = cogl_offscreen_new_with_texture (texture);
- cogl_object_unref (tex_2d);
- if (!cogl_framebuffer_allocate (COGL_FRAMEBUFFER (offscreen), &error))
- {
- g_warning ("Unable to allocate paint node offscreen: %s",
- error->message);
- goto out;
- }
-
- blur = clutter_blur_new (texture, sigma);
- blur_node->blur = blur;
-
- if (!blur)
- {
- g_warning ("Failed to create blur pipeline");
- goto out;
- }
-
- layer_node = CLUTTER_LAYER_NODE (blur_node);
- layer_node->offscreen = COGL_FRAMEBUFFER (g_steal_pointer (&offscreen));
- layer_node->pipeline = cogl_pipeline_copy (default_texture_pipeline);
- cogl_pipeline_set_layer_filters (layer_node->pipeline, 0,
- COGL_PIPELINE_FILTER_LINEAR,
- COGL_PIPELINE_FILTER_LINEAR);
- cogl_pipeline_set_layer_texture (layer_node->pipeline,
- 0,
- clutter_blur_get_texture (blur));
-
- cogl_framebuffer_orthographic (layer_node->offscreen,
- 0.0, 0.0,
- width, height,
- 0.0, 1.0);
-
-out:
- return (ClutterPaintNode *) blur_node;
-}
diff --git a/clutter/clutter/clutter-paint-nodes.h b/clutter/clutter/clutter-paint-nodes.h
deleted file mode 100644
index 7f0d12857..000000000
--- a/clutter/clutter/clutter-paint-nodes.h
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2011 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_PAINT_NODES_H__
-#define __CLUTTER_PAINT_NODES_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <cogl/cogl.h>
-#include <clutter/clutter-types.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_COLOR_NODE (clutter_color_node_get_type ())
-#define CLUTTER_COLOR_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_COLOR_NODE, ClutterColorNode))
-#define CLUTTER_IS_COLOR_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_COLOR_NODE))
-
-/**
- * ClutterColorNode:
- *
- * The #ClutterTextNode structure is an opaque
- * type whose members cannot be directly accessed.
- *
- * Since: 1.10
- */
-typedef struct _ClutterColorNode ClutterColorNode;
-typedef struct _ClutterColorNodeClass ClutterColorNodeClass;
-
-CLUTTER_EXPORT
-GType clutter_color_node_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterPaintNode * clutter_color_node_new (const ClutterColor *color);
-
-#define CLUTTER_TYPE_TEXTURE_NODE (clutter_texture_node_get_type ())
-#define CLUTTER_TEXTURE_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_TEXTURE_NODE, ClutterTextureNode))
-#define CLUTTER_IS_TEXTURE_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_TEXTURE_NODE))
-
-/**
- * ClutterTextureNode:
- *
- * The #ClutterTextNode structure is an opaque
- * type whose members cannot be directly accessed.
- *
- * Since: 1.10
- */
-typedef struct _ClutterTextureNode ClutterTextureNode;
-typedef struct _ClutterTextureNodeClass ClutterTextureNodeClass;
-
-CLUTTER_EXPORT
-GType clutter_texture_node_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterPaintNode * clutter_texture_node_new (CoglTexture *texture,
- const ClutterColor *color,
- ClutterScalingFilter min_filter,
- ClutterScalingFilter mag_filter);
-
-#define CLUTTER_TYPE_CLIP_NODE (clutter_clip_node_get_type ())
-#define CLUTTER_CLIP_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_CLIP_NODE, ClutterClipNode))
-#define CLUTTER_IS_CLIP_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_CLIP_NODE))
-
-/**
- * ClutterClipNode:
- *
- * The #ClutterTextNode structure is an opaque
- * type whose members cannot be directly accessed.
- *
- * Since: 1.10
- */
-typedef struct _ClutterClipNode ClutterClipNode;
-typedef struct _ClutterClipNodeClass ClutterClipNodeClass;
-
-CLUTTER_EXPORT
-GType clutter_clip_node_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterPaintNode * clutter_clip_node_new (void);
-
-#define CLUTTER_TYPE_PIPELINE_NODE (clutter_pipeline_node_get_type ())
-#define CLUTTER_PIPELINE_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_PIPELINE_NODE, ClutterPipelineNode))
-#define CLUTTER_IS_PIPELINE_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_PIPELINE_NODE))
-
-/**
- * ClutterPipelineNode:
- *
- * The #ClutterTextNode structure is an opaque
- * type whose members cannot be directly accessed.
- *
- * Since: 1.10
- */
-typedef struct _ClutterPipelineNode ClutterPipelineNode;
-typedef struct _ClutterPipelineNodeClass ClutterPipelineNodeClass;
-
-CLUTTER_EXPORT
-GType clutter_pipeline_node_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterPaintNode * clutter_pipeline_node_new (CoglPipeline *pipeline);
-
-#define CLUTTER_TYPE_TEXT_NODE (clutter_text_node_get_type ())
-#define CLUTTER_TEXT_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_TEXT_NODE, ClutterTextNode))
-#define CLUTTER_IS_TEXT_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_TEXT_NODE))
-
-/**
- * ClutterTextNode:
- *
- * The #ClutterTextNode structure is an opaque
- * type whose members cannot be directly accessed.
- *
- * Since: 1.10
- */
-typedef struct _ClutterTextNode ClutterTextNode;
-typedef struct _ClutterTextNodeClass ClutterTextNodeClass;
-
-CLUTTER_EXPORT
-GType clutter_text_node_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterPaintNode * clutter_text_node_new (PangoLayout *layout,
- const ClutterColor *color);
-
-#define CLUTTER_TYPE_ACTOR_NODE (clutter_actor_node_get_type ())
-#define CLUTTER_ACTOR_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ACTOR_NODE, ClutterActorNode))
-#define CLUTTER_IS_ACTOR_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ACTOR_NODE))
-
-/**
- * ClutterActorNode:
- *
- * The #ClutterActorNode structure is an opaque
- * type whose members cannot be directly accessed.
- */
-typedef struct _ClutterActorNode ClutterActorNode;
-typedef struct _ClutterActorNode ClutterActorNodeClass;
-
-CLUTTER_EXPORT
-GType clutter_actor_node_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterPaintNode * clutter_actor_node_new (ClutterActor *actor,
- int opacity);
-
-#define CLUTTER_TYPE_ROOT_NODE (clutter_root_node_get_type ())
-#define CLUTTER_ROOT_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ROOT_NODE, ClutterRootNode))
-#define CLUTTER_IS_ROOT_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ROOT_NODE))
-
-/**
- * ClutterRootNode:
- *
- * The #ClutterRootNode structure is an opaque
- * type whose members cannot be directly accessed.
- */
-typedef struct _ClutterRootNode ClutterRootNode;
-typedef struct _ClutterPaintNodeClass ClutterRootNodeClass;
-
-CLUTTER_EXPORT
-GType clutter_root_node_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterPaintNode * clutter_root_node_new (CoglFramebuffer *framebuffer,
- const ClutterColor *clear_color,
- CoglBufferBit clear_flags);
-
-#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))
-#define CLUTTER_IS_LAYER_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_LAYER_NODE))
-
-/*
- * ClutterLayerNode:
- *
- * The #ClutterLayerNode structure is an opaque
- * type whose members cannot be directly accessed.
- *
- * Since: 1.10
- */
-typedef struct _ClutterLayerNode ClutterLayerNode;
-typedef struct _ClutterLayerNodeClass ClutterLayerNodeClass;
-
-CLUTTER_EXPORT
-GType clutter_layer_node_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterPaintNode * clutter_layer_node_new (const graphene_matrix_t *projection,
- const cairo_rectangle_t *viewport,
- float width,
- float height,
- guint8 opacity);
-
-CLUTTER_EXPORT
-ClutterPaintNode * clutter_layer_node_new_to_framebuffer (CoglFramebuffer *framebuffer,
- CoglPipeline *pipeline);
-
-
-#define CLUTTER_TYPE_TRANSFORM_NODE (clutter_transform_node_get_type ())
-#define CLUTTER_TRANSFORM_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_TRANSFORM_NODE, ClutterTransformNode))
-#define CLUTTER_IS_TRANSFORM_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_TRANSFORM_NODE))
-
-/*
- * ClutterTransformNode:
- *
- * The #ClutterLayerNode structure is an opaque
- * type whose members cannot be directly accessed.
- *
- * Since: 1.10
- */
-typedef struct _ClutterTransformNode ClutterTransformNode;
-typedef struct _ClutterPaintNodeClass ClutterTransformNodeClass;
-
-CLUTTER_EXPORT
-GType clutter_transform_node_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterPaintNode * clutter_transform_node_new (const graphene_matrix_t *projection);
-
-#define CLUTTER_TYPE_BLIT_NODE (clutter_blit_node_get_type ())
-#define CLUTTER_BLIT_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BLIT_NODE, ClutterBlitNode))
-#define CLUTTER_IS_BLIT_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BLIT_NODE))
-
-/*
- * ClutterBlitNode:
- *
- * The #ClutterBlitNode structure is an opaque
- * type whose members cannot be directly accessed.
- */
-typedef struct _ClutterBlitNode ClutterBlitNode;
-typedef struct _ClutterPaintNodeClass ClutterBlitNodeClass;
-
-CLUTTER_EXPORT
-GType clutter_blit_node_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterPaintNode * clutter_blit_node_new (CoglFramebuffer *src);
-
-CLUTTER_EXPORT
-void clutter_blit_node_add_blit_rectangle (ClutterBlitNode *blit_node,
- int src_x,
- int src_y,
- int dst_x,
- int dst_y,
- int width,
- int height);
-
-#define CLUTTER_TYPE_BLUR_NODE (clutter_blur_node_get_type ())
-#define CLUTTER_BLUR_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BLUR_NODE, ClutterBlurNode))
-#define CLUTTER_IS_BLUR_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BLUR_NODE))
-
-/**
- * ClutterBlurNode:
- *
- * The #ClutterBurNode structure is an opaque
- * type whose members cannot be directly accessed.
- */
-typedef struct _ClutterBlurNode ClutterBlurNode;
-typedef struct _ClutterLayerNodeClass ClutterBlurNodeClass;
-
-CLUTTER_EXPORT
-GType clutter_blur_node_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterPaintNode * clutter_blur_node_new (unsigned int width,
- unsigned int height,
- float sigma);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_PAINT_NODES_H__ */
diff --git a/clutter/clutter/clutter-paint-volume-private.h b/clutter/clutter/clutter-paint-volume-private.h
deleted file mode 100644
index a54218460..000000000
--- a/clutter/clutter/clutter-paint-volume-private.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __CLUTTER_PAINT_VOLUME_PRIVATE_H__
-#define __CLUTTER_PAINT_VOLUME_PRIVATE_H__
-
-#include <clutter/clutter-types.h>
-#include <clutter/clutter-private.h>
-
-G_BEGIN_DECLS
-
-struct _ClutterPaintVolume
-{
- /* A paint volume represents a volume in a given actors private
- * coordinate system. */
- ClutterActor *actor;
-
- /* cuboid for the volume:
- *
- * 4â”â”â”â”â”â”â”┓5
- * â”â”â”â”â”â”â”â”â”┓╱┃
- * ┃0 ┊7 1┃ ┃
- * ┃ ┄┄┄┄┄┃┄┃6
- * ┃3 2┃╱
- * â”—â”â”â”â”â”â”â”â”â”›
- *
- * 0: top, left (origin) : always valid
- * 1: top, right : always valid
- * 2: bottom, right : updated lazily
- * 3: bottom, left : always valid
- *
- * 4: top, left, back : always valid
- * 5: top, right, back : updated lazily
- * 6: bottom, right, back : updated lazily
- * 7: bottom, left, back : updated lazily
- *
- * Elements 0, 1, 3 and 4 are filled in by the PaintVolume setters
- *
- * Note: the reason for this ordering is that we can simply ignore
- * elements 4, 5, 6 and 7 most of the time for 2D actors when
- * calculating the projected paint box.
- */
- graphene_point3d_t vertices[8];
-
- /* As an optimization for internally managed PaintVolumes we allow
- * initializing ClutterPaintVolume variables allocated on the stack
- * so we can avoid hammering the memory allocator. */
- guint is_static:1;
-
- /* A newly initialized PaintVolume is considered empty as it is
- * degenerate on all three axis.
- *
- * We consider this carefully when we union an empty volume with
- * another so that the union simply results in a copy of the other
- * volume instead of also bounding the origin of the empty volume.
- *
- * For example this is a convenient property when calculating the
- * volume of a container as the union of the volume of its children
- * where the initial volume passed to the containers
- * ->get_paint_volume method will be empty. */
- guint is_empty:1;
-
- /* TRUE when we've updated the values we calculate lazily */
- guint is_complete:1;
-
- /* TRUE if vertices 4-7 can be ignored. (Only valid if complete is
- * TRUE) */
- guint is_2d:1;
-
- /* Set to TRUE initially but cleared if the paint volume is
- * transformed by a matrix. */
- guint is_axis_aligned:1;
-
-
- /* Note: There is a precedence to the above bitfields that should be
- * considered whenever we implement code that manipulates
- * PaintVolumes...
- *
- * Firstly if ->is_empty == TRUE then the values for ->is_complete
- * and ->is_2d are undefined, so you should typically check
- * ->is_empty as the first priority.
- *
- * XXX: document other invariables...
- */
-};
-
-void _clutter_paint_volume_init_static (ClutterPaintVolume *pv,
- ClutterActor *actor);
-ClutterPaintVolume *_clutter_paint_volume_new (ClutterActor *actor);
-void _clutter_paint_volume_copy_static (const ClutterPaintVolume *src_pv,
- ClutterPaintVolume *dst_pv);
-void _clutter_paint_volume_set_from_volume (ClutterPaintVolume *pv,
- const ClutterPaintVolume *src);
-
-void _clutter_paint_volume_complete (ClutterPaintVolume *pv);
-void _clutter_paint_volume_transform (ClutterPaintVolume *pv,
- const graphene_matrix_t *matrix);
-void _clutter_paint_volume_project (ClutterPaintVolume *pv,
- const graphene_matrix_t *modelview,
- const graphene_matrix_t *projection,
- const float *viewport);
-void _clutter_paint_volume_get_bounding_box (ClutterPaintVolume *pv,
- ClutterActorBox *box);
-void _clutter_paint_volume_axis_align (ClutterPaintVolume *pv);
-void _clutter_paint_volume_set_reference_actor (ClutterPaintVolume *pv,
- ClutterActor *actor);
-
-ClutterCullResult _clutter_paint_volume_cull (ClutterPaintVolume *pv,
- const graphene_frustum_t *frustum);
-
-void _clutter_paint_volume_get_stage_paint_box (ClutterPaintVolume *pv,
- ClutterStage *stage,
- ClutterActorBox *box);
-
-void _clutter_paint_volume_transform_relative (ClutterPaintVolume *pv,
- ClutterActor *relative_to_ancestor);
-
-void clutter_paint_volume_to_box (ClutterPaintVolume *pv,
- graphene_box_t *box);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_PAINT_VOLUME_PRIVATE_H__ */
diff --git a/clutter/clutter/clutter-paint-volume.c b/clutter/clutter/clutter-paint-volume.c
deleted file mode 100644
index e30d804c0..000000000
--- a/clutter/clutter/clutter-paint-volume.c
+++ /dev/null
@@ -1,1155 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * Authors:
- * Robert Bragg <robert@linux.intel.com>
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#include "clutter-build-config.h"
-
-#include <string.h>
-
-#include <glib-object.h>
-#include <math.h>
-
-#include "clutter-actor-private.h"
-#include "clutter-paint-volume-private.h"
-#include "clutter-private.h"
-#include "clutter-stage-private.h"
-#include "clutter-actor-box-private.h"
-
-G_DEFINE_BOXED_TYPE (ClutterPaintVolume, clutter_paint_volume,
- clutter_paint_volume_copy,
- clutter_paint_volume_free);
-
-/*<private>
- * _clutter_paint_volume_new:
- * @actor: a #ClutterActor
- *
- * Creates a new #ClutterPaintVolume for the given @actor.
- *
- * Return value: the newly allocated #ClutterPaintVolume. Use
- * clutter_paint_volume_free() to free the resources it uses
- *
- * Since: 1.6
- */
-ClutterPaintVolume *
-_clutter_paint_volume_new (ClutterActor *actor)
-{
- ClutterPaintVolume *pv;
-
- g_return_val_if_fail (actor != NULL, NULL);
-
- pv = g_new0 (ClutterPaintVolume, 1);
-
- pv->actor = actor;
-
- memset (pv->vertices, 0, 8 * sizeof (graphene_point3d_t));
-
- pv->is_static = FALSE;
- pv->is_empty = TRUE;
- pv->is_axis_aligned = TRUE;
- pv->is_complete = TRUE;
- pv->is_2d = TRUE;
-
- return pv;
-}
-
-/* Since paint volumes are used so heavily in a typical paint
- * traversal of a Clutter scene graph and since paint volumes often
- * have a very short life cycle that maps well to stack allocation we
- * allow initializing a static ClutterPaintVolume variable to avoid
- * hammering the memory allocator.
- *
- * We were seeing slice allocation take about 1% cumulative CPU time
- * for some very simple clutter tests which although it isn't a *lot*
- * this is an easy way to basically drop that to 0%.
- *
- * The PaintVolume will be internally marked as static and
- * clutter_paint_volume_free should still be used to "free" static
- * volumes. This allows us to potentially store dynamically allocated
- * data inside paint volumes in the future since we would be able to
- * free it during _paint_volume_free().
- */
-void
-_clutter_paint_volume_init_static (ClutterPaintVolume *pv,
- ClutterActor *actor)
-{
- pv->actor = actor;
-
- memset (pv->vertices, 0, 8 * sizeof (graphene_point3d_t));
-
- pv->is_static = TRUE;
- pv->is_empty = TRUE;
- pv->is_axis_aligned = TRUE;
- pv->is_complete = TRUE;
- pv->is_2d = TRUE;
-}
-
-void
-_clutter_paint_volume_copy_static (const ClutterPaintVolume *src_pv,
- ClutterPaintVolume *dst_pv)
-{
-
- g_return_if_fail (src_pv != NULL && dst_pv != NULL);
-
- memcpy (dst_pv, src_pv, sizeof (ClutterPaintVolume));
- dst_pv->is_static = TRUE;
-}
-
-/**
- * clutter_paint_volume_copy:
- * @pv: a #ClutterPaintVolume
- *
- * Copies @pv into a new #ClutterPaintVolume
- *
- * Return value: a newly allocated copy of a #ClutterPaintVolume
- *
- * Since: 1.6
- */
-ClutterPaintVolume *
-clutter_paint_volume_copy (const ClutterPaintVolume *pv)
-{
- ClutterPaintVolume *copy;
-
- g_return_val_if_fail (pv != NULL, NULL);
-
- copy = g_memdup2 (pv, sizeof (ClutterPaintVolume));
- copy->is_static = FALSE;
-
- return copy;
-}
-
-void
-_clutter_paint_volume_set_from_volume (ClutterPaintVolume *pv,
- const ClutterPaintVolume *src)
-{
- gboolean is_static = pv->is_static;
- memcpy (pv, src, sizeof (ClutterPaintVolume));
- pv->is_static = is_static;
-}
-
-/**
- * clutter_paint_volume_free:
- * @pv: a #ClutterPaintVolume
- *
- * Frees the resources allocated by @pv
- *
- * Since: 1.6
- */
-void
-clutter_paint_volume_free (ClutterPaintVolume *pv)
-{
- g_return_if_fail (pv != NULL);
-
- if (G_LIKELY (pv->is_static))
- return;
-
- g_free (pv);
-}
-
-/**
- * clutter_paint_volume_set_origin:
- * @pv: a #ClutterPaintVolume
- * @origin: a #graphene_point3d_t
- *
- * Sets the origin of the paint volume.
- *
- * The origin is defined as the X, Y and Z coordinates of the top-left
- * corner of an actor's paint volume, in actor coordinates.
- *
- * The default is origin is assumed at: (0, 0, 0)
- *
- * Since: 1.6
- */
-void
-clutter_paint_volume_set_origin (ClutterPaintVolume *pv,
- const graphene_point3d_t *origin)
-{
- static const int key_vertices[4] = { 0, 1, 3, 4 };
- float dx, dy, dz;
- int i;
-
- g_return_if_fail (pv != NULL);
-
- dx = origin->x - pv->vertices[0].x;
- dy = origin->y - pv->vertices[0].y;
- dz = origin->z - pv->vertices[0].z;
-
- /* If we change the origin then all the key vertices of the paint
- * volume need to be shifted too... */
- for (i = 0; i < 4; i++)
- {
- pv->vertices[key_vertices[i]].x += dx;
- pv->vertices[key_vertices[i]].y += dy;
- pv->vertices[key_vertices[i]].z += dz;
- }
-
- pv->is_complete = FALSE;
-}
-
-/**
- * clutter_paint_volume_get_origin:
- * @pv: a #ClutterPaintVolume
- * @vertex: (out): the return location for a #graphene_point3d_t
- *
- * Retrieves the origin of the #ClutterPaintVolume.
- *
- * Since: 1.6
- */
-void
-clutter_paint_volume_get_origin (const ClutterPaintVolume *pv,
- graphene_point3d_t *vertex)
-{
- g_return_if_fail (pv != NULL);
- g_return_if_fail (vertex != NULL);
-
- *vertex = pv->vertices[0];
-}
-
-static void
-_clutter_paint_volume_update_is_empty (ClutterPaintVolume *pv)
-{
- if (pv->vertices[0].x == pv->vertices[1].x &&
- pv->vertices[0].y == pv->vertices[3].y &&
- pv->vertices[0].z == pv->vertices[4].z)
- pv->is_empty = TRUE;
- else
- pv->is_empty = FALSE;
-}
-
-/**
- * clutter_paint_volume_set_width:
- * @pv: a #ClutterPaintVolume
- * @width: the width of the paint volume, in pixels
- *
- * Sets the width of the paint volume. The width is measured along
- * the x axis in the actor coordinates that @pv is associated with.
- *
- * Since: 1.6
- */
-void
-clutter_paint_volume_set_width (ClutterPaintVolume *pv,
- gfloat width)
-{
- gfloat right_xpos;
-
- g_return_if_fail (pv != NULL);
- g_return_if_fail (width >= 0.0f);
-
- /* If the volume is currently empty then only the origin is
- * currently valid */
- if (pv->is_empty)
- pv->vertices[1] = pv->vertices[3] = pv->vertices[4] = pv->vertices[0];
-
- if (!pv->is_axis_aligned)
- _clutter_paint_volume_axis_align (pv);
-
- right_xpos = pv->vertices[0].x + width;
-
- /* Move the right vertices of the paint box relative to the
- * origin... */
- pv->vertices[1].x = right_xpos;
- /* pv->vertices[2].x = right_xpos; NB: updated lazily */
- /* pv->vertices[5].x = right_xpos; NB: updated lazily */
- /* pv->vertices[6].x = right_xpos; NB: updated lazily */
-
- pv->is_complete = FALSE;
-
- _clutter_paint_volume_update_is_empty (pv);
-}
-
-/**
- * clutter_paint_volume_get_width:
- * @pv: a #ClutterPaintVolume
- *
- * Retrieves the width of the volume's, axis aligned, bounding box.
- *
- * In other words; this takes into account what actor's coordinate
- * space @pv belongs too and conceptually fits an axis aligned box
- * around the volume. It returns the size of that bounding box as
- * measured along the x-axis.
- *
- * If, for example, clutter_actor_get_transformed_paint_volume()
- * is used to transform a 2D child actor that is 100px wide, 100px
- * high and 0px deep into container coordinates then the width might
- * not simply be 100px if the child actor has a 3D rotation applied to
- * it.
- *
- * Remember: if clutter_actor_get_transformed_paint_volume() is
- * used then a transformed child volume will be defined relative to the
- * ancestor container actor and so a 2D child actor can have a 3D
- * bounding volume.
- *
- * There are no accuracy guarantees for the reported width,
- * except that it must always be greater than, or equal to, the
- * actor's width. This is because actors may report simple, loose
- * fitting paint volumes for efficiency.
-
- * Return value: the width, in units of @pv's local coordinate system.
- *
- * Since: 1.6
- */
-gfloat
-clutter_paint_volume_get_width (const ClutterPaintVolume *pv)
-{
- g_return_val_if_fail (pv != NULL, 0.0);
-
- if (pv->is_empty)
- return 0;
- else if (!pv->is_axis_aligned)
- {
- ClutterPaintVolume tmp;
- float width;
- _clutter_paint_volume_copy_static (pv, &tmp);
- _clutter_paint_volume_axis_align (&tmp);
- width = tmp.vertices[1].x - tmp.vertices[0].x;
- clutter_paint_volume_free (&tmp);
- return width;
- }
- else
- return pv->vertices[1].x - pv->vertices[0].x;
-}
-
-/**
- * clutter_paint_volume_set_height:
- * @pv: a #ClutterPaintVolume
- * @height: the height of the paint volume, in pixels
- *
- * Sets the height of the paint volume. The height is measured along
- * the y axis in the actor coordinates that @pv is associated with.
- *
- * Since: 1.6
- */
-void
-clutter_paint_volume_set_height (ClutterPaintVolume *pv,
- gfloat height)
-{
- gfloat height_ypos;
-
- g_return_if_fail (pv != NULL);
- g_return_if_fail (height >= 0.0f);
-
- /* If the volume is currently empty then only the origin is
- * currently valid */
- if (pv->is_empty)
- pv->vertices[1] = pv->vertices[3] = pv->vertices[4] = pv->vertices[0];
-
- if (!pv->is_axis_aligned)
- _clutter_paint_volume_axis_align (pv);
-
- height_ypos = pv->vertices[0].y + height;
-
- /* Move the bottom vertices of the paint box relative to the
- * origin... */
- /* pv->vertices[2].y = height_ypos; NB: updated lazily */
- pv->vertices[3].y = height_ypos;
- /* pv->vertices[6].y = height_ypos; NB: updated lazily */
- /* pv->vertices[7].y = height_ypos; NB: updated lazily */
- pv->is_complete = FALSE;
-
- _clutter_paint_volume_update_is_empty (pv);
-}
-
-/**
- * clutter_paint_volume_get_height:
- * @pv: a #ClutterPaintVolume
- *
- * Retrieves the height of the volume's, axis aligned, bounding box.
- *
- * In other words; this takes into account what actor's coordinate
- * space @pv belongs too and conceptually fits an axis aligned box
- * around the volume. It returns the size of that bounding box as
- * measured along the y-axis.
- *
- * If, for example, clutter_actor_get_transformed_paint_volume()
- * is used to transform a 2D child actor that is 100px wide, 100px
- * high and 0px deep into container coordinates then the height might
- * not simply be 100px if the child actor has a 3D rotation applied to
- * it.
- *
- * Remember: if clutter_actor_get_transformed_paint_volume() is
- * used then a transformed child volume will be defined relative to the
- * ancestor container actor and so a 2D child actor
- * can have a 3D bounding volume.
- *
- * There are no accuracy guarantees for the reported height,
- * except that it must always be greater than, or equal to, the actor's
- * height. This is because actors may report simple, loose fitting paint
- * volumes for efficiency.
- *
- * Return value: the height, in units of @pv's local coordinate system.
- *
- * Since: 1.6
- */
-gfloat
-clutter_paint_volume_get_height (const ClutterPaintVolume *pv)
-{
- g_return_val_if_fail (pv != NULL, 0.0);
-
- if (pv->is_empty)
- return 0;
- else if (!pv->is_axis_aligned)
- {
- ClutterPaintVolume tmp;
- float height;
- _clutter_paint_volume_copy_static (pv, &tmp);
- _clutter_paint_volume_axis_align (&tmp);
- height = tmp.vertices[3].y - tmp.vertices[0].y;
- clutter_paint_volume_free (&tmp);
- return height;
- }
- else
- return pv->vertices[3].y - pv->vertices[0].y;
-}
-
-/**
- * clutter_paint_volume_set_depth:
- * @pv: a #ClutterPaintVolume
- * @depth: the depth of the paint volume, in pixels
- *
- * Sets the depth of the paint volume. The depth is measured along
- * the z axis in the actor coordinates that @pv is associated with.
- *
- * Since: 1.6
- */
-void
-clutter_paint_volume_set_depth (ClutterPaintVolume *pv,
- gfloat depth)
-{
- gfloat depth_zpos;
-
- g_return_if_fail (pv != NULL);
- g_return_if_fail (depth >= 0.0f);
-
- /* If the volume is currently empty then only the origin is
- * currently valid */
- if (pv->is_empty)
- pv->vertices[1] = pv->vertices[3] = pv->vertices[4] = pv->vertices[0];
-
- if (!pv->is_axis_aligned)
- _clutter_paint_volume_axis_align (pv);
-
- depth_zpos = pv->vertices[0].z + depth;
-
- /* Move the back vertices of the paint box relative to the
- * origin... */
- pv->vertices[4].z = depth_zpos;
- /* pv->vertices[5].z = depth_zpos; NB: updated lazily */
- /* pv->vertices[6].z = depth_zpos; NB: updated lazily */
- /* pv->vertices[7].z = depth_zpos; NB: updated lazily */
-
- pv->is_complete = FALSE;
- pv->is_2d = depth ? FALSE : TRUE;
- _clutter_paint_volume_update_is_empty (pv);
-}
-
-/**
- * clutter_paint_volume_get_depth:
- * @pv: a #ClutterPaintVolume
- *
- * Retrieves the depth of the volume's, axis aligned, bounding box.
- *
- * In other words; this takes into account what actor's coordinate
- * space @pv belongs too and conceptually fits an axis aligned box
- * around the volume. It returns the size of that bounding box as
- * measured along the z-axis.
- *
- * If, for example, clutter_actor_get_transformed_paint_volume()
- * is used to transform a 2D child actor that is 100px wide, 100px
- * high and 0px deep into container coordinates then the depth might
- * not simply be 0px if the child actor has a 3D rotation applied to
- * it.
- *
- * Remember: if clutter_actor_get_transformed_paint_volume() is
- * used then the transformed volume will be defined relative to the
- * container actor and in container coordinates a 2D child actor
- * can have a 3D bounding volume.
- *
- * There are no accuracy guarantees for the reported depth,
- * except that it must always be greater than, or equal to, the actor's
- * depth. This is because actors may report simple, loose fitting paint
- * volumes for efficiency.
- *
- * Return value: the depth, in units of @pv's local coordinate system.
- *
- * Since: 1.6
- */
-gfloat
-clutter_paint_volume_get_depth (const ClutterPaintVolume *pv)
-{
- g_return_val_if_fail (pv != NULL, 0.0);
-
- if (pv->is_empty)
- return 0;
- else if (!pv->is_axis_aligned)
- {
- ClutterPaintVolume tmp;
- float depth;
- _clutter_paint_volume_copy_static (pv, &tmp);
- _clutter_paint_volume_axis_align (&tmp);
- depth = tmp.vertices[4].z - tmp.vertices[0].z;
- clutter_paint_volume_free (&tmp);
- return depth;
- }
- else
- return pv->vertices[4].z - pv->vertices[0].z;
-}
-
-/**
- * clutter_paint_volume_union:
- * @pv: The first #ClutterPaintVolume and destination for resulting
- * union
- * @another_pv: A second #ClutterPaintVolume to union with @pv
- *
- * Updates the geometry of @pv to encompass @pv and @another_pv.
- *
- * There are no guarantees about how precisely the two volumes
- * will be unioned.
- *
- * Since: 1.6
- */
-void
-clutter_paint_volume_union (ClutterPaintVolume *pv,
- const ClutterPaintVolume *another_pv)
-{
- ClutterPaintVolume aligned_pv;
- graphene_point3d_t min;
- graphene_point3d_t max;
- graphene_box_t another_box;
- graphene_box_t union_box;
- graphene_box_t box;
-
- g_return_if_fail (pv != NULL);
- g_return_if_fail (another_pv != NULL);
-
- /* Both volumes have to belong to the same local coordinate space */
- g_return_if_fail (pv->actor == another_pv->actor);
-
- /* We special case empty volumes because otherwise we'd end up
- * calculating a bounding box that would enclose the origin of
- * the empty volume which isn't desired.
- */
- if (another_pv->is_empty)
- return;
-
- if (pv->is_empty)
- {
- _clutter_paint_volume_set_from_volume (pv, another_pv);
- goto done;
- }
-
- if (!pv->is_axis_aligned)
- _clutter_paint_volume_axis_align (pv);
-
- _clutter_paint_volume_complete (pv);
-
- if (!another_pv->is_axis_aligned || !another_pv->is_complete)
- {
- _clutter_paint_volume_copy_static (another_pv, &aligned_pv);
- _clutter_paint_volume_axis_align (&aligned_pv);
- _clutter_paint_volume_complete (&aligned_pv);
- another_pv = &aligned_pv;
- }
-
- if (G_LIKELY (pv->is_2d))
- graphene_box_init_from_points (&box, 4, pv->vertices);
- else
- graphene_box_init_from_points (&box, 8, pv->vertices);
-
- if (G_LIKELY (another_pv->is_2d))
- graphene_box_init_from_points (&another_box, 4, another_pv->vertices);
- else
- graphene_box_init_from_points (&another_box, 8, another_pv->vertices);
-
- graphene_box_union (&box, &another_box, &union_box);
-
- graphene_box_get_min (&union_box, &min);
- graphene_box_get_max (&union_box, &max);
- graphene_point3d_init (&pv->vertices[0], min.x, min.y, min.z);
- graphene_point3d_init (&pv->vertices[1], max.x, min.y, min.z);
- graphene_point3d_init (&pv->vertices[3], min.x, max.y, min.z);
- graphene_point3d_init (&pv->vertices[4], min.x, min.y, max.z);
-
- if (pv->vertices[4].z == pv->vertices[0].z)
- pv->is_2d = TRUE;
- else
- pv->is_2d = FALSE;
-
-done:
- pv->is_empty = FALSE;
- pv->is_complete = FALSE;
-}
-
-/**
- * clutter_paint_volume_union_box:
- * @pv: a #ClutterPaintVolume
- * @box: a #ClutterActorBox to union to @pv
- *
- * Unions the 2D region represented by @box to a #ClutterPaintVolume.
- *
- * This function is similar to clutter_paint_volume_union(), but it is
- * specific for 2D regions.
- *
- * Since: 1.10
- */
-void
-clutter_paint_volume_union_box (ClutterPaintVolume *pv,
- const ClutterActorBox *box)
-{
- ClutterPaintVolume volume;
- graphene_point3d_t origin;
-
- g_return_if_fail (pv != NULL);
- g_return_if_fail (box != NULL);
-
- _clutter_paint_volume_init_static (&volume, pv->actor);
-
- origin.x = box->x1;
- origin.y = box->y1;
- origin.z = 0.f;
- clutter_paint_volume_set_origin (&volume, &origin);
- clutter_paint_volume_set_width (&volume, box->x2 - box->x1);
- clutter_paint_volume_set_height (&volume, box->y2 - box->y1);
-
- clutter_paint_volume_union (pv, &volume);
-
- clutter_paint_volume_free (&volume);
-}
-
-/* The paint_volume setters only update vertices 0, 1, 3 and
- * 4 since the others can be drived from them.
- *
- * This will set pv->completed = TRUE;
- */
-void
-_clutter_paint_volume_complete (ClutterPaintVolume *pv)
-{
- float dx_l2r, dy_l2r, dz_l2r;
- float dx_t2b, dy_t2b, dz_t2b;
-
- if (pv->is_empty)
- return;
-
- if (pv->is_complete)
- return;
-
- /* Find the vector that takes us from any vertex on the left face to
- * the corresponding vertex on the right face. */
- dx_l2r = pv->vertices[1].x - pv->vertices[0].x;
- dy_l2r = pv->vertices[1].y - pv->vertices[0].y;
- dz_l2r = pv->vertices[1].z - pv->vertices[0].z;
-
- /* Find the vector that takes us from any vertex on the top face to
- * the corresponding vertex on the bottom face. */
- dx_t2b = pv->vertices[3].x - pv->vertices[0].x;
- dy_t2b = pv->vertices[3].y - pv->vertices[0].y;
- dz_t2b = pv->vertices[3].z - pv->vertices[0].z;
-
- /* front-bottom-right */
- pv->vertices[2].x = pv->vertices[3].x + dx_l2r;
- pv->vertices[2].y = pv->vertices[3].y + dy_l2r;
- pv->vertices[2].z = pv->vertices[3].z + dz_l2r;
-
- if (G_UNLIKELY (!pv->is_2d))
- {
- /* back-top-right */
- pv->vertices[5].x = pv->vertices[4].x + dx_l2r;
- pv->vertices[5].y = pv->vertices[4].y + dy_l2r;
- pv->vertices[5].z = pv->vertices[4].z + dz_l2r;
-
- /* back-bottom-right */
- pv->vertices[6].x = pv->vertices[5].x + dx_t2b;
- pv->vertices[6].y = pv->vertices[5].y + dy_t2b;
- pv->vertices[6].z = pv->vertices[5].z + dz_t2b;
-
- /* back-bottom-left */
- pv->vertices[7].x = pv->vertices[4].x + dx_t2b;
- pv->vertices[7].y = pv->vertices[4].y + dy_t2b;
- pv->vertices[7].z = pv->vertices[4].z + dz_t2b;
- }
-
- pv->is_complete = TRUE;
-}
-
-/*<private>
- * _clutter_paint_volume_get_box:
- * @pv: a #ClutterPaintVolume
- * @box: a pixel aligned #ClutterActorBox
- *
- * Transforms a 3D paint volume into a 2D bounding box in the
- * same coordinate space as the 3D paint volume.
- *
- * To get an actors "paint box" you should first project
- * the paint volume into window coordinates before getting
- * the 2D bounding box.
- *
- * The coordinates of the returned box are not clamped to
- * integer pixel values; if you need them to be rounded to the
- * nearest integer pixel values, you can use the
- * clutter_actor_box_clamp_to_pixel() function.
- *
- * Since: 1.6
- */
-void
-_clutter_paint_volume_get_bounding_box (ClutterPaintVolume *pv,
- ClutterActorBox *box)
-{
- gfloat x_min, y_min, x_max, y_max;
- graphene_point3d_t *vertices;
- int count;
- gint i;
-
- g_return_if_fail (pv != NULL);
- g_return_if_fail (box != NULL);
-
- if (pv->is_empty)
- {
- box->x1 = box->x2 = pv->vertices[0].x;
- box->y1 = box->y2 = pv->vertices[0].y;
- return;
- }
-
- /* Updates the vertices we calculate lazily
- * (See ClutterPaintVolume typedef for more details) */
- _clutter_paint_volume_complete (pv);
-
- vertices = pv->vertices;
-
- x_min = x_max = vertices[0].x;
- y_min = y_max = vertices[0].y;
-
- /* Most actors are 2D so we only have to look at the front 4
- * vertices of the paint volume... */
- if (G_LIKELY (pv->is_2d))
- count = 4;
- else
- count = 8;
-
- for (i = 1; i < count; i++)
- {
- if (vertices[i].x < x_min)
- x_min = vertices[i].x;
- else if (vertices[i].x > x_max)
- x_max = vertices[i].x;
-
- if (vertices[i].y < y_min)
- y_min = vertices[i].y;
- else if (vertices[i].y > y_max)
- y_max = vertices[i].y;
- }
-
- box->x1 = x_min;
- box->y1 = y_min;
- box->x2 = x_max;
- box->y2 = y_max;
-}
-
-void
-_clutter_paint_volume_project (ClutterPaintVolume *pv,
- const graphene_matrix_t *modelview,
- const graphene_matrix_t *projection,
- const float *viewport)
-{
- int transform_count;
-
- if (pv->is_empty)
- {
- /* Just transform the origin... */
- _clutter_util_fully_transform_vertices (modelview,
- projection,
- viewport,
- pv->vertices,
- pv->vertices,
- 1);
- return;
- }
-
- /* All the vertices must be up to date, since after the projection
- * it won't be trivial to derive the other vertices. */
- _clutter_paint_volume_complete (pv);
-
- /* Most actors are 2D so we only have to transform the front 4
- * vertices of the paint volume... */
- if (G_LIKELY (pv->is_2d))
- transform_count = 4;
- else
- transform_count = 8;
-
- _clutter_util_fully_transform_vertices (modelview,
- projection,
- viewport,
- pv->vertices,
- pv->vertices,
- transform_count);
-
- pv->is_axis_aligned = FALSE;
-}
-
-void
-_clutter_paint_volume_transform (ClutterPaintVolume *pv,
- const graphene_matrix_t *matrix)
-{
- int transform_count;
-
- if (pv->is_empty)
- {
- gfloat w = 1;
- /* Just transform the origin */
- cogl_graphene_matrix_project_point (matrix,
- &pv->vertices[0].x,
- &pv->vertices[0].y,
- &pv->vertices[0].z,
- &w);
- return;
- }
-
- /* All the vertices must be up to date, since after the transform
- * it won't be trivial to derive the other vertices. */
- _clutter_paint_volume_complete (pv);
-
- /* Most actors are 2D so we only have to transform the front 4
- * vertices of the paint volume... */
- if (G_LIKELY (pv->is_2d))
- transform_count = 4;
- else
- transform_count = 8;
-
- cogl_graphene_matrix_transform_points (matrix,
- 3,
- sizeof (graphene_point3d_t),
- pv->vertices,
- sizeof (graphene_point3d_t),
- pv->vertices,
- transform_count);
-
- pv->is_axis_aligned = FALSE;
-}
-
-
-/* Given a paint volume that has been transformed by an arbitrary
- * modelview and is no longer axis aligned, this derives a replacement
- * that is axis aligned. */
-void
-_clutter_paint_volume_axis_align (ClutterPaintVolume *pv)
-{
- int count;
- int i;
- graphene_point3d_t origin;
- float max_x;
- float max_y;
- float max_z;
-
- g_return_if_fail (pv != NULL);
-
- if (pv->is_empty)
- return;
-
- if (G_LIKELY (pv->is_axis_aligned))
- return;
-
- if (G_LIKELY (pv->vertices[0].x == pv->vertices[1].x &&
- pv->vertices[0].y == pv->vertices[3].y &&
- pv->vertices[0].z == pv->vertices[4].z))
- {
- pv->is_axis_aligned = TRUE;
- return;
- }
-
- if (!pv->is_complete)
- _clutter_paint_volume_complete (pv);
-
- origin = pv->vertices[0];
- max_x = pv->vertices[0].x;
- max_y = pv->vertices[0].y;
- max_z = pv->vertices[0].z;
-
- count = pv->is_2d ? 4 : 8;
- for (i = 1; i < count; i++)
- {
- if (pv->vertices[i].x < origin.x)
- origin.x = pv->vertices[i].x;
- else if (pv->vertices[i].x > max_x)
- max_x = pv->vertices[i].x;
-
- if (pv->vertices[i].y < origin.y)
- origin.y = pv->vertices[i].y;
- else if (pv->vertices[i].y > max_y)
- max_y = pv->vertices[i].y;
-
- if (pv->vertices[i].z < origin.z)
- origin.z = pv->vertices[i].z;
- else if (pv->vertices[i].z > max_z)
- max_z = pv->vertices[i].z;
- }
-
- pv->vertices[0] = origin;
-
- pv->vertices[1].x = max_x;
- pv->vertices[1].y = origin.y;
- pv->vertices[1].z = origin.z;
-
- pv->vertices[3].x = origin.x;
- pv->vertices[3].y = max_y;
- pv->vertices[3].z = origin.z;
-
- pv->vertices[4].x = origin.x;
- pv->vertices[4].y = origin.y;
- pv->vertices[4].z = max_z;
-
- pv->is_complete = FALSE;
- pv->is_axis_aligned = TRUE;
-
- if (pv->vertices[4].z == pv->vertices[0].z)
- pv->is_2d = TRUE;
- else
- pv->is_2d = FALSE;
-}
-
-/*<private>
- * _clutter_actor_set_default_paint_volume:
- * @self: a #ClutterActor
- * @check_gtype: if not %G_TYPE_INVALID, match the type of @self against
- * this type
- * @volume: the #ClutterPaintVolume to set
- *
- * Sets the default paint volume for @self.
- *
- * This function should be called by #ClutterActor sub-classes that follow
- * the default assumption that their paint volume is defined by their
- * allocation.
- *
- * If @check_gtype is not %G_TYPE_INVALID, this function will check the
- * type of @self and only compute the paint volume if the type matches;
- * this can be used to avoid computing the paint volume for sub-classes
- * of an actor class
- *
- * Return value: %TRUE if the paint volume was set, and %FALSE otherwise
- */
-gboolean
-_clutter_actor_set_default_paint_volume (ClutterActor *self,
- GType check_gtype,
- ClutterPaintVolume *volume)
-{
- ClutterActorBox box;
-
- if (check_gtype != G_TYPE_INVALID)
- {
- if (G_OBJECT_TYPE (self) != check_gtype)
- return FALSE;
- }
-
- /* calling clutter_actor_get_allocation_* can potentially be very
- * expensive, as it can result in a synchronous full stage relayout
- * and redraw
- */
- if (!clutter_actor_has_allocation (self))
- return FALSE;
-
- clutter_actor_get_allocation_box (self, &box);
-
- /* we only set the width and height, as the paint volume is defined
- * to be relative to the actor's modelview, which means that the
- * allocation's origin has already been applied
- */
- clutter_paint_volume_set_width (volume, box.x2 - box.x1);
- clutter_paint_volume_set_height (volume, box.y2 - box.y1);
-
- return TRUE;
-}
-
-/**
- * clutter_paint_volume_set_from_allocation:
- * @pv: a #ClutterPaintVolume
- * @actor: a #ClutterActor
- *
- * Sets the #ClutterPaintVolume from the allocation of @actor.
- *
- * This function should be used when overriding the
- * #ClutterActorClass.get_paint_volume() by #ClutterActor sub-classes
- * that do not paint outside their allocation.
- *
- * A typical example is:
- *
- * |[
- * static gboolean
- * my_actor_get_paint_volume (ClutterActor *self,
- * ClutterPaintVolume *volume)
- * {
- * return clutter_paint_volume_set_from_allocation (volume, self);
- * }
- * ]|
- *
- * Return value: %TRUE if the paint volume was successfully set, and %FALSE
- * otherwise
- *
- * Since: 1.6
- */
-gboolean
-clutter_paint_volume_set_from_allocation (ClutterPaintVolume *pv,
- ClutterActor *actor)
-{
- g_return_val_if_fail (pv != NULL, FALSE);
- g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), FALSE);
-
- return _clutter_actor_set_default_paint_volume (actor, G_TYPE_INVALID, pv);
-}
-
-/* Currently paint volumes are defined relative to a given actor, but
- * in some cases it is desirable to be able to change the actor that
- * a volume relates too (For instance for ClutterClone actors where we
- * need to masquerade the source actors volume as the volume for the
- * clone). */
-void
-_clutter_paint_volume_set_reference_actor (ClutterPaintVolume *pv,
- ClutterActor *actor)
-{
- g_return_if_fail (pv != NULL);
-
- pv->actor = actor;
-}
-
-ClutterCullResult
-_clutter_paint_volume_cull (ClutterPaintVolume *pv,
- const graphene_frustum_t *frustum)
-{
- int vertex_count;
- graphene_box_t box;
-
- if (pv->is_empty)
- return CLUTTER_CULL_RESULT_OUT;
-
- /* We expect the volume to already be transformed into eye coordinates
- */
- g_return_val_if_fail (pv->is_complete == TRUE, CLUTTER_CULL_RESULT_IN);
- g_return_val_if_fail (pv->actor == NULL, CLUTTER_CULL_RESULT_IN);
-
- /* Most actors are 2D so we only have to transform the front 4
- * vertices of the paint volume... */
- if (G_LIKELY (pv->is_2d))
- vertex_count = 4;
- else
- vertex_count = 8;
-
- graphene_box_init_from_points (&box, vertex_count, pv->vertices);
-
- if (graphene_frustum_intersects_box (frustum, &box))
- return CLUTTER_CULL_RESULT_IN;
- else
- return CLUTTER_CULL_RESULT_OUT;
-}
-
-void
-_clutter_paint_volume_get_stage_paint_box (ClutterPaintVolume *pv,
- ClutterStage *stage,
- ClutterActorBox *box)
-{
- ClutterPaintVolume projected_pv;
- graphene_matrix_t modelview;
- graphene_matrix_t projection;
- float viewport[4];
-
- _clutter_paint_volume_copy_static (pv, &projected_pv);
-
- graphene_matrix_init_identity (&modelview);
-
- /* If the paint volume isn't already in eye coordinates... */
- if (pv->actor)
- _clutter_actor_apply_relative_transformation_matrix (pv->actor, NULL,
- &modelview);
-
- _clutter_stage_get_projection_matrix (stage, &projection);
- _clutter_stage_get_viewport (stage,
- &viewport[0],
- &viewport[1],
- &viewport[2],
- &viewport[3]);
-
- _clutter_paint_volume_project (&projected_pv,
- &modelview,
- &projection,
- viewport);
-
- _clutter_paint_volume_get_bounding_box (&projected_pv, box);
-
- if (pv->is_2d && pv->actor &&
- clutter_actor_get_z_position (pv->actor) == 0)
- {
- /* If the volume/actor are perfectly 2D, take the bounding box as
- * good. We won't need to add any extra room for sub-pixel positioning
- * in this case.
- */
- clutter_paint_volume_free (&projected_pv);
- box->x1 = CLUTTER_NEARBYINT (box->x1);
- box->y1 = CLUTTER_NEARBYINT (box->y1);
- box->x2 = CLUTTER_NEARBYINT (box->x2);
- box->y2 = CLUTTER_NEARBYINT (box->y2);
- return;
- }
-
- _clutter_actor_box_enlarge_for_effects (box);
-
- clutter_paint_volume_free (&projected_pv);
-}
-
-void
-_clutter_paint_volume_transform_relative (ClutterPaintVolume *pv,
- ClutterActor *relative_to_ancestor)
-{
- graphene_matrix_t matrix;
- ClutterActor *actor;
-
- actor = pv->actor;
-
- g_return_if_fail (actor != NULL);
-
- _clutter_paint_volume_set_reference_actor (pv, relative_to_ancestor);
-
- graphene_matrix_init_identity (&matrix);
- _clutter_actor_apply_relative_transformation_matrix (actor,
- relative_to_ancestor,
- &matrix);
-
- _clutter_paint_volume_transform (pv, &matrix);
-}
-
-void
-clutter_paint_volume_to_box (ClutterPaintVolume *pv,
- graphene_box_t *box)
-{
- int vertex_count;
-
- if (pv->is_empty)
- {
- graphene_box_init_from_box (box, graphene_box_empty ());
- return;
- }
-
- _clutter_paint_volume_complete (pv);
-
- if (G_LIKELY (pv->is_2d))
- vertex_count = 4;
- else
- vertex_count = 8;
-
- graphene_box_init_from_points (box, vertex_count, pv->vertices);
-}
diff --git a/clutter/clutter/clutter-pan-action.c b/clutter/clutter/clutter-pan-action.c
deleted file mode 100644
index 5ad82ff6f..000000000
--- a/clutter/clutter/clutter-pan-action.c
+++ /dev/null
@@ -1,1048 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- * Copyright (C) 2011 Robert Bosch Car Multimedia GmbH.
- * Copyright (C) 2012, 2014 Collabora Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emanuele Aina <emanuele.aina@collabora.com>
- *
- * Based on ClutterDragAction, ClutterSwipeAction, and MxKineticScrollView,
- * written by:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- * Tomeu Vizoso <tomeu.vizoso@collabora.co.uk>
- * Chris Lord <chris@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-pan-action
- * @Title: ClutterPanAction
- * @Short_Description: Action for pan gestures
- *
- * #ClutterPanAction is a sub-class of #ClutterGestureAction that implements
- * the logic for recognizing pan gestures.
- *
- * The simplest usage of #ClutterPanAction consists in adding it to
- * a #ClutterActor with a child and setting it as reactive; for instance,
- * the following code:
- *
- * |[
- * clutter_actor_add_action (actor, clutter_pan_action_new ());
- * clutter_actor_set_reactive (actor, TRUE);
- * ]|
- *
- * will automatically result in the actor children to be moved
- * when dragging.
- *
- * Since: 1.12
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-pan-action.h"
-
-#include "clutter-debug.h"
-#include "clutter-enum-types.h"
-#include "clutter-gesture-action-private.h"
-#include "clutter-marshal.h"
-#include "clutter-private.h"
-#include "clutter-timeline.h"
-#include <math.h>
-
-#define FLOAT_EPSILON (1e-15)
-
-static const gfloat min_velocity = 0.1f; // measured in px/ms
-static const gfloat reference_fps = 60.0f; // the fps assumed for the deceleration rate
-static const gfloat default_deceleration_rate = 0.95f;
-static const gfloat default_acceleration_factor = 1.0f;
-
-typedef enum
-{
- PAN_STATE_INACTIVE,
- PAN_STATE_PANNING,
- PAN_STATE_INTERPOLATING
-} PanState;
-
-typedef enum
-{
- SCROLL_PINNED_UNKNOWN,
- SCROLL_PINNED_NONE,
- SCROLL_PINNED_HORIZONTAL,
- SCROLL_PINNED_VERTICAL
-} PinState;
-
-struct _ClutterPanActionPrivate
-{
- ClutterPanAxis pan_axis;
-
- PanState state;
-
- /* Variables for storing acceleration information */
- ClutterTimeline *deceleration_timeline;
- gfloat target_x;
- gfloat target_y;
- gfloat dx;
- gfloat dy;
- gdouble deceleration_rate;
- gdouble acceleration_factor;
-
- /* Inertial motion tracking */
- gfloat interpolated_x;
- gfloat interpolated_y;
- gfloat release_x;
- gfloat release_y;
-
- guint should_interpolate : 1;
-
- PinState pin_state;
-};
-
-enum
-{
- PROP_0,
-
- PROP_PAN_AXIS,
- PROP_INTERPOLATE,
- PROP_DECELERATION,
- PROP_ACCELERATION_FACTOR,
-
- PROP_LAST
-};
-
-static GParamSpec *pan_props[PROP_LAST] = { NULL, };
-
-enum
-{
- PAN,
- PAN_STOPPED,
-
- LAST_SIGNAL
-};
-
-static guint pan_signals[LAST_SIGNAL] = { 0, };
-
-G_DEFINE_TYPE_WITH_PRIVATE (ClutterPanAction, clutter_pan_action,
- CLUTTER_TYPE_GESTURE_ACTION)
-
-static void
-emit_pan (ClutterPanAction *self,
- ClutterActor *actor,
- gboolean is_interpolated)
-{
- ClutterPanActionPrivate *priv = self->priv;
- gboolean retval;
-
- if (priv->pin_state == SCROLL_PINNED_UNKNOWN)
- {
- priv->pin_state = SCROLL_PINNED_NONE;
- if (priv->pan_axis == CLUTTER_PAN_AXIS_AUTO)
- {
- gfloat delta_x;
- gfloat delta_y;
- gfloat scroll_threshold = G_PI_4/2;
- gfloat drag_angle;
-
- clutter_gesture_action_get_motion_delta (CLUTTER_GESTURE_ACTION (self),
- 0,
- &delta_x,
- &delta_y);
-
- if (delta_x != 0.0f)
- drag_angle = atanf (delta_y / delta_x);
- else
- drag_angle = G_PI_2;
-
- if ((drag_angle > -scroll_threshold) &&
- (drag_angle < scroll_threshold))
- priv->pin_state = SCROLL_PINNED_HORIZONTAL;
- else if ((drag_angle > (G_PI_2 - scroll_threshold)) ||
- (drag_angle < -(G_PI_2 - scroll_threshold)))
- priv->pin_state = SCROLL_PINNED_VERTICAL;
- }
- }
-
- g_signal_emit (self, pan_signals[PAN], 0, actor, is_interpolated, &retval);
-}
-
-static void
-emit_pan_stopped (ClutterPanAction *self,
- ClutterActor *actor)
-{
- ClutterPanActionPrivate *priv = self->priv;
-
- g_signal_emit (self, pan_signals[PAN_STOPPED], 0, actor);
- priv->state = PAN_STATE_INACTIVE;
-}
-
-static void
-on_deceleration_stopped (ClutterTimeline *timeline,
- gboolean is_finished,
- ClutterPanAction *self)
-{
- ClutterPanActionPrivate *priv = self->priv;
- ClutterActor *actor;
-
- g_object_unref (timeline);
- priv->deceleration_timeline = NULL;
-
- actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (self));
- emit_pan_stopped (self, actor);
-}
-
-static void
-on_deceleration_new_frame (ClutterTimeline *timeline,
- gint elapsed_time,
- ClutterPanAction *self)
-{
- ClutterPanActionPrivate *priv = self->priv;
- ClutterActor *actor;
- gdouble progress;
- gfloat interpolated_x, interpolated_y;
-
- progress = clutter_timeline_get_progress (timeline);
-
- interpolated_x = priv->target_x * progress;
- interpolated_y = priv->target_y * progress;
- priv->dx = interpolated_x - priv->interpolated_x;
- priv->dy = interpolated_y - priv->interpolated_y;
- priv->interpolated_x = interpolated_x;
- priv->interpolated_y = interpolated_y;
-
- actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (self));
- emit_pan (self, actor, TRUE);
-}
-
-static gboolean
-gesture_prepare (ClutterGestureAction *gesture,
- ClutterActor *actor)
-{
- ClutterPanAction *self = CLUTTER_PAN_ACTION (gesture);
- ClutterPanActionPrivate *priv = self->priv;
-
- if (priv->state == PAN_STATE_INTERPOLATING && priv->deceleration_timeline)
- clutter_timeline_stop (priv->deceleration_timeline);
-
- return TRUE;
-}
-
-static gboolean
-gesture_begin (ClutterGestureAction *gesture,
- ClutterActor *actor)
-{
- ClutterPanAction *self = CLUTTER_PAN_ACTION (gesture);
- ClutterPanActionPrivate *priv = self->priv;
-
- priv->pin_state = SCROLL_PINNED_UNKNOWN;
- priv->state = PAN_STATE_PANNING;
- priv->interpolated_x = priv->interpolated_y = 0.0f;
- priv->dx = priv->dy = 0.0f;
-
- return TRUE;
-}
-
-static gboolean
-gesture_progress (ClutterGestureAction *gesture,
- ClutterActor *actor)
-{
- ClutterPanAction *self = CLUTTER_PAN_ACTION (gesture);
-
- emit_pan (self, actor, FALSE);
-
- return TRUE;
-}
-
-static void
-gesture_cancel (ClutterGestureAction *gesture,
- ClutterActor *actor)
-{
- ClutterPanAction *self = CLUTTER_PAN_ACTION (gesture);
- ClutterPanActionPrivate *priv = self->priv;
-
- priv->state = PAN_STATE_INACTIVE;
-}
-
-static void
-gesture_end (ClutterGestureAction *gesture,
- ClutterActor *actor)
-{
- ClutterPanAction *self = CLUTTER_PAN_ACTION (gesture);
- ClutterPanActionPrivate *priv = self->priv;
- gfloat velocity, velocity_x, velocity_y;
- gfloat delta_x, delta_y;
- gfloat tau;
- gint duration;
-
- clutter_gesture_action_get_release_coords (CLUTTER_GESTURE_ACTION (self),
- 0,
- &priv->release_x,
- &priv->release_y);
-
- if (!priv->should_interpolate)
- {
- priv->state = PAN_STATE_INACTIVE;
- return;
- }
-
- priv->state = PAN_STATE_INTERPOLATING;
-
- clutter_gesture_action_get_motion_delta (gesture, 0, &delta_x, &delta_y);
- velocity = clutter_gesture_action_get_velocity (gesture, 0,
- &velocity_x,
- &velocity_y);
-
- /* Exponential timing constant v(t) = v(0) * exp(-t/tau)
- * tau = 1000ms / (frame_per_second * - ln(decay_per_frame))
- * with frame_per_second = 60 and decay_per_frame = 0.95, tau ~= 325ms
- * see http://ariya.ofilabs.com/2011/10/flick-list-with-its-momentum-scrolling-and-deceleration.html */
- tau = 1000.0f / (reference_fps * - logf (priv->deceleration_rate));
-
- /* See where the decreasing velocity reaches $min_velocity px/ms
- * v(t) = v(0) * exp(-t/tau) = min_velocity
- * t = - tau * ln( min_velocity / |v(0)|) */
- duration = - tau * logf (min_velocity / (ABS (velocity) *
- priv->acceleration_factor));
-
- /* Target point: x(t) = v(0) * tau * [1 - exp(-t/tau)] */
- priv->target_x = (velocity_x * priv->acceleration_factor * tau *
- (1 - exp ((float)-duration / tau)));
- priv->target_y = (velocity_y * priv->acceleration_factor * tau *
- (1 - exp ((float)-duration / tau)));
-
- if (ABS (velocity) * priv->acceleration_factor > min_velocity &&
- duration > FLOAT_EPSILON)
- {
- ClutterActor *pan_actor =
- clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (gesture));
-
- priv->interpolated_x = priv->interpolated_y = 0.0f;
- priv->deceleration_timeline = clutter_timeline_new_for_actor (pan_actor,
- duration);
- clutter_timeline_set_progress_mode (priv->deceleration_timeline,
- CLUTTER_EASE_OUT_EXPO);
-
- g_signal_connect (priv->deceleration_timeline, "new_frame",
- G_CALLBACK (on_deceleration_new_frame), self);
- g_signal_connect (priv->deceleration_timeline, "stopped",
- G_CALLBACK (on_deceleration_stopped), self);
- clutter_timeline_start (priv->deceleration_timeline);
- }
- else
- {
- emit_pan_stopped (self, actor);
- }
-}
-
-static gboolean
-clutter_pan_action_real_pan (ClutterPanAction *self,
- ClutterActor *actor,
- gboolean is_interpolated)
-{
- gfloat dx, dy;
- graphene_matrix_t transform;
- graphene_matrix_t translate;
-
- clutter_pan_action_get_constrained_motion_delta (self, 0, &dx, &dy);
-
- clutter_actor_get_child_transform (actor, &transform);
- graphene_matrix_init_translate (&translate,
- &GRAPHENE_POINT3D_INIT (dx, dy, 0.0f));
- graphene_matrix_multiply (&translate, &transform, &transform);
- clutter_actor_set_child_transform (actor, &transform);
- return TRUE;
-}
-
-static void
-clutter_pan_action_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterPanAction *self = CLUTTER_PAN_ACTION (gobject);
-
- switch (prop_id)
- {
- case PROP_PAN_AXIS:
- clutter_pan_action_set_pan_axis (self, g_value_get_enum (value));
- break;
-
- case PROP_INTERPOLATE :
- clutter_pan_action_set_interpolate (self, g_value_get_boolean (value));
- break;
-
- case PROP_DECELERATION :
- clutter_pan_action_set_deceleration (self, g_value_get_double (value));
- break;
-
- case PROP_ACCELERATION_FACTOR :
- clutter_pan_action_set_acceleration_factor (self,
- g_value_get_double (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- }
-}
-
-static void
-clutter_pan_action_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterPanAction *self = CLUTTER_PAN_ACTION (gobject);
- ClutterPanActionPrivate *priv = self->priv;
-
- switch (prop_id)
- {
- case PROP_PAN_AXIS:
- g_value_set_enum (value, priv->pan_axis);
- break;
-
- case PROP_INTERPOLATE :
- g_value_set_boolean (value, priv->should_interpolate);
- break;
-
- case PROP_DECELERATION :
- g_value_set_double (value, priv->deceleration_rate);
- break;
-
- case PROP_ACCELERATION_FACTOR :
- g_value_set_double (value, priv->acceleration_factor);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- }
-}
-
-static void
-clutter_pan_action_constructed (GObject *gobject)
-{
- ClutterGestureAction *gesture;
- ClutterGestureTriggerEdge edge;
-
- gesture = CLUTTER_GESTURE_ACTION (gobject);
- edge = CLUTTER_GESTURE_TRIGGER_EDGE_AFTER;
- clutter_gesture_action_set_threshold_trigger_edge (gesture, edge);
-}
-
-static void
-clutter_pan_action_dispose (GObject *gobject)
-{
- ClutterPanActionPrivate *priv = CLUTTER_PAN_ACTION (gobject)->priv;
-
- g_clear_object (&priv->deceleration_timeline);
-
- G_OBJECT_CLASS (clutter_pan_action_parent_class)->dispose (gobject);
-}
-
-static void
-clutter_pan_action_set_actor (ClutterActorMeta *meta,
- ClutterActor *actor)
-{
- ClutterPanAction *self = CLUTTER_PAN_ACTION (meta);
- ClutterPanActionPrivate *priv = self->priv;
- ClutterActor *old_actor;
-
- old_actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (self));
- if (old_actor != actor)
- {
- /* make sure we reset the state */
- if (priv->state == PAN_STATE_INTERPOLATING)
- g_clear_object (&priv->deceleration_timeline);
- else if (priv->deceleration_timeline)
- clutter_timeline_set_actor (priv->deceleration_timeline, actor);
- }
-
- CLUTTER_ACTOR_META_CLASS (clutter_pan_action_parent_class)->set_actor (meta,
- actor);
-}
-
-
-static void
-clutter_pan_action_class_init (ClutterPanActionClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
- ClutterGestureActionClass *gesture_class =
- CLUTTER_GESTURE_ACTION_CLASS (klass);
-
- klass->pan = clutter_pan_action_real_pan;
-
- gesture_class->gesture_prepare = gesture_prepare;
- gesture_class->gesture_begin = gesture_begin;
- gesture_class->gesture_progress = gesture_progress;
- gesture_class->gesture_cancel = gesture_cancel;
- gesture_class->gesture_end = gesture_end;
-
- meta_class->set_actor = clutter_pan_action_set_actor;
-
- /**
- * ClutterPanAction:pan-axis:
- *
- * Constraints the panning action to the specified axis
- *
- * Since: 1.12
- */
- pan_props[PROP_PAN_AXIS] =
- g_param_spec_enum ("pan-axis",
- P_("Pan Axis"),
- P_("Constraints the panning to an axis"),
- CLUTTER_TYPE_PAN_AXIS,
- CLUTTER_PAN_AXIS_NONE,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterPanAction:interpolate:
- *
- * Whether interpolated events emission is enabled.
- *
- * Since: 1.12
- */
- pan_props[PROP_INTERPOLATE] =
- g_param_spec_boolean ("interpolate",
- P_("Interpolate"),
- P_("Whether interpolated events emission is enabled."),
- FALSE,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterPanAction:deceleration:
- *
- * The rate at which the interpolated panning will decelerate in
- *
- * #ClutterPanAction will emit interpolated ::pan events with decreasing
- * scroll deltas, using the rate specified by this property.
- *
- * Since: 1.12
- */
- pan_props[PROP_DECELERATION] =
- g_param_spec_double ("deceleration",
- P_("Deceleration"),
- P_("Rate at which the interpolated panning will decelerate in"),
- FLOAT_EPSILON, 1.0, default_deceleration_rate,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterPanAction:acceleration-factor:
- *
- * The initial acceleration factor
- *
- * The kinetic momentum measured at the time of releasing the pointer will
- * be multiplied by the factor specified by this property before being used
- * to generate interpolated ::pan events.
- *
- * Since: 1.12
- */
- pan_props[PROP_ACCELERATION_FACTOR] =
- g_param_spec_double ("acceleration-factor",
- P_("Initial acceleration factor"),
- P_("Factor applied to the momentum when starting the interpolated phase"),
- 1.0, G_MAXDOUBLE, default_acceleration_factor,
- CLUTTER_PARAM_READWRITE);
-
- gobject_class->constructed = clutter_pan_action_constructed;
- gobject_class->set_property = clutter_pan_action_set_property;
- gobject_class->get_property = clutter_pan_action_get_property;
- gobject_class->dispose = clutter_pan_action_dispose;
- g_object_class_install_properties (gobject_class,
- PROP_LAST,
- pan_props);
-
- /**
- * ClutterPanAction::pan:
- * @action: the #ClutterPanAction that emitted the signal
- * @actor: the #ClutterActor attached to the @action
- * @is_interpolated: if the event is the result of interpolating
- * the motion velocity at the end of the drag
- *
- * The ::pan signal is emitted to keep track of the motion during
- * a pan gesture. @is_interpolated is set to %TRUE during the
- * interpolation phase of the pan, after the drag has ended and
- * the :interpolate property was set to %TRUE.
- *
- * Return value: %TRUE if the pan should continue, and %FALSE if
- * the pan should be cancelled.
- *
- * Since: 1.12
- */
- pan_signals[PAN] =
- g_signal_new (I_("pan"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterPanActionClass, pan),
- _clutter_boolean_continue_accumulator, NULL,
- _clutter_marshal_BOOLEAN__OBJECT_BOOLEAN,
- G_TYPE_BOOLEAN, 2,
- CLUTTER_TYPE_ACTOR,
- G_TYPE_BOOLEAN);
-
- /**
- * ClutterPanAction::pan-stopped:
- * @action: the #ClutterPanAction that emitted the signal
- * @actor: the #ClutterActor attached to the @action
- *
- * The ::pan-stopped signal is emitted at the end of the interpolation
- * phase of the pan action, only when :interpolate is set to %TRUE.
- *
- * Since: 1.12
- */
- pan_signals[PAN_STOPPED] =
- g_signal_new (I_("pan-stopped"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterPanActionClass, pan_stopped),
- NULL, NULL, NULL,
- G_TYPE_NONE, 1,
- CLUTTER_TYPE_ACTOR);
-}
-
-static void
-clutter_pan_action_init (ClutterPanAction *self)
-{
- self->priv = clutter_pan_action_get_instance_private (self);
- self->priv->deceleration_rate = default_deceleration_rate;
- self->priv->acceleration_factor = default_acceleration_factor;
- self->priv->state = PAN_STATE_INACTIVE;
-}
-
-/**
- * clutter_pan_action_new:
- *
- * Creates a new #ClutterPanAction instance
- *
- * Return value: the newly created #ClutterPanAction
- *
- * Since: 1.12
- */
-ClutterAction *
-clutter_pan_action_new (void)
-{
- return g_object_new (CLUTTER_TYPE_PAN_ACTION, NULL);
-}
-
-/**
- * clutter_pan_action_set_pan_axis:
- * @self: a #ClutterPanAction
- * @axis: the axis to constraint the panning to
- *
- * Restricts the panning action to a specific axis
- *
- * Since: 1.12
- */
-void
-clutter_pan_action_set_pan_axis (ClutterPanAction *self,
- ClutterPanAxis axis)
-{
- ClutterPanActionPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_PAN_ACTION (self));
- g_return_if_fail (axis >= CLUTTER_PAN_AXIS_NONE &&
- axis <= CLUTTER_PAN_AXIS_AUTO);
-
- priv = self->priv;
-
- if (priv->pan_axis == axis)
- return;
-
- priv->pan_axis = axis;
-
- g_object_notify_by_pspec (G_OBJECT (self), pan_props[PROP_PAN_AXIS]);
-}
-
-/**
- * clutter_pan_action_get_pan_axis:
- * @self: a #ClutterPanAction
- *
- * Retrieves the axis constraint set by clutter_pan_action_set_pan_axis()
- *
- * Return value: the axis constraint
- *
- * Since: 1.12
- */
-ClutterPanAxis
-clutter_pan_action_get_pan_axis (ClutterPanAction *self)
-{
- g_return_val_if_fail (CLUTTER_IS_PAN_ACTION (self),
- CLUTTER_PAN_AXIS_NONE);
-
- return self->priv->pan_axis;
-}
-
-/**
- * clutter_pan_action_set_interpolate:
- * @self: a #ClutterPanAction
- * @should_interpolate: whether to enable interpolated pan events
- *
- * Sets whether the action should emit interpolated ::pan events
- * after the drag has ended, to emulate the gesture kinetic inertia.
- *
- * Since: 1.12
- */
-void
-clutter_pan_action_set_interpolate (ClutterPanAction *self,
- gboolean should_interpolate)
-{
- ClutterPanActionPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_PAN_ACTION (self));
-
- priv = self->priv;
-
- should_interpolate = !!should_interpolate;
-
- if (priv->should_interpolate == should_interpolate)
- return;
-
- priv->should_interpolate = should_interpolate;
-
- g_object_notify_by_pspec (G_OBJECT (self), pan_props[PROP_INTERPOLATE]);
-}
-
-/**
- * clutter_pan_action_get_interpolate:
- * @self: a #ClutterPanAction
- *
- * Checks if the action should emit ::pan events even after releasing
- * the pointer during a panning gesture, to emulate some kind of
- * kinetic inertia.
- *
- * Return value: %TRUE if interpolated events emission is active.
- *
- * Since: 1.12
- */
-gboolean
-clutter_pan_action_get_interpolate (ClutterPanAction *self)
-{
- g_return_val_if_fail (CLUTTER_IS_PAN_ACTION (self),
- FALSE);
-
- return self->priv->should_interpolate;
-}
-
-/**
- * clutter_pan_action_set_deceleration:
- * @self: A #ClutterPanAction
- * @rate: The deceleration rate
- *
- * Sets the deceleration rate of the interpolated ::pan events generated
- * after a pan gesture. This is approximately the value that the momentum
- * at the time of releasing the pointer is divided by every 60th of a second.
- *
- * Since: 1.12
- */
-void
-clutter_pan_action_set_deceleration (ClutterPanAction *self,
- gdouble rate)
-{
- g_return_if_fail (CLUTTER_IS_PAN_ACTION (self));
- g_return_if_fail (rate <= 1.0);
- g_return_if_fail (rate > 0.0);
-
- self->priv->deceleration_rate = rate;
- g_object_notify_by_pspec (G_OBJECT (self), pan_props[PROP_DECELERATION]);
-}
-
-/**
- * clutter_pan_action_get_deceleration:
- * @self: A #ClutterPanAction
- *
- * Retrieves the deceleration rate of interpolated ::pan events.
- *
- * Return value: The deceleration rate of the interpolated events.
- *
- * Since: 1.12
- */
-gdouble
-clutter_pan_action_get_deceleration (ClutterPanAction *self)
-{
- g_return_val_if_fail (CLUTTER_IS_PAN_ACTION (self), 0.95);
- return self->priv->deceleration_rate;
-}
-
-/**
- * clutter_pan_action_set_acceleration_factor:
- * @self: A #ClutterPanAction
- * @factor: The acceleration factor
- *
- * Factor applied to the momentum velocity at the time of releasing the
- * pointer when generating interpolated ::pan events.
- *
- * Since: 1.12
- */
-void
-clutter_pan_action_set_acceleration_factor (ClutterPanAction *self,
- gdouble factor)
-{
- g_return_if_fail (CLUTTER_IS_PAN_ACTION (self));
- g_return_if_fail (factor >= 0.0);
-
- self->priv->acceleration_factor = factor;
- g_object_notify_by_pspec (G_OBJECT (self), pan_props[PROP_ACCELERATION_FACTOR]);
-}
-
-/**
- * clutter_pan_action_get_acceleration_factor:
- * @self: A #ClutterPanAction
- *
- * Retrieves the initial acceleration factor for interpolated ::pan events.
- *
- * Return value: The initial acceleration factor for interpolated events.
- *
- * Since: 1.12
- */
-gdouble
-clutter_pan_action_get_acceleration_factor (ClutterPanAction *self)
-{
- g_return_val_if_fail (CLUTTER_IS_PAN_ACTION (self), 1.0);
- return self->priv->acceleration_factor;
-}
-
-/**
- * clutter_pan_action_get_interpolated_coords:
- * @self: A #ClutterPanAction
- * @interpolated_x: (out) (allow-none): return location for the latest
- * interpolated event's X coordinate
- * @interpolated_y: (out) (allow-none): return location for the latest
- * interpolated event's Y coordinate
- *
- * Retrieves the coordinates, in stage space, of the latest interpolated
- * event, analogous to clutter_gesture_action_get_motion_coords().
- *
- * Since: 1.12
- */
-void
-clutter_pan_action_get_interpolated_coords (ClutterPanAction *self,
- gfloat *interpolated_x,
- gfloat *interpolated_y)
-{
- ClutterPanActionPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_PAN_ACTION (self));
-
- priv = self->priv;
-
- if (interpolated_x)
- *interpolated_x = priv->release_x + priv->interpolated_x;
-
- if (interpolated_y)
- *interpolated_y = priv->release_y + priv->interpolated_y;
-}
-
-/**
- * clutter_pan_action_get_interpolated_delta:
- * @self: A #ClutterPanAction
- * @delta_x: (out) (allow-none): return location for the X delta since
- * the latest interpolated event
- * @delta_y: (out) (allow-none): return location for the Y delta since
- * the latest interpolated event
- *
- * Retrieves the delta, in stage space, since the latest interpolated
- * event, analogous to clutter_gesture_action_get_motion_delta().
- *
- * Return value: the distance since the latest interpolated event
- *
- * Since: 1.12
- */
-gfloat
-clutter_pan_action_get_interpolated_delta (ClutterPanAction *self,
- gfloat *delta_x,
- gfloat *delta_y)
-{
- ClutterPanActionPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_PAN_ACTION (self), 0.0f);
-
- priv = self->priv;
-
- if (delta_x)
- *delta_x = priv->dx;
-
- if (delta_y)
- *delta_y = priv->dy;
-
- return sqrt ((priv->dx * priv->dx) + (priv->dy * priv->dy));
-}
-
-/**
- * clutter_pan_action_get_constrained_motion_delta:
- * @self: A #ClutterPanAction
- * @point: the touch point index, with 0 being the first touch
- * point received by the action
- * @delta_x: (out) (optional): return location for the X delta
- * @delta_y: (out) (optional): return location for the Y delta
- *
- * Retrieves the delta, in stage space, dependent on the current state
- * of the #ClutterPanAction, and respecting the constraint specified by the
- * #ClutterPanAction:pan-axis property.
- *
- * Return value: the distance since last motion event
- *
- * Since: 1.24
- */
-gfloat
-clutter_pan_action_get_constrained_motion_delta (ClutterPanAction *self,
- guint point,
- gfloat *out_delta_x,
- gfloat *out_delta_y)
-{
- ClutterPanActionPrivate *priv;
- gfloat delta_x = 0.f, delta_y = 0.f, distance;
-
- g_return_val_if_fail (CLUTTER_IS_PAN_ACTION (self), 0.0f);
-
- priv = self->priv;
-
- distance = clutter_pan_action_get_motion_delta (self, point,
- &delta_x,
- &delta_y);
-
- switch (priv->pan_axis)
- {
- case CLUTTER_PAN_AXIS_NONE:
- break;
-
- case CLUTTER_PAN_AXIS_AUTO:
- if (priv->pin_state == SCROLL_PINNED_VERTICAL)
- delta_x = 0.0f;
- else if (priv->pin_state == SCROLL_PINNED_HORIZONTAL)
- delta_y = 0.0f;
- break;
-
- case CLUTTER_PAN_X_AXIS:
- delta_y = 0.0f;
- break;
-
- case CLUTTER_PAN_Y_AXIS:
- delta_x = 0.0f;
- break;
- }
-
- if (out_delta_x)
- *out_delta_x = delta_x;
-
- if (out_delta_y)
- *out_delta_y = delta_y;
-
- return distance;
-}
-
-/**
- * clutter_pan_action_get_motion_delta:
- * @self: A #ClutterPanAction
- * @point: the touch point index, with 0 being the first touch
- * point received by the action
- * @delta_x: (out) (allow-none): return location for the X delta
- * @delta_y: (out) (allow-none): return location for the Y delta
- *
- * Retrieves the delta, in stage space, dependent on the current state
- * of the #ClutterPanAction. If it is inactive, both fields will be
- * set to 0. If it is panning by user action, the values will be equivalent
- * to those returned by clutter_gesture_action_get_motion_delta().
- * If it is interpolating with some form of kinetic scrolling, the values
- * will be equivalent to those returned by
- * clutter_pan_action_get_interpolated_delta(). This is a convenience
- * method designed to be used in replacement "pan" signal handlers.
- *
- * Since: 1.14
- */
-gfloat
-clutter_pan_action_get_motion_delta (ClutterPanAction *self,
- guint point,
- gfloat *delta_x,
- gfloat *delta_y)
-{
- ClutterPanActionPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_PAN_ACTION (self), 0.0f);
-
- priv = self->priv;
-
- switch (priv->state)
- {
- case PAN_STATE_INACTIVE:
- if (delta_x)
- *delta_x = 0;
-
- if (delta_y)
- *delta_y = 0;
-
- return 0;
- case PAN_STATE_PANNING:
- return clutter_gesture_action_get_motion_delta (CLUTTER_GESTURE_ACTION (self),
- point, delta_x, delta_y);
- case PAN_STATE_INTERPOLATING:
- return clutter_pan_action_get_interpolated_delta (self, delta_x, delta_y);
- default:
- g_assert_not_reached ();
- return 0.0f;
- }
-}
-
-/**
- * clutter_pan_action_get_motion_coords:
- * @self: A #ClutterPanAction
- * @point: the touch point index, with 0 being the first touch
- * point received by the action
- * @motion_x: (out) (allow-none): return location for the X coordinate
- * @motion_y: (out) (allow-none): return location for the Y coordinate
- *
- * Retrieves the coordinates, in stage space, dependent on the current state
- * of the #ClutterPanAction. If it is inactive, both fields will be
- * set to 0. If it is panning by user action, the values will be equivalent
- * to those returned by clutter_gesture_action_get_motion_coords().
- * If it is interpolating with some form of kinetic scrolling, the values
- * will be equivalent to those returned by
- * clutter_pan_action_get_interpolated_coords(). This is a convenience
- * method designed to be used in replacement "pan" signal handlers.
- *
- * Since: 1.14
- */
-void
-clutter_pan_action_get_motion_coords (ClutterPanAction *self,
- guint point,
- gfloat *motion_x,
- gfloat *motion_y)
-{
- ClutterPanActionPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_PAN_ACTION (self));
-
- priv = self->priv;
-
- switch (priv->state)
- {
- case PAN_STATE_INACTIVE:
- if (motion_x)
- *motion_x = 0;
-
- if (motion_y)
- *motion_y = 0;
- break;
- case PAN_STATE_PANNING:
- clutter_gesture_action_get_motion_coords (CLUTTER_GESTURE_ACTION (self),
- point, motion_x, motion_y);
- break;
- case PAN_STATE_INTERPOLATING:
- clutter_pan_action_get_interpolated_coords (self, motion_x, motion_y);
- break;
- default:
- g_assert_not_reached ();
- }
-}
diff --git a/clutter/clutter/clutter-pan-action.h b/clutter/clutter/clutter-pan-action.h
deleted file mode 100644
index 64115b69b..000000000
--- a/clutter/clutter/clutter-pan-action.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- * Copyright (C) 2011 Robert Bosch Car Multimedia GmbH.
- * Copyright (C) 2012 Collabora Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emanuele Aina <emanuele.aina@collabora.com>
- *
- * Based on ClutterDragAction, ClutterSwipeAction, and MxKineticScrollView,
- * written by:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- * Tomeu Vizoso <tomeu.vizoso@collabora.co.uk>
- * Chris Lord <chris@linux.intel.com>
- */
-
-#ifndef __CLUTTER_PAN_ACTION_H__
-#define __CLUTTER_PAN_ACTION_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-gesture-action.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_PAN_ACTION (clutter_pan_action_get_type ())
-#define CLUTTER_PAN_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_PAN_ACTION, ClutterPanAction))
-#define CLUTTER_IS_PAN_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_PAN_ACTION))
-#define CLUTTER_PAN_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_PAN_ACTION, ClutterPanActionClass))
-#define CLUTTER_IS_PAN_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_PAN_ACTION))
-#define CLUTTER_PAN_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_PAN_ACTION, ClutterPanActionClass))
-
-typedef struct _ClutterPanAction ClutterPanAction;
-typedef struct _ClutterPanActionPrivate ClutterPanActionPrivate;
-typedef struct _ClutterPanActionClass ClutterPanActionClass;
-
-/**
- * ClutterPanAction:
- *
- * The #ClutterPanAction structure contains
- * only private data and should be accessed using the provided API
- *
- * Since: 1.12
- */
-struct _ClutterPanAction
-{
- /*< private >*/
- ClutterGestureAction parent_instance;
-
- ClutterPanActionPrivate *priv;
-};
-
-/**
- * ClutterPanActionClass:
- * @pan: class handler for the #ClutterPanAction::pan signal
- * @pan_stopped: class handler for the #ClutterPanAction::pan-stopped signal
- *
- * The #ClutterPanActionClass structure contains
- * only private data.
- *
- * Since: 1.12
- */
-struct _ClutterPanActionClass
-{
- /*< private >*/
- ClutterGestureActionClass parent_class;
-
- /*< public >*/
- gboolean (* pan) (ClutterPanAction *action,
- ClutterActor *actor,
- gboolean is_interpolated);
- void (* pan_stopped) (ClutterPanAction *action,
- ClutterActor *actor);
-
- /*< private >*/
- void (* _clutter_pan_action1) (void);
- void (* _clutter_pan_action2) (void);
- void (* _clutter_pan_action3) (void);
- void (* _clutter_pan_action4) (void);
- void (* _clutter_pan_action5) (void);
- void (* _clutter_pan_action6) (void);
-};
-
-CLUTTER_EXPORT
-GType clutter_pan_action_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterAction * clutter_pan_action_new (void);
-CLUTTER_EXPORT
-void clutter_pan_action_set_pan_axis (ClutterPanAction *self,
- ClutterPanAxis axis);
-CLUTTER_EXPORT
-ClutterPanAxis clutter_pan_action_get_pan_axis (ClutterPanAction *self);
-CLUTTER_EXPORT
-void clutter_pan_action_set_interpolate (ClutterPanAction *self,
- gboolean should_interpolate);
-CLUTTER_EXPORT
-gboolean clutter_pan_action_get_interpolate (ClutterPanAction *self);
-CLUTTER_EXPORT
-void clutter_pan_action_set_deceleration (ClutterPanAction *self,
- gdouble rate);
-CLUTTER_EXPORT
-gdouble clutter_pan_action_get_deceleration (ClutterPanAction *self);
-CLUTTER_EXPORT
-void clutter_pan_action_set_acceleration_factor (ClutterPanAction *self,
- gdouble factor);
-CLUTTER_EXPORT
-gdouble clutter_pan_action_get_acceleration_factor (ClutterPanAction *self);
-CLUTTER_EXPORT
-void clutter_pan_action_get_interpolated_coords (ClutterPanAction *self,
- gfloat *interpolated_x,
- gfloat *interpolated_y);
-CLUTTER_EXPORT
-gfloat clutter_pan_action_get_interpolated_delta (ClutterPanAction *self,
- gfloat *delta_x,
- gfloat *delta_y);
-CLUTTER_EXPORT
-gfloat clutter_pan_action_get_motion_delta (ClutterPanAction *self,
- guint point,
- gfloat *delta_x,
- gfloat *delta_y);
-CLUTTER_EXPORT
-void clutter_pan_action_get_motion_coords (ClutterPanAction *self,
- guint point,
- gfloat *motion_x,
- gfloat *motion_y);
-CLUTTER_EXPORT
-gfloat clutter_pan_action_get_constrained_motion_delta (ClutterPanAction *self,
- guint point,
- gfloat *delta_x,
- gfloat *delta_y);
-G_END_DECLS
-
-#endif /* __CLUTTER_PAN_ACTION_H__ */
diff --git a/clutter/clutter/clutter-path-constraint.c b/clutter/clutter/clutter-path-constraint.c
deleted file mode 100644
index b2eb918db..000000000
--- a/clutter/clutter/clutter-path-constraint.c
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-path-constraint
- * @Title: ClutterPathConstraint
- * @Short_Description: A constraint that follows a path
- *
- * #ClutterPathConstraint is a simple constraint that modifies the allocation
- * of the #ClutterActor to which it has been applied using a #ClutterPath.
- *
- * By setting the #ClutterPathConstraint:offset property it is possible to
- * control how far along the path the #ClutterActor should be.
- *
- * ClutterPathConstraint is available since Clutter 1.6.
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-path-constraint.h"
-
-#include "clutter-debug.h"
-#include "clutter-marshal.h"
-#include "clutter-private.h"
-
-#define CLUTTER_PATH_CONSTRAINT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_PATH_CONSTRAINT, ClutterPathConstraintClass))
-#define CLUTTER_IS_PATH_CONSTRAINT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_PATH_CONSTRAINT))
-#define CLUTTER_PATH_CONSTRAINT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_PATH_CONSTRAINT, ClutterPathConstraintClass))
-
-struct _ClutterPathConstraint
-{
- ClutterConstraint parent_instance;
-
- ClutterPath *path;
-
- gfloat offset;
-
- ClutterActor *actor;
-
- guint current_node;
-};
-
-struct _ClutterPathConstraintClass
-{
- ClutterConstraintClass parent_class;
-};
-
-enum
-{
- PROP_0,
-
- PROP_PATH,
- PROP_OFFSET,
-
- LAST_PROPERTY
-};
-
-enum
-{
- NODE_REACHED,
-
- LAST_SIGNAL
-};
-
-G_DEFINE_TYPE (ClutterPathConstraint, clutter_path_constraint, CLUTTER_TYPE_CONSTRAINT);
-
-static GParamSpec *path_properties[LAST_PROPERTY] = { NULL, };
-static guint path_signals[LAST_SIGNAL] = { 0, };
-
-static void
-clutter_path_constraint_update_allocation (ClutterConstraint *constraint,
- ClutterActor *actor,
- ClutterActorBox *allocation)
-{
- ClutterPathConstraint *self = CLUTTER_PATH_CONSTRAINT (constraint);
- gfloat width, height;
- ClutterKnot position;
- guint knot_id;
-
- if (self->path == NULL)
- return;
-
- knot_id = clutter_path_get_position (self->path, self->offset, &position);
- clutter_actor_box_get_size (allocation, &width, &height);
- allocation->x1 = position.x;
- allocation->y1 = position.y;
- allocation->x2 = allocation->x1 + width;
- allocation->y2 = allocation->y1 + height;
-
- if (knot_id != self->current_node)
- {
- self->current_node = knot_id;
- g_signal_emit (self, path_signals[NODE_REACHED], 0,
- self->actor,
- self->current_node);
- }
-}
-
-static void
-clutter_path_constraint_set_actor (ClutterActorMeta *meta,
- ClutterActor *new_actor)
-{
- ClutterPathConstraint *path = CLUTTER_PATH_CONSTRAINT (meta);
- ClutterActorMetaClass *parent;
-
- /* store the pointer to the actor, for later use */
- path->actor = new_actor;
-
- parent = CLUTTER_ACTOR_META_CLASS (clutter_path_constraint_parent_class);
- parent->set_actor (meta, new_actor);
-}
-
-static void
-clutter_path_constraint_dispose (GObject *gobject)
-{
- ClutterPathConstraint *self = CLUTTER_PATH_CONSTRAINT (gobject);
-
- if (self->path != NULL)
- {
- g_object_unref (self->path);
- self->path = NULL;
- }
-
- G_OBJECT_CLASS (clutter_path_constraint_parent_class)->dispose (gobject);
-}
-
-static void
-clutter_path_constraint_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterPathConstraint *self = CLUTTER_PATH_CONSTRAINT (gobject);
-
- switch (prop_id)
- {
- case PROP_PATH:
- clutter_path_constraint_set_path (self, g_value_get_object (value));
- break;
-
- case PROP_OFFSET:
- clutter_path_constraint_set_offset (self, g_value_get_float (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- }
-}
-
-static void
-clutter_path_constraint_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterPathConstraint *self = CLUTTER_PATH_CONSTRAINT (gobject);
-
- switch (prop_id)
- {
- case PROP_PATH:
- g_value_set_object (value, self->path);
- break;
-
- case PROP_OFFSET:
- g_value_set_float (value, self->offset);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- }
-}
-
-static void
-clutter_path_constraint_class_init (ClutterPathConstraintClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
- ClutterConstraintClass *constraint_class = CLUTTER_CONSTRAINT_CLASS (klass);
-
- /**
- * ClutterPathConstraint:path:
- *
- * The #ClutterPath used to constrain the position of an actor.
- *
- * Since: 1.6
- */
- path_properties[PROP_PATH] =
- g_param_spec_object ("path",
- P_("Path"),
- P_("The path used to constrain an actor"),
- CLUTTER_TYPE_PATH,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterPathConstraint:offset:
- *
- * The offset along the #ClutterPathConstraint:path, between -1.0 and 2.0.
- *
- * Since: 1.6
- */
- path_properties[PROP_OFFSET] =
- g_param_spec_float ("offset",
- P_("Offset"),
- P_("The offset along the path, between -1.0 and 2.0"),
- -1.0, 2.0,
- 0.0,
- CLUTTER_PARAM_READWRITE);
-
- gobject_class->set_property = clutter_path_constraint_set_property;
- gobject_class->get_property = clutter_path_constraint_get_property;
- gobject_class->dispose = clutter_path_constraint_dispose;
- g_object_class_install_properties (gobject_class,
- LAST_PROPERTY,
- path_properties);
-
- meta_class->set_actor = clutter_path_constraint_set_actor;
-
- constraint_class->update_allocation = clutter_path_constraint_update_allocation;
-
- /**
- * ClutterPathConstraint::node-reached:
- * @constraint: the #ClutterPathConstraint that emitted the signal
- * @actor: the #ClutterActor using the @constraint
- * @index: the index of the node that has been reached
- *
- * The ::node-reached signal is emitted each time a
- * #ClutterPathConstraint:offset value results in the actor
- * passing a #ClutterPathNode
- *
- * Since: 1.6
- */
- path_signals[NODE_REACHED] =
- g_signal_new (I_("node-reached"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- _clutter_marshal_VOID__OBJECT_UINT,
- G_TYPE_NONE, 2,
- CLUTTER_TYPE_ACTOR,
- G_TYPE_UINT);
-}
-
-static void
-clutter_path_constraint_init (ClutterPathConstraint *self)
-{
- self->offset = 0.0f;
- self->current_node = G_MAXUINT;
-}
-
-/**
- * clutter_path_constraint_new:
- * @path: (allow-none): a #ClutterPath, or %NULL
- * @offset: the offset along the #ClutterPath
- *
- * Creates a new #ClutterPathConstraint with the given @path and @offset
- *
- * Return value: the newly created #ClutterPathConstraint
- *
- * Since: 1.6
- */
-ClutterConstraint *
-clutter_path_constraint_new (ClutterPath *path,
- gfloat offset)
-{
- g_return_val_if_fail (path == NULL || CLUTTER_IS_PATH (path), NULL);
-
- return g_object_new (CLUTTER_TYPE_PATH_CONSTRAINT,
- "path", path,
- "offset", offset,
- NULL);
-}
-
-/**
- * clutter_path_constraint_set_path:
- * @constraint: a #ClutterPathConstraint
- * @path: (allow-none): a #ClutterPath
- *
- * Sets the @path to be followed by the #ClutterPathConstraint.
- *
- * The @constraint will take ownership of the #ClutterPath passed to this
- * function.
- *
- * Since: 1.6
- */
-void
-clutter_path_constraint_set_path (ClutterPathConstraint *constraint,
- ClutterPath *path)
-{
- g_return_if_fail (CLUTTER_IS_PATH_CONSTRAINT (constraint));
- g_return_if_fail (path == NULL || CLUTTER_IS_PATH (path));
-
- if (constraint->path == path)
- return;
-
- if (constraint->path != NULL)
- {
- g_object_unref (constraint->path);
- constraint->path = NULL;
- }
-
- if (path != NULL)
- constraint->path = g_object_ref_sink (path);
-
- if (constraint->actor != NULL)
- clutter_actor_queue_relayout (constraint->actor);
-
- g_object_notify_by_pspec (G_OBJECT (constraint), path_properties[PROP_PATH]);
-}
-
-/**
- * clutter_path_constraint_get_path:
- * @constraint: a #ClutterPathConstraint
- *
- * Retrieves a pointer to the #ClutterPath used by @constraint.
- *
- * Return value: (transfer none): the #ClutterPath used by the
- * #ClutterPathConstraint, or %NULL. The returned #ClutterPath is owned
- * by the constraint and it should not be unreferenced
- *
- * Since: 1.6
- */
-ClutterPath *
-clutter_path_constraint_get_path (ClutterPathConstraint *constraint)
-{
- g_return_val_if_fail (CLUTTER_IS_PATH_CONSTRAINT (constraint), NULL);
-
- return constraint->path;
-}
-
-/**
- * clutter_path_constraint_set_offset:
- * @constraint: a #ClutterPathConstraint
- * @offset: the offset along the path
- *
- * Sets the offset along the #ClutterPath used by @constraint.
- *
- * Since: 1.6
- */
-void
-clutter_path_constraint_set_offset (ClutterPathConstraint *constraint,
- gfloat offset)
-{
- g_return_if_fail (CLUTTER_IS_PATH_CONSTRAINT (constraint));
-
- if (constraint->offset == offset)
- return;
-
- constraint->offset = offset;
-
- if (constraint->actor != NULL)
- clutter_actor_queue_relayout (constraint->actor);
-
- g_object_notify_by_pspec (G_OBJECT (constraint), path_properties[PROP_OFFSET]);
-}
-
-/**
- * clutter_path_constraint_get_offset:
- * @constraint: a #ClutterPathConstraint
- *
- * Retrieves the offset along the #ClutterPath used by @constraint.
- *
- * Return value: the offset
- *
- * Since: 1.6
- */
-gfloat
-clutter_path_constraint_get_offset (ClutterPathConstraint *constraint)
-{
- g_return_val_if_fail (CLUTTER_IS_PATH_CONSTRAINT (constraint), 0.0);
-
- return constraint->offset;
-}
diff --git a/clutter/clutter/clutter-path-constraint.h b/clutter/clutter/clutter-path-constraint.h
deleted file mode 100644
index cd66a0350..000000000
--- a/clutter/clutter/clutter-path-constraint.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_PATH_CONSTRAINT_H__
-#define __CLUTTER_PATH_CONSTRAINT_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-constraint.h>
-#include <clutter/clutter-path.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_PATH_CONSTRAINT (clutter_path_constraint_get_type ())
-#define CLUTTER_PATH_CONSTRAINT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_PATH_CONSTRAINT, ClutterPathConstraint))
-#define CLUTTER_IS_PATH_CONSTRAINT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_PATH_CONSTRAINT))
-
-/**
- * ClutterPathConstraint:
- *
- * #ClutterPathConstraint is an opaque structure
- * whose members cannot be directly accessed
- *
- * Since: 1.6
- */
-typedef struct _ClutterPathConstraint ClutterPathConstraint;
-typedef struct _ClutterPathConstraintClass ClutterPathConstraintClass;
-
-CLUTTER_EXPORT
-GType clutter_path_constraint_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterConstraint *clutter_path_constraint_new (ClutterPath *path,
- gfloat offset);
-
-CLUTTER_EXPORT
-void clutter_path_constraint_set_path (ClutterPathConstraint *constraint,
- ClutterPath *path);
-CLUTTER_EXPORT
-ClutterPath * clutter_path_constraint_get_path (ClutterPathConstraint *constraint);
-CLUTTER_EXPORT
-void clutter_path_constraint_set_offset (ClutterPathConstraint *constraint,
- gfloat offset);
-CLUTTER_EXPORT
-gfloat clutter_path_constraint_get_offset (ClutterPathConstraint *constraint);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_PATH_CONSTRAINT_H__ */
diff --git a/clutter/clutter/clutter-path.c b/clutter/clutter/clutter-path.c
deleted file mode 100644
index fba788df2..000000000
--- a/clutter/clutter/clutter-path.c
+++ /dev/null
@@ -1,1593 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- *
- * Copyright (C) 2008 Intel Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * SECTION:clutter-path
- * @short_description: An object describing a path with straight lines
- * and bezier curves.
- *
- * A #ClutterPath contains a description of a path consisting of
- * straight lines and bezier curves.
- *
- * The path consists of a series of nodes. Each node is one of the
- * following four types:
- *
- * - %CLUTTER_PATH_MOVE_TO, changes the position of the path to the
- * given pair of coordinates. This is usually used as the first node
- * of a path to mark the start position. If it is used in the middle
- * of a path then the path will be disjoint and the actor will appear
- * to jump to the new position when animated.
- * - %CLUTTER_PATH_LINE_TO, creates a straight line from the previous
- * point to the given point.
- * - %CLUTTER_PATH_CURVE_TO, creates a bezier curve. The end of the
- * last node is used as the first control point and the three
- * subsequent coordinates given in the node as used as the other three.
- * -%CLUTTER_PATH_CLOSE, creates a straight line from the last node to
- * the last %CLUTTER_PATH_MOVE_TO node. This can be used to close a
- * path so that it will appear as a loop when animated.
- *
- * The first three types have the corresponding relative versions
- * %CLUTTER_PATH_REL_MOVE_TO, %CLUTTER_PATH_REL_LINE_TO and
- * %CLUTTER_PATH_REL_CURVE_TO. These are exactly the same except the
- * coordinates are given relative to the previous node instead of as
- * direct screen positions.
- *
- * You can build a path using the node adding functions such as
- * clutter_path_add_line_to(). Alternatively the path can be described
- * in a string using a subset of the SVG path syntax. See
- * clutter_path_add_string() for details.
- *
- * #ClutterPath is available since Clutter 1.0
- */
-
-#include "clutter-build-config.h"
-
-#include <string.h>
-#include <stdarg.h>
-#include <math.h>
-#include <glib-object.h>
-
-#include "clutter-path.h"
-#include "clutter-types.h"
-#include "clutter-bezier.h"
-#include "clutter-private.h"
-
-#define CLUTTER_PATH_NODE_TYPE_IS_VALID(t) \
- ((((t) & ~CLUTTER_PATH_RELATIVE) >= CLUTTER_PATH_MOVE_TO \
- && ((t) & ~CLUTTER_PATH_RELATIVE) <= CLUTTER_PATH_CURVE_TO) \
- || (t) == CLUTTER_PATH_CLOSE)
-
-enum
-{
- PROP_0,
-
- PROP_DESCRIPTION,
- PROP_LENGTH,
-
- PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST];
-
-typedef struct _ClutterPathNodeFull ClutterPathNodeFull;
-
-struct _ClutterPathNodeFull
-{
- ClutterPathNode k;
-
- ClutterBezier *bezier;
-
- guint length;
-};
-
-struct _ClutterPathPrivate
-{
- GSList *nodes, *nodes_tail;
- gboolean nodes_dirty;
-
- guint total_length;
-};
-
-/* Character tests that don't pay attention to the locale */
-#define clutter_path_isspace(ch) memchr (" \f\n\r\t\v", (ch), 6)
-#define clutter_path_isdigit(ch) ((ch) >= '0' && (ch) <= '9')
-
-static ClutterPathNodeFull *clutter_path_node_full_new (void);
-static void clutter_path_node_full_free (ClutterPathNodeFull *node);
-
-static void clutter_path_finalize (GObject *object);
-
-static void clutter_value_transform_path_string (const GValue *src,
- GValue *dest);
-static void clutter_value_transform_string_path (const GValue *src,
- GValue *dest);
-
-G_DEFINE_BOXED_TYPE (ClutterPathNode, clutter_path_node,
- clutter_path_node_copy,
- clutter_path_node_free);
-
-G_DEFINE_TYPE_WITH_CODE (ClutterPath,
- clutter_path,
- G_TYPE_INITIALLY_UNOWNED,
- G_ADD_PRIVATE (ClutterPath)
- CLUTTER_REGISTER_VALUE_TRANSFORM_TO (G_TYPE_STRING, clutter_value_transform_path_string)
- CLUTTER_REGISTER_VALUE_TRANSFORM_FROM (G_TYPE_STRING, clutter_value_transform_string_path));
-
-static void
-clutter_path_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterPath *path = CLUTTER_PATH (gobject);
-
- switch (prop_id)
- {
- case PROP_DESCRIPTION:
- g_value_take_string (value, clutter_path_get_description (path));
- break;
- case PROP_LENGTH:
- g_value_set_uint (value, clutter_path_get_length (path));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_path_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterPath *path = CLUTTER_PATH (gobject);
-
- switch (prop_id)
- {
- case PROP_DESCRIPTION:
- if (!clutter_path_set_description (path, g_value_get_string (value)))
- g_warning ("Invalid path description");
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_path_class_init (ClutterPathClass *klass)
-{
- GObjectClass *gobject_class = (GObjectClass *) klass;
- GParamSpec *pspec;
-
- gobject_class->get_property = clutter_path_get_property;
- gobject_class->set_property = clutter_path_set_property;
- gobject_class->finalize = clutter_path_finalize;
-
- pspec = g_param_spec_string ("description",
- "Description",
- "SVG-style description of the path",
- "",
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_DESCRIPTION] = pspec;
- g_object_class_install_property (gobject_class, PROP_DESCRIPTION, pspec);
-
- pspec = g_param_spec_uint ("length",
- "Length",
- "An approximation of the total length "
- "of the path.",
- 0, G_MAXUINT, 0,
- CLUTTER_PARAM_READABLE);
- obj_props[PROP_LENGTH] = pspec;
- g_object_class_install_property (gobject_class, PROP_LENGTH, pspec);
-}
-
-static void
-clutter_path_init (ClutterPath *self)
-{
- self->priv = clutter_path_get_instance_private (self);
-}
-
-static void
-clutter_value_transform_path_string (const GValue *src,
- GValue *dest)
-{
- gchar *string = clutter_path_get_description (src->data[0].v_pointer);
-
- g_value_take_string (dest, string);
-}
-
-static void
-clutter_value_transform_string_path (const GValue *src,
- GValue *dest)
-{
- ClutterPath *new_path;
-
- new_path = clutter_path_new_with_description (g_value_get_string (src));
- g_value_take_object (dest, new_path);
-}
-
-static void
-clutter_path_finalize (GObject *object)
-{
- ClutterPath *self = (ClutterPath *) object;
-
- clutter_path_clear (self);
-
- G_OBJECT_CLASS (clutter_path_parent_class)->finalize (object);
-}
-
-/**
- * clutter_path_new:
- *
- * Creates a new #ClutterPath instance with no nodes.
- *
- * Return value: the newly created #ClutterPath
- *
- * Since: 1.0
- */
-ClutterPath *
-clutter_path_new (void)
-{
- ClutterPath *self = g_object_new (CLUTTER_TYPE_PATH, NULL);
-
- return self;
-}
-
-/**
- * clutter_path_new_with_description:
- * @desc: a string describing the path
- *
- * Creates a new #ClutterPath instance with the nodes described in
- * @desc. See clutter_path_add_string() for details of the format of
- * the string.
- *
- * Return value: the newly created #ClutterPath
- *
- * Since: 1.0
- */
-ClutterPath *
-clutter_path_new_with_description (const gchar *desc)
-{
- return g_object_new (CLUTTER_TYPE_PATH,
- "description", desc,
- NULL);
-}
-
-/**
- * clutter_path_clear:
- * @path: a #ClutterPath
- *
- * Removes all nodes from the path.
- *
- * Since: 1.0
- */
-void
-clutter_path_clear (ClutterPath *path)
-{
- ClutterPathPrivate *priv = path->priv;
-
- g_slist_free_full (priv->nodes, (GDestroyNotify) clutter_path_node_full_free);
-
- priv->nodes = priv->nodes_tail = NULL;
- priv->nodes_dirty = TRUE;
-}
-
-/* Takes ownership of the node */
-static void
-clutter_path_add_node_full (ClutterPath *path,
- ClutterPathNodeFull *node)
-{
- ClutterPathPrivate *priv = path->priv;
- GSList *new_node;
-
- new_node = g_slist_prepend (NULL, node);
-
- if (priv->nodes_tail == NULL)
- priv->nodes = new_node;
- else
- priv->nodes_tail->next = new_node;
-
- priv->nodes_tail = new_node;
-
- priv->nodes_dirty = TRUE;
-}
-
-/* Helper function to make the rest of the add_* functions shorter */
-static void
-clutter_path_add_node_helper (ClutterPath *path,
- ClutterPathNodeType type,
- int num_coords,
- ...)
-{
- ClutterPathNodeFull *node;
- int i;
- va_list ap;
-
- node = clutter_path_node_full_new ();
-
- node->k.type = type;
-
- va_start (ap, num_coords);
-
- for (i = 0; i < num_coords; i++)
- {
- node->k.points[i].x = va_arg (ap, gint);
- node->k.points[i].y = va_arg (ap, gint);
- }
-
- va_end (ap);
-
- clutter_path_add_node_full (path, node);
-}
-
-/**
- * clutter_path_add_move_to:
- * @path: a #ClutterPath
- * @x: the x coordinate
- * @y: the y coordinate
- *
- * Adds a %CLUTTER_PATH_MOVE_TO type node to the path. This is usually
- * used as the first node in a path. It can also be used in the middle
- * of the path to cause the actor to jump to the new coordinate.
- *
- * Since: 1.0
- */
-void
-clutter_path_add_move_to (ClutterPath *path,
- gint x,
- gint y)
-{
- g_return_if_fail (CLUTTER_IS_PATH (path));
-
- clutter_path_add_node_helper (path, CLUTTER_PATH_MOVE_TO, 1, x, y);
-}
-
-/**
- * clutter_path_add_rel_move_to:
- * @path: a #ClutterPath
- * @x: the x coordinate
- * @y: the y coordinate
- *
- * Same as clutter_path_add_move_to() except the coordinates are
- * relative to the previous node.
- *
- * Since: 1.0
- */
-void
-clutter_path_add_rel_move_to (ClutterPath *path,
- gint x,
- gint y)
-{
- g_return_if_fail (CLUTTER_IS_PATH (path));
-
- clutter_path_add_node_helper (path, CLUTTER_PATH_REL_MOVE_TO, 1, x, y);
-}
-
-/**
- * clutter_path_add_line_to:
- * @path: a #ClutterPath
- * @x: the x coordinate
- * @y: the y coordinate
- *
- * Adds a %CLUTTER_PATH_LINE_TO type node to the path. This causes the
- * actor to move to the new coordinates in a straight line.
- *
- * Since: 1.0
- */
-void
-clutter_path_add_line_to (ClutterPath *path,
- gint x,
- gint y)
-{
- g_return_if_fail (CLUTTER_IS_PATH (path));
-
- clutter_path_add_node_helper (path, CLUTTER_PATH_LINE_TO, 1, x, y);
-}
-
-/**
- * clutter_path_add_rel_line_to:
- * @path: a #ClutterPath
- * @x: the x coordinate
- * @y: the y coordinate
- *
- * Same as clutter_path_add_line_to() except the coordinates are
- * relative to the previous node.
- *
- * Since: 1.0
- */
-void
-clutter_path_add_rel_line_to (ClutterPath *path,
- gint x,
- gint y)
-{
- g_return_if_fail (CLUTTER_IS_PATH (path));
-
- clutter_path_add_node_helper (path, CLUTTER_PATH_REL_LINE_TO, 1, x, y);
-}
-
-/**
- * clutter_path_add_curve_to:
- * @path: a #ClutterPath
- * @x_1: the x coordinate of the first control point
- * @y_1: the y coordinate of the first control point
- * @x_2: the x coordinate of the second control point
- * @y_2: the y coordinate of the second control point
- * @x_3: the x coordinate of the third control point
- * @y_3: the y coordinate of the third control point
- *
- * Adds a %CLUTTER_PATH_CURVE_TO type node to the path. This causes
- * the actor to follow a bezier from the last node to (@x_3, @y_3) using
- * (@x_1, @y_1) and (@x_2,@y_2) as control points.
- *
- * Since: 1.0
- */
-void
-clutter_path_add_curve_to (ClutterPath *path,
- gint x_1,
- gint y_1,
- gint x_2,
- gint y_2,
- gint x_3,
- gint y_3)
-{
- g_return_if_fail (CLUTTER_IS_PATH (path));
-
- clutter_path_add_node_helper (path, CLUTTER_PATH_CURVE_TO, 3,
- x_1, y_1,
- x_2, y_2,
- x_3, y_3);
-}
-
-/**
- * clutter_path_add_rel_curve_to:
- * @path: a #ClutterPath
- * @x_1: the x coordinate of the first control point
- * @y_1: the y coordinate of the first control point
- * @x_2: the x coordinate of the second control point
- * @y_2: the y coordinate of the second control point
- * @x_3: the x coordinate of the third control point
- * @y_3: the y coordinate of the third control point
- *
- * Same as clutter_path_add_curve_to() except the coordinates are
- * relative to the previous node.
- *
- * Since: 1.0
- */
-void
-clutter_path_add_rel_curve_to (ClutterPath *path,
- gint x_1,
- gint y_1,
- gint x_2,
- gint y_2,
- gint x_3,
- gint y_3)
-{
- g_return_if_fail (CLUTTER_IS_PATH (path));
-
- clutter_path_add_node_helper (path, CLUTTER_PATH_REL_CURVE_TO, 3,
- x_1, y_1,
- x_2, y_2,
- x_3, y_3);
-}
-
-/**
- * clutter_path_add_close:
- * @path: a #ClutterPath
- *
- * Adds a %CLUTTER_PATH_CLOSE type node to the path. This creates a
- * straight line from the last node to the last %CLUTTER_PATH_MOVE_TO
- * type node.
- *
- * Since: 1.0
- */
-void
-clutter_path_add_close (ClutterPath *path)
-{
- g_return_if_fail (CLUTTER_IS_PATH (path));
-
- clutter_path_add_node_helper (path, CLUTTER_PATH_CLOSE, 0);
-}
-
-static gboolean
-clutter_path_parse_number (const gchar **pin,
- gboolean allow_comma,
- gint *ret)
-{
- gint val = 0;
- gboolean negative = FALSE;
- gint digit_count = 0;
- const gchar *p = *pin;
-
- /* Skip leading spaces */
- while (clutter_path_isspace (*p))
- p++;
-
- /* Optional comma */
- if (allow_comma && *p == ',')
- {
- p++;
- while (clutter_path_isspace (*p))
- p++;
- }
-
- /* Optional sign */
- if (*p == '+')
- p++;
- else if (*p == '-')
- {
- negative = TRUE;
- p++;
- }
-
- /* Some digits */
- while (clutter_path_isdigit (*p))
- {
- val = val * 10 + *p - '0';
- digit_count++;
- p++;
- }
-
- /* We need at least one digit */
- if (digit_count < 1)
- return FALSE;
-
- /* Optional fractional part which we ignore */
- if (*p == '.')
- {
- p++;
- digit_count = 0;
- while (clutter_path_isdigit (*p))
- {
- digit_count++;
- p++;
- }
- /* If there is a fractional part then it also needs at least one
- digit */
- if (digit_count < 1)
- return FALSE;
- }
-
- *pin = p;
- *ret = negative ? -val : val;
-
- return TRUE;
-}
-
-static gboolean
-clutter_path_parse_description (const gchar *p,
- GSList **ret)
-{
- ClutterPathNodeFull *node;
- GSList *nodes = NULL;
-
- if (p == NULL || *p == '\0')
- return FALSE;
-
- while (TRUE)
- {
- /* Skip leading whitespace */
- while (clutter_path_isspace (*p))
- p++;
-
- /* It is not an error to end now */
- if (*p == '\0')
- break;
-
- switch (*p)
- {
- case 'M':
- case 'm':
- case 'L':
- case 'l':
- node = clutter_path_node_full_new ();
- nodes = g_slist_prepend (nodes, node);
-
- node->k.type = (*p == 'M' ? CLUTTER_PATH_MOVE_TO :
- *p == 'm' ? CLUTTER_PATH_REL_MOVE_TO :
- *p == 'L' ? CLUTTER_PATH_LINE_TO :
- CLUTTER_PATH_REL_LINE_TO);
- p++;
-
- if (!clutter_path_parse_number (&p, FALSE, &node->k.points[0].x) ||
- !clutter_path_parse_number (&p, TRUE, &node->k.points[0].y))
- goto fail;
- break;
-
- case 'C':
- case 'c':
- node = clutter_path_node_full_new ();
- nodes = g_slist_prepend (nodes, node);
-
- node->k.type = (*p == 'C' ? CLUTTER_PATH_CURVE_TO :
- CLUTTER_PATH_REL_CURVE_TO);
- p++;
-
- if (!clutter_path_parse_number (&p, FALSE, &node->k.points[0].x) ||
- !clutter_path_parse_number (&p, TRUE, &node->k.points[0].y) ||
- !clutter_path_parse_number (&p, TRUE, &node->k.points[1].x) ||
- !clutter_path_parse_number (&p, TRUE, &node->k.points[1].y) ||
- !clutter_path_parse_number (&p, TRUE, &node->k.points[2].x) ||
- !clutter_path_parse_number (&p, TRUE, &node->k.points[2].y))
- goto fail;
- break;
-
- case 'Z':
- case 'z':
- node = clutter_path_node_full_new ();
- nodes = g_slist_prepend (nodes, node);
- p++;
-
- node->k.type = CLUTTER_PATH_CLOSE;
- break;
-
- default:
- goto fail;
- }
- }
-
- *ret = g_slist_reverse (nodes);
- return TRUE;
-
- fail:
- g_slist_free_full (nodes, (GDestroyNotify) clutter_path_node_full_free);
- return FALSE;
-}
-
-/* Takes ownership of the node list */
-static void
-clutter_path_add_nodes (ClutterPath *path,
- GSList *nodes)
-{
- ClutterPathPrivate *priv = path->priv;
-
- if (priv->nodes_tail == NULL)
- priv->nodes = nodes;
- else
- priv->nodes_tail->next = nodes;
-
- while (nodes)
- {
- priv->nodes_tail = nodes;
- nodes = nodes->next;
- }
-
- priv->nodes_dirty = TRUE;
-}
-
-/**
- * clutter_path_add_string:
- * @path: a #ClutterPath
- * @str: a string describing the new nodes
- *
- * Adds new nodes to the end of the path as described in @str. The
- * format is a subset of the SVG path format. Each node is represented
- * by a letter and is followed by zero, one or three pairs of
- * coordinates. The coordinates can be separated by spaces or a
- * comma. The types are:
- *
- * - `M`: Adds a %CLUTTER_PATH_MOVE_TO node. Takes one pair of coordinates.
- * - `L`: Adds a %CLUTTER_PATH_LINE_TO node. Takes one pair of coordinates.
- * - `C`: Adds a %CLUTTER_PATH_CURVE_TO node. Takes three pairs of coordinates.
- * - `z`: Adds a %CLUTTER_PATH_CLOSE node. No coordinates are needed.
- *
- * The M, L and C commands can also be specified in lower case which
- * means the coordinates are relative to the previous node.
- *
- * For example, to move an actor in a 100 by 100 pixel square centered
- * on the point 300,300 you could use the following path:
- *
- * |[
- * M 250,350 l 0 -100 L 350,250 l 0 100 z
- * ]|
- *
- * If the path description isn't valid %FALSE will be returned and no
- * nodes will be added.
- *
- * Return value: %TRUE is the path description was valid or %FALSE
- * otherwise.
- *
- * Since: 1.0
- */
-gboolean
-clutter_path_add_string (ClutterPath *path,
- const gchar *str)
-{
- GSList *nodes;
-
- g_return_val_if_fail (CLUTTER_IS_PATH (path), FALSE);
- g_return_val_if_fail (str != NULL, FALSE);
-
- if (clutter_path_parse_description (str, &nodes))
- {
- clutter_path_add_nodes (path, nodes);
-
- return TRUE;
- }
- else
- return FALSE;
-}
-
-/**
- * clutter_path_add_node:
- * @path: a #ClutterPath
- * @node: a #ClutterPathNode
- *
- * Adds @node to the end of the path.
- *
- * Since: 1.0
- */
-void
-clutter_path_add_node (ClutterPath *path,
- const ClutterPathNode *node)
-{
- ClutterPathNodeFull *node_full;
-
- g_return_if_fail (CLUTTER_IS_PATH (path));
- g_return_if_fail (node != NULL);
- g_return_if_fail (CLUTTER_PATH_NODE_TYPE_IS_VALID (node->type));
-
- node_full = clutter_path_node_full_new ();
- node_full->k = *node;
-
- clutter_path_add_node_full (path, node_full);
-}
-
-/**
- * clutter_path_add_cairo_path:
- * @path: a #ClutterPath
- * @cpath: a Cairo path
- *
- * Add the nodes of the Cairo path to the end of @path.
- *
- * Since: 1.0
- */
-void
-clutter_path_add_cairo_path (ClutterPath *path,
- const cairo_path_t *cpath)
-{
- int num_data;
- const cairo_path_data_t *p;
-
- g_return_if_fail (CLUTTER_IS_PATH (path));
- g_return_if_fail (cpath != NULL);
-
- /* Iterate over each command in the cairo path */
- for (num_data = cpath->num_data, p = cpath->data;
- num_data > 0;
- num_data -= p->header.length, p += p->header.length)
- {
- switch (p->header.type)
- {
- case CAIRO_PATH_MOVE_TO:
- g_assert (p->header.length >= 2);
-
- clutter_path_add_move_to (path, p[1].point.x, p[1].point.y);
- break;
-
- case CAIRO_PATH_LINE_TO:
- g_assert (p->header.length >= 2);
-
- clutter_path_add_line_to (path, p[1].point.x, p[1].point.y);
- break;
-
- case CAIRO_PATH_CURVE_TO:
- g_assert (p->header.length >= 4);
-
- clutter_path_add_curve_to (path,
- p[1].point.x, p[1].point.y,
- p[2].point.x, p[2].point.y,
- p[3].point.x, p[3].point.y);
- break;
-
- case CAIRO_PATH_CLOSE_PATH:
- clutter_path_add_close (path);
- }
- }
-}
-
-static void
-clutter_path_add_node_to_cairo_path (const ClutterPathNode *node,
- gpointer data)
-{
- cairo_t *cr = data;
-
- switch (node->type)
- {
- case CLUTTER_PATH_MOVE_TO:
- cairo_move_to (cr, node->points[0].x, node->points[0].y);
- break;
-
- case CLUTTER_PATH_LINE_TO:
- cairo_line_to (cr, node->points[0].x, node->points[0].y);
- break;
-
- case CLUTTER_PATH_CURVE_TO:
- cairo_curve_to (cr,
- node->points[0].x, node->points[0].y,
- node->points[1].x, node->points[1].y,
- node->points[2].x, node->points[2].y);
- break;
-
- case CLUTTER_PATH_REL_MOVE_TO:
- cairo_rel_move_to (cr, node->points[0].x, node->points[0].y);
- break;
-
- case CLUTTER_PATH_REL_LINE_TO:
- cairo_rel_line_to (cr, node->points[0].x, node->points[0].y);
- break;
-
- case CLUTTER_PATH_REL_CURVE_TO:
- cairo_rel_curve_to (cr,
- node->points[0].x, node->points[0].y,
- node->points[1].x, node->points[1].y,
- node->points[2].x, node->points[2].y);
- break;
-
- case CLUTTER_PATH_CLOSE:
- cairo_close_path (cr);
- }
-}
-
-/**
- * clutter_path_to_cairo_path:
- * @path: a #ClutterPath
- * @cr: a Cairo context
- *
- * Add the nodes of the ClutterPath to the path in the Cairo context.
- *
- * Since: 1.0
- */
-void
-clutter_path_to_cairo_path (ClutterPath *path,
- cairo_t *cr)
-{
- g_return_if_fail (CLUTTER_IS_PATH (path));
- g_return_if_fail (cr != NULL);
-
- clutter_path_foreach (path, clutter_path_add_node_to_cairo_path, cr);
-}
-
-/**
- * clutter_path_get_n_nodes:
- * @path: a #ClutterPath
- *
- * Retrieves the number of nodes in the path.
- *
- * Return value: the number of nodes.
- *
- * Since: 1.0
- */
-guint
-clutter_path_get_n_nodes (ClutterPath *path)
-{
- ClutterPathPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_PATH (path), 0);
-
- priv = path->priv;
-
- return g_slist_length (priv->nodes);
-}
-
-/**
- * clutter_path_get_node:
- * @path: a #ClutterPath
- * @index_: the node number to retrieve
- * @node: (out): a location to store a copy of the node
- *
- * Retrieves the node of the path indexed by @index.
- *
- * Since: 1.0
- */
-void
-clutter_path_get_node (ClutterPath *path,
- guint index_,
- ClutterPathNode *node)
-{
- ClutterPathNodeFull *node_full;
- ClutterPathPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_PATH (path));
-
- priv = path->priv;
-
- node_full = g_slist_nth_data (priv->nodes, index_);
-
- g_return_if_fail (node_full != NULL);
-
- *node = node_full->k;
-}
-
-/**
- * clutter_path_get_nodes:
- * @path: a #ClutterPath
- *
- * Returns a #GSList of #ClutterPathNode<!-- -->s. The list should be
- * freed with g_slist_free(). The nodes are owned by the path and
- * should not be freed. Altering the path may cause the nodes in the
- * list to become invalid so you should copy them if you want to keep
- * the list.
- *
- * Return value: (transfer container) (element-type Clutter.PathNode): a
- * list of nodes in the path.
- *
- * Since: 1.0
- */
-GSList *
-clutter_path_get_nodes (ClutterPath *path)
-{
- ClutterPathPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_PATH (path), NULL);
-
- priv = path->priv;
-
- return g_slist_copy (priv->nodes);
-}
-
-/**
- * clutter_path_foreach:
- * @path: a #ClutterPath
- * @callback: (scope call): the function to call with each node
- * @user_data: user data to pass to the function
- *
- * Calls a function for each node of the path.
- *
- * Since: 1.0
- */
-void
-clutter_path_foreach (ClutterPath *path,
- ClutterPathCallback callback,
- gpointer user_data)
-{
- ClutterPathPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_PATH (path));
-
- priv = path->priv;
-
- g_slist_foreach (priv->nodes, (GFunc) callback, user_data);
-}
-
-/**
- * clutter_path_insert_node:
- * @path: a #ClutterPath
- * @index_: offset of where to insert the node
- * @node: the node to insert
- *
- * Inserts @node into the path before the node at the given offset. If
- * @index_ is negative it will append the node to the end of the path.
- *
- * Since: 1.0
- */
-void
-clutter_path_insert_node (ClutterPath *path,
- gint index_,
- const ClutterPathNode *node)
-{
- ClutterPathPrivate *priv;
- ClutterPathNodeFull *node_full;
-
- g_return_if_fail (CLUTTER_IS_PATH (path));
- g_return_if_fail (node != NULL);
- g_return_if_fail (CLUTTER_PATH_NODE_TYPE_IS_VALID (node->type));
-
- priv = path->priv;
-
- node_full = clutter_path_node_full_new ();
- node_full->k = *node;
-
- priv->nodes = g_slist_insert (priv->nodes, node_full, index_);
-
- if (priv->nodes_tail == NULL)
- priv->nodes_tail = priv->nodes;
- else if (priv->nodes_tail->next)
- priv->nodes_tail = priv->nodes_tail->next;
-
- priv->nodes_dirty = TRUE;
-}
-
-/**
- * clutter_path_remove_node:
- * @path: a #ClutterPath
- * @index_: index of the node to remove
- *
- * Removes the node at the given offset from the path.
- *
- * Since: 1.0
- */
-void
-clutter_path_remove_node (ClutterPath *path,
- guint index_)
-{
- ClutterPathPrivate *priv;
- GSList *node, *prev = NULL;
-
- g_return_if_fail (CLUTTER_IS_PATH (path));
-
- priv = path->priv;
-
- for (node = priv->nodes; node && index_--; node = node->next)
- prev = node;
-
- if (node)
- {
- clutter_path_node_full_free (node->data);
-
- if (prev)
- prev->next = node->next;
- else
- priv->nodes = node->next;
-
- if (node == priv->nodes_tail)
- priv->nodes_tail = prev;
-
- g_slist_free_1 (node);
-
- priv->nodes_dirty = TRUE;
- }
-}
-
-/**
- * clutter_path_replace_node:
- * @path: a #ClutterPath
- * @index_: index to the existing node
- * @node: the replacement node
- *
- * Replaces the node at offset @index_ with @node.
- *
- * Since: 1.0
- */
-void
-clutter_path_replace_node (ClutterPath *path,
- guint index_,
- const ClutterPathNode *node)
-{
- ClutterPathPrivate *priv;
- ClutterPathNodeFull *node_full;
-
- g_return_if_fail (CLUTTER_IS_PATH (path));
- g_return_if_fail (node != NULL);
- g_return_if_fail (CLUTTER_PATH_NODE_TYPE_IS_VALID (node->type));
-
- priv = path->priv;
-
- if ((node_full = g_slist_nth_data (priv->nodes, index_)))
- {
- node_full->k = *node;
-
- priv->nodes_dirty = TRUE;
- }
-}
-
-/**
- * clutter_path_set_description:
- * @path: a #ClutterPath
- * @str: a string describing the path
- *
- * Replaces all of the nodes in the path with nodes described by
- * @str. See clutter_path_add_string() for details of the format.
- *
- * If the string is invalid then %FALSE is returned and the path is
- * unaltered.
- *
- * Return value: %TRUE is the path was valid, %FALSE otherwise.
- *
- * Since: 1.0
- */
-gboolean
-clutter_path_set_description (ClutterPath *path,
- const gchar *str)
-{
- GSList *nodes;
-
- g_return_val_if_fail (CLUTTER_IS_PATH (path), FALSE);
- g_return_val_if_fail (str != NULL, FALSE);
-
- if (clutter_path_parse_description (str, &nodes))
- {
- clutter_path_clear (path);
- clutter_path_add_nodes (path, nodes);
-
- return TRUE;
- }
- else
- return FALSE;
-}
-
-/**
- * clutter_path_get_description:
- * @path: a #ClutterPath
- *
- * Returns a newly allocated string describing the path in the same
- * format as used by clutter_path_add_string().
- *
- * Return value: a string description of the path. Free with g_free().
- *
- * Since: 1.0
- */
-gchar *
-clutter_path_get_description (ClutterPath *path)
-{
- ClutterPathPrivate *priv;
- GString *str;
- GSList *l;
-
- g_return_val_if_fail (CLUTTER_IS_PATH (path), NULL);
-
- priv = path->priv;
-
- str = g_string_new ("");
-
- for (l = priv->nodes; l; l = l->next)
- {
- ClutterPathNodeFull *node = l->data;
- gchar letter = '?';
- gint params = 0;
- gint i;
-
- switch (node->k.type)
- {
- case CLUTTER_PATH_MOVE_TO:
- letter = 'M';
- params = 1;
- break;
-
- case CLUTTER_PATH_REL_MOVE_TO:
- letter = 'm';
- params = 1;
- break;
-
- case CLUTTER_PATH_LINE_TO:
- letter = 'L';
- params = 1;
- break;
-
- case CLUTTER_PATH_REL_LINE_TO:
- letter = 'l';
- params = 1;
- break;
-
- case CLUTTER_PATH_CURVE_TO:
- letter = 'C';
- params = 3;
- break;
-
- case CLUTTER_PATH_REL_CURVE_TO:
- letter = 'c';
- params = 3;
- break;
-
- case CLUTTER_PATH_CLOSE:
- letter = 'z';
- params = 0;
- break;
- }
-
- if (str->len > 0)
- g_string_append_c (str, ' ');
- g_string_append_c (str, letter);
-
- for (i = 0; i < params; i++)
- g_string_append_printf (str, " %i %i",
- node->k.points[i].x,
- node->k.points[i].y);
- }
-
- return g_string_free (str, FALSE);
-}
-
-static guint
-clutter_path_node_distance (const ClutterKnot *start,
- const ClutterKnot *end)
-{
- gint64 x_d, y_d;
- float t;
-
- g_return_val_if_fail (start != NULL, 0);
- g_return_val_if_fail (end != NULL, 0);
-
- if (clutter_knot_equal (start, end))
- return 0;
-
- x_d = end->x - start->x;
- y_d = end->y - start->y;
-
- t = floorf (sqrtf ((x_d * x_d) + (y_d * y_d)));
-
- return (guint) t;
-}
-
-static void
-clutter_path_ensure_node_data (ClutterPath *path)
-{
- ClutterPathPrivate *priv = path->priv;
-
- /* Recalculate the nodes data if has changed */
- if (priv->nodes_dirty)
- {
- GSList *l;
- ClutterKnot last_position = { 0, 0 };
- ClutterKnot loop_start = { 0, 0 };
- ClutterKnot points[3];
-
- priv->total_length = 0;
-
- for (l = priv->nodes; l; l = l->next)
- {
- ClutterPathNodeFull *node = l->data;
- gboolean relative = (node->k.type & CLUTTER_PATH_RELATIVE) != 0;
-
- switch (node->k.type & ~CLUTTER_PATH_RELATIVE)
- {
- case CLUTTER_PATH_MOVE_TO:
- node->length = 0;
-
- /* Store the actual position in point[1] */
- if (relative)
- {
- node->k.points[1].x = last_position.x + node->k.points[0].x;
- node->k.points[1].y = last_position.y + node->k.points[0].y;
- }
- else
- node->k.points[1] = node->k.points[0];
-
- last_position = node->k.points[1];
- loop_start = node->k.points[1];
- break;
-
- case CLUTTER_PATH_LINE_TO:
- /* Use point[1] as the start point and point[2] as the end
- point */
- node->k.points[1] = last_position;
-
- if (relative)
- {
- node->k.points[2].x = (node->k.points[1].x
- + node->k.points[0].x);
- node->k.points[2].y = (node->k.points[1].y
- + node->k.points[0].y);
- }
- else
- node->k.points[2] = node->k.points[0];
-
- last_position = node->k.points[2];
-
- node->length = clutter_path_node_distance (node->k.points + 1,
- node->k.points + 2);
- break;
-
- case CLUTTER_PATH_CURVE_TO:
- /* Convert to a bezier curve */
- if (node->bezier == NULL)
- node->bezier = _clutter_bezier_new ();
-
- if (relative)
- {
- int i;
-
- for (i = 0; i < 3; i++)
- {
- points[i].x = last_position.x + node->k.points[i].x;
- points[i].y = last_position.y + node->k.points[i].y;
- }
- }
- else
- memcpy (points, node->k.points, sizeof (ClutterKnot) * 3);
-
- _clutter_bezier_init (node->bezier,
- last_position.x, last_position.y,
- points[0].x, points[0].y,
- points[1].x, points[1].y,
- points[2].x, points[2].y);
-
- last_position = points[2];
-
- node->length = _clutter_bezier_get_length (node->bezier);
-
- break;
-
- case CLUTTER_PATH_CLOSE:
- /* Convert to a line to from last_point to loop_start */
- node->k.points[1] = last_position;
- node->k.points[2] = loop_start;
- last_position = node->k.points[2];
-
- node->length = clutter_path_node_distance (node->k.points + 1,
- node->k.points + 2);
- break;
- }
-
- priv->total_length += node->length;
- }
-
- priv->nodes_dirty = FALSE;
- }
-}
-
-/**
- * clutter_path_get_position:
- * @path: a #ClutterPath
- * @progress: a position along the path as a fraction of its length
- * @position: (out): location to store the position
- *
- * The value in @progress represents a position along the path where
- * 0.0 is the beginning and 1.0 is the end of the path. An
- * interpolated position is then stored in @position.
- *
- * Return value: index of the node used to calculate the position.
- *
- * Since: 1.0
- */
-guint
-clutter_path_get_position (ClutterPath *path,
- gdouble progress,
- ClutterKnot *position)
-{
- ClutterPathPrivate *priv;
- GSList *l;
- guint point_distance, length = 0, node_num = 0;
- ClutterPathNodeFull *node;
-
- g_return_val_if_fail (CLUTTER_IS_PATH (path), 0);
- g_return_val_if_fail (progress >= 0.0 && progress <= 1.0, 0);
-
- priv = path->priv;
-
- clutter_path_ensure_node_data (path);
-
- /* Special case if the path is empty, just return 0,0 for want of
- something better */
- if (priv->nodes == NULL)
- {
- memset (position, 0, sizeof (ClutterKnot));
- return 0;
- }
-
- /* Convert the progress to a length along the path */
- point_distance = progress * priv->total_length;
-
- /* Find the node that covers this point */
- for (l = priv->nodes;
- l->next && point_distance >= (((ClutterPathNodeFull *) l->data)->length
- + length);
- l = l->next)
- {
- length += ((ClutterPathNodeFull *) l->data)->length;
- node_num++;
- }
-
- node = l->data;
-
- /* Convert the point distance to a distance along the node */
- point_distance -= length;
- if (point_distance > node->length)
- point_distance = node->length;
-
- switch (node->k.type & ~CLUTTER_PATH_RELATIVE)
- {
- case CLUTTER_PATH_MOVE_TO:
- *position = node->k.points[1];
- break;
-
- case CLUTTER_PATH_LINE_TO:
- case CLUTTER_PATH_CLOSE:
- if (node->length == 0)
- *position = node->k.points[1];
- else
- {
- position->x = (node->k.points[1].x
- + ((node->k.points[2].x - node->k.points[1].x)
- * (gint) point_distance / (gint) node->length));
- position->y = (node->k.points[1].y
- + ((node->k.points[2].y - node->k.points[1].y)
- * (gint) point_distance / (gint) node->length));
- }
- break;
-
- case CLUTTER_PATH_CURVE_TO:
- if (node->length == 0)
- *position = node->k.points[2];
- else
- {
- _clutter_bezier_advance (node->bezier,
- point_distance * CLUTTER_BEZIER_MAX_LENGTH
- / node->length,
- position);
- }
- break;
- }
-
- return node_num;
-}
-
-/**
- * clutter_path_get_length:
- * @path: a #ClutterPath
- *
- * Retrieves an approximation of the total length of the path.
- *
- * Return value: the length of the path.
- *
- * Since: 1.0
- */
-guint
-clutter_path_get_length (ClutterPath *path)
-{
- g_return_val_if_fail (CLUTTER_IS_PATH (path), 0);
-
- clutter_path_ensure_node_data (path);
-
- return path->priv->total_length;
-}
-
-static ClutterPathNodeFull *
-clutter_path_node_full_new (void)
-{
- return g_new0 (ClutterPathNodeFull, 1);
-}
-
-static void
-clutter_path_node_full_free (ClutterPathNodeFull *node)
-{
- if (node->bezier)
- _clutter_bezier_free (node->bezier);
-
- g_free (node);
-}
-
-/**
- * clutter_path_node_copy:
- * @node: a #ClutterPathNode
- *
- * Makes an allocated copy of a node.
- *
- * Return value: the copied node.
- *
- * Since: 1.0
- */
-ClutterPathNode *
-clutter_path_node_copy (const ClutterPathNode *node)
-{
- return g_memdup2 (node, sizeof (ClutterPathNode));
-}
-
-/**
- * clutter_path_node_free:
- * @node: a #ClutterPathNode
- *
- * Frees the memory of an allocated node.
- *
- * Since: 1.0
- */
-void
-clutter_path_node_free (ClutterPathNode *node)
-{
- if (G_LIKELY (node))
- g_free (node);
-}
-
-/**
- * clutter_path_node_equal:
- * @node_a: First node
- * @node_b: Second node
- *
- * Compares two nodes and checks if they are the same type with the
- * same coordinates.
- *
- * Return value: %TRUE if the nodes are the same.
- *
- * Since: 1.0
- */
-gboolean
-clutter_path_node_equal (const ClutterPathNode *node_a,
- const ClutterPathNode *node_b)
-{
- guint n_points, i;
-
- g_return_val_if_fail (node_a != NULL, FALSE);
- g_return_val_if_fail (node_b != NULL, FALSE);
-
- if (node_a->type != node_b->type)
- return FALSE;
-
- switch (node_a->type & ~CLUTTER_PATH_RELATIVE)
- {
- case CLUTTER_PATH_MOVE_TO: n_points = 1; break;
- case CLUTTER_PATH_LINE_TO: n_points = 1; break;
- case CLUTTER_PATH_CURVE_TO: n_points = 3; break;
- case CLUTTER_PATH_CLOSE: n_points = 0; break;
- default: return FALSE;
- }
-
- for (i = 0; i < n_points; i++)
- if (node_a->points[i].x != node_b->points[i].x
- || node_a->points[i].y != node_b->points[i].y)
- return FALSE;
-
- return TRUE;
-}
-
-G_DEFINE_BOXED_TYPE (ClutterKnot, clutter_knot,
- clutter_knot_copy,
- clutter_knot_free);
-
-/**
- * clutter_knot_copy:
- * @knot: a #ClutterKnot
- *
- * Makes an allocated copy of a knot.
- *
- * Return value: the copied knot.
- *
- * Since: 0.2
- */
-ClutterKnot *
-clutter_knot_copy (const ClutterKnot *knot)
-{
- if (G_UNLIKELY (knot == NULL))
- return NULL;
-
- return g_memdup2 (knot, sizeof (ClutterKnot));
-}
-
-/**
- * clutter_knot_free:
- * @knot: a #ClutterKnot
- *
- * Frees the memory of an allocated knot.
- *
- * Since: 0.2
- */
-void
-clutter_knot_free (ClutterKnot *knot)
-{
- if (G_LIKELY (knot != NULL))
- g_free (knot);
-}
-
-/**
- * clutter_knot_equal:
- * @knot_a: First knot
- * @knot_b: Second knot
- *
- * Compares to knot and checks if the point to the same location.
- *
- * Return value: %TRUE if the knots point to the same location.
- *
- * Since: 0.2
- */
-gboolean
-clutter_knot_equal (const ClutterKnot *knot_a,
- const ClutterKnot *knot_b)
-{
- g_return_val_if_fail (knot_a != NULL, FALSE);
- g_return_val_if_fail (knot_b != NULL, FALSE);
-
- if (knot_a == knot_b)
- return TRUE;
-
- return knot_a->x == knot_b->x && knot_a->y == knot_b->y;
-}
diff --git a/clutter/clutter/clutter-path.h b/clutter/clutter/clutter-path.h
deleted file mode 100644
index 8ec4d93f5..000000000
--- a/clutter/clutter/clutter-path.h
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- *
- * Copyright (C) 2008 Intel Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __CLUTTER_PATH_H__
-#define __CLUTTER_PATH_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <cairo.h>
-#include <clutter/clutter-types.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_PATH (clutter_path_get_type ())
-#define CLUTTER_TYPE_PATH_NODE (clutter_path_node_get_type ())
-#define CLUTTER_PATH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_PATH, ClutterPath))
-#define CLUTTER_PATH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_PATH, ClutterPathClass))
-#define CLUTTER_IS_PATH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_PATH))
-#define CLUTTER_IS_PATH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_PATH))
-#define CLUTTER_PATH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_PATH, ClutterPathClass))
-
-typedef struct _ClutterPathClass ClutterPathClass;
-typedef struct _ClutterPathPrivate ClutterPathPrivate;
-
-/**
- * ClutterPathCallback:
- * @node: the node
- * @data: (closure): optional data passed to the function
- *
- * This function is passed to clutter_path_foreach() and will be
- * called for each node contained in the path.
- *
- * Since: 1.0
- */
-typedef void (* ClutterPathCallback) (const ClutterPathNode *node,
- gpointer data);
-
-/**
- * ClutterPath:
- *
- * The #ClutterPath struct contains only private data and should
- * be accessed with the functions below.
- *
- * Since: 1.0
- */
-struct _ClutterPath
-{
- /*< private >*/
- GInitiallyUnowned parent;
-
- ClutterPathPrivate *priv;
-};
-
-/**
- * ClutterPathClass:
- *
- * The #ClutterPathClass struct contains only private data.
- *
- * Since: 1.0
- */
-struct _ClutterPathClass
-{
- /*< private >*/
- GInitiallyUnownedClass parent_class;
-};
-
-CLUTTER_EXPORT
-GType clutter_path_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterPath *clutter_path_new (void);
-CLUTTER_EXPORT
-ClutterPath *clutter_path_new_with_description (const gchar *desc);
-CLUTTER_EXPORT
-void clutter_path_add_move_to (ClutterPath *path,
- gint x,
- gint y);
-CLUTTER_EXPORT
-void clutter_path_add_rel_move_to (ClutterPath *path,
- gint x,
- gint y);
-CLUTTER_EXPORT
-void clutter_path_add_line_to (ClutterPath *path,
- gint x,
- gint y);
-CLUTTER_EXPORT
-void clutter_path_add_rel_line_to (ClutterPath *path,
- gint x,
- gint y);
-CLUTTER_EXPORT
-void clutter_path_add_curve_to (ClutterPath *path,
- gint x_1,
- gint y_1,
- gint x_2,
- gint y_2,
- gint x_3,
- gint y_3);
-CLUTTER_EXPORT
-void clutter_path_add_rel_curve_to (ClutterPath *path,
- gint x_1,
- gint y_1,
- gint x_2,
- gint y_2,
- gint x_3,
- gint y_3);
-CLUTTER_EXPORT
-void clutter_path_add_close (ClutterPath *path);
-CLUTTER_EXPORT
-gboolean clutter_path_add_string (ClutterPath *path,
- const gchar *str);
-CLUTTER_EXPORT
-void clutter_path_add_node (ClutterPath *path,
- const ClutterPathNode *node);
-CLUTTER_EXPORT
-void clutter_path_add_cairo_path (ClutterPath *path,
- const cairo_path_t *cpath);
-CLUTTER_EXPORT
-guint clutter_path_get_n_nodes (ClutterPath *path);
-CLUTTER_EXPORT
-void clutter_path_get_node (ClutterPath *path,
- guint index_,
- ClutterPathNode *node);
-CLUTTER_EXPORT
-GSList * clutter_path_get_nodes (ClutterPath *path);
-CLUTTER_EXPORT
-void clutter_path_foreach (ClutterPath *path,
- ClutterPathCallback callback,
- gpointer user_data);
-CLUTTER_EXPORT
-void clutter_path_insert_node (ClutterPath *path,
- gint index_,
- const ClutterPathNode *node);
-CLUTTER_EXPORT
-void clutter_path_remove_node (ClutterPath *path,
- guint index_);
-CLUTTER_EXPORT
-void clutter_path_replace_node (ClutterPath *path,
- guint index_,
- const ClutterPathNode *node);
-CLUTTER_EXPORT
-gchar * clutter_path_get_description (ClutterPath *path);
-CLUTTER_EXPORT
-gboolean clutter_path_set_description (ClutterPath *path,
- const gchar *str);
-CLUTTER_EXPORT
-void clutter_path_clear (ClutterPath *path);
-CLUTTER_EXPORT
-void clutter_path_to_cairo_path (ClutterPath *path,
- cairo_t *cr);
-CLUTTER_EXPORT
-guint clutter_path_get_position (ClutterPath *path,
- gdouble progress,
- ClutterKnot *position);
-CLUTTER_EXPORT
-guint clutter_path_get_length (ClutterPath *path);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_PATH_H__ */
diff --git a/clutter/clutter/clutter-pick-context-private.h b/clutter/clutter/clutter-pick-context-private.h
deleted file mode 100644
index f40de6f3d..000000000
--- a/clutter/clutter/clutter-pick-context-private.h
+++ /dev/null
@@ -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_PICK_CONTEXT_PRIVATE_H
-#define CLUTTER_PICK_CONTEXT_PRIVATE_H
-
-#include "clutter-pick-context.h"
-#include "clutter-pick-stack-private.h"
-
-ClutterPickContext *
-clutter_pick_context_new_for_view (ClutterStageView *view,
- ClutterPickMode mode,
- const graphene_point3d_t *point,
- const graphene_ray_t *ray);
-
-ClutterPickStack *
-clutter_pick_context_steal_stack (ClutterPickContext *pick_context);
-
-gboolean
-clutter_pick_context_intersects_box (ClutterPickContext *pick_context,
- const graphene_box_t *box);
-
-#endif /* CLUTTER_PICK_CONTEXT_PRIVATE_H */
diff --git a/clutter/clutter/clutter-pick-context.c b/clutter/clutter/clutter-pick-context.c
deleted file mode 100644
index 2f054d318..000000000
--- a/clutter/clutter/clutter-pick-context.c
+++ /dev/null
@@ -1,199 +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/>.
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-backend.h"
-#include "clutter-pick-context-private.h"
-
-struct _ClutterPickContext
-{
- grefcount ref_count;
-
- ClutterPickMode mode;
- ClutterPickStack *pick_stack;
-
- graphene_ray_t ray;
- graphene_point3d_t point;
-};
-
-G_DEFINE_BOXED_TYPE (ClutterPickContext, clutter_pick_context,
- clutter_pick_context_ref,
- clutter_pick_context_unref)
-
-ClutterPickContext *
-clutter_pick_context_new_for_view (ClutterStageView *view,
- ClutterPickMode mode,
- const graphene_point3d_t *point,
- const graphene_ray_t *ray)
-{
- ClutterPickContext *pick_context;
- CoglContext *context;
-
- pick_context = g_new0 (ClutterPickContext, 1);
- g_ref_count_init (&pick_context->ref_count);
- pick_context->mode = mode;
- graphene_ray_init_from_ray (&pick_context->ray, ray);
- graphene_point3d_init_from_point (&pick_context->point, point);
-
- context = clutter_backend_get_cogl_context (clutter_get_default_backend ());
- pick_context->pick_stack = clutter_pick_stack_new (context);
-
- return pick_context;
-}
-
-ClutterPickContext *
-clutter_pick_context_ref (ClutterPickContext *pick_context)
-{
- g_ref_count_inc (&pick_context->ref_count);
- return pick_context;
-}
-
-static void
-clutter_pick_context_dispose (ClutterPickContext *pick_context)
-{
- g_clear_pointer (&pick_context->pick_stack, clutter_pick_stack_unref);
-}
-
-void
-clutter_pick_context_unref (ClutterPickContext *pick_context)
-{
- if (g_ref_count_dec (&pick_context->ref_count))
- {
- clutter_pick_context_dispose (pick_context);
- g_free (pick_context);
- }
-}
-
-void
-clutter_pick_context_destroy (ClutterPickContext *pick_context)
-{
- clutter_pick_context_dispose (pick_context);
- clutter_pick_context_unref (pick_context);
-}
-
-/**
- * clutter_pick_context_get_mode: (skip)
- */
-ClutterPickMode
-clutter_pick_context_get_mode (ClutterPickContext *pick_context)
-{
- return pick_context->mode;
-}
-
-ClutterPickStack *
-clutter_pick_context_steal_stack (ClutterPickContext *pick_context)
-{
- clutter_pick_stack_seal (pick_context->pick_stack);
- return g_steal_pointer (&pick_context->pick_stack);
-}
-
-/**
- * clutter_pick_context_log_pick:
- * @pick_context: a #ClutterPickContext
- * @box: a #ClutterActorBox
- * @actor: a #ClutterActor
- *
- * Logs a pick rectangle into the pick stack.
- */
-void
-clutter_pick_context_log_pick (ClutterPickContext *pick_context,
- const ClutterActorBox *box,
- ClutterActor *actor)
-{
- clutter_pick_stack_log_pick (pick_context->pick_stack, box, actor);
-}
-
-/**
- * clutter_pick_context_push_clip:
- * @pick_context: a #ClutterPickContext
- * @box: a #ClutterActorBox
- *
- * Pushes a clip rectangle defined by @box into the pick stack. Pop with
- * clutter_pick_context_pop_clip() when done.
- */
-void
-clutter_pick_context_push_clip (ClutterPickContext *pick_context,
- const ClutterActorBox *box)
-{
- clutter_pick_stack_push_clip (pick_context->pick_stack, box);
-}
-
-/**
- * clutter_pick_context_pop_clip:
- * @pick_context: a #ClutterPickContext
- *
- * Pops the current clip rectangle from the clip stack. It is a programming
- * error to call this without a corresponding clutter_pick_context_push_clip()
- * call first.
- */
-void
-clutter_pick_context_pop_clip (ClutterPickContext *pick_context)
-{
- clutter_pick_stack_pop_clip (pick_context->pick_stack);
-}
-
-/**
- * clutter_pick_context_push_transform:
- * @pick_context: a #ClutterPickContext
- * @transform: a #graphene_matrix_t
- *
- * Pushes @transform into the pick stack. Pop with
- * clutter_pick_context_pop_transform() when done.
- */
-void
-clutter_pick_context_push_transform (ClutterPickContext *pick_context,
- const graphene_matrix_t *transform)
-{
- clutter_pick_stack_push_transform (pick_context->pick_stack, transform);
-}
-
-/**
- * clutter_pick_context_get_transform:
- * @pick_context: a #ClutterPickContext
- * @out_matrix: (out): a #graphene_matrix_t
- *
- * Retrieves the current transform of the pick stack.
- */
-void
-clutter_pick_context_get_transform (ClutterPickContext *pick_context,
- graphene_matrix_t *out_transform)
-{
- clutter_pick_stack_get_transform (pick_context->pick_stack, out_transform);
-}
-
-/**
- * clutter_pick_context_pop_transform:
- * @pick_context: a #ClutterPickContext
- *
- * Pops the current transform from the clip stack. It is a programming error
- * to call this without a corresponding clutter_pick_context_push_transform()
- * call first.
- */
-void
-clutter_pick_context_pop_transform (ClutterPickContext *pick_context)
-{
- clutter_pick_stack_pop_transform (pick_context->pick_stack);
-}
-
-gboolean
-clutter_pick_context_intersects_box (ClutterPickContext *pick_context,
- const graphene_box_t *box)
-{
- return graphene_box_contains_point (box, &pick_context->point) ||
- graphene_ray_intersects_box (&pick_context->ray, box);
-}
diff --git a/clutter/clutter/clutter-pick-context.h b/clutter/clutter/clutter-pick-context.h
deleted file mode 100644
index 5792be6b5..000000000
--- a/clutter/clutter/clutter-pick-context.h
+++ /dev/null
@@ -1,72 +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_PICK_CONTEXT_H
-#define CLUTTER_PICK_CONTEXT_H
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <glib-object.h>
-
-#include "clutter-macros.h"
-#include "clutter-stage-view.h"
-
-typedef struct _ClutterPickContext ClutterPickContext;
-
-#define CLUTTER_TYPE_PICK_CONTEXT (clutter_pick_context_get_type ())
-
-CLUTTER_EXPORT
-GType clutter_pick_context_get_type (void);
-
-CLUTTER_EXPORT
-ClutterPickContext * clutter_pick_context_ref (ClutterPickContext *pick_context);
-
-CLUTTER_EXPORT
-void clutter_pick_context_unref (ClutterPickContext *pick_context);
-
-CLUTTER_EXPORT
-void clutter_pick_context_destroy (ClutterPickContext *pick_context);
-
-CLUTTER_EXPORT
-ClutterPickMode clutter_pick_context_get_mode (ClutterPickContext *pick_context);
-
-CLUTTER_EXPORT
-void clutter_pick_context_log_pick (ClutterPickContext *pick_context,
- const ClutterActorBox *box,
- ClutterActor *actor);
-
-CLUTTER_EXPORT
-void clutter_pick_context_push_clip (ClutterPickContext *pick_context,
- const ClutterActorBox *box);
-
-CLUTTER_EXPORT
-void clutter_pick_context_pop_clip (ClutterPickContext *pick_context);
-
-CLUTTER_EXPORT
-void clutter_pick_context_push_transform (ClutterPickContext *pick_context,
- const graphene_matrix_t *transform);
-
-CLUTTER_EXPORT
-void clutter_pick_context_get_transform (ClutterPickContext *pick_context,
- graphene_matrix_t *out_matrix);
-
-CLUTTER_EXPORT
-void clutter_pick_context_pop_transform (ClutterPickContext *pick_context);
-
-#endif /* CLUTTER_PICK_CONTEXT_H */
diff --git a/clutter/clutter/clutter-pick-stack-private.h b/clutter/clutter/clutter-pick-stack-private.h
deleted file mode 100644
index 0523fcafe..000000000
--- a/clutter/clutter/clutter-pick-stack-private.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2020 Endless OS Foundation, LLC
- *
- * 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_PICK_STACK_PRIVATE_H
-#define CLUTTER_PICK_STACK_PRIVATE_H
-
-#include <glib-object.h>
-
-#include "clutter-macros.h"
-#include "clutter-stage-view.h"
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_PICK_STACK (clutter_pick_stack_get_type ())
-
-typedef struct _ClutterPickStack ClutterPickStack;
-
-GType clutter_pick_stack_get_type (void) G_GNUC_CONST;
-
-ClutterPickStack * clutter_pick_stack_new (CoglContext *context);
-
-ClutterPickStack * clutter_pick_stack_ref (ClutterPickStack *pick_stack);
-
-void clutter_pick_stack_unref (ClutterPickStack *pick_stack);
-
-void clutter_pick_stack_seal (ClutterPickStack *pick_stack);
-
-void clutter_pick_stack_log_pick (ClutterPickStack *pick_stack,
- const ClutterActorBox *box,
- ClutterActor *actor);
-
-void clutter_pick_stack_push_clip (ClutterPickStack *pick_stack,
- const ClutterActorBox *box);
-
-void clutter_pick_stack_pop_clip (ClutterPickStack *pick_stack);
-
-void clutter_pick_stack_push_transform (ClutterPickStack *pick_stack,
- const graphene_matrix_t *transform);
-
-void clutter_pick_stack_get_transform (ClutterPickStack *pick_stack,
- graphene_matrix_t *out_transform);
-
-void clutter_pick_stack_pop_transform (ClutterPickStack *pick_stack);
-
-ClutterActor *
-clutter_pick_stack_search_actor (ClutterPickStack *pick_stack,
- const graphene_point3d_t *point,
- const graphene_ray_t *ray);
-
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPickStack, clutter_pick_stack_unref)
-
-G_END_DECLS
-
-#endif /* CLUTTER_PICK_STACK_PRIVATE_H */
diff --git a/clutter/clutter/clutter-pick-stack.c b/clutter/clutter/clutter-pick-stack.c
deleted file mode 100644
index 3e56ad704..000000000
--- a/clutter/clutter/clutter-pick-stack.c
+++ /dev/null
@@ -1,436 +0,0 @@
-/*
- * Copyright (C) 2020 Endless OS Foundation, LLC
- * Copyright (C) 2018 Canonical Ltd.
- *
- * 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-pick-stack-private.h"
-#include "clutter-private.h"
-
-typedef struct
-{
- graphene_point3d_t vertices[4];
- CoglMatrixEntry *matrix_entry;
- ClutterActorBox rect;
- gboolean projected;
-} Record;
-
-typedef struct
-{
- Record base;
- ClutterActor *actor;
- int clip_index;
-} PickRecord;
-
-typedef struct
-{
- Record base;
- int prev;
-} PickClipRecord;
-
-struct _ClutterPickStack
-{
- grefcount ref_count;
-
- CoglMatrixStack *matrix_stack;
- GArray *vertices_stack;
- GArray *clip_stack;
- int current_clip_stack_top;
-
- gboolean sealed : 1;
-};
-
-G_DEFINE_BOXED_TYPE (ClutterPickStack, clutter_pick_stack,
- clutter_pick_stack_ref, clutter_pick_stack_unref)
-
-static void
-project_vertices (CoglMatrixEntry *matrix_entry,
- const ClutterActorBox *box,
- graphene_point3d_t vertices[4])
-{
- graphene_matrix_t m;
- int i;
-
- cogl_matrix_entry_get (matrix_entry, &m);
-
- graphene_point3d_init (&vertices[0], box->x1, box->y1, 0.f);
- graphene_point3d_init (&vertices[1], box->x2, box->y1, 0.f);
- graphene_point3d_init (&vertices[2], box->x2, box->y2, 0.f);
- graphene_point3d_init (&vertices[3], box->x1, box->y2, 0.f);
-
- for (i = 0; i < 4; i++)
- {
- float w = 1.f;
-
- cogl_graphene_matrix_project_point (&m,
- &vertices[i].x,
- &vertices[i].y,
- &vertices[i].z,
- &w);
- }
-}
-
-static void
-maybe_project_record (Record *rec)
-{
- if (!rec->projected)
- {
- project_vertices (rec->matrix_entry, &rec->rect, rec->vertices);
- rec->projected = TRUE;
- }
-}
-
-static inline gboolean
-is_axis_aligned_2d_rectangle (const graphene_point3d_t vertices[4])
-{
- int i;
-
- for (i = 0; i < 4; i++)
- {
- if (!G_APPROX_VALUE (vertices[i].z,
- vertices[(i + 1) % 4].z,
- FLT_EPSILON))
- return FALSE;
-
- if (!G_APPROX_VALUE (vertices[i].x,
- vertices[(i + 1) % 4].x,
- FLT_EPSILON) &&
- !G_APPROX_VALUE (vertices[i].y,
- vertices[(i + 1) % 4].y,
- FLT_EPSILON))
- return FALSE;
- }
-
- return TRUE;
-}
-
-static gboolean
-ray_intersects_input_region (Record *rec,
- const graphene_ray_t *ray,
- const graphene_point3d_t *point)
-{
- maybe_project_record (rec);
-
- if (G_LIKELY (is_axis_aligned_2d_rectangle (rec->vertices)))
- {
- graphene_box_t box;
- graphene_box_t right_border;
- graphene_box_t bottom_border;
-
- /* Graphene considers both the start and end coordinates of boxes to be
- * inclusive, while the vertices of a clutter actor are exclusive. So we
- * need to manually exclude hits on these borders
- */
-
- graphene_box_init_from_points (&box, 4, rec->vertices);
- graphene_box_init_from_points (&right_border, 2, rec->vertices + 1);
- graphene_box_init_from_points (&bottom_border, 2, rec->vertices + 2);
-
- /* Fast path for actors without 3D transforms */
- if (graphene_box_contains_point (&box, point))
- {
- return !graphene_box_contains_point (&right_border, point) &&
- !graphene_box_contains_point (&bottom_border, point);
- }
-
- return graphene_ray_intersects_box (ray, &box) &&
- !graphene_ray_intersects_box (ray, &right_border) &&
- !graphene_ray_intersects_box (ray, &bottom_border);
- }
- else
- {
- graphene_triangle_t t0, t1;
-
- /*
- * Degrade the projected quad into the following triangles:
- *
- * 0 -------------- 1
- * | • |
- * | • t0 |
- * | • |
- * | t1 • |
- * | • |
- * 3 -------------- 2
- */
-
- graphene_triangle_init_from_point3d (&t0,
- &rec->vertices[0],
- &rec->vertices[1],
- &rec->vertices[2]);
-
- graphene_triangle_init_from_point3d (&t1,
- &rec->vertices[0],
- &rec->vertices[2],
- &rec->vertices[3]);
-
- return graphene_triangle_contains_point (&t0, point) ||
- graphene_triangle_contains_point (&t1, point) ||
- graphene_ray_intersects_triangle (ray, &t0) ||
- graphene_ray_intersects_triangle (ray, &t1);
- }
-}
-
-static gboolean
-ray_intersects_record (ClutterPickStack *pick_stack,
- PickRecord *rec,
- const graphene_point3d_t *point,
- const graphene_ray_t *ray)
-{
- int clip_index;
-
- if (!ray_intersects_input_region (&rec->base, ray, point))
- return FALSE;
-
- clip_index = rec->clip_index;
- while (clip_index >= 0)
- {
- PickClipRecord *clip =
- &g_array_index (pick_stack->clip_stack, PickClipRecord, clip_index);
-
- if (!ray_intersects_input_region (&clip->base, ray, point))
- return FALSE;
-
- clip_index = clip->prev;
- }
-
- return TRUE;
-}
-
-static void
-add_pick_stack_weak_refs (ClutterPickStack *pick_stack)
-{
- int i;
-
- g_assert (!pick_stack->sealed);
-
- for (i = 0; i < pick_stack->vertices_stack->len; i++)
- {
- PickRecord *rec =
- &g_array_index (pick_stack->vertices_stack, PickRecord, i);
-
- if (rec->actor)
- g_object_add_weak_pointer (G_OBJECT (rec->actor),
- (gpointer) &rec->actor);
- }
-}
-
-static void
-remove_pick_stack_weak_refs (ClutterPickStack *pick_stack)
-{
- int i;
-
- for (i = 0; i < pick_stack->vertices_stack->len; i++)
- {
- PickRecord *rec =
- &g_array_index (pick_stack->vertices_stack, PickRecord, i);
-
- if (rec->actor)
- g_object_remove_weak_pointer (G_OBJECT (rec->actor),
- (gpointer) &rec->actor);
- }
-}
-
-static void
-clutter_pick_stack_dispose (ClutterPickStack *pick_stack)
-{
- remove_pick_stack_weak_refs (pick_stack);
- g_clear_pointer (&pick_stack->matrix_stack, cogl_object_unref);
- g_clear_pointer (&pick_stack->vertices_stack, g_array_unref);
- g_clear_pointer (&pick_stack->clip_stack, g_array_unref);
-}
-
-static void
-clear_pick_record (gpointer data)
-{
- PickRecord *rec = data;
- g_clear_pointer (&rec->base.matrix_entry, cogl_matrix_entry_unref);
-}
-
-static void
-clear_clip_record (gpointer data)
-{
- PickClipRecord *clip = data;
- g_clear_pointer (&clip->base.matrix_entry, cogl_matrix_entry_unref);
-}
-
-/**
- * clutter_pick_stack_new:
- * @context: a #CoglContext
- *
- * Creates a new #ClutterPickStack.
- *
- * Returns: (transfer full): A newly created #ClutterPickStack
- */
-ClutterPickStack *
-clutter_pick_stack_new (CoglContext *context)
-{
- ClutterPickStack *pick_stack;
-
- pick_stack = g_new0 (ClutterPickStack, 1);
- g_ref_count_init (&pick_stack->ref_count);
- pick_stack->matrix_stack = cogl_matrix_stack_new (context);
- pick_stack->vertices_stack = g_array_new (FALSE, FALSE, sizeof (PickRecord));
- pick_stack->clip_stack = g_array_new (FALSE, FALSE, sizeof (PickClipRecord));
- pick_stack->current_clip_stack_top = -1;
-
- g_array_set_clear_func (pick_stack->vertices_stack, clear_pick_record);
- g_array_set_clear_func (pick_stack->clip_stack, clear_clip_record);
-
- return pick_stack;
-}
-
-/**
- * clutter_pick_stack_ref:
- * @pick_stack: A #ClutterPickStack
- *
- * Increments the reference count of @pick_stack by one.
- *
- * Returns: (transfer full): @pick_stack
- */
-ClutterPickStack *
-clutter_pick_stack_ref (ClutterPickStack *pick_stack)
-{
- g_ref_count_inc (&pick_stack->ref_count);
- return pick_stack;
-}
-
-/**
- * clutter_pick_stack_unref:
- * @pick_stack: A #ClutterPickStack
- *
- * Decrements the reference count of @pick_stack by one, freeing the structure
- * when the reference count reaches zero.
- */
-void
-clutter_pick_stack_unref (ClutterPickStack *pick_stack)
-{
- if (g_ref_count_dec (&pick_stack->ref_count))
- {
- clutter_pick_stack_dispose (pick_stack);
- g_free (pick_stack);
- }
-}
-
-void
-clutter_pick_stack_seal (ClutterPickStack *pick_stack)
-{
- g_assert (!pick_stack->sealed);
- add_pick_stack_weak_refs (pick_stack);
- pick_stack->sealed = TRUE;
-}
-
-void
-clutter_pick_stack_log_pick (ClutterPickStack *pick_stack,
- const ClutterActorBox *box,
- ClutterActor *actor)
-{
- PickRecord rec;
-
- g_return_if_fail (actor != NULL);
-
- g_assert (!pick_stack->sealed);
-
- rec.actor = actor;
- rec.clip_index = pick_stack->current_clip_stack_top;
- rec.base.rect = *box;
- rec.base.projected = FALSE;
- rec.base.matrix_entry = cogl_matrix_stack_get_entry (pick_stack->matrix_stack);
- cogl_matrix_entry_ref (rec.base.matrix_entry);
-
- g_array_append_val (pick_stack->vertices_stack, rec);
-}
-
-void
-clutter_pick_stack_push_clip (ClutterPickStack *pick_stack,
- const ClutterActorBox *box)
-{
- PickClipRecord clip;
-
- g_assert (!pick_stack->sealed);
-
- clip.prev = pick_stack->current_clip_stack_top;
- clip.base.rect = *box;
- clip.base.projected = FALSE;
- clip.base.matrix_entry = cogl_matrix_stack_get_entry (pick_stack->matrix_stack);
- cogl_matrix_entry_ref (clip.base.matrix_entry);
-
- g_array_append_val (pick_stack->clip_stack, clip);
- pick_stack->current_clip_stack_top = pick_stack->clip_stack->len - 1;
-}
-
-void
-clutter_pick_stack_pop_clip (ClutterPickStack *pick_stack)
-{
- const PickClipRecord *top;
-
- g_assert (!pick_stack->sealed);
- g_assert (pick_stack->current_clip_stack_top >= 0);
-
- /* Individual elements of clip_stack are not freed. This is so they can
- * be shared as part of a tree of different stacks used by different
- * actors in the pick_stack. The whole clip_stack does however get
- * freed later in clutter_pick_stack_dispose.
- */
-
- top = &g_array_index (pick_stack->clip_stack,
- PickClipRecord,
- pick_stack->current_clip_stack_top);
-
- pick_stack->current_clip_stack_top = top->prev;
-}
-
-void
-clutter_pick_stack_push_transform (ClutterPickStack *pick_stack,
- const graphene_matrix_t *transform)
-{
- cogl_matrix_stack_push (pick_stack->matrix_stack);
- cogl_matrix_stack_multiply (pick_stack->matrix_stack, transform);
-}
-
-void
-clutter_pick_stack_get_transform (ClutterPickStack *pick_stack,
- graphene_matrix_t *out_transform)
-{
- cogl_matrix_stack_get (pick_stack->matrix_stack, out_transform);
-}
-
-void
-clutter_pick_stack_pop_transform (ClutterPickStack *pick_stack)
-{
- cogl_matrix_stack_pop (pick_stack->matrix_stack);
-}
-
-ClutterActor *
-clutter_pick_stack_search_actor (ClutterPickStack *pick_stack,
- const graphene_point3d_t *point,
- const graphene_ray_t *ray)
-{
- int i;
-
- /* Search all "painted" pickable actors from front to back. A linear search
- * is required, and also performs fine since there is typically only
- * on the order of dozens of actors in the list (on screen) at a time.
- */
- for (i = pick_stack->vertices_stack->len - 1; i >= 0; i--)
- {
- PickRecord *rec =
- &g_array_index (pick_stack->vertices_stack, PickRecord, i);
-
- if (rec->actor && ray_intersects_record (pick_stack, rec, point, ray))
- return rec->actor;
- }
-
- return NULL;
-}
diff --git a/clutter/clutter/clutter-private.h b/clutter/clutter/clutter-private.h
deleted file mode 100644
index ccee4c4b6..000000000
--- a/clutter/clutter/clutter-private.h
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- *
- * Copyright (C) 2006 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 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_PRIVATE_H__
-#define __CLUTTER_PRIVATE_H__
-
-#include <string.h>
-#include <glib.h>
-
-#include <cogl-pango/cogl-pango.h>
-
-#include "clutter-backend.h"
-#include "clutter-effect.h"
-#include "clutter-event.h"
-#include "clutter-feature.h"
-#include "clutter-id-pool.h"
-#include "clutter-layout-manager.h"
-#include "clutter-settings.h"
-#include "clutter-stage-manager.h"
-#include "clutter-stage.h"
-
-G_BEGIN_DECLS
-
-typedef struct _ClutterMainContext ClutterMainContext;
-
-#define CLUTTER_REGISTER_VALUE_TRANSFORM_TO(TYPE_TO,func) { \
- g_value_register_transform_func (g_define_type_id, TYPE_TO, func); \
-}
-
-#define CLUTTER_REGISTER_VALUE_TRANSFORM_FROM(TYPE_FROM,func) { \
- g_value_register_transform_func (TYPE_FROM, g_define_type_id, func); \
-}
-
-#define CLUTTER_REGISTER_INTERVAL_PROGRESS(func) { \
- clutter_interval_register_progress_func (g_define_type_id, func); \
-}
-
-#define CLUTTER_PRIVATE_FLAGS(a) (((ClutterActor *) (a))->private_flags)
-#define CLUTTER_SET_PRIVATE_FLAGS(a,f) (CLUTTER_PRIVATE_FLAGS (a) |= (f))
-#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_IN_DESTRUCTION(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_DESTRUCTION) != FALSE)
-#define CLUTTER_ACTOR_IN_PAINT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PAINT) != FALSE)
-#define CLUTTER_ACTOR_IN_PICK(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PICK) != FALSE)
-#define CLUTTER_ACTOR_IN_RELAYOUT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_RELAYOUT) != FALSE)
-#define CLUTTER_ACTOR_IN_PREF_WIDTH(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PREF_WIDTH) != FALSE)
-#define CLUTTER_ACTOR_IN_PREF_HEIGHT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PREF_HEIGHT) != FALSE)
-#define CLUTTER_ACTOR_IN_PREF_SIZE(a) ((CLUTTER_PRIVATE_FLAGS (a) & (CLUTTER_IN_PREF_HEIGHT|CLUTTER_IN_PREF_WIDTH)) != FALSE)
-
-#define CLUTTER_PARAM_READABLE (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)
-#define CLUTTER_PARAM_WRITABLE (G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS)
-#define CLUTTER_PARAM_READWRITE (G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS)
-
-#define CLUTTER_PARAM_ANIMATABLE (1 << G_PARAM_USER_SHIFT)
-
-/* automagic interning of a static string */
-#define I_(str) (g_intern_static_string ((str)))
-
-/* keep this for source compatibility with clutter */
-#define P_(String) (String)
-#define N_(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
- * always be available but also it seems in glibc it is defined as a function
- * call so this macro could end up faster anyway. We can't just add 0.5f
- * because it will break for negative numbers. */
-#define CLUTTER_NEARBYINT(x) ((int) ((x) < 0.0f ? (x) - 0.5f : (x) + 0.5f))
-
-typedef enum
-{
- CLUTTER_ACTOR_UNUSED_FLAG = 0,
-
- CLUTTER_IN_DESTRUCTION = 1 << 0,
- CLUTTER_IS_TOPLEVEL = 1 << 1,
- CLUTTER_IN_PREF_WIDTH = 1 << 3,
- CLUTTER_IN_PREF_HEIGHT = 1 << 4,
-
- /* Used to avoid recursion */
- CLUTTER_IN_PAINT = 1 << 5,
- CLUTTER_IN_PICK = 1 << 6,
-
- /* Used to avoid recursion */
- CLUTTER_IN_RELAYOUT = 1 << 7,
-} ClutterPrivateFlags;
-
-/*
- * ClutterMainContext:
- *
- * The shared state of Clutter
- */
-struct _ClutterMainContext
-{
- /* the main windowing system backend */
- ClutterBackend *backend;
-
- /* the object holding all the stage instances */
- ClutterStageManager *stage_manager;
-
- /* the main event queue */
- GAsyncQueue *events_queue;
-
- /* the event filters added via clutter_event_add_filter. these are
- * ordered from least recently added to most recently added */
- GList *event_filters;
-
- /* default FPS; this is only used if we cannot sync to vblank */
- guint frame_rate;
-
- /* fb bit masks for col<->id mapping in picking */
- gint fb_r_mask;
- gint fb_g_mask;
- gint fb_b_mask;
- gint fb_r_mask_used;
- gint fb_g_mask_used;
- gint fb_b_mask_used;
-
- CoglPangoFontMap *font_map; /* Global font map */
-
- /* stack of #ClutterEvent */
- GSList *current_event;
-
- /* list of repaint functions installed through
- * clutter_threads_add_repaint_func()
- */
- GList *repaint_funcs;
- guint last_repaint_id;
-
- /* main settings singleton */
- ClutterSettings *settings;
-
- /* boolean flags */
- guint is_initialized : 1;
- guint defer_display_setup : 1;
- guint options_parsed : 1;
- guint show_fps : 1;
-};
-
-/* shared between clutter-main.c and clutter-frame-source.c */
-typedef struct
-{
- GSourceFunc func;
- gpointer data;
- GDestroyNotify notify;
-} ClutterThreadsDispatch;
-
-gboolean _clutter_threads_dispatch (gpointer data);
-void _clutter_threads_dispatch_free (gpointer data);
-
-ClutterMainContext * _clutter_context_get_default (void);
-void _clutter_context_lock (void);
-void _clutter_context_unlock (void);
-CLUTTER_EXPORT
-gboolean _clutter_context_is_initialized (void);
-gboolean _clutter_context_get_show_fps (void);
-
-gboolean _clutter_feature_init (GError **error);
-
-/* Diagnostic mode */
-gboolean _clutter_diagnostic_enabled (void);
-void _clutter_diagnostic_message (const char *fmt, ...) G_GNUC_PRINTF (1, 2);
-
-CLUTTER_EXPORT
-void _clutter_set_sync_to_vblank (gboolean sync_to_vblank);
-
-/* use this function as the accumulator if you have a signal with
- * a G_TYPE_BOOLEAN return value; this will stop the emission as
- * soon as one handler returns TRUE
- */
-gboolean _clutter_boolean_handled_accumulator (GSignalInvocationHint *ihint,
- GValue *return_accu,
- const GValue *handler_return,
- gpointer dummy);
-
-/* use this function as the accumulator if you have a signal with
- * a G_TYPE_BOOLEAN return value; this will stop the emission as
- * soon as one handler returns FALSE
- */
-gboolean _clutter_boolean_continue_accumulator (GSignalInvocationHint *ihint,
- GValue *return_accu,
- const GValue *handler_return,
- gpointer dummy);
-
-void _clutter_run_repaint_functions (ClutterRepaintFlags flags);
-
-GType _clutter_layout_manager_get_child_meta_type (ClutterLayoutManager *manager);
-
-void _clutter_util_fully_transform_vertices (const graphene_matrix_t *modelview,
- const graphene_matrix_t *projection,
- const float *viewport,
- const graphene_point3d_t *vertices_in,
- graphene_point3d_t *vertices_out,
- int n_vertices);
-
-CLUTTER_EXPORT
-void _clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src,
- graphene_rect_t *dest);
-
-CLUTTER_EXPORT
-void _clutter_util_rectangle_int_extents (const graphene_rect_t *src,
- cairo_rectangle_int_t *dest);
-
-void _clutter_util_rectangle_offset (const cairo_rectangle_int_t *src,
- int x,
- int y,
- cairo_rectangle_int_t *dest);
-
-void _clutter_util_rectangle_union (const cairo_rectangle_int_t *src1,
- const cairo_rectangle_int_t *src2,
- cairo_rectangle_int_t *dest);
-
-gboolean _clutter_util_rectangle_intersection (const cairo_rectangle_int_t *src1,
- const cairo_rectangle_int_t *src2,
- cairo_rectangle_int_t *dest);
-
-gboolean clutter_util_rectangle_equal (const cairo_rectangle_int_t *src1,
- const cairo_rectangle_int_t *src2);
-
-CLUTTER_EXPORT
-PangoDirection _clutter_pango_unichar_direction (gunichar ch);
-
-PangoDirection _clutter_pango_find_base_dir (const gchar *text,
- gint length);
-
-typedef enum _ClutterCullResult
-{
- CLUTTER_CULL_RESULT_UNKNOWN,
- CLUTTER_CULL_RESULT_IN,
- CLUTTER_CULL_RESULT_OUT,
-} ClutterCullResult;
-
-gboolean _clutter_has_progress_function (GType gtype);
-gboolean _clutter_run_progress_function (GType gtype,
- const GValue *initial,
- const GValue *final,
- gdouble progress,
- GValue *retval);
-
-void clutter_timeline_cancel_delay (ClutterTimeline *timeline);
-
-static inline void
-clutter_round_to_256ths (float *f)
-{
- *f = roundf ((*f) * 256) / 256;
-}
-
-static inline uint64_t
-ns (uint64_t ns)
-{
- return ns;
-}
-
-static inline int64_t
-us (int64_t us)
-{
- return us;
-}
-
-static inline int64_t
-ms (int64_t ms)
-{
- return ms;
-}
-
-static inline int64_t
-ms2us (int64_t ms)
-{
- return us (ms * 1000);
-}
-
-static inline int64_t
-us2ns (int64_t us)
-{
- return ns (us * 1000);
-}
-
-static inline int64_t
-us2ms (int64_t us)
-{
- return (int64_t) (us / 1000);
-}
-
-static inline int64_t
-ns2us (int64_t ns)
-{
- return us (ns / 1000);
-}
-
-static inline int64_t
-s2us (int64_t s)
-{
- return s * G_USEC_PER_SEC;
-}
-
-static inline int64_t
-us2s (int64_t us)
-{
- return us / G_USEC_PER_SEC;
-}
-
-static inline int64_t
-s2ns (int64_t s)
-{
- return us2ns (s2us (s));
-}
-
-static inline int64_t
-s2ms (int64_t s)
-{
- return (int64_t) ms (s * 1000);
-}
-
-G_END_DECLS
-
-#endif /* __CLUTTER_PRIVATE_H__ */
diff --git a/clutter/clutter/clutter-property-transition.c b/clutter/clutter/clutter-property-transition.c
deleted file mode 100644
index f8c96761d..000000000
--- a/clutter/clutter/clutter-property-transition.c
+++ /dev/null
@@ -1,378 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2012 Intel Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * SECTION:clutter-property-transition
- * @Title: ClutterPropertyTransition
- * @Short_Description: Property transitions
- *
- * #ClutterPropertyTransition is a specialized #ClutterTransition that
- * can be used to tween a property of a #ClutterAnimatable instance.
- *
- * #ClutterPropertyTransition is available since Clutter 1.10
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-property-transition.h"
-
-#include "clutter-animatable.h"
-#include "clutter-debug.h"
-#include "clutter-interval.h"
-#include "clutter-private.h"
-#include "clutter-transition.h"
-
-struct _ClutterPropertyTransitionPrivate
-{
- char *property_name;
-
- GParamSpec *pspec;
-};
-
-enum
-{
- PROP_0,
-
- PROP_PROPERTY_NAME,
-
- PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST] = { NULL, };
-
-G_DEFINE_TYPE_WITH_PRIVATE (ClutterPropertyTransition, clutter_property_transition, CLUTTER_TYPE_TRANSITION)
-
-static inline void
-clutter_property_transition_ensure_interval (ClutterPropertyTransition *transition,
- ClutterAnimatable *animatable,
- ClutterInterval *interval)
-{
- ClutterPropertyTransitionPrivate *priv = transition->priv;
- GValue *value_p;
-
- if (clutter_interval_is_valid (interval))
- return;
-
- /* if no initial value has been set, use the current value */
- value_p = clutter_interval_peek_initial_value (interval);
- if (!G_IS_VALUE (value_p))
- {
- g_value_init (value_p, clutter_interval_get_value_type (interval));
- clutter_animatable_get_initial_state (animatable,
- priv->property_name,
- value_p);
- }
-
- /* if no final value has been set, use the current value */
- value_p = clutter_interval_peek_final_value (interval);
- if (!G_IS_VALUE (value_p))
- {
- g_value_init (value_p, clutter_interval_get_value_type (interval));
- clutter_animatable_get_initial_state (animatable,
- priv->property_name,
- value_p);
- }
-}
-
-static void
-clutter_property_transition_attached (ClutterTransition *transition,
- ClutterAnimatable *animatable)
-{
- ClutterPropertyTransition *self = CLUTTER_PROPERTY_TRANSITION (transition);
- ClutterPropertyTransitionPrivate *priv = self->priv;
- ClutterInterval *interval;
-
- if (priv->property_name == NULL)
- return;
-
- priv->pspec =
- clutter_animatable_find_property (animatable, priv->property_name);
-
- if (priv->pspec == NULL)
- return;
-
- interval = clutter_transition_get_interval (transition);
- if (interval == NULL)
- return;
-
- clutter_property_transition_ensure_interval (self, animatable, interval);
-}
-
-static void
-clutter_property_transition_detached (ClutterTransition *transition,
- ClutterAnimatable *animatable)
-{
- ClutterPropertyTransition *self = CLUTTER_PROPERTY_TRANSITION (transition);
- ClutterPropertyTransitionPrivate *priv = self->priv;
-
- priv->pspec = NULL;
-}
-
-static void
-clutter_property_transition_compute_value (ClutterTransition *transition,
- ClutterAnimatable *animatable,
- ClutterInterval *interval,
- gdouble progress)
-{
- ClutterPropertyTransition *self = CLUTTER_PROPERTY_TRANSITION (transition);
- ClutterPropertyTransitionPrivate *priv = self->priv;
- GValue value = G_VALUE_INIT;
- GType p_type, i_type;
- gboolean res;
-
- /* if we have a GParamSpec we also have an animatable instance */
- if (priv->pspec == NULL)
- return;
-
- clutter_property_transition_ensure_interval (self, animatable, interval);
-
- p_type = G_PARAM_SPEC_VALUE_TYPE (priv->pspec);
- i_type = clutter_interval_get_value_type (interval);
-
- g_value_init (&value, i_type);
-
- res = clutter_animatable_interpolate_value (animatable,
- priv->property_name,
- interval,
- progress,
- &value);
-
- if (res)
- {
- if (i_type != p_type || g_type_is_a (i_type, p_type))
- {
- if (g_value_type_transformable (i_type, p_type))
- {
- GValue transform = G_VALUE_INIT;
-
- g_value_init (&transform, p_type);
-
- if (g_value_transform (&value, &transform))
- {
- clutter_animatable_set_final_state (animatable,
- priv->property_name,
- &transform);
- }
- else
- g_warning ("%s: Unable to convert a value of type '%s' from "
- "the value type '%s' of the interval.",
- G_STRLOC,
- g_type_name (p_type),
- g_type_name (i_type));
-
- g_value_unset (&transform);
- }
- }
- else
- clutter_animatable_set_final_state (animatable,
- priv->property_name,
- &value);
- }
-
- g_value_unset (&value);
-}
-
-static void
-clutter_property_transition_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterPropertyTransition *self = CLUTTER_PROPERTY_TRANSITION (gobject);
-
- switch (prop_id)
- {
- case PROP_PROPERTY_NAME:
- clutter_property_transition_set_property_name (self,
- g_value_get_string (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- }
-}
-
-static void
-clutter_property_transition_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterPropertyTransitionPrivate *priv = CLUTTER_PROPERTY_TRANSITION (gobject)->priv;
-
- switch (prop_id)
- {
- case PROP_PROPERTY_NAME:
- g_value_set_string (value, priv->property_name);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- }
-}
-
-static void
-clutter_property_transition_finalize (GObject *gobject)
-{
- ClutterPropertyTransitionPrivate *priv;
-
- priv = CLUTTER_PROPERTY_TRANSITION (gobject)->priv;
-
- g_free (priv->property_name);
-
- G_OBJECT_CLASS (clutter_property_transition_parent_class)->finalize (gobject);
-}
-
-static void
-clutter_property_transition_class_init (ClutterPropertyTransitionClass *klass)
-{
- ClutterTransitionClass *transition_class = CLUTTER_TRANSITION_CLASS (klass);
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- transition_class->attached = clutter_property_transition_attached;
- transition_class->detached = clutter_property_transition_detached;
- transition_class->compute_value = clutter_property_transition_compute_value;
-
- gobject_class->set_property = clutter_property_transition_set_property;
- gobject_class->get_property = clutter_property_transition_get_property;
- gobject_class->finalize = clutter_property_transition_finalize;
-
- /**
- * ClutterPropertyTransition:property-name:
- *
- * The name of the property of a #ClutterAnimatable to animate.
- *
- * Since: 1.10
- */
- obj_props[PROP_PROPERTY_NAME] =
- g_param_spec_string ("property-name",
- P_("Property Name"),
- P_("The name of the property to animate"),
- NULL,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
-}
-
-static void
-clutter_property_transition_init (ClutterPropertyTransition *self)
-{
- self->priv = clutter_property_transition_get_instance_private (self);
-}
-
-/**
- * clutter_property_transition_new_for_actor:
- * @actor: a #ClutterActor
- * @property_name: (allow-none): a property of @animatable, or %NULL
- *
- * Creates a new #ClutterPropertyTransition.
- *
- * Return value: (transfer full): the newly created #ClutterPropertyTransition.
- * Use g_object_unref() when done
- */
-ClutterTransition *
-clutter_property_transition_new_for_actor (ClutterActor *actor,
- const char *property_name)
-{
- return g_object_new (CLUTTER_TYPE_PROPERTY_TRANSITION,
- "actor", actor,
- "property-name", property_name,
- NULL);
-}
-
-/**
- * clutter_property_transition_new:
- * @property_name: (allow-none): a property of @animatable, or %NULL
- *
- * Creates a new #ClutterPropertyTransition.
- *
- * Return value: (transfer full): the newly created #ClutterPropertyTransition.
- * Use g_object_unref() when done
- *
- * Since: 1.10
- */
-ClutterTransition *
-clutter_property_transition_new (const char *property_name)
-{
- return g_object_new (CLUTTER_TYPE_PROPERTY_TRANSITION,
- "property-name", property_name,
- NULL);
-}
-
-/**
- * clutter_property_transition_set_property_name:
- * @transition: a #ClutterPropertyTransition
- * @property_name: (allow-none): a property name
- *
- * Sets the #ClutterPropertyTransition:property-name property of @transition.
- *
- * Since: 1.10
- */
-void
-clutter_property_transition_set_property_name (ClutterPropertyTransition *transition,
- const char *property_name)
-{
- ClutterPropertyTransitionPrivate *priv;
- ClutterAnimatable *animatable;
-
- g_return_if_fail (CLUTTER_IS_PROPERTY_TRANSITION (transition));
-
- priv = transition->priv;
-
- if (g_strcmp0 (priv->property_name, property_name) == 0)
- return;
-
- g_free (priv->property_name);
- priv->property_name = g_strdup (property_name);
- priv->pspec = NULL;
-
- animatable =
- clutter_transition_get_animatable (CLUTTER_TRANSITION (transition));
- if (animatable != NULL)
- {
- priv->pspec = clutter_animatable_find_property (animatable,
- priv->property_name);
- }
-
- g_object_notify_by_pspec (G_OBJECT (transition),
- obj_props[PROP_PROPERTY_NAME]);
-}
-
-/**
- * clutter_property_transition_get_property_name:
- * @transition: a #ClutterPropertyTransition
- *
- * Retrieves the value of the #ClutterPropertyTransition:property-name
- * property.
- *
- * Return value: the name of the property being animated, or %NULL if
- * none is set. The returned string is owned by the @transition and
- * it should not be freed.
- *
- * Since: 1.10
- */
-const char *
-clutter_property_transition_get_property_name (ClutterPropertyTransition *transition)
-{
- g_return_val_if_fail (CLUTTER_IS_PROPERTY_TRANSITION (transition), NULL);
-
- return transition->priv->property_name;
-}
diff --git a/clutter/clutter/clutter-property-transition.h b/clutter/clutter/clutter-property-transition.h
deleted file mode 100644
index 5670746fa..000000000
--- a/clutter/clutter/clutter-property-transition.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2012 Intel Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author: Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_PROPERTY_TRANSITION_H__
-#define __CLUTTER_PROPERTY_TRANSITION_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-types.h>
-#include <clutter/clutter-transition.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_PROPERTY_TRANSITION (clutter_property_transition_get_type ())
-#define CLUTTER_PROPERTY_TRANSITION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_PROPERTY_TRANSITION, ClutterPropertyTransition))
-#define CLUTTER_IS_PROPERTY_TRANSITION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_PROPERTY_TRANSITION))
-#define CLUTTER_PROPERTY_TRANSITION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_PROPERTY_TRANSITION, ClutterPropertyTransitionClass))
-#define CLUTTER_IS_PROPERTY_TRANSITION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_PROPERTY_TRANSITION))
-#define CLUTTER_PROPERTY_TRANSITION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_PROPERTY_TRANSITION, ClutterPropertyTransitionClass))
-
-typedef struct _ClutterPropertyTransitionPrivate ClutterPropertyTransitionPrivate;
-typedef struct _ClutterPropertyTransitionClass ClutterPropertyTransitionClass;
-
-/**
- * ClutterPropertyTransition:
- *
- * The #ClutterPropertyTransition structure contains
- * private data and should only be accessed using the provided API.
- *
- * Since: 1.10
- */
-struct _ClutterPropertyTransition
-{
- /*< private >*/
- ClutterTransition parent_instance;
-
- ClutterPropertyTransitionPrivate *priv;
-};
-
-/**
- * ClutterPropertyTransitionClass:
- *
- * The #ClutterPropertyTransitionClass structure
- * contains private data.
- *
- * Since: 1.10
- */
-struct _ClutterPropertyTransitionClass
-{
- /*< private >*/
- ClutterTransitionClass parent_class;
-
- gpointer _padding[8];
-};
-
-CLUTTER_EXPORT
-GType clutter_property_transition_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterTransition * clutter_property_transition_new_for_actor (ClutterActor *actor,
- const char *property_name);
-
-CLUTTER_EXPORT
-ClutterTransition * clutter_property_transition_new (const char *property_name);
-
-CLUTTER_EXPORT
-void clutter_property_transition_set_property_name (ClutterPropertyTransition *transition,
- const char *property_name);
-CLUTTER_EXPORT
-const char * clutter_property_transition_get_property_name (ClutterPropertyTransition *transition);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_PROPERTY_TRANSITION_H__ */
diff --git a/clutter/clutter/clutter-rotate-action.c b/clutter/clutter/clutter-rotate-action.c
deleted file mode 100644
index 7a21607d5..000000000
--- a/clutter/clutter/clutter-rotate-action.c
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2012 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Lionel Landwerlin <lionel.g.landwerlin@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-rotate-action
- * @Title: ClutterRotateAction
- * @Short_Description: Action to rotate an actor
- *
- * #ClutterRotateAction is a sub-class of #ClutterGestureAction that implements
- * the logic for recognizing rotate gestures using two touch points.
- *
- * Since: 1.12
- */
-
-#include "clutter-build-config.h"
-
-#include <math.h>
-
-#include "clutter-rotate-action.h"
-
-#include "clutter-debug.h"
-#include "clutter-enum-types.h"
-#include "clutter-gesture-action-private.h"
-#include "clutter-marshal.h"
-#include "clutter-private.h"
-
-struct _ClutterRotateActionPrivate
-{
- gfloat initial_vector[2];
- gdouble initial_vector_norm;
- gdouble initial_rotation;
-};
-
-enum
-{
- ROTATE,
-
- LAST_SIGNAL
-};
-
-static guint rotate_signals[LAST_SIGNAL] = { 0, };
-
-G_DEFINE_TYPE_WITH_PRIVATE (ClutterRotateAction, clutter_rotate_action, CLUTTER_TYPE_GESTURE_ACTION)
-
-static gboolean
-clutter_rotate_action_real_rotate (ClutterRotateAction *action,
- ClutterActor *actor,
- gdouble angle)
-{
- clutter_actor_set_rotation_angle (actor,
- CLUTTER_Z_AXIS,
- action->priv->initial_rotation + angle);
-
- return TRUE;
-}
-
-static gboolean
-clutter_rotate_action_gesture_begin (ClutterGestureAction *action,
- ClutterActor *actor)
-{
- ClutterRotateActionPrivate *priv = CLUTTER_ROTATE_ACTION (action)->priv;
- gfloat p1[2], p2[2];
-
- /* capture initial vector */
- clutter_gesture_action_get_motion_coords (action, 0, &p1[0], &p1[1]);
- clutter_gesture_action_get_motion_coords (action, 1, &p2[0], &p2[1]);
-
- priv->initial_vector[0] = p2[0] - p1[0];
- priv->initial_vector[1] = p2[1] - p1[1];
-
- priv->initial_vector_norm =
- sqrt (priv->initial_vector[0] * priv->initial_vector[0] +
- priv->initial_vector[1] * priv->initial_vector[1]);
-
- priv->initial_rotation = clutter_actor_get_rotation_angle (actor, CLUTTER_Z_AXIS);
-
- return TRUE;
-}
-
-static gboolean
-clutter_rotate_action_gesture_progress (ClutterGestureAction *action,
- ClutterActor *actor)
-{
- ClutterRotateActionPrivate *priv = CLUTTER_ROTATE_ACTION (action)->priv;
- gfloat p1[2], p2[2];
- gfloat vector[2];
- gboolean retval;
-
- /* capture current vector */
- clutter_gesture_action_get_motion_coords (action, 0, &p1[0], &p1[1]);
- clutter_gesture_action_get_motion_coords (action, 1, &p2[0], &p2[1]);
-
- vector[0] = p2[0] - p1[0];
- vector[1] = p2[1] - p1[1];
-
- if ((vector[0] == priv->initial_vector[0]) &&
- (vector[1] == priv->initial_vector[1]))
- {
- g_signal_emit (action, rotate_signals[ROTATE], 0,
- actor, (gdouble) 0.0,
- &retval);
- }
- else
- {
- gfloat mult[2];
- gfloat norm;
- gdouble angle;
-
- /* Computes angle between the 2 initial touch points and the
- current position of the 2 touch points. */
- norm = sqrt (vector[0] * vector[0] + vector[1] * vector[1]);
- norm = (priv->initial_vector[0] * vector[0] +
- priv->initial_vector[1] * vector[1]) / (priv->initial_vector_norm * norm);
-
- if ((norm >= -1.0) && (norm <= 1.0))
- angle = acos (norm);
- else
- angle = 0;
-
- /* The angle given is comprise between 0 and 180 degrees, we
- need some logic on top to get a value between 0 and 360. */
- mult[0] = priv->initial_vector[0] * vector[1] -
- priv->initial_vector[1] * vector[0];
- mult[1] = priv->initial_vector[1] * vector[0] -
- priv->initial_vector[0] * vector[1];
-
- if (mult[0] < 0)
- angle = -angle;
-
- /* Convert radians to degrees */
- angle = angle * 180.0 / G_PI;
-
- g_signal_emit (action, rotate_signals[ROTATE], 0,
- actor, angle,
- &retval);
- }
-
- return TRUE;
-}
-
-static void
-clutter_rotate_action_gesture_cancel (ClutterGestureAction *action,
- ClutterActor *actor)
-{
- gboolean retval;
-
- g_signal_emit (action, rotate_signals[ROTATE], 0,
- actor, (gdouble) 0.0,
- &retval);
-}
-
-static void
-clutter_rotate_action_constructed (GObject *gobject)
-{
- ClutterGestureAction *gesture;
-
- gesture = CLUTTER_GESTURE_ACTION (gobject);
- clutter_gesture_action_set_threshold_trigger_edge (gesture, CLUTTER_GESTURE_TRIGGER_EDGE_NONE);
-}
-
-static void
-clutter_rotate_action_class_init (ClutterRotateActionClass *klass)
-{
- ClutterGestureActionClass *gesture_class =
- CLUTTER_GESTURE_ACTION_CLASS (klass);
- GObjectClass *object_class =
- G_OBJECT_CLASS (klass);
-
- klass->rotate = clutter_rotate_action_real_rotate;
-
- object_class->constructed = clutter_rotate_action_constructed;
-
- gesture_class->gesture_begin = clutter_rotate_action_gesture_begin;
- gesture_class->gesture_progress = clutter_rotate_action_gesture_progress;
- gesture_class->gesture_cancel = clutter_rotate_action_gesture_cancel;
-
- /**
- * ClutterRotateAction::rotate:
- * @action: the #ClutterRotateAction that emitted the signal
- * @actor: the #ClutterActor attached to the @action
- * @angle: the difference of angle of rotation between the initial
- * rotation and the current rotation
- *
- * The ::rotate signal is emitted when a rotate gesture is
- * recognized on the attached actor and when the gesture is
- * cancelled (in this case with an angle value of 0).
- *
- * Return value: %TRUE if the rotation should continue, and %FALSE if
- * the rotation should be cancelled.
- *
- * Since: 1.12
- */
- rotate_signals[ROTATE] =
- g_signal_new (I_("rotate"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterRotateActionClass, rotate),
- _clutter_boolean_continue_accumulator, NULL,
- _clutter_marshal_BOOLEAN__OBJECT_DOUBLE,
- G_TYPE_BOOLEAN, 2,
- CLUTTER_TYPE_ACTOR,
- G_TYPE_DOUBLE);
-}
-
-static void
-clutter_rotate_action_init (ClutterRotateAction *self)
-{
- ClutterGestureAction *gesture;
-
- self->priv = clutter_rotate_action_get_instance_private (self);
-
- gesture = CLUTTER_GESTURE_ACTION (self);
- clutter_gesture_action_set_n_touch_points (gesture, 2);
-}
-
-/**
- * clutter_rotate_action_new:
- *
- * Creates a new #ClutterRotateAction instance
- *
- * Return value: the newly created #ClutterRotateAction
- *
- * Since: 1.12
- */
-ClutterAction *
-clutter_rotate_action_new (void)
-{
- return g_object_new (CLUTTER_TYPE_ROTATE_ACTION, NULL);
-}
diff --git a/clutter/clutter/clutter-rotate-action.h b/clutter/clutter/clutter-rotate-action.h
deleted file mode 100644
index faa240e6c..000000000
--- a/clutter/clutter/clutter-rotate-action.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2012 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Lionel Landwerlin <lionel.g.landwerlin@linux.intel.com>
- */
-
-#ifndef __CLUTTER_ROTATE_ACTION_H__
-#define __CLUTTER_ROTATE_ACTION_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-gesture-action.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_ROTATE_ACTION (clutter_rotate_action_get_type ())
-#define CLUTTER_ROTATE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ROTATE_ACTION, ClutterRotateAction))
-#define CLUTTER_IS_ROTATE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ROTATE_ACTION))
-#define CLUTTER_ROTATE_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_ROTATE_ACTION, ClutterRotateActionClass))
-#define CLUTTER_IS_ROTATE_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_ROTATE_ACTION))
-#define CLUTTER_ROTATE_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ROTATE_ACTION, ClutterRotateActionClass))
-
-typedef struct _ClutterRotateAction ClutterRotateAction;
-typedef struct _ClutterRotateActionPrivate ClutterRotateActionPrivate;
-typedef struct _ClutterRotateActionClass ClutterRotateActionClass;
-
-/**
- * ClutterRotateAction:
- *
- * The #ClutterRotateAction structure contains
- * only private data and should be accessed using the provided API
- *
- * Since: 1.12
- */
-struct _ClutterRotateAction
-{
- /*< private >*/
- ClutterGestureAction parent_instance;
-
- ClutterRotateActionPrivate *priv;
-};
-
-/**
- * ClutterRotateActionClass:
- * @rotate: class handler for the #ClutterRotateAction::rotate signal
- *
- * The #ClutterRotateActionClass structure contains
- * only private data.
- *
- * Since: 1.12
- */
-struct _ClutterRotateActionClass
-{
- /*< private >*/
- ClutterGestureActionClass parent_class;
-
- /*< public >*/
- gboolean (* rotate) (ClutterRotateAction *action,
- ClutterActor *actor,
- gdouble angle);
-
- /*< private >*/
- void (* _clutter_rotate_action1) (void);
- void (* _clutter_rotate_action2) (void);
- void (* _clutter_rotate_action3) (void);
- void (* _clutter_rotate_action4) (void);
- void (* _clutter_rotate_action5) (void);
- void (* _clutter_rotate_action6) (void);
- void (* _clutter_rotate_action7) (void);
-};
-
-CLUTTER_EXPORT
-GType clutter_rotate_action_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterAction *clutter_rotate_action_new (void);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_ROTATE_ACTION_H__ */
diff --git a/clutter/clutter/clutter-script-parser.c b/clutter/clutter/clutter-script-parser.c
deleted file mode 100644
index 8ae38a505..000000000
--- a/clutter/clutter/clutter-script-parser.c
+++ /dev/null
@@ -1,2011 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2006, 2007, 2008 OpenedHand Ltd
- * Copyright (C) 2009 Intel Corportation
- *
- * 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/>.
- *
- * Original author:
- *
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#include "clutter-build-config.h"
-
-#include <string.h>
-#include <stdlib.h>
-
-#include <glib.h>
-#include <gmodule.h>
-
-#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
-#include "deprecated/clutter-container.h"
-
-#include "clutter-actor.h"
-#include "clutter-debug.h"
-#include "clutter-enum-types.h"
-
-#include "clutter-script.h"
-#include "clutter-script-private.h"
-#include "clutter-scriptable.h"
-
-#include "clutter-stage-manager.h"
-
-#include "clutter-private.h"
-
-static void clutter_script_parser_object_end (JsonParser *parser,
- JsonObject *object);
-static void clutter_script_parser_parse_end (JsonParser *parser);
-
-#define clutter_script_parser_get_type _clutter_script_parser_get_type
-
-G_DEFINE_TYPE (ClutterScriptParser, clutter_script_parser, JSON_TYPE_PARSER);
-
-static void
-clutter_script_parser_class_init (ClutterScriptParserClass *klass)
-{
- JsonParserClass *parser_class = JSON_PARSER_CLASS (klass);
-
- parser_class->object_end = clutter_script_parser_object_end;
- parser_class->parse_end = clutter_script_parser_parse_end;
-}
-
-static void
-clutter_script_parser_init (ClutterScriptParser *parser)
-{
-}
-
-GType
-_clutter_script_get_type_from_symbol (const gchar *symbol)
-{
- static GModule *module = NULL;
- GTypeGetFunc func;
- GType gtype = G_TYPE_INVALID;
-
- if (!module)
- module = g_module_open (NULL, 0);
-
- if (g_module_symbol (module, symbol, (gpointer)&func))
- gtype = func ();
-
- return gtype;
-}
-
-GType
-_clutter_script_get_type_from_class (const gchar *name)
-{
- static GModule *module = NULL;
- GString *symbol_name = g_string_sized_new (64);
- GType gtype = G_TYPE_INVALID;
- GTypeGetFunc func;
- gchar *symbol;
- gint i;
-
- if (G_UNLIKELY (!module))
- module = g_module_open (NULL, 0);
-
- for (i = 0; name[i] != '\0'; i++)
- {
- gchar c = name[i];
-
- /* the standard naming policy for GObject-based libraries
- * is:
- *
- * NAME := INITIAL_WORD WORD+
- * INITIAL_WORD := [A-Z][a-z0-9]*
- * WORD := [A-Z]{1,2}[a-z0-9]+ | [A-Z]{2,}
- *
- * for instance:
- *
- * GString -> g_string
- * GtkCTree -> gtk_ctree
- * ClutterX11TexturePixmap -> clutter_x11_texture_pixmap
- *
- * see:
- *
- * http://mail.gnome.org/archives/gtk-devel-list/2007-June/msg00022.html
- *
- * and:
- *
- * http://git.gnome.org/cgit/gtk+/plain/gtk/gtkbuilderparser.c
- */
-
- if ((c == g_ascii_toupper (c) &&
- i > 0 && name[i - 1] != g_ascii_toupper (name[i - 1])) ||
- (i > 2 && name[i] == g_ascii_toupper (name[i]) &&
- name[i - 1] == g_ascii_toupper (name[i - 1]) &&
- name[i - 2] == g_ascii_toupper (name[i - 2])))
- g_string_append_c (symbol_name, '_');
-
- g_string_append_c (symbol_name, g_ascii_tolower (c));
- }
-
- g_string_append (symbol_name, "_get_type");
-
- symbol = g_string_free (symbol_name, FALSE);
-
- if (g_module_symbol (module, symbol, (gpointer)&func))
- {
- CLUTTER_NOTE (SCRIPT, "Type function: %s", symbol);
- gtype = func ();
- }
-
- g_free (symbol);
-
- return gtype;
-}
-
-/*
- * clutter_script_enum_from_string:
- * @type: a #GType for an enumeration type
- * @string: the enumeration value as a string
- * @enum_value: (out): return location for the enumeration value as an integer
- *
- * Converts an enumeration value inside @string into a numeric
- * value and places it into @enum_value.
- *
- * The enumeration value can be an integer, the enumeration nick
- * or the enumeration name, as part of the #GEnumValue structure.
- *
- * Return value: %TRUE if the conversion was successful.
- */
-gboolean
-_clutter_script_enum_from_string (GType type,
- const gchar *string,
- gint *enum_value)
-{
- GEnumClass *eclass;
- GEnumValue *ev;
- gchar *endptr;
- gint value;
- gboolean retval = TRUE;
-
- g_return_val_if_fail (G_TYPE_IS_ENUM (type), 0);
- g_return_val_if_fail (string != NULL, 0);
-
- value = strtoul (string, &endptr, 0);
- if (endptr != string) /* parsed a number */
- *enum_value = value;
- else
- {
- eclass = g_type_class_ref (type);
- ev = g_enum_get_value_by_name (eclass, string);
- if (!ev)
- ev = g_enum_get_value_by_nick (eclass, string);
-
- if (ev)
- *enum_value = ev->value;
- else
- retval = FALSE;
-
- g_type_class_unref (eclass);
- }
-
- return retval;
-}
-
-gboolean
-_clutter_script_flags_from_string (GType type,
- const gchar *string,
- gint *flags_value)
-{
- gchar *endptr, *prevptr;
- guint i, j, ret, value;
- gchar *flagstr;
- GFlagsValue *fv;
- const gchar *flag;
-
- g_return_val_if_fail (G_TYPE_IS_FLAGS (type), 0);
- g_return_val_if_fail (string != NULL, 0);
-
- ret = TRUE;
-
- value = strtoul (string, &endptr, 0);
- if (endptr != string) /* parsed a number */
- *flags_value = value;
- else
- {
- GFlagsClass *fclass;
-
- fclass = g_type_class_ref (type);
-
- flagstr = g_strdup (string);
- for (value = i = j = 0; ; i++)
- {
- gboolean eos = (flagstr[i] == '\0') ? TRUE : FALSE;
-
- if (!eos && flagstr[i] != '|')
- continue;
-
- flag = &flagstr[j];
- endptr = &flagstr[i];
-
- if (!eos)
- {
- flagstr[i++] = '\0';
- j = i;
- }
-
- /* trim spaces */
- for (;;)
- {
- gunichar ch = g_utf8_get_char (flag);
- if (!g_unichar_isspace (ch))
- break;
-
- flag = g_utf8_next_char (flag);
- }
-
- while (endptr > flag)
- {
- gunichar ch;
-
- prevptr = g_utf8_prev_char (endptr);
-
- ch = g_utf8_get_char (prevptr);
- if (!g_unichar_isspace (ch))
- break;
-
- endptr = prevptr;
- }
-
- if (endptr > flag)
- {
- *endptr = '\0';
-
- fv = g_flags_get_value_by_name (fclass, flag);
-
- if (!fv)
- fv = g_flags_get_value_by_nick (fclass, flag);
-
- if (fv)
- value |= fv->value;
- else
- {
- ret = FALSE;
- break;
- }
- }
-
- if (eos)
- {
- *flags_value = value;
- break;
- }
- }
-
- g_free (flagstr);
-
- g_type_class_unref (fclass);
- }
-
- return ret;
-}
-
-static gboolean
-parse_knot_from_array (JsonArray *array,
- ClutterKnot *knot)
-{
- if (json_array_get_length (array) != 2)
- return FALSE;
-
- knot->x = json_array_get_int_element (array, 0);
- knot->y = json_array_get_int_element (array, 1);
-
- return TRUE;
-}
-
-static gboolean
-parse_knot_from_object (JsonObject *object,
- ClutterKnot *knot)
-{
- if (json_object_has_member (object, "x"))
- knot->x = json_object_get_int_member (object, "x");
- else
- knot->x = 0;
-
- if (json_object_has_member (object, "y"))
- knot->y = json_object_get_int_member (object, "y");
- else
- knot->y = 0;
-
- return TRUE;
-}
-
-gboolean
-_clutter_script_parse_knot (ClutterScript *script,
- JsonNode *node,
- ClutterKnot *knot)
-{
- g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), FALSE);
- g_return_val_if_fail (node != NULL, FALSE);
- g_return_val_if_fail (knot != NULL, FALSE);
-
- switch (JSON_NODE_TYPE (node))
- {
- case JSON_NODE_ARRAY:
- return parse_knot_from_array (json_node_get_array (node), knot);
-
- case JSON_NODE_OBJECT:
- return parse_knot_from_object (json_node_get_object (node), knot);
-
- default:
- break;
- }
-
- return FALSE;
-}
-
-static gboolean
-parse_rect_from_array (JsonArray *array,
- graphene_rect_t *rect)
-{
- 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));
-
- return TRUE;
-}
-
-static gboolean
-parse_rect_from_object (JsonObject *object,
- graphene_rect_t *rect)
-{
- if (json_object_has_member (object, "x"))
- rect->origin.x = json_object_get_int_member (object, "x");
- else
- rect->origin.x = 0;
-
- if (json_object_has_member (object, "y"))
- rect->origin.y = json_object_get_int_member (object, "y");
- else
- rect->origin.y = 0;
-
- if (json_object_has_member (object, "width"))
- rect->size.width = json_object_get_int_member (object, "width");
- else
- rect->size.width = 0;
-
- if (json_object_has_member (object, "height"))
- rect->size.height = json_object_get_int_member (object, "height");
- else
- rect->size.height = 0;
-
- return TRUE;
-}
-
-gboolean
-_clutter_script_parse_rect (ClutterScript *script,
- JsonNode *node,
- graphene_rect_t *rect)
-{
- 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);
-
- switch (JSON_NODE_TYPE (node))
- {
- case JSON_NODE_ARRAY:
- return parse_rect_from_array (json_node_get_array (node), rect);
-
- case JSON_NODE_OBJECT:
- return parse_rect_from_object (json_node_get_object (node), rect);
-
- default:
- break;
- }
-
- return FALSE;
-}
-
-static gboolean
-parse_color_from_array (JsonArray *array,
- ClutterColor *color)
-{
- if (json_array_get_length (array) != 3 ||
- json_array_get_length (array) != 4)
- return FALSE;
-
- color->red = CLAMP (json_array_get_int_element (array, 0), 0, 255);
- color->green = CLAMP (json_array_get_int_element (array, 1), 0, 255);
- color->blue = CLAMP (json_array_get_int_element (array, 2), 0, 255);
-
- if (json_array_get_length (array) == 4)
- color->alpha = CLAMP (json_array_get_int_element (array, 3), 0, 255);
- else
- color->alpha = 255;
-
- return TRUE;
-}
-
-static gboolean
-parse_color_from_object (JsonObject *object,
- ClutterColor *color)
-{
- if (json_object_has_member (object, "red"))
- color->red = CLAMP (json_object_get_int_member (object, "red"), 0, 255);
- else
- color->red = 0;
-
- if (json_object_has_member (object, "green"))
- color->green = CLAMP (json_object_get_int_member (object, "green"), 0, 255);
- else
- color->green = 0;
-
- if (json_object_has_member (object, "blue"))
- color->blue = CLAMP (json_object_get_int_member (object, "blue"), 0, 255);
- else
- color->blue = 0;
-
- if (json_object_has_member (object, "alpha"))
- color->alpha = CLAMP (json_object_get_int_member (object, "alpha"), 0, 255);
- else
- color->alpha = 255;
-
- return TRUE;
-}
-
-gboolean
-_clutter_script_parse_color (ClutterScript *script,
- JsonNode *node,
- ClutterColor *color)
-{
- g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), FALSE);
- g_return_val_if_fail (node != NULL, FALSE);
- g_return_val_if_fail (color != NULL, FALSE);
-
- switch (JSON_NODE_TYPE (node))
- {
- case JSON_NODE_ARRAY:
- return parse_color_from_array (json_node_get_array (node), color);
-
- case JSON_NODE_OBJECT:
- return parse_color_from_object (json_node_get_object (node), color);
-
- case JSON_NODE_VALUE:
- return clutter_color_from_string (color, json_node_get_string (node));
-
- default:
- break;
- }
-
- return FALSE;
-}
-
-static gboolean
-parse_point_from_array (JsonArray *array,
- graphene_point_t *point)
-{
- if (json_array_get_length (array) != 2)
- return FALSE;
-
- point->x = json_array_get_double_element (array, 0);
- point->y = json_array_get_double_element (array, 1);
-
- return TRUE;
-}
-
-static gboolean
-parse_point_from_object (JsonObject *object,
- graphene_point_t *point)
-{
- if (json_object_has_member (object, "x"))
- point->x = json_object_get_double_member (object, "x");
- else
- point->x = 0.f;
-
- if (json_object_has_member (object, "y"))
- point->y = json_object_get_double_member (object, "y");
- else
- point->y = 0.f;
-
- return TRUE;
-}
-
-gboolean
-_clutter_script_parse_point (ClutterScript *script,
- JsonNode *node,
- graphene_point_t *point)
-{
- g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), FALSE);
- g_return_val_if_fail (node != NULL, FALSE);
- g_return_val_if_fail (point != NULL, FALSE);
-
- switch (JSON_NODE_TYPE (node))
- {
- case JSON_NODE_ARRAY:
- return parse_point_from_array (json_node_get_array (node), point);
-
- case JSON_NODE_OBJECT:
- return parse_point_from_object (json_node_get_object (node), point);
-
- default:
- break;
- }
-
- return FALSE;
-}
-
-static gboolean
-parse_size_from_array (JsonArray *array,
- graphene_size_t *size)
-{
- if (json_array_get_length (array) != 2)
- return FALSE;
-
- size->width = json_array_get_double_element (array, 0);
- size->height = json_array_get_double_element (array, 1);
-
- return TRUE;
-}
-
-static gboolean
-parse_size_from_object (JsonObject *object,
- graphene_size_t *size)
-{
- if (json_object_has_member (object, "width"))
- size->width = json_object_get_double_member (object, "width");
- else
- size->width = 0.f;
-
- if (json_object_has_member (object, "height"))
- size->height = json_object_get_double_member (object, "height");
- else
- size->height = 0.f;
-
- return TRUE;
-}
-
-gboolean
-_clutter_script_parse_size (ClutterScript *script,
- JsonNode *node,
- graphene_size_t *size)
-{
- g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), FALSE);
- g_return_val_if_fail (node != NULL, FALSE);
- g_return_val_if_fail (size != NULL, FALSE);
-
- switch (JSON_NODE_TYPE (node))
- {
- case JSON_NODE_ARRAY:
- return parse_size_from_array (json_node_get_array (node), size);
-
- case JSON_NODE_OBJECT:
- return parse_size_from_object (json_node_get_object (node), size);
-
- default:
- break;
- }
-
- return FALSE;
-}
-
-const gchar *
-_clutter_script_get_id_from_node (JsonNode *node)
-{
- JsonObject *object;
-
- switch (JSON_NODE_TYPE (node))
- {
- case JSON_NODE_OBJECT:
- object = json_node_get_object (node);
- if (json_object_has_member (object, "id"))
- return json_object_get_string_member (object, "id");
- break;
-
- case JSON_NODE_VALUE:
- return json_node_get_string (node);
-
- default:
- break;
- }
-
- return NULL;
-}
-
-static GList *
-parse_children (ObjectInfo *oinfo,
- JsonNode *node)
-{
- JsonArray *array;
- GList *retval;
- guint array_len, i;
-
- if (JSON_NODE_TYPE (node) != JSON_NODE_ARRAY)
- return NULL;
-
- retval = oinfo->children;
-
- array = json_node_get_array (node);
- array_len = json_array_get_length (array);
-
- for (i = 0; i < array_len; i++)
- {
- JsonNode *child = json_array_get_element (array, i);
- const gchar *id_;
-
- id_ = _clutter_script_get_id_from_node (child);
- if (id_ != NULL)
- retval = g_list_prepend (retval, g_strdup (id_));
- }
-
- return g_list_reverse (retval);
-}
-
-static GList *
-parse_signals (ClutterScript *script,
- ObjectInfo *oinfo,
- JsonNode *node)
-{
- JsonArray *array;
- GList *retval;
- guint array_len, i;
-
- if (JSON_NODE_TYPE (node) != JSON_NODE_ARRAY)
- {
- _clutter_script_warn_invalid_value (script, "signals", "Array", node);
- return NULL;
- }
-
- retval = oinfo->signals;
- array = json_node_get_array (node);
- array_len = json_array_get_length (array);
-
- for (i = 0; i < array_len; i++)
- {
- JsonNode *val = json_array_get_element (array, i);
- SignalInfo *sinfo = NULL;
- JsonObject *object;
- const gchar *name;
-
- if (JSON_NODE_TYPE (val) != JSON_NODE_OBJECT)
- {
- _clutter_script_warn_invalid_value (script,
- "signals array", "Object",
- node);
- continue;
- }
-
- object = json_node_get_object (val);
-
- /* mandatory: "name" */
- if (!json_object_has_member (object, "name"))
- {
- _clutter_script_warn_missing_attribute (script, NULL, "name");
- continue;
- }
- else
- {
- name = json_object_get_string_member (object, "name");
- if (!name)
- {
- _clutter_script_warn_invalid_value (script,
- "name", "string",
- val);
- continue;
- }
- }
-
- /* mandatory: "target-state" or "handler" */
- if (json_object_has_member (object, "target-state"))
- {
- const gchar *state = NULL;
- const gchar *target = NULL;
- gboolean warp_to = FALSE;
-
- target = json_object_get_string_member (object, "target-state");
- if (target == NULL)
- {
- _clutter_script_warn_invalid_value (script,
- "target-state", "string",
- val);
- continue;
- }
-
- if (json_object_has_member (object, "states"))
- state = json_object_get_string_member (object, "states");
-
- if (json_object_has_member (object, "warp"))
- warp_to = json_object_get_boolean_member (object, "warp");
-
- CLUTTER_NOTE (SCRIPT,
- "Added signal '%s' (states:%s, target-state:%s, warp:%s)",
- name,
- state != NULL ? state : "<default>", target,
- warp_to ? "true" : "false");
-
- sinfo = g_new0 (SignalInfo, 1);
- sinfo->is_handler = FALSE;
- sinfo->name = g_strdup (name);
- sinfo->state = g_strdup (state);
- sinfo->target = g_strdup (target);
- sinfo->warp_to = warp_to;
- }
- else if (json_object_has_member (object, "handler"))
- {
- const gchar *handler;
- const gchar *connect;
- GConnectFlags flags = 0;
-
- handler = json_object_get_string_member (object, "handler");
- if (handler == NULL)
- {
- _clutter_script_warn_invalid_value (script,
- "handler", "string",
- val);
- continue;
- }
-
- /* optional: "object" */
- if (json_object_has_member (object, "object"))
- connect = json_object_get_string_member (object, "object");
- else
- connect = NULL;
-
- /* optional: "after" */
- if (json_object_has_member (object, "after"))
- {
- if (json_object_get_boolean_member (object, "after"))
- flags |= G_CONNECT_AFTER;
- }
-
- /* optional: "swapped" */
- if (json_object_has_member (object, "swapped"))
- {
- if (json_object_get_boolean_member (object, "swapped"))
- flags |= G_CONNECT_SWAPPED;
- }
-
- CLUTTER_NOTE (SCRIPT,
- "Added signal '%s' (handler:%s, object:%s, flags:%d)",
- name,
- handler, connect, flags);
-
- sinfo = g_new0 (SignalInfo, 1);
- sinfo->is_handler = TRUE;
- sinfo->name = g_strdup (name);
- sinfo->handler = g_strdup (handler);
- sinfo->object = g_strdup (connect);
- sinfo->flags = flags;
- }
- else
- _clutter_script_warn_missing_attribute (script,
- NULL,
- "handler or state");
- if (sinfo != NULL)
- retval = g_list_prepend (retval, sinfo);
- }
-
- return retval;
-}
-
-static void
-clutter_script_parser_object_end (JsonParser *json_parser,
- JsonObject *object)
-{
- ClutterScriptParser *parser = CLUTTER_SCRIPT_PARSER (json_parser);
- ClutterScript *script = parser->script;
- ObjectInfo *oinfo;
- JsonNode *val;
- const gchar *id_;
- GList *members, *l;
-
- /* if the object definition does not have an 'id' field we'll
- * fake one for it...
- */
- if (!json_object_has_member (object, "id"))
- {
- gchar *fake;
-
- /* ... unless it doesn't even have a type - in which case
- * it is an internal object definition and we're not
- * supposed to touch it
- */
- if (!json_object_has_member (object, "type"))
- return;
-
- fake = _clutter_script_generate_fake_id (script);
- json_object_set_string_member (object, "id", fake);
-
- CLUTTER_NOTE (SCRIPT,
- "Adding fake id '%s' to object of type '%s'",
- json_object_get_string_member (object, "id"),
- json_object_get_string_member (object, "type"));
-
- g_free (fake);
- }
-
- if (!json_object_has_member (object, "type"))
- {
- val = json_object_get_member (object, "id");
-
- _clutter_script_warn_missing_attribute (script,
- json_node_get_string (val),
- "type");
- return;
- }
-
- id_ = json_object_get_string_member (object, "id");
- CLUTTER_NOTE (SCRIPT, "Getting object info for object '%s'", id_);
-
- oinfo = _clutter_script_get_object_info (script, id_);
- if (oinfo == NULL)
- {
- const gchar *class_name;
-
- oinfo = g_new0 (ObjectInfo, 1);
- oinfo->merge_id = _clutter_script_get_last_merge_id (script);
- oinfo->id = g_strdup (id_);
- oinfo->has_unresolved = TRUE;
-
- class_name = json_object_get_string_member (object, "type");
- oinfo->class_name = g_strdup (class_name);
-
- if (json_object_has_member (object, "type_func"))
- {
- const gchar *type_func;
-
- type_func = json_object_get_string_member (object, "type_func");
- oinfo->type_func = g_strdup (type_func);
-
- /* remove the type_func member; we don't want it to
- * pollute the object members
- */
- json_object_remove_member (object, "type_func");
- }
- }
-
- if (json_object_has_member (object, "children"))
- {
- val = json_object_get_member (object, "children");
- oinfo->children = parse_children (oinfo, val);
-
- json_object_remove_member (object, "children");
-
- oinfo->has_unresolved = TRUE;
- }
-
- if (json_object_has_member (object, "signals"))
- {
- val = json_object_get_member (object, "signals");
- oinfo->signals = parse_signals (script, oinfo, val);
-
- json_object_remove_member (object, "signals");
-
- oinfo->has_unresolved = TRUE;
- }
-
- if (strcmp (oinfo->class_name, "ClutterStage") == 0 &&
- json_object_has_member (object, "is-default"))
- {
- oinfo->is_actor = TRUE;
- oinfo->is_stage = TRUE;
- oinfo->is_stage_default =
- json_object_get_boolean_member (object, "is-default");
-
- json_object_remove_member (object, "is-default");
- }
- else
- oinfo->is_stage_default = FALSE;
-
- members = json_object_get_members (object);
- for (l = members; l; l = l->next)
- {
- const gchar *name = l->data;
- PropertyInfo *pinfo;
- JsonNode *node;
-
- CLUTTER_NOTE (SCRIPT, "Object '%s' member '%s'",
- oinfo->id,
- name);
-
- /* we have already parsed these */
- if (strcmp (name, "id") == 0 || strcmp (name, "type") == 0)
- continue;
-
- node = json_object_get_member (object, name);
-
- /* this should not really happen; we're getting a list of
- * member names, and if one does not map a real member
- * value then it's likely that something has gone wrong
- */
- if (G_UNLIKELY (node == NULL))
- {
- CLUTTER_NOTE (SCRIPT,
- "Empty node for member '%s' of object '%s' (type: %s)",
- name,
- oinfo->id,
- oinfo->class_name);
- continue;
- }
-
- pinfo = g_new0 (PropertyInfo, 1);
-
- pinfo->name = g_strdup (name);
- pinfo->node = json_node_copy (node);
- pinfo->pspec = NULL;
- pinfo->is_child = g_str_has_prefix (name, "child::") ? TRUE : FALSE;
- pinfo->is_layout = g_str_has_prefix (name, "layout::") ? TRUE : FALSE;
-
- oinfo->properties = g_list_prepend (oinfo->properties, pinfo);
- oinfo->has_unresolved = TRUE;
- }
-
- g_list_free (members);
-
- CLUTTER_NOTE (SCRIPT,
- "Added object '%s' (type:%s, id:%d, props:%d, signals:%d)",
- oinfo->id,
- oinfo->class_name,
- oinfo->merge_id,
- g_list_length (oinfo->properties),
- g_list_length (oinfo->signals));
-
- _clutter_script_add_object_info (script, oinfo);
- _clutter_script_construct_object (script, oinfo);
-}
-
-static void
-clutter_script_parser_parse_end (JsonParser *parser)
-{
- clutter_script_ensure_objects (CLUTTER_SCRIPT_PARSER (parser)->script);
-}
-
-gboolean
-_clutter_script_parse_translatable_string (ClutterScript *script,
- JsonNode *node,
- char **str)
-{
- JsonObject *obj;
- const char *string, *domain, *context;
- const char *res;
- gboolean translatable;
-
- if (!JSON_NODE_HOLDS_OBJECT (node))
- return FALSE;
-
- obj = json_node_get_object (node);
- if (!(json_object_has_member (obj, "translatable") &&
- json_object_has_member (obj, "string")))
- return FALSE;
-
- translatable = json_object_get_boolean_member (obj, "translatable");
-
- string = json_object_get_string_member (obj, "string");
- if (string == NULL || *string == '\0')
- return FALSE;
-
- if (json_object_has_member (obj, "context"))
- context = json_object_get_string_member (obj, "context");
- else
- context = NULL;
-
- if (json_object_has_member (obj, "domain"))
- domain = json_object_get_string_member (obj, "domain");
- else
- domain = NULL;
-
- if (domain == NULL || *domain == '\0')
- domain = clutter_script_get_translation_domain (script);
-
- if (translatable)
- {
- if (context != NULL && *context != '\0')
- res = g_dpgettext2 (domain, context, string);
- else
- res = g_dgettext (domain, string);
- }
- else
- res = string;
-
- if (str != NULL)
- *str = g_strdup (res);
-
- return TRUE;
-}
-
-gboolean
-_clutter_script_parse_node (ClutterScript *script,
- GValue *value,
- const gchar *name,
- JsonNode *node,
- GParamSpec *pspec)
-{
- GValue node_value = G_VALUE_INIT;
- gboolean retval = FALSE;
-
- g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), FALSE);
- g_return_val_if_fail (name != NULL, FALSE);
- g_return_val_if_fail (node != NULL, FALSE);
-
- switch (JSON_NODE_TYPE (node))
- {
- case JSON_NODE_OBJECT:
- /* if we don't have a GParamSpec we can't infer the type
- * of the property; this usually means that this property
- * is a custom member that will be parsed by the Scriptable
- * interface implementantion
- */
- if (pspec == NULL && !G_IS_VALUE (value))
- return FALSE;
- else
- {
- GType p_type;
- ObjectInfo *oinfo;
- const gchar *id_;
-
- if (G_IS_VALUE (value))
- p_type = G_VALUE_TYPE (value);
- else
- {
- p_type = G_PARAM_SPEC_VALUE_TYPE (pspec);
- g_value_init (value, p_type);
- }
-
- if (g_type_is_a (p_type, G_TYPE_OBJECT))
- {
- /* default GObject handling: we get the id and
- * retrieve the ObjectInfo for it; since the object
- * definitions are parsed leaf-first we are guaranteed
- * to have a defined object at this point
- */
- id_ = _clutter_script_get_id_from_node (node);
- if (id_ == NULL || *id_ == '\0')
- return FALSE;
-
- oinfo = _clutter_script_get_object_info (script, id_);
- if (oinfo == NULL || oinfo->gtype == G_TYPE_INVALID )
- return FALSE;
-
- if (g_type_is_a (oinfo->gtype, p_type))
- {
- /* force construction, even though it should
- * not be necessary; we don't need the properties
- * to be applied as well: they will when the
- * ScriptParser finishes
- */
- _clutter_script_construct_object (script, oinfo);
-
- g_value_set_object (value, oinfo->object);
-
- return TRUE;
- }
- }
- else if (p_type == CLUTTER_TYPE_KNOT)
- {
- ClutterKnot knot = { 0, };
-
- /* knot := { "x" : (int), "y" : (int) } */
-
- if (_clutter_script_parse_knot (script, node, &knot))
- {
- g_value_set_boxed (value, &knot);
- return TRUE;
- }
- }
- else if (p_type == GRAPHENE_TYPE_RECT)
- {
- graphene_rect_t rect = GRAPHENE_RECT_INIT_ZERO;
-
- /* rect := {
- * "x" : (int),
- * "y" : (int),
- * "width" : (int),
- * "height" : (int)
- * }
- */
-
- if (_clutter_script_parse_rect (script, node, &rect))
- {
- g_value_set_boxed (value, &rect);
- return TRUE;
- }
- }
- else if (p_type == CLUTTER_TYPE_COLOR)
- {
- ClutterColor color = { 0, };
-
- /* color := {
- * "red" : (int),
- * "green" : (int),
- * "blue" : (int),
- * "alpha" : (int)
- * }
- */
-
- if (_clutter_script_parse_color (script, node, &color))
- {
- g_value_set_boxed (value, &color);
- return TRUE;
- }
- }
- else if (p_type == GRAPHENE_TYPE_POINT)
- {
- graphene_point_t point = GRAPHENE_POINT_INIT_ZERO;
-
- if (_clutter_script_parse_point (script, node, &point))
- {
- g_value_set_boxed (value, &point);
- return TRUE;
- }
- }
- else if (p_type == GRAPHENE_TYPE_SIZE)
- {
- graphene_size_t size = GRAPHENE_SIZE_INIT_ZERO;
-
- if (_clutter_script_parse_size (script, node, &size))
- {
- g_value_set_boxed (value, &size);
- return TRUE;
- }
- }
- else if (p_type == G_TYPE_STRING)
- {
- char *str = NULL;
-
- if (_clutter_script_parse_translatable_string (script, node, &str))
- {
- g_value_take_string (value, str);
- return TRUE;
- }
- }
- }
- return FALSE;
-
- case JSON_NODE_ARRAY:
- if (!pspec && !G_IS_VALUE (value))
- return FALSE;
- else
- {
- if (!G_IS_VALUE (value))
- g_value_init (value, G_PARAM_SPEC_VALUE_TYPE (pspec));
-
- if (G_VALUE_HOLDS (value, CLUTTER_TYPE_KNOT))
- {
- ClutterKnot knot = { 0, };
-
- /* knot := [ (int), (int) ] */
-
- if (_clutter_script_parse_knot (script, node, &knot))
- {
- g_value_set_boxed (value, &knot);
- return TRUE;
- }
- }
- else if (G_VALUE_HOLDS (value, GRAPHENE_TYPE_RECT))
- {
- graphene_rect_t rect = GRAPHENE_RECT_INIT_ZERO;
-
- /* rect := [ (int), (int), (int), (int) ] */
-
- if (_clutter_script_parse_rect (script, node, &rect))
- {
- g_value_set_boxed (value, &rect);
- return TRUE;
- }
- }
- else if (CLUTTER_VALUE_HOLDS_COLOR (value))
- {
- ClutterColor color = { 0, };
-
- /* color := [ (int), (int), (int), (int) ] */
-
- if (_clutter_script_parse_color (script, node, &color))
- {
- g_value_set_boxed (value, &color);
- return TRUE;
- }
- }
- else if (G_VALUE_HOLDS (value, GRAPHENE_TYPE_POINT))
- {
- graphene_point_t point = GRAPHENE_POINT_INIT_ZERO;
-
- if (_clutter_script_parse_point (script, node, &point))
- {
- g_value_set_boxed (value, &point);
- return TRUE;
- }
- }
- else if (G_VALUE_HOLDS (value, GRAPHENE_TYPE_SIZE))
- {
- graphene_size_t size = GRAPHENE_SIZE_INIT_ZERO;
-
- if (_clutter_script_parse_size (script, node, &size))
- {
- g_value_set_boxed (value, &size);
- return TRUE;
- }
- }
- else if (G_VALUE_HOLDS (value, G_TYPE_STRV))
- {
- JsonArray *array = json_node_get_array (node);
- guint i, array_len = json_array_get_length (array);
- GPtrArray *str_array = g_ptr_array_sized_new (array_len);
-
- /* strv := [ (str), (str), ... ] */
-
- for (i = 0; i < array_len; i++)
- {
- JsonNode *val = json_array_get_element (array, i);
-
- if (JSON_NODE_TYPE (val) != JSON_NODE_VALUE &&
- json_node_get_string (val) == NULL)
- continue;
-
- g_ptr_array_add (str_array,
- (gpointer) json_node_get_string (val));
- }
-
- g_value_set_boxed (value, str_array->pdata);
- g_ptr_array_free (str_array, TRUE);
-
- return TRUE;
- }
- }
- return FALSE;
-
- case JSON_NODE_NULL:
- return FALSE;
-
- case JSON_NODE_VALUE:
- json_node_get_value (node, &node_value);
-
- if (!pspec && !G_IS_VALUE (value))
- g_value_init (value, G_VALUE_TYPE (&node_value));
- else if (pspec)
- g_value_init (value, G_PARAM_SPEC_VALUE_TYPE (pspec));
-
- switch (G_TYPE_FUNDAMENTAL (G_VALUE_TYPE (value)))
- {
- /* fundamental JSON types */
- case G_TYPE_INT64:
- case G_TYPE_DOUBLE:
- case G_TYPE_STRING:
- case G_TYPE_BOOLEAN:
- g_value_copy (&node_value, value);
- retval = TRUE;
- break;
-
- case G_TYPE_INT:
- g_value_set_int (value, g_value_get_int64 (&node_value));
- retval = TRUE;
- break;
-
- case G_TYPE_UINT:
- g_value_set_uint (value, (guint) g_value_get_int64 (&node_value));
- retval = TRUE;
- break;
-
- case G_TYPE_ULONG:
- g_value_set_ulong (value, (gulong) g_value_get_int64 (&node_value));
- retval = TRUE;
- break;
-
- case G_TYPE_UCHAR:
- g_value_set_uchar (value, (guchar) g_value_get_int64 (&node_value));
- retval = TRUE;
- break;
-
- case G_TYPE_FLOAT:
- if (G_VALUE_HOLDS (&node_value, G_TYPE_DOUBLE))
- {
- g_value_set_float (value, g_value_get_double (&node_value));
- retval = TRUE;
- }
- else if (G_VALUE_HOLDS (&node_value, G_TYPE_INT64))
- {
- g_value_set_float (value, g_value_get_int64 (&node_value));
- retval = TRUE;
- }
- break;
-
- case G_TYPE_ENUM:
- if (G_VALUE_HOLDS (&node_value, G_TYPE_INT64))
- {
- g_value_set_enum (value, g_value_get_int64 (&node_value));
- retval = TRUE;
- }
- else if (G_VALUE_HOLDS (&node_value, G_TYPE_STRING))
- {
- gint enum_value;
-
- retval = _clutter_script_enum_from_string (G_VALUE_TYPE (value),
- g_value_get_string (&node_value),
- &enum_value);
- if (retval)
- g_value_set_enum (value, enum_value);
- }
- break;
-
- case G_TYPE_FLAGS:
- if (G_VALUE_HOLDS (&node_value, G_TYPE_INT64))
- {
- g_value_set_flags (value, g_value_get_int64 (&node_value));
- retval = TRUE;
- }
- else if (G_VALUE_HOLDS (&node_value, G_TYPE_STRING))
- {
- gint flags_value;
-
- retval = _clutter_script_flags_from_string (G_VALUE_TYPE (value),
- g_value_get_string (&node_value),
- &flags_value);
- if (retval)
- g_value_set_flags (value, flags_value);
- }
- break;
-
- case G_TYPE_BOXED:
- if (G_VALUE_HOLDS (value, CLUTTER_TYPE_COLOR))
- {
- ClutterColor color = { 0, };
-
- retval = _clutter_script_parse_color (script, node, &color);
- if (retval)
- clutter_value_set_color (value, &color);
- }
- break;
-
- case G_TYPE_OBJECT:
- if (G_VALUE_HOLDS (&node_value, G_TYPE_STRING))
- {
- const gchar *str = g_value_get_string (&node_value);
- GObject *object = clutter_script_get_object (script, str);
- if (object)
- {
- CLUTTER_NOTE (SCRIPT,
- "Assigning '%s' (%s) to property '%s'",
- str,
- G_OBJECT_TYPE_NAME (object),
- name);
-
- g_value_set_object (value, object);
- retval = TRUE;
- }
- }
- break;
-
- default:
- retval = FALSE;
- break;
- }
-
- if (G_VALUE_TYPE (value) == G_TYPE_GTYPE &&
- G_VALUE_HOLDS (&node_value, G_TYPE_STRING))
- {
- const gchar *str = g_value_get_string (&node_value);
- GType type = clutter_script_get_type_from_name (script, str);
- g_value_set_gtype (value, type);
- retval = TRUE;
- }
-
- g_value_unset (&node_value);
- break;
- }
-
- return retval;
-}
-
-static GList *
-clutter_script_translate_parameters (ClutterScript *script,
- GObject *object,
- const gchar *name,
- GList *properties,
- GPtrArray **param_names,
- GArray **param_values)
-{
- 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);
-
- if (CLUTTER_IS_SCRIPTABLE (object))
- {
- scriptable = CLUTTER_SCRIPTABLE (object);
- iface = CLUTTER_SCRIPTABLE_GET_IFACE (scriptable);
-
- if (iface->parse_custom_node)
- parse_custom = TRUE;
- }
-
- unparsed = NULL;
-
- for (l = properties; l != NULL; l = l->next)
- {
- PropertyInfo *pinfo = l->data;
- GValue value = G_VALUE_INIT;
- gboolean res = FALSE;
-
- if (pinfo->is_child || pinfo->is_layout)
- {
- CLUTTER_NOTE (SCRIPT, "Skipping %s property '%s'",
- pinfo->is_child ? "child" : "layout",
- pinfo->name);
- unparsed = g_list_prepend (unparsed, pinfo);
- continue;
- }
-
- CLUTTER_NOTE (SCRIPT, "Parsing %s property (id:%s)",
- pinfo->pspec ? "regular" : "custom",
- pinfo->name);
-
- if (parse_custom)
- res = iface->parse_custom_node (scriptable, script, &value,
- pinfo->name,
- pinfo->node);
-
- if (!res)
- res = _clutter_script_parse_node (script, &value,
- pinfo->name,
- pinfo->node,
- pinfo->pspec);
-
- if (!res)
- {
- CLUTTER_NOTE (SCRIPT, "Property '%s' ignored", pinfo->name);
- unparsed = g_list_prepend (unparsed, pinfo);
- continue;
- }
-
- g_ptr_array_add (*param_names, g_strdup (pinfo->name));
- g_array_append_val (*param_values, value);
-
- property_info_free (pinfo);
- }
-
- g_list_free (properties);
-
- return unparsed;
-}
-
-static GList *
-clutter_script_construct_parameters (ClutterScript *script,
- GType gtype,
- const gchar *name,
- GList *properties,
- GPtrArray **construct_param_names,
- GArray **construct_param_values)
-{
- GObjectClass *klass;
- GList *l, *unparsed;
-
- 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);
-
- unparsed = NULL;
-
- for (l = properties; l != NULL; l = l->next)
- {
- PropertyInfo *pinfo = l->data;
- GValue value = G_VALUE_INIT;
- GParamSpec *pspec = NULL;
-
- /* we allow custom property names for classes, so if we
- * don't find a corresponding GObject property for this
- * class we just skip it and let the class itself deal
- * with it later on
- */
- pspec = g_object_class_find_property (klass, pinfo->name);
- if (pspec)
- pinfo->pspec = g_param_spec_ref (pspec);
- else
- {
- pinfo->pspec = NULL;
- unparsed = g_list_prepend (unparsed, pinfo);
- continue;
- }
-
- if (!(pspec->flags & (G_PARAM_CONSTRUCT | G_PARAM_CONSTRUCT_ONLY)))
- {
- unparsed = g_list_prepend (unparsed, pinfo);
- continue;
- }
-
- if (!_clutter_script_parse_node (script, &value,
- pinfo->name,
- pinfo->node,
- pinfo->pspec))
- {
- unparsed = g_list_prepend (unparsed, pinfo);
- continue;
- }
-
- g_ptr_array_add (*construct_param_names, g_strdup (pinfo->name));
- g_array_append_val (*construct_param_values, value);
-
- property_info_free (pinfo);
- }
-
- g_list_free (properties);
-
- g_type_class_unref (klass);
-
- return unparsed;
-}
-
-static void
-apply_layout_properties (ClutterScript *script,
- ClutterContainer *container,
- ClutterActor *actor,
- ObjectInfo *oinfo)
-{
- ClutterScriptable *scriptable = NULL;
- ClutterScriptableIface *iface = NULL;
- gboolean parse_custom_node = FALSE;
- GList *l, *unresolved, *properties;
- ClutterLayoutManager *manager;
- GType meta_type;
-
- manager = g_object_get_data (G_OBJECT (container), "clutter-layout-manager");
- if (manager == NULL)
- return;
-
- meta_type = _clutter_layout_manager_get_child_meta_type (manager);
- if (meta_type == G_TYPE_INVALID)
- return;
-
- CLUTTER_NOTE (SCRIPT, "Layout manager of type '%s' with meta type '%s'",
- G_OBJECT_TYPE_NAME (manager),
- g_type_name (meta_type));
-
- /* shortcut, to avoid typechecking every time */
- if (CLUTTER_IS_SCRIPTABLE (manager))
- {
- scriptable = CLUTTER_SCRIPTABLE (manager);
- iface = CLUTTER_SCRIPTABLE_GET_IFACE (scriptable);
-
- parse_custom_node = iface->parse_custom_node != NULL ? TRUE : FALSE;
- }
-
- properties = oinfo->properties;
- oinfo->properties = NULL;
-
- unresolved = NULL;
- for (l = properties; l != NULL; l = l->next)
- {
- PropertyInfo *pinfo = l->data;
- GValue value = G_VALUE_INIT;
- gboolean res = FALSE;
- const gchar *name;
-
- if (!pinfo->is_layout)
- {
- unresolved = g_list_prepend (unresolved, pinfo);
- continue;
- }
-
- name = pinfo->name + strlen ("layout::");
-
- pinfo->pspec =
- clutter_layout_manager_find_child_property (manager, name);
-
- if (pinfo->pspec != NULL)
- g_param_spec_ref (pinfo->pspec);
-
- CLUTTER_NOTE (SCRIPT, "Parsing %s layout property (id:%s)",
- pinfo->pspec != NULL ? "regular" : "custom",
- name);
-
- if (parse_custom_node)
- res = iface->parse_custom_node (scriptable, script, &value,
- name,
- pinfo->node);
-
- if (!res)
- res = _clutter_script_parse_node (script, &value,
- name,
- pinfo->node,
- pinfo->pspec);
-
- if (!res)
- {
- CLUTTER_NOTE (SCRIPT, "Layout property '%s' ignored", name);
- unresolved = g_list_prepend (unresolved, pinfo);
- continue;
- }
-
- CLUTTER_NOTE (SCRIPT,
- "Setting %s layout property '%s' (type:%s) to "
- "object '%s' (id:%s)",
- iface->set_custom_property != NULL ? "custom" : "regular",
- name,
- g_type_name (G_VALUE_TYPE (&value)),
- g_type_name (oinfo->gtype),
- oinfo->id);
-
- clutter_layout_manager_child_set_property (manager, container, actor,
- name,
- &value);
-
- g_value_unset (&value);
-
- property_info_free (pinfo);
- }
-
- g_list_free (properties);
-
- oinfo->properties = unresolved;
-}
-
-static void
-apply_child_properties (ClutterScript *script,
- ClutterContainer *container,
- ClutterActor *actor,
- ObjectInfo *oinfo)
-{
- ClutterScriptable *scriptable = NULL;
- ClutterScriptableIface *iface = NULL;
- gboolean parse_custom_node = FALSE;
- GList *l, *unresolved, *properties;
- GObjectClass *klass;
- GType meta_type;
-
- meta_type = CLUTTER_CONTAINER_GET_IFACE (container)->child_meta_type;
- if (meta_type == G_TYPE_INVALID)
- return;
-
- klass = G_OBJECT_GET_CLASS (container);
-
- /* shortcut, to avoid typechecking every time */
- if (CLUTTER_IS_SCRIPTABLE (container))
- {
- scriptable = CLUTTER_SCRIPTABLE (container);
- iface = CLUTTER_SCRIPTABLE_GET_IFACE (scriptable);
-
- parse_custom_node = iface->parse_custom_node != NULL ? TRUE : FALSE;
- }
-
- properties = oinfo->properties;
- oinfo->properties = NULL;
-
- unresolved = NULL;
- for (l = properties; l != NULL; l = l->next)
- {
- PropertyInfo *pinfo = l->data;
- GValue value = G_VALUE_INIT;
- gboolean res = FALSE;
- const gchar *name;
-
- if (!pinfo->is_child)
- {
- unresolved = g_list_prepend (unresolved, pinfo);
- continue;
- }
-
- name = pinfo->name + strlen ("child::");
-
- pinfo->pspec =
- clutter_container_class_find_child_property (klass, name);
-
- if (pinfo->pspec != NULL)
- g_param_spec_ref (pinfo->pspec);
-
- CLUTTER_NOTE (SCRIPT, "Parsing %s child property (id:%s)",
- pinfo->pspec != NULL ? "regular" : "custom",
- name);
-
- if (parse_custom_node)
- res = iface->parse_custom_node (scriptable, script, &value,
- name,
- pinfo->node);
-
- if (!res)
- res = _clutter_script_parse_node (script, &value,
- name,
- pinfo->node,
- pinfo->pspec);
-
- if (!res)
- {
- CLUTTER_NOTE (SCRIPT, "Child property '%s' ignored", name);
- unresolved = g_list_prepend (unresolved, pinfo);
- continue;
- }
-
-
- CLUTTER_NOTE (SCRIPT,
- "Setting %s child property '%s' (type:%s) to "
- "object '%s' (id:%s)",
- iface->set_custom_property != NULL ? "custom" : "regular",
- name,
- g_type_name (G_VALUE_TYPE (&value)),
- g_type_name (oinfo->gtype),
- oinfo->id);
-
- clutter_container_child_set_property (container, actor,
- name,
- &value);
-
- g_value_unset (&value);
-
- property_info_free (pinfo);
- }
-
- g_list_free (properties);
-
- oinfo->properties = unresolved;
-}
-
-static void
-add_children (ClutterScript *script,
- ObjectInfo *oinfo)
-{
- ClutterContainer *container = CLUTTER_CONTAINER (oinfo->object);
- GList *l, *unresolved;
-
- unresolved = NULL;
- for (l = oinfo->children; l != NULL; l = l->next)
- {
- const gchar *name = l->data;
- GObject *object = NULL;
- ObjectInfo *child_info;
-
- child_info = _clutter_script_get_object_info (script, name);
- if (child_info != NULL)
- {
- _clutter_script_construct_object (script, child_info);
- object = child_info->object;
- }
-
- if (object == NULL)
- {
- unresolved = g_list_prepend (unresolved, g_strdup (name));
- continue;
- }
-
- if (!CLUTTER_IS_ACTOR (object))
- {
- g_warning ("The object definition '%s' (type: %s) is not "
- "an actor, but it is referenced in the 'children' "
- "member of the container '%s' (type: %s); skipping.",
- child_info->id,
- g_type_name (child_info->gtype),
- oinfo->id,
- g_type_name (oinfo->gtype));
- continue;
- }
-
- CLUTTER_NOTE (SCRIPT, "Adding children '%s' to actor of type '%s'",
- name,
- g_type_name (G_OBJECT_TYPE (container)));
-
- clutter_container_add_actor (container, CLUTTER_ACTOR (object));
- }
-
- g_list_free_full (oinfo->children, g_free);
-
- oinfo->children = unresolved;
-}
-
-static inline void
-_clutter_script_check_unresolved (ClutterScript *script,
- ObjectInfo *oinfo)
-{
- if (oinfo->children != NULL && CLUTTER_IS_CONTAINER (oinfo->object))
- add_children (script, oinfo);
-
- /* this is a bit *eugh*, but it allows us to effectively make sure
- * that child and layout properties are parsed and applied to the
- * right child
- */
- if (oinfo->properties != NULL && CLUTTER_IS_ACTOR (oinfo->object))
- {
- ClutterActor *parent;
-
- parent = clutter_actor_get_parent (CLUTTER_ACTOR (oinfo->object));
- if (parent != NULL)
- {
- ClutterContainer *container = CLUTTER_CONTAINER (parent);
- ClutterActor *child;
-
- for (child = clutter_actor_get_first_child (parent);
- child != NULL;
- child = clutter_actor_get_next_sibling (child))
- {
- ObjectInfo *child_info;
- const gchar *id_;
-
- id_ = clutter_get_script_id (G_OBJECT (child));
- if (id_ == NULL || *id_ == '\0')
- continue;
-
- child_info = _clutter_script_get_object_info (script, id_);
- if (child_info == NULL)
- continue;
-
- apply_child_properties (script, container,
- child,
- child_info);
- apply_layout_properties (script, container,
- child,
- child_info);
- }
- }
- }
-
- if (oinfo->properties || oinfo->children)
- oinfo->has_unresolved = TRUE;
- else
- oinfo->has_unresolved = FALSE;
-}
-
-void
-_clutter_script_apply_properties (ClutterScript *script,
- ObjectInfo *oinfo)
-{
- ClutterScriptable *scriptable = NULL;
- ClutterScriptableIface *iface = NULL;
- gboolean set_custom_property = FALSE;
- GObject *object = oinfo->object;
- GList *properties;
- g_autoptr (GPtrArray) param_names = NULL;
- g_autoptr (GArray) param_values = NULL;
- guint i;
-
- if (!oinfo->has_unresolved)
- return;
-
- /* shortcut, to avoid typechecking every time */
- if (CLUTTER_IS_SCRIPTABLE (object))
- {
- scriptable = CLUTTER_SCRIPTABLE (object);
- iface = CLUTTER_SCRIPTABLE_GET_IFACE (scriptable);
-
- if (iface->set_custom_property)
- set_custom_property = TRUE;
- }
-
- /* then we get the rest of the parameters, asking the object itself
- * to translate them for us, if we cannot do that
- */
- properties = oinfo->properties;
- oinfo->properties = clutter_script_translate_parameters (script,
- object,
- oinfo->id,
- properties,
- &param_names,
- &param_values);
-
- /* consume all the properties we could translate in this pass */
- for (i = 0; i < param_names->len; i++)
- {
- char *name = g_ptr_array_index (param_names, i);
- GValue *value = &g_array_index (param_values, GValue, 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)),
- g_type_name (oinfo->gtype),
- oinfo->id);
-
- if (set_custom_property)
- iface->set_custom_property (scriptable, script,
- name,
- value);
- else
- g_object_set_property (object, name, value);
- }
-
- _clutter_script_check_unresolved (script, oinfo);
-}
-
-void
-_clutter_script_construct_object (ClutterScript *script,
- ObjectInfo *oinfo)
-{
- g_autoptr (GPtrArray) param_names = NULL;
- g_autoptr (GArray) param_values = NULL;
-
- /* we have completely updated the object */
- if (oinfo->object != NULL)
- {
- if (oinfo->has_unresolved)
- _clutter_script_check_unresolved (script, oinfo);
-
- return;
- }
-
- if (oinfo->gtype == G_TYPE_INVALID)
- {
- if (G_UNLIKELY (oinfo->type_func))
- oinfo->gtype = _clutter_script_get_type_from_symbol (oinfo->type_func);
- else
- oinfo->gtype = clutter_script_get_type_from_name (script, oinfo->class_name);
-
- if (G_UNLIKELY (oinfo->gtype == G_TYPE_INVALID))
- return;
- }
-
- oinfo->is_actor = g_type_is_a (oinfo->gtype, CLUTTER_TYPE_ACTOR);
- if (oinfo->is_actor)
- oinfo->is_stage = g_type_is_a (oinfo->gtype, CLUTTER_TYPE_STAGE);
-
- if (oinfo->is_stage && oinfo->is_stage_default)
- {
- ClutterStageManager *manager = clutter_stage_manager_get_default ();
- GList *properties = oinfo->properties;
- ClutterStage *default_stage;
-
- /* the default stage is a complex beast: we cannot create it using
- * g_object_newv() but we need clutter_script_construct_parameters()
- * to add the GParamSpec to the PropertyInfo pspec member, so
- * that we don't have to implement every complex property (like
- * the "color" one) directly inside the ClutterStage class.
- */
- oinfo->properties =
- clutter_script_construct_parameters (script,
- oinfo->gtype,
- oinfo->id,
- properties,
- &param_names,
- &param_values);
-
- default_stage = clutter_stage_manager_get_default_stage (manager);
- oinfo->object = G_OBJECT (default_stage);
- }
- else
- {
- GList *properties = oinfo->properties;
-
- /* every other object: first, we get the construction parameters */
- oinfo->properties =
- clutter_script_construct_parameters (script,
- oinfo->gtype,
- oinfo->id,
- properties,
- &param_names,
- &param_values);
-
- oinfo->object = g_object_new_with_properties (oinfo->gtype,
- param_names->len,
- (const gchar **) param_names->pdata,
- (const GValue *) param_values->data);
-
- /* by sinking the floating reference, we make sure that the reference
- * count is correct whether the object is referenced from somewhere
- * else too or only by this ClutterScript object.
- */
- g_object_ref_sink (oinfo->object);
- }
-
- g_assert (oinfo->object != NULL);
-
- if (CLUTTER_IS_SCRIPTABLE (oinfo->object))
- clutter_scriptable_set_id (CLUTTER_SCRIPTABLE (oinfo->object), oinfo->id);
- else
- g_object_set_data_full (oinfo->object, "clutter-script-id",
- g_strdup (oinfo->id),
- g_free);
-
- _clutter_script_check_unresolved (script, oinfo);
-}
diff --git a/clutter/clutter/clutter-script-private.h b/clutter/clutter/clutter-script-private.h
deleted file mode 100644
index 52c240e2a..000000000
--- a/clutter/clutter/clutter-script-private.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- *
- * Copyright (C) 2006 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 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_SCRIPT_PRIVATE_H__
-#define __CLUTTER_SCRIPT_PRIVATE_H__
-
-#include <glib-object.h>
-#include <json-glib/json-glib.h>
-
-#include "clutter-color.h"
-#include "clutter-types.h"
-#include "clutter-script.h"
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_SCRIPT_PARSER (_clutter_script_parser_get_type ())
-#define CLUTTER_SCRIPT_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_SCRIPT_PARSER, ClutterScriptParser))
-#define CLUTTER_IS_SCRIPT_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_SCRIPT_PARSER))
-
-typedef struct _ClutterScriptParser ClutterScriptParser;
-typedef struct _JsonParserClass ClutterScriptParserClass;
-
-struct _ClutterScriptParser
-{
- JsonParser parent_instance;
-
- /* back reference */
- ClutterScript *script;
-};
-
-typedef GType (* GTypeGetFunc) (void);
-
-typedef struct {
- gchar *id;
- gchar *class_name;
- gchar *type_func;
-
- GList *properties;
- GList *children;
- GList *signals;
-
- GType gtype;
- GObject *object;
-
- guint merge_id;
-
- guint is_actor : 1;
- guint is_stage : 1;
- guint is_stage_default : 1;
- guint has_unresolved : 1;
- guint is_unmerged : 1;
-} ObjectInfo;
-
-void object_info_free (gpointer data);
-
-typedef struct {
- gchar *name;
- JsonNode *node;
- GParamSpec *pspec;
-
- guint is_child : 1;
- guint is_layout : 1;
-} PropertyInfo;
-
-typedef struct {
- gchar *name;
- gchar *handler;
- gchar *object;
- gchar *state;
- gchar *target;
-
- GConnectFlags flags;
-
- guint is_handler : 1;
- guint warp_to : 1;
-} SignalInfo;
-
-void property_info_free (gpointer data);
-
-GType _clutter_script_parser_get_type (void) G_GNUC_CONST;
-
-gboolean _clutter_script_parse_node (ClutterScript *script,
- GValue *value,
- const gchar *name,
- JsonNode *node,
- GParamSpec *pspec);
-
-GType _clutter_script_get_type_from_symbol (const gchar *symbol);
-GType _clutter_script_get_type_from_class (const gchar *name);
-
-gboolean _clutter_script_enum_from_string (GType gtype,
- const gchar *string,
- gint *enum_value);
-gboolean _clutter_script_flags_from_string (GType gtype,
- const gchar *string,
- gint *flags_value);
-
-gboolean _clutter_script_parse_knot (ClutterScript *script,
- JsonNode *node,
- ClutterKnot *knot);
-gboolean _clutter_script_parse_rect (ClutterScript *script,
- JsonNode *node,
- graphene_rect_t *rect);
-gboolean _clutter_script_parse_color (ClutterScript *script,
- JsonNode *node,
- ClutterColor *color);
-gboolean _clutter_script_parse_point (ClutterScript *script,
- JsonNode *node,
- graphene_point_t *point);
-gboolean _clutter_script_parse_size (ClutterScript *script,
- JsonNode *node,
- graphene_size_t *size);
-
-gboolean _clutter_script_parse_translatable_string (ClutterScript *script,
- JsonNode *node,
- char **str);
-
-void _clutter_script_construct_object (ClutterScript *script,
- ObjectInfo *oinfo);
-void _clutter_script_apply_properties (ClutterScript *script,
- ObjectInfo *oinfo);
-
-gchar *_clutter_script_generate_fake_id (ClutterScript *script);
-
-void _clutter_script_warn_missing_attribute (ClutterScript *script,
- const gchar *id,
- const gchar *attribute);
-
-void _clutter_script_warn_invalid_value (ClutterScript *script,
- const gchar *attribute,
- const gchar *expected,
- JsonNode *node);
-
-ObjectInfo *_clutter_script_get_object_info (ClutterScript *script,
- const gchar *script_id);
-
-guint _clutter_script_get_last_merge_id (ClutterScript *script);
-
-void _clutter_script_add_object_info (ClutterScript *script,
- ObjectInfo *oinfo);
-
-const gchar *_clutter_script_get_id_from_node (JsonNode *node);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_SCRIPT_PRIVATE_H__ */
diff --git a/clutter/clutter/clutter-script.c b/clutter/clutter/clutter-script.c
deleted file mode 100644
index e9d4d545e..000000000
--- a/clutter/clutter/clutter-script.c
+++ /dev/null
@@ -1,1388 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- *
- * Copyright (C) 2006 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- *
- */
-
-/**
- * SECTION:clutter-script
- * @short_description: Loads a scene from UI definition data
- *
- * #ClutterScript is an object used for loading and building parts or a
- * complete scenegraph from external definition data in forms of string
- * buffers or files.
- *
- * The UI definition format is JSON, the JavaScript Object Notation as
- * described by RFC 4627. #ClutterScript can load a JSON data stream,
- * parse it and build all the objects defined into it. Each object must
- * have an "id" and a "type" properties defining the name to be used
- * to retrieve it from #ClutterScript with clutter_script_get_object(),
- * and the class type to be instantiated. Every other attribute will
- * be mapped to the class properties.
- *
- * A #ClutterScript holds a reference on every object it creates from
- * the definition data, except for the stage. Every non-actor object
- * will be finalized when the #ClutterScript instance holding it will
- * be finalized, so they need to be referenced using g_object_ref() in
- * order for them to survive.
- *
- * A simple object might be defined as:
- *
- * <informalexample><programlisting><![CDATA[
- * {
- * "id" : "red-button",
- * "type" : "ClutterActor",
- * "width" : 100,
- * "height" : 100,
- * "background-color" : "&num;ff0000ff"
- * }
- * ]]></programlisting></informalexample>
- *
- * This will produce a red #ClutterActor, 100x100 pixels wide, and
- * with a ClutterScript id of "red-button"; it can be retrieved by calling:
- *
- * |[
- * ClutterActor *red_button;
- *
- * red_button = CLUTTER_ACTOR (clutter_script_get_object (script, "red-button"));
- * ]|
- *
- * and then manipulated with the Clutter API. For every object created
- * using ClutterScript it is possible to check the id by calling
- * clutter_get_script_id().
- *
- * Packing can be represented using the "children" member, and passing an
- * array of objects or ids of objects already defined (but not packed: the
- * packing rules of Clutter still apply, and an actor cannot be packed
- * in multiple containers without unparenting it in between).
- *
- * Signal handlers can be defined inside a Clutter UI definition file and
- * then autoconnected to their respective signals using the
- * clutter_script_connect_signals() function:
- *
- * <informalexample><programlisting><![CDATA[
- * ...
- * "signals" : [
- * { "name" : "button-press-event", "handler" : "on_button_press" },
- * {
- * "name" : "foo-signal",
- * "handler" : "after_foo",
- * "after" : true
- * },
- * ],
- * ...
- * ]]></programlisting></informalexample>
- *
- * Signal handler definitions must have a "name" and a "handler" members;
- * they can also have the "after" and "swapped" boolean members (for the
- * signal connection flags %G_CONNECT_AFTER and %G_CONNECT_SWAPPED
- * respectively) and the "object" string member for calling
- * g_signal_connect_object() instead of g_signal_connect().
- *
- * Clutter reserves the following names, so classes defining properties
- * through the usual GObject registration process should avoid using these
- * names to avoid collisions:
- *
- * <programlisting><![CDATA[
- * "id" := the unique name of a ClutterScript object
- * "type" := the class literal name, also used to infer the type
- * function
- * "type_func" := the GType function name, for non-standard classes
- * "children" := an array of names or objects to add as children
- * "signals" := an array of signal definitions to connect to an object
- * "is-default" := a boolean flag used when defining the #ClutterStage;
- * if set to "true" the default stage will be used instead
- * of creating a new #ClutterStage instance
- * ]]></programlisting>
- *
- * #ClutterScript is available since Clutter 0.6
- */
-
-#include "clutter-build-config.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <errno.h>
-
-#include <glib.h>
-#include <glib-object.h>
-#include <gmodule.h>
-
-#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
-
-#include "clutter-actor.h"
-#include "clutter-stage.h"
-
-#include "clutter-script.h"
-#include "clutter-script-private.h"
-#include "clutter-scriptable.h"
-
-#include "clutter-enum-types.h"
-#include "clutter-private.h"
-#include "clutter-debug.h"
-
-#include "deprecated/clutter-container.h"
-
-enum
-{
- PROP_0,
-
- PROP_FILENAME_SET,
- PROP_FILENAME,
- PROP_TRANSLATION_DOMAIN,
-
- PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST];
-
-struct _ClutterScriptPrivate
-{
- GHashTable *objects;
-
- guint last_merge_id;
- guint last_unknown;
-
- ClutterScriptParser *parser;
-
- gchar **search_paths;
-
- gchar *translation_domain;
-
- gchar *filename;
- guint is_filename : 1;
-};
-
-G_DEFINE_TYPE_WITH_PRIVATE (ClutterScript, clutter_script, G_TYPE_OBJECT)
-
-static GType
-clutter_script_real_get_type_from_name (ClutterScript *script,
- const gchar *type_name)
-{
- GType gtype;
-
- gtype = g_type_from_name (type_name);
- if (gtype != G_TYPE_INVALID)
- return gtype;
-
- return _clutter_script_get_type_from_class (type_name);
-}
-
-void
-property_info_free (gpointer data)
-{
- if (G_LIKELY (data))
- {
- PropertyInfo *pinfo = data;
-
- if (pinfo->node)
- json_node_free (pinfo->node);
-
- if (pinfo->pspec)
- g_param_spec_unref (pinfo->pspec);
-
- g_free (pinfo->name);
-
- g_free (pinfo);
- }
-}
-
-static void
-signal_info_free (gpointer data)
-{
- if (G_LIKELY (data))
- {
- SignalInfo *sinfo = data;
-
- g_free (sinfo->name);
- g_free (sinfo->handler);
- g_free (sinfo->object);
- g_free (sinfo->target);
-
- g_free (sinfo);
- }
-}
-
-void
-object_info_free (gpointer data)
-{
- if (G_LIKELY (data))
- {
- ObjectInfo *oinfo = data;
-
- g_free (oinfo->id);
- g_free (oinfo->class_name);
- g_free (oinfo->type_func);
-
- g_list_free_full (oinfo->properties, property_info_free);
-
- g_list_free_full (oinfo->signals, signal_info_free);
-
- /* these are ids */
- g_list_free_full (oinfo->children, g_free);
-
- /* we unref top-level objects and leave the actors alone,
- * unless we are unmerging in which case we have to destroy
- * the actor to unparent them
- */
- if (oinfo->object != NULL)
- {
- if (oinfo->is_unmerged)
- {
- if (oinfo->is_actor && !oinfo->is_stage)
- clutter_actor_destroy (CLUTTER_ACTOR (oinfo->object));
- }
-
- g_object_unref (oinfo->object);
-
- oinfo->object = NULL;
- }
-
- g_free (oinfo);
- }
-}
-
-static void
-clutter_script_finalize (GObject *gobject)
-{
- ClutterScriptPrivate *priv = CLUTTER_SCRIPT (gobject)->priv;
-
- g_object_unref (priv->parser);
- g_hash_table_destroy (priv->objects);
- g_strfreev (priv->search_paths);
- g_free (priv->filename);
- g_free (priv->translation_domain);
-
- G_OBJECT_CLASS (clutter_script_parent_class)->finalize (gobject);
-}
-
-static void
-clutter_script_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterScript *script = CLUTTER_SCRIPT (gobject);
-
- switch (prop_id)
- {
- case PROP_TRANSLATION_DOMAIN:
- clutter_script_set_translation_domain (script, g_value_get_string (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_script_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterScript *script = CLUTTER_SCRIPT (gobject);
-
- switch (prop_id)
- {
- case PROP_FILENAME_SET:
- g_value_set_boolean (value, script->priv->is_filename);
- break;
-
- case PROP_FILENAME:
- g_value_set_string (value, script->priv->filename);
- break;
-
- case PROP_TRANSLATION_DOMAIN:
- g_value_set_string (value, script->priv->translation_domain);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_script_class_init (ClutterScriptClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- klass->get_type_from_name = clutter_script_real_get_type_from_name;
-
- /**
- * ClutterScript:filename-set:
- *
- * Whether the #ClutterScript:filename property is set. If this property
- * is %TRUE then the currently parsed data comes from a file, and the
- * file name is stored inside the #ClutterScript:filename property.
- *
- * Since: 0.6
- */
- obj_props[PROP_FILENAME_SET] =
- g_param_spec_boolean ("filename-set",
- P_("Filename Set"),
- P_("Whether the :filename property is set"),
- FALSE,
- CLUTTER_PARAM_READABLE);
-
- /**
- * ClutterScript:filename:
- *
- * The path of the currently parsed file. If #ClutterScript:filename-set
- * is %FALSE then the value of this property is undefined.
- *
- * Since: 0.6
- */
- obj_props[PROP_FILENAME] =
- g_param_spec_string ("filename",
- P_("Filename"),
- P_("The path of the currently parsed file"),
- NULL,
- CLUTTER_PARAM_READABLE);
-
- /**
- * ClutterScript:translation-domain:
- *
- * The translation domain, used to localize strings marked as translatable
- * inside a UI definition.
- *
- * If #ClutterScript:translation-domain is set to %NULL, #ClutterScript
- * will use gettext(), otherwise g_dgettext() will be used.
- *
- * Since: 1.10
- */
- obj_props[PROP_TRANSLATION_DOMAIN] =
- g_param_spec_string ("translation-domain",
- P_("Translation Domain"),
- P_("The translation domain used to localize string"),
- NULL,
- CLUTTER_PARAM_READWRITE);
-
- gobject_class->set_property = clutter_script_set_property;
- gobject_class->get_property = clutter_script_get_property;
- gobject_class->finalize = clutter_script_finalize;
-
- g_object_class_install_properties (gobject_class,
- PROP_LAST,
- obj_props);
-}
-
-static void
-clutter_script_init (ClutterScript *script)
-{
- ClutterScriptPrivate *priv;
-
- script->priv = priv = clutter_script_get_instance_private (script);
-
- priv->parser = g_object_new (CLUTTER_TYPE_SCRIPT_PARSER, NULL);
- priv->parser->script = script;
-
- priv->is_filename = FALSE;
- priv->last_merge_id = 0;
-
- priv->objects = g_hash_table_new_full (g_str_hash, g_str_equal,
- NULL,
- object_info_free);
-}
-
-/**
- * clutter_script_new:
- *
- * Creates a new #ClutterScript instance. #ClutterScript can be used to load
- * objects definitions for scenegraph elements, like actors, or behavioural
- * elements, like timelines. The definitions must be encoded using the
- * JavaScript Object Notation (JSON) language.
- *
- * Return value: the newly created #ClutterScript instance. Use
- * g_object_unref() when done.
- *
- * Since: 0.6
- */
-ClutterScript *
-clutter_script_new (void)
-{
- return g_object_new (CLUTTER_TYPE_SCRIPT, NULL);
-}
-
-/**
- * clutter_script_load_from_file:
- * @script: a #ClutterScript
- * @filename: the full path to the definition file
- * @error: return location for a #GError, or %NULL
- *
- * Loads the definitions from @filename into @script and merges with
- * the currently loaded ones, if any.
- *
- * Return value: on error, zero is returned and @error is set
- * accordingly. On success, the merge id for the UI definitions is
- * returned. You can use the merge id with clutter_script_unmerge_objects().
- *
- * Since: 0.6
- */
-guint
-clutter_script_load_from_file (ClutterScript *script,
- const gchar *filename,
- GError **error)
-{
- ClutterScriptPrivate *priv;
- GError *internal_error;
-
- g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), 0);
- g_return_val_if_fail (filename != NULL, 0);
-
- priv = script->priv;
-
- g_free (priv->filename);
- priv->filename = g_strdup (filename);
- priv->is_filename = TRUE;
- priv->last_merge_id += 1;
-
- internal_error = NULL;
- json_parser_load_from_file (JSON_PARSER (priv->parser),
- filename,
- &internal_error);
- if (internal_error)
- {
- g_propagate_error (error, internal_error);
- priv->last_merge_id -= 1;
- return 0;
- }
-
- return priv->last_merge_id;
-}
-
-/**
- * clutter_script_load_from_data:
- * @script: a #ClutterScript
- * @data: a buffer containing the definitions
- * @length: the length of the buffer, or -1 if @data is a NUL-terminated
- * buffer
- * @error: return location for a #GError, or %NULL
- *
- * Loads the definitions from @data into @script and merges with
- * the currently loaded ones, if any.
- *
- * Return value: on error, zero is returned and @error is set
- * accordingly. On success, the merge id for the UI definitions is
- * returned. You can use the merge id with clutter_script_unmerge_objects().
- *
- * Since: 0.6
- */
-guint
-clutter_script_load_from_data (ClutterScript *script,
- const gchar *data,
- gssize length,
- GError **error)
-{
- ClutterScriptPrivate *priv;
- GError *internal_error;
-
- g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), 0);
- g_return_val_if_fail (data != NULL, 0);
-
- if (length < 0)
- length = strlen (data);
-
- priv = script->priv;
-
- g_free (priv->filename);
- priv->filename = NULL;
- priv->is_filename = FALSE;
- priv->last_merge_id += 1;
-
- internal_error = NULL;
- json_parser_load_from_data (JSON_PARSER (priv->parser),
- data, length,
- &internal_error);
- if (internal_error)
- {
- g_propagate_error (error, internal_error);
- priv->last_merge_id -= 1;
- return 0;
- }
-
- return priv->last_merge_id;
-}
-
-/**
- * clutter_script_load_from_resource:
- * @script: a #ClutterScript
- * @resource_path: the resource path of the file to parse
- * @error: return location for a #GError, or %NULL
- *
- * Loads the definitions from a resource file into @script and merges with
- * the currently loaded ones, if any.
- *
- * Return value: on error, zero is returned and @error is set
- * accordingly. On success, the merge id for the UI definitions is
- * returned. You can use the merge id with clutter_script_unmerge_objects().
- *
- * Since: 1.10
- */
-guint
-clutter_script_load_from_resource (ClutterScript *script,
- const gchar *resource_path,
- GError **error)
-{
- GBytes *data;
- guint res;
-
- g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), 0);
-
- data = g_resources_lookup_data (resource_path, 0, error);
- if (data == NULL)
- return 0;
-
- res = clutter_script_load_from_data (script,
- g_bytes_get_data (data, NULL),
- g_bytes_get_size (data),
- error);
-
- g_bytes_unref (data);
-
- return res;
-}
-
-/**
- * clutter_script_get_object:
- * @script: a #ClutterScript
- * @name: the name of the object to retrieve
- *
- * Retrieves the object bound to @name. This function does not increment
- * the reference count of the returned object.
- *
- * Return value: (transfer none): the named object, or %NULL if no object
- * with the given name was available
- *
- * Since: 0.6
- */
-GObject *
-clutter_script_get_object (ClutterScript *script,
- const gchar *name)
-{
- ObjectInfo *oinfo;
-
- g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), NULL);
- g_return_val_if_fail (name != NULL, NULL);
-
- oinfo = g_hash_table_lookup (script->priv->objects, name);
- if (!oinfo)
- return NULL;
-
- _clutter_script_construct_object (script, oinfo);
- _clutter_script_apply_properties (script, oinfo);
-
- return oinfo->object;
-}
-
-static gint
-clutter_script_get_objects_valist (ClutterScript *script,
- const gchar *first_name,
- va_list args)
-{
- gint retval = 0;
- const gchar *name;
-
- name = first_name;
- while (name)
- {
- GObject **obj = NULL;
-
- obj = va_arg (args, GObject**);
-
- *obj = clutter_script_get_object (script, name);
- if (*obj)
- retval += 1;
-
- name = va_arg (args, gchar*);
- }
-
- return retval;
-}
-
-/**
- * clutter_script_get_objects:
- * @script: a #ClutterScript
- * @first_name: the name of the first object to retrieve
- * @...: return location for a #GObject, then additional names, ending
- * with %NULL
- *
- * Retrieves a list of objects for the given names. After @script, object
- * names/return location pairs should be listed, with a %NULL pointer
- * ending the list, like:
- *
- * |[
- * GObject *my_label, *a_button, *main_timeline;
- *
- * clutter_script_get_objects (script,
- * "my-label", &my_label,
- * "a-button", &a_button,
- * "main-timeline", &main_timeline,
- * NULL);
- * ]|
- *
- * Note: This function does not increment the reference count of the
- * returned objects.
- *
- * Return value: the number of objects returned.
- *
- * Since: 0.6
- */
-gint
-clutter_script_get_objects (ClutterScript *script,
- const gchar *first_name,
- ...)
-{
- gint retval;
- va_list var_args;
-
- g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), 0);
- g_return_val_if_fail (first_name != NULL, 0);
-
- va_start (var_args, first_name);
- retval = clutter_script_get_objects_valist (script, first_name, var_args);
- va_end (var_args);
-
- return retval;
-}
-
-typedef struct {
- ClutterScript *script;
- guint merge_id;
- GSList *ids;
-} UnmergeData;
-
-static void
-remove_by_merge_id (gpointer key,
- gpointer value,
- gpointer data)
-{
- gchar *name = key;
- ObjectInfo *oinfo = value;
- UnmergeData *unmerge_data = data;
-
- if (oinfo->merge_id == unmerge_data->merge_id)
- {
- CLUTTER_NOTE (SCRIPT,
- "Unmerging object (id:%s, type:%s, merge-id:%d)",
- oinfo->id,
- oinfo->class_name,
- oinfo->merge_id);
-
- unmerge_data->ids = g_slist_prepend (unmerge_data->ids, g_strdup (name));
- oinfo->is_unmerged = TRUE;
- }
-}
-
-/**
- * clutter_script_unmerge_objects:
- * @script: a #ClutterScript
- * @merge_id: merge id returned when loading a UI definition
- *
- * Unmerges the objects identified by @merge_id.
- *
- * Since: 0.6
- */
-void
-clutter_script_unmerge_objects (ClutterScript *script,
- guint merge_id)
-{
- ClutterScriptPrivate *priv;
- UnmergeData data;
- GSList *l;
-
- g_return_if_fail (CLUTTER_IS_SCRIPT (script));
- g_return_if_fail (merge_id > 0);
-
- priv = script->priv;
-
- data.script = script;
- data.merge_id = merge_id;
- data.ids = NULL;
- g_hash_table_foreach (priv->objects, remove_by_merge_id, &data);
-
- for (l = data.ids; l != NULL; l = l->next)
- g_hash_table_remove (priv->objects, l->data);
-
- g_slist_free_full (data.ids, g_free);
-
- clutter_script_ensure_objects (script);
-}
-
-static void
-construct_each_objects (gpointer key,
- gpointer value,
- gpointer user_data)
-{
- ClutterScript *script = user_data;
- ObjectInfo *oinfo = value;
-
- /* we have unfinished business */
- if (oinfo->has_unresolved)
- {
- /* this should not happen, but resilence is
- * a good thing in a parser
- */
- if (oinfo->object == NULL)
- _clutter_script_construct_object (script, oinfo);
-
- /* this will take care of setting up properties and adding children */
- _clutter_script_apply_properties (script, oinfo);
- }
-}
-
-/**
- * clutter_script_ensure_objects:
- * @script: a #ClutterScript
- *
- * Ensure that every object defined inside @script is correctly
- * constructed. You should rarely need to use this function.
- *
- * Since: 0.6
- */
-void
-clutter_script_ensure_objects (ClutterScript *script)
-{
- ClutterScriptPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_SCRIPT (script));
-
- priv = script->priv;
- g_hash_table_foreach (priv->objects, construct_each_objects, script);
-}
-
-/**
- * clutter_script_get_type_from_name:
- * @script: a #ClutterScript
- * @type_name: name of the type to look up
- *
- * Looks up a type by name, using the virtual function that
- * #ClutterScript has for that purpose. This function should
- * rarely be used.
- *
- * Return value: the type for the requested type name, or
- * %G_TYPE_INVALID if not corresponding type was found.
- *
- * Since: 0.6
- */
-GType
-clutter_script_get_type_from_name (ClutterScript *script,
- const gchar *type_name)
-{
- g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), G_TYPE_INVALID);
- g_return_val_if_fail (type_name != NULL, G_TYPE_INVALID);
-
- return CLUTTER_SCRIPT_GET_CLASS (script)->get_type_from_name (script, type_name);
-}
-
-/**
- * clutter_get_script_id:
- * @gobject: a #GObject
- *
- * Retrieves the Clutter script id, if any.
- *
- * Return value: the script id, or %NULL if @object was not defined inside
- * a UI definition file. The returned string is owned by the object and
- * should never be modified or freed.
- *
- * Since: 0.6
- */
-const gchar *
-clutter_get_script_id (GObject *gobject)
-{
- g_return_val_if_fail (G_IS_OBJECT (gobject), NULL);
-
- if (CLUTTER_IS_SCRIPTABLE (gobject))
- return clutter_scriptable_get_id (CLUTTER_SCRIPTABLE (gobject));
- else
- return g_object_get_data (gobject, "clutter-script-id");
-}
-
-typedef struct {
- GModule *module;
- gpointer data;
-} ConnectData;
-
-/* default signal connection code */
-static void
-clutter_script_default_connect (ClutterScript *script,
- GObject *gobject,
- const gchar *signal_name,
- const gchar *signal_handler,
- GObject *connect_gobject,
- GConnectFlags flags,
- gpointer user_data)
-{
- ConnectData *data = user_data;
- GCallback function;
-
- if (!data->module)
- return;
-
- if (!g_module_symbol (data->module, signal_handler, (gpointer) &function))
- {
- g_warning ("Could not find a signal handler '%s' for signal '%s::%s'",
- signal_handler,
- connect_gobject ? G_OBJECT_TYPE_NAME (connect_gobject)
- : G_OBJECT_TYPE_NAME (gobject),
- signal_name);
- return;
- }
-
- CLUTTER_NOTE (SCRIPT,
- "connecting %s::%s to %s (after:%s, swapped:%s, object:%s)",
- (connect_gobject ? G_OBJECT_TYPE_NAME (connect_gobject)
- : G_OBJECT_TYPE_NAME (gobject)),
- signal_name,
- signal_handler,
- (flags & G_CONNECT_AFTER) ? "true" : "false",
- (flags & G_CONNECT_SWAPPED) ? "true" : "false",
- (connect_gobject ? G_OBJECT_TYPE_NAME (connect_gobject)
- : "<none>"));
-
- if (connect_gobject != NULL)
- g_signal_connect_object (gobject,
- signal_name, function,
- connect_gobject,
- flags);
- else
- g_signal_connect_data (gobject,
- signal_name, function,
- data->data,
- NULL,
- flags);
-}
-
-/**
- * clutter_script_connect_signals:
- * @script: a #ClutterScript
- * @user_data: data to be passed to the signal handlers, or %NULL
- *
- * Connects all the signals defined into a UI definition file to their
- * handlers.
- *
- * This method invokes clutter_script_connect_signals_full() internally
- * and uses #GModule's introspective features (by opening the current
- * module's scope) to look at the application's symbol table.
- *
- * Note that this function will not work if #GModule is not supported by
- * the platform Clutter is running on.
- *
- * Since: 0.6
- */
-void
-clutter_script_connect_signals (ClutterScript *script,
- gpointer user_data)
-{
- ConnectData *cd;
-
- g_return_if_fail (CLUTTER_IS_SCRIPT (script));
-
- if (!g_module_supported ())
- {
- g_critical ("clutter_script_connect_signals() requires a working "
- "GModule support from GLib");
- return;
- }
-
- cd = g_new (ConnectData, 1);
- cd->module = g_module_open (NULL, 0);
- cd->data = user_data;
-
- clutter_script_connect_signals_full (script,
- clutter_script_default_connect,
- cd);
-
- g_module_close (cd->module);
-
- g_free (cd);
-}
-
-typedef struct {
- ClutterScript *script;
- ClutterScriptConnectFunc func;
- gpointer user_data;
-} SignalConnectData;
-
-static void
-connect_each_object (gpointer key,
- gpointer value,
- gpointer data)
-{
- SignalConnectData *connect_data = data;
- ClutterScript *script = connect_data->script;
- ObjectInfo *oinfo = value;
- GObject *object = oinfo->object;
- GList *unresolved, *l;
-
- _clutter_script_construct_object (script, oinfo);
-
- unresolved = NULL;
- for (l = oinfo->signals; l != NULL; l = l->next)
- {
- SignalInfo *sinfo = l->data;
-
- if (sinfo->is_handler)
- {
- GObject *connect_object = NULL;
-
- if (sinfo->object)
- connect_object = clutter_script_get_object (script, sinfo->object);
-
- if (sinfo->object && !connect_object)
- unresolved = g_list_prepend (unresolved, sinfo);
- else
- {
- connect_data->func (script, object,
- sinfo->name,
- sinfo->handler,
- connect_object,
- sinfo->flags,
- connect_data->user_data);
- }
- }
- else
- {
- g_warn_if_reached ();
- }
-
- signal_info_free (sinfo);
- }
-
- /* keep the unresolved signal handlers around, in case
- * clutter_script_connect_signals() is called multiple
- * times (e.g. after a UI definition merge)
- */
- g_list_free (oinfo->signals);
- oinfo->signals = unresolved;
-}
-
-/**
- * clutter_script_connect_signals_full:
- * @script: a #ClutterScript
- * @func: (scope call): signal connection function
- * @user_data: data to be passed to the signal handlers, or %NULL
- *
- * Connects all the signals defined into a UI definition file to their
- * handlers.
- *
- * This function allows to control how the signal handlers are
- * going to be connected to their respective signals. It is meant
- * primarily for language bindings to allow resolving the function
- * names using the native API, but it can also be used on platforms
- * that do not support GModule.
- *
- * Applications should use clutter_script_connect_signals().
- *
- * Since: 0.6
- */
-void
-clutter_script_connect_signals_full (ClutterScript *script,
- ClutterScriptConnectFunc func,
- gpointer user_data)
-{
- SignalConnectData data;
-
- g_return_if_fail (CLUTTER_IS_SCRIPT (script));
- g_return_if_fail (func != NULL);
-
- data.script = script;
- data.func = func;
- data.user_data = user_data;
-
- g_hash_table_foreach (script->priv->objects, connect_each_object, &data);
-}
-
-GQuark
-clutter_script_error_quark (void)
-{
- return g_quark_from_static_string ("clutter-script-error");
-}
-
-/**
- * clutter_script_add_search_paths:
- * @script: a #ClutterScript
- * @paths: (array length=n_paths): an array of strings containing
- * different search paths
- * @n_paths: the length of the passed array
- *
- * Adds @paths to the list of search paths held by @script.
- *
- * The search paths are used by clutter_script_lookup_filename(), which
- * can be used to define search paths for the textures source file name
- * or other custom, file-based properties.
- *
- * Since: 0.8
- */
-void
-clutter_script_add_search_paths (ClutterScript *script,
- const gchar * const paths[],
- gsize n_paths)
-{
- ClutterScriptPrivate *priv;
- gchar **old_paths, **new_paths;
- gsize old_paths_len, i;
- gsize iter = 0;
-
- g_return_if_fail (CLUTTER_IS_SCRIPT (script));
- g_return_if_fail (paths != NULL);
- g_return_if_fail (n_paths > 0);
-
- priv = script->priv;
-
- if (priv->search_paths)
- {
- old_paths = priv->search_paths;
- old_paths_len = g_strv_length (old_paths);
- }
- else
- {
- old_paths = NULL;
- old_paths_len = 0;
- }
-
- new_paths = g_new0 (gchar*, old_paths_len + n_paths + 1);
-
- for (i = 0, iter = 0; i < old_paths_len; i++, iter++)
- new_paths[iter] = g_strdup (old_paths[i]);
-
- for (i = 0; i < n_paths; i++, iter++)
- new_paths[iter] = g_strdup (paths[i]);
-
- CLUTTER_NOTE (SCRIPT,
- "Added %" G_GSIZE_FORMAT " new search paths (new size: %d)",
- n_paths,
- g_strv_length (new_paths));
-
- priv->search_paths = new_paths;
-
- if (old_paths)
- g_strfreev (old_paths);
-}
-
-/**
- * clutter_script_lookup_filename:
- * @script: a #ClutterScript
- * @filename: the name of the file to lookup
- *
- * Looks up @filename inside the search paths of @script. If @filename
- * is found, its full path will be returned .
- *
- * Return value: the full path of @filename or %NULL if no path was
- * found.
- *
- * Since: 0.8
- */
-gchar *
-clutter_script_lookup_filename (ClutterScript *script,
- const gchar *filename)
-{
- ClutterScriptPrivate *priv;
- gchar *dirname;
- gchar *retval;
-
- g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), NULL);
- g_return_val_if_fail (filename != NULL, NULL);
-
- if (g_path_is_absolute (filename))
- return g_strdup (filename);
-
- priv = script->priv;
-
- if (priv->search_paths)
- {
- gsize paths_len, i;
-
- paths_len = g_strv_length (priv->search_paths);
- for (i = 0; i < paths_len; i++)
- {
- retval = g_build_filename (priv->search_paths[i], filename, NULL);
- if (g_file_test (retval, G_FILE_TEST_EXISTS))
- return retval;
- else
- {
- g_free (retval);
- retval = NULL;
- }
- }
- }
-
- /* Fall back to assuming relative to our script */
- if (priv->is_filename)
- dirname = g_path_get_dirname (script->priv->filename);
- else
- dirname = g_get_current_dir ();
-
- retval = g_build_filename (dirname, filename, NULL);
- if (!g_file_test (retval, G_FILE_TEST_EXISTS))
- {
- g_free (retval);
- retval = NULL;
- }
-
- g_free (dirname);
-
- return retval;
-}
-
-/**
- * clutter_script_list_objects:
- * @script: a #ClutterScript
- *
- * Retrieves all the objects created by @script.
- *
- * Note: this function does not increment the reference count of the
- * objects it returns.
- *
- * Return value: (transfer container) (element-type GObject.Object): a list
- * of #GObject<!-- -->s, or %NULL. The objects are owned by the
- * #ClutterScript instance. Use g_list_free() on the returned list when
- * done.
- *
- * Since: 0.8
- */
-GList *
-clutter_script_list_objects (ClutterScript *script)
-{
- GList *objects, *l;
- GList *retval;
-
- g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), NULL);
-
- clutter_script_ensure_objects (script);
- if (!script->priv->objects)
- return NULL;
-
- retval = NULL;
- objects = g_hash_table_get_values (script->priv->objects);
- for (l = objects; l != NULL; l = l->next)
- {
- ObjectInfo *oinfo = l->data;
-
- if (oinfo->object)
- retval = g_list_prepend (retval, oinfo->object);
- }
-
- g_list_free (objects);
-
- return retval;
-}
-
-/**
- * clutter_script_set_translation_domain:
- * @script: a #ClutterScript
- * @domain: (allow-none): the translation domain, or %NULL
- *
- * Sets the translation domain for @script.
- *
- * Since: 1.10
- */
-void
-clutter_script_set_translation_domain (ClutterScript *script,
- const gchar *domain)
-{
- g_return_if_fail (CLUTTER_IS_SCRIPT (script));
-
- if (g_strcmp0 (domain, script->priv->translation_domain) == 0)
- return;
-
- g_free (script->priv->translation_domain);
- script->priv->translation_domain = g_strdup (domain);
-
- g_object_notify_by_pspec (G_OBJECT (script), obj_props[PROP_TRANSLATION_DOMAIN]);
-}
-
-/**
- * clutter_script_get_translation_domain:
- * @script: a #ClutterScript
- *
- * Retrieves the translation domain set using
- * clutter_script_set_translation_domain().
- *
- * Return value: (transfer none): the translation domain, if any is set,
- * or %NULL
- *
- * Since: 1.10
- */
-const gchar *
-clutter_script_get_translation_domain (ClutterScript *script)
-{
- g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), NULL);
-
- return script->priv->translation_domain;
-}
-
-/*
- * _clutter_script_generate_fake_id:
- * @script: a #ClutterScript
- *
- * Generates a fake id string for object definitions without
- * an "id" member
- *
- * Return value: a newly-allocated string containing the fake
- * id. Use g_free() to free the resources allocated by the
- * returned value
- *
- */
-gchar *
-_clutter_script_generate_fake_id (ClutterScript *script)
-{
- ClutterScriptPrivate *priv = script->priv;
-
- return g_strdup_printf ("script-%d-%d",
- priv->last_merge_id,
- priv->last_unknown++);
-}
-
-/*
- * _clutter_script_warn_missing_attribute:
- * @script: a #ClutterScript
- * @id_: the id of an object definition, or %NULL
- * @attribute: the expected attribute
- *
- * Emits a warning, using GLib's log facilities, for a missing
- * @attribute in an object definition, pointing to the current
- * location of the #ClutterScriptParser
- */
-void
-_clutter_script_warn_missing_attribute (ClutterScript *script,
- const gchar *id_,
- const gchar *attribute)
-{
- ClutterScriptPrivate *priv = script->priv;
- JsonParser *parser = JSON_PARSER (priv->parser);
- gint current_line = json_parser_get_current_line (parser);
-
- if (id_ != NULL && *id_ != '\0')
- {
- g_warning ("%s:%d: object '%s' has no '%s' attribute",
- priv->is_filename ? priv->filename : "<input>",
- current_line,
- id_,
- attribute);
- }
- else
- {
- g_warning ("%s:%d: object has no '%s' attribute",
- priv->is_filename ? priv->filename : "<input>",
- current_line,
- attribute);
- }
-}
-
-/*
- * _clutter_script_warn_invalid_value:
- * @script: a #ClutterScript
- * @attribute: the attribute with the invalid value
- * @expected: a string with the expected value
- * @node: a #JsonNode containing the value
- *
- * Emits a warning, using GLib's log facilities, for an invalid
- * value found when parsing @attribute, pointing to the current
- * location of the #ClutterScriptParser
- */
-void
-_clutter_script_warn_invalid_value (ClutterScript *script,
- const gchar *attribute,
- const gchar *expected,
- JsonNode *node)
-{
- ClutterScriptPrivate *priv = script->priv;
- JsonParser *parser = JSON_PARSER (priv->parser);
- gint current_line = json_parser_get_current_line (parser);
-
- if (node != NULL)
- {
- g_warning ("%s:%d: invalid value of type '%s' for attribute '%s':"
- "a value of type '%s' is expected",
- priv->is_filename ? priv->filename : "<input>",
- current_line,
- json_node_type_name (node),
- attribute,
- expected);
- }
- else
- {
- g_warning ("%s:%d: invalid value for attribute '%s':"
- "a value of type '%s' is expected",
- priv->is_filename ? priv->filename : "<input>",
- current_line,
- attribute,
- expected);
- }
-}
-
-/*
- * _clutter_script_get_object_info:
- * @script: a #ClutterScript
- * @script_id: the id of the object definition
- *
- * Retrieves the #ObjectInfo for the given @script_id
- *
- * Return value: a #ObjectInfo or %NULL
- */
-ObjectInfo *
-_clutter_script_get_object_info (ClutterScript *script,
- const gchar *script_id)
-{
- ClutterScriptPrivate *priv = script->priv;
-
- return g_hash_table_lookup (priv->objects, script_id);
-}
-
-/*
- * _clutter_script_get_last_merge_id:
- * @script: a #ClutterScript
- *
- * Retrieves the last merge id of @script. The merge id
- * should be stored inside an #ObjectInfo. If you need
- * a unique fake id for object definitions with an "id"
- * member, consider using _clutter_script_generate_fake_id()
- * instead
- *
- * Return value: the last merge id
- */
-guint
-_clutter_script_get_last_merge_id (ClutterScript *script)
-{
- return script->priv->last_merge_id;
-}
-
-/*
- * _clutter_script_add_object_info:
- * @script: a #ClutterScript
- * @oinfo: a #ObjectInfo
- *
- * Adds @oinfo inside the objects list held by @script
- */
-void
-_clutter_script_add_object_info (ClutterScript *script,
- ObjectInfo *oinfo)
-{
- ClutterScriptPrivate *priv = script->priv;
-
- g_hash_table_steal (priv->objects, oinfo->id);
- g_hash_table_insert (priv->objects, oinfo->id, oinfo);
-}
diff --git a/clutter/clutter/clutter-script.h b/clutter/clutter/clutter-script.h
deleted file mode 100644
index ca07a6810..000000000
--- a/clutter/clutter/clutter-script.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- *
- * Copyright (C) 2006 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 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_SCRIPT_H__
-#define __CLUTTER_SCRIPT_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-types.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_SCRIPT (clutter_script_get_type ())
-#define CLUTTER_SCRIPT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_SCRIPT, ClutterScript))
-#define CLUTTER_IS_SCRIPT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_SCRIPT))
-#define CLUTTER_SCRIPT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_SCRIPT, ClutterScriptClass))
-#define CLUTTER_IS_SCRIPT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_SCRIPT))
-#define CLUTTER_SCRIPT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_SCRIPT, ClutterScriptClass))
-
-typedef struct _ClutterScript ClutterScript;
-typedef struct _ClutterScriptPrivate ClutterScriptPrivate;
-typedef struct _ClutterScriptClass ClutterScriptClass;
-
-/**
- * ClutterScriptConnectFunc:
- * @script: a #ClutterScript
- * @object: the object to connect
- * @signal_name: the name of the signal
- * @handler_name: the name of the signal handler
- * @connect_object: the object to connect the signal to, or %NULL
- * @flags: signal connection flags
- * @user_data: user data to pass to the signal handler
- *
- * This is the signature of a function used to connect signals. It is used
- * by the clutter_script_connect_signals_full() function. It is mainly
- * intended for interpreted language bindings, but could be useful where the
- * programmer wants more control over the signal connection process.
- *
- * Since: 0.6
- */
-typedef void (* ClutterScriptConnectFunc) (ClutterScript *script,
- GObject *object,
- const gchar *signal_name,
- const gchar *handler_name,
- GObject *connect_object,
- GConnectFlags flags,
- gpointer user_data);
-
-/**
- * ClutterScriptError:
- * @CLUTTER_SCRIPT_ERROR_INVALID_TYPE_FUNCTION: Type function not found
- * or invalid
- * @CLUTTER_SCRIPT_ERROR_INVALID_PROPERTY: Property not found or invalid
- * @CLUTTER_SCRIPT_ERROR_INVALID_VALUE: Invalid value
- *
- * #ClutterScript error enumeration.
- *
- * Since: 0.6
- */
-typedef enum
-{
- CLUTTER_SCRIPT_ERROR_INVALID_TYPE_FUNCTION,
- CLUTTER_SCRIPT_ERROR_INVALID_PROPERTY,
- CLUTTER_SCRIPT_ERROR_INVALID_VALUE
-} ClutterScriptError;
-
-/**
- * CLUTTER_SCRIPT_ERROR:
- *
- * Error domain for the #ClutterScript errors
- *
- * Since: 0.6
- */
-#define CLUTTER_SCRIPT_ERROR (clutter_script_error_quark ())
-CLUTTER_EXPORT
-GQuark clutter_script_error_quark (void);
-
-/**
- * ClutterScript:
- *
- * The #ClutterScript structure contains only private data
- * and should be accessed using the provided API
- *
- * Since: 0.6
- */
-struct _ClutterScript
-{
- /*< private >*/
- GObject parent_instance;
-
- ClutterScriptPrivate *priv;
-};
-
-/**
- * ClutterScriptClass:
- * @get_type_from_name: virtual function used to map a type name
- * to a #GType. This function should only be overridden by
- * language bindings in order to map native types to #GType.
- * The default implementation is equivalent to g_type_from_name()
- *
- * The #ClutterScriptClass structure contains only private data
- *
- * Since: 0.6
- */
-struct _ClutterScriptClass
-{
- /*< private >*/
- GObjectClass parent_class;
-
- /*< public >*/
- GType (* get_type_from_name) (ClutterScript *script,
- const gchar *type_name);
-
- /*< private >*/
- /* padding, for future expansion */
- void (*_clutter_reserved1) (void);
- void (*_clutter_reserved2) (void);
- void (*_clutter_reserved3) (void);
- void (*_clutter_reserved4) (void);
- void (*_clutter_reserved5) (void);
- void (*_clutter_reserved6) (void);
- void (*_clutter_reserved7) (void);
- void (*_clutter_reserved8) (void);
-};
-
-CLUTTER_EXPORT
-GType clutter_script_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterScript * clutter_script_new (void);
-CLUTTER_EXPORT
-guint clutter_script_load_from_file (ClutterScript *script,
- const gchar *filename,
- GError **error);
-CLUTTER_EXPORT
-guint clutter_script_load_from_data (ClutterScript *script,
- const gchar *data,
- gssize length,
- GError **error);
-CLUTTER_EXPORT
-guint clutter_script_load_from_resource (ClutterScript *script,
- const gchar *resource_path,
- GError **error);
-
-CLUTTER_EXPORT
-GObject * clutter_script_get_object (ClutterScript *script,
- const gchar *name);
-CLUTTER_EXPORT
-gint clutter_script_get_objects (ClutterScript *script,
- const gchar *first_name,
- ...) G_GNUC_NULL_TERMINATED;
-CLUTTER_EXPORT
-GList * clutter_script_list_objects (ClutterScript *script);
-CLUTTER_EXPORT
-void clutter_script_unmerge_objects (ClutterScript *script,
- guint merge_id);
-CLUTTER_EXPORT
-void clutter_script_ensure_objects (ClutterScript *script);
-
-CLUTTER_EXPORT
-void clutter_script_connect_signals (ClutterScript *script,
- gpointer user_data);
-CLUTTER_EXPORT
-void clutter_script_connect_signals_full (ClutterScript *script,
- ClutterScriptConnectFunc func,
- gpointer user_data);
-
-CLUTTER_EXPORT
-void clutter_script_add_search_paths (ClutterScript *script,
- const gchar * const paths[],
- gsize n_paths);
-CLUTTER_EXPORT
-gchar * clutter_script_lookup_filename (ClutterScript *script,
- const gchar *filename) G_GNUC_MALLOC;
-CLUTTER_EXPORT
-GType clutter_script_get_type_from_name (ClutterScript *script,
- const gchar *type_name);
-
-CLUTTER_EXPORT
-void clutter_script_set_translation_domain (ClutterScript *script,
- const gchar *domain);
-CLUTTER_EXPORT
-const gchar * clutter_script_get_translation_domain (ClutterScript *script);
-
-CLUTTER_EXPORT
-const gchar * clutter_get_script_id (GObject *gobject);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_SCRIPT_H__ */
diff --git a/clutter/clutter/clutter-scriptable.c b/clutter/clutter/clutter-scriptable.c
deleted file mode 100644
index 25b983c16..000000000
--- a/clutter/clutter/clutter-scriptable.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- * Emmanuele Bassi <ebassi@openedhand.com>
- *
- * Copyright (C) 2006 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- *
- */
-
-/**
- * SECTION:clutter-scriptable
- * @short_description: Override the UI definition parsing
- *
- * The #ClutterScriptableIface interface exposes the UI definition parsing
- * process to external classes. By implementing this interface, a class can
- * override the UI definition parsing and transform complex data types into
- * GObject properties, or allow custom properties.
- *
- * #ClutterScriptable is available since Clutter 0.6
- */
-
-#include "clutter-build-config.h"
-
-#include <string.h>
-#include <stdlib.h>
-
-#include <glib.h>
-
-#include "clutter-scriptable.h"
-#include "clutter-script-private.h"
-
-#include "clutter-private.h"
-#include "clutter-debug.h"
-
-typedef ClutterScriptableIface ClutterScriptableInterface;
-
-G_DEFINE_INTERFACE (ClutterScriptable, clutter_scriptable, G_TYPE_OBJECT);
-
-static void
-clutter_scriptable_default_init (ClutterScriptableInterface *iface)
-{
-}
-
-/**
- * clutter_scriptable_set_id:
- * @scriptable: a #ClutterScriptable
- * @id_: the #ClutterScript id of the object
- *
- * Sets @id_ as the unique Clutter script it for this instance of
- * #ClutterScriptableIface.
- *
- * This name can be used by user interface designer applications to
- * define a unique name for an object constructable using the UI
- * definition language parsed by #ClutterScript.
- *
- * Since: 0.6
- */
-void
-clutter_scriptable_set_id (ClutterScriptable *scriptable,
- const gchar *id_)
-{
- ClutterScriptableIface *iface;
-
- g_return_if_fail (CLUTTER_IS_SCRIPTABLE (scriptable));
- g_return_if_fail (id_ != NULL);
-
- iface = CLUTTER_SCRIPTABLE_GET_IFACE (scriptable);
- if (iface->set_id)
- iface->set_id (scriptable, id_);
- else
- g_object_set_data_full (G_OBJECT (scriptable),
- "clutter-script-id",
- g_strdup (id_),
- g_free);
-}
-
-/**
- * clutter_scriptable_get_id:
- * @scriptable: a #ClutterScriptable
- *
- * Retrieves the id of @scriptable set using clutter_scriptable_set_id().
- *
- * Return value: the id of the object. The returned string is owned by
- * the scriptable object and should never be modified of freed
- *
- * Since: 0.6
- */
-const gchar *
-clutter_scriptable_get_id (ClutterScriptable *scriptable)
-{
- ClutterScriptableIface *iface;
-
- g_return_val_if_fail (CLUTTER_IS_SCRIPTABLE (scriptable), NULL);
-
- iface = CLUTTER_SCRIPTABLE_GET_IFACE (scriptable);
- if (iface->get_id)
- return iface->get_id (scriptable);
- else
- return g_object_get_data (G_OBJECT (scriptable), "clutter-script-id");
-}
-
-/**
- * clutter_scriptable_parse_custom_node:
- * @scriptable: a #ClutterScriptable
- * @script: the #ClutterScript creating the scriptable instance
- * @value: the generic value to be set
- * @name: the name of the node
- * @node: the JSON node to be parsed
- *
- * Parses the passed JSON node. The implementation must set the type
- * of the passed #GValue pointer using g_value_init().
- *
- * Return value: %TRUE if the node was successfully parsed, %FALSE otherwise.
- *
- * Since: 0.6
- */
-gboolean
-clutter_scriptable_parse_custom_node (ClutterScriptable *scriptable,
- ClutterScript *script,
- GValue *value,
- const gchar *name,
- JsonNode *node)
-{
- ClutterScriptableIface *iface;
-
- g_return_val_if_fail (CLUTTER_IS_SCRIPTABLE (scriptable), FALSE);
- g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), FALSE);
- g_return_val_if_fail (name != NULL, FALSE);
- g_return_val_if_fail (node != NULL, FALSE);
-
- iface = CLUTTER_SCRIPTABLE_GET_IFACE (scriptable);
- if (iface->parse_custom_node)
- return iface->parse_custom_node (scriptable, script, value, name, node);
-
- return FALSE;
-}
-
-/**
- * clutter_scriptable_set_custom_property:
- * @scriptable: a #ClutterScriptable
- * @script: the #ClutterScript creating the scriptable instance
- * @name: the name of the property
- * @value: the value of the property
- *
- * Overrides the common properties setting. The underlying virtual
- * function should be used when implementing custom properties.
- *
- * Since: 0.6
- */
-void
-clutter_scriptable_set_custom_property (ClutterScriptable *scriptable,
- ClutterScript *script,
- const gchar *name,
- const GValue *value)
-{
- ClutterScriptableIface *iface;
-
- g_return_if_fail (CLUTTER_IS_SCRIPTABLE (scriptable));
- g_return_if_fail (CLUTTER_IS_SCRIPT (script));
- g_return_if_fail (name != NULL);
- g_return_if_fail (value != NULL);
-
- iface = CLUTTER_SCRIPTABLE_GET_IFACE (scriptable);
- if (iface->set_custom_property)
- iface->set_custom_property (scriptable, script, name, value);
-}
diff --git a/clutter/clutter/clutter-scriptable.h b/clutter/clutter/clutter-scriptable.h
deleted file mode 100644
index 82d187b36..000000000
--- a/clutter/clutter/clutter-scriptable.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- * Emmanuele Bassi <ebassi@openedhand.com>
- *
- * Copyright (C) 2006 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 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_SCRIPTABLE_H__
-#define __CLUTTER_SCRIPTABLE_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <glib-object.h>
-#include <json-glib/json-glib.h>
-#include <clutter/clutter-script.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_SCRIPTABLE (clutter_scriptable_get_type ())
-#define CLUTTER_SCRIPTABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_SCRIPTABLE, ClutterScriptable))
-#define CLUTTER_IS_SCRIPTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_SCRIPTABLE))
-#define CLUTTER_SCRIPTABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CLUTTER_TYPE_SCRIPTABLE, ClutterScriptableIface))
-
-typedef struct _ClutterScriptable ClutterScriptable;
-typedef struct _ClutterScriptableIface ClutterScriptableIface;
-
-/**
- * ClutterScriptable:
- *
- * #ClutterScriptable is an opaque structure whose members cannot be directly
- * accessed
- *
- * Since: 0.6
- */
-
-/**
- * ClutterScriptableIface:
- * @set_id: virtual function for setting the id of a scriptable object
- * @get_id: virtual function for getting the id of a scriptable object
- * @parse_custom_node: virtual function for parsing complex data containers
- * into GObject properties
- * @set_custom_property: virtual function for setting a custom property
- *
- * Interface for implementing "scriptable" objects. An object implementing
- * this interface can override the parsing and properties setting sequence
- * when loading a UI definition data with #ClutterScript
- *
- * Since: 0.6
- */
-struct _ClutterScriptableIface
-{
- /*< private >*/
- GTypeInterface g_iface;
-
- /*< public >*/
- void (* set_id) (ClutterScriptable *scriptable,
- const gchar *id_);
- const gchar *(* get_id) (ClutterScriptable *scriptable);
-
- gboolean (* parse_custom_node) (ClutterScriptable *scriptable,
- ClutterScript *script,
- GValue *value,
- const gchar *name,
- JsonNode *node);
- void (* set_custom_property) (ClutterScriptable *scriptable,
- ClutterScript *script,
- const gchar *name,
- const GValue *value);
-};
-
-CLUTTER_EXPORT
-GType clutter_scriptable_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-void clutter_scriptable_set_id (ClutterScriptable *scriptable,
- const gchar *id_);
-CLUTTER_EXPORT
-const gchar * clutter_scriptable_get_id (ClutterScriptable *scriptable);
-CLUTTER_EXPORT
-gboolean clutter_scriptable_parse_custom_node (ClutterScriptable *scriptable,
- ClutterScript *script,
- GValue *value,
- const gchar *name,
- JsonNode *node);
-CLUTTER_EXPORT
-void clutter_scriptable_set_custom_property (ClutterScriptable *scriptable,
- ClutterScript *script,
- const gchar *name,
- const GValue *value);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_SCRIPTABLE_H__ */
diff --git a/clutter/clutter/clutter-scroll-actor.c b/clutter/clutter/clutter-scroll-actor.c
deleted file mode 100644
index 9ef63b23a..000000000
--- a/clutter/clutter/clutter-scroll-actor.c
+++ /dev/null
@@ -1,435 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2012 Intel Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * SECTION:clutter-scroll-actor
- * @Title: ClutterScrollActor
- * @Short_Description: An actor for displaying a portion of its children
- *
- * #ClutterScrollActor is an actor that can be used to display a portion
- * of the contents of its children.
- *
- * The extent of the area of a #ClutterScrollActor is defined by the size
- * of its children; the visible region of the children of a #ClutterScrollActor
- * is set by using clutter_scroll_actor_scroll_to_point() or by using
- * clutter_scroll_actor_scroll_to_rect() to define a point or a rectangle
- * acting as the origin, respectively.
- *
- * #ClutterScrollActor does not provide pointer or keyboard event handling,
- * nor does it provide visible scroll handles.
- *
- * See [scroll-actor.c](https://git.gnome.org/browse/clutter/tree/examples/scroll-actor.c?h=clutter-1.18)
- * for an example of how to use #ClutterScrollActor.
- *
- * #ClutterScrollActor is available since Clutter 1.12.
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-scroll-actor.h"
-
-#include "clutter-actor-private.h"
-#include "clutter-animatable.h"
-#include "clutter-debug.h"
-#include "clutter-enum-types.h"
-#include "clutter-private.h"
-#include "clutter-property-transition.h"
-#include "clutter-transition.h"
-
-struct _ClutterScrollActorPrivate
-{
- graphene_point_t scroll_to;
-
- ClutterScrollMode scroll_mode;
-
- ClutterTransition *transition;
-};
-
-enum
-{
- PROP_0,
-
- PROP_SCROLL_MODE,
-
- PROP_LAST
-};
-
-enum
-{
- ANIM_PROP_0,
-
- ANIM_PROP_SCROLL_TO,
-
- ANIM_PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST] = { NULL, };
-static GParamSpec *animatable_props[ANIM_PROP_LAST] = { NULL, };
-
-static ClutterAnimatableInterface *parent_animatable_iface = NULL;
-
-static void clutter_animatable_iface_init (ClutterAnimatableInterface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (ClutterScrollActor, clutter_scroll_actor, CLUTTER_TYPE_ACTOR,
- G_ADD_PRIVATE (ClutterScrollActor)
- G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_ANIMATABLE,
- clutter_animatable_iface_init))
-
-static void
-clutter_scroll_actor_set_scroll_to_internal (ClutterScrollActor *self,
- const graphene_point_t *point)
-{
- ClutterScrollActorPrivate *priv = self->priv;
- ClutterActor *actor = CLUTTER_ACTOR (self);
- graphene_matrix_t m;
- float dx, dy;
-
- if (graphene_point_equal (&priv->scroll_to, point))
- return;
-
- if (point == NULL)
- graphene_point_init (&priv->scroll_to, 0.f, 0.f);
- else
- priv->scroll_to = *point;
-
- if (priv->scroll_mode & CLUTTER_SCROLL_HORIZONTALLY)
- dx = -priv->scroll_to.x;
- else
- dx = 0.f;
-
- if (priv->scroll_mode & CLUTTER_SCROLL_VERTICALLY)
- dy = -priv->scroll_to.y;
- else
- dy = 0.f;
-
- graphene_matrix_init_translate (&m,
- &GRAPHENE_POINT3D_INIT (dx, dy, 0.f));
- clutter_actor_set_child_transform (actor, &m);
-}
-
-static void
-clutter_scroll_actor_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterScrollActor *actor = CLUTTER_SCROLL_ACTOR (gobject);
-
- switch (prop_id)
- {
- case PROP_SCROLL_MODE:
- clutter_scroll_actor_set_scroll_mode (actor, g_value_get_flags (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- }
-}
-
-static void
-clutter_scroll_actor_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterScrollActor *actor = CLUTTER_SCROLL_ACTOR (gobject);
-
- switch (prop_id)
- {
- case PROP_SCROLL_MODE:
- g_value_set_flags (value, actor->priv->scroll_mode);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- }
-}
-
-static void
-clutter_scroll_actor_class_init (ClutterScrollActorClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- gobject_class->set_property = clutter_scroll_actor_set_property;
- gobject_class->get_property = clutter_scroll_actor_get_property;
-
- /**
- * ClutterScrollActor:scroll-mode:
- *
- * The scrolling direction.
- *
- * Since: 1.12
- */
- obj_props[PROP_SCROLL_MODE] =
- g_param_spec_flags ("scroll-mode",
- P_("Scroll Mode"),
- P_("The scrolling direction"),
- CLUTTER_TYPE_SCROLL_MODE,
- CLUTTER_SCROLL_BOTH,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
-
- g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
-}
-
-static void
-clutter_scroll_actor_init (ClutterScrollActor *self)
-{
- self->priv = clutter_scroll_actor_get_instance_private (self);
- self->priv->scroll_mode = CLUTTER_SCROLL_BOTH;
-
- clutter_actor_set_clip_to_allocation (CLUTTER_ACTOR (self), TRUE);
-}
-
-static GParamSpec *
-clutter_scroll_actor_find_property (ClutterAnimatable *animatable,
- const char *property_name)
-{
- if (strcmp (property_name, "scroll-to") == 0)
- return animatable_props[ANIM_PROP_SCROLL_TO];
-
- return parent_animatable_iface->find_property (animatable, property_name);
-}
-
-static void
-clutter_scroll_actor_set_final_state (ClutterAnimatable *animatable,
- const char *property_name,
- const GValue *value)
-{
- if (strcmp (property_name, "scroll-to") == 0)
- {
- ClutterScrollActor *self = CLUTTER_SCROLL_ACTOR (animatable);
- const graphene_point_t *point = g_value_get_boxed (value);
-
- clutter_scroll_actor_set_scroll_to_internal (self, point);
- }
- else
- parent_animatable_iface->set_final_state (animatable, property_name, value);
-}
-
-static void
-clutter_scroll_actor_get_initial_state (ClutterAnimatable *animatable,
- const char *property_name,
- GValue *value)
-{
- if (strcmp (property_name, "scroll-to") == 0)
- {
- ClutterScrollActor *self = CLUTTER_SCROLL_ACTOR (animatable);
-
- g_value_set_boxed (value, &self->priv->scroll_to);
- }
- else
- parent_animatable_iface->get_initial_state (animatable, property_name, value);
-}
-
-static void
-clutter_animatable_iface_init (ClutterAnimatableInterface *iface)
-{
- parent_animatable_iface = g_type_interface_peek_parent (iface);
-
- animatable_props[ANIM_PROP_SCROLL_TO] =
- g_param_spec_boxed ("scroll-to",
- "Scroll To",
- "The point to scroll the actor to",
- GRAPHENE_TYPE_POINT,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- CLUTTER_PARAM_ANIMATABLE);
-
- iface->find_property = clutter_scroll_actor_find_property;
- iface->get_initial_state = clutter_scroll_actor_get_initial_state;
- iface->set_final_state = clutter_scroll_actor_set_final_state;
-}
-
-/**
- * clutter_scroll_actor_new:
- *
- * Creates a new #ClutterScrollActor.
- *
- * Return value: The newly created #ClutterScrollActor
- * instance.
- *
- * Since: 1.12
- */
-ClutterActor *
-clutter_scroll_actor_new (void)
-{
- return g_object_new (CLUTTER_TYPE_SCROLL_ACTOR, NULL);
-}
-
-/**
- * clutter_scroll_actor_set_scroll_mode:
- * @actor: a #ClutterScrollActor
- * @mode: a #ClutterScrollMode
- *
- * Sets the #ClutterScrollActor:scroll-mode property.
- *
- * Since: 1.12
- */
-void
-clutter_scroll_actor_set_scroll_mode (ClutterScrollActor *actor,
- ClutterScrollMode mode)
-{
- ClutterScrollActorPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_SCROLL_ACTOR (actor));
-
- priv = actor->priv;
-
- if (priv->scroll_mode == mode)
- return;
-
- priv->scroll_mode = mode;
-
- g_object_notify_by_pspec (G_OBJECT (actor), obj_props[PROP_SCROLL_MODE]);
-}
-
-/**
- * clutter_scroll_actor_get_scroll_mode:
- * @actor: a #ClutterScrollActor
- *
- * Retrieves the #ClutterScrollActor:scroll-mode property
- *
- * Return value: the scrolling mode
- *
- * Since: 1.12
- */
-ClutterScrollMode
-clutter_scroll_actor_get_scroll_mode (ClutterScrollActor *actor)
-{
- g_return_val_if_fail (CLUTTER_IS_SCROLL_ACTOR (actor), CLUTTER_SCROLL_NONE);
-
- return actor->priv->scroll_mode;
-}
-
-/**
- * clutter_scroll_actor_scroll_to_point:
- * @actor: a #ClutterScrollActor
- * @point: a #graphene_point_t
- *
- * Scrolls the contents of @actor so that @point is the new origin
- * of the visible area.
- *
- * The coordinates of @point must be relative to the @actor.
- *
- * This function will use the currently set easing state of the @actor
- * to transition from the current scroll origin to the new one.
- *
- * Since: 1.12
- */
-void
-clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor,
- const graphene_point_t *point)
-{
- ClutterScrollActorPrivate *priv;
- const ClutterAnimationInfo *info;
-
- g_return_if_fail (CLUTTER_IS_SCROLL_ACTOR (actor));
- g_return_if_fail (point != NULL);
-
- priv = actor->priv;
-
- info = _clutter_actor_get_animation_info (CLUTTER_ACTOR (actor));
-
- /* jump to the end if there is no easing state, or if the easing
- * state has a duration of 0 msecs
- */
- if (info->cur_state == NULL ||
- info->cur_state->easing_duration == 0)
- {
- /* ensure that we remove any currently running transition */
- if (priv->transition != NULL)
- {
- clutter_actor_remove_transition (CLUTTER_ACTOR (actor),
- "scroll-to");
- priv->transition = NULL;
- }
-
- clutter_scroll_actor_set_scroll_to_internal (actor, point);
-
- return;
- }
-
- if (priv->transition == NULL)
- {
- priv->transition = clutter_property_transition_new ("scroll-to");
- clutter_transition_set_animatable (priv->transition,
- CLUTTER_ANIMATABLE (actor));
- clutter_transition_set_remove_on_complete (priv->transition, TRUE);
-
- /* delay only makes sense if the transition has just been created */
- clutter_timeline_set_delay (CLUTTER_TIMELINE (priv->transition),
- info->cur_state->easing_delay);
- /* we need this to clear the priv->transition pointer */
- g_object_add_weak_pointer (G_OBJECT (priv->transition), (gpointer *) &priv->transition);
-
- clutter_actor_add_transition (CLUTTER_ACTOR (actor),
- "scroll-to",
- priv->transition);
-
- /* the actor now owns the transition */
- g_object_unref (priv->transition);
- }
-
- /* if a transition already exist, update its bounds */
- clutter_transition_set_from (priv->transition,
- GRAPHENE_TYPE_POINT,
- &priv->scroll_to);
- clutter_transition_set_to (priv->transition,
- GRAPHENE_TYPE_POINT,
- point);
-
- /* always use the current easing state */
- clutter_timeline_set_duration (CLUTTER_TIMELINE (priv->transition),
- info->cur_state->easing_duration);
- clutter_timeline_set_progress_mode (CLUTTER_TIMELINE (priv->transition),
- info->cur_state->easing_mode);
-
- /* ensure that we start from the beginning */
- clutter_timeline_rewind (CLUTTER_TIMELINE (priv->transition));
- clutter_timeline_start (CLUTTER_TIMELINE (priv->transition));
-}
-
-/**
- * clutter_scroll_actor_scroll_to_rect:
- * @actor: a #ClutterScrollActor
- * @rect: a #ClutterRect
- *
- * Scrolls @actor so that @rect is in the visible portion.
- *
- * Since: 1.12
- */
-void
-clutter_scroll_actor_scroll_to_rect (ClutterScrollActor *actor,
- const graphene_rect_t *rect)
-{
- graphene_rect_t n_rect;
-
- g_return_if_fail (CLUTTER_IS_SCROLL_ACTOR (actor));
- g_return_if_fail (rect != NULL);
-
- n_rect = *rect;
-
- /* normalize, so that we have a valid origin */
- graphene_rect_normalize (&n_rect);
-
- clutter_scroll_actor_scroll_to_point (actor, &n_rect.origin);
-}
diff --git a/clutter/clutter/clutter-scroll-actor.h b/clutter/clutter/clutter-scroll-actor.h
deleted file mode 100644
index e6a176521..000000000
--- a/clutter/clutter/clutter-scroll-actor.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2012 Intel Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __CLUTTER_SCROLL_ACTOR_H__
-#define __CLUTTER_SCROLL_ACTOR_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-types.h>
-#include <clutter/clutter-actor.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_SCROLL_ACTOR (clutter_scroll_actor_get_type ())
-#define CLUTTER_SCROLL_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_SCROLL_ACTOR, ClutterScrollActor))
-#define CLUTTER_IS_SCROLL_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_SCROLL_ACTOR))
-#define CLUTTER_SCROLL_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_SCROLL_ACTOR, ClutterScrollActorClass))
-#define CLUTTER_IS_SCROLL_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_SCROLL_ACTOR))
-#define CLUTTER_SCROLL_ACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_SCROLL_ACTOR, ClutterScrollActorClass))
-
-typedef struct _ClutterScrollActorPrivate ClutterScrollActorPrivate;
-typedef struct _ClutterScrollActorClass ClutterScrollActorClass;
-
-/**
- * ClutterScrollActor:
- *
- * The #ClutterScrollActor structure contains only
- * private data, and should be accessed using the provided API.
- *
- * Since: 1.12
- */
-struct _ClutterScrollActor
-{
- /*< private >*/
- ClutterActor parent_instance;
-
- ClutterScrollActorPrivate *priv;
-};
-
-/**
- * ClutterScrollActorClass:
- *
- * The #ClutterScrollActor structure contains only
- * private data.
- *
- * Since: 1.12
- */
-struct _ClutterScrollActorClass
-{
- /*< private >*/
- ClutterActorClass parent_instance;
-
- gpointer _padding[8];
-};
-
-CLUTTER_EXPORT
-GType clutter_scroll_actor_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterActor * clutter_scroll_actor_new (void);
-
-CLUTTER_EXPORT
-void clutter_scroll_actor_set_scroll_mode (ClutterScrollActor *actor,
- ClutterScrollMode mode);
-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);
-CLUTTER_EXPORT
-void clutter_scroll_actor_scroll_to_rect (ClutterScrollActor *actor,
- const graphene_rect_t *rect);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_SCROLL_ACTOR_H__ */
diff --git a/clutter/clutter/clutter-seat-private.h b/clutter/clutter/clutter-seat-private.h
deleted file mode 100644
index 2adb7bcd6..000000000
--- a/clutter/clutter/clutter-seat-private.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2021 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_SEAT_PRIVATE_H
-#define CLUTTER_SEAT_PRIVATE_H
-
-#include "clutter/clutter-types.h"
-
-CLUTTER_EXPORT
-void clutter_seat_destroy (ClutterSeat *seat);
-
-#endif /* CLUTTER_SEAT_PRIVATE_H */
diff --git a/clutter/clutter/clutter-seat.c b/clutter/clutter/clutter-seat.c
deleted file mode 100644
index 3e7435fd9..000000000
--- a/clutter/clutter/clutter-seat.c
+++ /dev/null
@@ -1,707 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2019 Red Hat Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author: Carlos Garnacho <carlosg@gnome.org>
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-input-device-tool.h"
-#include "clutter-input-pointer-a11y-private.h"
-#include "clutter-marshal.h"
-#include "clutter-mutter.h"
-#include "clutter-private.h"
-#include "clutter-seat.h"
-#include "clutter-seat-private.h"
-#include "clutter-settings-private.h"
-#include "clutter-virtual-input-device.h"
-
-enum
-{
- DEVICE_ADDED,
- DEVICE_REMOVED,
- KBD_A11Y_MASK_CHANGED,
- KBD_A11Y_FLAGS_CHANGED,
- PTR_A11Y_DWELL_CLICK_TYPE_CHANGED,
- PTR_A11Y_TIMEOUT_STARTED,
- PTR_A11Y_TIMEOUT_STOPPED,
- IS_UNFOCUS_INHIBITED_CHANGED,
- N_SIGNALS,
-};
-
-static guint signals[N_SIGNALS] = { 0 };
-
-enum
-{
- PROP_0,
- PROP_TOUCH_MODE,
- N_PROPS
-};
-
-static GParamSpec *props[N_PROPS];
-
-typedef struct _ClutterSeatPrivate ClutterSeatPrivate;
-
-struct _ClutterSeatPrivate
-{
- unsigned int inhibit_unfocus_count;
-
- /* Pointer a11y */
- ClutterPointerA11ySettings pointer_a11y_settings;
-};
-
-G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterSeat, clutter_seat, G_TYPE_OBJECT)
-
-static void
-clutter_seat_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- switch (prop_id)
- {
- case PROP_TOUCH_MODE:
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
-}
-
-static void
-clutter_seat_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- switch (prop_id)
- {
- case PROP_TOUCH_MODE:
- g_value_set_boolean (value, FALSE);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
-}
-
-static void
-clutter_seat_constructed (GObject *object)
-{
- ClutterSettings *settings = clutter_settings_get_default ();
-
- G_OBJECT_CLASS (clutter_seat_parent_class)->constructed (object);
- clutter_settings_ensure_pointer_a11y_settings (settings,
- CLUTTER_SEAT (object));
-}
-
-static void
-clutter_seat_class_init (ClutterSeatClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->set_property = clutter_seat_set_property;
- object_class->get_property = clutter_seat_get_property;
- object_class->constructed = clutter_seat_constructed;
-
- signals[DEVICE_ADDED] =
- g_signal_new (I_("device-added"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, NULL,
- G_TYPE_NONE, 1,
- CLUTTER_TYPE_INPUT_DEVICE);
-
- signals[DEVICE_REMOVED] =
- g_signal_new (I_("device-removed"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, NULL,
- G_TYPE_NONE, 1,
- CLUTTER_TYPE_INPUT_DEVICE);
-
- /**
- * ClutterSeat::kbd-a11y-mods-state-changed:
- * @seat: the #ClutterSeat that emitted the signal
- * @latched_mask: the latched modifier mask from stickykeys
- * @locked_mask: the locked modifier mask from stickykeys
- *
- * The ::kbd-a11y-mods-state-changed signal is emitted each time either the
- * latched modifiers mask or locked modifiers mask are changed as the
- * result of keyboard accessibilty's sticky keys operations.
- */
- signals[KBD_A11Y_MASK_CHANGED] =
- g_signal_new (I_("kbd-a11y-mods-state-changed"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0, NULL, NULL,
- _clutter_marshal_VOID__UINT_UINT,
- G_TYPE_NONE, 2,
- G_TYPE_UINT,
- G_TYPE_UINT);
- g_signal_set_va_marshaller (signals[KBD_A11Y_MASK_CHANGED],
- G_TYPE_FROM_CLASS (object_class),
- _clutter_marshal_VOID__UINT_UINTv);
-
- /**
- * ClutterSeat::kbd-a11y-flags-changed:
- * @seat: the #ClutterSeat that emitted the signal
- * @settings_flags: the new ClutterKeyboardA11yFlags configuration
- * @changed_mask: the ClutterKeyboardA11yFlags changed
- *
- * The ::kbd-a11y-flags-changed signal is emitted each time the
- * ClutterKeyboardA11yFlags configuration is changed as the result of
- * keyboard accessibility operations.
- */
- signals[KBD_A11Y_FLAGS_CHANGED] =
- g_signal_new (I_("kbd-a11y-flags-changed"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0, NULL, NULL,
- _clutter_marshal_VOID__UINT_UINT,
- G_TYPE_NONE, 2,
- G_TYPE_UINT,
- G_TYPE_UINT);
- g_signal_set_va_marshaller (signals[KBD_A11Y_FLAGS_CHANGED],
- G_TYPE_FROM_CLASS (object_class),
- _clutter_marshal_VOID__UINT_UINTv);
-
- /**
- * ClutterSeat::ptr-a11y-dwell-click-type-changed:
- * @seat: the #ClutterSeat that emitted the signal
- * @click_type: the new #ClutterPointerA11yDwellClickType mode
- *
- * The ::ptr-a11y-dwell-click-type-changed signal is emitted each time
- * the ClutterPointerA11yDwellClickType mode is changed as the result
- * of pointer accessibility operations.
- */
- signals[PTR_A11Y_DWELL_CLICK_TYPE_CHANGED] =
- g_signal_new (I_("ptr-a11y-dwell-click-type-changed"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, NULL,
- G_TYPE_NONE, 1,
- CLUTTER_TYPE_POINTER_A11Y_DWELL_CLICK_TYPE);
-
- /**
- * ClutterSeat::ptr-a11y-timeout-started:
- * @seat: the #ClutterSeat that emitted the signal
- * @device: the core pointer #ClutterInputDevice
- * @timeout_type: the type of timeout #ClutterPointerA11yTimeoutType
- * @delay: the delay in ms before secondary-click is triggered.
- *
- * The ::ptr-a11y-timeout-started signal is emitted when a
- * pointer accessibility timeout delay is started, so that upper
- * layers can notify the user with some visual feedback.
- */
- signals[PTR_A11Y_TIMEOUT_STARTED] =
- g_signal_new (I_("ptr-a11y-timeout-started"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0, NULL, NULL,
- _clutter_marshal_VOID__OBJECT_FLAGS_UINT,
- G_TYPE_NONE, 3,
- CLUTTER_TYPE_INPUT_DEVICE,
- CLUTTER_TYPE_POINTER_A11Y_TIMEOUT_TYPE,
- G_TYPE_UINT);
- g_signal_set_va_marshaller (signals[PTR_A11Y_TIMEOUT_STARTED],
- G_TYPE_FROM_CLASS (object_class),
- _clutter_marshal_VOID__OBJECT_FLAGS_UINTv);
-
- /**
- * ClutterSeat::ptr-a11y-timeout-stopped:
- * @seat: the #ClutterSeat that emitted the signal
- * @device: the core pointer #ClutterInputDevice
- * @timeout_type: the type of timeout #ClutterPointerA11yTimeoutType
- * @clicked: %TRUE if the timeout finished and triggered a click
- *
- * The ::ptr-a11y-timeout-stopped signal is emitted when a running
- * pointer accessibility timeout delay is stopped, either because
- * it's triggered at the end of the delay or cancelled, so that
- * upper layers can notify the user with some visual feedback.
- */
- signals[PTR_A11Y_TIMEOUT_STOPPED] =
- g_signal_new (I_("ptr-a11y-timeout-stopped"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0, NULL, NULL,
- _clutter_marshal_VOID__OBJECT_FLAGS_BOOLEAN,
- G_TYPE_NONE, 3,
- CLUTTER_TYPE_INPUT_DEVICE,
- CLUTTER_TYPE_POINTER_A11Y_TIMEOUT_TYPE,
- G_TYPE_BOOLEAN);
- g_signal_set_va_marshaller (signals[PTR_A11Y_TIMEOUT_STOPPED],
- G_TYPE_FROM_CLASS (object_class),
- _clutter_marshal_VOID__OBJECT_FLAGS_BOOLEANv);
-
- /**
- * ClutterSeat::is-unfocus-inhibited-changed:
- * @seat: the #ClutterSeat that emitted the signal
- *
- * The ::is-unfocus-inhibited-changed signal is emitted when the
- * property to inhibit the unsetting of the focus-surface of the
- * #ClutterSeat changed. To get the current state of this property,
- * use clutter_seat_is_unfocus_inhibited().
- */
- signals[IS_UNFOCUS_INHIBITED_CHANGED] =
- g_signal_new (I_("is-unfocus-inhibited-changed"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, NULL,
- G_TYPE_NONE, 0);
-
- /**
- * ClutterSeat:touch-mode:
- *
- * The current touch-mode of the #ClutterSeat, it is set to %TRUE if the
- * requirements documented in clutter_seat_get_touch_mode() are fulfilled.
- **/
- props[PROP_TOUCH_MODE] =
- g_param_spec_boolean ("touch-mode",
- P_("Touch mode"),
- P_("Touch mode"),
- FALSE,
- CLUTTER_PARAM_READABLE);
-
- g_object_class_install_properties (object_class, N_PROPS, props);
-}
-
-static void
-clutter_seat_init (ClutterSeat *seat)
-{
-}
-
-/**
- * clutter_seat_get_pointer:
- * @seat: a #ClutterSeat
- *
- * Returns the logical pointer
- *
- * Returns: (transfer none): the logical pointer
- **/
-ClutterInputDevice *
-clutter_seat_get_pointer (ClutterSeat *seat)
-{
- g_return_val_if_fail (CLUTTER_IS_SEAT (seat), NULL);
-
- return CLUTTER_SEAT_GET_CLASS (seat)->get_pointer (seat);
-}
-
-/**
- * clutter_seat_get_keyboard:
- * @seat: a #ClutterSeat
- *
- * Returns the logical keyboard
- *
- * Returns: (transfer none): the logical keyboard
- **/
-ClutterInputDevice *
-clutter_seat_get_keyboard (ClutterSeat *seat)
-{
- g_return_val_if_fail (CLUTTER_IS_SEAT (seat), NULL);
-
- return CLUTTER_SEAT_GET_CLASS (seat)->get_keyboard (seat);
-}
-
-/**
- * clutter_seat_peek_devices: (skip)
- **/
-const GList *
-clutter_seat_peek_devices (ClutterSeat *seat)
-{
- g_return_val_if_fail (CLUTTER_IS_SEAT (seat), NULL);
-
- return CLUTTER_SEAT_GET_CLASS (seat)->peek_devices (seat);
-}
-
-/**
- * clutter_seat_list_devices:
- * @seat: a #ClutterSeat
- *
- * Returns the list of HW devices
- *
- * Returns: (transfer container) (element-type Clutter.InputDevice): A list
- * of #ClutterInputDevice. The elements of the returned list are owned by
- * Clutter and may not be freed, the returned list should be freed using
- * g_list_free() when done.
- **/
-GList *
-clutter_seat_list_devices (ClutterSeat *seat)
-{
- g_return_val_if_fail (CLUTTER_IS_SEAT (seat), NULL);
-
- return g_list_copy ((GList *)clutter_seat_peek_devices (seat));
-}
-
-void
-clutter_seat_bell_notify (ClutterSeat *seat)
-{
- CLUTTER_SEAT_GET_CLASS (seat)->bell_notify (seat);
-}
-
-/**
- * clutter_seat_get_keymap:
- * @seat: a #ClutterSeat
- *
- * Returns the seat keymap
- *
- * Returns: (transfer none): the seat keymap
- **/
-ClutterKeymap *
-clutter_seat_get_keymap (ClutterSeat *seat)
-{
- return CLUTTER_SEAT_GET_CLASS (seat)->get_keymap (seat);
-}
-
-void
-clutter_seat_ensure_a11y_state (ClutterSeat *seat)
-{
- ClutterInputDevice *core_pointer;
-
- core_pointer = clutter_seat_get_pointer (seat);
-
- if (core_pointer)
- {
- if (_clutter_is_input_pointer_a11y_enabled (core_pointer))
- _clutter_input_pointer_a11y_add_device (core_pointer);
- }
-}
-
-static gboolean
-are_pointer_a11y_settings_equal (ClutterPointerA11ySettings *a,
- ClutterPointerA11ySettings *b)
-{
- return (memcmp (a, b, sizeof (ClutterPointerA11ySettings)) == 0);
-}
-
-static void
-clutter_seat_enable_pointer_a11y (ClutterSeat *seat)
-{
- ClutterInputDevice *core_pointer;
-
- core_pointer = clutter_seat_get_pointer (seat);
-
- _clutter_input_pointer_a11y_add_device (core_pointer);
-}
-
-static void
-clutter_seat_disable_pointer_a11y (ClutterSeat *seat)
-{
- ClutterInputDevice *core_pointer;
-
- core_pointer = clutter_seat_get_pointer (seat);
-
- _clutter_input_pointer_a11y_remove_device (core_pointer);
-}
-
-/**
- * clutter_seat_set_pointer_a11y_settings:
- * @seat: a #ClutterSeat
- * @settings: a pointer to a #ClutterPointerA11ySettings
- *
- * Sets the pointer accessibility settings
- **/
-void
-clutter_seat_set_pointer_a11y_settings (ClutterSeat *seat,
- ClutterPointerA11ySettings *settings)
-{
- ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
-
- g_return_if_fail (CLUTTER_IS_SEAT (seat));
-
- if (are_pointer_a11y_settings_equal (&priv->pointer_a11y_settings, settings))
- return;
-
- if (priv->pointer_a11y_settings.controls == 0 && settings->controls != 0)
- clutter_seat_enable_pointer_a11y (seat);
- else if (priv->pointer_a11y_settings.controls != 0 && settings->controls == 0)
- clutter_seat_disable_pointer_a11y (seat);
-
- priv->pointer_a11y_settings = *settings;
-}
-
-/**
- * clutter_seat_get_pointer_a11y_settings:
- * @seat: a #ClutterSeat
- * @settings: a pointer to a #ClutterPointerA11ySettings
- *
- * Gets the current pointer accessibility settings
- **/
-void
-clutter_seat_get_pointer_a11y_settings (ClutterSeat *seat,
- ClutterPointerA11ySettings *settings)
-{
- ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
-
- g_return_if_fail (CLUTTER_IS_SEAT (seat));
-
- *settings = priv->pointer_a11y_settings;
-}
-
-/**
- * clutter_seat_set_pointer_a11y_dwell_click_type:
- * @seat: a #ClutterSeat
- * @click_type: type of click as #ClutterPointerA11yDwellClickType
- *
- * Sets the dwell click type
- **/
-void
-clutter_seat_set_pointer_a11y_dwell_click_type (ClutterSeat *seat,
- ClutterPointerA11yDwellClickType click_type)
-{
- ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
-
- g_return_if_fail (CLUTTER_IS_SEAT (seat));
-
- priv->pointer_a11y_settings.dwell_click_type = click_type;
-}
-
-/**
- * clutter_seat_inhibit_unfocus:
- * @seat: a #ClutterSeat
- *
- * Inhibits unsetting of the pointer focus-surface for the #ClutterSeat @seat,
- * this allows to keep using the pointer even when it's hidden.
- *
- * This property is refcounted, so clutter_seat_uninhibit_unfocus() must be
- * called the exact same number of times as clutter_seat_inhibit_unfocus()
- * was called before.
- **/
-void
-clutter_seat_inhibit_unfocus (ClutterSeat *seat)
-{
- ClutterSeatPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_SEAT (seat));
-
- priv = clutter_seat_get_instance_private (seat);
-
- priv->inhibit_unfocus_count++;
-
- if (priv->inhibit_unfocus_count == 1)
- g_signal_emit (G_OBJECT (seat), signals[IS_UNFOCUS_INHIBITED_CHANGED], 0);
-}
-
-/**
- * clutter_seat_uninhibit_unfocus:
- * @seat: a #ClutterSeat
- *
- * Disables the inhibiting of unsetting of the pointer focus-surface
- * previously enabled by calling clutter_seat_inhibit_unfocus().
- *
- * This property is refcounted, so clutter_seat_uninhibit_unfocus() must be
- * called the exact same number of times as clutter_seat_inhibit_unfocus()
- * was called before.
- **/
-void
-clutter_seat_uninhibit_unfocus (ClutterSeat *seat)
-{
- ClutterSeatPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_SEAT (seat));
-
- priv = clutter_seat_get_instance_private (seat);
-
- if (priv->inhibit_unfocus_count == 0)
- {
- g_warning ("Called clutter_seat_uninhibit_unfocus without inhibiting before");
- return;
- }
-
- priv->inhibit_unfocus_count--;
-
- if (priv->inhibit_unfocus_count == 0)
- g_signal_emit (G_OBJECT (seat), signals[IS_UNFOCUS_INHIBITED_CHANGED], 0);
-}
-
-/**
- * clutter_seat_is_unfocus_inhibited:
- * @seat: a #ClutterSeat
- *
- * Gets whether unsetting of the pointer focus-surface is inhibited
- * for the #ClutterSeat @seat.
- *
- * Returns: %TRUE if unsetting is inhibited, %FALSE otherwise
- **/
-gboolean
-clutter_seat_is_unfocus_inhibited (ClutterSeat *seat)
-{
- ClutterSeatPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_SEAT (seat), FALSE);
-
- priv = clutter_seat_get_instance_private (seat);
-
- return priv->inhibit_unfocus_count > 0;
-}
-
-/**
- * clutter_seat_create_virtual_device:
- * @seat: a #ClutterSeat
- * @device_type: the type of the virtual device
- *
- * Creates a virtual input device.
- *
- * Returns: (transfer full): a newly created virtual device
- **/
-ClutterVirtualInputDevice *
-clutter_seat_create_virtual_device (ClutterSeat *seat,
- ClutterInputDeviceType device_type)
-{
- ClutterSeatClass *seat_class;
-
- g_return_val_if_fail (CLUTTER_IS_SEAT (seat), NULL);
-
- seat_class = CLUTTER_SEAT_GET_CLASS (seat);
- return seat_class->create_virtual_device (seat, device_type);
-}
-
-/**
- * clutter_seat_get_supported_virtual_device_types: (skip)
- **/
-ClutterVirtualDeviceType
-clutter_seat_get_supported_virtual_device_types (ClutterSeat *seat)
-{
- ClutterSeatClass *seat_class;
-
- g_return_val_if_fail (CLUTTER_IS_SEAT (seat),
- CLUTTER_VIRTUAL_DEVICE_TYPE_NONE);
-
- seat_class = CLUTTER_SEAT_GET_CLASS (seat);
- return seat_class->get_supported_virtual_device_types (seat);
-}
-
-gboolean
-clutter_seat_handle_event_post (ClutterSeat *seat,
- const ClutterEvent *event)
-{
- ClutterSeatClass *seat_class;
- ClutterInputDevice *device;
-
- g_return_val_if_fail (CLUTTER_IS_SEAT (seat), FALSE);
- g_return_val_if_fail (event, FALSE);
-
- seat_class = CLUTTER_SEAT_GET_CLASS (seat);
-
- if (seat_class->handle_event_post)
- seat_class->handle_event_post (seat, event);
-
- device = clutter_event_get_source_device (event);
- g_assert_true (CLUTTER_IS_INPUT_DEVICE (device));
-
- switch (event->type)
- {
- case CLUTTER_DEVICE_ADDED:
- g_signal_emit (seat, signals[DEVICE_ADDED], 0, device);
- break;
- case CLUTTER_DEVICE_REMOVED:
- g_signal_emit (seat, signals[DEVICE_REMOVED], 0, device);
- g_object_run_dispose (G_OBJECT (device));
- break;
- default:
- break;
- }
-
- return TRUE;
-}
-
-void
-clutter_seat_warp_pointer (ClutterSeat *seat,
- int x,
- int y)
-{
- g_return_if_fail (CLUTTER_IS_SEAT (seat));
-
- CLUTTER_SEAT_GET_CLASS (seat)->warp_pointer (seat, x, y);
-}
-
-/**
- * clutter_seat_get_touch_mode:
- * @seat: a #ClutterSeat
- *
- * Gets the current touch-mode state of the #ClutterSeat @seat.
- * The #ClutterSeat:touch-mode property is set to %TRUE if the following
- * requirements are fulfilled:
- *
- * - A touchscreen is available
- * - A tablet mode switch, if present, is enabled
- *
- * Returns: %TRUE if the device is a tablet that doesn't have an external
- * keyboard attached, %FALSE otherwise.
- **/
-gboolean
-clutter_seat_get_touch_mode (ClutterSeat *seat)
-{
- gboolean touch_mode;
-
- g_return_val_if_fail (CLUTTER_IS_SEAT (seat), FALSE);
-
- g_object_get (G_OBJECT (seat), "touch-mode", &touch_mode, NULL);
-
- return touch_mode;
-}
-
-/**
- * clutter_seat_has_touchscreen: (skip)
- **/
-gboolean
-clutter_seat_has_touchscreen (ClutterSeat *seat)
-{
- gboolean has_touchscreen = FALSE;
- const GList *devices, *l;
-
- g_return_val_if_fail (CLUTTER_IS_SEAT (seat), FALSE);
-
- devices = clutter_seat_peek_devices (seat);
- for (l = devices; l; l = l->next)
- {
- ClutterInputDevice *device = l->data;
-
- if (clutter_input_device_get_device_mode (device) != CLUTTER_INPUT_MODE_LOGICAL &&
- clutter_input_device_get_device_type (device) == CLUTTER_TOUCHSCREEN_DEVICE)
- {
- has_touchscreen = TRUE;
- break;
- }
- }
-
- return has_touchscreen;
-}
-
-gboolean
-clutter_seat_query_state (ClutterSeat *seat,
- ClutterInputDevice *device,
- ClutterEventSequence *sequence,
- graphene_point_t *coords,
- ClutterModifierType *modifiers)
-{
- g_return_val_if_fail (CLUTTER_IS_SEAT (seat), FALSE);
- g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE);
-
- return CLUTTER_SEAT_GET_CLASS (seat)->query_state (seat,
- device,
- sequence,
- coords,
- modifiers);
-}
-
-void
-clutter_seat_destroy (ClutterSeat *seat)
-{
- g_object_run_dispose (G_OBJECT (seat));
- g_object_unref (seat);
-}
diff --git a/clutter/clutter/clutter-seat.h b/clutter/clutter/clutter-seat.h
deleted file mode 100644
index 5c5dfe6eb..000000000
--- a/clutter/clutter/clutter-seat.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2019 Red Hat Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author: Carlos Garnacho <carlosg@gnome.org>
- */
-#ifndef CLUTTER_SEAT_H
-#define CLUTTER_SEAT_H
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include "clutter/clutter-types.h"
-#include "clutter/clutter-keymap.h"
-#include "clutter/clutter-virtual-input-device.h"
-
-#define CLUTTER_TYPE_SEAT (clutter_seat_get_type ())
-
-CLUTTER_EXPORT
-G_DECLARE_DERIVABLE_TYPE (ClutterSeat, clutter_seat,
- CLUTTER, SEAT, GObject)
-
-/**
- * ClutterPointerA11ySettings:
- *
- * The #ClutterPointerA11ySettings structure contains pointer accessibility
- * settings
- *
- */
-typedef struct _ClutterPointerA11ySettings
-{
- ClutterPointerA11yFlags controls;
- ClutterPointerA11yDwellClickType dwell_click_type;
- ClutterPointerA11yDwellMode dwell_mode;
- ClutterPointerA11yDwellDirection dwell_gesture_single;
- ClutterPointerA11yDwellDirection dwell_gesture_double;
- ClutterPointerA11yDwellDirection dwell_gesture_drag;
- ClutterPointerA11yDwellDirection dwell_gesture_secondary;
- gint secondary_click_delay;
- gint dwell_delay;
- gint dwell_threshold;
-} ClutterPointerA11ySettings;
-
-/**
- * ClutterVirtualDeviceType:
- */
-typedef enum
-{
- CLUTTER_VIRTUAL_DEVICE_TYPE_NONE = 0,
- CLUTTER_VIRTUAL_DEVICE_TYPE_KEYBOARD = 1 << 0,
- CLUTTER_VIRTUAL_DEVICE_TYPE_POINTER = 1 << 1,
- CLUTTER_VIRTUAL_DEVICE_TYPE_TOUCHSCREEN = 1 << 2,
-} ClutterVirtualDeviceType;
-
-typedef struct _ClutterSeatClass ClutterSeatClass;
-
-struct _ClutterSeatClass
-{
- GObjectClass parent_class;
-
- ClutterInputDevice * (* get_pointer) (ClutterSeat *seat);
- ClutterInputDevice * (* get_keyboard) (ClutterSeat *seat);
-
- const GList * (* peek_devices) (ClutterSeat *seat);
-
- void (* bell_notify) (ClutterSeat *seat);
-
- ClutterKeymap * (* get_keymap) (ClutterSeat *seat);
-
- gboolean (* handle_event_post) (ClutterSeat *seat,
- const ClutterEvent *event);
-
- void (* warp_pointer) (ClutterSeat *seat,
- int x,
- int y);
-
- gboolean (* query_state) (ClutterSeat *seat,
- ClutterInputDevice *device,
- ClutterEventSequence *sequence,
- graphene_point_t *coords,
- ClutterModifierType *modifiers);
-
- /* Virtual devices */
- ClutterVirtualInputDevice * (* create_virtual_device) (ClutterSeat *seat,
- ClutterInputDeviceType device_type);
- ClutterVirtualDeviceType (* get_supported_virtual_device_types) (ClutterSeat *seat);
-};
-
-CLUTTER_EXPORT
-ClutterInputDevice * clutter_seat_get_pointer (ClutterSeat *seat);
-CLUTTER_EXPORT
-ClutterInputDevice * clutter_seat_get_keyboard (ClutterSeat *seat);
-CLUTTER_EXPORT
-GList * clutter_seat_list_devices (ClutterSeat *seat);
-const GList * clutter_seat_peek_devices (ClutterSeat *seat);
-CLUTTER_EXPORT
-void clutter_seat_bell_notify (ClutterSeat *seat);
-
-CLUTTER_EXPORT
-ClutterKeymap * clutter_seat_get_keymap (ClutterSeat *seat);
-
-CLUTTER_EXPORT
-void clutter_seat_ensure_a11y_state (ClutterSeat *seat);
-
-CLUTTER_EXPORT
-void clutter_seat_set_pointer_a11y_settings (ClutterSeat *seat,
- ClutterPointerA11ySettings *settings);
-
-CLUTTER_EXPORT
-void clutter_seat_get_pointer_a11y_settings (ClutterSeat *seat,
- ClutterPointerA11ySettings *settings);
-
-CLUTTER_EXPORT
-void clutter_seat_set_pointer_a11y_dwell_click_type (ClutterSeat *seat,
- ClutterPointerA11yDwellClickType click_type);
-
-CLUTTER_EXPORT
-void clutter_seat_inhibit_unfocus (ClutterSeat *seat);
-
-CLUTTER_EXPORT
-void clutter_seat_uninhibit_unfocus (ClutterSeat *seat);
-
-CLUTTER_EXPORT
-gboolean clutter_seat_is_unfocus_inhibited (ClutterSeat *seat);
-
-CLUTTER_EXPORT
-ClutterVirtualInputDevice *clutter_seat_create_virtual_device (ClutterSeat *seat,
- ClutterInputDeviceType device_type);
-
-CLUTTER_EXPORT
-ClutterVirtualDeviceType clutter_seat_get_supported_virtual_device_types (ClutterSeat *seat);
-
-CLUTTER_EXPORT
-void clutter_seat_warp_pointer (ClutterSeat *seat,
- int x,
- int y);
-CLUTTER_EXPORT
-gboolean clutter_seat_get_touch_mode (ClutterSeat *seat);
-
-CLUTTER_EXPORT
-gboolean clutter_seat_has_touchscreen (ClutterSeat *seat);
-
-CLUTTER_EXPORT
-gboolean clutter_seat_query_state (ClutterSeat *seat,
- ClutterInputDevice *device,
- ClutterEventSequence *sequence,
- graphene_point_t *coords,
- ClutterModifierType *modifiers);
-
-#endif /* CLUTTER_SEAT_H */
diff --git a/clutter/clutter/clutter-settings-private.h b/clutter/clutter/clutter-settings-private.h
deleted file mode 100644
index a8a8e01e3..000000000
--- a/clutter/clutter/clutter-settings-private.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef __CLUTTER_SETTINGS_PRIVATE_H__
-#define __CLUTTER_SETTINGS_PRIVATE_H__
-
-#include <clutter/clutter-backend-private.h>
-#include <clutter/clutter-settings.h>
-
-G_BEGIN_DECLS
-
-void _clutter_settings_set_backend (ClutterSettings *settings,
- ClutterBackend *backend);
-
-void clutter_settings_set_property_internal (ClutterSettings *settings,
- const char *property,
- GValue *value);
-
-void clutter_settings_ensure_pointer_a11y_settings (ClutterSettings *settings,
- ClutterSeat *seat);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_SETTINGS_PRIVATE_H__ */
diff --git a/clutter/clutter/clutter-settings.c b/clutter/clutter/clutter-settings.c
deleted file mode 100644
index f3dffdbbb..000000000
--- a/clutter/clutter/clutter-settings.c
+++ /dev/null
@@ -1,1082 +0,0 @@
-/**
- * SECTION:clutter-settings
- * @Title: ClutterSettings
- * @Short_Description: Settings configuration
- *
- * Clutter depends on some settings to perform operations like detecting
- * multiple button press events, or font options to render text.
- *
- * Usually, Clutter will strive to use the platform's settings in order
- * to be as much integrated as possible. It is, however, possible to
- * change these settings on a per-application basis, by using the
- * #ClutterSettings singleton object and setting its properties. It is
- * also possible, for toolkit developers, to retrieve the settings from
- * the #ClutterSettings properties when implementing new UI elements,
- * for instance the default font name.
- *
- * #ClutterSettings is available since Clutter 1.4
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-settings.h"
-
-#ifdef HAVE_PANGO_FT2
-/* for pango_fc_font_map_cache_clear() */
-#define PANGO_ENABLE_BACKEND
-#include <pango/pangofc-fontmap.h>
-#endif /* HAVE_PANGO_FT2 */
-
-#include "clutter-debug.h"
-#include "clutter-settings-private.h"
-#include "clutter-stage-private.h"
-#include "clutter-private.h"
-
-#include <gdesktop-enums.h>
-#include <stdlib.h>
-
-#define DEFAULT_FONT_NAME "Sans 12"
-
-#define CLUTTER_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_SETTINGS, ClutterSettingsClass))
-#define CLUTTER_IS_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_SETTINGS))
-#define CLUTTER_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_SETTINGS, ClutterSettingsClass))
-
-typedef struct
-{
- cairo_antialias_t cairo_antialias;
- gint clutter_font_antialias;
-
- cairo_hint_style_t cairo_hint_style;
- const char *clutter_font_hint_style;
-
- cairo_subpixel_order_t cairo_subpixel_order;
- const char *clutter_font_subpixel_order;
-} FontSettings;
-
-/**
- * ClutterSettings:
- *
- * `ClutterSettings` is an opaque structure whose
- * members cannot be directly accessed.
- *
- * Since: 1.4
- */
-struct _ClutterSettings
-{
- GObject parent_instance;
-
- ClutterBackend *backend;
- GSettings *font_settings;
- GSettings *mouse_settings;
- GSettings *mouse_a11y_settings;
-
- gint double_click_time;
- gint double_click_distance;
-
- gint dnd_drag_threshold;
-
- gdouble resolution;
-
- gchar *font_name;
- gint font_dpi;
-
- gint xft_hinting;
- gint xft_antialias;
- gchar *xft_hint_style;
- gchar *xft_rgba;
-
- gint long_press_duration;
-
- guint last_fontconfig_timestamp;
-
- guint password_hint_time;
-
- gint unscaled_font_dpi;
-};
-
-struct _ClutterSettingsClass
-{
- GObjectClass parent_class;
-};
-
-enum
-{
- PROP_0,
-
- PROP_BACKEND,
-
- PROP_DOUBLE_CLICK_TIME,
- PROP_DOUBLE_CLICK_DISTANCE,
-
- PROP_DND_DRAG_THRESHOLD,
-
- PROP_FONT_NAME,
-
- PROP_FONT_ANTIALIAS,
- PROP_FONT_DPI,
- PROP_FONT_HINTING,
- PROP_FONT_HINT_STYLE,
- PROP_FONT_RGBA,
-
- PROP_LONG_PRESS_DURATION,
-
- PROP_FONTCONFIG_TIMESTAMP,
-
- PROP_PASSWORD_HINT_TIME,
-
- PROP_UNSCALED_FONT_DPI,
-
- PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST];
-
-G_DEFINE_TYPE (ClutterSettings, clutter_settings, G_TYPE_OBJECT);
-
-static inline void
-settings_update_font_options (ClutterSettings *self)
-{
- cairo_hint_style_t hint_style = CAIRO_HINT_STYLE_NONE;
- cairo_antialias_t antialias_mode = CAIRO_ANTIALIAS_GRAY;
- cairo_subpixel_order_t subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
- cairo_font_options_t *options;
-
- if (self->backend == NULL)
- return;
-
- options = cairo_font_options_create ();
-
- cairo_font_options_set_hint_metrics (options, CAIRO_HINT_METRICS_ON);
-
- if (self->xft_hinting >= 0 &&
- self->xft_hint_style == NULL)
- {
- hint_style = CAIRO_HINT_STYLE_NONE;
- }
- else if (self->xft_hint_style != NULL)
- {
- if (strcmp (self->xft_hint_style, "hintnone") == 0)
- hint_style = CAIRO_HINT_STYLE_NONE;
- else if (strcmp (self->xft_hint_style, "hintslight") == 0)
- hint_style = CAIRO_HINT_STYLE_SLIGHT;
- else if (strcmp (self->xft_hint_style, "hintmedium") == 0)
- hint_style = CAIRO_HINT_STYLE_MEDIUM;
- else if (strcmp (self->xft_hint_style, "hintfull") == 0)
- hint_style = CAIRO_HINT_STYLE_FULL;
- }
-
- cairo_font_options_set_hint_style (options, hint_style);
-
- if (self->xft_rgba)
- {
- if (strcmp (self->xft_rgba, "rgb") == 0)
- subpixel_order = CAIRO_SUBPIXEL_ORDER_RGB;
- else if (strcmp (self->xft_rgba, "bgr") == 0)
- subpixel_order = CAIRO_SUBPIXEL_ORDER_BGR;
- else if (strcmp (self->xft_rgba, "vrgb") == 0)
- subpixel_order = CAIRO_SUBPIXEL_ORDER_VRGB;
- else if (strcmp (self->xft_rgba, "vbgr") == 0)
- subpixel_order = CAIRO_SUBPIXEL_ORDER_VBGR;
- }
-
- cairo_font_options_set_subpixel_order (options, subpixel_order);
-
- if (self->xft_antialias >= 0 && !self->xft_antialias)
- antialias_mode = CAIRO_ANTIALIAS_NONE;
- else if (subpixel_order != CAIRO_SUBPIXEL_ORDER_DEFAULT)
- antialias_mode = CAIRO_ANTIALIAS_SUBPIXEL;
- else if (self->xft_antialias >= 0)
- antialias_mode = CAIRO_ANTIALIAS_GRAY;
-
- cairo_font_options_set_antialias (options, antialias_mode);
-
- CLUTTER_NOTE (BACKEND, "New font options:\n"
- " - font-name: %s\n"
- " - antialias: %d\n"
- " - hinting: %d\n"
- " - hint-style: %s\n"
- " - rgba: %s\n",
- self->font_name != NULL ? self->font_name : DEFAULT_FONT_NAME,
- self->xft_antialias,
- self->xft_hinting,
- self->xft_hint_style != NULL ? self->xft_hint_style : "<null>",
- self->xft_rgba != NULL ? self->xft_rgba : "<null>");
-
- clutter_backend_set_font_options (self->backend, options);
- cairo_font_options_destroy (options);
-}
-
-static void
-settings_update_font_name (ClutterSettings *self)
-{
- CLUTTER_NOTE (BACKEND, "New font-name: %s", self->font_name);
-
- if (self->backend != NULL)
- g_signal_emit_by_name (self->backend, "font-changed");
-}
-
-static void
-settings_update_resolution (ClutterSettings *self)
-{
- const char *scale_env = NULL;
-
- if (self->font_dpi > 0)
- self->resolution = (gdouble) self->font_dpi / 1024.0;
- else
- self->resolution = 96.0;
-
- scale_env = g_getenv ("GDK_DPI_SCALE");
- if (scale_env != NULL)
- {
- double scale = g_ascii_strtod (scale_env, NULL);
- if (scale != 0 && self->resolution > 0)
- self->resolution *= scale;
- }
-
- CLUTTER_NOTE (BACKEND, "New resolution: %.2f (%s)",
- self->resolution,
- self->unscaled_font_dpi > 0 ? "unscaled" : "scaled");
-
- if (self->backend != NULL)
- g_signal_emit_by_name (self->backend, "resolution-changed");
-}
-
-static void
-settings_update_fontmap (ClutterSettings *self,
- guint stamp)
-{
- if (self->backend == NULL)
- return;
-
-#ifdef HAVE_PANGO_FT2
- CLUTTER_NOTE (BACKEND, "Update fontmaps (stamp: %d)", stamp);
-
- if (self->last_fontconfig_timestamp != stamp)
- {
- ClutterMainContext *context;
- gboolean update_needed = FALSE;
-
- context = _clutter_context_get_default ();
-
- /* If there is no font map yet then we don't need to do anything
- * because the config for fontconfig will be read when it is
- * created */
- if (context->font_map)
- {
- PangoFontMap *fontmap = PANGO_FONT_MAP (context->font_map);
-
- if (PANGO_IS_FC_FONT_MAP (fontmap) &&
- !FcConfigUptoDate (NULL))
- {
- pango_fc_font_map_cache_clear (PANGO_FC_FONT_MAP (fontmap));
-
- if (FcInitReinitialize ())
- update_needed = TRUE;
- }
- }
-
- self->last_fontconfig_timestamp = stamp;
-
- if (update_needed)
- g_signal_emit_by_name (self->backend, "font-changed");
- }
-#endif /* HAVE_PANGO_FT2 */
-}
-
-static void
-get_font_gsettings (GSettings *settings,
- FontSettings *output)
-{
- /* org.gnome.desktop.GDesktopFontAntialiasingMode */
- static const struct
- {
- cairo_antialias_t cairo_antialias;
- gint clutter_font_antialias;
- }
- antialiasings[] =
- {
- /* none=0 */ {CAIRO_ANTIALIAS_NONE, 0},
- /* grayscale=1 */ {CAIRO_ANTIALIAS_GRAY, 1},
- /* rgba=2 */ {CAIRO_ANTIALIAS_SUBPIXEL, 1},
- };
-
- /* org.gnome.desktop.GDesktopFontHinting */
- static const struct
- {
- cairo_hint_style_t cairo_hint_style;
- const char *clutter_font_hint_style;
- }
- hintings[] =
- {
- /* none=0 */ {CAIRO_HINT_STYLE_NONE, "hintnone"},
- /* slight=1 */ {CAIRO_HINT_STYLE_SLIGHT, "hintslight"},
- /* medium=2 */ {CAIRO_HINT_STYLE_MEDIUM, "hintmedium"},
- /* full=3 */ {CAIRO_HINT_STYLE_FULL, "hintfull"},
- };
-
- /* org.gnome.desktop.GDesktopFontRgbaOrder */
- static const struct
- {
- cairo_subpixel_order_t cairo_subpixel_order;
- const char *clutter_font_subpixel_order;
- }
- rgba_orders[] =
- {
- /* rgba=0 */ {CAIRO_SUBPIXEL_ORDER_RGB, "rgb"}, /* XXX what is 'rgba'? */
- /* rgb=1 */ {CAIRO_SUBPIXEL_ORDER_RGB, "rgb"},
- /* bgr=2 */ {CAIRO_SUBPIXEL_ORDER_BGR, "bgr"},
- /* vrgb=3 */ {CAIRO_SUBPIXEL_ORDER_VRGB, "vrgb"},
- /* vbgr=4 */ {CAIRO_SUBPIXEL_ORDER_VBGR, "vbgr"},
- };
- guint i;
-
- i = g_settings_get_enum (settings, "font-hinting");
- if (i < G_N_ELEMENTS (hintings))
- {
- output->cairo_hint_style = hintings[i].cairo_hint_style;
- output->clutter_font_hint_style = hintings[i].clutter_font_hint_style;
- }
- else
- {
- output->cairo_hint_style = CAIRO_HINT_STYLE_DEFAULT;
- output->clutter_font_hint_style = NULL;
- }
-
- i = g_settings_get_enum (settings, "font-antialiasing");
- if (i < G_N_ELEMENTS (antialiasings))
- {
- output->cairo_antialias = antialiasings[i].cairo_antialias;
- output->clutter_font_antialias = antialiasings[i].clutter_font_antialias;
- }
- else
- {
- output->cairo_antialias = CAIRO_ANTIALIAS_DEFAULT;
- output->clutter_font_antialias = -1;
- }
-
- i = g_settings_get_enum (settings, "font-rgba-order");
- if (i < G_N_ELEMENTS (rgba_orders))
- {
- output->cairo_subpixel_order = rgba_orders[i].cairo_subpixel_order;
- output->clutter_font_subpixel_order = rgba_orders[i].clutter_font_subpixel_order;
- }
- else
- {
- output->cairo_subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
- output->clutter_font_subpixel_order = NULL;
- }
-
- if (output->cairo_antialias == CAIRO_ANTIALIAS_GRAY)
- output->clutter_font_subpixel_order = "none";
-}
-
-static void
-init_font_options (ClutterSettings *self)
-{
- GSettings *settings = self->font_settings;
- cairo_font_options_t *options = cairo_font_options_create ();
- FontSettings fs;
-
- get_font_gsettings (settings, &fs);
-
- cairo_font_options_set_hint_style (options, fs.cairo_hint_style);
- cairo_font_options_set_antialias (options, fs.cairo_antialias);
- cairo_font_options_set_subpixel_order (options, fs.cairo_subpixel_order);
-
- clutter_backend_set_font_options (self->backend, options);
-
- cairo_font_options_destroy (options);
-}
-
-static void
-sync_mouse_options (ClutterSettings *self)
-{
- int double_click;
- int drag_threshold;
-
- double_click = g_settings_get_int (self->mouse_settings, "double-click");
- drag_threshold = g_settings_get_int (self->mouse_settings, "drag-threshold");
-
- g_object_set (self,
- "double-click-time", double_click,
- "dnd-drag-threshold", drag_threshold,
- NULL);
-}
-
-static gboolean
-on_font_settings_change_event (GSettings *settings,
- gpointer keys,
- gint n_keys,
- gpointer user_data)
-{
- ClutterSettings *self = CLUTTER_SETTINGS (user_data);
- FontSettings fs;
- gint hinting;
-
- get_font_gsettings (settings, &fs);
- hinting = fs.cairo_hint_style == CAIRO_HINT_STYLE_NONE ? 0 : 1;
- g_object_set (self,
- "font-hinting", hinting,
- "font-hint-style", fs.clutter_font_hint_style,
- "font-antialias", fs.clutter_font_antialias,
- "font-subpixel-order", fs.clutter_font_subpixel_order,
- NULL);
-
- return FALSE;
-}
-
-static gboolean
-on_mouse_settings_change_event (GSettings *settings,
- gpointer keys,
- gint n_keys,
- gpointer user_data)
-{
- ClutterSettings *self = CLUTTER_SETTINGS (user_data);
-
- sync_mouse_options (self);
-
- return FALSE;
-}
-
-struct _pointer_a11y_settings_flags_pair {
- const char *name;
- ClutterPointerA11yFlags flag;
-} pointer_a11y_settings_flags_pair[] = {
- { "secondary-click-enabled", CLUTTER_A11Y_SECONDARY_CLICK_ENABLED },
- { "dwell-click-enabled", CLUTTER_A11Y_DWELL_ENABLED },
-};
-
-static ClutterPointerA11yDwellDirection
-pointer_a11y_dwell_direction_from_setting (ClutterSettings *self,
- const char *key)
-{
- GDesktopMouseDwellDirection dwell_gesture_direction;
-
- dwell_gesture_direction = g_settings_get_enum (self->mouse_a11y_settings,
- key);
- switch (dwell_gesture_direction)
- {
- case G_DESKTOP_MOUSE_DWELL_DIRECTION_LEFT:
- return CLUTTER_A11Y_DWELL_DIRECTION_LEFT;
- break;
- case G_DESKTOP_MOUSE_DWELL_DIRECTION_RIGHT:
- return CLUTTER_A11Y_DWELL_DIRECTION_RIGHT;
- break;
- case G_DESKTOP_MOUSE_DWELL_DIRECTION_UP:
- return CLUTTER_A11Y_DWELL_DIRECTION_UP;
- break;
- case G_DESKTOP_MOUSE_DWELL_DIRECTION_DOWN:
- return CLUTTER_A11Y_DWELL_DIRECTION_DOWN;
- break;
- default:
- break;
- }
- return CLUTTER_A11Y_DWELL_DIRECTION_NONE;
-}
-
-static void
-sync_pointer_a11y_settings (ClutterSettings *self,
- ClutterSeat *seat)
-{
- ClutterPointerA11ySettings pointer_a11y_settings;
- GDesktopMouseDwellMode dwell_mode;
- int i;
-
- clutter_seat_get_pointer_a11y_settings (seat, &pointer_a11y_settings);
- pointer_a11y_settings.controls = 0;
- for (i = 0; i < G_N_ELEMENTS (pointer_a11y_settings_flags_pair); i++)
- {
- if (!g_settings_get_boolean (self->mouse_a11y_settings,
- pointer_a11y_settings_flags_pair[i].name))
- continue;
-
- pointer_a11y_settings.controls |=
- pointer_a11y_settings_flags_pair[i].flag;
- }
-
- /* "secondary-click-time" is expressed in seconds */
- pointer_a11y_settings.secondary_click_delay =
- (1000 * g_settings_get_double (self->mouse_a11y_settings,
- "secondary-click-time"));
- /* "dwell-time" is expressed in seconds */
- pointer_a11y_settings.dwell_delay =
- (1000 * g_settings_get_double (self->mouse_a11y_settings, "dwell-time"));
- pointer_a11y_settings.dwell_threshold =
- g_settings_get_int (self->mouse_a11y_settings, "dwell-threshold");
-
- dwell_mode = g_settings_get_enum (self->mouse_a11y_settings, "dwell-mode");
- if (dwell_mode == G_DESKTOP_MOUSE_DWELL_MODE_WINDOW)
- pointer_a11y_settings.dwell_mode = CLUTTER_A11Y_DWELL_MODE_WINDOW;
- else
- pointer_a11y_settings.dwell_mode = CLUTTER_A11Y_DWELL_MODE_GESTURE;
-
- pointer_a11y_settings.dwell_gesture_single =
- pointer_a11y_dwell_direction_from_setting (self, "dwell-gesture-single");
- pointer_a11y_settings.dwell_gesture_double =
- pointer_a11y_dwell_direction_from_setting (self, "dwell-gesture-double");
- pointer_a11y_settings.dwell_gesture_drag =
- pointer_a11y_dwell_direction_from_setting (self, "dwell-gesture-drag");
- pointer_a11y_settings.dwell_gesture_secondary =
- pointer_a11y_dwell_direction_from_setting (self, "dwell-gesture-secondary");
-
- clutter_seat_set_pointer_a11y_settings (seat, &pointer_a11y_settings);
-}
-
-static gboolean
-on_mouse_a11y_settings_change_event (GSettings *settings,
- gpointer keys,
- int n_keys,
- gpointer user_data)
-{
- ClutterSettings *self = CLUTTER_SETTINGS (user_data);
- ClutterSeat *seat = clutter_backend_get_default_seat (self->backend);
-
- sync_pointer_a11y_settings (self, seat);
-
- return FALSE;
-}
-
-static void
-load_initial_settings (ClutterSettings *self)
-{
- static const gchar *font_settings_path = "org.gnome.desktop.interface";
- static const gchar *mouse_settings_path = "org.gnome.desktop.peripherals.mouse";
- static const char *mouse_a11y_settings_path = "org.gnome.desktop.a11y.mouse";
- GSettingsSchemaSource *source = g_settings_schema_source_get_default ();
- GSettingsSchema *schema;
-
- schema = g_settings_schema_source_lookup (source, font_settings_path, TRUE);
- if (!schema)
- {
- g_warning ("Failed to find schema: %s", font_settings_path);
- }
- else
- {
- self->font_settings = g_settings_new_full (schema, NULL, NULL);
- if (self->font_settings)
- {
- init_font_options (self);
- g_signal_connect (self->font_settings, "change-event",
- G_CALLBACK (on_font_settings_change_event),
- self);
- }
- }
-
- schema = g_settings_schema_source_lookup (source, mouse_settings_path, TRUE);
- if (!schema)
- {
- g_warning ("Failed to find schema: %s", mouse_settings_path);
- }
- else
- {
- self->mouse_settings = g_settings_new_full (schema, NULL, NULL);
- if (self->mouse_settings)
- {
- sync_mouse_options (self);
- g_signal_connect (self->mouse_settings, "change-event",
- G_CALLBACK (on_mouse_settings_change_event),
- self);
- }
- }
-
- schema = g_settings_schema_source_lookup (source, mouse_a11y_settings_path, TRUE);
- if (!schema)
- {
- g_warning ("Failed to find schema: %s", mouse_settings_path);
- }
- else
- {
- self->mouse_a11y_settings = g_settings_new_full (schema, NULL, NULL);
- g_signal_connect (self->mouse_a11y_settings, "change-event",
- G_CALLBACK (on_mouse_a11y_settings_change_event),
- self);
- }
-}
-
-static void
-clutter_settings_finalize (GObject *gobject)
-{
- ClutterSettings *self = CLUTTER_SETTINGS (gobject);
-
- g_free (self->font_name);
- g_free (self->xft_hint_style);
- g_free (self->xft_rgba);
-
- g_clear_object (&self->font_settings);
- g_clear_object (&self->mouse_settings);
- g_clear_object (&self->mouse_a11y_settings);
-
- G_OBJECT_CLASS (clutter_settings_parent_class)->finalize (gobject);
-}
-
-static void
-clutter_settings_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterSettings *self = CLUTTER_SETTINGS (gobject);
-
- switch (prop_id)
- {
- case PROP_BACKEND:
- self->backend = g_value_get_object (value);
- break;
-
- case PROP_DOUBLE_CLICK_TIME:
- self->double_click_time = g_value_get_int (value);
- break;
-
- case PROP_DOUBLE_CLICK_DISTANCE:
- self->double_click_distance = g_value_get_int (value);
- break;
-
- case PROP_DND_DRAG_THRESHOLD:
- self->dnd_drag_threshold = g_value_get_int (value);
- break;
-
- case PROP_FONT_NAME:
- g_free (self->font_name);
- self->font_name = g_value_dup_string (value);
- settings_update_font_name (self);
- break;
-
- case PROP_FONT_ANTIALIAS:
- self->xft_antialias = g_value_get_int (value);
- settings_update_font_options (self);
- break;
-
- case PROP_FONT_DPI:
- self->font_dpi = g_value_get_int (value);
- settings_update_resolution (self);
- break;
-
- case PROP_FONT_HINTING:
- self->xft_hinting = g_value_get_int (value);
- settings_update_font_options (self);
- break;
-
- case PROP_FONT_HINT_STYLE:
- g_free (self->xft_hint_style);
- self->xft_hint_style = g_value_dup_string (value);
- settings_update_font_options (self);
- break;
-
- case PROP_FONT_RGBA:
- g_free (self->xft_rgba);
- self->xft_rgba = g_value_dup_string (value);
- settings_update_font_options (self);
- break;
-
- case PROP_LONG_PRESS_DURATION:
- self->long_press_duration = g_value_get_int (value);
- break;
-
- case PROP_FONTCONFIG_TIMESTAMP:
- settings_update_fontmap (self, g_value_get_uint (value));
- break;
-
- case PROP_PASSWORD_HINT_TIME:
- self->password_hint_time = g_value_get_uint (value);
- break;
-
- case PROP_UNSCALED_FONT_DPI:
- self->font_dpi = g_value_get_int (value);
- settings_update_resolution (self);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-void
-clutter_settings_set_property_internal (ClutterSettings *self,
- const char *property,
- GValue *value)
-{
-
- property = g_intern_string (property);
-
- g_object_set_property (G_OBJECT (self), property, value);
-}
-
-static void
-clutter_settings_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterSettings *self = CLUTTER_SETTINGS (gobject);
-
- switch (prop_id)
- {
- case PROP_DOUBLE_CLICK_TIME:
- g_value_set_int (value, self->double_click_time);
- break;
-
- case PROP_DOUBLE_CLICK_DISTANCE:
- g_value_set_int (value, self->double_click_distance);
- break;
-
- case PROP_DND_DRAG_THRESHOLD:
- g_value_set_int (value, self->dnd_drag_threshold);
- break;
-
- case PROP_FONT_NAME:
- g_value_set_string (value, self->font_name);
- break;
-
- case PROP_FONT_ANTIALIAS:
- g_value_set_int (value, self->xft_antialias);
- break;
-
- case PROP_FONT_DPI:
- g_value_set_int (value, self->resolution * 1024);
- break;
-
- case PROP_FONT_HINTING:
- g_value_set_int (value, self->xft_hinting);
- break;
-
- case PROP_FONT_HINT_STYLE:
- g_value_set_string (value, self->xft_hint_style);
- break;
-
- case PROP_FONT_RGBA:
- g_value_set_string (value, self->xft_rgba);
- break;
-
- case PROP_LONG_PRESS_DURATION:
- g_value_set_int (value, self->long_press_duration);
- break;
-
- case PROP_PASSWORD_HINT_TIME:
- g_value_set_uint (value, self->password_hint_time);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_settings_dispatch_properties_changed (GObject *gobject,
- guint n_pspecs,
- GParamSpec **pspecs)
-{
- ClutterSettings *self = CLUTTER_SETTINGS (gobject);
- GObjectClass *klass;
-
- /* chain up to emit ::notify */
- klass = G_OBJECT_CLASS (clutter_settings_parent_class);
- klass->dispatch_properties_changed (gobject, n_pspecs, pspecs);
-
- /* emit settings-changed just once for multiple properties */
- if (self->backend != NULL)
- g_signal_emit_by_name (self->backend, "settings-changed");
-}
-
-static void
-clutter_settings_class_init (ClutterSettingsClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- /**
- * ClutterSettings:backend:
- *
- * A back pointer to the #ClutterBackend
- *
- * Since: 1.4
- *
- * Deprecated: 1.10
- */
- obj_props[PROP_BACKEND] =
- g_param_spec_object ("backend",
- "Backend",
- "A pointer to the backend",
- CLUTTER_TYPE_BACKEND,
- CLUTTER_PARAM_WRITABLE |
- G_PARAM_DEPRECATED |
- G_PARAM_CONSTRUCT_ONLY);
-
- /**
- * ClutterSettings:double-click-time:
- *
- * The time, in milliseconds, that should elapse between button-press
- * events in order to increase the click count by 1.
- *
- * Since: 1.4
- */
- obj_props[PROP_DOUBLE_CLICK_TIME] =
- g_param_spec_int ("double-click-time",
- P_("Double Click Time"),
- P_("The time between clicks necessary to detect a multiple click"),
- 0, G_MAXINT,
- 250,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterSettings:double-click-distance:
- *
- * The maximum distance, in pixels, between button-press events that
- * determines whether or not to increase the click count by 1.
- *
- * Since: 1.4
- */
- obj_props[PROP_DOUBLE_CLICK_DISTANCE] =
- g_param_spec_int ("double-click-distance",
- P_("Double Click Distance"),
- P_("The distance between clicks necessary to detect a multiple click"),
- 0, G_MAXINT,
- 5,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterSettings:dnd-drag-threshold:
- *
- * The default distance that the cursor of a pointer device
- * should travel before a drag operation should start.
- *
- * Since: 1.8
- */
- obj_props[PROP_DND_DRAG_THRESHOLD] =
- g_param_spec_int ("dnd-drag-threshold",
- P_("Drag Threshold"),
- P_("The distance the cursor should travel before starting to drag"),
- 1, G_MAXINT,
- 8,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterSettings:font-name:
- *
- * The default font name that should be used by text actors, as
- * a string that can be passed to pango_font_description_from_string().
- *
- * Since: 1.4
- */
- obj_props[PROP_FONT_NAME] =
- g_param_spec_string ("font-name",
- P_("Font Name"),
- P_("The description of the default font, as one that could be parsed by Pango"),
- NULL,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterSettings:font-antialias:
- *
- * Whether or not to use antialiasing when rendering text; a value
- * of 1 enables it unconditionally; a value of 0 disables it
- * unconditionally; and -1 will use the system's default.
- *
- * Since: 1.4
- */
- obj_props[PROP_FONT_ANTIALIAS] =
- g_param_spec_int ("font-antialias",
- P_("Font Antialias"),
- P_("Whether to use antialiasing (1 to enable, 0 to disable, and -1 to use the default)"),
- -1, 1,
- -1,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterSettings:font-dpi:
- *
- * The DPI used when rendering text, as a value of 1024 * dots/inch.
- *
- * If set to -1, the system's default will be used instead
- *
- * Since: 1.4
- */
- obj_props[PROP_FONT_DPI] =
- g_param_spec_int ("font-dpi",
- P_("Font DPI"),
- P_("The resolution of the font, in 1024 * dots/inch, or -1 to use the default"),
- -1, 1024 * 1024,
- -1,
- CLUTTER_PARAM_READWRITE);
-
- obj_props[PROP_UNSCALED_FONT_DPI] =
- g_param_spec_int ("unscaled-font-dpi",
- P_("Font DPI"),
- P_("The resolution of the font, in 1024 * dots/inch, or -1 to use the default"),
- -1, 1024 * 1024,
- -1,
- CLUTTER_PARAM_WRITABLE);
-
- /**
- * ClutterSettings:font-hinting:
- *
- * Whether or not to use hinting when rendering text; a value of 1
- * unconditionally enables it; a value of 0 unconditionally disables
- * it; and a value of -1 will use the system's default.
- *
- * Since: 1.4
- */
- obj_props[PROP_FONT_HINTING] =
- g_param_spec_int ("font-hinting",
- P_("Font Hinting"),
- P_("Whether to use hinting (1 to enable, 0 to disable and -1 to use the default)"),
- -1, 1,
- -1,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterSettings:font-hint-style:
- *
- * The style of the hinting used when rendering text. Valid values
- * are:
- *
- * - hintnone
- * - hintslight
- * - hintmedium
- * - hintfull
- *
- * Since: 1.4
- */
- obj_props[PROP_FONT_HINT_STYLE] =
- g_param_spec_string ("font-hint-style",
- P_("Font Hint Style"),
- P_("The style of hinting (hintnone, hintslight, hintmedium, hintfull)"),
- NULL,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterSettings:font-subpixel-order:
- *
- * The type of sub-pixel antialiasing used when rendering text. Valid
- * values are:
- *
- * - none
- * - rgb
- * - bgr
- * - vrgb
- * - vbgr
- *
- * Since: 1.4
- */
- obj_props[PROP_FONT_RGBA] =
- g_param_spec_string ("font-subpixel-order",
- P_("Font Subpixel Order"),
- P_("The type of subpixel antialiasing (none, rgb, bgr, vrgb, vbgr)"),
- NULL,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterSettings:long-press-duration:
- *
- * Sets the minimum duration for a press to be recognized as a long press
- * gesture. The duration is expressed in milliseconds.
- *
- * See also #ClutterClickAction:long-press-duration.
- *
- * Since: 1.8
- */
- obj_props[PROP_LONG_PRESS_DURATION] =
- g_param_spec_int ("long-press-duration",
- P_("Long Press Duration"),
- P_("The minimum duration for a long press gesture to be recognized"),
- 0, G_MAXINT,
- 500,
- CLUTTER_PARAM_READWRITE);
-
- obj_props[PROP_FONTCONFIG_TIMESTAMP] =
- g_param_spec_uint ("fontconfig-timestamp",
- P_("Fontconfig configuration timestamp"),
- P_("Timestamp of the current fontconfig configuration"),
- 0, G_MAXUINT,
- 0,
- CLUTTER_PARAM_WRITABLE);
-
- /**
- * ClutterText:password-hint-time:
- *
- * How long should Clutter show the last input character in editable
- * ClutterText actors. The value is in milliseconds. A value of 0
- * disables showing the password hint. 600 is a good value for
- * enabling the hint.
- *
- * Since: 1.10
- */
- obj_props[PROP_PASSWORD_HINT_TIME] =
- g_param_spec_uint ("password-hint-time",
- P_("Password Hint Time"),
- P_("How long to show the last input character in hidden entries"),
- 0, G_MAXUINT,
- 0,
- CLUTTER_PARAM_READWRITE);
-
- gobject_class->set_property = clutter_settings_set_property;
- gobject_class->get_property = clutter_settings_get_property;
- gobject_class->dispatch_properties_changed =
- clutter_settings_dispatch_properties_changed;
- gobject_class->finalize = clutter_settings_finalize;
- g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
-}
-
-static void
-clutter_settings_init (ClutterSettings *self)
-{
- self->resolution = -1.0;
-
- self->font_dpi = -1;
- self->unscaled_font_dpi = -1;
-
- self->double_click_time = 250;
- self->double_click_distance = 5;
-
- self->dnd_drag_threshold = 8;
-
- self->font_name = g_strdup (DEFAULT_FONT_NAME);
-
- self->xft_antialias = -1;
- self->xft_hinting = -1;
- self->xft_hint_style = NULL;
- self->xft_rgba = NULL;
-
- self->long_press_duration = 500;
-}
-
-/**
- * clutter_settings_get_default:
- *
- * Retrieves the singleton instance of #ClutterSettings
- *
- * Return value: (transfer none): the instance of #ClutterSettings. The
- * returned object is owned by Clutter and it should not be unreferenced
- * directly
- *
- * Since: 1.4
- */
-ClutterSettings *
-clutter_settings_get_default (void)
-{
- static ClutterSettings *settings = NULL;
-
- if (G_UNLIKELY (settings == NULL))
- settings = g_object_new (CLUTTER_TYPE_SETTINGS, NULL);
-
- return settings;
-}
-
-void
-_clutter_settings_set_backend (ClutterSettings *settings,
- ClutterBackend *backend)
-{
- g_assert (CLUTTER_IS_SETTINGS (settings));
- g_assert (CLUTTER_IS_BACKEND (backend));
-
- settings->backend = backend;
-
- load_initial_settings (settings);
-}
-
-void
-clutter_settings_ensure_pointer_a11y_settings (ClutterSettings *settings,
- ClutterSeat *seat)
-{
- sync_pointer_a11y_settings (settings, seat);
-}
diff --git a/clutter/clutter/clutter-settings.h b/clutter/clutter/clutter-settings.h
deleted file mode 100644
index bb3911e9d..000000000
--- a/clutter/clutter/clutter-settings.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef __CLUTTER_SETTINGS_H__
-#define __CLUTTER_SETTINGS_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-types.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_SETTINGS (clutter_settings_get_type ())
-#define CLUTTER_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_SETTINGS, ClutterSettings))
-#define CLUTTER_IS_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_SETTINGS))
-
-typedef struct _ClutterSettings ClutterSettings;
-typedef struct _ClutterSettingsClass ClutterSettingsClass;
-
-CLUTTER_EXPORT
-GType clutter_settings_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterSettings *clutter_settings_get_default (void);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_SETTINGS_H__ */
diff --git a/clutter/clutter/clutter-shader-effect.c b/clutter/clutter/clutter-shader-effect.c
deleted file mode 100644
index 4c9c866c9..000000000
--- a/clutter/clutter/clutter-shader-effect.c
+++ /dev/null
@@ -1,904 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-shader-effect
- * @short_description: Base class for shader effects
- * @See_Also: #ClutterEffect, #ClutterOffscreenEffect
- *
- * #ClutterShaderEffect is a class that implements all the plumbing for
- * creating #ClutterEffect<!-- -->s using GLSL shaders.
- *
- * #ClutterShaderEffect creates an offscreen buffer and then applies the
- * GLSL shader (after checking whether the compilation and linking were
- * successful) to the buffer before painting it on screen.
- *
- * #ClutterShaderEffect is available since Clutter 1.4
- *
- * ## Implementing a ClutterShaderEffect
- *
- * Creating a sub-class of #ClutterShaderEffect requires the
- * overriding of the #ClutterOffscreenEffectClass.paint_target() virtual
- * function from the #ClutterOffscreenEffect class. It is also convenient
- * to implement the #ClutterShaderEffectClass.get_static_shader_source()
- * virtual function in case you are planning to create more than one
- * instance of the effect.
- *
- * The #ClutterShaderEffectClass.get_static_shader_source()
- * function should return a copy of the shader source to use. This
- * function is only called once per subclass of #ClutterShaderEffect
- * regardless of how many instances of the effect are created. The
- * source for the shader is typically stored in a static const
- * string which is returned from this function via
- * g_strdup().
- *
- * The #ClutterOffscreenEffectClass.paint_target() should set the
- * shader's uniforms if any. This is done by calling
- * clutter_shader_effect_set_uniform_value() or
- * clutter_shader_effect_set_uniform(). The sub-class should then
- * chain up to the #ClutterShaderEffect implementation.
- *
- * ## Setting uniforms on a ClutterShaderEffect
- *
- * The example below shows a typical implementation of the
- * #ClutterShaderEffectClass.get_static_shader_source() and
- * #ClutterOffscreenEffectClass.paint_target() virtual functions
- * for a #ClutterShaderEffect subclass.
- *
- * |[<!-- language="C" -->
- * static gchar *
- * my_effect_get_static_shader_source (ClutterShaderEffect *effect)
- * {
- * // shader_source is set elsewhere
- * return g_strdup (shader_source);
- * }
- *
- * static gboolean
- * my_effect_paint_target (ClutterOffscreenEffect *effect)
- * {
- * MyEffect *self = MY_EFFECT (effect);
- * ClutterShaderEffect *shader = CLUTTER_SHADER_EFFECT (effect);
- * ClutterEffectClass *parent_class;
- * gfloat component_r, component_g, component_b;
- *
- * // the "tex" uniform is declared in the shader as:
- * //
- * // uniform int tex;
- * //
- * // and it is passed a constant value of 0
- * clutter_shader_effect_set_uniform (shader, "tex", G_TYPE_INT, 1, 0);
- *
- * // the "component" uniform is declared in the shader as:
- * //
- * // uniform vec3 component;
- * //
- * // and it's defined to contain the normalized components
- * // of a #ClutterColor
- * component_r = self->color.red / 255.0f;
- * component_g = self->color.green / 255.0f;
- * component_b = self->color.blue / 255.0f;
- * clutter_shader_effect_set_uniform (shader, "component",
- * G_TYPE_FLOAT, 3,
- * component_r,
- * component_g,
- * component_b);
- *
- * // chain up to the parent's implementation
- * parent_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (my_effect_parent_class);
- * return parent_class->paint_target (effect);
- * }
- * ]|
- */
-
-#include "clutter-build-config.h"
-
-#include "cogl/cogl.h"
-
-#include "clutter-shader-effect.h"
-
-#include "clutter-debug.h"
-#include "clutter-enum-types.h"
-#include "clutter-feature.h"
-#include "clutter-private.h"
-#include "clutter-shader-types.h"
-
-typedef struct _ShaderUniform
-{
- gchar *name;
- GType type;
- GValue value;
- int location;
-} ShaderUniform;
-
-struct _ClutterShaderEffectPrivate
-{
- ClutterActor *actor;
-
- ClutterShaderType shader_type;
-
- CoglHandle program;
- CoglHandle shader;
-
- GHashTable *uniforms;
-};
-
-typedef struct _ClutterShaderEffectClassPrivate
-{
- /* These are the per-class pre-compiled shader and program which is
- used when the class implements get_static_shader_source without
- calling set_shader_source. They will be shared by all instances
- of this class */
- CoglHandle program;
- CoglHandle shader;
-} ClutterShaderEffectClassPrivate;
-
-enum
-{
- PROP_0,
-
- PROP_SHADER_TYPE,
-
- PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST];
-
-G_DEFINE_TYPE_WITH_CODE (ClutterShaderEffect,
- clutter_shader_effect,
- CLUTTER_TYPE_OFFSCREEN_EFFECT,
- G_ADD_PRIVATE (ClutterShaderEffect)
- g_type_add_class_private (g_define_type_id,
- sizeof (ClutterShaderEffectClassPrivate)))
-
-static inline void
-clutter_shader_effect_clear (ClutterShaderEffect *self,
- gboolean reset_uniforms)
-{
- ClutterShaderEffectPrivate *priv = self->priv;
-
- if (priv->shader != NULL)
- {
- cogl_object_unref (priv->shader);
-
- priv->shader = NULL;
- }
-
- if (priv->program != NULL)
- {
- cogl_object_unref (priv->program);
-
- priv->program = NULL;
- }
-
- if (reset_uniforms && priv->uniforms != NULL)
- {
- g_hash_table_destroy (priv->uniforms);
- priv->uniforms = NULL;
- }
-
- priv->actor = NULL;
-}
-
-static void
-clutter_shader_effect_update_uniforms (ClutterShaderEffect *effect)
-{
- ClutterShaderEffectPrivate *priv = effect->priv;
- GHashTableIter iter;
- gpointer key, value;
- gsize size;
-
- if (priv->program == NULL)
- return;
-
- if (priv->uniforms == NULL)
- return;
-
- key = value = NULL;
- g_hash_table_iter_init (&iter, priv->uniforms);
- while (g_hash_table_iter_next (&iter, &key, &value))
- {
- ShaderUniform *uniform = value;
-
- if (uniform->location == -1)
- uniform->location = cogl_program_get_uniform_location (priv->program,
- uniform->name);
-
- if (CLUTTER_VALUE_HOLDS_SHADER_FLOAT (&uniform->value))
- {
- const float *floats;
-
- floats = clutter_value_get_shader_float (&uniform->value, &size);
- cogl_program_set_uniform_float (priv->program, uniform->location,
- size, 1,
- floats);
- }
- else if (CLUTTER_VALUE_HOLDS_SHADER_INT (&uniform->value))
- {
- const int *ints;
-
- ints = clutter_value_get_shader_int (&uniform->value, &size);
- cogl_program_set_uniform_int (priv->program, uniform->location,
- size, 1,
- ints);
- }
- else if (CLUTTER_VALUE_HOLDS_SHADER_MATRIX (&uniform->value))
- {
- const float *matrix;
-
- matrix = clutter_value_get_shader_matrix (&uniform->value, &size);
- cogl_program_set_uniform_matrix (priv->program, uniform->location,
- size, 1,
- FALSE,
- matrix);
- }
- else if (G_VALUE_HOLDS_FLOAT (&uniform->value))
- {
- const float float_val = g_value_get_float (&uniform->value);
-
- cogl_program_set_uniform_float (priv->program, uniform->location,
- 1, 1,
- &float_val);
- }
- else if (G_VALUE_HOLDS_DOUBLE (&uniform->value))
- {
- const float float_val =
- (float) g_value_get_double (&uniform->value);
-
- cogl_program_set_uniform_float (priv->program, uniform->location,
- 1, 1,
- &float_val);
- }
- else if (G_VALUE_HOLDS_INT (&uniform->value))
- {
- const int int_val = g_value_get_int (&uniform->value);
-
- cogl_program_set_uniform_int (priv->program, uniform->location,
- 1, 1,
- &int_val);
- }
- else
- g_warning ("Invalid uniform of type '%s' for name '%s'",
- g_type_name (G_VALUE_TYPE (&uniform->value)),
- uniform->name);
- }
-}
-
-static void
-clutter_shader_effect_set_actor (ClutterActorMeta *meta,
- ClutterActor *actor)
-{
- ClutterShaderEffect *self = CLUTTER_SHADER_EFFECT (meta);
- ClutterShaderEffectPrivate *priv = self->priv;
- ClutterActorMetaClass *parent;
-
- if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
- {
- /* if we don't have support for GLSL shaders then we
- * forcibly disable the ActorMeta
- */
- g_warning ("Unable to use the ShaderEffect: the graphics hardware "
- "or the current GL driver does not implement support "
- "for the GLSL shading language.");
- clutter_actor_meta_set_enabled (meta, FALSE);
- return;
- }
-
- parent = CLUTTER_ACTOR_META_CLASS (clutter_shader_effect_parent_class);
- parent->set_actor (meta, actor);
-
- /* we keep a back pointer here */
- priv->actor = clutter_actor_meta_get_actor (meta);
- if (priv->actor == NULL)
- return;
-
- CLUTTER_NOTE (SHADER, "Preparing shader effect of type '%s'",
- G_OBJECT_TYPE_NAME (meta));
-}
-
-static CoglHandle
-clutter_shader_effect_create_shader (ClutterShaderEffect *self)
-{
- ClutterShaderEffectPrivate *priv = self->priv;
-
- switch (priv->shader_type)
- {
- case CLUTTER_FRAGMENT_SHADER:
- return cogl_create_shader (COGL_SHADER_TYPE_FRAGMENT);
- break;
-
- case CLUTTER_VERTEX_SHADER:
- return cogl_create_shader (COGL_SHADER_TYPE_VERTEX);
- break;
-
- default:
- g_assert_not_reached ();
- return NULL;
- }
-}
-
-static void
-clutter_shader_effect_try_static_source (ClutterShaderEffect *self)
-{
- ClutterShaderEffectPrivate *priv = self->priv;
- ClutterShaderEffectClass *shader_effect_class =
- CLUTTER_SHADER_EFFECT_GET_CLASS (self);
-
- if (shader_effect_class->get_static_shader_source != NULL)
- {
- ClutterShaderEffectClassPrivate *class_priv;
-
- class_priv =
- G_TYPE_CLASS_GET_PRIVATE (shader_effect_class,
- CLUTTER_TYPE_SHADER_EFFECT,
- ClutterShaderEffectClassPrivate);
-
- if (class_priv->shader == NULL)
- {
- gchar *source;
-
- class_priv->shader = clutter_shader_effect_create_shader (self);
-
- source = shader_effect_class->get_static_shader_source (self);
-
- cogl_shader_source (class_priv->shader, source);
-
- g_free (source);
-
- CLUTTER_NOTE (SHADER, "Compiling shader effect");
-
- class_priv->program = cogl_create_program ();
-
- cogl_program_attach_shader (class_priv->program,
- class_priv->shader);
-
- cogl_program_link (class_priv->program);
- }
-
- priv->shader = cogl_object_ref (class_priv->shader);
-
- if (class_priv->program != NULL)
- priv->program = cogl_object_ref (class_priv->program);
- }
-}
-
-static void
-clutter_shader_effect_paint_target (ClutterOffscreenEffect *effect,
- ClutterPaintNode *node,
- ClutterPaintContext *paint_context)
-{
- ClutterShaderEffect *self = CLUTTER_SHADER_EFFECT (effect);
- ClutterShaderEffectPrivate *priv = self->priv;
- ClutterOffscreenEffectClass *parent;
- CoglPipeline *pipeline;
-
- /* If the source hasn't been set then we'll try to get it from the
- static source instead */
- if (priv->shader == NULL)
- 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)
- goto out;
-
- CLUTTER_NOTE (SHADER, "Applying the shader effect of type '%s'",
- G_OBJECT_TYPE_NAME (effect));
-
- clutter_shader_effect_update_uniforms (CLUTTER_SHADER_EFFECT (effect));
-
- /* associate the program to the offscreen target pipeline */
- pipeline = clutter_offscreen_effect_get_pipeline (effect);
- cogl_pipeline_set_user_program (pipeline, priv->program);
-
-out:
- /* paint the offscreen buffer */
- parent = CLUTTER_OFFSCREEN_EFFECT_CLASS (clutter_shader_effect_parent_class);
- parent->paint_target (effect, node, paint_context);
-
-}
-
-static void
-clutter_shader_effect_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterShaderEffectPrivate *priv = CLUTTER_SHADER_EFFECT (gobject)->priv;
-
- switch (prop_id)
- {
- case PROP_SHADER_TYPE:
- priv->shader_type = g_value_get_enum (value);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_shader_effect_finalize (GObject *gobject)
-{
- ClutterShaderEffect *effect = CLUTTER_SHADER_EFFECT (gobject);
-
- clutter_shader_effect_clear (effect, TRUE);
-
- G_OBJECT_CLASS (clutter_shader_effect_parent_class)->finalize (gobject);
-}
-
-static void
-clutter_shader_effect_class_init (ClutterShaderEffectClass *klass)
-{
- ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- ClutterOffscreenEffectClass *offscreen_class;
-
- offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass);
-
- /**
- * ClutterShaderEffect:shader-type:
- *
- * The type of shader that is used by the effect. This property
- * should be set by the constructor of #ClutterShaderEffect
- * sub-classes.
- *
- * Since: 1.4
- */
- obj_props[PROP_SHADER_TYPE] =
- g_param_spec_enum ("shader-type",
- P_("Shader Type"),
- P_("The type of shader used"),
- CLUTTER_TYPE_SHADER_TYPE,
- CLUTTER_FRAGMENT_SHADER,
- CLUTTER_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
-
- gobject_class->set_property = clutter_shader_effect_set_property;
- gobject_class->finalize = clutter_shader_effect_finalize;
- g_object_class_install_properties (gobject_class,
- PROP_LAST,
- obj_props);
-
- meta_class->set_actor = clutter_shader_effect_set_actor;
-
- offscreen_class->paint_target = clutter_shader_effect_paint_target;
-}
-
-static void
-clutter_shader_effect_init (ClutterShaderEffect *effect)
-{
- effect->priv = clutter_shader_effect_get_instance_private (effect);
- effect->priv->shader_type = CLUTTER_FRAGMENT_SHADER;
-}
-
-/**
- * clutter_shader_effect_new:
- * @shader_type: the type of the shader, either %CLUTTER_FRAGMENT_SHADER,
- * or %CLUTTER_VERTEX_SHADER
- *
- * Creates a new #ClutterShaderEffect, to be applied to an actor using
- * clutter_actor_add_effect().
- *
- * The effect will be empty until clutter_shader_effect_set_shader_source()
- * is called.
- *
- * Return value: the newly created #ClutterShaderEffect.
- * Use g_object_unref() when done.
- *
- * Since: 1.8
- */
-ClutterEffect *
-clutter_shader_effect_new (ClutterShaderType shader_type)
-{
- return g_object_new (CLUTTER_TYPE_SHADER_EFFECT,
- "shader-type", shader_type,
- NULL);
-}
-
-/**
- * clutter_shader_effect_get_shader:
- * @effect: a #ClutterShaderEffect
- *
- * Retrieves a pointer to the shader's handle
- *
- * Return value: (transfer none): a pointer to the shader's handle,
- * or %NULL
- *
- * Since: 1.4
- */
-CoglHandle
-clutter_shader_effect_get_shader (ClutterShaderEffect *effect)
-{
- g_return_val_if_fail (CLUTTER_IS_SHADER_EFFECT (effect),
- NULL);
-
- return effect->priv->shader;
-}
-
-/**
- * clutter_shader_effect_get_program:
- * @effect: a #ClutterShaderEffect
- *
- * Retrieves a pointer to the program's handle
- *
- * Return value: (transfer none): a pointer to the program's handle,
- * or %NULL
- *
- * Since: 1.4
- */
-CoglHandle
-clutter_shader_effect_get_program (ClutterShaderEffect *effect)
-{
- g_return_val_if_fail (CLUTTER_IS_SHADER_EFFECT (effect),
- NULL);
-
- return effect->priv->program;
-}
-
-static void
-shader_uniform_free (gpointer data)
-{
- if (data != NULL)
- {
- ShaderUniform *uniform = data;
-
- g_value_unset (&uniform->value);
- g_free (uniform->name);
-
- g_free (uniform);
- }
-}
-
-static ShaderUniform *
-shader_uniform_new (const gchar *name,
- const GValue *value)
-{
- ShaderUniform *retval;
-
- retval = g_new0 (ShaderUniform, 1);
- retval->name = g_strdup (name);
- retval->type = G_VALUE_TYPE (value);
- retval->location = -1;
-
- g_value_init (&retval->value, retval->type);
- g_value_copy (value, &retval->value);
-
- return retval;
-}
-
-static void
-shader_uniform_update (ShaderUniform *uniform,
- const GValue *value)
-{
- g_value_unset (&uniform->value);
-
- g_value_init (&uniform->value, G_VALUE_TYPE (value));
- g_value_copy (value, &uniform->value);
-}
-
-static inline void
-clutter_shader_effect_add_uniform (ClutterShaderEffect *effect,
- const gchar *name,
- const GValue *value)
-{
- ClutterShaderEffectPrivate *priv = effect->priv;
- ShaderUniform *uniform;
-
- if (priv->uniforms == NULL)
- {
- priv->uniforms = g_hash_table_new_full (g_str_hash, g_str_equal,
- NULL,
- shader_uniform_free);
- }
-
- uniform = g_hash_table_lookup (priv->uniforms, name);
- if (uniform == NULL)
- {
- uniform = shader_uniform_new (name, value);
- g_hash_table_insert (priv->uniforms, uniform->name, uniform);
- }
- else
- shader_uniform_update (uniform, value);
-
- if (priv->actor != NULL && !CLUTTER_ACTOR_IN_PAINT (priv->actor))
- clutter_effect_queue_repaint (CLUTTER_EFFECT (effect));
-}
-
-/**
- * clutter_shader_effect_set_uniform_value:
- * @effect: a #ClutterShaderEffect
- * @name: the name of the uniform to set
- * @value: a #GValue with the value of the uniform to set
- *
- * Sets @value as the payload for the uniform @name inside the shader
- * effect
- *
- * The #GType of the @value must be one of: %G_TYPE_INT, for a single
- * integer value; %G_TYPE_FLOAT, for a single floating point value;
- * %CLUTTER_TYPE_SHADER_INT, for an array of integer values;
- * %CLUTTER_TYPE_SHADER_FLOAT, for an array of floating point values;
- * and %CLUTTER_TYPE_SHADER_MATRIX, for a matrix of floating point
- * values. It also accepts %G_TYPE_DOUBLE for compatibility with other
- * languages than C.
- *
- * Since: 1.4
- */
-void
-clutter_shader_effect_set_uniform_value (ClutterShaderEffect *effect,
- const gchar *name,
- const GValue *value)
-{
- g_return_if_fail (CLUTTER_IS_SHADER_EFFECT (effect));
- g_return_if_fail (name != NULL);
- g_return_if_fail (value != NULL);
-
- clutter_shader_effect_add_uniform (effect, name, value);
-}
-
-static void
-clutter_shader_effect_set_uniform_valist (ClutterShaderEffect *effect,
- const gchar *name,
- GType value_type,
- gsize n_values,
- va_list *args)
-{
- GValue value = G_VALUE_INIT;
-
- if (value_type == CLUTTER_TYPE_SHADER_INT)
- {
- gint *int_values = va_arg (*args, gint*);
-
- g_value_init (&value, CLUTTER_TYPE_SHADER_INT);
- clutter_value_set_shader_int (&value, n_values, int_values);
-
- goto add_uniform;
- }
-
- if (value_type == CLUTTER_TYPE_SHADER_FLOAT)
- {
- gfloat *float_values = va_arg (*args, gfloat*);
-
- g_value_init (&value, CLUTTER_TYPE_SHADER_FLOAT);
- clutter_value_set_shader_float (&value, n_values, float_values);
-
- goto add_uniform;
- }
-
- if (value_type == CLUTTER_TYPE_SHADER_MATRIX)
- {
- gfloat *float_values = va_arg (*args, gfloat*);
-
- g_value_init (&value, CLUTTER_TYPE_SHADER_MATRIX);
- clutter_value_set_shader_matrix (&value, n_values, float_values);
-
- goto add_uniform;
- }
-
- if (value_type == G_TYPE_INT)
- {
- g_return_if_fail (n_values <= 4);
-
- /* if we only have one value we can go through the fast path
- * of using G_TYPE_INT, otherwise we create a vector of integers
- * from the passed values
- */
- if (n_values == 1)
- {
- gint int_val = va_arg (*args, gint);
-
- g_value_init (&value, G_TYPE_INT);
- g_value_set_int (&value, int_val);
- }
- else
- {
- gint *int_values = g_new (gint, n_values);
- gint i;
-
- for (i = 0; i < n_values; i++)
- int_values[i] = va_arg (*args, gint);
-
- g_value_init (&value, CLUTTER_TYPE_SHADER_INT);
- clutter_value_set_shader_int (&value, n_values, int_values);
-
- g_free (int_values);
- }
-
- goto add_uniform;
- }
-
- if (value_type == G_TYPE_FLOAT)
- {
- g_return_if_fail (n_values <= 4);
-
- /* if we only have one value we can go through the fast path
- * of using G_TYPE_FLOAT, otherwise we create a vector of floats
- * from the passed values
- */
- if (n_values == 1)
- {
- gfloat float_val = (gfloat) va_arg (*args, gdouble);
-
- g_value_init (&value, G_TYPE_FLOAT);
- g_value_set_float (&value, float_val);
- }
- else
- {
- gfloat *float_values = g_new (gfloat, n_values);
- gint i;
-
- for (i = 0; i < n_values; i++)
- float_values[i] = (gfloat) va_arg (*args, double);
-
- g_value_init (&value, CLUTTER_TYPE_SHADER_FLOAT);
- clutter_value_set_shader_float (&value, n_values, float_values);
-
- g_free (float_values);
- }
-
- goto add_uniform;
- }
-
- g_warning ("Unrecognized type '%s' (values: %d) for uniform name '%s'",
- g_type_name (value_type),
- (int) n_values,
- name);
- return;
-
-add_uniform:
- clutter_shader_effect_add_uniform (effect, name, &value);
- g_value_unset (&value);
-}
-
-/**
- * clutter_shader_effect_set_uniform:
- * @effect: a #ClutterShaderEffect
- * @name: the name of the uniform to set
- * @gtype: the type of the uniform to set
- * @n_values: the number of values
- * @...: a list of values
- *
- * Sets a list of values as the payload for the uniform @name inside
- * the shader effect
- *
- * The @gtype must be one of: %G_TYPE_INT, for 1 or more integer values;
- * %G_TYPE_FLOAT, for 1 or more floating point values;
- * %CLUTTER_TYPE_SHADER_INT, for a pointer to an array of integer values;
- * %CLUTTER_TYPE_SHADER_FLOAT, for a pointer to an array of floating point
- * values; and %CLUTTER_TYPE_SHADER_MATRIX, for a pointer to an array of
- * floating point values mapping a matrix
- *
- * The number of values interpreted is defined by the @n_value
- * argument, and by the @gtype argument. For instance, a uniform named
- * "sampler0" and containing a single integer value is set using:
- *
- * |[<!-- language="C" -->
- * clutter_shader_effect_set_uniform (effect, "sampler0",
- * G_TYPE_INT, 1,
- * 0);
- * ]|
- *
- * While a uniform named "components" and containing a 3-elements vector
- * of floating point values (a "vec3") can be set using:
- *
- * |[<!-- language="C" -->
- * gfloat component_r, component_g, component_b;
- *
- * clutter_shader_effect_set_uniform (effect, "components",
- * G_TYPE_FLOAT, 3,
- * component_r,
- * component_g,
- * component_b);
- * ]|
- *
- * or can be set using:
- *
- * |[<!-- language="C" -->
- * gfloat component_vec[3];
- *
- * clutter_shader_effect_set_uniform (effect, "components",
- * CLUTTER_TYPE_SHADER_FLOAT, 3,
- * component_vec);
- * ]|
- *
- * Finally, a uniform named "map" and containing a matrix can be set using:
- *
- * |[<!-- language="C" -->
- * float v[16];
- *
- * cogl_matrix_to_float (&matrix, v);
- * clutter_shader_effect_set_uniform (effect, "map",
- * CLUTTER_TYPE_SHADER_MATRIX,
- * 1, v);
- * ]|
- *
- * Since: 1.4
- */
-void
-clutter_shader_effect_set_uniform (ClutterShaderEffect *effect,
- const gchar *name,
- GType gtype,
- gsize n_values,
- ...)
-{
- va_list args;
-
- g_return_if_fail (CLUTTER_IS_SHADER_EFFECT (effect));
- g_return_if_fail (name != NULL);
- g_return_if_fail (gtype != G_TYPE_INVALID);
- g_return_if_fail (n_values > 0);
-
- va_start (args, n_values);
- clutter_shader_effect_set_uniform_valist (effect, name,
- gtype,
- n_values,
- &args);
- va_end (args);
-}
-
-/**
- * clutter_shader_effect_set_shader_source:
- * @effect: a #ClutterShaderEffect
- * @source: the source of a GLSL shader
- *
- * Sets the source of the GLSL shader used by @effect
- *
- * This function should only be called by implementations of
- * the #ClutterShaderEffect class, and not by application code.
- *
- * This function can only be called once; subsequent calls will
- * yield no result.
- *
- * Return value: %TRUE if the source was set
- *
- * Since: 1.4
- */
-gboolean
-clutter_shader_effect_set_shader_source (ClutterShaderEffect *effect,
- const gchar *source)
-{
- ClutterShaderEffectPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_SHADER_EFFECT (effect), FALSE);
- g_return_val_if_fail (source != NULL && *source != '\0', FALSE);
-
- priv = effect->priv;
-
- if (priv->shader != NULL)
- return TRUE;
-
- priv->shader = clutter_shader_effect_create_shader (effect);
-
- cogl_shader_source (priv->shader, source);
-
- CLUTTER_NOTE (SHADER, "Compiling shader effect");
-
- priv->program = cogl_create_program ();
-
- cogl_program_attach_shader (priv->program, priv->shader);
-
- cogl_program_link (priv->program);
-
- return TRUE;
-}
diff --git a/clutter/clutter/clutter-shader-effect.h b/clutter/clutter/clutter-shader-effect.h
deleted file mode 100644
index 7df050ee7..000000000
--- a/clutter/clutter/clutter-shader-effect.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_SHADER_EFFECT_H__
-#define __CLUTTER_SHADER_EFFECT_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-offscreen-effect.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_SHADER_EFFECT (clutter_shader_effect_get_type ())
-#define CLUTTER_SHADER_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_SHADER_EFFECT, ClutterShaderEffect))
-#define CLUTTER_IS_SHADER_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_SHADER_EFFECT))
-#define CLUTTER_SHADER_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_SHADER_EFFECT, ClutterShaderEffectClass))
-#define CLUTTER_IS_SHADER_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_SHADER_EFFECT))
-#define CLUTTER_SHADER_EFFECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_SHADER_EFFECT, ClutterShaderEffectClass))
-
-typedef struct _ClutterShaderEffect ClutterShaderEffect;
-typedef struct _ClutterShaderEffectPrivate ClutterShaderEffectPrivate;
-typedef struct _ClutterShaderEffectClass ClutterShaderEffectClass;
-
-/**
- * ClutterShaderEffect:
- *
- * The #ClutterShaderEffect structure contains
- * only private data and should be accessed using the provided API
- *
- * Since: 1.4
- */
-struct _ClutterShaderEffect
-{
- /*< private >*/
- ClutterOffscreenEffect parent_instance;
-
- ClutterShaderEffectPrivate *priv;
-};
-
-/**
- * ClutterShaderEffectClass:
- * @get_static_shader_source: Returns the GLSL source code to use for
- * instances of this shader effect. Note that this function is only
- * called once per subclass of #ClutterShaderEffect regardless of how
- * many instances are used. It is expected that subclasses will return
- * a copy of a static string from this function.
- *
- * The #ClutterShaderEffectClass structure contains
- * only private data
- *
- * Since: 1.4
- */
-struct _ClutterShaderEffectClass
-{
- /*< private >*/
- ClutterOffscreenEffectClass parent_class;
-
- /*< public >*/
- gchar * (* get_static_shader_source) (ClutterShaderEffect *effect);
-
- /*< private >*/
- /* padding */
- void (*_clutter_shader1) (void);
- void (*_clutter_shader2) (void);
- void (*_clutter_shader3) (void);
- void (*_clutter_shader4) (void);
- void (*_clutter_shader5) (void);
-};
-
-CLUTTER_EXPORT
-GType clutter_shader_effect_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterEffect * clutter_shader_effect_new (ClutterShaderType shader_type);
-
-CLUTTER_EXPORT
-gboolean clutter_shader_effect_set_shader_source (ClutterShaderEffect *effect,
- const gchar *source);
-
-CLUTTER_EXPORT
-void clutter_shader_effect_set_uniform (ClutterShaderEffect *effect,
- const gchar *name,
- GType gtype,
- gsize n_values,
- ...);
-CLUTTER_EXPORT
-void clutter_shader_effect_set_uniform_value (ClutterShaderEffect *effect,
- const gchar *name,
- const GValue *value);
-
-CLUTTER_EXPORT
-CoglHandle clutter_shader_effect_get_shader (ClutterShaderEffect *effect);
-CLUTTER_EXPORT
-CoglHandle clutter_shader_effect_get_program (ClutterShaderEffect *effect);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_SHADER_EFFECT_H__ */
diff --git a/clutter/clutter/clutter-shader-types.c b/clutter/clutter/clutter-shader-types.c
deleted file mode 100644
index cdd78003d..000000000
--- a/clutter/clutter/clutter-shader-types.c
+++ /dev/null
@@ -1,567 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- * Chris Lord <chris@openedhand.com>
- *
- * Copyright (C) 2008 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- *
- */
-
-#include "clutter-build-config.h"
-
-#include <glib-object.h>
-#include <gobject/gvaluecollector.h>
-
-#include "clutter-shader-types.h"
-#include "clutter-private.h"
-
-static GTypeInfo shader_float_info = {
- 0,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- 0,
- 0,
- NULL,
- NULL,
-};
-
-static GTypeFundamentalInfo shader_float_finfo = { 0, };
-
-static GTypeInfo shader_int_info = {
- 0,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- 0,
- 0,
- NULL,
- NULL,
-};
-
-static GTypeFundamentalInfo shader_int_finfo = { 0, };
-
-static GTypeInfo shader_matrix_info = {
- 0,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- 0,
- 0,
- NULL,
- NULL,
-};
-
-static GTypeFundamentalInfo shader_matrix_finfo = { 0, };
-
-struct _ClutterShaderFloat
-{
- gint size;
- float value[4];
-};
-
-struct _ClutterShaderInt
-{
- gint size;
- int value[4];
-};
-
-struct _ClutterShaderMatrix
-{
- gint size;
- float value[16];
-};
-
-static gpointer
-clutter_value_peek_pointer (const GValue *value)
-{
- return value->data[0].v_pointer;
-}
-
-/* Float */
-
-static void
-clutter_value_init_shader_float (GValue *value)
-{
- value->data[0].v_pointer = g_new0 (ClutterShaderFloat, 1);
-}
-
-static void
-clutter_value_free_shader_float (GValue *value)
-{
- g_free (value->data[0].v_pointer);
-}
-
-static void
-clutter_value_copy_shader_float (const GValue *src,
- GValue *dest)
-{
- dest->data[0].v_pointer =
- g_memdup2 (src->data[0].v_pointer, sizeof (ClutterShaderFloat));
-}
-
-static gchar *
-clutter_value_collect_shader_float (GValue *value,
- guint n_collect_values,
- GTypeCValue *collect_values,
- guint collect_flags)
-{
- gint float_count = collect_values[0].v_int;
- const float *floats = collect_values[1].v_pointer;
-
- if (!floats)
- return g_strdup_printf ("value location for '%s' passed as NULL",
- G_VALUE_TYPE_NAME (value));
-
- clutter_value_init_shader_float (value);
- clutter_value_set_shader_float (value, float_count, floats);
-
- return NULL;
-}
-
-static gchar *
-clutter_value_lcopy_shader_float (const GValue *value,
- guint n_collect_values,
- GTypeCValue *collect_values,
- guint collect_flags)
-{
- gint *float_count = collect_values[0].v_pointer;
- float **floats = collect_values[1].v_pointer;
- ClutterShaderFloat *shader_float = value->data[0].v_pointer;
-
- if (!float_count || !floats)
- return g_strdup_printf ("value location for '%s' passed as NULL",
- G_VALUE_TYPE_NAME (value));
-
- *float_count = shader_float->size;
- *floats = g_memdup2 (shader_float->value,
- shader_float->size * sizeof (float));
-
- return NULL;
-}
-
-static const GTypeValueTable _clutter_shader_float_value_table = {
- clutter_value_init_shader_float,
- clutter_value_free_shader_float,
- clutter_value_copy_shader_float,
- clutter_value_peek_pointer,
- "ip",
- clutter_value_collect_shader_float,
- "pp",
- clutter_value_lcopy_shader_float
-};
-
-GType
-clutter_shader_float_get_type (void)
-{
- static GType _clutter_shader_float_type = 0;
-
- if (G_UNLIKELY (_clutter_shader_float_type == 0))
- {
- shader_float_info.value_table = & _clutter_shader_float_value_table;
- _clutter_shader_float_type =
- g_type_register_fundamental (g_type_fundamental_next (),
- I_("ClutterShaderFloat"),
- &shader_float_info,
- &shader_float_finfo, 0);
- }
-
- return _clutter_shader_float_type;
-}
-
-
-/* Integer */
-
-static void
-clutter_value_init_shader_int (GValue *value)
-{
- value->data[0].v_pointer = g_new0 (ClutterShaderInt, 1);
-}
-
-static void
-clutter_value_free_shader_int (GValue *value)
-{
- g_free (value->data[0].v_pointer);
-}
-
-static void
-clutter_value_copy_shader_int (const GValue *src,
- GValue *dest)
-{
- dest->data[0].v_pointer =
- g_memdup2 (src->data[0].v_pointer, sizeof (ClutterShaderInt));
-}
-
-static gchar *
-clutter_value_collect_shader_int (GValue *value,
- guint n_collect_values,
- GTypeCValue *collect_values,
- guint collect_flags)
-{
- gint int_count = collect_values[0].v_int;
- const int *ints = collect_values[1].v_pointer;
-
- if (!ints)
- return g_strdup_printf ("value location for '%s' passed as NULL",
- G_VALUE_TYPE_NAME (value));
-
- clutter_value_init_shader_int (value);
- clutter_value_set_shader_int (value, int_count, ints);
-
- return NULL;
-}
-
-static gchar *
-clutter_value_lcopy_shader_int (const GValue *value,
- guint n_collect_values,
- GTypeCValue *collect_values,
- guint collect_flags)
-{
- gint *int_count = collect_values[0].v_pointer;
- int **ints = collect_values[1].v_pointer;
- ClutterShaderInt *shader_int = value->data[0].v_pointer;
-
- if (!int_count || !ints)
- return g_strdup_printf ("value location for '%s' passed as NULL",
- G_VALUE_TYPE_NAME (value));
-
- *int_count = shader_int->size;
- *ints = g_memdup2 (shader_int->value, shader_int->size * sizeof (int));
-
- return NULL;
-}
-
-static const GTypeValueTable _clutter_shader_int_value_table = {
- clutter_value_init_shader_int,
- clutter_value_free_shader_int,
- clutter_value_copy_shader_int,
- clutter_value_peek_pointer,
- "ip",
- clutter_value_collect_shader_int,
- "pp",
- clutter_value_lcopy_shader_int
-};
-
-GType
-clutter_shader_int_get_type (void)
-{
- static GType _clutter_shader_int_type = 0;
-
- if (G_UNLIKELY (_clutter_shader_int_type == 0))
- {
- shader_int_info.value_table = & _clutter_shader_int_value_table;
- _clutter_shader_int_type =
- g_type_register_fundamental (g_type_fundamental_next (),
- I_("ClutterShaderInt"),
- &shader_int_info,
- &shader_int_finfo, 0);
- }
-
- return _clutter_shader_int_type;
-}
-
-
-/* Matrix */
-
-static void
-clutter_value_init_shader_matrix (GValue *value)
-{
- value->data[0].v_pointer = g_new0 (ClutterShaderMatrix, 1);
-}
-
-static void
-clutter_value_free_shader_matrix (GValue *value)
-{
- g_free (value->data[0].v_pointer);
-}
-
-static void
-clutter_value_copy_shader_matrix (const GValue *src,
- GValue *dest)
-{
- dest->data[0].v_pointer =
- g_memdup2 (src->data[0].v_pointer, sizeof (ClutterShaderMatrix));
-}
-
-static gchar *
-clutter_value_collect_shader_matrix (GValue *value,
- guint n_collect_values,
- GTypeCValue *collect_values,
- guint collect_flags)
-{
- gint float_count = collect_values[0].v_int;
- const float *floats = collect_values[1].v_pointer;
-
- if (!floats)
- return g_strdup_printf ("value location for '%s' passed as NULL",
- G_VALUE_TYPE_NAME (value));
-
- clutter_value_init_shader_matrix (value);
- clutter_value_set_shader_matrix (value, float_count, floats);
-
- return NULL;
-}
-
-static gchar *
-clutter_value_lcopy_shader_matrix (const GValue *value,
- guint n_collect_values,
- GTypeCValue *collect_values,
- guint collect_flags)
-{
- gint *float_count = collect_values[0].v_pointer;
- float **floats = collect_values[1].v_pointer;
- ClutterShaderFloat *shader_float = value->data[0].v_pointer;
-
- if (!float_count || !floats)
- return g_strdup_printf ("value location for '%s' passed as NULL",
- G_VALUE_TYPE_NAME (value));
-
- *float_count = shader_float->size;
- *floats = g_memdup2 (shader_float->value,
- shader_float->size *
- shader_float->size *
- sizeof (float));
-
- return NULL;
-}
-
-static const GTypeValueTable _clutter_shader_matrix_value_table = {
- clutter_value_init_shader_matrix,
- clutter_value_free_shader_matrix,
- clutter_value_copy_shader_matrix,
- clutter_value_peek_pointer,
- "ip",
- clutter_value_collect_shader_matrix,
- "pp",
- clutter_value_lcopy_shader_matrix
-};
-
-GType
-clutter_shader_matrix_get_type (void)
-{
- static GType _clutter_shader_matrix_type = 0;
-
- if (G_UNLIKELY (_clutter_shader_matrix_type == 0))
- {
- shader_matrix_info.value_table = & _clutter_shader_matrix_value_table;
- _clutter_shader_matrix_type =
- g_type_register_fundamental (g_type_fundamental_next (),
- I_("ClutterShaderMatrix"),
- &shader_matrix_info,
- &shader_matrix_finfo, 0);
- }
-
- return _clutter_shader_matrix_type;
-}
-
-
-/* Utility functions */
-
-/**
- * clutter_value_set_shader_float:
- * @value: a #GValue
- * @size: number of floating point values in @floats
- * @floats: (array length=size): an array of floating point values
- *
- * Sets @floats as the contents of @value. The passed #GValue
- * must have been initialized using %CLUTTER_TYPE_SHADER_FLOAT.
- *
- * Since: 0.8
- */
-void
-clutter_value_set_shader_float (GValue *value,
- gint size,
- const gfloat *floats)
-{
- ClutterShaderFloat *shader_float;
- gint i;
-
- g_return_if_fail (CLUTTER_VALUE_HOLDS_SHADER_FLOAT (value));
- g_return_if_fail (size <= 4);
-
- shader_float = value->data[0].v_pointer;
-
- shader_float->size = size;
-
- for (i = 0; i < size; i++)
- shader_float->value[i] = floats[i];
-}
-
-/**
- * clutter_value_set_shader_int:
- * @value: a #GValue
- * @size: number of integer values in @ints
- * @ints: (array length=size): an array of integer values
- *
- * Sets @ints as the contents of @value. The passed #GValue
- * must have been initialized using %CLUTTER_TYPE_SHADER_INT.
- *
- * Since: 0.8
- */
-void
-clutter_value_set_shader_int (GValue *value,
- gint size,
- const gint *ints)
-{
- ClutterShaderInt *shader_int;
- gint i;
-
- g_return_if_fail (CLUTTER_VALUE_HOLDS_SHADER_INT (value));
- g_return_if_fail (size <= 4);
-
- shader_int = value->data[0].v_pointer;
-
- shader_int->size = size;
-
- for (i = 0; i < size; i++)
- shader_int->value[i] = ints[i];
-}
-
-/**
- * clutter_value_set_shader_matrix:
- * @value: a #GValue
- * @size: number of floating point values in @floats
- * @matrix: (array length=size): a matrix of floating point values
- *
- * Sets @matrix as the contents of @value. The passed #GValue
- * must have been initialized using %CLUTTER_TYPE_SHADER_MATRIX.
- *
- * Since: 0.8
- */
-void
-clutter_value_set_shader_matrix (GValue *value,
- gint size,
- const gfloat *matrix)
-{
- ClutterShaderMatrix *shader_matrix;
- gint i;
-
- g_return_if_fail (CLUTTER_VALUE_HOLDS_SHADER_MATRIX (value));
- g_return_if_fail (size <= 4);
-
- shader_matrix = value->data[0].v_pointer;
-
- shader_matrix->size = size;
-
- for (i = 0; i < size * size; i++)
- shader_matrix->value[i] = matrix[i];
-}
-
-/**
- * clutter_value_get_shader_float:
- * @value: a #GValue
- * @length: (out): return location for the number of returned floating
- * point values, or %NULL
- *
- * Retrieves the list of floating point values stored inside
- * the passed #GValue. @value must have been initialized with
- * %CLUTTER_TYPE_SHADER_FLOAT.
- *
- * Return value: (array length=length): the pointer to a list of
- * floating point values. The returned value is owned by the
- * #GValue and should never be modified or freed.
- *
- * Since: 0.8
- */
-const gfloat *
-clutter_value_get_shader_float (const GValue *value,
- gsize *length)
-{
- ClutterShaderFloat *shader_float;
-
- g_return_val_if_fail (CLUTTER_VALUE_HOLDS_SHADER_FLOAT (value), NULL);
-
- shader_float = value->data[0].v_pointer;
-
- if (length)
- *length = shader_float->size;
-
- return shader_float->value;
-}
-
-/**
- * clutter_value_get_shader_int:
- * @value: a #GValue
- * @length: (out): return location for the number of returned integer
- * values, or %NULL
- *
- * Retrieves the list of integer values stored inside the passed
- * #GValue. @value must have been initialized with
- * %CLUTTER_TYPE_SHADER_INT.
- *
- * Return value: (array length=length): the pointer to a list of
- * integer values. The returned value is owned by the #GValue and
- * should never be modified or freed.
- *
- * Since: 0.8
- */
-const gint *
-clutter_value_get_shader_int (const GValue *value,
- gsize *length)
-{
- ClutterShaderInt *shader_int;
-
- g_return_val_if_fail (CLUTTER_VALUE_HOLDS_SHADER_INT (value), NULL);
-
- shader_int = value->data[0].v_pointer;
-
- if (length)
- *length = shader_int->size;
-
- return shader_int->value;
-}
-
-/**
- * clutter_value_get_shader_matrix:
- * @value: a #GValue
- * @length: (out): return location for the number of returned floating
- * point values, or %NULL
- *
- * Retrieves a matrix of floating point values stored inside
- * the passed #GValue. @value must have been initialized with
- * %CLUTTER_TYPE_SHADER_MATRIX.
- *
- * Return value: (array length=length) (transfer none): the pointer to a matrix
- * of floating point values. The returned value is owned by the #GValue and
- * should never be modified or freed.
- *
- * Since: 0.8
- */
-const gfloat *
-clutter_value_get_shader_matrix (const GValue *value,
- gsize *length)
-{
- ClutterShaderMatrix *shader_matrix;
-
- g_return_val_if_fail (CLUTTER_VALUE_HOLDS_SHADER_MATRIX (value), NULL);
-
- shader_matrix = value->data[0].v_pointer;
-
- if (length)
- *length = shader_matrix->size;
-
- return shader_matrix->value;
-}
diff --git a/clutter/clutter/clutter-shader-types.h b/clutter/clutter/clutter-shader-types.h
deleted file mode 100644
index 629cf515a..000000000
--- a/clutter/clutter/clutter-shader-types.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- *
- * Copyright (C) 2008 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __CLUTTER_SHADER_TYPES_H__
-#define __CLUTTER_SHADER_TYPES_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-types.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_SHADER_FLOAT (clutter_shader_float_get_type ())
-#define CLUTTER_TYPE_SHADER_INT (clutter_shader_int_get_type ())
-#define CLUTTER_TYPE_SHADER_MATRIX (clutter_shader_matrix_get_type ())
-
-typedef struct _ClutterShaderFloat ClutterShaderFloat;
-typedef struct _ClutterShaderInt ClutterShaderInt;
-typedef struct _ClutterShaderMatrix ClutterShaderMatrix;
-
-/**
- * CLUTTER_VALUE_HOLDS_SHADER_FLOAT:
- * @x: a #GValue
- *
- * Evaluates to %TRUE if @x holds a #ClutterShaderFloat.
- *
- * Since: 1.0
- */
-#define CLUTTER_VALUE_HOLDS_SHADER_FLOAT(x) (G_VALUE_HOLDS ((x), CLUTTER_TYPE_SHADER_FLOAT))
-
-/**
- * CLUTTER_VALUE_HOLDS_SHADER_INT:
- * @x: a #GValue
- *
- * Evaluates to %TRUE if @x holds a #ClutterShaderInt.
- *
- * Since: 1.0
- */
-#define CLUTTER_VALUE_HOLDS_SHADER_INT(x) (G_VALUE_HOLDS ((x), CLUTTER_TYPE_SHADER_INT))
-
-/**
- * CLUTTER_VALUE_HOLDS_SHADER_MATRIX:
- * @x: a #GValue
- *
- * Evaluates to %TRUE if @x holds a #ClutterShaderMatrix.
- *
- * Since: 1.0
- */
-#define CLUTTER_VALUE_HOLDS_SHADER_MATRIX(x) (G_VALUE_HOLDS ((x), CLUTTER_TYPE_SHADER_MATRIX))
-
-CLUTTER_EXPORT
-GType clutter_shader_float_get_type (void) G_GNUC_CONST;
-CLUTTER_EXPORT
-GType clutter_shader_int_get_type (void) G_GNUC_CONST;
-CLUTTER_EXPORT
-GType clutter_shader_matrix_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-void clutter_value_set_shader_float (GValue *value,
- gint size,
- const gfloat *floats);
-CLUTTER_EXPORT
-void clutter_value_set_shader_int (GValue *value,
- gint size,
- const gint *ints);
-CLUTTER_EXPORT
-void clutter_value_set_shader_matrix (GValue *value,
- gint size,
- const gfloat *matrix);
-CLUTTER_EXPORT
-const gfloat * clutter_value_get_shader_float (const GValue *value,
- gsize *length);
-CLUTTER_EXPORT
-const gint * clutter_value_get_shader_int (const GValue *value,
- gsize *length);
-CLUTTER_EXPORT
-const gfloat * clutter_value_get_shader_matrix (const GValue *value,
- gsize *length);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_SHADER_TYPES_H__ */
diff --git a/clutter/clutter/clutter-snap-constraint.c b/clutter/clutter/clutter-snap-constraint.c
deleted file mode 100644
index 5d526aab3..000000000
--- a/clutter/clutter/clutter-snap-constraint.c
+++ /dev/null
@@ -1,602 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-snap-constraint
- * @Title: ClutterSnapConstraint
- * @Short_Description: A constraint snapping two actors together
- *
- * #ClutterSnapConstraint is a constraint the snaps the edges of two
- * actors together, expanding the actor's allocation if necessary.
- *
- * An offset can be applied to the constraint, to provide spacing.
- *
- * #ClutterSnapConstraint is available since Clutter 1.6
- */
-
-#include "clutter-build-config.h"
-
-#include <math.h>
-
-#include "clutter-snap-constraint.h"
-
-#include "clutter-actor-private.h"
-#include "clutter-constraint.h"
-#include "clutter-debug.h"
-#include "clutter-enum-types.h"
-#include "clutter-private.h"
-
-#define CLUTTER_SNAP_CONSTRAINT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_SNAP_CONSTRAINT, ClutterSnapConstraintClass))
-#define CLUTTER_IS_SNAP_CONSTRAINT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_SNAP_CONSTRAINT))
-#define CLUTTER_SNAP_CONSTRAINT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_SNAP_CONSTRAINT, ClutterSnapConstraintClass))
-
-struct _ClutterSnapConstraint
-{
- ClutterConstraint parent_instance;
-
- ClutterActor *actor;
- ClutterActor *source;
-
- ClutterSnapEdge from_edge;
- ClutterSnapEdge to_edge;
-
- gfloat offset;
-};
-
-struct _ClutterSnapConstraintClass
-{
- ClutterConstraintClass parent_class;
-};
-
-enum
-{
- PROP_0,
-
- PROP_SOURCE,
- PROP_FROM_EDGE,
- PROP_TO_EDGE,
- PROP_OFFSET,
-
- PROP_LAST
-};
-
-G_DEFINE_TYPE (ClutterSnapConstraint,
- clutter_snap_constraint,
- CLUTTER_TYPE_CONSTRAINT);
-
-static GParamSpec *obj_props[PROP_LAST] = { NULL, };
-
-static void
-source_queue_relayout (ClutterActor *source,
- ClutterSnapConstraint *constraint)
-{
- if (constraint->actor != NULL)
- _clutter_actor_queue_only_relayout (constraint->actor);
-}
-
-static void
-source_destroyed (ClutterActor *actor,
- ClutterSnapConstraint *constraint)
-{
- constraint->source = NULL;
-}
-
-static inline void
-warn_horizontal_edge (const gchar *edge,
- ClutterActor *actor,
- ClutterActor *source)
-{
- g_warning (G_STRLOC ": the %s edge of actor '%s' can only be snapped "
- "to either the right or the left edge of actor '%s'",
- edge,
- _clutter_actor_get_debug_name (actor),
- _clutter_actor_get_debug_name (source));
-}
-
-static inline void
-warn_vertical_edge (const gchar *edge,
- ClutterActor *actor,
- ClutterActor *source)
-{
- g_warning (G_STRLOC ": the %s edge of actor '%s' can only "
- "be snapped to the top or bottom edge of actor '%s'",
- edge,
- _clutter_actor_get_debug_name (actor),
- _clutter_actor_get_debug_name (source));
-}
-
-static void
-clutter_snap_constraint_update_allocation (ClutterConstraint *constraint,
- ClutterActor *actor,
- ClutterActorBox *allocation)
-{
- ClutterSnapConstraint *self = CLUTTER_SNAP_CONSTRAINT (constraint);
- gfloat source_width, source_height;
- gfloat source_x, source_y;
- gfloat actor_width, actor_height;
-
- if (self->source == NULL)
- return;
-
- clutter_actor_get_position (self->source, &source_x, &source_y);
- clutter_actor_get_size (self->source, &source_width, &source_height);
-
- clutter_actor_box_get_size (allocation, &actor_width, &actor_height);
-
- switch (self->to_edge)
- {
- case CLUTTER_SNAP_EDGE_LEFT:
- if (self->from_edge == CLUTTER_SNAP_EDGE_LEFT)
- allocation->x1 = source_x + self->offset;
- else if (self->from_edge == CLUTTER_SNAP_EDGE_RIGHT)
- allocation->x2 = source_x + self->offset;
- else
- warn_horizontal_edge ("left", self->actor, self->source);
- break;
-
- case CLUTTER_SNAP_EDGE_RIGHT:
- if (self->from_edge == CLUTTER_SNAP_EDGE_RIGHT)
- allocation->x2 = source_x + source_width + self->offset;
- else if (self->from_edge == CLUTTER_SNAP_EDGE_LEFT)
- allocation->x1 = source_x + source_width + self->offset;
- else
- warn_horizontal_edge ("right", self->actor, self->source);
- break;
-
- break;
-
- case CLUTTER_SNAP_EDGE_TOP:
- if (self->from_edge == CLUTTER_SNAP_EDGE_TOP)
- allocation->y1 = source_y + self->offset;
- else if (self->from_edge == CLUTTER_SNAP_EDGE_BOTTOM)
- allocation->y2 = source_y + self->offset;
- else
- warn_vertical_edge ("top", self->actor, self->source);
- break;
-
- case CLUTTER_SNAP_EDGE_BOTTOM:
- if (self->from_edge == CLUTTER_SNAP_EDGE_BOTTOM)
- allocation->y2 = source_y + source_height + self->offset;
- else if (self->from_edge == CLUTTER_SNAP_EDGE_TOP)
- allocation->y1 = source_y + source_height + self->offset;
- else
- warn_vertical_edge ("bottom", self->actor, self->source);
- break;
-
- default:
- g_assert_not_reached ();
- break;
- }
-
- if (allocation->x2 - allocation->x1 < 0)
- allocation->x2 = allocation->x1;
-
- if (allocation->y2 - allocation->y1 < 0)
- allocation->y2 = allocation->y1;
-}
-
-static void
-clutter_snap_constraint_set_actor (ClutterActorMeta *meta,
- ClutterActor *new_actor)
-{
- ClutterSnapConstraint *self = CLUTTER_SNAP_CONSTRAINT (meta);
- ClutterActorMetaClass *parent;
-
- /* store the pointer to the actor, for later use */
- self->actor = new_actor;
-
- parent = CLUTTER_ACTOR_META_CLASS (clutter_snap_constraint_parent_class);
- parent->set_actor (meta, new_actor);
-}
-
-static void
-clutter_snap_constraint_dispose (GObject *gobject)
-{
- ClutterSnapConstraint *snap = CLUTTER_SNAP_CONSTRAINT (gobject);
-
- if (snap->source != NULL)
- {
- g_signal_handlers_disconnect_by_func (snap->source,
- G_CALLBACK (source_destroyed),
- snap);
- g_signal_handlers_disconnect_by_func (snap->source,
- G_CALLBACK (source_queue_relayout),
- snap);
- snap->source = NULL;
- }
-
- G_OBJECT_CLASS (clutter_snap_constraint_parent_class)->dispose (gobject);
-}
-
-static void
-clutter_snap_constraint_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterSnapConstraint *self = CLUTTER_SNAP_CONSTRAINT (gobject);
-
- switch (prop_id)
- {
- case PROP_SOURCE:
- clutter_snap_constraint_set_source (self, g_value_get_object (value));
- break;
-
- case PROP_FROM_EDGE:
- clutter_snap_constraint_set_edges (self,
- g_value_get_enum (value),
- self->to_edge);
- break;
-
- case PROP_TO_EDGE:
- clutter_snap_constraint_set_edges (self,
- self->from_edge,
- g_value_get_enum (value));
- break;
-
- case PROP_OFFSET:
- clutter_snap_constraint_set_offset (self, g_value_get_float (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_snap_constraint_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterSnapConstraint *self = CLUTTER_SNAP_CONSTRAINT (gobject);
-
- switch (prop_id)
- {
- case PROP_SOURCE:
- g_value_set_object (value, self->source);
- break;
-
- case PROP_FROM_EDGE:
- g_value_set_enum (value, self->from_edge);
- break;
-
- case PROP_TO_EDGE:
- g_value_set_enum (value, self->to_edge);
- break;
-
- case PROP_OFFSET:
- g_value_set_float (value, self->offset);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_snap_constraint_class_init (ClutterSnapConstraintClass *klass)
-{
- ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
- ClutterConstraintClass *constraint_class = CLUTTER_CONSTRAINT_CLASS (klass);
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- meta_class->set_actor = clutter_snap_constraint_set_actor;
-
- constraint_class->update_allocation = clutter_snap_constraint_update_allocation;
- /**
- * ClutterSnapConstraint:source:
- *
- * The #ClutterActor used as the source for the constraint
- *
- * Since: 1.6
- */
- obj_props[PROP_SOURCE] =
- g_param_spec_object ("source",
- P_("Source"),
- P_("The source of the constraint"),
- CLUTTER_TYPE_ACTOR,
- CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);
-
- /**
- * ClutterSnapConstraint:from-edge:
- *
- * The edge of the #ClutterActor that should be snapped
- *
- * Since: 1.6
- */
- obj_props[PROP_FROM_EDGE] =
- g_param_spec_enum ("from-edge",
- P_("From Edge"),
- P_("The edge of the actor that should be snapped"),
- CLUTTER_TYPE_SNAP_EDGE,
- CLUTTER_SNAP_EDGE_RIGHT,
- CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);
-
- /**
- * ClutterSnapConstraint:to-edge:
- *
- * The edge of the #ClutterSnapConstraint:source that should be snapped
- *
- * Since: 1.6
- */
- obj_props[PROP_TO_EDGE] =
- g_param_spec_enum ("to-edge",
- P_("To Edge"),
- P_("The edge of the source that should be snapped"),
- CLUTTER_TYPE_SNAP_EDGE,
- CLUTTER_SNAP_EDGE_RIGHT,
- CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);
-
- /**
- * ClutterSnapConstraint:offset:
- *
- * The offset, in pixels, between #ClutterSnapConstraint:from-edge
- * and #ClutterSnapConstraint:to-edge
- *
- * Since: 1.6
- */
- obj_props[PROP_OFFSET] =
- g_param_spec_float ("offset",
- P_("Offset"),
- P_("The offset in pixels to apply to the constraint"),
- -G_MAXFLOAT, G_MAXFLOAT,
- 0.0f,
- CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);
-
- gobject_class->dispose = clutter_snap_constraint_dispose;
- gobject_class->set_property = clutter_snap_constraint_set_property;
- gobject_class->get_property = clutter_snap_constraint_get_property;
- g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
-}
-
-static void
-clutter_snap_constraint_init (ClutterSnapConstraint *self)
-{
- self->actor = NULL;
- self->source = NULL;
-
- self->from_edge = CLUTTER_SNAP_EDGE_RIGHT;
- self->to_edge = CLUTTER_SNAP_EDGE_RIGHT;
-
- self->offset = 0.0f;
-}
-
-/**
- * clutter_snap_constraint_new:
- * @source: (allow-none): the #ClutterActor to use as the source of
- * the constraint, or %NULL
- * @from_edge: the edge of the actor to use in the constraint
- * @to_edge: the edge of @source to use in the constraint
- * @offset: the offset to apply to the constraint, in pixels
- *
- * Creates a new #ClutterSnapConstraint that will snap a #ClutterActor
- * to the @edge of @source, with the given @offset.
- *
- * Return value: the newly created #ClutterSnapConstraint
- *
- * Since: 1.6
- */
-ClutterConstraint *
-clutter_snap_constraint_new (ClutterActor *source,
- ClutterSnapEdge from_edge,
- ClutterSnapEdge to_edge,
- gfloat offset)
-{
- g_return_val_if_fail (source == NULL || CLUTTER_IS_ACTOR (source), NULL);
-
- return g_object_new (CLUTTER_TYPE_SNAP_CONSTRAINT,
- "source", source,
- "from-edge", from_edge,
- "to-edge", to_edge,
- "offset", offset,
- NULL);
-}
-
-/**
- * clutter_snap_constraint_set_source:
- * @constraint: a #ClutterSnapConstraint
- * @source: (allow-none): a #ClutterActor, or %NULL to unset the source
- *
- * Sets the source #ClutterActor for the constraint
- *
- * Since: 1.6
- */
-void
-clutter_snap_constraint_set_source (ClutterSnapConstraint *constraint,
- ClutterActor *source)
-{
- ClutterActor *old_source;
-
- g_return_if_fail (CLUTTER_IS_SNAP_CONSTRAINT (constraint));
- g_return_if_fail (source == NULL || CLUTTER_IS_ACTOR (source));
-
- if (constraint->source == source)
- return;
-
- old_source = constraint->source;
- if (old_source != NULL)
- {
- g_signal_handlers_disconnect_by_func (old_source,
- G_CALLBACK (source_destroyed),
- constraint);
- g_signal_handlers_disconnect_by_func (old_source,
- G_CALLBACK (source_queue_relayout),
- constraint);
- }
-
- constraint->source = source;
- if (constraint->source != NULL)
- {
- g_signal_connect (constraint->source, "queue-relayout",
- G_CALLBACK (source_queue_relayout),
- constraint);
- g_signal_connect (constraint->source, "destroy",
- G_CALLBACK (source_destroyed),
- constraint);
-
- if (constraint->actor != NULL)
- clutter_actor_queue_relayout (constraint->actor);
- }
-
- g_object_notify_by_pspec (G_OBJECT (constraint), obj_props[PROP_SOURCE]);
-}
-
-/**
- * clutter_snap_constraint_get_source:
- * @constraint: a #ClutterSnapConstraint
- *
- * Retrieves the #ClutterActor set using clutter_snap_constraint_set_source()
- *
- * Return value: (transfer none): a pointer to the source actor
- *
- * Since: 1.6
- */
-ClutterActor *
-clutter_snap_constraint_get_source (ClutterSnapConstraint *constraint)
-{
- g_return_val_if_fail (CLUTTER_IS_SNAP_CONSTRAINT (constraint), NULL);
-
- return constraint->source;
-}
-
-/**
- * clutter_snap_constraint_set_edges:
- * @constraint: a #ClutterSnapConstraint
- * @from_edge: the edge on the actor
- * @to_edge: the edge on the source
- *
- * Sets the edges to be used by the @constraint
- *
- * The @from_edge is the edge on the #ClutterActor to which @constraint
- * has been added. The @to_edge is the edge of the #ClutterActor inside
- * the #ClutterSnapConstraint:source property.
- *
- * Since: 1.6
- */
-void
-clutter_snap_constraint_set_edges (ClutterSnapConstraint *constraint,
- ClutterSnapEdge from_edge,
- ClutterSnapEdge to_edge)
-{
- gboolean from_changed = FALSE, to_changed = FALSE;
-
- g_return_if_fail (CLUTTER_IS_SNAP_CONSTRAINT (constraint));
-
- g_object_freeze_notify (G_OBJECT (constraint));
-
- if (constraint->from_edge != from_edge)
- {
- constraint->from_edge = from_edge;
- g_object_notify_by_pspec (G_OBJECT (constraint),
- obj_props[PROP_FROM_EDGE]);
- from_changed = TRUE;
- }
-
- if (constraint->to_edge != to_edge)
- {
- constraint->to_edge = to_edge;
- g_object_notify_by_pspec (G_OBJECT (constraint),
- obj_props[PROP_TO_EDGE]);
- to_changed = TRUE;
- }
-
- if ((from_changed || to_changed) &&
- constraint->actor != NULL)
- {
- clutter_actor_queue_relayout (constraint->actor);
- }
-
- g_object_thaw_notify (G_OBJECT (constraint));
-}
-
-/**
- * clutter_snap_constraint_get_edges:
- * @constraint: a #ClutterSnapConstraint
- * @from_edge: (out): return location for the actor's edge, or %NULL
- * @to_edge: (out): return location for the source's edge, or %NULL
- *
- * Retrieves the edges used by the @constraint
- *
- * Since: 1.6
- */
-void
-clutter_snap_constraint_get_edges (ClutterSnapConstraint *constraint,
- ClutterSnapEdge *from_edge,
- ClutterSnapEdge *to_edge)
-{
- g_return_if_fail (CLUTTER_IS_SNAP_CONSTRAINT (constraint));
-
- if (from_edge)
- *from_edge = constraint->from_edge;
-
- if (to_edge)
- *to_edge = constraint->to_edge;
-}
-
-/**
- * clutter_snap_constraint_set_offset:
- * @constraint: a #ClutterSnapConstraint
- * @offset: the offset to apply, in pixels
- *
- * Sets the offset to be applied to the constraint
- *
- * Since: 1.6
- */
-void
-clutter_snap_constraint_set_offset (ClutterSnapConstraint *constraint,
- gfloat offset)
-{
- g_return_if_fail (CLUTTER_IS_SNAP_CONSTRAINT (constraint));
-
- if (fabs (constraint->offset - offset) < 0.00001f)
- return;
-
- constraint->offset = offset;
-
- if (constraint->actor != NULL)
- clutter_actor_queue_relayout (constraint->actor);
-
- g_object_notify_by_pspec (G_OBJECT (constraint), obj_props[PROP_OFFSET]);
-}
-
-/**
- * clutter_snap_constraint_get_offset:
- * @constraint: a #ClutterSnapConstraint
- *
- * Retrieves the offset set using clutter_snap_constraint_set_offset()
- *
- * Return value: the offset, in pixels
- *
- * Since: 1.6
- */
-gfloat
-clutter_snap_constraint_get_offset (ClutterSnapConstraint *constraint)
-{
- g_return_val_if_fail (CLUTTER_IS_SNAP_CONSTRAINT (constraint), 0.0);
-
- return constraint->offset;
-}
diff --git a/clutter/clutter/clutter-snap-constraint.h b/clutter/clutter/clutter-snap-constraint.h
deleted file mode 100644
index 4ee46d03d..000000000
--- a/clutter/clutter/clutter-snap-constraint.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_SNAP_CONSTRAINT_H__
-#define __CLUTTER_SNAP_CONSTRAINT_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-constraint.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_SNAP_CONSTRAINT (clutter_snap_constraint_get_type ())
-#define CLUTTER_SNAP_CONSTRAINT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_SNAP_CONSTRAINT, ClutterSnapConstraint))
-#define CLUTTER_IS_SNAP_CONSTRAINT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_SNAP_CONSTRAINT))
-
-/**
- * ClutterSnapConstraint:
- *
- * #ClutterSnapConstraint is an opaque structure
- * whose members cannot be directly accesses
- *
- * Since: 1.6
- */
-typedef struct _ClutterSnapConstraint ClutterSnapConstraint;
-typedef struct _ClutterSnapConstraintClass ClutterSnapConstraintClass;
-
-CLUTTER_EXPORT
-GType clutter_snap_constraint_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterConstraint * clutter_snap_constraint_new (ClutterActor *source,
- ClutterSnapEdge from_edge,
- ClutterSnapEdge to_edge,
- gfloat offset);
-
-CLUTTER_EXPORT
-void clutter_snap_constraint_set_source (ClutterSnapConstraint *constraint,
- ClutterActor *source);
-CLUTTER_EXPORT
-ClutterActor * clutter_snap_constraint_get_source (ClutterSnapConstraint *constraint);
-CLUTTER_EXPORT
-void clutter_snap_constraint_set_edges (ClutterSnapConstraint *constraint,
- ClutterSnapEdge from_edge,
- ClutterSnapEdge to_edge);
-CLUTTER_EXPORT
-void clutter_snap_constraint_get_edges (ClutterSnapConstraint *constraint,
- ClutterSnapEdge *from_edge,
- ClutterSnapEdge *to_edge);
-CLUTTER_EXPORT
-void clutter_snap_constraint_set_offset (ClutterSnapConstraint *constraint,
- gfloat offset);
-CLUTTER_EXPORT
-gfloat clutter_snap_constraint_get_offset (ClutterSnapConstraint *constraint);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_SNAP_CONSTRAINT_H__ */
diff --git a/clutter/clutter/clutter-stage-manager-private.h b/clutter/clutter/clutter-stage-manager-private.h
deleted file mode 100644
index 81ebbb6c0..000000000
--- a/clutter/clutter/clutter-stage-manager-private.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_STAGE_MANAGER_PRIVATE_H__
-#define __CLUTTER_STAGE_MANAGER_PRIVATE_H__
-
-#include <clutter/clutter-stage-manager.h>
-
-G_BEGIN_DECLS
-
-struct _ClutterStageManager
-{
- GObject parent_instance;
-
- GSList *stages;
-};
-
-/* stage manager */
-void _clutter_stage_manager_add_stage (ClutterStageManager *stage_manager,
- ClutterStage *stage);
-void _clutter_stage_manager_remove_stage (ClutterStageManager *stage_manager,
- ClutterStage *stage);
-void _clutter_stage_manager_set_default_stage (ClutterStageManager *stage_manager,
- ClutterStage *stage);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_STAGE_MANAGER_PRIVATE_H__ */
diff --git a/clutter/clutter/clutter-stage-manager.c b/clutter/clutter/clutter-stage-manager.c
deleted file mode 100644
index 0132e1983..000000000
--- a/clutter/clutter/clutter-stage-manager.c
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2008 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author: Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-stage-manager
- * @short_description: Maintains the list of stages
- *
- * #ClutterStageManager is a singleton object, owned by Clutter, which
- * maintains the list of currently active stages
- *
- * Every newly-created #ClutterStage will cause the emission of the
- * #ClutterStageManager::stage-added signal; once a #ClutterStage has
- * been destroyed, the #ClutterStageManager::stage-removed signal will
- * be emitted
- *
- * #ClutterStageManager is available since Clutter 0.8
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-stage-manager-private.h"
-
-#include "clutter-marshal.h"
-#include "clutter-debug.h"
-#include "clutter-private.h"
-
-enum
-{
- PROP_0,
- PROP_DEFAULT_STAGE
-};
-
-enum
-{
- STAGE_ADDED,
- STAGE_REMOVED,
-
- LAST_SIGNAL
-};
-
-static guint manager_signals[LAST_SIGNAL] = { 0, };
-static ClutterStage *default_stage = NULL;
-
-G_DEFINE_TYPE (ClutterStageManager, clutter_stage_manager, G_TYPE_OBJECT);
-
-static void
-clutter_stage_manager_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- switch (prop_id)
- {
- case PROP_DEFAULT_STAGE:
- g_value_set_object (value, default_stage);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_stage_manager_dispose (GObject *gobject)
-{
- ClutterStageManager *stage_manager;
-
- stage_manager = CLUTTER_STAGE_MANAGER (gobject);
-
- g_slist_free_full (stage_manager->stages,
- (GDestroyNotify) clutter_actor_destroy);
- stage_manager->stages = NULL;
-
- G_OBJECT_CLASS (clutter_stage_manager_parent_class)->dispose (gobject);
-}
-
-static void
-clutter_stage_manager_class_init (ClutterStageManagerClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- gobject_class->dispose = clutter_stage_manager_dispose;
- gobject_class->get_property = clutter_stage_manager_get_property;
-
- /**
- * ClutterStageManager:default-stage:
- *
- * The default stage used by Clutter.
- *
- * Since: 0.8
- */
- g_object_class_install_property (gobject_class,
- PROP_DEFAULT_STAGE,
- g_param_spec_object ("default-stage",
- "Default Stage",
- "The default stage",
- CLUTTER_TYPE_STAGE,
- CLUTTER_PARAM_READABLE));
-
- /**
- * ClutterStageManager::stage-added:
- * @stage_manager: the object which received the signal
- * @stage: the added stage
- *
- * The ::stage-added signal is emitted each time a new #ClutterStage
- * has been added to the stage manager.
- *
- * Since: 0.8
- */
- manager_signals[STAGE_ADDED] =
- g_signal_new ("stage-added",
- G_OBJECT_CLASS_TYPE (gobject_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterStageManagerClass, stage_added),
- NULL, NULL, NULL,
- G_TYPE_NONE, 1,
- CLUTTER_TYPE_STAGE);
- /**
- * ClutterStageManager::stage-removed:
- * @stage_manager: the object which received the signal
- * @stage: the removed stage
- *
- * The ::stage-removed signal is emitted each time a #ClutterStage
- * has been removed from the stage manager.
- *
- * Since: 0.8
- */
- manager_signals[STAGE_REMOVED] =
- g_signal_new ("stage-removed",
- G_OBJECT_CLASS_TYPE (gobject_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterStageManagerClass, stage_removed),
- NULL, NULL, NULL,
- G_TYPE_NONE, 1,
- CLUTTER_TYPE_STAGE);
-}
-
-static void
-clutter_stage_manager_init (ClutterStageManager *stage_manager)
-{
-}
-
-/**
- * clutter_stage_manager_get_default:
- *
- * Returns the default #ClutterStageManager.
- *
- * Return value: (transfer none): the default stage manager instance. The returned
- * object is owned by Clutter and you should not reference or unreference it.
- *
- * Since: 0.8
- */
-ClutterStageManager *
-clutter_stage_manager_get_default (void)
-{
- ClutterMainContext *context = _clutter_context_get_default ();
-
- if (G_UNLIKELY (context->stage_manager == NULL))
- context->stage_manager = g_object_new (CLUTTER_TYPE_STAGE_MANAGER, NULL);
-
- return context->stage_manager;
-}
-
-/*< private >
- * _clutter_stage_manager_set_default_stage:
- * @stage_manager: a #ClutterStageManager
- * @stage: a #ClutterStage
- *
- * Sets @stage as the default stage
- *
- * A no-op if there already is a default stage
- */
-void
-_clutter_stage_manager_set_default_stage (ClutterStageManager *stage_manager,
- ClutterStage *stage)
-{
- if (G_UNLIKELY (default_stage == NULL))
- {
- default_stage = stage;
-
- /* the default stage is immediately realized */
- clutter_actor_realize (CLUTTER_ACTOR (stage));
-
- g_object_notify (G_OBJECT (stage_manager), "default-stage");
- }
-}
-
-/**
- * clutter_stage_manager_get_default_stage:
- * @stage_manager: a #ClutterStageManager
- *
- * Returns the default #ClutterStage.
- *
- * Return value: (transfer none): the default stage. The returned object
- * is owned by Clutter and you should never reference or unreference it
- *
- * Since: 0.8
- */
-ClutterStage *
-clutter_stage_manager_get_default_stage (ClutterStageManager *stage_manager)
-{
- return default_stage;
-}
-
-/**
- * clutter_stage_manager_list_stages:
- * @stage_manager: a #ClutterStageManager
- *
- * Lists all currently used stages.
- *
- * Return value: (transfer container) (element-type Clutter.Stage): a newly
- * allocated list of #ClutterStage objects. Use g_slist_free() to
- * deallocate it when done.
- *
- * Since: 0.8
- */
-GSList *
-clutter_stage_manager_list_stages (ClutterStageManager *stage_manager)
-{
- return g_slist_copy (stage_manager->stages);
-}
-
-/**
- * clutter_stage_manager_peek_stages:
- * @stage_manager: a #ClutterStageManager
- *
- * Lists all currently used stages.
- *
- * Return value: (transfer none) (element-type Clutter.Stage): a pointer
- * to the internal list of #ClutterStage objects. The returned list
- * is owned by the #ClutterStageManager and should never be modified
- * or freed
- *
- * Since: 1.0
- */
-const GSList *
-clutter_stage_manager_peek_stages (ClutterStageManager *stage_manager)
-{
- return stage_manager->stages;
-}
-
-void
-_clutter_stage_manager_add_stage (ClutterStageManager *stage_manager,
- ClutterStage *stage)
-{
- if (g_slist_find (stage_manager->stages, stage))
- {
- g_warning ("Trying to add a stage to the list of managed stages, "
- "but it is already in it, aborting.");
- return;
- }
-
- g_object_ref_sink (stage);
-
- stage_manager->stages = g_slist_append (stage_manager->stages, stage);
-
- g_signal_emit (stage_manager, manager_signals[STAGE_ADDED], 0, stage);
-}
-
-void
-_clutter_stage_manager_remove_stage (ClutterStageManager *stage_manager,
- ClutterStage *stage)
-{
- /* this might be called multiple times from a ::dispose, so it
- * needs to just return without warning
- */
- if (!g_slist_find (stage_manager->stages, stage))
- return;
-
- stage_manager->stages = g_slist_remove (stage_manager->stages, stage);
-
- /* if the default stage is being destroyed then we unset the pointer */
- if (default_stage == stage)
- default_stage = NULL;
-
- g_signal_emit (stage_manager, manager_signals[STAGE_REMOVED], 0, stage);
-
- g_object_unref (stage);
-}
diff --git a/clutter/clutter/clutter-stage-manager.h b/clutter/clutter/clutter-stage-manager.h
deleted file mode 100644
index 27da12e2e..000000000
--- a/clutter/clutter/clutter-stage-manager.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2008 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author: Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_STAGE_MANAGER_H__
-#define __CLUTTER_STAGE_MANAGER_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-types.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_STAGE_MANAGER (clutter_stage_manager_get_type ())
-#define CLUTTER_STAGE_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_STAGE_MANAGER, ClutterStageManager))
-#define CLUTTER_IS_STAGE_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_STAGE_MANAGER))
-#define CLUTTER_STAGE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_STAGE_MANAGER, ClutterStageManagerClass))
-#define CLUTTER_IS_STAGE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_STAGE_MANAGER))
-#define CLUTTER_STAGE_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_STAGE_MANAGER, ClutterStageManagerClass))
-
-typedef struct _ClutterStageManager ClutterStageManager;
-typedef struct _ClutterStageManagerClass ClutterStageManagerClass;
-
-/**
- * ClutterStageManager:
- *
- * The #ClutterStageManager structure is private.
- *
- * Since: 1.0
- */
-
-/**
- * ClutterStageManagerClass:
- *
- * The #ClutterStageManagerClass structure contains only private data
- * and should be accessed using the provided API
- *
- * Since: 1.0
- */
-struct _ClutterStageManagerClass
-{
- /*< private >*/
- GObjectClass parent_class;
-
- void (* stage_added) (ClutterStageManager *stage_manager,
- ClutterStage *stage);
- void (* stage_removed) (ClutterStageManager *stage_manager,
- ClutterStage *stage);
-};
-
-CLUTTER_EXPORT
-GType clutter_stage_manager_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterStageManager *clutter_stage_manager_get_default (void);
-CLUTTER_EXPORT
-ClutterStage * clutter_stage_manager_get_default_stage (ClutterStageManager *stage_manager);
-CLUTTER_EXPORT
-GSList * clutter_stage_manager_list_stages (ClutterStageManager *stage_manager);
-CLUTTER_EXPORT
-const GSList * clutter_stage_manager_peek_stages (ClutterStageManager *stage_manager);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_STAGE_MANAGER_H__ */
diff --git a/clutter/clutter/clutter-stage-private.h b/clutter/clutter/clutter-stage-private.h
deleted file mode 100644
index 690a360fa..000000000
--- a/clutter/clutter/clutter-stage-private.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __CLUTTER_STAGE_PRIVATE_H__
-#define __CLUTTER_STAGE_PRIVATE_H__
-
-#include <clutter/clutter-stage-window.h>
-#include <clutter/clutter-stage.h>
-#include <clutter/clutter-input-device.h>
-#include <clutter/clutter-private.h>
-
-#include <cogl/cogl.h>
-
-G_BEGIN_DECLS
-
-/* stage */
-ClutterStageWindow *_clutter_stage_get_default_window (void);
-
-CLUTTER_EXPORT
-void clutter_stage_paint_view (ClutterStage *stage,
- ClutterStageView *view,
- const cairo_region_t *redraw_clip);
-
-void clutter_stage_emit_before_update (ClutterStage *stage,
- ClutterStageView *view);
-void clutter_stage_emit_before_paint (ClutterStage *stage,
- ClutterStageView *view);
-void clutter_stage_emit_after_paint (ClutterStage *stage,
- ClutterStageView *view);
-void clutter_stage_emit_after_update (ClutterStage *stage,
- ClutterStageView *view);
-
-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,
- graphene_matrix_t *projection);
-void _clutter_stage_dirty_projection (ClutterStage *stage);
-void _clutter_stage_get_viewport (ClutterStage *stage,
- float *x,
- float *y,
- float *width,
- float *height);
-void _clutter_stage_dirty_viewport (ClutterStage *stage);
-CLUTTER_EXPORT
-void _clutter_stage_maybe_setup_viewport (ClutterStage *stage,
- ClutterStageView *view);
-void clutter_stage_maybe_relayout (ClutterActor *stage);
-void clutter_stage_maybe_finish_queue_redraws (ClutterStage *stage);
-GSList * clutter_stage_find_updated_devices (ClutterStage *stage);
-void clutter_stage_update_devices (ClutterStage *stage,
- GSList *devices);
-void clutter_stage_finish_layout (ClutterStage *stage);
-
-CLUTTER_EXPORT
-void _clutter_stage_queue_event (ClutterStage *stage,
- ClutterEvent *event,
- gboolean copy_event);
-gboolean _clutter_stage_has_queued_events (ClutterStage *stage);
-void _clutter_stage_process_queued_events (ClutterStage *stage);
-void _clutter_stage_update_input_devices (ClutterStage *stage);
-gboolean _clutter_stage_has_full_redraw_queued (ClutterStage *stage);
-
-ClutterActor *_clutter_stage_do_pick (ClutterStage *stage,
- float x,
- float y,
- ClutterPickMode mode);
-
-ClutterPaintVolume *_clutter_stage_paint_volume_stack_allocate (ClutterStage *stage);
-void _clutter_stage_paint_volume_stack_free_all (ClutterStage *stage);
-
-void clutter_stage_queue_actor_redraw (ClutterStage *stage,
- ClutterActor *actor,
- const ClutterPaintVolume *clip);
-
-void clutter_stage_dequeue_actor_redraw (ClutterStage *stage,
- ClutterActor *actor);
-
-void _clutter_stage_add_pointer_drag_actor (ClutterStage *stage,
- ClutterInputDevice *device,
- ClutterActor *actor);
-ClutterActor * _clutter_stage_get_pointer_drag_actor (ClutterStage *stage,
- ClutterInputDevice *device);
-void _clutter_stage_remove_pointer_drag_actor (ClutterStage *stage,
- ClutterInputDevice *device);
-
-void _clutter_stage_add_touch_drag_actor (ClutterStage *stage,
- ClutterEventSequence *sequence,
- ClutterActor *actor);
-ClutterActor * _clutter_stage_get_touch_drag_actor (ClutterStage *stage,
- ClutterEventSequence *sequence);
-void _clutter_stage_remove_touch_drag_actor (ClutterStage *stage,
- ClutterEventSequence *sequence);
-
-void _clutter_stage_set_scale_factor (ClutterStage *stage,
- int factor);
-
-void clutter_stage_presented (ClutterStage *stage,
- ClutterStageView *view,
- ClutterFrameInfo *frame_info);
-
-void clutter_stage_queue_actor_relayout (ClutterStage *stage,
- ClutterActor *actor);
-
-void clutter_stage_dequeue_actor_relayout (ClutterStage *stage,
- ClutterActor *actor);
-
-GList * clutter_stage_get_views_for_rect (ClutterStage *stage,
- const graphene_rect_t *rect);
-
-void clutter_stage_set_actor_needs_immediate_relayout (ClutterStage *stage);
-
-void clutter_stage_update_device_entry (ClutterStage *self,
- ClutterInputDevice *device,
- ClutterEventSequence *sequence,
- graphene_point_t coords,
- ClutterActor *actor);
-
-void clutter_stage_remove_device_entry (ClutterStage *self,
- ClutterInputDevice *device,
- ClutterEventSequence *sequence);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_STAGE_PRIVATE_H__ */
diff --git a/clutter/clutter/clutter-stage-view-private.h b/clutter/clutter/clutter-stage-view-private.h
deleted file mode 100644
index 0a20d75b1..000000000
--- a/clutter/clutter/clutter-stage-view-private.h
+++ /dev/null
@@ -1,82 +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"
-#include "clutter/clutter-types.h"
-
-CLUTTER_EXPORT
-void clutter_stage_view_after_paint (ClutterStageView *view,
- cairo_region_t *redraw_clip);
-
-CLUTTER_EXPORT
-void clutter_stage_view_before_swap_buffer (ClutterStageView *view,
- const cairo_region_t *swap_region);
-
-gboolean clutter_stage_view_is_dirty_viewport (ClutterStageView *view);
-
-void clutter_stage_view_invalidate_viewport (ClutterStageView *view);
-
-void clutter_stage_view_set_viewport (ClutterStageView *view,
- float x,
- float y,
- float width,
- float height);
-
-gboolean clutter_stage_view_is_dirty_projection (ClutterStageView *view);
-
-void clutter_stage_view_invalidate_projection (ClutterStageView *view);
-
-void clutter_stage_view_set_projection (ClutterStageView *view,
- const graphene_matrix_t *matrix);
-
-CLUTTER_EXPORT
-void clutter_stage_view_add_redraw_clip (ClutterStageView *view,
- const cairo_rectangle_int_t *clip);
-
-gboolean clutter_stage_view_has_full_redraw_clip (ClutterStageView *view);
-
-gboolean clutter_stage_view_has_redraw_clip (ClutterStageView *view);
-
-const cairo_region_t * clutter_stage_view_peek_redraw_clip (ClutterStageView *view);
-
-CLUTTER_EXPORT
-cairo_region_t * clutter_stage_view_take_redraw_clip (ClutterStageView *view);
-
-CLUTTER_EXPORT
-CoglScanout * clutter_stage_view_take_scanout (ClutterStageView *view);
-
-CLUTTER_EXPORT
-void clutter_stage_view_transform_rect_to_onscreen (ClutterStageView *view,
- const cairo_rectangle_int_t *src_rect,
- int dst_width,
- int dst_height,
- cairo_rectangle_int_t *dst_rect);
-
-CLUTTER_EXPORT
-void clutter_stage_view_schedule_update (ClutterStageView *view);
-
-CLUTTER_EXPORT
-void clutter_stage_view_notify_presented (ClutterStageView *view,
- ClutterFrameInfo *frame_info);
-
-CLUTTER_EXPORT
-void clutter_stage_view_notify_ready (ClutterStageView *view);
-
-#endif /* __CLUTTER_STAGE_VIEW_PRIVATE_H__ */
diff --git a/clutter/clutter/clutter-stage-view.c b/clutter/clutter/clutter-stage-view.c
deleted file mode 100644
index 2b2cadd68..000000000
--- a/clutter/clutter/clutter-stage-view.c
+++ /dev/null
@@ -1,1522 +0,0 @@
-/*
- * Copyright (C) 2016 Red Hat Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter/clutter-stage-view.h"
-#include "clutter/clutter-stage-view-private.h"
-
-#include <cairo-gobject.h>
-#include <math.h>
-
-#include "clutter/clutter-damage-history.h"
-#include "clutter/clutter-frame-clock.h"
-#include "clutter/clutter-frame-private.h"
-#include "clutter/clutter-private.h"
-#include "clutter/clutter-mutter.h"
-#include "clutter/clutter-stage-private.h"
-#include "cogl/cogl.h"
-
-enum
-{
- PROP_0,
-
- PROP_NAME,
- PROP_STAGE,
- PROP_LAYOUT,
- PROP_FRAMEBUFFER,
- PROP_OFFSCREEN,
- PROP_USE_SHADOWFB,
- PROP_SCALE,
- PROP_REFRESH_RATE,
- PROP_VBLANK_DURATION_US,
-
- PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST];
-
-typedef struct _ClutterStageViewPrivate
-{
- char *name;
-
- ClutterStage *stage;
-
- cairo_rectangle_int_t layout;
- float scale;
- CoglFramebuffer *framebuffer;
-
- CoglOffscreen *offscreen;
- CoglPipeline *offscreen_pipeline;
-
- gboolean use_shadowfb;
- struct {
- struct {
- CoglDmaBufHandle *handles[2];
- int current_idx;
- ClutterDamageHistory *damage_history;
- } dma_buf;
-
- CoglOffscreen *framebuffer;
- } shadow;
-
- CoglScanout *next_scanout;
-
- gboolean has_redraw_clip;
- cairo_region_t *redraw_clip;
-
- float refresh_rate;
- int64_t vblank_duration_us;
- ClutterFrameClock *frame_clock;
-
- struct {
- int frame_count;
- int64_t last_print_time_us;
- int64_t cumulative_draw_time_us;
- int64_t began_draw_time_us;
- int64_t worst_draw_time_us;
- } frame_timings;
-
- guint dirty_viewport : 1;
- guint dirty_projection : 1;
-} ClutterStageViewPrivate;
-
-G_DEFINE_TYPE_WITH_PRIVATE (ClutterStageView, clutter_stage_view, G_TYPE_OBJECT)
-
-void
-clutter_stage_view_destroy (ClutterStageView *view)
-{
- g_object_run_dispose (G_OBJECT (view));
- g_object_unref (view);
-}
-
-void
-clutter_stage_view_get_layout (ClutterStageView *view,
- cairo_rectangle_int_t *rect)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (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)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- if (priv->offscreen)
- return COGL_FRAMEBUFFER (priv->offscreen);
- else if (priv->shadow.framebuffer)
- return COGL_FRAMEBUFFER (priv->shadow.framebuffer);
- else
- 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)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- return priv->framebuffer;
-}
-
-static CoglPipeline *
-clutter_stage_view_create_offscreen_pipeline (CoglOffscreen *offscreen)
-{
- CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (offscreen);
- CoglPipeline *pipeline;
-
- pipeline = cogl_pipeline_new (cogl_framebuffer_get_context (framebuffer));
-
- cogl_pipeline_set_layer_filters (pipeline, 0,
- COGL_PIPELINE_FILTER_NEAREST,
- COGL_PIPELINE_FILTER_NEAREST);
- cogl_pipeline_set_layer_texture (pipeline, 0,
- cogl_offscreen_get_texture (offscreen));
- cogl_pipeline_set_layer_wrap_mode (pipeline, 0,
- COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE);
-
- return pipeline;
-}
-
-static void
-clutter_stage_view_ensure_offscreen_blit_pipeline (ClutterStageView *view)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
- ClutterStageViewClass *view_class =
- CLUTTER_STAGE_VIEW_GET_CLASS (view);
-
- g_assert (priv->offscreen != NULL);
-
- if (priv->offscreen_pipeline)
- return;
-
- priv->offscreen_pipeline =
- clutter_stage_view_create_offscreen_pipeline (priv->offscreen);
-
- if (view_class->setup_offscreen_blit_pipeline)
- view_class->setup_offscreen_blit_pipeline (view, priv->offscreen_pipeline);
-}
-
-void
-clutter_stage_view_invalidate_offscreen_blit_pipeline (ClutterStageView *view)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- g_clear_pointer (&priv->offscreen_pipeline, cogl_object_unref);
-}
-
-void
-clutter_stage_view_transform_rect_to_onscreen (ClutterStageView *view,
- const cairo_rectangle_int_t *src_rect,
- int dst_width,
- int dst_height,
- cairo_rectangle_int_t *dst_rect)
-{
- ClutterStageViewClass *view_class = CLUTTER_STAGE_VIEW_GET_CLASS (view);
-
- return view_class->transform_rect_to_onscreen (view,
- src_rect,
- dst_width,
- dst_height,
- dst_rect);
-}
-
-static void
-paint_transformed_framebuffer (ClutterStageView *view,
- CoglPipeline *pipeline,
- CoglOffscreen *src_framebuffer,
- CoglFramebuffer *dst_framebuffer,
- const cairo_region_t *redraw_clip)
-{
- graphene_matrix_t matrix;
- unsigned int n_rectangles, i;
- int dst_width, dst_height;
- cairo_rectangle_int_t view_layout;
- cairo_rectangle_int_t onscreen_layout;
- float view_scale;
- float *coordinates;
-
- dst_width = cogl_framebuffer_get_width (dst_framebuffer);
- dst_height = cogl_framebuffer_get_height (dst_framebuffer);
- clutter_stage_view_get_layout (view, &view_layout);
- clutter_stage_view_transform_rect_to_onscreen (view,
- &(cairo_rectangle_int_t) {
- .width = view_layout.width,
- .height = view_layout.height,
- },
- view_layout.width,
- view_layout.height,
- &onscreen_layout);
- view_scale = clutter_stage_view_get_scale (view);
-
- cogl_framebuffer_push_matrix (dst_framebuffer);
-
- graphene_matrix_init_translate (&matrix,
- &GRAPHENE_POINT3D_INIT (-dst_width / 2.0,
- -dst_height / 2.0,
- 0.f));
- graphene_matrix_scale (&matrix,
- 1.0 / (dst_width / 2.0),
- -1.0 / (dst_height / 2.0),
- 0.f);
- cogl_framebuffer_set_projection_matrix (dst_framebuffer, &matrix);
- cogl_framebuffer_set_viewport (dst_framebuffer,
- 0, 0, dst_width, dst_height);
-
- n_rectangles = cairo_region_num_rectangles (redraw_clip);
- coordinates = g_newa (float, 2 * 4 * n_rectangles);
-
- for (i = 0; i < n_rectangles; i++)
- {
- cairo_rectangle_int_t src_rect;
- cairo_rectangle_int_t dst_rect;
-
- cairo_region_get_rectangle (redraw_clip, i, &src_rect);
- _clutter_util_rectangle_offset (&src_rect,
- -view_layout.x,
- -view_layout.y,
- &src_rect);
-
- clutter_stage_view_transform_rect_to_onscreen (view,
- &src_rect,
- onscreen_layout.width,
- onscreen_layout.height,
- &dst_rect);
-
- coordinates[i * 8 + 0] = (float) dst_rect.x * view_scale;
- coordinates[i * 8 + 1] = (float) dst_rect.y * view_scale;
- coordinates[i * 8 + 2] = ((float) (dst_rect.x + dst_rect.width) *
- view_scale);
- coordinates[i * 8 + 3] = ((float) (dst_rect.y + dst_rect.height) *
- view_scale);
-
- coordinates[i * 8 + 4] = (((float) dst_rect.x / (float) dst_width) *
- view_scale);
- coordinates[i * 8 + 5] = (((float) dst_rect.y / (float) dst_height) *
- view_scale);
- coordinates[i * 8 + 6] = ((float) (dst_rect.x + dst_rect.width) /
- (float) dst_width) * view_scale;
- coordinates[i * 8 + 7] = ((float) (dst_rect.y + dst_rect.height) /
- (float) dst_height) * view_scale;
- }
-
- cogl_framebuffer_draw_textured_rectangles (dst_framebuffer,
- pipeline,
- coordinates,
- n_rectangles);
-
- cogl_framebuffer_pop_matrix (dst_framebuffer);
-}
-
-static gboolean
-is_shadowfb_double_buffered (ClutterStageView *view)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- return priv->shadow.dma_buf.handles[0] && priv->shadow.dma_buf.handles[1];
-}
-
-static gboolean
-init_dma_buf_shadowfbs (ClutterStageView *view,
- CoglContext *cogl_context,
- int width,
- int height,
- GError **error)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
- CoglRenderer *cogl_renderer = cogl_context_get_renderer (cogl_context);
- CoglFramebuffer *initial_shadowfb;
-
- if (!cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE))
- {
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
- "Buffer age not supported");
- return FALSE;
- }
-
- if (!COGL_IS_ONSCREEN (priv->framebuffer))
- {
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
- "Tried to use shadow buffer without onscreen");
- return FALSE;
- }
-
- priv->shadow.dma_buf.handles[0] = cogl_renderer_create_dma_buf (cogl_renderer,
- width, height,
- error);
- if (!priv->shadow.dma_buf.handles[0])
- return FALSE;
-
- priv->shadow.dma_buf.handles[1] = cogl_renderer_create_dma_buf (cogl_renderer,
- width, height,
- error);
- if (!priv->shadow.dma_buf.handles[1])
- {
- g_clear_pointer (&priv->shadow.dma_buf.handles[0],
- cogl_dma_buf_handle_free);
- return FALSE;
- }
-
- priv->shadow.dma_buf.damage_history = clutter_damage_history_new ();
-
- initial_shadowfb =
- cogl_dma_buf_handle_get_framebuffer (priv->shadow.dma_buf.handles[0]);
- priv->shadow.framebuffer = COGL_OFFSCREEN (g_object_ref (initial_shadowfb));
-
- return TRUE;
-}
-
-static CoglOffscreen *
-create_offscreen_framebuffer (CoglContext *context,
- int width,
- int height,
- GError **error)
-{
- CoglOffscreen *framebuffer;
- CoglTexture2D *texture;
-
- texture = cogl_texture_2d_new_with_size (context, width, height);
- cogl_primitive_texture_set_auto_mipmap (COGL_PRIMITIVE_TEXTURE (texture),
- FALSE);
-
- if (!cogl_texture_allocate (COGL_TEXTURE (texture), error))
- {
- cogl_object_unref (texture);
- return FALSE;
- }
-
- framebuffer = cogl_offscreen_new_with_texture (COGL_TEXTURE (texture));
- cogl_object_unref (texture);
- if (!cogl_framebuffer_allocate (COGL_FRAMEBUFFER (framebuffer), error))
- {
- g_object_unref (framebuffer);
- return FALSE;
- }
-
- return framebuffer;
-}
-
-static gboolean
-init_fallback_shadowfb (ClutterStageView *view,
- CoglContext *cogl_context,
- int width,
- int height,
- GError **error)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
- CoglOffscreen *offscreen;
-
- offscreen = create_offscreen_framebuffer (cogl_context, width, height, error);
- if (!offscreen)
- return FALSE;
-
- priv->shadow.framebuffer = offscreen;
- return TRUE;
-}
-
-static void
-init_shadowfb (ClutterStageView *view)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
- g_autoptr (GError) error = NULL;
- int width;
- int height;
- CoglContext *cogl_context;
-
- width = cogl_framebuffer_get_width (priv->framebuffer);
- height = cogl_framebuffer_get_height (priv->framebuffer);
- cogl_context = cogl_framebuffer_get_context (priv->framebuffer);
-
- if (g_strcmp0 (g_getenv ("MUTTER_DEBUG_ENABLE_DOUBLE_SHADOWFB"), "1") == 0)
- {
- if (init_dma_buf_shadowfbs (view, cogl_context, width, height, &error))
- {
- g_message ("Initialized double buffered shadow fb for %s",
- priv->name);
- return;
- }
-
- g_warning ("Failed to initialize double buffered shadow fb for %s: %s",
- priv->name, error->message);
- g_clear_error (&error);
- }
-
- if (!init_fallback_shadowfb (view, cogl_context, width, height, &error))
- {
- g_warning ("Failed to initialize single buffered shadow fb for %s: %s",
- priv->name, error->message);
- }
- else
- {
- g_message ("Initialized single buffered shadow fb for %s", priv->name);
- }
-}
-
-void
-clutter_stage_view_after_paint (ClutterStageView *view,
- cairo_region_t *redraw_clip)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- if (priv->offscreen)
- {
- clutter_stage_view_ensure_offscreen_blit_pipeline (view);
-
- if (priv->shadow.framebuffer)
- {
- CoglFramebuffer *shadowfb =
- COGL_FRAMEBUFFER (priv->shadow.framebuffer);
-
- paint_transformed_framebuffer (view,
- priv->offscreen_pipeline,
- priv->offscreen,
- shadowfb,
- redraw_clip);
- }
- else
- {
- paint_transformed_framebuffer (view,
- priv->offscreen_pipeline,
- priv->offscreen,
- priv->framebuffer,
- redraw_clip);
- }
- }
-}
-
-static gboolean
-is_tile_dirty (cairo_rectangle_int_t *tile,
- uint8_t *current_data,
- uint8_t *prev_data,
- int bpp,
- int stride)
-{
- int y;
-
- for (y = tile->y; y < tile->y + tile->height; y++)
- {
- if (memcmp (prev_data + y * stride + tile->x * bpp,
- current_data + y * stride + tile->x * bpp,
- tile->width * bpp) != 0)
- return TRUE;
- }
-
- return FALSE;
-}
-
-static int
-flip_dma_buf_idx (int idx)
-{
- return (idx + 1) % 2;
-}
-
-static cairo_region_t *
-find_damaged_tiles (ClutterStageView *view,
- const cairo_region_t *damage_region,
- GError **error)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
- cairo_region_t *tile_damage_region;
- cairo_rectangle_int_t damage_extents;
- cairo_rectangle_int_t fb_rect;
- int prev_dma_buf_idx;
- CoglDmaBufHandle *prev_dma_buf_handle;
- uint8_t *prev_data;
- int current_dma_buf_idx;
- CoglDmaBufHandle *current_dma_buf_handle;
- uint8_t *current_data;
- int width, height, stride, bpp;
- int tile_x_min, tile_x_max;
- int tile_y_min, tile_y_max;
- int tile_x, tile_y;
- const int tile_size = 16;
-
- prev_dma_buf_idx = flip_dma_buf_idx (priv->shadow.dma_buf.current_idx);
- prev_dma_buf_handle = priv->shadow.dma_buf.handles[prev_dma_buf_idx];
-
- current_dma_buf_idx = priv->shadow.dma_buf.current_idx;
- current_dma_buf_handle = priv->shadow.dma_buf.handles[current_dma_buf_idx];
-
- width = cogl_dma_buf_handle_get_width (current_dma_buf_handle);
- height = cogl_dma_buf_handle_get_height (current_dma_buf_handle);
- stride = cogl_dma_buf_handle_get_stride (current_dma_buf_handle);
- bpp = cogl_dma_buf_handle_get_bpp (current_dma_buf_handle);
-
- cogl_framebuffer_finish (COGL_FRAMEBUFFER (priv->shadow.framebuffer));
-
- if (!cogl_dma_buf_handle_sync_read_start (prev_dma_buf_handle, error))
- return NULL;
-
- if (!cogl_dma_buf_handle_sync_read_start (current_dma_buf_handle, error))
- goto err_sync_read_current;
-
- prev_data = cogl_dma_buf_handle_mmap (prev_dma_buf_handle, error);
- if (!prev_data)
- goto err_mmap_prev;
- current_data = cogl_dma_buf_handle_mmap (current_dma_buf_handle, error);
- if (!current_data)
- goto err_mmap_current;
-
- fb_rect = (cairo_rectangle_int_t) {
- .width = width,
- .height = height,
- };
-
- cairo_region_get_extents (damage_region, &damage_extents);
-
- tile_x_min = damage_extents.x / tile_size;
- tile_x_max = ((damage_extents.x + damage_extents.width + tile_size - 1) /
- tile_size);
- tile_y_min = damage_extents.y / tile_size;
- tile_y_max = ((damage_extents.y + damage_extents.height + tile_size - 1) /
- tile_size);
-
- tile_damage_region = cairo_region_create ();
-
- for (tile_y = tile_y_min; tile_y <= tile_y_max; tile_y++)
- {
- for (tile_x = tile_x_min; tile_x <= tile_x_max; tile_x++)
- {
- cairo_rectangle_int_t tile = {
- .x = tile_x * tile_size,
- .y = tile_y * tile_size,
- .width = tile_size,
- .height = tile_size,
- };
-
- if (cairo_region_contains_rectangle (damage_region, &tile) ==
- CAIRO_REGION_OVERLAP_OUT)
- continue;
-
- _clutter_util_rectangle_intersection (&tile, &fb_rect, &tile);
-
- if (is_tile_dirty (&tile, current_data, prev_data, bpp, stride))
- cairo_region_union_rectangle (tile_damage_region, &tile);
- }
- }
-
- if (!cogl_dma_buf_handle_sync_read_end (prev_dma_buf_handle, error))
- {
- g_warning ("Failed to end DMA buffer read synchronization: %s",
- (*error)->message);
- g_clear_error (error);
- }
-
- if (!cogl_dma_buf_handle_sync_read_end (current_dma_buf_handle, error))
- {
- g_warning ("Failed to end DMA buffer read synchronization: %s",
- (*error)->message);
- g_clear_error (error);
- }
-
- cogl_dma_buf_handle_munmap (prev_dma_buf_handle, prev_data, NULL);
- cogl_dma_buf_handle_munmap (current_dma_buf_handle, current_data, NULL);
-
- cairo_region_intersect (tile_damage_region, damage_region);
-
- return tile_damage_region;
-
-err_mmap_current:
- cogl_dma_buf_handle_munmap (prev_dma_buf_handle, prev_data, NULL);
-
-err_mmap_prev:
- cogl_dma_buf_handle_sync_read_end (current_dma_buf_handle, NULL);
-
-err_sync_read_current:
- cogl_dma_buf_handle_sync_read_end (prev_dma_buf_handle, NULL);
-
- return NULL;
-}
-
-static void
-swap_dma_buf_framebuffer (ClutterStageView *view)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
- int next_idx;
- CoglDmaBufHandle *next_dma_buf_handle;
- CoglFramebuffer *next_framebuffer;
-
- next_idx = ((priv->shadow.dma_buf.current_idx + 1) %
- G_N_ELEMENTS (priv->shadow.dma_buf.handles));
- priv->shadow.dma_buf.current_idx = next_idx;
-
- next_dma_buf_handle = priv->shadow.dma_buf.handles[next_idx];
- next_framebuffer =
- cogl_dma_buf_handle_get_framebuffer (next_dma_buf_handle);
- g_clear_object (&priv->shadow.framebuffer);
- priv->shadow.framebuffer = COGL_OFFSCREEN (g_object_ref (next_framebuffer));
-}
-
-static void
-copy_shadowfb_to_onscreen (ClutterStageView *view,
- const cairo_region_t *swap_region)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
- ClutterDamageHistory *damage_history = priv->shadow.dma_buf.damage_history;
- cairo_region_t *damage_region;
- int age;
- int i;
-
- if (cairo_region_is_empty (swap_region))
- {
- cairo_rectangle_int_t full_damage = {
- .width = cogl_framebuffer_get_width (priv->framebuffer),
- .height = cogl_framebuffer_get_height (priv->framebuffer),
- };
- damage_region = cairo_region_create_rectangle (&full_damage);
- }
- else
- {
- damage_region = cairo_region_copy (swap_region);
- }
-
- if (is_shadowfb_double_buffered (view))
- {
- CoglOnscreen *onscreen = COGL_ONSCREEN (priv->framebuffer);
- cairo_region_t *changed_region;
-
- if (cogl_onscreen_get_frame_counter (onscreen) >= 1)
- {
- g_autoptr (GError) error = NULL;
-
- changed_region = find_damaged_tiles (view, damage_region, &error);
- if (!changed_region)
- {
- int other_dma_buf_idx;
-
- g_warning ("Disabling actual damage detection: %s",
- error->message);
-
- other_dma_buf_idx =
- flip_dma_buf_idx (priv->shadow.dma_buf.current_idx);
- g_clear_pointer (&priv->shadow.dma_buf.handles[other_dma_buf_idx],
- cogl_dma_buf_handle_free);
- }
- }
- else
- {
- changed_region = cairo_region_copy (damage_region);
- }
-
- if (changed_region)
- {
- int buffer_age;
-
- clutter_damage_history_record (damage_history, changed_region);
-
- buffer_age = cogl_onscreen_get_buffer_age (onscreen);
- if (clutter_damage_history_is_age_valid (damage_history, buffer_age))
- {
- for (age = 1; age <= buffer_age; age++)
- {
- const cairo_region_t *old_damage;
-
- old_damage = clutter_damage_history_lookup (damage_history, age);
- cairo_region_union (changed_region, old_damage);
- }
-
- cairo_region_destroy (damage_region);
- damage_region = g_steal_pointer (&changed_region);
- }
- else
- {
- cairo_region_destroy (changed_region);
- }
-
- clutter_damage_history_step (damage_history);
- }
- }
-
- for (i = 0; i < cairo_region_num_rectangles (damage_region); i++)
- {
- CoglFramebuffer *shadowfb = COGL_FRAMEBUFFER (priv->shadow.framebuffer);
- g_autoptr (GError) error = NULL;
- cairo_rectangle_int_t rect;
-
- cairo_region_get_rectangle (damage_region, i, &rect);
-
- if (!cogl_blit_framebuffer (shadowfb,
- priv->framebuffer,
- rect.x, rect.y,
- rect.x, rect.y,
- rect.width, rect.height,
- &error))
- {
- g_warning ("Failed to blit shadow buffer: %s", error->message);
- cairo_region_destroy (damage_region);
- return;
- }
- }
-
- cairo_region_destroy (damage_region);
-
- if (is_shadowfb_double_buffered (view))
- swap_dma_buf_framebuffer (view);
-}
-
-void
-clutter_stage_view_before_swap_buffer (ClutterStageView *view,
- const cairo_region_t *swap_region)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- if (priv->shadow.framebuffer)
- copy_shadowfb_to_onscreen (view, swap_region);
-}
-
-float
-clutter_stage_view_get_scale (ClutterStageView *view)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- return priv->scale;
-}
-
-typedef void (*FrontBufferCallback) (CoglFramebuffer *framebuffer,
- gconstpointer user_data);
-
-static void
-clutter_stage_view_foreach_front_buffer (ClutterStageView *view,
- FrontBufferCallback callback,
- gconstpointer user_data)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- if (priv->offscreen)
- {
- callback (COGL_FRAMEBUFFER (priv->offscreen), user_data);
- }
- else if (priv->shadow.framebuffer)
- {
- if (is_shadowfb_double_buffered (view))
- {
- int i;
-
- for (i = 0; i < G_N_ELEMENTS (priv->shadow.dma_buf.handles); i++)
- {
- CoglDmaBufHandle *handle = priv->shadow.dma_buf.handles[i];
- CoglFramebuffer *framebuffer =
- cogl_dma_buf_handle_get_framebuffer (handle);
-
- callback (framebuffer, user_data);
- }
- }
- else
- {
- callback (COGL_FRAMEBUFFER (priv->shadow.framebuffer), user_data);
- }
- }
- else
- {
- callback (priv->framebuffer, user_data);
- }
-}
-
-gboolean
-clutter_stage_view_is_dirty_viewport (ClutterStageView *view)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- return priv->dirty_viewport;
-}
-
-void
-clutter_stage_view_invalidate_viewport (ClutterStageView *view)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- priv->dirty_viewport = TRUE;
-}
-
-static void
-set_framebuffer_viewport (CoglFramebuffer *framebuffer,
- gconstpointer user_data)
-{
- const graphene_rect_t *rect = user_data;
-
- cogl_framebuffer_set_viewport (framebuffer,
- rect->origin.x,
- rect->origin.y,
- rect->size.width,
- rect->size.height);
-}
-
-void
-clutter_stage_view_set_viewport (ClutterStageView *view,
- float x,
- float y,
- float width,
- float height)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
- graphene_rect_t rect;
-
- priv->dirty_viewport = FALSE;
-
- rect = (graphene_rect_t) {
- .origin = { .x = x, .y = y },
- .size = { .width = width, .height = height },
- };
- clutter_stage_view_foreach_front_buffer (view,
- set_framebuffer_viewport,
- &rect);
-}
-
-gboolean
-clutter_stage_view_is_dirty_projection (ClutterStageView *view)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- return priv->dirty_projection;
-}
-
-static void
-set_framebuffer_projection_matrix (CoglFramebuffer *framebuffer,
- gconstpointer user_data)
-{
- cogl_framebuffer_set_projection_matrix (framebuffer, user_data);
-}
-
-void
-clutter_stage_view_invalidate_projection (ClutterStageView *view)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- priv->dirty_projection = TRUE;
-}
-
-void
-clutter_stage_view_set_projection (ClutterStageView *view,
- const graphene_matrix_t *matrix)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- priv->dirty_projection = FALSE;
- clutter_stage_view_foreach_front_buffer (view,
- set_framebuffer_projection_matrix,
- matrix);
-}
-
-void
-clutter_stage_view_get_offscreen_transformation_matrix (ClutterStageView *view,
- graphene_matrix_t *matrix)
-{
- ClutterStageViewClass *view_class = CLUTTER_STAGE_VIEW_GET_CLASS (view);
-
- view_class->get_offscreen_transformation_matrix (view, matrix);
-}
-
-void
-clutter_stage_view_add_redraw_clip (ClutterStageView *view,
- const cairo_rectangle_int_t *clip)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- if (priv->has_redraw_clip && !priv->redraw_clip)
- return;
-
- if (!clip)
- {
- g_clear_pointer (&priv->redraw_clip, cairo_region_destroy);
- priv->has_redraw_clip = TRUE;
- return;
- }
-
- if (clip->width == 0 || clip->height == 0)
- return;
-
- if (!priv->redraw_clip)
- {
- if (!clutter_util_rectangle_equal (&priv->layout, clip))
- priv->redraw_clip = cairo_region_create_rectangle (clip);
- }
- else
- {
- cairo_region_union_rectangle (priv->redraw_clip, clip);
-
- if (cairo_region_num_rectangles (priv->redraw_clip) == 1)
- {
- cairo_rectangle_int_t redraw_clip_extents;
-
- cairo_region_get_extents (priv->redraw_clip, &redraw_clip_extents);
- if (clutter_util_rectangle_equal (&priv->layout, &redraw_clip_extents))
- g_clear_pointer (&priv->redraw_clip, cairo_region_destroy);
- }
- }
-
- priv->has_redraw_clip = TRUE;
-}
-
-gboolean
-clutter_stage_view_has_redraw_clip (ClutterStageView *view)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- return priv->has_redraw_clip;
-}
-
-gboolean
-clutter_stage_view_has_full_redraw_clip (ClutterStageView *view)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- return priv->has_redraw_clip && !priv->redraw_clip;
-}
-
-const cairo_region_t *
-clutter_stage_view_peek_redraw_clip (ClutterStageView *view)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- return priv->redraw_clip;
-}
-
-cairo_region_t *
-clutter_stage_view_take_redraw_clip (ClutterStageView *view)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- priv->has_redraw_clip = FALSE;
-
- return g_steal_pointer (&priv->redraw_clip);
-}
-
-static void
-clutter_stage_default_get_offscreen_transformation_matrix (ClutterStageView *view,
- graphene_matrix_t *matrix)
-{
- graphene_matrix_init_identity (matrix);
-}
-
-void
-clutter_stage_view_assign_next_scanout (ClutterStageView *view,
- CoglScanout *scanout)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- g_set_object (&priv->next_scanout, scanout);
-}
-
-CoglScanout *
-clutter_stage_view_take_scanout (ClutterStageView *view)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- return g_steal_pointer (&priv->next_scanout);
-}
-
-/**
- * clutter_stage_view_peek_scanout: (skip)
- */
-CoglScanout *
-clutter_stage_view_peek_scanout (ClutterStageView *view)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- return priv->next_scanout;
-}
-
-void
-clutter_stage_view_schedule_update (ClutterStageView *view)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- clutter_frame_clock_schedule_update (priv->frame_clock);
-}
-
-float
-clutter_stage_view_get_refresh_rate (ClutterStageView *view)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- return priv->refresh_rate;
-}
-
-/**
- * clutter_stage_view_get_frame_clock: (skip)
- */
-ClutterFrameClock *
-clutter_stage_view_get_frame_clock (ClutterStageView *view)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- return priv->frame_clock;
-}
-
-static void
-handle_frame_clock_before_frame (ClutterFrameClock *frame_clock,
- int64_t frame_count,
- gpointer user_data)
-{
- ClutterStageView *view = user_data;
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- _clutter_stage_process_queued_events (priv->stage);
-}
-
-static void
-begin_frame_timing_measurement (ClutterStageView *view)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- priv->frame_timings.began_draw_time_us = g_get_monotonic_time ();
-}
-
-static void
-end_frame_timing_measurement (ClutterStageView *view)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
- int64_t now_us = g_get_monotonic_time ();
- int64_t draw_time_us;
-
- draw_time_us = now_us - priv->frame_timings.began_draw_time_us;
-
- priv->frame_timings.frame_count++;
- priv->frame_timings.cumulative_draw_time_us += draw_time_us;
- if (draw_time_us > priv->frame_timings.worst_draw_time_us)
- priv->frame_timings.worst_draw_time_us = draw_time_us;
-
- if (priv->frame_timings.frame_count && priv->frame_timings.last_print_time_us)
- {
- float time_since_last_print_s;
-
- time_since_last_print_s =
- (now_us - priv->frame_timings.last_print_time_us) /
- (float) G_USEC_PER_SEC;
-
- if (time_since_last_print_s >= 1.0)
- {
- float avg_fps, avg_draw_time_ms, worst_draw_time_ms;
-
- avg_fps = priv->frame_timings.frame_count / time_since_last_print_s;
-
- avg_draw_time_ms =
- (priv->frame_timings.cumulative_draw_time_us / 1000.0) /
- priv->frame_timings.frame_count;
-
- worst_draw_time_ms = priv->frame_timings.worst_draw_time_us / 1000.0;
-
- g_print ("*** %s frame timings over %.01fs: "
- "%.02f FPS, average: %.01fms, peak: %.01fms\n",
- priv->name,
- time_since_last_print_s,
- avg_fps,
- avg_draw_time_ms,
- worst_draw_time_ms);
-
- priv->frame_timings.frame_count = 0;
- priv->frame_timings.cumulative_draw_time_us = 0;
- priv->frame_timings.worst_draw_time_us = 0;
- priv->frame_timings.last_print_time_us = now_us;
- }
- }
- else if (!priv->frame_timings.last_print_time_us)
- {
- priv->frame_timings.last_print_time_us = now_us;
- }
-}
-
-static ClutterFrameResult
-handle_frame_clock_frame (ClutterFrameClock *frame_clock,
- int64_t frame_count,
- int64_t time_us,
- gpointer user_data)
-{
- ClutterStageView *view = user_data;
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
- ClutterStage *stage = priv->stage;
- ClutterStageWindow *stage_window = _clutter_stage_get_window (stage);
- g_autoptr (GSList) devices = NULL;
- ClutterFrame frame;
-
- if (CLUTTER_ACTOR_IN_DESTRUCTION (stage))
- return CLUTTER_FRAME_RESULT_IDLE;
-
- if (!clutter_actor_is_realized (CLUTTER_ACTOR (stage)))
- return CLUTTER_FRAME_RESULT_IDLE;
-
- if (!clutter_actor_is_mapped (CLUTTER_ACTOR (stage)))
- return CLUTTER_FRAME_RESULT_IDLE;
-
- if (_clutter_context_get_show_fps ())
- begin_frame_timing_measurement (view);
-
- _clutter_run_repaint_functions (CLUTTER_REPAINT_FLAGS_PRE_PAINT);
- clutter_stage_emit_before_update (stage, view);
-
- clutter_stage_maybe_relayout (CLUTTER_ACTOR (stage));
- clutter_stage_maybe_finish_queue_redraws (stage);
-
- clutter_stage_finish_layout (stage);
-
- devices = clutter_stage_find_updated_devices (stage);
-
- frame = CLUTTER_FRAME_INIT;
-
- _clutter_stage_window_prepare_frame (stage_window, view, &frame);
-
- if (clutter_stage_view_has_redraw_clip (view))
- {
- clutter_stage_emit_before_paint (stage, view);
-
- _clutter_stage_window_redraw_view (stage_window, view, &frame);
-
- clutter_frame_clock_record_flip_time (frame_clock,
- g_get_monotonic_time ());
-
- clutter_stage_emit_after_paint (stage, view);
-
- if (_clutter_context_get_show_fps ())
- end_frame_timing_measurement (view);
- }
-
- _clutter_stage_window_finish_frame (stage_window, view, &frame);
-
- clutter_stage_update_devices (stage, devices);
-
- _clutter_run_repaint_functions (CLUTTER_REPAINT_FLAGS_POST_PAINT);
- clutter_stage_emit_after_update (stage, view);
-
- return clutter_frame_get_result (&frame);
-}
-
-static const ClutterFrameListenerIface frame_clock_listener_iface = {
- .before_frame = handle_frame_clock_before_frame,
- .frame = handle_frame_clock_frame,
-};
-
-void
-clutter_stage_view_notify_presented (ClutterStageView *view,
- ClutterFrameInfo *frame_info)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- clutter_stage_presented (priv->stage, view, frame_info);
- clutter_frame_clock_notify_presented (priv->frame_clock, frame_info);
-}
-
-void
-clutter_stage_view_notify_ready (ClutterStageView *view)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- clutter_frame_clock_notify_ready (priv->frame_clock);
-}
-
-static void
-sanity_check_framebuffer (ClutterStageView *view)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
- G_GNUC_UNUSED int fb_width, fb_height;
-
- fb_width = cogl_framebuffer_get_width (priv->framebuffer);
- fb_height = cogl_framebuffer_get_height (priv->framebuffer);
-
- g_warn_if_fail (fabsf (roundf (fb_width / priv->scale) -
- fb_width / priv->scale) < FLT_EPSILON);
- g_warn_if_fail (fabsf (roundf (fb_height / priv->scale) -
- fb_height / priv->scale) < FLT_EPSILON);
-}
-
-static void
-clutter_stage_view_set_framebuffer (ClutterStageView *view,
- CoglFramebuffer *framebuffer)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- g_warn_if_fail (!priv->framebuffer);
- if (framebuffer)
- {
- priv->framebuffer = g_object_ref (framebuffer);
- sanity_check_framebuffer (view);
- }
-}
-
-static void
-clutter_stage_view_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterStageView *view = CLUTTER_STAGE_VIEW (object);
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- switch (prop_id)
- {
- case PROP_NAME:
- g_value_set_string (value, priv->name);
- break;
- case PROP_STAGE:
- g_value_set_boxed (value, &priv->stage);
- break;
- case PROP_LAYOUT:
- g_value_set_boxed (value, &priv->layout);
- break;
- case PROP_FRAMEBUFFER:
- g_value_set_object (value, priv->framebuffer);
- break;
- case PROP_OFFSCREEN:
- g_value_set_object (value, priv->offscreen);
- break;
- case PROP_USE_SHADOWFB:
- g_value_set_boolean (value, priv->use_shadowfb);
- break;
- case PROP_SCALE:
- g_value_set_float (value, priv->scale);
- break;
- case PROP_REFRESH_RATE:
- g_value_set_float (value, priv->refresh_rate);
- break;
- case PROP_VBLANK_DURATION_US:
- g_value_set_int64 (value, priv->vblank_duration_us);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
-}
-
-static void
-clutter_stage_view_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterStageView *view = CLUTTER_STAGE_VIEW (object);
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
- cairo_rectangle_int_t *layout;
-
- switch (prop_id)
- {
- case PROP_NAME:
- priv->name = g_value_dup_string (value);
- break;
- case PROP_STAGE:
- priv->stage = g_value_get_object (value);
- break;
- case PROP_LAYOUT:
- layout = g_value_get_boxed (value);
- priv->layout = *layout;
- break;
- case PROP_FRAMEBUFFER:
- clutter_stage_view_set_framebuffer (view, g_value_get_object (value));
- break;
- case PROP_OFFSCREEN:
- priv->offscreen = g_value_dup_object (value);
- break;
- case PROP_USE_SHADOWFB:
- priv->use_shadowfb = g_value_get_boolean (value);
- break;
- case PROP_SCALE:
- priv->scale = g_value_get_float (value);
- break;
- case PROP_REFRESH_RATE:
- priv->refresh_rate = g_value_get_float (value);
- break;
- case PROP_VBLANK_DURATION_US:
- priv->vblank_duration_us = g_value_get_int64 (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
-}
-
-static void
-clutter_stage_view_constructed (GObject *object)
-{
- ClutterStageView *view = CLUTTER_STAGE_VIEW (object);
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- if (priv->use_shadowfb)
- init_shadowfb (view);
-
- priv->frame_clock = clutter_frame_clock_new (priv->refresh_rate,
- priv->vblank_duration_us,
- &frame_clock_listener_iface,
- view);
-
- G_OBJECT_CLASS (clutter_stage_view_parent_class)->constructed (object);
-}
-
-static void
-clutter_stage_view_dispose (GObject *object)
-{
- ClutterStageView *view = CLUTTER_STAGE_VIEW (object);
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
- int i;
-
- g_clear_pointer (&priv->name, g_free);
-
- g_clear_object (&priv->shadow.framebuffer);
- for (i = 0; i < G_N_ELEMENTS (priv->shadow.dma_buf.handles); i++)
- {
- g_clear_pointer (&priv->shadow.dma_buf.handles[i],
- cogl_dma_buf_handle_free);
- }
- g_clear_pointer (&priv->shadow.dma_buf.damage_history,
- clutter_damage_history_free);
-
- g_clear_object (&priv->offscreen);
- g_clear_pointer (&priv->offscreen_pipeline, cogl_object_unref);
- g_clear_pointer (&priv->redraw_clip, cairo_region_destroy);
- g_clear_pointer (&priv->frame_clock, clutter_frame_clock_destroy);
-
- G_OBJECT_CLASS (clutter_stage_view_parent_class)->dispose (object);
-}
-
-static void
-clutter_stage_view_finalize (GObject *object)
-{
- ClutterStageView *view = CLUTTER_STAGE_VIEW (object);
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- g_clear_object (&priv->framebuffer);
-
- G_OBJECT_CLASS (clutter_stage_view_parent_class)->dispose (object);
-}
-
-static void
-clutter_stage_view_init (ClutterStageView *view)
-{
- ClutterStageViewPrivate *priv =
- clutter_stage_view_get_instance_private (view);
-
- priv->dirty_viewport = TRUE;
- priv->dirty_projection = TRUE;
- priv->scale = 1.0;
- priv->refresh_rate = 60.0;
-}
-
-static void
-clutter_stage_view_class_init (ClutterStageViewClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- klass->get_offscreen_transformation_matrix =
- clutter_stage_default_get_offscreen_transformation_matrix;
-
- object_class->get_property = clutter_stage_view_get_property;
- object_class->set_property = clutter_stage_view_set_property;
- object_class->constructed = clutter_stage_view_constructed;
- object_class->dispose = clutter_stage_view_dispose;
- object_class->finalize = clutter_stage_view_finalize;
-
- obj_props[PROP_NAME] =
- g_param_spec_string ("name",
- "Name",
- "Name of view",
- NULL,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS);
-
- obj_props[PROP_STAGE] =
- g_param_spec_object ("stage",
- "The stage",
- "The ClutterStage",
- CLUTTER_TYPE_STAGE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS);
-
- obj_props[PROP_LAYOUT] =
- g_param_spec_boxed ("layout",
- "View layout",
- "The view layout on the screen",
- CAIRO_GOBJECT_TYPE_RECTANGLE_INT,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
- G_PARAM_STATIC_STRINGS);
-
- obj_props[PROP_FRAMEBUFFER] =
- g_param_spec_object ("framebuffer",
- "View framebuffer",
- "The front buffer of the view",
- COGL_TYPE_FRAMEBUFFER,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
- G_PARAM_STATIC_STRINGS);
-
- obj_props[PROP_OFFSCREEN] =
- g_param_spec_object ("offscreen",
- "Offscreen buffer",
- "Framebuffer used as intermediate buffer",
- COGL_TYPE_OFFSCREEN,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS);
-
- obj_props[PROP_USE_SHADOWFB] =
- g_param_spec_boolean ("use-shadowfb",
- "Use shadowfb",
- "Whether to use one or more shadow framebuffers",
- FALSE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS);
-
- obj_props[PROP_SCALE] =
- g_param_spec_float ("scale",
- "View scale",
- "The view scale",
- 0.5, G_MAXFLOAT, 1.0,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
- G_PARAM_STATIC_STRINGS);
-
- obj_props[PROP_REFRESH_RATE] =
- g_param_spec_float ("refresh-rate",
- "Refresh rate",
- "Update refresh rate",
- 1.0, G_MAXFLOAT, 60.0,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT |
- G_PARAM_STATIC_STRINGS);
-
- obj_props[PROP_VBLANK_DURATION_US] =
- g_param_spec_int64 ("vblank-duration-us",
- "Vblank duration (µs)",
- "The vblank duration",
- 0, G_MAXINT64, 0,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS);
-
- g_object_class_install_properties (object_class, PROP_LAST, obj_props);
-}
diff --git a/clutter/clutter/clutter-stage-view.h b/clutter/clutter/clutter-stage-view.h
deleted file mode 100644
index c2cf76abf..000000000
--- a/clutter/clutter/clutter-stage-view.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2016 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_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>
-
-#include "clutter-macros.h"
-#include "clutter-frame-clock.h"
-
-#define CLUTTER_TYPE_STAGE_VIEW (clutter_stage_view_get_type ())
-CLUTTER_EXPORT
-G_DECLARE_DERIVABLE_TYPE (ClutterStageView, clutter_stage_view,
- CLUTTER, STAGE_VIEW,
- GObject)
-
-struct _ClutterStageViewClass
-{
- GObjectClass parent_class;
-
- void (* setup_offscreen_blit_pipeline) (ClutterStageView *view,
- CoglPipeline *pipeline);
-
- void (* get_offscreen_transformation_matrix) (ClutterStageView *view,
- graphene_matrix_t *matrix);
-
- void (* transform_rect_to_onscreen) (ClutterStageView *view,
- const cairo_rectangle_int_t *src_rect,
- int dst_width,
- int dst_height,
- cairo_rectangle_int_t *dst_rect);
-};
-
-CLUTTER_EXPORT
-void clutter_stage_view_destroy (ClutterStageView *view);
-
-CLUTTER_EXPORT
-void clutter_stage_view_get_layout (ClutterStageView *view,
- cairo_rectangle_int_t *rect);
-
-CLUTTER_EXPORT
-CoglFramebuffer *clutter_stage_view_get_framebuffer (ClutterStageView *view);
-CLUTTER_EXPORT
-CoglFramebuffer *clutter_stage_view_get_onscreen (ClutterStageView *view);
-CLUTTER_EXPORT
-void clutter_stage_view_invalidate_offscreen_blit_pipeline (ClutterStageView *view);
-
-CLUTTER_EXPORT
-float clutter_stage_view_get_scale (ClutterStageView *view);
-
-CLUTTER_EXPORT
-void clutter_stage_view_get_offscreen_transformation_matrix (ClutterStageView *view,
- graphene_matrix_t *matrix);
-
-CLUTTER_EXPORT
-ClutterFrameClock * clutter_stage_view_get_frame_clock (ClutterStageView *view);
-
-CLUTTER_EXPORT
-CoglScanout * clutter_stage_view_peek_scanout (ClutterStageView *view);
-
-CLUTTER_EXPORT
-float clutter_stage_view_get_refresh_rate (ClutterStageView *view);
-
-#endif /* __CLUTTER_STAGE_VIEW_H__ */
diff --git a/clutter/clutter/clutter-stage-window.c b/clutter/clutter/clutter-stage-window.c
deleted file mode 100644
index 9052a8c4b..000000000
--- a/clutter/clutter/clutter-stage-window.c
+++ /dev/null
@@ -1,175 +0,0 @@
-#include "clutter-build-config.h"
-
-#include <glib-object.h>
-
-#include "clutter-actor.h"
-#include "clutter-frame.h"
-#include "clutter-stage-window.h"
-#include "clutter-private.h"
-
-/**
- * SECTION:clutter-stage-window
- * @short_description: Handles the implementation for ClutterStage
- *
- * #ClutterStageWindow is an interface that provides the implementation for the
- * #ClutterStage actor, abstracting away the specifics of the windowing system.
- */
-
-G_DEFINE_INTERFACE (ClutterStageWindow, clutter_stage_window, G_TYPE_OBJECT);
-
-static void
-clutter_stage_window_default_init (ClutterStageWindowInterface *iface)
-{
- GParamSpec *pspec;
-
- pspec = g_param_spec_object ("backend",
- "Backend",
- "Back pointer to the Backend instance",
- CLUTTER_TYPE_BACKEND,
- G_PARAM_WRITABLE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS);
- g_object_interface_install_property (iface, pspec);
-
- pspec = g_param_spec_object ("wrapper",
- "Wrapper",
- "Back pointer to the Stage actor",
- CLUTTER_TYPE_STAGE,
- G_PARAM_WRITABLE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS);
- g_object_interface_install_property (iface, pspec);
-}
-
-/**
- * _clutter_stage_window_get_wrapper:
- * @window: a #ClutterStageWindow object
- *
- * Returns the pointer to the #ClutterStage it's part of.
- */
-ClutterActor *
-_clutter_stage_window_get_wrapper (ClutterStageWindow *window)
-{
- return CLUTTER_STAGE_WINDOW_GET_IFACE (window)->get_wrapper (window);
-}
-
-void
-_clutter_stage_window_set_title (ClutterStageWindow *window,
- const gchar *title)
-{
- ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
-
- if (iface->set_title)
- iface->set_title (window, title);
-}
-
-gboolean
-_clutter_stage_window_realize (ClutterStageWindow *window)
-{
- return CLUTTER_STAGE_WINDOW_GET_IFACE (window)->realize (window);
-}
-
-void
-_clutter_stage_window_unrealize (ClutterStageWindow *window)
-{
- CLUTTER_STAGE_WINDOW_GET_IFACE (window)->unrealize (window);
-}
-
-void
-_clutter_stage_window_show (ClutterStageWindow *window,
- gboolean do_raise)
-{
- CLUTTER_STAGE_WINDOW_GET_IFACE (window)->show (window, do_raise);
-}
-
-void
-_clutter_stage_window_hide (ClutterStageWindow *window)
-{
- CLUTTER_STAGE_WINDOW_GET_IFACE (window)->hide (window);
-}
-
-void
-_clutter_stage_window_resize (ClutterStageWindow *window,
- gint width,
- gint height)
-{
- CLUTTER_STAGE_WINDOW_GET_IFACE (window)->resize (window, width, height);
-}
-
-void
-_clutter_stage_window_get_geometry (ClutterStageWindow *window,
- cairo_rectangle_int_t *geometry)
-{
- CLUTTER_STAGE_WINDOW_GET_IFACE (window)->get_geometry (window, geometry);
-}
-
-void
-_clutter_stage_window_redraw_view (ClutterStageWindow *window,
- ClutterStageView *view,
- ClutterFrame *frame)
-{
- g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
-
- CLUTTER_STAGE_WINDOW_GET_IFACE (window)->redraw_view (window, view, frame);
-}
-
-gboolean
-_clutter_stage_window_can_clip_redraws (ClutterStageWindow *window)
-{
- ClutterStageWindowInterface *iface;
-
- g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
-
- iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
- if (iface->can_clip_redraws != NULL)
- return iface->can_clip_redraws (window);
-
- return FALSE;
-}
-
-GList *
-_clutter_stage_window_get_views (ClutterStageWindow *window)
-{
- ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
-
- return iface->get_views (window);
-}
-
-void
-_clutter_stage_window_prepare_frame (ClutterStageWindow *window,
- ClutterStageView *view,
- ClutterFrame *frame)
-{
- ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
-
- if (iface->prepare_frame)
- iface->prepare_frame (window, view, frame);
-}
-
-void
-_clutter_stage_window_finish_frame (ClutterStageWindow *window,
- ClutterStageView *view,
- ClutterFrame *frame)
-{
- ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
-
- if (iface->finish_frame)
- {
- iface->finish_frame (window, view, frame);
- return;
- }
-
- if (!clutter_frame_has_result (frame))
- clutter_frame_set_result (frame, CLUTTER_FRAME_RESULT_IDLE);
-}
-
-int64_t
-_clutter_stage_window_get_frame_counter (ClutterStageWindow *window)
-{
- ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
-
- if (iface->get_frame_counter)
- return iface->get_frame_counter (window);
- else
- return 0;
-}
diff --git a/clutter/clutter/clutter-stage-window.h b/clutter/clutter/clutter-stage-window.h
deleted file mode 100644
index a4ea11859..000000000
--- a/clutter/clutter/clutter-stage-window.h
+++ /dev/null
@@ -1,108 +0,0 @@
-#ifndef __CLUTTER_STAGE_WINDOW_H__
-#define __CLUTTER_STAGE_WINDOW_H__
-
-#include <cogl/cogl.h>
-#include <clutter/clutter-types.h>
-#include "clutter/clutter-stage-view.h"
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_STAGE_WINDOW (clutter_stage_window_get_type ())
-
-CLUTTER_EXPORT
-G_DECLARE_INTERFACE (ClutterStageWindow, clutter_stage_window,
- CLUTTER, STAGE_WINDOW,
- GObject)
-
-/*
- * ClutterStageWindowInterface: (skip)
- *
- * The interface implemented by backends for stage windows
- *
- * Since: 0.8
- */
-struct _ClutterStageWindowInterface
-{
- /*< private >*/
- GTypeInterface parent_iface;
-
- ClutterActor *(* get_wrapper) (ClutterStageWindow *stage_window);
-
- void (* set_title) (ClutterStageWindow *stage_window,
- const gchar *title);
-
- gboolean (* realize) (ClutterStageWindow *stage_window);
- void (* unrealize) (ClutterStageWindow *stage_window);
-
- void (* show) (ClutterStageWindow *stage_window,
- gboolean do_raise);
- void (* hide) (ClutterStageWindow *stage_window);
-
- void (* resize) (ClutterStageWindow *stage_window,
- gint width,
- gint height);
- void (* get_geometry) (ClutterStageWindow *stage_window,
- cairo_rectangle_int_t *geometry);
-
- void (* redraw_view) (ClutterStageWindow *stage_window,
- ClutterStageView *view,
- ClutterFrame *frame);
-
- gboolean (* can_clip_redraws) (ClutterStageWindow *stage_window);
-
- GList *(* get_views) (ClutterStageWindow *stage_window);
- int64_t (* get_frame_counter) (ClutterStageWindow *stage_window);
- void (* prepare_frame) (ClutterStageWindow *stage_window,
- ClutterStageView *view,
- ClutterFrame *frame);
- void (* finish_frame) (ClutterStageWindow *stage_window,
- ClutterStageView *view,
- ClutterFrame *frame);
-};
-
-ClutterActor * _clutter_stage_window_get_wrapper (ClutterStageWindow *window);
-
-void _clutter_stage_window_set_title (ClutterStageWindow *window,
- const gchar *title);
-void _clutter_stage_window_set_cursor_visible (ClutterStageWindow *window,
- gboolean is_visible);
-
-gboolean _clutter_stage_window_realize (ClutterStageWindow *window);
-void _clutter_stage_window_unrealize (ClutterStageWindow *window);
-
-void _clutter_stage_window_show (ClutterStageWindow *window,
- gboolean do_raise);
-void _clutter_stage_window_hide (ClutterStageWindow *window);
-
-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_set_accept_focus (ClutterStageWindow *window,
- gboolean accept_focus);
-
-void _clutter_stage_window_redraw_view (ClutterStageWindow *window,
- ClutterStageView *view,
- ClutterFrame *frame);
-
-CLUTTER_EXPORT
-gboolean _clutter_stage_window_can_clip_redraws (ClutterStageWindow *window);
-
-GList * _clutter_stage_window_get_views (ClutterStageWindow *window);
-
-void _clutter_stage_window_prepare_frame (ClutterStageWindow *window,
- ClutterStageView *view,
- ClutterFrame *frame);
-
-void _clutter_stage_window_finish_frame (ClutterStageWindow *window,
- ClutterStageView *view,
- ClutterFrame *frame);
-
-int64_t _clutter_stage_window_get_frame_counter (ClutterStageWindow *window);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_STAGE_WINDOW_H__ */
diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c
deleted file mode 100644
index fc170107f..000000000
--- a/clutter/clutter/clutter-stage.c
+++ /dev/null
@@ -1,3599 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- *
- * Copyright (C) 2006 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * SECTION:clutter-stage
- * @short_description: Top level visual element to which actors are placed.
- *
- * #ClutterStage is a top level 'window' on which child actors are placed
- * and manipulated.
- *
- * Backends might provide support for multiple stages. The support for this
- * feature can be checked at run-time using the clutter_feature_available()
- * function and the %CLUTTER_FEATURE_STAGE_MULTIPLE flag. If the backend used
- * supports multiple stages, new #ClutterStage instances can be created
- * using clutter_stage_new(). These stages must be managed by the developer
- * using clutter_actor_destroy(), which will take care of destroying all the
- * actors contained inside them.
- *
- * #ClutterStage is a proxy actor, wrapping the backend-specific implementation
- * (a #StageWindow) of the windowing system. It is possible to subclass
- * #ClutterStage, as long as every overridden virtual function chains up to the
- * parent class corresponding function.
- */
-
-#include "clutter-build-config.h"
-
-#include <math.h>
-#include <cairo-gobject.h>
-
-#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
-
-#include "clutter-stage.h"
-#include "deprecated/clutter-container.h"
-
-#include "clutter-actor-private.h"
-#include "clutter-backend-private.h"
-#include "clutter-cairo.h"
-#include "clutter-container.h"
-#include "clutter-debug.h"
-#include "clutter-enum-types.h"
-#include "clutter-event-private.h"
-#include "clutter-frame-clock.h"
-#include "clutter-id-pool.h"
-#include "clutter-input-device-private.h"
-#include "clutter-main.h"
-#include "clutter-marshal.h"
-#include "clutter-mutter.h"
-#include "clutter-paint-context-private.h"
-#include "clutter-paint-volume-private.h"
-#include "clutter-pick-context-private.h"
-#include "clutter-private.h"
-#include "clutter-stage-manager-private.h"
-#include "clutter-stage-private.h"
-#include "clutter-stage-view-private.h"
-#include "clutter-private.h"
-
-#include "cogl/cogl.h"
-
-#define MAX_FRUSTA 64
-
-typedef struct _QueueRedrawEntry
-{
- gboolean has_clip;
- ClutterPaintVolume clip;
-} QueueRedrawEntry;
-
-typedef struct _PickRecord
-{
- graphene_point_t vertex[4];
- ClutterActor *actor;
- int clip_stack_top;
-} PickRecord;
-
-typedef struct _PickClipRecord
-{
- int prev;
- graphene_point_t vertex[4];
-} PickClipRecord;
-
-typedef struct _PointerDeviceEntry
-{
- ClutterStage *stage;
- ClutterInputDevice *device;
- ClutterEventSequence *sequence;
- graphene_point_t coords;
- ClutterActor *current_actor;
-} PointerDeviceEntry;
-
-struct _ClutterStagePrivate
-{
- /* the stage implementation */
- ClutterStageWindow *impl;
-
- ClutterPerspective perspective;
- graphene_matrix_t projection;
- graphene_matrix_t inverse_projection;
- graphene_matrix_t view;
- float viewport[4];
-
- gchar *title;
- ClutterActor *key_focused_actor;
-
- GQueue *event_queue;
-
- GArray *paint_volume_stack;
-
- GSList *pending_relayouts;
- GHashTable *pending_queue_redraws;
-
- int update_freeze_count;
-
- gboolean needs_update_devices;
- gboolean pending_finish_queue_redraws;
-
- GHashTable *pointer_devices;
- GHashTable *touch_sequences;
-
- guint throttle_motion_events : 1;
- guint min_size_changed : 1;
- guint motion_events_enabled : 1;
- guint actor_needs_immediate_relayout : 1;
-};
-
-enum
-{
- PROP_0,
-
- PROP_PERSPECTIVE,
- PROP_TITLE,
- PROP_KEY_FOCUS,
- PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST] = { NULL, };
-
-enum
-{
- ACTIVATE,
- DEACTIVATE,
- DELETE_EVENT,
- BEFORE_UPDATE,
- BEFORE_PAINT,
- AFTER_PAINT,
- AFTER_UPDATE,
- PAINT_VIEW,
- PRESENTED,
- GL_VIDEO_MEMORY_PURGED,
-
- LAST_SIGNAL
-};
-
-static guint stage_signals[LAST_SIGNAL] = { 0, };
-
-static const ClutterColor default_stage_color = { 255, 255, 255, 255 };
-
-static void free_queue_redraw_entry (QueueRedrawEntry *entry);
-static void free_pointer_device_entry (PointerDeviceEntry *entry);
-static void clutter_stage_update_view_perspective (ClutterStage *stage);
-static void clutter_stage_set_viewport (ClutterStage *stage,
- float width,
- float height);
-
-G_DEFINE_TYPE_WITH_PRIVATE (ClutterStage, clutter_stage, CLUTTER_TYPE_ACTOR)
-
-static void
-clutter_stage_get_preferred_width (ClutterActor *self,
- gfloat for_height,
- gfloat *min_width_p,
- gfloat *natural_width_p)
-{
- ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
- cairo_rectangle_int_t geom;
-
- if (priv->impl == NULL)
- return;
-
- _clutter_stage_window_get_geometry (priv->impl, &geom);
-
- if (min_width_p)
- *min_width_p = geom.width;
-
- if (natural_width_p)
- *natural_width_p = geom.width;
-}
-
-static void
-clutter_stage_get_preferred_height (ClutterActor *self,
- gfloat for_width,
- gfloat *min_height_p,
- gfloat *natural_height_p)
-{
- ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
- cairo_rectangle_int_t geom;
-
- if (priv->impl == NULL)
- return;
-
- _clutter_stage_window_get_geometry (priv->impl, &geom);
-
- if (min_height_p)
- *min_height_p = geom.height;
-
- if (natural_height_p)
- *natural_height_p = geom.height;
-}
-
-static void
-clutter_stage_add_redraw_clip (ClutterStage *stage,
- cairo_rectangle_int_t *clip)
-{
- GList *l;
-
- for (l = clutter_stage_peek_stage_views (stage); l; l = l->next)
- {
- ClutterStageView *view = l->data;
-
- if (!clip)
- {
- clutter_stage_view_add_redraw_clip (view, NULL);
- }
- else
- {
- cairo_rectangle_int_t view_layout;
- cairo_rectangle_int_t intersection;
-
- clutter_stage_view_get_layout (view, &view_layout);
- if (_clutter_util_rectangle_intersection (&view_layout, clip,
- &intersection))
- clutter_stage_view_add_redraw_clip (view, &intersection);
- }
- }
-}
-
-static inline void
-queue_full_redraw (ClutterStage *stage)
-{
- ClutterStageWindow *stage_window;
-
- if (CLUTTER_ACTOR_IN_DESTRUCTION (stage))
- return;
-
- clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
-
- /* Just calling clutter_actor_queue_redraw will typically only
- * redraw the bounding box of the children parented on the stage but
- * in this case we really need to ensure that the full stage is
- * redrawn so we add a NULL redraw clip to the stage window. */
- stage_window = _clutter_stage_get_window (stage);
- if (stage_window == NULL)
- return;
-
- clutter_stage_add_redraw_clip (stage, NULL);
-}
-
-static void
-clutter_stage_allocate (ClutterActor *self,
- const ClutterActorBox *box)
-{
- ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
- ClutterActorBox alloc = CLUTTER_ACTOR_BOX_INIT_ZERO;
- float new_width, new_height;
- float width, height;
- cairo_rectangle_int_t window_size;
- ClutterLayoutManager *layout_manager = clutter_actor_get_layout_manager (self);
-
- if (priv->impl == NULL)
- return;
-
- /* the current allocation */
- clutter_actor_box_get_size (box, &width, &height);
-
- /* the current Stage implementation size */
- _clutter_stage_window_get_geometry (priv->impl, &window_size);
-
- /* if the stage is fixed size (for instance, it's using a EGL framebuffer)
- * then we simply ignore any allocation request and override the
- * allocation chain - because we cannot forcibly change the size of the
- * stage window.
- */
- if (!clutter_feature_available (CLUTTER_FEATURE_STAGE_STATIC))
- {
- ClutterActorBox children_box;
-
- children_box.x1 = children_box.y1 = 0.f;
- children_box.x2 = box->x2 - box->x1;
- children_box.y2 = box->y2 - box->y1;
-
- CLUTTER_NOTE (LAYOUT,
- "Following allocation to %.2fx%.2f",
- width, height);
-
- clutter_actor_set_allocation (self, box);
-
- clutter_layout_manager_allocate (layout_manager,
- CLUTTER_CONTAINER (self),
- &children_box);
-
- /* Ensure the window is sized correctly */
- if (priv->min_size_changed)
- {
- gfloat min_width, min_height;
- gboolean min_width_set, min_height_set;
-
- g_object_get (G_OBJECT (self),
- "min-width", &min_width,
- "min-width-set", &min_width_set,
- "min-height", &min_height,
- "min-height-set", &min_height_set,
- NULL);
-
- if (!min_width_set)
- min_width = 1;
- if (!min_height_set)
- min_height = 1;
-
- if (width < min_width)
- width = min_width;
- if (height < min_height)
- height = min_height;
-
- priv->min_size_changed = FALSE;
- }
-
- if (window_size.width != CLUTTER_NEARBYINT (width) ||
- window_size.height != CLUTTER_NEARBYINT (height))
- {
- _clutter_stage_window_resize (priv->impl,
- CLUTTER_NEARBYINT (width),
- CLUTTER_NEARBYINT (height));
- }
- }
- else
- {
- ClutterActorBox override = { 0, };
-
- /* override the passed allocation */
- override.x1 = 0;
- override.y1 = 0;
- override.x2 = window_size.width;
- override.y2 = window_size.height;
-
- CLUTTER_NOTE (LAYOUT,
- "Overriding original allocation of %.2fx%.2f "
- "with %.2fx%.2f",
- width, height,
- override.x2, override.y2);
-
- /* and store the overridden allocation */
- clutter_actor_set_allocation (self, &override);
-
- clutter_layout_manager_allocate (layout_manager,
- CLUTTER_CONTAINER (self),
- &override);
- }
-
- /* set the viewport to the new allocation */
- clutter_actor_get_allocation_box (self, &alloc);
- clutter_actor_box_get_size (&alloc, &new_width, &new_height);
-
- clutter_stage_set_viewport (CLUTTER_STAGE (self), new_width, new_height);
-}
-
-static void
-setup_clip_frustum (ClutterStage *stage,
- const cairo_rectangle_int_t *clip,
- graphene_frustum_t *frustum)
-{
- ClutterStagePrivate *priv = stage->priv;
- cairo_rectangle_int_t geom;
- graphene_point3d_t camera_position;
- graphene_point3d_t p[4];
- graphene_plane_t planes[6];
- graphene_vec4_t v;
- int i;
-
- _clutter_stage_window_get_geometry (priv->impl, &geom);
-
- CLUTTER_NOTE (CLIPPING, "Creating stage clip frustum for "
- "x=%d, y=%d, width=%d, height=%d",
- clip->x, clip->y, clip->width, clip->height);
-
- camera_position = GRAPHENE_POINT3D_INIT_ZERO;
-
- p[0] = GRAPHENE_POINT3D_INIT (MAX (clip->x, 0), MAX (clip->y, 0), 0.f);
- p[2] = GRAPHENE_POINT3D_INIT (MIN (clip->x + clip->width, geom.width),
- MIN (clip->y + clip->height, geom.height),
- 0.f);
-
- for (i = 0; i < 2; i++)
- {
- float w = 1.0;
- cogl_graphene_matrix_project_point (&priv->view,
- &p[2 * i].x,
- &p[2 * i].y,
- &p[2 * i].z,
- &w);
- }
-
- graphene_point3d_init (&p[1], p[2].x, p[0].y, p[0].z);
- graphene_point3d_init (&p[3], p[0].x, p[2].y, p[0].z);
-
- for (i = 0; i < 4; i++)
- {
- graphene_plane_init_from_points (&planes[i],
- &camera_position,
- &p[i],
- &p[(i + 1) % 4]);
- }
-
- graphene_vec4_init (&v, 0.f, 0.f, -1.f, priv->perspective.z_near);
- graphene_plane_init_from_vec4 (&planes[4], &v);
-
- graphene_vec4_init (&v, 0.f, 0.f, 1.f, priv->perspective.z_far);
- graphene_plane_init_from_vec4 (&planes[5], &v);
-
- graphene_frustum_init (frustum,
- &planes[0], &planes[1],
- &planes[2], &planes[3],
- &planes[4], &planes[5]);
-}
-
-static void
-clutter_stage_do_paint_view (ClutterStage *stage,
- ClutterStageView *view,
- const cairo_region_t *redraw_clip)
-{
- ClutterPaintContext *paint_context;
- cairo_rectangle_int_t clip_rect;
- g_autoptr (GArray) clip_frusta = NULL;
- graphene_frustum_t clip_frustum;
- int n_rectangles;
-
- n_rectangles = redraw_clip ? cairo_region_num_rectangles (redraw_clip) : 0;
- if (redraw_clip && n_rectangles < MAX_FRUSTA)
- {
- int i;
-
- clip_frusta = g_array_sized_new (FALSE, FALSE,
- sizeof (graphene_frustum_t),
- n_rectangles);
-
- for (i = 0; i < n_rectangles; i++)
- {
- cairo_region_get_rectangle (redraw_clip, i, &clip_rect);
- setup_clip_frustum (stage, &clip_rect, &clip_frustum);
- g_array_append_val (clip_frusta, clip_frustum);
- }
- }
- else
- {
- clip_frusta = g_array_sized_new (FALSE, FALSE,
- sizeof (graphene_frustum_t),
- 1);
- if (redraw_clip)
- cairo_region_get_extents (redraw_clip, &clip_rect);
- else
- clutter_stage_view_get_layout (view, &clip_rect);
-
- setup_clip_frustum (stage, &clip_rect, &clip_frustum);
- g_array_append_val (clip_frusta, clip_frustum);
- }
-
- _clutter_stage_paint_volume_stack_free_all (stage);
-
- paint_context = clutter_paint_context_new_for_view (view,
- redraw_clip,
- clip_frusta,
- CLUTTER_PAINT_FLAG_NONE);
-
- clutter_actor_paint (CLUTTER_ACTOR (stage), paint_context);
- clutter_paint_context_destroy (paint_context);
-}
-
-/* This provides a common point of entry for painting the scenegraph
- * for picking or painting...
- */
-void
-clutter_stage_paint_view (ClutterStage *stage,
- ClutterStageView *view,
- const cairo_region_t *redraw_clip)
-{
- ClutterStagePrivate *priv = stage->priv;
-
- if (!priv->impl)
- return;
-
- COGL_TRACE_BEGIN_SCOPED (ClutterStagePaintView, "Paint (view)");
-
- if (g_signal_has_handler_pending (stage, stage_signals[PAINT_VIEW],
- 0, TRUE))
- g_signal_emit (stage, stage_signals[PAINT_VIEW], 0, view, redraw_clip);
- else
- CLUTTER_STAGE_GET_CLASS (stage)->paint_view (stage, view, redraw_clip);
-}
-
-void
-clutter_stage_emit_before_update (ClutterStage *stage,
- ClutterStageView *view)
-{
- g_signal_emit (stage, stage_signals[BEFORE_UPDATE], 0, view);
-}
-
-void
-clutter_stage_emit_before_paint (ClutterStage *stage,
- ClutterStageView *view)
-{
- g_signal_emit (stage, stage_signals[BEFORE_PAINT], 0, view);
-}
-
-void
-clutter_stage_emit_after_paint (ClutterStage *stage,
- ClutterStageView *view)
-{
- g_signal_emit (stage, stage_signals[AFTER_PAINT], 0, view);
-}
-
-void
-clutter_stage_emit_after_update (ClutterStage *stage,
- ClutterStageView *view)
-{
- g_signal_emit (stage, stage_signals[AFTER_UPDATE], 0, view);
-}
-
-static gboolean
-clutter_stage_get_paint_volume (ClutterActor *self,
- ClutterPaintVolume *volume)
-{
- /* Returning False effectively means Clutter has to assume it covers
- * everything... */
- return FALSE;
-}
-
-static void
-clutter_stage_realize (ClutterActor *self)
-{
- ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
- gboolean is_realized;
-
- g_assert (priv->impl != NULL);
- is_realized = _clutter_stage_window_realize (priv->impl);
-
- if (!is_realized)
- CLUTTER_ACTOR_UNSET_FLAGS (self, CLUTTER_ACTOR_REALIZED);
-}
-
-static void
-clutter_stage_unrealize (ClutterActor *self)
-{
- ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
-
- /* and then unrealize the implementation */
- g_assert (priv->impl != NULL);
- _clutter_stage_window_unrealize (priv->impl);
-
- CLUTTER_ACTOR_UNSET_FLAGS (self, CLUTTER_ACTOR_REALIZED);
-}
-
-static void
-clutter_stage_show (ClutterActor *self)
-{
- ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
-
- CLUTTER_ACTOR_CLASS (clutter_stage_parent_class)->show (self);
-
- /* Possibly do an allocation run so that the stage will have the
- right size before we map it */
- clutter_stage_maybe_relayout (self);
-
- g_assert (priv->impl != NULL);
- _clutter_stage_window_show (priv->impl, TRUE);
-}
-
-static void
-clutter_stage_hide_all (ClutterActor *self)
-{
- ClutterActorIter iter;
- ClutterActor *child;
-
- clutter_actor_hide (self);
-
- /* we don't do a recursive hide_all(), to maintain the old invariants
- * from ClutterGroup
- */
- clutter_actor_iter_init (&iter, self);
- while (clutter_actor_iter_next (&iter, &child))
- clutter_actor_hide (child);
-}
-
-static void
-clutter_stage_hide (ClutterActor *self)
-{
- ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
-
- g_assert (priv->impl != NULL);
- _clutter_stage_window_hide (priv->impl);
-
- CLUTTER_ACTOR_CLASS (clutter_stage_parent_class)->hide (self);
-}
-
-static void
-clutter_stage_emit_key_focus_event (ClutterStage *stage,
- gboolean focus_in)
-{
- ClutterStagePrivate *priv = stage->priv;
-
- if (priv->key_focused_actor == NULL)
- return;
-
- _clutter_actor_set_has_key_focus (CLUTTER_ACTOR (stage), focus_in);
-
- g_object_notify_by_pspec (G_OBJECT (stage), obj_props[PROP_KEY_FOCUS]);
-}
-
-static void
-clutter_stage_real_activate (ClutterStage *stage)
-{
- clutter_stage_emit_key_focus_event (stage, TRUE);
-}
-
-static void
-clutter_stage_real_deactivate (ClutterStage *stage)
-{
- clutter_stage_emit_key_focus_event (stage, FALSE);
-}
-
-void
-_clutter_stage_queue_event (ClutterStage *stage,
- ClutterEvent *event,
- gboolean copy_event)
-{
- ClutterStagePrivate *priv;
- gboolean first_event;
-
- g_return_if_fail (CLUTTER_IS_STAGE (stage));
-
- priv = stage->priv;
-
- first_event = priv->event_queue->length == 0;
-
- if (copy_event)
- event = clutter_event_copy (event);
-
- if (first_event)
- {
- gboolean compressible = event->type == CLUTTER_MOTION ||
- event->type == CLUTTER_TOUCH_UPDATE;
-
- if (!compressible)
- {
- _clutter_process_event (event);
- clutter_event_free (event);
- return;
- }
- }
-
- g_queue_push_tail (priv->event_queue, event);
-
- if (first_event)
- clutter_stage_schedule_update (stage);
-}
-
-gboolean
-_clutter_stage_has_queued_events (ClutterStage *stage)
-{
- ClutterStagePrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
-
- priv = stage->priv;
-
- return priv->event_queue->length > 0;
-}
-
-static void
-clutter_stage_compress_motion (ClutterStage *stage,
- ClutterEvent *event,
- const ClutterEvent *to_discard)
-{
- double dx, dy;
- double dx_unaccel, dy_unaccel;
- double dst_dx = 0.0, dst_dy = 0.0;
- double dst_dx_unaccel = 0.0, dst_dy_unaccel = 0.0;
-
- if (!clutter_event_get_relative_motion (to_discard,
- &dx, &dy,
- &dx_unaccel, &dy_unaccel))
- return;
-
- clutter_event_get_relative_motion (event,
- &dst_dx, &dst_dy,
- &dst_dx_unaccel, &dst_dy_unaccel);
-
- event->motion.flags |= CLUTTER_EVENT_FLAG_RELATIVE_MOTION;
- event->motion.dx = dx + dst_dx;
- event->motion.dy = dy + dst_dy;
- event->motion.dx_unaccel = dx_unaccel + dst_dx_unaccel;
- event->motion.dy_unaccel = dy_unaccel + dst_dy_unaccel;
-}
-
-void
-_clutter_stage_process_queued_events (ClutterStage *stage)
-{
- ClutterStagePrivate *priv;
- GList *events, *l;
-
- g_return_if_fail (CLUTTER_IS_STAGE (stage));
-
- priv = stage->priv;
-
- if (priv->event_queue->length == 0)
- return;
-
- /* In case the stage gets destroyed during event processing */
- g_object_ref (stage);
-
- /* Steal events before starting processing to avoid reentrancy
- * issues */
- events = priv->event_queue->head;
- priv->event_queue->head = NULL;
- priv->event_queue->tail = NULL;
- priv->event_queue->length = 0;
-
- for (l = events; l != NULL; l = l->next)
- {
- ClutterEvent *event;
- ClutterEvent *next_event;
- ClutterInputDevice *device;
- ClutterInputDevice *next_device;
- ClutterInputDeviceType device_type;
- gboolean check_device = FALSE;
-
- event = l->data;
- next_event = l->next ? l->next->data : NULL;
-
- device = clutter_event_get_device (event);
-
- if (next_event != NULL)
- next_device = clutter_event_get_device (next_event);
- else
- next_device = NULL;
-
- if (device != NULL && next_device != NULL)
- check_device = TRUE;
-
- device_type = clutter_input_device_get_device_type (device);
-
- /* Skip consecutive motion events coming from the same device,
- * except those of tablet tools, since users of these events
- * want no precision loss.
- */
- if (priv->throttle_motion_events && next_event != NULL &&
- device_type != CLUTTER_TABLET_DEVICE &&
- device_type != CLUTTER_PEN_DEVICE &&
- device_type != CLUTTER_ERASER_DEVICE)
- {
- if (event->type == CLUTTER_MOTION &&
- (next_event->type == CLUTTER_MOTION ||
- next_event->type == CLUTTER_LEAVE) &&
- (!check_device || (device == next_device)))
- {
- CLUTTER_NOTE (EVENT,
- "Omitting motion event at %d, %d",
- (int) event->motion.x,
- (int) event->motion.y);
-
- if (next_event->type == CLUTTER_MOTION)
- clutter_stage_compress_motion (stage, next_event, event);
-
- goto next_event;
- }
- else if (event->type == CLUTTER_TOUCH_UPDATE &&
- next_event->type == CLUTTER_TOUCH_UPDATE &&
- event->touch.sequence == next_event->touch.sequence &&
- (!check_device || (device == next_device)))
- {
- CLUTTER_NOTE (EVENT,
- "Omitting touch update event at %d, %d",
- (int) event->touch.x,
- (int) event->touch.y);
- goto next_event;
- }
- }
-
- _clutter_process_event (event);
-
- next_event:
- clutter_event_free (event);
- }
-
- g_list_free (events);
-
- g_object_unref (stage);
-}
-
-void
-clutter_stage_queue_actor_relayout (ClutterStage *stage,
- ClutterActor *actor)
-{
- ClutterStagePrivate *priv = stage->priv;
-
- if (priv->pending_relayouts == NULL)
- clutter_stage_schedule_update (stage);
-
- priv->pending_relayouts = g_slist_prepend (priv->pending_relayouts,
- g_object_ref (actor));
-}
-
-void
-clutter_stage_dequeue_actor_relayout (ClutterStage *stage,
- ClutterActor *actor)
-{
- ClutterStagePrivate *priv = stage->priv;
- GSList *l;
-
- for (l = priv->pending_relayouts; l; l = l->next)
- {
- ClutterActor *relayout_actor = l->data;
-
- if (relayout_actor == actor)
- {
- g_object_unref (relayout_actor);
- priv->pending_relayouts =
- g_slist_delete_link (priv->pending_relayouts, l);
-
- return;
- }
- }
-}
-
-void
-clutter_stage_maybe_relayout (ClutterActor *actor)
-{
- ClutterStage *stage = CLUTTER_STAGE (actor);
- ClutterStagePrivate *priv = stage->priv;
- g_autoptr (GSList) stolen_list = NULL;
- GSList *l;
- int count = 0;
-
- /* No work to do? Avoid the extraneous debug log messages too. */
- if (priv->pending_relayouts == NULL)
- return;
-
- COGL_TRACE_BEGIN_SCOPED (ClutterStageRelayout, "Layout");
-
- CLUTTER_NOTE (ACTOR, ">>> Recomputing layout");
-
- stolen_list = g_steal_pointer (&priv->pending_relayouts);
- for (l = stolen_list; l; l = l->next)
- {
- g_autoptr (ClutterActor) queued_actor = l->data;
- float x = 0.f;
- float y = 0.f;
-
- if (CLUTTER_ACTOR_IN_RELAYOUT (queued_actor)) /* avoid reentrancy */
- continue;
-
- if (queued_actor == actor)
- CLUTTER_NOTE (ACTOR, " Deep relayout of stage %s",
- _clutter_actor_get_debug_name (queued_actor));
- else
- CLUTTER_NOTE (ACTOR, " Shallow relayout of actor %s",
- _clutter_actor_get_debug_name (queued_actor));
-
- CLUTTER_SET_PRIVATE_FLAGS (queued_actor, CLUTTER_IN_RELAYOUT);
-
- clutter_actor_get_fixed_position (queued_actor, &x, &y);
- clutter_actor_allocate_preferred_size (queued_actor, x, y);
-
- CLUTTER_UNSET_PRIVATE_FLAGS (queued_actor, CLUTTER_IN_RELAYOUT);
-
- count++;
- }
-
- CLUTTER_NOTE (ACTOR, "<<< Completed recomputing layout of %d subtrees", count);
-
- if (count)
- priv->needs_update_devices = TRUE;
-}
-
-GSList *
-clutter_stage_find_updated_devices (ClutterStage *stage)
-{
- ClutterStagePrivate *priv = stage->priv;
- GSList *updating = NULL;
- GHashTableIter iter;
- gpointer value;
-
- if (!priv->needs_update_devices)
- return NULL;
-
- priv->needs_update_devices = FALSE;
-
- g_hash_table_iter_init (&iter, priv->pointer_devices);
- while (g_hash_table_iter_next (&iter, NULL, &value))
- {
- PointerDeviceEntry *entry = value;
- ClutterStageView *view;
- const cairo_region_t *clip;
-
- view = clutter_stage_get_view_at (stage, entry->coords.x, entry->coords.y);
- if (!view)
- continue;
-
- clip = clutter_stage_view_peek_redraw_clip (view);
- if (!clip || cairo_region_contains_point (clip, entry->coords.x, entry->coords.y))
- updating = g_slist_prepend (updating, entry->device);
- }
-
- return updating;
-}
-
-void
-clutter_stage_finish_layout (ClutterStage *stage)
-{
- ClutterActor *actor = CLUTTER_ACTOR (stage);
- ClutterStagePrivate *priv = stage->priv;
- int phase;
-
- COGL_TRACE_BEGIN_SCOPED (ClutterStageUpdateActorStageViews,
- "Actor stage-views");
-
- /* If an actor needs an immediate relayout because its resource scale
- * changed, we give it another chance to allocate correctly before
- * the paint.
- *
- * We're doing the whole thing twice and pass the phase to
- * clutter_actor_finish_layout() to allow actors to detect loops:
- * If the resource scale changes again after the relayout, the new
- * allocation of an actor probably moved the actor onto another stage
- * view, so if an actor sees phase == 1, it can choose a "final" scale.
- */
- for (phase = 0; phase < 2; phase++)
- {
- clutter_actor_finish_layout (actor, phase);
-
- if (!priv->actor_needs_immediate_relayout)
- break;
-
- priv->actor_needs_immediate_relayout = FALSE;
- clutter_stage_maybe_relayout (actor);
- clutter_stage_maybe_finish_queue_redraws (stage);
- }
-
- g_warn_if_fail (!priv->actor_needs_immediate_relayout);
-}
-
-void
-clutter_stage_update_devices (ClutterStage *stage,
- GSList *devices)
-{
- ClutterStagePrivate *priv = stage->priv;
- GSList *l;
-
- COGL_TRACE_BEGIN (ClutterStageUpdateDevices, "UpdateDevices");
-
- for (l = devices; l; l = l->next)
- {
- ClutterInputDevice *device = l->data;
- PointerDeviceEntry *entry = NULL;
- ClutterActor *new_actor;
-
- entry = g_hash_table_lookup (priv->pointer_devices, device);
- g_assert (entry != NULL);
-
- new_actor = _clutter_stage_do_pick (stage,
- entry->coords.x,
- entry->coords.y,
- CLUTTER_PICK_REACTIVE);
-
- clutter_stage_update_device (stage,
- device, NULL,
- entry->coords,
- CLUTTER_CURRENT_TIME,
- new_actor,
- TRUE);
- }
-}
-
-static void
-clutter_stage_real_queue_relayout (ClutterActor *self)
-{
- ClutterStage *stage = CLUTTER_STAGE (self);
- ClutterActorClass *parent_class;
-
- clutter_stage_queue_actor_relayout (stage, self);
-
- /* chain up */
- parent_class = CLUTTER_ACTOR_CLASS (clutter_stage_parent_class);
- parent_class->queue_relayout (self);
-}
-
-static gboolean
-is_full_stage_redraw_queued (ClutterStage *stage)
-{
- GList *l;
-
- for (l = clutter_stage_peek_stage_views (stage); l; l = l->next)
- {
- ClutterStageView *view = l->data;
-
- if (!clutter_stage_view_has_full_redraw_clip (view))
- return FALSE;
- }
-
- return TRUE;
-}
-
-gboolean
-_clutter_stage_has_full_redraw_queued (ClutterStage *stage)
-{
- if (CLUTTER_ACTOR_IN_DESTRUCTION (stage))
- return FALSE;
-
- return is_full_stage_redraw_queued (stage);
-}
-
-static void
-setup_ray_for_coordinates (ClutterStage *stage,
- float x,
- float y,
- graphene_point3d_t *point,
- graphene_ray_t *ray)
-{
- ClutterStagePrivate *priv = stage->priv;
- graphene_point3d_t camera_position;
- graphene_point3d_t p;
- graphene_vec3_t direction;
- graphene_vec3_t cv;
- graphene_vec3_t v;
-
- camera_position = GRAPHENE_POINT3D_INIT_ZERO;
- graphene_vec3_init (&cv,
- camera_position.x,
- camera_position.y,
- camera_position.z);
-
- p = GRAPHENE_POINT3D_INIT (x, y, 0.f);
- graphene_matrix_transform_point3d (&priv->view, &p, &p);
-
- graphene_vec3_init (&v, p.x, p.y, p.z);
- graphene_vec3_subtract (&v, &cv, &direction);
- graphene_vec3_normalize (&direction, &direction);
-
- graphene_ray_init (ray, &camera_position, &direction);
- graphene_point3d_init_from_point (point, &p);
-}
-
-static ClutterActor *
-_clutter_stage_do_pick_on_view (ClutterStage *stage,
- float x,
- float y,
- ClutterPickMode mode,
- ClutterStageView *view)
-{
- g_autoptr (ClutterPickStack) pick_stack = NULL;
- ClutterPickContext *pick_context;
- graphene_point3d_t p;
- graphene_ray_t ray;
- ClutterActor *actor;
-
- COGL_TRACE_BEGIN_SCOPED (ClutterStagePickView, "Pick (view)");
-
- setup_ray_for_coordinates (stage, x, y, &p, &ray);
-
- pick_context = clutter_pick_context_new_for_view (view, mode, &p, &ray);
-
- clutter_actor_pick (CLUTTER_ACTOR (stage), pick_context);
- pick_stack = clutter_pick_context_steal_stack (pick_context);
- clutter_pick_context_destroy (pick_context);
-
- actor = clutter_pick_stack_search_actor (pick_stack, &p, &ray);
- return actor ? actor : CLUTTER_ACTOR (stage);
-}
-
-/**
- * clutter_stage_get_view_at: (skip)
- */
-ClutterStageView *
-clutter_stage_get_view_at (ClutterStage *stage,
- float x,
- float y)
-{
- ClutterStagePrivate *priv = stage->priv;
- GList *l;
-
- for (l = _clutter_stage_window_get_views (priv->impl); l; l = l->next)
- {
- ClutterStageView *view = l->data;
- cairo_rectangle_int_t view_layout;
-
- clutter_stage_view_get_layout (view, &view_layout);
- if (x >= view_layout.x &&
- x < view_layout.x + view_layout.width &&
- y >= view_layout.y &&
- y < view_layout.y + view_layout.height)
- return view;
- }
-
- return NULL;
-}
-
-ClutterActor *
-_clutter_stage_do_pick (ClutterStage *stage,
- float x,
- float y,
- ClutterPickMode mode)
-{
- ClutterActor *actor = CLUTTER_ACTOR (stage);
- ClutterStagePrivate *priv = stage->priv;
- float stage_width, stage_height;
- ClutterStageView *view = NULL;
-
- priv = stage->priv;
-
- if (CLUTTER_ACTOR_IN_DESTRUCTION (stage))
- return actor;
-
- if (G_UNLIKELY (clutter_pick_debug_flags & CLUTTER_DEBUG_NOP_PICKING))
- return actor;
-
- if (G_UNLIKELY (priv->impl == NULL))
- return actor;
-
- clutter_actor_get_size (CLUTTER_ACTOR (stage), &stage_width, &stage_height);
- if (x < 0 || x >= stage_width || y < 0 || y >= stage_height)
- return actor;
-
- view = clutter_stage_get_view_at (stage, x, y);
- if (view)
- return _clutter_stage_do_pick_on_view (stage, x, y, mode, view);
-
- return actor;
-}
-
-static void
-clutter_stage_real_apply_transform (ClutterActor *stage,
- graphene_matrix_t *matrix)
-{
- ClutterStagePrivate *priv = CLUTTER_STAGE (stage)->priv;
-
- /* FIXME: we probably shouldn't be explicitly resetting the matrix
- * here... */
- graphene_matrix_init_from_matrix (matrix, &priv->view);
-}
-
-static void
-clutter_stage_constructed (GObject *gobject)
-{
- ClutterStage *self = CLUTTER_STAGE (gobject);
- ClutterStageManager *stage_manager;
-
- stage_manager = clutter_stage_manager_get_default ();
-
- /* this will take care to sinking the floating reference */
- _clutter_stage_manager_add_stage (stage_manager, self);
-
- /* if this stage has been created on a backend that does not
- * support multiple stages then it becomes the default stage
- * as well; any other attempt at creating a ClutterStage will
- * fail.
- */
- if (!clutter_feature_available (CLUTTER_FEATURE_STAGE_MULTIPLE))
- {
- if (G_UNLIKELY (clutter_stage_manager_get_default_stage (stage_manager) != NULL))
- {
- g_error ("Unable to create another stage: the backend of "
- "type '%s' does not support multiple stages. Use "
- "clutter_stage_manager_get_default_stage() instead "
- "to access the stage singleton.",
- G_OBJECT_TYPE_NAME (clutter_get_default_backend ()));
- }
-
- _clutter_stage_manager_set_default_stage (stage_manager, self);
- }
-
- G_OBJECT_CLASS (clutter_stage_parent_class)->constructed (gobject);
-}
-
-static void
-clutter_stage_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterStage *stage = CLUTTER_STAGE (object);
-
- switch (prop_id)
- {
- case PROP_TITLE:
- clutter_stage_set_title (stage, g_value_get_string (value));
- break;
-
- case PROP_KEY_FOCUS:
- clutter_stage_set_key_focus (stage, g_value_get_object (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_stage_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterStagePrivate *priv = CLUTTER_STAGE (gobject)->priv;
-
- switch (prop_id)
- {
- case PROP_PERSPECTIVE:
- g_value_set_boxed (value, &priv->perspective);
- break;
-
- case PROP_TITLE:
- g_value_set_string (value, priv->title);
- break;
-
- case PROP_KEY_FOCUS:
- g_value_set_object (value, priv->key_focused_actor);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_stage_dispose (GObject *object)
-{
- ClutterStage *stage = CLUTTER_STAGE (object);
- ClutterStagePrivate *priv = stage->priv;
- ClutterStageManager *stage_manager;
-
- clutter_actor_hide (CLUTTER_ACTOR (object));
-
- _clutter_clear_events_queue ();
-
- if (priv->impl != NULL)
- {
- CLUTTER_NOTE (BACKEND, "Disposing of the stage implementation");
-
- if (CLUTTER_ACTOR_IS_REALIZED (object))
- _clutter_stage_window_unrealize (priv->impl);
-
- g_object_unref (priv->impl);
- priv->impl = NULL;
- }
-
- clutter_actor_destroy_all_children (CLUTTER_ACTOR (object));
-
- g_hash_table_remove_all (priv->pending_queue_redraws);
-
- g_slist_free_full (priv->pending_relayouts,
- (GDestroyNotify) g_object_unref);
- priv->pending_relayouts = NULL;
-
- /* this will release the reference on the stage */
- stage_manager = clutter_stage_manager_get_default ();
- _clutter_stage_manager_remove_stage (stage_manager, stage);
-
- G_OBJECT_CLASS (clutter_stage_parent_class)->dispose (object);
-}
-
-static void
-clutter_stage_finalize (GObject *object)
-{
- ClutterStage *stage = CLUTTER_STAGE (object);
- ClutterStagePrivate *priv = stage->priv;
-
- g_queue_foreach (priv->event_queue, (GFunc) clutter_event_free, NULL);
- g_queue_free (priv->event_queue);
-
- g_hash_table_destroy (priv->pointer_devices);
- g_hash_table_destroy (priv->touch_sequences);
-
- g_free (priv->title);
-
- g_array_free (priv->paint_volume_stack, TRUE);
-
- G_OBJECT_CLASS (clutter_stage_parent_class)->finalize (object);
-}
-
-static void
-clutter_stage_real_paint_view (ClutterStage *stage,
- ClutterStageView *view,
- const cairo_region_t *redraw_clip)
-{
- clutter_stage_do_paint_view (stage, view, redraw_clip);
-}
-
-static void
-clutter_stage_paint (ClutterActor *actor,
- ClutterPaintContext *paint_context)
-{
- ClutterStageView *view;
-
- CLUTTER_ACTOR_CLASS (clutter_stage_parent_class)->paint (actor, paint_context);
-
- view = clutter_paint_context_get_stage_view (paint_context);
- if (view &&
- G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_MAX_RENDER_TIME))
- {
- cairo_rectangle_int_t view_layout;
- ClutterFrameClock *frame_clock;
- g_autoptr (GString) string = NULL;
- PangoLayout *layout;
- PangoRectangle logical;
- ClutterColor color;
- g_autoptr (ClutterPaintNode) node = NULL;
- ClutterActorBox box;
-
- clutter_stage_view_get_layout (view, &view_layout);
- frame_clock = clutter_stage_view_get_frame_clock (view);
-
- string = clutter_frame_clock_get_max_render_time_debug_info (frame_clock);
-
- layout = clutter_actor_create_pango_layout (actor, string->str);
- pango_layout_set_alignment (layout, PANGO_ALIGN_RIGHT);
- pango_layout_get_pixel_extents (layout, NULL, &logical);
-
- clutter_color_init (&color, 255, 255, 255, 255);
- node = clutter_text_node_new (layout, &color);
-
- box.x1 = view_layout.x;
- box.y1 = view_layout.y + 30;
- box.x2 = box.x1 + logical.width;
- box.y2 = box.y1 + logical.height;
- clutter_paint_node_add_rectangle (node, &box);
-
- clutter_paint_node_paint (node, paint_context);
-
- g_object_unref (layout);
- }
-}
-
-static void
-clutter_stage_class_init (ClutterStageClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
-
- gobject_class->constructed = clutter_stage_constructed;
- gobject_class->set_property = clutter_stage_set_property;
- gobject_class->get_property = clutter_stage_get_property;
- gobject_class->dispose = clutter_stage_dispose;
- gobject_class->finalize = clutter_stage_finalize;
-
- actor_class->allocate = clutter_stage_allocate;
- actor_class->get_preferred_width = clutter_stage_get_preferred_width;
- actor_class->get_preferred_height = clutter_stage_get_preferred_height;
- actor_class->get_paint_volume = clutter_stage_get_paint_volume;
- actor_class->realize = clutter_stage_realize;
- actor_class->unrealize = clutter_stage_unrealize;
- actor_class->show = clutter_stage_show;
- actor_class->hide = clutter_stage_hide;
- actor_class->hide_all = clutter_stage_hide_all;
- actor_class->queue_relayout = clutter_stage_real_queue_relayout;
- actor_class->apply_transform = clutter_stage_real_apply_transform;
- actor_class->paint = clutter_stage_paint;
-
- klass->paint_view = clutter_stage_real_paint_view;
-
- /**
- * ClutterStage:perspective:
- *
- * The parameters used for the perspective projection from 3D
- * coordinates to 2D
- *
- * Since: 0.8
- */
- obj_props[PROP_PERSPECTIVE] =
- g_param_spec_boxed ("perspective",
- P_("Perspective"),
- P_("Perspective projection parameters"),
- CLUTTER_TYPE_PERSPECTIVE,
- CLUTTER_PARAM_READABLE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterStage:title:
- *
- * The stage's title - usually displayed in stage windows title decorations.
- *
- * Since: 0.4
- */
- obj_props[PROP_TITLE] =
- g_param_spec_string ("title",
- P_("Title"),
- P_("Stage Title"),
- NULL,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- /**
- * ClutterStage:key-focus:
- *
- * The #ClutterActor that will receive key events from the underlying
- * windowing system.
- *
- * If %NULL, the #ClutterStage will receive the events.
- *
- * Since: 1.2
- */
- obj_props[PROP_KEY_FOCUS] =
- g_param_spec_object ("key-focus",
- P_("Key Focus"),
- P_("The currently key focused actor"),
- CLUTTER_TYPE_ACTOR,
- CLUTTER_PARAM_READWRITE |
- G_PARAM_EXPLICIT_NOTIFY);
-
- g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
-
- /**
- * ClutterStage::activate:
- * @stage: the stage which was activated
- *
- * The ::activate signal is emitted when the stage receives key focus
- * from the underlying window system.
- *
- * Since: 0.6
- */
- stage_signals[ACTIVATE] =
- g_signal_new (I_("activate"),
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterStageClass, activate),
- NULL, NULL, NULL,
- G_TYPE_NONE, 0);
- /**
- * ClutterStage::deactivate:
- * @stage: the stage which was deactivated
- *
- * The ::deactivate signal is emitted when the stage loses key focus
- * from the underlying window system.
- *
- * Since: 0.6
- */
- stage_signals[DEACTIVATE] =
- g_signal_new (I_("deactivate"),
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterStageClass, deactivate),
- NULL, NULL, NULL,
- G_TYPE_NONE, 0);
-
- /**
- * ClutterStage::before-update:
- * @stage: the #ClutterStage
- * @view: a #ClutterStageView
- */
- stage_signals[BEFORE_UPDATE] =
- g_signal_new (I_("before-update"),
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL, NULL,
- G_TYPE_NONE, 1,
- CLUTTER_TYPE_STAGE_VIEW);
-
- /**
- * ClutterStage::before-paint:
- * @stage: the stage that received the event
- * @view: a #ClutterStageView
- *
- * The ::before-paint signal is emitted before the stage is painted.
- */
- stage_signals[BEFORE_PAINT] =
- g_signal_new (I_("before-paint"),
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterStageClass, before_paint),
- NULL, NULL, NULL,
- G_TYPE_NONE, 1,
- CLUTTER_TYPE_STAGE_VIEW);
- /**
- * ClutterStage::after-paint:
- * @stage: the stage that received the event
- * @view: a #ClutterStageView
- *
- * The ::after-paint signal is emitted after the stage is painted,
- * but before the results are displayed on the screen.
- *
- * Since: 1.20
- */
- stage_signals[AFTER_PAINT] =
- g_signal_new (I_("after-paint"),
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_LAST,
- 0, /* no corresponding vfunc */
- NULL, NULL, NULL,
- G_TYPE_NONE, 1,
- CLUTTER_TYPE_STAGE_VIEW);
-
- /**
- * ClutterStage::after-update:
- * @stage: the #ClutterStage
- * @view: a #ClutterStageView
- */
- stage_signals[AFTER_UPDATE] =
- g_signal_new (I_("after-update"),
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL, NULL,
- G_TYPE_NONE, 1,
- CLUTTER_TYPE_STAGE_VIEW);
-
- /**
- * ClutterStage::paint-view:
- * @stage: the stage that received the event
- * @view: a #ClutterStageView
- * @redraw_clip: a #cairo_region_t with the redraw clip
- *
- * The ::paint-view signal is emitted before a #ClutterStageView is being
- * painted.
- *
- * The view is painted in the default handler. Hence, if you want to perform
- * some action after the view is painted, like reading the contents of the
- * framebuffer, use g_signal_connect_after() or pass %G_CONNECT_AFTER.
- */
- stage_signals[PAINT_VIEW] =
- g_signal_new (I_("paint-view"),
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterStageClass, paint_view),
- NULL, NULL, NULL,
- G_TYPE_NONE, 2,
- CLUTTER_TYPE_STAGE_VIEW,
- CAIRO_GOBJECT_TYPE_REGION);
-
- /**
- * ClutterStage::presented: (skip)
- * @stage: the stage that received the event
- * @view: the #ClutterStageView presented
- * @frame_info: a #ClutterFrameInfo
- *
- * Signals that the #ClutterStage was presented on the screen to the user.
- */
- stage_signals[PRESENTED] =
- g_signal_new (I_("presented"),
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL, NULL,
- G_TYPE_NONE, 2,
- CLUTTER_TYPE_STAGE_VIEW,
- G_TYPE_POINTER);
-
- /**
- * ClutterStage::gl-video-memory-purged: (skip)
- * @stage: the stage that received the event
- *
- * Signals that the underlying GL driver has had its texture memory purged
- * so anything presently held in texture memory is now invalidated, and
- * likely corrupt. It needs redrawing.
- */
- stage_signals[GL_VIDEO_MEMORY_PURGED] =
- g_signal_new (I_("gl-video-memory-purged"),
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL, NULL,
- G_TYPE_NONE, 0);
-
- klass->activate = clutter_stage_real_activate;
- klass->deactivate = clutter_stage_real_deactivate;
-}
-
-static void
-clutter_stage_notify_min_size (ClutterStage *self)
-{
- self->priv->min_size_changed = TRUE;
-}
-
-static void
-clutter_stage_init (ClutterStage *self)
-{
- cairo_rectangle_int_t geom = { 0, };
- ClutterStagePrivate *priv;
- ClutterStageWindow *impl;
- ClutterBackend *backend;
- GError *error;
-
- /* a stage is a top-level object */
- CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IS_TOPLEVEL);
-
- self->priv = priv = clutter_stage_get_instance_private (self);
-
- CLUTTER_NOTE (BACKEND, "Creating stage from the default backend");
- backend = clutter_get_default_backend ();
-
- error = NULL;
- impl = _clutter_backend_create_stage (backend, self, &error);
-
- if (G_LIKELY (impl != NULL))
- {
- _clutter_stage_set_window (self, impl);
- _clutter_stage_window_get_geometry (priv->impl, &geom);
- }
- else
- {
- if (error != NULL)
- {
- g_critical ("Unable to create a new stage implementation: %s",
- error->message);
- g_error_free (error);
- }
- else
- g_critical ("Unable to create a new stage implementation.");
- }
-
- priv->event_queue = g_queue_new ();
-
- priv->throttle_motion_events = TRUE;
- priv->min_size_changed = FALSE;
- priv->motion_events_enabled = TRUE;
-
- priv->pointer_devices =
- g_hash_table_new_full (NULL, NULL,
- NULL, (GDestroyNotify) free_pointer_device_entry);
- priv->touch_sequences =
- g_hash_table_new_full (NULL, NULL,
- NULL, (GDestroyNotify) free_pointer_device_entry);
-
- clutter_actor_set_background_color (CLUTTER_ACTOR (self),
- &default_stage_color);
-
- clutter_stage_queue_actor_relayout (self, CLUTTER_ACTOR (self));
-
- clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE);
- clutter_stage_set_title (self, g_get_prgname ());
- clutter_stage_set_key_focus (self, NULL);
-
- g_signal_connect (self, "notify::min-width",
- G_CALLBACK (clutter_stage_notify_min_size), NULL);
- g_signal_connect (self, "notify::min-height",
- G_CALLBACK (clutter_stage_notify_min_size), NULL);
-
- clutter_stage_set_viewport (self, geom.width, geom.height);
-
- priv->pending_queue_redraws =
- g_hash_table_new_full (NULL, NULL,
- g_object_unref,
- (GDestroyNotify) free_queue_redraw_entry);
-
- priv->paint_volume_stack =
- g_array_new (FALSE, FALSE, sizeof (ClutterPaintVolume));
-}
-
-static void
-clutter_stage_set_perspective (ClutterStage *stage,
- ClutterPerspective *perspective)
-{
- ClutterStagePrivate *priv = stage->priv;
-
- if (priv->perspective.fovy == perspective->fovy &&
- priv->perspective.aspect == perspective->aspect &&
- priv->perspective.z_near == perspective->z_near &&
- priv->perspective.z_far == perspective->z_far)
- return;
-
- priv->perspective = *perspective;
-
- graphene_matrix_init_perspective (&priv->projection,
- priv->perspective.fovy,
- priv->perspective.aspect,
- priv->perspective.z_near,
- priv->perspective.z_far);
- graphene_matrix_inverse (&priv->projection,
- &priv->inverse_projection);
-
- _clutter_stage_dirty_projection (stage);
- clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
-}
-
-/**
- * clutter_stage_get_perspective:
- * @stage: A #ClutterStage
- * @perspective: (out caller-allocates) (allow-none): return location for a
- * #ClutterPerspective
- *
- * Retrieves the stage perspective.
- */
-void
-clutter_stage_get_perspective (ClutterStage *stage,
- ClutterPerspective *perspective)
-{
- g_return_if_fail (CLUTTER_IS_STAGE (stage));
- g_return_if_fail (perspective != NULL);
-
- *perspective = stage->priv->perspective;
-}
-
-/*
- * clutter_stage_get_projection_matrix:
- * @stage: A #ClutterStage
- * @projection: return location for a #graphene_matrix_t representing the
- * perspective projection applied to actors on the given
- * @stage.
- *
- * Retrieves the @stage's projection matrix. This is derived from the
- * current perspective.
- *
- * Since: 1.6
- */
-void
-_clutter_stage_get_projection_matrix (ClutterStage *stage,
- graphene_matrix_t *projection)
-{
- g_return_if_fail (CLUTTER_IS_STAGE (stage));
- g_return_if_fail (projection != NULL);
-
- *projection = stage->priv->projection;
-}
-
-/* This simply provides a simple mechanism for us to ensure that
- * the projection matrix gets re-asserted before painting.
- *
- * This is used when switching between multiple stages */
-void
-_clutter_stage_dirty_projection (ClutterStage *stage)
-{
- ClutterStagePrivate *priv;
- GList *l;
-
- g_return_if_fail (CLUTTER_IS_STAGE (stage));
-
- priv = stage->priv;
-
- for (l = _clutter_stage_window_get_views (priv->impl); l; l = l->next)
- {
- ClutterStageView *view = l->data;
-
- clutter_stage_view_invalidate_projection (view);
- }
-}
-
-/*
- * clutter_stage_set_viewport:
- * @stage: A #ClutterStage
- * @width: The width to render the stage at, in window coordinates
- * @height: The height to render the stage at, in window coordinates
- *
- * Sets the stage viewport. The viewport defines a final scale and
- * translation of your rendered stage and actors. This lets you render
- * your stage into a subregion of the stage window or you could use it to
- * pan a subregion of the stage if your stage window is smaller then
- * the stage. (XXX: currently this isn't possible)
- *
- * Unlike a scale and translation done using the modelview matrix this
- * is done after everything has had perspective projection applied, so
- * for example if you were to pan across a subregion of the stage using
- * the viewport then you would not see a change in perspective for the
- * actors on the stage.
- *
- * Normally the stage viewport will automatically track the size of the
- * stage window with no offset so the stage will fill your window. This
- * behaviour can be changed with the "viewport-mimics-window" property
- * which will automatically be set to FALSE if you use this API. If
- * you want to revert to the original behaviour then you should set
- * this property back to %TRUE using
- * clutter_stage_set_viewport_mimics_window().
- * (XXX: If we were to make this API public then we might want to do
- * add that property.)
- *
- * Note: currently this interface only support integer precision
- * offsets and sizes for viewports but the interface takes floats because
- * OpenGL 4.0 has introduced floating point viewports which we might
- * want to expose via this API eventually.
- *
- * Since: 1.6
- */
-static void
-clutter_stage_set_viewport (ClutterStage *stage,
- float width,
- float height)
-{
- ClutterStagePrivate *priv;
- float x, y;
-
- g_return_if_fail (CLUTTER_IS_STAGE (stage));
-
- priv = stage->priv;
-
- x = 0.f;
- y = 0.f;
- width = roundf (width);
- height = roundf (height);
-
- if (x == priv->viewport[0] &&
- y == priv->viewport[1] &&
- width == priv->viewport[2] &&
- height == priv->viewport[3])
- return;
-
- priv->viewport[0] = x;
- priv->viewport[1] = y;
- priv->viewport[2] = width;
- priv->viewport[3] = height;
-
- clutter_stage_update_view_perspective (stage);
- _clutter_stage_dirty_viewport (stage);
-
- queue_full_redraw (stage);
-}
-
-/* This simply provides a simple mechanism for us to ensure that
- * the viewport gets re-asserted before next painting.
- *
- * This is used when switching between multiple stages */
-void
-_clutter_stage_dirty_viewport (ClutterStage *stage)
-{
- ClutterStagePrivate *priv;
- GList *l;
-
- g_return_if_fail (CLUTTER_IS_STAGE (stage));
-
- priv = stage->priv;
-
- for (l = _clutter_stage_window_get_views (priv->impl); l; l = l->next)
- {
- ClutterStageView *view = l->data;
-
- clutter_stage_view_invalidate_viewport (view);
- }
-}
-
-/*
- * clutter_stage_get_viewport:
- * @stage: A #ClutterStage
- * @x: A location for the X position where the stage is rendered,
- * in window coordinates.
- * @y: A location for the Y position where the stage is rendered,
- * in window coordinates.
- * @width: A location for the width the stage is rendered at,
- * in window coordinates.
- * @height: A location for the height the stage is rendered at,
- * in window coordinates.
- *
- * Returns the viewport offset and size set using
- * clutter_stage_set_viewport() or if the "viewport-mimics-window" property
- * is TRUE then @x and @y will be set to 0 and @width and @height will equal
- * the width if the stage window.
- *
- * Since: 1.6
- */
-void
-_clutter_stage_get_viewport (ClutterStage *stage,
- float *x,
- float *y,
- float *width,
- float *height)
-{
- ClutterStagePrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_STAGE (stage));
-
- priv = stage->priv;
-
- *x = priv->viewport[0];
- *y = priv->viewport[1];
- *width = priv->viewport[2];
- *height = priv->viewport[3];
-}
-
-/**
- * clutter_stage_read_pixels:
- * @stage: A #ClutterStage
- * @x: x coordinate of the first pixel that is read from stage
- * @y: y coordinate of the first pixel that is read from stage
- * @width: Width dimension of pixels to be read, or -1 for the
- * entire stage width
- * @height: Height dimension of pixels to be read, or -1 for the
- * entire stage height
- *
- * Makes a screenshot of the stage in RGBA 8bit data, returns a
- * linear buffer with @width * 4 as rowstride.
- *
- * The alpha data contained in the returned buffer is driver-dependent,
- * and not guaranteed to hold any sensible value.
- *
- * Return value: (transfer full) (array): a pointer to newly allocated memory with the buffer
- * or %NULL if the read failed. Use g_free() on the returned data
- * to release the resources it has allocated.
- */
-guchar *
-clutter_stage_read_pixels (ClutterStage *stage,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- ClutterStagePrivate *priv;
- ClutterActorBox box;
- GList *l;
- ClutterStageView *view;
- cairo_region_t *clip;
- cairo_rectangle_int_t clip_rect;
- CoglFramebuffer *framebuffer;
- float view_scale;
- float pixel_width;
- float pixel_height;
- uint8_t *pixels;
-
- COGL_TRACE_BEGIN_SCOPED (ClutterStageReadPixels, "Read Pixels");
-
- g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
-
- priv = stage->priv;
-
- clutter_actor_get_allocation_box (CLUTTER_ACTOR (stage), &box);
-
- if (width < 0)
- width = ceilf (box.x2 - box.x1);
-
- if (height < 0)
- height = ceilf (box.y2 - box.y1);
-
- l = _clutter_stage_window_get_views (priv->impl);
-
- if (!l)
- return NULL;
-
- /* XXX: We only read the first view. Needs different API for multi view screen
- * capture. */
- view = l->data;
-
- clutter_stage_view_get_layout (view, &clip_rect);
- clip = cairo_region_create_rectangle (&clip_rect);
- cairo_region_intersect_rectangle (clip,
- &(cairo_rectangle_int_t) {
- .x = x,
- .y = y,
- .width = width,
- .height = height,
- });
- cairo_region_get_extents (clip, &clip_rect);
-
- if (clip_rect.width == 0 || clip_rect.height == 0)
- {
- cairo_region_destroy (clip);
- return NULL;
- }
-
- framebuffer = clutter_stage_view_get_framebuffer (view);
- clutter_stage_do_paint_view (stage, view, clip);
-
- cairo_region_destroy (clip);
-
- view_scale = clutter_stage_view_get_scale (view);
- pixel_width = roundf (clip_rect.width * view_scale);
- pixel_height = roundf (clip_rect.height * view_scale);
-
- pixels = g_malloc0 (pixel_width * pixel_height * 4);
- cogl_framebuffer_read_pixels (framebuffer,
- clip_rect.x * view_scale,
- clip_rect.y * view_scale,
- pixel_width, pixel_height,
- COGL_PIXEL_FORMAT_RGBA_8888,
- pixels);
-
- return pixels;
-}
-
-/**
- * clutter_stage_get_actor_at_pos:
- * @stage: a #ClutterStage
- * @pick_mode: how the scene graph should be painted
- * @x: X coordinate to check
- * @y: Y coordinate to check
- *
- * Checks the scene at the coordinates @x and @y and returns a pointer
- * to the #ClutterActor at those coordinates. The result is the actor which
- * would be at the specified location on the next redraw, and is not
- * necessarily that which was there on the previous redraw. This allows the
- * function to perform chronologically correctly after any queued changes to
- * the scene, and even if nothing has been drawn.
- *
- * By using @pick_mode it is possible to control which actors will be
- * painted and thus available.
- *
- * Return value: (transfer none): the actor at the specified coordinates,
- * if any
- */
-ClutterActor *
-clutter_stage_get_actor_at_pos (ClutterStage *stage,
- ClutterPickMode pick_mode,
- float x,
- float y)
-{
- g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
-
- return _clutter_stage_do_pick (stage, x, y, pick_mode);
-}
-
-/**
- * clutter_stage_set_title:
- * @stage: A #ClutterStage
- * @title: A utf8 string for the stage windows title.
- *
- * Sets the stage title.
- *
- * Since: 0.4
- **/
-void
-clutter_stage_set_title (ClutterStage *stage,
- const gchar *title)
-{
- ClutterStagePrivate *priv;
- ClutterStageWindow *impl;
-
- g_return_if_fail (CLUTTER_IS_STAGE (stage));
-
- priv = stage->priv;
-
- g_free (priv->title);
- priv->title = g_strdup (title);
-
- impl = CLUTTER_STAGE_WINDOW (priv->impl);
- if (CLUTTER_STAGE_WINDOW_GET_IFACE(impl)->set_title != NULL)
- CLUTTER_STAGE_WINDOW_GET_IFACE (impl)->set_title (impl, priv->title);
-
- g_object_notify_by_pspec (G_OBJECT (stage), obj_props[PROP_TITLE]);
-}
-
-/**
- * clutter_stage_get_title:
- * @stage: A #ClutterStage
- *
- * Gets the stage title.
- *
- * Return value: pointer to the title string for the stage. The
- * returned string is owned by the actor and should not
- * be modified or freed.
- *
- * Since: 0.4
- **/
-const gchar *
-clutter_stage_get_title (ClutterStage *stage)
-{
- g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
-
- return stage->priv->title;
-}
-
-/**
- * clutter_stage_set_key_focus:
- * @stage: the #ClutterStage
- * @actor: (allow-none): the actor to set key focus to, or %NULL
- *
- * Sets the key focus on @actor. An actor with key focus will receive
- * all the key events. If @actor is %NULL, the stage will receive
- * focus.
- *
- * Since: 0.6
- */
-void
-clutter_stage_set_key_focus (ClutterStage *stage,
- ClutterActor *actor)
-{
- ClutterStagePrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_STAGE (stage));
- g_return_if_fail (actor == NULL || CLUTTER_IS_ACTOR (actor));
-
- priv = stage->priv;
-
- /* normalize the key focus. NULL == stage */
- if (actor == CLUTTER_ACTOR (stage))
- actor = NULL;
-
- /* avoid emitting signals and notifications if we're setting the same
- * actor as the key focus
- */
- if (priv->key_focused_actor == actor)
- return;
-
- if (priv->key_focused_actor != NULL)
- {
- ClutterActor *old_focused_actor;
-
- old_focused_actor = priv->key_focused_actor;
-
- /* set key_focused_actor to NULL before emitting the signal or someone
- * might hide the previously focused actor in the signal handler
- */
- priv->key_focused_actor = NULL;
-
- _clutter_actor_set_has_key_focus (old_focused_actor, FALSE);
- }
- else
- _clutter_actor_set_has_key_focus (CLUTTER_ACTOR (stage), FALSE);
-
- /* Note, if someone changes key focus in focus-out signal handler we'd be
- * overriding the latter call below moving the focus where it was originally
- * intended. The order of events would be:
- * 1st focus-out, 2nd focus-out (on stage), 2nd focus-in, 1st focus-in
- */
- if (actor != NULL)
- {
- priv->key_focused_actor = actor;
- _clutter_actor_set_has_key_focus (actor, TRUE);
- }
- else
- _clutter_actor_set_has_key_focus (CLUTTER_ACTOR (stage), TRUE);
-
- g_object_notify_by_pspec (G_OBJECT (stage), obj_props[PROP_KEY_FOCUS]);
-}
-
-/**
- * clutter_stage_get_key_focus:
- * @stage: the #ClutterStage
- *
- * Retrieves the actor that is currently under key focus.
- *
- * Return value: (transfer none): the actor with key focus, or the stage
- *
- * Since: 0.6
- */
-ClutterActor *
-clutter_stage_get_key_focus (ClutterStage *stage)
-{
- g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
-
- if (stage->priv->key_focused_actor)
- return stage->priv->key_focused_actor;
-
- return CLUTTER_ACTOR (stage);
-}
-
-/*** Perspective boxed type ******/
-
-static gpointer
-clutter_perspective_copy (gpointer data)
-{
- if (G_LIKELY (data))
- return g_memdup2 (data, sizeof (ClutterPerspective));
-
- return NULL;
-}
-
-static void
-clutter_perspective_free (gpointer data)
-{
- if (G_LIKELY (data))
- g_free (data);
-}
-
-G_DEFINE_BOXED_TYPE (ClutterPerspective, clutter_perspective,
- clutter_perspective_copy,
- clutter_perspective_free);
-
-/**
- * clutter_stage_ensure_viewport:
- * @stage: a #ClutterStage
- *
- * Ensures that the GL viewport is updated with the current
- * stage window size.
- *
- * This function will queue a redraw of @stage.
- *
- * This function should not be called by applications; it is used
- * when embedding a #ClutterStage into a toolkit with another
- * windowing system, like GTK+.
- *
- * Since: 1.0
- */
-void
-clutter_stage_ensure_viewport (ClutterStage *stage)
-{
- g_return_if_fail (CLUTTER_IS_STAGE (stage));
-
- _clutter_stage_dirty_viewport (stage);
-
- clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
-}
-
-# define _DEG_TO_RAD(d) ((d) * ((float) G_PI / 180.0f))
-
-/* This calculates a distance into the view frustum to position the
- * stage so there is a decent amount of space to position geometry
- * between the stage and the near clipping plane.
- *
- * Some awkward issues with this problem are:
- * - It's not possible to have a gap as large as the stage size with
- * a fov > 53° which is basically always the case since the default
- * fov is 60°.
- * - This can be deduced if you consider that this requires a
- * triangle as wide as it is deep to fit in the frustum in front
- * of the z_near plane. That triangle will always have an angle
- * of 53.13° at the point sitting on the z_near plane, but if the
- * frustum has a wider fov angle the left/right clipping planes
- * can never converge with the two corners of our triangle no
- * matter what size the triangle has.
- * - With a fov > 53° there is a trade off between maximizing the gap
- * size relative to the stage size but not losing depth precision.
- * - Perhaps ideally we wouldn't just consider the fov on the y-axis
- * that is usually used to define a perspective, we would consider
- * the fov of the axis with the largest stage size so the gap would
- * accommodate that size best.
- *
- * After going around in circles a few times with how to handle these
- * issues, we decided in the end to go for the simplest solution to
- * start with instead of an elaborate function that handles arbitrary
- * fov angles that we currently have no use-case for.
- *
- * The solution assumes a fovy of 60° and for that case gives a gap
- * that's 85% of the stage height. We can consider more elaborate
- * functions if necessary later.
- *
- * One guide we had to steer the gap size we support is the
- * interactive test, test-texture-quality which expects to animate an
- * actor to +400 on the z axis with a stage size of 640x480. A gap
- * that's 85% of the stage height gives a gap of 408 in that case.
- */
-static float
-calculate_z_translation (float z_near)
-{
- /* This solution uses fairly basic trigonometry, but is seems worth
- * clarifying the particular geometry we are looking at in-case
- * anyone wants to develop this further later. Not sure how well an
- * ascii diagram is going to work :-)
- *
- * |--- stage_height ---|
- * | stage line |
- * ╲â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”╱------------
- * ╲. (2) │ .╱ | |
- * C ╲ . │ . ╱ gap| |
- * =0.5°╲ . a │ . ╱ | |
- * b╲(1). D│ . ╱ | |
- * ╲ B.│. ╱near plane | |
- * A= ╲â”â”â”â”â”â”â”â”â”╱------------- |
- * 120° ╲ c │ ╱ | z_2d
- * ╲ │ ╱ z_near |
- * left ╲ │ ╱ | |
- * clip 60°fovy | |
- * plane ╳----------------------
- * |
- * |
- * origin line
- *
- * The area of interest is the triangle labeled (1) at the top left
- * marked with the ... line (a) from where the origin line crosses
- * the near plane to the top left where the stage line cross the
- * left clip plane.
- *
- * The sides of the triangle are a, b and c and the corresponding
- * angles opposite those sides are A, B and C.
- *
- * The angle of C is what trades off the gap size we have relative
- * to the stage size vs the depth precision we have.
- *
- * As mentioned above we arove at the angle for C is by working
- * backwards from how much space we want for test-texture-quality.
- * With a stage_height of 480 we want a gap > 400, ideally we also
- * wanted a somewhat round number as a percentage of the height for
- * documentation purposes. ~87% or a gap of ~416 is the limit
- * because that's where we approach a C angle of 0° and effectively
- * loose all depth precision.
- *
- * So for our test app with a stage_height of 480 if we aim for a
- * gap of 408 (85% of 480) we can get the angle D as
- * atan (stage_height/2/408) = 30.5°.
- *
- * That gives us the angle for B as 90° - 30.5° = 59.5°
- *
- * We can already determine that A has an angle of (fovy/2 + 90°) =
- * 120°
- *
- * Therefore C = 180 - A - B = 0.5°
- *
- * The length of c = z_near * tan (30°)
- *
- * Now we can use the rule a/SinA = c/SinC to calculate the
- * length of a. After some rearranging that gives us:
- *
- * a c
- * ---------- = ----------
- * sin (120°) sin (0.5°)
- *
- * c * sin (120°)
- * a = --------------
- * sin (0.5°)
- *
- * And with that we can determine z_2d = cos (D) * a =
- * cos (30.5°) * a + z_near:
- *
- * c * sin (120°) * cos (30.5°)
- * z_2d = --------------------------- + z_near
- * sin (0.5°)
- */
-
- /* We expect the compiler should boil this down to z_near * CONSTANT
- * already, but just in case we use precomputed constants
- */
-#if 0
-# define A tanf (_DEG_TO_RAD (30.f))
-# define B sinf (_DEG_TO_RAD (120.f))
-# define C cosf (_DEG_TO_RAD (30.5f))
-# define D sinf (_DEG_TO_RAD (.5f))
-#else
-# define A 0.57735025882720947265625f
-# define B 0.866025388240814208984375f
-# define C 0.86162912845611572265625f
-# define D 0.00872653536498546600341796875f
-#endif
-
- return z_near
- * A * B * C
- / D
- + z_near;
-}
-
-static void
-view_2d_in_perspective (graphene_matrix_t *matrix,
- float fov_y,
- float aspect,
- float z_near,
- float z_2d,
- float width_2d,
- float height_2d)
-{
- float top = z_near * tan (fov_y * G_PI / 360.0);
- float left = -top * aspect;
- float right = top * aspect;
- float bottom = -top;
-
- float left_2d_plane = left / z_near * z_2d;
- float right_2d_plane = right / z_near * z_2d;
- float bottom_2d_plane = bottom / z_near * z_2d;
- float top_2d_plane = top / z_near * z_2d;
-
- float width_2d_start = right_2d_plane - left_2d_plane;
- float height_2d_start = top_2d_plane - bottom_2d_plane;
-
- /* Factors to scale from framebuffer geometry to frustum
- * cross-section geometry. */
- float width_scale = width_2d_start / width_2d;
- float height_scale = height_2d_start / height_2d;
-
- graphene_matrix_init_scale (matrix, width_scale, -height_scale, width_scale);
- graphene_matrix_translate (matrix,
- &GRAPHENE_POINT3D_INIT (left_2d_plane,
- top_2d_plane,
- -z_2d));
-}
-
-static void
-clutter_stage_update_view_perspective (ClutterStage *stage)
-{
- ClutterStagePrivate *priv = stage->priv;
- ClutterPerspective perspective;
- float z_2d;
-
- perspective = priv->perspective;
-
- perspective.fovy = 60.0; /* 60 Degrees */
- perspective.z_near = 1.0;
- perspective.aspect = priv->viewport[2] / priv->viewport[3];
- z_2d = calculate_z_translation (perspective.z_near);
-
- /* NB: z_2d is only enough room for 85% of the stage_height between
- * the stage and the z_near plane. For behind the stage plane we
- * want a more consistent gap of 10 times the stage_height before
- * hitting the far plane so we calculate that relative to the final
- * height of the stage plane at the z_2d_distance we got... */
- perspective.z_far = z_2d +
- tanf (_DEG_TO_RAD (perspective.fovy / 2.0f)) * z_2d * 20.0f;
-
- clutter_stage_set_perspective (stage, &perspective);
-
- view_2d_in_perspective (&priv->view,
- perspective.fovy,
- perspective.aspect,
- perspective.z_near,
- z_2d,
- priv->viewport[2],
- priv->viewport[3]);
-
- clutter_actor_invalidate_transform (CLUTTER_ACTOR (stage));
-}
-
-void
-_clutter_stage_maybe_setup_viewport (ClutterStage *stage,
- ClutterStageView *view)
-{
- ClutterStagePrivate *priv = stage->priv;
-
- if (clutter_stage_view_is_dirty_viewport (view))
- {
- cairo_rectangle_int_t view_layout;
- float fb_scale;
- float viewport_offset_x;
- float viewport_offset_y;
- float viewport_x;
- float viewport_y;
- float viewport_width;
- float viewport_height;
-
- CLUTTER_NOTE (PAINT,
- "Setting up the viewport { w:%f, h:%f }",
- priv->viewport[2],
- priv->viewport[3]);
-
- fb_scale = clutter_stage_view_get_scale (view);
- clutter_stage_view_get_layout (view, &view_layout);
-
- viewport_offset_x = view_layout.x * fb_scale;
- viewport_offset_y = view_layout.y * fb_scale;
- viewport_x = roundf (priv->viewport[0] * fb_scale - viewport_offset_x);
- viewport_y = roundf (priv->viewport[1] * fb_scale - viewport_offset_y);
- viewport_width = roundf (priv->viewport[2] * fb_scale);
- viewport_height = roundf (priv->viewport[3] * fb_scale);
-
- clutter_stage_view_set_viewport (view,
- viewport_x, viewport_y,
- viewport_width, viewport_height);
- }
-
- if (clutter_stage_view_is_dirty_projection (view))
- clutter_stage_view_set_projection (view, &priv->projection);
-}
-
-#undef _DEG_TO_RAD
-
-/**
- * clutter_stage_is_redraw_queued_on_view: (skip)
- */
-gboolean
-clutter_stage_is_redraw_queued_on_view (ClutterStage *stage,
- ClutterStageView *view)
-{
- clutter_stage_maybe_finish_queue_redraws (stage);
-
- return clutter_stage_view_has_redraw_clip (view);
-}
-
-void
-_clutter_stage_set_window (ClutterStage *stage,
- ClutterStageWindow *stage_window)
-{
- g_return_if_fail (CLUTTER_IS_STAGE (stage));
- g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (stage_window));
-
- if (stage->priv->impl != NULL)
- g_object_unref (stage->priv->impl);
-
- stage->priv->impl = stage_window;
-}
-
-ClutterStageWindow *
-_clutter_stage_get_window (ClutterStage *stage)
-{
- g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
-
- return CLUTTER_STAGE_WINDOW (stage->priv->impl);
-}
-
-ClutterStageWindow *
-_clutter_stage_get_default_window (void)
-{
- ClutterStageManager *manager = clutter_stage_manager_get_default ();
- ClutterStage *stage;
-
- stage = clutter_stage_manager_get_default_stage (manager);
- if (stage == NULL)
- return NULL;
-
- return _clutter_stage_get_window (stage);
-}
-
-/**
- * clutter_stage_set_throttle_motion_events:
- * @stage: a #ClutterStage
- * @throttle: %TRUE to throttle motion events
- *
- * Sets whether motion events received between redraws should
- * be throttled or not. If motion events are throttled, those
- * events received by the windowing system between redraws will
- * be compressed so that only the last event will be propagated
- * to the @stage and its actors.
- *
- * This function should only be used if you want to have all
- * the motion events delivered to your application code.
- *
- * Since: 1.0
- */
-void
-clutter_stage_set_throttle_motion_events (ClutterStage *stage,
- gboolean throttle)
-{
- ClutterStagePrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_STAGE (stage));
-
- priv = stage->priv;
-
- if (priv->throttle_motion_events != throttle)
- priv->throttle_motion_events = throttle;
-}
-
-/**
- * clutter_stage_get_throttle_motion_events:
- * @stage: a #ClutterStage
- *
- * Retrieves the value set with clutter_stage_set_throttle_motion_events()
- *
- * Return value: %TRUE if the motion events are being throttled,
- * and %FALSE otherwise
- *
- * Since: 1.0
- */
-gboolean
-clutter_stage_get_throttle_motion_events (ClutterStage *stage)
-{
- g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
-
- return stage->priv->throttle_motion_events;
-}
-
-/**
- * clutter_stage_set_minimum_size:
- * @stage: a #ClutterStage
- * @width: width, in pixels
- * @height: height, in pixels
- *
- * Sets the minimum size for a stage window, if the default backend
- * uses #ClutterStage inside a window
- *
- * This is a convenience function, and it is equivalent to setting the
- * #ClutterActor:min-width and #ClutterActor:min-height on @stage
- *
- * If the current size of @stage is smaller than the minimum size, the
- * @stage will be resized to the new @width and @height
- *
- * Since: 1.2
- */
-void
-clutter_stage_set_minimum_size (ClutterStage *stage,
- guint width,
- guint height)
-{
- g_return_if_fail (CLUTTER_IS_STAGE (stage));
- g_return_if_fail ((width > 0) && (height > 0));
-
- g_object_set (G_OBJECT (stage),
- "min-width", (gfloat) width,
- "min-height", (gfloat )height,
- NULL);
-}
-
-/**
- * clutter_stage_get_minimum_size:
- * @stage: a #ClutterStage
- * @width: (out): return location for the minimum width, in pixels,
- * or %NULL
- * @height: (out): return location for the minimum height, in pixels,
- * or %NULL
- *
- * Retrieves the minimum size for a stage window as set using
- * clutter_stage_set_minimum_size().
- *
- * The returned size may not correspond to the actual minimum size and
- * it is specific to the #ClutterStage implementation inside the
- * Clutter backend
- *
- * Since: 1.2
- */
-void
-clutter_stage_get_minimum_size (ClutterStage *stage,
- guint *width_p,
- guint *height_p)
-{
- gfloat width, height;
- gboolean width_set, height_set;
-
- g_return_if_fail (CLUTTER_IS_STAGE (stage));
-
- g_object_get (G_OBJECT (stage),
- "min-width", &width,
- "min-width-set", &width_set,
- "min-height", &height,
- "min-height-set", &height_set,
- NULL);
-
- /* if not width or height have been set, then the Stage
- * minimum size is defined to be 1x1
- */
- if (!width_set)
- width = 1;
-
- if (!height_set)
- height = 1;
-
- if (width_p)
- *width_p = (guint) width;
-
- if (height_p)
- *height_p = (guint) height;
-}
-
-/**
- * clutter_stage_schedule_update:
- * @stage: a #ClutterStage actor
- *
- * Schedules a redraw of the #ClutterStage at the next optimal timestamp.
- */
-void
-clutter_stage_schedule_update (ClutterStage *stage)
-{
- ClutterStageWindow *stage_window;
- GList *l;
-
- if (CLUTTER_ACTOR_IN_DESTRUCTION (stage))
- return;
-
- stage_window = _clutter_stage_get_window (stage);
- if (stage_window == NULL)
- return;
-
- for (l = clutter_stage_peek_stage_views (stage); l; l = l->next)
- {
- ClutterStageView *view = l->data;
-
- clutter_stage_view_schedule_update (view);
- }
-}
-
-ClutterPaintVolume *
-_clutter_stage_paint_volume_stack_allocate (ClutterStage *stage)
-{
- GArray *paint_volume_stack = stage->priv->paint_volume_stack;
-
- g_array_set_size (paint_volume_stack,
- paint_volume_stack->len+1);
-
- return &g_array_index (paint_volume_stack,
- ClutterPaintVolume,
- paint_volume_stack->len - 1);
-}
-
-void
-_clutter_stage_paint_volume_stack_free_all (ClutterStage *stage)
-{
- GArray *paint_volume_stack = stage->priv->paint_volume_stack;
- int i;
-
- for (i = 0; i < paint_volume_stack->len; i++)
- {
- ClutterPaintVolume *pv =
- &g_array_index (paint_volume_stack, ClutterPaintVolume, i);
- clutter_paint_volume_free (pv);
- }
-
- g_array_set_size (paint_volume_stack, 0);
-}
-
-/* When an actor queues a redraw we add it to a list on the stage that
- * gets processed once all updates to the stage have been finished.
- *
- * This deferred approach to processing queue_redraw requests means
- * that we can avoid redundant transformations of clip volumes if
- * something later triggers a full stage redraw anyway. It also means
- * we can be more sure that all the referenced actors will have valid
- * allocations improving the chance that we can determine the actors
- * paint volume so we can clip the redraw request even if the user
- * didn't explicitly do so.
- */
-void
-clutter_stage_queue_actor_redraw (ClutterStage *stage,
- ClutterActor *actor,
- const ClutterPaintVolume *clip)
-{
- ClutterStagePrivate *priv = stage->priv;
- QueueRedrawEntry *entry = NULL;
-
- CLUTTER_NOTE (CLIPPING, "stage_queue_actor_redraw (actor=%s, clip=%p): ",
- _clutter_actor_get_debug_name (actor), clip);
-
- if (!priv->pending_finish_queue_redraws)
- {
- GList *l;
-
- for (l = clutter_stage_peek_stage_views (stage); l; l = l->next)
- {
- ClutterStageView *view = l->data;
-
- clutter_stage_view_schedule_update (view);
- }
-
- priv->pending_finish_queue_redraws = TRUE;
- }
-
- entry = g_hash_table_lookup (priv->pending_queue_redraws, actor);
-
- if (entry)
- {
- /* Ignore all requests to queue a redraw for an actor if a full
- * (non-clipped) redraw of the actor has already been queued. */
- if (!entry->has_clip)
- {
- CLUTTER_NOTE (CLIPPING, "Bail from stage_queue_actor_redraw (%s): "
- "Unclipped redraw of actor already queued",
- _clutter_actor_get_debug_name (actor));
- return;
- }
-
- /* If queuing a clipped redraw and a clipped redraw has
- * previously been queued for this actor then combine the latest
- * clip together with the existing clip */
- if (clip)
- clutter_paint_volume_union (&entry->clip, clip);
- else
- {
- clutter_paint_volume_free (&entry->clip);
- entry->has_clip = FALSE;
- }
- }
- else
- {
- entry = g_new0 (QueueRedrawEntry, 1);
-
- if (clip)
- {
- entry->has_clip = TRUE;
- _clutter_paint_volume_init_static (&entry->clip, actor);
- _clutter_paint_volume_set_from_volume (&entry->clip, clip);
- }
- else
- entry->has_clip = FALSE;
-
- g_hash_table_insert (priv->pending_queue_redraws,
- g_object_ref (actor), entry);
- }
-}
-
-static void
-free_queue_redraw_entry (QueueRedrawEntry *entry)
-{
- if (entry->has_clip)
- clutter_paint_volume_free (&entry->clip);
- g_free (entry);
-}
-
-void
-clutter_stage_dequeue_actor_redraw (ClutterStage *self,
- ClutterActor *actor)
-{
- g_hash_table_remove (self->priv->pending_queue_redraws, actor);
-}
-
-static void
-add_to_stage_clip (ClutterStage *stage,
- ClutterPaintVolume *redraw_clip)
-{
- ClutterStageWindow *stage_window;
- ClutterActorBox bounding_box;
- ClutterActorBox intersection_box;
- cairo_rectangle_int_t geom, stage_clip;
-
- if (CLUTTER_ACTOR_IN_DESTRUCTION (CLUTTER_ACTOR (stage)))
- return;
-
- stage_window = _clutter_stage_get_window (stage);
- if (stage_window == NULL)
- return;
-
- if (is_full_stage_redraw_queued (stage))
- return;
-
- if (redraw_clip == NULL)
- {
- clutter_stage_add_redraw_clip (stage, NULL);
- return;
- }
-
- if (redraw_clip->is_empty)
- return;
-
- /* Now transform and project the clip volume to view coordinates and get
- * the axis aligned bounding box that's aligned to the pixel grid.
- */
- _clutter_paint_volume_get_stage_paint_box (redraw_clip,
- stage,
- &bounding_box);
-
- _clutter_stage_window_get_geometry (stage_window, &geom);
-
- intersection_box.x1 = MAX (bounding_box.x1, 0);
- intersection_box.y1 = MAX (bounding_box.y1, 0);
- intersection_box.x2 = MIN (bounding_box.x2, geom.width);
- intersection_box.y2 = MIN (bounding_box.y2, geom.height);
-
- /* There is no need to track degenerate/empty redraw clips */
- if (intersection_box.x2 <= intersection_box.x1 ||
- intersection_box.y2 <= intersection_box.y1)
- return;
-
- stage_clip.x = intersection_box.x1;
- stage_clip.y = intersection_box.y1;
- stage_clip.width = intersection_box.x2 - stage_clip.x;
- stage_clip.height = intersection_box.y2 - stage_clip.y;
-
- clutter_stage_add_redraw_clip (stage, &stage_clip);
-}
-
-void
-clutter_stage_maybe_finish_queue_redraws (ClutterStage *stage)
-{
- ClutterStagePrivate *priv = stage->priv;
- GHashTableIter iter;
- gpointer key, value;
-
- COGL_TRACE_BEGIN_SCOPED (ClutterStageFinishQueueRedraws, "FinishQueueRedraws");
-
- if (!priv->pending_finish_queue_redraws)
- return;
-
- priv->pending_finish_queue_redraws = FALSE;
-
- g_hash_table_iter_init (&iter, priv->pending_queue_redraws);
- while (g_hash_table_iter_next (&iter, &key, &value))
- {
- ClutterActor *redraw_actor = key;
- QueueRedrawEntry *entry = value;
- ClutterPaintVolume old_actor_pv, new_actor_pv;
-
- g_hash_table_iter_steal (&iter);
-
- _clutter_paint_volume_init_static (&old_actor_pv, NULL);
- _clutter_paint_volume_init_static (&new_actor_pv, NULL);
-
- if (entry->has_clip)
- {
- add_to_stage_clip (stage, &entry->clip);
- }
- else if (clutter_actor_get_redraw_clip (redraw_actor,
- &old_actor_pv,
- &new_actor_pv))
- {
- /* Add both the old paint volume of the actor (which is
- * currently visible on the screen) and the new paint volume
- * (which will be visible on the screen after this redraw)
- * to the redraw clip.
- * The former we do to ensure the old texture on the screen
- * will be fully painted over in case the actor was moved.
- */
- add_to_stage_clip (stage, &old_actor_pv);
- add_to_stage_clip (stage, &new_actor_pv);
- }
- else
- {
- /* If there's no clip we can use, we have to trigger an
- * unclipped full stage redraw.
- */
- add_to_stage_clip (stage, NULL);
- }
-
- g_object_unref (redraw_actor);
- free_queue_redraw_entry (entry);
-
- /* get_paint_volume() vfuncs might queue redraws and can cause our
- * iterator to now be invalidated. So start over. This isn't wasting
- * any time since we already stole (removed) the elements previously
- * visited.
- */
- g_hash_table_iter_init (&iter, priv->pending_queue_redraws);
- }
-}
-
-/**
- * clutter_stage_set_motion_events_enabled:
- * @stage: a #ClutterStage
- * @enabled: %TRUE to enable the motion events delivery, and %FALSE
- * otherwise
- *
- * Sets whether per-actor motion events (and relative crossing
- * events) should be disabled or not.
- *
- * The default is %TRUE.
- *
- * If @enable is %FALSE the following signals will not be emitted
- * by the actors children of @stage:
- *
- * - #ClutterActor::motion-event
- * - #ClutterActor::enter-event
- * - #ClutterActor::leave-event
- *
- * The events will still be delivered to the #ClutterStage.
- *
- * The main side effect of this function is that disabling the motion
- * events will disable picking to detect the #ClutterActor underneath
- * the pointer for each motion event. This is useful, for instance,
- * when dragging a #ClutterActor across the @stage: the actor underneath
- * the pointer is not going to change, so it's meaningless to perform
- * a pick.
- *
- * Since: 1.8
- */
-void
-clutter_stage_set_motion_events_enabled (ClutterStage *stage,
- gboolean enabled)
-{
- ClutterStagePrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_STAGE (stage));
-
- priv = stage->priv;
-
- enabled = !!enabled;
-
- if (priv->motion_events_enabled != enabled)
- priv->motion_events_enabled = enabled;
-}
-
-/**
- * clutter_stage_get_motion_events_enabled:
- * @stage: a #ClutterStage
- *
- * Retrieves the value set using clutter_stage_set_motion_events_enabled().
- *
- * Return value: %TRUE if the per-actor motion event delivery is enabled
- * and %FALSE otherwise
- *
- * Since: 1.8
- */
-gboolean
-clutter_stage_get_motion_events_enabled (ClutterStage *stage)
-{
- g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
-
- return stage->priv->motion_events_enabled;
-}
-
-void
-_clutter_stage_add_pointer_drag_actor (ClutterStage *stage,
- ClutterInputDevice *device,
- ClutterActor *actor)
-{
- GHashTable *drag_actors;
-
- drag_actors = g_object_get_data (G_OBJECT (stage),
- "__clutter_stage_pointer_drag_actors");
- if (drag_actors == NULL)
- {
- drag_actors = g_hash_table_new (NULL, NULL);
- g_object_set_data_full (G_OBJECT (stage),
- "__clutter_stage_pointer_drag_actors",
- drag_actors,
- (GDestroyNotify) g_hash_table_destroy);
- }
-
- g_hash_table_replace (drag_actors, device, actor);
-}
-
-ClutterActor *
-_clutter_stage_get_pointer_drag_actor (ClutterStage *stage,
- ClutterInputDevice *device)
-{
- GHashTable *drag_actors;
-
- drag_actors = g_object_get_data (G_OBJECT (stage),
- "__clutter_stage_pointer_drag_actors");
- if (drag_actors == NULL)
- return NULL;
-
- return g_hash_table_lookup (drag_actors, device);
-}
-
-void
-_clutter_stage_remove_pointer_drag_actor (ClutterStage *stage,
- ClutterInputDevice *device)
-{
- GHashTable *drag_actors;
-
- drag_actors = g_object_get_data (G_OBJECT (stage),
- "__clutter_stage_pointer_drag_actors");
- if (drag_actors == NULL)
- return;
-
- g_hash_table_remove (drag_actors, device);
-
- if (g_hash_table_size (drag_actors) == 0)
- g_object_set_data (G_OBJECT (stage),
- "__clutter_stage_pointer_drag_actors",
- NULL);
-}
-
-void
-_clutter_stage_add_touch_drag_actor (ClutterStage *stage,
- ClutterEventSequence *sequence,
- ClutterActor *actor)
-{
- GHashTable *drag_actors;
-
- drag_actors = g_object_get_data (G_OBJECT (stage),
- "__clutter_stage_touch_drag_actors");
- if (drag_actors == NULL)
- {
- drag_actors = g_hash_table_new (NULL, NULL);
- g_object_set_data_full (G_OBJECT (stage),
- "__clutter_stage_touch_drag_actors",
- drag_actors,
- (GDestroyNotify) g_hash_table_destroy);
- }
-
- g_hash_table_replace (drag_actors, sequence, actor);
-}
-
-ClutterActor *
-_clutter_stage_get_touch_drag_actor (ClutterStage *stage,
- ClutterEventSequence *sequence)
-{
- GHashTable *drag_actors;
-
- drag_actors = g_object_get_data (G_OBJECT (stage),
- "__clutter_stage_touch_drag_actors");
- if (drag_actors == NULL)
- return NULL;
-
- return g_hash_table_lookup (drag_actors, sequence);
-}
-
-void
-_clutter_stage_remove_touch_drag_actor (ClutterStage *stage,
- ClutterEventSequence *sequence)
-{
- GHashTable *drag_actors;
-
- drag_actors = g_object_get_data (G_OBJECT (stage),
- "__clutter_stage_touch_drag_actors");
- if (drag_actors == NULL)
- return;
-
- g_hash_table_remove (drag_actors, sequence);
-
- if (g_hash_table_size (drag_actors) == 0)
- g_object_set_data (G_OBJECT (stage),
- "__clutter_stage_touch_drag_actors",
- NULL);
-}
-
-int64_t
-clutter_stage_get_frame_counter (ClutterStage *stage)
-{
- ClutterStageWindow *stage_window;
-
- stage_window = _clutter_stage_get_window (stage);
- return _clutter_stage_window_get_frame_counter (stage_window);
-}
-
-void
-clutter_stage_presented (ClutterStage *stage,
- ClutterStageView *view,
- ClutterFrameInfo *frame_info)
-{
- g_signal_emit (stage, stage_signals[PRESENTED], 0, view, frame_info);
-}
-
-/**
- * clutter_stage_get_capture_final_size:
- * @stage: a #ClutterStage actor
- * @rect: a #cairo_rectangle_int_t
- * @out_width: (out) (optional): the final width
- * @out_height: (out) (optional): the final height
- * @out_scale: (out) (optional): the final scale factor
- *
- * Get the size of the framebuffer one must pass to
- * clutter_stage_paint_to_buffer() or clutter_stage_paint_to_framebuffer()
- * would be used with the same @rect.
- *
- * Returns: %TRUE if the size has been retrieved, %FALSE otherwise.
- */
-gboolean
-clutter_stage_get_capture_final_size (ClutterStage *stage,
- cairo_rectangle_int_t *rect,
- int *out_width,
- int *out_height,
- float *out_scale)
-{
- float max_scale = 1.0;
-
- g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
-
- if (rect)
- {
- graphene_rect_t capture_rect;
- g_autoptr (GList) views = NULL;
- GList *l;
-
- _clutter_util_rect_from_rectangle (rect, &capture_rect);
- views = clutter_stage_get_views_for_rect (stage, &capture_rect);
-
- if (!views)
- return FALSE;
-
- for (l = views; l; l = l->next)
- {
- ClutterStageView *view = l->data;
-
- max_scale = MAX (clutter_stage_view_get_scale (view), max_scale);
- }
-
- if (out_width)
- *out_width = (gint) roundf (rect->width * max_scale);
-
- if (out_height)
- *out_height = (gint) roundf (rect->height * max_scale);
- }
- else
- {
- ClutterActorBox alloc;
- float stage_width, stage_height;
-
- clutter_actor_get_allocation_box (CLUTTER_ACTOR (stage), &alloc);
- clutter_actor_box_get_size (&alloc, &stage_width, &stage_height);
- max_scale = clutter_actor_get_real_resource_scale (CLUTTER_ACTOR (stage));
-
- if (out_width)
- *out_width = (gint) roundf (stage_width * max_scale);
-
- if (out_height)
- *out_height = (gint) roundf (stage_height * max_scale);
- }
-
- if (out_scale)
- *out_scale = max_scale;
-
- return TRUE;
-}
-
-void
-clutter_stage_paint_to_framebuffer (ClutterStage *stage,
- CoglFramebuffer *framebuffer,
- const cairo_rectangle_int_t *rect,
- float scale,
- ClutterPaintFlag paint_flags)
-{
- ClutterStagePrivate *priv = stage->priv;
- ClutterPaintContext *paint_context;
- cairo_region_t *redraw_clip;
-
- if (paint_flags & CLUTTER_PAINT_FLAG_CLEAR)
- {
- CoglColor clear_color;
-
- cogl_color_init_from_4ub (&clear_color, 0, 0, 0, 0);
- cogl_framebuffer_clear (framebuffer, COGL_BUFFER_BIT_COLOR, &clear_color);
- }
-
- redraw_clip = cairo_region_create_rectangle (rect);
- paint_context =
- clutter_paint_context_new_for_framebuffer (framebuffer,
- redraw_clip,
- paint_flags);
- cairo_region_destroy (redraw_clip);
-
- cogl_framebuffer_push_matrix (framebuffer);
- cogl_framebuffer_set_projection_matrix (framebuffer, &priv->projection);
- cogl_framebuffer_set_viewport (framebuffer,
- -(rect->x * scale),
- -(rect->y * scale),
- priv->viewport[2] * scale,
- priv->viewport[3] * scale);
- clutter_actor_paint (CLUTTER_ACTOR (stage), paint_context);
- cogl_framebuffer_pop_matrix (framebuffer);
-
- clutter_paint_context_destroy (paint_context);
-}
-
-/**
- * clutter_stage_paint_to_buffer:
- * @stage: a #ClutterStage actor
- * @rect: a #cairo_rectangle_int_t
- * @scale: the scale
- * @data: (inout) (array) (element-type guint8): a pointer to the data
- * @stride: stride of the image surface
- * @format: the pixel format
- * @paint_flags: the #ClutterPaintFlag
- * @error: the error
- *
- * Take a snapshot of the stage to a provided buffer.
- *
- * Returns: %TRUE is the buffer has been paint successfully, %FALSE otherwise.
- */
-gboolean
-clutter_stage_paint_to_buffer (ClutterStage *stage,
- const cairo_rectangle_int_t *rect,
- float scale,
- uint8_t *data,
- int stride,
- CoglPixelFormat format,
- ClutterPaintFlag paint_flags,
- GError **error)
-{
- ClutterBackend *clutter_backend = clutter_get_default_backend ();
- CoglContext *cogl_context =
- clutter_backend_get_cogl_context (clutter_backend);
- int texture_width, texture_height;
- CoglTexture2D *texture;
- CoglOffscreen *offscreen;
- CoglFramebuffer *framebuffer;
- CoglBitmap *bitmap;
-
- texture_width = (int) roundf (rect->width * scale);
- texture_height = (int) roundf (rect->height * scale);
- texture = cogl_texture_2d_new_with_size (cogl_context,
- texture_width,
- texture_height);
- if (!texture)
- {
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- "Failed to create %dx%d texture",
- texture_width, texture_height);
- return FALSE;
- }
-
- offscreen = cogl_offscreen_new_with_texture (COGL_TEXTURE (texture));
- framebuffer = COGL_FRAMEBUFFER (offscreen);
-
- cogl_object_unref (texture);
-
- if (!cogl_framebuffer_allocate (framebuffer, error))
- return FALSE;
-
- clutter_stage_paint_to_framebuffer (stage, framebuffer,
- rect, scale, paint_flags);
-
- bitmap = cogl_bitmap_new_for_data (cogl_context,
- texture_width, texture_height,
- format,
- stride,
- data);
-
- cogl_framebuffer_read_pixels_into_bitmap (framebuffer,
- 0, 0,
- COGL_READ_PIXELS_COLOR_BUFFER,
- bitmap);
-
- cogl_object_unref (bitmap);
- g_object_unref (framebuffer);
-
- return TRUE;
-}
-
-void
-clutter_stage_capture_view_into (ClutterStage *stage,
- ClutterStageView *view,
- cairo_rectangle_int_t *rect,
- uint8_t *data,
- int stride)
-{
- CoglFramebuffer *framebuffer;
- ClutterBackend *backend;
- CoglContext *context;
- CoglBitmap *bitmap;
- cairo_rectangle_int_t view_layout;
- float view_scale;
- float texture_width;
- float texture_height;
-
- g_return_if_fail (CLUTTER_IS_STAGE (stage));
-
- framebuffer = clutter_stage_view_get_framebuffer (view);
-
- clutter_stage_view_get_layout (view, &view_layout);
-
- if (!rect)
- rect = &view_layout;
-
- view_scale = clutter_stage_view_get_scale (view);
- texture_width = roundf (rect->width * view_scale);
- texture_height = roundf (rect->height * view_scale);
-
- backend = clutter_get_default_backend ();
- context = clutter_backend_get_cogl_context (backend);
- bitmap = cogl_bitmap_new_for_data (context,
- texture_width, texture_height,
- CLUTTER_CAIRO_FORMAT_ARGB32,
- stride,
- data);
-
- cogl_framebuffer_read_pixels_into_bitmap (framebuffer,
- roundf ((rect->x - view_layout.x) * view_scale),
- roundf ((rect->y - view_layout.y) * view_scale),
- COGL_READ_PIXELS_COLOR_BUFFER,
- bitmap);
-
- cogl_object_unref (bitmap);
-}
-
-void
-clutter_stage_capture_into (ClutterStage *stage,
- cairo_rectangle_int_t *rect,
- float scale,
- uint8_t *data,
- int stride)
-{
- ClutterStagePrivate *priv = stage->priv;
- GList *l;
- int bpp = 4;
-
- for (l = _clutter_stage_window_get_views (priv->impl); l; l = l->next)
- {
- ClutterStageView *view = l->data;
- cairo_rectangle_int_t view_layout;
- cairo_region_t *region;
- cairo_rectangle_int_t capture_rect;
- int x_offset, y_offset;
-
- clutter_stage_view_get_layout (view, &view_layout);
- region = cairo_region_create_rectangle (&view_layout);
- cairo_region_intersect_rectangle (region, rect);
-
- cairo_region_get_extents (region, &capture_rect);
- cairo_region_destroy (region);
-
- x_offset = roundf ((capture_rect.x - rect->x) * scale);
- y_offset = roundf ((capture_rect.y - rect->y) * scale);
-
- clutter_stage_capture_view_into (stage, view,
- &capture_rect,
- (data +
- (x_offset * bpp) +
- (y_offset * stride)),
- stride);
- }
-}
-
-/**
- * clutter_stage_peek_stage_views: (skip)
- */
-GList *
-clutter_stage_peek_stage_views (ClutterStage *stage)
-{
- ClutterStagePrivate *priv = stage->priv;
-
- return _clutter_stage_window_get_views (priv->impl);
-}
-
-void
-clutter_stage_clear_stage_views (ClutterStage *stage)
-{
- clutter_actor_clear_stage_views_recursive (CLUTTER_ACTOR (stage));
-}
-
-GList *
-clutter_stage_get_views_for_rect (ClutterStage *stage,
- const graphene_rect_t *rect)
-{
- ClutterStagePrivate *priv = stage->priv;
- GList *views_for_rect = NULL;
- GList *l;
-
- for (l = _clutter_stage_window_get_views (priv->impl); l; l = l->next)
- {
- ClutterStageView *view = l->data;
- cairo_rectangle_int_t view_layout;
- graphene_rect_t view_rect;
-
- clutter_stage_view_get_layout (view, &view_layout);
- _clutter_util_rect_from_rectangle (&view_layout, &view_rect);
-
- if (graphene_rect_intersection (&view_rect, rect, NULL))
- views_for_rect = g_list_prepend (views_for_rect, view);
- }
-
- return views_for_rect;
-}
-
-void
-clutter_stage_set_actor_needs_immediate_relayout (ClutterStage *stage)
-{
- ClutterStagePrivate *priv = stage->priv;
-
- priv->actor_needs_immediate_relayout = TRUE;
-}
-
-static void
-on_device_actor_reactive_changed (ClutterActor *actor,
- GParamSpec *pspec,
- PointerDeviceEntry *entry)
-{
- ClutterStage *self = entry->stage;
- ClutterActor *new_device_actor;
-
- g_assert (!clutter_actor_get_reactive (actor));
-
- new_device_actor =
- _clutter_stage_do_pick (self,
- entry->coords.x,
- entry->coords.y,
- CLUTTER_PICK_REACTIVE);
-
- clutter_stage_update_device (self,
- entry->device, entry->sequence,
- entry->coords,
- CLUTTER_CURRENT_TIME,
- new_device_actor,
- TRUE);
-}
-
-static void
-on_device_actor_destroyed (ClutterActor *actor,
- PointerDeviceEntry *entry)
-{
- /* Simply unset the current_actor pointer here, there's no need to
- * unset has_pointer or to disconnect any signals because the actor
- * is gone anyway.
- * Also, as soon as the next repaint happens, a repick should be triggered
- * and the PointerDeviceEntry will get updated again, so no need to
- * trigger a repick here.
- */
- entry->current_actor = NULL;
-}
-
-static void
-free_pointer_device_entry (PointerDeviceEntry *entry)
-{
- if (entry->current_actor)
- {
- ClutterActor *actor = entry->current_actor;
-
- g_signal_handlers_disconnect_by_func (actor,
- G_CALLBACK (on_device_actor_reactive_changed),
- entry);
- g_signal_handlers_disconnect_by_func (actor,
- G_CALLBACK (on_device_actor_destroyed),
- entry);
-
- _clutter_actor_set_has_pointer (actor, FALSE);
- }
-
- g_free (entry);
-}
-
-void
-clutter_stage_update_device_entry (ClutterStage *self,
- ClutterInputDevice *device,
- ClutterEventSequence *sequence,
- graphene_point_t coords,
- ClutterActor *actor)
-{
- ClutterStagePrivate *priv = self->priv;
- PointerDeviceEntry *entry = NULL;
-
- g_assert (device != NULL);
-
- if (sequence != NULL)
- entry = g_hash_table_lookup (priv->touch_sequences, sequence);
- else
- entry = g_hash_table_lookup (priv->pointer_devices, device);
-
- if (!entry)
- {
- entry = g_new0 (PointerDeviceEntry, 1);
-
- if (sequence != NULL)
- g_hash_table_insert (priv->touch_sequences, sequence, entry);
- else
- g_hash_table_insert (priv->pointer_devices, device, entry);
-
- entry->stage = self;
- entry->device = device;
- entry->sequence = sequence;
- }
-
- entry->coords = coords;
-
- if (entry->current_actor != actor)
- {
- if (entry->current_actor)
- {
- ClutterActor *old_actor = entry->current_actor;
-
- g_signal_handlers_disconnect_by_func (old_actor,
- G_CALLBACK (on_device_actor_reactive_changed),
- entry);
- g_signal_handlers_disconnect_by_func (old_actor,
- G_CALLBACK (on_device_actor_destroyed),
- entry);
-
- _clutter_actor_set_has_pointer (old_actor, FALSE);
- }
-
- entry->current_actor = actor;
-
- if (actor)
- {
- g_signal_connect (actor, "notify::reactive",
- G_CALLBACK (on_device_actor_reactive_changed), entry);
- g_signal_connect (actor, "destroy",
- G_CALLBACK (on_device_actor_destroyed), entry);
-
- _clutter_actor_set_has_pointer (actor, TRUE);
- }
- }
-}
-
-void
-clutter_stage_remove_device_entry (ClutterStage *self,
- ClutterInputDevice *device,
- ClutterEventSequence *sequence)
-{
- ClutterStagePrivate *priv = self->priv;
- gboolean removed;
-
- g_assert (device != NULL);
-
- if (sequence != NULL)
- removed = g_hash_table_remove (priv->touch_sequences, sequence);
- else
- removed = g_hash_table_remove (priv->pointer_devices, device);
-
- g_assert (removed);
-}
-
-/**
- * clutter_stage_get_device_actor:
- * @stage: a #ClutterStage
- * @device: a #ClutterInputDevice
- * @sequence: (allow-none): an optional #ClutterEventSequence
- *
- * Retrieves the #ClutterActor underneath the pointer or touch point
- * of @device and @sequence.
- *
- * Return value: (transfer none): a pointer to the #ClutterActor or %NULL
- */
-ClutterActor *
-clutter_stage_get_device_actor (ClutterStage *stage,
- ClutterInputDevice *device,
- ClutterEventSequence *sequence)
-{
- ClutterStagePrivate *priv = stage->priv;
- PointerDeviceEntry *entry = NULL;
-
- g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
- g_return_val_if_fail (device != NULL, NULL);
-
- if (sequence != NULL)
- entry = g_hash_table_lookup (priv->touch_sequences, sequence);
- else
- entry = g_hash_table_lookup (priv->pointer_devices, device);
-
- if (entry)
- return entry->current_actor;
-
- return NULL;
-}
-
-/**
- * clutter_stage_get_device_coords: (skip):
- */
-void
-clutter_stage_get_device_coords (ClutterStage *stage,
- ClutterInputDevice *device,
- ClutterEventSequence *sequence,
- graphene_point_t *coords)
-{
- ClutterStagePrivate *priv = stage->priv;
- PointerDeviceEntry *entry = NULL;
-
- g_return_if_fail (CLUTTER_IS_STAGE (stage));
- g_return_if_fail (device != NULL);
-
- if (sequence != NULL)
- entry = g_hash_table_lookup (priv->touch_sequences, sequence);
- else
- entry = g_hash_table_lookup (priv->pointer_devices, device);
-
- if (entry && coords)
- *coords = entry->coords;
-}
diff --git a/clutter/clutter/clutter-stage.h b/clutter/clutter/clutter-stage.h
deleted file mode 100644
index 69ab1d6eb..000000000
--- a/clutter/clutter/clutter-stage.h
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- *
- * Copyright (C) 2006 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 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_H__
-#define __CLUTTER_STAGE_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-actor.h>
-#include <clutter/clutter-types.h>
-#include <clutter/clutter-stage-view.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_STAGE (clutter_stage_get_type())
-
-#define CLUTTER_STAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_STAGE, ClutterStage))
-#define CLUTTER_STAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_STAGE, ClutterStageClass))
-#define CLUTTER_IS_STAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_STAGE))
-#define CLUTTER_IS_STAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_STAGE))
-#define CLUTTER_STAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_STAGE, ClutterStageClass))
-
-typedef struct _ClutterStageClass ClutterStageClass;
-typedef struct _ClutterStagePrivate ClutterStagePrivate;
-
-/**
- * ClutterStage:
- *
- * The #ClutterStage structure contains only private data
- * and should be accessed using the provided API
- *
- * Since: 0.2
- */
-struct _ClutterStage
-{
- /*< private >*/
- ClutterActor parent_instance;
-
- ClutterStagePrivate *priv;
-};
-/**
- * ClutterStageClass:
- * @activate: handler for the #ClutterStage::activate signal
- * @deactivate: handler for the #ClutterStage::deactivate signal
- *
- * The #ClutterStageClass structure contains only private data
- *
- * Since: 0.2
- */
-
-struct _ClutterStageClass
-{
- /*< private >*/
- ClutterActorClass parent_class;
-
- /*< public >*/
- /* signals */
- void (* activate) (ClutterStage *stage);
- void (* deactivate) (ClutterStage *stage);
-
- void (* before_paint) (ClutterStage *stage,
- ClutterStageView *view);
-
- void (* paint_view) (ClutterStage *stage,
- ClutterStageView *view,
- const cairo_region_t *redraw_clip);
-
- /*< private >*/
- /* padding for future expansion */
- gpointer _padding_dummy[31];
-};
-
-/**
- * ClutterPerspective:
- * @fovy: the field of view angle, in degrees, in the y direction
- * @aspect: the aspect ratio that determines the field of view in the x
- * direction. The aspect ratio is the ratio of x (width) to y (height)
- * @z_near: the distance from the viewer to the near clipping
- * plane (always positive)
- * @z_far: the distance from the viewer to the far clipping
- * plane (always positive)
- *
- * Stage perspective definition.
- *
- * Since: 0.4
- */
-struct _ClutterPerspective
-{
- gfloat fovy;
- gfloat aspect;
- gfloat z_near;
- gfloat z_far;
-};
-
-typedef enum
-{
- CLUTTER_FRAME_INFO_FLAG_NONE = 0,
- /* presentation_time timestamp was provided by the hardware */
- CLUTTER_FRAME_INFO_FLAG_HW_CLOCK = 1 << 0,
- /*
- * The presentation of this frame was done zero-copy. This means the buffer
- * from the client was given to display hardware as is, without copying it.
- * Compositing with OpenGL counts as copying, even if textured directly from
- * the client buffer. Possible zero-copy cases include direct scanout of a
- * fullscreen surface and a surface on a hardware overlay.
- */
- CLUTTER_FRAME_INFO_FLAG_ZERO_COPY = 1 << 1,
- /*
- * The presentation was synchronized to the "vertical retrace" by the display
- * hardware such that tearing does not happen. Relying on user space
- * scheduling is not acceptable for this flag. If presentation is done by a
- * copy to the active frontbuffer, then it must guarantee that tearing cannot
- * happen.
- */
- CLUTTER_FRAME_INFO_FLAG_VSYNC = 1 << 2,
-} ClutterFrameInfoFlag;
-
-/**
- * ClutterFrameInfo: (skip)
- */
-struct _ClutterFrameInfo
-{
- int64_t frame_counter;
- int64_t presentation_time; /* microseconds; CLOCK_MONOTONIC */
- float refresh_rate;
-
- ClutterFrameInfoFlag flags;
-
- unsigned int sequence;
-
- int64_t gpu_rendering_duration_ns;
- int64_t cpu_time_before_buffer_swap_us;
-};
-
-typedef struct _ClutterCapture
-{
- cairo_surface_t *image;
- cairo_rectangle_int_t rect;
-} ClutterCapture;
-
-CLUTTER_EXPORT
-GType clutter_perspective_get_type (void) G_GNUC_CONST;
-CLUTTER_EXPORT
-GType clutter_stage_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-void clutter_stage_get_perspective (ClutterStage *stage,
- ClutterPerspective *perspective);
-CLUTTER_EXPORT
-void clutter_stage_set_title (ClutterStage *stage,
- const gchar *title);
-CLUTTER_EXPORT
-const gchar * clutter_stage_get_title (ClutterStage *stage);
-
-CLUTTER_EXPORT
-void clutter_stage_set_minimum_size (ClutterStage *stage,
- guint width,
- guint height);
-CLUTTER_EXPORT
-void clutter_stage_get_minimum_size (ClutterStage *stage,
- guint *width,
- guint *height);
-CLUTTER_EXPORT
-void clutter_stage_set_use_alpha (ClutterStage *stage,
- gboolean use_alpha);
-CLUTTER_EXPORT
-gboolean clutter_stage_get_use_alpha (ClutterStage *stage);
-
-CLUTTER_EXPORT
-void clutter_stage_set_key_focus (ClutterStage *stage,
- ClutterActor *actor);
-CLUTTER_EXPORT
-ClutterActor * clutter_stage_get_key_focus (ClutterStage *stage);
-CLUTTER_EXPORT
-void clutter_stage_set_throttle_motion_events (ClutterStage *stage,
- gboolean throttle);
-CLUTTER_EXPORT
-gboolean clutter_stage_get_throttle_motion_events (ClutterStage *stage);
-CLUTTER_EXPORT
-void clutter_stage_set_motion_events_enabled (ClutterStage *stage,
- gboolean enabled);
-CLUTTER_EXPORT
-gboolean clutter_stage_get_motion_events_enabled (ClutterStage *stage);
-CLUTTER_EXPORT
-gboolean clutter_stage_event (ClutterStage *stage,
- ClutterEvent *event);
-
-CLUTTER_EXPORT
-ClutterActor * clutter_stage_get_actor_at_pos (ClutterStage *stage,
- ClutterPickMode pick_mode,
- float x,
- float y);
-CLUTTER_EXPORT
-guchar * clutter_stage_read_pixels (ClutterStage *stage,
- gint x,
- gint y,
- gint width,
- gint height);
-
-CLUTTER_EXPORT
-void clutter_stage_ensure_viewport (ClutterStage *stage);
-
-CLUTTER_EXPORT
-gboolean clutter_stage_is_redraw_queued_on_view (ClutterStage *stage,
- ClutterStageView *view);
-CLUTTER_EXPORT
-void clutter_stage_schedule_update (ClutterStage *stage);
-
-CLUTTER_EXPORT
-gboolean clutter_stage_get_capture_final_size (ClutterStage *stage,
- cairo_rectangle_int_t *rect,
- int *out_width,
- int *out_height,
- float *out_scale);
-
-CLUTTER_EXPORT
-void clutter_stage_paint_to_framebuffer (ClutterStage *stage,
- CoglFramebuffer *framebuffer,
- const cairo_rectangle_int_t *rect,
- float scale,
- ClutterPaintFlag paint_flags);
-
-CLUTTER_EXPORT
-gboolean clutter_stage_paint_to_buffer (ClutterStage *stage,
- const cairo_rectangle_int_t *rect,
- float scale,
- uint8_t *data,
- int stride,
- CoglPixelFormat format,
- ClutterPaintFlag paint_flags,
- GError **error);
-
-CLUTTER_EXPORT
-ClutterStageView * clutter_stage_get_view_at (ClutterStage *stage,
- float x,
- float y);
-
-CLUTTER_EXPORT
-ClutterActor * clutter_stage_get_device_actor (ClutterStage *stage,
- ClutterInputDevice *device,
- ClutterEventSequence *sequence);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_STAGE_H__ */
diff --git a/clutter/clutter/clutter-swipe-action.c b/clutter/clutter/clutter-swipe-action.c
deleted file mode 100644
index 2706e1d82..000000000
--- a/clutter/clutter/clutter-swipe-action.c
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- * Copyright (C) 2011 Robert Bosch Car Multimedia GmbH.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Tomeu Vizoso <tomeu.vizoso@collabora.co.uk>
- *
- * Based on ClutterDragAction, written by:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-swipe-action
- * @Title: ClutterSwipeAction
- * @Short_Description: Action for swipe gestures
- *
- * #ClutterSwipeAction is a sub-class of #ClutterGestureAction that implements
- * the logic for recognizing swipe gestures.
- *
- * Since: 1.8
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-swipe-action.h"
-
-#include "clutter-debug.h"
-#include "clutter-enum-types.h"
-#include "clutter-gesture-action-private.h"
-#include "clutter-marshal.h"
-#include "clutter-private.h"
-
-struct _ClutterSwipeActionPrivate
-{
- ClutterSwipeDirection h_direction;
- ClutterSwipeDirection v_direction;
-
- float distance_x, distance_y;
-};
-
-enum
-{
- SWEPT,
- SWIPE,
-
- LAST_SIGNAL
-};
-
-static guint swipe_signals[LAST_SIGNAL] = { 0, };
-
-G_DEFINE_TYPE_WITH_PRIVATE (ClutterSwipeAction, clutter_swipe_action, CLUTTER_TYPE_GESTURE_ACTION)
-
-static gboolean
-gesture_begin (ClutterGestureAction *action,
- ClutterActor *actor)
-{
- ClutterSwipeActionPrivate *priv = CLUTTER_SWIPE_ACTION (action)->priv;
-
- /* reset the state at the beginning of a new gesture */
- priv->h_direction = 0;
- priv->v_direction = 0;
-
- g_object_get (action,
- "threshold-trigger-distance-x", &priv->distance_x,
- "threshold-trigger-distance-y", &priv->distance_y,
- NULL);
-
- return TRUE;
-}
-
-static gboolean
-gesture_progress (ClutterGestureAction *action,
- ClutterActor *actor)
-{
- ClutterSwipeActionPrivate *priv = CLUTTER_SWIPE_ACTION (action)->priv;
- gfloat press_x, press_y;
- gfloat motion_x, motion_y;
- gfloat delta_x, delta_y;
- ClutterSwipeDirection h_direction = 0, v_direction = 0;
-
- clutter_gesture_action_get_press_coords (action,
- 0,
- &press_x,
- &press_y);
-
- clutter_gesture_action_get_motion_coords (action,
- 0,
- &motion_x,
- &motion_y);
-
- delta_x = press_x - motion_x;
- delta_y = press_y - motion_y;
-
- if (delta_x >= priv->distance_x)
- h_direction = CLUTTER_SWIPE_DIRECTION_RIGHT;
- else if (delta_x < -priv->distance_x)
- h_direction = CLUTTER_SWIPE_DIRECTION_LEFT;
-
- if (delta_y >= priv->distance_y)
- v_direction = CLUTTER_SWIPE_DIRECTION_DOWN;
- else if (delta_y < -priv->distance_y)
- v_direction = CLUTTER_SWIPE_DIRECTION_UP;
-
- /* cancel gesture on direction reversal */
- if (priv->h_direction == 0)
- priv->h_direction = h_direction;
-
- if (priv->v_direction == 0)
- priv->v_direction = v_direction;
-
- if (priv->h_direction != h_direction)
- return FALSE;
-
- if (priv->v_direction != v_direction)
- return FALSE;
-
- return TRUE;
-}
-
-static void
-gesture_end (ClutterGestureAction *action,
- ClutterActor *actor)
-{
- ClutterSwipeActionPrivate *priv = CLUTTER_SWIPE_ACTION (action)->priv;
- gfloat press_x, press_y;
- gfloat release_x, release_y;
- ClutterSwipeDirection direction = 0;
- gboolean can_emit_swipe;
- const ClutterEvent *last_event;
-
- clutter_gesture_action_get_press_coords (action,
- 0,
- &press_x, &press_y);
-
- /* Check the last event instead of get_release_coords(), this
- * might not be the sequence that finished on multi-finger swipes.
- */
- last_event = clutter_gesture_action_get_last_event (action, 0);
- clutter_event_get_coords (last_event, &release_x, &release_y);
-
- if (release_x - press_x > priv->distance_x)
- direction |= CLUTTER_SWIPE_DIRECTION_RIGHT;
- else if (press_x - release_x > priv->distance_x)
- direction |= CLUTTER_SWIPE_DIRECTION_LEFT;
-
- if (release_y - press_y > priv->distance_y)
- direction |= CLUTTER_SWIPE_DIRECTION_DOWN;
- else if (press_y - release_y > priv->distance_y)
- direction |= CLUTTER_SWIPE_DIRECTION_UP;
-
- /* XXX:2.0 remove */
- g_signal_emit (action, swipe_signals[SWIPE], 0, actor, direction,
- &can_emit_swipe);
- if (can_emit_swipe)
- g_signal_emit (action, swipe_signals[SWEPT], 0, actor, direction);
-}
-
-/* XXX:2.0 remove */
-static gboolean
-clutter_swipe_action_real_swipe (ClutterSwipeAction *action,
- ClutterActor *actor,
- ClutterSwipeDirection direction)
-{
- return TRUE;
-}
-
-static void
-clutter_swipe_action_constructed (GObject *object)
-{
- clutter_gesture_action_set_threshold_trigger_edge (CLUTTER_GESTURE_ACTION (object),
- CLUTTER_GESTURE_TRIGGER_EDGE_AFTER);
-}
-
-static void
-clutter_swipe_action_class_init (ClutterSwipeActionClass *klass)
-{
- ClutterGestureActionClass *gesture_class =
- CLUTTER_GESTURE_ACTION_CLASS (klass);
- GObjectClass *object_class =
- G_OBJECT_CLASS (klass);
-
- object_class->constructed = clutter_swipe_action_constructed;
-
- gesture_class->gesture_begin = gesture_begin;
- gesture_class->gesture_progress = gesture_progress;
- gesture_class->gesture_end = gesture_end;
-
- /* XXX:2.0 remove */
- klass->swipe = clutter_swipe_action_real_swipe;
-
- /**
- * ClutterSwipeAction::swept:
- * @action: the #ClutterSwipeAction that emitted the signal
- * @actor: the #ClutterActor attached to the @action
- * @direction: the main direction of the swipe gesture
- *
- * The ::swept signal is emitted when a swipe gesture is recognized on the
- * attached actor.
- *
- * Deprecated: 1.14: Use the ::swipe signal instead.
- *
- * Since: 1.8
- */
- swipe_signals[SWEPT] =
- g_signal_new (I_("swept"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST |
- G_SIGNAL_DEPRECATED,
- G_STRUCT_OFFSET (ClutterSwipeActionClass, swept),
- NULL, NULL,
- _clutter_marshal_VOID__OBJECT_FLAGS,
- G_TYPE_NONE, 2,
- CLUTTER_TYPE_ACTOR,
- CLUTTER_TYPE_SWIPE_DIRECTION);
-
- /**
- * ClutterSwipeAction::swipe:
- * @action: the #ClutterSwipeAction that emitted the signal
- * @actor: the #ClutterActor attached to the @action
- * @direction: the main direction of the swipe gesture
- *
- * The ::swipe signal is emitted when a swipe gesture is recognized on the
- * attached actor.
- *
- * Return value: %TRUE if the swipe should continue, and %FALSE if
- * the swipe should be cancelled.
- *
- * Since: 1.14
- */
- swipe_signals[SWIPE] =
- g_signal_new (I_("swipe"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterSwipeActionClass, swipe),
- _clutter_boolean_continue_accumulator, NULL,
- _clutter_marshal_BOOLEAN__OBJECT_FLAGS,
- G_TYPE_BOOLEAN, 2,
- CLUTTER_TYPE_ACTOR,
- CLUTTER_TYPE_SWIPE_DIRECTION);
-}
-
-static void
-clutter_swipe_action_init (ClutterSwipeAction *self)
-{
- self->priv = clutter_swipe_action_get_instance_private (self);
-}
-
-/**
- * clutter_swipe_action_new:
- *
- * Creates a new #ClutterSwipeAction instance
- *
- * Return value: the newly created #ClutterSwipeAction
- *
- * Since: 1.8
- */
-ClutterAction *
-clutter_swipe_action_new (void)
-{
- return g_object_new (CLUTTER_TYPE_SWIPE_ACTION, NULL);
-}
diff --git a/clutter/clutter/clutter-swipe-action.h b/clutter/clutter/clutter-swipe-action.h
deleted file mode 100644
index 1bf50c6bf..000000000
--- a/clutter/clutter/clutter-swipe-action.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- * Copyright (C) 2011 Robert Bosch Car Multimedia GmbH.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Tomeu Vizoso <tomeu.vizoso@collabora.co.uk>
- *
- * Based on ClutterDragAction, written by:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#ifndef __CLUTTER_SWIPE_ACTION_H__
-#define __CLUTTER_SWIPE_ACTION_H__
-
-#include <clutter/clutter-gesture-action.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_SWIPE_ACTION (clutter_swipe_action_get_type ())
-#define CLUTTER_SWIPE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_SWIPE_ACTION, ClutterSwipeAction))
-#define CLUTTER_IS_SWIPE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_SWIPE_ACTION))
-#define CLUTTER_SWIPE_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_SWIPE_ACTION, ClutterSwipeActionClass))
-#define CLUTTER_IS_SWIPE_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_SWIPE_ACTION))
-#define CLUTTER_SWIPE_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_SWIPE_ACTION, ClutterSwipeActionClass))
-
-typedef struct _ClutterSwipeAction ClutterSwipeAction;
-typedef struct _ClutterSwipeActionPrivate ClutterSwipeActionPrivate;
-typedef struct _ClutterSwipeActionClass ClutterSwipeActionClass;
-
-/**
- * ClutterSwipeAction:
- *
- * The #ClutterSwipeAction structure contains
- * only private data and should be accessed using the provided API
- *
- * Since: 1.8
- */
-struct _ClutterSwipeAction
-{
- /*< private >*/
- ClutterGestureAction parent_instance;
-
- ClutterSwipeActionPrivate *priv;
-};
-
-/**
- * ClutterSwipeActionClass:
- * @swept: class handler for the #ClutterSwipeAction::swept signal;
- * deprecated since 1.14
- * @swipe: class handler for the #ClutterSwipeAction::swipe signal
- *
- * The #ClutterSwipeActionClass structure contains
- * only private data.
- *
- * Since: 1.8
- */
-struct _ClutterSwipeActionClass
-{
- /*< private >*/
- ClutterGestureActionClass parent_class;
-
- /*< public >*/
- void (* swept) (ClutterSwipeAction *action,
- ClutterActor *actor,
- ClutterSwipeDirection direction);
-
- gboolean (* swipe) (ClutterSwipeAction *action,
- ClutterActor *actor,
- ClutterSwipeDirection direction);
-
- /*< private >*/
- void (* _clutter_swipe_action1) (void);
- void (* _clutter_swipe_action2) (void);
- void (* _clutter_swipe_action3) (void);
- void (* _clutter_swipe_action4) (void);
- void (* _clutter_swipe_action5) (void);
- void (* _clutter_swipe_action6) (void);
-};
-
-CLUTTER_EXPORT
-GType clutter_swipe_action_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterAction * clutter_swipe_action_new (void);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_SWIPE_ACTION_H__ */
diff --git a/clutter/clutter/clutter-tap-action.c b/clutter/clutter/clutter-tap-action.c
deleted file mode 100644
index e5353f040..000000000
--- a/clutter/clutter/clutter-tap-action.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- * Copyright (C) 2011 Robert Bosch Car Multimedia GmbH.
- * Copyright (C) 2012 Collabora Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emanuele Aina <emanuele.aina@collabora.com>
- *
- * Based on ClutterPanAction
- * Based on ClutterDragAction, ClutterSwipeAction, and MxKineticScrollView,
- * written by:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- * Tomeu Vizoso <tomeu.vizoso@collabora.co.uk>
- * Chris Lord <chris@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-tap-action
- * @Title: ClutterTapAction
- * @Short_Description: Action for tap gestures
- *
- * #ClutterTapAction is a sub-class of #ClutterGestureAction that implements
- * the logic for recognizing mouse clicks and touch tap gestures.
- *
- * The simplest usage of #ClutterTapAction consists in adding it to
- * a #ClutterActor, setting it as reactive and connecting a
- * callback for the #ClutterTapAction::tap signal, along the lines of the
- * following code:
- *
- * |[
- * clutter_actor_add_action (actor, clutter_tap_action_new ());
- * clutter_actor_set_reactive (actor, TRUE);
- * g_signal_connect (action, "tap", G_CALLBACK (on_tap_callback), NULL);
- * ]|
- *
- * Since: 1.14
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-tap-action.h"
-
-#include "clutter-debug.h"
-#include "clutter-enum-types.h"
-#include "clutter-gesture-action-private.h"
-#include "clutter-marshal.h"
-#include "clutter-private.h"
-
-enum
-{
- TAP,
-
- LAST_SIGNAL
-};
-
-static guint tap_signals[LAST_SIGNAL] = { 0, };
-
-G_DEFINE_TYPE (ClutterTapAction, clutter_tap_action,
- CLUTTER_TYPE_GESTURE_ACTION);
-
-static void
-emit_tap (ClutterTapAction *self,
- ClutterActor *actor)
-{
- g_signal_emit (self, tap_signals[TAP], 0, actor);
-}
-
-static void
-gesture_end (ClutterGestureAction *gesture,
- ClutterActor *actor)
-{
- emit_tap (CLUTTER_TAP_ACTION (gesture), actor);
-}
-
-static void
-clutter_tap_action_constructed (GObject *object)
-{
- clutter_gesture_action_set_threshold_trigger_edge (CLUTTER_GESTURE_ACTION (object),
- CLUTTER_GESTURE_TRIGGER_EDGE_BEFORE);
-}
-
-static void
-clutter_tap_action_class_init (ClutterTapActionClass *klass)
-{
- ClutterGestureActionClass *gesture_class =
- CLUTTER_GESTURE_ACTION_CLASS (klass);
- GObjectClass *object_class =
- G_OBJECT_CLASS (klass);
-
- object_class->constructed = clutter_tap_action_constructed;
-
- gesture_class->gesture_end = gesture_end;
-
- /**
- * ClutterTapAction::tap:
- * @action: the #ClutterTapAction that emitted the signal
- * @actor: the #ClutterActor attached to the @action
- *
- * The ::tap signal is emitted when the tap gesture is complete.
- *
- * Since: 1.14
- */
- tap_signals[TAP] =
- g_signal_new (I_("tap"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterTapActionClass, tap),
- NULL, NULL, NULL,
- G_TYPE_NONE, 1,
- CLUTTER_TYPE_ACTOR);
-}
-
-static void
-clutter_tap_action_init (ClutterTapAction *self)
-{
-}
-
-/**
- * clutter_tap_action_new:
- *
- * Creates a new #ClutterTapAction instance
- *
- * Return value: the newly created #ClutterTapAction
- *
- * Since: 1.14
- */
-ClutterAction *
-clutter_tap_action_new (void)
-{
- return g_object_new (CLUTTER_TYPE_TAP_ACTION, NULL);
-}
diff --git a/clutter/clutter/clutter-tap-action.h b/clutter/clutter/clutter-tap-action.h
deleted file mode 100644
index 97fd604f3..000000000
--- a/clutter/clutter/clutter-tap-action.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2010 Intel Corporation.
- * Copyright (C) 2011 Robert Bosch Car Multimedia GmbH.
- * Copyright (C) 2012 Collabora Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emanuele Aina <emanuele.aina@collabora.com>
- *
- * Based on ClutterPanAction
- * Based on ClutterDragAction, ClutterSwipeAction, and MxKineticScrollView,
- * written by:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- * Tomeu Vizoso <tomeu.vizoso@collabora.co.uk>
- * Chris Lord <chris@linux.intel.com>
- */
-
-#ifndef __CLUTTER_TAP_ACTION_H__
-#define __CLUTTER_TAP_ACTION_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-gesture-action.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_TAP_ACTION (clutter_tap_action_get_type ())
-#define CLUTTER_TAP_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_TAP_ACTION, ClutterTapAction))
-#define CLUTTER_IS_TAP_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_TAP_ACTION))
-#define CLUTTER_TAP_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_TAP_ACTION, ClutterTapActionClass))
-#define CLUTTER_IS_TAP_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_TAP_ACTION))
-#define CLUTTER_TAP_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_TAP_ACTION, ClutterTapActionClass))
-
-typedef struct _ClutterTapAction ClutterTapAction;
-typedef struct _ClutterTapActionPrivate ClutterTapActionPrivate;
-typedef struct _ClutterTapActionClass ClutterTapActionClass;
-
-/**
- * ClutterTapAction:
- *
- * The #ClutterTapAction structure contains
- * only private data and should be accessed using the provided API
- *
- * Since: 1.14
- */
-struct _ClutterTapAction
-{
- /*< private >*/
- ClutterGestureAction parent_instance;
-};
-
-/**
- * ClutterTapActionClass:
- * @tap: class handler for the #ClutterTapAction::tap signal
- *
- * The #ClutterTapActionClass structure contains
- * only private data.
- */
-struct _ClutterTapActionClass
-{
- /*< private >*/
- ClutterGestureActionClass parent_class;
-
- /*< public >*/
- gboolean (* tap) (ClutterTapAction *action,
- ClutterActor *actor);
-
- /*< private >*/
- void (* _clutter_tap_action1) (void);
- void (* _clutter_tap_action2) (void);
- void (* _clutter_tap_action3) (void);
- void (* _clutter_tap_action4) (void);
- void (* _clutter_tap_action5) (void);
- void (* _clutter_tap_action6) (void);
-};
-
-CLUTTER_EXPORT
-GType clutter_tap_action_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterAction * clutter_tap_action_new (void);
-G_END_DECLS
-
-#endif /* __CLUTTER_TAP_ACTION_H__ */
diff --git a/clutter/clutter/clutter-text-buffer.c b/clutter/clutter/clutter-text-buffer.c
deleted file mode 100644
index 1436921d1..000000000
--- a/clutter/clutter/clutter-text-buffer.c
+++ /dev/null
@@ -1,766 +0,0 @@
-/* clutter-text-buffer.c
- * Copyright (C) 2011 Collabora Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Stef Walter <stefw@collabora.co.uk>
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-text-buffer.h"
-#include "clutter-marshal.h"
-#include "clutter-private.h"
-
-#include <string.h>
-
-/**
- * SECTION:clutter-text-buffer
- * @title: ClutterTextBuffer
- * @short_description: Text buffer for ClutterText
- *
- * The #ClutterTextBuffer class contains the actual text displayed in a
- * #ClutterText widget.
- *
- * A single #ClutterTextBuffer object can be shared by multiple #ClutterText
- * widgets which will then share the same text content, but not the cursor
- * position, visibility attributes, icon etc.
- *
- * #ClutterTextBuffer may be derived from. Such a derived class might allow
- * text to be stored in an alternate location, such as non-pageable memory,
- * useful in the case of important passwords. Or a derived class could
- * integrate with an application's concept of undo/redo.
- *
- * Since: 1.10
- */
-
-/* Initial size of buffer, in bytes */
-#define MIN_SIZE 16
-
-enum
-{
- PROP_0,
- PROP_TEXT,
- PROP_LENGTH,
- PROP_MAX_LENGTH,
- PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST] = { NULL, };
-
-enum
-{
- INSERTED_TEXT,
- DELETED_TEXT,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-struct _ClutterTextBufferPrivate
-{
- gint max_length;
-
- /* Only valid if this class is not derived */
- gchar *normal_text;
- gsize normal_text_size;
- gsize normal_text_bytes;
- guint normal_text_chars;
-};
-
-G_DEFINE_TYPE_WITH_PRIVATE (ClutterTextBuffer, clutter_text_buffer, G_TYPE_OBJECT)
-
-/* --------------------------------------------------------------------------------
- * DEFAULT IMPLEMENTATIONS OF TEXT BUFFER
- *
- * These may be overridden by a derived class, behavior may be changed etc...
- * The normal_text and normal_text_xxxx fields may not be valid when
- * this class is derived from.
- */
-
-/* Overwrite a memory that might contain sensitive information. */
-static void
-trash_area (gchar *area,
- gsize len)
-{
- volatile gchar *varea = (volatile gchar *)area;
- while (len-- > 0)
- *varea++ = 0;
-}
-
-static const gchar*
-clutter_text_buffer_normal_get_text (ClutterTextBuffer *buffer,
- gsize *n_bytes)
-{
- if (n_bytes)
- *n_bytes = buffer->priv->normal_text_bytes;
- if (!buffer->priv->normal_text)
- return "";
- return buffer->priv->normal_text;
-}
-
-static guint
-clutter_text_buffer_normal_get_length (ClutterTextBuffer *buffer)
-{
- return buffer->priv->normal_text_chars;
-}
-
-static guint
-clutter_text_buffer_normal_insert_text (ClutterTextBuffer *buffer,
- guint position,
- const gchar *chars,
- guint n_chars)
-{
- ClutterTextBufferPrivate *pv = buffer->priv;
- gsize prev_size;
- gsize n_bytes;
- gsize at;
-
- n_bytes = g_utf8_offset_to_pointer (chars, n_chars) - chars;
-
- /* Need more memory */
- if (n_bytes + pv->normal_text_bytes + 1 > pv->normal_text_size)
- {
- gchar *et_new;
-
- prev_size = pv->normal_text_size;
-
- /* Calculate our new buffer size */
- while (n_bytes + pv->normal_text_bytes + 1 > pv->normal_text_size)
- {
- if (pv->normal_text_size == 0)
- pv->normal_text_size = MIN_SIZE;
- else
- {
- if (2 * pv->normal_text_size < CLUTTER_TEXT_BUFFER_MAX_SIZE)
- pv->normal_text_size *= 2;
- else
- {
- pv->normal_text_size = CLUTTER_TEXT_BUFFER_MAX_SIZE;
- if (n_bytes > pv->normal_text_size - pv->normal_text_bytes - 1)
- {
- n_bytes = pv->normal_text_size - pv->normal_text_bytes - 1;
- n_bytes = g_utf8_find_prev_char (chars, chars + n_bytes + 1) - chars;
- n_chars = g_utf8_strlen (chars, n_bytes);
- }
- break;
- }
- }
- }
-
- /* Could be a password, so can't leave stuff in memory. */
- et_new = g_malloc (pv->normal_text_size);
- memcpy (et_new, pv->normal_text, MIN (prev_size, pv->normal_text_size));
- trash_area (pv->normal_text, prev_size);
- g_free (pv->normal_text);
- pv->normal_text = et_new;
- }
-
- /* 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);
- memcpy (pv->normal_text + at, chars, n_bytes);
-
- /* Book keeping */
- pv->normal_text_bytes += n_bytes;
- pv->normal_text_chars += n_chars;
- pv->normal_text[pv->normal_text_bytes] = '\0';
-
- clutter_text_buffer_emit_inserted_text (buffer, position, chars, n_chars);
- return n_chars;
-}
-
-static guint
-clutter_text_buffer_normal_delete_text (ClutterTextBuffer *buffer,
- guint position,
- guint n_chars)
-{
- ClutterTextBufferPrivate *pv = buffer->priv;
- gsize start, end;
-
- if (position > pv->normal_text_chars)
- position = pv->normal_text_chars;
- if (position + n_chars > pv->normal_text_chars)
- n_chars = pv->normal_text_chars - position;
-
- if (n_chars > 0)
- {
- 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);
- pv->normal_text_chars -= n_chars;
- pv->normal_text_bytes -= (end - start);
-
- /*
- * Could be a password, make sure we don't leave anything sensitive after
- * the terminating zero. Note, that the terminating zero already trashed
- * one byte.
- */
- trash_area (pv->normal_text + pv->normal_text_bytes + 1, end - start - 1);
-
- clutter_text_buffer_emit_deleted_text (buffer, position, n_chars);
- }
-
- return n_chars;
-}
-
-/* --------------------------------------------------------------------------------
- *
- */
-
-static void
-clutter_text_buffer_real_inserted_text (ClutterTextBuffer *buffer,
- guint position,
- 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]);
-}
-
-static void
-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]);
-}
-
-/* --------------------------------------------------------------------------------
- *
- */
-
-static void
-clutter_text_buffer_init (ClutterTextBuffer *self)
-{
- self->priv = clutter_text_buffer_get_instance_private (self);
-
- self->priv->normal_text = NULL;
- self->priv->normal_text_chars = 0;
- self->priv->normal_text_bytes = 0;
- self->priv->normal_text_size = 0;
-}
-
-static void
-clutter_text_buffer_finalize (GObject *obj)
-{
- ClutterTextBuffer *buffer = CLUTTER_TEXT_BUFFER (obj);
- ClutterTextBufferPrivate *pv = buffer->priv;
-
- if (pv->normal_text)
- {
- trash_area (pv->normal_text, pv->normal_text_size);
- g_free (pv->normal_text);
- pv->normal_text = NULL;
- pv->normal_text_bytes = pv->normal_text_size = 0;
- pv->normal_text_chars = 0;
- }
-
- G_OBJECT_CLASS (clutter_text_buffer_parent_class)->finalize (obj);
-}
-
-static void
-clutter_text_buffer_set_property (GObject *obj,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterTextBuffer *buffer = CLUTTER_TEXT_BUFFER (obj);
-
- switch (prop_id)
- {
- case PROP_MAX_LENGTH:
- clutter_text_buffer_set_max_length (buffer, g_value_get_int (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_text_buffer_get_property (GObject *obj,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterTextBuffer *buffer = CLUTTER_TEXT_BUFFER (obj);
-
- switch (prop_id)
- {
- case PROP_TEXT:
- g_value_set_string (value, clutter_text_buffer_get_text (buffer));
- break;
- case PROP_LENGTH:
- g_value_set_uint (value, clutter_text_buffer_get_length (buffer));
- break;
- case PROP_MAX_LENGTH:
- g_value_set_int (value, clutter_text_buffer_get_max_length (buffer));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_text_buffer_class_init (ClutterTextBufferClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- gobject_class->finalize = clutter_text_buffer_finalize;
- gobject_class->set_property = clutter_text_buffer_set_property;
- gobject_class->get_property = clutter_text_buffer_get_property;
-
- klass->get_text = clutter_text_buffer_normal_get_text;
- klass->get_length = clutter_text_buffer_normal_get_length;
- klass->insert_text = clutter_text_buffer_normal_insert_text;
- klass->delete_text = clutter_text_buffer_normal_delete_text;
-
- klass->inserted_text = clutter_text_buffer_real_inserted_text;
- klass->deleted_text = clutter_text_buffer_real_deleted_text;
-
- /**
- * ClutterTextBuffer:text:
- *
- * The contents of the buffer.
- *
- * Since: 1.10
- */
- obj_props[PROP_TEXT] =
- g_param_spec_string ("text",
- P_("Text"),
- P_("The contents of the buffer"),
- "",
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
-
- /**
- * ClutterTextBuffer:length:
- *
- * The length (in characters) of the text in buffer.
- *
- * Since: 1.10
- */
- obj_props[PROP_LENGTH] =
- g_param_spec_uint ("length",
- P_("Text length"),
- P_("Length of the text currently in the buffer"),
- 0, CLUTTER_TEXT_BUFFER_MAX_SIZE, 0,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
-
- /**
- * ClutterTextBuffer:max-length:
- *
- * The maximum length (in characters) of the text in the buffer.
- *
- * Since: 1.10
- */
- obj_props[PROP_MAX_LENGTH] =
- g_param_spec_int ("max-length",
- P_("Maximum length"),
- P_("Maximum number of characters for this entry. Zero if no maximum"),
- 0, CLUTTER_TEXT_BUFFER_MAX_SIZE, 0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
-
- /**
- * ClutterTextBuffer::inserted-text:
- * @buffer: a #ClutterTextBuffer
- * @position: the position the text was inserted at.
- * @chars: The text that was inserted.
- * @n_chars: The number of characters that were inserted.
- *
- * This signal is emitted after text is inserted into the buffer.
- *
- * Since: 1.10
- */
- signals[INSERTED_TEXT] =
- g_signal_new (I_("inserted-text"),
- CLUTTER_TYPE_TEXT_BUFFER,
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (ClutterTextBufferClass, inserted_text),
- NULL, NULL,
- _clutter_marshal_VOID__UINT_STRING_UINT,
- G_TYPE_NONE, 3,
- G_TYPE_UINT,
- G_TYPE_STRING,
- G_TYPE_UINT);
-
- /**
- * ClutterTextBuffer::deleted-text:
- * @buffer: a #ClutterTextBuffer
- * @position: the position the text was deleted at.
- * @n_chars: The number of characters that were deleted.
- *
- * This signal is emitted after text is deleted from the buffer.
- *
- * Since: 1.10
- */
- signals[DELETED_TEXT] =
- g_signal_new (I_("deleted-text"),
- CLUTTER_TYPE_TEXT_BUFFER,
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (ClutterTextBufferClass, deleted_text),
- NULL, NULL,
- _clutter_marshal_VOID__UINT_UINT,
- G_TYPE_NONE, 2,
- G_TYPE_UINT,
- G_TYPE_UINT);
-}
-
-/* --------------------------------------------------------------------------------
- *
- */
-
-/**
- * clutter_text_buffer_new:
- *
- * Create a new ClutterTextBuffer object.
- *
- * Return value: A new ClutterTextBuffer object.
- *
- * Since: 1.10
- **/
-ClutterTextBuffer*
-clutter_text_buffer_new (void)
-{
- return g_object_new (CLUTTER_TYPE_TEXT_BUFFER, NULL);
-}
-
-
-/**
- * clutter_text_buffer_new_with_text:
- * @text: (allow-none): initial buffer text
- * @text_len: initial buffer text length, or -1 for null-terminated.
- *
- * Create a new ClutterTextBuffer object with some text.
- *
- * Return value: A new ClutterTextBuffer object.
- *
- * Since: 1.10
- **/
-ClutterTextBuffer*
-clutter_text_buffer_new_with_text (const gchar *text,
- gssize text_len)
-{
- ClutterTextBuffer *buffer;
- buffer = clutter_text_buffer_new ();
- clutter_text_buffer_set_text (buffer, text, text_len);
- return buffer;
-}
-
-
-/**
- * clutter_text_buffer_get_length:
- * @buffer: a #ClutterTextBuffer
- *
- * Retrieves the length in characters of the buffer.
- *
- * Return value: The number of characters in the buffer.
- *
- * Since: 1.10
- **/
-guint
-clutter_text_buffer_get_length (ClutterTextBuffer *buffer)
-{
- ClutterTextBufferClass *klass;
-
- g_return_val_if_fail (CLUTTER_IS_TEXT_BUFFER (buffer), 0);
-
- klass = CLUTTER_TEXT_BUFFER_GET_CLASS (buffer);
- g_return_val_if_fail (klass->get_length != NULL, 0);
-
- return (*klass->get_length) (buffer);
-}
-
-/**
- * clutter_text_buffer_get_bytes:
- * @buffer: a #ClutterTextBuffer
- *
- * Retrieves the length in bytes of the buffer.
- * See clutter_text_buffer_get_length().
- *
- * Return value: The byte length of the buffer.
- *
- * Since: 1.10
- **/
-gsize
-clutter_text_buffer_get_bytes (ClutterTextBuffer *buffer)
-{
- ClutterTextBufferClass *klass;
- gsize bytes = 0;
-
- g_return_val_if_fail (CLUTTER_IS_TEXT_BUFFER (buffer), 0);
-
- klass = CLUTTER_TEXT_BUFFER_GET_CLASS (buffer);
- g_return_val_if_fail (klass->get_text != NULL, 0);
-
- (*klass->get_text) (buffer, &bytes);
- return bytes;
-}
-
-/**
- * clutter_text_buffer_get_text:
- * @buffer: a #ClutterTextBuffer
- *
- * Retrieves the contents of the buffer.
- *
- * The memory pointer returned by this call will not change
- * unless this object emits a signal, or is finalized.
- *
- * Return value: a pointer to the contents of the widget as a
- * string. This string points to internally allocated
- * storage in the buffer and must not be freed, modified or
- * stored.
- *
- * Since: 1.10
- **/
-const gchar*
-clutter_text_buffer_get_text (ClutterTextBuffer *buffer)
-{
- ClutterTextBufferClass *klass;
-
- g_return_val_if_fail (CLUTTER_IS_TEXT_BUFFER (buffer), NULL);
-
- klass = CLUTTER_TEXT_BUFFER_GET_CLASS (buffer);
- g_return_val_if_fail (klass->get_text != NULL, NULL);
-
- return (*klass->get_text) (buffer, NULL);
-}
-
-/**
- * clutter_text_buffer_set_text:
- * @buffer: a #ClutterTextBuffer
- * @chars: the new text
- * @n_chars: the number of characters in @text, or -1
- *
- * Sets the text in the buffer.
- *
- * This is roughly equivalent to calling clutter_text_buffer_delete_text()
- * and clutter_text_buffer_insert_text().
- *
- * Note that @n_chars is in characters, not in bytes.
- *
- * Since: 1.10
- **/
-void
-clutter_text_buffer_set_text (ClutterTextBuffer *buffer,
- const gchar *chars,
- gint n_chars)
-{
- g_return_if_fail (CLUTTER_IS_TEXT_BUFFER (buffer));
- g_return_if_fail (chars != NULL);
-
- g_object_freeze_notify (G_OBJECT (buffer));
- clutter_text_buffer_delete_text (buffer, 0, -1);
- clutter_text_buffer_insert_text (buffer, 0, chars, n_chars);
- g_object_thaw_notify (G_OBJECT (buffer));
-}
-
-/**
- * clutter_text_buffer_set_max_length:
- * @buffer: a #ClutterTextBuffer
- * @max_length: the maximum length of the entry buffer, or 0 for no maximum.
- * (other than the maximum length of entries.) The value passed in will
- * be clamped to the range [ 0, %CLUTTER_TEXT_BUFFER_MAX_SIZE ].
- *
- * Sets the maximum allowed length of the contents of the buffer. If
- * the current contents are longer than the given length, then they
- * will be truncated to fit.
- *
- * Since: 1.10
- **/
-void
-clutter_text_buffer_set_max_length (ClutterTextBuffer *buffer,
- gint max_length)
-{
- g_return_if_fail (CLUTTER_IS_TEXT_BUFFER (buffer));
-
- max_length = CLAMP (max_length, 0, CLUTTER_TEXT_BUFFER_MAX_SIZE);
-
- if (max_length > 0 && clutter_text_buffer_get_length (buffer) > max_length)
- 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]);
-}
-
-/**
- * clutter_text_buffer_get_max_length:
- * @buffer: a #ClutterTextBuffer
- *
- * Retrieves the maximum allowed length of the text in
- * @buffer. See clutter_text_buffer_set_max_length().
- *
- * Return value: the maximum allowed number of characters
- * in #ClutterTextBuffer, or 0 if there is no maximum.
- *
- * Since: 1.10
- */
-gint
-clutter_text_buffer_get_max_length (ClutterTextBuffer *buffer)
-{
- g_return_val_if_fail (CLUTTER_IS_TEXT_BUFFER (buffer), 0);
- return buffer->priv->max_length;
-}
-
-/**
- * clutter_text_buffer_insert_text:
- * @buffer: a #ClutterTextBuffer
- * @position: the position at which to insert text.
- * @chars: the text to insert into the buffer.
- * @n_chars: the length of the text in characters, or -1
- *
- * Inserts @n_chars characters of @chars into the contents of the
- * buffer, at position @position.
- *
- * If @n_chars is negative, then characters from chars will be inserted
- * until a null-terminator is found. If @position or @n_chars are out of
- * bounds, or the maximum buffer text length is exceeded, then they are
- * coerced to sane values.
- *
- * Note that the position and length are in characters, not in bytes.
- *
- * Returns: The number of characters actually inserted.
- *
- * Since: 1.10
- */
-guint
-clutter_text_buffer_insert_text (ClutterTextBuffer *buffer,
- guint position,
- const gchar *chars,
- gint n_chars)
-{
- ClutterTextBufferClass *klass;
- ClutterTextBufferPrivate *pv;
- guint length;
-
- g_return_val_if_fail (CLUTTER_IS_TEXT_BUFFER (buffer), 0);
-
- length = clutter_text_buffer_get_length (buffer);
- pv = buffer->priv;
-
- if (n_chars < 0)
- n_chars = g_utf8_strlen (chars, -1);
-
- /* Bring position into bounds */
- if (position > length)
- position = length;
-
- /* Make sure not entering too much data */
- if (pv->max_length > 0)
- {
- if (length >= pv->max_length)
- n_chars = 0;
- else if (length + n_chars > pv->max_length)
- n_chars -= (length + n_chars) - pv->max_length;
- }
-
- klass = CLUTTER_TEXT_BUFFER_GET_CLASS (buffer);
- g_return_val_if_fail (klass->insert_text != NULL, 0);
-
- return (klass->insert_text) (buffer, position, chars, n_chars);
-}
-
-/**
- * clutter_text_buffer_delete_text:
- * @buffer: a #ClutterTextBuffer
- * @position: position at which to delete text
- * @n_chars: number of characters to delete
- *
- * Deletes a sequence of characters from the buffer. @n_chars characters are
- * deleted starting at @position. If @n_chars is negative, then all characters
- * until the end of the text are deleted.
- *
- * If @position or @n_chars are out of bounds, then they are coerced to sane
- * values.
- *
- * Note that the positions are specified in characters, not bytes.
- *
- * Returns: The number of characters deleted.
- *
- * Since: 1.10
- */
-guint
-clutter_text_buffer_delete_text (ClutterTextBuffer *buffer,
- guint position,
- gint n_chars)
-{
- ClutterTextBufferClass *klass;
- guint length;
-
- g_return_val_if_fail (CLUTTER_IS_TEXT_BUFFER (buffer), 0);
-
- length = clutter_text_buffer_get_length (buffer);
- if (n_chars < 0)
- n_chars = length;
- if (position > length)
- position = length;
- if (position + n_chars > length)
- n_chars = length - position;
-
- klass = CLUTTER_TEXT_BUFFER_GET_CLASS (buffer);
- g_return_val_if_fail (klass->delete_text != NULL, 0);
-
- return (klass->delete_text) (buffer, position, n_chars);
-}
-
-/**
- * clutter_text_buffer_emit_inserted_text:
- * @buffer: a #ClutterTextBuffer
- * @position: position at which text was inserted
- * @chars: text that was inserted
- * @n_chars: number of characters inserted
- *
- * Emits the #ClutterTextBuffer::inserted-text signal on @buffer.
- *
- * Used when subclassing #ClutterTextBuffer
- *
- * Since: 1.10
- */
-void
-clutter_text_buffer_emit_inserted_text (ClutterTextBuffer *buffer,
- guint position,
- const gchar *chars,
- guint n_chars)
-{
- g_return_if_fail (CLUTTER_IS_TEXT_BUFFER (buffer));
- g_signal_emit (buffer, signals[INSERTED_TEXT], 0, position, chars, n_chars);
-}
-
-/**
- * clutter_text_buffer_emit_deleted_text:
- * @buffer: a #ClutterTextBuffer
- * @position: position at which text was deleted
- * @n_chars: number of characters deleted
- *
- * Emits the #ClutterTextBuffer::deleted-text signal on @buffer.
- *
- * Used when subclassing #ClutterTextBuffer
- *
- * Since: 1.10
- */
-void
-clutter_text_buffer_emit_deleted_text (ClutterTextBuffer *buffer,
- guint position,
- guint n_chars)
-{
- g_return_if_fail (CLUTTER_IS_TEXT_BUFFER (buffer));
- g_signal_emit (buffer, signals[DELETED_TEXT], 0, position, n_chars);
-}
diff --git a/clutter/clutter/clutter-text-buffer.h b/clutter/clutter/clutter-text-buffer.h
deleted file mode 100644
index b65724d72..000000000
--- a/clutter/clutter/clutter-text-buffer.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/* clutter-text-buffer.h
- * Copyright (C) 2011 Collabora Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Stef Walter <stefw@collabora.co.uk>
- */
-
-#ifndef __CLUTTER_TEXT_BUFFER_H__
-#define __CLUTTER_TEXT_BUFFER_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-types.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_TEXT_BUFFER (clutter_text_buffer_get_type ())
-#define CLUTTER_TEXT_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_TEXT_BUFFER, ClutterTextBuffer))
-#define CLUTTER_TEXT_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_TEXT_BUFFER, ClutterTextBufferClass))
-#define CLUTTER_IS_TEXT_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_TEXT_BUFFER))
-#define CLUTTER_IS_TEXT_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_TEXT_BUFFER))
-#define CLUTTER_TEXT_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_TEXT_BUFFER, ClutterTextBufferClass))
-
-/**
- * CLUTTER_TEXT_BUFFER_MAX_SIZE:
- *
- * Maximum size of text buffer, in bytes.
- *
- * Since: 1.10
- */
-#define CLUTTER_TEXT_BUFFER_MAX_SIZE G_MAXUSHORT
-
-typedef struct _ClutterTextBuffer ClutterTextBuffer;
-typedef struct _ClutterTextBufferClass ClutterTextBufferClass;
-typedef struct _ClutterTextBufferPrivate ClutterTextBufferPrivate;
-
-/**
- * ClutterTextBuffer:
- *
- * The #ClutterTextBuffer structure contains private
- * data and it should only be accessed using the provided API.
- *
- * Since: 1.10
- */
-struct _ClutterTextBuffer
-{
- /*< private >*/
- GObject parent_instance;
-
- ClutterTextBufferPrivate *priv;
-};
-
-/**
- * ClutterTextBufferClass:
- * @inserted_text: default handler for the #ClutterTextBuffer::inserted-text signal
- * @deleted_text: default handler for the #ClutterTextBuffer::deleted-text signal
- * @get_text: virtual function
- * @get_length: virtual function
- * @insert_text: virtual function
- * @delete_text: virtual function
- *
- * The #ClutterTextBufferClass structure contains
- * only private data.
- *
- * Since: 1.10
- */
-struct _ClutterTextBufferClass
-{
- /*< private >*/
- GObjectClass parent_class;
-
- /*< public >*/
- /* Signals */
- void (*inserted_text) (ClutterTextBuffer *buffer,
- guint position,
- const gchar *chars,
- guint n_chars);
-
- void (*deleted_text) (ClutterTextBuffer *buffer,
- guint position,
- guint n_chars);
-
- /* Virtual Methods */
- const gchar* (*get_text) (ClutterTextBuffer *buffer,
- gsize *n_bytes);
-
- guint (*get_length) (ClutterTextBuffer *buffer);
-
- guint (*insert_text) (ClutterTextBuffer *buffer,
- guint position,
- const gchar *chars,
- guint n_chars);
-
- guint (*delete_text) (ClutterTextBuffer *buffer,
- guint position,
- guint n_chars);
-
- /*< private >*/
- /* Padding for future expansion */
- void (*_clutter_reserved1) (void);
- void (*_clutter_reserved2) (void);
- void (*_clutter_reserved3) (void);
- void (*_clutter_reserved4) (void);
- void (*_clutter_reserved5) (void);
- void (*_clutter_reserved6) (void);
- void (*_clutter_reserved7) (void);
- void (*_clutter_reserved8) (void);
-};
-
-CLUTTER_EXPORT
-GType clutter_text_buffer_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterTextBuffer* clutter_text_buffer_new (void);
-CLUTTER_EXPORT
-ClutterTextBuffer* clutter_text_buffer_new_with_text (const gchar *text,
- gssize text_len);
-
-CLUTTER_EXPORT
-gsize clutter_text_buffer_get_bytes (ClutterTextBuffer *buffer);
-CLUTTER_EXPORT
-guint clutter_text_buffer_get_length (ClutterTextBuffer *buffer);
-CLUTTER_EXPORT
-const gchar* clutter_text_buffer_get_text (ClutterTextBuffer *buffer);
-CLUTTER_EXPORT
-void clutter_text_buffer_set_text (ClutterTextBuffer *buffer,
- const gchar *chars,
- gint n_chars);
-CLUTTER_EXPORT
-void clutter_text_buffer_set_max_length (ClutterTextBuffer *buffer,
- gint max_length);
-CLUTTER_EXPORT
-gint clutter_text_buffer_get_max_length (ClutterTextBuffer *buffer);
-
-CLUTTER_EXPORT
-guint clutter_text_buffer_insert_text (ClutterTextBuffer *buffer,
- guint position,
- const gchar *chars,
- gint n_chars);
-CLUTTER_EXPORT
-guint clutter_text_buffer_delete_text (ClutterTextBuffer *buffer,
- guint position,
- gint n_chars);
-CLUTTER_EXPORT
-void clutter_text_buffer_emit_inserted_text (ClutterTextBuffer *buffer,
- guint position,
- const gchar *chars,
- guint n_chars);
-CLUTTER_EXPORT
-void clutter_text_buffer_emit_deleted_text (ClutterTextBuffer *buffer,
- guint position,
- guint n_chars);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_TEXT_BUFFER_H__ */
diff --git a/clutter/clutter/clutter-text.c b/clutter/clutter/clutter-text.c
deleted file mode 100644
index 45c7eac56..000000000
--- a/clutter/clutter/clutter-text.c
+++ /dev/null
@@ -1,6857 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2008 Intel Corporation.
- *
- * Authored By: Øyvind Kolås <pippin@o-hand.com>
- * Emmanuele Bassi <ebassi@linux.intel.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * SECTION:clutter-text
- * @short_description: An actor for displaying and editing text
- *
- * #ClutterText is an actor that displays custom text using Pango
- * as the text rendering engine.
- *
- * #ClutterText also allows inline editing of the text if the
- * actor is set editable using clutter_text_set_editable().
- *
- * Selection using keyboard or pointers can be enabled using
- * clutter_text_set_selectable().
- *
- * #ClutterText is available since Clutter 1.0
- */
-
-#include "clutter-build-config.h"
-
-#include <string.h>
-#include <math.h>
-
-#include "clutter-text.h"
-
-#include "clutter-actor-private.h"
-#include "clutter-animatable.h"
-#include "clutter-backend-private.h"
-#include "clutter-binding-pool.h"
-#include "clutter-color.h"
-#include "clutter-debug.h"
-#include "clutter-enum-types.h"
-#include "clutter-keysyms.h"
-#include "clutter-main.h"
-#include "clutter-marshal.h"
-#include "clutter-private.h" /* includes <cogl-pango/cogl-pango.h> */
-#include "clutter-property-transition.h"
-#include "clutter-text-buffer.h"
-#include "clutter-units.h"
-#include "clutter-paint-volume-private.h"
-#include "clutter-scriptable.h"
-#include "clutter-input-focus.h"
-
-/* cursor width in pixels */
-#define DEFAULT_CURSOR_SIZE 2
-
-/* vertical padding for the cursor */
-#define CURSOR_Y_PADDING 2
-
-/* We need at least three cached layouts to run the allocation without
- * regenerating a new layout. First the layout will be generated at
- * full width to get the preferred width, then it will be generated at
- * the preferred width to get the preferred height and then it might
- * be regenerated at a different width to get the height for the
- * actual allocated width
- *
- * since we might get multiple queries from layout managers doing a
- * double-pass allocations, like tabular ones, we should use 6 slots
- */
-#define N_CACHED_LAYOUTS 6
-
-typedef struct _LayoutCache LayoutCache;
-
-struct _LayoutCache
-{
- /* Cached layout. Pango internally caches the computed extents
- * when they are requested so there is no need to cache that as
- * well
- */
- PangoLayout *layout;
-
- /* A number representing the age of this cache (so that when a
- * new layout is needed the last used cache is replaced)
- */
- guint age;
-};
-
-struct _ClutterTextInputFocus
-{
- ClutterInputFocus parent_instance;
- ClutterText *text;
-};
-
-struct _ClutterTextPrivate
-{
- PangoFontDescription *font_desc;
-
- /* the displayed text */
- ClutterTextBuffer *buffer;
-
- gchar *font_name;
-
- gchar *preedit_str;
-
- ClutterColor text_color;
-
- LayoutCache cached_layouts[N_CACHED_LAYOUTS];
- guint cache_age;
-
- /* These are the attributes set by the attributes property */
- PangoAttrList *attrs;
- /* These are the attributes derived from the text when the
- use-markup property is set */
- PangoAttrList *markup_attrs;
- /* This is the combination of the above two lists. It is set to NULL
- whenever either of them changes and then regenerated by merging
- the two lists whenever a layout is needed */
- PangoAttrList *effective_attrs;
- /* These are the attributes for the preedit string. These are merged
- with the effective attributes into a temporary list before
- creating a layout */
- PangoAttrList *preedit_attrs;
-
- /* current cursor position */
- gint position;
-
- /* current 'other end of selection' position */
- gint selection_bound;
-
- /* the x position in the PangoLayout, used to
- * avoid drifting when repeatedly moving up|down
- */
- gint x_pos;
-
- /* the x position of the PangoLayout (in both physical and logical pixels)
- * when in single line mode, to scroll the contents of the
- * text actor
- */
- gint text_x;
- gint text_logical_x;
-
- /* the y position of the PangoLayout (in both physical and logical pixels),
- * fixed to 0 by default for now */
- gint text_y;
- gint text_logical_y;
-
- /* Where to draw the cursor */
- graphene_rect_t cursor_rect;
- ClutterColor cursor_color;
- guint cursor_size;
-
- /* Box representing the paint volume. The box is lazily calculated
- and cached */
- ClutterPaintVolume paint_volume;
-
- guint preedit_cursor_pos;
- gint preedit_n_chars;
-
- ClutterColor selection_color;
-
- ClutterColor selected_text_color;
-
- gunichar password_char;
-
- guint password_hint_id;
- guint password_hint_timeout;
-
- /* Signal handler for when the backend changes its font settings */
- gulong settings_changed_id;
-
- /* Signal handler for when the :text-direction changes */
- gulong direction_changed_id;
-
- ClutterInputFocus *input_focus;
- ClutterInputContentHintFlags input_hints;
- ClutterInputContentPurpose input_purpose;
-
- /* bitfields */
- guint alignment : 2;
- guint wrap : 1;
- guint use_underline : 1;
- guint use_markup : 1;
- guint ellipsize : 3;
- guint single_line_mode : 1;
- guint wrap_mode : 3;
- guint justify : 1;
- guint editable : 1;
- guint cursor_visible : 1;
- guint activatable : 1;
- guint selectable : 1;
- guint selection_color_set : 1;
- guint in_select_drag : 1;
- guint in_select_touch : 1;
- guint cursor_color_set : 1;
- guint preedit_set : 1;
- guint is_default_font : 1;
- guint has_focus : 1;
- guint selected_text_color_set : 1;
- guint paint_volume_valid : 1;
- guint show_password_hint : 1;
- guint password_hint_visible : 1;
- guint resolved_direction : 4;
-};
-
-enum
-{
- PROP_0,
-
- PROP_BUFFER,
- PROP_FONT_NAME,
- PROP_FONT_DESCRIPTION,
- PROP_TEXT,
- PROP_COLOR,
- PROP_USE_MARKUP,
- PROP_ATTRIBUTES,
- PROP_LINE_ALIGNMENT,
- PROP_LINE_WRAP,
- PROP_LINE_WRAP_MODE,
- PROP_JUSTIFY,
- PROP_ELLIPSIZE,
- PROP_POSITION, /* XXX:2.0 - remove */
- PROP_SELECTION_BOUND,
- PROP_SELECTION_COLOR,
- PROP_SELECTION_COLOR_SET,
- PROP_CURSOR_VISIBLE,
- PROP_CURSOR_COLOR,
- PROP_CURSOR_COLOR_SET,
- PROP_CURSOR_SIZE,
- PROP_CURSOR_POSITION,
- PROP_EDITABLE,
- PROP_SELECTABLE,
- PROP_ACTIVATABLE,
- PROP_PASSWORD_CHAR,
- PROP_MAX_LENGTH,
- PROP_SINGLE_LINE_MODE,
- PROP_SELECTED_TEXT_COLOR,
- PROP_SELECTED_TEXT_COLOR_SET,
- PROP_INPUT_HINTS,
- PROP_INPUT_PURPOSE,
-
- PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST];
-
-enum
-{
- TEXT_CHANGED,
- CURSOR_EVENT, /* XXX:2.0 - remove */
- ACTIVATE,
- INSERT_TEXT,
- DELETE_TEXT,
- CURSOR_CHANGED,
-
- LAST_SIGNAL
-};
-
-static guint text_signals[LAST_SIGNAL] = { 0, };
-
-static void clutter_text_settings_changed_cb (ClutterText *text);
-static void buffer_connect_signals (ClutterText *self);
-static void buffer_disconnect_signals (ClutterText *self);
-static ClutterTextBuffer *get_buffer (ClutterText *self);
-
-static const ClutterColor default_cursor_color = { 0, 0, 0, 255 };
-static const ClutterColor default_selection_color = { 0, 0, 0, 255 };
-static const ClutterColor default_text_color = { 0, 0, 0, 255 };
-static const ClutterColor default_selected_text_color = { 0, 0, 0, 255 };
-
-static CoglPipeline *default_color_pipeline = NULL;
-
-static ClutterAnimatableInterface *parent_animatable_iface = NULL;
-static ClutterScriptableIface *parent_scriptable_iface = NULL;
-
-/* ClutterTextInputFocus */
-#define CLUTTER_TYPE_TEXT_INPUT_FOCUS (clutter_text_input_focus_get_type ())
-
-G_DECLARE_FINAL_TYPE (ClutterTextInputFocus, clutter_text_input_focus,
- CLUTTER, TEXT_INPUT_FOCUS, ClutterInputFocus)
-G_DEFINE_TYPE (ClutterTextInputFocus, clutter_text_input_focus,
- CLUTTER_TYPE_INPUT_FOCUS)
-
-/* Utilities pango to (logical) pixels functions */
-static float
-pixels_to_pango (float px)
-{
- return ceilf (px * (float) PANGO_SCALE);
-}
-
-static float
-logical_pixels_to_pango (float px,
- float scale)
-{
- return pixels_to_pango (px * scale);
-}
-
-static float
-pango_to_pixels (float size)
-{
- return ceilf (size / (float) PANGO_SCALE);
-}
-
-static float
-pango_to_logical_pixels (float size,
- float scale)
-{
- return pango_to_pixels (size / scale);
-}
-
-static void
-clutter_text_input_focus_request_surrounding (ClutterInputFocus *focus)
-{
- ClutterText *clutter_text = CLUTTER_TEXT_INPUT_FOCUS (focus)->text;
- ClutterTextBuffer *buffer;
- const gchar *text;
- gint anchor_pos, cursor_pos;
-
- buffer = clutter_text_get_buffer (clutter_text);
- text = clutter_text_buffer_get_text (buffer);
-
- cursor_pos = clutter_text_get_cursor_position (clutter_text);
- if (cursor_pos < 0)
- cursor_pos = clutter_text_buffer_get_length (buffer);
-
- anchor_pos = clutter_text_get_selection_bound (clutter_text);
- if (anchor_pos < 0)
- anchor_pos = cursor_pos;
-
- clutter_input_focus_set_surrounding (focus, text,
- g_utf8_offset_to_pointer (text, cursor_pos) - text,
- g_utf8_offset_to_pointer (text, anchor_pos) - text);
-}
-
-static void
-clutter_text_input_focus_delete_surrounding (ClutterInputFocus *focus,
- int offset,
- guint len)
-{
- ClutterText *clutter_text = CLUTTER_TEXT_INPUT_FOCUS (focus)->text;
- int cursor;
- int start;
-
- cursor = clutter_text_get_cursor_position (clutter_text);
- start = cursor + offset;
- if (start < 0)
- {
- g_warning ("The offset '%d' of deleting surrounding is larger than the cursor pos '%d'",
- offset, cursor);
- return;
- }
- if (clutter_text_get_editable (clutter_text))
- clutter_text_delete_text (clutter_text, start, len);
-}
-
-static void
-clutter_text_input_focus_commit_text (ClutterInputFocus *focus,
- const gchar *text)
-{
- ClutterText *clutter_text = CLUTTER_TEXT_INPUT_FOCUS (focus)->text;
-
- if (clutter_text_get_editable (clutter_text))
- {
- clutter_text_delete_selection (clutter_text);
- clutter_text_insert_text (clutter_text, text,
- clutter_text_get_cursor_position (clutter_text));
- clutter_text_set_preedit_string (clutter_text, NULL, NULL, 0);
- }
-}
-
-static void
-clutter_text_input_focus_set_preedit_text (ClutterInputFocus *focus,
- const gchar *preedit_text,
- guint cursor_pos)
-{
- ClutterText *clutter_text = CLUTTER_TEXT_INPUT_FOCUS (focus)->text;
-
- if (clutter_text_get_editable (clutter_text))
- {
- PangoAttrList *list;
-
- list = pango_attr_list_new ();
- pango_attr_list_insert (list, pango_attr_underline_new (PANGO_UNDERLINE_SINGLE));
- clutter_text_set_preedit_string (clutter_text,
- preedit_text, list,
- cursor_pos);
- pango_attr_list_unref (list);
- }
-}
-
-static void
-clutter_text_input_focus_class_init (ClutterTextInputFocusClass *klass)
-{
- ClutterInputFocusClass *focus_class = CLUTTER_INPUT_FOCUS_CLASS (klass);
-
- focus_class->request_surrounding = clutter_text_input_focus_request_surrounding;
- focus_class->delete_surrounding = clutter_text_input_focus_delete_surrounding;
- focus_class->commit_text = clutter_text_input_focus_commit_text;
- focus_class->set_preedit_text = clutter_text_input_focus_set_preedit_text;
-}
-
-static void
-clutter_text_input_focus_init (ClutterTextInputFocus *focus)
-{
-}
-
-static ClutterInputFocus *
-clutter_text_input_focus_new (ClutterText *text)
-{
- ClutterTextInputFocus *focus;
-
- focus = g_object_new (CLUTTER_TYPE_TEXT_INPUT_FOCUS, NULL);
- focus->text = text;
-
- return CLUTTER_INPUT_FOCUS (focus);
-}
-
-/* ClutterText */
-static void clutter_scriptable_iface_init (ClutterScriptableIface *iface);
-static void clutter_animatable_iface_init (ClutterAnimatableInterface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (ClutterText,
- clutter_text,
- CLUTTER_TYPE_ACTOR,
- G_ADD_PRIVATE (ClutterText)
- G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE,
- clutter_scriptable_iface_init)
- G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_ANIMATABLE,
- clutter_animatable_iface_init));
-
-static inline void
-clutter_text_dirty_paint_volume (ClutterText *text)
-{
- ClutterTextPrivate *priv = text->priv;
-
- if (priv->paint_volume_valid)
- {
- clutter_paint_volume_free (&priv->paint_volume);
- priv->paint_volume_valid = FALSE;
- }
-}
-
-static inline void
-clutter_text_queue_redraw (ClutterActor *self)
-{
- /* This is a wrapper for clutter_actor_queue_redraw that also
- dirties the cached paint volume. It would be nice if we could
- just override the default implementation of the queue redraw
- signal to do this instead but that doesn't work because the
- signal isn't immediately emitted when queue_redraw is called.
- Clutter will however immediately call get_paint_volume when
- queue_redraw is called so we do need to dirty it immediately. */
-
- clutter_text_dirty_paint_volume (CLUTTER_TEXT (self));
-
- clutter_actor_queue_redraw (self);
-}
-
-static gboolean
-clutter_text_should_draw_cursor (ClutterText *self)
-{
- ClutterTextPrivate *priv = self->priv;
-
- return (priv->editable || priv->selectable) &&
- priv->cursor_visible &&
- priv->has_focus;
-}
-
-#define clutter_actor_queue_redraw \
- Please_use_clutter_text_queue_redraw_instead
-
-#define offset_real(t,p) ((p) == -1 ? g_utf8_strlen ((t), -1) : (p))
-
-static gint
-offset_to_bytes (const gchar *text,
- gint pos)
-{
- const gchar *ptr;
-
- if (pos < 0)
- return strlen (text);
-
- /* Loop over each character in the string until we either reach the
- end or the requested position */
- for (ptr = text; *ptr && pos-- > 0; ptr = g_utf8_next_char (ptr));
-
- return ptr - text;
-}
-
-#define bytes_to_offset(t,p) (g_utf8_pointer_to_offset ((t), (t) + (p)))
-
-static inline void
-clutter_text_clear_selection (ClutterText *self)
-{
- ClutterTextPrivate *priv = self->priv;
-
- if (priv->selection_bound != priv->position)
- {
- priv->selection_bound = priv->position;
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SELECTION_BOUND]);
- clutter_text_queue_redraw (CLUTTER_ACTOR (self));
- }
-}
-
-static gboolean
-clutter_text_is_empty (ClutterText *self)
-{
- if (self->priv->buffer == NULL)
- return TRUE;
-
- if (clutter_text_buffer_get_length (self->priv->buffer) == 0)
- return TRUE;
-
- return FALSE;
-}
-
-static gchar *
-clutter_text_get_display_text (ClutterText *self)
-{
- ClutterTextPrivate *priv = self->priv;
- ClutterTextBuffer *buffer;
- const gchar *text;
-
- /* short-circuit the case where the buffer is unset or it's empty,
- * to avoid creating a pointless TextBuffer and emitting
- * notifications with it
- */
- if (clutter_text_is_empty (self))
- return g_strdup ("");
-
- buffer = get_buffer (self);
- text = clutter_text_buffer_get_text (buffer);
-
- /* simple short-circuit to avoid going through GString
- * with an empty text and a password char set
- */
- if (text[0] == '\0')
- return g_strdup ("");
-
- if (G_LIKELY (priv->password_char == 0))
- return g_strdup (text);
- else
- {
- GString *str;
- gunichar invisible_char;
- gchar buf[7];
- gint char_len, i;
- guint n_chars;
-
- n_chars = clutter_text_buffer_get_length (buffer);
- str = g_string_sized_new (clutter_text_buffer_get_bytes (buffer));
- invisible_char = priv->password_char;
-
- /* we need to convert the string built of invisible
- * characters into UTF-8 for it to be fed to the Pango
- * layout
- */
- memset (buf, 0, sizeof (buf));
- char_len = g_unichar_to_utf8 (invisible_char, buf);
-
- if (priv->show_password_hint && priv->password_hint_visible)
- {
- char *last_char;
-
- for (i = 0; i < n_chars - 1; i++)
- g_string_append_len (str, buf, char_len);
-
- last_char = g_utf8_offset_to_pointer (text, n_chars - 1);
- g_string_append (str, last_char);
- }
- else
- {
- for (i = 0; i < n_chars; i++)
- g_string_append_len (str, buf, char_len);
- }
-
- return g_string_free (str, FALSE);
- }
-}
-
-static void
-ensure_effective_pango_scale_attribute (ClutterText *self)
-{
- float resource_scale;
- ClutterTextPrivate *priv = self->priv;
-
- resource_scale = clutter_actor_get_resource_scale (CLUTTER_ACTOR (self));
-
- if (priv->effective_attrs != NULL)
- {
- PangoAttrIterator *iter;
- PangoAttribute *scale_attrib;
- PangoAttrList *old_attributes;
-
- old_attributes = priv->effective_attrs;
- priv->effective_attrs = pango_attr_list_copy (priv->effective_attrs);
- pango_attr_list_unref (old_attributes);
-
- iter = pango_attr_list_get_iterator (priv->effective_attrs);
- scale_attrib = pango_attr_iterator_get (iter, PANGO_ATTR_SCALE);
-
- if (scale_attrib != NULL)
- resource_scale *= ((PangoAttrFloat *) scale_attrib)->value;
-
- pango_attr_iterator_destroy (iter);
- }
- else
- priv->effective_attrs = pango_attr_list_new ();
-
- pango_attr_list_change (priv->effective_attrs,
- pango_attr_scale_new (resource_scale));
-}
-
-static void
-set_effective_pango_attributes (ClutterText *self,
- PangoAttrList *attributes)
-{
- ClutterTextPrivate *priv = self->priv;
-
- if (attributes != NULL)
- {
- PangoAttrList *old_attributes = priv->effective_attrs;
- priv->effective_attrs = pango_attr_list_ref (attributes);
-
- if (old_attributes != NULL)
- pango_attr_list_unref (old_attributes);
- }
- else
- {
- g_clear_pointer (&priv->effective_attrs, pango_attr_list_unref);
- }
-
- ensure_effective_pango_scale_attribute (self);
-}
-
-static inline void
-clutter_text_ensure_effective_attributes (ClutterText *self)
-{
- ClutterTextPrivate *priv = self->priv;
-
- /* If we already have the effective attributes then we don't need to
- do anything */
- if (priv->effective_attrs != NULL)
- return;
-
- /* Same as if we don't have any attribute at all.
- * We also ignore markup attributes for editable. */
- if (priv->attrs == NULL && (priv->editable || priv->markup_attrs == NULL))
- {
- set_effective_pango_attributes (self, NULL);
- return;
- }
-
- if (priv->attrs != NULL)
- {
- /* If there are no markup attributes, or if this is editable (in which
- * case we ignore markup), then we can just use these attrs directly */
- if (priv->editable || priv->markup_attrs == NULL)
- set_effective_pango_attributes (self, priv->attrs);
- else
- {
- /* Otherwise we need to merge the two lists */
- PangoAttrList *effective_attrs;
- PangoAttrIterator *iter;
- GSList *attributes, *l;
-
- effective_attrs = pango_attr_list_copy (priv->markup_attrs);
-
- iter = pango_attr_list_get_iterator (priv->attrs);
- do
- {
- attributes = pango_attr_iterator_get_attrs (iter);
-
- for (l = attributes; l != NULL; l = l->next)
- {
- PangoAttribute *attr = l->data;
-
- pango_attr_list_insert (effective_attrs, attr);
- }
-
- g_slist_free (attributes);
- }
- while (pango_attr_iterator_next (iter));
-
- pango_attr_iterator_destroy (iter);
-
- set_effective_pango_attributes (self, effective_attrs);
- pango_attr_list_unref (effective_attrs);
- }
- }
- else if (priv->markup_attrs != NULL)
- {
- set_effective_pango_attributes (self, priv->markup_attrs);
- }
-}
-
-static PangoLayout *
-clutter_text_create_layout_no_cache (ClutterText *text,
- gint width,
- gint height,
- PangoEllipsizeMode ellipsize)
-{
- ClutterTextPrivate *priv = text->priv;
- PangoLayout *layout;
- gchar *contents;
- gsize contents_len;
-
- layout = clutter_actor_create_pango_layout (CLUTTER_ACTOR (text), NULL);
- pango_layout_set_font_description (layout, priv->font_desc);
-
- contents = clutter_text_get_display_text (text);
- contents_len = strlen (contents);
-
- if (priv->editable && priv->preedit_set)
- {
- GString *tmp = g_string_new (contents);
- PangoAttrList *tmp_attrs = pango_attr_list_new ();
- gint cursor_index;
-
- if (priv->position == 0)
- cursor_index = 0;
- else
- cursor_index = offset_to_bytes (contents, priv->position);
-
- g_string_insert (tmp, cursor_index, priv->preedit_str);
-
- pango_layout_set_text (layout, tmp->str, tmp->len);
-
- if (priv->preedit_attrs != NULL)
- {
- pango_attr_list_splice (tmp_attrs, priv->preedit_attrs,
- cursor_index,
- strlen (priv->preedit_str));
-
- pango_layout_set_attributes (layout, tmp_attrs);
- }
-
- g_string_free (tmp, TRUE);
- pango_attr_list_unref (tmp_attrs);
- }
- else
- {
- PangoDirection pango_dir;
-
- if (priv->password_char != 0)
- pango_dir = PANGO_DIRECTION_NEUTRAL;
- else
- pango_dir = _clutter_pango_find_base_dir (contents, contents_len);
-
- if (pango_dir == PANGO_DIRECTION_NEUTRAL)
- {
- ClutterBackend *backend = clutter_get_default_backend ();
- ClutterTextDirection text_dir;
-
- if (clutter_actor_has_key_focus (CLUTTER_ACTOR (text)))
- {
- ClutterSeat *seat;
- ClutterKeymap *keymap;
-
- seat = clutter_backend_get_default_seat (backend);
- keymap = clutter_seat_get_keymap (seat);
- pango_dir = clutter_keymap_get_direction (keymap);
- }
- else
- {
- text_dir = clutter_actor_get_text_direction (CLUTTER_ACTOR (text));
-
- if (text_dir == CLUTTER_TEXT_DIRECTION_RTL)
- pango_dir = PANGO_DIRECTION_RTL;
- else
- pango_dir = PANGO_DIRECTION_LTR;
- }
- }
-
- pango_context_set_base_dir (clutter_actor_get_pango_context (CLUTTER_ACTOR (text)), pango_dir);
-
- priv->resolved_direction = pango_dir;
-
- pango_layout_set_text (layout, contents, contents_len);
- }
-
- /* This will merge the markup attributes and the attributes
- * property if needed */
- clutter_text_ensure_effective_attributes (text);
-
- if (priv->effective_attrs != NULL)
- pango_layout_set_attributes (layout, priv->effective_attrs);
-
- pango_layout_set_alignment (layout, priv->alignment);
- pango_layout_set_single_paragraph_mode (layout, priv->single_line_mode);
- pango_layout_set_justify (layout, priv->justify);
- pango_layout_set_wrap (layout, priv->wrap_mode);
-
- pango_layout_set_ellipsize (layout, ellipsize);
- pango_layout_set_width (layout, width);
- pango_layout_set_height (layout, height);
-
- g_free (contents);
-
- return layout;
-}
-
-static void
-clutter_text_dirty_cache (ClutterText *text)
-{
- ClutterTextPrivate *priv = text->priv;
- int i;
-
- /* Delete the cached layouts so they will be recreated the next time
- they are needed */
- for (i = 0; i < N_CACHED_LAYOUTS; i++)
- if (priv->cached_layouts[i].layout)
- {
- g_object_unref (priv->cached_layouts[i].layout);
- priv->cached_layouts[i].layout = NULL;
- }
-
- clutter_text_dirty_paint_volume (text);
-}
-
-/*
- * clutter_text_set_font_description_internal:
- * @self: a #ClutterText
- * @desc: a #PangoFontDescription
- *
- * Sets @desc as the font description to be used by the #ClutterText
- * actor. The #PangoFontDescription is copied.
- *
- * This function will also set the :font-name field as a side-effect
- *
- * This function will evict the layout cache, and queue a relayout if
- * the #ClutterText actor has contents.
- */
-static inline void
-clutter_text_set_font_description_internal (ClutterText *self,
- PangoFontDescription *desc,
- gboolean is_default_font)
-{
- ClutterTextPrivate *priv = self->priv;
-
- priv->is_default_font = is_default_font;
-
- if (priv->font_desc == desc ||
- pango_font_description_equal (priv->font_desc, desc))
- return;
-
- if (priv->font_desc != NULL)
- pango_font_description_free (priv->font_desc);
-
- priv->font_desc = pango_font_description_copy (desc);
-
- /* update the font name string we use */
- g_free (priv->font_name);
- priv->font_name = pango_font_description_to_string (priv->font_desc);
-
- clutter_text_dirty_cache (self);
-
- if (clutter_text_buffer_get_length (get_buffer (self)) != 0)
- clutter_actor_queue_relayout (CLUTTER_ACTOR (self));
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_FONT_DESCRIPTION]);
-}
-
-static void
-clutter_text_settings_changed_cb (ClutterText *text)
-{
- ClutterTextPrivate *priv = text->priv;
- guint password_hint_time = 0;
- ClutterSettings *settings;
-
- settings = clutter_settings_get_default ();
-
- g_object_get (settings, "password-hint-time", &password_hint_time, NULL);
-
- priv->show_password_hint = password_hint_time > 0;
- priv->password_hint_timeout = password_hint_time;
-
- if (priv->is_default_font)
- {
- PangoFontDescription *font_desc;
- gchar *font_name = NULL;
-
- g_object_get (settings, "font-name", &font_name, NULL);
-
- CLUTTER_NOTE (ACTOR, "Text[%p]: default font changed to '%s'",
- text,
- font_name);
-
- font_desc = pango_font_description_from_string (font_name);
- clutter_text_set_font_description_internal (text, font_desc, TRUE);
-
- pango_font_description_free (font_desc);
- g_free (font_name);
- }
-
- clutter_text_dirty_cache (text);
- clutter_actor_queue_relayout (CLUTTER_ACTOR (text));
-}
-
-static void
-clutter_text_direction_changed_cb (GObject *gobject,
- GParamSpec *pspec)
-{
- clutter_text_dirty_cache (CLUTTER_TEXT (gobject));
-
- /* no need to queue a relayout: set_text_direction() will do that for us */
-}
-
-/*
- * clutter_text_create_layout:
- * @text: a #ClutterText
- * @allocation_width: the allocation width
- * @allocation_height: the allocation height
- *
- * Like clutter_text_create_layout_no_cache(), but will also ensure
- * the glyphs cache. If a previously cached layout generated using the
- * same width is available then that will be used instead of
- * generating a new one.
- */
-static PangoLayout *
-clutter_text_create_layout (ClutterText *text,
- gfloat allocation_width,
- gfloat allocation_height)
-{
- ClutterTextPrivate *priv = text->priv;
- LayoutCache *oldest_cache = priv->cached_layouts;
- gboolean found_free_cache = FALSE;
- gint width = -1;
- gint height = -1;
- PangoEllipsizeMode ellipsize = PANGO_ELLIPSIZE_NONE;
- int i;
-
- /* First determine the width, height, and ellipsize mode that
- * we need for the layout. The ellipsize mode depends on
- * allocation_width/allocation_size as follows:
- *
- * Cases, assuming ellipsize != NONE on actor:
- *
- * Width request: ellipsization can be set or not on layout,
- * doesn't matter.
- *
- * Height request: ellipsization must never be set on layout
- * if wrap=true, because we need to measure the wrapped
- * height. It must always be set if wrap=false.
- *
- * Allocate: ellipsization must always be set.
- *
- * See http://bugzilla.gnome.org/show_bug.cgi?id=560931
- */
-
- if (priv->ellipsize != PANGO_ELLIPSIZE_NONE)
- {
- if (allocation_height < 0 && priv->wrap)
- ; /* must not set ellipsization on wrap=true height request */
- else
- {
- if (!priv->editable)
- ellipsize = priv->ellipsize;
- }
- }
-
- /* When painting, we always need to set the width, since
- * we might need to align to the right. When getting the
- * height, however, there are some cases where we know that
- * the width won't affect the width.
- *
- * - editable, single-line text actors, since those can
- * scroll the layout.
- * - non-wrapping, non-ellipsizing actors.
- */
- if (allocation_width >= 0 &&
- (allocation_height >= 0 ||
- !((priv->editable && priv->single_line_mode) ||
- (priv->ellipsize == PANGO_ELLIPSIZE_NONE && !priv->wrap))))
- {
- width = pixels_to_pango (allocation_width);
- }
-
- /* Pango only uses height if ellipsization is enabled, so don't set
- * height if ellipsize isn't set. Pango implicitly enables wrapping
- * if height is set, so don't set height if wrapping is disabled.
- * In other words, only set height if we want to both wrap then
- * ellipsize and we're not in single line mode.
- *
- * See http://bugzilla.gnome.org/show_bug.cgi?id=560931 if this
- * seems odd.
- */
- if (allocation_height >= 0 &&
- priv->wrap &&
- priv->ellipsize != PANGO_ELLIPSIZE_NONE &&
- !priv->single_line_mode)
- {
- height = pixels_to_pango (allocation_height);
- }
-
- /* Search for a cached layout with the same width and keep
- * track of the oldest one
- */
- for (i = 0; i < N_CACHED_LAYOUTS; i++)
- {
- if (priv->cached_layouts[i].layout == NULL)
- {
- /* Always prefer free cache spaces */
- found_free_cache = TRUE;
- oldest_cache = priv->cached_layouts + i;
- }
- else
- {
- PangoLayout *cached = priv->cached_layouts[i].layout;
- gint cached_width = pango_layout_get_width (cached);
- gint cached_height = pango_layout_get_height (cached);
- gint cached_ellipsize = pango_layout_get_ellipsize (cached);
-
- if (cached_width == width &&
- cached_height == height &&
- cached_ellipsize == ellipsize)
- {
- /* If this cached layout is using the same size then we can
- * just return that directly
- */
- CLUTTER_NOTE (ACTOR,
- "ClutterText: %p: cache hit for size %.2fx%.2f",
- text,
- allocation_width,
- allocation_height);
-
- return priv->cached_layouts[i].layout;
- }
-
- /* When getting the preferred height for a specific width,
- * we might be able to reuse the layout from getting the
- * preferred width. If the width that the layout gives
- * unconstrained is less than the width that we are using
- * than the height will be unaffected by that width.
- */
- if (allocation_height < 0 &&
- cached_width == -1 &&
- cached_ellipsize == ellipsize)
- {
- PangoRectangle logical_rect;
-
- pango_layout_get_extents (priv->cached_layouts[i].layout,
- NULL,
- &logical_rect);
-
- if (logical_rect.width <= width)
- {
- /* We've been asked for our height for the width we gave as a result
- * of a _get_preferred_width call
- */
- CLUTTER_NOTE (ACTOR,
- "ClutterText: %p: cache hit for size %.2fx%.2f "
- "(unwrapped width narrower than given width)",
- text,
- allocation_width,
- allocation_height);
-
- return priv->cached_layouts[i].layout;
- }
- }
-
- if (!found_free_cache &&
- (priv->cached_layouts[i].age < oldest_cache->age))
- {
- oldest_cache = priv->cached_layouts + i;
- }
- }
- }
-
- CLUTTER_NOTE (ACTOR, "ClutterText: %p: cache miss for size %.2fx%.2f",
- text,
- allocation_width,
- allocation_height);
-
- /* If we make it here then we didn't have a cached version so we
- need to recreate the layout */
- if (oldest_cache->layout)
- g_object_unref (oldest_cache->layout);
-
- oldest_cache->layout =
- clutter_text_create_layout_no_cache (text, width, height, ellipsize);
-
- cogl_pango_ensure_glyph_cache_for_layout (oldest_cache->layout);
-
- /* Mark the 'time' this cache was created and advance the time */
- oldest_cache->age = priv->cache_age++;
- return oldest_cache->layout;
-}
-
-static PangoLayout *
-create_text_layout_with_scale (ClutterText *text,
- gfloat allocation_width,
- gfloat allocation_height,
- gfloat scale)
-{
- if (allocation_width > 0)
- allocation_width = roundf (allocation_width * scale);
-
- if (allocation_height > 0)
- allocation_height = roundf (allocation_height * scale);
-
- return clutter_text_create_layout (text, allocation_width, allocation_height);
-}
-
-static PangoLayout *
-maybe_create_text_layout_with_resource_scale (ClutterText *text,
- gfloat allocation_width,
- gfloat allocation_height)
-{
- float resource_scale;
-
- resource_scale = clutter_actor_get_resource_scale (CLUTTER_ACTOR (text));
-
- return create_text_layout_with_scale (text,
- allocation_width,
- allocation_height,
- resource_scale);
-}
-
-/**
- * clutter_text_coords_to_position:
- * @self: a #ClutterText
- * @x: the X coordinate, relative to the actor
- * @y: the Y coordinate, relative to the actor
- *
- * Retrieves the position of the character at the given coordinates.
- *
- * Return: the position of the character
- *
- * Since: 1.10
- */
-gint
-clutter_text_coords_to_position (ClutterText *self,
- gfloat x,
- gfloat y)
-{
- gint index_;
- gint px, py;
- gint trailing;
- gfloat resource_scale;
-
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), 0);
-
- resource_scale = clutter_actor_get_resource_scale (CLUTTER_ACTOR (self));
-
- /* Take any offset due to scrolling into account, and normalize
- * the coordinates to PangoScale units
- */
- px = logical_pixels_to_pango (x - self->priv->text_logical_x, resource_scale);
- py = logical_pixels_to_pango (y - self->priv->text_logical_y, resource_scale);
-
- pango_layout_xy_to_index (clutter_text_get_layout (self),
- px, py,
- &index_, &trailing);
-
- return index_ + trailing;
-}
-
-static gboolean
-clutter_text_position_to_coords_internal (ClutterText *self,
- gint position,
- gfloat *x,
- gfloat *y,
- gfloat *line_height)
-{
- ClutterTextPrivate *priv;
- PangoRectangle rect;
- gint n_chars;
- gint password_char_bytes = 1;
- gint index_;
- gsize n_bytes;
-
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), FALSE);
-
- priv = self->priv;
-
- n_chars = clutter_text_buffer_get_length (get_buffer (self));
- if (priv->preedit_set)
- n_chars += priv->preedit_n_chars;
-
- if (position < -1 || position > n_chars)
- return FALSE;
-
- if (priv->password_char != 0)
- password_char_bytes = g_unichar_to_utf8 (priv->password_char, NULL);
-
- if (position == -1)
- {
- if (priv->password_char == 0)
- {
- n_bytes = clutter_text_buffer_get_bytes (get_buffer (self));
- if (priv->editable && priv->preedit_set)
- index_ = n_bytes + strlen (priv->preedit_str);
- else
- index_ = n_bytes;
- }
- else
- index_ = n_chars * password_char_bytes;
- }
- else if (position == 0)
- {
- index_ = 0;
- }
- else
- {
- gchar *text = clutter_text_get_display_text (self);
- GString *tmp = g_string_new (text);
- gint cursor_index;
-
- cursor_index = offset_to_bytes (text, priv->position);
-
- if (priv->preedit_str != NULL)
- g_string_insert (tmp, cursor_index, priv->preedit_str);
-
- if (priv->password_char == 0)
- index_ = offset_to_bytes (tmp->str, position);
- else
- index_ = position * password_char_bytes;
-
- g_free (text);
- g_string_free (tmp, TRUE);
- }
-
- pango_layout_get_cursor_pos (clutter_text_get_layout (self),
- index_,
- &rect, NULL);
-
- if (x)
- {
- *x = pango_to_pixels (rect.x);
-
- /* Take any offset due to scrolling into account */
- if (priv->single_line_mode)
- *x += priv->text_x;
- }
-
- if (y)
- *y = pango_to_pixels (rect.y);
-
- if (line_height)
- *line_height = pango_to_pixels (rect.height);
-
- return TRUE;
-}
-
-/**
- * clutter_text_position_to_coords:
- * @self: a #ClutterText
- * @position: position in characters
- * @x: (out): return location for the X coordinate, or %NULL
- * @y: (out): return location for the Y coordinate, or %NULL
- * @line_height: (out): return location for the line height, or %NULL
- *
- * Retrieves the coordinates of the given @position.
- *
- * Return value: %TRUE if the conversion was successful
- *
- * Since: 1.0
- */
-gboolean
-clutter_text_position_to_coords (ClutterText *self,
- gint position,
- gfloat *x,
- gfloat *y,
- gfloat *line_height)
-{
- gfloat resource_scale;
- gboolean ret;
-
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), FALSE);
-
- resource_scale = clutter_actor_get_resource_scale (CLUTTER_ACTOR (self));
-
- ret = clutter_text_position_to_coords_internal (self, position,
- x, y, line_height);
-
- if (x)
- *x /= resource_scale;
-
- if (y)
- *y /= resource_scale;
-
- if (line_height)
- *line_height /= resource_scale;
-
- return ret;
-}
-
-static inline void
-update_cursor_location (ClutterText *self)
-{
- ClutterTextPrivate *priv = self->priv;
- graphene_rect_t rect;
- float x, y;
-
- if (!priv->editable)
- return;
-
- clutter_text_get_cursor_rect (self, &rect);
- clutter_actor_get_transformed_position (CLUTTER_ACTOR (self), &x, &y);
- graphene_rect_offset (&rect, x, y);
- clutter_input_focus_set_cursor_location (priv->input_focus, &rect);
-}
-
-static inline void
-clutter_text_ensure_cursor_position (ClutterText *self,
- float scale)
-{
- ClutterTextPrivate *priv = self->priv;
- gfloat x, y, cursor_height;
- graphene_rect_t cursor_rect = GRAPHENE_RECT_INIT_ZERO;
- gint position;
-
- position = priv->position;
-
- if (priv->editable && priv->preedit_set)
- {
- if (position == -1)
- position = clutter_text_buffer_get_length (get_buffer (self));
-
- position += priv->preedit_cursor_pos;
- }
-
- CLUTTER_NOTE (MISC, "Cursor at %d (preedit %s at pos: %d)",
- position,
- priv->preedit_set ? "set" : "unset",
- priv->preedit_set ? priv->preedit_cursor_pos : 0);
-
- x = y = cursor_height = 0;
- clutter_text_position_to_coords_internal (self, position,
- &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);
-
- if (!graphene_rect_equal (&priv->cursor_rect, &cursor_rect))
- {
- priv->cursor_rect = cursor_rect;
-
- g_signal_emit (self, text_signals[CURSOR_EVENT], 0, &cursor_rect);
- g_signal_emit (self, text_signals[CURSOR_CHANGED], 0);
-
- update_cursor_location (self);
- }
-}
-
-/**
- * clutter_text_delete_selection:
- * @self: a #ClutterText
- *
- * Deletes the currently selected text
- *
- * This function is only useful in subclasses of #ClutterText
- *
- * Return value: %TRUE if text was deleted or if the text actor
- * is empty, and %FALSE otherwise
- *
- * Since: 1.0
- */
-gboolean
-clutter_text_delete_selection (ClutterText *self)
-{
- ClutterTextPrivate *priv;
- gint start_index;
- gint end_index;
- gint old_position, old_selection;
- guint n_chars;
-
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), FALSE);
-
- priv = self->priv;
-
- n_chars = clutter_text_buffer_get_length (get_buffer (self));
- if (n_chars == 0)
- return TRUE;
-
- start_index = priv->position == -1 ? n_chars : priv->position;
- end_index = priv->selection_bound == -1 ? n_chars : priv->selection_bound;
-
- if (end_index == start_index)
- return FALSE;
-
- if (end_index < start_index)
- {
- gint temp = start_index;
- start_index = end_index;
- end_index = temp;
- }
-
- old_position = priv->position;
- old_selection = priv->selection_bound;
-
- clutter_text_delete_text (self, start_index, end_index);
-
- priv->position = start_index;
- priv->selection_bound = start_index;
-
- /* Not required to be guarded by g_object_freeze/thaw_notify */
- if (priv->position != old_position)
- {
- /* XXX:2.0 - remove */
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_POSITION]);
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_CURSOR_POSITION]);
- g_signal_emit (self, text_signals[CURSOR_CHANGED], 0);
- }
-
- if (priv->selection_bound != old_selection)
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SELECTION_BOUND]);
-
- return TRUE;
-}
-
-/*
- * Utility function to update both cursor position and selection bound
- * at once
- */
-static inline void
-clutter_text_set_positions (ClutterText *self,
- gint new_pos,
- gint new_bound)
-{
- g_object_freeze_notify (G_OBJECT (self));
- clutter_text_set_cursor_position (self, new_pos);
- clutter_text_set_selection_bound (self, new_bound);
- g_object_thaw_notify (G_OBJECT (self));
-}
-
-static inline void
-clutter_text_set_markup_internal (ClutterText *self,
- const gchar *str)
-{
- ClutterTextPrivate *priv = self->priv;
- GError *error;
- gchar *text = NULL;
- PangoAttrList *attrs = NULL;
- gboolean res;
-
- g_assert (str != NULL);
-
- error = NULL;
- res = pango_parse_markup (str, -1, 0,
- &attrs,
- &text,
- NULL,
- &error);
-
- if (!res)
- {
- if (G_LIKELY (error != NULL))
- {
- g_warning ("Failed to set the markup of the actor '%s': %s",
- _clutter_actor_get_debug_name (CLUTTER_ACTOR (self)),
- error->message);
- g_error_free (error);
- }
- else
- g_warning ("Failed to set the markup of the actor '%s'",
- _clutter_actor_get_debug_name (CLUTTER_ACTOR (self)));
-
- return;
- }
-
- if (text)
- {
- clutter_text_buffer_set_text (get_buffer (self), text, -1);
- g_free (text);
- }
-
- /* Store the new markup attributes */
- if (priv->markup_attrs != NULL)
- pango_attr_list_unref (priv->markup_attrs);
-
- priv->markup_attrs = attrs;
-
- /* Clear the effective attributes so they will be regenerated when a
- layout is created */
- if (priv->effective_attrs != NULL)
- {
- pango_attr_list_unref (priv->effective_attrs);
- priv->effective_attrs = NULL;
- }
-}
-
-static void
-clutter_text_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterText *self = CLUTTER_TEXT (gobject);
-
- switch (prop_id)
- {
- case PROP_BUFFER:
- clutter_text_set_buffer (self, g_value_get_object (value));
- break;
-
- case PROP_TEXT:
- {
- const char *str = g_value_get_string (value);
- if (self->priv->use_markup)
- clutter_text_set_markup_internal (self, str ? str : "");
- else
- clutter_text_buffer_set_text (get_buffer (self), str ? str : "", -1);
- }
- break;
-
- case PROP_COLOR:
- clutter_text_set_color (self, clutter_value_get_color (value));
- break;
-
- case PROP_FONT_NAME:
- clutter_text_set_font_name (self, g_value_get_string (value));
- break;
-
- case PROP_FONT_DESCRIPTION:
- clutter_text_set_font_description (self, g_value_get_boxed (value));
- break;
-
- case PROP_USE_MARKUP:
- clutter_text_set_use_markup (self, g_value_get_boolean (value));
- break;
-
- case PROP_ATTRIBUTES:
- clutter_text_set_attributes (self, g_value_get_boxed (value));
- break;
-
- case PROP_LINE_ALIGNMENT:
- clutter_text_set_line_alignment (self, g_value_get_enum (value));
- break;
-
- case PROP_LINE_WRAP:
- clutter_text_set_line_wrap (self, g_value_get_boolean (value));
- break;
-
- case PROP_LINE_WRAP_MODE:
- clutter_text_set_line_wrap_mode (self, g_value_get_enum (value));
- break;
-
- case PROP_JUSTIFY:
- clutter_text_set_justify (self, g_value_get_boolean (value));
- break;
-
- case PROP_ELLIPSIZE:
- clutter_text_set_ellipsize (self, g_value_get_enum (value));
- break;
-
- case PROP_POSITION: /* XXX:2.0: remove */
- case PROP_CURSOR_POSITION:
- clutter_text_set_cursor_position (self, g_value_get_int (value));
- break;
-
- case PROP_SELECTION_BOUND:
- clutter_text_set_selection_bound (self, g_value_get_int (value));
- break;
-
- case PROP_SELECTION_COLOR:
- clutter_text_set_selection_color (self, g_value_get_boxed (value));
- break;
-
- case PROP_CURSOR_VISIBLE:
- clutter_text_set_cursor_visible (self, g_value_get_boolean (value));
- break;
-
- case PROP_CURSOR_COLOR:
- clutter_text_set_cursor_color (self, g_value_get_boxed (value));
- break;
-
- case PROP_CURSOR_SIZE:
- clutter_text_set_cursor_size (self, g_value_get_int (value));
- break;
-
- case PROP_EDITABLE:
- clutter_text_set_editable (self, g_value_get_boolean (value));
- break;
-
- case PROP_ACTIVATABLE:
- clutter_text_set_activatable (self, g_value_get_boolean (value));
- break;
-
- case PROP_SELECTABLE:
- clutter_text_set_selectable (self, g_value_get_boolean (value));
- break;
-
- case PROP_PASSWORD_CHAR:
- clutter_text_set_password_char (self, g_value_get_uint (value));
- break;
-
- case PROP_MAX_LENGTH:
- clutter_text_set_max_length (self, g_value_get_int (value));
- break;
-
- case PROP_SINGLE_LINE_MODE:
- clutter_text_set_single_line_mode (self, g_value_get_boolean (value));
- break;
-
- case PROP_SELECTED_TEXT_COLOR:
- clutter_text_set_selected_text_color (self, clutter_value_get_color (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- }
-}
-
-static void
-clutter_text_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterText *self = CLUTTER_TEXT (gobject);
- ClutterTextPrivate *priv = self->priv;
-
- switch (prop_id)
- {
- case PROP_BUFFER:
- g_value_set_object (value, clutter_text_get_buffer (self));
- break;
-
- case PROP_TEXT:
- g_value_set_string (value, clutter_text_buffer_get_text (get_buffer (self)));
- break;
-
- case PROP_FONT_NAME:
- g_value_set_string (value, priv->font_name);
- break;
-
- case PROP_FONT_DESCRIPTION:
- g_value_set_boxed (value, priv->font_desc);
- break;
-
- case PROP_USE_MARKUP:
- g_value_set_boolean (value, priv->use_markup);
- break;
-
- case PROP_COLOR:
- clutter_value_set_color (value, &priv->text_color);
- break;
-
- case PROP_CURSOR_VISIBLE:
- g_value_set_boolean (value, priv->cursor_visible);
- break;
-
- case PROP_CURSOR_COLOR:
- clutter_value_set_color (value, &priv->cursor_color);
- break;
-
- case PROP_CURSOR_COLOR_SET:
- g_value_set_boolean (value, priv->cursor_color_set);
- break;
-
- case PROP_CURSOR_SIZE:
- g_value_set_int (value, priv->cursor_size);
- break;
-
- case PROP_POSITION: /* XXX:2.0 - remove */
- case PROP_CURSOR_POSITION:
- g_value_set_int (value, priv->position);
- break;
-
- case PROP_SELECTION_BOUND:
- g_value_set_int (value, priv->selection_bound);
- break;
-
- case PROP_EDITABLE:
- g_value_set_boolean (value, priv->editable);
- break;
-
- case PROP_SELECTABLE:
- g_value_set_boolean (value, priv->selectable);
- break;
-
- case PROP_SELECTION_COLOR:
- clutter_value_set_color (value, &priv->selection_color);
- break;
-
- case PROP_SELECTION_COLOR_SET:
- g_value_set_boolean (value, priv->selection_color_set);
- break;
-
- case PROP_ACTIVATABLE:
- g_value_set_boolean (value, priv->activatable);
- break;
-
- case PROP_PASSWORD_CHAR:
- g_value_set_uint (value, priv->password_char);
- break;
-
- case PROP_MAX_LENGTH:
- g_value_set_int (value, clutter_text_buffer_get_max_length (get_buffer (self)));
- break;
-
- case PROP_SINGLE_LINE_MODE:
- g_value_set_boolean (value, priv->single_line_mode);
- break;
-
- case PROP_ELLIPSIZE:
- g_value_set_enum (value, priv->ellipsize);
- break;
-
- case PROP_LINE_WRAP:
- g_value_set_boolean (value, priv->wrap);
- break;
-
- case PROP_LINE_WRAP_MODE:
- g_value_set_enum (value, priv->wrap_mode);
- break;
-
- case PROP_LINE_ALIGNMENT:
- g_value_set_enum (value, priv->alignment);
- break;
-
- case PROP_JUSTIFY:
- g_value_set_boolean (value, priv->justify);
- break;
-
- case PROP_ATTRIBUTES:
- g_value_set_boxed (value, priv->attrs);
- break;
-
- case PROP_SELECTED_TEXT_COLOR:
- clutter_value_set_color (value, &priv->selected_text_color);
- break;
-
- case PROP_SELECTED_TEXT_COLOR_SET:
- g_value_set_boolean (value, priv->selected_text_color_set);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- }
-}
-
-static void
-clutter_text_dispose (GObject *gobject)
-{
- ClutterText *self = CLUTTER_TEXT (gobject);
- ClutterTextPrivate *priv = self->priv;
-
- /* get rid of the entire cache */
- clutter_text_dirty_cache (self);
-
- g_clear_signal_handler (&priv->direction_changed_id, self);
- g_clear_signal_handler (&priv->settings_changed_id,
- clutter_get_default_backend ());
-
- g_clear_handle_id (&priv->password_hint_id, g_source_remove);
-
- clutter_text_set_buffer (self, NULL);
-
- G_OBJECT_CLASS (clutter_text_parent_class)->dispose (gobject);
-}
-
-static void
-clutter_text_finalize (GObject *gobject)
-{
- ClutterText *self = CLUTTER_TEXT (gobject);
- ClutterTextPrivate *priv = self->priv;
-
- if (priv->font_desc)
- pango_font_description_free (priv->font_desc);
-
- if (priv->attrs)
- pango_attr_list_unref (priv->attrs);
- if (priv->markup_attrs)
- pango_attr_list_unref (priv->markup_attrs);
- if (priv->effective_attrs)
- pango_attr_list_unref (priv->effective_attrs);
- if (priv->preedit_attrs)
- pango_attr_list_unref (priv->preedit_attrs);
-
- clutter_text_dirty_paint_volume (self);
-
- clutter_text_set_buffer (self, NULL);
- g_free (priv->font_name);
-
- g_clear_object (&priv->input_focus);
-
- G_OBJECT_CLASS (clutter_text_parent_class)->finalize (gobject);
-}
-
-typedef void (* ClutterTextSelectionFunc) (ClutterText *text,
- const ClutterActorBox *box,
- gpointer user_data);
-
-static void
-clutter_text_foreach_selection_rectangle (ClutterText *self,
- float scale,
- ClutterTextSelectionFunc func,
- gpointer user_data)
-{
- ClutterTextPrivate *priv = self->priv;
- PangoLayout *layout = clutter_text_get_layout (self);
- gchar *utf8 = clutter_text_get_display_text (self);
- gint lines;
- gint start_index;
- gint end_index;
- gint line_no;
-
- if (priv->position == 0)
- start_index = 0;
- else
- start_index = offset_to_bytes (utf8, priv->position);
-
- if (priv->selection_bound == 0)
- end_index = 0;
- else
- end_index = offset_to_bytes (utf8, priv->selection_bound);
-
- if (start_index > end_index)
- {
- gint temp = start_index;
- start_index = end_index;
- end_index = temp;
- }
-
- lines = pango_layout_get_line_count (layout);
-
- for (line_no = 0; line_no < lines; line_no++)
- {
- PangoLayoutLine *line;
- gint n_ranges;
- gint *ranges;
- gint i;
- gint index_;
- gint maxindex;
- ClutterActorBox box;
- gfloat y, height;
-
- line = pango_layout_get_line_readonly (layout, line_no);
- pango_layout_line_x_to_index (line, G_MAXINT, &maxindex, NULL);
- if (maxindex < start_index)
- continue;
-
- pango_layout_line_get_x_ranges (line, start_index, end_index,
- &ranges,
- &n_ranges);
- pango_layout_line_x_to_index (line, 0, &index_, NULL);
-
- clutter_text_position_to_coords_internal (self,
- bytes_to_offset (utf8, index_),
- NULL, &y, &height);
-
- box.y1 = y;
- box.y2 = y + height;
-
- for (i = 0; i < n_ranges; i++)
- {
- gfloat range_x;
- gfloat range_width;
-
- range_x = pango_to_pixels (ranges[i * 2]);
-
- /* Account for any scrolling in single line mode */
- if (priv->single_line_mode)
- range_x += priv->text_x;
-
-
- range_width = pango_to_pixels (ranges[i * 2 + 1] - ranges[i * 2]);
- box.x1 = range_x;
- box.x2 = ceilf (range_x + range_width);
-
- clutter_actor_box_scale (&box, scale);
-
- func (self, &box, user_data);
- }
-
- g_free (ranges);
- }
-
- g_free (utf8);
-}
-
-static void
-clutter_text_foreach_selection_rectangle_prescaled (ClutterText *self,
- ClutterTextSelectionFunc func,
- gpointer user_data)
-{
- clutter_text_foreach_selection_rectangle (self, 1.0f, func, user_data);
-}
-
-static void
-paint_selection_rectangle (ClutterText *self,
- const ClutterActorBox *box,
- gpointer user_data)
-{
- CoglFramebuffer *fb = user_data;
- ClutterTextPrivate *priv = self->priv;
- ClutterActor *actor = CLUTTER_ACTOR (self);
- guint8 paint_opacity = clutter_actor_get_paint_opacity (actor);
- CoglPipeline *color_pipeline = cogl_pipeline_copy (default_color_pipeline);
- PangoLayout *layout = clutter_text_get_layout (self);
- CoglColor cogl_color = { 0, };
- const ClutterColor *color;
-
- /* Paint selection background */
- if (priv->selection_color_set)
- color = &priv->selection_color;
- else if (priv->cursor_color_set)
- color = &priv->cursor_color;
- 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);
-
- cogl_framebuffer_push_rectangle_clip (fb,
- box->x1, box->y1,
- box->x2, box->y2);
- cogl_framebuffer_draw_rectangle (fb, color_pipeline,
- box->x1, box->y1,
- box->x2, box->y2);
-
- if (priv->selected_text_color_set)
- color = &priv->selected_text_color;
- else
- color = &priv->text_color;
-
- cogl_color_init_from_4ub (&cogl_color,
- color->red,
- color->green,
- color->blue,
- paint_opacity * color->alpha / 255);
-
- cogl_pango_show_layout (fb, layout, priv->text_x, 0, &cogl_color);
-
- cogl_framebuffer_pop_clip (fb);
- cogl_object_unref (color_pipeline);
-}
-
-/* Draws the selected text, its background, and the cursor */
-static void
-selection_paint (ClutterText *self,
- CoglFramebuffer *fb)
-{
- ClutterTextPrivate *priv = self->priv;
- ClutterActor *actor = CLUTTER_ACTOR (self);
- guint8 paint_opacity = clutter_actor_get_paint_opacity (actor);
- const ClutterColor *color;
-
- if (!clutter_text_should_draw_cursor (self))
- return;
-
- if (priv->position == priv->selection_bound)
- {
- CoglPipeline *color_pipeline = cogl_pipeline_copy (default_color_pipeline);
- CoglColor cogl_color;
-
- /* No selection, just draw the cursor */
- if (priv->cursor_color_set)
- color = &priv->cursor_color;
- 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);
-
- cogl_framebuffer_draw_rectangle (fb,
- color_pipeline,
- priv->cursor_rect.origin.x,
- priv->cursor_rect.origin.y,
- priv->cursor_rect.origin.x + priv->cursor_rect.size.width,
- priv->cursor_rect.origin.y + priv->cursor_rect.size.height);
- }
- else
- {
- clutter_text_foreach_selection_rectangle_prescaled (self,
- paint_selection_rectangle,
- fb);
- }
-}
-
-static gint
-clutter_text_move_word_backward (ClutterText *self,
- gint start)
-{
- gint retval = start;
-
- if (clutter_text_buffer_get_length (get_buffer (self)) > 0 && start > 0)
- {
- PangoLayout *layout = clutter_text_get_layout (self);
- PangoLogAttr *log_attrs = NULL;
- gint n_attrs = 0;
-
- pango_layout_get_log_attrs (layout, &log_attrs, &n_attrs);
-
- retval = start - 1;
- while (retval > 0 && !log_attrs[retval].is_word_start)
- retval -= 1;
-
- g_free (log_attrs);
- }
-
- return retval;
-}
-
-static gint
-clutter_text_move_word_forward (ClutterText *self,
- gint start)
-{
- gint retval = start;
- guint n_chars;
-
- n_chars = clutter_text_buffer_get_length (get_buffer (self));
- if (n_chars > 0 && start < n_chars)
- {
- PangoLayout *layout = clutter_text_get_layout (self);
- PangoLogAttr *log_attrs = NULL;
- gint n_attrs = 0;
-
- pango_layout_get_log_attrs (layout, &log_attrs, &n_attrs);
-
- retval = start + 1;
- while (retval < n_chars && !log_attrs[retval].is_word_end)
- retval += 1;
-
- g_free (log_attrs);
- }
-
- return retval;
-}
-
-static gint
-clutter_text_move_line_start (ClutterText *self,
- gint start)
-{
- PangoLayoutLine *layout_line;
- PangoLayout *layout;
- gint line_no;
- gint index_;
- gint position;
- const gchar *text;
-
- layout = clutter_text_get_layout (self);
- text = clutter_text_buffer_get_text (get_buffer (self));
-
- if (start == 0)
- index_ = 0;
- else
- index_ = offset_to_bytes (text, start);
-
- pango_layout_index_to_line_x (layout, index_,
- 0,
- &line_no, NULL);
-
- layout_line = pango_layout_get_line_readonly (layout, line_no);
- if (!layout_line)
- return FALSE;
-
- pango_layout_line_x_to_index (layout_line, 0, &index_, NULL);
-
- position = bytes_to_offset (text, index_);
-
- return position;
-}
-
-static gint
-clutter_text_move_line_end (ClutterText *self,
- gint start)
-{
- ClutterTextPrivate *priv = self->priv;
- PangoLayoutLine *layout_line;
- PangoLayout *layout;
- gint line_no;
- gint index_;
- gint trailing;
- gint position;
- const gchar *text;
-
- layout = clutter_text_get_layout (self);
- text = clutter_text_buffer_get_text (get_buffer (self));
-
- if (start == 0)
- index_ = 0;
- else
- index_ = offset_to_bytes (text, priv->position);
-
- pango_layout_index_to_line_x (layout, index_,
- 0,
- &line_no, NULL);
-
- layout_line = pango_layout_get_line_readonly (layout, line_no);
- if (!layout_line)
- return FALSE;
-
- pango_layout_line_x_to_index (layout_line, G_MAXINT, &index_, &trailing);
- index_ += trailing;
-
- position = bytes_to_offset (text, index_);
-
- return position;
-}
-
-static void
-clutter_text_select_word (ClutterText *self)
-{
- gint cursor_pos = self->priv->position;
- gint start_pos, end_pos;
-
- start_pos = clutter_text_move_word_backward (self, cursor_pos);
- end_pos = clutter_text_move_word_forward (self, cursor_pos);
-
- clutter_text_set_selection (self, start_pos, end_pos);
-}
-
-static void
-clutter_text_select_line (ClutterText *self)
-{
- ClutterTextPrivate *priv = self->priv;
- gint cursor_pos = priv->position;
- gint start_pos, end_pos;
-
- if (priv->single_line_mode)
- {
- start_pos = 0;
- end_pos = -1;
- }
- else
- {
- start_pos = clutter_text_move_line_start (self, cursor_pos);
- end_pos = clutter_text_move_line_end (self, cursor_pos);
- }
-
- clutter_text_set_selection (self, start_pos, end_pos);
-}
-
-static gboolean
-clutter_text_press (ClutterActor *actor,
- ClutterEvent *event)
-{
- ClutterText *self = CLUTTER_TEXT (actor);
- ClutterTextPrivate *priv = self->priv;
- ClutterEventType type = clutter_event_type (event);
- gboolean res = FALSE;
- gfloat x, y;
- gint index_;
-
- /* if a ClutterText is just used for display purposes, then we
- * should ignore the events we receive
- */
- if (!(priv->editable || priv->selectable))
- return CLUTTER_EVENT_PROPAGATE;
-
- clutter_actor_grab_key_focus (actor);
- clutter_input_focus_set_input_panel_state (priv->input_focus,
- CLUTTER_INPUT_PANEL_STATE_TOGGLE);
-
- /* if the actor is empty we just reset everything and not
- * set up the dragging of the selection since there's nothing
- * to select
- */
- if (clutter_text_buffer_get_length (get_buffer (self)) == 0)
- {
- clutter_text_set_positions (self, -1, -1);
-
- return CLUTTER_EVENT_STOP;
- }
-
- clutter_event_get_coords (event, &x, &y);
-
- res = clutter_actor_transform_stage_point (actor, x, y, &x, &y);
- if (res)
- {
- const char *text;
- int offset;
-
- index_ = clutter_text_coords_to_position (self, x, y);
- text = clutter_text_buffer_get_text (get_buffer (self));
- offset = bytes_to_offset (text, index_);
-
- /* what we select depends on the number of button clicks we
- * receive, and whether we are selectable:
- *
- * 1: just position the cursor and the selection
- * 2: select the current word
- * 3: select the contents of the whole actor
- */
- if (type == CLUTTER_BUTTON_PRESS)
- {
- gint click_count = clutter_event_get_click_count (event);
-
- if (click_count == 1)
- {
- clutter_text_set_positions (self, offset, offset);
- }
- else if (priv->selectable && click_count == 2)
- {
- clutter_text_select_word (self);
- }
- else if (priv->selectable && click_count == 3)
- {
- clutter_text_select_line (self);
- }
- }
- else
- {
- /* touch events do not have click count */
- clutter_text_set_positions (self, offset, offset);
- }
- }
-
- /* we don't need to go any further if we're not selectable */
- if (!priv->selectable)
- return CLUTTER_EVENT_STOP;
-
- /* grab the pointer */
- priv->in_select_drag = TRUE;
-
- if (type == CLUTTER_BUTTON_PRESS)
- {
- clutter_input_device_grab (clutter_event_get_device (event),
- actor);
- }
- else
- {
- clutter_input_device_sequence_grab (clutter_event_get_device (event),
- clutter_event_get_event_sequence (event),
- actor);
- priv->in_select_touch = TRUE;
- }
-
- return CLUTTER_EVENT_STOP;
-}
-
-static gboolean
-clutter_text_move (ClutterActor *actor,
- ClutterEvent *event)
-{
- ClutterText *self = CLUTTER_TEXT (actor);
- ClutterTextPrivate *priv = self->priv;
- gfloat x, y;
- gint index_, offset;
- gboolean res;
- const gchar *text;
-
- if (!priv->in_select_drag)
- return CLUTTER_EVENT_PROPAGATE;
-
- clutter_event_get_coords (event, &x, &y);
-
- res = clutter_actor_transform_stage_point (actor, x, y, &x, &y);
- if (!res)
- return CLUTTER_EVENT_PROPAGATE;
-
- index_ = clutter_text_coords_to_position (self, x, y);
- text = clutter_text_buffer_get_text (get_buffer (self));
- offset = bytes_to_offset (text, index_);
-
- if (priv->selectable)
- clutter_text_set_cursor_position (self, offset);
- else
- clutter_text_set_positions (self, offset, offset);
-
- return CLUTTER_EVENT_STOP;
-}
-
-static gboolean
-clutter_text_release (ClutterActor *actor,
- ClutterEvent *event)
-{
- ClutterText *self = CLUTTER_TEXT (actor);
- ClutterTextPrivate *priv = self->priv;
- ClutterEventType type = clutter_event_type (event);
-
- if (priv->in_select_drag)
- {
- if (type == CLUTTER_BUTTON_RELEASE)
- {
- if (!priv->in_select_touch)
- {
- clutter_input_device_ungrab (clutter_event_get_device (event));
- priv->in_select_drag = FALSE;
-
- return CLUTTER_EVENT_STOP;
- }
- }
- else
- {
- if (priv->in_select_touch)
- {
- ClutterInputDevice *device = clutter_event_get_device (event);
- ClutterEventSequence *sequence =
- clutter_event_get_event_sequence (event);
-
- clutter_input_device_sequence_ungrab (device, sequence);
- priv->in_select_touch = FALSE;
- priv->in_select_drag = FALSE;
-
- return CLUTTER_EVENT_STOP;
- }
- }
- }
-
- return CLUTTER_EVENT_PROPAGATE;
-}
-
-static gboolean
-clutter_text_button_press (ClutterActor *actor,
- ClutterButtonEvent *event)
-{
- return clutter_text_press (actor, (ClutterEvent *) event);
-}
-
-static gboolean
-clutter_text_motion (ClutterActor *actor,
- ClutterMotionEvent *event)
-{
- return clutter_text_move (actor, (ClutterEvent *) event);
-}
-
-static gboolean
-clutter_text_button_release (ClutterActor *actor,
- ClutterButtonEvent *event)
-{
- return clutter_text_release (actor, (ClutterEvent *) event);
-}
-
-static gboolean
-clutter_text_touch_event (ClutterActor *actor,
- ClutterTouchEvent *event)
-{
- switch (event->type)
- {
- case CLUTTER_TOUCH_BEGIN:
- return clutter_text_press (actor, (ClutterEvent *) event);
-
- case CLUTTER_TOUCH_END:
- case CLUTTER_TOUCH_CANCEL:
- /* TODO: the cancel case probably need a special handler */
- return clutter_text_release (actor, (ClutterEvent *) event);
-
- case CLUTTER_TOUCH_UPDATE:
- return clutter_text_move (actor, (ClutterEvent *) event);
-
- default:
- break;
- }
-
- return CLUTTER_EVENT_PROPAGATE;
-}
-
-static gboolean
-clutter_text_remove_password_hint (gpointer data)
-{
- ClutterText *self = data;
-
- self->priv->password_hint_visible = FALSE;
- self->priv->password_hint_id = 0;
-
- clutter_text_dirty_cache (data);
- clutter_text_queue_redraw (data);
-
- return G_SOURCE_REMOVE;
-}
-
-static gboolean
-clutter_text_key_press (ClutterActor *actor,
- ClutterKeyEvent *event)
-{
- ClutterText *self = CLUTTER_TEXT (actor);
- ClutterTextPrivate *priv = self->priv;
- ClutterBindingPool *pool;
- gboolean res;
-
- if (!priv->editable)
- return CLUTTER_EVENT_PROPAGATE;
-
- /* we need to use the ClutterText type name to find our own
- * key bindings; subclasses will override or chain up this
- * event handler, so they can do whatever they want there
- */
- pool = clutter_binding_pool_find (g_type_name (CLUTTER_TYPE_TEXT));
- g_assert (pool != NULL);
-
- if (!(event->flags & CLUTTER_EVENT_FLAG_INPUT_METHOD) &&
- clutter_input_focus_is_focused (priv->input_focus) &&
- clutter_input_focus_filter_event (priv->input_focus,
- (ClutterEvent *) event))
- return CLUTTER_EVENT_STOP;
-
- /* we allow passing synthetic events that only contain
- * the Unicode value and not the key symbol, unless they
- * contain the input method flag.
- */
- if (event->keyval == 0 && (event->flags & CLUTTER_EVENT_FLAG_SYNTHETIC) &&
- !(event->flags & CLUTTER_EVENT_FLAG_INPUT_METHOD))
- res = FALSE;
- else
- res = clutter_binding_pool_activate (pool, event->keyval,
- event->modifier_state,
- G_OBJECT (actor));
-
- /* if the key binding has handled the event we bail out
- * as fast as we can; otherwise, we try to insert the
- * Unicode character inside the key event into the text
- * actor
- */
- if (res)
- return CLUTTER_EVENT_STOP;
- else if ((event->modifier_state & CLUTTER_CONTROL_MASK) == 0)
- {
- gunichar key_unichar;
-
- /* Skip keys when control is pressed */
- key_unichar = clutter_event_get_key_unicode ((ClutterEvent *) event);
-
- /* return is reported as CR, but we want LF */
- if (key_unichar == '\r')
- key_unichar = '\n';
-
- if ((key_unichar == '\n' && !priv->single_line_mode) ||
- (g_unichar_validate (key_unichar) &&
- !g_unichar_iscntrl (key_unichar)))
- {
- /* truncate the eventual selection so that the
- * Unicode character can replace it
- */
- clutter_text_delete_selection (self);
- clutter_text_insert_unichar (self, key_unichar);
-
- if (priv->show_password_hint)
- {
- g_clear_handle_id (&priv->password_hint_id, g_source_remove);
-
- priv->password_hint_visible = TRUE;
- priv->password_hint_id =
- clutter_threads_add_timeout (priv->password_hint_timeout,
- clutter_text_remove_password_hint,
- self);
- }
-
- return CLUTTER_EVENT_STOP;
- }
- }
-
- return CLUTTER_EVENT_PROPAGATE;
-}
-
-static gboolean
-clutter_text_key_release (ClutterActor *actor,
- ClutterKeyEvent *event)
-{
- ClutterText *self = CLUTTER_TEXT (actor);
- ClutterTextPrivate *priv = self->priv;
-
- if (clutter_input_focus_is_focused (priv->input_focus) &&
- clutter_input_focus_filter_event (priv->input_focus,
- (ClutterEvent *) event))
- return CLUTTER_EVENT_STOP;
-
- return CLUTTER_EVENT_PROPAGATE;
-}
-
-static void
-clutter_text_compute_layout_offsets (ClutterText *self,
- PangoLayout *layout,
- const ClutterActorBox *alloc,
- int *text_x,
- int *text_y)
-{
- ClutterActor *actor = CLUTTER_ACTOR (self);
- ClutterActorAlign x_align, y_align;
- PangoRectangle logical_rect;
- float alloc_width, alloc_height;
- float x, y;
-
- clutter_actor_box_get_size (alloc, &alloc_width, &alloc_height);
- pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
-
- if (clutter_actor_needs_expand (actor, CLUTTER_ORIENTATION_HORIZONTAL))
- x_align = _clutter_actor_get_effective_x_align (actor);
- else
- x_align = CLUTTER_ACTOR_ALIGN_FILL;
-
- if (clutter_actor_needs_expand (actor, CLUTTER_ORIENTATION_VERTICAL))
- y_align = clutter_actor_get_y_align (actor);
- else
- y_align = CLUTTER_ACTOR_ALIGN_FILL;
-
- x = 0.f;
- switch (x_align)
- {
- case CLUTTER_ACTOR_ALIGN_FILL:
- case CLUTTER_ACTOR_ALIGN_START:
- break;
-
- case CLUTTER_ACTOR_ALIGN_END:
- if (alloc_width > logical_rect.width)
- x = alloc_width - logical_rect.width;
- break;
-
- case CLUTTER_ACTOR_ALIGN_CENTER:
- if (alloc_width > logical_rect.width)
- x = (alloc_width - logical_rect.width) / 2.f;
- break;
- }
-
- y = 0.f;
- switch (y_align)
- {
- case CLUTTER_ACTOR_ALIGN_FILL:
- case CLUTTER_ACTOR_ALIGN_START:
- break;
-
- case CLUTTER_ACTOR_ALIGN_END:
- if (alloc_height > logical_rect.height)
- y = alloc_height - logical_rect.height;
- break;
-
- case CLUTTER_ACTOR_ALIGN_CENTER:
- if (alloc_height > logical_rect.height)
- y = (alloc_height - logical_rect.height) / 2.f;
- break;
- }
-
- if (text_x != NULL)
- *text_x = floorf (x);
-
- if (text_y != NULL)
- *text_y = floorf (y);
-}
-
-#define TEXT_PADDING 2
-
-static void
-clutter_text_paint (ClutterActor *self,
- ClutterPaintContext *paint_context)
-{
- ClutterText *text = CLUTTER_TEXT (self);
- ClutterTextPrivate *priv = text->priv;
- CoglFramebuffer *fb;
- PangoLayout *layout;
- ClutterActorBox alloc = { 0, };
- CoglColor color = { 0, };
- guint8 real_opacity;
- gint text_x = priv->text_x;
- gint text_y = priv->text_y;
- gboolean clip_set = FALSE;
- gboolean bg_color_set = FALSE;
- guint n_chars;
- float alloc_width;
- float alloc_height;
- float resource_scale;
-
- fb = clutter_paint_context_get_framebuffer (paint_context);
-
- /* Note that if anything in this paint method changes it needs to be
- reflected in the get_paint_volume implementation which is tightly
- tied to the workings of this function */
- n_chars = clutter_text_buffer_get_length (get_buffer (text));
-
- clutter_actor_get_allocation_box (self, &alloc);
-
- if (G_UNLIKELY (default_color_pipeline == NULL))
- {
- CoglContext *ctx =
- clutter_backend_get_cogl_context (clutter_get_default_backend ());
- default_color_pipeline = cogl_pipeline_new (ctx);
- }
-
- g_assert (default_color_pipeline != NULL);
-
- g_object_get (self, "background-color-set", &bg_color_set, NULL);
- if (bg_color_set)
- {
- CoglPipeline *color_pipeline = cogl_pipeline_copy (default_color_pipeline);
- ClutterColor bg_color;
-
- clutter_actor_get_background_color (self, &bg_color);
- bg_color.alpha = clutter_actor_get_paint_opacity (self)
- * bg_color.alpha
- / 255;
-
- cogl_color_init_from_4ub (&color,
- bg_color.red,
- bg_color.green,
- bg_color.blue,
- bg_color.alpha);
- cogl_color_premultiply (&color);
- cogl_pipeline_set_color (color_pipeline, &color);
-
- cogl_framebuffer_draw_rectangle (fb,
- color_pipeline,
- 0, 0,
- clutter_actor_box_get_width (&alloc),
- clutter_actor_box_get_height (&alloc));
-
- cogl_object_unref (color_pipeline);
- }
-
- /* don't bother painting an empty text actor, unless it's
- * editable, in which case we want to paint at least the
- * cursor
- */
- if (n_chars == 0 &&
- !clutter_text_should_draw_cursor (text))
- return;
-
- resource_scale = clutter_actor_get_resource_scale (CLUTTER_ACTOR (self));
-
- clutter_actor_box_scale (&alloc, resource_scale);
- clutter_actor_box_get_size (&alloc, &alloc_width, &alloc_height);
-
- if (priv->editable && priv->single_line_mode)
- layout = clutter_text_create_layout (text, -1, -1);
- else
- {
- /* the only time when we create the PangoLayout using the full
- * width and height of the allocation is when we can both wrap
- * and ellipsize
- */
- if (priv->wrap && priv->ellipsize)
- {
- layout = clutter_text_create_layout (text, alloc_width, alloc_height);
- }
- else
- {
- /* if we're not wrapping we cannot set the height of the
- * layout, otherwise Pango will happily wrap the text to
- * fit in the rectangle - thus making the :wrap property
- * useless
- *
- * see bug:
- *
- * http://bugzilla.clutter-project.org/show_bug.cgi?id=2339
- *
- * in order to fix this, we create a layout that would fit
- * in the assigned width, then we clip the actor if the
- * logical rectangle overflows the allocation.
- */
- layout = clutter_text_create_layout (text, alloc_width, -1);
- }
- }
-
- if (resource_scale != 1.0f)
- {
- float paint_scale = 1.0f / resource_scale;
- cogl_framebuffer_push_matrix (fb);
- cogl_framebuffer_scale (fb, paint_scale, paint_scale, 1.0f);
- }
-
- if (clutter_text_should_draw_cursor (text))
- clutter_text_ensure_cursor_position (text, resource_scale);
-
- if (priv->editable && priv->single_line_mode)
- {
- PangoRectangle logical_rect = { 0, };
- gint actor_width, text_width;
- gboolean rtl;
-
- pango_layout_get_extents (layout, NULL, &logical_rect);
-
- cogl_framebuffer_push_rectangle_clip (fb, 0, 0, alloc_width, alloc_height);
- clip_set = TRUE;
-
- actor_width = alloc_width - 2 * TEXT_PADDING;
- text_width = pango_to_pixels (logical_rect.width);
-
- rtl = priv->resolved_direction == PANGO_DIRECTION_RTL;
-
- if (actor_width < text_width)
- {
- gint cursor_x = graphene_rect_get_x (&priv->cursor_rect);
-
- if (priv->position == -1)
- {
- text_x = rtl ? TEXT_PADDING : actor_width - text_width;
- }
- else if (priv->position == 0)
- {
- text_x = rtl ? actor_width - text_width : TEXT_PADDING;
- }
- else
- {
- if (cursor_x < 0)
- {
- text_x = text_x - cursor_x - TEXT_PADDING;
- }
- else if (cursor_x > actor_width)
- {
- text_x = text_x + (actor_width - cursor_x) - TEXT_PADDING;
- }
- }
- }
- else
- {
- text_x = rtl ? actor_width - text_width : TEXT_PADDING;
- }
- }
- else if (!priv->editable && !(priv->wrap && priv->ellipsize))
- {
- PangoRectangle logical_rect = { 0, };
-
- pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
-
- /* don't clip if the layout managed to fit inside our allocation */
- if (logical_rect.width > alloc_width ||
- logical_rect.height > alloc_height)
- {
- cogl_framebuffer_push_rectangle_clip (fb, 0, 0, alloc_width, alloc_height);
- clip_set = TRUE;
- }
-
- clutter_text_compute_layout_offsets (text, layout, &alloc, &text_x, &text_y);
- }
- else
- clutter_text_compute_layout_offsets (text, layout, &alloc, &text_x, &text_y);
-
- if (priv->text_x != text_x ||
- priv->text_y != text_y)
- {
- priv->text_x = text_x;
- priv->text_y = text_y;
- priv->text_logical_x = roundf ((float) text_x / resource_scale);
- priv->text_logical_y = roundf ((float) text_y / resource_scale);
-
- clutter_text_ensure_cursor_position (text, resource_scale);
- }
-
- real_opacity = clutter_actor_get_paint_opacity (self)
- * priv->text_color.alpha
- / 255;
-
- CLUTTER_NOTE (PAINT, "painting text (text: '%s')",
- clutter_text_buffer_get_text (get_buffer (text)));
-
- cogl_color_init_from_4ub (&color,
- priv->text_color.red,
- priv->text_color.green,
- priv->text_color.blue,
- real_opacity);
- cogl_pango_show_layout (fb, layout, priv->text_x, priv->text_y, &color);
-
- selection_paint (text, fb);
-
- if (resource_scale != 1.0f)
- cogl_framebuffer_pop_matrix (fb);
-
- if (clip_set)
- cogl_framebuffer_pop_clip (fb);
-}
-
-static void
-add_selection_to_paint_volume (ClutterText *text,
- const ClutterActorBox *box,
- gpointer user_data)
-{
- ClutterPaintVolume *total_volume = user_data;
- ClutterPaintVolume rect_volume;
- graphene_point3d_t vertex;
-
- _clutter_paint_volume_init_static (&rect_volume, CLUTTER_ACTOR (text));
-
- vertex.x = box->x1;
- vertex.y = box->y1;
- vertex.z = 0.0f;
- clutter_paint_volume_set_origin (&rect_volume, &vertex);
- clutter_paint_volume_set_width (&rect_volume, box->x2 - box->x1);
- clutter_paint_volume_set_height (&rect_volume, box->y2 - box->y1);
-
- clutter_paint_volume_union (total_volume, &rect_volume);
-
- clutter_paint_volume_free (&rect_volume);
-}
-
-static void
-clutter_text_get_paint_volume_for_cursor (ClutterText *text,
- float resource_scale,
- ClutterPaintVolume *volume)
-{
- ClutterTextPrivate *priv = text->priv;
- graphene_point3d_t origin;
-
- clutter_text_ensure_cursor_position (text, resource_scale);
-
- if (priv->position == priv->selection_bound)
- {
- float width, height;
-
- width = priv->cursor_rect.size.width / resource_scale;
- height = priv->cursor_rect.size.height / resource_scale;
- origin.x = priv->cursor_rect.origin.x / resource_scale;
- origin.y = priv->cursor_rect.origin.y / resource_scale;
- origin.z = 0;
-
- clutter_paint_volume_set_origin (volume, &origin);
- clutter_paint_volume_set_width (volume, width);
- clutter_paint_volume_set_height (volume, height);
- }
- else
- {
- clutter_text_foreach_selection_rectangle (text,
- 1.0f / resource_scale,
- add_selection_to_paint_volume,
- volume);
- }
-}
-
-static gboolean
-clutter_text_get_paint_volume (ClutterActor *self,
- ClutterPaintVolume *volume)
-{
- ClutterText *text = CLUTTER_TEXT (self);
- ClutterTextPrivate *priv = text->priv;
-
- /* ClutterText uses the logical layout as the natural size of the
- actor. This means that it can sometimes paint outside of its
- allocation for example with italic fonts with serifs. Therefore
- we should use the ink rectangle of the layout instead */
-
- if (!priv->paint_volume_valid)
- {
- PangoLayout *layout;
- PangoRectangle ink_rect;
- graphene_point3d_t origin;
- float resource_scale;
-
- /* If the text is single line editable then it gets clipped to
- the allocation anyway so we can just use that */
- if (priv->editable && priv->single_line_mode)
- return _clutter_actor_set_default_paint_volume (self,
- CLUTTER_TYPE_TEXT,
- volume);
-
- if (G_OBJECT_TYPE (self) != CLUTTER_TYPE_TEXT)
- return FALSE;
-
- if (!clutter_actor_has_allocation (self))
- return FALSE;
-
- resource_scale = clutter_actor_get_resource_scale (self);
-
- _clutter_paint_volume_init_static (&priv->paint_volume, self);
-
- layout = clutter_text_get_layout (text);
- pango_layout_get_extents (layout, &ink_rect, NULL);
-
- origin.x = pango_to_logical_pixels (ink_rect.x, resource_scale);
- origin.y = pango_to_logical_pixels (ink_rect.y, resource_scale);
- origin.z = 0;
- clutter_paint_volume_set_origin (&priv->paint_volume, &origin);
- clutter_paint_volume_set_width (&priv->paint_volume,
- pango_to_logical_pixels (ink_rect.width,
- resource_scale));
- clutter_paint_volume_set_height (&priv->paint_volume,
- pango_to_logical_pixels (ink_rect.height,
- resource_scale));
-
- /* If the cursor is visible then that will likely be drawn
- outside of the ink rectangle so we should merge that in */
- if (clutter_text_should_draw_cursor (text))
- {
- ClutterPaintVolume cursor_paint_volume;
-
- _clutter_paint_volume_init_static (&cursor_paint_volume, self);
-
- clutter_text_get_paint_volume_for_cursor (text, resource_scale,
- &cursor_paint_volume);
-
- clutter_paint_volume_union (&priv->paint_volume,
- &cursor_paint_volume);
-
- clutter_paint_volume_free (&cursor_paint_volume);
- }
-
- priv->paint_volume_valid = TRUE;
- }
-
- _clutter_paint_volume_copy_static (&priv->paint_volume, volume);
-
- return TRUE;
-}
-
-static void
-clutter_text_get_preferred_width (ClutterActor *self,
- gfloat for_height,
- gfloat *min_width_p,
- gfloat *natural_width_p)
-{
- ClutterText *text = CLUTTER_TEXT (self);
- ClutterTextPrivate *priv = text->priv;
- PangoRectangle logical_rect = { 0, };
- PangoLayout *layout;
- gint logical_width;
- gfloat layout_width;
- gfloat resource_scale;
-
- resource_scale = clutter_actor_get_resource_scale (self);
-
- layout = clutter_text_create_layout (text, -1, -1);
- pango_layout_get_extents (layout, NULL, &logical_rect);
-
- /* the X coordinate of the logical rectangle might be non-zero
- * according to the Pango documentation; hence, we need to offset
- * the width accordingly
- */
- logical_width = logical_rect.x + logical_rect.width;
-
- layout_width = logical_width > 0
- ? pango_to_logical_pixels (logical_width, resource_scale)
- : 1;
-
- if (min_width_p)
- {
- if (priv->wrap || priv->ellipsize || priv->editable)
- *min_width_p = 1;
- else
- *min_width_p = layout_width;
- }
-
- if (natural_width_p)
- {
- if (priv->editable && priv->single_line_mode)
- *natural_width_p = layout_width + TEXT_PADDING * 2;
- else
- *natural_width_p = layout_width;
- }
-}
-
-static void
-clutter_text_get_preferred_height (ClutterActor *self,
- gfloat for_width,
- gfloat *min_height_p,
- gfloat *natural_height_p)
-{
- ClutterTextPrivate *priv = CLUTTER_TEXT (self)->priv;
-
- if (for_width == 0)
- {
- if (min_height_p)
- *min_height_p = 0;
-
- if (natural_height_p)
- *natural_height_p = 0;
- }
- else
- {
- PangoLayout *layout;
- PangoRectangle logical_rect = { 0, };
- gint logical_height;
- gfloat layout_height;
- gfloat resource_scale;
-
- resource_scale = clutter_actor_get_resource_scale (self);
-
- if (priv->single_line_mode)
- for_width = -1;
-
- layout = create_text_layout_with_scale (CLUTTER_TEXT (self),
- for_width, -1, resource_scale);
-
- pango_layout_get_extents (layout, NULL, &logical_rect);
-
- /* the Y coordinate of the logical rectangle might be non-zero
- * according to the Pango documentation; hence, we need to offset
- * the height accordingly
- */
- logical_height = logical_rect.y + logical_rect.height;
- layout_height = pango_to_logical_pixels (logical_height, resource_scale);
-
- if (min_height_p)
- {
- /* if we wrap and ellipsize then the minimum height is
- * going to be at least the size of the first line
- */
- if ((priv->ellipsize && priv->wrap) && !priv->single_line_mode)
- {
- PangoLayoutLine *line;
- gfloat line_height;
-
- line = pango_layout_get_line_readonly (layout, 0);
- pango_layout_line_get_extents (line, NULL, &logical_rect);
-
- logical_height = logical_rect.y + logical_rect.height;
- line_height = pango_to_logical_pixels (logical_height,
- resource_scale);
-
- *min_height_p = line_height;
- }
- else
- *min_height_p = layout_height;
- }
-
- if (natural_height_p)
- *natural_height_p = layout_height;
- }
-}
-
-static void
-clutter_text_allocate (ClutterActor *self,
- const ClutterActorBox *box)
-{
- ClutterText *text = CLUTTER_TEXT (self);
- ClutterActorClass *parent_class;
-
- /* Ensure that there is a cached layout with the right width so
- * that we don't need to create the text during the paint run
- *
- * if the Text is editable and in single line mode we don't want
- * to have any limit on the layout size, since the paint will clip
- * it to the allocation of the actor
- */
- if (text->priv->editable && text->priv->single_line_mode)
- clutter_text_create_layout (text, -1, -1);
- else
- maybe_create_text_layout_with_resource_scale (text,
- box->x2 - box->x1,
- box->y2 - box->y1);
-
- parent_class = CLUTTER_ACTOR_CLASS (clutter_text_parent_class);
- parent_class->allocate (self, box);
-}
-
-static gboolean
-clutter_text_has_overlaps (ClutterActor *self)
-{
- return clutter_text_should_draw_cursor ((ClutterText *) self);
-}
-
-static float
-clutter_text_calculate_resource_scale (ClutterActor *actor,
- int phase)
-{
- ClutterActorClass *parent_class = CLUTTER_ACTOR_CLASS (clutter_text_parent_class);
- float new_resource_scale;
-
- new_resource_scale = parent_class->calculate_resource_scale (actor, phase);
-
- if (phase == 1)
- return MAX (new_resource_scale, clutter_actor_get_real_resource_scale (actor));
-
- return new_resource_scale;
-}
-
-static void
-clutter_text_resource_scale_changed (ClutterActor *actor)
-{
- ClutterText *text = CLUTTER_TEXT (actor);
- ClutterTextPrivate *priv = text->priv;
-
- g_clear_pointer (&priv->effective_attrs, pango_attr_list_unref);
- clutter_text_dirty_cache (text);
-
- clutter_actor_queue_immediate_relayout (actor);
-}
-
-static gboolean
-clutter_text_event (ClutterActor *self,
- ClutterEvent *event)
-{
- ClutterText *text = CLUTTER_TEXT (self);
- ClutterTextPrivate *priv = text->priv;
-
- if (clutter_input_focus_is_focused (priv->input_focus) &&
- (event->type == CLUTTER_IM_COMMIT ||
- event->type == CLUTTER_IM_DELETE ||
- event->type == CLUTTER_IM_PREEDIT))
- {
- return clutter_input_focus_filter_event (priv->input_focus, event);
- }
-
- return CLUTTER_EVENT_PROPAGATE;
-}
-
-static void
-clutter_text_im_focus (ClutterText *text)
-{
- ClutterTextPrivate *priv = text->priv;
- ClutterBackend *backend = clutter_get_default_backend ();
- ClutterInputMethod *method = clutter_backend_get_input_method (backend);
-
- if (!method)
- return;
-
- clutter_input_method_focus_in (method, priv->input_focus);
- clutter_input_focus_set_content_purpose (priv->input_focus,
- priv->input_purpose);
- clutter_input_focus_set_content_hints (priv->input_focus,
- priv->input_hints);
- clutter_input_focus_set_can_show_preedit (priv->input_focus, TRUE);
- update_cursor_location (text);
-}
-
-static void
-clutter_text_key_focus_in (ClutterActor *actor)
-{
- ClutterTextPrivate *priv = CLUTTER_TEXT (actor)->priv;
-
- if (priv->editable)
- clutter_text_im_focus (CLUTTER_TEXT (actor));
-
- priv->has_focus = TRUE;
-
- clutter_text_queue_redraw (actor);
-}
-
-static void
-clutter_text_key_focus_out (ClutterActor *actor)
-{
- ClutterTextPrivate *priv = CLUTTER_TEXT (actor)->priv;
- ClutterBackend *backend = clutter_get_default_backend ();
- ClutterInputMethod *method = clutter_backend_get_input_method (backend);
-
- priv->has_focus = FALSE;
-
- if (priv->editable && clutter_input_focus_is_focused (priv->input_focus))
- {
- clutter_text_set_preedit_string (CLUTTER_TEXT (actor), NULL, NULL, 0);
- clutter_input_method_focus_out (method);
- }
-
- clutter_text_queue_redraw (actor);
-}
-
-static gboolean
-clutter_text_real_move_left (ClutterText *self,
- const gchar *action,
- guint keyval,
- ClutterModifierType modifiers)
-{
- ClutterTextPrivate *priv = self->priv;
- gint pos = priv->position;
- gint new_pos = 0;
- gint len;
-
- len = clutter_text_buffer_get_length (get_buffer (self));
-
- g_object_freeze_notify (G_OBJECT (self));
-
- if (pos != 0 && len != 0)
- {
- if (modifiers & CLUTTER_CONTROL_MASK)
- {
- if (pos == -1)
- new_pos = clutter_text_move_word_backward (self, len);
- else
- new_pos = clutter_text_move_word_backward (self, pos);
- }
- else
- {
- if (pos == -1)
- new_pos = len - 1;
- else
- new_pos = pos - 1;
- }
-
- clutter_text_set_cursor_position (self, new_pos);
- }
-
- if (!(priv->selectable && (modifiers & CLUTTER_SHIFT_MASK)))
- clutter_text_clear_selection (self);
-
- g_object_thaw_notify (G_OBJECT (self));
-
- return TRUE;
-}
-
-static gboolean
-clutter_text_real_move_right (ClutterText *self,
- const gchar *action,
- guint keyval,
- ClutterModifierType modifiers)
-{
- ClutterTextPrivate *priv = self->priv;
- gint pos = priv->position;
- gint len = clutter_text_buffer_get_length (get_buffer (self));
- gint new_pos = 0;
-
- g_object_freeze_notify (G_OBJECT (self));
-
- if (pos != -1 && len !=0)
- {
- if (modifiers & CLUTTER_CONTROL_MASK)
- {
- if (pos != len)
- new_pos = clutter_text_move_word_forward (self, pos);
- }
- else
- {
- if (pos != len)
- new_pos = pos + 1;
- }
-
- clutter_text_set_cursor_position (self, new_pos);
- }
-
- if (!(priv->selectable && (modifiers & CLUTTER_SHIFT_MASK)))
- clutter_text_clear_selection (self);
-
- g_object_thaw_notify (G_OBJECT (self));
-
- return TRUE;
-}
-
-static gboolean
-clutter_text_real_move_up (ClutterText *self,
- const gchar *action,
- guint keyval,
- ClutterModifierType modifiers)
-{
- ClutterTextPrivate *priv = self->priv;
- PangoLayoutLine *layout_line;
- PangoLayout *layout;
- gint line_no;
- gint index_, trailing;
- gint pos;
- gint x;
- const gchar *text;
-
- layout = clutter_text_get_layout (self);
- text = clutter_text_buffer_get_text (get_buffer (self));
-
- if (priv->position == 0)
- index_ = 0;
- else
- index_ = offset_to_bytes (text, priv->position);
-
- pango_layout_index_to_line_x (layout, index_,
- 0,
- &line_no, &x);
-
- line_no -= 1;
- if (line_no < 0)
- return FALSE;
-
- if (priv->x_pos != -1)
- x = priv->x_pos;
-
- layout_line = pango_layout_get_line_readonly (layout, line_no);
- if (!layout_line)
- return FALSE;
-
- pango_layout_line_x_to_index (layout_line, x, &index_, &trailing);
-
- g_object_freeze_notify (G_OBJECT (self));
-
- pos = bytes_to_offset (text, index_);
- clutter_text_set_cursor_position (self, pos + trailing);
-
- /* Store the target x position to avoid drifting left and right when
- moving the cursor up and down */
- priv->x_pos = x;
-
- if (!(priv->selectable && (modifiers & CLUTTER_SHIFT_MASK)))
- clutter_text_clear_selection (self);
-
- g_object_thaw_notify (G_OBJECT (self));
-
- return TRUE;
-}
-
-static gboolean
-clutter_text_real_move_down (ClutterText *self,
- const gchar *action,
- guint keyval,
- ClutterModifierType modifiers)
-{
- ClutterTextPrivate *priv = self->priv;
- PangoLayoutLine *layout_line;
- PangoLayout *layout;
- gint line_no;
- gint index_, trailing;
- gint x;
- gint pos;
- const gchar *text;
-
- layout = clutter_text_get_layout (self);
- text = clutter_text_buffer_get_text (get_buffer (self));
-
- if (priv->position == 0)
- index_ = 0;
- else
- index_ = offset_to_bytes (text, priv->position);
-
- pango_layout_index_to_line_x (layout, index_,
- 0,
- &line_no, &x);
-
- if (priv->x_pos != -1)
- x = priv->x_pos;
-
- layout_line = pango_layout_get_line_readonly (layout, line_no + 1);
- if (!layout_line)
- return FALSE;
-
- pango_layout_line_x_to_index (layout_line, x, &index_, &trailing);
-
- g_object_freeze_notify (G_OBJECT (self));
-
- pos = bytes_to_offset (text, index_);
- clutter_text_set_cursor_position (self, pos + trailing);
-
- /* Store the target x position to avoid drifting left and right when
- moving the cursor up and down */
- priv->x_pos = x;
-
- if (!(priv->selectable && (modifiers & CLUTTER_SHIFT_MASK)))
- clutter_text_clear_selection (self);
-
- g_object_thaw_notify (G_OBJECT (self));
-
- return TRUE;
-}
-
-static gboolean
-clutter_text_real_line_start (ClutterText *self,
- const gchar *action,
- guint keyval,
- ClutterModifierType modifiers)
-{
- ClutterTextPrivate *priv = self->priv;
- gint position;
-
- g_object_freeze_notify (G_OBJECT (self));
-
- position = clutter_text_move_line_start (self, priv->position);
- clutter_text_set_cursor_position (self, position);
-
- if (!(priv->selectable && (modifiers & CLUTTER_SHIFT_MASK)))
- clutter_text_clear_selection (self);
-
- g_object_thaw_notify (G_OBJECT (self));
-
- return TRUE;
-}
-
-static gboolean
-clutter_text_real_line_end (ClutterText *self,
- const gchar *action,
- guint keyval,
- ClutterModifierType modifiers)
-{
- ClutterTextPrivate *priv = self->priv;
- gint position;
-
- g_object_freeze_notify (G_OBJECT (self));
-
- position = clutter_text_move_line_end (self, priv->position);
- clutter_text_set_cursor_position (self, position);
-
- if (!(priv->selectable && (modifiers & CLUTTER_SHIFT_MASK)))
- clutter_text_clear_selection (self);
-
- g_object_thaw_notify (G_OBJECT (self));
-
- return TRUE;
-}
-
-static gboolean
-clutter_text_real_select_all (ClutterText *self,
- const gchar *action,
- guint keyval,
- ClutterModifierType modifiers)
-{
- guint n_chars = clutter_text_buffer_get_length (get_buffer (self));
- clutter_text_set_positions (self, 0, n_chars);
-
- return TRUE;
-}
-
-static gboolean
-clutter_text_real_del_next (ClutterText *self,
- const gchar *action,
- guint keyval,
- ClutterModifierType modifiers)
-{
- ClutterTextPrivate *priv = self->priv;
- gint pos;
- gint len;
-
- if (clutter_text_delete_selection (self))
- return TRUE;
-
- pos = priv->position;
- len = clutter_text_buffer_get_length (get_buffer (self));
-
- if (len && pos != -1 && pos < len)
- clutter_text_delete_text (self, pos, pos + 1);
-
- return TRUE;
-}
-
-static gboolean
-clutter_text_real_del_word_next (ClutterText *self,
- const gchar *action,
- guint keyval,
- ClutterModifierType modifiers)
-{
- ClutterTextPrivate *priv = self->priv;
- gint pos;
- gint len;
-
- pos = priv->position;
- len = clutter_text_buffer_get_length (get_buffer (self));
-
- if (len && pos != -1 && pos < len)
- {
- gint end;
-
- end = clutter_text_move_word_forward (self, pos);
- clutter_text_delete_text (self, pos, end);
-
- if (priv->selection_bound >= end)
- {
- gint new_bound;
-
- new_bound = priv->selection_bound - (end - pos);
- clutter_text_set_selection_bound (self, new_bound);
- }
- else if (priv->selection_bound > pos)
- {
- clutter_text_set_selection_bound (self, pos);
- }
- }
-
- return TRUE;
-}
-
-static gboolean
-clutter_text_real_del_prev (ClutterText *self,
- const gchar *action,
- guint keyval,
- ClutterModifierType modifiers)
-{
- ClutterTextPrivate *priv = self->priv;
- gint pos;
- gint len;
-
- if (clutter_text_delete_selection (self))
- return TRUE;
-
- pos = priv->position;
- len = clutter_text_buffer_get_length (get_buffer (self));
-
- if (pos != 0 && len != 0)
- {
- if (pos == -1)
- {
- clutter_text_delete_text (self, len - 1, len);
-
- clutter_text_set_positions (self, -1, -1);
- }
- else
- {
- clutter_text_delete_text (self, pos - 1, pos);
-
- clutter_text_set_positions (self, pos - 1, pos - 1);
- }
- }
-
- return TRUE;
-}
-
-static gboolean
-clutter_text_real_del_word_prev (ClutterText *self,
- const gchar *action,
- guint keyval,
- ClutterModifierType modifiers)
-{
- ClutterTextPrivate *priv = self->priv;
- gint pos;
- gint len;
-
- pos = priv->position;
- len = clutter_text_buffer_get_length (get_buffer (self));
-
- if (pos != 0 && len != 0)
- {
- gint new_pos;
-
- if (pos == -1)
- {
- new_pos = clutter_text_move_word_backward (self, len);
- clutter_text_delete_text (self, new_pos, len);
-
- clutter_text_set_positions (self, -1, -1);
- }
- else
- {
- new_pos = clutter_text_move_word_backward (self, pos);
- clutter_text_delete_text (self, new_pos, pos);
-
- clutter_text_set_cursor_position (self, new_pos);
- if (priv->selection_bound >= pos)
- {
- gint new_bound;
-
- new_bound = priv->selection_bound - (pos - new_pos);
- clutter_text_set_selection_bound (self, new_bound);
- }
- else if (priv->selection_bound >= new_pos)
- {
- clutter_text_set_selection_bound (self, new_pos);
- }
- }
- }
-
- return TRUE;
-}
-
-static gboolean
-clutter_text_real_activate (ClutterText *self,
- const gchar *action,
- guint keyval,
- ClutterModifierType modifiers)
-{
- return clutter_text_activate (self);
-}
-
-static inline void
-clutter_text_add_move_binding (ClutterBindingPool *pool,
- const gchar *action,
- guint key_val,
- ClutterModifierType additional_modifiers,
- GCallback callback)
-{
- clutter_binding_pool_install_action (pool, action,
- key_val,
- 0,
- callback,
- NULL, NULL);
- clutter_binding_pool_install_action (pool, action,
- key_val,
- CLUTTER_SHIFT_MASK,
- callback,
- NULL, NULL);
-
- if (additional_modifiers != 0)
- {
- clutter_binding_pool_install_action (pool, action,
- key_val,
- additional_modifiers,
- callback,
- NULL, NULL);
- clutter_binding_pool_install_action (pool, action,
- key_val,
- CLUTTER_SHIFT_MASK |
- additional_modifiers,
- callback,
- NULL, NULL);
- }
-}
-
-static gboolean
-clutter_text_parse_custom_node (ClutterScriptable *scriptable,
- ClutterScript *script,
- GValue *value,
- const gchar *name,
- JsonNode *node)
-{
- if (strncmp (name, "font-description", 16) == 0)
- {
- g_value_init (value, G_TYPE_STRING);
- g_value_set_string (value, json_node_get_string (node));
-
- return TRUE;
- }
-
- return parent_scriptable_iface->parse_custom_node (scriptable, script,
- value,
- name,
- node);
-}
-
-static void
-clutter_text_set_color_internal (ClutterText *self,
- GParamSpec *pspec,
- const ClutterColor *color)
-{
- ClutterTextPrivate *priv = CLUTTER_TEXT (self)->priv;
- GParamSpec *other = NULL;
-
- switch (pspec->param_id)
- {
- case PROP_COLOR:
- priv->text_color = *color;
- break;
-
- case PROP_CURSOR_COLOR:
- if (color)
- {
- priv->cursor_color = *color;
- priv->cursor_color_set = TRUE;
- }
- else
- priv->cursor_color_set = FALSE;
-
- other = obj_props[PROP_CURSOR_COLOR_SET];
- break;
-
- case PROP_SELECTION_COLOR:
- if (color)
- {
- priv->selection_color = *color;
- priv->selection_color_set = TRUE;
- }
- else
- priv->selection_color_set = FALSE;
-
- other = obj_props[PROP_SELECTION_COLOR_SET];
- break;
-
- case PROP_SELECTED_TEXT_COLOR:
- if (color)
- {
- priv->selected_text_color = *color;
- priv->selected_text_color_set = TRUE;
- }
- else
- priv->selected_text_color_set = FALSE;
-
- other = obj_props[PROP_SELECTED_TEXT_COLOR_SET];
- break;
-
- default:
- g_assert_not_reached ();
- break;
- }
-
- clutter_text_queue_redraw (CLUTTER_ACTOR (self));
- g_object_notify_by_pspec (G_OBJECT (self), pspec);
- if (other)
- g_object_notify_by_pspec (G_OBJECT (self), other);
-}
-
-static void
-clutter_text_set_color_animated (ClutterText *self,
- GParamSpec *pspec,
- const ClutterColor *color)
-{
- ClutterActor *actor = CLUTTER_ACTOR (self);
- ClutterTextPrivate *priv = self->priv;
- const ClutterAnimationInfo *info;
- ClutterTransition *transition;
-
- info = _clutter_actor_get_animation_info (actor);
- transition = clutter_actor_get_transition (actor, pspec->name);
-
- /* jump to the end if there is no easing state, or if the easing
- * state has a duration of 0 msecs
- */
- if (info->cur_state == NULL ||
- info->cur_state->easing_duration == 0)
- {
- /* ensure that we remove any currently running transition */
- if (transition != NULL)
- {
- clutter_actor_remove_transition (actor, pspec->name);
- transition = NULL;
- }
-
- clutter_text_set_color_internal (self, pspec, color);
-
- return;
- }
-
- if (transition == NULL)
- {
- transition = clutter_property_transition_new (pspec->name);
- clutter_transition_set_animatable (transition,
- CLUTTER_ANIMATABLE (self));
- clutter_transition_set_remove_on_complete (transition, TRUE);
-
- /* delay only makes sense if the transition has just been created */
- clutter_timeline_set_delay (CLUTTER_TIMELINE (transition),
- info->cur_state->easing_delay);
-
- clutter_actor_add_transition (actor, pspec->name, transition);
-
- /* the actor now owns the transition */
- g_object_unref (transition);
- }
-
- /* if a transition already exist, update its bounds */
- switch (pspec->param_id)
- {
- case PROP_COLOR:
- clutter_transition_set_from (transition, CLUTTER_TYPE_COLOR,
- &priv->text_color);
- break;
-
- case PROP_CURSOR_COLOR:
- clutter_transition_set_from (transition, CLUTTER_TYPE_COLOR,
- &priv->cursor_color);
- break;
-
- case PROP_SELECTION_COLOR:
- clutter_transition_set_from (transition, CLUTTER_TYPE_COLOR,
- &priv->selection_color);
- break;
-
- case PROP_SELECTED_TEXT_COLOR:
- clutter_transition_set_from (transition, CLUTTER_TYPE_COLOR,
- &priv->selected_text_color);
- break;
-
- default:
- g_assert_not_reached ();
- }
-
- clutter_transition_set_to (transition, CLUTTER_TYPE_COLOR, color);
-
- /* always use the current easing state */
- clutter_timeline_set_duration (CLUTTER_TIMELINE (transition),
- info->cur_state->easing_duration);
- clutter_timeline_set_progress_mode (CLUTTER_TIMELINE (transition),
- info->cur_state->easing_mode);
-
- /* ensure that we start from the beginning */
- clutter_timeline_rewind (CLUTTER_TIMELINE (transition));
- clutter_timeline_start (CLUTTER_TIMELINE (transition));
-}
-
-static void
-clutter_text_set_custom_property (ClutterScriptable *scriptable,
- ClutterScript *script,
- const gchar *name,
- const GValue *value)
-{
- if (strncmp (name, "font-description", 16) == 0)
- {
- g_assert (G_VALUE_HOLDS (value, G_TYPE_STRING));
- if (g_value_get_string (value) != NULL)
- clutter_text_set_font_name (CLUTTER_TEXT (scriptable),
- g_value_get_string (value));
- }
- else
- parent_scriptable_iface->set_custom_property (scriptable, script,
- name,
- value);
-}
-
-static void
-clutter_scriptable_iface_init (ClutterScriptableIface *iface)
-{
- parent_scriptable_iface = g_type_interface_peek_parent (iface);
-
- iface->parse_custom_node = clutter_text_parse_custom_node;
- iface->set_custom_property = clutter_text_set_custom_property;
-}
-
-static void
-clutter_text_set_final_state (ClutterAnimatable *animatable,
- const char *property_name,
- const GValue *value)
-{
- if (strcmp (property_name, "color") == 0)
- {
- const ClutterColor *color = clutter_value_get_color (value);
- clutter_text_set_color_internal (CLUTTER_TEXT (animatable),
- obj_props[PROP_COLOR], color);
- }
- else if (strcmp (property_name, "cursor-color") == 0)
- {
- const ClutterColor *color = clutter_value_get_color (value);
- clutter_text_set_color_internal (CLUTTER_TEXT (animatable),
- obj_props[PROP_CURSOR_COLOR],
- color);
- }
- else if (strcmp (property_name, "selected-text-color") == 0)
- {
- const ClutterColor *color = clutter_value_get_color (value);
- clutter_text_set_color_internal (CLUTTER_TEXT (animatable),
- obj_props[PROP_SELECTED_TEXT_COLOR],
- color);
- }
- else if (strcmp (property_name, "selection-color") == 0)
- {
- const ClutterColor *color = clutter_value_get_color (value);
- clutter_text_set_color_internal (CLUTTER_TEXT (animatable),
- obj_props[PROP_SELECTION_COLOR],
- color);
- }
- else
- parent_animatable_iface->set_final_state (animatable, property_name, value);
-}
-
-static void
-clutter_animatable_iface_init (ClutterAnimatableInterface *iface)
-{
- parent_animatable_iface = g_type_interface_peek_parent (iface);
-
- iface->set_final_state = clutter_text_set_final_state;
-}
-
-static void
-clutter_text_class_init (ClutterTextClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
- ClutterBindingPool *binding_pool;
- GParamSpec *pspec;
-
- gobject_class->set_property = clutter_text_set_property;
- gobject_class->get_property = clutter_text_get_property;
- gobject_class->dispose = clutter_text_dispose;
- gobject_class->finalize = clutter_text_finalize;
-
- actor_class->paint = clutter_text_paint;
- actor_class->get_paint_volume = clutter_text_get_paint_volume;
- actor_class->get_preferred_width = clutter_text_get_preferred_width;
- actor_class->get_preferred_height = clutter_text_get_preferred_height;
- actor_class->allocate = clutter_text_allocate;
- actor_class->key_press_event = clutter_text_key_press;
- actor_class->key_release_event = clutter_text_key_release;
- actor_class->button_press_event = clutter_text_button_press;
- actor_class->button_release_event = clutter_text_button_release;
- actor_class->motion_event = clutter_text_motion;
- actor_class->touch_event = clutter_text_touch_event;
- actor_class->key_focus_in = clutter_text_key_focus_in;
- actor_class->key_focus_out = clutter_text_key_focus_out;
- actor_class->has_overlaps = clutter_text_has_overlaps;
- actor_class->calculate_resource_scale = clutter_text_calculate_resource_scale;
- actor_class->resource_scale_changed = clutter_text_resource_scale_changed;
- actor_class->event = clutter_text_event;
-
- /**
- * ClutterText:buffer:
- *
- * The buffer which stores the text for this #ClutterText.
- *
- * If set to %NULL, a default buffer will be created.
- *
- * Since: 1.8
- */
- pspec = g_param_spec_object ("buffer",
- P_("Buffer"),
- P_("The buffer for the text"),
- CLUTTER_TYPE_TEXT_BUFFER,
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_BUFFER] = pspec;
- g_object_class_install_property (gobject_class, PROP_BUFFER, pspec);
-
- /**
- * ClutterText:font-name:
- *
- * The font to be used by the #ClutterText, as a string
- * that can be parsed by pango_font_description_from_string().
- *
- * If set to %NULL, the default system font will be used instead.
- *
- * Since: 1.0
- */
- pspec = g_param_spec_string ("font-name",
- P_("Font Name"),
- P_("The font to be used by the text"),
- NULL,
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_FONT_NAME] = pspec;
- g_object_class_install_property (gobject_class, PROP_FONT_NAME, pspec);
-
- /**
- * ClutterText:font-description:
- *
- * The #PangoFontDescription that should be used by the #ClutterText
- *
- * If you have a string describing the font then you should look at
- * #ClutterText:font-name instead
- *
- * Since: 1.2
- */
- pspec = g_param_spec_boxed ("font-description",
- P_("Font Description"),
- P_("The font description to be used"),
- PANGO_TYPE_FONT_DESCRIPTION,
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_FONT_DESCRIPTION] = pspec;
- g_object_class_install_property (gobject_class,
- PROP_FONT_DESCRIPTION,
- pspec);
-
- /**
- * ClutterText:text:
- *
- * The text to render inside the actor.
- *
- * Since: 1.0
- */
- pspec = g_param_spec_string ("text",
- P_("Text"),
- P_("The text to render"),
- "",
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_TEXT] = pspec;
- g_object_class_install_property (gobject_class, PROP_TEXT, pspec);
-
- /**
- * ClutterText:color:
- *
- * The color used to render the text.
- *
- * Since: 1.0
- */
- pspec = clutter_param_spec_color ("color",
- P_("Font Color"),
- P_("Color of the font used by the text"),
- &default_text_color,
- CLUTTER_PARAM_READWRITE |
- CLUTTER_PARAM_ANIMATABLE);
- obj_props[PROP_COLOR] = pspec;
- g_object_class_install_property (gobject_class, PROP_COLOR, pspec);
-
- /**
- * ClutterText:editable:
- *
- * Whether key events delivered to the actor causes editing.
- *
- * Since: 1.0
- */
- pspec = g_param_spec_boolean ("editable",
- P_("Editable"),
- P_("Whether the text is editable"),
- FALSE,
- G_PARAM_READWRITE);
- obj_props[PROP_EDITABLE] = pspec;
- g_object_class_install_property (gobject_class, PROP_EDITABLE, pspec);
-
- /**
- * ClutterText:selectable:
- *
- * Whether it is possible to select text, either using the pointer
- * or the keyboard.
- *
- * This property depends on the #ClutterActor:reactive property being
- * set to %TRUE.
- *
- * Since: 1.0
- */
- pspec = g_param_spec_boolean ("selectable",
- P_("Selectable"),
- P_("Whether the text is selectable"),
- TRUE,
- G_PARAM_READWRITE);
- obj_props[PROP_SELECTABLE] = pspec;
- g_object_class_install_property (gobject_class, PROP_SELECTABLE, pspec);
-
- /**
- * ClutterText:activatable:
- *
- * Toggles whether return invokes the activate signal or not.
- *
- * Since: 1.0
- */
- pspec = g_param_spec_boolean ("activatable",
- P_("Activatable"),
- P_("Whether pressing return causes the activate signal to be emitted"),
- TRUE,
- G_PARAM_READWRITE);
- obj_props[PROP_ACTIVATABLE] = pspec;
- g_object_class_install_property (gobject_class, PROP_ACTIVATABLE, pspec);
-
- /**
- * ClutterText:cursor-visible:
- *
- * Whether the input cursor is visible or not.
- *
- * The cursor will only be visible if this property and either
- * the #ClutterText:editable or the #ClutterText:selectable properties
- * are set to %TRUE.
- *
- * Since: 1.0
- */
- pspec = g_param_spec_boolean ("cursor-visible",
- P_("Cursor Visible"),
- P_("Whether the input cursor is visible"),
- TRUE,
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_CURSOR_VISIBLE] = pspec;
- g_object_class_install_property (gobject_class, PROP_CURSOR_VISIBLE, pspec);
-
- /**
- * ClutterText:cursor-color:
- *
- * The color of the cursor.
- *
- * Since: 1.0
- */
- pspec = clutter_param_spec_color ("cursor-color",
- P_("Cursor Color"),
- P_("Cursor Color"),
- &default_cursor_color,
- CLUTTER_PARAM_READWRITE |
- CLUTTER_PARAM_ANIMATABLE);
- obj_props[PROP_CURSOR_COLOR] = pspec;
- g_object_class_install_property (gobject_class, PROP_CURSOR_COLOR, pspec);
-
- /**
- * ClutterText:cursor-color-set:
- *
- * Will be set to %TRUE if #ClutterText:cursor-color has been set.
- *
- * Since: 1.0
- */
- pspec = g_param_spec_boolean ("cursor-color-set",
- P_("Cursor Color Set"),
- P_("Whether the cursor color has been set"),
- FALSE,
- CLUTTER_PARAM_READABLE);
- obj_props[PROP_CURSOR_COLOR_SET] = pspec;
- g_object_class_install_property (gobject_class, PROP_CURSOR_COLOR_SET, pspec);
-
- /**
- * ClutterText:cursor-size:
- *
- * The size of the cursor, in pixels. If set to -1 the size used will
- * be the default cursor size of 2 pixels.
- *
- * Since: 1.0
- */
- pspec = g_param_spec_int ("cursor-size",
- P_("Cursor Size"),
- P_("The width of the cursor, in pixels"),
- -1, G_MAXINT, DEFAULT_CURSOR_SIZE,
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_CURSOR_SIZE] = pspec;
- g_object_class_install_property (gobject_class, PROP_CURSOR_SIZE, pspec);
-
- /**
- * ClutterText:position:
- *
- * The current input cursor position. -1 is taken to be the end of the text
- *
- * Since: 1.0
- *
- * Deprecated: 1.12: Use ClutterText:cursor-position instead.
- */
- pspec = g_param_spec_int ("position",
- P_("Cursor Position"),
- P_("The cursor position"),
- -1, G_MAXINT,
- -1,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS |
- G_PARAM_DEPRECATED);
- obj_props[PROP_POSITION] = pspec;
- g_object_class_install_property (gobject_class, PROP_POSITION, pspec);
-
- /**
- * ClutterText:cursor-position:
- *
- * The current input cursor position. -1 is taken to be the end of the text
- *
- * Since: 1.12
- */
- pspec = g_param_spec_int ("cursor-position",
- P_("Cursor Position"),
- P_("The cursor position"),
- -1, G_MAXINT,
- -1,
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_CURSOR_POSITION] = pspec;
- g_object_class_install_property (gobject_class, PROP_CURSOR_POSITION, pspec);
-
- /**
- * ClutterText:selection-bound:
- *
- * The current input cursor position. -1 is taken to be the end of the text
- *
- * Since: 1.0
- */
- pspec = g_param_spec_int ("selection-bound",
- P_("Selection-bound"),
- P_("The cursor position of the other end of the selection"),
- -1, G_MAXINT,
- -1,
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_SELECTION_BOUND] = pspec;
- g_object_class_install_property (gobject_class, PROP_SELECTION_BOUND, pspec);
-
- /**
- * ClutterText:selection-color:
- *
- * The color of the selection.
- *
- * Since: 1.0
- */
- pspec = clutter_param_spec_color ("selection-color",
- P_("Selection Color"),
- P_("Selection Color"),
- &default_selection_color,
- CLUTTER_PARAM_READWRITE |
- CLUTTER_PARAM_ANIMATABLE);
- obj_props[PROP_SELECTION_COLOR] = pspec;
- g_object_class_install_property (gobject_class, PROP_SELECTION_COLOR, pspec);
-
- /**
- * ClutterText:selection-color-set:
- *
- * Will be set to %TRUE if #ClutterText:selection-color has been set.
- *
- * Since: 1.0
- */
- pspec = g_param_spec_boolean ("selection-color-set",
- P_("Selection Color Set"),
- P_("Whether the selection color has been set"),
- FALSE,
- CLUTTER_PARAM_READABLE);
- obj_props[PROP_SELECTION_COLOR_SET] = pspec;
- g_object_class_install_property (gobject_class, PROP_SELECTION_COLOR_SET, pspec);
-
- /**
- * ClutterText:attributes:
- *
- * A list of #PangoStyleAttribute<!-- -->s to be applied to the
- * contents of the #ClutterText actor.
- *
- * Since: 1.0
- */
- pspec = g_param_spec_boxed ("attributes",
- P_("Attributes"),
- P_("A list of style attributes to apply to the contents of the actor"),
- PANGO_TYPE_ATTR_LIST,
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_ATTRIBUTES] = pspec;
- g_object_class_install_property (gobject_class, PROP_ATTRIBUTES, pspec);
-
- /**
- * ClutterText:use-markup:
- *
- * Whether the text includes Pango markup.
- *
- * For more information about the Pango markup format, see
- * pango_layout_set_markup() in the Pango documentation.
- *
- * It is not possible to round-trip this property between
- * %TRUE and %FALSE. Once a string with markup has been set on
- * a #ClutterText actor with :use-markup set to %TRUE, the markup
- * is stripped from the string.
- *
- * Since: 1.0
- */
- pspec = g_param_spec_boolean ("use-markup",
- P_("Use markup"),
- P_("Whether or not the text includes Pango markup"),
- FALSE,
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_USE_MARKUP] = pspec;
- g_object_class_install_property (gobject_class, PROP_USE_MARKUP, pspec);
-
- /**
- * ClutterText:line-wrap:
- *
- * Whether to wrap the lines of #ClutterText:text if the contents
- * exceed the available allocation. The wrapping strategy is
- * controlled by the #ClutterText:line-wrap-mode property.
- *
- * Since: 1.0
- */
- pspec = g_param_spec_boolean ("line-wrap",
- P_("Line wrap"),
- P_("If set, wrap the lines if the text becomes too wide"),
- FALSE,
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_LINE_WRAP] = pspec;
- g_object_class_install_property (gobject_class, PROP_LINE_WRAP, pspec);
-
- /**
- * ClutterText:line-wrap-mode:
- *
- * If #ClutterText:line-wrap is set to %TRUE, this property will
- * control how the text is wrapped.
- *
- * Since: 1.0
- */
- pspec = g_param_spec_enum ("line-wrap-mode",
- P_("Line wrap mode"),
- P_("Control how line-wrapping is done"),
- PANGO_TYPE_WRAP_MODE,
- PANGO_WRAP_WORD,
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_LINE_WRAP_MODE] = pspec;
- g_object_class_install_property (gobject_class, PROP_LINE_WRAP_MODE, pspec);
-
- /**
- * ClutterText:ellipsize:
- *
- * The preferred place to ellipsize the contents of the #ClutterText actor
- *
- * Since: 1.0
- */
- pspec = g_param_spec_enum ("ellipsize",
- P_("Ellipsize"),
- P_("The preferred place to ellipsize the string"),
- PANGO_TYPE_ELLIPSIZE_MODE,
- PANGO_ELLIPSIZE_NONE,
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_ELLIPSIZE] = pspec;
- g_object_class_install_property (gobject_class, PROP_ELLIPSIZE, pspec);
-
- /**
- * ClutterText:line-alignment:
- *
- * The preferred alignment for the text. This property controls
- * the alignment of multi-line paragraphs.
- *
- * Since: 1.0
- */
- pspec = g_param_spec_enum ("line-alignment",
- P_("Line Alignment"),
- P_("The preferred alignment for the string, for multi-line text"),
- PANGO_TYPE_ALIGNMENT,
- PANGO_ALIGN_LEFT,
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_LINE_ALIGNMENT] = pspec;
- g_object_class_install_property (gobject_class, PROP_LINE_ALIGNMENT, pspec);
-
- /**
- * ClutterText:justify:
- *
- * Whether the contents of the #ClutterText should be justified
- * on both margins.
- *
- * Since: 1.0
- */
- pspec = g_param_spec_boolean ("justify",
- P_("Justify"),
- P_("Whether the text should be justified"),
- FALSE,
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_JUSTIFY] = pspec;
- g_object_class_install_property (gobject_class, PROP_JUSTIFY, pspec);
-
- /**
- * ClutterText:password-char:
- *
- * If non-zero, the character that should be used in place of
- * the actual text in a password text actor.
- *
- * Since: 1.0
- */
- pspec = g_param_spec_unichar ("password-char",
- P_("Password Character"),
- P_("If non-zero, use this character to display the actor's contents"),
- 0,
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_PASSWORD_CHAR] = pspec;
- g_object_class_install_property (gobject_class, PROP_PASSWORD_CHAR, pspec);
-
- /**
- * ClutterText:max-length:
- *
- * The maximum length of the contents of the #ClutterText actor.
- *
- * Since: 1.0
- */
- pspec = g_param_spec_int ("max-length",
- P_("Max Length"),
- P_("Maximum length of the text inside the actor"),
- -1, G_MAXINT, 0,
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_MAX_LENGTH] = pspec;
- g_object_class_install_property (gobject_class, PROP_MAX_LENGTH, pspec);
-
- /**
- * ClutterText:single-line-mode:
- *
- * Whether the #ClutterText actor should be in single line mode
- * or not. A single line #ClutterText actor will only contain a
- * single line of text, scrolling it in case its length is bigger
- * than the allocated size.
- *
- * Setting this property will also set the #ClutterText:activatable
- * property as a side-effect.
- *
- * The #ClutterText:single-line-mode property is used only if the
- * #ClutterText:editable property is set to %TRUE.
- *
- * Since: 1.0
- */
- pspec = g_param_spec_boolean ("single-line-mode",
- P_("Single Line Mode"),
- P_("Whether the text should be a single line"),
- FALSE,
- CLUTTER_PARAM_READWRITE);
- obj_props[PROP_SINGLE_LINE_MODE] = pspec;
- g_object_class_install_property (gobject_class, PROP_SINGLE_LINE_MODE, pspec);
-
- /**
- * ClutterText:selected-text-color:
- *
- * The color of selected text.
- *
- * Since: 1.8
- */
- pspec = clutter_param_spec_color ("selected-text-color",
- P_("Selected Text Color"),
- P_("Selected Text Color"),
- &default_selected_text_color,
- CLUTTER_PARAM_READWRITE |
- CLUTTER_PARAM_ANIMATABLE);
- obj_props[PROP_SELECTED_TEXT_COLOR] = pspec;
- g_object_class_install_property (gobject_class, PROP_SELECTED_TEXT_COLOR, pspec);
-
- /**
- * ClutterText:selected-text-color-set:
- *
- * Will be set to %TRUE if #ClutterText:selected-text-color has been set.
- *
- * Since: 1.8
- */
- pspec = g_param_spec_boolean ("selected-text-color-set",
- P_("Selected Text Color Set"),
- P_("Whether the selected text color has been set"),
- FALSE,
- CLUTTER_PARAM_READABLE);
- obj_props[PROP_SELECTED_TEXT_COLOR_SET] = pspec;
- g_object_class_install_property (gobject_class, PROP_SELECTED_TEXT_COLOR_SET, pspec);
-
- pspec = g_param_spec_flags ("input-hints",
- P_("Input hints"),
- P_("Input hints"),
- CLUTTER_TYPE_INPUT_CONTENT_HINT_FLAGS,
- 0, CLUTTER_PARAM_READWRITE);
- obj_props[PROP_INPUT_HINTS] = pspec;
- g_object_class_install_property (gobject_class, PROP_INPUT_HINTS, pspec);
-
- pspec = g_param_spec_enum ("input-purpose",
- P_("Input purpose"),
- P_("Input purpose"),
- CLUTTER_TYPE_INPUT_CONTENT_PURPOSE,
- 0, CLUTTER_PARAM_READWRITE);
- obj_props[PROP_INPUT_PURPOSE] = pspec;
- g_object_class_install_property (gobject_class, PROP_INPUT_PURPOSE, pspec);
-
- /**
- * ClutterText::text-changed:
- * @self: the #ClutterText that emitted the signal
- *
- * The ::text-changed signal is emitted after @actor's text changes
- *
- * Since: 1.0
- */
- text_signals[TEXT_CHANGED] =
- g_signal_new (I_("text-changed"),
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterTextClass, text_changed),
- NULL, NULL, NULL,
- G_TYPE_NONE, 0);
-
- /**
- * ClutterText::insert-text:
- * @self: the #ClutterText that emitted the signal
- * @new_text: the new text to insert
- * @new_text_length: the length of the new text, in bytes, or -1 if
- * new_text is nul-terminated
- * @position: the position, in characters, at which to insert the
- * new text. this is an in-out parameter. After the signal
- * emission is finished, it should point after the newly
- * inserted text.
- *
- * This signal is emitted when text is inserted into the actor by
- * the user. It is emitted before @self text changes.
- *
- * Since: 1.2
- */
- text_signals[INSERT_TEXT] =
- g_signal_new (I_("insert-text"),
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- 0,
- NULL, NULL,
- _clutter_marshal_VOID__STRING_INT_POINTER,
- G_TYPE_NONE, 3,
- G_TYPE_STRING,
- G_TYPE_INT,
- G_TYPE_POINTER);
-
- /**
- * ClutterText::delete-text:
- * @self: the #ClutterText that emitted the signal
- * @start_pos: the starting position
- * @end_pos: the end position
- *
- * This signal is emitted when text is deleted from the actor by
- * the user. It is emitted before @self text changes.
- *
- * Since: 1.2
- */
- text_signals[DELETE_TEXT] =
- g_signal_new (I_("delete-text"),
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- 0,
- NULL, NULL,
- _clutter_marshal_VOID__INT_INT,
- G_TYPE_NONE, 2,
- G_TYPE_INT,
- G_TYPE_INT);
-
- /**
- * ClutterText::cursor-event:
- * @self: the #ClutterText that emitted the signal
- * @rect: 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
- * the current position and size of the cursor, relative to the actor
- * itself.
- *
- * Since: 1.0
- *
- * Deprecated: 1.16: Use the #ClutterText::cursor-changed signal instead
- */
- text_signals[CURSOR_EVENT] =
- g_signal_new (I_("cursor-event"),
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_DEPRECATED,
- G_STRUCT_OFFSET (ClutterTextClass, cursor_event),
- NULL, NULL, NULL,
- G_TYPE_NONE, 1,
- GRAPHENE_TYPE_RECT | G_SIGNAL_TYPE_STATIC_SCOPE);
-
- /**
- * ClutterText::cursor-changed:
- * @self: the #ClutterText that emitted the signal
- *
- * The ::cursor-changed signal is emitted whenever the cursor
- * position or size changes.
- *
- * Since: 1.16
- */
- text_signals[CURSOR_CHANGED] =
- g_signal_new (I_("cursor-changed"),
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterTextClass, cursor_changed),
- NULL, NULL, NULL,
- G_TYPE_NONE, 0);
-
- /**
- * ClutterText::activate:
- * @self: the #ClutterText that emitted the signal
- *
- * The ::activate signal is emitted each time the actor is 'activated'
- * by the user, normally by pressing the 'Enter' key. The signal is
- * emitted only if #ClutterText:activatable is set to %TRUE.
- *
- * Since: 1.0
- */
- text_signals[ACTIVATE] =
- g_signal_new (I_("activate"),
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterTextClass, activate),
- NULL, NULL, NULL,
- G_TYPE_NONE, 0);
-
- binding_pool = clutter_binding_pool_get_for_class (klass);
-
- clutter_text_add_move_binding (binding_pool, "move-left",
- CLUTTER_KEY_Left, CLUTTER_CONTROL_MASK,
- G_CALLBACK (clutter_text_real_move_left));
- clutter_text_add_move_binding (binding_pool, "move-left",
- CLUTTER_KEY_KP_Left, CLUTTER_CONTROL_MASK,
- G_CALLBACK (clutter_text_real_move_left));
- clutter_text_add_move_binding (binding_pool, "move-right",
- CLUTTER_KEY_Right, CLUTTER_CONTROL_MASK,
- G_CALLBACK (clutter_text_real_move_right));
- clutter_text_add_move_binding (binding_pool, "move-right",
- CLUTTER_KEY_KP_Right, CLUTTER_CONTROL_MASK,
- G_CALLBACK (clutter_text_real_move_right));
- clutter_text_add_move_binding (binding_pool, "move-up",
- CLUTTER_KEY_Up, 0,
- G_CALLBACK (clutter_text_real_move_up));
- clutter_text_add_move_binding (binding_pool, "move-up",
- CLUTTER_KEY_KP_Up, 0,
- G_CALLBACK (clutter_text_real_move_up));
- clutter_text_add_move_binding (binding_pool, "move-down",
- CLUTTER_KEY_Down, 0,
- G_CALLBACK (clutter_text_real_move_down));
- clutter_text_add_move_binding (binding_pool, "move-down",
- CLUTTER_KEY_KP_Down, 0,
- G_CALLBACK (clutter_text_real_move_down));
-
- clutter_text_add_move_binding (binding_pool, "line-start",
- CLUTTER_KEY_Home, 0,
- G_CALLBACK (clutter_text_real_line_start));
- clutter_text_add_move_binding (binding_pool, "line-start",
- CLUTTER_KEY_KP_Home, 0,
- G_CALLBACK (clutter_text_real_line_start));
- clutter_text_add_move_binding (binding_pool, "line-start",
- CLUTTER_KEY_Begin, 0,
- G_CALLBACK (clutter_text_real_line_start));
- clutter_text_add_move_binding (binding_pool, "line-end",
- CLUTTER_KEY_End, 0,
- G_CALLBACK (clutter_text_real_line_end));
- clutter_text_add_move_binding (binding_pool, "line-end",
- CLUTTER_KEY_KP_End, 0,
- G_CALLBACK (clutter_text_real_line_end));
-
- clutter_binding_pool_install_action (binding_pool, "select-all",
- CLUTTER_KEY_a, CLUTTER_CONTROL_MASK,
- G_CALLBACK (clutter_text_real_select_all),
- NULL, NULL);
- clutter_binding_pool_install_action (binding_pool, "select-all",
- CLUTTER_KEY_A, CLUTTER_CONTROL_MASK,
- G_CALLBACK (clutter_text_real_select_all),
- NULL, NULL);
-
- clutter_binding_pool_install_action (binding_pool, "delete-next",
- CLUTTER_KEY_Delete, 0,
- G_CALLBACK (clutter_text_real_del_next),
- NULL, NULL);
- clutter_binding_pool_install_action (binding_pool, "delete-next",
- CLUTTER_KEY_Delete, CLUTTER_CONTROL_MASK,
- G_CALLBACK (clutter_text_real_del_word_next),
- NULL, NULL);
- clutter_binding_pool_install_action (binding_pool, "delete-next",
- CLUTTER_KEY_KP_Delete, 0,
- G_CALLBACK (clutter_text_real_del_next),
- NULL, NULL);
- clutter_binding_pool_install_action (binding_pool, "delete-next",
- CLUTTER_KEY_KP_Delete, CLUTTER_CONTROL_MASK,
- G_CALLBACK (clutter_text_real_del_word_next),
- NULL, NULL);
- clutter_binding_pool_install_action (binding_pool, "delete-prev",
- CLUTTER_KEY_BackSpace, 0,
- G_CALLBACK (clutter_text_real_del_prev),
- NULL, NULL);
- clutter_binding_pool_install_action (binding_pool, "delete-prev",
- CLUTTER_KEY_BackSpace, CLUTTER_SHIFT_MASK,
- G_CALLBACK (clutter_text_real_del_prev),
- NULL, NULL);
- clutter_binding_pool_install_action (binding_pool, "delete-prev",
- CLUTTER_KEY_BackSpace, CLUTTER_CONTROL_MASK,
- G_CALLBACK (clutter_text_real_del_word_prev),
- NULL, NULL);
-
- clutter_binding_pool_install_action (binding_pool, "activate",
- CLUTTER_KEY_Return, 0,
- G_CALLBACK (clutter_text_real_activate),
- NULL, NULL);
- clutter_binding_pool_install_action (binding_pool, "activate",
- CLUTTER_KEY_KP_Enter, 0,
- G_CALLBACK (clutter_text_real_activate),
- NULL, NULL);
- clutter_binding_pool_install_action (binding_pool, "activate",
- CLUTTER_KEY_ISO_Enter, 0,
- G_CALLBACK (clutter_text_real_activate),
- NULL, NULL);
-}
-
-static void
-clutter_text_init (ClutterText *self)
-{
- ClutterSettings *settings;
- ClutterTextPrivate *priv;
- gchar *font_name;
- int i, password_hint_time;
-
- self->priv = priv = clutter_text_get_instance_private (self);
-
- priv->alignment = PANGO_ALIGN_LEFT;
- priv->wrap = FALSE;
- priv->wrap_mode = PANGO_WRAP_WORD;
- priv->ellipsize = PANGO_ELLIPSIZE_NONE;
- priv->use_underline = FALSE;
- priv->use_markup = FALSE;
- priv->justify = FALSE;
-
- for (i = 0; i < N_CACHED_LAYOUTS; i++)
- priv->cached_layouts[i].layout = NULL;
-
- /* default to "" so that clutter_text_get_text() will
- * return a valid string and we can safely call strlen()
- * or strcmp() on it
- */
- priv->buffer = NULL;
-
- priv->text_color = default_text_color;
- priv->cursor_color = default_cursor_color;
- priv->selection_color = default_selection_color;
- priv->selected_text_color = default_selected_text_color;
-
- /* get the default font name from the context; we don't use
- * set_font_description() here because we are initializing
- * the Text and we don't need notifications and sanity checks
- */
- settings = clutter_settings_get_default ();
- g_object_get (settings,
- "font-name", &font_name,
- "password-hint-time", &password_hint_time,
- NULL);
-
- priv->font_name = font_name; /* font_name is allocated */
- priv->font_desc = pango_font_description_from_string (font_name);
- priv->is_default_font = TRUE;
-
- priv->position = -1;
- priv->selection_bound = -1;
-
- priv->x_pos = -1;
- priv->cursor_visible = TRUE;
- priv->editable = FALSE;
- priv->selectable = TRUE;
-
- priv->selection_color_set = FALSE;
- priv->cursor_color_set = FALSE;
- priv->selected_text_color_set = FALSE;
- priv->preedit_set = FALSE;
-
- priv->password_char = 0;
- priv->show_password_hint = password_hint_time > 0;
- priv->password_hint_timeout = password_hint_time;
-
- priv->text_y = 0;
-
- priv->cursor_size = DEFAULT_CURSOR_SIZE;
-
- priv->settings_changed_id =
- g_signal_connect_swapped (clutter_get_default_backend (),
- "settings-changed",
- G_CALLBACK (clutter_text_settings_changed_cb),
- self);
-
- priv->direction_changed_id =
- g_signal_connect (self, "notify::text-direction",
- G_CALLBACK (clutter_text_direction_changed_cb),
- NULL);
-
- priv->input_focus = clutter_text_input_focus_new (self);
-}
-
-/**
- * clutter_text_new:
- *
- * Creates a new #ClutterText actor. This actor can be used to
- * display and edit text.
- *
- * Return value: the newly created #ClutterText actor
- *
- * Since: 1.0
- */
-ClutterActor *
-clutter_text_new (void)
-{
- return g_object_new (CLUTTER_TYPE_TEXT, NULL);
-}
-
-/**
- * clutter_text_new_full:
- * @font_name: a string with a font description
- * @text: the contents of the actor
- * @color: the color to be used to render @text
- *
- * Creates a new #ClutterText actor, using @font_name as the font
- * description; @text will be used to set the contents of the actor;
- * and @color will be used as the color to render @text.
- *
- * This function is equivalent to calling clutter_text_new(),
- * clutter_text_set_font_name(), clutter_text_set_text() and
- * clutter_text_set_color().
- *
- * Return value: the newly created #ClutterText actor
- *
- * Since: 1.0
- */
-ClutterActor *
-clutter_text_new_full (const gchar *font_name,
- const gchar *text,
- const ClutterColor *color)
-{
- return g_object_new (CLUTTER_TYPE_TEXT,
- "font-name", font_name,
- "text", text,
- "color", color,
- NULL);
-}
-
-/**
- * clutter_text_new_with_text:
- * @font_name: (allow-none): a string with a font description
- * @text: the contents of the actor
- *
- * Creates a new #ClutterText actor, using @font_name as the font
- * description; @text will be used to set the contents of the actor.
- *
- * This function is equivalent to calling clutter_text_new(),
- * clutter_text_set_font_name(), and clutter_text_set_text().
- *
- * Return value: the newly created #ClutterText actor
- *
- * Since: 1.0
- */
-ClutterActor *
-clutter_text_new_with_text (const gchar *font_name,
- const gchar *text)
-{
- return g_object_new (CLUTTER_TYPE_TEXT,
- "font-name", font_name,
- "text", text,
- NULL);
-}
-
-static ClutterTextBuffer*
-get_buffer (ClutterText *self)
-{
- ClutterTextPrivate *priv = self->priv;
-
- if (priv->buffer == NULL)
- {
- ClutterTextBuffer *buffer;
- buffer = clutter_text_buffer_new ();
- clutter_text_set_buffer (self, buffer);
- g_object_unref (buffer);
- }
-
- return priv->buffer;
-}
-
-/* GtkEntryBuffer signal handlers
- */
-static void
-buffer_inserted_text (ClutterTextBuffer *buffer,
- guint position,
- const gchar *chars,
- guint n_chars,
- ClutterText *self)
-{
- ClutterTextPrivate *priv;
- gint new_position;
- gint new_selection_bound;
-
- priv = self->priv;
- if (priv->position >= 0 || priv->selection_bound >= 0)
- {
- new_position = priv->position;
- new_selection_bound = priv->selection_bound;
-
- if (position <= new_position)
- new_position += n_chars;
- if (position <= new_selection_bound)
- new_selection_bound += n_chars;
-
- if (priv->position != new_position || priv->selection_bound != new_selection_bound)
- clutter_text_set_positions (self, new_position, new_selection_bound);
- }
-
- /* TODO: What are we supposed to with the out value of position? */
-}
-
-static void
-buffer_deleted_text (ClutterTextBuffer *buffer,
- guint position,
- guint n_chars,
- ClutterText *self)
-{
- ClutterTextPrivate *priv;
- gint new_position;
- gint new_selection_bound;
-
- priv = self->priv;
- if (priv->position >= 0 || priv->selection_bound >= 0)
- {
- new_position = priv->position;
- new_selection_bound = priv->selection_bound;
-
- if (position < new_position)
- new_position -= n_chars;
- if (position < new_selection_bound)
- new_selection_bound -= n_chars;
-
- if (priv->position != new_position || priv->selection_bound != new_selection_bound)
- clutter_text_set_positions (self, new_position, new_selection_bound);
- }
-}
-
-static void
-clutter_text_queue_redraw_or_relayout (ClutterText *self)
-{
- ClutterActor *actor = CLUTTER_ACTOR (self);
- gfloat preferred_width;
- gfloat preferred_height;
-
- clutter_text_dirty_cache (self);
-
- /* we're using our private implementations here to avoid the caching done by ClutterActor */
- clutter_text_get_preferred_width (actor, -1, NULL, &preferred_width);
- clutter_text_get_preferred_height (actor, preferred_width, NULL, &preferred_height);
-
- if (clutter_actor_has_allocation (actor) &&
- fabsf (preferred_width - clutter_actor_get_width (actor)) <= 0.001 &&
- fabsf (preferred_height - clutter_actor_get_height (actor)) <= 0.001)
- clutter_text_queue_redraw (actor);
- else
- clutter_actor_queue_relayout (actor);
-}
-
-static void
-buffer_notify_text (ClutterTextBuffer *buffer,
- GParamSpec *spec,
- ClutterText *self)
-{
- g_object_freeze_notify (G_OBJECT (self));
-
- clutter_text_queue_redraw_or_relayout (self);
-
- g_signal_emit (self, text_signals[TEXT_CHANGED], 0);
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_TEXT]);
-
- g_object_thaw_notify (G_OBJECT (self));
-}
-
-static void
-buffer_notify_max_length (ClutterTextBuffer *buffer,
- GParamSpec *spec,
- ClutterText *self)
-{
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_MAX_LENGTH]);
-}
-
-static void
-buffer_connect_signals (ClutterText *self)
-{
- ClutterTextPrivate *priv = self->priv;
- g_signal_connect (priv->buffer, "inserted-text", G_CALLBACK (buffer_inserted_text), self);
- g_signal_connect (priv->buffer, "deleted-text", G_CALLBACK (buffer_deleted_text), self);
- g_signal_connect (priv->buffer, "notify::text", G_CALLBACK (buffer_notify_text), self);
- g_signal_connect (priv->buffer, "notify::max-length", G_CALLBACK (buffer_notify_max_length), self);
-}
-
-static void
-buffer_disconnect_signals (ClutterText *self)
-{
- ClutterTextPrivate *priv = self->priv;
- g_signal_handlers_disconnect_by_func (priv->buffer, buffer_inserted_text, self);
- g_signal_handlers_disconnect_by_func (priv->buffer, buffer_deleted_text, self);
- g_signal_handlers_disconnect_by_func (priv->buffer, buffer_notify_text, self);
- g_signal_handlers_disconnect_by_func (priv->buffer, buffer_notify_max_length, self);
-}
-
-/**
- * clutter_text_new_with_buffer:
- * @buffer: The buffer to use for the new #ClutterText.
- *
- * Creates a new entry with the specified text buffer.
- *
- * Return value: a new #ClutterText
- *
- * Since: 1.10
- */
-ClutterActor *
-clutter_text_new_with_buffer (ClutterTextBuffer *buffer)
-{
- g_return_val_if_fail (CLUTTER_IS_TEXT_BUFFER (buffer), NULL);
- return g_object_new (CLUTTER_TYPE_TEXT, "buffer", buffer, NULL);
-}
-
-/**
- * clutter_text_get_buffer:
- * @self: a #ClutterText
- *
- * Get the #ClutterTextBuffer object which holds the text for
- * this widget.
- *
- * Returns: (transfer none): A #GtkEntryBuffer object.
- *
- * Since: 1.10
- */
-ClutterTextBuffer*
-clutter_text_get_buffer (ClutterText *self)
-{
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), NULL);
-
- return get_buffer (self);
-}
-
-/**
- * clutter_text_set_buffer:
- * @self: a #ClutterText
- * @buffer: a #ClutterTextBuffer
- *
- * Set the #ClutterTextBuffer object which holds the text for
- * this widget.
- *
- * Since: 1.10
- */
-void
-clutter_text_set_buffer (ClutterText *self,
- ClutterTextBuffer *buffer)
-{
- ClutterTextPrivate *priv;
- GObject *obj;
-
- g_return_if_fail (CLUTTER_IS_TEXT (self));
-
- priv = self->priv;
-
- if (buffer)
- {
- g_return_if_fail (CLUTTER_IS_TEXT_BUFFER (buffer));
- g_object_ref (buffer);
- }
-
- if (priv->buffer)
- {
- buffer_disconnect_signals (self);
- g_object_unref (priv->buffer);
- }
-
- priv->buffer = buffer;
-
- if (priv->buffer)
- buffer_connect_signals (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_thaw_notify (obj);
-}
-
-/**
- * clutter_text_set_editable:
- * @self: a #ClutterText
- * @editable: whether the #ClutterText should be editable
- *
- * Sets whether the #ClutterText actor should be editable.
- *
- * An editable #ClutterText with key focus set using
- * clutter_actor_grab_key_focus() or clutter_stage_set_key_focus()
- * will receive key events and will update its contents accordingly.
- *
- * Since: 1.0
- */
-void
-clutter_text_set_editable (ClutterText *self,
- gboolean editable)
-{
- ClutterBackend *backend = clutter_get_default_backend ();
- ClutterInputMethod *method = clutter_backend_get_input_method (backend);
- ClutterTextPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TEXT (self));
-
- priv = self->priv;
-
- if (priv->editable != editable)
- {
- priv->editable = editable;
-
- if (method)
- {
- if (!priv->editable && clutter_input_focus_is_focused (priv->input_focus))
- clutter_input_method_focus_out (method);
- else if (priv->has_focus)
- clutter_text_im_focus (self);
- }
-
- clutter_text_queue_redraw (CLUTTER_ACTOR (self));
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_EDITABLE]);
- }
-}
-
-/**
- * clutter_text_get_editable:
- * @self: a #ClutterText
- *
- * Retrieves whether a #ClutterText is editable or not.
- *
- * Return value: %TRUE if the actor is editable
- *
- * Since: 1.0
- */
-gboolean
-clutter_text_get_editable (ClutterText *self)
-{
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), FALSE);
-
- return self->priv->editable;
-}
-
-/**
- * clutter_text_set_selectable:
- * @self: a #ClutterText
- * @selectable: whether the #ClutterText actor should be selectable
- *
- * Sets whether a #ClutterText actor should be selectable.
- *
- * A selectable #ClutterText will allow selecting its contents using
- * the pointer or the keyboard.
- *
- * Since: 1.0
- */
-void
-clutter_text_set_selectable (ClutterText *self,
- gboolean selectable)
-{
- ClutterTextPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TEXT (self));
-
- priv = self->priv;
-
- if (priv->selectable != selectable)
- {
- priv->selectable = selectable;
-
- clutter_text_queue_redraw (CLUTTER_ACTOR (self));
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SELECTABLE]);
- }
-}
-
-/**
- * clutter_text_get_selectable:
- * @self: a #ClutterText
- *
- * Retrieves whether a #ClutterText is selectable or not.
- *
- * Return value: %TRUE if the actor is selectable
- *
- * Since: 1.0
- */
-gboolean
-clutter_text_get_selectable (ClutterText *self)
-{
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), TRUE);
-
- return self->priv->selectable;
-}
-
-/**
- * clutter_text_set_activatable:
- * @self: a #ClutterText
- * @activatable: whether the #ClutterText actor should be activatable
- *
- * Sets whether a #ClutterText actor should be activatable.
- *
- * An activatable #ClutterText actor will emit the #ClutterText::activate
- * signal whenever the 'Enter' (or 'Return') key is pressed; if it is not
- * activatable, a new line will be appended to the current content.
- *
- * An activatable #ClutterText must also be set as editable using
- * clutter_text_set_editable().
- *
- * Since: 1.0
- */
-void
-clutter_text_set_activatable (ClutterText *self,
- gboolean activatable)
-{
- ClutterTextPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TEXT (self));
-
- priv = self->priv;
-
- if (priv->activatable != activatable)
- {
- priv->activatable = activatable;
-
- clutter_text_queue_redraw (CLUTTER_ACTOR (self));
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ACTIVATABLE]);
- }
-}
-
-/**
- * clutter_text_get_activatable:
- * @self: a #ClutterText
- *
- * Retrieves whether a #ClutterText is activatable or not.
- *
- * Return value: %TRUE if the actor is activatable
- *
- * Since: 1.0
- */
-gboolean
-clutter_text_get_activatable (ClutterText *self)
-{
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), TRUE);
-
- return self->priv->activatable;
-}
-
-/**
- * clutter_text_activate:
- * @self: a #ClutterText
- *
- * Emits the #ClutterText::activate signal, if @self has been set
- * as activatable using clutter_text_set_activatable().
- *
- * This function can be used to emit the ::activate signal inside
- * a #ClutterActor::captured-event or #ClutterActor::key-press-event
- * signal handlers before the default signal handler for the
- * #ClutterText is invoked.
- *
- * Return value: %TRUE if the ::activate signal has been emitted,
- * and %FALSE otherwise
- *
- * Since: 1.0
- */
-gboolean
-clutter_text_activate (ClutterText *self)
-{
- ClutterTextPrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), FALSE);
-
- priv = self->priv;
-
- if (priv->activatable)
- {
- g_signal_emit (self, text_signals[ACTIVATE], 0);
- return TRUE;
- }
-
- return FALSE;
-}
-
-/**
- * clutter_text_set_cursor_visible:
- * @self: a #ClutterText
- * @cursor_visible: whether the cursor should be visible
- *
- * Sets whether the cursor of a #ClutterText actor should be
- * visible or not.
- *
- * The color of the cursor will be the same as the text color
- * unless clutter_text_set_cursor_color() has been called.
- *
- * The size of the cursor can be set using clutter_text_set_cursor_size().
- *
- * The position of the cursor can be changed programmatically using
- * clutter_text_set_cursor_position().
- *
- * Since: 1.0
- */
-void
-clutter_text_set_cursor_visible (ClutterText *self,
- gboolean cursor_visible)
-{
- ClutterTextPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TEXT (self));
-
- priv = self->priv;
-
- cursor_visible = !!cursor_visible;
-
- if (priv->cursor_visible != cursor_visible)
- {
- priv->cursor_visible = cursor_visible;
-
- clutter_text_queue_redraw_or_relayout (self);
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_CURSOR_VISIBLE]);
- }
-}
-
-/**
- * clutter_text_get_cursor_visible:
- * @self: a #ClutterText
- *
- * Retrieves whether the cursor of a #ClutterText actor is visible.
- *
- * Return value: %TRUE if the cursor is visible
- *
- * Since: 1.0
- */
-gboolean
-clutter_text_get_cursor_visible (ClutterText *self)
-{
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), TRUE);
-
- return self->priv->cursor_visible;
-}
-
-/**
- * clutter_text_set_cursor_color:
- * @self: a #ClutterText
- * @color: (allow-none): the color of the cursor, or %NULL to unset it
- *
- * Sets the color of the cursor of a #ClutterText actor.
- *
- * If @color is %NULL, the cursor color will be the same as the
- * text color.
- *
- * Since: 1.0
- */
-void
-clutter_text_set_cursor_color (ClutterText *self,
- const ClutterColor *color)
-{
- g_return_if_fail (CLUTTER_IS_TEXT (self));
-
- clutter_text_set_color_animated (self, obj_props[PROP_CURSOR_COLOR], color);
-}
-
-/**
- * clutter_text_get_cursor_color:
- * @self: a #ClutterText
- * @color: (out): return location for a #ClutterColor
- *
- * Retrieves the color of the cursor of a #ClutterText actor.
- *
- * Since: 1.0
- */
-void
-clutter_text_get_cursor_color (ClutterText *self,
- ClutterColor *color)
-{
- ClutterTextPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TEXT (self));
- g_return_if_fail (color != NULL);
-
- priv = self->priv;
-
- *color = priv->cursor_color;
-}
-
-/**
- * clutter_text_set_selection:
- * @self: a #ClutterText
- * @start_pos: start of the selection, in characters
- * @end_pos: end of the selection, in characters
- *
- * Selects the region of text between @start_pos and @end_pos.
- *
- * This function changes the position of the cursor to match
- * @start_pos and the selection bound to match @end_pos.
- *
- * Since: 1.0
- */
-void
-clutter_text_set_selection (ClutterText *self,
- gssize start_pos,
- gssize end_pos)
-{
- guint n_chars;
-
- g_return_if_fail (CLUTTER_IS_TEXT (self));
-
- n_chars = clutter_text_buffer_get_length (get_buffer (self));
- if (end_pos < 0)
- end_pos = n_chars;
-
- start_pos = MIN (n_chars, start_pos);
- end_pos = MIN (n_chars, end_pos);
-
- clutter_text_set_positions (self, start_pos, end_pos);
-}
-
-/**
- * clutter_text_get_selection:
- * @self: a #ClutterText
- *
- * Retrieves the currently selected text.
- *
- * Return value: a newly allocated string containing the currently
- * selected text, or %NULL. Use g_free() to free the returned
- * string.
- *
- * Since: 1.0
- */
-gchar *
-clutter_text_get_selection (ClutterText *self)
-{
- ClutterTextPrivate *priv;
- gchar *str;
- gint len;
- gint start_index, end_index;
- gint start_offset, end_offset;
- const gchar *text;
-
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), NULL);
-
- priv = self->priv;
-
- start_index = priv->position;
- end_index = priv->selection_bound;
-
- if (end_index == start_index)
- return g_strdup ("");
-
- if ((end_index != -1 && end_index < start_index) ||
- start_index == -1)
- {
- gint temp = start_index;
- start_index = end_index;
- end_index = temp;
- }
-
- text = clutter_text_buffer_get_text (get_buffer (self));
- start_offset = offset_to_bytes (text, start_index);
- end_offset = offset_to_bytes (text, end_index);
- len = end_offset - start_offset;
-
- str = g_malloc (len + 1);
- g_utf8_strncpy (str, text + start_offset, end_index - start_index);
-
- return str;
-}
-
-/**
- * clutter_text_set_selection_bound:
- * @self: a #ClutterText
- * @selection_bound: the position of the end of the selection, in characters
- *
- * Sets the other end of the selection, starting from the current
- * cursor position.
- *
- * If @selection_bound is -1, the selection unset.
- *
- * Since: 1.0
- */
-void
-clutter_text_set_selection_bound (ClutterText *self,
- gint selection_bound)
-{
- ClutterTextPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TEXT (self));
-
- priv = self->priv;
-
- if (priv->selection_bound != selection_bound)
- {
- gint len = clutter_text_buffer_get_length (get_buffer (self));
-
- if (selection_bound < 0 || selection_bound >= len)
- priv->selection_bound = -1;
- else
- priv->selection_bound = selection_bound;
-
- clutter_text_queue_redraw (CLUTTER_ACTOR (self));
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SELECTION_BOUND]);
- }
-}
-
-/**
- * clutter_text_get_selection_bound:
- * @self: a #ClutterText
- *
- * Retrieves the other end of the selection of a #ClutterText actor,
- * in characters from the current cursor position.
- *
- * Return value: the position of the other end of the selection
- *
- * Since: 1.0
- */
-gint
-clutter_text_get_selection_bound (ClutterText *self)
-{
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), -1);
-
- return self->priv->selection_bound;
-}
-
-/**
- * clutter_text_set_selection_color:
- * @self: a #ClutterText
- * @color: (allow-none): the color of the selection, or %NULL to unset it
- *
- * Sets the color of the selection of a #ClutterText actor.
- *
- * If @color is %NULL, the selection color will be the same as the
- * cursor color, or if no cursor color is set either then it will be
- * the same as the text color.
- *
- * Since: 1.0
- */
-void
-clutter_text_set_selection_color (ClutterText *self,
- const ClutterColor *color)
-{
- g_return_if_fail (CLUTTER_IS_TEXT (self));
-
- clutter_text_set_color_animated (self, obj_props[PROP_SELECTION_COLOR],
- color);
-}
-
-/**
- * clutter_text_get_selection_color:
- * @self: a #ClutterText
- * @color: (out caller-allocates): return location for a #ClutterColor
- *
- * Retrieves the color of the selection of a #ClutterText actor.
- *
- * Since: 1.0
- */
-void
-clutter_text_get_selection_color (ClutterText *self,
- ClutterColor *color)
-{
- ClutterTextPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TEXT (self));
- g_return_if_fail (color != NULL);
-
- priv = self->priv;
-
- *color = priv->selection_color;
-}
-
-/**
- * clutter_text_set_selected_text_color:
- * @self: a #ClutterText
- * @color: (allow-none): the selected text color, or %NULL to unset it
- *
- * Sets the selected text color of a #ClutterText actor.
- *
- * If @color is %NULL, the selected text color will be the same as the
- * selection color, which then falls back to cursor, and then text color.
- *
- * Since: 1.8
- */
-void
-clutter_text_set_selected_text_color (ClutterText *self,
- const ClutterColor *color)
-{
- g_return_if_fail (CLUTTER_IS_TEXT (self));
-
- clutter_text_set_color_animated (self, obj_props[PROP_SELECTED_TEXT_COLOR],
- color);
-}
-
-/**
- * clutter_text_get_selected_text_color:
- * @self: a #ClutterText
- * @color: (out caller-allocates): return location for a #ClutterColor
- *
- * Retrieves the color of selected text of a #ClutterText actor.
- *
- * Since: 1.8
- */
-void
-clutter_text_get_selected_text_color (ClutterText *self,
- ClutterColor *color)
-{
- ClutterTextPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TEXT (self));
- g_return_if_fail (color != NULL);
-
- priv = self->priv;
-
- *color = priv->selected_text_color;
-}
-
-/**
- * clutter_text_set_font_description:
- * @self: a #ClutterText
- * @font_desc: a #PangoFontDescription
- *
- * Sets @font_desc as the font description for a #ClutterText
- *
- * The #PangoFontDescription is copied by the #ClutterText actor
- * so you can safely call pango_font_description_free() on it after
- * calling this function.
- *
- * Since: 1.2
- */
-void
-clutter_text_set_font_description (ClutterText *self,
- PangoFontDescription *font_desc)
-{
- g_return_if_fail (CLUTTER_IS_TEXT (self));
-
- clutter_text_set_font_description_internal (self, font_desc,
- font_desc == NULL);
-}
-
-/**
- * clutter_text_get_font_description:
- * @self: a #ClutterText
- *
- * Retrieves the #PangoFontDescription used by @self
- *
- * Return value: a #PangoFontDescription. The returned value is owned
- * by the #ClutterText actor and it should not be modified or freed
- *
- * Since: 1.2
- */
-PangoFontDescription *
-clutter_text_get_font_description (ClutterText *self)
-{
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), NULL);
-
- return self->priv->font_desc;
-}
-
-/**
- * clutter_text_get_font_name:
- * @self: a #ClutterText
- *
- * Retrieves the font name as set by clutter_text_set_font_name().
- *
- * Return value: a string containing the font name. The returned
- * string is owned by the #ClutterText actor and should not be
- * modified or freed
- *
- * Since: 1.0
- */
-const gchar *
-clutter_text_get_font_name (ClutterText *text)
-{
- g_return_val_if_fail (CLUTTER_IS_TEXT (text), NULL);
-
- return text->priv->font_name;
-}
-
-/**
- * clutter_text_set_font_name:
- * @self: a #ClutterText
- * @font_name: (allow-none): a font name, or %NULL to set the default font name
- *
- * Sets the font used by a #ClutterText. The @font_name string
- * must either be %NULL, which means that the font name from the
- * default #ClutterBackend will be used; or be something that can
- * be parsed by the pango_font_description_from_string() function,
- * like:
- *
- * |[
- * // Set the font to the system's Sans, 10 points
- * clutter_text_set_font_name (text, "Sans 10");
- *
- * // Set the font to the system's Serif, 16 pixels
- * clutter_text_set_font_name (text, "Serif 16px");
- *
- * // Set the font to Helvetica, 10 points
- * clutter_text_set_font_name (text, "Helvetica 10");
- * ]|
- *
- * Since: 1.0
- */
-void
-clutter_text_set_font_name (ClutterText *self,
- const gchar *font_name)
-{
- ClutterTextPrivate *priv;
- PangoFontDescription *desc;
- gboolean is_default_font;
-
- g_return_if_fail (CLUTTER_IS_TEXT (self));
-
- /* get the default font name from the backend */
- if (font_name == NULL || font_name[0] == '\0')
- {
- ClutterSettings *settings = clutter_settings_get_default ();
- gchar *default_font_name = NULL;
-
- g_object_get (settings, "font-name", &default_font_name, NULL);
-
- if (default_font_name != NULL)
- font_name = default_font_name;
- else
- {
- /* last fallback */
- font_name = g_strdup ("Sans 12");
- }
-
- is_default_font = TRUE;
- }
- else
- is_default_font = FALSE;
-
- priv = self->priv;
-
- if (g_strcmp0 (priv->font_name, font_name) == 0)
- goto out;
-
- desc = pango_font_description_from_string (font_name);
- if (desc == NULL)
- {
- g_warning ("Attempting to create a PangoFontDescription for "
- "font name '%s', but failed.",
- font_name);
- goto out;
- }
-
- /* this will set the font_name field as well */
- clutter_text_set_font_description_internal (self, desc, is_default_font);
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_FONT_NAME]);
-
- pango_font_description_free (desc);
-
-out:
- if (is_default_font)
- g_free ((gchar *) font_name);
-}
-
-/**
- * clutter_text_get_text:
- * @self: a #ClutterText
- *
- * Retrieves a pointer to the current contents of a #ClutterText
- * actor.
- *
- * If you need a copy of the contents for manipulating, either
- * use g_strdup() on the returned string, or use:
- *
- * |[
- * copy = clutter_text_get_chars (text, 0, -1);
- * ]|
- *
- * Which will return a newly allocated string.
- *
- * If the #ClutterText actor is empty, this function will return
- * an empty string, and not %NULL.
- *
- * Return value: (transfer none): the contents of the actor. The returned
- * string is owned by the #ClutterText actor and should never be modified
- * or freed
- *
- * Since: 1.0
- */
-const gchar *
-clutter_text_get_text (ClutterText *self)
-{
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), NULL);
-
- return clutter_text_buffer_get_text (get_buffer (self));
-}
-
-static inline void
-clutter_text_set_use_markup_internal (ClutterText *self,
- gboolean use_markup)
-{
- ClutterTextPrivate *priv = self->priv;
-
- if (priv->use_markup != use_markup)
- {
- priv->use_markup = use_markup;
-
- /* reset the attributes lists so that they can be
- * re-generated
- */
- if (priv->effective_attrs != NULL)
- {
- pango_attr_list_unref (priv->effective_attrs);
- priv->effective_attrs = NULL;
- }
-
- if (priv->markup_attrs)
- {
- pango_attr_list_unref (priv->markup_attrs);
- priv->markup_attrs = NULL;
- }
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_USE_MARKUP]);
- }
-}
-
-/**
- * clutter_text_set_text:
- * @self: a #ClutterText
- * @text: (allow-none): the text to set. Passing %NULL is the same
- * as passing "" (the empty string)
- *
- * Sets the contents of a #ClutterText actor.
- *
- * If the #ClutterText:use-markup property was set to %TRUE it
- * will be reset to %FALSE as a side effect. If you want to
- * maintain the #ClutterText:use-markup you should use the
- * clutter_text_set_markup() function instead
- *
- * Since: 1.0
- */
-void
-clutter_text_set_text (ClutterText *self,
- const gchar *text)
-{
- g_return_if_fail (CLUTTER_IS_TEXT (self));
-
- /* if the text is editable (i.e. there is not markup flag to reset) then
- * changing the contents will result in selection and cursor changes that
- * we should avoid
- */
- if (self->priv->editable)
- {
- if (g_strcmp0 (clutter_text_buffer_get_text (get_buffer (self)), text) == 0)
- return;
- }
-
- clutter_text_set_use_markup_internal (self, FALSE);
- clutter_text_buffer_set_text (get_buffer (self), text ? text : "", -1);
-}
-
-/**
- * clutter_text_set_markup:
- * @self: a #ClutterText
- * @markup: (allow-none): a string containing Pango markup.
- * Passing %NULL is the same as passing "" (the empty string)
- *
- * Sets @markup as the contents of a #ClutterText.
- *
- * This is a convenience function for setting a string containing
- * Pango markup, and it is logically equivalent to:
- *
- * |[
- * /&ast; the order is important &ast;/
- * clutter_text_set_text (CLUTTER_TEXT (actor), markup);
- * clutter_text_set_use_markup (CLUTTER_TEXT (actor), TRUE);
- * ]|
- *
- * Since: 1.0
- */
-void
-clutter_text_set_markup (ClutterText *self,
- const gchar *markup)
-{
- g_return_if_fail (CLUTTER_IS_TEXT (self));
-
- clutter_text_set_use_markup_internal (self, TRUE);
- if (markup != NULL && *markup != '\0')
- clutter_text_set_markup_internal (self, markup);
- else
- clutter_text_buffer_set_text (get_buffer (self), "", 0);
-}
-
-/**
- * clutter_text_get_layout:
- * @self: a #ClutterText
- *
- * Retrieves the current #PangoLayout used by a #ClutterText actor.
- *
- * Return value: (transfer none): a #PangoLayout. The returned object is owned by
- * the #ClutterText actor and should not be modified or freed
- *
- * Since: 1.0
- */
-PangoLayout *
-clutter_text_get_layout (ClutterText *self)
-{
- PangoLayout *layout;
- gfloat width, height;
-
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), NULL);
-
- if (self->priv->editable && self->priv->single_line_mode)
- return clutter_text_create_layout (self, -1, -1);
-
- clutter_actor_get_size (CLUTTER_ACTOR (self), &width, &height);
- layout = maybe_create_text_layout_with_resource_scale (self, width, height);
-
- if (!layout)
- layout = clutter_text_create_layout (self, width, height);
-
- return layout;
-}
-
-/**
- * clutter_text_set_color:
- * @self: a #ClutterText
- * @color: a #ClutterColor
- *
- * Sets the color of the contents of a #ClutterText actor.
- *
- * The overall opacity of the #ClutterText actor will be the
- * result of the alpha value of @color and the composited
- * opacity of the actor itself on the scenegraph, as returned
- * by clutter_actor_get_paint_opacity().
- *
- * Since: 1.0
- */
-void
-clutter_text_set_color (ClutterText *self,
- const ClutterColor *color)
-{
- g_return_if_fail (CLUTTER_IS_TEXT (self));
- g_return_if_fail (color != NULL);
-
- clutter_text_set_color_animated (self, obj_props[PROP_COLOR], color);
-}
-
-/**
- * clutter_text_get_color:
- * @self: a #ClutterText
- * @color: (out caller-allocates): return location for a #ClutterColor
- *
- * Retrieves the text color as set by clutter_text_set_color().
- *
- * Since: 1.0
- */
-void
-clutter_text_get_color (ClutterText *self,
- ClutterColor *color)
-{
- ClutterTextPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TEXT (self));
- g_return_if_fail (color != NULL);
-
- priv = self->priv;
-
- *color = priv->text_color;
-}
-
-/**
- * clutter_text_set_ellipsize:
- * @self: a #ClutterText
- * @mode: a #PangoEllipsizeMode
- *
- * Sets the mode used to ellipsize (add an ellipsis: "...") to the
- * text if there is not enough space to render the entire contents
- * of a #ClutterText actor
- *
- * Since: 1.0
- */
-void
-clutter_text_set_ellipsize (ClutterText *self,
- PangoEllipsizeMode mode)
-{
- ClutterTextPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TEXT (self));
- g_return_if_fail (mode >= PANGO_ELLIPSIZE_NONE &&
- mode <= PANGO_ELLIPSIZE_END);
-
- priv = self->priv;
-
- if ((PangoEllipsizeMode) priv->ellipsize != mode)
- {
- priv->ellipsize = mode;
-
- clutter_text_dirty_cache (self);
-
- clutter_actor_queue_relayout (CLUTTER_ACTOR (self));
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ELLIPSIZE]);
- }
-}
-
-/**
- * clutter_text_get_ellipsize:
- * @self: a #ClutterText
- *
- * Returns the ellipsizing position of a #ClutterText actor, as
- * set by clutter_text_set_ellipsize().
- *
- * Return value: #PangoEllipsizeMode
- *
- * Since: 1.0
- */
-PangoEllipsizeMode
-clutter_text_get_ellipsize (ClutterText *self)
-{
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), PANGO_ELLIPSIZE_NONE);
-
- return self->priv->ellipsize;
-}
-
-/**
- * clutter_text_get_line_wrap:
- * @self: a #ClutterText
- *
- * Retrieves the value set using clutter_text_set_line_wrap().
- *
- * Return value: %TRUE if the #ClutterText actor should wrap
- * its contents
- *
- * Since: 1.0
- */
-gboolean
-clutter_text_get_line_wrap (ClutterText *self)
-{
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), FALSE);
-
- return self->priv->wrap;
-}
-
-/**
- * clutter_text_set_line_wrap:
- * @self: a #ClutterText
- * @line_wrap: whether the contents should wrap
- *
- * Sets whether the contents of a #ClutterText actor should wrap,
- * if they don't fit the size assigned to the actor.
- *
- * Since: 1.0
- */
-void
-clutter_text_set_line_wrap (ClutterText *self,
- gboolean line_wrap)
-{
- ClutterTextPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TEXT (self));
-
- priv = self->priv;
-
- if (priv->wrap != line_wrap)
- {
- priv->wrap = line_wrap;
-
- clutter_text_dirty_cache (self);
-
- clutter_actor_queue_relayout (CLUTTER_ACTOR (self));
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_LINE_WRAP]);
- }
-}
-
-/**
- * clutter_text_set_line_wrap_mode:
- * @self: a #ClutterText
- * @wrap_mode: the line wrapping mode
- *
- * If line wrapping is enabled (see clutter_text_set_line_wrap()) this
- * function controls how the line wrapping is performed. The default is
- * %PANGO_WRAP_WORD which means wrap on word boundaries.
- *
- * Since: 1.0
- */
-void
-clutter_text_set_line_wrap_mode (ClutterText *self,
- PangoWrapMode wrap_mode)
-{
- ClutterTextPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TEXT (self));
-
- priv = self->priv;
-
- if (priv->wrap_mode != wrap_mode)
- {
- priv->wrap_mode = wrap_mode;
-
- clutter_text_dirty_cache (self);
-
- clutter_actor_queue_relayout (CLUTTER_ACTOR (self));
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_LINE_WRAP_MODE]);
- }
-}
-
-/**
- * clutter_text_get_line_wrap_mode:
- * @self: a #ClutterText
- *
- * Retrieves the line wrap mode used by the #ClutterText actor.
- *
- * See clutter_text_set_line_wrap_mode ().
- *
- * Return value: the wrap mode used by the #ClutterText
- *
- * Since: 1.0
- */
-PangoWrapMode
-clutter_text_get_line_wrap_mode (ClutterText *self)
-{
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), PANGO_WRAP_WORD);
-
- return self->priv->wrap_mode;
-}
-
-/**
- * clutter_text_set_attributes:
- * @self: a #ClutterText
- * @attrs: (allow-none): a #PangoAttrList or %NULL to unset the attributes
- *
- * Sets the attributes list that are going to be applied to the
- * #ClutterText contents.
- *
- * The #ClutterText actor will take a reference on the #PangoAttrList
- * passed to this function.
- *
- * Since: 1.0
- */
-void
-clutter_text_set_attributes (ClutterText *self,
- PangoAttrList *attrs)
-{
- ClutterTextPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TEXT (self));
-
- priv = self->priv;
-
- if (pango_attr_list_equal (priv->attrs, attrs))
- return;
-
- if (attrs)
- pango_attr_list_ref (attrs);
-
- if (priv->attrs)
- pango_attr_list_unref (priv->attrs);
-
- priv->attrs = attrs;
-
- /* Clear the effective attributes so they will be regenerated when a
- layout is created */
- if (priv->effective_attrs)
- {
- pango_attr_list_unref (priv->effective_attrs);
- priv->effective_attrs = NULL;
- }
-
- clutter_text_queue_redraw_or_relayout (self);
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ATTRIBUTES]);
-}
-
-/**
- * clutter_text_get_attributes:
- * @self: a #ClutterText
- *
- * Gets the attribute list that was set on the #ClutterText actor
- * clutter_text_set_attributes(), if any.
- *
- * Return value: (transfer none): the attribute list, or %NULL if none was set. The
- * returned value is owned by the #ClutterText and should not be unreferenced.
- *
- * Since: 1.0
- */
-PangoAttrList *
-clutter_text_get_attributes (ClutterText *self)
-{
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), NULL);
-
- return self->priv->attrs;
-}
-
-/**
- * clutter_text_set_line_alignment:
- * @self: a #ClutterText
- * @alignment: A #PangoAlignment
- *
- * Sets the way that the lines of a wrapped label are aligned with
- * respect to each other. This does not affect the overall alignment
- * of the label within its allocated or specified width.
- *
- * To align a #ClutterText actor you should add it to a container
- * that supports alignment, or use the anchor point.
- *
- * Since: 1.0
- */
-void
-clutter_text_set_line_alignment (ClutterText *self,
- PangoAlignment alignment)
-{
- ClutterTextPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TEXT (self));
-
- priv = self->priv;
-
- if (priv->alignment != alignment)
- {
- priv->alignment = alignment;
-
- clutter_text_queue_redraw_or_relayout (self);
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_LINE_ALIGNMENT]);
- }
-}
-
-/**
- * clutter_text_get_line_alignment:
- * @self: a #ClutterText
- *
- * Retrieves the alignment of a #ClutterText, as set by
- * clutter_text_set_line_alignment().
- *
- * Return value: a #PangoAlignment
- *
- * Since: 1.0
- */
-PangoAlignment
-clutter_text_get_line_alignment (ClutterText *self)
-{
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), PANGO_ALIGN_LEFT);
-
- return self->priv->alignment;
-}
-
-/**
- * clutter_text_set_use_markup:
- * @self: a #ClutterText
- * @setting: %TRUE if the text should be parsed for markup.
- *
- * Sets whether the contents of the #ClutterText actor contains markup
- * in <link linkend="PangoMarkupFormat">Pango's text markup language</link>.
- *
- * Setting #ClutterText:use-markup on an editable #ClutterText will
- * not have any effect except hiding the markup.
- *
- * See also #ClutterText:use-markup.
- *
- * Since: 1.0
- */
-void
-clutter_text_set_use_markup (ClutterText *self,
- gboolean setting)
-{
- const gchar *text;
-
- g_return_if_fail (CLUTTER_IS_TEXT (self));
-
- text = clutter_text_buffer_get_text (get_buffer (self));
-
- clutter_text_set_use_markup_internal (self, setting);
-
- if (setting)
- clutter_text_set_markup_internal (self, text);
-
- clutter_text_queue_redraw_or_relayout (self);
-}
-
-/**
- * clutter_text_get_use_markup:
- * @self: a #ClutterText
- *
- * Retrieves whether the contents of the #ClutterText actor should be
- * parsed for the Pango text markup.
- *
- * Return value: %TRUE if the contents will be parsed for markup
- *
- * Since: 1.0
- */
-gboolean
-clutter_text_get_use_markup (ClutterText *self)
-{
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), FALSE);
-
- return self->priv->use_markup;
-}
-
-/**
- * clutter_text_set_justify:
- * @self: a #ClutterText
- * @justify: whether the text should be justified
- *
- * Sets whether the text of the #ClutterText actor should be justified
- * on both margins. This setting is ignored if Clutter is compiled
- * against Pango &lt; 1.18.
- *
- * Since: 1.0
- */
-void
-clutter_text_set_justify (ClutterText *self,
- gboolean justify)
-{
- ClutterTextPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TEXT (self));
-
- priv = self->priv;
-
- if (priv->justify != justify)
- {
- priv->justify = justify;
-
- clutter_text_queue_redraw_or_relayout (self);
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_JUSTIFY]);
- }
-}
-
-/**
- * clutter_text_get_justify:
- * @self: a #ClutterText
- *
- * Retrieves whether the #ClutterText actor should justify its contents
- * on both margins.
- *
- * Return value: %TRUE if the text should be justified
- *
- * Since: 0.6
- */
-gboolean
-clutter_text_get_justify (ClutterText *self)
-{
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), FALSE);
-
- return self->priv->justify;
-}
-
-/**
- * clutter_text_get_cursor_position:
- * @self: a #ClutterText
- *
- * Retrieves the cursor position.
- *
- * Return value: the cursor position, in characters
- *
- * Since: 1.0
- */
-gint
-clutter_text_get_cursor_position (ClutterText *self)
-{
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), -1);
-
- return self->priv->position;
-}
-
-/**
- * clutter_text_set_cursor_position:
- * @self: a #ClutterText
- * @position: the new cursor position, in characters
- *
- * Sets the cursor of a #ClutterText actor at @position.
- *
- * The position is expressed in characters, not in bytes.
- *
- * Since: 1.0
- */
-void
-clutter_text_set_cursor_position (ClutterText *self,
- gint position)
-{
- ClutterTextPrivate *priv;
- gint len;
-
- g_return_if_fail (CLUTTER_IS_TEXT (self));
-
- priv = self->priv;
-
- if (priv->position == position)
- return;
-
- len = clutter_text_buffer_get_length (get_buffer (self));
-
- if (position < 0 || position >= len)
- priv->position = -1;
- else
- priv->position = position;
-
- /* Forget the target x position so that it will be recalculated next
- time the cursor is moved up or down */
- priv->x_pos = -1;
-
- clutter_text_queue_redraw (CLUTTER_ACTOR (self));
-
- /* XXX:2.0 - remove */
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_POSITION]);
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_CURSOR_POSITION]);
- g_signal_emit (self, text_signals[CURSOR_CHANGED], 0);
-}
-
-/**
- * clutter_text_set_cursor_size:
- * @self: a #ClutterText
- * @size: the size of the cursor, in pixels, or -1 to use the
- * default value
- *
- * Sets the size of the cursor of a #ClutterText. The cursor
- * will only be visible if the #ClutterText:cursor-visible property
- * is set to %TRUE.
- *
- * Since: 1.0
- */
-void
-clutter_text_set_cursor_size (ClutterText *self,
- gint size)
-{
- ClutterTextPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TEXT (self));
-
- priv = self->priv;
-
- if (priv->cursor_size != size)
- {
- if (size < 0)
- size = DEFAULT_CURSOR_SIZE;
-
- priv->cursor_size = size;
-
- clutter_text_queue_redraw (CLUTTER_ACTOR (self));
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_CURSOR_SIZE]);
- }
-}
-
-/**
- * clutter_text_get_cursor_size:
- * @self: a #ClutterText
- *
- * Retrieves the size of the cursor of a #ClutterText actor.
- *
- * Return value: the size of the cursor, in pixels
- *
- * Since: 1.0
- */
-guint
-clutter_text_get_cursor_size (ClutterText *self)
-{
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), DEFAULT_CURSOR_SIZE);
-
- return self->priv->cursor_size;
-}
-
-/**
- * clutter_text_set_password_char:
- * @self: a #ClutterText
- * @wc: a Unicode character, or 0 to unset the password character
- *
- * Sets the character to use in place of the actual text in a
- * password text actor.
- *
- * If @wc is 0 the text will be displayed as it is entered in the
- * #ClutterText actor.
- *
- * Since: 1.0
- */
-void
-clutter_text_set_password_char (ClutterText *self,
- gunichar wc)
-{
- ClutterTextPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TEXT (self));
-
- priv = self->priv;
-
- if (priv->password_char != wc)
- {
- priv->password_char = wc;
-
- clutter_text_dirty_cache (self);
- clutter_actor_queue_relayout (CLUTTER_ACTOR (self));
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_PASSWORD_CHAR]);
- }
-}
-
-/**
- * clutter_text_get_password_char:
- * @self: a #ClutterText
- *
- * Retrieves the character to use in place of the actual text
- * as set by clutter_text_set_password_char().
- *
- * Return value: a Unicode character or 0 if the password
- * character is not set
- *
- * Since: 1.0
- */
-gunichar
-clutter_text_get_password_char (ClutterText *self)
-{
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), 0);
-
- return self->priv->password_char;
-}
-
-/**
- * clutter_text_set_max_length:
- * @self: a #ClutterText
- * @max: the maximum number of characters allowed in the text actor; 0
- * to disable or -1 to set the length of the current string
- *
- * Sets the maximum allowed length of the contents of the actor. If the
- * current contents are longer than the given length, then they will be
- * truncated to fit.
- *
- * Since: 1.0
- */
-void
-clutter_text_set_max_length (ClutterText *self,
- gint max)
-{
- g_return_if_fail (CLUTTER_IS_TEXT (self));
- clutter_text_buffer_set_max_length (get_buffer (self), max);
-}
-
-/**
- * clutter_text_get_max_length:
- * @self: a #ClutterText
- *
- * Gets the maximum length of text that can be set into a text actor.
- *
- * See clutter_text_set_max_length().
- *
- * Return value: the maximum number of characters.
- *
- * Since: 1.0
- */
-gint
-clutter_text_get_max_length (ClutterText *self)
-{
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), 0);
-
- return clutter_text_buffer_get_max_length (get_buffer (self));
-}
-
-static void
-clutter_text_real_insert_text (ClutterText *self,
- guint start_pos,
- const gchar *chars,
- guint n_chars)
-{
- gsize n_bytes;
-
- n_bytes = g_utf8_offset_to_pointer (chars, n_chars) - chars;
-
- /*
- * insert-text is emitted here instead of as part of a
- * buffer_inserted_text() callback because that should be emitted
- * before the buffer changes, while ClutterTextBuffer::deleted-text
- * is emitter after. See BG#722220 for more info.
- */
- g_signal_emit (self, text_signals[INSERT_TEXT], 0, chars,
- n_bytes, &start_pos);
-
- /*
- * The actual insertion from the buffer. This will end firing the
- * following signal handlers: buffer_inserted_text(),
- * buffer_notify_text(), buffer_notify_max_length()
- */
- clutter_text_buffer_insert_text (get_buffer (self), start_pos, chars, n_chars);
-}
-
-/**
- * clutter_text_insert_unichar:
- * @self: a #ClutterText
- * @wc: a Unicode character
- *
- * Inserts @wc at the current cursor position of a
- * #ClutterText actor.
- *
- * Since: 1.0
- */
-void
-clutter_text_insert_unichar (ClutterText *self,
- gunichar wc)
-{
- ClutterTextPrivate *priv;
- GString *new;
-
- priv = self->priv;
-
- new = g_string_new ("");
- g_string_append_unichar (new, wc);
-
- clutter_text_real_insert_text (self, priv->position, new->str, 1);
-
- g_string_free (new, TRUE);
-}
-
-
-/**
- * clutter_text_insert_text:
- * @self: a #ClutterText
- * @text: the text to be inserted
- * @position: the position of the insertion, or -1
- *
- * Inserts @text into a #ClutterActor at the given position.
- *
- * If @position is a negative number, the text will be appended
- * at the end of the current contents of the #ClutterText.
- *
- * The position is expressed in characters, not in bytes.
- *
- * Since: 1.0
- */
-void
-clutter_text_insert_text (ClutterText *self,
- const gchar *text,
- gssize position)
-{
- g_return_if_fail (CLUTTER_IS_TEXT (self));
- g_return_if_fail (text != NULL);
-
- clutter_text_real_insert_text (self, position, text, g_utf8_strlen (text, -1));
-}
-
-static
-void clutter_text_real_delete_text (ClutterText *self,
- gssize start_pos,
- gssize end_pos)
-{
- /*
- * delete-text is emitted here instead of as part of a
- * buffer_deleted_text() callback because that should be emitted
- * before the buffer changes, while ClutterTextBuffer::deleted-text
- * is emitter after. See BG#722220 for more info.
- */
- g_signal_emit (self, text_signals[DELETE_TEXT], 0, start_pos, end_pos);
-
- /*
- * The actual deletion from the buffer. This will end firing the
- * following signal handlers: buffer_deleted_text(),
- * buffer_notify_text(), buffer_notify_max_length()
- */
- clutter_text_buffer_delete_text (get_buffer (self), start_pos, end_pos - start_pos);
-}
-
-
-
-/**
- * clutter_text_delete_text:
- * @self: a #ClutterText
- * @start_pos: starting position
- * @end_pos: ending position
- *
- * Deletes the text inside a #ClutterText actor between @start_pos
- * and @end_pos.
- *
- * The starting and ending positions are expressed in characters,
- * not in bytes.
- *
- * Since: 1.0
- */
-void
-clutter_text_delete_text (ClutterText *self,
- gssize start_pos,
- gssize end_pos)
-{
- g_return_if_fail (CLUTTER_IS_TEXT (self));
-
- clutter_text_real_delete_text (self, start_pos, end_pos);
-}
-
-/**
- * clutter_text_delete_chars:
- * @self: a #ClutterText
- * @n_chars: the number of characters to delete
- *
- * Deletes @n_chars inside a #ClutterText actor, starting from the
- * current cursor position.
- *
- * Somewhat awkwardly, the cursor position is decremented by the same
- * number of characters you've deleted.
- *
- * Since: 1.0
- */
-void
-clutter_text_delete_chars (ClutterText *self,
- guint n_chars)
-{
- ClutterTextPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TEXT (self));
-
- priv = self->priv;
-
- clutter_text_real_delete_text (self, priv->position, priv->position + n_chars);
-
- if (priv->position > 0)
- clutter_text_set_cursor_position (self, priv->position - n_chars);
-}
-
-/**
- * clutter_text_get_chars:
- * @self: a #ClutterText
- * @start_pos: start of text, in characters
- * @end_pos: end of text, in characters
- *
- * Retrieves the contents of the #ClutterText actor between
- * @start_pos and @end_pos, but not including @end_pos.
- *
- * The positions are specified in characters, not in bytes.
- *
- * Return value: a newly allocated string with the contents of
- * the text actor between the specified positions. Use g_free()
- * to free the resources when done
- *
- * Since: 1.0
- */
-gchar *
-clutter_text_get_chars (ClutterText *self,
- gssize start_pos,
- gssize end_pos)
-{
- gint start_index, end_index;
- guint n_chars;
- const gchar *text;
-
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), NULL);
-
- n_chars = clutter_text_buffer_get_length (get_buffer (self));
- text = clutter_text_buffer_get_text (get_buffer (self));
-
- if (end_pos < 0)
- end_pos = n_chars;
-
- start_pos = MIN (n_chars, start_pos);
- end_pos = MIN (n_chars, end_pos);
-
- start_index = g_utf8_offset_to_pointer (text, start_pos) - text;
- end_index = g_utf8_offset_to_pointer (text, end_pos) - text;
-
- return g_strndup (text + start_index, end_index - start_index);
-}
-
-/**
- * clutter_text_set_single_line_mode:
- * @self: a #ClutterText
- * @single_line: whether to enable single line mode
- *
- * Sets whether a #ClutterText actor should be in single line mode
- * or not. Only editable #ClutterText<!-- -->s can be in single line
- * mode.
- *
- * A text actor in single line mode will not wrap text and will clip
- * the visible area to the predefined size. The contents of the
- * text actor will scroll to display the end of the text if its length
- * is bigger than the allocated width.
- *
- * When setting the single line mode the #ClutterText:activatable
- * property is also set as a side effect. Instead of entering a new
- * line character, the text actor will emit the #ClutterText::activate
- * signal.
- *
- * Since: 1.0
- */
-void
-clutter_text_set_single_line_mode (ClutterText *self,
- gboolean single_line)
-{
- ClutterTextPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TEXT (self));
-
- priv = self->priv;
-
- if (priv->single_line_mode != single_line)
- {
- g_object_freeze_notify (G_OBJECT (self));
-
- priv->single_line_mode = single_line;
-
- if (priv->single_line_mode)
- {
- priv->activatable = TRUE;
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ACTIVATABLE]);
- }
-
- clutter_text_dirty_cache (self);
- clutter_actor_queue_relayout (CLUTTER_ACTOR (self));
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SINGLE_LINE_MODE]);
-
- g_object_thaw_notify (G_OBJECT (self));
- }
-}
-
-/**
- * clutter_text_get_single_line_mode:
- * @self: a #ClutterText
- *
- * Retrieves whether the #ClutterText actor is in single line mode.
- *
- * Return value: %TRUE if the #ClutterText actor is in single line mode
- *
- * Since: 1.0
- */
-gboolean
-clutter_text_get_single_line_mode (ClutterText *self)
-{
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), FALSE);
-
- return self->priv->single_line_mode;
-}
-
-/**
- * clutter_text_set_preedit_string:
- * @self: a #ClutterText
- * @preedit_str: (allow-none): the pre-edit string, or %NULL to unset it
- * @preedit_attrs: (allow-none): the pre-edit string attributes
- * @cursor_pos: the cursor position for the pre-edit string
- *
- * Sets, or unsets, the pre-edit string. This function is useful
- * for input methods to display a string (with eventual specific
- * Pango attributes) before it is entered inside the #ClutterText
- * buffer.
- *
- * The preedit string and attributes are ignored if the #ClutterText
- * actor is not editable.
- *
- * This function should not be used by applications
- *
- * Since: 1.2
- */
-void
-clutter_text_set_preedit_string (ClutterText *self,
- const gchar *preedit_str,
- PangoAttrList *preedit_attrs,
- guint cursor_pos)
-{
- ClutterTextPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TEXT (self));
-
- priv = self->priv;
-
- g_free (priv->preedit_str);
- priv->preedit_str = NULL;
-
- if (priv->preedit_attrs != NULL)
- {
- pango_attr_list_unref (priv->preedit_attrs);
- priv->preedit_attrs = NULL;
- }
-
- priv->preedit_n_chars = 0;
- priv->preedit_cursor_pos = 0;
-
- if (preedit_str == NULL || *preedit_str == '\0')
- priv->preedit_set = FALSE;
- else
- {
- priv->preedit_str = g_strdup (preedit_str);
-
- if (priv->preedit_str != NULL)
- priv->preedit_n_chars = g_utf8_strlen (priv->preedit_str, -1);
- else
- priv->preedit_n_chars = 0;
-
- if (preedit_attrs != NULL)
- priv->preedit_attrs = pango_attr_list_ref (preedit_attrs);
-
- priv->preedit_cursor_pos =
- CLAMP (cursor_pos, 0, priv->preedit_n_chars);
-
- priv->preedit_set = TRUE;
- }
-
- clutter_text_queue_redraw_or_relayout (self);
-}
-
-
-/**
- * clutter_text_get_layout_offsets:
- * @self: a #ClutterText
- * @x: (out): location to store X offset of layout, or %NULL
- * @y: (out): location to store Y offset of layout, or %NULL
- *
- * Obtains the coordinates where the #ClutterText will draw the #PangoLayout
- * representing the text.
- *
- * Since: 1.8
- */
-void
-clutter_text_get_layout_offsets (ClutterText *self,
- gint *x,
- gint *y)
-{
- ClutterTextPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TEXT (self));
-
- priv = self->priv;
-
- if (x != NULL)
- *x = priv->text_logical_x;
-
- if (y != NULL)
- *y = priv->text_logical_y;
-}
-
-/**
- * clutter_text_get_cursor_rect:
- * @self: a #ClutterText
- * @rect: (out caller-allocates): return location of a #ClutterRect
- *
- * Retrieves the rectangle that contains the cursor.
- *
- * The coordinates of the rectangle's origin are in actor-relative
- * coordinates.
- *
- * Since: 1.16
- */
-void
-clutter_text_get_cursor_rect (ClutterText *self,
- graphene_rect_t *rect)
-{
- float inverse_scale;
-
- g_return_if_fail (CLUTTER_IS_TEXT (self));
- g_return_if_fail (rect != NULL);
-
- inverse_scale = 1.f / clutter_actor_get_resource_scale (CLUTTER_ACTOR (self));
-
- graphene_rect_scale (&self->priv->cursor_rect,
- inverse_scale,
- inverse_scale,
- rect);
-}
-
-void
-clutter_text_set_input_hints (ClutterText *self,
- ClutterInputContentHintFlags hints)
-{
- g_return_if_fail (CLUTTER_IS_TEXT (self));
-
- self->priv->input_hints = hints;
-
- if (clutter_input_focus_is_focused (self->priv->input_focus))
- clutter_input_focus_set_content_hints (self->priv->input_focus, hints);
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_INPUT_HINTS]);
-}
-
-ClutterInputContentHintFlags
-clutter_text_get_input_hints (ClutterText *self)
-{
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), 0);
-
- return self->priv->input_hints;
-}
-
-void
-clutter_text_set_input_purpose (ClutterText *self,
- ClutterInputContentPurpose purpose)
-{
- g_return_if_fail (CLUTTER_IS_TEXT (self));
-
- self->priv->input_purpose = purpose;
-
- if (clutter_input_focus_is_focused (self->priv->input_focus))
- clutter_input_focus_set_content_purpose (self->priv->input_focus, purpose);
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_INPUT_PURPOSE]);
-}
-
-ClutterInputContentPurpose
-clutter_text_get_input_purpose (ClutterText *self)
-{
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), 0);
-
- return self->priv->input_purpose;
-}
-
-gboolean
-clutter_text_has_preedit (ClutterText *self)
-{
- g_return_val_if_fail (CLUTTER_IS_TEXT (self), FALSE);
-
- return self->priv->preedit_set;
-}
diff --git a/clutter/clutter/clutter-text.h b/clutter/clutter/clutter-text.h
deleted file mode 100644
index 7fa8116da..000000000
--- a/clutter/clutter/clutter-text.h
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2008 Intel Corporation.
- *
- * Authored By: Øyvind Kolås <pippin@o-hand.com>
- * Emmanuele Bassi <ebassi@linux.intel.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __CLUTTER_TEXT_H__
-#define __CLUTTER_TEXT_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-actor.h>
-#include <clutter/clutter-text-buffer.h>
-#include <pango/pango.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_TEXT (clutter_text_get_type ())
-#define CLUTTER_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_TEXT, ClutterText))
-#define CLUTTER_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_TEXT, ClutterTextClass))
-#define CLUTTER_IS_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_TEXT))
-#define CLUTTER_IS_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_TEXT))
-#define CLUTTER_TEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_TEXT, ClutterTextClass))
-
-typedef struct _ClutterText ClutterText;
-typedef struct _ClutterTextPrivate ClutterTextPrivate;
-typedef struct _ClutterTextClass ClutterTextClass;
-
-/**
- * ClutterText:
- *
- * The #ClutterText struct contains only private data.
- *
- * Since: 1.0
- */
-struct _ClutterText
-{
- /*< private >*/
- ClutterActor parent_instance;
-
- ClutterTextPrivate *priv;
-};
-
-/**
- * ClutterTextClass:
- * @text_changed: class handler for the #ClutterText::text-changed signal
- * @activate: class handler for the #ClutterText::activate signal
- * @cursor_event: class handler for the #ClutterText::cursor-event signal
- * @cursor_changed: class handler for the #ClutterText::cursor-changed signal
- *
- * The #ClutterTextClass struct contains only private data.
- *
- * Since: 1.0
- */
-struct _ClutterTextClass
-{
- /*< private >*/
- ClutterActorClass parent_class;
-
- /*< public >*/
- /* signals, not vfuncs */
- void (* text_changed) (ClutterText *self);
- void (* activate) (ClutterText *self);
- void (* cursor_event) (ClutterText *self,
- const graphene_rect_t *rect);
- void (* cursor_changed) (ClutterText *self);
-
- /*< private >*/
- /* padding for future expansion */
- void (* _clutter_reserved1) (void);
- void (* _clutter_reserved2) (void);
- void (* _clutter_reserved3) (void);
- void (* _clutter_reserved4) (void);
- void (* _clutter_reserved5) (void);
- void (* _clutter_reserved6) (void);
- void (* _clutter_reserved7) (void);
-};
-
-CLUTTER_EXPORT
-GType clutter_text_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterActor * clutter_text_new (void);
-CLUTTER_EXPORT
-ClutterActor * clutter_text_new_full (const gchar *font_name,
- const gchar *text,
- const ClutterColor *color);
-CLUTTER_EXPORT
-ClutterActor * clutter_text_new_with_text (const gchar *font_name,
- const gchar *text);
-CLUTTER_EXPORT
-ClutterActor * clutter_text_new_with_buffer (ClutterTextBuffer *buffer);
-CLUTTER_EXPORT
-ClutterTextBuffer * clutter_text_get_buffer (ClutterText *self);
-CLUTTER_EXPORT
-void clutter_text_set_buffer (ClutterText *self,
- ClutterTextBuffer *buffer);
-CLUTTER_EXPORT
-const gchar * clutter_text_get_text (ClutterText *self);
-CLUTTER_EXPORT
-void clutter_text_set_text (ClutterText *self,
- const gchar *text);
-CLUTTER_EXPORT
-void clutter_text_set_markup (ClutterText *self,
- const gchar *markup);
-CLUTTER_EXPORT
-void clutter_text_set_color (ClutterText *self,
- const ClutterColor *color);
-CLUTTER_EXPORT
-void clutter_text_get_color (ClutterText *self,
- ClutterColor *color);
-CLUTTER_EXPORT
-void clutter_text_set_font_name (ClutterText *self,
- const gchar *font_name);
-CLUTTER_EXPORT
-const gchar * clutter_text_get_font_name (ClutterText *self);
-CLUTTER_EXPORT
-void clutter_text_set_font_description (ClutterText *self,
- PangoFontDescription *font_desc);
-CLUTTER_EXPORT
-PangoFontDescription *clutter_text_get_font_description (ClutterText *self);
-
-CLUTTER_EXPORT
-void clutter_text_set_ellipsize (ClutterText *self,
- PangoEllipsizeMode mode);
-CLUTTER_EXPORT
-PangoEllipsizeMode clutter_text_get_ellipsize (ClutterText *self);
-CLUTTER_EXPORT
-void clutter_text_set_line_wrap (ClutterText *self,
- gboolean line_wrap);
-CLUTTER_EXPORT
-gboolean clutter_text_get_line_wrap (ClutterText *self);
-CLUTTER_EXPORT
-void clutter_text_set_line_wrap_mode (ClutterText *self,
- PangoWrapMode wrap_mode);
-CLUTTER_EXPORT
-PangoWrapMode clutter_text_get_line_wrap_mode (ClutterText *self);
-CLUTTER_EXPORT
-PangoLayout * clutter_text_get_layout (ClutterText *self);
-CLUTTER_EXPORT
-void clutter_text_set_attributes (ClutterText *self,
- PangoAttrList *attrs);
-CLUTTER_EXPORT
-PangoAttrList * clutter_text_get_attributes (ClutterText *self);
-CLUTTER_EXPORT
-void clutter_text_set_use_markup (ClutterText *self,
- gboolean setting);
-CLUTTER_EXPORT
-gboolean clutter_text_get_use_markup (ClutterText *self);
-CLUTTER_EXPORT
-void clutter_text_set_line_alignment (ClutterText *self,
- PangoAlignment alignment);
-CLUTTER_EXPORT
-PangoAlignment clutter_text_get_line_alignment (ClutterText *self);
-CLUTTER_EXPORT
-void clutter_text_set_justify (ClutterText *self,
- gboolean justify);
-CLUTTER_EXPORT
-gboolean clutter_text_get_justify (ClutterText *self);
-
-CLUTTER_EXPORT
-void clutter_text_insert_unichar (ClutterText *self,
- gunichar wc);
-CLUTTER_EXPORT
-void clutter_text_delete_chars (ClutterText *self,
- guint n_chars);
-CLUTTER_EXPORT
-void clutter_text_insert_text (ClutterText *self,
- const gchar *text,
- gssize position);
-CLUTTER_EXPORT
-void clutter_text_delete_text (ClutterText *self,
- gssize start_pos,
- gssize end_pos);
-CLUTTER_EXPORT
-gchar * clutter_text_get_chars (ClutterText *self,
- gssize start_pos,
- gssize end_pos);
-CLUTTER_EXPORT
-void clutter_text_set_editable (ClutterText *self,
- gboolean editable);
-CLUTTER_EXPORT
-gboolean clutter_text_get_editable (ClutterText *self);
-CLUTTER_EXPORT
-void clutter_text_set_activatable (ClutterText *self,
- gboolean activatable);
-CLUTTER_EXPORT
-gboolean clutter_text_get_activatable (ClutterText *self);
-
-CLUTTER_EXPORT
-gint clutter_text_get_cursor_position (ClutterText *self);
-CLUTTER_EXPORT
-void clutter_text_set_cursor_position (ClutterText *self,
- gint position);
-CLUTTER_EXPORT
-void clutter_text_set_cursor_visible (ClutterText *self,
- gboolean cursor_visible);
-CLUTTER_EXPORT
-gboolean clutter_text_get_cursor_visible (ClutterText *self);
-CLUTTER_EXPORT
-void clutter_text_set_cursor_color (ClutterText *self,
- const ClutterColor *color);
-CLUTTER_EXPORT
-void clutter_text_get_cursor_color (ClutterText *self,
- ClutterColor *color);
-CLUTTER_EXPORT
-void clutter_text_set_cursor_size (ClutterText *self,
- gint size);
-CLUTTER_EXPORT
-guint clutter_text_get_cursor_size (ClutterText *self);
-CLUTTER_EXPORT
-void clutter_text_get_cursor_rect (ClutterText *self,
- graphene_rect_t *rect);
-CLUTTER_EXPORT
-void clutter_text_set_selectable (ClutterText *self,
- gboolean selectable);
-CLUTTER_EXPORT
-gboolean clutter_text_get_selectable (ClutterText *self);
-CLUTTER_EXPORT
-void clutter_text_set_selection_bound (ClutterText *self,
- gint selection_bound);
-CLUTTER_EXPORT
-gint clutter_text_get_selection_bound (ClutterText *self);
-CLUTTER_EXPORT
-void clutter_text_set_selection (ClutterText *self,
- gssize start_pos,
- gssize end_pos);
-CLUTTER_EXPORT
-gchar * clutter_text_get_selection (ClutterText *self);
-CLUTTER_EXPORT
-void clutter_text_set_selection_color (ClutterText *self,
- const ClutterColor *color);
-CLUTTER_EXPORT
-void clutter_text_get_selection_color (ClutterText *self,
- ClutterColor *color);
-CLUTTER_EXPORT
-gboolean clutter_text_delete_selection (ClutterText *self);
-CLUTTER_EXPORT
-void clutter_text_set_password_char (ClutterText *self,
- gunichar wc);
-CLUTTER_EXPORT
-gunichar clutter_text_get_password_char (ClutterText *self);
-CLUTTER_EXPORT
-void clutter_text_set_max_length (ClutterText *self,
- gint max);
-CLUTTER_EXPORT
-gint clutter_text_get_max_length (ClutterText *self);
-CLUTTER_EXPORT
-void clutter_text_set_single_line_mode (ClutterText *self,
- gboolean single_line);
-CLUTTER_EXPORT
-gboolean clutter_text_get_single_line_mode (ClutterText *self);
-
-CLUTTER_EXPORT
-void clutter_text_set_selected_text_color (ClutterText *self,
- const ClutterColor *color);
-CLUTTER_EXPORT
-void clutter_text_get_selected_text_color (ClutterText *self,
- ClutterColor *color);
-
-CLUTTER_EXPORT
-gboolean clutter_text_activate (ClutterText *self);
-CLUTTER_EXPORT
-gint clutter_text_coords_to_position (ClutterText *self,
- gfloat x,
- gfloat y);
-CLUTTER_EXPORT
-gboolean clutter_text_position_to_coords (ClutterText *self,
- gint position,
- gfloat *x,
- gfloat *y,
- gfloat *line_height);
-
-CLUTTER_EXPORT
-void clutter_text_set_preedit_string (ClutterText *self,
- const gchar *preedit_str,
- PangoAttrList *preedit_attrs,
- guint cursor_pos);
-
-CLUTTER_EXPORT
-void clutter_text_get_layout_offsets (ClutterText *self,
- gint *x,
- gint *y);
-
-CLUTTER_EXPORT
-void clutter_text_set_input_hints (ClutterText *self,
- ClutterInputContentHintFlags hints);
-CLUTTER_EXPORT
-void clutter_text_set_input_purpose (ClutterText *self,
- ClutterInputContentPurpose purpose);
-CLUTTER_EXPORT
-ClutterInputContentHintFlags clutter_text_get_input_hints (ClutterText *self);
-CLUTTER_EXPORT
-ClutterInputContentPurpose clutter_text_get_input_purpose (ClutterText *self);
-
-CLUTTER_EXPORT
-gboolean clutter_text_has_preedit (ClutterText *self);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_TEXT_H__ */
diff --git a/clutter/clutter/clutter-texture-content.c b/clutter/clutter/clutter-texture-content.c
deleted file mode 100644
index d045fdc6d..000000000
--- a/clutter/clutter/clutter-texture-content.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive image' library.
- *
- * Copyright (C) 2012 Intel Corporation.
- * Copyright (C) 2021 Robert Mader.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- * Robert Mader <robert.mader@posteo.de>
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-texture-content.h"
-
-#include "clutter-actor-private.h"
-#include "clutter-content-private.h"
-#include "clutter-paint-node.h"
-
-struct _ClutterTextureContent
-{
- GObject parent_instance;
-
- CoglTexture *texture;
-};
-
-static void clutter_content_iface_init (ClutterContentInterface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (ClutterTextureContent, clutter_texture_content,
- G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTENT,
- clutter_content_iface_init))
-
-static void
-clutter_texture_content_finalize (GObject *gobject)
-{
- ClutterTextureContent *texture_content = CLUTTER_TEXTURE_CONTENT (gobject);
-
- g_clear_pointer (&texture_content->texture, cogl_object_unref);
-
- G_OBJECT_CLASS (clutter_texture_content_parent_class)->finalize (gobject);
-}
-
-static void
-clutter_texture_content_class_init (ClutterTextureContentClass *klass)
-{
- G_OBJECT_CLASS (klass)->finalize = clutter_texture_content_finalize;
-}
-
-static void
-clutter_texture_content_init (ClutterTextureContent *texture_content)
-{
-}
-
-static void
-clutter_texture_content_paint_content (ClutterContent *content,
- ClutterActor *actor,
- ClutterPaintNode *root,
- ClutterPaintContext *paint_context)
-{
- ClutterTextureContent *texture_content = CLUTTER_TEXTURE_CONTENT (content);
- ClutterPaintNode *node;
-
- node = clutter_actor_create_texture_paint_node (actor,
- texture_content->texture);
- clutter_paint_node_set_static_name (node, "Texture Content");
- clutter_paint_node_add_child (root, node);
- clutter_paint_node_unref (node);
-}
-
-static gboolean
-clutter_texture_content_get_preferred_size (ClutterContent *content,
- float *width,
- float *height)
-{
- ClutterTextureContent *texture_content = CLUTTER_TEXTURE_CONTENT (content);
-
- if (width != NULL)
- *width = cogl_texture_get_width (texture_content->texture);
-
- if (height != NULL)
- *height = cogl_texture_get_height (texture_content->texture);
-
- return TRUE;
-}
-
-static void
-clutter_content_iface_init (ClutterContentInterface *iface)
-{
- iface->get_preferred_size = clutter_texture_content_get_preferred_size;
- iface->paint_content = clutter_texture_content_paint_content;
-}
-
-/**
- * clutter_texture_content_new_from_texture:
- * @texture: a #CoglTexture
- * @clip: (nullable): A clipping rectangle
- *
- * Creates a new #ClutterTextureContent instance for @texture, taking an
- * internal reference to @texture.
- *
- * If you change the contents of the #CoglTexture you will need
- * to manually invalidate the @texture_content with clutter_content_invalidate()
- * in order to update the actors using @texture_content as their content.
- *
- * Return value: (transfer full): the newly created #ClutterTextureContent instance.
- * Use g_object_unref() when done.
- */
-ClutterContent *
-clutter_texture_content_new_from_texture (CoglTexture *texture,
- cairo_rectangle_int_t *clip)
-{
- ClutterTextureContent *texture_content;
-
- g_return_val_if_fail (texture != NULL, NULL);
-
- texture_content = g_object_new (CLUTTER_TYPE_TEXTURE_CONTENT, NULL);
-
- if (clip)
- {
- texture_content->texture =
- cogl_texture_new_from_sub_texture (texture,
- clip->x,
- clip->y,
- clip->width,
- clip->height);
- }
- else
- {
- texture_content->texture = cogl_object_ref (texture);
- }
-
- return CLUTTER_CONTENT (texture_content);
-}
-
-/**
- * clutter_texture_content_get_texture:
- * @texture_content: a #ClutterTextureContent
- *
- * Retrieves a pointer to the #CoglTexture used by @texture_content.
- *
- * If you change the contents of the returned #CoglTexture you will need
- * to manually invalidate the @texture_content with clutter_content_invalidate()
- * in order to update the actors using @texture_content as their content.
- *
- * Return value: (transfer none): a pointer to the #CoglTexture
- */
-CoglTexture *
-clutter_texture_content_get_texture (ClutterTextureContent *texture_content)
-{
- g_return_val_if_fail (CLUTTER_IS_TEXTURE_CONTENT (texture_content), NULL);
-
- return texture_content->texture;
-}
diff --git a/clutter/clutter/clutter-texture-content.h b/clutter/clutter/clutter-texture-content.h
deleted file mode 100644
index 4f2c21c9f..000000000
--- a/clutter/clutter/clutter-texture-content.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive image' library.
- *
- * Copyright (C) 2012 Intel Corporation.
- * Copyright (C) 2021 Robert Mader.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Emmanuele Bassi <ebassi@linux.intel.com>
- * Robert Mader <robert.mader@posteo.de>
- */
-
-#ifndef CLUTTER_TEXTURE_CONTENT_H
-#define CLUTTER_TEXTURE_CONTENT_H
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <cogl/cogl.h>
-#include <clutter/clutter-types.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_TEXTURE_CONTENT (clutter_texture_content_get_type ())
-CLUTTER_EXPORT
-G_DECLARE_FINAL_TYPE (ClutterTextureContent, clutter_texture_content,
- CLUTTER, TEXTURE_CONTENT, GObject)
-
-CLUTTER_EXPORT
-ClutterContent * clutter_texture_content_new_from_texture (CoglTexture *texture,
- cairo_rectangle_int_t *clip);
-
-CLUTTER_EXPORT
-CoglTexture * clutter_texture_content_get_texture (ClutterTextureContent *texture_content);
-
-G_END_DECLS
-
-#endif /* CLUTTER_TEXTURE_CONTENT_H */
diff --git a/clutter/clutter/clutter-timeline-private.h b/clutter/clutter/clutter-timeline-private.h
deleted file mode 100644
index 38e712bfd..000000000
--- a/clutter/clutter/clutter-timeline-private.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By: Emmanuele Bassi <ebassi@linux.intel.com>
- *
- * Copyright (C) 2009 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef CLUTTER_TIMELINE_PRIVATE_H
-#define CLUTTER_TIMELINE_PRIVATE_H
-
-void _clutter_timeline_advance (ClutterTimeline *timeline,
- int64_t tick_time);
-int64_t _clutter_timeline_get_delta (ClutterTimeline *timeline);
-void _clutter_timeline_do_tick (ClutterTimeline *timeline,
- int64_t tick_time);
-
-#endif /* CLUTTER_TIMELINE_PRIVATE_H */
diff --git a/clutter/clutter/clutter-timeline.c b/clutter/clutter/clutter-timeline.c
deleted file mode 100644
index 0c9fd2c1c..000000000
--- a/clutter/clutter/clutter-timeline.c
+++ /dev/null
@@ -1,2752 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- *
- * Copyright (C) 2006 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * SECTION:clutter-timeline
- * @short_description: A class for time-based events
- *
- * #ClutterTimeline is a base class for managing time-based event that cause
- * Clutter to redraw a stage, such as animations.
- *
- * Each #ClutterTimeline instance has a duration: once a timeline has been
- * started, using clutter_timeline_start(), it will emit a signal that can
- * be used to update the state of the actors.
- *
- * It is important to note that #ClutterTimeline is not a generic API for
- * calling closures after an interval; each Timeline is tied into the master
- * clock used to drive the frame cycle. If you need to schedule a closure
- * after an interval, see clutter_threads_add_timeout() instead.
- *
- * Users of #ClutterTimeline should connect to the #ClutterTimeline::new-frame
- * signal, which is emitted each time a timeline is advanced during the maste
- * clock iteration. The #ClutterTimeline::new-frame signal provides the time
- * elapsed since the beginning of the timeline, in milliseconds. A normalized
- * progress value can be obtained by calling clutter_timeline_get_progress().
- * By using clutter_timeline_get_delta() it is possible to obtain the wallclock
- * time elapsed since the last emission of the #ClutterTimeline::new-frame
- * signal.
- *
- * Initial state can be set up by using the #ClutterTimeline::started signal,
- * while final state can be set up by using the #ClutterTimeline::stopped
- * signal. The #ClutterTimeline guarantees the emission of at least a single
- * #ClutterTimeline::new-frame signal, as well as the emission of the
- * #ClutterTimeline::completed signal every time the #ClutterTimeline reaches
- * its #ClutterTimeline:duration.
- *
- * It is possible to connect to specific points in the timeline progress by
- * adding markers using clutter_timeline_add_marker_at_time() and connecting
- * to the #ClutterTimeline::marker-reached signal.
- *
- * Timelines can be made to loop once they reach the end of their duration, by
- * using clutter_timeline_set_repeat_count(); a looping timeline will still
- * emit the #ClutterTimeline::completed signal once it reaches the end of its
- * duration at each repeat. If you want to be notified of the end of the last
- * repeat, use the #ClutterTimeline::stopped signal.
- *
- * Timelines have a #ClutterTimeline:direction: the default direction is
- * %CLUTTER_TIMELINE_FORWARD, and goes from 0 to the duration; it is possible
- * to change the direction to %CLUTTER_TIMELINE_BACKWARD, and have the timeline
- * go from the duration to 0. The direction can be automatically reversed
- * when reaching completion by using the #ClutterTimeline:auto-reverse property.
- *
- * Timelines are used in the Clutter animation framework by classes like
- * #ClutterTransition.
- *
- * ## Defining Timelines in ClutterScript
- *
- * A #ClutterTimeline can be described in #ClutterScript like any
- * other object. Additionally, it is possible to define markers directly
- * inside the JSON definition by using the `markers` JSON object member,
- * such as:
- *
- * |[
-{
- "type" : "ClutterTimeline",
- "duration" : 1000,
- "markers" : [
- { "name" : "quarter", "time" : 250 },
- { "name" : "half-time", "time" : 500 },
- { "name" : "three-quarters", "time" : 750 }
- ]
-}
- * ]|
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-timeline.h"
-#include "deprecated/clutter-timeline.h"
-
-#include "clutter-debug.h"
-#include "clutter-easing.h"
-#include "clutter-enum-types.h"
-#include "clutter-frame-clock.h"
-#include "clutter-main.h"
-#include "clutter-marshal.h"
-#include "clutter-mutter.h"
-#include "clutter-private.h"
-#include "clutter-scriptable.h"
-#include "clutter-timeline-private.h"
-
-struct _ClutterTimelinePrivate
-{
- ClutterTimelineDirection direction;
-
- ClutterFrameClock *custom_frame_clock;
- ClutterFrameClock *frame_clock;
- ClutterActor *frame_clock_actor;
- gulong frame_clock_actor_stage_views_handler_id;
-
- ClutterActor *actor;
- gulong actor_destroy_handler_id;
- gulong actor_stage_views_handler_id;
- gulong stage_stage_views_handler_id;
- ClutterActor *stage;
-
- guint delay_id;
-
- /* The total length in milliseconds of this timeline */
- guint duration;
- guint delay;
-
- /* The current amount of elapsed time */
- gint64 elapsed_time;
-
- /* The elapsed time since the last frame was fired */
- gint64 msecs_delta;
-
- GHashTable *markers_by_name;
-
- /* Time we last advanced the elapsed time and showed a frame */
- gint64 last_frame_time;
-
- /* How many times the timeline should repeat */
- gint repeat_count;
-
- /* The number of times the timeline has repeated */
- gint current_repeat;
-
- ClutterTimelineProgressFunc progress_func;
- gpointer progress_data;
- GDestroyNotify progress_notify;
- ClutterAnimationMode progress_mode;
-
- /* step() parameters */
- gint n_steps;
- ClutterStepMode step_mode;
-
- /* cubic-bezier() parameters */
- graphene_point_t cb_1;
- graphene_point_t cb_2;
-
- guint is_playing : 1;
-
- /* If we've just started playing and haven't yet gotten
- * a tick from the master clock
- */
- guint waiting_first_tick : 1;
- guint auto_reverse : 1;
-};
-
-typedef struct {
- gchar *name;
- GQuark quark;
-
- union {
- guint msecs;
- gdouble progress;
- } data;
-
- guint is_relative : 1;
-} TimelineMarker;
-
-enum
-{
- PROP_0,
-
- PROP_ACTOR,
- PROP_DELAY,
- PROP_DURATION,
- PROP_DIRECTION,
- PROP_AUTO_REVERSE,
- PROP_REPEAT_COUNT,
- PROP_PROGRESS_MODE,
- PROP_FRAME_CLOCK,
-
- PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST] = { NULL, };
-
-enum
-{
- NEW_FRAME,
- STARTED,
- PAUSED,
- COMPLETED,
- MARKER_REACHED,
- STOPPED,
-
- LAST_SIGNAL
-};
-
-static guint timeline_signals[LAST_SIGNAL] = { 0, };
-
-static void update_frame_clock (ClutterTimeline *timeline);
-
-static void clutter_scriptable_iface_init (ClutterScriptableIface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (ClutterTimeline, clutter_timeline, G_TYPE_OBJECT,
- G_ADD_PRIVATE (ClutterTimeline)
- G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE,
- clutter_scriptable_iface_init))
-
-static TimelineMarker *
-timeline_marker_new_time (const gchar *name,
- guint msecs)
-{
- TimelineMarker *marker = g_new0 (TimelineMarker, 1);
-
- marker->name = g_strdup (name);
- marker->quark = g_quark_from_string (marker->name);
- marker->is_relative = FALSE;
- marker->data.msecs = msecs;
-
- return marker;
-}
-
-static TimelineMarker *
-timeline_marker_new_progress (const gchar *name,
- gdouble progress)
-{
- TimelineMarker *marker = g_new0 (TimelineMarker, 1);
-
- marker->name = g_strdup (name);
- marker->quark = g_quark_from_string (marker->name);
- marker->is_relative = TRUE;
- marker->data.progress = CLAMP (progress, 0.0, 1.0);
-
- return marker;
-}
-
-static void
-timeline_marker_free (gpointer data)
-{
- if (G_LIKELY (data))
- {
- TimelineMarker *marker = data;
-
- g_free (marker->name);
- g_free (marker);
- }
-}
-
-/*< private >
- * clutter_timeline_add_marker_internal:
- * @timeline: a #ClutterTimeline
- * @marker: a TimelineMarker
- *
- * Adds @marker into the hash table of markers for @timeline.
- *
- * The TimelineMarker will either be added or, in case of collisions
- * with another existing marker, freed. In any case, this function
- * assumes the ownership of the passed @marker.
- */
-static inline void
-clutter_timeline_add_marker_internal (ClutterTimeline *timeline,
- TimelineMarker *marker)
-{
- ClutterTimelinePrivate *priv = timeline->priv;
- TimelineMarker *old_marker;
-
- /* create the hash table that will hold the markers */
- if (G_UNLIKELY (priv->markers_by_name == NULL))
- priv->markers_by_name = g_hash_table_new_full (g_str_hash, g_str_equal,
- NULL,
- timeline_marker_free);
-
- old_marker = g_hash_table_lookup (priv->markers_by_name, marker->name);
- if (old_marker != NULL)
- {
- guint msecs;
-
- if (old_marker->is_relative)
- msecs = old_marker->data.progress * priv->duration;
- else
- msecs = old_marker->data.msecs;
-
- g_warning ("A marker named '%s' already exists at time %d",
- old_marker->name,
- msecs);
- timeline_marker_free (marker);
- return;
- }
-
- g_hash_table_insert (priv->markers_by_name, marker->name, marker);
-}
-
-static void
-on_actor_destroyed (ClutterActor *actor,
- ClutterTimeline *timeline)
-{
- ClutterTimelinePrivate *priv = timeline->priv;
-
- g_clear_signal_handler (&priv->stage_stage_views_handler_id, priv->stage);
- priv->actor = NULL;
-}
-
-/**
- * clutter_timeline_get_actor:
- * @timeline: a #ClutterTimeline
- *
- * Get the actor the timeline is associated with.
- *
- * Returns: (transfer none): the associated #ClutterActor
- */
-ClutterActor *
-clutter_timeline_get_actor (ClutterTimeline *timeline)
-{
- ClutterTimelinePrivate *priv = timeline->priv;
-
- return priv->actor;
-}
-
-static void
-maybe_add_timeline (ClutterTimeline *timeline)
-{
- ClutterTimelinePrivate *priv = timeline->priv;
-
- if (!priv->frame_clock)
- return;
-
- clutter_frame_clock_add_timeline (priv->frame_clock, timeline);
-}
-
-static void
-maybe_remove_timeline (ClutterTimeline *timeline)
-{
- ClutterTimelinePrivate *priv = timeline->priv;
-
- if (!priv->frame_clock)
- return;
-
- clutter_frame_clock_remove_timeline (priv->frame_clock, timeline);
-}
-
-static void
-set_frame_clock_internal (ClutterTimeline *timeline,
- ClutterFrameClock *frame_clock)
-{
- ClutterTimelinePrivate *priv = timeline->priv;
-
- if (priv->frame_clock == frame_clock)
- return;
-
- if (priv->frame_clock && priv->is_playing)
- maybe_remove_timeline (timeline);
-
- g_set_object (&priv->frame_clock, frame_clock);
-
- g_object_notify_by_pspec (G_OBJECT (timeline),
- obj_props[PROP_FRAME_CLOCK]);
-
- if (priv->is_playing)
- maybe_add_timeline (timeline);
-}
-
-static void
-on_stage_stage_views_changed (ClutterActor *stage,
- ClutterTimeline *timeline)
-{
- ClutterTimelinePrivate *priv = timeline->priv;
-
- g_clear_signal_handler (&priv->stage_stage_views_handler_id, priv->stage);
- priv->stage = NULL;
-
- update_frame_clock (timeline);
-}
-
-static void
-on_frame_clock_actor_stage_views_changed (ClutterActor *frame_clock_actor,
- ClutterTimeline *timeline)
-{
- update_frame_clock (timeline);
-}
-
-static void
-update_frame_clock (ClutterTimeline *timeline)
-{
- ClutterTimelinePrivate *priv = timeline->priv;
- ClutterFrameClock *frame_clock = NULL;
- ClutterActor *stage;
- ClutterActor *frame_clock_actor;
-
- if (!priv->actor)
- goto out;
-
- if (priv->frame_clock_actor)
- {
- g_clear_signal_handler (&priv->frame_clock_actor_stage_views_handler_id,
- priv->frame_clock_actor);
- g_clear_weak_pointer (&priv->frame_clock_actor);
- }
-
- frame_clock = clutter_actor_pick_frame_clock (priv->actor, &frame_clock_actor);
- if (frame_clock)
- {
- g_set_weak_pointer (&priv->frame_clock_actor, frame_clock_actor);
- priv->frame_clock_actor_stage_views_handler_id =
- g_signal_connect (frame_clock_actor, "stage-views-changed",
- G_CALLBACK (on_frame_clock_actor_stage_views_changed),
- timeline);
-
- g_clear_signal_handler (&priv->stage_stage_views_handler_id, priv->stage);
- goto out;
- }
-
- stage = clutter_actor_get_stage (priv->actor);
- if (!stage)
- {
- if (priv->is_playing)
- g_warning ("Timelines with detached actors are not supported");
- goto out;
- }
-
- if (priv->stage_stage_views_handler_id > 0)
- goto out;
-
- priv->stage_stage_views_handler_id =
- g_signal_connect (stage, "stage-views-changed",
- G_CALLBACK (on_stage_stage_views_changed),
- timeline);
- priv->stage = stage;
-
-out:
- set_frame_clock_internal (timeline, frame_clock);
-}
-
-static void
-on_actor_stage_views_changed (ClutterActor *actor,
- ClutterTimeline *timeline)
-{
- update_frame_clock (timeline);
-}
-
-/**
- * clutter_timeline_set_actor:
- * @timeline: a #ClutterTimeline
- * @actor: (nullable): a #ClutterActor
- *
- * Set the actor the timeline is associated with.
- */
-void
-clutter_timeline_set_actor (ClutterTimeline *timeline,
- ClutterActor *actor)
-{
- ClutterTimelinePrivate *priv = timeline->priv;
-
- g_return_if_fail (!actor || (actor && !priv->custom_frame_clock));
-
- if (priv->actor)
- {
- g_clear_signal_handler (&priv->actor_destroy_handler_id, priv->actor);
- g_clear_signal_handler (&priv->actor_stage_views_handler_id, priv->actor);
- g_clear_signal_handler (&priv->stage_stage_views_handler_id, priv->stage);
- priv->stage = NULL;
- priv->actor = NULL;
- }
-
- priv->actor = actor;
-
- if (priv->actor)
- {
- priv->actor_destroy_handler_id =
- g_signal_connect (priv->actor, "destroy",
- G_CALLBACK (on_actor_destroyed),
- timeline);
- priv->actor_stage_views_handler_id =
- g_signal_connect (priv->actor, "stage-views-changed",
- G_CALLBACK (on_actor_stage_views_changed),
- timeline);
- }
-
- update_frame_clock (timeline);
-}
-
-/* Scriptable */
-typedef struct _ParseClosure {
- ClutterTimeline *timeline;
- ClutterScript *script;
- GValue *value;
- gboolean result;
-} ParseClosure;
-
-static void
-parse_timeline_markers (JsonArray *array,
- guint index_,
- JsonNode *element,
- gpointer data)
-{
- ParseClosure *clos = data;
- JsonObject *object;
- TimelineMarker *marker;
- GList *markers;
-
- if (JSON_NODE_TYPE (element) != JSON_NODE_OBJECT)
- {
- g_warning ("The 'markers' member of a ClutterTimeline description "
- "should be an array of objects, but the element %d of the "
- "array is of type '%s'. The element will be ignored.",
- index_,
- json_node_type_name (element));
- return;
- }
-
- object = json_node_get_object (element);
-
- if (!(json_object_has_member (object, "name") &&
- (json_object_has_member (object, "time") ||
- json_object_has_member (object, "progress"))))
- {
- g_warning ("The marker definition in a ClutterTimeline description "
- "must be an object with the 'name' and either the 'time' "
- "or the 'progress' members, but the element %d of the "
- "'markers' array does not have any of them.",
- index_);
- return;
- }
-
- if (G_IS_VALUE (clos->value))
- markers = g_value_get_pointer (clos->value);
- else
- {
- g_value_init (clos->value, G_TYPE_POINTER);
- markers = NULL;
- }
-
- if (json_object_has_member (object, "time"))
- marker = timeline_marker_new_time (json_object_get_string_member (object, "name"),
- json_object_get_int_member (object, "time"));
- else
- marker = timeline_marker_new_progress (json_object_get_string_member (object, "name"),
- json_object_get_double_member (object, "progress"));
-
- markers = g_list_prepend (markers, marker);
-
- g_value_set_pointer (clos->value, markers);
-
- clos->result = TRUE;
-}
-
-static gboolean
-clutter_timeline_parse_custom_node (ClutterScriptable *scriptable,
- ClutterScript *script,
- GValue *value,
- const gchar *name,
- JsonNode *node)
-{
- ParseClosure clos;
-
- if (strcmp (name, "markers") != 0)
- return FALSE;
-
- if (JSON_NODE_TYPE (node) != JSON_NODE_ARRAY)
- return FALSE;
-
- clos.timeline = CLUTTER_TIMELINE (scriptable);
- clos.script = script;
- clos.value = value;
- clos.result = FALSE;
-
- json_array_foreach_element (json_node_get_array (node),
- parse_timeline_markers,
- &clos);
-
- return clos.result;
-}
-
-static void
-clutter_timeline_set_custom_property (ClutterScriptable *scriptable,
- ClutterScript *script,
- const gchar *name,
- const GValue *value)
-{
- if (strcmp (name, "markers") == 0)
- {
- ClutterTimeline *timeline = CLUTTER_TIMELINE (scriptable);
- GList *markers = g_value_get_pointer (value);
- GList *m;
-
- /* the list was created through prepend() */
- markers = g_list_reverse (markers);
-
- for (m = markers; m != NULL; m = m->next)
- clutter_timeline_add_marker_internal (timeline, m->data);
-
- g_list_free (markers);
- }
- else
- 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)
-{
- iface->parse_custom_node = clutter_timeline_parse_custom_node;
- iface->set_custom_property = clutter_timeline_set_custom_property;
-}
-
-/* Object */
-
-static void
-clutter_timeline_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterTimeline *timeline = CLUTTER_TIMELINE (object);
-
- switch (prop_id)
- {
- case PROP_ACTOR:
- clutter_timeline_set_actor (timeline, g_value_get_object (value));
- break;
-
- case PROP_DELAY:
- clutter_timeline_set_delay (timeline, g_value_get_uint (value));
- break;
-
- case PROP_DURATION:
- clutter_timeline_set_duration (timeline, g_value_get_uint (value));
- break;
-
- case PROP_DIRECTION:
- clutter_timeline_set_direction (timeline, g_value_get_enum (value));
- break;
-
- case PROP_AUTO_REVERSE:
- clutter_timeline_set_auto_reverse (timeline, g_value_get_boolean (value));
- break;
-
- case PROP_REPEAT_COUNT:
- clutter_timeline_set_repeat_count (timeline, g_value_get_int (value));
- break;
-
- case PROP_PROGRESS_MODE:
- clutter_timeline_set_progress_mode (timeline, g_value_get_enum (value));
- break;
-
- case PROP_FRAME_CLOCK:
- clutter_timeline_set_frame_clock (timeline, g_value_get_object (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_timeline_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterTimeline *timeline = CLUTTER_TIMELINE (object);
- ClutterTimelinePrivate *priv = timeline->priv;
-
- switch (prop_id)
- {
- case PROP_ACTOR:
- g_value_set_object (value, priv->actor);
- break;
-
- case PROP_DELAY:
- g_value_set_uint (value, priv->delay);
- break;
-
- case PROP_DURATION:
- g_value_set_uint (value, clutter_timeline_get_duration (timeline));
- break;
-
- case PROP_DIRECTION:
- g_value_set_enum (value, priv->direction);
- break;
-
- case PROP_AUTO_REVERSE:
- g_value_set_boolean (value, priv->auto_reverse);
- break;
-
- case PROP_REPEAT_COUNT:
- g_value_set_int (value, priv->repeat_count);
- break;
-
- case PROP_PROGRESS_MODE:
- g_value_set_enum (value, priv->progress_mode);
- break;
-
- case PROP_FRAME_CLOCK:
- g_value_set_object (value, priv->frame_clock);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_timeline_finalize (GObject *object)
-{
- ClutterTimeline *self = CLUTTER_TIMELINE (object);
- ClutterTimelinePrivate *priv = self->priv;
-
- if (priv->markers_by_name)
- g_hash_table_destroy (priv->markers_by_name);
-
- if (priv->is_playing)
- maybe_remove_timeline (self);
-
- g_clear_object (&priv->frame_clock);
-
- G_OBJECT_CLASS (clutter_timeline_parent_class)->finalize (object);
-}
-
-static void
-clutter_timeline_dispose (GObject *object)
-{
- ClutterTimeline *self = CLUTTER_TIMELINE(object);
- ClutterTimelinePrivate *priv;
-
- priv = self->priv;
-
- clutter_timeline_cancel_delay (self);
-
- if (priv->actor)
- {
- g_clear_signal_handler (&priv->actor_destroy_handler_id, priv->actor);
- g_clear_signal_handler (&priv->actor_stage_views_handler_id, priv->actor);
- g_clear_signal_handler (&priv->stage_stage_views_handler_id, priv->stage);
- priv->actor = NULL;
- }
-
- if (priv->frame_clock_actor)
- {
- g_clear_signal_handler (&priv->frame_clock_actor_stage_views_handler_id,
- priv->frame_clock_actor);
- g_clear_weak_pointer (&priv->frame_clock_actor);
- }
-
- if (priv->progress_notify != NULL)
- {
- priv->progress_notify (priv->progress_data);
- priv->progress_func = NULL;
- priv->progress_data = NULL;
- priv->progress_notify = NULL;
- }
-
- G_OBJECT_CLASS (clutter_timeline_parent_class)->dispose (object);
-}
-
-static void
-clutter_timeline_class_init (ClutterTimelineClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- /**
- * ClutterTimeline::actor:
- *
- * The actor the timeline is associated with. This will determine what frame
- * clock will drive it.
- */
- obj_props[PROP_ACTOR] =
- g_param_spec_object ("actor",
- P_("Actor"),
- P_("Associated ClutterActor"),
- CLUTTER_TYPE_ACTOR,
- G_PARAM_CONSTRUCT | CLUTTER_PARAM_READWRITE);
- /**
- * ClutterTimeline:delay:
- *
- * A delay, in milliseconds, that should be observed by the
- * timeline before actually starting.
- *
- * Since: 0.4
- */
- obj_props[PROP_DELAY] =
- g_param_spec_uint ("delay",
- P_("Delay"),
- P_("Delay before start"),
- 0, G_MAXUINT,
- 0,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterTimeline:duration:
- *
- * Duration of the timeline in milliseconds, depending on the
- * ClutterTimeline:fps value.
- *
- * Since: 0.6
- */
- obj_props[PROP_DURATION] =
- g_param_spec_uint ("duration",
- P_("Duration"),
- P_("Duration of the timeline in milliseconds"),
- 0, G_MAXUINT,
- 1000,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterTimeline:direction:
- *
- * The direction of the timeline, either %CLUTTER_TIMELINE_FORWARD or
- * %CLUTTER_TIMELINE_BACKWARD.
- *
- * Since: 0.6
- */
- obj_props[PROP_DIRECTION] =
- g_param_spec_enum ("direction",
- P_("Direction"),
- P_("Direction of the timeline"),
- CLUTTER_TYPE_TIMELINE_DIRECTION,
- CLUTTER_TIMELINE_FORWARD,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterTimeline:auto-reverse:
- *
- * If the direction of the timeline should be automatically reversed
- * when reaching the end.
- *
- * Since: 1.6
- */
- obj_props[PROP_AUTO_REVERSE] =
- g_param_spec_boolean ("auto-reverse",
- P_("Auto Reverse"),
- P_("Whether the direction should be reversed when reaching the end"),
- FALSE,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterTimeline:repeat-count:
- *
- * Defines how many times the timeline should repeat.
- *
- * If the repeat count is 0, the timeline does not repeat.
- *
- * If the repeat count is set to -1, the timeline will repeat until it is
- * stopped.
- *
- * Since: 1.10
- */
- obj_props[PROP_REPEAT_COUNT] =
- g_param_spec_int ("repeat-count",
- P_("Repeat Count"),
- P_("How many times the timeline should repeat"),
- -1, G_MAXINT,
- 0,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterTimeline:progress-mode:
- *
- * Controls the way a #ClutterTimeline computes the normalized progress.
- *
- * Since: 1.10
- */
- obj_props[PROP_PROGRESS_MODE] =
- g_param_spec_enum ("progress-mode",
- P_("Progress Mode"),
- P_("How the timeline should compute the progress"),
- CLUTTER_TYPE_ANIMATION_MODE,
- CLUTTER_LINEAR,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterTimeline:frame-clock:
- *
- * The frame clock driving the timeline.
- */
- obj_props[PROP_FRAME_CLOCK] =
- g_param_spec_object ("frame-clock",
- "Frame clock",
- "Frame clock driving the timeline",
- CLUTTER_TYPE_FRAME_CLOCK,
- G_PARAM_CONSTRUCT | CLUTTER_PARAM_READWRITE);
-
- object_class->dispose = clutter_timeline_dispose;
- object_class->finalize = clutter_timeline_finalize;
- object_class->set_property = clutter_timeline_set_property;
- object_class->get_property = clutter_timeline_get_property;
- g_object_class_install_properties (object_class, PROP_LAST, obj_props);
-
- /**
- * ClutterTimeline::new-frame:
- * @timeline: the timeline which received the signal
- * @msecs: the elapsed time between 0 and duration
- *
- * The ::new-frame signal is emitted for each timeline running
- * timeline before a new frame is drawn to give animations a chance
- * to update the scene.
- */
- timeline_signals[NEW_FRAME] =
- g_signal_new (I_("new-frame"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterTimelineClass, new_frame),
- NULL, NULL, NULL,
- G_TYPE_NONE,
- 1, G_TYPE_INT);
- /**
- * ClutterTimeline::completed:
- * @timeline: the #ClutterTimeline which received the signal
- *
- * The #ClutterTimeline::completed signal is emitted when the timeline's
- * elapsed time reaches the value of the #ClutterTimeline:duration
- * property.
- *
- * This signal will be emitted even if the #ClutterTimeline is set to be
- * repeating.
- *
- * If you want to get notification on whether the #ClutterTimeline has
- * been stopped or has finished its run, including its eventual repeats,
- * you should use the #ClutterTimeline::stopped signal instead.
- */
- timeline_signals[COMPLETED] =
- g_signal_new (I_("completed"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterTimelineClass, completed),
- NULL, NULL, NULL,
- G_TYPE_NONE, 0);
- /**
- * ClutterTimeline::started:
- * @timeline: the #ClutterTimeline which received the signal
- *
- * The ::started signal is emitted when the timeline starts its run.
- * This might be as soon as clutter_timeline_start() is invoked or
- * after the delay set in the ClutterTimeline:delay property has
- * expired.
- */
- timeline_signals[STARTED] =
- g_signal_new (I_("started"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterTimelineClass, started),
- NULL, NULL, NULL,
- G_TYPE_NONE, 0);
- /**
- * ClutterTimeline::paused:
- * @timeline: the #ClutterTimeline which received the signal
- *
- * The ::paused signal is emitted when clutter_timeline_pause() is invoked.
- */
- timeline_signals[PAUSED] =
- g_signal_new (I_("paused"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterTimelineClass, paused),
- NULL, NULL, NULL,
- G_TYPE_NONE, 0);
- /**
- * ClutterTimeline::marker-reached:
- * @timeline: the #ClutterTimeline which received the signal
- * @marker_name: the name of the marker reached
- * @msecs: the elapsed time
- *
- * The ::marker-reached signal is emitted each time a timeline
- * reaches a marker set with
- * clutter_timeline_add_marker_at_time(). This signal is detailed
- * with the name of the marker as well, so it is possible to connect
- * a callback to the ::marker-reached signal for a specific marker
- * with:
- *
- * <informalexample><programlisting>
- * clutter_timeline_add_marker_at_time (timeline, "foo", 500);
- * clutter_timeline_add_marker_at_time (timeline, "bar", 750);
- *
- * g_signal_connect (timeline, "marker-reached",
- * G_CALLBACK (each_marker_reached), NULL);
- * g_signal_connect (timeline, "marker-reached::foo",
- * G_CALLBACK (foo_marker_reached), NULL);
- * g_signal_connect (timeline, "marker-reached::bar",
- * G_CALLBACK (bar_marker_reached), NULL);
- * </programlisting></informalexample>
- *
- * In the example, the first callback will be invoked for both
- * the "foo" and "bar" marker, while the second and third callbacks
- * will be invoked for the "foo" or "bar" markers, respectively.
- *
- * Since: 0.8
- */
- timeline_signals[MARKER_REACHED] =
- g_signal_new (I_("marker-reached"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE |
- G_SIGNAL_DETAILED | G_SIGNAL_NO_HOOKS,
- G_STRUCT_OFFSET (ClutterTimelineClass, marker_reached),
- NULL, NULL,
- _clutter_marshal_VOID__STRING_INT,
- G_TYPE_NONE, 2,
- G_TYPE_STRING,
- G_TYPE_INT);
- /**
- * ClutterTimeline::stopped:
- * @timeline: the #ClutterTimeline that emitted the signal
- * @is_finished: %TRUE if the signal was emitted at the end of the
- * timeline.
- *
- * The #ClutterTimeline::stopped signal is emitted when the timeline
- * has been stopped, either because clutter_timeline_stop() has been
- * called, or because it has been exhausted.
- *
- * This is different from the #ClutterTimeline::completed signal,
- * which gets emitted after every repeat finishes.
- *
- * If the #ClutterTimeline has is marked as infinitely repeating,
- * this signal will never be emitted.
- *
- * Since: 1.12
- */
- timeline_signals[STOPPED] =
- g_signal_new (I_("stopped"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterTimelineClass, stopped),
- NULL, NULL, NULL,
- G_TYPE_NONE, 1,
- G_TYPE_BOOLEAN);
-}
-
-static void
-clutter_timeline_init (ClutterTimeline *self)
-{
- self->priv = clutter_timeline_get_instance_private (self);
-
- self->priv->progress_mode = CLUTTER_LINEAR;
-
- /* default steps() parameters are 1, end */
- self->priv->n_steps = 1;
- 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);
-}
-
-struct CheckIfMarkerHitClosure
-{
- ClutterTimeline *timeline;
- ClutterTimelineDirection direction;
- gint new_time;
- gint duration;
- gint delta;
-};
-
-static gboolean
-have_passed_time (const struct CheckIfMarkerHitClosure *data,
- gint msecs)
-{
- /* Ignore markers that are outside the duration of the timeline */
- if (msecs < 0 || msecs > data->duration)
- return FALSE;
-
- if (data->direction == CLUTTER_TIMELINE_FORWARD)
- {
- /* We need to special case when a marker is added at the
- beginning of the timeline */
- if (msecs == 0 &&
- data->delta > 0 &&
- data->new_time - data->delta <= 0)
- return TRUE;
-
- /* Otherwise it's just a simple test if the time is in range of
- the previous time and the new time */
- return (msecs > data->new_time - data->delta &&
- msecs <= data->new_time);
- }
- else
- {
- /* We need to special case when a marker is added at the
- end of the timeline */
- if (msecs == data->duration &&
- data->delta > 0 &&
- data->new_time + data->delta >= data->duration)
- return TRUE;
-
- /* Otherwise it's just a simple test if the time is in range of
- the previous time and the new time */
- return (msecs >= data->new_time &&
- msecs < data->new_time + data->delta);
- }
-}
-
-static void
-check_if_marker_hit (const gchar *name,
- TimelineMarker *marker,
- struct CheckIfMarkerHitClosure *data)
-{
- gint msecs;
-
- if (marker->is_relative)
- msecs = (gdouble) data->duration * marker->data.progress;
- else
- msecs = marker->data.msecs;
-
- if (have_passed_time (data, msecs))
- {
- CLUTTER_NOTE (SCHEDULER, "Marker '%s' reached", name);
-
- g_signal_emit (data->timeline, timeline_signals[MARKER_REACHED],
- marker->quark,
- name,
- msecs);
- }
-}
-
-static void
-check_markers (ClutterTimeline *timeline,
- gint delta)
-{
- ClutterTimelinePrivate *priv = timeline->priv;
- struct CheckIfMarkerHitClosure data;
-
- /* shortcircuit here if we don't have any marker installed */
- if (priv->markers_by_name == NULL)
- return;
-
- /* store the details of the timeline so that changing them in a
- marker signal handler won't affect which markers are hit */
- data.timeline = timeline;
- data.direction = priv->direction;
- data.new_time = priv->elapsed_time;
- data.duration = priv->duration;
- data.delta = delta;
-
- g_hash_table_foreach (priv->markers_by_name,
- (GHFunc) check_if_marker_hit,
- &data);
-}
-
-static void
-emit_frame_signal (ClutterTimeline *timeline)
-{
- ClutterTimelinePrivate *priv = timeline->priv;
-
- /* see bug https://bugzilla.gnome.org/show_bug.cgi?id=654066 */
- gint elapsed = (gint) priv->elapsed_time;
-
- CLUTTER_NOTE (SCHEDULER, "Emitting ::new-frame signal on timeline[%p]", timeline);
-
- g_signal_emit (timeline, timeline_signals[NEW_FRAME], 0, elapsed);
-}
-
-static gboolean
-is_complete (ClutterTimeline *timeline)
-{
- ClutterTimelinePrivate *priv = timeline->priv;
-
- return (priv->direction == CLUTTER_TIMELINE_FORWARD
- ? priv->elapsed_time >= priv->duration
- : priv->elapsed_time <= 0);
-}
-
-static void
-set_is_playing (ClutterTimeline *timeline,
- gboolean is_playing)
-{
- ClutterTimelinePrivate *priv = timeline->priv;
-
- is_playing = !!is_playing;
-
- if (is_playing == priv->is_playing)
- return;
-
- priv->is_playing = is_playing;
-
- if (priv->is_playing)
- {
- priv->waiting_first_tick = TRUE;
- priv->current_repeat = 0;
-
- maybe_add_timeline (timeline);
- }
- else
- {
- maybe_remove_timeline (timeline);
- }
-}
-
-static gboolean
-clutter_timeline_do_frame (ClutterTimeline *timeline)
-{
- ClutterTimelinePrivate *priv;
-
- priv = timeline->priv;
-
- g_object_ref (timeline);
-
- CLUTTER_NOTE (SCHEDULER, "Timeline [%p] activated (elapsed time: %ld, "
- "duration: %ld, msecs_delta: %ld)\n",
- timeline,
- (long) priv->elapsed_time,
- (long) priv->duration,
- (long) priv->msecs_delta);
-
- /* Advance time */
- if (priv->direction == CLUTTER_TIMELINE_FORWARD)
- priv->elapsed_time += priv->msecs_delta;
- else
- priv->elapsed_time -= priv->msecs_delta;
-
- /* If we have not reached the end of the timeline: */
- if (!is_complete (timeline))
- {
- /* Emit the signal */
- emit_frame_signal (timeline);
- check_markers (timeline, priv->msecs_delta);
-
- g_object_unref (timeline);
-
- return priv->is_playing;
- }
- else
- {
- /* Handle loop or stop */
- ClutterTimelineDirection saved_direction = priv->direction;
- gint elapsed_time_delta = priv->msecs_delta;
- guint overflow_msecs = priv->elapsed_time;
- gint end_msecs;
-
- /* Update the current elapsed time in case the signal handlers
- * want to take a peek. If we clamp elapsed time, then we need
- * to correpondingly reduce elapsed_time_delta to reflect the correct
- * range of times */
- if (priv->direction == CLUTTER_TIMELINE_FORWARD)
- {
- elapsed_time_delta -= (priv->elapsed_time - priv->duration);
- priv->elapsed_time = priv->duration;
- }
- else if (priv->direction == CLUTTER_TIMELINE_BACKWARD)
- {
- elapsed_time_delta -= - priv->elapsed_time;
- priv->elapsed_time = 0;
- }
-
- end_msecs = priv->elapsed_time;
-
- /* Emit the signal */
- emit_frame_signal (timeline);
- check_markers (timeline, elapsed_time_delta);
-
- /* Did the signal handler modify the elapsed time? */
- if (priv->elapsed_time != end_msecs)
- {
- g_object_unref (timeline);
- return TRUE;
- }
-
- /* Note: If the new-frame signal handler paused the timeline
- * on the last frame we will still go ahead and send the
- * completed signal */
- CLUTTER_NOTE (SCHEDULER,
- "Timeline [%p] completed (cur: %ld, tot: %ld)",
- timeline,
- (long) priv->elapsed_time,
- (long) priv->msecs_delta);
-
- if (priv->is_playing &&
- (priv->repeat_count == 0 ||
- priv->repeat_count == priv->current_repeat))
- {
- /* We stop the timeline now, so that the completed signal handler
- * may choose to re-start the timeline
- *
- * XXX Perhaps we should do this earlier, and regardless of
- * priv->repeat_count. Are we limiting the things that could be
- * done in the above new-frame signal handler?
- */
- set_is_playing (timeline, FALSE);
-
- g_signal_emit (timeline, timeline_signals[COMPLETED], 0);
- g_signal_emit (timeline, timeline_signals[STOPPED], 0, TRUE);
- }
- else
- g_signal_emit (timeline, timeline_signals[COMPLETED], 0);
-
- priv->current_repeat += 1;
-
- if (priv->auto_reverse)
- {
- /* :auto-reverse changes the direction of the timeline */
- if (priv->direction == CLUTTER_TIMELINE_FORWARD)
- priv->direction = CLUTTER_TIMELINE_BACKWARD;
- else
- priv->direction = CLUTTER_TIMELINE_FORWARD;
-
- g_object_notify_by_pspec (G_OBJECT (timeline),
- obj_props[PROP_DIRECTION]);
- }
-
- /* Again check to see if the user has manually played with
- * the elapsed time, before we finally stop or loop the timeline */
-
- if (priv->elapsed_time != end_msecs &&
- !(/* Except allow changing time from 0 -> duration (or vice-versa)
- since these are considered equivalent */
- (priv->elapsed_time == 0 && end_msecs == priv->duration) ||
- (priv->elapsed_time == priv->duration && end_msecs == 0)
- ))
- {
- g_object_unref (timeline);
- return TRUE;
- }
-
- if (priv->repeat_count != 0)
- {
- /* We try and interpolate smoothly around a loop */
- if (saved_direction == CLUTTER_TIMELINE_FORWARD)
- priv->elapsed_time = overflow_msecs - priv->duration;
- else
- priv->elapsed_time = priv->duration + overflow_msecs;
-
- /* Or if the direction changed, we try and bounce */
- if (priv->direction != saved_direction)
- priv->elapsed_time = priv->duration - priv->elapsed_time;
-
- /* If we have overflowed then we are changing the elapsed
- time without emitting the new frame signal so we need to
- check for markers again */
- check_markers (timeline,
- priv->direction == CLUTTER_TIMELINE_FORWARD
- ? priv->elapsed_time
- : priv->duration - priv->elapsed_time);
-
- g_object_unref (timeline);
- return TRUE;
- }
- else
- {
- clutter_timeline_rewind (timeline);
-
- g_object_unref (timeline);
- return FALSE;
- }
- }
-}
-
-static gboolean
-delay_timeout_func (gpointer data)
-{
- ClutterTimeline *timeline = data;
- ClutterTimelinePrivate *priv = timeline->priv;
-
- priv->delay_id = 0;
- priv->msecs_delta = 0;
- set_is_playing (timeline, TRUE);
-
- g_signal_emit (timeline, timeline_signals[STARTED], 0);
-
- return FALSE;
-}
-
-/**
- * clutter_timeline_start:
- * @timeline: A #ClutterTimeline
- *
- * Starts the #ClutterTimeline playing.
- **/
-void
-clutter_timeline_start (ClutterTimeline *timeline)
-{
- ClutterTimelinePrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TIMELINE (timeline));
-
- priv = timeline->priv;
-
- if (priv->delay_id || priv->is_playing)
- return;
-
- if (priv->duration == 0)
- return;
-
- g_warn_if_fail ((priv->actor && clutter_actor_get_stage (priv->actor)) ||
- priv->frame_clock);
-
- if (priv->delay)
- priv->delay_id = clutter_threads_add_timeout (priv->delay,
- delay_timeout_func,
- timeline);
- else
- {
- priv->msecs_delta = 0;
- set_is_playing (timeline, TRUE);
-
- g_signal_emit (timeline, timeline_signals[STARTED], 0);
- }
-}
-
-/**
- * clutter_timeline_pause:
- * @timeline: A #ClutterTimeline
- *
- * Pauses the #ClutterTimeline on current frame
- **/
-void
-clutter_timeline_pause (ClutterTimeline *timeline)
-{
- ClutterTimelinePrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TIMELINE (timeline));
-
- priv = timeline->priv;
-
- clutter_timeline_cancel_delay (timeline);
-
- if (!priv->is_playing)
- return;
-
- priv->msecs_delta = 0;
- set_is_playing (timeline, FALSE);
-
- g_signal_emit (timeline, timeline_signals[PAUSED], 0);
-}
-
-/**
- * clutter_timeline_stop:
- * @timeline: A #ClutterTimeline
- *
- * Stops the #ClutterTimeline and moves to frame 0
- **/
-void
-clutter_timeline_stop (ClutterTimeline *timeline)
-{
- gboolean was_playing;
-
- g_return_if_fail (CLUTTER_IS_TIMELINE (timeline));
-
- /* we check the is_playing here because pause() will return immediately
- * if the timeline wasn't playing, so we don't know if it was actually
- * stopped, and yet we still don't want to emit a ::stopped signal if
- * the timeline was not playing in the first place.
- */
- was_playing = timeline->priv->is_playing;
-
- clutter_timeline_pause (timeline);
- clutter_timeline_rewind (timeline);
-
- if (was_playing)
- g_signal_emit (timeline, timeline_signals[STOPPED], 0, FALSE);
-}
-
-/**
- * clutter_timeline_rewind:
- * @timeline: A #ClutterTimeline
- *
- * Rewinds #ClutterTimeline to the first frame if its direction is
- * %CLUTTER_TIMELINE_FORWARD and the last frame if it is
- * %CLUTTER_TIMELINE_BACKWARD.
- */
-void
-clutter_timeline_rewind (ClutterTimeline *timeline)
-{
- ClutterTimelinePrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TIMELINE (timeline));
-
- priv = timeline->priv;
-
- if (priv->direction == CLUTTER_TIMELINE_FORWARD)
- clutter_timeline_advance (timeline, 0);
- else if (priv->direction == CLUTTER_TIMELINE_BACKWARD)
- clutter_timeline_advance (timeline, priv->duration);
-}
-
-/**
- * clutter_timeline_skip:
- * @timeline: A #ClutterTimeline
- * @msecs: Amount of time to skip
- *
- * Advance timeline by the requested time in milliseconds
- */
-void
-clutter_timeline_skip (ClutterTimeline *timeline,
- guint msecs)
-{
- ClutterTimelinePrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TIMELINE (timeline));
-
- priv = timeline->priv;
-
- if (priv->direction == CLUTTER_TIMELINE_FORWARD)
- {
- priv->elapsed_time += msecs;
-
- if (priv->elapsed_time > priv->duration)
- priv->elapsed_time = 1;
- }
- else if (priv->direction == CLUTTER_TIMELINE_BACKWARD)
- {
- priv->elapsed_time -= msecs;
-
- if (priv->elapsed_time < 1)
- priv->elapsed_time = priv->duration - 1;
- }
-
- priv->msecs_delta = 0;
-}
-
-/**
- * clutter_timeline_advance:
- * @timeline: A #ClutterTimeline
- * @msecs: Time to advance to
- *
- * Advance timeline to the requested point. The point is given as a
- * time in milliseconds since the timeline started.
- *
- * The @timeline will not emit the #ClutterTimeline::new-frame
- * signal for the given time. The first ::new-frame signal after the call to
- * clutter_timeline_advance() will be emit the skipped markers.
- */
-void
-clutter_timeline_advance (ClutterTimeline *timeline,
- guint msecs)
-{
- ClutterTimelinePrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TIMELINE (timeline));
-
- priv = timeline->priv;
-
- priv->elapsed_time = CLAMP (msecs, 0, priv->duration);
-}
-
-/**
- * clutter_timeline_get_elapsed_time:
- * @timeline: A #ClutterTimeline
- *
- * Request the current time position of the timeline.
- *
- * Return value: current elapsed time in milliseconds.
- */
-guint
-clutter_timeline_get_elapsed_time (ClutterTimeline *timeline)
-{
- g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), 0);
-
- return timeline->priv->elapsed_time;
-}
-
-/**
- * clutter_timeline_is_playing:
- * @timeline: A #ClutterTimeline
- *
- * Queries state of a #ClutterTimeline.
- *
- * Return value: %TRUE if timeline is currently playing
- */
-gboolean
-clutter_timeline_is_playing (ClutterTimeline *timeline)
-{
- g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), FALSE);
-
- return timeline->priv->is_playing;
-}
-
-/**
- * clutter_timeline_new:
- * @duration_ms: Duration of the timeline in milliseconds
- *
- * Creates a new #ClutterTimeline with a duration of @duration_ms milli seconds.
- *
- * Return value: the newly created #ClutterTimeline instance. Use
- * g_object_unref() when done using it
- *
- * Since: 0.6
- */
-ClutterTimeline *
-clutter_timeline_new (guint duration_ms)
-{
- return g_object_new (CLUTTER_TYPE_TIMELINE,
- "duration", duration_ms,
- NULL);
-}
-
-/**
- * clutter_timeline_new_for_actor:
- * @actor: The #ClutterActor the timeline is associated with
- * @duration_ms: Duration of the timeline in milliseconds
- *
- * Creates a new #ClutterTimeline with a duration of @duration milli seconds.
- *
- * Return value: the newly created #ClutterTimeline instance. Use
- * g_object_unref() when done using it
- */
-ClutterTimeline *
-clutter_timeline_new_for_actor (ClutterActor *actor,
- unsigned int duration_ms)
-{
- return g_object_new (CLUTTER_TYPE_TIMELINE,
- "duration", duration_ms,
- "actor", actor,
- NULL);
-}
-
-/**
- * clutter_timeline_new_for_frame_clock:
- * @frame_clock: The #ClutterFrameClock the timeline is driven by
- * @duration_ms: Duration of the timeline in milliseconds
- *
- * Creates a new #ClutterTimeline with a duration of @duration_ms milli seconds.
- *
- * Return value: the newly created #ClutterTimeline instance. Use
- * g_object_unref() when done using it
- */
-ClutterTimeline *
-clutter_timeline_new_for_frame_clock (ClutterFrameClock *frame_clock,
- unsigned int duration_ms)
-{
- return g_object_new (CLUTTER_TYPE_TIMELINE,
- "duration", duration_ms,
- "frame-clock", frame_clock,
- NULL);
-}
-
-/**
- * clutter_timeline_get_delay:
- * @timeline: a #ClutterTimeline
- *
- * Retrieves the delay set using clutter_timeline_set_delay().
- *
- * Return value: the delay in milliseconds.
- *
- * Since: 0.4
- */
-guint
-clutter_timeline_get_delay (ClutterTimeline *timeline)
-{
- g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), 0);
-
- return timeline->priv->delay;
-}
-
-/**
- * clutter_timeline_set_delay:
- * @timeline: a #ClutterTimeline
- * @msecs: delay in milliseconds
- *
- * Sets the delay, in milliseconds, before @timeline should start.
- *
- * Since: 0.4
- */
-void
-clutter_timeline_set_delay (ClutterTimeline *timeline,
- guint msecs)
-{
- ClutterTimelinePrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TIMELINE (timeline));
-
- priv = timeline->priv;
-
- if (priv->delay != msecs)
- {
- priv->delay = msecs;
- g_object_notify_by_pspec (G_OBJECT (timeline), obj_props[PROP_DELAY]);
- }
-}
-
-/**
- * clutter_timeline_get_duration:
- * @timeline: a #ClutterTimeline
- *
- * Retrieves the duration of a #ClutterTimeline in milliseconds.
- * See clutter_timeline_set_duration().
- *
- * Return value: the duration of the timeline, in milliseconds.
- *
- * Since: 0.6
- */
-guint
-clutter_timeline_get_duration (ClutterTimeline *timeline)
-{
- ClutterTimelinePrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), 0);
-
- priv = timeline->priv;
-
- return priv->duration;
-}
-
-/**
- * clutter_timeline_set_duration:
- * @timeline: a #ClutterTimeline
- * @msecs: duration of the timeline in milliseconds
- *
- * Sets the duration of the timeline, in milliseconds. The speed
- * of the timeline depends on the ClutterTimeline:fps setting.
- *
- * Since: 0.6
- */
-void
-clutter_timeline_set_duration (ClutterTimeline *timeline,
- guint msecs)
-{
- ClutterTimelinePrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TIMELINE (timeline));
- g_return_if_fail (msecs > 0);
-
- priv = timeline->priv;
-
- if (priv->duration != msecs)
- {
- priv->duration = msecs;
-
- g_object_notify_by_pspec (G_OBJECT (timeline), obj_props[PROP_DURATION]);
- }
-}
-
-/**
- * clutter_timeline_get_progress:
- * @timeline: a #ClutterTimeline
- *
- * The position of the timeline in a normalized [-1, 2] interval.
- *
- * The return value of this function is determined by the progress
- * mode set using clutter_timeline_set_progress_mode(), or by the
- * progress function set using clutter_timeline_set_progress_func().
- *
- * Return value: the normalized current position in the timeline.
- *
- * Since: 0.6
- */
-gdouble
-clutter_timeline_get_progress (ClutterTimeline *timeline)
-{
- ClutterTimelinePrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), 0.0);
-
- priv = timeline->priv;
-
- /* short-circuit linear progress */
- if (priv->progress_func == NULL)
- return (gdouble) priv->elapsed_time / (gdouble) priv->duration;
- else
- return priv->progress_func (timeline,
- (gdouble) priv->elapsed_time,
- (gdouble) priv->duration,
- priv->progress_data);
-}
-
-/**
- * clutter_timeline_get_direction:
- * @timeline: a #ClutterTimeline
- *
- * Retrieves the direction of the timeline set with
- * clutter_timeline_set_direction().
- *
- * Return value: the direction of the timeline
- *
- * Since: 0.6
- */
-ClutterTimelineDirection
-clutter_timeline_get_direction (ClutterTimeline *timeline)
-{
- g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline),
- CLUTTER_TIMELINE_FORWARD);
-
- return timeline->priv->direction;
-}
-
-/**
- * clutter_timeline_set_direction:
- * @timeline: a #ClutterTimeline
- * @direction: the direction of the timeline
- *
- * Sets the direction of @timeline, either %CLUTTER_TIMELINE_FORWARD or
- * %CLUTTER_TIMELINE_BACKWARD.
- *
- * Since: 0.6
- */
-void
-clutter_timeline_set_direction (ClutterTimeline *timeline,
- ClutterTimelineDirection direction)
-{
- ClutterTimelinePrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TIMELINE (timeline));
-
- priv = timeline->priv;
-
- if (priv->direction != direction)
- {
- priv->direction = direction;
-
- if (priv->elapsed_time == 0)
- priv->elapsed_time = priv->duration;
-
- g_object_notify_by_pspec (G_OBJECT (timeline), obj_props[PROP_DIRECTION]);
- }
-}
-
-/**
- * clutter_timeline_get_delta:
- * @timeline: a #ClutterTimeline
- *
- * Retrieves the amount of time elapsed since the last
- * ClutterTimeline::new-frame signal.
- *
- * This function is only useful inside handlers for the ::new-frame
- * signal, and its behaviour is undefined if the timeline is not
- * playing.
- *
- * Return value: the amount of time in milliseconds elapsed since the
- * last frame
- *
- * Since: 0.6
- */
-guint
-clutter_timeline_get_delta (ClutterTimeline *timeline)
-{
- g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), 0);
-
- if (!clutter_timeline_is_playing (timeline))
- return 0;
-
- return timeline->priv->msecs_delta;
-}
-
-void
-_clutter_timeline_advance (ClutterTimeline *timeline,
- gint64 tick_time)
-{
- ClutterTimelinePrivate *priv = timeline->priv;
-
- g_object_ref (timeline);
-
- CLUTTER_NOTE (SCHEDULER,
- "Timeline [%p] advancing (cur: %ld, tot: %ld, "
- "tick_time: %lu)",
- timeline,
- (long) priv->elapsed_time,
- (long) priv->msecs_delta,
- (long) tick_time);
-
- priv->msecs_delta = tick_time;
- priv->is_playing = TRUE;
-
- clutter_timeline_do_frame (timeline);
-
- priv->is_playing = FALSE;
-
- g_object_unref (timeline);
-}
-
-/*< private >
- * clutter_timeline_do_tick
- * @timeline: a #ClutterTimeline
- * @tick_time: time of advance
- *
- * Advances @timeline based on the time passed in @tick_time. This
- * function is called by the master clock. The @timeline will use this
- * interval to emit the #ClutterTimeline::new-frame signal and
- * eventually skip frames.
- */
-void
-_clutter_timeline_do_tick (ClutterTimeline *timeline,
- gint64 tick_time)
-{
- ClutterTimelinePrivate *priv;
-
- priv = timeline->priv;
-
- CLUTTER_NOTE (SCHEDULER,
- "Timeline [%p] ticked (elapsed_time: %ld, msecs_delta: %ld, "
- "last_frame_time: %ld, tick_time: %ld)",
- timeline,
- (long) priv->elapsed_time,
- (long) priv->msecs_delta,
- (long) priv->last_frame_time,
- (long) tick_time);
-
- /* Check the is_playing variable before performing the timeline tick.
- * This is necessary, as if a timeline is stopped in response to a
- * frame clock generated signal of a different timeline, this code can
- * still be reached.
- */
- if (!priv->is_playing)
- return;
-
- if (priv->waiting_first_tick)
- {
- priv->last_frame_time = tick_time;
- priv->msecs_delta = 0;
- priv->waiting_first_tick = FALSE;
- clutter_timeline_do_frame (timeline);
- }
- else
- {
- gint64 msecs;
-
- msecs = tick_time - priv->last_frame_time;
-
- /* if the clock rolled back between ticks we need to
- * account for it; the best course of action, since the
- * clock roll back can happen by any arbitrary amount
- * of milliseconds, is to drop a frame here
- */
- if (msecs < 0)
- {
- priv->last_frame_time = tick_time;
- return;
- }
-
- if (msecs != 0)
- {
- /* Avoid accumulating error */
- priv->last_frame_time += msecs;
- priv->msecs_delta = msecs;
- clutter_timeline_do_frame (timeline);
- }
- }
-}
-
-/**
- * clutter_timeline_add_marker:
- * @timeline: a #ClutterTimeline
- * @marker_name: the unique name for this marker
- * @progress: the normalized value of the position of the martke
- *
- * Adds a named marker that will be hit when the timeline has reached
- * the specified @progress.
- *
- * Markers are unique string identifiers for a given position on the
- * timeline. Once @timeline reaches the given @progress of its duration,
- * if will emit a ::marker-reached signal for each marker attached to
- * that particular point.
- *
- * A marker can be removed with clutter_timeline_remove_marker(). The
- * timeline can be advanced to a marker using
- * clutter_timeline_advance_to_marker().
- *
- * See also: clutter_timeline_add_marker_at_time()
- *
- * Since: 1.14
- */
-void
-clutter_timeline_add_marker (ClutterTimeline *timeline,
- const gchar *marker_name,
- gdouble progress)
-{
- TimelineMarker *marker;
-
- g_return_if_fail (CLUTTER_IS_TIMELINE (timeline));
- g_return_if_fail (marker_name != NULL);
-
- marker = timeline_marker_new_progress (marker_name, progress);
- clutter_timeline_add_marker_internal (timeline, marker);
-}
-
-/**
- * clutter_timeline_add_marker_at_time:
- * @timeline: a #ClutterTimeline
- * @marker_name: the unique name for this marker
- * @msecs: position of the marker in milliseconds
- *
- * Adds a named marker that will be hit when the timeline has been
- * running for @msecs milliseconds.
- *
- * Markers are unique string identifiers for a given position on the
- * timeline. Once @timeline reaches the given @msecs, it will emit
- * a ::marker-reached signal for each marker attached to that position.
- *
- * A marker can be removed with clutter_timeline_remove_marker(). The
- * timeline can be advanced to a marker using
- * clutter_timeline_advance_to_marker().
- *
- * See also: clutter_timeline_add_marker()
- *
- * Since: 0.8
- */
-void
-clutter_timeline_add_marker_at_time (ClutterTimeline *timeline,
- const gchar *marker_name,
- guint msecs)
-{
- TimelineMarker *marker;
-
- g_return_if_fail (CLUTTER_IS_TIMELINE (timeline));
- g_return_if_fail (marker_name != NULL);
- g_return_if_fail (msecs <= clutter_timeline_get_duration (timeline));
-
- marker = timeline_marker_new_time (marker_name, msecs);
- clutter_timeline_add_marker_internal (timeline, marker);
-}
-
-struct CollectMarkersClosure
-{
- guint duration;
- guint msecs;
- GArray *markers;
-};
-
-static void
-collect_markers (const gchar *key,
- TimelineMarker *marker,
- struct CollectMarkersClosure *data)
-{
- guint msecs;
-
- if (marker->is_relative)
- msecs = marker->data.progress * data->duration;
- else
- msecs = marker->data.msecs;
-
- if (msecs == data->msecs)
- {
- gchar *name_copy = g_strdup (key);
- g_array_append_val (data->markers, name_copy);
- }
-}
-
-/**
- * clutter_timeline_list_markers:
- * @timeline: a #ClutterTimeline
- * @msecs: the time to check, or -1
- * @n_markers: the number of markers returned
- *
- * Retrieves the list of markers at time @msecs. If @msecs is a
- * negative integer, all the markers attached to @timeline will be
- * returned.
- *
- * Return value: (transfer full) (array zero-terminated=1 length=n_markers):
- * a newly allocated, %NULL terminated string array containing the names
- * of the markers. Use g_strfreev() when done.
- *
- * Since: 0.8
- */
-gchar **
-clutter_timeline_list_markers (ClutterTimeline *timeline,
- gint msecs,
- gsize *n_markers)
-{
- ClutterTimelinePrivate *priv;
- gchar **retval = NULL;
- gsize i;
-
- g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), NULL);
-
- priv = timeline->priv;
-
- if (G_UNLIKELY (priv->markers_by_name == NULL))
- {
- if (n_markers)
- *n_markers = 0;
-
- return NULL;
- }
-
- if (msecs < 0)
- {
- GList *markers, *l;
-
- markers = g_hash_table_get_keys (priv->markers_by_name);
- retval = g_new0 (gchar*, g_list_length (markers) + 1);
-
- for (i = 0, l = markers; l != NULL; i++, l = l->next)
- retval[i] = g_strdup (l->data);
-
- g_list_free (markers);
- }
- else
- {
- struct CollectMarkersClosure data;
-
- data.duration = priv->duration;
- data.msecs = msecs;
- data.markers = g_array_new (TRUE, FALSE, sizeof (gchar *));
-
- g_hash_table_foreach (priv->markers_by_name,
- (GHFunc) collect_markers,
- &data);
-
- i = data.markers->len;
- retval = (gchar **) (void *) g_array_free (data.markers, FALSE);
- }
-
- if (n_markers)
- *n_markers = i;
-
- return retval;
-}
-
-/**
- * clutter_timeline_advance_to_marker:
- * @timeline: a #ClutterTimeline
- * @marker_name: the name of the marker
- *
- * Advances @timeline to the time of the given @marker_name.
- *
- * Like clutter_timeline_advance(), this function will not
- * emit the #ClutterTimeline::new-frame for the time where @marker_name
- * is set, nor it will emit #ClutterTimeline::marker-reached for
- * @marker_name.
- *
- * Since: 0.8
- */
-void
-clutter_timeline_advance_to_marker (ClutterTimeline *timeline,
- const gchar *marker_name)
-{
- ClutterTimelinePrivate *priv;
- TimelineMarker *marker;
- guint msecs;
-
- g_return_if_fail (CLUTTER_IS_TIMELINE (timeline));
- g_return_if_fail (marker_name != NULL);
-
- priv = timeline->priv;
-
- if (G_UNLIKELY (priv->markers_by_name == NULL))
- {
- g_warning ("No marker named '%s' found.", marker_name);
- return;
- }
-
- marker = g_hash_table_lookup (priv->markers_by_name, marker_name);
- if (marker == NULL)
- {
- g_warning ("No marker named '%s' found.", marker_name);
- return;
- }
-
- if (marker->is_relative)
- msecs = marker->data.progress * priv->duration;
- else
- msecs = marker->data.msecs;
-
- clutter_timeline_advance (timeline, msecs);
-}
-
-/**
- * clutter_timeline_remove_marker:
- * @timeline: a #ClutterTimeline
- * @marker_name: the name of the marker to remove
- *
- * Removes @marker_name, if found, from @timeline.
- *
- * Since: 0.8
- */
-void
-clutter_timeline_remove_marker (ClutterTimeline *timeline,
- const gchar *marker_name)
-{
- ClutterTimelinePrivate *priv;
- TimelineMarker *marker;
-
- g_return_if_fail (CLUTTER_IS_TIMELINE (timeline));
- g_return_if_fail (marker_name != NULL);
-
- priv = timeline->priv;
-
- if (G_UNLIKELY (priv->markers_by_name == NULL))
- {
- g_warning ("No marker named '%s' found.", marker_name);
- return;
- }
-
- marker = g_hash_table_lookup (priv->markers_by_name, marker_name);
- if (!marker)
- {
- g_warning ("No marker named '%s' found.", marker_name);
- return;
- }
-
- /* this will take care of freeing the marker as well */
- g_hash_table_remove (priv->markers_by_name, marker_name);
-}
-
-/**
- * clutter_timeline_has_marker:
- * @timeline: a #ClutterTimeline
- * @marker_name: the name of the marker
- *
- * Checks whether @timeline has a marker set with the given name.
- *
- * Return value: %TRUE if the marker was found
- *
- * Since: 0.8
- */
-gboolean
-clutter_timeline_has_marker (ClutterTimeline *timeline,
- const gchar *marker_name)
-{
- g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), FALSE);
- g_return_val_if_fail (marker_name != NULL, FALSE);
-
- if (G_UNLIKELY (timeline->priv->markers_by_name == NULL))
- return FALSE;
-
- return NULL != g_hash_table_lookup (timeline->priv->markers_by_name,
- marker_name);
-}
-
-/**
- * clutter_timeline_set_auto_reverse:
- * @timeline: a #ClutterTimeline
- * @reverse: %TRUE if the @timeline should reverse the direction
- *
- * Sets whether @timeline should reverse the direction after the
- * emission of the #ClutterTimeline::completed signal.
- *
- * Setting the #ClutterTimeline:auto-reverse property to %TRUE is the
- * equivalent of connecting a callback to the #ClutterTimeline::completed
- * signal and changing the direction of the timeline from that callback;
- * for instance, this code:
- *
- * |[
- * static void
- * reverse_timeline (ClutterTimeline *timeline)
- * {
- * ClutterTimelineDirection dir = clutter_timeline_get_direction (timeline);
- *
- * if (dir == CLUTTER_TIMELINE_FORWARD)
- * dir = CLUTTER_TIMELINE_BACKWARD;
- * else
- * dir = CLUTTER_TIMELINE_FORWARD;
- *
- * clutter_timeline_set_direction (timeline, dir);
- * }
- * ...
- * timeline = clutter_timeline_new (1000);
- * clutter_timeline_set_repeat_count (timeline, -1);
- * g_signal_connect (timeline, "completed",
- * G_CALLBACK (reverse_timeline),
- * NULL);
- * ]|
- *
- * can be effectively replaced by:
- *
- * |[
- * timeline = clutter_timeline_new (1000);
- * clutter_timeline_set_repeat_count (timeline, -1);
- * clutter_timeline_set_auto_reverse (timeline);
- * ]|
- *
- * Since: 1.6
- */
-void
-clutter_timeline_set_auto_reverse (ClutterTimeline *timeline,
- gboolean reverse)
-{
- ClutterTimelinePrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TIMELINE (timeline));
-
- reverse = !!reverse;
-
- priv = timeline->priv;
-
- if (priv->auto_reverse != reverse)
- {
- priv->auto_reverse = reverse;
-
- g_object_notify_by_pspec (G_OBJECT (timeline),
- obj_props[PROP_AUTO_REVERSE]);
- }
-}
-
-/**
- * clutter_timeline_get_auto_reverse:
- * @timeline: a #ClutterTimeline
- *
- * Retrieves the value set by clutter_timeline_set_auto_reverse().
- *
- * Return value: %TRUE if the timeline should automatically reverse, and
- * %FALSE otherwise
- *
- * Since: 1.6
- */
-gboolean
-clutter_timeline_get_auto_reverse (ClutterTimeline *timeline)
-{
- g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), FALSE);
-
- return timeline->priv->auto_reverse;
-}
-
-/**
- * clutter_timeline_set_repeat_count:
- * @timeline: a #ClutterTimeline
- * @count: the number of times the timeline should repeat
- *
- * Sets the number of times the @timeline should repeat.
- *
- * If @count is 0, the timeline never repeats.
- *
- * If @count is -1, the timeline will always repeat until
- * it's stopped.
- *
- * Since: 1.10
- */
-void
-clutter_timeline_set_repeat_count (ClutterTimeline *timeline,
- gint count)
-{
- ClutterTimelinePrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TIMELINE (timeline));
- g_return_if_fail (count >= -1);
-
- priv = timeline->priv;
-
- if (priv->repeat_count != count)
- {
- priv->repeat_count = count;
-
- g_object_notify_by_pspec (G_OBJECT (timeline),
- obj_props[PROP_REPEAT_COUNT]);
- }
-}
-
-/**
- * clutter_timeline_get_repeat_count:
- * @timeline: a #ClutterTimeline
- *
- * Retrieves the number set using clutter_timeline_set_repeat_count().
- *
- * Return value: the number of repeats
- *
- * Since: 1.10
- */
-gint
-clutter_timeline_get_repeat_count (ClutterTimeline *timeline)
-{
- g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), 0);
-
- return timeline->priv->repeat_count;
-}
-
-/**
- * clutter_timeline_set_progress_func:
- * @timeline: a #ClutterTimeline
- * @func: (scope notified) (allow-none): a progress function, or %NULL
- * @data: (closure): data to pass to @func
- * @notify: a function to be called when the progress function is removed
- * or the timeline is disposed
- *
- * Sets a custom progress function for @timeline. The progress function will
- * be called by clutter_timeline_get_progress() and will be used to compute
- * the progress value based on the elapsed time and the total duration of the
- * timeline.
- *
- * If @func is not %NULL, the #ClutterTimeline:progress-mode property will
- * be set to %CLUTTER_CUSTOM_MODE.
- *
- * If @func is %NULL, any previously set progress function will be unset, and
- * the #ClutterTimeline:progress-mode property will be set to %CLUTTER_LINEAR.
- *
- * Since: 1.10
- */
-void
-clutter_timeline_set_progress_func (ClutterTimeline *timeline,
- ClutterTimelineProgressFunc func,
- gpointer data,
- GDestroyNotify notify)
-{
- ClutterTimelinePrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TIMELINE (timeline));
-
- priv = timeline->priv;
-
- if (priv->progress_notify != NULL)
- priv->progress_notify (priv->progress_data);
-
- priv->progress_func = func;
- priv->progress_data = data;
- priv->progress_notify = notify;
-
- if (priv->progress_func != NULL)
- priv->progress_mode = CLUTTER_CUSTOM_MODE;
- else
- priv->progress_mode = CLUTTER_LINEAR;
-
- g_object_notify_by_pspec (G_OBJECT (timeline), obj_props[PROP_PROGRESS_MODE]);
-}
-
-static gdouble
-clutter_timeline_progress_func (ClutterTimeline *timeline,
- gdouble elapsed,
- gdouble duration,
- gpointer user_data G_GNUC_UNUSED)
-{
- ClutterTimelinePrivate *priv = timeline->priv;
-
- /* parametrized easing functions need to be handled separately */
- switch (priv->progress_mode)
- {
- case CLUTTER_STEPS:
- if (priv->step_mode == CLUTTER_STEP_MODE_START)
- return clutter_ease_steps_start (elapsed, duration, priv->n_steps);
- else if (priv->step_mode == CLUTTER_STEP_MODE_END)
- return clutter_ease_steps_end (elapsed, duration, priv->n_steps);
- else
- g_assert_not_reached ();
- break;
-
- case CLUTTER_STEP_START:
- return clutter_ease_steps_start (elapsed, duration, 1);
-
- case CLUTTER_STEP_END:
- return clutter_ease_steps_end (elapsed, duration, 1);
-
- case CLUTTER_CUBIC_BEZIER:
- return clutter_ease_cubic_bezier (elapsed, duration,
- priv->cb_1.x, priv->cb_1.y,
- priv->cb_2.x, priv->cb_2.y);
-
- case CLUTTER_EASE:
- return clutter_ease_cubic_bezier (elapsed, duration,
- 0.25, 0.1, 0.25, 1.0);
-
- case CLUTTER_EASE_IN:
- return clutter_ease_cubic_bezier (elapsed, duration,
- 0.42, 0.0, 1.0, 1.0);
-
- case CLUTTER_EASE_OUT:
- return clutter_ease_cubic_bezier (elapsed, duration,
- 0.0, 0.0, 0.58, 1.0);
-
- case CLUTTER_EASE_IN_OUT:
- return clutter_ease_cubic_bezier (elapsed, duration,
- 0.42, 0.0, 0.58, 1.0);
-
- default:
- break;
- }
-
- return clutter_easing_for_mode (priv->progress_mode, elapsed, duration);
-}
-
-/**
- * clutter_timeline_set_progress_mode:
- * @timeline: a #ClutterTimeline
- * @mode: the progress mode, as a #ClutterAnimationMode
- *
- * Sets the progress function using a value from the #ClutterAnimationMode
- * enumeration. The @mode cannot be %CLUTTER_CUSTOM_MODE or bigger than
- * %CLUTTER_ANIMATION_LAST.
- *
- * Since: 1.10
- */
-void
-clutter_timeline_set_progress_mode (ClutterTimeline *timeline,
- ClutterAnimationMode mode)
-{
- ClutterTimelinePrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TIMELINE (timeline));
- g_return_if_fail (mode < CLUTTER_ANIMATION_LAST);
- g_return_if_fail (mode != CLUTTER_CUSTOM_MODE);
-
- priv = timeline->priv;
-
- if (priv->progress_mode == mode)
- return;
-
- if (priv->progress_notify != NULL)
- priv->progress_notify (priv->progress_data);
-
- priv->progress_mode = mode;
-
- /* short-circuit linear progress */
- if (priv->progress_mode != CLUTTER_LINEAR)
- priv->progress_func = clutter_timeline_progress_func;
- else
- priv->progress_func = NULL;
-
- priv->progress_data = NULL;
- priv->progress_notify = NULL;
-
- g_object_notify_by_pspec (G_OBJECT (timeline), obj_props[PROP_PROGRESS_MODE]);
-}
-
-/**
- * clutter_timeline_get_progress_mode:
- * @timeline: a #ClutterTimeline
- *
- * Retrieves the progress mode set using clutter_timeline_set_progress_mode()
- * or clutter_timeline_set_progress_func().
- *
- * Return value: a #ClutterAnimationMode
- *
- * Since: 1.10
- */
-ClutterAnimationMode
-clutter_timeline_get_progress_mode (ClutterTimeline *timeline)
-{
- g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), CLUTTER_LINEAR);
-
- return timeline->priv->progress_mode;
-}
-
-/**
- * clutter_timeline_get_duration_hint:
- * @timeline: a #ClutterTimeline
- *
- * Retrieves the full duration of the @timeline, taking into account the
- * current value of the #ClutterTimeline:repeat-count property.
- *
- * If the #ClutterTimeline:repeat-count property is set to -1, this function
- * will return %G_MAXINT64.
- *
- * The returned value is to be considered a hint, and it's only valid
- * as long as the @timeline hasn't been changed.
- *
- * Return value: the full duration of the #ClutterTimeline
- *
- * Since: 1.10
- */
-gint64
-clutter_timeline_get_duration_hint (ClutterTimeline *timeline)
-{
- ClutterTimelinePrivate *priv;
-
- g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), 0);
-
- priv = timeline->priv;
-
- if (priv->repeat_count == 0)
- return priv->duration;
- else if (priv->repeat_count < 0)
- return G_MAXINT64;
- else
- return priv->repeat_count * priv->duration;
-}
-
-/**
- * clutter_timeline_get_current_repeat:
- * @timeline: a #ClutterTimeline
- *
- * Retrieves the current repeat for a timeline.
- *
- * Repeats start at 0.
- *
- * Return value: the current repeat
- *
- * Since: 1.10
- */
-gint
-clutter_timeline_get_current_repeat (ClutterTimeline *timeline)
-{
- g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), 0);
-
- return timeline->priv->current_repeat;
-}
-
-/**
- * clutter_timeline_set_step_progress:
- * @timeline: a #ClutterTimeline
- * @n_steps: the number of steps
- * @step_mode: whether the change should happen at the start
- * or at the end of the step
- *
- * Sets the #ClutterTimeline:progress-mode of the @timeline to %CLUTTER_STEPS
- * and provides the parameters of the step function.
- *
- * Since: 1.12
- */
-void
-clutter_timeline_set_step_progress (ClutterTimeline *timeline,
- gint n_steps,
- ClutterStepMode step_mode)
-{
- ClutterTimelinePrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TIMELINE (timeline));
- g_return_if_fail (n_steps > 0);
-
- priv = timeline->priv;
-
- if (priv->progress_mode == CLUTTER_STEPS &&
- priv->n_steps == n_steps &&
- priv->step_mode == step_mode)
- return;
-
- priv->n_steps = n_steps;
- priv->step_mode = step_mode;
- clutter_timeline_set_progress_mode (timeline, CLUTTER_STEPS);
-}
-
-/**
- * clutter_timeline_get_step_progress:
- * @timeline: a #ClutterTimeline
- * @n_steps: (out): return location for the number of steps, or %NULL
- * @step_mode: (out): return location for the value change policy,
- * or %NULL
- *
- * Retrieves the parameters of the step progress mode used by @timeline.
- *
- * Return value: %TRUE if the @timeline is using a step progress
- * mode, and %FALSE otherwise
- *
- * Since: 1.12
- */
-gboolean
-clutter_timeline_get_step_progress (ClutterTimeline *timeline,
- gint *n_steps,
- ClutterStepMode *step_mode)
-{
- g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), FALSE);
-
- if (!(timeline->priv->progress_mode == CLUTTER_STEPS ||
- timeline->priv->progress_mode == CLUTTER_STEP_START ||
- timeline->priv->progress_mode == CLUTTER_STEP_END))
- return FALSE;
-
- if (n_steps != NULL)
- *n_steps = timeline->priv->n_steps;
-
- if (step_mode != NULL)
- *step_mode = timeline->priv->step_mode;
-
- return TRUE;
-}
-
-/**
- * clutter_timeline_set_cubic_bezier_progress:
- * @timeline: a #ClutterTimeline
- * @c_1: the first control point for the cubic bezier
- * @c_2: the second control point for the cubic bezier
- *
- * Sets the #ClutterTimeline:progress-mode of @timeline
- * to %CLUTTER_CUBIC_BEZIER, and sets the two control
- * points for the cubic bezier.
- *
- * The cubic bezier curve is between (0, 0) and (1, 1). The X coordinate
- * of the two control points must be in the [ 0, 1 ] range, while the
- * Y coordinate of the two control points can exceed this range.
- *
- * Since: 1.12
- */
-void
-clutter_timeline_set_cubic_bezier_progress (ClutterTimeline *timeline,
- const graphene_point_t *c_1,
- const graphene_point_t *c_2)
-{
- ClutterTimelinePrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TIMELINE (timeline));
- g_return_if_fail (c_1 != NULL && c_2 != NULL);
-
- priv = timeline->priv;
-
- priv->cb_1 = *c_1;
- priv->cb_2 = *c_2;
-
- /* ensure the range on the X coordinate */
- priv->cb_1.x = CLAMP (priv->cb_1.x, 0.f, 1.f);
- priv->cb_2.x = CLAMP (priv->cb_2.x, 0.f, 1.f);
-
- clutter_timeline_set_progress_mode (timeline, CLUTTER_CUBIC_BEZIER);
-}
-
-/**
- * clutter_timeline_get_cubic_bezier_progress:
- * @timeline: a #ClutterTimeline
- * @c_1: (out caller-allocates): return location for the first control
- * point of the cubic bezier, or %NULL
- * @c_2: (out caller-allocates): return location for the second control
- * point of the cubic bezier, or %NULL
- *
- * Retrieves the control points for the cubic bezier progress mode.
- *
- * Return value: %TRUE if the @timeline is using a cubic bezier progress
- * more, and %FALSE otherwise
- *
- * Since: 1.12
- */
-gboolean
-clutter_timeline_get_cubic_bezier_progress (ClutterTimeline *timeline,
- graphene_point_t *c_1,
- graphene_point_t *c_2)
-{
- g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), FALSE);
-
- if (!(timeline->priv->progress_mode == CLUTTER_CUBIC_BEZIER ||
- timeline->priv->progress_mode == CLUTTER_EASE ||
- timeline->priv->progress_mode == CLUTTER_EASE_IN ||
- timeline->priv->progress_mode == CLUTTER_EASE_OUT ||
- timeline->priv->progress_mode == CLUTTER_EASE_IN_OUT))
- return FALSE;
-
- if (c_1 != NULL)
- *c_1 = timeline->priv->cb_1;
-
- if (c_2 != NULL)
- *c_2 = timeline->priv->cb_2;
-
- return TRUE;
-}
-
-/**
- * clutter_timeline_get_frame_clock: (skip)
- */
-ClutterFrameClock *
-clutter_timeline_get_frame_clock (ClutterTimeline *timeline)
-{
- g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), NULL);
-
- return timeline->priv->frame_clock;
-}
-
-void
-clutter_timeline_set_frame_clock (ClutterTimeline *timeline,
- ClutterFrameClock *frame_clock)
-{
- ClutterTimelinePrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TIMELINE (timeline));
-
- priv = timeline->priv;
-
- g_assert (!frame_clock || (frame_clock && !priv->actor));
- g_return_if_fail (!frame_clock || (frame_clock && !priv->actor));
-
- priv->custom_frame_clock = frame_clock;
- if (!priv->actor)
- set_frame_clock_internal (timeline, frame_clock);
-}
diff --git a/clutter/clutter/clutter-timeline.h b/clutter/clutter/clutter-timeline.h
deleted file mode 100644
index 022a927ce..000000000
--- a/clutter/clutter/clutter-timeline.h
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- *
- * Copyright (C) 2006 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#ifndef __CLUTTER_TIMELINE_H__
-#define __CLUTTER_TIMELINE_H__
-
-#include <clutter/clutter-types.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_TIMELINE (clutter_timeline_get_type ())
-#define CLUTTER_TIMELINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_TIMELINE, ClutterTimeline))
-#define CLUTTER_TIMELINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_TIMELINE, ClutterTimelineClass))
-#define CLUTTER_IS_TIMELINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_TIMELINE))
-#define CLUTTER_IS_TIMELINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_TIMELINE))
-#define CLUTTER_TIMELINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_TIMELINE, ClutterTimelineClass))
-
-typedef struct _ClutterTimelineClass ClutterTimelineClass;
-typedef struct _ClutterTimelinePrivate ClutterTimelinePrivate;
-
-/**
- * ClutterTimelineProgressFunc:
- * @timeline: a #ClutterTimeline
- * @elapsed: the elapsed time, in milliseconds
- * @total: the total duration of the timeline, in milliseconds,
- * @user_data: data passed to the function
- *
- * A function for defining a custom progress.
- *
- * Return value: the progress, as a floating point value between -1.0 and 2.0.
- *
- * Since: 1.10
- */
-typedef gdouble (* ClutterTimelineProgressFunc) (ClutterTimeline *timeline,
- gdouble elapsed,
- gdouble total,
- gpointer user_data);
-
-/**
- * ClutterTimeline:
- *
- * The #ClutterTimeline structure contains only private data
- * and should be accessed using the provided API
- *
- * Since: 0.2
- */
-struct _ClutterTimeline
-{
- /*< private >*/
- GObject parent_instance;
-
- ClutterTimelinePrivate *priv;
-};
-
-/**
- * ClutterTimelineClass:
- * @started: class handler for the #ClutterTimeline::started signal
- * @completed: class handler for the #ClutterTimeline::completed signal
- * @paused: class handler for the #ClutterTimeline::paused signal
- * @new_frame: class handler for the #ClutterTimeline::new-frame signal
- * @marker_reached: class handler for the #ClutterTimeline::marker-reached signal
- * @stopped: class handler for the #ClutterTimeline::stopped signal
- *
- * The #ClutterTimelineClass structure contains only private data
- *
- * Since: 0.2
- */
-struct _ClutterTimelineClass
-{
- /*< private >*/
- GObjectClass parent_class;
-
- /*< public >*/
- void (*started) (ClutterTimeline *timeline);
- void (*completed) (ClutterTimeline *timeline);
- void (*paused) (ClutterTimeline *timeline);
-
- void (*new_frame) (ClutterTimeline *timeline,
- gint msecs);
-
- void (*marker_reached) (ClutterTimeline *timeline,
- const gchar *marker_name,
- gint msecs);
- void (*stopped) (ClutterTimeline *timeline,
- gboolean is_finished);
-
- /*< private >*/
- void (*_clutter_timeline_1) (void);
- void (*_clutter_timeline_2) (void);
- void (*_clutter_timeline_3) (void);
- void (*_clutter_timeline_4) (void);
-};
-
-CLUTTER_EXPORT
-GType clutter_timeline_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterTimeline * clutter_timeline_new_for_actor (ClutterActor *actor,
- unsigned int duration_ms);
-
-CLUTTER_EXPORT
-ClutterTimeline * clutter_timeline_new_for_frame_clock (ClutterFrameClock *frame_clock,
- unsigned int duration_ms);
-
-CLUTTER_EXPORT
-ClutterActor * clutter_timeline_get_actor (ClutterTimeline *timeline);
-
-CLUTTER_EXPORT
-void clutter_timeline_set_actor (ClutterTimeline *timeline,
- ClutterActor *actor);
-
-CLUTTER_EXPORT
-guint clutter_timeline_get_duration (ClutterTimeline *timeline);
-CLUTTER_EXPORT
-void clutter_timeline_set_duration (ClutterTimeline *timeline,
- guint msecs);
-CLUTTER_EXPORT
-ClutterTimelineDirection clutter_timeline_get_direction (ClutterTimeline *timeline);
-CLUTTER_EXPORT
-void clutter_timeline_set_direction (ClutterTimeline *timeline,
- ClutterTimelineDirection direction);
-CLUTTER_EXPORT
-void clutter_timeline_start (ClutterTimeline *timeline);
-CLUTTER_EXPORT
-void clutter_timeline_pause (ClutterTimeline *timeline);
-CLUTTER_EXPORT
-void clutter_timeline_stop (ClutterTimeline *timeline);
-CLUTTER_EXPORT
-void clutter_timeline_set_auto_reverse (ClutterTimeline *timeline,
- gboolean reverse);
-CLUTTER_EXPORT
-gboolean clutter_timeline_get_auto_reverse (ClutterTimeline *timeline);
-CLUTTER_EXPORT
-void clutter_timeline_set_repeat_count (ClutterTimeline *timeline,
- gint count);
-CLUTTER_EXPORT
-gint clutter_timeline_get_repeat_count (ClutterTimeline *timeline);
-CLUTTER_EXPORT
-void clutter_timeline_rewind (ClutterTimeline *timeline);
-CLUTTER_EXPORT
-void clutter_timeline_skip (ClutterTimeline *timeline,
- guint msecs);
-CLUTTER_EXPORT
-void clutter_timeline_advance (ClutterTimeline *timeline,
- guint msecs);
-CLUTTER_EXPORT
-guint clutter_timeline_get_elapsed_time (ClutterTimeline *timeline);
-CLUTTER_EXPORT
-gdouble clutter_timeline_get_progress (ClutterTimeline *timeline);
-CLUTTER_EXPORT
-gboolean clutter_timeline_is_playing (ClutterTimeline *timeline);
-CLUTTER_EXPORT
-void clutter_timeline_set_delay (ClutterTimeline *timeline,
- guint msecs);
-CLUTTER_EXPORT
-guint clutter_timeline_get_delay (ClutterTimeline *timeline);
-CLUTTER_EXPORT
-guint clutter_timeline_get_delta (ClutterTimeline *timeline);
-CLUTTER_EXPORT
-void clutter_timeline_add_marker (ClutterTimeline *timeline,
- const gchar *marker_name,
- gdouble progress);
-CLUTTER_EXPORT
-void clutter_timeline_add_marker_at_time (ClutterTimeline *timeline,
- const gchar *marker_name,
- guint msecs);
-CLUTTER_EXPORT
-void clutter_timeline_remove_marker (ClutterTimeline *timeline,
- const gchar *marker_name);
-CLUTTER_EXPORT
-gchar ** clutter_timeline_list_markers (ClutterTimeline *timeline,
- gint msecs,
- gsize *n_markers) G_GNUC_MALLOC;
-CLUTTER_EXPORT
-gboolean clutter_timeline_has_marker (ClutterTimeline *timeline,
- const gchar *marker_name);
-CLUTTER_EXPORT
-void clutter_timeline_advance_to_marker (ClutterTimeline *timeline,
- const gchar *marker_name);
-CLUTTER_EXPORT
-void clutter_timeline_set_progress_func (ClutterTimeline *timeline,
- ClutterTimelineProgressFunc func,
- gpointer data,
- GDestroyNotify notify);
-CLUTTER_EXPORT
-void clutter_timeline_set_progress_mode (ClutterTimeline *timeline,
- ClutterAnimationMode mode);
-CLUTTER_EXPORT
-ClutterAnimationMode clutter_timeline_get_progress_mode (ClutterTimeline *timeline);
-CLUTTER_EXPORT
-void clutter_timeline_set_step_progress (ClutterTimeline *timeline,
- gint n_steps,
- ClutterStepMode step_mode);
-CLUTTER_EXPORT
-gboolean clutter_timeline_get_step_progress (ClutterTimeline *timeline,
- 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);
-CLUTTER_EXPORT
-gboolean clutter_timeline_get_cubic_bezier_progress (ClutterTimeline *timeline,
- graphene_point_t *c_1,
- graphene_point_t *c_2);
-
-CLUTTER_EXPORT
-gint64 clutter_timeline_get_duration_hint (ClutterTimeline *timeline);
-CLUTTER_EXPORT
-gint clutter_timeline_get_current_repeat (ClutterTimeline *timeline);
-
-CLUTTER_EXPORT
-ClutterFrameClock * clutter_timeline_get_frame_clock (ClutterTimeline *timeline);
-
-CLUTTER_EXPORT
-void clutter_timeline_set_frame_clock (ClutterTimeline *timeline,
- ClutterFrameClock *frame_clock);
-
-G_END_DECLS
-
-#endif /* _CLUTTER_TIMELINE_H__ */
diff --git a/clutter/clutter/clutter-transition-group.c b/clutter/clutter/clutter-transition-group.c
deleted file mode 100644
index 3d8c5a53b..000000000
--- a/clutter/clutter/clutter-transition-group.c
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2012 Intel Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author: Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-transition-group
- * @Title: ClutterTransitionGroup
- * @Short_Description: Group transitions together
- *
- * The #ClutterTransitionGroup allows running multiple #ClutterTransition
- * instances concurrently.
- *
- * The transitions inside a group will run within the boundaries of the
- * group; for instance, if a transition has a duration of 10 seconds, and
- * the group that contains it has a duration of 5 seconds, only the first
- * 5 seconds of the transition will be played.
- *
- * #ClutterTransitionGroup is available since Clutter 1.12
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-transition-group.h"
-
-#include "clutter-debug.h"
-#include "clutter-private.h"
-#include "clutter-timeline-private.h"
-
-struct _ClutterTransitionGroupPrivate
-{
- GHashTable *transitions;
-};
-
-G_DEFINE_TYPE_WITH_PRIVATE (ClutterTransitionGroup, clutter_transition_group, CLUTTER_TYPE_TRANSITION)
-
-static void
-clutter_transition_group_new_frame (ClutterTimeline *timeline,
- gint elapsed)
-{
- ClutterTransitionGroupPrivate *priv;
- GHashTableIter iter;
- gpointer element;
- gint64 msecs;
-
- priv = CLUTTER_TRANSITION_GROUP (timeline)->priv;
-
- /* get the time elapsed since the last ::new-frame... */
- msecs = clutter_timeline_get_delta (timeline);
-
- g_hash_table_iter_init (&iter, priv->transitions);
- while (g_hash_table_iter_next (&iter, &element, NULL))
- {
- ClutterTimeline *t = element;
-
- /* ... and advance every timeline */
- clutter_timeline_set_direction (t, clutter_timeline_get_direction (timeline));
- clutter_timeline_set_duration (t, clutter_timeline_get_duration (timeline));
-
- _clutter_timeline_advance (t, msecs);
- }
-}
-
-static void
-clutter_transition_group_attached (ClutterTransition *transition,
- ClutterAnimatable *animatable)
-{
- ClutterTransitionGroupPrivate *priv;
- GHashTableIter iter;
- gpointer element;
-
- priv = CLUTTER_TRANSITION_GROUP (transition)->priv;
-
- g_hash_table_iter_init (&iter, priv->transitions);
- while (g_hash_table_iter_next (&iter, &element, NULL))
- {
- ClutterTransition *t = element;
-
- clutter_transition_set_animatable (t, animatable);
- }
-}
-
-static void
-clutter_transition_group_detached (ClutterTransition *transition,
- ClutterAnimatable *animatable)
-{
- ClutterTransitionGroupPrivate *priv;
- GHashTableIter iter;
- gpointer element;
-
- priv = CLUTTER_TRANSITION_GROUP (transition)->priv;
-
- g_hash_table_iter_init (&iter, priv->transitions);
- while (g_hash_table_iter_next (&iter, &element, NULL))
- {
- ClutterTransition *t = element;
-
- clutter_transition_set_animatable (t, NULL);
- }
-}
-
-static void
-clutter_transition_group_started (ClutterTimeline *timeline)
-{
- ClutterTransitionGroupPrivate *priv;
- GHashTableIter iter;
- gpointer element;
-
- priv = CLUTTER_TRANSITION_GROUP (timeline)->priv;
-
- g_hash_table_iter_init (&iter, priv->transitions);
- while (g_hash_table_iter_next (&iter, &element, NULL))
- {
- ClutterTransition *t = element;
-
- g_signal_emit_by_name (t, "started");
- }
-}
-
-static void
-clutter_transition_group_finalize (GObject *gobject)
-{
- ClutterTransitionGroupPrivate *priv;
-
- priv = CLUTTER_TRANSITION_GROUP (gobject)->priv;
-
- g_hash_table_unref (priv->transitions);
-
- G_OBJECT_CLASS (clutter_transition_group_parent_class)->finalize (gobject);
-}
-
-static void
-clutter_transition_group_class_init (ClutterTransitionGroupClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- ClutterTimelineClass *timeline_class = CLUTTER_TIMELINE_CLASS (klass);
- ClutterTransitionClass *transition_class = CLUTTER_TRANSITION_CLASS (klass);
-
- gobject_class->finalize = clutter_transition_group_finalize;
-
- timeline_class->started = clutter_transition_group_started;
- timeline_class->new_frame = clutter_transition_group_new_frame;
-
- transition_class->attached = clutter_transition_group_attached;
- transition_class->detached = clutter_transition_group_detached;
-}
-
-static void
-clutter_transition_group_init (ClutterTransitionGroup *self)
-{
- self->priv = clutter_transition_group_get_instance_private (self);
- self->priv->transitions =
- g_hash_table_new_full (NULL, NULL, (GDestroyNotify) g_object_unref, NULL);
-}
-
-/**
- * clutter_transition_group_new:
- *
- * Creates a new #ClutterTransitionGroup instance.
- *
- * Return value: the newly created #ClutterTransitionGroup. Use
- * g_object_unref() when done to deallocate the resources it
- * uses
- *
- * Since: 1.12
- */
-ClutterTransition *
-clutter_transition_group_new (void)
-{
- return g_object_new (CLUTTER_TYPE_TRANSITION_GROUP, NULL);
-}
-
-/**
- * clutter_transition_group_add_transition:
- * @group: a #ClutterTransitionGroup
- * @transition: a #ClutterTransition
- *
- * Adds @transition to @group.
- *
- * This function acquires a reference on @transition that will be released
- * when calling clutter_transition_group_remove_transition().
- *
- * Since: 1.12
- */
-void
-clutter_transition_group_add_transition (ClutterTransitionGroup *group,
- ClutterTransition *transition)
-{
- g_return_if_fail (CLUTTER_IS_TRANSITION_GROUP (group));
- g_return_if_fail (CLUTTER_IS_TRANSITION (transition));
-
- g_hash_table_add (group->priv->transitions, g_object_ref (transition));
-}
-
-/**
- * clutter_transition_group_remove_transition:
- * @group: a #ClutterTransitionGroup
- * @transition: a #ClutterTransition
- *
- * Removes @transition from @group.
- *
- * This function releases the reference acquired on @transition when
- * calling clutter_transition_group_add_transition().
- *
- * Since: 1.12
- */
-void
-clutter_transition_group_remove_transition (ClutterTransitionGroup *group,
- ClutterTransition *transition)
-{
- g_return_if_fail (CLUTTER_IS_TRANSITION_GROUP (group));
-
- g_hash_table_remove (group->priv->transitions, transition);
-}
-
-/**
- * clutter_transition_group_remove_all:
- * @group: a #ClutterTransitionGroup
- *
- * Removes all transitions from @group.
- *
- * This function releases the reference acquired when calling
- * clutter_transition_group_add_transition().
- *
- * Since: 1.12
- */
-void
-clutter_transition_group_remove_all (ClutterTransitionGroup *group)
-{
- g_return_if_fail (CLUTTER_IS_TRANSITION_GROUP (group));
-
- g_hash_table_remove_all (group->priv->transitions);
-}
diff --git a/clutter/clutter/clutter-transition-group.h b/clutter/clutter/clutter-transition-group.h
deleted file mode 100644
index a98b7715c..000000000
--- a/clutter/clutter/clutter-transition-group.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2012 Intel Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author: Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_TRANSITION_GROUP_H__
-#define __CLUTTER_TRANSITION_GROUP_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-types.h>
-#include <clutter/clutter-transition.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_TRANSITION_GROUP (clutter_transition_group_get_type ())
-#define CLUTTER_TRANSITION_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_TRANSITION_GROUP, ClutterTransitionGroup))
-#define CLUTTER_IS_TRANSITION_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_TRANSITION_GROUP))
-#define CLUTTER_TRANSITION_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_TRANSITION_GROUP, ClutterTransitionGroupClass))
-#define CLUTTER_IS_TRANSITION_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_TRANSITION_GROUP))
-#define CLUTTER_TRANSITION_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_TRANSITION_GROUP, ClutterTransitionGroup))
-
-typedef struct _ClutterTransitionGroupPrivate ClutterTransitionGroupPrivate;
-typedef struct _ClutterTransitionGroupClass ClutterTransitionGroupClass;
-
-/**
- * ClutterTransitionGroup:
- *
- * The #ClutterTransitionGroup structure contains
- * private data and should only be accessed using the provided API.
- *
- * Since: 1.12
- */
-struct _ClutterTransitionGroup
-{
- /*< private >*/
- ClutterTransition parent_instance;
-
- ClutterTransitionGroupPrivate *priv;
-};
-
-/**
- * ClutterTransitionGroupClass:
- *
- * The #ClutterTransitionGroupClass structure
- * contains only private data.
- *
- * Since: 1.12
- */
-struct _ClutterTransitionGroupClass
-{
- /*< private >*/
- ClutterTransitionClass parent_class;
-
- gpointer _padding[8];
-};
-
-CLUTTER_EXPORT
-GType clutter_transition_group_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterTransition * clutter_transition_group_new (void);
-
-CLUTTER_EXPORT
-void clutter_transition_group_add_transition (ClutterTransitionGroup *group,
- ClutterTransition *transition);
-CLUTTER_EXPORT
-void clutter_transition_group_remove_transition (ClutterTransitionGroup *group,
- ClutterTransition *transition);
-CLUTTER_EXPORT
-void clutter_transition_group_remove_all (ClutterTransitionGroup *group);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_TRANSITION_GROUP_H__ */
diff --git a/clutter/clutter/clutter-transition.c b/clutter/clutter/clutter-transition.c
deleted file mode 100644
index 146c52546..000000000
--- a/clutter/clutter/clutter-transition.c
+++ /dev/null
@@ -1,684 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2012 Intel Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author: Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-transition
- * @Title: ClutterTransition
- * @Short_Description: Transition between two values
- *
- * #ClutterTransition is an abstract subclass of #ClutterTimeline that
- * computes the interpolation between two values, stored by a #ClutterInterval.
- */
-
-#include "clutter-build-config.h"
-
-#include "clutter-transition.h"
-
-#include "clutter-animatable.h"
-#include "clutter-debug.h"
-#include "clutter-interval.h"
-#include "clutter-private.h"
-#include "clutter-timeline.h"
-
-#include <gobject/gvaluecollector.h>
-
-struct _ClutterTransitionPrivate
-{
- ClutterInterval *interval;
- ClutterAnimatable *animatable;
-
- guint remove_on_complete : 1;
-};
-
-enum
-{
- PROP_0,
-
- PROP_INTERVAL,
- PROP_ANIMATABLE,
- PROP_REMOVE_ON_COMPLETE,
-
- PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST] = { NULL, };
-
-static GQuark quark_animatable_set = 0;
-
-G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterTransition, clutter_transition, CLUTTER_TYPE_TIMELINE)
-
-static void
-clutter_transition_attach (ClutterTransition *transition,
- ClutterAnimatable *animatable)
-{
- CLUTTER_TRANSITION_GET_CLASS (transition)->attached (transition, animatable);
-}
-
-static void
-clutter_transition_detach (ClutterTransition *transition,
- ClutterAnimatable *animatable)
-{
- CLUTTER_TRANSITION_GET_CLASS (transition)->detached (transition, animatable);
-}
-
-static void
-clutter_transition_real_compute_value (ClutterTransition *transition,
- ClutterAnimatable *animatable,
- ClutterInterval *interval,
- gdouble progress)
-{
-}
-
-static void
-clutter_transition_real_attached (ClutterTransition *transition,
- ClutterAnimatable *animatable)
-{
-}
-
-static void
-clutter_transition_real_detached (ClutterTransition *transition,
- ClutterAnimatable *animatable)
-{
-}
-
-static void
-clutter_transition_new_frame (ClutterTimeline *timeline,
- gint elapsed G_GNUC_UNUSED)
-{
- ClutterTransition *transition = CLUTTER_TRANSITION (timeline);
- ClutterTransitionPrivate *priv = transition->priv;
- gdouble progress;
-
- if (priv->interval == NULL ||
- priv->animatable == NULL)
- return;
-
- progress = clutter_timeline_get_progress (timeline);
-
- CLUTTER_TRANSITION_GET_CLASS (timeline)->compute_value (transition,
- priv->animatable,
- priv->interval,
- progress);
-}
-
-static void
-clutter_transition_stopped (ClutterTimeline *timeline,
- gboolean is_finished)
-{
- ClutterTransitionPrivate *priv = CLUTTER_TRANSITION (timeline)->priv;
-
- if (is_finished &&
- priv->animatable != NULL &&
- priv->remove_on_complete)
- {
- clutter_transition_detach (CLUTTER_TRANSITION (timeline),
- priv->animatable);
- g_clear_object (&priv->animatable);
- }
-}
-
-static void
-clutter_transition_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterTransition *transition = CLUTTER_TRANSITION (gobject);
-
- switch (prop_id)
- {
- case PROP_INTERVAL:
- clutter_transition_set_interval (transition, g_value_get_object (value));
- break;
-
- case PROP_ANIMATABLE:
- clutter_transition_set_animatable (transition, g_value_get_object (value));
- break;
-
- case PROP_REMOVE_ON_COMPLETE:
- clutter_transition_set_remove_on_complete (transition, g_value_get_boolean (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_transition_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterTransitionPrivate *priv = CLUTTER_TRANSITION (gobject)->priv;
-
- switch (prop_id)
- {
- case PROP_INTERVAL:
- g_value_set_object (value, priv->interval);
- break;
-
- case PROP_ANIMATABLE:
- g_value_set_object (value, priv->animatable);
- break;
-
- case PROP_REMOVE_ON_COMPLETE:
- g_value_set_boolean (value, priv->remove_on_complete);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_transition_dispose (GObject *gobject)
-{
- ClutterTransitionPrivate *priv = CLUTTER_TRANSITION (gobject)->priv;
-
- if (priv->animatable != NULL)
- clutter_transition_detach (CLUTTER_TRANSITION (gobject),
- priv->animatable);
-
- g_clear_object (&priv->interval);
- g_clear_object (&priv->animatable);
-
- G_OBJECT_CLASS (clutter_transition_parent_class)->dispose (gobject);
-}
-
-static void
-clutter_transition_class_init (ClutterTransitionClass *klass)
-{
- ClutterTimelineClass *timeline_class = CLUTTER_TIMELINE_CLASS (klass);
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- quark_animatable_set =
- g_quark_from_static_string ("-clutter-transition-animatable-set");
-
- klass->compute_value = clutter_transition_real_compute_value;
- klass->attached = clutter_transition_real_attached;
- klass->detached = clutter_transition_real_detached;
-
- timeline_class->new_frame = clutter_transition_new_frame;
- timeline_class->stopped = clutter_transition_stopped;
-
- gobject_class->set_property = clutter_transition_set_property;
- gobject_class->get_property = clutter_transition_get_property;
- gobject_class->dispose = clutter_transition_dispose;
-
- /**
- * ClutterTransition:interval:
- *
- * The #ClutterInterval used to describe the initial and final states
- * of the transition.
- *
- * Since: 1.10
- */
- obj_props[PROP_INTERVAL] =
- g_param_spec_object ("interval",
- P_("Interval"),
- P_("The interval of values to transition"),
- CLUTTER_TYPE_INTERVAL,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
-
- /**
- * ClutterTransition:animatable:
- *
- * The #ClutterAnimatable instance currently being animated.
- *
- * Since: 1.10
- */
- obj_props[PROP_ANIMATABLE] =
- g_param_spec_object ("animatable",
- P_("Animatable"),
- P_("The animatable object"),
- CLUTTER_TYPE_ANIMATABLE,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
-
- /**
- * ClutterTransition:remove-on-complete:
- *
- * Whether the #ClutterTransition should be automatically detached
- * from the #ClutterTransition:animatable instance whenever the
- * #ClutterTimeline::stopped signal is emitted.
- *
- * The #ClutterTransition:remove-on-complete property takes into
- * account the value of the #ClutterTimeline:repeat-count property,
- * and it only detaches the transition if the transition is not
- * repeating.
- *
- * Since: 1.10
- */
- obj_props[PROP_REMOVE_ON_COMPLETE] =
- g_param_spec_boolean ("remove-on-complete",
- P_("Remove on Complete"),
- P_("Detach the transition when completed"),
- FALSE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
-}
-
-static void
-clutter_transition_init (ClutterTransition *self)
-{
- self->priv = clutter_transition_get_instance_private (self);
-}
-
-/**
- * clutter_transition_set_interval:
- * @transition: a #ClutterTransition
- * @interval: (allow-none): a #ClutterInterval, or %NULL
- *
- * Sets the #ClutterTransition:interval property using @interval.
- *
- * The @transition will acquire a reference on the @interval, sinking
- * the floating flag on it if necessary.
- *
- * Since: 1.10
- */
-void
-clutter_transition_set_interval (ClutterTransition *transition,
- ClutterInterval *interval)
-{
- ClutterTransitionPrivate *priv;
-
- g_return_if_fail (CLUTTER_IS_TRANSITION (transition));
- g_return_if_fail (interval == NULL || CLUTTER_IS_INTERVAL (interval));
-
- priv = transition->priv;
-
- if (priv->interval == interval)
- return;
-
- g_clear_object (&priv->interval);
-
- if (interval != NULL)
- priv->interval = g_object_ref_sink (interval);
-
- g_object_notify_by_pspec (G_OBJECT (transition), obj_props[PROP_INTERVAL]);
-}
-
-/**
- * clutter_transition_get_interval:
- * @transition: a #ClutterTransition
- *
- * Retrieves the interval set using clutter_transition_set_interval()
- *
- * Return value: (transfer none): a #ClutterInterval, or %NULL; the returned
- * interval is owned by the #ClutterTransition and it should not be freed
- * directly
- *
- * Since: 1.10
- */
-ClutterInterval *
-clutter_transition_get_interval (ClutterTransition *transition)
-{
- g_return_val_if_fail (CLUTTER_IS_TRANSITION (transition), NULL);
-
- return transition->priv->interval;
-}
-
-/**
- * clutter_transition_set_animatable:
- * @transition: a #ClutterTransition
- * @animatable: (allow-none): a #ClutterAnimatable, or %NULL
- *
- * Sets the #ClutterTransition:animatable property.
- *
- * The @transition will acquire a reference to the @animatable instance,
- * and will call the #ClutterTransitionClass.attached() virtual function.
- *
- * If an existing #ClutterAnimatable is attached to @transition, the
- * reference will be released, and the #ClutterTransitionClass.detached()
- * virtual function will be called.
- *
- * Since: 1.10
- */
-void
-clutter_transition_set_animatable (ClutterTransition *transition,
- ClutterAnimatable *animatable)
-{
- ClutterTransitionPrivate *priv;
- ClutterActor *actor;
-
- g_return_if_fail (CLUTTER_IS_TRANSITION (transition));
- g_return_if_fail (animatable == NULL || CLUTTER_IS_ANIMATABLE (animatable));
-
- priv = transition->priv;
-
- if (priv->animatable == animatable)
- return;
-
- if (priv->animatable != NULL)
- clutter_transition_detach (transition, priv->animatable);
-
- g_clear_object (&priv->animatable);
-
- if (animatable != NULL)
- {
- priv->animatable = g_object_ref (animatable);
- clutter_transition_attach (transition, priv->animatable);
- }
-
- actor = clutter_animatable_get_actor (animatable);
- clutter_timeline_set_actor (CLUTTER_TIMELINE (transition), actor);
-}
-
-/**
- * clutter_transition_get_animatable:
- * @transition: a #ClutterTransition
- *
- * Retrieves the #ClutterAnimatable set using clutter_transition_set_animatable().
- *
- * Return value: (transfer none): a #ClutterAnimatable, or %NULL; the returned
- * animatable is owned by the #ClutterTransition, and it should not be freed
- * directly.
- *
- * Since: 1.10
- */
-ClutterAnimatable *
-clutter_transition_get_animatable (ClutterTransition *transition)
-{
- g_return_val_if_fail (CLUTTER_IS_TRANSITION (transition), NULL);
-
- return transition->priv->animatable;
-}
-
-/**
- * clutter_transition_set_remove_on_complete:
- * @transition: a #ClutterTransition
- * @remove_complete: whether to detach @transition when complete
- *
- * Sets whether @transition should be detached from the #ClutterAnimatable
- * set using clutter_transition_set_animatable() when the
- * #ClutterTimeline::completed signal is emitted.
- *
- * Since: 1.10
- */
-void
-clutter_transition_set_remove_on_complete (ClutterTransition *transition,
- gboolean remove_complete)
-{
- g_return_if_fail (CLUTTER_IS_TRANSITION (transition));
-
- remove_complete = !!remove_complete;
-
- if (transition->priv->remove_on_complete == remove_complete)
- return;
-
- transition->priv->remove_on_complete = remove_complete;
-
- g_object_notify_by_pspec (G_OBJECT (transition),
- obj_props[PROP_REMOVE_ON_COMPLETE]);
-}
-
-/**
- * clutter_transition_get_remove_on_complete:
- * @transition: a #ClutterTransition
- *
- * Retrieves the value of the #ClutterTransition:remove-on-complete property.
- *
- * Return value: %TRUE if the @transition should be detached when complete,
- * and %FALSE otherwise
- *
- * Since: 1.10
- */
-gboolean
-clutter_transition_get_remove_on_complete (ClutterTransition *transition)
-{
- g_return_val_if_fail (CLUTTER_IS_TRANSITION (transition), FALSE);
-
- return transition->priv->remove_on_complete;
-}
-
-typedef void (* IntervalSetFunc) (ClutterInterval *interval,
- const GValue *value);
-
-static inline void
-clutter_transition_set_value (ClutterTransition *transition,
- IntervalSetFunc interval_set_func,
- const GValue *value)
-{
- ClutterTransitionPrivate *priv = transition->priv;
- GType interval_type;
-
- if (priv->interval == NULL)
- {
- priv->interval = clutter_interval_new_with_values (G_VALUE_TYPE (value),
- NULL,
- NULL);
- g_object_ref_sink (priv->interval);
- }
-
- interval_type = clutter_interval_get_value_type (priv->interval);
-
- if (!g_type_is_a (G_VALUE_TYPE (value), interval_type))
- {
- if (g_value_type_compatible (G_VALUE_TYPE (value), interval_type))
- {
- interval_set_func (priv->interval, value);
- return;
- }
-
- if (g_value_type_transformable (G_VALUE_TYPE (value), interval_type))
- {
- GValue transform = G_VALUE_INIT;
-
- g_value_init (&transform, interval_type);
- if (g_value_transform (value, &transform))
- interval_set_func (priv->interval, &transform);
- else
- {
- g_warning ("%s: Unable to convert a value of type '%s' into "
- "the value type '%s' of the interval used by the "
- "transition.",
- G_STRLOC,
- g_type_name (G_VALUE_TYPE (value)),
- g_type_name (interval_type));
- }
-
- g_value_unset (&transform);
- }
- }
- else
- interval_set_func (priv->interval, value);
-}
-
-/**
- * clutter_transition_set_from_value: (rename-to clutter_transition_set_from)
- * @transition: a #ClutterTransition
- * @value: a #GValue with the initial value of the transition
- *
- * Sets the initial value of the transition.
- *
- * This is a convenience function that will either create the
- * #ClutterInterval used by @transition, or will update it if
- * the #ClutterTransition:interval is already set.
- *
- * This function will copy the contents of @value, so it is
- * safe to call g_value_unset() after it returns.
- *
- * If @transition already has a #ClutterTransition:interval set,
- * then @value must hold the same type, or a transformable type,
- * as the interval's #ClutterInterval:value-type property.
- *
- * This function is meant to be used by language bindings.
- *
- * Since: 1.12
- */
-void
-clutter_transition_set_from_value (ClutterTransition *transition,
- const GValue *value)
-{
- g_return_if_fail (CLUTTER_IS_TRANSITION (transition));
- g_return_if_fail (G_IS_VALUE (value));
-
- clutter_transition_set_value (transition,
- clutter_interval_set_initial_value,
- value);
-}
-
-/**
- * clutter_transition_set_to_value: (rename-to clutter_transition_set_to)
- * @transition: a #ClutterTransition
- * @value: a #GValue with the final value of the transition
- *
- * Sets the final value of the transition.
- *
- * This is a convenience function that will either create the
- * #ClutterInterval used by @transition, or will update it if
- * the #ClutterTransition:interval is already set.
- *
- * This function will copy the contents of @value, so it is
- * safe to call g_value_unset() after it returns.
- *
- * If @transition already has a #ClutterTransition:interval set,
- * then @value must hold the same type, or a transformable type,
- * as the interval's #ClutterInterval:value-type property.
- *
- * This function is meant to be used by language bindings.
- *
- * Since: 1.12
- */
-void
-clutter_transition_set_to_value (ClutterTransition *transition,
- const GValue *value)
-{
- g_return_if_fail (CLUTTER_IS_TRANSITION (transition));
- g_return_if_fail (G_IS_VALUE (value));
-
- clutter_transition_set_value (transition,
- clutter_interval_set_final_value,
- value);
-}
-
-/**
- * clutter_transition_set_from: (skip)
- * @transition: a #ClutterTransition
- * @value_type: the type of the value to set
- * @...: the initial value
- *
- * Sets the initial value of the transition.
- *
- * This is a convenience function that will either create the
- * #ClutterInterval used by @transition, or will update it if
- * the #ClutterTransition:interval is already set.
- *
- * If @transition already has a #ClutterTransition:interval set,
- * then @value must hold the same type, or a transformable type,
- * as the interval's #ClutterInterval:value-type property.
- *
- * This is a convenience function for the C API; language bindings
- * should use clutter_transition_set_from_value() instead.
- *
- * Since: 1.12
- */
-void
-clutter_transition_set_from (ClutterTransition *transition,
- GType value_type,
- ...)
-{
- GValue value = G_VALUE_INIT;
- gchar *error = NULL;
- va_list args;
-
- g_return_if_fail (CLUTTER_IS_TRANSITION (transition));
- g_return_if_fail (value_type != G_TYPE_INVALID);
-
- va_start (args, value_type);
-
- G_VALUE_COLLECT_INIT (&value, value_type, args, 0, &error);
-
- va_end (args);
-
- if (error != NULL)
- {
- g_warning ("%s: %s", G_STRLOC, error);
- g_free (error);
- return;
- }
-
- clutter_transition_set_value (transition,
- clutter_interval_set_initial_value,
- &value);
-
- g_value_unset (&value);
-}
-
-/**
- * clutter_transition_set_to: (skip)
- * @transition: a #ClutterTransition
- * @value_type: the type of the value to set
- * @...: the final value
- *
- * Sets the final value of the transition.
- *
- * This is a convenience function that will either create the
- * #ClutterInterval used by @transition, or will update it if
- * the #ClutterTransition:interval is already set.
- *
- * If @transition already has a #ClutterTransition:interval set,
- * then @value must hold the same type, or a transformable type,
- * as the interval's #ClutterInterval:value-type property.
- *
- * This is a convenience function for the C API; language bindings
- * should use clutter_transition_set_to_value() instead.
- *
- * Since: 1.12
- */
-void
-clutter_transition_set_to (ClutterTransition *transition,
- GType value_type,
- ...)
-{
- GValue value = G_VALUE_INIT;
- gchar *error = NULL;
- va_list args;
-
- g_return_if_fail (CLUTTER_IS_TRANSITION (transition));
- g_return_if_fail (value_type != G_TYPE_INVALID);
-
- va_start (args, value_type);
-
- G_VALUE_COLLECT_INIT (&value, value_type, args, 0, &error);
-
- va_end (args);
-
- if (error != NULL)
- {
- g_warning ("%s: %s", G_STRLOC, error);
- g_free (error);
- return;
- }
-
- clutter_transition_set_value (transition,
- clutter_interval_set_final_value,
- &value);
-
- g_value_unset (&value);
-}
diff --git a/clutter/clutter/clutter-transition.h b/clutter/clutter/clutter-transition.h
deleted file mode 100644
index 6f8e4dc1a..000000000
--- a/clutter/clutter/clutter-transition.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2012 Intel Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author: Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#ifndef __CLUTTER_TRANSITION_H__
-#define __CLUTTER_TRANSITION_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-types.h>
-#include <clutter/clutter-timeline.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_TRANSITION (clutter_transition_get_type ())
-#define CLUTTER_TRANSITION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_TRANSITION, ClutterTransition))
-#define CLUTTER_IS_TRANSITION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_TRANSITION))
-#define CLUTTER_TRANSITION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_TRANSITION, ClutterTransitionClass))
-#define CLUTTER_IS_TRANSITION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_TRANSITION))
-#define CLUTTER_TRANSITION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_TRANSITION, ClutterTransitionClass))
-
-typedef struct _ClutterTransitionPrivate ClutterTransitionPrivate;
-typedef struct _ClutterTransitionClass ClutterTransitionClass;
-
-/**
- * ClutterTransition:
- *
- * The #ClutterTransition structure contains private
- * data and should only be accessed using the provided API.
- *
- * Since: 1.10
- */
-struct _ClutterTransition
-{
- /*< private >*/
- ClutterTimeline parent_instance;
-
- ClutterTransitionPrivate *priv;
-};
-
-/**
- * ClutterTransitionClass:
- * @attached: virtual function; called when a transition is attached to
- * a #ClutterAnimatable instance
- * @detached: virtual function; called when a transition is detached from
- * a #ClutterAnimatable instance
- * @compute_value: virtual function; called each frame to compute and apply
- * the interpolation of the interval
- *
- * The #ClutterTransitionClass structure contains
- * private data.
- *
- * Since: 1.10
- */
-struct _ClutterTransitionClass
-{
- /*< private >*/
- ClutterTimelineClass parent_class;
-
- /*< public >*/
- void (* attached) (ClutterTransition *transition,
- ClutterAnimatable *animatable);
- void (* detached) (ClutterTransition *transition,
- ClutterAnimatable *animatable);
-
- void (* compute_value) (ClutterTransition *transition,
- ClutterAnimatable *animatable,
- ClutterInterval *interval,
- gdouble progress);
-
- /*< private >*/
- gpointer _padding[8];
-};
-
-CLUTTER_EXPORT
-GType clutter_transition_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-void clutter_transition_set_interval (ClutterTransition *transition,
- ClutterInterval *interval);
-CLUTTER_EXPORT
-ClutterInterval * clutter_transition_get_interval (ClutterTransition *transition);
-CLUTTER_EXPORT
-void clutter_transition_set_from_value (ClutterTransition *transition,
- const GValue *value);
-CLUTTER_EXPORT
-void clutter_transition_set_to_value (ClutterTransition *transition,
- const GValue *value);
-CLUTTER_EXPORT
-void clutter_transition_set_from (ClutterTransition *transition,
- GType value_type,
- ...);
-CLUTTER_EXPORT
-void clutter_transition_set_to (ClutterTransition *transition,
- GType value_type,
- ...);
-
-CLUTTER_EXPORT
-void clutter_transition_set_animatable (ClutterTransition *transition,
- ClutterAnimatable *animatable);
-CLUTTER_EXPORT
-ClutterAnimatable * clutter_transition_get_animatable (ClutterTransition *transition);
-CLUTTER_EXPORT
-void clutter_transition_set_remove_on_complete (ClutterTransition *transition,
- gboolean remove_complete);
-CLUTTER_EXPORT
-gboolean clutter_transition_get_remove_on_complete (ClutterTransition *transition);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_TRANSITION_H__ */
diff --git a/clutter/clutter/clutter-types.h b/clutter/clutter/clutter-types.h
deleted file mode 100644
index 569e36604..000000000
--- a/clutter/clutter/clutter-types.h
+++ /dev/null
@@ -1,435 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- *
- * Copyright (C) 2006 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 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_TYPES_H__
-#define __CLUTTER_TYPES_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <cairo.h>
-#include <cogl/cogl.h>
-#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_KNOT (clutter_knot_get_type ())
-#define CLUTTER_TYPE_MARGIN (clutter_margin_get_type ())
-#define CLUTTER_TYPE_PAINT_VOLUME (clutter_paint_volume_get_type ())
-#define CLUTTER_TYPE_PERSPECTIVE (clutter_perspective_get_type ())
-
-typedef struct _ClutterActor ClutterActor;
-
-typedef struct _ClutterStage ClutterStage;
-typedef struct _ClutterFrame ClutterFrame;
-typedef struct _ClutterFrameInfo ClutterFrameInfo;
-typedef struct _ClutterContainer ClutterContainer; /* dummy */
-typedef struct _ClutterChildMeta ClutterChildMeta;
-typedef struct _ClutterLayoutMeta ClutterLayoutMeta;
-typedef struct _ClutterActorMeta ClutterActorMeta;
-typedef struct _ClutterLayoutManager ClutterLayoutManager;
-typedef struct _ClutterActorIter ClutterActorIter;
-typedef struct _ClutterPaintNode ClutterPaintNode;
-typedef struct _ClutterContent ClutterContent; /* dummy */
-typedef struct _ClutterScrollActor ClutterScrollActor;
-typedef struct _ClutterFrameClock ClutterFrameClock;
-
-typedef struct _ClutterInterval ClutterInterval;
-typedef struct _ClutterAnimatable ClutterAnimatable; /* dummy */
-typedef struct _ClutterTimeline ClutterTimeline;
-typedef struct _ClutterTransition ClutterTransition;
-typedef struct _ClutterPropertyTransition ClutterPropertyTransition;
-typedef struct _ClutterKeyframeTransition ClutterKeyframeTransition;
-typedef struct _ClutterTransitionGroup ClutterTransitionGroup;
-
-typedef struct _ClutterAction ClutterAction;
-typedef struct _ClutterConstraint ClutterConstraint;
-typedef struct _ClutterEffect ClutterEffect;
-
-typedef struct _ClutterPath ClutterPath;
-typedef struct _ClutterPathNode ClutterPathNode;
-
-typedef struct _ClutterActorBox ClutterActorBox;
-typedef struct _ClutterColor ClutterColor;
-typedef struct _ClutterKnot ClutterKnot;
-typedef struct _ClutterMargin ClutterMargin;
-typedef struct _ClutterPerspective ClutterPerspective;
-
-typedef struct _ClutterInputDeviceTool ClutterInputDeviceTool;
-typedef struct _ClutterInputDevice ClutterInputDevice;
-typedef struct _ClutterVirtualInputDevice ClutterVirtualInputDevice;
-
-typedef struct _ClutterInputMethod ClutterInputMethod;
-typedef struct _ClutterInputFocus ClutterInputFocus;
-
-typedef union _ClutterEvent ClutterEvent;
-
-/**
- * ClutterEventSequence:
- *
- * The #ClutterEventSequence structure is an opaque
- * type used to denote the event sequence of a touch event.
- *
- * Since: 1.12
- */
-typedef struct _ClutterEventSequence ClutterEventSequence;
-
-typedef struct _ClutterShader ClutterShader; /* deprecated */
-
-/**
- * ClutterPaintVolume:
- *
- * #ClutterPaintVolume is an opaque structure
- * whose members cannot be directly accessed.
- *
- * A #ClutterPaintVolume represents an
- * a bounding volume whose internal representation isn't defined but
- * can be set and queried in terms of an axis aligned bounding box.
- *
- * A #ClutterPaintVolume for a #ClutterActor
- * is defined to be relative from the current actor modelview matrix.
- *
- * Other internal representation and methods for describing the
- * bounding volume may be added in the future.
- *
- * Since: 1.4
- */
-typedef struct _ClutterPaintVolume ClutterPaintVolume;
-
-/**
- * ClutterActorBox:
- * @x1: X coordinate of the top left corner
- * @y1: Y coordinate of the top left corner
- * @x2: X coordinate of the bottom right corner
- * @y2: Y coordinate of the bottom right corner
- *
- * Bounding box of an actor. The coordinates of the top left and right bottom
- * corners of an actor. The coordinates of the two points are expressed in
- * pixels with sub-pixel precision
- */
-struct _ClutterActorBox
-{
- gfloat x1;
- gfloat y1;
-
- gfloat x2;
- gfloat y2;
-};
-
-/**
- * CLUTTER_ACTOR_BOX_INIT:
- * @x_1: the X coordinate of the top left corner
- * @y_1: the Y coordinate of the top left corner
- * @x_2: the X coordinate of the bottom right corner
- * @y_2: the Y coordinate of the bottom right corner
- *
- * A simple macro for initializing a #ClutterActorBox when declaring
- * it, e.g.:
- *
- * |[
- * ClutterActorBox box = CLUTTER_ACTOR_BOX_INIT (0, 0, 400, 600);
- * ]|
- *
- * Since: 1.10
- */
-#define CLUTTER_ACTOR_BOX_INIT(x_1,y_1,x_2,y_2) { (x_1), (y_1), (x_2), (y_2) }
-
-/**
- * CLUTTER_ACTOR_BOX_INIT_ZERO:
- *
- * A simple macro for initializing a #ClutterActorBox to 0 when
- * declaring it, e.g.:
- *
- * |[
- * ClutterActorBox box = CLUTTER_ACTOR_BOX_INIT_ZERO;
- * ]|
- *
- * Since: 1.12
- */
-#define CLUTTER_ACTOR_BOX_INIT_ZERO CLUTTER_ACTOR_BOX_INIT (0.f, 0.f, 0.f, 0.f)
-
-/**
- * CLUTTER_ACTOR_BOX_UNINITIALIZED:
- *
- * A simple macro for creating a #ClutterActorBox with a size of -1 when
- * declaring it, e.g.:
- *
- * |[
- * ClutterActorBox box = CLUTTER_ACTOR_BOX_UNINITIALIZED;
- * ]|
- */
-
-
-#define CLUTTER_ACTOR_BOX_UNINITIALIZED { .x1 = INFINITY, .y1 = INFINITY, .x2 = -INFINITY, .y2 = -INFINITY }
-
-CLUTTER_EXPORT
-GType clutter_actor_box_get_type (void) G_GNUC_CONST;
-CLUTTER_EXPORT
-ClutterActorBox *clutter_actor_box_new (gfloat x_1,
- gfloat y_1,
- gfloat x_2,
- gfloat y_2);
-CLUTTER_EXPORT
-ClutterActorBox *clutter_actor_box_alloc (void);
-CLUTTER_EXPORT
-ClutterActorBox *clutter_actor_box_init (ClutterActorBox *box,
- gfloat x_1,
- gfloat y_1,
- gfloat x_2,
- gfloat y_2);
-CLUTTER_EXPORT
-void clutter_actor_box_init_rect (ClutterActorBox *box,
- gfloat x,
- gfloat y,
- gfloat width,
- gfloat height);
-CLUTTER_EXPORT
-ClutterActorBox *clutter_actor_box_copy (const ClutterActorBox *box);
-CLUTTER_EXPORT
-void clutter_actor_box_free (ClutterActorBox *box);
-CLUTTER_EXPORT
-gboolean clutter_actor_box_equal (const ClutterActorBox *box_a,
- const ClutterActorBox *box_b);
-CLUTTER_EXPORT
-gfloat clutter_actor_box_get_x (const ClutterActorBox *box);
-CLUTTER_EXPORT
-gfloat clutter_actor_box_get_y (const ClutterActorBox *box);
-CLUTTER_EXPORT
-gfloat clutter_actor_box_get_width (const ClutterActorBox *box);
-CLUTTER_EXPORT
-gfloat clutter_actor_box_get_height (const ClutterActorBox *box);
-CLUTTER_EXPORT
-void clutter_actor_box_get_origin (const ClutterActorBox *box,
- gfloat *x,
- gfloat *y);
-CLUTTER_EXPORT
-void clutter_actor_box_get_size (const ClutterActorBox *box,
- gfloat *width,
- gfloat *height);
-CLUTTER_EXPORT
-gfloat clutter_actor_box_get_area (const ClutterActorBox *box);
-CLUTTER_EXPORT
-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[]);
-CLUTTER_EXPORT
-void clutter_actor_box_interpolate (const ClutterActorBox *initial,
- const ClutterActorBox *final,
- gdouble progress,
- ClutterActorBox *result);
-CLUTTER_EXPORT
-void clutter_actor_box_clamp_to_pixel (ClutterActorBox *box);
-CLUTTER_EXPORT
-void clutter_actor_box_union (const ClutterActorBox *a,
- const ClutterActorBox *b,
- ClutterActorBox *result);
-
-CLUTTER_EXPORT
-void clutter_actor_box_set_origin (ClutterActorBox *box,
- gfloat x,
- gfloat y);
-CLUTTER_EXPORT
-void clutter_actor_box_set_size (ClutterActorBox *box,
- gfloat width,
- gfloat height);
-
-CLUTTER_EXPORT
-void clutter_actor_box_scale (ClutterActorBox *box,
- gfloat scale);
-
-CLUTTER_EXPORT
-gboolean clutter_actor_box_is_initialized (ClutterActorBox *box);
-
-/**
- * ClutterKnot:
- * @x: X coordinate of the knot
- * @y: Y coordinate of the knot
- *
- * Point in a path behaviour.
- *
- * Since: 0.2
- */
-struct _ClutterKnot
-{
- gint x;
- gint y;
-};
-
-CLUTTER_EXPORT
-GType clutter_knot_get_type (void) G_GNUC_CONST;
-CLUTTER_EXPORT
-ClutterKnot *clutter_knot_copy (const ClutterKnot *knot);
-CLUTTER_EXPORT
-void clutter_knot_free (ClutterKnot *knot);
-CLUTTER_EXPORT
-gboolean clutter_knot_equal (const ClutterKnot *knot_a,
- const ClutterKnot *knot_b);
-
-/**
- * ClutterPathNode:
- * @type: the node's type
- * @points: the coordinates of the node
- *
- * Represents a single node of a #ClutterPath.
- *
- * Some of the coordinates in @points may be unused for some node
- * types. %CLUTTER_PATH_MOVE_TO and %CLUTTER_PATH_LINE_TO use only one
- * pair of coordinates, %CLUTTER_PATH_CURVE_TO uses all three and
- * %CLUTTER_PATH_CLOSE uses none.
- *
- * Since: 1.0
- */
-struct _ClutterPathNode
-{
- ClutterPathNodeType type;
-
- ClutterKnot points[3];
-};
-
-CLUTTER_EXPORT
-GType clutter_path_node_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterPathNode *clutter_path_node_copy (const ClutterPathNode *node);
-CLUTTER_EXPORT
-void clutter_path_node_free (ClutterPathNode *node);
-CLUTTER_EXPORT
-gboolean clutter_path_node_equal (const ClutterPathNode *node_a,
- const ClutterPathNode *node_b);
-
-/*
- * ClutterPaintVolume
- */
-
-CLUTTER_EXPORT
-GType clutter_paint_volume_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterPaintVolume *clutter_paint_volume_copy (const ClutterPaintVolume *pv);
-CLUTTER_EXPORT
-void clutter_paint_volume_free (ClutterPaintVolume *pv);
-
-CLUTTER_EXPORT
-void clutter_paint_volume_set_origin (ClutterPaintVolume *pv,
- const graphene_point3d_t *origin);
-CLUTTER_EXPORT
-void clutter_paint_volume_get_origin (const ClutterPaintVolume *pv,
- graphene_point3d_t *vertex);
-CLUTTER_EXPORT
-void clutter_paint_volume_set_width (ClutterPaintVolume *pv,
- gfloat width);
-CLUTTER_EXPORT
-gfloat clutter_paint_volume_get_width (const ClutterPaintVolume *pv);
-CLUTTER_EXPORT
-void clutter_paint_volume_set_height (ClutterPaintVolume *pv,
- gfloat height);
-CLUTTER_EXPORT
-gfloat clutter_paint_volume_get_height (const ClutterPaintVolume *pv);
-CLUTTER_EXPORT
-void clutter_paint_volume_set_depth (ClutterPaintVolume *pv,
- gfloat depth);
-CLUTTER_EXPORT
-gfloat clutter_paint_volume_get_depth (const ClutterPaintVolume *pv);
-CLUTTER_EXPORT
-void clutter_paint_volume_union (ClutterPaintVolume *pv,
- const ClutterPaintVolume *another_pv);
-CLUTTER_EXPORT
-void clutter_paint_volume_union_box (ClutterPaintVolume *pv,
- const ClutterActorBox *box);
-
-CLUTTER_EXPORT
-gboolean clutter_paint_volume_set_from_allocation (ClutterPaintVolume *pv,
- ClutterActor *actor);
-
-/**
- * ClutterMargin:
- * @left: the margin from the left
- * @right: the margin from the right
- * @top: the margin from the top
- * @bottom: the margin from the bottom
- *
- * A representation of the components of a margin.
- *
- * Since: 1.10
- */
-struct _ClutterMargin
-{
- float left;
- float right;
- float top;
- float bottom;
-};
-
-CLUTTER_EXPORT
-GType clutter_margin_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterMargin * clutter_margin_new (void) G_GNUC_MALLOC;
-CLUTTER_EXPORT
-ClutterMargin * clutter_margin_copy (const ClutterMargin *margin_);
-CLUTTER_EXPORT
-void clutter_margin_free (ClutterMargin *margin_);
-
-/**
- * ClutterProgressFunc:
- * @a: the initial value of an interval
- * @b: the final value of an interval
- * @progress: the progress factor, between 0 and 1
- * @retval: the value used to store the progress
- *
- * Prototype of the progress function used to compute the value
- * between the two ends @a and @b of an interval depending on
- * the value of @progress.
- *
- * The #GValue in @retval is already initialized with the same
- * type as @a and @b.
- *
- * This function will be called by #ClutterInterval if the
- * type of the values of the interval was registered using
- * clutter_interval_register_progress_func().
- *
- * Return value: %TRUE if the function successfully computed
- * the value and stored it inside @retval
- *
- * Since: 1.0
- */
-typedef gboolean (* ClutterProgressFunc) (const GValue *a,
- const GValue *b,
- gdouble progress,
- GValue *retval);
-
-CLUTTER_EXPORT
-void clutter_interval_register_progress_func (GType value_type,
- ClutterProgressFunc func);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_TYPES_H__ */
diff --git a/clutter/clutter/clutter-units.c b/clutter/clutter/clutter-units.c
deleted file mode 100644
index a5f582471..000000000
--- a/clutter/clutter/clutter-units.c
+++ /dev/null
@@ -1,932 +0,0 @@
-/* -*- mode:C; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By: Tomas Frydrych <tf@openedhand.com>
- * Emmanuele Bassi <ebassi@openedhand.com>
- *
- * Copyright (C) 2007 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- *
- */
-
-/**
- * SECTION:clutter-units
- * @short_description: A logical distance unit
- *
- * #ClutterUnits is a structure holding a logical distance value along with
- * its type, expressed as a value of the #ClutterUnitType enumeration. It is
- * possible to use #ClutterUnits to store a position or a size in units
- * different than pixels, and convert them whenever needed (for instance
- * inside the #ClutterActorClass.allocate() virtual function, or inside the
- * #ClutterActorClass.get_preferred_width() and #ClutterActorClass.get_preferred_height()
- * virtual functions.
- *
- * In order to register a #ClutterUnits property, the #ClutterParamSpecUnits
- * #GParamSpec sub-class should be used:
- *
- * |[
- * GParamSpec *pspec;
- *
- * pspec = clutter_param_spec_units ("active-width",
- * "Width",
- * "Width of the active area, in millimeters",
- * CLUTTER_UNIT_MM,
- * 0.0, 12.0,
- * 12.0,
- * G_PARAM_READWRITE);
- * g_object_class_install_property (gobject_class, PROP_WIDTH, pspec);
- * ]|
- *
- * A #GValue holding units can be manipulated using clutter_value_set_units()
- * and clutter_value_get_units(). #GValue<!-- -->s containing a #ClutterUnits
- * value can also be transformed to #GValue<!-- -->s initialized with
- * %G_TYPE_INT, %G_TYPE_FLOAT and %G_TYPE_STRING through implicit conversion
- * and using g_value_transform().
- *
- * #ClutterUnits is available since Clutter 1.0
- */
-
-#include "clutter-build-config.h"
-
-#include <stdlib.h>
-
-#include <glib-object.h>
-#include <gobject/gvaluecollector.h>
-
-#include "clutter-backend-private.h"
-#include "clutter-interval.h"
-#include "clutter-private.h"
-#include "clutter-units.h"
-
-#define DPI_FALLBACK (96.0)
-
-#define FLOAT_EPSILON (1e-30)
-
-static gfloat
-units_mm_to_pixels (gfloat mm)
-{
- ClutterBackend *backend;
- gdouble dpi;
-
- backend = clutter_get_default_backend ();
- dpi = clutter_backend_get_resolution (backend);
- if (dpi < 0)
- dpi = DPI_FALLBACK;
-
- return mm * dpi / 25.4;
-}
-
-static gfloat
-units_cm_to_pixels (gfloat cm)
-{
- return units_mm_to_pixels (cm * 10);
-}
-
-static gfloat
-units_pt_to_pixels (gfloat pt)
-{
- ClutterBackend *backend;
- gdouble dpi;
-
- backend = clutter_get_default_backend ();
- dpi = clutter_backend_get_resolution (backend);
- if (dpi < 0)
- dpi = DPI_FALLBACK;
-
- return pt * dpi / 72.0;
-}
-
-static gfloat
-units_em_to_pixels (const gchar *font_name,
- gfloat em)
-{
- ClutterBackend *backend = clutter_get_default_backend ();
-
- if (font_name == NULL || *font_name == '\0')
- return em * _clutter_backend_get_units_per_em (backend, NULL);
- else
- {
- PangoFontDescription *font_desc;
- gfloat res;
-
- font_desc = pango_font_description_from_string (font_name);
- if (font_desc == NULL)
- res = -1.0;
- else
- {
- res = em * _clutter_backend_get_units_per_em (backend, font_desc);
-
- pango_font_description_free (font_desc);
- }
-
- return res;
- }
-}
-
-/**
- * clutter_units_from_mm:
- * @units: (out caller-allocates): a #ClutterUnits
- * @mm: millimeters
- *
- * Stores a value in millimiters inside @units
- *
- * Since: 1.0
- */
-void
-clutter_units_from_mm (ClutterUnits *units,
- gfloat mm)
-{
- ClutterBackend *backend;
-
- g_return_if_fail (units != NULL);
-
- backend = clutter_get_default_backend ();
-
- units->unit_type = CLUTTER_UNIT_MM;
- units->value = mm;
- units->pixels = units_mm_to_pixels (mm);
- units->pixels_set = TRUE;
- units->serial = _clutter_backend_get_units_serial (backend);
-}
-
-/**
- * clutter_units_from_cm:
- * @units: (out caller-allocates): a #ClutterUnits
- * @cm: centimeters
- *
- * Stores a value in centimeters inside @units
- *
- * Since: 1.2
- */
-void
-clutter_units_from_cm (ClutterUnits *units,
- gfloat cm)
-{
- ClutterBackend *backend;
-
- g_return_if_fail (units != NULL);
-
- backend = clutter_get_default_backend ();
-
- units->unit_type = CLUTTER_UNIT_CM;
- units->value = cm;
- units->pixels = units_cm_to_pixels (cm);
- units->pixels_set = TRUE;
- units->serial = _clutter_backend_get_units_serial (backend);
-}
-
-/**
- * clutter_units_from_pt:
- * @units: (out caller-allocates): a #ClutterUnits
- * @pt: typographic points
- *
- * Stores a value in typographic points inside @units
- *
- * Since: 1.0
- */
-void
-clutter_units_from_pt (ClutterUnits *units,
- gfloat pt)
-{
- ClutterBackend *backend;
-
- g_return_if_fail (units != NULL);
-
- backend = clutter_get_default_backend ();
-
- units->unit_type = CLUTTER_UNIT_POINT;
- units->value = pt;
- units->pixels = units_pt_to_pixels (pt);
- units->pixels_set = TRUE;
- units->serial = _clutter_backend_get_units_serial (backend);
-}
-
-/**
- * clutter_units_from_em:
- * @units: (out caller-allocates): a #ClutterUnits
- * @em: em
- *
- * Stores a value in em inside @units, using the default font
- * name as returned by clutter_backend_get_font_name()
- *
- * Since: 1.0
- */
-void
-clutter_units_from_em (ClutterUnits *units,
- gfloat em)
-{
- ClutterBackend *backend;
-
- g_return_if_fail (units != NULL);
-
- backend = clutter_get_default_backend ();
-
- units->unit_type = CLUTTER_UNIT_EM;
- units->value = em;
- units->pixels = units_em_to_pixels (NULL, em);
- units->pixels_set = TRUE;
- units->serial = _clutter_backend_get_units_serial (backend);
-}
-
-/**
- * clutter_units_from_em_for_font:
- * @units: (out caller-allocates): a #ClutterUnits
- * @font_name: (allow-none): the font name and size
- * @em: em
- *
- * Stores a value in em inside @units using @font_name
- *
- * Since: 1.0
- */
-void
-clutter_units_from_em_for_font (ClutterUnits *units,
- const gchar *font_name,
- gfloat em)
-{
- ClutterBackend *backend;
-
- g_return_if_fail (units != NULL);
-
- backend = clutter_get_default_backend ();
-
- units->unit_type = CLUTTER_UNIT_EM;
- units->value = em;
- units->pixels = units_em_to_pixels (font_name, em);
- units->pixels_set = TRUE;
- units->serial = _clutter_backend_get_units_serial (backend);
-}
-
-/**
- * clutter_units_from_pixels:
- * @units: (out caller-allocates): a #ClutterUnits
- * @px: pixels
- *
- * Stores a value in pixels inside @units
- *
- * Since: 1.0
- */
-void
-clutter_units_from_pixels (ClutterUnits *units,
- gint px)
-{
- ClutterBackend *backend;
-
- g_return_if_fail (units != NULL);
-
- backend = clutter_get_default_backend ();
-
- units->unit_type = CLUTTER_UNIT_PIXEL;
- units->value = px;
- units->pixels = px;
- units->pixels_set = TRUE;
- units->serial = _clutter_backend_get_units_serial (backend);
-}
-
-/**
- * clutter_units_get_unit_type:
- * @units: a #ClutterUnits
- *
- * Retrieves the unit type of the value stored inside @units
- *
- * Return value: a unit type
- *
- * Since: 1.0
- */
-ClutterUnitType
-clutter_units_get_unit_type (const ClutterUnits *units)
-{
- g_return_val_if_fail (units != NULL, CLUTTER_UNIT_PIXEL);
-
- return units->unit_type;
-}
-
-/**
- * clutter_units_get_unit_value:
- * @units: a #ClutterUnits
- *
- * Retrieves the value stored inside @units
- *
- * Return value: the value stored inside a #ClutterUnits
- *
- * Since: 1.0
- */
-gfloat
-clutter_units_get_unit_value (const ClutterUnits *units)
-{
- g_return_val_if_fail (units != NULL, 0.0);
-
- return units->value;
-}
-
-/**
- * clutter_units_copy:
- * @units: the #ClutterUnits to copy
- *
- * Copies @units
- *
- * Return value: (transfer full): the newly created copy of a
- * #ClutterUnits structure. Use clutter_units_free() to free
- * the allocated resources
- *
- * Since: 1.0
- */
-ClutterUnits *
-clutter_units_copy (const ClutterUnits *units)
-{
- if (units != NULL)
- return g_memdup2 (units, sizeof (ClutterUnits));
-
- return NULL;
-}
-
-/**
- * clutter_units_free:
- * @units: the #ClutterUnits to free
- *
- * Frees the resources allocated by @units
- *
- * You should only call this function on a #ClutterUnits
- * created using clutter_units_copy()
- *
- * Since: 1.0
- */
-void
-clutter_units_free (ClutterUnits *units)
-{
- if (units != NULL)
- g_free (units);
-}
-
-/**
- * clutter_units_to_pixels:
- * @units: units to convert
- *
- * Converts a value in #ClutterUnits to pixels
- *
- * Return value: the value in pixels
- *
- * Since: 1.0
- */
-gfloat
-clutter_units_to_pixels (ClutterUnits *units)
-{
- ClutterBackend *backend;
-
- g_return_val_if_fail (units != NULL, 0.0);
-
- /* if the backend settings changed we evict the cached value */
- backend = clutter_get_default_backend ();
- if (units->serial != _clutter_backend_get_units_serial (backend))
- units->pixels_set = FALSE;
-
- if (units->pixels_set)
- return units->pixels;
-
- switch (units->unit_type)
- {
- case CLUTTER_UNIT_MM:
- units->pixels = units_mm_to_pixels (units->value);
- break;
-
- case CLUTTER_UNIT_CM:
- units->pixels = units_cm_to_pixels (units->value);
- break;
-
- case CLUTTER_UNIT_POINT:
- units->pixels = units_pt_to_pixels (units->value);
- break;
-
- case CLUTTER_UNIT_EM:
- units->pixels = units_em_to_pixels (NULL, units->value);
- break;
-
- case CLUTTER_UNIT_PIXEL:
- units->pixels = units->value;
- break;
- }
-
- units->pixels_set = TRUE;
- units->serial = _clutter_backend_get_units_serial (backend);
-
- return units->pixels;
-}
-
-/**
- * clutter_units_from_string:
- * @units: (out caller-allocates): a #ClutterUnits
- * @str: the string to convert
- *
- * Parses a value and updates @units with it
- *
- * A #ClutterUnits expressed in string should match:
- *
- * |[
- * units: wsp* unit-value wsp* unit-name? wsp*
- * unit-value: number
- * unit-name: 'px' | 'pt' | 'mm' | 'em' | 'cm'
- * number: digit+
- * | digit* sep digit+
- * sep: '.' | ','
- * digit: '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
- * wsp: (#0x20 | #0x9 | #0xA | #0xB | #0xC | #0xD)+
- * ]|
- *
- * For instance, these are valid strings:
- *
- * |[
- * 10 px
- * 5.1 em
- * 24 pt
- * 12.6 mm
- * .3 cm
- * ]|
- *
- * While these are not:
- *
- * |[
- * 42 cats
- * omg!1!ponies
- * ]|
- *
- * If no unit is specified, pixels are assumed.
- *
- * Return value: %TRUE if the string was successfully parsed,
- * and %FALSE otherwise
- *
- * Since: 1.0
- */
-gboolean
-clutter_units_from_string (ClutterUnits *units,
- const gchar *str)
-{
- ClutterBackend *backend;
- ClutterUnitType unit_type;
- gfloat value;
-
- g_return_val_if_fail (units != NULL, FALSE);
- g_return_val_if_fail (str != NULL, FALSE);
-
- /* strip leading space */
- while (g_ascii_isspace (*str))
- str++;
-
- if (*str == '\0')
- return FALSE;
-
- /* integer part */
- value = (gfloat) strtoul (str, (char **) &str, 10);
-
- if (*str == '.' || *str == ',')
- {
- gfloat divisor = 0.1;
-
- /* 5.cm is not a valid number */
- if (!g_ascii_isdigit (*++str))
- return FALSE;
-
- while (g_ascii_isdigit (*str))
- {
- value += (*str - '0') * divisor;
- divisor *= 0.1;
- str++;
- }
- }
-
- while (g_ascii_isspace (*str))
- str++;
-
- /* assume pixels by default, if no unit is specified */
- if (*str == '\0')
- unit_type = CLUTTER_UNIT_PIXEL;
- else if (strncmp (str, "em", 2) == 0)
- {
- unit_type = CLUTTER_UNIT_EM;
- str += 2;
- }
- else if (strncmp (str, "mm", 2) == 0)
- {
- unit_type = CLUTTER_UNIT_MM;
- str += 2;
- }
- else if (strncmp (str, "cm", 2) == 0)
- {
- unit_type = CLUTTER_UNIT_CM;
- str += 2;
- }
- else if (strncmp (str, "pt", 2) == 0)
- {
- unit_type = CLUTTER_UNIT_POINT;
- str += 2;
- }
- else if (strncmp (str, "px", 2) == 0)
- {
- unit_type = CLUTTER_UNIT_PIXEL;
- str += 2;
- }
- else
- return FALSE;
-
- /* ensure the unit is only followed by white space */
- while (g_ascii_isspace (*str))
- str++;
- if (*str != '\0')
- return FALSE;
-
- backend = clutter_get_default_backend ();
-
- units->unit_type = unit_type;
- units->value = value;
- units->pixels_set = FALSE;
- units->serial = _clutter_backend_get_units_serial (backend);
-
- return TRUE;
-}
-
-static const gchar *
-clutter_unit_type_name (ClutterUnitType unit_type)
-{
- switch (unit_type)
- {
- case CLUTTER_UNIT_MM:
- return "mm";
-
- case CLUTTER_UNIT_CM:
- return "cm";
-
- case CLUTTER_UNIT_POINT:
- return "pt";
-
- case CLUTTER_UNIT_EM:
- return "em";
-
- case CLUTTER_UNIT_PIXEL:
- return "px";
- }
-
- g_warning ("Invalid unit type %d", (int) unit_type);
-
- return "<invalid>";
-}
-
-/**
- * clutter_units_to_string:
- * @units: a #ClutterUnits
- *
- * Converts @units into a string
- *
- * See clutter_units_from_string() for the units syntax and for
- * examples of output
- *
- * Fractional values are truncated to the second decimal
- * position for em, mm and cm, and to the first decimal position for
- * typographic points. Pixels are integers.
- *
- * Return value: a newly allocated string containing the encoded
- * #ClutterUnits value. Use g_free() to free the string
- *
- * Since: 1.0
- */
-gchar *
-clutter_units_to_string (const ClutterUnits *units)
-{
- const gchar *unit_name = NULL;
- const gchar *fmt = NULL;
- gchar buf[G_ASCII_DTOSTR_BUF_SIZE];
-
- g_return_val_if_fail (units != NULL, NULL);
-
- switch (units->unit_type)
- {
- /* special case: there is no such thing as "half a pixel", so
- * we round up to the nearest integer using C default
- */
- case CLUTTER_UNIT_PIXEL:
- return g_strdup_printf ("%d px", (int) units->value);
-
- case CLUTTER_UNIT_MM:
- unit_name = "mm";
- fmt = "%.2f";
- break;
-
- case CLUTTER_UNIT_CM:
- unit_name = "cm";
- fmt = "%.2f";
- break;
-
- case CLUTTER_UNIT_POINT:
- unit_name = "pt";
- fmt = "%.1f";
- break;
-
- case CLUTTER_UNIT_EM:
- unit_name = "em";
- fmt = "%.2f";
- break;
-
- default:
- g_assert_not_reached ();
- break;
- }
-
- g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, fmt, units->value);
-
- return g_strconcat (buf, " ", unit_name, NULL);
-}
-
-/*
- * ClutterInterval integration
- */
-
-static gboolean
-clutter_units_progress (const GValue *a,
- const GValue *b,
- gdouble progress,
- GValue *retval)
-{
- ClutterUnits *a_units = (ClutterUnits *) clutter_value_get_units (a);
- ClutterUnits *b_units = (ClutterUnits *) clutter_value_get_units (b);
- ClutterUnits res;
- gfloat a_px, b_px, value;
-
- a_px = clutter_units_to_pixels (a_units);
- b_px = clutter_units_to_pixels (b_units);
- value = progress * (b_px - a_px) + a_px;
-
- clutter_units_from_pixels (&res, value);
- clutter_value_set_units (retval, &res);
-
- return TRUE;
-}
-
-/*
- * GValue and GParamSpec integration
- */
-
-/* units to integer */
-static void
-clutter_value_transform_units_int (const GValue *src,
- GValue *dest)
-{
- dest->data[0].v_int = clutter_units_to_pixels (src->data[0].v_pointer);
-}
-
-/* integer to units */
-static void
-clutter_value_transform_int_units (const GValue *src,
- GValue *dest)
-{
- clutter_units_from_pixels (dest->data[0].v_pointer, src->data[0].v_int);
-}
-
-/* units to float */
-static void
-clutter_value_transform_units_float (const GValue *src,
- GValue *dest)
-{
- dest->data[0].v_float = clutter_units_to_pixels (src->data[0].v_pointer);
-}
-
-/* float to units */
-static void
-clutter_value_transform_float_units (const GValue *src,
- GValue *dest)
-{
- clutter_units_from_pixels (dest->data[0].v_pointer, src->data[0].v_float);
-}
-
-/* units to string */
-static void
-clutter_value_transform_units_string (const GValue *src,
- GValue *dest)
-{
- gchar *string = clutter_units_to_string (src->data[0].v_pointer);
-
- g_value_take_string (dest, string);
-}
-
-/* string to units */
-static void
-clutter_value_transform_string_units (const GValue *src,
- GValue *dest)
-{
- ClutterUnits units = { CLUTTER_UNIT_PIXEL, 0.0f };
-
- clutter_units_from_string (&units, g_value_get_string (src));
-
- clutter_value_set_units (dest, &units);
-}
-
-G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterUnits, clutter_units,
- clutter_units_copy,
- clutter_units_free,
- CLUTTER_REGISTER_VALUE_TRANSFORM_TO (G_TYPE_INT, clutter_value_transform_units_int)
- CLUTTER_REGISTER_VALUE_TRANSFORM_TO (G_TYPE_FLOAT, clutter_value_transform_units_float)
- CLUTTER_REGISTER_VALUE_TRANSFORM_TO (G_TYPE_STRING, clutter_value_transform_units_string)
- CLUTTER_REGISTER_VALUE_TRANSFORM_FROM (G_TYPE_INT, clutter_value_transform_int_units)
- CLUTTER_REGISTER_VALUE_TRANSFORM_FROM (G_TYPE_FLOAT, clutter_value_transform_float_units)
- CLUTTER_REGISTER_VALUE_TRANSFORM_FROM (G_TYPE_STRING, clutter_value_transform_string_units)
- CLUTTER_REGISTER_INTERVAL_PROGRESS (clutter_units_progress));
-
-/**
- * clutter_value_set_units:
- * @value: a #GValue initialized to %CLUTTER_TYPE_UNITS
- * @units: the units to set
- *
- * Sets @value to @units
- *
- * Since: 0.8
- */
-void
-clutter_value_set_units (GValue *value,
- const ClutterUnits *units)
-{
- g_return_if_fail (CLUTTER_VALUE_HOLDS_UNITS (value));
-
- value->data[0].v_pointer = clutter_units_copy (units);
-}
-
-/**
- * clutter_value_get_units:
- * @value: a #GValue initialized to %CLUTTER_TYPE_UNITS
- *
- * Gets the #ClutterUnits contained in @value.
- *
- * Return value: the units inside the passed #GValue
- *
- * Since: 0.8
- */
-const ClutterUnits *
-clutter_value_get_units (const GValue *value)
-{
- g_return_val_if_fail (CLUTTER_VALUE_HOLDS_UNITS (value), NULL);
-
- return value->data[0].v_pointer;
-}
-
-static void
-param_units_init (GParamSpec *pspec)
-{
- ClutterParamSpecUnits *uspec = CLUTTER_PARAM_SPEC_UNITS (pspec);
-
- uspec->minimum = -G_MAXFLOAT;
- uspec->maximum = G_MAXFLOAT;
- uspec->default_value = 0.0f;
- uspec->default_type = CLUTTER_UNIT_PIXEL;
-}
-
-static void
-param_units_set_default (GParamSpec *pspec,
- GValue *value)
-{
- ClutterParamSpecUnits *uspec = CLUTTER_PARAM_SPEC_UNITS (pspec);
- ClutterUnits units;
-
- units.unit_type = uspec->default_type;
- units.value = uspec->default_value;
- units.pixels_set = FALSE;
-
- clutter_value_set_units (value, &units);
-}
-
-static gboolean
-param_units_validate (GParamSpec *pspec,
- GValue *value)
-{
- ClutterParamSpecUnits *uspec = CLUTTER_PARAM_SPEC_UNITS (pspec);
- ClutterUnits *units = value->data[0].v_pointer;
- ClutterUnitType otype = units->unit_type;
- gfloat oval = units->value;
-
- g_assert (CLUTTER_IS_PARAM_SPEC_UNITS (pspec));
-
- if (otype != uspec->default_type)
- {
- gchar *str = clutter_units_to_string (units);
-
- g_warning ("The units value of '%s' does not have the same unit "
- "type as declared by the ClutterParamSpecUnits of '%s'",
- str,
- clutter_unit_type_name (uspec->default_type));
-
- g_free (str);
-
- return FALSE;
- }
-
- units->value = CLAMP (units->value,
- uspec->minimum,
- uspec->maximum);
-
- return units->value != oval;
-}
-
-static gint
-param_units_values_cmp (GParamSpec *pspec,
- const GValue *value1,
- const GValue *value2)
-{
- ClutterUnits *units1 = value1->data[0].v_pointer;
- ClutterUnits *units2 = value2->data[0].v_pointer;
- gfloat v1, v2;
-
- if (units1->unit_type == units2->unit_type)
- {
- v1 = units1->value;
- v2 = units2->value;
- }
- else
- {
- v1 = clutter_units_to_pixels (units1);
- v2 = clutter_units_to_pixels (units2);
- }
-
- if (v1 < v2)
- return - (v2 - v1 > FLOAT_EPSILON);
- else
- return v1 - v2 > FLOAT_EPSILON;
-}
-
-GType
-clutter_param_units_get_type (void)
-{
- static GType pspec_type = 0;
-
- if (G_UNLIKELY (pspec_type == 0))
- {
- const GParamSpecTypeInfo pspec_info = {
- sizeof (ClutterParamSpecUnits),
- 16,
- param_units_init,
- CLUTTER_TYPE_UNITS,
- NULL,
- param_units_set_default,
- param_units_validate,
- param_units_values_cmp,
- };
-
- pspec_type = g_param_type_register_static (I_("ClutterParamSpecUnit"),
- &pspec_info);
- }
-
- return pspec_type;
-}
-
-/**
- * clutter_param_spec_units: (skip)
- * @name: name of the property
- * @nick: short name
- * @blurb: description (can be translatable)
- * @default_type: the default type for the #ClutterUnits
- * @minimum: lower boundary
- * @maximum: higher boundary
- * @default_value: default value
- * @flags: flags for the param spec
- *
- * Creates a #GParamSpec for properties using #ClutterUnits.
- *
- * Return value: the newly created #GParamSpec
- *
- * Since: 1.0
- */
-GParamSpec *
-clutter_param_spec_units (const gchar *name,
- const gchar *nick,
- const gchar *blurb,
- ClutterUnitType default_type,
- gfloat minimum,
- gfloat maximum,
- gfloat default_value,
- GParamFlags flags)
-{
- ClutterParamSpecUnits *uspec;
-
- g_return_val_if_fail (default_value >= minimum && default_value <= maximum,
- NULL);
-
- uspec = g_param_spec_internal (CLUTTER_TYPE_PARAM_UNITS,
- name, nick, blurb,
- flags);
-
- uspec->default_type = default_type;
- uspec->minimum = minimum;
- uspec->maximum = maximum;
- uspec->default_value = default_value;
-
- return G_PARAM_SPEC (uspec);
-}
diff --git a/clutter/clutter/clutter-units.h b/clutter/clutter/clutter-units.h
deleted file mode 100644
index 900f90d2b..000000000
--- a/clutter/clutter/clutter-units.h
+++ /dev/null
@@ -1,184 +0,0 @@
-/* -*- mode:C; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By: Tomas Frydrych <tf@openedhand.com>
- * Emmanuele Bassu <ebassi@linux.intel.com>
- *
- * Copyright (C) 2007, 2008 OpenedHand
- * Copyright (C) 2009 Intel Corp.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __CLUTTER_UNITS_H__
-#define __CLUTTER_UNITS_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <glib-object.h>
-
-#include <cogl/cogl.h>
-
-G_BEGIN_DECLS
-
-/**
- * ClutterUnits:
- *
- * An opaque structure, to be used to store sizing and positioning
- * values along with their unit.
- *
- * Since: 1.0
- */
-typedef struct _ClutterUnits ClutterUnits;
-
-struct _ClutterUnits
-{
- /*< private >*/
- ClutterUnitType unit_type;
-
- gfloat value;
-
- /* pre-filled by the provided constructors */
-
- /* cached pixel value */
- gfloat pixels;
-
- /* whether the :pixels field is set */
- guint pixels_set;
-
- /* the serial coming from the backend, used to evict the cache */
- gint32 serial;
-
- /* padding for eventual expansion */
- gint32 __padding_1;
- gint64 __padding_2;
-};
-
-CLUTTER_EXPORT
-GType clutter_units_get_type (void) G_GNUC_CONST;
-CLUTTER_EXPORT
-ClutterUnitType clutter_units_get_unit_type (const ClutterUnits *units);
-CLUTTER_EXPORT
-gfloat clutter_units_get_unit_value (const ClutterUnits *units);
-
-CLUTTER_EXPORT
-ClutterUnits * clutter_units_copy (const ClutterUnits *units);
-CLUTTER_EXPORT
-void clutter_units_free (ClutterUnits *units);
-
-CLUTTER_EXPORT
-void clutter_units_from_pixels (ClutterUnits *units,
- gint px);
-CLUTTER_EXPORT
-void clutter_units_from_em (ClutterUnits *units,
- gfloat em);
-CLUTTER_EXPORT
-void clutter_units_from_em_for_font (ClutterUnits *units,
- const gchar *font_name,
- gfloat em);
-CLUTTER_EXPORT
-void clutter_units_from_mm (ClutterUnits *units,
- gfloat mm);
-CLUTTER_EXPORT
-void clutter_units_from_cm (ClutterUnits *units,
- gfloat cm);
-CLUTTER_EXPORT
-void clutter_units_from_pt (ClutterUnits *units,
- gfloat pt);
-
-CLUTTER_EXPORT
-gfloat clutter_units_to_pixels (ClutterUnits *units);
-
-CLUTTER_EXPORT
-gboolean clutter_units_from_string (ClutterUnits *units,
- const gchar *str);
-CLUTTER_EXPORT
-gchar * clutter_units_to_string (const ClutterUnits *units);
-
-/* shorthands for the constructors */
-#define clutter_units_pixels clutter_units_from_pixels
-#define clutter_units_em clutter_units_from_em
-#define clutter_units_em_for_font clutter_units_from_em_for_font
-#define clutter_units_mm clutter_units_from_mm
-#define clutter_units_cm clutter_units_from_cm
-#define clutter_units_pt clutter_units_from_pt
-
-#define CLUTTER_TYPE_UNITS (clutter_units_get_type ())
-#define CLUTTER_TYPE_PARAM_UNITS (clutter_param_units_get_type ())
-#define CLUTTER_PARAM_SPEC_UNITS(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), CLUTTER_TYPE_PARAM_UNITS, ClutterParamSpecUnits))
-#define CLUTTER_IS_PARAM_SPEC_UNITS(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), CLUTTER_TYPE_PARAM_UNITS))
-
-/**
- * CLUTTER_VALUE_HOLDS_UNITS:
- * @x: a #GValue
- *
- * Evaluates to %TRUE if @x holds a #ClutterUnits value
- *
- * Since: 0.8
- */
-#define CLUTTER_VALUE_HOLDS_UNITS(x) (G_VALUE_HOLDS ((x), CLUTTER_TYPE_UNITS))
-
-typedef struct _ClutterParamSpecUnits ClutterParamSpecUnits;
-
-/**
- * ClutterParamSpecUnits: (skip)
- * @default_type: default type
- * @default_value: default value
- * @minimum: lower boundary
- * @maximum: higher boundary
- *
- * #GParamSpec subclass for unit based properties.
- *
- * Since: 1.0
- */
-struct _ClutterParamSpecUnits
-{
- /*< private >*/
- GParamSpec parent_instance;
-
- /*< public >*/
- ClutterUnitType default_type;
-
- gfloat default_value;
- gfloat minimum;
- gfloat maximum;
-};
-
-CLUTTER_EXPORT
-GType clutter_param_units_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-GParamSpec * clutter_param_spec_units (const gchar *name,
- const gchar *nick,
- const gchar *blurb,
- ClutterUnitType default_type,
- gfloat minimum,
- gfloat maximum,
- gfloat default_value,
- GParamFlags flags);
-
-CLUTTER_EXPORT
-void clutter_value_set_units (GValue *value,
- const ClutterUnits *units);
-CLUTTER_EXPORT
-const ClutterUnits * clutter_value_get_units (const GValue *value);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_UNITS_H__ */
diff --git a/clutter/clutter/clutter-util.c b/clutter/clutter/clutter-util.c
deleted file mode 100644
index a5de007f3..000000000
--- a/clutter/clutter/clutter-util.c
+++ /dev/null
@@ -1,427 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- *
- * Copyright (C) 2006 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- *
- */
-
-/**
- * SECTION:clutter-util
- * @short_description: Utility functions
- *
- * Various miscellaneous utilility functions.
- */
-
-#include "clutter-build-config.h"
-
-#include <fribidi.h>
-#include <math.h>
-
-#include "clutter-debug.h"
-#include "clutter-main.h"
-#include "clutter-interval.h"
-#include "clutter-private.h"
-
-/* Help macros to scale from OpenGL <-1,1> coordinates system to
- * window coordinates ranging [0,window-size]
- */
-#define MTX_GL_SCALE_X(x,w,v1,v2) ((((((x) / (w)) + 1.0f) / 2.0f) * (v1)) + (v2))
-#define MTX_GL_SCALE_Y(y,w,v1,v2) ((v1) - (((((y) / (w)) + 1.0f) / 2.0f) * (v1)) + (v2))
-#define MTX_GL_SCALE_Z(z,w,v1,v2) (MTX_GL_SCALE_X ((z), (w), (v1), (v2)))
-
-typedef struct
-{
- float x;
- float y;
- float z;
- float w;
-} ClutterVertex4;
-
-void
-_clutter_util_fully_transform_vertices (const graphene_matrix_t *modelview,
- const graphene_matrix_t *projection,
- const float *viewport,
- const graphene_point3d_t *vertices_in,
- graphene_point3d_t *vertices_out,
- int n_vertices)
-{
- graphene_matrix_t modelview_projection;
- ClutterVertex4 *vertices_tmp;
- int i;
-
- vertices_tmp = g_alloca (sizeof (ClutterVertex4) * n_vertices);
-
- if (n_vertices >= 4)
- {
- /* XXX: we should find a way to cache this per actor */
- graphene_matrix_multiply (modelview, projection, &modelview_projection);
-
- cogl_graphene_matrix_project_points (&modelview_projection,
- 3,
- sizeof (graphene_point3d_t),
- vertices_in,
- sizeof (ClutterVertex4),
- vertices_tmp,
- n_vertices);
- }
- else
- {
- cogl_graphene_matrix_transform_points (modelview,
- 3,
- sizeof (graphene_point3d_t),
- vertices_in,
- sizeof (ClutterVertex4),
- vertices_tmp,
- n_vertices);
-
- cogl_graphene_matrix_project_points (projection,
- 3,
- sizeof (ClutterVertex4),
- vertices_tmp,
- sizeof (ClutterVertex4),
- vertices_tmp,
- n_vertices);
- }
-
- for (i = 0; i < n_vertices; i++)
- {
- ClutterVertex4 vertex_tmp = vertices_tmp[i];
- graphene_point3d_t *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]);
- vertex_out->y = MTX_GL_SCALE_Y (vertex_tmp.y,
- vertex_tmp.w,
- viewport[3],
- viewport[1]);
- clutter_round_to_256ths (&vertex_out->x);
- clutter_round_to_256ths (&vertex_out->y);
- }
-}
-
-void
-_clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src,
- graphene_rect_t *dest)
-{
- *dest = (graphene_rect_t) {
- .origin = {
- .x = src->x,
- .y = src->y
- },
- .size = {
- .width = src->width,
- .height = src->height
- }
- };
-}
-
-void
-_clutter_util_rectangle_int_extents (const graphene_rect_t *src,
- cairo_rectangle_int_t *dest)
-{
- graphene_rect_t tmp = *src;
-
- graphene_rect_round_extents (&tmp, &tmp);
-
- *dest = (cairo_rectangle_int_t) {
- .x = tmp.origin.x,
- .y = tmp.origin.y,
- .width = tmp.size.width,
- .height = tmp.size.height,
- };
-}
-
-void
-_clutter_util_rectangle_offset (const cairo_rectangle_int_t *src,
- int x,
- int y,
- cairo_rectangle_int_t *dest)
-{
- *dest = *src;
-
- dest->x += x;
- dest->y += y;
-}
-
-/*< private >
- * _clutter_util_rectangle_union:
- * @src1: first rectangle to union
- * @src2: second rectangle to union
- * @dest: (out): return location for the unioned rectangle
- *
- * Calculates the union of two rectangles.
- *
- * The union of rectangles @src1 and @src2 is the smallest rectangle which
- * includes both @src1 and @src2 within it.
- *
- * It is allowed for @dest to be the same as either @src1 or @src2.
- *
- * This function should really be in Cairo.
- */
-void
-_clutter_util_rectangle_union (const cairo_rectangle_int_t *src1,
- const cairo_rectangle_int_t *src2,
- cairo_rectangle_int_t *dest)
-{
- int dest_x, dest_y;
-
- dest_x = MIN (src1->x, src2->x);
- dest_y = MIN (src1->y, src2->y);
-
- dest->width = MAX (src1->x + src1->width, src2->x + src2->width) - dest_x;
- dest->height = MAX (src1->y + src1->height, src2->y + src2->height) - dest_y;
- dest->x = dest_x;
- dest->y = dest_y;
-}
-
-gboolean
-_clutter_util_rectangle_intersection (const cairo_rectangle_int_t *src1,
- const cairo_rectangle_int_t *src2,
- cairo_rectangle_int_t *dest)
-{
- int x1, y1, x2, y2;
-
- x1 = MAX (src1->x, src2->x);
- y1 = MAX (src1->y, src2->y);
-
- x2 = MIN (src1->x + (int) src1->width, src2->x + (int) src2->width);
- y2 = MIN (src1->y + (int) src1->height, src2->y + (int) src2->height);
-
- if (x1 >= x2 || y1 >= y2)
- {
- dest->x = 0;
- dest->y = 0;
- dest->width = 0;
- dest->height = 0;
-
- return FALSE;
- }
- else
- {
- dest->x = x1;
- dest->y = y1;
- dest->width = x2 - x1;
- dest->height = y2 - y1;
-
- return TRUE;
- }
-}
-
-gboolean
-clutter_util_rectangle_equal (const cairo_rectangle_int_t *src1,
- const cairo_rectangle_int_t *src2)
-{
- return ((src1->x == src2->x) &&
- (src1->y == src2->y) &&
- (src1->width == src2->width) &&
- (src1->height == src2->height));
-}
-
-typedef struct
-{
- GType value_type;
- ClutterProgressFunc func;
-} ProgressData;
-
-G_LOCK_DEFINE_STATIC (progress_funcs);
-static GHashTable *progress_funcs = NULL;
-
-gboolean
-_clutter_has_progress_function (GType gtype)
-{
- const char *type_name = g_type_name (gtype);
-
- if (progress_funcs == NULL)
- return FALSE;
-
- return g_hash_table_lookup (progress_funcs, type_name) != NULL;
-}
-
-gboolean
-_clutter_run_progress_function (GType gtype,
- const GValue *initial,
- const GValue *final,
- gdouble progress,
- GValue *retval)
-{
- ProgressData *pdata;
- gboolean res;
-
- G_LOCK (progress_funcs);
-
- if (G_UNLIKELY (progress_funcs == NULL))
- {
- res = FALSE;
- goto out;
- }
-
- pdata = g_hash_table_lookup (progress_funcs, g_type_name (gtype));
- if (G_UNLIKELY (pdata == NULL))
- {
- res = FALSE;
- goto out;
- }
-
- res = pdata->func (initial, final, progress, retval);
-
-out:
- G_UNLOCK (progress_funcs);
-
- return res;
-}
-
-static void
-progress_data_destroy (gpointer data_)
-{
- g_free (data_);
-}
-
-/**
- * clutter_interval_register_progress_func: (skip)
- * @value_type: a #GType
- * @func: a #ClutterProgressFunc, or %NULL to unset a previously
- * set progress function
- *
- * Sets the progress function for a given @value_type, like:
- *
- * |[
- * clutter_interval_register_progress_func (MY_TYPE_FOO,
- * my_foo_progress);
- * ]|
- *
- * Whenever a #ClutterInterval instance using the default
- * #ClutterInterval::compute_value implementation is set as an
- * interval between two #GValue of type @value_type, it will call
- * @func to establish the value depending on the given progress,
- * for instance:
- *
- * |[
- * static gboolean
- * my_int_progress (const GValue *a,
- * const GValue *b,
- * gdouble progress,
- * GValue *retval)
- * {
- * gint ia = g_value_get_int (a);
- * gint ib = g_value_get_int (b);
- * gint res = factor * (ib - ia) + ia;
- *
- * g_value_set_int (retval, res);
- *
- * return TRUE;
- * }
- *
- * clutter_interval_register_progress_func (G_TYPE_INT, my_int_progress);
- * ]|
- *
- * To unset a previously set progress function of a #GType, pass %NULL
- * for @func.
- *
- * Since: 1.0
- */
-void
-clutter_interval_register_progress_func (GType value_type,
- ClutterProgressFunc func)
-{
- ProgressData *progress_func;
- const char *type_name;
-
- g_return_if_fail (value_type != G_TYPE_INVALID);
-
- type_name = g_type_name (value_type);
-
- G_LOCK (progress_funcs);
-
- if (G_UNLIKELY (progress_funcs == NULL))
- progress_funcs = g_hash_table_new_full (NULL, NULL,
- NULL,
- progress_data_destroy);
-
- progress_func =
- g_hash_table_lookup (progress_funcs, type_name);
-
- if (G_UNLIKELY (progress_func))
- {
- if (func == NULL)
- {
- g_hash_table_remove (progress_funcs, type_name);
- g_free (progress_func);
- }
- else
- progress_func->func = func;
- }
- else
- {
- progress_func = g_new0 (ProgressData, 1);
- progress_func->value_type = value_type;
- progress_func->func = func;
-
- g_hash_table_replace (progress_funcs,
- (gpointer) type_name,
- progress_func);
- }
-
- G_UNLOCK (progress_funcs);
-}
-
-PangoDirection
-_clutter_pango_unichar_direction (gunichar ch)
-{
- FriBidiCharType fribidi_ch_type;
-
- G_STATIC_ASSERT (sizeof (FriBidiChar) == sizeof (gunichar));
-
- fribidi_ch_type = fribidi_get_bidi_type (ch);
-
- if (!FRIBIDI_IS_STRONG (fribidi_ch_type))
- return PANGO_DIRECTION_NEUTRAL;
- else if (FRIBIDI_IS_RTL (fribidi_ch_type))
- return PANGO_DIRECTION_RTL;
- else
- return PANGO_DIRECTION_LTR;
-}
-
-PangoDirection
-_clutter_pango_find_base_dir (const gchar *text,
- gint length)
-{
- PangoDirection dir = PANGO_DIRECTION_NEUTRAL;
- const gchar *p;
-
- g_return_val_if_fail (text != NULL || length == 0, PANGO_DIRECTION_NEUTRAL);
-
- p = text;
- while ((length < 0 || p < text + length) && *p)
- {
- gunichar wc = g_utf8_get_char (p);
-
- dir = _clutter_pango_unichar_direction (wc);
-
- if (dir != PANGO_DIRECTION_NEUTRAL)
- break;
-
- p = g_utf8_next_char (p);
- }
-
- return dir;
-}
diff --git a/clutter/clutter/clutter-virtual-input-device.c b/clutter/clutter/clutter-virtual-input-device.c
deleted file mode 100644
index ff733a464..000000000
--- a/clutter/clutter/clutter-virtual-input-device.c
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2016 Red Hat Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author: Jonas Ã…dahl <jadahl@gmail.com>
- */
-
-#include "clutter-build-config.h"
-
-#include <glib-object.h>
-
-#include "clutter-virtual-input-device.h"
-
-#include "clutter-enum-types.h"
-#include "clutter-private.h"
-#include "clutter-seat.h"
-
-enum
-{
- PROP_0,
-
- PROP_SEAT,
- PROP_DEVICE_TYPE,
-
- PROP_LAST
-};
-
-static GParamSpec *obj_props[PROP_LAST];
-
-typedef struct _ClutterVirtualInputDevicePrivate
-{
- ClutterSeat *seat;
- ClutterInputDeviceType device_type;
-} ClutterVirtualInputDevicePrivate;
-
-G_DEFINE_TYPE_WITH_PRIVATE (ClutterVirtualInputDevice,
- clutter_virtual_input_device,
- G_TYPE_OBJECT)
-
-void
-clutter_virtual_input_device_notify_relative_motion (ClutterVirtualInputDevice *virtual_device,
- uint64_t time_us,
- double dx,
- double dy)
-{
- ClutterVirtualInputDeviceClass *klass =
- CLUTTER_VIRTUAL_INPUT_DEVICE_GET_CLASS (virtual_device);
-
- klass->notify_relative_motion (virtual_device, time_us, dx, dy);
-}
-
-void
-clutter_virtual_input_device_notify_absolute_motion (ClutterVirtualInputDevice *virtual_device,
- uint64_t time_us,
- double x,
- double y)
-{
- ClutterVirtualInputDeviceClass *klass =
- CLUTTER_VIRTUAL_INPUT_DEVICE_GET_CLASS (virtual_device);
-
- klass->notify_absolute_motion (virtual_device, time_us, x, y);
-}
-
-void
-clutter_virtual_input_device_notify_button (ClutterVirtualInputDevice *virtual_device,
- uint64_t time_us,
- uint32_t button,
- ClutterButtonState button_state)
-{
- ClutterVirtualInputDeviceClass *klass =
- CLUTTER_VIRTUAL_INPUT_DEVICE_GET_CLASS (virtual_device);
-
- klass->notify_button (virtual_device, time_us, button, button_state);
-}
-
-void
-clutter_virtual_input_device_notify_key (ClutterVirtualInputDevice *virtual_device,
- uint64_t time_us,
- uint32_t key,
- ClutterKeyState key_state)
-{
- ClutterVirtualInputDeviceClass *klass =
- CLUTTER_VIRTUAL_INPUT_DEVICE_GET_CLASS (virtual_device);
-
- klass->notify_key (virtual_device, time_us, key, key_state);
-}
-
-void
-clutter_virtual_input_device_notify_keyval (ClutterVirtualInputDevice *virtual_device,
- uint64_t time_us,
- uint32_t keyval,
- ClutterKeyState key_state)
-{
- ClutterVirtualInputDeviceClass *klass =
- CLUTTER_VIRTUAL_INPUT_DEVICE_GET_CLASS (virtual_device);
-
- klass->notify_keyval (virtual_device, time_us, keyval, key_state);
-}
-
-void
-clutter_virtual_input_device_notify_discrete_scroll (ClutterVirtualInputDevice *virtual_device,
- uint64_t time_us,
- ClutterScrollDirection direction,
- ClutterScrollSource scroll_source)
-{
- ClutterVirtualInputDeviceClass *klass =
- CLUTTER_VIRTUAL_INPUT_DEVICE_GET_CLASS (virtual_device);
-
- klass->notify_discrete_scroll (virtual_device, time_us,
- direction, scroll_source);
-}
-
-void
-clutter_virtual_input_device_notify_scroll_continuous (ClutterVirtualInputDevice *virtual_device,
- uint64_t time_us,
- double dx,
- double dy,
- ClutterScrollSource scroll_source,
- ClutterScrollFinishFlags finish_flags)
-{
- ClutterVirtualInputDeviceClass *klass =
- CLUTTER_VIRTUAL_INPUT_DEVICE_GET_CLASS (virtual_device);
-
- klass->notify_scroll_continuous (virtual_device, time_us,
- dx, dy, scroll_source, finish_flags);
-}
-
-void
-clutter_virtual_input_device_notify_touch_down (ClutterVirtualInputDevice *virtual_device,
- uint64_t time_us,
- int slot,
- double x,
- double y)
-{
- ClutterVirtualInputDeviceClass *klass =
- CLUTTER_VIRTUAL_INPUT_DEVICE_GET_CLASS (virtual_device);
-
- g_return_if_fail (CLUTTER_IS_VIRTUAL_INPUT_DEVICE (virtual_device));
- g_return_if_fail (slot >= 0 &&
- slot < CLUTTER_VIRTUAL_INPUT_DEVICE_MAX_TOUCH_SLOTS);
-
- klass->notify_touch_down (virtual_device, time_us,
- slot, x, y);
-}
-
-void
-clutter_virtual_input_device_notify_touch_motion (ClutterVirtualInputDevice *virtual_device,
- uint64_t time_us,
- int slot,
- double x,
- double y)
-{
- ClutterVirtualInputDeviceClass *klass =
- CLUTTER_VIRTUAL_INPUT_DEVICE_GET_CLASS (virtual_device);
-
- g_return_if_fail (CLUTTER_IS_VIRTUAL_INPUT_DEVICE (virtual_device));
- g_return_if_fail (slot >= 0 &&
- slot < CLUTTER_VIRTUAL_INPUT_DEVICE_MAX_TOUCH_SLOTS);
-
- klass->notify_touch_motion (virtual_device, time_us,
- slot, x, y);
-}
-
-void
-clutter_virtual_input_device_notify_touch_up (ClutterVirtualInputDevice *virtual_device,
- uint64_t time_us,
- int slot)
-{
- ClutterVirtualInputDeviceClass *klass =
- CLUTTER_VIRTUAL_INPUT_DEVICE_GET_CLASS (virtual_device);
-
- g_return_if_fail (CLUTTER_IS_VIRTUAL_INPUT_DEVICE (virtual_device));
- g_return_if_fail (slot >= 0 &&
- slot < CLUTTER_VIRTUAL_INPUT_DEVICE_MAX_TOUCH_SLOTS);
-
- klass->notify_touch_up (virtual_device, time_us,
- slot);
-}
-
-int
-clutter_virtual_input_device_get_device_type (ClutterVirtualInputDevice *virtual_device)
-{
- ClutterVirtualInputDevicePrivate *priv =
- clutter_virtual_input_device_get_instance_private (virtual_device);
-
- return priv->device_type;
-}
-
-static void
-clutter_virtual_input_device_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterVirtualInputDevice *virtual_device =
- CLUTTER_VIRTUAL_INPUT_DEVICE (object);
- ClutterVirtualInputDevicePrivate *priv =
- clutter_virtual_input_device_get_instance_private (virtual_device);
-
- switch (prop_id)
- {
- case PROP_SEAT:
- g_value_set_object (value, priv->seat);
- break;
- case PROP_DEVICE_TYPE:
- g_value_set_enum (value, priv->device_type);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_virtual_input_device_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterVirtualInputDevice *virtual_device =
- CLUTTER_VIRTUAL_INPUT_DEVICE (object);
- ClutterVirtualInputDevicePrivate *priv =
- clutter_virtual_input_device_get_instance_private (virtual_device);
-
- switch (prop_id)
- {
- case PROP_SEAT:
- priv->seat = g_value_get_object (value);
- break;
- case PROP_DEVICE_TYPE:
- priv->device_type = g_value_get_enum (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-clutter_virtual_input_device_init (ClutterVirtualInputDevice *virtual_device)
-{
-}
-
-static void
-clutter_virtual_input_device_class_init (ClutterVirtualInputDeviceClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->get_property = clutter_virtual_input_device_get_property;
- object_class->set_property = clutter_virtual_input_device_set_property;
-
- obj_props[PROP_SEAT] =
- g_param_spec_object ("seat",
- P_("Seat"),
- P_("Seat"),
- CLUTTER_TYPE_SEAT,
- CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
- obj_props[PROP_DEVICE_TYPE] =
- g_param_spec_enum ("device-type",
- P_("Device type"),
- P_("Device type"),
- CLUTTER_TYPE_INPUT_DEVICE_TYPE,
- CLUTTER_POINTER_DEVICE,
- CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
-
- g_object_class_install_properties (object_class, PROP_LAST, obj_props);
-}
diff --git a/clutter/clutter/clutter-virtual-input-device.h b/clutter/clutter/clutter-virtual-input-device.h
deleted file mode 100644
index fb357af1e..000000000
--- a/clutter/clutter/clutter-virtual-input-device.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2016 Red Hat inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author: Jonas Ã…dahl <jadahl@gmail.com>
- */
-
-#ifndef __CLUTTER_VIRTUAL_INPUT_DEVICE_H__
-#define __CLUTTER_VIRTUAL_INPUT_DEVICE_H__
-
-#include <glib-object.h>
-#include <stdint.h>
-
-#include "clutter-seat.h"
-
-#define CLUTTER_TYPE_VIRTUAL_INPUT_DEVICE (clutter_virtual_input_device_get_type ())
-
-#define CLUTTER_VIRTUAL_INPUT_DEVICE_MAX_TOUCH_SLOTS 32u
-
-CLUTTER_EXPORT
-G_DECLARE_DERIVABLE_TYPE (ClutterVirtualInputDevice,
- clutter_virtual_input_device,
- CLUTTER, VIRTUAL_INPUT_DEVICE,
- GObject)
-
-typedef enum _ClutterButtonState
-{
- CLUTTER_BUTTON_STATE_RELEASED,
- CLUTTER_BUTTON_STATE_PRESSED
-} ClutterButtonState;
-
-typedef enum _ClutterKeyState
-{
- CLUTTER_KEY_STATE_RELEASED,
- CLUTTER_KEY_STATE_PRESSED
-} ClutterKeyState;
-
-struct _ClutterVirtualInputDeviceClass
-{
- GObjectClass parent_class;
-
- void (*notify_relative_motion) (ClutterVirtualInputDevice *virtual_device,
- uint64_t time_us,
- double dx,
- double dy);
-
- void (*notify_absolute_motion) (ClutterVirtualInputDevice *virtual_device,
- uint64_t time_us,
- double x,
- double y);
-
- void (*notify_button) (ClutterVirtualInputDevice *virtual_device,
- uint64_t time_us,
- uint32_t button,
- ClutterButtonState button_state);
-
- void (*notify_key) (ClutterVirtualInputDevice *virtual_device,
- uint64_t time_us,
- uint32_t key,
- ClutterKeyState key_state);
- void (*notify_keyval) (ClutterVirtualInputDevice *virtual_device,
- uint64_t time_us,
- uint32_t keyval,
- ClutterKeyState key_state);
-
- void (*notify_discrete_scroll) (ClutterVirtualInputDevice *virtual_device,
- uint64_t time_us,
- ClutterScrollDirection direction,
- ClutterScrollSource scroll_source);
-
- void (*notify_scroll_continuous) (ClutterVirtualInputDevice *virtual_device,
- uint64_t time_us,
- double dx,
- double dy,
- ClutterScrollSource scroll_source,
- ClutterScrollFinishFlags finish_flags);
-
- void (*notify_touch_down) (ClutterVirtualInputDevice *virtual_device,
- uint64_t time_us,
- int slot,
- double x,
- double y);
-
- void (*notify_touch_motion) (ClutterVirtualInputDevice *virtual_device,
- uint64_t time_us,
- int slot,
- double x,
- double y);
-
- void (*notify_touch_up) (ClutterVirtualInputDevice *virtual_device,
- uint64_t time_us,
- int slot);
-};
-
-CLUTTER_EXPORT
-void clutter_virtual_input_device_notify_relative_motion (ClutterVirtualInputDevice *virtual_device,
- uint64_t time_us,
- double dx,
- double dy);
-
-CLUTTER_EXPORT
-void clutter_virtual_input_device_notify_absolute_motion (ClutterVirtualInputDevice *virtual_device,
- uint64_t time_us,
- double x,
- double y);
-
-CLUTTER_EXPORT
-void clutter_virtual_input_device_notify_button (ClutterVirtualInputDevice *virtual_device,
- uint64_t time_us,
- uint32_t button,
- ClutterButtonState button_state);
-
-CLUTTER_EXPORT
-void clutter_virtual_input_device_notify_key (ClutterVirtualInputDevice *virtual_device,
- uint64_t time_us,
- uint32_t key,
- ClutterKeyState key_state);
-
-CLUTTER_EXPORT
-void clutter_virtual_input_device_notify_keyval (ClutterVirtualInputDevice *virtual_device,
- uint64_t time_us,
- uint32_t keyval,
- ClutterKeyState key_state);
-
-CLUTTER_EXPORT
-void clutter_virtual_input_device_notify_discrete_scroll (ClutterVirtualInputDevice *virtual_device,
- uint64_t time_us,
- ClutterScrollDirection direction,
- ClutterScrollSource scroll_source);
-
-CLUTTER_EXPORT
-void clutter_virtual_input_device_notify_scroll_continuous (ClutterVirtualInputDevice *virtual_device,
- uint64_t time_us,
- double dx,
- double dy,
- ClutterScrollSource scroll_source,
- ClutterScrollFinishFlags finish_flags);
-
-CLUTTER_EXPORT
-void clutter_virtual_input_device_notify_touch_down (ClutterVirtualInputDevice *virtual_device,
- uint64_t time_us,
- int slot,
- double x,
- double y);
-
-CLUTTER_EXPORT
-void clutter_virtual_input_device_notify_touch_motion (ClutterVirtualInputDevice *virtual_device,
- uint64_t time_us,
- int slot,
- double x,
- double y);
-
-CLUTTER_EXPORT
-void clutter_virtual_input_device_notify_touch_up (ClutterVirtualInputDevice *virtual_device,
- uint64_t time_us,
- int slot);
-
-CLUTTER_EXPORT
-int clutter_virtual_input_device_get_device_type (ClutterVirtualInputDevice *virtual_device);
-
-#endif /* __CLUTTER_VIRTUAL_INPUT_DEVICE_H__ */
diff --git a/clutter/clutter/clutter-zoom-action.c b/clutter/clutter/clutter-zoom-action.c
deleted file mode 100644
index c25b79688..000000000
--- a/clutter/clutter/clutter-zoom-action.c
+++ /dev/null
@@ -1,515 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2012 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Lionel Landwerlin <lionel.g.landwerlin@linux.intel.com>
- */
-
-/**
- * SECTION:clutter-zoom-action
- * @Title: ClutterZoomAction
- * @Short_Description: Action enabling zooming on actors
- *
- * #ClutterZoomAction is a sub-class of #ClutterGestureAction that
- * implements all the necessary logic for zooming actors using a "pinch"
- * gesture between two touch points.
- *
- * The simplest usage of #ClutterZoomAction consists in adding it to
- * a #ClutterActor and setting it as reactive; for instance, the following
- * code:
- *
- * |[
- * clutter_actor_add_action (actor, clutter_zoom_action_new ());
- * clutter_actor_set_reactive (actor, TRUE);
- * ]|
- *
- * will automatically result in the actor to be scale according to the
- * distance between two touch points.
- *
- * Since: 1.12
- */
-
-#include "clutter-build-config.h"
-
-#include <math.h>
-
-#include "clutter-zoom-action.h"
-
-#include "clutter-debug.h"
-#include "clutter-enum-types.h"
-#include "clutter-gesture-action-private.h"
-#include "clutter-marshal.h"
-#include "clutter-private.h"
-#include "clutter-stage-private.h"
-
-typedef struct
-{
- gfloat start_x;
- gfloat start_y;
- gfloat transformed_start_x;
- gfloat transformed_start_y;
-
- gfloat update_x;
- gfloat update_y;
- gfloat transformed_update_x;
- gfloat transformed_update_y;
-} ZoomPoint;
-
-struct _ClutterZoomActionPrivate
-{
- ClutterStage *stage;
-
- ClutterZoomAxis zoom_axis;
-
- ZoomPoint points[2];
-
- graphene_point_t initial_focal_point;
- graphene_point_t focal_point;
- graphene_point_t transformed_focal_point;
-
- gfloat initial_x;
- gfloat initial_y;
- gfloat initial_z;
-
- gdouble initial_scale_x;
- gdouble initial_scale_y;
-
- gdouble zoom_initial_distance;
-};
-
-enum
-{
- PROP_0,
-
- PROP_ZOOM_AXIS,
-
- PROP_LAST
-};
-
-static GParamSpec *zoom_props[PROP_LAST] = { NULL, };
-
-enum
-{
- ZOOM,
-
- LAST_SIGNAL
-};
-
-static guint zoom_signals[LAST_SIGNAL] = { 0, };
-
-G_DEFINE_TYPE_WITH_PRIVATE (ClutterZoomAction, clutter_zoom_action, CLUTTER_TYPE_GESTURE_ACTION)
-
-static void
-capture_point_initial_position (ClutterGestureAction *action,
- ClutterActor *actor,
- gint index,
- ZoomPoint *point)
-{
- clutter_gesture_action_get_motion_coords (action, index,
- &point->start_x,
- &point->start_y);
-
- point->transformed_start_x = point->update_x = point->start_x;
- point->transformed_start_y = point->update_x = point->start_y;
- clutter_actor_transform_stage_point (actor,
- point->start_x, point->start_y,
- &point->transformed_start_x,
- &point->transformed_start_y);
- point->transformed_update_x = point->transformed_start_x;
- point->transformed_update_y = point->transformed_start_y;
-}
-
-static void
-capture_point_update_position (ClutterGestureAction *action,
- ClutterActor *actor,
- gint index,
- ZoomPoint *point)
-{
- clutter_gesture_action_get_motion_coords (action, index,
- &point->update_x,
- &point->update_y);
-
- point->transformed_update_x = point->update_x;
- point->transformed_update_y = point->update_y;
- clutter_actor_transform_stage_point (actor,
- point->update_x, point->update_y,
- &point->transformed_update_x,
- &point->transformed_update_y);
-}
-
-static gboolean
-clutter_zoom_action_gesture_begin (ClutterGestureAction *action,
- ClutterActor *actor)
-{
- ClutterZoomActionPrivate *priv = ((ClutterZoomAction *) action)->priv;
- gfloat dx, dy;
-
- capture_point_initial_position (action, actor, 0, &priv->points[0]);
- capture_point_initial_position (action, actor, 1, &priv->points[1]);
-
- dx = priv->points[1].transformed_start_x - priv->points[0].transformed_start_x;
- dy = priv->points[1].transformed_start_y - priv->points[0].transformed_start_y;
- priv->zoom_initial_distance = sqrt (dx * dx + dy * dy);
-
- clutter_actor_get_translation (actor,
- &priv->initial_x,
- &priv->initial_y,
- &priv->initial_z);
- clutter_actor_get_scale (actor,
- &priv->initial_scale_x,
- &priv->initial_scale_y);
-
- priv->initial_focal_point.x = (priv->points[0].start_x + priv->points[1].start_x) / 2;
- priv->initial_focal_point.y = (priv->points[0].start_y + priv->points[1].start_y) / 2;
- clutter_actor_transform_stage_point (actor,
- priv->initial_focal_point.x,
- priv->initial_focal_point.y,
- &priv->transformed_focal_point.x,
- &priv->transformed_focal_point.y);
-
- clutter_actor_set_pivot_point (actor,
- priv->transformed_focal_point.x / clutter_actor_get_width (actor),
- priv->transformed_focal_point.y / clutter_actor_get_height (actor));
-
- return TRUE;
-}
-
-static gboolean
-clutter_zoom_action_gesture_progress (ClutterGestureAction *action,
- ClutterActor *actor)
-{
- ClutterZoomActionPrivate *priv = ((ClutterZoomAction *) action)->priv;
- gdouble distance, new_scale;
- gfloat dx, dy;
- gboolean retval;
-
- capture_point_update_position (action, actor, 0, &priv->points[0]);
- capture_point_update_position (action, actor, 1, &priv->points[1]);
-
- dx = priv->points[1].update_x - priv->points[0].update_x;
- dy = priv->points[1].update_y - priv->points[0].update_y;
- distance = sqrt (dx * dx + dy * dy);
-
- if (distance == 0)
- return TRUE;
-
- priv->focal_point.x = (priv->points[0].update_x + priv->points[1].update_x) / 2;
- priv->focal_point.y = (priv->points[0].update_y + priv->points[1].update_y) / 2;
-
- new_scale = distance / priv->zoom_initial_distance;
-
- g_signal_emit (action, zoom_signals[ZOOM], 0,
- actor, &priv->focal_point, new_scale,
- &retval);
-
- return TRUE;
-}
-
-static void
-clutter_zoom_action_gesture_cancel (ClutterGestureAction *action,
- ClutterActor *actor)
-{
- ClutterZoomActionPrivate *priv = ((ClutterZoomAction *) action)->priv;
-
- clutter_actor_set_translation (actor,
- priv->initial_x,
- priv->initial_y,
- priv->initial_z);
- clutter_actor_set_scale (actor, priv->initial_scale_x, priv->initial_scale_y);
-}
-
-static gboolean
-clutter_zoom_action_real_zoom (ClutterZoomAction *action,
- ClutterActor *actor,
- graphene_point_t *focal_point,
- gdouble factor)
-{
- ClutterZoomActionPrivate *priv = action->priv;
- gfloat x, y, z;
- gdouble scale_x, scale_y;
- graphene_point3d_t out, in;
-
- in.x = priv->transformed_focal_point.x;
- in.y = priv->transformed_focal_point.y;
- in.z = 0;
-
- clutter_actor_apply_transform_to_point (actor, &in, &out);
-
- clutter_actor_get_scale (actor, &scale_x, &scale_y);
-
- switch (priv->zoom_axis)
- {
- case CLUTTER_ZOOM_BOTH:
- clutter_actor_set_scale (actor, factor, factor);
- break;
-
- case CLUTTER_ZOOM_X_AXIS:
- clutter_actor_set_scale (actor, factor, scale_y);
- break;
-
- case CLUTTER_ZOOM_Y_AXIS:
- clutter_actor_set_scale (actor, scale_x, factor);
- break;
-
- default:
- break;
- }
-
- x = priv->initial_x + priv->focal_point.x - priv->initial_focal_point.x;
- y = priv->initial_y + priv->focal_point.y - priv->initial_focal_point.y;
- clutter_actor_get_translation (actor, NULL, NULL, &z);
- clutter_actor_set_translation (actor, x, y, z);
-
- return TRUE;
-}
-
-static void
-clutter_zoom_action_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ClutterZoomAction *action = CLUTTER_ZOOM_ACTION (gobject);
-
- switch (prop_id)
- {
- case PROP_ZOOM_AXIS:
- clutter_zoom_action_set_zoom_axis (action, g_value_get_enum (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- }
-}
-
-static void
-clutter_zoom_action_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ClutterZoomActionPrivate *priv = CLUTTER_ZOOM_ACTION (gobject)->priv;
-
- switch (prop_id)
- {
- case PROP_ZOOM_AXIS:
- g_value_set_enum (value, priv->zoom_axis);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
- }
-}
-
-static void
-clutter_zoom_action_dispose (GObject *gobject)
-{
- G_OBJECT_CLASS (clutter_zoom_action_parent_class)->dispose (gobject);
-}
-
-static void
-clutter_zoom_action_constructed (GObject *gobject)
-{
- ClutterGestureAction *gesture;
-
- gesture = CLUTTER_GESTURE_ACTION (gobject);
- clutter_gesture_action_set_threshold_trigger_edge (gesture, CLUTTER_GESTURE_TRIGGER_EDGE_NONE);
-}
-
-static void
-clutter_zoom_action_class_init (ClutterZoomActionClass *klass)
-{
- ClutterGestureActionClass *gesture_class =
- CLUTTER_GESTURE_ACTION_CLASS (klass);
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- gobject_class->constructed = clutter_zoom_action_constructed;
- gobject_class->set_property = clutter_zoom_action_set_property;
- gobject_class->get_property = clutter_zoom_action_get_property;
- gobject_class->dispose = clutter_zoom_action_dispose;
-
- gesture_class->gesture_begin = clutter_zoom_action_gesture_begin;
- gesture_class->gesture_progress = clutter_zoom_action_gesture_progress;
- gesture_class->gesture_cancel = clutter_zoom_action_gesture_cancel;
-
- klass->zoom = clutter_zoom_action_real_zoom;
-
- /**
- * ClutterZoomAction:zoom-axis:
- *
- * Constraints the zooming action to the specified axis
- *
- * Since: 1.12
- */
- zoom_props[PROP_ZOOM_AXIS] =
- g_param_spec_enum ("zoom-axis",
- P_("Zoom Axis"),
- P_("Constraints the zoom to an axis"),
- CLUTTER_TYPE_ZOOM_AXIS,
- CLUTTER_ZOOM_BOTH,
- CLUTTER_PARAM_READWRITE);
-
- g_object_class_install_properties (gobject_class,
- PROP_LAST,
- zoom_props);
-
- /**
- * ClutterZoomAction::zoom:
- * @action: the #ClutterZoomAction that emitted the signal
- * @actor: the #ClutterActor attached to the action
- * @focal_point: the focal point of the zoom
- * @factor: the initial distance between the 2 touch points
- *
- * The ::zoom signal is emitted for each series of touch events that
- * change the distance and focal point between the touch points.
- *
- * The default handler of the signal will call
- * clutter_actor_set_scale() on @actor using the ratio of the first
- * distance between the touch points and the current distance. To
- * override the default behaviour, connect to this signal and return
- * %FALSE.
- *
- * Return value: %TRUE if the zoom should continue, and %FALSE if
- * the zoom should be cancelled.
- *
- * Since: 1.12
- */
- zoom_signals[ZOOM] =
- g_signal_new (I_("zoom"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ClutterZoomActionClass, zoom),
- _clutter_boolean_continue_accumulator, NULL,
- _clutter_marshal_BOOLEAN__OBJECT_BOXED_DOUBLE,
- G_TYPE_BOOLEAN, 3,
- CLUTTER_TYPE_ACTOR,
- GRAPHENE_TYPE_POINT,
- G_TYPE_DOUBLE);
-}
-
-static void
-clutter_zoom_action_init (ClutterZoomAction *self)
-{
- ClutterGestureAction *gesture;
-
- self->priv = clutter_zoom_action_get_instance_private (self);
- self->priv->zoom_axis = CLUTTER_ZOOM_BOTH;
-
- gesture = CLUTTER_GESTURE_ACTION (self);
- clutter_gesture_action_set_n_touch_points (gesture, 2);
-}
-
-/**
- * clutter_zoom_action_new:
- *
- * Creates a new #ClutterZoomAction instance
- *
- * Return value: the newly created #ClutterZoomAction
- *
- * Since: 1.12
- */
-ClutterAction *
-clutter_zoom_action_new (void)
-{
- return g_object_new (CLUTTER_TYPE_ZOOM_ACTION, NULL);
-}
-
-/**
- * clutter_zoom_action_set_zoom_axis:
- * @action: a #ClutterZoomAction
- * @axis: the axis to constraint the zooming to
- *
- * Restricts the zooming action to a specific axis
- *
- * Since: 1.12
- */
-void
-clutter_zoom_action_set_zoom_axis (ClutterZoomAction *action,
- ClutterZoomAxis axis)
-{
- g_return_if_fail (CLUTTER_IS_ZOOM_ACTION (action));
- g_return_if_fail (axis >= CLUTTER_ZOOM_X_AXIS &&
- axis <= CLUTTER_ZOOM_BOTH);
-
- if (action->priv->zoom_axis == axis)
- return;
-
- action->priv->zoom_axis = axis;
-
- g_object_notify_by_pspec (G_OBJECT (action), zoom_props[PROP_ZOOM_AXIS]);
-}
-
-/**
- * clutter_zoom_action_get_zoom_axis:
- * @action: a #ClutterZoomAction
- *
- * Retrieves the axis constraint set by clutter_zoom_action_set_zoom_axis()
- *
- * Return value: the axis constraint
- *
- * Since: 1.12
- */
-ClutterZoomAxis
-clutter_zoom_action_get_zoom_axis (ClutterZoomAction *action)
-{
- g_return_val_if_fail (CLUTTER_IS_ZOOM_ACTION (action),
- CLUTTER_ZOOM_BOTH);
-
- return action->priv->zoom_axis;
-}
-
-/**
- * clutter_zoom_action_get_focal_point:
- * @action: a #ClutterZoomAction
- * @point: (out): a #graphene_point_t
- *
- * Retrieves the focal point of the current zoom
- *
- * Since: 1.12
- */
-void
-clutter_zoom_action_get_focal_point (ClutterZoomAction *action,
- graphene_point_t *point)
-{
- g_return_if_fail (CLUTTER_IS_ZOOM_ACTION (action));
- g_return_if_fail (point != NULL);
-
- *point = action->priv->focal_point;
-}
-
-/**
- * clutter_zoom_action_get_transformed_focal_point:
- * @action: a #ClutterZoomAction
- * @point: (out): a #graphene_point_t
- *
- * Retrieves the focal point relative to the actor's coordinates of
- * the current zoom
- *
- * Since: 1.12
- */
-void
-clutter_zoom_action_get_transformed_focal_point (ClutterZoomAction *action,
- graphene_point_t *point)
-{
- g_return_if_fail (CLUTTER_IS_ZOOM_ACTION (action));
- g_return_if_fail (point != NULL);
-
- *point = action->priv->transformed_focal_point;
-}
diff --git a/clutter/clutter/clutter-zoom-action.h b/clutter/clutter/clutter-zoom-action.h
deleted file mode 100644
index f1f7e572d..000000000
--- a/clutter/clutter/clutter-zoom-action.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2012 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- * Lionel Landwerlin <lionel.g.landwerlin@linux.intel.com>
- */
-
-#ifndef __CLUTTER_ZOOM_ACTION_H__
-#define __CLUTTER_ZOOM_ACTION_H__
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#include <clutter/clutter-event.h>
-#include <clutter/clutter-gesture-action.h>
-#include <clutter/clutter-types.h>
-
-G_BEGIN_DECLS
-
-#define CLUTTER_TYPE_ZOOM_ACTION (clutter_zoom_action_get_type ())
-#define CLUTTER_ZOOM_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ZOOM_ACTION, ClutterZoomAction))
-#define CLUTTER_IS_ZOOM_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ZOOM_ACTION))
-#define CLUTTER_ZOOM_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_ZOOM_ACTION, ClutterZoomActionClass))
-#define CLUTTER_IS_ZOOM_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_ZOOM_ACTION))
-#define CLUTTER_ZOOM_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ZOOM_ACTION, ClutterZoomActionClass))
-
-typedef struct _ClutterZoomAction ClutterZoomAction;
-typedef struct _ClutterZoomActionPrivate ClutterZoomActionPrivate;
-typedef struct _ClutterZoomActionClass ClutterZoomActionClass;
-
-/**
- * ClutterZoomAction:
- *
- * The #ClutterZoomAction structure contains only
- * private data and should be accessed using the provided API
- *
- * Since: 1.12
- */
-struct _ClutterZoomAction
-{
- /*< private >*/
- ClutterGestureAction parent_instance;
-
- ClutterZoomActionPrivate *priv;
-};
-
-/**
- * ClutterZoomActionClass:
- * @zoom: class handler of the #ClutterZoomAction::zoom signal
- *
- * The #ClutterZoomActionClass structure contains
- * only private data
- *
- * Since: 1.12
- */
-struct _ClutterZoomActionClass
-{
- /*< private >*/
- ClutterGestureActionClass parent_class;
-
- /*< public >*/
- gboolean (* zoom) (ClutterZoomAction *action,
- ClutterActor *actor,
- graphene_point_t *focal_point,
- gdouble factor);
-
- /*< private >*/
- void (* _clutter_zoom_action1) (void);
- void (* _clutter_zoom_action2) (void);
- void (* _clutter_zoom_action3) (void);
- void (* _clutter_zoom_action4) (void);
- void (* _clutter_zoom_action5) (void);
-};
-
-CLUTTER_EXPORT
-GType clutter_zoom_action_get_type (void) G_GNUC_CONST;
-
-CLUTTER_EXPORT
-ClutterAction * clutter_zoom_action_new (void);
-
-CLUTTER_EXPORT
-void clutter_zoom_action_set_zoom_axis (ClutterZoomAction *action,
- ClutterZoomAxis axis);
-CLUTTER_EXPORT
-ClutterZoomAxis clutter_zoom_action_get_zoom_axis (ClutterZoomAction *action);
-
-CLUTTER_EXPORT
-void clutter_zoom_action_get_focal_point (ClutterZoomAction *action,
- graphene_point_t *point);
-CLUTTER_EXPORT
-void clutter_zoom_action_get_transformed_focal_point (ClutterZoomAction *action,
- graphene_point_t *point);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_ZOOM_ACTION_H__ */
diff --git a/clutter/clutter/clutter.h b/clutter/clutter/clutter.h
deleted file mode 100644
index 8eefead61..000000000
--- a/clutter/clutter/clutter.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Authored By Matthew Allum <mallum@openedhand.com>
- *
- * Copyright (C) 2006 OpenedHand
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 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_H__
-#define __CLUTTER_H__
-
-#define __CLUTTER_H_INSIDE__
-
-#include "clutter-types.h"
-
-#include "clutter-action.h"
-#include "clutter-actor.h"
-#include "clutter-actor-meta.h"
-#include "clutter-align-constraint.h"
-#include "clutter-animatable.h"
-#include "clutter-backend.h"
-#include "clutter-bind-constraint.h"
-#include "clutter-binding-pool.h"
-#include "clutter-bin-layout.h"
-#include "clutter-blur-effect.h"
-#include "clutter-box-layout.h"
-#include "clutter-brightness-contrast-effect.h"
-#include "clutter-cairo.h"
-#include "clutter-canvas.h"
-#include "clutter-child-meta.h"
-#include "clutter-click-action.h"
-#include "clutter-clone.h"
-#include "clutter-color.h"
-#include "clutter-color-static.h"
-#include "clutter-colorize-effect.h"
-#include "clutter-constraint.h"
-#include "clutter-container.h"
-#include "clutter-content.h"
-#include "clutter-deform-effect.h"
-#include "clutter-desaturate-effect.h"
-#include "clutter-effect.h"
-#include "clutter-enums.h"
-#include "clutter-enum-types.h"
-#include "clutter-event.h"
-#include "clutter-feature.h"
-#include "clutter-fixed-layout.h"
-#include "clutter-flow-layout.h"
-#include "clutter-frame-clock.h"
-#include "clutter-frame.h"
-#include "clutter-gesture-action.h"
-#include "clutter-grid-layout.h"
-#include "clutter-image.h"
-#include "clutter-input-device.h"
-#include "clutter-input-device-tool.h"
-#include "clutter-input-method.h"
-#include "clutter-input-focus.h"
-#include "clutter-interval.h"
-#include "clutter-keyframe-transition.h"
-#include "clutter-keymap.h"
-#include "clutter-keysyms.h"
-#include "clutter-layout-manager.h"
-#include "clutter-layout-meta.h"
-#include "clutter-macros.h"
-#include "clutter-main.h"
-#include "clutter-offscreen-effect.h"
-#include "clutter-page-turn-effect.h"
-#include "clutter-paint-nodes.h"
-#include "clutter-paint-node.h"
-#include "clutter-pan-action.h"
-#include "clutter-path-constraint.h"
-#include "clutter-path.h"
-#include "clutter-property-transition.h"
-#include "clutter-rotate-action.h"
-#include "clutter-scriptable.h"
-#include "clutter-script.h"
-#include "clutter-scroll-actor.h"
-#include "clutter-settings.h"
-#include "clutter-shader-effect.h"
-#include "clutter-shader-types.h"
-#include "clutter-swipe-action.h"
-#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-text.h"
-#include "clutter-texture-content.h"
-#include "clutter-timeline.h"
-#include "clutter-transition-group.h"
-#include "clutter-transition.h"
-#include "clutter-units.h"
-#include "clutter-virtual-input-device.h"
-#include "clutter-zoom-action.h"
-
-#include "clutter-deprecated.h"
-
-#include "clutter-autocleanups.h"
-
-#undef __CLUTTER_H_INSIDE__
-
-#endif /* __CLUTTER_H__ */
diff --git a/clutter/clutter/deprecated/clutter-container.h b/clutter/clutter/deprecated/clutter-container.h
deleted file mode 100644
index c1e256544..000000000
--- a/clutter/clutter/deprecated/clutter-container.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2011 Intel Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * ClutterContainer: Generic actor container interface.
- *
- * Author: Emmanuele Bassi <ebassi@linux.intel.com>
- */
-
-#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
-#error "Only <clutter/clutter.h> can be included directly."
-#endif
-
-#ifndef __CLUTTER_CONTAINER_DEPRECATED_H__
-#define __CLUTTER_CONTAINER_DEPRECATED_H__
-
-#include <clutter/clutter-container.h>
-
-G_BEGIN_DECLS
-
-CLUTTER_DEPRECATED_FOR(clutter_actor_add_child)
-void clutter_container_add (ClutterContainer *container,
- ClutterActor *first_actor,
- ...) G_GNUC_NULL_TERMINATED;
-
-CLUTTER_DEPRECATED_FOR(clutter_actor_add_child)
-void clutter_container_add_actor (ClutterContainer *container,
- ClutterActor *actor);
-
-CLUTTER_DEPRECATED_FOR(clutter_actor_remove_child)
-void clutter_container_remove (ClutterContainer *container,
- ClutterActor *first_actor,
- ...) G_GNUC_NULL_TERMINATED;
-
-CLUTTER_DEPRECATED_FOR(clutter_actor_remove_child)
-void clutter_container_remove_actor (ClutterContainer *container,
- ClutterActor *actor);
-
-CLUTTER_DEPRECATED_FOR(clutter_actor_get_children)
-GList * clutter_container_get_children (ClutterContainer *container);
-
-CLUTTER_DEPRECATED_FOR(clutter_actor_set_child_above_sibling)
-void clutter_container_raise_child (ClutterContainer *container,
- ClutterActor *actor,
- ClutterActor *sibling);
-
-CLUTTER_DEPRECATED_FOR(clutter_actor_set_child_below_sibling)
-void clutter_container_lower_child (ClutterContainer *container,
- ClutterActor *actor,
- ClutterActor *sibling);
-
-CLUTTER_DEPRECATED
-void clutter_container_sort_depth_order (ClutterContainer *container);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_CONTAINER_DEPRECATED_H__ */
diff --git a/clutter/clutter/deprecated/clutter-timeline.h b/clutter/clutter/deprecated/clutter-timeline.h
deleted file mode 100644
index 169bd7c76..000000000
--- a/clutter/clutter/deprecated/clutter-timeline.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Clutter.
- *
- * An OpenGL based 'interactive canvas' library.
- *
- * Copyright (C) 2012 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_TIMELINE_PRIVATE_H__
-#define __CLUTTER_TIMELINE_PRIVATE_H__
-
-#include <clutter/clutter-timeline.h>
-
-G_BEGIN_DECLS
-
-CLUTTER_DEPRECATED_FOR(clutter_timeline_new_for_actor)
-ClutterTimeline * clutter_timeline_new (guint duration_ms);
-
-G_END_DECLS
-
-#endif /* __CLUTTER_TIMELINE_PRIVATE_H__ */
diff --git a/clutter/clutter/meson.build b/clutter/clutter/meson.build
deleted file mode 100644
index fee76438b..000000000
--- a/clutter/clutter/meson.build
+++ /dev/null
@@ -1,410 +0,0 @@
-clutter_clutter_includesubdir = join_paths(clutter_includesubdir, 'clutter')
-clutter_clutter_includedir = join_paths(clutter_includedir, 'clutter')
-
-clutter_headers = [
- 'clutter.h',
- 'clutter-action.h',
- 'clutter-actor-meta.h',
- 'clutter-actor.h',
- 'clutter-align-constraint.h',
- 'clutter-animatable.h',
- 'clutter-autocleanups.h',
- 'clutter-backend.h',
- 'clutter-bind-constraint.h',
- 'clutter-binding-pool.h',
- 'clutter-bin-layout.h',
- 'clutter-blur-effect.h',
- 'clutter-box-layout.h',
- 'clutter-brightness-contrast-effect.h',
- 'clutter-cairo.h',
- 'clutter-canvas.h',
- 'clutter-child-meta.h',
- 'clutter-click-action.h',
- 'clutter-clone.h',
- 'clutter-color-static.h',
- 'clutter-color.h',
- 'clutter-colorize-effect.h',
- 'clutter-constraint.h',
- 'clutter-container.h',
- 'clutter-content.h',
- 'clutter-deform-effect.h',
- 'clutter-deprecated.h',
- 'clutter-desaturate-effect.h',
- 'clutter-effect.h',
- 'clutter-enums.h',
- 'clutter-event.h',
- 'clutter-feature.h',
- 'clutter-fixed-layout.h',
- 'clutter-flow-layout.h',
- 'clutter-frame-clock.h',
- 'clutter-frame.h',
- 'clutter-gesture-action.h',
- 'clutter-grid-layout.h',
- 'clutter-image.h',
- 'clutter-input-device.h',
- 'clutter-input-device-tool.h',
- 'clutter-input-focus.h',
- 'clutter-input-method.h',
- 'clutter-interval.h',
- 'clutter-keyframe-transition.h',
- 'clutter-keymap.h',
- 'clutter-keysyms.h',
- 'clutter-layout-manager.h',
- 'clutter-layout-meta.h',
- 'clutter-macros.h',
- 'clutter-main.h',
- 'clutter-mutter.h',
- 'clutter-offscreen-effect.h',
- 'clutter-page-turn-effect.h',
- 'clutter-paint-context.h',
- 'clutter-paint-nodes.h',
- 'clutter-paint-node.h',
- 'clutter-pan-action.h',
- 'clutter-path-constraint.h',
- 'clutter-path.h',
- 'clutter-pick-context.h',
- 'clutter-property-transition.h',
- 'clutter-rotate-action.h',
- 'clutter-script.h',
- 'clutter-scriptable.h',
- 'clutter-scroll-actor.h',
- 'clutter-seat.h',
- 'clutter-settings.h',
- 'clutter-shader-effect.h',
- 'clutter-shader-types.h',
- 'clutter-swipe-action.h',
- 'clutter-snap-constraint.h',
- 'clutter-stage.h',
- 'clutter-stage-manager.h',
- 'clutter-stage-view.h',
- 'clutter-tap-action.h',
- 'clutter-text.h',
- 'clutter-text-buffer.h',
- 'clutter-texture-content.h',
- 'clutter-timeline.h',
- 'clutter-transition-group.h',
- 'clutter-transition.h',
- 'clutter-types.h',
- 'clutter-units.h',
- 'clutter-virtual-input-device.h',
- 'clutter-zoom-action.h',
-]
-
-clutter_sources = [
- 'clutter-action.c',
- 'clutter-actor-box.c',
- 'clutter-actor-meta.c',
- 'clutter-actor.c',
- 'clutter-align-constraint.c',
- 'clutter-animatable.c',
- 'clutter-backend.c',
- 'clutter-base-types.c',
- 'clutter-bezier.c',
- 'clutter-bind-constraint.c',
- 'clutter-binding-pool.c',
- 'clutter-bin-layout.c',
- 'clutter-blur.c',
- 'clutter-blur-effect.c',
- 'clutter-box-layout.c',
- 'clutter-brightness-contrast-effect.c',
- 'clutter-cairo.c',
- 'clutter-canvas.c',
- 'clutter-child-meta.c',
- 'clutter-click-action.c',
- 'clutter-clone.c',
- 'clutter-color.c',
- 'clutter-colorize-effect.c',
- 'clutter-constraint.c',
- 'clutter-container.c',
- 'clutter-content.c',
- 'clutter-damage-history.c',
- 'clutter-deform-effect.c',
- 'clutter-desaturate-effect.c',
- 'clutter-effect.c',
- 'clutter-event.c',
- 'clutter-feature.c',
- 'clutter-fixed-layout.c',
- 'clutter-flatten-effect.c',
- 'clutter-flow-layout.c',
- 'clutter-frame-clock.c',
- 'clutter-frame.c',
- 'clutter-gesture-action.c',
- 'clutter-graphene.c',
- 'clutter-grid-layout.c',
- 'clutter-image.c',
- 'clutter-input-device.c',
- 'clutter-input-device-tool.c',
- 'clutter-input-focus.c',
- 'clutter-input-method.c',
- 'clutter-input-pointer-a11y.c',
- 'clutter-virtual-input-device.c',
- 'clutter-interval.c',
- 'clutter-keyframe-transition.c',
- 'clutter-keymap.c',
- 'clutter-keysyms-table.c',
- 'clutter-layout-manager.c',
- 'clutter-layout-meta.c',
- 'clutter-main.c',
- 'clutter-offscreen-effect.c',
- 'clutter-page-turn-effect.c',
- 'clutter-paint-context.c',
- 'clutter-paint-nodes.c',
- 'clutter-paint-node.c',
- 'clutter-pan-action.c',
- 'clutter-path-constraint.c',
- 'clutter-path.c',
- 'clutter-pick-context.c',
- 'clutter-pick-stack.c',
- 'clutter-property-transition.c',
- 'clutter-rotate-action.c',
- 'clutter-script.c',
- 'clutter-script-parser.c',
- 'clutter-scriptable.c',
- 'clutter-scroll-actor.c',
- 'clutter-seat.c',
- 'clutter-settings.c',
- 'clutter-shader-effect.c',
- 'clutter-shader-types.c',
- 'clutter-swipe-action.c',
- 'clutter-snap-constraint.c',
- 'clutter-stage.c',
- 'clutter-stage-manager.c',
- 'clutter-stage-view.c',
- 'clutter-stage-window.c',
- 'clutter-tap-action.c',
- 'clutter-text.c',
- 'clutter-text-buffer.c',
- 'clutter-texture-content.c',
- 'clutter-transition-group.c',
- 'clutter-transition.c',
- 'clutter-timeline.c',
- 'clutter-units.c',
- 'clutter-util.c',
- 'clutter-paint-volume.c',
- 'clutter-zoom-action.c',
-]
-
-clutter_private_headers = [
- 'clutter-actor-meta-private.h',
- 'clutter-actor-private.h',
- 'clutter-backend-private.h',
- 'clutter-bezier.h',
- 'clutter-blur-private.h',
- 'clutter-constraint-private.h',
- 'clutter-content-private.h',
- 'clutter-damage-history.h',
- 'clutter-debug.h',
- 'clutter-easing.h',
- 'clutter-effect-private.h',
- 'clutter-event-private.h',
- 'clutter-flatten-effect.h',
- 'clutter-frame-private.h',
- 'clutter-graphene.h',
- 'clutter-gesture-action-private.h',
- 'clutter-id-pool.h',
- 'clutter-input-device-private.h',
- 'clutter-input-focus-private.h',
- 'clutter-input-method-private.h',
- 'clutter-input-pointer-a11y-private.h',
- 'clutter-keymap-private.h',
- 'clutter-offscreen-effect-private.h',
- 'clutter-paint-context-private.h',
- 'clutter-paint-node-private.h',
- 'clutter-paint-volume-private.h',
- 'clutter-private.h',
- 'clutter-script-private.h',
- 'clutter-settings-private.h',
- 'clutter-stage-manager-private.h',
- 'clutter-stage-private.h',
- 'clutter-stage-view-private.h',
- 'clutter-stage-window.h',
- 'clutter-timeline-private.h',
-]
-
-clutter_nonintrospected_sources = [
- 'clutter-easing.c',
- 'clutter-id-pool.c',
-]
-
-clutter_deprecated_headers = [
- 'deprecated/clutter-container.h',
- 'deprecated/clutter-timeline.h',
-]
-
-clutter_backend_private_headers = []
-
-cally_headers = [
- 'cally/cally-actor.h',
- 'cally/cally-clone.h',
- 'cally/cally-factory.h',
- 'cally/cally.h',
- 'cally/cally-main.h',
- 'cally/cally-root.h',
- 'cally/cally-stage.h',
- 'cally/cally-text.h',
- 'cally/cally-util.h',
-]
-
-cally_sources = [
- 'cally/cally-actor.c',
- 'cally/cally.c',
- 'cally/cally-clone.c',
- 'cally/cally-root.c',
- 'cally/cally-stage.c',
- 'cally/cally-text.c',
- 'cally/cally-util.c',
-]
-
-cally_private_headers = [
- 'cally/cally-actor-private.h',
-]
-
-clutter_built_sources = []
-clutter_built_headers = []
-clutter_built_private_headers = []
-
-cdata = configuration_data()
-cdata.set_quoted('MUTTER_VERSION', meson.project_version())
-cdata.set('CLUTTER_DRIVERS', '"*"')
-cdata.set('HAVE_PANGO_FT2', have_pango_ft2)
-
-clutter_build_config_h = configure_file(
- input: 'clutter-build-config.h.meson',
- output: 'clutter-build-config.h',
- configuration: cdata,
- install: false,
-)
-clutter_built_private_headers += clutter_build_config_h
-
-clutter_enum_types = gnome.mkenums('clutter-enum-types',
- sources: [clutter_headers, clutter_deprecated_headers],
- c_template: 'clutter-enum-types.c.in',
- h_template: 'clutter-enum-types.h.in',
- install_dir: clutter_clutter_includedir,
- install_header: true,
-)
-clutter_built_sources += clutter_enum_types[0]
-clutter_built_headers += clutter_enum_types[1]
-
-clutter_marshal = gnome.genmarshal('clutter-marshal',
- prefix: '_clutter_marshal',
- sources: 'clutter-marshal.list',
- valist_marshallers: true,
- extra_args: ['--quiet'],
- install_dir: clutter_clutter_includedir,
- install_header: true,
-)
-clutter_built_sources += clutter_marshal[0]
-clutter_built_headers += clutter_marshal[1]
-
-libmutter_clutter_name = 'mutter-clutter-' + libmutter_api_version
-libmutter_clutter = shared_library(libmutter_clutter_name,
- sources: [
- clutter_sources,
- clutter_headers,
- clutter_private_headers,
- clutter_nonintrospected_sources,
- clutter_deprecated_headers,
- clutter_built_sources,
- clutter_built_headers,
- cally_sources,
- cally_headers,
- cally_private_headers,
- ],
- version: '0.0.0',
- soversion: 0,
- c_args: clutter_c_args,
- include_directories: clutter_includes,
- dependencies: [clutter_deps],
- gnu_symbol_visibility: 'hidden',
- link_with: [
- libmutter_cogl,
- libmutter_cogl_pango,
- ],
- install_rpath: pkglibdir,
- install_dir: pkglibdir,
- install: true,
-)
-libmutter_clutter_dep = declare_dependency(
- sources: [clutter_enum_types[1]],
- link_with: libmutter_clutter,
- dependencies: clutter_deps,
-)
-
-if have_introspection
- clutter_introspection_args = introspection_args + [
- '-DCLUTTER_SYSCONFDIR="@0@"'.format(join_paths(prefix, sysconfdir)),
- '-DCLUTTER_COMPILATION=1',
- '-DCOGL_DISABLE_DEPRECATION_WARNINGS',
- '-DG_LOG_DOMAIN="Clutter"'
- ]
-
- libmutter_clutter_gir = gnome.generate_gir(libmutter_clutter,
- sources: [
- clutter_built_sources,
- clutter_built_headers,
- clutter_sources,
- clutter_headers,
- clutter_deprecated_headers,
- ],
- nsversion: libmutter_api_version,
- namespace: 'Clutter',
- export_packages: [libmutter_clutter_name],
- includes: [
- libmutter_cogl_gir[0],
- libmutter_cogl_pango_gir[0],
- 'GL-1.0',
- 'GObject-2.0',
- 'cairo-1.0',
- 'Atk-1.0',
- 'Json-1.0',
- ],
- dependencies: [cogl_deps],
- extra_args: clutter_introspection_args + ['--c-include=clutter/clutter.h'],
- install_dir_gir: pkglibdir,
- install_dir_typelib: pkglibdir,
- install: true,
- )
-
- libmutter_cally_gir = gnome.generate_gir(libmutter_clutter,
- sources: [
- cally_sources,
- cally_headers,
- ],
- nsversion: libmutter_api_version,
- namespace: 'Cally',
- includes: [
- libmutter_cogl_gir[0],
- libmutter_cogl_pango_gir[0],
- libmutter_clutter_gir[0],
- ],
- dependencies: [cogl_deps],
- extra_args: clutter_introspection_args,
- install_dir_gir: pkglibdir,
- install_dir_typelib: pkglibdir,
- install: true
- )
-endif
-
-install_headers(clutter_headers,
- subdir: clutter_clutter_includesubdir)
-
-install_headers(cally_headers,
- subdir: join_paths(clutter_includesubdir, 'cally'))
-
-install_headers(clutter_deprecated_headers,
- subdir: join_paths(clutter_clutter_includesubdir, 'deprecated'))
-
-pkg.generate(libmutter_clutter,
- name: 'Mutters Clutter',
- filebase: libmutter_clutter_name,
- description: 'Mutters Clutter Private Library',
- libraries: [m_dep],
- subdirs: join_paths(pkgname, 'clutter'),
- requires: [clutter_pkg_deps, libmutter_cogl_name],
- version: meson.project_version(),
- variables: [
- 'apiversion=' + libmutter_api_version,
- ],
- install_dir: pcdir,
-)
diff --git a/clutter/clutter/mutter-clutter.pc.in b/clutter/clutter/mutter-clutter.pc.in
deleted file mode 100644
index 6509dfc95..000000000
--- a/clutter/clutter/mutter-clutter.pc.in
+++ /dev/null
@@ -1,24 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-apiversion=@LIBMUTTER_API_VERSION@
-libdir=@libdir@/mutter-${apiversion}
-includedir=@includedir@/mutter-${apiversion}
-
-requires=@CLUTTER_REQUIRES@ mutter-cogl-${apiversion}
-requires_private=@CLUTTER_REQUIRES_PRIVATE@
-backends=@CLUTTER_BACKENDS@
-
-# only kept for backward compatibility
-soname_infix=@CLUTTER_SONAME_INFIX@
-winsys=@CLUTTER_WINSYS@
-backend=@CLUTTER_WINSYS@
-cogl=deprecated
-cogl_driver=deprecated
-
-Name: Mutter Clutter
-Description: Mutter's Clutter Private Library
-Version: @MUTTER_VERSION@
-Libs: -L${libdir} -lmutter-clutter-${apiversion}
-Cflags: -I${includedir}/clutter
-Requires: ${requires}
-Requires.private: ${requires_private}