1
0
Fork 0
Commit graph

1624 commits

Author SHA1 Message Date
Bilal Elmoussaoui
dc52ccc75a cleanup: Port from ClutterColor to CoglColor
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3544>
2024-06-13 14:45:53 +02:00
Bilal Elmoussaoui
74ece2ad92 clutter: Drop various Color constructors
The fields are writable, there is no need to provide a custom constructor.
This shapes the Color API to be similar to GdkRGBA

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3802>
2024-06-12 16:25:18 +00:00
Carlos Garnacho
17dc9393e0 compositor: Make surface actors unreactive after losing their surface
These actors are expected to be destroyed along with their surface, this
however happens later in the process, so there is a moment where actors
are eligible for picking, but do not have a surface anymore.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3729>
2024-06-07 17:01:26 +02:00
Bilal Elmoussaoui
0f19c6f5b6 window: Stop caching frame_bounds
That was only there to force updating MetaFrame's bounds
but that is something that is already updated in
MetaWindowX11.move_resize_internal. So just drop all of that

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3254>
2024-05-27 12:50:26 +00:00
Bilal Elmoussaoui
d1b04ffb55 window: Move frame_bounds to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3254>
2024-05-27 12:50:26 +00:00
Bilal Elmoussaoui
bcb069f454 window: Move frame field to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3254>
2024-05-27 12:50:26 +00:00
Bilal Elmoussaoui
503c70e284 window: Replace get_titlebar usages
Uses the hardcoded value that was used for wayland
clients for x11 ones as well.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3254>
2024-05-27 12:50:26 +00:00
Bilal Elmoussaoui
acbb14f34b window: Move has_custom_frame_extents to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3254>
2024-05-27 12:50:26 +00:00
Bilal Elmoussaoui
b4b896d4db core: Move frame related types to x11
Also rename the files to meta-x11-frame* for consistency

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3254>
2024-05-27 12:50:26 +00:00
Bilal Elmoussaoui
fc623c1ed1 build: Enable -Werror=shadow and fix related issues
Mostly renames or removing already defined types

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3378>
2024-05-06 15:54:16 +00:00
Jonas Ådahl
454a70cce5 edge-resistance: Use current conventions for lists
Use GList *l and for loop for iterating, autopointers and autolists
for memory management, and a function instead of a macro for a
condition.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3703>
2024-04-15 16:48:04 +00:00
Robert Mader
1f82365021 window-actor/wayland: Improve scanout candidate check
By ignoring obcured surfaces we can generalize the single-pixel-buffer
background check to work with arbitrary surface trees, as long as the
two top ones are the background and content surfaces.

As a nice side effect of this, clients like Firefox now usually take the
shorter `meta_window_is_fullscreen (window) && n_visible_surface_actors == 1`
route.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3699>
2024-04-15 15:52:26 +00:00
Daniel van Vugt
22689d722a compositor/sync-ring: Allow the gpu_fence to be moved
When the compositor inserts two waits in a frame, such as f606a4424a,
the second insertion shouldn't break the ring's state machine as easily
as it does. We can instead merge the two GL waits into one by simply moving
the GL fence to the latest insertion. Each insertion still does its own X11
sync though.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3384
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3685>
2024-04-05 14:18:12 +00:00
Bilal Elmoussaoui
f480de4ecd plugin-manager: Guard MetaPluginClass.xevent_filter
As we are getting close to have a Wayland-only build, guard those usages
so we don't 'regress'.
Once Kiosk figures it use case, we can revert both this commit and the
previous one.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3652>
2024-03-16 04:11:38 +01:00
Bilal Elmoussaoui
eb1d1883c2 Revert "plugin-manager: Drop MetaPluginClass.xevent_filter"
This reverts commit 917526ee9d.

As it is currently used by GNOME Kiosk, until upstream figures out
how to replace that code path, let us revert the commit

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3652>
2024-03-16 04:09:41 +01:00
Robert Mader
f1a4758ce2 window-actor/wayland: Access single pixel buffer object directly
Using `meta_wayland_single_pixel_buffer_from_buffer()` can fail if
the buffer resource is already gone. Given that we release the buffer
immediately, that is actually expected - but the client this was tested
with did/does not do so.

This made the single pixel black bar optimization fail for
GstWaylandsink, while working for the mpv Wayland backend.

Access the object directly, which is both faster and works as long as
the buffer is alive.

Fixes: ed50cbbfe4 (window-actor/wayland: Update scanout candidate check)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3662>
2024-03-15 17:09:42 +00:00
Sebastian Keller
f94e32037c background: Call malloc_trim() after loading background image
Some of the new JXL backgrounds from gnome-backgrounds can allocate
several hundred MB during loading, so let's call malloc_trim() after we
are done with loading the image into a pixbuf.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3327
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3653>
2024-03-12 17:27:29 +00:00
Sebastian Keller
c09fb9c5a1 compositor/drag: Use "default" cursor for moving windows
This is consistent with the DnD related cursor changes that also use the
"default" cursor for moving. The "move" cursor is kept for moving and
resizing windows using the keyboard since we currently have no other way
indicate this state.

See: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7425#note_2023057
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3634>
2024-03-02 23:42:55 +00:00
Robert Mader
e8b43d3b1b surface-actor: Add NULL check for stage
In some cases Wayland surface actors are not decendents of the stage,
notably subsurfaces without a parent surface. The code changes in the
mentioned commits dropped the previously existing check for that - readd
it.

Fixes: 627ab24721 (surface-actor: Add meta_surface_actor_schedule_update())
Fixes: 7eb99ddef7 (wayland/surface: Schedule updates in the context of the surface actor)

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3323
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3633>
2024-03-02 22:37:22 +00:00
Jonas Dreßler
e9866eee0f compositor: Set priv->current_drag before calling meta_window_drag_begin()
priv->current_drag is the property that
meta_compositor_get_current_window_drag() and therefore also
meta_display_is_grabbed() bases its check on. We use
meta_display_is_grabbed() to select which cursor to use (window cursor
vs root cursor) when updating the cursor in MetaCursorTracker.

Since meta_window_drag_begin() sets a new cursor, and therefore triggers the
cursor tracker to update the current visible cursor, we should set
priv->current_drag before the call to meta_window_drag_begin(). This makes
sure the cursor tracker sees that there's a window drag and changes the
cursor right away when the window drag begins (instead of doing so on
subsequent pointer events).

Fixes: 525ed1166c ("wayland/pointer: Unset current surface during window drags")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3630>
2024-03-02 20:24:26 +00:00
Dor Askayo
4919a53f84 compositor/native: Enable frame synchronization for surface actors
Find a surface actor that meets the criteria to drive the refresh
rate for the view. If a new surface actor is found, add a
reference to it and request frame synchronization to be enabled
for the relevant MetaRendererViewNative.

Whenever the surface actor schedules a repaint or an update, and
in case frame synchronization is enabled for the
MetaRendererViewNative, schedule the update to occur "now". This
effectively makes the surface actor's frame rate drive the refresh
rate of the monitor.

If the actor is frozen or destroyed, it is no longer expected to
schedule repaints or updates and should stop driving the refresh
rate.

When there is no surface actor to drive the refresh rate, request
frame synchronization to be disabled for the MetaRendererViewNative.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1154>
2024-03-02 12:08:21 +00:00
Dor Askayo
627ab24721 surface-actor: Add meta_surface_actor_schedule_update()
This function allows scheduling a stage update in the context of a
surface actor and emit the "update-scheduled" signal. This signal is
similar to "repaint-scheduled", but can be used to be notified of
updates that do not necessarily result in a repaint.

With variable refresh rate, any update potentially affecting the
frame pacing of a surface actor needs to be handled differently
depending on whether that surface actor drives the refresh rate or
not.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1154>
2024-03-02 12:08:21 +00:00
Dor Askayo
4e5ac0186c surface-actor: Allow checking if a surface actor covers a rect
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1154>
2024-03-02 12:08:21 +00:00
Dor Askayo
f5e5032eac surface-actor: Add "is-frozen" property
This can be used to receive notification of when a surface actor
becomes frozen or thawed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1154>
2024-03-02 12:08:21 +00:00
Carlos Garnacho
51e084ee8d compositor: Forward window drag position hint across internals
Allow passing an argument to meta_compositor_drag_window() to pass
the hint. Unused so far.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3546>
2024-02-27 00:19:20 +01:00
Carlos Garnacho
e4542a6495 compositor: Add MetaWindowDrag API to add a hint on the grab coordinates
This is added as a hint so that the caller can optionally use it, e.g.
in the case that a window drag is driven by the mouse. This will be used
to more accurately follow the drag position, other than starting at the
current pointer position.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3546>
2024-02-27 00:18:23 +01:00
Bilal Elmoussaoui
60e10511ae cogl: Remove Color.init_from_4ub
Slowly switching to using floats only in CoglColor
Helps https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3544

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3594>
2024-02-22 12:34:58 +00:00
Bilal Elmoussaoui
3cc44b1f04 cleanup: Guard x11 headers includes
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3603>
2024-02-21 16:01:00 +01:00
Bilal Elmoussaoui
b5cf16fa74 cleanup: Remove not used X11 includes
Also add ones where they are actually used

Helps https://gitlab.gnome.org/GNOME/mutter/-/issues/2272

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3603>
2024-02-21 15:25:44 +01:00
Bilal Elmoussaoui
917526ee9d plugin-manager: Drop MetaPluginClass.xevent_filter
This was added for registering profiling hooks for glx.swapComplete on
x11 code paths.

Nowadays we have sysprof

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3599>
2024-02-20 15:21:21 +00:00
Daniel van Vugt
f606a4424a compositor/x11: Sync again at the end of before_paint
The existing comment tells us this is necessary:

> there may be drawing between the last damage event and the
> XDamageSubtract() that needs to be flushed as well.

But the commit message for 551101c65c also tells us that
synchronization is necessary before-update. Assuming both are correct
then it needs to be done in both places.

I did try optimizing out the second sync to only do it if damage
arrived during the update, but that doesn't seem to be the issue.
The damage event is arriving before the update starts and it's some
secondary changes within the damage region running late that need
flushing. So this means the client is reporting damage more frequently
than the frame rate and we're ignoring the secondary damage reports
for efficiency (XDamageReportBoundingBox), which is still a good thing.

Fixes: 551101c65c ("compositor-x11: Move synchronization to before-update")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2880
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3590>
2024-02-20 18:22:00 +08:00
Corentin Noël
e7de5c36f3 build: Remove the config.h inclusion from all public headers
Do not include it at header side as it is not part of the installed headers.

Only keep it in cogl-gl-headers.h as it is a private header.

Add it to all the source files that depend on it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3593>
2024-02-17 11:58:55 +00:00
Bilal Elmoussaoui
2c613df4eb cogl: Drop Pipeline.set_color_*
Those setters variants makes it very hard to do across project changes
to the
color type. As part of
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3544
I would like to switch from using integers to floats inside CoglColor
which this PR would simplify

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3553>
2024-02-16 12:13:23 +01:00
Bilal Elmoussaoui
72c2d8913e clutter: Drop static colors
There is literally zero reasons nowadays to still provide the tango color
palette as part of the Clutter API. End users of Mutter can define the
colors on their side if they want to.

The change simplifies https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3544

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3588>
2024-02-16 10:24:24 +00:00
Bilal Elmoussaoui
41cc85c857 window: Move shape_region to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3584>
2024-02-15 13:40:07 +00:00
Bilal Elmoussaoui
5e8e7df5bd window: Move input_region to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3584>
2024-02-15 13:40:07 +00:00
Bilal Elmoussaoui
606197de46 window: Move opaque_region to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3584>
2024-02-15 13:40:07 +00:00
Bilal Elmoussaoui
e31c47877a frame: Inline get_mask where it is used
The function was used only once so just move it content where it is
called. It allows us to drop more cairo paths from the API surface even
if it is not part of a public api

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3581>
2024-02-14 11:20:30 +00:00
Carlos Garnacho
f46205417f compositor: Drop grab_begin/end vfuncs
These do no longer anything on any implementation, and may be
removed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
3c5bbedb7c compositor: Move code to sync pointer position to backends/x11
Since the backend also knows when did we start/stop being grabbed,
we can shuffle this backend-y code to the backend.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
e7f436bc39 compositor: Refactor MetaDnD wayland event handling
Hook MetaDnD event delivery in the case of Wayland DnD ops
directly in the Wayland code, instead of indirectly in core/
code.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
2bcf6607d3 compositor: Do not sync input focus
The wayland bits do already take care of logically unsetting
their focus in the presence of extraneous grabs, there is no
need to trigger this from the compositor.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
2a584a8f01 wayland: Make use of Wayland event grabbing mechanism
Enable grabbing input for popups, and drag-and-drop. Since the very
switch to using ClutterGrab underneath Wayland grabs will challenge
assumptions in existing code, these had to change in one go. A notable
one is that meta_display_windows_are_interactable() is not 100% true
anymore for xdg_popups, at least not the same.

Another change happening in lockstep is MetaDnD no longer having
to funnel events to Wayland, since the grab triggered by Wayland DnD
is now a cause of "compositor grabs", and will naturally receive events
as long as it hold. while "modal".

A number of ad-hoc checks for grabbing state has also been dropped
from src/wayland/ internals, since again Wayland grabs are a reason
for Clutter grabs, plus the mechanism itself will already take care
of focus loss and restoration.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
b154fddd0f clutter: Make ClutterGrab a GObject
We'll want to add notifications on it, make it a GObject
to allow that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Robert Mader
f26939255e compositor-view/native: Remove leftover check
This check was originally added because `window` was actually used.
While technically correct, there's no reason to keep it around.

Fixes: 4736f873f2 ("compositor/native: Add support for direct scanout per view")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3177>
2024-02-10 17:41:12 +00:00
Robert Mader
bd6196f4ca wayland: Implement direct scanout for cropped and scaled surfaces
Until now we only supported direct scanout to the primary plane if the
buffer size perfectly matched the display size.
Since display controllers usually support scaling and cropping buffers
highly efficiently, try to let them do the job. This is usually helpful
if wp_viewporter is used by the client or Mutter uses fractional
scaling.

This has several advantages:
 - Games (e.g. SDL2 based ones) can almost always hit direct scanout
   paths in fullscreen mode. Notably when fractional scaling is used or
   the game renders in a non-native resolution (or both).
 - Video players using YUV buffer formats and wp_viewporter can easily
   hit direct scanout paths, making displaying video very power
   efficient as the 3D engine is not used at all.

Note that this still only uses the primary plane, no overlay or underlay
planes, making this change comparatively low risk.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3177>
2024-02-10 17:41:12 +00:00
Robert Mader
ed50cbbfe4 window-actor/wayland: Update scanout candidate check
In a following commit we will start supporting scaled and croped
surfaces, thus, in preparation, update the logic to three common cases:
1. only one surface, fullscreen (most apps)
2. a content surface and a black background surface which the client
   does not want to unmap, fullscreen
3. top-level subsurface covers the whole window and is opaque (Firefox)

The remaining currently supported cases should be fairly uncommen and
and harder to compute.

Note that we already check that the window cover the stage view in
MetaCompositorView.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3177>
2024-02-10 17:41:12 +00:00
Bilal Elmoussaoui
fa59796afd meta: Drop deprecated methods
Both functions were deprecated 20months ago, so should be safe
to remove now

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3573>
2024-02-09 18:03:09 +01:00
Bilal Elmoussaoui
d8812c0d2f compositor/drag: Guard X11 call
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3540>
2024-01-31 12:25:39 +00:00
Bilal Elmoussaoui
67e21e0881 compositor/actor: Guard X11 actor usage
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3540>
2024-01-31 12:25:39 +00:00