1
0
Fork 0
Commit graph

30392 commits

Author SHA1 Message Date
Carlos Garnacho
c01580cec6 clutter: Remove some unused code
The drag actors were practically unused, and became wholly
unused API with commit eb6e1f694a. There is no provision for
using this in the future, so drop this internal API.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3058>
2023-06-15 16:27:48 +00:00
Sebastian Wick
87bd574598 core/window: Change MRU behavior for windows on secondary output
Current behavior pushes a window which receives focus to the start of
the MRU list on every workspace it is on. By focusing a sticky window
the default focus on all other workspaces changes as well. This is fine
for sticky windows explicitly marked as sticky by the user but if a
window is on a secondary output and workspaces are only on the primary
output the behavior is unexpected. Instead we want the window to be the
default focus only on the current workspace but also keep those windows
in a relative MRU order to each other on all workspaces.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2681
Fixes: 058981dc1 ("workspace: Focus the default window only if no window is focused")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2909>
2023-06-15 12:39:58 +02:00
Sebastian Wick
3bbff537d9 Revert "workspace: Focus the default window only if no window is focused"
This reverts commit 058981dc12.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2909>
2023-06-15 12:09:31 +02:00
Dor Askayo
a738132486 profiler: Actually free ThreadInfo when a thread unregisters
The previous commit only freed the list node.

Fixes: a731017ec ("profiler: Free ThreadInfo when a thread unregisters")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3078>
2023-06-14 23:54:41 +03:00
Dor Askayo
edc5d2a933 profiler: Free ThreadInfo when a thread unregisters
This avoids leaking the the ThreadInfo object when a thread unregisters.

Fixes: e16d68372 ("profiler: Add API to register profiler threads")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3076>
2023-06-14 19:48:12 +03:00
Dor Askayo
f49b2a3c7d profiler: Free ThreadInfo list on MetaProfiler finalize
This avoids use-after-free when handle_start() is called following
handle_stop() during the lifetime of the MetaProfiler. This happens
on repeated profiling sessions using Sysprof.

Fixes: e16d68372 ("profiler: Add API to register profiler threads")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3076>
2023-06-14 19:44:48 +03:00
Carlos Garnacho
bc04fcb89d core: Change MetaWaylandTextInput event forwarding to IMs
We need to juggle with some things here to keep key event ordering
and accounting consistent.

The keyboard internal state changes (and maybe modifier event emission)
happening through meta_wayland_seat_update() should ideally happen
from the same key events that reach the client through wl_keyboard.key,
so that wl_keyboard.modifier events are emitted in the right relative
order to other key events.

In order to fix this, we need to decide at an earlier point whether
the event will get processed through IM (and maybe be reinjected),
thus ignored in wait of IM-postprocessed events.

This means we pay less attention to whether events are first-hand
hardware events for some things and go with the event that does
eventually reach to us (hardware or IM).

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5890
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3044>
2023-06-13 14:21:41 +00:00
Carlos Garnacho
eaa09be17c wayland: Account for doubly pressed/released keys in MetaWaylandKeyboard
Given the presence of IMs and the different paths in event handling to reach
one of them, we cannot make guesses about whether should stick to the original
hardware-triggered event, or wait/prefer a second hand IM event that might or
might not arrive. We also have no say for other IM foci unrelated to wayland
(e.g. ClutterText) triggering the double event emission.

So go with it and maintain our own internal state for keys, we already kinda
do, but mainly for warning purposes, at the time of updating the
MetaWaylandKeyboard state.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3044>
2023-06-13 14:21:41 +00:00
Carlos Garnacho
7b26aab08d wayland: Add compositor API to get the text input object
We need to open code a bit the event handling of MetaWaylandTextInput,
in order to avoid out of order events.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3044>
2023-06-13 14:21:41 +00:00
Carlos Garnacho
7716b62fa2 clutter: Separate ClutterInputFocus event processing and filtering
Currently, we let the same function handle key event filtering as they
are passed to the IM, and the IM events resulting in actions like text
commit or preedit changes.

Split these two aspects into filter/process functions, and port
ClutterText to it. MetaWaylandTextInput still handles everything in
a single place, but that will be split in later commits.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3044>
2023-06-13 14:21:41 +00:00
Carlos Garnacho
ff4953caa6 wayland: Remove redundant ifdef
It's already surrounded by the same ifdef

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3044>
2023-06-13 14:21:41 +00:00
Jonas Ådahl
63767df59a backend: Initialize cursor renderer position too
This means initializing the pointer position in MetaSeatImpl
synchronously too, otherwise it's not guaranteed querying the seat state
will result in the expected position.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3071>
2023-06-13 13:22:59 +00:00
Jonas Ådahl
0b0f863428 seat/native/impl: Also init core pointer coordinates
Otherwise clutter_seat_query_state() doesn't give us the expected value,
since it doesn't check the seat pointer coordinates.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3071>
2023-06-13 13:22:59 +00:00
Michel Dänzer
4d664fd797 output/kms: Use meta_kms_connector_get_preferred_mode in init_output_modes
I have a monitor which can report two preferred modes: 5120x1440@240
and 3840x1080@60. Since they are enumerated in this order by KMS,
init_output_modes would end up using 3840x1080@60 (and it was impossible
to select any 5120x1440 mode in the GNOME display settings).

Fix this by using meta_kms_connector_get_preferred_mode, which returns
the first KMS mode with DRM_MODE_TYPE_PREFERRED.

v2:
* Use meta_kms_connector_get_preferred_mode. (Jonas Ådahl)

Signed-off-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3055>
2023-06-12 18:59:06 +00:00
Jonas Ådahl
49e6ce459c backend: Dispatch initial burst of events synchronously on init
This will consist of device-added events, meaning before init finishes,
we can derive some state that depends on the set of input devices
available on startup, such as cursor visibility.

This avoids cursor visibility switching between hidden and visibility
during startup.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3070>
2023-06-12 18:16:01 +00:00
Jonas Ådahl
27606cf1fb seat/native/impl: Start reading input device events when starting
This opens up for a possibility to handle initial events (devices
discovered on startup) during initialization, meaning we can figure out
a more correct initial state that depends on available input devices.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3070>
2023-06-12 18:16:01 +00:00
Jonas Ådahl
af078264fa backend: Init pointer position with clutter_seat_init_pointer_position()
Also fix a function name and remove an unused struct field.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3070>
2023-06-12 18:16:01 +00:00
Jonas Ådahl
060c4c2dfc clutter/seat: Add API to initialize pointer position
This is different from "warping" as it doesn't necessarily result in a
pointer motion event. This can be helpful during initializing so we can
avoid faked pointer events that would otherwise need to be special cased
to not appear as actual pointer movements.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3070>
2023-06-12 18:16:01 +00:00
Timotej Šulík
97f0e2e691 monitor: Ensure the preferred mode is always included
If there are two display modes present with the same flags,
and one of them is the preferred mode, it could have been
excluded from the resulting list of display modes.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2858
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3061>
2023-06-12 15:26:47 +00:00
Jonas Ådahl
bea2fdc12b profiler: Add missing call to stop profiling
Otherwise the profiling backend (cogl-trace.c) doesn't actually stop,
and will complain if we try to start it up again.

Fixes: ab39eaf131 ("cogl/trace: Make global start/stop more explicit")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3068>
2023-06-12 12:20:38 +00:00
Olivier Fourdan
d65883e0d7 cogl/gl-framebuffer: Remove conditional on HAVE_COGL_GL
By testing the features flag, we can get rid of the conditional build
on HAVE_COGL_GL entirely.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3047>
2023-06-07 07:16:10 +00:00
Olivier Fourdan
c3af4c1b15 cogl/gl-framebuffer: Fail without QUERY_FRAMEBUFFER_BITS
glGetIntegerv() with GL_RED_BITS/GL_GREEN_BITS/GL_BLUE_BITS/etc. is not
supported with the GL core context, so there is no point in falling back
to that without supporting COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS,
as this will cause an GL error.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3047>
2023-06-07 07:16:10 +00:00
Olivier Fourdan
fad240f437 cogl/gl-framebuffer: Match testing features
The function ensure_bits_initialized() in cogl-gl-framebuffer-fbo.c
checks for COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS whereas the same
in cogl-gl-framebuffer-back.c simply checks for the driver being
COGL_DRIVER_GL3.

Change the later to use the COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS
flag as well.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3047>
2023-06-07 07:16:10 +00:00
Olivier Fourdan
a2203df9f4 cogl/gl-framebuffer: Fix inverted test in ensure_bits_initialized()
Cogl's feature COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS is required
to use the GL_FRAMEBUFFER_ATTACHMENT_* queries.

Unfortunately, the test for the availability of the private feature is
actually inverted in ensure_bits_initialized() which causes that whole
portion of code to be ignored, falling back to the glGetIntegerv()
method which isn't supported in core profiles.

As Mesa has recently started to be more strict about these, this causes
the CI tests to fail in mutter.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3047>
2023-06-07 07:16:10 +00:00
Olivier Fourdan
5a83e8ef82 cogl/gl-framebuffer: Fix spurious trailing spaces
Purely cosmetic fix, no functional change.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3047>
2023-06-07 07:16:10 +00:00
Robert Mader
c36f3f0101 clutter/actor: Some code-style fixes
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2679>
2023-06-06 11:41:01 +00:00
Jonas Dreßler
b408be0b1e clutter/actor: Return NULL instead of FALSE when type check fails
Fix a small oversight in clutter_actor_peek_stage_views(), it should return
NULL instead of FALSE when the check fails.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2679>
2023-06-06 11:41:01 +00:00
Jonas Dreßler
26344fb533 clutter/actor: Don't store a second stage-views list for the stage
The stage already maintains its own list of stage-views via
clutter_stage_peek_stage_views(), it's a bit superfluous to copy that list
around all the time into priv->stage_views of ClutterActor. Let's deal with
that by returning clutter_stage_peek_stage_views() when
clutter_actor_peek_stage_views() gets called for the stage.

In order to make sure ClutterActor::stage-views-changed still gets emitted
correctly for the stage, always emit that signal on the ClutterStage when
the stage views get invalidated. This now depends on the backend only
actually invalidating the views and calling
clutter_stage_clear_stage_views() when things have actually changed, but
that should be the case.

This needs a change in one of the stage-views tests, namely the one which
tests stage-view-changed emission on the stage: Here we now see an emission
of stage-views-changed, but that signal emission actually seems correct.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2679>
2023-06-06 11:41:01 +00:00
Jonas Dreßler
2ef4960b4f clutter/actor: Cache absolute modelview matrices
While we're now doing a fairly good job at not needing those matrices
all the time anymore, we still need it multiple times during every paint
cycle, so it definitely makes sense to introduce some caching here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2679>
2023-06-06 11:41:01 +00:00
Jonas Dreßler
4579e86330 clutter/actor: Avoid always traversing actor tree on finish_layout
With commit 5a565b4258, we changed
clutter_actor_finish_layout() to be not only about updating stage views,
but also take care of updating the visible_paint_volume, for that we
started doing a full tree traversal of all mapped actors.

This can be quite a performance issue, apparently especially on certain
ARM devices, where the simple tree traversal can take as long as 2ms.
This is precious time we need to paint our next frame, so lets do a bit
more work to avoid those useless traversals.

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

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2679>
2023-06-06 11:41:01 +00:00
Jonas Dreßler
261f516af4 clutter/stage: Avoid queueing stage updates when they're already queued
We're using clutter_stage_schedule_update() now from ClutterActor to kick
off the stage updating machinery when a redraw needs to happen.

This introduced a bunch of unnecessary calls to
clutter_stage_schedule_update() and thus
clutter_stage_view_schedule_update() when multiple actors request redraws
during the same stage update cycle, which is a very common case.

Cut off all those unnecessary calls by bailing out in
clutter_stage_schedule_update() when updates are already queued.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2679>
2023-06-06 11:41:00 +00:00
Jonas Dreßler
d2d730ec0b clutter/actor: Use GArray to store redraw clips
Using a list of heap allocated ClutterPaintVolumes adds quite a bit of
unnecessary overhead: It means for every single redraw clip we allocate a
list and a paint volume on the heap.

Let's avoid all those heap allocations by using a GArray with static
ClutterPaintVolumes instead.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2679>
2023-06-06 11:41:00 +00:00
Jonas Dreßler
699e1b305b clutter/actor: Refactor redraw clip to be centered around ClutterActor
So far our logic for queueing redraws goes like this: Actor notices that it
needs to redraw -> actor tells stage that it needs to redraw via
clutter_stage_queue_actor_redraw() -> stage collects more and more redraws
into a QueueRedrawList before the actual stage update happens -> when
that happens, the stage collects the actual redraw clips from the actors via
clutter_actor_get_redraw_clip().

The logic behind this QueueRedrawList was that by storing a list of
redraw entries on the stage, way we can avoid traversing the whole actor
tree one more time to build the redraw clip before the stage update.

These days we have clutter_actor_finish_layout() though, which is basically
exactly that, a whole actor tree traversal that happens before every stage
update.

Since we have that now, we might as well get rid of the whole dance back and
forth between ClutterStage and ClutterActor, and simply merge the logic to
queue redraws into the finish-layout step.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2679>
2023-06-06 11:41:00 +00:00
Jonas Dreßler
4cad96ed24 clutter/actor: Cache the visible paint volume
If no actors have changed their positions and we're only repainting
because a window needs a repaint, the paint volumes of all actors
remain unchanged. There is no reason to redo those paint volumes on every
stage update.

So introduce caching and invalidation logic for the visible_paint_volume
that allows us to avoid a ton of matrix multiplications that right now
are happening for the whole mapped actor tree on every redraw.

Note that this removes two places where the visible paint volume is set
to an empty paint volume: This is a compromise so that we can keep
around the cached pv when hiding and showing an actor, it does "regress"
one case though: When hiding -> moving -> showing an actor, we'll now
include the old paint volume of the actor in the redraw clip on show (even
though redrawing that old region is not necessary, the actor was hidden
after all). This results in a bit of overpaint in this very specific case,
but for the sake of simplicity let's not care about that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2679>
2023-06-06 11:41:00 +00:00
Robert Mader
64feb2e5f0 clutter/actor-box: Avoid rounding compensation for empty boxes
Empty boxes should not be enlarged to non-empty boxes, otherwise we
potentially confuse tests where we expect a zero-sized actor to also be on
zero stage views.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2679>
2023-06-06 11:41:00 +00:00
Jonas Ådahl
a1749524da cogl/trace: Add missing semicolon when profiling is disabled
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3051>
2023-06-05 10:20:25 +02:00
Jonas Ådahl
0884747dce window-actor/x11: Fix using shape region for input
There were two issues with using the shape region to derive an input
region.

Firstly, the shape region is against the client rectangle, while the
surface actor needs it to be against the buffer rectangle. Fix this by
offsetting the shape region before passing it along.

Secondly, we can't just intersect the shape and input region, since that
leaves out the window decorations. Fix this by only intersecting the
input region covering the client part, and the shape region, and then
union that with the input region covering the rest.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3045>
2023-06-02 22:41:35 +02:00
Sebastian Keller
6274bb3518 x11: Use input region from frame window for decorated windows
Previously the input region was ignored for decorated windows, which
since the introduction of the frames client meant that the entire shadow
region of the frame window was considered interactive.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2706
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3031>
2023-06-02 20:21:56 +00:00
Pascal Nowack
30a5178204 clutter/clutter-stage: Get rid of an unused variable warning
When building mutter with -Ddebug=false, a warning appears, that
`ClutterStagePrivate *priv` is unused.
Simply remove this variable and directly use `stage->priv` in
`CLUTTER_NOTE` to get rid of this warning.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3046>
2023-06-02 12:22:18 +02:00
Bilal Elmoussaoui
9a6ee5d7c7 clutter: Drop unnused cairo specific APIs
The APIs are not used by Mutter and GNOME Shell, so they should be safe to remove

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3040>
2023-06-01 16:10:13 +00:00
Sebastian Keller
2b58efbcbb meta: Remove unused MetaFrameFlags enum
It has been unused since 04fa926e, but could not be removed before
branching due to being in a public header.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3036>
2023-06-01 12:15:20 +00:00
Jonas Ådahl
798a6e450a kms/impl-device/dummy: Add empty disable() implementation
We don't need to do anything, since we have no mode setting devices to
disable in the dummy implementation.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2841
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3037>
2023-06-01 11:29:09 +00:00
Michel Dänzer
b809f3dc85 ci: Use "when: on_success" in job rules
Instead of "when: always". The latter would result in jobs running even
after a dependency job failed, which would inevitably result in the
dependent job failing as well. See
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2628#note_1758824
for an example.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3034>
2023-05-31 14:31:20 +00:00
Jonas Ådahl
b413f45bee profiler: Enable tracing on threads added while running
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2998>
2023-05-31 08:37:52 +00:00
Jonas Ådahl
ab39eaf131 cogl/trace: Make global start/stop more explicit
Don't try to handle things by threads enabling/disabling the main trace
context on-demand, just have a clear start/stop API. For the D-Bus API,
it becomes more straight forward, and for the persistent variant too, as
it avoids having to pass garbage input when it's known that arguments
will be discarded.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2998>
2023-05-31 08:37:52 +00:00
Jonas Ådahl
33a210d768 x11/events: NULL Check input event when getting name
Fixes a SIGSEGV when trying to get the name of an XIEvent for profile
trace data gathering. We don't use GDK anymore, so we can't rely on any
GDK semantics.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2998>
2023-05-31 08:37:52 +00:00
Jonas Ådahl
e4b2b141d9 seat/impl: Trace libinput dispatching and event processing
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2998>
2023-05-31 08:37:52 +00:00
Jonas Ådahl
1ca76e9b9c context: Start persistent profiling via command line argument
Persistent profiling was started via an env var, but that's rather hard
to discover and remember without grepping; change to use a command line
argument.

The profiler is started early, even during (though late in)
configuration, but configuration should ideally be instant and pointless
to configure.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2998>
2023-05-31 08:37:52 +00:00
Jonas Ådahl
e16d683721 profiler: Add API to register profiler threads
The registered threads will get tracing turned on when MetaProfiler is
started.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2998>
2023-05-31 08:37:52 +00:00
Jonas Ådahl
dd3c1046c1 cogl/trace: Make each thread have its own trace context ref
This means that when we disable tracing, the writer will be kept alive
until the last thread using it is disabled.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2998>
2023-05-31 08:37:52 +00:00