Commit Graph

4249 Commits

Author SHA1 Message Date
Emmanuele Bassi
169df02a56 stage: Call ClutterStageWindow::unrealize() on dispose
Since we realize on creation we need to unrealize on destruction. This
makes sure that the ClutterStageWindow implementation can tear down any
resource set up during the realization phase.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2559
2011-02-13 19:26:29 +00:00
Emmanuele Bassi
7c356fd05b stage/x11: Add a debug note for unrealization
We remove the ClutterStageWindow ↔ Window mapping in the ::unrealize
implementation; let's just check that we get there using a simple
debug note.
2011-02-13 19:25:21 +00:00
Emmanuele Bassi
2abf56fe92 Merge remote-tracking branch 'nobled/wayland-fixes2'
* nobled/wayland-fixes2:
  wayland: fix shm buffers
  wayland: set renderable type on dummy surface
  wayland: check for egl extensions explicitly
  wayland: fall back to shm buffers if drm fails
  wayland: add shm buffer code
  wayland: make buffer handling generic
  wayland: really fix buffer format selection
  wayland: fix pixel format
  wayland: clean up buffer creation code
  wayland: don't require the surfaceless extensions
  wayland: check for API-specific surfaceless extension
  wayland: fix GLES context creation
  wayland: use EGL_NO_SURFACE
  wayland: update to new api
  wayland: fix connecting to default socket
  fix ClutterContainer docs
2011-02-11 16:45:45 +00:00
Chris Lord
b152a97ea5 actor: Rename in_clone_paint parameter to avoid variable shadowing
The 'in_clone_paint' parameter of the private function
_clutter_actor_set_in_clone_paint() shadowed the private function
in_clone_paint(). Rename this parameter to 'is_in_clone_paint' to remove
a compiler warning.
2011-02-11 16:27:46 +00:00
Chris Lord
a297fb0394 offscreen: Fix partially off-stage actors being clipped in the fbo
If an actor was partially off of the stage, it would be clipped because
of the stage viewport. This produces problems if you use an offscreen
effect that relies on the entire actor being rendered (e.g. shadows).

Expand the viewport in this scenario so that the offscreen-rendering isn't
clipped.

This fixes http://bugzilla.clutter-project.org/show_bug.cgi?id=2550
2011-02-11 16:17:57 +00:00
Chris Lord
442d8c3f2e offscreen-effect: Use actor's opacity_override when redirecting painting
Override the actor's paint opacity so that it will appear fully opaque in
the offscreen surface. This avoids multiple multiplications of an actor's
opacity.

Fixes http://bugzilla.clutter-project.org/show_bug.cgi?id=2541
2011-02-11 16:17:57 +00:00
Chris Lord
b2ea7d1352 actor: Replace private opacity_parent with opacity_override
Replace the opacity_parent with an opacity_override variable, to allow
direct overriding of the paint opacity and simplify this mechanism
somewhat.

This also required a new private flag, in_clone_paint, to maintain the
functionality of the public function clutter_actor_is_in_clone_paint()
2011-02-11 16:17:57 +00:00
Neil Roberts
2ee7052d89 cogl-framebuffer: Fix flushing the framebuffer on push
When pushing a framebuffer it would previously push
COGL_INVALID_HANDLE to the top of the framebuffer stack so that when
it later calls cogl_set_framebuffer it will recognise that the
framebuffer is different and replace the top with the new
pointer. This isn't ideal because it breaks the code to flush the
journal because _cogl_framebuffer_flush_journal is called with the
value of the old pointer which is NULL. That function was checking for
a NULL pointer so it wouldn't actually flush. It also would mean that
if you pushed the same framebuffer twice we would end up dirtying
state unnecessarily. To fix this cogl_push_framebuffer now pushes a
reference to the current framebuffer instead.
2011-02-10 20:19:01 +00:00
Neil Roberts
3afa732bce cogl-framebuffer: Remove all dependencies after a flush
After a dependent framebuffer is added to a framebuffer it was never
getting removed. Once the journal for a framebuffer is flushed we no
longer depend on any framebuffers so the list should be cleared. This
was causing leaks of offscreens and textures.
2011-02-10 11:31:34 +00:00
Robert Bragg
ce3f55292a glx: Make sure to glFlush if blitting to frontbuffer.
Unlike glXSwapBuffers, glXCopySubBuffer and glBlitFramebuffer don't
issue an implicit glFlush() so we have to flush ourselves if we want the
request to complete in finite amount of time since otherwise the driver
can batch the command indefinitely.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2551
2011-02-09 19:12:20 +00:00
Robert Bragg
7b0491427c docs: clarify cogl_vertex_buffer_adds docs
This adds a clarification that cogl_vertex_buffer_add can also be
used to replace a previously added attribute with the same name.
2011-02-09 19:12:12 +00:00
Robert Bragg
d0ca228776 matrix: note that _matrix_multiply can multiply in-place
This adds a note to clarify that cogl_matrix_multiply allows you to
multiply the @a matrix in-place, so @a can equal @result but @b can't
equal @result.
2011-02-09 17:21:48 +00:00
Emmanuele Bassi
9adbb2f20c Fix compilation of the EGL backend
Sorry for breaking it.
2011-02-09 16:34:21 +00:00
Emmanuele Bassi
bb56a26daa keymap/x11: Remove unused variables
Silence compiler warnings.
2011-02-09 16:33:55 +00:00
Neil Roberts
645ca56208 cogl: Set the layer matrix on the right layer instead of a random one
When uploading the layer matrix to GL it wasn't first calling
glActiveTextureMatrix to set the right texture unit for the
layer. This would end up setting the texture matrix on whatever layer
happened to be previously active. This happened to work for
test-cogl-multitexture presumably because it was coincidentally
setting the layer matrix on the last used layer.
2011-02-09 16:14:13 +00:00
Emmanuele Bassi
95f6359f64 Intern clutter_get_actor_by_gid() implementation
As the prelude to deprecation of the function in 1.8, let's move the
implementation to an internal function, and use that instead of the
public facing one.
2011-02-09 15:27:24 +00:00
Emmanuele Bassi
719e3b7e20 Clean up ClutterMainContext and clutter-private.h
Do a better job at documenting the main context structure fields; remove
unused members; clean up the declarations.
2011-02-09 13:36:54 +00:00
Emmanuele Bassi
ef4688fd0e Avoid direct access to the main context events queue
The GQueue that stores the global events queue is handled all over the
place:

  • the structure is created in _clutter_backend_init_events();
  • the queue is handled in clutter-event.c, clutter-stage.c and
    clutter-backend.c;
  • ClutterStage::dispose cleans up the events associated with
    the stage being destroyed;
  • the queue is destroyed in ClutterBackend::dispose.

Since we need to have access to it in different places we cannot put it
inside ClutterBackendPrivate, hence it should stay in ClutterMainContext;
but we should still manage it from just one place - preferably by the
ClutterEvent API only.
2011-02-09 13:34:25 +00:00
Emmanuele Bassi
56d133f908 backend: Move event translators to the base class
In the future, we want event translators to be the way to handle events
in backends. For this reason, they should be a part of the base abstract
ClutterBackend class, and not an X11-only concept.
2011-02-09 13:29:30 +00:00
Emmanuele Bassi
224280be22 backend: Invoke ClutterStageWindow::redraw by default
Instead of asking all backends to do that for us, we can call
ClutterStageWindow::redraw ourselves by default.

This changeset fixes all backends to actually do the right thing, and
move the stage implementation redraw inside the ClutterStageWindow
implementation itself.
2011-02-09 13:29:30 +00:00
nobled
734a236a97 wayland: fix shm buffers
We need to *write* to the shared memory, not read from it.
cogl_texture_from_data() is read-only, it doesn't keep
the data in sync with the texture.

Instead, we have to call cogl_texture_get_data() ourselves
to sync manually.
2011-02-08 16:17:29 +00:00
nobled
c1a27d481b wayland: set renderable type on dummy surface
Make sure it's compatible with the API that's in use.
2011-02-08 16:16:18 +00:00
nobled
20b1350614 wayland: check for egl extensions explicitly
eglGetProcAddress() returns non-null function pointers
whether or not they're actually supported by the driver,
since it can be used before any driver gets loaded. So
we have to check if the extensions are advertised first,
which requires having an initialized display, so we split
the display creation code into its own function.

The exception to extension-checking is EGL_MESA_drm_display,
since by definition it's needed before any display is even
created.
2011-02-08 16:15:09 +00:00
Emmanuele Bassi
7da930fb75 stage-window: Add ::redraw virtual function
How to redraw a ClutterStage's implementation should be part of the
ClutterStageWindow interface.
2011-02-08 15:49:19 +00:00
Emmanuele Bassi
bbf73f58b6 Skip some x11-specific calls when generating introspection
Some types are just not handled currently.
2011-02-08 15:31:20 +00:00
Emmanuele Bassi
2f8d22ef89 Unify the vfunc parameters names with their callers
Otherwise g-ir-scanner will get fairly angry.
2011-02-08 15:30:48 +00:00
Emmanuele Bassi
9090070a98 x11: Refresh key mapping when notified by X11
Use both the MappingNotify event and the XKB XkbMapNotify event, if
we're compiled with XKB support.

This change is also useful for making ClutterKeymapX11 an event
translator and let it deal with XKB events internally like we do for
stage and input events.

Based on a patch by: Damien Lespiau <damien.lespiau@intel.com>

Signed-off by: Emmanuele Bassi <ebassi@linux.intel.com>

http://bugzilla.clutter-project.org/show_bug.cgi?id=2525
2011-02-08 12:13:13 +00:00
Emmanuele Bassi
615c200707 build: Fix the Cally pkg-config file
Do not use ${winsys}: use ${soname_infix} instead.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2549
2011-02-07 15:40:50 +00:00
Emmanuele Bassi
9fa85ee9bf osx: Add more checks to the redraw function
The redraw function might be called during destruction phase, when the
Stage state has not entirely been tore down. We need to be slightly more
resilient to that scenario.
2011-02-03 16:25:42 +00:00
Emmanuele Bassi
d846f5fe6a Add some more sanity checks to clutter_do_event()
Silently ignore events on stages during destruction; but print out a
warning if clutter_do_event() is being called with a stage-less event.
2011-02-03 11:30:10 +00:00
Emmanuele Bassi
63e88d9840 stage: Unconditionally create the devices hash table 2011-02-03 11:27:46 +00:00
Emmanuele Bassi
f133d84c02 stage: Do not update when destroying a stage
During the stage destruction we should just skip event processing, since
we cannot guarantee that the stage is actually valid.
2011-02-03 11:25:28 +00:00
Viatcheslav Gachkaylo
901ed32568 Fixed bugs with mouse events.
Enter/leave events are now being received. Mouse move events
now work properly.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>

http://bugzilla.clutter-project.org/show_bug.cgi?id=2545
2011-02-03 10:58:38 +00:00
Emmanuele Bassi
cef380040d osx: Use _clutter_event_push()
Do not operate directly on the event queue, but use the wrapper call
that all backends share.
2011-02-02 14:44:35 +00:00
Emmanuele Bassi
af22290f0d osx: Re-add the event time
Some overzealous diffing led to a missing call to setting the time of a
ClutterEvent from the corresponding NSEvent.
2011-02-02 14:44:35 +00:00
Neil Roberts
55e26e23df cogl-vertex-buffer: Use a ref count on the pipeline private data
The pipeline private data is accessed both from the private data set
on a CoglPipeline and the destroy notify function of a weak material
that the vertex buffer creates when it needs to override the wrap
mode. However when a CoglPipeline is destroyed, the CoglObject code
first removes all of the private data set on the object and then the
CoglPipeline code gets invoked to destroy all of the weak children. At
this point the vertex buffer's weak override destroy notify function
will get invoked and try to use the private data which has already
been freed causing a crash.

This patch instead adds a reference count to the pipeline private data
stuct so that we can avoid freeing it until both the private data on
the pipeline has been destroyed and all of the weak materials are
destroyed.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2544
2011-02-01 18:47:05 +00:00
Neil Roberts
5740a5a38a cogl-pipeline: Fix comparing the color in set_layer_combine_constant
In cogl_pipeline_set_layer_combine_constant it was comparing whether
the new color is the same as the old color using a memcmp on the
constant_color parameter. However the combine constant is stored in
the layer data as an array of four floats but the passed in color is a
CoglColor (which is currently an array of four guint8s). This was
causing valgrind errors and presumably also the check for setting the
same color twice would always fail.

This patch makes it do the conversion to a float array upfront before
the comparison.
2011-02-01 17:50:10 +00:00
Emmanuele Bassi
a573ad05c9 event: The device setter work on sub-types
Instead of just setting the input device pointer in the private event
data, it should also set the field in the event sub-types, so that
direct access to the structures still works.
2011-02-01 14:44:22 +00:00
Emmanuele Bassi
6f1e5010d9 docs: Switch a 'Since' annotation in CallyActor
Since doesn't like it when it's not the last annotation.
2011-02-01 14:39:21 +00:00
Neil Roberts
2ded18933e cogl-matrix: Get rid of the *_packed variants
cogl_matrix_project_points and cogl_matrix_transform_points had an
optimization for the common case where the stride parameters exactly
match the size of the corresponding structures. The code for both when
generated by gcc with -O2 on x86-64 use two registers to hold the
addresses of the input and output arrays. In the strided version these
pointers are incremented by adding the value of a register and in the
packed version they are incremented by adding an immediate value. I
think the difference in cost here would be negligible and it may even
be faster to add a register.

Also GCC appears to retain the loop counter in a register for the
strided version but in the packed version it can optimize it out and
directly use the input pointer as the counter. I think it would be
possible to reorder the code a bit to explicitly use the input pointer
as the counter if this were a problem.

Getting rid of the packed versions tidies up the code a bit and it
could potentially be faster if the code differences are small and we
get to avoid an extra conditional in cogl_matrix_transform_points.
2011-02-01 13:18:43 +00:00
nobled
e855bc45a2 wayland: fall back to shm buffers if drm fails 2011-02-01 02:58:15 +00:00
nobled
d84f31ef3a wayland: add shm buffer code
It's not enabled to do anything yet.
2011-02-01 02:58:11 +00:00
Emmanuele Bassi
2c1f8c9ad3 osx: Add devices to event translation code
Use a DeviceManager sub-class similar to the Win32 backend one, which
creates two InputDevices: a core pointer and a core keyboard.

The event translation code then uses these two devices to fill out the
.device field of the events.

Throw in enter/leave tracking, given that we need to update the device's
state.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2490
2011-01-31 13:47:34 +00:00
Viatcheslav Gachkaylo
634e4ffd1a osx: Improve the event loop
Implementation of event loop which works with GLib events, native OS X
events and Clutter events.

The event loop source code comes from the equivalent code in the Quartz
GDK backend from GTK+ 2.22.1, which is LGPL v2.1+ and thus compatible
with Clutter's licensing terms.

The code has been tested with libsoup, which did not work before together
with Clutter.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>

http://bugzilla.clutter-project.org/show_bug.cgi?id=2490
2011-01-31 13:43:12 +00:00
Emmanuele Bassi
1558975bc3 docs: Fix documentation for clutter_actor_pop_internal()
http://bugzilla.clutter-project.org/show_bug.cgi?id=2534
2011-01-31 13:37:32 +00:00
Emmanuele Bassi
ef36d7cbcc docs: Update the documentation for clutter_actor_unparent()
Make sure that we document the semantics of unparent() and who should
call it.
2011-01-31 12:51:14 +00:00
Emmanuele Bassi
e32253508d docs: Update documentation for ::destroy
The ::destroy signal is meant to be used to break reference cycles on
third party code. The documentation should really make it clear.
2011-01-31 12:50:25 +00:00
nobled
d4ccef786b wayland: make buffer handling generic
Separate the code specific to DRM buffers into
its own functions/subclass to prepare for adding SHM buffers.
2011-01-31 03:16:29 +00:00
nobled
15cd4705db wayland: really fix buffer format selection
Wayland visuals refer to a pixel's bytes in order from
most significant to least significant, while the
one-byte-per-component Cogl formats refer to the order
of increasing memory addresses, so converting between
the two depends on the system's endianness.
2011-01-31 02:45:01 +00:00
nobled
2ff5cf5aa0 wayland: fix pixel format
This matches to the Wayland premultiplied_argb_visual
the rest of the code is using.

The format needs to differ based on endianness, though...
2011-01-31 02:44:23 +00:00