Commit Graph

2597 Commits

Author SHA1 Message Date
Emmanuele Bassi
cd3acca2b7 [build] Link Cogl against -lm
We use math routines inside Cogl, so it's correct to have it in
the LIBADD line. In normal usage something else was pulling in
-lm, but the introspection is relying on linking against the
convenience library.

Based on a patch by: Colin Walters <walters@verbum.org>

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-05-14 23:23:00 +01:00
Emmanuele Bassi
08ac50faae [build] List cogl-internal.h
During the Makefile clean up, cogl-internal.h got lost and this
broke the dist. Let's put it back in.
2009-05-14 19:51:03 +01:00
Emmanuele Bassi
2f5012e38c [animation] Do not leak timelines
The timeline created when calling set_timeline(NULL) is referenced
even though we implicitly own it. When the Animation is destroyed,
the timeline is then leaked.

Thanks to: Richard Heatley <richard.heatley@starleaf.com>

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1548
2009-05-14 16:20:12 +01:00
Emmanuele Bassi
21e3901d62 [text] Expose position_to_coords()
The clutter_text_position_to_coords() is useful for ClutterText
subclasses.

See bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1521

Based on a patch by: Raymond Liu <raymond.liu@intel.com>
2009-05-14 16:19:15 +01:00
Emmanuele Bassi
ca23838752 [text] Add ClutterText::delete_selection()
Add a method for deleting the current selection inside a Text actor.

This is useful for subclasses.

See bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1521

Based on a patch by: Raymond Liu <raymond.liu@intel.com>
2009-05-14 16:16:06 +01:00
Emmanuele Bassi
79cb0a3515 [animation] Remove InitiallyUnowned from Animation
ClutterAnimation currently inherits the initial floating reference
semantics from GInitiallyUnowned. An Animation is, though, meant to
be used as a top-level object, like a Timeline or a Behaviour, and
not "owned" by another object. For this reason, the initial floating
reference does not make any sense.
2009-05-14 16:12:36 +01:00
Emmanuele Bassi
0f7a3b9739 [docs] Add Animation get_type() function
We need to reference clutter_animation_get_type() if we want the
properties, signals and object hierarchy to show up in the API
reference
2009-05-14 16:11:47 +01:00
Emmanuele Bassi
092b41d53b [docs] Document the destructor for Timeline
The rest of the API reference lists the destructor for the class
inside the constructor's return value -- except Timeline.
2009-05-14 16:11:38 +01:00
Dan Winship
1c6580afd6 [cairo-texture] Document redrawing behavior
Document that repeated calls to clutter_cairo_texture_create()
continue drawing on the same cairo_surface_t. Add
clutter_cairo_texture_clear() for when you don't want that behavior.

http://bugzilla.openedhand.com/show_bug.cgi?id=1599

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-05-14 15:53:59 +01:00
Thomas Wood
81a536238d [text] fix problems with scrolling interaction
The cursor x position is already translated, so we do not need to take the
actors allocation into account when calculating scrolling.

Additionally, we need to update the text_x value before running
clutter_text_ensure_cursor_position.
2009-05-14 15:08:31 +01:00
Thomas Wood
a3a5fe5594 [text] scroll to the cursor position if it is outside the allocation
Adjust the text offset to keep the cursor within the allocation. This means
the text will scroll per character
2009-05-14 13:31:51 +01:00
Thomas Wood
cf6c2d9721 [text] account for scrolling in text selections
Account for any scrolling offset in single line mode when calculating the
area that should be selected.
2009-05-14 13:31:21 +01:00
Thomas Wood
e79fd1055d [text] account for scrolling in clutter_text_position_to_coords
Add any scrolling offset to the x value when in single line mode.

Now that the offset is taken into account in the position_to_coords
function, we do not need to adjust the cursor x manually in
clutter_text_paint.
2009-05-14 13:31:21 +01:00
Thomas Wood
16185c78fc [text] take scrolling into account when calculating cursor position
Account for the scrolling in single line more when calculating the cursor
position from coordinates.
2009-05-14 13:31:20 +01:00
Thomas Wood
e162d0b060 [text] position the cursor correctly in single line mode
The position of the text should be increased by the value of TEXT_PADDING
and the cursor offset by the same value as the text offset.
2009-05-14 13:31:20 +01:00
Thomas Wood
cd86e70f41 [text] take text padding into account when in single line mode
In single line mode, extra padding is added to the text which must be
taken into account when reporting the natural size of the actor.
2009-05-14 13:31:20 +01:00
Emmanuele Bassi
92e4391056 [tests] Verify cursor position
Print out the cursor and selection positions in order to verify
the behaviour of the Text actor.

This is a likely candidate for a conformance test unit as well.
2009-05-14 12:05:57 +01:00
Emmanuele Bassi
0d43d81ee0 [text] Maintain the cursor at the end when deleting
If the cursor is already at the end of the Text contents then we
need to maintain its position when deleting the previous character
using the relative key binding.
2009-05-14 12:00:51 +01:00
Emmanuele Bassi
8174f66cc6 [text] Reset the cursor when setting empty text
When setting the contents of Text to an empty string we should
reset the cursor position and selection bound to -1.
2009-05-14 11:50:42 +01:00
Emmanuele Bassi
608c3e3ab4 [build] Fix with --disable-introspection
The required "fake" libclutter-cogl.la upon with the main clutter
shared object depends is only built with introspection enabled
instead of being built unconditionally.
2009-05-14 10:03:31 +01:00
Emmanuele Bassi
724e58a85a [build] Do not rebuild the conformance tests scripts
Make the build output a little bit cleaner by not re-creating the
small shell scripts that allow launching the test units separately.
2009-05-14 08:38:28 +01:00
Owen W. Taylor
d8aa6827ee Don't build Cogl.gir against installed Clutter library
Passing:

 --library=clutter-@CLUTTER_FLAVOUR@-@CLUTTER_API_VERSION@

to g-ir-scanner, when building Cogl was causing g-ir-scanner to
link the introspection program against the installed clutter library,
if it existed or fail otherwise. Instead copy the handling from
the json/ directory where we link against the convenience library
to scan, and do the generation of the typelib later in the
main clutter/directory.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1594

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-05-13 23:31:43 +01:00
Emmanuele Bassi
447e04bdce [text] Return the correct minimum height
If text is set, ClutterText should never return less than the layout
height for minimum and preferred heights.

This holds unless ellipsize and wrap are enabled, in which case the
minimum height should be the height of the first line -- which is
the height needed to at the very least show the ellipsization.

Based on a patch by: Thomas Wood <thomas@openedhand.com>

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1598

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-05-13 23:06:43 +01:00
Emmanuele Bassi
aa1246e891 [backend] Abstract the GL context creation
This is the another step into abstracting the backend operations
that are currently spread all across the board back into the
backend implementations where they belong.

The GL context creation, for instance, is demanded to the stage
realization which makes it a critical path for every operation
that is GL-context bound. This usually does not make any difference
since we realize the default stage, but at some point we might
start looking into avoiding the default stage realization in order
to make the Clutter startup faster.

It also makes the code maintainable because every part is self
contained and can be reworked with the minimum amount of pain.
2009-05-13 22:21:48 +01:00
Emmanuele Bassi
1d7a79f343 Update the redraw priority
The master clock is using the redraw priority to create the source
that will be used to spin the paint sequence if something is being
animated using a timeline.

Unfortunately, the priority is too high and this causes starvation
when embedding into other toolkits -- like gtk+.

Thanks to Havoc Pennington for catching this.
2009-05-13 22:20:19 +01:00
Emmanuele Bassi
e59a19bd03 [x11] Abstract XVisualInfo creation
The XVisualInfo for GL is created when a stage is being realized.
When embedding Clutter inside another toolkit we might not want to
realize a stage to extract the XVisualInfo, then set the stage
window using a foreign X Window -- which will cause a re-realization.

Instead, we should abstract as much as possible into the X11 backend.

Unfortunately, the XVisualInfo for GL is requested using GLX API; for
this reason we have to create a ClutterBackendX11 method that we
override inside the ClutterBackendGLX implementation.

This also allows us to move a little bit of complexity from out of
the stage realization, which is currently a very delicate and hard
to debug section.
2009-05-13 21:49:45 +01:00
Robert Bragg
2b1759385e [text] Ensure clutter_text_get_selection copes with start/end positions of -1
I was seeing clutter_text_get_selection trying to malloc up to 4Gb due to
unexpected negative arithmetic for the start/end offsets which resulted
in a crash.

This just tests for positions of -1 before deciding if the start/end
positions need to be swapped.  The conversion from position to byte offset
already works with -1.
2009-05-13 14:34:00 +01:00
Emmanuele Bassi
979f089ef9 [tests] Add command line option to the picking test
The picking test has two configurables: the number of actors and
the number of events per frame. It makes sense to have them as
command line options to test with multiple configurations without
having to change defines and recompile.
2009-05-12 19:22:25 +01:00
Owen W. Taylor
df85b70ab4 Fix chain-up in clutter_list_model_dispose()
Chain up to parent class's dispose() method not parent class's
finalize() method.

http://bugzilla.openedhand.com/show_bug.cgi?id=1595

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-05-12 16:31:41 +01:00
Chris Lord
62e2f27604 [tests/micro-bench] Add a picking performance test
Approved by Robert Bragg.
2009-05-12 16:17:51 +01:00
Robert Bragg
d1fa83039d [picking] Use cogl_clip_push_window_rect to greatly reduce the cost of picking.
cogl_clip_push_window_rect is implemented using GPU scissoring which allows
the GPU to cull anything that falls outside a given rectangle.  Since in the
case of picking we only ever care about a single pixel we can get the GPU to
ignore all geometry that doesn't intersect that pixel and only rasterize for
one pixel.
2009-05-12 15:44:34 +01:00
Robert Bragg
e80fcbc298 [cogl-clip-stack] Support pushing rectangles onto the stack using window coords
Previously clipping could only be specified in object coordinates, now
rectangles can also be pushed in window coordinates.

Internally rectangles pushed this way are intersected and then clipped using
scissoring.  We also transparently try to convert rectangles pushed in
object coordinates into window coordinates as we anticipate the scissoring
path will be faster then the clip planes and undoubtably it will be faster
than using the stencil buffer.
2009-05-12 15:44:33 +01:00
Neil Roberts
e9b863eba2 Don't clear the stencil buffer before painting and picking
The stencil buffer is always cleared the first time a clip is used
that needs it and the stencil test is disabled otherwise so there is
no need to clear before a paint.
2009-05-12 15:36:16 +01:00
Robert Bragg
36cfb60307 [cogl] Remove the COGL{enum,int,uint} typedefs
COGLenum, COGLint and COGLuint which were simply typedefs for GL{enum,int,uint}
have been removed from the API and replaced with specialised enum typedefs, int
and unsigned int. These were causing problems for generating bindings and also
considered poor style.

The cogl texture filter defines CGL_NEAREST and CGL_LINEAR etc are now replaced
by a namespaced typedef 'CoglTextureFilter' so they should be replaced with
COGL_TEXTURE_FILTER_NEAREST and COGL_TEXTURE_FILTER_LINEAR etc.

The shader type defines CGL_VERTEX_SHADER and CGL_FRAGMENT_SHADER are handled by
a CoglShaderType typedef and should be replaced with COGL_SHADER_TYPE_VERTEX and
COGL_SHADER_TYPE_FRAGMENT.

cogl_shader_get_parameteriv has been replaced by cogl_shader_get_type and
cogl_shader_is_compiled. More getters can be added later if desired.
2009-05-12 14:53:44 +01:00
Robert Bragg
cea711cc7e [ClutterTexture] Remove a spurious line I accidentally committed in 741c4bb5
I accidentally changed clutter_texture_set_cogl_texture to always set the
filter quality for the new Cogl texture to medium.
2009-05-12 14:53:43 +01:00
Robert Bragg
08a73a215f Don't call glFinish in _clutter_do_pick
Calling glReadPixels is bad enough in forcing us to synchronize the CPU with
the GPU, but glFinish has even stronger synchonization semantics than
glReadPixels which may negate some driver optimizations possible in
glReadPixels.
2009-05-12 14:53:43 +01:00
Neil Roberts
10783e053b [build] Fix out-of-tree builds for Cogl
Commit 43fa38fcf5 broke out-of-tree builds by removing some of the
builddir directories from the include path. builddir/clutter/cogl and
builddir/clutter are needed because cogl.h and cogl-defines-gl.h are
automatically generated by the configure script. The main clutter
headers are in the srcdir so this needs to be in the path too.
2009-05-12 14:16:46 +01:00
Raymond Liu
dd95939d26 Emit key focus signal when stage state changes
When the stage state changes between active/deactive, send out
key-focus-in/key-focus-out signal for the current key focused
actor on the stage.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1503

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-05-12 13:47:17 +01:00
Emmanuele Bassi
4b285e02bc [x11] Unset the GL context when re-realizing
Setting the stage window using the set_stage_foreign() method will
lead to a re-realization. We need to make sure that the Drawable
currently associated to the GL context is set to None, to avoid a
BadDrawable error or, if we're unlucky, a segfault in the X server.
2009-05-11 18:17:30 +01:00
Emmanuele Bassi
0b7e459d48 Add more debugging notes 2009-05-11 12:45:33 +01:00
Emmanuele Bassi
8b7c6955de [backend] Unset the current stage if it is unrealized
This commit reverts part of commit 5bcde25c - specifically the
part that forced a realization of the stage if we are ensuring
the GL context with it. This makes Clutter behave like it did
prior to commit 5bcde25c: if we are asked to ensure the GL context
with an unrealized stage we simply pass NULL to the backend
implementation.
2009-05-11 12:45:33 +01:00
Emmanuele Bassi
d19f6feb45 [stage] Chain up ::show before showing the implementation
When showing a Stage for the first time we end up realizing the stage
implementation before realizing the wrapper. This leads to segmentation
faults or errors coming from the backend because we're fumbling the
state and realization sequence.
2009-05-11 12:45:33 +01:00
Emmanuele Bassi
9582fddb24 [x11] Do not needlessly check XVisualInfo
Since we are destroying any previously set VisualInfo we keep we know
for sure that stage->xvisinfo is going to be None; hence, no reason to
check this condition.
2009-05-11 12:45:33 +01:00
Emmanuele Bassi
0acb98e987 [actor] Conditionally verify the map state
The verify_map_state() internal method is conditionally compiled
if we have CLUTTER_ENABLE_DEBUG set; for this reason, all calls to
that method should be made conditional.
2009-05-11 12:45:33 +01:00
Emmanuele Bassi
d00cac6353 [build] Unbreak compilation
When building Clutter with introspection enabled everything stops
at Cogl GIR generation because it depends on the installed library
to work. Since we still require some changes in the API to be able
to build the GIR and the typelib for Cogl we should disable the
generation of the GIR as well.
2009-05-10 00:44:10 +01:00
Emmanuele Bassi
5bcde25cbb Tentative fix for multi-stage support on GLX
The fix for bug 1138 broke multi-stage support on GLX, causing
X11 to segfault with the following stack trace:

Backtrace:
0: /usr/X11R6/bin/X(xf86SigHandler+0x7e) [0x80c91fe]
1: [0xb7eea400]
2: /usr/lib/xorg/modules/extensions//libglx.so [0xb7ae880c]
3: /usr/lib/xorg/modules/extensions//libglx.so [0xb7aec0d6]
4: /usr/X11R6/bin/X [0x8154c24]
5: /usr/X11R6/bin/X(Dispatch+0x314) [0x808de54]
6: /usr/X11R6/bin/X(main+0x4b5) [0x8074795]
7: /lib/i686/cmov/libc.so.6(__libc_start_main+0xe5) [0xb7c75775]
8: /usr/X11R6/bin/X(FontFileCompleteXLFD+0x21d) [0x8073a81]

which I can only track down to clutter_backend_glx_ensure_current()
being passed a NULL stage -- something that happens when a stage
is not correct realized. That should lead to a glXMakeCurrent(None)
and not to a segmentation fault, though.
2009-05-08 17:17:48 +01:00
Emmanuele Bassi
91126558d3 [actor] Relax some of the invariants checks
When destroying a top-level actor we can actually relax the verification
of the map state, since it might be fully asynchronous and we might not
re-enter inside the mainloop in time to receive the unmap notification.
2009-05-08 17:14:49 +01:00
Rob Bradford
692c50ba67 [list-model] Return NULL for first row in a fully filtered model
If the filter means that the there should be no rows left in the model,
clutter_model_get_iter_at_row (model, 0) should return NULL.

Howevever the currene implementation misbehaves and returns a bad iterator.
This change resolves the issue by tracking if we actually found any
non-filtered rows in our pass through the sequence.

OH Bugzilla: 1591
2009-05-08 12:33:44 +01:00
Emmanuele Bassi
9f3927c460 [stage] Chain up to the correct vfunc when picking
The stage is chaining up to the ClutterGroup::paint instead of
the ClutterGroup::pick method. This works anyway because we
detect the stage by default, but it's not a reliable solution
in case we decide to change the picking further on.
2009-05-07 19:25:24 +01:00
Emmanuele Bassi
533c9c5365 [debug] Show the actor name/type on queue_redraw() 2009-05-07 19:25:24 +01:00