Commit Graph

30111 Commits

Author SHA1 Message Date
Simon Elst
10d370eb03 Update French translation 2023-05-12 13:05:48 +00:00
Jonas Ådahl
1a4f03bd79 wayland/surface: NULL check surface resource in handle_output_bound()
Otherwise binding new wl_output's might try to send enter to the
destroyed resource. Fixes the following crash:

     #0 wl_resource_get_client at ../src/wayland-server.c:801
     #1 handle_output_bound at ../src/wayland/meta-wayland-surface.c:1287
     #3 signal_emit_unlocked_R.isra.0 at ../gobject/gsignal.c:3812
     #6 ffi_call_unix64 at ../src/x86/unix64.S:104
     #7 ffi_call_int at ../src/x86/ffi64.c:673
     #8 ffi_call at ../src/x86/ffi64.c:710
     #9 wl_closure_invoke at ../src/connection.c:1025
    #10 wl_client_connection_data at ../src/wayland-server.c:438
    #11 wl_event_loop_dispatch at ../src/event-loop.c:1027
    #12 wayland_event_source_dispatch at ../src/wayland/meta-wayland.c:125
    #15 g_main_context_iterate.isra.0 at ../glib/gmain.c:4276
    #17 meta_context_run_main_loop at ../src/core/meta-context.c:482

Related: https://bugzilla.redhat.com/show_bug.cgi?id=2196527
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2992>
2023-05-09 15:26:32 +00:00
Jonas Ådahl
802c1baec7 compositor-view: Chain up finalize()
The chaining up to the GObject finalize() method was missing, fix that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2991>
2023-05-09 10:31:38 +00:00
Danial Behzadi
921f52dfc0 Update Persian translation 2023-05-09 09:55:13 +00:00
Alexandre Franke
eab928918d Fix shortcut wording
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2982>
2023-05-08 21:00:05 +00:00
Robert Mader
9884a2c3d2 shaped-texture: Move variable declaration to the top
Just a minor cleanup.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2990>
2023-05-07 23:18:33 +02:00
Robert Mader
2dd5196267 egl: Set EGL_IMAGE_PRESERVED_KHR on DMABUF import
Otherwise drivers would be free to alter the buffer content. While no
driver is known to do so, it's probably good to make things explicit.
See also `import_simple_dmabuf()` in Weston.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2990>
2023-05-07 23:16:37 +02:00
Jonas Ådahl
29ec2d2e20 screen-cast/src: Never dequeue pw_buffer's we refuse to record to
The DMA buffer paths vs MemFd paths differ slightly in when content is
recorded. This was in some places done by trying to record but bail if
the dequeued buffer had the wrong type. This is problematic for two
reasons: we'd update the timestamp even if we refused to record, making
the follow-up attempt fail, and we'd dequeue and queue buffers that
didn't get any content, meaning the receiving end would see empty
buffers potentially with only cursor updates.

Fix this by keeping track if a stream is DMA buffer able or not, and
don't attempt to record at all in the places we would previously require
DMA buffers. This avoids both issues: we don't dequeue/queue pw_buffers
that we refuse to record to, and we won't update the recorded timestamp
when we didn't intend to record to begin with.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2783
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2987>
2023-05-04 13:00:07 +00:00
Jonas Ådahl
39b28ad8c8 build: Join keybindings path correctly too
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2985>
2023-05-04 12:35:38 +00:00
Jonas Ådahl
8a4095308e build: Use / operator instead of format for Wayland protocol paths
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2985>
2023-05-04 12:35:38 +00:00
Jonas Ådahl
61b42e5303 build: Use / operator instead of join_paths everywhere
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2985>
2023-05-04 12:35:38 +00:00
Jonas Ådahl
dcaca398f1 tests: Set a dummy XDG_CONFIG_HOME variable
This avoids a local ~/.config/monitors.xml messing up tests.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2985>
2023-05-04 12:35:38 +00:00
Sebastian Keller
551aebce19 cogl: Remove struct paddings
Due to cogl being a private library we don't need worry about ABI
compatibility.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2986>
2023-05-04 12:11:26 +00:00
Sebastian Keller
5b26db8ae8 clutter: Remove struct paddings
Due to clutter being a private library we don't need worry about ABI
compatibility.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2986>
2023-05-04 12:11:26 +00:00
Andy Holmes
07184e099c docs: Add missing flag documentation
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2983>
2023-05-04 11:46:09 +00:00
Danial Behzadi
153433a8e6 Update Persian translation 2023-05-03 09:12:36 +00:00
msizanoen1
3f85158b85 surface-actor: Queue rectangles of update region separately
This aims to help reduce the amount of pixels redrawn on the screen in
case the damage rectangle is partially occluded by another surface.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2965>
2023-05-03 08:53:36 +00:00
msizanoen1
4048562961 stage: Keep queued actor redraw clip volumes separate
This aims to reduce the amount of pixels that have to be redrawed on the
screen on a clipped actor redraw in case using the union of two
different clips in a surface will substantially increase the redrawn
area.

This should not result in excessive memory consumption as callers of
`clutter_actor_queue_redraw_with_clip` are expected to ensure that the
redraw clip rectangles are adequately deduplicated.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2965>
2023-05-03 08:53:36 +00:00
Marco Trevisan (Treviño)
17414fd242 clutter: Remove class paddings
mutter-clutter is a private library that is only used by the shell and
not meant to be ABI/API compatible in between versions, so there's no
need to add padding to classes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2903>
2023-05-02 19:48:03 +00:00
adarshgm
7f18cae282 edid: Integrate libdisplay-info for edid parsing
Hides libdisplay-info under a build time default-off flag,
provides provision to parse essential edid parameters with
APIs provided by libdisplay-info. This implementaion increases
readibility, avoids code duplication and decreases complexity
of edid parsing.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2642>
2023-05-02 17:37:01 +00:00
Sebastian Keller
d643eb5c6f frames: Disable XDND support on the frame window
All X11 surfaces created by gtk4 claim to support XDND via the XdndAware
property. This was leading some clients, e.g. Qt, to consider the frame
window as drop target instead of the client window.

Avoid this issue by removing the XdndAware property again after gtk has
created the surface.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2715
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2978>
2023-04-28 12:46:58 +02:00
Florian Müllner
28a6447ff0 Bump version to 44.1
Update NEWS.
2023-04-25 18:16:17 +02:00
Carlos Garnacho
18be74edeb core: Fix map transitions for X11 windows on Wayland
We are attempting to show windows that do not yet have a
surface/buffer, this makes GNOME Shell avoid transitions
for these windows.

Since on Wayland X11 windows are also Wayland surfaces,
this check is also valid for these, and is thus made more
generic to also cater for these windows.

Eventually, meta_window_update_visibility() is called
when the surface gets its buffer, so the window can be
neatly animated.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2611
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2975>
2023-04-25 17:34:24 +02:00
Carlos Garnacho
5eb17a362e tests: Avoid CSD window in test
This ATM triggers missed .commit events for the window in question,
to be addressed in Xwayland. Since the test does not seem to specifically
rely on this window being CSD, make it a regular window instead.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2975>
2023-04-25 17:34:24 +02:00
Carlos Garnacho
57fdd7efd2 frames: Use cairo renderer on GTK frames
Going for the default GL renderer is known to trigger rendering
artifacts using the NVidia proprietary driver. Since we don't have
too many expectatives about frames being flashy (not to the point
of mandating GL), resort to the cairo renderer in the mean time.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2976>
2023-04-24 12:07:06 +02:00
Sebastian Wick
cca07612b8 output: Check the EDID for the supported sink Colorimetry
Just like the HDR Metadata property the Colorspace property values only
indicate that the display driver supports signaling certain colorimetry.
It does not indidcate that the sink actually supports processing the
colorimetry. For this we have to look up the colorimetry support in the
EDID.

The default colorimetry is always supported. If we want bt.2020 we might
get either the RGB or YCC variant even if we ask for the RGB variant but
there is nothing we can do about it so let's just pretend it's a driver
issue.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2919>
2023-04-21 00:00:24 +02:00
Robert Mader
754a1a1ce6 wayland/dma-buf: Enable modifiers by default on non-native backend
If the used EGL backend supports it. In practice this should currently
only affect the nested backend.

Enabling modifiers can help with app development. An example is
`weston-simple-dmabuf-v4l`, which requires the linear modifier to be
available.

Note that Weston behaves similar already.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2972>
2023-04-20 15:34:00 +00:00
Sebastian Keller
04fa926eea core: Remove meta_frame_get_flags()
It is private and the last caller was removed in 92feea30.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2971>
2023-04-20 15:49:55 +02:00
Robert Mader
b56ab36704 xdg-shell: Always handle frame callbacks in popup_apply_state()
Just like we do in `toplevel_apply_state()`.

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

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2963>
2023-04-20 12:34:47 +00:00
Daniel van Vugt
dd6be7cf2a backends/x11: Trap errors from XIChangeProperty
And report them as warnings instead of crashing.

https://launchpad.net/bugs/2014986

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2960>
2023-04-18 20:18:01 +00:00
Jonas Ådahl
86b5d9d809 Replace using sscanf() to parse mode strings with new helper
This fixes issues when the locale uses characters other than `.` in
floating point numbers.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2902>
2023-04-18 18:38:03 +00:00
Jonas Ådahl
2fd9834d94 monitor: Add helper to parse simple mode strings
This will be used to extract the resolution and refresh rate from
strings like "1920x1080@60.0" or "1280x720". This aims to replace the
use of the locale dependent sscanf() function.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2902>
2023-04-18 18:38:03 +00:00
Jonas Ådahl
550a1dadf1 monitor: Don't use locale dependent mode ID string
The result of printf("%f", number) depends on the locale. To avoid
unpredictable mode IDs, make sure they always are generated the same no
matter the locale.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2902>
2023-04-18 18:38:03 +00:00
Jonas Ådahl
429cc9a674 clutter/backend: Allow unsetting input method
This is needed by GNOME Shell to remove itself as a input method
implementation during its shutdown sequence. We can't do it ourself
later because at mutters own shutdowns equence, the GNOME Shell
Javascript context has by that time already been teared down.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2934>
2023-04-18 14:04:41 +00:00
Michel Dänzer
db24557e40 wayland/xdg-shell: Bail from popup_configure if resource was destroyed
This function gets called when a surface state transaction is applied.
Applying a transaction can get delayed, so the Wayland resource may have
already been destroyed when we get here. In that case we cannot send
events, so there's nothing to do.

v2:
* Drop code comment, expand commit log instead. (Jonas Ådahl)

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2737
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2967>
2023-04-18 10:37:18 +00:00
Jonas Ådahl
867494d3df wayland/cursor-surface: Update cursor on dispose
Otherwise we'll have a cursor sprite backed by a surface that no longer
exist. This usually doesn't happen, but can happen in rare situations
related to pointer capability changes Wayland client cursor changes and
hotplugs.

Fixes the following crash:

  #0 meta_wayland_buffer_get_resource() at ../src/wayland/meta-wayland-buffer.c:128
  #1 realize_cursor_sprite_from_wl_buffer_for_gpu() at ../src/backends/native/meta-cursor-renderer-native.c:1649
  #2 realize_cursor_sprite_for_gpu() at ../src/backends/native/meta-cursor-renderer-native.c:1869
  #3 realize_cursor_sprite() at ../src/backends/native/meta-cursor-renderer-native.c:1887
  #4 meta_cursor_renderer_native_update_cursor() at ../src/backends/native/meta-cursor-renderer-native.c:1100
  #5 meta_cursor_renderer_update_cursor() at ../src/backends/meta-cursor-renderer.c:414
  #6 meta_cursor_renderer_force_update() at ../src/backends/meta-cursor-renderer.c:449
  #7 update_cursors() at ../src/backends/meta-backend.c:328
  #8 meta_backend_monitors_changed() at ../src/backends/meta-backend.c:338
  #9 meta_monitor_manager_notify_monitors_changed() at ../src/backends/meta-monitor-manager.c:3590
 #10 meta_monitor_manager_rebuild() at ../src/backends/meta-monitor-manager.c:3678
 #11 meta_monitor_manager_native_apply_monitors_config() at ../src/backends/native/meta-monitor-manager-native.c:343
 #12 meta_monitor_manager_apply_monitors_config() at ../src/backends/meta-monitor-manager.c:706
 #13 meta_monitor_manager_ensure_configured() at ../src/backends/meta-monitor-manager.c:779
 #14 meta_monitor_manager_reconfigure() at ../src/backends/meta-monitor-manager.c:3738
 #15 meta_monitor_manager_reload() at ../src/backends/meta-monitor-manager.c:3745

or the following on gnome-43:

 #0 meta_wayland_surface_get_buffer at ../src/wayland/meta-wayland-surface.c:441
 #1 meta_cursor_sprite_wayland_get_buffer at ../src/wayland/meta-cursor-sprite-wayland.c:83
 #2 realize_cursor_sprite_from_wl_buffer_for_gpu at ../src/backends/native/meta-cursor-renderer-native.c:1612
 #3 realize_cursor_sprite_for_gpu at ../src/backends/native/meta-cursor-renderer-native.c:1836
 #4 realize_cursor_sprite at ../src/backends/native/meta-cursor-renderer-native.c:1854
 #5 meta_cursor_renderer_native_update_cursor at ../src/backends/native/meta-cursor-renderer-native.c:1087
 #6 meta_cursor_renderer_update_cursor at ../src/backends/meta-cursor-renderer.c:413
 #7 meta_cursor_renderer_force_update at ../src/backends/meta-cursor-renderer.c:448
 #8 update_cursors at ../src/backends/meta-backend.c:344
 #9 meta_backend_monitors_changed at ../src/backends/meta-backend.c:354

Related: https://bugzilla.redhat.com/show_bug.cgi?id=2185113
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2968>
2023-04-17 19:53:35 +00:00
Jonas Ådahl
9252131348 cursor-tracker: Don't leak window cursor on exit
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2968>
2023-04-17 19:53:35 +00:00
Robert Mader
a7a7933e03 wayland: Emit frame events in GSource after "empty" updates
Under certain conditions a stage-view update does not trigger a kms
update.

In such cases we still want the next update to run within the same
refresh cycle, as otherwise we'd waste the remaining time in the
current one.
At the same time we currently use the `after-update` signal for Wayland
frame events, which again may result in more "empty" updates -
creating an unthrottled feedback loop. This can trigger excessive
load both in the compositor as well as in clients.

Introduce a new GSource that is dispatched once per refresh cycle at
maximum per stage view and use it to emit frame events. Do so by
computing the time from when on we can be sure that an update resulting
from a client commit would certainly get scheduled to the next refresh
cycle.

Note: this only works on the native backend. Given that chances are
small that we hit the corresponding issue on e.g. the nested backend,
stick to the previous behavior there for now.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2823>
2023-04-17 09:16:10 +00:00
Robert Mader
87b3843615 clutter/stage-view: Add destroy signal
It will be used in the next commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2823>
2023-04-17 09:16:10 +00:00
Robert Mader
020d128d15 frame/native: Remember whether the frame carried a kms update
So that information is available in e.g. after_update handlers.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2823>
2023-04-17 09:16:10 +00:00
Robert Mader
ff246a2dc8 clutter/frame: Add API to query minimal render time of a frame
It will be used to schedule Wayland frame events independently from both
update and presentation time, as the former may happen multiple times
frame and the later not at all.

For frame events we want a timing that is just late enough to ensure
that a following commit by a Wayland client will not get included into
the current frame any more.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2823>
2023-04-17 09:16:10 +00:00
Sebastian Keller
dddaf19d07 x11: Always initialize all fields of XEvents sent via XSendEvent
The X server ignores the send_event and serial in incoming XEvents, so
they were not initialized when calling XSendEvent in a few places.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2641
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2964>
2023-04-17 01:52:36 +02:00
Sebastian Keller
6b57ab8975 workspace: Only consider windows that should be showing as focusable
When selecting the default focus window, is_focusable() was not
considering the new conditions for whether a window should be shown or
hidden that were added to meta_window_should_be_showing() in 39942974.
As a result the default focus window could end up a window already
hidden or hidden once meta_window_flush_calc_showing() is called by
meta_window_focus() when focusing the default window. This would cause
meta_window_focus() to fail, which is an issue if it prevents us from
unfocusing a window when it is getting unmanaged.

Fixes: 399429742 ("x11: Integrate frames client into Mutter")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2644
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2962>
2023-04-16 11:48:37 +02:00
Sebastian Keller
a86900091d wayland: Set compositor when creating MetaWaylandDataSourceXWayland
create_and_send_dnd_offer() sets the compositor of the offer to the one
from the MetaWaylandDataSource. This then later gets used in
display_from_offer() when trying to get the context from the compositor.
meta_wayland_data_source_xwayland_new() however was not setting the
compositor, so this was causing crashes when dragging things from X11
windows on Wayland.

Fixes: 2731f0cda ("wayland: Setup and use ownership chains")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2723
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2956>
2023-04-15 16:01:42 +00:00
msizanoen1
1b140e8cb9 wayland/data-device: Clear data source when cancelling drag with ESC
This ensures a consistent code path with other cases where the drag
operation might be cancelled.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2953>
2023-04-15 10:11:07 +00:00
msizanoen1
ce0d9ccb37 dnd: Clear Wayland drag source when cancelled from stage grab context
This ensures that applications are notified when a drag gets cancelled
because the user dropped or press ESC while in overview.

This fixes an issue with Chromium on Wayland refusing to acknowledge
wl_pointer::enter events after accidentally dropping a
Chromium-originated object in GNOME Shell overview.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2953>
2023-04-15 10:11:07 +00:00
Carlos Garnacho
2a600ac98e frames: Forward _NET_WM_STATE during frame initialization
Ensure the frame window is created at the right fullscreen state
before showing it and assigning it to the client window.

A peculiarity of this property on frame windows is that it is
typically single-handedly updated from the Mutter side, in synchronization
with client window state. It can only differ during creation, since
GTK still likes to apply its own state.

Also, the only relevant property seems to be _NET_WM_STATE_FULLSCREEN,
since the others are less relevant to the role of the frames client,
and get applied to the MetaWindow as a whole, instead.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2712
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2961>
2023-04-14 13:55:23 +00:00
Sebastian Keller
6fbe4286ea x11: Fix remaining leaks from switch to XGetAtomName()
After this got changed from gdk_x11_get_xatom_name() to XGetAtomName(),
this no longer returns a const char* and it now also needs to be freed.

Fixes: e66f4396e ("x11: Avoid GDK API in X11 selections")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2957>
2023-04-14 13:27:19 +00:00
Sebastian Keller
94bd5c7319 x11: Use Atoms when constructing a new MetaX11SelectionOutputStream
This was pointlessly being converted between atom and string and back,
which with the switch from gdk_x11_get_xatom_name() to XGetAtomName()
also introduced a leak for every XGetAtomName() call.

Fixes: e66f4396e ("x11: Avoid GDK API in X11 selections")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2957>
2023-04-14 13:27:19 +00:00
Sebastian Keller
01ae1d32ee x11: Remove unused member variables from MetaX11SelectionInputStream
The private format and type member variables were not being used by any
of the callers, so they can simply be removed. This also fixes a leak of
type which was introduced when switching from gdk_x11_get_xatom_name()
to XGetAtomName().

Fixes: e66f4396e ("x11: Avoid GDK API in X11 selections")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2957>
2023-04-14 13:27:19 +00:00