We only want to eschew the pango_layout_set_width() on editable,
single-line Text actors because they can "scroll" the PangoLayout.
This fixes the ellipsization on entries.
In unifying the {gl,gles}/cogl.c code recently, moving most of the code into
common/cogl.c the gmodule.h include was also mistakenly moved.
Thanks to Felix Rabe for reporting this issue.
Note: I haven't tested this fix myself, as I'm not set up to be able to
build for OS X
Buffer objects aren't currently available for glx indirect contexts, so we
now have a fallback that simply allocates fake client side vbos to store the
attributes.
This makes the #if 0'd debug code that was in _cogl_journal_flush_quad_batch
- which we have repeatedly found usefull for debugging various geometry
issues in Clutter apps - a runtime debug option.
The outline colors rotate in order from red to green to blue which can also
help confirm the order that your geometry really drawn.
The outlines are not affected by the current material state, so if you e.g.
have a blending bug where geometry mysteriously disappears this can confirm
if the underlying rectangles are actually being emitted but blending is
causing them to be invisible.
Editable ClutterText will scroll when allocated less width than is
necessary to lay out the entire layout on a single line, so return 1 for
the minimum width in this case.
Approved by Emmanuele Bassi, fixes bug #1555.
Since we have to do (z_far - z_near) and use it in a division we
should check that the user is not passing a value that would
cause a division by zero.
If we need to check that the layout sequence is correct in
terms of order of execution and with respect to caching, then
having a CLUTTER_DEBUG_LAYOUT debug flag would make things
easier.
Ellipsizing was effectively broken for two reasons. There was a typo
in the code to set the width so it always ended up being some massive
value. If no height should be set on the layout it was being set to
G_MAXINT. Setting a height greater than 0 enables wrapping which so
ellipsizing is not performed. It should be left at the default of -1
instead.
Bug 1476 - JSON Parser memory leak
Static analysis of the code showed that the in-tree copy of
the JsonParser object leaks objects and arrays on parse errors.
Thanks to Gordon Williams <gordon.williams@collabora.co.uk>
If the stage is unrealized (such as will be the case if the stage was
created with clutter_stage_new) then it would set the size of the
stage display but it was not setting the fullscreen_on_map flag so it
never got the _NET_WM_STATE_FULLSCREEN property. Now it always sets
the flag regardless of whether the window is created yet.
There was also problems with dual-headed displays because in that case
DisplayWidth/Height will return the size of the combined display but
Metacity (and presumably other WMs) will sensibly try fit the window
to only one of the monitors. However we were setting the size hints so
that the minimum size is that of the combined display. Metacity tries
to honour this by setting the minimum size but then it no longer
positions the window at the top left of the screen.
The patch makes it avoid setting the minimum size when the stage is
fullscreen by checking the fullscreen_on_map flag. This also means we
can remove the static was_resizable flag which would presumably have
caused problems for multi-stage.
Adds a new property so that the selection color can be different from
the cursor color. If no selection color is specified it will use the
cursor color as before. If no cursor color is specified either it will
use the text color.
The debug macros for tracking reference counting of CoglHandles had
some typos introduced in c3d9f0 which meant it failed to compile when
COGL_DEBUG is 1.
Since the Cogl material branch merge when changing the color of a part
using pango attributes (such as using <span color="red" /> markup)
then it wouldn't return to the default color for the rest of the
layout. pango_renderer_get_color returns NULL if there is no color
override in which case it needs to revert to the color specified as
the argument to cogl_pango_render_layout. The 'color' member of
CoglPangoRenderer has been reinstated to store that default color and
now cogl_pango_render_set_color_for_part is the only place that sets
the material color.
The clutter_actor_animate*() family of functions should only connect
to the Animation::completed signal once, during the construction of
the Animation object attached to the Actor. Otherwise, the completed
signal handler will be run multiple times, and will try to unref()
the Animation for each call -- leading to a segmentation fault.
The Animation class is missing a ::started signal matching the
::completed one. A ::started signal is useful for debugging,
initial state set up, and checks.
Bug 1535 - Complete animation always unrefs ClutterAnimation (even
after g_object_ref_sink)
Animations created through clutter_animation_new() should not
automagically unref themselves by default on ::complete. We
only want that behaviour for Animations created by the
clutter_actor_animate* family of functions, since those provide
the automagic memory management.
ClutterGroup still ships with API deprecated since 0.4. We did
promise to keep it around for a minor release cycle -- not for 3.
Since we plan on shipping 1.0 without the extra baggage of the
deprecated entry points, here's the chance to remove the accumulated
cruft.
All the removed methods and signals have a ClutterContainer
counterpart.
Since we're planning to release 1.0 without any of the deprecated
API baggage, we can simply remove the set_uniform_1f() method from
ClutterShader public API and add it to the deprecated header.
The cogl_is_* functions were showing up quite high on profiles due to
iterating through arrays of cogl handles.
This does away with all the handle arrays and implements a simple struct
inheritance scheme. All cogl objects now add a CoglHandleObject _parent;
member to their main structures. The base object includes 2 members a.t.m; a
ref_count, and a klass pointer. The klass in turn gives you a type and
virtual function for freeing objects of that type.
Each handle type has a _cogl_##handle_type##_get_type () function
automatically defined which returns a GQuark of the handle type, so now
implementing the cogl_is_* funcs is just a case of comparing with
obj->klass->type.
Another outcome of the re-work is that cogl_handle_{ref,unref} are also much
more efficient, and no longer need extending for each handle type added to
cogl. The cogl_##handle_type##_{ref,unref} functions are now deprecated and
are no longer used internally to Clutter or Cogl. Potentially we can remove
them completely before 1.0.
A layer object may be instantiated when setting a combine mode, but before a
texture is associated. (e.g. this is done by the pango renderer) if this is the
case we shouldn't call cogl_texture_get_format() with an invalid cogl handle.
This patch skips over layers without a texture handle when determining if any
textures have an alpha channel.
Bug 1518 - [Patch] Widget derivied from ClutterText will crash on
key_press_event
In clutter_text_key_press() we are using G_OBJECT_TYPE_NAME to find
out the actor's type name. However, if some widget is derived from
ClutterText, when the key press handler is called, G_OBJECT_TYPE_NAME
will return the name of the derived widget.
The default implementation should get the binding pool for the base
class.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
ClutterText should offer multiple selection modes depending on the
number of pointer clicks.
Following the GTK+ conventions:
- double click selects the current word
- triple click selects the current line
Added support for registering a handler for the completed signal
directly amongst the varargs making it easier to attach code
to be executed when animations complete.
Bug 1529 - Selection bound out of sync with an empty Text actor
When the user clicks on a Text actor the cursor position and the
selection bound are set using bytes_to_offset(); if the Text is
empty, this means placing them both to 0. Setting the selection
bound to 0 means that when the user inserts a character by typing
it into the Text, the selection will be [0,1]; this will select
the first character, which will then be overwritten when typing
a new character.
The Text actor should, instead, check if there are no contents
and set the cursor position and the selection bound to -1.
The clutter_text_set_selection_bound() method should also validate
the value passed, in case it's bigger than the text lenght, or
smaller than -1.
The symbol name for cogl_vertex_buffer_draw_elements was wrong so it
ended up with no documentation. The name for the vertex attribute was
incorrect in cogl_vertex_buffer_add.
None of this code directly related to implementing CoglTextures, and the
code was needlessly duplicated between the GL and GLES backends. This moves
the cogl_rectangle* and cogl_polygon* code into common/cogl-primitives.c
makes which makes lot of sense since the two copies keep needlessly
diverging introducing or fixing bugs in one but not the other. For instance
I came accross one such bug regarding the enabling of texture units when
unifying the code.
The gtk-doc had a copy and paste error, saying the float array should be 8
elements per rectangle instead of 4. There was also no newline in the gles
code before the new function.
It's often nice to be able to draw a batch of vertices, even if these
have no texture coordinates. This add a cogl_rectangles, similar to
cogl_rectangles_with_texture_coords, only without.
There's no need to enable the texture target unless it is going to be
used for rendering. Enabling it directly with glEnable calls confuses
Cogl's state caching.
This is a replacement for the patch in bug 1483 which was reverted.
This reverts commit f9d996a460.
The change from calling glBindTexture to using the material API with
cogl_material_flush_gl_state does not always work because it doesn't
necessarily leave the active texture unit as GL_TEXTURE0. For example,
if the previously rendered texture was multi-layered then the last
thing cogl_material_flush_gl_state will do is select GL_TEXTURE1 just
to disable it.
Clutter was complaining about netural width smaller than minimum widths
(differences around 0.0005) by using an epsilon value of 1e-4 for these
floating point comparisons, these warnings have now been silenced.