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) 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 * 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 * it under the terms of the GNU General Public License as published by
...@@ -41,11 +41,13 @@ gf_backend_native_post_init (GfBackend *backend) ...@@ -41,11 +41,13 @@ gf_backend_native_post_init (GfBackend *backend)
} }
static GfMonitorManager * 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, return g_initable_new (GF_TYPE_MONITOR_MANAGER_KMS,
"backend", backend, NULL, error,
NULL); "backend", backend,
NULL);
} }
static void static void
......
/* /*
* Copyright (C) 2014 Red Hat * 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 * 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 * it under the terms of the GNU General Public License as published by
...@@ -37,9 +37,10 @@ struct _GfBackendClass ...@@ -37,9 +37,10 @@ struct _GfBackendClass
{ {
GObjectClass parent_class; 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); 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 * Copyright (C) 2017 Red Hat
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
...@@ -31,7 +31,8 @@ struct _GfBackendX11Cm ...@@ -31,7 +31,8 @@ struct _GfBackendX11Cm
G_DEFINE_TYPE (GfBackendX11Cm, gf_backend_x11_cm, GF_TYPE_BACKEND_X11) G_DEFINE_TYPE (GfBackendX11Cm, gf_backend_x11_cm, GF_TYPE_BACKEND_X11)
static GfMonitorManager * 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, return g_object_new (GF_TYPE_MONITOR_MANAGER_XRANDR,
"backend", backend, "backend", backend,
......
/* /*
* Copyright (C) 2017 Alberts Muktupāvels * Copyright (C) 2017-2019 Alberts Muktupāvels
* Copyright (C) 2017 Red Hat * Copyright (C) 2017 Red Hat
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
...@@ -31,7 +31,8 @@ struct _GfBackendX11Nested ...@@ -31,7 +31,8 @@ struct _GfBackendX11Nested
G_DEFINE_TYPE (GfBackendX11Nested, gf_backend_x11_nested, GF_TYPE_BACKEND_X11) G_DEFINE_TYPE (GfBackendX11Nested, gf_backend_x11_nested, GF_TYPE_BACKEND_X11)
static GfMonitorManager * 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, return g_object_new (GF_TYPE_MONITOR_MANAGER_DUMMY,
"backend", backend, "backend", backend,
......
/* /*
* Copyright (C) 2014 Red Hat * 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 * 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 * 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, ...@@ -51,7 +51,8 @@ G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GfBackend, gf_backend, G_TYPE_OBJECT,
initable_iface_init)) initable_iface_init))
static GfMonitorManager * static GfMonitorManager *
create_monitor_manager (GfBackend *backend) create_monitor_manager (GfBackend *backend,
GError **error)
{ {
if (g_getenv ("DUMMY_MONITORS")) if (g_getenv ("DUMMY_MONITORS"))
{ {
...@@ -60,7 +61,7 @@ create_monitor_manager (GfBackend *backend) ...@@ -60,7 +61,7 @@ create_monitor_manager (GfBackend *backend)
NULL); NULL);
} }
return GF_BACKEND_GET_CLASS (backend)->create_monitor_manager (backend); return GF_BACKEND_GET_CLASS (backend)->create_monitor_manager (backend, error);
} }
static gboolean static gboolean
...@@ -77,7 +78,9 @@ gf_backend_initable_init (GInitable *initable, ...@@ -77,7 +78,9 @@ gf_backend_initable_init (GInitable *initable,
priv->settings = gf_settings_new (backend); priv->settings = gf_settings_new (backend);
priv->orientation_manager = gf_orientation_manager_new (); 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; return TRUE;
} }
......
/* /*
* Copyright (C) 2013 Red Hat Inc. * 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 * 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 * it under the terms of the GNU General Public License as published by
...@@ -31,7 +31,27 @@ struct _GfMonitorManagerKms ...@@ -31,7 +31,27 @@ struct _GfMonitorManagerKms
GfMonitorManager parent; 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 static void
gf_monitor_manager_kms_read_current (GfMonitorManager *manager) 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