Commit Graph

26640 Commits

Author SHA1 Message Date
Georges Basile Stavracas Neto
a77e1f200b drm-buffer-gbm: Clear framebuffer with g_clear_object
Another fallout of eb14da3874

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1531
2020-10-27 14:32:45 +00:00
Olivier Fourdan
8711d8d591 backend: Keep a refcount on backend's current_device
Otherwise we might run into a use-after-free and crash on (virtual)
device removal:

 Invalid read of size 8
   at clutter_input_device_get_device_type (clutter-input-device.c:811)
   by update_last_device (meta-backend.c:1282)
   by g_main_dispatch (gmain.c:3325)
   by g_main_context_dispatch (gmain.c:4016)
   by g_main_context_iterate.constprop.0 (gmain.c:4092)
   by g_main_loop_run (gmain.c:4290)
   by meta_run_main_loop (main.c:708)
   by meta_run (main.c:723)
   by main (main.c:550)
 Address is 32 bytes inside a block of size 504 free'd
   at free (vg_replace_malloc.c:538)
   by g_type_free_instance (gtype.c:1939)
   by clutter_event_free (clutter-event.c:1420)
   by _clutter_stage_process_queued_events (clutter-stage.c:830)
   by handle_frame_clock_before_frame (clutter-stage-view.c:1064)
   by clutter_frame_clock_dispatch (clutter-frame-clock.c:405)
   by frame_clock_source_dispatch (clutter-frame-clock.c:456)
   by g_main_dispatch (gmain.c:3325)
   by g_main_context_dispatch (gmain.c:4016)
   by g_main_context_iterate.constprop.0 (gmain.c:4092)
   by g_main_loop_run (gmain.c:4290)
   by meta_run_main_loop (main.c:708)
   by meta_run (main.c:723)
 Block was alloc'd at
   at malloc (vg_replace_malloc.c:307)
   by g_malloc (gmem.c:106)
   by g_slice_alloc (gslice.c:1025)
   by g_slice_alloc0 (gslice.c:1051)
   by g_type_create_instance (gtype.c:1839)
   by g_object_new_internal (gobject.c:1939)
   by g_object_new_valist (gobject.c:2264)
   by g_object_new (gobject.c:1782)
   by meta_input_device_native_new_virtual (meta-input-device-native.c:1365)
   by meta_virtual_input_device_native_constructed (meta-virtual-input-device-native.c:705)
   by g_object_new_internal (gobject.c:1979)
   by g_object_new_valist (gobject.c:2264)

Suggested-by: Carlos Garnacho <carlosg@gnome.org>
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1529
2020-10-26 18:19:31 +00:00
Jonas Dreßler
b1700c3f7b clutter/actor: Remove two unused functions in private header
Those two functions are nowhere to be found in our code, so remove those
function headers which were probably forgot during another cleanup.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1528
2020-10-26 17:36:49 +00:00
Jonas Dreßler
84dd6b4af5 clutter/stage: Remove redraw_pending and redraw_count
The redraw_pending boolean is used to schedule the first stage update
after starting Clutter. This flag is superfluous because we have the
pending_finish_queue_redraws flag which does the same.

While at it, also remove the redraw_count debug variable, since there
should be better ways to count the number of queued redraws nowadays,
for example Sysprof marks.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1527
2020-10-26 18:26:30 +01:00
Jonas Dreßler
10392359a9 clutter/actor: Make functions to queue relayout/redraw on clones static
We don't call those functions from outside ClutterActor and we also
shouldn't, so remove them from the private header and define them
statically.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1527
2020-10-26 18:26:28 +01:00
Jonas Dreßler
3ea9217be2 clutter/actor: Remove _clutter_actor_queue_redraw_with_clip()
Queueing a redraw with a clip is easy enough and this function is
private anyway, so remove it and call _clutter_actor_queue_redraw_full()
instead in the one function using it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1527
2020-10-26 18:26:26 +01:00
Jonas Dreßler
8b21fb4f96 clutter: Remove ClutterRedrawFlags
ClutterRedrawFlags are a way to give Clutter additional context
about what it needs to redraw. There currently is only one flag defined,
CLUTTER_REDRAW_CLIPPED_TO_ALLOCATION, this flag would clip the redraw to
the actors current allocation.

Since ClutterActor also provides the clip_to_allocation property (which
affects the paint volume of the actor instead of only one redraw), the
additional CLIPPED_TO_ALLOCATION flag seems unnecessary. It's also only
defined to be used privately in Clutter, which it never is, so let's
remove it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1527
2020-10-26 18:26:24 +01:00
Jonas Dreßler
52e2afa2ec clutter/actor: Don't check handlers when emitting stage-views-changed
Turns out the g_signal_has_handler_pending() call in
update_stage_views() is actually more expensive than comparing the
sorted list (which is usually very short), so remove that and simply
always emit the signal.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1524
2020-10-26 13:45:57 +00:00
Georges Basile Stavracas Neto
da7671b547 clutter/actor: Don't push identity transforms
It is useless, and needlessly increases the matrix stack and
does more multiplications than necessary.

Don't push identity transforms to the pick stack.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1509
2020-10-26 10:19:04 -03:00
Georges Basile Stavracas Neto
ce6f13357a clutter/pick-context: Remove clutter_pick_context_get_framebuffer()
It is not used anymore.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1509
2020-10-26 10:19:04 -03:00
Georges Basile Stavracas Neto
54db1b2fa2 clutter/actor: Remove cached inverse transform
It is not used anymore.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1509
2020-10-26 10:19:04 -03:00
Georges Basile Stavracas Neto
7d25cbe87f Use graphene_ray_t to pick actors
This commit introduces a few important changes in order to
acommodate graphene_ray_t. Most of them are positive changes,
so don't panic :)

The first very visible change is that neither the actor box
nor the clip rectangles are projected before being pushed.
This required changing the parameters of the related functions
at both ClutterPickContext, and ClutterPickStack, to receive
boxes instead of vertices. These rectangles are projected on
demand now, so in the best case (first actor picked) only
one projection happens; and in the worst case, it projects
as much as it does now.

The second important change is that there are no more checks
for axis-alignment anymore. That's because picking now happens
in 3D space, using triangles.

Talking about triangles in 3D space, this is what is used now
for picking. We break down each actor rectangle in 2 triangles,
and check if the projected pick point is inside any one of them,
of if the ray intersects any one of them. The same check happens
for the clip rectangles.

Checking the projected pick point is both an optimization for the
2D case, and a workaround to graphene_ray_t problems with float
precision, which is specially visible on edges such as the top
bar.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1509
2020-10-26 10:19:01 -03:00
Georges Basile Stavracas Neto
620f0ad74b clutter/pick-stack: Store current matrix entry
This is the beginning of the preparations to passing unprojected
rectangles to the clip stack. Store a ref to the current tip of
the matrix entry.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1509
2020-10-26 09:57:33 -03:00
Georges Basile Stavracas Neto
f411834d42 Introduce ClutterPickStack
ClutterPickStack is a new boxed type that stores the vertices
and clip rectangles. It is meant to be a byproduct of picking,
and takes over most of what ClutterStage currently does.

It introduces a 'seal' system, inspired by MetaKmsUpdate. After
the pick operation is done, and the rectangles are collected,
the pick stack is sealed, and is not allowed to be externally
modified anymore. Internally, it still can invalidate pick
records when an actor is destroyed.

For now, it handles both the clip rectangles, and the matrix
stack, separatedly. Future commits will rearrange this.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1509
2020-10-26 09:56:42 -03:00
Georges Basile Stavracas Neto
0d79a0faf8 clutter/stage: Remove useless cached pick mode reset
It happens a couple of lines above, in _clutter_stage_clear_pick_stack().

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1509
2020-10-26 09:20:38 -03:00
Georges Basile Stavracas Neto
56ed0bf001 clutter: Remove pick mode from context
It is not used anywhere now.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1509
2020-10-26 09:20:38 -03:00
Georges Basile Stavracas Neto
8d47f79b2c clutter/actor: Remove '_paint' suffix from clutter_actor_should_pick_paint
We're not using paint to pick anymore.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1509
2020-10-26 09:20:38 -03:00
Georges Basile Stavracas Neto
05b6b6a88d clutter/actor: Use pick context in clutter_actor_should_pick_paint()
Pass the ClutterPickContext to clutter_actor_should_pick_paint() and
check the pick mode from it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1509
2020-10-26 09:20:38 -03:00
Georges Basile Stavracas Neto
a4961ad4a7 clutter/pick-context: Make pick context aware of the pick mode
Pass the pick mode during construction, and add a getter for it. It'll
be used by the next patches to make clutter_actor_should_pick_paint()
not depend on a global context.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1509
2020-10-26 09:20:38 -03:00
Georges Basile Stavracas Neto
8a709b5766 clutter/stage: Add pick trace
It will help profiling picking times, and compare this future patches
with status quo.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1509
2020-10-26 09:20:38 -03:00
Juliano de Souza Camargo
a43821311b Update Portuguese translation
(cherry picked from commit d9e34ebbb8d9fafbce2f2e9ed9be542a71699d10)
2020-10-24 14:06:06 +00:00
Daniel van Vugt
a24b2f4b0f background-content: Assume background clones are always transformed
Because clones may not have identical geometry to their source actors.
So we can't use the geometry of the source actor to decide to take the
more optimized (more clipped) path.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1480
2020-10-23 22:54:25 +00:00
Jonas Dreßler
cc7c7fa015 clutter/actor: Remove the paint signal and keep the paint vfunc
The "paint" signal of ClutterActor has been a pain for everyone involved
long enough now, turns out we actually use it nowhere except tests
anymore (which has been handled in the last commits), so get rid of it
for good before anyone starts using it again.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1522
2020-10-23 22:07:01 +02:00
Jonas Dreßler
4e63ed524e tests: Use ClutterStage "after-paint" instead of ClutterActor "paint"
The "paint" signal of ClutterActor is deprecated and will be removed. We
have a good replacement to get notified about stage paints nowadays,
that is "after-paint" on ClutterStage, so switch to that signal where it
makes sense.

I didn't bother to update the few tests (namely Clutters
conform/texture-fbo.c, conform/text-cache.c,
interactive/test-cogl-multitexture.c and Cogls
conform/test-multitexture.c, conform/test-texture-mipmaps.c) where it's
harder to replace the signal since we don't build those anyway.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1522
2020-10-23 22:06:58 +02:00
Jonas Dreßler
a03e233b44 tests/interactive: Remove clutter paint-wrapper test
The paint-wrapper test wraps around the painting process of an actor to
paint its own texture before and after painting, it does that using the
"paint" signal.

This signal is deprecated and will be removed from Clutter, and since
this "use-case" won't be supported anymore afterwards (the proper way is
to use a ClutterEffect for things like this), remove the test.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1522
2020-10-23 21:40:43 +02:00
Carlos Garnacho
027abc6ea7 clutter: Drop unused field in ClutterInputDevice struct
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:19 +00:00
Carlos Garnacho
8d9dc097e4 clutter: Drop clutter_input_device_set_time()
An input device does not have time on itself, events do. This was made
unused so drop it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:19 +00:00
Carlos Garnacho
a76a47fbde clutter: Pass timestamp to clutter_input_device_set_actor()
This function emits crossing events, so needs a (most times truthful)
timestamp. Make it explicit instead of fetching it from the device.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:19 +00:00
Carlos Garnacho
90001f09b3 clutter/main: Drop dead code branches
We shouldn't get an input event that has not a device.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:19 +00:00
Carlos Garnacho
6e49ad436d clutter: Drop clutter_input_device_set_stage()
Also drop the stage argument from clutter_input_device_set_coords()
in consequence. No one uses this already.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:19 +00:00
Carlos Garnacho
ce2b3728a2 backends/x11: Drop users of clutter_input_device_set_stage()
There is no getter, so this information is useless.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:19 +00:00
Carlos Garnacho
942b3c63df backends/native: Drop users of clutter_input_device_set_stage()
There is no getter, so doing this is now pointless.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:19 +00:00
Carlos Garnacho
a67f676b0d clutter: Drop clutter_input_device_get_[pointer_]stage()
Input devices are not related to the stage in any way. Drop all the
users that relied on it being so.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:19 +00:00
Carlos Garnacho
e3644acbbf backends/x11: Drop all users of clutter_input_device_get_stage()
And clutter_input_device_get_pointer_stage().

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:19 +00:00
Carlos Garnacho
9598eedd04 backends/native: Drop all uses of clutter_input_device_get_stage()
Rely on the seat stage, or other ways to fetch it. Also rely that
there is actually a single stage, so that we assign the right stage
to all events going out of the seat, in a single place.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:19 +00:00
Carlos Garnacho
af249ddf44 clutter: Do not depend on device stage on ClutterInputMethod
Look it up through other means.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:19 +00:00
Carlos Garnacho
f99fc2ae9c clutter: Pass stage on to _clutter_input_device_set_actor()
Don't rely on the device stage, so specify the stage in the callers.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:18 +00:00
Carlos Garnacho
6a6894a397 clutter: Specify stage on clutter_input_device_update() function
This is the function performing the picking, tell it explicitly the
stage it should happen on.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:18 +00:00
Carlos Garnacho
3c8376ad91 backends/native: Move relative motion filter to MetaSeatNative altogether
And drop the relative motion filter API. The seat will handle relative motion
across outputs with different scales. This accesses the MetaMonitorManager
ATM.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:18 +00:00
Carlos Garnacho
90df3c6fa3 backends/native: Make seat constrain pointer to monitors out of the box
It does access the MetaMonitorManager directly ATM.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:18 +00:00
Carlos Garnacho
27ef073432 backend/native: Move barrier manager to MetaSeatNative
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:18 +00:00
Carlos Garnacho
6cb1557d99 backends: Move absolute/relative device mapping to native backend
This is a bit scattered around, with the setter/getter in Clutter, and
it only being only directly honored in Wayland (it goes straight through
device properties in X11).

Make this private native API, and out of public ClutterInputDevice API.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:18 +00:00
Carlos Garnacho
82c6c3f303 backends: Move device mapping check into backend
Make the upper parts agnostic about the device being relative in
order to apply the display mapping. Just make the low level bits
resort to the identity matrix for those.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:18 +00:00
Carlos Garnacho
c4d11f7550 backends: Fold device mapping check into backend
Make the upper part agnostic about the device being relative in order
to avoid applying keep-aspect. The X11 bits already are, so make it
sure it's also the case for the native backend.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:18 +00:00
Carlos Garnacho
b6a020e9ff clutter: Sanitize ClutterInputDevice header
Move some exposed setters to private headers. It makes some sense to
provide those for backends, not as much to the upper layers.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:18 +00:00
Carlos Garnacho
e28007edb9 backends: Drop extra layer of touch info handling
We have a hashtable in the device that does not add much on top
to the seat handling. Make all the places rely on the seat accounting
instead.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:18 +00:00
Carlos Garnacho
c9a405ff9e backends/native: Use libinput seat slot API
Instead of creating a seat-wide touch slot ID ourselves, rely on libinput
API doing this for us.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:18 +00:00
Carlos Garnacho
439e9a5567 backends/native: Assign unique ranges of slots to virtual devices
We are moving to seat-wide touch slot accounting, so move these virtual
devices to using their own range each. The theoretical case of
overflow/rollover is also handled.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:18 +00:00
Carlos Garnacho
bd4062a196 clutter: Limit number of touch slots available to a virtual touch device
It's not worth letting these devices have an "unlimited" range of touch
slots. Limiting it to 32 is more than enough to map it with real touch
devices nowadays.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:18 +00:00
Carlos Garnacho
7698fc4aaf backends: Drop the filter for libinput events
This is now unused, and it's arguably any useful to stay.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486
2020-10-23 18:48:18 +00:00