Neil Roberts [Thu, 27 Nov 2008 16:44:39 +0000 (16:44 +0000)]
Fix GLES 2 after the multiple-texture-rectangle branch merge
The GLES 2 wrapper needs to set up some state before each
draw. Previously this was acheived by wrapping glDrawArrays. Since the
multiple-texture-rectangle branch merge, glDrawElements is used
instead so we also need a wrapper for that.
It was also directly calling glBindTexture. GLES 2 uses a wrapper for
this function so that it can cope with GL_ALPHA format textures. The
format of the current texture needs to be stored as well as the target
and object number for this to work.
Neil Roberts [Mon, 12 Jan 2009 18:32:49 +0000 (18:32 +0000)]
Update gtk-doc 'Since' field for cogl_texture_multiple_rectangles
The function has been backported to the 0.8 branch so it will also be
available in Clutter 0.8.6
Emmanuele Bassi [Tue, 13 Jan 2009 14:05:35 +0000 (14:05 +0000)]
[gitignore] Update the ignore file
Emmanuele Bassi [Tue, 13 Jan 2009 12:51:03 +0000 (12:51 +0000)]
Add ClutterBindingPool:name
The BindingPool constructor should only check for duplicate pools
and then set the :name constructor-only property. If a BindingPool
is created without a name we also make a fuss about it.
It is also possible to simply dispose of a binding pool using
g_object_unref(), as long as it has been created by using
clutter_binding_pool_new() or directly with g_object_new(). Only
BindingPools attached to a class are not owned by the user.
Emmanuele Bassi [Tue, 13 Jan 2009 12:34:59 +0000 (12:34 +0000)]
Turn ClutterBindingPool a GObject
ClutterBindingPool is already "problematic" in terms of memory
management for language bindings and gobject-introspection. It
also lacks a GType.
Turning ClutterBindingPool into a GBoxed would not make much
sense, since it does not adhere to the copy/free semantics. It
could be referenced/unreferenced, but in that case we can just
as well use GObject as a base class instead of reimplemeting
a ref-counted object and then boxing it.
ClutterBindingPool is obviously a terminal class, so we just
hide the instance and class structures.
Havoc Pennington [Mon, 12 Jan 2009 14:19:48 +0000 (14:19 +0000)]
Bug 1087 - virtualize stage_queue_redraw
Add a ClutterStage::queue-redraw signal.
The purpose of this signal is to allow combining the Clutter redraw
idle with another redraw idle such as gtk's (or any other one really;
this is desirable anytime Clutter is not the only thing drawing to
a toplevel window).
To override the default, you would connect to ::queue-redraw and then
stop the signal emission.
Robert Bragg [Mon, 12 Jan 2009 13:02:19 +0000 (13:02 +0000)]
[ClutterGLXTexturePixmap] Use an RGB texture (not ARGB) for 24bpp pixmaps
By creating an ARGB texture for 24bpp pixmaps we were exposing an undefined
alpha channel to the blending and texture combine stages which resulted in
nasty artefacts. (This issue was seen on i945 + DRI2)
Emmanuele Bassi [Mon, 12 Jan 2009 11:21:06 +0000 (11:21 +0000)]
Declare G_LOG_DOMAIN for COGL
In order to get properly namespaced debug and warning messages
inside COGL code we need to define the G_LOG_DOMAIN macro.
Emmanuele Bassi [Mon, 12 Jan 2009 11:18:11 +0000 (11:18 +0000)]
Allow ensuring that a stage viewport is updated
Since we only update the GL viewport when we receive a ConfigureNotify
event on X11, we also need a function to allow other toolkits to tell
a stage that the viewport should be updated.
This commit adds clutter_stage_ensure_viewport(), a function that simply
sets the private SYNC_MATRICES flag on the stage and then queues a
redraw.
This function should be called by libraries integrating Clutter with
other toolkits, like clutter-gtk or clutter-qt.
Emmanuele Bassi [Mon, 12 Jan 2009 11:15:41 +0000 (11:15 +0000)]
[x11] Proper fix for the ClutterStage resize race
Continuation of the fix in commit
00a3c698686f25e193d0311ad25c903f0ad71e8b.
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.
Emmanuele Bassi [Fri, 9 Jan 2009 14:26:35 +0000 (14:26 +0000)]
[docs] Documentation warnings
Fix the various warnings issued by gtk-doc when enabling the API
reference generation for both COGL and Clutter.
Emmanuele Bassi [Fri, 9 Jan 2009 12:06:46 +0000 (12:06 +0000)]
[x11] Fix a race condition when resizing a stage
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.
Emmanuele Bassi [Thu, 8 Jan 2009 17:06:04 +0000 (17:06 +0000)]
[text] Fix GObject properties in ClutterText
Some of the read-write properties of ClutterText were missing
an implementation in clutter_text_get_property(), as well as
the :position and :selection-bound properties being wrongly
converted from fixed point to integer, passing through floating
point values.
Emmanuele Bassi [Thu, 8 Jan 2009 15:45:22 +0000 (15:45 +0000)]
Fix last improper usage of ClutterUnits
ClutterUnits should not be used interchangeably as, or with
ClutterFixed values. ClutterUnits should also not be assumed
to be integers.
This commit fixes the last few improper usages of ClutterUnit
values, and adds a CLUTTER_UNITS_FORMAT macro for safely printing
ClutterUnit values with printf().
Robert Bragg [Wed, 7 Jan 2009 12:33:40 +0000 (12:33 +0000)]
[test-clip] Use gint for hand_{width,height} when calulating -hand_* /2
It was a fluke that this worked out due to how the incorrect integer
result gets converted by CLUTTER_INT_TO_FIXED.
Robert Bragg [Wed, 7 Jan 2009 12:08:43 +0000 (12:08 +0000)]
[test-depth] Use a gint for width, not guint, when calculating -width/2
It was a fluke that this worked out due to how clutter_actor_set_depth
internally converts the incorrect integer result to fixed point.
Emmanuele Bassi [Wed, 7 Jan 2009 16:26:03 +0000 (16:26 +0000)]
Rename a variable masking index()
The maintainer CFLAGS found another masking of the index() function
by an helpless variable.
Neil Roberts [Wed, 7 Jan 2009 16:10:25 +0000 (16:10 +0000)]
Merge branch multiple-texture-rectangle into master
Bug 1289 - Draw multiple glyphs at once
The multiple-texture-rectangle branch adds a new Cogl texture function
called cogl_texture_multiple_rectangles which is used to draw multiple
rectangles out of a texture using a single GL call. This is
significantly faster than drawing the rectangles with individual calls
on some platforms. The Pango renderer now uses this to speed up
rendering.
The conflicts are just due to the whitespace fixes in cb569a5.
Conflicts:
clutter/cogl/gl/cogl-context.c
clutter/cogl/gl/cogl-context.h
clutter/cogl/gl/cogl-texture.c
Emmanuele Bassi [Wed, 7 Jan 2009 15:54:08 +0000 (15:54 +0000)]
[tests] Update the ClutterText interactive test
Remove the unused functions and if the test fails to load the
text from a file, show the error inside the text actor itself.
Emmanuele Bassi [Wed, 7 Jan 2009 14:53:54 +0000 (14:53 +0000)]
[docs] Documentation fixes
Remove the causes of warnings from the Clutter gtk-doc API reference
generation process.
Emmanuele Bassi [Wed, 7 Jan 2009 13:48:45 +0000 (13:48 +0000)]
[text] Do not use markup on an editable Text
An editable ClutterText should not use pango_layout_set_markup(),
as the contents of the text actor will not match the text.
Only read-only text actors should parse the contents for Pango
markup.
Emmanuele Bassi [Wed, 7 Jan 2009 13:14:13 +0000 (13:14 +0000)]
[text] Do not ensure the cursor if not needed
If the Text actor is neither editable nor has its cursor set
to visible, then we should not be ensuring the cursor position.
This fixes a failure in the conformance test unit for the
layout cache.
Emmanuele Bassi [Wed, 7 Jan 2009 12:17:09 +0000 (12:17 +0000)]
[tests] Make test-scale use ClutterText
The ClutterLabel actor has been superceded by ClutterText.
This is merge fall-out from the text-actor branch.
Emmanuele Bassi [Wed, 7 Jan 2009 12:16:08 +0000 (12:16 +0000)]
[tests] Remove test-opacity interactive test
Merge fall-out from the text-actor branch. The test-opacity test
was moved to the conformance test suite.
Emmanuele Bassi [Wed, 7 Jan 2009 12:06:33 +0000 (12:06 +0000)]
Merge the ClutterText actor
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
...
Emmanuele Bassi [Wed, 7 Jan 2009 11:46:22 +0000 (11:46 +0000)]
Re-align ClutterText header file
The addition of the single line mode accessor methods caused the
re-alignment of the entire file.
Emmanuele Bassi [Wed, 7 Jan 2009 11:44:54 +0000 (11:44 +0000)]
[text] Fix cursor sizing
The cursor should be slightly smaller than the height of the actor, to
allow for painting a border. Let's pad it by 1 pixel on the top and 1
on the bottom.
Also, we should use the cursor size everywhere and not use hardcoded
magic numbers.
Emmanuele Bassi [Wed, 7 Jan 2009 00:43:24 +0000 (00:43 +0000)]
Comments and whitespace fixes to ClutterText
Emmanuele Bassi [Wed, 7 Jan 2009 00:30:59 +0000 (00:30 +0000)]
[docs] Add newly added :single-line-mode accessors
Add the ClutterText:single-line-mode property accessor methods
to the API reference.
Emmanuele Bassi [Wed, 7 Jan 2009 00:29:41 +0000 (00:29 +0000)]
Update the ignore file
Emmanuele Bassi [Wed, 7 Jan 2009 00:27:50 +0000 (00:27 +0000)]
[tests] Add text field interactive test
The test-text-field is a test/example that shows how to use the
ClutterText as a text input field in single line mode.
Emmanuele Bassi [Wed, 7 Jan 2009 00:25:24 +0000 (00:25 +0000)]
[text] Add single-line-mode to ClutterText
Allow using ClutterText as a single line text field. This is useful for
text fields that accept just a single line of contents by default, and
respond to the Enter key press to execute some action.
The :single-line-mode property enables this behaviour inside ClutterText
by clipping and scrolling the contents of the PangoLayout if they do
not fit the allocated width of the Text actor.
Emmanuele Bassi [Tue, 6 Jan 2009 20:54:20 +0000 (20:54 +0000)]
[text] Fix the deletion actions
When using the delete-prev action from the end of the text we end
up either missing the first glyph we have to delete or falling
through the last one in the text.
This commit fixes both issues.
Emmanuele Bassi [Tue, 6 Jan 2009 20:52:03 +0000 (20:52 +0000)]
[text] Use cached length when possible
Since clutter_text_set_text() measures the length of the text
each time, we should use the cached length instead of recomputing
the text length each time. This should save us some time when
dealing with long, multi-byte texts.
Emmanuele Bassi [Tue, 6 Jan 2009 15:30:31 +0000 (15:30 +0000)]
[tests] Add unit for the ClutterText:password-char property
Check that the contents of the Text actor are unaffected by the
:password-char property; that the accessors are correct; and finally
that the initial value for a newly constructed Text actor is valid.
Emmanuele Bassi [Tue, 6 Jan 2009 15:29:44 +0000 (15:29 +0000)]
[docs] Update the Text section
After the
979b6794 commit, the section for ClutterText needs
updating on the renamed and removed accessors.
Emmanuele Bassi [Tue, 6 Jan 2009 15:22:31 +0000 (15:22 +0000)]
[text] Coalesce text visibility and password character
Using two properties to set a password entry can be construed as
both cumbersome and a gtk-ism. And rightly so on both counts.
The :text-visible property has also conflicting semantics with the
:cursor-visible one: while the latter hides the cursor, the former
changes the display of the contents of the Text actor. It is, thus,
not a matter of "visibility" but of "rendering".
Instead of setting the :text-visible and :invisible-char properties
to have a password text field, the Text actor should just have a
single :password-char property holding a Unicode character. If the
value of the :password-char is non-zero, the Text actor will use the
Unicode character to render the contents of the text entry.
This commit removes the following methods:
clutter_text_set_text_visible()
clutter_text_get_text_visible()
clutter_text_set_invisible_char()
clutter_text_get_invisible_char()
And the following properties:
ClutterText:text-visible
ClutterText:invisible-char
In favour of:
clutter_text_set_password_char()
clutter_text_get_password_char()
And:
ClutterText:password-char
Thus making obvious what use the property and accessor methods are
for and simplifying the process of creating a simple password text
field to:
text = clutter_text_new ();
clutter_text_set_password_char (CLUTTER_TEXT (text), '*');
Emmanuele Bassi [Tue, 6 Jan 2009 12:35:19 +0000 (12:35 +0000)]
Allow localizations to change the text direction
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.
Neil Roberts [Tue, 6 Jan 2009 11:39:14 +0000 (11:39 +0000)]
Fix off-by-one error in clutter_stage_read_pixels
It was always reading one pixel lower than requested. If y was 0 then
it would try to read below the lowest line.
Thanks to Geoff Gustafson for spotting.
Takao Fujiwara [Tue, 6 Jan 2009 12:11:07 +0000 (12:11 +0000)]
Bug 1397 - Allow localizing the command line help
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>
Neil Roberts [Mon, 5 Jan 2009 17:05:30 +0000 (17:05 +0000)]
Make libdisable-npots a bit more portable
Instead of including GL/gl.h directly it now includes cogl/cogl.h
instead which should include the right GL header.
Instead of using dlopen to specifically open libGL it now tries to use
dlsym with RTLD_NEXT. This requires defining _GNU_SOURCE on GNU
systems. If RTLD_NEXT is not available it will try passing NULL which
is unlikely to work but it will at least catch the case where it
returns the wrapper version of glGetString to prevent infinite
recursion.
This should hopefully make it work on OS X where the name of the
header and library are different (although this is currently
untested).
Emmanuele Bassi [Mon, 5 Jan 2009 16:48:46 +0000 (16:48 +0000)]
Clean up the update_pango_context() function
Logically split the various operations with whitespace so that
it's clear what does what.
Emmanuele Bassi [Mon, 5 Jan 2009 16:45:59 +0000 (16:45 +0000)]
Pass the PangoContext, not the MainContext
When updating the PangoContext with the current options (font name,
options, resolution) pass the PangoContext instead of the Clutter
MainContext structure pointer.
Emmanuele Bassi [Mon, 5 Jan 2009 16:44:52 +0000 (16:44 +0000)]
Revert the logic of the PangoContext check
The branch that creates the global PangoContext should only run
if there is no global PangoContext already.
Emmanuele Bassi [Mon, 5 Jan 2009 16:29:49 +0000 (16:29 +0000)]
Remove the binding pool entry from the list
When removing a binding entry from the binding pool we should not
only remove it from the hash table, but also from the linked list
we use to iterate over inside the block/unblock_action() pair.
Emmanuele Bassi [Mon, 5 Jan 2009 16:25:50 +0000 (16:25 +0000)]
Remove BindingPool::list_actions()
The clutter_binding_pool_list_actions() was not implemented. The
utility of a call listing all the action names is also debatable:
all the functions related to the key bindings take the key symbol
and modifiers -- except the block_action() and unblock_action()
pair.
Emmanuele Bassi [Mon, 5 Jan 2009 15:29:10 +0000 (15:29 +0000)]
Add ClutterActor::create_pango_context()
Sometimes an actor needs to set specific font rendering options on
the PangoContext without changing settings for every other text-rendering
actor.
In order to do this, we need a new public method to create a Pango
context object -- preset with all the default settings -- owned by the
developer and not shared with the rest of Clutter.
This new method is called clutter_actor_create_pango_context(); while
it does not strictly depend on a ClutterActor, it is a good idea to
have it inside the ClutterActor API to map the current get_pango_context()
method and in case we start storing screen-specific data to the Actor
itself during the 1.x API cycle.
Emmanuele Bassi [Mon, 5 Jan 2009 15:27:33 +0000 (15:27 +0000)]
Rename the PangoContext creation functions
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.
Emmanuele Bassi [Mon, 5 Jan 2009 15:26:57 +0000 (15:26 +0000)]
Whitespace fixes
Neil Roberts [Mon, 5 Jan 2009 13:14:12 +0000 (13:14 +0000)]
Fix some animation_set_* functions so they cope if the value is the same
The following functions are fixed:
clutter_animation_set_actor
clutter_animation_set_timeline
clutter_animation_set_alpha
This is related to bug 1392 which discusses the problem for
behaviour_set_alpha.
Neil Roberts [Mon, 5 Jan 2009 12:05:51 +0000 (12:05 +0000)]
Fix some *_set functions so they work if the object is the same value
Bug 1392 - behaviour_set_alpha set same alpha twice lead to warning
and destroy the input alpha
The following functions are fixed:
clutter_actor_set_shader
clutter_alpha_set_timeline
clutter_behaviour_set_alpha
clutter_clone_texture_set_parent_texture
They either now reference the new value before destroying the old
value, or just return immediately if the values are the same.
Neil Roberts [Mon, 5 Jan 2009 12:52:46 +0000 (12:52 +0000)]
Fix setting the mode on a ClutterAlpha created with animation_set_alpha(NULL)
It previously attempted to set the mode on the alpha using
clutter_animation_set_mode_internal, but this was setting the mode on
priv->alpha. At that point in the code priv->alpha is always NULL.
clutter_animation_set_mode_internal now takes a parameter to specify
which alpha to modify.
Emmanuele Bassi [Mon, 5 Jan 2009 12:52:29 +0000 (12:52 +0000)]
[docs] Add the new API to the BindingPool section
Add the clutter_binding_pool_override_* family of functions to
the BindingPool section of the Clutter API reference.
Emmanuele Bassi [Mon, 5 Jan 2009 12:49:01 +0000 (12:49 +0000)]
Allow overriding actions inside a BindingPool
As of now, a key binding installed into a BindingPool is always there
and cannot be changed.
This is problematic for sub-classes trying to override the callback
or the action for a given key binding.
This commit adds the ability to override the closure for an existing
key binding inside a binding pool -- assumed the caller knows the
key symbol and modifiers used to install the key binding in the first
place.
Neil Roberts [Mon, 5 Jan 2009 12:47:10 +0000 (12:47 +0000)]
In clutter_alpha_set_mode, set priv->mode after setting the func
Otherwise the call to clutter_alpha_set_func sets the mode back to
CLUTTER_CUSTOM_MODE so clutter_alpha_get_mode won't get back the same
value that was set.
Emmanuele Bassi [Mon, 5 Jan 2009 12:27:45 +0000 (12:27 +0000)]
[text] Add select-all binding
Bind Ctrl+A to the "select all" action.
Emmanuele Bassi [Tue, 16 Dec 2008 17:44:13 +0000 (17:44 +0000)]
[docs] Add clutter_text_activate()
Add the last unused symbol to the ClutterText section.
Emmanuele Bassi [Tue, 16 Dec 2008 17:40:41 +0000 (17:40 +0000)]
[docs] Remove ClutterLabel and ClutterEntry sections
Remove the sections for the Label and the Entry actors, which
have been replaced by ClutterText.
Emmanuele Bassi [Mon, 5 Jan 2009 11:11:10 +0000 (11:11 +0000)]
Merge branch 'units-rework'
* units-rework:
[texture] Do not mix fixed point and units values
[tests] Fix the actor detection
[units] Do not use fixed point and units interchangeably
Robert Bragg [Tue, 23 Dec 2008 16:29:29 +0000 (16:29 +0000)]
White space clean up across a number of files (only removing trailing spaces)
Removed trailing white space from the following files:
- clutter-clone-texture.c
- clutter-texture.c
- clutter-texture.h
- cogl/cogl-texture.h
- cogl/gl/cogl-context.c
- cogl/gl/cogl-texture.c
- cogl/gl/cogl-context.h
Emmanuele Bassi [Tue, 23 Dec 2008 21:06:05 +0000 (21:06 +0000)]
Remove a masking with index()
The binding-pool test unit had a variable masking the index() function
declared inside string.h.
Emmanuele Bassi [Tue, 23 Dec 2008 20:55:35 +0000 (20:55 +0000)]
Fix an empty block
Remove a stray ';' that prevented the get_bounds() method of the
ClutterBehaviourRotate to correctly return the start angle value.
Emmanuele Bassi [Tue, 23 Dec 2008 20:53:44 +0000 (20:53 +0000)]
Add more maintainer CFLAGS
Be even more anal-retentive when the maintainer flags are enabled.
Kudos to Benjamin Otte.
Emmanuele Bassi [Tue, 23 Dec 2008 16:59:14 +0000 (16:59 +0000)]
[docs] Document the newly added functions
Document the ClutterBackend font name accessors, and the
clutter_actor_get_pango_context() getter method.
Emmanuele Bassi [Tue, 23 Dec 2008 16:40:26 +0000 (16:40 +0000)]
Add the ability to set the text direction
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.
Emmanuele Bassi [Tue, 23 Dec 2008 16:27:54 +0000 (16:27 +0000)]
Return the default font name if no font name is set
When calling clutter_backend_get_font_name(), if no default font
name has previously been set, we just set the default and return
a pointer to it - like we do for the font options.
Emmanuele Bassi [Tue, 23 Dec 2008 15:05:16 +0000 (15:05 +0000)]
Use the default font from the Backend
Instead of storing the default font name and size as a pre-processor
macro, use the newly added ClutterBackend API to retrieve the current
default font from the backend.
Emmanuele Bassi [Tue, 23 Dec 2008 15:03:11 +0000 (15:03 +0000)]
Store the default font name inside ClutterBackend
The default backend stores some of the global defaults, like the
font options, text resolution, double click settings. It should also
store the default font name, to allow various text-based actors to
share the same settings.
When the font name changes, the ::font-changed signal is emitted,
to allow actors to pick up the change.
Emmanuele Bassi [Tue, 23 Dec 2008 14:34:16 +0000 (14:34 +0000)]
Update the PangoContext on backend changes
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.
Emmanuele Bassi [Tue, 23 Dec 2008 14:27:41 +0000 (14:27 +0000)]
Store the PangoContext inside the main context
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.
Emmanuele Bassi [Tue, 23 Dec 2008 14:15:10 +0000 (14:15 +0000)]
Do not leak the PangoContext
We hold a reference on the PangoContext we use for an actor, so
we should remove the reference inside the dispose implementation.
Emmanuele Bassi [Tue, 23 Dec 2008 14:11:27 +0000 (14:11 +0000)]
Create the PangoContext of the Text actor
Instead of creating a single, private PangoContext for every
Text actor, use the newly added clutter_actor_get_pango_context()
function.
Emmanuele Bassi [Tue, 23 Dec 2008 14:06:55 +0000 (14:06 +0000)]
Add a per-actor PangoContext
Rendering text inside an actor is pretty much impossible without
using internal API to create the various pieces like the PangoContext
and the font map.
Each actor should have the ability to create a PangoContext, which
is the only object needed to generate layouts and change the various
Pango settings.
This commit adds a clutter_actor_get_pango_context() function that
creates a PangoContext inside the ClutterActor private data and allows
the creation of PangoLayouts when needed. If the actor already
has a PangoContext, the same instance is returned.
The PangoContext is created only on demand.
Emmanuele Bassi [Tue, 23 Dec 2008 13:55:51 +0000 (13:55 +0000)]
Add signals for Backend options
The ClutterBackend instance at the moment lacks the ability to
notify runtime changes of the font options and the resolution.
For this reason, this commit adds a ::resolution-changed and a
::font-changed signals to the Backend class.
The ::resolution-changed signal is emitted when set_resolution()
is called with a different DPI; ::font-changed is emitted when the
cairo_font_options_t* changes from the default.
Emmanuele Bassi [Mon, 22 Dec 2008 13:29:10 +0000 (13:29 +0000)]
Use "" as the default value for the :text property
This follows the convention of GtkLabel/GtkEntry in GTK+ and the old
ClutterEntry.
It makes it easier to use strlen/strcmp etc on the output, since we can
assume that it is always a string.
This commit also updates the test unit for ClutterText to verify that
the clutter_text_get_text() function also returns an empty string when
a ClutterText actor has been created.
Emmanuele Bassi [Mon, 22 Dec 2008 13:24:52 +0000 (13:24 +0000)]
Do not include cogl-pango.h multiple times
The clutter-private.h header already includes cogl-pango.h with
the correct inclusion path, because the main context stores a
pointer to the font map.
There is no need for clutter-text.c to include cogl-pango.h
again since it already includes clutter-private.h.
Owen Taylor [Mon, 22 Dec 2008 13:11:59 +0000 (13:11 +0000)]
Return something reasonable from clutter_x11_handle_event()
Instead of returning CLUTTER_X11_FILTER_CONTINUE always from
clutter_x11_handle_event() return CLUTTER_X11_FILTER_REMOVE if
the event was on a stage and translated to a ClutterEvent.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Robert Bragg [Sun, 21 Dec 2008 21:12:43 +0000 (21:12 +0000)]
[gitignore] Adds *.swn + *.swo (Vim files) & *.orig + *.reg (patch conflicts)
Robert Bragg [Sun, 21 Dec 2008 21:08:10 +0000 (21:08 +0000)]
[build] Replaces use of #include <cairo/cairo.h> with #include <cairo.h>
The cairo pkg-config is crafted such that #include <cairo.h> should be used.
If building with a private build of cairo installed to a custom prefix
<cairo/cairo.h> can cause an un-intended cairo header to be picked up during
compilation due to /usr/include being in the header search path.
Robert Bragg [Fri, 19 Dec 2008 21:31:18 +0000 (21:31 +0000)]
[tests] Ensures that test-viewport.c is built
test-viewport.c wasn't listed correctly in the UNIT_TESTS variable
(it was missing the .c extension, and so it wasn't being built.)
Robert Bragg [Fri, 19 Dec 2008 21:22:45 +0000 (21:22 +0000)]
[tests] Ensure that test-launcher.sh is found for out of tree builds
When building out of tree the generated scripts for the unit tests
need to explicitly reference the original src dir to be able to find
test-launcher.sh, like this:
$(top_srcdir)/tests/conform/test-launcher.sh
Also test-launcher.sh now passes -m slow --verbose to gtester. Without
-m slow then the wrappers dont work for some of the timeline tests.
Emmanuele Bassi [Fri, 19 Dec 2008 18:21:36 +0000 (18:21 +0000)]
Avoid masking math.h exported variables
Our beloved math.h exports, from bits/mathcalls.h, a bare "y1" symbol.
Apparently, it's unthinkable for code including <math.h> to also declare
arguments or variable named "y0", "y1" and "yn".
Anyway, the quick fix already used elsewhere in Clutter's codebase is
to rename the colliding variables "y_0", "y_1" and "y_n" - and
obviously everything similar to them as well, using the same pattern.
Emmanuele Bassi [Fri, 19 Dec 2008 17:49:57 +0000 (17:49 +0000)]
[docs] Remove a duplicate definition
ClutterScriptable was defined twice inside the sections file.
Emmanuele Bassi [Fri, 19 Dec 2008 17:48:30 +0000 (17:48 +0000)]
[docs] Documentation fixes for CairoTexture
Sync up the arguments name inside the gtk-doc annotations with their
name inside the function declaration in the header file.
Emmanuele Bassi [Fri, 19 Dec 2008 17:44:24 +0000 (17:44 +0000)]
Whitespace fixes
Let's try to honour the coding style document, now that we have one.
Emmanuele Bassi [Fri, 19 Dec 2008 17:41:44 +0000 (17:41 +0000)]
[docs] Parameter naming fixes
The name of the parameter in the header and the one in the gtk-doc
annotation on top of a function must match.
Unfortunately, there is an index() function declared inside strings.h
which makes gcc complain for the "index" argument as soon as we
enable the extra compiler flags we use when distchecking.
Hence, we need to rename "index" to "index_" in the header and in
the source files.
Emmanuele Bassi [Fri, 19 Dec 2008 17:30:50 +0000 (17:30 +0000)]
[docs] Add last few missing symbols to the sections file
Emmanuele Bassi [Fri, 19 Dec 2008 17:28:42 +0000 (17:28 +0000)]
[docs] Add shader symbols to their sections
Emmanuele Bassi [Fri, 19 Dec 2008 17:25:18 +0000 (17:25 +0000)]
[docs] Add ClutterPath unused symbols
Add the symbols that gtk-doc can track to the sections file.
Emmanuele Bassi [Fri, 19 Dec 2008 17:21:30 +0000 (17:21 +0000)]
[docs] Fix a typo in the binding pool section
Emmanuele Bassi [Fri, 19 Dec 2008 16:44:40 +0000 (16:44 +0000)]
Merge branch 'cairo-texture'
* cairo-texture:
[cairo-texture] Remove the construct only restriction on surface size
[cairo-texture] Silently discard 0x0 surfaces
Re-indent ClutterPath header
Add a test case for the new cairo path functions
Add clutter_path_to_cairo_path and clutter_path_add_cairo_path
Warn instead of returning in the IN_PAINT check
Small documentation fixes
Print a warning when creating a cairo_t while painting
Do not set the IN_PAINT flag inside the Stage paint
Set the IN_PAINT private flag
[docs] Add ClutterCairoTexture to the API reference
Add ClutterCairoTexture
Require Cairo as a Clutter dependency
Conflicts:
Fix merge conflict in clutter/clutter-path.h
Neil Roberts [Fri, 19 Dec 2008 13:15:26 +0000 (13:15 +0000)]
[cairo-texture] Remove the construct only restriction on surface size
It is possible to change the surface size after construction with
clutter_cairo_texture_set_surface_size so it doesn't seem right to
restrict changing the properties.
clutter_cairo_texture_resize_surface_internal is called in a handler
for the notify signal. It is called there rather than directly in the
set_property handler so that changing both properties in a single
g_object_set will only cause one resize. The constructed override is
no longer needed.
resize_surface_internal will now bail out if the size of the surface
is already the right size.
Emmanuele Bassi [Fri, 19 Dec 2008 13:42:17 +0000 (13:42 +0000)]
[texture] Do not mix fixed point and units values
Like we did for ClutterActor in commit
cdb78ec4, fix ClutterTexture
usage of CoglFixed and ClutterUnit values without conversion between
the two types.
Emmanuele Bassi [Fri, 19 Dec 2008 13:03:53 +0000 (13:03 +0000)]
[tests] Fix the actor detection
The test-unproject interactive test assumed that only the rectangle was
on the stage. As it turns out, labels can be picked as well.
Emmanuele Bassi [Fri, 19 Dec 2008 12:53:57 +0000 (12:53 +0000)]
[units] Do not use fixed point and units interchangeably
Clutter units are, at the moment, implemented as a value in fixed point
notation using the same format as CoglFixed. This is, though, an
implementation detail. For this reason, units should not be treated as
CoglFixed values and should be converted to and from fixed point using
the provided macros.
This commit updates the usage of units and fixed point values in
ClutterActor and rationalises some of the transformation code that
heavily relied on the equivalency between them.
Emmanuele Bassi [Thu, 18 Dec 2008 18:14:22 +0000 (18:14 +0000)]
[docs] Fix a copy-and-paste typo in the coding style
Emmanuele Bassi [Thu, 18 Dec 2008 17:56:11 +0000 (17:56 +0000)]
[docs] Add coding style document
We should formalise the current coding style of Clutter for
third parties that wish to start hacking and contribute back
patches.
Robert Bragg [Thu, 18 Dec 2008 17:54:35 +0000 (17:54 +0000)]
Improves tfp performance on Nvidia
Some drivers (e.g. Nvidia) get upset if you try to create multiple glx pixmaps
for the same server side pixmap object, even though you might have unique
client side names, we now avoid hitting this problem by destroying the current
glx pixmap early within clutter_glx_texture_pixmap_create_glx_pixmap.
Neil Roberts [Thu, 18 Dec 2008 17:40:36 +0000 (17:40 +0000)]
[test-scale] Add a label showing the gravity
A label is now displayed under the rectangle showing the current
gravity. The text for the gravity is taken from the GEnumClass. This
makes it easier to verify that the test is working correctly.
Neil Roberts [Thu, 18 Dec 2008 12:20:46 +0000 (12:20 +0000)]
Fix calculation in clutter_cubic_bezier
The calculation for cubic bezier curves had an extra multiplication by
3 which was causing the curve to go over 1.0 very quickly. This had
the affect of making test-animation appear to complete much before the
completed signal is emitted.