[mutter] Turn MetaLogicalMonitor into a GObject
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] Turn MetaLogicalMonitor into a GObject
- Date: Wed, 25 Jan 2017 08:32:28 +0000 (UTC)
commit 6de3e4a07ec2460c8caffa08970b0affb54c67cc
Author: Jonas Ådahl <jadahl gmail com>
Date: Fri Dec 2 16:08:59 2016 +0800
Turn MetaLogicalMonitor into a GObject
This will make it easier to move various manually managed data and data
now in MetaLogicalMonitor into GObject QData fields.
https://bugzilla.gnome.org/show_bug.cgi?id=777732
src/backends/meta-monitor-manager-private.h | 7 +++++++
src/backends/meta-monitor-manager.c | 22 ++++++++++++++++++----
2 files changed, 25 insertions(+), 4 deletions(-)
---
diff --git a/src/backends/meta-monitor-manager-private.h b/src/backends/meta-monitor-manager-private.h
index 3c3565e..5bc454a 100644
--- a/src/backends/meta-monitor-manager-private.h
+++ b/src/backends/meta-monitor-manager-private.h
@@ -59,6 +59,11 @@ typedef struct _MetaCRTCInfo MetaCRTCInfo;
typedef struct _MetaOutputInfo MetaOutputInfo;
typedef struct _MetaTileInfo MetaTileInfo;
+#define META_TYPE_LOGICAL_MONITOR (meta_logical_monitor_get_type ())
+G_DECLARE_FINAL_TYPE (MetaLogicalMonitor, meta_logical_monitor,
+ META, LOGICAL_MONITOR,
+ GObject)
+
typedef enum {
META_MONITOR_TRANSFORM_NORMAL,
META_MONITOR_TRANSFORM_90,
@@ -208,6 +213,8 @@ struct _MetaMonitorMode
*/
struct _MetaLogicalMonitor
{
+ GObject parent;
+
int number;
int xinerama_index;
MetaRectangle rect;
diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c
index 9d473e3..2aacb9d 100644
--- a/src/backends/meta-monitor-manager.c
+++ b/src/backends/meta-monitor-manager.c
@@ -40,6 +40,8 @@
#include "backends/x11/meta-monitor-manager-xrandr.h"
#include "meta-backend-private.h"
+G_DEFINE_TYPE (MetaLogicalMonitor, meta_logical_monitor, G_TYPE_OBJECT)
+
enum {
CONFIRM_DISPLAY_CHANGE,
SIGNALS_LAST
@@ -138,7 +140,7 @@ construct_tile_monitor (MetaMonitorManager *manager,
{
MetaLogicalMonitor *logical_monitor = NULL;
- logical_monitor = g_new0 (MetaLogicalMonitor, 1);
+ logical_monitor = g_object_new (META_TYPE_LOGICAL_MONITOR, NULL);
logical_monitor->tile_group_id = output->tile_info.group_id;
logical_monitor->refresh_rate = output->crtc->current_mode->refresh_rate;
@@ -226,7 +228,9 @@ make_logical_config (MetaMonitorManager *manager)
if (crtc->logical_monitor == NULL)
{
- MetaLogicalMonitor *logical_monitor = g_new0 (MetaLogicalMonitor, 1);
+ MetaLogicalMonitor *logical_monitor;
+
+ logical_monitor = g_object_new (META_TYPE_LOGICAL_MONITOR, NULL);
logical_monitor->number = monitor_number;
logical_monitor->rect = crtc->rect;
@@ -452,7 +456,7 @@ meta_monitor_manager_finalize (GObject *object)
meta_monitor_manager_free_output_array (manager->outputs, manager->n_outputs);
meta_monitor_manager_free_mode_array (manager->modes, manager->n_modes);
meta_monitor_manager_free_crtc_array (manager->crtcs, manager->n_crtcs);
- g_list_free_full (manager->logical_monitors, g_free);
+ g_list_free_full (manager->logical_monitors, g_object_unref);
G_OBJECT_CLASS (meta_monitor_manager_parent_class)->finalize (object);
}
@@ -1573,7 +1577,7 @@ meta_monitor_manager_rebuild_derived (MetaMonitorManager *manager)
g_signal_emit_by_name (manager, "monitors-changed");
- g_list_free_full (old_logical_monitors, g_free);
+ g_list_free_full (old_logical_monitors, g_object_unref);
}
void
@@ -1751,3 +1755,13 @@ meta_monitor_manager_get_is_builtin_display_on (MetaMonitorManager *manager)
return meta_monitor_config_get_is_builtin_display_on (manager->config);
}
+
+static void
+meta_logical_monitor_init (MetaLogicalMonitor *logical_monitor)
+{
+}
+
+static void
+meta_logical_monitor_class_init (MetaLogicalMonitorClass *klass)
+{
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]