Commit ec25e0d7 authored by Alberts Muktupāvels's avatar Alberts Muktupāvels

backends: add GError parameter to create_monitor_manager

Based on mutter commit:
mutter@16a6aef5
parent 768d1411
/*
* Copyright (C) 2014 Red Hat
* Copyright (C) 2017 Alberts Muktupāvels
* Copyright (C) 2017-2019 Alberts Muktupāvels
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -41,11 +41,13 @@ gf_backend_native_post_init (GfBackend *backend)
}
static GfMonitorManager *
gf_backend_native_create_monitor_manager (GfBackend *backend)
gf_backend_native_create_monitor_manager (GfBackend *backend,
GError **error)
{
return g_object_new (GF_TYPE_MONITOR_MANAGER_KMS,
"backend", backend,
NULL);
return g_initable_new (GF_TYPE_MONITOR_MANAGER_KMS,
NULL, error,
"backend", backend,
NULL);
}
static void
......
/*
* Copyright (C) 2014 Red Hat
* Copyright (C) 2017 Alberts Muktupāvels
* Copyright (C) 2017-2019 Alberts Muktupāvels
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -37,9 +37,10 @@ struct _GfBackendClass
{
GObjectClass parent_class;
void (* post_init) (GfBackend *backend);
void (* post_init) (GfBackend *backend);
GfMonitorManager * (* create_monitor_manager) (GfBackend *backend);
GfMonitorManager * (* create_monitor_manager) (GfBackend *backend,
GError **error);
};
GfOrientationManager *gf_backend_get_orientation_manager (GfBackend *backend);
......
/*
* Copyright (C) 2017 Alberts Muktupāvels
* Copyright (C) 2017-2019 Alberts Muktupāvels
* Copyright (C) 2017 Red Hat
*
* This program is free software: you can redistribute it and/or modify
......@@ -31,7 +31,8 @@ struct _GfBackendX11Cm
G_DEFINE_TYPE (GfBackendX11Cm, gf_backend_x11_cm, GF_TYPE_BACKEND_X11)
static GfMonitorManager *
gf_backend_x11_cm_create_monitor_manager (GfBackend *backend)
gf_backend_x11_cm_create_monitor_manager (GfBackend *backend,
GError **error)
{
return g_object_new (GF_TYPE_MONITOR_MANAGER_XRANDR,
"backend", backend,
......
/*
* Copyright (C) 2017 Alberts Muktupāvels
* Copyright (C) 2017-2019 Alberts Muktupāvels
* Copyright (C) 2017 Red Hat
*
* This program is free software: you can redistribute it and/or modify
......@@ -31,7 +31,8 @@ struct _GfBackendX11Nested
G_DEFINE_TYPE (GfBackendX11Nested, gf_backend_x11_nested, GF_TYPE_BACKEND_X11)
static GfMonitorManager *
gf_backend_x11_nested_create_monitor_manager (GfBackend *backend)
gf_backend_x11_nested_create_monitor_manager (GfBackend *backend,
GError **error)
{
return g_object_new (GF_TYPE_MONITOR_MANAGER_DUMMY,
"backend", backend,
......
/*
* Copyright (C) 2014 Red Hat
* Copyright (C) 2017 Alberts Muktupāvels
* Copyright (C) 2017-2019 Alberts Muktupāvels
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -51,7 +51,8 @@ G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GfBackend, gf_backend, G_TYPE_OBJECT,
initable_iface_init))
static GfMonitorManager *
create_monitor_manager (GfBackend *backend)
create_monitor_manager (GfBackend *backend,
GError **error)
{
if (g_getenv ("DUMMY_MONITORS"))
{
......@@ -60,7 +61,7 @@ create_monitor_manager (GfBackend *backend)
NULL);
}
return GF_BACKEND_GET_CLASS (backend)->create_monitor_manager (backend);
return GF_BACKEND_GET_CLASS (backend)->create_monitor_manager (backend, error);
}
static gboolean
......@@ -77,7 +78,9 @@ gf_backend_initable_init (GInitable *initable,
priv->settings = gf_settings_new (backend);
priv->orientation_manager = gf_orientation_manager_new ();
priv->monitor_manager = create_monitor_manager (backend);
priv->monitor_manager = create_monitor_manager (backend, error);
if (!priv->monitor_manager)
return FALSE;
return TRUE;
}
......
/*
* Copyright (C) 2013 Red Hat Inc.
* Copyright (C) 2017 Alberts Muktupāvels
* Copyright (C) 2017-2019 Alberts Muktupāvels
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -31,7 +31,27 @@ struct _GfMonitorManagerKms
GfMonitorManager parent;
};
G_DEFINE_TYPE (GfMonitorManagerKms, gf_monitor_manager_kms, GF_TYPE_MONITOR_MANAGER)
static void
initable_iface_init (GInitableIface *initable_iface);
G_DEFINE_TYPE_WITH_CODE (GfMonitorManagerKms, gf_monitor_manager_kms,
GF_TYPE_MONITOR_MANAGER,
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
initable_iface_init))
static gboolean
gf_monitor_manager_kms_initable_init (GInitable *initable,
GCancellable *cancellable,
GError **error)
{
return TRUE;
}
static void
initable_iface_init (GInitableIface *initable_iface)
{
initable_iface->init = gf_monitor_manager_kms_initable_init;
}
static void
gf_monitor_manager_kms_read_current (GfMonitorManager *manager)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment