Commit Graph

6424 Commits

Author SHA1 Message Date
Emmanuele Bassi
c6e40de500 actor: Warn on adding/removing itself as a child
ClutterActor should warn if a user tries to add or remove an actor to,
and from, itself on the scene graph.

Clutter will likely crash, or warn way down the line, but if we can make
debugging simpler then we should.
2016-03-29 15:09:26 +01:00
Emmanuele Bassi
e62a6376a5 gdk: Disable deprecation warnings
For the GDK backend We're using the GdkDeviceManager API, which maps to
Clutter's own device manager API. GDK has now moved to a per-seat device
management model, and deprecated the device manager singleton one.

In order to avoid the deprecation warnings, we'd have to implement a
model similar to the GDK one inside the generic Clutter API, but that
would also require moving all the others backend to it, which is pretty
pointless.

Instead, we can disable deprecation warnings for the
ClutterDeviceManager implementation inside the GDK backend.
2016-02-28 12:43:43 +00:00
Chun-wei Fan
a99dd7555b clutter/config.h.win32.in: Keep in sync with autotools builds
This updates config.h.win32.in to be in-sync with the entries that are in
the config.h.in that is generated by the autotools builds.  In particular,
for Visual Studio builds, we default to enable all available drivers ("*").
2016-02-27 20:48:51 +08:00
Emmanuele Bassi
2b0ff2f2ba cally: Avoid clone spamming state changes
Clones may generate a temporary map/unmap on their source when painting;
this, in turn, will generate unnecessary ATK state changes.

https://bugzilla.gnome.org/show_bug.cgi?id=756371
2016-02-24 12:03:37 +00:00
Emmanuele Bassi
c867e9d941 actor: Expand is_in_clone_paint() check
The function should return true not only if the actor is being painted
by a ClutterClone, but also if it's inside a sub-graph being painted by
a ClutterClone.

https://bugzilla.gnome.org/show_bug.cgi?id=756371
2016-02-24 12:03:37 +00:00
Jonas Ådahl
8181ef15d6 evdev: Pass a motion delta to pointer constrain callback
The constrain callback cannot rely on the pointer position of the
corresponding ClutterInputDevice to get the actual delta of the motion
event that is to be constrained since it is only updated when an event is
dispatched. So change the API to pass the previous pointer position when
constraining.

https://bugzilla.gnome.org/show_bug.cgi?id=752752
2016-02-16 18:53:58 +08:00
Jonas Ådahl
52e38d1ab7 evdev: Expose microsecond timestamps via the clutter evdev API
This is needed by Wayland compositors for certain types of events.

https://bugzilla.gnome.org/show_bug.cgi?id=752752
2016-02-16 18:24:23 +08:00
Jonas Ådahl
9214d5029c evdev: Use microsecond granularity for internal timestamps
It's what libinput uses internally, and it'll be exposed in a later
patch.

https://bugzilla.gnome.org/show_bug.cgi?id=752752
2016-02-16 18:24:23 +08:00
Jonas Ådahl
a598917e07 evdev: Provide the relative pointer motion event deltas
Compositors need more detailed information about motion events. Make it
possible to retrieve this information when running the evdev backend by
adding the information to the backend specific event struct.

https://bugzilla.gnome.org/show_bug.cgi?id=752752
2016-02-16 18:24:23 +08:00
Jonas Ådahl
a10200509e evdev: Recycle device ids after devices are removed
In order to not grow the device id number forever, recycle the ids
whenever a device is released.

https://bugzilla.gnome.org/show_bug.cgi?id=755849
2016-02-16 18:24:23 +08:00
Emmanuele Bassi
c624230a8a gdk: Enable swap throttling on full screen windows
Since commit 6183eb3632 we disabled swap
throttling in favour of being driven by the GDK frame clock (and thus by
the compositor).

Compositors may decide to unredirect full screen windows to avoid the
performance penalty of the additional copy, especially on X11, which
means that a Clutter application marked as full screen is not going to
be driven by the compositor, and it's not going to be throttled by the
underlying GL machinery. This has a performance impact on constrained
platforms.

For this reason, we should re-enable swap throttling when the window is
full screen.

As the change was introduced especially because of Wayland, we should
check that we're not running as clients under a Wayland compositor; if
we do, we always keep swap throttling disabled, as the compositor will
always manage our output, even when full screen.
2016-01-25 18:48:49 +00:00
Carlos Garnacho
307cb58598 evdev: Add scroll source/finish flags info to scroll events.
Libinput tells us this much, so make use of it.

https://bugzilla.gnome.org/show_bug.cgi?id=757026
2016-01-14 19:12:17 +01:00
Carlos Garnacho
89c1c1e551 clutter-event: Add scroll source enum and axis scroll flags
Those can be used to implement different scrolling behaviors.
The fields have been added to ClutterScrollEvent itself. According
to pahole, this makes the struct as big as ClutterButtonEvent and
ClutterTouchEvent, so already at the limit of the ClutterEvent
union.

https://bugzilla.gnome.org/show_bug.cgi?id=757026
2016-01-14 19:12:17 +01:00
Emmanuele Bassi
a774ff5a09 egl: Rename backend constructor function
Otherwise the build will fail.
2015-12-11 16:23:09 +00:00
Emmanuele Bassi
e9b5eb3045 Allow setting the default backend from the configuration file
We should allow a configuration file to set up the initial state of the
global state, which also implies being able to set the backend.

If the allowed backends have already been set programmatically via the
clutter_set_windowing_backend(), though, then the application code takes
precedence, as we assume that the application author knows better than
us what their code supports or requires.
2015-12-11 15:53:24 +00:00
Emmanuele Bassi
cc31ed77bd Read the config file when creating the global shared state
The configuration file should set up the global state before we
initialize it; instead of relying on implicit ordering, explicitly read
the configuration file once, when creating the global shared context
data structure.
2015-12-11 15:53:24 +00:00
Emmanuele Bassi
6d0d1deda2 backend: Ensure that Cogl drivers are set prior to initialization
It doesn't make sense for the allowed drivers to be changed after
Clutter has been initialized.
2015-12-11 15:53:24 +00:00
Emmanuele Bassi
10b74e7005 backend: Allow setting a list of windowing backends
Like CLUTTER_DRIVER, we want to allow users to specify a list of
backends to test, and fall back to the internally defined priority as a
default.

This requires changing the way the allowed backend string is parsed,
both for the CLUTTER_BACKEND environment variable and for the
clutter_set_windowing_backend() function. Existing callers are still
supported with the exact same semantics.
2015-12-11 15:53:23 +00:00
Emmanuele Bassi
7ca28e0974 Add internal constructor function for each backend
We're going to use it to create an instance of each backend without
using the get_type() function.
2015-12-11 14:23:38 +00:00
Emmanuele Bassi
407d7ca436 Allow overriding the list of Cogl drivers via configuration file
Clutter has a configuration file that can be used to override
various settings, including the ones from environment variables.
2015-12-10 16:52:45 +00:00
Emmanuele Bassi
bb23335b5f Add a configuration option for deciding the Cogl drivers to use
Using environment variables only is not convenient for all platforms,
and in some cases it's beneficial to decide the default driver when
building Clutter. Cogl already has a similar configuration switch, and
since Clutter is overriding the default Cogl behaviour, it should offer
the same mechanism.

https://bugzilla.gnome.org/show_bug.cgi?id=742678
2015-12-10 16:38:46 +00:00
Emmanuele Bassi
2c524fbf73 backend: Allow overriding the Cogl drivers chain
We have an hardcoded list of drivers we have to go through when creating
a Cogl context. Some platforms may expose those drivers, but not be the
preferred ones.

In order to allow users and system integrators to override the list of
drivers, we should crib the same approach used by GDK, and have an
environment variable with a list of drivers to try.

The new environment variable is called `CLUTTER_DRIVER` and accepts a
comma-separated list of driver names, which will be tested in sequence
until one succeeds. There's also an additional '*' token which is used
to ask Clutter to fall back to the internally defined preferred list of
drivers.

https://bugzilla.gnome.org/show_bug.cgi?id=742678
2015-12-10 16:38:46 +00:00
Emmanuele Bassi
b47e1616eb Fix annotation for bind_model()
The (optional) annotation should only be used for (out) arguments; in
arguments that can be NULL should use the (nullable) annotation.
2015-12-09 12:44:20 +00:00
Emmanuele Bassi
a166cc9f35 Fix definition of ClutterEventExtender
The interface vtable structure is missing the GTypeInterface parent, and
GObject is complaining about it, as it should.
2015-12-09 12:42:55 +00:00
Emmanuele Bassi
dd30595084 gdk: Check for both GDK and Cogl winsys support
When using GDK and Cogl API, we need to check that both GDK and Cogl
have been built with support for that API, otherwise the build will
likely fail.
2015-12-08 14:24:36 +00:00
Jonas Ådahl
9c26a98a6f evdev: Drop redundant stage set check
Every path creating a input device in the evdev backend sets a stage,
so the check is unnecessary.

https://bugzilla.gnome.org/show_bug.cgi?id=752752
2015-12-03 15:36:49 +08:00
Emmanuele Bassi
1d53b773fd text: Enforce boolean value
We store the cursor-visible value in a bit field, which means that we
need to enforce the argument for the setter to either 0 or 1 in order to
fit.
2015-11-30 13:47:57 +00:00
Emmanuele Bassi
c8ef4349fe docs: Improve documentation for ClutterText
Ensure that the rule for :cursor-visible are documented.
2015-11-30 13:47:15 +00:00
Emmanuele Bassi
388fe9b542 text: Unify conditions for visible cursor
We have a bunch of similar checks in various places, and they should all
be coalesced into one.
2015-11-30 13:45:45 +00:00
Emmanuele Bassi
78eb07d657 text: Allow selectability without editability
Being able to select text and being able to edit text are two separate
capabilities, but ClutterText only allows the former with the latter.

The ClutterText:selectable property is set to TRUE by default, given
that it depends on the :editable property; this implies that all
ClutterText instances now are going to show a cursor as soon as they get
key focused. Obviously, this would make labels look a bit off — but if
you have a label then you would not give it key focus, either by
explicitly calling clutter_actor_grab_focus(), or by setting it as
reactive and allowing it to be clicked.

If this turns out to be a problem, we have various ways to avoid showing
a cursor — for instance, we could change the default value of the
selectable property, and ensure that setting the :editable property to
TRUE would also set the :selectable property as a side effect. Or we
could hide the cursor until the first button/touch press event. Finally,
we could always back this commit out if it proves to be too much of a
breakage for existing code bases.

https://bugzilla.gnome.org/show_bug.cgi?id=757470
2015-11-28 20:20:00 +00:00
Lionel Landwerlin
8c863573fc gdk: take into account scaling on wayland
The X11 part of the GDK backend takes into account the scaling factor of its
window when resizing the underlying X11 objects. We need to do the same for
Wayland.

https://bugzilla.gnome.org/show_bug.cgi?id=755245
2015-11-22 21:45:55 +00:00
Carlos Garnacho
a9b0715df1 gdk: Implement ClutterEventExtender
This lifts the responsibility off its ClutterBackend.

https://bugzilla.gnome.org/show_bug.cgi?id=758238
2015-11-18 13:00:53 +01:00
Carlos Garnacho
9215852c32 x11: Implement ClutterEventExtender
This lifts the responsibility off its ClutterBackend.

https://bugzilla.gnome.org/show_bug.cgi?id=758238
2015-11-18 13:00:53 +01:00
Carlos Garnacho
8aeea7fb73 evdev: Set event code on button/key events
This will allow users to know the event code without strange calculations
on event->key.hardware_keycode or event->button.button.

https://bugzilla.gnome.org/show_bug.cgi?id=758238
2015-11-18 13:00:53 +01:00
Carlos Garnacho
f1ad702309 evdev: Allow to retrieve the input.h event code from ClutterEvents
This is now stored as platform data in the ClutterEvent, so can
be retrieved with the clutter_evdev_event_get_event_code() call
that's been added to the evdev backend.

https://bugzilla.gnome.org/show_bug.cgi?id=758238
2015-11-18 13:00:48 +01:00
Carlos Garnacho
dfc749e576 evdev: Implement the ClutterEventExtender interface
This will allow the ClutterDeviceManagerEvdev to define evdev-specific
event data.

https://bugzilla.gnome.org/show_bug.cgi?id=758238
2015-11-18 12:59:05 +01:00
Carlos Garnacho
4115f215ac backend: Bridge platform-dependent event data creation to device managers
Device managers can now implement the ClutterEventExtender interface
that allows them to set their own data to events, make the backend call
those implementations if the device manager implements the interface.

https://bugzilla.gnome.org/show_bug.cgi?id=758238
2015-11-18 12:59:05 +01:00
Carlos Garnacho
5ea70bd102 device-manager: Add private interface to manipulate platform event data
This normally belonged to the ClutterBackend, however there's device
managers (eg. evdev) that are somewhat detached from the backend, so
need to bridge this somehow.

This allows device managers to implement these bits that were usually
responsibility of the ClutterBackend.

https://bugzilla.gnome.org/show_bug.cgi?id=758238
2015-11-18 12:59:05 +01:00
Emmanuele Bassi
89a794ec46 Add version macros for Clutter 1.26 2015-11-18 11:54:26 +00:00
Carlos Garnacho
83b738c0e7 evdev: Move additional pointer buttons after the old 4-7 scrolling ones
On X11 those were skipped, so additional pointer buttons would come up
as button >= 8 events. Do here the same, so we remain compatible across
backends.

https://bugzilla.gnome.org/show_bug.cgi?id=758237
2015-11-17 22:47:20 +01:00
Carlos Garnacho
a9f16c3d1f evdev: Mark either of smooth/discrete scroll events as emulating
We're always emulating one of those, depending on the scrolling
device/source, so mark these as such.
2015-10-23 17:04:49 +02:00
Carlos Garnacho
9753c99382 click-action: Ignore motions/updates from different devices/sequences
Otherwise events from other devices or touch sequences might unintendedly
trigger the thresholds, and a "cancelled" ::long-press with it.

https://bugzilla.gnome.org/show_bug.cgi?id=756749
2015-10-17 18:44:25 +02:00
Emmanuele Bassi
b6425bbb15 Use explicit NULL comparison for pointers
Following the coding style.
2015-10-12 19:54:32 +01:00
Carlos Garnacho
1fe21a8fe1 evdev: Emulate discrete scroll events out of smooth scroll ones.
There's handlers around relying on up/down/left/right scroll events,
which won't work as expected if only smooth scroll events are sent.
In order to work properly there, we have to retrofit discrete scroll
events on the evdev backend.

Fix this by implementing emission (on devices with a wheel) and
emulation (on anything else) of discrete scroll events. On the former
both smooth and discrete events are set, for the latter we do accumulate
the dx/dy of the latest scroll events, and emit discrete ones when we
accumulated enough. The ending 0/0 event will reset the accumulators for
the next scrolling batch.

https://bugzilla.gnome.org/show_bug.cgi?id=756284
2015-10-12 19:54:32 +01:00
Owen W. Taylor
2ddec579d6 clutter_actor_update_map_state: Remove a useless warning
A check for priv->parent == NULL was inside the else of a check
for (priv->parent == NULL).

https://bugzilla.gnome.org/show_bug.cgi?id=745517
2015-10-01 13:38:47 -04:00
Owen W. Taylor
4c9443bbd7 _clutter_actor_set_enable_paint_unmapped: don't force an unmap
When enable_paint_unmapped is disabled, we shouldn't force the
source widget to be unmapped if the constraints would keep it
mapped; in practice this shouldn't matter unless a paint handler
is messing with the map state.

https://bugzilla.gnome.org/show_bug.cgi?id=745517
2015-10-01 13:38:47 -04:00
Owen W. Taylor
76c8cd292e Avoid crashing when an actor not parented to a toplevel is cloned
If we can't realize the source actor for a clone, simply skip updating
the map state and painting it.

https://bugzilla.gnome.org/show_bug.cgi?id=745517
2015-09-29 14:15:16 -04:00
Lionel Landwerlin
b9df8524f0 gdk: Enable clock updates when timelines are added to the clock
Enable animation updates from the GdkFrameClock whenever any timeline is
added to the ClutterMasterClockGdk. This may improve animation
smoothness (depending on the GDK backend in use) because it allows GDK
to tweak its frame timing for animation purposes.

https://bugzilla.gnome.org/show_bug.cgi?id=755357
2015-09-22 17:27:42 +01:00
Philip Withnall
3816d5a6bb gdk: Fix frame budget diagnostics
Set the frame budget so that CLUTTER_ENABLE_DIAGNOSTIC correctly outputs
timing diagnostics from the ClutterMasterClockGdk.

https://bugzilla.gnome.org/show_bug.cgi?id=755357
2015-09-21 18:03:04 +01:00
Philip Withnall
9e8da64636 gdk: Use frame time when calculating the tick time for clock updates
This is how GdkFrameClock is meant to be used: the frame time is meant
to be queried from the GdkFrameClock within its frame signals, rather
from the system monotonic time source.

https://bugzilla.gnome.org/show_bug.cgi?id=755357
2015-09-21 18:03:04 +01:00
Philip Withnall
5545b69a8f timeline: Add more debug output
https://bugzilla.gnome.org/show_bug.cgi?id=755357
2015-09-21 17:02:39 +01:00
Philip Withnall
ae1a84853e timeline: Ensure waiting_first_tick is set before adding the timeline
Just in case the timeline starts being prodded by the ClutterMasterClock
before the add function returns. (This has not been verified.)

https://bugzilla.gnome.org/show_bug.cgi?id=755357
2015-09-21 17:02:39 +01:00
Lionel Landwerlin
0e7b18832a cogl: reset pending swaps counter on unrealize
When removing the frame callback on the CoglOnscreen, we loose the ability
to get notified of swap events. This could leave us with a counter != 0
which leads to a deadlock situation after the next realize/draw cycle.

https://bugzilla.gnome.org/show_bug.cgi?id=755014
2015-09-15 12:29:05 +01:00
Lionel Landwerlin
ff1a5aae7a x11: stage window: reset framebuffer on foreign window unrealize
Similarly to 13dbb74c81, we need to reset the
framebuffer in the x11 for foreign windows.

https://bugzilla.gnome.org/show_bug.cgi?id=755014
2015-09-15 12:29:04 +01:00
Lionel Landwerlin
6c7f624f69 master-clock-default: prevent deadlock with GLX_INTEL_swap_event
If we call _clutter_stage_do_update() on a ClutterStage that isn't
mapped/visible, no GL command will be queued, and the Mesa/DRI2
implementation of SwapBuffers will do nothing. This causes
GLX_INTEL_swap_event to not be emitted by the X server because no swapping
has been requested through DRI2 and it eventually leads to a deadlock
situation in ClutterStageCogl because we're waiting for an event before we
start the next draw cycle.

This patch removes the non mapped stages from the list of stages to process.
This is consistent with a previous patch for the ClutterMasterClockGdk [1].

[1] : 5733ad58e5

https://bugzilla.gnome.org/show_bug.cgi?id=755014
2015-09-15 12:23:08 +01:00
Lionel Landwerlin
ee98a5bbe8 gdk: x11: notify Cogl immediately of a foreign window resize
We want to avoid waiting for the acknowledgement event from the X
server as we might redraw the stage before that happens.

This patch reimplements a bit of logic already in clutter-gtk [1].

[1] : https://git.gnome.org/browse/clutter-gtk/tree/clutter-gtk/gtk-clutter-embed.c#n723

https://bugzilla.gnome.org/show_bug.cgi?id=754993
2015-09-14 13:49:08 +01:00
Lionel Landwerlin
aeb19f2f4d gdk: move sync_to_vblank setup from master clock to backend
Setting up the sync_to_vblank in the MasterClock is a bit too late as
the MasterClock can be created after a StageWindow has been created
and realized (and therefore all of its Cogl/GL state setup already).
So move the setup to the backend, prior to any StageWindow creation.

https://bugzilla.gnome.org/show_bug.cgi?id=754938
2015-09-14 13:46:31 +01:00
Lionel Landwerlin
13dbb74c81 gdk: stage window: reset framebuffer on foreign window unrealize
Clutter still uses part of the deprecated stateful API of Cogl (in
particulart cogl_set_framebuffer). It means Cogl can keep an internal
reference to the onscreen object we rendered to. In the case of
foreign window, we want to avoid this, as we don't know what's going
to happen to that window.

This change sets the current Cogl framebuffer to a dummy 1x1
framebuffer if the current Cogl framebuffer is the one we're
unrealizing.

https://bugzilla.gnome.org/show_bug.cgi?id=754890
2015-09-12 00:39:43 +02:00
Lionel Landwerlin
cb4e88884b gdk: master clock: hook ourselves to the paint signal
We're currently hooked to the "update" signal of the FrameClock. When
embedding Clutter inside GTK+ we want to have the layout phase of GTK+
to notify us the size of our stage.

This patch change to FrameClock signal we're listening to, to the
"paint" signal to make sure we've received the layout information from
GTK+, before painting. Otherwise we paint with a delay of one frame.

https://bugzilla.gnome.org/show_bug.cgi?id=754889
2015-09-12 00:39:43 +02:00
Jonas Ådahl
5d83260b19 actor: Fix transforming stage point when scale is less than 1
The commit 6cd24faaa5 (actor: Clean up
transform_stage_point()) changed the validation of the transformation
matrix to ignore the fraction part of the determinant. This caused
clutter_actor_transform_stage_point() to fail and return FALSE for
actors which scale was less than 1.

Previously the validation was ('det' being a float):
	det = (RQ[0][0] * ST[0][0])
	    + (RQ[0][1] * ST[0][1])
	    + (RQ[0][2] * ST[0][2]);
	if (!det)
		return FALSE;

Semantically, the if statement expression '!det' is equivalent to
'det == 0', i.e. 'det == 0.0f'. Post cleanup patches, 'det' was turned
into a double, and the if statement was changed to:

	if (CLUTTER_NEARBYINT (det) == 0)
		return FALSE;

which, different from before, rounds the determinant to the nearest
integer value, meaning determinant in the range (-0.5, 0.5) would be
considered invalid.

This patch reverts this part to the old behavior, while, because of the
inexact nature of floating point arithmetics, allowing a bit more liberal
meaning of "equals to 0" than '== 0.0'.

https://bugzilla.gnome.org/show_bug.cgi?id=754766
2015-09-11 10:36:52 +08:00
Lionel Landwerlin
9432e67ee8 gdk: stage: create subsurface when dealing with foreign windows on wayland
It is safer to create our own wayland surface when rendering into
someone else GdkWindow, otherwise we might draw somewhere we didn't
intend to.

https://bugzilla.gnome.org/show_bug.cgi?id=754697
2015-09-07 18:17:10 +01:00
Lionel Landwerlin
3771ef2f08 gdk: stage: report geometry of the underlying surface for foreign windows
When running on wayland, we might have our own subsurface
desynchronized from the foreign GdkWindow. It is important that we
report the size of the actually surface we're rendering to, otherwise
the logic in ClutterStage might discard resize operation that
resynchronize the subsurface with the stage's size.

https://bugzilla.gnome.org/show_bug.cgi?id=754697
2015-09-07 18:17:10 +01:00
Lionel Landwerlin
55dce70440 gdk: stage: do not ensure native windows are created with foreign windows
For foreign windows this should be dealt with by the embedding
framework. In particular on Wayland with foreign windows, we might
want to create a subsurface and use the foreign window only for events
and frame clock synchronization.

https://bugzilla.gnome.org/show_bug.cgi?id=754697
2015-09-07 18:17:10 +01:00
Lionel Landwerlin
a9b38fefdc gdk: stage: disable some operations for foreign windows
Some operations like :
     * resize
     * show/hide
     * set_title
     * set_user_resizable

should be handled by the embedding framework, so disable them for
foreign windows.

https://bugzilla.gnome.org/show_bug.cgi?id=754671
2015-09-07 18:17:10 +01:00
Lionel Landwerlin
5733ad58e5 gdk: master clock: only process mapped & realized stages
When using Clutter embed inside a Gtk application, a stage might end
up realized but not visible. In this case we might discard doing any
kind of animation processing.

https://bugzilla.gnome.org/show_bug.cgi?id=754671
2015-09-07 18:17:09 +01:00
Lionel Landwerlin
6183eb3632 gdk: master-clock: disable vsync throttling
When running with a master clock based on the GdkFrameClock, we get
synchronized with the compositor, so no need for throttling rendering.

In particular when dealing with foreign windows, we run into deadlocks
in Mesa because of the way the Mesa wayland backend is implemented [1].

[1] : http://cgit.freedesktop.org/mesa/mesa/tree/src/egl/drivers/dri2/platform_wayland.c#n330

https://bugzilla.gnome.org/show_bug.cgi?id=754671
2015-09-07 18:17:09 +01:00
Emmanuele Bassi
dbec3be996 grid-layout: Clarify the scope of the orientation property
Just like GtkGrid, changing the orientation of a ClutterGridLayout does
not change the existing layout; the orientation property is only used as
a hint when adding new children.
2015-09-04 13:53:04 +01:00
Emmanuele Bassi
7ed96aabd8 grid: Use the proper orientation for the request mode
We automatically switch the request mode of the container depending on
the GridLayout's orientation, but we need to keep track of the request
mode during allocation, so that we don't get out of sync if the user
changed the request mode after adding the layout manager.

This change also brings us closer to the code in GtkGrid.
2015-09-03 14:18:33 +01:00
Emmanuele Bassi
dea5057fbd grid: Use the orientation of the request
We use the orientation of the grid to get the preferred size of the
layout, but we should be using the orientation of the request instead.
The preferred width has an orizontal orientation, and the preferred
height has a vertical orientation.

This allows us to refactor the get_preferred_* implementation into a
separate function.
2015-08-29 20:38:29 +01:00
Lionel Landwerlin
0e4d11bcd8 gdk: master clock: fix incorrect symbol use
https://bugzilla.gnome.org/show_bug.cgi?id=754134
2015-08-26 21:40:47 +01:00
Lionel Landwerlin
5b9c31a0ce gdk: fix memory corruption
g_hash_table_replace will free the list pointer we're modifying.
Let's just do memory management ourselves.

https://bugzilla.gnome.org/show_bug.cgi?id=754134
2015-08-26 21:40:41 +01:00
Emmanuele Bassi
84c5846aa0 image: Use internal function for the texture node
ClutterActor has a convenience function that removes the need to query
the actor's state and apply it to a ClutterTextureNode, so we should use
it.
2015-08-24 10:01:03 +01:00
Emmanuele Bassi
af010d5e2d canvas: Use internal function for the texture node
ClutterActor has a convenience function that removes the need to query
the actor's state and apply it to a ClutterTextureNode, so we should use
it.
2015-08-24 09:59:53 +01:00
Emmanuele Bassi
cf7e37b53b actor: Add internal "create textute node" function
To avoid excessive copy and paste. We could even consider making it
public before release.
2015-08-24 09:59:16 +01:00
Emmanuele Bassi
38e983b8e9 docs: Fix a typo in the BoxLayout:homogeneous description
https://bugzilla.gnome.org/show_bug.cgi?id=753895
2015-08-21 12:11:05 +01:00
Emmanuele Bassi
fe422ab61c gdk: Use non-deprecated/non-Clutter specific X11 API
We are currently using deprecated/Clutter-specific API in Cogl to
retrieve the XVisualInfo associated with the (E)GLX context. Cogl 1.21.2
added new CoglRenderer API to achieve the same result.
2015-08-21 11:58:52 +01:00
Anders Jonsson
6d649ec6d1 Fix typo (textues)
https://bugzilla.gnome.org/show_bug.cgi?id=746279
2015-08-01 21:55:07 +02:00
Adel Gadllah
9a510c0117 backend: Check for a known set of drivers
We want to use the Cogl GL3 driver, if possible, and then go through a
known list of Cogl drivers, before giving up and using COGL_DRIVER_ANY.

Based on original patch from Emmanuele Bassi.

We have to create and tear down the whole context when trying
out the drivers though because the extension checks do not happen
until cogl_context_init.

https://bugzilla.gnome.org/show_bug.cgi?id=742678
2015-07-26 16:05:07 +02:00
Carlos Garnacho
40f6a0135e evdev: Set missing dx/dy fields on ClutterTouchpadPinchEvents 2015-07-24 19:17:12 +02:00
Emmanuele Bassi
b834503b79 build: Fix for distcheck 2015-07-22 19:12:42 +01:00
Stefan Sauer
8f976cad44 docs: give more hints about how to replace the anchor-point
In addition to pivot-point also mention _set_translation().
2015-07-22 18:41:39 +01:00
Emmanuele Bassi
13c722c026 x11: Remove unused enumeration
The ClutterX11XInputEventTypes enumeration has been unused inside
Clutter for the past 4 years and a half, since we switched to the
XInput 2 API.

The enumeration itself has always been private, and nobody should
have used it in the first place, but if something breaks, we can
revert this commit.
2015-07-20 13:05:06 +01:00
Emmanuele Bassi
9d40fafa2a Do not generate backend-specific enumeration types
They should be part of the backend-specific API.

The only backend that has an enumeration type is the X11 one, and it's
small, so we can simply put it there.

This is not an ABI change: the backend-specific symbols are still in
the same SO. You'll be required to import clutter-x11.h to have access
to the GType method at the source level, whereas before just importing
clutter.h would have sufficed. The only user of that enumeration was a
function declared in clutter-x11.h, anyway.
2015-07-20 13:00:12 +01:00
Emmanuele Bassi
c2e63cf16b build: Use the appropriate NAMESPACE variable everywhere
We're inconsistently using the NAMESPACE variable instead of passing
the --identifier-prefix and --symbol-prefix command line arguments to
the introspection scanner.
2015-07-19 13:17:49 +01:00
Emmanuele Bassi
e474684f2b deprecated: Regenerate the compatibility key symbols
Now with the appropriate compiler warning that points to the replacement
key symbol.
2015-07-17 13:16:53 +01:00
Emmanuele Bassi
1506ec4a54 keysyms-update: Add deprecation notice for compat symbols
Now that we can warn about deprecated macros, we should finally do it
for the old, non-namespaced key symbol macros that we've been stringing
along since the 1.0 days.
2015-07-17 13:15:32 +01:00
Ting-Wei Lan
ad690c61b1 macros: Clang 3.4 and later versions can use deprecation macros for GCC
https://bugzilla.gnome.org/show_bug.cgi?id=752272
2015-07-14 02:39:40 +08:00
Nitin Sharma
4dfa4de5d0 actor: Check for NULL pointer for pspec
In function clutter_actor_set_final_state, the pspec pointer returned by calling
g_object_class_find_property is not checked for NULL.
2015-07-13 13:15:52 +01:00
Emmanuele Bassi
332aa3cf21 macros: Add fallback defines for non-GCC compilers
I forgot to add the fallback definitions in case we're not using GCC;
without them, anybody using non-GCC compilers will get a build error.

https://bugzilla.gnome.org/show_bug.cgi?id=752272
2015-07-11 23:58:12 +01:00
Ting-Wei Lan
7e0f588c91 trivial: Fix return value error in clutter_event_get_gesture_motion_delta 2015-07-11 18:09:45 +08:00
Emmanuele Bassi
a722cbebef actor: Fully deprecate the state access macros
Now that we can warn without breaking the build, we should deprecate the
state access macros for ClutterActor.
2015-07-11 10:18:18 +01:00
Emmanuele Bassi
4040f2d556 gdk: Do not use deprecated macros
Use the replacement functions instead.
2015-07-11 10:18:18 +01:00
Emmanuele Bassi
eefbb88675 backend: Do not use deprecated macros
Use the replacement functions instead.
2015-07-11 10:18:18 +01:00
Emmanuele Bassi
02b44fcc60 cally: Drop use of deprecated macros
Use the equivalent functions instead.
2015-07-11 10:18:18 +01:00
Emmanuele Bassi
8a24ad83c9 Add macros for deprecating macros
We want to be able to deprecate macros, but right now the best we can do
is to wrap them with things like:

  #ifndef CLUTTER_DISABLE_DEPRECATED
  # define A_MACRO_I_WANT_TO_DEPRECATE ...
  #endif

Which requires adding a new symbol to the build, and will cause a build
error instead of a compiler/pre-processor warning.

Fortunately, we can use the _Pragma() keyword introduced by C99 and
supported by GCC to add a warning to the output, while leaving the macro
itself intact.

GCC does not have a "deprecated" pragma, so we have to use a generic
warning; this also means we cannot do nifty things like concatenating
strings and the like, as we do for the "deprecated" attribute.

The macro deprecation symbol should have the same affordances as the
function deprecation one, and evaluate to nothing if the required
version is lower than the current version; or if the global toggle for
deprecation warnings is in effect.
2015-07-11 10:18:18 +01:00
Carlos Garnacho
b151898534 clutter-event: Add API around touchpad gesture events
These are needed in order to make these events binding friendly
2015-07-10 21:47:30 +02:00
Carlos Garnacho
5b8a2a9e15 evdev: Handle libinput touchpad swipe/pinch gesture events
The translation from libinput events is fairly straightforward, as they
map almost 1:1.
2015-07-10 21:47:30 +02:00
Carlos Garnacho
c185a17783 event: Add pinch/swipe gesture event types and structs
We now have ClutterTouchpadPinchEvent and ClutterTouchpadSwipeEvent,
each bringing the necessary info for the specific gesture. Each
of these events is defined by begin/update/end/cancel phases.

These events have been also made to propagate down/up the pointer
position, just like scroll and button events do.
2015-07-10 21:47:01 +02:00
Emmanuele Bassi
3e14d87188 actor: Use CLUTTER_NEARBYINT instead of C integer casting
Otherwise we break because of rounding.
2015-07-10 14:33:25 +01:00
Emmanuele Bassi
b0e785c6c2 actor: Add bind_model_with_properties()
When binding models to actors to map items to children we don't often
need the full control of a function; in many cases we just need to
specify the type of the child we want to construct and the properties
on both the item and the child that we want to bind.

We should provide a simple convenience function that does all this for
us.
2015-07-10 11:26:34 +01:00
Emmanuele Bassi
365bd482fb gdk: Use X11 API only when running under X11
Avoid using GdkX11Screen API when the GDK backend being used is not the
X11 one.

https://bugzilla.gnome.org/show_bug.cgi?id=752143
2015-07-09 14:34:11 +01:00
Emmanuele Bassi
41cd804f10 actor: Rename internal function
Map to the field name and the signal name, so it's clear what it does.
2015-07-09 14:30:26 +01:00
Emmanuele Bassi
b0300a6247 cogl: Pack ClutterStageCogl a bit more
We should rearrange the fields a bit so they get packed without holes,
and aligned with cacheline boundaries.
2015-07-08 11:15:54 +01:00
Emmanuele Bassi
938eea175f backend: Remove unnecessary private data structure
The whole of ClutterBackend is a final/protected type, so having a bunch
of instance fields and an instance private data structure is redundant
at best, and less efficient at worst.
2015-07-08 11:10:45 +01:00
Emmanuele Bassi
02b69e4d76 Move header inclusion guard at the top
GCC has some optimization for the inclusion guard, but they only work if
the check is the outermost one.

We're fairly inconsistent because of historical reasons, so we should
ensure that we follow the same pattern in every public header.
2015-07-07 16:03:32 +01:00
Emmanuele Bassi
cffa243fbe Add autocleanup macros for Clutter types
So that people can use the g_auto* macros, as well as the G_DECLARE_*
ones, from GLib 2.44.
2015-07-07 16:03:31 +01:00
Emmanuele Bassi
6cd24faaa5 actor: Clean up transform_stage_point()
Use double precision floats for the intermediate computations, to avoid
loss of precision, and don't convert too integer when unnecessary, to
avoid rounding errors.
2015-07-07 16:03:31 +01:00
Emmanuele Bassi
bf9a71ae23 actor: Allow binding an actor to a GListModel
It can be useful to bind the children list to set of objects inside a
GListModel implementation; the GListModel stores the objects, and every
time the model changes, a function is called that maps each object in
the model to a newly created ClutterActor, which is then added as a
child. This API, along with the property binding one inside GObject,
allows automatic creation of views based on object models that update
themselves without manual intervention.
2015-07-07 16:03:31 +01:00
Emmanuele Bassi
db8bb95817 Move ClutterModel to the deprecated area
And deal with the fallout in the source tree.
2015-07-07 16:03:31 +01:00
Emmanuele Bassi
31c2c57f8b Move clutter-list-model.[ch] to the deprecated area 2015-07-07 16:03:31 +01:00
Emmanuele Bassi
6376eebd9b Deprecate ClutterModel
Now that we've deprecated the only concrete implementation of
ClutterModel, it's time we deprecate the base abstract class.
2015-07-07 16:03:31 +01:00
Emmanuele Bassi
e1e6f7be48 Deprecate ClutterListModel
The model API was an ad hoc addition to Clutter, back in the 0.6 days,
that was needed because GLib did not offer anything of sort, and the
only model-like storage was inside GTK+. The API design was heavily
based on GtkTreeModel and friends, with column-based collections of
generic data.

Since then, the model API inside Clutter has not really been integrated
in the core API; on the other hand, GIO has grown a model API, and it's
seeing more use in the platform.

This means that the ClutterModel API should finally be deprecated, and
we should move code to the GListModel API inside GIO.
2015-07-07 16:03:31 +01:00
Peter Hutterer
661078a4f2 x11: don't create the libinput tapping property
If it doesn't exist, we don't have a touchpad. Don't create the property
and potentially confuse other pieces of the stack that do the same check.
2015-07-07 16:03:31 +01:00
Kalev Lember
7c2ac712f7 docs: Fix a typo in ClutterImage example 2015-06-20 18:55:01 +02:00
Gustavo Noronha Silva
0c75e17814 Add PanAxis mode that automatically pins scroll based on initial movement
This code is inspired by the implementation of the same feature for the
Mx toolkit's MxKineticScrollView. See commit 4d08771.

https://bugzilla.gnome.org/show_bug.cgi?id=707982
2015-06-11 15:47:48 -03:00
Carlos Garnacho
2105055a34 gdk: Enable GDK_TOUCH_MASK on the stage window
This allows touch events to be received and translated.

https://bugzilla.gnome.org/show_bug.cgi?id=750496
2015-06-11 15:06:55 +01:00
Carlos Garnacho
7ed3714a94 gdk: Ignore synthesized leave events out of touch events
Certain crossing modes notify about synthesized events, where
the pointer didn't really leave the window. Unsetting the stage
from the device at that time is incorrect, and will leave all
remaining touches unable to pick coordinates, so silently eaten
away.

https://bugzilla.gnome.org/show_bug.cgi?id=750496
2015-06-11 15:06:55 +01:00
Emmanuele Bassi
2d5b5aa82a gdk: Add function to retrieve the GdkVisual
Straight from Cogl.

This allows us to propagate the GdkVisual Cogl and Clutter use to
embedding toolkits, like GTK+.

The function is annotated as being added to the 1.22 development
cycle because it will be backported to the stable branch, so that
downstream developers can package up a version of Clutter that does
not crash on nVidia.

https://bugzilla.gnome.org/show_bug.cgi?id=747489
2015-06-10 19:09:21 +01:00
Emmanuele Bassi
c91621e8c2 gdk: Use the Cogl visual on Xlib winsys
GDK 3.16 started selecting different visuals, to best comply with the
requirements for OpenGL, and this has broken Clutter on GLX drivers that
are fairly picky in how they select visuals and GLXFBConfig.

GDK selects GLXFBConfig that do not include depth or stencil buffers;
Cogl, on the other hand, needs both depth and stencil buffers, and keeps
selecting the first available visual, assuming that the GLX driver will
give us the best compliant one, as per specification. Sadly, some
drivers will return incompatible configurations, and then bomb out when
you try to embed Clutter inside GTK+, because of mismatched visuals.

Cogl has an old, deprecated, Clutter-only API that allows us to retrieve
the XVisualInfo mapping to the GLXFBConfig it uses; this means we should
look up the GdkVisual for it when creating our own GdkWindows, instead
of relying on the RGBA and system GdkVisuals exposed by GDK — at least
on X11.

https://bugzilla.gnome.org/show_bug.cgi?id=747489
2015-06-10 19:06:25 +01:00
Emmanuele Bassi
c4fa3514ad Use the public symbol for Wayland compositor support
Instead of using a private one. This way, if things go out of sync,
we'll notice immediately.
2015-06-10 12:31:51 +01:00
Emmanuele Bassi
a1c4acf227 Add missing include
Some X11-related system header is leaking stdlib.h, so when we disable
the X11 backend we get a compiler warning for atol().
2015-06-10 12:28:59 +01:00
Emmanuele Bassi
896e43cbd5 gdk/device: Propagate more device details from GDK
In order to do device matching we need to propagate more information,
like the device_id (only on X11 with the XInput2 extension enabled),
the vendor id, and the product id.

https://bugzilla.gnome.org/show_bug.cgi?id=747951
2015-06-03 13:08:01 +01:00
Dima Ryazanov
71743ef660 Fix a compile error when the X11 backend is disabled
When defining clutter_stage_gdk_update_foreign_event_mask, check for the
same macros as when actually using it.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Emmanuele Bassi <ebassi@gnome.org>
2015-05-29 10:13:03 +01:00
Carlos Garnacho
fbe2c74e19 swipe-action: Fix typo
X coords are meant to compare with distance_x.
2015-05-26 19:05:20 +02:00
Carlos Garnacho
a4962c0336 swipe-action: Prepare for multifinger swipes
Its ::gesture-end implementation used to check the press/release
coordinates for the first touchpoint. On multifinger swipes, we
can receive this vfunc called due to other touch sequence going
first, so we'd get 0/0 as the release coordinates for this still
active sequence, resulting in bogus directions.

Instead, check the last event coordinates, that will be always
correct regardless of whether the touchpoint 0 finished yet or
not.

https://bugzilla.gnome.org/show_bug.cgi?id=749739
2015-05-26 19:02:51 +02:00
Emmanuele Bassi
c71dfa2162 docs: Remove stray XML element
We moved to Markdown a while ago, but a stray </para> was left in.
2015-05-19 15:27:30 +01:00
Emmanuele Bassi
c99ce18efb actor: Guard against negative-sized allocations
The allocate_align_fill() method may end up trying to allocate an actor
with a negative size, due to rounding and floating point operations.

https://bugzilla.gnome.org/show_bug.cgi?id=749420
2015-05-19 15:27:29 +01:00
Emmanuele Bassi
e72a1a44e6 actor: Ensure allocation adjustment is safe against zero sizes
We already copy with negative end results, but there's no point in doing
the work in the first place.
2015-05-19 15:27:29 +01:00
Rui Matos
9268bb9144 x11: Fix touchpad detection
Commit 79849ef1d5fff9acd310cd68d59df0c7cf2cb28f had a typo in the
device property format check. This property is formated in 8-bit
items, not 32-bit.

This went unnoticed till now because some touchpads were still being
detected as such due to a second check below:

      else if (strstr (name, "touchpad") != NULL)
        source = CLUTTER_TOUCHPAD_DEVICE;

https://bugzilla.gnome.org/show_bug.cgi?id=749482
2015-05-18 11:43:58 +02:00
Matthieu Bouron
8aea8bc463 clutter-backend-gdk: Only set setting on successful gdk_screen_get_setting call
It could happen that gdk_screen_get_setting fails to retreive
Gdk/WindowScalingFactor which leads to the following warnings when
clutter_init is called:

GLib-GObject-WARNING **: value "0" of type 'gint' is invalid or out of range for property 'window-scaling-factor' of type 'gint'
GLib-GObject-WARNING **: value "0" of type 'gint' is invalid or out of range for property 'dnd-drag-threshold' of type 'gint'

https://bugzilla.gnome.org/show_bug.cgi?id=749256

Slightly edited to fix up whitespace issues.

Edited-by: Emmanuele Bassi <ebassi@gnome.org>
2015-05-12 11:14:14 +01:00
Emmanuele Bassi
8fc8a73580 gdk: Use RGBA visual if there is one
The condition check for the has_rgba_visual flag is reversed, and thus
we relied on drivers returning an ARGB visual first by default.

Referenced by: https://bugzilla.redhat.com/show_bug.cgi?id=1206960
2015-05-07 13:28:33 +01:00
Emmanuele Bassi
9584b23958 docs: Fix typo in ClutterStage::deactivate 2015-05-01 16:51:12 +01:00
Emmanuele Bassi
54a2a20e38 actor: Remove trailing new line
The debug messages have a new line by default.
2015-04-30 12:42:44 +01:00
Emmanuele Bassi
8b8aa0b492 actor: Use the real opacity when clearing the stage
The paint opacity for a top level is always overridden to be the full
value, since it's a composited value and we want to paint our scene.

When clearing the stage framebuffer, though, we want to use the actual
opacity, if ClutterStage:use-alpha is set.
2015-04-30 12:40:39 +01:00
Jasper St. Pierre
21ce9bc08b clutter-stage-cogl: Match EGL's behavior of eglSwapBuffersWithDamage
-1 is explicitly an invalid value to pass to eglSwapBuffersWithDamage,
and the specification admits as much:

                                                         If
    eglSwapBuffersWithDamageEXT is called and <n_rects>, is less
    than zero or <n_rects> is greater than zero but <rects> is
    NULL, EGL_BAD_PARAMETER is generated.

Fix up our usage of SwapBuffersWithDamage to match the behavior in the
EGL specification.

https://bugzilla.gnome.org/show_bug.cgi?id=745512
2015-04-29 22:41:58 +01:00
Emmanuele Bassi
dac33c5fea Stop using macros for accessing actor state
Use the newly added functions instead.
2015-04-23 17:39:30 +01:00
Emmanuele Bassi
4c6a550d13 Soft-deprecation of actor state macros
These are just terrible API that we've been stringing along since the
0.x days. We cannot truly deprecate them, because they are, in some
cases, the only actual API to perform some operation, and porting all
the code in the world is not going to make us any friends.

For the time being, we use a deprecation notice in the documentation.
2015-04-14 12:46:49 +01:00
Emmanuele Bassi
849607316a actor: Add functions mapping to state query macros
The macros are useless for language bindings, and are terribly unsafe
from C as well. There's always the option of using the GObject
properties they refer to, but it's more efficient to just have a simple
getter function.
2015-04-14 12:37:42 +01:00
Emmanuele Bassi
4006b8524d Add version macros for 1.24 2015-04-14 12:29:58 +01:00
Emmanuele Bassi
877e58a6b4 x11: Plug a leak on error path
If XIGetProperty() does not return what we expect, but still returned
something, we need to free it.
2015-04-09 12:35:23 +01:00
Emmanuele Bassi
83cd36e95f x11: Improve touchpad detection heuristics
We should use the same heuristics used by GDK in order to detect whether
a device is a touchpad or not.

Based on the similar code from Carlos Garnacho for GDK:
https://git.gnome.org/browse/gtk+/commit/?id=6f07d5e7

https://bugzilla.gnome.org/show_bug.cgi?id=747436
2015-04-09 11:03:16 +01:00
Emmanuele Bassi
d362e373bb actor: Fix a compiler warning 2015-03-23 13:24:52 +00:00
Emmanuele Bassi
505801cd09 gdk: Fix stage removal from the master clock
Prevents a double-free in the conformance test suite.
2015-03-23 13:24:44 +00:00
Emmanuele Bassi
4f8643cea3 gdk: Fix mapping between frame clock and stages
While each stage has at most a GdkFrameClock, the same GdkFrameClock
instance may drive multiple stages per frame. This means that the
mapping between a GdkFrameClock and a ClutterStage is a 1:M one, not a
1:1.

We should store a list of stages associated to each frame clock
instance, so that we can iterate over it when we need to update the
stages.

This commit fixes redraws of applications using multiple stages,
especially when using clutter-gtk.
2015-03-23 11:00:00 +00:00
Florian Müllner
38c4807230 cally-actor: Don't assume X11 backend is used when supported
_cally_actor_get_top_level_origin() uses a compile time check
without runtime check, which will obviously fail when another
backend like wayland is used.

https://bugzilla.gnome.org/show_bug.cgi?id=746575
2015-03-23 11:00:00 +00:00
Jonas Ådahl
615b0f46ae evdev: Keep track of the pointer coordinate ourself
When multiple relative motion events are received and queued, we can't
base the relative => absolute motion conversion off of the stage pointer
position, since that is only updated when the queue is processed at
the beginning of each frame. The effect of trying to use the stage
pointer position was that subsequent motion events were effectively
dropped.

To improve things, switch to keeping track of the pointer position
ourselves in the evdev backend and adding to that.

This has the side effect of making the internal function
_clutter_input_device_set_coords not effect the internal coordinate
state of the evdev stage, but AFAICS there is nothing depending on that
so that should be fine.

https://bugzilla.gnome.org/show_bug.cgi?id=746328
2015-03-18 22:45:38 +08:00
Emmanuele Bassi
83caeaae9b stage-cogl: Abort realize() if there's no CoglContext
There's no point in trying to go ahead if we don't have a context to
create the CoglOnscreen framebuffer, and Cogl will crash anyway if we
pass NULL to the constructor.
2015-03-17 13:47:08 +00:00
Emmanuele Bassi
ce2d86515a rectangle: Fix the border drawing conditions
And reorganize the code a bit while we're at it.
2015-03-15 15:10:31 +00:00
Chris Wilson
239280f855 stage-cogl: Fix damage tracking with varying buffer ages
With server-side buffer allocation, buffers may be returned out of order
(e.g. they may be held onto by external references or hardware). As such
we may see older buffers the frame after we discard the history from
seeing a very young buffer. To overcome this we want to keep the history
in a ring so we can keep track of older entries without keeping an
unbounded list. After converting to a ring, the maximum buffer age
observed during testing was 5 (expected value of 4), but before we could
see ages as high as 9 due to the huge latency spikes caused by doing full
buffer redraws (compounded by external listeners doing readback on the
damaged areas, for example vnc, drm/udl, prime). For this reason, a
maximum age of 16 was chosen to be suitably large enough to prevent these
worst cases from taxing the system.

v2: Fix off-by-one in combining the damage histroy into the clipping
rectangle, and apply copious whitespace fixes.

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=745512
References: https://bugzilla.gnome.org/show_bug.cgi?id=724788
References: https://bugzilla.gnome.org/show_bug.cgi?id=669122
2015-03-15 14:46:42 +00:00
Chris Wilson
55c957267e stage-cogl: Use swap buffers with damage
cogl provides an interface to pass along damage with the swap buffers
request. This is useful for the display servers and hardware to minimise
the work done in updating the screen and also reducing the work done by
external listeners (such as vnc, drm/udl and PRIME).

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=745512
2015-03-15 14:45:53 +00:00