backends/eis: Hook eis into the debug system

To be enabled with MUTTER_DEBUG=eis

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2628>
This commit is contained in:
Peter Hutterer 2021-08-18 10:41:33 +10:00 committed by Carlos Garnacho
parent a20aa28af0
commit a6d406d7bf
3 changed files with 33 additions and 0 deletions

View File

@ -27,6 +27,7 @@
#include "backends/meta-eis.h"
#include "backends/meta-eis-client.h"
#include "clutter/clutter-mutter.h"
#include "meta/util.h"
typedef struct _MetaEventSource MetaEventSource;
@ -214,6 +215,30 @@ static GSourceFuncs eis_event_funcs = {
NULL
};
static void
eis_logger (struct eis *eis,
enum eis_log_priority priority,
const char *message,
struct eis_log_context *ctx)
{
switch (priority)
{
case EIS_LOG_PRIORITY_DEBUG:
meta_topic (META_DEBUG_EIS, "%s", message);
break;
case EIS_LOG_PRIORITY_WARNING:
g_warning ("%s", message);
break;
case EIS_LOG_PRIORITY_ERROR:
g_error ("%s", message);
break;
case EIS_LOG_PRIORITY_INFO:
default:
g_info ("%s", message);
break;
}
}
static int
try_and_find_free_eis_socket (MetaEis *meta_eis)
{
@ -254,6 +279,9 @@ meta_eis_new (MetaBackend *backend)
return NULL;
}
eis_log_set_handler (meta_eis->eis, eis_logger);
eis_log_set_priority (meta_eis->eis, EIS_LOG_PRIORITY_DEBUG);
fd = eis_get_fd (meta_eis->eis);
meta_eis->event_source = meta_event_source_new (meta_eis, fd, &eis_event_funcs);

View File

@ -68,6 +68,7 @@ static const GDebugKey meta_debug_keys[] = {
{ "render", META_DEBUG_RENDER },
{ "color", META_DEBUG_COLOR },
{ "input-events", META_DEBUG_INPUT_EVENTS },
{ "eis", META_DEBUG_EIS },
};
static gint verbose_topics = 0;
@ -323,6 +324,8 @@ meta_topic_to_string (MetaDebugTopic topic)
return "VERBOSE";
case META_DEBUG_INPUT_EVENTS:
return "INPUT_EVENTS";
case META_DEBUG_EIS:
return "EIS";
}
return "WM";

View File

@ -76,6 +76,7 @@ void meta_fatal (const char *format,
* @META_DEBUG_RENDER: native backend rendering
* @META_DEBUG_COLOR: color management
* @META_DEBUG_INPUT_EVENTS: input events
* @META_DEBUG_EIS: eis state
*/
typedef enum
{
@ -108,6 +109,7 @@ typedef enum
META_DEBUG_RENDER = 1 << 25,
META_DEBUG_COLOR = 1 << 26,
META_DEBUG_INPUT_EVENTS = 1 << 27,
META_DEBUG_EIS = 1 << 28,
} MetaDebugTopic;
/**