profile/ivi/clutter.git
15 years agoAdd declaration of clutter_binding_pool_get_type()
Emmanuele Bassi [Wed, 14 Jan 2009 15:03:30 +0000 (15:03 +0000)]
Add declaration of clutter_binding_pool_get_type()

The function is automagically created by G_DEFINE_TYPE(), but
it should also be declared in the header.

15 years agoMerge branch 'animation-improvements'
Emmanuele Bassi [Wed, 14 Jan 2009 15:00:44 +0000 (15:00 +0000)]
Merge branch 'animation-improvements'

* animation-improvements:
  [docs] Add ClutterAnimatable to the API reference
  Add license notice to ClutterAnimation files
  [docs] Update the ClutterAnimation section
  [animation] Extend ClutterAnimation support to all objects
  [animation] Use ClutterAnimatable inside Animation
  [animation] Add ClutterAnimatable
  [animation] Allow registering custom progress function
  [animation] Interval::compute_value should return a boolean
  Animate ClutterColor properties

15 years agoFix compilation warning
Emmanuele Bassi [Wed, 14 Jan 2009 14:34:35 +0000 (14:34 +0000)]
Fix compilation warning

Declare the width and height variables as unsigned ints, in order
to match the required arguments for clutter_actor_get_size().

15 years ago[clutter-text] Fix x-position of cursor when moving up or down
Neil Roberts [Wed, 14 Jan 2009 11:12:02 +0000 (11:12 +0000)]
[clutter-text] Fix x-position of cursor when moving up or down

ClutterText already has code to try to preserve the x position when
moving up or down. A target x-position is stored and the cursor is
positioned at the nearest point to that in the appropriate line when
up or down is pressed. However the target position was never cleared
so it would always target the x-position of the cursor from the first
time you pressed up or down.

To fix this the patch clears the target position in set_position and
then sets it after the call in real_move_up/down. That way pressing
up or down sets the target position and any other movement will clear
it.

To get an index for the pixel position in the line
pango_layout_line_x_to_index is used. However when x is greater than
the length of the line then the index before the last grapheme is
returned which was causing it to jump to the penultimate
character. The patch makes it add on the trailing value so that it
will jump to the last character.

15 years ago[clutter-text] Fix offset_to_bytes to work when pos == 0
Neil Roberts [Tue, 13 Jan 2009 18:42:50 +0000 (18:42 +0000)]
[clutter-text] Fix offset_to_bytes to work when pos == 0

The old function ended up returning the length of the string when pos
was zero. This caused it to insert characters at the end when the
cursor was at the beginning of the string.

15 years ago[clutter-text] Don't allow control characters to be inserted
Neil Roberts [Tue, 13 Jan 2009 17:52:38 +0000 (17:52 +0000)]
[clutter-text] Don't allow control characters to be inserted

If an unbound control key is pressed (such as Ctrl+R) it would insert
a rectangle into the text.

Also zero is considered a valid unicode character by
g_unichar_validate so pressing a key such as shift would cause the
current selection to be deleted. The character isn't actually inserted
because insert_unichar disallows zeroes.

15 years agoFix GLES 2 after the multiple-texture-rectangle branch merge
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.

15 years agoUpdate gtk-doc 'Since' field for cogl_texture_multiple_rectangles
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

15 years ago[gitignore] Update the ignore file
Emmanuele Bassi [Tue, 13 Jan 2009 14:05:35 +0000 (14:05 +0000)]
[gitignore] Update the ignore file

15 years agoAdd ClutterBindingPool:name
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.

15 years agoTurn ClutterBindingPool a GObject
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.

15 years agoBug 1087 - virtualize stage_queue_redraw
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.

15 years ago[ClutterGLXTexturePixmap] Use an RGB texture (not ARGB) for 24bpp pixmaps
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)

15 years agoDeclare G_LOG_DOMAIN for COGL
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.

15 years agoAllow ensuring that a stage viewport is updated
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.

15 years ago[x11] Proper fix for the ClutterStage resize race
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.

15 years ago[docs] Documentation warnings
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.

15 years ago[x11] Fix a race condition when resizing a stage
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.

15 years ago[text] Fix GObject properties in ClutterText
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.

15 years agoFix last improper usage of ClutterUnits
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().

15 years agoMerge branch 'animatable-iface' into animation-improvements
Emmanuele Bassi [Thu, 8 Jan 2009 13:38:51 +0000 (13:38 +0000)]
Merge branch 'animatable-iface' into animation-improvements

* animatable-iface:
  [docs] Add ClutterAnimatable to the API reference
  Add license notice to ClutterAnimation files
  [animation] Use ClutterAnimatable inside Animation
  [animation] Add ClutterAnimatable

15 years ago[docs] Add ClutterAnimatable to the API reference
Emmanuele Bassi [Thu, 8 Jan 2009 13:31:27 +0000 (13:31 +0000)]
[docs] Add ClutterAnimatable to the API reference

15 years agoAdd license notice to ClutterAnimation files
Emmanuele Bassi [Thu, 8 Jan 2009 13:18:00 +0000 (13:18 +0000)]
Add license notice to ClutterAnimation files

15 years ago[docs] Update the ClutterAnimation section
Emmanuele Bassi [Thu, 8 Jan 2009 13:16:20 +0000 (13:16 +0000)]
[docs] Update the ClutterAnimation section

15 years ago[animation] Extend ClutterAnimation support to all objects
Emmanuele Bassi [Thu, 8 Jan 2009 13:13:39 +0000 (13:13 +0000)]
[animation] Extend ClutterAnimation support to all objects

Instead of limiting the use of ClutterAnimation to ClutterActor
instances, relax the constraint to include all GObject classes.

ClutterAnimation is not using actor-specific API, since it is
only using properties.

The only actor-based API is the clutter_actor_animate() family
of functions.

15 years ago[animation] Use ClutterAnimatable inside Animation
Emmanuele Bassi [Thu, 8 Jan 2009 12:59:16 +0000 (12:59 +0000)]
[animation] Use ClutterAnimatable inside Animation

ClutterAnimation should check if the object is implementing the
Animatable interface, and if so delegate to it the computation
of the value along the interval initial and final value, depending
on the progress.

15 years ago[animation] Add ClutterAnimatable
Emmanuele Bassi [Thu, 8 Jan 2009 12:56:46 +0000 (12:56 +0000)]
[animation] Add ClutterAnimatable

The ClutterAnimatable interface is meant to be used by GObject
classes to override the value computation for an animatable
property within the boundaries of an interval.

It is composed of a single virtual function, animate_property();
its implementation will receive the ClutterAnimation used to
animate the object; the property name; the initial and final
interval values; and the progress factor as retrieved by the
Alpha object bound to the Animation instance.

15 years ago[test-clip] Use gint for hand_{width,height} when calulating -hand_* /2
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.

15 years ago[animation] Allow registering custom progress function
Emmanuele Bassi [Thu, 8 Jan 2009 11:15:09 +0000 (11:15 +0000)]
[animation] Allow registering custom progress function

A ClutterInterval can change the way the progress is computed
by subclassing and overriding the ::compute_value() virtual function.

It should also be possible to register a custom progress function
in the same way it is possible to register a custom transformation
function between two GValues.

This commit adds an internal, global hash table that maintains a
GType <-> progress function association; each ClutterInterval
will check if there is a progress function registered for the
GType of the initial and final values of the interval and, if
it has been found, it will call it to compute the value of the
interval depending on the progress factor.

15 years ago[test-depth] Use a gint for width, not guint, when calculating -width/2
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.

15 years ago[animation] Interval::compute_value should return a boolean
Emmanuele Bassi [Wed, 7 Jan 2009 18:18:59 +0000 (18:18 +0000)]
[animation] Interval::compute_value should return a boolean

If the computation of the interval value depending on the progress
was not successful, ClutterInterval::compute_value() should return
this information to the caller.

15 years agoRename a variable masking index()
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.

15 years agoMerge branch multiple-texture-rectangle into master
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

15 years ago[tests] Update the ClutterText interactive test
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.

15 years ago[docs] Documentation fixes
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.

15 years ago[text] Do not use markup on an editable Text
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.

15 years ago[text] Do not ensure the cursor if not needed
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.

15 years ago[tests] Make test-scale use ClutterText
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.

15 years ago[tests] Remove test-opacity interactive test
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.

15 years agoMerge the ClutterText actor
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
  ...

15 years agoRe-align ClutterText header file
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.

15 years ago[text] Fix cursor sizing
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.

15 years agoComments and whitespace fixes to ClutterText
Emmanuele Bassi [Wed, 7 Jan 2009 00:43:24 +0000 (00:43 +0000)]
Comments and whitespace fixes to ClutterText

15 years ago[docs] Add newly added :single-line-mode accessors
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.

15 years agoUpdate the ignore file
Emmanuele Bassi [Wed, 7 Jan 2009 00:29:41 +0000 (00:29 +0000)]
Update the ignore file

15 years ago[tests] Add text field interactive test
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.

15 years ago[text] Add single-line-mode to ClutterText
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.

15 years ago[text] Fix the deletion actions
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.

15 years ago[text] Use cached length when possible
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.

15 years ago[tests] Add unit for the ClutterText:password-char property
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.

15 years ago[docs] Update the Text section
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.

15 years ago[text] Coalesce text visibility and password character
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), '*');

15 years agoAnimate ClutterColor properties
Emmanuele Bassi [Tue, 6 Jan 2009 12:53:30 +0000 (12:53 +0000)]
Animate ClutterColor properties

We can animate a ClutterColor-based property between an interval
of two colors by simply applying the factor to each color component.

15 years agoAllow localizations to change the text direction
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.

15 years agoFix off-by-one error in clutter_stage_read_pixels
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.

15 years agoBug 1397 - Allow localizing the command line help
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>
15 years agoMake libdisable-npots a bit more portable
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).

15 years agoClean up the update_pango_context() function
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.

15 years agoPass the PangoContext, not the MainContext
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.

15 years agoRevert the logic of the PangoContext check
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.

15 years agoRemove the binding pool entry from the list
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.

15 years agoRemove BindingPool::list_actions()
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.

15 years agoAdd ClutterActor::create_pango_context()
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.

15 years agoRename the PangoContext creation functions
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.

15 years agoWhitespace fixes
Emmanuele Bassi [Mon, 5 Jan 2009 15:26:57 +0000 (15:26 +0000)]
Whitespace fixes

15 years agoFix some animation_set_* functions so they cope if the value is the same
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.

15 years agoFix some *_set functions so they work if the object is the same value
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.

15 years agoFix setting the mode on a ClutterAlpha created with animation_set_alpha(NULL)
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.

15 years ago[docs] Add the new API to the BindingPool section
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.

15 years agoAllow overriding actions inside a BindingPool
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.

15 years agoIn clutter_alpha_set_mode, set priv->mode after setting the func
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.

15 years ago[text] Add select-all binding
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.

15 years ago[docs] Add clutter_text_activate()
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.

15 years ago[docs] Remove ClutterLabel and ClutterEntry sections
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.

15 years agoMerge branch 'units-rework'
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

15 years agoWhite space clean up across a number of files (only removing trailing spaces)
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

15 years agoRemove a masking with index()
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.

15 years agoFix an empty block
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.

15 years agoAdd more maintainer CFLAGS
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.

15 years ago[docs] Document the newly added functions
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.

15 years agoAdd the ability to set the text direction
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.

15 years agoReturn the default font name if no font name is set
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.

15 years agoUse the default font from the Backend
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.

15 years agoStore the default font name inside ClutterBackend
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.

15 years agoUpdate the PangoContext on backend changes
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.

15 years agoStore the PangoContext inside the main context
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.

15 years agoDo not leak the PangoContext
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.

15 years agoCreate the PangoContext of the Text actor
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.

15 years agoAdd a per-actor PangoContext
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.

15 years agoAdd signals for Backend options
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.

15 years agoUse "" as the default value for the :text property
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.

15 years agoDo not include cogl-pango.h multiple times
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.

15 years agoReturn something reasonable from clutter_x11_handle_event()
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>
15 years ago[gitignore] Adds *.swn + *.swo (Vim files) & *.orig + *.reg (patch conflicts)
Robert Bragg [Sun, 21 Dec 2008 21:12:43 +0000 (21:12 +0000)]
[gitignore] Adds *.swn + *.swo (Vim files) & *.orig + *.reg (patch conflicts)

15 years ago[build] Replaces use of #include <cairo/cairo.h> with #include <cairo.h>
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.

15 years ago[tests] Ensures that test-viewport.c is built
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.)

15 years ago[tests] Ensure that test-launcher.sh is found for out of tree builds
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.

15 years agoAvoid masking math.h exported variables
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.

15 years ago[docs] Remove a duplicate definition
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.

15 years ago[docs] Documentation fixes for CairoTexture
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.