The environment variable to disable mipmapping should also be
a command line switch, and be handled like the rest of Clutter's
environment variables/command line switches.
Clutter is able to show debug messages written using the CLUTTER_NOTE()
macro at runtime, either by using an environment variable:
CLUTTER_DEBUG=...
or by using a command line switch:
--clutter-debug=...
--clutter-no-debug=...
Both are parsed during the initialization process by using the
GOption API.
COGL would benefit from having the same support.
In order to do this, we need a cogl_get_option_group() function in
COGL that sets up a GOptionGroup for COGL and adds a pre-parse hook
that will check the COGL_DEBUG environment variable. The OptionGroup
will also install two command line switches:
--cogl-debug
--cogl-no-debug
With the same semantics of the Clutter ones.
During Clutter initialization, the COGL option group will be attached
to the GOptionContext used to parse the command line options passed
to a Clutter application.
Every debug message written using:
COGL_NOTE (SECTION, "message format", arguments);
Will then be printed only if SECTION was enabled at runtime.
This whole machinery, like the equivalent one in Clutter, depends on
a compile time switch, COGL_ENABLE_DEBUG, which is enabled at the same
time as CLUTTER_ENABLE_DEBUG. Having two different symbols allows
greater granularity.
Mipmapped text is enabled by default in Clutter but it can cause
problems on some drivers so it is convenient to have an environment
variable to disable it for all apps.
Add annotations such as (transfer-none) (out) (element-type ClutterActor),
and so forth to the doc comments as appropriate.
The annotations added here are a combination of the annotations previously
in gir-repository for Clutter and annotations found in a review of all
return values with that were being parsed with a transfer of "full".
http://bugzilla.openedhand.com/show_bug.cgi?id=1452
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
cogl_paint_init was a bit too miscellaneous; it mainly cleared the color, depth
and stencil buffers but arbitrarily it also disabled fogging and lighting.
It no longer disables lighting, since we know Cogl never enables lighting and
disabling of fog is now handled with a seperate function.
Since I noticed cogl_set_fog was taking a density argument documented as
"Ignored" I've also added a mode argument to cogl_set_fog which exposes the
exponential fog modes which can make use of the density.
In generate_enter_leave_events it passes the device pointer from the
event to set_motion_last_actor but it was reading it directly from
event->motion.device. However the function is also used to process
button events so it would read from the wrong location in this case.
The device location in the union happened to be in the same place as
the click_count field of ClutterButtonEvent so it only mattered if the
click_count is non-zero. The X11 backend doesn't set this but
Clutter-GTK does so it was causing a crash.
Bug 1178 - No enter / leave events on actors when pointer leaves the
stage window
The patch is mostly thanks to Johan Bilien with small modifications
based on suggestions by Owen Taylor.
The X11 backend now listens for enter and leave notifications. Leave
notifications get translated directly to a CLUTTER_LEAVE
event. Clutter can detect these special events because the source
actor is NULL in which case it sets the source actor to the last known
actor and then sets the last known actor to NULL.
Enter notifications just get translated to CLUTTER_MOTION events which
will cause Clutter to generate an enter event through the usual code
path.
Moved clutter_stage_set_title() before call to clutter_actor_realize()
to ensure _NET_WM_NAME is set early enough for use by interested WM's,
Signed-off-by: Shane Bryan <shane.bryan@linux.intel.com>
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
The clutter_get_current_event_time() is a global function for
retrieving the timestamp of the current event being propagated
by Clutter. Such function avoids the need to propagate the
timestamp from within user code.
Instead of having a separate set of font options that override the
backend options when clutter_set_font_flags is called, it now just
directly sets the backend font options. So now the font flags are just
a convenience wrapper around the backend font options.
This also makes the ClutterText labels automatically update when the
font flags are changed because they will respond to the 'font-changed'
signal from the backend.
Conflicts:
clutter/cogl/gl/cogl-texture.c
clutter/cogl/gles/cogl-primitives.c
* cogl-material:
clutter-{clone-,}texture weren't updating their material opacity.
Updates GLES1 support for CoglMaterial
Normalizes gl vs gles code in preperation for synching material changes
Removes cogl_blend_func and cogl_alpha_func
Fully integrates CoglMaterial throughout the rest of Cogl
[cogl-material] Restore the GL_TEXTURE_ENV_MODE after material_rectangle
[cogl-material] Make the user_tex_coords parameter of _rectangle const
[test-cogl-material] Remove return value from material_rectangle_paint
Add cogl-material.h and cogl-matrix.h to libclutterinclude_HEADERS
[cogl-material] improvements for cogl_material_rectangle
[cogl-material] Adds a cogl_material_set_color function
[cogl-material] Some improvements for how we sync CoglMaterial state with OpenGL
[cogl-material] Converts clutter-texture/clutter-clone-texture to the material API
[doc] Hooks up cogl-material reference documentation
Updates previous GLES multi-texturing code to use CoglMaterial
Adds a CoglMaterial abstraction, which includes support for multi-texturing
[doc] Hooks up cogl-matrix reference documentation
Adds CoglMatrix utility code
[tests] Adds an interactive unit test for multi-texturing
[multi-texturing] This adds a new cogl_multi_texture API for GL,GLES1 + GLES2
The hope is that this function makes it easier to extend the font
settings with more flags without having to add a function for every
setting.
A new flag for enabling hinting has been added. If set, this changes
the font options on the global PangoContext and any newly created
PangoContexts. The options are only set if the flag is changed from
the default so it won't override any detailed setting chosen by the
backend.
This glues CoglMaterial in as the fundamental way that Cogl describes how to
fill in geometry.
It adds cogl_set_source (), which is used to set the material which will be
used by all subsequent drawing functions
It adds cogl_set_source_texture as a convenience for setting up a default
material with a single texture layer, and cogl_set_source_color is now also
a convenience for setting up a material with a solid fill.
"drawing functions" include, cogl_rectangle, cogl_texture_rectangle,
cogl_texture_multiple_rectangles, cogl_texture_polygon (though the
cogl_texture_* funcs have been renamed; see below for details),
cogl_path_fill/stroke and cogl_vertex_buffer_draw*.
cogl_texture_rectangle, cogl_texture_multiple_rectangles and
cogl_texture_polygon no longer take a texture handle; instead the current
source material is referenced. The functions have also been renamed to:
cogl_rectangle_with_texture_coords, cogl_rectangles_with_texture_coords
and cogl_polygon respectivly.
Most code that previously did:
cogl_texture_rectangle (tex_handle, x, y,...);
needs to be changed to now do:
cogl_set_source_texture (tex_handle);
cogl_rectangle_with_texture_coords (x, y,....);
In the less likely case where you were blending your source texture with a color
like:
cogl_set_source_color4ub (r,g,b,a); /* where r,g,b,a isn't just white */
cogl_texture_rectangle (tex_handle, x, y,...);
you will need your own material to do that:
mat = cogl_material_new ();
cogl_material_set_color4ub (r,g,b,a);
cogl_material_set_layer (mat, 0, tex_handle));
cogl_set_source_material (mat);
Code that uses the texture coordinates, 0, 0, 1, 1 don't need to use
cog_rectangle_with_texure_coords since these are the coordinates that
cogl_rectangle will use.
For cogl_texture_polygon; as well as dropping the texture handle, the
n_vertices and vertices arguments were transposed for consistency. So
code previously written as:
cogl_texture_polygon (tex_handle, 3, verts, TRUE);
need to be written as:
cogl_set_source_texture (tex_handle);
cogl_polygon (verts, 3, TRUE);
All of the unit tests have been updated to now use the material API and
test-cogl-material has been renamed to test-cogl-multitexture since any
textured quad is now technically a test of CoglMaterial but this test
specifically creates a material with multiple texture layers.
Note: The GLES backend has not been updated yet; that will be done in a
following commit.
Continuation of the fix in commit 00a3c69868.
Instead of using a separate flag for the resize process, just
delay the setting of the CLUTTER_ACTOR_SYNC_MATRICES flag on the
stage to the point when we receive a ConfigureNotify event from
X11.
This commit will break the stage embedding into other toolkits.
There is a race condition when we resize a stage before showing
it on X11.
The race goes like this:
- clutter_init() creates the default stage and realize it, which
will cause a 640x480 Window to be created
- call set_size(800, 600) on the stage will cause the Window to be
resized to 800x600
- call show() on the stage for the first time will cause COGL
to set up an 800 by 600 GL viewport
- the Window will be mapped, which will cause X to notify the
window manager that the Window should be resized to 800x600
- the window manager will approve the resize
- X resizes the drawable to 800x600
To fix the race, we need to defer COGL from setting up the viewport
until we receive a ConfigureNotify event and the X server has resized
the Drawable.
In order to defer the call to cogl_setup_viewport() we add a new
private flag, CLUTTER_STAGE_IN_RESIZE; the flag is checked whenever
we need to change the viewport size along with the SYNC_MATRICES
private flag. Thus, cogl_setup_viewport() will be called only if
SYNC_MATRICES is set and IN_RESIZE is not set.
Merge branch 'text-actor'
* text-actor: (108 commits)
Re-align ClutterText header file
[text] Fix cursor sizing
Comments and whitespace fixes to ClutterText
[docs] Add newly added :single-line-mode accessors
Update the ignore file
[tests] Add text field interactive test
[text] Add single-line-mode to ClutterText
[text] Fix the deletion actions
[text] Use cached length when possible
[tests] Add unit for the ClutterText:password-char property
[docs] Update the Text section
[text] Coalesce text visibility and password character
Allow localizations to change the text direction
Clean up the update_pango_context() function
Pass the PangoContext, not the MainContext
Revert the logic of the PangoContext check
Remove the binding pool entry from the list
Remove BindingPool::list_actions()
Add ClutterActor::create_pango_context()
Rename the PangoContext creation functions
...
The locale translators of Clutter are also the ones that should set
the default direction of the text in a Clutter user interface.
This commit adds a translatable string that defines the direction
of the text; the translation authors will change it to the correct
value and that will determine the default direction.
The default text direction can be overridden by using the
CLUTTER_TEXT_DIRECTION environment variable, or by using the
--clutter-text-direction command line switch. In any other case,
the locale will determine the text direction, as it should.
Clutter has a set of command line options that are added to every
application by means of clutter_init() or by obtaining the Clutter
GOptionGroup and using g_option_context_parse(). Thus, every Clutter
application will automatically have an --help command line switch
showing the list of options and their description.
At the moment, Clutter does not enable localization of the help,
thus making it less than useful on non-English locales.
This patch enables the machinery to create a localization file and
load it when initializing Clutter, by means of the GLib macros and
locale.h API we already use.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
When updating the PangoContext with the current options (font name,
options, resolution) pass the PangoContext instead of the Clutter
MainContext structure pointer.
The _clutter_context_create_pango_context() should create a new
context; the function returning the PangoContext stored inside the
MainContext structure should be named _get_pango_context() instead.
The direction of the text depends on the locale, and it is the
basic setting needed to enable internationalization of user
interfaces.
This commit allows setting the direction of the PangoContext instance
used by Clutter by using the CLUTTER_TEXT_DIRECTION environment
variable, or by passing the --clutter-text-direction command line
argument. Valid values are:
ltr - for left-to-right locales
rtl - for right-to-left locales
The default is LTR.
Ideally, this should be a value set by the localization teams on the
PO file, but this step requires some build system surgery to allow
the translation of the Clutter strings.
When the ClutterBackend notifies of changes in the resolution or
font options, update the PangoContext stored by Clutter's main
context. This allows changing the backend font-related settings at
runtime.
The PangoContext should be stored once, and inside the main
Clutter context. Each actor for which clutter_actor_get_pango_context()
has been called will hold a reference on the Pango context as well.
This makes it possible to update the text rendering for Clutter
by using only public API.
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
* clutter/clutter-main.c (_clutter_id_to_color): When using fuzzy
picking to pick a color for an actor, it would previously set the
fuzzy bit and then all but the most significant of the remaining
unused bits. This meant that for 16-bit displays it would end up
with a strange pattern for the unused bits like 1011 which could
cause it to round up. Now it just sets all but the most
significant of all of the unused bits giving a pattern like
0111. Thanks to Guy Zadickario for the patch.
Bug 1200 - Crash with invalid DISPLAY
* clutter/clutter-main.c: Use the ClutterBackend wrapper API
instead of directly checking the class structure.
* clutter/glx/clutter-backend-glx.c: Return the correct value
in case of failure.
* clutter/x11/clutter-backend-x11.c: Bail out if XOpenDisplay()
failed.
Bug 1210 - Add CoglColor API
* clutter/cogl/cogl-color.h:
* clutter/cogl/cogl.h.in:
* clutter/cogl/common/Makefile.am:
* clutter/cogl/common/cogl-color.c:
* clutter/cogl/gl/Makefile.am:
* clutter/cogl/gl/cogl.c:
* clutter/cogl/gles/Makefile.am:
* clutter/cogl/gles/cogl-texture.c:
* clutter/cogl/gles/cogl.c: Add a new color-type, to be used by
COGL. CoglColor is optimized to allow the minimum amount of
conversions possible for both GL and GLES implementations.
* clutter/clutter-actor.c:
* clutter/clutter-clone-texture.c:
* clutter/clutter-entry.c:
* clutter/clutter-main.c:
* clutter/clutter-rectangle.c:
* clutter/clutter-stage.c:
* clutter/clutter-texture.c: Use CoglColor when needed.
* clutter/pango/pangoclutter-render.c: Use CoglColor when needed.
* doc/reference/cogl/cogl-docs.sgml:
* doc/reference/cogl/cogl-sections.txt: Update the documentation.
* tests/test-cogl-offscreen.c:
* tests/test-cogl-primitives.c:
* tests/test-cogl-tex-convert.c:
* tests/test-cogl-tex-foreign.c:
* tests/test-cogl-tex-getset.c:
* tests/test-cogl-tex-polygon.c:
* tests/test-cogl-tex-tile.c:
* tests/test-paint-wrapper.c: Update the tests.
* README: Update release notes.
* clutter/clutter-main.c (_clutter_do_pick): After picking is
finished, restore the state of glEnable (GL_DITHER). Otherwise it
will cause the scene to look different after the first pick on low
depth displays. (Thanks to Michael Boccara for the patch)
Handle dropped motion events when computing crossing events,
based on a patch from Gwenole Beauchesne.
* clutter/clutter-main.c: (clutter_event_get_device): internal static
utility function.
(clutter_do_event): generate enter/leave events for all pointer
events.
(generate_enter_leave_events): modified enter/leave events generator
to work for all pointer event types. Enter/leave events are now
delivered before the motion/button event that caused the crossing to
happen.
* clutter/clutter-event.c: (clutter_event_copy), (clutter_event_free):
removed reference counting logic that is not needed when the crossing
events are directly delivered.
Bug 1130 - CLUTTER_MOTION is not emitted when time goes backwards.
* clutter/clutter-main.c (clutter_do_event): Check for time
rollbacks inside the motion event throttling. (Pierce Liu)
* clutter/clutter-main.c:
* clutter/clutter-main.h:
* clutter/clutter-private.h:
* clutter/x11/clutter-backend-x11.c:
(clutter_get_option_group_without_init):
Function to obtain clutter option group without opening display
(for use with foreign display and gtk_clutter_init). Bug 1033.
Stripped trailing whitespace.
* clutter/clutter-main.c: Don't free the ClutterMainContext so
that the main loop can be restarted.
* clutter/eglx/clutter-backend-egl.c:
* clutter/eglnative/clutter-backend-egl.c: Register an atexit
handler which disposes the backend object so that we are still
guaranteed to call eglTerminate on GLES.
Bug 1033 - Manually parsing command line options prevents
initializing clutter
* clutter/clutter-main.c:
(post_parse_hook), (clutter_init_with_args),
(clutter_parse_args), (clutter_init): Move the initialization
of Clutter at the end of the post-parse hook of Clutter's
GOptionGroup. Clutter must be initialized at the end of the
argument parsing.
* clutter/clutter-main.c: Properly document the
clutter_get_option_group() function and the invariant that
after parsing Clutter's option group the library will be
initialized. (Thanks to Tomas Frydrych for pointing this
out)
* clutter/clutter-main.c (_clutter_id_to_color): When choosing a
pick color, set all but the most significant of the unused
bits. This should make make it more likely that the GL
implementation will round down to the right value.
* tests/test-pick.c: Test case for picking. It creates 192 actors
at known positions and stores their gids. It then calls
clutter_stage_get_actor_at_pos with each position to check that
the right gid is returned.
* tests/Makefile.am (noinst_PROGRAMS): Add test-pick
* clutter/clutter-main.c:
Destroy the debugging timer when the context is freed.
* clutter/clutter-stage.c:
Free the stage title when the stage is finalized.
Bug 1033 - Manually parsing command line options prevents
initializing clutter (Armin Burgmeier)
* clutter/clutter-main.c:
(post_parse_hook), (clutter_init_real): Set the is_initialized
flag inside the real initialization function.
* clutter/clutter-event.c: (clutter_event_get_device_id): swap
arguments of g_return_val_if_fail around.
* clutter/clutter-event.h: added *device field to crossing events as
well.
* clutter/clutter-main.c: (emit_pointer_event): added a device
argument and check for per device grabs if this device is passed.
(clutter_do_event): pass the device if present for all pointer event
emissions.
(generate_enter_leave_events): copy the device from the motion events
when generating enter/leave events.
Bug #960 - PangoContext creation code should not be duplicated
* clutter/clutter-private.h:
* clutter/clutter-main.c:
(_clutter_context_create_pango_context): Abstract the creation
of the PangoContext inside its own function, to avoid code and
bugs duplication. (Tommi Komulainen)
* clutter/clutter-entry.c (clutter_entry_init): Use the newly
added PangoContext creation function.
* clutter/clutter-label.c (clutter_label_init): Ditto as above.
Bug #815 - Split up request, allocation, and paint box
* clutter/clutter-actor.[ch]: Rework the size allocation,
request and paint area. Now ::request_coords() is called
::allocate(), and ::query_coords() has been split into
::get_preferred_width() and ::get_preferred_height(). See
the documentation and the layout test on how to implement
a container and layout manager with the new API. (#915,
based on a patch by Havoc Pennington, Lucas Rocha and Johan
Bilien)
* clutter/clutter-clone-texture.c: Port CloneTexture to
the new size negotiation API; it just means forwarding
the requests to the parent texture.
* clutter/clutter-deprecated.h: Add deprecated and replaced
API.
* clutter/clutter-entry.c: Port Entry to the new size
negotiation API.
* clutter/clutter-group.c: Port Group to the new size
negotiation API; the semantics of the Group actor do not
change.
* clutter/clutter-label.c: Port Label to the new size
negotiation API, and vastly simplify the code.
* clutter/clutter-main.[ch]: Add API for executing a
relayout when needed.
* clutter/clutter-private.h: Add new Stage private API.
* clutter/clutter-rectangle.c: Update the get_abs_opacity()
call to get_paint_opacity().
* clutter/clutter-stage.c:
(clutter_stage_get_preferred_width),
(clutter_stage_get_preferred_height),
(clutter_stage_allocate),
(clutter_stage_class_init): Port Stage to the new size
negotiation API.
* clutter/clutter-texture.c: Port Texture to the new size
negotiation API.
* clutter/clutter-types.h: Add ClutterRequestMode enumeration.
* clutter/x11/clutter-stage-x11.c: Port the X11 stage
implementation to the new size negotiation API.
* tests/Makefile.am: Add the layout manager test case.
* tests/test-opacity.c: Update.
* tests/test-project.c: Update.
* tests/test-layout.c: Test case for a layout manager implemented
using the new size negotiation API; the layout manager handles
both transformed and untransformed children.