Commit Graph

6319 Commits

Author SHA1 Message Date
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