1
0
Fork 0
Commit graph

10352 commits

Author SHA1 Message Date
Jonas Ådahl
bdb34401c5 xwayland: Only warn on X IO errors when X11 is mandatory
This avoids warnings when we're just slightly unlucky when Xwayland went
away due to inactivity.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2364>
2022-05-31 12:00:55 +00:00
Jonas Ådahl
e1033951ef wayland: Add getter for XWayland manager object
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2364>
2022-05-31 12:00:54 +00:00
Jonas Ådahl
c575696acc tests/test-client: Add clipboard-set command
To be used for clipboard testing.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2364>
2022-05-31 12:00:54 +00:00
Jonas Ådahl
9930b5d7ca x11/selection: Unset selection ownership on shutdown
This makes sure we don't accidentally try to paste from past Xwayland
connection instances.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2364>
2022-05-31 12:00:54 +00:00
Jonas Ådahl
a2ebd10f04 kms/crtc: Determine gamma support given the gamma length
The property doesn't necessarily exist when using drivers that doesn't
support atomic mode setting, and the way it worked will break night
light and other gamma related features. This makes things use the gamma
length; if it is higher than 0, it definitely supports it one way or the
other, i.e. GAMMA_LUT with the atomic backend, and drmModeCrtcSetGamma()
with the legacy/simple backend.

Fixes: 364572b95c
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2287
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2435>
2022-05-28 18:29:13 +00:00
Jonas Ådahl
9001fa9717 kms/crtc: Always read the gamma state
It doesn't depend on whether the CRTC is active or not, so always read
it. This is also useful to know whether a CRTC supports gamma, before it
is being turned on, without relying on the existance of properties.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2435>
2022-05-28 18:29:13 +00:00
Florian Müllner
d04a197723 x11/events: Do not handle enter/leave during grabs
The COMPOSITOR_GRAB event route has effectively been replaced by
ClutterGrabs, which are no longer covered by the existing check.

So check for grabs as well to restore the old behavior.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2436>
2022-05-28 10:25:29 +00:00
Florian Müllner
f73ad1d8d2 display: Remove META_EVENT_ROUTE_COMPOSITOR_GRAB
Nothing sets the value anymore since the port to ClutterGrab, and
we just removed the last code references.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2436>
2022-05-28 10:25:29 +00:00
Florian Müllner
75856043d4 display: Bypass focus window during grabs
This is what the old COMPOSITOR_GRAB check effectively did (by
returning the grab_window, which is only set during window grab
operations).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2436>
2022-05-28 10:25:29 +00:00
Florian Müllner
937651cf0e display: Remove another COMPOSITOR_GRAB check
The event-route is never set to COMPOSITOR_GRAB nowadays, so the
condition will never be met.

Furthermore, it is expected that ClutterGrabs only happen when
events are routed normally, so the remaining NORMAL check should
already fully cover the old COMPOSITOR_GRAB case.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2436>
2022-05-28 10:25:29 +00:00
Florian Müllner
022f47ebfe events: Remove obsolete COMPOSITOR_GRAB check
We already bypass wayland if there is a ClutterGrab, so the case
that used to be covered by the event-route check is already handled,
and we can just remove the obsolete check.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2436>
2022-05-28 10:25:29 +00:00
Florian Müllner
fabad0be9c wayland: Remove unnecessary COMPOSITOR_GRAB checks
Since the new ClutterGrab API replaced the old plugin-modal hook,
the event-route is never set to COMPOSITOR_GRAB.

The code in question already checks whether the stage has a grab,
so we can just remove old checks.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2436>
2022-05-28 10:25:29 +00:00
Carlos Garnacho
50e89e3760 core: Avoid focusing window in presence of Clutter grabs
This is the same circumstance than the event_route not being NORMAL,
since events may or may not eventually reach the window. It should not
attempt to get focus out of the stage in that situation. This used
to be covered by META_EVENT_ROUTE_COMPOSITOR_GRAB, but this is no longer
set when ClutterGrab came in to replace it.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4858
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2433>
2022-05-28 09:04:48 +00:00
Jonas Ådahl
1e95710c52 x11-display: Init event mask after taking manager selection
Initializing the event mask, SubstructureRedirectMask in particular,
before taking the manager selection fails with BadAccess. Fix this by
initializing said mask after taking the manager selection.

This fixes `--replace`.

Fixes: eb4307c350
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2432>
2022-05-27 18:26:01 +02:00
Jonas Ådahl
a24b14e302 x11-display: Make some init calls more compact
Makes more of the function fit on the screen, without making readability
any subjectively worse.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2432>
2022-05-27 10:49:57 +02:00
Bilal Elmoussaoui
a81b2a49ed meson: Split x11 option into backend/xwayland
Allow disabling either the xwayland or backend implementation of x11.
Meson options were not added as this is more of a groundwork than the
actual implementation.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2354>
2022-05-25 16:42:04 +02:00
Bilal Elmoussaoui
b27234cfef startup/x11: Fix compiling without startup-notification
If startup_notification is disabled, linking against sn would fail

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2425>
2022-05-25 10:38:25 +00:00
Sebastian Keller
bc9762eebb display: Properly store later ID when adding window to queue
The code is already trying to avoid creating new laters when there
already is one for the queue type, but this wasn't working because the
ID of the later was never stored after creating a new one. This would
then result in as many laters as meta_display_queue_window() was called
and all of them would run the handler function, even if only the first
one had a non-empty window queue.

Similarly this was causing the later to not be removed if the window
queue got empty after meta_display_unqueue_window().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2414>
2022-05-25 09:50:07 +00:00
Sebastian Keller
b289c8f01e window: Ensure window-visibility-updated is emitted when flushing queue
Currently the signal is getting emitted accidentally, because even when
removing a window from the queue, the later handler of that queue will
still get run due to a bug. This bug is going to get fixed in the next
commit, but some things might depend on the signal getting emitted when
the visibility of a window has changed.

This change affects the behavior in two ways. First the signal is now
emitted immediately rather than from an idle. And second it now
correctly includes the window in the should_show or should_hide list.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2414>
2022-05-25 09:50:07 +00:00
Sebastian Keller
2a3c964e64 display: Add method to flush a single window from the queues
This can be used when a state change needs to be applied immediately for
a specific window and will be used in the next commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2414>
2022-05-25 09:50:07 +00:00
Sebastian Keller
f493a78641 display: Fix typo in trace message
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2414>
2022-05-25 09:50:07 +00:00
Fernando Monteiro
d4bdd8b56f wayland: Remove Gtk primary selection protocol
This has been replaced for primary selection protocol from
wayland-protocols.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2184>
2022-05-18 20:15:08 +00:00
Fernando Monteiro
11bc19fbe8 wayland: Drop xdg-shell v6 protocol
There is no need to have this protocol as we already
have support for the xdg-shell stable.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2207>
2022-05-18 19:29:08 +00:00
Sebastian Keller
bb76d6fcc3 compositor: Update topmost window actor after visibility changes
The compositor currently only updates the topmost window actor that is
visible to it after stacking changes. The visibility of a window actor
to the compositor however might only change via the display idle queue
after the stacking changes. This could then lead to the topmost window
actor being assumed to be NULL on Wayland after switching from an empty
workspace or when opening the first window on an empty workspace. The
result of this is direct scanout being disabled in these cases.

To fix this also trigger the update when the visibility of windows
changes.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2269
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2413>
2022-05-17 13:42:07 +00:00
Sebastian Keller
0bc142ec1b compositor: Split out a function to update the topmost window actor
This allows this to be used from outside the restacking code in the
follow-up commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2413>
2022-05-17 13:42:07 +00:00
Sebastian Keller
54ba64b9f2 window-actor/wayland: Only use scanout for opaque non-fullscreen windows
This could for example happen with the client window created by the
desktop-icons-ng extension which spans the entire desktop, but is not a
fullscreen window and uses transparency

On Wayland only opaque surfaces or transparent surfaces of fullscreen
windows can be used for direct scanout.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2263
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2409>
2022-05-17 10:34:20 +00:00
Sebastian Keller
dc43bb9f68 window-actor/x11: Don't use direct scanout if the window is not opaque
Some windows span the entire screen but still use transparency, such as
the desktop window of Nemo. When these windows were used for direct
scanout, the transparent areas would turn black and nothing else would
be rendered.

In addition to checking the surface for opaqueness, for X11 windows also
the window actor itself has to be checked, because its opacity might
have been changed via _NET_WM_WINDOW_OPACITY.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2263
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2409>
2022-05-17 10:34:20 +00:00
Sebastian Keller
9c8948fc04 window-actor: Add API to get the surface actor candidate for scanout
This replaces the API to get the topmost surface actor with an API to
get the surface actor that could be a candidate for direct scanout. The
advantage of this is that it allows X11 and Wayland specific
restrictions for these actors.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2409>
2022-05-17 10:34:20 +00:00
Jonas Ådahl
75ec27966d wayland/buffer: Only query Wayland EGL buffer if display bound
It's not allowed to call eglQueryWaylandBuffer() if the call to
eglBindWaylandDisplay() failed, and will result in an assert being hit
in mesa if called.

Avoid that by keeping track whether we succeeded to bind, and only
attempt to realize a legacy EGL wl_buffer if binding succeeded.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2415>
2022-05-17 10:09:27 +00:00
Bilal Elmoussaoui
c861101ae6 backend: Check if the gsettings scheme exists
Mutter makes use of a gsettings scheme that comes from
gnome-settings-daemon to check for the screen orientation.
In use cases where gnome-settings-daemon is not available,
this would lead to a crash as the key doesn't exists

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2398>
2022-05-17 11:24:07 +02:00
Jonas Ådahl
8fdb80a718 monitor-manager: Add NightLightSupported property to DisplayConfig
This checks whether it's possible to set a CRTC GAMMA_LUT, which is what
is necessary to implement night light.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2310>
2022-05-17 08:42:25 +00:00
Jonas Ådahl
f64259ceae tests/wayland: Draw surface with shared helper
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2416>
2022-05-17 08:03:29 +00:00
Jonas Ådahl
9b97c9b4d4 tests/wayland/xdg-toplevel-bounds: Port to WaylandDisplay
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2416>
2022-05-17 08:03:29 +00:00
Jonas Ådahl
2c2aa7acc3 tests/wayland/xdg-activation: Port to WaylandDisplay
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2416>
2022-05-17 08:03:29 +00:00
Jonas Ådahl
a7161e1132 tests/wayland/subsurface-reparenting: Port to WaylandDisplay
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2416>
2022-05-17 08:03:29 +00:00
Jonas Ådahl
e32b9956fe tests/wayland/subsurface-remap-toplevel: Port to WaylandDisplay
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2416>
2022-05-17 08:03:29 +00:00
Jonas Ådahl
1562bcc6fd tests/wayland/subsurface-parent-unmapped: Port to WaylandDisplay
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2416>
2022-05-17 08:03:29 +00:00
Jonas Ådahl
08acf51423 tests/wayland-display: Emit sync event signal from test driver
This is for hooking up sync events from the compositor side test case.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2416>
2022-05-17 08:03:29 +00:00
Jonas Ådahl
d5367f7332 tests/wayland: Make display helper a GObject
This is in preparation for adding signals.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2416>
2022-05-17 08:03:29 +00:00
Jonas Ådahl
b0528dcd53 tests/wayland: Port xdg-shell action tests to WaylandDisplay
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2416>
2022-05-17 08:03:29 +00:00
Jonas Ådahl
d58bd948a8 tests/wayland/subsurfaces: Use helper to manage display
Adds a _free() function since the display is reopened multiple times and
cleaned up in between.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2416>
2022-05-17 08:03:29 +00:00
Jonas Ådahl
a936219983 tests/xdg-apply-limits: Move out generic display management
This is meant to be used by other test clients, in order to reduce the
amount of code duplication that currently exists in the test cases.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2416>
2022-05-17 08:03:29 +00:00
Marco Trevisan (Treviño)
c93e402a89 monitor-manager: Ensure monitors settings after backend has been updated
The monitors settings such as the privacy screen property is propagated
to the monitors via kms updates, however during initialization and
on monitors changes, we end up clearing the pending KMS updates because
such settings are added to the queue before the backend has fully
initialized the monitors, and this may lead to discarding all the
pending updates, including the one we've just planned.

To avoid this, move settings applications after we've both initialized
the backend and notified it about changes.

Also avoid to try set the settings during actual initialization, but
delay that after post-init.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2372>
2022-05-11 18:13:46 +00:00
Jonas Ådahl
8ec8a26717 display: Unmanage windows before compositor
Prior to 'compositor: Destroy actors when unmanaging', window actors
were destroyed when the compositor object was destroyed, long after the
windows were unmanaged, however, when this instead changed to happen
when unmanaging, with the original goal to avoid having these actors try
to interact with the disposed MetaCompositor instance, it caused an
issue where window actors would be indirectly destroyed as a side effect
of their parents being destroyed, which caused some fallout in the logic
handling window-close animation tracking, which relies on
meta_window_actor_queue_destroy() being called before a window actor is
actually destroyed.

Fix this by unmanaging windows before unmanaging the compositor.

From an X11 point of view, this should be harmless, since all it really
do is call XCompositeUnredirectSubwindows().

For the native backend and the common behavior, all unmanaging the
compositor instance does is destroy clutter actors, so doing so after
window actors were already cleaned up should not be a problem, as this
was the case before too.

Fixes: 35ac3a096d
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5330
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2403>
2022-05-11 15:37:23 +00:00
Dor Askayo
40edfbcbeb tests/screen-cast: Avoid undefined behavior with GSource
Follow the existing convention in Mutter and avoid downcasting
custom GSource structs.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2406>
2022-05-11 15:01:31 +00:00
Dor Askayo
61c9e344e4 screen-cast/src: Avoid undefined behavior with GSource
Follow the existing convention in Mutter and avoid downcasting
custom GSource structs.

This fixes the following warning:
    ../src/backends/meta-screen-cast-stream-src.c:1301:20: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
     1301 |   g_clear_pointer ((GSource **) &priv->pipewire_source, g_source_destroy);
    /usr/include/glib-2.0/glib/glib-typeof.h:36:36: note: in definition of macro ‘glib_typeof’
       36 | #define glib_typeof(t) __typeof__ (t)
          |                                    ^
    ../src/backends/meta-screen-cast-stream-src.c:1301:3: note: in expansion of macro ‘g_clear_pointer’
     1301 |   g_clear_pointer ((GSource **) &priv->pipewire_source, g_source_destroy);
          |   ^~~~~~~~~~~~~~~

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2406>
2022-05-11 15:01:31 +00:00
Kazuki Hashimoto
38314fe5fd util: Fix compilation when !WITH_VERBOSE_MODE
Fixes the following linker error:

`meta_add_verbose_topic':
<artificial>:(.text+0x372f): undefined reference to `ensure_logfile'

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2405>
2022-05-07 11:53:41 +09:00
Bilal Elmoussaoui
97fc21adc1 core: Drop zenity show_dialog
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2370>
2022-05-06 16:13:45 +02:00
Bilal Elmoussaoui
4dee531b68 x11/sm: Drop the zenity confirmation dialog
Quoting Ray Strode:
we don't expose a way to explicitly save the session in gnome anymore
afaik, and I don't think it's going to show on log out because
I believe we use the FORCE flag from the log out dialog.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2370>
2022-05-06 16:13:45 +02:00
Bilal Elmoussaoui
749b9be98a core: Drop the default close dialog implementation
If the MetaPlugin doesn't implement it, we don't show anything.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2370>
2022-05-06 16:13:45 +02:00
Bilal Elmoussaoui
0e092ad6b3 default-plugin: Drop default confirm display dialog
Mostly to drop the 1/3 use cases of zenity on mutter and usually
shells built on top of Mutter should implement that vfunc

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2370>
2022-05-06 16:13:45 +02:00
Sebastian Keller
c3210b0ab2 Revert "workspace: Use existing focus_window when asked to focus default window"
This reverts commit d0de671c1d.

The change introduced a regression when focusing java/swing windows.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5395
Reopens: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5162
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2402>
2022-05-04 23:29:39 +02:00
Jonas Ådahl
5404eb34f8 kms/impl/simple: Make sure cursor buffers have fb ids
'kms/impl-device/simple: Get the buffer handle from MetaDrmBuffer'
changed how fb ids are generated, but it only made it fully work with
atomic mode setting. For legacy/simple mode setting, it only handled the
primary plane buffer, not the hardware cursor.

Fix this by making sure the fb id is generated also in the legacy mode
setting case.

Fixes: ea39142da2
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2250
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2397>
2022-05-03 21:45:19 +00:00
Bilal Elmoussaoui
03929ca01f build: Fix building without Wayland
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2400>
2022-05-03 16:47:02 +02:00
Sebastian Keller
5e5480e620 x11/window: Update _NET_WM_DESKTOP when a window becomes all-workspace
When an X11 window becomes an all-workspace window its `workspace` is
set to NULL before `meta_window_x11_current_workspace_changed()` is
called. The latter then checks for `workspace` being NULL (which also
happens when unmanaging) and then returns early. So this does not update
`_NET_WM_DESKTOP` to 0xFFFFFFFF. Instead it remains at the workspace the
window was on before. This was causing programs like `wmctrl` to switch
to this old workspace when activating such a window.

Fix this by checking if the window is unmanaging instead.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2242
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2387>
2022-05-02 16:35:58 +00:00
Carlos Garnacho
f361e8032c wayland: Avoid repeated NULL preedit string updates
Simply signal preedit string changes from/to NULL once, in order
to avoid unwanted activity in the client side. We do still need to
send the preedit once each .done event, if there is one, in order
to behave according to the protocol when it matters the most.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2395>
2022-04-30 15:10:17 +00:00
Jonas Ådahl
b1be1e86e9 screen-cast: Always wait for an update before sending cursor-only frames
With the unthrottled input emission, we ended up often getting the
cursor updates long before any damage had been posted, meaning that if
you moved around the mouse pointer where the mouse had a high enough
refresh rate, we'd effectively stall the screen cast stream by only
sending cursor updates and nothing else.

Fix this by scheduling an update when we get a cursor update, then
sending a cursor-only frame after any damage and relayout has been
processed, but only if there is no queued damage that will cause an
actual repaint.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2393>
2022-04-29 20:51:25 +00:00
Jonas Ådahl
c5410b61d2 screen-cast/window/src: Fix signal handler types
Should be gulong, not unsigned long.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2393>
2022-04-29 20:51:25 +00:00
Robert Mader
aa8d2d6fff wayland/dma-buf: Remove redundant error check
`meta_egl_*` functions are assumed to set an error on failure.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2386>
2022-04-29 20:27:56 +00:00
Robert Mader
c8095b4306 wayland/dma-buf: Only advertise supported formats
Analogous to how we use `eglQueryDmaBufModifiersEXT()` to query
supported modifiers, use `eglQueryDmaBufFormatsEXT()` to ensure
we only advertise formats supported by both the compositor and the
driver.

If there is no overlap, don't advertise `zwp_linux_dmabuf_v1` at
all.

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

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2386>
2022-04-29 20:27:56 +00:00
Jonas Ådahl
2cfd4f325b cursor-renderer/native: Support allocating dumb buffers
This makes it possible to allocate HW cursor without a gbm_device, e.g.
when using EGLStream/EGLDevice.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1980
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2275>
2022-04-29 19:35:35 +00:00
Jonas Ådahl
42ed40ac52 cursor-renderer/native: Move buffer creation to helper
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2275>
2022-04-29 19:35:35 +00:00
Jonas Ådahl
ea39142da2 kms/impl-device/simple: Get the buffer handle from MetaDrmBuffer
This avoids buffer implementation specific code where it shouldn't
matter.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2275>
2022-04-29 19:35:35 +00:00
Jonas Ådahl
22d11eb9cb drm-buffer: Keep track of handle as well
This handle is used by the legacy KMS API; lets avoid having to have GBM
specific code where this is done by letting the MetaDrmBuffer API, that
already has this information, expose it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2275>
2022-04-29 19:35:35 +00:00
Jonas Ådahl
d19700604b compositor/dnd: Fix indentation
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2391>
2022-04-29 18:58:38 +00:00
Jonas Ådahl
b2eec49873 screen-cast: Remove stray newline
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2391>
2022-04-29 18:58:38 +00:00
Jonas Ådahl
5da8e5a9d5 barrier: Remove _ prefix in various places
It's not a convention used anywhere else anymore, lets remove the
prefixes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2391>
2022-04-29 18:58:38 +00:00
Jonas Ådahl
1a5647e00c barrier: Some coding style cleanup
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2391>
2022-04-29 18:58:38 +00:00
Jonas Ådahl
36de8baf55 display: Get the backend from the context
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2391>
2022-04-29 18:58:38 +00:00
Jonas Ådahl
dd6afb28ff util: Avoid overriding 'message' in meta_topic()
We'd put the message in a variable called `message`. If something passed
to meta_topic() was called `message`, it'd end up being `NULL` in the
log entry. Avoid this by making the local message variable a bit more
"on topic".

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2391>
2022-04-29 18:58:38 +00:00
Jonas Ådahl
70ab4b6519 build: Make each executable/library have their own log domain
This helps reading log output during, as it's otherwise often unclear
whether a log entry came from a test client or mutter itself.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2391>
2022-04-29 18:58:38 +00:00
Carlos Garnacho
cd0c47a25a clutter: Shuffle handling of IM reset on button presses
Unfortunately we cannot do this generically since the target of the
button/touch press does matter, e.g. tapping on the OSK, or clicking
the IBus candidates window. These situations should not trigger a
reset.

So be more selective about the situations where button/touch presses
trigger an IM reset, in the case of ClutterText these are still clicks
inside the actor, for Wayland's text-input it is when clicking the
surface that has text_input focus.

For all other situations where clicking anywhere else might make
sense to trigger an IM reset are covered by the focus changing paths,
that also ensure a reset before changing focus between surfaces/actors.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1961
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2384>
2022-04-23 15:04:30 +02:00
Carlos Garnacho
39ff8d15e2 wayland: Reset ClutterInputFocus on focus changes
Focus changes should trigger an IM reset, as some engines do want
to maybe commit the preedit string before changing focus. In addition,
we do not want the preedit string to be able to move between
windows/applications.

Ensure that the commit string is committed when the IM deems so, and
ensure we send a .done event disntinct to the .leave event, so that
the client doesn't miss the commit.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2030
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2384>
2022-04-23 15:04:30 +02:00
Jonas Ådahl
358df1c569 screen-cast/src: Always allow MemFd buffer types to be selected
Just because the PipeWire client can handle DMA buffers, doesnt mean we
should not advertise support for MemFd.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2383>
2022-04-22 12:08:04 +00:00
Jonas Ådahl
2b4a24132b screen-cast: Test allocate DMA buffer with implicit API
DMA buffers might be allocatable, but it doesn't mean the driver doesn't
fail when we try to allocate a buffer with an implicit modifier. Using
the proprietary NVIDIA driver for example, it will fail. Lets catch this
up front and avoid advertising DMA buffer support when we know it won't
work.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2383>
2022-04-22 12:08:04 +00:00
Carlos Garnacho
f5f49dfa46 wayland: Always acknowledge state changing .commit() events with .done()
As of currently, we only emit .done() on actual changes coming from the
ClutterInputMethod/ClutterInputFocus. With the recent changes in the
interpretation of serials, it becomes more important now that the
compositor acknowledges every .commit done by the client, in order to
keep them feeding future IM state updates.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2365>
2022-04-22 11:39:44 +00:00
Carlos Garnacho
be2a1d85a5 wayland: Always update preedit with text_input.done()
Compensate the protocol statelessness with our ClutterInputFocus
statefulness. This becomes more necessary now, since sending
consecutive .done() events is now considered acceptable behavior.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2365>
2022-04-22 11:39:44 +00:00
Sebastian Wick
43ae37a93e backends/native: Update cursor also when scaled or transformed
MetaCursorRendererNative only updates the cursor state when the
underlying texture changes. The cursor scale and transform do not
trigger updates. This results in wrong cursor orientations on rotated
displays. Use both texture changes and scale and transformation changes
to figure out when to update the cursor state.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2363>
2022-04-21 11:23:15 +00:00
Carlos Garnacho
91ae72acdf core: Account ClutterStage grabs on Wayland key focus synchronization
When switching between the existence and not of a stage ClutterGrab, we
would correctly attempt to synchronize key focus from the perspective of
the Wayland clients.

But this synchronization should do its own checks about existing stage
grabs before determining a client window has key focus or not.

Add that check, so that grabs correctly unfocus the keyboard in Wayland
clients, in addition to pointers and touch.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2194
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2366>
2022-04-20 14:38:23 +00:00
Łukasz Spintzyk
ad838ec540 renderer/native: Restore EGL state after creating secondary GPU state
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2347>
2022-04-20 09:30:04 +00:00
Daniel van Vugt
af7e116b94 cursor-renderer/native: Remove unused DRM_CAP_CURSOR_{WIDTH,HEIGHT}
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2361>
2022-04-20 08:28:06 +00:00
Daniel van Vugt
be9deeba09 crtc/kms: Don't add gamma to the update if unsupported by the CRTC
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2197
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2360>
2022-04-19 07:58:31 +00:00
Daniel van Vugt
364572b95c kms/crtc: Add function meta_kms_crtc_has_gamma
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2360>
2022-04-19 07:58:31 +00:00
Daniel van Vugt
cc20584032 kms/crtc: Add debug logging of supported vs unsupported properties
Unsupported properties are particularly common in an Nvidia/hybrid
setup so we don't want to make it a warning that's always visible.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2360>
2022-04-19 07:58:31 +00:00
Daniel van Vugt
e3cba9f2d8 kms/crtc: Fix typo s/proporties/properties/
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2360>
2022-04-19 07:58:31 +00:00
Jonas Ådahl
8c656a7f40 startup-notification: Fix some introspection annotations
This avoids a bunch of warnings and fixes a transfer annotation.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2374>
2022-04-13 12:03:27 +02:00
Daniel van Vugt
14ab0238d0 stage/x11: Remove trailing whitespace
To avoid check-code-style warnings in other MRs that touch this file.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2373>
2022-04-13 14:35:59 +08:00
Daniel van Vugt
dd94c448e9 kms/device: Disable modifiers when !DRM_CAP_ADDFB2_MODIFIERS
Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2210
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2359>
2022-04-08 16:20:34 +00:00
Daniel van Vugt
11e6100226 kms/impl-device: Add addfb2_modifiers to MetaKmsDeviceCaps
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2359>
2022-04-08 16:20:34 +00:00
Jonas Ådahl
9d0f612de1 shaped-texture: Paint with the right layer snippet
When we get passed a "snippet" to the shaped texture, it's added as a
pipeline layer snippet to change how the source texture is sampled. When
we draw from a texture tower however we have allocated regular textures
which doesn't need any special layer snippet, so create separate
pipelines for those that doesn't use that snippet.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/528
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2278>
2022-04-07 07:28:44 +00:00
Jonas Ådahl
d4ffaf291f shaped-texture: Pass along the snippet to the texture tower
The snippet is used make sure the right source is sampled in the shader.
This wasn't done in the texture tower, meaning the textures from the
tower were not correct.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/528
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2278>
2022-04-07 07:28:44 +00:00
Corentin Noël
c2b8582e0f startup-notification: Specify the actual type in the "changed" signal
Allows to have type checks and the introspection to be aware of the actual type.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2362>
2022-04-05 14:05:23 +02:00
Corentin Noël
9132f984ce mutter: Add missing nullable annotation when possible
Add missing (nullable) annotation when a possible NULL return value is expected.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2362>
2022-04-05 14:05:23 +02:00
Corentin Noël
50c91bca75 cursor-tracker: Add missing annotation to meta_cursor_tracker_get_pointer
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2362>
2022-04-05 14:05:22 +02:00
Daniel van Vugt
9a23ed98e7 onscreen/native: Fix typo in log message "the the"
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2357>
2022-04-04 17:36:37 +08:00
Jonas Ådahl
47375897a5 wayland/shm: Add support for ABGR8888 and XBGR8888 formats
This avoids shuffling bits for clients drawing in these formats.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2200
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2352>
2022-03-30 14:43:10 +00:00
Olivier Fourdan
eb4307c350 x11: Set WM_S0 last
With Xwayland on demand, a number of maintenance X11 applications need
to be run first, before Xwayland starts accepting requests from the
normal clients, as soon as the WM_S0 selection is acquired by mutter.

On startup, mutter also sets a number of X11 properties that can be
queried by X11 clients.

Unfortunately, mutter acquires the WM_S0 selection before setting those
properties, so mutter and the first regular X11 client will race on
startup.

As a result, the X11 properties set by mutter on startup may not be
available to the very first X11 client when Xwayland starts.

To avoid that issue, make sure to take the WM_S0 selection last when
opening the display.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2176
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2336>
2022-03-30 14:15:03 +00:00
Olivier Fourdan
de8927e075 xwayland: Init DnD on every Xwayland start
Currently, meta_xwayland_shutdown_dnd() is called from the handler
on_x11_display_closing() triggered from the signal "x11-display-closing"
hooked up from meta_xwayland_init_display().

Once the signal has been triggered, on_x11_display_closing() removes the
signal handler, disconnecting from the signal.

As meta_xwayland_init_display() is called from meta_display_new() which
is issued only once, the signal handler is not restored again.

As a result, meta_xwayland_shutdown_dnd() is not called anymore after
Xwayland has been restarted, but meta_xwayland_init_dnd() will check and
assert that the manager's DND object is NULL.

Basically, restarting Xwayland more that once will trigger an assertion
failure in mutter. That's even more of a problem with autoclose-xwayland
where Xwayland is expected to terminate when there is no meaningful X11
client remaining, which can happen multiple times during the lifetime
of a user session.

To make sure that meta_xwayland_init_display() is called for every new
instance of Xwayland, simply keep the signal hooked in place by not
disconnecting it when triggered.

This reverts commit 9a10b8ff94.

Even though, originally, this issue was first introduced with commit
b4fe1fdd95 ("xwayland: Make setup/teardown
a bit more symmetrical") which didn't actually kept 'x11-display-setup'
and 'x11-display-closing' connected.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2168
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2339>
2022-03-30 13:51:26 +00:00
Sebastian Wick
1760dcb0d7 window: Check fullscreen status when window changes monitor
For wayland meta_window_move_to_monitor sends a configure to the client
without actually moving the window, yet and the
meta_display_queue_check_fullscreen call won't detect any changes.
Checking for fullscreen in meta_window_update_monitor fixes the problem
because it is called whenever the window actually changed the monitor it
is on.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2325>
2022-03-30 13:01:29 +00:00
Daniel van Vugt
8354289650 onscreen/native: Fall back if COPY_MODE_SECONDARY_GPU fails to init
This can happen if we've got a GBM driver that is incomplete or
buggy for any reason. Currently this includes the Nvidia driver
when used as a secondary GPU, and as soon as they fix that it will
use the fast path instead.

Falling back means we can still use it as a KMS device with all rendering
done on the primary GPU instead. Just like a DisplayLink.

It's slow, but at least the screens all light up now and you get a
usable desktop. Surprisingly it's still a better experience than using
Xorg, maybe because we can flip the outputs independently with the
native backend.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2166,
       https://gitlab.gnome.org/GNOME/mutter/-/issues/2182,
       https://launchpad.net/bugs/1959888,
       https://launchpad.net/bugs/1964037

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2341>
2022-03-30 12:36:05 +00:00
Daniel van Vugt
41bfabad96 onscreen/native: Don't try rendering on a secondary GPU without EGL
We rather confusingly still call a secondary display card that is
GPU-less (DisplayLink or other basic KMS device) a "secondary GPU",
so just because secondary_gpu_state is non-NULL doesn't mean we
can use it for rendering. The clearest indication of this is when
there is no EGL surface.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2341>
2022-03-30 12:36:05 +00:00
Carlos Garnacho
861c4b8535 core: Port to input device capabilities in pad mapper
Check for tablets and pad devices using capabilities.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2331>
2022-03-30 12:06:52 +00:00
Carlos Garnacho
286562ea53 backends: Update MetaInputSettings to apply settings based on capabilities
Since devices may be multiple things now, check all capabilities in order
to ensure all aspects of the device are correctly configured.

This change does the following observations:
- Devices that have TOUCHPAD | POINTER capabilities prefer the 'touchpad'
  settings path. The regular pointer settings path is left for all
  non-touchpads.
- Devices that are both a tablet and a touchscreen prefer the tablet
  relocatable schema. This works for both aspects as the touchscreen
  schema is a subset of the tablet one.

Other than that it's a rather boring, even if verbose search and replace.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2331>
2022-03-30 12:06:52 +00:00
Carlos Garnacho
fff3654941 wayland: Check input device capabilities in tablet seats
Instead of looking for tablets and pads based on input device type,
check capabilities.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2331>
2022-03-30 12:06:52 +00:00
Carlos Garnacho
844a729fa9 wayland: Set wayland seat capabilities based on input device capabilities
Instead of looking at device types, which might be incomplete.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2154
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2331>
2022-03-30 12:06:52 +00:00
Carlos Garnacho
1f3fb8441f backends/native: Assign capabilities to input devices
These are extracted from the individual libinput_devices.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2331>
2022-03-30 12:06:52 +00:00
Carlos Garnacho
842295838f backends/native: Make function to determine ClutterInputDeviceType private
We do not need to open code the ClutterInputDeviceType fetching from a
libinput_device, since we already created a native ClutterInputDevice that
has the right type.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2331>
2022-03-30 12:06:52 +00:00
Jonas Dreßler
d0de671c1d workspace: Use existing focus_window when asked to focus default window
We use meta_workpace_focus_default_window() to sync the input focus back
to a window after it was on shell UI, this is not really necessary on
Wayland, but it is on X11. What this function does internally is ask
MetaWindowStack about the topmost window and focus+raise that window.

In gnome-shell we set the input focus to the default window every time
the key-focus changes to NULL (see shell-global.c ->
sync_stage_window_focus()). Now when closing the alt-tab switcher and
activating a window while there's an always-on-top window on the
workspace, meta_workspace_focus_default_window() will focus that
always-on-top window right after closing the alt-tab switcher, making it
impossible to focus another window using alt-tab.

To fix this, make meta_workspace_focus_default_window() check if there's
an existing focus_window first, if there is, use that, and if there
isn't, resort to just focusing the topmost one.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5162
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2328>
2022-03-30 11:41:52 +00:00
Bartłomiej Piotrowski
7a7fb863a2 tests/virtme-run: Expose two CPUs
We're multi threaded, so make things more like reality by exposing more
CPUs using the '-smp 2' qemu option.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2152>
2022-03-28 16:17:21 +00:00
Bartłomiej Piotrowski
7435bfd0e5 tests/virtme-run: Disable pdcm
There are issues when running a nested KVM with Fedora 35 when pdcm is
enabled. Work around this for now by disabling it.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=2022075
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2152>
2022-03-28 16:17:21 +00:00
Bartłomiej Piotrowski
4ce233b89e tests/virtme-run: Create fake stdin
When running in CI, the stdin may be /dev/null, which causes issues
for qemu. Avoid this issue by creating our own fake stdin.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2152>
2022-03-28 16:17:21 +00:00
Jonas Ådahl
31bc1c80ab tests/kvm: Forward the test environment variables to the VM
This will help with finding the right libdefault.so and correctly setup
the GLib test framework.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2152>
2022-03-28 16:17:21 +00:00
Jonas Ådahl
189068d465 tests/build: Set up test environment using a dict()
This will allow us to reuse the keys and values more easily, as later
commits will rely on being able to iterate over the keys and values to
construct explict env strings for passing into special test cases.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2152>
2022-03-28 16:17:21 +00:00
Robert Mader
f9857cb8bd wayland/surface: Disable WL_SURFACE_ERROR_INVALID_SIZE check again
The check was introduces in ab17c98c94
but turned out to trigger client crashes in common cases.
Turn it into a warning for now until clients are fixed.

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

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2335>
2022-03-24 15:15:08 +00:00
Jonas Dreßler
0280b0aaa5 events: Use the event target actor to determine window for event
We use get_window_for_event() to check whether an event happened on top
of a window or on top of shell UI to decide whether to bypass delivering
the event to Clutter. In case of crossing events though, we can't just
use the device actor to determine whether to forward the event to
Clutter or not: We do want to forward CLUTTER_LEAVE events which
happened on top of shell UI. In that case the device actor is already a
window actor (the pointer already is on top of a window), but the shell
still needs to get the LEAVE crossing event.

Since the event source actor got removed from the detail of
ClutterEvent, the context we're looking for (which actor did the pointer
leave) is now the target actor that the event gets emitted to. Since the
last commit, we also made event filters aware of this context by passing
the target actor to them, so use this context now to determine whether
we're on top of a window or not.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2321>
2022-03-21 23:08:40 +00:00
Jonas Dreßler
2aad56b949 clutter: Pass target actor of events to event filter functions
We'll need the additional context of which actor the event will be
emitted to in mutters event filter (see next commit), so pass that
target actor to the event filters that are installed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2321>
2022-03-21 23:08:40 +00:00
Ivan Molodetskikh
690b8806dd backends/native: Change uint32_t modifiers to uint64_t
They were erroneously cast to uint32_t. In particular this prevented the
invalid modifier from working as it is equal to a 64-bit -1.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2322>
2022-03-06 16:56:27 +03:00
Robert Mader
7f93004809 compositor/native: Check that the surface can be scanned out untransformed
Before scanning out the surface of a native client we have
to check the following attributes that influence the
relationship between buffer and the defined result on screen:
 - buffer scale
 - buffer transform
 - viewport

In the future we can loose these checks again in cases where the
display hardware supports the required operations (scaling, cropping
and rotating).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2276>
2022-03-05 14:14:37 +00:00
Robert Mader
6330acfaa2 compositor: Some header cleanups
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2276>
2022-03-05 14:14:37 +00:00
Sebastian Keller
251bb45ec0 window/wayland: Always include a size when sending a configuration
Prior to 67033b0a mutter was accidentally including sizes for
configurations that were just focus state changes. This was not leading
to any known problems on the client side, but it was causing issues in
mutter itself when detecting whether a resize originated from the client
or the server.

Not including sizes in focus change configurations anymore however
revealed a bug in gtk. It was storing the window size when in a fixed
size mode (tiled/maximized/fullscreen), but not on any other server side
resizes. It was then restoring this stored size whenever there was a new
configuration without a size while in floating mode, i.e. the focus
change configurations generated by mutter after 67033b0a.

This change now addresses the issue 67033b0a was fixing in a way that
restores the previous behavior of always including the size whenever
sending a configuration.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2091
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2238>
2022-03-05 13:18:58 +00:00
Jonas Ådahl
46f81afb3b kms/impl-device/atomic: Fix function type signature
The property enum type was wrong.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2319>
2022-03-04 23:12:24 +00:00
Jonas Ådahl
590e32dc62 wayland/tablet-pad: Fix fallthrough warning
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2319>
2022-03-04 23:12:24 +00:00
Jonas Ådahl
339c315ed9 input-settings/native: Fix switch fallthrough warning
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2319>
2022-03-04 23:12:24 +00:00
Jonas Ådahl
43870a5f55 input-settins/x11: Fix switch fallthrough warning
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2319>
2022-03-04 23:12:24 +00:00
Jonas Ådahl
79319a3a91 barrier/native: Fix warning about implicit enum conversion
Also add static asserts to make sure the values match so casting can be
done.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2319>
2022-03-04 23:12:24 +00:00
Jonas Ådahl
1914f533b8 tests/screen-cast: Add input injection tests to screen cast client
This tests that cursor metadata are handled properly, and that the
display server handles input events correctly, including ones that are
sent too early.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2270>
2022-03-04 18:13:45 +00:00
Jonas Ådahl
1e50ca0057 remote-desktop/virtual: Drop absolute events if not active
If the remote desktop service emits absolute input events (e.g. absolute
pointer events) before the stream has started streaming, we don't have a
virtual monitor, as the size has not been negotiated yet. When this
happens, just drop the event. Remote desktop services should probably
make sure not to send events before the streaming has started, but them
doing so anyway shouldn't trigger a crash, which would be the case
otherwise.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2270>
2022-03-04 18:13:45 +00:00
Jonas Ådahl
d649445bb7 tests/screen-cast: Also make it a remote desktop session
This will allow emitting input events / remote control too.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2270>
2022-03-04 18:13:45 +00:00
Jonas Ådahl
88cfd31f18 tests/screen-cast: Test virtual stream resizing
This test resizes the stream by updating the PipeWire stream properties.
This triggers a format negotiation, that results in the buffers being
reallocated with the new size. The test makes sure we eventually
receive this new size.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2270>
2022-03-04 18:13:45 +00:00
Jonas Ådahl
c49037469a tests/screen-cast-client: Set an explicit size
Don't set a range, take control of the size. This is fine, since we're
only recording virtual monitors, which get their size from the PipeWire
negotiation.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2270>
2022-03-04 18:13:45 +00:00
Jonas Ådahl
4de740c7a3 screen-cast/virtual-src: Don't recreate the virtual monitor on resizes
Keep the virtual monitor around if it's being resized. This reduces the
number of unnecessary object rebuilding that happen during monitor
rebuilding.

This changes finalize() vfunc into a dispose() vfunc in the abstract
stream source object implementation, as it needs the abstract stream
source object to close the stream early, so that various signal
listeners get disconnected early.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1904
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2270>
2022-03-04 18:13:45 +00:00
Jonas Ådahl
34d0e68aef virtual-monitor: Add way to change virtual monitor mode
This can be used to change the size of the virtual monitor without
recreating it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2270>
2022-03-04 18:13:45 +00:00
Jonas Ådahl
a97b6560d7 virtual-monitor: Never reuse mode IDs
We'll change mode's on-demand so using IDs identical to the virtual
monitor ID would mean IDs didn't change when changing mode, and that is
rather unintuitive. IDs don't mean much anyhow, just make them grow
within the realm of a 63 bit unsigned integer, as the 64th bit means its
a virtual mode ID. Making sure the ID is in the virtual mode namespace
is handled by meta_crtc_mode_virtual_new().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2270>
2022-03-04 18:13:45 +00:00
Jonas Ådahl
ee8de0dc83 backend/native: Remove unused ID namespace macros
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2270>
2022-03-04 18:13:45 +00:00
Jonas Ådahl
46a4a080b7 virtual-monitor: Split out mode info into separate struct
Will help when changing virtual monitor modes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2270>
2022-03-04 18:13:45 +00:00
Jonas Ådahl
a09b99261f wayland/dma-buf: Handle lack of gbm_device gracefully
In some configurations (e.g. NVIDIA driver 470) Xwayland may use DMA
buffer for passing buffers around. When this is done, we might attempt
to scanout these buffers when they are fullscreen, and to do so we
import them using gbm.

However, for the mentioned configuration, there is no gbm device
available for importing. This was not handled, and resulted in a crash;
avoid this crash by checking whether we have a gbm device and fail
gracefully if we don't.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2098
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2318>
2022-03-04 17:27:29 +00:00
Jonas Ådahl
370de58868 wayland/surface: Add support for wl_surface.offset
This aims to replace the x,y arguments in wl_surface.attach(); meaning
it can be used more sanely together with EGL, and at all when using
Vulkan.

The most common use case for the offset is setting the hotspot of DND
surfaces.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1905>
2022-03-04 17:38:30 +01:00
Jonas Ådahl
fadffe3fad wayland/xdg-shell: Add toplevel bounds support
This implements the new 'bounds' event that is part of the xdg_toplevel
interface in the xdg-shell protocol. It aims to let clients create
"good" default window sizes that depends on e.g. the resolution of the
monitor the window will be mapped on, whether there are panels taking up
space, and things like that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2167>
2022-03-04 14:48:25 +00:00
Jonas Ådahl
28a5946a28 tests/wayland-unit-tests: Remove unnecessary message check
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2167>
2022-03-04 14:48:25 +00:00
Jonas Ådahl
cb424b68e6 tests/wayland-unit-tests: Make some function names less generic
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2167>
2022-03-04 14:48:25 +00:00
Jonas Ådahl
546b94545e window: Make a better guess at initial monitor
We'd guess the initial monitor before it was actually calculated by
looking at the initial geometry. For Wayland windows, this geometry was
always 0x0+0+0, thus the selected monitor was always the primary one.

This is problematic if we want to provide initial more likely
configurations to Wayland clients. While we're not doing that yet, it'll
be added later, and this is in preparation for that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2167>
2022-03-04 14:48:25 +00:00
Jonas Ådahl
17e239246a window: Add function to calculate current bounds
This will later be used to tell Wayland clients about a size they
shouldn't exceed.

If the window doesn't have a main monitor, this function does nothing
and returns FALSE.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2167>
2022-03-04 14:48:25 +00:00
Jonas Ådahl
213f0d8dd3 window/wayland: Pass x,y,width,height as rectangle
Will make the number of variables a bit more managable.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2167>
2022-03-04 14:48:25 +00:00
Carlos Garnacho
e736b04deb clutter: Remove "source" event union fields
These are no longer used, drop the last places that modify those
in event structs and remove them.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2311>
2022-03-04 10:58:28 +00:00
Carlos Garnacho
5dd818cf1a tests: Move away from clutter_event_get_source()
The target actor as seen by the stage is equivalent, so use that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2311>
2022-03-04 10:58:28 +00:00
Carlos Garnacho
9b6253bf3f wayland: Move away from clutter_event_get_source()
Instead ask the stage about the target actor, which is equivalent
and ensured to be up-to-date.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2311>
2022-03-04 10:58:28 +00:00
Carlos Garnacho
52002d042e core: Move away from clutter_event_get_source()
Instead ask the stage for the target actor for the given device/sequence.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2311>
2022-03-04 10:58:28 +00:00
Robert Mader
8f91d831ee wayland/dma-buf: Fix typos in struct name
Fixes 7acecb1c72

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2297>
2022-03-04 09:16:28 +00:00
Robert Mader
5b9abecc1b wayland/dma-buf: Add missing wl_array_release()
So we don't leak the array.

Fixes 7acecb1c72

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2297>
2022-03-04 09:16:28 +00:00
Ivan Molodetskikh
bcf6ee5e55 Name unnamed sources
These names show up in GLib traces in sysprof, so let's make sure they
exist.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1928>
2022-03-04 10:10:05 +03:00
Bilal Elmoussaoui
7717383deb meson: Allow to build without gnome-desktop
gnome-desktop is used to retrieve the monitor vendor name which in some
use cases is not needed  as it brings a bunch of gnome-desktop unwanted
dependencies.
The change makes mutter fallback to an "Undefined" vendor name if it is
built without gnome-desktop

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2317>
2022-03-03 15:07:38 +00:00
Alfonso Sánchez-Beato
8ccbb32f71 egl: Fix number of configs returned in meta_egl_choose_all_configs
Return in meta_egl_choose_all_configs() the actual number of
configurations returned by eglChooseConfig(), which are not
necessarily the same number as those from eglGetConfigs().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2303>
2022-03-03 08:18:56 +00:00
Jonas Dreßler
672696f823 dnd: Notify about events during compositor grab from event filter
Since the introduction of ClutterGrabs, MetaDnd now no longer gets
notified about input events on the stage during grabs (for example while
the alt-tab popup is shown) and thus can't move the grab feedback actor
anymore.

To fix this, forward events to MetaDnD directly from
meta_display_handle_event() when a ClutterGrab is in effect.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2308>
2022-03-02 15:12:23 +00:00
Jonas Dreßler
8a11069dca events: Only get MetaWaylandCompositor once
We get the MetaWaylandCompositor a bunch of times, but we can do with
getting it only once and then also replace the is_wayland_compositor()
checks with a if (wayland_compositor).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2308>
2022-03-02 15:12:23 +00:00
Carlos Garnacho
32332fd53d wayland: Handle xdg_activation_v1_activate on non XDG activation tokens
The XDG activation support was missing interoperability with other
startup sequences, notably those coming from other means than XDG
activation.

In order to play nice with X11 startup sequence IDs, we not just
have to check for the startup ID being in the general pool, but
we also need to fallback into X11-style timestamp comparison so the
window ends up properly focused.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2314>
2022-02-28 17:34:27 +01:00
Olivier Fourdan
fe41e69eea wayland/xdnd: Use multiple DnD X11 peers
When a drag and drop occurs from an X11 client to a Wayland native
client, mutter uses an internal X11 window as a peer for the DnD  drop
site.

That internal X11 window is moved and resized to match the Wayland
native windows as the drag destination moves.

When moving from one Wayland native window to another Wayland native
window, the same X11 window is used, and as a result no DND enter/leave
events is emitted.

In that case, the drop may occur on the wrong Wayland native window,
because no new XdndEnter/XdndLeave event were emitted.

To avoid that issue, use a pair of X11 windows instead of just one and
alternate between the two when repicking a new drop surface, so that
moving from a Wayland surface to another will always generate the
expected enter/leave events that we rely on.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2136
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2305>
2022-02-25 11:35:35 +01:00
Dor Askayo
2a5506170a core: Initialize g_autofree with NULL
This prevents build warnings about use of potentially uninitialized
variables.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2301>
2022-02-23 20:48:10 +00:00
Bilal Elmoussaoui
26790f7f39 wayland/keyboard: Remove unnused define
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2306>
2022-02-22 11:05:36 +01:00
Carlos Garnacho
1ad98879b7 core: Mark both directions in rings/strips as (un)handled altogether
If going on a direction has a keycombo associated and the other does
not, it does not make sense to let the wayland bits handle pad
ring/strip events that only go in one direction.

Ensure that's the case, and also while figuring out the ring/strip
direction based on the initial events.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1886
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2001>
2022-02-14 15:24:27 +00:00
Carlos Garnacho
952caf6b71 core: Refactor strip/ring direction guessing in action handling
Make it all happen in meta_pad_action_mapper_handle_action(), since
we'll need better handling here than just "return FALSE".

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2001>
2022-02-14 15:24:27 +00:00
Carlos Garnacho
101cae03f3 core: Handle mixture of keycombo/no action in pad rings/strips
When generating the action label, we expect both directions of these
features to have consistent settings (either both get a keycombo, or
they don't) or these just return NULL altogether.

Since one of the directions has an action associated, this is
misleading, so be more lenient at the time of generating the action
label.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2001>
2022-02-14 15:24:27 +00:00
Carlos Garnacho
7bf10de538 wayland: Warn and fix accounting on missed CLUTTER_TOUCH_END events
If we happen to handle a CLUTTER_TOUCH_BEGIN without a corresponding
CLUTTER_TOUCH_END at MetaWaylandTouch, we would still attempt to
reuse the older MetaWaylandTouchInfo, resulting in an assert triggered
as there is a stale touch reference on the previous surface.

Warn in place and create a new touch info struct to still fix the
broken surface accounting, instead of finding out the hard
way after the surface is destroyed. The assert is preserved to ensure
the accounting does not sneakily break anymore/further.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/584
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2251>
2022-02-14 13:54:33 +00:00
Daniel van Vugt
b7f7b82b89 onscreen/native: Warn instead of crashing if the frame_info queue is empty
Some Ubuntu systems with mutter 40 and 41 report `maybe_update_frame_info`
crashes with SIGSEGV when `frame_info == NULL`.

The same was reported by @rmader as happening "after wakeup" in testing
(https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1441#note_1301588)
although the Ubuntu reports show it's not related to that MR.

Fixes: https://launchpad.net/bugs/1960585
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2282>
2022-02-14 10:51:18 +00:00
Jonas Ådahl
ca5488c3d6 monitor-manager: Don't introspect "monitor-privacy-screen-changed"
It passes a MetaLogicalMonitor, which isn't introspected right now, so
skip it completely. The entry point to the UI is handled via
MetaDisplay, so it isn't needed.

This fixes the following warning:

<unknown>:: Warning: Meta: (Signal)monitor-privacy-screen-changed: argument object: Unresolved type: 'MetaLogicalMonitor'

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2287>
2022-02-14 10:01:54 +00:00
Jonas Ådahl
2a624dbd1e monitor-manager/native: Emit privacy-screen-changed signal later
Make sure the monitor and output state is up to date when we emit the
privacy-monitor-changed signal, otherwise the signal emission code will
try to look up out of date state.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2119
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2280>
2022-02-14 09:29:48 +00:00
Florian Müllner
7ff52b6128 wayland/gtk: Only perform allowed titlebar gestures
The window functions "work" regardless of whether the client allows
the behavior or not. That is, it's up to the caller to not call
maximize and friends when the action isn't allowed.

Add appropriate checks, which should make the titlebar_gesture()
behavior identical to titlebar actions for server-side decorations.

https://gitlab.gnome.org/GNOME/mutter/-/issues/2139

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2281>
2022-02-10 20:00:15 +01:00
Konstantin Kharlamov
338eea7a37 backends/native/meta-seat: Sync keyboard LEDs when changing layout
Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/633
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2279>
2022-02-10 08:11:56 +00:00
Jonas Ådahl
5588f2a21c tests: Decrease boiler plate needed for adding more tests
Structure tests in a list of dictionaries, instead of requiring each
test to have its own executable(...) and test(...) statement. The
intention of this is to make it easier to add more test cases.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2262>
2022-02-09 09:04:09 +00:00
Jonas Ådahl
afca974405 tests: Move monitor test utils into libmutter-test.so
It already was built into it without any symbols exported, but also
duplicated in test cases that used it. Make it so that the built in
functions are exported, with prefixes, and make all tests use the
exported functions. While at it, make things go via MetaContext or
MetaBackend depending on how early in initialization things are run.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2262>
2022-02-09 09:04:09 +00:00
Jonas Ådahl
3fc0d8b81d tests/build: Remove duplicated meta-gpu-test.c file inclusion
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2262>
2022-02-09 09:04:09 +00:00
Jonas Ådahl
15b8f89c02 tests: Move ref test framework to libmutter-test.so
Will make it available to most tests without having to explicitly
include.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2262>
2022-02-09 09:04:09 +00:00
Jonas Ådahl
bd18af1a0d tests/build: Sort sources list
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2262>
2022-02-09 09:04:09 +00:00
Jonas Ådahl
195766cb69 tests: Add helper for creating virtual test monitors
This uses virtual monitors in the headless backend, in contrast to the
ones used by the monitor configuration tests which use the nseted
backend.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2262>
2022-02-09 09:04:09 +00:00
Jonas Ådahl
b7f23c1baf tests/utils: Add helper to find a window given a title
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2262>
2022-02-09 09:04:09 +00:00
Jonas Ådahl
b522e3cecd tests/wayland: Move test client helper into a utils file
This will make it easier to run Wayland test cases from other test
executables.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2262>
2022-02-09 09:04:09 +00:00
Carlos Garnacho
d90adfe303 backends: Keep cursor hidden on tablet input on Wayland
Tablets have their own cursor, in order to avoid confusions just
hide the regular pointer like we do on touchscreens, so there's
the illusion that there is a single cursor.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/75
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/285>
2022-02-08 14:34:47 +00:00
Carlos Garnacho
a870e6b38d backends/x11: Update MetaBackend on ClutterEvent processing
This should fix wonky handling of last used device and pointer
visibility on X11. At least does on --nested under presence of
touchscreen/tablet.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/285>
2022-02-08 14:34:47 +00:00
Carlos Garnacho
13330f34f3 backends: Add private call to update MetaBackend from a device
We update some details like the last used device and pointer visibility
from events, but this is done inconsistently on X11 since the
ClutterEvents are created and pushed from an additional place.

Make these updates happen on a private call, that will be called from
these places in X11.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/285>
2022-02-08 14:34:47 +00:00
Carlos Garnacho
f5c0bcbf9c backends: Split handling of pointer visibility on events
This was done as part of the "last updated device" changes, separate
that as we want different checks and policies.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/285>
2022-02-08 14:34:47 +00:00
Carlos Garnacho
f852e5ab2b backends: Make meta_backend_update_last_device() private
This is now handled entirely in the backend, no need to export this
function.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/285>
2022-02-08 14:34:47 +00:00
Carlos Garnacho
d72bacb3cd backends/x11: Drop handling of XI_DeviceChange
Even though it's great that XI2 has an event to notify about device
changes, this is something we can let the MetaBackend code handle
consistently for all backends, since looking for the source device
works everywhere.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/285>
2022-02-08 14:34:47 +00:00
Carlos Garnacho
4e85e0e1b3 core: Drop handling of updates to the last used device
This is now done in the backend for the Wayland case, so we can
drop this update here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/285>
2022-02-08 14:34:47 +00:00
Carlos Garnacho
9708d04f7e backends: Check for updates in the last used device after dispatching events
Instead of relying in the device being updated from different parts of our
machinery for different backends, hook this up to our own event dispatching.
This will allow dropping all other places where this is done.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/285>
2022-02-08 14:34:47 +00:00
Carlos Garnacho
ecafc489c1 backends: Move function definitions
These will be made private and called from different places. At the
moment there is no functional change here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/285>
2022-02-08 14:34:47 +00:00
Carlos Garnacho
3ab59175c8 backends/native: Fix cursor renderer assignment for tablet devices
We create a cursor renderer per device for those at
meta_seat_native_handle_event_post() with PROXIMITY_IN events, but
the MetaWaylandTabletTool handles the event before that, and goes
with a NULL cursor renderer.

Make MetaBackend::get_cursor_renderer() on the native backend create
those cursor renderers on demand, and only handle PROXIMITY_OUT in
handle_event_post() to dispose those. This makes MetaWaylandTabletTool
happily get a cursor renderer again.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/285>
2022-02-08 14:34:47 +00:00
Carlos Garnacho
a88c9b9ff2 wayland: Use default cursor on tablet tools
Now that we "replace" the pointer cursor on tablet input, have it
use the default cursor so it blends in better.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/285>
2022-02-08 14:34:47 +00:00
Carlos Garnacho
f2ff9dcc01 backends: Unify cursor visibility checks
We are adding more to this logic, so make this check be its own
function that checks devices individually.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/285>
2022-02-08 14:34:46 +00:00
Jonas Ådahl
52ce81657d backend/native: Only disable dmabuf screen cast when not hw accelerated
We now only enable DMA buffer based PipeWire screen casting if a
format/modifier has been negotiated. This practically means a consumer
is aware about what is needed, and we should not try to predict that it
uses the DMA buffer the right way (i.e. not mmap:ing directly).

However, in case we're not hardware accelerated, we never want to
attempt to use DMA buffer screen sharing, as we want to avoid
compositing into a DMA buffer on such hardware as doing so can be very
slow.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2086>
2022-02-07 19:16:45 +00:00
Jonas Ådahl
169dd2fb7a window: Move some display level window processing to MetaDisplay
meta_window_(un)queue() was implemented with global arrays in window.c
that managed MetaLater handle IDs and lists of window queues. In order
to rely less on scattered static variables and making it clearer that
we're dealing with per display window management and not something
specific to a single window, move the window resize/calc-showing queue
management to MetaDisplay.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2264>
2022-02-07 17:52:05 +00:00
Jonas Ådahl
ac5d728abd window: Fix coding style in meta_window_unqueue()
As with meta_window_queue(), it had some comments duplicating code, so
those were removed too to increase readability.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2264>
2022-02-07 17:52:05 +00:00
Jonas Ådahl
aeae90d5d9 window: Move icon management to X11 implementation
It's still used by e.g. GNOME Shell to produce fallback icons for X11
applications that doesn't come with a .desktop file. Geometry stays in
the generic class because it's used for minimize animations and is
configured by the panel (e.g. the one in gnome-shell-extensions).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2264>
2022-02-07 17:52:05 +00:00
Jonas Ådahl
35ac3a096d compositor: Destroy actors when unmanaging
When disposing, actors being destroyed might want to access the disposed
compositor; avoid that by destroying them earlier.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2264>
2022-02-07 17:52:05 +00:00
Jonas Ådahl
dd14592314 laters: Expose MetaLaters publicly
Will allow not having to use the context-less meta_later_add().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2264>
2022-02-07 17:52:05 +00:00
Jonas Ådahl
73c010d8b0 window: Remove musings from meta_window_queue()
The comments in this function tells a story of C programmer self
reflecting about data types and Perl. While that can be nice, the rest
consisted mostly of repeating what the code line below did, with the end
result being that the function didn't fit on screen, resulting in worse
readability overall.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2264>
2022-02-07 17:52:05 +00:00
Jonas Ådahl
b5d873a8ac window: Clean up coding style of meta_window_queue()
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2264>
2022-02-07 17:52:05 +00:00
Carlos Garnacho
09538422c6 backends: Update idle time after opening the lid
When handling lid state, we used to update the idle time right after
opening the lid. This behavior changed in commit 14b6c8780d due
to a typo/thinko, "if (lid_is_closed)" used to be an early return
condition before updating idle time, now it only updates in that
case.

Restore the original behavior, since this idle time update is key
in having gsd-power light up the display again, this presumably
fixes situations that required extra "light up" hints after suspend.
What it does surely fix is "ninja test" in g-s-d against recent
mutter, since the behavioral change induced a test timeout there.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2272>
2022-02-07 16:52:39 +00:00
Sebastian Wick
abadb29132 xwayland: Relax the ownership requirements of /tmp/.X11-unix
The `ensure_x11_unix_perms` function tries to detect systems on which
/tmp/.X11-unix is owned by neither root nor ourselves because in that
case the owner can take over the socket we create (symlink races are
fixed in linux 800179c9b8a1e796e441674776d11cd4c05d61d7). This should
not be possible in the first place and systems should come with some way
to ensure that's the case (systemd-tmpfiles, polyinstantiationm …). That
check however only works if we see the root user namespace which might
not be the case when running in e.g. toolbx.

This change relaxes the requirements such that in the root user
namespace we detect and abort if a vulnerable system is detected but
unconditionally run in toolbx.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2261>
2022-02-07 16:01:26 +00:00
Olivier Fourdan
6427b27602 mutter: Raise the NOFILE limit if a Wayland compositor
When being run as a Wayland compositor, raise the NOFILE limit to
mitigate the risk of running out of file descriptors.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2235>
2022-02-07 16:11:47 +01:00
Olivier Fourdan
8305c7bd06 wayland/client: Restore the NOFILE limit
Make sure the restore the original NOFILE limit prior to run the
trusted Wayland client so it does not inherit from the raised value.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2235>
2022-02-07 16:11:47 +01:00
Olivier Fourdan
acded0648c core: Restore the NOFILE limit
When restarting or when running a dialog, the original NOFILE limit
should be restored.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2235>
2022-02-07 16:11:47 +01:00