Compare commits
3 Commits
gtk3-ci
...
wip/nielsd
Author | SHA1 | Date | |
---|---|---|---|
4233ecd539 | |||
355d486502 | |||
84415f936c |
@ -1,4 +1,4 @@
|
||||
image: registry.gitlab.gnome.org/gnome/mutter/master:v3
|
||||
image: registry.gitlab.gnome.org/gnome/mutter/master:v2
|
||||
|
||||
stages:
|
||||
- review
|
||||
@ -28,20 +28,6 @@ build-mutter:
|
||||
- merge_requests
|
||||
- /^.*$/
|
||||
|
||||
build-without-opengl-and-glx:
|
||||
stage: build
|
||||
script:
|
||||
- meson . build -Dbuildtype=debugoptimized -Dopengl=false -Dglx=false -Degl_device=true -Dwayland_eglstream=true --werror --prefix /usr
|
||||
- ninja -C build
|
||||
- ninja -C build install
|
||||
artifacts:
|
||||
expire_in: 1 day
|
||||
paths:
|
||||
- build
|
||||
only:
|
||||
- merge_requests
|
||||
- /^.*$/
|
||||
|
||||
build-without-native-backend-and-wayland:
|
||||
stage: build
|
||||
script:
|
||||
|
@ -1,32 +1,40 @@
|
||||
# Rebuild and push with
|
||||
#
|
||||
# cd .gitlab-ci/
|
||||
# podman build --format docker --no-cache -t registry.gitlab.gnome.org/gnome/mutter/master:v3 .
|
||||
# podman push registry.gitlab.gnome.org/gnome/mutter/master:v3
|
||||
# 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:31
|
||||
FROM fedora:30
|
||||
|
||||
RUN dnf -y update && dnf -y upgrade && \
|
||||
dnf install -y 'dnf-command(builddep)' && \
|
||||
dnf install -y 'dnf-command(copr)' && \
|
||||
dnf copr enable -y fmuellner/gnome-shell-ci && \
|
||||
dnf copr enable -y jadahl/mutter-ci && \
|
||||
dnf copr enable -y hergertme/sysprof-3 && \
|
||||
dnf -y update && dnf -y upgrade && \
|
||||
|
||||
dnf builddep -y mutter && \
|
||||
|
||||
# Until Fedora catches up with new build-deps
|
||||
dnf install -y 'pkgconfig(graphene-gobject-1.0)' 'pkgconfig(sysprof-capture-3)' && \
|
||||
# Until Fedora catches up with meson build-deps
|
||||
dnf install -y meson xorg-x11-server-Xorg gnome-settings-daemon-devel egl-wayland-devel xorg-x11-server-Xwayland graphene-devel && \
|
||||
|
||||
# Until Fedora catches up with mesa bug fixes
|
||||
dnf upgrade -y mesa-dri-drivers mesa-libEGL && \
|
||||
|
||||
# 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 && \
|
||||
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 && \
|
||||
# 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 upgrade -y 'pkgconfig(libpipewire-0.3)' && \
|
||||
|
||||
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"
|
214
NEWS
214
NEWS
@ -1,217 +1,3 @@
|
||||
3.36.1
|
||||
======
|
||||
* Fix hardware cursor on GPU hotplpug [Pekka; !1097]
|
||||
* Fix black areas around XWayland windows when resizing [Robert, Olivier; !1091]
|
||||
* Fix applying wrong scale to monitors on X11 [Jonas; !1118]
|
||||
* Fix moving/resizing windows via keyboard on wayland [Alynx; !997]
|
||||
* Fix locate-pointer feature interfering with keybindings [Carlos; !1014]
|
||||
* Add support for middle-click emulation [Andrew; !256]
|
||||
* Fix freeze when moving cursor between scaled monitors [Robert; !1125]
|
||||
* Fix popup misplacement with focus-follows-mouse [Jonas Å.; !1122]
|
||||
* Fix misplaced cursor in preedit strings [Carlos; !1132]
|
||||
* Support mirroring with proprietary Nvidia driver [Jonas Å.; !1098]
|
||||
* Support tablets with multiple mode switch buttons in a group [Carlos; !970]
|
||||
* Ignore foreground color for color glyphs (emojis) [Carlos; !1148]
|
||||
* Allow pad mode switches while showing OSD [Carlos; !975]
|
||||
* Fix positioning of OSD for display-attached tablets [Carlos; !971]
|
||||
* Respect configured RANDR panning on X11 [Jonas Å.; !1085]
|
||||
* Use correct texture filtering with scaled displays [Jonas; !1124]
|
||||
* Fix cursor hotspots in virtual machines [Jonas Å.; !1136]
|
||||
* Fix build with GLES and no GL [Georges; !1151]
|
||||
* Work around Firefox bug when copying images on wayland [Robert; !1141]
|
||||
* Fix wrong cursor rotation on rotated displays [Hans; !1153]
|
||||
* Fix glitches in window screencasts [Georges; !1129]
|
||||
* Fix IM support for deleting surrounding text [Takao, Carlos; #539]
|
||||
* Fix map animation of maximized windows [Robert; !1164]
|
||||
* Fixed crashes [Jonas Å., Carlos, Florian, Robert; !1120, !1121,
|
||||
#917, #1132, #1083, !1147, #1147]
|
||||
* Misc. bug fixes and cleanups [Jonas Å., Olivier, Mart, Sebastian, Corentin,
|
||||
Andre, Daniel, Robert, Carlos, Peter, Georges, Jonas D., Florian, Christian;
|
||||
!1115, !1102, !1104, !1106, !1117, !1119, !1101, !1123, #1124, !1130, !1131,
|
||||
!1133, #1065, !1108, !1144, !1145, !1109, !1059, !1107, !999, !1152, #1128,
|
||||
!1155, !1156, !1158, !1157, #1146, !1161, !1163]
|
||||
|
||||
Contributors:
|
||||
Jonas Dreßler, Olivier Fourdan, Takao Fujiwara, Carlos Garnacho, Andrew Gaul,
|
||||
Hans de Goede, Peter Hutterer, Sebastian Keller, Robert Mader,
|
||||
Andre Moreira Magalhaes, Florian Müllner, Georges Basile Stavracas Neto,
|
||||
Corentin Noël, Pekka Paalanen, Christian Rauch, Mart Raudsepp,
|
||||
Daniel van Vugt, Alynx Zhou, Jonas Ådahl
|
||||
|
||||
Translators:
|
||||
Марко Костић [sr], Daniel Șerbănescu [ro]
|
||||
|
||||
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]
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
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__ */
|
@ -39,6 +39,7 @@
|
||||
#include "cally-group.h"
|
||||
#include "cally-stage.h"
|
||||
#include "cally-text.h"
|
||||
#include "cally-texture.h"
|
||||
#include "cally-rectangle.h"
|
||||
#include "cally-clone.h"
|
||||
|
||||
@ -55,6 +56,7 @@ 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)
|
||||
|
||||
@ -76,6 +78,7 @@ cally_accessibility_init (void)
|
||||
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);
|
||||
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "cally-root.h"
|
||||
#include "cally-stage.h"
|
||||
#include "cally-text.h"
|
||||
#include "cally-texture.h"
|
||||
#include "cally-util.h"
|
||||
|
||||
#undef __CALLY_H_INSIDE__
|
||||
|
@ -51,7 +51,7 @@
|
||||
struct _ClutterActorMetaPrivate
|
||||
{
|
||||
ClutterActor *actor;
|
||||
gulong destroy_id;
|
||||
guint destroy_id;
|
||||
|
||||
gchar *name;
|
||||
|
||||
@ -91,7 +91,11 @@ clutter_actor_meta_real_set_actor (ClutterActorMeta *meta,
|
||||
if (meta->priv->actor == actor)
|
||||
return;
|
||||
|
||||
g_clear_signal_handler (&meta->priv->destroy_id, meta->priv->actor);
|
||||
if (meta->priv->destroy_id != 0)
|
||||
{
|
||||
g_signal_handler_disconnect (meta->priv->actor, meta->priv->destroy_id);
|
||||
meta->priv->destroy_id = 0;
|
||||
}
|
||||
|
||||
meta->priv->actor = actor;
|
||||
|
||||
@ -158,8 +162,8 @@ clutter_actor_meta_finalize (GObject *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);
|
||||
|
||||
|
@ -315,6 +315,7 @@ void _clutter_actor_queue_relayout_on_clones
|
||||
void _clutter_actor_queue_only_relayout (ClutterActor *actor);
|
||||
void _clutter_actor_queue_update_resource_scale_recursive (ClutterActor *actor);
|
||||
|
||||
CoglFramebuffer * _clutter_actor_get_active_framebuffer (ClutterActor *actor);
|
||||
gboolean _clutter_actor_get_real_resource_scale (ClutterActor *actor,
|
||||
float *resource_scale);
|
||||
|
||||
|
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
|
||||
|
||||
@ -230,14 +228,12 @@ struct _ClutterActorClass
|
||||
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);
|
||||
void (* pick) (ClutterActor *actor);
|
||||
|
||||
gboolean (* queue_redraw) (ClutterActor *actor,
|
||||
ClutterActor *leaf_that_queued,
|
||||
@ -299,11 +295,10 @@ struct _ClutterActorClass
|
||||
|
||||
gboolean (* touch_event) (ClutterActor *self,
|
||||
ClutterTouchEvent *event);
|
||||
gboolean (* has_accessible) (ClutterActor *self);
|
||||
|
||||
/*< private >*/
|
||||
/* padding for future expansion */
|
||||
gpointer _padding_dummy[25];
|
||||
gpointer _padding_dummy[26];
|
||||
};
|
||||
|
||||
/**
|
||||
@ -354,17 +349,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
|
||||
@ -381,8 +368,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);
|
||||
@ -884,11 +869,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
|
||||
@ -923,7 +903,6 @@ void clutter_actor_bind_model_with_properties
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_pick_box (ClutterActor *self,
|
||||
ClutterPickContext *pick_context,
|
||||
const ClutterActorBox *box);
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -54,6 +54,7 @@
|
||||
#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);
|
||||
@ -63,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
|
||||
|
@ -90,7 +90,6 @@ 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)
|
||||
|
@ -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;
|
||||
@ -56,6 +59,8 @@ struct _ClutterBackend
|
||||
ClutterStageWindow *stage_window;
|
||||
|
||||
ClutterInputMethod *input_method;
|
||||
|
||||
ClutterKeymap *keymap;
|
||||
};
|
||||
|
||||
struct _ClutterBackendClass
|
||||
@ -84,12 +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);
|
||||
|
||||
void (* bell_notify) (ClutterBackend *backend);
|
||||
|
||||
ClutterKeymap * (* get_keymap) (ClutterBackend *backend);
|
||||
|
||||
/* signals */
|
||||
void (* resolution_changed) (ClutterBackend *backend);
|
||||
@ -129,6 +139,11 @@ 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
|
||||
|
@ -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"
|
||||
@ -527,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)
|
||||
{
|
||||
@ -590,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
|
||||
@ -756,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);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -970,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 == NULL)
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -982,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
|
||||
@ -1010,24 +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);
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
|
@ -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"
|
||||
@ -698,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);
|
||||
}
|
||||
|
@ -144,55 +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;
|
||||
|
||||
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,
|
||||
@ -377,8 +328,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);
|
||||
|
@ -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;
|
||||
@ -202,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);
|
||||
@ -257,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,
|
||||
@ -346,12 +351,6 @@ on_captured_event (ClutterActor *stage,
|
||||
ClutterModifierType modifier_state;
|
||||
gboolean has_button = TRUE;
|
||||
|
||||
if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (action)))
|
||||
{
|
||||
clutter_click_action_release (action);
|
||||
return CLUTTER_EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
|
||||
|
||||
switch (clutter_event_type (event))
|
||||
@ -376,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;
|
||||
@ -446,7 +453,7 @@ clutter_click_action_set_actor (ClutterActorMeta *meta,
|
||||
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;
|
||||
}
|
||||
@ -454,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);
|
||||
@ -534,12 +545,24 @@ clutter_click_action_dispose (GObject *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);
|
||||
}
|
||||
@ -737,7 +760,11 @@ clutter_click_action_release (ClutterClickAction *action)
|
||||
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);
|
||||
|
@ -152,8 +152,7 @@ clutter_clone_apply_transform (ClutterActor *self, CoglMatrix *matrix)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_clone_paint (ClutterActor *actor,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_clone_paint (ClutterActor *actor)
|
||||
{
|
||||
ClutterClone *self = CLUTTER_CLONE (actor);
|
||||
ClutterClonePrivate *priv = self->priv;
|
||||
@ -190,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 ();
|
||||
}
|
||||
|
||||
@ -401,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;
|
||||
|
||||
|
@ -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().
|
||||
@ -222,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"
|
||||
@ -385,6 +384,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 +474,33 @@ 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_container_get_children:
|
||||
* @container: a #ClutterContainer
|
||||
@ -1251,23 +1304,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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -147,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;
|
||||
}
|
||||
@ -166,16 +166,14 @@ 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)
|
||||
{
|
||||
|
@ -5,13 +5,24 @@
|
||||
|
||||
#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;
|
||||
|
306
clutter/clutter/clutter-device-manager-private.h
Normal file
306
clutter/clutter/clutter-device-manager-private.h
Normal file
@ -0,0 +1,306 @@
|
||||
/*
|
||||
* 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);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_device_manager_ensure_a11y_state (ClutterDeviceManager *device_manager);
|
||||
|
||||
/* input device */
|
||||
CLUTTER_EXPORT
|
||||
gboolean _clutter_input_device_has_sequence (ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence);
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_input_device_add_event_sequence (ClutterInputDevice *device,
|
||||
ClutterEvent *event);
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_input_device_remove_event_sequence (ClutterInputDevice *device,
|
||||
ClutterEvent *event);
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_input_device_set_coords (ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
gfloat x,
|
||||
gfloat y,
|
||||
ClutterStage *stage);
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_input_device_set_state (ClutterInputDevice *device,
|
||||
ClutterModifierType state);
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_input_device_set_time (ClutterInputDevice *device,
|
||||
guint32 time_);
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_input_device_set_stage (ClutterInputDevice *device,
|
||||
ClutterStage *stage);
|
||||
CLUTTER_EXPORT
|
||||
ClutterStage * _clutter_input_device_get_stage (ClutterInputDevice *device);
|
||||
void _clutter_input_device_set_actor (ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
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__ */
|
753
clutter/clutter/clutter-device-manager.c
Normal file
753
clutter/clutter/clutter-device-manager.c
Normal file
@ -0,0 +1,753 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_device_manager_ensure_a11y_state (ClutterDeviceManager *device_manager)
|
||||
{
|
||||
ClutterInputDevice *core_pointer;
|
||||
|
||||
core_pointer = clutter_device_manager_get_core_device (device_manager,
|
||||
CLUTTER_POINTER_DEVICE);
|
||||
if (core_pointer)
|
||||
{
|
||||
if (_clutter_is_input_pointer_a11y_enabled (core_pointer))
|
||||
_clutter_input_pointer_a11y_add_device (core_pointer);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
are_kbd_a11y_settings_equal (ClutterKbdA11ySettings *a,
|
||||
ClutterKbdA11ySettings *b)
|
||||
{
|
||||
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__ */
|
@ -315,7 +315,11 @@ emit_drag_end (ClutterDragAction *action,
|
||||
goto out;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
clutter_stage_set_motion_events_enabled (priv->stage,
|
||||
priv->motion_events_enabled);
|
||||
@ -474,8 +478,8 @@ clutter_drag_action_set_actor (ClutterActorMeta *meta,
|
||||
old_actor = clutter_actor_meta_get_actor (meta);
|
||||
if (old_actor != NULL)
|
||||
{
|
||||
g_clear_signal_handler (&priv->button_press_id, old_actor);
|
||||
g_clear_signal_handler (&priv->touch_begin_id, old_actor);
|
||||
g_signal_handler_disconnect (old_actor, priv->button_press_id);
|
||||
g_signal_handler_disconnect (old_actor, priv->touch_begin_id);
|
||||
}
|
||||
|
||||
priv->button_press_id = 0;
|
||||
@ -485,7 +489,7 @@ clutter_drag_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;
|
||||
@ -664,7 +668,7 @@ clutter_drag_action_dispose (GObject *gobject)
|
||||
priv->motion_events_enabled);
|
||||
|
||||
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;
|
||||
@ -677,8 +681,8 @@ clutter_drag_action_dispose (GObject *gobject)
|
||||
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (gobject));
|
||||
if (actor != NULL)
|
||||
{
|
||||
g_clear_signal_handler (&priv->button_press_id, actor);
|
||||
g_clear_signal_handler (&priv->touch_begin_id, actor);
|
||||
g_signal_handler_disconnect (actor, priv->button_press_id);
|
||||
g_signal_handler_disconnect (actor, priv->touch_begin_id);
|
||||
}
|
||||
|
||||
priv->button_press_id = 0;
|
||||
|
@ -107,7 +107,7 @@ drop_target_free (gpointer _data)
|
||||
{
|
||||
DropTarget *data = _data;
|
||||
|
||||
g_clear_signal_handler (&data->capture_id, data->stage);
|
||||
g_signal_handler_disconnect (data->stage, data->capture_id);
|
||||
g_hash_table_destroy (data->actions);
|
||||
g_free (data);
|
||||
}
|
||||
@ -326,10 +326,12 @@ clutter_drop_action_set_actor (ClutterActorMeta *meta,
|
||||
{
|
||||
drop_action_unregister (CLUTTER_DROP_ACTION (meta));
|
||||
|
||||
g_clear_signal_handler (&priv->mapped_id, priv->actor);
|
||||
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;
|
||||
|
@ -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
|
||||
|
||||
|
@ -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,24 +206,24 @@ 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
|
||||
@ -266,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);
|
||||
|
@ -535,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().
|
||||
*
|
||||
@ -549,9 +545,8 @@ 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;
|
||||
|
||||
/**
|
||||
@ -678,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;
|
||||
|
||||
/**
|
||||
@ -978,6 +970,8 @@ 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.
|
||||
@ -993,6 +987,8 @@ 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),
|
||||
@ -1191,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
|
||||
@ -1198,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
|
||||
*
|
||||
|
@ -2161,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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
@ -308,7 +308,11 @@ cancel_gesture (ClutterGestureAction *action)
|
||||
|
||||
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);
|
||||
@ -477,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;
|
||||
}
|
||||
@ -531,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;
|
||||
}
|
||||
@ -539,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;
|
||||
|
@ -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
|
||||
|
@ -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,255 +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 _ClutterTouchInfo
|
||||
{
|
||||
ClutterEventSequence *sequence;
|
||||
ClutterActor *actor;
|
||||
|
||||
float current_x;
|
||||
float 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;
|
||||
|
||||
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 stage the device is on */
|
||||
ClutterStage *stage;
|
||||
|
||||
/* the current state */
|
||||
float current_x;
|
||||
float current_y;
|
||||
uint32_t current_time;
|
||||
int current_button_number;
|
||||
ClutterModifierType current_state;
|
||||
|
||||
/* the current touch points states */
|
||||
GHashTable *touch_sequences_info;
|
||||
|
||||
/* the previous state, used for click count generation */
|
||||
int previous_x;
|
||||
int previous_y;
|
||||
uint32_t previous_time;
|
||||
int previous_button_number;
|
||||
ClutterModifierType previous_state;
|
||||
|
||||
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;
|
||||
|
||||
ClutterInputDeviceMapping mapping_mode;
|
||||
|
||||
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
|
||||
ClutterStage * _clutter_input_device_get_stage (ClutterInputDevice *device);
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_input_device_set_stage (ClutterInputDevice *device,
|
||||
ClutterStage *stage);
|
||||
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_);
|
||||
void _clutter_input_device_set_actor (ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
ClutterActor *actor,
|
||||
gboolean emit_crossing);
|
||||
CLUTTER_EXPORT
|
||||
ClutterActor * clutter_input_device_update (ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
gboolean emit_crossing);
|
||||
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_n_keys (ClutterInputDevice *device,
|
||||
guint n_keys);
|
||||
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);
|
||||
|
||||
#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,7 +57,7 @@ enum
|
||||
PROP_NAME,
|
||||
|
||||
PROP_DEVICE_TYPE,
|
||||
PROP_SEAT,
|
||||
PROP_DEVICE_MANAGER,
|
||||
PROP_DEVICE_MODE,
|
||||
|
||||
PROP_HAS_CURSOR,
|
||||
@ -96,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)
|
||||
{
|
||||
@ -171,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:
|
||||
@ -247,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:
|
||||
@ -362,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);
|
||||
|
||||
/**
|
||||
@ -798,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
|
||||
@ -1016,7 +1017,7 @@ clutter_input_device_get_coords (ClutterInputDevice *device,
|
||||
}
|
||||
|
||||
/*
|
||||
* clutter_input_device_update:
|
||||
* _clutter_input_device_update:
|
||||
* @device: a #ClutterInputDevice
|
||||
*
|
||||
* Updates the input @device by determining the #ClutterActor underneath the
|
||||
@ -1030,9 +1031,9 @@ clutter_input_device_get_coords (ClutterInputDevice *device,
|
||||
* Since: 1.2
|
||||
*/
|
||||
ClutterActor *
|
||||
clutter_input_device_update (ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
gboolean emit_crossing)
|
||||
_clutter_input_device_update (ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
gboolean emit_crossing)
|
||||
{
|
||||
ClutterStage *stage;
|
||||
ClutterActor *new_cursor_actor;
|
||||
@ -1223,11 +1224,11 @@ clutter_input_device_get_device_mode (ClutterInputDevice *device)
|
||||
*
|
||||
* translate_native_event_to_clutter (native_event, &c_event);
|
||||
*
|
||||
* // get the seat
|
||||
* seat = clutter_backend_get_deafult_seat (clutter_get_default_backend ());
|
||||
* // get the device manager
|
||||
* manager = clutter_device_manager_get_default ();
|
||||
*
|
||||
* // use the default Core Pointer that Clutter backends register by default
|
||||
* device = clutter_seat_get_pointer (seat);
|
||||
* 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);
|
||||
@ -2440,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))
|
||||
@ -201,8 +171,6 @@ void clutter_input_device_set_mapping_mode (ClutterInputDev
|
||||
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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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),
|
||||
@ -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;
|
||||
@ -452,8 +452,8 @@ clutter_input_method_forward_key (ClutterInputMethod *im,
|
||||
gboolean press)
|
||||
{
|
||||
ClutterInputMethodPrivate *priv;
|
||||
ClutterDeviceManager *device_manager;
|
||||
ClutterInputDevice *keyboard;
|
||||
ClutterSeat *seat;
|
||||
ClutterStage *stage;
|
||||
ClutterEvent *event;
|
||||
|
||||
@ -463,8 +463,9 @@ clutter_input_method_forward_key (ClutterInputMethod *im,
|
||||
if (!priv->focus)
|
||||
return;
|
||||
|
||||
seat = clutter_backend_get_default_seat (clutter_get_default_backend ());
|
||||
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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include <clutter/clutter-macros.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <pango/pango.h>
|
||||
|
||||
typedef struct _ClutterKeymap ClutterKeymap;
|
||||
typedef struct _ClutterKeymapClass ClutterKeymapClass;
|
||||
@ -40,7 +39,6 @@ struct _ClutterKeymapClass
|
||||
|
||||
gboolean (* get_num_lock_state) (ClutterKeymap *keymap);
|
||||
gboolean (* get_caps_lock_state) (ClutterKeymap *keymap);
|
||||
PangoDirection (* get_direction) (ClutterKeymap *keymap);
|
||||
};
|
||||
|
||||
#define CLUTTER_TYPE_KEYMAP (clutter_keymap_get_type ())
|
||||
@ -55,6 +53,4 @@ gboolean clutter_keymap_get_num_lock_state (ClutterKeymap *keymap);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_keymap_get_caps_lock_state (ClutterKeymap *keymap);
|
||||
|
||||
PangoDirection clutter_keymap_get_direction (ClutterKeymap *keymap);
|
||||
|
||||
#endif /* CLUTTER_KEYMAP_H */
|
||||
|
@ -58,6 +58,10 @@ die "Could not open file keysymdef.h: $!\n"
|
||||
die "Could not open file clutter-keysyms.h: $!\n"
|
||||
unless open(OUT_KEYSYMS, ">:utf8", "clutter-keysyms.h");
|
||||
|
||||
# Output: clutter/clutter/deprecated/clutter-keysyms.h
|
||||
die "Could not open file clutter-keysyms-compat.h: $!\n"
|
||||
unless open(OUT_KEYSYMS_COMPAT, ">:utf8", "deprecated/clutter-keysyms.h");
|
||||
|
||||
my $LICENSE_HEADER= <<EOF;
|
||||
/* Clutter
|
||||
*
|
||||
@ -81,6 +85,7 @@ my $LICENSE_HEADER= <<EOF;
|
||||
EOF
|
||||
|
||||
print OUT_KEYSYMS $LICENSE_HEADER;
|
||||
print OUT_KEYSYMS_COMPAT $LICENSE_HEADER;
|
||||
|
||||
print OUT_KEYSYMS<<EOF;
|
||||
|
||||
@ -99,6 +104,23 @@ print OUT_KEYSYMS<<EOF;
|
||||
|
||||
EOF
|
||||
|
||||
print OUT_KEYSYMS_COMPAT<<EOF;
|
||||
/*
|
||||
* Compatibility version of clutter-keysyms.h.
|
||||
*
|
||||
* Since Clutter 1.4, the key symbol defines have been changed to have
|
||||
* a KEY_ prefix. This is a compatibility header that is included when
|
||||
* deprecated symbols are enabled. Consider porting to the new names
|
||||
* instead.
|
||||
*/
|
||||
|
||||
#ifndef __CLUTTER_KEYSYMS_DEPRECATED_H__
|
||||
#define __CLUTTER_KEYSYMS_DEPRECATED_H__
|
||||
|
||||
#ifndef CLUTTER_DISABLE_DEPRECATED
|
||||
|
||||
EOF
|
||||
|
||||
while (<IN_KEYSYMDEF>)
|
||||
{
|
||||
next if ( ! /^#define / );
|
||||
@ -115,8 +137,13 @@ while (<IN_KEYSYMDEF>)
|
||||
my $element = $keysymelements[1];
|
||||
my $binding = $element;
|
||||
$binding =~ s/^XK_/CLUTTER_KEY_/g;
|
||||
my $compat_binding = $element;
|
||||
$compat_binding =~ s/^XK_/CLUTTER_/g;
|
||||
|
||||
my $deprecation = "CLUTTER_DEPRECATED_MACRO_FOR(\"Deprecated key symbol. Use $binding instead.\")";
|
||||
|
||||
printf OUT_KEYSYMS "#define %s 0x%03x\n", $binding, hex($keysymelements[2]);
|
||||
printf OUT_KEYSYMS_COMPAT "#define %s 0x%03x %s\n", $compat_binding, hex($keysymelements[2]), $deprecation;
|
||||
}
|
||||
|
||||
close IN_KEYSYMDEF;
|
||||
@ -160,8 +187,11 @@ while (<IN_XF86KEYSYM>)
|
||||
my $element = $keysymelements[1];
|
||||
my $binding = $element;
|
||||
$binding =~ s/^XF86XK_/CLUTTER_KEY_/g;
|
||||
my $compat_binding = $element;
|
||||
$compat_binding =~ s/^XF86XK_/CLUTTER_/g;
|
||||
|
||||
printf OUT_KEYSYMS "#define %s 0x%03x\n", $binding, hex($keysymelements[2]);
|
||||
printf OUT_KEYSYMS_COMPAT "#define %s 0x%03x\n", $compat_binding, hex($keysymelements[2]);
|
||||
}
|
||||
|
||||
close IN_XF86KEYSYM;
|
||||
@ -172,6 +202,13 @@ print OUT_KEYSYMS<<EOF;
|
||||
#endif /* __CLUTTER_KEYSYMS_H__ */
|
||||
EOF
|
||||
|
||||
print OUT_KEYSYMS_COMPAT<<EOF;
|
||||
|
||||
#endif /* CLUTTER_DISABLE_DEPRECATED */
|
||||
|
||||
#endif /* __CLUTTER_KEYSYMS_DEPRECATED_H__ */
|
||||
EOF
|
||||
|
||||
foreach my $f (qw/ keysymdef.h XF86keysym.h /) {
|
||||
unlink $f or die "Unable to delete $f: $!";
|
||||
}
|
||||
|
@ -98,11 +98,11 @@
|
||||
* |[
|
||||
* {
|
||||
* "type" : "ClutterBox",
|
||||
* "layout-manager" : { "type" : "ClutterGridLayout" },
|
||||
* "layout-manager" : { "type" : "ClutterTableLayout" },
|
||||
* "children" : [
|
||||
* {
|
||||
* "type" : "ClutterText",
|
||||
* "text" : "Some text",
|
||||
* "type" : "ClutterTexture",
|
||||
* "filename" : "image-00.png",
|
||||
*
|
||||
* "layout::row" : 0,
|
||||
* "layout::column" : 0,
|
||||
@ -112,8 +112,8 @@
|
||||
* "layout::y-expand" : true
|
||||
* },
|
||||
* {
|
||||
* "type" : "ClutterText",
|
||||
* "text" : "Some more text",
|
||||
* "type" : "ClutterTexture",
|
||||
* "filename" : "image-01.png",
|
||||
*
|
||||
* "layout::row" : 0,
|
||||
* "layout::column" : 1,
|
||||
@ -329,6 +329,9 @@ layout_manager_real_begin_animation (ClutterLayoutManager *manager,
|
||||
/* let the alpha take ownership of the timeline */
|
||||
g_object_unref (timeline);
|
||||
|
||||
g_signal_connect_swapped (timeline, "completed",
|
||||
G_CALLBACK (clutter_layout_manager_end_animation),
|
||||
manager);
|
||||
g_signal_connect_swapped (timeline, "new-frame",
|
||||
G_CALLBACK (clutter_layout_manager_layout_changed),
|
||||
manager);
|
||||
@ -372,6 +375,9 @@ layout_manager_real_end_animation (ClutterLayoutManager *manager)
|
||||
if (clutter_timeline_is_playing (timeline))
|
||||
clutter_timeline_stop (timeline);
|
||||
|
||||
g_signal_handlers_disconnect_by_func (timeline,
|
||||
G_CALLBACK (clutter_layout_manager_end_animation),
|
||||
manager);
|
||||
g_signal_handlers_disconnect_by_func (timeline,
|
||||
G_CALLBACK (clutter_layout_manager_layout_changed),
|
||||
manager);
|
||||
|
@ -213,6 +213,15 @@ void clutter_layout_manager_child_get_property (ClutterLayoutMa
|
||||
const gchar *property_name,
|
||||
GValue *value);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterAlpha * clutter_layout_manager_begin_animation (ClutterLayoutManager *manager,
|
||||
guint duration,
|
||||
gulong mode);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_layout_manager_end_animation (ClutterLayoutManager *manager);
|
||||
CLUTTER_DEPRECATED
|
||||
gdouble clutter_layout_manager_get_animation_progress (ClutterLayoutManager *manager);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_LAYOUT_MANAGER_H__ */
|
||||
|
@ -55,15 +55,14 @@
|
||||
#include "clutter-backend-private.h"
|
||||
#include "clutter-config.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-device-manager-private.h"
|
||||
#include "clutter-event-private.h"
|
||||
#include "clutter-feature.h"
|
||||
#include "clutter-input-device-private.h"
|
||||
#include "clutter-input-pointer-a11y-private.h"
|
||||
#include "clutter-graphene.h"
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-master-clock.h"
|
||||
#include "clutter-mutter.h"
|
||||
#include "clutter-paint-node-private.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-settings-private.h"
|
||||
#include "clutter-stage-manager.h"
|
||||
@ -971,9 +970,6 @@ clutter_init_real (GError **error)
|
||||
if (clutter_enable_accessibility)
|
||||
cally_accessibility_init ();
|
||||
|
||||
/* Initialize types required for paint nodes */
|
||||
_clutter_paint_node_init_types ();
|
||||
|
||||
return CLUTTER_INIT_SUCCESS;
|
||||
}
|
||||
|
||||
@ -1527,7 +1523,7 @@ event_click_count_generate (ClutterEvent *event)
|
||||
previous_y = event->button.y;
|
||||
previous_time = event->button.time;
|
||||
|
||||
G_GNUC_FALLTHROUGH;
|
||||
/* fallthrough */
|
||||
case CLUTTER_BUTTON_RELEASE:
|
||||
event->button.click_count = click_count;
|
||||
break;
|
||||
@ -1780,7 +1776,7 @@ _clutter_process_event_details (ClutterActor *stage,
|
||||
|
||||
emit_crossing_event (event, device);
|
||||
|
||||
actor = clutter_input_device_update (device, NULL, FALSE);
|
||||
actor = _clutter_input_device_update (device, NULL, FALSE);
|
||||
if (actor != stage)
|
||||
{
|
||||
ClutterEvent *crossing;
|
||||
@ -1838,10 +1834,13 @@ _clutter_process_event_details (ClutterActor *stage,
|
||||
{
|
||||
if (_clutter_is_input_pointer_a11y_enabled (device))
|
||||
{
|
||||
ClutterInputDevice *core_pointer;
|
||||
gfloat x, y;
|
||||
|
||||
clutter_event_get_coords (event, &x, &y);
|
||||
_clutter_input_pointer_a11y_on_motion_event (device, x, y);
|
||||
core_pointer = clutter_device_manager_get_core_device (device->device_manager,
|
||||
CLUTTER_POINTER_DEVICE);
|
||||
_clutter_input_pointer_a11y_on_motion_event (core_pointer, x, y);
|
||||
}
|
||||
}
|
||||
#endif /* CLUTTER_WINDOWING_X11 */
|
||||
@ -1872,7 +1871,7 @@ _clutter_process_event_details (ClutterActor *stage,
|
||||
break;
|
||||
}
|
||||
|
||||
G_GNUC_FALLTHROUGH;
|
||||
/* fallthrough from motion */
|
||||
case CLUTTER_BUTTON_PRESS:
|
||||
case CLUTTER_BUTTON_RELEASE:
|
||||
#ifdef CLUTTER_WINDOWING_X11
|
||||
@ -1880,7 +1879,12 @@ _clutter_process_event_details (ClutterActor *stage,
|
||||
{
|
||||
if (_clutter_is_input_pointer_a11y_enabled (device) && (event->type != CLUTTER_MOTION))
|
||||
{
|
||||
_clutter_input_pointer_a11y_on_button_event (device,
|
||||
ClutterInputDevice *core_pointer;
|
||||
|
||||
core_pointer = clutter_device_manager_get_core_device (device->device_manager,
|
||||
CLUTTER_POINTER_DEVICE);
|
||||
|
||||
_clutter_input_pointer_a11y_on_button_event (core_pointer,
|
||||
event->button.button,
|
||||
event->type == CLUTTER_BUTTON_PRESS);
|
||||
}
|
||||
@ -1939,7 +1943,7 @@ _clutter_process_event_details (ClutterActor *stage,
|
||||
* get the actor underneath
|
||||
*/
|
||||
if (device != NULL)
|
||||
actor = clutter_input_device_update (device, NULL, TRUE);
|
||||
actor = _clutter_input_device_update (device, NULL, TRUE);
|
||||
else
|
||||
{
|
||||
CLUTTER_NOTE (EVENT, "No device found: picking");
|
||||
@ -2012,7 +2016,7 @@ _clutter_process_event_details (ClutterActor *stage,
|
||||
break;
|
||||
}
|
||||
|
||||
G_GNUC_FALLTHROUGH;
|
||||
/* fallthrough from motion */
|
||||
case CLUTTER_TOUCH_BEGIN:
|
||||
case CLUTTER_TOUCH_CANCEL:
|
||||
case CLUTTER_TOUCH_END:
|
||||
@ -2056,7 +2060,7 @@ _clutter_process_event_details (ClutterActor *stage,
|
||||
}
|
||||
|
||||
if (device != NULL)
|
||||
actor = clutter_input_device_update (device, sequence, TRUE);
|
||||
actor = _clutter_input_device_update (device, sequence, TRUE);
|
||||
else
|
||||
{
|
||||
CLUTTER_NOTE (EVENT, "No device found: picking");
|
||||
@ -2307,7 +2311,8 @@ clutter_threads_remove_repaint_func (guint handle_id)
|
||||
* that it does not block, otherwise the frame time budget may be lost.
|
||||
*
|
||||
* A repaint function is useful to ensure that an update of the scenegraph
|
||||
* is performed before the scenegraph is repainted. By default, a repaint
|
||||
* is performed before the scenegraph is repainted; for instance, uploading
|
||||
* a frame from a video into a #ClutterTexture. By default, a repaint
|
||||
* function added using this function will be invoked prior to the frame
|
||||
* being processed.
|
||||
*
|
||||
@ -2356,7 +2361,8 @@ clutter_threads_add_repaint_func (GSourceFunc func,
|
||||
* that it does not block, otherwise the frame time budget may be lost.
|
||||
*
|
||||
* A repaint function is useful to ensure that an update of the scenegraph
|
||||
* is performed before the scenegraph is repainted. The @flags passed to this
|
||||
* is performed before the scenegraph is repainted; for instance, uploading
|
||||
* a frame from a video into a #ClutterTexture. The @flags passed to this
|
||||
* function will determine the section of the frame processing that will
|
||||
* result in @func being called.
|
||||
*
|
||||
@ -2599,36 +2605,6 @@ clutter_check_windowing_backend (const char *backend_type)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_add_debug_flags: (skip)
|
||||
*
|
||||
* Adds the debug flags passed to the list of debug flags.
|
||||
*/
|
||||
void
|
||||
clutter_add_debug_flags (ClutterDebugFlag debug_flags,
|
||||
ClutterDrawDebugFlag draw_flags,
|
||||
ClutterPickDebugFlag pick_flags)
|
||||
{
|
||||
clutter_debug_flags |= debug_flags;
|
||||
clutter_paint_debug_flags |= draw_flags;
|
||||
clutter_pick_debug_flags |= pick_flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_remove_debug_flags: (skip)
|
||||
*
|
||||
* Removes the debug flags passed from the list of debug flags.
|
||||
*/
|
||||
void
|
||||
clutter_remove_debug_flags (ClutterDebugFlag debug_flags,
|
||||
ClutterDrawDebugFlag draw_flags,
|
||||
ClutterPickDebugFlag pick_flags)
|
||||
{
|
||||
clutter_debug_flags &= ~debug_flags;
|
||||
clutter_paint_debug_flags &= ~draw_flags;
|
||||
clutter_pick_debug_flags &= ~pick_flags;
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_set_sync_to_vblank (gboolean sync_to_vblank)
|
||||
{
|
||||
|
@ -34,45 +34,6 @@
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* CLUTTER_INIT_ERROR:
|
||||
*
|
||||
@ -197,15 +158,6 @@ guint clutter_get_default_frame_rate (void);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_check_windowing_backend (const char *backend_type);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_add_debug_flags (ClutterDebugFlag debug_flags,
|
||||
ClutterDrawDebugFlag draw_flags,
|
||||
ClutterPickDebugFlag pick_flags);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_remove_debug_flags (ClutterDebugFlag debug_flags,
|
||||
ClutterDrawDebugFlag draw_flags,
|
||||
ClutterPickDebugFlag pick_flags);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -31,8 +31,6 @@
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include <cogl/cogl.h>
|
||||
|
||||
#include "clutter-master-clock.h"
|
||||
#include "clutter-master-clock-default.h"
|
||||
#include "clutter-debug.h"
|
||||
@ -190,26 +188,6 @@ master_clock_get_swap_wait_time (ClutterMasterClockDefault *master_clock)
|
||||
}
|
||||
}
|
||||
|
||||
static int64_t
|
||||
master_clock_get_next_presentation_time (ClutterMasterClockDefault *master_clock)
|
||||
{
|
||||
ClutterStageManager *stage_manager = clutter_stage_manager_get_default ();
|
||||
const GSList *stages, *l;
|
||||
int64_t earliest = -1;
|
||||
|
||||
stages = clutter_stage_manager_peek_stages (stage_manager);
|
||||
|
||||
for (l = stages; l != NULL; l = l->next)
|
||||
{
|
||||
gint64 t = _clutter_stage_get_next_presentation_time (l->data);
|
||||
|
||||
if (earliest == -1 || (t != -1 && t < earliest))
|
||||
earliest = t;
|
||||
}
|
||||
|
||||
return earliest;
|
||||
}
|
||||
|
||||
static void
|
||||
master_clock_schedule_stage_updates (ClutterMasterClockDefault *master_clock)
|
||||
{
|
||||
@ -483,14 +461,8 @@ clutter_clock_dispatch (GSource *source,
|
||||
|
||||
_clutter_threads_acquire_lock ();
|
||||
|
||||
COGL_TRACE_BEGIN (ClutterMasterClockTick, "Master Clock (tick)");
|
||||
|
||||
/* Get the time to use for this frame */
|
||||
master_clock->cur_tick = master_clock_get_next_presentation_time (master_clock);
|
||||
|
||||
/* On the first frame the backend might not have an answer */
|
||||
if (master_clock->cur_tick <= 0)
|
||||
master_clock->cur_tick = g_source_get_time (source);
|
||||
master_clock->cur_tick = g_source_get_time (source);
|
||||
|
||||
#ifdef CLUTTER_ENABLE_DEBUG
|
||||
master_clock->remaining_budget = master_clock->frame_budget;
|
||||
@ -520,8 +492,6 @@ clutter_clock_dispatch (GSource *source,
|
||||
|
||||
g_slist_free_full (stages, g_object_unref);
|
||||
|
||||
COGL_TRACE_END (ClutterMasterClockTick);
|
||||
|
||||
_clutter_threads_release_lock ();
|
||||
|
||||
return TRUE;
|
||||
|
@ -26,8 +26,8 @@
|
||||
#define __CLUTTER_H_INSIDE__
|
||||
|
||||
#include "clutter-backend.h"
|
||||
#include "clutter-device-manager-private.h"
|
||||
#include "clutter-event-private.h"
|
||||
#include "clutter-input-device-private.h"
|
||||
#include "clutter-input-pointer-a11y-private.h"
|
||||
#include "clutter-macros.h"
|
||||
#include "clutter-private.h"
|
||||
|
@ -74,7 +74,6 @@
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-stage-private.h"
|
||||
#include "clutter-paint-context-private.h"
|
||||
#include "clutter-paint-volume-private.h"
|
||||
#include "clutter-actor-box-private.h"
|
||||
|
||||
@ -118,7 +117,11 @@ clutter_offscreen_effect_set_actor (ClutterActorMeta *meta,
|
||||
meta_class->set_actor (meta, actor);
|
||||
|
||||
/* clear out the previous state */
|
||||
g_clear_pointer (&priv->offscreen, cogl_object_unref);
|
||||
if (priv->offscreen != NULL)
|
||||
{
|
||||
cogl_object_unref (priv->offscreen);
|
||||
priv->offscreen = NULL;
|
||||
}
|
||||
|
||||
/* we keep a back pointer here, to avoid going through the ActorMeta */
|
||||
priv->actor = clutter_actor_meta_get_actor (meta);
|
||||
@ -194,8 +197,17 @@ update_fbo (ClutterEffect *effect,
|
||||
ensure_pipeline_filter_for_scale (self, resource_scale);
|
||||
}
|
||||
|
||||
g_clear_pointer (&priv->texture, cogl_object_unref);
|
||||
g_clear_pointer (&priv->offscreen, cogl_object_unref);
|
||||
if (priv->texture != NULL)
|
||||
{
|
||||
cogl_object_unref (priv->texture);
|
||||
priv->texture = NULL;
|
||||
}
|
||||
|
||||
if (priv->offscreen != NULL)
|
||||
{
|
||||
cogl_object_unref (priv->offscreen);
|
||||
priv->offscreen = NULL;
|
||||
}
|
||||
|
||||
priv->texture =
|
||||
clutter_offscreen_effect_create_texture (self, target_width, target_height);
|
||||
@ -225,8 +237,7 @@ update_fbo (ClutterEffect *effect,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
|
||||
{
|
||||
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
|
||||
ClutterOffscreenEffectPrivate *priv = self->priv;
|
||||
@ -237,7 +248,6 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
|
||||
CoglColor transparent;
|
||||
gfloat stage_width, stage_height;
|
||||
gfloat target_width = -1, target_height = -1;
|
||||
CoglFramebuffer *framebuffer;
|
||||
gfloat resource_scale;
|
||||
gfloat ceiled_resource_scale;
|
||||
graphene_point3d_t local_offset;
|
||||
@ -302,10 +312,10 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
|
||||
if (!update_fbo (effect, target_width, target_height, resource_scale))
|
||||
return FALSE;
|
||||
|
||||
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
|
||||
cogl_framebuffer_get_modelview_matrix (framebuffer, &old_modelview);
|
||||
cogl_get_modelview_matrix (&old_modelview);
|
||||
|
||||
clutter_paint_context_push_framebuffer (paint_context, priv->offscreen);
|
||||
/* let's draw offscreen */
|
||||
cogl_push_framebuffer (priv->offscreen);
|
||||
|
||||
/* We don't want the FBO contents to be transformed. That could waste memory
|
||||
* (e.g. during zoom), or result in something that's not rectangular (clipped
|
||||
@ -315,7 +325,7 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
|
||||
* contents on screen...
|
||||
*/
|
||||
clutter_actor_get_transform (priv->stage, &modelview);
|
||||
cogl_framebuffer_set_modelview_matrix (priv->offscreen, &modelview);
|
||||
cogl_set_modelview_matrix (&modelview);
|
||||
|
||||
/* Save the original viewport for calculating priv->position */
|
||||
_clutter_stage_get_viewport (CLUTTER_STAGE (priv->stage),
|
||||
@ -327,11 +337,10 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
|
||||
/* Set up the viewport so that it has the same size as the stage (avoid
|
||||
* distortion), but translated to account for the FBO offset...
|
||||
*/
|
||||
cogl_framebuffer_set_viewport (priv->offscreen,
|
||||
-priv->fbo_offset_x,
|
||||
-priv->fbo_offset_y,
|
||||
stage_width,
|
||||
stage_height);
|
||||
cogl_set_viewport (-priv->fbo_offset_x,
|
||||
-priv->fbo_offset_y,
|
||||
stage_width,
|
||||
stage_height);
|
||||
|
||||
/* Copy the stage's projection matrix across to the framebuffer */
|
||||
_clutter_stage_get_projection_matrix (CLUTTER_STAGE (priv->stage),
|
||||
@ -348,15 +357,14 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
|
||||
&priv->position,
|
||||
1);
|
||||
|
||||
cogl_framebuffer_set_projection_matrix (priv->offscreen, &projection);
|
||||
cogl_set_projection_matrix (&projection);
|
||||
|
||||
cogl_color_init_from_4ub (&transparent, 0, 0, 0, 0);
|
||||
cogl_framebuffer_clear (priv->offscreen,
|
||||
COGL_BUFFER_BIT_COLOR |
|
||||
COGL_BUFFER_BIT_DEPTH,
|
||||
&transparent);
|
||||
cogl_clear (&transparent,
|
||||
COGL_BUFFER_BIT_COLOR |
|
||||
COGL_BUFFER_BIT_DEPTH);
|
||||
|
||||
cogl_framebuffer_push_matrix (priv->offscreen);
|
||||
cogl_push_matrix ();
|
||||
|
||||
/* Override the actor's opacity to fully opaque - we paint the offscreen
|
||||
* texture with the actor's paint opacity, so we need to do this to avoid
|
||||
@ -370,12 +378,10 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_offscreen_effect_real_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_offscreen_effect_real_paint_target (ClutterOffscreenEffect *effect)
|
||||
{
|
||||
ClutterOffscreenEffectPrivate *priv = effect->priv;
|
||||
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 (priv->actor);
|
||||
@ -401,21 +407,18 @@ clutter_offscreen_effect_real_paint_target (ClutterOffscreenEffect *effect,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect)
|
||||
{
|
||||
ClutterOffscreenEffectPrivate *priv = effect->priv;
|
||||
CoglFramebuffer *framebuffer =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
CoglMatrix modelview;
|
||||
float resource_scale;
|
||||
|
||||
cogl_framebuffer_push_matrix (framebuffer);
|
||||
cogl_push_matrix ();
|
||||
|
||||
/* The current modelview matrix is *almost* perfect already. It's only
|
||||
* missing a correction for the expanded FBO and offset rendering within...
|
||||
*/
|
||||
cogl_framebuffer_get_modelview_matrix (framebuffer, &modelview);
|
||||
cogl_get_modelview_matrix (&modelview);
|
||||
|
||||
if (clutter_actor_get_resource_scale (priv->actor, &resource_scale) &&
|
||||
resource_scale != 1.0f)
|
||||
@ -428,23 +431,21 @@ clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect,
|
||||
priv->fbo_offset_x,
|
||||
priv->fbo_offset_y,
|
||||
0.0f);
|
||||
cogl_framebuffer_set_modelview_matrix (framebuffer, &modelview);
|
||||
cogl_set_modelview_matrix (&modelview);
|
||||
|
||||
/* paint the target material; this is virtualized for
|
||||
* sub-classes that require special hand-holding
|
||||
*/
|
||||
clutter_offscreen_effect_paint_target (effect, paint_context);
|
||||
clutter_offscreen_effect_paint_target (effect);
|
||||
|
||||
cogl_framebuffer_pop_matrix (framebuffer);
|
||||
cogl_pop_matrix ();
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_offscreen_effect_post_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_offscreen_effect_post_paint (ClutterEffect *effect)
|
||||
{
|
||||
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
|
||||
ClutterOffscreenEffectPrivate *priv = self->priv;
|
||||
CoglFramebuffer *framebuffer;
|
||||
|
||||
if (priv->offscreen == NULL ||
|
||||
priv->target == NULL ||
|
||||
@ -454,60 +455,31 @@ clutter_offscreen_effect_post_paint (ClutterEffect *effect,
|
||||
/* Restore the previous opacity override */
|
||||
clutter_actor_set_opacity_override (priv->actor, priv->old_opacity_override);
|
||||
|
||||
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
|
||||
cogl_framebuffer_pop_matrix (framebuffer);
|
||||
clutter_paint_context_pop_framebuffer (paint_context);
|
||||
cogl_pop_matrix ();
|
||||
cogl_pop_framebuffer ();
|
||||
|
||||
clutter_offscreen_effect_paint_texture (self, paint_context);
|
||||
clutter_offscreen_effect_paint_texture (self);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_offscreen_effect_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context,
|
||||
ClutterEffectPaintFlags flags)
|
||||
{
|
||||
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
|
||||
ClutterOffscreenEffectPrivate *priv = self->priv;
|
||||
|
||||
if (flags & CLUTTER_EFFECT_PAINT_BYPASS_EFFECT)
|
||||
{
|
||||
clutter_actor_continue_paint (priv->actor, paint_context);
|
||||
cogl_clear_object (&priv->offscreen);
|
||||
return;
|
||||
}
|
||||
|
||||
/* If we've already got a cached image and the actor hasn't been redrawn
|
||||
* then we can just use the cached image in the FBO.
|
||||
*/
|
||||
if (priv->offscreen == NULL || (flags & CLUTTER_EFFECT_PAINT_ACTOR_DIRTY))
|
||||
{
|
||||
ClutterEffectClass *effect_class = CLUTTER_EFFECT_GET_CLASS (effect);
|
||||
gboolean pre_paint_succeeded;
|
||||
|
||||
pre_paint_succeeded = effect_class->pre_paint (effect, paint_context);
|
||||
|
||||
clutter_actor_continue_paint (priv->actor, paint_context);
|
||||
|
||||
if (pre_paint_succeeded)
|
||||
effect_class->post_paint (effect, paint_context);
|
||||
else
|
||||
g_clear_pointer (&priv->offscreen, cogl_object_unref);
|
||||
/* Chain up to the parent paint method which will call the pre and
|
||||
post paint functions to update the image */
|
||||
CLUTTER_EFFECT_CLASS (clutter_offscreen_effect_parent_class)->
|
||||
paint (effect, flags);
|
||||
}
|
||||
else
|
||||
clutter_offscreen_effect_paint_texture (self, paint_context);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_offscreen_effect_notify (GObject *gobject,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterOffscreenEffect *offscreen_effect = CLUTTER_OFFSCREEN_EFFECT (gobject);
|
||||
ClutterOffscreenEffectPrivate *priv = offscreen_effect->priv;
|
||||
|
||||
if (strcmp (pspec->name, "enabled") == 0)
|
||||
g_clear_pointer (&priv->offscreen, cogl_object_unref);
|
||||
|
||||
G_OBJECT_CLASS (clutter_offscreen_effect_parent_class)->notify (gobject, pspec);
|
||||
clutter_offscreen_effect_paint_texture (self);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -516,9 +488,14 @@ clutter_offscreen_effect_finalize (GObject *gobject)
|
||||
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (gobject);
|
||||
ClutterOffscreenEffectPrivate *priv = self->priv;
|
||||
|
||||
g_clear_pointer (&priv->offscreen, cogl_object_unref);
|
||||
g_clear_pointer (&priv->texture, cogl_object_unref);
|
||||
g_clear_pointer (&priv->target, cogl_object_unref);
|
||||
if (priv->offscreen)
|
||||
cogl_object_unref (priv->offscreen);
|
||||
|
||||
if (priv->target)
|
||||
cogl_object_unref (priv->target);
|
||||
|
||||
if (priv->texture)
|
||||
cogl_object_unref (priv->texture);
|
||||
|
||||
G_OBJECT_CLASS (clutter_offscreen_effect_parent_class)->finalize (gobject);
|
||||
}
|
||||
@ -540,7 +517,6 @@ clutter_offscreen_effect_class_init (ClutterOffscreenEffectClass *klass)
|
||||
effect_class->paint = clutter_offscreen_effect_paint;
|
||||
|
||||
gobject_class->finalize = clutter_offscreen_effect_finalize;
|
||||
gobject_class->notify = clutter_offscreen_effect_notify;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -606,20 +582,17 @@ clutter_offscreen_effect_get_target (ClutterOffscreenEffect *effect)
|
||||
/**
|
||||
* clutter_offscreen_effect_paint_target:
|
||||
* @effect: a #ClutterOffscreenEffect
|
||||
* @paint_context: a #ClutterPaintContext
|
||||
*
|
||||
* Calls the paint_target() virtual function of the @effect
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
void
|
||||
clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_OFFSCREEN_EFFECT (effect));
|
||||
|
||||
CLUTTER_OFFSCREEN_EFFECT_GET_CLASS (effect)->paint_target (effect,
|
||||
paint_context);
|
||||
CLUTTER_OFFSCREEN_EFFECT_GET_CLASS (effect)->paint_target (effect);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -79,8 +79,7 @@ struct _ClutterOffscreenEffectClass
|
||||
CoglHandle (* create_texture) (ClutterOffscreenEffect *effect,
|
||||
gfloat width,
|
||||
gfloat height);
|
||||
void (* paint_target) (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context);
|
||||
void (* paint_target) (ClutterOffscreenEffect *effect);
|
||||
|
||||
/*< private >*/
|
||||
void (* _clutter_offscreen1) (void);
|
||||
@ -102,8 +101,7 @@ CLUTTER_EXPORT
|
||||
CoglHandle clutter_offscreen_effect_get_texture (ClutterOffscreenEffect *effect);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context);
|
||||
void clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect);
|
||||
CLUTTER_EXPORT
|
||||
CoglHandle clutter_offscreen_effect_create_texture (ClutterOffscreenEffect *effect,
|
||||
gfloat width,
|
||||
|
@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Red Hat Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CLUTTER_PAINT_CONTEXT_PRIVATE_H
|
||||
#define CLUTTER_PAINT_CONTEXT_PRIVATE_H
|
||||
|
||||
#include "clutter-paint-context.h"
|
||||
|
||||
ClutterPaintContext * clutter_paint_context_new_for_view (ClutterStageView *view,
|
||||
const cairo_region_t *redraw_clip);
|
||||
|
||||
gboolean clutter_paint_context_is_drawing_off_stage (ClutterPaintContext *paint_context);
|
||||
|
||||
CoglFramebuffer * clutter_paint_context_get_base_framebuffer (ClutterPaintContext *paint_context);
|
||||
|
||||
#endif /* CLUTTER_PAINT_CONTEXT_PRIVATE_H */
|
@ -1,172 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Red Hat Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter-paint-context-private.h"
|
||||
|
||||
struct _ClutterPaintContext
|
||||
{
|
||||
grefcount ref_count;
|
||||
|
||||
GList *framebuffers;
|
||||
|
||||
ClutterStageView *view;
|
||||
|
||||
cairo_region_t *redraw_clip;
|
||||
};
|
||||
|
||||
G_DEFINE_BOXED_TYPE (ClutterPaintContext, clutter_paint_context,
|
||||
clutter_paint_context_ref,
|
||||
clutter_paint_context_unref)
|
||||
|
||||
ClutterPaintContext *
|
||||
clutter_paint_context_new_for_view (ClutterStageView *view,
|
||||
const cairo_region_t *redraw_clip)
|
||||
{
|
||||
ClutterPaintContext *paint_context;
|
||||
CoglFramebuffer *framebuffer;
|
||||
|
||||
paint_context = g_new0 (ClutterPaintContext, 1);
|
||||
g_ref_count_init (&paint_context->ref_count);
|
||||
paint_context->view = view;
|
||||
paint_context->redraw_clip = cairo_region_copy (redraw_clip);
|
||||
|
||||
framebuffer = clutter_stage_view_get_framebuffer (view);
|
||||
clutter_paint_context_push_framebuffer (paint_context, framebuffer);
|
||||
|
||||
return paint_context;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_paint_context_new_for_framebuffer: (skip)
|
||||
*/
|
||||
ClutterPaintContext *
|
||||
clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer)
|
||||
{
|
||||
ClutterPaintContext *paint_context;
|
||||
|
||||
paint_context = g_new0 (ClutterPaintContext, 1);
|
||||
g_ref_count_init (&paint_context->ref_count);
|
||||
|
||||
clutter_paint_context_push_framebuffer (paint_context, framebuffer);
|
||||
|
||||
return paint_context;
|
||||
}
|
||||
|
||||
ClutterPaintContext *
|
||||
clutter_paint_context_ref (ClutterPaintContext *paint_context)
|
||||
{
|
||||
g_ref_count_inc (&paint_context->ref_count);
|
||||
return paint_context;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_paint_context_dispose (ClutterPaintContext *paint_context)
|
||||
{
|
||||
g_list_free_full (paint_context->framebuffers,
|
||||
cogl_object_unref);
|
||||
paint_context->framebuffers = NULL;
|
||||
g_clear_pointer (&paint_context->redraw_clip, cairo_region_destroy);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_paint_context_unref (ClutterPaintContext *paint_context)
|
||||
{
|
||||
if (g_ref_count_dec (&paint_context->ref_count))
|
||||
{
|
||||
clutter_paint_context_dispose (paint_context);
|
||||
g_free (paint_context);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
clutter_paint_context_destroy (ClutterPaintContext *paint_context)
|
||||
{
|
||||
clutter_paint_context_dispose (paint_context);
|
||||
clutter_paint_context_unref (paint_context);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_paint_context_push_framebuffer (ClutterPaintContext *paint_context,
|
||||
CoglFramebuffer *framebuffer)
|
||||
{
|
||||
paint_context->framebuffers = g_list_prepend (paint_context->framebuffers,
|
||||
cogl_object_ref (framebuffer));
|
||||
}
|
||||
|
||||
void
|
||||
clutter_paint_context_pop_framebuffer (ClutterPaintContext *paint_context)
|
||||
{
|
||||
g_return_if_fail (paint_context->framebuffers);
|
||||
|
||||
cogl_object_unref (paint_context->framebuffers->data);
|
||||
paint_context->framebuffers =
|
||||
g_list_delete_link (paint_context->framebuffers,
|
||||
paint_context->framebuffers);
|
||||
}
|
||||
|
||||
const cairo_region_t *
|
||||
clutter_paint_context_get_redraw_clip (ClutterPaintContext *paint_context)
|
||||
{
|
||||
return paint_context->redraw_clip;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_paint_context_get_framebuffer:
|
||||
* @paint_context: The #ClutterPaintContext
|
||||
*
|
||||
* Returns: (transfer none): The #CoglFramebuffer used for drawing
|
||||
*/
|
||||
CoglFramebuffer *
|
||||
clutter_paint_context_get_framebuffer (ClutterPaintContext *paint_context)
|
||||
{
|
||||
g_return_val_if_fail (paint_context->framebuffers, NULL);
|
||||
|
||||
return paint_context->framebuffers->data;
|
||||
}
|
||||
|
||||
CoglFramebuffer *
|
||||
clutter_paint_context_get_base_framebuffer (ClutterPaintContext *paint_context)
|
||||
{
|
||||
return g_list_last (paint_context->framebuffers)->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_paint_context_get_stage_view: (skip)
|
||||
*/
|
||||
ClutterStageView *
|
||||
clutter_paint_context_get_stage_view (ClutterPaintContext *paint_context)
|
||||
{
|
||||
return paint_context->view;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_paint_context_is_drawing_off_stage: (skip)
|
||||
*
|
||||
* Return %TRUE if the paint context is currently drawing off stage.
|
||||
* This happens if there are any framebuffers pushed, and the base framebuffer
|
||||
* comes from the stage view.
|
||||
*/
|
||||
gboolean
|
||||
clutter_paint_context_is_drawing_off_stage (ClutterPaintContext *paint_context)
|
||||
{
|
||||
if (g_list_length (paint_context->framebuffers) > 1)
|
||||
return TRUE;
|
||||
|
||||
return !paint_context->view;
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Red Hat Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CLUTTER_PAINT_CONTEXT_H
|
||||
#define CLUTTER_PAINT_CONTEXT_H
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "clutter-macros.h"
|
||||
#include "clutter-stage-view.h"
|
||||
|
||||
typedef struct _ClutterPaintContext ClutterPaintContext;
|
||||
|
||||
#define CLUTTER_TYPE_PAINT_CONTEXT (clutter_paint_context_get_type ())
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_paint_context_get_type (void);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterPaintContext * clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterPaintContext * clutter_paint_context_ref (ClutterPaintContext *paint_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_context_unref (ClutterPaintContext *paint_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_context_destroy (ClutterPaintContext *paint_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
CoglFramebuffer * clutter_paint_context_get_framebuffer (ClutterPaintContext *paint_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterStageView * clutter_paint_context_get_stage_view (ClutterPaintContext *paint_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_context_push_framebuffer (ClutterPaintContext *paint_context,
|
||||
CoglFramebuffer *framebuffer);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_context_pop_framebuffer (ClutterPaintContext *paint_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
const cairo_region_t * clutter_paint_context_get_redraw_clip (ClutterPaintContext *paint_context);
|
||||
|
||||
#endif /* CLUTTER_PAINT_CONTEXT_H */
|
@ -27,7 +27,6 @@
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <json-glib/json-glib.h>
|
||||
#include <clutter/clutter-paint-context.h>
|
||||
#include <clutter/clutter-paint-node.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
@ -49,11 +48,11 @@ struct _ClutterPaintNode
|
||||
ClutterPaintNode *next_sibling;
|
||||
ClutterPaintNode *last_child;
|
||||
|
||||
guint n_children;
|
||||
|
||||
GArray *operations;
|
||||
|
||||
const gchar *name;
|
||||
|
||||
guint n_children;
|
||||
gchar *name;
|
||||
|
||||
volatile int ref_count;
|
||||
};
|
||||
@ -64,12 +63,9 @@ struct _ClutterPaintNodeClass
|
||||
|
||||
void (* finalize) (ClutterPaintNode *node);
|
||||
|
||||
gboolean (* pre_draw) (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context);
|
||||
void (* draw) (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context);
|
||||
void (* post_draw) (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context);
|
||||
gboolean (* pre_draw) (ClutterPaintNode *node);
|
||||
void (* draw) (ClutterPaintNode *node);
|
||||
void (* post_draw) (ClutterPaintNode *node);
|
||||
|
||||
JsonNode*(* serialize) (ClutterPaintNode *node);
|
||||
|
||||
@ -115,8 +111,7 @@ void _clutter_paint_node_init_types (void);
|
||||
gpointer _clutter_paint_node_create (GType gtype);
|
||||
|
||||
ClutterPaintNode * _clutter_transform_node_new (const CoglMatrix *matrix);
|
||||
ClutterPaintNode * _clutter_dummy_node_new (ClutterActor *actor,
|
||||
CoglFramebuffer *framebuffer);
|
||||
ClutterPaintNode * _clutter_dummy_node_new (ClutterActor *actor);
|
||||
|
||||
void _clutter_paint_node_dump_tree (ClutterPaintNode *root);
|
||||
|
||||
@ -144,6 +139,30 @@ ClutterPaintNode * clutter_paint_node_get_last_child (Clutter
|
||||
G_GNUC_INTERNAL
|
||||
ClutterPaintNode * clutter_paint_node_get_parent (ClutterPaintNode *node);
|
||||
|
||||
#define CLUTTER_TYPE_LAYER_NODE (_clutter_layer_node_get_type ())
|
||||
#define CLUTTER_LAYER_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_LAYER_NODE, ClutterLayerNode))
|
||||
#define CLUTTER_IS_LAYER_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_LAYER_NODE))
|
||||
|
||||
/*
|
||||
* ClutterLayerNode:
|
||||
*
|
||||
* The #ClutterLayerNode structure is an opaque
|
||||
* type whose members cannot be directly accessed.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
typedef struct _ClutterLayerNode ClutterLayerNode;
|
||||
typedef struct _ClutterLayerNodeClass ClutterLayerNodeClass;
|
||||
|
||||
GType _clutter_layer_node_get_type (void) G_GNUC_CONST;
|
||||
|
||||
ClutterPaintNode * _clutter_layer_node_new (const CoglMatrix *projection,
|
||||
const cairo_rectangle_t *viewport,
|
||||
float width,
|
||||
float height,
|
||||
guint8 opacity);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_PAINT_NODE_PRIVATE_H__ */
|
||||
|
@ -171,6 +171,8 @@ clutter_paint_node_real_finalize (ClutterPaintNode *node)
|
||||
{
|
||||
ClutterPaintNode *iter;
|
||||
|
||||
g_free (node->name);
|
||||
|
||||
if (node->operations != NULL)
|
||||
{
|
||||
guint i;
|
||||
@ -200,21 +202,18 @@ clutter_paint_node_real_finalize (ClutterPaintNode *node)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_paint_node_real_pre_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_paint_node_real_pre_draw (ClutterPaintNode *node)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_paint_node_real_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_paint_node_real_draw (ClutterPaintNode *node)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_paint_node_real_post_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_paint_node_real_post_draw (ClutterPaintNode *node)
|
||||
{
|
||||
}
|
||||
|
||||
@ -295,8 +294,7 @@ clutter_paint_node_get_type (void)
|
||||
*
|
||||
* The @name will be used for debugging purposes.
|
||||
*
|
||||
* The @node will intern @name using g_intern_string(). If you have access to a
|
||||
* static string, use clutter_paint_node_set_static_name() instead.
|
||||
* The @node will copy the passed string.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
@ -306,22 +304,8 @@ clutter_paint_node_set_name (ClutterPaintNode *node,
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
|
||||
|
||||
node->name = g_intern_string (name);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_paint_node_set_static_name: (skip)
|
||||
*
|
||||
* Like clutter_paint_node_set_name() but uses a static or interned string
|
||||
* containing the name.
|
||||
*/
|
||||
void
|
||||
clutter_paint_node_set_static_name (ClutterPaintNode *node,
|
||||
const char *name)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
|
||||
|
||||
node->name = name;
|
||||
g_free (node->name);
|
||||
node->name = g_strdup (name);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1013,30 +997,29 @@ clutter_paint_node_add_primitive (ClutterPaintNode *node,
|
||||
* its children, if any.
|
||||
*/
|
||||
void
|
||||
clutter_paint_node_paint (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_paint_node_paint (ClutterPaintNode *node)
|
||||
{
|
||||
ClutterPaintNodeClass *klass = CLUTTER_PAINT_NODE_GET_CLASS (node);
|
||||
ClutterPaintNode *iter;
|
||||
gboolean res;
|
||||
|
||||
res = klass->pre_draw (node, paint_context);
|
||||
res = klass->pre_draw (node);
|
||||
|
||||
if (res)
|
||||
{
|
||||
klass->draw (node, paint_context);
|
||||
klass->draw (node);
|
||||
}
|
||||
|
||||
for (iter = node->first_child;
|
||||
iter != NULL;
|
||||
iter = iter->next_sibling)
|
||||
{
|
||||
clutter_paint_node_paint (iter, paint_context);
|
||||
clutter_paint_node_paint (iter);
|
||||
}
|
||||
|
||||
if (res)
|
||||
{
|
||||
klass->post_draw (node, paint_context);
|
||||
klass->post_draw (node);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1194,6 +1177,8 @@ _clutter_paint_node_create (GType gtype)
|
||||
{
|
||||
g_return_val_if_fail (g_type_is_a (gtype, CLUTTER_TYPE_PAINT_NODE), NULL);
|
||||
|
||||
_clutter_paint_node_init_types ();
|
||||
|
||||
return (gpointer) g_type_create_instance (gtype);
|
||||
}
|
||||
|
||||
@ -1214,10 +1199,9 @@ clutter_paint_node_get_root (ClutterPaintNode *node)
|
||||
* @node: a #ClutterPaintNode
|
||||
*
|
||||
* Retrieves the #CoglFramebuffer that @node will draw
|
||||
* into, if it the root node has a custom framebuffer set.
|
||||
* into.
|
||||
*
|
||||
* Returns: (transfer none): a #CoglFramebuffer or %NULL if no custom one is
|
||||
* set.
|
||||
* Returns: (transfer none): a #CoglFramebuffer
|
||||
*/
|
||||
CoglFramebuffer *
|
||||
clutter_paint_node_get_framebuffer (ClutterPaintNode *node)
|
||||
@ -1225,9 +1209,12 @@ clutter_paint_node_get_framebuffer (ClutterPaintNode *node)
|
||||
ClutterPaintNode *root = clutter_paint_node_get_root (node);
|
||||
ClutterPaintNodeClass *klass;
|
||||
|
||||
if (root == NULL)
|
||||
return NULL;
|
||||
|
||||
klass = CLUTTER_PAINT_NODE_GET_CLASS (root);
|
||||
if (klass->get_framebuffer != NULL)
|
||||
return klass->get_framebuffer (root);
|
||||
else
|
||||
return NULL;
|
||||
|
||||
return cogl_get_draw_framebuffer ();
|
||||
}
|
||||
|
@ -50,15 +50,11 @@ CLUTTER_EXPORT
|
||||
void clutter_paint_node_unref (ClutterPaintNode *node);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_node_paint (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context);
|
||||
void clutter_paint_node_paint (ClutterPaintNode *node);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_node_set_name (ClutterPaintNode *node,
|
||||
const char *name);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_node_set_static_name (ClutterPaintNode *node,
|
||||
const char *name);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
CoglFramebuffer * clutter_paint_node_get_framebuffer (ClutterPaintNode *node);
|
||||
|
@ -44,7 +44,6 @@
|
||||
#include "clutter-color.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-paint-context-private.h"
|
||||
|
||||
#include "clutter-paint-nodes.h"
|
||||
|
||||
@ -104,12 +103,11 @@ struct _ClutterRootNode
|
||||
G_DEFINE_TYPE (ClutterRootNode, clutter_root_node, CLUTTER_TYPE_PAINT_NODE)
|
||||
|
||||
static gboolean
|
||||
clutter_root_node_pre_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_root_node_pre_draw (ClutterPaintNode *node)
|
||||
{
|
||||
ClutterRootNode *rnode = (ClutterRootNode *) node;
|
||||
|
||||
clutter_paint_context_push_framebuffer (paint_context, rnode->framebuffer);
|
||||
cogl_push_framebuffer (rnode->framebuffer);
|
||||
|
||||
cogl_framebuffer_clear (rnode->framebuffer,
|
||||
rnode->clear_flags,
|
||||
@ -119,10 +117,9 @@ clutter_root_node_pre_draw (ClutterPaintNode *node,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_root_node_post_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_root_node_post_draw (ClutterPaintNode *node)
|
||||
{
|
||||
clutter_paint_context_pop_framebuffer (paint_context);
|
||||
cogl_pop_framebuffer ();
|
||||
}
|
||||
|
||||
static void
|
||||
@ -166,8 +163,6 @@ clutter_root_node_new (CoglFramebuffer *framebuffer,
|
||||
{
|
||||
ClutterRootNode *res;
|
||||
|
||||
g_return_val_if_fail (framebuffer, NULL);
|
||||
|
||||
res = _clutter_paint_node_create (CLUTTER_TYPE_ROOT_NODE);
|
||||
|
||||
cogl_color_init_from_4ub (&res->clear_color,
|
||||
@ -177,52 +172,54 @@ clutter_root_node_new (CoglFramebuffer *framebuffer,
|
||||
clear_color->alpha);
|
||||
cogl_color_premultiply (&res->clear_color);
|
||||
|
||||
res->framebuffer = cogl_object_ref (framebuffer);
|
||||
if (G_LIKELY (framebuffer != NULL))
|
||||
res->framebuffer = cogl_object_ref (framebuffer);
|
||||
else
|
||||
res->framebuffer = cogl_object_ref (cogl_get_draw_framebuffer ());
|
||||
|
||||
res->clear_flags = clear_flags;
|
||||
|
||||
return (ClutterPaintNode *) res;
|
||||
}
|
||||
|
||||
/*
|
||||
* ClutterTransformNode
|
||||
* Transform node
|
||||
*
|
||||
* A private PaintNode, that changes the modelview of its child
|
||||
* nodes.
|
||||
*/
|
||||
|
||||
struct _ClutterTransformNode
|
||||
{
|
||||
#define clutter_transform_node_get_type _clutter_transform_node_get_type
|
||||
|
||||
typedef struct _ClutterTransformNode {
|
||||
ClutterPaintNode parent_instance;
|
||||
|
||||
CoglMatrix transform;
|
||||
};
|
||||
CoglMatrix modelview;
|
||||
} ClutterTransformNode;
|
||||
|
||||
struct _ClutterTransformNodeClass
|
||||
{
|
||||
ClutterPaintNodeClass parent_class;
|
||||
};
|
||||
typedef struct _ClutterPaintNodeClass ClutterTransformNodeClass;
|
||||
|
||||
G_DEFINE_TYPE (ClutterTransformNode, clutter_transform_node, CLUTTER_TYPE_PAINT_NODE)
|
||||
|
||||
static gboolean
|
||||
clutter_transform_node_pre_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_transform_node_pre_draw (ClutterPaintNode *node)
|
||||
{
|
||||
ClutterTransformNode *transform_node = (ClutterTransformNode *) node;
|
||||
CoglFramebuffer *fb =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
ClutterTransformNode *tnode = (ClutterTransformNode *) node;
|
||||
CoglMatrix matrix;
|
||||
|
||||
cogl_framebuffer_push_matrix (fb);
|
||||
cogl_framebuffer_transform (fb, &transform_node->transform);
|
||||
cogl_push_matrix ();
|
||||
|
||||
cogl_get_modelview_matrix (&matrix);
|
||||
cogl_matrix_multiply (&matrix, &matrix, &tnode->modelview);
|
||||
cogl_set_modelview_matrix (&matrix);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_transform_node_post_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_transform_node_post_draw (ClutterPaintNode *node)
|
||||
{
|
||||
CoglFramebuffer *fb =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
|
||||
cogl_framebuffer_pop_matrix (fb);
|
||||
cogl_pop_matrix ();
|
||||
}
|
||||
|
||||
static void
|
||||
@ -238,24 +235,18 @@ clutter_transform_node_class_init (ClutterTransformNodeClass *klass)
|
||||
static void
|
||||
clutter_transform_node_init (ClutterTransformNode *self)
|
||||
{
|
||||
cogl_matrix_init_identity (&self->transform);
|
||||
cogl_matrix_init_identity (&self->modelview);
|
||||
}
|
||||
|
||||
/*
|
||||
* clutter_transform_node_new:
|
||||
* @transform: (nullable): the transform matrix to apply
|
||||
*
|
||||
* Return value: (transfer full): the newly created #ClutterTransformNode.
|
||||
* Use clutter_paint_node_unref() when done.
|
||||
*/
|
||||
ClutterPaintNode *
|
||||
clutter_transform_node_new (const CoglMatrix *transform)
|
||||
_clutter_transform_node_new (const CoglMatrix *modelview)
|
||||
{
|
||||
ClutterTransformNode *res;
|
||||
|
||||
res = _clutter_paint_node_create (CLUTTER_TYPE_TRANSFORM_NODE);
|
||||
if (transform)
|
||||
res->transform = *transform;
|
||||
res = _clutter_paint_node_create (_clutter_transform_node_get_type ());
|
||||
|
||||
if (modelview != NULL)
|
||||
res->modelview = *modelview;
|
||||
|
||||
return (ClutterPaintNode *) res;
|
||||
}
|
||||
@ -283,8 +274,7 @@ struct _ClutterDummyNode
|
||||
G_DEFINE_TYPE (ClutterDummyNode, clutter_dummy_node, CLUTTER_TYPE_PAINT_NODE)
|
||||
|
||||
static gboolean
|
||||
clutter_dummy_node_pre_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_dummy_node_pre_draw (ClutterPaintNode *node)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@ -321,16 +311,6 @@ clutter_dummy_node_get_framebuffer (ClutterPaintNode *node)
|
||||
return dnode->framebuffer;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_dummy_node_finalize (ClutterPaintNode *node)
|
||||
{
|
||||
ClutterDummyNode *dnode = (ClutterDummyNode *) node;
|
||||
|
||||
cogl_clear_object (&dnode->framebuffer);
|
||||
|
||||
CLUTTER_PAINT_NODE_CLASS (clutter_dummy_node_parent_class)->finalize (node);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_dummy_node_class_init (ClutterDummyNodeClass *klass)
|
||||
{
|
||||
@ -339,7 +319,6 @@ clutter_dummy_node_class_init (ClutterDummyNodeClass *klass)
|
||||
node_class->pre_draw = clutter_dummy_node_pre_draw;
|
||||
node_class->serialize = clutter_dummy_node_serialize;
|
||||
node_class->get_framebuffer = clutter_dummy_node_get_framebuffer;
|
||||
node_class->finalize = clutter_dummy_node_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -348,8 +327,7 @@ clutter_dummy_node_init (ClutterDummyNode *self)
|
||||
}
|
||||
|
||||
ClutterPaintNode *
|
||||
_clutter_dummy_node_new (ClutterActor *actor,
|
||||
CoglFramebuffer *framebuffer)
|
||||
_clutter_dummy_node_new (ClutterActor *actor)
|
||||
{
|
||||
ClutterPaintNode *res;
|
||||
ClutterDummyNode *dnode;
|
||||
@ -358,7 +336,7 @@ _clutter_dummy_node_new (ClutterActor *actor,
|
||||
|
||||
dnode = (ClutterDummyNode *) res;
|
||||
dnode->actor = actor;
|
||||
dnode->framebuffer = cogl_object_ref (framebuffer);
|
||||
dnode->framebuffer = _clutter_actor_get_active_framebuffer (actor);
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -401,34 +379,22 @@ clutter_pipeline_node_finalize (ClutterPaintNode *node)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_pipeline_node_pre_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_pipeline_node_pre_draw (ClutterPaintNode *node)
|
||||
{
|
||||
ClutterPipelineNode *pnode = CLUTTER_PIPELINE_NODE (node);
|
||||
|
||||
if (node->operations != NULL &&
|
||||
pnode->pipeline != NULL)
|
||||
return TRUE;
|
||||
{
|
||||
cogl_push_source (pnode->pipeline);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static CoglFramebuffer *
|
||||
get_target_framebuffer (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
CoglFramebuffer *framebuffer;
|
||||
|
||||
framebuffer = clutter_paint_node_get_framebuffer (node);
|
||||
if (framebuffer)
|
||||
return framebuffer;
|
||||
|
||||
return clutter_paint_context_get_framebuffer (paint_context);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_pipeline_node_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_pipeline_node_draw (ClutterPaintNode *node)
|
||||
{
|
||||
ClutterPipelineNode *pnode = CLUTTER_PIPELINE_NODE (node);
|
||||
CoglFramebuffer *fb;
|
||||
@ -440,7 +406,7 @@ clutter_pipeline_node_draw (ClutterPaintNode *node,
|
||||
if (node->operations == NULL)
|
||||
return;
|
||||
|
||||
fb = clutter_paint_context_get_framebuffer (paint_context);
|
||||
fb = clutter_paint_node_get_framebuffer (node);
|
||||
|
||||
for (i = 0; i < node->operations->len; i++)
|
||||
{
|
||||
@ -454,20 +420,18 @@ clutter_pipeline_node_draw (ClutterPaintNode *node,
|
||||
break;
|
||||
|
||||
case PAINT_OP_TEX_RECT:
|
||||
cogl_framebuffer_draw_textured_rectangle (fb,
|
||||
pnode->pipeline,
|
||||
op->op.texrect[0],
|
||||
op->op.texrect[1],
|
||||
op->op.texrect[2],
|
||||
op->op.texrect[3],
|
||||
op->op.texrect[4],
|
||||
op->op.texrect[5],
|
||||
op->op.texrect[6],
|
||||
op->op.texrect[7]);
|
||||
cogl_rectangle_with_texture_coords (op->op.texrect[0],
|
||||
op->op.texrect[1],
|
||||
op->op.texrect[2],
|
||||
op->op.texrect[3],
|
||||
op->op.texrect[4],
|
||||
op->op.texrect[5],
|
||||
op->op.texrect[6],
|
||||
op->op.texrect[7]);
|
||||
break;
|
||||
|
||||
case PAINT_OP_MULTITEX_RECT:
|
||||
cogl_framebuffer_draw_multitextured_rectangle (fb,
|
||||
cogl_framebuffer_draw_multitextured_rectangle (cogl_get_draw_framebuffer (),
|
||||
pnode->pipeline,
|
||||
op->op.texrect[0],
|
||||
op->op.texrect[1],
|
||||
@ -478,7 +442,7 @@ clutter_pipeline_node_draw (ClutterPaintNode *node,
|
||||
break;
|
||||
|
||||
case PAINT_OP_PATH:
|
||||
cogl_framebuffer_fill_path (fb, pnode->pipeline, op->op.path);
|
||||
cogl_path_fill (op->op.path);
|
||||
break;
|
||||
|
||||
case PAINT_OP_PRIMITIVE:
|
||||
@ -491,9 +455,9 @@ clutter_pipeline_node_draw (ClutterPaintNode *node,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_pipeline_node_post_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_pipeline_node_post_draw (ClutterPaintNode *node)
|
||||
{
|
||||
cogl_pop_source ();
|
||||
}
|
||||
|
||||
static JsonNode *
|
||||
@ -812,8 +776,7 @@ clutter_text_node_finalize (ClutterPaintNode *node)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_text_node_pre_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_text_node_pre_draw (ClutterPaintNode *node)
|
||||
{
|
||||
ClutterTextNode *tnode = CLUTTER_TEXT_NODE (node);
|
||||
|
||||
@ -821,8 +784,7 @@ clutter_text_node_pre_draw (ClutterPaintNode *node,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_text_node_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_text_node_draw (ClutterPaintNode *node)
|
||||
{
|
||||
ClutterTextNode *tnode = CLUTTER_TEXT_NODE (node);
|
||||
PangoRectangle extents;
|
||||
@ -832,7 +794,7 @@ clutter_text_node_draw (ClutterPaintNode *node,
|
||||
if (node->operations == NULL)
|
||||
return;
|
||||
|
||||
fb = get_target_framebuffer (node, paint_context);
|
||||
fb = clutter_paint_node_get_framebuffer (node);
|
||||
|
||||
pango_layout_get_pixel_extents (tnode->layout, NULL, &extents);
|
||||
|
||||
@ -865,11 +827,11 @@ clutter_text_node_draw (ClutterPaintNode *node,
|
||||
clipped = TRUE;
|
||||
}
|
||||
|
||||
cogl_pango_show_layout (fb,
|
||||
tnode->layout,
|
||||
op->op.texrect[0],
|
||||
op->op.texrect[1],
|
||||
&tnode->color);
|
||||
cogl_pango_render_layout (tnode->layout,
|
||||
op->op.texrect[0],
|
||||
op->op.texrect[1],
|
||||
&tnode->color,
|
||||
0);
|
||||
|
||||
if (clipped)
|
||||
cogl_framebuffer_pop_clip (fb);
|
||||
@ -1008,8 +970,7 @@ struct _ClutterClipNodeClass
|
||||
G_DEFINE_TYPE (ClutterClipNode, clutter_clip_node, CLUTTER_TYPE_PAINT_NODE)
|
||||
|
||||
static gboolean
|
||||
clutter_clip_node_pre_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_clip_node_pre_draw (ClutterPaintNode *node)
|
||||
{
|
||||
gboolean retval = FALSE;
|
||||
CoglFramebuffer *fb;
|
||||
@ -1018,7 +979,7 @@ clutter_clip_node_pre_draw (ClutterPaintNode *node,
|
||||
if (node->operations == NULL)
|
||||
return FALSE;
|
||||
|
||||
fb = get_target_framebuffer (node, paint_context);
|
||||
fb = clutter_paint_node_get_framebuffer (node);
|
||||
|
||||
for (i = 0; i < node->operations->len; i++)
|
||||
{
|
||||
@ -1053,8 +1014,7 @@ clutter_clip_node_pre_draw (ClutterPaintNode *node,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_clip_node_post_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_clip_node_post_draw (ClutterPaintNode *node)
|
||||
{
|
||||
CoglFramebuffer *fb;
|
||||
guint i;
|
||||
@ -1062,7 +1022,7 @@ clutter_clip_node_post_draw (ClutterPaintNode *node,
|
||||
if (node->operations == NULL)
|
||||
return;
|
||||
|
||||
fb = get_target_framebuffer (node, paint_context);
|
||||
fb = clutter_paint_node_get_framebuffer (node);
|
||||
|
||||
for (i = 0; i < node->operations->len; i++)
|
||||
{
|
||||
@ -1118,118 +1078,10 @@ clutter_clip_node_new (void)
|
||||
}
|
||||
|
||||
/*
|
||||
* ClutterActorNode
|
||||
* ClutterLayerNode (private)
|
||||
*/
|
||||
|
||||
struct _ClutterActorNode
|
||||
{
|
||||
ClutterPaintNode parent_instance;
|
||||
|
||||
ClutterActor *actor;
|
||||
};
|
||||
|
||||
struct _ClutterActorNodeClass
|
||||
{
|
||||
ClutterPaintNodeClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (ClutterActorNode, clutter_actor_node, CLUTTER_TYPE_PAINT_NODE)
|
||||
|
||||
static gboolean
|
||||
clutter_actor_node_pre_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
|
||||
|
||||
CLUTTER_SET_PRIVATE_FLAGS (actor_node->actor, CLUTTER_IN_PAINT);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_node_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
|
||||
|
||||
clutter_actor_continue_paint (actor_node->actor, paint_context);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_node_post_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
|
||||
|
||||
CLUTTER_UNSET_PRIVATE_FLAGS (actor_node->actor, CLUTTER_IN_PAINT);
|
||||
}
|
||||
|
||||
static JsonNode *
|
||||
clutter_actor_node_serialize (ClutterPaintNode *node)
|
||||
{
|
||||
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
|
||||
g_autoptr (JsonBuilder) builder = NULL;
|
||||
const char *debug_name;
|
||||
|
||||
debug_name = _clutter_actor_get_debug_name (actor_node->actor);
|
||||
|
||||
builder = json_builder_new ();
|
||||
|
||||
json_builder_begin_object (builder);
|
||||
json_builder_set_member_name (builder, "actor");
|
||||
json_builder_add_string_value (builder, debug_name);
|
||||
json_builder_end_object (builder);
|
||||
|
||||
return json_builder_get_root (builder);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_node_class_init (ClutterActorNodeClass *klass)
|
||||
{
|
||||
ClutterPaintNodeClass *node_class;
|
||||
|
||||
node_class = CLUTTER_PAINT_NODE_CLASS (klass);
|
||||
node_class->pre_draw = clutter_actor_node_pre_draw;
|
||||
node_class->draw = clutter_actor_node_draw;
|
||||
node_class->post_draw = clutter_actor_node_post_draw;
|
||||
node_class->serialize = clutter_actor_node_serialize;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_node_init (ClutterActorNode *self)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* clutter_actor_node_new:
|
||||
* @actor: the actor to paint
|
||||
*
|
||||
* Creates a new #ClutterActorNode.
|
||||
*
|
||||
* The actor is painted together with any effects
|
||||
* applied to it. Children of this node will draw
|
||||
* over the actor contents.
|
||||
*
|
||||
* Return value: (transfer full): the newly created #ClutterActorNode.
|
||||
* Use clutter_paint_node_unref() when done.
|
||||
*/
|
||||
ClutterPaintNode *
|
||||
clutter_actor_node_new (ClutterActor *actor)
|
||||
{
|
||||
ClutterActorNode *res;
|
||||
|
||||
g_assert (actor != NULL);
|
||||
|
||||
res = _clutter_paint_node_create (CLUTTER_TYPE_ACTOR_NODE);
|
||||
res->actor = actor;
|
||||
|
||||
return (ClutterPaintNode *) res;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ClutterLayerNode
|
||||
*/
|
||||
#define clutter_layer_node_get_type _clutter_layer_node_get_type
|
||||
|
||||
struct _ClutterLayerNode
|
||||
{
|
||||
@ -1257,11 +1109,9 @@ struct _ClutterLayerNodeClass
|
||||
G_DEFINE_TYPE (ClutterLayerNode, clutter_layer_node, CLUTTER_TYPE_PAINT_NODE)
|
||||
|
||||
static gboolean
|
||||
clutter_layer_node_pre_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_layer_node_pre_draw (ClutterPaintNode *node)
|
||||
{
|
||||
ClutterLayerNode *lnode = (ClutterLayerNode *) node;
|
||||
CoglFramebuffer *framebuffer;
|
||||
CoglMatrix matrix;
|
||||
|
||||
/* if we were unable to create an offscreen buffer for this node, then
|
||||
@ -1277,10 +1127,9 @@ clutter_layer_node_pre_draw (ClutterPaintNode *node,
|
||||
/* copy the same modelview from the current framebuffer to the one we
|
||||
* are going to use
|
||||
*/
|
||||
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
|
||||
cogl_framebuffer_get_modelview_matrix (framebuffer, &matrix);
|
||||
cogl_get_modelview_matrix (&matrix);
|
||||
|
||||
clutter_paint_context_push_framebuffer (paint_context, lnode->offscreen);
|
||||
cogl_push_framebuffer (lnode->offscreen);
|
||||
|
||||
cogl_framebuffer_set_modelview_matrix (lnode->offscreen, &matrix);
|
||||
|
||||
@ -1298,7 +1147,7 @@ clutter_layer_node_pre_draw (ClutterPaintNode *node,
|
||||
COGL_BUFFER_BIT_COLOR | COGL_BUFFER_BIT_DEPTH,
|
||||
0.f, 0.f, 0.f, 0.f);
|
||||
|
||||
cogl_framebuffer_push_matrix (lnode->offscreen);
|
||||
cogl_push_matrix ();
|
||||
|
||||
/* every draw operation after this point will happen an offscreen
|
||||
* framebuffer
|
||||
@ -1308,18 +1157,17 @@ clutter_layer_node_pre_draw (ClutterPaintNode *node,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_layer_node_post_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_layer_node_post_draw (ClutterPaintNode *node)
|
||||
{
|
||||
ClutterLayerNode *lnode = CLUTTER_LAYER_NODE (node);
|
||||
CoglFramebuffer *fb;
|
||||
guint i;
|
||||
|
||||
/* switch to the previous framebuffer */
|
||||
cogl_framebuffer_pop_matrix (lnode->offscreen);
|
||||
clutter_paint_context_pop_framebuffer (paint_context);
|
||||
cogl_pop_matrix ();
|
||||
cogl_pop_framebuffer ();
|
||||
|
||||
fb = clutter_paint_context_get_framebuffer (paint_context);
|
||||
fb = cogl_get_draw_framebuffer ();
|
||||
|
||||
for (i = 0; i < node->operations->len; i++)
|
||||
{
|
||||
@ -1333,20 +1181,20 @@ clutter_layer_node_post_draw (ClutterPaintNode *node,
|
||||
|
||||
case PAINT_OP_TEX_RECT:
|
||||
/* now we need to paint the texture */
|
||||
cogl_framebuffer_draw_textured_rectangle (fb,
|
||||
lnode->state,
|
||||
op->op.texrect[0],
|
||||
op->op.texrect[1],
|
||||
op->op.texrect[2],
|
||||
op->op.texrect[3],
|
||||
op->op.texrect[4],
|
||||
op->op.texrect[5],
|
||||
op->op.texrect[6],
|
||||
op->op.texrect[7]);
|
||||
cogl_push_source (lnode->state);
|
||||
cogl_rectangle_with_texture_coords (op->op.texrect[0],
|
||||
op->op.texrect[1],
|
||||
op->op.texrect[2],
|
||||
op->op.texrect[3],
|
||||
op->op.texrect[4],
|
||||
op->op.texrect[5],
|
||||
op->op.texrect[6],
|
||||
op->op.texrect[7]);
|
||||
cogl_pop_source ();
|
||||
break;
|
||||
|
||||
case PAINT_OP_MULTITEX_RECT:
|
||||
cogl_framebuffer_draw_multitextured_rectangle (fb,
|
||||
cogl_framebuffer_draw_multitextured_rectangle (cogl_get_draw_framebuffer (),
|
||||
lnode->state,
|
||||
op->op.texrect[0],
|
||||
op->op.texrect[1],
|
||||
@ -1357,7 +1205,9 @@ clutter_layer_node_post_draw (ClutterPaintNode *node,
|
||||
break;
|
||||
|
||||
case PAINT_OP_PATH:
|
||||
cogl_framebuffer_fill_path (fb, lnode->state, op->op.path);
|
||||
cogl_push_source (lnode->state);
|
||||
cogl_path_fill (op->op.path);
|
||||
cogl_pop_source ();
|
||||
break;
|
||||
|
||||
case PAINT_OP_PRIMITIVE:
|
||||
@ -1418,11 +1268,11 @@ clutter_layer_node_init (ClutterLayerNode *self)
|
||||
* Since: 1.10
|
||||
*/
|
||||
ClutterPaintNode *
|
||||
clutter_layer_node_new (const CoglMatrix *projection,
|
||||
const cairo_rectangle_t *viewport,
|
||||
float width,
|
||||
float height,
|
||||
guint8 opacity)
|
||||
_clutter_layer_node_new (const CoglMatrix *projection,
|
||||
const cairo_rectangle_t *viewport,
|
||||
float width,
|
||||
float height,
|
||||
guint8 opacity)
|
||||
{
|
||||
ClutterLayerNode *res;
|
||||
CoglColor color;
|
||||
|
@ -143,25 +143,6 @@ CLUTTER_EXPORT
|
||||
ClutterPaintNode * clutter_text_node_new (PangoLayout *layout,
|
||||
const ClutterColor *color);
|
||||
|
||||
#define CLUTTER_TYPE_ACTOR_NODE (clutter_actor_node_get_type ())
|
||||
#define CLUTTER_ACTOR_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ACTOR_NODE, ClutterActorNode))
|
||||
#define CLUTTER_IS_ACTOR_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ACTOR_NODE))
|
||||
|
||||
/**
|
||||
* ClutterActorNode:
|
||||
*
|
||||
* The #ClutterActorNode structure is an opaque
|
||||
* type whose members cannot be directly accessed.
|
||||
*/
|
||||
typedef struct _ClutterActorNode ClutterActorNode;
|
||||
typedef struct _ClutterActorNode ClutterActorNodeClass;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_actor_node_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterPaintNode * clutter_actor_node_new (ClutterActor *actor);
|
||||
|
||||
#define CLUTTER_TYPE_ROOT_NODE (clutter_root_node_get_type ())
|
||||
#define CLUTTER_ROOT_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ROOT_NODE, ClutterRootNode))
|
||||
#define CLUTTER_IS_ROOT_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ROOT_NODE))
|
||||
@ -182,54 +163,6 @@ CLUTTER_EXPORT
|
||||
ClutterPaintNode * clutter_root_node_new (CoglFramebuffer *framebuffer,
|
||||
const ClutterColor *clear_color,
|
||||
CoglBufferBit clear_flags);
|
||||
|
||||
#define CLUTTER_TYPE_LAYER_NODE (clutter_layer_node_get_type ())
|
||||
#define CLUTTER_LAYER_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_LAYER_NODE, ClutterLayerNode))
|
||||
#define CLUTTER_IS_LAYER_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_LAYER_NODE))
|
||||
|
||||
/*
|
||||
* ClutterLayerNode:
|
||||
*
|
||||
* The #ClutterLayerNode structure is an opaque
|
||||
* type whose members cannot be directly accessed.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
typedef struct _ClutterLayerNode ClutterLayerNode;
|
||||
typedef struct _ClutterLayerNodeClass ClutterLayerNodeClass;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_layer_node_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterPaintNode * clutter_layer_node_new (const CoglMatrix *projection,
|
||||
const cairo_rectangle_t *viewport,
|
||||
float width,
|
||||
float height,
|
||||
guint8 opacity);
|
||||
|
||||
|
||||
#define CLUTTER_TYPE_TRANSFORM_NODE (clutter_transform_node_get_type ())
|
||||
#define CLUTTER_TRANSFORM_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_TRANSFORM_NODE, ClutterTransformNode))
|
||||
#define CLUTTER_IS_TRANSFORM_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_TRANSFORM_NODE))
|
||||
|
||||
/*
|
||||
* ClutterTransformNode:
|
||||
*
|
||||
* The #ClutterLayerNode structure is an opaque
|
||||
* type whose members cannot be directly accessed.
|
||||
*
|
||||
* Since: 1.10
|
||||
*/
|
||||
typedef struct _ClutterTransformNode ClutterTransformNode;
|
||||
typedef struct _ClutterPaintNodeClass ClutterTransformNodeClass;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_transform_node_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterPaintNode * clutter_transform_node_new (const CoglMatrix *projection);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_PAINT_NODES_H__ */
|
||||
|
@ -27,7 +27,8 @@
|
||||
* and bezier curves.
|
||||
*
|
||||
* A #ClutterPath contains a description of a path consisting of
|
||||
* straight lines and bezier curves.
|
||||
* straight lines and bezier curves. This can be used in a
|
||||
* #ClutterBehaviourPath to animate an actor moving along the path.
|
||||
*
|
||||
* The path consists of a series of nodes. Each node is one of the
|
||||
* following four types:
|
||||
@ -243,6 +244,9 @@ clutter_path_finalize (GObject *object)
|
||||
*
|
||||
* Creates a new #ClutterPath instance with no nodes.
|
||||
*
|
||||
* The object has a floating reference so if you add it to a
|
||||
* #ClutterBehaviourPath then you do not need to unref it.
|
||||
*
|
||||
* Return value: the newly created #ClutterPath
|
||||
*
|
||||
* Since: 1.0
|
||||
@ -263,6 +267,9 @@ clutter_path_new (void)
|
||||
* @desc. See clutter_path_add_string() for details of the format of
|
||||
* the string.
|
||||
*
|
||||
* The object has a floating reference so if you add it to a
|
||||
* #ClutterBehaviourPath then you do not need to unref it.
|
||||
*
|
||||
* Return value: the newly created #ClutterPath
|
||||
*
|
||||
* Since: 1.0
|
||||
|
@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Red Hat Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CLUTTER_PICK_CONTEXT_PRIVATE_H
|
||||
#define CLUTTER_PICK_CONTEXT_PRIVATE_H
|
||||
|
||||
#include "clutter-pick-context.h"
|
||||
|
||||
ClutterPickContext * clutter_pick_context_new_for_view (ClutterStageView *view);
|
||||
|
||||
#endif /* CLUTTER_PICK_CONTEXT_PRIVATE_H */
|
@ -1,83 +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-pick-context-private.h"
|
||||
|
||||
struct _ClutterPickContext
|
||||
{
|
||||
grefcount ref_count;
|
||||
|
||||
CoglFramebuffer *framebuffer;
|
||||
};
|
||||
|
||||
G_DEFINE_BOXED_TYPE (ClutterPickContext, clutter_pick_context,
|
||||
clutter_pick_context_ref,
|
||||
clutter_pick_context_unref)
|
||||
|
||||
ClutterPickContext *
|
||||
clutter_pick_context_new_for_view (ClutterStageView *view)
|
||||
{
|
||||
ClutterPickContext *pick_context;
|
||||
|
||||
pick_context = g_new0 (ClutterPickContext, 1);
|
||||
g_ref_count_init (&pick_context->ref_count);
|
||||
pick_context->framebuffer =
|
||||
cogl_object_ref (clutter_stage_view_get_framebuffer (view));
|
||||
|
||||
return pick_context;
|
||||
}
|
||||
|
||||
ClutterPickContext *
|
||||
clutter_pick_context_ref (ClutterPickContext *pick_context)
|
||||
{
|
||||
g_ref_count_inc (&pick_context->ref_count);
|
||||
return pick_context;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_pick_context_dispose (ClutterPickContext *pick_context)
|
||||
{
|
||||
g_clear_pointer (&pick_context->framebuffer, cogl_object_unref);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_pick_context_unref (ClutterPickContext *pick_context)
|
||||
{
|
||||
if (g_ref_count_dec (&pick_context->ref_count))
|
||||
{
|
||||
clutter_pick_context_dispose (pick_context);
|
||||
g_free (pick_context);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
clutter_pick_context_destroy (ClutterPickContext *pick_context)
|
||||
{
|
||||
clutter_pick_context_dispose (pick_context);
|
||||
clutter_pick_context_unref (pick_context);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_pick_context_get_framebuffer: (skip)
|
||||
*/
|
||||
CoglFramebuffer *
|
||||
clutter_pick_context_get_framebuffer (ClutterPickContext *pick_context)
|
||||
{
|
||||
return pick_context->framebuffer;
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Red Hat Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CLUTTER_PICK_CONTEXT_H
|
||||
#define CLUTTER_PICK_CONTEXT_H
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "clutter-macros.h"
|
||||
#include "clutter-stage-view.h"
|
||||
|
||||
typedef struct _ClutterPickContext ClutterPickContext;
|
||||
|
||||
#define CLUTTER_TYPE_PICK_CONTEXT (clutter_pick_context_get_type ())
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_pick_context_get_type (void);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterPickContext * clutter_pick_context_ref (ClutterPickContext *pick_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_pick_context_unref (ClutterPickContext *pick_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_pick_context_destroy (ClutterPickContext *pick_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
CoglFramebuffer * clutter_pick_context_get_framebuffer (ClutterPickContext *pick_context);
|
||||
|
||||
#endif /* CLUTTER_PICK_CONTEXT_H */
|
@ -67,7 +67,6 @@ typedef struct _ClutterVertex4 ClutterVertex4;
|
||||
#define CLUTTER_ACTOR_IN_DESTRUCTION(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_DESTRUCTION) != FALSE)
|
||||
#define CLUTTER_ACTOR_IN_REPARENT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_REPARENT) != FALSE)
|
||||
#define CLUTTER_ACTOR_IN_PAINT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PAINT) != FALSE)
|
||||
#define CLUTTER_ACTOR_IN_PICK(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PICK) != FALSE)
|
||||
#define CLUTTER_ACTOR_IN_RELAYOUT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_RELAYOUT) != FALSE)
|
||||
#define CLUTTER_ACTOR_IN_PREF_WIDTH(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PREF_WIDTH) != FALSE)
|
||||
#define CLUTTER_ACTOR_IN_PREF_HEIGHT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PREF_HEIGHT) != FALSE)
|
||||
@ -105,10 +104,9 @@ typedef enum
|
||||
|
||||
/* Used to avoid recursion */
|
||||
CLUTTER_IN_PAINT = 1 << 5,
|
||||
CLUTTER_IN_PICK = 1 << 6,
|
||||
|
||||
/* Used to avoid recursion */
|
||||
CLUTTER_IN_RELAYOUT = 1 << 7,
|
||||
CLUTTER_IN_RELAYOUT = 1 << 6,
|
||||
} ClutterPrivateFlags;
|
||||
|
||||
/*
|
||||
@ -248,9 +246,6 @@ gboolean _clutter_util_rectangle_intersection (const cairo_rectangle_int_t *src1
|
||||
const cairo_rectangle_int_t *src2,
|
||||
cairo_rectangle_int_t *dest);
|
||||
|
||||
gboolean clutter_util_rectangle_equal (const cairo_rectangle_int_t *src1,
|
||||
const cairo_rectangle_int_t *src2);
|
||||
|
||||
|
||||
struct _ClutterVertex4
|
||||
{
|
||||
|
@ -75,6 +75,65 @@
|
||||
* packing rules of Clutter still apply, and an actor cannot be packed
|
||||
* in multiple containers without unparenting it in between).
|
||||
*
|
||||
* Behaviours and timelines can also be defined inside a UI definition
|
||||
* buffer:
|
||||
*
|
||||
* <informalexample><programlisting><![CDATA[
|
||||
* {
|
||||
* "id" : "rotate-behaviour",
|
||||
* "type" : "ClutterBehaviourRotate",
|
||||
* "angle-start" : 0.0,
|
||||
* "angle-end" : 360.0,
|
||||
* "axis" : "z-axis",
|
||||
* "alpha" : {
|
||||
* "timeline" : { "duration" : 4000, "loop" : true },
|
||||
* "mode" : "easeInSine"
|
||||
* }
|
||||
* }
|
||||
* ]]></programlisting></informalexample>
|
||||
*
|
||||
* And then to apply a defined behaviour to an actor defined inside the
|
||||
* definition of an actor, the "behaviour" member can be used:
|
||||
*
|
||||
* <informalexample><programlisting><![CDATA[
|
||||
* {
|
||||
* "id" : "my-rotating-actor",
|
||||
* "type" : "ClutterTexture",
|
||||
* ...
|
||||
* "behaviours" : [ "rotate-behaviour" ]
|
||||
* }
|
||||
* ]]></programlisting></informalexample>
|
||||
*
|
||||
* A #ClutterAlpha belonging to a #ClutterBehaviour can only be defined
|
||||
* implicitly like in the example above, or explicitly by setting the
|
||||
* "alpha" property to point to a previously defined #ClutterAlpha, e.g.:
|
||||
*
|
||||
* <informalexample><programlisting><![CDATA[
|
||||
* {
|
||||
* "id" : "rotate-behaviour",
|
||||
* "type" : "ClutterBehaviourRotate",
|
||||
* "angle-start" : 0.0,
|
||||
* "angle-end" : 360.0,
|
||||
* "axis" : "z-axis",
|
||||
* "alpha" : {
|
||||
* "id" : "rotate-alpha",
|
||||
* "type" : "ClutterAlpha",
|
||||
* "timeline" : {
|
||||
* "id" : "rotate-timeline",
|
||||
* "type : "ClutterTimeline",
|
||||
* "duration" : 4000,
|
||||
* "loop" : true
|
||||
* },
|
||||
* "function" : "custom_sine_alpha"
|
||||
* }
|
||||
* }
|
||||
* ]]></programlisting></informalexample>
|
||||
*
|
||||
* Implicitely defined #ClutterAlpha<!-- -->s and #ClutterTimeline<!-- -->s
|
||||
* can omit the `id`, as well as the `type` members, but will not be available
|
||||
* using clutter_script_get_object() (they can, however, be extracted using the
|
||||
* #ClutterBehaviour and #ClutterAlpha API respectively).
|
||||
*
|
||||
* Signal handlers can be defined inside a Clutter UI definition file and
|
||||
* then autoconnected to their respective signals using the
|
||||
* clutter_script_connect_signals() function:
|
||||
@ -151,6 +210,7 @@
|
||||
* function
|
||||
* "type_func" := the GType function name, for non-standard classes
|
||||
* "children" := an array of names or objects to add as children
|
||||
* "behaviours" := an array of names or objects to apply to an actor
|
||||
* "signals" := an array of signal definitions to connect to an object
|
||||
* "is-default" := a boolean flag used when defining the #ClutterStage;
|
||||
* if set to "true" the default stage will be used instead
|
||||
@ -175,6 +235,7 @@
|
||||
|
||||
#include "clutter-actor.h"
|
||||
#include "clutter-stage.h"
|
||||
#include "clutter-texture.h"
|
||||
|
||||
#include "clutter-script.h"
|
||||
#include "clutter-script-private.h"
|
||||
@ -185,6 +246,7 @@
|
||||
#include "clutter-debug.h"
|
||||
|
||||
#include "deprecated/clutter-alpha.h"
|
||||
#include "deprecated/clutter-behaviour.h"
|
||||
#include "deprecated/clutter-container.h"
|
||||
#include "deprecated/clutter-state.h"
|
||||
|
||||
@ -462,10 +524,11 @@ clutter_script_init (ClutterScript *script)
|
||||
/**
|
||||
* clutter_script_new:
|
||||
*
|
||||
* Creates a new #ClutterScript instance. #ClutterScript can be used to load
|
||||
* objects definitions for scenegraph elements, like actors, or behavioural
|
||||
* elements, like timelines. The definitions must be encoded using the
|
||||
* JavaScript Object Notation (JSON) language.
|
||||
* Creates a new #ClutterScript instance. #ClutterScript can be used
|
||||
* to load objects definitions for scenegraph elements, like actors,
|
||||
* or behavioural elements, like behaviours and timelines. The
|
||||
* definitions must be encoded using the JavaScript Object Notation (JSON)
|
||||
* language.
|
||||
*
|
||||
* Return value: the newly created #ClutterScript instance. Use
|
||||
* g_object_unref() when done.
|
||||
@ -800,7 +863,9 @@ construct_each_objects (gpointer key,
|
||||
if (oinfo->object == NULL)
|
||||
_clutter_script_construct_object (script, oinfo);
|
||||
|
||||
/* this will take care of setting up properties and adding children */
|
||||
/* this will take care of setting up properties,
|
||||
* adding children and applying behaviours
|
||||
*/
|
||||
_clutter_script_apply_properties (script, oinfo);
|
||||
}
|
||||
}
|
||||
|
@ -1,701 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright (C) 2019 Red Hat Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author: Carlos Garnacho <carlosg@gnome.org>
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter-backend-private.h"
|
||||
#include "clutter-input-device-tool.h"
|
||||
#include "clutter-input-pointer-a11y-private.h"
|
||||
#include "clutter-marshal.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-seat.h"
|
||||
#include "clutter-virtual-input-device.h"
|
||||
|
||||
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,
|
||||
IS_UNFOCUS_INHIBITED_CHANGED,
|
||||
N_SIGNALS,
|
||||
};
|
||||
|
||||
static guint signals[N_SIGNALS] = { 0 };
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_BACKEND,
|
||||
PROP_TOUCH_MODE,
|
||||
N_PROPS
|
||||
};
|
||||
|
||||
static GParamSpec *props[N_PROPS];
|
||||
|
||||
typedef struct _ClutterSeatPrivate ClutterSeatPrivate;
|
||||
|
||||
struct _ClutterSeatPrivate
|
||||
{
|
||||
ClutterBackend *backend;
|
||||
|
||||
unsigned int inhibit_unfocus_count;
|
||||
|
||||
/* Keyboard a11y */
|
||||
ClutterKbdA11ySettings kbd_a11y_settings;
|
||||
|
||||
/* Pointer a11y */
|
||||
ClutterPointerA11ySettings pointer_a11y_settings;
|
||||
};
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterSeat, clutter_seat, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
clutter_seat_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterSeat *seat = CLUTTER_SEAT (object);
|
||||
ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_BACKEND:
|
||||
priv->backend = g_value_get_object (value);
|
||||
break;
|
||||
case PROP_TOUCH_MODE:
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_seat_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterSeat *seat = CLUTTER_SEAT (object);
|
||||
ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_BACKEND:
|
||||
g_value_set_object (value, priv->backend);
|
||||
break;
|
||||
case PROP_TOUCH_MODE:
|
||||
g_value_set_boolean (value, FALSE);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_seat_finalize (GObject *object)
|
||||
{
|
||||
ClutterSeat *seat = CLUTTER_SEAT (object);
|
||||
ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
|
||||
|
||||
g_clear_object (&priv->backend);
|
||||
|
||||
G_OBJECT_CLASS (clutter_seat_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_seat_class_init (ClutterSeatClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->set_property = clutter_seat_set_property;
|
||||
object_class->get_property = clutter_seat_get_property;
|
||||
object_class->finalize = clutter_seat_finalize;
|
||||
|
||||
signals[DEVICE_ADDED] =
|
||||
g_signal_new (I_("device-added"),
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_INPUT_DEVICE);
|
||||
|
||||
signals[DEVICE_REMOVED] =
|
||||
g_signal_new (I_("device-removed"),
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_INPUT_DEVICE);
|
||||
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);
|
||||
g_signal_set_va_marshaller (signals[TOOL_CHANGED],
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
_clutter_marshal_VOID__OBJECT_OBJECTv);
|
||||
|
||||
/**
|
||||
* ClutterSeat::kbd-a11y-mods-state-changed:
|
||||
* @seat: the #ClutterSeat that emitted the signal
|
||||
* @latched_mask: the latched modifier mask from stickykeys
|
||||
* @locked_mask: the locked modifier mask from stickykeys
|
||||
*
|
||||
* The ::kbd-a11y-mods-state-changed signal is emitted each time either the
|
||||
* latched modifiers mask or locked modifiers mask are changed as the
|
||||
* result of keyboard accessibilty's sticky keys operations.
|
||||
*/
|
||||
signals[KBD_A11Y_MASK_CHANGED] =
|
||||
g_signal_new (I_("kbd-a11y-mods-state-changed"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL,
|
||||
_clutter_marshal_VOID__UINT_UINT,
|
||||
G_TYPE_NONE, 2,
|
||||
G_TYPE_UINT,
|
||||
G_TYPE_UINT);
|
||||
g_signal_set_va_marshaller (signals[KBD_A11Y_MASK_CHANGED],
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
_clutter_marshal_VOID__UINT_UINTv);
|
||||
|
||||
/**
|
||||
* ClutterSeat::kbd-a11y-flags-changed:
|
||||
* @seat: the #ClutterSeat that emitted the signal
|
||||
* @settings_flags: the new ClutterKeyboardA11yFlags configuration
|
||||
* @changed_mask: the ClutterKeyboardA11yFlags changed
|
||||
*
|
||||
* The ::kbd-a11y-flags-changed signal is emitted each time the
|
||||
* ClutterKeyboardA11yFlags configuration is changed as the result of
|
||||
* keyboard accessibility operations.
|
||||
*/
|
||||
signals[KBD_A11Y_FLAGS_CHANGED] =
|
||||
g_signal_new (I_("kbd-a11y-flags-changed"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL,
|
||||
_clutter_marshal_VOID__UINT_UINT,
|
||||
G_TYPE_NONE, 2,
|
||||
G_TYPE_UINT,
|
||||
G_TYPE_UINT);
|
||||
g_signal_set_va_marshaller (signals[KBD_A11Y_FLAGS_CHANGED],
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
_clutter_marshal_VOID__UINT_UINTv);
|
||||
|
||||
/**
|
||||
* ClutterSeat::ptr-a11y-dwell-click-type-changed:
|
||||
* @seat: the #ClutterSeat that emitted the signal
|
||||
* @click_type: the new #ClutterPointerA11yDwellClickType mode
|
||||
*
|
||||
* The ::ptr-a11y-dwell-click-type-changed signal is emitted each time
|
||||
* the ClutterPointerA11yDwellClickType mode is changed as the result
|
||||
* of pointer accessibility operations.
|
||||
*/
|
||||
signals[PTR_A11Y_DWELL_CLICK_TYPE_CHANGED] =
|
||||
g_signal_new (I_("ptr-a11y-dwell-click-type-changed"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_POINTER_A11Y_DWELL_CLICK_TYPE);
|
||||
|
||||
/**
|
||||
* ClutterSeat::ptr-a11y-timeout-started:
|
||||
* @seat: the #ClutterSeat that emitted the signal
|
||||
* @device: the core pointer #ClutterInputDevice
|
||||
* @timeout_type: the type of timeout #ClutterPointerA11yTimeoutType
|
||||
* @delay: the delay in ms before secondary-click is triggered.
|
||||
*
|
||||
* The ::ptr-a11y-timeout-started signal is emitted when a
|
||||
* pointer accessibility timeout delay is started, so that upper
|
||||
* layers can notify the user with some visual feedback.
|
||||
*/
|
||||
signals[PTR_A11Y_TIMEOUT_STARTED] =
|
||||
g_signal_new (I_("ptr-a11y-timeout-started"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL,
|
||||
_clutter_marshal_VOID__OBJECT_FLAGS_UINT,
|
||||
G_TYPE_NONE, 3,
|
||||
CLUTTER_TYPE_INPUT_DEVICE,
|
||||
CLUTTER_TYPE_POINTER_A11Y_TIMEOUT_TYPE,
|
||||
G_TYPE_UINT);
|
||||
g_signal_set_va_marshaller (signals[PTR_A11Y_TIMEOUT_STARTED],
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
_clutter_marshal_VOID__OBJECT_FLAGS_UINTv);
|
||||
|
||||
/**
|
||||
* ClutterSeat::ptr-a11y-timeout-stopped:
|
||||
* @seat: the #ClutterSeat that emitted the signal
|
||||
* @device: the core pointer #ClutterInputDevice
|
||||
* @timeout_type: the type of timeout #ClutterPointerA11yTimeoutType
|
||||
* @clicked: %TRUE if the timeout finished and triggered a click
|
||||
*
|
||||
* The ::ptr-a11y-timeout-stopped signal is emitted when a running
|
||||
* pointer accessibility timeout delay is stopped, either because
|
||||
* it's triggered at the end of the delay or cancelled, so that
|
||||
* upper layers can notify the user with some visual feedback.
|
||||
*/
|
||||
signals[PTR_A11Y_TIMEOUT_STOPPED] =
|
||||
g_signal_new (I_("ptr-a11y-timeout-stopped"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL,
|
||||
_clutter_marshal_VOID__OBJECT_FLAGS_BOOLEAN,
|
||||
G_TYPE_NONE, 3,
|
||||
CLUTTER_TYPE_INPUT_DEVICE,
|
||||
CLUTTER_TYPE_POINTER_A11Y_TIMEOUT_TYPE,
|
||||
G_TYPE_BOOLEAN);
|
||||
g_signal_set_va_marshaller (signals[PTR_A11Y_TIMEOUT_STOPPED],
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
_clutter_marshal_VOID__OBJECT_FLAGS_BOOLEANv);
|
||||
|
||||
/**
|
||||
* ClutterSeat::is-unfocus-inhibited-changed:
|
||||
* @seat: the #ClutterSeat that emitted the signal
|
||||
*
|
||||
* The ::is-unfocus-inhibited-changed signal is emitted when the
|
||||
* property to inhibit the unsetting of the focus-surface of the
|
||||
* #ClutterSeat changed. To get the current state of this property,
|
||||
* use clutter_seat_is_unfocus_inhibited().
|
||||
*/
|
||||
signals[IS_UNFOCUS_INHIBITED_CHANGED] =
|
||||
g_signal_new (I_("is-unfocus-inhibited-changed"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
props[PROP_BACKEND] =
|
||||
g_param_spec_object ("backend",
|
||||
P_("Backend"),
|
||||
P_("Backend"),
|
||||
CLUTTER_TYPE_BACKEND,
|
||||
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
|
||||
|
||||
/**
|
||||
* ClutterSeat:touch-mode:
|
||||
*
|
||||
* The current touch-mode of the #ClutterSeat, it is set to %TRUE if the
|
||||
* requirements documented in clutter_seat_get_touch_mode() are fulfilled.
|
||||
**/
|
||||
props[PROP_TOUCH_MODE] =
|
||||
g_param_spec_boolean ("touch-mode",
|
||||
P_("Touch mode"),
|
||||
P_("Touch mode"),
|
||||
FALSE,
|
||||
CLUTTER_PARAM_READABLE);
|
||||
|
||||
g_object_class_install_properties (object_class, N_PROPS, props);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_seat_init (ClutterSeat *seat)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_seat_get_pointer:
|
||||
* @seat: a #ClutterSeat
|
||||
*
|
||||
* Returns the master pointer
|
||||
*
|
||||
* Returns: (transfer none): the master pointer
|
||||
**/
|
||||
ClutterInputDevice *
|
||||
clutter_seat_get_pointer (ClutterSeat *seat)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_SEAT (seat), NULL);
|
||||
|
||||
return CLUTTER_SEAT_GET_CLASS (seat)->get_pointer (seat);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_seat_get_keyboard:
|
||||
* @seat: a #ClutterSeat
|
||||
*
|
||||
* Returns the master keyboard
|
||||
*
|
||||
* Returns: (transfer none): the master keyboard
|
||||
**/
|
||||
ClutterInputDevice *
|
||||
clutter_seat_get_keyboard (ClutterSeat *seat)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_SEAT (seat), NULL);
|
||||
|
||||
return CLUTTER_SEAT_GET_CLASS (seat)->get_keyboard (seat);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_seat_list_devices:
|
||||
* @seat: a #ClutterSeat
|
||||
*
|
||||
* Returns the list of HW devices
|
||||
*
|
||||
* Returns: (transfer container) (element-type Clutter.InputDevice): A list
|
||||
* of #ClutterInputDevice. The elements of the returned list are owned by
|
||||
* Clutter and may not be freed, the returned list should be freed using
|
||||
* g_list_free() when done.
|
||||
**/
|
||||
GList *
|
||||
clutter_seat_list_devices (ClutterSeat *seat)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_SEAT (seat), NULL);
|
||||
|
||||
return CLUTTER_SEAT_GET_CLASS (seat)->list_devices (seat);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_seat_bell_notify (ClutterSeat *seat)
|
||||
{
|
||||
CLUTTER_SEAT_GET_CLASS (seat)->bell_notify (seat);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_seat_get_keymap:
|
||||
* @seat: a #ClutterSeat
|
||||
*
|
||||
* Returns the seat keymap
|
||||
*
|
||||
* Returns: (transfer none): the seat keymap
|
||||
**/
|
||||
ClutterKeymap *
|
||||
clutter_seat_get_keymap (ClutterSeat *seat)
|
||||
{
|
||||
return CLUTTER_SEAT_GET_CLASS (seat)->get_keymap (seat);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
are_kbd_a11y_settings_equal (ClutterKbdA11ySettings *a,
|
||||
ClutterKbdA11ySettings *b)
|
||||
{
|
||||
return (memcmp (a, b, sizeof (ClutterKbdA11ySettings)) == 0);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_seat_set_kbd_a11y_settings (ClutterSeat *seat,
|
||||
ClutterKbdA11ySettings *settings)
|
||||
{
|
||||
ClutterSeatClass *seat_class;
|
||||
ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_SEAT (seat));
|
||||
|
||||
if (are_kbd_a11y_settings_equal (&priv->kbd_a11y_settings, settings))
|
||||
return;
|
||||
|
||||
priv->kbd_a11y_settings = *settings;
|
||||
|
||||
seat_class = CLUTTER_SEAT_GET_CLASS (seat);
|
||||
if (seat_class->apply_kbd_a11y_settings)
|
||||
seat_class->apply_kbd_a11y_settings (seat, settings);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_seat_get_kbd_a11y_settings (ClutterSeat *seat,
|
||||
ClutterKbdA11ySettings *settings)
|
||||
{
|
||||
ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_SEAT (seat));
|
||||
|
||||
*settings = priv->kbd_a11y_settings;
|
||||
}
|
||||
|
||||
void
|
||||
clutter_seat_ensure_a11y_state (ClutterSeat *seat)
|
||||
{
|
||||
ClutterInputDevice *core_pointer;
|
||||
|
||||
core_pointer = clutter_seat_get_pointer (seat);
|
||||
|
||||
if (core_pointer)
|
||||
{
|
||||
if (_clutter_is_input_pointer_a11y_enabled (core_pointer))
|
||||
_clutter_input_pointer_a11y_add_device (core_pointer);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
are_pointer_a11y_settings_equal (ClutterPointerA11ySettings *a,
|
||||
ClutterPointerA11ySettings *b)
|
||||
{
|
||||
return (memcmp (a, b, sizeof (ClutterPointerA11ySettings)) == 0);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_seat_enable_pointer_a11y (ClutterSeat *seat)
|
||||
{
|
||||
ClutterInputDevice *core_pointer;
|
||||
|
||||
core_pointer = clutter_seat_get_pointer (seat);
|
||||
|
||||
_clutter_input_pointer_a11y_add_device (core_pointer);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_seat_disable_pointer_a11y (ClutterSeat *seat)
|
||||
{
|
||||
ClutterInputDevice *core_pointer;
|
||||
|
||||
core_pointer = clutter_seat_get_pointer (seat);
|
||||
|
||||
_clutter_input_pointer_a11y_remove_device (core_pointer);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_seat_set_pointer_a11y_settings:
|
||||
* @seat: a #ClutterSeat
|
||||
* @settings: a pointer to a #ClutterPointerA11ySettings
|
||||
*
|
||||
* Sets the pointer accessibility settings
|
||||
**/
|
||||
void
|
||||
clutter_seat_set_pointer_a11y_settings (ClutterSeat *seat,
|
||||
ClutterPointerA11ySettings *settings)
|
||||
{
|
||||
ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_SEAT (seat));
|
||||
|
||||
if (are_pointer_a11y_settings_equal (&priv->pointer_a11y_settings, settings))
|
||||
return;
|
||||
|
||||
if (priv->pointer_a11y_settings.controls == 0 && settings->controls != 0)
|
||||
clutter_seat_enable_pointer_a11y (seat);
|
||||
else if (priv->pointer_a11y_settings.controls != 0 && settings->controls == 0)
|
||||
clutter_seat_disable_pointer_a11y (seat);
|
||||
|
||||
priv->pointer_a11y_settings = *settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_seat_get_pointer_a11y_settings:
|
||||
* @seat: a #ClutterSeat
|
||||
* @settings: a pointer to a #ClutterPointerA11ySettings
|
||||
*
|
||||
* Gets the current pointer accessibility settings
|
||||
**/
|
||||
void
|
||||
clutter_seat_get_pointer_a11y_settings (ClutterSeat *seat,
|
||||
ClutterPointerA11ySettings *settings)
|
||||
{
|
||||
ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_SEAT (seat));
|
||||
|
||||
*settings = priv->pointer_a11y_settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_seat_set_pointer_a11y_dwell_click_type:
|
||||
* @seat: a #ClutterSeat
|
||||
* @click_type: type of click as #ClutterPointerA11yDwellClickType
|
||||
*
|
||||
* Sets the dwell click type
|
||||
**/
|
||||
void
|
||||
clutter_seat_set_pointer_a11y_dwell_click_type (ClutterSeat *seat,
|
||||
ClutterPointerA11yDwellClickType click_type)
|
||||
{
|
||||
ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_SEAT (seat));
|
||||
|
||||
priv->pointer_a11y_settings.dwell_click_type = click_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_seat_inhibit_unfocus:
|
||||
* @seat: a #ClutterSeat
|
||||
*
|
||||
* Inhibits unsetting of the pointer focus-surface for the #ClutterSeat @seat,
|
||||
* this allows to keep using the pointer even when it's hidden.
|
||||
*
|
||||
* This property is refcounted, so clutter_seat_uninhibit_unfocus() must be
|
||||
* called the exact same number of times as clutter_seat_inhibit_unfocus()
|
||||
* was called before.
|
||||
**/
|
||||
void
|
||||
clutter_seat_inhibit_unfocus (ClutterSeat *seat)
|
||||
{
|
||||
ClutterSeatPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_SEAT (seat));
|
||||
|
||||
priv = clutter_seat_get_instance_private (seat);
|
||||
|
||||
priv->inhibit_unfocus_count++;
|
||||
|
||||
if (priv->inhibit_unfocus_count == 1)
|
||||
g_signal_emit (G_OBJECT (seat), signals[IS_UNFOCUS_INHIBITED_CHANGED], 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_seat_uninhibit_unfocus:
|
||||
* @seat: a #ClutterSeat
|
||||
*
|
||||
* Disables the inhibiting of unsetting of the pointer focus-surface
|
||||
* previously enabled by calling clutter_seat_inhibit_unfocus().
|
||||
*
|
||||
* This property is refcounted, so clutter_seat_uninhibit_unfocus() must be
|
||||
* called the exact same number of times as clutter_seat_inhibit_unfocus()
|
||||
* was called before.
|
||||
**/
|
||||
void
|
||||
clutter_seat_uninhibit_unfocus (ClutterSeat *seat)
|
||||
{
|
||||
ClutterSeatPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_SEAT (seat));
|
||||
|
||||
priv = clutter_seat_get_instance_private (seat);
|
||||
|
||||
if (priv->inhibit_unfocus_count == 0)
|
||||
{
|
||||
g_warning ("Called clutter_seat_uninhibit_unfocus without inhibiting before");
|
||||
return;
|
||||
}
|
||||
|
||||
priv->inhibit_unfocus_count--;
|
||||
|
||||
if (priv->inhibit_unfocus_count == 0)
|
||||
g_signal_emit (G_OBJECT (seat), signals[IS_UNFOCUS_INHIBITED_CHANGED], 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_seat_is_unfocus_inhibited:
|
||||
* @seat: a #ClutterSeat
|
||||
*
|
||||
* Gets whether unsetting of the pointer focus-surface is inhibited
|
||||
* for the #ClutterSeat @seat.
|
||||
*
|
||||
* Returns: %TRUE if unsetting is inhibited, %FALSE otherwise
|
||||
**/
|
||||
gboolean
|
||||
clutter_seat_is_unfocus_inhibited (ClutterSeat *seat)
|
||||
{
|
||||
ClutterSeatPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_SEAT (seat), FALSE);
|
||||
|
||||
priv = clutter_seat_get_instance_private (seat);
|
||||
|
||||
return priv->inhibit_unfocus_count > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_seat_create_virtual_device:
|
||||
* @seat: a #ClutterSeat
|
||||
* @device_type: the type of the virtual device
|
||||
*
|
||||
* Creates a virtual input device.
|
||||
*
|
||||
* Returns: (transfer full): a newly created virtual device
|
||||
**/
|
||||
ClutterVirtualInputDevice *
|
||||
clutter_seat_create_virtual_device (ClutterSeat *seat,
|
||||
ClutterInputDeviceType device_type)
|
||||
{
|
||||
ClutterSeatClass *seat_class;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_SEAT (seat), NULL);
|
||||
|
||||
seat_class = CLUTTER_SEAT_GET_CLASS (seat);
|
||||
return seat_class->create_virtual_device (seat, device_type);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_seat_supported_virtual_device_types: (skip)
|
||||
*/
|
||||
ClutterVirtualDeviceType
|
||||
clutter_seat_get_supported_virtual_device_types (ClutterSeat *seat)
|
||||
{
|
||||
ClutterSeatClass *seat_class;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_SEAT (seat),
|
||||
CLUTTER_VIRTUAL_DEVICE_TYPE_NONE);
|
||||
|
||||
seat_class = CLUTTER_SEAT_GET_CLASS (seat);
|
||||
return seat_class->get_supported_virtual_device_types (seat);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_seat_compress_motion (ClutterSeat *seat,
|
||||
ClutterEvent *event,
|
||||
const ClutterEvent *to_discard)
|
||||
{
|
||||
ClutterSeatClass *seat_class;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_SEAT (seat));
|
||||
|
||||
seat_class = CLUTTER_SEAT_GET_CLASS (seat);
|
||||
|
||||
if (seat_class->compress_motion)
|
||||
seat_class->compress_motion (seat, event, to_discard);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_seat_warp_pointer (ClutterSeat *seat,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_SEAT (seat));
|
||||
|
||||
CLUTTER_SEAT_GET_CLASS (seat)->warp_pointer (seat, x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_seat_get_touch_mode:
|
||||
* @seat: a #ClutterSeat
|
||||
*
|
||||
* Gets the current touch-mode state of the #ClutterSeat @seat.
|
||||
* The #ClutterSeat:touch-mode property is set to %TRUE if the following
|
||||
* requirements are fulfilled:
|
||||
*
|
||||
* - A touchscreen is available
|
||||
* - No external keyboard is attached to the device
|
||||
* - A tablet mode switch, if present, is enabled
|
||||
*
|
||||
* Returns: %TRUE if the device is a tablet that doesn't have an external
|
||||
* keyboard attached, %FALSE otherwise.
|
||||
**/
|
||||
gboolean
|
||||
clutter_seat_get_touch_mode (ClutterSeat *seat)
|
||||
{
|
||||
gboolean touch_mode;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_SEAT (seat), FALSE);
|
||||
|
||||
g_object_get (G_OBJECT (seat), "touch-mode", &touch_mode, NULL);
|
||||
|
||||
return touch_mode;
|
||||
}
|
@ -1,190 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright (C) 2019 Red Hat Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author: Carlos Garnacho <carlosg@gnome.org>
|
||||
*/
|
||||
#ifndef CLUTTER_SEAT_H
|
||||
#define CLUTTER_SEAT_H
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "clutter/clutter-types.h"
|
||||
#include "clutter/clutter-keymap.h"
|
||||
#include "clutter/clutter-virtual-input-device.h"
|
||||
|
||||
#define CLUTTER_TYPE_SEAT (clutter_seat_get_type ())
|
||||
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_DERIVABLE_TYPE (ClutterSeat, clutter_seat,
|
||||
CLUTTER, SEAT, GObject)
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* ClutterVirtualDeviceType:
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
CLUTTER_VIRTUAL_DEVICE_TYPE_NONE = 0,
|
||||
CLUTTER_VIRTUAL_DEVICE_TYPE_KEYBOARD = 1 << 0,
|
||||
CLUTTER_VIRTUAL_DEVICE_TYPE_POINTER = 1 << 1,
|
||||
CLUTTER_VIRTUAL_DEVICE_TYPE_TOUCHSCREEN = 1 << 2,
|
||||
} ClutterVirtualDeviceType;
|
||||
|
||||
typedef struct _ClutterSeatClass ClutterSeatClass;
|
||||
|
||||
struct _ClutterSeatClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
ClutterInputDevice * (* get_pointer) (ClutterSeat *seat);
|
||||
ClutterInputDevice * (* get_keyboard) (ClutterSeat *seat);
|
||||
|
||||
GList * (* list_devices) (ClutterSeat *seat);
|
||||
|
||||
void (* bell_notify) (ClutterSeat *seat);
|
||||
|
||||
ClutterKeymap * (* get_keymap) (ClutterSeat *seat);
|
||||
|
||||
void (* compress_motion) (ClutterSeat *seat,
|
||||
ClutterEvent *event,
|
||||
const ClutterEvent *to_discard);
|
||||
|
||||
void (* warp_pointer) (ClutterSeat *seat,
|
||||
int x,
|
||||
int y);
|
||||
|
||||
/* Event platform data */
|
||||
void (* copy_event_data) (ClutterSeat *seat,
|
||||
const ClutterEvent *src,
|
||||
ClutterEvent *dest);
|
||||
void (* free_event_data) (ClutterSeat *seat,
|
||||
ClutterEvent *event);
|
||||
|
||||
/* Keyboard accessibility */
|
||||
void (* apply_kbd_a11y_settings) (ClutterSeat *seat,
|
||||
ClutterKbdA11ySettings *settings);
|
||||
|
||||
/* Virtual devices */
|
||||
ClutterVirtualInputDevice * (* create_virtual_device) (ClutterSeat *seat,
|
||||
ClutterInputDeviceType device_type);
|
||||
ClutterVirtualDeviceType (* get_supported_virtual_device_types) (ClutterSeat *seat);
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterInputDevice * clutter_seat_get_pointer (ClutterSeat *seat);
|
||||
CLUTTER_EXPORT
|
||||
ClutterInputDevice * clutter_seat_get_keyboard (ClutterSeat *seat);
|
||||
CLUTTER_EXPORT
|
||||
GList * clutter_seat_list_devices (ClutterSeat *seat);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_seat_bell_notify (ClutterSeat *seat);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterKeymap * clutter_seat_get_keymap (ClutterSeat *seat);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_seat_set_kbd_a11y_settings (ClutterSeat *seat,
|
||||
ClutterKbdA11ySettings *settings);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_seat_get_kbd_a11y_settings (ClutterSeat *seat,
|
||||
ClutterKbdA11ySettings *settings);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_seat_ensure_a11y_state (ClutterSeat *seat);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_seat_set_pointer_a11y_settings (ClutterSeat *seat,
|
||||
ClutterPointerA11ySettings *settings);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_seat_get_pointer_a11y_settings (ClutterSeat *seat,
|
||||
ClutterPointerA11ySettings *settings);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_seat_set_pointer_a11y_dwell_click_type (ClutterSeat *seat,
|
||||
ClutterPointerA11yDwellClickType click_type);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_seat_inhibit_unfocus (ClutterSeat *seat);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_seat_uninhibit_unfocus (ClutterSeat *seat);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_seat_is_unfocus_inhibited (ClutterSeat *seat);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterVirtualInputDevice *clutter_seat_create_virtual_device (ClutterSeat *seat,
|
||||
ClutterInputDeviceType device_type);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterVirtualDeviceType clutter_seat_get_supported_virtual_device_types (ClutterSeat *seat);
|
||||
|
||||
void clutter_seat_compress_motion (ClutterSeat *seat,
|
||||
ClutterEvent *event,
|
||||
const ClutterEvent *to_discard);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_seat_warp_pointer (ClutterSeat *seat,
|
||||
int x,
|
||||
int y);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_seat_get_touch_mode (ClutterSeat *seat);
|
||||
|
||||
#endif /* CLUTTER_SEAT_H */
|
@ -367,12 +367,24 @@ clutter_shader_effect_try_static_source (ClutterShaderEffect *self)
|
||||
|
||||
CLUTTER_NOTE (SHADER, "Compiling shader effect");
|
||||
|
||||
class_priv->program = cogl_create_program ();
|
||||
cogl_shader_compile (class_priv->shader);
|
||||
|
||||
cogl_program_attach_shader (class_priv->program,
|
||||
class_priv->shader);
|
||||
if (cogl_shader_is_compiled (class_priv->shader))
|
||||
{
|
||||
class_priv->program = cogl_create_program ();
|
||||
|
||||
cogl_program_link (class_priv->program);
|
||||
cogl_program_attach_shader (class_priv->program,
|
||||
class_priv->shader);
|
||||
|
||||
cogl_program_link (class_priv->program);
|
||||
}
|
||||
else
|
||||
{
|
||||
gchar *log_buf = cogl_shader_get_info_log (class_priv->shader);
|
||||
|
||||
g_warning (G_STRLOC ": Unable to compile the GLSL shader: %s", log_buf);
|
||||
g_free (log_buf);
|
||||
}
|
||||
}
|
||||
|
||||
priv->shader = cogl_object_ref (class_priv->shader);
|
||||
@ -383,8 +395,7 @@ clutter_shader_effect_try_static_source (ClutterShaderEffect *self)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_shader_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_shader_effect_paint_target (ClutterOffscreenEffect *effect)
|
||||
{
|
||||
ClutterShaderEffect *self = CLUTTER_SHADER_EFFECT (effect);
|
||||
ClutterShaderEffectPrivate *priv = self->priv;
|
||||
@ -414,7 +425,7 @@ clutter_shader_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
out:
|
||||
/* paint the offscreen buffer */
|
||||
parent = CLUTTER_OFFSCREEN_EFFECT_CLASS (clutter_shader_effect_parent_class);
|
||||
parent->paint_target (effect, paint_context);
|
||||
parent->paint_target (effect);
|
||||
|
||||
}
|
||||
|
||||
@ -890,11 +901,23 @@ clutter_shader_effect_set_shader_source (ClutterShaderEffect *effect,
|
||||
|
||||
CLUTTER_NOTE (SHADER, "Compiling shader effect");
|
||||
|
||||
priv->program = cogl_create_program ();
|
||||
cogl_shader_compile (priv->shader);
|
||||
|
||||
cogl_program_attach_shader (priv->program, priv->shader);
|
||||
if (cogl_shader_is_compiled (priv->shader))
|
||||
{
|
||||
priv->program = cogl_create_program ();
|
||||
|
||||
cogl_program_link (priv->program);
|
||||
cogl_program_attach_shader (priv->program, priv->shader);
|
||||
|
||||
cogl_program_link (priv->program);
|
||||
}
|
||||
else
|
||||
{
|
||||
gchar *log_buf = cogl_shader_get_info_log (priv->shader);
|
||||
|
||||
g_warning (G_STRLOC ": Unable to compile the GLSL shader: %s", log_buf);
|
||||
g_free (log_buf);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -44,6 +44,8 @@
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
#include "deprecated/clutter-stage-manager.h"
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
@ -181,6 +183,23 @@ clutter_stage_manager_get_default (void)
|
||||
return context->stage_manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_stage_manager_set_default_stage:
|
||||
* @stage_manager: a #ClutterStageManager
|
||||
* @stage: a #ClutterStage
|
||||
*
|
||||
* Sets @stage as the default stage.
|
||||
*
|
||||
* Since: 0.8
|
||||
*
|
||||
* Deprecated: 1.2: Calling this function has no effect
|
||||
*/
|
||||
void
|
||||
clutter_stage_manager_set_default_stage (ClutterStageManager *stage_manager,
|
||||
ClutterStage *stage)
|
||||
{
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* _clutter_stage_manager_set_default_stage:
|
||||
* @stage_manager: a #ClutterStageManager
|
||||
|
@ -36,9 +36,9 @@ typedef struct _ClutterStageQueueRedrawEntry ClutterStageQueueRedrawEntry;
|
||||
/* stage */
|
||||
ClutterStageWindow *_clutter_stage_get_default_window (void);
|
||||
|
||||
void clutter_stage_paint_view (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
const cairo_region_t *redraw_clip);
|
||||
void _clutter_stage_paint_view (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
const cairo_rectangle_int_t *clip);
|
||||
|
||||
void _clutter_stage_emit_after_paint (ClutterStage *stage);
|
||||
|
||||
@ -78,7 +78,6 @@ void _clutter_stage_schedule_update (ClutterStage *stage);
|
||||
gint64 _clutter_stage_get_update_time (ClutterStage *stage);
|
||||
void _clutter_stage_clear_update_time (ClutterStage *stage);
|
||||
gboolean _clutter_stage_has_full_redraw_queued (ClutterStage *stage);
|
||||
int64_t _clutter_stage_get_next_presentation_time (ClutterStage *stage);
|
||||
|
||||
void clutter_stage_log_pick (ClutterStage *stage,
|
||||
const graphene_point_t *vertices,
|
||||
@ -105,6 +104,8 @@ ClutterStageQueueRedrawEntry *_clutter_stage_queue_actor_redraw (Clut
|
||||
const ClutterPaintVolume *clip);
|
||||
void _clutter_stage_queue_redraw_entry_invalidate (ClutterStageQueueRedrawEntry *entry);
|
||||
|
||||
CoglFramebuffer *_clutter_stage_get_active_framebuffer (ClutterStage *stage);
|
||||
|
||||
void _clutter_stage_add_pointer_drag_actor (ClutterStage *stage,
|
||||
ClutterInputDevice *device,
|
||||
ClutterActor *actor);
|
||||
@ -142,9 +143,6 @@ void _clutter_stage_presented (ClutterStage *stag
|
||||
|
||||
GList * _clutter_stage_peek_stage_views (ClutterStage *stage);
|
||||
|
||||
void clutter_stage_queue_actor_relayout (ClutterStage *stage,
|
||||
ClutterActor *actor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_STAGE_PRIVATE_H__ */
|
||||
|
@ -20,7 +20,8 @@
|
||||
|
||||
#include "clutter/clutter-stage-view.h"
|
||||
|
||||
void clutter_stage_view_after_paint (ClutterStageView *view);
|
||||
void clutter_stage_view_blit_offscreen (ClutterStageView *view,
|
||||
const cairo_rectangle_int_t *clip);
|
||||
|
||||
gboolean clutter_stage_view_is_dirty_viewport (ClutterStageView *view);
|
||||
|
||||
@ -32,15 +33,5 @@ gboolean clutter_stage_view_is_dirty_projection (ClutterStageView *view);
|
||||
void clutter_stage_view_set_dirty_projection (ClutterStageView *view,
|
||||
gboolean dirty);
|
||||
|
||||
void clutter_stage_view_add_redraw_clip (ClutterStageView *view,
|
||||
const cairo_rectangle_int_t *clip);
|
||||
|
||||
gboolean clutter_stage_view_has_full_redraw_clip (ClutterStageView *view);
|
||||
|
||||
gboolean clutter_stage_view_has_redraw_clip (ClutterStageView *view);
|
||||
|
||||
const cairo_region_t * clutter_stage_view_peek_redraw_clip (ClutterStageView *view);
|
||||
|
||||
cairo_region_t * clutter_stage_view_take_redraw_clip (ClutterStageView *view);
|
||||
|
||||
#endif /* __CLUTTER_STAGE_VIEW_PRIVATE_H__ */
|
||||
|
@ -23,8 +23,6 @@
|
||||
#include <cairo-gobject.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "clutter/clutter-private.h"
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
@ -32,7 +30,6 @@ enum
|
||||
PROP_LAYOUT,
|
||||
PROP_FRAMEBUFFER,
|
||||
PROP_OFFSCREEN,
|
||||
PROP_SHADOWFB,
|
||||
PROP_SCALE,
|
||||
|
||||
PROP_LAST
|
||||
@ -47,13 +44,7 @@ typedef struct _ClutterStageViewPrivate
|
||||
CoglFramebuffer *framebuffer;
|
||||
|
||||
CoglOffscreen *offscreen;
|
||||
CoglPipeline *offscreen_pipeline;
|
||||
|
||||
CoglOffscreen *shadowfb;
|
||||
CoglPipeline *shadowfb_pipeline;
|
||||
|
||||
gboolean has_redraw_clip;
|
||||
cairo_region_t *redraw_clip;
|
||||
CoglPipeline *pipeline;
|
||||
|
||||
guint dirty_viewport : 1;
|
||||
guint dirty_projection : 1;
|
||||
@ -87,8 +78,6 @@ clutter_stage_view_get_framebuffer (ClutterStageView *view)
|
||||
|
||||
if (priv->offscreen)
|
||||
return priv->offscreen;
|
||||
else if (priv->shadowfb)
|
||||
return priv->shadowfb;
|
||||
else
|
||||
return priv->framebuffer;
|
||||
}
|
||||
@ -110,24 +99,6 @@ clutter_stage_view_get_onscreen (ClutterStageView *view)
|
||||
return priv->framebuffer;
|
||||
}
|
||||
|
||||
static CoglPipeline *
|
||||
clutter_stage_view_create_framebuffer_pipeline (CoglFramebuffer *framebuffer)
|
||||
{
|
||||
CoglPipeline *pipeline;
|
||||
|
||||
pipeline = cogl_pipeline_new (cogl_framebuffer_get_context (framebuffer));
|
||||
|
||||
cogl_pipeline_set_layer_filters (pipeline, 0,
|
||||
COGL_PIPELINE_FILTER_NEAREST,
|
||||
COGL_PIPELINE_FILTER_NEAREST);
|
||||
cogl_pipeline_set_layer_texture (pipeline, 0,
|
||||
cogl_offscreen_get_texture (framebuffer));
|
||||
cogl_pipeline_set_layer_wrap_mode (pipeline, 0,
|
||||
COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE);
|
||||
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_view_ensure_offscreen_blit_pipeline (ClutterStageView *view)
|
||||
{
|
||||
@ -138,27 +109,21 @@ clutter_stage_view_ensure_offscreen_blit_pipeline (ClutterStageView *view)
|
||||
|
||||
g_assert (priv->offscreen != NULL);
|
||||
|
||||
if (priv->offscreen_pipeline)
|
||||
if (priv->pipeline)
|
||||
return;
|
||||
|
||||
priv->offscreen_pipeline =
|
||||
clutter_stage_view_create_framebuffer_pipeline (priv->offscreen);
|
||||
priv->pipeline =
|
||||
cogl_pipeline_new (cogl_framebuffer_get_context (priv->offscreen));
|
||||
cogl_pipeline_set_layer_filters (priv->pipeline, 0,
|
||||
COGL_PIPELINE_FILTER_NEAREST,
|
||||
COGL_PIPELINE_FILTER_NEAREST);
|
||||
cogl_pipeline_set_layer_texture (priv->pipeline, 0,
|
||||
cogl_offscreen_get_texture (priv->offscreen));
|
||||
cogl_pipeline_set_layer_wrap_mode (priv->pipeline, 0,
|
||||
COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE);
|
||||
|
||||
if (view_class->setup_offscreen_blit_pipeline)
|
||||
view_class->setup_offscreen_blit_pipeline (view, priv->offscreen_pipeline);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_view_ensure_shadowfb_blit_pipeline (ClutterStageView *view)
|
||||
{
|
||||
ClutterStageViewPrivate *priv =
|
||||
clutter_stage_view_get_instance_private (view);
|
||||
|
||||
if (priv->shadowfb_pipeline)
|
||||
return;
|
||||
|
||||
priv->shadowfb_pipeline =
|
||||
clutter_stage_view_create_framebuffer_pipeline (priv->shadowfb);
|
||||
view_class->setup_offscreen_blit_pipeline (view, priv->pipeline);
|
||||
}
|
||||
|
||||
void
|
||||
@ -167,88 +132,48 @@ clutter_stage_view_invalidate_offscreen_blit_pipeline (ClutterStageView *view)
|
||||
ClutterStageViewPrivate *priv =
|
||||
clutter_stage_view_get_instance_private (view);
|
||||
|
||||
g_clear_pointer (&priv->offscreen_pipeline, cogl_object_unref);
|
||||
g_clear_pointer (&priv->pipeline, cogl_object_unref);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_view_copy_to_framebuffer (ClutterStageView *view,
|
||||
CoglPipeline *pipeline,
|
||||
CoglFramebuffer *src_framebuffer,
|
||||
CoglFramebuffer *dst_framebuffer,
|
||||
gboolean can_blit)
|
||||
void
|
||||
clutter_stage_view_blit_offscreen (ClutterStageView *view,
|
||||
const cairo_rectangle_int_t *rect)
|
||||
{
|
||||
ClutterStageViewPrivate *priv =
|
||||
clutter_stage_view_get_instance_private (view);
|
||||
CoglMatrix matrix;
|
||||
|
||||
/* First, try with blit */
|
||||
if (can_blit)
|
||||
clutter_stage_view_get_offscreen_transformation_matrix (view, &matrix);
|
||||
if (cogl_matrix_is_identity (&matrix))
|
||||
{
|
||||
if (cogl_blit_framebuffer (src_framebuffer,
|
||||
dst_framebuffer,
|
||||
int fb_width = cogl_framebuffer_get_width (priv->framebuffer);
|
||||
int fb_height = cogl_framebuffer_get_height (priv->framebuffer);
|
||||
|
||||
if (cogl_blit_framebuffer (priv->offscreen,
|
||||
priv->framebuffer,
|
||||
0, 0,
|
||||
0, 0,
|
||||
cogl_framebuffer_get_width (dst_framebuffer),
|
||||
cogl_framebuffer_get_height (dst_framebuffer),
|
||||
fb_width, fb_height,
|
||||
NULL))
|
||||
return;
|
||||
}
|
||||
|
||||
/* If blit fails, fallback to the slower painting method */
|
||||
cogl_framebuffer_push_matrix (dst_framebuffer);
|
||||
clutter_stage_view_ensure_offscreen_blit_pipeline (view);
|
||||
cogl_framebuffer_push_matrix (priv->framebuffer);
|
||||
|
||||
/* Set transform so 0,0 is on the top left corner and 1,1 on
|
||||
* the bottom right corner.
|
||||
*/
|
||||
cogl_matrix_init_identity (&matrix);
|
||||
cogl_matrix_translate (&matrix, -1, 1, 0);
|
||||
cogl_matrix_scale (&matrix, 2, -2, 0);
|
||||
cogl_framebuffer_set_projection_matrix (dst_framebuffer, &matrix);
|
||||
cogl_framebuffer_set_projection_matrix (priv->framebuffer, &matrix);
|
||||
|
||||
cogl_framebuffer_draw_rectangle (dst_framebuffer,
|
||||
pipeline,
|
||||
cogl_framebuffer_draw_rectangle (priv->framebuffer,
|
||||
priv->pipeline,
|
||||
0, 0, 1, 1);
|
||||
|
||||
cogl_framebuffer_pop_matrix (dst_framebuffer);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_stage_view_after_paint (ClutterStageView *view)
|
||||
{
|
||||
ClutterStageViewPrivate *priv =
|
||||
clutter_stage_view_get_instance_private (view);
|
||||
|
||||
if (priv->offscreen)
|
||||
{
|
||||
gboolean can_blit;
|
||||
CoglMatrix matrix;
|
||||
|
||||
clutter_stage_view_ensure_offscreen_blit_pipeline (view);
|
||||
clutter_stage_view_get_offscreen_transformation_matrix (view, &matrix);
|
||||
can_blit = cogl_matrix_is_identity (&matrix);
|
||||
|
||||
if (priv->shadowfb)
|
||||
{
|
||||
clutter_stage_view_copy_to_framebuffer (view,
|
||||
priv->offscreen_pipeline,
|
||||
priv->offscreen,
|
||||
priv->shadowfb,
|
||||
can_blit);
|
||||
}
|
||||
else
|
||||
{
|
||||
clutter_stage_view_copy_to_framebuffer (view,
|
||||
priv->offscreen_pipeline,
|
||||
priv->offscreen,
|
||||
priv->framebuffer,
|
||||
can_blit);
|
||||
}
|
||||
}
|
||||
|
||||
if (priv->shadowfb)
|
||||
{
|
||||
clutter_stage_view_ensure_shadowfb_blit_pipeline (view);
|
||||
clutter_stage_view_copy_to_framebuffer (view,
|
||||
priv->shadowfb_pipeline,
|
||||
priv->shadowfb,
|
||||
priv->framebuffer,
|
||||
TRUE);
|
||||
}
|
||||
cogl_framebuffer_pop_matrix (priv->framebuffer);
|
||||
}
|
||||
|
||||
float
|
||||
@ -307,86 +232,6 @@ clutter_stage_view_get_offscreen_transformation_matrix (ClutterStageView *view,
|
||||
view_class->get_offscreen_transformation_matrix (view, matrix);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_stage_view_add_redraw_clip (ClutterStageView *view,
|
||||
const cairo_rectangle_int_t *clip)
|
||||
{
|
||||
ClutterStageViewPrivate *priv =
|
||||
clutter_stage_view_get_instance_private (view);
|
||||
|
||||
if (priv->has_redraw_clip && !priv->redraw_clip)
|
||||
return;
|
||||
|
||||
if (!clip)
|
||||
{
|
||||
g_clear_pointer (&priv->redraw_clip, cairo_region_destroy);
|
||||
priv->has_redraw_clip = TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (clip->width == 0 || clip->height == 0)
|
||||
return;
|
||||
|
||||
if (!priv->redraw_clip)
|
||||
{
|
||||
if (!clutter_util_rectangle_equal (&priv->layout, clip))
|
||||
priv->redraw_clip = cairo_region_create_rectangle (clip);
|
||||
}
|
||||
else
|
||||
{
|
||||
cairo_region_union_rectangle (priv->redraw_clip, clip);
|
||||
|
||||
if (cairo_region_num_rectangles (priv->redraw_clip) == 1)
|
||||
{
|
||||
cairo_rectangle_int_t redraw_clip_extents;
|
||||
|
||||
cairo_region_get_extents (priv->redraw_clip, &redraw_clip_extents);
|
||||
if (clutter_util_rectangle_equal (&priv->layout, &redraw_clip_extents))
|
||||
g_clear_pointer (&priv->redraw_clip, cairo_region_destroy);
|
||||
}
|
||||
}
|
||||
|
||||
priv->has_redraw_clip = TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
clutter_stage_view_has_redraw_clip (ClutterStageView *view)
|
||||
{
|
||||
ClutterStageViewPrivate *priv =
|
||||
clutter_stage_view_get_instance_private (view);
|
||||
|
||||
return priv->has_redraw_clip;
|
||||
}
|
||||
|
||||
gboolean
|
||||
clutter_stage_view_has_full_redraw_clip (ClutterStageView *view)
|
||||
{
|
||||
ClutterStageViewPrivate *priv =
|
||||
clutter_stage_view_get_instance_private (view);
|
||||
|
||||
return priv->has_redraw_clip && !priv->redraw_clip;
|
||||
}
|
||||
|
||||
const cairo_region_t *
|
||||
clutter_stage_view_peek_redraw_clip (ClutterStageView *view)
|
||||
{
|
||||
ClutterStageViewPrivate *priv =
|
||||
clutter_stage_view_get_instance_private (view);
|
||||
|
||||
return priv->redraw_clip;
|
||||
}
|
||||
|
||||
cairo_region_t *
|
||||
clutter_stage_view_take_redraw_clip (ClutterStageView *view)
|
||||
{
|
||||
ClutterStageViewPrivate *priv =
|
||||
clutter_stage_view_get_instance_private (view);
|
||||
|
||||
priv->has_redraw_clip = FALSE;
|
||||
|
||||
return g_steal_pointer (&priv->redraw_clip);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_stage_view_transform_to_onscreen (ClutterStageView *view,
|
||||
gfloat *x,
|
||||
@ -428,9 +273,6 @@ clutter_stage_view_get_property (GObject *object,
|
||||
case PROP_OFFSCREEN:
|
||||
g_value_set_boxed (value, priv->offscreen);
|
||||
break;
|
||||
case PROP_SHADOWFB:
|
||||
g_value_set_boxed (value, priv->shadowfb);
|
||||
break;
|
||||
case PROP_SCALE:
|
||||
g_value_set_float (value, priv->scale);
|
||||
break;
|
||||
@ -476,9 +318,6 @@ clutter_stage_view_set_property (GObject *object,
|
||||
case PROP_OFFSCREEN:
|
||||
priv->offscreen = g_value_dup_boxed (value);
|
||||
break;
|
||||
case PROP_SHADOWFB:
|
||||
priv->shadowfb = g_value_dup_boxed (value);
|
||||
break;
|
||||
case PROP_SCALE:
|
||||
priv->scale = g_value_get_float (value);
|
||||
break;
|
||||
@ -495,11 +334,8 @@ clutter_stage_view_dispose (GObject *object)
|
||||
clutter_stage_view_get_instance_private (view);
|
||||
|
||||
g_clear_pointer (&priv->framebuffer, cogl_object_unref);
|
||||
g_clear_pointer (&priv->shadowfb, cogl_object_unref);
|
||||
g_clear_pointer (&priv->offscreen, cogl_object_unref);
|
||||
g_clear_pointer (&priv->offscreen_pipeline, cogl_object_unref);
|
||||
g_clear_pointer (&priv->shadowfb_pipeline, cogl_object_unref);
|
||||
g_clear_pointer (&priv->redraw_clip, cairo_region_destroy);
|
||||
g_clear_pointer (&priv->pipeline, cogl_object_unref);
|
||||
|
||||
G_OBJECT_CLASS (clutter_stage_view_parent_class)->dispose (object);
|
||||
}
|
||||
@ -554,15 +390,6 @@ clutter_stage_view_class_init (ClutterStageViewClass *klass)
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
obj_props[PROP_SHADOWFB] =
|
||||
g_param_spec_boxed ("shadowfb",
|
||||
"Shadow framebuffer",
|
||||
"Framebuffer used as intermediate shadow buffer",
|
||||
COGL_TYPE_HANDLE,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
obj_props[PROP_SCALE] =
|
||||
g_param_spec_float ("scale",
|
||||
"View scale",
|
||||
|
@ -178,20 +178,76 @@ _clutter_stage_window_clear_update_time (ClutterStageWindow *window)
|
||||
iface->clear_update_time (window);
|
||||
}
|
||||
|
||||
int64_t
|
||||
_clutter_stage_window_get_next_presentation_time (ClutterStageWindow *window)
|
||||
void
|
||||
_clutter_stage_window_add_redraw_clip (ClutterStageWindow *window,
|
||||
cairo_rectangle_int_t *stage_clip)
|
||||
{
|
||||
ClutterStageWindowInterface *iface;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), 0);
|
||||
g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
|
||||
|
||||
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
||||
if (iface->add_redraw_clip != NULL)
|
||||
iface->add_redraw_clip (window, stage_clip);
|
||||
}
|
||||
|
||||
/* If not implemented then just revert to the old behaviour... */
|
||||
if (iface->get_next_presentation_time == NULL)
|
||||
return _clutter_stage_window_get_update_time (window);
|
||||
/* Determines if the backend will clip the rendering of the next
|
||||
* frame.
|
||||
*
|
||||
* Note: at the start of each new frame there is an implied clip that
|
||||
* clips everything (i.e. nothing would be drawn) so this function
|
||||
* will return True at the start of a new frame if the backend
|
||||
* supports clipped redraws.
|
||||
*/
|
||||
gboolean
|
||||
_clutter_stage_window_has_redraw_clips (ClutterStageWindow *window)
|
||||
{
|
||||
ClutterStageWindowInterface *iface;
|
||||
|
||||
return iface->get_next_presentation_time (window);
|
||||
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
|
||||
|
||||
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
||||
if (iface->has_redraw_clips != NULL)
|
||||
return iface->has_redraw_clips (window);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Determines if the backend will discard any additional redraw clips
|
||||
* and instead promote them to a full stage redraw.
|
||||
*
|
||||
* The ideas is that backend may have some heuristics that cause it to
|
||||
* give up tracking redraw clips so this can be used to avoid the cost
|
||||
* of calculating a redraw clip when we know it's going to be ignored
|
||||
* anyway.
|
||||
*/
|
||||
gboolean
|
||||
_clutter_stage_window_ignoring_redraw_clips (ClutterStageWindow *window)
|
||||
{
|
||||
ClutterStageWindowInterface *iface;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
|
||||
|
||||
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
||||
if (iface->ignoring_redraw_clips != NULL)
|
||||
return iface->ignoring_redraw_clips (window);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_clutter_stage_window_get_redraw_clip_bounds (ClutterStageWindow *window,
|
||||
cairo_rectangle_int_t *stage_clip)
|
||||
{
|
||||
ClutterStageWindowInterface *iface;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
|
||||
|
||||
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
||||
if (iface->get_redraw_clip_bounds != NULL)
|
||||
return iface->get_redraw_clip_bounds (window, stage_clip);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -51,6 +51,14 @@ struct _ClutterStageWindowInterface
|
||||
gint64 (* get_update_time) (ClutterStageWindow *stage_window);
|
||||
void (* clear_update_time) (ClutterStageWindow *stage_window);
|
||||
|
||||
void (* add_redraw_clip) (ClutterStageWindow *stage_window,
|
||||
cairo_rectangle_int_t *stage_rectangle);
|
||||
gboolean (* has_redraw_clips) (ClutterStageWindow *stage_window);
|
||||
gboolean (* ignoring_redraw_clips) (ClutterStageWindow *stage_window);
|
||||
gboolean (* get_redraw_clip_bounds) (ClutterStageWindow *stage_window,
|
||||
cairo_rectangle_int_t *clip);
|
||||
|
||||
|
||||
void (* set_accept_focus) (ClutterStageWindow *stage_window,
|
||||
gboolean accept_focus);
|
||||
|
||||
@ -61,8 +69,6 @@ struct _ClutterStageWindowInterface
|
||||
GList *(* get_views) (ClutterStageWindow *stage_window);
|
||||
int64_t (* get_frame_counter) (ClutterStageWindow *stage_window);
|
||||
void (* finish_frame) (ClutterStageWindow *stage_window);
|
||||
|
||||
int64_t (* get_next_presentation_time) (ClutterStageWindow *stage_window);
|
||||
};
|
||||
|
||||
ClutterActor * _clutter_stage_window_get_wrapper (ClutterStageWindow *window);
|
||||
@ -90,6 +96,13 @@ void _clutter_stage_window_schedule_update (ClutterStageWin
|
||||
gint64 _clutter_stage_window_get_update_time (ClutterStageWindow *window);
|
||||
void _clutter_stage_window_clear_update_time (ClutterStageWindow *window);
|
||||
|
||||
void _clutter_stage_window_add_redraw_clip (ClutterStageWindow *window,
|
||||
cairo_rectangle_int_t *stage_clip);
|
||||
gboolean _clutter_stage_window_has_redraw_clips (ClutterStageWindow *window);
|
||||
gboolean _clutter_stage_window_ignoring_redraw_clips (ClutterStageWindow *window);
|
||||
gboolean _clutter_stage_window_get_redraw_clip_bounds (ClutterStageWindow *window,
|
||||
cairo_rectangle_int_t *clip);
|
||||
|
||||
void _clutter_stage_window_set_accept_focus (ClutterStageWindow *window,
|
||||
gboolean accept_focus);
|
||||
|
||||
@ -103,8 +116,6 @@ void _clutter_stage_window_finish_frame (ClutterStageWin
|
||||
|
||||
int64_t _clutter_stage_window_get_frame_counter (ClutterStageWindow *window);
|
||||
|
||||
int64_t _clutter_stage_window_get_next_presentation_time (ClutterStageWindow *window);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_STAGE_WINDOW_H__ */
|
||||
|
@ -60,17 +60,15 @@
|
||||
#include "clutter-color.h"
|
||||
#include "clutter-container.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-device-manager-private.h"
|
||||
#include "clutter-enum-types.h"
|
||||
#include "clutter-event-private.h"
|
||||
#include "clutter-id-pool.h"
|
||||
#include "clutter-input-device-private.h"
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-marshal.h"
|
||||
#include "clutter-master-clock.h"
|
||||
#include "clutter-mutter.h"
|
||||
#include "clutter-paint-context-private.h"
|
||||
#include "clutter-paint-volume-private.h"
|
||||
#include "clutter-pick-context-private.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-stage-manager-private.h"
|
||||
#include "clutter-stage-private.h"
|
||||
@ -78,6 +76,27 @@
|
||||
#include "clutter-private.h"
|
||||
|
||||
#include "cogl/cogl.h"
|
||||
#include "cogl/cogl-trace.h"
|
||||
|
||||
/* <private>
|
||||
* ClutterStageHint:
|
||||
* @CLUTTER_STAGE_NONE: No hint set
|
||||
* @CLUTTER_STAGE_NO_CLEAR_ON_PAINT: When this hint is set, the stage
|
||||
* should not clear the viewport; this flag is useful when painting
|
||||
* fully opaque actors covering the whole visible area of the stage,
|
||||
* i.e. when no blending with the stage color happens over the whole
|
||||
* stage viewport
|
||||
*
|
||||
* A series of hints that enable or disable behaviours on the stage
|
||||
*/
|
||||
typedef enum /*< prefix=CLUTTER_STAGE >*/
|
||||
{
|
||||
CLUTTER_STAGE_HINT_NONE = 0,
|
||||
|
||||
CLUTTER_STAGE_NO_CLEAR_ON_PAINT = 1 << 0
|
||||
} ClutterStageHint;
|
||||
|
||||
#define STAGE_NO_CLEAR_ON_PAINT(s) ((((ClutterStage *) (s))->priv->stage_hints & CLUTTER_STAGE_NO_CLEAR_ON_PAINT) != 0)
|
||||
|
||||
struct _ClutterStageQueueRedrawEntry
|
||||
{
|
||||
@ -115,14 +134,16 @@ struct _ClutterStagePrivate
|
||||
|
||||
GQueue *event_queue;
|
||||
|
||||
ClutterStageHint stage_hints;
|
||||
|
||||
GArray *paint_volume_stack;
|
||||
|
||||
ClutterPlane current_clip_planes[4];
|
||||
|
||||
GHashTable *pending_relayouts;
|
||||
unsigned int pending_relayouts_version;
|
||||
GList *pending_queue_redraws;
|
||||
|
||||
CoglFramebuffer *active_framebuffer;
|
||||
|
||||
gint sync_delay;
|
||||
|
||||
GTimer *fps_timer;
|
||||
@ -143,8 +164,11 @@ struct _ClutterStagePrivate
|
||||
gpointer paint_data;
|
||||
GDestroyNotify paint_notify;
|
||||
|
||||
cairo_rectangle_int_t view_clip;
|
||||
|
||||
int update_freeze_count;
|
||||
|
||||
guint relayout_pending : 1;
|
||||
guint redraw_pending : 1;
|
||||
guint is_cursor_visible : 1;
|
||||
guint throttle_motion_events : 1;
|
||||
@ -166,6 +190,7 @@ enum
|
||||
PROP_TITLE,
|
||||
PROP_USE_ALPHA,
|
||||
PROP_KEY_FOCUS,
|
||||
PROP_NO_CLEAR_HINT,
|
||||
PROP_ACCEPT_FOCUS,
|
||||
PROP_LAST
|
||||
};
|
||||
@ -441,9 +466,9 @@ is_inside_axis_aligned_rectangle (const graphene_point_t *point,
|
||||
const graphene_point_t *vertices)
|
||||
{
|
||||
float min_x = FLT_MAX;
|
||||
float max_x = -FLT_MAX;
|
||||
float max_x = FLT_MIN;
|
||||
float min_y = FLT_MAX;
|
||||
float max_y = -FLT_MAX;
|
||||
float max_y = FLT_MIN;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
@ -556,33 +581,6 @@ pick_record_contains_point (ClutterStage *stage,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_add_redraw_clip (ClutterStage *stage,
|
||||
cairo_rectangle_int_t *clip)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
for (l = _clutter_stage_peek_stage_views (stage); l; l = l->next)
|
||||
{
|
||||
ClutterStageView *view = l->data;
|
||||
|
||||
if (!clip)
|
||||
{
|
||||
clutter_stage_view_add_redraw_clip (view, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
cairo_rectangle_int_t view_layout;
|
||||
cairo_rectangle_int_t intersection;
|
||||
|
||||
clutter_stage_view_get_layout (view, &view_layout);
|
||||
if (_clutter_util_rectangle_intersection (&view_layout, clip,
|
||||
&intersection))
|
||||
clutter_stage_view_add_redraw_clip (view, &intersection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
queue_full_redraw (ClutterStage *stage)
|
||||
{
|
||||
@ -601,7 +599,7 @@ queue_full_redraw (ClutterStage *stage)
|
||||
if (stage_window == NULL)
|
||||
return;
|
||||
|
||||
clutter_stage_add_redraw_clip (stage, NULL);
|
||||
_clutter_stage_window_add_redraw_clip (stage_window, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -721,6 +719,17 @@ clutter_stage_allocate (ClutterActor *self,
|
||||
flags | CLUTTER_DELEGATE_LAYOUT);
|
||||
}
|
||||
|
||||
/* XXX: Until Cogl becomes fully responsible for backend windows
|
||||
* Clutter need to manually keep it informed of the current window
|
||||
* size. We do this after the allocation above so that the stage
|
||||
* window has a chance to update the window size based on the
|
||||
* allocation.
|
||||
*/
|
||||
_clutter_stage_window_get_geometry (priv->impl, &window_size);
|
||||
|
||||
cogl_onscreen_clutter_backend_set_size (window_size.width,
|
||||
window_size.height);
|
||||
|
||||
/* reset the viewport if the allocation effectively changed */
|
||||
clutter_actor_get_allocation_box (self, &alloc);
|
||||
clutter_actor_box_get_size (&alloc, &new_width, &new_height);
|
||||
@ -863,17 +872,32 @@ _cogl_util_get_eye_planes_for_screen_poly (float *polygon,
|
||||
graphene_vec3_normalize (&plane->n, &plane->n);
|
||||
}
|
||||
|
||||
static void
|
||||
_clutter_stage_update_active_framebuffer (ClutterStage *stage,
|
||||
CoglFramebuffer *framebuffer)
|
||||
{
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
|
||||
/* We track the CoglFramebuffer that corresponds to the stage itself
|
||||
* so, for example, we can disable culling when rendering to an
|
||||
* offscreen framebuffer.
|
||||
*/
|
||||
|
||||
priv->active_framebuffer = framebuffer;
|
||||
}
|
||||
|
||||
/* XXX: Instead of having a toplevel 2D clip region, it might be
|
||||
* better to have a clip volume within the view frustum. This could
|
||||
* allow us to avoid projecting actors into window coordinates to
|
||||
* be able to cull them.
|
||||
*/
|
||||
static void
|
||||
setup_view_for_pick_or_paint (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
const cairo_rectangle_int_t *clip)
|
||||
clutter_stage_do_paint_view (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
const cairo_rectangle_int_t *clip)
|
||||
{
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
CoglFramebuffer *framebuffer = clutter_stage_view_get_framebuffer (view);
|
||||
cairo_rectangle_int_t view_layout;
|
||||
float clip_poly[8];
|
||||
float viewport[4];
|
||||
@ -924,32 +948,17 @@ setup_view_for_pick_or_paint (ClutterStage *stage,
|
||||
priv->current_clip_planes);
|
||||
|
||||
_clutter_stage_paint_volume_stack_free_all (stage);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_do_paint_view (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
const cairo_region_t *redraw_clip)
|
||||
{
|
||||
ClutterPaintContext *paint_context;
|
||||
cairo_rectangle_int_t clip_rect;
|
||||
|
||||
paint_context = clutter_paint_context_new_for_view (view, redraw_clip);
|
||||
|
||||
cairo_region_get_extents (redraw_clip, &clip_rect);
|
||||
setup_view_for_pick_or_paint (stage, view, &clip_rect);
|
||||
|
||||
clutter_actor_paint (CLUTTER_ACTOR (stage), paint_context);
|
||||
clutter_paint_context_destroy (paint_context);
|
||||
_clutter_stage_update_active_framebuffer (stage, framebuffer);
|
||||
clutter_actor_paint (CLUTTER_ACTOR (stage));
|
||||
}
|
||||
|
||||
/* This provides a common point of entry for painting the scenegraph
|
||||
* for picking or painting...
|
||||
*/
|
||||
void
|
||||
clutter_stage_paint_view (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
const cairo_region_t *redraw_clip)
|
||||
_clutter_stage_paint_view (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
const cairo_rectangle_int_t *clip)
|
||||
{
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
|
||||
@ -958,11 +967,15 @@ clutter_stage_paint_view (ClutterStage *stage,
|
||||
|
||||
COGL_TRACE_BEGIN_SCOPED (ClutterStagePaintView, "Paint (view)");
|
||||
|
||||
priv->view_clip = *clip;
|
||||
|
||||
if (g_signal_has_handler_pending (stage, stage_signals[PAINT_VIEW],
|
||||
0, TRUE))
|
||||
g_signal_emit (stage, stage_signals[PAINT_VIEW], 0, view, redraw_clip);
|
||||
g_signal_emit (stage, stage_signals[PAINT_VIEW], 0, view);
|
||||
else
|
||||
CLUTTER_STAGE_GET_CLASS (stage)->paint_view (stage, view, redraw_clip);
|
||||
CLUTTER_STAGE_GET_CLASS (stage)->paint_view (stage, view);
|
||||
|
||||
priv->view_clip = (cairo_rectangle_int_t) { 0 };
|
||||
}
|
||||
|
||||
void
|
||||
@ -976,20 +989,18 @@ _clutter_stage_emit_after_paint (ClutterStage *stage)
|
||||
* respect the Z order as it uses our empty sort_depth_order.
|
||||
*/
|
||||
static void
|
||||
clutter_stage_paint (ClutterActor *self,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_stage_paint (ClutterActor *self)
|
||||
{
|
||||
ClutterActorIter iter;
|
||||
ClutterActor *child;
|
||||
|
||||
clutter_actor_iter_init (&iter, self);
|
||||
while (clutter_actor_iter_next (&iter, &child))
|
||||
clutter_actor_paint (child, paint_context);
|
||||
clutter_actor_paint (child);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_pick (ClutterActor *self,
|
||||
ClutterPickContext *pick_context)
|
||||
clutter_stage_pick (ClutterActor *self)
|
||||
{
|
||||
ClutterActorIter iter;
|
||||
ClutterActor *child;
|
||||
@ -1000,7 +1011,7 @@ clutter_stage_pick (ClutterActor *self,
|
||||
*/
|
||||
clutter_actor_iter_init (&iter, self);
|
||||
while (clutter_actor_iter_next (&iter, &child))
|
||||
clutter_actor_pick (child, pick_context);
|
||||
clutter_actor_paint (child);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -1263,9 +1274,11 @@ _clutter_stage_process_queued_events (ClutterStage *stage)
|
||||
|
||||
if (next_event->type == CLUTTER_MOTION)
|
||||
{
|
||||
ClutterSeat *seat = clutter_input_device_get_seat (device);
|
||||
ClutterDeviceManager *device_manager =
|
||||
clutter_device_manager_get_default ();
|
||||
|
||||
clutter_seat_compress_motion (seat, next_event, event);
|
||||
_clutter_device_manager_compress_motion (device_manager,
|
||||
next_event, event);
|
||||
}
|
||||
|
||||
goto next_event;
|
||||
@ -1311,20 +1324,7 @@ _clutter_stage_needs_update (ClutterStage *stage)
|
||||
|
||||
priv = stage->priv;
|
||||
|
||||
return priv->redraw_pending || g_hash_table_size (priv->pending_relayouts) > 0;
|
||||
}
|
||||
|
||||
void
|
||||
clutter_stage_queue_actor_relayout (ClutterStage *stage,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
|
||||
if (g_hash_table_size (priv->pending_relayouts) == 0)
|
||||
_clutter_stage_schedule_update (stage);
|
||||
|
||||
g_hash_table_add (priv->pending_relayouts, g_object_ref (actor));
|
||||
priv->pending_relayouts_version++;
|
||||
return priv->relayout_pending || priv->redraw_pending;
|
||||
}
|
||||
|
||||
void
|
||||
@ -1332,58 +1332,41 @@ _clutter_stage_maybe_relayout (ClutterActor *actor)
|
||||
{
|
||||
ClutterStage *stage = CLUTTER_STAGE (actor);
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
GHashTableIter iter;
|
||||
gpointer key;
|
||||
int count = 0;
|
||||
gfloat natural_width, natural_height;
|
||||
ClutterActorBox box = { 0, };
|
||||
|
||||
/* No work to do? Avoid the extraneous debug log messages too. */
|
||||
if (g_hash_table_size (priv->pending_relayouts) == 0)
|
||||
if (!priv->relayout_pending)
|
||||
return;
|
||||
|
||||
CLUTTER_NOTE (ACTOR, ">>> Recomputing layout");
|
||||
|
||||
g_hash_table_iter_init (&iter, priv->pending_relayouts);
|
||||
while (g_hash_table_iter_next (&iter, &key, NULL))
|
||||
/* avoid reentrancy */
|
||||
if (!CLUTTER_ACTOR_IN_RELAYOUT (stage))
|
||||
{
|
||||
g_autoptr (ClutterActor) queued_actor = key;
|
||||
unsigned int old_version;
|
||||
priv->relayout_pending = FALSE;
|
||||
priv->stage_was_relayout = TRUE;
|
||||
|
||||
g_hash_table_iter_steal (&iter);
|
||||
priv->pending_relayouts_version++;
|
||||
CLUTTER_NOTE (ACTOR, "Recomputing layout");
|
||||
|
||||
if (CLUTTER_ACTOR_IN_RELAYOUT (queued_actor)) /* avoid reentrancy */
|
||||
continue;
|
||||
CLUTTER_SET_PRIVATE_FLAGS (stage, CLUTTER_IN_RELAYOUT);
|
||||
|
||||
/* An actor may have been destroyed or hidden between queuing and now */
|
||||
if (clutter_actor_get_stage (queued_actor) != actor)
|
||||
continue;
|
||||
natural_width = natural_height = 0;
|
||||
clutter_actor_get_preferred_size (CLUTTER_ACTOR (stage),
|
||||
NULL, NULL,
|
||||
&natural_width, &natural_height);
|
||||
|
||||
if (queued_actor == actor)
|
||||
CLUTTER_NOTE (ACTOR, " Deep relayout of stage %s",
|
||||
_clutter_actor_get_debug_name (queued_actor));
|
||||
else
|
||||
CLUTTER_NOTE (ACTOR, " Shallow relayout of actor %s",
|
||||
_clutter_actor_get_debug_name (queued_actor));
|
||||
box.x1 = 0;
|
||||
box.y1 = 0;
|
||||
box.x2 = natural_width;
|
||||
box.y2 = natural_height;
|
||||
|
||||
CLUTTER_SET_PRIVATE_FLAGS (queued_actor, CLUTTER_IN_RELAYOUT);
|
||||
CLUTTER_NOTE (ACTOR, "Allocating (0, 0 - %d, %d) for the stage",
|
||||
(int) natural_width,
|
||||
(int) natural_height);
|
||||
|
||||
old_version = priv->pending_relayouts_version;
|
||||
clutter_actor_allocate_preferred_size (queued_actor,
|
||||
CLUTTER_ALLOCATION_NONE);
|
||||
clutter_actor_allocate (CLUTTER_ACTOR (stage),
|
||||
&box, CLUTTER_ALLOCATION_NONE);
|
||||
|
||||
CLUTTER_UNSET_PRIVATE_FLAGS (queued_actor, CLUTTER_IN_RELAYOUT);
|
||||
|
||||
count++;
|
||||
|
||||
/* Prevent using an iterator that's been invalidated */
|
||||
if (old_version != priv->pending_relayouts_version)
|
||||
g_hash_table_iter_init (&iter, priv->pending_relayouts);
|
||||
CLUTTER_UNSET_PRIVATE_FLAGS (stage, CLUTTER_IN_RELAYOUT);
|
||||
}
|
||||
|
||||
CLUTTER_NOTE (ACTOR, "<<< Completed recomputing layout of %d subtrees", count);
|
||||
|
||||
if (count)
|
||||
priv->stage_was_relayout = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1433,21 +1416,22 @@ clutter_stage_do_redraw (ClutterStage *stage)
|
||||
static GSList *
|
||||
_clutter_stage_check_updated_pointers (ClutterStage *stage)
|
||||
{
|
||||
ClutterBackend *backend;
|
||||
ClutterSeat *seat;
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
ClutterDeviceManager *device_manager;
|
||||
GSList *updating = NULL;
|
||||
GList *l, *devices;
|
||||
const GSList *devices;
|
||||
cairo_rectangle_int_t clip;
|
||||
graphene_point_t point;
|
||||
gboolean has_clip;
|
||||
|
||||
backend = clutter_get_default_backend ();
|
||||
seat = clutter_backend_get_default_seat (backend);
|
||||
devices = clutter_seat_list_devices (seat);
|
||||
has_clip = _clutter_stage_window_get_redraw_clip_bounds (priv->impl, &clip);
|
||||
|
||||
for (l = devices; l; l = l->next)
|
||||
device_manager = clutter_device_manager_get_default ();
|
||||
devices = clutter_device_manager_peek_devices (device_manager);
|
||||
|
||||
for (; devices != NULL; devices = devices->next)
|
||||
{
|
||||
ClutterInputDevice *dev = l->data;
|
||||
ClutterStageView *view;
|
||||
const cairo_region_t *clip;
|
||||
ClutterInputDevice *dev = devices->data;
|
||||
|
||||
if (clutter_input_device_get_device_mode (dev) !=
|
||||
CLUTTER_INPUT_MODE_MASTER)
|
||||
@ -1463,12 +1447,9 @@ _clutter_stage_check_updated_pointers (ClutterStage *stage)
|
||||
if (!clutter_input_device_get_coords (dev, NULL, &point))
|
||||
continue;
|
||||
|
||||
view = clutter_stage_get_view_at (stage, point.x, point.y);
|
||||
if (!view)
|
||||
continue;
|
||||
|
||||
clip = clutter_stage_view_peek_redraw_clip (view);
|
||||
if (!clip || cairo_region_contains_point (clip, point.x, point.y))
|
||||
if (!has_clip ||
|
||||
(point.x >= clip.x && point.x < clip.x + clip.width &&
|
||||
point.y >= clip.y && point.y < clip.y + clip.height))
|
||||
updating = g_slist_prepend (updating, dev);
|
||||
break;
|
||||
default:
|
||||
@ -1481,8 +1462,6 @@ _clutter_stage_check_updated_pointers (ClutterStage *stage)
|
||||
}
|
||||
}
|
||||
|
||||
g_list_free (devices);
|
||||
|
||||
return updating;
|
||||
}
|
||||
|
||||
@ -1555,7 +1534,7 @@ _clutter_stage_do_update (ClutterStage *stage)
|
||||
|
||||
while (pointers)
|
||||
{
|
||||
clutter_input_device_update (pointers->data, NULL, TRUE);
|
||||
_clutter_input_device_update (pointers->data, NULL, TRUE);
|
||||
pointers = g_slist_delete_link (pointers, pointers);
|
||||
}
|
||||
|
||||
@ -1568,31 +1547,20 @@ static void
|
||||
clutter_stage_real_queue_relayout (ClutterActor *self)
|
||||
{
|
||||
ClutterStage *stage = CLUTTER_STAGE (self);
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
ClutterActorClass *parent_class;
|
||||
|
||||
clutter_stage_queue_actor_relayout (stage, self);
|
||||
if (!priv->relayout_pending)
|
||||
{
|
||||
_clutter_stage_schedule_update (stage);
|
||||
priv->relayout_pending = TRUE;
|
||||
}
|
||||
|
||||
/* chain up */
|
||||
parent_class = CLUTTER_ACTOR_CLASS (clutter_stage_parent_class);
|
||||
parent_class->queue_relayout (self);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_full_stage_redraw_queued (ClutterStage *stage)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
for (l = _clutter_stage_peek_stage_views (stage); l; l = l->next)
|
||||
{
|
||||
ClutterStageView *view = l->data;
|
||||
|
||||
if (!clutter_stage_view_has_full_redraw_clip (view))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_stage_real_queue_redraw (ClutterActor *actor,
|
||||
ClutterActor *leaf,
|
||||
@ -1614,12 +1582,12 @@ clutter_stage_real_queue_redraw (ClutterActor *actor,
|
||||
if (stage_window == NULL)
|
||||
return TRUE;
|
||||
|
||||
if (is_full_stage_redraw_queued (stage))
|
||||
if (_clutter_stage_window_ignoring_redraw_clips (stage_window))
|
||||
return FALSE;
|
||||
|
||||
if (redraw_clip == NULL)
|
||||
{
|
||||
clutter_stage_add_redraw_clip (stage, NULL);
|
||||
_clutter_stage_window_add_redraw_clip (stage_window, NULL);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -1651,20 +1619,58 @@ clutter_stage_real_queue_redraw (ClutterActor *actor,
|
||||
stage_clip.width = intersection_box.x2 - stage_clip.x;
|
||||
stage_clip.height = intersection_box.y2 - stage_clip.y;
|
||||
|
||||
clutter_stage_add_redraw_clip (stage, &stage_clip);
|
||||
_clutter_stage_window_add_redraw_clip (stage_window, &stage_clip);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_clutter_stage_has_full_redraw_queued (ClutterStage *stage)
|
||||
{
|
||||
if (CLUTTER_ACTOR_IN_DESTRUCTION (stage))
|
||||
ClutterStageWindow *stage_window = _clutter_stage_get_window (stage);
|
||||
|
||||
if (CLUTTER_ACTOR_IN_DESTRUCTION (stage) || stage_window == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!stage->priv->redraw_pending)
|
||||
if (stage->priv->redraw_pending &&
|
||||
!_clutter_stage_window_has_redraw_clips (stage_window))
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return is_full_stage_redraw_queued (stage);
|
||||
/**
|
||||
* clutter_stage_get_redraw_clip_bounds:
|
||||
* @stage: A #ClutterStage
|
||||
* @clip: (out caller-allocates): Return location for the clip bounds
|
||||
*
|
||||
* Gets the bounds of the current redraw for @stage in stage pixel
|
||||
* coordinates. E.g., if only a single actor has queued a redraw then
|
||||
* Clutter may redraw the stage with a clip so that it doesn't have to
|
||||
* paint every pixel in the stage. This function would then return the
|
||||
* bounds of that clip. An application can use this information to
|
||||
* avoid some extra work if it knows that some regions of the stage
|
||||
* aren't going to be painted. This should only be called while the
|
||||
* stage is being painted. If there is no current redraw clip then
|
||||
* this function will set @clip to the full extents of the stage.
|
||||
*
|
||||
* Since: 1.8
|
||||
*/
|
||||
void
|
||||
clutter_stage_get_redraw_clip_bounds (ClutterStage *stage,
|
||||
cairo_rectangle_int_t *clip)
|
||||
{
|
||||
ClutterStagePrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
||||
g_return_if_fail (clip != NULL);
|
||||
|
||||
priv = stage->priv;
|
||||
|
||||
if (!_clutter_stage_window_get_redraw_clip_bounds (priv->impl, clip))
|
||||
{
|
||||
/* Set clip to the full extents of the stage */
|
||||
_clutter_stage_window_get_geometry (priv->impl, clip);
|
||||
}
|
||||
}
|
||||
|
||||
static ClutterActor *
|
||||
@ -1676,25 +1682,23 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
|
||||
{
|
||||
ClutterMainContext *context = _clutter_context_get_default ();
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
CoglFramebuffer *fb = clutter_stage_view_get_framebuffer (view);
|
||||
int i;
|
||||
|
||||
g_assert (context->pick_mode == CLUTTER_PICK_NONE);
|
||||
|
||||
if (mode != priv->cached_pick_mode)
|
||||
{
|
||||
ClutterPickContext *pick_context;
|
||||
|
||||
_clutter_stage_clear_pick_stack (stage);
|
||||
|
||||
pick_context = clutter_pick_context_new_for_view (view);
|
||||
cogl_push_framebuffer (fb);
|
||||
|
||||
context->pick_mode = mode;
|
||||
setup_view_for_pick_or_paint (stage, view, NULL);
|
||||
clutter_actor_pick (CLUTTER_ACTOR (stage), pick_context);
|
||||
clutter_stage_do_paint_view (stage, view, NULL);
|
||||
context->pick_mode = CLUTTER_PICK_NONE;
|
||||
priv->cached_pick_mode = mode;
|
||||
|
||||
clutter_pick_context_destroy (pick_context);
|
||||
cogl_pop_framebuffer ();
|
||||
|
||||
add_pick_stack_weak_refs (stage);
|
||||
}
|
||||
@ -1869,6 +1873,10 @@ clutter_stage_set_property (GObject *object,
|
||||
clutter_stage_set_key_focus (stage, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
case PROP_NO_CLEAR_HINT:
|
||||
clutter_stage_set_no_clear_hint (stage, g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
case PROP_ACCEPT_FOCUS:
|
||||
clutter_stage_set_accept_focus (stage, g_value_get_boolean (value));
|
||||
break;
|
||||
@ -1919,6 +1927,15 @@ clutter_stage_get_property (GObject *gobject,
|
||||
g_value_set_object (value, priv->key_focused_actor);
|
||||
break;
|
||||
|
||||
case PROP_NO_CLEAR_HINT:
|
||||
{
|
||||
gboolean hint =
|
||||
(priv->stage_hints & CLUTTER_STAGE_NO_CLEAR_ON_PAINT) != 0;
|
||||
|
||||
g_value_set_boolean (value, hint);
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_ACCEPT_FOCUS:
|
||||
g_value_set_boolean (value, priv->accept_focus);
|
||||
break;
|
||||
@ -1957,8 +1974,6 @@ clutter_stage_dispose (GObject *object)
|
||||
(GDestroyNotify) free_queue_redraw_entry);
|
||||
priv->pending_queue_redraws = NULL;
|
||||
|
||||
g_clear_pointer (&priv->pending_relayouts, g_hash_table_destroy);
|
||||
|
||||
/* this will release the reference on the stage */
|
||||
stage_manager = clutter_stage_manager_get_default ();
|
||||
_clutter_stage_manager_remove_stage (stage_manager, stage);
|
||||
@ -1993,11 +2008,13 @@ clutter_stage_finalize (GObject *object)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_real_paint_view (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
const cairo_region_t *redraw_clip)
|
||||
clutter_stage_real_paint_view (ClutterStage *stage,
|
||||
ClutterStageView *view)
|
||||
{
|
||||
clutter_stage_do_paint_view (stage, view, redraw_clip);
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
const cairo_rectangle_int_t *clip = &priv->view_clip;
|
||||
|
||||
clutter_stage_do_paint_view (stage, view, clip);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2121,6 +2138,23 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
||||
CLUTTER_TYPE_ACTOR,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
/**
|
||||
* ClutterStage:no-clear-hint:
|
||||
*
|
||||
* Whether or not the #ClutterStage should clear its contents
|
||||
* before each paint cycle.
|
||||
*
|
||||
* See clutter_stage_set_no_clear_hint() for further information.
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
obj_props[PROP_NO_CLEAR_HINT] =
|
||||
g_param_spec_boolean ("no-clear-hint",
|
||||
P_("No Clear Hint"),
|
||||
P_("Whether the stage should clear its contents"),
|
||||
FALSE,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
|
||||
/**
|
||||
* ClutterStage:accept-focus:
|
||||
*
|
||||
@ -2204,7 +2238,6 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
||||
/**
|
||||
* ClutterStage::after-paint:
|
||||
* @stage: the stage that received the event
|
||||
* @paint_Context: the paint context
|
||||
*
|
||||
* The ::after-paint signal is emitted after the stage is painted,
|
||||
* but before the results are displayed on the screen.
|
||||
@ -2223,7 +2256,6 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
||||
* ClutterStage::paint-view:
|
||||
* @stage: the stage that received the event
|
||||
* @view: a #ClutterStageView
|
||||
* @redraw_clip: a #cairo_region_t with the redraw clip
|
||||
*
|
||||
* The ::paint-view signal is emitted before a #ClutterStageView is being
|
||||
* painted.
|
||||
@ -2238,9 +2270,8 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ClutterStageClass, paint_view),
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 2,
|
||||
CLUTTER_TYPE_STAGE_VIEW,
|
||||
G_TYPE_POINTER);
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_STAGE_VIEW);
|
||||
|
||||
/**
|
||||
* ClutterStage::presented: (skip)
|
||||
@ -2318,11 +2349,7 @@ clutter_stage_init (ClutterStage *self)
|
||||
clutter_actor_set_background_color (CLUTTER_ACTOR (self),
|
||||
&default_stage_color);
|
||||
|
||||
priv->pending_relayouts = g_hash_table_new_full (NULL,
|
||||
NULL,
|
||||
g_object_unref,
|
||||
NULL);
|
||||
clutter_stage_queue_actor_relayout (self, CLUTTER_ACTOR (self));
|
||||
priv->relayout_pending = TRUE;
|
||||
|
||||
clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE);
|
||||
clutter_stage_set_title (self, g_get_prgname ());
|
||||
@ -2816,17 +2843,14 @@ clutter_stage_read_pixels (ClutterStage *stage,
|
||||
.height = height,
|
||||
});
|
||||
cairo_region_get_extents (clip, &clip_rect);
|
||||
cairo_region_destroy (clip);
|
||||
|
||||
if (clip_rect.width == 0 || clip_rect.height == 0)
|
||||
{
|
||||
cairo_region_destroy (clip);
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
|
||||
framebuffer = clutter_stage_view_get_framebuffer (view);
|
||||
clutter_stage_do_paint_view (stage, view, clip);
|
||||
|
||||
cairo_region_destroy (clip);
|
||||
cogl_push_framebuffer (framebuffer);
|
||||
clutter_stage_do_paint_view (stage, view, &clip_rect);
|
||||
|
||||
view_scale = clutter_stage_view_get_scale (view);
|
||||
pixel_width = roundf (clip_rect.width * view_scale);
|
||||
@ -2840,6 +2864,8 @@ clutter_stage_read_pixels (ClutterStage *stage,
|
||||
COGL_PIXEL_FORMAT_RGBA_8888,
|
||||
pixels);
|
||||
|
||||
cogl_pop_framebuffer ();
|
||||
|
||||
return pixels;
|
||||
}
|
||||
|
||||
@ -3401,9 +3427,10 @@ clutter_stage_ensure_redraw (ClutterStage *stage)
|
||||
|
||||
priv = stage->priv;
|
||||
|
||||
if (!_clutter_stage_needs_update (stage))
|
||||
if (!priv->relayout_pending && !priv->redraw_pending)
|
||||
_clutter_stage_schedule_update (stage);
|
||||
|
||||
priv->relayout_pending = TRUE;
|
||||
priv->redraw_pending = TRUE;
|
||||
|
||||
master_clock = _clutter_master_clock_get_default ();
|
||||
@ -3745,19 +3772,70 @@ _clutter_stage_clear_update_time (ClutterStage *stage)
|
||||
_clutter_stage_window_clear_update_time (stage_window);
|
||||
}
|
||||
|
||||
int64_t
|
||||
_clutter_stage_get_next_presentation_time (ClutterStage *stage)
|
||||
/**
|
||||
* clutter_stage_set_no_clear_hint:
|
||||
* @stage: a #ClutterStage
|
||||
* @no_clear: %TRUE if the @stage should not clear itself on every
|
||||
* repaint cycle
|
||||
*
|
||||
* Sets whether the @stage should clear itself at the beginning
|
||||
* of each paint cycle or not.
|
||||
*
|
||||
* Clearing the #ClutterStage can be a costly operation, especially
|
||||
* if the stage is always covered - for instance, in a full-screen
|
||||
* video player or in a game with a background texture.
|
||||
*
|
||||
* This setting is a hint; Clutter might discard this hint
|
||||
* depending on its internal state.
|
||||
*
|
||||
* If parts of the stage are visible and you disable clearing you
|
||||
* might end up with visual artifacts while painting the contents of
|
||||
* the stage.
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
void
|
||||
clutter_stage_set_no_clear_hint (ClutterStage *stage,
|
||||
gboolean no_clear)
|
||||
{
|
||||
ClutterStageWindow *stage_window;
|
||||
ClutterStagePrivate *priv;
|
||||
ClutterStageHint new_hints;
|
||||
|
||||
if (CLUTTER_ACTOR_IN_DESTRUCTION (stage))
|
||||
return 0;
|
||||
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
||||
|
||||
stage_window = _clutter_stage_get_window (stage);
|
||||
if (stage_window == NULL)
|
||||
return 0;
|
||||
priv = stage->priv;
|
||||
new_hints = priv->stage_hints;
|
||||
|
||||
return _clutter_stage_window_get_next_presentation_time (stage_window);
|
||||
if (no_clear)
|
||||
new_hints |= CLUTTER_STAGE_NO_CLEAR_ON_PAINT;
|
||||
else
|
||||
new_hints &= ~CLUTTER_STAGE_NO_CLEAR_ON_PAINT;
|
||||
|
||||
if (priv->stage_hints == new_hints)
|
||||
return;
|
||||
|
||||
priv->stage_hints = new_hints;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (stage), obj_props[PROP_NO_CLEAR_HINT]);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_stage_get_no_clear_hint:
|
||||
* @stage: a #ClutterStage
|
||||
*
|
||||
* Retrieves the hint set with clutter_stage_set_no_clear_hint()
|
||||
*
|
||||
* Return value: %TRUE if the stage should not clear itself on every paint
|
||||
* cycle, and %FALSE otherwise
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
gboolean
|
||||
clutter_stage_get_no_clear_hint (ClutterStage *stage)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
|
||||
|
||||
return (stage->priv->stage_hints & CLUTTER_STAGE_NO_CLEAR_ON_PAINT) != 0;
|
||||
}
|
||||
|
||||
ClutterPaintVolume *
|
||||
@ -4073,6 +4151,18 @@ clutter_stage_get_motion_events_enabled (ClutterStage *stage)
|
||||
return stage->priv->motion_events_enabled;
|
||||
}
|
||||
|
||||
/* NB: The presumption shouldn't be that a stage can't be comprised
|
||||
* of multiple internal framebuffers, so instead of simply naming
|
||||
* this function _clutter_stage_get_framebuffer(), the "active"
|
||||
* infix is intended to clarify that it gets the framebuffer that
|
||||
* is currently in use/being painted.
|
||||
*/
|
||||
CoglFramebuffer *
|
||||
_clutter_stage_get_active_framebuffer (ClutterStage *stage)
|
||||
{
|
||||
return stage->priv->active_framebuffer;
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_stage_add_pointer_drag_actor (ClutterStage *stage,
|
||||
ClutterInputDevice *device,
|
||||
@ -4348,6 +4438,7 @@ capture_view (ClutterStage *stage,
|
||||
texture_width, texture_height);
|
||||
cairo_surface_set_device_scale (image, view_scale, view_scale);
|
||||
|
||||
|
||||
data = cairo_image_surface_get_data (image);
|
||||
stride = cairo_image_surface_get_stride (image);
|
||||
|
||||
@ -4357,20 +4448,6 @@ capture_view (ClutterStage *stage,
|
||||
cairo_surface_mark_dirty (capture->image);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_stage_capture:
|
||||
* @stage: a #ClutterStage
|
||||
* @paint: whether to pain the frame
|
||||
* @rect: a #cairo_rectangle_int_t in stage coordinates
|
||||
* @out_captures: (out) (array length=out_n_captures): an array of
|
||||
* #ClutterCapture
|
||||
* @out_n_captures: (out): the number of captures in @out_captures
|
||||
*
|
||||
* Captures the stage pixels of @rect into @captures. @rect is in stage
|
||||
* coordinates.
|
||||
*
|
||||
* Returns: %TRUE if a #ClutterCapture has been created, %FALSE otherwise
|
||||
*/
|
||||
gboolean
|
||||
clutter_stage_capture (ClutterStage *stage,
|
||||
gboolean paint,
|
||||
@ -4495,12 +4572,9 @@ capture_view_into (ClutterStage *stage,
|
||||
|
||||
if (paint)
|
||||
{
|
||||
cairo_region_t *region;
|
||||
|
||||
cogl_push_framebuffer (framebuffer);
|
||||
_clutter_stage_maybe_setup_viewport (stage, view);
|
||||
region = cairo_region_create_rectangle (rect);
|
||||
clutter_stage_do_paint_view (stage, view, region);
|
||||
cairo_region_destroy (region);
|
||||
clutter_stage_do_paint_view (stage, view, rect);
|
||||
}
|
||||
|
||||
view_scale = clutter_stage_view_get_scale (view);
|
||||
@ -4523,45 +4597,55 @@ capture_view_into (ClutterStage *stage,
|
||||
COGL_READ_PIXELS_COLOR_BUFFER,
|
||||
bitmap);
|
||||
|
||||
if (paint)
|
||||
cogl_pop_framebuffer ();
|
||||
|
||||
cogl_object_unref (bitmap);
|
||||
}
|
||||
|
||||
static ClutterStageView *
|
||||
get_view_at_rect (ClutterStage *stage,
|
||||
cairo_rectangle_int_t *rect)
|
||||
{
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
GList *views = _clutter_stage_window_get_views (priv->impl);
|
||||
GList *l;
|
||||
|
||||
for (l = views; l; l = l->next)
|
||||
{
|
||||
ClutterStageView *view = l->data;
|
||||
cairo_rectangle_int_t view_layout;
|
||||
cairo_region_t *region;
|
||||
cairo_rectangle_int_t view_capture_rect;
|
||||
|
||||
clutter_stage_view_get_layout (view, &view_layout);
|
||||
region = cairo_region_create_rectangle (&view_layout);
|
||||
cairo_region_intersect_rectangle (region, rect);
|
||||
cairo_region_get_extents (region, &view_capture_rect);
|
||||
cairo_region_destroy (region);
|
||||
|
||||
if (view_capture_rect.width == 0 || view_capture_rect.height == 0)
|
||||
continue;
|
||||
|
||||
g_assert (view_capture_rect.width == rect->width &&
|
||||
view_capture_rect.height == rect->height);
|
||||
return view;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
clutter_stage_capture_into (ClutterStage *stage,
|
||||
gboolean paint,
|
||||
cairo_rectangle_int_t *rect,
|
||||
uint8_t *data)
|
||||
{
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
GList *l;
|
||||
ClutterStageView *view;
|
||||
int bpp = 4;
|
||||
int stride;
|
||||
|
||||
stride = rect->width * 4;
|
||||
|
||||
for (l = _clutter_stage_window_get_views (priv->impl); l; l = l->next)
|
||||
{
|
||||
ClutterStageView *view = l->data;
|
||||
cairo_rectangle_int_t view_layout;
|
||||
cairo_region_t *region;
|
||||
cairo_rectangle_int_t capture_rect;
|
||||
int x_offset, y_offset;
|
||||
|
||||
clutter_stage_view_get_layout (view, &view_layout);
|
||||
region = cairo_region_create_rectangle (&view_layout);
|
||||
cairo_region_intersect_rectangle (region, rect);
|
||||
|
||||
cairo_region_get_extents (region, &capture_rect);
|
||||
cairo_region_destroy (region);
|
||||
|
||||
x_offset = capture_rect.x - rect->x;
|
||||
y_offset = capture_rect.y - rect->y;
|
||||
|
||||
capture_view_into (stage, paint, view,
|
||||
&capture_rect,
|
||||
data + (x_offset * bpp) + (y_offset * stride),
|
||||
stride);
|
||||
}
|
||||
view = get_view_at_rect (stage, rect);
|
||||
capture_view_into (stage, paint, view, rect, data, rect->width * bpp);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user