Compare commits

..

10 Commits

Author SHA1 Message Date
Bruce Leidl
7cab502754 Citadel changes to Mutter 2021-12-03 14:07:17 -05:00
Florian Müllner
8de96d3d7c Bump version to 41.1
Update NEWS.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2075>
2021-11-03 19:58:30 +01:00
Jason Gerecke
ad787c3cf7 input-mapper: Reverse sort order of display score comparator
The `guess_candidates()` function scores each display that an input
device could be mapped to and then uses the `sort_by_score()` comparator
to find the best option. The function expects the list to be sorted from
best to worst, but the comparator currently sorts them in the opposite
order. This causes the function to end up returning the _worst_ match
rather than the the best. This commit reverses the sort order of the
comparator so that the best display can be returned as intended.

Closes: #1889

(Cherry-picked from commit 64ff1f20f8)
2021-11-02 19:11:51 +01:00
Robert Mader
7f9defb444 clutter/stage: Only add paint volumes of mapped actors to stage clip
Right now we damage the stage even if an actor is not mapped, for
example in the overview.

Stop doing so, reducing over-paint significantly in some situations.
Clones will still do stage damage on their own.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2035>
(cherry picked from commit 136caca5d5)
2021-11-02 16:19:39 +01:00
Sebastian Keller
c33ca49dfc clutter/offscreen-effect: Consider paint volumes at negative coordinates
When basing the offscreen texture position off the paint volume, the
code was assuming that the paint volume was always starting at 0,0 but
this is not the case if child widgets are placed at negative coordinates
or the widget itself is transformed. This could cause such widgets that
have been flattened and therefore rendered to an offscreen texture to
appear cut off in the top/left.

Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4561
Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1923
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2031>
(cherry picked from commit 3768efef2b)
2021-11-02 16:19:39 +01:00
Carlos Garnacho
fd826632e8 core: Use b/w unicode for tablet mode OSD
This unicode was initially meant to be b/w, but fonts and pango
eventually had another plan and we ended up with color glyphs
being used here, so we get strings like "". Change the
unicode used to ensure these are simpler b/w glyhps like
"● ○ ○ ○" that are easier to read on the OSD (and maybe even a
bit less ugly).

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4733
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2064>
(cherry picked from commit 5125f66afa)
2021-11-02 16:19:39 +01:00
Quytelda Kahja
2f5c4bfc86 clutter: Fix event axes array indices in axis broadcasts
A clutter event's axes array is indexed by `ClutterInputAxis`.
However, a few lines accidentally use `ClutterInputAxisFlags` as
indices, reading incorrect values from elsewhere in memory. As a
result, broadcasted axis values for the tilt, rotation, and wheel
axes don't reflect actual event data.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1982
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2065>
(cherry picked from commit af6fb2a702)
2021-11-02 16:19:39 +01:00
Carlos Garnacho
42d6013bc5 clutter: Only reset preedit text if set
On ClutterInputFocus::reset, avoid to unset the preedit text if
none was set earlier. This seems to trick GTK clients into focusing
the cursor position again, even when we are moving away from it.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4647

(Cherry-picked from commit 3b6f9111c7)
2021-11-01 18:37:54 +01:00
Rūdolfs Mazurs
4ccdedfd99 Update Latvian translation 2021-10-26 19:14:57 +00:00
Robert Mader
3fb3764d27 wayland/data-offer: Accept final preferrence of drop destination
Quoting the spec for `wl_data_device::drop`:
> If the resulting action is "ask", the action will not be considered
> final. The drag-and-drop destination is expected to perform one last
> wl_data_offer.set_actions request, or wl_data_offer.destroy in order
> to cancel the operation.

We did not respect the action choosen by the drop destination when
it called `wl_data_offer::set_actions` after `wl_data_device::drop`
if a user override was still active. This eventually resulted in
a protocol error in `wl_data_offer::finish`, as the current action
could still be `ask`.

Fix this by only allowing a user override to `ask` before `drop` is
called, thus making sure the final `set_actions` preference is
honored.

Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/1952

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2043>

(cherry picked from commit 33b834c433)
2021-10-14 23:11:23 +02:00
537 changed files with 20920 additions and 30108 deletions

View File

@@ -1,6 +1,6 @@
include:
- remote: 'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/34f4ade99434043f88e164933f570301fd18b125/templates/fedora.yml'
- remote: 'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/34f4ade99434043f88e164933f570301fd18b125/templates/ci-fairy.yml'
- remote: 'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/bbe5232986c9b98eb1efe62484e07216f7d1a4df/templates/fedora.yml'
- remote: 'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/bbe5232986c9b98eb1efe62484e07216f7d1a4df/templates/ci-fairy.yml'
stages:
- review
@@ -14,96 +14,44 @@ stages:
variables:
FDO_UPSTREAM_REPO: GNOME/mutter
.mutter.fedora:35@common:
.mutter.fedora:34@common:
variables:
FDO_DISTRIBUTION_VERSION: 35
BASE_TAG: '2022-03-05.0'
FDO_DISTRIBUTION_VERSION: 34
BASE_TAG: '2021-09-04.1'
FDO_DISTRIBUTION_PACKAGES:
asciidoc
clang
gcovr
gdm
gnome-shell
mozjs91-devel
python3-dbusmock
sassc
uncrustify
xorg-x11-server-Xvfb
mesa-dri-drivers
xorg-x11-proto-devel
qemu-system-x86-core
busybox
FDO_DISTRIBUTION_EXEC: |
dnf install -y 'dnf-command(builddep)' &&
dnf builddep -y gsettings-desktop-schemas --setopt=install_weak_deps=False &&
dnf builddep -y mutter --setopt=install_weak_deps=False &&
dnf builddep -y gnome-shell --setopt=install_weak_deps=False &&
dnf builddep -y libinput --setopt=install_weak_deps=False &&
dnf builddep -y wayland --setopt=install_weak_deps=False &&
dnf builddep -y wayland-protocols --setopt=install_weak_deps=False &&
dnf builddep -y kernel --setopt=install_weak_deps=False &&
# For Xwayland
dnf builddep -y xorg-x11-server-Xwayland --setopt=install_weak_deps=False &&
dnf install -y 'pkgconfig(fontutil)' &&
dnf install -y 'pkgconfig(libxcvt)' &&
./.gitlab-ci/install-meson-project.sh \
-Dxwayland=true \
-Dxwayland_eglstream=true \
-D{xorg,xnest,xvfb}=false \
-Dvendor_name="Mutter CI" \
-D{xdmcp,udev,udev_kms}=false \
-Dxcsecurity=true \
-Dglamor=true \
-D{dri1,dri2}=false \
-Ddri3=true \
https://gitlab.freedesktop.org/xorg/xserver.git \
xwayland-22.1.0 \
. &&
./.gitlab-ci/install-meson-project.sh \
https://gitlab.gnome.org/GNOME/gjs.git \
1.71.1 . &&
https://gitlab.gnome.org/GNOME/glib.git \
main . 02742ef957b532789c003eef80ec7f51c370e3d5 &&
./.gitlab-ci/install-meson-project.sh \
https://gitlab.gnome.org/GNOME/gsettings-desktop-schemas.git \
42.beta . &&
41.alpha . &&
./.gitlab-ci/install-meson-project.sh \
https://gitlab.freedesktop.org/wayland/wayland.git \
1.20.0 . &&
./.gitlab-ci/install-meson-project.sh \
https://gitlab.freedesktop.org/wayland/wayland-protocols.git \
1.25 . &&
./.gitlab-ci/install-meson-project.sh \
-Dgtk_doc=false \
https://gitlab.gnome.org/GNOME/libgweather.git \
main . 1f687f6375a3f3f006600119f7eee7df7348ade5 &&
https://gitlab.gnome.org/GNOME/gjs.git \
1.69.2 . &&
rpm -e --nodeps gnome-bluetooth-libs-devel \
mutter mutter-devel \
gnome-shell &&
dnf clean all &&
if [[ x"$(uname -m )" = "xx86_64" ]] ; then
meson build -Dkvm_tests=true &&
ninja -C build src/tests/kvm/bzImage &&
mkdir -p /opt/mutter &&
cp build/src/tests/kvm/bzImage /opt/mutter/bzImage &&
git clone https://github.com/jadahl/virtme.git &&
cd virtme &&
git checkout e7ee481efa10098ed0d62c9e033d61b2379b9b95 &&
./setup.py install --prefix=/usr &&
cd .. &&
rm -rf virtme
fi
dnf clean all
default:
# Cancel jobs if newer commits are pushed to the branch
@@ -117,13 +65,13 @@ default:
- 'scheduler_failure'
- 'api_failure'
.mutter.fedora:35@x86_64:
extends: .mutter.fedora:35@common
.mutter.fedora:34@x86_64:
extends: .mutter.fedora:34@common
variables:
FDO_DISTRIBUTION_TAG: "x86_64-${BASE_TAG}"
.mutter.fedora:35@aarch64:
extends: .mutter.fedora:35@common
.mutter.fedora:34@aarch64:
extends: .mutter.fedora:34@common
variables:
FDO_DISTRIBUTION_TAG: "aarch64-${BASE_TAG}"
tags:
@@ -188,7 +136,7 @@ check-merge-request:
build-fedora-container@x86_64:
extends:
- .fdo.container-build@fedora@x86_64
- .mutter.fedora:35@x86_64
- .mutter.fedora:34@x86_64
stage: prepare
needs:
- check-commit-log
@@ -199,7 +147,7 @@ build-fedora-container@x86_64:
build-fedora-container@aarch64:
extends:
- .fdo.container-build@fedora@aarch64
- .mutter.fedora:35@aarch64
- .mutter.fedora:34@aarch64
stage: prepare
needs:
- check-commit-log
@@ -210,7 +158,7 @@ build-fedora-container@aarch64:
check-code-style:
extends:
- .fdo.distribution-image@fedora
- .mutter.fedora:35@x86_64
- .mutter.fedora:34@x86_64
stage: code-review
needs:
- build-fedora-container@x86_64
@@ -226,27 +174,12 @@ check-code-style:
fi
allow_failure: true
.build-mutter-base:
variables:
BASE_MESON_OPTIONS:
-Degl_device=true
-Dwayland_eglstream=true
.build-mutter:
extends:
- .fdo.distribution-image@fedora
- .build-mutter-base
stage: build
script:
- meson . build
--prefix /usr
--werror
--fatal-meson-warnings
--warnlevel 2
-Dbuildtype=debugoptimized
-Db_coverage=true
$BASE_MESON_OPTIONS
$EXTRA_MESON_OPTIONS
- meson . build -Dbuildtype=debugoptimized -Db_coverage=true -Degl_device=true -Dwayland_eglstream=true --werror --prefix /usr
- meson compile -C build
- meson install -C build
artifacts:
@@ -255,37 +188,28 @@ check-code-style:
- build
build-mutter@x86_64:
variables:
EXTRA_MESON_OPTIONS:
-Dkvm_tests=true
-Dkvm_kernel_image=/opt/mutter/bzImage
extends:
- .build-mutter
- .mutter.fedora:35@x86_64
- .mutter.fedora:34@x86_64
needs:
- build-fedora-container@x86_64
build-mutter@aarch64:
extends:
- .build-mutter
- .mutter.fedora:35@aarch64
- .mutter.fedora:34@aarch64
needs:
- build-fedora-container@aarch64
build-without-opengl-and-glx@x86_64:
extends:
- .fdo.distribution-image@fedora
- .mutter.fedora:35@x86_64
- .mutter.fedora:34@x86_64
stage: build
needs:
- build-fedora-container@x86_64
script:
- meson . build --werror --prefix /usr
-Dbuildtype=debugoptimized
-Dopengl=false
-Dglx=false
-Degl_device=true
-Dwayland_eglstream=true
- meson . build -Dbuildtype=debugoptimized -Dopengl=false -Dglx=false -Degl_device=true -Dwayland_eglstream=true --werror --prefix /usr
- meson compile -C build
- meson install -C build
artifacts:
@@ -295,18 +219,12 @@ build-without-opengl-and-glx@x86_64:
build-without-native-backend-and-wayland@x86_64:
extends:
- .fdo.distribution-image@fedora
- .mutter.fedora:35@x86_64
- .mutter.fedora:34@x86_64
stage: build
needs:
- build-fedora-container@x86_64
script:
- meson . build --werror --prefix /usr
-Dbuildtype=debugoptimized
-Dnative_backend=false
-Dudev=false
-Dwayland=false
-Dcore_tests=false
-Dnative_tests=false
- meson . build -Dbuildtype=debugoptimized -Dnative_backend=false -Dudev=false -Dwayland=false -Dcore_tests=false -Dnative_tests=false --werror --prefix /usr
- meson compile -C build
- meson install -C build
artifacts:
@@ -325,99 +243,73 @@ build-without-native-backend-and-wayland@x86_64:
MALLOC_CHECK_: "3"
NO_AT_BRIDGE: "1"
before_script:
- glib-compile-schemas $GSETTINGS_SCHEMA_DIR
# Disable e.g. audio support to not dead lock screen cast tests
- rm -f /usr/share/pipewire/media-session.d/with-*
- mkdir -m 700 $XDG_RUNTIME_DIR
- pipewire & sleep 2
.test-mutter-base:
extends:
- .fdo.distribution-image@fedora
<<: *test-setup
stage: test
after_script:
- pushd build
- gcovr --root=..
--filter='\.\./src/' --filter='\.\./clutter/' --filter='\.\./cogl/'
--exclude='\.\./build/.*\.[ch]$' --exclude='.*/tests/.*\.[ch]$'
--json --output=../coverage-${CI_JOB_NAME}.json
- popd
artifacts:
expire_in: 1 day
name: "mutter-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
paths:
- build
- coverage-*.json
.test-mutter:
extends:
- .fdo.distribution-image@fedora
- .test-mutter-base
<<: *test-setup
stage: test
script:
- glib-compile-schemas $GSETTINGS_SCHEMA_DIR
- dbus-run-session -- xvfb-run -a -s "$XVFB_SERVER_ARGS"
./.gitlab-ci/run-meson.sh test -C build
--no-suite 'mutter/kvm'
--no-rebuild
--timeout-multiplier 10
catchsegv meson test -C build --no-rebuild -t 10
artifacts:
expire_in: 1 day
reports:
junit: "build/meson-logs/testlog.junit.xml"
junit: "build/meson-logs/testlog-catchsegv.junit.xml"
name: "mutter-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
paths:
- build
test-mutter@x86_64:
extends:
- .test-mutter
- .mutter.fedora:35@x86_64
- .mutter.fedora:34@x86_64
needs:
- build-mutter@x86_64
test-mutter-kvm@x86_64:
extends:
- .test-mutter-base
- .mutter.fedora:35@x86_64
tags:
- kvm
script:
meson test -C build
--no-rebuild
--timeout-multiplier 10
--setup plain
--suite 'mutter/kvm'
needs:
- build-mutter@x86_64
artifacts:
reports:
junit: "build/meson-logs/testlog-plain.junit.xml"
test-mutter@aarch64:
extends:
- .test-mutter
- .mutter.fedora:35@aarch64
- .mutter.fedora:34@aarch64
needs:
- build-mutter@aarch64
coverage:
.test-mutter-coverage:
extends:
- .fdo.distribution-image@fedora
- .mutter.fedora:35@x86_64
stage: analyze
script:
- mkdir coveragereport
- gcovr --add-tracefile 'coverage-*.json'
--html-details --print-summary --output coveragereport/index.html
- ninja -C build coverage
- cat build/meson-logs/coverage.txt
artifacts:
paths:
- coveragereport
coverage: '/^lines: (\d+\.\d+\%)/'
- build/meson-logs/coveragereport
coverage: '/^TOTAL.*\s+(\d+\%)$/'
test-mutter-coverage@x86_64:
extends:
- .test-mutter-coverage
- .mutter.fedora:34@x86_64
needs:
- test-mutter@x86_64
test-mutter-coverage@aarch64:
extends:
- .test-mutter-coverage
- .mutter.fedora:34@aarch64
needs:
- test-mutter@aarch64
- test-mutter-kvm@x86_64
can-build-gnome-shell@x86_64:
extends:
- .fdo.distribution-image@fedora
- .mutter.fedora:35@x86_64
- .mutter.fedora:34@x86_64
stage: test
needs:
- build-mutter@x86_64
@@ -435,7 +327,7 @@ test-mutter-coverity:
- when: manual
extends:
- .fdo.distribution-image@fedora
- .mutter.fedora:35@x86_64
- .mutter.fedora:34@x86_64
needs:
- build-fedora-container@x86_64
stage: analyze
@@ -457,20 +349,13 @@ test-mutter-coverity:
dist-mutter:
extends:
- .fdo.distribution-image@fedora
- .mutter.fedora:35@x86_64
- .build-mutter-base
- .mutter.fedora:34@x86_64
<<: *test-setup
stage: deploy
needs:
- build-fedora-container@x86_64
- build-mutter@x86_64
script:
- meson . build --werror --prefix /usr
-Dbuildtype=debugoptimized
$BASE_MESON_OPTIONS
-Dkvm_tests=false
- glib-compile-schemas $GSETTINGS_SCHEMA_DIR
- dbus-run-session -- xvfb-run -a -s "$XVFB_SERVER_ARGS"
./.gitlab-ci/run-meson.sh dist -C build
- dbus-run-session -- xvfb-run -a -s "$XVFB_SERVER_ARGS" meson dist -C build
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
changes:

View File

@@ -1,8 +0,0 @@
#!/usr/bin/bash
set -e
wireplumber &
sleep 1
catchsegv meson "$@"

View File

@@ -283,4 +283,4 @@ click_action_clicked_cb (ClutterClickAction *click_action,
}
```
[gnome-coding-style]: https://developer.gnome.org/documentation/guidelines/programming/coding-style.html
[gnome-coding-style]: https://developer.gnome.org/programming-guidelines/stable/c-coding-style.html.en

196
NEWS
View File

@@ -1,126 +1,11 @@
42.1
41.1
====
* Send correct LEAVE events when entering windows [Jonas D.; !2321]
* Be more forgiving with wrongly sized clients [Robert; !2335]
* Add ClutterInputCapabilities enum and device property [Carlos; !2331]
* Fall back if COPY_MODE_SECONDARY_GPU fails to init [Daniel; !2341]
* Fix missing root window properties after XWayland start [Olivier; !2336]
* wayland/shm: Add support for ABGR8888 and XBGR8888 formats [Jonas Å.; !2352]
* Keep actors dirty if a redraw was queued up during paint() [Carlos; !2353]
* Fix overview painting of shaped texture with layer snippets [Jonas Å.; !2278]
* Survive missing GAMMA_LUT KMS property [Daniel; !2360]
* Record current event when going through event filters [Jonas D.; !2327]
* Pass events to pointer a11y before going through filters [Jonas D.; !2332]
* Update cursor when scaled or transformed [Sebastian W.; !2363]
* Fix screen cast when DMA buffer fails or can't be used [Jonas Å.; !2383]
* Repick when pointer actor goes unmapped [Jonas D.; !2333]
* Improve IM support [Carlos; !2365, !2384]
* Allow using dumb buffers for cursor sprites [Jonas Å.; !2275]
* wayland/dma-buf: Only advertise supported formats [Robert; !2386]
* Fix screen cast cursor metadata with unthrottled input [Jonas Å.; !2393]
* Fixed crashes [Olivier Daniel, Łukasz, Jonas D.; !2339, !2359, !2347, !2299]
* Plugged memory leak [Sebastian K.; !2345]
* Misc. bug fixes and cleanups [Christian, Jonas Å., Bartłomiej, Carlos, Daniel,
Sebastian W., Corentin, Jonas D., Sebastian K.; !2316, !2152, !2334, !2349,
!2325, !2357, !2362, !2373, !2374, !2361, !2366, !2350, !2377, !2382, !2391,
!2395, !2387, !2400, !2397, !2378]
Contributors:
Jonas Dreßler, Bilal Elmoussaoui, Olivier Fourdan, Carlos Garnacho,
Christian Hergert, Sebastian Keller, Robert Mader, Florian Müllner,
Corentin Noël, Bartłomiej Piotrowski, Łukasz Spintzyk, Daniel van Vugt,
Sebastian Wick, Jonas Ådahl
Translators:
Balázs Úr [hu], Charles Monzat [fr], Milo Casagrande [it], Марко Костић [sr],
Nathan Follens [nl], Jordi Mas [ca], Ngọc Quân Trần [vi]
42.0
====
Translators:
Fabio Tomat [fur], Alexander Shopov [bg]
42.rc
=====
* Fix X11 → wayland drops ending up in the wrong wayland client [Olivier; !2305]
* Make xdg-activation interoperate with other startup sequences [Carlos; !2314]
* Fix stuck grab feedback actor during compositor grabs [Jonas D.; !2308]
* Make gnome-desktop dependency optional [Bilal; !2317]
* Provide better profiling information [Ivan; !1928]
* Drop ClutterEvent "source" field [Carlos; !2311]
* Add support for xdg_toplevel.configure_bounds() [Jonas Å.; !2167]
* Add support for wl_surface.offset [Jonas Å.; !1905]
* Fix resizing of virtual monitors [Jonas Å.; !2270]
* Include size in configure events of maximized clients [Sebastian K.; !2238]
* Only allow direct scanouts for surfaces that aren't cropped, scaled or rotated
[Robert; !2276]
* Fix pipewire screencasts [Ivan; !2322]
* Plugged memory leak [Robert; !2297]
* Fixed crash [Jonas; !2318]
* Misc. bug fixes and cleanups [Bilal, Jonas Å., Florian, Dor, Alfonso,
Sebastian W., Carlos, Jonas D.; !2306, !2300, !2301, !2303, !2307, !2315,
!2319, !2298, !2320, !2324]
Contributors:
Dor Askayo, Jonas Dreßler, Bilal Elmoussaoui, Olivier Fourdan,
Carlos Garnacho, Sebastian Keller, Robert Mader, Ivan Molodetskikh,
Florian Müllner, Alfonso Sánchez-Beato, Sebastian Wick, Jonas Ådahl
Translators:
Emin Tufan Çetin [tr], Yosef Or Boczko [he], Quentin PAGÈS [oc],
Christian Kirbach [de], Aurimas Černius [lt], Danial Behzadi [fa],
Daniel Mustieles [es], Alan Mortensen [da], Goran Vidović [hr],
Tim Sabsch [de], Anders Jonsson [sv], Gwan-gyeong Mun [ko],
Daniel Șerbănescu [ro], Piotr Drąg [pl]
42.beta
=======
* Implement a new Clutter grab API [Carlos; !2068, !2099, !2100]
* Support KMS testing via QEMU [Jonas Å.; !2151]
* Generate API references with gi-docgen [Andy; !2248]
* Improve support for running from toolbx [Sebastian; !2254, !2261]
* Add support for privacy screen [Marco; !1952]
* Allow changing monitor configuration policy [Jonas Å.; !2030]
* Add support for XFixes ClientDisconnectMode [Olivier; !1794]
* Fix possible missed clicks on menus [Carlos; !2257]
* Place popups on the same monitor as the anchor rect [Jonas Å.; !2252]
* Announce DMA-BUF support via pipewire [columbarius; !1939]
* Raise the file descriptor limit of the wayland compositor [Olivier; !2235]
* Fix resetting idle time on lid open [Carlos; !2272]
* Don't limit DMA buffer screen casting only to Intel [Jonas Å.; !2086]
* Keep a single cursor sprite visible with tablets [Carlos; !285]
* Sync keyboard LEDs after layout changes [Konstantin; !2279]
* Honor window input area in picking [Carlos; !2283]
* Handle mixture of keycombo/no action in pad rings/strips [Carlos; !2001]
* Fixed crashes [Carlos, Jonas Å., Daniel; !2237, !2280, !2282, !2251]
* Misc. bug fixes and cleanups [Björn, Jonas Å., Daniel, Michel, Robert,
Pascal, Florian, Olivier, Pabel, Carlos, Jonas D.; !2236, !2014, !2240,
!2230, !2232, !2255, !2245, !2242, !2159, !2253, !2258, !2263, !2266,
!2271, !2256, !2264, !2262, !2281, !2287, !2284]
Contributors:
Marco Trevisan (Treviño), Björn Daase, Jonas Dreßler, Michel Dänzer,
Olivier Fourdan, Carlos Garnacho, Pablo Correa Gómez, Andy Holmes,
Konstantin Kharlamov, Robert Mader, Florian Müllner, Pascal Nowack,
Daniel van Vugt, Sebastian Wick, columbarius, Jonas Ådahl
Translators:
Yaron Shahrabani [he], Boyuan Yang [zh_CN], Marek Černocký [cs],
Aurimas Černius [lt], Kukuh Syafaat [id], Daniel Mustieles [es],
Yuri Chornoivan [uk], Hugo Carvalho [pt], Yosef Or Boczko [he],
Fran Dieguez [gl], Matheus Barbosa [pt_BR], Aleksandr Melman [ru],
sicklylife [ja], Luming Zh [zh_CN], Matej Urbančič [sl],
Leônidas Araújo [pt_BR], Asier Sarasua Garmendia [eu],
Jordi Mas i Hernandez [ca]
42.alpha
========
* Fix monitor screencast scanouts [Michel; !1914]
* dma-buf: Use alpha-less pixel formats where appropriate [Robert; !1810]
* wayland: Allow clients to maximize windows regardless of constraints
[Christian; !1997]
* Handle hotplug events without relevant changes more effectively [Marco; !1964]
* Handle hotplug events without relevant changes more effectively
[Marco; !1964]
* Improve error reporting when startup fails [Jonas; !1994]
* dma-buf: Add support for ABGR and XBGR formats [Erfan; !1999]
* Fix X11 middle button emulation setting [José; !2000]
@@ -131,82 +16,27 @@ Translators:
* Fix videos in Firefox stuttering in overview [Robert; !2034]
* Don't use atomic mode setting for virtio_gpu driver [Jonas; !2040]
* Improve on-screen keyboard on X11 [Sebastian, Ray; !1955, !2039]
* misc [Daniel, Jonas, Corentin, Robert; !1992, !2007, !2008, !2026, !2044]
* Fix text glitches after size changes [Sebastian; !2006]
* Fix reporting output rotation to xwayland [Olivier; !2050]
* wayland: Accept final preference of drop destination [Robert; !2043]
* Only add paint volumes of mapped actors to stage clip [Robert; !2035]
* Fix negative paint volume offscreen effect [Sebastian; !2031]
* Introduce MetaRenderDevice [Jonas; !1854]
* Prefer GBM over EGLStream where possible [Jonas; !2051, !2052]
* Fix erratic scrolling in GTK apps [Carlos; !2059]
* Use rtkit to get realtime priority [Carlos; !2060]
* Turn experimental features into flags [Robert; !1961]
* Add support for EGL_KHR_partial_update [Erico; !2023]
* Use b/w unicode for tablet mode OSD [Carlos; !2064]
* Fix erratic scrolling in GTK apps [Carlos; gnome-shell#4647]
* Fix tilt direction of pen/tablet inputs [Quytelda; !2065]
* Sanitize event handling at gestures [Carlos; !2024]
* Use b/w unicode for tablet mode OSD [Carlos; !2064]
* Fix negative paint volume offscreen effect [Sebastian; !2031]
* Only add paint volumes of mapped actors to stage clip [Robert; !2035]
* Fix mapping tablet input to correct monitor [Jason; !1934]
* Optionally run (and exit) with a command [Mark; !1982]
* Fix key repeat of on-screen keyboard for 2nd-level keysyms [Ray; !2045]
* Copy damage rectangles to secondary GPU [Piotr; !2033]
* Fix window size after returning from fullscreen [Sebastian, Jonas; !2066]
* Fix blank screen when unplugging docking station [Jonas; !2097]
* Ensure constraints after client resize [Sebastian; !2103]
* Improve anti-aliasing of background corners [Daniel; !2102]
* Fix unredirected Xwayland windows not getting updated [Michel; !2112]
* Fix DND between X11 and wayland clients [Carlos; !2124]
* Add hold gestures [José; !1830]
* Always snoop key events for a11y [Carlos; !1328]
* Improve Wacom tablet mapping [Carlos; !2107]
* Allow adding more streams to a screen cast session [Jonas; !2131]
* Do not throttle input in wayland event delivery [Carlos; !1915]
* Allow forcing EGLStream backend [Jonas; !2132]
* Check keyboard serials for activation [Carlos; !2148]
* Rebind the EGLimage when handling damage [Neil; !2062]
* Do not pass events to windows with modal transients [Florian; !2123]
* Fix mixed up refresh rates in multi-monitor setups [Robert; !2169]
* Fix orientation changes on devices with 90° [Hans, Marco; !2090]
* Allow disabling HW cursors [Olivier; !2150]
* Improve damage handling [Robert; !2168]
* Consider xrandr flags for advertised modes [Robert; !2190]
* Improve KMS fallback modes [Robert; !2189]
* window-group: Disable culling when rendinging clone to offscreen buffer
[Sebastian; !2080]
* Support DMA buffer feedback [Jonas, Robert; !2202, !1959]
* Advance timelines according to presentation time [Daniel; !2161]
* Drop deprecated wl-shell and text-input-v3 support [Fernando; !2183, !2185]
* Fix workspace switch animation in default plugin [Mark, Erik; !2076, !2120]
* Fix unfullscreening of window that were mapped fullscreen [Jonas; !2210]
* Consider wayland subsurfaces for scanout [Robert; !2211]
* Fix DMA-BUF screencasts with unredirected fullscreen windows [Georges; !2186]
* Fixed crashes [Carlos, Jonas, Daniel; !2063, !2025, !2081, !2104, !1991,
!2111, !2127, !2147, !2181, !2216]
* Plugged leaks [Sebastian, Jonas; !2193, !2192, !2225]
* Misc. bug fixes and cleanups [Daniel, Jonas, Corentin, Robert, Georges,
Sebastian, Simon, Carlos, Pascal, Fernando, Joan, José, Florian, Alexander,
Ievgen; !1992, !2007, !2008, !2026, !2044, !2057, !2002, !2028, !2049, !2061,
!1796, !2079, !2084, !2088, !2093, !2009, !2094, !2108, !2125, !2133, !2128,
!2138, !2058, !2130, !2140, !2122, !2095, !2126, !2139, !2145, !2149, !2157,
!1966, !2163, !2158, !2134, !1993, !2142, !2162, !2173, !2187, !2199, !2203,
!2204, !2205, !2146, !1812, !2214, !2215, !2188, !2206]
* Misc. bug fixes and cleanups
Contributors:
Marco Trevisan (Treviño), Erfan Abdi, Dor Askayo, Michel Dänzer,
José Expósito, Olivier Fourdan, Carlos Garnacho, Jason Gerecke, Hans de Goede,
JoseExposito, Quytelda Kahja, Sebastian Keller, Robert Mader, Mark,
Erik Massop, Simon McVittie, Alexander Mikhaylenko, Fernando Monteiro,
Florian Müllner, Georges Basile Stavracas Neto, Bastien Nocera, Pascal Nowack,
Corentin Noël, Erico Nunes, Ievgen Popovych, Christian Rauch, Neil Roberts,
Ray Strode, Joan Torres, Daniel van Vugt, Jonas Ådahl, Piotr Łopatka
José Expósito, Olivier Fourdan, Carlos Garnacho, Jason Gerecke,
Quytelda Kahja, Sebastian Keller, Robert Mader, Bastien Nocera, Corentin Noël,
Christian Rauch, Ray Strode, Daniel van Vugt, Jonas Ådahl
Translators:
eshagh shahidani [fa], Danial Behzadi [fa], Марко Костић [sr],
Zander Brown [en_GB], Ngọc Quân Trần [vi], Rūdolfs Mazurs [lv],
Yuri Chornoivan [uk], Fabio Tomat [fur], Hugo Carvalho [pt],
Milo Casagrande [it], Quentin PAGÈS [oc], Goran Vidović [hr],
Yaron Shahrabani [he], Daniel Mustieles [es], Aleksandr Melman [ru],
Aurimas Černius [lt], Sveinn í Felli [is], Kukuh Syafaat [id],
Asier Sarasua Garmendia [eu]
Zander Brown [en_GB], Ngọc Quân Trần [vi], Rūdolfs Mazurs [lv]
41.0
====

View File

@@ -89,6 +89,8 @@ struct _CallyActor
/**
* CallyActorClass:
* @notify_clutter: Signal handler for notify signal on Clutter actor
* @focus_clutter: Signal handler for key-focus-in and key-focus-out
* signal on Clutter actor. This virtual functions is deprecated.
* @add_actor: Signal handler for actor-added signal on
* ClutterContainer interface
* @remove_actor: Signal handler for actor-added signal on
@@ -108,6 +110,9 @@ struct _CallyActorClass
void (*notify_clutter) (GObject *object,
GParamSpec *pspec);
gboolean (*focus_clutter) (ClutterActor *actor,
gpointer data);
gint (*add_actor) (ClutterActor *container,
ClutterActor *actor,
gpointer data);

View File

@@ -60,6 +60,17 @@ static const gchar * cally_util_get_toolkit_name (void);
static const gchar * cally_util_get_toolkit_version (void);
/* private */
static void cally_util_simulate_snooper_install (void);
static void cally_util_simulate_snooper_remove (void);
static gboolean cally_key_snooper (ClutterActor *actor,
ClutterEvent *event,
gpointer user_data);
static void cally_util_stage_added_cb (ClutterStageManager *stage_manager,
ClutterStage *stage,
gpointer data);
static void cally_util_stage_removed_cb (ClutterStageManager *stage_manager,
ClutterStage *stage,
gpointer data);
static gboolean notify_hf (gpointer key,
gpointer value,
gpointer data);
@@ -142,8 +153,12 @@ cally_util_add_key_event_listener (AtkKeySnoopFunc listener,
CallyKeyEventInfo *event_info = NULL;
if (!key_listener_list)
{
key_listener_list = g_hash_table_new_full (NULL, NULL, NULL, g_free);
cally_util_simulate_snooper_install ();
}
event_info = g_new (CallyKeyEventInfo, 1);
event_info->listener = listener;
event_info->func_data = data;
@@ -164,11 +179,75 @@ cally_util_remove_key_event_listener (guint remove_listener)
{
g_hash_table_destroy (key_listener_list);
key_listener_list = NULL;
cally_util_simulate_snooper_remove ();
}
}
/* ------------------------------ PRIVATE FUNCTIONS ------------------------- */
/* Trying to emulate gtk_key_snooper install (a kind of wrapper). This
could be implemented without it, but I will maintain it in this
way, so if in the future clutter implements it natively it would be
easier the transition */
static void
cally_util_simulate_snooper_install (void)
{
ClutterStageManager *stage_manager = NULL;
ClutterStage *stage = NULL;
GSList *stage_list = NULL;
GSList *iter = NULL;
stage_manager = clutter_stage_manager_get_default ();
stage_list = clutter_stage_manager_list_stages (stage_manager);
for (iter = stage_list; iter != NULL; iter = g_slist_next (iter))
{
stage = CLUTTER_STAGE (iter->data);
g_signal_connect (G_OBJECT (stage), "captured-event",
G_CALLBACK (cally_key_snooper), NULL);
}
g_signal_connect (G_OBJECT (stage_manager), "stage-added",
G_CALLBACK (cally_util_stage_added_cb), cally_key_snooper);
g_signal_connect (G_OBJECT (stage_manager), "stage-removed",
G_CALLBACK (cally_util_stage_removed_cb), cally_key_snooper);
g_slist_free (stage_list);
}
static void
cally_util_simulate_snooper_remove (void)
{
ClutterStageManager *stage_manager = NULL;
ClutterStage *stage = NULL;
GSList *stage_list = NULL;
GSList *iter = NULL;
gint num = 0;
stage_manager = clutter_stage_manager_get_default ();
stage_list = clutter_stage_manager_list_stages (stage_manager);
for (iter = stage_list; iter != NULL; iter = g_slist_next (iter))
{
stage = CLUTTER_STAGE (iter->data);
num += g_signal_handlers_disconnect_by_func (stage, cally_key_snooper, NULL);
}
g_signal_handlers_disconnect_by_func (G_OBJECT (stage_manager),
G_CALLBACK (cally_util_stage_added_cb),
cally_key_snooper);
g_signal_handlers_disconnect_by_func (G_OBJECT (stage_manager),
G_CALLBACK (cally_util_stage_removed_cb),
cally_key_snooper);
#ifdef CALLY_DEBUG
g_print ("Number of snooper callbacks disconnected: %i\n", num);
#endif
}
static AtkKeyEventStruct *
atk_key_event_from_clutter_event_key (ClutterKeyEvent *clutter_event,
gunichar password_char)
@@ -282,11 +361,8 @@ insert_hf (gpointer key, gpointer value, gpointer data)
static gunichar
check_key_visibility (ClutterEvent *event)
{
AtkObject *accessible;
ClutterActor *focus;
focus = clutter_stage_get_key_focus (clutter_event_get_stage (event));
accessible = clutter_actor_get_accessible (focus);
ClutterKeyEvent *key_event = (ClutterKeyEvent *)event;
AtkObject *accessible = clutter_actor_get_accessible (key_event->source);
g_return_val_if_fail (accessible != NULL, 0);
@@ -302,40 +378,65 @@ check_key_visibility (ClutterEvent *event)
still better fill this with a default unichar that the original
one */
if (CLUTTER_IS_TEXT (focus))
return clutter_text_get_password_char (CLUTTER_TEXT (focus));
if (CLUTTER_IS_TEXT (key_event->source))
return clutter_text_get_password_char (CLUTTER_TEXT (key_event->source));
else
return DEFAULT_PASSWORD_CHAR;
}
gboolean
cally_snoop_key_event (ClutterKeyEvent *key)
static gboolean
cally_key_snooper (ClutterActor *actor,
ClutterEvent *event,
gpointer user_data)
{
ClutterEvent *event = (ClutterEvent *) key;
AtkKeyEventStruct *key_event = NULL;
gboolean consumed = FALSE;
gint consumed = 0;
gunichar password_char = 0;
/* filter key events */
if ((event->type != CLUTTER_KEY_PRESS) && (event->type != CLUTTER_KEY_RELEASE))
return FALSE;
{
return FALSE;
}
password_char = check_key_visibility (event);
if (key_listener_list)
{
GHashTable *new_hash = g_hash_table_new (NULL, NULL);
g_hash_table_foreach (key_listener_list, insert_hf, new_hash);
password_char = check_key_visibility (event);
key_event = atk_key_event_from_clutter_event_key (key, password_char);
key_event = atk_key_event_from_clutter_event_key ((ClutterKeyEvent *)event,
password_char);
/* func data is inside the hash table */
consumed = g_hash_table_foreach_steal (new_hash, notify_hf, key_event) > 0;
consumed = g_hash_table_foreach_steal (new_hash, notify_hf, key_event);
g_hash_table_destroy (new_hash);
g_free (key_event->string);
g_free (key_event);
}
return consumed;
return (consumed ? 1 : 0);
}
static void
cally_util_stage_added_cb (ClutterStageManager *stage_manager,
ClutterStage *stage,
gpointer data)
{
GCallback cally_key_snooper_cb = G_CALLBACK (data);
g_signal_connect (G_OBJECT (stage), "captured-event", cally_key_snooper_cb, NULL);
}
static void
cally_util_stage_removed_cb (ClutterStageManager *stage_manager,
ClutterStage *stage,
gpointer data)
{
GCallback cally_key_snooper_cb = G_CALLBACK (data);
g_signal_handlers_disconnect_by_func (stage, cally_key_snooper_cb, NULL);
}
void

View File

@@ -79,8 +79,6 @@ GType cally_util_get_type (void) G_GNUC_CONST;
void _cally_util_override_atk_util (void);
gboolean cally_snoop_key_event (ClutterKeyEvent *key);
G_END_DECLS
#endif /* __CALLY_UTIL_H__ */

View File

@@ -1,44 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2021 Red Hat Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author:
* Carlos Garnacho <carlosg@gnome.org>
*/
#ifndef CLUTTER_ACTION_PRIVATE_H
#define CLUTTER_ACTION_PRIVATE_H
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#include <clutter/clutter-action.h>
G_BEGIN_DECLS
void clutter_action_set_phase (ClutterAction *action,
ClutterEventPhase phase);
gboolean clutter_action_handle_event (ClutterAction *action,
const ClutterEvent *event);
G_END_DECLS
#endif /* CLUTTER_ACTION_PRIVATE_H */

View File

@@ -44,63 +44,18 @@
#include "clutter-build-config.h"
#include "clutter-action.h"
#include "clutter-action-private.h"
#include "clutter-debug.h"
#include "clutter-private.h"
typedef struct _ClutterActionPrivate ClutterActionPrivate;
struct _ClutterActionPrivate
{
ClutterEventPhase phase;
};
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterAction, clutter_action,
CLUTTER_TYPE_ACTOR_META)
static gboolean
clutter_action_handle_event_default (ClutterAction *action,
const ClutterEvent *event)
{
return FALSE;
}
G_DEFINE_ABSTRACT_TYPE (ClutterAction, clutter_action, CLUTTER_TYPE_ACTOR_META);
static void
clutter_action_class_init (ClutterActionClass *klass)
{
klass->handle_event = clutter_action_handle_event_default;
}
static void
clutter_action_init (ClutterAction *self)
{
}
void
clutter_action_set_phase (ClutterAction *action,
ClutterEventPhase phase)
{
ClutterActionPrivate *priv;
priv = clutter_action_get_instance_private (action);
priv->phase = phase;
}
ClutterEventPhase
clutter_action_get_phase (ClutterAction *action)
{
ClutterActionPrivate *priv;
g_return_val_if_fail (CLUTTER_IS_ACTION (action), CLUTTER_PHASE_CAPTURE);
priv = clutter_action_get_instance_private (action);
return priv->phase;
}
gboolean
clutter_action_handle_event (ClutterAction *action,
const ClutterEvent *event)
{
return CLUTTER_ACTION_GET_CLASS (action)->handle_event (action, event);
}

View File

@@ -51,9 +51,6 @@ struct _ClutterActionClass
/*< private >*/
ClutterActorMetaClass parent_class;
gboolean (* handle_event) (ClutterAction *action,
const ClutterEvent *event);
void (* _clutter_action1) (void);
void (* _clutter_action2) (void);
void (* _clutter_action3) (void);
@@ -73,11 +70,6 @@ void clutter_actor_add_action_with_name (ClutterActor *self,
const gchar *name,
ClutterAction *action);
CLUTTER_EXPORT
void clutter_actor_add_action_full (ClutterActor *self,
const char *name,
ClutterEventPhase phase,
ClutterAction *action);
CLUTTER_EXPORT
void clutter_actor_remove_action (ClutterActor *self,
ClutterAction *action);
CLUTTER_EXPORT
@@ -94,8 +86,6 @@ void clutter_actor_clear_actions (ClutterActor *self);
CLUTTER_EXPORT
gboolean clutter_actor_has_actions (ClutterActor *self);
ClutterEventPhase clutter_action_get_phase (ClutterAction *action);
G_END_DECLS
#endif /* __CLUTTER_ACTION_H__ */

View File

@@ -109,8 +109,6 @@ clutter_actor_meta_real_set_actor (ClutterActorMeta *meta,
priv->destroy_id = g_signal_connect (priv->actor, "destroy",
G_CALLBACK (on_actor_destroy),
meta);
g_object_notify_by_pspec (G_OBJECT (meta), obj_props[PROP_ACTOR]);
}
static void
@@ -215,8 +213,7 @@ clutter_actor_meta_class_init (ClutterActorMetaClass *klass)
P_("Actor"),
P_("The actor attached to the meta"),
CLUTTER_TYPE_ACTOR,
CLUTTER_PARAM_READABLE |
G_PARAM_EXPLICIT_NOTIFY);
CLUTTER_PARAM_READABLE);
/**
* ClutterActorMeta:name:

View File

@@ -23,7 +23,6 @@
#define __CLUTTER_ACTOR_PRIVATE_H__
#include <clutter/clutter-actor.h>
#include <clutter/clutter-grab.h>
G_BEGIN_DECLS
@@ -247,7 +246,6 @@ void _clutter_actor_pop_clone_paint
ClutterActorAlign _clutter_actor_get_effective_x_align (ClutterActor *self);
void _clutter_actor_handle_event (ClutterActor *actor,
ClutterActor *root,
const ClutterEvent *event);
void _clutter_actor_attach_clone (ClutterActor *actor,
@@ -273,11 +271,6 @@ gboolean clutter_actor_get_redraw_clip (ClutterActor *self,
ClutterPaintVolume *dst_old_pv,
ClutterPaintVolume *dst_new_pv);
void clutter_actor_attach_grab (ClutterActor *actor,
ClutterGrab *grab);
void clutter_actor_detach_grab (ClutterActor *actor,
ClutterGrab *grab);
G_END_DECLS
#endif /* __CLUTTER_ACTOR_PRIVATE_H__ */

File diff suppressed because it is too large Load Diff

View File

@@ -66,12 +66,17 @@ struct _ClutterBackendClass
GObjectClass parent_class;
/* vfuncs */
gboolean (* finish_init) (ClutterBackend *backend,
gboolean (* pre_parse) (ClutterBackend *backend,
GError **error);
gboolean (* post_parse) (ClutterBackend *backend,
GError **error);
ClutterStageWindow * (* create_stage) (ClutterBackend *backend,
ClutterStage *wrapper,
GError **error);
void (* init_features) (ClutterBackend *backend);
void (* add_options) (ClutterBackend *backend,
GOptionGroup *group);
ClutterFeatureFlags (* get_features) (ClutterBackend *backend);
CoglRenderer * (* get_renderer) (ClutterBackend *backend,
GError **error);
CoglDisplay * (* get_display) (ClutterBackend *backend,
@@ -95,13 +100,19 @@ struct _ClutterBackendClass
void (* settings_changed) (ClutterBackend *backend);
};
ClutterBackend * _clutter_create_backend (void);
ClutterStageWindow * _clutter_backend_create_stage (ClutterBackend *backend,
ClutterStage *wrapper,
GError **error);
gboolean _clutter_backend_create_context (ClutterBackend *backend,
GError **error);
gboolean _clutter_backend_finish_init (ClutterBackend *backend,
void _clutter_backend_add_options (ClutterBackend *backend,
GOptionGroup *group);
gboolean _clutter_backend_pre_parse (ClutterBackend *backend,
GError **error);
gboolean _clutter_backend_post_parse (ClutterBackend *backend,
GError **error);
CLUTTER_EXPORT
@@ -109,6 +120,8 @@ gboolean _clutter_backend_translate_event (Clutter
gpointer native,
ClutterEvent *event);
ClutterFeatureFlags _clutter_backend_get_features (ClutterBackend *backend);
gfloat _clutter_backend_get_units_per_em (ClutterBackend *backend,
PangoFontDescription *font_desc);
gint32 _clutter_backend_get_units_serial (ClutterBackend *backend);

View File

@@ -353,7 +353,8 @@ clutter_backend_real_create_context (ClutterBackend *backend,
if (internal_error != NULL)
g_propagate_error (error, internal_error);
else
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
g_set_error_literal (error, CLUTTER_INIT_ERROR,
CLUTTER_INIT_ERROR_BACKEND,
"Unable to initialize the Clutter backend: no available drivers found.");
return FALSE;
@@ -365,6 +366,53 @@ clutter_backend_real_create_context (ClutterBackend *backend,
return TRUE;
}
static ClutterFeatureFlags
clutter_backend_real_get_features (ClutterBackend *backend)
{
ClutterFeatureFlags flags = 0;
if (cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_MULTIPLE_ONSCREEN))
{
CLUTTER_NOTE (BACKEND, "Cogl supports multiple onscreen framebuffers");
flags |= CLUTTER_FEATURE_STAGE_MULTIPLE;
}
else
{
CLUTTER_NOTE (BACKEND, "Cogl only supports one onscreen framebuffer");
flags |= CLUTTER_FEATURE_STAGE_STATIC;
}
if (cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_BUFFERS_EVENT))
{
CLUTTER_NOTE (BACKEND, "Cogl supports swap buffers complete events");
flags |= CLUTTER_FEATURE_SWAP_EVENTS;
}
return flags;
}
static ClutterBackend * (* custom_backend_func) (void);
void
clutter_set_custom_backend_func (ClutterBackend *(* func) (void))
{
custom_backend_func = func;
}
ClutterBackend *
_clutter_create_backend (void)
{
ClutterBackend *retval;
g_return_val_if_fail (custom_backend_func, NULL);
retval = custom_backend_func ();
if (!retval)
g_error ("Failed to create custom backend.");
return retval;
}
static void
clutter_backend_class_init (ClutterBackendClass *klass)
{
@@ -427,6 +475,7 @@ clutter_backend_class_init (ClutterBackendClass *klass)
klass->font_changed = clutter_backend_real_font_changed;
klass->create_context = clutter_backend_real_create_context;
klass->get_features = clutter_backend_real_get_features;
}
static void
@@ -440,17 +489,45 @@ clutter_backend_init (ClutterBackend *self)
self->fallback_resource_scale = 1.f;
}
gboolean
_clutter_backend_finish_init (ClutterBackend *backend,
GError **error)
void
_clutter_backend_add_options (ClutterBackend *backend,
GOptionGroup *group)
{
ClutterBackendClass *klass;
g_assert (CLUTTER_IS_BACKEND (backend));
klass = CLUTTER_BACKEND_GET_CLASS (backend);
if (klass->finish_init)
return klass->finish_init (backend, error);
if (klass->add_options)
klass->add_options (backend, group);
}
gboolean
_clutter_backend_pre_parse (ClutterBackend *backend,
GError **error)
{
ClutterBackendClass *klass;
g_assert (CLUTTER_IS_BACKEND (backend));
klass = CLUTTER_BACKEND_GET_CLASS (backend);
if (klass->pre_parse)
return klass->pre_parse (backend, error);
return TRUE;
}
gboolean
_clutter_backend_post_parse (ClutterBackend *backend,
GError **error)
{
ClutterBackendClass *klass;
g_assert (CLUTTER_IS_BACKEND (backend));
klass = CLUTTER_BACKEND_GET_CLASS (backend);
if (klass->post_parse)
return klass->post_parse (backend, error);
return TRUE;
}
@@ -495,6 +572,46 @@ _clutter_backend_create_context (ClutterBackend *backend,
return klass->create_context (backend, error);
}
ClutterFeatureFlags
_clutter_backend_get_features (ClutterBackend *backend)
{
ClutterBackendClass *klass;
GError *error;
g_assert (CLUTTER_IS_BACKEND (backend));
klass = CLUTTER_BACKEND_GET_CLASS (backend);
/* we need to have a context here; so we create the
* GL context first and the ask for features. if the
* context already exists this should be a no-op
*/
error = NULL;
if (klass->create_context != NULL)
{
gboolean res;
res = klass->create_context (backend, &error);
if (!res)
{
if (error)
{
g_critical ("Unable to create a context: %s", error->message);
g_error_free (error);
}
else
g_critical ("Unable to create a context: unknown error");
return 0;
}
}
if (klass->get_features)
return klass->get_features (backend);
return 0;
}
gfloat
_clutter_backend_get_units_per_em (ClutterBackend *backend,
PangoFontDescription *font_desc)

View File

@@ -39,6 +39,8 @@
#define FLOAT_EPSILON (1e-15)
/*
* ClutterMargin
*/

View File

@@ -34,6 +34,7 @@
*
* - all children are arranged on a single line
* - the axis used is controlled by the #ClutterBoxLayout:orientation property
* - the order of the packing is determined by the #ClutterBoxLayout:pack-start boolean property
* - each child will be allocated to its natural size or, if #ClutterActor:x-expand or
* #ClutterActor:y-expand are set, the available size
* - honours the #ClutterActor's #ClutterActor:x-align and #ClutterActor:y-align properties
@@ -52,7 +53,6 @@
#include <math.h>
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "deprecated/clutter-box-layout.h"
#include "deprecated/clutter-container.h"
#include "clutter-box-layout.h"
@@ -75,6 +75,7 @@ struct _ClutterBoxLayoutPrivate
ClutterOrientation orientation;
guint is_pack_start : 1;
guint is_homogeneous : 1;
};
@@ -596,17 +597,17 @@ distribute_natural_allocation (float extra_space,
/* Distribute available space.
* This master piece of a loop was conceived by Behdad Esfahbod.
*/
for (i = n_requested_sizes - 1; extra_space > 0.0 && i >= 0; --i)
for (i = n_requested_sizes - 1; extra_space > 0 && i >= 0; --i)
{
/* Divide remaining space by number of remaining children.
* Sort order and reducing remaining space by assigned space
* ensures that space is distributed equally.
*/
float glue = (extra_space + i) / (i + 1.0);
float gap =
sizes[(spreading[i])].natural_size - sizes[(spreading[i])].minimum_size;
int glue = (extra_space + i) / (i + 1);
int gap = sizes[(spreading[i])].natural_size
- sizes[(spreading[i])].minimum_size;
float extra = MIN (glue, gap);
int extra = MIN (glue, gap);
sizes[spreading[i]].minimum_size += extra;
@@ -763,13 +764,19 @@ clutter_box_layout_allocate (ClutterLayoutManager *layout,
{
child_allocation.x1 = box->x1;
child_allocation.x2 = MAX (1.0, box->x2);
y = box->y1;
if (priv->is_pack_start)
y = box->y2 - box->y1;
else
y = box->y1;
}
else
{
child_allocation.y1 = box->y1;
child_allocation.y2 = MAX (1.0, box->y2);
x = box->x1;
if (priv->is_pack_start)
x = box->x2 - box->x1;
else
x = box->x1;
}
i = 0;
@@ -821,7 +828,17 @@ clutter_box_layout_allocate (ClutterLayoutManager *layout,
child_allocation.y2 = child_allocation.y1 + sizes[i].minimum_size;
}
y += child_size + priv->spacing;
if (priv->is_pack_start)
{
y -= child_size + priv->spacing;
child_allocation.y1 -= child_size;
child_allocation.y2 -= child_size;
}
else
{
y += child_size + priv->spacing;
}
}
else /* CLUTTER_ORIENTATION_HORIZONTAL */
{
@@ -836,7 +853,17 @@ clutter_box_layout_allocate (ClutterLayoutManager *layout,
child_allocation.x2 = child_allocation.x1 + sizes[i].minimum_size;
}
x += child_size + priv->spacing;
if (priv->is_pack_start)
{
x -= child_size + priv->spacing;
child_allocation.x1 -= child_size;
child_allocation.x2 -= child_size;
}
else
{
x += child_size + priv->spacing;
}
if (is_rtl)
{
@@ -912,7 +939,7 @@ clutter_box_layout_get_property (GObject *gobject,
break;
case PROP_PACK_START:
g_value_set_boolean (value, FALSE);
g_value_set_boolean (value, priv->is_pack_start);
break;
default:
@@ -970,14 +997,17 @@ clutter_box_layout_class_init (ClutterBoxLayoutClass *klass)
/**
* ClutterBoxLayout:pack-start:
*
* Deprecated: No longer has any effect
* Whether the #ClutterBoxLayout should pack items at the start
* or append them at the end
*
* Since: 1.2
*/
obj_props[PROP_PACK_START] =
g_param_spec_boolean ("pack-start",
P_("Pack Start"),
P_("Whether to pack items at the start of the box"),
FALSE,
CLUTTER_PARAM_READWRITE | G_PARAM_DEPRECATED);
CLUTTER_PARAM_READWRITE);
/**
* ClutterBoxLayout:spacing:
@@ -1005,6 +1035,7 @@ clutter_box_layout_init (ClutterBoxLayout *self)
self->priv->orientation = CLUTTER_ORIENTATION_HORIZONTAL;
self->priv->is_homogeneous = FALSE;
self->priv->is_pack_start = FALSE;
self->priv->spacing = 0;
self->priv->easing_mode = CLUTTER_EASE_OUT_CUBIC;
@@ -1187,25 +1218,50 @@ clutter_box_layout_get_homogeneous (ClutterBoxLayout *layout)
* @pack_start: %TRUE if the @layout should pack children at the
* beginning of the layout
*
* Deprecated: No longer has any effect
* Sets whether children of @layout should be laid out by appending
* them or by prepending them
*
* Since: 1.2
*/
void
clutter_box_layout_set_pack_start (ClutterBoxLayout *layout,
gboolean pack_start)
{
ClutterBoxLayoutPrivate *priv;
g_return_if_fail (CLUTTER_IS_BOX_LAYOUT (layout));
priv = layout->priv;
if (priv->is_pack_start != pack_start)
{
ClutterLayoutManager *manager;
priv->is_pack_start = pack_start ? TRUE : FALSE;
manager = CLUTTER_LAYOUT_MANAGER (layout);
clutter_layout_manager_layout_changed (manager);
g_object_notify (G_OBJECT (layout), "pack-start");
}
}
/**
* clutter_box_layout_get_pack_start:
* @layout: a #ClutterBoxLayout
*
* Return value: The value of the :pack-start property,
* always %FALSE
* Retrieves the value set using clutter_box_layout_set_pack_start()
*
* Deprecated: No longer has any effect
* Return value: %TRUE if the #ClutterBoxLayout should pack children
* at the beginning of the layout, and %FALSE otherwise
*
* Since: 1.2
*/
gboolean
clutter_box_layout_get_pack_start (ClutterBoxLayout *layout)
{
return FALSE;
g_return_val_if_fail (CLUTTER_IS_BOX_LAYOUT (layout), FALSE);
return layout->priv->is_pack_start;
}

View File

@@ -99,6 +99,11 @@ void clutter_box_layout_set_homogeneous (ClutterBoxLayou
gboolean homogeneous);
CLUTTER_EXPORT
gboolean clutter_box_layout_get_homogeneous (ClutterBoxLayout *layout);
CLUTTER_EXPORT
void clutter_box_layout_set_pack_start (ClutterBoxLayout *layout,
gboolean pack_start);
CLUTTER_EXPORT
gboolean clutter_box_layout_get_pack_start (ClutterBoxLayout *layout);
G_END_DECLS

View File

@@ -105,6 +105,8 @@ struct _ClutterClickActionPrivate
{
ClutterActor *stage;
gulong event_id;
gulong capture_id;
guint long_press_id;
gint long_press_threshold;
@@ -148,6 +150,11 @@ static guint click_signals[LAST_SIGNAL] = { 0, };
G_DEFINE_TYPE_WITH_PRIVATE (ClutterClickAction, clutter_click_action, CLUTTER_TYPE_ACTION)
/* forward declaration */
static gboolean on_captured_event (ClutterActor *stage,
ClutterEvent *event,
ClutterClickAction *action);
static inline void
click_action_set_pressed (ClutterClickAction *action,
gboolean is_pressed)
@@ -198,6 +205,8 @@ click_action_emit_long_press (gpointer data)
CLUTTER_LONG_PRESS_ACTIVATE,
&result);
g_clear_signal_handler (&priv->capture_id, priv->stage);
click_action_set_pressed (action, FALSE);
click_action_set_held (action, FALSE);
@@ -265,7 +274,7 @@ click_action_cancel_long_press (ClutterClickAction *action)
static inline gboolean
event_within_drag_threshold (ClutterClickAction *click_action,
const ClutterEvent *event)
ClutterEvent *event)
{
ClutterClickActionPrivate *priv =
clutter_click_action_get_instance_private (click_action);
@@ -281,44 +290,29 @@ event_within_drag_threshold (ClutterClickAction *click_action,
}
static gboolean
clutter_click_action_handle_event (ClutterAction *action,
const ClutterEvent *event)
on_event (ClutterActor *actor,
ClutterEvent *event,
ClutterClickAction *action)
{
ClutterClickAction *click_action = CLUTTER_CLICK_ACTION (action);
ClutterClickActionPrivate *priv =
clutter_click_action_get_instance_private (click_action);
ClutterActor *actor =
clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
clutter_click_action_get_instance_private (action);
gboolean has_button = TRUE;
ClutterModifierType modifier_state;
ClutterActor *target;
if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (action)))
return CLUTTER_EVENT_PROPAGATE;
if (priv->press_sequence != NULL &&
clutter_event_get_event_sequence (event) != priv->press_sequence)
{
click_action_set_held (click_action, FALSE);
click_action_cancel_long_press (click_action);
return CLUTTER_EVENT_PROPAGATE;
}
switch (clutter_event_type (event))
{
case CLUTTER_TOUCH_BEGIN:
has_button = FALSE;
G_GNUC_FALLTHROUGH;
case CLUTTER_BUTTON_PRESS:
if (has_button && clutter_event_get_click_count (event) != 1)
return CLUTTER_EVENT_PROPAGATE;
if (priv->is_held)
return CLUTTER_EVENT_STOP;
target = clutter_stage_get_device_actor (clutter_event_get_stage (event),
clutter_event_get_device (event),
clutter_event_get_event_sequence (event));
if (!clutter_actor_contains (actor, target))
if (!clutter_actor_contains (actor, clutter_event_get_source (event)))
return CLUTTER_EVENT_PROPAGATE;
priv->press_button = has_button ? clutter_event_get_button (event) : 0;
@@ -341,47 +335,71 @@ clutter_click_action_handle_event (ClutterAction *action,
if (priv->stage == NULL)
priv->stage = clutter_actor_get_stage (actor);
click_action_set_pressed (click_action, TRUE);
click_action_set_held (click_action, TRUE);
click_action_query_long_press (click_action);
priv->capture_id = g_signal_connect_after (priv->stage, "captured-event",
G_CALLBACK (on_captured_event),
action);
click_action_set_pressed (action, TRUE);
click_action_set_held (action, TRUE);
click_action_query_long_press (action);
break;
case CLUTTER_ENTER:
click_action_set_pressed (click_action, priv->is_held);
click_action_set_pressed (action, priv->is_held);
break;
case CLUTTER_LEAVE:
click_action_set_pressed (click_action, FALSE);
click_action_cancel_long_press (click_action);
click_action_set_pressed (action, priv->is_held);
click_action_cancel_long_press (action);
break;
default:
break;
}
return CLUTTER_EVENT_PROPAGATE;
}
static gboolean
on_captured_event (ClutterActor *stage,
ClutterEvent *event,
ClutterClickAction *action)
{
ClutterClickActionPrivate *priv =
clutter_click_action_get_instance_private (action);
ClutterActor *actor;
ClutterModifierType modifier_state;
gboolean has_button = TRUE;
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
switch (clutter_event_type (event))
{
case CLUTTER_TOUCH_CANCEL:
clutter_click_action_release (click_action);
clutter_click_action_release (action);
break;
case CLUTTER_TOUCH_END:
has_button = FALSE;
G_GNUC_FALLTHROUGH;
case CLUTTER_BUTTON_RELEASE:
if (!priv->is_held)
return CLUTTER_EVENT_STOP;
if ((has_button && clutter_event_get_button (event) != priv->press_button) ||
(has_button && clutter_event_get_click_count (event) != 1) ||
clutter_event_get_device (event) != priv->press_device ||
clutter_event_get_event_sequence (event) != priv->press_sequence)
return CLUTTER_EVENT_PROPAGATE;
click_action_set_held (click_action, FALSE);
click_action_cancel_long_press (click_action);
click_action_set_held (action, FALSE);
click_action_cancel_long_press (action);
/* disconnect the capture */
g_clear_signal_handler (&priv->capture_id, priv->stage);
g_clear_handle_id (&priv->long_press_id, g_source_remove);
target = clutter_stage_get_device_actor (clutter_event_get_stage (event),
clutter_event_get_device (event),
clutter_event_get_event_sequence (event));
if (!clutter_actor_contains (actor, target))
if (!clutter_actor_contains (actor, clutter_event_get_source (event)))
return CLUTTER_EVENT_PROPAGATE;
/* exclude any button-mask so that we can compare
@@ -400,10 +418,10 @@ clutter_click_action_handle_event (ClutterAction *action,
if (modifier_state != priv->modifier_state)
priv->modifier_state = 0;
click_action_set_pressed (click_action, FALSE);
click_action_set_pressed (action, FALSE);
if (event_within_drag_threshold (click_action, event))
g_signal_emit (click_action, click_signals[CLICKED], 0, actor);
if (event_within_drag_threshold (action, event))
g_signal_emit (action, click_signals[CLICKED], 0, actor);
break;
case CLUTTER_MOTION:
@@ -416,8 +434,8 @@ clutter_click_action_handle_event (ClutterAction *action,
if (!priv->is_held)
return CLUTTER_EVENT_PROPAGATE;
if (!event_within_drag_threshold (click_action, event))
clutter_click_action_release (click_action);
if (!event_within_drag_threshold (action, event))
clutter_click_action_release (action);
}
break;
@@ -425,7 +443,7 @@ clutter_click_action_handle_event (ClutterAction *action,
break;
}
return priv->is_held ? CLUTTER_EVENT_STOP : CLUTTER_EVENT_PROPAGATE;
return CLUTTER_EVENT_STOP;
}
static void
@@ -436,11 +454,35 @@ clutter_click_action_set_actor (ClutterActorMeta *meta,
ClutterClickActionPrivate *priv =
clutter_click_action_get_instance_private (action);
if (priv->event_id != 0)
{
ClutterActor *old_actor = clutter_actor_meta_get_actor (meta);
if (old_actor != NULL)
g_clear_signal_handler (&priv->event_id, old_actor);
priv->event_id = 0;
}
if (priv->capture_id != 0)
{
if (priv->stage != NULL)
g_clear_signal_handler (&priv->capture_id, priv->stage);
priv->capture_id = 0;
priv->stage = NULL;
}
g_clear_handle_id (&priv->long_press_id, g_source_remove);
click_action_set_pressed (action, FALSE);
click_action_set_held (action, FALSE);
if (actor != NULL)
priv->event_id = g_signal_connect (actor, "event",
G_CALLBACK (on_event),
action);
CLUTTER_ACTOR_META_CLASS (clutter_click_action_parent_class)->set_actor (meta, actor);
}
@@ -522,19 +564,22 @@ clutter_click_action_dispose (GObject *gobject)
ClutterClickActionPrivate *priv =
clutter_click_action_get_instance_private (CLUTTER_CLICK_ACTION (gobject));
g_clear_signal_handler (&priv->event_id,
clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (gobject)));
g_clear_signal_handler (&priv->capture_id, priv->stage);
g_clear_handle_id (&priv->long_press_id, g_source_remove);
G_OBJECT_CLASS (clutter_click_action_parent_class)->dispose (gobject);
}
static void
clutter_click_action_class_init (ClutterClickActionClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
ClutterActionClass *action_class = CLUTTER_ACTION_CLASS (klass);
action_class->handle_event = clutter_click_action_handle_event;
meta_class->set_actor = clutter_click_action_set_actor;
meta_class->set_enabled = clutter_click_action_set_enabled;
@@ -724,6 +769,9 @@ clutter_click_action_release (ClutterClickAction *action)
if (!priv->is_held)
return;
/* disconnect the capture */
g_clear_signal_handler (&priv->capture_id, priv->stage);
click_action_cancel_long_press (action);
click_action_set_held (action, FALSE);
click_action_set_pressed (action, FALSE);

View File

@@ -119,6 +119,31 @@ container_real_remove (ClutterContainer *container,
clutter_actor_remove_child (CLUTTER_ACTOR (container), actor);
}
static void
container_real_raise (ClutterContainer *container,
ClutterActor *child,
ClutterActor *sibling)
{
ClutterActor *self = CLUTTER_ACTOR (container);
clutter_actor_set_child_above_sibling (self, child, sibling);
}
static void
container_real_lower (ClutterContainer *container,
ClutterActor *child,
ClutterActor *sibling)
{
ClutterActor *self = CLUTTER_ACTOR (container);
clutter_actor_set_child_below_sibling (self, child, sibling);
}
static void
container_real_sort_depth_order (ClutterContainer *container)
{
}
static void
clutter_container_default_init (ClutterContainerInterface *iface)
{
@@ -188,6 +213,9 @@ clutter_container_default_init (ClutterContainerInterface *iface)
iface->add = container_real_add;
iface->remove = container_real_remove;
iface->raise = container_real_raise;
iface->lower = container_real_lower;
iface->sort_depth_order = container_real_sort_depth_order;
iface->child_meta_type = G_TYPE_INVALID;
iface->create_child_meta = create_child_meta;
@@ -420,6 +448,202 @@ clutter_container_remove_actor (ClutterContainer *container,
container_remove_actor (container, actor);
}
/**
* clutter_container_get_children:
* @container: a #ClutterContainer
*
* Retrieves all the children of @container.
*
* Return value: (element-type Clutter.Actor) (transfer container): a list
* of #ClutterActor<!-- -->s. Use g_list_free() on the returned
* list when done.
*
* Since: 0.4
*
* Deprecated: 1.10: Use clutter_actor_get_children() instead.
*/
GList *
clutter_container_get_children (ClutterContainer *container)
{
g_return_val_if_fail (CLUTTER_IS_CONTAINER (container), NULL);
return clutter_actor_get_children (CLUTTER_ACTOR (container));
}
/**
* clutter_container_raise_child: (virtual raise)
* @container: a #ClutterContainer
* @actor: the actor to raise
* @sibling: (allow-none): the sibling to raise to, or %NULL to raise
* to the top
*
* Raises @actor to @sibling level, in the depth ordering.
*
* This function calls the #ClutterContainerIface.raise() virtual function,
* which has been deprecated. The default implementation will call
* clutter_actor_set_child_above_sibling().
*
* Since: 0.6
*
* Deprecated: 1.10: Use clutter_actor_set_child_above_sibling() instead.
*/
void
clutter_container_raise_child (ClutterContainer *container,
ClutterActor *actor,
ClutterActor *sibling)
{
ClutterContainerIface *iface;
ClutterActor *self;
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
g_return_if_fail (sibling == NULL || CLUTTER_IS_ACTOR (sibling));
if (actor == sibling)
return;
self = CLUTTER_ACTOR (container);
if (clutter_actor_get_parent (actor) != self)
{
g_warning ("Actor of type '%s' is not a child of the container "
"of type '%s'",
g_type_name (G_OBJECT_TYPE (actor)),
g_type_name (G_OBJECT_TYPE (container)));
return;
}
if (sibling != NULL &&
clutter_actor_get_parent (sibling) != self)
{
g_warning ("Actor of type '%s' is not a child of the container "
"of type '%s'",
g_type_name (G_OBJECT_TYPE (sibling)),
g_type_name (G_OBJECT_TYPE (container)));
return;
}
iface = CLUTTER_CONTAINER_GET_IFACE (container);
#ifdef CLUTTER_ENABLE_DEBUG
if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
{
if (iface->raise != container_real_raise)
_clutter_diagnostic_message ("The ClutterContainer::raise() "
"virtual function has been deprecated "
"and it should not be overridden by "
"newly written code");
}
#endif /* CLUTTER_ENABLE_DEBUG */
iface->raise (container, actor, sibling);
}
/**
* clutter_container_lower_child: (virtual lower)
* @container: a #ClutterContainer
* @actor: the actor to raise
* @sibling: (allow-none): the sibling to lower to, or %NULL to lower
* to the bottom
*
* Lowers @actor to @sibling level, in the depth ordering.
*
* This function calls the #ClutterContainerIface.lower() virtual function,
* which has been deprecated. The default implementation will call
* clutter_actor_set_child_below_sibling().
*
* Since: 0.6
*
* Deprecated: 1.10: Use clutter_actor_set_child_below_sibling() instead.
*/
void
clutter_container_lower_child (ClutterContainer *container,
ClutterActor *actor,
ClutterActor *sibling)
{
ClutterContainerIface *iface;
ClutterActor *self;
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
g_return_if_fail (sibling == NULL || CLUTTER_IS_ACTOR (sibling));
if (actor == sibling)
return;
self = CLUTTER_ACTOR (container);
if (clutter_actor_get_parent (actor) != self)
{
g_warning ("Actor of type '%s' is not a child of the container "
"of type '%s'",
g_type_name (G_OBJECT_TYPE (actor)),
g_type_name (G_OBJECT_TYPE (container)));
return;
}
if (sibling != NULL&&
clutter_actor_get_parent (sibling) != self)
{
g_warning ("Actor of type '%s' is not a child of the container "
"of type '%s'",
g_type_name (G_OBJECT_TYPE (sibling)),
g_type_name (G_OBJECT_TYPE (container)));
return;
}
iface = CLUTTER_CONTAINER_GET_IFACE (container);
#ifdef CLUTTER_ENABLE_DEBUG
if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
{
if (iface->lower != container_real_lower)
_clutter_diagnostic_message ("The ClutterContainer::lower() "
"virtual function has been deprecated "
"and it should not be overridden by "
"newly written code");
}
#endif /* CLUTTER_ENABLE_DEBUG */
iface->lower (container, actor, sibling);
}
/**
* clutter_container_sort_depth_order:
* @container: a #ClutterContainer
*
* Sorts a container's children using their depth. This function should not
* be normally used by applications.
*
* Since: 0.6
*
* Deprecated: 1.10: The #ClutterContainerIface.sort_depth_order() virtual
* function should not be used any more; the default implementation in
* #ClutterContainer does not do anything.
*/
void
clutter_container_sort_depth_order (ClutterContainer *container)
{
ClutterContainerIface *iface;
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
iface = CLUTTER_CONTAINER_GET_IFACE (container);
#ifdef CLUTTER_ENABLE_DEBUG
if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
{
if (iface->sort_depth_order != container_real_sort_depth_order)
_clutter_diagnostic_message ("The ClutterContainer::sort_depth_order() "
"virtual function has been deprecated "
"and it should not be overridden by "
"newly written code");
}
#endif /* CLUTTER_ENABLE_DEBUG */
iface->sort_depth_order (container);
}
/**
* clutter_container_find_child_by_name:
* @container: a #ClutterContainer
@@ -444,7 +668,7 @@ clutter_container_find_child_by_name (ClutterContainer *container,
g_return_val_if_fail (CLUTTER_IS_CONTAINER (container), NULL);
g_return_val_if_fail (child_name != NULL, NULL);
children = clutter_actor_get_children (CLUTTER_ACTOR (container));
children = clutter_container_get_children (container);
for (iter = children; iter; iter = g_list_next (iter))
{

View File

@@ -59,6 +59,13 @@ typedef struct _ClutterContainerIface ClutterContainerIface;
* function is deprecated, and it should not be overridden.
* @remove: virtual function for removing an actor from the container. This
* virtual function is deprecated, and it should not be overridden.
* @raise: virtual function for raising a child. This virtual function is
* deprecated and it should not be overridden.
* @lower: virtual function for lowering a child. This virtual function is
* deprecated and it should not be overridden.
* @sort_depth_order: virtual function for sorting the children of a
* container depending on their depth. This virtual function is deprecated
* and it should not be overridden.
* @child_meta_type: The GType used for storing auxiliary information about
* each of the containers children.
* @create_child_meta: virtual function that gets called for each added
@@ -90,6 +97,15 @@ struct _ClutterContainerIface
void (* remove) (ClutterContainer *container,
ClutterActor *actor);
/* child stacking */
void (* raise) (ClutterContainer *container,
ClutterActor *actor,
ClutterActor *sibling);
void (* lower) (ClutterContainer *container,
ClutterActor *actor,
ClutterActor *sibling);
void (* sort_depth_order) (ClutterContainer *container);
/* ClutterChildMeta management */
GType child_meta_type;
void (* create_child_meta) (ClutterContainer *container,

View File

@@ -322,8 +322,8 @@ _clutter_content_paint_content (ClutterContent *content,
/**
* clutter_content_get_preferred_size:
* @content: a #ClutterContent
* @width: (out) (optional): return location for the natural width of the content
* @height: (out) (optional): return location for the natural height of the content
* @width: (out): return location for the natural width of the content
* @height: (out): return location for the natural height of the content
*
* Retrieves the natural size of the @content, if any.
*

View File

@@ -15,7 +15,7 @@ G_BEGIN_DECLS
/* Try the GCC extension for valists in macros */
#define CLUTTER_NOTE(type,x,a...) G_STMT_START { \
if (G_UNLIKELY (CLUTTER_HAS_DEBUG (type))) { \
_clutter_debug_message ("[" #type "]: " x, ##a); \
_clutter_debug_message ("[" #type "]:" G_STRLOC ": " x, ##a); \
} } G_STMT_END
#else /* !__GNUC__ */
@@ -26,7 +26,7 @@ G_BEGIN_DECLS
#define CLUTTER_NOTE(type,...) G_STMT_START { \
if (G_UNLIKELY (CLUTTER_HAS_DEBUG (type))) { \
gchar *_fmt = g_strdup_printf (__VA_ARGS__); \
_clutter_debug_message ("[" #type "]: %s", _fmt); \
_clutter_debug_message ("[" #type "]:" G_STRLOC ": %s", _fmt); \
g_free (_fmt); \
} } G_STMT_END
#endif

View File

@@ -3,7 +3,6 @@
#define __CLUTTER_DEPRECATED_H_INSIDE__
#include "deprecated/clutter-box-layout.h"
#include "deprecated/clutter-container.h"
#undef __CLUTTER_DEPRECATED_H_INSIDE__

View File

@@ -308,12 +308,12 @@ clutter_desaturate_effect_new (gdouble factor)
*/
void
clutter_desaturate_effect_set_factor (ClutterDesaturateEffect *effect,
double factor)
gdouble factor)
{
g_return_if_fail (CLUTTER_IS_DESATURATE_EFFECT (effect));
g_return_if_fail (factor >= 0.0 && factor <= 1.0);
if (fabs (effect->factor - factor) >= 0.00001)
if (fabsf (effect->factor - factor) >= 0.00001)
{
effect->factor = factor;
update_factor_uniform (effect);

View File

@@ -804,7 +804,6 @@ typedef enum /*< flags prefix=CLUTTER_EVENT >*/
CLUTTER_EVENT_FLAG_INPUT_METHOD = 1 << 1,
CLUTTER_EVENT_FLAG_REPEATED = 1 << 2,
CLUTTER_EVENT_FLAG_RELATIVE_MOTION = 1 << 3,
CLUTTER_EVENT_FLAG_GRAB_NOTIFY = 1 << 4,
} ClutterEventFlags;
/**
@@ -830,11 +829,6 @@ typedef enum /*< flags prefix=CLUTTER_EVENT >*/
* determined by its phase field; event added in 1.24
* @CLUTTER_TOUCHPAD_SWIPE: A swipe gesture event, the current state is
* determined by its phase field; event added in 1.24
* @CLUTTER_TOUCHPAD_HOLD: A hold gesture event, the current state is
* determined by its phase field. A hold gesture starts when the user places a
* finger on the touchpad and ends when all fingers are lifted. It is
* cancelled when the finger(s) move past a certain threshold.
* Event added in 40.4
* @CLUTTER_PROXIMITY_IN: A tool entered in proximity to a tablet;
* event added in 1.28
* @CLUTTER_PROXIMITY_OUT: A tool left from the proximity area of a tablet;
@@ -863,7 +857,6 @@ typedef enum /*< prefix=CLUTTER >*/
CLUTTER_TOUCH_CANCEL,
CLUTTER_TOUCHPAD_PINCH,
CLUTTER_TOUCHPAD_SWIPE,
CLUTTER_TOUCHPAD_HOLD,
CLUTTER_PROXIMITY_IN,
CLUTTER_PROXIMITY_OUT,
CLUTTER_PAD_BUTTON_PRESS,
@@ -905,7 +898,12 @@ typedef enum /*< prefix=CLUTTER_SCROLL >*/
/**
* ClutterFeatureFlags:
* @CLUTTER_FEATURE_STAGE_STATIC: Set if stage size if fixed (i.e framebuffer)
* @CLUTTER_FEATURE_STAGE_CURSOR: Set if stage has a graphical cursor.
* @CLUTTER_FEATURE_SHADERS_GLSL: Set if the backend supports GLSL shaders.
* @CLUTTER_FEATURE_OFFSCREEN: Set if the backend supports offscreen rendering.
* @CLUTTER_FEATURE_STAGE_MULTIPLE: Set if multiple stages are supported.
* @CLUTTER_FEATURE_SWAP_EVENTS: Set if the GLX_INTEL_swap_event is supported.
*
* Runtime flags indicating specific features available via Clutter window
* system and graphics backend.
@@ -914,7 +912,12 @@ typedef enum /*< prefix=CLUTTER_SCROLL >*/
*/
typedef enum
{
CLUTTER_FEATURE_STAGE_STATIC = (1 << 6),
CLUTTER_FEATURE_STAGE_CURSOR = (1 << 8),
CLUTTER_FEATURE_SHADERS_GLSL = (1 << 9),
CLUTTER_FEATURE_OFFSCREEN = (1 << 10),
CLUTTER_FEATURE_STAGE_MULTIPLE = (1 << 11),
CLUTTER_FEATURE_SWAP_EVENTS = (1 << 12)
} ClutterFeatureFlags;
/**
@@ -935,29 +938,6 @@ typedef enum /*< prefix=CLUTTER_FLOW >*/
CLUTTER_FLOW_VERTICAL
} ClutterFlowOrientation;
/**
* ClutterInputDeviceCapabilities:
* @CLUTTER_INPUT_CAPABILITY_NONE: No capabilities
* @CLUTTER_INPUT_CAPABILITY_POINTER: Pointer capability
* @CLUTTER_INPUT_CAPABILITY_KEYBOARD: Keyboard capability
* @CLUTTER_INPUT_CAPABILITY_TOUCHPAD: Touchpad gesture and scroll capability
* @CLUTTER_INPUT_CAPABILITY_TOUCH: Touch capability
* @CLUTTER_INPUT_CAPABILITY_TABLET_TOOL: Tablet tool capability
* @CLUTTER_INPUT_CAPABILITY_TABLET_PAD: Tablet pad capability
*
* Describes the capabilities of an input device.
**/
typedef enum /*< prefix=CLUTTER_INPUT_CAPABILITY >*/
{
CLUTTER_INPUT_CAPABILITY_NONE = 0,
CLUTTER_INPUT_CAPABILITY_POINTER = 1 << 0,
CLUTTER_INPUT_CAPABILITY_KEYBOARD = 1 << 1,
CLUTTER_INPUT_CAPABILITY_TOUCHPAD = 1 << 2,
CLUTTER_INPUT_CAPABILITY_TOUCH = 1 << 3,
CLUTTER_INPUT_CAPABILITY_TABLET_TOOL = 1 << 4,
CLUTTER_INPUT_CAPABILITY_TABLET_PAD = 1 << 5,
} ClutterInputCapabilities;
/**
* ClutterInputDeviceType:
* @CLUTTER_POINTER_DEVICE: A pointer device
@@ -1459,6 +1439,24 @@ typedef enum
CLUTTER_STEP_MODE_END
} ClutterStepMode;
/**
* ClutterZoomAxis:
* @CLUTTER_ZOOM_X_AXIS: Scale only on the X axis
* @CLUTTER_ZOOM_Y_AXIS: Scale only on the Y axis
* @CLUTTER_ZOOM_BOTH: Scale on both axis
*
* The axis of the constraint that should be applied by the
* zooming action.
*
* Since: 1.12
*/
typedef enum /*< prefix=CLUTTER_ZOOM >*/
{
CLUTTER_ZOOM_X_AXIS,
CLUTTER_ZOOM_Y_AXIS,
CLUTTER_ZOOM_BOTH
} ClutterZoomAxis;
/**
* ClutterGestureTriggerEdge:
* @CLUTTER_GESTURE_TRIGGER_EDGE_NONE: Tell #ClutterGestureAction that
@@ -1646,21 +1644,6 @@ typedef enum
CLUTTER_PREEDIT_RESET_COMMIT,
} ClutterPreeditResetMode;
typedef enum
{
CLUTTER_PHASE_CAPTURE,
CLUTTER_PHASE_BUBBLE,
} ClutterEventPhase;
typedef enum
{
CLUTTER_GRAB_STATE_NONE = 0,
CLUTTER_GRAB_STATE_POINTER = 1 << 0,
CLUTTER_GRAB_STATE_KEYBOARD = 1 << 1,
CLUTTER_GRAB_STATE_ALL = (CLUTTER_GRAB_STATE_POINTER |
CLUTTER_GRAB_STATE_KEYBOARD),
} ClutterGrabState;
G_END_DECLS
#endif /* __CLUTTER_ENUMS_H__ */

View File

@@ -14,8 +14,7 @@ CLUTTER_EXPORT
void _clutter_process_event (ClutterEvent *event);
CLUTTER_EXPORT
gboolean _clutter_event_process_filters (ClutterEvent *event,
ClutterActor *event_actor);
gboolean _clutter_event_process_filters (ClutterEvent *event);
/* clears the event queue inside the main context */
void _clutter_clear_events_queue (void);

View File

@@ -433,11 +433,6 @@ clutter_event_get_position (const ClutterEvent *event,
graphene_point_init (position, event->touchpad_swipe.x,
event->touchpad_swipe.y);
break;
case CLUTTER_TOUCHPAD_HOLD:
graphene_point_init (position, event->touchpad_hold.x,
event->touchpad_hold.y);
break;
}
}
@@ -517,11 +512,6 @@ clutter_event_set_coords (ClutterEvent *event,
event->touchpad_swipe.x = x;
event->touchpad_swipe.y = y;
break;
case CLUTTER_TOUCHPAD_HOLD:
event->touchpad_hold.x = x;
event->touchpad_hold.y = y;
break;
}
}
@@ -541,8 +531,7 @@ clutter_event_get_source (const ClutterEvent *event)
{
g_return_val_if_fail (event != NULL, NULL);
return clutter_stage_get_event_actor (clutter_event_get_stage (event),
event);
return event->any.source;
}
/**
@@ -558,6 +547,10 @@ void
clutter_event_set_source (ClutterEvent *event,
ClutterActor *actor)
{
g_return_if_fail (event != NULL);
g_return_if_fail (actor == NULL || CLUTTER_IS_ACTOR (actor));
event->any.source = actor;
}
/**
@@ -830,6 +823,27 @@ clutter_event_set_button (ClutterEvent *event,
event->button.button = button;
}
/**
* clutter_event_get_click_count:
* @event: a #ClutterEvent of type %CLUTTER_BUTTON_PRESS or
* of type %CLUTTER_BUTTON_RELEASE
*
* Retrieves the number of clicks of @event
*
* Return value: the click count
*
* Since: 1.0
*/
guint32
clutter_event_get_click_count (const ClutterEvent *event)
{
g_return_val_if_fail (event != NULL, 0);
g_return_val_if_fail (event->type == CLUTTER_BUTTON_PRESS ||
event->type == CLUTTER_BUTTON_RELEASE, 0);
return event->button.click_count;
}
/* keys */
/**
@@ -1074,7 +1088,6 @@ clutter_event_set_device (ClutterEvent *event,
case CLUTTER_TOUCHPAD_PINCH:
case CLUTTER_TOUCHPAD_SWIPE:
case CLUTTER_TOUCHPAD_HOLD:
/* Rely on priv data for these */
break;
@@ -1172,7 +1185,6 @@ clutter_event_get_device (const ClutterEvent *event)
case CLUTTER_TOUCHPAD_PINCH:
case CLUTTER_TOUCHPAD_SWIPE:
case CLUTTER_TOUCHPAD_HOLD:
/* Rely on priv data for these */
break;
@@ -1637,7 +1649,6 @@ clutter_event_get_axes (const ClutterEvent *event,
case CLUTTER_TOUCHPAD_PINCH:
case CLUTTER_TOUCHPAD_SWIPE:
case CLUTTER_TOUCHPAD_HOLD:
case CLUTTER_PAD_BUTTON_PRESS:
case CLUTTER_PAD_BUTTON_RELEASE:
case CLUTTER_PAD_STRIP:
@@ -1772,8 +1783,7 @@ clutter_event_is_pointer_emulated (const ClutterEvent *event)
}
gboolean
_clutter_event_process_filters (ClutterEvent *event,
ClutterActor *event_actor)
_clutter_event_process_filters (ClutterEvent *event)
{
ClutterMainContext *context = _clutter_context_get_default ();
GList *l, *next;
@@ -1790,7 +1800,7 @@ _clutter_event_process_filters (ClutterEvent *event,
if (event_filter->stage && event_filter->stage != event->any.stage)
continue;
if (event_filter->func (event, event_actor, event_filter->user_data) == CLUTTER_EVENT_STOP)
if (event_filter->func (event, event_filter->user_data) == CLUTTER_EVENT_STOP)
return CLUTTER_EVENT_STOP;
}
@@ -1884,15 +1894,12 @@ clutter_event_get_touchpad_gesture_finger_count (const ClutterEvent *event)
{
g_return_val_if_fail (event != NULL, 0);
g_return_val_if_fail (event->type == CLUTTER_TOUCHPAD_SWIPE ||
event->type == CLUTTER_TOUCHPAD_PINCH ||
event->type == CLUTTER_TOUCHPAD_HOLD, 0);
event->type == CLUTTER_TOUCHPAD_PINCH, 0);
if (event->type == CLUTTER_TOUCHPAD_SWIPE)
return event->touchpad_swipe.n_fingers;
else if (event->type == CLUTTER_TOUCHPAD_PINCH)
return event->touchpad_pinch.n_fingers;
else if (event->type == CLUTTER_TOUCHPAD_HOLD)
return event->touchpad_hold.n_fingers;
return 0;
}
@@ -1951,15 +1958,12 @@ clutter_event_get_gesture_phase (const ClutterEvent *event)
{
g_return_val_if_fail (event != NULL, 0);
g_return_val_if_fail (event->type == CLUTTER_TOUCHPAD_PINCH ||
event->type == CLUTTER_TOUCHPAD_SWIPE ||
event->type == CLUTTER_TOUCHPAD_HOLD, 0);
event->type == CLUTTER_TOUCHPAD_SWIPE, 0);
if (event->type == CLUTTER_TOUCHPAD_PINCH)
return event->touchpad_pinch.phase;
else if (event->type == CLUTTER_TOUCHPAD_SWIPE)
return event->touchpad_swipe.phase;
else if (event->type == CLUTTER_TOUCHPAD_HOLD)
return event->touchpad_hold.phase;
/* Shouldn't ever happen */
return CLUTTER_TOUCHPAD_GESTURE_PHASE_BEGIN;
@@ -1985,8 +1989,7 @@ clutter_event_get_gesture_motion_delta (const ClutterEvent *event,
{
g_return_if_fail (event != NULL);
g_return_if_fail (event->type == CLUTTER_TOUCHPAD_PINCH ||
event->type == CLUTTER_TOUCHPAD_SWIPE ||
event->type == CLUTTER_TOUCHPAD_HOLD);
event->type == CLUTTER_TOUCHPAD_SWIPE);
if (event->type == CLUTTER_TOUCHPAD_PINCH)
{
@@ -2002,13 +2005,6 @@ clutter_event_get_gesture_motion_delta (const ClutterEvent *event,
if (dy)
*dy = event->touchpad_swipe.dy;
}
else if (event->type == CLUTTER_TOUCHPAD_HOLD)
{
if (dx)
*dx = 0;
if (dy)
*dy = 0;
}
}
/**
@@ -2030,8 +2026,7 @@ clutter_event_get_gesture_motion_delta_unaccelerated (const ClutterEvent *event,
{
g_return_if_fail (event != NULL);
g_return_if_fail (event->type == CLUTTER_TOUCHPAD_PINCH ||
event->type == CLUTTER_TOUCHPAD_SWIPE ||
event->type == CLUTTER_TOUCHPAD_HOLD);
event->type == CLUTTER_TOUCHPAD_SWIPE);
if (event->type == CLUTTER_TOUCHPAD_PINCH)
{
@@ -2047,13 +2042,6 @@ clutter_event_get_gesture_motion_delta_unaccelerated (const ClutterEvent *event,
if (dy)
*dy = event->touchpad_swipe.dy_unaccel;
}
else if (event->type == CLUTTER_TOUCHPAD_HOLD)
{
if (dx)
*dx = 0;
if (dy)
*dy = 0;
}
}
/**
* clutter_event_get_scroll_source:

View File

@@ -116,7 +116,6 @@ typedef struct _ClutterCrossingEvent ClutterCrossingEvent;
typedef struct _ClutterTouchEvent ClutterTouchEvent;
typedef struct _ClutterTouchpadPinchEvent ClutterTouchpadPinchEvent;
typedef struct _ClutterTouchpadSwipeEvent ClutterTouchpadSwipeEvent;
typedef struct _ClutterTouchpadHoldEvent ClutterTouchpadHoldEvent;
typedef struct _ClutterProximityEvent ClutterProximityEvent;
typedef struct _ClutterPadButtonEvent ClutterPadButtonEvent;
typedef struct _ClutterPadStripEvent ClutterPadStripEvent;
@@ -141,6 +140,7 @@ struct _ClutterAnyEvent
guint32 time;
ClutterEventFlags flags;
ClutterStage *stage;
ClutterActor *source;
};
/**
@@ -167,6 +167,7 @@ struct _ClutterKeyEvent
guint32 time;
ClutterEventFlags flags;
ClutterStage *stage;
ClutterActor *source;
ClutterModifierType modifier_state;
guint keyval;
@@ -187,6 +188,8 @@ struct _ClutterKeyEvent
* @y: event Y coordinate, relative to the stage
* @modifier_state: button modifiers
* @button: event button
* @click_count: number of button presses within the default time
* and radius
* @axes: reserved for future use
* @device: the device that originated the event. If you want the physical
* device the event originated from, use clutter_event_get_source_device()
@@ -205,11 +208,13 @@ struct _ClutterButtonEvent
guint32 time;
ClutterEventFlags flags;
ClutterStage *stage;
ClutterActor *source;
gfloat x;
gfloat y;
ClutterModifierType modifier_state;
guint32 button;
guint click_count;
gdouble *axes; /* Future use */
ClutterInputDevice *device;
uint32_t evdev_code;
@@ -235,6 +240,7 @@ struct _ClutterProximityEvent
guint32 time;
ClutterEventFlags flags;
ClutterStage *stage;
ClutterActor *source;
ClutterInputDevice *device;
};
@@ -261,6 +267,7 @@ struct _ClutterCrossingEvent
guint32 time;
ClutterEventFlags flags;
ClutterStage *stage;
ClutterActor *source;
gfloat x;
gfloat y;
@@ -293,6 +300,7 @@ struct _ClutterMotionEvent
guint32 time;
ClutterEventFlags flags;
ClutterStage *stage;
ClutterActor *source;
gfloat x;
gfloat y;
@@ -334,6 +342,7 @@ struct _ClutterScrollEvent
guint32 time;
ClutterEventFlags flags;
ClutterStage *stage;
ClutterActor *source;
gfloat x;
gfloat y;
@@ -383,6 +392,7 @@ struct _ClutterTouchEvent
guint32 time;
ClutterEventFlags flags;
ClutterStage *stage;
ClutterActor *source;
gfloat x;
gfloat y;
@@ -428,6 +438,7 @@ struct _ClutterTouchpadPinchEvent
guint32 time;
ClutterEventFlags flags;
ClutterStage *stage;
ClutterActor *source;
ClutterTouchpadGesturePhase phase;
gfloat x;
@@ -470,6 +481,7 @@ struct _ClutterTouchpadSwipeEvent
guint32 time;
ClutterEventFlags flags;
ClutterStage *stage;
ClutterActor *source;
ClutterTouchpadGesturePhase phase;
guint n_fingers;
@@ -481,47 +493,13 @@ struct _ClutterTouchpadSwipeEvent
gfloat dy_unaccel;
};
/**
* ClutterTouchpadHoldEvent
* @type: event type
* @time: event time
* @flags: event flags
* @stage: event source stage
* @source: event source actor (unused)
* @phase: the current phase of the gesture
* @n_fingers: the number of fingers triggering the swipe
* @x: the X coordinate of the pointer, relative to the stage
* @y: the Y coordinate of the pointer, relative to the stage
*
* Used for touchpad hold gesture events. The current state of the
* gesture will be determined by the @phase field.
*
* A hold gesture starts when the user places one or many fingers on the
* touchpad and ends when all fingers are lifted. It is cancelled when the
* finger(s) move past a certain threshold.
* Unlike swipe and pinch, @phase can only be
* CLUTTER_TOUCHPAD_GESTURE_PHASE_BEGIN, CLUTTER_TOUCHPAD_GESTURE_PHASE_END and
* CLUTTER_TOUCHPAD_GESTURE_PHASE_CANCEL.
*/
struct _ClutterTouchpadHoldEvent
{
ClutterEventType type;
guint32 time;
ClutterEventFlags flags;
ClutterStage *stage;
ClutterTouchpadGesturePhase phase;
uint32_t n_fingers;
float x;
float y;
};
struct _ClutterPadButtonEvent
{
ClutterEventType type;
guint32 time;
ClutterEventFlags flags;
ClutterStage *stage;
ClutterActor *source;
guint32 button;
guint32 group;
@@ -535,6 +513,7 @@ struct _ClutterPadStripEvent
guint32 time;
ClutterEventFlags flags;
ClutterStage *stage;
ClutterActor *source;
ClutterInputDevice *device;
ClutterInputDevicePadSource strip_source;
@@ -550,6 +529,7 @@ struct _ClutterPadRingEvent
guint32 time;
ClutterEventFlags flags;
ClutterStage *stage;
ClutterActor *source;
ClutterInputDevice *device;
ClutterInputDevicePadSource ring_source;
@@ -565,6 +545,7 @@ struct _ClutterDeviceEvent
guint32 time;
ClutterEventFlags flags;
ClutterStage *stage;
ClutterActor *source;
ClutterInputDevice *device;
};
@@ -575,6 +556,7 @@ struct _ClutterIMEvent
uint32_t time;
ClutterEventFlags flags;
ClutterStage *stage;
ClutterActor *source;
char *text;
int32_t offset;
@@ -603,7 +585,6 @@ union _ClutterEvent
ClutterTouchEvent touch;
ClutterTouchpadPinchEvent touchpad_pinch;
ClutterTouchpadSwipeEvent touchpad_swipe;
ClutterTouchpadHoldEvent touchpad_hold;
ClutterProximityEvent proximity;
ClutterPadButtonEvent pad_button;
ClutterPadStripEvent pad_strip;
@@ -615,7 +596,6 @@ union _ClutterEvent
/**
* ClutterEventFilterFunc:
* @event: the event that is going to be emitted
* @event_actor: the current device actor of the events device
* @user_data: the data pointer passed to clutter_event_add_filter()
*
* A function pointer type used by event filters that are added with
@@ -629,7 +609,6 @@ union _ClutterEvent
* Since: 1.18
*/
typedef gboolean (* ClutterEventFilterFunc) (const ClutterEvent *event,
ClutterActor *event_actor,
gpointer user_data);
CLUTTER_EXPORT
@@ -702,10 +681,10 @@ void clutter_event_set_device_tool (ClutterEvent
CLUTTER_EXPORT
ClutterInputDeviceTool *clutter_event_get_device_tool (const ClutterEvent *event);
CLUTTER_DEPRECATED_FOR(clutter_stage_get_event_actor)
CLUTTER_EXPORT
void clutter_event_set_source (ClutterEvent *event,
ClutterActor *actor);
CLUTTER_DEPRECATED
CLUTTER_EXPORT
ClutterActor * clutter_event_get_source (const ClutterEvent *event);
CLUTTER_EXPORT
void clutter_event_set_stage (ClutterEvent *event,
@@ -761,6 +740,8 @@ void clutter_event_set_button (ClutterEvent
CLUTTER_EXPORT
guint32 clutter_event_get_button (const ClutterEvent *event);
CLUTTER_EXPORT
guint clutter_event_get_click_count (const ClutterEvent *event);
CLUTTER_EXPORT
void clutter_event_set_related (ClutterEvent *event,
ClutterActor *actor);
CLUTTER_EXPORT

View File

@@ -64,13 +64,16 @@ clutter_features_from_cogl (void)
clutter_flags |= CLUTTER_FEATURE_SHADERS_GLSL;
clutter_flags |= CLUTTER_FEATURE_OFFSCREEN;
return clutter_flags;
}
gboolean
clutter_feature_init (ClutterMainContext *context,
GError **error)
_clutter_feature_init (GError **error)
{
ClutterMainContext *context;
CLUTTER_NOTE (MISC, "checking features");
if (!__features)
@@ -83,11 +86,14 @@ clutter_feature_init (ClutterMainContext *context,
if (__features->features_set)
return TRUE;
context = _clutter_context_get_default ();
/* makes sure we have a GL context; if we have, this is a no-op */
if (!_clutter_backend_create_context (context->backend, error))
return FALSE;
__features->flags = clutter_features_from_cogl ();
__features->flags = (clutter_features_from_cogl ()
| _clutter_backend_get_features (context->backend));
__features->features_set = TRUE;

View File

@@ -45,7 +45,10 @@ typedef struct _EstimateQueue
int next_index;
} EstimateQueue;
#define SYNC_DELAY_FALLBACK_FRACTION 0.875
/* When heuristic render time is off,
* wait 2ms after vblank before starting to draw next frame.
*/
#define SYNC_DELAY_FALLBACK_US ms2us (2)
typedef struct _ClutterFrameListener
{
@@ -228,48 +231,6 @@ void
clutter_frame_clock_notify_presented (ClutterFrameClock *frame_clock,
ClutterFrameInfo *frame_info)
{
COGL_TRACE_BEGIN_SCOPED (ClutterFrameClockNotifyPresented,
"Frame Clock (presented)");
#ifdef COGL_HAS_TRACING
if (G_UNLIKELY (cogl_is_tracing_enabled ()))
{
int64_t current_time_us;
g_autoptr (GString) description = NULL;
current_time_us = g_get_monotonic_time ();
description = g_string_new (NULL);
if (frame_info->presentation_time != 0)
{
if (frame_info->presentation_time <= current_time_us)
{
g_string_append_printf (description,
"presentation was %ld µs earlier",
current_time_us - frame_info->presentation_time);
}
else
{
g_string_append_printf (description,
"presentation will be %ld µs later",
frame_info->presentation_time - current_time_us);
}
}
if (frame_info->gpu_rendering_duration_ns != 0)
{
if (description->len > 0)
g_string_append (description, ", ");
g_string_append_printf (description,
"buffer swap to GPU done: %ld µs",
ns2us (frame_info->gpu_rendering_duration_ns));
}
COGL_TRACE_DESCRIBE (ClutterFrameClockNotifyPresented, description->str);
}
#endif
frame_clock->last_presentation_time_us = frame_info->presentation_time;
frame_clock->got_measurements_last_frame = FALSE;
@@ -328,8 +289,6 @@ clutter_frame_clock_notify_presented (ClutterFrameClock *frame_clock,
void
clutter_frame_clock_notify_ready (ClutterFrameClock *frame_clock)
{
COGL_TRACE_BEGIN_SCOPED (ClutterFrameClockNotifyReady, "Frame Clock (ready)");
switch (frame_clock->state)
{
case CLUTTER_FRAME_CLOCK_STATE_INIT:
@@ -355,12 +314,13 @@ clutter_frame_clock_compute_max_render_time_us (ClutterFrameClock *frame_clock)
int64_t max_render_time_us;
int i;
refresh_interval_us = frame_clock->refresh_interval_us;
refresh_interval_us =
(int64_t) (0.5 + G_USEC_PER_SEC / frame_clock->refresh_rate);
if (!frame_clock->got_measurements_last_frame ||
G_UNLIKELY (clutter_paint_debug_flags &
CLUTTER_DEBUG_DISABLE_DYNAMIC_MAX_RENDER_TIME))
return refresh_interval_us * SYNC_DELAY_FALLBACK_FRACTION;
return refresh_interval_us - SYNC_DELAY_FALLBACK_US;
for (i = 0; i < ESTIMATE_QUEUE_LENGTH; ++i)
{
@@ -657,14 +617,8 @@ clutter_frame_clock_dispatch (ClutterFrameClock *frame_clock,
ClutterFrameResult result;
int64_t ideal_dispatch_time_us, lateness_us;
#ifdef COGL_HAS_TRACING
int64_t this_dispatch_ready_time_us;
COGL_TRACE_BEGIN_SCOPED (ClutterFrameClockDispatch, "Frame Clock (dispatch)");
this_dispatch_ready_time_us = g_source_get_ready_time (frame_clock->source);
#endif
ideal_dispatch_time_us = (frame_clock->last_dispatch_time_us -
frame_clock->last_dispatch_lateness_us) +
frame_clock->refresh_interval_us;
@@ -692,14 +646,13 @@ clutter_frame_clock_dispatch (ClutterFrameClock *frame_clock,
COGL_TRACE_END (ClutterFrameClockEvents);
COGL_TRACE_BEGIN (ClutterFrameClockTimelines, "Frame Clock (timelines)");
if (frame_clock->is_next_presentation_time_valid)
time_us = frame_clock->next_presentation_time_us;
advance_timelines (frame_clock, time_us);
COGL_TRACE_END (ClutterFrameClockTimelines);
COGL_TRACE_BEGIN (ClutterFrameClockFrame, "Frame Clock (frame)");
result = frame_clock->listener.iface->frame (frame_clock,
frame_count,
time_us,
frame_clock->listener.user_data);
COGL_TRACE_END (ClutterFrameClockFrame);
@@ -725,17 +678,6 @@ clutter_frame_clock_dispatch (ClutterFrameClock *frame_clock,
}
break;
}
#ifdef COGL_HAS_TRACING
if (this_dispatch_ready_time_us != -1 &&
G_UNLIKELY (cogl_is_tracing_enabled ()))
{
g_autofree char *description = NULL;
description = g_strdup_printf ("dispatched %ld µs late",
time_us - this_dispatch_ready_time_us);
COGL_TRACE_DESCRIBE (ClutterFrameClockDispatch, description);
}
#endif
}
static gboolean
@@ -822,7 +764,7 @@ init_frame_clock_source (ClutterFrameClock *frame_clock)
source = g_source_new (&frame_clock_source_funcs, sizeof (ClutterClockSource));
clock_source = (ClutterClockSource *) source;
name = g_strdup_printf ("[mutter] Clutter frame clock (%p)", frame_clock);
name = g_strdup_printf ("Clutter frame clock (%p)", frame_clock);
g_source_set_name (source, name);
g_source_set_priority (source, CLUTTER_PRIORITY_REDRAW);
g_source_set_can_recurse (source, FALSE);

View File

@@ -50,6 +50,7 @@ typedef struct _ClutterFrameListenerIface
gpointer user_data);
ClutterFrameResult (* frame) (ClutterFrameClock *frame_clock,
int64_t frame_count,
int64_t time_us,
gpointer user_data);
} ClutterFrameListenerIface;

View File

@@ -118,6 +118,9 @@ struct _ClutterGestureActionPrivate
gint requested_nb_points;
GArray *points;
gulong actor_capture_id;
gulong stage_capture_id;
ClutterGestureTriggerEdge edge;
float distance_x, distance_y;
@@ -152,8 +155,7 @@ static guint gesture_signals[LAST_SIGNAL] = { 0, };
G_DEFINE_TYPE_WITH_PRIVATE (ClutterGestureAction, clutter_gesture_action, CLUTTER_TYPE_ACTION)
static GesturePoint *
gesture_register_point (ClutterGestureAction *action,
const ClutterEvent *event)
gesture_register_point (ClutterGestureAction *action, ClutterEvent *event)
{
ClutterGestureActionPrivate *priv =
clutter_gesture_action_get_instance_private (action);
@@ -186,8 +188,8 @@ gesture_register_point (ClutterGestureAction *action,
static GesturePoint *
gesture_find_point (ClutterGestureAction *action,
const ClutterEvent *event,
int *position)
ClutterEvent *event,
gint *position)
{
ClutterGestureActionPrivate *priv =
clutter_gesture_action_get_instance_private (action);
@@ -230,8 +232,8 @@ gesture_unregister_point (ClutterGestureAction *action, gint position)
}
static void
gesture_update_motion_point (GesturePoint *point,
const ClutterEvent *event)
gesture_update_motion_point (GesturePoint *point,
ClutterEvent *event)
{
gfloat motion_x, motion_y;
gint64 _time;
@@ -252,8 +254,8 @@ gesture_update_motion_point (GesturePoint *point,
}
static void
gesture_update_release_point (GesturePoint *point,
const ClutterEvent *event)
gesture_update_release_point (GesturePoint *point,
ClutterEvent *event)
{
gint64 _time;
@@ -281,7 +283,7 @@ gesture_get_default_threshold (void)
static gboolean
gesture_point_pass_threshold (ClutterGestureAction *action,
GesturePoint *point,
const ClutterEvent *event)
ClutterEvent *event)
{
float threshold_x, threshold_y;
gfloat motion_x, motion_y;
@@ -310,6 +312,8 @@ cancel_gesture (ClutterGestureAction *action)
priv->in_gesture = FALSE;
g_clear_signal_handler (&priv->stage_capture_id, priv->stage);
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
g_signal_emit (action, gesture_signals[GESTURE_CANCEL], 0, actor);
@@ -350,62 +354,34 @@ begin_gesture (ClutterGestureAction *action,
}
static gboolean
clutter_gesture_action_handle_event (ClutterAction *action,
const ClutterEvent *event)
stage_captured_event_cb (ClutterActor *stage,
ClutterEvent *event,
ClutterGestureAction *action)
{
ClutterGestureAction *gesture_action = CLUTTER_GESTURE_ACTION (action);
ClutterGestureActionPrivate *priv =
clutter_gesture_action_get_instance_private (gesture_action);
ClutterActor *actor =
clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
clutter_gesture_action_get_instance_private (action);
ClutterActor *actor;
gint position;
float threshold_x, threshold_y;
gboolean return_value;
GesturePoint *point;
ClutterEventType event_type;
if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (action)))
event_type = clutter_event_type (event);
if (event_type != CLUTTER_TOUCH_CANCEL &&
event_type != CLUTTER_TOUCH_UPDATE &&
event_type != CLUTTER_TOUCH_END &&
event_type != CLUTTER_MOTION &&
event_type != CLUTTER_BUTTON_RELEASE)
return CLUTTER_EVENT_PROPAGATE;
event_type = clutter_event_type (event);
if ((point = gesture_find_point (action, event, &position)) == NULL)
return CLUTTER_EVENT_PROPAGATE;
if (event_type == CLUTTER_BUTTON_PRESS ||
event_type == CLUTTER_TOUCH_BEGIN)
{
point = gesture_register_point (gesture_action, event);
}
else
{
if ((point = gesture_find_point (gesture_action, event, &position)) == NULL)
return CLUTTER_EVENT_PROPAGATE;
}
if (point &&
event_type == CLUTTER_LEAVE &&
(event->crossing.flags & CLUTTER_EVENT_FLAG_GRAB_NOTIFY) != 0)
{
gesture_unregister_point (gesture_action, position);
if (priv->in_gesture)
cancel_gesture (gesture_action);
return CLUTTER_EVENT_PROPAGATE;
}
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
switch (clutter_event_type (event))
{
case CLUTTER_BUTTON_PRESS:
case CLUTTER_TOUCH_BEGIN:
if (priv->stage == NULL)
priv->stage = clutter_actor_get_stage (actor);
/* Start the gesture immediately if the gesture has no
* _TRIGGER_EDGE_AFTER drag threshold. */
if ((priv->points->len >= priv->requested_nb_points) &&
(priv->edge != CLUTTER_GESTURE_TRIGGER_EDGE_AFTER))
begin_gesture (gesture_action, actor);
break;
case CLUTTER_MOTION:
{
ClutterModifierType mods = clutter_event_get_state (event);
@@ -416,11 +392,11 @@ clutter_gesture_action_handle_event (ClutterAction *action,
*/
if (!(mods & CLUTTER_BUTTON1_MASK))
{
cancel_gesture (gesture_action);
cancel_gesture (action);
return CLUTTER_EVENT_PROPAGATE;
}
}
G_GNUC_FALLTHROUGH;
/* Follow same code path as a touch event update */
case CLUTTER_TOUCH_UPDATE:
if (!priv->in_gesture)
@@ -434,7 +410,7 @@ clutter_gesture_action_handle_event (ClutterAction *action,
/* Wait until the drag threshold has been exceeded
* before starting _TRIGGER_EDGE_AFTER gestures. */
if (priv->edge == CLUTTER_GESTURE_TRIGGER_EDGE_AFTER &&
gesture_point_pass_threshold (gesture_action, point, event))
gesture_point_pass_threshold (action, point, event))
{
gesture_update_motion_point (point, event);
return CLUTTER_EVENT_PROPAGATE;
@@ -442,33 +418,31 @@ clutter_gesture_action_handle_event (ClutterAction *action,
gesture_update_motion_point (point, event);
if (!begin_gesture (gesture_action, actor))
if (!begin_gesture (action, actor))
return CLUTTER_EVENT_PROPAGATE;
if ((point = gesture_find_point (gesture_action, event, &position)) == NULL)
if ((point = gesture_find_point (action, event, &position)) == NULL)
return CLUTTER_EVENT_PROPAGATE;
}
gesture_update_motion_point (point, event);
g_signal_emit (gesture_action, gesture_signals[GESTURE_PROGRESS], 0, actor,
g_signal_emit (action, gesture_signals[GESTURE_PROGRESS], 0, actor,
&return_value);
if (!return_value)
{
cancel_gesture (gesture_action);
cancel_gesture (action);
return CLUTTER_EVENT_PROPAGATE;
}
/* Check if a _TRIGGER_EDGE_BEFORE gesture needs to be cancelled because
* the drag threshold has been exceeded. */
clutter_gesture_action_get_threshold_trigger_distance (gesture_action,
&threshold_x,
&threshold_y);
clutter_gesture_action_get_threshold_trigger_distance (action, &threshold_x, &threshold_y);
if (priv->edge == CLUTTER_GESTURE_TRIGGER_EDGE_BEFORE &&
((fabsf (point->press_y - point->last_motion_y) > threshold_y) ||
(fabsf (point->press_x - point->last_motion_x) > threshold_x)))
{
cancel_gesture (gesture_action);
cancel_gesture (action);
return CLUTTER_EVENT_PROPAGATE;
}
break;
@@ -482,10 +456,10 @@ clutter_gesture_action_handle_event (ClutterAction *action,
((priv->points->len - 1) < priv->requested_nb_points))
{
priv->in_gesture = FALSE;
g_signal_emit (gesture_action, gesture_signals[GESTURE_END], 0, actor);
g_signal_emit (action, gesture_signals[GESTURE_END], 0, actor);
}
gesture_unregister_point (gesture_action, position);
gesture_unregister_point (action, position);
}
break;
@@ -496,10 +470,10 @@ clutter_gesture_action_handle_event (ClutterAction *action,
if (priv->in_gesture)
{
priv->in_gesture = FALSE;
cancel_gesture (gesture_action);
cancel_gesture (action);
}
gesture_unregister_point (gesture_action, position);
gesture_unregister_point (action, position);
}
break;
@@ -507,9 +481,85 @@ clutter_gesture_action_handle_event (ClutterAction *action,
break;
}
return priv->in_gesture ?
CLUTTER_EVENT_STOP :
CLUTTER_EVENT_PROPAGATE;
if (priv->points->len == 0)
g_clear_signal_handler (&priv->stage_capture_id, priv->stage);
return CLUTTER_EVENT_PROPAGATE;
}
static gboolean
actor_captured_event_cb (ClutterActor *actor,
ClutterEvent *event,
ClutterGestureAction *action)
{
ClutterGestureActionPrivate *priv =
clutter_gesture_action_get_instance_private (action);
GesturePoint *point G_GNUC_UNUSED;
if ((clutter_event_type (event) != CLUTTER_BUTTON_PRESS) &&
(clutter_event_type (event) != CLUTTER_TOUCH_BEGIN))
return CLUTTER_EVENT_PROPAGATE;
if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (action)))
return CLUTTER_EVENT_PROPAGATE;
point = gesture_register_point (action, event);
if (priv->stage == NULL)
priv->stage = clutter_actor_get_stage (actor);
if (priv->stage_capture_id == 0)
priv->stage_capture_id =
g_signal_connect_after (priv->stage, "captured-event",
G_CALLBACK (stage_captured_event_cb),
action);
/* Start the gesture immediately if the gesture has no
* _TRIGGER_EDGE_AFTER drag threshold. */
if ((priv->points->len >= priv->requested_nb_points) &&
(priv->edge != CLUTTER_GESTURE_TRIGGER_EDGE_AFTER))
begin_gesture (action, actor);
return CLUTTER_EVENT_PROPAGATE;
}
static void
clutter_gesture_action_set_actor (ClutterActorMeta *meta,
ClutterActor *actor)
{
ClutterGestureActionPrivate *priv =
clutter_gesture_action_get_instance_private (CLUTTER_GESTURE_ACTION (meta));
ClutterActorMetaClass *meta_class =
CLUTTER_ACTOR_META_CLASS (clutter_gesture_action_parent_class);
if (priv->actor_capture_id != 0)
{
ClutterActor *old_actor = clutter_actor_meta_get_actor (meta);
if (old_actor != NULL)
g_clear_signal_handler (&priv->actor_capture_id, old_actor);
priv->actor_capture_id = 0;
}
if (priv->stage_capture_id != 0)
{
if (priv->stage != NULL)
g_clear_signal_handler (&priv->stage_capture_id, priv->stage);
priv->stage_capture_id = 0;
priv->stage = NULL;
}
if (actor != NULL)
{
priv->actor_capture_id =
g_signal_connect (actor, "captured-event",
G_CALLBACK (actor_captured_event_cb),
meta);
}
meta_class->set_actor (meta, actor);
}
static void
@@ -633,16 +683,14 @@ clutter_gesture_action_class_init (ClutterGestureActionClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
ClutterActionClass *action_class = CLUTTER_ACTION_CLASS (klass);
gobject_class->finalize = clutter_gesture_action_finalize;
gobject_class->set_property = clutter_gesture_action_set_property;
gobject_class->get_property = clutter_gesture_action_get_property;
meta_class->set_actor = clutter_gesture_action_set_actor;
meta_class->set_enabled = clutter_gesture_action_set_enabled;
action_class->handle_event = clutter_gesture_action_handle_event;
klass->gesture_begin = default_event_handler;
klass->gesture_progress = default_event_handler;
klass->gesture_prepare = default_event_handler;

View File

@@ -1,51 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2021 Red Hat Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Carlos Garnacho <carlosg@gnome.org>
*/
#ifndef CLUTTER_GRAB_H
#define CLUTTER_GRAB_H
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#include <glib-object.h>
#define CLUTTER_TYPE_GRAB (clutter_grab_get_type ())
typedef struct _ClutterGrab ClutterGrab;
CLUTTER_EXPORT
GType clutter_grab_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
void clutter_grab_dismiss (ClutterGrab *grab);
CLUTTER_EXPORT
ClutterGrabState clutter_grab_get_seat_state (ClutterGrab *grab);
CLUTTER_EXPORT
ClutterGrab * clutter_grab_ref (ClutterGrab *grab);
CLUTTER_EXPORT
void clutter_grab_unref (ClutterGrab *grab);
#endif /* CLUTTER_GRAB_H */

View File

@@ -53,6 +53,22 @@ struct _ClutterInputDevice
{
GObject parent_instance;
/* the actor that has a grab in place for the device */
ClutterActor *pointer_grab_actor;
ClutterActor *keyboard_grab_actor;
GHashTable *sequence_grab_actors;
GHashTable *inv_sequence_grab_actors;
/* the current click count */
int click_count;
int current_button_number;
/* the previous state, used for click count generation */
int previous_x;
int previous_y;
uint32_t previous_time;
int previous_button_number;
/* Accessiblity */
ClutterVirtualInputDevice *accessibility_virtual_device;
ClutterPtrA11yData *ptr_a11y_data;

View File

@@ -56,7 +56,6 @@ enum
PROP_NAME,
PROP_DEVICE_TYPE,
PROP_CAPABILITIES,
PROP_SEAT,
PROP_DEVICE_MODE,
@@ -81,7 +80,6 @@ typedef struct _ClutterInputDevicePrivate ClutterInputDevicePrivate;
struct _ClutterInputDevicePrivate
{
ClutterInputDeviceType device_type;
ClutterInputCapabilities capabilities;
ClutterInputMode device_mode;
char *device_name;
@@ -104,53 +102,6 @@ struct _ClutterInputDevicePrivate
G_DEFINE_TYPE_WITH_PRIVATE (ClutterInputDevice, clutter_input_device, G_TYPE_OBJECT);
static void
clutter_input_device_constructed (GObject *gobject)
{
ClutterInputDevice *device = CLUTTER_INPUT_DEVICE (gobject);
ClutterInputDevicePrivate *priv =
clutter_input_device_get_instance_private (device);
if (priv->capabilities == 0)
{
ClutterInputCapabilities capabilities = 0;
switch (priv->device_type)
{
case CLUTTER_POINTER_DEVICE:
capabilities = CLUTTER_INPUT_CAPABILITY_POINTER;
break;
case CLUTTER_KEYBOARD_DEVICE:
capabilities = CLUTTER_INPUT_CAPABILITY_KEYBOARD;
break;
case CLUTTER_TOUCHPAD_DEVICE:
capabilities = CLUTTER_INPUT_CAPABILITY_POINTER |
CLUTTER_INPUT_CAPABILITY_TOUCHPAD;
break;
case CLUTTER_TOUCHSCREEN_DEVICE:
capabilities = CLUTTER_INPUT_CAPABILITY_TOUCH;
break;
case CLUTTER_TABLET_DEVICE:
case CLUTTER_PEN_DEVICE:
case CLUTTER_ERASER_DEVICE:
case CLUTTER_CURSOR_DEVICE:
capabilities = CLUTTER_INPUT_CAPABILITY_TABLET_TOOL;
break;
case CLUTTER_PAD_DEVICE:
capabilities = CLUTTER_INPUT_CAPABILITY_TABLET_PAD;
break;
case CLUTTER_EXTENSION_DEVICE:
case CLUTTER_JOYSTICK_DEVICE:
break;
case CLUTTER_N_DEVICE_TYPES:
g_assert_not_reached ();
break;
}
priv->capabilities = capabilities;
}
}
static void
clutter_input_device_dispose (GObject *gobject)
{
@@ -185,10 +136,6 @@ clutter_input_device_set_property (GObject *gobject,
priv->device_type = g_value_get_enum (value);
break;
case PROP_CAPABILITIES:
priv->capabilities = g_value_get_flags (value);
break;
case PROP_SEAT:
priv->seat = g_value_get_object (value);
break;
@@ -259,10 +206,6 @@ clutter_input_device_get_property (GObject *gobject,
g_value_set_enum (value, priv->device_type);
break;
case PROP_CAPABILITIES:
g_value_set_flags (value, priv->capabilities);
break;
case PROP_SEAT:
g_value_set_object (value, priv->seat);
break;
@@ -353,19 +296,6 @@ clutter_input_device_class_init (ClutterInputDeviceClass *klass)
CLUTTER_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY);
/**
* ClutterInputDevice:capabilities:
*
* The capabilities of the device
*/
obj_props[PROP_CAPABILITIES] =
g_param_spec_flags ("capabilities",
P_("Capabilities"),
P_("The capabilities of the device"),
CLUTTER_TYPE_INPUT_CAPABILITIES, 0,
CLUTTER_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY);
/**
* ClutterInputDevice:seat:
*
@@ -484,7 +414,6 @@ clutter_input_device_class_init (ClutterInputDeviceClass *klass)
NULL,
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
gobject_class->constructed = clutter_input_device_constructed;
gobject_class->dispose = clutter_input_device_dispose;
gobject_class->set_property = clutter_input_device_set_property;
gobject_class->get_property = clutter_input_device_get_property;
@@ -498,6 +427,13 @@ clutter_input_device_init (ClutterInputDevice *self)
clutter_input_device_get_instance_private (self);
priv->device_type = CLUTTER_POINTER_DEVICE;
self->click_count = 0;
self->previous_time = CLUTTER_CURRENT_TIME;
self->previous_x = -1;
self->previous_y = -1;
self->current_button_number = self->previous_button_number = -1;
}
/**
@@ -522,25 +458,6 @@ clutter_input_device_get_device_type (ClutterInputDevice *device)
return priv->device_type;
}
/**
* clutter_input_device_get_capabilities:
* @device: a #ClutterInputDevice
*
* Retrieves the capabilities of @device
*
* Return value: the capabilities of the device
*/
ClutterInputCapabilities
clutter_input_device_get_capabilities (ClutterInputDevice *device)
{
ClutterInputDevicePrivate *priv =
clutter_input_device_get_instance_private (device);
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), 0);
return priv->capabilities;
}
/**
* clutter_input_device_get_device_name:
* @device: a #ClutterInputDevice
@@ -608,6 +525,303 @@ clutter_input_device_get_device_mode (ClutterInputDevice *device)
return priv->device_mode;
}
static void
on_grab_actor_destroy (ClutterActor *actor,
ClutterInputDevice *device)
{
ClutterInputDevicePrivate *priv =
clutter_input_device_get_instance_private (device);
switch (priv->device_type)
{
case CLUTTER_POINTER_DEVICE:
case CLUTTER_TABLET_DEVICE:
device->pointer_grab_actor = NULL;
break;
case CLUTTER_KEYBOARD_DEVICE:
device->keyboard_grab_actor = NULL;
break;
default:
g_assert_not_reached ();
}
}
/**
* clutter_input_device_grab:
* @device: a #ClutterInputDevice
* @actor: a #ClutterActor
*
* Acquires a grab on @actor for the given @device.
*
* Any event coming from @device will be delivered to @actor, bypassing
* the usual event delivery mechanism, until the grab is released by
* calling clutter_input_device_ungrab().
*
* The grab is client-side: even if the windowing system used by the Clutter
* backend has the concept of "device grabs", Clutter will not use them.
*
* Only #ClutterInputDevice of types %CLUTTER_POINTER_DEVICE,
* %CLUTTER_TABLET_DEVICE and %CLUTTER_KEYBOARD_DEVICE can hold a grab.
*
* Since: 1.10
*/
void
clutter_input_device_grab (ClutterInputDevice *device,
ClutterActor *actor)
{
ClutterActor **grab_actor;
ClutterInputDevicePrivate *priv =
clutter_input_device_get_instance_private (device);
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
switch (priv->device_type)
{
case CLUTTER_POINTER_DEVICE:
case CLUTTER_TABLET_DEVICE:
grab_actor = &device->pointer_grab_actor;
break;
case CLUTTER_KEYBOARD_DEVICE:
grab_actor = &device->keyboard_grab_actor;
break;
default:
g_critical ("Only pointer and keyboard devices can grab an actor");
return;
}
if (*grab_actor != NULL)
{
g_signal_handlers_disconnect_by_func (*grab_actor,
G_CALLBACK (on_grab_actor_destroy),
device);
}
*grab_actor = actor;
g_signal_connect (*grab_actor,
"destroy",
G_CALLBACK (on_grab_actor_destroy),
device);
}
/**
* clutter_input_device_ungrab:
* @device: a #ClutterInputDevice
*
* Releases the grab on the @device, if one is in place.
*
* Since: 1.10
*/
void
clutter_input_device_ungrab (ClutterInputDevice *device)
{
ClutterActor **grab_actor;
ClutterInputDevicePrivate *priv =
clutter_input_device_get_instance_private (device);
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
switch (priv->device_type)
{
case CLUTTER_POINTER_DEVICE:
case CLUTTER_TABLET_DEVICE:
grab_actor = &device->pointer_grab_actor;
break;
case CLUTTER_KEYBOARD_DEVICE:
grab_actor = &device->keyboard_grab_actor;
break;
default:
return;
}
if (*grab_actor == NULL)
return;
g_signal_handlers_disconnect_by_func (*grab_actor,
G_CALLBACK (on_grab_actor_destroy),
device);
*grab_actor = NULL;
}
/**
* clutter_input_device_get_grabbed_actor:
* @device: a #ClutterInputDevice
*
* Retrieves a pointer to the #ClutterActor currently grabbing all
* the events coming from @device.
*
* Return value: (transfer none): a #ClutterActor, or %NULL
*
* Since: 1.10
*/
ClutterActor *
clutter_input_device_get_grabbed_actor (ClutterInputDevice *device)
{
ClutterInputDevicePrivate *priv =
clutter_input_device_get_instance_private (device);
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
switch (priv->device_type)
{
case CLUTTER_POINTER_DEVICE:
case CLUTTER_TABLET_DEVICE:
return device->pointer_grab_actor;
case CLUTTER_KEYBOARD_DEVICE:
return device->keyboard_grab_actor;
default:
g_critical ("Only pointer and keyboard devices can grab an actor");
}
return NULL;
}
static void
on_grab_sequence_actor_destroy (ClutterActor *actor,
ClutterInputDevice *device)
{
ClutterEventSequence *sequence =
g_hash_table_lookup (device->inv_sequence_grab_actors, actor);
if (sequence != NULL)
{
g_hash_table_remove (device->sequence_grab_actors, sequence);
g_hash_table_remove (device->inv_sequence_grab_actors, actor);
}
}
/**
* clutter_input_device_sequence_grab:
* @device: a #ClutterInputDevice
* @sequence: a #ClutterEventSequence
* @actor: a #ClutterActor
*
* Acquires a grab on @actor for the given @device and the given touch
* @sequence.
*
* Any touch event coming from @device and from @sequence will be
* delivered to @actor, bypassing the usual event delivery mechanism,
* until the grab is released by calling
* clutter_input_device_sequence_ungrab().
*
* The grab is client-side: even if the windowing system used by the Clutter
* backend has the concept of "device grabs", Clutter will not use them.
*
* Since: 1.12
*/
void
clutter_input_device_sequence_grab (ClutterInputDevice *device,
ClutterEventSequence *sequence,
ClutterActor *actor)
{
ClutterActor *grab_actor;
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
if (device->sequence_grab_actors == NULL)
{
grab_actor = NULL;
device->sequence_grab_actors = g_hash_table_new (NULL, NULL);
device->inv_sequence_grab_actors = g_hash_table_new (NULL, NULL);
}
else
{
grab_actor = g_hash_table_lookup (device->sequence_grab_actors, sequence);
}
if (grab_actor != NULL)
{
g_signal_handlers_disconnect_by_func (grab_actor,
G_CALLBACK (on_grab_sequence_actor_destroy),
device);
g_hash_table_remove (device->sequence_grab_actors, sequence);
g_hash_table_remove (device->inv_sequence_grab_actors, grab_actor);
}
g_hash_table_insert (device->sequence_grab_actors, sequence, actor);
g_hash_table_insert (device->inv_sequence_grab_actors, actor, sequence);
g_signal_connect (actor,
"destroy",
G_CALLBACK (on_grab_sequence_actor_destroy),
device);
}
/**
* clutter_input_device_sequence_ungrab:
* @device: a #ClutterInputDevice
* @sequence: a #ClutterEventSequence
*
* Releases the grab on the @device for the given @sequence, if one is
* in place.
*
* Since: 1.12
*/
void
clutter_input_device_sequence_ungrab (ClutterInputDevice *device,
ClutterEventSequence *sequence)
{
ClutterActor *grab_actor;
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
if (device->sequence_grab_actors == NULL)
return;
grab_actor = g_hash_table_lookup (device->sequence_grab_actors, sequence);
if (grab_actor == NULL)
return;
g_signal_handlers_disconnect_by_func (grab_actor,
G_CALLBACK (on_grab_sequence_actor_destroy),
device);
g_hash_table_remove (device->sequence_grab_actors, sequence);
g_hash_table_remove (device->inv_sequence_grab_actors, grab_actor);
if (g_hash_table_size (device->sequence_grab_actors) == 0)
{
g_hash_table_destroy (device->sequence_grab_actors);
device->sequence_grab_actors = NULL;
g_hash_table_destroy (device->inv_sequence_grab_actors);
device->inv_sequence_grab_actors = NULL;
}
}
/**
* clutter_input_device_sequence_get_grabbed_actor:
* @device: a #ClutterInputDevice
* @sequence: a #ClutterEventSequence
*
* Retrieves a pointer to the #ClutterActor currently grabbing the
* touch events coming from @device given the @sequence.
*
* Return value: (transfer none): a #ClutterActor, or %NULL
*
* Since: 1.12
*/
ClutterActor *
clutter_input_device_sequence_get_grabbed_actor (ClutterInputDevice *device,
ClutterEventSequence *sequence)
{
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
if (device->sequence_grab_actors == NULL)
return NULL;
return g_hash_table_lookup (device->sequence_grab_actors, sequence);
}
/**
* clutter_input_device_get_vendor_id:
* @device: a physical #ClutterInputDevice

View File

@@ -80,6 +80,25 @@ ClutterInputMode clutter_input_device_get_device_mode (ClutterInputDev
CLUTTER_EXPORT
gboolean clutter_input_device_get_has_cursor (ClutterInputDevice *device);
CLUTTER_EXPORT
void clutter_input_device_grab (ClutterInputDevice *device,
ClutterActor *actor);
CLUTTER_EXPORT
void clutter_input_device_ungrab (ClutterInputDevice *device);
CLUTTER_EXPORT
ClutterActor * clutter_input_device_get_grabbed_actor (ClutterInputDevice *device);
CLUTTER_EXPORT
void clutter_input_device_sequence_grab (ClutterInputDevice *device,
ClutterEventSequence *sequence,
ClutterActor *actor);
CLUTTER_EXPORT
void clutter_input_device_sequence_ungrab (ClutterInputDevice *device,
ClutterEventSequence *sequence);
CLUTTER_EXPORT
ClutterActor * clutter_input_device_sequence_get_grabbed_actor (ClutterInputDevice *device,
ClutterEventSequence *sequence);
CLUTTER_EXPORT
const gchar * clutter_input_device_get_vendor_id (ClutterInputDevice *device);
CLUTTER_EXPORT
@@ -121,9 +140,6 @@ int clutter_input_device_get_pad_feature_group (ClutterInputDevice *de
ClutterInputDevicePadFeature feature,
int n_feature);
CLUTTER_EXPORT
ClutterInputCapabilities clutter_input_device_get_capabilities (ClutterInputDevice *device);
G_END_DECLS
#endif /* __CLUTTER_INPUT_DEVICE_H__ */

View File

@@ -210,6 +210,14 @@ clutter_input_focus_filter_event (ClutterInputFocus *focus,
event->im.offset);
return TRUE;
}
else if (event->type == CLUTTER_TOUCH_BEGIN ||
(event->type == CLUTTER_BUTTON_PRESS &&
event->button.button == CLUTTER_BUTTON_PRIMARY))
{
clutter_input_focus_reset (focus);
/* pointing events are not consumed by IMs */
return FALSE;
}
return FALSE;
}

View File

@@ -42,10 +42,6 @@ void _clutter_input_pointer_a11y_on_button_event (ClutterInputDevice *device,
CLUTTER_EXPORT
gboolean _clutter_is_input_pointer_a11y_enabled (ClutterInputDevice *device);
CLUTTER_EXPORT
void clutter_input_pointer_a11y_update (ClutterInputDevice *device,
const ClutterEvent *event);
G_END_DECLS
#endif /* __CLUTTER_INPUT_POINTER_A11Y_H__ */

View File

@@ -25,13 +25,11 @@
#include "clutter-build-config.h"
#include "clutter-backend-private.h"
#include "clutter-enum-types.h"
#include "clutter-input-device.h"
#include "clutter-input-device-private.h"
#include "clutter-input-pointer-a11y-private.h"
#include "clutter-main.h"
#include "clutter-private.h"
#include "clutter-virtual-input-device.h"
static gboolean
@@ -728,41 +726,3 @@ _clutter_is_input_pointer_a11y_enabled (ClutterInputDevice *device)
return (is_secondary_click_enabled (device) || is_dwell_click_enabled (device));
}
void
clutter_input_pointer_a11y_update (ClutterInputDevice *device,
const ClutterEvent *event)
{
ClutterMainContext *clutter_context;
ClutterBackend *backend;
g_return_if_fail (clutter_event_get_device (event) == device);
if (!_clutter_is_input_pointer_a11y_enabled (device))
return;
if ((event->any.flags & CLUTTER_EVENT_FLAG_SYNTHETIC) != 0)
return;
clutter_context = _clutter_context_get_default ();
backend = clutter_context->backend;
if (!clutter_backend_is_display_server (backend))
return;
if (event->type == CLUTTER_MOTION)
{
float x, y;
clutter_event_get_coords (event, &x, &y);
_clutter_input_pointer_a11y_on_motion_event (device, x, y);
}
else if (event->type == CLUTTER_BUTTON_PRESS ||
event->type == CLUTTER_BUTTON_RELEASE)
{
_clutter_input_pointer_a11y_on_button_event (device,
event->button.button,
event->type == CLUTTER_BUTTON_PRESS);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -77,6 +77,37 @@ typedef enum
CLUTTER_DEBUG_PAINT_MAX_RENDER_TIME = 1 << 10,
} ClutterDrawDebugFlag;
/**
* CLUTTER_INIT_ERROR:
*
* #GError domain for #ClutterInitError
*/
#define CLUTTER_INIT_ERROR (clutter_init_error_quark ())
/**
* ClutterInitError:
* @CLUTTER_INIT_SUCCESS: Initialisation successful
* @CLUTTER_INIT_ERROR_UNKNOWN: Unknown error
* @CLUTTER_INIT_ERROR_THREADS: Thread initialisation failed
* @CLUTTER_INIT_ERROR_BACKEND: Backend initialisation failed
* @CLUTTER_INIT_ERROR_INTERNAL: Internal error
*
* Error conditions returned by clutter_init().
*
* Since: 0.2
*/
typedef enum
{
CLUTTER_INIT_SUCCESS = 1,
CLUTTER_INIT_ERROR_UNKNOWN = 0,
CLUTTER_INIT_ERROR_THREADS = -1,
CLUTTER_INIT_ERROR_BACKEND = -2,
CLUTTER_INIT_ERROR_INTERNAL = -3
} ClutterInitError;
CLUTTER_EXPORT
GQuark clutter_init_error_quark (void);
/**
* CLUTTER_PRIORITY_REDRAW:
*
@@ -90,6 +121,18 @@ typedef enum
*/
#define CLUTTER_PRIORITY_REDRAW (G_PRIORITY_HIGH_IDLE + 50)
/* Initialisation */
CLUTTER_EXPORT
void clutter_base_init (void);
CLUTTER_EXPORT
ClutterInitError clutter_init (int *argc,
char ***argv) G_GNUC_WARN_UNUSED_RESULT;
CLUTTER_EXPORT
GOptionGroup * clutter_get_option_group (void);
CLUTTER_EXPORT
GOptionGroup * clutter_get_option_group_without_init (void);
CLUTTER_EXPORT
void clutter_do_event (ClutterEvent *event);
@@ -137,6 +180,9 @@ PangoFontMap * clutter_get_font_map (void);
CLUTTER_EXPORT
ClutterTextDirection clutter_get_default_text_direction (void);
CLUTTER_EXPORT
guint clutter_get_default_frame_rate (void);
CLUTTER_EXPORT
void clutter_add_debug_flags (ClutterDebugFlag debug_flags,
ClutterDrawDebugFlag draw_flags,

View File

@@ -38,32 +38,6 @@
#include "clutter-stage-view-private.h"
#include "clutter.h"
typedef struct _ClutterMainContext ClutterContext;
typedef ClutterBackend * (* ClutterBackendConstructor) (gpointer user_data);
/**
* clutter_context_new: (skip)
*/
CLUTTER_EXPORT
ClutterContext * clutter_context_new (ClutterBackendConstructor backend_constructor,
gpointer user_data,
GError **error);
/**
* clutter_context_free: (skip)
*/
CLUTTER_EXPORT
void clutter_context_free (ClutterContext *clutter_context);
/**
* clutter_context_get_backend:
*
* Returns: (transfer none): The corresponding %ClutterBackend
*/
CLUTTER_EXPORT
ClutterBackend * clutter_context_get_backend (ClutterContext *clutter_context);
CLUTTER_EXPORT
GList * clutter_stage_peek_stage_views (ClutterStage *stage);
@@ -71,6 +45,9 @@ CLUTTER_EXPORT
gboolean clutter_actor_is_effectively_on_stage_view (ClutterActor *self,
ClutterStageView *view);
CLUTTER_EXPORT
void clutter_set_custom_backend_func (ClutterBackend *(* func) (void));
CLUTTER_EXPORT
int64_t clutter_stage_get_frame_counter (ClutterStage *stage);
@@ -108,7 +85,6 @@ void clutter_stage_update_device (ClutterStage *stage,
graphene_point_t point,
uint32_t time,
ClutterActor *new_actor,
cairo_region_t *region,
gboolean emit_crossing);
CLUTTER_EXPORT

View File

@@ -153,10 +153,9 @@ clutter_offscreen_effect_real_create_texture (ClutterOffscreenEffect *effect,
gfloat width,
gfloat height)
{
CoglContext *ctx =
clutter_backend_get_cogl_context (clutter_get_default_backend ());
return cogl_texture_2d_new_with_size (ctx, MAX (width, 1), MAX (height, 1));
return cogl_texture_new_with_size (MAX (width, 1), MAX (height, 1),
COGL_TEXTURE_NO_SLICING,
COGL_PIXEL_FORMAT_RGBA_8888_PRE);
}
static void

View File

@@ -27,7 +27,6 @@
#include <glib-object.h>
#include <json-glib/json-glib.h>
#include <clutter/clutter-backend.h>
#include <clutter/clutter-paint-context.h>
#include <clutter/clutter-paint-node.h>
@@ -110,7 +109,7 @@ void _clutter_paint_operation_paint_path (const C
void _clutter_paint_operation_clip_path (const ClutterPaintOperation *op);
void _clutter_paint_operation_paint_primitive (const ClutterPaintOperation *op);
void clutter_paint_node_init_types (ClutterBackend *clutter_backend);
void _clutter_paint_node_init_types (void);
gpointer _clutter_paint_node_create (GType gtype);
ClutterPaintNode * _clutter_transform_node_new (const graphene_matrix_t *matrix);

View File

@@ -51,30 +51,30 @@ static CoglPipeline *default_color_pipeline = NULL;
static CoglPipeline *default_texture_pipeline = NULL;
/*< private >
* clutter_paint_node_init_types:
* _clutter_paint_node_init_types:
*
* Initializes the required types for ClutterPaintNode subclasses
*/
void
clutter_paint_node_init_types (ClutterBackend *clutter_backend)
_clutter_paint_node_init_types (void)
{
CoglContext *cogl_context;
CoglContext *ctx;
CoglColor cogl_color;
GType node_type G_GNUC_UNUSED;
if (G_LIKELY (default_color_pipeline != NULL))
return;
cogl_context = clutter_backend_get_cogl_context (clutter_backend);
ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
node_type = clutter_paint_node_get_type ();
cogl_color_init_from_4f (&cogl_color, 1.0, 1.0, 1.0, 1.0);
default_color_pipeline = cogl_pipeline_new (cogl_context);
default_color_pipeline = cogl_pipeline_new (ctx);
cogl_pipeline_set_color (default_color_pipeline, &cogl_color);
default_texture_pipeline = cogl_pipeline_new (cogl_context);
default_texture_pipeline = cogl_pipeline_new (ctx);
cogl_pipeline_set_layer_null_texture (default_texture_pipeline, 0);
cogl_pipeline_set_color (default_texture_pipeline, &cogl_color);
cogl_pipeline_set_layer_wrap_mode (default_texture_pipeline, 0,
@@ -484,9 +484,9 @@ clutter_pipeline_node_draw (ClutterPaintNode *node,
break;
case PAINT_OP_PRIMITIVE:
cogl_primitive_draw (op->op.primitive,
fb,
pnode->pipeline);
cogl_framebuffer_draw_primitive (fb,
pnode->pipeline,
op->op.primitive);
break;
}
}
@@ -1467,9 +1467,9 @@ clutter_layer_node_post_draw (ClutterPaintNode *node,
break;
case PAINT_OP_PRIMITIVE:
cogl_primitive_draw (op->op.primitive,
fb,
lnode->pipeline);
cogl_framebuffer_draw_primitive (fb,
lnode->pipeline,
op->op.primitive);
break;
}
}

View File

@@ -348,6 +348,25 @@ gesture_end (ClutterGestureAction *gesture,
}
}
static gboolean
clutter_pan_action_real_pan (ClutterPanAction *self,
ClutterActor *actor,
gboolean is_interpolated)
{
gfloat dx, dy;
graphene_matrix_t transform;
graphene_matrix_t translate;
clutter_pan_action_get_constrained_motion_delta (self, 0, &dx, &dy);
clutter_actor_get_child_transform (actor, &transform);
graphene_matrix_init_translate (&translate,
&GRAPHENE_POINT3D_INIT (dx, dy, 0.0f));
graphene_matrix_multiply (&translate, &transform, &transform);
clutter_actor_set_child_transform (actor, &transform);
return TRUE;
}
static void
clutter_pan_action_set_property (GObject *gobject,
guint prop_id,
@@ -464,6 +483,8 @@ clutter_pan_action_class_init (ClutterPanActionClass *klass)
ClutterGestureActionClass *gesture_class =
CLUTTER_GESTURE_ACTION_CLASS (klass);
klass->pan = clutter_pan_action_real_pan;
gesture_class->gesture_prepare = gesture_prepare;
gesture_class->gesture_begin = gesture_begin;
gesture_class->gesture_progress = gesture_progress;
@@ -565,7 +586,8 @@ clutter_pan_action_class_init (ClutterPanActionClass *klass)
g_signal_new (I_("pan"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, g_signal_accumulator_true_handled, NULL,
G_STRUCT_OFFSET (ClutterPanActionClass, pan),
_clutter_boolean_continue_accumulator, NULL,
_clutter_marshal_BOOLEAN__OBJECT_BOOLEAN,
G_TYPE_BOOLEAN, 2,
CLUTTER_TYPE_ACTOR,

View File

@@ -84,6 +84,9 @@ struct _ClutterPanActionClass
ClutterGestureActionClass parent_class;
/*< public >*/
gboolean (* pan) (ClutterPanAction *action,
ClutterActor *actor,
gboolean is_interpolated);
void (* pan_stopped) (ClutterPanAction *action,
ClutterActor *actor);

View File

@@ -118,20 +118,6 @@ clutter_pick_context_log_pick (ClutterPickContext *pick_context,
clutter_pick_stack_log_pick (pick_context->pick_stack, box, actor);
}
/**
* clutter_pick_context_log_overlap:
* @pick_context: a #ClutterPickContext
* @actor: a #ClutterActor
*
* Logs an overlapping actor into the pick stack.
*/
void
clutter_pick_context_log_overlap (ClutterPickContext *pick_context,
ClutterActor *actor)
{
clutter_pick_stack_log_overlap (pick_context->pick_stack, actor);
}
/**
* clutter_pick_context_push_clip:
* @pick_context: a #ClutterPickContext

View File

@@ -50,9 +50,6 @@ CLUTTER_EXPORT
void clutter_pick_context_log_pick (ClutterPickContext *pick_context,
const ClutterActorBox *box,
ClutterActor *actor);
CLUTTER_EXPORT
void clutter_pick_context_log_overlap (ClutterPickContext *pick_context,
ClutterActor *actor);
CLUTTER_EXPORT
void clutter_pick_context_push_clip (ClutterPickContext *pick_context,

View File

@@ -42,8 +42,6 @@ void clutter_pick_stack_seal (ClutterPickStack *pick_stack);
void clutter_pick_stack_log_pick (ClutterPickStack *pick_stack,
const ClutterActorBox *box,
ClutterActor *actor);
void clutter_pick_stack_log_overlap (ClutterPickStack *pick_stack,
ClutterActor *actor);
void clutter_pick_stack_push_clip (ClutterPickStack *pick_stack,
const ClutterActorBox *box);
@@ -59,10 +57,9 @@ void clutter_pick_stack_get_transform (ClutterPickStack *pick_stack,
void clutter_pick_stack_pop_transform (ClutterPickStack *pick_stack);
ClutterActor *
clutter_pick_stack_search_actor (ClutterPickStack *pick_stack,
const graphene_point3d_t *point,
const graphene_ray_t *ray,
cairo_region_t **clear_area);
clutter_pick_stack_search_actor (ClutterPickStack *pick_stack,
const graphene_point3d_t *point,
const graphene_ray_t *ray);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPickStack, clutter_pick_stack_unref)

View File

@@ -32,7 +32,6 @@ typedef struct
Record base;
ClutterActor *actor;
int clip_index;
gboolean is_overlap;
} PickRecord;
typedef struct
@@ -343,10 +342,9 @@ clutter_pick_stack_log_pick (ClutterPickStack *pick_stack,
g_assert (!pick_stack->sealed);
rec.is_overlap = FALSE;
rec.actor = actor;
rec.clip_index = pick_stack->current_clip_stack_top;
rec.base.rect = *box;
rec.base.rect = *box;
rec.base.projected = FALSE;
rec.base.matrix_entry = cogl_matrix_stack_get_entry (pick_stack->matrix_stack);
cogl_matrix_entry_ref (rec.base.matrix_entry);
@@ -354,21 +352,6 @@ clutter_pick_stack_log_pick (ClutterPickStack *pick_stack,
g_array_append_val (pick_stack->vertices_stack, rec);
}
void
clutter_pick_stack_log_overlap (ClutterPickStack *pick_stack,
ClutterActor *actor)
{
PickRecord rec = { 0 };
g_assert (!pick_stack->sealed);
rec.is_overlap = TRUE;
rec.actor = actor;
rec.clip_index = pick_stack->current_clip_stack_top;
g_array_append_val (pick_stack->vertices_stack, rec);
}
void
clutter_pick_stack_push_clip (ClutterPickStack *pick_stack,
const ClutterActorBox *box)
@@ -429,91 +412,10 @@ clutter_pick_stack_pop_transform (ClutterPickStack *pick_stack)
cogl_matrix_stack_pop (pick_stack->matrix_stack);
}
static gboolean
get_verts_rectangle (graphene_point3d_t verts[4],
cairo_rectangle_int_t *rect)
{
if (verts[0].x != verts[2].x ||
verts[0].y != verts[1].y ||
verts[3].x != verts[1].x ||
verts[3].y != verts[2].y ||
verts[0].x > verts[3].x ||
verts[0].y > verts[3].y)
return FALSE;
*rect = (cairo_rectangle_int_t) {
.x = ceilf (verts[0].x),
.y = ceilf (verts[0].y),
.width = floor (verts[1].x - ceilf (verts[0].x)),
.height = floor (verts[2].y - ceilf (verts[0].y)),
};
return TRUE;
}
static void
calculate_clear_area (ClutterPickStack *pick_stack,
PickRecord *pick_rec,
int elem,
cairo_region_t **clear_area)
{
cairo_region_t *area = NULL;
graphene_point3d_t verts[4];
cairo_rectangle_int_t rect;
int i;
clutter_actor_get_abs_allocation_vertices (pick_rec->actor,
(graphene_point3d_t *) &verts);
if (!get_verts_rectangle (verts, &rect))
{
if (clear_area)
*clear_area = NULL;
return;
}
rect.x += ceil (pick_rec->base.rect.x1);
rect.y += ceil (pick_rec->base.rect.y1);
rect.width =
MIN (rect.width, floor (pick_rec->base.rect.x2 - pick_rec->base.rect.x1));
rect.height =
MIN (rect.height, floor (pick_rec->base.rect.y2 - pick_rec->base.rect.y1));
area = cairo_region_create_rectangle (&rect);
for (i = elem + 1; i < pick_stack->vertices_stack->len; i++)
{
PickRecord *rec =
&g_array_index (pick_stack->vertices_stack, PickRecord, i);
ClutterActorBox paint_box;
if (!rec->is_overlap &&
(rec->base.rect.x1 == rec->base.rect.x2 ||
rec->base.rect.y1 == rec->base.rect.y2))
continue;
if (!clutter_actor_get_paint_box (rec->actor, &paint_box))
continue;
cairo_region_subtract_rectangle (area,
&(cairo_rectangle_int_t) {
.x = paint_box.x1,
.y = paint_box.y1,
.width = paint_box.x2 - paint_box.x1,
.height = paint_box.y2 - paint_box.y1,
});
}
if (clear_area)
*clear_area = g_steal_pointer (&area);
g_clear_pointer (&area, cairo_region_destroy);
}
ClutterActor *
clutter_pick_stack_search_actor (ClutterPickStack *pick_stack,
const graphene_point3d_t *point,
const graphene_ray_t *ray,
cairo_region_t **clear_area)
clutter_pick_stack_search_actor (ClutterPickStack *pick_stack,
const graphene_point3d_t *point,
const graphene_ray_t *ray)
{
int i;
@@ -526,13 +428,8 @@ clutter_pick_stack_search_actor (ClutterPickStack *pick_stack,
PickRecord *rec =
&g_array_index (pick_stack->vertices_stack, PickRecord, i);
if (!rec->is_overlap && rec->actor &&
ray_intersects_record (pick_stack, rec, point, ray))
{
if (clear_area)
calculate_clear_area (pick_stack, rec, i, clear_area);
return rec->actor;
}
if (rec->actor && ray_intersects_record (pick_stack, rec, point, ray))
return rec->actor;
}
return NULL;

View File

@@ -69,7 +69,6 @@ typedef struct _ClutterMainContext ClutterMainContext;
#define CLUTTER_ACTOR_IN_PREF_WIDTH(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PREF_WIDTH) != FALSE)
#define CLUTTER_ACTOR_IN_PREF_HEIGHT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PREF_HEIGHT) != FALSE)
#define CLUTTER_ACTOR_IN_PREF_SIZE(a) ((CLUTTER_PRIVATE_FLAGS (a) & (CLUTTER_IN_PREF_HEIGHT|CLUTTER_IN_PREF_WIDTH)) != FALSE)
#define CLUTTER_ACTOR_IN_MAP_UNMAP(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_MAP_UNMAP) != FALSE)
#define CLUTTER_PARAM_READABLE (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)
#define CLUTTER_PARAM_WRITABLE (G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS)
@@ -106,8 +105,6 @@ typedef enum
/* Used to avoid recursion */
CLUTTER_IN_RELAYOUT = 1 << 7,
CLUTTER_IN_MAP_UNMAP = 1 << 8,
} ClutterPrivateFlags;
/*
@@ -130,6 +127,17 @@ struct _ClutterMainContext
* ordered from least recently added to most recently added */
GList *event_filters;
/* default FPS; this is only used if we cannot sync to vblank */
guint frame_rate;
/* fb bit masks for col<->id mapping in picking */
gint fb_r_mask;
gint fb_g_mask;
gint fb_b_mask;
gint fb_r_mask_used;
gint fb_g_mask_used;
gint fb_b_mask_used;
CoglPangoFontMap *font_map; /* Global font map */
/* stack of #ClutterEvent */
@@ -146,6 +154,8 @@ struct _ClutterMainContext
/* boolean flags */
guint is_initialized : 1;
guint defer_display_setup : 1;
guint options_parsed : 1;
guint show_fps : 1;
};
@@ -167,8 +177,7 @@ CLUTTER_EXPORT
gboolean _clutter_context_is_initialized (void);
gboolean _clutter_context_get_show_fps (void);
gboolean clutter_feature_init (ClutterMainContext *clutter_context,
GError **error);
gboolean _clutter_feature_init (GError **error);
/* Diagnostic mode */
gboolean _clutter_diagnostic_enabled (void);

View File

@@ -63,6 +63,18 @@ static guint rotate_signals[LAST_SIGNAL] = { 0, };
G_DEFINE_TYPE_WITH_PRIVATE (ClutterRotateAction, clutter_rotate_action, CLUTTER_TYPE_GESTURE_ACTION)
static gboolean
clutter_rotate_action_real_rotate (ClutterRotateAction *action,
ClutterActor *actor,
gdouble angle)
{
clutter_actor_set_rotation_angle (actor,
CLUTTER_Z_AXIS,
action->priv->initial_rotation + angle);
return TRUE;
}
static gboolean
clutter_rotate_action_gesture_begin (ClutterGestureAction *action,
ClutterActor *actor)
@@ -175,6 +187,8 @@ clutter_rotate_action_class_init (ClutterRotateActionClass *klass)
GObjectClass *object_class =
G_OBJECT_CLASS (klass);
klass->rotate = clutter_rotate_action_real_rotate;
object_class->constructed = clutter_rotate_action_constructed;
gesture_class->gesture_begin = clutter_rotate_action_gesture_begin;
@@ -201,7 +215,8 @@ clutter_rotate_action_class_init (ClutterRotateActionClass *klass)
g_signal_new (I_("rotate"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, g_signal_accumulator_true_handled, NULL,
G_STRUCT_OFFSET (ClutterRotateActionClass, rotate),
_clutter_boolean_continue_accumulator, NULL,
_clutter_marshal_BOOLEAN__OBJECT_DOUBLE,
G_TYPE_BOOLEAN, 2,
CLUTTER_TYPE_ACTOR,

View File

@@ -74,6 +74,12 @@ struct _ClutterRotateActionClass
/*< private >*/
ClutterGestureActionClass parent_class;
/*< public >*/
gboolean (* rotate) (ClutterRotateAction *action,
ClutterActor *actor,
gdouble angle);
/*< private >*/
void (* _clutter_rotate_action1) (void);
void (* _clutter_rotate_action2) (void);
void (* _clutter_rotate_action3) (void);

View File

@@ -28,9 +28,4 @@
CLUTTER_EXPORT
void clutter_seat_destroy (ClutterSeat *seat);
ClutterGrabState clutter_seat_grab (ClutterSeat *seat,
uint32_t time);
void clutter_seat_ungrab (ClutterSeat *seat,
uint32_t time);
#endif /* CLUTTER_SEAT_PRIVATE_H */

View File

@@ -705,27 +705,3 @@ clutter_seat_destroy (ClutterSeat *seat)
g_object_run_dispose (G_OBJECT (seat));
g_object_unref (seat);
}
ClutterGrabState
clutter_seat_grab (ClutterSeat *seat,
uint32_t time)
{
ClutterSeatClass *seat_class;
seat_class = CLUTTER_SEAT_GET_CLASS (seat);
if (seat_class->grab)
return seat_class->grab (seat, time);
else
return CLUTTER_GRAB_STATE_ALL;
}
void
clutter_seat_ungrab (ClutterSeat *seat,
uint32_t time)
{
ClutterSeatClass *seat_class;
seat_class = CLUTTER_SEAT_GET_CLASS (seat);
if (seat_class->ungrab)
return seat_class->ungrab (seat, time);
}

View File

@@ -29,6 +29,7 @@
#include "clutter/clutter-types.h"
#include "clutter/clutter-keymap.h"
#include "clutter/clutter-virtual-input-device.h"
#define CLUTTER_TYPE_SEAT (clutter_seat_get_type ())
@@ -96,11 +97,6 @@ struct _ClutterSeatClass
graphene_point_t *coords,
ClutterModifierType *modifiers);
ClutterGrabState (* grab) (ClutterSeat *seat,
uint32_t time);
void (* ungrab) (ClutterSeat *seat,
uint32_t time);
/* Virtual devices */
ClutterVirtualInputDevice * (* create_virtual_device) (ClutterSeat *seat,
ClutterInputDeviceType device_type);

View File

@@ -22,7 +22,6 @@
#ifndef __CLUTTER_STAGE_PRIVATE_H__
#define __CLUTTER_STAGE_PRIVATE_H__
#include <clutter/clutter-grab.h>
#include <clutter/clutter-stage-window.h>
#include <clutter/clutter-stage.h>
#include <clutter/clutter-input-device.h>
@@ -32,13 +31,6 @@
G_BEGIN_DECLS
typedef enum
{
CLUTTER_DEVICE_UPDATE_NONE = 0,
CLUTTER_DEVICE_UPDATE_EMIT_CROSSING = 1 << 0,
CLUTTER_DEVICE_UPDATE_IGNORE_CACHE = 1 << 1,
} ClutterDeviceUpdateFlags;
/* stage */
ClutterStageWindow *_clutter_stage_get_default_window (void);
@@ -49,8 +41,6 @@ void clutter_stage_paint_view (ClutterStage
void clutter_stage_emit_before_update (ClutterStage *stage,
ClutterStageView *view);
void clutter_stage_emit_prepare_frame (ClutterStage *stage,
ClutterStageView *view);
void clutter_stage_emit_before_paint (ClutterStage *stage,
ClutterStageView *view);
void clutter_stage_emit_after_paint (ClutterStage *stage,
@@ -77,8 +67,7 @@ void _clutter_stage_maybe_setup_viewport (ClutterStage
ClutterStageView *view);
void clutter_stage_maybe_relayout (ClutterActor *stage);
void clutter_stage_maybe_finish_queue_redraws (ClutterStage *stage);
GSList * clutter_stage_find_updated_devices (ClutterStage *stage,
ClutterStageView *view);
GSList * clutter_stage_find_updated_devices (ClutterStage *stage);
void clutter_stage_update_devices (ClutterStage *stage,
GSList *devices);
void clutter_stage_finish_layout (ClutterStage *stage);
@@ -92,6 +81,11 @@ void _clutter_stage_process_queued_events (ClutterStage *stage);
void _clutter_stage_update_input_devices (ClutterStage *stage);
gboolean _clutter_stage_has_full_redraw_queued (ClutterStage *stage);
ClutterActor *_clutter_stage_do_pick (ClutterStage *stage,
float x,
float y,
ClutterPickMode mode);
ClutterPaintVolume *_clutter_stage_paint_volume_stack_allocate (ClutterStage *stage);
void _clutter_stage_paint_volume_stack_free_all (ClutterStage *stage);
@@ -140,24 +134,11 @@ void clutter_stage_update_device_entry (ClutterStage *self,
ClutterInputDevice *device,
ClutterEventSequence *sequence,
graphene_point_t coords,
ClutterActor *actor,
cairo_region_t *clear_area);
ClutterActor *actor);
void clutter_stage_remove_device_entry (ClutterStage *self,
ClutterInputDevice *device,
ClutterEventSequence *sequence);
ClutterActor * clutter_stage_pick_and_update_device (ClutterStage *stage,
ClutterInputDevice *device,
ClutterEventSequence *sequence,
ClutterDeviceUpdateFlags flags,
graphene_point_t point,
uint32_t time_ms);
void clutter_stage_unlink_grab (ClutterStage *self,
ClutterGrab *grab);
void clutter_stage_invalidate_focus (ClutterStage *self,
ClutterActor *actor);
G_END_DECLS

View File

@@ -79,6 +79,4 @@ void clutter_stage_view_notify_presented (ClutterStageView *view,
CLUTTER_EXPORT
void clutter_stage_view_notify_ready (ClutterStageView *view);
void clutter_stage_view_invalidate_input_devices (ClutterStageView *view);
#endif /* __CLUTTER_STAGE_VIEW_PRIVATE_H__ */

View File

@@ -93,7 +93,6 @@ typedef struct _ClutterStageViewPrivate
guint dirty_viewport : 1;
guint dirty_projection : 1;
guint needs_update_devices : 1;
} ClutterStageViewPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (ClutterStageView, clutter_stage_view, G_TYPE_OBJECT)
@@ -1147,6 +1146,7 @@ end_frame_timing_measurement (ClutterStageView *view)
static ClutterFrameResult
handle_frame_clock_frame (ClutterFrameClock *frame_clock,
int64_t frame_count,
int64_t time_us,
gpointer user_data)
{
ClutterStageView *view = user_data;
@@ -1177,13 +1177,11 @@ handle_frame_clock_frame (ClutterFrameClock *frame_clock,
clutter_stage_finish_layout (stage);
if (priv->needs_update_devices)
devices = clutter_stage_find_updated_devices (stage, view);
devices = clutter_stage_find_updated_devices (stage);
frame = CLUTTER_FRAME_INIT;
_clutter_stage_window_prepare_frame (stage_window, view, &frame);
clutter_stage_emit_prepare_frame (stage, view);
if (clutter_stage_view_has_redraw_clip (view))
{
@@ -1203,7 +1201,6 @@ handle_frame_clock_frame (ClutterFrameClock *frame_clock,
_clutter_stage_window_finish_frame (stage_window, view, &frame);
clutter_stage_update_devices (stage, devices);
priv->needs_update_devices = FALSE;
_clutter_run_repaint_functions (CLUTTER_REPAINT_FLAGS_POST_PAINT);
clutter_stage_emit_after_update (stage, view);
@@ -1526,12 +1523,3 @@ clutter_stage_view_class_init (ClutterStageViewClass *klass)
g_object_class_install_properties (object_class, PROP_LAST, obj_props);
}
void
clutter_stage_view_invalidate_input_devices (ClutterStageView *view)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
priv->needs_update_devices = TRUE;
}

View File

@@ -20,6 +20,25 @@ G_DEFINE_INTERFACE (ClutterStageWindow, clutter_stage_window, G_TYPE_OBJECT);
static void
clutter_stage_window_default_init (ClutterStageWindowInterface *iface)
{
GParamSpec *pspec;
pspec = g_param_spec_object ("backend",
"Backend",
"Back pointer to the Backend instance",
CLUTTER_TYPE_BACKEND,
G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
g_object_interface_install_property (iface, pspec);
pspec = g_param_spec_object ("wrapper",
"Wrapper",
"Back pointer to the Stage actor",
CLUTTER_TYPE_STAGE,
G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
g_object_interface_install_property (iface, pspec);
}
/**

File diff suppressed because it is too large Load Diff

View File

@@ -29,7 +29,6 @@
#endif
#include <clutter/clutter-actor.h>
#include <clutter/clutter-grab.h>
#include <clutter/clutter-types.h>
#include <clutter/clutter-stage-view.h>
@@ -183,11 +182,30 @@ CLUTTER_EXPORT
void clutter_stage_get_minimum_size (ClutterStage *stage,
guint *width,
guint *height);
CLUTTER_EXPORT
void clutter_stage_set_use_alpha (ClutterStage *stage,
gboolean use_alpha);
CLUTTER_EXPORT
gboolean clutter_stage_get_use_alpha (ClutterStage *stage);
CLUTTER_EXPORT
void clutter_stage_set_key_focus (ClutterStage *stage,
ClutterActor *actor);
CLUTTER_EXPORT
ClutterActor * clutter_stage_get_key_focus (ClutterStage *stage);
CLUTTER_EXPORT
void clutter_stage_set_throttle_motion_events (ClutterStage *stage,
gboolean throttle);
CLUTTER_EXPORT
gboolean clutter_stage_get_throttle_motion_events (ClutterStage *stage);
CLUTTER_EXPORT
void clutter_stage_set_motion_events_enabled (ClutterStage *stage,
gboolean enabled);
CLUTTER_EXPORT
gboolean clutter_stage_get_motion_events_enabled (ClutterStage *stage);
CLUTTER_EXPORT
gboolean clutter_stage_event (ClutterStage *stage,
ClutterEvent *event);
CLUTTER_EXPORT
ClutterActor * clutter_stage_get_actor_at_pos (ClutterStage *stage,
@@ -250,16 +268,6 @@ CLUTTER_EXPORT
ClutterActor * clutter_stage_get_device_actor (ClutterStage *stage,
ClutterInputDevice *device,
ClutterEventSequence *sequence);
CLUTTER_EXPORT
ClutterActor * clutter_stage_get_event_actor (ClutterStage *stage,
const ClutterEvent *event);
CLUTTER_EXPORT
ClutterGrab * clutter_stage_grab (ClutterStage *stage,
ClutterActor *actor);
CLUTTER_EXPORT
ClutterActor * clutter_stage_get_grab_actor (ClutterStage *stage);
G_END_DECLS

View File

@@ -172,6 +172,15 @@ gesture_end (ClutterGestureAction *action,
g_signal_emit (action, swipe_signals[SWEPT], 0, actor, direction);
}
/* XXX:2.0 remove */
static gboolean
clutter_swipe_action_real_swipe (ClutterSwipeAction *action,
ClutterActor *actor,
ClutterSwipeDirection direction)
{
return TRUE;
}
static void
clutter_swipe_action_constructed (GObject *object)
{
@@ -193,6 +202,9 @@ clutter_swipe_action_class_init (ClutterSwipeActionClass *klass)
gesture_class->gesture_progress = gesture_progress;
gesture_class->gesture_end = gesture_end;
/* XXX:2.0 remove */
klass->swipe = clutter_swipe_action_real_swipe;
/**
* ClutterSwipeAction::swept:
* @action: the #ClutterSwipeAction that emitted the signal
@@ -236,7 +248,8 @@ clutter_swipe_action_class_init (ClutterSwipeActionClass *klass)
g_signal_new (I_("swipe"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, g_signal_accumulator_true_handled, NULL,
G_STRUCT_OFFSET (ClutterSwipeActionClass, swipe),
_clutter_boolean_continue_accumulator, NULL,
_clutter_marshal_BOOLEAN__OBJECT_FLAGS,
G_TYPE_BOOLEAN, 2,
CLUTTER_TYPE_ACTOR,

View File

@@ -85,6 +85,10 @@ struct _ClutterSwipeActionClass
ClutterActor *actor,
ClutterSwipeDirection direction);
gboolean (* swipe) (ClutterSwipeAction *action,
ClutterActor *actor,
ClutterSwipeDirection direction);
/*< private >*/
void (* _clutter_swipe_action1) (void);
void (* _clutter_swipe_action2) (void);

View File

@@ -187,13 +187,6 @@ struct _ClutterTextPrivate
ClutterInputContentHintFlags input_hints;
ClutterInputContentPurpose input_purpose;
ClutterGrab *grab;
float last_click_x;
float last_click_y;
uint32_t last_click_time_ms;
int click_count;
/* bitfields */
guint alignment : 2;
guint wrap : 1;
@@ -356,16 +349,10 @@ clutter_text_input_focus_delete_surrounding (ClutterInputFocus *focus,
guint len)
{
ClutterText *clutter_text = CLUTTER_TEXT_INPUT_FOCUS (focus)->text;
ClutterTextBuffer *buffer;
int cursor;
int start;
buffer = get_buffer (clutter_text);
cursor = clutter_text_get_cursor_position (clutter_text);
if (cursor < 0)
cursor = clutter_text_buffer_get_length (buffer);
start = cursor + offset;
if (start < 0)
{
@@ -374,9 +361,7 @@ clutter_text_input_focus_delete_surrounding (ClutterInputFocus *focus,
return;
}
if (clutter_text_get_editable (clutter_text))
clutter_text_delete_text (clutter_text, start, start + len);
clutter_text_input_focus_request_surrounding (focus);
clutter_text_delete_text (clutter_text, start, len);
}
static void
@@ -391,7 +376,6 @@ clutter_text_input_focus_commit_text (ClutterInputFocus *focus,
clutter_text_insert_text (clutter_text, text,
clutter_text_get_cursor_position (clutter_text));
clutter_text_set_preedit_string (clutter_text, NULL, NULL, 0);
clutter_text_input_focus_request_surrounding (focus);
}
}
@@ -1339,7 +1323,6 @@ update_cursor_location (ClutterText *self)
clutter_actor_get_transformed_position (CLUTTER_ACTOR (self), &x, &y);
graphene_rect_offset (&rect, x, y);
clutter_input_focus_set_cursor_location (priv->input_focus, &rect);
clutter_text_input_focus_request_surrounding (priv->input_focus);
}
static inline void
@@ -2180,39 +2163,6 @@ clutter_text_select_line (ClutterText *self)
clutter_text_set_selection (self, start_pos, end_pos);
}
static int
clutter_text_update_click_count (ClutterText *self,
const ClutterEvent *event)
{
ClutterTextPrivate *priv = self->priv;
ClutterSettings *settings;
int double_click_time, double_click_distance;
uint32_t evtime;
float x, y;
settings = clutter_settings_get_default ();
clutter_event_get_coords (event, &x, &y);
evtime = clutter_event_get_time (event);
g_object_get (settings,
"double-click-distance", &double_click_distance,
"double-click-time", &double_click_time,
NULL);
if (evtime > (priv->last_click_time_ms + double_click_time) ||
(ABS (x - priv->last_click_x) > double_click_distance) ||
(ABS (y - priv->last_click_y) > double_click_distance))
priv->click_count = 0;
priv->last_click_time_ms = evtime;
priv->last_click_x = x;
priv->last_click_y = y;
priv->click_count = (priv->click_count % 3) + 1;
return priv->click_count;
}
static gboolean
clutter_text_press (ClutterActor *actor,
ClutterEvent *event)
@@ -2220,7 +2170,6 @@ clutter_text_press (ClutterActor *actor,
ClutterText *self = CLUTTER_TEXT (actor);
ClutterTextPrivate *priv = self->priv;
ClutterEventType type = clutter_event_type (event);
ClutterActor *stage;
gboolean res = FALSE;
gfloat x, y;
gint index_;
@@ -2232,7 +2181,6 @@ clutter_text_press (ClutterActor *actor,
return CLUTTER_EVENT_PROPAGATE;
clutter_actor_grab_key_focus (actor);
clutter_input_focus_reset (priv->input_focus);
clutter_input_focus_set_input_panel_state (priv->input_focus,
CLUTTER_INPUT_PANEL_STATE_TOGGLE);
@@ -2271,9 +2219,7 @@ clutter_text_press (ClutterActor *actor,
*/
if (type == CLUTTER_BUTTON_PRESS)
{
gint click_count;
click_count = clutter_text_update_click_count (self, event);
gint click_count = clutter_event_get_click_count (event);
if (click_count == 1)
{
@@ -2302,11 +2248,18 @@ clutter_text_press (ClutterActor *actor,
/* grab the pointer */
priv->in_select_drag = TRUE;
stage = clutter_actor_get_stage (actor);
priv->grab = clutter_stage_grab (CLUTTER_STAGE (stage), actor);
if (type != CLUTTER_BUTTON_PRESS)
priv->in_select_touch = TRUE;
if (type == CLUTTER_BUTTON_PRESS)
{
clutter_input_device_grab (clutter_event_get_device (event),
actor);
}
else
{
clutter_input_device_sequence_grab (clutter_event_get_device (event),
clutter_event_get_event_sequence (event),
actor);
priv->in_select_touch = TRUE;
}
return CLUTTER_EVENT_STOP;
}
@@ -2353,16 +2306,11 @@ clutter_text_release (ClutterActor *actor,
if (priv->in_select_drag)
{
if (priv->grab)
{
clutter_grab_dismiss (priv->grab);
g_clear_pointer (&priv->grab, clutter_grab_unref);
}
if (type == CLUTTER_BUTTON_RELEASE)
{
if (!priv->in_select_touch)
{
clutter_input_device_ungrab (clutter_event_get_device (event));
priv->in_select_drag = FALSE;
return CLUTTER_EVENT_STOP;
@@ -2372,6 +2320,11 @@ clutter_text_release (ClutterActor *actor,
{
if (priv->in_select_touch)
{
ClutterInputDevice *device = clutter_event_get_device (event);
ClutterEventSequence *sequence =
clutter_event_get_event_sequence (event);
clutter_input_device_sequence_ungrab (device, sequence);
priv->in_select_touch = FALSE;
priv->in_select_drag = FALSE;
@@ -3194,7 +3147,7 @@ clutter_text_key_focus_out (ClutterActor *actor)
if (priv->editable && clutter_input_focus_is_focused (priv->input_focus))
{
clutter_input_focus_reset (priv->input_focus);
clutter_text_set_preedit_string (CLUTTER_TEXT (actor), NULL, NULL, 0);
clutter_input_method_focus_out (method);
}

View File

@@ -126,8 +126,6 @@ clutter_texture_content_new_from_texture (CoglTexture *texture,
cairo_rectangle_int_t *clip)
{
ClutterTextureContent *texture_content;
CoglContext *cogl_context =
clutter_backend_get_cogl_context (clutter_get_default_backend ());
g_return_val_if_fail (texture != NULL, NULL);
@@ -136,12 +134,11 @@ clutter_texture_content_new_from_texture (CoglTexture *texture,
if (clip)
{
texture_content->texture =
COGL_TEXTURE (cogl_sub_texture_new (cogl_context,
texture,
clip->x,
clip->y,
clip->width,
clip->height));
cogl_texture_new_from_sub_texture (texture,
clip->x,
clip->y,
clip->width,
clip->height);
}
else
{

View File

@@ -33,7 +33,7 @@
* be used to update the state of the actors.
*
* It is important to note that #ClutterTimeline is not a generic API for
* calling closures after an interval; each Timeline is tied into a frame
* calling closures after an interval; each Timeline is tied into the master
* clock used to drive the frame cycle. If you need to schedule a closure
* after an interval, see clutter_threads_add_timeout() instead.
*
@@ -97,7 +97,6 @@
#include "clutter-timeline.h"
#include "deprecated/clutter-timeline.h"
#include "clutter-actor-private.h"
#include "clutter-debug.h"
#include "clutter-easing.h"
#include "clutter-enum-types.h"
@@ -163,7 +162,7 @@ struct _ClutterTimelinePrivate
guint is_playing : 1;
/* If we've just started playing and haven't yet gotten
* a tick from the frame clock
* a tick from the master clock
*/
guint waiting_first_tick : 1;
guint auto_reverse : 1;
@@ -429,10 +428,7 @@ update_frame_clock (ClutterTimeline *timeline)
if (!stage)
{
if (priv->is_playing)
g_warning ("Timelines with detached actors are not supported. "
"%s in animation of duration %ums but not on stage.",
_clutter_actor_get_debug_name (priv->actor),
priv->duration);
g_warning ("Timelines with detached actors are not supported");
goto out;
}
@@ -1884,11 +1880,9 @@ _clutter_timeline_advance (ClutterTimeline *timeline,
* @tick_time: time of advance
*
* Advances @timeline based on the time passed in @tick_time. This
* function is called by the frame clock and ideally passes the next
* presentation time in which consequences of our timeline will be visible.
* Otherwise an estimate using the current monotonic time is also acceptable.
* The @timeline will use this interval to emit the #ClutterTimeline::new-frame
* signal and eventually skip frames.
* function is called by the master clock. The @timeline will use this
* interval to emit the #ClutterTimeline::new-frame signal and
* eventually skip frames.
*/
void
_clutter_timeline_do_tick (ClutterTimeline *timeline,

View File

@@ -202,20 +202,6 @@ clutter_virtual_input_device_get_device_type (ClutterVirtualInputDevice *virtual
return priv->device_type;
}
/**
* clutter_virtual_input_device_get_seat:
*
* Returns: (transfer none): The seat of the virtual input device
*/
ClutterSeat *
clutter_virtual_input_device_get_seat (ClutterVirtualInputDevice *virtual_device)
{
ClutterVirtualInputDevicePrivate *priv =
clutter_virtual_input_device_get_instance_private (virtual_device);
return priv->seat;
}
static void
clutter_virtual_input_device_get_property (GObject *object,
guint prop_id,

View File

@@ -174,7 +174,4 @@ void clutter_virtual_input_device_notify_touch_up (ClutterVirtualInputDevice *vi
CLUTTER_EXPORT
int clutter_virtual_input_device_get_device_type (ClutterVirtualInputDevice *virtual_device);
CLUTTER_EXPORT
ClutterSeat * clutter_virtual_input_device_get_seat (ClutterVirtualInputDevice *virtual_device);
#endif /* __CLUTTER_VIRTUAL_INPUT_DEVICE_H__ */

View File

@@ -76,6 +76,8 @@ struct _ClutterZoomActionPrivate
{
ClutterStage *stage;
ClutterZoomAxis zoom_axis;
ZoomPoint points[2];
graphene_point_t initial_focal_point;
@@ -92,6 +94,17 @@ struct _ClutterZoomActionPrivate
gdouble zoom_initial_distance;
};
enum
{
PROP_0,
PROP_ZOOM_AXIS,
PROP_LAST
};
static GParamSpec *zoom_props[PROP_LAST] = { NULL, };
enum
{
ZOOM,
@@ -222,6 +235,89 @@ clutter_zoom_action_gesture_cancel (ClutterGestureAction *action,
clutter_actor_set_scale (actor, priv->initial_scale_x, priv->initial_scale_y);
}
static gboolean
clutter_zoom_action_real_zoom (ClutterZoomAction *action,
ClutterActor *actor,
graphene_point_t *focal_point,
gdouble factor)
{
ClutterZoomActionPrivate *priv = action->priv;
gfloat x, y, z;
gdouble scale_x, scale_y;
graphene_point3d_t out, in;
in.x = priv->transformed_focal_point.x;
in.y = priv->transformed_focal_point.y;
in.z = 0;
clutter_actor_apply_transform_to_point (actor, &in, &out);
clutter_actor_get_scale (actor, &scale_x, &scale_y);
switch (priv->zoom_axis)
{
case CLUTTER_ZOOM_BOTH:
clutter_actor_set_scale (actor, factor, factor);
break;
case CLUTTER_ZOOM_X_AXIS:
clutter_actor_set_scale (actor, factor, scale_y);
break;
case CLUTTER_ZOOM_Y_AXIS:
clutter_actor_set_scale (actor, scale_x, factor);
break;
default:
break;
}
x = priv->initial_x + priv->focal_point.x - priv->initial_focal_point.x;
y = priv->initial_y + priv->focal_point.y - priv->initial_focal_point.y;
clutter_actor_get_translation (actor, NULL, NULL, &z);
clutter_actor_set_translation (actor, x, y, z);
return TRUE;
}
static void
clutter_zoom_action_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterZoomAction *action = CLUTTER_ZOOM_ACTION (gobject);
switch (prop_id)
{
case PROP_ZOOM_AXIS:
clutter_zoom_action_set_zoom_axis (action, g_value_get_enum (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
}
}
static void
clutter_zoom_action_get_property (GObject *gobject,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ClutterZoomActionPrivate *priv = CLUTTER_ZOOM_ACTION (gobject)->priv;
switch (prop_id)
{
case PROP_ZOOM_AXIS:
g_value_set_enum (value, priv->zoom_axis);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
}
}
static void
clutter_zoom_action_dispose (GObject *gobject)
{
@@ -245,12 +341,35 @@ clutter_zoom_action_class_init (ClutterZoomActionClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->constructed = clutter_zoom_action_constructed;
gobject_class->set_property = clutter_zoom_action_set_property;
gobject_class->get_property = clutter_zoom_action_get_property;
gobject_class->dispose = clutter_zoom_action_dispose;
gesture_class->gesture_begin = clutter_zoom_action_gesture_begin;
gesture_class->gesture_progress = clutter_zoom_action_gesture_progress;
gesture_class->gesture_cancel = clutter_zoom_action_gesture_cancel;
klass->zoom = clutter_zoom_action_real_zoom;
/**
* ClutterZoomAction:zoom-axis:
*
* Constraints the zooming action to the specified axis
*
* Since: 1.12
*/
zoom_props[PROP_ZOOM_AXIS] =
g_param_spec_enum ("zoom-axis",
P_("Zoom Axis"),
P_("Constraints the zoom to an axis"),
CLUTTER_TYPE_ZOOM_AXIS,
CLUTTER_ZOOM_BOTH,
CLUTTER_PARAM_READWRITE);
g_object_class_install_properties (gobject_class,
PROP_LAST,
zoom_props);
/**
* ClutterZoomAction::zoom:
* @action: the #ClutterZoomAction that emitted the signal
@@ -276,7 +395,8 @@ clutter_zoom_action_class_init (ClutterZoomActionClass *klass)
g_signal_new (I_("zoom"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, g_signal_accumulator_true_handled, NULL,
G_STRUCT_OFFSET (ClutterZoomActionClass, zoom),
_clutter_boolean_continue_accumulator, NULL,
_clutter_marshal_BOOLEAN__OBJECT_BOXED_DOUBLE,
G_TYPE_BOOLEAN, 3,
CLUTTER_TYPE_ACTOR,
@@ -290,6 +410,7 @@ clutter_zoom_action_init (ClutterZoomAction *self)
ClutterGestureAction *gesture;
self->priv = clutter_zoom_action_get_instance_private (self);
self->priv->zoom_axis = CLUTTER_ZOOM_BOTH;
gesture = CLUTTER_GESTURE_ACTION (self);
clutter_gesture_action_set_n_touch_points (gesture, 2);
@@ -310,6 +431,50 @@ clutter_zoom_action_new (void)
return g_object_new (CLUTTER_TYPE_ZOOM_ACTION, NULL);
}
/**
* clutter_zoom_action_set_zoom_axis:
* @action: a #ClutterZoomAction
* @axis: the axis to constraint the zooming to
*
* Restricts the zooming action to a specific axis
*
* Since: 1.12
*/
void
clutter_zoom_action_set_zoom_axis (ClutterZoomAction *action,
ClutterZoomAxis axis)
{
g_return_if_fail (CLUTTER_IS_ZOOM_ACTION (action));
g_return_if_fail (axis >= CLUTTER_ZOOM_X_AXIS &&
axis <= CLUTTER_ZOOM_BOTH);
if (action->priv->zoom_axis == axis)
return;
action->priv->zoom_axis = axis;
g_object_notify_by_pspec (G_OBJECT (action), zoom_props[PROP_ZOOM_AXIS]);
}
/**
* clutter_zoom_action_get_zoom_axis:
* @action: a #ClutterZoomAction
*
* Retrieves the axis constraint set by clutter_zoom_action_set_zoom_axis()
*
* Return value: the axis constraint
*
* Since: 1.12
*/
ClutterZoomAxis
clutter_zoom_action_get_zoom_axis (ClutterZoomAction *action)
{
g_return_val_if_fail (CLUTTER_IS_ZOOM_ACTION (action),
CLUTTER_ZOOM_BOTH);
return action->priv->zoom_axis;
}
/**
* clutter_zoom_action_get_focal_point:
* @action: a #ClutterZoomAction

View File

@@ -76,6 +76,13 @@ struct _ClutterZoomActionClass
/*< private >*/
ClutterGestureActionClass parent_class;
/*< public >*/
gboolean (* zoom) (ClutterZoomAction *action,
ClutterActor *actor,
graphene_point_t *focal_point,
gdouble factor);
/*< private >*/
void (* _clutter_zoom_action1) (void);
void (* _clutter_zoom_action2) (void);
void (* _clutter_zoom_action3) (void);
@@ -89,6 +96,12 @@ GType clutter_zoom_action_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
ClutterAction * clutter_zoom_action_new (void);
CLUTTER_EXPORT
void clutter_zoom_action_set_zoom_axis (ClutterZoomAction *action,
ClutterZoomAxis axis);
CLUTTER_EXPORT
ClutterZoomAxis clutter_zoom_action_get_zoom_axis (ClutterZoomAction *action);
CLUTTER_EXPORT
void clutter_zoom_action_get_focal_point (ClutterZoomAction *action,
graphene_point_t *point);

View File

@@ -65,7 +65,6 @@
#include "clutter-frame-clock.h"
#include "clutter-frame.h"
#include "clutter-gesture-action.h"
#include "clutter-grab.h"
#include "clutter-grid-layout.h"
#include "clutter-image.h"
#include "clutter-input-device.h"

View File

@@ -1,48 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author:
* Emmanuele Bassi <ebassi@linux.intel.com>
*
* Based on the NBTK NbtkBoxLayout actor by:
* Thomas Wood <thomas.wood@intel.com>
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_BOX_LAYOUT_DEPRECATED_H__
#define __CLUTTER_BOX_LAYOUT_DEPRECATED_H__
#include <clutter/clutter-box-layout.h>
G_BEGIN_DECLS
CLUTTER_DEPRECATED
void clutter_box_layout_set_pack_start (ClutterBoxLayout *layout,
gboolean pack_start);
CLUTTER_DEPRECATED
gboolean clutter_box_layout_get_pack_start (ClutterBoxLayout *layout);
G_END_DECLS
#endif /* __CLUTTER_BOX_LAYOUT_DEPRECATED_H__ */

View File

@@ -52,6 +52,22 @@ CLUTTER_DEPRECATED_FOR(clutter_actor_remove_child)
void clutter_container_remove_actor (ClutterContainer *container,
ClutterActor *actor);
CLUTTER_DEPRECATED_FOR(clutter_actor_get_children)
GList * clutter_container_get_children (ClutterContainer *container);
CLUTTER_DEPRECATED_FOR(clutter_actor_set_child_above_sibling)
void clutter_container_raise_child (ClutterContainer *container,
ClutterActor *actor,
ClutterActor *sibling);
CLUTTER_DEPRECATED_FOR(clutter_actor_set_child_below_sibling)
void clutter_container_lower_child (ClutterContainer *container,
ClutterActor *actor,
ClutterActor *sibling);
CLUTTER_DEPRECATED
void clutter_container_sort_depth_order (ClutterContainer *container);
G_END_DECLS
#endif /* __CLUTTER_CONTAINER_DEPRECATED_H__ */

View File

@@ -39,7 +39,6 @@ clutter_headers = [
'clutter-frame-clock.h',
'clutter-frame.h',
'clutter-gesture-action.h',
'clutter-grab.h',
'clutter-grid-layout.h',
'clutter-image.h',
'clutter-input-device.h',
@@ -228,7 +227,6 @@ clutter_nonintrospected_sources = [
]
clutter_deprecated_headers = [
'deprecated/clutter-box-layout.h',
'deprecated/clutter-container.h',
'deprecated/clutter-timeline.h',
]

View File

@@ -446,9 +446,8 @@ _cogl_pango_display_list_render (CoglFramebuffer *fb,
break;
case COGL_PANGO_DISPLAY_LIST_TRAPEZOID:
cogl_primitive_draw (node->d.trapezoid.primitive,
fb,
node->pipeline);
cogl_framebuffer_draw_primitive (fb, node->pipeline,
node->d.trapezoid.primitive);
break;
}
}

View File

@@ -114,6 +114,8 @@ struct _CoglContext
CoglBitmask enable_custom_attributes_tmp;
CoglBitmask changed_bits_tmp;
gboolean legacy_backface_culling_enabled;
/* A few handy matrix constants */
graphene_matrix_t identity_matrix;
graphene_matrix_t y_flip_matrix;
@@ -160,6 +162,8 @@ struct _CoglContext
float depth_range_near_cache;
float depth_range_far_cache;
gboolean legacy_depth_test_enabled;
CoglBuffer *current_buffer[COGL_BUFFER_BIND_TARGET_COUNT];
/* Framebuffers */

View File

@@ -146,7 +146,6 @@ cogl_context_new (CoglDisplay *display,
CoglRenderer *renderer = cogl_renderer_new ();
if (!cogl_renderer_connect (renderer, error))
{
cogl_object_unref (renderer);
g_free (context);
return NULL;
}
@@ -224,6 +223,8 @@ cogl_context_new (CoglDisplay *display,
context->current_clip_stack_valid = FALSE;
context->current_clip_stack = NULL;
context->legacy_backface_culling_enabled = FALSE;
graphene_matrix_init_identity (&context->identity_matrix);
graphene_matrix_init_identity (&context->y_flip_matrix);
graphene_matrix_scale (&context->y_flip_matrix, 1, -1, 1);
@@ -275,6 +276,8 @@ cogl_context_new (CoglDisplay *display,
context->depth_range_near_cache = 0;
context->depth_range_far_cache = 1;
context->legacy_depth_test_enabled = FALSE;
context->pipeline_cache = _cogl_pipeline_cache_new ();
for (i = 0; i < COGL_BUFFER_BIND_TARGET_COUNT; i++)
@@ -501,13 +504,6 @@ cogl_context_get_named_pipeline (CoglContext *context,
return g_hash_table_lookup (context->named_pipelines, key);
}
/**
* cogl_context_free_timestamp_query:
* @context: a #CoglContext object
* @query: (transfer full): the #CoglTimestampQuery to free
*
* Free the #CoglTimestampQuery
*/
void
cogl_context_free_timestamp_query (CoglContext *context,
CoglTimestampQuery *query)
@@ -526,7 +522,7 @@ int64_t
cogl_context_get_gpu_time_ns (CoglContext *context)
{
g_return_val_if_fail (cogl_has_feature (context,
COGL_FEATURE_ID_TIMESTAMP_QUERY),
COGL_FEATURE_ID_GET_GPU_TIME),
0);
return context->driver_vtable->get_gpu_time_ns (context);

View File

@@ -210,6 +210,7 @@ typedef enum _CoglFeatureID
COGL_FEATURE_ID_TEXTURE_EGL_IMAGE_EXTERNAL,
COGL_FEATURE_ID_BLIT_FRAMEBUFFER,
COGL_FEATURE_ID_TIMESTAMP_QUERY,
COGL_FEATURE_ID_GET_GPU_TIME,
/*< private >*/
_COGL_N_FEATURE_IDS /*< skip >*/
@@ -384,7 +385,7 @@ cogl_context_timestamp_query_get_time_ns (CoglContext *context,
* cogl_context_get_gpu_time_ns:
* @context: a #CoglContext pointer
*
* This function should only be called if the COGL_FEATURE_ID_TIMESTAMP_QUERY
* This function should only be called if the COGL_FEATURE_ID_GET_GPU_TIME
* feature is advertised.
*
* Return value: Current GPU time in nanoseconds

View File

@@ -39,6 +39,7 @@
#mesondefine COGL_HAS_GL
#mesondefine CLUTTER_COGL_HAS_GL
#mesondefine COGL_HAS_GLX_SUPPORT
#mesondefine COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT
#mesondefine COGL_HAS_EGL_PLATFORM_XLIB_SUPPORT
#mesondefine COGL_HAS_EGL_SUPPORT
#mesondefine COGL_HAS_X11

View File

@@ -141,6 +141,4 @@ cogl_dma_buf_handle_get_offset (CoglDmaBufHandle *dmabuf_handle);
COGL_EXPORT int
cogl_dma_buf_handle_get_bpp (CoglDmaBufHandle *dmabuf_handle);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (CoglDmaBufHandle, cogl_dma_buf_handle_free)
#endif /* __COGL_DMA_BUF_HANDLE_H__ */

View File

@@ -2497,6 +2497,14 @@ _cogl_framebuffer_draw_indexed_attributes (CoglFramebuffer *framebuffer,
}
}
void
cogl_framebuffer_draw_primitive (CoglFramebuffer *framebuffer,
CoglPipeline *pipeline,
CoglPrimitive *primitive)
{
_cogl_primitive_draw (primitive, framebuffer, pipeline, 0);
}
void
cogl_framebuffer_draw_rectangle (CoglFramebuffer *framebuffer,
CoglPipeline *pipeline,

View File

@@ -1046,6 +1046,36 @@ cogl_framebuffer_clear4f (CoglFramebuffer *framebuffer,
float blue,
float alpha);
/**
* cogl_framebuffer_draw_primitive: (skip)
* @framebuffer: A destination #CoglFramebuffer
* @pipeline: A #CoglPipeline state object
* @primitive: A #CoglPrimitive geometry object
*
* Draws the given @primitive geometry to the specified destination
* @framebuffer using the graphics processing state described by @pipeline.
*
* This drawing api doesn't support high-level meta texture types such
* as #CoglTexture2DSliced so it is the user's responsibility to
* ensure that only low-level textures that can be directly sampled by
* a GPU such as #CoglTexture2D are associated with layers of the given
* @pipeline.
*
* <note>This api doesn't support any of the legacy global state options such
* as cogl_set_depth_test_enabled() or
* cogl_set_backface_culling_enabled().</note>
*
* Stability: unstable
* Since: 1.10
* Deprecated: 1.16: Use #CoglPrimitive<!-- -->s and
* cogl_primitive_draw() instead
*/
COGL_DEPRECATED_FOR (cogl_primitive_draw)
COGL_EXPORT void
cogl_framebuffer_draw_primitive (CoglFramebuffer *framebuffer,
CoglPipeline *pipeline,
CoglPrimitive *primitive);
/**
* cogl_framebuffer_draw_rectangle:
* @framebuffer: A destination #CoglFramebuffer

View File

@@ -171,7 +171,6 @@ cogl_glib_renderer_source_new (CoglRenderer *renderer,
source = g_source_new (&cogl_glib_source_funcs,
sizeof (CoglGLibSource));
g_source_set_name (source, "[mutter] Cogl");
cogl_source = (CoglGLibSource *) source;
cogl_source->renderer = renderer;

View File

@@ -300,19 +300,6 @@ cogl_onscreen_bind (CoglOnscreen *onscreen)
COGL_ONSCREEN_GET_CLASS (onscreen)->bind (onscreen);
}
void
cogl_onscreen_queue_damage_region (CoglOnscreen *onscreen,
const int *rectangles,
int n_rectangles)
{
CoglOnscreenClass *klass = COGL_ONSCREEN_GET_CLASS (onscreen);
if (!klass->queue_damage_region)
return;
klass->queue_damage_region (onscreen, rectangles, n_rectangles);
}
void
cogl_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
const int *rectangles,

View File

@@ -74,10 +74,6 @@ struct _CoglOnscreenClass
CoglFrameInfo *info,
gpointer user_data);
void (* queue_damage_region) (CoglOnscreen *onscreen,
const int *rectangles,
int n_rectangles);
gboolean (* direct_scanout) (CoglOnscreen *onscreen,
CoglScanout *scanout,
CoglFrameInfo *info,
@@ -231,23 +227,6 @@ cogl_onscreen_swap_buffers (CoglOnscreen *onscreen,
COGL_EXPORT int
cogl_onscreen_get_buffer_age (CoglOnscreen *onscreen);
/**
* cogl_onscreen_queue_damage_region:
* @onscreen: A #CoglOnscreen framebuffer
* @rectangles: An array of integer 4-tuples representing damaged
* rectangles as (x, y, width, height) tuples.
* @n_rectangles: The number of 4-tuples to be read from @rectangles
*
* Implementation for https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_partial_update.txt
* This immediately queues state to OpenGL that will be used for the
* next swap.
* This needs to be called every frame.
*/
COGL_EXPORT void
cogl_onscreen_queue_damage_region (CoglOnscreen *onscreen,
const int *rectangles,
int n_rectangles);
/**
* cogl_onscreen_swap_buffers_with_damage:
* @onscreen: A #CoglOnscreen framebuffer

View File

@@ -103,10 +103,9 @@ dump_layer_cb (CoglNode *node, void *user_data)
{
g_string_append_printf (changes_label, "\"];\n");
g_string_append (state->graph, changes_label->str);
g_string_free (changes_label, TRUE);
}
g_string_free (changes_label, TRUE);
state_out.parent_id = layer_id;
state_out.node_id_ptr = state->node_id_ptr;
@@ -211,10 +210,9 @@ dump_pipeline_cb (CoglNode *node, void *user_data)
{
g_string_append_printf (changes_label, "\"];\n");
g_string_append (state->graph, changes_label->str);
g_string_free (changes_label, TRUE);
}
g_string_free (changes_label, TRUE);
if (layers)
{
g_list_foreach (pipeline->layer_differences,

View File

@@ -529,7 +529,7 @@ gboolean
cogl_renderer_connect (CoglRenderer *renderer, GError **error)
{
int i;
g_autoptr (GString) error_message = NULL;
GString *error_message;
gboolean constraints_failed = FALSE;
if (renderer->connected)
@@ -594,6 +594,7 @@ cogl_renderer_connect (CoglRenderer *renderer, GError **error)
else
{
renderer->connected = TRUE;
g_string_free (error_message, TRUE);
return TRUE;
}
}
@@ -612,6 +613,7 @@ cogl_renderer_connect (CoglRenderer *renderer, GError **error)
g_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_INIT,
"Failed to connected to any renderer: %s",
error_message->str);
g_string_free (error_message, TRUE);
return FALSE;
}
@@ -773,17 +775,6 @@ cogl_renderer_create_dma_buf (CoglRenderer *renderer,
return NULL;
}
gboolean
cogl_renderer_is_dma_buf_supported (CoglRenderer *renderer)
{
const CoglWinsysVtable *winsys = _cogl_renderer_get_winsys (renderer);
if (winsys->renderer_is_dma_buf_supported)
return winsys->renderer_is_dma_buf_supported (renderer);
else
return FALSE;
}
void
cogl_renderer_bind_api (CoglRenderer *renderer)
{

View File

@@ -419,16 +419,6 @@ cogl_renderer_create_dma_buf (CoglRenderer *renderer,
int height,
GError **error);
/**
* cogl_renderer_is_dma_buf_supported: (skip)
* @renderer: A #CoglRenderer
*
* Returns: %TRUE if DMA buffers can be allocated
*/
COGL_EXPORT gboolean
cogl_renderer_is_dma_buf_supported (CoglRenderer *renderer);
/**
* cogl_renderer_bind_api: (skip)
*/

View File

@@ -51,6 +51,10 @@
#include <string.h>
#include <math.h>
#ifdef COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT
#include "cogl-wayland-server.h"
#endif
static void _cogl_texture_2d_free (CoglTexture2D *tex_2d);
COGL_TEXTURE_DEFINE (Texture2D, texture_2d);

View File

@@ -423,6 +423,10 @@ typedef enum _CoglFilterReturn { /*< prefix=COGL_FILTER >*/
typedef enum _CoglWinsysFeature
{
/* Available if the window system can support multiple onscreen
* framebuffers at the same time. */
COGL_WINSYS_FEATURE_MULTIPLE_ONSCREEN,
/* Available if its possible to query a counter that
* increments at each vblank. */
COGL_WINSYS_FEATURE_VBLANK_COUNTER,

View File

@@ -0,0 +1,88 @@
/*
* Cogl
*
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2012 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_WAYLAND_SERVER_H
#define __COGL_WAYLAND_SERVER_H
#include <wayland-server.h>
/* NB: this is a top-level header that can be included directly but we
* want to be careful not to define __COGL_H_INSIDE__ when this is
* included internally while building Cogl itself since
* __COGL_H_INSIDE__ is used in headers to guard public vs private api
* definitions
*/
#ifndef COGL_COMPILATION
/* Note: When building Cogl .gir we explicitly define
* __COGL_H_INSIDE__ */
#ifndef __COGL_H_INSIDE__
#define __COGL_H_INSIDE__
#define __COGL_MUST_UNDEF_COGL_H_INSIDE_COGL_WAYLAND_SERVER_
#endif
#endif /* COGL_COMPILATION */
#include <cogl/cogl-context.h>
#include <cogl/cogl-texture-2d.h>
G_BEGIN_DECLS
/**
* cogl_wayland_display_set_compositor_display:
* @display: a #CoglDisplay
* @wayland_display: A compositor's Wayland display pointer
*
* Informs Cogl of a compositor's Wayland display pointer. This
* enables Cogl to register private wayland extensions required to
* pass buffers between the clients and compositor.
*
* Since: 1.10
* Stability: unstable
*/
COGL_EXPORT void
cogl_wayland_display_set_compositor_display (CoglDisplay *display,
struct wl_display *wayland_display);
G_END_DECLS
/* The gobject introspection scanner seems to parse public headers in
* isolation which means we need to be extra careful about how we
* define and undefine __COGL_H_INSIDE__ used to detect when internal
* headers are incorrectly included by developers. In the gobject
* introspection case we have to manually define __COGL_H_INSIDE__ as
* a commandline argument for the scanner which means we must be
* careful not to undefine it in a header...
*/
#ifdef __COGL_MUST_UNDEF_COGL_H_INSIDE_COGL_WAYLAND_SERVER_
#undef __COGL_H_INSIDE__
#undef __COGL_MUST_UNDEF_COGL_H_INSIDE_COGL_WAYLAND_SERVER_
#endif
#endif /* __COGL_WAYLAND_SERVER_H */

View File

@@ -73,6 +73,45 @@ _cogl_check_extension (const char *name, char * const *ext)
return FALSE;
}
/* XXX: This API has been deprecated */
void
cogl_set_depth_test_enabled (gboolean setting)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
if (ctx->legacy_depth_test_enabled == setting)
return;
ctx->legacy_depth_test_enabled = setting;
}
/* XXX: This API has been deprecated */
gboolean
cogl_get_depth_test_enabled (void)
{
_COGL_GET_CONTEXT (ctx, FALSE);
return ctx->legacy_depth_test_enabled;
}
void
cogl_set_backface_culling_enabled (gboolean setting)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
if (ctx->legacy_backface_culling_enabled == setting)
return;
ctx->legacy_backface_culling_enabled = setting;
}
gboolean
cogl_get_backface_culling_enabled (void)
{
_COGL_GET_CONTEXT (ctx, FALSE);
return ctx->legacy_backface_culling_enabled;
}
gboolean
cogl_has_feature (CoglContext *ctx, CoglFeatureID feature)
{

View File

@@ -85,6 +85,7 @@
#include <cogl/deprecated/cogl-auto-texture.h>
#include <cogl/deprecated/cogl-shader.h>
#include <cogl/deprecated/cogl-material-compat.h>
#ifdef COGL_ENABLE_MUTTER_API
#include <cogl/cogl-mutter.h>

View File

@@ -79,6 +79,65 @@ cogl_get_option_group (void);
COGL_EXPORT GCallback
cogl_get_proc_address (const char *name);
/**
* cogl_set_depth_test_enabled:
* @setting: %TRUE to enable depth testing or %FALSE to disable.
*
* Sets whether depth testing is enabled. If it is disabled then the
* order that actors are layered on the screen depends solely on the
* order specified using clutter_actor_raise() and
* clutter_actor_lower(), otherwise it will also take into account the
* actor's depth. Depth testing is disabled by default.
*
* Deprecated: 1.16: Use cogl_pipeline_set_depth_state() instead
*/
COGL_DEPRECATED_FOR (cogl_pipeline_set_depth_state)
COGL_EXPORT void
cogl_set_depth_test_enabled (gboolean setting);
/**
* cogl_get_depth_test_enabled:
*
* Queries if depth testing has been enabled via cogl_set_depth_test_enable()
*
* Return value: %TRUE if depth testing is enabled, and %FALSE otherwise
*
* Deprecated: 1.16: Use cogl_pipeline_set_depth_state() instead
*/
COGL_DEPRECATED_FOR (cogl_pipeline_set_depth_state)
COGL_EXPORT gboolean
cogl_get_depth_test_enabled (void);
/**
* cogl_set_backface_culling_enabled:
* @setting: %TRUE to enable backface culling or %FALSE to disable.
*
* Sets whether textures positioned so that their backface is showing
* should be hidden. This can be used to efficiently draw two-sided
* textures or fully closed cubes without enabling depth testing. This
* only affects calls to the cogl_rectangle* family of functions and
* cogl_vertex_buffer_draw*. Backface culling is disabled by default.
*
* Deprecated: 1.16: Use cogl_pipeline_set_cull_face_mode() instead
*/
COGL_DEPRECATED_FOR (cogl_pipeline_set_cull_face_mode)
COGL_EXPORT void
cogl_set_backface_culling_enabled (gboolean setting);
/**
* cogl_get_backface_culling_enabled:
*
* Queries if backface culling has been enabled via
* cogl_set_backface_culling_enabled()
*
* Return value: %TRUE if backface culling is enabled, and %FALSE otherwise
*
* Deprecated: 1.16: Use cogl_pipeline_get_cull_face_mode() instead
*/
COGL_DEPRECATED_FOR (cogl_pipeline_get_cull_face_mode)
COGL_EXPORT gboolean
cogl_get_backface_culling_enabled (void);
/**
* cogl_flush:
*

View File

@@ -68,6 +68,66 @@ set_auto_mipmap_cb (CoglTexture *sub_texture,
FALSE);
}
CoglTexture *
cogl_texture_new_with_size (unsigned int width,
unsigned int height,
CoglTextureFlags flags,
CoglPixelFormat internal_format)
{
CoglTexture *tex;
GError *skip_error = NULL;
_COGL_GET_CONTEXT (ctx, NULL);
/* First try creating a fast-path non-sliced texture */
tex = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx, width, height));
_cogl_texture_set_internal_format (tex, internal_format);
if (!cogl_texture_allocate (tex, &skip_error))
{
g_error_free (skip_error);
skip_error = NULL;
cogl_object_unref (tex);
tex = NULL;
}
if (!tex)
{
/* If it fails resort to sliced textures */
int max_waste = flags & COGL_TEXTURE_NO_SLICING ? -1 : COGL_TEXTURE_MAX_WASTE;
tex = COGL_TEXTURE (cogl_texture_2d_sliced_new_with_size (ctx,
width,
height,
max_waste));
_cogl_texture_set_internal_format (tex, internal_format);
}
/* NB: This api existed before Cogl introduced lazy allocation of
* textures and so we maintain its original synchronous allocation
* semantics and return NULL if allocation fails... */
if (!cogl_texture_allocate (tex, &skip_error))
{
g_error_free (skip_error);
cogl_object_unref (tex);
return NULL;
}
if (tex &&
flags & COGL_TEXTURE_NO_AUTO_MIPMAP)
{
cogl_meta_texture_foreach_in_region (COGL_META_TEXTURE (tex),
0, 0, 1, 1,
COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE,
COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE,
set_auto_mipmap_cb,
NULL);
}
return tex;
}
static CoglTexture *
_cogl_texture_new_from_data (CoglContext *ctx,
int width,
@@ -273,3 +333,16 @@ cogl_texture_new_from_file (const char *filename,
return texture;
}
CoglTexture *
cogl_texture_new_from_sub_texture (CoglTexture *full_texture,
int sub_x,
int sub_y,
int sub_width,
int sub_height)
{
_COGL_GET_CONTEXT (ctx, NULL);
return COGL_TEXTURE (cogl_sub_texture_new (ctx,
full_texture, sub_x, sub_y,
sub_width, sub_height));
}

View File

@@ -35,6 +35,29 @@ G_BEGIN_DECLS
#include <cogl/cogl-texture.h>
/**
* cogl_texture_new_with_size:
* @width: width of texture in pixels.
* @height: height of texture in pixels.
* @flags: Optional flags for the texture, or %COGL_TEXTURE_NONE
* @internal_format: the #CoglPixelFormat to use for the GPU storage of the
* texture.
*
* Creates a new #CoglTexture with the specified dimensions and pixel format.
*
* Return value: (transfer full): A newly created #CoglTexture or %NULL on failure
*
* Since: 0.8
* Deprecated: 1.18: Use specific constructors such as
* cogl_texture_2d_new_with_size()
*/
COGL_DEPRECATED_FOR (cogl_texture_2d_new_with_size__OR__cogl_texture_2d_sliced_new_with_size)
COGL_EXPORT CoglTexture *
cogl_texture_new_with_size (unsigned int width,
unsigned int height,
CoglTextureFlags flags,
CoglPixelFormat internal_format);
/**
* cogl_texture_new_from_file:
* @filename: the file to load
@@ -124,6 +147,38 @@ cogl_texture_new_from_bitmap (CoglBitmap *bitmap,
CoglTextureFlags flags,
CoglPixelFormat internal_format);
/**
* cogl_texture_new_from_sub_texture:
* @full_texture: a #CoglTexture pointer
* @sub_x: X coordinate of the top-left of the subregion
* @sub_y: Y coordinate of the top-left of the subregion
* @sub_width: Width in pixels of the subregion
* @sub_height: Height in pixels of the subregion
*
* Creates a new texture which represents a subregion of another
* texture. The GL resources will be shared so that no new texture
* data is actually allocated.
*
* Sub textures have undefined behaviour texture coordinates outside
* of the range [0,1] are used.
*
* The sub texture will keep a reference to the full texture so you do
* not need to keep one separately if you only want to use the sub
* texture.
*
* Return value: (transfer full): A newly created #CoglTexture or
* %NULL on failure
* Since: 1.2
* Deprecated: 1.18: Use cogl_sub_texture_new()
*/
COGL_DEPRECATED_FOR (cogl_sub_texture_new)
COGL_EXPORT CoglTexture *
cogl_texture_new_from_sub_texture (CoglTexture *full_texture,
int sub_x,
int sub_y,
int sub_width,
int sub_height);
G_END_DECLS
#endif /* __COGL_AUTO_TEXTURE_H__ */

View File

@@ -0,0 +1,162 @@
/*
* 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.
*
* Authors:
* Robert Bragg <robert@linux.intel.com>
*/
#include "cogl-config.h"
#include <cogl-pipeline.h>
#include <cogl-pipeline-private.h>
#include <cogl-types.h>
#include <cogl-context-private.h>
#include <deprecated/cogl-material-compat.h>
G_DEFINE_BOXED_TYPE (CoglMaterial, cogl_material,
cogl_object_ref, cogl_object_unref)
CoglMaterial *
cogl_material_new (void)
{
_COGL_GET_CONTEXT(ctx, NULL);
return COGL_MATERIAL (cogl_pipeline_new (ctx));
}
void
cogl_material_set_color (CoglMaterial *material,
const CoglColor *color)
{
cogl_pipeline_set_color (COGL_PIPELINE (material), color);
}
void
cogl_material_set_color4ub (CoglMaterial *material,
uint8_t red,
uint8_t green,
uint8_t blue,
uint8_t alpha)
{
cogl_pipeline_set_color4ub (COGL_PIPELINE (material),
red, green, blue, alpha);
}
gboolean
cogl_material_set_blend (CoglMaterial *material,
const char *blend_string,
GError **error)
{
return cogl_pipeline_set_blend (COGL_PIPELINE (material),
blend_string,
error);
}
void
cogl_material_set_blend_constant (CoglMaterial *material,
const CoglColor *constant_color)
{
cogl_pipeline_set_blend_constant (COGL_PIPELINE (material), constant_color);
}
void
cogl_material_set_point_size (CoglMaterial *material,
float point_size)
{
cogl_pipeline_set_point_size (COGL_PIPELINE (material), point_size);
}
void
cogl_material_set_user_program (CoglMaterial *material,
CoglHandle program)
{
cogl_pipeline_set_user_program (COGL_PIPELINE (material), program);
}
void
cogl_material_set_layer (CoglMaterial *material,
int layer_index,
CoglHandle texture)
{
cogl_pipeline_set_layer_texture (COGL_PIPELINE (material),
layer_index, texture);
}
gboolean
cogl_material_set_layer_combine (CoglMaterial *material,
int layer_index,
const char *blend_string,
GError **error)
{
return cogl_pipeline_set_layer_combine (COGL_PIPELINE (material),
layer_index,
blend_string,
error);
}
void
cogl_material_set_layer_combine_constant (CoglMaterial *material,
int layer_index,
const CoglColor *constant)
{
cogl_pipeline_set_layer_combine_constant (COGL_PIPELINE (material),
layer_index,
constant);
}
void
cogl_material_set_layer_matrix (CoglMaterial *material,
int layer_index,
const graphene_matrix_t *matrix)
{
cogl_pipeline_set_layer_matrix (COGL_PIPELINE (material),
layer_index, matrix);
}
void
cogl_material_set_layer_filters (CoglMaterial *material,
int layer_index,
CoglMaterialFilter min_filter,
CoglMaterialFilter mag_filter)
{
cogl_pipeline_set_layer_filters (COGL_PIPELINE (material),
layer_index,
min_filter,
mag_filter);
}
gboolean
cogl_material_set_layer_point_sprite_coords_enabled (CoglMaterial *material,
int layer_index,
gboolean enable,
GError **error)
{
CoglPipeline *pipeline = COGL_PIPELINE (material);
return cogl_pipeline_set_layer_point_sprite_coords_enabled (pipeline,
layer_index,
enable,
error);
}

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