Some of the tests were ignoring the return value of
clutter_init_with_args and instead they would recognise an error by
seeing whether the GError parameter was set. This patch changes it to
check the return value so that it won't give a warning now that
G_GNUC_WARN_UNUSED_RESULT is on that function.
http://bugzilla.clutter-project.org/show_bug.cgi?id=2574
This fixes segfaults when something goes wrong during
init, but the test keeps going anyway.
Except for test-easing and test-picking, these were fixed by
sed magic:
sed -i -s -e "s/clutter_init \?(&argc, &argv)/\
if (clutter_init (\&argc, \&argv) != CLUTTER_INIT_SUCCESS)\n\
return 1/" tests/*/*.c
http://bugzilla.clutter-project.org/show_bug.cgi?id=2574
The _clutter_do_redraw() function should really be moved inside
ClutterStage, since all it does is calling private stage and
backend functions. This also allows us to change a long-standing
issue with a global fps counter for all stages, instead of a\
per-stage one.
Let's try and start reducing the size of ClutterActorPrivate by moving
some optional, out-of-band data from it to GObject data.
The ShaderData structure is a prime candidate for this migration: it
does not need to be inspected by the actor, and its relationship with an
actor is transient and optional.
By attaching it to the actor's instance through g_object_set_data() we
neatly tie its lifetime to the instance, and we don't have to care
cleaning it up in the finalize()/dispose() implementation of
ClutterActor itself.
The venerable test-actors used the default stage, which meant that
closing the window just stopped the main loop but left the scene intact.
This does not happen with a normal stage created through
clutter_stage_new().
The change happened in 6ed6b2a54b, in an
unhelpfully named commit that was just supposed to switch to static
colors. My bad.
Anyway, the change led to some assertion failures when closing the stage
in the middle of an animation.
The correct thing to do when using an actor from another object (a
Timeline ::new-frame callback in this case) without owning the instance
is to connect to the ::destroy signal and clean up the pointer to avoid
calling an invalid actor.
CLUTTER_BIND_POSITION and CLUTTER_BIND_SIZE are two convenience
enumeration values for binding x and y, and width and height
respectively, using a single ClutterBindConstraint.
With test-clip it's possible to draw three different shapes depending
on what mouse button is used: a rectangle, an ellipse or a path
containing multiple shapes. However the ellipse is also a path so it
doesn't really test anything extra from the third option. This
replaces the ellipse with a rectangle that is first rotated by the
modelview matrix. The rotated matrix won't be able to use the scissor
so it can be used to test stencil and clip plane clipping.
Hierarchy and Device changed events come through with the X window set
to be the root window, not the stage window. We need to whitelist them
so that we can actually support hotplugging and device changes.
Slave and floating devices should always be disabled, and not deliver
events to the scene. It is up to the user to enable non-master devices
and handle events coming from them.
ClutterInputDevice gets a new :enabled property, defaulting to FALSE;
when a device manager creates a new device it has to set it to TRUE if
the :device-mode property is set to CLUTTER_INPUT_MODE_MASTER.
The main event queue entry point, _clutter_event_push(), will
automatically discard events coming from disabled devices.
This is a lump commit that is fairly difficult to break down without
either breaking bisecting or breaking the test cases.
The new design for handling X11 event translation works this way:
- ClutterBackend::translate_event() has been added as the central
point used by a ClutterBackend implementation to translate a
native event into a ClutterEvent;
- ClutterEventTranslator is a private interface that should be
implemented by backend-specific objects, like stage
implementations and ClutterDeviceManager sub-classes, and
allows dealing with class-specific event translation;
- ClutterStageX11 implements EventTranslator, and deals with the
stage-relative X11 events coming from the X11 event source;
- ClutterStageGLX overrides EventTranslator, in order to
deal with the INTEL_GLX_swap_event extension, and it chains up
to the X11 default implementation;
- ClutterDeviceManagerX11 has been split into two separate classes,
one that deals with core and (optionally) XI1 events, and the
other that deals with XI2 events; the selection is done at run-time,
since the core+XI1 and XI2 mechanisms are mutually exclusive.
All the other backends we officially support still use their own
custom event source and translation function, but the end goal is to
migrate them to the translate_event() virtual function, and have the
event source be a shared part of Clutter core.
The ClutterGLXTexturePixmap actor is just a wrapper around
ClutterX11TexturePixmap, since the relevant texture-from-pixmap code has
been moved down to Cogl.
The config.h header should be considered a Clutter internal header, and
the test cases (especially the interactive test cases) should strive to
never rely on internal headers.
Atlasing needs to be disabled for the hand texture so that it can work
out the step value needed to fetch a neighbouring pixel in the blur
shader. If the texture ends up in the atlas then the test can't know
the actual size of the texture so it looks wrong.
Other frameworks expose the same functionality as "auto-reverse",
probably to match the cassette tape player. It actually makes sense
for Clutter to follow suit.
The test-viewport interactive test is exercising the clip code - a job
better done by the conformance test suite and by the test-clip
interactive test.
The test-project test case was an old test that was barely working after
landing the size allocation API in Clutter 0.8. It has never been fixed,
and it's been of relative use ever since.
The test-offscreen interactive test was a dummy test for the
ClutterStage:offscreen property, which has been deprecated and
not implemented since Clutter 1.0, and never really worked except
briefly in Clutter 0.2 or something.
We know support EV_REL events comming from evdev devices. This addition
is pretty straigthforward, it adds a x,y per GSource listening to a
evdev device, updates from EL_REL (relative) events and craft new
ClutterMotionEvents. As for buttons, BTN_LEFT..BTN_TASK are translated
to ClutterButtonEvents with 1..8 as button number.
The Behaviour class and its implementations have been replaced by the
new animation framework API and by the constraints for layout-related
animations.
Currently, we need to make tests build, so we undef DISABLE_DEPRECATED
in specific test cases while they get ported.
When COGL_ENABLE_EXPERIMENTAL_2_0_API is defined cogl.h will now include
cogl2-path.h which changes cogl_path_new() so it can directly return a
CoglPath pointer; it no longer exposes a prototype for
cogl_{get,set}_path and all the remaining cogl_path_ functions now take
an explicit path as their first argument.
The idea is that we want to encourage developers to retain path objects
for as long as possible so they can take advantage of us uploading the
path geometry to the GPU. Currently although it is possible to start a
new path and query the current path, it is not convenient.
The other thing is that we want to get Cogl to the point where nothing
depends on a global, current context variable. This will allow us to one
day define a sensible threading model if/when that is ever desired.
We now prepend a set of defines to any given GLSL shader so that we can
define builtin uniforms/attributes within the "cogl" namespace that we
can use to provide compatibility across a range of the earlier versions
of GLSL.
This updates test-cogl-shader-glsl.c and test-shader.c so they no longer
needs to special case GLES vs GL when splicing together its shaders as
well as the blur, colorize and desaturate effects.
To get a feel for the new, portable uniform/attribute names here are the
defines for OpenGL vertex shaders:
#define cogl_position_in gl_Vertex
#define cogl_color_in gl_Color
#define cogl_tex_coord_in gl_MultiTexCoord0
#define cogl_tex_coord0_in gl_MultiTexCoord0
#define cogl_tex_coord1_in gl_MultiTexCoord1
#define cogl_tex_coord2_in gl_MultiTexCoord2
#define cogl_tex_coord3_in gl_MultiTexCoord3
#define cogl_tex_coord4_in gl_MultiTexCoord4
#define cogl_tex_coord5_in gl_MultiTexCoord5
#define cogl_tex_coord6_in gl_MultiTexCoord6
#define cogl_tex_coord7_in gl_MultiTexCoord7
#define cogl_normal_in gl_Normal
#define cogl_position_out gl_Position
#define cogl_point_size_out gl_PointSize
#define cogl_color_out gl_FrontColor
#define cogl_tex_coord_out gl_TexCoord
#define cogl_modelview_matrix gl_ModelViewMatrix
#define cogl_modelview_projection_matrix gl_ModelViewProjectionMatrix
#define cogl_projection_matrix gl_ProjectionMatrix
#define cogl_texture_matrix gl_TextureMatrix
And for fragment shaders we have:
#define cogl_color_in gl_Color
#define cogl_tex_coord_in gl_TexCoord
#define cogl_color_out gl_FragColor
#define cogl_depth_out gl_FragDepth
#define cogl_front_facing gl_FrontFacing
They are generated at configure time, so it's a good idea to have them
in the main ignore file instead of adding them to the built ignore files
under tests.
By using a new signal, ::create-surface (width, height), it should be
possible for third party code and sub-classes to override the default
surface creation code in CairoSurface.
This commit takes a bit of the patch from:
http://bugzilla.clutter-project.org/show_bug.cgi?id=1878
which cleans up CairoTexture; the idea, mutuated from that bug, is that
the CairoTexture actor checks whether the surface it has it's an image
one, and in that case it uses a Cogl texture as the backing store. In
case the surface is not an image one we assume that the surface itself
has some way of updating the GL state and flush the surface.
As a convenient test that clipped redraws are working correctly in
response to X pixmap damage this updates test-pixmap to have a repeating
1 second timeout that draws arcs on the pixmap.
*** This is an API change ***
The general pattern for axis-aligned arguments is:
x argument
y argument
If we consider columns an x-aligned argument, and row a y-aligned
argument, then we need to update the TableLayout functions to be:
column
row
and not:
row
column
The keysyms defines in clutter-keysyms.h are generated from the X11 key
symbols headers by doing the equivalent of a pass of sed from XK_* to
CLUTTER_*. This might lead to namespace collisions, down the road.
Instead, we should use the CLUTTER_KEY_* namespace.
This commit includes the script, taken from GDK, that parses the X11
key symbols and generates two headers:
- clutter-keysyms.h: the default included header, with CLUTTER_KEY_*
- clutter-keysyms-compat.h: the compatibility header, with CLUTTER_*
The compat.h header file is included if CLUTTER_DISABLE_DEPRECATED is
not defined - essentially deprecating all the old key symbols.
This does not change any ABI and, assuming that an application or
library is not compiling with CLUTTER_DISABLE_DEPRECATED, the source
compatibility is still guaranteed.
*** This is an API change ***
Replaced the original drag-threshold property with two separate
horizontal (x-drag-threshold) and vertical (y-drag-threshold)
thresholds.
It is some times necessary to have different drag thresholds for the
horizontal and vertical axes. For example, when a draggable actor is
inside a horizontal scrolling area, only vertical movement must begin
dragging. That can be achieved by setting the x-drag-threshold to
G_MAXUINT while y-drag-threshold is something usual, say, 20 pixels.
This is different than drag axis, because after the threshold
has been cleared by the pointer, the draggable actor can be dragged
along both axes (if allowed by the drag-axis property).
http://bugzilla.clutter-project.org/show_bug.cgi?id=2291
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Creating new materials for every Texture instance results in a lot of
ARBfp programs being generated/compiled. Since most textures will just
be similar we should create a template material for all of them, and
then copy it in every instance. Cogl will try to optimize the generation
of the program and, hopefully, will reuse the same program most of the
time.
With this change, a simple test shows that loading 48 textures will
result in just two programs being compiled - with and without batching
enabled.
http://bugzilla.clutter-project.org/show_bug.cgi?id=2295