1
0
Fork 0
Commit graph

4184 commits

Author SHA1 Message Date
Emmanuele Bassi
d078fe0930 event: Fix up clutter_event_copy()
We need to copy the scroll axis data, and we need to copy the private
Event data from the source event to the target event structure.
2011-01-21 10:25:45 +00:00
Emmanuele Bassi
405e611279 device/xi2: Translate the axis data after setting devices
We need the devices (source and virtual) to be set before translating
the axis data from XI2 to the Clutter event.
2011-01-21 10:25:45 +00:00
Emmanuele Bassi
dd5f6ca7e1 device: Add more accessors for properties
Allow using real accessor methods for getting the ClutterInputDevice
properties set on construction.
2011-01-21 10:25:45 +00:00
Emmanuele Bassi
333ca35cec device: Add get_axis_value()
We need a convenience function for extracting the value of a specific
axis type out of the array of axis values attached to events.
2011-01-21 10:25:45 +00:00
Emmanuele Bassi
d805237c31 event: Add accessor for the axes field
CLUTTER_BUTTON_* and CLUTTER_MOTION event types have axes data attached
to them, so we want to expose a common ClutterEvent method for
extracting that data.
2011-01-21 10:25:44 +00:00
Emmanuele Bassi
431200f40d device: Add keys and axes accessors
Allow retrieving the number of keys and axes, since we provide the API
to iterate over them both.
2011-01-21 10:25:44 +00:00
Emmanuele Bassi
0a869e0718 egl/x11: Defer X11-specific code to the X11 backend
The ClutterStageX11 implementation does most of the heavy lifting, so
subclasses like ClutterStageGLX and ClutterStageEGL do not need to
handle things like creating the stage Window and selecting events; just
chaining up and using the internal API will suffice.
2011-01-21 10:25:44 +00:00
Emmanuele Bassi
a3102a777e docs: Fill out documentation for new symbols 2011-01-21 10:25:44 +00:00
Emmanuele Bassi
fa3c5a28a7 backend/x11: Allow querying xinput support
Undeprecate the XInput-related X11 API: since we don't enable XI support
by default we still need to ask for it, and see if we have it after the
backend initialization sequence.
2011-01-21 10:25:44 +00:00
Emmanuele Bassi
c8cc03f8a7 event/x11: Epic clean up
Event translation is now done where it belongs: we don't need a massive
switch in a file with direct access to private structure members.

So long, event_translate(); and thanks for all the fish.
2011-01-21 10:25:44 +00:00
Emmanuele Bassi
c044e44dc7 device/x11: Use similar core for axis translation as XI2 2011-01-21 10:25:44 +00:00
Emmanuele Bassi
c9c6236d37 stage/x11: Do not check a boolean for equality
Booleans should only be used like direct conditions, never as
comparisons with TRUE or FALSE.
2011-01-21 10:25:44 +00:00
Emmanuele Bassi
ee15d0d2d0 Add copyright and licensing blurbs 2011-01-21 10:25:44 +00:00
Emmanuele Bassi
2cb0077f7d device/xi2: Implement get_core_device()
We ask XI2 to get the client pointer for CLUTTER_POINTER_DEVICE, and
we use the attached keyboard device for CLUTTER_KEYBOARD_DEVICE. For
everything else, we return NULL.
2011-01-21 10:25:44 +00:00
Emmanuele Bassi
9c48486d7a device/xi2: Remove the ::remove implementation
Removing a device is only internal API, and we already have a function
for that: we don't need to implement the DeviceManager virtual as well.
2011-01-21 10:25:44 +00:00
Emmanuele Bassi
0075c45ca4 device/xi2: Blow the cached devices list
Every time we add or remove a device we should clear the cached list
that we return in get_devices(), so that it gets repopulated.
2011-01-21 10:25:44 +00:00
Emmanuele Bassi
de93f721c1 Clean up the copyright and licensing blurbs 2011-01-21 10:25:43 +00:00
Emmanuele Bassi
7c25b063aa x11: Use XI2 API only if we support it
XIQueryVersion() is XI2 API.
2011-01-21 10:25:43 +00:00
Emmanuele Bassi
caf359d8c9 input-device: Add documentation 2011-01-21 10:25:43 +00:00
Emmanuele Bassi
342cdd2575 input-device: Move select_stage_events() to a vfunc
Don't use a signal, use a virtual function.
2011-01-21 10:25:43 +00:00
Emmanuele Bassi
2777c52f27 input-device: Make ClutterInputDeviceClass private
We keep the symbol in the public header, but the definition is now
private. You could not sub-class InputDevice anyway, without the
instance structure, and the lack of padding in the class made actually
implementing devices in backends really hard.
2011-01-21 10:25:43 +00:00
Emmanuele Bassi
1b1e77b469 event/x11: Rework the way we translate X11 events
This is a lump commit that is fairly difficult to break down without
either breaking bisecting or breaking the test cases.

The new design for handling X11 event translation works this way:

  - ClutterBackend::translate_event() has been added as the central
    point used by a ClutterBackend implementation to translate a
    native event into a ClutterEvent;

  - ClutterEventTranslator is a private interface that should be
    implemented by backend-specific objects, like stage
    implementations and ClutterDeviceManager sub-classes, and
    allows dealing with class-specific event translation;

  - ClutterStageX11 implements EventTranslator, and deals with the
    stage-relative X11 events coming from the X11 event source;

  - ClutterStageGLX overrides EventTranslator, in order to
    deal with the INTEL_GLX_swap_event extension, and it chains up
    to the X11 default implementation;

  - ClutterDeviceManagerX11 has been split into two separate classes,
    one that deals with core and (optionally) XI1 events, and the
    other that deals with XI2 events; the selection is done at run-time,
    since the core+XI1 and XI2 mechanisms are mutually exclusive.

All the other backends we officially support still use their own
custom event source and translation function, but the end goal is to
migrate them to the translate_event() virtual function, and have the
event source be a shared part of Clutter core.
2011-01-21 10:25:43 +00:00
Emmanuele Bassi
ca092477c2 Appease the gods in introspection
Reduce the amount of bogus warnings g-ir-scanner prints out.
2011-01-20 16:35:26 +00:00
Emmanuele Bassi
ef78104227 Expose deprecated symbols whilst building Clutter
Don't use ugly "#undef CLUTTER_DISABLE_DEPRECATED" inside source code
using deprecated symbols; we have the handy CLUTTER_COMPILATION define
that we can use as part of the "disable deprecated" conditional.
2011-01-20 13:29:37 +00:00
Emmanuele Bassi
cd96e631f1 glx: Deprecate ClutterGLXTexturePixmap
Since 1.4 the ClutterGLXTexturePixmap is just a wrapper around
ClutterX11TexturePixmap, so we can safely deprecate it. All the
functionality it provided is now effectively available from the
superclass or directly from Cogl.
2011-01-20 13:21:50 +00:00
Emmanuele Bassi
94b905b9e1 build: Generate an instealled config header
Clutter has some platform-specific API that is accessible only if the
right backend has been compiled in. Third party applications that wish
to be portable across backends might want to use defines and other
pre-processor tricks to determine header inclusion and API usage.

While Clutter has an internal set of symbols it can use, third party
applications don't have the luxury of being able to access the config.h
generated by Clutter's configure script.

For this reason, Clutter should install a configuration header with a
series of namespaced defines that can be picked up by applications and
other third party code.
2011-01-19 14:33:27 +00:00
Chris Lord
bb41cb54cb timeline: Check if the timeline is playing in do_tick
Check that the timeline is still playing before executing in
_clutter_timeline_do_tick. This fixes the possibility of receiving a
new-frame signal when stopping a timeline in response to a different
timeline's signal emission.
2011-01-18 16:23:50 +00:00
Lucas Rocha
c61e22d067 drag-action: fix case where motion events are indefinitely disabled
When drag threshold is not reached, emit_drag_begin() is not called
causing default value of priv->motion_events_enabled (false) to used to
restore motion events enabled state in Clutter. This causes drag action
to indefinitely disable motion events. The current value of motion
events enabled state is now queried on button press which guarantees
that the state will be restored with the correct value in
emit_drag_end()

http://bugzilla.clutter-project.org/show_bug.cgi?id=2522
2011-01-18 14:48:14 +00:00
Emmanuele Bassi
cecc7a4bfb stage: Fix gtk-doc annotation for set_accept_focus() 2011-01-18 14:46:02 +00:00
Bastian Winkler
5d8b6aa6fa introspection: Add missing (out) annotations for get_color()
Some actors are missing the (out) annotations for the get_color()
methods.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2518
2011-01-17 17:31:59 +00:00
Lucas Rocha
6af7b76cb5 click-action: add API to get modifier type
This is to allow implementing modified click such as ctrl+click,
shift+click, and so on.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2520
2011-01-17 17:31:46 +00:00
Damien Lespiau
6100aee5bd color: Mark the new static color API as being new from 1.6
The patch was written a while ago but only merged in the 1.5.x cycle.
2011-01-17 15:22:48 +00:00
Neil Roberts
ae9781e526 cogl-program: Don't use separate definitions on GLES 1.1
Previously most of the code for cogl-program and cogl-shader was
ifdef'd out for GLES 1.1 and alternate stub definitions were
defined. This patch removes those and instead puts #ifdef's directly
in the functions that need it. This should make it a little bit easier
to maintain.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2516
2011-01-17 12:56:58 +00:00
Neil Roberts
b7677d047d cogl-pipeline-opengl: #ifdef out set_glsl_program for GLES 1.1
glUseProgram is not available under GLES 1.1 so it was breaking the
build.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2516
2011-01-17 12:38:46 +00:00
Neil Roberts
568d32acf3 cogl-pipeline: Fix the enum names for the constant combine source
When determining whether to hash the combine constant Cogl checks the
arguments to the combine funcs to determine whether the combine
constant is used. However is was using the GLenums GL_CONSTANT_COLOR
and GL_CONSTANT_ALPHA but these are not valid values for the
CoglPipelineCombineSource enum so presumably the constant would never
get hashed. This patch makes it use Cogl's enum of
COGL_PIPELINE_COMBINE_SOURCE_CONSTANT instead.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2516
2011-01-17 12:38:46 +00:00
Adel Gadllah
0c070cdf91 ClutterX11TexturePixmap: Fix doc comment
The wrong signal name was used probably a copy & paste
mistake, fix that.
2011-01-17 12:21:22 +00:00
Neil Roberts
88fe56d175 cogl-buffer: Support mapping buffers for write on GLES
GLES has an extension called GL_OES_mapbuffer to support mapping
buffer objects but only for writing. Cogl now has two new feature
flags to advertise whether mapping for reading and writing is
supported. Under OpenGL, these features are always set if the VBO
extension is advertised and under GLES only the write flag is set if
the GL_OES_mapbuffer extension is advertised.
2011-01-13 16:36:45 +00:00
Neil Roberts
7e73f0d423 cogl: Enable the VBOs feature for GLES2
The GLES2 wrapper code has been removed so there are no longer any
problems with enabling VBOs.
2011-01-13 16:36:45 +00:00
Neil Roberts
9bb74988d5 cogl: Fallback to set_data when mapping a buffer to fill it
In the journal code and when generating the stroke path the vertices
are generated on the fly and stored in a CoglBuffer using
cogl_buffer_map. However cogl_buffer_map is allowed to fail but it
wasn't checking for a NULL return value. In particular on GLES it will
always fail because glMapBuffer is only provided by an extension. This
adds a new pair of internal functions called
_cogl_buffer_{un,}map_for_fill_or_fallback which wrap
cogl_buffer_map. If the map fails then it will instead return a
pointer into a GByteArray attached to the context. When the buffer is
unmapped the array is copied into the buffer using
cogl_buffer_set_data.
2011-01-13 16:36:32 +00:00
Neil Roberts
77a486caf2 cogl-context: Don't enable point sprites on GLES2
On GLES2 there's no builtin mechanism to replace texture coordinates
with point sprite coordinates so calling glEnable(GL_POINT_SPRITE)
isn't valid. Instead the point sprite coords are implemented by using
a special builtin varying variable in GLSL.
2011-01-13 14:26:03 +00:00
Robert Bragg
88a085fdd8 pipeline: differentiate texture target and data state
There are several places where we need to compare the texture state of a
pipeline and sometimes we need to take into consideration if the
underlying texture has changed but other times we may only care to know
if the texture target has changed.

For example the fragends typically generate programs that they want to
share with all pipelines with equivalent fragment processing state, and
in this case when comparing pipelines we only care about the texture
targets since changes to the underlying texture won't affect the
programs generated.

Prior to this we had tried to handle this by passing around some special
flags to various functions that evaluate pipeline state to say when we
do/don't care about the texture data, but this wasn't working in all
cases and was more awkward to manage than the new approach.

Now we simply have two state bits:
COGL_PIPELINE_LAYER_STATE_TEXTURE_TARGET and
COGL_PIPELINE_LAYER_STATE_TEXTURE_DATA and CoglPipelineLayer has an
additional target member. Since all the appropriate code takes masks of
these state bits to determine what to evaluate we don't need any extra
magic flags.
2011-01-13 12:23:33 +00:00
Robert Bragg
8ab68d26a5 pipeline: optimize state init if changing property
When notifying that a pipeline property is going to change, then at
times a pipeline will take over being the authority of the corresponding
state group. Some state groups can contain multiple properties and so to
maintain the integrity of all of the properties we have to initialize
all the property values in the new authority. For state groups with only
one property we don't have to initialize anything during the
pre_change_notify() because we can assume the value will be initialized
as part of the change being notified.

This patch optimizes how we handle this initialization of state groups
in a couple of ways; firstly we no longer do anything to initialize
state-groups with only one property, secondly we no longer use
_cogl_pipeline_copy_differences - (we have a new
_cogl_pipeline_init_multi_property_sparse_state() func) so we can avoid
lots calls to handle_automatic_blend_enable() which is sometimes seen
high in sysprof profiles.
2011-01-13 12:23:33 +00:00
Neil Roberts
3c9f72abbf cogl-atlas-texture: Don't disable atlas if can't read texture data
Previously atlasing would be disabled if the GL driver does not
support reading back texture data. This meant that atlasing would not
happen on GLES. However we also require that the driver support FBOs
and the texture data is only read back as a fallback if the FBO
fails. Therefore the atlas should be ok on GLES 2 which has FBO
support in core.
2011-01-13 11:50:09 +00:00
Robert Bragg
676df42c6f pipeline: don't skip flush if skip_gl_color flag differs
We try and bail out of flushing pipeline state asap if we can see the
pipeline has already been flushed and hasn't changed but we weren't
checking to see if the skip_gl_color flag is the same as when it was
last flush too and so we'd sometimes bail out without updating the
glColor correctly.
2011-01-11 14:30:02 +00:00
Neil Roberts
38e527a3cf cogl-vertex-attribute: Optionally avoid applying the legacy state
When an item is added to the journal the current pipeline immediately
gets the legacy state applied to it and the modified pipeline is
logged instead of the original. However the actual drawing from the
journal is done using the vertex attribute API which was also applying
the legacy state. This meant that the legacy state used would be a
combination of the state set when the journal entry was added as well
as the state set when the journal is flushed. To fix this there is now
an extra CoglDrawFlag to avoid applying the legacy state when setting
up the GL state for the vertex attributes. The journal uses this flag
when flushing.
2011-01-11 14:06:09 +00:00
Bastian Winkler
f4fc7284eb script-parser: Also honor properties of type GType
The script parser should also handle GType properties.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2513
2011-01-11 12:37:53 +00:00
Damien Lespiau
f2080f099e shader: Don't notify properties when finalizing shaders
clutter_shader_finalize() was calling clutter_shader_release() which in
turn notifies "compiled". GObject was complaining that we were trying to
_ref() an object that was in _finalize().

 #0  g_log (log_domain=0x3e15c4 "GLib-GObject", log_level=G_LOG_LEVEL_CRITICAL,
     format=0x76c938 "%s: assertion `%s' failed") at gmessages.h:97
 #1  0x0070777d in g_return_if_fail_warning (
     log_domain=0x3e15c4 "GLib-GObject",
     pretty_function=0x3e37a4 "g_object_ref",
     expression=0x3e2a00 "object->ref_count > 0") at gmessages.c:586
 #2  0x003b862b in g_object_ref (_object=0x8567af0) at gobject.c:2615
 #3  0x003bd238 in g_object_notify_by_pspec (object=0x8567af0, pspec=0x87ea2f0)
     at gobject.c:1075
 #4  0x00b6500b in clutter_shader_release (shader=0x8567af0)
     at ./clutter-shader.c:612
 #5  0x00b659b9 in clutter_shader_finalize (object=0x8567af0)
     at ./clutter-shader.c:107

Then, let's split release in two, with an _internal() version that does
not notify "compiled" and use it from dispose (as the object is still
usable after a call to release_internal().

http://bugzilla.clutter-project.org/show_bug.cgi?id=2512
2011-01-11 11:20:16 +00:00
Tomeu Vizoso
3625adb9d8 ClutterListModel: Implement get_n_rows for improved performance
The default implementation in ClutterModel iterates through all
the elements.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2511
2011-01-10 21:22:22 +00:00
Adel Gadllah
850f956d4e ClutterAlignConstraint: Keep pixel aligment
We have to round the values here otherwise we might end up with
misaligned actors.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2508
2011-01-10 18:45:22 +00:00
Neil Roberts
d648de7d14 cogl-journal: Avoid enabling blending if possible
The vertex attribute API assumes that if there is a color array
enabled then we can't determine if the colors are opaque so we have to
enable blending. The journal always uses a color array to avoid
switching color state between rectangles. Since the journal switched
to using vertex attributes this means we effectively always enable
blending from the journal. To fix this there is now a new flag for
_cogl_draw_vertex_attributes to specify that the color array is known
to only contain opaque colors which causes the draw function not to
copy the pipeline. If the pipeline has blending disabled then the
journal passes this flag.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2481
2011-01-10 17:11:42 +00:00
Neil Roberts
159cd6ddc0 cogl-vertex-attribute: Add flags to _cogl_draw_vertex_attributes_array
There is an internal version of cogl_draw_vertex_attributes_array
which previously just bypassed the framebuffer flushing, journal
flushing and pipeline validation so that it could be used to draw the
journal. This patch generalises the function so that it takes a set of
flags to specify which parts to flush. The public version of the
function now just calls the internal version with the flags set to
0. The '_real' version of the function has now been merged into the
internal version of the function because it was only called in one
place. This simplifies the code somewhat. The common code which
flushed the various state has been moved to a separate function. The
indexed versions of the functions have had a similar treatment.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2481
2011-01-10 17:11:41 +00:00
Neil Roberts
0201e5fa97 cogl: Don't assume that CoglBitmaps are allocated to height*rowstride
Cogl no longer has any code that assumes the buffer in a CoglBitmap is
allocated to the full size of height*rowstride. We should comment that
this is the case so that we remember to keep it that way. This is
important for cogl_texture_new_from_data because the application may
have created the data from a sub-region of a larger image and in that
case it's not safe to read the full rowstride of the last row when the
sub region contains the last row of the larger image.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2491
2011-01-10 16:55:01 +00:00
Neil Roberts
e1cbef23f5 cogl-texture-driver-gles: Don't copy the bitmap if alignment matches
When uploading data for GLES we need to deal with cases where the
rowstride is too large to be described only by GL_UNPACK_ALIGNMENT
because there is no GL_UNPACK_ROW_LENGTH. Previously for the
sub-region uploading code it would always copy the bitmap and for the
code to upload the whole image it would copy the bitmap unless the
rowstride == bpp*width. Neither paths took into account that we don't
need to copy if the rowstride is just an alignment of bpp*width. This
moves the bitmap copying code to a separate function that is used by
both upload methods. It only copies the bitmap if the rowstride is not
just an alignment of bpp*width.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2491
2011-01-10 16:55:00 +00:00
Neil Roberts
b3058c097d cogl-util: Add an internal wrapper for the ffs function
The ffs function is defined in C99 so if we want to use it in Cogl we
need to provide a fallback for MSVC. This adds a configure check for
the function and then a fallback using a while loop if it is not
available.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2491
2011-01-10 16:55:00 +00:00
Neil Roberts
91c1602306 cogl-texture: Don't use the source rowstride if we have to copy bitmap
If we have to copy the bitmap to do the premultiplication then we were
previously using the rowstride of the source image as the rowstride
for the new image. This is wasteful if the source image is a subregion
of a larger image which would make it use a large rowstride. If we
have to copy the data anyway we might as well compact it to the
smallest rowstride. This also prevents the copy from reading past the
end of the last row of pixels.

An internal function called _cogl_bitmap_copy has been added to do the
copy. It creates a new bitmap with the smallest possible rowstride
rounded up the nearest multiple of 4 bytes. There may be other places
in Cogl that are currently assuming we can read height*rowstride of
the source buffer so they may want to take advantage of this function
too.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2491
2011-01-10 16:54:58 +00:00
Neil Roberts
c6fbc8c567 cogl-vertex-attribute: Fix the name of the cogl_normal_in attribute
The builtin vertex attribute for the normals was incorrectly checked
for as 'cogl_normal' however it is defined as cogl_normal_in in the
shader boilerplate and for the name generated by CoglVertexBuffer.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2499
2011-01-10 14:29:25 +00:00
Emmanuele Bassi
2c36b81996 container: Do not use Actor as prerequisite
The prerequisite for ClutterContainer in 1.x is GObject, and we cannot
restrict the prerequisites without an ABI break.
2011-01-10 14:03:35 +00:00
nobled
6bb81a542f egl: Fix build for --with-flavour=opengl-egl-xlib
Make sure the EGL backend doesn't forget to include desktop OpenGL headers.
2011-01-06 17:16:51 +00:00
nobled
530bc2aa70 egl: Don't use obsolete API
Fixes a GCC "implicit declaration of function" warning when compiling.
2011-01-06 16:40:58 +00:00
Kristian Høgsberg
8c23766da8 x11: Create the list of all devices correctly
Linked lists are tricky.
2011-01-06 14:28:41 +00:00
Emmanuele Bassi
2fe20ff3c5 osx: Implement the set_accept_focus() vfunc
Like the x11 and win32 backends, the quartz backend should allow setting
the key focus when showing the stage window.
2010-12-30 12:47:00 +00:00
Emmanuele Bassi
9d6a33d0c8 win32: Implement the set_accept_focus() vfunc
Implement the ClutterStageWindow::set_accept_focus() virtual function in
the win32 backend.

If accept_focus is set to be TRUE then we call SetforegroundWindow()
after calling ShowWindow(). This is similar to what GDK does when
dealing with the same situation.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2500
2010-12-30 12:47:00 +00:00
Emmanuele Bassi
497f39e2f4 x11: Implement the set_accept_focus() vfunc
Actually set the InputHint flag and set the input field of the WM_SPEC
hints depending on the value of the accept-focus bitfield.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2500
2010-12-30 12:47:00 +00:00
Emmanuele Bassi
bbede9fef5 stage: Add :accept-focus property and accessors
Allow the developer to set whether the Stage should receive key focus
when mapped. The implementation is fully backend-dependent. The default
value is TRUE because that's what we've been expecting so far.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2500
2010-12-30 12:44:13 +00:00
Emmanuele Bassi
e1cd6f49b2 stage-window: Add set_accept_focus() vfunc
Allow Stage implementations to set whether or not they want to accept
key focus when being shown.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2500
2010-12-30 12:44:13 +00:00
Johan Bilien
601b958ab1 Fixed a crash when destroying the actor of a LEAVE event
When processing a LEAVE event, one might destroy the actor, so the weak
reference device->actor would be NULL.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2502

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-12-30 12:27:26 +00:00
Johan Bilien
c95cc8d477 Only reset the relayout_pending flag when actually doing a relayout
If an actor is (unfortunately) queuing a relayout in relayout, you would
end up with (ClutterActor*)stage->needs_allocation set to TRUE and
stage->relayout_pending set to TRUE. But if then in the same cycle, an
actor calls clutter_actor_get_allocation_box, that will trigger another
(recursive) _clutter_stage_maybe_relayout, which will wrongly reset the
relayout pending to FALSE, while not actually performing a new relayout
because of the re-entrancy protection.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2503
2010-12-30 11:48:51 +00:00
Emmanuele Bassi
b6558c5a18 docs: Fixes for the Cogl API reference 2010-12-22 09:52:35 +00:00
Emmanuele Bassi
605e8d6fb5 text: Only paint cursor if we have key focus
If a Text actor does not have key focus then there's no point in showing
the cursor at all.
2010-12-21 10:50:24 +00:00
Emmanuele Bassi
491bbc226e constraints: Remove signal handlers on dispose
Same as commit 2fa8b3a3ab but done for
AlignConstraint and SnapConstraint as well.
2010-12-18 13:24:54 +00:00
Emmanuele Bassi
2fa8b3a3ab bind-constraint: Remove handlers in dispose
We should remove the signal handlers on the source actor when a
BindConstraint is disposed, to avoid dangling pointers and wrong
invocations.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2493
2010-12-18 13:16:23 +00:00
Emmanuele Bassi
6c244c0549 geometry: Avoid sign issues when interpolating
Width and height in ClutterGeometry are unsigned, and this might lead to
overflow and wrap around issues.
2010-12-17 13:53:28 +00:00
Alexandre Quessy
c3313726f0 Fixed a typo in a doc string
http://bugzilla.clutter-project.org/show_bug.cgi?id=2485
2010-12-17 13:37:05 +00:00
Emmanuele Bassi
c444447cd3 timeline: Rename the reverse property to auto-reverse
Other frameworks expose the same functionality as "auto-reverse",
probably to match the cassette tape player. It actually makes sense
for Clutter to follow suit.
2010-12-17 12:07:52 +00:00
Neil Roberts
faaff03730 clutter-stage: Don't always set the projection and viewport matrix
The stage has a dirty flag to record whenever the viewport and
projection matrices need to be flushed. However after flushing these
the flags were never cleared so it would always redundantly update the
state.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2480
2010-12-14 13:12:29 +00:00
Neil Roberts
f595433942 cogl-pipeline-fragend-arbfp: Generate ARBfp if user vertex shader
The ARBfp fragend was bypassing generating a shader if the pipeline
contains a user program. However it shouldn't do this if the pipeline
only contains a vertex shader. This was breaking
test-cogl-just-vertex-shader.
2010-12-14 13:12:28 +00:00
Emmanuele Bassi
52442414d9 cally: Allow memory management for actions
Adding an action should allow passing a user data pointer, and have a
notification action that gets called when removing the action. This
allows introspection and language bindings to attach custom data to the
action - for instance, the real callable object that should be invoked.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2479
2010-12-14 10:07:32 +00:00
Mike Owens
def14e80cb ClutterText: Only grab keyboard focus if keyboard-interactive.
Previously, ClutterText took keyboard focus on mouse-down, regardless
if it were editable or selectable.  Now it checks these properties,
and behaves like other actors if it can't do anything useful with
the focus.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2462
2010-12-14 09:36:28 +00:00
Neil Roberts
7b985f034f Allow multiple CoglAtlases for textures
Previously Cogl would only ever use one atlas for textures and if it
reached the maximum texture size then all other new textures would get
their own GL texture. This patch makes it so that we create as many
atlases as needed. This should avoid breaking up some batches and it
will be particularly good if we switch to always using multi-texturing
with a default shader that selects between multiple atlases using a
vertex attribute.

Whenever a new atlas is created it is stored in a GSList on the
context. A weak weference is taken on the atlas using
cogl_object_set_user_data so that it can be removed from the list when
the atlas is destroyed. The atlas textures themselves take a reference
to the atlas and this is the only thing that keeps the atlas
alive. This means that once the atlas becomes empty it will
automatically be destroyed.

All of the COGL_NOTEs pertaining to atlases are now prefixed with the
atlas pointer to make it clearer which atlas is changing.
2010-12-13 18:59:41 +00:00
Neil Roberts
d01a707623 cogl-atlas: Convert to be a CoglObject subclass
To implement multiple atlases it will be useful to have ref-counting
on the CoglAtlas so it makes sense to convert it to be a CoglObject.
2010-12-13 18:59:41 +00:00
Neil Roberts
d1ddca4eee cogl-shader-boilerplate: Add the 3D texture extension on GLES2
To use the 3D texture extension on GLES2 it has to be enabled with the
following line in GLSL:

#extension GL_OES_texture_3D : enable
2010-12-13 17:29:14 +00:00
Neil Roberts
bdeb555ae1 cogl2-path: Don't flush the enable flags
All of the drawing needed in _cogl_add_path_to_stencil_buffer is done
with the vertex attribute API so there should be no need to flush the
enable flags to enable the vertex array. This was causing problems on
GLES2 where the vertex array isn't available.
2010-12-13 17:29:14 +00:00
Neil Roberts
7dc4b3c894 Remove the GLES2 wrapper
The GLES2 wrapper is no longer needed because the shader generation is
done within the GLSL fragend and vertend and any functions that are
different for GLES2 are now guarded by #ifdefs.
2010-12-13 17:29:14 +00:00
Neil Roberts
1999bee5d2 cogl-pipeline: Use enums for the layer combine values
Once the GLES2 wrapper is removed then we won't have the GLenums
needed for setting up the layer combine state. This adds Cogl enums
instead which have the same values as the corresponding GLenums. The
enums are:

CoglPipelineCombineFunc
CoglPipelineCombineSource
 and
CoglPipelineCombineOp
2010-12-13 17:29:14 +00:00
Neil Roberts
271acaaae5 cogl: upload matrices with uniforms on GLES2
Once the GLES2 wrapper is removed we won't be able to upload the
matrices with the fixed function API any more. The fixed function API
gives a global state for setting the matrix but if a custom shader
uniform is used for the matrices then the state is per
program. _cogl_matrix_stack_flush_to_gl is called in a few places and
it is assumed the current pipeline doesn't need to be flushed before
it is called. To allow these semantics to continue to work, on GLES2
the matrix flush now just stores a reference to the matrix stack in
the CoglContext. A pre_paint virtual is added to the progend which is
called whenever a pipeline is flushed, even if the same pipeline was
flushed already. This gives the GLSL progend a chance to upload the
matrices to the uniforms. The combined modelview/projection matrix is
only calculated if it is used. The generated programs end up never
using the modelview or projection matrix so it usually only has to
upload the combined matrix. When a matrix stack is flushed a reference
is taked to it by the pipeline progend and the age is stored so that
if the same state is used with the same program again then we don't
need to reupload the uniform.
2010-12-13 17:29:13 +00:00
Neil Roberts
67847260bc cogl-matrix-stack: Add _cogl_matrix_stack_has_identity_flag
This adds an internal function to quickly determine whether the top of
the matrix stack is known to be the identity matrix.
2010-12-13 17:28:52 +00:00
Neil Roberts
016005591d cogl-matrix-stack: Convert to be a CoglObject
We will want to use ref-counting on the CoglMatrixStack so it might as
well be a CoglObject.
2010-12-13 17:28:29 +00:00
Robert Bragg
58a2261387 matrix-stack: Make header style consistent
Cogl doesn't follow the Clutter/GTK+ columnized function prototype style
so this updates cogl-matrix-stack.h to match the other Cogl headers.
2010-12-13 17:28:29 +00:00
Robert Bragg
4976d22940 matrix-stack: Adds a stack age counter
Sometimes it would be useful if we could efficiently track when a matrix
stack has been modified. For example on GLES2 we have to upload the
modelview as a uniform to our glsl programs but because the modelview
state is part of the framebuffer state it becomes a bit more tricky to
know when to re-sync the value of the uniform with the framebuffer
state. This adds an "age" counter to CoglMatrixStack which is
incremented for any operation that effectively modifies the top of the
stack so now we can save the age of the stack inside the pipeline
whenever we update modelview uniform and later compare that with the
stack to determine if it has changed.
2010-12-13 17:28:29 +00:00
Neil Roberts
856d43a27c cogl-pipeline: Add internal API to get the layer matrix
This returns the layer matrix given a pipeline and a layer index. The
API is kept as internal because it directly returns a pointer into the
layer private data to avoid a copy into an out-param. We might also
want to add a public function which does the copy.
2010-12-13 17:28:29 +00:00
Neil Roberts
4514d49dda cogl-vertex-attribute: Use glVertexAttribPointer on GLES2
When the GLES2 wrapper is removed we can't use the fixed function API
such as glColorPointer to set the builtin attributes. Instead the GLSL
progend now maintains a cache of attribute locations that are queried
with glGetAttribLocation. The code that previously maintained a cache
of the enabled texture coord arrays has been modified to also cache
the enabled vertex attributes under GLES2. The vertex attribute API is
now the only place that is using this cache so it has been moved into
cogl-vertex-attribute.c
2010-12-13 17:28:29 +00:00
Neil Roberts
1515a8d73a cogl-path: Stroke using the vertex attribute API
Previously when stroking a path it was flushing a pipeline and then
directly calling glDrawArrays to draw the line strip from the path
nodes array. This patch changes it to build a CoglVertexArray and a
series of attributes to paint with instead. The vertex array and
attributes are attached to the CoglPath so it can be reused later. The
old vertex array for filling has been renamed to fill_vbo.
2010-12-13 17:28:28 +00:00
Neil Roberts
3c5fa0cf90 cogl: Move COGL_DEBUG=show-source into cogl-shader.c
The code to display the source when the show-source debug option is
given has been moved to _cogl_shader_set_source_with_boilerplate so
that it will show both user shaders and generated shaders. It also
shows the code with the full boilerplate. To make it the same for
ARBfp, cogl_shader_compile_real now also dumps user ARBfp shaders.
2010-12-13 17:28:28 +00:00
Neil Roberts
8764a0d487 cogl: Add a vertend to generate GLSL
The GLSL vertend is mostly only useful for GLES2. The fixed function
vertend is kept at higher priority than the GLSL vertend so it is
unlikely to be used in any other circumstances.
2010-12-13 17:28:28 +00:00
Neil Roberts
6c34fb7232 cogl-shader-boilerplate: Don't put the color attrib in location 0
Due to Mesa bug 28585 calling glVertexAttrib with attrib location 0
doesn't appear to work. This patch just reorders the vertex and color
attributes in the shader in the hope that Mesa will assign the color
attribute to a different location.
2010-12-13 17:28:28 +00:00
Neil Roberts
cf0ded1361 cogl-shader-boilerplate: Add more builtins for GLES2
Some builtin attributes such as the matrix uniforms and some varyings
were missing from the boilerplate for GLES2. This also moves the
texture matrix and texture coord attribute declarations to
cogl-shader.c so that they can be dynamically defined depending on the
number of texture coord arrays enabled.
2010-12-13 17:22:57 +00:00
Neil Roberts
17d689f794 cogl-pipeline: Rename the fragment_{source,header}_buffer to codegen
We want to reuse the same buffers for vertends so calling them
fragment_* doesn't make sense.
2010-12-13 17:22:57 +00:00
Neil Roberts
a3e53dd029 cogl: Add a fixed function vertend
The vertends are intended to flush state that would be represented in
a vertex program. Code to handle the layer matrix, lighting and
point size has now been moved from the common cogl-pipeline-opengl
backend to the fixed vertend.
2010-12-13 17:22:57 +00:00
Neil Roberts
313adc7bdf cogl: Add a GLSL 'progend'
'progend' is short for 'program backend'. The progend is intended to
operate on combined state from a fragment backend and a vertex
backend. The progend has an 'end' function which is run whenever the
pipeline is flushed and the two pipeline change notification
functions. All of the progends are run whenever the pipeline is
flushed instead of selecting a single one because it is possible that
multiple progends may be in use for example if the vertends and
fragends are different. The GLSL progend will take the shaders
generated by the fragend and vertend and link them into a single
program. The fragend code has been changed to only generate the shader
and not the program. The idea is that pipelines can share fragment
shader objects even if their vertex state is different. The authority
for the progend needs to be the combined authority on the vertend and
fragend state.
2010-12-13 17:22:57 +00:00
Neil Roberts
1e3cdb60d6 cogl-program: Add private functions to check if have each shader type
This adds two internal functions:

gboolean
_cogl_program_has_fragment_shader (CoglHandle handle);

gboolean
_cogl_program_has_vertex_shader (CoglHandle handle);

They just check whether any of the contained shaders are of that type.
2010-12-13 17:22:57 +00:00