core/debug-control: Introspect it to export the dbus service with lg
by executing `global.context.get_debug_control().exported = true`. This makes it possible to get access to the debug service without having to start with `--enable-debug`. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3902>
This commit is contained in:
parent
c974bcf4b2
commit
682935fefa
12 changed files with 89 additions and 24 deletions
|
@ -55,6 +55,7 @@
|
|||
#include "backends/meta-output.h"
|
||||
#include "backends/meta-virtual-monitor.h"
|
||||
#include "clutter/clutter.h"
|
||||
#include "core/meta-debug-control-private.h"
|
||||
#include "core/util-private.h"
|
||||
#include "meta/main.h"
|
||||
#include "meta/meta-enum-types.h"
|
||||
|
|
|
@ -70,6 +70,7 @@
|
|||
#include "common/meta-cogl-drm-formats.h"
|
||||
#include "common/meta-drm-format-helpers.h"
|
||||
#include "core/boxes-private.h"
|
||||
#include "core/meta-debug-control-private.h"
|
||||
|
||||
#ifdef HAVE_EGL_DEVICE
|
||||
#include "backends/native/meta-render-device-egl-stream.h"
|
||||
|
|
|
@ -313,7 +313,7 @@ meta_context_main_configure (MetaContext *context,
|
|||
{
|
||||
MetaDebugControl *debug_control = meta_context_get_debug_control (context);
|
||||
|
||||
meta_debug_control_export (debug_control);
|
||||
meta_debug_control_set_exported (debug_control, TRUE);
|
||||
}
|
||||
|
||||
g_unsetenv ("DESKTOP_AUTOSTART_ID");
|
||||
|
|
|
@ -18,12 +18,12 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "core/meta-debug-control.h"
|
||||
#include "core/meta-private-enums.h"
|
||||
#include "core/meta-service-channel.h"
|
||||
#include "core/util-private.h"
|
||||
#include "meta/meta-backend.h"
|
||||
#include "meta/meta-context.h"
|
||||
#include "meta/meta-debug-control.h"
|
||||
#include "wayland/meta-wayland-types.h"
|
||||
|
||||
#ifdef HAVE_PROFILER
|
||||
|
@ -84,5 +84,3 @@ meta_context_get_profiler (MetaContext *context);
|
|||
void meta_context_set_trace_file (MetaContext *context,
|
||||
const char *trace_file);
|
||||
#endif
|
||||
|
||||
MetaDebugControl * meta_context_get_debug_control (MetaContext *context);
|
||||
|
|
|
@ -884,6 +884,12 @@ meta_context_init (MetaContext *context)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_context_get_debug_control:
|
||||
* @context: The #MetaContext
|
||||
*
|
||||
* Returns: (transfer none): the #MetaDebugControl
|
||||
*/
|
||||
MetaDebugControl *
|
||||
meta_context_get_debug_control (MetaContext *context)
|
||||
{
|
||||
|
|
25
src/core/meta-debug-control-private.h
Normal file
25
src/core/meta-debug-control-private.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright (C) 2023 Red Hat
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "meta/meta-debug-control.h"
|
||||
|
||||
gboolean meta_debug_control_is_linear_blending_forced (MetaDebugControl *debug_control);
|
||||
|
||||
gboolean meta_debug_control_is_hdr_enabled (MetaDebugControl *debug_control);
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "core/meta-debug-control.h"
|
||||
#include "core/meta-debug-control-private.h"
|
||||
|
||||
#include "core/util-private.h"
|
||||
#include "meta/meta-backend.h"
|
||||
|
@ -29,6 +29,7 @@ enum
|
|||
PROP_0,
|
||||
|
||||
PROP_CONTEXT,
|
||||
PROP_EXPORTED,
|
||||
|
||||
N_PROPS
|
||||
};
|
||||
|
@ -43,6 +44,7 @@ struct _MetaDebugControl
|
|||
MetaDBusDebugControlSkeleton parent;
|
||||
|
||||
MetaContext *context;
|
||||
gboolean exported;
|
||||
|
||||
guint dbus_name_id;
|
||||
};
|
||||
|
@ -107,6 +109,10 @@ meta_debug_control_set_property (GObject *object,
|
|||
case PROP_CONTEXT:
|
||||
debug_control->context = g_value_get_object (value);
|
||||
break;
|
||||
case PROP_EXPORTED:
|
||||
meta_debug_control_set_exported (debug_control,
|
||||
g_value_get_boolean (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -126,6 +132,9 @@ meta_debug_control_get_property (GObject *object,
|
|||
case PROP_CONTEXT:
|
||||
g_value_set_object (value, debug_control->context);
|
||||
break;
|
||||
case PROP_EXPORTED:
|
||||
g_value_set_boolean (value, debug_control->exported);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -146,6 +155,11 @@ meta_debug_control_class_init (MetaDebugControlClass *klass)
|
|||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
obj_props[PROP_EXPORTED] = g_param_spec_boolean ("exported", NULL, NULL,
|
||||
FALSE,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_EXPLICIT_NOTIFY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
g_object_class_install_properties (object_class, N_PROPS, obj_props);
|
||||
}
|
||||
|
||||
|
@ -184,15 +198,29 @@ meta_debug_control_is_hdr_enabled (MetaDebugControl *debug_control)
|
|||
}
|
||||
|
||||
void
|
||||
meta_debug_control_export (MetaDebugControl *debug_control)
|
||||
meta_debug_control_set_exported (MetaDebugControl *debug_control,
|
||||
gboolean exported)
|
||||
{
|
||||
debug_control->dbus_name_id =
|
||||
g_bus_own_name (G_BUS_TYPE_SESSION,
|
||||
META_DEBUG_CONTROL_DBUS_SERVICE,
|
||||
G_BUS_NAME_OWNER_FLAGS_NONE,
|
||||
on_bus_acquired,
|
||||
NULL,
|
||||
NULL,
|
||||
debug_control,
|
||||
NULL);
|
||||
if (debug_control->exported == exported)
|
||||
return;
|
||||
|
||||
if (exported)
|
||||
{
|
||||
debug_control->dbus_name_id =
|
||||
g_bus_own_name (G_BUS_TYPE_SESSION,
|
||||
META_DEBUG_CONTROL_DBUS_SERVICE,
|
||||
G_BUS_NAME_OWNER_FLAGS_NONE,
|
||||
on_bus_acquired,
|
||||
NULL,
|
||||
NULL,
|
||||
debug_control,
|
||||
NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_clear_handle_id (&debug_control->dbus_name_id, g_bus_unown_name);
|
||||
}
|
||||
|
||||
debug_control->exported = exported;
|
||||
g_object_notify_by_pspec (G_OBJECT (debug_control), obj_props[PROP_EXPORTED]);
|
||||
}
|
||||
|
|
|
@ -362,7 +362,7 @@ mutter_sources = [
|
|||
'core/meta-context-private.h',
|
||||
'core/meta-context.c',
|
||||
'core/meta-debug-control.c',
|
||||
'core/meta-debug-control.h',
|
||||
'core/meta-debug-control-private.h',
|
||||
'core/meta-fraction.c',
|
||||
'core/meta-fraction.h',
|
||||
'core/meta-gesture-tracker.c',
|
||||
|
|
|
@ -18,6 +18,7 @@ mutter_public_headers = [
|
|||
'meta-cursor-tracker.h',
|
||||
'meta-context.h',
|
||||
'meta-debug.h',
|
||||
'meta-debug-control.h',
|
||||
'meta-dnd.h',
|
||||
'meta-enums.h',
|
||||
'meta-idle-monitor.h',
|
||||
|
|
|
@ -101,3 +101,6 @@ gboolean meta_context_raise_rlimit_nofile (MetaContext *context,
|
|||
META_EXPORT
|
||||
gboolean meta_context_restore_rlimit_nofile (MetaContext *context,
|
||||
GError **error);
|
||||
|
||||
META_EXPORT
|
||||
MetaDebugControl * meta_context_get_debug_control (MetaContext *context);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2023 Red Hat
|
||||
* Copyright (C) 2024 Red Hat
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -18,18 +18,19 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "meta-dbus-debug-control.h"
|
||||
|
||||
#include "clutter/clutter.h"
|
||||
#include "meta/meta-base.h"
|
||||
|
||||
#define META_TYPE_DEBUG_CONTROL (meta_debug_control_get_type ())
|
||||
META_EXPORT
|
||||
G_DECLARE_FINAL_TYPE (MetaDebugControl,
|
||||
meta_debug_control,
|
||||
META, DEBUG_CONTROL,
|
||||
MetaDBusDebugControlSkeleton)
|
||||
|
||||
gboolean meta_debug_control_is_linear_blending_forced (MetaDebugControl *debug_control);
|
||||
|
||||
gboolean meta_debug_control_is_hdr_enabled (MetaDebugControl *debug_control);
|
||||
|
||||
void meta_debug_control_export (MetaDebugControl *debug_control);
|
||||
META_EXPORT
|
||||
void meta_debug_control_set_exported (MetaDebugControl *debug_control,
|
||||
gboolean exported);
|
|
@ -34,4 +34,5 @@ typedef struct _MetaDnd MetaDnd;
|
|||
typedef struct _MetaSettings MetaSettings;
|
||||
|
||||
typedef struct _MetaWorkspaceManager MetaWorkspaceManager;
|
||||
typedef struct _MetaSelection MetaSelection;
|
||||
typedef struct _MetaSelection MetaSelection;
|
||||
typedef struct _MetaDebugControl MetaDebugControl;
|
||||
|
|
Loading…
Reference in a new issue