1
0
Fork 0
Commit graph

1249 commits

Author SHA1 Message Date
Laurent Bigonville
d26dc4ae44 compositor: Only include meta-window-actor-wayland.h when building with wayland
https://gitlab.gnome.org/GNOME/mutter/-/issues/1074
2020-04-27 13:28:28 +00:00
Olivier Fourdan
bd45a00fa3 window-actor/x11: Cache the frame bounds
When resizing an X11 window with client side decorations, the shadow is
clipped by the frame bounds so that we don't need to paint the shadow
under the opaque areas covered by the window and its frame.

When the X11 client uses the EMWH synchronization mechanism (like all
gtk-3 based clients), the actual window may not be updated so that the
actual window and it frame may be behind the expected window frame
bounds, which gives the impression of de-synchronized shadows.

To avoid the issue, keep a copy of the frame bounds as a cache and only
update it when the client is not frozen so that the clipping occurs on
the actual content.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/1178
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1214
2020-04-27 13:04:38 +02:00
Jonas Ådahl
a4f55d4986 clutter/paint-context: Allow passing redraw clip to offscreen paint context
So that we can mark the redraw clip of the part of the stage we're
painting.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1207
2020-04-23 14:45:53 +00:00
Jonas Ådahl
1b33a5a3a7 clutter/paint-context: Add paint flag
A paint flag affects a paint operation in ways defined by the flags.
Currently no flags are defined, so no semantical changes are defined
yet. Eventually a flag aiming to avoid painting of cursors is going to
be added, so that screen cast streams can decide whether to include a
cursor or not.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1207
2020-04-23 14:45:53 +00:00
Jonas Ådahl
65a6c4c361 compositor: Add support for direct scanout of Wayland surfaces
Try to bypass compositing if there is a fullscreen toplevel window with
a buffer compatible with the primary plane of the monitor it is
fullscreen on. Only non-mirrored is currently supported; as well as
fullscreened on a single monitor. It should be possible to extend with
more cases, but this starts small.

It does this by introducing a new MetaCompositor sub type
MetaCompositorNative specific to the native backend, which derives from
MetaCompositorServer, containing functionality only relevant for when
running on top of the native backend.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/798
2020-04-16 15:05:52 +02:00
Jonas Ådahl
b51c468c0f later: Listen to MetaCompositor signal instead of clutter
We need to coordinate with MetaCompositor during pre-paint so that we
have control over whether MetaLater callbacks happen first, or the
MetaCompositor pre-paint logic.

In order to do so, make MetaLater listen to a new signal "pre-paint" on
MetaCompositor, that is called MetaCompositors own pre-paint handling.

This fixes an issue where the top window actor was calculated after the
MetaCompositor pre-paint handling, meaning the top actor being painted
was out-of-date.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/798
2020-04-16 15:05:52 +02:00
Jonas Ådahl
2e7d02f1ce later: Make MetaCompositor the owner of the MetaLaters state
Since the order of destruction during MetaDisplay tear down is a bit
unordered, there are pieces that try to destruct its compositing
dependent pieces (i.e. queued MetaLater callbacks) after MetaCompositor
has been cleaned up, meaning we need to put some slightly awkward NULL
checks to avoid crashing.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/798
2020-04-16 15:05:52 +02:00
Jonas Ådahl
dc4fe780f7 display: Initialize MetaCompositor in two steps
MetaCompositor is the place in mutter that manages the higher level
state of compositing, such as handling what happens before and after
paint. In order for other units that depend on having a compositor
instance active, but should be initialized before the X11 implementation
of MetaCompositor registers as a X11 compositing manager, split the
initialization of compositing into two steps:

 1) Instantiate the object - only construct the instance, making it
    possible for users to start listening to signals etc
 2) Manage - this e.g. establishes the compositor as the X11 compositing
    manager and similar things.

This will enable us to put compositing dependent scattered global
variables into a MetaCompositor owned object.

For now, compositor management is internally done by calling a new
`meta_compositor_do_manage()`, as right now we can't change the API of
`meta_compositor_manage()` as it is public. For the next version, manual
management of compositing will removed from the public API, and only
managed internally.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/798
2020-04-16 15:05:52 +02:00
Jonas Ådahl
d682cdb078 util: Move MetaLater to its own file
While at it, fix some style inconsistencies, for now use a single
singleton struct instead of multiple static variables, and
other non-functional cleanups. Semantically, there is no changes
introduced.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/798
2020-04-16 15:05:52 +02:00
Jonas Ådahl
5dad87cfb9 surface-actor-x11: Move window related unredirect logic to MetaWindowX11
Better to have the relevant object figure out whether it is a good
position to be unredirectable other than the actor, which should be
responsible for being composited.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/798
2020-04-16 14:08:19 +02:00
Jonas Ådahl
a6f94696e2 window-actor: Set viewport when blitting to screencast fb
This fixes an issue where a non-maximized screen casted window would be
stretched to fill the whole screen cast stream, instead of just the crop
that corresponds to the current window size.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1174
2020-04-03 16:14:02 +00:00
Robert Mader
09a6031c69 window-actor: Force full actor geometry sync when mapping
Normally we bail out in `sync_actor_geometry()`. The comment there
states:
```
Normally we want freezing a window to also freeze its position; this allows
windows to atomically move and resize together, either under app control,
or because the user is resizing from the left/top. But on initial placement
we need to assign a position, since immediately after the window
is shown, the map effect will go into effect and prevent further geometry
updates.
```

The signal for the initial sync originates in `MetaWindow` though and predates
`xdg_toplevel_set_maximized`, which again calls `meta_window_force_placement`,
triggering the signal too early. As a result, Wayland clients that start up
maximized have a wrong map animation, starting in the top-left corner.

In order to fix this without changing big parts of the geometry logic and risking
regressions, force the initial sync again before mapping.

Solution suggested by Jonas Ådahl.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1164
2020-03-30 15:59:48 +00:00
Georges Basile Stavracas Neto
fed5f4d9aa window-actor: Inhibit culling when blitting to screencast
This allows us to screencast any window continuously, even
without it being visible. Because it's still being painted,
clients continue to receive frame callbacks, and people
are happy again.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1129
2020-03-27 23:29:58 +00:00
Georges Basile Stavracas Neto
cdd27d0e53 window-actor: Clip before translate when blitting
cogl_framebuffer_push_rectangle_clip() acts on the current modelview
matrix. That means the result of clipping then translating will be
different of the result of translating then clipping.

What we want for window screencasting is the former, not the latter.
Move the translation code (and associated) to after clipping.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/1097

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1129
2020-03-27 23:29:57 +00:00
Georges Basile Stavracas Neto
82778f72a4 window-actor: Shuffle some lines around
Move the CoglColor assignment right above the cogl_framebuffer_clear() call,
and let these wonderful partners together to delight us with an easier to
read code.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1129
2020-03-27 23:29:57 +00:00
Jonas Ådahl
8beef8ccd0 shaped-texture: Fix use-nearest check when viewports are scaled
We checked that the content size was appropriately painted in the stage,
but didn't take into account that the size of the sampled texture
region, meaning that when stage views were scaled, we'd think that we
would draw a texture scaled, as e.g. a 200x200 sized texture with buffer
scale 2 would have the size 100x100. When stage views were not scaled,
we'd apply a geometry scale meaning it'd end up as 200x200 anyway, thus
pass the check, but when stage views are scaled, it'd still be painted
as a 100x100 shaped texture on the stage, thus failing the
are-we-unscaled test.

Fix this by comparing the transformed paint size with the sampled size,
instead of the paint size again, when checking whether we are being
painted scaled or not. For example, when stage views are scaled, our
200x200 buffer with buffer scale 2, thus content size 100x100 will
transform to a 200x200 paint command, thus passing the test. For
non-scaled stage views, our 200x200 buffer with buffer scale 2 thus
content size 100x100 will also transform into a 200x200 paint command,
and will also pass the check, as the texture sample region is still
200x200.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/804

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1124
2020-03-26 08:32:46 +00:00
Jonas Ådahl
62d0dd907b clutter-utils: Fix a couple of coding style issues
Multiple assignments on the same line were split up, so was a super long
line.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1124
2020-03-26 08:32:46 +00:00
Jonas Ådahl
238e41d493 cogl: Install cogl-trace.h and include from cogl.h
This is so that cogl-trace.h can start using things from cogl-macros.h,
and so that it doesn't leak cogl-config.h into the world, while exposing
it to e.g. gnome-shell so that it can make use of it as well. There is
no practical reason why we shouldn't just include cogl-trace.h via
cogl.h as we do with everything else.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1059
2020-03-26 09:05:38 +01:00
Robert Mader
41130b08eb surface-actor: Add culling offset for geometry scale
This fixes a case that was overlooked in
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1036 - when we
have a geometry scale > 1 and Wayland subsurfaces that have an offset
to their parent surface (which is often the case when the toplevel surface
includes decoration/shadows etc.), we have to add extra offset to their
opaque regions so they match their 'visible' location.

This is necessary as `meta_cullable_cull_out_children` moves the coordinate
system during culling, but does not know about geometry scale.

Also, remove the redundant check for `window_actor` - we only hit this code
path if a `window_actor` culls out its children.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1108
2020-03-23 20:28:59 +01:00
Robert Mader
1d20045247 surface-actor: Fix memory leak
When we create a new region for an opaque texture we need to free it.
While on it, simplify the check slightly.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1108
2020-03-23 18:10:28 +00:00
Olivier Fourdan
0743381573 window/x11: Rename meta_window_x11_buffer_rect_to_frame_rect
To keep consistent and avoid confusion, rename the function:
    `meta_window_x11_buffer_rect_to_frame_rect()`
to:
    `meta_window_x11_surface_rect_to_frame_rect()`

As this function doesn't deal with the `window->buffer_rect` at all.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1091
2020-03-10 14:52:26 +01:00
Olivier Fourdan
267f712068 window-actor/x11: Use the new MetaShapedTexture API
The code in `build_and_scan_frame_mask` predates the introduction of the
`MetaShapedTexture` API to get the texture width hand height.

Use the new `meta_shaped_texture_get_width/height` API instead of using
the CoGL paint texture.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1091
2020-03-10 14:52:26 +01:00
Olivier Fourdan
304a103659 window-actor: Add API to update regions
For X11 clients running on Xwayland, the opaque, input and shape regions
are processed from different properties and may occur at a different
time, before the actual buffer is eventually committed by Xwayland.

Add a new API `update_regions` to window actor to trigger the update of
those regions when needed.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1091
2020-03-10 14:52:26 +01:00
Olivier Fourdan
2d09e95934 window-actor/x11: Compute client area from surface size
Commit 7dbb4bc3 cached the client area when the client was frozen.

This is not sufficient though, because the buffer size might still be
lagging waiting for the buffer from Xwayland to be committed.

So instead of caching the client size from the expected size, deduce the
client area rectangle from the surface size, like we did for the frame
bounds in commit 1ce933e2.

This partly reverts commit 7dbb4bc3 - "window-actor/x11: Cache the
client area"

https://gitlab.gnome.org/GNOME/mutter/issues/1007
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1091
2020-03-10 14:52:26 +01:00
Robert Mader
adc38f902a window-actor/X11: Update shape, input and opaque region in order
As they depend on each other to be correct, we should set all of them
in the correct order. As we do already have a function for that, use it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1091
2020-03-10 14:52:26 +01:00
Robert Mader
39a8c047d1 background-actor: Do not copy empty clip/unobscured regions
Clip and unobscured regions stricly shrink during culling. If they
are already empty, simply reference the empty region to reduce allocations.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1082
2020-02-29 19:44:01 +00:00
Robert Mader
c979cd95aa surface-actor: Do not copy empty clip/unobscured regions
Clip and unobscured regions stricly shrink during culling. If they
are already empty, simply reference the empty region to reduce allocations.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1082
2020-02-29 19:44:01 +00:00
Robert Mader
6831f2edb4 window-actor/x11: Disable culling on window actor level
This shape region culling was wrongly implemented in f5a28aa9, as it
does not take frame offsets into account, and is also redundant, as
we already set the opaque region of the underlying surface accordingly.

The other parts were implemented in ac7aa114, the reason given in
the commit message:
```
Wayland clients do this through the opaque region in the surface
actor. However X11 clients were considered fully transparent for
culling purposes, which may result in mutter painting other bits
of the background or other windows that will be painted over in
reality.
```

is wrong though - culling on X11 actors works just fine and did only
not work in Wayland sessions because of a bug that got fixed in
19814497.

In conclusion the whole part appears to be redundand and some testing
done suggests the same. Drop it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1082
2020-02-29 19:44:01 +00:00
Robert Mader
372d73e275 surface-actor: Cull out surfaces without alpha channel
If a opaque region is explicitly set we should not consider the surface
opaque, as that implies e.g. a shape region is set.

If no opque region is set but the texture does not have an alpha channel,
we can savely cull it out.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1082
2020-02-29 19:44:01 +00:00
Carlos Garnacho
4b513a31ae compositor: Shuffle x11 compositing bits in MetaCompositor
Given that on Wayland we are pretty much guaranteed to finish MetaX11Display
setup after the MetaCompositor is enabled, we may drop the
meta_compositor_manage() x11 initialization bits, and move them into the
MetaX11Compositor subclass where it's actually needed.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/944
2020-02-28 20:20:35 +00:00
Georges Basile Stavracas Neto
86168b945c window-stream-source: Draw into DMA buffer image
Much like monitor streaming, implement window streaming by
making the window actor draw itself with a paint context
that used the passed framebuffer.

Now that all MetaScreenCastStreamSrc subclasses implement
blit_to_framebuffer, remove the conditional check from
meta_screen_cast_stream_src_blit_to_framebuffer().

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1086
2020-02-28 15:52:19 -03:00
Jonas Ådahl
fe1ccea1e1 clutter: Pass redraw clip via paint context
Instead of users fetching it via `clutter_stage_get_redraw_clip()`, pass
it via the paint context. This is helpful as it is only valid during a
paint, making it more obvious that it needs to be handled differently
when there is no redraw clip (i.e. we're painting off-screen).

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1042
2020-02-25 19:18:54 +01:00
Christian Hergert
4c421959dc clutter: fix hole in ClutterPaintNode
Fixing the missalignment takes the structure from 80 bytes down to 72.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1081
2020-02-21 22:36:31 +00:00
Robert Mader
f5a28aa9e4 window-actor: Make culling of opaque windows X11 only
It is only useful for clients that do not set an opaque region but
still can be detected as being opaque. This is helpful for X11 clients
as opaque regions only got introduced around 2012 and only as part of EWMH
and are thus not used in many cases.
On Wayland however opaque regions have been part of the core protocol from the
beginnig and we can assume they are used more commonly.

As the current implementation in `MetaWindowActor` does not handle Wayland
subsurfaces well, instead of adding more complexity just move it to
`MetaWindowActorX11`.

While on it, take the shape region into account that is set when clients
use the X Nonrectangular Window Shape Extension Protocol, so we have exact
culling with those clients.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1058
2020-02-20 15:57:51 +00:00
Jonas Ådahl
5149e1e43a wayland: Move tree updating to the shell surface role
The shell surface role is the one where subsurfaces may exist, and it
has direct relation to the MetaWindowActorWayland which currently has
the subsurface stacking logic.

Instead of directly finding the window actor when dealing with
subsurfaces, notify the parent surface that the subsurface state
changed, so that it can outsource the application of this information to
the role. For subsurface roles, this simply means forward upward to the
parent; for shell surface roles, this means regenerate the surface actor
layering.

This allows us to move away from accessing the window directly from the
surface, which in turn allows us to change the ownership structure of
windows.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/835
2020-02-19 22:34:28 +00:00
Jonas Ådahl
ac2c870177 surface-actor: Remove get_window() API and vfunc
It was unused.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/835
2020-02-19 22:34:28 +00:00
Sebastian Keller
b45b03b063 surface-actor-x11: Avoid flicker when (un)redirecting windows
Currently when a window is requested to be unredirected, the
corresponding pixmap and texture can get cleared before the window has
been unredirected by the X server. This can result in the windows behind
showing through which causes a short flicker after showing an OSD or
notification when a fullscreen application is running.
Fix this by ensuring the texture is only cleared after the window has
been unredirected by the server.

Similarly when the window is being redirected again, the pixmap of the
window can only be requested after the redirection has been completed by
the server. This currently can happen in a different frame than the next
redraw of the actor resulting in an empty texture until the next redraw.
Fix this by queuing a redraw immediately after redirecting.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/997
2020-02-18 22:49:01 +00:00
Jonas Ådahl
c06fae4741 window-actor: Don't show actor until meta_window_actor_show()
By default clutter will show an actor as it is added to a parent. This
means that after we create the window actor, when it's added to the
window group, we implicitly show it. What we really want is to not show
it until the window is supposed to be shown, which happens when
meta_window_actor_show() is called, as showing prior to that, could
cause issues.

Avoid the implicit show by setting the "show-on-set-parent" property on
the window actor to `FALSE` on window actor construction.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1066
2020-02-18 23:04:49 +01:00
Olivier Fourdan
76e0d7293d window-actor/x11: Update opaque region
Now that the opaque region is not reset by the Wayland actor surface, we
need to update the opaque region just like we do for input region.

That fixes a regression with client-side decoration X11 windows running
in Xwayland.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1060
Closes: https://gitlab.gnome.org/GNOME/mutter/issues/1043
2020-02-17 23:37:18 +00:00
Robert Mader
aceadfe305 cullable: Check if effects are disabled
Currently we skip culling actors if they have any effects set. But
effects can be disabled, in which case we don't need to do that.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1052
2020-02-14 01:17:42 +01:00
Olivier Fourdan
0f58c98386 screen-cast-window: Use buffer bounds in place of frame bounds
The frame bounds as returned by `meta_window_actor_get_frame_bounds()`
would be used as cropping values when streaming a window content.

But, as its name implies, it returns the actual frame bounds, whereas we
may want to include the whole buffer, to include client side shadows for
example.

Rename the `get_frame_bounds()` API to `get_buffer_bounds()` (which was
previously partly removed with commit 11bd84789) and return the actual
buffer bounds to use as the cropping area when streaming a window.

Fixes: 931934511 - "Implement MetaScreenCastWindow interface"
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1022
Closes: https://gitlab.gnome.org/GNOME/mutter/issues/1018
2020-02-11 12:59:57 +00:00
Olivier Fourdan
ebc07871eb shaped-texture: Add get_width()/get_height() API
Add an API to retrieve the content size of a shaped texture.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1022
2020-02-11 12:59:57 +00:00
Olivier Fourdan
840c50b00d window-actor: Ensure clipping in capture_into()
The clip bounds passed in `meta_window_actor_capture_into()` represent
the actual allocated buffer size where the window actor image will be
eventually copied.

As such, it is completely agnostic to the scaling factors that might
affect the different surface actors which compose the window actor.

So instead of trying to compute the scale factor by which the given
clipping bounds need to be adjusted, simply clip the resulting image
based on the given bounds to make sure we never overflow the destination
buffer.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1022
2020-02-11 12:59:57 +00:00
Robert Mader
264f68858a surface-actor: Implement meta_cullable_is_untransformed interface
Its `cull_out()` method was already implemented with geometry scale
in mind. Add a corresponding `is_untransformed()` method so culling
succeeds with geometry scale > 1.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1036
2020-02-08 19:20:41 +01:00
Robert Mader
56ce25360c cullable: Factor out untransformed check into a vfunc
Some cullable implementation may have extra information about their
expected size. The main example here are surface actors which can be scaled
by geometry scale.

Add an API to overwrite the default size / untransformed check for such cases.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1036
2020-02-08 19:20:41 +01:00
Robert Mader
d8b7905662 surface-actor: Scale unobscured and clip region by geometry scale
The local copy of the clip- and unobscured region are used to optimize
painting. To get correct results when the actor is scaled, thus "grows",
the corresponding regions have to "shrink", i.e. get scaled down.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1036
2020-02-07 19:22:15 +01:00
Robert Mader
cbef49fd74 shaped-texture: Remove unused meta-cullable header
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1036
2020-02-07 18:05:49 +01:00
Daniel van Vugt
76240e24f7 background: Scale monitor_area after texture creation
Scaling the `monitor_area` before texture creation was just wasting
megabytes of memory on resolution that the monitor can't display. This
was also hurting runtime performance.

Example:

  Monitor is natively 1920x1080 and scale set to 3.

  Before: The monitor texture allocated was 5760x3250x4 = 74.6 MB
  After:  The monitor texture allocated is  1920x1080x4 =  8.3 MB

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1004
2020-02-04 19:48:01 +00:00
Olivier Fourdan
1ce933e281 window-actor/x11: Get frame rect from the buffer size
When building the frame mask, the current reported frame size may not
match when is actually on screen if the buffer has not been updated
yet.

So instead of getting the frame size from the meta window, deduce it
from the texture size.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1009
2020-01-29 10:44:50 +00:00
Olivier Fourdan
c0321c7b21 frame: Pass the frame area for get_mask()
Currently, `meta_frame_get_mask()` and `meta_ui_frame_get_mask()` will
return the frame mask applied to the current frame size, by querying the
frame themselves.

To be able to get the frame mask at an arbitrary size, change the API to
take a rectangle representing the size at which the frame mask should be
rendered.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1009
2020-01-29 10:44:50 +00:00
Olivier Fourdan
7dbb4bc3f5 window-actor/x11: Cache the client area
With Xwayland, the shape region is recomputed and reapplied even when
the actor is frozen to prevent the black shadows effect.

However, while recomputing the shape region, the current client size is
taken into account, rather than the size when the client was frozen,
which is ahead of the actual client size using the NET_WM_SYNC protocol.

Keep the current client area and to reuse them when the X11 window actor
is frozen for rebuilding the client mask texture.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1009
2020-01-29 10:44:50 +00:00
Sebastian Keller
b30a29f830 shaped-texture: Plug region leak
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1002
2020-01-16 20:57:20 +00:00
Olivier Fourdan
c0038f6dac window-actor/x11: Update shape even when frozen
On Xwayland, freezing actor updates on sync requests means the
server-side frame and shadows repaint will be frozen as well, which
causes the shadow to show black at times when resizing X11 clients
which support NET_WM_SYNC.

Using freeze/thaw commits prevents the content from changing, yet the
shape window still needs to be updated when frozen otherwise the
difference in shape induced by the on-going resize operation will show
as well, even if the toplevel window has its commits frozen.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/942
Closes: https://bugzilla.gnome.org/show_bug.cgi?id=767212
Closes: https://gitlab.gnome.org/GNOME/mutter/issues/858
2020-01-16 09:22:25 +01:00
Olivier Fourdan
d7a7af1ff2 window-actor/x11: Freeze/thaw commits on actor freeze/thaw
When using Xwayland, if the damage get posted before the X11 window
manager/compositor has finished repainting the actors, the intermediate
state will show.

Make sure to hint Xwayland as to when it can post pending damages and
commit the Wayland buffer using the `freeze_commits()/thaw_commits()`
API, based on window actor freeze/thaw.

See-also: https://gitlab.gnome.org/GNOME/mutter/merge_requests/855
See-also: https://gitlab.freedesktop.org/xorg/xserver/merge_requests/316

https://gitlab.gnome.org/GNOME/mutter/merge_requests/942
2020-01-16 09:22:25 +01:00
Olivier Fourdan
aa017383ac window-actor: Add set_frozen vfunc
Currently, the window actor freeze/thaw implementation sets the frozen
state of the surface actor using `meta_surface_actor_set_frozen()`.

If we want to expand that behavior to also freeze/thaw commits for X11
windows running on Xwayland, we need to have a specific vfunc to abstract
that in the window actor specific implementation.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/942
2020-01-16 09:22:25 +01:00
Olivier Fourdan
c3c54e8ce6 surface-actor: Add meta_surface_actor_is_frozen()
Change the internal `is_frozen()` API to be available publicly.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/942
2020-01-16 09:22:25 +01:00
Olivier Fourdan
4ae9953607 window/x11: Freeze commits on resize
Make sure we freeze commits before resizing the window as this will
clear the frame to black.

Set the "thaw on paint" flag so that the post paint for window actor X11
can then thaw the freeze initiated prior to the resize and keep the
freeze/thaw balanced.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/942
2020-01-16 09:22:25 +01:00
Jonas Ådahl
3969285e5c shaped-texture: Make setting the same texture a no-op
Will be helpful when pushing state to the shaped texture, letting the
one pushing not have to care about checking if anything changed.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/961
2020-01-10 16:01:22 +00:00
Jonas Ådahl
60ebf19c9e shaped-texture: Minor clean up
Use cogl_clear_object(), add reference to texture when setting, and
remove redundant runtime type check.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/961
2020-01-10 16:01:22 +00:00
Jonas Ådahl
6e5ac0b585 Use G_GNUC_FALLTHROUGH instead of comments
Get the same task done in a bit more C:y way.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/998
2020-01-09 17:58:29 +01:00
Robert Mader
a8cb84c711 window-actor: Also cull out clip_region
From `meta_cullable_cull_out`:
```
Actors that may have fully opaque parts should also subtract out a region
that is fully opaque from @unobscured_region and @clip_region.
```

As we do no check for the intersection of these two elsewhere in the code,
let's substract from the clip region, too.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/985
2020-01-06 13:38:23 +00:00
Jonas Ådahl
3f65837e0d clutter, core: Stop using the Cogl framebuffer stack
The Cogl framebuffer stack is going away; replace all its uses by the
framebuffer stack carried by the paint context.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
549f60fe49 texture-tower: Don't use implicit framebuffer stack Cogl API
Replace it with the non-deprecated counterparts.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
26147afb08 shadow-factory: Don't set implicit Cogl material
We only draw with non-deprecated API already, so there is no reason to
set the source material.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
f11170fecb clutter/paint-node: Have caller of .._get_framebuffer() handle fallback
clutter_paint_node_get_framebuffer() fell back on
cogl_get_draw_framebuffer() when the root node didn't have a custom
get_framebuffer vfunc. As this relies on deprecated implicit Cogl stack
API, it needs to go away, so handle this in the caller that knows more
about the context.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
cb9d6b79ef clutter: Introduce pick contexts
Just as with painting, add a pick context that carries pick related
temporary state when doing actor picking. It is currently unused, and
will at least at first still carry around a framebuffer to deal track
view transforms etc.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
49c8d42317 clutter: Introduce paint contexts
When painting, actors rely on semi global state tracked by the state to
get various things needed for painting, such as the current draw
framebuffer. Having state hidden in such ways can be very deceiving as
it's hard to follow changes spread out, and adding more and more state
that should be tracked during a paint gets annoying as they will not
change in isolation but one by one in their own places. To do this
better, introduce a paint context that is passed along in paint calls
that contains the necessary state needed during painting.

The paint context implements a framebuffer stack just as Cogl works,
which is currently needed for offscreen rendering used by clutter.

The same context is passed around for paint nodes, contents and effects
as well.

In this commit, the context is only introduced, but not used. It aims to
replace the Cogl framebuffer stack, and will allow actors to know what
view it is currently painted on.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Robert Mader
0247d35e5a shaped-texture: Do not invalidate content on set_cogl_texture()
This was wrongly introduced in 75cffd0ec4. As the comment above explains, we
only want to queue redraws in response to surface/buffer damage.

This triggered a full redraw when using DMA buffers on Wayland as we currently
create a new texture on every buffer_attach(), breaking partial invalidation.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/947
2019-11-26 21:35:50 +01:00
Corentin Noël
5582d7b3be background: set_file accepts NULL files
https://gitlab.gnome.org/GNOME/mutter/merge_requests/941
2019-11-22 22:13:35 +00:00
Carlos Garnacho
e44bd2edb4 compositor: Use redraw clip region to cull out children
This will avoid repainting too much of the background if the
bounding box turned out to be too large.

https://bugzilla.gnome.org/show_bug.cgi?id=782344
2019-11-22 21:07:05 +00:00
Robert Mader
8e172aeecb cleanup: Use g_clear_handle_id() for g_source_remove()
It makes sure we do not forget to zero the id and lets us avoid
zero checks before. We use it for all new code, lets clean up the
existing code base.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/947
2019-11-22 01:27:40 +01:00
Robert Mader
92375c75f8 cleanup: Use g_clear_signal_handler() where possible
This is inspired by 98892391d7 where the usage of
`g_signal_handler_disconnect()` without resetting the corresponding
handler id later resulted in a bug. Using `g_clear_signal_handler()`
makes sure we avoid similar bugs and is almost always the better
alternative. We use it for new code, let's clean up the old code to
also use it.

A further benefit is that it can get called even if the passed id is
0, allowing us to remove a lot of now unnessecary checks, and the fact
that `g_clear_signal_handler()` checks for the right type size, forcing us
to clean up all places where we used `guint` instead of `gulong`.

No functional changes intended here and all changes should be trivial,
thus bundled in one big commit.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/940
2019-11-21 15:02:27 +00:00
Jonas Ådahl
7193938d27 compositor: Guard against untimely calls
It seems that sometimes these functions are called by Javascript in
GNOME Shell during tear down. This causes segfaults and crash reports,
but without any backtraces other than the entry and exit points into
gjs.

In order to get more useful information about where these calls come
from, validate the input passed gracefully, by complaining in the log
and returning NULL values.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/926
2019-11-11 13:09:20 +00:00
Robert Mader
a4f51da184 plugin-manager: Kill window effects on destroy
We do so for all other window effects already. Why this was left out
is unknown (9b3a0d1ad8), but we will need it for a fix in GS.

Related: https://gitlab.gnome.org/GNOME/mutter/issues/655

https://gitlab.gnome.org/GNOME/mutter/merge_requests/924
2019-11-08 22:18:09 +00:00
Florian Müllner
0545b93232 plugins/default: Handle skipped animations
We currently assume that the actor_animate() helper function returns
a timeline. However Clutter may skip implicit animations and simple
set properties directly, for example when the actor is hidden.

The returned timeline will be NULL in that case, and we abort when
using it as instance parameter to g_signal_connect().

Fix this by only setting up a completed handler when we are actually
animating, and complete the effect directly otherwise.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/925
2019-11-08 22:49:31 +01:00
Jonas Ådahl
dc1a28c42a plugins/default: Clean up tile preview when closing display
On finalize, the preview actor will have been destroyed behind our back;
avoid that by cleaning up before it's too late.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/912
2019-11-05 10:35:00 +01:00
Jonas Ådahl
955b27637c plugin/default: Init quark before using
Cut lines in pieces, and remove useless "optimizations" while at it

https://gitlab.gnome.org/GNOME/mutter/merge_requests/912
2019-11-05 10:35:00 +01:00
Robert Mader
5e87d67e5f surface-actor-wayland: Do not send frame callbacks if the actor is obscured
`meta_surface_actor_is_obscured` implies that the actor got successfully culled
out and nothing of it will get painted. This includes that there are no clones,
no effects etc. In this cases we don't want to send frame callbacks, thus avoiding
unnecessary client work.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/918
2019-11-04 16:06:37 +01:00
Carlos Garnacho
40e6aa7d94 compositor: Plug cairo_region_t leak
The MetaBackgroundActor uses a region to find out the areas that need
repainting, but forgot to free it, oops.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/873
2019-10-21 19:01:37 +02:00
Georges Basile Stavracas Neto
179d5ba6a6 clutter: Split pick and paint
Add the corresponding clutter_actor_pick() and
clutter_actor_continue_pick() as public APIs,
and use them in pick overrides and ClutterEffect.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/865
2019-10-21 13:49:26 +00:00
Daniel van Vugt
e82a657cd9 clutter/actor: Remove color from the pick virtual function
It's unused since commit 14c706e51.

**ABI break**

https://gitlab.gnome.org/GNOME/mutter/merge_requests/851
2019-10-16 12:01:16 +00:00
Georges Basile Stavracas Neto
bdf5e3f357 Replace ClutterGeometry by graphene_rect_t
The last of the replacements. It is fine for now
to replace ClutterGeometry's integers by floats.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:14 +00:00
Georges Basile Stavracas Neto
94682e69aa Replace ClutterRect by graphene_rect_t
https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:14 +00:00
Georges Basile Stavracas Neto
160cc9182d Replace ClutterPoint by graphene_point_t
Remove the tests for ClutterPoint since it's
corresponding code moved to private ClutterStage
methods.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:14 +00:00
Georges Basile Stavracas Neto
a5d0cfe8fb Replace ClutterVertex by graphene_point3d_t
Pretty direct and straightforward port. This requires a
GNOME Shell counterpart. In addition to that, include a
progress function.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:13 +00:00
Georges Basile Stavracas Neto
959a418cc3 Replace CoglEuler by graphene_euler_t
As the first step into removing Cogl types that are covered by
Graphene, remove CoglEuler and replace it by graphene_euler_t.

This is a mostly straightforward replacement, except that the
naming conventions changed a bit. Cogl uses "heading" for the
Y axis, "pitch" for the X axis, and "roll" for the Z axis, and
graphene uses the axis themselves. That means the 1st and 2nd
arguments need to be swapped.

Also adapt the matrix stack to store a graphene_euler_t in the
rotation node -- that simplifies the code a bit as well.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:13 +00:00
Jonas Ådahl
f7315c9a36 window-actor: Move shapes, shadows and unredirection to X11 sub types
Move out updating of various shapes (input, opaque, shape) indirectly
from X11 to the corresponding X11 sub types of MetaWindowActor and
MetaSurfaceActor.

Also move fullscreen window unredirection code with it. We want to
effectively do something similar for MetaCompositorServer, but it will
work differently enough not to share too much logic.

While it would have been nice to move things piece by piece, things were
too intertwined to make it feasible.

This has the side effect fixing accidentally and arbitrarily adding
server side shadow to Wayland surfaces.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/727

https://gitlab.gnome.org/GNOME/mutter/merge_requests/734
2019-10-16 13:16:55 +02:00
Jonas Ådahl
9ac52f0340 compositor/x11: Move unredirect logic to helper
It makes it clearer what is required for unredirecting a window.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/734
2019-10-16 13:05:40 +02:00
Jonas Ådahl
f059466337 window-actor/x11: Use g_clear_signal_handler()
Also fixes type of handler ID.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/734
2019-10-16 13:05:40 +02:00
Jonas Ådahl
dcd0f4322a shaped-texture: Add API to check opaqueness
It is opaque if the texture has no alpha channel, or if the opaque
region covers the whole content.

Internally uses a function that checks whether there is an alpha
channel. This API will be exposed at a later time as well.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/734
2019-10-16 13:05:40 +02:00
Jonas Ådahl
c474ad6a53 Stop including core.h where it's not used
It provides glue for window frame controls and internal window
management, and that is only relevant for a couple of places in src/ui/.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/854
2019-10-15 07:17:29 +00:00
Robert Mader
317ce05a27 window-actor: Add a missing NULL-check
We shouldn't crash on a NULL-clip.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/856
2019-10-14 18:23:32 +02:00
Jonas Ådahl
fb6e2743ec plugins/default: Hold reference on timelines while stopping
We get implicit, thus auto-removed, transitions, then manage them
manually by stopping them and emitting "completed" signals. This doesn't
work since they are removed and freed when stopped. To be able to emit
the "completed" signal, hold a reference while stopping, so that we
still can emit the signal as before.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/828
2019-10-07 18:33:28 +00:00
Ting-Wei Lan
006eb6d81e build: Fix build when wayland is disabled
https://gitlab.gnome.org/GNOME/mutter/merge_requests/817
2019-10-03 08:52:44 +00:00
Jonas Ådahl
f352c3d79d display: Handle late unredirect (un)inhibit calls
When tearing down, gnome-shell may call various methods a bit late,
specifically while MetaDisplay is closing, after MetaCompositor is
freed.

Handle calls to the fullscreen unredirect inhibitation counters
happening after MetaCompositor tear down by ignoring them. We're closing
anyway, so it's not a problem.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1710

https://gitlab.gnome.org/GNOME/mutter/merge_requests/808
2019-09-26 11:43:00 +02:00
Robert Mader
b5775e3d85 window-actor: Use surface coordinates for the fast path in get_image()
shaped_texture requires the clip to be in surface coordinates. Scale
it accordingly.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/758
2019-09-20 16:42:55 +00:00
Robert Mader
cd70595b50 shaped-texture: Use surface coordinates in get_image()
There were multiple bugs present after the ClutterContent transition.
Refactor `get_image` to:

- always assume surface coordinates for the clip
- return a cairo_surface in buffer size
- make the offscreen path take size arguments, so we can
easily change the assumption in get_image
- fix some clipping bugs on the way

https://gitlab.gnome.org/GNOME/mutter/merge_requests/758
2019-09-20 16:42:55 +00:00
Marco Trevisan (Treviño)
b8a49a682e window/surface-actor: Add docstrings
Redefine the docstring for functions using shaped texture, setting the clip
as nullable.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/79
2019-09-20 15:03:52 +00:00
Marco Trevisan (Treviño)
82901f89d5 shaped-texture: Mark set the clip and return value nullable
As per the code definition the clip can be a null rectangle, and we can also
return a null surface, so mark them as nullable in the introspection.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/796
2019-09-20 15:03:52 +00:00
Jonas Ådahl
ef2e04a613 plugins/default: Get default keymap from localed
When starting standalone mutter and running using the native backend, we
always fall back on using the us pc105 keyboard layout. This can be very
frustrating if one is used to using some other keyboard layout, such as
dvorak, causing keyboard fumbling everytime when doing something with
standalone mutter.

Avoid this involuntary fumbling by having the default plugin query
localed what layout the user has actually configured the machine to
operate using. It doesn't add any keymap selection user interface, so
it'll always use the first one it encounters.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/787
2019-09-10 20:09:40 +00:00