Commit Graph

343 Commits

Author SHA1 Message Date
Emmanuele Bassi
f92b78781d stage: Use precomputed constants instead of trigonometric functions
This should actually ensure that the calculations of the Z translation
for the projection matrix is resolved to "variable * CONSTANT". The
original factors are left in code so it's trivial to revert to the
trigonometric operations if need be, even without reverting this commit.
2013-05-06 10:04:22 -07:00
Emmanuele Bassi
d061a47573 stage: Add a paint callback
The ClutterActor::paint signal is deprecated, and connecting to it even
to get notifications will disable clipped redraws because of violations
of the paint volume.

The only actual valid use case for notifications of a successful frame
is on the ClutterStage, so we should add new (experimental) API for it,
so that users can actually subscribe to it — at least if you're writing
a compositor.

Shoving a signal in a performance critical path is not an option, and
I'm not sure I want to commit to an API like this yet. I reserve the
right to revisit this decision in the future.

https://bugzilla.gnome.org/show_bug.cgi?id=698783
2013-05-06 10:04:21 -07:00
Emmanuele Bassi
03296e30e7 Fix compilers warnings when debugging is disabled 2013-04-04 11:53:38 +01:00
Owen W. Taylor
b248941af5 Add clutter_stage_set_sync_delay()
New experimental API is added to allow changing the way that redraws
are timed for a stage to include a "sync delay" - a period after
the vertical blanking period where Clutter simply waits for updates.

In detail, the algorithm is that when the master clock is restarted
after drawing a frame (in the case where there are timelines running)
or started fresh in response to a queued redraw or relayout, the
start is scheduled at the next sync point (sync_delay ms after the
predicted vblank period) rather than done immediately.

https://bugzilla.gnome.org/show_bug.cgi?id=692901
2013-02-13 09:27:17 -05:00
Adel Gadllah
683f15ba68 clutter-stage: Fix typo
https://bugzilla.gnome.org/show_bug.cgi?id=669122
2013-02-06 18:21:27 +01:00
Adel Gadllah
b9ad93ad8d stage-cogl: Reuse backbuffer contents
Use the buffer_age extension when available to recycle backbuffer contents
instead of blitting from the back to front buffer when doing clipped redraws.

The picking is now done in a pixel that is going to be repaired during the next
redraw cycle for non static scences.

This should improve performance and avoid tearing.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=669122
2013-02-06 18:21:27 +01:00
Adel Gadllah
60f20e8a7e stage-window: make it possible to damage the back buffer
This allows us to report to the backend that the stage's back buffer has been trashed
while handling picking. If the backend is keeping track of the contents of back buffers
so it can minimize how much of the stage is redrawn then it needs to know when we do pick
renders so it can invalidate the back buffer.

Based on patch from Robert Bragg <robert@linux.intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=669122
2013-02-06 18:20:49 +01:00
Emanuele Aina
165871024c stage: fix typo and format identifiers in debug notes
https://bugzilla.gnome.org/show_bug.cgi?id=683937
2012-09-13 12:09:30 +02:00
Jasper St. Pierre
3398f3acdf stage: Normalize key focus setting
We often mean that when key_focus == NULL, it's assumed to be on the
stage, and clutter_stage_get_key_focus() reflects this. We also do a
lot of check around the lines of key_focus == NULL instead of also
checking for the stage, so make sure to normalize it so that explicitly
grabbing the stage's key focus will not change our behaviour.

https://bugzilla.gnome.org/show_bug.cgi?id=683301
2012-09-05 14:16:34 -03:00
Lionel Landwerlin
d6a0f7eb61 input-device: don't reset a device's stage until all touch points are gone
803b3bafb6 introduced a new issue for
multi touch events.

In the case where 2 touch events for 2 different touch points are
processed in the same iteration, a call to
_clutter_stage_remove_device() when processing the first event will
remove the stage setting of the InputDevice. That means Clutter will
skip the second event, because it can't find a stage to which relate
the event, so no related actor and so no emission.

To fix this we move the _clutter_stage_(add/remove)_device() calls
into the input device. This way the input device can find out exactly
when to call these functions (i.e. when no touch point were previously
active or when no touch point remain active).

https://bugzilla.gnome.org/show_bug.cgi?id=682362
2012-09-03 21:50:24 +01:00
Tomeu Vizoso
d5332d1e4c stage: Remove tracking input devices, it's not used
https://bugzilla.gnome.org/show_bug.cgi?id=683126
2012-09-03 21:50:19 +01:00
Emmanuele Bassi
00f7fc4e58 stage: Do not use get_allocation_geometry()
Second try, after testing.

Tested-by: Rico Tzschichholz <ricotz@t-online.de>
2012-08-12 11:14:54 +01:00
Emmanuele Bassi
44661902bd Revert "stage: Do not use get_allocation_geometry()"
This reverts commit ef1bb42a86.

Apparently, it broke GNOME Shell, so let's back it out first and try to
figure out why.
2012-08-12 09:29:29 +01:00
Emmanuele Bassi
ef1bb42a86 stage: Do not use get_allocation_geometry()
It's pointless, and it will be deprecated soon.
2012-08-10 15:05:43 +01:00
Lionel Landwerlin
9e02ef459e input-device: add enter/leave events generation for touch events
This patch brings 'enter-event' and 'leave-event' generation for touch
based devices. This leads to adding a new API to retrieve coordinates
of a touch point.

https://bugzilla.gnome.org/show_bug.cgi?id=679797
2012-07-17 21:49:26 +01:00
Jasper St. Pierre
6c4abde369 stage: Make sure to free any pending queued redraws if we have any
This fixes a memory leak when someone creates a stage and then immediately
destroys it.
2012-06-24 13:31:31 -04:00
Emmanuele Bassi
ab88511133 stage: Remove an extra reference count
The dispose sequence will keep the object alive, and we need to release
the last reference held by the StageManager before releasing control to
GObject.
2012-06-24 18:02:45 +01:00
Emmanuele Bassi
550168eee3 Clean up deprecated header inclusion
The build should not add deprecated/ into the default INCLUDE paths, so
that deprecated headers are clearly separated; this will make it easier
to get rid of them when we branch out for 2.0.
2012-06-23 08:23:11 +01:00
Lionel Landwerlin
132e4b98d1 drag/drop actions: add touch event support
https://bugzilla.gnome.org/show_bug.cgi?id=678049
2012-06-22 21:40:08 +01:00
Evan Nemerson
252eafa520 introspection: assorted annotation fixes ported from Vala
https://bugzilla.gnome.org/show_bug.cgi?id=677778
2012-06-12 17:44:16 -07:00
Emmanuele Bassi
0dd74ca3fb docs: Annotation fixes
The introspection scanner has become slightly more annoying, in the hope
that people start fixing their annotations. As it turns out, it was the
right move.
2012-04-30 17:17:41 +01:00
Emmanuele Bassi
e2564dd265 Deprecate ClutterCairoTexture
The ClutterCanvas content implementation should be used instead, to
avoid stringing along the ClutterTexture API and implementation.

This change requires some minor surgery, as the deprecated section
already contains an header for the previously deprecated methods; plus,
we don't want to deprecate clutter_cairo_set_source_color(). This means
creating a new header to be used for Cairo-related API.
2012-04-27 12:28:49 +01:00
Neil Roberts
f7f8179898 Remove calls to cogl_disable_fog
I can't think of any reason why it would do this and there's no
comment explaining it so let's just remove it. The global fog state
has been removed in Cogl 2.0 so it will cause problems later.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-04-25 17:30:17 +01:00
Emmanuele Bassi
b12514ff9a stage: Unset the natural size when fullscreening
This ensures that constraints and signal handlers will go through the
allocation and not through the cache after ::fullscreen has been
emitted.
2012-04-10 12:12:50 +01:00
Neil Roberts
c9a81f035e Don't use any GL types or defines in Clutter
Some of the Clutter code was using GL types for the primitive types
such as GLint and GLubyte and then passing these to Cogl. This doesn't
make much sense because the Cogl functions directly take native C
types. This patch just replaces them with either a native C type or a
glib type.

Some of the cogl conformance tests are trying to directly call GL for
example to test creating a foreign texture. These tests have been
changed to manually define the GL enum values instead of relying on a
GL header to define them.

This is necessary because Cogl may soon stop including a GL header
from its public headers.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-23 17:24:42 +00:00
Emmanuele Bassi
720fbd3bec stage: Fix up a copy-and-paste train wreck
The show and hide implementation inside ClutterStage ended up being
recursive, and the hide implementation would actually show the children
of the stage unconditionally.

Whoopsie.
2012-03-05 17:38:27 +00:00
Alejandro Piñeiro
dbd603c504 ClutterStage: notify "key-focus" change on clutter_stage_emit_key_focus_event 2012-02-14 16:53:54 +01:00
Emmanuele Bassi
bc7959069b Deprecate ClutterStage:color
ClutterActor has a background-color property, now; we should use it for
the Stage, re-implement the color property in terms of background-color.
and deprecate the Stage property.
2012-02-13 17:30:22 +00:00
Emmanuele Bassi
f024b852f9 stage: Do not use weak refs with actors
ClutterActor provides a signal for notifying destruction: using weak
references is neither indicated nor recommended.
2012-02-13 08:45:22 +00:00
Emmanuele Bassi
519da376f0 stage: Clean up
Remove some ifdeffed out dead code, and some duplication.
2012-02-13 08:44:40 +00:00
Emmanuele Bassi
c6e1491474 stage: Use the iterator API instead of the DOM one
Whenever we're iterating over the children of the Stage we can now use
the ClutterActorIter API.

https://bugzilla.gnome.org/show_bug.cgi?id=668669
2012-01-27 11:55:39 +00:00
Emmanuele Bassi
19ff11ac93 stage: Add state tracking
State changes on the Stage are currently deferred to the windowing
system backends, but the code is generally the same, and it should
be abstracted neatly inside the Stage class itself.

There's also the extra caveat for backends that state changes on a
Stage must also emit a ClutterEvent of type CLUTTER_STAGE_STATE, a
requirement that needlessly complicates the backend code.
2012-01-26 08:30:47 +00:00
Emmanuele Bassi
4330f45d05 Override Container inside ClutterStage
The only actor that results in a mix of the old Container API and the
new Actor API is ClutterStage. By inheritance, a Stage is a Group, but
we don't want it to behave like a Group - as it already overrides most
of the Actor API, and the reason why it was made as a Group in the
first place was convenience for adding/removing children.

Given that touching Group to make it aware of the new Actor API has
rapidly devolved into a struggle between a Demiurge that tries to
avoid breakage and a Chaos that finds new and interesting ways to
break ClutterGroup, let's declare API bankruptcy here and now.

ClutterStage should override ClutterContainer methods, and use the
layout management of ClutterFixedLayout as the proper class that it
was meant to be ages ago. Let ClutterGroup rot in pieces.
2012-01-23 20:54:07 +00:00
Emmanuele Bassi
cfac97ffe1 Allow mixing old and new API without falling apart
Now that we reinstated Group to its "former glory", we need to ensure
that applications using the deprecated containers with the new DOM API
in ClutterActor can actually work - or, at least, not break horribly.

This actually means making sure that ClutterStage and ClutterGroup can
cope with the DOM, while retaining their old implementations, as well as
their bizarre idiosyncrasies and their utter, utter brokenness.
2012-01-23 20:54:06 +00:00
Emmanuele Bassi
3ff502fbb2 stage: Restore the chain up inside allocate()
Group does not have a custom allocate() any more, so it would end up
calling the default allocate() implementation provided by ClutterActor
anyway.
2012-01-20 14:55:57 +00:00
Emmanuele Bassi
480514b721 stage: Use clutter_actor_set_allocation()
Instead of chaining up, given that we want to bypass chaining up and
just set the allocation. This also allows us to bail out of the
overridden allocate vfunc check, given that we want the default Actor
behaviour to apply - including eventual layout manager delegates.
2012-01-19 13:44:38 +00:00
Emmanuele Bassi
3ad77b417c stage: Use the Actor iteration API 2012-01-16 23:37:11 +00:00
Emmanuele Bassi
9d9e98968f actor: More cleanups to the Private data structure
Try to document it properly. We can also remove some things that are
properly encapsulated through functions, like the redraw clip volume.
2012-01-16 23:35:14 +00:00
Neil Roberts
0396d3e7e6 Remove use of CoglVector3
Cogl has removed the CoglVector3 type in favour of directly using an
array of 3 floats.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-01-16 21:06:19 +00:00
Emmanuele Bassi
646cf236a5 backend: Remove ClutterBackend::redraw
The ::redraw virtual function was a throwback from olden times, and has
been thoroughly replaced by the equivalent vfunc on the StageWindow
interface. We can safely remove it, now, and simplify the flow of the
redraw code inside ClutterStage.
2012-01-12 13:35:09 +00:00
Emmanuele Bassi
e689d01800 stage: Deprecate :use-fog and :fog
The depth cueing through GL fog has been broken for a long while, now.

The fog-related API in Clutter is ridiculously limited, and harks back
to simpler times; the ClutterFog structure is not enough to express all
the GL fog machinery, and required application code to connect to the
Stage's paint implementation and drop into Cogl directly.

Additionally, the fixed pipeline fog machinery in GL simply does not
work with premultiplied alpha, unless you use a shader - and in that
case it would only work for textures. Let's deprecate it, and just
don't do anything if somebody has the brilliant idea of setting the
:use-fog property to TRUE.
2011-12-30 10:26:12 +00:00
Emmanuele Bassi
bf9339b8f4 Deprecate some more old, useless API
We still ship clutter_get_show_fps() and clutter_get_debug_enabled() as
public entry points. Yet another case of missing API review prior to the
1.0 release, so really the bucket stops around my desk.

Let's deprecate these two useless functions, and reduce the API
footprint of Clutter.
2011-11-15 17:58:25 +00:00
Emmanuele Bassi
c6e487a5c1 Remove CLUTTER_TIMESTAMP debug macro
It's pretty much unused, and it doesn't print out really informative
messages. We should make CLUTTER_NOTE print out a decent timestamp
instead.
2011-11-15 16:07:13 +00:00
Emmanuele Bassi
b5ac927763 stage: Clean up
Improve the consistency of the code.
2011-11-14 11:46:02 +00:00
Emmanuele Bassi
b2d1dfa932 stage: Deprecate clutter_stage_queue_redraw()
It's a wrapper around clutter_actor_queue_redraw().
2011-11-14 11:45:14 +00:00
Emmanuele Bassi
0c18dc6bf9 stage: Deprecate the default stage
Deprecate the clutter_stage_get_default() function, as well as the
clutter_stage_is_default() one, and replace its internal usage.
2011-11-10 15:37:51 +00:00
Emmanuele Bassi
26f4467392 Try to mop up the default stage mess
The default stage was a neat concept when we started Clutter out,
somewhere in the Jurassic era; a singleton instance that gets created at
initialization time, and remains the same for the entire duration of the
process.

Worked well enough when Clutter was a small library meant to be used to
write fullscreen media browsers, but since the introduction of multiple
stages, and Clutter being used to create all sorts of applications, the
default stage is just a vestigial remainder of that past, like an
appendix; something that complicates the layout of the code and
introduces weird behaviour, so that you notice its existence only when
something goes wrong.

Some platforms we do support, though, only have one framebuffer, so it
makes sense for them to have only one stage.

At this point, the only sane thing to do is to go through the same code
paths on all platforms, and that code path is the stage instance
creation and initialization — i.e. clutter_stage_new() (or
g_object_new() with CLUTTER_TYPE_STAGE).

For platforms that support multiple stages, nothing has changed: the stage
created by clutter_stage_get_default() will be set as the default one;
if nobody calls it, the default stage is never created, and it just
lives on as a meaningless check.

For platforms that only support one stage, clutter_stage_new() and
clutter_stage_get_default() will behave exactly the same the first time
they are called: both will create a stage, and set it as the default.
Calling clutter_stage_new() a second time is treated as a programmer
error, and will result in Clutter aborting. This is a behavioural change
because the existing behaviour or creating a new ClutterStage instance
with the same ClutterStageWindow private implementation is, simply put,
utterly braindamaged and I should have *never* had written it, and I
apologize for it. In my defence, I didn't know any better at the time.

This is the first step towards the complete deprecation of
clutter_stage_get_default() and clutter_stage_is_default(), which will
come later.
2011-11-10 15:37:51 +00:00
Emmanuele Bassi
1776ac8ed5 Remove internal usage of ClutterGeometry in StageWindow
The ClutterGeometry type is a poor substitute of cairo_rectangle_int_t,
with unsigned integers for width and height to complicate matters.

Let's remove the internal usage of ClutterGeometry and switch to the
rectangle type from Cairo.

https://bugzilla.gnome.org/show_bug.cgi?id=656663
2011-09-26 12:05:55 +01:00
Robert Bragg
239fc43c5f stage: implicitly clip to stage window bounds
This implicitly intersects any clip for redrawing with the stage window
bounds. Without this we were sometimes trying to set huge off screen
scissors leading to undefined clipping results.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-09-19 14:48:31 +01:00
Emmanuele Bassi
c5ba998d64 stage: Protect call to unrealize() in dispose
Do not call ClutterStageWindow::unrealize() if the Stage has already
been unrealized.
2011-09-09 13:53:33 +01:00