1
0
Fork 0
Commit graph

3269 commits

Author SHA1 Message Date
Neil Roberts
fae4d60106 cogl: Pull in the code for GLU tesselator from Mesa/SGI
This copies the files for the GLU tesselator from Mesa. The Mesa code
is based on the original SGI code and is released under a BSD license.

The memalloc.h header has been replaced with one that forces the code
to use g_malloc and friends. The rest of the files are not altered
from the original so it should be possible to later upgrade the files
by simply overwriting them.

There is a tesselator.h header which is expected to be included by
rest of Cogl to use the tesselator. This contains a trimmed down
version of glu.h that only includes parts that pertain to the
tesselator. There is also a stub glu.h in the GL directory which is
just provided so that the tesselator code can include <GL/gl.h>
without depending on the system header. It just redirects to
tesselator.h
2010-06-29 20:37:13 +01:00
Chris Lord
8801c947d5 event: Typos in event code could cause crashes
A typo in clutter-event.c meant that the wrong struct location could be
used for the input device of key events. Also, a typo in the X11 event
code meant that key-presses would come from the pointer device (releases
would still come from the keyboard device).
2010-06-29 15:42:59 +01:00
Emmanuele Bassi
32ad63efef bind-constraint: Add width and height binding
Allow using the BindConstraint to bind width and height of a source
actor.

Also, add a test for the BindConstraint showing all types of usages
for this constraint class.
2010-06-28 18:06:23 +01:00
Neil Roberts
b3ffe602a2 cogl: Add const to some pointer arguments
Some of the arguments to the material and path functions were taking a
pointer to a CoglColor or an array of floats that was not intended to
be written to but were not marked with const.
2010-06-28 15:25:19 +01:00
Emmanuele Bassi
a20def9df6 text: Use the ::settings-changed signal
Instead of the ::font-changed one.
2010-06-28 10:43:13 +01:00
Emmanuele Bassi
c81ef75942 x11: Add XSETTINGS watcher
If we want to be able to get live notification of system settings
changes, we need watch the window that the XSETTINGS client conjures
up for us.
2010-06-28 10:32:54 +01:00
Emmanuele Bassi
31fc8e9664 text: Document and annotate :font-name for NULL values
Update the documentation of :font-name, to make it clear that by setting
it to NULL the Text actor will use the default font.

Also, set the annotation for the @font_name argument of the setter to be
allow-none, and allow passing NULL through bindings.
2010-06-26 23:05:36 +01:00
Emmanuele Bassi
809211588d text: Update actors using the default font
If a ClutterText actor is using the default font from the backend then
we should track font name changes and update it accordingly. This only
applies to ClutterText actors with the :font-name property unset or
explicitly set to NULL.
2010-06-26 15:49:15 +01:00
Emmanuele Bassi
26fb096095 settings: Emit Backend::font-changed
When the :font-name property changes, to maintain the invariant.
2010-06-26 13:51:06 +01:00
Emmanuele Bassi
2e4e321dad Detail the font-name value in the font settings debug note 2010-06-25 11:44:53 +01:00
Neil Roberts
527ad961ab clutter-event-win32: Emit multiple events for WM_MOUSEWHEEL Messages
It's possible that a single WM_MOUSEWHEEL event can arrive with a
scroll amount greater than WHEEL_DELTA. Previously it would accumulate
these amounts but it would still only emit a single event per
message. For example, if a message arrived that is worth two
WHEEL_DELTAs then it would emit one event and leave scroll_pos as
+WHEEL_DELTA. If the wheel is then scrolled in the opposite direction
then wheel delta would end up as zero and the scroll event would get
lost.

This patch fixes it so that it always emits enough events to put
scroll_pos back to less than WHEEL_DELTA.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2135
2010-06-25 11:29:07 +01:00
Neil Roberts
2c8d73f047 clutter-event-win32: Directly enqueue events in message_translate
Previously the window procedure for the stage window would always
create a ClutterEvent struct for every message and then pass that on
to message_translate to fill in the details. message_translate could
return FALSE to abandon the event. Instead of this, message_translate
now creates and queues the event itself whenever it sees a message
that could translate to an event. The function now returns void. This
has a number of advantages:

* It saves redundantly allocating events for messages that Clutter
  doesn't care about.

* A single message can now easily be translated into multiple events.

* There were some messages that were handled and did not fill in the
  event struct but did not cause the function to return FALSE. I think
  this would end up with a CLUTTER_NOTHING event being emitted.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2135
2010-06-25 11:29:07 +01:00
Øyvind Kolås
b4607f7a37 state: avoid g_str_equal if a string might be NULL 2010-06-25 02:06:31 +01:00
Emmanuele Bassi
a950388bc6 actor: Top-levels should always report a 255 opacity
The paint opacity should always assume a fully opaque top-level at the
end, otherwise the scene would be rendered fully transparent.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2050
2010-06-24 17:26:01 +01:00
Emmanuele Bassi
42df1a150b actor: Ignore the NOP paint at 0 opacity for top-levels
A top-level actor could still have 0 opacity (e.g. a Stage with the
:use-alpha property set to TRUE), but we want its children to still
be painted.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2050
2010-06-24 17:26:01 +01:00
Robert Bragg
1b15397120 material: Avoid possibly reading invalid memory
in _cogl_material_prune_empty_layer_difference we sometimes unref the
given layer before dereferencing it to get a pointer to its parent. This
defers the unref until after we have fetched the parent pointer.
2010-06-24 17:05:26 +01:00
Øyvind Kolås
1ad7eb969c state: added more documentation 2010-06-24 16:52:48 +01:00
Øyvind Kolås
2a29cd2aee state: removed special handling of state named "default"
The "default" state used for unspecified source transitions is NULL.
Small update and some other fixes to documentation.
2010-06-24 15:49:01 +01:00
Alejandro Piñeiro
d37dee8258 Improve clutter_text_get_chars doc
Explicitly explain that end_pos is not included with the resulting
string

http://bugzilla.clutter-project.org/show_bug.cgi?id=2081
2010-06-24 14:25:11 +01:00
Elliot Smith
213cd30ceb docs: Fix example code in BindingPool
The code sample in the gtk-doc annotations for ClutterBindingPool shows
the arguments in the wrong order.

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-06-24 11:23:50 +01:00
Neil Roberts
d17ea2c021 cogl: Remove cogl-defines.h.in from the driver make files
Commit 7fae8ac051 changed cogl-defines.h.in so there is only a
single copy in clutter/cogl/ instead of one for each driver. However
the old files were still mentioned in the EXTRA_DIST of the
Makefile.am so make distcheck was failing.
2010-06-23 17:44:09 +01:00
Chris Lord
97e39228c5 cogl-path: Disable texture coord arrays before drawing
It was possible that the texture co-ord arrays were left enabled during
stroking, which could possibly cause a crash.
2010-06-23 16:07:00 +01:00
Neil Roberts
8512423f22 clutter-animation: Fix for using fixed:: from clutter_actor_animatev
When using clutter_actor_animatev it would set a boolean whenever a
property begins with "fixed::". However it would never clear the
variable so it would end up marking all subsequent properties as
fixed.

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

http://bugzilla.clutter-project.org/show_bug.cgi?id=2149
2010-06-23 15:55:46 +01:00
Robert Bragg
f423d794cc texture-pixmap-x11: don't assume anything about the GLXFBConfig type
A pedantic change to get_fbconfig_for_depth() so that we don't need to
make any assumptions about the GLXFBConfig typedef or what values
we can overload to indicate an invalid config.

get_fbconfig_for_depth() now simply returns FALSE if it fails to find a
config.
2010-06-22 16:53:59 +01:00
Emmanuele Bassi
62c08b4a09 drag-action: Disable picking during drag
While dragging we don't need to perform picking to determine the actor
underneath the pointer, for two reasons:

  • we use a capture on the stage to determine the motion delta.
  • we know the actor underneath the pointer because that's the
    actor we are dragging around.

This change should make dragging actors in complex scenes a bit faster.
2010-06-22 16:12:53 +01:00
Emmanuele Bassi
d89270d7c1 Silence another compiler warning 2010-06-22 14:43:36 +01:00
Neil Roberts
db47e90829 cogl-texture-pixmap-x11: Use NULL instead of None for invalid GLXFBConfig
GLXFBConfigs are opaque pointers not XIDs so it doesn't make sense to
return None from get_fbconfig_for_depth. Instead it now returns NULL.
2010-06-22 14:19:59 +01:00
Emmanuele Bassi
b2c87eaddf Silence some compiler warnings 2010-06-22 13:48:53 +01:00
Emmanuele Bassi
3734408962 Use -Bsymbolic-functions
The -Bsymbolic-functions linker flag allows to avoid intra-library
PLT jumps on ELF platforms. It is similar to the aliasing hack in
GLib and GTK+, but definitely less messy.

The configure script should look for the flags, in order to support
platforms/linkers that do not have it.
2010-06-22 13:32:11 +01:00
Neil Roberts
5d860a9978 clutter-{glx,x11}-texture-pixmap: Use CoglTexturePixmapX11
The pixmap handling of both of the texture pixmap actors in Clutter is
now removed and instead it just creates a CoglTexturePixmapX11. Both
actors are now equivalent so there is no need to choose between the
two.
2010-06-22 12:22:48 +01:00
Neil Roberts
a197baa533 Add a CoglTexturePixmapX11 texture backend
This is a publicly exposed texture backend to create a texture which
contains the contents of an X11 pixmap. The API is currently marked as
experimental.

The backend internally holds a handle to another texture. All of the
backend virtuals simply redirect to the internal texture.

The texture can optionally be automatically updated if the
automatic_updates parameter is TRUE. If set then Cogl will listen for
damage events on the pixmap and update the texture accordingly.
Alternatively a damage object can be created externally and passed
down to Cogl.

The updates can be performed with XGetImage, XShmGetImage or the
GLX_EXT_texture_pixmap extension. If the TFP extension is used it will
optionally try to create a rectangle texture if the driver does not
support NPOTs or it is forced through the
COGL_PIXMAP_TEXTURE_RECTANGLE or CLUTTER_PIXMAP_TEXTURE_RECTANGLE
environment variables.

If the GLXFBConfig does not support mipmapping then it will fallback
to using X{Shm,}GetImage. It keeps a separate texture around for this
so that it can later start using the TFP texture again if the texture
is later drawn with mipmaps disabled.
2010-06-22 12:22:48 +01:00
Neil Roberts
6ca13e54d8 Add -DCOGL_ENABLE_EXPERIMENTAL_API to Makefiles for Cogl and x11/glx
Cogl and Clutter should be able to use the experimental API so this
adds the required define to the CPPFLAGS in the Makefiles.
2010-06-22 12:22:47 +01:00
Neil Roberts
7fae8ac051 cogl-defines.h: Add a COGL_HAS_X11 define
This will be defined in cogl-defines.h whenever Cogl is built using a
winsys that supports X11. This implies CoglTexturePixmapX11 will be
available.

To make this work the two separate cogl-defines.h.in files have been
merged into one. The configure script now makes a @COGL_DEFINES@
substitution variable which contains the #define lines to put in
rather than directly having them in the seperate files.
2010-06-22 12:22:47 +01:00
Neil Roberts
a01b094630 cogl: Add _cogl_xlib_{,un}trap_errors
This is similar to clutter_x11_{,un}trap_errors except that it stores
the previous trap state in a caller-allocated struct so that it can be
re-entrant.

Make _cogl_xlib_trap_errors re-entrant

(this will be squashed into an earlier commit)
2010-06-22 12:22:47 +01:00
Neil Roberts
3abe26b913 cogl-texture: Avoid premult conversion if the dst format has no alpha
The _cogl_texture_needs_premult_conversion function was already
checking whether the source format had an alpha channel before
returning TRUE, but it also doesn't make sense to do the premult
conversion if the destination format has no alpha. This patch adds
that check in too.
2010-06-22 12:22:47 +01:00
Neil Roberts
279ad7b7e5 cogl: Add the infrastructure for checking for winsys extensions
This adds the framework needed to check for winsys specific extensions
(such as GLX extensions) using a similar mechanism to the
cogl-feature-functions header. There is a separate
cogl-winsys-feature-functions header which will contain macros to list
the extensions and functions. cogl_create_context_winsys now calls
_cogl_feature_check for each of these functions. _cogl_feature_check
has had to be changed to accept the driver prefix as the first
parameter so that it can prepend "GLX" rather than "GL" in this case.
2010-06-22 12:22:43 +01:00
Neil Roberts
9cdcc155f3 Pass all Xlib events through Cogl
The Clutter X11 backend now passes all events through
_cogl_xlib_handle_event. This function can now internally be hooked
with _cogl_xlib_add_filter. These are added to a list of callbacks
which are all called in turn by _cogl_xlib_handle_event. This is
intended to be used internally in Cogl by any parts that need to see
Xlib events.

Cogl now also has an internally exposed function to set a pointer to
the Xlib display. This is stored in a global variable. The Clutter X11
backend sets this.

_cogl_xlib_handle_event and _cogl_xlib_set_display can be removed once
Cogl gains a proper window system abstraction.
2010-06-22 12:20:59 +01:00
Neil Roberts
811bbba075 cogl: Add a struct for winsys-specific data to CoglContext
This creates a separate struct to store the fields of the context that
are specific to the winsys. This is all stored in one file but ideally
this could work more like the CoglContextDriver struct and have a
different header for each winsys.
2010-06-22 11:47:33 +01:00
Neil Roberts
3a3d55cd88 cogl: Add an internal CoglTextureRectangle backend
This adds an internal rectangle texture backend which is mostly based
on the CoglTexture2D backend. It will throw assert failures if any
operations are attempted that rectangle textures don't support, such
as mipmapping or hardware repeating.
2010-06-22 11:47:33 +01:00
Neil Roberts
fd3a3e93bf cogl-texture: Replace the ensure_mipmaps virtual with pre_paint
Instead of the ensure_mipmaps virtual that is only called whenever the
texture is about to be rendered with a min filter that needs the
mipmap, there is now a pre_paint virtual that is always called when
the texture is about to be painted in any way. It has a flags
parameter which is used to specify whether the mipmap will be needed.

This is useful for CoglTexturePixmapX11 because it needs to do stuff
before painting that is unrelated to mipmapping.
2010-06-22 11:47:33 +01:00
Neil Roberts
87240cd764 cogl-texture: List texture subclass types rather than hardcoding them
Instead of having a hardcoded series of if-statements in
cogl_is_texture to determine which types should appear as texture
subclasses, they are now stored in a GSList attached to the Cogl
context. The list is amended to using a new cogl_texture_register_type
function. There is a convenience macro called COGL_TEXTURE_DEFINE
which uses COGL_HANDLE_DEFINE_WITH_CODE to register the texture type
when the _get_type() function is first called.
2010-06-22 11:47:33 +01:00
Neil Roberts
5ea8c5bd12 Add COGL_{OBJECT,HANDLE}_DEFINE_WITH_CODE
This macro is similar to COGL_HANDLE_DEFINE_WITH_CODE except that it
allows a snippet of code to be inserted into the _get_type()
function. This is similar to how G_DEFINE_TYPE_WITH_CODE
works. COGL_HANDLE_DEFINE is now just a wrapper around
COGL_HANDLE_DEFINE_WITH_CODE.
2010-06-22 11:47:33 +01:00
Neil Roberts
97225a96a6 Add _cogl_texture_2d_externally_modified
_cogl_texture_2d_externally_modified is a function specific to the
CoglTexture2D texture backend that should be called whenever the
contents of the texture are modified without the backend knowing about
it. It simply marks the mipmap tree as invalid.
2010-06-22 11:47:32 +01:00
Neil Roberts
7e149c5ca9 cogl: Fix the include path in driver/*/Makefile.am
The include path for the winsys and driver folder was given relative
to $(srcdir) so it would end up relative to the driver folder which is
wrong. It is now specified as $(srcdir)/../../winsys to get the right
location. The driver folder is removed because it is actually just
$(srcdir) and that is already included.
2010-06-22 11:47:32 +01:00
Robert Bragg
60cad4bf0b gles2: don't disable clip planes for GLES2
GLES2 doesn't provide user clip planes (you would have to use a vertex +
fragment shader to achieve the same kind of result) so we make sure not
to call glEnable/Disable with any of the GL_CLIP_PLANE0..3 defines.

http://bugzilla.o-hand.com/show_bug.cgi?id=2177
2010-06-22 11:35:22 +01:00
Robert Bragg
00bb189e71 material: fix a typo in _cogl_material_journal_unref
The function had a line like:

CoglMaterial *material =
    material = _cogl_material_pointer_from_handle (material_handle);

where the duplicate "material =" wasn't intended, so this patch removes
it.
2010-06-22 11:21:09 +01:00
Emmanuele Bassi
8a9890e138 json: Backport JSON_NODE_HOLDS macros
Unbreak the compilation with the internal copy of json-glib.
2010-06-22 07:58:49 +01:00
Emmanuele Bassi
1eb7f57582 x11: Use the _clutter symbols for xsettings_* API
Instead of using the bare xsettings_* API; this maintains consistency.
2010-06-21 18:56:16 +01:00
Emmanuele Bassi
f3adc600fc backend: Undeprecated clutter_backend_get_resolution()
Since the Settings:font-dpi property is exposed as 1024 * real_dpi in
order to make the setting as neutral as possible (and allow XSETTINGS
to use it natively) we need a simple API returning the DPI using a
floating point value.
2010-06-21 18:26:38 +01:00
Emmanuele Bassi
19de6d9e5d Deprecate the Backend settings
The Settings instance is the preferred way of accessing the settings.
2010-06-21 17:58:26 +01:00