1
0
Fork 0
Commit graph

10833 commits

Author SHA1 Message Date
Olivier Fourdan
8ee85cb228 xwayland: Add support for byte-swapped clients
Instructs Xwayland to allow/disallow connections from X11 clients with a
different endianess based on the "xwayland-allow-byte-swapped-clients"
setting.

This option has no effect if Xwayland does not support the command
option +byteswappedclients/-byteswappedclients.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2576
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2785>
2023-01-17 11:14:19 +01:00
Olivier Fourdan
5be6e7b18e settings: Add Xwayland byte-swapped clients
Recent versions of Xwayland can allow or disallow X11 clients from
different endianess to connect.

Add a setting to configure this feature from mutter, who spawns
Xwayland.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2785>
2023-01-17 11:14:19 +01:00
Carlos Garnacho
95c2154039 wayland: Drop HAVE_XSETIOERROREXITHANDLER checks
This define was dropped by commit 0e8aaebc00 (xwayland: Make
XSetIOErrorExitHandler() mandatory), but some #ifdef checks were
brought back by commit 36f30341ac (wayland: Add a prepare-shutdown
signal).

Since there's no define anymore in config.h, these pieces of code
were unintentionally disabled, and a meta_get_display() call be
also left over. Remove the ifdefs and update the code to build
again.

Fixes: 36f30341ac - wayland: Add a prepare-shutdown signal
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2786>
2023-01-12 14:54:31 +00:00
Carlos Garnacho
78a3631d15 core: Wrap XMapWindow() request with error traps
Other X11 calls happening during the process of assigning a frame
to a window are already wrapped with error traps, wrap this as well
to avoid possible X11 errors.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2745>
2023-01-12 14:07:32 +01:00
Carlos Garnacho
2019536f3c core: Wrap an extra X11 call with error trap
This XChangeWindowAttributes call was never surrounded by an error trap
and was not really expected to fail with BadWindow since the frame window
would be owned by Mutter itself.

This however is no longer true, and we might be getting a BadWindow from
the frame window given the right timing.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2745>
2023-01-12 14:00:52 +01:00
Carlos Garnacho
c7b3d8c607 frames: Push error traps around various X11 calls
It is a possibility that these requests result in an error, so handle
the possible fallout.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2745>
2023-01-12 14:00:52 +01:00
Carlos Garnacho
5816268c1d x11: Push error trap reading X11 selection
It is a possibility that this request results in an error, so handle
the possible fallout.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2745>
2023-01-12 14:00:52 +01:00
Carlos Garnacho
8789e1b7d9 x11: Push error trap querying the _MUTTER_FRAME_FOR property
It is a possibility that this request results in an error, so handle the
possible fallout.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2745>
2023-01-12 14:00:52 +01:00
Carlos Garnacho
1cee0579fa wayland: Push an error trap while querying XDND mimetype list
It is a possibility that this request results in an error, so handle the
possible fallout.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2745>
2023-01-12 14:00:52 +01:00
Bilal Elmoussaoui
a4d1b50b3b tests: Disable XWayland tests if it is not enabled
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2399>
2023-01-03 20:45:04 +00:00
Bilal Elmoussaoui
4bbad6063a wayland: Move Xwayland specific call to xwayland
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2399>
2023-01-03 20:45:04 +00:00
Bilal Elmoussaoui
36f30341ac wayland: Add a prepare-shutdown signal
This allows moving the xwayland shutdown logic to the xwayland
implementation

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2399>
2023-01-03 20:45:04 +00:00
Bilal Elmoussaoui
6e818c8c38 build: Allow disabling xwayland
Mostly moving things around to allow a build without xwayland.
Note that more work might still be needed once the x11 build option
lands as that would allow us to have a proper xwayland only build
without the x server part.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2272
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2399>
2023-01-03 20:45:04 +00:00
Carlos Garnacho
717ee78997 backends/native: Set up keyboard a11y when keyboards are plugged
Commit 4e0ffba5c attempted to fix initialization of keyboard a11y,
but mousekeys do attempt to create a virtual input device at a
time that it is too early to try to create one.

Defer this operation until keyboard devices are added, so that
we are ensured to already have the seat input thread set up.

Fixes: 4e0ffba5c - backends/native: Initialize keyboard a11y on startup
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2778>
2022-12-23 14:51:01 +01:00
Bilal Elmoussaoui
d1d2496c99 core: Replace MetaVirtualModifier
By making all the types uses ClutterModifierType instead.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2407>
2022-12-22 15:13:54 +01:00
Bilal Elmoussaoui
8b42bc77dc build: Make GTK dependency specific to X11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2407>
2022-12-22 15:13:54 +01:00
Bilal Elmoussaoui
4d7aedf90a compositor: Drop debug helpers
They can no longer be used as libmutter will drop it gdk/gtk
dependencies in the upcoming commits

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2407>
2022-12-22 15:13:54 +01:00
Bilal Elmoussaoui
7e9d9c7eb9 core: Add meta_accelerator_name
As we have switched to using meta_parse_accelerator in PadActionMapper.
We need a function that does the other direction for the client side
usage. See
https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/f1d50a4a/js/ui/padOsd.js#L107

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2407>
2022-12-22 15:13:54 +01:00
Bilal Elmoussaoui
abef37f5ee core: Add a copy of GDK_PRIORITY_EVENTS
Quoting Carlos:
The META_PRIORITY_EVENTS ± 1 happening below are in order to set these idles
and timeouts in a priority that is relative to the literal GDK event priority,
making those diverge is a likely way to sneakily break things.
But that's unlikely to happen, and decoupling mutter from GTK further
should make it moot, so perhaps it's alright after all.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2407>
2022-12-22 15:13:54 +01:00
Bilal Elmoussaoui
809eaf6e91 core: Replace gtk_accelerator_parse usage
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2407>
2022-12-22 15:13:54 +01:00
Bilal Elmoussaoui
c710f14cc5 core: Replace gtk_get_default_locale usage
Clutter has an API to get the text direction but used to depend
on gtk3's translation domain. In order to avoid broken i18n
in case gtk3 is not installed, move the transtalable string to
clutter itself.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2407>
2022-12-22 15:13:54 +01:00
Bilal Elmoussaoui
64ee8d02f7 core: Add a in-tree copy of GtkBorder
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2407>
2022-12-22 15:13:54 +01:00
Bilal Elmoussaoui
b0b21e8274 default-plugin: Remove unnused field
This drops the usage of GdkRGBA

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2407>
2022-12-22 15:09:03 +01:00
Bilal Elmoussaoui
fb4161853f cleanup: Make GDK dependency specific to X11
This way, the dependencies on GTK/GDK could be completely dropped if
built with Wayland only.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2407>
2022-12-22 15:09:03 +01:00
Carlos Garnacho
60e0fe776d backends: Do not require a physical device to update pointer visibility
We may also want to update pointer visibility from emulated events
emitted directly on logical devices, as those we generate from XI_RawMotion
on X11 when the pointer is not over a compositor window.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2344
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2766>
2022-12-19 18:30:34 +01:00
Jonas Ådahl
6adc2e4b59 pointer-lock/wayland: Fix coding style
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2772>
2022-12-18 13:17:49 +01:00
Jonas Ådahl
4edcdd8a7f pointer-lock/wayland: Remove unused instance struct field
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2772>
2022-12-18 10:00:34 +01:00
Jonas Ådahl
2762a67000 pointer-lock/wayland: Get compositor from surface
This avoids trying to get it from an pointer that was never set to
anything.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2558
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2772>
2022-12-18 10:00:14 +01:00
Jonas Ådahl
439856e7aa wayland/gtk-shell: Dereference surface after NULL check
Spotted by coverity.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2772>
2022-12-18 09:47:29 +01:00
Jonas Ådahl
ca98895185 tests/cogl: Add test checking rgb10 fbo precision
There are two tests; one checks that clearing with a color that cannot
be represented using 8 bits per channel doesn't loose precision when
painted, then read back using glReadPixels(). Would the texture backing
store have 8 bits per channel instead of 10, we'd get a different value
back.

The other test checks that painting from one fbo to another also doesn't
loose that precision.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2461>
2022-12-17 23:12:34 +00:00
Olivier Fourdan
9e8d32980a meta: Move enum definitions to meta-enums.h
Commit bf84b24 created meta-enums.h but it's pretty empty so far, the
vast majority of enum definitions is still in common.h.

Move the Meta enum definitions to meta-enums.h as one would expect them
to be found.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2467>
2022-12-17 22:49:44 +00:00
Jonas Ådahl
ea7175f6b7 tests/wayland: Add test for xdg-foreign
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2770>
2022-12-17 20:38:23 +00:00
Jonas Ådahl
474c093801 tests/wayland-client-utils: Add simple toplevel helper
Add a helper to create a toplevel painted with a given color, size and
title. It's meant to be "dumb" and have a default size, but respect any
configured size.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2770>
2022-12-17 20:38:23 +00:00
Jonas Ådahl
d97c160122 tests/wayland-test-client-utils: Add helper to wait for event
Useful for synchronization.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2770>
2022-12-17 20:38:23 +00:00
Jason Francis
aa0b1fbc88 wayland/xdg-foreign: Add support for xdg-foreign-v2
This replaces the v1 implementation, which is now renamed to
legacy-xdg-foreign. Both implementations use the same data structures
internally, so that protocol version mismatches between
the importer client and exporter client don't fail.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2770>
2022-12-17 20:38:23 +00:00
Robert Mader
7441d4f8e1 core/selection: Set display on creation
Otherwise the getter always returns `NULL`.

Fixes dd2beae6a8

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2768>
2022-12-17 16:47:46 +01:00
Jonas Ådahl
471d23ba43 Remove meta_get_display()
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
2022-12-17 15:13:48 +01:00
Jonas Ådahl
d7f26136b4 later: Remove old API
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
2022-12-17 15:13:48 +01:00
Jonas Ådahl
d7f5477103 compositor: Enable introspection
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
2022-12-17 15:13:48 +01:00
Jonas Ådahl
7a62e55c54 laters: Turn into GObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
2022-12-17 15:13:48 +01:00
Jonas Ådahl
4b3cab2cca compositor: Don't make internal API public
Things like meta_compositor_destroy() and meta_compositor_add_window()
isn't intended to be used externally, and if they was, things would
probably fall apart rather quickly.

MetaCompositor also isn't introspected, meaning things that technically
belong to the compositing parts isn't easily available via some object,
but much take detours via other objects like MetaDisplay.

So move the API intended for internal usage to compositor-private.h, and
leave API that is meant to be expose in the public compositor.h.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
2022-12-17 15:13:48 +01:00
Jonas Ådahl
6487415e88 Deprecate meta_get_feedback_group_for_display()
Callers should replace with meta_compositor_get_feedback_group().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
2022-12-17 15:13:48 +01:00
Jonas Ådahl
2340af8d93 Remove meta_get_backend()
It should be retrieved from the context via an ownership chain.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
2022-12-17 15:13:48 +01:00
Jonas Ådahl
aa2a663380 meta: Remove meta_monitor_manager_get()
It has no more users and shouldn't be used.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
2022-12-17 15:13:48 +01:00
Jonas Ådahl
82abee5ad7 wayland: Remove meta_wayland_compositor_get_default()
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
2022-12-17 15:13:48 +01:00
Jonas Ådahl
f8376a43d3 Always queue MetaLater via compositor instance
The "later" API is used to queue actions in relation to compositing,
thus is owned by the MetaCompositor instance. Make users of this
functionality get MetaLaters instance from the compositor, and stop
using the global meta_later() API.

display: Use non-singleton MetaLater API

tests: Use non-singleton MetaLater API

meta/common: Make docs refer to context aware MetaLater API

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
2022-12-17 15:13:48 +01:00
Jonas Ådahl
342c94076d display: Destroy unmanaged compositor a bit later
This allows for things that want to get some state or manager objects
(MetaLaters to be specific) a bit later in the tear down procedures.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
2022-12-17 15:13:48 +01:00
Jonas Ådahl
e9cd2b60a6 tests: Make tests components have ownership chains as well
This means we can eliminate the use of scattered singletons that isn't
added by the tests or the test framework itself.

tests: Don't get backend from old singleton getter

Either use the ownership chain, or the explicit test context instance
pointer.

tests/wayland: Pass context to test client constructor

So that we can get the Wayland compositor directly from the context.

tests: Don't get display from singleton

tests/client: Make test client carry a context pointer

tests/runner: Have test cases carry a context pointer

tests/wayland/test-driver: Get backend from context

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
2022-12-17 15:13:48 +01:00
Jonas Ådahl
3a1ded73ad x11/session: Make state tracking context aware
Instead of passing around state using GINT_TO_POINTER() pass around a
state struct that also carries a pointer to the context. This allows
avoiding using old singletons for getting a window list.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
2022-12-17 15:13:48 +01:00
Jonas Ådahl
1b737190cc x11: Setup and user ownership chains
On the path towards clear ownership chains and always using them to find
other components, do the same for X11 client support paths too.

x11-display: Don't get backend from signleton

x11/selection: Don't get display from singleton

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
2022-12-17 15:13:48 +01:00