[gnome-flashback] backends: add GfMonitorManager classes
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback] backends: add GfMonitorManager classes
- Date: Sat, 9 Sep 2017 22:18:46 +0000 (UTC)
commit 55e758e2c1fc0f026e63594d807fdb9fe551b4a8
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sun Sep 10 00:25:19 2017 +0300
backends: add GfMonitorManager classes
backends/Makefile.am | 9 ++
backends/gf-backend-native.c | 10 ++
backends/gf-backend-private.h | 5 +-
backends/gf-backend-x11-cm.c | 23 ++++-
backends/gf-backend-x11-nested.c | 13 ++
backends/gf-backend.c | 32 ++++++
backends/gf-backend.h | 6 +-
backends/gf-monitor-manager-dummy-private.h | 38 +++++++
backends/gf-monitor-manager-dummy.c | 46 ++++++++
backends/gf-monitor-manager-kms-private.h | 38 +++++++
backends/gf-monitor-manager-kms.c | 44 ++++++++
backends/gf-monitor-manager-private.h | 59 ++++++++++
backends/gf-monitor-manager-xrandr-private.h | 42 +++++++
backends/gf-monitor-manager-xrandr.c | 53 +++++++++
backends/gf-monitor-manager.c | 153 ++++++++++++++++++++++++++
backends/gf-monitor-manager.h | 33 ++++++
16 files changed, 600 insertions(+), 4 deletions(-)
---
diff --git a/backends/Makefile.am b/backends/Makefile.am
index 4b91b19..50c72ba 100644
--- a/backends/Makefile.am
+++ b/backends/Makefile.am
@@ -31,6 +31,15 @@ libbackends_la_SOURCES = \
gf-backend.h \
gf-edid-parse.c \
gf-edid-private.h \
+ gf-monitor-manager-dummy-private.h \
+ gf-monitor-manager-dummy.c \
+ gf-monitor-manager-kms-private.h \
+ gf-monitor-manager-kms.c \
+ gf-monitor-manager-private.h \
+ gf-monitor-manager-xrandr-private.h \
+ gf-monitor-manager-xrandr.c \
+ gf-monitor-manager.c \
+ gf-monitor-manager.h \
gf-monitor-spec-private.h \
gf-monitor-spec.c \
gf-orientation-manager-private.h \
diff --git a/backends/gf-backend-native.c b/backends/gf-backend-native.c
index 4f1aef0..a1e4591 100644
--- a/backends/gf-backend-native.c
+++ b/backends/gf-backend-native.c
@@ -25,6 +25,7 @@
#include "config.h"
#include "gf-backend-native-private.h"
+#include "gf-monitor-manager-kms-private.h"
struct _GfBackendNative
{
@@ -39,6 +40,14 @@ gf_backend_native_post_init (GfBackend *backend)
GF_BACKEND_CLASS (gf_backend_native_parent_class)->post_init (backend);
}
+static GfMonitorManager *
+gf_backend_native_create_monitor_manager (GfBackend *backend)
+{
+ return g_object_new (GF_TYPE_MONITOR_MANAGER_KMS,
+ "backend", backend,
+ NULL);
+}
+
static void
gf_backend_native_class_init (GfBackendNativeClass *native_class)
{
@@ -47,6 +56,7 @@ gf_backend_native_class_init (GfBackendNativeClass *native_class)
backend_class = GF_BACKEND_CLASS (native_class);
backend_class->post_init = gf_backend_native_post_init;
+ backend_class->create_monitor_manager = gf_backend_native_create_monitor_manager;
}
static void
diff --git a/backends/gf-backend-private.h b/backends/gf-backend-private.h
index 01643b3..af08550 100644
--- a/backends/gf-backend-private.h
+++ b/backends/gf-backend-private.h
@@ -27,6 +27,7 @@
#define GF_BACKEND_PRIVATE_H
#include "gf-backend.h"
+#include "gf-monitor-manager-private.h"
G_BEGIN_DECLS
@@ -34,7 +35,9 @@ struct _GfBackendClass
{
GObjectClass parent_class;
- void (* post_init) (GfBackend *backend);
+ void (* post_init) (GfBackend *backend);
+
+ GfMonitorManager * (* create_monitor_manager) (GfBackend *backend);
};
G_END_DECLS
diff --git a/backends/gf-backend-x11-cm.c b/backends/gf-backend-x11-cm.c
index 876e398..b1017f4 100644
--- a/backends/gf-backend-x11-cm.c
+++ b/backends/gf-backend-x11-cm.c
@@ -21,6 +21,7 @@
#include "config.h"
#include "gf-backend-x11-cm-private.h"
+#include "gf-monitor-manager-xrandr-private.h"
struct _GfBackendX11Cm
{
@@ -29,20 +30,40 @@ 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)
+{
+ return g_object_new (GF_TYPE_MONITOR_MANAGER_XRANDR,
+ "backend", backend,
+ NULL);
+}
+
static gboolean
gf_backend_x11_cm_handle_host_xevent (GfBackendX11 *x11,
XEvent *event)
{
- return FALSE;
+ GfBackend *backend;
+ GfMonitorManager *monitor_manager;
+ GfMonitorManagerXrandr *xrandr;
+
+ backend = GF_BACKEND (x11);
+ monitor_manager = gf_backend_get_monitor_manager (backend);
+ xrandr = GF_MONITOR_MANAGER_XRANDR (monitor_manager);
+
+ return gf_monitor_manager_xrandr_handle_xevent (xrandr, event);
}
static void
gf_backend_x11_cm_class_init (GfBackendX11CmClass *x11_cm_class)
{
+ GfBackendClass *backend_class;
GfBackendX11Class *backend_x11_class;
+ backend_class = GF_BACKEND_CLASS (x11_cm_class);
backend_x11_class = GF_BACKEND_X11_CLASS (x11_cm_class);
+ backend_class->create_monitor_manager = gf_backend_x11_cm_create_monitor_manager;
+
backend_x11_class->handle_host_xevent = gf_backend_x11_cm_handle_host_xevent;
}
diff --git a/backends/gf-backend-x11-nested.c b/backends/gf-backend-x11-nested.c
index a129df3..5622083 100644
--- a/backends/gf-backend-x11-nested.c
+++ b/backends/gf-backend-x11-nested.c
@@ -21,6 +21,7 @@
#include "config.h"
#include "gf-backend-x11-nested-private.h"
+#include "gf-monitor-manager-dummy-private.h"
struct _GfBackendX11Nested
{
@@ -29,6 +30,14 @@ 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)
+{
+ return g_object_new (GF_TYPE_MONITOR_MANAGER_DUMMY,
+ "backend", backend,
+ NULL);
+}
+
static gboolean
gf_backend_x11_nested_handle_host_xevent (GfBackendX11 *x11,
XEvent *event)
@@ -39,10 +48,14 @@ gf_backend_x11_nested_handle_host_xevent (GfBackendX11 *x11,
static void
gf_backend_x11_nested_class_init (GfBackendX11NestedClass *x11_nested_class)
{
+ GfBackendClass *backend_class;
GfBackendX11Class *backend_x11_class;
+ backend_class = GF_BACKEND_CLASS (x11_nested_class);
backend_x11_class = GF_BACKEND_X11_CLASS (x11_nested_class);
+ backend_class->create_monitor_manager = gf_backend_x11_nested_create_monitor_manager;
+
backend_x11_class->handle_host_xevent = gf_backend_x11_nested_handle_host_xevent;
}
diff --git a/backends/gf-backend.c b/backends/gf-backend.c
index b822bf7..ed05f83 100644
--- a/backends/gf-backend.c
+++ b/backends/gf-backend.c
@@ -30,6 +30,7 @@
#include "gf-backend-native-private.h"
#include "gf-backend-x11-cm-private.h"
#include "gf-backend-x11-nested-private.h"
+#include "gf-monitor-manager-dummy-private.h"
#include "gf-orientation-manager-private.h"
#include "gf-settings-private.h"
@@ -37,6 +38,8 @@ typedef struct
{
GfSettings *settings;
GfOrientationManager *orientation_manager;
+
+ GfMonitorManager *monitor_manager;
} GfBackendPrivate;
static void
@@ -47,6 +50,19 @@ G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GfBackend, gf_backend, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
initable_iface_init))
+static GfMonitorManager *
+create_monitor_manager (GfBackend *backend)
+{
+ if (g_getenv ("DUMMY_MONITORS"))
+ {
+ return g_object_new (GF_TYPE_MONITOR_MANAGER_DUMMY,
+ "backend", backend,
+ NULL);
+ }
+
+ return GF_BACKEND_GET_CLASS (backend)->create_monitor_manager (backend);
+}
+
static gboolean
gf_backend_initable_init (GInitable *initable,
GCancellable *cancellable,
@@ -79,6 +95,7 @@ gf_backend_dispose (GObject *object)
backend = GF_BACKEND (object);
priv = gf_backend_get_instance_private (backend);
+ g_clear_object (&priv->monitor_manager);
g_clear_object (&priv->orientation_manager);
g_clear_object (&priv->settings);
@@ -88,6 +105,11 @@ gf_backend_dispose (GObject *object)
static void
gf_backend_real_post_init (GfBackend *backend)
{
+ GfBackendPrivate *priv;
+
+ priv = gf_backend_get_instance_private (backend);
+
+ priv->monitor_manager = create_monitor_manager (backend);
}
static void
@@ -150,3 +172,13 @@ gf_backend_new (GfBackendType type)
return backend;
}
+
+GfMonitorManager *
+gf_backend_get_monitor_manager (GfBackend *backend)
+{
+ GfBackendPrivate *priv;
+
+ priv = gf_backend_get_instance_private (backend);
+
+ return priv->monitor_manager;
+}
diff --git a/backends/gf-backend.h b/backends/gf-backend.h
index a4fda4f..c4d0060 100644
--- a/backends/gf-backend.h
+++ b/backends/gf-backend.h
@@ -26,7 +26,7 @@
#ifndef GF_BACKEND_H
#define GF_BACKEND_H
-#include <glib-object.h>
+#include "gf-monitor-manager.h"
G_BEGIN_DECLS
@@ -40,7 +40,9 @@ typedef enum
GF_BACKEND_TYPE_NATIVE
} GfBackendType;
-GfBackend *gf_backend_new (GfBackendType type);
+GfBackend *gf_backend_new (GfBackendType type);
+
+GfMonitorManager *gf_backend_get_monitor_manager (GfBackend *backend);
G_END_DECLS
diff --git a/backends/gf-monitor-manager-dummy-private.h b/backends/gf-monitor-manager-dummy-private.h
new file mode 100644
index 0000000..e2b481f
--- /dev/null
+++ b/backends/gf-monitor-manager-dummy-private.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2001 Havoc Pennington
+ * Copyright (C) 2003 Rob Adams
+ * Copyright (C) 2004-2006 Elijah Newren
+ * Copyright (C) 2013 Red Hat Inc.
+ * Copyright (C) 2017 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Adapted from mutter:
+ * - src/backends/meta-monitor-manager-dummy.h
+ */
+
+#ifndef GF_MONITOR_MANAGER_DUMMY_PRIVATE_H
+#define GF_MONITOR_MANAGER_DUMMY_PRIVATE_H
+
+#include "gf-monitor-manager-private.h"
+
+G_BEGIN_DECLS
+
+#define GF_TYPE_MONITOR_MANAGER_DUMMY (gf_monitor_manager_dummy_get_type ())
+G_DECLARE_FINAL_TYPE (GfMonitorManagerDummy, gf_monitor_manager_dummy,
+ GF, MONITOR_MANAGER_DUMMY, GfMonitorManager)
+
+G_END_DECLS
+
+#endif
diff --git a/backends/gf-monitor-manager-dummy.c b/backends/gf-monitor-manager-dummy.c
new file mode 100644
index 0000000..df20252
--- /dev/null
+++ b/backends/gf-monitor-manager-dummy.c
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2001, 2002 Havoc Pennington
+ * Copyright (C) 2002, 2003 Red Hat Inc.
+ * Some ICCCM manager selection code derived from fvwm2,
+ * Copyright (C) 2001 Dominik Vogt, Matthias Clasen, and fvwm2 team
+ * Copyright (C) 2003 Rob Adams
+ * Copyright (C) 2004-2006 Elijah Newren
+ * Copyright (C) 2013 Red Hat Inc.
+ * Copyright (C) 2017 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Adapted from mutter:
+ * - src/backends/meta-monitor-manager-dummy.c
+ */
+
+#include "config.h"
+#include "gf-monitor-manager-dummy-private.h"
+
+struct _GfMonitorManagerDummy
+{
+ GfMonitorManager parent;
+};
+
+G_DEFINE_TYPE (GfMonitorManagerDummy, gf_monitor_manager_dummy, GF_TYPE_MONITOR_MANAGER)
+
+static void
+gf_monitor_manager_dummy_class_init (GfMonitorManagerDummyClass *dummy_class)
+{
+}
+
+static void
+gf_monitor_manager_dummy_init (GfMonitorManagerDummy *dummy)
+{
+}
diff --git a/backends/gf-monitor-manager-kms-private.h b/backends/gf-monitor-manager-kms-private.h
new file mode 100644
index 0000000..91c3564
--- /dev/null
+++ b/backends/gf-monitor-manager-kms-private.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2001 Havoc Pennington
+ * Copyright (C) 2003 Rob Adams
+ * Copyright (C) 2004-2006 Elijah Newren
+ * Copyright (C) 2013 Red Hat Inc.
+ * Copyright (C) 2017 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Adapted from mutter:
+ * - src/backends/native/meta-monitor-manager-kms.h
+ */
+
+#ifndef GF_MONITOR_MANAGER_KMS_PRIVATE_H
+#define GF_MONITOR_MANAGER_KMS_PRIVATE_H
+
+#include "gf-monitor-manager-private.h"
+
+G_BEGIN_DECLS
+
+#define GF_TYPE_MONITOR_MANAGER_KMS (gf_monitor_manager_kms_get_type ())
+G_DECLARE_FINAL_TYPE (GfMonitorManagerKms, gf_monitor_manager_kms,
+ GF, MONITOR_MANAGER_KMS, GfMonitorManager)
+
+G_END_DECLS
+
+#endif
diff --git a/backends/gf-monitor-manager-kms.c b/backends/gf-monitor-manager-kms.c
new file mode 100644
index 0000000..024d3ab
--- /dev/null
+++ b/backends/gf-monitor-manager-kms.c
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2013 Red Hat Inc.
+ * Copyright (C) 2017 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Alberts Muktupāvels <alberts muktupavels gmail com>
+ * Giovanni Campagna <gcampagn redhat com>
+ *
+ * Adapted from mutter:
+ * - src/backends/native/meta-monitor-manager-kms.c
+ */
+
+#include "config.h"
+#include "gf-monitor-manager-kms-private.h"
+
+struct _GfMonitorManagerKms
+{
+ GfMonitorManager parent;
+};
+
+G_DEFINE_TYPE (GfMonitorManagerKms, gf_monitor_manager_kms, GF_TYPE_MONITOR_MANAGER)
+
+static void
+gf_monitor_manager_kms_class_init (GfMonitorManagerKmsClass *kms_class)
+{
+}
+
+static void
+gf_monitor_manager_kms_init (GfMonitorManagerKms *kms)
+{
+}
diff --git a/backends/gf-monitor-manager-private.h b/backends/gf-monitor-manager-private.h
new file mode 100644
index 0000000..d5b052b
--- /dev/null
+++ b/backends/gf-monitor-manager-private.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2001 Havoc Pennington
+ * Copyright (C) 2003 Rob Adams
+ * Copyright (C) 2004-2006 Elijah Newren
+ * Copyright (C) 2013 Red Hat Inc.
+ * Copyright (C) 2017 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Adapted from mutter:
+ * - src/backends/meta-monitor-manager-private.h
+ */
+
+#ifndef GF_MONITOR_MANAGER_PRIVATE_H
+#define GF_MONITOR_MANAGER_PRIVATE_H
+
+#include "gf-backend-private.h"
+#include "gf-dbus-display-config.h"
+#include "gf-monitor-manager.h"
+
+G_BEGIN_DECLS
+
+typedef struct _GfMonitorManagerClass GfMonitorManagerClass;
+
+#define GF_TYPE_MONITOR_MANAGER (gf_monitor_manager_get_type ())
+#define GF_MONITOR_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GF_TYPE_MONITOR_MANAGER,
GfMonitorManager))
+#define GF_MONITOR_MANAGER_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GF_TYPE_MONITOR_MANAGER,
GfMonitorManagerClass))
+#define GF_IS_MONITOR_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GF_TYPE_MONITOR_MANAGER))
+#define GF_IS_MONITOR_MANAGER_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GF_TYPE_MONITOR_MANAGER))
+#define GF_MONITOR_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GF_TYPE_MONITOR_MANAGER,
GfMonitorManagerClass))
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GfMonitorManager, g_object_unref)
+
+struct _GfMonitorManager
+{
+ GfDBusDisplayConfigSkeleton parent;
+};
+
+struct _GfMonitorManagerClass
+{
+ GfDBusDisplayConfigSkeletonClass parent_class;
+};
+
+GType gf_monitor_manager_get_type (void);
+
+G_END_DECLS
+
+#endif
diff --git a/backends/gf-monitor-manager-xrandr-private.h b/backends/gf-monitor-manager-xrandr-private.h
new file mode 100644
index 0000000..b6d93a0
--- /dev/null
+++ b/backends/gf-monitor-manager-xrandr-private.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2001 Havoc Pennington
+ * Copyright (C) 2003 Rob Adams
+ * Copyright (C) 2004-2006 Elijah Newren
+ * Copyright (C) 2013 Red Hat Inc.
+ * Copyright (C) 2017 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Adapted from mutter:
+ * - src/backends/x11/meta-monitor-manager-xrandr.h
+ */
+
+#ifndef GF_MONITOR_MANAGER_XRANDR_PRIVATE_H
+#define GF_MONITOR_MANAGER_XRANDR_PRIVATE_H
+
+#include <X11/Xlib.h>
+#include "gf-monitor-manager-private.h"
+
+G_BEGIN_DECLS
+
+#define GF_TYPE_MONITOR_MANAGER_XRANDR (gf_monitor_manager_xrandr_get_type ())
+G_DECLARE_FINAL_TYPE (GfMonitorManagerXrandr, gf_monitor_manager_xrandr,
+ GF, MONITOR_MANAGER_XRANDR, GfMonitorManager)
+
+gboolean gf_monitor_manager_xrandr_handle_xevent (GfMonitorManagerXrandr *xrandr,
+ XEvent *event);
+
+G_END_DECLS
+
+#endif
diff --git a/backends/gf-monitor-manager-xrandr.c b/backends/gf-monitor-manager-xrandr.c
new file mode 100644
index 0000000..ca464a5
--- /dev/null
+++ b/backends/gf-monitor-manager-xrandr.c
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2001, 2002 Havoc Pennington
+ * Copyright (C) 2002, 2003 Red Hat Inc.
+ * Some ICCCM manager selection code derived from fvwm2,
+ * Copyright (C) 2001 Dominik Vogt, Matthias Clasen, and fvwm2 team
+ * Copyright (C) 2003 Rob Adams
+ * Copyright (C) 2004-2006 Elijah Newren
+ * Copyright (C) 2013 Red Hat Inc.
+ * Copyright (C) 2017 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Adapted from mutter:
+ * - src/backends/x11/meta-monitor-manager-xrandr.c
+ */
+
+#include "config.h"
+#include "gf-monitor-manager-xrandr-private.h"
+
+struct _GfMonitorManagerXrandr
+{
+ GfMonitorManager parent;
+};
+
+G_DEFINE_TYPE (GfMonitorManagerXrandr, gf_monitor_manager_xrandr, GF_TYPE_MONITOR_MANAGER)
+
+static void
+gf_monitor_manager_xrandr_class_init (GfMonitorManagerXrandrClass *xrandr_class)
+{
+}
+
+static void
+gf_monitor_manager_xrandr_init (GfMonitorManagerXrandr *xrandr)
+{
+}
+
+gboolean
+gf_monitor_manager_xrandr_handle_xevent (GfMonitorManagerXrandr *xrandr,
+ XEvent *event)
+{
+ return FALSE;
+}
diff --git a/backends/gf-monitor-manager.c b/backends/gf-monitor-manager.c
new file mode 100644
index 0000000..f3989b7
--- /dev/null
+++ b/backends/gf-monitor-manager.c
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 2001, 2002 Havoc Pennington
+ * Copyright (C) 2002, 2003 Red Hat Inc.
+ * Some ICCCM manager selection code derived from fvwm2,
+ * Copyright (C) 2001 Dominik Vogt, Matthias Clasen, and fvwm2 team
+ * Copyright (C) 2003 Rob Adams
+ * Copyright (C) 2004-2006 Elijah Newren
+ * Copyright (C) 2013 Red Hat Inc.
+ * Copyright (C) 2017 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Adapted from mutter:
+ * - src/backends/meta-monitor-manager.c
+ */
+
+#include "config.h"
+#include "gf-monitor-manager-private.h"
+
+typedef struct
+{
+ GfBackend *backend;
+} GfMonitorManagerPrivate;
+
+enum
+{
+ PROP_0,
+
+ PROP_BACKEND,
+
+ LAST_PROP
+};
+
+static GParamSpec *manager_properties[LAST_PROP] = { NULL };
+
+static void gf_monitor_manager_display_config_init (GfDBusDisplayConfigIface *iface);
+
+G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GfMonitorManager, gf_monitor_manager, GF_DBUS_TYPE_DISPLAY_CONFIG_SKELETON,
+ G_ADD_PRIVATE (GfMonitorManager)
+ G_IMPLEMENT_INTERFACE (GF_DBUS_TYPE_DISPLAY_CONFIG,
gf_monitor_manager_display_config_init))
+
+static void
+gf_monitor_manager_display_config_init (GfDBusDisplayConfigIface *iface)
+{
+}
+
+static void
+gf_monitor_manager_dispose (GObject *object)
+{
+ GfMonitorManager *manager;
+ GfMonitorManagerPrivate *priv;
+
+ manager = GF_MONITOR_MANAGER (object);
+ priv = gf_monitor_manager_get_instance_private (manager);
+
+ priv->backend = NULL;
+
+ G_OBJECT_CLASS (gf_monitor_manager_parent_class)->dispose (object);
+}
+
+static void
+gf_monitor_manager_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GfMonitorManager *manager;
+ GfMonitorManagerPrivate *priv;
+
+ manager = GF_MONITOR_MANAGER (object);
+ priv = gf_monitor_manager_get_instance_private (manager);
+
+ switch (property_id)
+ {
+ case PROP_BACKEND:
+ g_value_set_object (value, priv->backend);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gf_monitor_manager_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GfMonitorManager *manager;
+ GfMonitorManagerPrivate *priv;
+
+ manager = GF_MONITOR_MANAGER (object);
+ priv = gf_monitor_manager_get_instance_private (manager);
+
+ switch (property_id)
+ {
+ case PROP_BACKEND:
+ priv->backend = g_value_get_object (value);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gf_monitor_manager_install_properties (GObjectClass *object_class)
+{
+ manager_properties[PROP_BACKEND] =
+ g_param_spec_object ("backend",
+ "GfBackend",
+ "GfBackend",
+ GF_TYPE_BACKEND,
+ G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, LAST_PROP,
+ manager_properties);
+}
+
+static void
+gf_monitor_manager_class_init (GfMonitorManagerClass *manager_class)
+{
+ GObjectClass *object_class;
+
+ object_class = G_OBJECT_CLASS (manager_class);
+
+ object_class->dispose = gf_monitor_manager_dispose;
+ object_class->get_property = gf_monitor_manager_get_property;
+ object_class->set_property = gf_monitor_manager_set_property;
+
+ gf_monitor_manager_install_properties (object_class);
+}
+
+static void
+gf_monitor_manager_init (GfMonitorManager *manager)
+{
+}
diff --git a/backends/gf-monitor-manager.h b/backends/gf-monitor-manager.h
new file mode 100644
index 0000000..9c7ac64
--- /dev/null
+++ b/backends/gf-monitor-manager.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2015 Red Hat
+ * Copyright (C) 2017 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Adapted from mutter:
+ * - src/meta/meta-monitor-manager.h
+ */
+
+#ifndef GF_MONITOR_MANAGER_H
+#define GF_MONITOR_MANAGER_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GfMonitorManager GfMonitorManager;
+
+G_END_DECLS
+
+#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]