Commit Graph

27197 Commits

Author SHA1 Message Date
Jonas Ådahl
30e1c51b33 Change all g_memdup() to g_memdup2()
Using g_memdup() is dangerous due to the type of the size argument. See
https://gitlab.gnome.org/GNOME/glib/-/issues/2319 and
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1926 for details.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1708>
2021-02-04 19:16:28 +01:00
Hugo Carvalho
70c5febdd9 Update Portuguese translation 2021-02-04 16:50:17 +00:00
Daniel Șerbănescu
aecdbf8f8e Update Romanian translation 2021-02-04 16:45:31 +00:00
Yuri Chornoivan
7ac73b4254 Update Ukrainian translation 2021-02-04 15:36:23 +00:00
Florian Müllner
36424ab298 data: Updated exposed keybindings
Workspaces were changed to a horizontal layout, so we should show
the keybindings for horizontal navigation in Settings instead of
the vertical ones.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1706>
2021-02-04 00:09:57 +01:00
Sebastian Keller
a9d9aee6c0 kms/impl-device-atomic: Fix blob_ids array leak
release_blob_ids() only destroys the DRM property blobs, but does not
free the array they were stored in.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1699>
2021-02-02 14:41:52 +00:00
Daniel Șerbănescu
3e186aa5a7 Update Romanian translation 2021-02-02 11:12:51 +00:00
Jonas Ådahl
ca22622517 screen-cast/src: Only allocate DMA buffers if other end supports it
The other end of the PipeWire stream can set the buffer data type to a
bitmask of supported buffer types. We should respect this, and not
attempt to allocate a DMA buffer if it isn't asked for.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1697>
2021-02-02 10:25:12 +00:00
Jonas Ådahl
ca95ccdef0 screen-cast/src: Always first set spa buffer data to NULL
We use that elsewhere for sanity checking, and it's not initialized to
anything, so might be pointing to invalid memory if buffer allocation
failed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1697>
2021-02-02 10:25:12 +00:00
Jonas Ådahl
08ad107df5 screen-cast/src: Handle failing to allocate shm buffers
Don't leak the file descriptors, and don't fall over when trying to
clean up buffers that failed to allocate.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1697>
2021-02-02 10:25:12 +00:00
Jonas Ådahl
70d9a7b4bf screen-cast/src: Pass dimension and stride when needed
Instead of getters, pass the width, height and stride around when
relevant. This also removes the redudant "stream_size" and
"stream_height" variables from the src struct, as they are already part
of the video format.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1697>
2021-02-02 10:25:12 +00:00
Daniel van Vugt
41bf0181b9 clutter/offscreen-effect: Set the viewport correctly
Previously we were setting the FBO's viewport to be the same dimensions as
the stage itself for compatibility. This works for most cases, but not if
the actor is larger than the stage. In that case it could cause excessive
clipping if the actor's transformed screen position was negative, which
is seen in https://gitlab.gnome.org/GNOME/gnome-shell/issues/2087

Also if a small actor paints to its negative dimensions (like a box-shadow)
then we might be missing those pixels on the left or top, even though
they're inside the paint volume.

Now we set the viewport dimensions to match the area we're actually
rendering so the FBO contents are never over or under clipped.

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

Although if you try using shadows larger than that (like in
gnome-shell#1090) then you will also need gnome-shell!1417.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1053>
2021-02-02 09:42:56 +00:00
Daniel van Vugt
f887b02714 clutter/offscreen-effect: Unscale first, then translate the FBO texture
We had been doing it backwards as far back as e3966882e8 which meant
that we were translating by `fbo_offset / resource_scale` stage units
instead of just `fbo_offset`.

Because `fbo_offset` is in stage units already, it's not scaled and so
needs to be applied after the unscaling from texels to stage units.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1053>
2021-02-02 09:42:56 +00:00
Yuri Chornoivan
2373ad2a19 Update Ukrainian translation 2021-02-02 09:25:39 +00:00
Björn Daase
ea39379224 gschema: Fix capitalization of autoclose-xwayland option
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1696>
2021-02-01 18:56:39 +01:00
Rafael Fontenelle
6a47eb8c8a Update Brazilian Portuguese translation 2021-01-31 12:39:57 +00:00
Marek Černocký
c07308ea43 Updated Czech translation 2021-01-30 12:09:01 +01:00
Olivier Fourdan
a2e2cfe437 window/x11: Check before freezing commits
Now that we have a window actor API that can hint whether or not the
window actor would support freezing commits, use it to avoid freezing
Xwayland commit on actors that will not be thawed after paint.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1615
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1678>
2021-01-30 10:13:03 +00:00
Olivier Fourdan
df5a5d279d window-actor: Add a new can_freeze_commits() API
Mutter freezes Xwayland commits when resizing windows, and thaw them in
the window actors' after_paint() for X11.

Yet, after_paint() could be never called, as when a new window is mapped
while the overview is active in gnome-shell.

As a result, the content of the X11 window will remain invisible to the
overview.

Add a new window actor API to tell whether commits can be frozen. For
Wayland window actors, this always return FALSE, whereas for X11 window
actors, it checks whether the Clutter actor is mapped.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1678>
2021-01-30 10:13:03 +00:00
Jonas Ådahl
cda26b493e wayland: Only use async configured geometry if actually changed
When (un)maximizing, (un)fullscreening, the move/resize action is
flagged with 'ACTION_MOVE' and 'ACTION_RESIZE' , while e.g.
'appears-focus' does not.

When a client misbehaved and didn't immediately reply to a configure
request with a commit with the corresponding ack_configure, the
following commit would trigger a oddly timed move, making the window
appear to move back to a previous position.

Avoid this issue by only carrying over the target window position if the
configuration actually contained a new position.

We cannot only rely on the flags however, as e.g. a new position should
be respected during interactive resize, even though only 'ACTION_RESIZE'
is passed in such scenarios.

Do the same for the size, except if the window state dictates that the
size is fixed to a certain size, e.g. being fullscreen or maximized.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1445>
2021-01-30 09:49:13 +00:00
Jonas Ådahl
9a21f97ce1 cogl/gl-framebuffer: Remove hard coding type name
Either "onscreen" or "offscreen" was logged as the type; replace this
with the actual type name.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:47 +00:00
Jonas Ådahl
b07994b606 cogl: Use 'is_y_flipped()' instead of instance-of checking
This is what it was effectively used for in these places, so use the
appropriate API instead.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:47 +00:00
Jonas Ådahl
6b5d7f45cb cogl/gl-framebuffer: Check Y-flipped-ness instead of framebuffer type
In a few places coordinates were flipped if driven framebuffer was or
wasn't a CoglOffscreen. Change this to use the existing Y-flipped-ness
class vfunc.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
102aa59ce3 cogl/gl-framebuffer: Move stereo mode state flushing to backend
It's currently only handled by a surface backend framebuffer (assuming
the right GLX extensions are available). While it's theoretically
possible to do the same with the offcreen by having multiple textures,
it's not supported, so leave the FBO variant with a single warning if we
end up there.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
dd55c3699c cogl/gl-framebuffer: GObject:ify helper functions
The object was still pretending to be CoglFramebuffer itself, by using
naming and calling conventions making it seem like that. Fix that by
passing around the driver instead of the framebuffer.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
0fcb26075f cogl/framebuffer: Move read_pixels_into_bitmap() to driver class
This was the last driver vfunc used specifically to implement the
CoglFramebuffer driver.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
1e5f105836 cogl/framebuffer: Move attribute drawing to driver class
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
392ffaeeb4 cogl/framebuffer: Move discard_buffers() to driver sub types
It was implemented slightly different depending on whether it was for a
surface or FBO, so move it to their corresponding GL driver types.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
b7c6865225 cogl/framebuffer: Move flush() and finish() to driver class
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
1b3937491c cogl/framebuffer: Move clear() to CoglFramebufferDriver
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
4f3b57c841 cogl/onscreen: Move buffer age getter vfunc to class
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
b2482a2069 cogl: Add CoglX11Onscreen interface
Mutter needs to fetch the X11 Window ID from the onscreen and did that
by using an X11 specific API on the CoglOnscreen, where the X11 type was
"expanded" (Window -> uint32_t). Change this by introducing an interface
called CoglX11Onscreen, implemented by both the Xlib and GLX onscreen
implementations, that keeps the right type (Window), while avoiding X11
specific API for CoglOnscreen.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
4ec0975e91 cogl/onscreen: Remove explicit 'resizable':ness
Mutter didn't use the APIs for resizeability of CoglOnscreens but
managed the size itself. For the native backend we don't ever resize
onscreens. Thus, remove this unused functionality.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
e43b95cd11 cogl/onscreen: Remove show()/hide()
Not used, and not relevant.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
b0ec3a3ad7 cogl/test-utils: Skip "showing" the onscreen
Tests pass anyway.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
0fdf6a6405 cogl/onscreen: Move direct scanout to CoglOnscreen class
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
f663567405 cogl/onscreen: Move binding to onscreen class
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
fe72876b20 cogl/onscreen: Make swap_buffer/region CoglOnscreen class vfuncs
No need to go via the "winsys" vtable.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
60e1516b1c cogl/gl-framebuffer: Split up into FBO and back drivers
One is for when we're painting to the back buffer (onscreen), and the
other when we're painting to an FBO (offscreen).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
a6b0376a6c cogl: Add 'framebuffer' debug topic
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
d136c6510b cogl: Init framebuffer driver up front
The framebuffer driver was lazilly initialized on demand in some cases
(onscreen), and up front other (offscreen). Replace this with a more
predictable up front initialization, done at framebuffer allocation.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
58eb1e87bf cogl/offscreen: Move struct to C file
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:46 +00:00
Jonas Ådahl
ece714c5c6 cogl/gl-framebuffer: Move struct fields into private
This makes it possible to make type derivable.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:45 +00:00
Jonas Ådahl
e3de0be678 cogl: Move "flush framebuffers" under the context scope
It was namespaced as a CoglFramebuffer function, but was passed two
framebuffers, and operated on state kept in CoglContext. Move and rename
accordingly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:45 +00:00
Jonas Ådahl
5be5529269 cogl: Add CoglFramebufferDriver base type
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:45 +00:00
Jonas Ådahl
c7ea0b3d54 cogl/offscreen: Pass ColgOffscreenFlag when allocating
So that the allocation functions don't need to peek at the cached flag
struct field.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:45 +00:00
Jonas Ådahl
cac5938238 cogl/gl-framebuffer: Fix allocate flag variable name
It was called 'flags' which would conflict with a variable containing a
CoglOffscreenFlag that will be added later.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:45 +00:00
Jonas Ådahl
1bee9e0d53 cogl/offscreen: Remove alloation_flags struct field
Was unused.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:45 +00:00
Jonas Ådahl
408d4c9f09 cogl/offscreen: Remove depth buffer texture field
It was never set, so it was just some dead code.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:45 +00:00
Jonas Ådahl
8910b3e7bc cogl/offscreen: Move CoglGlFbo struct to GL driver
It was only used there, so put it in the driver private struct.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
2021-01-30 09:11:45 +00:00