1
0
Fork 0
Commit graph

26186 commits

Author SHA1 Message Date
Jonas Ådahl
3d19b8f49c cursor-tracker: Move out more X11:isms to the X11 backend
This includes the xfixes cursor management.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
Jonas Ådahl
a80b0f34e3 clutter: Remove old split capture based screen shooting API
This is no longer used, and the replacement (clutter_stage_paint_to_*())
should be used instead.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
Jonas Ådahl
1743887fa7 clutter: Expose clutter_stage_paint_to_(frame)buffer()
This will be used by GNOME Shell to take screenshots.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
Jonas Ådahl
b4a8247191 screen-cast: Track and always record cursors
Always force-track the cursor position (so that the X11 backend can keep
it up to date), and if the cursor wasn't part of the sampled
framebuffer when reading pixels into CPU memory, draw it in an extra
pass using cairo after the fact. The cairo based cursor painting only
happens on the X11 backend, as we otherwise inhibit the hw cursor.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
Jonas Ådahl
eeee7bed1d cursor-tracker: Add way to force tracking cursor position
On X11 we won't always receive cursor positions, as some other client
might have grabbed the pointer (e.g. for implementing a popup menu). To
make screen casting show a somewhat correct cursor position, we need to
actively poll the X server about the current cursor position.

We only really want to do this when screen casting or taking a
screenshot, so add an API that forces the cursor tracker to track the
cursor position.

On the native backend this is a no-op as we by default always track the
cursor position anyway.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
Jonas Ådahl
b24b95db15 cursor-tracker: Only emit 'cursor-moved' if it moved
This makes it safe to update the position with the same coordinates
without risking 'cursor-moved' being emitted when nothing actually
moved.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
Jonas Ådahl
e1f25b7244 cursor-sprite: Don't NULL check realize_texture() vfunc
All non-abstract MetaCursorSprite type implementations implement this
function, so no need to NULL check it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
Jonas Ådahl
b319add04b cursor-renderer: Remove unneeded NULL check
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
Jonas Ådahl
3abbfef66e cursor-tracker: Add X11 cursor tracker backend
The intention is to use this to actively track the cursor position given
a fixed interval when needed, e.g. when screen casting.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
Jonas Ådahl
fcf7c4d0c7 cursor-renderer: Always keep the cursor overlay on the stage
Only when the cursor isn't handled by the backend is the overlay made
visible. This is intended to be used when painting the stage to an
offscreen using clutter_stage_paint_to_(frame)buffer() in a way where
the cursor is always included.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
Jonas Ådahl
d8be2a8b85 stage: Use g_list_foreach instead of manual for loop
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
Jonas Ådahl
f5958fa473 stage: Keep a pointer to the backend
Will be used later.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
Jonas Ådahl
c23b675daf cursor-tracker: Keep a pointer to the backend
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
Jonas Ådahl
59a2fc4f5a cursor-tracker: Move struct fields into instance private
This is so that we can make the cursor tracker type derivable.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
Jonas Ådahl
4a125e73a2 cursor-tracker: Move struct definition into .c file
Not used externally, and if so should use API.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
Daniel van Vugt
2de69cd3cc clutter-offscreen-effect: Invalidate cache on gl-video-memory-purged
This fixes graphics corruption that could occur on resume from suspend
with the Nvidia driver.

https://www.khronos.org/registry/OpenGL/extensions/NV/NV_robustness_video_memory_purge.txt

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1374
2020-08-05 08:26:37 +00:00
Daniel van Vugt
305fcd0713 clutter-stage: Add gl-video-memory-purged signal
For when you want parts of Clutter to connect to the signal, without
referencing Meta classes.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1374
2020-08-05 08:26:37 +00:00
Philipp Zabel
7564c2f2e4 kms: Skip displays with 'non-desktop' property set
Detect displays marked as 'non-desktop' by the kernel and skip them when
creating the outputs. Mutter is not able to render images that are shown
properly on those devices anyway.

This avoids lighting up attached VR HMDs and showing the GDM login
screen between the eyes in a VR HMD instead of on the monitor.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1393
2020-08-05 06:09:36 +00:00
Florian Müllner
769997b0bc ci: Explicitly specify job dependencies
We can speed up CI a bit by allowing build jobs to run in parallel
with review jobs, and don't have test jobs wait for non-default
build configuration builds.

See https://gitlab.gnome.org/help/ci/yaml/README.md#needs for details.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1398
2020-08-04 18:00:04 +02:00
Jonas Ådahl
5ea0034943 renderer/native: Remove left-over comment
Since the frame clock split it's no longer valid, so remove it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1397
2020-08-04 15:20:54 +02:00
Daniel van Vugt
4c513e3e19 backends/native: Remove unused meta_gpu_kms_wait_for_flip and more
Remove unused function `meta_gpu_kms_wait_for_flip` and other code which
only existed to support `meta_gpu_kms_wait_for_flip`.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1388
2020-08-04 08:57:06 +00:00
Daniel van Vugt
f3ad63e206 Remove unused flag COGL_WINSYS_FEATURE_SWAP_THROTTLE
This also removes an old comment about `wait_for_pending_flips` which
no longer exists.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1390
2020-08-04 08:43:57 +00:00
Daniel van Vugt
593e610415 clutter: Remove unused flag CLUTTER_FEATURE_SWAP_THROTTLE
It's been unused ever since e415cc538a.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1390
2020-08-04 08:43:57 +00:00
Sergio Costas
f894f5cc13 wayland: Add API to launch trusted clients
Allowing code from inside mutter to create a child process and
delegate on it some of its tasks is something very useful. This can
be done easily with the g_subprocess and g_subprocess_launcher classes
already available in GLib and GObject.

Unfortunately, although the child process can be a graphical program,
currently it is not possible for the inner code to identify the
windows created by the child in a secure manner (this is: being able
to ensure that a malicious program won't be able to trick the inner
code into thinking it is a child process launched by it).

Under X11 this is not a problem because any program has full control
over their windows, but under Wayland it is a different story: a
program can't neither force their window to be kept at the top (like a
docker program does) or at the bottom (like a program for desktop icons
does), nor hide it from the list of windows. This means that it is not
possible for a "classic", non-priviledged program, to fulfill these
tasks, and it can be done only from code inside mutter (like a
gnome-shell extension).

This is a non desirable situation, because an extension runs in the
same main loop than the whole desktop itself, which means that a
complex extension can need to do too much work inside the main loop,
and freeze the whole desktop for too much time. Also, it is important
to note that javascript doesn't have access to fork(), or threads,
which means that, at most, all the parallel computing that can do is
those available in the _async calls in GLib/GObject.

Also, having to create an extension for any priviledged graphical
element is an stopper for a lot of programmers who already know
GTK+ but doesn't know Clutter.

This patch wants to offer a solution to this problem, by offering a
new class that allows to launch a trusted child process from inside
mutter, and make it to use an specific UNIX socket to communicate
with the compositor. It also allows to check whether an specific
MetaWindow was created by one of this trusted child processes or not.

This allows to create extensions that launch a child process, and
when that process creates a window, the extension can confirm in a
secure way that the window really belongs to that process
launched by it, so it can give to that window "superpowers" like
being kept at the bottom of the desktop, not being listed in the
list of windows or shown in the Activities panel... Also, in future
versions, it could easily implement protocol extensions that only
could be used by these trusted child processes.

Several examples of the usefulness of this are that, with it, it
is possible to write programs that implements:

- desktop icons
- a dock
- a top or bottom bar
...

all in a secure manner, avoiding insecure programs to do the same.
In fact, even if the same code is launched manually, it won't have
those privileges, only the specific process launched from inside
mutter.

Since this is only needed under Wayland, it won't work under X11.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/741
2020-08-04 08:42:29 +00:00
Olivier Fourdan
17417a82a5 cleanup: remove controversial naming
Replace "whitelist" and "blacklist" with "allow_list" and "deny_list"
which better represent the purpose of those variables.

There is no functional change.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1396
2020-08-04 10:04:16 +02:00
Jordi Mas
5ed97f3a02 Update Catalan translation 2020-08-02 12:24:58 +02:00
Jonas Ådahl
34579d71cc remote-access-handle: Add 'is-recording' property
Will be TRUE if it is a screen cast session where all streams have the
'is-recording' set to TRUE. For other screen casts or remote desktop
sessions, it'll be FALSE.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1377
2020-07-31 10:41:38 +02:00
Jonas Ådahl
153357cd36 screen-cast: Add 'is-recording' option to record methods
This can be used by the Shell to change the UI to be the same as the
current built in screen recording.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1377
2020-07-31 10:41:15 +02:00
Jonas Ådahl
14cd78a016 screen-cast: Add screen cast flag to streams
Intended to be used to pass state from screen cast clients down the
line. The first use case will be a boolean whether a screen cast is a
plain recording or not, e.g. letting the Shell decide whether to use a
red dot as the icon, or the generic "sharing" symbol.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1377
2020-07-30 09:51:16 +02:00
Daniel García Moreno
109fbdbac9 clutter/actor: Add get_transformed_extents
The clutter_actor_get_transformed_position returns the position of the
top left point of the actor, with the actor transformations. That means
that if the actor is rotated 180º it'll return the "screen" position top
right.

Using this to calculate if the actor is in the screen is causing
problems when it's transformted.

This patch adds a new function clutter_actor_get_transformed_extents,
that will return the transformed actor bounding rect.

This new function is used on the update_stage_views so the actor will
get updated. this way rotated actors will be updated if they are on the
screen.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1386
2020-07-29 11:12:26 +02:00
Christian Hergert
2c08eb6d16 build: bump ABI to sysprof-capture-4
GLib will now be linking against sysprof-capture-4.a. To support that,
sysprof had to remove the GLib dependency from sysprof-capture-4 which
had the side-effect of breaking ABi.

This bumps the dependency and includes a fallback to compile just the
libsysprof-capture-4.a using a subproject wrap.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1352
2020-07-28 11:13:30 -07:00
Olivier Fourdan
ca64a308eb surface-actor: Restore drop shadow with server-side decorations
Commit 510cbef15a changed the logic in `handle_update()` for X11 window
actors to return early if the surface is not an X11 surface.

That works fine for plain Xorg, but on Xwayland, the surface is actually
a Wayland surface, therefore the function returns early before updating
the drop shadows of server-side decorations for X11 windows.

Change the test logic to restore drops shadows with Xwayland windows.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1384
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1358
2020-07-28 13:21:23 +00:00
Olivier Fourdan
d0ee02fae7 cleanup: Remove duplicate semicolons in C code
No functional change, it just hurts my eyes when reading the code.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1385
2020-07-28 10:32:46 +02:00
Sebastian Keller
c7d14244b1 x11: Add STRING/UTF8_STRING targets for selection sources lacking them
The memory selection source was only providing the "text/plain" or the
"text/plain;charset=utf-8" mimetype, but not "STRING" or "UTF8_STRING",
which some X11 clients, like wine, are looking for. This was breaking
pasting from the clipboard in wine applications.

Fix this by adding those targets when they are missing and the selection
source provides the corresponding mimetypes.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1369
2020-07-27 08:34:40 +00:00
Sebastian Keller
e1c4e55880 x11: Handle selection windows being destroyed before new selection
Wine destroys its old selection window immediately before creating a new
selection. This would trigger restoring the clipboard, which would
overwrite the new selection with the old one. The selection window
however can also be destroyed as part of the shutdown process of
applications, such as Chromium for example. In those cases we want the
clipboard to be restored after the selection window has been destroyed.

Solve this by not immediately restoring the clipboard but instead using
a timeout which can be canceled by any new selection owner, such as in
the Wine case.

Fixes https://gitlab.gnome.org/GNOME/mutter/-/issues/1338
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1369
2020-07-27 08:34:40 +00:00
Martin Whitaker
7b79fcee45 Fix segfaults on 32-bit systems.
The new "id" properties for the MetaCrtc* and MetaOuput* objects are 64-bit
values, so take care to pass 64-bit values when calling g_object_new.

Fixes https://gitlab.gnome.org/GNOME/mutter/-/issues/1343.
2020-07-24 11:24:08 +00:00
Carlos Garnacho
ac6990ef51 build: Depend on an up-to-date gsettings-desktop-schemas
Update the dependency as we use newer settings there.

Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3004

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1376
2020-07-21 12:54:42 +02:00
Erik Kurzinger
0aa4bab539 kms: Use custom page flip function when retrying failed flips
When using its EGLStream-based presentation path with the proprietary NVIDIA
driver, mutter will use a different function to process page flips -
custom_egl_stream_page_flip.  If that fails due to an EBUSY error, it will
attempt to retry the flip.  However, when retrying, it unconditionally uses the
libdrm-based path. In practice, this causes a segfault when attempting to
access plane_assignments->fb_id, since plane_assignments will be NULL in the
EGLStream case.  The issue can be reproduced reliably by VT-switching away from
GNOME and back again while an EGL application is running.

This patch has mutter also use the custom page flip function when retrying the
failed flip.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1375
2020-07-19 12:50:37 -07:00
Rafael Fontenelle
224db78409 Update Brazilian Portuguese translation
(cherry picked from commit ef3dac70648196de8e291708eaa1cf68dc2eec28)
2020-07-17 21:36:43 +00:00
Daniel van Vugt
7658e07beb Include the pkgconfig-specified gdesktop-enums.h
Instead of blindly hoping that `$INCLUDE` contains the parent directory
of `gsettings-desktop-schemas`.

Because `gsettings-desktop-schemas.pc` says:
```
Cflags: -I/SOME/DIRECTORY/gsettings-desktop-schemas
```
Which means to include the version that Meson has configured you need
to drop the directory prefix and only `#include <gdesktop-enums.h>`.

This fixes a build failure with local installs triggered by 775ec67a44
but it's also the right thing to do™.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1370
2020-07-13 17:30:20 +08:00
Fabio Tomat
1faba58ccc Update Friulian translation 2020-07-12 16:35:03 +00:00
Giusy Margarita
775ec67a44 Add tap-button-map and tap-and-drag-lock support to X11 and Wayland
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1319
2020-07-10 13:31:46 +00:00
Jonas Ådahl
d67ba3ea65 screen-cast/src: Remove follow up timeout source on disable
We failed to remove the timeout source when disabling, meaning that if a
follow up was scheduled, and shortly after we disabled the source, the
timeout would be invoked after the source was freed causing
use-after-free bugs.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1337

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1365
2020-07-10 09:08:59 +02:00
Jonas Ådahl
50634d450e screen-cast/src: Use G_USEC_PER_SEC instead of 1000000
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1361
2020-07-08 21:42:23 +02:00
Jonas Ådahl
9bab8e8751 screen-cast/src: Record follow up frame after timeout
During animation or other things that cause multiple frames in a row
being painted, we might skip recording frames if the max framerate is
reached.

Doing so means we might end up skipping the last frame in a series,
ending with the last frame we sent was not the last one, making things
appear to get stuck sometimes.

Handle this by creating a timeout if we ever throttle, and at the time
the timeout callback is triggered, make sure we eventually send an up to
date frame.

This is handle differently depending on the source type. A monitor
source type reports 1x1 pixel damage on each view its monitor overlaps,
while a window source type simply records a frame from the surface
directly, except without recording a timestamp, so that timestamps
always refer to when damage actually happened.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1361
2020-07-08 21:42:23 +02:00
Jonas Ådahl
7adc24d3a6 screen-cast/src: Fix signedness of timestamp field
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1361
2020-07-08 21:42:23 +02:00
Jonas Ådahl
047da80c3b screen-cast/src: Make record functions return an error when failing
Now that we don't use the record function to early out depending on
implicit state (don't record pixels if only cursor moved for example),
let it simply report an error when it fails, as we should no longer ever
return without pixels if nothing failed.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1361
2020-07-08 21:42:23 +02:00
Jonas Ådahl
882967d3ce screen-cast: Let the reason for recording determine what to record
E.g. we'll have pointer movement that, if no painting is already
scheduled, should only send new cursor metadata without any new pixel
buffer. When this happens, tell next step to not record the pixels if
this was the case, instead of having it rediscover this itself.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/1323
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1361
2020-07-08 21:42:23 +02:00
Jonas Ådahl
cea0722e72 screen-cast/src: Add flag to maybe_record()
Will later be used to make recording avoid recording actual pixel
content if e.g. only the cursor moved.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1361
2020-07-08 21:42:23 +02:00
Jonas Ådahl
03823128c4 screen-cast/window-stream-src: Fix indentation
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1361
2020-07-08 21:42:22 +02:00