Compare commits
26 Commits
wip/lantw/
...
wip/carlos
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1c31fe8e65 | ||
![]() |
819ea8c0a6 | ||
![]() |
f0241114f6 | ||
![]() |
987cd7e821 | ||
![]() |
a4a7f9a660 | ||
![]() |
993b0b2758 | ||
![]() |
9bddda584b | ||
![]() |
81b0802eab | ||
![]() |
5de6d032d6 | ||
![]() |
a4d39bdabc | ||
![]() |
4e12be36d1 | ||
![]() |
1c70f6894f | ||
![]() |
ef2acde122 | ||
![]() |
a8c6fab3b8 | ||
![]() |
b8c8b59dc8 | ||
![]() |
efe698f6e1 | ||
![]() |
75ad578a7d | ||
![]() |
77d0ec12b1 | ||
![]() |
11f3db6693 | ||
![]() |
c5b89d9a86 | ||
![]() |
ed4c96c751 | ||
![]() |
2001bdd863 | ||
![]() |
9577475453 | ||
![]() |
ea099a871c | ||
![]() |
454e104d6f | ||
![]() |
127df62a02 |
@@ -1,4 +1,4 @@
|
||||
image: registry.gitlab.gnome.org/gnome/mutter/master:v4
|
||||
image: registry.gitlab.gnome.org/gnome/mutter/master:v3
|
||||
|
||||
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,27 +1,29 @@
|
||||
# Rebuild and push with
|
||||
#
|
||||
# cd .gitlab-ci/
|
||||
# podman build --format docker --no-cache -t registry.gitlab.gnome.org/gnome/mutter/master:v4 .
|
||||
# podman push registry.gitlab.gnome.org/gnome/mutter/master:v4
|
||||
# docker build --no-cache -t registry.gitlab.gnome.org/gnome/mutter/master:v3 .
|
||||
# docker push registry.gitlab.gnome.org/gnome/mutter/master:v3
|
||||
#
|
||||
|
||||
FROM fedora:32
|
||||
FROM fedora:31
|
||||
|
||||
RUN dnf -y update && dnf -y upgrade && \
|
||||
dnf install -y 'dnf-command(builddep)' && \
|
||||
dnf install -y 'dnf-command(copr)' && \
|
||||
dnf copr enable -y jadahl/mutter-ci && \
|
||||
dnf copr enable -y fmuellner/gnome-shell-ci && \
|
||||
dnf -y update && dnf -y upgrade && \
|
||||
|
||||
dnf builddep -y mutter --setopt=install_weak_deps=False && \
|
||||
dnf builddep -y mutter && \
|
||||
|
||||
# Until Fedora catches up with new build-deps
|
||||
dnf install -y 'pkgconfig(graphene-gobject-1.0)' 'pkgconfig(sysprof-capture-3)' && \
|
||||
|
||||
# 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 \
|
||||
--setopt=install_weak_deps=False && \
|
||||
dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 '*/xvfb-run' gdm-lib accountsservice-libs gnome-control-center && \
|
||||
|
||||
# GNOME Shell
|
||||
dnf builddep -y gnome-shell --setopt=install_weak_deps=False && \
|
||||
dnf remove -y gnome-bluetooth-libs-devel && \
|
||||
dnf remove -y gnome-bluetooth-libs-devel dbus-glib-devel upower-devel python3-devel && \
|
||||
dnf remove -y --noautoremove mutter mutter-devel && \
|
||||
|
||||
dnf clean all
|
||||
|
@@ -19,7 +19,7 @@ fi
|
||||
function commit_message_has_url() {
|
||||
commit=$1
|
||||
commit_message=$(git show -s --format='format:%b' $commit)
|
||||
echo "$commit_message" | grep -qe "\($CI_MERGE_REQUEST_PROJECT_URL/\(-/\)\?\(issues\|merge_requests\)/[0-9]\+\|https://bugzilla.gnome.org/show_bug.cgi?id=[0-9]\+\)"
|
||||
echo "$commit_message" | grep -qe "\($CI_MERGE_REQUEST_PROJECT_URL/\(issues\|merge_requests\)/[0-9]\+\|https://bugzilla.gnome.org/show_bug.cgi?id=[0-9]\+\)"
|
||||
return $?
|
||||
}
|
||||
|
||||
|
@@ -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"
|
204
NEWS
204
NEWS
@@ -1,207 +1,3 @@
|
||||
3.37.1
|
||||
======
|
||||
* Fix screencasting non-maximized windows [Jonas Å.; !1174]
|
||||
* Make window-aliveness checks less aggressive [Jonas Å.; !1182]
|
||||
* Fix stylus coordinates when using screen rotation [Jonas T.; #1118]
|
||||
* Preserve keyboard state on VT switch [Olivier; !1185]
|
||||
* Remove Clutter's drag and drop actions [Jonas D.; !789]
|
||||
* Cancel clicks/gestures actions on disable [Georges; !1188]
|
||||
* Fix various clipboard issues [Carlos; !1186, !1198, !1203, !1204, !1206]
|
||||
* Fix trackball button scrolling [Phillip; #1120]
|
||||
* Fix tiled monitor support [Jonas; !1199]
|
||||
* Support unredirecting fullscreen wayland surfaces [Jonas Å.; !798]
|
||||
* Support area screencasts [Jonas Å.; !1207]
|
||||
* Synchronize shadows to server-side decorations [Olivier; !1214]
|
||||
* Allow inhibiting remote access [Jonas Å.; !1212]
|
||||
* Fix overview key on X11 when using multiple keyboard layouts [Olivier; !1219]
|
||||
* Fixed crashes [Jonas, D., Carlos; !1173, !1183, !1012]
|
||||
* Misc. bug fixes and cleanups [Andre, Georges, Christian, Jonas Å., Andre,
|
||||
Simon, Florian, Carlos, Adam, Marco, Thomas, Elias, Pekka, Jonas D.,
|
||||
Laurent; !1169, !1168, !1166, !1170, !1167, !1172, !1175, !1176, !1184,
|
||||
!1126, !1187, !1191, !1195, !1179, !1200, !1193, !1209, !1213, !1208,
|
||||
#1074, !1223]
|
||||
|
||||
Contributors:
|
||||
Marco Trevisan (Treviño), Elias Aebi, Thomas Hindoe Paaboel Andersen,
|
||||
Laurent Bigonville, Jonas Dreßler, Olivier Fourdan, Carlos Garnacho,
|
||||
Adam Jackson, Andre Moreira Magalhaes, Simon McVittie, Florian Müllner,
|
||||
Georges Basile Stavracas Neto, Pekka Paalanen, Christian Rauch, Jonas Troeger,
|
||||
Phillip Wood, Jonas Ådahl
|
||||
|
||||
Translators:
|
||||
Dušan Kazik [sk], Christian Kirbach [de]
|
||||
|
||||
3.36.0
|
||||
======
|
||||
* Fix placement of popup windows in multi-monitor setups [Jonas; !1110]
|
||||
* Fix invisible mouse cursor on some hardware [Jonas; !1079]
|
||||
|
||||
Contributors:
|
||||
Jonas Ådahl
|
||||
|
||||
Translators:
|
||||
Aurimas Černius [lt], Goran Vidović [hr], Anders Jonsson [sv],
|
||||
Guillaume Bernard [fr], Milo Casagrande [it], Daniel Korostil [uk],
|
||||
Andre Klapper [cy], Aman Alam [pa], Nathan Follens [nl]
|
||||
|
||||
3.35.92
|
||||
=======
|
||||
* Fix visibility of initially hidden windows [Jonas Å.; !1066]
|
||||
* Avoid flicker when (un)redirecting windows [Sebastian; #997]
|
||||
* Let BindConstraints update the preferred size [Emmanuele; !1070]
|
||||
* Learn about GLES3 [Adam; !882]
|
||||
* Ping windows on every window focus [Jonas D.; !891]
|
||||
* Remove overhead from hot code paths [Christian;
|
||||
#1056, !1081, !1083, !1071, !1087]
|
||||
* Allow remote desktop services to inhibit animations [Jonas Å.; !838]
|
||||
* Update screen-cast code to PipeWire 0.3 API [Wim; !1062]
|
||||
* Make check-alive timeouts configurable [Jonas Å.; !1080]
|
||||
* Make each stage view correspond to a single CRTC [Jonas Å.; !1042]
|
||||
* Implement scaled/transformed hardware cursors [Robert; !526]
|
||||
* Use DMA buffers for screencasting if possible [Georges; !1086]
|
||||
* Make Xwayland startup asynchronous [Carlos; !944]
|
||||
* Fix clipping glitches in long text entries [Jonas D.; !1096]
|
||||
* Add side channel for starting required X11 services [Carlos; !945]
|
||||
* Support synchronized wayland popup moving [Jonas Å.; !705]
|
||||
* Fixed crashes [Olivier, Jonas Å.; !1073, !1093]
|
||||
* Plugged memory leaks [Sebastian, Jonas Å.; !1089, !1095]
|
||||
* Misc. bug fixes and cleanups [Jonas Å, Olivier, Florian, Daniel, Jonas D.,
|
||||
Robert, Sebastian, Christian, Arun, Carlos, worldofpeace; !1061, #1043,
|
||||
!1067, !1068, !1065, !835, !1058, !1069, !1075, #1060, !1077, !423, !1090,
|
||||
!1088, !1094, #1067, !1064, !1099, !957, !1000, !1082]
|
||||
|
||||
Contributors:
|
||||
Emmanuele Bassi, Jonas Dreßler, Olivier Fourdan, Carlos Garnacho,
|
||||
Christian Hergert, Adam Jackson, Sebastian Keller, Robert Mader,
|
||||
Florian Müllner, Georges Basile Stavracas Neto, Arun Raghavan, Wim Taymans,
|
||||
Daniel van Vugt, worldofpeace, Jonas Ådahl
|
||||
|
||||
Translators:
|
||||
Yi-Jyun Pan [zh_TW], Asier Sarasua Garmendia [eu], Rafael Fontenelle [pt_BR],
|
||||
Emin Tufan Çetin [tr], Daniel Mustieles [es], Balázs Úr [hu],
|
||||
Gwan-gyeong Mun [ko], Marek Černocký [cs], Fran Dieguez [gl],
|
||||
Kukuh Syafaat [id], Alan Mortensen [da], Piotr Drąg [pl], sicklylife [ja],
|
||||
Matej Urbančič [sl]
|
||||
|
||||
3.35.91
|
||||
=======
|
||||
* Honor accelerometer orientation on monitor config changes [Hans; !959]
|
||||
* Enable culling for integer-scaled actors [Robert; !1036]
|
||||
* Add ClutterSeat::touch-mode property [Carlos; !1044]
|
||||
* Fix mis-scaling when streaming windows [Olivier; !1022]
|
||||
* Make the cursor renderer use the transactional KMS API [Jonas; !930]
|
||||
* Advertise MetaMonitor as wl_output [Olivier; !994]
|
||||
* Fix culling of XWayland windows [Robert; !1049]
|
||||
* Only consider enabled effects when disabling culling [Robert; !1052]
|
||||
* Misc. bug fixes and cleanups [Olivier, Sergio, Adam, Carlos, Björn; !1040,
|
||||
#985, !1024, !1039, !1051]
|
||||
|
||||
Contributors:
|
||||
Sergio Costas, Björn Daase, Olivier Fourdan, Carlos Garnacho, Hans de Goede,
|
||||
Adam Jackson, Robert Mader, Jonas Ådahl
|
||||
|
||||
Translators:
|
||||
sicklylife [ja]
|
||||
|
||||
3.35.90
|
||||
=======
|
||||
* Cull out clip region [Robert; !985]
|
||||
* Always enable tap-to-click/drag on opaque Wacom tablets [Carlos; !968]
|
||||
* Fix visual glitches with offscreen effects applied [Georges; !992]
|
||||
* Fix "sticky corner" in multi-head setups [Jonas D.; #774]
|
||||
* Fix black shadows around XWayland windows during resizes [Ray, Olivier; #858]
|
||||
* Zero-copy path for GPU-less secondary GPUs [Pekka; !810]
|
||||
* Cancel DND on Esc [Carlos; #1020]
|
||||
* Sync XWayland window shadows to frame during resizes [Olivier; !1009]
|
||||
* Add support for per-monitor workareas [Alberts; !370]
|
||||
* Ensure newly mapped wayland windows receive ENTER event [Olivier; !1026]
|
||||
* Add ClutterSeat object [Carlos; !852]
|
||||
* Honour CLUTTER_ACTOR_NO_LAYOUT flag more efficiently [Daniel; !575]
|
||||
* Fix interoperation with wl_data_device_manager v1 [Carlos; #965]
|
||||
* Favor text over images in clipboard manager [Carlos; #919]
|
||||
* Apply monitor scale after background texture creation [Daniel; !1004]
|
||||
* Plugged memory leaks [Sebastian, Adam; !991, #1000, !1011, !1020, !1030,
|
||||
!1001, !1033]
|
||||
* Fixed crashes [Jonas Å., Florian, Olivier; !961, #1029, !1037]
|
||||
* Misc. bug fixes and cleanups [Björn, Jonas Å., Adam, Sebastian, Jonas D.,
|
||||
Daniel, Carlos, Corentin, Sebastian, Robert, Daniel; #385, !998, !1007, !995,
|
||||
!1016, !1018, !1017, !1005, !1019, !1025, !1028, !1029, !1031, !1015, !1032,
|
||||
!1034, #1025]
|
||||
|
||||
Contributors:
|
||||
Björn Daase, Jonas Dreßler, Olivier Fourdan, Carlos Garnacho, Adam Jackson,
|
||||
Sebastian Keller, Robert Mader, Alberts Muktupāvels, Florian Müllner,
|
||||
Georges Basile Stavracas Neto, Corentin Noël, Pekka Paalanen, Ray Strode,
|
||||
Daniel van Vugt, Jonas Ådahl
|
||||
|
||||
Translators:
|
||||
sicklylife [ja], Umarzuki Bin Mochlis Moktar [ms]
|
||||
|
||||
3.35.3
|
||||
======
|
||||
* backends/native: Correct dy value in pinch gesture event [Yariv; !974]
|
||||
* Upload clipping rectangles in parallel [Daniel; !969]
|
||||
* More cogl API cleanups [Adam; !978, !977, !973]
|
||||
* Fix window recording on HiDPI [Pascal; !976]
|
||||
* Fix top-left pixel being insensitive to clicks [Sebastian; #893]
|
||||
* Misc. bug fixes and cleanups [Daniel, Adam; !979, !980]
|
||||
|
||||
Contributors:
|
||||
Yariv Barkan, Adam Jackson, Sebastian Keller, Pascal Nowack, Daniel van Vugt
|
||||
|
||||
Translators:
|
||||
Fran Dieguez [gl], Dz Chen [zh_CN]
|
||||
|
||||
3.35.2
|
||||
======
|
||||
* Don't emit focus event after destruction [Marco; gnome-shell#1704, !860]
|
||||
* Add a notion of pixel format planes [Niels; !858]
|
||||
* Replace various Cogl/Clutter types with Graphene [Georges; !458]
|
||||
* Improve CoglJournal [Georges, Jasper; !402]
|
||||
* Split pick and paint [Georges; !865]
|
||||
* Remove deprecated/unused cogl/clutter APIs [Adam; !866, !878, !879, !880,
|
||||
!885, !900, !902, !904, !896, !913, !922, !883, !903, !921, !933, !819]
|
||||
* Fix hang when opening not-responding dialog on Xorg [Carlos; !876]
|
||||
* Allow changing Clutter debug flags at runtime [Georges; !862]
|
||||
* Fix frozen grabs on Xorg after weeks of inactivity [Jonas; !886]
|
||||
* Fix triggering popups from stylus devices o wayland [Carlos; #886]
|
||||
* Fix fallback to GLES2 [Adam; #635]
|
||||
* Fix buffer age checks on multiple monitors [Carlos; !906]
|
||||
* Adjust to Sysprof API change [Christian; !908]
|
||||
* Improve support for (X11) fullscreen games under wayland [Hans; !739]
|
||||
* Support shadow framebuffers for offscreen rendering [Olivier; !877]
|
||||
* Fix hang after interacting with desktop icons on X11 [Marco; !909]
|
||||
* Don't double scale when getting absolute surface coordinates [Xiang; !915]
|
||||
* Respect NET_WM_TRANSIENT_FOR for override-redirect windows [Marco; !920]
|
||||
* Kill window effects on destroy [Robert; !924]
|
||||
* Remove deprecated ClutterTexture [Jonas; !932]
|
||||
* Use regions instead of bounding box for clipping and culling [Carlos; !867]
|
||||
* Use partial damage for dma-buf and EGLImage buffers on wayland [Robert; #947]
|
||||
* Do not stack transients underneath their always-on-top parent [Florian; #587]
|
||||
* Add explicit paint/pick contexts [Jonas; !935]
|
||||
* Fix KMS freeze after pageflip fallback [Pekka; !953]
|
||||
* Fixed crashes [Robert, Carlos, Jonas, Marco, Hans, Tim; !856, !869, !912,
|
||||
!895, !928, #591, !823, !960]
|
||||
* Plugged memory leaks [Niels, Robert, Carlos, Marco; !847, !868, !873, #908]
|
||||
* Misc. bug fixes and cleanups [Niels, Robert, Jonas, Marco, Carlos, Daniel,
|
||||
Jan, Adam, Cosimo, Florian, Thomas, Georges, Hans, Corentin, Christian,
|
||||
Benjamin; !853, !822, !451, !854, !816, !857, !859, !734, !844, !851, #876,
|
||||
!874, !673, !692, !888, !889, !894, !901, !905, !872, !898, !911, !918, !863,
|
||||
#878, !811, !893, !925, !926, !890, !931, !927, !934, !938, !940, !947, !941,
|
||||
!929, !949, !952, !871, !955, !956, !958, !907, !965, !964, !966]
|
||||
|
||||
Contributors:
|
||||
Marco Trevisan (Treviño), Jan Alexander Steffens (heftig),
|
||||
Thomas Hindoe Paaboel Andersen, Benjamin Berg, Cosimo Cecchi, Tim Crawford,
|
||||
Piotr Drąg, Xiang Fan, Olivier Fourdan, Carlos Garnacho, Hans de Goede,
|
||||
Niels De Graef, Christian Hergert, Adam Jackson, Robert Mader,
|
||||
Florian Müllner, Georges Basile Stavracas Neto, Bastien Nocera, Corentin Noël,
|
||||
Pekka Paalanen, Jasper St. Pierre, Christian Rauch, Daniel van Vugt,
|
||||
Jonas Ådahl
|
||||
|
||||
Translators:
|
||||
Bruce Cowan [en_GB]
|
||||
|
||||
3.35.1
|
||||
======
|
||||
* Fix immediate screen blank after releaseing inhibitor [Tim; #573]
|
||||
|
@@ -600,11 +600,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);
|
||||
|
||||
|
@@ -88,10 +88,6 @@ static void
|
||||
clutter_actor_meta_real_set_actor (ClutterActorMeta *meta,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
g_warn_if_fail (!meta->priv->actor ||
|
||||
!CLUTTER_ACTOR_IN_PAINT (meta->priv->actor));
|
||||
g_warn_if_fail (!actor || !CLUTTER_ACTOR_IN_PAINT (actor));
|
||||
|
||||
if (meta->priv->actor == actor)
|
||||
return;
|
||||
|
||||
@@ -105,18 +101,6 @@ clutter_actor_meta_real_set_actor (ClutterActorMeta *meta,
|
||||
meta);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_meta_real_set_enabled (ClutterActorMeta *meta,
|
||||
gboolean is_enabled)
|
||||
{
|
||||
g_warn_if_fail (!meta->priv->actor ||
|
||||
!CLUTTER_ACTOR_IN_PAINT (meta->priv->actor));
|
||||
|
||||
meta->priv->is_enabled = is_enabled;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (meta), obj_props[PROP_ENABLED]);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_meta_set_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
@@ -188,7 +172,6 @@ clutter_actor_meta_class_init (ClutterActorMetaClass *klass)
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
klass->set_actor = clutter_actor_meta_real_set_actor;
|
||||
klass->set_enabled = clutter_actor_meta_real_set_enabled;
|
||||
|
||||
/**
|
||||
* ClutterActorMeta:actor:
|
||||
@@ -315,7 +298,9 @@ clutter_actor_meta_set_enabled (ClutterActorMeta *meta,
|
||||
if (meta->priv->is_enabled == is_enabled)
|
||||
return;
|
||||
|
||||
CLUTTER_ACTOR_META_GET_CLASS (meta)->set_enabled (meta, is_enabled);
|
||||
meta->priv->is_enabled = is_enabled;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (meta), obj_props[PROP_ENABLED]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -87,9 +87,6 @@ struct _ClutterActorMetaClass
|
||||
void (* set_actor) (ClutterActorMeta *meta,
|
||||
ClutterActor *actor);
|
||||
|
||||
void (* set_enabled) (ClutterActorMeta *meta,
|
||||
gboolean is_enabled);
|
||||
|
||||
/*< private >*/
|
||||
void (* _clutter_meta1) (void);
|
||||
void (* _clutter_meta2) (void);
|
||||
@@ -97,6 +94,7 @@ struct _ClutterActorMetaClass
|
||||
void (* _clutter_meta4) (void);
|
||||
void (* _clutter_meta5) (void);
|
||||
void (* _clutter_meta6) (void);
|
||||
void (* _clutter_meta7) (void);
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -631,7 +631,7 @@
|
||||
#include "clutter-color-static.h"
|
||||
#include "clutter-color.h"
|
||||
#include "clutter-constraint-private.h"
|
||||
#include "clutter-container-private.h"
|
||||
#include "clutter-container.h"
|
||||
#include "clutter-content-private.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-easing.h"
|
||||
@@ -643,7 +643,6 @@
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-marshal.h"
|
||||
#include "clutter-mutter.h"
|
||||
#include "clutter-paint-context-private.h"
|
||||
#include "clutter-paint-nodes.h"
|
||||
#include "clutter-paint-node-private.h"
|
||||
#include "clutter-paint-volume-private.h"
|
||||
@@ -710,7 +709,6 @@ struct _ClutterActorPrivate
|
||||
|
||||
guint8 opacity;
|
||||
gint opacity_override;
|
||||
unsigned int inhibit_culling_counter;
|
||||
|
||||
ClutterOffscreenRedirect offscreen_redirect;
|
||||
|
||||
@@ -1125,20 +1123,6 @@ static GQuark quark_actor_layout_info = 0;
|
||||
static GQuark quark_actor_transform_info = 0;
|
||||
static GQuark quark_actor_animation_info = 0;
|
||||
|
||||
static GQuark quark_key = 0;
|
||||
static GQuark quark_motion = 0;
|
||||
static GQuark quark_pointer_focus = 0;
|
||||
static GQuark quark_button = 0;
|
||||
static GQuark quark_scroll = 0;
|
||||
static GQuark quark_stage = 0;
|
||||
static GQuark quark_destroy = 0;
|
||||
static GQuark quark_client = 0;
|
||||
static GQuark quark_delete = 0;
|
||||
static GQuark quark_touch = 0;
|
||||
static GQuark quark_touchpad = 0;
|
||||
static GQuark quark_proximity = 0;
|
||||
static GQuark quark_pad = 0;
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (ClutterActor,
|
||||
clutter_actor,
|
||||
G_TYPE_INITIALLY_UNOWNED,
|
||||
@@ -1302,12 +1286,10 @@ clutter_actor_verify_map_state (ClutterActor *self)
|
||||
static gboolean
|
||||
_clutter_actor_transform_local_box_to_stage (ClutterActor *self,
|
||||
ClutterStage *stage,
|
||||
ClutterPickContext *pick_context,
|
||||
const ClutterActorBox *box,
|
||||
graphene_point_t vertices[4])
|
||||
{
|
||||
CoglFramebuffer *fb =
|
||||
clutter_pick_context_get_framebuffer (pick_context);
|
||||
CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
|
||||
CoglMatrix stage_transform, inv_stage_transform;
|
||||
CoglMatrix modelview, transform_to_stage;
|
||||
int v;
|
||||
@@ -1348,7 +1330,6 @@ _clutter_actor_transform_local_box_to_stage (ClutterActor *self,
|
||||
/**
|
||||
* clutter_actor_pick_box:
|
||||
* @self: The #ClutterActor being "pick" painted.
|
||||
* @pick_context: The #ClutterPickContext
|
||||
* @box: A rectangle in the actor's own local coordinates.
|
||||
*
|
||||
* Logs (does a virtual paint of) a rectangle for picking. Note that @box is
|
||||
@@ -1359,7 +1340,6 @@ _clutter_actor_transform_local_box_to_stage (ClutterActor *self,
|
||||
*/
|
||||
void
|
||||
clutter_actor_pick_box (ClutterActor *self,
|
||||
ClutterPickContext *pick_context,
|
||||
const ClutterActorBox *box)
|
||||
{
|
||||
ClutterStage *stage;
|
||||
@@ -1373,14 +1353,12 @@ clutter_actor_pick_box (ClutterActor *self,
|
||||
|
||||
stage = CLUTTER_STAGE (_clutter_actor_get_stage_internal (self));
|
||||
|
||||
if (_clutter_actor_transform_local_box_to_stage (self, stage, pick_context,
|
||||
box, vertices))
|
||||
if (_clutter_actor_transform_local_box_to_stage (self, stage, box, vertices))
|
||||
clutter_stage_log_pick (stage, vertices, self);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_clutter_actor_push_pick_clip (ClutterActor *self,
|
||||
ClutterPickContext *pick_context,
|
||||
const ClutterActorBox *clip)
|
||||
{
|
||||
ClutterStage *stage;
|
||||
@@ -1388,8 +1366,7 @@ _clutter_actor_push_pick_clip (ClutterActor *self,
|
||||
|
||||
stage = CLUTTER_STAGE (_clutter_actor_get_stage_internal (self));
|
||||
|
||||
if (!_clutter_actor_transform_local_box_to_stage (self, stage, pick_context,
|
||||
clip, vertices))
|
||||
if (!_clutter_actor_transform_local_box_to_stage (self, stage, clip, vertices))
|
||||
return FALSE;
|
||||
|
||||
clutter_stage_push_pick_clip (stage, vertices);
|
||||
@@ -1793,15 +1770,6 @@ clutter_actor_unmap (ClutterActor *self)
|
||||
clutter_actor_update_map_state (self, MAP_STATE_MAKE_UNMAPPED);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_queue_shallow_relayout (ClutterActor *self)
|
||||
{
|
||||
ClutterActor *stage = _clutter_actor_get_stage_internal (self);
|
||||
|
||||
if (stage != NULL)
|
||||
clutter_stage_queue_actor_relayout (CLUTTER_STAGE (stage), self);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_real_show (ClutterActor *self)
|
||||
{
|
||||
@@ -1835,11 +1803,6 @@ clutter_actor_real_show (ClutterActor *self)
|
||||
|
||||
clutter_actor_queue_relayout (self);
|
||||
}
|
||||
else /* but still don't leave the actor un-allocated before showing it */
|
||||
{
|
||||
clutter_actor_queue_shallow_relayout (self);
|
||||
clutter_actor_queue_redraw (self);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
@@ -2358,8 +2321,7 @@ _clutter_actor_rerealize (ClutterActor *self,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_real_pick (ClutterActor *self,
|
||||
ClutterPickContext *pick_context)
|
||||
clutter_actor_real_pick (ClutterActor *self)
|
||||
{
|
||||
if (clutter_actor_should_pick_paint (self))
|
||||
{
|
||||
@@ -2370,7 +2332,7 @@ clutter_actor_real_pick (ClutterActor *self,
|
||||
.y2 = clutter_actor_get_height (self),
|
||||
};
|
||||
|
||||
clutter_actor_pick_box (self, pick_context, &box);
|
||||
clutter_actor_pick_box (self, &box);
|
||||
}
|
||||
|
||||
/* XXX - this thoroughly sucks, but we need to maintain compatibility
|
||||
@@ -2387,7 +2349,7 @@ clutter_actor_real_pick (ClutterActor *self,
|
||||
for (iter = self->priv->first_child;
|
||||
iter != NULL;
|
||||
iter = iter->priv->next_sibling)
|
||||
clutter_actor_pick (iter, pick_context);
|
||||
clutter_actor_pick (iter);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2410,7 +2372,6 @@ clutter_actor_should_pick_paint (ClutterActor *self)
|
||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
|
||||
|
||||
if (CLUTTER_ACTOR_IS_MAPPED (self) &&
|
||||
clutter_actor_has_allocation (self) &&
|
||||
(_clutter_context_get_pick_mode () == CLUTTER_PICK_ALL ||
|
||||
CLUTTER_ACTOR_IS_REACTIVE (self)))
|
||||
return TRUE;
|
||||
@@ -2894,23 +2855,9 @@ clutter_actor_real_queue_relayout (ClutterActor *self)
|
||||
memset (priv->height_requests, 0,
|
||||
N_CACHED_SIZE_REQUESTS * sizeof (SizeRequest));
|
||||
|
||||
/* We may need to go all the way up the hierarchy */
|
||||
/* We need to go all the way up the hierarchy */
|
||||
if (priv->parent != NULL)
|
||||
{
|
||||
if (priv->parent->flags & CLUTTER_ACTOR_NO_LAYOUT)
|
||||
{
|
||||
clutter_actor_queue_shallow_relayout (self);
|
||||
|
||||
/* The above might have invalidated the parent's paint volume if self
|
||||
* has moved or resized. DnD seems to require this...
|
||||
*/
|
||||
priv->parent->priv->needs_paint_volume_update = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
_clutter_actor_queue_only_relayout (priv->parent);
|
||||
}
|
||||
}
|
||||
_clutter_actor_queue_only_relayout (priv->parent);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3490,8 +3437,8 @@ _clutter_actor_draw_paint_volume_full (ClutterActor *self,
|
||||
cogl_pipeline_set_color (outline, &cogl_color);
|
||||
|
||||
pipeline_node = clutter_pipeline_node_new (outline);
|
||||
clutter_paint_node_set_static_name (pipeline_node,
|
||||
"ClutterActor (paint volume outline)");
|
||||
clutter_paint_node_set_name (pipeline_node,
|
||||
"ClutterActor (paint volume outline)");
|
||||
clutter_paint_node_add_primitive (pipeline_node, prim);
|
||||
clutter_paint_node_add_child (node, pipeline_node);
|
||||
cogl_object_unref (prim);
|
||||
@@ -3505,8 +3452,8 @@ _clutter_actor_draw_paint_volume_full (ClutterActor *self,
|
||||
pango_layout_set_text (layout, label, -1);
|
||||
|
||||
text_node = clutter_text_node_new (layout, color);
|
||||
clutter_paint_node_set_static_name (text_node,
|
||||
"ClutterActor (paint volume label)");
|
||||
clutter_paint_node_set_name (text_node,
|
||||
"ClutterActor (paint volume label)");
|
||||
clutter_paint_node_add_rectangle (text_node,
|
||||
&(ClutterActorBox) {
|
||||
.x1 = pv->vertices[0].x,
|
||||
@@ -3602,8 +3549,8 @@ _clutter_actor_paint_cull_result (ClutterActor *self,
|
||||
pango_layout_set_text (layout, label, -1);
|
||||
|
||||
text_node = clutter_text_node_new (layout, &color);
|
||||
clutter_paint_node_set_static_name (text_node,
|
||||
"ClutterActor (paint volume text)");
|
||||
clutter_paint_node_set_name (text_node,
|
||||
"ClutterActor (paint volume text)");
|
||||
clutter_paint_node_add_rectangle (text_node,
|
||||
&(ClutterActorBox) {
|
||||
.x1 = 0.f,
|
||||
@@ -3644,9 +3591,8 @@ in_clone_paint (void)
|
||||
* means there's no point in trying to cull descendants of the current
|
||||
* node. */
|
||||
static gboolean
|
||||
cull_actor (ClutterActor *self,
|
||||
ClutterPaintContext *paint_context,
|
||||
ClutterCullResult *result_out)
|
||||
cull_actor (ClutterActor *self,
|
||||
ClutterCullResult *result_out)
|
||||
{
|
||||
ClutterActorPrivate *priv = self->priv;
|
||||
ClutterStage *stage;
|
||||
@@ -3673,10 +3619,10 @@ cull_actor (ClutterActor *self,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (clutter_paint_context_is_drawing_off_stage (paint_context))
|
||||
if (cogl_get_draw_framebuffer () != _clutter_stage_get_active_framebuffer (stage))
|
||||
{
|
||||
CLUTTER_NOTE (CLIPPING, "Bail from cull_actor without culling (%s): "
|
||||
"Drawing off stage",
|
||||
"Current framebuffer doesn't correspond to stage",
|
||||
_clutter_actor_get_debug_name (self));
|
||||
return FALSE;
|
||||
}
|
||||
@@ -3759,13 +3705,7 @@ needs_flatten_effect (ClutterActor *self)
|
||||
CLUTTER_DEBUG_DISABLE_OFFSCREEN_REDIRECT))
|
||||
return FALSE;
|
||||
|
||||
/* We need to enable the effect immediately even in ON_IDLE because that can
|
||||
* only be implemented efficiently within the effect itself.
|
||||
* If it was implemented here using just priv->is_dirty then we would lose
|
||||
* the ability to animate opacity without repaints.
|
||||
*/
|
||||
if ((priv->offscreen_redirect & CLUTTER_OFFSCREEN_REDIRECT_ALWAYS) ||
|
||||
(priv->offscreen_redirect & CLUTTER_OFFSCREEN_REDIRECT_ON_IDLE))
|
||||
if (priv->offscreen_redirect & CLUTTER_OFFSCREEN_REDIRECT_ALWAYS)
|
||||
return TRUE;
|
||||
else if (priv->offscreen_redirect & CLUTTER_OFFSCREEN_REDIRECT_AUTOMATIC_FOR_OPACITY)
|
||||
{
|
||||
@@ -3820,8 +3760,7 @@ add_or_remove_flatten_effect (ClutterActor *self)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_real_paint (ClutterActor *actor,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_actor_real_paint (ClutterActor *actor)
|
||||
{
|
||||
ClutterActorPrivate *priv = actor->priv;
|
||||
ClutterActor *iter;
|
||||
@@ -3838,19 +3777,21 @@ clutter_actor_real_paint (ClutterActor *actor,
|
||||
iter->priv->allocation.x2 - iter->priv->allocation.x1,
|
||||
iter->priv->allocation.y2 - iter->priv->allocation.y1);
|
||||
|
||||
clutter_actor_paint (iter, paint_context);
|
||||
clutter_actor_paint (iter);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_actor_paint_node (ClutterActor *actor,
|
||||
ClutterPaintNode *root,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_actor_paint_node (ClutterActor *actor,
|
||||
ClutterPaintNode *root)
|
||||
{
|
||||
ClutterActorPrivate *priv = actor->priv;
|
||||
ClutterActorBox box;
|
||||
ClutterColor bg_color;
|
||||
|
||||
if (root == NULL)
|
||||
return FALSE;
|
||||
|
||||
box.x1 = 0.f;
|
||||
box.y1 = 0.f;
|
||||
box.x2 = clutter_actor_box_get_width (&priv->allocation);
|
||||
@@ -3864,9 +3805,16 @@ clutter_actor_paint_node (ClutterActor *actor,
|
||||
CoglFramebuffer *fb;
|
||||
CoglBufferBit clear_flags;
|
||||
|
||||
fb = clutter_paint_context_get_base_framebuffer (paint_context);
|
||||
fb = _clutter_stage_get_active_framebuffer (CLUTTER_STAGE (actor));
|
||||
|
||||
bg_color.alpha = 255;
|
||||
if (clutter_stage_get_use_alpha (CLUTTER_STAGE (actor)))
|
||||
{
|
||||
bg_color.alpha = priv->opacity
|
||||
* priv->bg_color.alpha
|
||||
/ 255;
|
||||
}
|
||||
else
|
||||
bg_color.alpha = 255;
|
||||
|
||||
CLUTTER_NOTE (PAINT, "Stage clear color: (%d, %d, %d, %d)",
|
||||
bg_color.red,
|
||||
@@ -3877,7 +3825,7 @@ clutter_actor_paint_node (ClutterActor *actor,
|
||||
clear_flags = COGL_BUFFER_BIT_DEPTH;
|
||||
|
||||
node = clutter_root_node_new (fb, &bg_color, clear_flags);
|
||||
clutter_paint_node_set_static_name (node, "stageClear");
|
||||
clutter_paint_node_set_name (node, "stageClear");
|
||||
clutter_paint_node_add_rectangle (node, &box);
|
||||
clutter_paint_node_add_child (root, node);
|
||||
clutter_paint_node_unref (node);
|
||||
@@ -3892,14 +3840,14 @@ clutter_actor_paint_node (ClutterActor *actor,
|
||||
/ 255;
|
||||
|
||||
node = clutter_color_node_new (&bg_color);
|
||||
clutter_paint_node_set_static_name (node, "backgroundColor");
|
||||
clutter_paint_node_set_name (node, "backgroundColor");
|
||||
clutter_paint_node_add_rectangle (node, &box);
|
||||
clutter_paint_node_add_child (root, node);
|
||||
clutter_paint_node_unref (node);
|
||||
}
|
||||
|
||||
if (priv->content != NULL)
|
||||
_clutter_content_paint_content (priv->content, actor, root, paint_context);
|
||||
_clutter_content_paint_content (priv->content, actor, root);
|
||||
|
||||
if (CLUTTER_ACTOR_GET_CLASS (actor)->paint_node != NULL)
|
||||
CLUTTER_ACTOR_GET_CLASS (actor)->paint_node (actor, root);
|
||||
@@ -3915,7 +3863,7 @@ clutter_actor_paint_node (ClutterActor *actor,
|
||||
}
|
||||
#endif /* CLUTTER_ENABLE_DEBUG */
|
||||
|
||||
clutter_paint_node_paint (root, paint_context);
|
||||
clutter_paint_node_paint (root);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -3939,14 +3887,12 @@ clutter_actor_paint_node (ClutterActor *actor,
|
||||
* unless it is performing a pick paint.
|
||||
*/
|
||||
void
|
||||
clutter_actor_paint (ClutterActor *self,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_actor_paint (ClutterActor *self)
|
||||
{
|
||||
g_autoptr (ClutterPaintNode) actor_node = NULL;
|
||||
g_autoptr (ClutterPaintNode) root_node = NULL;
|
||||
ClutterActorPrivate *priv;
|
||||
ClutterActorBox clip;
|
||||
gboolean culling_inhibited;
|
||||
gboolean clip_set = FALSE;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
||||
@@ -4013,14 +3959,11 @@ clutter_actor_paint (ClutterActor *self,
|
||||
|
||||
clutter_actor_get_transform (self, &transform);
|
||||
|
||||
if (!cogl_matrix_is_identity (&transform))
|
||||
{
|
||||
transform_node = clutter_transform_node_new (&transform);
|
||||
clutter_paint_node_add_child (transform_node, root_node);
|
||||
clutter_paint_node_unref (root_node);
|
||||
transform_node = clutter_transform_node_new (&transform);
|
||||
clutter_paint_node_add_child (transform_node, root_node);
|
||||
clutter_paint_node_unref (root_node);
|
||||
|
||||
root_node = g_steal_pointer (&transform_node);
|
||||
}
|
||||
root_node = g_steal_pointer (&transform_node);
|
||||
|
||||
#ifdef CLUTTER_ENABLE_DEBUG
|
||||
/* Catch when out-of-band transforms have been made by actors not as part
|
||||
@@ -4095,8 +4038,7 @@ clutter_actor_paint (ClutterActor *self,
|
||||
* paint then the last-paint-volume would likely represent the new
|
||||
* actor position not the old.
|
||||
*/
|
||||
culling_inhibited = priv->inhibit_culling_counter > 0;
|
||||
if (!culling_inhibited && !in_clone_paint ())
|
||||
if (!in_clone_paint ())
|
||||
{
|
||||
gboolean success;
|
||||
/* annoyingly gcc warns if uninitialized even though
|
||||
@@ -4110,7 +4052,7 @@ clutter_actor_paint (ClutterActor *self,
|
||||
CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS)))
|
||||
_clutter_actor_update_last_paint_volume (self);
|
||||
|
||||
success = cull_actor (self, paint_context, &result);
|
||||
success = cull_actor (self, &result);
|
||||
|
||||
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_REDRAWS))
|
||||
_clutter_actor_paint_cull_result (self, success, result, actor_node);
|
||||
@@ -4127,7 +4069,7 @@ clutter_actor_paint (ClutterActor *self,
|
||||
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_VOLUMES))
|
||||
_clutter_actor_draw_paint_volume (self, actor_node);
|
||||
|
||||
clutter_paint_node_paint (root_node, paint_context);
|
||||
clutter_paint_node_paint (root_node);
|
||||
|
||||
/* If we make it here then the actor has run through a complete
|
||||
paint run including all the effects so it's no longer dirty */
|
||||
@@ -4147,8 +4089,7 @@ clutter_actor_paint (ClutterActor *self,
|
||||
* Since: 1.8
|
||||
*/
|
||||
void
|
||||
clutter_actor_continue_paint (ClutterActor *self,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_actor_continue_paint (ClutterActor *self)
|
||||
{
|
||||
ClutterActorPrivate *priv;
|
||||
|
||||
@@ -4168,7 +4109,6 @@ clutter_actor_continue_paint (ClutterActor *self,
|
||||
actual actor */
|
||||
if (priv->next_effect_to_paint == NULL)
|
||||
{
|
||||
CoglFramebuffer *framebuffer;
|
||||
ClutterPaintNode *dummy;
|
||||
|
||||
/* XXX - this will go away in 2.0, when we can get rid of this
|
||||
@@ -4176,22 +4116,21 @@ clutter_actor_continue_paint (ClutterActor *self,
|
||||
* for the entire frame, starting from the Stage; the paint()
|
||||
* virtual function can then be called directly.
|
||||
*/
|
||||
framebuffer = clutter_paint_context_get_base_framebuffer (paint_context);
|
||||
dummy = _clutter_dummy_node_new (self, framebuffer);
|
||||
clutter_paint_node_set_static_name (dummy, "Root");
|
||||
dummy = _clutter_dummy_node_new (self);
|
||||
clutter_paint_node_set_name (dummy, "Root");
|
||||
|
||||
/* XXX - for 1.12, we use the return value of paint_node() to
|
||||
* decide whether we should emit the ::paint signal.
|
||||
*/
|
||||
clutter_actor_paint_node (self, dummy, paint_context);
|
||||
clutter_actor_paint_node (self, dummy);
|
||||
clutter_paint_node_unref (dummy);
|
||||
|
||||
/* XXX:2.0 - Call the paint() virtual directly */
|
||||
if (g_signal_has_handler_pending (self, actor_signals[PAINT],
|
||||
0, TRUE))
|
||||
g_signal_emit (self, actor_signals[PAINT], 0, paint_context);
|
||||
g_signal_emit (self, actor_signals[PAINT], 0);
|
||||
else
|
||||
CLUTTER_ACTOR_GET_CLASS (self)->paint (self, paint_context);
|
||||
CLUTTER_ACTOR_GET_CLASS (self)->paint (self);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4218,12 +4157,7 @@ clutter_actor_continue_paint (ClutterActor *self,
|
||||
run_flags |= CLUTTER_EFFECT_PAINT_ACTOR_DIRTY;
|
||||
}
|
||||
|
||||
if (priv->current_effect == priv->flatten_effect &&
|
||||
priv->offscreen_redirect & CLUTTER_OFFSCREEN_REDIRECT_ON_IDLE &&
|
||||
run_flags & CLUTTER_EFFECT_PAINT_ACTOR_DIRTY)
|
||||
run_flags |= CLUTTER_EFFECT_PAINT_BYPASS_EFFECT;
|
||||
|
||||
_clutter_effect_paint (priv->current_effect, paint_context, run_flags);
|
||||
_clutter_effect_paint (priv->current_effect, run_flags);
|
||||
|
||||
priv->current_effect = old_current_effect;
|
||||
}
|
||||
@@ -4236,11 +4170,9 @@ clutter_actor_continue_paint (ClutterActor *self,
|
||||
* Asks @actor to perform a pick.
|
||||
*/
|
||||
void
|
||||
clutter_actor_pick (ClutterActor *actor,
|
||||
ClutterPickContext *pick_context)
|
||||
clutter_actor_pick (ClutterActor *actor)
|
||||
{
|
||||
ClutterActorPrivate *priv;
|
||||
CoglFramebuffer *framebuffer;
|
||||
ClutterActorBox clip;
|
||||
gboolean clip_set = FALSE;
|
||||
|
||||
@@ -4260,16 +4192,15 @@ clutter_actor_pick (ClutterActor *actor,
|
||||
/* mark that we are in the paint process */
|
||||
CLUTTER_SET_PRIVATE_FLAGS (actor, CLUTTER_IN_PICK);
|
||||
|
||||
framebuffer = clutter_pick_context_get_framebuffer (pick_context);
|
||||
cogl_framebuffer_push_matrix (framebuffer);
|
||||
cogl_push_matrix ();
|
||||
|
||||
if (priv->enable_model_view_transform)
|
||||
{
|
||||
CoglMatrix matrix;
|
||||
|
||||
cogl_framebuffer_get_modelview_matrix (framebuffer, &matrix);
|
||||
cogl_get_modelview_matrix (&matrix);
|
||||
_clutter_actor_apply_modelview_transform (actor, &matrix);
|
||||
cogl_framebuffer_set_modelview_matrix (framebuffer, &matrix);
|
||||
cogl_set_modelview_matrix (&matrix);
|
||||
}
|
||||
|
||||
if (priv->has_clip)
|
||||
@@ -4290,7 +4221,7 @@ clutter_actor_pick (ClutterActor *actor,
|
||||
}
|
||||
|
||||
if (clip_set)
|
||||
clip_set = _clutter_actor_push_pick_clip (actor, pick_context, &clip);
|
||||
clip_set = _clutter_actor_push_pick_clip (actor, &clip);
|
||||
|
||||
priv->next_effect_to_paint = NULL;
|
||||
if (priv->effects)
|
||||
@@ -4299,12 +4230,12 @@ clutter_actor_pick (ClutterActor *actor,
|
||||
_clutter_meta_group_peek_metas (priv->effects);
|
||||
}
|
||||
|
||||
clutter_actor_continue_pick (actor, pick_context);
|
||||
clutter_actor_continue_pick (actor);
|
||||
|
||||
if (clip_set)
|
||||
_clutter_actor_pop_pick_clip (actor);
|
||||
|
||||
cogl_framebuffer_pop_matrix (framebuffer);
|
||||
cogl_pop_matrix ();
|
||||
|
||||
/* paint sequence complete */
|
||||
CLUTTER_UNSET_PRIVATE_FLAGS (actor, CLUTTER_IN_PICK);
|
||||
@@ -4321,8 +4252,7 @@ clutter_actor_pick (ClutterActor *actor,
|
||||
* is the last effect in the chain.
|
||||
*/
|
||||
void
|
||||
clutter_actor_continue_pick (ClutterActor *actor,
|
||||
ClutterPickContext *pick_context)
|
||||
clutter_actor_continue_pick (ClutterActor *actor)
|
||||
{
|
||||
ClutterActorPrivate *priv;
|
||||
|
||||
@@ -4348,9 +4278,9 @@ clutter_actor_continue_pick (ClutterActor *actor,
|
||||
*/
|
||||
if (g_signal_has_handler_pending (actor, actor_signals[PICK],
|
||||
0, TRUE))
|
||||
g_signal_emit (actor, actor_signals[PICK], 0, pick_context);
|
||||
g_signal_emit (actor, actor_signals[PICK], 0);
|
||||
else
|
||||
CLUTTER_ACTOR_GET_CLASS (actor)->pick (actor, pick_context);
|
||||
CLUTTER_ACTOR_GET_CLASS (actor)->pick (actor);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4364,7 +4294,7 @@ clutter_actor_continue_pick (ClutterActor *actor,
|
||||
priv->current_effect = priv->next_effect_to_paint->data;
|
||||
priv->next_effect_to_paint = priv->next_effect_to_paint->next;
|
||||
|
||||
_clutter_effect_pick (priv->current_effect, pick_context);
|
||||
_clutter_effect_pick (priv->current_effect);
|
||||
|
||||
priv->current_effect = old_current_effect;
|
||||
}
|
||||
@@ -4593,7 +4523,7 @@ clutter_actor_remove_child_internal (ClutterActor *self,
|
||||
|
||||
/* we need to emit the signal before dropping the reference */
|
||||
if (emit_actor_removed)
|
||||
_clutter_container_emit_actor_removed (CLUTTER_CONTAINER (self), child);
|
||||
g_signal_emit_by_name (self, "actor-removed", child);
|
||||
|
||||
if (notify_first_last)
|
||||
{
|
||||
@@ -6556,20 +6486,6 @@ clutter_actor_class_init (ClutterActorClass *klass)
|
||||
quark_actor_transform_info = g_quark_from_static_string ("-clutter-actor-transform-info");
|
||||
quark_actor_animation_info = g_quark_from_static_string ("-clutter-actor-animation-info");
|
||||
|
||||
quark_key = g_quark_from_static_string ("key");
|
||||
quark_motion = g_quark_from_static_string ("motion");
|
||||
quark_pointer_focus = g_quark_from_static_string ("pointer-focus");
|
||||
quark_button = g_quark_from_static_string ("button");
|
||||
quark_scroll = g_quark_from_static_string ("scroll");
|
||||
quark_stage = g_quark_from_static_string ("stage");
|
||||
quark_destroy = g_quark_from_static_string ("destroy");
|
||||
quark_client = g_quark_from_static_string ("client");
|
||||
quark_delete = g_quark_from_static_string ("delete");
|
||||
quark_touch = g_quark_from_static_string ("touch");
|
||||
quark_touchpad = g_quark_from_static_string ("touchpad");
|
||||
quark_proximity = g_quark_from_static_string ("proximity");
|
||||
quark_pad = g_quark_from_static_string ("pad");
|
||||
|
||||
object_class->constructor = clutter_actor_constructor;
|
||||
object_class->set_property = clutter_actor_set_property;
|
||||
object_class->get_property = clutter_actor_get_property;
|
||||
@@ -6669,7 +6585,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
|
||||
g_param_spec_float ("width",
|
||||
P_("Width"),
|
||||
P_("Width of the actor"),
|
||||
-1.0f, G_MAXFLOAT,
|
||||
0.0, G_MAXFLOAT,
|
||||
0.0,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
@@ -6688,7 +6604,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
|
||||
g_param_spec_float ("height",
|
||||
P_("Height"),
|
||||
P_("Height of the actor"),
|
||||
-1.0f, G_MAXFLOAT,
|
||||
0.0, G_MAXFLOAT,
|
||||
0.0,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
@@ -8605,7 +8521,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
|
||||
actor_signals[CAPTURED_EVENT] =
|
||||
g_signal_new (I_("captured-event"),
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ClutterActorClass, captured_event),
|
||||
_clutter_boolean_handled_accumulator, NULL,
|
||||
_clutter_marshal_BOOLEAN__BOXED,
|
||||
@@ -8618,7 +8534,6 @@ clutter_actor_class_init (ClutterActorClass *klass)
|
||||
/**
|
||||
* ClutterActor::paint:
|
||||
* @actor: the #ClutterActor that received the signal
|
||||
* @paint_context: a #ClutterPaintContext
|
||||
*
|
||||
* The ::paint signal is emitted each time an actor is being painted.
|
||||
*
|
||||
@@ -8646,8 +8561,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
|
||||
G_SIGNAL_DEPRECATED,
|
||||
G_STRUCT_OFFSET (ClutterActorClass, paint),
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_PAINT_CONTEXT);
|
||||
G_TYPE_NONE, 0);
|
||||
/**
|
||||
* ClutterActor::realize:
|
||||
* @actor: the #ClutterActor that received the signal
|
||||
@@ -8690,7 +8604,6 @@ clutter_actor_class_init (ClutterActorClass *klass)
|
||||
/**
|
||||
* ClutterActor::pick:
|
||||
* @actor: the #ClutterActor that received the signal
|
||||
* @pick_context: a #ClutterPickContext
|
||||
*
|
||||
* The ::pick signal is emitted each time an actor is being painted
|
||||
* in "pick mode". The pick mode is used to identify the actor during
|
||||
@@ -8712,8 +8625,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_DEPRECATED,
|
||||
G_STRUCT_OFFSET (ClutterActorClass, pick),
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_PICK_CONTEXT);
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
/**
|
||||
* ClutterActor::allocation-changed:
|
||||
@@ -9792,23 +9704,6 @@ clutter_actor_get_preferred_width (ClutterActor *self,
|
||||
return;
|
||||
}
|
||||
|
||||
/* if the request mode is CONTENT_SIZE we simply return the content width */
|
||||
if (priv->request_mode == CLUTTER_REQUEST_CONTENT_SIZE)
|
||||
{
|
||||
float content_width = 0.f;
|
||||
|
||||
if (priv->content != NULL)
|
||||
clutter_content_get_preferred_size (priv->content, &content_width, NULL);
|
||||
|
||||
if (min_width_p != NULL)
|
||||
*min_width_p = content_width;
|
||||
|
||||
if (natural_width_p != NULL)
|
||||
*natural_width_p = content_width;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IN_PREF_WIDTH);
|
||||
|
||||
/* the remaining cases are:
|
||||
@@ -9957,23 +9852,6 @@ clutter_actor_get_preferred_height (ClutterActor *self,
|
||||
return;
|
||||
}
|
||||
|
||||
/* if the request mode is CONTENT_SIZE we simply return the content height */
|
||||
if (priv->request_mode == CLUTTER_REQUEST_CONTENT_SIZE)
|
||||
{
|
||||
float content_height = 0.f;
|
||||
|
||||
if (priv->content != NULL)
|
||||
clutter_content_get_preferred_size (priv->content, NULL, &content_height);
|
||||
|
||||
if (min_height_p != NULL)
|
||||
*min_height_p = content_height;
|
||||
|
||||
if (natural_height_p != NULL)
|
||||
*natural_height_p = content_height;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IN_PREF_HEIGHT);
|
||||
|
||||
/* the remaining cases are:
|
||||
@@ -13251,7 +13129,7 @@ clutter_actor_add_child_internal (ClutterActor *self,
|
||||
}
|
||||
|
||||
if (emit_actor_added)
|
||||
_clutter_container_emit_actor_added (CLUTTER_CONTAINER (self), child);
|
||||
g_signal_emit_by_name (self, "actor-added", child);
|
||||
|
||||
if (notify_first_last)
|
||||
{
|
||||
@@ -13915,70 +13793,8 @@ clutter_actor_event (ClutterActor *actor,
|
||||
|
||||
if (capture)
|
||||
{
|
||||
GQuark detail = 0;
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
case CLUTTER_NOTHING:
|
||||
break;
|
||||
case CLUTTER_KEY_PRESS:
|
||||
case CLUTTER_KEY_RELEASE:
|
||||
detail = quark_key;
|
||||
break;
|
||||
case CLUTTER_MOTION:
|
||||
detail = quark_motion;
|
||||
break;
|
||||
case CLUTTER_ENTER:
|
||||
case CLUTTER_LEAVE:
|
||||
detail = quark_pointer_focus;
|
||||
break;
|
||||
case CLUTTER_BUTTON_PRESS:
|
||||
case CLUTTER_BUTTON_RELEASE:
|
||||
detail = quark_button;
|
||||
break;
|
||||
case CLUTTER_SCROLL:
|
||||
detail = quark_scroll;
|
||||
break;
|
||||
case CLUTTER_STAGE_STATE:
|
||||
detail = quark_stage;
|
||||
break;
|
||||
case CLUTTER_DESTROY_NOTIFY:
|
||||
detail = quark_destroy;
|
||||
break;
|
||||
case CLUTTER_CLIENT_MESSAGE:
|
||||
detail = quark_client;
|
||||
break;
|
||||
case CLUTTER_DELETE:
|
||||
detail = quark_delete;
|
||||
break;
|
||||
case CLUTTER_TOUCH_BEGIN:
|
||||
case CLUTTER_TOUCH_UPDATE:
|
||||
case CLUTTER_TOUCH_END:
|
||||
case CLUTTER_TOUCH_CANCEL:
|
||||
detail = quark_touch;
|
||||
break;
|
||||
case CLUTTER_TOUCHPAD_PINCH:
|
||||
case CLUTTER_TOUCHPAD_SWIPE:
|
||||
detail = quark_touchpad;
|
||||
break;
|
||||
case CLUTTER_PROXIMITY_IN:
|
||||
case CLUTTER_PROXIMITY_OUT:
|
||||
detail = quark_proximity;
|
||||
break;
|
||||
case CLUTTER_PAD_BUTTON_PRESS:
|
||||
case CLUTTER_PAD_BUTTON_RELEASE:
|
||||
case CLUTTER_PAD_STRIP:
|
||||
case CLUTTER_PAD_RING:
|
||||
detail = quark_pad;
|
||||
break;
|
||||
case CLUTTER_EVENT_LAST: /* Just keep compiler warnings quiet */
|
||||
break;
|
||||
}
|
||||
|
||||
g_signal_emit (actor,
|
||||
actor_signals[CAPTURED_EVENT],
|
||||
detail,
|
||||
event,
|
||||
g_signal_emit (actor, actor_signals[CAPTURED_EVENT], 0,
|
||||
event,
|
||||
&retval);
|
||||
goto out;
|
||||
}
|
||||
@@ -15844,7 +15660,7 @@ update_pango_context (ClutterBackend *backend,
|
||||
* stored by the #ClutterBackend change.
|
||||
*
|
||||
* You can use the returned #PangoContext to create a #PangoLayout
|
||||
* and render text using cogl_pango_show_layout() to reuse the
|
||||
* and render text using cogl_pango_render_layout() to reuse the
|
||||
* glyphs cache also used by Clutter.
|
||||
*
|
||||
* Return value: (transfer none): the #PangoContext for a #ClutterActor.
|
||||
@@ -15999,63 +15815,6 @@ clutter_actor_get_opacity_override (ClutterActor *self)
|
||||
return self->priv->opacity_override;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_inhibit_culling:
|
||||
* @actor: a #ClutterActor
|
||||
*
|
||||
* Increases the culling inhibitor counter. Inhibiting culling
|
||||
* forces the actor to be painted even when outside the visible
|
||||
* bounds of the stage view.
|
||||
*
|
||||
* This is usually necessary when an actor is being painted on
|
||||
* another paint context.
|
||||
*
|
||||
* Pair with clutter_actor_uninhibit_culling() when the actor doesn't
|
||||
* need to be painted anymore.
|
||||
*/
|
||||
void
|
||||
clutter_actor_inhibit_culling (ClutterActor *actor)
|
||||
{
|
||||
ClutterActorPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
|
||||
|
||||
priv = actor->priv;
|
||||
|
||||
priv->inhibit_culling_counter++;
|
||||
_clutter_actor_set_enable_paint_unmapped (actor, TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_uninhibit_culling:
|
||||
* @actor: a #ClutterActor
|
||||
*
|
||||
* Decreases the culling inhibitor counter. See clutter_actor_inhibit_culling()
|
||||
* for when inhibit culling is necessary.
|
||||
*
|
||||
* Calling this function without a matching call to
|
||||
* clutter_actor_inhibit_culling() is a programming error.
|
||||
*/
|
||||
void
|
||||
clutter_actor_uninhibit_culling (ClutterActor *actor)
|
||||
{
|
||||
ClutterActorPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
|
||||
|
||||
priv = actor->priv;
|
||||
|
||||
if (priv->inhibit_culling_counter == 0)
|
||||
{
|
||||
g_critical ("Unpaired call to clutter_actor_uninhibit_culling");
|
||||
return;
|
||||
}
|
||||
|
||||
priv->inhibit_culling_counter--;
|
||||
if (priv->inhibit_culling_counter == 0)
|
||||
_clutter_actor_set_enable_paint_unmapped (actor, FALSE);
|
||||
}
|
||||
|
||||
/* Allows you to disable applying the actors model view transform during
|
||||
* a paint. Used by ClutterClone. */
|
||||
void
|
||||
@@ -17769,42 +17528,10 @@ _clutter_actor_compute_resource_scale (ClutterActor *self,
|
||||
resource_scale))
|
||||
{
|
||||
if (priv->parent)
|
||||
{
|
||||
gboolean in_clone_paint;
|
||||
gboolean was_parent_in_clone_paint;
|
||||
gboolean was_parent_unmapped;
|
||||
gboolean was_parent_paint_unmapped;
|
||||
gboolean ret;
|
||||
|
||||
in_clone_paint = clutter_actor_is_in_clone_paint (self);
|
||||
was_parent_unmapped = !clutter_actor_is_mapped (priv->parent);
|
||||
was_parent_in_clone_paint =
|
||||
clutter_actor_is_in_clone_paint (priv->parent);
|
||||
was_parent_paint_unmapped = priv->parent->priv->enable_paint_unmapped;
|
||||
|
||||
if (in_clone_paint && was_parent_unmapped)
|
||||
{
|
||||
_clutter_actor_set_in_clone_paint (priv->parent, TRUE);
|
||||
_clutter_actor_set_enable_paint_unmapped (priv->parent, TRUE);
|
||||
}
|
||||
|
||||
ret = _clutter_actor_compute_resource_scale (priv->parent,
|
||||
resource_scale);
|
||||
|
||||
if (in_clone_paint && was_parent_unmapped)
|
||||
{
|
||||
_clutter_actor_set_in_clone_paint (priv->parent,
|
||||
was_parent_in_clone_paint);
|
||||
_clutter_actor_set_enable_paint_unmapped (priv->parent,
|
||||
was_parent_paint_unmapped);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
return _clutter_actor_compute_resource_scale (priv->parent,
|
||||
resource_scale);
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -19455,8 +19182,8 @@ _clutter_actor_create_transition (ClutterActor *actor,
|
||||
gboolean call_restore = FALSE;
|
||||
TransitionClosure *clos;
|
||||
va_list var_args;
|
||||
g_auto (GValue) initial = G_VALUE_INIT;
|
||||
g_auto (GValue) final = G_VALUE_INIT;
|
||||
GValue initial = G_VALUE_INIT;
|
||||
GValue final = G_VALUE_INIT;
|
||||
GType ptype;
|
||||
char *error;
|
||||
|
||||
@@ -19505,6 +19232,7 @@ _clutter_actor_create_transition (ClutterActor *actor,
|
||||
if (error != NULL)
|
||||
{
|
||||
g_critical ("%s: %s", G_STRLOC, error);
|
||||
g_value_unset (&initial);
|
||||
g_free (error);
|
||||
goto out;
|
||||
}
|
||||
@@ -19526,6 +19254,9 @@ _clutter_actor_create_transition (ClutterActor *actor,
|
||||
&final,
|
||||
pspec);
|
||||
|
||||
g_value_unset (&initial);
|
||||
g_value_unset (&final);
|
||||
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -19573,6 +19304,9 @@ _clutter_actor_create_transition (ClutterActor *actor,
|
||||
|
||||
/* the actor now owns the transition */
|
||||
g_object_unref (res);
|
||||
|
||||
g_value_unset (&initial);
|
||||
g_value_unset (&final);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -19960,23 +19694,6 @@ clutter_actor_get_transition (ClutterActor *self,
|
||||
return clos->transition;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_has_transitions: (skip)
|
||||
*/
|
||||
gboolean
|
||||
clutter_actor_has_transitions (ClutterActor *self)
|
||||
{
|
||||
const ClutterAnimationInfo *info;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
|
||||
|
||||
info = _clutter_actor_get_animation_info_or_defaults (self);
|
||||
if (info->transitions == NULL)
|
||||
return FALSE;
|
||||
|
||||
return g_hash_table_size (info->transitions) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_save_easing_state:
|
||||
* @self: a #ClutterActor
|
||||
@@ -21076,6 +20793,32 @@ clutter_actor_has_mapped_clones (ClutterActor *self)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
CoglFramebuffer *
|
||||
_clutter_actor_get_active_framebuffer (ClutterActor *self)
|
||||
{
|
||||
ClutterStage *stage;
|
||||
|
||||
if (!CLUTTER_ACTOR_IN_PAINT (self))
|
||||
{
|
||||
g_critical ("The active framebuffer of actor '%s' can only be "
|
||||
"retrieved during the paint sequence. Please, check "
|
||||
"your code.",
|
||||
_clutter_actor_get_debug_name (self));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
stage = (ClutterStage *) _clutter_actor_get_stage_internal (self);
|
||||
if (stage == NULL)
|
||||
{
|
||||
g_critical ("The active framebuffer of actor '%s' is only available "
|
||||
"if the actor is associated to a ClutterStage.",
|
||||
_clutter_actor_get_debug_name (self));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return _clutter_stage_get_active_framebuffer (stage);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_child_model__items_changed (GListModel *model,
|
||||
guint position,
|
||||
@@ -21364,7 +21107,7 @@ clutter_actor_create_texture_paint_node (ClutterActor *self,
|
||||
color.alpha = clutter_actor_get_paint_opacity_internal (self);
|
||||
|
||||
node = clutter_texture_node_new (texture, &color, priv->min_filter, priv->mag_filter);
|
||||
clutter_paint_node_set_static_name (node, "Texture");
|
||||
clutter_paint_node_set_name (node, "Texture");
|
||||
|
||||
if (priv->content_repeat == CLUTTER_REPEAT_NONE)
|
||||
clutter_paint_node_add_rectangle (node, &box);
|
||||
@@ -21385,14 +21128,3 @@ clutter_actor_create_texture_paint_node (ClutterActor *self,
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
gboolean
|
||||
clutter_actor_has_accessible (ClutterActor *actor)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), FALSE);
|
||||
|
||||
if (CLUTTER_ACTOR_GET_CLASS (actor)->has_accessible)
|
||||
return CLUTTER_ACTOR_GET_CLASS (actor)->has_accessible (actor);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@@ -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,13 @@ 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);
|
||||
void clutter_actor_continue_paint (ClutterActor *self);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_pick (ClutterActor *actor,
|
||||
ClutterPickContext *pick_context);
|
||||
void clutter_actor_pick (ClutterActor *actor);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_continue_pick (ClutterActor *actor,
|
||||
ClutterPickContext *pick_context);
|
||||
void clutter_actor_continue_pick (ClutterActor *actor);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_queue_redraw (ClutterActor *self);
|
||||
CLUTTER_EXPORT
|
||||
@@ -381,8 +372,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 +873,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 +907,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
|
||||
|
@@ -50,6 +50,8 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterConstraint, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterContainer, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDeformEffect, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDesaturateEffect, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDragAction, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDropAction, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterEffect, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterFixedLayout, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterFlowLayout, g_object_unref)
|
||||
@@ -88,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)
|
||||
|
@@ -129,6 +129,9 @@ gfloat _clutter_backend_get_units_per_em (Clutter
|
||||
PangoFontDescription *font_desc);
|
||||
gint32 _clutter_backend_get_units_serial (ClutterBackend *backend);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void _clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend);
|
||||
|
||||
void clutter_set_allowed_drivers (const char *drivers);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
|
@@ -970,6 +970,27 @@ clutter_wayland_set_compositor_display (void *display)
|
||||
}
|
||||
#endif
|
||||
|
||||
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)
|
||||
{
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -238,7 +238,6 @@ click_action_query_long_press (ClutterClickAction *action)
|
||||
|
||||
if (result)
|
||||
{
|
||||
g_clear_handle_id (&priv->long_press_id, g_source_remove);
|
||||
priv->long_press_id =
|
||||
clutter_threads_add_timeout (timeout,
|
||||
click_action_emit_long_press,
|
||||
@@ -468,20 +467,6 @@ clutter_click_action_set_actor (ClutterActorMeta *meta,
|
||||
CLUTTER_ACTOR_META_CLASS (clutter_click_action_parent_class)->set_actor (meta, actor);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_click_action_set_enabled (ClutterActorMeta *meta,
|
||||
gboolean is_enabled)
|
||||
{
|
||||
ClutterClickAction *click_action = CLUTTER_CLICK_ACTION (meta);
|
||||
ClutterActorMetaClass *parent_class =
|
||||
CLUTTER_ACTOR_META_CLASS (clutter_click_action_parent_class);
|
||||
|
||||
if (!is_enabled)
|
||||
clutter_click_action_release (click_action);
|
||||
|
||||
parent_class->set_enabled (meta, is_enabled);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_click_action_set_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
@@ -561,7 +546,6 @@ clutter_click_action_class_init (ClutterClickActionClass *klass)
|
||||
ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
|
||||
|
||||
meta_class->set_actor = clutter_click_action_set_actor;
|
||||
meta_class->set_enabled = clutter_click_action_set_enabled;
|
||||
|
||||
gobject_class->dispose = clutter_click_action_dispose;
|
||||
gobject_class->set_property = clutter_click_action_set_property;
|
||||
|
@@ -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 ();
|
||||
}
|
||||
|
||||
|
@@ -105,8 +105,7 @@ G_DEFINE_TYPE (ClutterColorizeEffect,
|
||||
CLUTTER_TYPE_OFFSCREEN_EFFECT);
|
||||
|
||||
static gboolean
|
||||
clutter_colorize_effect_pre_paint (ClutterEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_colorize_effect_pre_paint (ClutterEffect *effect)
|
||||
{
|
||||
ClutterColorizeEffect *self = CLUTTER_COLORIZE_EFFECT (effect);
|
||||
ClutterEffectClass *parent_class;
|
||||
@@ -127,7 +126,7 @@ clutter_colorize_effect_pre_paint (ClutterEffect *effect,
|
||||
}
|
||||
|
||||
parent_class = CLUTTER_EFFECT_CLASS (clutter_colorize_effect_parent_class);
|
||||
if (parent_class->pre_paint (effect, paint_context))
|
||||
if (parent_class->pre_paint (effect))
|
||||
{
|
||||
ClutterOffscreenEffect *offscreen_effect =
|
||||
CLUTTER_OFFSCREEN_EFFECT (effect);
|
||||
@@ -146,12 +145,10 @@ clutter_colorize_effect_pre_paint (ClutterEffect *effect,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_colorize_effect_paint_target (ClutterOffscreenEffect *effect,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_colorize_effect_paint_target (ClutterOffscreenEffect *effect)
|
||||
{
|
||||
ClutterColorizeEffect *self = CLUTTER_COLORIZE_EFFECT (effect);
|
||||
CoglFramebuffer *framebuffer =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
|
||||
ClutterActor *actor;
|
||||
guint8 paint_opacity;
|
||||
|
||||
|
@@ -9,13 +9,7 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#mesondefine CLUTTER_HAS_WAYLAND_COMPOSITOR_SUPPORT
|
||||
#mesondefine CLUTTER_WINDOWING_X11
|
||||
#mesondefine CLUTTER_INPUT_X11
|
||||
#mesondefine CLUTTER_WINDOWING_GLX
|
||||
#mesondefine CLUTTER_WINDOWING_EGL
|
||||
#mesondefine CLUTTER_INPUT_EVDEV
|
||||
#mesondefine CLUTTER_INPUT_NULL
|
||||
@CLUTTER_CONFIG_DEFINES@
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@@ -30,6 +30,13 @@ gboolean clutter_constraint_update_allocation (ClutterConstraint *constraint,
|
||||
ClutterActor *actor,
|
||||
ClutterActorBox *allocation);
|
||||
|
||||
void clutter_constraint_update_preferred_size (ClutterConstraint *constraint,
|
||||
ClutterActor *actor,
|
||||
ClutterOrientation direction,
|
||||
float for_size,
|
||||
float *minimum_size,
|
||||
float *natural_size);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_CONSTRAINT_PRIVATE_H__ */
|
||||
|
@@ -160,26 +160,28 @@ constraint_update_preferred_size (ClutterConstraint *constraint,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_constraint_set_enabled (ClutterActorMeta *meta,
|
||||
gboolean is_enabled)
|
||||
clutter_constraint_notify (GObject *gobject,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterActorMetaClass *parent_class =
|
||||
CLUTTER_ACTOR_META_CLASS (clutter_constraint_parent_class);
|
||||
ClutterActor *actor;
|
||||
if (strcmp (pspec->name, "enabled") == 0)
|
||||
{
|
||||
ClutterActorMeta *meta = CLUTTER_ACTOR_META (gobject);
|
||||
ClutterActor *actor = clutter_actor_meta_get_actor (meta);
|
||||
|
||||
actor = clutter_actor_meta_get_actor (meta);
|
||||
if (actor)
|
||||
clutter_actor_queue_relayout (actor);
|
||||
if (actor != NULL)
|
||||
clutter_actor_queue_relayout (actor);
|
||||
}
|
||||
|
||||
parent_class->set_enabled (meta, is_enabled);
|
||||
if (G_OBJECT_CLASS (clutter_constraint_parent_class)->notify != NULL)
|
||||
G_OBJECT_CLASS (clutter_constraint_parent_class)->notify (gobject, pspec);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_constraint_class_init (ClutterConstraintClass *klass)
|
||||
{
|
||||
ClutterActorMetaClass *actor_meta_class = CLUTTER_ACTOR_META_CLASS (klass);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
actor_meta_class->set_enabled = clutter_constraint_set_enabled;
|
||||
gobject_class->notify = clutter_constraint_notify;
|
||||
|
||||
klass->update_allocation = constraint_update_allocation;
|
||||
klass->update_preferred_size = constraint_update_preferred_size;
|
||||
@@ -220,17 +222,6 @@ clutter_constraint_update_allocation (ClutterConstraint *constraint,
|
||||
return !clutter_actor_box_equal (allocation, &old_alloc);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_constraint_update_preferred_size:
|
||||
* @constraint: a #ClutterConstraint
|
||||
* @actor: a #ClutterActor
|
||||
* @direction: a #ClutterOrientation
|
||||
* @for_size: the size in the opposite direction
|
||||
* @minimum_size: (inout): the minimum size to modify
|
||||
* @natural_size: (inout): the natural size to modify
|
||||
*
|
||||
* Asks the @constraint to update the size request of a #ClutterActor.
|
||||
*/
|
||||
void
|
||||
clutter_constraint_update_preferred_size (ClutterConstraint *constraint,
|
||||
ClutterActor *actor,
|
||||
|
@@ -99,14 +99,6 @@ struct _ClutterConstraintClass
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_constraint_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_constraint_update_preferred_size (ClutterConstraint *constraint,
|
||||
ClutterActor *actor,
|
||||
ClutterOrientation direction,
|
||||
float for_size,
|
||||
float *minimum_size,
|
||||
float *natural_size);
|
||||
|
||||
/* ClutterActor API */
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_add_constraint (ClutterActor *self,
|
||||
|
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright 2020 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __CLUTTER_CONTAINER_PRIVATE_H__
|
||||
#define __CLUTTER_CONTAINER_PRIVATE_H__
|
||||
|
||||
#include <clutter/clutter-container.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void _clutter_container_emit_actor_added (ClutterContainer *container,
|
||||
ClutterActor *actor);
|
||||
void _clutter_container_emit_actor_removed (ClutterContainer *container,
|
||||
ClutterActor *actor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_CONTAINER_PRIVATE_H__ */
|
@@ -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"
|
||||
@@ -1251,23 +1250,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);
|
||||
|
@@ -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)
|
||||
{
|
||||
|
@@ -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;
|
||||
|
1316
clutter/clutter/clutter-drag-action.c
Normal file
1316
clutter/clutter/clutter-drag-action.c
Normal file
File diff suppressed because it is too large
Load Diff
152
clutter/clutter/clutter-drag-action.h
Normal file
152
clutter/clutter/clutter-drag-action.h
Normal file
@@ -0,0 +1,152 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright (C) 2010 Intel Corporation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author:
|
||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
#ifndef __CLUTTER_DRAG_ACTION_H__
|
||||
#define __CLUTTER_DRAG_ACTION_H__
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <clutter/clutter-action.h>
|
||||
#include <clutter/clutter-event.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_DRAG_ACTION (clutter_drag_action_get_type ())
|
||||
#define CLUTTER_DRAG_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_DRAG_ACTION, ClutterDragAction))
|
||||
#define CLUTTER_IS_DRAG_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_DRAG_ACTION))
|
||||
#define CLUTTER_DRAG_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_DRAG_ACTION, ClutterDragActionClass))
|
||||
#define CLUTTER_IS_DRAG_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_DRAG_ACTION))
|
||||
#define CLUTTER_DRAG_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_DRAG_ACTION, ClutterDragActionClass))
|
||||
|
||||
typedef struct _ClutterDragAction ClutterDragAction;
|
||||
typedef struct _ClutterDragActionPrivate ClutterDragActionPrivate;
|
||||
typedef struct _ClutterDragActionClass ClutterDragActionClass;
|
||||
|
||||
/**
|
||||
* ClutterDragAction:
|
||||
*
|
||||
* The #ClutterDragAction structure contains only
|
||||
* private data and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _ClutterDragAction
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterAction parent_instance;
|
||||
|
||||
ClutterDragActionPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterDragActionClass:
|
||||
* @drag_begin: class handler of the #ClutterDragAction::drag-begin signal
|
||||
* @drag_motion: class handler of the #ClutterDragAction::drag-motion signal
|
||||
* @drag_end: class handler of the #ClutterDragAction::drag-end signal
|
||||
* @drag_progress: class handler of the #ClutterDragAction::drag-progress signal
|
||||
*
|
||||
* The #ClutterDragActionClass structure contains
|
||||
* only private data
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _ClutterDragActionClass
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterActionClass parent_class;
|
||||
|
||||
/*< public >*/
|
||||
void (* drag_begin) (ClutterDragAction *action,
|
||||
ClutterActor *actor,
|
||||
gfloat event_x,
|
||||
gfloat event_y,
|
||||
ClutterModifierType modifiers);
|
||||
void (* drag_motion) (ClutterDragAction *action,
|
||||
ClutterActor *actor,
|
||||
gfloat delta_x,
|
||||
gfloat delta_y);
|
||||
void (* drag_end) (ClutterDragAction *action,
|
||||
ClutterActor *actor,
|
||||
gfloat event_x,
|
||||
gfloat event_y,
|
||||
ClutterModifierType modifiers);
|
||||
gboolean (* drag_progress) (ClutterDragAction *action,
|
||||
ClutterActor *actor,
|
||||
gfloat delta_x,
|
||||
gfloat delta_y);
|
||||
|
||||
/*< private >*/
|
||||
void (* _clutter_drag_action1) (void);
|
||||
void (* _clutter_drag_action2) (void);
|
||||
void (* _clutter_drag_action3) (void);
|
||||
void (* _clutter_drag_action4) (void);
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_drag_action_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterAction * clutter_drag_action_new (void);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_drag_action_set_drag_threshold (ClutterDragAction *action,
|
||||
gint x_threshold,
|
||||
gint y_threshold);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_drag_action_get_drag_threshold (ClutterDragAction *action,
|
||||
guint *x_threshold,
|
||||
guint *y_threshold);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_drag_action_set_drag_handle (ClutterDragAction *action,
|
||||
ClutterActor *handle);
|
||||
CLUTTER_EXPORT
|
||||
ClutterActor * clutter_drag_action_get_drag_handle (ClutterDragAction *action);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_drag_action_set_drag_axis (ClutterDragAction *action,
|
||||
ClutterDragAxis axis);
|
||||
CLUTTER_EXPORT
|
||||
ClutterDragAxis clutter_drag_action_get_drag_axis (ClutterDragAction *action);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_drag_action_get_press_coords (ClutterDragAction *action,
|
||||
gfloat *press_x,
|
||||
gfloat *press_y);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_drag_action_get_motion_coords (ClutterDragAction *action,
|
||||
gfloat *motion_x,
|
||||
gfloat *motion_y);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_drag_action_get_drag_area (ClutterDragAction *action,
|
||||
graphene_rect_t *drag_area);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_drag_action_set_drag_area (ClutterDragAction *action,
|
||||
const graphene_rect_t *drag_area);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_DRAG_ACTION_H__ */
|
527
clutter/clutter/clutter-drop-action.c
Normal file
527
clutter/clutter/clutter-drop-action.c
Normal file
@@ -0,0 +1,527 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright © 2011 Intel Corporation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author:
|
||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:clutter-drop-action
|
||||
* @Title: ClutterDropAction
|
||||
* @short_description: An action for drop targets
|
||||
*
|
||||
* #ClutterDropAction is a #ClutterAction that allows a #ClutterActor
|
||||
* implementation to control what happens when an actor dragged using
|
||||
* a #ClutterDragAction crosses the target area or when a dragged actor
|
||||
* is released (or "dropped") on the target area.
|
||||
*
|
||||
* A trivial use of #ClutterDropAction consists in connecting to the
|
||||
* #ClutterDropAction::drop signal and handling the drop from there,
|
||||
* for instance:
|
||||
*
|
||||
* |[<!-- language="C" -->
|
||||
* ClutterAction *action = clutter_drop_action ();
|
||||
*
|
||||
* g_signal_connect (action, "drop", G_CALLBACK (on_drop), NULL);
|
||||
* clutter_actor_add_action (an_actor, action);
|
||||
* ]|
|
||||
*
|
||||
* The #ClutterDropAction::can-drop can be used to control whether the
|
||||
* #ClutterDropAction::drop signal is going to be emitted; returning %FALSE
|
||||
* from a handler connected to the #ClutterDropAction::can-drop signal will
|
||||
* cause the #ClutterDropAction::drop signal to be skipped when the input
|
||||
* device button is released.
|
||||
*
|
||||
* It's important to note that #ClutterDropAction will only work with
|
||||
* actors dragged using #ClutterDragAction.
|
||||
*
|
||||
* See [drop-action.c](https://git.gnome.org/browse/clutter/tree/examples/drop-action.c?h=clutter-1.18)
|
||||
* for an example of how to use #ClutterDropAction.
|
||||
*
|
||||
* #ClutterDropAction is available since Clutter 1.8
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter-drop-action.h"
|
||||
|
||||
#include "clutter-actor-meta-private.h"
|
||||
#include "clutter-actor-private.h"
|
||||
#include "clutter-drag-action.h"
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-marshal.h"
|
||||
#include "clutter-stage-private.h"
|
||||
|
||||
struct _ClutterDropActionPrivate
|
||||
{
|
||||
ClutterActor *actor;
|
||||
ClutterActor *stage;
|
||||
|
||||
gulong mapped_id;
|
||||
};
|
||||
|
||||
typedef struct _DropTarget {
|
||||
ClutterActor *stage;
|
||||
|
||||
gulong capture_id;
|
||||
|
||||
GHashTable *actions;
|
||||
|
||||
ClutterDropAction *last_action;
|
||||
} DropTarget;
|
||||
|
||||
enum
|
||||
{
|
||||
CAN_DROP,
|
||||
OVER_IN,
|
||||
OVER_OUT,
|
||||
DROP,
|
||||
DROP_CANCEL,
|
||||
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint drop_signals[LAST_SIGNAL] = { 0, };
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterDropAction, clutter_drop_action, CLUTTER_TYPE_ACTION)
|
||||
|
||||
static void
|
||||
drop_target_free (gpointer _data)
|
||||
{
|
||||
DropTarget *data = _data;
|
||||
|
||||
g_clear_signal_handler (&data->capture_id, data->stage);
|
||||
g_hash_table_destroy (data->actions);
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
on_stage_capture (ClutterStage *stage,
|
||||
ClutterEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
DropTarget *data = user_data;
|
||||
gfloat event_x, event_y;
|
||||
ClutterActor *actor, *drag_actor;
|
||||
ClutterDropAction *drop_action;
|
||||
ClutterInputDevice *device;
|
||||
gboolean was_reactive;
|
||||
|
||||
switch (clutter_event_type (event))
|
||||
{
|
||||
case CLUTTER_MOTION:
|
||||
case CLUTTER_BUTTON_RELEASE:
|
||||
if (clutter_event_type (event) == CLUTTER_MOTION &&
|
||||
!(clutter_event_get_state (event) & CLUTTER_BUTTON1_MASK))
|
||||
return CLUTTER_EVENT_PROPAGATE;
|
||||
|
||||
if (clutter_event_type (event) == CLUTTER_BUTTON_RELEASE &&
|
||||
clutter_event_get_button (event) != CLUTTER_BUTTON_PRIMARY)
|
||||
return CLUTTER_EVENT_PROPAGATE;
|
||||
|
||||
device = clutter_event_get_device (event);
|
||||
drag_actor = _clutter_stage_get_pointer_drag_actor (stage, device);
|
||||
if (drag_actor == NULL)
|
||||
return CLUTTER_EVENT_PROPAGATE;
|
||||
break;
|
||||
|
||||
case CLUTTER_TOUCH_UPDATE:
|
||||
case CLUTTER_TOUCH_END:
|
||||
drag_actor = _clutter_stage_get_touch_drag_actor (stage,
|
||||
clutter_event_get_event_sequence (event));
|
||||
if (drag_actor == NULL)
|
||||
return CLUTTER_EVENT_PROPAGATE;
|
||||
break;
|
||||
|
||||
default:
|
||||
return CLUTTER_EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
clutter_event_get_coords (event, &event_x, &event_y);
|
||||
|
||||
/* get the actor under the cursor, excluding the dragged actor; we
|
||||
* use reactivity because it won't cause any scene invalidation
|
||||
*/
|
||||
was_reactive = clutter_actor_get_reactive (drag_actor);
|
||||
clutter_actor_set_reactive (drag_actor, FALSE);
|
||||
|
||||
actor = clutter_stage_get_actor_at_pos (stage, CLUTTER_PICK_REACTIVE,
|
||||
event_x,
|
||||
event_y);
|
||||
if (actor == NULL || actor == CLUTTER_ACTOR (stage))
|
||||
{
|
||||
if (data->last_action != NULL)
|
||||
{
|
||||
ClutterActorMeta *meta = CLUTTER_ACTOR_META (data->last_action);
|
||||
|
||||
g_signal_emit (data->last_action, drop_signals[OVER_OUT], 0,
|
||||
clutter_actor_meta_get_actor (meta));
|
||||
|
||||
data->last_action = NULL;
|
||||
}
|
||||
|
||||
goto out;
|
||||
}
|
||||
|
||||
drop_action = g_hash_table_lookup (data->actions, actor);
|
||||
|
||||
if (drop_action == NULL)
|
||||
{
|
||||
if (data->last_action != NULL)
|
||||
{
|
||||
ClutterActorMeta *meta = CLUTTER_ACTOR_META (data->last_action);
|
||||
|
||||
g_signal_emit (data->last_action, drop_signals[OVER_OUT], 0,
|
||||
clutter_actor_meta_get_actor (meta));
|
||||
|
||||
data->last_action = NULL;
|
||||
}
|
||||
|
||||
goto out;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (data->last_action != drop_action)
|
||||
{
|
||||
ClutterActorMeta *meta;
|
||||
|
||||
if (data->last_action != NULL)
|
||||
{
|
||||
meta = CLUTTER_ACTOR_META (data->last_action);
|
||||
|
||||
g_signal_emit (data->last_action, drop_signals[OVER_OUT], 0,
|
||||
clutter_actor_meta_get_actor (meta));
|
||||
}
|
||||
|
||||
meta = CLUTTER_ACTOR_META (drop_action);
|
||||
|
||||
g_signal_emit (drop_action, drop_signals[OVER_IN], 0,
|
||||
clutter_actor_meta_get_actor (meta));
|
||||
}
|
||||
|
||||
data->last_action = drop_action;
|
||||
}
|
||||
|
||||
out:
|
||||
if (clutter_event_type (event) == CLUTTER_BUTTON_RELEASE ||
|
||||
clutter_event_type (event) == CLUTTER_TOUCH_END)
|
||||
{
|
||||
if (data->last_action != NULL)
|
||||
{
|
||||
ClutterActorMeta *meta = CLUTTER_ACTOR_META (data->last_action);
|
||||
gboolean can_drop = FALSE;
|
||||
|
||||
g_signal_emit (data->last_action, drop_signals[CAN_DROP], 0,
|
||||
clutter_actor_meta_get_actor (meta),
|
||||
event_x, event_y,
|
||||
&can_drop);
|
||||
|
||||
if (can_drop)
|
||||
{
|
||||
g_signal_emit (data->last_action, drop_signals[DROP], 0,
|
||||
clutter_actor_meta_get_actor (meta),
|
||||
event_x, event_y);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_signal_emit (data->last_action, drop_signals[DROP_CANCEL], 0,
|
||||
clutter_actor_meta_get_actor (meta),
|
||||
event_x, event_y);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
data->last_action = NULL;
|
||||
}
|
||||
|
||||
if (drag_actor != NULL)
|
||||
clutter_actor_set_reactive (drag_actor, was_reactive);
|
||||
|
||||
return CLUTTER_EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
static void
|
||||
drop_action_register (ClutterDropAction *self)
|
||||
{
|
||||
ClutterDropActionPrivate *priv = self->priv;
|
||||
DropTarget *data;
|
||||
|
||||
g_assert (priv->stage != NULL);
|
||||
|
||||
data = g_object_get_data (G_OBJECT (priv->stage), "__clutter_drop_targets");
|
||||
if (data == NULL)
|
||||
{
|
||||
data = g_new0 (DropTarget, 1);
|
||||
|
||||
data->stage = priv->stage;
|
||||
data->actions = g_hash_table_new (NULL, NULL);
|
||||
data->capture_id = g_signal_connect (priv->stage, "captured-event",
|
||||
G_CALLBACK (on_stage_capture),
|
||||
data);
|
||||
g_object_set_data_full (G_OBJECT (priv->stage), "__clutter_drop_targets",
|
||||
data,
|
||||
drop_target_free);
|
||||
}
|
||||
|
||||
g_hash_table_replace (data->actions, priv->actor, self);
|
||||
}
|
||||
|
||||
static void
|
||||
drop_action_unregister (ClutterDropAction *self)
|
||||
{
|
||||
ClutterDropActionPrivate *priv = self->priv;
|
||||
DropTarget *data = NULL;
|
||||
|
||||
if (priv->stage != NULL)
|
||||
data = g_object_get_data (G_OBJECT (priv->stage), "__clutter_drop_targets");
|
||||
|
||||
if (data == NULL)
|
||||
return;
|
||||
|
||||
g_hash_table_remove (data->actions, priv->actor);
|
||||
if (g_hash_table_size (data->actions) == 0)
|
||||
g_object_set_data (G_OBJECT (data->stage), "__clutter_drop_targets", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
on_actor_mapped (ClutterActor *actor,
|
||||
GParamSpec *pspec,
|
||||
ClutterDropAction *self)
|
||||
{
|
||||
if (clutter_actor_is_mapped (actor))
|
||||
{
|
||||
if (self->priv->stage == NULL)
|
||||
self->priv->stage = clutter_actor_get_stage (actor);
|
||||
|
||||
drop_action_register (self);
|
||||
}
|
||||
else
|
||||
drop_action_unregister (self);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_drop_action_set_actor (ClutterActorMeta *meta,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
ClutterDropActionPrivate *priv = CLUTTER_DROP_ACTION (meta)->priv;
|
||||
|
||||
if (priv->actor != NULL)
|
||||
{
|
||||
drop_action_unregister (CLUTTER_DROP_ACTION (meta));
|
||||
|
||||
g_clear_signal_handler (&priv->mapped_id, priv->actor);
|
||||
|
||||
priv->stage = NULL;
|
||||
priv->actor = NULL;
|
||||
}
|
||||
|
||||
priv->actor = actor;
|
||||
|
||||
if (priv->actor != NULL)
|
||||
{
|
||||
priv->stage = clutter_actor_get_stage (actor);
|
||||
priv->mapped_id = g_signal_connect (actor, "notify::mapped",
|
||||
G_CALLBACK (on_actor_mapped),
|
||||
meta);
|
||||
|
||||
if (priv->stage != NULL)
|
||||
drop_action_register (CLUTTER_DROP_ACTION (meta));
|
||||
}
|
||||
|
||||
CLUTTER_ACTOR_META_CLASS (clutter_drop_action_parent_class)->set_actor (meta, actor);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
signal_accumulator (GSignalInvocationHint *ihint,
|
||||
GValue *return_accu,
|
||||
const GValue *handler_return,
|
||||
gpointer user_data)
|
||||
{
|
||||
gboolean continue_emission;
|
||||
|
||||
continue_emission = g_value_get_boolean (handler_return);
|
||||
g_value_set_boolean (return_accu, continue_emission);
|
||||
|
||||
return continue_emission;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_drop_action_real_can_drop (ClutterDropAction *action,
|
||||
ClutterActor *actor,
|
||||
gfloat event_x,
|
||||
gfloat event_y)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_drop_action_class_init (ClutterDropActionClass *klass)
|
||||
{
|
||||
ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
|
||||
|
||||
meta_class->set_actor = clutter_drop_action_set_actor;
|
||||
|
||||
klass->can_drop = clutter_drop_action_real_can_drop;
|
||||
|
||||
/**
|
||||
* ClutterDropAction::can-drop:
|
||||
* @action: the #ClutterDropAction that emitted the signal
|
||||
* @actor: the #ClutterActor attached to the @action
|
||||
* @event_x: the X coordinate (in stage space) of the drop event
|
||||
* @event_y: the Y coordinate (in stage space) of the drop event
|
||||
*
|
||||
* The ::can-drop signal is emitted when the dragged actor is dropped
|
||||
* on @actor. The return value of the ::can-drop signal will determine
|
||||
* whether or not the #ClutterDropAction::drop signal is going to be
|
||||
* emitted on @action.
|
||||
*
|
||||
* The default implementation of #ClutterDropAction returns %TRUE for
|
||||
* this signal.
|
||||
*
|
||||
* Return value: %TRUE if the drop is accepted, and %FALSE otherwise
|
||||
*
|
||||
* Since: 1.8
|
||||
*/
|
||||
drop_signals[CAN_DROP] =
|
||||
g_signal_new (I_("can-drop"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ClutterDropActionClass, can_drop),
|
||||
signal_accumulator, NULL,
|
||||
_clutter_marshal_BOOLEAN__OBJECT_FLOAT_FLOAT,
|
||||
G_TYPE_BOOLEAN, 3,
|
||||
CLUTTER_TYPE_ACTOR,
|
||||
G_TYPE_FLOAT,
|
||||
G_TYPE_FLOAT);
|
||||
|
||||
/**
|
||||
* ClutterDropAction::over-in:
|
||||
* @action: the #ClutterDropAction that emitted the signal
|
||||
* @actor: the #ClutterActor attached to the @action
|
||||
*
|
||||
* The ::over-in signal is emitted when the dragged actor crosses
|
||||
* into @actor.
|
||||
*
|
||||
* Since: 1.8
|
||||
*/
|
||||
drop_signals[OVER_IN] =
|
||||
g_signal_new (I_("over-in"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ClutterDropActionClass, over_in),
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_ACTOR);
|
||||
|
||||
/**
|
||||
* ClutterDropAction::over-out:
|
||||
* @action: the #ClutterDropAction that emitted the signal
|
||||
* @actor: the #ClutterActor attached to the @action
|
||||
*
|
||||
* The ::over-out signal is emitted when the dragged actor crosses
|
||||
* outside @actor.
|
||||
*
|
||||
* Since: 1.8
|
||||
*/
|
||||
drop_signals[OVER_OUT] =
|
||||
g_signal_new (I_("over-out"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ClutterDropActionClass, over_out),
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_ACTOR);
|
||||
|
||||
/**
|
||||
* ClutterDropAction::drop:
|
||||
* @action: the #ClutterDropAction that emitted the signal
|
||||
* @actor: the #ClutterActor attached to the @action
|
||||
* @event_x: the X coordinate (in stage space) of the drop event
|
||||
* @event_y: the Y coordinate (in stage space) of the drop event
|
||||
*
|
||||
* The ::drop signal is emitted when the dragged actor is dropped
|
||||
* on @actor. This signal is only emitted if at least an handler of
|
||||
* #ClutterDropAction::can-drop returns %TRUE.
|
||||
*
|
||||
* Since: 1.8
|
||||
*/
|
||||
drop_signals[DROP] =
|
||||
g_signal_new (I_("drop"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ClutterDropActionClass, drop),
|
||||
NULL, NULL,
|
||||
_clutter_marshal_VOID__OBJECT_FLOAT_FLOAT,
|
||||
G_TYPE_NONE, 3,
|
||||
CLUTTER_TYPE_ACTOR,
|
||||
G_TYPE_FLOAT,
|
||||
G_TYPE_FLOAT);
|
||||
|
||||
|
||||
/**
|
||||
* ClutterDropAction::drop-cancel:
|
||||
* @action: the #ClutterDropAction that emitted the signal
|
||||
* @actor: the #ClutterActor attached to the @action
|
||||
* @event_x: the X coordinate (in stage space) of the drop event
|
||||
* @event_y: the Y coordinate (in stage space) of the drop event
|
||||
*
|
||||
* The ::drop-cancel signal is emitted when the drop is refused
|
||||
* by an emission of the #ClutterDropAction::can-drop signal.
|
||||
*
|
||||
* After the ::drop-cancel signal is fired the active drag is
|
||||
* terminated.
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
drop_signals[DROP_CANCEL] =
|
||||
g_signal_new (I_("drop-cancel"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (ClutterDropActionClass, drop),
|
||||
NULL, NULL,
|
||||
_clutter_marshal_VOID__OBJECT_FLOAT_FLOAT,
|
||||
G_TYPE_NONE, 3,
|
||||
CLUTTER_TYPE_ACTOR,
|
||||
G_TYPE_FLOAT,
|
||||
G_TYPE_FLOAT);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_drop_action_init (ClutterDropAction *self)
|
||||
{
|
||||
self->priv = clutter_drop_action_get_instance_private (self);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_drop_action_new:
|
||||
*
|
||||
* Creates a new #ClutterDropAction.
|
||||
*
|
||||
* Use clutter_actor_add_action() to add the action to a #ClutterActor.
|
||||
*
|
||||
* Return value: the newly created #ClutterDropAction
|
||||
*
|
||||
* Since: 1.8
|
||||
*/
|
||||
ClutterAction *
|
||||
clutter_drop_action_new (void)
|
||||
{
|
||||
return g_object_new (CLUTTER_TYPE_DROP_ACTION, NULL);
|
||||
}
|
115
clutter/clutter/clutter-drop-action.h
Normal file
115
clutter/clutter/clutter-drop-action.h
Normal file
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright © 2011 Intel Corporation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author:
|
||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
*/
|
||||
|
||||
#ifndef __CLUTTER_DROP_ACTION_H__
|
||||
#define __CLUTTER_DROP_ACTION_H__
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be directly included."
|
||||
#endif
|
||||
|
||||
#include <clutter/clutter-action.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_DROP_ACTION (clutter_drop_action_get_type ())
|
||||
#define CLUTTER_DROP_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_DROP_ACTION, ClutterDropAction))
|
||||
#define CLUTTER_IS_DROP_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_DROP_ACTION))
|
||||
#define CLUTTER_DROP_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_DROP_ACTION, ClutterDropActionClass))
|
||||
#define CLUTTER_IS_DROP_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_DROP_ACTION))
|
||||
#define CLUTTER_DROP_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_DROP_ACTION, ClutterDropActionClass))
|
||||
|
||||
typedef struct _ClutterDropAction ClutterDropAction;
|
||||
typedef struct _ClutterDropActionPrivate ClutterDropActionPrivate;
|
||||
typedef struct _ClutterDropActionClass ClutterDropActionClass;
|
||||
|
||||
/**
|
||||
* ClutterDropAction:
|
||||
*
|
||||
* The #ClutterDropAction structure contains only
|
||||
* private data and should be accessed using the provided API.
|
||||
*
|
||||
* Since: 1.8
|
||||
*/
|
||||
struct _ClutterDropAction
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterAction parent_instance;
|
||||
|
||||
ClutterDropActionPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterDropActionClass:
|
||||
* @can_drop: class handler for the #ClutterDropAction::can-drop signal
|
||||
* @over_in: class handler for the #ClutterDropAction::over-in signal
|
||||
* @over_out: class handler for the #ClutterDropAction::over-out signal
|
||||
* @drop: class handler for the #ClutterDropAction::drop signal
|
||||
*
|
||||
* The #ClutterDropActionClass structure contains
|
||||
* only private data.
|
||||
*
|
||||
* Since: 1.8
|
||||
*/
|
||||
struct _ClutterDropActionClass
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterActionClass parent_class;
|
||||
|
||||
/*< public >*/
|
||||
gboolean (* can_drop) (ClutterDropAction *action,
|
||||
ClutterActor *actor,
|
||||
gfloat event_x,
|
||||
gfloat event_y);
|
||||
|
||||
void (* over_in) (ClutterDropAction *action,
|
||||
ClutterActor *actor);
|
||||
void (* over_out) (ClutterDropAction *action,
|
||||
ClutterActor *actor);
|
||||
|
||||
void (* drop) (ClutterDropAction *action,
|
||||
ClutterActor *actor,
|
||||
gfloat event_x,
|
||||
gfloat event_y);
|
||||
|
||||
/*< private >*/
|
||||
void (*_clutter_drop_action1) (void);
|
||||
void (*_clutter_drop_action2) (void);
|
||||
void (*_clutter_drop_action3) (void);
|
||||
void (*_clutter_drop_action4) (void);
|
||||
void (*_clutter_drop_action5) (void);
|
||||
void (*_clutter_drop_action6) (void);
|
||||
void (*_clutter_drop_action7) (void);
|
||||
void (*_clutter_drop_action8) (void);
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_drop_action_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterAction * clutter_drop_action_new (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_DROP_ACTION_H__ */
|
@@ -5,18 +5,14 @@
|
||||
|
||||
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);
|
||||
void _clutter_effect_pick (ClutterEffect *effect);
|
||||
|
||||
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,47 +206,48 @@ 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)
|
||||
{
|
||||
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_pick (actor);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_effect_set_enabled (ClutterActorMeta *meta,
|
||||
gboolean is_enabled)
|
||||
clutter_effect_notify (GObject *gobject,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterActorMetaClass *parent_class =
|
||||
CLUTTER_ACTOR_META_CLASS (clutter_effect_parent_class);
|
||||
ClutterActor *actor;
|
||||
if (strcmp (pspec->name, "enabled") == 0)
|
||||
{
|
||||
ClutterActorMeta *meta = CLUTTER_ACTOR_META (gobject);
|
||||
ClutterActor *actor = clutter_actor_meta_get_actor (meta);
|
||||
|
||||
actor = clutter_actor_meta_get_actor (meta);
|
||||
if (actor)
|
||||
clutter_actor_queue_redraw (actor);
|
||||
if (actor != NULL)
|
||||
clutter_actor_queue_redraw (actor);
|
||||
}
|
||||
|
||||
parent_class->set_enabled (meta, is_enabled);
|
||||
if (G_OBJECT_CLASS (clutter_effect_parent_class)->notify != NULL)
|
||||
G_OBJECT_CLASS (clutter_effect_parent_class)->notify (gobject, pspec);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_effect_class_init (ClutterEffectClass *klass)
|
||||
{
|
||||
ClutterActorMetaClass *actor_meta_class = CLUTTER_ACTOR_META_CLASS (klass);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
actor_meta_class->set_enabled = clutter_effect_set_enabled;
|
||||
gobject_class->notify = clutter_effect_notify;
|
||||
|
||||
klass->pre_paint = clutter_effect_real_pre_paint;
|
||||
klass->post_paint = clutter_effect_real_post_paint;
|
||||
@@ -264,40 +262,36 @@ 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)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_EFFECT (effect));
|
||||
|
||||
CLUTTER_EFFECT_GET_CLASS (effect)->pick (effect, pick_context);
|
||||
CLUTTER_EFFECT_GET_CLASS (effect)->pick (effect);
|
||||
}
|
||||
|
||||
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,15 @@ 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);
|
||||
void (* pick) (ClutterEffect *effect);
|
||||
|
||||
/*< 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;
|
||||
|
||||
/**
|
||||
|
@@ -556,21 +556,6 @@ clutter_gesture_action_set_actor (ClutterActorMeta *meta,
|
||||
meta_class->set_actor (meta, actor);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_gesture_action_set_enabled (ClutterActorMeta *meta,
|
||||
gboolean is_enabled)
|
||||
{
|
||||
ClutterActorMetaClass *meta_class =
|
||||
CLUTTER_ACTOR_META_CLASS (clutter_gesture_action_parent_class);
|
||||
ClutterGestureAction *gesture_action = CLUTTER_GESTURE_ACTION (meta);
|
||||
ClutterGestureActionPrivate *priv = gesture_action->priv;
|
||||
|
||||
if (!is_enabled && priv->in_gesture)
|
||||
cancel_gesture (gesture_action);
|
||||
|
||||
meta_class->set_enabled (meta, is_enabled);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
default_event_handler (ClutterGestureAction *action,
|
||||
ClutterActor *actor)
|
||||
@@ -669,7 +654,6 @@ clutter_gesture_action_class_init (ClutterGestureActionClass *klass)
|
||||
gobject_class->get_property = clutter_gesture_action_get_property;
|
||||
|
||||
meta_class->set_actor = clutter_gesture_action_set_actor;
|
||||
meta_class->set_enabled = clutter_gesture_action_set_enabled;
|
||||
|
||||
klass->gesture_begin = default_event_handler;
|
||||
klass->gesture_progress = default_event_handler;
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -36,13 +36,13 @@ typedef struct _ClutterAxisInfo
|
||||
{
|
||||
ClutterInputAxis axis;
|
||||
|
||||
double min_axis;
|
||||
double max_axis;
|
||||
gdouble min_axis;
|
||||
gdouble max_axis;
|
||||
|
||||
double min_value;
|
||||
double max_value;
|
||||
gdouble min_value;
|
||||
gdouble max_value;
|
||||
|
||||
double resolution;
|
||||
gdouble resolution;
|
||||
} ClutterAxisInfo;
|
||||
|
||||
typedef struct _ClutterKeyInfo
|
||||
@@ -55,9 +55,9 @@ typedef struct _ClutterScrollInfo
|
||||
{
|
||||
guint axis_id;
|
||||
ClutterScrollDirection direction;
|
||||
double increment;
|
||||
gdouble increment;
|
||||
|
||||
double last_value;
|
||||
gdouble last_value;
|
||||
guint last_value_valid : 1;
|
||||
} ClutterScrollInfo;
|
||||
|
||||
@@ -66,8 +66,8 @@ typedef struct _ClutterTouchInfo
|
||||
ClutterEventSequence *sequence;
|
||||
ClutterActor *actor;
|
||||
|
||||
float current_x;
|
||||
float current_y;
|
||||
gfloat current_x;
|
||||
gfloat current_y;
|
||||
} ClutterTouchInfo;
|
||||
|
||||
typedef struct _ClutterPtrA11yData
|
||||
@@ -91,12 +91,12 @@ struct _ClutterInputDevice
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
int id;
|
||||
gint id;
|
||||
|
||||
ClutterInputDeviceType device_type;
|
||||
ClutterInputMode device_mode;
|
||||
|
||||
char *device_name;
|
||||
gchar *device_name;
|
||||
|
||||
ClutterSeat *seat;
|
||||
|
||||
@@ -118,26 +118,26 @@ struct _ClutterInputDevice
|
||||
GHashTable *inv_sequence_grab_actors;
|
||||
|
||||
/* the current click count */
|
||||
int click_count;
|
||||
gint 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;
|
||||
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 */
|
||||
int previous_x;
|
||||
int previous_y;
|
||||
uint32_t previous_time;
|
||||
int previous_button_number;
|
||||
gint previous_x;
|
||||
gint previous_y;
|
||||
guint32 previous_time;
|
||||
gint previous_button_number;
|
||||
ClutterModifierType previous_state;
|
||||
|
||||
GArray *axes;
|
||||
@@ -147,15 +147,15 @@ struct _ClutterInputDevice
|
||||
|
||||
GArray *scroll_info;
|
||||
|
||||
char *vendor_id;
|
||||
char *product_id;
|
||||
char *node_path;
|
||||
gchar *vendor_id;
|
||||
gchar *product_id;
|
||||
gchar *node_path;
|
||||
|
||||
GPtrArray *tools;
|
||||
|
||||
int n_rings;
|
||||
int n_strips;
|
||||
int n_mode_groups;
|
||||
gint n_rings;
|
||||
gint n_strips;
|
||||
gint n_mode_groups;
|
||||
|
||||
ClutterInputDeviceMapping mapping_mode;
|
||||
|
||||
@@ -200,10 +200,9 @@ 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);
|
||||
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);
|
||||
|
@@ -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)
|
||||
{
|
||||
@@ -798,7 +797,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 +1015,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 +1029,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;
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
|
@@ -63,7 +63,6 @@
|
||||
#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,12 @@ _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_event_get_device (event);
|
||||
_clutter_input_pointer_a11y_on_motion_event (core_pointer, x, y);
|
||||
}
|
||||
}
|
||||
#endif /* CLUTTER_WINDOWING_X11 */
|
||||
@@ -1872,7 +1870,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 +1878,10 @@ _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_event_get_device (event);
|
||||
_clutter_input_pointer_a11y_on_button_event (core_pointer,
|
||||
event->button.button,
|
||||
event->type == CLUTTER_BUTTON_PRESS);
|
||||
}
|
||||
@@ -1939,7 +1940,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 +2013,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 +2057,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");
|
||||
|
@@ -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"
|
||||
@@ -463,8 +461,6 @@ 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 = g_source_get_time (source);
|
||||
|
||||
@@ -496,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;
|
||||
|
@@ -36,9 +36,6 @@
|
||||
#include "cogl/clutter-stage-cogl.h"
|
||||
#include "clutter/x11/clutter-backend-x11.h"
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GList * clutter_stage_peek_stage_views (ClutterStage *stage);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_set_custom_backend_func (ClutterBackend *(* func) (void));
|
||||
|
||||
@@ -51,23 +48,6 @@ void clutter_stage_capture_into (ClutterStage *stage,
|
||||
cairo_rectangle_int_t *rect,
|
||||
uint8_t *data);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_stage_paint_to_framebuffer (ClutterStage *stage,
|
||||
CoglFramebuffer *framebuffer,
|
||||
const cairo_rectangle_int_t *rect,
|
||||
float scale,
|
||||
ClutterPaintFlag paint_flags);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_stage_paint_to_buffer (ClutterStage *stage,
|
||||
const cairo_rectangle_int_t *rect,
|
||||
float scale,
|
||||
uint8_t *data,
|
||||
int stride,
|
||||
CoglPixelFormat format,
|
||||
ClutterPaintFlag paint_flags,
|
||||
GError **error);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_stage_freeze_updates (ClutterStage *stage);
|
||||
|
||||
@@ -77,16 +57,9 @@ void clutter_stage_thaw_updates (ClutterStage *stage);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_stage_update_resource_scales (ClutterStage *stage);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_stage_view_assign_next_scanout (ClutterStageView *stage_view,
|
||||
CoglScanout *scanout);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_actor_has_damage (ClutterActor *actor);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_actor_has_transitions (ClutterActor *actor);
|
||||
|
||||
#undef __CLUTTER_H_INSIDE__
|
||||
|
||||
#endif /* __CLUTTER_MUTTER_H__ */
|
||||
|
@@ -74,14 +74,13 @@
|
||||
#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"
|
||||
|
||||
struct _ClutterOffscreenEffectPrivate
|
||||
{
|
||||
CoglHandle offscreen;
|
||||
CoglPipeline *pipeline;
|
||||
CoglPipeline *target;
|
||||
CoglHandle texture;
|
||||
|
||||
ClutterActor *actor;
|
||||
@@ -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);
|
||||
@@ -140,7 +143,7 @@ ensure_pipeline_filter_for_scale (ClutterOffscreenEffect *self,
|
||||
{
|
||||
CoglPipelineFilter filter;
|
||||
|
||||
if (!self->priv->pipeline)
|
||||
if (!self->priv->target)
|
||||
return;
|
||||
|
||||
/* If no fractional scaling is set, we're always going to render the texture
|
||||
@@ -154,7 +157,7 @@ ensure_pipeline_filter_for_scale (ClutterOffscreenEffect *self,
|
||||
else
|
||||
filter = COGL_PIPELINE_FILTER_LINEAR;
|
||||
|
||||
cogl_pipeline_set_layer_filters (self->priv->pipeline, 0 /* layer_index */,
|
||||
cogl_pipeline_set_layer_filters (self->priv->target, 0 /* layer_index */,
|
||||
filter, filter);
|
||||
}
|
||||
|
||||
@@ -185,24 +188,33 @@ update_fbo (ClutterEffect *effect,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (priv->pipeline == NULL)
|
||||
if (priv->target == NULL)
|
||||
{
|
||||
CoglContext *ctx =
|
||||
clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
||||
|
||||
priv->pipeline = cogl_pipeline_new (ctx);
|
||||
priv->target = cogl_pipeline_new (ctx);
|
||||
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);
|
||||
if (priv->texture == NULL)
|
||||
return FALSE;
|
||||
|
||||
cogl_pipeline_set_layer_texture (priv->pipeline, 0, priv->texture);
|
||||
cogl_pipeline_set_layer_texture (priv->target, 0, priv->texture);
|
||||
|
||||
priv->target_width = target_width;
|
||||
priv->target_height = target_height;
|
||||
@@ -212,8 +224,8 @@ update_fbo (ClutterEffect *effect,
|
||||
{
|
||||
g_warning ("%s: Unable to create an Offscreen buffer", G_STRLOC);
|
||||
|
||||
cogl_object_unref (priv->pipeline);
|
||||
priv->pipeline = NULL;
|
||||
cogl_object_unref (priv->target);
|
||||
priv->target = NULL;
|
||||
|
||||
priv->target_width = 0;
|
||||
priv->target_height = 0;
|
||||
@@ -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,17 +378,15 @@ 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);
|
||||
|
||||
cogl_pipeline_set_color4ub (priv->pipeline,
|
||||
cogl_pipeline_set_color4ub (priv->target,
|
||||
paint_opacity,
|
||||
paint_opacity,
|
||||
paint_opacity,
|
||||
@@ -392,7 +398,7 @@ clutter_offscreen_effect_real_paint_target (ClutterOffscreenEffect *effect,
|
||||
* hadn't been redirected offscreen.
|
||||
*/
|
||||
cogl_framebuffer_draw_textured_rectangle (framebuffer,
|
||||
priv->pipeline,
|
||||
priv->target,
|
||||
0, 0,
|
||||
cogl_texture_get_width (priv->texture),
|
||||
cogl_texture_get_height (priv->texture),
|
||||
@@ -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,90 +431,55 @@ 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;
|
||||
|
||||
g_warn_if_fail (priv->offscreen);
|
||||
g_warn_if_fail (priv->pipeline);
|
||||
g_warn_if_fail (priv->actor);
|
||||
if (priv->offscreen == NULL ||
|
||||
priv->target == NULL ||
|
||||
priv->actor == NULL)
|
||||
return;
|
||||
|
||||
/* Restore the previous opacity override */
|
||||
if (priv->actor)
|
||||
{
|
||||
clutter_actor_set_opacity_override (priv->actor,
|
||||
priv->old_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_set_enabled (ClutterActorMeta *meta,
|
||||
gboolean is_enabled)
|
||||
{
|
||||
ClutterActorMetaClass *parent_class =
|
||||
CLUTTER_ACTOR_META_CLASS (clutter_offscreen_effect_parent_class);
|
||||
ClutterOffscreenEffect *offscreen_effect = CLUTTER_OFFSCREEN_EFFECT (meta);
|
||||
ClutterOffscreenEffectPrivate *priv = offscreen_effect->priv;
|
||||
|
||||
g_clear_pointer (&priv->offscreen, cogl_object_unref);
|
||||
|
||||
parent_class->set_enabled (meta, is_enabled);
|
||||
clutter_offscreen_effect_paint_texture (self);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -520,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->pipeline, 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);
|
||||
}
|
||||
@@ -538,7 +511,6 @@ clutter_offscreen_effect_class_init (ClutterOffscreenEffectClass *klass)
|
||||
klass->paint_target = clutter_offscreen_effect_real_paint_target;
|
||||
|
||||
meta_class->set_actor = clutter_offscreen_effect_set_actor;
|
||||
meta_class->set_enabled = clutter_offscreen_effect_set_enabled;
|
||||
|
||||
effect_class->pre_paint = clutter_offscreen_effect_pre_paint;
|
||||
effect_class->post_paint = clutter_offscreen_effect_post_paint;
|
||||
@@ -604,26 +576,23 @@ clutter_offscreen_effect_get_target (ClutterOffscreenEffect *effect)
|
||||
g_return_val_if_fail (CLUTTER_IS_OFFSCREEN_EFFECT (effect),
|
||||
NULL);
|
||||
|
||||
return (CoglMaterial *)effect->priv->pipeline;
|
||||
return (CoglMaterial *)effect->priv->target;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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,31 +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,
|
||||
ClutterPaintFlag paint_flags);
|
||||
|
||||
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,189 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Red Hat Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter-paint-context-private.h"
|
||||
|
||||
struct _ClutterPaintContext
|
||||
{
|
||||
grefcount ref_count;
|
||||
|
||||
ClutterPaintFlag paint_flags;
|
||||
|
||||
GList *framebuffers;
|
||||
|
||||
ClutterStageView *view;
|
||||
|
||||
cairo_region_t *redraw_clip;
|
||||
};
|
||||
|
||||
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,
|
||||
ClutterPaintFlag paint_flags)
|
||||
{
|
||||
ClutterPaintContext *paint_context;
|
||||
CoglFramebuffer *framebuffer;
|
||||
|
||||
paint_context = g_new0 (ClutterPaintContext, 1);
|
||||
g_ref_count_init (&paint_context->ref_count);
|
||||
paint_context->view = view;
|
||||
paint_context->redraw_clip = cairo_region_copy (redraw_clip);
|
||||
paint_context->paint_flags = paint_flags;
|
||||
|
||||
framebuffer = clutter_stage_view_get_framebuffer (view);
|
||||
clutter_paint_context_push_framebuffer (paint_context, framebuffer);
|
||||
|
||||
return paint_context;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_paint_context_new_for_framebuffer: (skip)
|
||||
*/
|
||||
ClutterPaintContext *
|
||||
clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer,
|
||||
const cairo_region_t *redraw_clip,
|
||||
ClutterPaintFlag paint_flags)
|
||||
{
|
||||
ClutterPaintContext *paint_context;
|
||||
|
||||
paint_context = g_new0 (ClutterPaintContext, 1);
|
||||
g_ref_count_init (&paint_context->ref_count);
|
||||
paint_context->redraw_clip = cairo_region_copy (redraw_clip);
|
||||
paint_context->paint_flags = paint_flags;
|
||||
|
||||
clutter_paint_context_push_framebuffer (paint_context, framebuffer);
|
||||
|
||||
return paint_context;
|
||||
}
|
||||
|
||||
ClutterPaintContext *
|
||||
clutter_paint_context_ref (ClutterPaintContext *paint_context)
|
||||
{
|
||||
g_ref_count_inc (&paint_context->ref_count);
|
||||
return paint_context;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_paint_context_dispose (ClutterPaintContext *paint_context)
|
||||
{
|
||||
g_list_free_full (paint_context->framebuffers,
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_paint_context_get_paint_flags: (skip)
|
||||
*/
|
||||
ClutterPaintFlag
|
||||
clutter_paint_context_get_paint_flags (ClutterPaintContext *paint_context)
|
||||
{
|
||||
return paint_context->paint_flags;
|
||||
}
|
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Red Hat Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CLUTTER_PAINT_CONTEXT_H
|
||||
#define CLUTTER_PAINT_CONTEXT_H
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "clutter-macros.h"
|
||||
#include "clutter-stage-view.h"
|
||||
|
||||
typedef struct _ClutterPaintContext ClutterPaintContext;
|
||||
|
||||
typedef enum _ClutterPaintFlag
|
||||
{
|
||||
CLUTTER_PAINT_FLAG_NONE = 0,
|
||||
CLUTTER_PAINT_FLAG_NO_CURSORS = 1 << 0,
|
||||
} ClutterPaintFlag;
|
||||
|
||||
#define CLUTTER_TYPE_PAINT_CONTEXT (clutter_paint_context_get_type ())
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_paint_context_get_type (void);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterPaintContext * clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer,
|
||||
const cairo_region_t *redraw_clip,
|
||||
ClutterPaintFlag paint_flags);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterPaintContext * clutter_paint_context_ref (ClutterPaintContext *paint_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_context_unref (ClutterPaintContext *paint_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_context_destroy (ClutterPaintContext *paint_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
CoglFramebuffer * clutter_paint_context_get_framebuffer (ClutterPaintContext *paint_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterStageView * clutter_paint_context_get_stage_view (ClutterPaintContext *paint_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_context_push_framebuffer (ClutterPaintContext *paint_context,
|
||||
CoglFramebuffer *framebuffer);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_context_pop_framebuffer (ClutterPaintContext *paint_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
const cairo_region_t * clutter_paint_context_get_redraw_clip (ClutterPaintContext *paint_context);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterPaintFlag clutter_paint_context_get_paint_flags (ClutterPaintContext *paint_context);
|
||||
|
||||
#endif /* CLUTTER_PAINT_CONTEXT_H */
|
@@ -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);
|
||||
|
||||
@@ -83,6 +79,7 @@ typedef enum
|
||||
PAINT_OP_INVALID = 0,
|
||||
PAINT_OP_TEX_RECT,
|
||||
PAINT_OP_MULTITEX_RECT,
|
||||
PAINT_OP_PATH,
|
||||
PAINT_OP_PRIMITIVE
|
||||
} PaintOpCode;
|
||||
|
||||
@@ -95,6 +92,8 @@ struct _ClutterPaintOperation
|
||||
union {
|
||||
float texrect[8];
|
||||
|
||||
CoglPath *path;
|
||||
|
||||
CoglPrimitive *primitive;
|
||||
} op;
|
||||
};
|
||||
@@ -112,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);
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -782,6 +766,11 @@ clutter_paint_operation_clear (ClutterPaintOperation *op)
|
||||
g_array_unref (op->multitex_coords);
|
||||
break;
|
||||
|
||||
case PAINT_OP_PATH:
|
||||
if (op->op.path != NULL)
|
||||
cogl_object_unref (op->op.path);
|
||||
break;
|
||||
|
||||
case PAINT_OP_PRIMITIVE:
|
||||
if (op->op.primitive != NULL)
|
||||
cogl_object_unref (op->op.primitive);
|
||||
@@ -831,6 +820,16 @@ clutter_paint_op_init_multitex_rect (ClutterPaintOperation *op,
|
||||
op->op.texrect[3] = rect->y2;
|
||||
}
|
||||
|
||||
static inline void
|
||||
clutter_paint_op_init_path (ClutterPaintOperation *op,
|
||||
CoglPath *path)
|
||||
{
|
||||
clutter_paint_operation_clear (op);
|
||||
|
||||
op->opcode = PAINT_OP_PATH;
|
||||
op->op.path = cogl_object_ref (path);
|
||||
}
|
||||
|
||||
static inline void
|
||||
clutter_paint_op_init_primitive (ClutterPaintOperation *op,
|
||||
CoglPrimitive *primitive)
|
||||
@@ -935,6 +934,34 @@ clutter_paint_node_add_multitexture_rectangle (ClutterPaintNode *node,
|
||||
g_array_append_val (node->operations, operation);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_paint_node_add_path: (skip)
|
||||
* @node: a #ClutterPaintNode
|
||||
* @path: a Cogl path
|
||||
*
|
||||
* Adds a region described as a path to the @node.
|
||||
*
|
||||
* This function acquires a reference on the passed @path, so it
|
||||
* is safe to call cogl_object_unref() when it returns.
|
||||
*
|
||||
* Since: 1.10
|
||||
* Stability: unstable
|
||||
*/
|
||||
void
|
||||
clutter_paint_node_add_path (ClutterPaintNode *node,
|
||||
CoglPath *path)
|
||||
{
|
||||
ClutterPaintOperation operation = PAINT_OP_INIT;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
|
||||
g_return_if_fail (cogl_is_path (path));
|
||||
|
||||
clutter_paint_node_maybe_init_operations (node);
|
||||
|
||||
clutter_paint_op_init_path (&operation, path);
|
||||
g_array_append_val (node->operations, operation);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_paint_node_add_primitive: (skip)
|
||||
* @node: a #ClutterPaintNode
|
||||
@@ -970,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1071,6 +1097,11 @@ clutter_paint_node_to_json (ClutterPaintNode *node)
|
||||
json_builder_end_array (builder);
|
||||
break;
|
||||
|
||||
case PAINT_OP_PATH:
|
||||
json_builder_set_member_name (builder, "path");
|
||||
json_builder_add_int_value (builder, (intptr_t) op->op.path);
|
||||
break;
|
||||
|
||||
case PAINT_OP_PRIMITIVE:
|
||||
json_builder_set_member_name (builder, "primitive");
|
||||
json_builder_add_int_value (builder, (intptr_t) op->op.primitive);
|
||||
@@ -1146,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);
|
||||
}
|
||||
|
||||
@@ -1166,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)
|
||||
@@ -1177,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);
|
||||
@@ -84,6 +80,9 @@ void clutter_paint_node_add_multitexture_rectangle (ClutterP
|
||||
unsigned int text_coords_len);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_node_add_path (ClutterPaintNode *node,
|
||||
CoglPath *path);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_node_add_primitive (ClutterPaintNode *node,
|
||||
CoglPrimitive *primitive);
|
||||
|
||||
|
@@ -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,7 +172,11 @@ 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;
|
||||
@@ -202,12 +201,10 @@ struct _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);
|
||||
CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
|
||||
|
||||
cogl_framebuffer_push_matrix (fb);
|
||||
cogl_framebuffer_transform (fb, &transform_node->transform);
|
||||
@@ -216,11 +213,9 @@ clutter_transform_node_pre_draw (ClutterPaintNode *node,
|
||||
}
|
||||
|
||||
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);
|
||||
CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
|
||||
|
||||
cogl_framebuffer_pop_matrix (fb);
|
||||
}
|
||||
@@ -283,8 +278,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 +315,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 +323,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 +331,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 +340,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 +383,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 +410,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 +424,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],
|
||||
@@ -477,6 +445,10 @@ clutter_pipeline_node_draw (ClutterPaintNode *node,
|
||||
op->multitex_coords->len);
|
||||
break;
|
||||
|
||||
case PAINT_OP_PATH:
|
||||
cogl_path_fill (op->op.path);
|
||||
break;
|
||||
|
||||
case PAINT_OP_PRIMITIVE:
|
||||
cogl_framebuffer_draw_primitive (fb,
|
||||
pnode->pipeline,
|
||||
@@ -487,9 +459,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 *
|
||||
@@ -808,8 +780,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);
|
||||
|
||||
@@ -817,8 +788,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;
|
||||
@@ -828,7 +798,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);
|
||||
|
||||
@@ -861,17 +831,18 @@ 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);
|
||||
break;
|
||||
|
||||
case PAINT_OP_MULTITEX_RECT:
|
||||
case PAINT_OP_PATH:
|
||||
case PAINT_OP_PRIMITIVE:
|
||||
case PAINT_OP_INVALID:
|
||||
break;
|
||||
@@ -1003,8 +974,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;
|
||||
@@ -1013,7 +983,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++)
|
||||
{
|
||||
@@ -1032,6 +1002,11 @@ clutter_clip_node_pre_draw (ClutterPaintNode *node,
|
||||
retval = TRUE;
|
||||
break;
|
||||
|
||||
case PAINT_OP_PATH:
|
||||
cogl_framebuffer_push_path_clip (fb, op->op.path);
|
||||
retval = TRUE;
|
||||
break;
|
||||
|
||||
case PAINT_OP_MULTITEX_RECT:
|
||||
case PAINT_OP_PRIMITIVE:
|
||||
case PAINT_OP_INVALID:
|
||||
@@ -1043,8 +1018,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;
|
||||
@@ -1052,7 +1026,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++)
|
||||
{
|
||||
@@ -1062,6 +1036,7 @@ clutter_clip_node_post_draw (ClutterPaintNode *node,
|
||||
|
||||
switch (op->opcode)
|
||||
{
|
||||
case PAINT_OP_PATH:
|
||||
case PAINT_OP_TEX_RECT:
|
||||
cogl_framebuffer_pop_clip (fb);
|
||||
break;
|
||||
@@ -1125,8 +1100,7 @@ struct _ClutterActorNodeClass
|
||||
G_DEFINE_TYPE (ClutterActorNode, clutter_actor_node, CLUTTER_TYPE_PAINT_NODE)
|
||||
|
||||
static gboolean
|
||||
clutter_actor_node_pre_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_actor_node_pre_draw (ClutterPaintNode *node)
|
||||
{
|
||||
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
|
||||
|
||||
@@ -1136,17 +1110,15 @@ clutter_actor_node_pre_draw (ClutterPaintNode *node,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_node_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_actor_node_draw (ClutterPaintNode *node)
|
||||
{
|
||||
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
|
||||
|
||||
clutter_actor_continue_paint (actor_node->actor, paint_context);
|
||||
clutter_actor_continue_paint (actor_node->actor);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_node_post_draw (ClutterPaintNode *node,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_actor_node_post_draw (ClutterPaintNode *node)
|
||||
{
|
||||
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
|
||||
|
||||
@@ -1171,7 +1143,6 @@ clutter_actor_node_serialize (ClutterPaintNode *node)
|
||||
|
||||
return json_builder_get_root (builder);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_node_class_init (ClutterActorNodeClass *klass)
|
||||
{
|
||||
@@ -1231,8 +1202,9 @@ struct _ClutterLayerNode
|
||||
float fbo_width;
|
||||
float fbo_height;
|
||||
|
||||
CoglPipeline *pipeline;
|
||||
CoglPipeline *state;
|
||||
CoglFramebuffer *offscreen;
|
||||
CoglTexture *texture;
|
||||
|
||||
guint8 opacity;
|
||||
};
|
||||
@@ -1245,11 +1217,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
|
||||
@@ -1265,10 +1235,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);
|
||||
|
||||
@@ -1286,7 +1255,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
|
||||
@@ -1296,18 +1265,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++)
|
||||
{
|
||||
@@ -1321,21 +1289,21 @@ 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->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_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,
|
||||
lnode->pipeline,
|
||||
cogl_framebuffer_draw_multitextured_rectangle (cogl_get_draw_framebuffer (),
|
||||
lnode->state,
|
||||
op->op.texrect[0],
|
||||
op->op.texrect[1],
|
||||
op->op.texrect[2],
|
||||
@@ -1344,10 +1312,14 @@ clutter_layer_node_post_draw (ClutterPaintNode *node,
|
||||
op->multitex_coords->len);
|
||||
break;
|
||||
|
||||
case PAINT_OP_PATH:
|
||||
cogl_push_source (lnode->state);
|
||||
cogl_path_fill (op->op.path);
|
||||
cogl_pop_source ();
|
||||
break;
|
||||
|
||||
case PAINT_OP_PRIMITIVE:
|
||||
cogl_framebuffer_draw_primitive (fb,
|
||||
lnode->pipeline,
|
||||
op->op.primitive);
|
||||
cogl_framebuffer_draw_primitive (fb, lnode->state, op->op.primitive);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1358,8 +1330,8 @@ clutter_layer_node_finalize (ClutterPaintNode *node)
|
||||
{
|
||||
ClutterLayerNode *lnode = CLUTTER_LAYER_NODE (node);
|
||||
|
||||
if (lnode->pipeline != NULL)
|
||||
cogl_object_unref (lnode->pipeline);
|
||||
if (lnode->state != NULL)
|
||||
cogl_object_unref (lnode->state);
|
||||
|
||||
if (lnode->offscreen != NULL)
|
||||
cogl_object_unref (lnode->offscreen);
|
||||
@@ -1411,8 +1383,6 @@ clutter_layer_node_new (const CoglMatrix *projection,
|
||||
guint8 opacity)
|
||||
{
|
||||
ClutterLayerNode *res;
|
||||
CoglContext *context;
|
||||
CoglTexture *texture;
|
||||
CoglColor color;
|
||||
|
||||
res = _clutter_paint_node_create (CLUTTER_TYPE_LAYER_NODE);
|
||||
@@ -1424,17 +1394,19 @@ clutter_layer_node_new (const CoglMatrix *projection,
|
||||
res->opacity = opacity;
|
||||
|
||||
/* the texture backing the FBO */
|
||||
context = clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
||||
res->texture = cogl_texture_new_with_size (MAX (res->fbo_width, 1),
|
||||
MAX (res->fbo_height, 1),
|
||||
COGL_TEXTURE_NO_SLICING,
|
||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE);
|
||||
|
||||
texture = cogl_texture_2d_new_with_size (context,
|
||||
MAX (res->fbo_width, 1),
|
||||
MAX (res->fbo_height, 1));
|
||||
cogl_texture_set_premultiplied (texture, TRUE);
|
||||
|
||||
res->offscreen = COGL_FRAMEBUFFER (cogl_offscreen_new_to_texture (texture));
|
||||
res->offscreen = COGL_FRAMEBUFFER (cogl_offscreen_new_to_texture (res->texture));
|
||||
if (res->offscreen == NULL)
|
||||
{
|
||||
g_critical ("%s: Unable to create an offscreen buffer", G_STRLOC);
|
||||
|
||||
cogl_object_unref (res->texture);
|
||||
res->texture = NULL;
|
||||
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -1444,15 +1416,14 @@ clutter_layer_node_new (const CoglMatrix *projection,
|
||||
* interpolation filters because the texture is always
|
||||
* going to be painted at a 1:1 texel:pixel ratio
|
||||
*/
|
||||
res->pipeline = cogl_pipeline_copy (default_texture_pipeline);
|
||||
cogl_pipeline_set_layer_filters (res->pipeline, 0,
|
||||
res->state = cogl_pipeline_copy (default_texture_pipeline);
|
||||
cogl_pipeline_set_layer_filters (res->state, 0,
|
||||
COGL_PIPELINE_FILTER_NEAREST,
|
||||
COGL_PIPELINE_FILTER_NEAREST);
|
||||
cogl_pipeline_set_layer_texture (res->pipeline, 0, texture);
|
||||
cogl_pipeline_set_color (res->pipeline, &color);
|
||||
cogl_pipeline_set_layer_texture (res->state, 0, res->texture);
|
||||
cogl_pipeline_set_color (res->state, &color);
|
||||
cogl_object_unref (res->texture);
|
||||
|
||||
out:
|
||||
cogl_object_unref (texture);
|
||||
|
||||
return (ClutterPaintNode *) res;
|
||||
}
|
||||
|
@@ -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 */
|
@@ -248,9 +248,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
|
||||
{
|
||||
|
@@ -41,7 +41,6 @@ enum
|
||||
PTR_A11Y_DWELL_CLICK_TYPE_CHANGED,
|
||||
PTR_A11Y_TIMEOUT_STARTED,
|
||||
PTR_A11Y_TIMEOUT_STOPPED,
|
||||
IS_UNFOCUS_INHIBITED_CHANGED,
|
||||
N_SIGNALS,
|
||||
};
|
||||
|
||||
@@ -51,7 +50,6 @@ enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_BACKEND,
|
||||
PROP_TOUCH_MODE,
|
||||
N_PROPS
|
||||
};
|
||||
|
||||
@@ -63,8 +61,6 @@ struct _ClutterSeatPrivate
|
||||
{
|
||||
ClutterBackend *backend;
|
||||
|
||||
unsigned int inhibit_unfocus_count;
|
||||
|
||||
/* Keyboard a11y */
|
||||
ClutterKbdA11ySettings kbd_a11y_settings;
|
||||
|
||||
@@ -88,7 +84,6 @@ clutter_seat_set_property (GObject *object,
|
||||
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);
|
||||
}
|
||||
@@ -108,9 +103,6 @@ clutter_seat_get_property (GObject *object,
|
||||
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);
|
||||
}
|
||||
@@ -140,17 +132,25 @@ clutter_seat_class_init (ClutterSeatClass *klass)
|
||||
g_signal_new (I_("device-added"),
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL, NULL,
|
||||
0, NULL, NULL,
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_INPUT_DEVICE);
|
||||
g_signal_set_va_marshaller (signals[DEVICE_ADDED],
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
g_cclosure_marshal_VOID__OBJECTv);
|
||||
|
||||
signals[DEVICE_REMOVED] =
|
||||
g_signal_new (I_("device-removed"),
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL, NULL,
|
||||
0, NULL, NULL,
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_INPUT_DEVICE);
|
||||
g_signal_set_va_marshaller (signals[DEVICE_REMOVED],
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
g_cclosure_marshal_VOID__OBJECTv);
|
||||
signals[TOOL_CHANGED] =
|
||||
g_signal_new (I_("tool-changed"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
@@ -223,9 +223,13 @@ clutter_seat_class_init (ClutterSeatClass *klass)
|
||||
g_signal_new (I_("ptr-a11y-dwell-click-type-changed"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL, NULL,
|
||||
0, NULL, NULL,
|
||||
g_cclosure_marshal_VOID__FLAGS,
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_POINTER_A11Y_DWELL_CLICK_TYPE);
|
||||
g_signal_set_va_marshaller (signals[PTR_A11Y_DWELL_CLICK_TYPE_CHANGED],
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
g_cclosure_marshal_VOID__FLAGSv);
|
||||
|
||||
/**
|
||||
* ClutterSeat::ptr-a11y-timeout-started:
|
||||
@@ -278,22 +282,6 @@ clutter_seat_class_init (ClutterSeatClass *klass)
|
||||
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"),
|
||||
@@ -301,19 +289,6 @@ clutter_seat_class_init (ClutterSeatClass *klass)
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -360,10 +335,7 @@ clutter_seat_get_keyboard (ClutterSeat *seat)
|
||||
*
|
||||
* 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.
|
||||
* Returns: (transfer container) (element-type Clutter.InputDevice): A list of #ClutterInputDevice
|
||||
**/
|
||||
GList *
|
||||
clutter_seat_list_devices (ClutterSeat *seat)
|
||||
@@ -533,85 +505,6 @@ clutter_seat_set_pointer_a11y_dwell_click_type (ClutterSeat
|
||||
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
|
||||
@@ -658,9 +551,10 @@ clutter_seat_compress_motion (ClutterSeat *seat,
|
||||
g_return_if_fail (CLUTTER_IS_SEAT (seat));
|
||||
|
||||
seat_class = CLUTTER_SEAT_GET_CLASS (seat);
|
||||
if (!seat_class->compress_motion)
|
||||
return;
|
||||
|
||||
if (seat_class->compress_motion)
|
||||
seat_class->compress_motion (seat, event, to_discard);
|
||||
seat_class->compress_motion (seat, event, to_discard);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -672,30 +566,3 @@ clutter_seat_warp_pointer (ClutterSeat *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;
|
||||
}
|
||||
|
@@ -159,16 +159,6 @@ void clutter_seat_get_pointer_a11y_settings (ClutterSeat *seat,
|
||||
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);
|
||||
@@ -184,7 +174,5 @@ 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;
|
||||
}
|
||||
|
@@ -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);
|
||||
|
||||
@@ -104,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);
|
||||
@@ -139,8 +141,7 @@ void _clutter_stage_presented (ClutterStage *stag
|
||||
CoglFrameEvent frame_event,
|
||||
ClutterFrameInfo *frame_info);
|
||||
|
||||
void clutter_stage_queue_actor_relayout (ClutterStage *stage,
|
||||
ClutterActor *actor);
|
||||
GList * _clutter_stage_peek_stage_views (ClutterStage *stage);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@@ -20,7 +20,8 @@
|
||||
|
||||
#include "clutter/clutter-stage-view.h"
|
||||
|
||||
void clutter_stage_view_after_paint (ClutterStageView *view);
|
||||
void clutter_stage_view_after_paint (ClutterStageView *view,
|
||||
const cairo_rectangle_int_t *clip);
|
||||
|
||||
gboolean clutter_stage_view_is_dirty_viewport (ClutterStageView *view);
|
||||
|
||||
@@ -32,17 +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);
|
||||
|
||||
CoglScanout * clutter_stage_view_take_scanout (ClutterStageView *view);
|
||||
|
||||
#endif /* __CLUTTER_STAGE_VIEW_PRIVATE_H__ */
|
||||
|
@@ -23,10 +23,6 @@
|
||||
#include <cairo-gobject.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "clutter/clutter-private.h"
|
||||
#include "clutter/clutter-mutter.h"
|
||||
#include "cogl/cogl.h"
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
@@ -54,11 +50,6 @@ typedef struct _ClutterStageViewPrivate
|
||||
CoglOffscreen *shadowfb;
|
||||
CoglPipeline *shadowfb_pipeline;
|
||||
|
||||
CoglScanout *next_scanout;
|
||||
|
||||
gboolean has_redraw_clip;
|
||||
cairo_region_t *redraw_clip;
|
||||
|
||||
guint dirty_viewport : 1;
|
||||
guint dirty_projection : 1;
|
||||
} ClutterStageViewPrivate;
|
||||
@@ -175,11 +166,12 @@ clutter_stage_view_invalidate_offscreen_blit_pipeline (ClutterStageView *view)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_view_copy_to_framebuffer (ClutterStageView *view,
|
||||
CoglPipeline *pipeline,
|
||||
CoglFramebuffer *src_framebuffer,
|
||||
CoglFramebuffer *dst_framebuffer,
|
||||
gboolean can_blit)
|
||||
clutter_stage_view_copy_to_framebuffer (ClutterStageView *view,
|
||||
const cairo_rectangle_int_t *rect,
|
||||
CoglPipeline *pipeline,
|
||||
CoglFramebuffer *src_framebuffer,
|
||||
CoglFramebuffer *dst_framebuffer,
|
||||
gboolean can_blit)
|
||||
{
|
||||
CoglMatrix matrix;
|
||||
|
||||
@@ -212,7 +204,8 @@ clutter_stage_view_copy_to_framebuffer (ClutterStageView *view,
|
||||
}
|
||||
|
||||
void
|
||||
clutter_stage_view_after_paint (ClutterStageView *view)
|
||||
clutter_stage_view_after_paint (ClutterStageView *view,
|
||||
const cairo_rectangle_int_t *rect)
|
||||
{
|
||||
ClutterStageViewPrivate *priv =
|
||||
clutter_stage_view_get_instance_private (view);
|
||||
@@ -229,6 +222,7 @@ clutter_stage_view_after_paint (ClutterStageView *view)
|
||||
if (priv->shadowfb)
|
||||
{
|
||||
clutter_stage_view_copy_to_framebuffer (view,
|
||||
rect,
|
||||
priv->offscreen_pipeline,
|
||||
priv->offscreen,
|
||||
priv->shadowfb,
|
||||
@@ -237,6 +231,7 @@ clutter_stage_view_after_paint (ClutterStageView *view)
|
||||
else
|
||||
{
|
||||
clutter_stage_view_copy_to_framebuffer (view,
|
||||
rect,
|
||||
priv->offscreen_pipeline,
|
||||
priv->offscreen,
|
||||
priv->framebuffer,
|
||||
@@ -248,6 +243,7 @@ clutter_stage_view_after_paint (ClutterStageView *view)
|
||||
{
|
||||
clutter_stage_view_ensure_shadowfb_blit_pipeline (view);
|
||||
clutter_stage_view_copy_to_framebuffer (view,
|
||||
rect,
|
||||
priv->shadowfb_pipeline,
|
||||
priv->shadowfb,
|
||||
priv->framebuffer,
|
||||
@@ -311,86 +307,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,
|
||||
@@ -411,25 +327,6 @@ clutter_stage_default_get_offscreen_transformation_matrix (ClutterStageView *vie
|
||||
cogl_matrix_init_identity (matrix);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_stage_view_assign_next_scanout (ClutterStageView *view,
|
||||
CoglScanout *scanout)
|
||||
{
|
||||
ClutterStageViewPrivate *priv =
|
||||
clutter_stage_view_get_instance_private (view);
|
||||
|
||||
g_set_object (&priv->next_scanout, scanout);
|
||||
}
|
||||
|
||||
CoglScanout *
|
||||
clutter_stage_view_take_scanout (ClutterStageView *view)
|
||||
{
|
||||
ClutterStageViewPrivate *priv =
|
||||
clutter_stage_view_get_instance_private (view);
|
||||
|
||||
return g_steal_pointer (&priv->next_scanout);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_view_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
@@ -522,7 +419,6 @@ clutter_stage_view_dispose (GObject *object)
|
||||
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_OBJECT_CLASS (clutter_stage_view_parent_class)->dispose (object);
|
||||
}
|
||||
|
@@ -62,6 +62,16 @@ _clutter_stage_window_set_title (ClutterStageWindow *window,
|
||||
iface->set_title (window, title);
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_stage_window_set_cursor_visible (ClutterStageWindow *window,
|
||||
gboolean is_visible)
|
||||
{
|
||||
ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
||||
|
||||
if (iface->set_cursor_visible)
|
||||
iface->set_cursor_visible (window, is_visible);
|
||||
}
|
||||
|
||||
gboolean
|
||||
_clutter_stage_window_realize (ClutterStageWindow *window)
|
||||
{
|
||||
@@ -168,6 +178,90 @@ _clutter_stage_window_clear_update_time (ClutterStageWindow *window)
|
||||
iface->clear_update_time (window);
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_stage_window_add_redraw_clip (ClutterStageWindow *window,
|
||||
cairo_rectangle_int_t *stage_clip)
|
||||
{
|
||||
ClutterStageWindowInterface *iface;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
cairo_region_t *
|
||||
_clutter_stage_window_get_redraw_clip (ClutterStageWindow *window)
|
||||
{
|
||||
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 != NULL)
|
||||
return iface->get_redraw_clip (window);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_stage_window_set_accept_focus (ClutterStageWindow *window,
|
||||
gboolean accept_focus)
|
||||
{
|
||||
ClutterStageWindowInterface *iface;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
|
||||
|
||||
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
||||
if (iface->set_accept_focus)
|
||||
iface->set_accept_focus (window, accept_focus);
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_stage_window_redraw (ClutterStageWindow *window)
|
||||
{
|
||||
|
@@ -30,6 +30,8 @@ struct _ClutterStageWindowInterface
|
||||
|
||||
void (* set_title) (ClutterStageWindow *stage_window,
|
||||
const gchar *title);
|
||||
void (* set_cursor_visible) (ClutterStageWindow *stage_window,
|
||||
gboolean cursor_visible);
|
||||
|
||||
gboolean (* realize) (ClutterStageWindow *stage_window);
|
||||
void (* unrealize) (ClutterStageWindow *stage_window);
|
||||
@@ -49,6 +51,15 @@ 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);
|
||||
cairo_region_t * (* get_redraw_clip) (ClutterStageWindow *stage_window);
|
||||
|
||||
void (* set_accept_focus) (ClutterStageWindow *stage_window,
|
||||
gboolean accept_focus);
|
||||
|
||||
void (* redraw) (ClutterStageWindow *stage_window);
|
||||
|
||||
gboolean (* can_clip_redraws) (ClutterStageWindow *stage_window);
|
||||
@@ -83,6 +94,12 @@ 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);
|
||||
cairo_region_t * _clutter_stage_window_get_redraw_clip (ClutterStageWindow *window);
|
||||
|
||||
void _clutter_stage_window_set_accept_focus (ClutterStageWindow *window,
|
||||
gboolean accept_focus);
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -84,9 +84,8 @@ struct _ClutterStageClass
|
||||
gboolean (* delete_event) (ClutterStage *stage,
|
||||
ClutterEvent *event);
|
||||
|
||||
void (* paint_view) (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
const cairo_region_t *redraw_clip);
|
||||
void (* paint_view) (ClutterStage *stage,
|
||||
ClutterStageView *view);
|
||||
|
||||
/*< private >*/
|
||||
/* padding for future expansion */
|
||||
@@ -103,7 +102,8 @@ struct _ClutterStageClass
|
||||
* @z_far: the distance from the viewer to the far clipping
|
||||
* plane (always positive)
|
||||
*
|
||||
* Stage perspective definition.
|
||||
* Stage perspective definition. #ClutterPerspective is only used by
|
||||
* the fixed point version of clutter_stage_set_perspective().
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
@@ -139,10 +139,17 @@ GType clutter_stage_get_type (void) G_GNUC_CONST;
|
||||
CLUTTER_EXPORT
|
||||
ClutterActor * clutter_stage_new (void);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_stage_set_perspective (ClutterStage *stage,
|
||||
ClutterPerspective *perspective);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_stage_get_perspective (ClutterStage *stage,
|
||||
ClutterPerspective *perspective);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_stage_show_cursor (ClutterStage *stage);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_stage_hide_cursor (ClutterStage *stage);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_stage_set_title (ClutterStage *stage,
|
||||
const gchar *title);
|
||||
CLUTTER_EXPORT
|
||||
@@ -178,6 +185,11 @@ void clutter_stage_set_motion_events_enabled (ClutterStage
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_stage_get_motion_events_enabled (ClutterStage *stage);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_stage_set_accept_focus (ClutterStage *stage,
|
||||
gboolean accept_focus);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_stage_get_accept_focus (ClutterStage *stage);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_stage_event (ClutterStage *stage,
|
||||
ClutterEvent *event);
|
||||
|
||||
@@ -193,6 +205,8 @@ guchar * clutter_stage_read_pixels (ClutterStage
|
||||
gint width,
|
||||
gint height);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
cairo_region_t * clutter_stage_get_redraw_clip (ClutterStage *stage);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_stage_ensure_viewport (ClutterStage *stage);
|
||||
CLUTTER_EXPORT
|
||||
@@ -220,8 +234,8 @@ CLUTTER_EXPORT
|
||||
gboolean clutter_stage_capture (ClutterStage *stage,
|
||||
gboolean paint,
|
||||
cairo_rectangle_int_t *rect,
|
||||
ClutterCapture **out_captures,
|
||||
int *out_n_captures);
|
||||
ClutterCapture **captures,
|
||||
int *n_captures);
|
||||
CLUTTER_EXPORT
|
||||
ClutterStageView * clutter_stage_get_view_at (ClutterStage *stage,
|
||||
float x,
|
||||
|
@@ -348,23 +348,13 @@ clutter_text_input_focus_request_surrounding (ClutterInputFocus *focus)
|
||||
|
||||
static void
|
||||
clutter_text_input_focus_delete_surrounding (ClutterInputFocus *focus,
|
||||
int offset,
|
||||
guint offset,
|
||||
guint len)
|
||||
{
|
||||
ClutterText *clutter_text = CLUTTER_TEXT_INPUT_FOCUS (focus)->text;
|
||||
int cursor;
|
||||
int start;
|
||||
|
||||
cursor = clutter_text_get_cursor_position (clutter_text);
|
||||
start = cursor + offset;
|
||||
if (start < 0)
|
||||
{
|
||||
g_warning ("The offset '%d' of deleting surrounding is larger than the cursor pos '%d'",
|
||||
offset, cursor);
|
||||
return;
|
||||
}
|
||||
if (clutter_text_get_editable (clutter_text))
|
||||
clutter_text_delete_text (clutter_text, start, len);
|
||||
clutter_text_delete_text (clutter_text, offset, len);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1907,6 +1897,14 @@ clutter_text_foreach_selection_rectangle (ClutterText *self,
|
||||
g_free (utf8);
|
||||
}
|
||||
|
||||
static void
|
||||
add_selection_rectangle_to_path (ClutterText *text,
|
||||
const ClutterActorBox *box,
|
||||
gpointer user_data)
|
||||
{
|
||||
cogl_path_rectangle (user_data, box->x1, box->y1, box->x2, box->y2);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_text_foreach_selection_rectangle_prescaled (ClutterText *self,
|
||||
ClutterTextSelectionFunc func,
|
||||
@@ -1915,60 +1913,6 @@ clutter_text_foreach_selection_rectangle_prescaled (ClutterText *se
|
||||
clutter_text_foreach_selection_rectangle (self, 1.0f, func, user_data);
|
||||
}
|
||||
|
||||
static void
|
||||
paint_selection_rectangle (ClutterText *self,
|
||||
const ClutterActorBox *box,
|
||||
gpointer user_data)
|
||||
{
|
||||
CoglFramebuffer *fb = user_data;
|
||||
ClutterTextPrivate *priv = self->priv;
|
||||
ClutterActor *actor = CLUTTER_ACTOR (self);
|
||||
guint8 paint_opacity = clutter_actor_get_paint_opacity (actor);
|
||||
CoglPipeline *color_pipeline = cogl_pipeline_copy (default_color_pipeline);
|
||||
PangoLayout *layout = clutter_text_get_layout (self);
|
||||
CoglColor cogl_color = { 0, };
|
||||
const ClutterColor *color;
|
||||
|
||||
/* Paint selection background */
|
||||
if (priv->selection_color_set)
|
||||
color = &priv->selection_color;
|
||||
else if (priv->cursor_color_set)
|
||||
color = &priv->cursor_color;
|
||||
else
|
||||
color = &priv->text_color;
|
||||
|
||||
cogl_color_init_from_4ub (&cogl_color,
|
||||
color->red,
|
||||
color->green,
|
||||
color->blue,
|
||||
paint_opacity * color->alpha / 255);
|
||||
cogl_color_premultiply (&cogl_color);
|
||||
cogl_pipeline_set_color (color_pipeline, &cogl_color);
|
||||
|
||||
cogl_framebuffer_push_rectangle_clip (fb,
|
||||
box->x1, box->y1,
|
||||
box->x2, box->y2);
|
||||
cogl_framebuffer_draw_rectangle (fb, color_pipeline,
|
||||
box->x1, box->y1,
|
||||
box->x2, box->y2);
|
||||
|
||||
if (priv->selected_text_color_set)
|
||||
color = &priv->selected_text_color;
|
||||
else
|
||||
color = &priv->text_color;
|
||||
|
||||
cogl_color_init_from_4ub (&cogl_color,
|
||||
color->red,
|
||||
color->green,
|
||||
color->blue,
|
||||
paint_opacity * color->alpha / 255);
|
||||
|
||||
cogl_pango_show_layout (fb, layout, priv->text_x, 0, &cogl_color);
|
||||
|
||||
cogl_framebuffer_pop_clip (fb);
|
||||
cogl_object_unref (color_pipeline);
|
||||
}
|
||||
|
||||
/* Draws the selected text, its background, and the cursor */
|
||||
static void
|
||||
selection_paint (ClutterText *self,
|
||||
@@ -2011,9 +1955,52 @@ selection_paint (ClutterText *self,
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Paint selection background first */
|
||||
CoglPipeline *color_pipeline = cogl_pipeline_copy (default_color_pipeline);
|
||||
PangoLayout *layout = clutter_text_get_layout (self);
|
||||
CoglPath *selection_path = cogl_path_new ();
|
||||
CoglColor cogl_color = { 0, };
|
||||
|
||||
/* Paint selection background */
|
||||
if (priv->selection_color_set)
|
||||
color = &priv->selection_color;
|
||||
else if (priv->cursor_color_set)
|
||||
color = &priv->cursor_color;
|
||||
else
|
||||
color = &priv->text_color;
|
||||
|
||||
cogl_color_init_from_4ub (&cogl_color,
|
||||
color->red,
|
||||
color->green,
|
||||
color->blue,
|
||||
paint_opacity * color->alpha / 255);
|
||||
cogl_color_premultiply (&cogl_color);
|
||||
cogl_pipeline_set_color (color_pipeline, &cogl_color);
|
||||
|
||||
clutter_text_foreach_selection_rectangle_prescaled (self,
|
||||
paint_selection_rectangle,
|
||||
fb);
|
||||
add_selection_rectangle_to_path,
|
||||
selection_path);
|
||||
|
||||
cogl_framebuffer_fill_path (fb, color_pipeline, selection_path);
|
||||
|
||||
/* Paint selected text */
|
||||
cogl_framebuffer_push_path_clip (fb, selection_path);
|
||||
cogl_object_unref (selection_path);
|
||||
|
||||
if (priv->selected_text_color_set)
|
||||
color = &priv->selected_text_color;
|
||||
else
|
||||
color = &priv->text_color;
|
||||
|
||||
cogl_color_init_from_4ub (&cogl_color,
|
||||
color->red,
|
||||
color->green,
|
||||
color->blue,
|
||||
paint_opacity * color->alpha / 255);
|
||||
|
||||
cogl_pango_render_layout (layout, priv->text_x, 0, &cogl_color, 0);
|
||||
|
||||
cogl_framebuffer_pop_clip (fb);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2568,8 +2555,7 @@ clutter_text_compute_layout_offsets (ClutterText *self,
|
||||
#define TEXT_PADDING 2
|
||||
|
||||
static void
|
||||
clutter_text_paint (ClutterActor *self,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_text_paint (ClutterActor *self)
|
||||
{
|
||||
ClutterText *text = CLUTTER_TEXT (self);
|
||||
ClutterTextPrivate *priv = text->priv;
|
||||
@@ -2587,7 +2573,7 @@ clutter_text_paint (ClutterActor *self,
|
||||
float alloc_height;
|
||||
float resource_scale;
|
||||
|
||||
fb = clutter_paint_context_get_framebuffer (paint_context);
|
||||
fb = cogl_get_draw_framebuffer ();
|
||||
|
||||
/* Note that if anything in this paint method changes it needs to be
|
||||
reflected in the get_paint_volume implementation which is tightly
|
||||
@@ -2775,7 +2761,7 @@ clutter_text_paint (ClutterActor *self,
|
||||
priv->text_color.green,
|
||||
priv->text_color.blue,
|
||||
real_opacity);
|
||||
cogl_pango_show_layout (fb, layout, priv->text_x, priv->text_y, &color);
|
||||
cogl_pango_render_layout (layout, priv->text_x, priv->text_y, &color, 0);
|
||||
|
||||
selection_paint (text, fb);
|
||||
|
||||
|
@@ -1038,15 +1038,15 @@ clutter_timeline_do_frame (ClutterTimeline *timeline)
|
||||
* to correpondingly reduce elapsed_time_delta to reflect the correct
|
||||
* range of times */
|
||||
if (priv->direction == CLUTTER_TIMELINE_FORWARD)
|
||||
{
|
||||
elapsed_time_delta -= (priv->elapsed_time - priv->duration);
|
||||
priv->elapsed_time = priv->duration;
|
||||
}
|
||||
{
|
||||
elapsed_time_delta -= (priv->elapsed_time - priv->duration);
|
||||
priv->elapsed_time = priv->duration;
|
||||
}
|
||||
else if (priv->direction == CLUTTER_TIMELINE_BACKWARD)
|
||||
{
|
||||
elapsed_time_delta -= - priv->elapsed_time;
|
||||
priv->elapsed_time = 0;
|
||||
}
|
||||
{
|
||||
elapsed_time_delta -= - priv->elapsed_time;
|
||||
priv->elapsed_time = 0;
|
||||
}
|
||||
|
||||
end_msecs = priv->elapsed_time;
|
||||
|
||||
@@ -1756,12 +1756,12 @@ _clutter_timeline_do_tick (ClutterTimeline *timeline,
|
||||
}
|
||||
|
||||
if (msecs != 0)
|
||||
{
|
||||
/* Avoid accumulating error */
|
||||
{
|
||||
/* Avoid accumulating error */
|
||||
priv->last_frame_time += msecs;
|
||||
priv->msecs_delta = msecs;
|
||||
clutter_timeline_do_frame (timeline);
|
||||
}
|
||||
priv->msecs_delta = msecs;
|
||||
clutter_timeline_do_frame (timeline);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -214,16 +214,6 @@ _clutter_util_rectangle_intersection (const cairo_rectangle_int_t *src1,
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
clutter_util_rectangle_equal (const cairo_rectangle_int_t *src1,
|
||||
const cairo_rectangle_int_t *src2)
|
||||
{
|
||||
return ((src1->x == src2->x) &&
|
||||
(src1->y == src2->y) &&
|
||||
(src1->width == src2->width) &&
|
||||
(src1->height == src2->height));
|
||||
}
|
||||
|
||||
float
|
||||
_clutter_util_matrix_determinant (const ClutterMatrix *matrix)
|
||||
{
|
||||
|
@@ -56,6 +56,8 @@
|
||||
#include "clutter-content.h"
|
||||
#include "clutter-deform-effect.h"
|
||||
#include "clutter-desaturate-effect.h"
|
||||
#include "clutter-drag-action.h"
|
||||
#include "clutter-drop-action.h"
|
||||
#include "clutter-effect.h"
|
||||
#include "clutter-enums.h"
|
||||
#include "clutter-enum-types.h"
|
||||
|
@@ -47,7 +47,7 @@
|
||||
#include "clutter-stage-private.h"
|
||||
#include "clutter-stage-view-private.h"
|
||||
|
||||
#define MAX_STACK_RECTS 256
|
||||
#include "cogl/cogl-trace.h"
|
||||
|
||||
typedef struct _ClutterStageViewCoglPrivate
|
||||
{
|
||||
@@ -288,6 +288,97 @@ clutter_stage_cogl_resize (ClutterStageWindow *stage_window,
|
||||
{
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_stage_cogl_has_redraw_clips (ClutterStageWindow *stage_window)
|
||||
{
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
|
||||
|
||||
/* NB: at the start of each new frame there is an implied clip that
|
||||
* clips everything (i.e. nothing would be drawn) so we need to make
|
||||
* sure we return True in the un-initialized case here.
|
||||
*/
|
||||
if (!stage_cogl->initialized_redraw_clip ||
|
||||
(stage_cogl->initialized_redraw_clip &&
|
||||
stage_cogl->redraw_clip))
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_stage_cogl_ignoring_redraw_clips (ClutterStageWindow *stage_window)
|
||||
{
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
|
||||
|
||||
/* NB: a NULL clip means a full stage redraw is required */
|
||||
if (stage_cogl->initialized_redraw_clip &&
|
||||
!stage_cogl->redraw_clip)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* A redraw clip represents (in stage coordinates) the bounding box of
|
||||
* something that needs to be redrawn. Typically they are added to the
|
||||
* StageWindow as a result of clutter_actor_queue_clipped_redraw() by
|
||||
* actors such as ClutterGLXTexturePixmap. All redraw clips are
|
||||
* discarded after the next paint.
|
||||
*
|
||||
* A NULL stage_clip means the whole stage needs to be redrawn.
|
||||
*
|
||||
* What we do with this information:
|
||||
* - we keep track of the bounding box for all redraw clips
|
||||
* - when we come to redraw; we scissor the redraw to that box and use
|
||||
* glBlitFramebuffer to present the redraw to the front
|
||||
* buffer.
|
||||
*/
|
||||
static void
|
||||
clutter_stage_cogl_add_redraw_clip (ClutterStageWindow *stage_window,
|
||||
cairo_rectangle_int_t *stage_clip)
|
||||
{
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
|
||||
|
||||
/* If we are already forced to do a full stage redraw then bail early */
|
||||
if (clutter_stage_cogl_ignoring_redraw_clips (stage_window))
|
||||
return;
|
||||
|
||||
/* A NULL stage clip means a full stage redraw has been queued and
|
||||
* we keep track of this by setting a NULL redraw_clip.
|
||||
*/
|
||||
if (stage_clip == NULL)
|
||||
{
|
||||
g_clear_pointer (&stage_cogl->redraw_clip, cairo_region_destroy);
|
||||
stage_cogl->initialized_redraw_clip = TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ignore requests to add degenerate/empty clip rectangles */
|
||||
if (stage_clip->width == 0 || stage_clip->height == 0)
|
||||
return;
|
||||
|
||||
if (!stage_cogl->redraw_clip)
|
||||
{
|
||||
stage_cogl->redraw_clip = cairo_region_create_rectangle (stage_clip);
|
||||
}
|
||||
else
|
||||
{
|
||||
cairo_region_union_rectangle (stage_cogl->redraw_clip, stage_clip);
|
||||
}
|
||||
|
||||
stage_cogl->initialized_redraw_clip = TRUE;
|
||||
}
|
||||
|
||||
static cairo_region_t *
|
||||
clutter_stage_cogl_get_redraw_clip (ClutterStageWindow *stage_window)
|
||||
{
|
||||
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
|
||||
|
||||
if (stage_cogl->using_clipped_redraw && stage_cogl->redraw_clip)
|
||||
return cairo_region_copy (stage_cogl->redraw_clip);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
valid_buffer_age (ClutterStageViewCogl *view_cogl,
|
||||
int age)
|
||||
@@ -304,8 +395,7 @@ valid_buffer_age (ClutterStageViewCogl *view_cogl,
|
||||
static void
|
||||
paint_damage_region (ClutterStageWindow *stage_window,
|
||||
ClutterStageView *view,
|
||||
cairo_region_t *swap_region,
|
||||
cairo_region_t *queued_redraw_clip)
|
||||
cairo_region_t *swap_region)
|
||||
{
|
||||
CoglFramebuffer *framebuffer = clutter_stage_view_get_onscreen (view);
|
||||
CoglContext *ctx = cogl_framebuffer_get_context (framebuffer);
|
||||
@@ -342,7 +432,8 @@ paint_damage_region (ClutterStageWindow *stage_window,
|
||||
}
|
||||
|
||||
/* Red for the clip */
|
||||
if (queued_redraw_clip)
|
||||
if (stage_cogl->initialized_redraw_clip &&
|
||||
stage_cogl->redraw_clip)
|
||||
{
|
||||
static CoglPipeline *overlay_red = NULL;
|
||||
|
||||
@@ -352,13 +443,13 @@ paint_damage_region (ClutterStageWindow *stage_window,
|
||||
cogl_pipeline_set_color4ub (overlay_red, 0x33, 0x00, 0x00, 0x33);
|
||||
}
|
||||
|
||||
n_rects = cairo_region_num_rectangles (queued_redraw_clip);
|
||||
n_rects = cairo_region_num_rectangles (stage_cogl->redraw_clip);
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
cairo_rectangle_int_t rect;
|
||||
float x_1, x_2, y_1, y_2;
|
||||
|
||||
cairo_region_get_rectangle (queued_redraw_clip, i, &rect);
|
||||
cairo_region_get_rectangle (stage_cogl->redraw_clip, i, &rect);
|
||||
x_1 = rect.x;
|
||||
x_2 = rect.x + rect.width;
|
||||
y_1 = rect.y;
|
||||
@@ -380,6 +471,9 @@ swap_framebuffer (ClutterStageWindow *stage_window,
|
||||
CoglFramebuffer *framebuffer = clutter_stage_view_get_onscreen (view);
|
||||
int *damage, n_rects, i;
|
||||
|
||||
if (G_UNLIKELY ((clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_DAMAGE_REGION)))
|
||||
paint_damage_region (stage_window, view, swap_region);
|
||||
|
||||
n_rects = cairo_region_num_rectangles (swap_region);
|
||||
damage = g_newa (int, n_rects * 4);
|
||||
for (i = 0; i < n_rects; i++)
|
||||
@@ -442,52 +536,34 @@ scale_and_clamp_rect (const graphene_rect_t *rect,
|
||||
_clutter_util_rectangle_int_extents (&tmp, dest);
|
||||
}
|
||||
|
||||
static cairo_region_t *
|
||||
offset_scale_and_clamp_region (const cairo_region_t *region,
|
||||
int offset_x,
|
||||
int offset_y,
|
||||
float scale)
|
||||
{
|
||||
int n_rects, i;
|
||||
cairo_rectangle_int_t *rects;
|
||||
g_autofree cairo_rectangle_int_t *freeme = NULL;
|
||||
|
||||
n_rects = cairo_region_num_rectangles (region);
|
||||
|
||||
if (n_rects == 0)
|
||||
return cairo_region_create ();
|
||||
|
||||
if (n_rects < MAX_STACK_RECTS)
|
||||
rects = g_newa (cairo_rectangle_int_t, n_rects);
|
||||
else
|
||||
rects = freeme = g_new (cairo_rectangle_int_t, n_rects);
|
||||
|
||||
for (i = 0; i < n_rects; i++)
|
||||
cairo_region_get_rectangle (region, i, &rects[i]);
|
||||
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
graphene_rect_t tmp;
|
||||
|
||||
_clutter_util_rect_from_rectangle (&rects[i], &tmp);
|
||||
graphene_rect_offset (&tmp, offset_x, offset_y);
|
||||
scale_and_clamp_rect (&tmp, scale, &rects[i]);
|
||||
}
|
||||
|
||||
return cairo_region_create_rectangles (rects, n_rects);
|
||||
}
|
||||
|
||||
static void
|
||||
paint_stage (ClutterStageCogl *stage_cogl,
|
||||
ClutterStageView *view,
|
||||
cairo_region_t *redraw_clip)
|
||||
paint_stage (ClutterStageCogl *stage_cogl,
|
||||
ClutterStageView *view,
|
||||
cairo_region_t *clip)
|
||||
{
|
||||
ClutterStage *stage = stage_cogl->wrapper;
|
||||
cairo_rectangle_int_t clip_rect;
|
||||
cairo_rectangle_int_t paint_rect;
|
||||
cairo_rectangle_int_t view_rect;
|
||||
graphene_rect_t rect;
|
||||
float fb_scale;
|
||||
|
||||
clutter_stage_view_get_layout (view, &view_rect);
|
||||
fb_scale = clutter_stage_view_get_scale (view);
|
||||
|
||||
cairo_region_get_extents (clip, &clip_rect);
|
||||
|
||||
_clutter_util_rect_from_rectangle (&clip_rect, &rect);
|
||||
scale_and_clamp_rect (&rect, 1.0f / fb_scale, &paint_rect);
|
||||
_clutter_util_rectangle_offset (&paint_rect,
|
||||
view_rect.x,
|
||||
view_rect.y,
|
||||
&paint_rect);
|
||||
|
||||
_clutter_stage_maybe_setup_viewport (stage, view);
|
||||
clutter_stage_paint_view (stage, view, redraw_clip);
|
||||
_clutter_stage_paint_view (stage, view, &paint_rect);
|
||||
|
||||
clutter_stage_view_after_paint (view);
|
||||
clutter_stage_view_after_paint (view, &paint_rect);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -607,7 +683,7 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
clutter_stage_view_cogl_get_instance_private (view_cogl);
|
||||
CoglFramebuffer *fb = clutter_stage_view_get_framebuffer (view);
|
||||
cairo_rectangle_int_t view_rect;
|
||||
gboolean is_full_redraw;
|
||||
gboolean have_clip;
|
||||
gboolean may_use_clipped_redraw;
|
||||
gboolean use_clipped_redraw;
|
||||
gboolean can_blit_sub_buffer;
|
||||
@@ -616,7 +692,6 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
gboolean swap_with_damage;
|
||||
ClutterActor *wrapper;
|
||||
cairo_region_t *redraw_clip;
|
||||
cairo_region_t *queued_redraw_clip = NULL;
|
||||
cairo_region_t *fb_clip_region;
|
||||
cairo_region_t *swap_region;
|
||||
cairo_rectangle_int_t redraw_rect;
|
||||
@@ -624,7 +699,6 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
float fb_scale;
|
||||
int subpixel_compensation = 0;
|
||||
int fb_width, fb_height;
|
||||
int buffer_age;
|
||||
|
||||
wrapper = CLUTTER_ACTOR (stage_cogl->wrapper);
|
||||
|
||||
@@ -639,46 +713,55 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
|
||||
has_buffer_age = cogl_is_onscreen (fb) && is_buffer_age_enabled ();
|
||||
|
||||
redraw_clip = clutter_stage_view_take_redraw_clip (view);
|
||||
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_DAMAGE_REGION))
|
||||
queued_redraw_clip = cairo_region_copy (redraw_clip);
|
||||
|
||||
/* NB: a NULL redraw clip == full stage redraw */
|
||||
if (!redraw_clip)
|
||||
is_full_redraw = TRUE;
|
||||
if (!stage_cogl->redraw_clip)
|
||||
have_clip = FALSE;
|
||||
else
|
||||
is_full_redraw = FALSE;
|
||||
|
||||
may_use_clipped_redraw =
|
||||
_clutter_stage_window_can_clip_redraws (stage_window) &&
|
||||
(can_blit_sub_buffer || has_buffer_age) &&
|
||||
!is_full_redraw &&
|
||||
/* some drivers struggle to get going and produce some junk
|
||||
* frames when starting up... */
|
||||
cogl_onscreen_get_frame_counter (COGL_ONSCREEN (fb)) > 3;
|
||||
|
||||
if (has_buffer_age)
|
||||
{
|
||||
buffer_age = cogl_onscreen_get_buffer_age (COGL_ONSCREEN (fb));
|
||||
if (!valid_buffer_age (view_cogl, buffer_age))
|
||||
{
|
||||
CLUTTER_NOTE (CLIPPING, "Invalid back buffer(age=%d): forcing full redraw\n", buffer_age);
|
||||
may_use_clipped_redraw = FALSE;
|
||||
}
|
||||
cairo_region_t *view_region;
|
||||
redraw_clip = cairo_region_copy (stage_cogl->redraw_clip);
|
||||
|
||||
view_region = cairo_region_create_rectangle (&view_rect);
|
||||
cairo_region_intersect (redraw_clip, view_region);
|
||||
|
||||
have_clip = !cairo_region_equal (redraw_clip, view_region);
|
||||
cairo_region_destroy (view_region);
|
||||
}
|
||||
|
||||
if (may_use_clipped_redraw)
|
||||
may_use_clipped_redraw = FALSE;
|
||||
if (_clutter_stage_window_can_clip_redraws (stage_window) &&
|
||||
(can_blit_sub_buffer || has_buffer_age) &&
|
||||
have_clip &&
|
||||
/* some drivers struggle to get going and produce some junk
|
||||
* frames when starting up... */
|
||||
cogl_onscreen_get_frame_counter (COGL_ONSCREEN (fb)) > 3)
|
||||
{
|
||||
fb_clip_region = offset_scale_and_clamp_region (redraw_clip,
|
||||
-view_rect.x,
|
||||
-view_rect.y,
|
||||
fb_scale);
|
||||
graphene_rect_t rect;
|
||||
cairo_rectangle_int_t *rects;
|
||||
int n_rects, i;
|
||||
|
||||
may_use_clipped_redraw = TRUE;
|
||||
|
||||
fb_clip_region = cairo_region_create ();
|
||||
|
||||
n_rects = cairo_region_num_rectangles (redraw_clip);
|
||||
rects = g_new (cairo_rectangle_int_t, n_rects);
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
cairo_rectangle_int_t new_fb_clip_rect;
|
||||
|
||||
cairo_region_get_rectangle (redraw_clip, i, &rects[i]);
|
||||
|
||||
_clutter_util_rect_from_rectangle (&rects[i], &rect);
|
||||
graphene_rect_offset (&rect, -view_rect.x, -view_rect.y);
|
||||
scale_and_clamp_rect (&rect, fb_scale, &new_fb_clip_rect);
|
||||
|
||||
cairo_region_union_rectangle (fb_clip_region, &new_fb_clip_rect);
|
||||
}
|
||||
g_free (rects);
|
||||
|
||||
if (fb_scale != floorf (fb_scale))
|
||||
{
|
||||
int n_rects, i;
|
||||
cairo_rectangle_int_t *rects;
|
||||
|
||||
subpixel_compensation = ceilf (fb_scale);
|
||||
|
||||
n_rects = cairo_region_num_rectangles (fb_clip_region);
|
||||
@@ -697,16 +780,9 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
}
|
||||
else
|
||||
{
|
||||
cairo_rectangle_int_t fb_rect;
|
||||
|
||||
fb_rect = (cairo_rectangle_int_t) {
|
||||
.width = fb_width,
|
||||
.height = fb_height,
|
||||
};
|
||||
fb_clip_region = cairo_region_create_rectangle (&fb_rect);
|
||||
|
||||
g_clear_pointer (&redraw_clip, cairo_region_destroy);
|
||||
redraw_clip = cairo_region_create_rectangle (&view_rect);
|
||||
cairo_rectangle_int_t rect = { 0, 0, view_rect.width, view_rect.height };
|
||||
fb_clip_region = cairo_region_create_rectangle (&rect);
|
||||
redraw_clip = cairo_region_copy (fb_clip_region);
|
||||
}
|
||||
|
||||
if (may_use_clipped_redraw &&
|
||||
@@ -722,43 +798,62 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
{
|
||||
if (use_clipped_redraw && !clip_region_empty)
|
||||
{
|
||||
cairo_region_t *fb_damage;
|
||||
cairo_region_t *view_damage;
|
||||
int i;
|
||||
int age;
|
||||
|
||||
fill_current_damage_history (view, fb_clip_region);
|
||||
age = cogl_onscreen_get_buffer_age (COGL_ONSCREEN (fb));
|
||||
|
||||
fb_damage = cairo_region_create ();
|
||||
|
||||
for (i = 1; i <= buffer_age; i++)
|
||||
if (valid_buffer_age (view_cogl, age))
|
||||
{
|
||||
int damage_index;
|
||||
graphene_rect_t rect;
|
||||
cairo_rectangle_int_t damage_region;
|
||||
cairo_rectangle_int_t *rects;
|
||||
int n_rects, i;
|
||||
|
||||
damage_index = DAMAGE_HISTORY (view_priv->damage_index - i - 1);
|
||||
cairo_region_union (fb_damage,
|
||||
view_priv->damage_history[damage_index]);
|
||||
fill_current_damage_history (view, fb_clip_region);
|
||||
|
||||
for (i = 1; i <= age; i++)
|
||||
{
|
||||
cairo_region_t *fb_damage =
|
||||
view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index - i - 1)];
|
||||
cairo_region_union (fb_clip_region, fb_damage);
|
||||
}
|
||||
|
||||
/* Update the redraw clip state with the extra damage. */
|
||||
n_rects = cairo_region_num_rectangles (fb_clip_region);
|
||||
rects = g_newa (cairo_rectangle_int_t, n_rects);
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
cairo_region_get_rectangle (fb_clip_region, i, &rects[i]);
|
||||
_clutter_util_rect_from_rectangle (&rects[i], &rect);
|
||||
scale_and_clamp_rect (&rect, 1.0f / fb_scale, &damage_region);
|
||||
_clutter_util_rectangle_offset (&damage_region,
|
||||
view_rect.x,
|
||||
view_rect.y,
|
||||
&damage_region);
|
||||
cairo_region_union_rectangle (stage_cogl->redraw_clip,
|
||||
&damage_region);
|
||||
}
|
||||
|
||||
CLUTTER_NOTE (CLIPPING, "Reusing back buffer(age=%d) - repairing region: num rects: %d\n",
|
||||
age,
|
||||
cairo_region_num_rectangles (fb_clip_region));
|
||||
|
||||
swap_with_damage = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
cairo_rectangle_int_t fb_damage;
|
||||
|
||||
/* Update the fb clip region with the extra damage. */
|
||||
cairo_region_union (fb_clip_region, fb_damage);
|
||||
|
||||
view_damage = offset_scale_and_clamp_region (fb_damage,
|
||||
0, 0,
|
||||
1.0f / fb_scale);
|
||||
cairo_region_translate (view_damage, view_rect.x, view_rect.y);
|
||||
cairo_region_intersect_rectangle (view_damage, &view_rect);
|
||||
|
||||
/* Update the redraw clip region with the extra damage. */
|
||||
cairo_region_union (redraw_clip, view_damage);
|
||||
|
||||
cairo_region_destroy (view_damage);
|
||||
cairo_region_destroy (fb_damage);
|
||||
|
||||
CLUTTER_NOTE (CLIPPING, "Reusing back buffer(age=%d) - repairing region: num rects: %d\n",
|
||||
buffer_age,
|
||||
cairo_region_num_rectangles (fb_clip_region));
|
||||
|
||||
swap_with_damage = TRUE;
|
||||
CLUTTER_NOTE (CLIPPING, "Invalid back buffer(age=%d): forcing full redraw\n", age);
|
||||
use_clipped_redraw = FALSE;
|
||||
fb_damage = (cairo_rectangle_int_t) {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.width = ceilf (view_rect.width * fb_scale),
|
||||
.height = ceilf (view_rect.height * fb_scale)
|
||||
};
|
||||
fill_current_damage_history_rectangle (view, &fb_damage);
|
||||
}
|
||||
}
|
||||
else if (!use_clipped_redraw)
|
||||
{
|
||||
@@ -774,6 +869,7 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
}
|
||||
}
|
||||
|
||||
cogl_push_framebuffer (fb);
|
||||
if (use_clipped_redraw && clip_region_empty)
|
||||
{
|
||||
CLUTTER_NOTE (CLIPPING, "Empty stage output paint\n");
|
||||
@@ -783,6 +879,8 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
cairo_rectangle_int_t clip_rect;
|
||||
cairo_rectangle_int_t scissor_rect;
|
||||
|
||||
stage_cogl->using_clipped_redraw = TRUE;
|
||||
|
||||
if (cairo_region_num_rectangles (fb_clip_region) == 1)
|
||||
{
|
||||
cairo_region_get_extents (fb_clip_region, &clip_rect);
|
||||
@@ -810,9 +908,11 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
cogl_framebuffer_push_region_clip (fb, fb_clip_region);
|
||||
}
|
||||
|
||||
paint_stage (stage_cogl, view, redraw_clip);
|
||||
paint_stage (stage_cogl, view, fb_clip_region);
|
||||
|
||||
cogl_framebuffer_pop_clip (fb);
|
||||
|
||||
stage_cogl->using_clipped_redraw = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -840,15 +940,27 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
scissor_rect.width,
|
||||
scissor_rect.height);
|
||||
|
||||
paint_stage (stage_cogl, view, redraw_clip);
|
||||
paint_stage (stage_cogl, view, fb_clip_region);
|
||||
|
||||
cogl_framebuffer_pop_clip (fb);
|
||||
}
|
||||
else
|
||||
{
|
||||
paint_stage (stage_cogl, view, redraw_clip);
|
||||
cairo_rectangle_int_t clip;
|
||||
cairo_region_t *view_region;
|
||||
|
||||
clip = (cairo_rectangle_int_t) {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.width = ceilf (view_rect.width * fb_scale),
|
||||
.height = ceilf (view_rect.height * fb_scale)
|
||||
};
|
||||
view_region = cairo_region_create_rectangle (&clip);
|
||||
paint_stage (stage_cogl, view, view_region);
|
||||
cairo_region_destroy (view_region);
|
||||
}
|
||||
}
|
||||
cogl_pop_framebuffer ();
|
||||
|
||||
cairo_region_get_extents (redraw_clip, &redraw_rect);
|
||||
|
||||
@@ -917,8 +1029,10 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
do_swap_buffer = TRUE;
|
||||
}
|
||||
|
||||
g_clear_pointer (&redraw_clip, cairo_region_destroy);
|
||||
g_clear_pointer (&fb_clip_region, cairo_region_destroy);
|
||||
if (redraw_clip)
|
||||
cairo_region_destroy (redraw_clip);
|
||||
if (fb_clip_region)
|
||||
cairo_region_destroy (fb_clip_region);
|
||||
|
||||
if (do_swap_buffer)
|
||||
{
|
||||
@@ -938,13 +1052,6 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
swap_region = transformed_swap_region;
|
||||
}
|
||||
|
||||
if (queued_redraw_clip)
|
||||
{
|
||||
paint_damage_region (stage_window, view,
|
||||
swap_region, queued_redraw_clip);
|
||||
cairo_region_destroy (queued_redraw_clip);
|
||||
}
|
||||
|
||||
res = swap_framebuffer (stage_window,
|
||||
view,
|
||||
swap_region,
|
||||
@@ -956,25 +1063,10 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
|
||||
}
|
||||
else
|
||||
{
|
||||
g_clear_pointer (&queued_redraw_clip, cairo_region_destroy);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_cogl_scanout_view (ClutterStageCogl *stage_cogl,
|
||||
ClutterStageView *view,
|
||||
CoglScanout *scanout)
|
||||
{
|
||||
CoglFramebuffer *framebuffer = clutter_stage_view_get_framebuffer (view);
|
||||
CoglOnscreen *onscreen;
|
||||
|
||||
g_return_if_fail (cogl_is_onscreen (framebuffer));
|
||||
|
||||
onscreen = COGL_ONSCREEN (framebuffer);
|
||||
cogl_onscreen_direct_scanout (onscreen, scanout);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
|
||||
{
|
||||
@@ -987,23 +1079,9 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
|
||||
for (l = _clutter_stage_window_get_views (stage_window); l; l = l->next)
|
||||
{
|
||||
ClutterStageView *view = l->data;
|
||||
g_autoptr (CoglScanout) scanout = NULL;
|
||||
|
||||
if (!clutter_stage_view_has_redraw_clip (view))
|
||||
continue;
|
||||
|
||||
scanout = clutter_stage_view_take_scanout (view);
|
||||
if (scanout)
|
||||
{
|
||||
clutter_stage_cogl_scanout_view (stage_cogl,
|
||||
view,
|
||||
scanout);
|
||||
swap_event = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
swap_event |= clutter_stage_cogl_redraw_view (stage_window, view);
|
||||
}
|
||||
swap_event =
|
||||
clutter_stage_cogl_redraw_view (stage_window, view) || swap_event;
|
||||
}
|
||||
|
||||
_clutter_stage_emit_after_paint (stage_cogl->wrapper);
|
||||
@@ -1019,6 +1097,10 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
|
||||
stage_cogl->pending_swaps++;
|
||||
}
|
||||
|
||||
/* reset the redraw clipping for the next paint... */
|
||||
stage_cogl->initialized_redraw_clip = FALSE;
|
||||
g_clear_pointer (&stage_cogl->redraw_clip, cairo_region_destroy);
|
||||
|
||||
stage_cogl->frame_count++;
|
||||
|
||||
COGL_TRACE_END (ClutterStageCoglRedraw);
|
||||
@@ -1036,6 +1118,10 @@ clutter_stage_window_iface_init (ClutterStageWindowInterface *iface)
|
||||
iface->schedule_update = clutter_stage_cogl_schedule_update;
|
||||
iface->get_update_time = clutter_stage_cogl_get_update_time;
|
||||
iface->clear_update_time = clutter_stage_cogl_clear_update_time;
|
||||
iface->add_redraw_clip = clutter_stage_cogl_add_redraw_clip;
|
||||
iface->has_redraw_clips = clutter_stage_cogl_has_redraw_clips;
|
||||
iface->ignoring_redraw_clips = clutter_stage_cogl_ignoring_redraw_clips;
|
||||
iface->get_redraw_clip = clutter_stage_cogl_get_redraw_clip;
|
||||
iface->redraw = clutter_stage_cogl_redraw;
|
||||
}
|
||||
|
||||
|
@@ -5,6 +5,12 @@
|
||||
#include <clutter/clutter-backend.h>
|
||||
#include <clutter/clutter-stage.h>
|
||||
|
||||
#ifdef COGL_HAS_X11_SUPPORT
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xutil.h>
|
||||
#endif
|
||||
|
||||
#include "clutter/clutter-stage-window.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
@@ -55,6 +61,14 @@ struct _ClutterStageCogl
|
||||
unsigned int frame_count;
|
||||
|
||||
gint last_sync_delay;
|
||||
|
||||
cairo_region_t *redraw_clip;
|
||||
|
||||
guint initialized_redraw_clip : 1;
|
||||
|
||||
/* TRUE if the current paint cycle has a clipped redraw. In that
|
||||
case bounding_redraw_clip specifies the the bounds. */
|
||||
guint using_clipped_redraw : 1;
|
||||
};
|
||||
|
||||
struct _ClutterStageCoglClass
|
||||
|
@@ -277,30 +277,28 @@ clutter_container_iface_init (ClutterContainerIface *iface)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_group_real_paint (ClutterActor *actor,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_group_real_paint (ClutterActor *actor)
|
||||
{
|
||||
ClutterGroupPrivate *priv = CLUTTER_GROUP (actor)->priv;
|
||||
|
||||
CLUTTER_NOTE (PAINT, "ClutterGroup paint enter '%s'",
|
||||
_clutter_actor_get_debug_name (actor));
|
||||
|
||||
g_list_foreach (priv->children, (GFunc) clutter_actor_paint, paint_context);
|
||||
g_list_foreach (priv->children, (GFunc) clutter_actor_paint, NULL);
|
||||
|
||||
CLUTTER_NOTE (PAINT, "ClutterGroup paint leave '%s'",
|
||||
_clutter_actor_get_debug_name (actor));
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_group_real_pick (ClutterActor *actor,
|
||||
ClutterPickContext *pick_context)
|
||||
clutter_group_real_pick (ClutterActor *actor)
|
||||
{
|
||||
ClutterGroupPrivate *priv = CLUTTER_GROUP (actor)->priv;
|
||||
|
||||
/* Chain up so we get a bounding box pained (if we are reactive) */
|
||||
CLUTTER_ACTOR_CLASS (clutter_group_parent_class)->pick (actor, pick_context);
|
||||
CLUTTER_ACTOR_CLASS (clutter_group_parent_class)->pick (actor);
|
||||
|
||||
g_list_foreach (priv->children, (GFunc) clutter_actor_pick, pick_context);
|
||||
g_list_foreach (priv->children, (GFunc) clutter_actor_pick, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -78,12 +78,10 @@ static const ClutterColor default_border_color = { 0, 0, 0, 255 };
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterRectangle, clutter_rectangle, CLUTTER_TYPE_ACTOR)
|
||||
|
||||
static void
|
||||
clutter_rectangle_paint (ClutterActor *self,
|
||||
ClutterPaintContext *paint_context)
|
||||
clutter_rectangle_paint (ClutterActor *self)
|
||||
{
|
||||
ClutterRectanglePrivate *priv = CLUTTER_RECTANGLE (self)->priv;
|
||||
CoglFramebuffer *framebuffer =
|
||||
clutter_paint_context_get_framebuffer (paint_context);
|
||||
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
|
||||
static CoglPipeline *default_color_pipeline = NULL;
|
||||
CoglPipeline *content_pipeline;
|
||||
ClutterActorBox alloc;
|
||||
|
@@ -233,7 +233,7 @@ clutter_backend_egl_native_init (ClutterBackendEglNative *backend_egl_native)
|
||||
GSettingsSchemaSource *source = g_settings_schema_source_get_default ();
|
||||
GSettingsSchema *schema = g_settings_schema_source_lookup (source,
|
||||
xsettings_path,
|
||||
TRUE);
|
||||
FALSE);
|
||||
|
||||
if (!schema)
|
||||
{
|
||||
|
@@ -37,6 +37,12 @@
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#ifdef COGL_HAS_XLIB_SUPPORT
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xutil.h>
|
||||
#endif
|
||||
|
||||
#include "clutter-egl-headers.h"
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
|
@@ -30,6 +30,8 @@ clutter_headers = [
|
||||
'clutter-deform-effect.h',
|
||||
'clutter-deprecated.h',
|
||||
'clutter-desaturate-effect.h',
|
||||
'clutter-drag-action.h',
|
||||
'clutter-drop-action.h',
|
||||
'clutter-effect.h',
|
||||
'clutter-enums.h',
|
||||
'clutter-event.h',
|
||||
@@ -55,13 +57,11 @@ clutter_headers = [
|
||||
'clutter-mutter.h',
|
||||
'clutter-offscreen-effect.h',
|
||||
'clutter-page-turn-effect.h',
|
||||
'clutter-paint-context.h',
|
||||
'clutter-paint-nodes.h',
|
||||
'clutter-paint-node.h',
|
||||
'clutter-pan-action.h',
|
||||
'clutter-path-constraint.h',
|
||||
'clutter-path.h',
|
||||
'clutter-pick-context.h',
|
||||
'clutter-property-transition.h',
|
||||
'clutter-rotate-action.h',
|
||||
'clutter-script.h',
|
||||
@@ -116,6 +116,8 @@ clutter_sources = [
|
||||
'clutter-content.c',
|
||||
'clutter-deform-effect.c',
|
||||
'clutter-desaturate-effect.c',
|
||||
'clutter-drag-action.c',
|
||||
'clutter-drop-action.c',
|
||||
'clutter-effect.c',
|
||||
'clutter-event.c',
|
||||
'clutter-feature.c',
|
||||
@@ -143,13 +145,11 @@ clutter_sources = [
|
||||
'clutter-master-clock-default.c',
|
||||
'clutter-offscreen-effect.c',
|
||||
'clutter-page-turn-effect.c',
|
||||
'clutter-paint-context.c',
|
||||
'clutter-paint-nodes.c',
|
||||
'clutter-paint-node.c',
|
||||
'clutter-pan-action.c',
|
||||
'clutter-path-constraint.c',
|
||||
'clutter-path.c',
|
||||
'clutter-pick-context.c',
|
||||
'clutter-property-transition.c',
|
||||
'clutter-rotate-action.c',
|
||||
'clutter-script.c',
|
||||
@@ -200,7 +200,6 @@ clutter_private_headers = [
|
||||
'clutter-master-clock.h',
|
||||
'clutter-master-clock-default.h',
|
||||
'clutter-offscreen-effect-private.h',
|
||||
'clutter-paint-context-private.h',
|
||||
'clutter-paint-node-private.h',
|
||||
'clutter-paint-volume-private.h',
|
||||
'clutter-private.h',
|
||||
@@ -337,20 +336,35 @@ clutter_build_config_h = configure_file(
|
||||
)
|
||||
clutter_built_private_headers += clutter_build_config_h
|
||||
|
||||
cdata = configuration_data()
|
||||
clutter_config_defines = []
|
||||
if have_wayland
|
||||
cdata.set10('CLUTTER_HAS_WAYLAND_COMPOSITOR_SUPPORT', true)
|
||||
clutter_config_defines += [
|
||||
'#define CLUTTER_HAS_WAYLAND_COMPOSITOR_SUPPORT 1',
|
||||
]
|
||||
endif
|
||||
if have_x11
|
||||
cdata.set_quoted('CLUTTER_WINDOWING_X11', 'x11')
|
||||
cdata.set_quoted('CLUTTER_INPUT_X11', 'x11')
|
||||
cdata.set_quoted('CLUTTER_WINDOWING_GLX', 'glx')
|
||||
clutter_config_defines += [
|
||||
'#define CLUTTER_WINDOWING_X11 "x11"',
|
||||
'#define CLUTTER_INPUT_X11 "x11"',
|
||||
'#define CLUTTER_WINDOWING_GLX "glx"',
|
||||
]
|
||||
endif
|
||||
if have_native_backend
|
||||
cdata.set_quoted('CLUTTER_WINDOWING_EGL', 'eglnative')
|
||||
cdata.set_quoted('CLUTTER_INPUT_EVDEV', 'evdev')
|
||||
clutter_config_defines += [
|
||||
'#define CLUTTER_WINDOWING_EGL "eglnative"',
|
||||
'#define CLUTTER_INPUT_EVDEV "evdev"',
|
||||
]
|
||||
endif
|
||||
cdata.set_quoted('CLUTTER_INPUT_NULL', 'null')
|
||||
clutter_config_defines += [
|
||||
'#define CLUTTER_INPUT_NULL "null"',
|
||||
]
|
||||
clutter_config_defines_string = ''
|
||||
foreach clutter_config_define : clutter_config_defines
|
||||
clutter_config_defines_string += clutter_config_define + '\n'
|
||||
endforeach
|
||||
|
||||
cdata = configuration_data()
|
||||
cdata.set('CLUTTER_CONFIG_DEFINES', clutter_config_defines_string)
|
||||
|
||||
clutter_config_h = configure_file(
|
||||
input: 'clutter-config.h.in',
|
||||
@@ -410,6 +424,7 @@ libmutter_clutter = shared_library(libmutter_clutter_name,
|
||||
link_with: [
|
||||
libmutter_cogl,
|
||||
libmutter_cogl_pango,
|
||||
libmutter_cogl_path,
|
||||
],
|
||||
install_rpath: pkglibdir,
|
||||
install_dir: pkglibdir,
|
||||
|
2
cogl/.gitignore
vendored
2
cogl/.gitignore
vendored
@@ -36,6 +36,8 @@ cogl-egl-defines.h
|
||||
cogl-enum-types.c
|
||||
cogl-enum-types.h
|
||||
cogl-gl-header.h
|
||||
cogl-path-enum-types.c
|
||||
cogl-path-enum-types.h
|
||||
cogl-config.h
|
||||
cogl-config.h.in
|
||||
cogl-mutter-config.h
|
||||
|
@@ -81,7 +81,6 @@ struct _CoglPangoDisplayListNode
|
||||
GArray *rectangles;
|
||||
/* A primitive representing those vertices */
|
||||
CoglPrimitive *primitive;
|
||||
guint has_color : 1;
|
||||
} texture;
|
||||
|
||||
struct
|
||||
@@ -421,9 +420,7 @@ _cogl_pango_display_list_render (CoglFramebuffer *fb,
|
||||
cogl_color_get_red_byte (&node->color),
|
||||
cogl_color_get_green_byte (&node->color),
|
||||
cogl_color_get_blue_byte (&node->color),
|
||||
(cogl_color_get_alpha_byte (&node->color) *
|
||||
cogl_color_get_alpha_byte (color) /
|
||||
255));
|
||||
cogl_color_get_alpha_byte (color));
|
||||
else
|
||||
draw_color = *color;
|
||||
cogl_color_premultiply (&draw_color);
|
||||
|
@@ -74,7 +74,7 @@ PangoFontMap *
|
||||
cogl_pango_font_map_new (void)
|
||||
{
|
||||
PangoFontMap *fm = pango_cairo_font_map_new ();
|
||||
g_autofree CoglPangoFontMapPriv *priv = g_new0 (CoglPangoFontMapPriv, 1);
|
||||
CoglPangoFontMapPriv *priv = g_new0 (CoglPangoFontMapPriv, 1);
|
||||
|
||||
_COGL_GET_CONTEXT (context, NULL);
|
||||
|
||||
@@ -85,7 +85,7 @@ cogl_pango_font_map_new (void)
|
||||
* for now. */
|
||||
g_object_set_qdata_full (G_OBJECT (fm),
|
||||
cogl_pango_font_map_get_priv_key (),
|
||||
g_steal_pointer (&priv),
|
||||
priv,
|
||||
free_priv);
|
||||
|
||||
return fm;
|
||||
|
@@ -58,29 +58,27 @@ struct _CoglPangoGlyphCacheValue
|
||||
|
||||
/* This will be set to TRUE when the glyph atlas is reorganized
|
||||
which means the glyph will need to be redrawn */
|
||||
guint dirty : 1;
|
||||
/* Set to TRUE if the glyph has colors (eg. emoji) */
|
||||
guint has_color : 1;
|
||||
gboolean dirty;
|
||||
};
|
||||
|
||||
typedef void (* CoglPangoGlyphCacheDirtyFunc) (PangoFont *font,
|
||||
PangoGlyph glyph,
|
||||
CoglPangoGlyphCacheValue *value);
|
||||
|
||||
COGL_EXPORT CoglPangoGlyphCache *
|
||||
CoglPangoGlyphCache *
|
||||
cogl_pango_glyph_cache_new (CoglContext *ctx,
|
||||
gboolean use_mipmapping);
|
||||
|
||||
COGL_EXPORT void
|
||||
void
|
||||
cogl_pango_glyph_cache_free (CoglPangoGlyphCache *cache);
|
||||
|
||||
COGL_EXPORT CoglPangoGlyphCacheValue *
|
||||
CoglPangoGlyphCacheValue *
|
||||
cogl_pango_glyph_cache_lookup (CoglPangoGlyphCache *cache,
|
||||
gboolean create,
|
||||
PangoFont *font,
|
||||
PangoGlyph glyph);
|
||||
|
||||
COGL_EXPORT void
|
||||
void
|
||||
cogl_pango_glyph_cache_clear (CoglPangoGlyphCache *cache);
|
||||
|
||||
void
|
||||
|
@@ -50,7 +50,6 @@
|
||||
#include <pango/pangocairo.h>
|
||||
#include <pango/pango-renderer.h>
|
||||
#include <cairo.h>
|
||||
#include <cairo-ft.h>
|
||||
|
||||
#include "cogl/cogl-debug.h"
|
||||
#include "cogl/cogl-context-private.h"
|
||||
@@ -455,6 +454,34 @@ cogl_pango_show_layout (CoglFramebuffer *fb,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cogl_pango_render_layout_subpixel (PangoLayout *layout,
|
||||
int x,
|
||||
int y,
|
||||
const CoglColor *color,
|
||||
int flags)
|
||||
{
|
||||
cogl_pango_show_layout (cogl_get_draw_framebuffer (),
|
||||
layout,
|
||||
x / (float) PANGO_SCALE,
|
||||
y / (float) PANGO_SCALE,
|
||||
color);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_pango_render_layout (PangoLayout *layout,
|
||||
int x,
|
||||
int y,
|
||||
const CoglColor *color,
|
||||
int flags)
|
||||
{
|
||||
cogl_pango_render_layout_subpixel (layout,
|
||||
x * PANGO_SCALE,
|
||||
y * PANGO_SCALE,
|
||||
color,
|
||||
flags);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_pango_show_layout_line (CoglFramebuffer *fb,
|
||||
PangoLayoutLine *line,
|
||||
@@ -492,6 +519,19 @@ cogl_pango_show_layout_line (CoglFramebuffer *fb,
|
||||
priv->display_list = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
cogl_pango_render_layout_line (PangoLayoutLine *line,
|
||||
int x,
|
||||
int y,
|
||||
const CoglColor *color)
|
||||
{
|
||||
cogl_pango_show_layout_line (cogl_get_draw_framebuffer (),
|
||||
line,
|
||||
x / (float) PANGO_SCALE,
|
||||
y / (float) PANGO_SCALE,
|
||||
color);
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_pango_renderer_clear_glyph_cache (CoglPangoRenderer *renderer)
|
||||
{
|
||||
@@ -527,24 +567,6 @@ cogl_pango_renderer_get_cached_glyph (PangoRenderer *renderer,
|
||||
create, font, glyph);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
font_has_color_glyphs (const PangoFont *font)
|
||||
{
|
||||
cairo_scaled_font_t *scaled_font;
|
||||
gboolean has_color = FALSE;
|
||||
|
||||
scaled_font = pango_cairo_font_get_scaled_font ((PangoCairoFont *) font);
|
||||
|
||||
if (cairo_scaled_font_get_type (scaled_font) == CAIRO_FONT_TYPE_FT)
|
||||
{
|
||||
FT_Face ft_face = cairo_ft_scaled_font_lock_face (scaled_font);
|
||||
has_color = (FT_HAS_COLOR (ft_face) != 0);
|
||||
cairo_ft_scaled_font_unlock_face (scaled_font);
|
||||
}
|
||||
|
||||
return has_color;
|
||||
}
|
||||
|
||||
static void
|
||||
cogl_pango_renderer_set_dirty_glyph (PangoFont *font,
|
||||
PangoGlyph glyph,
|
||||
@@ -619,8 +641,6 @@ cogl_pango_renderer_set_dirty_glyph (PangoFont *font,
|
||||
cairo_image_surface_get_data (surface));
|
||||
|
||||
cairo_surface_destroy (surface);
|
||||
|
||||
value->has_color = font_has_color_glyphs (font);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -719,7 +739,6 @@ cogl_pango_renderer_set_color_for_part (PangoRenderer *renderer,
|
||||
PangoRenderPart part)
|
||||
{
|
||||
PangoColor *pango_color = pango_renderer_get_color (renderer, part);
|
||||
uint16_t alpha = pango_renderer_get_alpha (renderer, part);
|
||||
CoglPangoRenderer *priv = COGL_PANGO_RENDERER (renderer);
|
||||
|
||||
if (pango_color)
|
||||
@@ -730,7 +749,7 @@ cogl_pango_renderer_set_color_for_part (PangoRenderer *renderer,
|
||||
pango_color->red >> 8,
|
||||
pango_color->green >> 8,
|
||||
pango_color->blue >> 8,
|
||||
alpha ? alpha >> 8 : 0xff);
|
||||
0xff);
|
||||
|
||||
_cogl_pango_display_list_set_color_override (priv->display_list, &color);
|
||||
}
|
||||
@@ -842,13 +861,14 @@ cogl_pango_renderer_draw_glyphs (PangoRenderer *renderer,
|
||||
CoglPangoGlyphCacheValue *cache_value;
|
||||
int i;
|
||||
|
||||
cogl_pango_renderer_set_color_for_part (renderer,
|
||||
PANGO_RENDER_PART_FOREGROUND);
|
||||
|
||||
for (i = 0; i < glyphs->num_glyphs; i++)
|
||||
{
|
||||
PangoGlyphInfo *gi = glyphs->glyphs + i;
|
||||
float x, y;
|
||||
|
||||
cogl_pango_renderer_set_color_for_part (renderer,
|
||||
PANGO_RENDER_PART_FOREGROUND);
|
||||
cogl_pango_renderer_get_device_units (renderer,
|
||||
xi + gi->geometry.x_offset,
|
||||
yi + gi->geometry.y_offset,
|
||||
@@ -905,19 +925,6 @@ cogl_pango_renderer_draw_glyphs (PangoRenderer *renderer,
|
||||
x += (float)(cache_value->draw_x);
|
||||
y += (float)(cache_value->draw_y);
|
||||
|
||||
/* Do not override color if the glyph/font provide its own */
|
||||
if (cache_value->has_color)
|
||||
{
|
||||
CoglColor color;
|
||||
uint16_t alpha;
|
||||
|
||||
alpha = pango_renderer_get_alpha (renderer,
|
||||
PANGO_RENDER_PART_FOREGROUND);
|
||||
cogl_color_init_from_4ub (&color, 0xff, 0xff, 0xff,
|
||||
alpha ? alpha >> 8 : 0xff);
|
||||
_cogl_pango_display_list_set_color_override (priv->display_list, &color);
|
||||
}
|
||||
|
||||
cogl_pango_renderer_draw_glyph (priv, cache_value, x, y);
|
||||
}
|
||||
}
|
||||
|
@@ -75,7 +75,7 @@ typedef PangoCairoFontMap CoglPangoFontMap;
|
||||
*
|
||||
* Since: 1.14
|
||||
*/
|
||||
COGL_EXPORT PangoFontMap *
|
||||
PangoFontMap *
|
||||
cogl_pango_font_map_new (void);
|
||||
|
||||
/**
|
||||
@@ -86,7 +86,7 @@ cogl_pango_font_map_new (void);
|
||||
*
|
||||
* Returns: (transfer full): the newly created context: free with g_object_unref().
|
||||
*/
|
||||
COGL_EXPORT PangoContext *
|
||||
PangoContext *
|
||||
cogl_pango_font_map_create_context (CoglPangoFontMap *font_map);
|
||||
|
||||
/**
|
||||
@@ -102,7 +102,7 @@ cogl_pango_font_map_create_context (CoglPangoFontMap *font_map);
|
||||
*
|
||||
* Since: 1.14
|
||||
*/
|
||||
COGL_EXPORT void
|
||||
void
|
||||
cogl_pango_font_map_set_resolution (CoglPangoFontMap *font_map,
|
||||
double dpi);
|
||||
|
||||
@@ -114,7 +114,7 @@ cogl_pango_font_map_set_resolution (CoglPangoFontMap *font_map,
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
COGL_EXPORT void
|
||||
void
|
||||
cogl_pango_font_map_clear_glyph_cache (CoglPangoFontMap *font_map);
|
||||
|
||||
/**
|
||||
@@ -129,7 +129,7 @@ cogl_pango_font_map_clear_glyph_cache (CoglPangoFontMap *font_map);
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
COGL_EXPORT void
|
||||
void
|
||||
cogl_pango_ensure_glyph_cache_for_layout (PangoLayout *layout);
|
||||
|
||||
/**
|
||||
@@ -142,7 +142,7 @@ cogl_pango_ensure_glyph_cache_for_layout (PangoLayout *layout);
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
COGL_EXPORT void
|
||||
void
|
||||
cogl_pango_font_map_set_use_mipmapping (CoglPangoFontMap *font_map,
|
||||
gboolean value);
|
||||
|
||||
@@ -157,7 +157,7 @@ cogl_pango_font_map_set_use_mipmapping (CoglPangoFontMap *font_map,
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
COGL_EXPORT gboolean
|
||||
gboolean
|
||||
cogl_pango_font_map_get_use_mipmapping (CoglPangoFontMap *font_map);
|
||||
|
||||
/**
|
||||
@@ -170,7 +170,7 @@ cogl_pango_font_map_get_use_mipmapping (CoglPangoFontMap *font_map);
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
COGL_EXPORT PangoRenderer *
|
||||
PangoRenderer *
|
||||
cogl_pango_font_map_get_renderer (CoglPangoFontMap *font_map);
|
||||
|
||||
/**
|
||||
@@ -187,7 +187,7 @@ cogl_pango_font_map_get_renderer (CoglPangoFontMap *font_map);
|
||||
*
|
||||
* Since: 1.14
|
||||
*/
|
||||
COGL_EXPORT void
|
||||
void
|
||||
cogl_pango_show_layout (CoglFramebuffer *framebuffer,
|
||||
PangoLayout *layout,
|
||||
float x,
|
||||
@@ -208,7 +208,7 @@ cogl_pango_show_layout (CoglFramebuffer *framebuffer,
|
||||
*
|
||||
* Since: 1.14
|
||||
*/
|
||||
COGL_EXPORT void
|
||||
void
|
||||
cogl_pango_show_layout_line (CoglFramebuffer *framebuffer,
|
||||
PangoLayoutLine *line,
|
||||
float x,
|
||||
@@ -227,7 +227,72 @@ cogl_pango_show_layout_line (CoglFramebuffer *framebuffer,
|
||||
typedef struct _CoglPangoRenderer CoglPangoRenderer;
|
||||
typedef struct _CoglPangoRendererClass CoglPangoRendererClass;
|
||||
|
||||
COGL_EXPORT GType cogl_pango_renderer_get_type (void) G_GNUC_CONST;
|
||||
GType cogl_pango_renderer_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/**
|
||||
* cogl_pango_render_layout_subpixel:
|
||||
* @layout: a #PangoLayout
|
||||
* @x: X coordinate (in Pango units) to render the layout at
|
||||
* @y: Y coordinate (in Pango units) to render the layout at
|
||||
* @color: color to use when rendering the layout
|
||||
* @flags:
|
||||
*
|
||||
* Draws a solidly coloured @layout on the given @framebuffer at (@x,
|
||||
* @y) within the @framebuffer<!-- -->'s current model-view coordinate
|
||||
* space.
|
||||
*
|
||||
* Since: 1.0
|
||||
* Deprecated: 1.16: Use cogl_pango_show_layout() instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_pango_show_layout)
|
||||
void
|
||||
cogl_pango_render_layout_subpixel (PangoLayout *layout,
|
||||
int x,
|
||||
int y,
|
||||
const CoglColor *color,
|
||||
int flags);
|
||||
|
||||
/**
|
||||
* cogl_pango_render_layout:
|
||||
* @layout: a #PangoLayout
|
||||
* @x: X coordinate to render the layout at
|
||||
* @y: Y coordinate to render the layout at
|
||||
* @color: color to use when rendering the layout
|
||||
* @flags:
|
||||
*
|
||||
* Draws a solidly coloured @layout on the given @framebuffer at (@x,
|
||||
* @y) within the @framebuffer<!-- -->'s current model-view coordinate
|
||||
* space.
|
||||
*
|
||||
* Since: 1.0
|
||||
* Deprecated: 1.16: Use cogl_pango_show_layout() instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_pango_show_layout)
|
||||
void
|
||||
cogl_pango_render_layout (PangoLayout *layout,
|
||||
int x,
|
||||
int y,
|
||||
const CoglColor *color,
|
||||
int flags);
|
||||
|
||||
/**
|
||||
* cogl_pango_render_layout_line:
|
||||
* @line: a #PangoLayoutLine
|
||||
* @x: X coordinate to render the line at
|
||||
* @y: Y coordinate to render the line at
|
||||
* @color: color to use when rendering the line
|
||||
*
|
||||
* Renders @line at the given coordinates using the given color.
|
||||
*
|
||||
* Since: 1.0
|
||||
* Deprecated: 1.16: Use cogl_pango_show_layout() instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_pango_show_layout_line)
|
||||
void
|
||||
cogl_pango_render_layout_line (PangoLayoutLine *line,
|
||||
int x,
|
||||
int y,
|
||||
const CoglColor *color);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@@ -7,3 +7,6 @@ cogl_pango_font_map_new
|
||||
cogl_pango_font_map_set_resolution
|
||||
cogl_pango_font_map_set_use_mipmapping
|
||||
cogl_pango_renderer_get_type
|
||||
cogl_pango_render_layout
|
||||
cogl_pango_render_layout_line
|
||||
cogl_pango_render_layout_subpixel
|
||||
|
6
cogl/cogl-pango/libmutter-cogl-pango.map
Normal file
6
cogl/cogl-pango/libmutter-cogl-pango.map
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
global:
|
||||
cogl_pango_*;
|
||||
local:
|
||||
*;
|
||||
};
|
@@ -20,13 +20,19 @@ cogl_pango_deps = [
|
||||
libmutter_cogl_dep,
|
||||
]
|
||||
|
||||
libmutter_cogl_pango_map = 'libmutter-cogl-pango.map'
|
||||
libmutter_cogl_pango_link_args = [
|
||||
'-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(),
|
||||
libmutter_cogl_pango_map),
|
||||
]
|
||||
libmutter_cogl_pango = shared_library('mutter-cogl-pango-' + libmutter_api_version,
|
||||
sources: [cogl_pango_sources, cogl_pango_public_headers],
|
||||
version: '0.0.0',
|
||||
soversion: 0,
|
||||
c_args: cogl_c_args,
|
||||
include_directories: [cogl_includepath],
|
||||
gnu_symbol_visibility: 'hidden',
|
||||
include_directories: [cogl_includepath, cogl_path_includepath],
|
||||
link_depends: libmutter_cogl_pango_map,
|
||||
link_args: libmutter_cogl_pango_link_args,
|
||||
dependencies: [cogl_pango_deps],
|
||||
install_rpath: pkglibdir,
|
||||
install_dir: pkglibdir,
|
||||
|
48
cogl/cogl-path/cogl-path-enum-types.c.in
Normal file
48
cogl/cogl-path/cogl-path-enum-types.c.in
Normal file
@@ -0,0 +1,48 @@
|
||||
/*** BEGIN file-header ***/
|
||||
#include "cogl-config.h"
|
||||
|
||||
/* We need to undefine this so that we will be sure to include
|
||||
* cogl-path.h instead of cogl2-path.h when we include the framebuffer
|
||||
* header. Otherwise it will include both headers and it won't
|
||||
* compile. */
|
||||
#undef COGL_ENABLE_EXPERIMENTAL_2_0_API
|
||||
|
||||
#include "cogl-path-enum-types.h"
|
||||
/*** END file-header ***/
|
||||
|
||||
/*** BEGIN file-production ***/
|
||||
|
||||
/* enumerations from "@filename@" */
|
||||
#include "@filename@"
|
||||
|
||||
/*** END file-production ***/
|
||||
|
||||
/*** BEGIN value-header ***/
|
||||
GType
|
||||
@enum_name@_get_type (void)
|
||||
{
|
||||
static volatile gsize g_enum_type_id__volatile = 0;
|
||||
|
||||
if (g_once_init_enter (&g_enum_type_id__volatile))
|
||||
{
|
||||
static const G@Type@Value values[] = {
|
||||
/*** END value-header ***/
|
||||
|
||||
/*** BEGIN value-production ***/
|
||||
{ @VALUENAME@, "@VALUENAME@", "@valuenick@" },
|
||||
/*** END value-production ***/
|
||||
|
||||
/*** BEGIN value-tail ***/
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
GType g_enum_type_id;
|
||||
|
||||
g_enum_type_id =
|
||||
g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
|
||||
|
||||
g_once_init_leave (&g_enum_type_id__volatile, g_enum_type_id);
|
||||
}
|
||||
|
||||
return g_enum_type_id__volatile;
|
||||
}
|
||||
/*** END value-tail ***/
|
25
cogl/cogl-path/cogl-path-enum-types.h.in
Normal file
25
cogl/cogl-path/cogl-path-enum-types.h.in
Normal file
@@ -0,0 +1,25 @@
|
||||
/*** BEGIN file-header ***/
|
||||
#ifndef __COGL_PATH_ENUM_TYPES_H__
|
||||
#define __COGL_PATH_ENUM_TYPES_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/*** END file-header ***/
|
||||
|
||||
/*** BEGIN file-production ***/
|
||||
/* enumerations from "@basename@" */
|
||||
/*** END file-production ***/
|
||||
|
||||
/*** BEGIN file-tail ***/
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __COGL_PATH_ENUM_TYPES_H__ */
|
||||
/*** END file-tail ***/
|
||||
|
||||
/*** BEGIN value-header ***/
|
||||
GType @enum_name@_get_type (void) G_GNUC_CONST;
|
||||
#define COGL_TYPE_@ENUMSHORT@ (@enum_name@_get_type())
|
||||
|
||||
/*** END value-header ***/
|
535
cogl/cogl-path/cogl-path-functions.h
Normal file
535
cogl/cogl-path/cogl-path-functions.h
Normal file
@@ -0,0 +1,535 @@
|
||||
/*
|
||||
* Cogl
|
||||
*
|
||||
* A Low Level GPU Graphics and Utilities API
|
||||
*
|
||||
* Copyright (C) 2008,2009,2013 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use, copy,
|
||||
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION)
|
||||
#error "Only <cogl/cogl.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __COGL_PATH_FUNCTIONS_H__
|
||||
#define __COGL_PATH_FUNCTIONS_H__
|
||||
|
||||
#include <cogl/cogl-types.h>
|
||||
#ifdef COGL_COMPILATION
|
||||
#include "cogl-context.h"
|
||||
#else
|
||||
#include <cogl/cogl.h>
|
||||
#endif
|
||||
#include <glib-object.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* cogl_path_get_gtype:
|
||||
*
|
||||
* Returns: a #GType that can be used with the GLib type system.
|
||||
*/
|
||||
GType cogl_path_get_gtype (void);
|
||||
|
||||
#define cogl_path_new cogl2_path_new
|
||||
/**
|
||||
* cogl_path_new:
|
||||
*
|
||||
* Creates a new, empty path object. The default fill rule is
|
||||
* %COGL_PATH_FILL_RULE_EVEN_ODD.
|
||||
*
|
||||
* Return value: A pointer to a newly allocated #CoglPath, which can
|
||||
* be freed using cogl_object_unref().
|
||||
*
|
||||
* Since: 2.0
|
||||
*/
|
||||
CoglPath *
|
||||
cogl_path_new (void);
|
||||
|
||||
/**
|
||||
* cogl_path_copy:
|
||||
* @path: A #CoglPath object
|
||||
*
|
||||
* Returns a new copy of the path in @path. The new path has a
|
||||
* reference count of 1 so you should unref it with
|
||||
* cogl_object_unref() if you no longer need it.
|
||||
*
|
||||
* Internally the path will share the data until one of the paths is
|
||||
* modified so copying paths should be relatively cheap.
|
||||
*
|
||||
* Return value: (transfer full): a copy of the path in @path.
|
||||
*
|
||||
* Since: 2.0
|
||||
*/
|
||||
CoglPath *
|
||||
cogl_path_copy (CoglPath *path);
|
||||
|
||||
/**
|
||||
* cogl_is_path:
|
||||
* @object: A #CoglObject
|
||||
*
|
||||
* Gets whether the given object references an existing path object.
|
||||
*
|
||||
* Return value: %TRUE if the object references a #CoglPath,
|
||||
* %FALSE otherwise.
|
||||
*
|
||||
* Since: 2.0
|
||||
*/
|
||||
gboolean
|
||||
cogl_is_path (void *object);
|
||||
|
||||
#define cogl_path_move_to cogl2_path_move_to
|
||||
/**
|
||||
* cogl_path_move_to:
|
||||
* @x: X coordinate of the pen location to move to.
|
||||
* @y: Y coordinate of the pen location to move to.
|
||||
*
|
||||
* Moves the pen to the given location. If there is an existing path
|
||||
* this will start a new disjoint subpath.
|
||||
*
|
||||
* Since: 2.0
|
||||
*/
|
||||
void
|
||||
cogl_path_move_to (CoglPath *path,
|
||||
float x,
|
||||
float y);
|
||||
|
||||
#define cogl_path_rel_move_to cogl2_path_rel_move_to
|
||||
/**
|
||||
* cogl_path_rel_move_to:
|
||||
* @x: X offset from the current pen location to move the pen to.
|
||||
* @y: Y offset from the current pen location to move the pen to.
|
||||
*
|
||||
* Moves the pen to the given offset relative to the current pen
|
||||
* location. If there is an existing path this will start a new
|
||||
* disjoint subpath.
|
||||
*
|
||||
* Since: 2.0
|
||||
*/
|
||||
void
|
||||
cogl_path_rel_move_to (CoglPath *path,
|
||||
float x,
|
||||
float y);
|
||||
|
||||
#define cogl_path_line_to cogl2_path_line_to
|
||||
/**
|
||||
* cogl_path_line_to:
|
||||
* @x: X coordinate of the end line vertex
|
||||
* @y: Y coordinate of the end line vertex
|
||||
*
|
||||
* Adds a straight line segment to the current path that ends at the
|
||||
* given coordinates.
|
||||
*
|
||||
* Since: 2.0
|
||||
*/
|
||||
void
|
||||
cogl_path_line_to (CoglPath *path,
|
||||
float x,
|
||||
float y);
|
||||
|
||||
#define cogl_path_rel_line_to cogl2_path_rel_line_to
|
||||
/**
|
||||
* cogl_path_rel_line_to:
|
||||
* @x: X offset from the current pen location of the end line vertex
|
||||
* @y: Y offset from the current pen location of the end line vertex
|
||||
*
|
||||
* Adds a straight line segment to the current path that ends at the
|
||||
* given coordinates relative to the current pen location.
|
||||
*
|
||||
* Since: 2.0
|
||||
*/
|
||||
void
|
||||
cogl_path_rel_line_to (CoglPath *path,
|
||||
float x,
|
||||
float y);
|
||||
|
||||
#define cogl_path_arc cogl2_path_arc
|
||||
/**
|
||||
* cogl_path_arc:
|
||||
* @center_x: X coordinate of the elliptical arc center
|
||||
* @center_y: Y coordinate of the elliptical arc center
|
||||
* @radius_x: X radius of the elliptical arc
|
||||
* @radius_y: Y radius of the elliptical arc
|
||||
* @angle_1: Angle in degrees at which the arc begin
|
||||
* @angle_2: Angle in degrees at which the arc ends
|
||||
*
|
||||
* Adds an elliptical arc segment to the current path. A straight line
|
||||
* segment will link the current pen location with the first vertex
|
||||
* of the arc. If you perform a move_to to the arcs start just before
|
||||
* drawing it you create a free standing arc.
|
||||
*
|
||||
* The angles are measured in degrees where 0° is in the direction of
|
||||
* the positive X axis and 90° is in the direction of the positive Y
|
||||
* axis. The angle of the arc begins at @angle_1 and heads towards
|
||||
* @angle_2 (so if @angle_2 is less than @angle_1 it will decrease,
|
||||
* otherwise it will increase).
|
||||
*
|
||||
* Since: 2.0
|
||||
*/
|
||||
void
|
||||
cogl_path_arc (CoglPath *path,
|
||||
float center_x,
|
||||
float center_y,
|
||||
float radius_x,
|
||||
float radius_y,
|
||||
float angle_1,
|
||||
float angle_2);
|
||||
|
||||
#define cogl_path_curve_to cogl2_path_curve_to
|
||||
/**
|
||||
* cogl_path_curve_to:
|
||||
* @x_1: X coordinate of the second bezier control point
|
||||
* @y_1: Y coordinate of the second bezier control point
|
||||
* @x_2: X coordinate of the third bezier control point
|
||||
* @y_2: Y coordinate of the third bezier control point
|
||||
* @x_3: X coordinate of the fourth bezier control point
|
||||
* @y_3: Y coordinate of the fourth bezier control point
|
||||
*
|
||||
* Adds a cubic bezier curve segment to the current path with the given
|
||||
* second, third and fourth control points and using current pen location
|
||||
* as the first control point.
|
||||
*
|
||||
* Since: 2.0
|
||||
*/
|
||||
void
|
||||
cogl_path_curve_to (CoglPath *path,
|
||||
float x_1,
|
||||
float y_1,
|
||||
float x_2,
|
||||
float y_2,
|
||||
float x_3,
|
||||
float y_3);
|
||||
|
||||
#define cogl_path_rel_curve_to cogl2_path_rel_curve_to
|
||||
/**
|
||||
* cogl_path_rel_curve_to:
|
||||
* @x_1: X coordinate of the second bezier control point
|
||||
* @y_1: Y coordinate of the second bezier control point
|
||||
* @x_2: X coordinate of the third bezier control point
|
||||
* @y_2: Y coordinate of the third bezier control point
|
||||
* @x_3: X coordinate of the fourth bezier control point
|
||||
* @y_3: Y coordinate of the fourth bezier control point
|
||||
*
|
||||
* Adds a cubic bezier curve segment to the current path with the given
|
||||
* second, third and fourth control points and using current pen location
|
||||
* as the first control point. The given coordinates are relative to the
|
||||
* current pen location.
|
||||
*
|
||||
* Since: 2.0
|
||||
*/
|
||||
void
|
||||
cogl_path_rel_curve_to (CoglPath *path,
|
||||
float x_1,
|
||||
float y_1,
|
||||
float x_2,
|
||||
float y_2,
|
||||
float x_3,
|
||||
float y_3);
|
||||
|
||||
#define cogl_path_close cogl2_path_close
|
||||
/**
|
||||
* cogl_path_close:
|
||||
*
|
||||
* Closes the path being constructed by adding a straight line segment
|
||||
* to it that ends at the first vertex of the path.
|
||||
*
|
||||
* Since: 2.0
|
||||
*/
|
||||
void
|
||||
cogl_path_close (CoglPath *path);
|
||||
|
||||
#define cogl_path_line cogl2_path_line
|
||||
/**
|
||||
* cogl_path_line:
|
||||
* @x_1: X coordinate of the start line vertex
|
||||
* @y_1: Y coordinate of the start line vertex
|
||||
* @x_2: X coordinate of the end line vertex
|
||||
* @y_2: Y coordinate of the end line vertex
|
||||
*
|
||||
* Constructs a straight line shape starting and ending at the given
|
||||
* coordinates. If there is an existing path this will start a new
|
||||
* disjoint sub-path.
|
||||
*
|
||||
* Since: 2.0
|
||||
*/
|
||||
void
|
||||
cogl_path_line (CoglPath *path,
|
||||
float x_1,
|
||||
float y_1,
|
||||
float x_2,
|
||||
float y_2);
|
||||
|
||||
#define cogl_path_polyline cogl2_path_polyline
|
||||
/**
|
||||
* cogl_path_polyline:
|
||||
* @coords: (in) (array) (transfer none): A pointer to the first element of an
|
||||
* array of fixed-point values that specify the vertex coordinates.
|
||||
* @num_points: The total number of vertices.
|
||||
*
|
||||
* Constructs a series of straight line segments, starting from the
|
||||
* first given vertex coordinate. If there is an existing path this
|
||||
* will start a new disjoint sub-path. Each subsequent segment starts
|
||||
* where the previous one ended and ends at the next given vertex
|
||||
* coordinate.
|
||||
*
|
||||
* The coords array must contain 2 * num_points values. The first value
|
||||
* represents the X coordinate of the first vertex, the second value
|
||||
* represents the Y coordinate of the first vertex, continuing in the same
|
||||
* fashion for the rest of the vertices. (num_points - 1) segments will
|
||||
* be constructed.
|
||||
*
|
||||
* Since: 2.0
|
||||
*/
|
||||
void
|
||||
cogl_path_polyline (CoglPath *path,
|
||||
const float *coords,
|
||||
int num_points);
|
||||
|
||||
#define cogl_path_polygon cogl2_path_polygon
|
||||
/**
|
||||
* cogl_path_polygon:
|
||||
* @coords: (in) (array) (transfer none): A pointer to the first element of
|
||||
* an array of fixed-point values that specify the vertex coordinates.
|
||||
* @num_points: The total number of vertices.
|
||||
*
|
||||
* Constructs a polygonal shape of the given number of vertices. If
|
||||
* there is an existing path this will start a new disjoint sub-path.
|
||||
*
|
||||
* The coords array must contain 2 * num_points values. The first value
|
||||
* represents the X coordinate of the first vertex, the second value
|
||||
* represents the Y coordinate of the first vertex, continuing in the same
|
||||
* fashion for the rest of the vertices.
|
||||
*
|
||||
* Since: 2.0
|
||||
*/
|
||||
void
|
||||
cogl_path_polygon (CoglPath *path,
|
||||
const float *coords,
|
||||
int num_points);
|
||||
|
||||
#define cogl_path_rectangle cogl2_path_rectangle
|
||||
/**
|
||||
* cogl_path_rectangle:
|
||||
* @x_1: X coordinate of the top-left corner.
|
||||
* @y_1: Y coordinate of the top-left corner.
|
||||
* @x_2: X coordinate of the bottom-right corner.
|
||||
* @y_2: Y coordinate of the bottom-right corner.
|
||||
*
|
||||
* Constructs a rectangular shape at the given coordinates. If there
|
||||
* is an existing path this will start a new disjoint sub-path.
|
||||
*
|
||||
* Since: 2.0
|
||||
*/
|
||||
void
|
||||
cogl_path_rectangle (CoglPath *path,
|
||||
float x_1,
|
||||
float y_1,
|
||||
float x_2,
|
||||
float y_2);
|
||||
|
||||
#define cogl_path_ellipse cogl2_path_ellipse
|
||||
/**
|
||||
* cogl_path_ellipse:
|
||||
* @center_x: X coordinate of the ellipse center
|
||||
* @center_y: Y coordinate of the ellipse center
|
||||
* @radius_x: X radius of the ellipse
|
||||
* @radius_y: Y radius of the ellipse
|
||||
*
|
||||
* Constructs an ellipse shape. If there is an existing path this will
|
||||
* start a new disjoint sub-path.
|
||||
*
|
||||
* Since: 2.0
|
||||
*/
|
||||
void
|
||||
cogl_path_ellipse (CoglPath *path,
|
||||
float center_x,
|
||||
float center_y,
|
||||
float radius_x,
|
||||
float radius_y);
|
||||
|
||||
#define cogl_path_round_rectangle cogl2_path_round_rectangle
|
||||
/**
|
||||
* cogl_path_round_rectangle:
|
||||
* @x_1: X coordinate of the top-left corner.
|
||||
* @y_1: Y coordinate of the top-left corner.
|
||||
* @x_2: X coordinate of the bottom-right corner.
|
||||
* @y_2: Y coordinate of the bottom-right corner.
|
||||
* @radius: Radius of the corner arcs.
|
||||
* @arc_step: Angle increment resolution for subdivision of
|
||||
* the corner arcs.
|
||||
*
|
||||
* Constructs a rectangular shape with rounded corners. If there is an
|
||||
* existing path this will start a new disjoint sub-path.
|
||||
*
|
||||
* Since: 2.0
|
||||
*/
|
||||
void
|
||||
cogl_path_round_rectangle (CoglPath *path,
|
||||
float x_1,
|
||||
float y_1,
|
||||
float x_2,
|
||||
float y_2,
|
||||
float radius,
|
||||
float arc_step);
|
||||
|
||||
#define cogl_path_set_fill_rule cogl2_path_set_fill_rule
|
||||
/**
|
||||
* cogl_path_set_fill_rule:
|
||||
* @fill_rule: The new fill rule.
|
||||
*
|
||||
* Sets the fill rule of the current path to @fill_rule. This will
|
||||
* affect how the path is filled when cogl_path_fill() is later
|
||||
* called. Note that the fill rule state is attached to the path so
|
||||
* calling cogl_get_path() will preserve the fill rule and calling
|
||||
* cogl_path_new() will reset the fill rule back to the default.
|
||||
*
|
||||
* Since: 2.0
|
||||
*/
|
||||
void
|
||||
cogl_path_set_fill_rule (CoglPath *path, CoglPathFillRule fill_rule);
|
||||
|
||||
#define cogl_path_get_fill_rule cogl2_path_get_fill_rule
|
||||
/**
|
||||
* cogl_path_get_fill_rule:
|
||||
*
|
||||
* Retrieves the fill rule set using cogl_path_set_fill_rule().
|
||||
*
|
||||
* Return value: the fill rule that is used for the current path.
|
||||
*
|
||||
* Since: 2.0
|
||||
*/
|
||||
CoglPathFillRule
|
||||
cogl_path_get_fill_rule (CoglPath *path);
|
||||
|
||||
#define cogl_path_fill cogl2_path_fill
|
||||
/**
|
||||
* cogl_path_fill:
|
||||
*
|
||||
* Fills the interior of the constructed shape using the current
|
||||
* drawing color.
|
||||
*
|
||||
* The interior of the shape is determined using the fill rule of the
|
||||
* path. See %CoglPathFillRule for details.
|
||||
*
|
||||
* <note>The result of referencing sliced textures in your current
|
||||
* pipeline when filling a path are undefined. You should pass
|
||||
* the %COGL_TEXTURE_NO_SLICING flag when loading any texture you will
|
||||
* use while filling a path.</note>
|
||||
*
|
||||
* Since: 2.0
|
||||
*/
|
||||
void
|
||||
cogl_path_fill (CoglPath *path);
|
||||
|
||||
/**
|
||||
* cogl_framebuffer_fill_path:
|
||||
* @framebuffer: A #CoglFramebuffer
|
||||
* @pipeline: A #CoglPipeline to render with
|
||||
* @path: The #CoglPath to fill
|
||||
*
|
||||
* Fills the interior of the path using the fragment operations
|
||||
* defined by the pipeline.
|
||||
*
|
||||
* The interior of the shape is determined using the fill rule of the
|
||||
* path. See %CoglPathFillRule for details.
|
||||
*
|
||||
* <note>The result of referencing sliced textures in your current
|
||||
* pipeline when filling a path are undefined. You should pass
|
||||
* the %COGL_TEXTURE_NO_SLICING flag when loading any texture you will
|
||||
* use while filling a path.</note>
|
||||
*
|
||||
* Stability: unstable
|
||||
*/
|
||||
void
|
||||
cogl_framebuffer_fill_path (CoglFramebuffer *framebuffer,
|
||||
CoglPipeline *pipeline,
|
||||
CoglPath *path);
|
||||
|
||||
#define cogl_path_stroke cogl2_path_stroke
|
||||
/**
|
||||
* cogl_path_stroke:
|
||||
*
|
||||
* Strokes the constructed shape using the current drawing color and a
|
||||
* width of 1 pixel (regardless of the current transformation
|
||||
* matrix).
|
||||
*
|
||||
* Since: 2.0
|
||||
*/
|
||||
void
|
||||
cogl_path_stroke (CoglPath *path);
|
||||
|
||||
/**
|
||||
* cogl_framebuffer_stroke_path:
|
||||
* @framebuffer: A #CoglFramebuffer
|
||||
* @pipeline: A #CoglPipeline to render with
|
||||
* @path: The #CoglPath to stroke
|
||||
*
|
||||
* Strokes the edge of the path using the fragment operations defined
|
||||
* by the pipeline. The stroke line will have a width of 1 pixel
|
||||
* regardless of the current transformation matrix.
|
||||
*
|
||||
* Stability: unstable
|
||||
*/
|
||||
void
|
||||
cogl_framebuffer_stroke_path (CoglFramebuffer *framebuffer,
|
||||
CoglPipeline *pipeline,
|
||||
CoglPath *path);
|
||||
|
||||
/**
|
||||
* cogl_framebuffer_push_path_clip:
|
||||
* @framebuffer: A #CoglFramebuffer pointer
|
||||
* @path: The path to clip with.
|
||||
*
|
||||
* Sets a new clipping area using the silhouette of the specified,
|
||||
* filled @path. The clipping area is intersected with the previous
|
||||
* clipping area. To restore the previous clipping area, call
|
||||
* cogl_framebuffer_pop_clip().
|
||||
*
|
||||
* Since: 1.0
|
||||
* Stability: unstable
|
||||
*/
|
||||
void
|
||||
cogl_framebuffer_push_path_clip (CoglFramebuffer *framebuffer,
|
||||
CoglPath *path);
|
||||
|
||||
#define cogl_clip_push_from_path cogl2_clip_push_from_path
|
||||
/**
|
||||
* cogl_clip_push_from_path:
|
||||
* @path: The path to clip with.
|
||||
*
|
||||
* Sets a new clipping area using the silhouette of the specified,
|
||||
* filled @path. The clipping area is intersected with the previous
|
||||
* clipping area. To restore the previous clipping area, call
|
||||
* call cogl_clip_pop().
|
||||
*
|
||||
* Since: 1.8
|
||||
* Stability: Unstable
|
||||
*/
|
||||
void
|
||||
cogl_clip_push_from_path (CoglPath *path);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __COGL_PATH_FUNCTIONS_H__ */
|
||||
|
126
cogl/cogl-path/cogl-path-private.h
Normal file
126
cogl/cogl-path/cogl-path-private.h
Normal file
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* Cogl
|
||||
*
|
||||
* A Low Level GPU Graphics and Utilities API
|
||||
*
|
||||
* Copyright (C) 2010 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use, copy,
|
||||
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __COGL_PATH_PRIVATE_H
|
||||
#define __COGL_PATH_PRIVATE_H
|
||||
|
||||
#include "cogl-object.h"
|
||||
#include "cogl-attribute-private.h"
|
||||
|
||||
typedef struct _floatVec2
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
} floatVec2;
|
||||
|
||||
typedef struct _CoglPathNode
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
unsigned int path_size;
|
||||
} CoglPathNode;
|
||||
|
||||
typedef struct _CoglBezQuad
|
||||
{
|
||||
floatVec2 p1;
|
||||
floatVec2 p2;
|
||||
floatVec2 p3;
|
||||
} CoglBezQuad;
|
||||
|
||||
typedef struct _CoglBezCubic
|
||||
{
|
||||
floatVec2 p1;
|
||||
floatVec2 p2;
|
||||
floatVec2 p3;
|
||||
floatVec2 p4;
|
||||
} CoglBezCubic;
|
||||
|
||||
typedef struct _CoglPathData CoglPathData;
|
||||
|
||||
struct _CoglPath
|
||||
{
|
||||
CoglObject _parent;
|
||||
|
||||
CoglPathData *data;
|
||||
};
|
||||
|
||||
#define COGL_PATH_N_ATTRIBUTES 2
|
||||
|
||||
struct _CoglPathData
|
||||
{
|
||||
unsigned int ref_count;
|
||||
|
||||
CoglContext *context;
|
||||
|
||||
CoglPathFillRule fill_rule;
|
||||
|
||||
GArray *path_nodes;
|
||||
|
||||
floatVec2 path_start;
|
||||
floatVec2 path_pen;
|
||||
unsigned int last_path;
|
||||
floatVec2 path_nodes_min;
|
||||
floatVec2 path_nodes_max;
|
||||
|
||||
CoglAttributeBuffer *fill_attribute_buffer;
|
||||
CoglIndices *fill_vbo_indices;
|
||||
unsigned int fill_vbo_n_indices;
|
||||
CoglAttribute *fill_attributes[COGL_PATH_N_ATTRIBUTES + 1];
|
||||
CoglPrimitive *fill_primitive;
|
||||
|
||||
CoglAttributeBuffer *stroke_attribute_buffer;
|
||||
CoglAttribute **stroke_attributes;
|
||||
unsigned int stroke_n_attributes;
|
||||
|
||||
/* This is used as an optimisation for when the path contains a
|
||||
single contour specified using cogl2_path_rectangle. Cogl is more
|
||||
optimised to handle rectangles than paths so we can detect this
|
||||
case and divert to the journal or a rectangle clip. If it is TRUE
|
||||
then the entire path can be described by calling
|
||||
_cogl_path_get_bounds */
|
||||
gboolean is_rectangle;
|
||||
};
|
||||
|
||||
void
|
||||
_cogl_add_path_to_stencil_buffer (CoglPath *path,
|
||||
gboolean merge,
|
||||
gboolean need_clear);
|
||||
|
||||
void
|
||||
_cogl_path_get_bounds (CoglPath *path,
|
||||
float *min_x,
|
||||
float *min_y,
|
||||
float *max_x,
|
||||
float *max_y);
|
||||
|
||||
gboolean
|
||||
_cogl_path_is_rectangle (CoglPath *path);
|
||||
|
||||
#endif /* __COGL_PATH_PRIVATE_H */
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user