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
This commit is contained in:
Jonas Ådahl 2016-12-02 16:08:59 +08:00
parent 1fb0e8e9bb
commit 6de3e4a07e
2 changed files with 25 additions and 4 deletions

View File

@ -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;

View File

@ -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)
{
}