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
Jonas Ådahl
6732e3e585
main: Temporarily tie meta_quit() to meta_context_terminate*()
...
Makes it possible for mutter internally to use meta_quit() both if we're
running using a MetaContext or the scattered functions.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 10:59:40 +02:00
Jonas Ådahl
2e784e23a2
context: Add 'notify_ready()' vfunc and method
...
This intends to replace the call to `meta_register_with_session()` that
deals with X11 session management, and is called when the user is
"ready". In thet test context, doing that makes no sense, so make it a
no-op.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 10:59:40 +02:00
Jonas Ådahl
4cd1154b3d
context/test: Respect MUTTER_SYNC envvar
...
It just calls meta_set_syncing() accordingly. Is currently done by
meta_init() either when the env var is set, or when a command line
argument is passed.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 10:59:40 +02:00
Jonas Ådahl
fddc631599
context/test: Enable 'scale-monitor-framebuffer' backend setting
...
This is done in all tests, so make life easier by doing it here.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 10:59:40 +02:00
Jonas Ådahl
8bf7d5c155
context: Init debug utils during setup phase
...
Is currently done during meta_init().
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 10:59:40 +02:00
Jonas Ådahl
ecc40e7b23
context: Init introspection paths during setup
...
This is currently done during meta_init().
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 10:59:40 +02:00
Jonas Ådahl
a32b005848
context: Change to home directory during setup
...
Is currently done during meta_init().
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 10:59:40 +02:00
Jonas Ådahl
6f4b973329
context: Initialize signal handlers during setup
...
Is currently done during meta_init().
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 10:59:40 +02:00
Jonas Ådahl
8ace1bf3ea
context: Init prefs when starting
...
Is currently done by meta_start().
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 10:59:40 +02:00
Jonas Ådahl
02176eab83
context: Add start/run/terminate phases
...
The start phase creates the MetaDisplay object, and initializes Wayland, and
creates the main loop.
The run phase runs the main loop and handles returning an error if the
context was terminated with an error.
The terminate phase terminates the main loop, with or without an error.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 10:59:40 +02:00
Jonas Ådahl
fe652518af
context: Load plugin during setup phase
...
The plugin must be configured by the context implementation during the
configure phase.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861 >
2021-07-15 10:59:40 +02:00