Commit Graph

7311 Commits

Author SHA1 Message Date
Carlos Garnacho
a270b6a2ce clutter: Drop _clutter_clear_events_queue_for_stage()
There's only one stage. Let's not overcomplicate things, as it
will not be possible to simply go through the event queue inspecting
every event.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1448
2020-09-23 16:49:32 +02:00
Jonas Ådahl
6e3ecadb79 backends/native: Fall back to compositing if direct scanout failed
Even when a direct client buffer has a compatible format, stride and
modifier for direct scanout, drmModePageFlip() may still fail sometimes.

From testing, it has been observed that it may seemingly randomly fail
with ENOSPC, where all subsequent attempts later on the same CRTC
failing with EBUSY.

Handle this by falling back to flipping after having composited a full
frame again.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1410
2020-09-17 12:17:35 +00:00
Marco Trevisan (Treviño)
aa56595b31 clutter-backend-x11: Don't set the font-dpi computed on X11 parameters
We already correctly set the font-dpi based on user settings in
MetaSettings at each user change and as part of backend initialization,
so there's no point to set it also during x11 backend post-parsing and
using X11 values, as this may happen at later point and lead to a wrong
clutter font DPI value.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1444
2020-09-17 11:37:43 +02:00
Georges Basile Stavracas Neto
9e011958d4 clutter/stage: Add new before_paint signal hook
It'll allow subclasses to get notified of the before-paint
signal without having to connect to it. This will allow
MetaStage to have proper watches being fired there without
the cost of the signal handling machinery.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1421
2020-09-01 13:05:29 -03:00
Georges Basile Stavracas Neto
098360f2c2 clutter/stage-view: Add method to peek scanout
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1421
2020-09-01 13:05:28 -03:00
Florian Müllner
6b04b2ff60 clutter/backends: Rename master and slave devices
Just because X11/XI uses a particular terminology doesn't mean we
have to use the same terms in our own API. The replacement terms
are in line with gtk@1c856a208, which seems a better precedent
for consistency.

Follow-up to commit 17417a82a5.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1425
2020-08-31 21:07:03 +02:00
Carlos Garnacho
51760692b0 clutter: Push commit/delete_sourrounding as IM events
These are not given directly to the input focus anymore, instead
queued up as events. This way, all actions triggered by the input
method (commit and preedit buffer ones, but also synthesized key
events) queue up the same way, and are thus processed in the exact
same order than they are given to us.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1286
2020-08-31 08:40:12 +00:00
Carlos Garnacho
fb6ff75a97 clutter: Prepare input focus for IM event delivery
The clutter_input_focus_filter_key_event() function has been made
a more generic filter_event(). Besides its old role about letting
key events go through the IM, it will also process the IM events
that are possibly injected as a result.

Users have been updated to these changes.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1286
2020-08-31 08:40:12 +00:00
Carlos Garnacho
d3b845902e clutter: Add IM events
These will be used to make IM commands into something that is processed
in a fixed order relative to key events.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1286
2020-08-31 08:40:12 +00:00
Daniel van Vugt
a1dd3c43fb clutter-actor: Cull actors that don't intersect the redraw clip
Previously we only culled actors that didn't intersect the bounding box
of the redraw clip. Now we also cull those whose paint volume bounds don't
intersect the arbitrary shape of the redraw clip.

This was inspired by the activities overview where idle windows and
workspace previews were being needlessly repainted. In that particular
case this yields more than 10% reduction in render time. But it probably
helps in other situations too.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1359
2020-08-30 11:49:09 +00:00
Marco Trevisan (Treviño)
cf67c54f87 clutter-seat: Handle device events and emit signals
Clutter device events are special events coming from the backend when an
input device is added or removed.

When such events are processed, we should make the seat to handle them by
calling vfunc that can be implemented by each backend and eventually
emitting the appropriate signal.

If a device is removed, we can also safely dispose it, as it can be
considered stale at this point.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1371
2020-08-29 09:33:54 +00:00
Marco Trevisan (Treviño)
928b32b1a1 clutter-event: Add device added/removed events
Add clutter device added and removed events to allow processing of them as
it happens in the backends, queuing them and performing actions in order.

This allows not to loose any event that is performed just before removing or
disabling a device, and still process the events in order in the event
queue.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1371
2020-08-29 09:33:54 +00:00
Björn Daase
5ec9bde64f *: Fix spelling mistakes found by codespell
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1410
2020-08-29 09:10:31 +00:00
Jonas Ådahl
a1daf0ab24 stage-view: Don't destroy onscreen until finalizing
There might be pending flip callbacks to process; we shouldn't release
the buffers until we have received the callback.

Fixes https://gitlab.gnome.org/GNOME/mutter/-/issues/1378

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1407
2020-08-17 10:29:05 -03:00
Jonas Ådahl
3dfe3a248d stage-view/cogl: Add frame listener in constructor()
The onscreens are set on construction now, so no need to wait for it to
be set after.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1407
2020-08-17 13:13:55 +00:00
Jonas Ådahl
3d54f973ce clutter/main: Remove unused "fuzzy picking" option
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 17:51:56 +02:00
Jonas Ådahl
678e1fcd47 clutter/stage: Remove clutter_stage_new()
It's never expected that anything creates its own stage directly, so
remove the constructor function.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 17:51:56 +02:00
Jonas Ådahl
e848414f89 clutter: Remove main loop helper
It's expected to always use meta_*() or your own main loop.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 17:51:56 +02:00
Jonas Ådahl
961a1376cd clutter: Remove 'eglnative' backend layer
It's completely empty, so remove it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 17:51:56 +02:00
Jonas Ådahl
72a389ef12 clutter/egl: Remove unused clutter_egl_get_egl_display()
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 17:51:56 +02:00
Jonas Ådahl
3566fa7bb0 clutter/main: Remove checking windowing system
Last user in gnome-shell removed with
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1358.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 17:51:56 +02:00
Jonas Ådahl
c2a155f767 clutter: Remove support not specifying backend
This was from the old clutter-as-application-library days, where it had
to try find a suitable backend. Now we already have a backend selected
(MetaBackend), and the clutter backend is already predecided depending
on that, so we don't need the code that auto detects an appropriate one
anymore.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 17:51:56 +02:00
Jonas Ådahl
ebfa94f360 clutter/eglnative: Remove unused source field
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 14:45:10 +02:00
Jonas Ådahl
5279e9a922 clutter/eglnative: Remove unused timer
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 14:45:10 +02:00
Jonas Ådahl
3958a019bb clutter: Move font settings reading to ClutterSettings
There is no reason to use Xsettings for the X11 backend, as it comes
from the GSetting store anyway, so move the font setting reading to
ClutterSettings and read directly from GSettings.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 14:45:10 +02:00
Jonas Ådahl
7e97268592 clutter/x11: Remove helper for checking XComposite presence
It's not used by anything.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 14:45:10 +02:00
Jonas Ådahl
d857edf09c clutter: Remove support for transparent windows
We're only ever a compositor, so we're never asking to be transparent.
Thus remove support for requesting to paint to GLX or EGL displays with
an alpha channel.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 14:45:10 +02:00
Jonas Ådahl
28cb025190 clutter: Remove DELETE event, signal and vfunc
The delete event was used for signalling the close button was clicked on
clutter windows. Being a compositor we should never see these, unless
we're running nested. Remove the plumbing of the DELETE event and just
directly call meta_quit() when we see it, if we're running nested.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 14:45:10 +02:00
Jonas Ådahl
c7429e8aad clutter/main: Use "is display server" state to decide a11y routing
We checked if we were using the usig the X11 backend to decide when to
deal with a11y event posting - in order to make the clutter code less
windowing system dependent, make this check a check whether we're a
display server or not, in contrast to a window/compositing manager
client. This is made into a vfunc ot ClutterBackendClass, implemented by
MetaClutterBackendNative and MetaClutterBackendX11.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 14:45:10 +02:00
Jonas Ådahl
06c4841e22 clutter/timeline: Listen to 'stage-view-changed' on picked actor
When we pick the frame clock given the associated actor, that frame
clock in fact comes from a picked actor. In order to not end up with
stale frame clocks, which may happen on e.g. hotplugs, monitor layout
changes, or non-optimal frame clocks, which may happen when the parent
used for picking the clock moves to another view, lets listen to
'stage-views-changed' on the actor used for picking the clock too.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1327
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1404
2020-08-13 06:34:05 +00:00
Jonas Ådahl
07e964e9fc clutter/actor: Return the actor used when picking clock
The actor used might be relevant, so that e.g. if it moves or for some
other reason changes stage views, the user can listen for that.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1404
2020-08-13 06:34:05 +00:00
Jonas Ådahl
9bcb03ab48 clutter/actor: Make frame clock picking semi private API
Let's not expose that outside of mutter quite yet; it's not used in
gnome-shell, and to avoid future breakage if it starts to be used, lets
move it to clutter-mutter.h so only mutter and clutter itself can use
it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1404
2020-08-13 06:34:04 +00:00
Jonas Ådahl
fb0f03640a stage-view: Add clutter_stage_view_destroy()
This aims to make sure a view and its resources are destroyed when it
should. Using references might keep certain components (e.g frame clock)
alive for too long.

We currently don't take any long lived references to the stage view
anywhere, so this doesn't matter in practice, but this may change, and
will be used by a to be added test case.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1404
2020-08-13 06:34:04 +00:00
Jonas Ådahl
a13c307fa4 frame-clock: Fix indentation
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1404
2020-08-13 06:34:04 +00:00
Jonas Ådahl
a80b0f34e3 clutter: Remove old split capture based screen shooting API
This is no longer used, and the replacement (clutter_stage_paint_to_*())
should be used instead.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
Jonas Ådahl
1743887fa7 clutter: Expose clutter_stage_paint_to_(frame)buffer()
This will be used by GNOME Shell to take screenshots.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
Jonas Ådahl
b4a8247191 screen-cast: Track and always record cursors
Always force-track the cursor position (so that the X11 backend can keep
it up to date), and if the cursor wasn't part of the sampled
framebuffer when reading pixels into CPU memory, draw it in an extra
pass using cairo after the fact. The cairo based cursor painting only
happens on the X11 backend, as we otherwise inhibit the hw cursor.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
Jonas Ådahl
eeee7bed1d cursor-tracker: Add way to force tracking cursor position
On X11 we won't always receive cursor positions, as some other client
might have grabbed the pointer (e.g. for implementing a popup menu). To
make screen casting show a somewhat correct cursor position, we need to
actively poll the X server about the current cursor position.

We only really want to do this when screen casting or taking a
screenshot, so add an API that forces the cursor tracker to track the
cursor position.

On the native backend this is a no-op as we by default always track the
cursor position anyway.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
Daniel van Vugt
2de69cd3cc clutter-offscreen-effect: Invalidate cache on gl-video-memory-purged
This fixes graphics corruption that could occur on resume from suspend
with the Nvidia driver.

https://www.khronos.org/registry/OpenGL/extensions/NV/NV_robustness_video_memory_purge.txt

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1374
2020-08-05 08:26:37 +00:00
Daniel van Vugt
305fcd0713 clutter-stage: Add gl-video-memory-purged signal
For when you want parts of Clutter to connect to the signal, without
referencing Meta classes.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1374
2020-08-05 08:26:37 +00:00
Daniel van Vugt
593e610415 clutter: Remove unused flag CLUTTER_FEATURE_SWAP_THROTTLE
It's been unused ever since e415cc538a.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1390
2020-08-04 08:43:57 +00:00
Daniel García Moreno
109fbdbac9 clutter/actor: Add get_transformed_extents
The clutter_actor_get_transformed_position returns the position of the
top left point of the actor, with the actor transformations. That means
that if the actor is rotated 180º it'll return the "screen" position top
right.

Using this to calculate if the actor is in the screen is causing
problems when it's transformted.

This patch adds a new function clutter_actor_get_transformed_extents,
that will return the transformed actor bounding rect.

This new function is used on the update_stage_views so the actor will
get updated. this way rotated actors will be updated if they are on the
screen.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1386
2020-07-29 11:12:26 +02:00
Olivier Fourdan
d0ee02fae7 cleanup: Remove duplicate semicolons in C code
No functional change, it just hurts my eyes when reading the code.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1385
2020-07-28 10:32:46 +02:00
Jonas Dreßler
03d177cf64 clutter/actor: Add position argument to allocate_preferred_size()
Make clutter_actor_allocate_preferred_size() convenient to use from
layout managers by not "automatically" honouring the fixed position of
the actor, but instead allowing to pass a position to allocate the
actor at.

This way we can move the handling of fixed positions to
ClutterFixedLayout, the layout manager which is responsible for
allocating actors using fixed positions.

This also makes clutter_actor_allocate_preferred_size() more similar to
clutter_actor_allocate_available_size().

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1310
2020-07-07 16:47:00 +00:00
Jonas Dreßler
dfa235aa5d clutter/actor: Add API to get fixed position
It's currently a bit hard to get the fixed position of an actor. It can
be either done by using g_object_get() with the "fixed-x"/"fixed-y"
properties or by calling clutter_actor_get_position().

Calling clutter_actor_get_position() can return the fixed position, but
it might also return the allocated position if the allocation is valid.
The latter is not the best behavior when querying the fixed position
during an allocation, so introduce a new function
clutter_actor_get_fixed_position() which always gets the fixed position
and returns FALSE in case no fixed position is set.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1310
2020-07-07 16:47:00 +00:00
Jonas Dreßler
249274c677 clutter/actor: Pass stage as user_data when unrealizing
We can avoid having to get the stage again for every child of the
subtree we're unrealizing by getting the stage once and passing it as
user_data to the callbacks.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1356
2020-07-06 19:51:35 +00:00
Jonas Dreßler
ae83a61e67 clutter/actor: Remove actors from shallow relayout list when unrealizing
With the introduction of the shallow relayout mechanism another small
but severe regression sneaked into our layout machinery: We might
allocate an actor twice during the same allocation cycle, with one
allocation happening using the wrong parent.

This issue happens when reparenting an actor from a NO_LAYOUT parent to
a non-NO_LAYOUT parent, in particular it triggered a bug in gnome-shell
when DND reparents a child from the NO_LAYOUT uiGroup to the overviews
Workspace actor after a drag ended. The reason the issue happens is the
following chain of events:

1. child of a NO_LAYOUT parent queues a relayout, this child is added to
the priv->pending_relayouts list maintained by ClutterStage

2. child is reparented to a different parent which doesn't have the
NO_LAYOUT flag set, another relayout is queued, this time a different
actor is added to the priv->pending_relayouts list

3. the relayout happens and we go through the pending_relayouts list
backwards, that means the correct relayout queued during 2. happens
first, then the old one happens and we simply call
clutter_actor_allocate_preferred_size() on the actor, that allocation
overrides the other, correct one.

So fix that issue by adding a method to ClutterStage which removes
actors from the pending_relayouts list again and call this method as
soon as an actor with a NO_LAYOUT parent is detached from the stage.

With that in place, we can also remove the check whether an actor is
still on stage while looping through pending_relayouts. In case
something else is going wrong and the actor is not on stage,
clutter_actor_allocate() will warn anyway.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1356
2020-07-06 19:51:35 +00:00
Daniel van Vugt
dbff32ec5c clutter-backend: Default to scale 1
So we at least don't trigger assertions for invalid scales of zero.

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

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1349
2020-07-03 19:57:30 +00:00
Jonas Ådahl
06781985e4 clutter/timeline: Warn if started with a detached actor
The timeline can't find a frame clock if the actor is detached, so warn
if that happens.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 20:13:53 +02:00
Georges Basile Stavracas Neto
5b0a7b3a33 clutter/timeline: Wait for stage if no frame clock is available
When picking which frame clock to use, we traverse up in the actor
hierarchy until a suitable frame clock is found. ClutterTimeline
also listens to the 'stage-views-changed' to make sure it's always
attached to the correct frame clock.

However, there is one special situation where neither of them would
work: when the stage doesn't have a frame clock yet, and the actor
of the timeline is outside any stage view. When that happens, the
returned frame clock is NULL, and 'stage-views-changed' is never
emitted by the actor.

Monitor the stage for stage view changes when the frame clock is
NULL.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:51 +02:00