Compare commits
3 Commits
wip/carlos
...
wip/kms-co
Author | SHA1 | Date | |
---|---|---|---|
9582f7b207 | |||
5fa38f4cd5 | |||
0ae31a45ab |
1
.gitignore
vendored
1
.gitignore
vendored
@ -103,4 +103,3 @@ doc/reference/meta.types
|
||||
.dirstamp
|
||||
**/tags.*
|
||||
build/
|
||||
subprojects/sysprof/
|
||||
|
@ -1,10 +1,9 @@
|
||||
image: registry.gitlab.gnome.org/gnome/mutter/master:v4
|
||||
image: registry.gitlab.gnome.org/gnome/mutter/master:v2
|
||||
|
||||
stages:
|
||||
- review
|
||||
- build
|
||||
- test
|
||||
- coverage
|
||||
|
||||
check-commit-log:
|
||||
stage: review
|
||||
@ -17,9 +16,8 @@ check-commit-log:
|
||||
|
||||
build-mutter:
|
||||
stage: build
|
||||
needs: []
|
||||
script:
|
||||
- meson . build -Dbuildtype=debugoptimized -Db_coverage=true -Degl_device=true -Dwayland_eglstream=true --werror --prefix /usr
|
||||
- meson . build -Dbuildtype=debugoptimized -Degl_device=true -Dwayland_eglstream=true --werror --prefix /usr
|
||||
- ninja -C build
|
||||
- ninja -C build install
|
||||
artifacts:
|
||||
@ -30,30 +28,16 @@ build-mutter:
|
||||
- merge_requests
|
||||
- /^.*$/
|
||||
|
||||
build-without-opengl-and-glx:
|
||||
build-without-native-backend:
|
||||
stage: build
|
||||
needs: []
|
||||
script:
|
||||
- meson . build -Dbuildtype=debugoptimized -Dopengl=false -Dglx=false -Degl_device=true -Dwayland_eglstream=true --werror --prefix /usr
|
||||
- meson . build -Dbuildtype=debugoptimized -Dnative_backend=false -Dudev=false --werror --prefix /usr
|
||||
- ninja -C build
|
||||
- ninja -C build install
|
||||
artifacts:
|
||||
expire_in: 1 day
|
||||
paths:
|
||||
- build/meson-logs
|
||||
only:
|
||||
- merge_requests
|
||||
- /^.*$/
|
||||
|
||||
build-without-native-backend-and-wayland:
|
||||
stage: build
|
||||
needs: []
|
||||
script:
|
||||
- meson . build -Dbuildtype=debugoptimized -Dnative_backend=false -Dudev=false -Dwayland=false -Dcore_tests=false --werror --prefix /usr
|
||||
- ninja -C build
|
||||
- ninja -C build install
|
||||
artifacts:
|
||||
paths:
|
||||
- build/meson-logs
|
||||
- build
|
||||
only:
|
||||
- merge_requests
|
||||
- /^.*$/
|
||||
@ -62,13 +46,13 @@ test-mutter:
|
||||
stage: test
|
||||
dependencies:
|
||||
- build-mutter
|
||||
needs: ["build-mutter"]
|
||||
variables:
|
||||
XDG_RUNTIME_DIR: "$CI_PROJECT_DIR/runtime-dir"
|
||||
GSETTINGS_SCHEMA_DIR: "$CI_PROJECT_DIR/build/data"
|
||||
G_SLICE: "always-malloc"
|
||||
MALLOC_CHECK_: "3"
|
||||
NO_AT_BRIDGE: "1"
|
||||
MALLOC_PERTURB_: "123"
|
||||
script:
|
||||
- dconf update
|
||||
- mkdir -m 700 $XDG_RUNTIME_DIR
|
||||
@ -76,36 +60,14 @@ test-mutter:
|
||||
- >
|
||||
dbus-run-session -- xvfb-run -s '+iglx -noreset'
|
||||
meson test -C build --no-rebuild -t 10 --verbose --no-stdsplit --print-errorlogs --wrap catchsegv
|
||||
artifacts:
|
||||
expire_in: 1 day
|
||||
paths:
|
||||
- build
|
||||
only:
|
||||
- merge_requests
|
||||
- /^.*$/
|
||||
|
||||
test-mutter-coverage:
|
||||
stage: coverage
|
||||
dependencies:
|
||||
- test-mutter
|
||||
needs: ["test-mutter"]
|
||||
script:
|
||||
- ninja -C build coverage
|
||||
- cat build/meson-logs/coverage.txt
|
||||
artifacts:
|
||||
paths:
|
||||
- build/meson-logs
|
||||
when: manual
|
||||
except:
|
||||
refs:
|
||||
- tags
|
||||
- master
|
||||
|
||||
can-build-gnome-shell:
|
||||
stage: test
|
||||
dependencies:
|
||||
- build-mutter
|
||||
needs: ["build-mutter"]
|
||||
before_script:
|
||||
- meson install --no-rebuild -C build
|
||||
script:
|
||||
|
@ -1,28 +1,40 @@
|
||||
# Rebuild and push with
|
||||
#
|
||||
# cd .gitlab-ci/
|
||||
# podman build --format docker --no-cache -t registry.gitlab.gnome.org/gnome/mutter/master:v4 .
|
||||
# podman push registry.gitlab.gnome.org/gnome/mutter/master:v4
|
||||
# docker build --no-cache -t registry.gitlab.gnome.org/gnome/mutter/master:v2 .
|
||||
# docker push registry.gitlab.gnome.org/gnome/mutter/master:v2
|
||||
#
|
||||
|
||||
FROM fedora:32
|
||||
FROM fedora:30
|
||||
|
||||
RUN dnf -y update && dnf -y upgrade && \
|
||||
dnf install -y 'dnf-command(builddep)' && \
|
||||
dnf install -y 'dnf-command(copr)' && \
|
||||
dnf copr enable -y fmuellner/gnome-shell-ci && \
|
||||
dnf copr enable -y jadahl/mutter-ci && \
|
||||
dnf copr enable -y hergertme/sysprof-3 && \
|
||||
dnf -y update && dnf -y upgrade && \
|
||||
|
||||
dnf builddep -y mutter --setopt=install_weak_deps=False && \
|
||||
dnf builddep -y mutter && \
|
||||
|
||||
# Until Fedora catches up with meson build-deps
|
||||
dnf install -y meson xorg-x11-server-Xorg gnome-settings-daemon-devel egl-wayland-devel xorg-x11-server-Xwayland && \
|
||||
|
||||
# Until Fedora catches up with mesa bug fixes
|
||||
dnf upgrade -y mesa-dri-drivers mesa-libEGL && \
|
||||
|
||||
# For running unit tests
|
||||
dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 \
|
||||
'*/xvfb-run' gdm-lib accountsservice-libs gnome-control-center gcovr \
|
||||
libnma python3-gobject python3-dbusmock \
|
||||
--setopt=install_weak_deps=False && \
|
||||
dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 '*/xvfb-run' gdm-lib accountsservice-libs && \
|
||||
|
||||
dnf install -y sysprof-devel && \
|
||||
|
||||
dnf install -y intltool redhat-rpm-config make && \
|
||||
|
||||
# GNOME Shell
|
||||
dnf builddep -y gnome-shell --setopt=install_weak_deps=False && \
|
||||
dnf remove -y gnome-bluetooth-libs-devel && \
|
||||
# New dep this cycle
|
||||
dnf install -y 'pkgconfig(gnome-autoar-0)' && \
|
||||
dnf remove -y gnome-bluetooth-libs-devel dbus-glib-devel upower-devel python3-devel && \
|
||||
dnf remove -y --noautoremove mutter mutter-devel && \
|
||||
|
||||
dnf clean all
|
||||
|
@ -19,7 +19,7 @@ fi
|
||||
function commit_message_has_url() {
|
||||
commit=$1
|
||||
commit_message=$(git show -s --format='format:%b' $commit)
|
||||
echo "$commit_message" | grep -qe "\($CI_MERGE_REQUEST_PROJECT_URL/\(-/\)\?\(issues\|merge_requests\)/[0-9]\+\|https://bugzilla.gnome.org/show_bug.cgi?id=[0-9]\+\)"
|
||||
echo "$commit_message" | grep -qe "\($CI_MERGE_REQUEST_PROJECT_URL/\(issues\|merge_requests\)/[0-9]\+\|https://bugzilla.gnome.org/show_bug.cgi?id=[0-9]\+\)"
|
||||
return $?
|
||||
}
|
||||
|
||||
@ -40,12 +40,11 @@ function commit_message_subject_is_compliant() {
|
||||
return 0
|
||||
}
|
||||
|
||||
RET=0
|
||||
for commit in $commits; do
|
||||
commit_short=$(echo $commit | cut -c -8)
|
||||
|
||||
if ! commit_message_has_url $commit; then
|
||||
echo "Commit $commit_short needs a merge request or issue URL"
|
||||
echo "Missing merge request or issue URL on commit $commit_short"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -53,8 +52,6 @@ for commit in $commits; do
|
||||
if [ $? != 0 ]; then
|
||||
echo "Commit message for $commit_short is not compliant:"
|
||||
echo "$errors"
|
||||
RET=1
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
exit $RET
|
||||
|
@ -1,5 +1,6 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
mutter_branch=$(git describe --contains --all HEAD)
|
||||
gnome_shell_target=
|
||||
|
||||
git clone https://gitlab.gnome.org/GNOME/gnome-shell.git
|
||||
@ -25,7 +26,8 @@ if [ "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" ]; then
|
||||
fi
|
||||
|
||||
if [ -z "$gnome_shell_target" ]; then
|
||||
gnome_shell_target=$(git branch -r -l origin/$CI_COMMIT_REF_NAME)
|
||||
gnome_shell_target=$(git branch -r -l origin/$mutter_branch)
|
||||
gnome_shell_target=${gnome_shell_target:-$(git branch -r -l ${mutter_branch#remotes/})}
|
||||
gnome_shell_target=${gnome_shell_target:-origin/master}
|
||||
echo Using $gnome_shell_target instead
|
||||
fi
|
||||
|
@ -1,55 +0,0 @@
|
||||
<!--
|
||||
Please read https://wiki.gnome.org/Community/GettingInTouch/BugReportingGuidelines
|
||||
first to ensure that you create a clear and specific issue.
|
||||
-->
|
||||
|
||||
### Affected version
|
||||
|
||||
<!--
|
||||
Provide at least the following information:
|
||||
* Your OS and version
|
||||
* Affected Mutter version
|
||||
* Does this issue appear in XOrg and/or Wayland
|
||||
-->
|
||||
|
||||
### Bug summary
|
||||
|
||||
<!--
|
||||
Provide a short summary of the bug you encountered.
|
||||
-->
|
||||
|
||||
### Steps to reproduce
|
||||
|
||||
<!--
|
||||
1. Step one
|
||||
2. Step two
|
||||
3. ...
|
||||
-->
|
||||
|
||||
### What happened
|
||||
|
||||
<!--
|
||||
What did Mutter do that was unexpected?
|
||||
-->
|
||||
|
||||
### What did you expect to happen
|
||||
|
||||
<!--
|
||||
What did you expect Mutter to do?
|
||||
-->
|
||||
|
||||
### Relevant logs, screenshots, screencasts etc.
|
||||
|
||||
<!--
|
||||
If you have further information, such as technical documentation, logs,
|
||||
screenshots or screencasts related, please provide them here.
|
||||
|
||||
If the bug is a crash, please obtain a stack trace with installed debug
|
||||
symbols (at least for GNOME Shell and Mutter) and attach it to
|
||||
this issue following the instructions on
|
||||
https://wiki.gnome.org/Community/GettingInTouch/Bugzilla/GettingTraces.
|
||||
-->
|
||||
|
||||
|
||||
<!-- Do not remove the following line. -->
|
||||
/label ~"1. Bug"
|
@ -1,30 +0,0 @@
|
||||
<!--
|
||||
Please read https://wiki.gnome.org/Community/GettingInTouch/BugReportingGuidelines
|
||||
first to ensure that you create a clear and specific issue.
|
||||
-->
|
||||
|
||||
### Feature summary
|
||||
|
||||
<!--
|
||||
Describe what you would like to be able to do with Mutter
|
||||
that you currently cannot do.
|
||||
-->
|
||||
|
||||
### How would you like it to work
|
||||
|
||||
<!--
|
||||
If you can think of a way Mutter might be able to do this,
|
||||
let us know here.
|
||||
-->
|
||||
|
||||
### Relevant links, screenshots, screencasts etc.
|
||||
|
||||
<!--
|
||||
If you have further information, such as technical documentation,
|
||||
code, mockups or a similar feature in another window managers,
|
||||
please provide them here.
|
||||
-->
|
||||
|
||||
|
||||
<!-- Do not remove the following line. -->
|
||||
/label ~"1. Feature"
|
372
NEWS
372
NEWS
@ -1,375 +1,3 @@
|
||||
3.37.90
|
||||
=======
|
||||
* Fix using NEAREST filter for backgrounds on scaled monitors [Daniel V.; !1346]
|
||||
* Screencast fixes and improvements [Jonas; !1361, !1377, !1391]
|
||||
* Support tap-button-map and tap-drag-lock touchpad settings [Giusy; !1319]
|
||||
* Fix wine copy & paste [Sebastian; !1369]
|
||||
* Fix shadows of server-side decorated XWayland windows [Olivier; #1358]
|
||||
* Replace some loaded terms with more descriptive ones [Olivier; !1396]
|
||||
* Add API to launch trusted wayland clients [Sergio; #741]
|
||||
* Skip displays with 'non-desktop' property set [Philipp; !1393]
|
||||
* Invalidate offscreen effect cache on video memory purge [Daniel V.; !1374]
|
||||
* Add wl_shm support for 10 bpc and 16 bpc half float formats [Jonas; !804]
|
||||
* Fixed crashes [Jonas, Erik, Martin; !1365, !1375, #1343]
|
||||
* Misc. bug fixes and cleanups [Daniel V., Carlos, Olivier, Christian,
|
||||
Daniel * G., Jonas, Florian; !1370, !1376, !1385, !1352, !1386, !1390,
|
||||
!1388, !1397, !1398, !1401]
|
||||
|
||||
Contributors:
|
||||
Jonas Ådahl, Sergio Costas, Olivier Fourdan, Carlos Garnacho,
|
||||
Christian Hergert, Sebastian Keller, Erik Kurzinger, Giusy Margarita,
|
||||
Daniel García Moreno, Florian Müllner, Daniel van Vugt, Martin Whitaker,
|
||||
Philipp Zabel
|
||||
|
||||
Translators:
|
||||
Fabio Tomat [fur], Rafael Fontenelle [pt_BR], Jordi Mas [ca],
|
||||
Yuri Chornoivan [uk], Alexandre Franke [fr]
|
||||
|
||||
3.37.3
|
||||
======
|
||||
* Support custom keyboard layouts in $XDG_CONFIG_HOME/xkb [Peter; !936]
|
||||
* Optimize resource scale computation [Jonas D.; !1196, !1276, !1343]
|
||||
* Allow animating ClutterActor's content property [Georges; !1301]
|
||||
* Implement backgrounds as ClutterContent [Georges; !1302]
|
||||
* Add ClutterAlignContraint:pivot-point property [Jonas D.; !737]
|
||||
* Fix crash on area screenshots with fractional scaling [Sebastian; !1320]
|
||||
* Do not paint textures of fully obscured windows [Robert; !1326]
|
||||
* Use a more appropriate combine function on opaque areas [Daniel; !1331]
|
||||
* Fix remote desktop being broken without screencast session [Olivier; #1307]
|
||||
* Remove more long-deprecated Clutter APIs [Adam, Georges; !1194, !1332]
|
||||
* Drive each monitor by its own frame clock [Jonas Å.; !1285]
|
||||
* Fix copy/paste failures on X11 [Carlos; !1350]
|
||||
* Mipmap background texture rendering [Daniel; !1347]
|
||||
* Plugged memory leaks [Sebastian, Jonas D.; !1293, !1281, !1304]
|
||||
* Misc. bug fixes and cleanups [Jonas Å., Jonas D., Daniel, Corentin, Carlos,
|
||||
Sebastian, Michel, Robert, Florian; !1288, !1289, !1291, !1296, !1292, !1298,
|
||||
!1300, !1303, !1290, !1287, !1306, !1305, !1308, !1313, !1250, !1314, !1267,
|
||||
!1275, !1317, !1270, !1322, !1181, !1282, !1325, !1323, !1240, !1295, !1329,
|
||||
!1333, !1334, !1336, !1341, #1312, !1345, !1349, !1356, #873, !1310, !1357]
|
||||
|
||||
Contributors:
|
||||
Jonas Dreßler, Michel Dänzer, Olivier Fourdan, Carlos Garnacho,
|
||||
Peter Hutterer, Adam Jackson, Sebastian Keller, Robert Mader, Florian Müllner,
|
||||
Georges Basile Stavracas Neto, Corentin Noël, Daniel van Vugt, Jonas Ådahl
|
||||
|
||||
3.37.2
|
||||
======
|
||||
* Fix move-to-center keybinding with multiple monitors [Sergey; #1073]
|
||||
* Fix stuck buttons when a virtual device is destroyed [Carlos; !1239]
|
||||
* Use workarea when centering new windows [Akatsuki; #964]
|
||||
* Limit mipmap levels when rendering background [Daniel; !1003]
|
||||
* Broadcast clipboard/primary offers [Carlos; !1253]
|
||||
* Support primary-selection protocol from wayland-protocols [Carlos; !1255]
|
||||
* Fix monitor screen cast on X11 [Jonas Å.; !1251]
|
||||
* Support a "blank" cursor type [Florian; !1244]
|
||||
* Improve stage view damage tracking [Jonas Å.; !1237]
|
||||
* Implement touch-mode detecation for the X11 backend [Carlos; !1278]
|
||||
* Drop external keyboard detection from touch-mode heuristics [Carlos; !1277]
|
||||
* Optimize actor allocations [Jonas D.; !1247]
|
||||
* Fixed crashes [Daniel, Carlos, Jonas Å., Jonas D.; !1256, !1258, !1217, !1280]
|
||||
* Misc. bug fixes and cleanups [Christian, Jonas D., Olivier, Ting-Wei,
|
||||
Jonas Å., Marco, Corentin, Daniel, Robert, Niels, Florian, Simon; !1231,
|
||||
!1228, !1238, !1229, !1192, !1236, !1171, !1134, #1126, !1234, !1230, !1210,
|
||||
!1242, !1243, !1252, !1113, !1232, !1259, !1245, !1265, !1180, !1261, !788,
|
||||
!1264, !1235, !1218, !1150, !1274, !1271, !1279, !1283, !1272]
|
||||
|
||||
Contributors:
|
||||
Marco Trevisan (Treviño), Akatsuki, Jonas Dreßler, Olivier Fourdan,
|
||||
Carlos Garnacho, Niels De Graef, Ting-Wei Lan, Robert Mader, Simon McVittie,
|
||||
Florian Müllner, Corentin Noël, Christian Rauch, Daniel van Vugt,
|
||||
Sergey Zigachev, Jonas Ådahl
|
||||
|
||||
3.37.1
|
||||
======
|
||||
* Fix screencasting non-maximized windows [Jonas Å.; !1174]
|
||||
* Make window-aliveness checks less aggressive [Jonas Å.; !1182]
|
||||
* Fix stylus coordinates when using screen rotation [Jonas T.; #1118]
|
||||
* Preserve keyboard state on VT switch [Olivier; !1185]
|
||||
* Remove Clutter's drag and drop actions [Jonas D.; !789]
|
||||
* Cancel clicks/gestures actions on disable [Georges; !1188]
|
||||
* Fix various clipboard issues [Carlos; !1186, !1198, !1203, !1204, !1206]
|
||||
* Fix trackball button scrolling [Phillip; #1120]
|
||||
* Fix tiled monitor support [Jonas; !1199]
|
||||
* Support unredirecting fullscreen wayland surfaces [Jonas Å.; !798]
|
||||
* Support area screencasts [Jonas Å.; !1207]
|
||||
* Synchronize shadows to server-side decorations [Olivier; !1214]
|
||||
* Allow inhibiting remote access [Jonas Å.; !1212]
|
||||
* Fix overview key on X11 when using multiple keyboard layouts [Olivier; !1219]
|
||||
* Fixed crashes [Jonas, D., Carlos; !1173, !1183, !1012]
|
||||
* Misc. bug fixes and cleanups [Andre, Georges, Christian, Jonas Å., Andre,
|
||||
Simon, Florian, Carlos, Adam, Marco, Thomas, Elias, Pekka, Jonas D.,
|
||||
Laurent; !1169, !1168, !1166, !1170, !1167, !1172, !1175, !1176, !1184,
|
||||
!1126, !1187, !1191, !1195, !1179, !1200, !1193, !1209, !1213, !1208,
|
||||
#1074, !1223]
|
||||
|
||||
Contributors:
|
||||
Marco Trevisan (Treviño), Elias Aebi, Thomas Hindoe Paaboel Andersen,
|
||||
Laurent Bigonville, Jonas Dreßler, Olivier Fourdan, Carlos Garnacho,
|
||||
Adam Jackson, Andre Moreira Magalhaes, Simon McVittie, Florian Müllner,
|
||||
Georges Basile Stavracas Neto, Pekka Paalanen, Christian Rauch, Jonas Troeger,
|
||||
Phillip Wood, Jonas Ådahl
|
||||
|
||||
Translators:
|
||||
Dušan Kazik [sk], Christian Kirbach [de]
|
||||
|
||||
3.36.0
|
||||
======
|
||||
* Fix placement of popup windows in multi-monitor setups [Jonas; !1110]
|
||||
* Fix invisible mouse cursor on some hardware [Jonas; !1079]
|
||||
|
||||
Contributors:
|
||||
Jonas Ådahl
|
||||
|
||||
Translators:
|
||||
Aurimas Černius [lt], Goran Vidović [hr], Anders Jonsson [sv],
|
||||
Guillaume Bernard [fr], Milo Casagrande [it], Daniel Korostil [uk],
|
||||
Andre Klapper [cy], Aman Alam [pa], Nathan Follens [nl]
|
||||
|
||||
3.35.92
|
||||
=======
|
||||
* Fix visibility of initially hidden windows [Jonas Å.; !1066]
|
||||
* Avoid flicker when (un)redirecting windows [Sebastian; #997]
|
||||
* Let BindConstraints update the preferred size [Emmanuele; !1070]
|
||||
* Learn about GLES3 [Adam; !882]
|
||||
* Ping windows on every window focus [Jonas D.; !891]
|
||||
* Remove overhead from hot code paths [Christian;
|
||||
#1056, !1081, !1083, !1071, !1087]
|
||||
* Allow remote desktop services to inhibit animations [Jonas Å.; !838]
|
||||
* Update screen-cast code to PipeWire 0.3 API [Wim; !1062]
|
||||
* Make check-alive timeouts configurable [Jonas Å.; !1080]
|
||||
* Make each stage view correspond to a single CRTC [Jonas Å.; !1042]
|
||||
* Implement scaled/transformed hardware cursors [Robert; !526]
|
||||
* Use DMA buffers for screencasting if possible [Georges; !1086]
|
||||
* Make Xwayland startup asynchronous [Carlos; !944]
|
||||
* Fix clipping glitches in long text entries [Jonas D.; !1096]
|
||||
* Add side channel for starting required X11 services [Carlos; !945]
|
||||
* Support synchronized wayland popup moving [Jonas Å.; !705]
|
||||
* Fixed crashes [Olivier, Jonas Å.; !1073, !1093]
|
||||
* Plugged memory leaks [Sebastian, Jonas Å.; !1089, !1095]
|
||||
* Misc. bug fixes and cleanups [Jonas Å, Olivier, Florian, Daniel, Jonas D.,
|
||||
Robert, Sebastian, Christian, Arun, Carlos, worldofpeace; !1061, #1043,
|
||||
!1067, !1068, !1065, !835, !1058, !1069, !1075, #1060, !1077, !423, !1090,
|
||||
!1088, !1094, #1067, !1064, !1099, !957, !1000, !1082]
|
||||
|
||||
Contributors:
|
||||
Emmanuele Bassi, Jonas Dreßler, Olivier Fourdan, Carlos Garnacho,
|
||||
Christian Hergert, Adam Jackson, Sebastian Keller, Robert Mader,
|
||||
Florian Müllner, Georges Basile Stavracas Neto, Arun Raghavan, Wim Taymans,
|
||||
Daniel van Vugt, worldofpeace, Jonas Ådahl
|
||||
|
||||
Translators:
|
||||
Yi-Jyun Pan [zh_TW], Asier Sarasua Garmendia [eu], Rafael Fontenelle [pt_BR],
|
||||
Emin Tufan Çetin [tr], Daniel Mustieles [es], Balázs Úr [hu],
|
||||
Gwan-gyeong Mun [ko], Marek Černocký [cs], Fran Dieguez [gl],
|
||||
Kukuh Syafaat [id], Alan Mortensen [da], Piotr Drąg [pl], sicklylife [ja],
|
||||
Matej Urbančič [sl]
|
||||
|
||||
3.35.91
|
||||
=======
|
||||
* Honor accelerometer orientation on monitor config changes [Hans; !959]
|
||||
* Enable culling for integer-scaled actors [Robert; !1036]
|
||||
* Add ClutterSeat::touch-mode property [Carlos; !1044]
|
||||
* Fix mis-scaling when streaming windows [Olivier; !1022]
|
||||
* Make the cursor renderer use the transactional KMS API [Jonas; !930]
|
||||
* Advertise MetaMonitor as wl_output [Olivier; !994]
|
||||
* Fix culling of XWayland windows [Robert; !1049]
|
||||
* Only consider enabled effects when disabling culling [Robert; !1052]
|
||||
* Misc. bug fixes and cleanups [Olivier, Sergio, Adam, Carlos, Björn; !1040,
|
||||
#985, !1024, !1039, !1051]
|
||||
|
||||
Contributors:
|
||||
Sergio Costas, Björn Daase, Olivier Fourdan, Carlos Garnacho, Hans de Goede,
|
||||
Adam Jackson, Robert Mader, Jonas Ådahl
|
||||
|
||||
Translators:
|
||||
sicklylife [ja]
|
||||
|
||||
3.35.90
|
||||
=======
|
||||
* Cull out clip region [Robert; !985]
|
||||
* Always enable tap-to-click/drag on opaque Wacom tablets [Carlos; !968]
|
||||
* Fix visual glitches with offscreen effects applied [Georges; !992]
|
||||
* Fix "sticky corner" in multi-head setups [Jonas D.; #774]
|
||||
* Fix black shadows around XWayland windows during resizes [Ray, Olivier; #858]
|
||||
* Zero-copy path for GPU-less secondary GPUs [Pekka; !810]
|
||||
* Cancel DND on Esc [Carlos; #1020]
|
||||
* Sync XWayland window shadows to frame during resizes [Olivier; !1009]
|
||||
* Add support for per-monitor workareas [Alberts; !370]
|
||||
* Ensure newly mapped wayland windows receive ENTER event [Olivier; !1026]
|
||||
* Add ClutterSeat object [Carlos; !852]
|
||||
* Honour CLUTTER_ACTOR_NO_LAYOUT flag more efficiently [Daniel; !575]
|
||||
* Fix interoperation with wl_data_device_manager v1 [Carlos; #965]
|
||||
* Favor text over images in clipboard manager [Carlos; #919]
|
||||
* Apply monitor scale after background texture creation [Daniel; !1004]
|
||||
* Plugged memory leaks [Sebastian, Adam; !991, #1000, !1011, !1020, !1030,
|
||||
!1001, !1033]
|
||||
* Fixed crashes [Jonas Å., Florian, Olivier; !961, #1029, !1037]
|
||||
* Misc. bug fixes and cleanups [Björn, Jonas Å., Adam, Sebastian, Jonas D.,
|
||||
Daniel, Carlos, Corentin, Sebastian, Robert, Daniel; #385, !998, !1007, !995,
|
||||
!1016, !1018, !1017, !1005, !1019, !1025, !1028, !1029, !1031, !1015, !1032,
|
||||
!1034, #1025]
|
||||
|
||||
Contributors:
|
||||
Björn Daase, Jonas Dreßler, Olivier Fourdan, Carlos Garnacho, Adam Jackson,
|
||||
Sebastian Keller, Robert Mader, Alberts Muktupāvels, Florian Müllner,
|
||||
Georges Basile Stavracas Neto, Corentin Noël, Pekka Paalanen, Ray Strode,
|
||||
Daniel van Vugt, Jonas Ådahl
|
||||
|
||||
Translators:
|
||||
sicklylife [ja], Umarzuki Bin Mochlis Moktar [ms]
|
||||
|
||||
3.35.3
|
||||
======
|
||||
* backends/native: Correct dy value in pinch gesture event [Yariv; !974]
|
||||
* Upload clipping rectangles in parallel [Daniel; !969]
|
||||
* More cogl API cleanups [Adam; !978, !977, !973]
|
||||
* Fix window recording on HiDPI [Pascal; !976]
|
||||
* Fix top-left pixel being insensitive to clicks [Sebastian; #893]
|
||||
* Misc. bug fixes and cleanups [Daniel, Adam; !979, !980]
|
||||
|
||||
Contributors:
|
||||
Yariv Barkan, Adam Jackson, Sebastian Keller, Pascal Nowack, Daniel van Vugt
|
||||
|
||||
Translators:
|
||||
Fran Dieguez [gl], Dz Chen [zh_CN]
|
||||
|
||||
3.35.2
|
||||
======
|
||||
* Don't emit focus event after destruction [Marco; gnome-shell#1704, !860]
|
||||
* Add a notion of pixel format planes [Niels; !858]
|
||||
* Replace various Cogl/Clutter types with Graphene [Georges; !458]
|
||||
* Improve CoglJournal [Georges, Jasper; !402]
|
||||
* Split pick and paint [Georges; !865]
|
||||
* Remove deprecated/unused cogl/clutter APIs [Adam; !866, !878, !879, !880,
|
||||
!885, !900, !902, !904, !896, !913, !922, !883, !903, !921, !933, !819]
|
||||
* Fix hang when opening not-responding dialog on Xorg [Carlos; !876]
|
||||
* Allow changing Clutter debug flags at runtime [Georges; !862]
|
||||
* Fix frozen grabs on Xorg after weeks of inactivity [Jonas; !886]
|
||||
* Fix triggering popups from stylus devices o wayland [Carlos; #886]
|
||||
* Fix fallback to GLES2 [Adam; #635]
|
||||
* Fix buffer age checks on multiple monitors [Carlos; !906]
|
||||
* Adjust to Sysprof API change [Christian; !908]
|
||||
* Improve support for (X11) fullscreen games under wayland [Hans; !739]
|
||||
* Support shadow framebuffers for offscreen rendering [Olivier; !877]
|
||||
* Fix hang after interacting with desktop icons on X11 [Marco; !909]
|
||||
* Don't double scale when getting absolute surface coordinates [Xiang; !915]
|
||||
* Respect NET_WM_TRANSIENT_FOR for override-redirect windows [Marco; !920]
|
||||
* Kill window effects on destroy [Robert; !924]
|
||||
* Remove deprecated ClutterTexture [Jonas; !932]
|
||||
* Use regions instead of bounding box for clipping and culling [Carlos; !867]
|
||||
* Use partial damage for dma-buf and EGLImage buffers on wayland [Robert; #947]
|
||||
* Do not stack transients underneath their always-on-top parent [Florian; #587]
|
||||
* Add explicit paint/pick contexts [Jonas; !935]
|
||||
* Fix KMS freeze after pageflip fallback [Pekka; !953]
|
||||
* Fixed crashes [Robert, Carlos, Jonas, Marco, Hans, Tim; !856, !869, !912,
|
||||
!895, !928, #591, !823, !960]
|
||||
* Plugged memory leaks [Niels, Robert, Carlos, Marco; !847, !868, !873, #908]
|
||||
* Misc. bug fixes and cleanups [Niels, Robert, Jonas, Marco, Carlos, Daniel,
|
||||
Jan, Adam, Cosimo, Florian, Thomas, Georges, Hans, Corentin, Christian,
|
||||
Benjamin; !853, !822, !451, !854, !816, !857, !859, !734, !844, !851, #876,
|
||||
!874, !673, !692, !888, !889, !894, !901, !905, !872, !898, !911, !918, !863,
|
||||
#878, !811, !893, !925, !926, !890, !931, !927, !934, !938, !940, !947, !941,
|
||||
!929, !949, !952, !871, !955, !956, !958, !907, !965, !964, !966]
|
||||
|
||||
Contributors:
|
||||
Marco Trevisan (Treviño), Jan Alexander Steffens (heftig),
|
||||
Thomas Hindoe Paaboel Andersen, Benjamin Berg, Cosimo Cecchi, Tim Crawford,
|
||||
Piotr Drąg, Xiang Fan, Olivier Fourdan, Carlos Garnacho, Hans de Goede,
|
||||
Niels De Graef, Christian Hergert, Adam Jackson, Robert Mader,
|
||||
Florian Müllner, Georges Basile Stavracas Neto, Bastien Nocera, Corentin Noël,
|
||||
Pekka Paalanen, Jasper St. Pierre, Christian Rauch, Daniel van Vugt,
|
||||
Jonas Ådahl
|
||||
|
||||
Translators:
|
||||
Bruce Cowan [en_GB]
|
||||
|
||||
3.35.1
|
||||
======
|
||||
* Fix immediate screen blank after releaseing inhibitor [Tim; #573]
|
||||
* Respond to frame callbacks regardless of damage [Jonas; !839]
|
||||
* selection [Carlos; !842]
|
||||
* Fix Night Light on wayland [Jonas; !840]
|
||||
* Fix various copy+paste/DND regressions [Carlos; !848, #789, #842,
|
||||
#793, #845, #854]
|
||||
* Misc. bug fixes and cleanups [Daniel, Marco, Jonas, Georges;
|
||||
!841, !764, !837, !846]
|
||||
|
||||
Contributors:
|
||||
Marco Trevisan (Treviño), Carlos Garnacho, Tim Klocke,
|
||||
Georges Basile Stavracas Neto, Daniel van Vugt, Jonas Ådahl
|
||||
|
||||
3.34.1
|
||||
======
|
||||
* Fix startup of X11 session services on wayland [Carlos; #771]
|
||||
* Fix _NET_ACTIVE_WINDOW emission [Carlos; #751]
|
||||
* Fix initial view perspective [Marco; !803]
|
||||
* Fix screenshots and window animations when scaled [Robert; !758]
|
||||
* Re-enable coredumps when capabilities are set [Jonas; !811]
|
||||
* Fix scaling of DND surface actors [Robert; !780]
|
||||
* Optimize blitting of untransformed offscreen stage views [Olivier; !809, !820]
|
||||
* Fix freeze of pointer event delivery on X11 [Olivier; !821]
|
||||
* Fix scaling of stylus input coordinates with HiDPI [Dorian; !830]
|
||||
* Fix memory leak when using implicit animations [Jonas; !828]
|
||||
* Fix numlock state for native backend [Carlos; #769]
|
||||
* Fixed crashes [Marco, Olivier, Jonas Å.; !805, #823, !808, !825,
|
||||
#844, !826, #779]
|
||||
* Misc. bug fixes and cleanups [Jonas Å., Georges, Jonas D., Michal, Daniel,
|
||||
Iain, Adam, Marco, Carlos, Ting-Wei, Hans, Robert; !787, !795, !791, !797,
|
||||
!772, !775, !799, !778, !785, !782, !796, #819, !814, !769, !817, !783, !786,
|
||||
!829, !774, #822]
|
||||
|
||||
Contributors:
|
||||
Marco Trevisan (Treviño), Jonas Dreßler, Olivier Fourdan, Carlos Garnacho,
|
||||
Hans de Goede, Adam Jackson, Ting-Wei Lan, Iain Lane, Michal Lazo,
|
||||
Robert Mader, Georges Basile Stavracas Neto, Dorian Stoll, Daniel van Vugt,
|
||||
Jonas Ådahl
|
||||
|
||||
Translators:
|
||||
Milo Casagrande [it], Nathan Follens [nl], Matej Urbančič [sl],
|
||||
Ask Hjorth Larsen [da], Alan Mortensen [da], Jordi Mas [ca]
|
||||
|
||||
3.34.0
|
||||
======
|
||||
* Fix xdg-output v3 support [Olivier; !771]
|
||||
* Fix crash when changing decoration state [Jonas; !773]
|
||||
* Add and remove connectors on hot-plug [Jonas; !743]
|
||||
|
||||
Contributors:
|
||||
Olivier Fourdan, Jonas Ådahl
|
||||
|
||||
Translators:
|
||||
Rafael Fontenelle [pt_BR], Gwan-gyeong Mun [ko], Christian Kirbach [de],
|
||||
Claude Paroz [fr], Milo Casagrande [it], Emin Tufan Çetin [tr],
|
||||
Ryuta Fujii [ja]
|
||||
|
||||
3.33.92
|
||||
=======
|
||||
* Turn MetaShapedTexture into a ClutterContent implementation [Georges; !409]
|
||||
* Restore inhibit shortcut for overlay key [Olivier; #734]
|
||||
* Misc. pointer a11y improvements [Jonas D., Olivier; !746, !747, !745, !761]
|
||||
* Fix position of drag surfaces [Robert; !684]
|
||||
* Implement subsurface.place_below() for parents [Robert; !664]
|
||||
* Add meta_window_actor_get_image() [Jonas Å.; !752]
|
||||
* Revert faulty optimization from !719 [Jonas Å.; #735]
|
||||
* Add additional sysprof trace points [Jonas Å.; !757, !765]
|
||||
* Remove GLX "threaded swap wait" used on Nvidia [Daniel; !602]
|
||||
* Implement geometric picking [Daniel; !189]
|
||||
* Fix lost keyboard focus after DND [Olivier; #747]
|
||||
* Misc. bug fixes and cleanups [Florian, Carlos, Piotr, Hans, Georges, Robert,
|
||||
Ray, Mart, Rémi; !740, !672, !749, !751, !753, !730, !755, !756, !750, !715,
|
||||
#738944, !657, !768]
|
||||
|
||||
Contributors:
|
||||
Jonas Ådahl, Rémi Bernon, Piotr Drąg, Jonas Dreßler, Olivier Fourdan,
|
||||
Carlos Garnacho, Hans de Goede, Robert Mader, Florian Müllner,
|
||||
Georges Basile Stavracas Neto, Mart Raudsepp, Ray Strode, Daniel van Vugt
|
||||
|
||||
Translators:
|
||||
Piotr Drąg [pl], Марко Костић [sr], Rūdolfs Mazurs [lv], Matej Urbančič [sl],
|
||||
Balázs Úr [hu], Fran Dieguez [gl], Jordi Mas [ca], Anders Jonsson [sv],
|
||||
Trần Ngọc Quân [vi], Tim Sabsch [de], Fabio Tomat [fur], Goran Vidović [hr],
|
||||
Marek Černocký [cs]
|
||||
|
||||
3.33.91
|
||||
=======
|
||||
* Fix primary selection copy and paste between X11 and wayland [Hans; #702]
|
||||
|
@ -310,7 +310,11 @@ cally_actor_finalize (GObject *obj)
|
||||
|
||||
_cally_actor_clean_action_list (cally_actor);
|
||||
|
||||
g_clear_handle_id (&priv->action_idle_handler, g_source_remove);
|
||||
if (priv->action_idle_handler)
|
||||
{
|
||||
g_source_remove (priv->action_idle_handler);
|
||||
priv->action_idle_handler = 0;
|
||||
}
|
||||
|
||||
if (priv->action_queue)
|
||||
{
|
||||
@ -600,11 +604,10 @@ cally_actor_real_remove_actor (ClutterActor *container,
|
||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), 0);
|
||||
|
||||
atk_parent = ATK_OBJECT (data);
|
||||
atk_child = clutter_actor_get_accessible (actor);
|
||||
|
||||
if (clutter_actor_has_accessible (actor))
|
||||
if (atk_child)
|
||||
{
|
||||
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);
|
||||
|
||||
@ -654,7 +657,7 @@ cally_actor_get_extents (AtkComponent *component,
|
||||
ClutterActor *actor = NULL;
|
||||
gint top_level_x, top_level_y;
|
||||
gfloat f_width, f_height;
|
||||
graphene_point3d_t verts[4];
|
||||
ClutterVertex verts[4];
|
||||
ClutterActor *stage = NULL;
|
||||
|
||||
g_return_if_fail (CALLY_IS_ACTOR (component));
|
||||
|
147
clutter/clutter/cally/cally-group.c
Normal file
147
clutter/clutter/cally/cally-group.c
Normal file
@ -0,0 +1,147 @@
|
||||
/* CALLY - The Clutter Accessibility Implementation Library
|
||||
*
|
||||
* Copyright (C) 2008 Igalia, S.L.
|
||||
*
|
||||
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
|
||||
*
|
||||
* Based on GailContainer 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-group
|
||||
* @Title: CallyGroup
|
||||
* @short_description: Implementation of the ATK interfaces for a #ClutterGroup
|
||||
* @see_also: #ClutterGroup
|
||||
*
|
||||
* #CallyGroup implements the required ATK interfaces of #ClutterGroup
|
||||
* In particular it exposes each of the Clutter actors contained in the
|
||||
* group.
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "cally-group.h"
|
||||
#include "cally-actor-private.h"
|
||||
|
||||
static gint cally_group_get_n_children (AtkObject *obj);
|
||||
static AtkObject* cally_group_ref_child (AtkObject *obj,
|
||||
gint i);
|
||||
static void cally_group_real_initialize (AtkObject *obj,
|
||||
gpointer data);
|
||||
|
||||
G_DEFINE_TYPE (CallyGroup, cally_group, CALLY_TYPE_ACTOR)
|
||||
|
||||
static void
|
||||
cally_group_class_init (CallyGroupClass *klass)
|
||||
{
|
||||
/* GObjectClass *gobject_class = G_OBJECT_CLASS (klass); */
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
class->get_n_children = cally_group_get_n_children;
|
||||
class->ref_child = cally_group_ref_child;
|
||||
class->initialize = cally_group_real_initialize;
|
||||
}
|
||||
|
||||
static void
|
||||
cally_group_init (CallyGroup *group)
|
||||
{
|
||||
/* nothing to do yet */
|
||||
}
|
||||
|
||||
/**
|
||||
* cally_group_new:
|
||||
* @actor: a #ClutterGroup
|
||||
*
|
||||
* Creates a #CallyGroup for @actor
|
||||
*
|
||||
* Return value: the newly created #CallyGroup
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
AtkObject *
|
||||
cally_group_new (ClutterActor *actor)
|
||||
{
|
||||
GObject *object = NULL;
|
||||
AtkObject *accessible = NULL;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_GROUP (actor), NULL);
|
||||
|
||||
object = g_object_new (CALLY_TYPE_GROUP, NULL);
|
||||
|
||||
accessible = ATK_OBJECT (object);
|
||||
atk_object_initialize (accessible, actor);
|
||||
|
||||
return accessible;
|
||||
}
|
||||
|
||||
static gint
|
||||
cally_group_get_n_children (AtkObject *obj)
|
||||
{
|
||||
ClutterActor *actor = NULL;
|
||||
gint count = 0;
|
||||
|
||||
g_return_val_if_fail (CALLY_IS_GROUP (obj), count);
|
||||
|
||||
actor = CALLY_GET_CLUTTER_ACTOR (obj);
|
||||
|
||||
if (actor == NULL) /* defunct */
|
||||
return 0;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_GROUP(actor), count);
|
||||
|
||||
count = clutter_actor_get_n_children (actor);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static AtkObject*
|
||||
cally_group_ref_child (AtkObject *obj,
|
||||
gint i)
|
||||
{
|
||||
AtkObject *accessible = NULL;
|
||||
ClutterActor *actor = NULL;
|
||||
ClutterActor *child = NULL;
|
||||
|
||||
g_return_val_if_fail (CALLY_IS_GROUP (obj), NULL);
|
||||
g_return_val_if_fail ((i >= 0), NULL);
|
||||
|
||||
actor = CALLY_GET_CLUTTER_ACTOR (obj);
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_GROUP(actor), NULL);
|
||||
child = clutter_actor_get_child_at_index (actor, i);
|
||||
|
||||
if (!child)
|
||||
return NULL;
|
||||
|
||||
accessible = clutter_actor_get_accessible (child);
|
||||
|
||||
if (accessible != NULL)
|
||||
g_object_ref (accessible);
|
||||
|
||||
return accessible;
|
||||
}
|
||||
|
||||
static void
|
||||
cally_group_real_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
ATK_OBJECT_CLASS (cally_group_parent_class)->initialize (obj, data);
|
||||
|
||||
obj->role = ATK_ROLE_PANEL;
|
||||
}
|
87
clutter/clutter/cally/cally-group.h
Normal file
87
clutter/clutter/cally/cally-group.h
Normal file
@ -0,0 +1,87 @@
|
||||
/* CALLY - The Clutter Accessibility Implementation Library
|
||||
*
|
||||
* Copyright (C) 2008 Igalia, S.L.
|
||||
*
|
||||
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
|
||||
*
|
||||
* Based on GailContainer 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __CALLY_GROUP_H__
|
||||
#define __CALLY_GROUP_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_GROUP (cally_group_get_type ())
|
||||
#define CALLY_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_GROUP, CallyGroup))
|
||||
#define CALLY_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_GROUP, CallyGroupClass))
|
||||
#define CALLY_IS_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_GROUP))
|
||||
#define CALLY_IS_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_GROUP))
|
||||
#define CALLY_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_GROUP, CallyGroupClass))
|
||||
|
||||
typedef struct _CallyGroup CallyGroup;
|
||||
typedef struct _CallyGroupClass CallyGroupClass;
|
||||
typedef struct _CallyGroupPrivate CallyGroupPrivate;
|
||||
|
||||
/**
|
||||
* CallyGroup:
|
||||
*
|
||||
* The <structname>CallyGroup</structname> structure contains only
|
||||
* private data and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _CallyGroup
|
||||
{
|
||||
/*< private >*/
|
||||
CallyActor parent;
|
||||
|
||||
CallyGroupPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* CallyGroupClass:
|
||||
*
|
||||
* The <structname>CallyGroupClass</structname> structure contains only
|
||||
* private data
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _CallyGroupClass
|
||||
{
|
||||
/*< private >*/
|
||||
CallyActorClass parent_class;
|
||||
|
||||
/* padding for future expansion */
|
||||
gpointer _padding_dummy[8];
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType cally_group_get_type (void) G_GNUC_CONST;
|
||||
CLUTTER_EXPORT
|
||||
AtkObject* cally_group_new (ClutterActor *actor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CALLY_GROUP_H__ */
|
98
clutter/clutter/cally/cally-rectangle.c
Normal file
98
clutter/clutter/cally/cally-rectangle.c
Normal file
@ -0,0 +1,98 @@
|
||||
/* CALLY - The Clutter Accessibility Implementation Library
|
||||
*
|
||||
* Copyright (C) 2009 Igalia, S.L.
|
||||
*
|
||||
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:cally-rectangle
|
||||
* @short_description: Implementation of the ATK interfaces for a #ClutterRectangle
|
||||
* @see_also: #ClutterRectangle
|
||||
*
|
||||
* #CallyRectangle implements the required ATK interfaces of #ClutterRectangle
|
||||
*
|
||||
* In particular it sets a proper role for the rectangle.
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include "cally-rectangle.h"
|
||||
#include "cally-actor-private.h"
|
||||
|
||||
#include "clutter-color.h"
|
||||
#include "deprecated/clutter-rectangle.h"
|
||||
|
||||
/* AtkObject */
|
||||
static void cally_rectangle_real_initialize (AtkObject *obj,
|
||||
gpointer data);
|
||||
|
||||
G_DEFINE_TYPE (CallyRectangle, cally_rectangle, CALLY_TYPE_ACTOR)
|
||||
|
||||
static void
|
||||
cally_rectangle_class_init (CallyRectangleClass *klass)
|
||||
{
|
||||
/* GObjectClass *gobject_class = G_OBJECT_CLASS (klass); */
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
class->initialize = cally_rectangle_real_initialize;
|
||||
}
|
||||
|
||||
static void
|
||||
cally_rectangle_init (CallyRectangle *rectangle)
|
||||
{
|
||||
/* nothing to do yet */
|
||||
}
|
||||
|
||||
/**
|
||||
* cally_rectangle_new:
|
||||
* @actor: a #ClutterActor
|
||||
*
|
||||
* Creates a new #CallyRectangle for the given @actor. @actor must be
|
||||
* a #ClutterRectangle.
|
||||
*
|
||||
* Return value: the newly created #AtkObject
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
AtkObject*
|
||||
cally_rectangle_new (ClutterActor *actor)
|
||||
{
|
||||
GObject *object = NULL;
|
||||
AtkObject *accessible = NULL;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_RECTANGLE (actor), NULL);
|
||||
|
||||
object = g_object_new (CALLY_TYPE_RECTANGLE, NULL);
|
||||
|
||||
accessible = ATK_OBJECT (object);
|
||||
atk_object_initialize (accessible, actor);
|
||||
|
||||
return accessible;
|
||||
}
|
||||
|
||||
static void
|
||||
cally_rectangle_real_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
ATK_OBJECT_CLASS (cally_rectangle_parent_class)->initialize (obj, data);
|
||||
|
||||
obj->role = ATK_ROLE_IMAGE;
|
||||
}
|
84
clutter/clutter/cally/cally-rectangle.h
Normal file
84
clutter/clutter/cally/cally-rectangle.h
Normal file
@ -0,0 +1,84 @@
|
||||
/* CALLY - The Clutter Accessibility Implementation Library
|
||||
*
|
||||
* Copyright (C) 2009 Igalia, S.L.
|
||||
*
|
||||
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __CALLY_RECTANGLE_H__
|
||||
#define __CALLY_RECTANGLE_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_RECTANGLE (cally_rectangle_get_type ())
|
||||
#define CALLY_RECTANGLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_RECTANGLE, CallyRectangle))
|
||||
#define CALLY_RECTANGLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_RECTANGLE, CallyRectangleClass))
|
||||
#define CALLY_IS_RECTANGLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_RECTANGLE))
|
||||
#define CALLY_IS_RECTANGLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_RECTANGLE))
|
||||
#define CALLY_RECTANGLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_RECTANGLE, CallyRectangleClass))
|
||||
|
||||
typedef struct _CallyRectangle CallyRectangle;
|
||||
typedef struct _CallyRectangleClass CallyRectangleClass;
|
||||
typedef struct _CallyRectanglePrivate CallyRectanglePrivate;
|
||||
|
||||
/**
|
||||
* CallyRectangle:
|
||||
*
|
||||
* The <structname>CallyRectangle</structname> structure contains only private
|
||||
* data and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _CallyRectangle
|
||||
{
|
||||
/*< private >*/
|
||||
CallyActor parent;
|
||||
|
||||
CallyRectanglePrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* CallyRectangleClass:
|
||||
*
|
||||
* The <structname>CallyRectangleClass</structname> structure contains
|
||||
* only private data
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _CallyRectangleClass
|
||||
{
|
||||
/*< private >*/
|
||||
CallyActorClass parent_class;
|
||||
|
||||
/* padding for future expansion */
|
||||
gpointer _padding_dummy[8];
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType cally_rectangle_get_type (void) G_GNUC_CONST;
|
||||
CLUTTER_EXPORT
|
||||
AtkObject* cally_rectangle_new (ClutterActor *actor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CALLY_RECTANGLE_H__ */
|
@ -75,8 +75,8 @@ struct _CallyRootPrivate
|
||||
GSList *stage_list;
|
||||
|
||||
/* signals id */
|
||||
gulong stage_added_id;
|
||||
gulong stage_removed_id;
|
||||
guint stage_added_id;
|
||||
guint stage_removed_id;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (CallyRoot, cally_root, ATK_TYPE_GOBJECT_ACCESSIBLE)
|
||||
@ -149,9 +149,11 @@ cally_root_finalize (GObject *object)
|
||||
|
||||
stage_manager = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (root));
|
||||
|
||||
g_clear_signal_handler (&root->priv->stage_added_id, stage_manager);
|
||||
g_signal_handler_disconnect (stage_manager,
|
||||
root->priv->stage_added_id);
|
||||
|
||||
g_clear_signal_handler (&root->priv->stage_removed_id, stage_manager);
|
||||
g_signal_handler_disconnect (stage_manager,
|
||||
root->priv->stage_added_id);
|
||||
|
||||
G_OBJECT_CLASS (cally_root_parent_class)->finalize (object);
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ struct _CallyStagePrivate
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (CallyStage,
|
||||
cally_stage,
|
||||
CALLY_TYPE_ACTOR,
|
||||
CALLY_TYPE_GROUP,
|
||||
G_ADD_PRIVATE (CallyStage)
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_WINDOW,
|
||||
cally_stage_window_interface_init));
|
||||
|
@ -25,7 +25,7 @@
|
||||
#error "Only <cally/cally.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <cally/cally-actor.h>
|
||||
#include <cally/cally-group.h>
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
@ -52,7 +52,7 @@ typedef struct _CallyStagePrivate CallyStagePrivate;
|
||||
struct _CallyStage
|
||||
{
|
||||
/*< private >*/
|
||||
CallyActor parent;
|
||||
CallyGroup parent;
|
||||
|
||||
CallyStagePrivate *priv;
|
||||
};
|
||||
@ -68,7 +68,7 @@ struct _CallyStage
|
||||
struct _CallyStageClass
|
||||
{
|
||||
/*< private >*/
|
||||
CallyActorClass parent_class;
|
||||
CallyGroupClass parent_class;
|
||||
|
||||
/* padding for future expansion */
|
||||
gpointer _padding_dummy[16];
|
||||
|
@ -247,7 +247,11 @@ cally_text_finalize (GObject *obj)
|
||||
/* g_object_unref (cally_text->priv->textutil); */
|
||||
/* cally_text->priv->textutil = NULL; */
|
||||
|
||||
g_clear_handle_id (&cally_text->priv->insert_idle_handler, g_source_remove);
|
||||
if (cally_text->priv->insert_idle_handler)
|
||||
{
|
||||
g_source_remove (cally_text->priv->insert_idle_handler);
|
||||
cally_text->priv->insert_idle_handler = 0;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (cally_text_parent_class)->finalize (obj);
|
||||
}
|
||||
@ -1434,7 +1438,7 @@ static void cally_text_get_character_extents (AtkText *text,
|
||||
PangoLayout *layout;
|
||||
PangoRectangle extents;
|
||||
const gchar *text_value;
|
||||
graphene_point3d_t verts[4];
|
||||
ClutterVertex verts[4];
|
||||
|
||||
actor = CALLY_GET_CLUTTER_ACTOR (text);
|
||||
if (actor == NULL) /* State is defunct */
|
||||
@ -2290,7 +2294,7 @@ _cally_misc_get_index_at_point (ClutterText *clutter_text,
|
||||
gint index, x_window, y_window, x_toplevel, y_toplevel;
|
||||
gint x_temp, y_temp;
|
||||
gboolean ret;
|
||||
graphene_point3d_t verts[4];
|
||||
ClutterVertex verts[4];
|
||||
PangoLayout *layout;
|
||||
gint x_layout, y_layout;
|
||||
|
||||
|
98
clutter/clutter/cally/cally-texture.c
Normal file
98
clutter/clutter/cally/cally-texture.c
Normal file
@ -0,0 +1,98 @@
|
||||
/* CALLY - The Clutter Accessibility Implementation Library
|
||||
*
|
||||
* Copyright (C) 2009 Igalia, S.L.
|
||||
*
|
||||
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:cally-texture
|
||||
* @Title: CallyTexture
|
||||
* @short_description: Implementation of the ATK interfaces for a #ClutterTexture
|
||||
* @see_also: #ClutterTexture
|
||||
*
|
||||
* #CallyTexture implements the required ATK interfaces of #ClutterTexture
|
||||
*
|
||||
* In particular it sets a proper role for the texture.
|
||||
*/
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include "cally-texture.h"
|
||||
#include "cally-actor-private.h"
|
||||
|
||||
#include "deprecated/clutter-texture.h"
|
||||
|
||||
/* AtkObject */
|
||||
static void cally_texture_real_initialize (AtkObject *obj,
|
||||
gpointer data);
|
||||
|
||||
G_DEFINE_TYPE (CallyTexture, cally_texture, CALLY_TYPE_ACTOR)
|
||||
|
||||
static void
|
||||
cally_texture_class_init (CallyTextureClass *klass)
|
||||
{
|
||||
/* GObjectClass *gobject_class = G_OBJECT_CLASS (klass); */
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
class->initialize = cally_texture_real_initialize;
|
||||
}
|
||||
|
||||
static void
|
||||
cally_texture_init (CallyTexture *texture)
|
||||
{
|
||||
/* nothing to do yet */
|
||||
}
|
||||
|
||||
/**
|
||||
* cally_texture_new:
|
||||
* @actor: a #ClutterActor
|
||||
*
|
||||
* Creates a new #CallyTexture for the given @actor. @actor must be
|
||||
* a #ClutterTexture.
|
||||
*
|
||||
* Return value: the newly created #AtkObject
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
AtkObject*
|
||||
cally_texture_new (ClutterActor *actor)
|
||||
{
|
||||
GObject *object = NULL;
|
||||
AtkObject *accessible = NULL;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_TEXTURE (actor), NULL);
|
||||
|
||||
object = g_object_new (CALLY_TYPE_TEXTURE, NULL);
|
||||
|
||||
accessible = ATK_OBJECT (object);
|
||||
atk_object_initialize (accessible, actor);
|
||||
|
||||
return accessible;
|
||||
}
|
||||
|
||||
static void
|
||||
cally_texture_real_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
ATK_OBJECT_CLASS (cally_texture_parent_class)->initialize (obj, data);
|
||||
|
||||
/* default role */
|
||||
obj->role = ATK_ROLE_IMAGE;
|
||||
}
|
84
clutter/clutter/cally/cally-texture.h
Normal file
84
clutter/clutter/cally/cally-texture.h
Normal file
@ -0,0 +1,84 @@
|
||||
/* CALLY - The Clutter Accessibility Implementation Library
|
||||
*
|
||||
* Copyright (C) 2009 Igalia, S.L.
|
||||
*
|
||||
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __CALLY_TEXTURE_H__
|
||||
#define __CALLY_TEXTURE_H__
|
||||
|
||||
#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <cally/cally.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <clutter/clutter.h>
|
||||
#include <cally/cally-actor.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CALLY_TYPE_TEXTURE (cally_texture_get_type ())
|
||||
#define CALLY_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_TEXTURE, CallyTexture))
|
||||
#define CALLY_TEXTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_TEXTURE, CallyTextureClass))
|
||||
#define CALLY_IS_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_TEXTURE))
|
||||
#define CALLY_IS_TEXTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_TEXTURE))
|
||||
#define CALLY_TEXTURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_TEXTURE, CallyTextureClass))
|
||||
|
||||
typedef struct _CallyTexture CallyTexture;
|
||||
typedef struct _CallyTextureClass CallyTextureClass;
|
||||
typedef struct _CallyTexturePrivate CallyTexturePrivate;
|
||||
|
||||
/**
|
||||
* CallyTexture:
|
||||
*
|
||||
* The <structname>CallyTexture</structname> structure contains only
|
||||
* private data and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _CallyTexture
|
||||
{
|
||||
/*< private >*/
|
||||
CallyActor parent;
|
||||
|
||||
CallyTexturePrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* CallyTextureClass:
|
||||
*
|
||||
* The <structname>CallyTextureClass</structname> structure contains
|
||||
* only private data
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _CallyTextureClass
|
||||
{
|
||||
/*< private >*/
|
||||
CallyActorClass parent_class;
|
||||
|
||||
/* padding for future expansion */
|
||||
gpointer _padding_dummy[8];
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType cally_texture_get_type (void) G_GNUC_CONST;
|
||||
CLUTTER_EXPORT
|
||||
AtkObject *cally_texture_new (ClutterActor *actor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CALLY_TEXTURE_H__ */
|
@ -36,8 +36,11 @@
|
||||
#include "cally.h"
|
||||
|
||||
#include "cally-actor.h"
|
||||
#include "cally-group.h"
|
||||
#include "cally-stage.h"
|
||||
#include "cally-text.h"
|
||||
#include "cally-texture.h"
|
||||
#include "cally-rectangle.h"
|
||||
#include "cally-clone.h"
|
||||
|
||||
#include "cally-factory.h"
|
||||
@ -50,8 +53,11 @@
|
||||
|
||||
/* factories initialization*/
|
||||
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_ACTOR, cally_actor, cally_actor_new)
|
||||
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_GROUP, cally_group, cally_group_new)
|
||||
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_STAGE, cally_stage, cally_stage_new)
|
||||
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_TEXT, cally_text, cally_text_new)
|
||||
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_TEXTURE, cally_texture, cally_texture_new)
|
||||
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_RECTANGLE, cally_rectangle, cally_rectangle_new)
|
||||
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_CLONE, cally_clone, cally_clone_new)
|
||||
|
||||
/**
|
||||
@ -69,8 +75,11 @@ cally_accessibility_init (void)
|
||||
{
|
||||
/* setting the factories */
|
||||
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_ACTOR, cally_actor);
|
||||
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_GROUP, cally_group);
|
||||
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_STAGE, cally_stage);
|
||||
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_TEXT, cally_text);
|
||||
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_TEXTURE, cally_texture);
|
||||
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_RECTANGLE, cally_rectangle);
|
||||
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_CLONE, cally_clone);
|
||||
|
||||
/* Initialize the CallyUtility class */
|
||||
|
@ -26,10 +26,13 @@
|
||||
#include "cally-actor.h"
|
||||
#include "cally-clone.h"
|
||||
#include "cally-factory.h"
|
||||
#include "cally-group.h"
|
||||
#include "cally-main.h"
|
||||
#include "cally-rectangle.h"
|
||||
#include "cally-root.h"
|
||||
#include "cally-stage.h"
|
||||
#include "cally-text.h"
|
||||
#include "cally-texture.h"
|
||||
#include "cally-util.h"
|
||||
|
||||
#undef __CALLY_H_INSIDE__
|
||||
|
@ -33,11 +33,28 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_ACTION (clutter_action_get_type ())
|
||||
#define CLUTTER_TYPE_ACTION (clutter_action_get_type ())
|
||||
#define CLUTTER_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ACTION, ClutterAction))
|
||||
#define CLUTTER_IS_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ACTION))
|
||||
#define CLUTTER_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_ACTION, ClutterActionClass))
|
||||
#define CLUTTER_IS_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_ACTION))
|
||||
#define CLUTTER_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ACTION, ClutterActionClass))
|
||||
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_DERIVABLE_TYPE (ClutterAction, clutter_action,
|
||||
CLUTTER, ACTION, ClutterActorMeta);
|
||||
typedef struct _ClutterActionClass ClutterActionClass;
|
||||
|
||||
/**
|
||||
* ClutterAction:
|
||||
*
|
||||
* The #ClutterAction structure contains only private data and
|
||||
* should be accessed using the provided API.
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _ClutterAction
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterActorMeta parent_instance;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterActionClass:
|
||||
@ -61,6 +78,9 @@ struct _ClutterActionClass
|
||||
void (* _clutter_action8) (void);
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_action_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/* ClutterActor API */
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_add_action (ClutterActor *self,
|
||||
|
@ -340,7 +340,7 @@ clutter_actor_box_contains (const ClutterActorBox *box,
|
||||
/**
|
||||
* clutter_actor_box_from_vertices:
|
||||
* @box: a #ClutterActorBox
|
||||
* @verts: (array fixed-size=4): array of four #graphene_point3d_t
|
||||
* @verts: (array fixed-size=4): array of four #ClutterVertex
|
||||
*
|
||||
* Calculates the bounding box represented by the four vertices; for details
|
||||
* of the vertex array see clutter_actor_get_abs_allocation_vertices().
|
||||
@ -348,8 +348,8 @@ clutter_actor_box_contains (const ClutterActorBox *box,
|
||||
* Since: 1.0
|
||||
*/
|
||||
void
|
||||
clutter_actor_box_from_vertices (ClutterActorBox *box,
|
||||
const graphene_point3d_t verts[])
|
||||
clutter_actor_box_from_vertices (ClutterActorBox *box,
|
||||
const ClutterVertex verts[])
|
||||
{
|
||||
gfloat x_1, x_2, y_1, y_2;
|
||||
|
||||
@ -615,32 +615,6 @@ clutter_actor_box_scale (ClutterActorBox *box,
|
||||
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,
|
||||
|
@ -51,7 +51,7 @@
|
||||
struct _ClutterActorMetaPrivate
|
||||
{
|
||||
ClutterActor *actor;
|
||||
gulong destroy_id;
|
||||
guint destroy_id;
|
||||
|
||||
gchar *name;
|
||||
|
||||
@ -81,49 +81,28 @@ static void
|
||||
on_actor_destroy (ClutterActor *actor,
|
||||
ClutterActorMeta *meta)
|
||||
{
|
||||
ClutterActorMetaPrivate *priv =
|
||||
clutter_actor_meta_get_instance_private (meta);
|
||||
|
||||
priv->actor = NULL;
|
||||
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)
|
||||
if (meta->priv->actor == actor)
|
||||
return;
|
||||
|
||||
g_clear_signal_handler (&priv->destroy_id, priv->actor);
|
||||
if (meta->priv->destroy_id != 0)
|
||||
{
|
||||
g_signal_handler_disconnect (meta->priv->actor, meta->priv->destroy_id);
|
||||
meta->priv->destroy_id = 0;
|
||||
}
|
||||
|
||||
priv->actor = actor;
|
||||
meta->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]);
|
||||
if (meta->priv->actor != NULL)
|
||||
meta->priv->destroy_id = g_signal_connect (meta->priv->actor, "destroy",
|
||||
G_CALLBACK (on_actor_destroy),
|
||||
meta);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -156,21 +135,20 @@ clutter_actor_meta_get_property (GObject *gobject,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterActorMetaPrivate *priv =
|
||||
clutter_actor_meta_get_instance_private (CLUTTER_ACTOR_META (gobject));
|
||||
ClutterActorMeta *meta = CLUTTER_ACTOR_META (gobject);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ACTOR:
|
||||
g_value_set_object (value, priv->actor);
|
||||
g_value_set_object (value, meta->priv->actor);
|
||||
break;
|
||||
|
||||
case PROP_NAME:
|
||||
g_value_set_string (value, priv->name);
|
||||
g_value_set_string (value, meta->priv->name);
|
||||
break;
|
||||
|
||||
case PROP_ENABLED:
|
||||
g_value_set_boolean (value, priv->is_enabled);
|
||||
g_value_set_boolean (value, meta->priv->is_enabled);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -182,11 +160,10 @@ clutter_actor_meta_get_property (GObject *gobject,
|
||||
static void
|
||||
clutter_actor_meta_finalize (GObject *gobject)
|
||||
{
|
||||
ClutterActorMetaPrivate *priv =
|
||||
clutter_actor_meta_get_instance_private (CLUTTER_ACTOR_META (gobject));
|
||||
ClutterActorMetaPrivate *priv = CLUTTER_ACTOR_META (gobject)->priv;
|
||||
|
||||
if (priv->actor != NULL)
|
||||
g_clear_signal_handler (&priv->destroy_id, priv->actor);
|
||||
if (priv->destroy_id != 0 && priv->actor != NULL)
|
||||
g_signal_handler_disconnect (priv->actor, priv->destroy_id);
|
||||
|
||||
g_free (priv->name);
|
||||
|
||||
@ -199,7 +176,6 @@ 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:
|
||||
@ -254,11 +230,9 @@ clutter_actor_meta_class_init (ClutterActorMetaClass *klass)
|
||||
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;
|
||||
self->priv = clutter_actor_meta_get_instance_private (self);
|
||||
self->priv->is_enabled = TRUE;
|
||||
self->priv->priority = CLUTTER_ACTOR_META_PRIORITY_DEFAULT;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -276,17 +250,13 @@ 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)
|
||||
if (g_strcmp0 (meta->priv->name, name) == 0)
|
||||
return;
|
||||
|
||||
g_free (priv->name);
|
||||
priv->name = g_strdup (name);
|
||||
g_free (meta->priv->name);
|
||||
meta->priv->name = g_strdup (name);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (meta), obj_props[PROP_NAME]);
|
||||
}
|
||||
@ -307,13 +277,9 @@ clutter_actor_meta_set_name (ClutterActorMeta *meta,
|
||||
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;
|
||||
return meta->priv->name;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -329,17 +295,16 @@ 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)
|
||||
if (meta->priv->is_enabled == is_enabled)
|
||||
return;
|
||||
|
||||
CLUTTER_ACTOR_META_GET_CLASS (meta)->set_enabled (meta, is_enabled);
|
||||
meta->priv->is_enabled = is_enabled;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (meta), obj_props[PROP_ENABLED]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -355,13 +320,9 @@ clutter_actor_meta_set_enabled (ClutterActorMeta *meta,
|
||||
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;
|
||||
return meta->priv->is_enabled;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -397,54 +358,40 @@ _clutter_actor_meta_set_actor (ClutterActorMeta *meta,
|
||||
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;
|
||||
return meta->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);
|
||||
g_return_if_fail (meta->priv->actor == NULL);
|
||||
|
||||
priv->priority = priority;
|
||||
meta->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;
|
||||
return meta->priv->priority;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_clutter_actor_meta_is_internal (ClutterActorMeta *meta)
|
||||
{
|
||||
ClutterActorMetaPrivate *priv =
|
||||
clutter_actor_meta_get_instance_private (meta);
|
||||
gint priority = priv->priority;
|
||||
gint priority = meta->priv->priority;
|
||||
|
||||
return (priority <= CLUTTER_ACTOR_META_PRIORITY_INTERNAL_LOW ||
|
||||
priority >= CLUTTER_ACTOR_META_PRIORITY_INTERNAL_HIGH);
|
||||
@ -491,21 +438,19 @@ 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)
|
||||
if (meta->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
|
||||
meta->priv->name != NULL
|
||||
? meta->priv->name
|
||||
: "<unknown>",
|
||||
clutter_actor_get_name (priv->actor) != NULL
|
||||
? clutter_actor_get_name (priv->actor)
|
||||
: G_OBJECT_TYPE_NAME (priv->actor));
|
||||
clutter_actor_get_name (meta->priv->actor) != NULL
|
||||
? clutter_actor_get_name (meta->priv->actor)
|
||||
: G_OBJECT_TYPE_NAME (meta->priv->actor));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -541,16 +486,13 @@ void
|
||||
_clutter_meta_group_remove_meta (ClutterMetaGroup *group,
|
||||
ClutterActorMeta *meta)
|
||||
{
|
||||
ClutterActorMetaPrivate *priv =
|
||||
clutter_actor_meta_get_instance_private (meta);
|
||||
|
||||
if (priv->actor != group->actor)
|
||||
if (meta->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
|
||||
meta->priv->name != NULL
|
||||
? meta->priv->name
|
||||
: "<unknown>",
|
||||
clutter_actor_get_name (group->actor) != NULL
|
||||
? clutter_actor_get_name (group->actor)
|
||||
@ -693,10 +635,8 @@ _clutter_meta_group_get_meta (ClutterMetaGroup *group,
|
||||
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)
|
||||
if (g_strcmp0 (meta->priv->name, name) == 0)
|
||||
return meta;
|
||||
}
|
||||
|
||||
@ -716,8 +656,6 @@ _clutter_meta_group_get_meta (ClutterMetaGroup *group,
|
||||
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);
|
||||
return meta->priv->name != NULL ? meta->priv->name
|
||||
: G_OBJECT_TYPE_NAME (meta);
|
||||
}
|
||||
|
@ -33,13 +33,31 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_ACTOR_META (clutter_actor_meta_get_type ())
|
||||
#define CLUTTER_TYPE_ACTOR_META (clutter_actor_meta_get_type ())
|
||||
#define CLUTTER_ACTOR_META(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ACTOR_META, ClutterActorMeta))
|
||||
#define CLUTTER_IS_ACTOR_META(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ACTOR_META))
|
||||
#define CLUTTER_ACTOR_META_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_ACTOR_META, ClutterActorMetaClass))
|
||||
#define CLUTTER_IS_ACTOR_META_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_ACTOR_META))
|
||||
#define CLUTTER_ACTOR_META_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ACTOR_META, ClutterActorMetaClass))
|
||||
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_DERIVABLE_TYPE (ClutterActorMeta, clutter_actor_meta,
|
||||
CLUTTER, ACTOR_META, GInitiallyUnowned);
|
||||
typedef struct _ClutterActorMetaPrivate ClutterActorMetaPrivate;
|
||||
typedef struct _ClutterActorMetaClass ClutterActorMetaClass;
|
||||
|
||||
typedef struct _ClutterActorMetaPrivate ClutterActorMetaPrivate;
|
||||
/**
|
||||
* ClutterActorMeta:
|
||||
*
|
||||
* The #ClutterActorMeta structure contains only
|
||||
* private data and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _ClutterActorMeta
|
||||
{
|
||||
/*< private >*/
|
||||
GInitiallyUnowned parent_instance;
|
||||
|
||||
ClutterActorMetaPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterActorMetaClass:
|
||||
@ -69,9 +87,6 @@ struct _ClutterActorMetaClass
|
||||
void (* set_actor) (ClutterActorMeta *meta,
|
||||
ClutterActor *actor);
|
||||
|
||||
void (* set_enabled) (ClutterActorMeta *meta,
|
||||
gboolean is_enabled);
|
||||
|
||||
/*< private >*/
|
||||
void (* _clutter_meta1) (void);
|
||||
void (* _clutter_meta2) (void);
|
||||
@ -79,8 +94,12 @@ struct _ClutterActorMetaClass
|
||||
void (* _clutter_meta4) (void);
|
||||
void (* _clutter_meta5) (void);
|
||||
void (* _clutter_meta6) (void);
|
||||
void (* _clutter_meta7) (void);
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_actor_meta_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_meta_set_name (ClutterActorMeta *meta,
|
||||
const gchar *name);
|
||||
|
@ -110,12 +110,35 @@ typedef ClutterActorTraverseVisitFlags (*ClutterTraverseCallback) (ClutterActor
|
||||
typedef gboolean (*ClutterForeachCallback) (ClutterActor *actor,
|
||||
gpointer user_data);
|
||||
|
||||
typedef struct _AnchorCoord AnchorCoord;
|
||||
typedef struct _SizeRequest SizeRequest;
|
||||
|
||||
typedef struct _ClutterLayoutInfo ClutterLayoutInfo;
|
||||
typedef struct _ClutterTransformInfo ClutterTransformInfo;
|
||||
typedef struct _ClutterAnimationInfo ClutterAnimationInfo;
|
||||
|
||||
/* Internal helper struct to represent a point that can be stored in
|
||||
either direct pixel coordinates or as a fraction of the actor's
|
||||
size. It is used for the anchor point, scale center and rotation
|
||||
centers. */
|
||||
struct _AnchorCoord
|
||||
{
|
||||
gboolean is_fractional;
|
||||
|
||||
union
|
||||
{
|
||||
/* Used when is_fractional == TRUE */
|
||||
struct
|
||||
{
|
||||
gdouble x;
|
||||
gdouble y;
|
||||
} fraction;
|
||||
|
||||
/* Use when is_fractional == FALSE */
|
||||
ClutterVertex units;
|
||||
} v;
|
||||
};
|
||||
|
||||
struct _SizeRequest
|
||||
{
|
||||
guint age;
|
||||
@ -140,7 +163,7 @@ struct _SizeRequest
|
||||
struct _ClutterLayoutInfo
|
||||
{
|
||||
/* fixed position coordinates */
|
||||
graphene_point_t fixed_pos;
|
||||
ClutterPoint fixed_pos;
|
||||
|
||||
ClutterMargin margin;
|
||||
|
||||
@ -150,8 +173,8 @@ struct _ClutterLayoutInfo
|
||||
guint x_expand : 1;
|
||||
guint y_expand : 1;
|
||||
|
||||
graphene_size_t minimum;
|
||||
graphene_size_t natural;
|
||||
ClutterSize minimum;
|
||||
ClutterSize natural;
|
||||
};
|
||||
|
||||
const ClutterLayoutInfo * _clutter_actor_get_layout_info_or_defaults (ClutterActor *self);
|
||||
@ -160,24 +183,33 @@ ClutterLayoutInfo * _clutter_actor_peek_layout_info
|
||||
|
||||
struct _ClutterTransformInfo
|
||||
{
|
||||
/* rotation */
|
||||
/* rotation (angle and center) */
|
||||
gdouble rx_angle;
|
||||
AnchorCoord rx_center;
|
||||
|
||||
gdouble ry_angle;
|
||||
AnchorCoord ry_center;
|
||||
|
||||
gdouble rz_angle;
|
||||
AnchorCoord rz_center;
|
||||
|
||||
/* scaling */
|
||||
gdouble scale_x;
|
||||
gdouble scale_y;
|
||||
gdouble scale_z;
|
||||
AnchorCoord scale_center;
|
||||
|
||||
/* anchor point */
|
||||
AnchorCoord anchor;
|
||||
|
||||
/* translation */
|
||||
graphene_point3d_t translation;
|
||||
ClutterVertex translation;
|
||||
|
||||
/* z_position */
|
||||
gfloat z_position;
|
||||
|
||||
/* transformation center */
|
||||
graphene_point_t pivot;
|
||||
ClutterPoint pivot;
|
||||
gfloat pivot_z;
|
||||
|
||||
CoglMatrix transform;
|
||||
@ -210,6 +242,9 @@ ClutterAnimationInfo * _clutter_actor_get_animation_info
|
||||
ClutterTransition * _clutter_actor_create_transition (ClutterActor *self,
|
||||
GParamSpec *pspec,
|
||||
...);
|
||||
ClutterTransition * _clutter_actor_get_transition (ClutterActor *self,
|
||||
GParamSpec *pspec);
|
||||
|
||||
gboolean _clutter_actor_foreach_child (ClutterActor *self,
|
||||
ClutterForeachCallback callback,
|
||||
gpointer user_data);
|
||||
@ -242,9 +277,6 @@ void _clutter_actor_set_enable_paint_unmapped
|
||||
void _clutter_actor_set_has_pointer (ClutterActor *self,
|
||||
gboolean has_pointer);
|
||||
|
||||
void _clutter_actor_set_has_key_focus (ClutterActor *self,
|
||||
gboolean has_key_focus);
|
||||
|
||||
void _clutter_actor_queue_redraw_with_clip (ClutterActor *self,
|
||||
ClutterRedrawFlags flags,
|
||||
const ClutterPaintVolume *clip_volume);
|
||||
@ -281,18 +313,15 @@ void _clutter_actor_detach_clone
|
||||
void _clutter_actor_queue_redraw_on_clones (ClutterActor *actor);
|
||||
void _clutter_actor_queue_relayout_on_clones (ClutterActor *actor);
|
||||
void _clutter_actor_queue_only_relayout (ClutterActor *actor);
|
||||
void clutter_actor_clear_stage_views_recursive (ClutterActor *actor);
|
||||
void _clutter_actor_queue_update_resource_scale_recursive (ClutterActor *actor);
|
||||
|
||||
float clutter_actor_get_real_resource_scale (ClutterActor *actor);
|
||||
CoglFramebuffer * _clutter_actor_get_active_framebuffer (ClutterActor *actor);
|
||||
gboolean _clutter_actor_get_real_resource_scale (ClutterActor *actor,
|
||||
float *resource_scale);
|
||||
|
||||
ClutterPaintNode * clutter_actor_create_texture_paint_node (ClutterActor *self,
|
||||
CoglTexture *texture);
|
||||
|
||||
void clutter_actor_update_stage_views (ClutterActor *self,
|
||||
int phase);
|
||||
|
||||
void clutter_actor_queue_immediate_relayout (ClutterActor *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_ACTOR_PRIVATE_H__ */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -39,8 +39,6 @@
|
||||
|
||||
#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
|
||||
|
||||
@ -142,6 +140,11 @@ struct _ClutterActor
|
||||
* ClutterActorClass:
|
||||
* @show: signal class handler for #ClutterActor::show; it must chain
|
||||
* up to the parent's implementation
|
||||
* @show_all: virtual function for containers and composite actors, to
|
||||
* determine which children should be shown when calling
|
||||
* clutter_actor_show_all() on the actor. Defaults to calling
|
||||
* clutter_actor_show(). This virtual function is deprecated and it
|
||||
* should not be overridden.
|
||||
* @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
|
||||
@ -170,18 +173,12 @@ struct _ClutterActor
|
||||
* @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.
|
||||
* @allocate: virtual function, used when settings the coordinates of an
|
||||
* actor; it is used by clutter_actor_allocate(); it must chain up to
|
||||
* the parent's implementation, or call clutter_actor_set_allocation()
|
||||
* @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
|
||||
* the allocation; 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
|
||||
@ -224,20 +221,20 @@ struct _ClutterActorClass
|
||||
|
||||
/*< public >*/
|
||||
void (* show) (ClutterActor *self);
|
||||
void (* show_all) (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 (* paint) (ClutterActor *self);
|
||||
void (* parent_set) (ClutterActor *actor,
|
||||
ClutterActor *old_parent);
|
||||
|
||||
void (* destroy) (ClutterActor *self);
|
||||
void (* pick) (ClutterActor *actor,
|
||||
ClutterPickContext *pick_context);
|
||||
const ClutterColor *color);
|
||||
|
||||
gboolean (* queue_redraw) (ClutterActor *actor,
|
||||
ClutterActor *leaf_that_queued,
|
||||
@ -253,7 +250,8 @@ struct _ClutterActorClass
|
||||
gfloat *min_height_p,
|
||||
gfloat *natural_height_p);
|
||||
void (* allocate) (ClutterActor *self,
|
||||
const ClutterActorBox *box);
|
||||
const ClutterActorBox *box,
|
||||
ClutterAllocationFlags flags);
|
||||
|
||||
/* transformations */
|
||||
void (* apply_transform) (ClutterActor *actor,
|
||||
@ -298,14 +296,10 @@ struct _ClutterActorClass
|
||||
|
||||
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];
|
||||
gpointer _padding_dummy[26];
|
||||
};
|
||||
|
||||
/**
|
||||
@ -356,17 +350,9 @@ void clutter_actor_map
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_unmap (ClutterActor *self);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_paint (ClutterActor *self,
|
||||
ClutterPaintContext *paint_context);
|
||||
void clutter_actor_paint (ClutterActor *self);
|
||||
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);
|
||||
void clutter_actor_continue_paint (ClutterActor *self);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_queue_redraw (ClutterActor *self);
|
||||
CLUTTER_EXPORT
|
||||
@ -383,8 +369,6 @@ 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);
|
||||
@ -417,31 +401,38 @@ void clutter_actor_get_preferred_size
|
||||
gfloat *natural_height_p);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_allocate (ClutterActor *self,
|
||||
const ClutterActorBox *box);
|
||||
const ClutterActorBox *box,
|
||||
ClutterAllocationFlags flags);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_allocate_preferred_size (ClutterActor *self,
|
||||
float x,
|
||||
float y);
|
||||
ClutterAllocationFlags flags);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_allocate_available_size (ClutterActor *self,
|
||||
gfloat x,
|
||||
gfloat y,
|
||||
gfloat available_width,
|
||||
gfloat available_height);
|
||||
gfloat available_height,
|
||||
ClutterAllocationFlags flags);
|
||||
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);
|
||||
gboolean y_fill,
|
||||
ClutterAllocationFlags flags);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_set_allocation (ClutterActor *self,
|
||||
const ClutterActorBox *box);
|
||||
const ClutterActorBox *box,
|
||||
ClutterAllocationFlags flags);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_get_allocation_box (ClutterActor *self,
|
||||
ClutterActorBox *box);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_get_allocation_vertices (ClutterActor *self,
|
||||
ClutterActor *ancestor,
|
||||
ClutterVertex verts[]);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_actor_has_allocation (ClutterActor *self);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_set_size (ClutterActor *self,
|
||||
@ -456,10 +447,6 @@ void clutter_actor_set_position
|
||||
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);
|
||||
@ -599,7 +586,8 @@ gboolean clutter_actor_get_paint_box
|
||||
ClutterActorBox *box);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
float clutter_actor_get_resource_scale (ClutterActor *self);
|
||||
gboolean clutter_actor_get_resource_scale (ClutterActor *self,
|
||||
gfloat *resource_scale);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_actor_has_overlaps (ClutterActor *self);
|
||||
@ -813,11 +801,6 @@ void clutter_actor_set_child_transform
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_get_child_transform (ClutterActor *self,
|
||||
ClutterMatrix *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,
|
||||
@ -834,16 +817,16 @@ gboolean clutter_actor_transform_stage_point
|
||||
gfloat *y_out);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_get_abs_allocation_vertices (ClutterActor *self,
|
||||
graphene_point3d_t *verts);
|
||||
ClutterVertex verts[]);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_apply_transform_to_point (ClutterActor *self,
|
||||
const graphene_point3d_t *point,
|
||||
graphene_point3d_t *vertex);
|
||||
const ClutterVertex *point,
|
||||
ClutterVertex *vertex);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_apply_relative_transform_to_point (ClutterActor *self,
|
||||
ClutterActor *ancestor,
|
||||
const graphene_point3d_t *point,
|
||||
graphene_point3d_t *vertex);
|
||||
const ClutterVertex *point,
|
||||
ClutterVertex *vertex);
|
||||
|
||||
/* Implicit animations */
|
||||
CLUTTER_EXPORT
|
||||
@ -887,11 +870,6 @@ void clutter_actor_set_opacity_override
|
||||
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
|
||||
@ -926,15 +904,8 @@ void clutter_actor_bind_model_with_properties
|
||||
|
||||
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);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_ACTOR_H__ */
|
||||
|
@ -58,7 +58,6 @@ struct _ClutterAlignConstraint
|
||||
ClutterActor *actor;
|
||||
ClutterActor *source;
|
||||
ClutterAlignAxis align_axis;
|
||||
graphene_point_t pivot;
|
||||
gfloat factor;
|
||||
};
|
||||
|
||||
@ -73,7 +72,6 @@ enum
|
||||
|
||||
PROP_SOURCE,
|
||||
PROP_ALIGN_AXIS,
|
||||
PROP_PIVOT_POINT,
|
||||
PROP_FACTOR,
|
||||
|
||||
PROP_LAST
|
||||
@ -86,11 +84,13 @@ G_DEFINE_TYPE (ClutterAlignConstraint,
|
||||
CLUTTER_TYPE_CONSTRAINT);
|
||||
|
||||
static void
|
||||
source_queue_relayout (ClutterActor *actor,
|
||||
ClutterAlignConstraint *align)
|
||||
source_position_changed (ClutterActor *actor,
|
||||
const ClutterActorBox *allocation,
|
||||
ClutterAllocationFlags flags,
|
||||
ClutterAlignConstraint *align)
|
||||
{
|
||||
if (align->actor != NULL)
|
||||
_clutter_actor_queue_only_relayout (align->actor);
|
||||
clutter_actor_queue_relayout (align->actor);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -135,41 +135,35 @@ clutter_align_constraint_update_allocation (ClutterConstraint *constraint,
|
||||
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;
|
||||
gfloat source_x, source_y;
|
||||
|
||||
if (align->source == NULL)
|
||||
return;
|
||||
|
||||
clutter_actor_box_get_size (allocation, &actor_width, &actor_height);
|
||||
|
||||
clutter_actor_get_position (align->source, &source_x, &source_y);
|
||||
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->x1 = ((source_width - actor_width) * align->factor)
|
||||
+ source_x;
|
||||
allocation->x2 = allocation->x1 + actor_width;
|
||||
break;
|
||||
|
||||
case CLUTTER_ALIGN_Y_AXIS:
|
||||
allocation->y1 += offset_y_start + (source_height * align->factor);
|
||||
allocation->y1 = ((source_height - actor_height) * align->factor)
|
||||
+ source_y;
|
||||
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->x1 = ((source_width - actor_width) * align->factor)
|
||||
+ source_x;
|
||||
allocation->y1 = ((source_height - actor_height) * align->factor)
|
||||
+ source_y;
|
||||
allocation->x2 = allocation->x1 + actor_width;
|
||||
allocation->y2 = allocation->y1 + actor_height;
|
||||
break;
|
||||
@ -193,7 +187,7 @@ clutter_align_constraint_dispose (GObject *gobject)
|
||||
G_CALLBACK (source_destroyed),
|
||||
align);
|
||||
g_signal_handlers_disconnect_by_func (align->source,
|
||||
G_CALLBACK (source_queue_relayout),
|
||||
G_CALLBACK (source_position_changed),
|
||||
align);
|
||||
align->source = NULL;
|
||||
}
|
||||
@ -219,10 +213,6 @@ clutter_align_constraint_set_property (GObject *gobject,
|
||||
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;
|
||||
@ -251,16 +241,6 @@ clutter_align_constraint_get_property (GObject *gobject,
|
||||
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;
|
||||
@ -314,30 +294,6 @@ clutter_align_constraint_class_init (ClutterAlignConstraintClass *klass)
|
||||
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:
|
||||
*
|
||||
@ -370,8 +326,6 @@ 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;
|
||||
}
|
||||
|
||||
@ -449,15 +403,15 @@ clutter_align_constraint_set_source (ClutterAlignConstraint *align,
|
||||
G_CALLBACK (source_destroyed),
|
||||
align);
|
||||
g_signal_handlers_disconnect_by_func (old_source,
|
||||
G_CALLBACK (source_queue_relayout),
|
||||
G_CALLBACK (source_position_changed),
|
||||
align);
|
||||
}
|
||||
|
||||
align->source = source;
|
||||
if (align->source != NULL)
|
||||
{
|
||||
g_signal_connect (align->source, "queue-relayout",
|
||||
G_CALLBACK (source_queue_relayout),
|
||||
g_signal_connect (align->source, "allocation-changed",
|
||||
G_CALLBACK (source_position_changed),
|
||||
align);
|
||||
g_signal_connect (align->source, "destroy",
|
||||
G_CALLBACK (source_destroyed),
|
||||
@ -534,60 +488,6 @@ clutter_align_constraint_get_align_axis (ClutterAlignConstraint *align)
|
||||
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
|
||||
|
@ -67,12 +67,6 @@ void clutter_align_constraint_set_align_axis (ClutterAlignConstrai
|
||||
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
|
||||
|
@ -27,23 +27,36 @@
|
||||
* @short_description: Interface for animatable classes
|
||||
*
|
||||
* #ClutterAnimatable is an interface that allows a #GObject class
|
||||
* to control how an actor will animate a property.
|
||||
* to control how a #ClutterAnimation will animate a property.
|
||||
*
|
||||
* Each #ClutterAnimatable should implement the
|
||||
* #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.
|
||||
*
|
||||
* If a #ClutterAnimatable is animated by a #ClutterAnimation
|
||||
* instance, the #ClutterAnimation will call
|
||||
* clutter_animatable_interpolate_property() passing the name of the
|
||||
* currently animated property; the values interval; and the progress factor.
|
||||
* The #ClutterAnimatable implementation should return the computed value for
|
||||
* the animated
|
||||
* property.
|
||||
*
|
||||
* #ClutterAnimatable is available since Clutter 1.0
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include "clutter-animatable.h"
|
||||
#include "clutter-interval.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
#include "deprecated/clutter-animatable.h"
|
||||
#include "deprecated/clutter-animation.h"
|
||||
|
||||
G_DEFINE_INTERFACE (ClutterAnimatable, clutter_animatable, G_TYPE_OBJECT);
|
||||
|
||||
static void
|
||||
@ -51,6 +64,80 @@ clutter_animatable_default_init (ClutterAnimatableInterface *iface)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_animatable_animate_property:
|
||||
* @animatable: a #ClutterAnimatable
|
||||
* @animation: a #ClutterAnimation
|
||||
* @property_name: the name of the animated property
|
||||
* @initial_value: the initial value of the animation interval
|
||||
* @final_value: the final value of the animation interval
|
||||
* @progress: the progress factor
|
||||
* @value: return location for the animation value
|
||||
*
|
||||
* Calls the animate_property() virtual function for @animatable.
|
||||
*
|
||||
* The @initial_value and @final_value #GValue<!-- -->s must contain
|
||||
* the same type; @value must have been initialized to the same
|
||||
* type of @initial_value and @final_value.
|
||||
*
|
||||
* All implementation of the #ClutterAnimatable interface must
|
||||
* implement this function.
|
||||
*
|
||||
* Return value: %TRUE if the value has been validated and can
|
||||
* be applied to the #ClutterAnimatable, and %FALSE otherwise
|
||||
*
|
||||
* Since: 1.0
|
||||
*
|
||||
* Deprecated: 1.8: Use clutter_animatable_interpolate_value()
|
||||
* instead
|
||||
*/
|
||||
gboolean
|
||||
clutter_animatable_animate_property (ClutterAnimatable *animatable,
|
||||
ClutterAnimation *animation,
|
||||
const gchar *property_name,
|
||||
const GValue *initial_value,
|
||||
const GValue *final_value,
|
||||
gdouble progress,
|
||||
GValue *value)
|
||||
{
|
||||
ClutterAnimatableInterface *iface;
|
||||
gboolean res;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_ANIMATABLE (animatable), FALSE);
|
||||
g_return_val_if_fail (CLUTTER_IS_ANIMATION (animation), FALSE);
|
||||
g_return_val_if_fail (property_name != NULL, FALSE);
|
||||
g_return_val_if_fail (initial_value != NULL && final_value != NULL, FALSE);
|
||||
g_return_val_if_fail (G_VALUE_TYPE (initial_value) != G_TYPE_INVALID, FALSE);
|
||||
g_return_val_if_fail (G_VALUE_TYPE (final_value) != G_TYPE_INVALID, FALSE);
|
||||
g_return_val_if_fail (value != NULL, FALSE);
|
||||
g_return_val_if_fail (G_VALUE_TYPE (value) == G_VALUE_TYPE (initial_value) &&
|
||||
G_VALUE_TYPE (value) == G_VALUE_TYPE (final_value),
|
||||
FALSE);
|
||||
|
||||
iface = CLUTTER_ANIMATABLE_GET_IFACE (animatable);
|
||||
if (iface->animate_property == NULL)
|
||||
{
|
||||
ClutterInterval *interval;
|
||||
|
||||
interval = clutter_animation_get_interval (animation, property_name);
|
||||
if (interval == NULL)
|
||||
return FALSE;
|
||||
|
||||
res = clutter_animatable_interpolate_value (animatable, property_name,
|
||||
interval,
|
||||
progress,
|
||||
value);
|
||||
}
|
||||
else
|
||||
res = iface->animate_property (animatable, animation,
|
||||
property_name,
|
||||
initial_value, final_value,
|
||||
progress,
|
||||
value);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_animatable_find_property:
|
||||
* @animatable: a #ClutterAnimatable
|
||||
@ -194,25 +281,3 @@ clutter_animatable_interpolate_value (ClutterAnimatable *animatable,
|
||||
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);
|
||||
}
|
||||
|
@ -42,6 +42,8 @@ G_DECLARE_INTERFACE (ClutterAnimatable, clutter_animatable,
|
||||
|
||||
/**
|
||||
* ClutterAnimatableInterface:
|
||||
* @animate_property: virtual function for custom interpolation of a
|
||||
* property. This virtual function is deprecated
|
||||
* @find_property: virtual function for retrieving the #GParamSpec of
|
||||
* an animatable property
|
||||
* @get_initial_state: virtual function for retrieving the initial
|
||||
@ -50,7 +52,9 @@ G_DECLARE_INTERFACE (ClutterAnimatable, clutter_animatable,
|
||||
* animatable property
|
||||
* @interpolate_value: virtual function for interpolating the progress
|
||||
* of a property
|
||||
* @get_actor: virtual function for getting associated actor
|
||||
*
|
||||
* Base interface for #GObject<!-- -->s that can be animated by a
|
||||
* a #ClutterAnimation.
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
@ -60,6 +64,13 @@ struct _ClutterAnimatableInterface
|
||||
GTypeInterface parent_iface;
|
||||
|
||||
/*< public >*/
|
||||
gboolean (* animate_property) (ClutterAnimatable *animatable,
|
||||
ClutterAnimation *animation,
|
||||
const gchar *property_name,
|
||||
const GValue *initial_value,
|
||||
const GValue *final_value,
|
||||
gdouble progress,
|
||||
GValue *value);
|
||||
GParamSpec *(* find_property) (ClutterAnimatable *animatable,
|
||||
const gchar *property_name);
|
||||
void (* get_initial_state) (ClutterAnimatable *animatable,
|
||||
@ -73,7 +84,6 @@ struct _ClutterAnimatableInterface
|
||||
ClutterInterval *interval,
|
||||
gdouble progress,
|
||||
GValue *value);
|
||||
ClutterActor * (* get_actor) (ClutterAnimatable *animatable);
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
@ -94,9 +104,6 @@ gboolean clutter_animatable_interpolate_value (ClutterAnimatable *animatable,
|
||||
gdouble progress,
|
||||
GValue *value);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterActor * clutter_animatable_get_actor (ClutterAnimatable *animatable);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_ANIMATABLE_H__ */
|
||||
|
@ -30,7 +30,9 @@
|
||||
|
||||
#ifndef __GI_SCANNER__
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterAction, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActor, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActorMeta, 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)
|
||||
@ -41,15 +43,19 @@ 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 (ClutterClickAction, 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 (ClutterDragAction, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDropAction, 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 (ClutterGestureAction, 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)
|
||||
@ -84,10 +90,13 @@ 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 (ClutterMatrix, clutter_matrix_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)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPoint, clutter_point_free)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterRect, clutter_rect_free)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterSize, clutter_size_free)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterVertex, clutter_vertex_free)
|
||||
|
||||
#endif /* __GI_SCANNER__ */
|
||||
|
||||
|
@ -23,7 +23,8 @@
|
||||
#define __CLUTTER_BACKEND_PRIVATE_H__
|
||||
|
||||
#include <clutter/clutter-backend.h>
|
||||
#include <clutter/clutter-seat.h>
|
||||
#include <clutter/clutter-device-manager.h>
|
||||
#include <clutter/clutter-keymap.h>
|
||||
#include <clutter/clutter-stage-window.h>
|
||||
|
||||
#define CLUTTER_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BACKEND, ClutterBackendClass))
|
||||
@ -46,6 +47,8 @@ struct _ClutterBackend
|
||||
|
||||
CoglOnscreen *dummy_onscreen;
|
||||
|
||||
ClutterDeviceManager *device_manager;
|
||||
|
||||
cairo_font_options_t *font_options;
|
||||
|
||||
gchar *font_name;
|
||||
@ -53,11 +56,11 @@ struct _ClutterBackend
|
||||
gfloat units_per_em;
|
||||
gint32 units_serial;
|
||||
|
||||
float fallback_resource_scale;
|
||||
|
||||
ClutterStageWindow *stage_window;
|
||||
|
||||
ClutterInputMethod *input_method;
|
||||
|
||||
ClutterKeymap *keymap;
|
||||
};
|
||||
|
||||
struct _ClutterBackendClass
|
||||
@ -86,14 +89,17 @@ struct _ClutterBackendClass
|
||||
GError **error);
|
||||
gboolean (* create_context) (ClutterBackend *backend,
|
||||
GError **error);
|
||||
ClutterDeviceManager *(* get_device_manager) (ClutterBackend *backend);
|
||||
|
||||
gboolean (* translate_event) (ClutterBackend *backend,
|
||||
gpointer native,
|
||||
ClutterEvent *event);
|
||||
|
||||
ClutterSeat * (* get_default_seat) (ClutterBackend *backend);
|
||||
PangoDirection (* get_keymap_direction) (ClutterBackend *backend);
|
||||
|
||||
gboolean (* is_display_server) (ClutterBackend *backend);
|
||||
void (* bell_notify) (ClutterBackend *backend);
|
||||
|
||||
ClutterKeymap * (* get_keymap) (ClutterBackend *backend);
|
||||
|
||||
/* signals */
|
||||
void (* resolution_changed) (ClutterBackend *backend);
|
||||
@ -133,19 +139,16 @@ gfloat _clutter_backend_get_units_per_em (Clutter
|
||||
PangoFontDescription *font_desc);
|
||||
gint32 _clutter_backend_get_units_serial (ClutterBackend *backend);
|
||||
|
||||
PangoDirection _clutter_backend_get_keymap_direction (ClutterBackend *backend);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend);
|
||||
|
||||
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);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BACKEND_PRIVATE_H__ */
|
||||
|
@ -51,6 +51,7 @@
|
||||
#include "clutter-stage-manager-private.h"
|
||||
#include "clutter-stage-private.h"
|
||||
#include "clutter-stage-window.h"
|
||||
#include "clutter-device-manager-private.h"
|
||||
|
||||
#ifdef CLUTTER_HAS_WAYLAND_COMPOSITOR_SUPPORT
|
||||
#include "wayland/clutter-wayland-compositor.h"
|
||||
@ -58,6 +59,13 @@
|
||||
|
||||
#include <cogl/cogl.h>
|
||||
|
||||
#ifdef CLUTTER_INPUT_X11
|
||||
#include "x11/clutter-backend-x11.h"
|
||||
#endif
|
||||
#ifdef CLUTTER_WINDOWING_EGL
|
||||
#include "egl/clutter-backend-eglnative.h"
|
||||
#endif
|
||||
|
||||
#ifdef CLUTTER_HAS_WAYLAND_COMPOSITOR_SUPPORT
|
||||
#include <cogl/cogl-wayland-server.h>
|
||||
#include <wayland-server.h>
|
||||
@ -415,6 +423,14 @@ clutter_backend_real_get_features (ClutterBackend *backend)
|
||||
flags |= CLUTTER_FEATURE_STAGE_STATIC;
|
||||
}
|
||||
|
||||
if (cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_THROTTLE))
|
||||
{
|
||||
CLUTTER_NOTE (BACKEND, "Cogl supports swap buffers throttling");
|
||||
flags |= CLUTTER_FEATURE_SWAP_THROTTLE;
|
||||
}
|
||||
else
|
||||
CLUTTER_NOTE (BACKEND, "Cogl doesn't support swap buffers throttling");
|
||||
|
||||
if (cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_BUFFERS_EVENT))
|
||||
{
|
||||
CLUTTER_NOTE (BACKEND, "Cogl supports swap buffers complete events");
|
||||
@ -424,8 +440,23 @@ clutter_backend_real_get_features (ClutterBackend *backend)
|
||||
return flags;
|
||||
}
|
||||
|
||||
static const char *allowed_backends;
|
||||
|
||||
static ClutterBackend * (* custom_backend_func) (void);
|
||||
|
||||
static const struct {
|
||||
const char *name;
|
||||
ClutterBackend * (* create_backend) (void);
|
||||
} available_backends[] = {
|
||||
#ifdef CLUTTER_WINDOWING_X11
|
||||
{ CLUTTER_WINDOWING_X11, clutter_backend_x11_new },
|
||||
#endif
|
||||
#ifdef CLUTTER_WINDOWING_EGL
|
||||
{ CLUTTER_WINDOWING_EGL, clutter_backend_egl_native_new },
|
||||
#endif
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
||||
void
|
||||
clutter_set_custom_backend_func (ClutterBackend *(* func) (void))
|
||||
{
|
||||
@ -435,13 +466,58 @@ clutter_set_custom_backend_func (ClutterBackend *(* func) (void))
|
||||
ClutterBackend *
|
||||
_clutter_create_backend (void)
|
||||
{
|
||||
const char *backends_list;
|
||||
ClutterBackend *retval;
|
||||
gboolean allow_any;
|
||||
char **backends;
|
||||
int i;
|
||||
|
||||
g_return_val_if_fail (custom_backend_func, NULL);
|
||||
if (custom_backend_func)
|
||||
{
|
||||
retval = custom_backend_func ();
|
||||
|
||||
retval = custom_backend_func ();
|
||||
if (!retval)
|
||||
g_error ("Failed to create custom backend.");
|
||||
if (!retval)
|
||||
g_error ("Failed to create custom backend.");
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
if (allowed_backends == NULL)
|
||||
allowed_backends = "*";
|
||||
|
||||
allow_any = strstr (allowed_backends, "*") != NULL;
|
||||
|
||||
backends_list = g_getenv ("CLUTTER_BACKEND");
|
||||
if (backends_list == NULL)
|
||||
backends_list = allowed_backends;
|
||||
|
||||
backends = g_strsplit (backends_list, ",", 0);
|
||||
|
||||
retval = NULL;
|
||||
|
||||
for (i = 0; retval == NULL && backends[i] != NULL; i++)
|
||||
{
|
||||
const char *backend = backends[i];
|
||||
gboolean is_any = g_str_equal (backend, "*");
|
||||
int j;
|
||||
|
||||
for (j = 0; available_backends[j].name != NULL; j++)
|
||||
{
|
||||
if ((is_any && allow_any) ||
|
||||
(is_any && strstr (allowed_backends, available_backends[j].name)) ||
|
||||
g_str_equal (backend, available_backends[j].name))
|
||||
{
|
||||
retval = available_backends[j].create_backend ();
|
||||
if (retval != NULL)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_strfreev (backends);
|
||||
|
||||
if (retval == NULL)
|
||||
g_error ("No default Clutter backend found.");
|
||||
|
||||
return retval;
|
||||
}
|
||||
@ -452,6 +528,30 @@ clutter_backend_real_init_events (ClutterBackend *backend)
|
||||
g_error ("Unknown input backend");
|
||||
}
|
||||
|
||||
static ClutterDeviceManager *
|
||||
clutter_backend_real_get_device_manager (ClutterBackend *backend)
|
||||
{
|
||||
if (G_UNLIKELY (backend->device_manager == NULL))
|
||||
{
|
||||
g_critical ("No device manager available, expect broken input");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return backend->device_manager;
|
||||
}
|
||||
|
||||
static ClutterKeymap *
|
||||
clutter_backend_real_get_keymap (ClutterBackend *backend)
|
||||
{
|
||||
if (G_UNLIKELY (backend->keymap == NULL))
|
||||
{
|
||||
g_critical ("No keymap available, expect broken keyboard input");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return backend->keymap;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_class_init (ClutterBackendClass *klass)
|
||||
{
|
||||
@ -515,8 +615,10 @@ clutter_backend_class_init (ClutterBackendClass *klass)
|
||||
klass->font_changed = clutter_backend_real_font_changed;
|
||||
|
||||
klass->init_events = clutter_backend_real_init_events;
|
||||
klass->get_device_manager = clutter_backend_real_get_device_manager;
|
||||
klass->create_context = clutter_backend_real_create_context;
|
||||
klass->get_features = clutter_backend_real_get_features;
|
||||
klass->get_keymap = clutter_backend_real_get_keymap;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -525,9 +627,7 @@ 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;
|
||||
self->dummy_onscreen = COGL_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
void
|
||||
@ -683,24 +783,24 @@ _clutter_backend_copy_event_data (ClutterBackend *backend,
|
||||
const ClutterEvent *src,
|
||||
ClutterEvent *dest)
|
||||
{
|
||||
ClutterSeatClass *seat_class;
|
||||
ClutterSeat *seat;
|
||||
ClutterDeviceManagerClass *device_manager_class;
|
||||
ClutterDeviceManager *device_manager;
|
||||
|
||||
seat = clutter_backend_get_default_seat (backend);
|
||||
seat_class = CLUTTER_SEAT_GET_CLASS (seat);
|
||||
seat_class->copy_event_data (seat, src, dest);
|
||||
device_manager = clutter_device_manager_get_default ();
|
||||
device_manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
|
||||
device_manager_class->copy_event_data (device_manager, src, dest);
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_backend_free_event_data (ClutterBackend *backend,
|
||||
ClutterEvent *event)
|
||||
{
|
||||
ClutterSeatClass *seat_class;
|
||||
ClutterSeat *seat;
|
||||
ClutterDeviceManagerClass *device_manager_class;
|
||||
ClutterDeviceManager *device_manager;
|
||||
|
||||
seat = clutter_backend_get_default_seat (backend);
|
||||
seat_class = CLUTTER_SEAT_GET_CLASS (seat);
|
||||
seat_class->free_event_data (seat, event);
|
||||
device_manager = clutter_device_manager_get_default ();
|
||||
device_manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
|
||||
device_manager_class->free_event_data (device_manager, event);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -897,6 +997,39 @@ clutter_wayland_set_compositor_display (void *display)
|
||||
}
|
||||
#endif
|
||||
|
||||
PangoDirection
|
||||
_clutter_backend_get_keymap_direction (ClutterBackend *backend)
|
||||
{
|
||||
ClutterBackendClass *klass;
|
||||
|
||||
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
||||
if (klass->get_keymap_direction != NULL)
|
||||
return klass->get_keymap_direction (backend);
|
||||
|
||||
return PANGO_DIRECTION_NEUTRAL;
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend)
|
||||
{
|
||||
if (backend->dummy_onscreen == COGL_INVALID_HANDLE)
|
||||
{
|
||||
GError *internal_error = NULL;
|
||||
|
||||
backend->dummy_onscreen = cogl_onscreen_new (backend->cogl_context, 1, 1);
|
||||
|
||||
if (!cogl_framebuffer_allocate (COGL_FRAMEBUFFER (backend->dummy_onscreen),
|
||||
&internal_error))
|
||||
{
|
||||
g_critical ("Unable to create dummy onscreen: %s", internal_error->message);
|
||||
g_error_free (internal_error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
cogl_set_framebuffer (COGL_FRAMEBUFFER (backend->dummy_onscreen));
|
||||
}
|
||||
|
||||
void
|
||||
clutter_set_allowed_drivers (const char *drivers)
|
||||
{
|
||||
@ -909,6 +1042,16 @@ clutter_set_allowed_drivers (const char *drivers)
|
||||
allowed_drivers = g_strdup (drivers);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_backend_bell_notify (ClutterBackend *backend)
|
||||
{
|
||||
ClutterBackendClass *klass;
|
||||
|
||||
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
||||
if (klass->bell_notify)
|
||||
klass->bell_notify (backend);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_backend_get_input_method:
|
||||
* @backend: the #CLutterBackend
|
||||
@ -937,43 +1080,22 @@ clutter_backend_set_input_method (ClutterBackend *backend,
|
||||
g_set_object (&backend->input_method, method);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_backend_get_keymap:
|
||||
* @backend: the #ClutterBackend
|
||||
*
|
||||
* Gets the keymap used by Clutter
|
||||
*
|
||||
* Returns: (transfer none): the keymap
|
||||
**/
|
||||
ClutterKeymap *
|
||||
clutter_backend_get_keymap (ClutterBackend *backend)
|
||||
{
|
||||
return CLUTTER_BACKEND_GET_CLASS (backend)->get_keymap (backend);
|
||||
}
|
||||
|
||||
ClutterStageWindow *
|
||||
clutter_backend_get_stage_window (ClutterBackend *backend)
|
||||
{
|
||||
return backend->stage_window;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_backend_get_default_seat:
|
||||
* @backend: the #ClutterBackend
|
||||
*
|
||||
* Returns the default seat
|
||||
*
|
||||
* Returns: (transfer none): the default seat
|
||||
**/
|
||||
ClutterSeat *
|
||||
clutter_backend_get_default_seat (ClutterBackend *backend)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_BACKEND (backend), NULL);
|
||||
|
||||
return CLUTTER_BACKEND_GET_CLASS (backend)->get_default_seat (backend);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include <clutter/clutter-config.h>
|
||||
#include <clutter/clutter-keymap.h>
|
||||
#include <clutter/clutter-types.h>
|
||||
#include <clutter/clutter-seat.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@ -73,6 +72,9 @@ const cairo_font_options_t * clutter_backend_get_font_options (Clutter
|
||||
CLUTTER_EXPORT
|
||||
CoglContext * clutter_backend_get_cogl_context (ClutterBackend *backend);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_backend_bell_notify (ClutterBackend *backend);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterInputMethod * clutter_backend_get_input_method (ClutterBackend *backend);
|
||||
|
||||
@ -80,7 +82,7 @@ CLUTTER_EXPORT
|
||||
void clutter_backend_set_input_method (ClutterBackend *backend,
|
||||
ClutterInputMethod *method);
|
||||
CLUTTER_EXPORT
|
||||
ClutterSeat * clutter_backend_get_default_seat (ClutterBackend *backend);
|
||||
ClutterKeymap * clutter_backend_get_keymap (ClutterBackend *backend);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -49,10 +49,10 @@
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include "deprecated/clutter-container.h"
|
||||
#include "deprecated/clutter-bin-layout.h"
|
||||
|
||||
#include "clutter-actor-private.h"
|
||||
#include "clutter-animatable.h"
|
||||
#include "clutter-bin-layout.h"
|
||||
#include "clutter-child-meta.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-enum-types.h"
|
||||
@ -406,7 +406,8 @@ get_actor_align_factor (ClutterActorAlign alignment)
|
||||
static void
|
||||
clutter_bin_layout_allocate (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container,
|
||||
const ClutterActorBox *allocation)
|
||||
const ClutterActorBox *allocation,
|
||||
ClutterAllocationFlags flags)
|
||||
{
|
||||
gfloat allocation_x, allocation_y;
|
||||
gfloat available_w, available_h;
|
||||
@ -514,7 +515,8 @@ clutter_bin_layout_allocate (ClutterLayoutManager *manager,
|
||||
|
||||
clutter_actor_allocate_align_fill (child, &child_alloc,
|
||||
x_align, y_align,
|
||||
x_fill, y_fill);
|
||||
x_fill, y_fill,
|
||||
flags);
|
||||
}
|
||||
}
|
||||
|
||||
@ -696,3 +698,187 @@ clutter_bin_layout_new (ClutterBinAlignment x_align,
|
||||
"y-align", y_align,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_bin_layout_set_alignment:
|
||||
* @self: a #ClutterBinLayout
|
||||
* @child: (allow-none): a child of @container
|
||||
* @x_align: the horizontal alignment policy to be used for the @child
|
||||
* inside @container
|
||||
* @y_align: the vertical aligment policy to be used on the @child
|
||||
* inside @container
|
||||
*
|
||||
* Sets the horizontal and vertical alignment policies to be applied
|
||||
* to a @child of @self
|
||||
*
|
||||
* If @child is %NULL then the @x_align and @y_align values will
|
||||
* be set as the default alignment policies
|
||||
*
|
||||
* Since: 1.2
|
||||
*
|
||||
* Deprecated: 1.12: Use the #ClutterActor:x-align and
|
||||
* #ClutterActor:y-align properties of #ClutterActor instead.
|
||||
*/
|
||||
void
|
||||
clutter_bin_layout_set_alignment (ClutterBinLayout *self,
|
||||
ClutterActor *child,
|
||||
ClutterBinAlignment x_align,
|
||||
ClutterBinAlignment y_align)
|
||||
{
|
||||
ClutterBinLayoutPrivate *priv;
|
||||
ClutterLayoutManager *manager;
|
||||
ClutterLayoutMeta *meta;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BIN_LAYOUT (self));
|
||||
g_return_if_fail (child == NULL || CLUTTER_IS_ACTOR (child));
|
||||
|
||||
priv = self->priv;
|
||||
|
||||
if (priv->container == NULL)
|
||||
{
|
||||
if (child == NULL)
|
||||
{
|
||||
set_x_align (self, x_align);
|
||||
set_y_align (self, y_align);
|
||||
}
|
||||
else
|
||||
g_warning ("The layout of type '%s' must be associated to "
|
||||
"a ClutterContainer before setting the alignment "
|
||||
"on its children",
|
||||
G_OBJECT_TYPE_NAME (self));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
manager = CLUTTER_LAYOUT_MANAGER (self);
|
||||
meta = clutter_layout_manager_get_child_meta (manager,
|
||||
priv->container,
|
||||
child);
|
||||
g_assert (CLUTTER_IS_BIN_LAYER (meta));
|
||||
|
||||
set_layer_x_align (CLUTTER_BIN_LAYER (meta), x_align);
|
||||
set_layer_y_align (CLUTTER_BIN_LAYER (meta), y_align);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_bin_layout_get_alignment:
|
||||
* @self: a #ClutterBinLayout
|
||||
* @child: (allow-none): a child of @container
|
||||
* @x_align: (out) (allow-none): return location for the horizontal
|
||||
* alignment policy
|
||||
* @y_align: (out) (allow-none): return location for the vertical
|
||||
* alignment policy
|
||||
*
|
||||
* Retrieves the horizontal and vertical alignment policies for
|
||||
* a child of @self
|
||||
*
|
||||
* If @child is %NULL the default alignment policies will be returned
|
||||
* instead
|
||||
*
|
||||
* Since: 1.2
|
||||
*
|
||||
* Deprecated: 1.12: Use the #ClutterActor:x-align and the
|
||||
* #ClutterActor:y-align properties of #ClutterActor instead.
|
||||
*/
|
||||
void
|
||||
clutter_bin_layout_get_alignment (ClutterBinLayout *self,
|
||||
ClutterActor *child,
|
||||
ClutterBinAlignment *x_align,
|
||||
ClutterBinAlignment *y_align)
|
||||
{
|
||||
ClutterBinLayoutPrivate *priv;
|
||||
ClutterLayoutManager *manager;
|
||||
ClutterLayoutMeta *meta;
|
||||
ClutterBinLayer *layer;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BIN_LAYOUT (self));
|
||||
|
||||
priv = self->priv;
|
||||
|
||||
if (priv->container == NULL)
|
||||
{
|
||||
if (child == NULL)
|
||||
{
|
||||
if (x_align)
|
||||
*x_align = priv->x_align;
|
||||
|
||||
if (y_align)
|
||||
*y_align = priv->y_align;
|
||||
}
|
||||
else
|
||||
g_warning ("The layout of type '%s' must be associated to "
|
||||
"a ClutterContainer before getting the alignment "
|
||||
"of its children",
|
||||
G_OBJECT_TYPE_NAME (self));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
manager = CLUTTER_LAYOUT_MANAGER (self);
|
||||
meta = clutter_layout_manager_get_child_meta (manager,
|
||||
priv->container,
|
||||
child);
|
||||
g_assert (CLUTTER_IS_BIN_LAYER (meta));
|
||||
|
||||
layer = CLUTTER_BIN_LAYER (meta);
|
||||
|
||||
if (x_align)
|
||||
*x_align = layer->x_align;
|
||||
|
||||
if (y_align)
|
||||
*y_align = layer->y_align;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_bin_layout_add:
|
||||
* @self: a #ClutterBinLayout
|
||||
* @child: a #ClutterActor
|
||||
* @x_align: horizontal alignment policy for @child
|
||||
* @y_align: vertical alignment policy for @child
|
||||
*
|
||||
* Adds a #ClutterActor to the container using @self and
|
||||
* sets the alignment policies for it
|
||||
*
|
||||
* This function is equivalent to clutter_container_add_actor()
|
||||
* and clutter_layout_manager_child_set_property() but it does not
|
||||
* require a pointer to the #ClutterContainer associated to the
|
||||
* #ClutterBinLayout
|
||||
*
|
||||
* Since: 1.2
|
||||
*
|
||||
* Deprecated: 1.12: Use clutter_actor_add_child() instead.
|
||||
*/
|
||||
void
|
||||
clutter_bin_layout_add (ClutterBinLayout *self,
|
||||
ClutterActor *child,
|
||||
ClutterBinAlignment x_align,
|
||||
ClutterBinAlignment y_align)
|
||||
{
|
||||
ClutterBinLayoutPrivate *priv;
|
||||
ClutterLayoutManager *manager;
|
||||
ClutterLayoutMeta *meta;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BIN_LAYOUT (self));
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (child));
|
||||
|
||||
priv = self->priv;
|
||||
|
||||
if (priv->container == NULL)
|
||||
{
|
||||
g_warning ("The layout of type '%s' must be associated to "
|
||||
"a ClutterContainer before adding children",
|
||||
G_OBJECT_TYPE_NAME (self));
|
||||
return;
|
||||
}
|
||||
|
||||
clutter_container_add_actor (priv->container, child);
|
||||
|
||||
manager = CLUTTER_LAYOUT_MANAGER (self);
|
||||
meta = clutter_layout_manager_get_child_meta (manager,
|
||||
priv->container,
|
||||
child);
|
||||
g_assert (CLUTTER_IS_BIN_LAYER (meta));
|
||||
|
||||
set_layer_x_align (CLUTTER_BIN_LAYER (meta), x_align);
|
||||
set_layer_y_align (CLUTTER_BIN_LAYER (meta), y_align);
|
||||
}
|
||||
|
@ -38,14 +38,12 @@
|
||||
*
|
||||
* |[<!-- language="C" -->
|
||||
* // source
|
||||
* rect[0] = clutter_actor_new ();
|
||||
* clutter_actor_set_background_color (rect[0], &red_color);
|
||||
* rect[0] = clutter_rectangle_new_with_color (&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);
|
||||
* rect[1] = clutter_rectangle_new_with_color (&green_color);
|
||||
* clutter_actor_set_size (rect[1], 100, 100);
|
||||
* clutter_actor_set_opacity (rect[1], 0);
|
||||
*
|
||||
@ -55,8 +53,7 @@
|
||||
* 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);
|
||||
* rect[2] = clutter_rectangle_new_with_color (&blue_color);
|
||||
* clutter_actor_set_size (rect[2], 100, 100);
|
||||
* clutter_actor_set_opacity (rect[2], 0);
|
||||
*
|
||||
@ -147,58 +144,6 @@ source_destroyed (ClutterActor *actor,
|
||||
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,
|
||||
@ -207,9 +152,7 @@ clutter_bind_constraint_update_allocation (ClutterConstraint *constraint,
|
||||
ClutterBindConstraint *bind = CLUTTER_BIND_CONSTRAINT (constraint);
|
||||
gfloat source_width, source_height;
|
||||
gfloat actor_width, actor_height;
|
||||
graphene_point3d_t source_position;
|
||||
|
||||
source_position = GRAPHENE_POINT3D_INIT (0.f, 0.f, 0.f);
|
||||
ClutterVertex source_position = { 0., };
|
||||
|
||||
if (bind->source == NULL)
|
||||
return;
|
||||
@ -383,8 +326,6 @@ clutter_bind_constraint_class_init (ClutterBindConstraintClass *klass)
|
||||
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:
|
||||
*
|
||||
|
@ -99,8 +99,7 @@ G_DEFINE_TYPE (ClutterBlurEffect,
|
||||
CLUTTER_TYPE_OFFSCREEN_EFFECT);
|
||||
|
||||
static gboolean
|
||||
clutter_blur_effect_pre_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_blur_effect_pre_paint (ClutterEffect *effect)
|
||||
{
|
||||
ClutterBlurEffect *self = CLUTTER_BLUR_EFFECT (effect);
|
||||
ClutterEffectClass *parent_class;
|
||||
@ -125,7 +124,7 @@ clutter_blur_effect_pre_paint (ClutterEffect *effect,
|
||||
}
|
||||
|
||||
parent_class = CLUTTER_EFFECT_CLASS (clutter_blur_effect_parent_class);
|
||||
if (parent_class->pre_paint (effect, paint_context))
|
||||
if (parent_class->pre_paint (effect))
|
||||
{
|
||||
ClutterOffscreenEffect *offscreen_effect =
|
||||
CLUTTER_OFFSCREEN_EFFECT (effect);
|
||||
@ -158,12 +157,10 @@ clutter_blur_effect_pre_paint (ClutterEffect *effect,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_blur_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_blur_effect_paint_target (ClutterOffscreenEffect *effect)
|
||||
{
|
||||
ClutterBlurEffect *self = CLUTTER_BLUR_EFFECT (effect);
|
||||
CoglFramebuffer *framebuffer =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
|
||||
guint8 paint_opacity;
|
||||
|
||||
paint_opacity = clutter_actor_get_paint_opacity (self->actor);
|
||||
@ -185,7 +182,7 @@ clutter_blur_effect_modify_paint_volume (ClutterEffect *effect,
|
||||
ClutterPaintVolume *volume)
|
||||
{
|
||||
gfloat cur_width, cur_height;
|
||||
graphene_point3d_t origin;
|
||||
ClutterVertex origin;
|
||||
|
||||
clutter_paint_volume_get_origin (volume, &origin);
|
||||
cur_width = clutter_paint_volume_get_width (volume);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -105,6 +105,64 @@ void clutter_box_layout_set_pack_start (ClutterBoxLayou
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_box_layout_get_pack_start (ClutterBoxLayout *layout);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_box_layout_set_orientation)
|
||||
void clutter_box_layout_set_vertical (ClutterBoxLayout *layout,
|
||||
gboolean vertical);
|
||||
CLUTTER_DEPRECATED_FOR(clutter_box_layout_get_orientation)
|
||||
gboolean clutter_box_layout_get_vertical (ClutterBoxLayout *layout);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_box_layout_pack (ClutterBoxLayout *layout,
|
||||
ClutterActor *actor,
|
||||
gboolean expand,
|
||||
gboolean x_fill,
|
||||
gboolean y_fill,
|
||||
ClutterBoxAlignment x_align,
|
||||
ClutterBoxAlignment y_align);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_box_layout_set_alignment (ClutterBoxLayout *layout,
|
||||
ClutterActor *actor,
|
||||
ClutterBoxAlignment x_align,
|
||||
ClutterBoxAlignment y_align);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_box_layout_get_alignment (ClutterBoxLayout *layout,
|
||||
ClutterActor *actor,
|
||||
ClutterBoxAlignment *x_align,
|
||||
ClutterBoxAlignment *y_align);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_box_layout_set_fill (ClutterBoxLayout *layout,
|
||||
ClutterActor *actor,
|
||||
gboolean x_fill,
|
||||
gboolean y_fill);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_box_layout_get_fill (ClutterBoxLayout *layout,
|
||||
ClutterActor *actor,
|
||||
gboolean *x_fill,
|
||||
gboolean *y_fill);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_box_layout_set_expand (ClutterBoxLayout *layout,
|
||||
ClutterActor *actor,
|
||||
gboolean expand);
|
||||
CLUTTER_DEPRECATED
|
||||
gboolean clutter_box_layout_get_expand (ClutterBoxLayout *layout,
|
||||
ClutterActor *actor);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_box_layout_set_use_animations (ClutterBoxLayout *layout,
|
||||
gboolean animate);
|
||||
CLUTTER_DEPRECATED
|
||||
gboolean clutter_box_layout_get_use_animations (ClutterBoxLayout *layout);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_box_layout_set_easing_mode (ClutterBoxLayout *layout,
|
||||
gulong mode);
|
||||
CLUTTER_DEPRECATED
|
||||
gulong clutter_box_layout_get_easing_mode (ClutterBoxLayout *layout);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_box_layout_set_easing_duration (ClutterBoxLayout *layout,
|
||||
guint msecs);
|
||||
CLUTTER_DEPRECATED
|
||||
guint clutter_box_layout_get_easing_duration (ClutterBoxLayout *layout);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BOX_LAYOUT_H__ */
|
||||
|
@ -121,17 +121,16 @@ G_DEFINE_TYPE (ClutterBrightnessContrastEffect,
|
||||
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));
|
||||
return (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);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_brightness_contrast_effect_pre_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_brightness_contrast_effect_pre_paint (ClutterEffect *effect)
|
||||
{
|
||||
ClutterBrightnessContrastEffect *self = CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (effect);
|
||||
ClutterEffectClass *parent_class;
|
||||
@ -157,7 +156,7 @@ clutter_brightness_contrast_effect_pre_paint (ClutterEffect *effect,
|
||||
|
||||
parent_class =
|
||||
CLUTTER_EFFECT_CLASS (clutter_brightness_contrast_effect_parent_class);
|
||||
if (parent_class->pre_paint (effect, paint_context))
|
||||
if (parent_class->pre_paint (effect))
|
||||
{
|
||||
ClutterOffscreenEffect *offscreen_effect =
|
||||
CLUTTER_OFFSCREEN_EFFECT (effect);
|
||||
@ -176,12 +175,10 @@ clutter_brightness_contrast_effect_pre_paint (ClutterEffect *effect,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_brightness_contrast_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_brightness_contrast_effect_paint_target (ClutterOffscreenEffect *effect)
|
||||
{
|
||||
ClutterBrightnessContrastEffect *self = CLUTTER_BRIGHTNESS_CONTRAST_EFFECT (effect);
|
||||
CoglFramebuffer *framebuffer =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
|
||||
ClutterActor *actor;
|
||||
guint8 paint_opacity;
|
||||
|
||||
@ -497,9 +494,9 @@ clutter_brightness_contrast_effect_set_brightness_full (ClutterBrightnessContras
|
||||
{
|
||||
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))
|
||||
if (red == effect->brightness_red &&
|
||||
green == effect->brightness_green &&
|
||||
blue == effect->brightness_blue)
|
||||
return;
|
||||
|
||||
effect->brightness_red = red;
|
||||
@ -587,9 +584,9 @@ clutter_brightness_contrast_effect_set_contrast_full (ClutterBrightnessContrastE
|
||||
{
|
||||
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))
|
||||
if (red == effect->contrast_red &&
|
||||
green == effect->contrast_green &&
|
||||
blue == effect->contrast_blue)
|
||||
return;
|
||||
|
||||
effect->contrast_red = red;
|
||||
|
@ -328,10 +328,9 @@ clutter_canvas_init (ClutterCanvas *self)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_canvas_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *root,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_canvas_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *root)
|
||||
{
|
||||
ClutterCanvas *self = CLUTTER_CANVAS (content);
|
||||
ClutterCanvasPrivate *priv = self->priv;
|
||||
@ -352,7 +351,7 @@ clutter_canvas_paint_content (ClutterContent *content,
|
||||
return;
|
||||
|
||||
node = clutter_actor_create_texture_paint_node (actor, priv->texture);
|
||||
clutter_paint_node_set_static_name (node, "Canvas Content");
|
||||
clutter_paint_node_set_name (node, "Canvas Content");
|
||||
clutter_paint_node_add_child (root, node);
|
||||
clutter_paint_node_unref (node);
|
||||
|
||||
|
@ -105,8 +105,8 @@ struct _ClutterClickActionPrivate
|
||||
{
|
||||
ClutterActor *stage;
|
||||
|
||||
gulong event_id;
|
||||
gulong capture_id;
|
||||
guint event_id;
|
||||
guint capture_id;
|
||||
guint long_press_id;
|
||||
|
||||
gint long_press_threshold;
|
||||
@ -159,8 +159,7 @@ static inline void
|
||||
click_action_set_pressed (ClutterClickAction *action,
|
||||
gboolean is_pressed)
|
||||
{
|
||||
ClutterClickActionPrivate *priv =
|
||||
clutter_click_action_get_instance_private (action);
|
||||
ClutterClickActionPrivate *priv = action->priv;
|
||||
|
||||
is_pressed = !!is_pressed;
|
||||
|
||||
@ -175,8 +174,7 @@ static inline void
|
||||
click_action_set_held (ClutterClickAction *action,
|
||||
gboolean is_held)
|
||||
{
|
||||
ClutterClickActionPrivate *priv =
|
||||
clutter_click_action_get_instance_private (action);
|
||||
ClutterClickActionPrivate *priv = action->priv;
|
||||
|
||||
is_held = !!is_held;
|
||||
|
||||
@ -191,8 +189,7 @@ static gboolean
|
||||
click_action_emit_long_press (gpointer data)
|
||||
{
|
||||
ClutterClickAction *action = data;
|
||||
ClutterClickActionPrivate *priv =
|
||||
clutter_click_action_get_instance_private (action);
|
||||
ClutterClickActionPrivate *priv = action->priv;
|
||||
ClutterActor *actor;
|
||||
gboolean result;
|
||||
|
||||
@ -205,7 +202,11 @@ click_action_emit_long_press (gpointer data)
|
||||
CLUTTER_LONG_PRESS_ACTIVATE,
|
||||
&result);
|
||||
|
||||
g_clear_signal_handler (&priv->capture_id, priv->stage);
|
||||
if (priv->capture_id != 0)
|
||||
{
|
||||
g_signal_handler_disconnect (priv->stage, priv->capture_id);
|
||||
priv->capture_id = 0;
|
||||
}
|
||||
|
||||
click_action_set_pressed (action, FALSE);
|
||||
click_action_set_held (action, FALSE);
|
||||
@ -216,8 +217,7 @@ click_action_emit_long_press (gpointer data)
|
||||
static inline void
|
||||
click_action_query_long_press (ClutterClickAction *action)
|
||||
{
|
||||
ClutterClickActionPrivate *priv =
|
||||
clutter_click_action_get_instance_private (action);
|
||||
ClutterClickActionPrivate *priv = action->priv;
|
||||
ClutterActor *actor;
|
||||
gboolean result = FALSE;
|
||||
gint timeout;
|
||||
@ -242,7 +242,6 @@ click_action_query_long_press (ClutterClickAction *action)
|
||||
|
||||
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,
|
||||
@ -253,8 +252,7 @@ click_action_query_long_press (ClutterClickAction *action)
|
||||
static inline void
|
||||
click_action_cancel_long_press (ClutterClickAction *action)
|
||||
{
|
||||
ClutterClickActionPrivate *priv =
|
||||
clutter_click_action_get_instance_private (action);
|
||||
ClutterClickActionPrivate *priv = action->priv;
|
||||
|
||||
if (priv->long_press_id != 0)
|
||||
{
|
||||
@ -263,7 +261,8 @@ click_action_cancel_long_press (ClutterClickAction *action)
|
||||
|
||||
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
|
||||
|
||||
g_clear_handle_id (&priv->long_press_id, g_source_remove);
|
||||
g_source_remove (priv->long_press_id);
|
||||
priv->long_press_id = 0;
|
||||
|
||||
g_signal_emit (action, click_signals[LONG_PRESS], 0,
|
||||
actor,
|
||||
@ -277,8 +276,7 @@ on_event (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
ClutterClickAction *action)
|
||||
{
|
||||
ClutterClickActionPrivate *priv =
|
||||
clutter_click_action_get_instance_private (action);
|
||||
ClutterClickActionPrivate *priv = action->priv;
|
||||
gboolean has_button = TRUE;
|
||||
|
||||
if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (action)))
|
||||
@ -348,8 +346,7 @@ on_captured_event (ClutterActor *stage,
|
||||
ClutterEvent *event,
|
||||
ClutterClickAction *action)
|
||||
{
|
||||
ClutterClickActionPrivate *priv =
|
||||
clutter_click_action_get_instance_private (action);
|
||||
ClutterClickActionPrivate *priv = action->priv;
|
||||
ClutterActor *actor;
|
||||
ClutterModifierType modifier_state;
|
||||
gboolean has_button = TRUE;
|
||||
@ -378,9 +375,17 @@ on_captured_event (ClutterActor *stage,
|
||||
click_action_cancel_long_press (action);
|
||||
|
||||
/* disconnect the capture */
|
||||
g_clear_signal_handler (&priv->capture_id, priv->stage);
|
||||
if (priv->capture_id != 0)
|
||||
{
|
||||
g_signal_handler_disconnect (priv->stage, priv->capture_id);
|
||||
priv->capture_id = 0;
|
||||
}
|
||||
|
||||
g_clear_handle_id (&priv->long_press_id, g_source_remove);
|
||||
if (priv->long_press_id != 0)
|
||||
{
|
||||
g_source_remove (priv->long_press_id);
|
||||
priv->long_press_id = 0;
|
||||
}
|
||||
|
||||
if (!clutter_actor_contains (actor, clutter_event_get_source (event)))
|
||||
return CLUTTER_EVENT_PROPAGATE;
|
||||
@ -441,15 +446,14 @@ clutter_click_action_set_actor (ClutterActorMeta *meta,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
ClutterClickAction *action = CLUTTER_CLICK_ACTION (meta);
|
||||
ClutterClickActionPrivate *priv =
|
||||
clutter_click_action_get_instance_private (action);
|
||||
ClutterClickActionPrivate *priv = action->priv;
|
||||
|
||||
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);
|
||||
g_signal_handler_disconnect (old_actor, priv->event_id);
|
||||
|
||||
priv->event_id = 0;
|
||||
}
|
||||
@ -457,13 +461,17 @@ clutter_click_action_set_actor (ClutterActorMeta *meta,
|
||||
if (priv->capture_id != 0)
|
||||
{
|
||||
if (priv->stage != NULL)
|
||||
g_clear_signal_handler (&priv->capture_id, priv->stage);
|
||||
g_signal_handler_disconnect (priv->stage, priv->capture_id);
|
||||
|
||||
priv->capture_id = 0;
|
||||
priv->stage = NULL;
|
||||
}
|
||||
|
||||
g_clear_handle_id (&priv->long_press_id, g_source_remove);
|
||||
if (priv->long_press_id != 0)
|
||||
{
|
||||
g_source_remove (priv->long_press_id);
|
||||
priv->long_press_id = 0;
|
||||
}
|
||||
|
||||
click_action_set_pressed (action, FALSE);
|
||||
click_action_set_held (action, FALSE);
|
||||
@ -476,28 +484,13 @@ clutter_click_action_set_actor (ClutterActorMeta *meta,
|
||||
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));
|
||||
ClutterClickActionPrivate *priv = CLUTTER_CLICK_ACTION (gobject)->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
@ -521,8 +514,7 @@ clutter_click_action_get_property (GObject *gobject,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterClickActionPrivate *priv =
|
||||
clutter_click_action_get_instance_private (CLUTTER_CLICK_ACTION (gobject));
|
||||
ClutterClickActionPrivate *priv = CLUTTER_CLICK_ACTION (gobject)->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
@ -551,15 +543,26 @@ clutter_click_action_get_property (GObject *gobject,
|
||||
static void
|
||||
clutter_click_action_dispose (GObject *gobject)
|
||||
{
|
||||
ClutterClickActionPrivate *priv =
|
||||
clutter_click_action_get_instance_private (CLUTTER_CLICK_ACTION (gobject));
|
||||
ClutterClickActionPrivate *priv = CLUTTER_CLICK_ACTION (gobject)->priv;
|
||||
|
||||
g_clear_signal_handler (&priv->event_id,
|
||||
clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (gobject)));
|
||||
if (priv->event_id)
|
||||
{
|
||||
g_signal_handler_disconnect (clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (gobject)),
|
||||
priv->event_id);
|
||||
priv->event_id = 0;
|
||||
}
|
||||
|
||||
g_clear_signal_handler (&priv->capture_id, priv->stage);
|
||||
if (priv->capture_id)
|
||||
{
|
||||
g_signal_handler_disconnect (priv->stage, priv->capture_id);
|
||||
priv->capture_id = 0;
|
||||
}
|
||||
|
||||
g_clear_handle_id (&priv->long_press_id, g_source_remove);
|
||||
if (priv->long_press_id)
|
||||
{
|
||||
g_source_remove (priv->long_press_id);
|
||||
priv->long_press_id = 0;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (clutter_click_action_parent_class)->dispose (gobject);
|
||||
}
|
||||
@ -572,7 +575,6 @@ clutter_click_action_class_init (ClutterClickActionClass *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;
|
||||
@ -710,11 +712,9 @@ clutter_click_action_class_init (ClutterClickActionClass *klass)
|
||||
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;
|
||||
self->priv = clutter_click_action_get_instance_private (self);
|
||||
self->priv->long_press_threshold = -1;
|
||||
self->priv->long_press_duration = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -754,13 +754,17 @@ clutter_click_action_release (ClutterClickAction *action)
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_CLICK_ACTION (action));
|
||||
|
||||
priv = clutter_click_action_get_instance_private (action);
|
||||
priv = action->priv;
|
||||
|
||||
if (!priv->is_held)
|
||||
return;
|
||||
|
||||
/* disconnect the capture */
|
||||
g_clear_signal_handler (&priv->capture_id, priv->stage);
|
||||
if (priv->capture_id != 0)
|
||||
{
|
||||
g_signal_handler_disconnect (priv->stage, priv->capture_id);
|
||||
priv->capture_id = 0;
|
||||
}
|
||||
|
||||
click_action_cancel_long_press (action);
|
||||
click_action_set_held (action, FALSE);
|
||||
@ -780,13 +784,9 @@ clutter_click_action_release (ClutterClickAction *action)
|
||||
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;
|
||||
return action->priv->press_button;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -802,13 +802,9 @@ clutter_click_action_get_button (ClutterClickAction *action)
|
||||
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;
|
||||
return action->priv->modifier_state;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -826,15 +822,11 @@ 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;
|
||||
*press_x = action->priv->press_x;
|
||||
|
||||
if (press_y != NULL)
|
||||
*press_y = priv->press_y;
|
||||
*press_y = action->priv->press_y;
|
||||
}
|
||||
|
@ -37,13 +37,32 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_CLICK_ACTION (clutter_click_action_get_type ())
|
||||
#define CLUTTER_TYPE_CLICK_ACTION (clutter_click_action_get_type ())
|
||||
#define CLUTTER_CLICK_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_CLICK_ACTION, ClutterClickAction))
|
||||
#define CLUTTER_IS_CLICK_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_CLICK_ACTION))
|
||||
#define CLUTTER_CLICK_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_CLICK_ACTION, ClutterClickActionClass))
|
||||
#define CLUTTER_IS_CLICK_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_CLICK_ACTION))
|
||||
#define CLUTTER_CLICK_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_CLICK_ACTION, ClutterClickActionClass))
|
||||
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_DERIVABLE_TYPE (ClutterClickAction, clutter_click_action,
|
||||
CLUTTER, CLICK_ACTION, ClutterAction);
|
||||
typedef struct _ClutterClickAction ClutterClickAction;
|
||||
typedef struct _ClutterClickActionPrivate ClutterClickActionPrivate;
|
||||
typedef struct _ClutterClickActionClass ClutterClickActionClass;
|
||||
|
||||
typedef struct _ClutterClickActionPrivate ClutterClickActionPrivate;
|
||||
/**
|
||||
* ClutterClickAction:
|
||||
*
|
||||
* The #ClutterClickAction structure contains
|
||||
* only private data and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _ClutterClickAction
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterAction parent_instance;
|
||||
|
||||
ClutterClickActionPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterClickActionClass:
|
||||
@ -78,6 +97,9 @@ struct _ClutterClickActionClass
|
||||
void (* _clutter_click_action7) (void);
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_click_action_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterAction * clutter_click_action_new (void);
|
||||
|
||||
|
@ -52,8 +52,6 @@
|
||||
struct _ClutterClonePrivate
|
||||
{
|
||||
ClutterActor *clone_source;
|
||||
float x_scale, y_scale;
|
||||
|
||||
gulong source_destroy_id;
|
||||
};
|
||||
|
||||
@ -124,6 +122,8 @@ static void
|
||||
clutter_clone_apply_transform (ClutterActor *self, CoglMatrix *matrix)
|
||||
{
|
||||
ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv;
|
||||
ClutterActorBox box, source_box;
|
||||
gfloat x_scale, y_scale;
|
||||
|
||||
/* First chain up and apply all the standard ClutterActor
|
||||
* transformations... */
|
||||
@ -134,12 +134,25 @@ clutter_clone_apply_transform (ClutterActor *self, CoglMatrix *matrix)
|
||||
if (priv->clone_source == NULL)
|
||||
return;
|
||||
|
||||
cogl_matrix_scale (matrix, priv->x_scale, priv->y_scale, 1.f);
|
||||
/* get our allocated size */
|
||||
clutter_actor_get_allocation_box (self, &box);
|
||||
|
||||
/* and get the allocated size of the source */
|
||||
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);
|
||||
|
||||
cogl_matrix_scale (matrix, x_scale, y_scale, x_scale);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_clone_paint (ClutterActor *actor,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_clone_paint (ClutterActor *actor)
|
||||
{
|
||||
ClutterClone *self = CLUTTER_CLONE (actor);
|
||||
ClutterClonePrivate *priv = self->priv;
|
||||
@ -176,7 +189,7 @@ clutter_clone_paint (ClutterActor *actor,
|
||||
if (clutter_actor_is_realized (priv->clone_source))
|
||||
{
|
||||
_clutter_actor_push_clone_paint ();
|
||||
clutter_actor_paint (priv->clone_source, paint_context);
|
||||
clutter_actor_paint (priv->clone_source);
|
||||
_clutter_actor_pop_clone_paint ();
|
||||
}
|
||||
|
||||
@ -226,16 +239,15 @@ clutter_clone_has_overlaps (ClutterActor *actor)
|
||||
|
||||
static void
|
||||
clutter_clone_allocate (ClutterActor *self,
|
||||
const ClutterActorBox *box)
|
||||
const ClutterActorBox *box,
|
||||
ClutterAllocationFlags flags)
|
||||
{
|
||||
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);
|
||||
parent_class->allocate (self, box, flags);
|
||||
|
||||
if (priv->clone_source == NULL)
|
||||
return;
|
||||
@ -245,31 +257,7 @@ clutter_clone_allocate (ClutterActor *self,
|
||||
*/
|
||||
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));
|
||||
}
|
||||
clutter_actor_allocate_preferred_size (priv->clone_source, flags);
|
||||
|
||||
#if 0
|
||||
/* XXX - this is wrong: ClutterClone cannot clone unparented
|
||||
@ -284,7 +272,7 @@ clutter_clone_allocate (ClutterActor *self,
|
||||
* 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);
|
||||
clutter_actor_allocate_preferred_size (priv->clone_source, flags);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -376,9 +364,6 @@ 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;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -415,7 +400,8 @@ clutter_clone_set_source_internal (ClutterClone *self,
|
||||
|
||||
if (priv->clone_source != NULL)
|
||||
{
|
||||
g_clear_signal_handler (&priv->source_destroy_id, priv->clone_source);
|
||||
g_signal_handler_disconnect (priv->clone_source, priv->source_destroy_id);
|
||||
priv->source_destroy_id = 0;
|
||||
_clutter_actor_detach_clone (priv->clone_source, CLUTTER_ACTOR (self));
|
||||
g_object_unref (priv->clone_source);
|
||||
priv->clone_source = NULL;
|
||||
|
@ -105,8 +105,7 @@ G_DEFINE_TYPE (ClutterColorizeEffect,
|
||||
CLUTTER_TYPE_OFFSCREEN_EFFECT);
|
||||
|
||||
static gboolean
|
||||
clutter_colorize_effect_pre_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_colorize_effect_pre_paint (ClutterEffect *effect)
|
||||
{
|
||||
ClutterColorizeEffect *self = CLUTTER_COLORIZE_EFFECT (effect);
|
||||
ClutterEffectClass *parent_class;
|
||||
@ -127,7 +126,7 @@ clutter_colorize_effect_pre_paint (ClutterEffect *effect,
|
||||
}
|
||||
|
||||
parent_class = CLUTTER_EFFECT_CLASS (clutter_colorize_effect_parent_class);
|
||||
if (parent_class->pre_paint (effect, paint_context))
|
||||
if (parent_class->pre_paint (effect))
|
||||
{
|
||||
ClutterOffscreenEffect *offscreen_effect =
|
||||
CLUTTER_OFFSCREEN_EFFECT (effect);
|
||||
@ -146,12 +145,10 @@ clutter_colorize_effect_pre_paint (ClutterEffect *effect,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_colorize_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_colorize_effect_paint_target (ClutterOffscreenEffect *effect)
|
||||
{
|
||||
ClutterColorizeEffect *self = CLUTTER_COLORIZE_EFFECT (effect);
|
||||
CoglFramebuffer *framebuffer =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
|
||||
ClutterActor *actor;
|
||||
guint8 paint_opacity;
|
||||
|
||||
|
@ -9,13 +9,7 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#mesondefine CLUTTER_HAS_WAYLAND_COMPOSITOR_SUPPORT
|
||||
#mesondefine CLUTTER_WINDOWING_X11
|
||||
#mesondefine CLUTTER_INPUT_X11
|
||||
#mesondefine CLUTTER_WINDOWING_GLX
|
||||
#mesondefine CLUTTER_WINDOWING_EGL
|
||||
#mesondefine CLUTTER_INPUT_EVDEV
|
||||
#mesondefine CLUTTER_INPUT_NULL
|
||||
@CLUTTER_CONFIG_DEFINES@
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -30,6 +30,13 @@ gboolean clutter_constraint_update_allocation (ClutterConstraint *constraint,
|
||||
ClutterActor *actor,
|
||||
ClutterActorBox *allocation);
|
||||
|
||||
void clutter_constraint_update_preferred_size (ClutterConstraint *constraint,
|
||||
ClutterActor *actor,
|
||||
ClutterOrientation direction,
|
||||
float for_size,
|
||||
float *minimum_size,
|
||||
float *natural_size);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_CONSTRAINT_PRIVATE_H__ */
|
||||
|
@ -48,7 +48,7 @@
|
||||
* Constraints provide a way to build user interfaces by using
|
||||
* relations between #ClutterActors, without explicit fixed
|
||||
* positioning and sizing, similarly to how fluid layout managers like
|
||||
* #ClutterBoxLayout lay out their children.
|
||||
* #ClutterBoxLayout and #ClutterTableLayout lay out their children.
|
||||
*
|
||||
* Constraints are attached to a #ClutterActor, and are available
|
||||
* for inspection using clutter_actor_get_constraints().
|
||||
@ -160,26 +160,28 @@ constraint_update_preferred_size (ClutterConstraint *constraint,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_constraint_set_enabled (ClutterActorMeta *meta,
|
||||
gboolean is_enabled)
|
||||
clutter_constraint_notify (GObject *gobject,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterActorMetaClass *parent_class =
|
||||
CLUTTER_ACTOR_META_CLASS (clutter_constraint_parent_class);
|
||||
ClutterActor *actor;
|
||||
if (strcmp (pspec->name, "enabled") == 0)
|
||||
{
|
||||
ClutterActorMeta *meta = CLUTTER_ACTOR_META (gobject);
|
||||
ClutterActor *actor = clutter_actor_meta_get_actor (meta);
|
||||
|
||||
actor = clutter_actor_meta_get_actor (meta);
|
||||
if (actor)
|
||||
clutter_actor_queue_relayout (actor);
|
||||
if (actor != NULL)
|
||||
clutter_actor_queue_relayout (actor);
|
||||
}
|
||||
|
||||
parent_class->set_enabled (meta, is_enabled);
|
||||
if (G_OBJECT_CLASS (clutter_constraint_parent_class)->notify != NULL)
|
||||
G_OBJECT_CLASS (clutter_constraint_parent_class)->notify (gobject, pspec);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_constraint_class_init (ClutterConstraintClass *klass)
|
||||
{
|
||||
ClutterActorMetaClass *actor_meta_class = CLUTTER_ACTOR_META_CLASS (klass);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
actor_meta_class->set_enabled = clutter_constraint_set_enabled;
|
||||
gobject_class->notify = clutter_constraint_notify;
|
||||
|
||||
klass->update_allocation = constraint_update_allocation;
|
||||
klass->update_preferred_size = constraint_update_preferred_size;
|
||||
@ -220,17 +222,6 @@ clutter_constraint_update_allocation (ClutterConstraint *constraint,
|
||||
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,
|
||||
|
@ -99,14 +99,6 @@ struct _ClutterConstraintClass
|
||||
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,
|
||||
|
@ -37,7 +37,6 @@
|
||||
|
||||
#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"
|
||||
@ -119,6 +118,37 @@ container_real_remove (ClutterContainer *container,
|
||||
clutter_actor_remove_child (CLUTTER_ACTOR (container), actor);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
ClutterCallback callback;
|
||||
gpointer data;
|
||||
} ForeachClosure;
|
||||
|
||||
static gboolean
|
||||
foreach_cb (ClutterActor *actor,
|
||||
gpointer data)
|
||||
{
|
||||
ForeachClosure *clos = data;
|
||||
|
||||
clos->callback (actor, clos->data);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
container_real_foreach (ClutterContainer *container,
|
||||
ClutterCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
ForeachClosure clos;
|
||||
|
||||
clos.callback = callback;
|
||||
clos.data = user_data;
|
||||
|
||||
_clutter_actor_foreach_child (CLUTTER_ACTOR (container),
|
||||
foreach_cb,
|
||||
&clos);
|
||||
}
|
||||
|
||||
static void
|
||||
container_real_raise (ClutterContainer *container,
|
||||
ClutterActor *child,
|
||||
@ -213,6 +243,7 @@ clutter_container_default_init (ClutterContainerInterface *iface)
|
||||
|
||||
iface->add = container_real_add;
|
||||
iface->remove = container_real_remove;
|
||||
iface->foreach = container_real_foreach;
|
||||
iface->raise = container_real_raise;
|
||||
iface->lower = container_real_lower;
|
||||
iface->sort_depth_order = container_real_sort_depth_order;
|
||||
@ -385,6 +416,33 @@ clutter_container_add_actor (ClutterContainer *container,
|
||||
container_add_actor (container, actor);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_container_add_valist: (skip)
|
||||
* @container: a #ClutterContainer
|
||||
* @first_actor: the first #ClutterActor to add
|
||||
* @var_args: list of actors to add, followed by %NULL
|
||||
*
|
||||
* Alternative va_list version of clutter_container_add().
|
||||
*
|
||||
* This function will call #ClutterContainerIface.add(), which is a
|
||||
* deprecated virtual function. The default implementation will
|
||||
* call clutter_actor_add_child().
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.10: Use clutter_actor_add_child() instead.
|
||||
*/
|
||||
void
|
||||
clutter_container_add_valist (ClutterContainer *container,
|
||||
ClutterActor *first_actor,
|
||||
va_list var_args)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (first_actor));
|
||||
|
||||
container_add_valist (container, first_actor, var_args);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_container_remove: (skip)
|
||||
* @container: a #ClutterContainer
|
||||
@ -448,6 +506,42 @@ clutter_container_remove_actor (ClutterContainer *container,
|
||||
container_remove_actor (container, actor);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_container_remove_valist: (skip)
|
||||
* @container: a #ClutterContainer
|
||||
* @first_actor: the first #ClutterActor to add
|
||||
* @var_args: list of actors to remove, followed by %NULL
|
||||
*
|
||||
* Alternative va_list version of clutter_container_remove().
|
||||
*
|
||||
* This function will call #ClutterContainerIface.remove(), which is a
|
||||
* deprecated virtual function. The default implementation will call
|
||||
* clutter_actor_remove_child().
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.10: Use clutter_actor_remove_child() instead.
|
||||
*/
|
||||
void
|
||||
clutter_container_remove_valist (ClutterContainer *container,
|
||||
ClutterActor *first_actor,
|
||||
va_list var_args)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (first_actor));
|
||||
|
||||
container_remove_valist (container, first_actor, var_args);
|
||||
}
|
||||
|
||||
static void
|
||||
get_children_cb (ClutterActor *child,
|
||||
gpointer data)
|
||||
{
|
||||
GList **children = data;
|
||||
|
||||
*children = g_list_prepend (*children, child);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_container_get_children:
|
||||
* @container: a #ClutterContainer
|
||||
@ -465,9 +559,108 @@ clutter_container_remove_actor (ClutterContainer *container,
|
||||
GList *
|
||||
clutter_container_get_children (ClutterContainer *container)
|
||||
{
|
||||
GList *retval;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_CONTAINER (container), NULL);
|
||||
|
||||
return clutter_actor_get_children (CLUTTER_ACTOR (container));
|
||||
retval = NULL;
|
||||
clutter_container_foreach (container, get_children_cb, &retval);
|
||||
|
||||
return g_list_reverse (retval);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_container_foreach:
|
||||
* @container: a #ClutterContainer
|
||||
* @callback: (scope call): a function to be called for each child
|
||||
* @user_data: data to be passed to the function, or %NULL
|
||||
*
|
||||
* Calls @callback for each child of @container that was added
|
||||
* by the application (with clutter_container_add_actor()). Does
|
||||
* not iterate over "internal" children that are part of the
|
||||
* container's own implementation, if any.
|
||||
*
|
||||
* This function calls the #ClutterContainerIface.foreach()
|
||||
* virtual function, which has been deprecated.
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.10: Use clutter_actor_get_first_child() or
|
||||
* clutter_actor_get_last_child() to retrieve the beginning of
|
||||
* the list of children, and clutter_actor_get_next_sibling()
|
||||
* and clutter_actor_get_previous_sibling() to iterate over it;
|
||||
* alternatively, use the #ClutterActorIter API.
|
||||
*/
|
||||
void
|
||||
clutter_container_foreach (ClutterContainer *container,
|
||||
ClutterCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
#ifdef CLUTTER_ENABLE_DEBUG
|
||||
if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
|
||||
{
|
||||
ClutterContainerIface *iface = CLUTTER_CONTAINER_GET_IFACE (container);
|
||||
|
||||
if (iface->foreach != container_real_foreach)
|
||||
_clutter_diagnostic_message ("The ClutterContainer::foreach() "
|
||||
"virtual function has been deprecated "
|
||||
"and it should not be overridden by "
|
||||
"newly written code");
|
||||
}
|
||||
#endif /* CLUTTER_ENABLE_DEBUG */
|
||||
|
||||
CLUTTER_CONTAINER_GET_IFACE (container)->foreach (container,
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_container_foreach_with_internals:
|
||||
* @container: a #ClutterContainer
|
||||
* @callback: (scope call): a function to be called for each child
|
||||
* @user_data: data to be passed to the function, or %NULL
|
||||
*
|
||||
* Calls @callback for each child of @container, including "internal"
|
||||
* children built in to the container itself that were never added
|
||||
* by the application.
|
||||
*
|
||||
* This function calls the #ClutterContainerIface.foreach_with_internals()
|
||||
* virtual function, which has been deprecated.
|
||||
*
|
||||
* Since: 1.0
|
||||
*
|
||||
* Deprecated: 1.10: See clutter_container_foreach().
|
||||
*/
|
||||
void
|
||||
clutter_container_foreach_with_internals (ClutterContainer *container,
|
||||
ClutterCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
ClutterContainerIface *iface;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
iface = CLUTTER_CONTAINER_GET_IFACE (container);
|
||||
|
||||
#ifdef CLUTTER_ENABLE_DEBUG
|
||||
if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
|
||||
{
|
||||
if (iface->foreach_with_internals != NULL)
|
||||
_clutter_diagnostic_message ("The ClutterContainer::foreach_with_internals() "
|
||||
"virtual function has been deprecated "
|
||||
"and it should not be overridden by "
|
||||
"newly written code");
|
||||
}
|
||||
#endif /* CLUTTER_ENABLE_DEBUG */
|
||||
|
||||
if (iface->foreach_with_internals != NULL)
|
||||
iface->foreach_with_internals (container, callback, user_data);
|
||||
else
|
||||
iface->foreach (container, callback, user_data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1251,23 +1444,3 @@ clutter_container_child_notify (ClutterContainer *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);
|
||||
}
|
||||
|
@ -59,6 +59,14 @@ typedef struct _ClutterContainerIface ClutterContainerIface;
|
||||
* function is deprecated, and it should not be overridden.
|
||||
* @remove: virtual function for removing an actor from the container. This
|
||||
* virtual function is deprecated, and it should not be overridden.
|
||||
* @foreach: virtual function for iterating over the container's children.
|
||||
* This virtual function is deprecated, and it should not be overridden.
|
||||
* @foreach_with_internals: virtual functions for iterating over the
|
||||
* container's children, both added using the #ClutterContainer API
|
||||
* and internal children. The implementation of this virtual function
|
||||
* is required only if the #ClutterContainer implementation has
|
||||
* internal children. This virtual function is deprecated, and it should
|
||||
* not be overridden.
|
||||
* @raise: virtual function for raising a child. This virtual function is
|
||||
* deprecated and it should not be overridden.
|
||||
* @lower: virtual function for lowering a child. This virtual function is
|
||||
@ -80,7 +88,7 @@ typedef struct _ClutterContainerIface ClutterContainerIface;
|
||||
* @actor_removed: class handler for #ClutterContainer::actor-removed
|
||||
* @child_notify: class handler for #ClutterContainer::child-notify
|
||||
*
|
||||
* Base interface for container actors. The @add and @remove
|
||||
* Base interface for container actors. The @add, @remove and @foreach
|
||||
* virtual functions must be provided by any implementation; the other
|
||||
* virtual functions are optional.
|
||||
*
|
||||
@ -96,6 +104,13 @@ struct _ClutterContainerIface
|
||||
ClutterActor *actor);
|
||||
void (* remove) (ClutterContainer *container,
|
||||
ClutterActor *actor);
|
||||
void (* foreach) (ClutterContainer *container,
|
||||
ClutterCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
void (* foreach_with_internals) (ClutterContainer *container,
|
||||
ClutterCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
/* child stacking */
|
||||
void (* raise) (ClutterContainer *container,
|
||||
|
@ -34,10 +34,9 @@ void _clutter_content_attached (ClutterContent *conte
|
||||
void _clutter_content_detached (ClutterContent *content,
|
||||
ClutterActor *actor);
|
||||
|
||||
void _clutter_content_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context);
|
||||
void _clutter_content_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *node);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -96,10 +96,9 @@ clutter_content_real_invalidate_size (ClutterContent *content)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_content_real_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *context,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_content_real_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *context)
|
||||
{
|
||||
}
|
||||
|
||||
@ -301,8 +300,7 @@ _clutter_content_detached (ClutterContent *content,
|
||||
* _clutter_content_paint_content:
|
||||
* @content: a #ClutterContent
|
||||
* @actor: a #ClutterActor
|
||||
* @node: a #ClutterPaintNode
|
||||
* @paint_context: a #ClutterPaintContext
|
||||
* @context: a #ClutterPaintNode
|
||||
*
|
||||
* Creates the render tree for the @content and @actor.
|
||||
*
|
||||
@ -310,13 +308,11 @@ _clutter_content_detached (ClutterContent *content,
|
||||
* virtual function.
|
||||
*/
|
||||
void
|
||||
_clutter_content_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
_clutter_content_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *node)
|
||||
{
|
||||
CLUTTER_CONTENT_GET_IFACE (content)->paint_content (content, actor, node,
|
||||
paint_context);
|
||||
CLUTTER_CONTENT_GET_IFACE (content)->paint_content (content, actor, node);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -65,10 +65,9 @@ struct _ClutterContentInterface
|
||||
gboolean (* get_preferred_size) (ClutterContent *content,
|
||||
gfloat *width,
|
||||
gfloat *height);
|
||||
void (* paint_content) (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context);
|
||||
void (* paint_content) (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *node);
|
||||
|
||||
void (* attached) (ClutterContent *content,
|
||||
ClutterActor *actor);
|
||||
|
@ -1,92 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2007,2008,2009,2010,2011 Intel Corporation.
|
||||
* Copyright (C) 2020 Red Hat Inc
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter-damage-history.h"
|
||||
|
||||
#define DAMAGE_HISTORY_LENGTH 0x10
|
||||
|
||||
struct _ClutterDamageHistory
|
||||
{
|
||||
cairo_region_t *damages[DAMAGE_HISTORY_LENGTH];
|
||||
int index;
|
||||
};
|
||||
|
||||
ClutterDamageHistory *
|
||||
clutter_damage_history_new (void)
|
||||
{
|
||||
ClutterDamageHistory *history;
|
||||
|
||||
history = g_new0 (ClutterDamageHistory, 1);
|
||||
|
||||
return history;
|
||||
}
|
||||
|
||||
void
|
||||
clutter_damage_history_free (ClutterDamageHistory *history)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (history->damages); i++)
|
||||
g_clear_pointer (&history->damages[i], cairo_region_destroy);
|
||||
|
||||
g_free (history);
|
||||
}
|
||||
|
||||
gboolean
|
||||
clutter_damage_history_is_age_valid (ClutterDamageHistory *history,
|
||||
int age)
|
||||
{
|
||||
if (age >= DAMAGE_HISTORY_LENGTH ||
|
||||
age < 1)
|
||||
return FALSE;
|
||||
|
||||
if (!clutter_damage_history_lookup (history, age))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
clutter_damage_history_record (ClutterDamageHistory *history,
|
||||
const cairo_region_t *damage)
|
||||
{
|
||||
g_clear_pointer (&history->damages[history->index], cairo_region_destroy);
|
||||
history->damages[history->index] = cairo_region_copy (damage);
|
||||
}
|
||||
|
||||
static inline int
|
||||
step_damage_index (int current,
|
||||
int diff)
|
||||
{
|
||||
return (current + diff) & (DAMAGE_HISTORY_LENGTH - 1);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_damage_history_step (ClutterDamageHistory *history)
|
||||
{
|
||||
history->index = step_damage_index (history->index, 1);
|
||||
}
|
||||
|
||||
const cairo_region_t *
|
||||
clutter_damage_history_lookup (ClutterDamageHistory *history,
|
||||
int age)
|
||||
{
|
||||
return history->damages[step_damage_index (history->index, -age)];
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2007,2008,2009,2010,2011 Intel Corporation.
|
||||
* Copyright (C) 2020 Red Hat Inc
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CLUTTER_DAMAGE_HISTORY_H
|
||||
#define CLUTTER_DAMAGE_HISTORY_H
|
||||
|
||||
#include <cairo.h>
|
||||
#include <glib.h>
|
||||
|
||||
typedef struct _ClutterDamageHistory ClutterDamageHistory;
|
||||
|
||||
ClutterDamageHistory * clutter_damage_history_new (void);
|
||||
|
||||
void clutter_damage_history_free (ClutterDamageHistory *history);
|
||||
|
||||
gboolean clutter_damage_history_is_age_valid (ClutterDamageHistory *history,
|
||||
int age);
|
||||
|
||||
void clutter_damage_history_record (ClutterDamageHistory *history,
|
||||
const cairo_region_t *damage);
|
||||
|
||||
void clutter_damage_history_step (ClutterDamageHistory *history);
|
||||
|
||||
const cairo_region_t * clutter_damage_history_lookup (ClutterDamageHistory *history,
|
||||
int age);
|
||||
|
||||
#endif /* CLUTTER_DAMAGE_HISTORY_H */
|
@ -6,6 +6,45 @@
|
||||
|
||||
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
|
||||
} 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,
|
||||
} ClutterDrawDebugFlag;
|
||||
|
||||
#ifdef CLUTTER_ENABLE_DEBUG
|
||||
|
||||
#define CLUTTER_HAS_DEBUG(type) ((clutter_debug_flags & CLUTTER_DEBUG_##type) != FALSE)
|
||||
|
@ -128,9 +128,10 @@ clutter_deform_effect_deform_vertex (ClutterDeformEffect *effect,
|
||||
}
|
||||
|
||||
static void
|
||||
vbo_invalidate (ClutterActor *actor,
|
||||
GParamSpec *pspec,
|
||||
ClutterDeformEffect *effect)
|
||||
vbo_invalidate (ClutterActor *actor,
|
||||
const ClutterActorBox *allocation,
|
||||
ClutterAllocationFlags flags,
|
||||
ClutterDeformEffect *effect)
|
||||
{
|
||||
effect->priv->is_dirty = TRUE;
|
||||
}
|
||||
@ -146,7 +147,7 @@ clutter_deform_effect_set_actor (ClutterActorMeta *meta,
|
||||
ClutterActor *old_actor = clutter_actor_meta_get_actor (meta);
|
||||
|
||||
if (old_actor != NULL)
|
||||
g_clear_signal_handler (&priv->allocation_id, old_actor);
|
||||
g_signal_handler_disconnect (old_actor, priv->allocation_id);
|
||||
|
||||
priv->allocation_id = 0;
|
||||
}
|
||||
@ -155,7 +156,7 @@ clutter_deform_effect_set_actor (ClutterActorMeta *meta,
|
||||
* changes
|
||||
*/
|
||||
if (actor != NULL)
|
||||
priv->allocation_id = g_signal_connect (actor, "notify::allocation",
|
||||
priv->allocation_id = g_signal_connect (actor, "allocation-changed",
|
||||
G_CALLBACK (vbo_invalidate),
|
||||
meta);
|
||||
|
||||
@ -165,20 +166,18 @@ clutter_deform_effect_set_actor (ClutterActorMeta *meta,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect)
|
||||
{
|
||||
ClutterDeformEffect *self= CLUTTER_DEFORM_EFFECT (effect);
|
||||
ClutterDeformEffectPrivate *priv = self->priv;
|
||||
CoglHandle material;
|
||||
CoglPipeline *pipeline;
|
||||
CoglDepthState depth_state;
|
||||
CoglFramebuffer *fb =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
|
||||
|
||||
if (priv->is_dirty)
|
||||
{
|
||||
graphene_rect_t rect;
|
||||
ClutterRect rect;
|
||||
gboolean mapped_buffer;
|
||||
CoglVertexP3T2C4 *verts;
|
||||
ClutterActor *actor;
|
||||
@ -194,8 +193,8 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
*/
|
||||
if (clutter_offscreen_effect_get_target_rect (effect, &rect))
|
||||
{
|
||||
width = graphene_rect_get_width (&rect);
|
||||
height = graphene_rect_get_height (&rect);
|
||||
width = clutter_rect_get_width (&rect);
|
||||
height = clutter_rect_get_height (&rect);
|
||||
}
|
||||
else
|
||||
clutter_actor_get_size (actor, &width, &height);
|
||||
|
@ -3,7 +3,27 @@
|
||||
|
||||
#define __CLUTTER_DEPRECATED_H_INSIDE__
|
||||
|
||||
#include "deprecated/clutter-actor.h"
|
||||
#include "deprecated/clutter-alpha.h"
|
||||
#include "deprecated/clutter-animatable.h"
|
||||
#include "deprecated/clutter-animation.h"
|
||||
#include "deprecated/clutter-behaviour.h"
|
||||
#include "deprecated/clutter-behaviour-depth.h"
|
||||
#include "deprecated/clutter-behaviour-opacity.h"
|
||||
#include "deprecated/clutter-behaviour-scale.h"
|
||||
#include "deprecated/clutter-bin-layout.h"
|
||||
#include "deprecated/clutter-box.h"
|
||||
#include "deprecated/clutter-cairo-texture.h"
|
||||
#include "deprecated/clutter-container.h"
|
||||
#include "deprecated/clutter-group.h"
|
||||
#include "deprecated/clutter-keysyms.h"
|
||||
#include "deprecated/clutter-rectangle.h"
|
||||
#include "deprecated/clutter-stage-manager.h"
|
||||
#include "deprecated/clutter-stage.h"
|
||||
#include "deprecated/clutter-state.h"
|
||||
#include "deprecated/clutter-table-layout.h"
|
||||
#include "deprecated/clutter-texture.h"
|
||||
#include "deprecated/clutter-timeline.h"
|
||||
|
||||
#undef __CLUTTER_DEPRECATED_H_INSIDE__
|
||||
|
||||
|
@ -112,8 +112,7 @@ G_DEFINE_TYPE (ClutterDesaturateEffect,
|
||||
CLUTTER_TYPE_OFFSCREEN_EFFECT);
|
||||
|
||||
static gboolean
|
||||
clutter_desaturate_effect_pre_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_desaturate_effect_pre_paint (ClutterEffect *effect)
|
||||
{
|
||||
ClutterDesaturateEffect *self = CLUTTER_DESATURATE_EFFECT (effect);
|
||||
ClutterEffectClass *parent_class;
|
||||
@ -134,7 +133,7 @@ clutter_desaturate_effect_pre_paint (ClutterEffect *effect,
|
||||
}
|
||||
|
||||
parent_class = CLUTTER_EFFECT_CLASS (clutter_desaturate_effect_parent_class);
|
||||
if (parent_class->pre_paint (effect, paint_context))
|
||||
if (parent_class->pre_paint (effect))
|
||||
{
|
||||
ClutterOffscreenEffect *offscreen_effect =
|
||||
CLUTTER_OFFSCREEN_EFFECT (effect);
|
||||
@ -153,12 +152,10 @@ clutter_desaturate_effect_pre_paint (ClutterEffect *effect,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_desaturate_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_desaturate_effect_paint_target (ClutterOffscreenEffect *effect)
|
||||
{
|
||||
ClutterDesaturateEffect *self = CLUTTER_DESATURATE_EFFECT (effect);
|
||||
CoglFramebuffer *framebuffer =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
|
||||
ClutterActor *actor;
|
||||
CoglHandle texture;
|
||||
guint8 paint_opacity;
|
||||
|
304
clutter/clutter/clutter-device-manager-private.h
Normal file
304
clutter/clutter/clutter-device-manager-private.h
Normal file
@ -0,0 +1,304 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright (C) 2010 Intel Corporation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author:
|
||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
#ifndef __CLUTTER_DEVICE_MANAGER_PRIVATE_H__
|
||||
#define __CLUTTER_DEVICE_MANAGER_PRIVATE_H__
|
||||
|
||||
#include <clutter/clutter-backend.h>
|
||||
#include <clutter/clutter-device-manager.h>
|
||||
#include <clutter/clutter-event.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _ClutterAxisInfo
|
||||
{
|
||||
ClutterInputAxis axis;
|
||||
|
||||
gdouble min_axis;
|
||||
gdouble max_axis;
|
||||
|
||||
gdouble min_value;
|
||||
gdouble max_value;
|
||||
|
||||
gdouble resolution;
|
||||
} ClutterAxisInfo;
|
||||
|
||||
typedef struct _ClutterKeyInfo
|
||||
{
|
||||
guint keyval;
|
||||
ClutterModifierType modifiers;
|
||||
} ClutterKeyInfo;
|
||||
|
||||
typedef struct _ClutterScrollInfo
|
||||
{
|
||||
guint axis_id;
|
||||
ClutterScrollDirection direction;
|
||||
gdouble increment;
|
||||
|
||||
gdouble last_value;
|
||||
guint last_value_valid : 1;
|
||||
} ClutterScrollInfo;
|
||||
|
||||
typedef struct _ClutterTouchInfo
|
||||
{
|
||||
ClutterEventSequence *sequence;
|
||||
ClutterActor *actor;
|
||||
|
||||
gfloat current_x;
|
||||
gfloat current_y;
|
||||
} ClutterTouchInfo;
|
||||
|
||||
typedef struct _ClutterPtrA11yData
|
||||
{
|
||||
int n_btn_pressed;
|
||||
float current_x;
|
||||
float current_y;
|
||||
|
||||
float dwell_x;
|
||||
float dwell_y;
|
||||
gboolean dwell_drag_started;
|
||||
gboolean dwell_gesture_started;
|
||||
guint dwell_timer;
|
||||
guint dwell_position_timer;
|
||||
|
||||
guint secondary_click_timer;
|
||||
gboolean secondary_click_triggered;
|
||||
} ClutterPtrA11yData;
|
||||
|
||||
struct _ClutterInputDevice
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
gint id;
|
||||
|
||||
ClutterInputDeviceType device_type;
|
||||
ClutterInputMode device_mode;
|
||||
|
||||
gchar *device_name;
|
||||
|
||||
ClutterDeviceManager *device_manager;
|
||||
|
||||
ClutterBackend *backend;
|
||||
|
||||
/* the associated device */
|
||||
ClutterInputDevice *associated;
|
||||
|
||||
GList *slaves;
|
||||
|
||||
/* the actor underneath the pointer */
|
||||
ClutterActor *cursor_actor;
|
||||
GHashTable *inv_touch_sequence_actors;
|
||||
|
||||
/* the actor that has a grab in place for the device */
|
||||
ClutterActor *pointer_grab_actor;
|
||||
ClutterActor *keyboard_grab_actor;
|
||||
GHashTable *sequence_grab_actors;
|
||||
GHashTable *inv_sequence_grab_actors;
|
||||
|
||||
/* the current click count */
|
||||
gint click_count;
|
||||
|
||||
/* the stage the device is on */
|
||||
ClutterStage *stage;
|
||||
|
||||
/* the current state */
|
||||
gfloat current_x;
|
||||
gfloat current_y;
|
||||
guint32 current_time;
|
||||
gint current_button_number;
|
||||
ClutterModifierType current_state;
|
||||
|
||||
/* the current touch points states */
|
||||
GHashTable *touch_sequences_info;
|
||||
|
||||
/* the previous state, used for click count generation */
|
||||
gint previous_x;
|
||||
gint previous_y;
|
||||
guint32 previous_time;
|
||||
gint previous_button_number;
|
||||
ClutterModifierType previous_state;
|
||||
|
||||
GArray *axes;
|
||||
|
||||
guint n_keys;
|
||||
GArray *keys;
|
||||
|
||||
GArray *scroll_info;
|
||||
|
||||
gchar *vendor_id;
|
||||
gchar *product_id;
|
||||
gchar *node_path;
|
||||
|
||||
GPtrArray *tools;
|
||||
|
||||
gint n_rings;
|
||||
gint n_strips;
|
||||
gint n_mode_groups;
|
||||
|
||||
ClutterInputDeviceMapping mapping_mode;
|
||||
|
||||
guint has_cursor : 1;
|
||||
guint is_enabled : 1;
|
||||
|
||||
/* Accessiblity */
|
||||
ClutterVirtualInputDevice *accessibility_virtual_device;
|
||||
ClutterPtrA11yData *ptr_a11y_data;
|
||||
};
|
||||
|
||||
typedef void (*ClutterEmitInputDeviceEvent) (ClutterEvent *event,
|
||||
ClutterInputDevice *device);
|
||||
|
||||
struct _ClutterInputDeviceClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
gboolean (* keycode_to_evdev) (ClutterInputDevice *device,
|
||||
guint hardware_keycode,
|
||||
guint *evdev_keycode);
|
||||
void (* update_from_tool) (ClutterInputDevice *device,
|
||||
ClutterInputDeviceTool *tool);
|
||||
|
||||
gboolean (* is_mode_switch_button) (ClutterInputDevice *device,
|
||||
guint group,
|
||||
guint button);
|
||||
gint (* get_group_n_modes) (ClutterInputDevice *device,
|
||||
gint group);
|
||||
|
||||
gboolean (* is_grouped) (ClutterInputDevice *device,
|
||||
ClutterInputDevice *other_device);
|
||||
|
||||
/* Keyboard accessbility */
|
||||
void (* process_kbd_a11y_event) (ClutterEvent *event,
|
||||
ClutterInputDevice *device,
|
||||
ClutterEmitInputDeviceEvent emit_event_func);
|
||||
};
|
||||
|
||||
/* device manager */
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_device_manager_add_device (ClutterDeviceManager *device_manager,
|
||||
ClutterInputDevice *device);
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_device_manager_remove_device (ClutterDeviceManager *device_manager,
|
||||
ClutterInputDevice *device);
|
||||
void _clutter_device_manager_update_devices (ClutterDeviceManager *device_manager);
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_device_manager_select_stage_events (ClutterDeviceManager *device_manager,
|
||||
ClutterStage *stage);
|
||||
ClutterBackend *_clutter_device_manager_get_backend (ClutterDeviceManager *device_manager);
|
||||
|
||||
void _clutter_device_manager_compress_motion (ClutterDeviceManager *device_manger,
|
||||
ClutterEvent *event,
|
||||
const ClutterEvent *to_discard);
|
||||
|
||||
/* input device */
|
||||
CLUTTER_EXPORT
|
||||
gboolean _clutter_input_device_has_sequence (ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence);
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_input_device_add_event_sequence (ClutterInputDevice *device,
|
||||
ClutterEvent *event);
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_input_device_remove_event_sequence (ClutterInputDevice *device,
|
||||
ClutterEvent *event);
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_input_device_set_coords (ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
gfloat x,
|
||||
gfloat y,
|
||||
ClutterStage *stage);
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_input_device_set_state (ClutterInputDevice *device,
|
||||
ClutterModifierType state);
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_input_device_set_time (ClutterInputDevice *device,
|
||||
guint32 time_);
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_input_device_set_stage (ClutterInputDevice *device,
|
||||
ClutterStage *stage);
|
||||
CLUTTER_EXPORT
|
||||
ClutterStage * _clutter_input_device_get_stage (ClutterInputDevice *device);
|
||||
void _clutter_input_device_set_actor (ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
ClutterActor *actor,
|
||||
gboolean emit_crossing);
|
||||
ClutterActor * _clutter_input_device_update (ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
gboolean emit_crossing);
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_input_device_set_n_keys (ClutterInputDevice *device,
|
||||
guint n_keys);
|
||||
CLUTTER_EXPORT
|
||||
guint _clutter_input_device_add_axis (ClutterInputDevice *device,
|
||||
ClutterInputAxis axis,
|
||||
gdouble min_value,
|
||||
gdouble max_value,
|
||||
gdouble resolution);
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_input_device_reset_axes (ClutterInputDevice *device);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_input_device_set_associated_device (ClutterInputDevice *device,
|
||||
ClutterInputDevice *associated);
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_input_device_add_slave (ClutterInputDevice *master,
|
||||
ClutterInputDevice *slave);
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_input_device_remove_slave (ClutterInputDevice *master,
|
||||
ClutterInputDevice *slave);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
gboolean _clutter_input_device_translate_axis (ClutterInputDevice *device,
|
||||
guint index_,
|
||||
gdouble value,
|
||||
gdouble *axis_value);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_input_device_add_scroll_info (ClutterInputDevice *device,
|
||||
guint index_,
|
||||
ClutterScrollDirection direction,
|
||||
gdouble increment);
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_input_device_reset_scroll_info (ClutterInputDevice *device);
|
||||
CLUTTER_EXPORT
|
||||
gboolean _clutter_input_device_get_scroll_delta (ClutterInputDevice *device,
|
||||
guint index_,
|
||||
gdouble value,
|
||||
ClutterScrollDirection *direction_p,
|
||||
gdouble *delta_p);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterInputDeviceTool * clutter_input_device_lookup_tool (ClutterInputDevice *device,
|
||||
guint64 serial,
|
||||
ClutterInputDeviceToolType type);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_input_device_add_tool (ClutterInputDevice *device,
|
||||
ClutterInputDeviceTool *tool);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_input_device_update_from_tool (ClutterInputDevice *device,
|
||||
ClutterInputDeviceTool *tool);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_DEVICE_MANAGER_PRIVATE_H__ */
|
739
clutter/clutter/clutter-device-manager.c
Normal file
739
clutter/clutter/clutter-device-manager.c
Normal file
@ -0,0 +1,739 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright (C) 2009 Intel Corp.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author: Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:clutter-device-manager
|
||||
* @short_description: Maintains the list of input devices
|
||||
*
|
||||
* #ClutterDeviceManager is a singleton object, owned by Clutter, which
|
||||
* maintains the list of #ClutterInputDevice<!-- -->s.
|
||||
*
|
||||
* Depending on the backend used by Clutter it is possible to use the
|
||||
* #ClutterDeviceManager::device-added and
|
||||
* #ClutterDeviceManager::device-removed to monitor addition and removal
|
||||
* of devices.
|
||||
*
|
||||
* #ClutterDeviceManager is available since Clutter 1.2
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter-backend-private.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-device-manager-private.h"
|
||||
#include "clutter-enum-types.h"
|
||||
#include "clutter-marshal.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-stage-private.h"
|
||||
#include "clutter-virtual-input-device.h"
|
||||
#include "clutter-input-device-tool.h"
|
||||
#include "clutter-input-pointer-a11y-private.h"
|
||||
|
||||
struct _ClutterDeviceManagerPrivate
|
||||
{
|
||||
/* back-pointer to the backend */
|
||||
ClutterBackend *backend;
|
||||
|
||||
/* Keyboard a11y */
|
||||
ClutterKbdA11ySettings kbd_a11y_settings;
|
||||
/* Pointer a11y */
|
||||
ClutterPointerA11ySettings pointer_a11y_settings;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
||||
PROP_BACKEND,
|
||||
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
static GParamSpec *obj_props[PROP_LAST];
|
||||
|
||||
enum
|
||||
{
|
||||
DEVICE_ADDED,
|
||||
DEVICE_REMOVED,
|
||||
TOOL_CHANGED,
|
||||
KBD_A11Y_MASK_CHANGED,
|
||||
KBD_A11Y_FLAGS_CHANGED,
|
||||
PTR_A11Y_DWELL_CLICK_TYPE_CHANGED,
|
||||
PTR_A11Y_TIMEOUT_STARTED,
|
||||
PTR_A11Y_TIMEOUT_STOPPED,
|
||||
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint manager_signals[LAST_SIGNAL] = { 0, };
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterDeviceManager,
|
||||
clutter_device_manager,
|
||||
G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
clutter_device_manager_set_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterDeviceManager *self = CLUTTER_DEVICE_MANAGER (gobject);
|
||||
ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (self);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_BACKEND:
|
||||
priv->backend = g_value_get_object (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_device_manager_get_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterDeviceManager *self = CLUTTER_DEVICE_MANAGER (gobject);
|
||||
ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (self);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_BACKEND:
|
||||
g_value_set_object (value, priv->backend);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_device_manager_class_init (ClutterDeviceManagerClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
obj_props[PROP_BACKEND] =
|
||||
g_param_spec_object ("backend",
|
||||
P_("Backend"),
|
||||
P_("The ClutterBackend of the device manager"),
|
||||
CLUTTER_TYPE_BACKEND,
|
||||
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
|
||||
|
||||
gobject_class->set_property = clutter_device_manager_set_property;
|
||||
gobject_class->get_property = clutter_device_manager_get_property;
|
||||
g_object_class_install_properties (gobject_class,
|
||||
PROP_LAST,
|
||||
obj_props);
|
||||
|
||||
/**
|
||||
* ClutterDeviceManager::device-added:
|
||||
* @manager: the #ClutterDeviceManager that emitted the signal
|
||||
* @device: the newly added #ClutterInputDevice
|
||||
*
|
||||
* The ::device-added signal is emitted each time a device has been
|
||||
* added to the #ClutterDeviceManager
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
manager_signals[DEVICE_ADDED] =
|
||||
g_signal_new (I_("device-added"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_INPUT_DEVICE);
|
||||
|
||||
/**
|
||||
* ClutterDeviceManager::device-removed:
|
||||
* @manager: the #ClutterDeviceManager that emitted the signal
|
||||
* @device: the removed #ClutterInputDevice
|
||||
*
|
||||
* The ::device-removed signal is emitted each time a device has been
|
||||
* removed from the #ClutterDeviceManager
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
manager_signals[DEVICE_REMOVED] =
|
||||
g_signal_new (I_("device-removed"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_INPUT_DEVICE);
|
||||
|
||||
manager_signals[TOOL_CHANGED] =
|
||||
g_signal_new (I_("tool-changed"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL,
|
||||
_clutter_marshal_VOID__OBJECT_OBJECT,
|
||||
G_TYPE_NONE, 2,
|
||||
CLUTTER_TYPE_INPUT_DEVICE,
|
||||
CLUTTER_TYPE_INPUT_DEVICE_TOOL);
|
||||
|
||||
/**
|
||||
* ClutterDeviceManager::kbd-a11y-mods-state-changed:
|
||||
* @manager: the #ClutterDeviceManager that emitted the signal
|
||||
* @latched_mask: the latched modifier mask from stickykeys
|
||||
* @locked_mask: the locked modifier mask from stickykeys
|
||||
*
|
||||
* The ::kbd-a11y-mods-state-changed signal is emitted each time either the
|
||||
* latched modifiers mask or locked modifiers mask are changed as the
|
||||
* result of keyboard accessibilty's sticky keys operations.
|
||||
*/
|
||||
manager_signals[KBD_A11Y_MASK_CHANGED] =
|
||||
g_signal_new (I_("kbd-a11y-mods-state-changed"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL,
|
||||
_clutter_marshal_VOID__UINT_UINT,
|
||||
G_TYPE_NONE, 2,
|
||||
G_TYPE_UINT,
|
||||
G_TYPE_UINT);
|
||||
|
||||
/**
|
||||
* ClutterDeviceManager::kbd-a11y-flags-changed:
|
||||
* @manager: the #ClutterDeviceManager that emitted the signal
|
||||
* @settings_flags: the new ClutterKeyboardA11yFlags configuration
|
||||
* @changed_mask: the ClutterKeyboardA11yFlags changed
|
||||
*
|
||||
* The ::kbd-a11y-flags-changed signal is emitted each time the
|
||||
* ClutterKeyboardA11yFlags configuration is changed as the result of
|
||||
* keyboard accessibilty operations.
|
||||
*/
|
||||
manager_signals[KBD_A11Y_FLAGS_CHANGED] =
|
||||
g_signal_new (I_("kbd-a11y-flags-changed"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL,
|
||||
_clutter_marshal_VOID__UINT_UINT,
|
||||
G_TYPE_NONE, 2,
|
||||
G_TYPE_UINT,
|
||||
G_TYPE_UINT);
|
||||
|
||||
/**
|
||||
* ClutterDeviceManager::ptr-a11y-dwell-click-type-changed:
|
||||
* @manager: the #ClutterDeviceManager that emitted the signal
|
||||
* @click_type: the new #ClutterPointerA11yDwellClickType mode
|
||||
*
|
||||
* The ::ptr-a11y-dwell-click-type-changed signal is emitted each time
|
||||
* the ClutterPointerA11yDwellClickType mode is changed as the result
|
||||
* of pointer accessibility operations.
|
||||
*/
|
||||
manager_signals[PTR_A11Y_DWELL_CLICK_TYPE_CHANGED] =
|
||||
g_signal_new (I_("ptr-a11y-dwell-click-type-changed"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL,
|
||||
g_cclosure_marshal_VOID__FLAGS,
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_POINTER_A11Y_DWELL_CLICK_TYPE);
|
||||
|
||||
/**
|
||||
* ClutterDeviceManager::ptr-a11y-timeout-started:
|
||||
* @manager: the #ClutterDeviceManager that emitted the signal
|
||||
* @device: the core pointer #ClutterInputDevice
|
||||
* @timeout_type: the type of timeout #ClutterPointerA11yTimeoutType
|
||||
* @delay: the delay in ms before secondary-click is triggered.
|
||||
*
|
||||
* The ::ptr-a11y-timeout-started signal is emitted when a
|
||||
* pointer accessibility timeout delay is started, so that upper
|
||||
* layers can notify the user with some visual feedback.
|
||||
*/
|
||||
manager_signals[PTR_A11Y_TIMEOUT_STARTED] =
|
||||
g_signal_new (I_("ptr-a11y-timeout-started"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL,
|
||||
_clutter_marshal_VOID__OBJECT_FLAGS_UINT,
|
||||
G_TYPE_NONE, 3,
|
||||
CLUTTER_TYPE_INPUT_DEVICE,
|
||||
CLUTTER_TYPE_POINTER_A11Y_TIMEOUT_TYPE,
|
||||
G_TYPE_UINT);
|
||||
|
||||
/**
|
||||
* ClutterDeviceManager::ptr-a11y-timeout-stopped:
|
||||
* @manager: the #ClutterDeviceManager that emitted the signal
|
||||
* @device: the core pointer #ClutterInputDevice
|
||||
* @timeout_type: the type of timeout #ClutterPointerA11yTimeoutType
|
||||
* @clicked: %TRUE if the timeout finished and triggered a click
|
||||
*
|
||||
* The ::ptr-a11y-timeout-stopped signal is emitted when a running
|
||||
* pointer accessibility timeout delay is stopped, either because
|
||||
* it's triggered at the end of the delay or cancelled, so that
|
||||
* upper layers can notify the user with some visual feedback.
|
||||
*/
|
||||
manager_signals[PTR_A11Y_TIMEOUT_STOPPED] =
|
||||
g_signal_new (I_("ptr-a11y-timeout-stopped"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL,
|
||||
_clutter_marshal_VOID__OBJECT_FLAGS_BOOLEAN,
|
||||
G_TYPE_NONE, 3,
|
||||
CLUTTER_TYPE_INPUT_DEVICE,
|
||||
CLUTTER_TYPE_POINTER_A11Y_TIMEOUT_TYPE,
|
||||
G_TYPE_BOOLEAN);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_device_manager_init (ClutterDeviceManager *self)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_device_manager_get_default:
|
||||
*
|
||||
* Retrieves the device manager singleton
|
||||
*
|
||||
* Return value: (transfer none): the #ClutterDeviceManager singleton.
|
||||
* The returned instance is owned by Clutter and it should not be
|
||||
* modified or freed
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
ClutterDeviceManager *
|
||||
clutter_device_manager_get_default (void)
|
||||
{
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
|
||||
return CLUTTER_BACKEND_GET_CLASS (backend)->get_device_manager (backend);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_device_manager_list_devices:
|
||||
* @device_manager: a #ClutterDeviceManager
|
||||
*
|
||||
* Lists all currently registered input devices
|
||||
*
|
||||
* Return value: (transfer container) (element-type Clutter.InputDevice):
|
||||
* a newly allocated list of #ClutterInputDevice objects. Use
|
||||
* g_slist_free() to deallocate it when done
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
GSList *
|
||||
clutter_device_manager_list_devices (ClutterDeviceManager *device_manager)
|
||||
{
|
||||
const GSList *devices;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager), NULL);
|
||||
|
||||
devices = clutter_device_manager_peek_devices (device_manager);
|
||||
|
||||
return g_slist_copy ((GSList *) devices);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_device_manager_peek_devices:
|
||||
* @device_manager: a #ClutterDeviceManager
|
||||
*
|
||||
* Lists all currently registered input devices
|
||||
*
|
||||
* Return value: (transfer none) (element-type Clutter.InputDevice):
|
||||
* a pointer to the internal list of #ClutterInputDevice objects. The
|
||||
* returned list is owned by the #ClutterDeviceManager and should never
|
||||
* be modified or freed
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
const GSList *
|
||||
clutter_device_manager_peek_devices (ClutterDeviceManager *device_manager)
|
||||
{
|
||||
ClutterDeviceManagerClass *manager_class;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager), NULL);
|
||||
|
||||
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
|
||||
return manager_class->get_devices (device_manager);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_device_manager_get_device:
|
||||
* @device_manager: a #ClutterDeviceManager
|
||||
* @device_id: the integer id of a device
|
||||
*
|
||||
* Retrieves the #ClutterInputDevice with the given @device_id
|
||||
*
|
||||
* Return value: (transfer none): a #ClutterInputDevice or %NULL. The
|
||||
* returned device is owned by the #ClutterDeviceManager and should
|
||||
* never be modified or freed
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
ClutterInputDevice *
|
||||
clutter_device_manager_get_device (ClutterDeviceManager *device_manager,
|
||||
gint device_id)
|
||||
{
|
||||
ClutterDeviceManagerClass *manager_class;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager), NULL);
|
||||
|
||||
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
|
||||
return manager_class->get_device (device_manager, device_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_device_manager_get_core_device:
|
||||
* @device_manager: a #ClutterDeviceManager
|
||||
* @device_type: the type of the core device
|
||||
*
|
||||
* Retrieves the core #ClutterInputDevice of type @device_type
|
||||
*
|
||||
* Core devices are devices created automatically by the default
|
||||
* Clutter backend
|
||||
*
|
||||
* Return value: (transfer none): a #ClutterInputDevice or %NULL. The
|
||||
* returned device is owned by the #ClutterDeviceManager and should
|
||||
* not be modified or freed
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
ClutterInputDevice *
|
||||
clutter_device_manager_get_core_device (ClutterDeviceManager *device_manager,
|
||||
ClutterInputDeviceType device_type)
|
||||
{
|
||||
ClutterDeviceManagerClass *manager_class;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager), NULL);
|
||||
|
||||
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
|
||||
return manager_class->get_core_device (device_manager, device_type);
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_device_manager_select_stage_events (ClutterDeviceManager *device_manager,
|
||||
ClutterStage *stage)
|
||||
{
|
||||
ClutterDeviceManagerClass *manager_class;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
|
||||
|
||||
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
|
||||
if (manager_class->select_stage_events)
|
||||
manager_class->select_stage_events (device_manager, stage);
|
||||
}
|
||||
|
||||
/*
|
||||
* _clutter_device_manager_add_device:
|
||||
* @device_manager: a #ClutterDeviceManager
|
||||
* @device: a #ClutterInputDevice
|
||||
*
|
||||
* Adds @device to the list of #ClutterInputDevice<!-- -->s maintained
|
||||
* by @device_manager
|
||||
*
|
||||
* The reference count of @device is not increased
|
||||
*
|
||||
* The #ClutterDeviceManager::device-added signal is emitted after
|
||||
* adding @device to the list
|
||||
*/
|
||||
void
|
||||
_clutter_device_manager_add_device (ClutterDeviceManager *device_manager,
|
||||
ClutterInputDevice *device)
|
||||
{
|
||||
ClutterDeviceManagerClass *manager_class;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
|
||||
|
||||
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
|
||||
g_assert (manager_class->add_device != NULL);
|
||||
|
||||
manager_class->add_device (device_manager, device);
|
||||
|
||||
g_signal_emit (device_manager, manager_signals[DEVICE_ADDED], 0, device);
|
||||
}
|
||||
|
||||
/*
|
||||
* _clutter_device_manager_remove_device:
|
||||
* @device_manager: a #ClutterDeviceManager
|
||||
* @device: a #ClutterInputDevice
|
||||
*
|
||||
* Removes @device from the list of #ClutterInputDevice<!-- -->s
|
||||
* maintained by @device_manager
|
||||
*
|
||||
* The reference count of @device is not decreased
|
||||
*
|
||||
* The #ClutterDeviceManager::device-removed signal is emitted after
|
||||
* removing @device from the list
|
||||
*/
|
||||
void
|
||||
_clutter_device_manager_remove_device (ClutterDeviceManager *device_manager,
|
||||
ClutterInputDevice *device)
|
||||
{
|
||||
ClutterDeviceManagerClass *manager_class;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
|
||||
|
||||
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
|
||||
g_assert (manager_class->remove_device != NULL);
|
||||
|
||||
/* The subclass remove_device() method will likely unref it but we
|
||||
have to keep it alive during the signal emission. */
|
||||
g_object_ref (device);
|
||||
|
||||
manager_class->remove_device (device_manager, device);
|
||||
g_signal_emit (device_manager, manager_signals[DEVICE_REMOVED], 0, device);
|
||||
|
||||
g_object_unref (device);
|
||||
}
|
||||
|
||||
/*
|
||||
* _clutter_device_manager_update_devices:
|
||||
* @device_manager: a #ClutterDeviceManager
|
||||
*
|
||||
* Updates every #ClutterInputDevice handled by @device_manager
|
||||
* by performing a pick paint at the coordinates of each pointer
|
||||
* device
|
||||
*/
|
||||
void
|
||||
_clutter_device_manager_update_devices (ClutterDeviceManager *device_manager)
|
||||
{
|
||||
const GSList *d;
|
||||
|
||||
for (d = clutter_device_manager_peek_devices (device_manager);
|
||||
d != NULL;
|
||||
d = d->next)
|
||||
{
|
||||
ClutterInputDevice *device = d->data;
|
||||
ClutterInputDeviceType device_type;
|
||||
|
||||
/* we only care about pointer devices */
|
||||
device_type = clutter_input_device_get_device_type (device);
|
||||
if (device_type != CLUTTER_POINTER_DEVICE)
|
||||
continue;
|
||||
|
||||
/* out of stage */
|
||||
if (device->stage == NULL)
|
||||
continue;
|
||||
|
||||
/* the user disabled motion events delivery on actors for
|
||||
* the stage the device is on; we don't perform any picking
|
||||
* since the source of the events will always be set to be
|
||||
* the stage
|
||||
*/
|
||||
if (!clutter_stage_get_motion_events_enabled (device->stage))
|
||||
continue;
|
||||
|
||||
_clutter_input_device_update (device, NULL, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
ClutterBackend *
|
||||
_clutter_device_manager_get_backend (ClutterDeviceManager *manager)
|
||||
{
|
||||
ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (manager);
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER (manager), NULL);
|
||||
|
||||
return priv->backend;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_device_manager_create_virtual_device:
|
||||
* @device_manager: a #ClutterDeviceManager
|
||||
* @device_type: the type of the virtual device
|
||||
*
|
||||
* Creates a virtual input device.
|
||||
*
|
||||
* Returns: (transfer full): a newly created virtual device
|
||||
**/
|
||||
ClutterVirtualInputDevice *
|
||||
clutter_device_manager_create_virtual_device (ClutterDeviceManager *device_manager,
|
||||
ClutterInputDeviceType device_type)
|
||||
{
|
||||
ClutterDeviceManagerClass *manager_class;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager), NULL);
|
||||
|
||||
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
|
||||
return manager_class->create_virtual_device (device_manager,
|
||||
device_type);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_device_manager_supported_virtua_device_types: (skip)
|
||||
*/
|
||||
ClutterVirtualDeviceType
|
||||
clutter_device_manager_get_supported_virtual_device_types (ClutterDeviceManager *device_manager)
|
||||
{
|
||||
ClutterDeviceManagerClass *manager_class;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager),
|
||||
CLUTTER_VIRTUAL_DEVICE_TYPE_NONE);
|
||||
|
||||
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
|
||||
return manager_class->get_supported_virtual_device_types (device_manager);
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_device_manager_compress_motion (ClutterDeviceManager *device_manager,
|
||||
ClutterEvent *event,
|
||||
const ClutterEvent *to_discard)
|
||||
{
|
||||
ClutterDeviceManagerClass *manager_class;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
|
||||
|
||||
|
||||
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
|
||||
if (!manager_class->compress_motion)
|
||||
return;
|
||||
|
||||
manager_class->compress_motion (device_manager, event, to_discard);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
are_kbd_a11y_settings_equal (ClutterKbdA11ySettings *a,
|
||||
ClutterKbdA11ySettings *b)
|
||||
{
|
||||
return (memcmp (a, b, sizeof (ClutterKbdA11ySettings)) == 0);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_device_manager_set_kbd_a11y_settings (ClutterDeviceManager *device_manager,
|
||||
ClutterKbdA11ySettings *settings)
|
||||
{
|
||||
ClutterDeviceManagerClass *manager_class;
|
||||
ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (device_manager);
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
|
||||
|
||||
if (are_kbd_a11y_settings_equal (&priv->kbd_a11y_settings, settings))
|
||||
return;
|
||||
|
||||
priv->kbd_a11y_settings = *settings;
|
||||
|
||||
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
|
||||
if (manager_class->apply_kbd_a11y_settings)
|
||||
manager_class->apply_kbd_a11y_settings (device_manager, settings);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_device_manager_get_kbd_a11y_settings (ClutterDeviceManager *device_manager,
|
||||
ClutterKbdA11ySettings *settings)
|
||||
{
|
||||
ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (device_manager);
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
|
||||
|
||||
*settings = priv->kbd_a11y_settings;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
are_pointer_a11y_settings_equal (ClutterPointerA11ySettings *a,
|
||||
ClutterPointerA11ySettings *b)
|
||||
{
|
||||
return (memcmp (a, b, sizeof (ClutterPointerA11ySettings)) == 0);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_device_manager_enable_pointer_a11y (ClutterDeviceManager *device_manager)
|
||||
{
|
||||
ClutterInputDevice *core_pointer;
|
||||
|
||||
core_pointer = clutter_device_manager_get_core_device (device_manager,
|
||||
CLUTTER_POINTER_DEVICE);
|
||||
|
||||
_clutter_input_pointer_a11y_add_device (core_pointer);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_device_manager_disable_pointer_a11y (ClutterDeviceManager *device_manager)
|
||||
{
|
||||
ClutterInputDevice *core_pointer;
|
||||
|
||||
core_pointer = clutter_device_manager_get_core_device (device_manager,
|
||||
CLUTTER_POINTER_DEVICE);
|
||||
|
||||
_clutter_input_pointer_a11y_remove_device (core_pointer);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_device_manager_set_pointer_a11y_settings:
|
||||
* @device_manager: a #ClutterDeviceManager
|
||||
* @settings: a pointer to a #ClutterPointerA11ySettings
|
||||
*
|
||||
* Sets the pointer accessibility settings
|
||||
**/
|
||||
void
|
||||
clutter_device_manager_set_pointer_a11y_settings (ClutterDeviceManager *device_manager,
|
||||
ClutterPointerA11ySettings *settings)
|
||||
{
|
||||
ClutterDeviceManagerPrivate *priv =
|
||||
clutter_device_manager_get_instance_private (device_manager);
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
|
||||
|
||||
if (are_pointer_a11y_settings_equal (&priv->pointer_a11y_settings, settings))
|
||||
return;
|
||||
|
||||
if (priv->pointer_a11y_settings.controls == 0 && settings->controls != 0)
|
||||
clutter_device_manager_enable_pointer_a11y (device_manager);
|
||||
else if (priv->pointer_a11y_settings.controls != 0 && settings->controls == 0)
|
||||
clutter_device_manager_disable_pointer_a11y (device_manager);
|
||||
|
||||
priv->pointer_a11y_settings = *settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_device_manager_get_pointer_a11y_settings:
|
||||
* @device_manager: a #ClutterDeviceManager
|
||||
* @settings: a pointer to a #ClutterPointerA11ySettings
|
||||
*
|
||||
* Gets the current pointer accessibility settings
|
||||
**/
|
||||
void
|
||||
clutter_device_manager_get_pointer_a11y_settings (ClutterDeviceManager *device_manager,
|
||||
ClutterPointerA11ySettings *settings)
|
||||
{
|
||||
ClutterDeviceManagerPrivate *priv =
|
||||
clutter_device_manager_get_instance_private (device_manager);
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
|
||||
|
||||
*settings = priv->pointer_a11y_settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_device_manager_set_pointer_a11y_dwell_click_type:
|
||||
* @device_manager: a #ClutterDeviceManager
|
||||
* @click_type: type of click as #ClutterPointerA11yDwellClickType
|
||||
*
|
||||
* Sets the dwell click type
|
||||
**/
|
||||
void
|
||||
clutter_device_manager_set_pointer_a11y_dwell_click_type (ClutterDeviceManager *device_manager,
|
||||
ClutterPointerA11yDwellClickType click_type)
|
||||
{
|
||||
ClutterDeviceManagerPrivate *priv =
|
||||
clutter_device_manager_get_instance_private (device_manager);
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
|
||||
|
||||
priv->pointer_a11y_settings.dwell_click_type = click_type;
|
||||
}
|
181
clutter/clutter/clutter-device-manager.h
Normal file
181
clutter/clutter/clutter-device-manager.h
Normal file
@ -0,0 +1,181 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright (C) 2009 Intel Corp.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author: Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
#ifndef __CLUTTER_DEVICE_MANAGER_H__
|
||||
#define __CLUTTER_DEVICE_MANAGER_H__
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <clutter/clutter-input-device.h>
|
||||
#include <clutter/clutter-stage.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_DEVICE_MANAGER (clutter_device_manager_get_type ())
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_DERIVABLE_TYPE (ClutterDeviceManager, clutter_device_manager,
|
||||
CLUTTER, DEVICE_MANAGER, GObject)
|
||||
|
||||
typedef struct _ClutterDeviceManagerPrivate ClutterDeviceManagerPrivate;
|
||||
|
||||
/**
|
||||
* ClutterVirtualDeviceType:
|
||||
*/
|
||||
typedef enum _ClutterVirtualDeviceType
|
||||
{
|
||||
CLUTTER_VIRTUAL_DEVICE_TYPE_NONE = 0,
|
||||
CLUTTER_VIRTUAL_DEVICE_TYPE_KEYBOARD = 1 << 0,
|
||||
CLUTTER_VIRTUAL_DEVICE_TYPE_POINTER = 1 << 1,
|
||||
CLUTTER_VIRTUAL_DEVICE_TYPE_TOUCHSCREEN = 1 << 2,
|
||||
} ClutterVirtualDeviceType;
|
||||
|
||||
/**
|
||||
* ClutterKbdA11ySettings:
|
||||
*
|
||||
* The #ClutterKbdA11ySettings structure contains keyboard accessibility
|
||||
* settings
|
||||
*
|
||||
*/
|
||||
typedef struct _ClutterKbdA11ySettings
|
||||
{
|
||||
ClutterKeyboardA11yFlags controls;
|
||||
gint slowkeys_delay;
|
||||
gint debounce_delay;
|
||||
gint timeout_delay;
|
||||
gint mousekeys_init_delay;
|
||||
gint mousekeys_max_speed;
|
||||
gint mousekeys_accel_time;
|
||||
} ClutterKbdA11ySettings;
|
||||
|
||||
/**
|
||||
* ClutterPointerA11ySettings:
|
||||
*
|
||||
* The #ClutterPointerA11ySettings structure contains pointer accessibility
|
||||
* settings
|
||||
*
|
||||
*/
|
||||
typedef struct _ClutterPointerA11ySettings
|
||||
{
|
||||
ClutterPointerA11yFlags controls;
|
||||
ClutterPointerA11yDwellClickType dwell_click_type;
|
||||
ClutterPointerA11yDwellMode dwell_mode;
|
||||
ClutterPointerA11yDwellDirection dwell_gesture_single;
|
||||
ClutterPointerA11yDwellDirection dwell_gesture_double;
|
||||
ClutterPointerA11yDwellDirection dwell_gesture_drag;
|
||||
ClutterPointerA11yDwellDirection dwell_gesture_secondary;
|
||||
gint secondary_click_delay;
|
||||
gint dwell_delay;
|
||||
gint dwell_threshold;
|
||||
} ClutterPointerA11ySettings;
|
||||
|
||||
/**
|
||||
* ClutterDeviceManagerClass:
|
||||
*
|
||||
* The #ClutterDeviceManagerClass structure contains only private data
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
struct _ClutterDeviceManagerClass
|
||||
{
|
||||
/*< private >*/
|
||||
GObjectClass parent_class;
|
||||
|
||||
const GSList * (* get_devices) (ClutterDeviceManager *device_manager);
|
||||
ClutterInputDevice *(* get_core_device) (ClutterDeviceManager *device_manager,
|
||||
ClutterInputDeviceType device_type);
|
||||
ClutterInputDevice *(* get_device) (ClutterDeviceManager *device_manager,
|
||||
gint device_id);
|
||||
|
||||
void (* add_device) (ClutterDeviceManager *manager,
|
||||
ClutterInputDevice *device);
|
||||
void (* remove_device) (ClutterDeviceManager *manager,
|
||||
ClutterInputDevice *device);
|
||||
void (* select_stage_events) (ClutterDeviceManager *manager,
|
||||
ClutterStage *stage);
|
||||
ClutterVirtualInputDevice *(* create_virtual_device) (ClutterDeviceManager *device_manager,
|
||||
ClutterInputDeviceType device_type);
|
||||
ClutterVirtualDeviceType (* get_supported_virtual_device_types) (ClutterDeviceManager *device_manager);
|
||||
void (* compress_motion) (ClutterDeviceManager *device_manger,
|
||||
ClutterEvent *event,
|
||||
const ClutterEvent *to_discard);
|
||||
/* Keyboard accessbility */
|
||||
void (* apply_kbd_a11y_settings) (ClutterDeviceManager *device_manger,
|
||||
ClutterKbdA11ySettings *settings);
|
||||
|
||||
/* Event platform data */
|
||||
void (* copy_event_data) (ClutterDeviceManager *device_manager,
|
||||
const ClutterEvent *src,
|
||||
ClutterEvent *dest);
|
||||
void (* free_event_data) (ClutterDeviceManager *device_manager,
|
||||
ClutterEvent *event);
|
||||
|
||||
/* padding */
|
||||
gpointer _padding[4];
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterDeviceManager *clutter_device_manager_get_default (void);
|
||||
CLUTTER_EXPORT
|
||||
GSList * clutter_device_manager_list_devices (ClutterDeviceManager *device_manager);
|
||||
CLUTTER_EXPORT
|
||||
const GSList * clutter_device_manager_peek_devices (ClutterDeviceManager *device_manager);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterInputDevice * clutter_device_manager_get_device (ClutterDeviceManager *device_manager,
|
||||
gint device_id);
|
||||
CLUTTER_EXPORT
|
||||
ClutterInputDevice * clutter_device_manager_get_core_device (ClutterDeviceManager *device_manager,
|
||||
ClutterInputDeviceType device_type);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterVirtualInputDevice *clutter_device_manager_create_virtual_device (ClutterDeviceManager *device_manager,
|
||||
ClutterInputDeviceType device_type);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterVirtualDeviceType clutter_device_manager_get_supported_virtual_device_types (ClutterDeviceManager *device_manager);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_device_manager_set_kbd_a11y_settings (ClutterDeviceManager *device_manager,
|
||||
ClutterKbdA11ySettings *settings);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_device_manager_get_kbd_a11y_settings (ClutterDeviceManager *device_manager,
|
||||
ClutterKbdA11ySettings *settings);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_device_manager_set_pointer_a11y_settings (ClutterDeviceManager *device_manager,
|
||||
ClutterPointerA11ySettings *settings);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_device_manager_get_pointer_a11y_settings (ClutterDeviceManager *device_manager,
|
||||
ClutterPointerA11ySettings *settings);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_device_manager_set_pointer_a11y_dwell_click_type (ClutterDeviceManager *device_manager,
|
||||
ClutterPointerA11yDwellClickType click_type);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_DEVICE_MANAGER_H__ */
|
1320
clutter/clutter/clutter-drag-action.c
Normal file
1320
clutter/clutter/clutter-drag-action.c
Normal file
File diff suppressed because it is too large
Load Diff
152
clutter/clutter/clutter-drag-action.h
Normal file
152
clutter/clutter/clutter-drag-action.h
Normal file
@ -0,0 +1,152 @@
|
||||
/*
|
||||
* 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_DRAG_ACTION_H__
|
||||
#define __CLUTTER_DRAG_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_DRAG_ACTION (clutter_drag_action_get_type ())
|
||||
#define CLUTTER_DRAG_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_DRAG_ACTION, ClutterDragAction))
|
||||
#define CLUTTER_IS_DRAG_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_DRAG_ACTION))
|
||||
#define CLUTTER_DRAG_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_DRAG_ACTION, ClutterDragActionClass))
|
||||
#define CLUTTER_IS_DRAG_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_DRAG_ACTION))
|
||||
#define CLUTTER_DRAG_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_DRAG_ACTION, ClutterDragActionClass))
|
||||
|
||||
typedef struct _ClutterDragAction ClutterDragAction;
|
||||
typedef struct _ClutterDragActionPrivate ClutterDragActionPrivate;
|
||||
typedef struct _ClutterDragActionClass ClutterDragActionClass;
|
||||
|
||||
/**
|
||||
* ClutterDragAction:
|
||||
*
|
||||
* The #ClutterDragAction structure contains only
|
||||
* private data and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _ClutterDragAction
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterAction parent_instance;
|
||||
|
||||
ClutterDragActionPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterDragActionClass:
|
||||
* @drag_begin: class handler of the #ClutterDragAction::drag-begin signal
|
||||
* @drag_motion: class handler of the #ClutterDragAction::drag-motion signal
|
||||
* @drag_end: class handler of the #ClutterDragAction::drag-end signal
|
||||
* @drag_progress: class handler of the #ClutterDragAction::drag-progress signal
|
||||
*
|
||||
* The #ClutterDragActionClass structure contains
|
||||
* only private data
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _ClutterDragActionClass
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterActionClass parent_class;
|
||||
|
||||
/*< public >*/
|
||||
void (* drag_begin) (ClutterDragAction *action,
|
||||
ClutterActor *actor,
|
||||
gfloat event_x,
|
||||
gfloat event_y,
|
||||
ClutterModifierType modifiers);
|
||||
void (* drag_motion) (ClutterDragAction *action,
|
||||
ClutterActor *actor,
|
||||
gfloat delta_x,
|
||||
gfloat delta_y);
|
||||
void (* drag_end) (ClutterDragAction *action,
|
||||
ClutterActor *actor,
|
||||
gfloat event_x,
|
||||
gfloat event_y,
|
||||
ClutterModifierType modifiers);
|
||||
gboolean (* drag_progress) (ClutterDragAction *action,
|
||||
ClutterActor *actor,
|
||||
gfloat delta_x,
|
||||
gfloat delta_y);
|
||||
|
||||
/*< private >*/
|
||||
void (* _clutter_drag_action1) (void);
|
||||
void (* _clutter_drag_action2) (void);
|
||||
void (* _clutter_drag_action3) (void);
|
||||
void (* _clutter_drag_action4) (void);
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_drag_action_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterAction * clutter_drag_action_new (void);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_drag_action_set_drag_threshold (ClutterDragAction *action,
|
||||
gint x_threshold,
|
||||
gint y_threshold);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_drag_action_get_drag_threshold (ClutterDragAction *action,
|
||||
guint *x_threshold,
|
||||
guint *y_threshold);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_drag_action_set_drag_handle (ClutterDragAction *action,
|
||||
ClutterActor *handle);
|
||||
CLUTTER_EXPORT
|
||||
ClutterActor * clutter_drag_action_get_drag_handle (ClutterDragAction *action);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_drag_action_set_drag_axis (ClutterDragAction *action,
|
||||
ClutterDragAxis axis);
|
||||
CLUTTER_EXPORT
|
||||
ClutterDragAxis clutter_drag_action_get_drag_axis (ClutterDragAction *action);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_drag_action_get_press_coords (ClutterDragAction *action,
|
||||
gfloat *press_x,
|
||||
gfloat *press_y);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_drag_action_get_motion_coords (ClutterDragAction *action,
|
||||
gfloat *motion_x,
|
||||
gfloat *motion_y);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_drag_action_get_drag_area (ClutterDragAction *action,
|
||||
ClutterRect *drag_area);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_drag_action_set_drag_area (ClutterDragAction *action,
|
||||
const ClutterRect *drag_area);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_DRAG_ACTION_H__ */
|
529
clutter/clutter/clutter-drop-action.c
Normal file
529
clutter/clutter/clutter-drop-action.c
Normal file
@ -0,0 +1,529 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright © 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-drop-action
|
||||
* @Title: ClutterDropAction
|
||||
* @short_description: An action for drop targets
|
||||
*
|
||||
* #ClutterDropAction is a #ClutterAction that allows a #ClutterActor
|
||||
* implementation to control what happens when an actor dragged using
|
||||
* a #ClutterDragAction crosses the target area or when a dragged actor
|
||||
* is released (or "dropped") on the target area.
|
||||
*
|
||||
* A trivial use of #ClutterDropAction consists in connecting to the
|
||||
* #ClutterDropAction::drop signal and handling the drop from there,
|
||||
* for instance:
|
||||
*
|
||||
* |[<!-- language="C" -->
|
||||
* ClutterAction *action = clutter_drop_action ();
|
||||
*
|
||||
* g_signal_connect (action, "drop", G_CALLBACK (on_drop), NULL);
|
||||
* clutter_actor_add_action (an_actor, action);
|
||||
* ]|
|
||||
*
|
||||
* The #ClutterDropAction::can-drop can be used to control whether the
|
||||
* #ClutterDropAction::drop signal is going to be emitted; returning %FALSE
|
||||
* from a handler connected to the #ClutterDropAction::can-drop signal will
|
||||
* cause the #ClutterDropAction::drop signal to be skipped when the input
|
||||
* device button is released.
|
||||
*
|
||||
* It's important to note that #ClutterDropAction will only work with
|
||||
* actors dragged using #ClutterDragAction.
|
||||
*
|
||||
* See [drop-action.c](https://git.gnome.org/browse/clutter/tree/examples/drop-action.c?h=clutter-1.18)
|
||||
* for an example of how to use #ClutterDropAction.
|
||||
*
|
||||
* #ClutterDropAction is available since Clutter 1.8
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter-drop-action.h"
|
||||
|
||||
#include "clutter-actor-meta-private.h"
|
||||
#include "clutter-actor-private.h"
|
||||
#include "clutter-drag-action.h"
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-marshal.h"
|
||||
#include "clutter-stage-private.h"
|
||||
|
||||
struct _ClutterDropActionPrivate
|
||||
{
|
||||
ClutterActor *actor;
|
||||
ClutterActor *stage;
|
||||
|
||||
gulong mapped_id;
|
||||
};
|
||||
|
||||
typedef struct _DropTarget {
|
||||
ClutterActor *stage;
|
||||
|
||||
gulong capture_id;
|
||||
|
||||
GHashTable *actions;
|
||||
|
||||
ClutterDropAction *last_action;
|
||||
} DropTarget;
|
||||
|
||||
enum
|
||||
{
|
||||
CAN_DROP,
|
||||
OVER_IN,
|
||||
OVER_OUT,
|
||||
DROP,
|
||||
DROP_CANCEL,
|
||||
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint drop_signals[LAST_SIGNAL] = { 0, };
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterDropAction, clutter_drop_action, CLUTTER_TYPE_ACTION)
|
||||
|
||||
static void
|
||||
drop_target_free (gpointer _data)
|
||||
{
|
||||
DropTarget *data = _data;
|
||||
|
||||
g_signal_handler_disconnect (data->stage, data->capture_id);
|
||||
g_hash_table_destroy (data->actions);
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
on_stage_capture (ClutterStage *stage,
|
||||
ClutterEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
DropTarget *data = user_data;
|
||||
gfloat event_x, event_y;
|
||||
ClutterActor *actor, *drag_actor;
|
||||
ClutterDropAction *drop_action;
|
||||
ClutterInputDevice *device;
|
||||
gboolean was_reactive;
|
||||
|
||||
switch (clutter_event_type (event))
|
||||
{
|
||||
case CLUTTER_MOTION:
|
||||
case CLUTTER_BUTTON_RELEASE:
|
||||
if (clutter_event_type (event) == CLUTTER_MOTION &&
|
||||
!(clutter_event_get_state (event) & CLUTTER_BUTTON1_MASK))
|
||||
return CLUTTER_EVENT_PROPAGATE;
|
||||
|
||||
if (clutter_event_type (event) == CLUTTER_BUTTON_RELEASE &&
|
||||
clutter_event_get_button (event) != CLUTTER_BUTTON_PRIMARY)
|
||||
return CLUTTER_EVENT_PROPAGATE;
|
||||
|
||||
device = clutter_event_get_device (event);
|
||||
drag_actor = _clutter_stage_get_pointer_drag_actor (stage, device);
|
||||
if (drag_actor == NULL)
|
||||
return CLUTTER_EVENT_PROPAGATE;
|
||||
break;
|
||||
|
||||
case CLUTTER_TOUCH_UPDATE:
|
||||
case CLUTTER_TOUCH_END:
|
||||
drag_actor = _clutter_stage_get_touch_drag_actor (stage,
|
||||
clutter_event_get_event_sequence (event));
|
||||
if (drag_actor == NULL)
|
||||
return CLUTTER_EVENT_PROPAGATE;
|
||||
break;
|
||||
|
||||
default:
|
||||
return CLUTTER_EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
clutter_event_get_coords (event, &event_x, &event_y);
|
||||
|
||||
/* get the actor under the cursor, excluding the dragged actor; we
|
||||
* use reactivity because it won't cause any scene invalidation
|
||||
*/
|
||||
was_reactive = clutter_actor_get_reactive (drag_actor);
|
||||
clutter_actor_set_reactive (drag_actor, FALSE);
|
||||
|
||||
actor = clutter_stage_get_actor_at_pos (stage, CLUTTER_PICK_REACTIVE,
|
||||
event_x,
|
||||
event_y);
|
||||
if (actor == NULL || actor == CLUTTER_ACTOR (stage))
|
||||
{
|
||||
if (data->last_action != NULL)
|
||||
{
|
||||
ClutterActorMeta *meta = CLUTTER_ACTOR_META (data->last_action);
|
||||
|
||||
g_signal_emit (data->last_action, drop_signals[OVER_OUT], 0,
|
||||
clutter_actor_meta_get_actor (meta));
|
||||
|
||||
data->last_action = NULL;
|
||||
}
|
||||
|
||||
goto out;
|
||||
}
|
||||
|
||||
drop_action = g_hash_table_lookup (data->actions, actor);
|
||||
|
||||
if (drop_action == NULL)
|
||||
{
|
||||
if (data->last_action != NULL)
|
||||
{
|
||||
ClutterActorMeta *meta = CLUTTER_ACTOR_META (data->last_action);
|
||||
|
||||
g_signal_emit (data->last_action, drop_signals[OVER_OUT], 0,
|
||||
clutter_actor_meta_get_actor (meta));
|
||||
|
||||
data->last_action = NULL;
|
||||
}
|
||||
|
||||
goto out;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (data->last_action != drop_action)
|
||||
{
|
||||
ClutterActorMeta *meta;
|
||||
|
||||
if (data->last_action != NULL)
|
||||
{
|
||||
meta = CLUTTER_ACTOR_META (data->last_action);
|
||||
|
||||
g_signal_emit (data->last_action, drop_signals[OVER_OUT], 0,
|
||||
clutter_actor_meta_get_actor (meta));
|
||||
}
|
||||
|
||||
meta = CLUTTER_ACTOR_META (drop_action);
|
||||
|
||||
g_signal_emit (drop_action, drop_signals[OVER_IN], 0,
|
||||
clutter_actor_meta_get_actor (meta));
|
||||
}
|
||||
|
||||
data->last_action = drop_action;
|
||||
}
|
||||
|
||||
out:
|
||||
if (clutter_event_type (event) == CLUTTER_BUTTON_RELEASE ||
|
||||
clutter_event_type (event) == CLUTTER_TOUCH_END)
|
||||
{
|
||||
if (data->last_action != NULL)
|
||||
{
|
||||
ClutterActorMeta *meta = CLUTTER_ACTOR_META (data->last_action);
|
||||
gboolean can_drop = FALSE;
|
||||
|
||||
g_signal_emit (data->last_action, drop_signals[CAN_DROP], 0,
|
||||
clutter_actor_meta_get_actor (meta),
|
||||
event_x, event_y,
|
||||
&can_drop);
|
||||
|
||||
if (can_drop)
|
||||
{
|
||||
g_signal_emit (data->last_action, drop_signals[DROP], 0,
|
||||
clutter_actor_meta_get_actor (meta),
|
||||
event_x, event_y);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_signal_emit (data->last_action, drop_signals[DROP_CANCEL], 0,
|
||||
clutter_actor_meta_get_actor (meta),
|
||||
event_x, event_y);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
data->last_action = NULL;
|
||||
}
|
||||
|
||||
if (drag_actor != NULL)
|
||||
clutter_actor_set_reactive (drag_actor, was_reactive);
|
||||
|
||||
return CLUTTER_EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
static void
|
||||
drop_action_register (ClutterDropAction *self)
|
||||
{
|
||||
ClutterDropActionPrivate *priv = self->priv;
|
||||
DropTarget *data;
|
||||
|
||||
g_assert (priv->stage != NULL);
|
||||
|
||||
data = g_object_get_data (G_OBJECT (priv->stage), "__clutter_drop_targets");
|
||||
if (data == NULL)
|
||||
{
|
||||
data = g_new0 (DropTarget, 1);
|
||||
|
||||
data->stage = priv->stage;
|
||||
data->actions = g_hash_table_new (NULL, NULL);
|
||||
data->capture_id = g_signal_connect (priv->stage, "captured-event",
|
||||
G_CALLBACK (on_stage_capture),
|
||||
data);
|
||||
g_object_set_data_full (G_OBJECT (priv->stage), "__clutter_drop_targets",
|
||||
data,
|
||||
drop_target_free);
|
||||
}
|
||||
|
||||
g_hash_table_replace (data->actions, priv->actor, self);
|
||||
}
|
||||
|
||||
static void
|
||||
drop_action_unregister (ClutterDropAction *self)
|
||||
{
|
||||
ClutterDropActionPrivate *priv = self->priv;
|
||||
DropTarget *data = NULL;
|
||||
|
||||
if (priv->stage != NULL)
|
||||
data = g_object_get_data (G_OBJECT (priv->stage), "__clutter_drop_targets");
|
||||
|
||||
if (data == NULL)
|
||||
return;
|
||||
|
||||
g_hash_table_remove (data->actions, priv->actor);
|
||||
if (g_hash_table_size (data->actions) == 0)
|
||||
g_object_set_data (G_OBJECT (data->stage), "__clutter_drop_targets", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
on_actor_mapped (ClutterActor *actor,
|
||||
GParamSpec *pspec,
|
||||
ClutterDropAction *self)
|
||||
{
|
||||
if (clutter_actor_is_mapped (actor))
|
||||
{
|
||||
if (self->priv->stage == NULL)
|
||||
self->priv->stage = clutter_actor_get_stage (actor);
|
||||
|
||||
drop_action_register (self);
|
||||
}
|
||||
else
|
||||
drop_action_unregister (self);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_drop_action_set_actor (ClutterActorMeta *meta,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
ClutterDropActionPrivate *priv = CLUTTER_DROP_ACTION (meta)->priv;
|
||||
|
||||
if (priv->actor != NULL)
|
||||
{
|
||||
drop_action_unregister (CLUTTER_DROP_ACTION (meta));
|
||||
|
||||
if (priv->mapped_id != 0)
|
||||
g_signal_handler_disconnect (priv->actor, priv->mapped_id);
|
||||
|
||||
priv->stage = NULL;
|
||||
priv->actor = NULL;
|
||||
priv->mapped_id = 0;
|
||||
}
|
||||
|
||||
priv->actor = actor;
|
||||
|
||||
if (priv->actor != NULL)
|
||||
{
|
||||
priv->stage = clutter_actor_get_stage (actor);
|
||||
priv->mapped_id = g_signal_connect (actor, "notify::mapped",
|
||||
G_CALLBACK (on_actor_mapped),
|
||||
meta);
|
||||
|
||||
if (priv->stage != NULL)
|
||||
drop_action_register (CLUTTER_DROP_ACTION (meta));
|
||||
}
|
||||
|
||||
CLUTTER_ACTOR_META_CLASS (clutter_drop_action_parent_class)->set_actor (meta, actor);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
signal_accumulator (GSignalInvocationHint *ihint,
|
||||
GValue *return_accu,
|
||||
const GValue *handler_return,
|
||||
gpointer user_data)
|
||||
{
|
||||
gboolean continue_emission;
|
||||
|
||||
continue_emission = g_value_get_boolean (handler_return);
|
||||
g_value_set_boolean (return_accu, continue_emission);
|
||||
|
||||
return continue_emission;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_drop_action_real_can_drop (ClutterDropAction *action,
|
||||
ClutterActor *actor,
|
||||
gfloat event_x,
|
||||
gfloat event_y)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_drop_action_class_init (ClutterDropActionClass *klass)
|
||||
{
|
||||
ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
|
||||
|
||||
meta_class->set_actor = clutter_drop_action_set_actor;
|
||||
|
||||
klass->can_drop = clutter_drop_action_real_can_drop;
|
||||
|
||||
/**
|
||||
* ClutterDropAction::can-drop:
|
||||
* @action: the #ClutterDropAction that emitted the signal
|
||||
* @actor: the #ClutterActor attached to the @action
|
||||
* @event_x: the X coordinate (in stage space) of the drop event
|
||||
* @event_y: the Y coordinate (in stage space) of the drop event
|
||||
*
|
||||
* The ::can-drop signal is emitted when the dragged actor is dropped
|
||||
* on @actor. The return value of the ::can-drop signal will determine
|
||||
* whether or not the #ClutterDropAction::drop signal is going to be
|
||||
* emitted on @action.
|
||||
*
|
||||
* The default implementation of #ClutterDropAction returns %TRUE for
|
||||
* this signal.
|
||||
*
|
||||
* Return value: %TRUE if the drop is accepted, and %FALSE otherwise
|
||||
*
|
||||
* Since: 1.8
|
||||
*/
|
||||
drop_signals[CAN_DROP] =
|
||||
g_signal_new (I_("can-drop"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ClutterDropActionClass, can_drop),
|
||||
signal_accumulator, NULL,
|
||||
_clutter_marshal_BOOLEAN__OBJECT_FLOAT_FLOAT,
|
||||
G_TYPE_BOOLEAN, 3,
|
||||
CLUTTER_TYPE_ACTOR,
|
||||
G_TYPE_FLOAT,
|
||||
G_TYPE_FLOAT);
|
||||
|
||||
/**
|
||||
* ClutterDropAction::over-in:
|
||||
* @action: the #ClutterDropAction that emitted the signal
|
||||
* @actor: the #ClutterActor attached to the @action
|
||||
*
|
||||
* The ::over-in signal is emitted when the dragged actor crosses
|
||||
* into @actor.
|
||||
*
|
||||
* Since: 1.8
|
||||
*/
|
||||
drop_signals[OVER_IN] =
|
||||
g_signal_new (I_("over-in"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ClutterDropActionClass, over_in),
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_ACTOR);
|
||||
|
||||
/**
|
||||
* ClutterDropAction::over-out:
|
||||
* @action: the #ClutterDropAction that emitted the signal
|
||||
* @actor: the #ClutterActor attached to the @action
|
||||
*
|
||||
* The ::over-out signal is emitted when the dragged actor crosses
|
||||
* outside @actor.
|
||||
*
|
||||
* Since: 1.8
|
||||
*/
|
||||
drop_signals[OVER_OUT] =
|
||||
g_signal_new (I_("over-out"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ClutterDropActionClass, over_out),
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_ACTOR);
|
||||
|
||||
/**
|
||||
* ClutterDropAction::drop:
|
||||
* @action: the #ClutterDropAction that emitted the signal
|
||||
* @actor: the #ClutterActor attached to the @action
|
||||
* @event_x: the X coordinate (in stage space) of the drop event
|
||||
* @event_y: the Y coordinate (in stage space) of the drop event
|
||||
*
|
||||
* The ::drop signal is emitted when the dragged actor is dropped
|
||||
* on @actor. This signal is only emitted if at least an handler of
|
||||
* #ClutterDropAction::can-drop returns %TRUE.
|
||||
*
|
||||
* Since: 1.8
|
||||
*/
|
||||
drop_signals[DROP] =
|
||||
g_signal_new (I_("drop"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ClutterDropActionClass, drop),
|
||||
NULL, NULL,
|
||||
_clutter_marshal_VOID__OBJECT_FLOAT_FLOAT,
|
||||
G_TYPE_NONE, 3,
|
||||
CLUTTER_TYPE_ACTOR,
|
||||
G_TYPE_FLOAT,
|
||||
G_TYPE_FLOAT);
|
||||
|
||||
|
||||
/**
|
||||
* ClutterDropAction::drop-cancel:
|
||||
* @action: the #ClutterDropAction that emitted the signal
|
||||
* @actor: the #ClutterActor attached to the @action
|
||||
* @event_x: the X coordinate (in stage space) of the drop event
|
||||
* @event_y: the Y coordinate (in stage space) of the drop event
|
||||
*
|
||||
* The ::drop-cancel signal is emitted when the drop is refused
|
||||
* by an emission of the #ClutterDropAction::can-drop signal.
|
||||
*
|
||||
* After the ::drop-cancel signal is fired the active drag is
|
||||
* terminated.
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
drop_signals[DROP_CANCEL] =
|
||||
g_signal_new (I_("drop-cancel"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ClutterDropActionClass, drop),
|
||||
NULL, NULL,
|
||||
_clutter_marshal_VOID__OBJECT_FLOAT_FLOAT,
|
||||
G_TYPE_NONE, 3,
|
||||
CLUTTER_TYPE_ACTOR,
|
||||
G_TYPE_FLOAT,
|
||||
G_TYPE_FLOAT);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_drop_action_init (ClutterDropAction *self)
|
||||
{
|
||||
self->priv = clutter_drop_action_get_instance_private (self);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_drop_action_new:
|
||||
*
|
||||
* Creates a new #ClutterDropAction.
|
||||
*
|
||||
* Use clutter_actor_add_action() to add the action to a #ClutterActor.
|
||||
*
|
||||
* Return value: the newly created #ClutterDropAction
|
||||
*
|
||||
* Since: 1.8
|
||||
*/
|
||||
ClutterAction *
|
||||
clutter_drop_action_new (void)
|
||||
{
|
||||
return g_object_new (CLUTTER_TYPE_DROP_ACTION, NULL);
|
||||
}
|
115
clutter/clutter/clutter-drop-action.h
Normal file
115
clutter/clutter/clutter-drop-action.h
Normal file
@ -0,0 +1,115 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright © 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_DROP_ACTION_H__
|
||||
#define __CLUTTER_DROP_ACTION_H__
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be directly included."
|
||||
#endif
|
||||
|
||||
#include <clutter/clutter-action.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_DROP_ACTION (clutter_drop_action_get_type ())
|
||||
#define CLUTTER_DROP_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_DROP_ACTION, ClutterDropAction))
|
||||
#define CLUTTER_IS_DROP_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_DROP_ACTION))
|
||||
#define CLUTTER_DROP_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_DROP_ACTION, ClutterDropActionClass))
|
||||
#define CLUTTER_IS_DROP_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_DROP_ACTION))
|
||||
#define CLUTTER_DROP_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_DROP_ACTION, ClutterDropActionClass))
|
||||
|
||||
typedef struct _ClutterDropAction ClutterDropAction;
|
||||
typedef struct _ClutterDropActionPrivate ClutterDropActionPrivate;
|
||||
typedef struct _ClutterDropActionClass ClutterDropActionClass;
|
||||
|
||||
/**
|
||||
* ClutterDropAction:
|
||||
*
|
||||
* The #ClutterDropAction structure contains only
|
||||
* private data and should be accessed using the provided API.
|
||||
*
|
||||
* Since: 1.8
|
||||
*/
|
||||
struct _ClutterDropAction
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterAction parent_instance;
|
||||
|
||||
ClutterDropActionPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterDropActionClass:
|
||||
* @can_drop: class handler for the #ClutterDropAction::can-drop signal
|
||||
* @over_in: class handler for the #ClutterDropAction::over-in signal
|
||||
* @over_out: class handler for the #ClutterDropAction::over-out signal
|
||||
* @drop: class handler for the #ClutterDropAction::drop signal
|
||||
*
|
||||
* The #ClutterDropActionClass structure contains
|
||||
* only private data.
|
||||
*
|
||||
* Since: 1.8
|
||||
*/
|
||||
struct _ClutterDropActionClass
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterActionClass parent_class;
|
||||
|
||||
/*< public >*/
|
||||
gboolean (* can_drop) (ClutterDropAction *action,
|
||||
ClutterActor *actor,
|
||||
gfloat event_x,
|
||||
gfloat event_y);
|
||||
|
||||
void (* over_in) (ClutterDropAction *action,
|
||||
ClutterActor *actor);
|
||||
void (* over_out) (ClutterDropAction *action,
|
||||
ClutterActor *actor);
|
||||
|
||||
void (* drop) (ClutterDropAction *action,
|
||||
ClutterActor *actor,
|
||||
gfloat event_x,
|
||||
gfloat event_y);
|
||||
|
||||
/*< private >*/
|
||||
void (*_clutter_drop_action1) (void);
|
||||
void (*_clutter_drop_action2) (void);
|
||||
void (*_clutter_drop_action3) (void);
|
||||
void (*_clutter_drop_action4) (void);
|
||||
void (*_clutter_drop_action5) (void);
|
||||
void (*_clutter_drop_action6) (void);
|
||||
void (*_clutter_drop_action7) (void);
|
||||
void (*_clutter_drop_action8) (void);
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_drop_action_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterAction * clutter_drop_action_new (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_DROP_ACTION_H__ */
|
@ -5,18 +5,15 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
gboolean _clutter_effect_pre_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context);
|
||||
void _clutter_effect_post_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context);
|
||||
gboolean _clutter_effect_pre_paint (ClutterEffect *effect);
|
||||
void _clutter_effect_post_paint (ClutterEffect *effect);
|
||||
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,
|
||||
ClutterPaintContext *paint_context,
|
||||
ClutterEffectPaintFlags flags);
|
||||
void _clutter_effect_pick (ClutterEffect *effect,
|
||||
ClutterPickContext *pick_context);
|
||||
ClutterEffectPaintFlags flags);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -100,13 +100,13 @@
|
||||
* // Clear the previous state //
|
||||
* if (self->rect_1)
|
||||
* {
|
||||
* cogl_object_unref (self->rect_1);
|
||||
* cogl_handle_unref (self->rect_1);
|
||||
* self->rect_1 = NULL;
|
||||
* }
|
||||
*
|
||||
* if (self->rect_2)
|
||||
* {
|
||||
* cogl_object_unref (self->rect_2);
|
||||
* cogl_handle_unref (self->rect_2);
|
||||
* self->rect_2 = NULL;
|
||||
* }
|
||||
*
|
||||
@ -177,15 +177,13 @@ G_DEFINE_ABSTRACT_TYPE (ClutterEffect,
|
||||
CLUTTER_TYPE_ACTOR_META);
|
||||
|
||||
static gboolean
|
||||
clutter_effect_real_pre_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_effect_real_pre_paint (ClutterEffect *effect)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_effect_real_post_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_effect_real_post_paint (ClutterEffect *effect)
|
||||
{
|
||||
}
|
||||
|
||||
@ -198,7 +196,6 @@ clutter_effect_real_modify_paint_volume (ClutterEffect *effect,
|
||||
|
||||
static void
|
||||
clutter_effect_real_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context,
|
||||
ClutterEffectPaintFlags flags)
|
||||
{
|
||||
ClutterActorMeta *actor_meta = CLUTTER_ACTOR_META (effect);
|
||||
@ -209,47 +206,49 @@ clutter_effect_real_paint (ClutterEffect *effect,
|
||||
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 = _clutter_effect_pre_paint (effect, paint_context);
|
||||
pre_paint_succeeded = _clutter_effect_pre_paint (effect);
|
||||
|
||||
actor = clutter_actor_meta_get_actor (actor_meta);
|
||||
clutter_actor_continue_paint (actor, paint_context);
|
||||
clutter_actor_continue_paint (actor);
|
||||
|
||||
if (pre_paint_succeeded)
|
||||
_clutter_effect_post_paint (effect, paint_context);
|
||||
_clutter_effect_post_paint (effect);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_effect_real_pick (ClutterEffect *effect,
|
||||
ClutterPickContext *pick_context)
|
||||
clutter_effect_real_pick (ClutterEffect *effect,
|
||||
ClutterEffectPaintFlags flags)
|
||||
{
|
||||
ClutterActorMeta *actor_meta = CLUTTER_ACTOR_META (effect);
|
||||
ClutterActor *actor;
|
||||
|
||||
actor = clutter_actor_meta_get_actor (actor_meta);
|
||||
clutter_actor_continue_pick (actor, pick_context);
|
||||
clutter_actor_continue_paint (actor);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_effect_set_enabled (ClutterActorMeta *meta,
|
||||
gboolean is_enabled)
|
||||
clutter_effect_notify (GObject *gobject,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterActorMetaClass *parent_class =
|
||||
CLUTTER_ACTOR_META_CLASS (clutter_effect_parent_class);
|
||||
ClutterActor *actor;
|
||||
if (strcmp (pspec->name, "enabled") == 0)
|
||||
{
|
||||
ClutterActorMeta *meta = CLUTTER_ACTOR_META (gobject);
|
||||
ClutterActor *actor = clutter_actor_meta_get_actor (meta);
|
||||
|
||||
actor = clutter_actor_meta_get_actor (meta);
|
||||
if (actor)
|
||||
clutter_actor_queue_redraw (actor);
|
||||
if (actor != NULL)
|
||||
clutter_actor_queue_redraw (actor);
|
||||
}
|
||||
|
||||
parent_class->set_enabled (meta, is_enabled);
|
||||
if (G_OBJECT_CLASS (clutter_effect_parent_class)->notify != NULL)
|
||||
G_OBJECT_CLASS (clutter_effect_parent_class)->notify (gobject, pspec);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_effect_class_init (ClutterEffectClass *klass)
|
||||
{
|
||||
ClutterActorMetaClass *actor_meta_class = CLUTTER_ACTOR_META_CLASS (klass);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
actor_meta_class->set_enabled = clutter_effect_set_enabled;
|
||||
gobject_class->notify = clutter_effect_notify;
|
||||
|
||||
klass->pre_paint = clutter_effect_real_pre_paint;
|
||||
klass->post_paint = clutter_effect_real_post_paint;
|
||||
@ -264,40 +263,37 @@ clutter_effect_init (ClutterEffect *self)
|
||||
}
|
||||
|
||||
gboolean
|
||||
_clutter_effect_pre_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
_clutter_effect_pre_paint (ClutterEffect *effect)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_EFFECT (effect), FALSE);
|
||||
|
||||
return CLUTTER_EFFECT_GET_CLASS (effect)->pre_paint (effect, paint_context);
|
||||
return CLUTTER_EFFECT_GET_CLASS (effect)->pre_paint (effect);
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_effect_post_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
_clutter_effect_post_paint (ClutterEffect *effect)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_EFFECT (effect));
|
||||
|
||||
CLUTTER_EFFECT_GET_CLASS (effect)->post_paint (effect, paint_context);
|
||||
CLUTTER_EFFECT_GET_CLASS (effect)->post_paint (effect);
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_effect_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context,
|
||||
ClutterEffectPaintFlags flags)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_EFFECT (effect));
|
||||
|
||||
CLUTTER_EFFECT_GET_CLASS (effect)->paint (effect, paint_context, flags);
|
||||
CLUTTER_EFFECT_GET_CLASS (effect)->paint (effect, flags);
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_effect_pick (ClutterEffect *effect,
|
||||
ClutterPickContext *pick_context)
|
||||
_clutter_effect_pick (ClutterEffect *effect,
|
||||
ClutterEffectPaintFlags flags)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_EFFECT (effect));
|
||||
|
||||
CLUTTER_EFFECT_GET_CLASS (effect)->pick (effect, pick_context);
|
||||
CLUTTER_EFFECT_GET_CLASS (effect)->pick (effect, flags);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -30,8 +30,6 @@
|
||||
#endif
|
||||
|
||||
#include <clutter/clutter-actor-meta.h>
|
||||
#include <clutter/clutter-paint-context.h>
|
||||
#include <clutter/clutter-pick-context.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@ -76,19 +74,16 @@ struct _ClutterEffectClass
|
||||
ClutterActorMetaClass parent_class;
|
||||
|
||||
/*< public >*/
|
||||
gboolean (* pre_paint) (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context);
|
||||
void (* post_paint) (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context);
|
||||
gboolean (* pre_paint) (ClutterEffect *effect);
|
||||
void (* post_paint) (ClutterEffect *effect);
|
||||
|
||||
gboolean (* modify_paint_volume) (ClutterEffect *effect,
|
||||
ClutterPaintVolume *volume);
|
||||
|
||||
void (* paint) (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context,
|
||||
ClutterEffectPaintFlags flags);
|
||||
void (* pick) (ClutterEffect *effect,
|
||||
ClutterPickContext *pick_context);
|
||||
ClutterEffectPaintFlags flags);
|
||||
|
||||
/*< private >*/
|
||||
void (* _clutter_effect4) (void);
|
||||
|
@ -190,7 +190,7 @@ typedef enum /*< prefix=CLUTTER_REQUEST >*/
|
||||
* @CLUTTER_ANIMATION_LAST: last animation mode, used as a guard for
|
||||
* registered global alpha functions
|
||||
*
|
||||
* The animation modes used by #ClutterAnimatable. This
|
||||
* The animation modes used by #ClutterAlpha and #ClutterAnimation. This
|
||||
* enumeration can be expanded in later versions of Clutter.
|
||||
*
|
||||
* <figure id="easing-modes">
|
||||
@ -387,6 +387,44 @@ typedef enum
|
||||
CLUTTER_MODIFIER_MASK = 0x5c001fff
|
||||
} ClutterModifierType;
|
||||
|
||||
/**
|
||||
* ClutterKeyboardA11yFlags:
|
||||
* @CLUTTER_A11Y_KEYBOARD_ENABLED:
|
||||
* @CLUTTER_A11Y_TIMEOUT_ENABLED:
|
||||
* @CLUTTER_A11Y_MOUSE_KEYS_ENABLED:
|
||||
* @CLUTTER_A11Y_SLOW_KEYS_ENABLED:
|
||||
* @CLUTTER_A11Y_SLOW_KEYS_BEEP_PRESS:
|
||||
* @CLUTTER_A11Y_SLOW_KEYS_BEEP_ACCEPT:
|
||||
* @CLUTTER_A11Y_SLOW_KEYS_BEEP_REJECT:
|
||||
* @CLUTTER_A11Y_BOUNCE_KEYS_ENABLED:
|
||||
* @CLUTTER_A11Y_BOUNCE_KEYS_BEEP_REJECT:
|
||||
* @CLUTTER_A11Y_TOGGLE_KEYS_ENABLED:
|
||||
* @CLUTTER_A11Y_STICKY_KEYS_ENABLED:
|
||||
* @CLUTTER_A11Y_STICKY_KEYS_TWO_KEY_OFF:
|
||||
* @CLUTTER_A11Y_STICKY_KEYS_BEEP:
|
||||
* @CLUTTER_A11Y_FEATURE_STATE_CHANGE_BEEP:
|
||||
*
|
||||
* Keyboard accessibility features applied to a ClutterInputDevice keyboard.
|
||||
*
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
CLUTTER_A11Y_KEYBOARD_ENABLED = 1 << 0,
|
||||
CLUTTER_A11Y_TIMEOUT_ENABLED = 1 << 1,
|
||||
CLUTTER_A11Y_MOUSE_KEYS_ENABLED = 1 << 2,
|
||||
CLUTTER_A11Y_SLOW_KEYS_ENABLED = 1 << 3,
|
||||
CLUTTER_A11Y_SLOW_KEYS_BEEP_PRESS = 1 << 4,
|
||||
CLUTTER_A11Y_SLOW_KEYS_BEEP_ACCEPT = 1 << 5,
|
||||
CLUTTER_A11Y_SLOW_KEYS_BEEP_REJECT = 1 << 6,
|
||||
CLUTTER_A11Y_BOUNCE_KEYS_ENABLED = 1 << 7,
|
||||
CLUTTER_A11Y_BOUNCE_KEYS_BEEP_REJECT = 1 << 8,
|
||||
CLUTTER_A11Y_TOGGLE_KEYS_ENABLED = 1 << 9,
|
||||
CLUTTER_A11Y_STICKY_KEYS_ENABLED = 1 << 10,
|
||||
CLUTTER_A11Y_STICKY_KEYS_TWO_KEY_OFF = 1 << 11,
|
||||
CLUTTER_A11Y_STICKY_KEYS_BEEP = 1 << 12,
|
||||
CLUTTER_A11Y_FEATURE_STATE_CHANGE_BEEP = 1 << 13,
|
||||
} ClutterKeyboardA11yFlags;
|
||||
|
||||
/**
|
||||
* ClutterPointerA11yFlags:
|
||||
* @CLUTTER_A11Y_POINTER_ENABLED:
|
||||
@ -497,13 +535,9 @@ typedef enum /*< prefix=CLUTTER_ACTOR >*/
|
||||
* ClutterOffscreenRedirect:
|
||||
* @CLUTTER_OFFSCREEN_REDIRECT_AUTOMATIC_FOR_OPACITY: Only redirect
|
||||
* the actor if it is semi-transparent and its has_overlaps()
|
||||
* virtual returns %TRUE.
|
||||
* virtual returns %TRUE. This is the default.
|
||||
* @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().
|
||||
*
|
||||
@ -511,11 +545,36 @@ typedef enum /*< prefix=CLUTTER_ACTOR >*/
|
||||
*/
|
||||
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
|
||||
CLUTTER_OFFSCREEN_REDIRECT_AUTOMATIC_FOR_OPACITY = 1<<0,
|
||||
CLUTTER_OFFSCREEN_REDIRECT_ALWAYS = 1<<1
|
||||
} ClutterOffscreenRedirect;
|
||||
|
||||
/**
|
||||
* ClutterAllocationFlags:
|
||||
* @CLUTTER_ALLOCATION_NONE: No flag set
|
||||
* @CLUTTER_ABSOLUTE_ORIGIN_CHANGED: Whether the absolute origin of the
|
||||
* actor has changed; this implies that any ancestor of the actor has
|
||||
* been moved.
|
||||
* @CLUTTER_DELEGATE_LAYOUT: Whether the allocation should be delegated
|
||||
* to the #ClutterLayoutManager instance stored inside the
|
||||
* #ClutterActor:layout-manager property of #ClutterActor. This flag
|
||||
* should only be used if you are subclassing #ClutterActor and
|
||||
* overriding the #ClutterActorClass.allocate() virtual function, but
|
||||
* you wish to use the default implementation of the virtual function
|
||||
* inside #ClutterActor. Added in Clutter 1.10.
|
||||
*
|
||||
* Flags passed to the #ClutterActorClass.allocate() virtual function
|
||||
* and to the clutter_actor_allocate() function.
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
CLUTTER_ALLOCATION_NONE = 0,
|
||||
CLUTTER_ABSOLUTE_ORIGIN_CHANGED = 1 << 1,
|
||||
CLUTTER_DELEGATE_LAYOUT = 1 << 2
|
||||
} ClutterAllocationFlags;
|
||||
|
||||
/**
|
||||
* ClutterAlignAxis:
|
||||
* @CLUTTER_ALIGN_X_AXIS: Maintain the alignment on the X axis
|
||||
@ -614,15 +673,12 @@ typedef enum /*< prefix=CLUTTER_BIND >*/
|
||||
* 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)
|
||||
CLUTTER_EFFECT_PAINT_ACTOR_DIRTY = (1 << 0)
|
||||
} ClutterEffectPaintFlags;
|
||||
|
||||
/**
|
||||
@ -819,6 +875,7 @@ typedef enum /*< flags prefix=CLUTTER_EVENT >*/
|
||||
* @CLUTTER_STAGE_STATE: Stage state change event
|
||||
* @CLUTTER_DESTROY_NOTIFY: Destroy notification event
|
||||
* @CLUTTER_CLIENT_MESSAGE: Client message event
|
||||
* @CLUTTER_DELETE: Stage delete 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;
|
||||
@ -856,6 +913,7 @@ typedef enum /*< prefix=CLUTTER >*/
|
||||
CLUTTER_STAGE_STATE,
|
||||
CLUTTER_DESTROY_NOTIFY,
|
||||
CLUTTER_CLIENT_MESSAGE,
|
||||
CLUTTER_DELETE,
|
||||
CLUTTER_TOUCH_BEGIN,
|
||||
CLUTTER_TOUCH_UPDATE,
|
||||
CLUTTER_TOUCH_END,
|
||||
@ -868,8 +926,6 @@ typedef enum /*< prefix=CLUTTER >*/
|
||||
CLUTTER_PAD_BUTTON_RELEASE,
|
||||
CLUTTER_PAD_STRIP,
|
||||
CLUTTER_PAD_RING,
|
||||
CLUTTER_DEVICE_ADDED,
|
||||
CLUTTER_DEVICE_REMOVED,
|
||||
|
||||
CLUTTER_EVENT_LAST /* helper */
|
||||
} ClutterEventType;
|
||||
@ -913,6 +969,9 @@ typedef enum
|
||||
|
||||
/**
|
||||
* ClutterFeatureFlags:
|
||||
* @CLUTTER_FEATURE_SWAP_THROTTLE: Set if backend throttles buffer swaps.
|
||||
* @CLUTTER_FEATURE_TEXTURE_YUV: Set if YUV based textures supported.
|
||||
* @CLUTTER_FEATURE_TEXTURE_READ_PIXELS: Set if texture pixels can be read.
|
||||
* @CLUTTER_FEATURE_STAGE_STATIC: Set if stage size if fixed (i.e framebuffer)
|
||||
* @CLUTTER_FEATURE_STAGE_CURSOR: Set if stage has a graphical cursor.
|
||||
* @CLUTTER_FEATURE_SHADERS_GLSL: Set if the backend supports GLSL shaders.
|
||||
@ -927,6 +986,9 @@ typedef enum
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
CLUTTER_FEATURE_SWAP_THROTTLE = (1 << 3),
|
||||
CLUTTER_FEATURE_TEXTURE_YUV = (1 << 4),
|
||||
CLUTTER_FEATURE_TEXTURE_READ_PIXELS = (1 << 5),
|
||||
CLUTTER_FEATURE_STAGE_STATIC = (1 << 6),
|
||||
CLUTTER_FEATURE_STAGE_CURSOR = (1 << 8),
|
||||
CLUTTER_FEATURE_SHADERS_GLSL = (1 << 9),
|
||||
@ -1125,6 +1187,29 @@ typedef enum /*< prefix=CLUTTER_PAN >*/
|
||||
CLUTTER_PAN_AXIS_AUTO
|
||||
} ClutterPanAxis;
|
||||
|
||||
|
||||
/**
|
||||
* ClutterTableAlignment:
|
||||
* @CLUTTER_TABLE_ALIGNMENT_START: Align the child to the top or to the
|
||||
* left of a cell in the table, depending on the axis
|
||||
* @CLUTTER_TABLE_ALIGNMENT_CENTER: Align the child to the center of
|
||||
* a cell in the table
|
||||
* @CLUTTER_TABLE_ALIGNMENT_END: Align the child to the bottom or to the
|
||||
* right of a cell in the table, depending on the axis
|
||||
*
|
||||
* The alignment policies available on each axis of the #ClutterTableLayout
|
||||
*
|
||||
* Since: 1.4
|
||||
*
|
||||
* Deprecated: 1.22: Use the alignment properties of #ClutterActor
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
CLUTTER_TABLE_ALIGNMENT_START,
|
||||
CLUTTER_TABLE_ALIGNMENT_CENTER,
|
||||
CLUTTER_TABLE_ALIGNMENT_END
|
||||
} ClutterTableAlignment;
|
||||
|
||||
/**
|
||||
* ClutterTextureFlags:
|
||||
* @CLUTTER_TEXTURE_NONE: No flags
|
||||
@ -1132,7 +1217,8 @@ typedef enum /*< prefix=CLUTTER_PAN >*/
|
||||
* @CLUTTER_TEXTURE_RGB_FLAG_PREMULT: Unused flag
|
||||
* @CLUTTER_TEXTURE_YUV_FLAG_YUV2: Unused flag
|
||||
*
|
||||
* Flags for clutter_texture_set_from_rgb_data().
|
||||
* Flags for clutter_texture_set_from_rgb_data() and
|
||||
* clutter_texture_set_from_yuv_data().
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
@ -1277,6 +1363,8 @@ typedef enum
|
||||
* painting the stages
|
||||
* @CLUTTER_REPAINT_FLAGS_POST_PAINT: Run the repaint function after
|
||||
* painting the stages
|
||||
* @CLUTTER_REPAINT_FLAGS_QUEUE_REDRAW_ON_ADD: Ensure that a new frame
|
||||
* is queued after adding the repaint function
|
||||
*
|
||||
* Flags to pass to clutter_threads_add_repaint_func_full().
|
||||
*
|
||||
@ -1286,6 +1374,7 @@ typedef enum
|
||||
{
|
||||
CLUTTER_REPAINT_FLAGS_PRE_PAINT = 1 << 0,
|
||||
CLUTTER_REPAINT_FLAGS_POST_PAINT = 1 << 1,
|
||||
CLUTTER_REPAINT_FLAGS_QUEUE_REDRAW_ON_ADD = 1 << 2
|
||||
} ClutterRepaintFlags;
|
||||
|
||||
/**
|
||||
@ -1594,6 +1683,12 @@ typedef enum
|
||||
CLUTTER_INPUT_DEVICE_PAD_SOURCE_FINGER,
|
||||
} ClutterInputDevicePadSource;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE,
|
||||
CLUTTER_INPUT_DEVICE_MAPPING_RELATIVE,
|
||||
} ClutterInputDeviceMapping;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CLUTTER_INPUT_CONTENT_HINT_COMPLETION = 1 << 0,
|
||||
|
@ -370,7 +370,7 @@ clutter_event_get_coords (const ClutterEvent *event,
|
||||
gfloat *x,
|
||||
gfloat *y)
|
||||
{
|
||||
graphene_point_t coords;
|
||||
ClutterPoint coords;
|
||||
|
||||
g_return_if_fail (event != NULL);
|
||||
|
||||
@ -386,15 +386,15 @@ clutter_event_get_coords (const ClutterEvent *event,
|
||||
/**
|
||||
* clutter_event_get_position:
|
||||
* @event: a #ClutterEvent
|
||||
* @position: a #graphene_point_t
|
||||
* @position: a #ClutterPoint
|
||||
*
|
||||
* Retrieves the event coordinates as a #graphene_point_t.
|
||||
* Retrieves the event coordinates as a #ClutterPoint.
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
void
|
||||
clutter_event_get_position (const ClutterEvent *event,
|
||||
graphene_point_t *position)
|
||||
ClutterPoint *position)
|
||||
{
|
||||
g_return_if_fail (event != NULL);
|
||||
g_return_if_fail (position != NULL);
|
||||
@ -407,6 +407,7 @@ clutter_event_get_position (const ClutterEvent *event,
|
||||
case CLUTTER_STAGE_STATE:
|
||||
case CLUTTER_DESTROY_NOTIFY:
|
||||
case CLUTTER_CLIENT_MESSAGE:
|
||||
case CLUTTER_DELETE:
|
||||
case CLUTTER_EVENT_LAST:
|
||||
case CLUTTER_PROXIMITY_IN:
|
||||
case CLUTTER_PROXIMITY_OUT:
|
||||
@ -414,44 +415,42 @@ clutter_event_get_position (const ClutterEvent *event,
|
||||
case CLUTTER_PAD_BUTTON_RELEASE:
|
||||
case CLUTTER_PAD_STRIP:
|
||||
case CLUTTER_PAD_RING:
|
||||
case CLUTTER_DEVICE_ADDED:
|
||||
case CLUTTER_DEVICE_REMOVED:
|
||||
graphene_point_init (position, 0.f, 0.f);
|
||||
clutter_point_init (position, 0.f, 0.f);
|
||||
break;
|
||||
|
||||
case CLUTTER_ENTER:
|
||||
case CLUTTER_LEAVE:
|
||||
graphene_point_init (position, event->crossing.x, event->crossing.y);
|
||||
clutter_point_init (position, event->crossing.x, event->crossing.y);
|
||||
break;
|
||||
|
||||
case CLUTTER_BUTTON_PRESS:
|
||||
case CLUTTER_BUTTON_RELEASE:
|
||||
graphene_point_init (position, event->button.x, event->button.y);
|
||||
clutter_point_init (position, event->button.x, event->button.y);
|
||||
break;
|
||||
|
||||
case CLUTTER_MOTION:
|
||||
graphene_point_init (position, event->motion.x, event->motion.y);
|
||||
clutter_point_init (position, event->motion.x, event->motion.y);
|
||||
break;
|
||||
|
||||
case CLUTTER_TOUCH_BEGIN:
|
||||
case CLUTTER_TOUCH_UPDATE:
|
||||
case CLUTTER_TOUCH_END:
|
||||
case CLUTTER_TOUCH_CANCEL:
|
||||
graphene_point_init (position, event->touch.x, event->touch.y);
|
||||
clutter_point_init (position, event->touch.x, event->touch.y);
|
||||
break;
|
||||
|
||||
case CLUTTER_SCROLL:
|
||||
graphene_point_init (position, event->scroll.x, event->scroll.y);
|
||||
clutter_point_init (position, event->scroll.x, event->scroll.y);
|
||||
break;
|
||||
|
||||
case CLUTTER_TOUCHPAD_PINCH:
|
||||
graphene_point_init (position, event->touchpad_pinch.x,
|
||||
event->touchpad_pinch.y);
|
||||
clutter_point_init (position, event->touchpad_pinch.x,
|
||||
event->touchpad_pinch.y);
|
||||
break;
|
||||
|
||||
case CLUTTER_TOUCHPAD_SWIPE:
|
||||
graphene_point_init (position, event->touchpad_swipe.x,
|
||||
event->touchpad_swipe.y);
|
||||
clutter_point_init (position, event->touchpad_swipe.x,
|
||||
event->touchpad_swipe.y);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -482,6 +481,7 @@ clutter_event_set_coords (ClutterEvent *event,
|
||||
case CLUTTER_STAGE_STATE:
|
||||
case CLUTTER_DESTROY_NOTIFY:
|
||||
case CLUTTER_CLIENT_MESSAGE:
|
||||
case CLUTTER_DELETE:
|
||||
case CLUTTER_EVENT_LAST:
|
||||
case CLUTTER_PROXIMITY_IN:
|
||||
case CLUTTER_PROXIMITY_OUT:
|
||||
@ -489,8 +489,6 @@ clutter_event_set_coords (ClutterEvent *event,
|
||||
case CLUTTER_PAD_BUTTON_RELEASE:
|
||||
case CLUTTER_PAD_STRIP:
|
||||
case CLUTTER_PAD_RING:
|
||||
case CLUTTER_DEVICE_ADDED:
|
||||
case CLUTTER_DEVICE_REMOVED:
|
||||
break;
|
||||
|
||||
case CLUTTER_ENTER:
|
||||
@ -1107,6 +1105,7 @@ clutter_event_set_device (ClutterEvent *event,
|
||||
case CLUTTER_STAGE_STATE:
|
||||
case CLUTTER_DESTROY_NOTIFY:
|
||||
case CLUTTER_CLIENT_MESSAGE:
|
||||
case CLUTTER_DELETE:
|
||||
case CLUTTER_EVENT_LAST:
|
||||
break;
|
||||
|
||||
@ -1162,11 +1161,6 @@ clutter_event_set_device (ClutterEvent *event,
|
||||
case CLUTTER_PAD_RING:
|
||||
event->pad_ring.device = device;
|
||||
break;
|
||||
|
||||
case CLUTTER_DEVICE_ADDED:
|
||||
case CLUTTER_DEVICE_REMOVED:
|
||||
event->device.device = device;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1208,6 +1202,7 @@ clutter_event_get_device (const ClutterEvent *event)
|
||||
case CLUTTER_STAGE_STATE:
|
||||
case CLUTTER_DESTROY_NOTIFY:
|
||||
case CLUTTER_CLIENT_MESSAGE:
|
||||
case CLUTTER_DELETE:
|
||||
case CLUTTER_EVENT_LAST:
|
||||
break;
|
||||
|
||||
@ -1263,11 +1258,6 @@ clutter_event_get_device (const ClutterEvent *event)
|
||||
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;
|
||||
@ -1421,8 +1411,6 @@ clutter_event_copy (const ClutterEvent *event)
|
||||
sizeof (gdouble) * n_axes);
|
||||
break;
|
||||
|
||||
case CLUTTER_DEVICE_ADDED:
|
||||
case CLUTTER_DEVICE_REMOVED:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -1477,9 +1465,6 @@ clutter_event_free (ClutterEvent *event)
|
||||
case CLUTTER_TOUCH_CANCEL:
|
||||
g_free (event->touch.axes);
|
||||
break;
|
||||
case CLUTTER_DEVICE_ADDED:
|
||||
case CLUTTER_DEVICE_REMOVED:
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
@ -1504,17 +1489,40 @@ ClutterEvent *
|
||||
clutter_event_get (void)
|
||||
{
|
||||
ClutterMainContext *context = _clutter_context_get_default ();
|
||||
ClutterEvent *event;
|
||||
|
||||
event = g_async_queue_try_pop (context->events_queue);
|
||||
if (context->events_queue == NULL)
|
||||
return NULL;
|
||||
|
||||
return event;
|
||||
if (g_queue_is_empty (context->events_queue))
|
||||
return NULL;
|
||||
|
||||
return g_queue_pop_tail (context->events_queue);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
spin_context (gpointer data)
|
||||
/**
|
||||
* clutter_event_peek:
|
||||
*
|
||||
* Returns a pointer to the first event from the event queue but
|
||||
* does not remove it.
|
||||
*
|
||||
* Return value: (transfer none): A #ClutterEvent or NULL if queue empty.
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
ClutterEvent *
|
||||
clutter_event_peek (void)
|
||||
{
|
||||
return G_SOURCE_REMOVE;
|
||||
ClutterMainContext *context = _clutter_context_get_default ();
|
||||
|
||||
g_return_val_if_fail (context != NULL, NULL);
|
||||
|
||||
if (context->events_queue == NULL)
|
||||
return NULL;
|
||||
|
||||
if (g_queue_is_empty (context->events_queue))
|
||||
return NULL;
|
||||
|
||||
return g_queue_peek_tail (context->events_queue);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1522,9 +1530,21 @@ _clutter_event_push (const ClutterEvent *event,
|
||||
gboolean do_copy)
|
||||
{
|
||||
ClutterMainContext *context = _clutter_context_get_default ();
|
||||
ClutterInputDevice *device;
|
||||
|
||||
g_assert (context != NULL);
|
||||
|
||||
if (context->events_queue == NULL)
|
||||
context->events_queue = g_queue_new ();
|
||||
|
||||
/* disabled devices don't propagate events */
|
||||
device = clutter_event_get_device (event);
|
||||
if (device != NULL)
|
||||
{
|
||||
if (!clutter_input_device_get_enabled (device))
|
||||
return;
|
||||
}
|
||||
|
||||
if (do_copy)
|
||||
{
|
||||
ClutterEvent *copy;
|
||||
@ -1533,8 +1553,7 @@ _clutter_event_push (const ClutterEvent *event,
|
||||
event = copy;
|
||||
}
|
||||
|
||||
g_async_queue_push (context->events_queue, (gpointer) event);
|
||||
g_idle_add (spin_context, NULL);
|
||||
g_queue_push_head (context->events_queue, (gpointer) event);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1571,7 +1590,10 @@ clutter_events_pending (void)
|
||||
|
||||
g_return_val_if_fail (context != NULL, FALSE);
|
||||
|
||||
return g_async_queue_length (context->events_queue) > 0;
|
||||
if (context->events_queue == NULL)
|
||||
return FALSE;
|
||||
|
||||
return g_queue_is_empty (context->events_queue) == FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1703,6 +1725,7 @@ clutter_event_get_axes (const ClutterEvent *event,
|
||||
case CLUTTER_STAGE_STATE:
|
||||
case CLUTTER_DESTROY_NOTIFY:
|
||||
case CLUTTER_CLIENT_MESSAGE:
|
||||
case CLUTTER_DELETE:
|
||||
case CLUTTER_ENTER:
|
||||
case CLUTTER_LEAVE:
|
||||
case CLUTTER_KEY_PRESS:
|
||||
@ -1710,8 +1733,6 @@ clutter_event_get_axes (const ClutterEvent *event,
|
||||
case CLUTTER_EVENT_LAST:
|
||||
case CLUTTER_PROXIMITY_IN:
|
||||
case CLUTTER_PROXIMITY_OUT:
|
||||
case CLUTTER_DEVICE_ADDED:
|
||||
case CLUTTER_DEVICE_REMOVED:
|
||||
break;
|
||||
|
||||
case CLUTTER_SCROLL:
|
||||
@ -1775,12 +1796,12 @@ float
|
||||
clutter_event_get_distance (const ClutterEvent *source,
|
||||
const ClutterEvent *target)
|
||||
{
|
||||
graphene_point_t p0, p1;
|
||||
ClutterPoint p0, p1;
|
||||
|
||||
clutter_event_get_position (source, &p0);
|
||||
clutter_event_get_position (source, &p1);
|
||||
|
||||
return graphene_point_distance (&p0, &p1, NULL, NULL);
|
||||
return clutter_point_distance (&p0, &p1, NULL, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1801,17 +1822,17 @@ double
|
||||
clutter_event_get_angle (const ClutterEvent *source,
|
||||
const ClutterEvent *target)
|
||||
{
|
||||
graphene_point_t p0, p1;
|
||||
ClutterPoint p0, p1;
|
||||
float x_distance, y_distance;
|
||||
double angle;
|
||||
|
||||
clutter_event_get_position (source, &p0);
|
||||
clutter_event_get_position (target, &p1);
|
||||
|
||||
if (graphene_point_equal (&p0, &p1))
|
||||
if (clutter_point_equals (&p0, &p1))
|
||||
return 0;
|
||||
|
||||
graphene_point_distance (&p0, &p1, &x_distance, &y_distance);
|
||||
clutter_point_distance (&p0, &p1, &x_distance, &y_distance);
|
||||
|
||||
angle = atan2 (x_distance, y_distance);
|
||||
|
||||
@ -2140,9 +2161,9 @@ clutter_event_get_scroll_source (const ClutterEvent *event)
|
||||
ClutterScrollFinishFlags
|
||||
clutter_event_get_scroll_finish_flags (const ClutterEvent *event)
|
||||
{
|
||||
g_return_val_if_fail (event != NULL, CLUTTER_SCROLL_FINISHED_NONE);
|
||||
g_return_val_if_fail (event != NULL, CLUTTER_SCROLL_SOURCE_UNKNOWN);
|
||||
g_return_val_if_fail (event->type == CLUTTER_SCROLL,
|
||||
CLUTTER_SCROLL_FINISHED_NONE);
|
||||
CLUTTER_SCROLL_SOURCE_UNKNOWN);
|
||||
|
||||
return event->scroll.finish_flags;
|
||||
}
|
||||
|
@ -121,7 +121,6 @@ typedef struct _ClutterProximityEvent ClutterProximityEvent;
|
||||
typedef struct _ClutterPadButtonEvent ClutterPadButtonEvent;
|
||||
typedef struct _ClutterPadStripEvent ClutterPadStripEvent;
|
||||
typedef struct _ClutterPadRingEvent ClutterPadRingEvent;
|
||||
typedef struct _ClutterDeviceEvent ClutterDeviceEvent;
|
||||
|
||||
/**
|
||||
* ClutterAnyEvent:
|
||||
@ -545,17 +544,6 @@ struct _ClutterPadRingEvent
|
||||
guint32 mode;
|
||||
};
|
||||
|
||||
struct _ClutterDeviceEvent
|
||||
{
|
||||
ClutterEventType type;
|
||||
guint32 time;
|
||||
ClutterEventFlags flags;
|
||||
ClutterStage *stage;
|
||||
ClutterActor *source;
|
||||
|
||||
ClutterInputDevice *device;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterEvent:
|
||||
*
|
||||
@ -582,7 +570,6 @@ union _ClutterEvent
|
||||
ClutterPadButtonEvent pad_button;
|
||||
ClutterPadStripEvent pad_strip;
|
||||
ClutterPadRingEvent pad_ring;
|
||||
ClutterDeviceEvent device;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -614,6 +601,8 @@ gboolean clutter_events_pending (void);
|
||||
CLUTTER_EXPORT
|
||||
ClutterEvent * clutter_event_get (void);
|
||||
CLUTTER_EXPORT
|
||||
ClutterEvent * clutter_event_peek (void);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_event_put (const ClutterEvent *event);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
@ -697,7 +686,7 @@ void clutter_event_get_coords (const ClutterEv
|
||||
gfloat *y);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_event_get_position (const ClutterEvent *event,
|
||||
graphene_point_t *position);
|
||||
ClutterPoint *position);
|
||||
CLUTTER_EXPORT
|
||||
float clutter_event_get_distance (const ClutterEvent *source,
|
||||
const ClutterEvent *target);
|
||||
|
@ -33,6 +33,8 @@
|
||||
*
|
||||
* It is possible to ask whether Clutter has support for specific features at
|
||||
* run-time.
|
||||
*
|
||||
* See also cogl_get_features() and #CoglFeatureFlags
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
@ -58,13 +60,20 @@ typedef struct ClutterFeatures
|
||||
static ClutterFeatures* __features = NULL;
|
||||
|
||||
static ClutterFeatureFlags
|
||||
clutter_features_from_cogl (void)
|
||||
clutter_features_from_cogl (guint cogl_flags)
|
||||
{
|
||||
ClutterFeatureFlags clutter_flags = 0;
|
||||
|
||||
if (cogl_flags & COGL_FEATURE_TEXTURE_YUV)
|
||||
clutter_flags |= CLUTTER_FEATURE_TEXTURE_YUV;
|
||||
|
||||
if (cogl_flags & COGL_FEATURE_TEXTURE_READ_PIXELS)
|
||||
clutter_flags |= CLUTTER_FEATURE_TEXTURE_READ_PIXELS;
|
||||
|
||||
clutter_flags |= CLUTTER_FEATURE_SHADERS_GLSL;
|
||||
|
||||
clutter_flags |= CLUTTER_FEATURE_OFFSCREEN;
|
||||
if (cogl_flags & COGL_FEATURE_OFFSCREEN)
|
||||
clutter_flags |= CLUTTER_FEATURE_OFFSCREEN;
|
||||
|
||||
return clutter_flags;
|
||||
}
|
||||
@ -92,7 +101,7 @@ _clutter_feature_init (GError **error)
|
||||
if (!_clutter_backend_create_context (context->backend, error))
|
||||
return FALSE;
|
||||
|
||||
__features->flags = (clutter_features_from_cogl ()
|
||||
__features->flags = (clutter_features_from_cogl (cogl_get_features ())
|
||||
| _clutter_backend_get_features (context->backend));
|
||||
|
||||
__features->features_set = TRUE;
|
||||
|
@ -131,7 +131,8 @@ clutter_fixed_layout_get_preferred_height (ClutterLayoutManager *manager,
|
||||
static void
|
||||
clutter_fixed_layout_allocate (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container,
|
||||
const ClutterActorBox *allocation)
|
||||
const ClutterActorBox *allocation,
|
||||
ClutterAllocationFlags flags)
|
||||
{
|
||||
ClutterActor *child;
|
||||
|
||||
@ -139,11 +140,7 @@ clutter_fixed_layout_allocate (ClutterLayoutManager *manager,
|
||||
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);
|
||||
clutter_actor_allocate_preferred_size (child, flags);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -566,7 +566,8 @@ clutter_flow_layout_get_preferred_height (ClutterLayoutManager *manager,
|
||||
static void
|
||||
clutter_flow_layout_allocate (ClutterLayoutManager *manager,
|
||||
ClutterContainer *container,
|
||||
const ClutterActorBox *allocation)
|
||||
const ClutterActorBox *allocation,
|
||||
ClutterAllocationFlags flags)
|
||||
{
|
||||
ClutterFlowLayoutPrivate *priv = CLUTTER_FLOW_LAYOUT (manager)->priv;
|
||||
ClutterActor *actor, *child;
|
||||
@ -728,7 +729,7 @@ clutter_flow_layout_allocate (ClutterLayoutManager *manager,
|
||||
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);
|
||||
clutter_actor_allocate (child, &child_alloc, flags);
|
||||
|
||||
if (priv->orientation == CLUTTER_FLOW_HORIZONTAL)
|
||||
item_x = new_x;
|
||||
|
@ -1,550 +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-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];
|
||||
|
||||
/* Wait 2ms after vblank before starting to draw next frame */
|
||||
#define SYNC_DELAY_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;
|
||||
ClutterFrameListener listener;
|
||||
|
||||
GSource *source;
|
||||
|
||||
int64_t frame_count;
|
||||
|
||||
ClutterFrameClockState state;
|
||||
int64_t last_presentation_time_us;
|
||||
|
||||
gboolean is_next_presentation_time_valid;
|
||||
int64_t next_presentation_time_us;
|
||||
|
||||
gboolean pending_reschedule;
|
||||
gboolean pending_reschedule_now;
|
||||
|
||||
int inhibit_count;
|
||||
|
||||
GList *timelines;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (ClutterFrameClock, clutter_frame_clock,
|
||||
G_TYPE_OBJECT)
|
||||
|
||||
float
|
||||
clutter_frame_clock_get_refresh_rate (ClutterFrameClock *frame_clock)
|
||||
{
|
||||
return frame_clock->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)
|
||||
{
|
||||
int64_t presentation_time_us = frame_info->presentation_time;
|
||||
|
||||
if (presentation_time_us > frame_clock->last_presentation_time_us ||
|
||||
((presentation_time_us - frame_clock->last_presentation_time_us) >
|
||||
INT64_MAX / 2))
|
||||
{
|
||||
frame_clock->last_presentation_time_us = presentation_time_us;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning_once ("Bogus presentation time %" G_GINT64_FORMAT
|
||||
" travelled back in time, using current time.",
|
||||
presentation_time_us);
|
||||
frame_clock->last_presentation_time_us = g_get_monotonic_time ();
|
||||
}
|
||||
|
||||
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 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;
|
||||
float refresh_rate;
|
||||
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_rate = frame_clock->refresh_rate;
|
||||
refresh_interval_us = (int64_t) (0.5 + G_USEC_PER_SEC / refresh_rate);
|
||||
|
||||
min_render_time_allowed_us = refresh_interval_us / 2;
|
||||
max_render_time_allowed_us = refresh_interval_us - SYNC_DELAY_US;
|
||||
|
||||
if (min_render_time_allowed_us > max_render_time_allowed_us)
|
||||
min_render_time_allowed_us = max_render_time_allowed_us;
|
||||
|
||||
last_presentation_time_us = frame_clock->last_presentation_time_us;
|
||||
next_presentation_time_us = last_presentation_time_us + refresh_interval_us;
|
||||
|
||||
/* Skip ahead to get close to the actual next presentation time. */
|
||||
if (next_presentation_time_us < now_us)
|
||||
{
|
||||
int64_t logical_clock_offset_us;
|
||||
int64_t logical_clock_phase_us;
|
||||
int64_t hw_clock_offset_us;
|
||||
|
||||
logical_clock_offset_us = now_us % refresh_interval_us;
|
||||
logical_clock_phase_us = now_us - logical_clock_offset_us;
|
||||
hw_clock_offset_us = last_presentation_time_us % refresh_interval_us;
|
||||
|
||||
next_presentation_time_us = logical_clock_phase_us + hw_clock_offset_us;
|
||||
}
|
||||
|
||||
/* Skip one interval if we got an early presented event. */
|
||||
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 = TRUE;
|
||||
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;
|
||||
|
||||
COGL_TRACE_BEGIN_SCOPED (ClutterFrameCLockDispatch, "Frame Clock (dispatch)");
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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,
|
||||
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);
|
||||
|
||||
frame_clock->refresh_rate = refresh_rate;
|
||||
|
||||
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);
|
||||
}
|
@ -1,87 +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)
|
||||
|
||||
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,
|
||||
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_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);
|
||||
|
||||
#endif /* CLUTTER_FRAME_CLOCK_H */
|
@ -118,7 +118,7 @@ struct _ClutterGestureActionPrivate
|
||||
gint requested_nb_points;
|
||||
GArray *points;
|
||||
|
||||
gulong actor_capture_id;
|
||||
guint actor_capture_id;
|
||||
gulong stage_capture_id;
|
||||
|
||||
ClutterGestureTriggerEdge edge;
|
||||
@ -157,8 +157,7 @@ G_DEFINE_TYPE_WITH_PRIVATE (ClutterGestureAction, clutter_gesture_action, CLUTTE
|
||||
static GesturePoint *
|
||||
gesture_register_point (ClutterGestureAction *action, ClutterEvent *event)
|
||||
{
|
||||
ClutterGestureActionPrivate *priv =
|
||||
clutter_gesture_action_get_instance_private (action);
|
||||
ClutterGestureActionPrivate *priv = action->priv;
|
||||
GesturePoint *point = NULL;
|
||||
|
||||
if (priv->points->len >= MAX_GESTURE_POINTS)
|
||||
@ -191,8 +190,7 @@ gesture_find_point (ClutterGestureAction *action,
|
||||
ClutterEvent *event,
|
||||
gint *position)
|
||||
{
|
||||
ClutterGestureActionPrivate *priv =
|
||||
clutter_gesture_action_get_instance_private (action);
|
||||
ClutterGestureActionPrivate *priv = action->priv;
|
||||
GesturePoint *point = NULL;
|
||||
ClutterEventType type = clutter_event_type (event);
|
||||
ClutterInputDevice *device = clutter_event_get_device (event);
|
||||
@ -222,10 +220,9 @@ gesture_find_point (ClutterGestureAction *action,
|
||||
static void
|
||||
gesture_unregister_point (ClutterGestureAction *action, gint position)
|
||||
{
|
||||
ClutterGestureActionPrivate *priv =
|
||||
clutter_gesture_action_get_instance_private (action);
|
||||
ClutterGestureActionPrivate *priv = action->priv;
|
||||
|
||||
if (priv->points->len == 0)
|
||||
if (action->priv->points->len == 0)
|
||||
return;
|
||||
|
||||
g_array_remove_index (priv->points, position);
|
||||
@ -306,26 +303,28 @@ gesture_point_unset (GesturePoint *point)
|
||||
static void
|
||||
cancel_gesture (ClutterGestureAction *action)
|
||||
{
|
||||
ClutterGestureActionPrivate *priv =
|
||||
clutter_gesture_action_get_instance_private (action);
|
||||
ClutterGestureActionPrivate *priv = action->priv;
|
||||
ClutterActor *actor;
|
||||
|
||||
priv->in_gesture = FALSE;
|
||||
|
||||
g_clear_signal_handler (&priv->stage_capture_id, priv->stage);
|
||||
if (priv->stage_capture_id != 0)
|
||||
{
|
||||
g_signal_handler_disconnect (priv->stage, priv->stage_capture_id);
|
||||
priv->stage_capture_id = 0;
|
||||
}
|
||||
|
||||
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
|
||||
g_signal_emit (action, gesture_signals[GESTURE_CANCEL], 0, actor);
|
||||
|
||||
g_array_set_size (priv->points, 0);
|
||||
g_array_set_size (action->priv->points, 0);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
begin_gesture (ClutterGestureAction *action,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
ClutterGestureActionPrivate *priv =
|
||||
clutter_gesture_action_get_instance_private (action);
|
||||
ClutterGestureActionPrivate *priv = action->priv;
|
||||
gboolean return_value;
|
||||
|
||||
priv->in_gesture = TRUE;
|
||||
@ -358,8 +357,7 @@ stage_captured_event_cb (ClutterActor *stage,
|
||||
ClutterEvent *event,
|
||||
ClutterGestureAction *action)
|
||||
{
|
||||
ClutterGestureActionPrivate *priv =
|
||||
clutter_gesture_action_get_instance_private (action);
|
||||
ClutterGestureActionPrivate *priv = action->priv;
|
||||
ClutterActor *actor;
|
||||
gint position;
|
||||
float threshold_x, threshold_y;
|
||||
@ -483,8 +481,11 @@ stage_captured_event_cb (ClutterActor *stage,
|
||||
break;
|
||||
}
|
||||
|
||||
if (priv->points->len == 0)
|
||||
g_clear_signal_handler (&priv->stage_capture_id, priv->stage);
|
||||
if (priv->points->len == 0 && priv->stage_capture_id)
|
||||
{
|
||||
g_signal_handler_disconnect (priv->stage, priv->stage_capture_id);
|
||||
priv->stage_capture_id = 0;
|
||||
}
|
||||
|
||||
return CLUTTER_EVENT_PROPAGATE;
|
||||
}
|
||||
@ -494,8 +495,7 @@ actor_captured_event_cb (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
ClutterGestureAction *action)
|
||||
{
|
||||
ClutterGestureActionPrivate *priv =
|
||||
clutter_gesture_action_get_instance_private (action);
|
||||
ClutterGestureActionPrivate *priv = action->priv;
|
||||
GesturePoint *point G_GNUC_UNUSED;
|
||||
|
||||
if ((clutter_event_type (event) != CLUTTER_BUTTON_PRESS) &&
|
||||
@ -529,8 +529,7 @@ static void
|
||||
clutter_gesture_action_set_actor (ClutterActorMeta *meta,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
ClutterGestureActionPrivate *priv =
|
||||
clutter_gesture_action_get_instance_private (CLUTTER_GESTURE_ACTION (meta));
|
||||
ClutterGestureActionPrivate *priv = CLUTTER_GESTURE_ACTION (meta)->priv;
|
||||
ClutterActorMetaClass *meta_class =
|
||||
CLUTTER_ACTOR_META_CLASS (clutter_gesture_action_parent_class);
|
||||
|
||||
@ -539,7 +538,7 @@ clutter_gesture_action_set_actor (ClutterActorMeta *meta,
|
||||
ClutterActor *old_actor = clutter_actor_meta_get_actor (meta);
|
||||
|
||||
if (old_actor != NULL)
|
||||
g_clear_signal_handler (&priv->actor_capture_id, old_actor);
|
||||
g_signal_handler_disconnect (old_actor, priv->actor_capture_id);
|
||||
|
||||
priv->actor_capture_id = 0;
|
||||
}
|
||||
@ -547,7 +546,7 @@ clutter_gesture_action_set_actor (ClutterActorMeta *meta,
|
||||
if (priv->stage_capture_id != 0)
|
||||
{
|
||||
if (priv->stage != NULL)
|
||||
g_clear_signal_handler (&priv->stage_capture_id, priv->stage);
|
||||
g_signal_handler_disconnect (priv->stage, priv->stage_capture_id);
|
||||
|
||||
priv->stage_capture_id = 0;
|
||||
priv->stage = NULL;
|
||||
@ -564,22 +563,6 @@ clutter_gesture_action_set_actor (ClutterActorMeta *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 && priv->in_gesture)
|
||||
cancel_gesture (gesture_action);
|
||||
|
||||
meta_class->set_enabled (meta, is_enabled);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
default_event_handler (ClutterGestureAction *action,
|
||||
ClutterActor *actor)
|
||||
@ -594,8 +577,6 @@ clutter_gesture_action_set_property (GObject *gobject,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterGestureAction *self = CLUTTER_GESTURE_ACTION (gobject);
|
||||
ClutterGestureActionPrivate *priv =
|
||||
clutter_gesture_action_get_instance_private (self);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
@ -608,15 +589,11 @@ clutter_gesture_action_set_property (GObject *gobject,
|
||||
break;
|
||||
|
||||
case PROP_THRESHOLD_TRIGGER_DISTANCE_X:
|
||||
clutter_gesture_action_set_threshold_trigger_distance (self,
|
||||
g_value_get_float (value),
|
||||
priv->distance_y);
|
||||
clutter_gesture_action_set_threshold_trigger_distance (self, g_value_get_float (value), self->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));
|
||||
clutter_gesture_action_set_threshold_trigger_distance (self, self->priv->distance_x, g_value_get_float (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -631,29 +608,28 @@ clutter_gesture_action_get_property (GObject *gobject,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterGestureActionPrivate *priv =
|
||||
clutter_gesture_action_get_instance_private (CLUTTER_GESTURE_ACTION (gobject));
|
||||
ClutterGestureAction *self = CLUTTER_GESTURE_ACTION (gobject);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_N_TOUCH_POINTS:
|
||||
g_value_set_int (value, priv->requested_nb_points);
|
||||
g_value_set_int (value, self->priv->requested_nb_points);
|
||||
break;
|
||||
|
||||
case PROP_THRESHOLD_TRIGGER_EDGE:
|
||||
g_value_set_enum (value, priv->edge);
|
||||
g_value_set_enum (value, self->priv->edge);
|
||||
break;
|
||||
|
||||
case PROP_THRESHOLD_TRIGGER_DISTANCE_X:
|
||||
if (priv->distance_x > 0.0)
|
||||
g_value_set_float (value, priv->distance_x);
|
||||
if (self->priv->distance_x > 0.0)
|
||||
g_value_set_float (value, self->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);
|
||||
if (self->priv->distance_y > 0.0)
|
||||
g_value_set_float (value, self->priv->distance_y);
|
||||
else
|
||||
g_value_set_float (value, gesture_get_default_threshold ());
|
||||
break;
|
||||
@ -667,8 +643,7 @@ clutter_gesture_action_get_property (GObject *gobject,
|
||||
static void
|
||||
clutter_gesture_action_finalize (GObject *gobject)
|
||||
{
|
||||
ClutterGestureActionPrivate *priv =
|
||||
clutter_gesture_action_get_instance_private (CLUTTER_GESTURE_ACTION (gobject));
|
||||
ClutterGestureActionPrivate *priv = CLUTTER_GESTURE_ACTION (gobject)->priv;
|
||||
|
||||
g_array_unref (priv->points);
|
||||
|
||||
@ -686,7 +661,6 @@ clutter_gesture_action_class_init (ClutterGestureActionClass *klass)
|
||||
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;
|
||||
@ -860,14 +834,13 @@ clutter_gesture_action_class_init (ClutterGestureActionClass *klass)
|
||||
static void
|
||||
clutter_gesture_action_init (ClutterGestureAction *self)
|
||||
{
|
||||
ClutterGestureActionPrivate *priv =
|
||||
clutter_gesture_action_get_instance_private (self);
|
||||
self->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);
|
||||
self->priv->points = g_array_sized_new (FALSE, TRUE, sizeof (GesturePoint), 3);
|
||||
g_array_set_clear_func (self->priv->points, (GDestroyNotify) gesture_point_unset);
|
||||
|
||||
priv->requested_nb_points = 1;
|
||||
priv->edge = CLUTTER_GESTURE_TRIGGER_EDGE_NONE;
|
||||
self->priv->requested_nb_points = 1;
|
||||
self->priv->edge = CLUTTER_GESTURE_TRIGGER_EDGE_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -906,21 +879,16 @@ clutter_gesture_action_get_press_coords (ClutterGestureAction *action,
|
||||
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);
|
||||
g_return_if_fail (action->priv->points->len > point);
|
||||
|
||||
if (press_x)
|
||||
*press_x = g_array_index (priv->points,
|
||||
*press_x = g_array_index (action->priv->points,
|
||||
GesturePoint,
|
||||
point).press_x;
|
||||
|
||||
if (press_y)
|
||||
*press_y = g_array_index (priv->points,
|
||||
*press_y = g_array_index (action->priv->points,
|
||||
GesturePoint,
|
||||
point).press_y;
|
||||
}
|
||||
@ -946,21 +914,16 @@ clutter_gesture_action_get_motion_coords (ClutterGestureAction *action,
|
||||
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);
|
||||
g_return_if_fail (action->priv->points->len > point);
|
||||
|
||||
if (motion_x)
|
||||
*motion_x = g_array_index (priv->points,
|
||||
*motion_x = g_array_index (action->priv->points,
|
||||
GesturePoint,
|
||||
point).last_motion_x;
|
||||
|
||||
if (motion_y)
|
||||
*motion_y = g_array_index (priv->points,
|
||||
*motion_y = g_array_index (action->priv->points,
|
||||
GesturePoint,
|
||||
point).last_motion_y;
|
||||
}
|
||||
@ -988,19 +951,15 @@ clutter_gesture_action_get_motion_delta (ClutterGestureAction *action,
|
||||
gfloat *delta_x,
|
||||
gfloat *delta_y)
|
||||
{
|
||||
ClutterGestureActionPrivate *priv;
|
||||
gfloat d_x, d_y;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), 0);
|
||||
g_return_val_if_fail (action->priv->points->len > point, 0);
|
||||
|
||||
priv = clutter_gesture_action_get_instance_private (action);
|
||||
|
||||
g_return_val_if_fail (priv->points->len > point, 0);
|
||||
|
||||
d_x = g_array_index (priv->points,
|
||||
d_x = g_array_index (action->priv->points,
|
||||
GesturePoint,
|
||||
point).last_delta_x;
|
||||
d_y = g_array_index (priv->points,
|
||||
d_y = g_array_index (action->priv->points,
|
||||
GesturePoint,
|
||||
point).last_delta_y;
|
||||
|
||||
@ -1034,21 +993,16 @@ clutter_gesture_action_get_release_coords (ClutterGestureAction *action,
|
||||
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);
|
||||
g_return_if_fail (action->priv->points->len > point);
|
||||
|
||||
if (release_x)
|
||||
*release_x = g_array_index (priv->points,
|
||||
*release_x = g_array_index (action->priv->points,
|
||||
GesturePoint,
|
||||
point).release_x;
|
||||
|
||||
if (release_y)
|
||||
*release_y = g_array_index (priv->points,
|
||||
*release_y = g_array_index (action->priv->points,
|
||||
GesturePoint,
|
||||
point).release_y;
|
||||
}
|
||||
@ -1074,20 +1028,16 @@ clutter_gesture_action_get_velocity (ClutterGestureAction *action,
|
||||
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);
|
||||
g_return_val_if_fail (action->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,
|
||||
d_t = g_array_index (action->priv->points,
|
||||
GesturePoint,
|
||||
point).last_delta_time;
|
||||
|
||||
@ -1114,13 +1064,9 @@ clutter_gesture_action_get_velocity (ClutterGestureAction *action,
|
||||
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;
|
||||
return action->priv->requested_nb_points;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1141,7 +1087,7 @@ clutter_gesture_action_set_n_touch_points (ClutterGestureAction *action,
|
||||
g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
|
||||
g_return_if_fail (nb_points >= 1);
|
||||
|
||||
priv = clutter_gesture_action_get_instance_private (action);
|
||||
priv = action->priv;
|
||||
|
||||
if (priv->requested_nb_points == nb_points)
|
||||
return;
|
||||
@ -1195,13 +1141,9 @@ clutter_gesture_action_set_n_touch_points (ClutterGestureAction *action,
|
||||
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;
|
||||
return action->priv->points->len;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1219,15 +1161,10 @@ ClutterEventSequence *
|
||||
clutter_gesture_action_get_sequence (ClutterGestureAction *action,
|
||||
guint point)
|
||||
{
|
||||
ClutterGestureActionPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), NULL);
|
||||
g_return_val_if_fail (action->priv->points->len > point, NULL);
|
||||
|
||||
priv = clutter_gesture_action_get_instance_private (action);
|
||||
|
||||
g_return_val_if_fail (priv->points->len > point, NULL);
|
||||
|
||||
return g_array_index (priv->points, GesturePoint, point).sequence;
|
||||
return g_array_index (action->priv->points, GesturePoint, point).sequence;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1246,15 +1183,10 @@ ClutterInputDevice *
|
||||
clutter_gesture_action_get_device (ClutterGestureAction *action,
|
||||
guint point)
|
||||
{
|
||||
ClutterGestureActionPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), NULL);
|
||||
g_return_val_if_fail (action->priv->points->len > point, NULL);
|
||||
|
||||
priv = clutter_gesture_action_get_instance_private (action);
|
||||
|
||||
g_return_val_if_fail (priv->points->len > point, NULL);
|
||||
|
||||
return g_array_index (priv->points, GesturePoint, point).device;
|
||||
return g_array_index (action->priv->points, GesturePoint, point).device;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1274,15 +1206,11 @@ 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);
|
||||
g_return_val_if_fail (action->priv->points->len > point, 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);
|
||||
gesture_point = &g_array_index (action->priv->points, GesturePoint, point);
|
||||
|
||||
return gesture_point->last_event;
|
||||
}
|
||||
@ -1319,16 +1247,12 @@ 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)
|
||||
if (action->priv->edge == edge)
|
||||
return;
|
||||
|
||||
priv->edge = edge;
|
||||
action->priv->edge = edge;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (action), gesture_props[PROP_THRESHOLD_TRIGGER_EDGE]);
|
||||
}
|
||||
@ -1347,14 +1271,10 @@ clutter_gesture_action_set_threshold_trigger_edge (ClutterGestureAction *ac
|
||||
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;
|
||||
return action->priv->edge;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1394,21 +1314,17 @@ clutter_gesture_action_set_threshold_trigger_distance (ClutterGestureAction
|
||||
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)
|
||||
if (fabsf (x - action->priv->distance_x) > FLOAT_EPSILON)
|
||||
{
|
||||
priv->distance_x = x;
|
||||
action->priv->distance_x = x;
|
||||
g_object_notify_by_pspec (G_OBJECT (action), gesture_props[PROP_THRESHOLD_TRIGGER_DISTANCE_X]);
|
||||
}
|
||||
|
||||
if (fabsf (y - priv->distance_y) > FLOAT_EPSILON)
|
||||
if (fabsf (y - action->priv->distance_y) > FLOAT_EPSILON)
|
||||
{
|
||||
priv->distance_y = y;
|
||||
action->priv->distance_y = y;
|
||||
g_object_notify_by_pspec (G_OBJECT (action), gesture_props[PROP_THRESHOLD_TRIGGER_DISTANCE_Y]);
|
||||
}
|
||||
}
|
||||
@ -1429,23 +1345,19 @@ clutter_gesture_action_get_threshold_trigger_distance (ClutterGestureAction *act
|
||||
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;
|
||||
if (action->priv->distance_x > 0.0)
|
||||
*x = action->priv->distance_x;
|
||||
else
|
||||
*x = gesture_get_default_threshold ();
|
||||
}
|
||||
if (y != NULL)
|
||||
{
|
||||
if (priv->distance_y > 0.0)
|
||||
*y = priv->distance_y;
|
||||
if (action->priv->distance_y > 0.0)
|
||||
*y = action->priv->distance_y;
|
||||
else
|
||||
*y = gesture_get_default_threshold ();
|
||||
}
|
||||
|
@ -34,13 +34,32 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_GESTURE_ACTION (clutter_gesture_action_get_type ())
|
||||
#define CLUTTER_TYPE_GESTURE_ACTION (clutter_gesture_action_get_type ())
|
||||
#define CLUTTER_GESTURE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_GESTURE_ACTION, ClutterGestureAction))
|
||||
#define CLUTTER_IS_GESTURE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_GESTURE_ACTION))
|
||||
#define CLUTTER_GESTURE_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_GESTURE_ACTION, ClutterGestureActionClass))
|
||||
#define CLUTTER_IS_GESTURE_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_GESTURE_ACTION))
|
||||
#define CLUTTER_GESTURE_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_GESTURE_ACTION, ClutterGestureActionClass))
|
||||
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_DERIVABLE_TYPE (ClutterGestureAction, clutter_gesture_action,
|
||||
CLUTTER, GESTURE_ACTION, ClutterAction);
|
||||
typedef struct _ClutterGestureAction ClutterGestureAction;
|
||||
typedef struct _ClutterGestureActionPrivate ClutterGestureActionPrivate;
|
||||
typedef struct _ClutterGestureActionClass ClutterGestureActionClass;
|
||||
|
||||
typedef struct _ClutterGestureActionPrivate ClutterGestureActionPrivate;
|
||||
/**
|
||||
* ClutterGestureAction:
|
||||
*
|
||||
* The #ClutterGestureAction structure contains
|
||||
* only private data and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.8
|
||||
*/
|
||||
struct _ClutterGestureAction
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterAction parent_instance;
|
||||
|
||||
ClutterGestureActionPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterGestureActionClass:
|
||||
@ -82,6 +101,9 @@ struct _ClutterGestureActionClass
|
||||
void (* _clutter_gesture_action6) (void);
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_gesture_action_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterAction * clutter_gesture_action_new (void);
|
||||
|
||||
|
@ -1,111 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
|
||||
*
|
||||
* Copyright (C) 2019 Endless, Inc
|
||||
* Copyright (C) 2009, 2010 Intel Corp
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter-graphene.h"
|
||||
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-types.h"
|
||||
|
||||
static gboolean
|
||||
graphene_point_progress (const GValue *a,
|
||||
const GValue *b,
|
||||
double progress,
|
||||
GValue *retval)
|
||||
{
|
||||
const graphene_point_t *ap = g_value_get_boxed (a);
|
||||
const graphene_point_t *bp = g_value_get_boxed (b);
|
||||
graphene_point_t res;
|
||||
|
||||
graphene_point_interpolate (ap, bp, progress, &res);
|
||||
|
||||
g_value_set_boxed (retval, &res);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
graphene_point3d_progress (const GValue *a,
|
||||
const GValue *b,
|
||||
double progress,
|
||||
GValue *retval)
|
||||
{
|
||||
const graphene_point3d_t *av = g_value_get_boxed (a);
|
||||
const graphene_point3d_t *bv = g_value_get_boxed (b);
|
||||
graphene_point3d_t res;
|
||||
|
||||
graphene_point3d_interpolate (av, bv, progress, &res);
|
||||
|
||||
g_value_set_boxed (retval, &res);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
graphene_rect_progress (const GValue *a,
|
||||
const GValue *b,
|
||||
double progress,
|
||||
GValue *retval)
|
||||
{
|
||||
const graphene_rect_t *rect_a = g_value_get_boxed (a);
|
||||
const graphene_rect_t *rect_b = g_value_get_boxed (b);
|
||||
graphene_rect_t res;
|
||||
|
||||
graphene_rect_interpolate (rect_a, rect_b, progress, &res);
|
||||
|
||||
g_value_set_boxed (retval, &res);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
graphene_size_progress (const GValue *a,
|
||||
const GValue *b,
|
||||
double progress,
|
||||
GValue *retval)
|
||||
{
|
||||
const graphene_size_t *as = g_value_get_boxed (a);
|
||||
const graphene_size_t *bs = g_value_get_boxed (b);
|
||||
graphene_size_t res;
|
||||
|
||||
graphene_size_interpolate (as, bs, progress, &res);
|
||||
|
||||
g_value_set_boxed (retval, &res);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
clutter_graphene_init (void)
|
||||
{
|
||||
clutter_interval_register_progress_func (GRAPHENE_TYPE_POINT,
|
||||
graphene_point_progress);
|
||||
clutter_interval_register_progress_func (GRAPHENE_TYPE_POINT3D,
|
||||
graphene_point3d_progress);
|
||||
clutter_interval_register_progress_func (GRAPHENE_TYPE_RECT,
|
||||
graphene_rect_progress);
|
||||
clutter_interval_register_progress_func (GRAPHENE_TYPE_SIZE,
|
||||
graphene_size_progress);
|
||||
}
|
@ -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
|
@ -44,12 +44,12 @@
|
||||
* SECTION:clutter-grid-layout
|
||||
* @Short_description: A layout manager for a grid of actors
|
||||
* @Title: ClutterGridLayout
|
||||
* @See_also: #ClutterBoxLayout
|
||||
* @See_also: #ClutterTableLayout, #ClutterBoxLayout
|
||||
*
|
||||
* #ClutterGridLayout is a layout manager which arranges its child widgets in
|
||||
* rows and columns. It is a very similar to #ClutterBoxLayout, but it
|
||||
* consistently uses #ClutterActor's alignment and expansion flags instead of
|
||||
* custom child properties.
|
||||
* rows and columns. It is a very similar to #ClutterTableLayout and
|
||||
* #ClutterBoxLayout, but it consistently uses #ClutterActor's
|
||||
* alignment and expansion flags instead of custom child properties.
|
||||
*
|
||||
* Children are added using clutter_grid_layout_attach(). They can span
|
||||
* multiple rows or columns. It is also possible to add a child next to an
|
||||
@ -1391,7 +1391,8 @@ allocate_child (ClutterGridRequest *request,
|
||||
static void
|
||||
clutter_grid_layout_allocate (ClutterLayoutManager *layout,
|
||||
ClutterContainer *container,
|
||||
const ClutterActorBox *allocation)
|
||||
const ClutterActorBox *allocation,
|
||||
ClutterAllocationFlags flags)
|
||||
{
|
||||
ClutterGridLayout *self = CLUTTER_GRID_LAYOUT (layout);
|
||||
ClutterOrientation orientation;
|
||||
@ -1452,7 +1453,7 @@ clutter_grid_layout_allocate (ClutterLayoutManager *layout,
|
||||
child_allocation.x2 = child_allocation.x1 + width;
|
||||
child_allocation.y2 = child_allocation.y1 + height;
|
||||
|
||||
clutter_actor_allocate (child, &child_allocation);
|
||||
clutter_actor_allocate (child, &child_allocation, flags);
|
||||
}
|
||||
}
|
||||
|
||||
|
96
clutter/clutter/clutter-group.h
Normal file
96
clutter/clutter/clutter-group.h
Normal file
@ -0,0 +1,96 @@
|
||||
/*
|
||||
* 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_GROUP_H__
|
||||
#define __CLUTTER_GROUP_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>
|
||||
#include <clutter/clutter-actor.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_GROUP (clutter_group_get_type ())
|
||||
#define CLUTTER_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_GROUP, ClutterGroup))
|
||||
#define CLUTTER_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_GROUP, ClutterGroupClass))
|
||||
#define CLUTTER_IS_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_GROUP))
|
||||
#define CLUTTER_IS_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_GROUP))
|
||||
#define CLUTTER_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_GROUP, ClutterGroupClass))
|
||||
|
||||
/* XXX - ClutterGroup is to be considered fully deprecated; the only
|
||||
* reason we keep this header is because ClutterStage inherits from
|
||||
* ClutterGroup, and thus we need to have a structure definition for
|
||||
* the Stage object to expand.
|
||||
*/
|
||||
|
||||
typedef struct _ClutterGroup ClutterGroup;
|
||||
typedef struct _ClutterGroupClass ClutterGroupClass;
|
||||
typedef struct _ClutterGroupPrivate ClutterGroupPrivate;
|
||||
|
||||
/**
|
||||
* ClutterGroup:
|
||||
*
|
||||
* The #ClutterGroup structure contains only private data
|
||||
* and should be accessed using the provided API
|
||||
*
|
||||
* Since: 0.2
|
||||
*/
|
||||
struct _ClutterGroup
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterActor parent_instance;
|
||||
|
||||
ClutterGroupPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterGroupClass:
|
||||
*
|
||||
* The #ClutterGroupClass structure contains only private data
|
||||
*
|
||||
* Since: 0.2
|
||||
*/
|
||||
struct _ClutterGroupClass
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterActorClass parent_class;
|
||||
|
||||
/* 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_group_get_type (void) G_GNUC_CONST;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_GROUP_H__ */
|
@ -118,10 +118,9 @@ clutter_image_init (ClutterImage *self)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_image_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *root,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_image_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
ClutterPaintNode *root)
|
||||
{
|
||||
ClutterImagePrivate *priv = CLUTTER_IMAGE (content)->priv;
|
||||
ClutterPaintNode *node;
|
||||
@ -130,7 +129,7 @@ clutter_image_paint_content (ClutterContent *content,
|
||||
return;
|
||||
|
||||
node = clutter_actor_create_texture_paint_node (actor, priv->texture);
|
||||
clutter_paint_node_set_static_name (node, "Image Content");
|
||||
clutter_paint_node_set_name (node, "Image Content");
|
||||
clutter_paint_node_add_child (root, node);
|
||||
clutter_paint_node_unref (node);
|
||||
}
|
||||
|
@ -1,226 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright © 2009, 2010, 2011 Intel Corp.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author: Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
#ifndef CLUTTER_INPUT_DEVICE_PRIVATE_H
|
||||
#define CLUTTER_INPUT_DEVICE_PRIVATE_H
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <clutter/clutter-input-device.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _ClutterAxisInfo
|
||||
{
|
||||
ClutterInputAxis axis;
|
||||
|
||||
double min_axis;
|
||||
double max_axis;
|
||||
|
||||
double min_value;
|
||||
double max_value;
|
||||
|
||||
double resolution;
|
||||
} ClutterAxisInfo;
|
||||
|
||||
typedef struct _ClutterKeyInfo
|
||||
{
|
||||
guint keyval;
|
||||
ClutterModifierType modifiers;
|
||||
} ClutterKeyInfo;
|
||||
|
||||
typedef struct _ClutterScrollInfo
|
||||
{
|
||||
guint axis_id;
|
||||
ClutterScrollDirection direction;
|
||||
double increment;
|
||||
|
||||
double last_value;
|
||||
guint last_value_valid : 1;
|
||||
} ClutterScrollInfo;
|
||||
|
||||
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;
|
||||
|
||||
int id;
|
||||
|
||||
ClutterInputDeviceType device_type;
|
||||
ClutterInputMode device_mode;
|
||||
|
||||
char *device_name;
|
||||
|
||||
ClutterSeat *seat;
|
||||
|
||||
ClutterBackend *backend;
|
||||
|
||||
/* the associated device */
|
||||
ClutterInputDevice *associated;
|
||||
|
||||
GList *slaves;
|
||||
|
||||
/* the actor underneath the pointer */
|
||||
ClutterActor *cursor_actor;
|
||||
GHashTable *inv_touch_sequence_actors;
|
||||
|
||||
/* the actor that has a grab in place for the device */
|
||||
ClutterActor *pointer_grab_actor;
|
||||
ClutterActor *keyboard_grab_actor;
|
||||
GHashTable *sequence_grab_actors;
|
||||
GHashTable *inv_sequence_grab_actors;
|
||||
|
||||
/* the current click count */
|
||||
int click_count;
|
||||
|
||||
/* the current state */
|
||||
int current_button_number;
|
||||
ClutterModifierType current_state;
|
||||
|
||||
/* the current touch points targets */
|
||||
GHashTable *touch_sequence_actors;
|
||||
|
||||
/* the previous state, used for click count generation */
|
||||
int previous_x;
|
||||
int previous_y;
|
||||
uint32_t previous_time;
|
||||
int previous_button_number;
|
||||
|
||||
GArray *axes;
|
||||
|
||||
guint n_keys;
|
||||
GArray *keys;
|
||||
|
||||
GArray *scroll_info;
|
||||
|
||||
char *vendor_id;
|
||||
char *product_id;
|
||||
char *node_path;
|
||||
|
||||
GPtrArray *tools;
|
||||
|
||||
int n_rings;
|
||||
int n_strips;
|
||||
int n_mode_groups;
|
||||
|
||||
guint has_cursor : 1;
|
||||
guint is_enabled : 1;
|
||||
|
||||
/* Accessiblity */
|
||||
ClutterVirtualInputDevice *accessibility_virtual_device;
|
||||
ClutterPtrA11yData *ptr_a11y_data;
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_input_device_set_associated_device (ClutterInputDevice *device,
|
||||
ClutterInputDevice *associated);
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_input_device_add_slave (ClutterInputDevice *master,
|
||||
ClutterInputDevice *slave);
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_input_device_remove_slave (ClutterInputDevice *master,
|
||||
ClutterInputDevice *slave);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_input_device_update_from_tool (ClutterInputDevice *device,
|
||||
ClutterInputDeviceTool *tool);
|
||||
CLUTTER_EXPORT
|
||||
ClutterActor * clutter_input_device_update (ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
ClutterStage *stage,
|
||||
gboolean emit_crossing,
|
||||
ClutterEvent *for_event);
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_input_device_remove_event_sequence (ClutterInputDevice *device,
|
||||
ClutterEvent *event);
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_input_device_set_n_keys (ClutterInputDevice *device,
|
||||
guint n_keys);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_input_device_set_key (ClutterInputDevice *device,
|
||||
guint index_,
|
||||
guint keyval,
|
||||
ClutterModifierType modifiers);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
gboolean _clutter_input_device_translate_axis (ClutterInputDevice *device,
|
||||
guint index_,
|
||||
gdouble value,
|
||||
gdouble *axis_value);
|
||||
CLUTTER_EXPORT
|
||||
guint _clutter_input_device_add_axis (ClutterInputDevice *device,
|
||||
ClutterInputAxis axis,
|
||||
gdouble minimum,
|
||||
gdouble maximum,
|
||||
gdouble resolution);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_input_device_reset_axes (ClutterInputDevice *device);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_input_device_add_scroll_info (ClutterInputDevice *device,
|
||||
guint index_,
|
||||
ClutterScrollDirection direction,
|
||||
gdouble increment);
|
||||
CLUTTER_EXPORT
|
||||
gboolean _clutter_input_device_get_scroll_delta (ClutterInputDevice *device,
|
||||
guint index_,
|
||||
gdouble value,
|
||||
ClutterScrollDirection *direction_p,
|
||||
gdouble *delta_p);
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_input_device_reset_scroll_info (ClutterInputDevice *device);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_input_device_add_tool (ClutterInputDevice *device,
|
||||
ClutterInputDeviceTool *tool);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterInputDeviceTool *
|
||||
clutter_input_device_lookup_tool (ClutterInputDevice *device,
|
||||
guint64 serial,
|
||||
ClutterInputDeviceToolType type);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_input_device_keycode_to_evdev (ClutterInputDevice *device,
|
||||
guint hardware_keycode,
|
||||
guint *evdev_keycode);
|
||||
|
||||
#endif /* CLUTTER_INPUT_DEVICE_PRIVATE_H */
|
@ -37,12 +37,12 @@
|
||||
|
||||
#include "clutter-actor-private.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-device-manager-private.h"
|
||||
#include "clutter-enum-types.h"
|
||||
#include "clutter-event-private.h"
|
||||
#include "clutter-marshal.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-stage-private.h"
|
||||
#include "clutter-input-device-private.h"
|
||||
#include "clutter-input-device-tool.h"
|
||||
|
||||
#include <math.h>
|
||||
@ -57,10 +57,11 @@ enum
|
||||
PROP_NAME,
|
||||
|
||||
PROP_DEVICE_TYPE,
|
||||
PROP_SEAT,
|
||||
PROP_DEVICE_MANAGER,
|
||||
PROP_DEVICE_MODE,
|
||||
|
||||
PROP_HAS_CURSOR,
|
||||
PROP_ENABLED,
|
||||
|
||||
PROP_N_AXES,
|
||||
|
||||
@ -71,10 +72,12 @@ enum
|
||||
PROP_N_RINGS,
|
||||
PROP_N_MODE_GROUPS,
|
||||
PROP_DEVICE_NODE,
|
||||
PROP_MAPPING_MODE,
|
||||
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
static void _clutter_input_device_free_touch_info (gpointer data);
|
||||
static void on_cursor_actor_destroy (ClutterActor *actor,
|
||||
ClutterInputDevice *device);
|
||||
static void on_cursor_actor_reactive_changed (ClutterActor *actor,
|
||||
@ -93,7 +96,6 @@ clutter_input_device_dispose (GObject *gobject)
|
||||
g_clear_pointer (&device->device_name, g_free);
|
||||
g_clear_pointer (&device->vendor_id, g_free);
|
||||
g_clear_pointer (&device->product_id, g_free);
|
||||
g_clear_pointer (&device->node_path, g_free);
|
||||
|
||||
if (device->associated != NULL)
|
||||
{
|
||||
@ -111,7 +113,7 @@ clutter_input_device_dispose (GObject *gobject)
|
||||
g_clear_pointer (&device->axes, g_array_unref);
|
||||
g_clear_pointer (&device->keys, g_array_unref);
|
||||
g_clear_pointer (&device->scroll_info, g_array_unref);
|
||||
g_clear_pointer (&device->touch_sequence_actors, g_hash_table_unref);
|
||||
g_clear_pointer (&device->touch_sequences_info, g_hash_table_unref);
|
||||
|
||||
if (device->cursor_actor)
|
||||
{
|
||||
@ -168,8 +170,8 @@ clutter_input_device_set_property (GObject *gobject,
|
||||
self->device_type = g_value_get_enum (value);
|
||||
break;
|
||||
|
||||
case PROP_SEAT:
|
||||
self->seat = g_value_get_object (value);
|
||||
case PROP_DEVICE_MANAGER:
|
||||
self->device_manager = g_value_get_object (value);
|
||||
break;
|
||||
|
||||
case PROP_DEVICE_MODE:
|
||||
@ -188,6 +190,10 @@ clutter_input_device_set_property (GObject *gobject,
|
||||
self->has_cursor = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_ENABLED:
|
||||
clutter_input_device_set_enabled (self, g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
case PROP_VENDOR_ID:
|
||||
self->vendor_id = g_value_dup_string (value);
|
||||
break;
|
||||
@ -212,6 +218,10 @@ clutter_input_device_set_property (GObject *gobject,
|
||||
self->node_path = g_value_dup_string (value);
|
||||
break;
|
||||
|
||||
case PROP_MAPPING_MODE:
|
||||
self->mapping_mode = g_value_get_enum (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
@ -236,8 +246,8 @@ clutter_input_device_get_property (GObject *gobject,
|
||||
g_value_set_enum (value, self->device_type);
|
||||
break;
|
||||
|
||||
case PROP_SEAT:
|
||||
g_value_set_object (value, self->seat);
|
||||
case PROP_DEVICE_MANAGER:
|
||||
g_value_set_object (value, self->device_manager);
|
||||
break;
|
||||
|
||||
case PROP_DEVICE_MODE:
|
||||
@ -260,6 +270,10 @@ clutter_input_device_get_property (GObject *gobject,
|
||||
g_value_set_uint (value, clutter_input_device_get_n_axes (self));
|
||||
break;
|
||||
|
||||
case PROP_ENABLED:
|
||||
g_value_set_boolean (value, self->is_enabled);
|
||||
break;
|
||||
|
||||
case PROP_VENDOR_ID:
|
||||
g_value_set_string (value, self->vendor_id);
|
||||
break;
|
||||
@ -284,6 +298,10 @@ clutter_input_device_get_property (GObject *gobject,
|
||||
g_value_set_string (value, self->node_path);
|
||||
break;
|
||||
|
||||
case PROP_MAPPING_MODE:
|
||||
g_value_set_enum (value, self->mapping_mode);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
@ -343,15 +361,17 @@ clutter_input_device_class_init (ClutterInputDeviceClass *klass)
|
||||
G_PARAM_CONSTRUCT_ONLY);
|
||||
|
||||
/**
|
||||
* ClutterInputDevice:seat:
|
||||
* ClutterInputDevice:device-manager:
|
||||
*
|
||||
* The #ClutterSeat instance which owns the device
|
||||
* The #ClutterDeviceManager instance which owns the device
|
||||
*
|
||||
* Since: 1.6
|
||||
*/
|
||||
obj_props[PROP_SEAT] =
|
||||
g_param_spec_object ("seat",
|
||||
P_("Seat"),
|
||||
P_("Seat"),
|
||||
CLUTTER_TYPE_SEAT,
|
||||
obj_props[PROP_DEVICE_MANAGER] =
|
||||
g_param_spec_object ("device-manager",
|
||||
P_("Device Manager"),
|
||||
P_("The device manager instance"),
|
||||
CLUTTER_TYPE_DEVICE_MANAGER,
|
||||
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
|
||||
|
||||
/**
|
||||
@ -383,6 +403,25 @@ clutter_input_device_class_init (ClutterInputDeviceClass *klass)
|
||||
FALSE,
|
||||
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
|
||||
|
||||
/**
|
||||
* ClutterInputDevice:enabled:
|
||||
*
|
||||
* Whether the device is enabled.
|
||||
*
|
||||
* A device with the #ClutterInputDevice:device-mode property set
|
||||
* to %CLUTTER_INPUT_MODE_MASTER cannot be disabled.
|
||||
*
|
||||
* A device must be enabled in order to receive events from it.
|
||||
*
|
||||
* Since: 1.6
|
||||
*/
|
||||
obj_props[PROP_ENABLED] =
|
||||
g_param_spec_boolean ("enabled",
|
||||
P_("Enabled"),
|
||||
P_("Whether the device is enabled"),
|
||||
FALSE,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
/**
|
||||
* ClutterInputDevice:n-axes:
|
||||
*
|
||||
@ -468,6 +507,14 @@ clutter_input_device_class_init (ClutterInputDeviceClass *klass)
|
||||
NULL,
|
||||
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
|
||||
|
||||
obj_props[PROP_MAPPING_MODE] =
|
||||
g_param_spec_enum ("mapping-mode",
|
||||
P_("Device mapping mode"),
|
||||
P_("Device mapping mode"),
|
||||
CLUTTER_TYPE_INPUT_DEVICE_MAPPING,
|
||||
CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
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;
|
||||
@ -482,15 +529,91 @@ clutter_input_device_init (ClutterInputDevice *self)
|
||||
|
||||
self->click_count = 0;
|
||||
|
||||
self->previous_time = CLUTTER_CURRENT_TIME;
|
||||
self->previous_x = -1;
|
||||
self->previous_y = -1;
|
||||
self->current_time = self->previous_time = CLUTTER_CURRENT_TIME;
|
||||
self->current_x = self->previous_x = -1;
|
||||
self->current_y = self->previous_y = -1;
|
||||
self->current_button_number = self->previous_button_number = -1;
|
||||
self->current_state = self->previous_state = 0;
|
||||
|
||||
self->touch_sequence_actors = g_hash_table_new (NULL, NULL);
|
||||
self->touch_sequences_info =
|
||||
g_hash_table_new_full (NULL, NULL,
|
||||
NULL, _clutter_input_device_free_touch_info);
|
||||
self->inv_touch_sequence_actors = g_hash_table_new (NULL, NULL);
|
||||
}
|
||||
|
||||
static ClutterTouchInfo *
|
||||
_clutter_input_device_ensure_touch_info (ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
ClutterStage *stage)
|
||||
{
|
||||
ClutterTouchInfo *info;
|
||||
|
||||
info = g_hash_table_lookup (device->touch_sequences_info, sequence);
|
||||
|
||||
if (info == NULL)
|
||||
{
|
||||
info = g_slice_new0 (ClutterTouchInfo);
|
||||
info->sequence = sequence;
|
||||
g_hash_table_insert (device->touch_sequences_info, sequence, info);
|
||||
|
||||
if (g_hash_table_size (device->touch_sequences_info) == 1)
|
||||
_clutter_input_device_set_stage (device, stage);
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* clutter_input_device_set_coords:
|
||||
* @device: a #ClutterInputDevice
|
||||
* @sequence: a #ClutterEventSequence or NULL
|
||||
* @x: X coordinate of the device
|
||||
* @y: Y coordinate of the device
|
||||
*
|
||||
* Stores the last known coordinates of the device
|
||||
*/
|
||||
void
|
||||
_clutter_input_device_set_coords (ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
gfloat x,
|
||||
gfloat y,
|
||||
ClutterStage *stage)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
|
||||
|
||||
if (sequence == NULL)
|
||||
{
|
||||
if (device->current_x != x)
|
||||
device->current_x = x;
|
||||
|
||||
if (device->current_y != y)
|
||||
device->current_y = y;
|
||||
}
|
||||
else
|
||||
{
|
||||
ClutterTouchInfo *info;
|
||||
info = _clutter_input_device_ensure_touch_info (device, sequence, stage);
|
||||
info->current_x = x;
|
||||
info->current_y = y;
|
||||
}
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* clutter_input_device_set_state:
|
||||
* @device: a #ClutterInputDevice
|
||||
* @state: a bitmask of modifiers
|
||||
*
|
||||
* Stores the last known modifiers state of the device
|
||||
*/
|
||||
void
|
||||
_clutter_input_device_set_state (ClutterInputDevice *device,
|
||||
ClutterModifierType state)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
|
||||
|
||||
device->current_state = state;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_input_device_get_modifier_state:
|
||||
* @device: a #ClutterInputDevice
|
||||
@ -505,17 +628,83 @@ clutter_input_device_init (ClutterInputDevice *self)
|
||||
ClutterModifierType
|
||||
clutter_input_device_get_modifier_state (ClutterInputDevice *device)
|
||||
{
|
||||
uint32_t modifiers;
|
||||
ClutterSeat *seat;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), 0);
|
||||
|
||||
seat = clutter_input_device_get_seat (device);
|
||||
return device->current_state;
|
||||
}
|
||||
|
||||
if (!clutter_seat_query_state (seat, device, NULL, NULL, &modifiers))
|
||||
return 0;
|
||||
/*< private >
|
||||
* clutter_input_device_set_time:
|
||||
* @device: a #ClutterInputDevice
|
||||
* @time_: the time
|
||||
*
|
||||
* Stores the last known event time of the device
|
||||
*/
|
||||
void
|
||||
_clutter_input_device_set_time (ClutterInputDevice *device,
|
||||
guint32 time_)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
|
||||
|
||||
return modifiers;
|
||||
if (device->current_time != time_)
|
||||
device->current_time = time_;
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* clutter_input_device_set_stage:
|
||||
* @device: a #ClutterInputDevice
|
||||
* @stage: a #ClutterStage or %NULL
|
||||
*
|
||||
* Stores the stage under the device
|
||||
*/
|
||||
void
|
||||
_clutter_input_device_set_stage (ClutterInputDevice *device,
|
||||
ClutterStage *stage)
|
||||
{
|
||||
if (device->stage == stage)
|
||||
return;
|
||||
|
||||
device->stage = stage;
|
||||
|
||||
/* we leave the ->cursor_actor in place in order to check
|
||||
* if we left the stage without crossing it again; this way
|
||||
* we can emit a leave event on the cursor actor right before
|
||||
* we emit the leave event on the stage.
|
||||
*/
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* clutter_input_device_get_stage:
|
||||
* @device: a #ClutterInputDevice
|
||||
*
|
||||
* Retrieves the stage currently associated with @device.
|
||||
*
|
||||
* Return value: The stage currently associated with @device.
|
||||
*/
|
||||
ClutterStage *
|
||||
_clutter_input_device_get_stage (ClutterInputDevice *device)
|
||||
{
|
||||
return device->stage;
|
||||
}
|
||||
|
||||
static void
|
||||
_clutter_input_device_free_touch_info (gpointer data)
|
||||
{
|
||||
g_slice_free (ClutterTouchInfo, data);
|
||||
}
|
||||
|
||||
static ClutterActor *
|
||||
_clutter_input_device_get_actor (ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence)
|
||||
{
|
||||
ClutterTouchInfo *info;
|
||||
|
||||
if (sequence == NULL)
|
||||
return device->cursor_actor;
|
||||
|
||||
info = g_hash_table_lookup (device->touch_sequences_info, sequence);
|
||||
|
||||
return info->actor;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -529,8 +718,12 @@ _clutter_input_device_associate_actor (ClutterInputDevice *device,
|
||||
{
|
||||
GList *sequences =
|
||||
g_hash_table_lookup (device->inv_touch_sequence_actors, actor);
|
||||
ClutterTouchInfo *info;
|
||||
ClutterStage *stage = CLUTTER_STAGE (clutter_actor_get_stage (actor));
|
||||
|
||||
info = _clutter_input_device_ensure_touch_info (device, sequence, stage);
|
||||
info->actor = actor;
|
||||
|
||||
g_hash_table_insert (device->touch_sequence_actors, sequence, actor);
|
||||
g_hash_table_insert (device->inv_touch_sequence_actors,
|
||||
actor, g_list_prepend (sequences, sequence));
|
||||
}
|
||||
@ -558,7 +751,13 @@ _clutter_input_device_unassociate_actor (ClutterInputDevice *device,
|
||||
actor);
|
||||
|
||||
for (l = sequences; l != NULL; l = l->next)
|
||||
g_hash_table_remove (device->touch_sequence_actors, l->data);
|
||||
{
|
||||
ClutterTouchInfo *info =
|
||||
g_hash_table_lookup (device->touch_sequences_info, l->data);
|
||||
|
||||
if (info)
|
||||
info->actor = NULL;
|
||||
}
|
||||
|
||||
g_list_free (sequences);
|
||||
g_hash_table_remove (device->inv_touch_sequence_actors, actor);
|
||||
@ -600,7 +799,7 @@ on_cursor_actor_reactive_changed (ClutterActor *actor,
|
||||
*
|
||||
* Sets the actor under the pointer coordinates of @device
|
||||
*
|
||||
* This function is called by clutter_input_device_update()
|
||||
* This function is called by _clutter_input_device_update()
|
||||
* and it will:
|
||||
*
|
||||
* - queue a %CLUTTER_LEAVE event on the previous pointer actor
|
||||
@ -611,31 +810,17 @@ on_cursor_actor_reactive_changed (ClutterActor *actor,
|
||||
* - set to %TRUE the :has-pointer property of the new pointer
|
||||
* actor
|
||||
*/
|
||||
static void
|
||||
void
|
||||
_clutter_input_device_set_actor (ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
ClutterActor *actor,
|
||||
gboolean emit_crossing,
|
||||
graphene_point_t coords,
|
||||
uint32_t time_)
|
||||
gboolean emit_crossing)
|
||||
{
|
||||
ClutterActor *old_actor = clutter_input_device_get_actor (device, sequence);
|
||||
ClutterStage *stage = NULL;
|
||||
ClutterActor *old_actor = _clutter_input_device_get_actor (device, sequence);
|
||||
|
||||
if (old_actor == actor)
|
||||
return;
|
||||
|
||||
if (emit_crossing)
|
||||
{
|
||||
if (actor)
|
||||
stage = CLUTTER_STAGE (clutter_actor_get_stage (actor));
|
||||
else if (old_actor)
|
||||
stage = CLUTTER_STAGE (clutter_actor_get_stage (old_actor));
|
||||
|
||||
if (!stage)
|
||||
return;
|
||||
}
|
||||
|
||||
if (old_actor != NULL)
|
||||
{
|
||||
ClutterActor *tmp_old_actor;
|
||||
@ -645,12 +830,12 @@ _clutter_input_device_set_actor (ClutterInputDevice *device,
|
||||
ClutterEvent *event;
|
||||
|
||||
event = clutter_event_new (CLUTTER_LEAVE);
|
||||
event->crossing.time = time_;
|
||||
event->crossing.time = device->current_time;
|
||||
event->crossing.flags = 0;
|
||||
event->crossing.stage = stage;
|
||||
event->crossing.stage = device->stage;
|
||||
event->crossing.source = old_actor;
|
||||
event->crossing.x = coords.x;
|
||||
event->crossing.y = coords.y;
|
||||
event->crossing.x = device->current_x;
|
||||
event->crossing.y = device->current_y;
|
||||
event->crossing.related = actor;
|
||||
event->crossing.sequence = sequence;
|
||||
clutter_event_set_device (event, device);
|
||||
@ -666,7 +851,7 @@ _clutter_input_device_set_actor (ClutterInputDevice *device,
|
||||
}
|
||||
|
||||
/* processing the event might have destroyed the actor */
|
||||
tmp_old_actor = clutter_input_device_get_actor (device, sequence);
|
||||
tmp_old_actor = _clutter_input_device_get_actor (device, sequence);
|
||||
_clutter_input_device_unassociate_actor (device,
|
||||
old_actor,
|
||||
tmp_old_actor == NULL);
|
||||
@ -682,11 +867,11 @@ _clutter_input_device_set_actor (ClutterInputDevice *device,
|
||||
ClutterEvent *event;
|
||||
|
||||
event = clutter_event_new (CLUTTER_ENTER);
|
||||
event->crossing.time = time_;
|
||||
event->crossing.time = device->current_time;
|
||||
event->crossing.flags = 0;
|
||||
event->crossing.stage = stage;
|
||||
event->crossing.x = coords.x;
|
||||
event->crossing.y = coords.y;
|
||||
event->crossing.stage = device->stage;
|
||||
event->crossing.x = device->current_x;
|
||||
event->crossing.y = device->current_y;
|
||||
event->crossing.source = actor;
|
||||
event->crossing.related = old_actor;
|
||||
event->crossing.sequence = sequence;
|
||||
@ -737,6 +922,56 @@ clutter_input_device_get_device_id (ClutterInputDevice *device)
|
||||
return device->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_input_device_set_enabled:
|
||||
* @device: a #ClutterInputDevice
|
||||
* @enabled: %TRUE to enable the @device
|
||||
*
|
||||
* Enables or disables a #ClutterInputDevice.
|
||||
*
|
||||
* Only devices with a #ClutterInputDevice:device-mode property set
|
||||
* to %CLUTTER_INPUT_MODE_SLAVE or %CLUTTER_INPUT_MODE_FLOATING can
|
||||
* be disabled.
|
||||
*
|
||||
* Since: 1.6
|
||||
*/
|
||||
void
|
||||
clutter_input_device_set_enabled (ClutterInputDevice *device,
|
||||
gboolean enabled)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
|
||||
|
||||
enabled = !!enabled;
|
||||
|
||||
if (!enabled && device->device_mode == CLUTTER_INPUT_MODE_MASTER)
|
||||
return;
|
||||
|
||||
if (device->is_enabled == enabled)
|
||||
return;
|
||||
|
||||
device->is_enabled = enabled;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (device), obj_props[PROP_ENABLED]);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_input_device_get_enabled:
|
||||
* @device: a #ClutterInputDevice
|
||||
*
|
||||
* Retrieves whether @device is enabled.
|
||||
*
|
||||
* Return value: %TRUE if the device is enabled
|
||||
*
|
||||
* Since: 1.6
|
||||
*/
|
||||
gboolean
|
||||
clutter_input_device_get_enabled (ClutterInputDevice *device)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE);
|
||||
|
||||
return device->is_enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_input_device_get_coords:
|
||||
* @device: a #ClutterInputDevice
|
||||
@ -756,20 +991,33 @@ clutter_input_device_get_device_id (ClutterInputDevice *device)
|
||||
gboolean
|
||||
clutter_input_device_get_coords (ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
graphene_point_t *point)
|
||||
ClutterPoint *point)
|
||||
{
|
||||
ClutterSeat *seat;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE);
|
||||
g_return_val_if_fail (point != NULL, FALSE);
|
||||
|
||||
seat = clutter_input_device_get_seat (device);
|
||||
if (sequence == NULL)
|
||||
{
|
||||
point->x = device->current_x;
|
||||
point->y = device->current_y;
|
||||
}
|
||||
else
|
||||
{
|
||||
ClutterTouchInfo *info =
|
||||
g_hash_table_lookup (device->touch_sequences_info, sequence);
|
||||
|
||||
return clutter_seat_query_state (seat, device, sequence, point, NULL);
|
||||
if (info == NULL)
|
||||
return FALSE;
|
||||
|
||||
point->x = info->current_x;
|
||||
point->y = info->current_y;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* clutter_input_device_update:
|
||||
* _clutter_input_device_update:
|
||||
* @device: a #ClutterInputDevice
|
||||
*
|
||||
* Updates the input @device by determining the #ClutterActor underneath the
|
||||
@ -783,33 +1031,31 @@ clutter_input_device_get_coords (ClutterInputDevice *device,
|
||||
* Since: 1.2
|
||||
*/
|
||||
ClutterActor *
|
||||
clutter_input_device_update (ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
ClutterStage *stage,
|
||||
gboolean emit_crossing,
|
||||
ClutterEvent *for_event)
|
||||
_clutter_input_device_update (ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
gboolean emit_crossing)
|
||||
{
|
||||
ClutterStage *stage;
|
||||
ClutterActor *new_cursor_actor;
|
||||
ClutterActor *old_cursor_actor;
|
||||
graphene_point_t point = GRAPHENE_POINT_INIT (-1.0f, -1.0f);
|
||||
ClutterPoint point = { -1, -1 };
|
||||
ClutterInputDeviceType device_type = device->device_type;
|
||||
uint32_t time_;
|
||||
|
||||
g_assert (device_type != CLUTTER_KEYBOARD_DEVICE &&
|
||||
device_type != CLUTTER_PAD_DEVICE);
|
||||
|
||||
if (for_event)
|
||||
stage = device->stage;
|
||||
if (G_UNLIKELY (stage == NULL))
|
||||
{
|
||||
clutter_event_get_coords (for_event, &point.x, &point.y);
|
||||
time_ = clutter_event_get_time (for_event);
|
||||
}
|
||||
else
|
||||
{
|
||||
clutter_input_device_get_coords (device, sequence, &point);
|
||||
time_ = CLUTTER_CURRENT_TIME;
|
||||
CLUTTER_NOTE (EVENT, "No stage defined for device %d '%s'",
|
||||
clutter_input_device_get_device_id (device),
|
||||
clutter_input_device_get_device_name (device));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
old_cursor_actor = clutter_input_device_get_actor (device, sequence);
|
||||
clutter_input_device_get_coords (device, sequence, &point);
|
||||
|
||||
old_cursor_actor = _clutter_input_device_get_actor (device, sequence);
|
||||
new_cursor_actor =
|
||||
_clutter_stage_do_pick (stage, point.x, point.y, CLUTTER_PICK_REACTIVE);
|
||||
|
||||
@ -834,34 +1080,47 @@ clutter_input_device_update (ClutterInputDevice *device,
|
||||
|
||||
_clutter_input_device_set_actor (device, sequence,
|
||||
new_cursor_actor,
|
||||
emit_crossing,
|
||||
point, time_);
|
||||
emit_crossing);
|
||||
|
||||
return new_cursor_actor;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_input_device_get_actor:
|
||||
* @device: a #ClutterInputDevice
|
||||
* @sequence: (allow-none): an optional #ClutterEventSequence
|
||||
* clutter_input_device_get_pointer_actor:
|
||||
* @device: a #ClutterInputDevice of type %CLUTTER_POINTER_DEVICE
|
||||
*
|
||||
* Retrieves the #ClutterActor underneath the pointer or touchpoint
|
||||
* of @device and @sequence.
|
||||
* Retrieves the #ClutterActor underneath the pointer of @device
|
||||
*
|
||||
* Return value: (transfer none): a pointer to the #ClutterActor or %NULL
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
ClutterActor *
|
||||
clutter_input_device_get_actor (ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence)
|
||||
clutter_input_device_get_pointer_actor (ClutterInputDevice *device)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
|
||||
g_return_val_if_fail (device->device_type == CLUTTER_POINTER_DEVICE, NULL);
|
||||
|
||||
if (sequence == NULL)
|
||||
return device->cursor_actor;
|
||||
return device->cursor_actor;
|
||||
}
|
||||
|
||||
return g_hash_table_lookup (device->touch_sequence_actors, sequence);
|
||||
/**
|
||||
* clutter_input_device_get_pointer_stage:
|
||||
* @device: a #ClutterInputDevice of type %CLUTTER_POINTER_DEVICE
|
||||
*
|
||||
* Retrieves the #ClutterStage underneath the pointer of @device
|
||||
*
|
||||
* Return value: (transfer none): a pointer to the #ClutterStage or %NULL
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
ClutterStage *
|
||||
clutter_input_device_get_pointer_stage (ClutterInputDevice *device)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
|
||||
g_return_val_if_fail (device->device_type == CLUTTER_POINTER_DEVICE, NULL);
|
||||
|
||||
return device->stage;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -922,6 +1181,95 @@ clutter_input_device_get_device_mode (ClutterInputDevice *device)
|
||||
return device->device_mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_input_device_update_from_event:
|
||||
* @device: a #ClutterInputDevice
|
||||
* @event: a #ClutterEvent
|
||||
* @update_stage: whether to update the #ClutterStage of the @device
|
||||
* using the stage of the event
|
||||
*
|
||||
* Forcibly updates the state of the @device using a #ClutterEvent
|
||||
*
|
||||
* This function should never be used by applications: it is meant
|
||||
* for integration with embedding toolkits, like clutter-gtk
|
||||
*
|
||||
* Embedding toolkits that disable the event collection inside Clutter
|
||||
* need to use this function to update the state of input devices depending
|
||||
* on a #ClutterEvent that they are going to submit to the event handling code
|
||||
* in Clutter though clutter_do_event(). Since the input devices hold the state
|
||||
* that is going to be used to fill in fields like the #ClutterButtonEvent
|
||||
* click count, or to emit synthesized events like %CLUTTER_ENTER and
|
||||
* %CLUTTER_LEAVE, it is necessary for embedding toolkits to also be
|
||||
* responsible of updating the input device state.
|
||||
*
|
||||
* For instance, this might be the code to translate an embedding toolkit
|
||||
* native motion notification into a Clutter #ClutterMotionEvent and ask
|
||||
* Clutter to process it:
|
||||
*
|
||||
* |[
|
||||
* ClutterEvent c_event;
|
||||
*
|
||||
* translate_native_event_to_clutter (native_event, &c_event);
|
||||
*
|
||||
* clutter_do_event (&c_event);
|
||||
* ]|
|
||||
*
|
||||
* Before letting clutter_do_event() process the event, it is necessary to call
|
||||
* clutter_input_device_update_from_event():
|
||||
*
|
||||
* |[
|
||||
* ClutterEvent c_event;
|
||||
* ClutterDeviceManager *manager;
|
||||
* ClutterInputDevice *device;
|
||||
*
|
||||
* translate_native_event_to_clutter (native_event, &c_event);
|
||||
*
|
||||
* // get the device manager
|
||||
* manager = clutter_device_manager_get_default ();
|
||||
*
|
||||
* // use the default Core Pointer that Clutter backends register by default
|
||||
* device = clutter_device_manager_get_core_device (manager, %CLUTTER_POINTER_DEVICE);
|
||||
*
|
||||
* // update the state of the input device
|
||||
* clutter_input_device_update_from_event (device, &c_event, FALSE);
|
||||
*
|
||||
* clutter_do_event (&c_event);
|
||||
* ]|
|
||||
*
|
||||
* The @update_stage boolean argument should be used when the input device
|
||||
* enters and leaves a #ClutterStage; it will use the #ClutterStage field
|
||||
* of the passed @event to update the stage associated to the input device.
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
void
|
||||
clutter_input_device_update_from_event (ClutterInputDevice *device,
|
||||
ClutterEvent *event,
|
||||
gboolean update_stage)
|
||||
{
|
||||
ClutterModifierType event_state;
|
||||
ClutterEventSequence *sequence;
|
||||
ClutterStage *event_stage;
|
||||
gfloat event_x, event_y;
|
||||
guint32 event_time;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
|
||||
g_return_if_fail (event != NULL);
|
||||
|
||||
event_state = clutter_event_get_state (event);
|
||||
event_time = clutter_event_get_time (event);
|
||||
event_stage = clutter_event_get_stage (event);
|
||||
sequence = clutter_event_get_event_sequence (event);
|
||||
clutter_event_get_coords (event, &event_x, &event_y);
|
||||
|
||||
_clutter_input_device_set_coords (device, sequence, event_x, event_y, event_stage);
|
||||
_clutter_input_device_set_state (device, event_state);
|
||||
_clutter_input_device_set_time (device, event_time);
|
||||
|
||||
if (update_stage)
|
||||
_clutter_input_device_set_stage (device, event_stage);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* clutter_input_device_reset_axes:
|
||||
* @device: a #ClutterInputDevice
|
||||
@ -1302,6 +1650,31 @@ _clutter_input_device_remove_slave (ClutterInputDevice *master,
|
||||
master->slaves = g_list_remove (master->slaves, slave);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* clutter_input_device_add_sequence:
|
||||
* @device: a #ClutterInputDevice
|
||||
* @sequence: a #ClutterEventSequence
|
||||
*
|
||||
* Start tracking informations related to a touch point (position,
|
||||
* actor underneath the touch point).
|
||||
*/
|
||||
void
|
||||
_clutter_input_device_add_event_sequence (ClutterInputDevice *device,
|
||||
ClutterEvent *event)
|
||||
{
|
||||
ClutterEventSequence *sequence = clutter_event_get_event_sequence (event);
|
||||
ClutterStage *stage;
|
||||
|
||||
if (sequence == NULL)
|
||||
return;
|
||||
|
||||
stage = clutter_event_get_stage (event);
|
||||
if (stage == NULL)
|
||||
return;
|
||||
|
||||
_clutter_input_device_ensure_touch_info (device, sequence, stage);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* clutter_input_device_remove_sequence:
|
||||
* @device: a #ClutterInputDevice
|
||||
@ -1314,25 +1687,25 @@ _clutter_input_device_remove_event_sequence (ClutterInputDevice *device,
|
||||
ClutterEvent *event)
|
||||
{
|
||||
ClutterEventSequence *sequence = clutter_event_get_event_sequence (event);
|
||||
ClutterActor *actor =
|
||||
g_hash_table_lookup (device->touch_sequence_actors, sequence);
|
||||
ClutterTouchInfo *info =
|
||||
g_hash_table_lookup (device->touch_sequences_info, sequence);
|
||||
|
||||
if (actor != NULL)
|
||||
if (info == NULL)
|
||||
return;
|
||||
|
||||
if (info->actor != NULL)
|
||||
{
|
||||
GList *sequences =
|
||||
g_hash_table_lookup (device->inv_touch_sequence_actors, actor);
|
||||
graphene_point_t point;
|
||||
g_hash_table_lookup (device->inv_touch_sequence_actors, info->actor);
|
||||
|
||||
sequences = g_list_remove (sequences, sequence);
|
||||
|
||||
g_hash_table_replace (device->inv_touch_sequence_actors,
|
||||
actor, sequences);
|
||||
clutter_event_get_coords (event, &point.x, &point.y);
|
||||
_clutter_input_device_set_actor (device, sequence, NULL, TRUE, point,
|
||||
clutter_event_get_time (event));
|
||||
info->actor, sequences);
|
||||
_clutter_input_device_set_actor (device, sequence, NULL, TRUE);
|
||||
}
|
||||
|
||||
g_hash_table_remove (device->touch_sequence_actors, sequence);
|
||||
g_hash_table_remove (device->touch_sequences_info, sequence);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2022,6 +2395,43 @@ clutter_input_device_get_device_node (ClutterInputDevice *device)
|
||||
return device->node_path;
|
||||
}
|
||||
|
||||
ClutterInputDeviceMapping
|
||||
clutter_input_device_get_mapping_mode (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterInputDeviceType device_type;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device),
|
||||
CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE);
|
||||
|
||||
device_type = clutter_input_device_get_device_type (device);
|
||||
g_return_val_if_fail (device_type == CLUTTER_TABLET_DEVICE ||
|
||||
device_type == CLUTTER_PEN_DEVICE ||
|
||||
device_type == CLUTTER_ERASER_DEVICE,
|
||||
CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE);
|
||||
|
||||
return device->mapping_mode;
|
||||
}
|
||||
|
||||
void
|
||||
clutter_input_device_set_mapping_mode (ClutterInputDevice *device,
|
||||
ClutterInputDeviceMapping mapping)
|
||||
{
|
||||
ClutterInputDeviceType device_type;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
|
||||
|
||||
device_type = clutter_input_device_get_device_type (device);
|
||||
g_return_if_fail (device_type == CLUTTER_TABLET_DEVICE ||
|
||||
device_type == CLUTTER_PEN_DEVICE ||
|
||||
device_type == CLUTTER_ERASER_DEVICE);
|
||||
|
||||
if (device->mapping_mode == mapping)
|
||||
return;
|
||||
|
||||
device->mapping_mode = mapping;
|
||||
g_object_notify (G_OBJECT (device), "mapping-mode");
|
||||
}
|
||||
|
||||
gboolean
|
||||
clutter_input_device_is_grouped (ClutterInputDevice *device,
|
||||
ClutterInputDevice *other_device)
|
||||
@ -2031,19 +2441,3 @@ clutter_input_device_is_grouped (ClutterInputDevice *device,
|
||||
|
||||
return CLUTTER_INPUT_DEVICE_GET_CLASS (device)->is_grouped (device, other_device);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_input_device_get_seat:
|
||||
* @device: a #ClutterInputDevice
|
||||
*
|
||||
* Returns the seat the device belongs to
|
||||
*
|
||||
* Returns: (transfer none): the device seat
|
||||
**/
|
||||
ClutterSeat *
|
||||
clutter_input_device_get_seat (ClutterInputDevice *device)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
|
||||
|
||||
return device->seat;
|
||||
}
|
||||
|
@ -28,40 +28,10 @@
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <clutter/clutter-backend.h>
|
||||
#include <clutter/clutter-types.h>
|
||||
#include <clutter/clutter-seat.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef void (*ClutterEmitInputDeviceEvent) (ClutterEvent *event,
|
||||
ClutterInputDevice *device);
|
||||
|
||||
struct _ClutterInputDeviceClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
gboolean (* keycode_to_evdev) (ClutterInputDevice *device,
|
||||
guint hardware_keycode,
|
||||
guint *evdev_keycode);
|
||||
void (* update_from_tool) (ClutterInputDevice *device,
|
||||
ClutterInputDeviceTool *tool);
|
||||
|
||||
gboolean (* is_mode_switch_button) (ClutterInputDevice *device,
|
||||
guint group,
|
||||
guint button);
|
||||
gint (* get_group_n_modes) (ClutterInputDevice *device,
|
||||
gint group);
|
||||
|
||||
gboolean (* is_grouped) (ClutterInputDevice *device,
|
||||
ClutterInputDevice *other_device);
|
||||
|
||||
/* Keyboard accessbility */
|
||||
void (* process_kbd_a11y_event) (ClutterEvent *event,
|
||||
ClutterInputDevice *device,
|
||||
ClutterEmitInputDeviceEvent emit_event_func);
|
||||
};
|
||||
|
||||
#define CLUTTER_TYPE_INPUT_DEVICE (clutter_input_device_get_type ())
|
||||
#define CLUTTER_INPUT_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_INPUT_DEVICE, ClutterInputDevice))
|
||||
#define CLUTTER_IS_INPUT_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_INPUT_DEVICE))
|
||||
@ -88,18 +58,24 @@ gint clutter_input_device_get_device_id (ClutterInputDev
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_input_device_get_coords (ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
graphene_point_t *point);
|
||||
ClutterPoint *point);
|
||||
CLUTTER_EXPORT
|
||||
ClutterModifierType clutter_input_device_get_modifier_state (ClutterInputDevice *device);
|
||||
CLUTTER_EXPORT
|
||||
ClutterActor * clutter_input_device_get_actor (ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence);
|
||||
ClutterActor * clutter_input_device_get_pointer_actor (ClutterInputDevice *device);
|
||||
CLUTTER_EXPORT
|
||||
ClutterStage * clutter_input_device_get_pointer_stage (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_set_enabled (ClutterInputDevice *device,
|
||||
gboolean enabled);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_input_device_get_enabled (ClutterInputDevice *device);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
guint clutter_input_device_get_n_axes (ClutterInputDevice *device);
|
||||
@ -115,6 +91,11 @@ gboolean clutter_input_device_get_axis_value (ClutterInputDev
|
||||
CLUTTER_EXPORT
|
||||
guint clutter_input_device_get_n_keys (ClutterInputDevice *device);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_input_device_set_key (ClutterInputDevice *device,
|
||||
guint index_,
|
||||
guint keyval,
|
||||
ClutterModifierType modifiers);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_input_device_get_key (ClutterInputDevice *device,
|
||||
guint index_,
|
||||
guint *keyval,
|
||||
@ -125,6 +106,11 @@ ClutterInputDevice * clutter_input_device_get_associated_device (ClutterInput
|
||||
CLUTTER_EXPORT
|
||||
GList * clutter_input_device_get_slave_devices (ClutterInputDevice *device);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_input_device_update_from_event (ClutterInputDevice *device,
|
||||
ClutterEvent *event,
|
||||
gboolean update_stage);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_input_device_grab (ClutterInputDevice *device,
|
||||
ClutterActor *actor);
|
||||
@ -144,6 +130,11 @@ CLUTTER_EXPORT
|
||||
ClutterActor * clutter_input_device_sequence_get_grabbed_actor (ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_input_device_keycode_to_evdev (ClutterInputDevice *device,
|
||||
guint hardware_keycode,
|
||||
guint *evdev_keycode);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
const gchar * clutter_input_device_get_vendor_id (ClutterInputDevice *device);
|
||||
CLUTTER_EXPORT
|
||||
@ -171,11 +162,15 @@ gint clutter_input_device_get_mode_switch_button_group (Clutt
|
||||
CLUTTER_EXPORT
|
||||
const gchar * clutter_input_device_get_device_node (ClutterInputDevice *device);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterInputDeviceMapping clutter_input_device_get_mapping_mode (ClutterInputDevice *device);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_input_device_set_mapping_mode (ClutterInputDevice *device,
|
||||
ClutterInputDeviceMapping mapping);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_input_device_is_grouped (ClutterInputDevice *device,
|
||||
ClutterInputDevice *other_device);
|
||||
CLUTTER_EXPORT
|
||||
ClutterSeat * clutter_input_device_get_seat (ClutterInputDevice *device);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -29,7 +29,7 @@ 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 offset,
|
||||
guint len);
|
||||
void clutter_input_focus_request_surrounding (ClutterInputFocus *focus);
|
||||
|
||||
|
@ -89,8 +89,8 @@ clutter_input_focus_reset (ClutterInputFocus *focus)
|
||||
}
|
||||
|
||||
void
|
||||
clutter_input_focus_set_cursor_location (ClutterInputFocus *focus,
|
||||
const graphene_rect_t *rect)
|
||||
clutter_input_focus_set_cursor_location (ClutterInputFocus *focus,
|
||||
const ClutterRect *rect)
|
||||
{
|
||||
ClutterInputFocusPrivate *priv;
|
||||
|
||||
@ -217,7 +217,7 @@ clutter_input_focus_commit (ClutterInputFocus *focus,
|
||||
|
||||
void
|
||||
clutter_input_focus_delete_surrounding (ClutterInputFocus *focus,
|
||||
int offset,
|
||||
guint offset,
|
||||
guint len)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_INPUT_FOCUS (focus));
|
||||
|
@ -41,7 +41,7 @@ struct _ClutterInputFocusClass
|
||||
|
||||
void (* request_surrounding) (ClutterInputFocus *focus);
|
||||
void (* delete_surrounding) (ClutterInputFocus *focus,
|
||||
int offset,
|
||||
guint offset,
|
||||
guint len);
|
||||
void (* commit_text) (ClutterInputFocus *focus,
|
||||
const gchar *text);
|
||||
@ -57,8 +57,8 @@ gboolean clutter_input_focus_is_focused (ClutterInputFocus *focus);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_input_focus_reset (ClutterInputFocus *focus);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_input_focus_set_cursor_location (ClutterInputFocus *focus,
|
||||
const graphene_rect_t *rect);
|
||||
void clutter_input_focus_set_cursor_location (ClutterInputFocus *focus,
|
||||
const ClutterRect *rect);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_input_focus_set_surrounding (ClutterInputFocus *focus,
|
||||
|
@ -26,8 +26,8 @@ ClutterInputFocus * clutter_input_method_get_focus (ClutterInputMethod *method);
|
||||
|
||||
void clutter_input_method_reset (ClutterInputMethod *method);
|
||||
|
||||
void clutter_input_method_set_cursor_location (ClutterInputMethod *method,
|
||||
const graphene_rect_t *rect);
|
||||
void clutter_input_method_set_cursor_location (ClutterInputMethod *method,
|
||||
const ClutterRect *rect);
|
||||
void clutter_input_method_set_surrounding (ClutterInputMethod *method,
|
||||
const gchar *text,
|
||||
guint cursor,
|
||||
|
@ -22,10 +22,10 @@
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter-private.h"
|
||||
#include "clutter/clutter-input-device-private.h"
|
||||
#include "clutter/clutter-input-method.h"
|
||||
#include "clutter/clutter-input-method-private.h"
|
||||
#include "clutter/clutter-input-focus-private.h"
|
||||
#include "clutter/clutter-device-manager-private.h"
|
||||
|
||||
typedef struct _ClutterInputMethodPrivate ClutterInputMethodPrivate;
|
||||
|
||||
@ -168,7 +168,7 @@ clutter_input_method_class_init (ClutterInputMethodClass *klass)
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_UINT);
|
||||
G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT);
|
||||
signals[REQUEST_SURROUNDING] =
|
||||
g_signal_new ("request-surrounding",
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
@ -187,7 +187,7 @@ clutter_input_method_class_init (ClutterInputMethodClass *klass)
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1, GRAPHENE_TYPE_RECT);
|
||||
G_TYPE_NONE, 1, CLUTTER_TYPE_RECT);
|
||||
|
||||
pspecs[PROP_CONTENT_HINTS] =
|
||||
g_param_spec_flags ("content-hints",
|
||||
@ -292,7 +292,7 @@ clutter_input_method_commit (ClutterInputMethod *im,
|
||||
|
||||
void
|
||||
clutter_input_method_delete_surrounding (ClutterInputMethod *im,
|
||||
int offset,
|
||||
guint offset,
|
||||
guint len)
|
||||
{
|
||||
ClutterInputMethodPrivate *priv;
|
||||
@ -377,8 +377,8 @@ clutter_input_method_reset (ClutterInputMethod *im)
|
||||
}
|
||||
|
||||
void
|
||||
clutter_input_method_set_cursor_location (ClutterInputMethod *im,
|
||||
const graphene_rect_t *rect)
|
||||
clutter_input_method_set_cursor_location (ClutterInputMethod *im,
|
||||
const ClutterRect *rect)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_INPUT_METHOD (im));
|
||||
|
||||
@ -452,9 +452,8 @@ clutter_input_method_forward_key (ClutterInputMethod *im,
|
||||
gboolean press)
|
||||
{
|
||||
ClutterInputMethodPrivate *priv;
|
||||
ClutterDeviceManager *device_manager;
|
||||
ClutterInputDevice *keyboard;
|
||||
ClutterSeat *seat;
|
||||
ClutterStageManager *stage_manager;
|
||||
ClutterStage *stage;
|
||||
ClutterEvent *event;
|
||||
|
||||
@ -464,10 +463,12 @@ clutter_input_method_forward_key (ClutterInputMethod *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);
|
||||
device_manager = clutter_device_manager_get_default ();
|
||||
keyboard = clutter_device_manager_get_core_device (device_manager,
|
||||
CLUTTER_KEYBOARD_DEVICE);
|
||||
stage = _clutter_input_device_get_stage (keyboard);
|
||||
if (stage == NULL)
|
||||
return;
|
||||
|
||||
event = clutter_event_new (press ? CLUTTER_KEY_PRESS : CLUTTER_KEY_RELEASE);
|
||||
event->key.time = time_;
|
||||
|
@ -42,8 +42,8 @@ struct _ClutterInputMethodClass
|
||||
|
||||
void (* reset) (ClutterInputMethod *im);
|
||||
|
||||
void (* set_cursor_location) (ClutterInputMethod *im,
|
||||
const graphene_rect_t *rect);
|
||||
void (* set_cursor_location) (ClutterInputMethod *im,
|
||||
const ClutterRect *rect);
|
||||
void (* set_surrounding) (ClutterInputMethod *im,
|
||||
const gchar *text,
|
||||
guint cursor,
|
||||
@ -68,7 +68,7 @@ void clutter_input_method_commit (ClutterInputMethod *im,
|
||||
const gchar *text);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_input_method_delete_surrounding (ClutterInputMethod *im,
|
||||
int offset,
|
||||
guint offset,
|
||||
guint len);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_input_method_request_surrounding (ClutterInputMethod *im);
|
||||
|
@ -25,9 +25,10 @@
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter-device-manager.h"
|
||||
#include "clutter-device-manager-private.h"
|
||||
#include "clutter-enum-types.h"
|
||||
#include "clutter-input-device.h"
|
||||
#include "clutter-input-device-private.h"
|
||||
#include "clutter-input-pointer-a11y-private.h"
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-virtual-input-device.h"
|
||||
@ -37,7 +38,7 @@ is_secondary_click_enabled (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterPointerA11ySettings settings;
|
||||
|
||||
clutter_seat_get_pointer_a11y_settings (device->seat, &settings);
|
||||
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
|
||||
|
||||
return (settings.controls & CLUTTER_A11Y_SECONDARY_CLICK_ENABLED);
|
||||
}
|
||||
@ -47,7 +48,7 @@ is_dwell_click_enabled (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterPointerA11ySettings settings;
|
||||
|
||||
clutter_seat_get_pointer_a11y_settings (device->seat, &settings);
|
||||
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
|
||||
|
||||
return (settings.controls & CLUTTER_A11Y_DWELL_ENABLED);
|
||||
}
|
||||
@ -57,7 +58,7 @@ get_secondary_click_delay (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterPointerA11ySettings settings;
|
||||
|
||||
clutter_seat_get_pointer_a11y_settings (device->seat, &settings);
|
||||
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
|
||||
|
||||
return settings.secondary_click_delay;
|
||||
}
|
||||
@ -67,7 +68,7 @@ get_dwell_delay (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterPointerA11ySettings settings;
|
||||
|
||||
clutter_seat_get_pointer_a11y_settings (device->seat, &settings);
|
||||
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
|
||||
|
||||
return settings.dwell_delay;
|
||||
}
|
||||
@ -77,7 +78,7 @@ get_dwell_threshold (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterPointerA11ySettings settings;
|
||||
|
||||
clutter_seat_get_pointer_a11y_settings (device->seat, &settings);
|
||||
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
|
||||
|
||||
return settings.dwell_threshold;
|
||||
}
|
||||
@ -87,7 +88,7 @@ get_dwell_mode (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterPointerA11ySettings settings;
|
||||
|
||||
clutter_seat_get_pointer_a11y_settings (device->seat, &settings);
|
||||
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
|
||||
|
||||
return settings.dwell_mode;
|
||||
}
|
||||
@ -97,7 +98,7 @@ get_dwell_click_type (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterPointerA11ySettings settings;
|
||||
|
||||
clutter_seat_get_pointer_a11y_settings (device->seat, &settings);
|
||||
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
|
||||
|
||||
return settings.dwell_click_type;
|
||||
}
|
||||
@ -108,7 +109,7 @@ get_dwell_click_type_for_direction (ClutterInputDevice *device,
|
||||
{
|
||||
ClutterPointerA11ySettings settings;
|
||||
|
||||
clutter_seat_get_pointer_a11y_settings (device->seat, &settings);
|
||||
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
|
||||
|
||||
if (direction == settings.dwell_gesture_single)
|
||||
return CLUTTER_A11Y_DWELL_CLICK_TYPE_PRIMARY;
|
||||
@ -167,7 +168,7 @@ trigger_secondary_click (gpointer data)
|
||||
device->ptr_a11y_data->secondary_click_triggered = TRUE;
|
||||
device->ptr_a11y_data->secondary_click_timer = 0;
|
||||
|
||||
g_signal_emit_by_name (device->seat,
|
||||
g_signal_emit_by_name (device->device_manager,
|
||||
"ptr-a11y-timeout-stopped",
|
||||
device,
|
||||
CLUTTER_A11Y_TIMEOUT_TYPE_SECONDARY_CLICK,
|
||||
@ -184,7 +185,7 @@ start_secondary_click_timeout (ClutterInputDevice *device)
|
||||
device->ptr_a11y_data->secondary_click_timer =
|
||||
clutter_threads_add_timeout (delay, trigger_secondary_click, device);
|
||||
|
||||
g_signal_emit_by_name (device->seat,
|
||||
g_signal_emit_by_name (device->device_manager,
|
||||
"ptr-a11y-timeout-started",
|
||||
device,
|
||||
CLUTTER_A11Y_TIMEOUT_TYPE_SECONDARY_CLICK,
|
||||
@ -196,10 +197,10 @@ stop_secondary_click_timeout (ClutterInputDevice *device)
|
||||
{
|
||||
if (device->ptr_a11y_data->secondary_click_timer)
|
||||
{
|
||||
g_clear_handle_id (&device->ptr_a11y_data->secondary_click_timer,
|
||||
g_source_remove);
|
||||
g_source_remove (device->ptr_a11y_data->secondary_click_timer);
|
||||
device->ptr_a11y_data->secondary_click_timer = 0;
|
||||
|
||||
g_signal_emit_by_name (device->seat,
|
||||
g_signal_emit_by_name (device->device_manager,
|
||||
"ptr-a11y-timeout-stopped",
|
||||
device,
|
||||
CLUTTER_A11Y_TIMEOUT_TYPE_SECONDARY_CLICK,
|
||||
@ -303,7 +304,7 @@ update_dwell_click_type (ClutterInputDevice *device)
|
||||
ClutterPointerA11ySettings settings;
|
||||
ClutterPointerA11yDwellClickType dwell_click_type;
|
||||
|
||||
clutter_seat_get_pointer_a11y_settings (device->seat, &settings);
|
||||
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
|
||||
|
||||
dwell_click_type = settings.dwell_click_type;
|
||||
switch (dwell_click_type)
|
||||
@ -328,9 +329,10 @@ update_dwell_click_type (ClutterInputDevice *device)
|
||||
if (dwell_click_type != settings.dwell_click_type)
|
||||
{
|
||||
settings.dwell_click_type = dwell_click_type;
|
||||
clutter_seat_set_pointer_a11y_settings (device->seat, &settings);
|
||||
clutter_device_manager_set_pointer_a11y_settings (device->device_manager,
|
||||
&settings);
|
||||
|
||||
g_signal_emit_by_name (device->seat,
|
||||
g_signal_emit_by_name (device->device_manager,
|
||||
"ptr-a11y-dwell-click-type-changed",
|
||||
dwell_click_type);
|
||||
}
|
||||
@ -435,7 +437,7 @@ trigger_dwell_gesture (gpointer data)
|
||||
device->ptr_a11y_data->dwell_timer =
|
||||
clutter_threads_add_timeout (delay, trigger_clear_dwell_gesture, device);
|
||||
|
||||
g_signal_emit_by_name (device->seat,
|
||||
g_signal_emit_by_name (device->device_manager,
|
||||
"ptr-a11y-timeout-stopped",
|
||||
device,
|
||||
CLUTTER_A11Y_TIMEOUT_TYPE_GESTURE,
|
||||
@ -453,7 +455,7 @@ start_dwell_gesture_timeout (ClutterInputDevice *device)
|
||||
clutter_threads_add_timeout (delay, trigger_dwell_gesture, device);
|
||||
device->ptr_a11y_data->dwell_gesture_started = TRUE;
|
||||
|
||||
g_signal_emit_by_name (device->seat,
|
||||
g_signal_emit_by_name (device->device_manager,
|
||||
"ptr-a11y-timeout-started",
|
||||
device,
|
||||
CLUTTER_A11Y_TIMEOUT_TYPE_GESTURE,
|
||||
@ -467,7 +469,7 @@ trigger_dwell_click (gpointer data)
|
||||
|
||||
device->ptr_a11y_data->dwell_timer = 0;
|
||||
|
||||
g_signal_emit_by_name (device->seat,
|
||||
g_signal_emit_by_name (device->device_manager,
|
||||
"ptr-a11y-timeout-stopped",
|
||||
device,
|
||||
CLUTTER_A11Y_TIMEOUT_TYPE_DWELL,
|
||||
@ -497,7 +499,7 @@ start_dwell_timeout (ClutterInputDevice *device)
|
||||
device->ptr_a11y_data->dwell_timer =
|
||||
clutter_threads_add_timeout (delay, trigger_dwell_click, device);
|
||||
|
||||
g_signal_emit_by_name (device->seat,
|
||||
g_signal_emit_by_name (device->device_manager,
|
||||
"ptr-a11y-timeout-started",
|
||||
device,
|
||||
CLUTTER_A11Y_TIMEOUT_TYPE_DWELL,
|
||||
@ -509,10 +511,11 @@ stop_dwell_timeout (ClutterInputDevice *device)
|
||||
{
|
||||
if (device->ptr_a11y_data->dwell_timer)
|
||||
{
|
||||
g_clear_handle_id (&device->ptr_a11y_data->dwell_timer, g_source_remove);
|
||||
g_source_remove (device->ptr_a11y_data->dwell_timer);
|
||||
device->ptr_a11y_data->dwell_timer = 0;
|
||||
device->ptr_a11y_data->dwell_gesture_started = FALSE;
|
||||
|
||||
g_signal_emit_by_name (device->seat,
|
||||
g_signal_emit_by_name (device->device_manager,
|
||||
"ptr-a11y-timeout-stopped",
|
||||
device,
|
||||
CLUTTER_A11Y_TIMEOUT_TYPE_DWELL,
|
||||
@ -571,7 +574,8 @@ is_device_core_pointer (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterInputDevice *core_pointer;
|
||||
|
||||
core_pointer = clutter_seat_get_pointer (device->seat);
|
||||
core_pointer = clutter_device_manager_get_core_device (device->device_manager,
|
||||
CLUTTER_POINTER_DEVICE);
|
||||
if (core_pointer == NULL)
|
||||
return FALSE;
|
||||
|
||||
@ -585,8 +589,8 @@ _clutter_input_pointer_a11y_add_device (ClutterInputDevice *device)
|
||||
return;
|
||||
|
||||
device->accessibility_virtual_device =
|
||||
clutter_seat_create_virtual_device (device->seat,
|
||||
CLUTTER_POINTER_DEVICE);
|
||||
clutter_device_manager_create_virtual_device (device->device_manager,
|
||||
CLUTTER_POINTER_DEVICE);
|
||||
|
||||
device->ptr_a11y_data = g_new0 (ClutterPtrA11yData, 1);
|
||||
}
|
||||
|
@ -37,6 +37,9 @@
|
||||
* any object taking a reference on a #ClutterInterval instance should
|
||||
* also take ownership of the interval by using g_object_ref_sink().
|
||||
*
|
||||
* #ClutterInterval is used by #ClutterAnimation to define the
|
||||
* interval of values that an implicit animation should tween over.
|
||||
*
|
||||
* #ClutterInterval can be subclassed to override the validation
|
||||
* and value computation.
|
||||
*
|
||||
|
@ -62,9 +62,3 @@ clutter_keymap_get_caps_lock_state (ClutterKeymap *keymap)
|
||||
{
|
||||
return CLUTTER_KEYMAP_GET_CLASS (keymap)->get_caps_lock_state (keymap);
|
||||
}
|
||||
|
||||
PangoDirection
|
||||
clutter_keymap_get_direction (ClutterKeymap *keymap)
|
||||
{
|
||||
return CLUTTER_KEYMAP_GET_CLASS (keymap)->get_direction (keymap);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user