Compare commits
132 Commits
wip/carlos
...
3.31.91
Author | SHA1 | Date | |
---|---|---|---|
![]() |
fca0e6abb1 | ||
![]() |
6975c8b424 | ||
![]() |
f4f823f238 | ||
![]() |
1c67260bd4 | ||
![]() |
79f90c147c | ||
![]() |
4e751a3b58 | ||
![]() |
1c2e8fcf06 | ||
![]() |
00ca387ec7 | ||
![]() |
5688f1cf6e | ||
![]() |
7bd668e6d0 | ||
![]() |
1dc602e289 | ||
![]() |
ec518c4f24 | ||
![]() |
0d9295523e | ||
![]() |
a4443885a3 | ||
![]() |
ef8f2876e3 | ||
![]() |
75071aba68 | ||
![]() |
a81435ab5f | ||
![]() |
6fe46cac60 | ||
![]() |
c3b9ef7bf5 | ||
![]() |
b70c0eb9a5 | ||
![]() |
f3dd97e67b | ||
![]() |
77fb0a0003 | ||
![]() |
58d2a674c4 | ||
![]() |
9e2ed4104d | ||
![]() |
3f9b4a1ab5 | ||
![]() |
2aa0ec004a | ||
![]() |
f798912cbd | ||
![]() |
3bf80a967c | ||
![]() |
6c3b0cfc36 | ||
![]() |
43633d6b2f | ||
![]() |
fdd531f307 | ||
![]() |
70c45f8941 | ||
![]() |
b82fa2c610 | ||
![]() |
eaacbb3289 | ||
![]() |
54fdd633fe | ||
![]() |
29ed84e921 | ||
![]() |
d587fc1ef4 | ||
![]() |
285d717ceb | ||
![]() |
616a149917 | ||
![]() |
f578c4daaa | ||
![]() |
830495b7c6 | ||
![]() |
4d02f68057 | ||
![]() |
31c5a0009f | ||
![]() |
c91d9df481 | ||
![]() |
e64cbfcc3f | ||
![]() |
3c2d85b544 | ||
![]() |
96c4dd817e | ||
![]() |
ba7af4f7d3 | ||
![]() |
edfe5cc3b7 | ||
![]() |
07e65a6ef2 | ||
![]() |
d574cf59f1 | ||
![]() |
47402d848d | ||
![]() |
922f14276a | ||
![]() |
8c5ad7ea2d | ||
![]() |
20c5e2525e | ||
![]() |
325fec31da | ||
![]() |
cbb2a286f2 | ||
![]() |
e9eaa37401 | ||
![]() |
dbe73c3296 | ||
![]() |
b4ae6cdd62 | ||
![]() |
317414ab26 | ||
![]() |
b63e104561 | ||
![]() |
02b184bfd7 | ||
![]() |
d8c7583922 | ||
![]() |
25f36b3892 | ||
![]() |
0f0b411f6e | ||
![]() |
5a71ed4411 | ||
![]() |
de76074336 | ||
![]() |
f63b69bb23 | ||
![]() |
a54f9e835c | ||
![]() |
7a941138de | ||
![]() |
2c5404532b | ||
![]() |
be259117f5 | ||
![]() |
6932b3cbb3 | ||
![]() |
b76bf20092 | ||
![]() |
a62dbc6680 | ||
![]() |
442dcc7855 | ||
![]() |
23e7a0a099 | ||
![]() |
7f2dbb6c44 | ||
![]() |
8a0d0ce987 | ||
![]() |
0789c3fb9f | ||
![]() |
31d99c51cb | ||
![]() |
30550ef688 | ||
![]() |
b04cca9eab | ||
![]() |
e0fd7a6d05 | ||
![]() |
923751aa39 | ||
![]() |
6de81b0513 | ||
![]() |
7ae698795e | ||
![]() |
72692b1144 | ||
![]() |
177b4df217 | ||
![]() |
a08d7cf48a | ||
![]() |
3fa6a92cc5 | ||
![]() |
d5a7bbd094 | ||
![]() |
de41f3ea28 | ||
![]() |
5c3ec27b4b | ||
![]() |
8655bc5d8d | ||
![]() |
2e53ce8e75 | ||
![]() |
2528a39781 | ||
![]() |
e02fef8e2f | ||
![]() |
e352011830 | ||
![]() |
7f551ba776 | ||
![]() |
3838341d83 | ||
![]() |
adc5670ea9 | ||
![]() |
08130912f0 | ||
![]() |
371b97af27 | ||
![]() |
562cf14258 | ||
![]() |
c57ae7fc9c | ||
![]() |
6c91683380 | ||
![]() |
25f416c13d | ||
![]() |
8d91135926 | ||
![]() |
1bbb5c8107 | ||
![]() |
12a42a9295 | ||
![]() |
01cea0d9ef | ||
![]() |
f615eea7ee | ||
![]() |
cbbd3e366a | ||
![]() |
ede10dded0 | ||
![]() |
982d135ace | ||
![]() |
548c0f16f4 | ||
![]() |
bbd295ae09 | ||
![]() |
c55004864d | ||
![]() |
54685091f1 | ||
![]() |
d4a9535f04 | ||
![]() |
44477390a9 | ||
![]() |
caf27c4c16 | ||
![]() |
576e7a43df | ||
![]() |
c242558398 | ||
![]() |
8c9e827aab | ||
![]() |
2bcc9e2b86 | ||
![]() |
5c66afbf63 | ||
![]() |
84aeb8f715 | ||
![]() |
3738579dd3 | ||
![]() |
1ca60f424a |
@@ -1,20 +1,44 @@
|
||||
image: registry.gitlab.gnome.org/gnome/mutter/master:v1
|
||||
|
||||
stages:
|
||||
- review
|
||||
- build
|
||||
- test
|
||||
|
||||
check-commit-log:
|
||||
stage: review
|
||||
script:
|
||||
- ./.gitlab-ci/check-commit-log.sh
|
||||
only:
|
||||
- merge_requests
|
||||
|
||||
build-mutter:
|
||||
stage: build
|
||||
script:
|
||||
- meson . build -Degl_device=true -Dwayland_eglstream=true
|
||||
- meson . build -Dbuildtype=debugoptimized -Degl_device=true -Dwayland_eglstream=true --werror
|
||||
- ninja -C build
|
||||
- ninja -C build install
|
||||
artifacts:
|
||||
expire_in: 1 day
|
||||
paths:
|
||||
- build
|
||||
only:
|
||||
- merge_requests
|
||||
- /^.*$/
|
||||
|
||||
test-mutter:
|
||||
stage: test
|
||||
dependencies:
|
||||
- build-mutter
|
||||
variables:
|
||||
XDG_RUNTIME_DIR: "$CI_PROJECT_DIR/runtime-dir"
|
||||
GSETTINGS_SCHEMA_DIR: "$CI_PROJECT_DIR/build/data"
|
||||
script:
|
||||
- meson . build -Degl_device=true -Dwayland_eglstream=true
|
||||
- ninja -C build
|
||||
- glib-compile-schemas $PWD/build/data
|
||||
- env XDG_RUNTIME_DIR=/tmp/ GSETTINGS_SCHEMA_DIR=$PWD/build/data dbus-run-session -- xvfb-run -s '+iglx -noreset' meson test -C build -t 10 --verbose --no-stdsplit --wrap catchsegv
|
||||
- mkdir -m 700 $XDG_RUNTIME_DIR
|
||||
- glib-compile-schemas $GSETTINGS_SCHEMA_DIR
|
||||
- >
|
||||
dbus-run-session -- xvfb-run -s '+iglx -noreset'
|
||||
meson test -C build --no-rebuild -t 10 --verbose --no-stdsplit --wrap catchsegv
|
||||
only:
|
||||
- merge_requests
|
||||
- /^.*$/
|
||||
|
@@ -11,10 +11,7 @@ RUN dnf -y update && dnf -y upgrade && \
|
||||
dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 && \
|
||||
|
||||
# Unpackaged versions
|
||||
dnf install -y https://copr-be.cloud.fedoraproject.org/results/jadahl/mutter-ci/fedora-29-x86_64/00836095-gsettings-desktop-schemas/gsettings-desktop-schemas-3.30.1-1.20181206git918efdd69be53.fc29.x86_64.rpm https://copr-be.cloud.fedoraproject.org/results/jadahl/mutter-ci/fedora-29-x86_64/00836095-gsettings-desktop-schemas/gsettings-desktop-schemas-devel-3.30.1-1.20181206git918efdd69be53.fc29.x86_64.rpm && \
|
||||
|
||||
# Packages not yet in stable
|
||||
dnf install -y https://kojipkgs.fedoraproject.org//packages/pipewire/0.2.5/1.fc29/x86_64/pipewire-0.2.5-1.fc29.x86_64.rpm https://kojipkgs.fedoraproject.org//packages/pipewire/0.2.5/1.fc29/x86_64/pipewire-devel-0.2.5-1.fc29.x86_64.rpm https://kojipkgs.fedoraproject.org//packages/pipewire/0.2.5/1.fc29/x86_64/pipewire-libs-0.2.5-1.fc29.x86_64.rpm && \
|
||||
dnf install -y https://copr-be.cloud.fedoraproject.org/results/jadahl/mutter-ci/fedora-29-x86_64/00848426-gsettings-desktop-schemas/gsettings-desktop-schemas-3.30.1-1.20181206git918efdd69be53.fc29.x86_64.rpm https://copr-be.cloud.fedoraproject.org/results/jadahl/mutter-ci/fedora-29-x86_64/00848426-gsettings-desktop-schemas/gsettings-desktop-schemas-devel-3.30.1-1.20181206git918efdd69be53.fc29.x86_64.rpm && \
|
||||
|
||||
dnf install -y intltool redhat-rpm-config make && \
|
||||
dnf clean all
|
||||
|
31
.gitlab-ci/check-commit-log.sh
Executable file
31
.gitlab-ci/check-commit-log.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -z "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" ]; then
|
||||
echo Cannot review non-merge request
|
||||
exit 1
|
||||
fi
|
||||
|
||||
git fetch $CI_MERGE_REQUEST_PROJECT_URL.git $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
|
||||
|
||||
branch_point=$(git merge-base HEAD FETCH_HEAD)
|
||||
|
||||
commits=$(git log --format='format:%H' $branch_point..$CI_COMMIT_SHA)
|
||||
|
||||
if [ -z "$commits" ]; then
|
||||
echo Commit range empty
|
||||
exit 1
|
||||
fi
|
||||
|
||||
function commit_message_has_url() {
|
||||
commit=$1
|
||||
commit_message=$(git show -s --format='format:%b' $commit)
|
||||
echo "$commit_message" | grep -qe "\($CI_MERGE_REQUEST_PROJECT_URL/\(issues\|merge_requests\)/[0-9]\+\|https://bugzilla.gnome.org/show_bug.cgi?id=[0-9]\+\)"
|
||||
return $?
|
||||
}
|
||||
|
||||
for commit in $commits; do
|
||||
if ! commit_message_has_url $commit; then
|
||||
echo "Missing merge request or issue URL on commit $(echo $commit | cut -c -8)"
|
||||
exit 1
|
||||
fi
|
||||
done
|
48
NEWS
48
NEWS
@@ -1,3 +1,51 @@
|
||||
3.31.91
|
||||
=======
|
||||
* Fix infinite loop in EDID matching [Marco; #459]
|
||||
* wayland: Don't resetin text-input state prematurely [Carlos; !410]
|
||||
* wayland: Don't maximize windows if minimum size is too big [Olivier; #463]
|
||||
* Fix crash when using "restore shortcuts" without focus window [Olivier; #464]
|
||||
* Add flag parameter to grab accelerator API [Andrea; !169]
|
||||
* Reuse old CRTC if possible to avoid flicker on hotplug [Pekka, Emilio; #373]
|
||||
* Misc. bug fixes and cleanups [Marco, Jonas, Niels, Adam, Olivier; !436,
|
||||
!421, #462, !439, !440, !444, !321, !445, !456]
|
||||
|
||||
Contributors:
|
||||
Jonas Ådahl, Andrea Azzarone, Olivier Fourdan, Carlos Garnacho,
|
||||
Niels De Graef, Adam Jackson, Emilio Pozuelo Monfort, Pekka Paalanen,
|
||||
Marco Trevisan (Treviño)
|
||||
|
||||
Translators:
|
||||
Jiri Grönroos [fi], Charles Monzat [fr], Claude Paroz [fr], Fran Dieguez [gl],
|
||||
Emin Tufan Çetin [tr], Aurimas Černius [lt], Anders Jonsson [sv],
|
||||
Matej Urbančič [sl], Marek Cernocky [cs], Daniel Șerbănescu [ro],
|
||||
Alan Mortensen [da], Baurzhan Muftakhidinov [kk], Yi-Jyun Pan [zh_TW],
|
||||
Daniel Mustieles [es], Rafael Fontenelle [pt_BR]
|
||||
|
||||
3.31.90
|
||||
=======
|
||||
* Fix support of extended characters in on-screen keyboard [Andrea; #109]
|
||||
* Improve selection of the primary GPU [Pekka, Emilio; !271]
|
||||
* Screen-cast cursor updates as PipeWire stream metadata [Jonas; !357]
|
||||
* Fix rendering glitches in magnifier [Daniel; gnome-shell#387]
|
||||
* Fix monitor recording on HiDPI [Jonas; !415]
|
||||
* Honour secondary GPU supported pixel formats [Pekka; !341]
|
||||
* Fall back to CPU copy path when using a software renderer [Emilio; !325]
|
||||
* Remove fallback app menu [Florian; gnome-shell#624]
|
||||
* wayland: Add support for viewporter protocol [Robert; !323]
|
||||
* Misc. bug fixes and cleanups [Florian, Carlos, Olivier, Marco, Robert,
|
||||
Daniel, Pekka, Jonas, Ole, Georges; !391, #335, #442, !406, !395, #447,
|
||||
!375, gnome-shell#349, #451, !416, #784199, !408, !181, !405]
|
||||
|
||||
Contributors:
|
||||
Jonas Ådahl, Andrea Azzarone, Ole Jørgen Brønner, Piotr Drąg, Olivier Fourdan,
|
||||
Dariusz Gadomski, Carlos Garnacho, Antoine Jacoutot, Iain Lane, Robert Mader,
|
||||
Emilio Pozuelo Monfort, Florian Müllner, Georges Basile Stavracas Neto,
|
||||
Pekka Paalanen, Marco Trevisan (Treviño), Josh Triplett, Daniel van Vugt
|
||||
|
||||
Translators:
|
||||
Fabio Tomat [fur], Balázs Úr [hu], Daniel Mustieles [es], Kukuh Syafaat [id],
|
||||
Jordi Mas [ca], Piotr Drąg [pl]
|
||||
|
||||
3.31.4
|
||||
======
|
||||
* keybindings: Limit corner move to current monitor [Jānis; #320]
|
||||
|
14
README.md
14
README.md
@@ -22,6 +22,20 @@ by Gala, elementary OS's window manager. It can also be run standalone, using
|
||||
the command "mutter", but just running plain mutter is only intended for
|
||||
debugging purposes.
|
||||
|
||||
## Contributing
|
||||
|
||||
To contribute, open merge requests at https://gitlab.gnome.org/GNOME/mutter.
|
||||
|
||||
The coding style used is primarily the GNU flavor of the [GNOME coding
|
||||
style](https://developer.gnome.org/programming-guidelines/stable/c-coding-style.html.en)
|
||||
with some minor additions such as preferring `stdint.h` types over GLib
|
||||
fundamental types, and a soft 80 character line limit. However, in general,
|
||||
look at the file you're editing for inspiration.
|
||||
|
||||
Commit messages should follow the [GNOME commit message
|
||||
guidelines](https://wiki.gnome.org/Git/CommitMessages). We require an URL
|
||||
to either an issue or a merge request in each commit.
|
||||
|
||||
## License
|
||||
|
||||
Mutter is distributed under the terms of the GNU General Public License,
|
||||
|
12
clutter/clutter/clutter-actor-box-private.h
Normal file
12
clutter/clutter/clutter-actor-box-private.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#ifndef __CLUTTER_ACTOR_BOX_PRIVATE_H__
|
||||
#define __CLUTTER_ACTOR_BOX_PRIVATE_H__
|
||||
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void _clutter_actor_box_enlarge_for_effects (ClutterActorBox *box);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_ACTOR_BOX_PRIVATE_H__ */
|
@@ -5,6 +5,7 @@
|
||||
#include "clutter-types.h"
|
||||
#include "clutter-interval.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-actor-box-private.h"
|
||||
|
||||
/**
|
||||
* clutter_actor_box_new:
|
||||
@@ -542,6 +543,57 @@ clutter_actor_box_set_size (ClutterActorBox *box,
|
||||
box->y2 = box->y1 + height;
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_actor_box_enlarge_for_effects (ClutterActorBox *box)
|
||||
{
|
||||
float width, height;
|
||||
|
||||
/* The aim here is that for a given rectangle defined with floating point
|
||||
* coordinates we want to determine a stable quantized size in pixels
|
||||
* that doesn't vary due to the original box's sub-pixel position.
|
||||
*
|
||||
* The reason this is important is because effects will use this
|
||||
* API to determine the size of offscreen framebuffers and so for
|
||||
* a fixed-size object that may be animated accross the screen we
|
||||
* want to make sure that the stage paint-box has an equally stable
|
||||
* size so that effects aren't made to continuously re-allocate
|
||||
* a corresponding fbo.
|
||||
*
|
||||
* The other thing we consider is that the calculation of this box is
|
||||
* subject to floating point precision issues that might be slightly
|
||||
* different to the precision issues involved with actually painting the
|
||||
* actor, which might result in painting slightly leaking outside the
|
||||
* user's calculated paint-volume. For this we simply aim to pad out the
|
||||
* paint-volume by at least half a pixel all the way around.
|
||||
*/
|
||||
width = box->x2 - box->x1;
|
||||
height = box->y2 - box->y1;
|
||||
width = CLUTTER_NEARBYINT (width);
|
||||
height = CLUTTER_NEARBYINT (height);
|
||||
/* XXX: NB the width/height may now be up to 0.5px too small so we
|
||||
* must also pad by 0.25px all around to account for this. In total we
|
||||
* must padd by at least 0.75px around all sides. */
|
||||
|
||||
/* XXX: The furthest that we can overshoot the bottom right corner by
|
||||
* here is 1.75px in total if you consider that the 0.75 padding could
|
||||
* just cross an integer boundary and so ceil will effectively add 1.
|
||||
*/
|
||||
box->x2 = ceilf (box->x2 + 0.75);
|
||||
box->y2 = ceilf (box->y2 + 0.75);
|
||||
|
||||
/* Now we redefine the top-left relative to the bottom right based on the
|
||||
* rounded width/height determined above + a constant so that the overall
|
||||
* size of the box will be stable and not dependant on the box's
|
||||
* position.
|
||||
*
|
||||
* Adding 3px to the width/height will ensure we cover the maximum of
|
||||
* 1.75px padding on the bottom/right and still ensure we have > 0.75px
|
||||
* padding on the top/left.
|
||||
*/
|
||||
box->x1 = box->x2 - width - 3;
|
||||
box->y1 = box->y2 - height - 3;
|
||||
}
|
||||
|
||||
G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterActorBox, clutter_actor_box,
|
||||
clutter_actor_box_copy,
|
||||
clutter_actor_box_free,
|
||||
|
@@ -3740,7 +3740,7 @@ clutter_actor_paint_node (ClutterActor *actor,
|
||||
if (!clutter_stage_get_no_clear_hint (CLUTTER_STAGE (actor)))
|
||||
clear_flags |= COGL_BUFFER_BIT_COLOR;
|
||||
|
||||
node = _clutter_root_node_new (fb, &bg_color, clear_flags);
|
||||
node = clutter_root_node_new (fb, &bg_color, clear_flags);
|
||||
clutter_paint_node_set_name (node, "stageClear");
|
||||
clutter_paint_node_add_rectangle (node, &box);
|
||||
clutter_paint_node_add_child (root, node);
|
||||
@@ -3779,7 +3779,7 @@ clutter_actor_paint_node (ClutterActor *actor,
|
||||
}
|
||||
#endif /* CLUTTER_ENABLE_DEBUG */
|
||||
|
||||
_clutter_paint_node_paint (root);
|
||||
clutter_paint_node_paint (root);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -18467,6 +18467,10 @@ clutter_actor_set_margin_top (ClutterActor *self,
|
||||
g_return_if_fail (margin >= 0.f);
|
||||
|
||||
info = _clutter_actor_get_layout_info_or_defaults (self);
|
||||
|
||||
if (info->margin.top == margin)
|
||||
return;
|
||||
|
||||
_clutter_actor_create_transition (self, obj_props[PROP_MARGIN_TOP],
|
||||
info->margin.top,
|
||||
margin);
|
||||
@@ -18511,6 +18515,10 @@ clutter_actor_set_margin_bottom (ClutterActor *self,
|
||||
g_return_if_fail (margin >= 0.f);
|
||||
|
||||
info = _clutter_actor_get_layout_info_or_defaults (self);
|
||||
|
||||
if (info->margin.bottom == margin)
|
||||
return;
|
||||
|
||||
_clutter_actor_create_transition (self, obj_props[PROP_MARGIN_BOTTOM],
|
||||
info->margin.bottom,
|
||||
margin);
|
||||
@@ -18555,6 +18563,10 @@ clutter_actor_set_margin_left (ClutterActor *self,
|
||||
g_return_if_fail (margin >= 0.f);
|
||||
|
||||
info = _clutter_actor_get_layout_info_or_defaults (self);
|
||||
|
||||
if (info->margin.left == margin)
|
||||
return;
|
||||
|
||||
_clutter_actor_create_transition (self, obj_props[PROP_MARGIN_LEFT],
|
||||
info->margin.left,
|
||||
margin);
|
||||
@@ -18599,6 +18611,10 @@ clutter_actor_set_margin_right (ClutterActor *self,
|
||||
g_return_if_fail (margin >= 0.f);
|
||||
|
||||
info = _clutter_actor_get_layout_info_or_defaults (self);
|
||||
|
||||
if (info->margin.right == margin)
|
||||
return;
|
||||
|
||||
_clutter_actor_create_transition (self, obj_props[PROP_MARGIN_RIGHT],
|
||||
info->margin.right,
|
||||
margin);
|
||||
|
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <clutter/clutter-backend.h>
|
||||
#include <clutter/clutter-device-manager.h>
|
||||
#include <clutter/clutter-keymap.h>
|
||||
#include <clutter/clutter-stage-window.h>
|
||||
|
||||
#include "clutter-event-translator.h"
|
||||
@@ -60,6 +61,8 @@ struct _ClutterBackend
|
||||
GList *event_translators;
|
||||
|
||||
ClutterInputMethod *input_method;
|
||||
|
||||
ClutterKeymap *keymap;
|
||||
};
|
||||
|
||||
struct _ClutterBackendClass
|
||||
@@ -104,6 +107,8 @@ struct _ClutterBackendClass
|
||||
|
||||
void (* bell_notify) (ClutterBackend *backend);
|
||||
|
||||
ClutterKeymap * (* get_keymap) (ClutterBackend *backend);
|
||||
|
||||
/* signals */
|
||||
void (* resolution_changed) (ClutterBackend *backend);
|
||||
void (* font_changed) (ClutterBackend *backend);
|
||||
|
@@ -53,9 +53,6 @@
|
||||
#include "clutter-stage-window.h"
|
||||
#include "clutter-device-manager-private.h"
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include "deprecated/clutter-backend.h"
|
||||
|
||||
#ifdef CLUTTER_HAS_WAYLAND_COMPOSITOR_SUPPORT
|
||||
#include "wayland/clutter-wayland-compositor.h"
|
||||
#endif
|
||||
@@ -577,6 +574,18 @@ clutter_backend_real_get_device_manager (ClutterBackend *backend)
|
||||
return backend->device_manager;
|
||||
}
|
||||
|
||||
static ClutterKeymap *
|
||||
clutter_backend_real_get_keymap (ClutterBackend *backend)
|
||||
{
|
||||
if (G_UNLIKELY (backend->keymap == NULL))
|
||||
{
|
||||
g_critical ("No keymap available, expect broken keyboard input");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return backend->keymap;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_backend_real_translate_event (ClutterBackend *backend,
|
||||
gpointer native,
|
||||
@@ -675,6 +684,7 @@ clutter_backend_class_init (ClutterBackendClass *klass)
|
||||
klass->translate_event = clutter_backend_real_translate_event;
|
||||
klass->create_context = clutter_backend_real_create_context;
|
||||
klass->get_features = clutter_backend_real_get_features;
|
||||
klass->get_keymap = clutter_backend_real_get_keymap;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -890,129 +900,6 @@ clutter_get_default_backend (void)
|
||||
return clutter_context->backend;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_backend_set_double_click_time:
|
||||
* @backend: a #ClutterBackend
|
||||
* @msec: milliseconds between two button press events
|
||||
*
|
||||
* Sets the maximum time between two button press events, used to
|
||||
* verify whether it's a double click event or not.
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.4: Use #ClutterSettings:double-click-time instead
|
||||
*/
|
||||
void
|
||||
clutter_backend_set_double_click_time (ClutterBackend *backend,
|
||||
guint msec)
|
||||
{
|
||||
ClutterSettings *settings = clutter_settings_get_default ();
|
||||
|
||||
g_object_set (settings, "double-click-time", msec, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_backend_get_double_click_time:
|
||||
* @backend: a #ClutterBackend
|
||||
*
|
||||
* Gets the maximum time between two button press events, as set
|
||||
* by clutter_backend_set_double_click_time().
|
||||
*
|
||||
* Return value: a time in milliseconds
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.4: Use #ClutterSettings:double-click-time instead
|
||||
*/
|
||||
guint
|
||||
clutter_backend_get_double_click_time (ClutterBackend *backend)
|
||||
{
|
||||
ClutterSettings *settings = clutter_settings_get_default ();
|
||||
gint retval;
|
||||
|
||||
g_object_get (settings, "double-click-time", &retval, NULL);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_backend_set_double_click_distance:
|
||||
* @backend: a #ClutterBackend
|
||||
* @distance: a distance, in pixels
|
||||
*
|
||||
* Sets the maximum distance used to verify a double click event.
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.4: Use #ClutterSettings:double-click-distance instead
|
||||
*/
|
||||
void
|
||||
clutter_backend_set_double_click_distance (ClutterBackend *backend,
|
||||
guint distance)
|
||||
{
|
||||
ClutterSettings *settings = clutter_settings_get_default ();
|
||||
|
||||
g_object_set (settings, "double-click-distance", distance, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_backend_get_double_click_distance:
|
||||
* @backend: a #ClutterBackend
|
||||
*
|
||||
* Retrieves the distance used to verify a double click event
|
||||
*
|
||||
* Return value: a distance, in pixels.
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.4: Use #ClutterSettings:double-click-distance instead
|
||||
*/
|
||||
guint
|
||||
clutter_backend_get_double_click_distance (ClutterBackend *backend)
|
||||
{
|
||||
ClutterSettings *settings = clutter_settings_get_default ();
|
||||
gint retval;
|
||||
|
||||
g_object_get (settings, "double-click-distance", &retval, NULL);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_backend_set_resolution:
|
||||
* @backend: a #ClutterBackend
|
||||
* @dpi: the resolution in "dots per inch" (Physical inches aren't
|
||||
* actually involved; the terminology is conventional).
|
||||
*
|
||||
* Sets the resolution for font handling on the screen. This is a
|
||||
* scale factor between points specified in a #PangoFontDescription
|
||||
* and cairo units. The default value is 96, meaning that a 10 point
|
||||
* font will be 13 units high. (10 * 96. / 72. = 13.3).
|
||||
*
|
||||
* Applications should never need to call this function.
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.4: Use #ClutterSettings:font-dpi instead
|
||||
*/
|
||||
void
|
||||
clutter_backend_set_resolution (ClutterBackend *backend,
|
||||
gdouble dpi)
|
||||
{
|
||||
ClutterSettings *settings;
|
||||
gint resolution;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BACKEND (backend));
|
||||
|
||||
if (dpi < 0)
|
||||
resolution = -1;
|
||||
else
|
||||
resolution = dpi * 1024;
|
||||
|
||||
settings = clutter_settings_get_default ();
|
||||
g_object_set (settings, "font-dpi", resolution, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_backend_get_resolution:
|
||||
* @backend: a #ClutterBackend
|
||||
@@ -1118,61 +1005,6 @@ clutter_backend_get_font_options (ClutterBackend *backend)
|
||||
return backend->font_options;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_backend_set_font_name:
|
||||
* @backend: a #ClutterBackend
|
||||
* @font_name: the name of the font
|
||||
*
|
||||
* Sets the default font to be used by Clutter. The @font_name string
|
||||
* must either be %NULL, which means that the font name from the
|
||||
* default #ClutterBackend will be used; or be something that can
|
||||
* be parsed by the pango_font_description_from_string() function.
|
||||
*
|
||||
* Since: 1.0
|
||||
*
|
||||
* Deprecated: 1.4: Use #ClutterSettings:font-name instead
|
||||
*/
|
||||
void
|
||||
clutter_backend_set_font_name (ClutterBackend *backend,
|
||||
const gchar *font_name)
|
||||
{
|
||||
ClutterSettings *settings = clutter_settings_get_default ();
|
||||
|
||||
g_object_set (settings, "font-name", font_name, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_backend_get_font_name:
|
||||
* @backend: a #ClutterBackend
|
||||
*
|
||||
* Retrieves the default font name as set by
|
||||
* clutter_backend_set_font_name().
|
||||
*
|
||||
* Return value: the font name for the backend. The returned string is
|
||||
* owned by the #ClutterBackend and should never be modified or freed
|
||||
*
|
||||
* Since: 1.0
|
||||
*
|
||||
* Deprecated: 1.4: Use #ClutterSettings:font-name instead
|
||||
*/
|
||||
const gchar *
|
||||
clutter_backend_get_font_name (ClutterBackend *backend)
|
||||
{
|
||||
ClutterSettings *settings;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_BACKEND (backend), NULL);
|
||||
|
||||
settings = clutter_settings_get_default ();
|
||||
|
||||
/* XXX yuck. but we return a const pointer, so we need to
|
||||
* store it in the backend
|
||||
*/
|
||||
g_free (backend->font_name);
|
||||
g_object_get (settings, "font-name", &backend->font_name, NULL);
|
||||
|
||||
return backend->font_name;
|
||||
}
|
||||
|
||||
gint32
|
||||
_clutter_backend_get_units_serial (ClutterBackend *backend)
|
||||
{
|
||||
@@ -1399,3 +1231,17 @@ clutter_backend_set_input_method (ClutterBackend *backend,
|
||||
{
|
||||
g_set_object (&backend->input_method, method);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_backend_get_keymap:
|
||||
* @backend: the #ClutterBackend
|
||||
*
|
||||
* Gets the keymap used by Clutter
|
||||
*
|
||||
* Returns: (transfer none): the keymap
|
||||
**/
|
||||
ClutterKeymap *
|
||||
clutter_backend_get_keymap (ClutterBackend *backend)
|
||||
{
|
||||
return CLUTTER_BACKEND_GET_CLASS (backend)->get_keymap (backend);
|
||||
}
|
||||
|
@@ -34,6 +34,7 @@
|
||||
#include <cogl/cogl.h>
|
||||
|
||||
#include <clutter/clutter-config.h>
|
||||
#include <clutter/clutter-keymap.h>
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
@@ -83,6 +84,9 @@ ClutterInputMethod * clutter_backend_get_input_method (Clutter
|
||||
CLUTTER_EXPORT
|
||||
void clutter_backend_set_input_method (ClutterBackend *backend,
|
||||
ClutterInputMethod *method);
|
||||
CLUTTER_EXPORT
|
||||
ClutterKeymap * clutter_backend_get_keymap (ClutterBackend *backend);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BACKEND_H__ */
|
||||
|
@@ -36,7 +36,7 @@ G_BEGIN_DECLS
|
||||
|
||||
typedef struct _ClutterBezier ClutterBezier;
|
||||
|
||||
ClutterBezier *_clutter_bezier_new ();
|
||||
ClutterBezier *_clutter_bezier_new (void);
|
||||
|
||||
void _clutter_bezier_free (ClutterBezier * b);
|
||||
|
||||
|
@@ -150,9 +150,9 @@ typedef struct _RequestedSize
|
||||
gfloat natural_size;
|
||||
} RequestedSize;
|
||||
|
||||
static gint distribute_natural_allocation (gint extra_space,
|
||||
guint n_requested_sizes,
|
||||
RequestedSize *sizes);
|
||||
static float distribute_natural_allocation (float extra_space,
|
||||
unsigned int n_requested_sizes,
|
||||
RequestedSize *sizes);
|
||||
static void count_expand_children (ClutterLayoutManager *layout,
|
||||
ClutterContainer *container,
|
||||
gint *visible_children,
|
||||
@@ -624,7 +624,19 @@ get_preferred_size_for_opposite_orientation (ClutterBoxLayout *self,
|
||||
else
|
||||
{
|
||||
/* Bring children up to size first */
|
||||
size = distribute_natural_allocation (MAX (0, size), nvis_children, sizes);
|
||||
if (isnormal (size) || size == 0)
|
||||
{
|
||||
size = distribute_natural_allocation (MAX (0, size),
|
||||
nvis_children,
|
||||
sizes);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_critical ("Actor %s (%p) received the invalid "
|
||||
"value %f as minimum/natural size\n",
|
||||
G_OBJECT_TYPE_NAME (container), container, size);
|
||||
size = 0;
|
||||
}
|
||||
|
||||
/* Calculate space which hasn't distributed yet,
|
||||
* and is available for expanding children.
|
||||
@@ -879,17 +891,18 @@ compare_gap (gconstpointer p1,
|
||||
*
|
||||
* Pulled from gtksizerequest.c from Gtk+
|
||||
*/
|
||||
static gint
|
||||
distribute_natural_allocation (gint extra_space,
|
||||
guint n_requested_sizes,
|
||||
static float
|
||||
distribute_natural_allocation (float extra_space,
|
||||
unsigned int n_requested_sizes,
|
||||
RequestedSize *sizes)
|
||||
{
|
||||
guint *spreading;
|
||||
gint i;
|
||||
unsigned int *spreading;
|
||||
int i;
|
||||
|
||||
g_return_val_if_fail (isnormal (extra_space) || extra_space == 0, 0);
|
||||
g_return_val_if_fail (extra_space >= 0, 0);
|
||||
|
||||
spreading = g_newa (guint, n_requested_sizes);
|
||||
spreading = g_newa (unsigned int, n_requested_sizes);
|
||||
|
||||
for (i = 0; i < n_requested_sizes; i++)
|
||||
spreading[i] = i;
|
||||
@@ -913,7 +926,7 @@ distribute_natural_allocation (gint extra_space,
|
||||
|
||||
/* Sort descending by gap and position. */
|
||||
g_qsort_with_data (spreading,
|
||||
n_requested_sizes, sizeof (guint),
|
||||
n_requested_sizes, sizeof (unsigned int),
|
||||
compare_gap, sizes);
|
||||
|
||||
/* Distribute available space.
|
||||
@@ -925,11 +938,11 @@ distribute_natural_allocation (gint extra_space,
|
||||
* Sort order and reducing remaining space by assigned space
|
||||
* ensures that space is distributed equally.
|
||||
*/
|
||||
gint glue = (extra_space + i) / (i + 1);
|
||||
gint gap = sizes[(spreading[i])].natural_size
|
||||
- sizes[(spreading[i])].minimum_size;
|
||||
int glue = (extra_space + i) / (i + 1);
|
||||
int gap = sizes[(spreading[i])].natural_size
|
||||
- sizes[(spreading[i])].minimum_size;
|
||||
|
||||
gint extra = MIN (glue, gap);
|
||||
int extra = MIN (glue, gap);
|
||||
|
||||
sizes[spreading[i]].minimum_size += extra;
|
||||
|
||||
@@ -1056,7 +1069,9 @@ clutter_box_layout_allocate (ClutterLayoutManager *layout,
|
||||
else
|
||||
{
|
||||
/* Bring children up to size first */
|
||||
size = distribute_natural_allocation (MAX (0, size), nvis_children, sizes);
|
||||
size = (gint) distribute_natural_allocation (MAX (0, (float) size),
|
||||
nvis_children,
|
||||
sizes);
|
||||
|
||||
/* Calculate space which hasn't distributed yet,
|
||||
* and is available for expanding children.
|
||||
|
@@ -38,6 +38,7 @@
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter-actor-private.h"
|
||||
#include "clutter-content-private.h"
|
||||
|
||||
#include "clutter-debug.h"
|
||||
@@ -91,6 +92,11 @@ clutter_content_real_invalidate (ClutterContent *content)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_content_real_invalidate_size (ClutterContent *content)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_content_real_paint_content (ClutterContent *content,
|
||||
ClutterActor *actor,
|
||||
@@ -108,6 +114,7 @@ clutter_content_default_init (ClutterContentInterface *iface)
|
||||
iface->attached = clutter_content_real_attached;
|
||||
iface->detached = clutter_content_real_detached;
|
||||
iface->invalidate = clutter_content_real_invalidate;
|
||||
iface->invalidate_size = clutter_content_real_invalidate_size;
|
||||
|
||||
/**
|
||||
* ClutterContent::attached:
|
||||
@@ -188,6 +195,45 @@ clutter_content_invalidate (ClutterContent *content)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_content_invalidate_size:
|
||||
* @content: a #ClutterContent
|
||||
*
|
||||
* Signals that @content's size changed. Attached actors with request mode
|
||||
* set to %CLUTTER_REQUEST_CONTENT_SIZE will have a relayout queued.
|
||||
*
|
||||
* Attached actors with other request modes are not redrawn. To redraw them
|
||||
* too, use clutter_content_invalidate().
|
||||
*/
|
||||
void
|
||||
clutter_content_invalidate_size (ClutterContent *content)
|
||||
{
|
||||
ClutterActor *actor;
|
||||
GHashTable *actors;
|
||||
GHashTableIter iter;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_CONTENT (content));
|
||||
|
||||
CLUTTER_CONTENT_GET_IFACE (content)->invalidate_size (content);
|
||||
|
||||
actors = g_object_get_qdata (G_OBJECT (content), quark_content_actors);
|
||||
if (actors == NULL)
|
||||
return;
|
||||
|
||||
g_hash_table_iter_init (&iter, actors);
|
||||
while (g_hash_table_iter_next (&iter, (gpointer *) &actor, NULL))
|
||||
{
|
||||
ClutterRequestMode request_mode;
|
||||
|
||||
g_assert (actor != NULL);
|
||||
|
||||
request_mode = clutter_actor_get_request_mode (actor);
|
||||
|
||||
if (request_mode == CLUTTER_REQUEST_CONTENT_SIZE)
|
||||
_clutter_actor_queue_only_relayout (actor);
|
||||
}
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* _clutter_content_attached:
|
||||
* @content: a #ClutterContent
|
||||
|
@@ -86,6 +86,8 @@ struct _ClutterContentIface
|
||||
ClutterActor *actor);
|
||||
|
||||
void (* invalidate) (ClutterContent *content);
|
||||
|
||||
void (* invalidate_size) (ClutterContent *content);
|
||||
};
|
||||
|
||||
CLUTTER_EXPORT
|
||||
@@ -98,6 +100,9 @@ gboolean clutter_content_get_preferred_size (ClutterContent *content
|
||||
CLUTTER_EXPORT
|
||||
void clutter_content_invalidate (ClutterContent *content);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_content_invalidate_size (ClutterContent *content);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_CONTENT_H__ */
|
||||
|
@@ -80,9 +80,9 @@ extern guint clutter_pick_debug_flags;
|
||||
extern guint clutter_paint_debug_flags;
|
||||
|
||||
void _clutter_debug_messagev (const char *format,
|
||||
va_list var_args);
|
||||
va_list var_args) G_GNUC_PRINTF (1, 0);
|
||||
void _clutter_debug_message (const char *format,
|
||||
...);
|
||||
...) G_GNUC_PRINTF (1, 2);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@@ -8,7 +8,6 @@
|
||||
#include "deprecated/clutter-animatable.h"
|
||||
#include "deprecated/clutter-animation.h"
|
||||
#include "deprecated/clutter-animator.h"
|
||||
#include "deprecated/clutter-backend.h"
|
||||
#include "deprecated/clutter-behaviour.h"
|
||||
#include "deprecated/clutter-behaviour-depth.h"
|
||||
#include "deprecated/clutter-behaviour-ellipse.h"
|
||||
@@ -20,7 +19,6 @@
|
||||
#include "deprecated/clutter-box.h"
|
||||
#include "deprecated/clutter-cairo-texture.h"
|
||||
#include "deprecated/clutter-container.h"
|
||||
#include "deprecated/clutter-frame-source.h"
|
||||
#include "deprecated/clutter-group.h"
|
||||
#include "deprecated/clutter-input-device.h"
|
||||
#include "deprecated/clutter-keysyms.h"
|
||||
@@ -36,8 +34,6 @@
|
||||
#include "deprecated/clutter-table-layout.h"
|
||||
#include "deprecated/clutter-texture.h"
|
||||
#include "deprecated/clutter-timeline.h"
|
||||
#include "deprecated/clutter-timeout-pool.h"
|
||||
#include "deprecated/clutter-util.h"
|
||||
|
||||
#undef __CLUTTER_DEPRECATED_H_INSIDE__
|
||||
|
||||
|
@@ -772,7 +772,10 @@ void clutter_event_get_gesture_motion_delta (const Clut
|
||||
gdouble *dx,
|
||||
gdouble *dy);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterScrollSource clutter_event_get_scroll_source (const ClutterEvent *event);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterScrollFinishFlags clutter_event_get_scroll_finish_flags (const ClutterEvent *event);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
|
@@ -53,6 +53,8 @@
|
||||
struct _ClutterImagePrivate
|
||||
{
|
||||
CoglTexture *texture;
|
||||
gint width;
|
||||
gint height;
|
||||
};
|
||||
|
||||
static void clutter_content_iface_init (ClutterContentIface *iface);
|
||||
@@ -68,6 +70,27 @@ clutter_image_error_quark (void)
|
||||
return g_quark_from_static_string ("clutter-image-error-quark");
|
||||
}
|
||||
|
||||
static void
|
||||
update_image_size (ClutterImage *self)
|
||||
{
|
||||
gint width, height;
|
||||
|
||||
if (self->priv->texture == NULL)
|
||||
return;
|
||||
|
||||
width = cogl_texture_get_width (self->priv->texture);
|
||||
height = cogl_texture_get_height (self->priv->texture);
|
||||
|
||||
if (self->priv->width == width &&
|
||||
self->priv->height == height)
|
||||
return;
|
||||
|
||||
self->priv->width = width;
|
||||
self->priv->height = height;
|
||||
|
||||
clutter_content_invalidate_size (CLUTTER_CONTENT (self));
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_image_finalize (GObject *gobject)
|
||||
{
|
||||
@@ -238,6 +261,7 @@ clutter_image_set_data (ClutterImage *image,
|
||||
}
|
||||
|
||||
clutter_content_invalidate (CLUTTER_CONTENT (image));
|
||||
update_image_size (image);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -306,6 +330,7 @@ clutter_image_set_bytes (ClutterImage *image,
|
||||
}
|
||||
|
||||
clutter_content_invalidate (CLUTTER_CONTENT (image));
|
||||
update_image_size (image);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -399,6 +424,7 @@ clutter_image_set_area (ClutterImage *image,
|
||||
}
|
||||
|
||||
clutter_content_invalidate (CLUTTER_CONTENT (image));
|
||||
update_image_size (image);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
64
clutter/clutter/clutter-keymap.c
Normal file
64
clutter/clutter/clutter-keymap.c
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Red Hat
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* Author: Carlos Garnacho <carlosg@gnome.org>
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter-keymap.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE (ClutterKeymap, clutter_keymap, G_TYPE_OBJECT)
|
||||
|
||||
enum
|
||||
{
|
||||
STATE_CHANGED,
|
||||
N_SIGNALS
|
||||
};
|
||||
|
||||
static guint signals[N_SIGNALS] = { 0, };
|
||||
|
||||
static void
|
||||
clutter_keymap_class_init (ClutterKeymapClass *klass)
|
||||
{
|
||||
signals[STATE_CHANGED] =
|
||||
g_signal_new (I_("state-changed"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
0, NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_keymap_init (ClutterKeymap *keymap)
|
||||
{
|
||||
}
|
||||
|
||||
gboolean
|
||||
clutter_keymap_get_num_lock_state (ClutterKeymap *keymap)
|
||||
{
|
||||
return CLUTTER_KEYMAP_GET_CLASS (keymap)->get_num_lock_state (keymap);
|
||||
}
|
||||
|
||||
gboolean
|
||||
clutter_keymap_get_caps_lock_state (ClutterKeymap *keymap)
|
||||
{
|
||||
return CLUTTER_KEYMAP_GET_CLASS (keymap)->get_caps_lock_state (keymap);
|
||||
}
|
56
clutter/clutter/clutter-keymap.h
Normal file
56
clutter/clutter/clutter-keymap.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Red Hat
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* Author: Carlos Garnacho <carlosg@gnome.org>
|
||||
*/
|
||||
|
||||
#ifndef CLUTTER_KEYMAP_H
|
||||
#define CLUTTER_KEYMAP_H
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <clutter/clutter-macros.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
typedef struct _ClutterKeymap ClutterKeymap;
|
||||
typedef struct _ClutterKeymapClass ClutterKeymapClass;
|
||||
|
||||
struct _ClutterKeymapClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
gboolean (* get_num_lock_state) (ClutterKeymap *keymap);
|
||||
gboolean (* get_caps_lock_state) (ClutterKeymap *keymap);
|
||||
};
|
||||
|
||||
#define CLUTTER_TYPE_KEYMAP (clutter_keymap_get_type ())
|
||||
CLUTTER_EXPORT
|
||||
G_DECLARE_DERIVABLE_TYPE (ClutterKeymap, clutter_keymap,
|
||||
CLUTTER, KEYMAP,
|
||||
GObject)
|
||||
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_keymap_get_num_lock_state (ClutterKeymap *keymap);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_keymap_get_caps_lock_state (ClutterKeymap *keymap);
|
||||
|
||||
#endif /* CLUTTER_KEYMAP_H */
|
@@ -72,6 +72,8 @@
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-stage-private.h"
|
||||
#include "clutter-paint-volume-private.h"
|
||||
#include "clutter-actor-box-private.h"
|
||||
|
||||
struct _ClutterOffscreenEffectPrivate
|
||||
{
|
||||
@@ -82,8 +84,10 @@ struct _ClutterOffscreenEffectPrivate
|
||||
ClutterActor *actor;
|
||||
ClutterActor *stage;
|
||||
|
||||
gfloat x_offset;
|
||||
gfloat y_offset;
|
||||
ClutterVertex position;
|
||||
|
||||
int fbo_offset_x;
|
||||
int fbo_offset_y;
|
||||
|
||||
/* This is the calculated size of the fbo before being passed
|
||||
through create_texture(). This needs to be tracked separately so
|
||||
@@ -93,16 +97,6 @@ struct _ClutterOffscreenEffectPrivate
|
||||
int fbo_height;
|
||||
|
||||
gint old_opacity_override;
|
||||
|
||||
/* The matrix that was current the last time the fbo was updated. We
|
||||
need to keep track of this to detect when we can reuse the
|
||||
contents of the fbo without redrawing the actor. We need the
|
||||
actual matrix rather than just detecting queued redraws on the
|
||||
actor because any change in the parent hierarchy (even just a
|
||||
translation) could cause the actor to look completely different
|
||||
and it won't cause a redraw to be queued on the parent's
|
||||
children. */
|
||||
CoglMatrix last_matrix_drawn;
|
||||
};
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterOffscreenEffect,
|
||||
@@ -222,15 +216,15 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
|
||||
{
|
||||
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
|
||||
ClutterOffscreenEffectPrivate *priv = self->priv;
|
||||
ClutterActorBox box;
|
||||
ClutterActorBox raw_box, box;
|
||||
ClutterActor *stage;
|
||||
CoglMatrix projection;
|
||||
CoglMatrix projection, old_modelview, modelview;
|
||||
const ClutterPaintVolume *volume;
|
||||
CoglColor transparent;
|
||||
gfloat stage_width, stage_height;
|
||||
gfloat fbo_width = -1, fbo_height = -1;
|
||||
gfloat width, height;
|
||||
gfloat xexpand, yexpand;
|
||||
int texture_width, texture_height;
|
||||
ClutterVertex local_offset = { 0.f, 0.f, 0.f };
|
||||
gfloat old_viewport[4];
|
||||
|
||||
if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (effect)))
|
||||
return FALSE;
|
||||
@@ -241,92 +235,82 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
|
||||
stage = _clutter_actor_get_stage_internal (priv->actor);
|
||||
clutter_actor_get_size (stage, &stage_width, &stage_height);
|
||||
|
||||
/* The paint box is the bounding box of the actor's paint volume in
|
||||
* stage coordinates. This will give us the size for the framebuffer
|
||||
* we need to redirect its rendering offscreen and its position will
|
||||
* be used to setup an offset viewport */
|
||||
if (clutter_actor_get_paint_box (priv->actor, &box))
|
||||
/* Get the minimal bounding box for what we want to paint, relative to the
|
||||
* parent of priv->actor. Note that we may actually be painting a clone of
|
||||
* priv->actor so we need to be careful to avoid querying the transformation
|
||||
* of priv->actor (like clutter_actor_get_paint_box would). Just stay in
|
||||
* local coordinates for now...
|
||||
*/
|
||||
volume = clutter_actor_get_paint_volume (priv->actor);
|
||||
if (volume)
|
||||
{
|
||||
clutter_actor_box_get_size (&box, &fbo_width, &fbo_height);
|
||||
clutter_actor_box_get_origin (&box, &priv->x_offset, &priv->y_offset);
|
||||
ClutterPaintVolume mutable_volume;
|
||||
|
||||
fbo_width = MIN (fbo_width, stage_width);
|
||||
fbo_height = MIN (fbo_height, stage_height);
|
||||
_clutter_paint_volume_copy_static (volume, &mutable_volume);
|
||||
_clutter_paint_volume_get_bounding_box (&mutable_volume, &raw_box);
|
||||
clutter_paint_volume_free (&mutable_volume);
|
||||
}
|
||||
else
|
||||
{
|
||||
fbo_width = stage_width;
|
||||
fbo_height = stage_height;
|
||||
clutter_actor_get_allocation_box (priv->actor, &raw_box);
|
||||
}
|
||||
|
||||
if (fbo_width == stage_width)
|
||||
priv->x_offset = 0.0f;
|
||||
if (fbo_height == stage_height)
|
||||
priv->y_offset = 0.0f;
|
||||
box = raw_box;
|
||||
_clutter_actor_box_enlarge_for_effects (&box);
|
||||
|
||||
priv->fbo_offset_x = box.x1 - raw_box.x1;
|
||||
priv->fbo_offset_y = box.y1 - raw_box.y1;
|
||||
|
||||
clutter_actor_box_get_size (&box, &fbo_width, &fbo_height);
|
||||
|
||||
/* First assert that the framebuffer is the right size... */
|
||||
if (!update_fbo (effect, fbo_width, fbo_height))
|
||||
return FALSE;
|
||||
|
||||
texture_width = cogl_texture_get_width (priv->texture);
|
||||
texture_height = cogl_texture_get_height (priv->texture);
|
||||
|
||||
/* get the current modelview matrix so that we can copy it to the
|
||||
* framebuffer. We also store the matrix that was last used when we
|
||||
* updated the FBO so that we can detect when we don't need to
|
||||
* update the FBO to paint a second time */
|
||||
cogl_get_modelview_matrix (&priv->last_matrix_drawn);
|
||||
cogl_get_modelview_matrix (&old_modelview);
|
||||
|
||||
/* let's draw offscreen */
|
||||
cogl_push_framebuffer (priv->offscreen);
|
||||
|
||||
/* Copy the modelview that would have been used if rendering onscreen */
|
||||
cogl_set_modelview_matrix (&priv->last_matrix_drawn);
|
||||
|
||||
/* Set up the viewport so that it has the same size as the stage,
|
||||
* but offset it so that the actor of interest lands on our
|
||||
* framebuffer. */
|
||||
clutter_actor_get_size (priv->stage, &width, &height);
|
||||
|
||||
/* Expand the viewport if the actor is partially off-stage,
|
||||
* otherwise the actor will end up clipped to the stage viewport
|
||||
/* We don't want the FBO contents to be transformed. That could waste memory
|
||||
* (e.g. during zoom), or result in something that's not rectangular (clipped
|
||||
* incorrectly). So drop the modelview matrix of the current paint chain.
|
||||
* This is fine since paint_texture runs with the same modelview matrix,
|
||||
* so it will come out correctly whenever that is used to put the FBO
|
||||
* contents on screen...
|
||||
*/
|
||||
xexpand = 0.f;
|
||||
if (priv->x_offset < 0.f)
|
||||
xexpand = -priv->x_offset;
|
||||
if (priv->x_offset + texture_width > width)
|
||||
xexpand = MAX (xexpand, (priv->x_offset + texture_width) - width);
|
||||
clutter_actor_get_transform (priv->stage, &modelview);
|
||||
cogl_set_modelview_matrix (&modelview);
|
||||
|
||||
yexpand = 0.f;
|
||||
if (priv->y_offset < 0.f)
|
||||
yexpand = -priv->y_offset;
|
||||
if (priv->y_offset + texture_height > height)
|
||||
yexpand = MAX (yexpand, (priv->y_offset + texture_height) - height);
|
||||
/* Save the original viewport for calculating priv->position */
|
||||
_clutter_stage_get_viewport (CLUTTER_STAGE (priv->stage),
|
||||
&old_viewport[0],
|
||||
&old_viewport[1],
|
||||
&old_viewport[2],
|
||||
&old_viewport[3]);
|
||||
|
||||
/* Set the viewport */
|
||||
cogl_set_viewport (-(priv->x_offset + xexpand), -(priv->y_offset + yexpand),
|
||||
width + (2 * xexpand), height + (2 * yexpand));
|
||||
/* Set up the viewport so that it has the same size as the stage (avoid
|
||||
* distortion), but translated to account for the FBO offset...
|
||||
*/
|
||||
cogl_set_viewport (-priv->fbo_offset_x,
|
||||
-priv->fbo_offset_y,
|
||||
stage_width,
|
||||
stage_height);
|
||||
|
||||
/* Copy the stage's projection matrix across to the framebuffer */
|
||||
_clutter_stage_get_projection_matrix (CLUTTER_STAGE (priv->stage),
|
||||
&projection);
|
||||
|
||||
/* If we've expanded the viewport, make sure to scale the projection
|
||||
* matrix accordingly (as it's been initialised to work with the
|
||||
* original viewport and not our expanded one).
|
||||
/* Now save the global position of the effect (not just of the actor).
|
||||
* It doesn't appear anyone actually uses this yet, but get_target_rect is
|
||||
* documented as returning it. So we should...
|
||||
*/
|
||||
if (xexpand > 0.f || yexpand > 0.f)
|
||||
{
|
||||
gfloat new_width, new_height;
|
||||
|
||||
new_width = width + (2 * xexpand);
|
||||
new_height = height + (2 * yexpand);
|
||||
|
||||
cogl_matrix_scale (&projection,
|
||||
width / new_width,
|
||||
height / new_height,
|
||||
1);
|
||||
}
|
||||
_clutter_util_fully_transform_vertices (&old_modelview,
|
||||
&projection,
|
||||
old_viewport,
|
||||
&local_offset,
|
||||
&priv->position,
|
||||
1);
|
||||
|
||||
cogl_set_projection_matrix (&projection);
|
||||
|
||||
@@ -385,13 +369,14 @@ clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect)
|
||||
|
||||
cogl_push_matrix ();
|
||||
|
||||
/* Now reset the modelview to put us in stage coordinates so
|
||||
* we can drawn the result of our offscreen render as a textured
|
||||
* quad... */
|
||||
|
||||
cogl_matrix_init_identity (&modelview);
|
||||
_clutter_actor_apply_modelview_transform (priv->stage, &modelview);
|
||||
cogl_matrix_translate (&modelview, priv->x_offset, priv->y_offset, 0.0f);
|
||||
/* The current modelview matrix is *almost* perfect already. It's only
|
||||
* missing a correction for the expanded FBO and offset rendering within...
|
||||
*/
|
||||
cogl_get_modelview_matrix (&modelview);
|
||||
cogl_matrix_translate (&modelview,
|
||||
priv->fbo_offset_x,
|
||||
priv->fbo_offset_y,
|
||||
0.0f);
|
||||
cogl_set_modelview_matrix (&modelview);
|
||||
|
||||
/* paint the target material; this is virtualized for
|
||||
@@ -428,16 +413,11 @@ clutter_offscreen_effect_paint (ClutterEffect *effect,
|
||||
{
|
||||
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
|
||||
ClutterOffscreenEffectPrivate *priv = self->priv;
|
||||
CoglMatrix matrix;
|
||||
|
||||
cogl_get_modelview_matrix (&matrix);
|
||||
|
||||
/* If we've already got a cached image for the same matrix and the
|
||||
actor hasn't been redrawn then we can just use the cached image
|
||||
in the fbo */
|
||||
if (priv->offscreen == NULL ||
|
||||
(flags & CLUTTER_EFFECT_PAINT_ACTOR_DIRTY) ||
|
||||
!cogl_matrix_equal (&matrix, &priv->last_matrix_drawn))
|
||||
/* If we've already got a cached image and the actor hasn't been redrawn
|
||||
* then we can just use the cached image in the FBO.
|
||||
*/
|
||||
if (priv->offscreen == NULL || (flags & CLUTTER_EFFECT_PAINT_ACTOR_DIRTY))
|
||||
{
|
||||
/* Chain up to the parent paint method which will call the pre and
|
||||
post paint functions to update the image */
|
||||
@@ -663,8 +643,8 @@ clutter_offscreen_effect_get_target_rect (ClutterOffscreenEffect *effect,
|
||||
return FALSE;
|
||||
|
||||
clutter_rect_init (rect,
|
||||
priv->x_offset,
|
||||
priv->y_offset,
|
||||
priv->position.x,
|
||||
priv->position.y,
|
||||
cogl_texture_get_width (priv->texture),
|
||||
cogl_texture_get_height (priv->texture));
|
||||
|
||||
|
@@ -77,6 +77,7 @@ struct _ClutterPaintNodeClass
|
||||
typedef enum {
|
||||
PAINT_OP_INVALID = 0,
|
||||
PAINT_OP_TEX_RECT,
|
||||
PAINT_OP_MULTITEX_RECT,
|
||||
PAINT_OP_PATH,
|
||||
PAINT_OP_PRIMITIVE
|
||||
} PaintOpCode;
|
||||
@@ -85,6 +86,8 @@ struct _ClutterPaintOperation
|
||||
{
|
||||
PaintOpCode opcode;
|
||||
|
||||
GArray *multitex_coords;
|
||||
|
||||
union {
|
||||
float texrect[8];
|
||||
|
||||
@@ -94,7 +97,6 @@ struct _ClutterPaintOperation
|
||||
} op;
|
||||
};
|
||||
|
||||
GType _clutter_root_node_get_type (void) G_GNUC_CONST;
|
||||
GType _clutter_transform_node_get_type (void) G_GNUC_CONST;
|
||||
GType _clutter_dummy_node_get_type (void) G_GNUC_CONST;
|
||||
|
||||
@@ -107,13 +109,9 @@ void _clutter_paint_operation_paint_primitive (const C
|
||||
void _clutter_paint_node_init_types (void);
|
||||
gpointer _clutter_paint_node_create (GType gtype);
|
||||
|
||||
ClutterPaintNode * _clutter_root_node_new (CoglFramebuffer *framebuffer,
|
||||
const ClutterColor *clear_color,
|
||||
CoglBufferBit clear_flags);
|
||||
ClutterPaintNode * _clutter_transform_node_new (const CoglMatrix *matrix);
|
||||
ClutterPaintNode * _clutter_dummy_node_new (ClutterActor *actor);
|
||||
|
||||
void _clutter_paint_node_paint (ClutterPaintNode *root);
|
||||
void _clutter_paint_node_dump_tree (ClutterPaintNode *root);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
|
@@ -761,6 +761,11 @@ clutter_paint_operation_clear (ClutterPaintOperation *op)
|
||||
case PAINT_OP_TEX_RECT:
|
||||
break;
|
||||
|
||||
case PAINT_OP_MULTITEX_RECT:
|
||||
if (op->multitex_coords != NULL)
|
||||
g_array_unref (op->multitex_coords);
|
||||
break;
|
||||
|
||||
case PAINT_OP_PATH:
|
||||
if (op->op.path != NULL)
|
||||
cogl_object_unref (op->op.path);
|
||||
@@ -794,6 +799,27 @@ clutter_paint_op_init_tex_rect (ClutterPaintOperation *op,
|
||||
op->op.texrect[7] = y_2;
|
||||
}
|
||||
|
||||
static inline void
|
||||
clutter_paint_op_init_multitex_rect (ClutterPaintOperation *op,
|
||||
const ClutterActorBox *rect,
|
||||
const float *tex_coords,
|
||||
unsigned int tex_coords_len)
|
||||
{
|
||||
clutter_paint_operation_clear (op);
|
||||
|
||||
op->opcode = PAINT_OP_MULTITEX_RECT;
|
||||
op->multitex_coords = g_array_sized_new (FALSE, FALSE,
|
||||
sizeof (float),
|
||||
tex_coords_len);
|
||||
|
||||
g_array_append_vals (op->multitex_coords, tex_coords, tex_coords_len);
|
||||
|
||||
op->op.texrect[0] = rect->x1;
|
||||
op->op.texrect[1] = rect->y1;
|
||||
op->op.texrect[2] = rect->x2;
|
||||
op->op.texrect[3] = rect->y2;
|
||||
}
|
||||
|
||||
static inline void
|
||||
clutter_paint_op_init_path (ClutterPaintOperation *op,
|
||||
CoglPath *path)
|
||||
@@ -881,6 +907,33 @@ clutter_paint_node_add_texture_rectangle (ClutterPaintNode *node,
|
||||
g_array_append_val (node->operations, operation);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* clutter_paint_node_add_multitexture_rectangle:
|
||||
* @node: a #ClutterPaintNode
|
||||
* @rect: a #ClutterActorBox
|
||||
* @text_coords: array of multitexture values
|
||||
* @text_coords_len: number of items of @text_coords
|
||||
*
|
||||
* Adds a rectangle region to the @node, with multitexture coordinates.
|
||||
*/
|
||||
void
|
||||
clutter_paint_node_add_multitexture_rectangle (ClutterPaintNode *node,
|
||||
const ClutterActorBox *rect,
|
||||
const float *text_coords,
|
||||
unsigned int text_coords_len)
|
||||
{
|
||||
ClutterPaintOperation operation = PAINT_OP_INIT;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
|
||||
g_return_if_fail (rect != NULL);
|
||||
|
||||
clutter_paint_node_maybe_init_operations (node);
|
||||
|
||||
clutter_paint_op_init_multitex_rect (&operation, rect, text_coords, text_coords_len);
|
||||
g_array_append_val (node->operations, operation);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_paint_node_add_path: (skip)
|
||||
* @node: a #ClutterPaintNode
|
||||
@@ -936,15 +989,15 @@ clutter_paint_node_add_primitive (ClutterPaintNode *node,
|
||||
g_array_append_val (node->operations, operation);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* _clutter_paint_node_paint:
|
||||
/**
|
||||
* clutter_paint_node_paint:
|
||||
* @node: a #ClutterPaintNode
|
||||
*
|
||||
* Paints the @node using the class implementation, traversing
|
||||
* its children, if any.
|
||||
*/
|
||||
void
|
||||
_clutter_paint_node_paint (ClutterPaintNode *node)
|
||||
clutter_paint_node_paint (ClutterPaintNode *node)
|
||||
{
|
||||
ClutterPaintNodeClass *klass = CLUTTER_PAINT_NODE_GET_CLASS (node);
|
||||
ClutterPaintNode *iter;
|
||||
@@ -961,7 +1014,7 @@ _clutter_paint_node_paint (ClutterPaintNode *node)
|
||||
iter != NULL;
|
||||
iter = iter->next_sibling)
|
||||
{
|
||||
_clutter_paint_node_paint (iter);
|
||||
clutter_paint_node_paint (iter);
|
||||
}
|
||||
|
||||
if (res)
|
||||
@@ -1006,7 +1059,7 @@ clutter_paint_node_to_json (ClutterPaintNode *node)
|
||||
|
||||
if (node->operations != NULL)
|
||||
{
|
||||
guint i;
|
||||
guint i, j;
|
||||
|
||||
for (i = 0; i < node->operations->len; i++)
|
||||
{
|
||||
@@ -1031,6 +1084,19 @@ clutter_paint_node_to_json (ClutterPaintNode *node)
|
||||
json_builder_end_array (builder);
|
||||
break;
|
||||
|
||||
case PAINT_OP_MULTITEX_RECT:
|
||||
json_builder_set_member_name (builder, "texrect");
|
||||
json_builder_begin_array (builder);
|
||||
|
||||
for (j = 0; i < op->multitex_coords->len; j++)
|
||||
{
|
||||
float coord = g_array_index (op->multitex_coords, float, j);
|
||||
json_builder_add_double_value (builder, coord);
|
||||
}
|
||||
|
||||
json_builder_end_array (builder);
|
||||
break;
|
||||
|
||||
case PAINT_OP_PATH:
|
||||
json_builder_set_member_name (builder, "path");
|
||||
json_builder_add_int_value (builder, (gint64) op->op.path);
|
||||
|
@@ -49,6 +49,9 @@ ClutterPaintNode * clutter_paint_node_ref (Clutter
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_node_unref (ClutterPaintNode *node);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_node_paint (ClutterPaintNode *node);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_node_set_name (ClutterPaintNode *node,
|
||||
const char *name);
|
||||
@@ -67,6 +70,12 @@ void clutter_paint_node_add_texture_rectangle (Clutter
|
||||
float x_2,
|
||||
float y_2);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_node_add_multitexture_rectangle (ClutterPaintNode *node,
|
||||
const ClutterActorBox *rect,
|
||||
const float *text_coords,
|
||||
unsigned int text_coords_len);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_paint_node_add_path (ClutterPaintNode *node,
|
||||
CoglPath *path);
|
||||
|
@@ -83,16 +83,13 @@ _clutter_paint_node_init_types (void)
|
||||
}
|
||||
|
||||
/*
|
||||
* Root node, private
|
||||
* Root node
|
||||
*
|
||||
* any frame can only have a since RootNode instance for each
|
||||
* top-level actor.
|
||||
*/
|
||||
|
||||
#define clutter_root_node_get_type _clutter_root_node_get_type
|
||||
|
||||
typedef struct _ClutterRootNode ClutterRootNode;
|
||||
typedef struct _ClutterPaintNodeClass ClutterRootNodeClass;
|
||||
#define clutter_root_node_get_type clutter_root_node_get_type
|
||||
|
||||
struct _ClutterRootNode
|
||||
{
|
||||
@@ -111,6 +108,8 @@ clutter_root_node_pre_draw (ClutterPaintNode *node)
|
||||
{
|
||||
ClutterRootNode *rnode = (ClutterRootNode *) node;
|
||||
|
||||
cogl_push_framebuffer (rnode->framebuffer);
|
||||
|
||||
cogl_framebuffer_clear (rnode->framebuffer,
|
||||
rnode->clear_flags,
|
||||
&rnode->clear_color);
|
||||
@@ -121,6 +120,7 @@ clutter_root_node_pre_draw (ClutterPaintNode *node)
|
||||
static void
|
||||
clutter_root_node_post_draw (ClutterPaintNode *node)
|
||||
{
|
||||
cogl_pop_framebuffer ();
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -158,13 +158,13 @@ clutter_root_node_init (ClutterRootNode *self)
|
||||
}
|
||||
|
||||
ClutterPaintNode *
|
||||
_clutter_root_node_new (CoglFramebuffer *framebuffer,
|
||||
const ClutterColor *clear_color,
|
||||
CoglBufferBit clear_flags)
|
||||
clutter_root_node_new (CoglFramebuffer *framebuffer,
|
||||
const ClutterColor *clear_color,
|
||||
CoglBufferBit clear_flags)
|
||||
{
|
||||
ClutterRootNode *res;
|
||||
|
||||
res = _clutter_paint_node_create (_clutter_root_node_get_type ());
|
||||
res = _clutter_paint_node_create (CLUTTER_TYPE_ROOT_NODE);
|
||||
|
||||
cogl_color_init_from_4ub (&res->clear_color,
|
||||
clear_color->red,
|
||||
@@ -431,6 +431,17 @@ clutter_pipeline_node_draw (ClutterPaintNode *node)
|
||||
op->op.texrect[7]);
|
||||
break;
|
||||
|
||||
case PAINT_OP_MULTITEX_RECT:
|
||||
cogl_framebuffer_draw_multitextured_rectangle (cogl_get_draw_framebuffer (),
|
||||
pnode->pipeline,
|
||||
op->op.texrect[0],
|
||||
op->op.texrect[1],
|
||||
op->op.texrect[2],
|
||||
op->op.texrect[3],
|
||||
(float*) op->multitex_coords->data,
|
||||
op->multitex_coords->len);
|
||||
break;
|
||||
|
||||
case PAINT_OP_PATH:
|
||||
cogl_path_fill (op->op.path);
|
||||
break;
|
||||
@@ -827,6 +838,7 @@ clutter_text_node_draw (ClutterPaintNode *node)
|
||||
cogl_framebuffer_pop_clip (fb);
|
||||
break;
|
||||
|
||||
case PAINT_OP_MULTITEX_RECT:
|
||||
case PAINT_OP_PATH:
|
||||
case PAINT_OP_PRIMITIVE:
|
||||
case PAINT_OP_INVALID:
|
||||
@@ -992,6 +1004,7 @@ clutter_clip_node_pre_draw (ClutterPaintNode *node)
|
||||
retval = TRUE;
|
||||
break;
|
||||
|
||||
case PAINT_OP_MULTITEX_RECT:
|
||||
case PAINT_OP_PRIMITIVE:
|
||||
case PAINT_OP_INVALID:
|
||||
break;
|
||||
@@ -1025,6 +1038,7 @@ clutter_clip_node_post_draw (ClutterPaintNode *node)
|
||||
cogl_framebuffer_pop_clip (fb);
|
||||
break;
|
||||
|
||||
case PAINT_OP_MULTITEX_RECT:
|
||||
case PAINT_OP_PRIMITIVE:
|
||||
case PAINT_OP_INVALID:
|
||||
break;
|
||||
@@ -1180,6 +1194,17 @@ clutter_layer_node_post_draw (ClutterPaintNode *node)
|
||||
cogl_pop_source ();
|
||||
break;
|
||||
|
||||
case PAINT_OP_MULTITEX_RECT:
|
||||
cogl_framebuffer_draw_multitextured_rectangle (cogl_get_draw_framebuffer (),
|
||||
lnode->state,
|
||||
op->op.texrect[0],
|
||||
op->op.texrect[1],
|
||||
op->op.texrect[2],
|
||||
op->op.texrect[3],
|
||||
(float*) op->multitex_coords->data,
|
||||
op->multitex_coords->len);
|
||||
break;
|
||||
|
||||
case PAINT_OP_PATH:
|
||||
cogl_push_source (lnode->state);
|
||||
cogl_path_fill (op->op.path);
|
||||
|
@@ -143,6 +143,26 @@ CLUTTER_EXPORT
|
||||
ClutterPaintNode * clutter_text_node_new (PangoLayout *layout,
|
||||
const ClutterColor *color);
|
||||
|
||||
#define CLUTTER_TYPE_ROOT_NODE (clutter_root_node_get_type ())
|
||||
#define CLUTTER_ROOT_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ROOT_NODE, ClutterRootNode))
|
||||
#define CLUTTER_IS_ROOT_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ROOT_NODE))
|
||||
|
||||
/**
|
||||
* ClutterRootNode:
|
||||
*
|
||||
* The #ClutterRootNode structure is an opaque
|
||||
* type whose members cannot be directly accessed.
|
||||
*/
|
||||
typedef struct _ClutterRootNode ClutterRootNode;
|
||||
typedef struct _ClutterPaintNodeClass ClutterRootNodeClass;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
GType clutter_root_node_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_EXPORT
|
||||
ClutterPaintNode * clutter_root_node_new (CoglFramebuffer *framebuffer,
|
||||
const ClutterColor *clear_color,
|
||||
CoglBufferBit clear_flags);
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_PAINT_NODES_H__ */
|
||||
|
@@ -35,6 +35,7 @@
|
||||
#include "clutter-paint-volume-private.h"
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-stage-private.h"
|
||||
#include "clutter-actor-box-private.h"
|
||||
|
||||
G_DEFINE_BOXED_TYPE (ClutterPaintVolume, clutter_paint_volume,
|
||||
clutter_paint_volume_copy,
|
||||
@@ -1138,8 +1139,6 @@ _clutter_paint_volume_get_stage_paint_box (ClutterPaintVolume *pv,
|
||||
CoglMatrix modelview;
|
||||
CoglMatrix projection;
|
||||
float viewport[4];
|
||||
float width;
|
||||
float height;
|
||||
|
||||
_clutter_paint_volume_copy_static (pv, &projected_pv);
|
||||
|
||||
@@ -1179,50 +1178,7 @@ _clutter_paint_volume_get_stage_paint_box (ClutterPaintVolume *pv,
|
||||
return;
|
||||
}
|
||||
|
||||
/* The aim here is that for a given rectangle defined with floating point
|
||||
* coordinates we want to determine a stable quantized size in pixels
|
||||
* that doesn't vary due to the original box's sub-pixel position.
|
||||
*
|
||||
* The reason this is important is because effects will use this
|
||||
* API to determine the size of offscreen framebuffers and so for
|
||||
* a fixed-size object that may be animated accross the screen we
|
||||
* want to make sure that the stage paint-box has an equally stable
|
||||
* size so that effects aren't made to continuously re-allocate
|
||||
* a corresponding fbo.
|
||||
*
|
||||
* The other thing we consider is that the calculation of this box is
|
||||
* subject to floating point precision issues that might be slightly
|
||||
* different to the precision issues involved with actually painting the
|
||||
* actor, which might result in painting slightly leaking outside the
|
||||
* user's calculated paint-volume. For this we simply aim to pad out the
|
||||
* paint-volume by at least half a pixel all the way around.
|
||||
*/
|
||||
width = box->x2 - box->x1;
|
||||
height = box->y2 - box->y1;
|
||||
width = CLUTTER_NEARBYINT (width);
|
||||
height = CLUTTER_NEARBYINT (height);
|
||||
/* XXX: NB the width/height may now be up to 0.5px too small so we
|
||||
* must also pad by 0.25px all around to account for this. In total we
|
||||
* must padd by at least 0.75px around all sides. */
|
||||
|
||||
/* XXX: The furthest that we can overshoot the bottom right corner by
|
||||
* here is 1.75px in total if you consider that the 0.75 padding could
|
||||
* just cross an integer boundary and so ceil will effectively add 1.
|
||||
*/
|
||||
box->x2 = ceilf (box->x2 + 0.75);
|
||||
box->y2 = ceilf (box->y2 + 0.75);
|
||||
|
||||
/* Now we redefine the top-left relative to the bottom right based on the
|
||||
* rounded width/height determined above + a constant so that the overall
|
||||
* size of the box will be stable and not dependant on the box's
|
||||
* position.
|
||||
*
|
||||
* Adding 3px to the width/height will ensure we cover the maximum of
|
||||
* 1.75px padding on the bottom/right and still ensure we have > 0.75px
|
||||
* padding on the top/left.
|
||||
*/
|
||||
box->x1 = box->x2 - width - 3;
|
||||
box->y1 = box->y2 - height - 3;
|
||||
_clutter_actor_box_enlarge_for_effects (box);
|
||||
|
||||
clutter_paint_volume_free (&projected_pv);
|
||||
}
|
||||
|
@@ -961,6 +961,7 @@ clutter_pan_action_get_motion_delta (ClutterPanAction *self,
|
||||
return clutter_pan_action_get_interpolated_delta (self, delta_x, delta_y);
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -202,7 +202,7 @@ gboolean _clutter_feature_init (GError **error);
|
||||
|
||||
/* Diagnostic mode */
|
||||
gboolean _clutter_diagnostic_enabled (void);
|
||||
void _clutter_diagnostic_message (const char *fmt, ...);
|
||||
void _clutter_diagnostic_message (const char *fmt, ...) G_GNUC_PRINTF (1, 2);
|
||||
|
||||
/* Picking code */
|
||||
guint _clutter_pixel_to_id (guchar pixel[4]);
|
||||
|
@@ -333,6 +333,7 @@ clutter_shader_effect_create_shader (ClutterShaderEffect *self)
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
return COGL_INVALID_HANDLE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1474,8 +1474,8 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
|
||||
if (G_LIKELY (!(clutter_pick_debug_flags & CLUTTER_DEBUG_DUMP_PICK_BUFFERS)))
|
||||
{
|
||||
CLUTTER_NOTE (PICK, "Pushing pick scissor clip x: %d, y: %d, 1x1",
|
||||
(int) dirty_x * fb_scale,
|
||||
(int) dirty_y * fb_scale);
|
||||
(int) (dirty_x * fb_scale),
|
||||
(int) (dirty_y * fb_scale));
|
||||
cogl_framebuffer_push_scissor_clip (fb, dirty_x * fb_scale, dirty_y * fb_scale, 1, 1);
|
||||
}
|
||||
|
||||
@@ -1495,7 +1495,7 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
|
||||
read_x = dirty_x * fb_scale;
|
||||
read_y = dirty_y * fb_scale;
|
||||
|
||||
CLUTTER_NOTE (PICK, "Performing pick at %i,%i on view %dx%d+%d+%d s: %d",
|
||||
CLUTTER_NOTE (PICK, "Performing pick at %i,%i on view %dx%d+%d+%d s: %f",
|
||||
x, y,
|
||||
view_layout.width, view_layout.height,
|
||||
view_layout.x, view_layout.y, fb_scale);
|
||||
|
@@ -39,29 +39,6 @@
|
||||
#include "clutter-interval.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
#include "deprecated/clutter-util.h"
|
||||
|
||||
/**
|
||||
* clutter_util_next_p2:
|
||||
* @a: Value to get the next power
|
||||
*
|
||||
* Calculates the nearest power of two, greater than or equal to @a.
|
||||
*
|
||||
* Return value: The nearest power of two, greater or equal to @a.
|
||||
*
|
||||
* Deprecated: 1.2
|
||||
*/
|
||||
gint
|
||||
clutter_util_next_p2 (gint a)
|
||||
{
|
||||
int rval = 1;
|
||||
|
||||
while (rval < a)
|
||||
rval <<= 1;
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
/* Help macros to scale from OpenGL <-1,1> coordinates system to
|
||||
* window coordinates ranging [0,window-size]
|
||||
*/
|
||||
|
@@ -76,6 +76,7 @@
|
||||
#include "clutter-input-focus.h"
|
||||
#include "clutter-interval.h"
|
||||
#include "clutter-keyframe-transition.h"
|
||||
#include "clutter-keymap.h"
|
||||
#include "clutter-keysyms.h"
|
||||
#include "clutter-layout-manager.h"
|
||||
#include "clutter-layout-meta.h"
|
||||
|
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006, 2007, 2008 OpenedHand Ltd
|
||||
* Copyright (C) 2009, 2010 Intel Corp
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __CLUTTER_BACKEND_DEPRECATED_H__
|
||||
#define __CLUTTER_BACKEND_DEPRECATED_H__
|
||||
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(ClutterSettings:font_dpi)
|
||||
void clutter_backend_set_resolution (ClutterBackend *backend,
|
||||
gdouble dpi);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(ClutterSettings:double_click_time)
|
||||
void clutter_backend_set_double_click_time (ClutterBackend *backend,
|
||||
guint msec);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(ClutterSettings:double_click_time)
|
||||
guint clutter_backend_get_double_click_time (ClutterBackend *backend);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(ClutterSettings:double_click_distance)
|
||||
void clutter_backend_set_double_click_distance (ClutterBackend *backend,
|
||||
guint distance);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(ClutterSettings:double_click_distance)
|
||||
guint clutter_backend_get_double_click_distance (ClutterBackend *backend);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(ClutterSettings:font_name)
|
||||
void clutter_backend_set_font_name (ClutterBackend *backend,
|
||||
const gchar *font_name);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(ClutterSettings:font_name)
|
||||
const gchar * clutter_backend_get_font_name (ClutterBackend *backend);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BACKEND_DEPRECATED_H__ */
|
@@ -1,261 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Neil Roberts <neil@linux.intel.com>
|
||||
*
|
||||
* Copyright (C) 2008 OpenedHand
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
#include "deprecated/clutter-frame-source.h"
|
||||
#include "deprecated/clutter-timeout-interval.h"
|
||||
|
||||
typedef struct _ClutterFrameSource ClutterFrameSource;
|
||||
|
||||
struct _ClutterFrameSource
|
||||
{
|
||||
GSource source;
|
||||
|
||||
ClutterTimeoutInterval timeout;
|
||||
};
|
||||
|
||||
static gboolean clutter_frame_source_prepare (GSource *source,
|
||||
gint *timeout);
|
||||
static gboolean clutter_frame_source_check (GSource *source);
|
||||
static gboolean clutter_frame_source_dispatch (GSource *source,
|
||||
GSourceFunc callback,
|
||||
gpointer user_data);
|
||||
|
||||
static GSourceFuncs clutter_frame_source_funcs =
|
||||
{
|
||||
clutter_frame_source_prepare,
|
||||
clutter_frame_source_check,
|
||||
clutter_frame_source_dispatch,
|
||||
NULL
|
||||
};
|
||||
|
||||
/**
|
||||
* clutter_frame_source_add_full: (rename-to clutter_frame_source_add)
|
||||
* @priority: the priority of the frame source. Typically this will be in the
|
||||
* range between %G_PRIORITY_DEFAULT and %G_PRIORITY_HIGH.
|
||||
* @fps: the number of times per second to call the function
|
||||
* @func: function to call
|
||||
* @data: data to pass to the function
|
||||
* @notify: function to call when the timeout source is removed
|
||||
*
|
||||
* Sets a function to be called at regular intervals with the given
|
||||
* priority. The function is called repeatedly until it returns
|
||||
* %FALSE, at which point the timeout is automatically destroyed and
|
||||
* the function will not be called again. The @notify function is
|
||||
* called when the timeout is destroyed. The first call to the
|
||||
* function will be at the end of the first @interval.
|
||||
*
|
||||
* This function is similar to g_timeout_add_full() except that it
|
||||
* will try to compensate for delays. For example, if @func takes half
|
||||
* the interval time to execute then the function will be called again
|
||||
* half the interval time after it finished. In contrast
|
||||
* g_timeout_add_full() would not fire until a full interval after the
|
||||
* function completes so the delay between calls would be 1.0 / @fps *
|
||||
* 1.5. This function does not however try to invoke the function
|
||||
* multiple times to catch up missing frames if @func takes more than
|
||||
* @interval ms to execute.
|
||||
*
|
||||
* Return value: the ID (greater than 0) of the event source.
|
||||
*
|
||||
* Since: 0.8
|
||||
*
|
||||
* Deprecated: 1.6: There is no direct replacement for this API.
|
||||
*/
|
||||
guint
|
||||
clutter_frame_source_add_full (gint priority,
|
||||
guint fps,
|
||||
GSourceFunc func,
|
||||
gpointer data,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
guint ret;
|
||||
GSource *source = g_source_new (&clutter_frame_source_funcs,
|
||||
sizeof (ClutterFrameSource));
|
||||
ClutterFrameSource *frame_source = (ClutterFrameSource *) source;
|
||||
|
||||
_clutter_timeout_interval_init (&frame_source->timeout, fps);
|
||||
|
||||
if (priority != G_PRIORITY_DEFAULT)
|
||||
g_source_set_priority (source, priority);
|
||||
|
||||
g_source_set_name (source, "Clutter frame timeout");
|
||||
g_source_set_callback (source, func, data, notify);
|
||||
|
||||
ret = g_source_attach (source, NULL);
|
||||
|
||||
g_source_unref (source);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_frame_source_add: (skip)
|
||||
* @fps: the number of times per second to call the function
|
||||
* @func: function to call
|
||||
* @data: data to pass to the function
|
||||
*
|
||||
* Simple wrapper around clutter_frame_source_add_full().
|
||||
*
|
||||
* Return value: the ID (greater than 0) of the event source.
|
||||
*
|
||||
* Since: 0.8
|
||||
*
|
||||
* Deprecated: 1.6: There is no direct replacement for this API
|
||||
*/
|
||||
guint
|
||||
clutter_frame_source_add (guint fps,
|
||||
GSourceFunc func,
|
||||
gpointer data)
|
||||
{
|
||||
return clutter_frame_source_add_full (G_PRIORITY_DEFAULT,
|
||||
fps, func, data, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_frame_source_prepare (GSource *source,
|
||||
gint *delay)
|
||||
{
|
||||
ClutterFrameSource *frame_source = (ClutterFrameSource *) source;
|
||||
gint64 current_time;
|
||||
|
||||
#if GLIB_CHECK_VERSION (2, 27, 3)
|
||||
current_time = g_source_get_time (source) / 1000;
|
||||
#else
|
||||
{
|
||||
GTimeVal source_time;
|
||||
g_source_get_current_time (source, &source_time);
|
||||
current_time = source_time.tv_sec * 1000 + source_time.tv_usec / 1000;
|
||||
}
|
||||
#endif
|
||||
|
||||
return _clutter_timeout_interval_prepare (current_time,
|
||||
&frame_source->timeout,
|
||||
delay);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_frame_source_check (GSource *source)
|
||||
{
|
||||
return clutter_frame_source_prepare (source, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_frame_source_dispatch (GSource *source,
|
||||
GSourceFunc callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
ClutterFrameSource *frame_source = (ClutterFrameSource *) source;
|
||||
|
||||
return _clutter_timeout_interval_dispatch (&frame_source->timeout,
|
||||
callback, user_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_threads_add_frame_source_full: (rename-to clutter_threads_add_frame_source)
|
||||
* @priority: the priority of the frame source. Typically this will be in the
|
||||
* range between %G_PRIORITY_DEFAULT and %G_PRIORITY_HIGH.
|
||||
* @fps: the number of times per second to call the function
|
||||
* @func: function to call
|
||||
* @data: data to pass to the function
|
||||
* @notify: function to call when the timeout source is removed
|
||||
*
|
||||
* Sets a function to be called at regular intervals holding the Clutter
|
||||
* threads lock, with the given priority. The function is called repeatedly
|
||||
* until it returns %FALSE, at which point the timeout is automatically
|
||||
* removed and the function will not be called again. The @notify function
|
||||
* is called when the timeout is removed.
|
||||
*
|
||||
* This function is similar to clutter_threads_add_timeout_full()
|
||||
* except that it will try to compensate for delays. For example, if
|
||||
* @func takes half the interval time to execute then the function
|
||||
* will be called again half the interval time after it finished. In
|
||||
* contrast clutter_threads_add_timeout_full() would not fire until a
|
||||
* full interval after the function completes so the delay between
|
||||
* calls would be @interval * 1.5. This function does not however try
|
||||
* to invoke the function multiple times to catch up missing frames if
|
||||
* @func takes more than @interval ms to execute.
|
||||
*
|
||||
* See also clutter_threads_add_idle_full().
|
||||
*
|
||||
* Return value: the ID (greater than 0) of the event source.
|
||||
*
|
||||
* Since: 0.8
|
||||
*
|
||||
* Deprecated: 1.6: There is no direct replacement for this API
|
||||
*/
|
||||
guint
|
||||
clutter_threads_add_frame_source_full (gint priority,
|
||||
guint fps,
|
||||
GSourceFunc func,
|
||||
gpointer data,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
ClutterThreadsDispatch *dispatch;
|
||||
|
||||
g_return_val_if_fail (func != NULL, 0);
|
||||
|
||||
dispatch = g_slice_new (ClutterThreadsDispatch);
|
||||
dispatch->func = func;
|
||||
dispatch->data = data;
|
||||
dispatch->notify = notify;
|
||||
|
||||
return clutter_frame_source_add_full (priority,
|
||||
fps,
|
||||
_clutter_threads_dispatch, dispatch,
|
||||
_clutter_threads_dispatch_free);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_threads_add_frame_source: (skip)
|
||||
* @fps: the number of times per second to call the function
|
||||
* @func: function to call
|
||||
* @data: data to pass to the function
|
||||
*
|
||||
* Simple wrapper around clutter_threads_add_frame_source_full().
|
||||
*
|
||||
* Return value: the ID (greater than 0) of the event source.
|
||||
*
|
||||
* Since: 0.8
|
||||
*
|
||||
* Deprecated: 1.6: There is no direct replacement for this API
|
||||
*/
|
||||
guint
|
||||
clutter_threads_add_frame_source (guint fps,
|
||||
GSourceFunc func,
|
||||
gpointer data)
|
||||
{
|
||||
g_return_val_if_fail (func != NULL, 0);
|
||||
|
||||
return clutter_threads_add_frame_source_full (G_PRIORITY_DEFAULT,
|
||||
fps,
|
||||
func, data,
|
||||
NULL);
|
||||
}
|
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2008 OpenedHand
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __CLUTTER_FRAME_SOURCE_H__
|
||||
#define __CLUTTER_FRAME_SOURCE_H__
|
||||
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
guint clutter_frame_source_add (guint fps,
|
||||
GSourceFunc func,
|
||||
gpointer data);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
guint clutter_frame_source_add_full (gint priority,
|
||||
guint fps,
|
||||
GSourceFunc func,
|
||||
gpointer data,
|
||||
GDestroyNotify notify);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_FRAME_SOURCE_H__ */
|
@@ -40,17 +40,6 @@ void clutter_threads_enter (void);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_threads_leave (void);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
guint clutter_threads_add_frame_source (guint fps,
|
||||
GSourceFunc func,
|
||||
gpointer data);
|
||||
CLUTTER_DEPRECATED
|
||||
guint clutter_threads_add_frame_source_full (gint priority,
|
||||
guint fps,
|
||||
GSourceFunc func,
|
||||
gpointer data,
|
||||
GDestroyNotify notify);
|
||||
|
||||
CLUTTER_DEPRECATED_FOR(clutter_stage_set_motion_events_enabled)
|
||||
void clutter_set_motion_events_enabled (gboolean enable);
|
||||
|
||||
|
@@ -66,7 +66,6 @@
|
||||
|
||||
#include "deprecated/clutter-shader.h"
|
||||
#include "deprecated/clutter-texture.h"
|
||||
#include "deprecated/clutter-util.h"
|
||||
|
||||
typedef struct _ClutterTextureAsyncData ClutterTextureAsyncData;
|
||||
|
||||
|
@@ -1,498 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
*
|
||||
* ClutterTimeoutPool: pool of timeout functions using the same slice of
|
||||
* the GLib main loop
|
||||
*
|
||||
* Author: Emmanuele Bassi <ebassi@openedhand.com>
|
||||
*
|
||||
* Based on similar code by Tristan van Berkom
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include "deprecated/clutter-main.h"
|
||||
|
||||
#include "clutter-timeout-pool.h"
|
||||
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-timeout-interval.h"
|
||||
|
||||
typedef struct _ClutterTimeout ClutterTimeout;
|
||||
typedef enum {
|
||||
CLUTTER_TIMEOUT_NONE = 0,
|
||||
CLUTTER_TIMEOUT_READY = 1 << 1
|
||||
} ClutterTimeoutFlags;
|
||||
|
||||
struct _ClutterTimeout
|
||||
{
|
||||
guint id;
|
||||
ClutterTimeoutFlags flags;
|
||||
gint refcount;
|
||||
|
||||
ClutterTimeoutInterval interval;
|
||||
|
||||
GSourceFunc func;
|
||||
gpointer data;
|
||||
GDestroyNotify notify;
|
||||
};
|
||||
|
||||
struct _ClutterTimeoutPool
|
||||
{
|
||||
GSource source;
|
||||
|
||||
guint next_id;
|
||||
|
||||
GList *timeouts;
|
||||
GList *dispatched_timeouts;
|
||||
|
||||
gint ready;
|
||||
|
||||
guint id;
|
||||
};
|
||||
|
||||
#define TIMEOUT_READY(timeout) (timeout->flags & CLUTTER_TIMEOUT_READY)
|
||||
|
||||
static gboolean clutter_timeout_pool_prepare (GSource *source,
|
||||
gint *next_timeout);
|
||||
static gboolean clutter_timeout_pool_check (GSource *source);
|
||||
static gboolean clutter_timeout_pool_dispatch (GSource *source,
|
||||
GSourceFunc callback,
|
||||
gpointer data);
|
||||
static void clutter_timeout_pool_finalize (GSource *source);
|
||||
|
||||
static GSourceFuncs clutter_timeout_pool_funcs =
|
||||
{
|
||||
clutter_timeout_pool_prepare,
|
||||
clutter_timeout_pool_check,
|
||||
clutter_timeout_pool_dispatch,
|
||||
clutter_timeout_pool_finalize
|
||||
};
|
||||
|
||||
static gint
|
||||
clutter_timeout_sort (gconstpointer a,
|
||||
gconstpointer b)
|
||||
{
|
||||
const ClutterTimeout *t_a = a;
|
||||
const ClutterTimeout *t_b = b;
|
||||
|
||||
/* Keep 'ready' timeouts at the front */
|
||||
if (TIMEOUT_READY (t_a))
|
||||
return -1;
|
||||
|
||||
if (TIMEOUT_READY (t_b))
|
||||
return 1;
|
||||
|
||||
return _clutter_timeout_interval_compare_expiration (&t_a->interval,
|
||||
&t_b->interval);
|
||||
}
|
||||
|
||||
static gint
|
||||
clutter_timeout_find_by_id (gconstpointer a,
|
||||
gconstpointer b)
|
||||
{
|
||||
const ClutterTimeout *t_a = a;
|
||||
|
||||
return t_a->id == GPOINTER_TO_UINT (b) ? 0 : 1;
|
||||
}
|
||||
|
||||
static ClutterTimeout *
|
||||
clutter_timeout_new (guint fps)
|
||||
{
|
||||
ClutterTimeout *timeout;
|
||||
|
||||
timeout = g_slice_new0 (ClutterTimeout);
|
||||
_clutter_timeout_interval_init (&timeout->interval, fps);
|
||||
timeout->flags = CLUTTER_TIMEOUT_NONE;
|
||||
timeout->refcount = 1;
|
||||
|
||||
return timeout;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_timeout_prepare (ClutterTimeoutPool *pool,
|
||||
ClutterTimeout *timeout,
|
||||
gint *next_timeout)
|
||||
{
|
||||
GSource *source = (GSource *) pool;
|
||||
gint64 now;
|
||||
|
||||
#if GLIB_CHECK_VERSION (2, 27, 3)
|
||||
now = g_source_get_time (source) / 1000;
|
||||
#else
|
||||
{
|
||||
GTimeVal source_time;
|
||||
g_source_get_current_time (source, &source_time);
|
||||
now = source_time.tv_sec * 1000 + source_time.tv_usec / 1000;
|
||||
}
|
||||
#endif
|
||||
|
||||
return _clutter_timeout_interval_prepare (now,
|
||||
&timeout->interval,
|
||||
next_timeout);
|
||||
}
|
||||
|
||||
/* ref and unref are always called under the main Clutter lock, so there
|
||||
* is not need for us to use g_atomic_int_* API.
|
||||
*/
|
||||
|
||||
static ClutterTimeout *
|
||||
clutter_timeout_ref (ClutterTimeout *timeout)
|
||||
{
|
||||
g_return_val_if_fail (timeout != NULL, timeout);
|
||||
g_return_val_if_fail (timeout->refcount > 0, timeout);
|
||||
|
||||
timeout->refcount += 1;
|
||||
|
||||
return timeout;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_timeout_unref (ClutterTimeout *timeout)
|
||||
{
|
||||
g_return_if_fail (timeout != NULL);
|
||||
g_return_if_fail (timeout->refcount > 0);
|
||||
|
||||
timeout->refcount -= 1;
|
||||
|
||||
if (timeout->refcount == 0)
|
||||
{
|
||||
if (timeout->notify)
|
||||
timeout->notify (timeout->data);
|
||||
|
||||
g_slice_free (ClutterTimeout, timeout);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_timeout_free (ClutterTimeout *timeout)
|
||||
{
|
||||
if (G_LIKELY (timeout))
|
||||
{
|
||||
if (timeout->notify)
|
||||
timeout->notify (timeout->data);
|
||||
|
||||
g_slice_free (ClutterTimeout, timeout);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_timeout_pool_prepare (GSource *source,
|
||||
gint *next_timeout)
|
||||
{
|
||||
ClutterTimeoutPool *pool = (ClutterTimeoutPool *) source;
|
||||
GList *l = pool->timeouts;
|
||||
|
||||
/* the pool is ready if the first timeout is ready */
|
||||
if (l && l->data)
|
||||
{
|
||||
ClutterTimeout *timeout = l->data;
|
||||
return clutter_timeout_prepare (pool, timeout, next_timeout);
|
||||
}
|
||||
else
|
||||
{
|
||||
*next_timeout = -1;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_timeout_pool_check (GSource *source)
|
||||
{
|
||||
ClutterTimeoutPool *pool = (ClutterTimeoutPool *) source;
|
||||
GList *l;
|
||||
|
||||
clutter_threads_enter ();
|
||||
|
||||
for (l = pool->timeouts; l; l = l->next)
|
||||
{
|
||||
ClutterTimeout *timeout = l->data;
|
||||
|
||||
/* since the timeouts are sorted by expiration, as soon
|
||||
* as we get a check returning FALSE we know that the
|
||||
* following timeouts are not expiring, so we break as
|
||||
* soon as possible
|
||||
*/
|
||||
if (clutter_timeout_prepare (pool, timeout, NULL))
|
||||
{
|
||||
timeout->flags |= CLUTTER_TIMEOUT_READY;
|
||||
pool->ready += 1;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
clutter_threads_leave ();
|
||||
|
||||
return (pool->ready > 0);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_timeout_pool_dispatch (GSource *source,
|
||||
GSourceFunc func,
|
||||
gpointer data)
|
||||
{
|
||||
ClutterTimeoutPool *pool = (ClutterTimeoutPool *) source;
|
||||
GList *dispatched_timeouts;
|
||||
|
||||
/* the main loop might have predicted this, so we repeat the
|
||||
* check for ready timeouts.
|
||||
*/
|
||||
if (!pool->ready)
|
||||
clutter_timeout_pool_check (source);
|
||||
|
||||
clutter_threads_enter ();
|
||||
|
||||
/* Iterate by moving the actual start of the list along so that it
|
||||
* can cope with adds and removes while a timeout is being dispatched
|
||||
*/
|
||||
while (pool->timeouts && pool->timeouts->data && pool->ready-- > 0)
|
||||
{
|
||||
ClutterTimeout *timeout = pool->timeouts->data;
|
||||
GList *l;
|
||||
|
||||
/* One of the ready timeouts may have been removed during dispatch,
|
||||
* in which case pool->ready will be wrong, but the ready timeouts
|
||||
* are always kept at the start of the list so we can stop once
|
||||
* we've reached the first non-ready timeout
|
||||
*/
|
||||
if (!(TIMEOUT_READY (timeout)))
|
||||
break;
|
||||
|
||||
/* Add a reference to the timeout so it can't disappear
|
||||
* while it's being dispatched
|
||||
*/
|
||||
clutter_timeout_ref (timeout);
|
||||
|
||||
timeout->flags &= ~CLUTTER_TIMEOUT_READY;
|
||||
|
||||
/* Move the list node to a list of dispatched timeouts */
|
||||
l = pool->timeouts;
|
||||
if (l->next)
|
||||
l->next->prev = NULL;
|
||||
|
||||
pool->timeouts = l->next;
|
||||
|
||||
if (pool->dispatched_timeouts)
|
||||
pool->dispatched_timeouts->prev = l;
|
||||
|
||||
l->prev = NULL;
|
||||
l->next = pool->dispatched_timeouts;
|
||||
pool->dispatched_timeouts = l;
|
||||
|
||||
if (!_clutter_timeout_interval_dispatch (&timeout->interval,
|
||||
timeout->func, timeout->data))
|
||||
{
|
||||
/* The timeout may have already been removed, but nothing
|
||||
* can be added to the dispatched_timeout list except in this
|
||||
* function so it will always either be at the head of the
|
||||
* dispatched list or have been removed
|
||||
*/
|
||||
if (pool->dispatched_timeouts &&
|
||||
pool->dispatched_timeouts->data == timeout)
|
||||
{
|
||||
pool->dispatched_timeouts =
|
||||
g_list_delete_link (pool->dispatched_timeouts,
|
||||
pool->dispatched_timeouts);
|
||||
|
||||
/* Remove the reference that was held by it being in the list */
|
||||
clutter_timeout_unref (timeout);
|
||||
}
|
||||
}
|
||||
|
||||
clutter_timeout_unref (timeout);
|
||||
}
|
||||
|
||||
/* Re-insert the dispatched timeouts in sorted order */
|
||||
dispatched_timeouts = pool->dispatched_timeouts;
|
||||
while (dispatched_timeouts)
|
||||
{
|
||||
ClutterTimeout *timeout = dispatched_timeouts->data;
|
||||
GList *next = dispatched_timeouts->next;
|
||||
|
||||
if (timeout)
|
||||
pool->timeouts = g_list_insert_sorted (pool->timeouts, timeout,
|
||||
clutter_timeout_sort);
|
||||
|
||||
dispatched_timeouts = next;
|
||||
}
|
||||
|
||||
g_list_free (pool->dispatched_timeouts);
|
||||
pool->dispatched_timeouts = NULL;
|
||||
|
||||
pool->ready = 0;
|
||||
|
||||
clutter_threads_leave ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_timeout_pool_finalize (GSource *source)
|
||||
{
|
||||
ClutterTimeoutPool *pool = (ClutterTimeoutPool *) source;
|
||||
|
||||
/* force destruction */
|
||||
g_list_foreach (pool->timeouts, (GFunc) clutter_timeout_free, NULL);
|
||||
g_list_free (pool->timeouts);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_timeout_pool_new:
|
||||
* @priority: the priority of the timeout pool. Typically this will
|
||||
* be #G_PRIORITY_DEFAULT
|
||||
*
|
||||
* Creates a new timeout pool source. A timeout pool should be used when
|
||||
* multiple timeout functions, running at the same priority, are needed and
|
||||
* the g_timeout_add() API might lead to starvation of the time slice of
|
||||
* the main loop. A timeout pool allocates a single time slice of the main
|
||||
* loop and runs every timeout function inside it. The timeout pool is
|
||||
* always sorted, so that the extraction of the next timeout function is
|
||||
* a constant time operation.
|
||||
*
|
||||
* Return value: the newly created #ClutterTimeoutPool. The created pool
|
||||
* is owned by the GLib default context and will be automatically
|
||||
* destroyed when the context is destroyed. It is possible to force
|
||||
* the destruction of the timeout pool using g_source_destroy()
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.6: There is no direct replacement for this API
|
||||
*/
|
||||
ClutterTimeoutPool *
|
||||
clutter_timeout_pool_new (gint priority)
|
||||
{
|
||||
ClutterTimeoutPool *pool;
|
||||
GSource *source;
|
||||
|
||||
source = g_source_new (&clutter_timeout_pool_funcs,
|
||||
sizeof (ClutterTimeoutPool));
|
||||
if (!source)
|
||||
return NULL;
|
||||
|
||||
g_source_set_name (source, "Clutter timeout pool");
|
||||
|
||||
if (priority != G_PRIORITY_DEFAULT)
|
||||
g_source_set_priority (source, priority);
|
||||
|
||||
pool = (ClutterTimeoutPool *) source;
|
||||
pool->next_id = 1;
|
||||
pool->id = g_source_attach (source, NULL);
|
||||
|
||||
/* let the default GLib context manage the pool */
|
||||
g_source_unref (source);
|
||||
|
||||
return pool;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_timeout_pool_add:
|
||||
* @pool: a #ClutterTimeoutPool
|
||||
* @fps: the time between calls to the function, in frames per second
|
||||
* @func: function to call
|
||||
* @data: (closure): data to pass to the function, or %NULL
|
||||
* @notify: function to call when the timeout is removed, or %NULL
|
||||
*
|
||||
* Sets a function to be called at regular intervals, and puts it inside
|
||||
* the @pool. The function is repeatedly called until it returns %FALSE,
|
||||
* at which point the timeout is automatically destroyed and the function
|
||||
* won't be called again. If @notify is not %NULL, the @notify function
|
||||
* will be called. The first call to @func will be at the end of @interval.
|
||||
*
|
||||
* Since Clutter 0.8 this will try to compensate for delays. For
|
||||
* example, if @func takes half the interval time to execute then the
|
||||
* function will be called again half the interval time after it
|
||||
* finished. Before version 0.8 it would not fire until a full
|
||||
* interval after the function completes so the delay between calls
|
||||
* would be @interval * 1.5. This function does not however try to
|
||||
* invoke the function multiple times to catch up missing frames if
|
||||
* @func takes more than @interval ms to execute.
|
||||
*
|
||||
* Return value: the ID (greater than 0) of the timeout inside the pool.
|
||||
* Use clutter_timeout_pool_remove() to stop the timeout.
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.6: There is no direct replacement for this API
|
||||
*/
|
||||
guint
|
||||
clutter_timeout_pool_add (ClutterTimeoutPool *pool,
|
||||
guint fps,
|
||||
GSourceFunc func,
|
||||
gpointer data,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
ClutterTimeout *timeout;
|
||||
guint retval = 0;
|
||||
|
||||
timeout = clutter_timeout_new (fps);
|
||||
|
||||
retval = timeout->id = pool->next_id++;
|
||||
|
||||
timeout->func = func;
|
||||
timeout->data = data;
|
||||
timeout->notify = notify;
|
||||
|
||||
pool->timeouts = g_list_insert_sorted (pool->timeouts, timeout,
|
||||
clutter_timeout_sort);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_timeout_pool_remove:
|
||||
* @pool: a #ClutterTimeoutPool
|
||||
* @id_: the id of the timeout to remove
|
||||
*
|
||||
* Removes a timeout function with @id_ from the timeout pool. The id
|
||||
* is the same returned when adding a function to the timeout pool with
|
||||
* clutter_timeout_pool_add().
|
||||
*
|
||||
* Since: 0.4
|
||||
*
|
||||
* Deprecated: 1.6: There is no direct replacement for this API
|
||||
*/
|
||||
void
|
||||
clutter_timeout_pool_remove (ClutterTimeoutPool *pool,
|
||||
guint id_)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
if ((l = g_list_find_custom (pool->timeouts, GUINT_TO_POINTER (id_),
|
||||
clutter_timeout_find_by_id)))
|
||||
{
|
||||
clutter_timeout_unref (l->data);
|
||||
pool->timeouts = g_list_delete_link (pool->timeouts, l);
|
||||
}
|
||||
else if ((l = g_list_find_custom (pool->dispatched_timeouts,
|
||||
GUINT_TO_POINTER (id_),
|
||||
clutter_timeout_find_by_id)))
|
||||
{
|
||||
clutter_timeout_unref (l->data);
|
||||
|
||||
pool->dispatched_timeouts =
|
||||
g_list_delete_link (pool->dispatched_timeouts, l);
|
||||
}
|
||||
}
|
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* ClutterTimeoutPool: pool of timeout functions using the same slice of
|
||||
* the GLib main loop
|
||||
*
|
||||
* Author: Emmanuele Bassi <ebassi@openedhand.com>
|
||||
*
|
||||
* Based on similar code by Tristan van Berkom
|
||||
*/
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __CLUTTER_TIMEOUT_POOL_H__
|
||||
#define __CLUTTER_TIMEOUT_POOL_H__
|
||||
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* ClutterTimeoutPool: (skip)
|
||||
*
|
||||
* #ClutterTimeoutPool is an opaque structure
|
||||
* whose members cannot be directly accessed.
|
||||
*
|
||||
* Since: 0.6
|
||||
*
|
||||
* Deprecated: 1.6
|
||||
*/
|
||||
typedef struct _ClutterTimeoutPool ClutterTimeoutPool;
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterTimeoutPool *clutter_timeout_pool_new (gint priority);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
guint clutter_timeout_pool_add (ClutterTimeoutPool *pool,
|
||||
guint fps,
|
||||
GSourceFunc func,
|
||||
gpointer data,
|
||||
GDestroyNotify notify);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_timeout_pool_remove (ClutterTimeoutPool *pool,
|
||||
guint id_);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_TIMEOUT_POOL_H__ */
|
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
||||
*
|
||||
* Copyright (C) 2006 OpenedHand
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __CLUTTER_UTIL_H__
|
||||
#define __CLUTTER_UTIL_H__
|
||||
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
gint clutter_util_next_p2 (gint a);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_UTIL_H__ */
|
@@ -44,6 +44,7 @@
|
||||
#include "clutter-device-manager-private.h"
|
||||
#include "clutter-event-private.h"
|
||||
#include "clutter-input-device-evdev.h"
|
||||
#include "clutter-keymap-evdev.h"
|
||||
#include "clutter-seat-evdev.h"
|
||||
#include "clutter-virtual-input-device-evdev.h"
|
||||
#include "clutter-main.h"
|
||||
@@ -91,7 +92,6 @@ struct _ClutterDeviceManagerEvdevPrivate
|
||||
GSList *seats;
|
||||
|
||||
ClutterSeatEvdev *main_seat;
|
||||
struct xkb_keymap *keymap;
|
||||
|
||||
ClutterPointerConstrainCallback constrain_callback;
|
||||
gpointer constrain_data;
|
||||
@@ -147,10 +147,6 @@ static const char *device_type_str[] = {
|
||||
* appear and disappear from the system.
|
||||
*/
|
||||
|
||||
static const char *option_xkb_layout = "us";
|
||||
static const char *option_xkb_variant = "";
|
||||
static const char *option_xkb_options = "";
|
||||
|
||||
static void
|
||||
clutter_device_manager_evdev_copy_event_data (ClutterEventExtender *event_extender,
|
||||
const ClutterEvent *src,
|
||||
@@ -1933,8 +1929,6 @@ clutter_device_manager_evdev_constructed (GObject *gobject)
|
||||
ClutterDeviceManagerEvdevPrivate *priv;
|
||||
ClutterEventSource *source;
|
||||
struct udev *udev;
|
||||
struct xkb_context *ctx;
|
||||
struct xkb_rule_names names;
|
||||
|
||||
udev = udev_new ();
|
||||
if (G_UNLIKELY (udev == NULL))
|
||||
@@ -1966,17 +1960,6 @@ clutter_device_manager_evdev_constructed (GObject *gobject)
|
||||
|
||||
udev_unref (udev);
|
||||
|
||||
names.rules = "evdev";
|
||||
names.model = "pc105";
|
||||
names.layout = option_xkb_layout;
|
||||
names.variant = option_xkb_variant;
|
||||
names.options = option_xkb_options;
|
||||
|
||||
ctx = xkb_context_new (0);
|
||||
g_assert (ctx);
|
||||
priv->keymap = xkb_keymap_new_from_names (ctx, &names, 0);
|
||||
xkb_context_unref (ctx);
|
||||
|
||||
priv->main_seat = clutter_seat_evdev_new (manager_evdev);
|
||||
priv->seats = g_slist_append (priv->seats, priv->main_seat);
|
||||
|
||||
@@ -2030,9 +2013,6 @@ clutter_device_manager_evdev_finalize (GObject *object)
|
||||
g_slist_free_full (priv->seats, (GDestroyNotify) clutter_seat_evdev_free);
|
||||
g_slist_free (priv->devices);
|
||||
|
||||
if (priv->keymap)
|
||||
xkb_keymap_unref (priv->keymap);
|
||||
|
||||
if (priv->event_source != NULL)
|
||||
clutter_event_source_free (priv->event_source);
|
||||
|
||||
@@ -2156,6 +2136,7 @@ _clutter_events_evdev_init (ClutterBackend *backend)
|
||||
{
|
||||
CLUTTER_NOTE (EVENT, "Initializing evdev backend");
|
||||
|
||||
backend->keymap = g_object_new (CLUTTER_TYPE_KEYMAP_EVDEV, NULL);
|
||||
backend->device_manager = g_object_new (CLUTTER_TYPE_DEVICE_MANAGER_EVDEV,
|
||||
"backend", backend,
|
||||
NULL);
|
||||
@@ -2218,14 +2199,6 @@ _clutter_device_manager_evdev_release_device_id (ClutterDeviceManagerEvdev *mana
|
||||
compare_ids);
|
||||
}
|
||||
|
||||
struct xkb_keymap *
|
||||
_clutter_device_manager_evdev_get_keymap (ClutterDeviceManagerEvdev *manager_evdev)
|
||||
{
|
||||
ClutterDeviceManagerEvdevPrivate *priv = manager_evdev->priv;
|
||||
|
||||
return priv->keymap;
|
||||
}
|
||||
|
||||
ClutterStage *
|
||||
_clutter_device_manager_evdev_get_stage (ClutterDeviceManagerEvdev *manager_evdev)
|
||||
{
|
||||
@@ -2288,6 +2261,11 @@ clutter_evdev_update_xkb_state (ClutterDeviceManagerEvdev *manager_evdev)
|
||||
ClutterSeatEvdev *seat;
|
||||
xkb_mod_mask_t latched_mods;
|
||||
xkb_mod_mask_t locked_mods;
|
||||
struct xkb_keymap *xkb_keymap;
|
||||
ClutterKeymap *keymap;
|
||||
|
||||
keymap = clutter_backend_get_keymap (clutter_get_default_backend ());
|
||||
xkb_keymap = clutter_keymap_evdev_get_keyboard_map (CLUTTER_KEYMAP_EVDEV (keymap));
|
||||
|
||||
priv = manager_evdev->priv;
|
||||
|
||||
@@ -2300,7 +2278,7 @@ clutter_evdev_update_xkb_state (ClutterDeviceManagerEvdev *manager_evdev)
|
||||
locked_mods = xkb_state_serialize_mods (seat->xkb,
|
||||
XKB_STATE_MODS_LOCKED);
|
||||
xkb_state_unref (seat->xkb);
|
||||
seat->xkb = xkb_state_new (priv->keymap);
|
||||
seat->xkb = xkb_state_new (xkb_keymap);
|
||||
|
||||
xkb_state_update_mask (seat->xkb,
|
||||
0, /* depressed */
|
||||
@@ -2308,9 +2286,9 @@ clutter_evdev_update_xkb_state (ClutterDeviceManagerEvdev *manager_evdev)
|
||||
locked_mods,
|
||||
0, 0, seat->layout_idx);
|
||||
|
||||
seat->caps_lock_led = xkb_keymap_led_get_index (priv->keymap, XKB_LED_NAME_CAPS);
|
||||
seat->num_lock_led = xkb_keymap_led_get_index (priv->keymap, XKB_LED_NAME_NUM);
|
||||
seat->scroll_lock_led = xkb_keymap_led_get_index (priv->keymap, XKB_LED_NAME_SCROLL);
|
||||
seat->caps_lock_led = xkb_keymap_led_get_index (xkb_keymap, XKB_LED_NAME_CAPS);
|
||||
seat->num_lock_led = xkb_keymap_led_get_index (xkb_keymap, XKB_LED_NAME_NUM);
|
||||
seat->scroll_lock_led = xkb_keymap_led_get_index (xkb_keymap, XKB_LED_NAME_SCROLL);
|
||||
|
||||
clutter_seat_evdev_sync_leds (seat);
|
||||
}
|
||||
@@ -2395,20 +2373,18 @@ clutter_evdev_set_device_callbacks (ClutterOpenDeviceCallback open_callback,
|
||||
*/
|
||||
void
|
||||
clutter_evdev_set_keyboard_map (ClutterDeviceManager *evdev,
|
||||
struct xkb_keymap *keymap)
|
||||
struct xkb_keymap *xkb_keymap)
|
||||
{
|
||||
ClutterDeviceManagerEvdev *manager_evdev;
|
||||
ClutterDeviceManagerEvdevPrivate *priv;
|
||||
ClutterKeymap *keymap;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER_EVDEV (evdev));
|
||||
|
||||
keymap = clutter_backend_get_keymap (clutter_get_default_backend ());
|
||||
clutter_keymap_evdev_set_keyboard_map (CLUTTER_KEYMAP_EVDEV (keymap),
|
||||
xkb_keymap);
|
||||
|
||||
manager_evdev = CLUTTER_DEVICE_MANAGER_EVDEV (evdev);
|
||||
priv = manager_evdev->priv;
|
||||
|
||||
if (priv->keymap)
|
||||
xkb_keymap_unref (priv->keymap);
|
||||
|
||||
priv->keymap = xkb_keymap_ref (keymap);
|
||||
clutter_evdev_update_xkb_state (manager_evdev);
|
||||
}
|
||||
|
||||
@@ -2503,12 +2479,18 @@ clutter_evdev_set_keyboard_numlock (ClutterDeviceManager *evdev,
|
||||
ClutterDeviceManagerEvdevPrivate *priv;
|
||||
GSList *iter;
|
||||
xkb_mod_mask_t numlock;
|
||||
struct xkb_keymap *xkb_keymap;
|
||||
ClutterKeymap *keymap;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER_EVDEV (evdev));
|
||||
|
||||
manager_evdev = CLUTTER_DEVICE_MANAGER_EVDEV (evdev);
|
||||
priv = manager_evdev->priv;
|
||||
numlock = (1 << xkb_keymap_mod_get_index(priv->keymap, "Mod2"));
|
||||
|
||||
keymap = clutter_backend_get_keymap (clutter_get_default_backend ());
|
||||
xkb_keymap = clutter_keymap_evdev_get_keyboard_map (CLUTTER_KEYMAP_EVDEV (keymap));
|
||||
|
||||
numlock = (1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod2"));
|
||||
|
||||
for (iter = priv->seats; iter; iter = iter->next)
|
||||
{
|
||||
@@ -2759,3 +2741,9 @@ clutter_evdev_set_seat_id (const gchar *seat_id)
|
||||
g_free (evdev_seat_id);
|
||||
evdev_seat_id = g_strdup (seat_id);
|
||||
}
|
||||
|
||||
struct xkb_state *
|
||||
_clutter_device_manager_evdev_get_xkb_state (ClutterDeviceManagerEvdev *manager_evdev)
|
||||
{
|
||||
return manager_evdev->priv->main_seat->xkb;
|
||||
}
|
||||
|
@@ -64,8 +64,6 @@ gint _clutter_device_manager_evdev_acquire_device_id (ClutterDeviceManagerEvdev
|
||||
void _clutter_device_manager_evdev_release_device_id (ClutterDeviceManagerEvdev *manager_evdev,
|
||||
ClutterInputDevice *device);
|
||||
|
||||
struct xkb_keymap * _clutter_device_manager_evdev_get_keymap (ClutterDeviceManagerEvdev *manager_evdev);
|
||||
|
||||
ClutterStage * _clutter_device_manager_evdev_get_stage (ClutterDeviceManagerEvdev *manager_evdev);
|
||||
|
||||
void _clutter_device_manager_evdev_constrain_pointer (ClutterDeviceManagerEvdev *manager_evdev,
|
||||
@@ -85,6 +83,8 @@ void _clutter_device_manager_evdev_filter_relative_motion (ClutterDeviceManagerE
|
||||
|
||||
void _clutter_device_manager_evdev_dispatch (ClutterDeviceManagerEvdev *manager_evdev);
|
||||
|
||||
struct xkb_state * _clutter_device_manager_evdev_get_xkb_state (ClutterDeviceManagerEvdev *manager_evdev);
|
||||
|
||||
static inline guint64
|
||||
us (guint64 us)
|
||||
{
|
||||
|
128
clutter/clutter/evdev/clutter-keymap-evdev.c
Normal file
128
clutter/clutter/evdev/clutter-keymap-evdev.c
Normal file
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Red Hat
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* Author: Carlos Garnacho <carlosg@gnome.org>
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include "clutter-device-manager-evdev.h"
|
||||
#include "clutter-keymap-evdev.h"
|
||||
|
||||
static const char *option_xkb_layout = "us";
|
||||
static const char *option_xkb_variant = "";
|
||||
static const char *option_xkb_options = "";
|
||||
|
||||
typedef struct _ClutterKeymapEvdev ClutterKeymapEvdev;
|
||||
|
||||
struct _ClutterKeymapEvdev
|
||||
{
|
||||
ClutterKeymap parent_instance;
|
||||
|
||||
struct xkb_keymap *keymap;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (ClutterKeymapEvdev, clutter_keymap_evdev,
|
||||
CLUTTER_TYPE_KEYMAP)
|
||||
|
||||
static void
|
||||
clutter_keymap_evdev_finalize (GObject *object)
|
||||
{
|
||||
ClutterKeymapEvdev *keymap = CLUTTER_KEYMAP_EVDEV (object);
|
||||
|
||||
xkb_keymap_unref (keymap->keymap);
|
||||
|
||||
G_OBJECT_CLASS (clutter_keymap_evdev_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_keymap_evdev_get_num_lock_state (ClutterKeymap *keymap)
|
||||
{
|
||||
ClutterDeviceManagerEvdev *device_manager;
|
||||
struct xkb_state *xkb_state;
|
||||
|
||||
device_manager =
|
||||
CLUTTER_DEVICE_MANAGER_EVDEV (clutter_device_manager_get_default ());
|
||||
xkb_state = _clutter_device_manager_evdev_get_xkb_state (device_manager);
|
||||
|
||||
return xkb_state_mod_name_is_active (xkb_state,
|
||||
XKB_MOD_NAME_NUM,
|
||||
XKB_STATE_MODS_LATCHED ||
|
||||
XKB_STATE_MODS_LOCKED);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_keymap_evdev_get_caps_lock_state (ClutterKeymap *keymap)
|
||||
{
|
||||
ClutterDeviceManagerEvdev *device_manager;
|
||||
struct xkb_state *xkb_state;
|
||||
|
||||
device_manager =
|
||||
CLUTTER_DEVICE_MANAGER_EVDEV (clutter_device_manager_get_default ());
|
||||
xkb_state = _clutter_device_manager_evdev_get_xkb_state (device_manager);
|
||||
|
||||
return xkb_state_mod_name_is_active (xkb_state,
|
||||
XKB_MOD_NAME_CAPS,
|
||||
XKB_STATE_MODS_LATCHED ||
|
||||
XKB_STATE_MODS_LOCKED);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_keymap_evdev_class_init (ClutterKeymapEvdevClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
ClutterKeymapClass *keymap_class = CLUTTER_KEYMAP_CLASS (klass);
|
||||
|
||||
object_class->finalize = clutter_keymap_evdev_finalize;
|
||||
|
||||
keymap_class->get_num_lock_state = clutter_keymap_evdev_get_num_lock_state;
|
||||
keymap_class->get_caps_lock_state = clutter_keymap_evdev_get_caps_lock_state;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_keymap_evdev_init (ClutterKeymapEvdev *keymap)
|
||||
{
|
||||
struct xkb_context *ctx;
|
||||
struct xkb_rule_names names;
|
||||
|
||||
names.rules = "evdev";
|
||||
names.model = "pc105";
|
||||
names.layout = option_xkb_layout;
|
||||
names.variant = option_xkb_variant;
|
||||
names.options = option_xkb_options;
|
||||
|
||||
ctx = xkb_context_new (0);
|
||||
g_assert (ctx);
|
||||
keymap->keymap = xkb_keymap_new_from_names (ctx, &names, 0);
|
||||
xkb_context_unref (ctx);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_keymap_evdev_set_keyboard_map (ClutterKeymapEvdev *keymap,
|
||||
struct xkb_keymap *xkb_keymap)
|
||||
{
|
||||
if (keymap->keymap)
|
||||
xkb_keymap_unref (keymap->keymap);
|
||||
keymap->keymap = xkb_keymap_ref (xkb_keymap);
|
||||
}
|
||||
|
||||
struct xkb_keymap *
|
||||
clutter_keymap_evdev_get_keyboard_map (ClutterKeymapEvdev *keymap)
|
||||
{
|
||||
return keymap->keymap;
|
||||
}
|
32
clutter/clutter/evdev/clutter-keymap-evdev.h
Normal file
32
clutter/clutter/evdev/clutter-keymap-evdev.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Red Hat
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* Author: Carlos Garnacho <carlosg@gnome.org>
|
||||
*/
|
||||
|
||||
#include "clutter-xkb-utils.h"
|
||||
#include "clutter-keymap.h"
|
||||
|
||||
#define CLUTTER_TYPE_KEYMAP_EVDEV (clutter_keymap_evdev_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (ClutterKeymapEvdev, clutter_keymap_evdev,
|
||||
CLUTTER, KEYMAP_EVDEV,
|
||||
ClutterKeymap)
|
||||
|
||||
void clutter_keymap_evdev_set_keyboard_map (ClutterKeymapEvdev *keymap,
|
||||
struct xkb_keymap *xkb_keymap);
|
||||
struct xkb_keymap * clutter_keymap_evdev_get_keyboard_map (ClutterKeymapEvdev *keymap);
|
@@ -34,6 +34,7 @@
|
||||
#include "clutter-event-private.h"
|
||||
#include "clutter-input-device-evdev.h"
|
||||
#include "clutter-input-device-tool-evdev.h"
|
||||
#include "clutter-keymap-evdev.h"
|
||||
#include "clutter-main.h"
|
||||
|
||||
/* Try to keep the pointer inside the stage. Hopefully no one is using
|
||||
@@ -152,7 +153,8 @@ clutter_seat_evdev_new (ClutterDeviceManagerEvdev *manager_evdev)
|
||||
ClutterSeatEvdev *seat;
|
||||
ClutterInputDevice *device;
|
||||
ClutterStage *stage;
|
||||
struct xkb_keymap *keymap;
|
||||
ClutterKeymap *keymap;
|
||||
struct xkb_keymap *xkb_keymap;
|
||||
|
||||
seat = g_new0 (ClutterSeatEvdev, 1);
|
||||
if (!seat)
|
||||
@@ -183,17 +185,19 @@ clutter_seat_evdev_new (ClutterDeviceManagerEvdev *manager_evdev)
|
||||
seat->repeat_delay = 250; /* ms */
|
||||
seat->repeat_interval = 33; /* ms */
|
||||
|
||||
keymap = _clutter_device_manager_evdev_get_keymap (manager_evdev);
|
||||
if (keymap)
|
||||
keymap = clutter_backend_get_keymap (clutter_get_default_backend ());
|
||||
xkb_keymap = clutter_keymap_evdev_get_keyboard_map (CLUTTER_KEYMAP_EVDEV (keymap));
|
||||
|
||||
if (xkb_keymap)
|
||||
{
|
||||
seat->xkb = xkb_state_new (keymap);
|
||||
seat->xkb = xkb_state_new (xkb_keymap);
|
||||
|
||||
seat->caps_lock_led =
|
||||
xkb_keymap_led_get_index (keymap, XKB_LED_NAME_CAPS);
|
||||
xkb_keymap_led_get_index (xkb_keymap, XKB_LED_NAME_CAPS);
|
||||
seat->num_lock_led =
|
||||
xkb_keymap_led_get_index (keymap, XKB_LED_NAME_NUM);
|
||||
xkb_keymap_led_get_index (xkb_keymap, XKB_LED_NAME_NUM);
|
||||
seat->scroll_lock_led =
|
||||
xkb_keymap_led_get_index (keymap, XKB_LED_NAME_SCROLL);
|
||||
xkb_keymap_led_get_index (xkb_keymap, XKB_LED_NAME_SCROLL);
|
||||
}
|
||||
|
||||
return seat;
|
||||
@@ -316,7 +320,13 @@ clutter_seat_evdev_notify_key (ClutterSeatEvdev *seat,
|
||||
queue_event (event);
|
||||
|
||||
if (update_keys && (changed_state & XKB_STATE_LEDS))
|
||||
clutter_seat_evdev_sync_leds (seat);
|
||||
{
|
||||
ClutterBackend *backend;
|
||||
|
||||
backend = clutter_get_default_backend ();
|
||||
g_signal_emit_by_name (clutter_backend_get_keymap (backend), "state-changed");
|
||||
clutter_seat_evdev_sync_leds (seat);
|
||||
}
|
||||
|
||||
if (state == 0 || /* key release */
|
||||
!seat->repeat ||
|
||||
@@ -766,6 +776,7 @@ discrete_to_direction (double discrete_dx,
|
||||
return CLUTTER_SCROLL_UP;
|
||||
else
|
||||
g_assert_not_reached ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@@ -29,6 +29,7 @@
|
||||
#include "clutter-private.h"
|
||||
#include "clutter-virtual-input-device.h"
|
||||
#include "evdev/clutter-input-device-evdev.h"
|
||||
#include "evdev/clutter-keymap-evdev.h"
|
||||
#include "evdev/clutter-seat-evdev.h"
|
||||
#include "evdev/clutter-virtual-input-device-evdev.h"
|
||||
|
||||
@@ -286,14 +287,14 @@ pick_keycode_for_keyval_in_current_group (ClutterVirtualInputDevice *virtual_dev
|
||||
{
|
||||
ClutterVirtualInputDeviceEvdev *virtual_evdev =
|
||||
CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV (virtual_device);
|
||||
ClutterDeviceManager *manager;
|
||||
ClutterKeymap *keymap;
|
||||
struct xkb_keymap *xkb_keymap;
|
||||
struct xkb_state *state;
|
||||
guint keycode, layout;
|
||||
xkb_keycode_t min_keycode, max_keycode;
|
||||
|
||||
manager = clutter_virtual_input_device_get_manager (virtual_device);
|
||||
xkb_keymap = _clutter_device_manager_evdev_get_keymap (CLUTTER_DEVICE_MANAGER_EVDEV (manager));
|
||||
keymap = clutter_backend_get_keymap (clutter_get_default_backend ());
|
||||
xkb_keymap = clutter_keymap_evdev_get_keyboard_map (CLUTTER_KEYMAP_EVDEV (keymap));
|
||||
state = virtual_evdev->seat->xkb;
|
||||
|
||||
layout = xkb_state_serialize_layout (state, XKB_STATE_LAYOUT_EFFECTIVE);
|
||||
|
@@ -48,6 +48,7 @@ clutter_headers = [
|
||||
'clutter-input-method.h',
|
||||
'clutter-interval.h',
|
||||
'clutter-keyframe-transition.h',
|
||||
'clutter-keymap.h',
|
||||
'clutter-keysyms.h',
|
||||
'clutter-layout-manager.h',
|
||||
'clutter-layout-meta.h',
|
||||
@@ -134,6 +135,7 @@ clutter_sources = [
|
||||
'clutter-virtual-input-device.c',
|
||||
'clutter-interval.c',
|
||||
'clutter-keyframe-transition.c',
|
||||
'clutter-keymap.c',
|
||||
'clutter-keysyms-table.c',
|
||||
'clutter-layout-manager.c',
|
||||
'clutter-layout-meta.c',
|
||||
@@ -219,7 +221,6 @@ clutter_deprecated_headers = [
|
||||
'deprecated/clutter-animatable.h',
|
||||
'deprecated/clutter-animation.h',
|
||||
'deprecated/clutter-animator.h',
|
||||
'deprecated/clutter-backend.h',
|
||||
'deprecated/clutter-behaviour.h',
|
||||
'deprecated/clutter-behaviour-depth.h',
|
||||
'deprecated/clutter-behaviour-ellipse.h',
|
||||
@@ -231,7 +232,6 @@ clutter_deprecated_headers = [
|
||||
'deprecated/clutter-box.h',
|
||||
'deprecated/clutter-cairo-texture.h',
|
||||
'deprecated/clutter-container.h',
|
||||
'deprecated/clutter-frame-source.h',
|
||||
'deprecated/clutter-group.h',
|
||||
'deprecated/clutter-input-device.h',
|
||||
'deprecated/clutter-keysyms.h',
|
||||
@@ -247,8 +247,6 @@ clutter_deprecated_headers = [
|
||||
'deprecated/clutter-table-layout.h',
|
||||
'deprecated/clutter-texture.h',
|
||||
'deprecated/clutter-timeline.h',
|
||||
'deprecated/clutter-timeout-pool.h',
|
||||
'deprecated/clutter-util.h',
|
||||
]
|
||||
|
||||
clutter_deprecated_sources = [
|
||||
@@ -265,7 +263,6 @@ clutter_deprecated_sources = [
|
||||
'deprecated/clutter-behaviour-scale.c',
|
||||
'deprecated/clutter-box.c',
|
||||
'deprecated/clutter-cairo-texture.c',
|
||||
'deprecated/clutter-frame-source.c',
|
||||
'deprecated/clutter-group.c',
|
||||
'deprecated/clutter-input-device-deprecated.c',
|
||||
'deprecated/clutter-layout-manager-deprecated.c',
|
||||
@@ -277,7 +274,6 @@ clutter_deprecated_sources = [
|
||||
'deprecated/clutter-state.c',
|
||||
'deprecated/clutter-table-layout.c',
|
||||
'deprecated/clutter-texture.c',
|
||||
'deprecated/clutter-timeout-pool.c',
|
||||
]
|
||||
|
||||
clutter_deprecated_private_headers = [
|
||||
@@ -356,6 +352,7 @@ if have_native_backend
|
||||
'evdev/clutter-event-evdev.c',
|
||||
'evdev/clutter-input-device-evdev.c',
|
||||
'evdev/clutter-input-device-tool-evdev.c',
|
||||
'evdev/clutter-keymap-evdev.c',
|
||||
'evdev/clutter-seat-evdev.c',
|
||||
'evdev/clutter-virtual-input-device-evdev.c',
|
||||
'evdev/clutter-xkb-utils.c',
|
||||
@@ -367,6 +364,7 @@ if have_native_backend
|
||||
'evdev/clutter-device-manager-evdev.h',
|
||||
'evdev/clutter-input-device-evdev.h',
|
||||
'evdev/clutter-input-device-tool-evdev.h',
|
||||
'evdev/clutter-keymap-evdev.h',
|
||||
'evdev/clutter-seat-evdev.h',
|
||||
'evdev/clutter-virtual-input-device-evdev.h',
|
||||
'evdev/clutter-xkb-utils.h',
|
||||
@@ -491,7 +489,7 @@ clutter_marshal = gnome.genmarshal('clutter-marshal',
|
||||
prefix: '_clutter_marshal',
|
||||
sources: 'clutter-marshal.list',
|
||||
valist_marshallers: true,
|
||||
extra_args: ['--prototypes', '--quiet'],
|
||||
extra_args: ['--quiet'],
|
||||
install_dir: clutter_clutter_includedir,
|
||||
install_header: true,
|
||||
)
|
||||
@@ -519,10 +517,12 @@ libmutter_clutter = shared_library(libmutter_clutter_name,
|
||||
cally_headers,
|
||||
cally_private_headers,
|
||||
],
|
||||
soversion: '0.0.0',
|
||||
version: '0.0.0',
|
||||
soversion: 0,
|
||||
c_args: clutter_c_args,
|
||||
include_directories: clutter_includes,
|
||||
dependencies: [clutter_deps],
|
||||
gnu_symbol_visibility: 'hidden',
|
||||
link_with: [
|
||||
libmutter_cogl,
|
||||
libmutter_cogl_pango,
|
||||
|
@@ -678,8 +678,8 @@ static gboolean
|
||||
check_onscreen_template (CoglRenderer *renderer,
|
||||
CoglSwapChain *swap_chain,
|
||||
CoglOnscreenTemplate *onscreen_template,
|
||||
CoglBool enable_argb,
|
||||
CoglBool enable_stereo,
|
||||
gboolean enable_argb,
|
||||
gboolean enable_stereo,
|
||||
GError **error)
|
||||
{
|
||||
GError *internal_error = NULL;
|
||||
@@ -807,6 +807,14 @@ clutter_backend_x11_get_keymap_direction (ClutterBackend *backend)
|
||||
return _clutter_keymap_x11_get_direction (backend_x11->keymap);
|
||||
}
|
||||
|
||||
static ClutterKeymap *
|
||||
clutter_backend_x11_get_keymap (ClutterBackend *backend)
|
||||
{
|
||||
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend);
|
||||
|
||||
return CLUTTER_KEYMAP (backend_x11->keymap);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_backend_x11_class_init (ClutterBackendX11Class *klass)
|
||||
{
|
||||
@@ -829,6 +837,7 @@ clutter_backend_x11_class_init (ClutterBackendX11Class *klass)
|
||||
backend_class->get_display = clutter_backend_x11_get_display;
|
||||
|
||||
backend_class->get_keymap_direction = clutter_backend_x11_get_keymap_direction;
|
||||
backend_class->get_keymap = clutter_backend_x11_get_keymap;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -97,9 +97,9 @@ translate_key_event (ClutterBackendX11 *backend_x11,
|
||||
_clutter_keymap_x11_get_is_modifier (backend_x11->keymap,
|
||||
event->key.hardware_keycode);
|
||||
event_x11->num_lock_set =
|
||||
_clutter_keymap_x11_get_num_lock_state (backend_x11->keymap);
|
||||
clutter_keymap_get_num_lock_state (CLUTTER_KEYMAP (backend_x11->keymap));
|
||||
event_x11->caps_lock_set =
|
||||
_clutter_keymap_x11_get_caps_lock_state (backend_x11->keymap);
|
||||
clutter_keymap_get_caps_lock_state (CLUTTER_KEYMAP (backend_x11->keymap));
|
||||
|
||||
/* unicode_value is the printable representation */
|
||||
n = XLookupString (&xevent->xkey, buffer, sizeof (buffer) - 1, NULL, NULL);
|
||||
|
@@ -1386,9 +1386,9 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
|
||||
_clutter_keymap_x11_get_is_modifier (backend_x11->keymap,
|
||||
event->key.hardware_keycode);
|
||||
event_x11->num_lock_set =
|
||||
_clutter_keymap_x11_get_num_lock_state (backend_x11->keymap);
|
||||
clutter_keymap_get_num_lock_state (CLUTTER_KEYMAP (backend_x11->keymap));
|
||||
event_x11->caps_lock_set =
|
||||
_clutter_keymap_x11_get_caps_lock_state (backend_x11->keymap);
|
||||
clutter_keymap_get_caps_lock_state (CLUTTER_KEYMAP (backend_x11->keymap));
|
||||
|
||||
source_device = g_hash_table_lookup (manager_xi2->devices_by_id,
|
||||
GINT_TO_POINTER (xev->sourceid));
|
||||
|
@@ -53,7 +53,7 @@ struct _DirectionCacheEntry
|
||||
|
||||
struct _ClutterKeymapX11
|
||||
{
|
||||
GObject parent_instance;
|
||||
ClutterKeymap parent_instance;
|
||||
|
||||
ClutterBackend *backend;
|
||||
|
||||
@@ -86,7 +86,7 @@ struct _ClutterKeymapX11
|
||||
|
||||
struct _ClutterKeymapX11Class
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
ClutterKeymapClass parent_class;
|
||||
};
|
||||
|
||||
enum
|
||||
@@ -104,7 +104,8 @@ static void clutter_event_translator_iface_init (ClutterEventTranslatorIface *if
|
||||
|
||||
#define clutter_keymap_x11_get_type _clutter_keymap_x11_get_type
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (ClutterKeymapX11, clutter_keymap_x11, G_TYPE_OBJECT,
|
||||
G_DEFINE_TYPE_WITH_CODE (ClutterKeymapX11, clutter_keymap_x11,
|
||||
CLUTTER_TYPE_KEYMAP,
|
||||
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_EVENT_TRANSLATOR,
|
||||
clutter_event_translator_iface_init));
|
||||
|
||||
@@ -215,12 +216,10 @@ static void
|
||||
update_locked_mods (ClutterKeymapX11 *keymap_x11,
|
||||
gint locked_mods)
|
||||
{
|
||||
#if 0
|
||||
gboolean old_caps_lock_state, old_num_lock_state;
|
||||
|
||||
old_caps_lock_state = keymap_x11->caps_lock_state;
|
||||
old_num_lock_state = keymap_x11->num_lock_state;
|
||||
#endif
|
||||
|
||||
keymap_x11->caps_lock_state = (locked_mods & CLUTTER_LOCK_MASK) != 0;
|
||||
keymap_x11->num_lock_state = (locked_mods & keymap_x11->num_lock_mask) != 0;
|
||||
@@ -229,12 +228,9 @@ update_locked_mods (ClutterKeymapX11 *keymap_x11,
|
||||
keymap_x11->num_lock_state ? "set" : "unset",
|
||||
keymap_x11->caps_lock_state ? "set" : "unset");
|
||||
|
||||
#if 0
|
||||
/* Add signal to ClutterBackend? */
|
||||
if ((keymap_x11->caps_lock_state != old_caps_lock_state) ||
|
||||
(keymap_x11->num_lock_state != old_num_lock_state))
|
||||
g_signal_emit_by_name (keymap_x11->backend, "key-lock-changed");
|
||||
#endif
|
||||
g_signal_emit_by_name (keymap_x11, "state-changed");
|
||||
}
|
||||
|
||||
/* the code to retrieve the keymap direction and cache it
|
||||
@@ -524,10 +520,27 @@ clutter_keymap_x11_finalize (GObject *gobject)
|
||||
G_OBJECT_CLASS (clutter_keymap_x11_parent_class)->finalize (gobject);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_keymap_x11_get_num_lock_state (ClutterKeymap *keymap)
|
||||
{
|
||||
ClutterKeymapX11 *keymap_x11 = CLUTTER_KEYMAP_X11 (keymap);
|
||||
|
||||
return keymap_x11->num_lock_state;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_keymap_x11_get_caps_lock_state (ClutterKeymap *keymap)
|
||||
{
|
||||
ClutterKeymapX11 *keymap_x11 = CLUTTER_KEYMAP_X11 (keymap);
|
||||
|
||||
return keymap_x11->caps_lock_state;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_keymap_x11_class_init (ClutterKeymapX11Class *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
ClutterKeymapClass *keymap_class = CLUTTER_KEYMAP_CLASS (klass);
|
||||
|
||||
obj_props[PROP_BACKEND] =
|
||||
g_param_spec_object ("backend",
|
||||
@@ -539,6 +552,10 @@ clutter_keymap_x11_class_init (ClutterKeymapX11Class *klass)
|
||||
gobject_class->constructed = clutter_keymap_x11_constructed;
|
||||
gobject_class->set_property = clutter_keymap_x11_set_property;
|
||||
gobject_class->finalize = clutter_keymap_x11_finalize;
|
||||
|
||||
keymap_class->get_num_lock_state = clutter_keymap_x11_get_num_lock_state;
|
||||
keymap_class->get_caps_lock_state = clutter_keymap_x11_get_caps_lock_state;
|
||||
|
||||
g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
|
||||
}
|
||||
|
||||
@@ -612,22 +629,6 @@ _clutter_keymap_x11_get_key_group (ClutterKeymapX11 *keymap,
|
||||
return XkbGroupForCoreState (state);
|
||||
}
|
||||
|
||||
gboolean
|
||||
_clutter_keymap_x11_get_num_lock_state (ClutterKeymapX11 *keymap)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_KEYMAP_X11 (keymap), FALSE);
|
||||
|
||||
return keymap->num_lock_state;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_clutter_keymap_x11_get_caps_lock_state (ClutterKeymapX11 *keymap)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_KEYMAP_X11 (keymap), FALSE);
|
||||
|
||||
return keymap->caps_lock_state;
|
||||
}
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
/* XXX - yes, I know that XKeycodeToKeysym() has been deprecated; hopefully,
|
||||
|
@@ -480,7 +480,7 @@ xsettings_client_new_with_grab_funcs (Display *display,
|
||||
{
|
||||
XSettingsClient *client;
|
||||
char buffer[256];
|
||||
char *atom_names[3];
|
||||
const char *atom_names[3];
|
||||
Atom atoms[3];
|
||||
|
||||
client = malloc (sizeof *client);
|
||||
|
@@ -29,26 +29,30 @@ endif
|
||||
clutter_c_args += clutter_debug_c_args
|
||||
|
||||
clutter_pkg_deps = [
|
||||
gdk_pixbuf_dep,
|
||||
atk_dep,
|
||||
cairo_gobject_dep,
|
||||
glib_dep,
|
||||
gobject_dep,
|
||||
gio_dep,
|
||||
json_glib_dep,
|
||||
pango_dep,
|
||||
]
|
||||
|
||||
clutter_pkg_private_deps = [
|
||||
gdk_pixbuf_dep,
|
||||
gthread_dep,
|
||||
gmodule_no_export_dep,
|
||||
atk_dep,
|
||||
pangocairo_dep,
|
||||
json_glib_dep,
|
||||
]
|
||||
|
||||
if have_pango_ft2
|
||||
clutter_pkg_deps += [
|
||||
clutter_pkg_private_deps += [
|
||||
pangoft2_dep,
|
||||
]
|
||||
endif
|
||||
|
||||
if have_wayland
|
||||
clutter_pkg_deps += [
|
||||
clutter_pkg_private_deps += [
|
||||
wayland_egl_dep,
|
||||
wayland_server_dep,
|
||||
]
|
||||
@@ -57,6 +61,8 @@ endif
|
||||
if have_x11
|
||||
clutter_pkg_deps += [
|
||||
x11_dep,
|
||||
]
|
||||
clutter_pkg_private_deps += [
|
||||
xext_dep,
|
||||
xdamage_dep,
|
||||
xcomposite_dep,
|
||||
@@ -66,7 +72,7 @@ if have_x11
|
||||
endif
|
||||
|
||||
if have_native_backend
|
||||
clutter_pkg_deps += [
|
||||
clutter_pkg_private_deps += [
|
||||
libudev_dep,
|
||||
libinput_dep,
|
||||
xkbcommon_dep,
|
||||
@@ -74,13 +80,14 @@ if have_native_backend
|
||||
endif
|
||||
|
||||
if have_libwacom
|
||||
clutter_pkg_deps += [
|
||||
clutter_pkg_private_deps += [
|
||||
libwacom_dep,
|
||||
]
|
||||
endif
|
||||
|
||||
clutter_deps = [
|
||||
clutter_pkg_deps,
|
||||
clutter_pkg_private_deps,
|
||||
libmutter_cogl_dep,
|
||||
m_dep
|
||||
]
|
||||
|
@@ -1,119 +0,0 @@
|
||||
#define CLUTTER_ENABLE_EXPERIMENTAL_API
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#define STAGE_WIDTH (300)
|
||||
#define STAGE_HEIGHT (300)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ClutterActor *stage;
|
||||
|
||||
ClutterActor *actor_group1;
|
||||
ClutterEffect *blur_effect1;
|
||||
|
||||
ClutterActor *actor_group2;
|
||||
ClutterEffect *blur_effect2;
|
||||
} Data;
|
||||
|
||||
static void
|
||||
check_results (ClutterStage *stage, gpointer user_data)
|
||||
{
|
||||
Data *data = user_data;
|
||||
gfloat width, height;
|
||||
ClutterRect rect;
|
||||
|
||||
clutter_offscreen_effect_get_target_rect (CLUTTER_OFFSCREEN_EFFECT (data->blur_effect1),
|
||||
&rect);
|
||||
|
||||
width = clutter_rect_get_width (&rect);
|
||||
height = clutter_rect_get_height (&rect);
|
||||
|
||||
if (g_test_verbose ())
|
||||
g_print ("Checking effect1 size: %.2f x %.2f\n",
|
||||
clutter_rect_get_width (&rect),
|
||||
clutter_rect_get_height (&rect));
|
||||
|
||||
g_assert_cmpint (width, <, STAGE_WIDTH);
|
||||
g_assert_cmpint (height, <, STAGE_HEIGHT);
|
||||
|
||||
clutter_offscreen_effect_get_target_rect (CLUTTER_OFFSCREEN_EFFECT (data->blur_effect2),
|
||||
&rect);
|
||||
|
||||
width = clutter_rect_get_width (&rect);
|
||||
height = clutter_rect_get_height (&rect);
|
||||
|
||||
if (g_test_verbose ())
|
||||
g_print ("Checking effect2 size: %.2f x %.2f\n", width, height);
|
||||
|
||||
g_assert_cmpint (width, ==, STAGE_WIDTH);
|
||||
g_assert_cmpint (height, ==, STAGE_HEIGHT);
|
||||
|
||||
|
||||
clutter_main_quit ();
|
||||
}
|
||||
|
||||
static ClutterActor *
|
||||
create_actor (gfloat x, gfloat y,
|
||||
gfloat width, gfloat height,
|
||||
const ClutterColor *color)
|
||||
{
|
||||
return g_object_new (CLUTTER_TYPE_ACTOR,
|
||||
"x", x,
|
||||
"y", y,
|
||||
"width", width,
|
||||
"height", height,
|
||||
"background-color", color,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
actor_offscreen_limit_max_size (void)
|
||||
{
|
||||
Data data;
|
||||
|
||||
if (!cogl_features_available (COGL_FEATURE_OFFSCREEN))
|
||||
return;
|
||||
|
||||
data.stage = clutter_test_get_stage ();
|
||||
g_signal_connect (data.stage, "after-paint",
|
||||
G_CALLBACK (check_results), &data);
|
||||
clutter_actor_set_size (data.stage, STAGE_WIDTH, STAGE_HEIGHT);
|
||||
|
||||
data.actor_group1 = clutter_actor_new ();
|
||||
clutter_actor_add_child (data.stage, data.actor_group1);
|
||||
data.blur_effect1 = clutter_blur_effect_new ();
|
||||
clutter_actor_add_effect (data.actor_group1, data.blur_effect1);
|
||||
clutter_actor_add_child (data.actor_group1,
|
||||
create_actor (10, 10,
|
||||
100, 100,
|
||||
CLUTTER_COLOR_Blue));
|
||||
clutter_actor_add_child (data.actor_group1,
|
||||
create_actor (100, 100,
|
||||
100, 100,
|
||||
CLUTTER_COLOR_Gray));
|
||||
|
||||
data.actor_group2 = clutter_actor_new ();
|
||||
clutter_actor_add_child (data.stage, data.actor_group2);
|
||||
data.blur_effect2 = clutter_blur_effect_new ();
|
||||
clutter_actor_add_effect (data.actor_group2, data.blur_effect2);
|
||||
clutter_actor_add_child (data.actor_group2,
|
||||
create_actor (-10, -10,
|
||||
100, 100,
|
||||
CLUTTER_COLOR_Yellow));
|
||||
clutter_actor_add_child (data.actor_group2,
|
||||
create_actor (250, 10,
|
||||
100, 100,
|
||||
CLUTTER_COLOR_ScarletRed));
|
||||
clutter_actor_add_child (data.actor_group2,
|
||||
create_actor (10, 250,
|
||||
100, 100,
|
||||
CLUTTER_COLOR_Yellow));
|
||||
|
||||
clutter_actor_show (data.stage);
|
||||
|
||||
clutter_main ();
|
||||
}
|
||||
|
||||
CLUTTER_TEST_SUITE (
|
||||
CLUTTER_TEST_UNIT ("/actor/offscreen/limit-max-size", actor_offscreen_limit_max_size)
|
||||
)
|
@@ -189,10 +189,11 @@ verify_redraws (gpointer user_data)
|
||||
clutter_actor_queue_redraw (data->child);
|
||||
verify_redraw (data, 1);
|
||||
|
||||
/* Modifying the transformation on the parent should cause a
|
||||
redraw */
|
||||
/* Modifying the transformation on the parent should not cause a redraw,
|
||||
since the FBO stores pre-transformed rendering that can be reused with
|
||||
any transformation. */
|
||||
clutter_actor_set_anchor_point (data->parent_container, 0, 1);
|
||||
verify_redraw (data, 1);
|
||||
verify_redraw (data, 0);
|
||||
|
||||
/* Redrawing an unrelated actor shouldn't cause a redraw */
|
||||
clutter_actor_set_position (data->unrelated_actor, 0, 1);
|
||||
|
@@ -19,7 +19,6 @@ clutter_conform_tests_actor_tests = [
|
||||
'actor-iter',
|
||||
'actor-layout',
|
||||
'actor-meta',
|
||||
'actor-offscreen-limit-max-size',
|
||||
'actor-offscreen-redirect',
|
||||
'actor-paint-opacity',
|
||||
'actor-pick',
|
||||
|
@@ -27,6 +27,9 @@ typedef struct SuperOH
|
||||
|
||||
static gint n_hands = NHANDS;
|
||||
|
||||
int
|
||||
test_actors_main (int argc, char *argv[]);
|
||||
|
||||
static GOptionEntry super_oh_entries[] = {
|
||||
{
|
||||
"num-hands", 'n',
|
||||
|
@@ -4,6 +4,12 @@
|
||||
|
||||
static gboolean is_expanded = FALSE;
|
||||
|
||||
int
|
||||
test_animation_main (int argc, char *argv[]);
|
||||
|
||||
const char *
|
||||
test_animation_describe (void);
|
||||
|
||||
static void
|
||||
on_rect_transitions_completed (ClutterActor *actor)
|
||||
{
|
||||
|
@@ -5,6 +5,10 @@
|
||||
|
||||
static ClutterAnimator *animator;
|
||||
|
||||
gint
|
||||
test_animator_main (gint argc,
|
||||
gchar **argv);
|
||||
|
||||
static ClutterActor *new_rect (gint r,
|
||||
gint g,
|
||||
gint b,
|
||||
|
@@ -47,6 +47,12 @@ static const gchar *desaturare_glsl_shader =
|
||||
|
||||
static gboolean is_expanded = FALSE;
|
||||
|
||||
const char *
|
||||
test_bind_constraint_describe (void);
|
||||
|
||||
int
|
||||
test_bind_constraint_main (int argc, char *argv[]);
|
||||
|
||||
static gboolean
|
||||
on_button_release (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
|
@@ -31,6 +31,14 @@ struct _KeyGroupClass
|
||||
ClutterActor *child);
|
||||
};
|
||||
|
||||
GType key_group_get_type (void);
|
||||
|
||||
int
|
||||
test_binding_pool_main (int argc, char *argv[]);
|
||||
|
||||
const char *
|
||||
test_binding_pool_describe (void);
|
||||
|
||||
G_DEFINE_TYPE (KeyGroup, key_group, CLUTTER_TYPE_ACTOR)
|
||||
|
||||
enum
|
||||
|
@@ -3,6 +3,12 @@
|
||||
#include <cairo.h>
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
int
|
||||
test_cairo_clock_main (int argc, char *argv[]);
|
||||
|
||||
const char *
|
||||
test_cairo_clock_describe (void);
|
||||
|
||||
static gboolean
|
||||
draw_clock (ClutterCanvas *canvas,
|
||||
cairo_t *cr,
|
||||
|
@@ -25,6 +25,12 @@ Flower;
|
||||
|
||||
static ClutterActor *stage = NULL;
|
||||
|
||||
int
|
||||
test_cairo_flowers_main (int argc, char **argv);
|
||||
|
||||
const char *
|
||||
test_cairo_flowers_describe (void);
|
||||
|
||||
static gboolean
|
||||
draw_flower (ClutterCanvas *canvas,
|
||||
cairo_t *cr,
|
||||
|
@@ -30,6 +30,11 @@ typedef struct _TestMultiLayerMaterialState
|
||||
|
||||
} TestMultiLayerMaterialState;
|
||||
|
||||
int
|
||||
test_cogl_multitexture_main (int argc, char *argv[]);
|
||||
|
||||
const char *
|
||||
test_cogl_multitexture_describe (void);
|
||||
|
||||
static void
|
||||
frame_cb (ClutterTimeline *timeline,
|
||||
|
@@ -56,6 +56,12 @@ struct _TestCoglboxClass
|
||||
|
||||
static GType test_coglbox_get_type (void) G_GNUC_CONST;
|
||||
|
||||
int
|
||||
test_cogl_offscreen_main (int argc, char *argv[]);
|
||||
|
||||
const char *
|
||||
test_cogl_offscreen_describe (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
/* Coglbox private declaration
|
||||
@@ -153,7 +159,7 @@ test_coglbox_dispose (GObject *object)
|
||||
* This sets up a Clutter like coordinate system for a Cogl
|
||||
* framebuffer
|
||||
*/
|
||||
void
|
||||
static void
|
||||
setup_viewport (unsigned int width,
|
||||
unsigned int height,
|
||||
float fovy,
|
||||
|
@@ -51,6 +51,12 @@ struct _Data
|
||||
CoglMaterial *material;
|
||||
};
|
||||
|
||||
int
|
||||
test_cogl_point_sprites_main (int argc, char *argv[]);
|
||||
|
||||
const char *
|
||||
test_cogl_point_sprites_describe (void);
|
||||
|
||||
static CoglHandle
|
||||
generate_round_texture (void)
|
||||
{
|
||||
|
@@ -7,10 +7,13 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
char *source;
|
||||
const char *name;
|
||||
const char *source;
|
||||
} ShaderSource;
|
||||
|
||||
int
|
||||
test_cogl_shader_glsl_main (int argc, char *argv[]);
|
||||
|
||||
/* a couple of boilerplate defines that are common amongst all the
|
||||
* sample shaders
|
||||
*/
|
||||
@@ -51,22 +54,6 @@ static ShaderSource shaders[]=
|
||||
{"box-blur",
|
||||
FRAGMENT_SHADER_VARS
|
||||
|
||||
#if GPU_SUPPORTS_DYNAMIC_BRANCHING
|
||||
"uniform float radius;"
|
||||
FRAGMENT_SHADER_BEGIN
|
||||
"float u, v;"
|
||||
"int count = 1;"
|
||||
"for (u=-radius;u<radius;u++)"
|
||||
" for (v=-radius;v<radius;v++)"
|
||||
" {"
|
||||
" color += texture2D(tex, "
|
||||
" vec2(cogl_tex_coord_in[0].s + u * 2.0 * x_step, "
|
||||
" cogl_tex_coord_in[0].t + v * 2.0 * y_step));"
|
||||
" count ++;"
|
||||
" }"
|
||||
"color = color / float(count);"
|
||||
FRAGMENT_SHADER_END
|
||||
#else
|
||||
"vec4 get_rgba_rel(sampler2D tex, float dx, float dy)"
|
||||
"{"
|
||||
" return texture2D (tex, cogl_tex_coord_in[0].st "
|
||||
@@ -86,7 +73,6 @@ static ShaderSource shaders[]=
|
||||
" color += get_rgba_rel (tex, x_step, y_step); count++;"
|
||||
" color = color / count;"
|
||||
FRAGMENT_SHADER_END
|
||||
#endif
|
||||
},
|
||||
|
||||
{"invert",
|
||||
|
@@ -56,6 +56,12 @@ struct _TestCoglboxClass
|
||||
|
||||
static GType test_coglbox_get_type (void) G_GNUC_CONST;
|
||||
|
||||
int
|
||||
test_cogl_tex_convert_main (int argc, char *argv[]);
|
||||
|
||||
const char *
|
||||
test_cogl_tex_convert_describe (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
/* Coglbox private declaration
|
||||
|
@@ -60,6 +60,9 @@ typedef struct _TestCoglbox TestCoglbox;
|
||||
typedef struct _TestCoglboxClass TestCoglboxClass;
|
||||
typedef struct _TestCoglboxPrivate TestCoglboxPrivate;
|
||||
|
||||
const char *
|
||||
test_cogl_tex_foreign_describe (void);
|
||||
|
||||
struct _TestCoglbox
|
||||
{
|
||||
ClutterActor parent;
|
||||
@@ -116,6 +119,9 @@ G_DEFINE_TYPE_WITH_PRIVATE (TestCoglbox, test_coglbox, CLUTTER_TYPE_ACTOR);
|
||||
#define TEST_COGLBOX_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), TEST_TYPE_COGLBOX, TestCoglboxPrivate))
|
||||
|
||||
int
|
||||
test_cogl_tex_foreign_main (int argc, char *argv[]);
|
||||
|
||||
/* Coglbox implementation
|
||||
*--------------------------------------------------*/
|
||||
|
||||
|
@@ -56,6 +56,12 @@ struct _TestCoglboxClass
|
||||
|
||||
static GType test_coglbox_get_type (void) G_GNUC_CONST;
|
||||
|
||||
int
|
||||
test_cogl_tex_polygon_main (int argc, char *argv[]);
|
||||
|
||||
const char *
|
||||
test_cogl_tex_polygon_describe (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
/* Coglbox private declaration
|
||||
|
@@ -57,6 +57,12 @@ struct _TestCoglboxClass
|
||||
|
||||
static GType test_coglbox_get_type (void) G_GNUC_CONST;
|
||||
|
||||
int
|
||||
test_cogl_tex_tile_main (int argc, char *argv[]);
|
||||
|
||||
const char *
|
||||
test_cogl_tex_tile_describe (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
/* Coglbox private declaration
|
||||
|
@@ -53,6 +53,12 @@ typedef struct _TestState
|
||||
guint frame_id;
|
||||
} TestState;
|
||||
|
||||
int
|
||||
test_cogl_vertex_buffer_main (int argc, char *argv[]);
|
||||
|
||||
const char *
|
||||
test_cogl_vertex_buffer_describe (void);
|
||||
|
||||
static void
|
||||
frame_cb (ClutterTimeline *timeline,
|
||||
gint elapsed_msecs,
|
||||
|
@@ -19,6 +19,14 @@ typedef struct _ColorContentClass {
|
||||
|
||||
static void clutter_content_iface_init (ClutterContentIface *iface);
|
||||
|
||||
GType color_content_get_type (void);
|
||||
|
||||
int
|
||||
test_content_main (int argc, char *argv[]);
|
||||
|
||||
const char *
|
||||
test_content_describe (void);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (ColorContent, color_content, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTENT,
|
||||
clutter_content_iface_init))
|
||||
|
@@ -12,6 +12,9 @@ typedef struct {
|
||||
GHashTable *devices;
|
||||
} TestDevicesApp;
|
||||
|
||||
int
|
||||
test_devices_main (int argc, char **argv);
|
||||
|
||||
static const gchar *
|
||||
device_type_name (ClutterInputDevice *device)
|
||||
{
|
||||
|
@@ -55,6 +55,12 @@ static ClutterActor *easing_mode_label = NULL;
|
||||
|
||||
static ClutterAnimation *last_animation = NULL;
|
||||
|
||||
int
|
||||
test_easing_main (int argc, char *argv[]);
|
||||
|
||||
const char *
|
||||
test_easing_describe (void);
|
||||
|
||||
/* recenter_bouncer:
|
||||
*
|
||||
* repositions (through an animation) the bouncer at the center of the stage
|
||||
|
@@ -4,6 +4,12 @@
|
||||
|
||||
gboolean IsFullScreen = FALSE, IsMotion = TRUE;
|
||||
|
||||
int
|
||||
test_events_main (int argc, char *argv[]);
|
||||
|
||||
const char *
|
||||
test_events_describe (void);
|
||||
|
||||
static const gchar *
|
||||
get_event_type_name (const ClutterEvent *event)
|
||||
{
|
||||
@@ -53,7 +59,7 @@ get_event_type_name (const ClutterEvent *event)
|
||||
static gchar *
|
||||
get_event_state_string (const ClutterEvent *event)
|
||||
{
|
||||
gchar *mods[18];
|
||||
const char *mods[18];
|
||||
int i = 0;
|
||||
ClutterModifierType state = clutter_event_get_state (event);
|
||||
|
||||
@@ -96,7 +102,7 @@ get_event_state_string (const ClutterEvent *event)
|
||||
mods[i++] = "-";
|
||||
|
||||
mods[i] = NULL;
|
||||
return g_strjoinv (",", mods);
|
||||
return g_strjoinv (",", (char **) mods);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -422,15 +428,15 @@ test_events_main (int argc, char *argv[])
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Events");
|
||||
clutter_actor_set_name (stage, "Stage");
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
g_signal_connect (stage, "event", G_CALLBACK (input_cb), "stage");
|
||||
g_signal_connect (stage, "event", G_CALLBACK (input_cb), (char *) "stage");
|
||||
g_signal_connect (stage, "fullscreen",
|
||||
G_CALLBACK (stage_state_cb), "fullscreen");
|
||||
G_CALLBACK (stage_state_cb), (char *) "fullscreen");
|
||||
g_signal_connect (stage, "unfullscreen",
|
||||
G_CALLBACK (stage_state_cb), "unfullscreen");
|
||||
G_CALLBACK (stage_state_cb), (char *) "unfullscreen");
|
||||
g_signal_connect (stage, "activate",
|
||||
G_CALLBACK (stage_state_cb), "activate");
|
||||
G_CALLBACK (stage_state_cb), (char *) "activate");
|
||||
g_signal_connect (stage, "deactivate",
|
||||
G_CALLBACK (stage_state_cb), "deactivate");
|
||||
G_CALLBACK (stage_state_cb), (char *) "deactivate");
|
||||
|
||||
focus_box = clutter_rectangle_new_with_color (CLUTTER_COLOR_Black);
|
||||
clutter_actor_set_name (focus_box, "Focus Box");
|
||||
@@ -442,7 +448,7 @@ test_events_main (int argc, char *argv[])
|
||||
clutter_actor_set_position (actor, 100, 100);
|
||||
clutter_actor_set_reactive (actor, TRUE);
|
||||
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
|
||||
g_signal_connect (actor, "event", G_CALLBACK (input_cb), "red box");
|
||||
g_signal_connect (actor, "event", G_CALLBACK (input_cb), (char *) "red box");
|
||||
g_signal_connect (actor, "key-focus-in", G_CALLBACK (key_focus_in_cb),
|
||||
focus_box);
|
||||
/* Toggle motion - enter/leave capture */
|
||||
@@ -457,7 +463,7 @@ test_events_main (int argc, char *argv[])
|
||||
clutter_actor_set_position (actor, 250, 100);
|
||||
clutter_actor_set_reactive (actor, TRUE);
|
||||
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
|
||||
g_signal_connect (actor, "event", G_CALLBACK (input_cb), "green box");
|
||||
g_signal_connect (actor, "event", G_CALLBACK (input_cb), (char *) "green box");
|
||||
g_signal_connect (actor, "key-focus-in", G_CALLBACK (key_focus_in_cb),
|
||||
focus_box);
|
||||
g_signal_connect (actor, "captured-event", G_CALLBACK (capture_cb), NULL);
|
||||
@@ -468,7 +474,7 @@ test_events_main (int argc, char *argv[])
|
||||
clutter_actor_set_position (actor, 400, 100);
|
||||
clutter_actor_set_reactive (actor, TRUE);
|
||||
clutter_container_add (CLUTTER_CONTAINER(stage), actor, NULL);
|
||||
g_signal_connect (actor, "event", G_CALLBACK (input_cb), "blue box");
|
||||
g_signal_connect (actor, "event", G_CALLBACK (input_cb), (char *) "blue box");
|
||||
g_signal_connect (actor, "key-focus-in", G_CALLBACK (key_focus_in_cb),
|
||||
focus_box);
|
||||
/* Fullscreen */
|
||||
@@ -481,7 +487,7 @@ test_events_main (int argc, char *argv[])
|
||||
clutter_actor_set_size (actor, 400, 50);
|
||||
clutter_actor_set_position (actor, 100, 250);
|
||||
clutter_container_add (CLUTTER_CONTAINER(stage), actor, NULL);
|
||||
g_signal_connect (actor, "event", G_CALLBACK (input_cb), "blue box");
|
||||
g_signal_connect (actor, "event", G_CALLBACK (input_cb), (char *) "blue box");
|
||||
g_signal_connect (actor, "key-focus-in", G_CALLBACK (key_focus_in_cb),
|
||||
focus_box);
|
||||
g_signal_connect (stage, "key-focus-in", G_CALLBACK (key_focus_in_cb),
|
||||
@@ -493,7 +499,7 @@ test_events_main (int argc, char *argv[])
|
||||
clutter_actor_set_size (actor, 100, 100);
|
||||
clutter_actor_set_reactive (actor, TRUE);
|
||||
|
||||
g_signal_connect (actor, "event", G_CALLBACK (input_cb), "yellow box");
|
||||
g_signal_connect (actor, "event", G_CALLBACK (input_cb), (char *) "yellow box");
|
||||
|
||||
/* note group not reactive */
|
||||
group = clutter_group_new ();
|
||||
|
@@ -8,7 +8,13 @@
|
||||
#define STAGE_WIDTH 800
|
||||
#define STAGE_HEIGHT 600
|
||||
|
||||
ClutterActor *
|
||||
int
|
||||
test_fbo_main (int argc, char *argv[]);
|
||||
|
||||
const char *
|
||||
test_fbo_describe (void);
|
||||
|
||||
static ClutterActor *
|
||||
make_source (void)
|
||||
{
|
||||
ClutterActor *source, *actor;
|
||||
|
@@ -1,6 +1,12 @@
|
||||
#include <gmodule.h>
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
int
|
||||
test_grab_main (int argc, char *argv[]);
|
||||
|
||||
const char *
|
||||
test_grab_describe (void);
|
||||
|
||||
static void
|
||||
stage_state_cb (ClutterStage *stage,
|
||||
gpointer data)
|
||||
@@ -211,22 +217,22 @@ test_grab_main (int argc, char *argv[])
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Grabs");
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
g_signal_connect (stage, "event",
|
||||
G_CALLBACK (debug_event_cb), "stage");
|
||||
G_CALLBACK (debug_event_cb), (char *) "stage");
|
||||
g_signal_connect (stage, "fullscreen",
|
||||
G_CALLBACK (stage_state_cb), "fullscreen");
|
||||
G_CALLBACK (stage_state_cb), (char *) "fullscreen");
|
||||
g_signal_connect (stage, "unfullscreen",
|
||||
G_CALLBACK (stage_state_cb), "unfullscreen");
|
||||
G_CALLBACK (stage_state_cb), (char *) "unfullscreen");
|
||||
g_signal_connect (stage, "activate",
|
||||
G_CALLBACK (stage_state_cb), "activate");
|
||||
G_CALLBACK (stage_state_cb), (char *) "activate");
|
||||
g_signal_connect (stage, "deactivate",
|
||||
G_CALLBACK (stage_state_cb), "deactivate");
|
||||
G_CALLBACK (stage_state_cb), (char *) "deactivate");
|
||||
|
||||
actor = clutter_rectangle_new_with_color (&rcol);
|
||||
clutter_actor_set_size (actor, 100, 100);
|
||||
clutter_actor_set_position (actor, 100, 100);
|
||||
clutter_actor_set_reactive (actor, TRUE);
|
||||
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
|
||||
g_signal_connect (actor, "event", G_CALLBACK (debug_event_cb), "red box");
|
||||
g_signal_connect (actor, "event", G_CALLBACK (debug_event_cb), (char *) "red box");
|
||||
g_signal_connect (actor, "button-press-event",
|
||||
G_CALLBACK (grab_pointer_cb), NULL);
|
||||
g_signal_connect (actor, "button-release-event",
|
||||
@@ -237,7 +243,7 @@ test_grab_main (int argc, char *argv[])
|
||||
clutter_actor_set_position (actor, 100, 300);
|
||||
clutter_actor_set_reactive (actor, TRUE);
|
||||
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
|
||||
g_signal_connect (actor, "event", G_CALLBACK (debug_event_cb), "yellow box");
|
||||
g_signal_connect (actor, "event", G_CALLBACK (debug_event_cb), (char *) "yellow box");
|
||||
g_signal_connect (actor, "button-press-event",
|
||||
G_CALLBACK (toggle_grab_pointer_cb), NULL);
|
||||
|
||||
@@ -247,7 +253,7 @@ test_grab_main (int argc, char *argv[])
|
||||
clutter_actor_set_reactive (actor, TRUE);
|
||||
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
|
||||
g_signal_connect (actor, "event",
|
||||
G_CALLBACK (debug_event_cb), "blue box");
|
||||
G_CALLBACK (debug_event_cb), (char *) "blue box");
|
||||
g_signal_connect (actor, "button-press-event",
|
||||
G_CALLBACK (grab_pointer_cb), NULL);
|
||||
g_signal_connect (actor, "button-release-event",
|
||||
@@ -259,7 +265,7 @@ test_grab_main (int argc, char *argv[])
|
||||
clutter_actor_set_reactive (actor, TRUE);
|
||||
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
|
||||
g_signal_connect (actor, "event",
|
||||
G_CALLBACK (debug_event_cb), "green box");
|
||||
G_CALLBACK (debug_event_cb), (char *) "green box");
|
||||
g_signal_connect (actor, "button-press-event",
|
||||
G_CALLBACK (green_press_cb), NULL);
|
||||
|
||||
@@ -270,7 +276,7 @@ test_grab_main (int argc, char *argv[])
|
||||
clutter_actor_set_reactive (actor, TRUE);
|
||||
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
|
||||
g_signal_connect (actor, "event",
|
||||
G_CALLBACK (debug_event_cb), "cyan box");
|
||||
G_CALLBACK (debug_event_cb), (char *) "cyan box");
|
||||
g_signal_connect (actor, "button-press-event",
|
||||
G_CALLBACK (cyan_press_cb), NULL);
|
||||
|
||||
|
@@ -20,6 +20,14 @@ typedef struct _SolidContentClass {
|
||||
|
||||
static void clutter_content_iface_init (ClutterContentIface *iface);
|
||||
|
||||
GType solid_content_get_type (void);
|
||||
|
||||
const char *
|
||||
test_image_describe (void);
|
||||
|
||||
int
|
||||
test_image_main (int argc, char *argv[]);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (SolidContent, solid_content, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTENT,
|
||||
clutter_content_iface_init))
|
||||
|
@@ -11,6 +11,12 @@ static const ClutterColor colors[] = {
|
||||
#define PADDING (64.0f)
|
||||
#define SIZE (64.0f)
|
||||
|
||||
const char *
|
||||
test_keyframe_transition_describe (void);
|
||||
|
||||
int
|
||||
test_keyframe_transition_main (int argc, char *argv[]);
|
||||
|
||||
static void
|
||||
on_transition_stopped (ClutterActor *actor,
|
||||
const gchar *transition_name,
|
||||
|
@@ -48,6 +48,14 @@ struct _MyThingPrivate
|
||||
guint use_transformed_box : 1;
|
||||
};
|
||||
|
||||
GType my_thing_get_type (void);
|
||||
|
||||
int
|
||||
test_layout_main (int argc, char *argv[]);
|
||||
|
||||
const char *
|
||||
test_layout_describe (void);
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (MyThing, my_thing, CLUTTER_TYPE_ACTOR)
|
||||
|
||||
#define MY_THING_GET_PRIVATE(obj) \
|
||||
@@ -417,7 +425,7 @@ my_thing_init (MyThing *thing)
|
||||
thing->priv = MY_THING_GET_PRIVATE (thing);
|
||||
}
|
||||
|
||||
ClutterActor *
|
||||
static ClutterActor *
|
||||
my_thing_new (gfloat padding,
|
||||
gfloat spacing)
|
||||
{
|
||||
|
@@ -4,6 +4,9 @@
|
||||
static GList *stages = NULL;
|
||||
static gint n_stages = 1;
|
||||
|
||||
int
|
||||
test_multistage_main (int argc, char *argv[]);
|
||||
|
||||
static gboolean
|
||||
tex_button_cb (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
|
@@ -56,6 +56,12 @@ static GOptionEntry super_oh_entries[] = {
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
int
|
||||
test_paint_wrapper_main (int argc, char *argv[]);
|
||||
|
||||
const char *
|
||||
test_paint_wrapper_describe (void);
|
||||
|
||||
static gboolean
|
||||
on_button_press_event (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
|
@@ -11,6 +11,10 @@
|
||||
|
||||
static gboolean toggled = FALSE;
|
||||
|
||||
int
|
||||
test_path_constraint_main (int argc,
|
||||
char *argv[]);
|
||||
|
||||
static gboolean
|
||||
on_button_press (ClutterActor *actor,
|
||||
const ClutterEvent *event,
|
||||
|
@@ -23,6 +23,12 @@
|
||||
static gboolean disable_x11 = FALSE;
|
||||
static gboolean disable_animation = FALSE;
|
||||
|
||||
int
|
||||
test_pixmap_main (int argc, char **argv);
|
||||
|
||||
const char *
|
||||
test_pixmap_describe (void);
|
||||
|
||||
static GOptionEntry g_options[] =
|
||||
{
|
||||
{ "disable-x11",
|
||||
@@ -131,7 +137,7 @@ stage_button_press_cb (ClutterActor *actor,
|
||||
return CLUTTER_EVENT_STOP;
|
||||
}
|
||||
|
||||
Pixmap
|
||||
static Pixmap
|
||||
create_pixmap (guint *width, guint *height, guint *depth)
|
||||
{
|
||||
Display *dpy = clutter_x11_get_default_display ();
|
||||
|
@@ -26,6 +26,12 @@
|
||||
#define STAGE_WIDTH 800
|
||||
#define STAGE_HEIGHT 550
|
||||
|
||||
int
|
||||
test_rotate_zoom_main (int argc, char *argv[]);
|
||||
|
||||
const char *
|
||||
test_rotate_zoom_describe (void);
|
||||
|
||||
static ClutterActor *
|
||||
create_hand (void)
|
||||
{
|
||||
|
@@ -18,6 +18,12 @@ static const ClutterGravity gravities[] = {
|
||||
static gint gindex = 0;
|
||||
static ClutterActor *label;
|
||||
|
||||
int
|
||||
test_scale_main (int argc, char *argv[]);
|
||||
|
||||
const char *
|
||||
test_scale_describe (void);
|
||||
|
||||
static void
|
||||
set_next_gravity (ClutterActor *actor)
|
||||
{
|
||||
|
@@ -10,6 +10,9 @@
|
||||
static ClutterScript *script = NULL;
|
||||
static guint merge_id = 0;
|
||||
|
||||
int
|
||||
test_script_main (int argc, char *argv[]);
|
||||
|
||||
static const gchar *test_unmerge =
|
||||
"["
|
||||
" {"
|
||||
@@ -75,28 +78,6 @@ static const gchar *test_behaviour =
|
||||
" }"
|
||||
"]";
|
||||
|
||||
gdouble
|
||||
sine_alpha (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = clutter_alpha_get_timeline (alpha);
|
||||
|
||||
return sin (clutter_timeline_get_progress (timeline) * G_PI);
|
||||
}
|
||||
|
||||
gdouble
|
||||
double_ramp_alpha (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = clutter_alpha_get_timeline (alpha);
|
||||
gdouble progress = clutter_timeline_get_progress (timeline);
|
||||
|
||||
if (progress >= 0.5)
|
||||
return 1.0 - progress;
|
||||
|
||||
return progress;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
blue_button_press (ClutterActor *actor,
|
||||
ClutterButtonEvent *event,
|
||||
|
@@ -20,6 +20,9 @@ static const gchar *rect_color[N_RECTS] = {
|
||||
static ClutterActor *rectangle[N_RECTS];
|
||||
static ClutterActor *viewport = NULL;
|
||||
|
||||
int
|
||||
test_scrolling_main (int argc, char *argv[]);
|
||||
|
||||
static void
|
||||
on_drag_end (ClutterDragAction *action,
|
||||
ClutterActor *actor,
|
||||
|
@@ -7,6 +7,9 @@
|
||||
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
int
|
||||
test_shader_effects_main (int argc, char *argv[]);
|
||||
|
||||
G_MODULE_EXPORT int
|
||||
test_shader_effects_main (int argc, char *argv[])
|
||||
{
|
||||
|
@@ -16,17 +16,23 @@ struct _CallbackData
|
||||
guint idle_source;
|
||||
};
|
||||
|
||||
int
|
||||
test_stage_read_pixels_main (int argc, char **argv);
|
||||
|
||||
const char *
|
||||
test_stage_read_pixels_describe (void);
|
||||
|
||||
static ClutterActor *
|
||||
make_label (void)
|
||||
{
|
||||
ClutterActor *label;
|
||||
gchar *text;
|
||||
gchar *argv[] = { "ls", "--help", NULL };
|
||||
const char *argv[] = { "ls", "--help", NULL };
|
||||
|
||||
label = clutter_text_new ();
|
||||
clutter_text_set_font_name (CLUTTER_TEXT (label), "Sans 10");
|
||||
|
||||
if (g_spawn_sync (NULL, argv, NULL,
|
||||
if (g_spawn_sync (NULL, (char **) argv, NULL,
|
||||
G_SPAWN_STDERR_TO_DEV_NULL | G_SPAWN_SEARCH_PATH,
|
||||
NULL, NULL, &text, NULL, NULL, NULL))
|
||||
{
|
||||
|
@@ -2,6 +2,12 @@
|
||||
#include <gmodule.h>
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
int
|
||||
test_stage_sizing_main (int argc, char *argv[]);
|
||||
|
||||
const char *
|
||||
test_stage_sizing_describe (void);
|
||||
|
||||
static gboolean
|
||||
fullscreen_clicked_cb (ClutterStage *stage)
|
||||
{
|
||||
|
@@ -6,6 +6,13 @@
|
||||
static ClutterState *state;
|
||||
static ClutterAnimator *animator;
|
||||
|
||||
gint
|
||||
test_state_animator_main (gint argc,
|
||||
gchar **argv);
|
||||
|
||||
const char *
|
||||
test_state_animator_describe (void);
|
||||
|
||||
static gboolean press_event (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
gpointer user_data)
|
||||
|
@@ -6,15 +6,8 @@
|
||||
|
||||
#define TEST_STATE_SCRIPT_FILE "test-script-signals.json"
|
||||
|
||||
gboolean
|
||||
on_button_press (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
g_print ("Button pressed!\n");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
int
|
||||
test_state_script_main (int argc, char *argv[]);
|
||||
|
||||
G_MODULE_EXPORT int
|
||||
test_state_script_main (int argc, char *argv[])
|
||||
|
@@ -13,6 +13,12 @@
|
||||
#define ROWS (STAGE_HEIGHT/ACTOR_HEIGHT)
|
||||
#define TOTAL (ROWS*COLS)
|
||||
|
||||
gint
|
||||
test_state_main (gint argc,
|
||||
gchar **argv);
|
||||
|
||||
const char *
|
||||
test_state_describe (void);
|
||||
|
||||
static gboolean press_event (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
|
@@ -7,6 +7,12 @@ enum {
|
||||
BOTH = 2
|
||||
};
|
||||
|
||||
int
|
||||
test_swipe_action_main (int argc, char *argv[]);
|
||||
|
||||
const char *
|
||||
test_swipe_action_describe (void);
|
||||
|
||||
static void
|
||||
swept_cb (ClutterSwipeAction *action,
|
||||
ClutterActor *actor,
|
||||
|
@@ -9,6 +9,12 @@
|
||||
|
||||
#define FONT "Sans 12"
|
||||
|
||||
int
|
||||
test_table_layout_main (int argc, char *argv[]);
|
||||
|
||||
const char *
|
||||
test_table_layout_describe (void);
|
||||
|
||||
static void
|
||||
set_text (ClutterActor *actor, const gchar *text)
|
||||
{
|
||||
|
@@ -2,6 +2,13 @@
|
||||
#include <gmodule.h>
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
gint
|
||||
test_text_field_main (gint argc,
|
||||
gchar **argv);
|
||||
|
||||
const char *
|
||||
test_text_field_describe (void);
|
||||
|
||||
static void
|
||||
on_entry_activate (ClutterText *text,
|
||||
gpointer data)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user