crtc: Make implementations inherit MetaCrtc

Just as with MetaOutput, instead of the home baked "inheritance" system,
using a gpointer and a GDestroyNotify function to keep the what
effectively is sub type details, make MetaCrtc an abstract derivable
type, and make the implementations inherit it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
This commit is contained in:
Jonas Ådahl
2020-02-26 19:47:44 +01:00
committed by Georges Basile Stavracas Neto
parent 4a4f2d8264
commit 1ce9e379d9
19 changed files with 233 additions and 188 deletions

View File

@ -138,7 +138,7 @@ meta_test_headless_monitor_connect (void)
test_setup->modes = g_list_append (NULL, crtc_mode);
gpu = META_GPU (meta_backend_get_gpus (meta_get_backend ())->data);
crtc = g_object_new (META_TYPE_CRTC,
crtc = g_object_new (META_TYPE_CRTC_TEST,
"id", 1,
"gpu", gpu,
NULL);

View File

@ -28,6 +28,7 @@
#include "backends/meta-output.h"
#include "tests/meta-backend-test.h"
G_DEFINE_TYPE (MetaCrtcTest, meta_crtc_test, META_TYPE_CRTC)
G_DEFINE_TYPE (MetaOutputTest, meta_output_test, META_TYPE_OUTPUT)
struct _MetaMonitorManagerTest
@ -436,3 +437,13 @@ static void
meta_output_test_class_init (MetaOutputTestClass *klass)
{
}
static void
meta_crtc_test_init (MetaCrtcTest *crtc_test)
{
}
static void
meta_crtc_test_class_init (MetaCrtcTestClass *klass)
{
}

View File

@ -20,6 +20,7 @@
#ifndef META_MONITOR_MANAGER_TEST_H
#define META_MONITOR_MANAGER_TEST_H
#include "backends/meta-crtc.h"
#include "backends/meta-monitor-manager-private.h"
#include "backends/meta-output.h"
@ -30,6 +31,11 @@ typedef struct _MetaMonitorTestSetup
GList *crtcs;
} MetaMonitorTestSetup;
struct _MetaCrtcTest
{
MetaCrtc parent;
};
struct _MetaOutputTest
{
MetaOutput parent;
@ -39,6 +45,11 @@ struct _MetaOutputTest
typedef MetaMonitorTestSetup * (* CreateTestSetupFunc) (void);
#define META_TYPE_CRTC_TEST (meta_crtc_test_get_type ())
G_DECLARE_FINAL_TYPE (MetaCrtcTest, meta_crtc_test,
META, CRTC_TEST,
MetaCrtc)
#define META_TYPE_OUTPUT_TEST (meta_output_test_get_type ())
G_DECLARE_FINAL_TYPE (MetaOutputTest, meta_output_test,
META, OUTPUT_TEST,

View File

@ -560,7 +560,7 @@ create_monitor_test_setup (MonitorTestCaseSetup *setup,
{
MetaCrtc *crtc;
crtc = g_object_new (META_TYPE_CRTC,
crtc = g_object_new (META_TYPE_CRTC_TEST,
"id", i + 1,
"gpu", test_get_gpu (),
NULL);