Make VT switch API explicitly part of the native backend

It already was, more or less, but make it a bit more in your face.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
This commit is contained in:
Jonas Ådahl 2022-05-27 19:55:16 +02:00 committed by Marge Bot
parent 872420f460
commit c45ab10c0e
3 changed files with 12 additions and 7 deletions

View File

@ -916,13 +916,13 @@ meta_backend_native_get_kms (MetaBackendNative *native)
} }
gboolean gboolean
meta_activate_vt (int vt, GError **error) meta_backend_native_activate_vt (MetaBackendNative *backend_native,
int vt,
GError **error)
{ {
MetaBackend *backend = meta_get_backend (); MetaLauncher *launcher = meta_backend_native_get_launcher (backend_native);
MetaBackendNative *native = META_BACKEND_NATIVE (backend);
MetaLauncher *launcher = meta_backend_native_get_launcher (native);
switch (native->mode) switch (backend_native->mode)
{ {
case META_BACKEND_NATIVE_MODE_DEFAULT: case META_BACKEND_NATIVE_MODE_DEFAULT:
return meta_launcher_activate_vt (launcher, vt, error); return meta_launcher_activate_vt (launcher, vt, error);

View File

@ -38,7 +38,9 @@ META_EXPORT_TEST
G_DECLARE_FINAL_TYPE (MetaBackendNative, meta_backend_native, G_DECLARE_FINAL_TYPE (MetaBackendNative, meta_backend_native,
META, BACKEND_NATIVE, MetaBackend) META, BACKEND_NATIVE, MetaBackend)
gboolean meta_activate_vt (int vt, GError **error); gboolean meta_backend_native_activate_vt (MetaBackendNative *backend_native,
int vt,
GError **error);
void meta_backend_native_pause (MetaBackendNative *backend_native); void meta_backend_native_pause (MetaBackendNative *backend_native);

View File

@ -3573,10 +3573,13 @@ handle_switch_vt (MetaDisplay *display,
MetaKeyBinding *binding, MetaKeyBinding *binding,
gpointer dummy) gpointer dummy)
{ {
MetaContext *context = meta_display_get_context (display);
MetaBackend *backend = meta_context_get_backend (context);
gint vt = binding->handler->data; gint vt = binding->handler->data;
GError *error = NULL; GError *error = NULL;
if (!meta_activate_vt (vt, &error)) if (!meta_backend_native_activate_vt (META_BACKEND_NATIVE (backend),
vt, &error))
{ {
g_warning ("Failed to switch VT: %s", error->message); g_warning ("Failed to switch VT: %s", error->message);
g_error_free (error); g_error_free (error);