1
0
Fork 0
Commit graph

3428 commits

Author SHA1 Message Date
Roman Kudiyarov
8e2b45648f osx: Fixed problem with freezing application while checking behaviour.
Problem was in incorrect application initialization.
[NSApplication sharedApplication] should be call in backend init(not
in init stage). It doesn't require any data and only makes a
connection to window server.
2010-08-04 15:13:11 +01:00
Roman Kudiyarov
8c69a639cb osx: Fixed bug with creating context twice.
We should assign context and pixel_format vars to null to avoid
multiple context creation.
2010-08-04 15:13:11 +01:00
Roman Kudiyarov
50793eac51 osx: added create_context function in backend
Cleanup clutter_backend_osx_post_parse function and move context
initialization to clutter_backend_osx_create_context. The OpenGL pixel
format attributes were taken as is. Also move bringing application to
foreground in clutter_stage_osx_realize, it seems there is best place
for it.
2010-08-04 15:13:11 +01:00
Roman Kudiyarov
904f619419 osx: Implemented hide cursor backend implementation
Add implementation for hide cursor in stage. Also added using this
feature in test-animator.
2010-08-04 15:13:11 +01:00
Roman Kudiyarov
12e5011488 osx: Added missed function declaration for stage
Added empty functions for cursor and window resize functional with
notes FIXME and also they are added to iface.
2010-08-04 15:13:11 +01:00
Roman Kudiyarov
01c9570d16 osx: Remove drawing call while showing stage and add viewport init
Viewport didn't initialized before OGL drawing and it causes crash on
assert so added viewport initalization to
clutter_stage_osx_realize. Also showing the stage causes drawing
function but other part of the system(in particular conformance tests)
don't expect it and aren't ready at this moment.
2010-08-04 15:13:11 +01:00
Roman Kudiyarov
e3295050f5 osx: Fixed crash while features initialization
Clearing current context couses incorrect work of glGetString function
and all next GL functions that use it work incorrectly.
2010-08-04 15:13:10 +01:00
Emmanuele Bassi
24d1142ecf glx: Add more debugging notes
Should help debug the GLX visual selection.
2010-08-03 17:53:58 +01:00
Emmanuele Bassi
fa54b7c60d docs: Further clarifications
Mention the XFixes extension for compositors using input regions to let
events "pass through" the stage.

Thanks to: Robert Bragg <robert@linux.intel.com>
2010-08-03 16:48:53 +01:00
Emmanuele Bassi
da6b2660ba docs: Clarify the event retrieval disable behaviour
When we disable the event retrieval, we now just disable the X11 event
source, not the event selection. We need to make that clear to
applications, especially compositors, which might expect complete
control over the selection.
2010-08-03 16:30:04 +01:00
Emmanuele Bassi
609560b1cb glx: Unconditionally select X11/GLX events
Currently, we select input events and GLX events conditionally,
depending on whether the user has disabled event retrieval.

We should, instead, unconditionally select input events even with event
retrieval disabled because we need to guarantee that the Clutter
internal state is maintained when calling clutter_x11_handle_event()
without requiring applications or embedding toolkits to select events
themselves. If we did that, we'd have to document the events to be
selected, and also update applications and embedding toolkits each time
we added a new mask, or a new class of events - something that's clearly
not possible.

See:

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

for the rationale of why we did conditional selection. It is now clear
that a compositor should clear out the input region, since it cannot
assume a perfectly clean slate coming from us.

See:

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

for an example of things that break if we do conditional event
selection on GLX events. In that specific case, the X11 server ≤ 1.8
always pushed GLX events on the queue, even without selecting them; this
has been fixed in the X11 server ≥ 1.9, which means that applications
like Mutter or toolkit integration libraries like Clutter-GTK would stop
working on recent Intel drivers providing the GLX_INTEL_swap_event
extension.

This change has been tested with Mutter and Clutter-GTK.
2010-08-03 16:11:52 +01:00
Robert Bragg
10c5cb1800 cogl-program: gles2: bind programs lazily as for GL
This makes the gles2 cogl_program_use consistent with the GL version by
not binding the program immediately and instead leaving it to
cogl-material.c to bind the program when actually drawing something.
2010-08-03 15:00:07 +01:00
Robert Bragg
4a9321b60c gles2: Have CoglProgram track uniforms per program
Previously custom uniforms were tracked in _CoglGles2Wrapper but as part
of a process to consolidate the gl/gles2 shader code it seems to make
sense for this state to be tracked in the CoglProgram object instead.

http://bugzilla.o-hand.com/show_bug.cgi?id=2179
2010-08-03 15:00:04 +01:00
Robert Bragg
c26f4ffa22 cogl-shader: unifies the driver/{gl,gles} shader files
The per driver implementations of cogl-shader.c had become almost
identical we now have a single cogl/cogl-shader.c instead.
2010-08-03 12:41:37 +01:00
Robert Bragg
8021d3e2eb cogl-shader: Store the CoglShaderType in CoglShader
Instead of having to query GL and translate the GL enum into a
CoglShaderType each time cogl_shader_get_type is called we now keep
track of the type in CoglShader.
2010-08-03 12:41:34 +01:00
Robert Bragg
467c33a3e3 cogl: don't include cogl-debug.h in cogl.h or install
cogl-debug.h is an internal header so it shouldn't have been included by
cogl.h and the header shouldn't be installed either.
2010-08-02 17:41:42 +01:00
Emmanuele Bassi
c23b283968 animatable: Allow passing a NULL animation
The Animatable interface was created specifically for the Animation
class. It turns out that it might be fairly useful to others - such as
ClutterAnimator and ClutterState.

The newly-added API in this cycle for querying and accessing custom
properties should not require that we pass a ClutterAnimation to the
implementations: the Animatable itself should be enough.

This is necessary to allow language bindings to wrap
clutter_actor_animate() correctly and do type validation and
demarshalling between native values and GValues; an Animation instance
is not available until the animate() call returns, and validation must
be performed before that happens.

There is nothing we can do about the animate_property() virtual
function - but in that case we might want to be able to access the
animation from an Animatable implementation to get the Interval for
the property, just like ClutterActor does in order to animate
ClutterActorMeta objects.
2010-07-31 10:56:09 +01:00
Emmanuele Bassi
c65c0f08d8 docs: Fix the BindConstraint example
A constraint was created but not added to the actor.
2010-07-31 10:39:53 +01:00
Emmanuele Bassi
a20a509584 x11: Split out conditions and warnings
XGetGeometry is a great piece of API, since it gets a lot of stuff that
are moderately *not* geometry related - the root window, and the depth
being two.

Since we have multiple conditions depending on the result of that call
we should split them up depending on the actual error - and each of them
should have a separate error message. This makes debugging simpler.
2010-07-29 17:18:25 +01:00
Emmanuele Bassi
0736cb7323 actor: Make set_flags() safe from unrefs
It's possible - though not recommended - that user code causes the
destruction of an actor in one of the notification handlers for
flag-based properties. We should protect the multiple notification
emission with g_object_ref/unref.
2010-07-29 17:00:24 +01:00
Øyvind Kolås
3d806f498f effect: fix conversion from degrees to radians 2010-07-23 12:16:37 +01:00
Neil Roberts
ec26466cdc gles/cogl-shader.c: Store the shader type in CoglShader
Nothing was storing the shader type when a shader was created so it
would get confused about whether it was a custom vertex or fragment
shader.

Also the 'type' member of CoglShader was a GLenum but the only place
that read it was treating it as if it was CoglShaderType. This changes
it be CoglShaderType.
2010-07-22 22:22:23 +01:00
Neil Roberts
a639ed6593 Plug the leaking CoglProgram and CoglShader
_cogl_program_free and _cogl_shader_free never freed the struct their
structs so it would end up leaking a little bit.
2010-07-22 21:51:43 +01:00
Neil Roberts
488e376b7e cogl-bitmap-pixbuf: Avoid copying the buffer in more circumstances
When loading an RGB image GdkPixbuf will pad the rowstride so that the
beginning of each row is aligned to 4 bytes. This was causing us to
fallback to the code that copies the buffer. It is probably safe to
avoid copying the buffer if we can detect that the rowstride is simply
an alignment of the packed rowstride.

This also changes the copying fallback code so that it uses the
aligned rowstride. However it is now extremely unlikely that the
fallback code would ever be used.
2010-07-22 20:13:37 +01:00
Neil Roberts
b9295bf0e5 cogl-bitmap-pixbuf: Fix the rowstride used when copying a GdkPixbuf
In commit b780413e5a the GdkPixbuf loading code was changed so that
if it needs to copy the pixbuf then it would tightly pack it. However
it was still using the rowstride from the pixbuf so the image would
end up skewed. This fixes it to use the real rowstride.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2235
2010-07-22 20:13:15 +01:00
Neil Roberts
bb1b1b151e cogl-material: Don't map the shininess value to [0,1]
In OpenGL the 'shininess' lighting parameter is floating point value
limited to the range 0.0→128.0. This number is used to affect the size
of the specular highlight. Cogl materials used to only accept a number
between 0.0 and 1.0 which then gets multiplied by 128.0 before sending
to GL. I think the assumption was that this is just a weird GL quirk
so we don't expose it. However the value is used as an exponent to
raise the attenuation to a power so there is no conceptual limit to
the value.

This removes the mapping and changes some of the documentation.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2222
2010-07-22 17:52:51 +01:00
Neil Roberts
d76d82c88f cogl-material: Always reset the GLSL program to zero when flushing
When flushing a fixed-function or arbfp material it would always call
disable_glsl to try to get rid of the previous GLSL shader. This is
needed even if current_use_program_type is not GLSL because if an
application calls cogl_program_uniform then Cogl will have to bind the
program to set the uniform. If this happens then it won't update
current_use_program_type presumably because the enabled state of arbfp
is still valid.

The problem was that disable_glsl would only select program zero when
the current_use_program_type is set to GLSL which wouldn't be the case
if cogl_program_uniform was called. This patch changes it to just
directly call _cogl_gl_use_program_wrapper(0) instead of having a
separate disable_glsl function. The current program is cached in the
cogl context anyway so it shouldn't cause any extra unnecessary GL
calls.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2232
2010-07-22 17:50:56 +01:00
Chris Kühl
24b9748f0a Fixed more set using *_get_* typos.
http://bugzilla.clutter-project.org/show_bug.cgi?id=2233
2010-07-22 11:03:04 +01:00
Emmanuele Bassi
99d7d31318 docs: Improve the text of X11 event-related functions
We need to make sure that people disabling event handling in Clutter
call clutter_x11_handle_event() to update Clutter's internal state.
2010-07-22 10:48:21 +01:00
Neil Roberts
1dee65770a Minor fix to the documentation for clutter_texture_get_sync_size
The documentation was recursively referring to itself causing a stack
overflow in the reader's brain.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2233
2010-07-22 10:06:26 +01:00
Emmanuele Bassi
eae4561929 Clean up the private flags for ClutterActor
Provide macros to quickly query a flag, and remove all namespacing
except the initial 'CLUTTER'.
2010-07-21 16:10:46 +01:00
Emmanuele Bassi
0dfbf010b8 x11: Add more checks to set_stage_foreign()
Check all the pre-requisites to avoid segfaults later on.
2010-07-21 15:21:08 +01:00
Emmanuele Bassi
8538e1bf58 x11: Clean up TexturePixmap header and private data structure
Align the header file and use bitfields instead of booleans.
2010-07-21 15:14:36 +01:00
Neil Roberts
0e80747a68 cogl-material: Consider the shader when deciding if materials equate
_cogl_material_equal was ignoring the user shader state so rectangles
with different shaders would get batched together.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2220
2010-07-20 17:21:12 +01:00
Emmanuele Bassi
f2d0f0ab5f stage: Ignore redraws on destroyed stages
We might get requests to redraw even during destruction; we should
ignore them and do some NULL checks instead of blindly invoking
functions.
2010-07-20 14:39:43 +01:00
Emmanuele Bassi
7b6b2ea55b stage-window: Add argument guards
Validate the arguments passed to StageWindow's methods.
2010-07-20 14:39:01 +01:00
Neil Roberts
76d8119a7f cogl-material-arbfp: Use separate buffers when calling g_ascii_dtostr
g_ascii_dtostr was being used in four separate arguments to
g_string_append_printf but all invocations of it were using the same
buffer. This would end up with all of the arguments having the same
value which would depend on whichever order the compiler evaluates
them in. This patches changes it to use a multi-dimensional array and
a loop to fill in the separate buffers.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2219
2010-07-18 11:01:05 +01:00
Emmanuele Bassi
6983429e4a material-arbfp: Use locale-independent double to string conversion
The ARBfp programs are created with a printf() wrapper, which usually
fails in non-en locales as soon as you start throwing things like
floating point values in the mix.

We should use the g_ascii_dtostr() function which places a double into a
string buffer in a locale-independent way.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2219
2010-07-16 23:40:34 +01:00
Neil Roberts
6ea2fbc729 Add an internal _cogl_bitmap_new_from_buffer
This function creates a CoglBitmap which internally references a
CoglBuffer. The map and unmap functions will divert to mapping the
buffer. There are also now bind and unbind functions which should be
used instead of map and unmap whenever the data doesn't need to be
read from the CPU but will instead be passed to GL for packing or
unpacking. For bitmaps created from buffers this just binds the
bitmap.

cogl_texture_new_from_buffer now just uses this function to wrap the
buffer in a bitmap rather than trying to bind the buffer
immediately. This means that the buffer will be bound only at the
point right before the texture data is uploaded.

This approach means that using a pixel array will take the fastest
upload route if possible, but can still fallback to copying the data
by mapping the buffer if some conversion is needed. Previously it
would just crash in this case because the texture functions were all
passed a NULL pointer.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2112
2010-07-15 17:27:15 +01:00
Neil Roberts
7eb0d01f9f Add a Cogl debug flag for BITMAP
CoglBitmap will soon want to report notes as it gets more complicated
so this adds a debug flag for it.
2010-07-15 17:27:15 +01:00
Neil Roberts
b780413e5a Try to avoid copying the GdkPixbuf when it is tightly packed
The docs for GdkPixbuf say that the last row of the image won't
necessarily be allocated to the size of the full rowstride. The rest
of Cogl and possibly GL assumes that we can copy the bitmap with
memcpy(height*rowstride) so we previously would copy the pixbuf data
to ensure this. However if the rowstride is the same as bpp*width then
there is no way for the last row to be under-allocated so in this case
we can just directly upload from the gdk pixbuf. Now that CoglBitmap
can be created with a destroy function we can make it keep a reference
to the pixbuf and unref it during its destroy callback. GdkPixbuf
seems to always pack the image with no padding between rows even if it
is RGB so this should end up always avoiding the memcpy.

The fallback code for when we do have to copy the pixbuf is now
simplified so that it copies all of the rows in a single loop. We only
copy the useful region of each row so this should be safe. The
rowstride of the CoglBitmap is now always allocated to bpp*width
regardless of the rowstride of the pixbuf.
2010-07-15 17:25:36 +01:00
Neil Roberts
fc12c42a83 cogl-bitmap: Encapsulate the CoglBitmap even internally
The CoglBitmap struct is now only defined within cogl-bitmap.c so that
all of its members can now only be accessed with accessor
functions. To get to the data pointer for the bitmap image you must
first call _cogl_bitmap_map and later call _cogl_bitmap_unmap. The map
function takes the same arguments as cogl_pixel_array_map so that
eventually we can make a bitmap optionally internally divert to a
pixel array.

There is a _cogl_bitmap_new_from_data function which constructs a new
bitmap object and takes ownership of the data pointer. The function
gets passed a destroy callback which gets called when the bitmap is
freed. This is similar to how gdk_pixbuf_new_from_data
works. Alternatively NULL can be passed for the destroy function which
means that the caller will manage the life of the pointer (but must
guarantee that it stays alive at least until the bitmap is
freed). This mechanism is used instead of the old approach of creating
a CoglBitmap struct on the stack and manually filling in the
members. It could also later be used to create a CoglBitmap that owns
a GdkPixbuf ref so that we don't necessarily have to copy the
GdkPixbuf data when converting to a bitmap.

There is also _cogl_bitmap_new_shared. This creates a bitmap using a
reference to another CoglBitmap for the data. This is a bit of a hack
but it is needed by the atlas texture backend which wants to divert
the set_region virtual to another texture but it needs to override the
format of the bitmap to ignore the premult flag.
2010-07-15 17:24:01 +01:00
Neil Roberts
fd886d9fc2 cogl-texture-2d-sliced: Store the internal format not image format
The 'format' member of CoglTexture2DSliced is returned by
cogl_texture_get_format. All of the other backends return the internal
format of the GL texture in this case. However the sliced backend was
returning the format of the image data used to create the texture. It
doesn't make any sense to retain this information because it doesn't
necessarily indicate the format of the actual texture. This patch
changes it to store the internal format instead.
2010-07-15 14:31:23 +01:00
Emmanuele Bassi
fd27ca7398 Mark property strings for translation
Both the nick and the blurb fields should be translatable, for UI
builders and other introspection-based tools.
2010-07-15 14:07:07 +01:00
Emmanuele Bassi
8be43b5285 Add P_() macro for translating property strings
The P_() macro adds a context for the property nick and blurb. In order
to make xgettext recognize it, we need to drop glib-gettexize inside the
autogen.sh script and ship a modified Makefile.in.in with Clutter.
2010-07-15 12:09:01 +01:00
Nate Stedman
fff5558ad2 Fixes build with GLX on Mac OS X.
Moves preprocessor #ifdef __linux_ above else statement, avoiding the
lack of an else block if __linux__ is not defined.

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-07-15 00:31:23 +01:00
Emmanuele Bassi
e7ae71e072 build: Fix include path for Cally's introspection
The introspection scanner does not include '.' by default, so it was
always using the installed copy of Clutter-1.0.gir. Which obviously
wouldn't work if we didn't have one.
2010-07-15 00:27:43 +01:00
Neil Roberts
54b2e1781e gles/cogl-texture-driver.c: Fix the include for cogl-material-private
In ddb9016be4 the GL texture driver backend was changed to include
cogl-material-opengl-private.h instead of cogl-material-private.h.
However the gles texture backend was missed from this so it was giving
a compiler warning about using an undeclared function.
2010-07-14 17:49:16 +01:00
Neil Roberts
ccdcbbb46b cogl-texture-3d: Use glTexSubImage3D through an indirect pointer
glTexSubImage3D was being called directly in cogl-texture-3d.c but the
function is only available since GL version 1.2 so on Windows it won't
be possible to directly link to it. Also under GLES it is only
available conditionally in an extension.
2010-07-14 17:45:15 +01:00
Neil Roberts
943266db3b cogl-texture-3d: Fix the cogl-material-private header include
In ddb9016be4 the texture backends were changed to include
cogl-material-opengl-private.h instead of cogl-material-private.h.
However the 3D texture backend was missed from this so it was giving a
compiler warning about using an undeclared function.
2010-07-14 16:35:33 +01:00