Commit Graph

6882 Commits

Author SHA1 Message Date
Marco Trevisan (Treviño)
c9c53cb55f clutter/actor: Cancel delayed timelines on removal
Delayed clutter timelines might be removed while they are still in the
process of being executed, but if they are not playing yet their delay
timeout won't be stopped, causing them to be executed anyway, leading to a
potential crash.

In fact if something else keeps a reference on the timelines (i.e. gjs), the
dispose vfunc delay cancellation won't take effect, causing the timelines to
be started and added to the master clock.

To avoid this, expose clutter_timeline_cancel_delay() function and call it
if a timeline is not playing but has a delay set.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/815
https://gitlab.gnome.org/GNOME/mutter/merge_requests/805
2019-09-20 16:51:20 +02:00
Marco Trevisan (Treviño)
1e637bd7e1 clutter/timeline: Don't emit ::paused signal on delayed timelines
If a timeline is delayed and we request to stop or pause it, we are emitting
the "::paused" signal on it, however this has never been started, and so
nothing has really be paused.

So, just try to cancel the delay on pause and return if not playing.

No code in mutter or gnome-shell is affected by this, so it is safe to
change.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/805
2019-09-20 16:51:20 +02:00
Marco Trevisan (Treviño)
63a0b702c9 clutter/timeline: Use a function to cancel the delay timeout
Avoid repeating the same code for canceling the delay timeout, using a
function for later uses.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/805
2019-09-20 16:51:20 +02:00
Marco Trevisan (Treviño)
b69d2aa6a0 stage: Compute view perspective when parameters changed
Clutter stage used to compute the initial projection using a fixed z
translation which wasn't matching the one we computed in
calculate_z_translation().
This caused to have a wrong initial projection on startup which was then
correctly recomputed only at the first paint.

However, since this calculation doesn't depend on view, but only on viewport
size, perspective's fovy and z_near we can safely do this at startup and
only when any of those parameters change.

Then we can move the computation out _clutter_stage_maybe_setup_viewport()
since the cogl framebuffer viewport sizes aren't affecting this.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1639
https://gitlab.gnome.org/GNOME/mutter/merge_requests/803
2019-09-20 13:51:33 +02:00
Daniel van Vugt
0b19078b2b clutter/stage-cogl: Use portable formatting for 64-bit integers
On 64-bit systems int64_t is %ld but on 32-bit systems it is %lld.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/778
2019-09-20 11:55:32 +02:00
Daniel van Vugt
7811865e84 clutter/paint-node: Convert safely from pointer to integer
To support 32-bit systems without compiler warnings.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/778
2019-09-20 11:55:25 +02:00
Jonas Dreßler
ab7af2d0c5 clutter/actor: Remove unused private function
`_clutter_actor_get_transition` is almost identical to
`clutter_actor_get_transition` and isn't used anywhere in the code (we
stopped using it with ee00e37b), remove it!

https://gitlab.gnome.org/GNOME/mutter/merge_requests/791
2019-09-12 21:36:02 +00:00
Jonas Dreßler
f92e0bec0b clutter/actor: Fix a wrong comment
According to the definition of ClutterAnimationInfo in
clutter-actor-private.h, `transitions` is the third variable of the
struct, not the first one.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/791
2019-09-12 21:36:02 +00:00
Olivier Fourdan
2f072af02b clutter/input-pointer-a11y: Restore pointer a11y on resume
When suspending, the devices are removed and the virtual device
associated with the corresponding core pointer is disposed.

Add the pointer accessibility virtual device to the core pointer
on resume to restore pointer accessibility on resume if enabled.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/761
2019-09-02 17:27:17 +00:00
Daniel van Vugt
14c706e51b clutter: Introduce geometric picking
Currently, Clutter does picking by drawing with Cogl and reading
the pixel that's beneath the given point. Since Cogl has a journal
that records drawing operations, and has optimizations to read a
single pixel from a list of rectangle, it would be expected that
we would hit this fast path and not flush the journal while picking.

However, that's not the case: dithering, clipping with scissors, etc,
can all flush the journal, issuing commands to the GPU and making
picking slow. On NVidia-based systems, this glReadPixels() call is
extremely costly.

Introduce geometric picking, and avoid using the Cogl journal entirely.
Do this by introducing a stack of actors in ClutterStage. This stack
is cached, but for now, don't use the cache as much as possible.

The picking routines are still tied to painting.

When projecting the actor vertexes, do it manually and take the modelview
matrix of the framebuffer into account as well.

CPU usage on an Intel i7-7700, tested with two different GPUs/drivers:

  |         |     Intel | Nvidia |
  | ------: | --------: | -----: |
  | Moving the mouse:            |
  | Before  |       10% |    10% |
  | After   |        6% |     6% |
  | Moving a window:             |
  | Before  |       23% |    81% |
  | After   |       19% |    40% |

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/154,
        https://gitlab.gnome.org/GNOME/mutter/issues/691

Helps significantly with: https://gitlab.gnome.org/GNOME/mutter/issues/283,
                          https://gitlab.gnome.org/GNOME/mutter/issues/590,
                          https://gitlab.gnome.org/GNOME/mutter/issues/700

v2: Fix code style issues
    Simplify quadrilateral checks
    Remove the 0.5f hack
    Differentiate axis-aligned rectangles

https://gitlab.gnome.org/GNOME/mutter/merge_requests/189
2019-09-02 16:41:13 +00:00
Daniel van Vugt
a70823dd1c clutter/point: Add ClutterPoint quarilateral testing API
Add a function to check whether a point is inside a quadrilateral
by checking the cross product of vectors with the quadrilateral
points, and the point being checked.

If the passed quadrilateral is zero-sized, no point is ever reported
to be inside it.

This will be used by the next commit when comparing the transformed
actor vertices.

[feaneron: add a commit message and remove unecessary code]

https://gitlab.gnome.org/GNOME/mutter/merge_requests/189
2019-09-02 16:41:13 +00:00
Jonas Ådahl
97140ab634 Revert "clutter/stage-cogl: Remove pending_swaps counter"
This reverts commit f57ce7254d.

It causes crashes, https://gitlab.gnome.org/GNOME/mutter/issues/735, and
changes various expectations relied upon by the renderer code, and being
close to release, it's safer to revert now and reconsider how to remove
the pending swap counter at a later point.
2019-08-27 20:16:01 +03:00
Jonas Dreßler
a51437ee2b clutter/input-pointer-a11y: Include success boolean in stop signals
Add a boolean parameter to the signal to inform the handler whether the
timeout completed successfully or not. This allows the shell to
gracefully end the pie timer animation and show a success animation when
the click happens.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/745
2019-08-27 07:36:57 +00:00
Olivier Fourdan
b8dcd5f842 clutter/main: Ignore synthetic events for accessibility
When a dwell click causes the pointer to move to another surface, a
synthetic event is generated which triggers another dwell click.

Make sure we ignore those to avoid dwell clicking twice in a raw.

Suggested-by: Carlos Garnacho <carlosg@gnome.org>
https://gitlab.gnome.org/GNOME/mutter/merge_requests/747
2019-08-24 12:43:20 +03:00
Olivier Fourdan
14e02635ff clutter/input-pointer-a11y: Trigger dwell detection in a timeout
Restarting the dwell click immediately would result in a contant
animation showing.

Start dwell detection in its own timeout handler, which has the nice
effect of not constantly showing a dwell animation and also making sure
that the dwell click timeout is started when pointer movement stops.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/747
2019-08-24 12:43:20 +03:00
Jonas Dreßler
9b3b5badfb clutter/input-pointer-a11y: Fix dwell timeout start after moving pointer
Sometimes the dwell timeout doesn't start again after quickly moving the
pointer. That happens if `should_stop_dwell` returns TRUE for the last
motion event we receive: It will stop the current timeout, but not start
a new one until we receive another event where the moved distance is
smaller than the threshold.

To fix this, always call `should_start_dwell` and `start_dwell_timeout`
instead of using an else-block, this makes sure we start a new dwell
timeout still during the same motion event that stopped the old one.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/746
2019-08-24 09:25:14 +00:00
Jonas Dreßler
47c1558287 clutter/input-pointer-a11y: Remove unneeded character
https://gitlab.gnome.org/GNOME/mutter/merge_requests/746
2019-08-24 09:25:14 +00:00
Carlos Garnacho
cc7e843c44 tests: Move clutter-test-utils.[ch] to src/tests
And add the necessary glue so those initialize a X11 clutter backend.
This should get Clutter tests that are dependent on windowing to work
again, thus they were enabled back again.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00
Carlos Garnacho
cfb8f18cef clutter: Move tests to src/tests
Clutter doesn't hold anymore backend implementations, move tests where
we have one that we may assign.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00
Carlos Garnacho
8b03d9ecc3 clutter: Move evdev input to src/backends/native
The end goal is to have all clutter backend code in src/backends. Input
is the larger chunk of it, which is now part of our specific
MutterClutterBackendNative, this extends to device manager, input devices,
tools and keymap.

This was supposed to be nice and incremental, but there's no sane way
to cut this through. As a result of the refactor, a number of private
Clutter functions are now exported for external backends to be possible.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00
Carlos Garnacho
ea54ce7d96 clutter: Drop functions to get XVisualInfo
We don't need nor use visuals anymore.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00
Carlos Garnacho
cb31e3e12a clutter: Drop unused function to translate to screen coordinates
We don't have anything like GdkInputMode that we'd like to honor, this
can just be dropped.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00
Carlos Garnacho
ad72fa46b0 clutter: Move X11 input to src/backends/x11
The end goal is to have all clutter backend code in src/backends. Input
is the larger chunk of it, which is now part of our specific
MutterClutterBackendX11, this extends to device manager, input devices,
tools and keymap.

This was supposed to be nice and incremental, but there's no sane way
to cut this through. As a result of the refactor, a number of private
Clutter functions are now exported for external backends to be possible.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00
Carlos Garnacho
fa4580de53 clutter: Temporarily comment out clutter tests
It will be enabled back in later commits. We're set for quite a ride
here.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00
Carlos Garnacho
5e343e2c16 clutter: Remove support for foreign stages
We have no use for this.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00
Carlos Garnacho
ef93bb6471 clutter: Remove event retrieval toggle
This is x11-specific API that was added back when clutter was out
of tree. Just remove it and directly do what we want.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00
Carlos Garnacho
d6aaef9954 clutter: Drop _() define
It's an unused no-op, we can do without it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00
Carlos Garnacho
2ca351366e clutter/cally: Remove needless per-backend code in cally
We can poke the X11 stage to translate to root coordinates, or just assume
the compositor will cover the root window area and avoid per-backend behavior
here.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00
Carlos Garnacho
f54bf022bd clutter: Remove ClutterEventExtender interface
Just move those methods to ClutterDeviceManager, since the two available
ones want to implement it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:07 +00:00
Carlos Garnacho
e56df455ae clutter: Drop ClutterEventTranslator interface
We don't need that much complexity when we have a fixed set of
translators, and only one of them wants a given event.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:07 +00:00
Carlos Garnacho
54101b1948 clutter: Use G_DECLARE_DERIVABLE_TYPE for ClutterDeviceManager
https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:07 +00:00
Carlos Garnacho
829d9c863c clutter: Move scattered x11 keymap code into ClutterKeymapX11
https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:07 +00:00
Carlos Garnacho
f304fa4869 Drop xinput2 version checks
We always request XInput >= 2.3 and fail otherwise, we don't need to
check for lower versions for touch events.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:07 +00:00
Carlos Garnacho
a32559e5ae clutter: Remove "has_xinput" x11 API
We always must have xinput, this is moot now.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:07 +00:00
Georges Basile Stavracas Neto
e33d6b2908 clutter/paint-node: Expose clutter_paint_node_get_framebuffer()
Mutter needs to know which framebuffer the paint nodes will be
drawn into, and using cogl_get_draw_framebuffer() directly is
not an option since ClutterRootNode only pushes the draw fb
at draw time.

Expose clutter_paint_node_get_framebuffer().

https://gitlab.gnome.org/GNOME/mutter/merge_requests/409
2019-08-23 13:23:07 +00:00
Daniel van Vugt
5c617ac286 clutter/stage: Only queue compressible events
Incompressible events already pass through unmodified, so queuing them
just wasted time and memory.

We would however like to keep the ordering of events so we can only
apply this optimization if the queue is empty.

This reduces the input latency of incompressible events like touchpad
scrolling or drawing tablets by up to one frame. It also means the same
series of events now arrives at the client more smoothly and not in
bursts.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/711
2019-08-20 23:52:49 +00:00
Daniel van Vugt
bc08ad2fbb clutter/device-manager-evdev: Update device modifiers before queuing
Until now we would:

  1. Enqueue modifier key event on the stage.
  2. Update device modifier state.
  3. Dequeue and process modifier key event with NEW device modifier state.

But if we consider optimizing out the queuing in some cases then there
will become a problem:

  1. Process modifier key event with OLD device modifier state.
  2. Update device modifier state.

To correct the above we now do:

  1. Update device modifier state.
  2. Queue/process modifier key event with NEW device modifier state.

It appears commit dd940a71 which introduced the old behaviour was correct
in the need to update the device modifier state, but is at least no longer
correct (if it ever was) that it should be done after queuing the event.
If queuing is working, as it is right now, then it makes no difference
whether the device modifier state is updated before or after. Because both
cases will come before the dequeing and processing.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/711
2019-08-20 23:52:49 +00:00
Jonas Dreßler
0947bc37d3 clutter/main: Move grabbing functions to clutter-input-device.c
Thanks to the now removed global/context grabs, we can move pointer and
keyboard grabs back home to where they belong.

While at it, also add handling of CLUTTER_TABLET_DEVICE devices to
`on_grab_actor_destroy` and `clutter_input_device_get_grabbed_actor`.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/536
2019-08-20 14:11:38 +02:00
Jonas Dreßler
959eb98090 clutter/main: Remove global/context grabs
Those are deprecated in favour of per device grabs.

Also switch to ClutterInputDevice grabs for the grab test.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/536
2019-08-20 14:08:44 +02:00
Jonas Dreßler
32dcf77a8f clutter/text: Switch to input device grabs
The old global/context grabs are being removed in favour of input device
grabs.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/536
2019-08-20 14:08:44 +02:00
Niels De Graef
9d65eab549 clutter: Use va_marshaller for Actor signals
If possible, GLib will try to use the va_marshaller to pass the signal
arguments, rather than unboxing into and out of a `GValue`. This is much
more performant and especially good for often-thrown signals.

The original bug even mentions Clutter performance issues as a drive to
implement the va_marshaller in GLib (see
https://bugzilla.gnome.org/show_bug.cgi?id=661140).

https://gitlab.gnome.org/GNOME/mutter/merge_requests/700
2019-08-19 13:09:56 +00:00
Niels De Graef
c4a9117ef8 clutter: Remove marshallers that are available in GLib
Some of the marshallers we generate in `clutter-marshal.list` are also
available in GLib, so we don't need to generate them ourselves. Even
more, by passing NULL to `g_signal_new` in these cases will actually
internally optimize this even more by also setting the valist
marshaller, which is a little bit faster than the regular marshalling
using `GValue` and libffi.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/700
2019-08-19 13:09:56 +00:00
Daniel van Vugt
f57ce7254d clutter/stage-cogl: Remove pending_swaps counter
As a protection against duplicate/early update times, it has already
been replaced by commit 35aa2781 and commit 4faeb127.

Removing it also prevents a common cause of frame skips:

  clutter_stage_cogl_schedule_update()
  clutter_stage_cogl_get_update_time() == -1

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1411

https://gitlab.gnome.org/GNOME/mutter/merge_requests/719
2019-08-16 16:44:27 +00:00
Florian Müllner
7ab07b05e9 clutter-actor: Expose layout manager properties to transitions
ClutterActor allows using properties of actions, constraints and effects
in transitions. Extend that functionality to allow the same for the actor's
layout manager.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/716
2019-08-06 23:19:33 +02:00
Florian Müllner
56a5c5e4d1 cleanup: Stop using g_get_current_time ()
It has been deprecated because it isn't Y2k38 ready, so replace it
with g_get_real_time () which is.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/708
2019-08-03 16:12:32 +00:00
Niels De Graef
ddbdb5fa77 clutter: Use g_object_notify_by_pspec()
`g_object_notify()` actually takes a global lock to look up the property
by its name, which means there is a performance hit (albeit tiny) every
time this function is called. For this reason, always try to use
`g_object_notify_by_pspec()` instead.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/703
2019-07-30 13:50:17 +02:00
Florian Müllner
08a3cbfc6c clutter: Force an allocation on clone source if necessary
Since commit 0eab73dc, actors are only allocated when they are actually
visible. While this generally works well, it breaks - because of *course*
it does - ClutterClones when the clone source (or any of its ancestors)
is hidden.

Force an allocation in that case to allow the clone's paint to work as
intended.

https://gitlab.gnome.org/GNOME/mutter/issues/683
2019-07-23 01:38:38 +00:00
Florian Müllner
87c734cef9 cleanup: Really stop using G_TYPE_INSTANCE_GET_PRIVATE()
Commit 4259cfd4c6 missed some occurences, move those to the generated
get_instance_private() functions as well.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/691
2019-07-22 09:48:29 +00:00
Florian Müllner
c755fb6995 clutter-tests: Fix macro definitions
FOO_OBJECT() macros should cast to the corresponding instance type,
not the class.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/691
2019-07-22 09:48:29 +00:00
Florian Müllner
9189b7b512 clutter: Stop using GParameter
The type has been deprecated, so stop using it. The easiest replacement
would be to add our own struct, but considering that separate name/value
arrays are easier to free (g_auto!) and we already do the split in one
place, go that route.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/689
2019-07-18 11:01:09 +02:00