Jonas Ådahl
8a4aa92a54
context: Move the signal handling and dir management to user
...
Signals and changing current directory is a process global action, thus
isn't that suitable for a library. Thus, move that responsibility to
gnome-shell.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 13:40:34 +02:00
Jonas Ådahl
9cda0bd719
tests: Make common test code a shared library
...
This will require some symbol exporting, but the benefit is that have
better control of what external test cases can do in terms of creating
more testing specific contexts.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 13:40:34 +02:00
Jonas Ådahl
d8107027ef
tests/test-utils: Move test client path ensure helper to private header
...
It's only used from the test context, and the main test utils header
file will be used to export helper functionality, so move it out,
preparing for that.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:42:40 +02:00
Jonas Ådahl
724a7eee74
tests: Move 'wait-for-X11-display' helper to MetaContextTest
...
Gets rid of a un-prefixed helper function relying on a global singleton.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:42:40 +02:00
Jonas Ådahl
e8742be568
tests/test-utils: Remove unused init function
...
This is now dealt with by MetaContextTest.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:42:40 +02:00
Jonas Ådahl
3d5a2b2ffb
context/test: Make type derivable
...
This makes it possible to declare the type in an installed header (so
that e.g. META_CONTEXT_TEST(context) works), but without having to
expose the MetaContextClass struct.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:42:40 +02:00
Jonas Ådahl
acb0a44224
tests: Prefix test plugin name getter with meta_
...
It'll be used via the new shared library, so prefix it.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:42:40 +02:00
Jonas Ådahl
9f1f3139b8
tests/utils: Prefix AsyncWaiter with Meta
...
This too will be used by test cases via a shared library.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:42:40 +02:00
Jonas Ådahl
4a6e22311a
tests/utils: Prefix TestClient with Meta
...
Soon we'll expose it via a libmutter-test library.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:42:40 +02:00
Jonas Ådahl
f74d311d61
tests: Rename test-utils.c/h to meta-test-utils.c/h
...
Otherwise it'll conflict with other files with identical filenames,
if one would add src/tests/ to the include path, which will happen in a
later commit.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:42:39 +02:00
Jonas Ådahl
ff0afb186a
context: Move 'replace-current-wm' tracking to the context
...
This move yet another scattered global static variable into the
context's control.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:34:37 +02:00
Jonas Ådahl
50ed027b6f
context: Move X11 display policy under the context
...
The context implementations already effectively dictate the policy, so
let them do it more directly instead of going indirectly via global
variables.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:34:37 +02:00
Jonas Ådahl
e62f7e2910
context: Allow controlled destruction
...
Add a method meta_context_destroy() that both runs dispose and unrefs
the context. Tear down is moved to dispose() so that things owned by the
context are destroyed when calling meta_context_destroy(), or when the
last reference is released.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:34:37 +02:00
Jonas Ådahl
2deb751fd9
context: Add explicit state tracking
...
This will help finding out when things happen in the wrong order.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:34:37 +02:00
Jonas Ådahl
c1beb204c2
x11-display: Get _GNOME_WM_KEYBINDINGS from the context
...
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:34:37 +02:00
Jonas Ådahl
7d0aaa14d1
x11-display: Get _NET_WM_NAME from context
...
It's equivalent to the name that was passed when the context was
created.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:34:37 +02:00
Jonas Ådahl
d3b7d8df0d
wayland: Initialize in a single step
...
Before we first created the MetaWaylandCompositor instance, which would
repare Clutter/Cogl so they could initialize and turn on Wayland display
server features, then later to initialize the rest. Now that part is
done by the Wayland infrastructure itself, so we don't need the early
initialization. Simplify things a bit by centralizing it all into a
single meta_wayland_compositor_new() call.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:34:37 +02:00
Jonas Ådahl
0330ce1f15
context: Make the context own MetaWaylandCompositor
...
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:34:37 +02:00
Jonas Ådahl
6768b509ea
Remove meta_quit()
...
It is no longer used, so remove it. This also removes the intermediate
MetaContext global singleton, as it is no longer needed.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:34:37 +02:00
Jonas Ådahl
122aa94642
x11/session: Use MetaContext to terminate instead of meta_quit()
...
This is done by keeping around a pointer to MetaContext as
"client_pointer" (which is practically the same as "user_pointer"
elsewhere), as well as creating a `MetaIceConnection` wrapper for ICE
connections.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:34:37 +02:00
Jonas Ådahl
9523120241
x11/events: Use MetaContext to terminate instead of meta_quit()
...
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:34:37 +02:00
Jonas Ådahl
e8af5fd398
display: Keep pointer to the context
...
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:34:37 +02:00
Jonas Ådahl
4be9bc9db4
stage/x11: Terminate using MetaContext instead of meta_quit()
...
Done for the nested backend when clicking the close button.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:34:37 +02:00
Jonas Ådahl
7d116bee0f
main: Move MetaX11DisplayPolicy to a new meta-private-enums.h
...
As with the compositor type enum, also have the X11 display policy enum,
as it's also effectively part of the context configuration. But as with
the compositor type, move it to a header file for enums only, and since
this is a private one, create a private variant meta-enums.h.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:34:36 +02:00
Jonas Ådahl
68b376a944
context: Make context owner of MetaDisplay
...
It may still be closed from elsewhere, e.g. when being replaced, but the
reference is owned by MetaContext instead of itself.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:25:21 +02:00
Jonas Ådahl
b1c643eeaa
context: Make the context owner of the backend
...
There is still the `_backend` singleton still, as there are still the
`meta_get_backend()` that needs to work for now.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:25:21 +02:00
Jonas Ådahl
1972d4ec90
main: Remove now unused functions used for running mutter
...
The way to do this now is using a MetaContext.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:25:21 +02:00
Jonas Ådahl
ed53dd90f3
context: Add way to add custom option group
...
This will be used by gnome-shell.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:25:21 +02:00
Jonas Ådahl
d76743736f
context: Add way to set plugin GType instead of name
...
Will be used by gnome-shell.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:25:21 +02:00
Jonas Ådahl
fe0ce2814e
main: Remove meta_test_init()
...
This was the last user of the configuration override API, so that goes
as well.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:25:21 +02:00
Jonas Ådahl
1d4224ab07
tests/persistent-virtual-monitor: Port to MetaContext
...
Since this tests the `--virtual-monitor` command line argument, it uses
the `MetaContextMain` variant of the context, as it's there that command
line argument is handled.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:25:21 +02:00
Jonas Ådahl
725510ea29
mutter: Port to MetaContext
...
Uses the new MetaContextMain, replacing piece by piece "real display
server" setup done using mostly main.c functions.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:25:21 +02:00
Jonas Ådahl
aa306ac3ca
Introduce MetaContextMain
...
This object intends to replace the scattered functions that are used to
make up what is effectively a "mutter context". It takes care of the
command line arguments that is now done in main.c, persistant virtual
monitors, and the like.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:25:21 +02:00
Jonas Ådahl
2ac262f138
tests/clutter: Port to MetaContext
...
The clutter tests neeed to start and stop, thus uses their own main loop
instead of the one in MetaContext. Shouldn't matter, since nothing
in mutter should happen that makes the test self-terminate from inside
mutter.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:25:21 +02:00
Jonas Ådahl
2f19a5f28d
context/test: Add 'no-x11' and 'test-client' constructor flags
...
The 'no-x11' one will inhibit Xwayland from starting, and 'test-client'
will make sure the test client path is properly discovered.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:25:21 +02:00
Jonas Ådahl
07384e18c5
clutter: Remove clutter_init_with_args()
...
Not used anymore.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:25:21 +02:00
Jonas Ådahl
2712555c71
display: Don't include sn.h from display-private.h
...
It has some annoying macro requirement to not nag about API stability;
try to limit its exposure.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:25:21 +02:00
Jonas Ådahl
383392f963
tests/stage-view-tests: Port to MetaContext
...
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:25:21 +02:00
Jonas Ådahl
648a8b9861
tests/ref-test-sanity: Port to MetaContext
...
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:25:21 +02:00
Jonas Ådahl
f8465906dd
tests/headless-start: Port to MetaContext
...
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:25:21 +02:00
Jonas Ådahl
fbc00a60cf
tests/headless-start: Stop ignoring the missed frame warnings
...
They don't seem to happen anymore.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:25:21 +02:00
Jonas Ådahl
d6ae8e7873
tests/test-runner: Port to MetaContext
...
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:25:21 +02:00
Jonas Ådahl
54c9ca7d06
monitor-manager/test: Add default fall back initial config
...
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:25:21 +02:00
Jonas Ådahl
f61c1a1be1
context/test: Add 'run-tests' signal that can replace g_test_run()
...
For tests that doesn't use g_test_run().
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:25:21 +02:00
Jonas Ådahl
03242a4e2a
tests/test-runner: Assorted style cleanup
...
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:25:21 +02:00
Jonas Ådahl
e09de6787f
context: Handle dealing with option entries
...
Users can add option entries, and it'll be part of the configuration
phase.
Create the main group manually to be able to set a user_data pointer;
this will be required to not have to rely on globals when parsing
options using a callback.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:25:21 +02:00
Jonas Ådahl
3d2160b473
tests/unit-tests: Port to MetaContext
...
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 11:25:20 +02:00
Jonas Ådahl
ccd8da336f
context/test: Add 'before-tests' and 'after-tests' signals
...
Will be used to set up and tear down test infrastructure.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 10:59:40 +02:00
Jonas Ådahl
bccd93a598
tests/native-headless: Port to MetaContext
...
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 10:59:40 +02:00
Jonas Ådahl
82d9dda08a
context/test: Add helper to run a test session
...
Takes care of setup, starting, running, and terminating, as well as
running the GLib test suite.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 10:59:40 +02:00