monitor-manager-dummy: Add non-preferred mode

Add an extra mode besides the preferred one. This makes it possible to
test monitor configuration paths when running nested.

https://bugzilla.gnome.org/show_bug.cgi?id=779745
This commit is contained in:
Jonas Ådahl 2017-03-08 11:58:44 +08:00
parent 8f2daed9e0
commit 3ace913aed

View File

@ -60,17 +60,25 @@ append_monitor (GArray *modes,
GArray *outputs, GArray *outputs,
int scale) int scale)
{ {
MetaCrtcMode mode; MetaCrtcMode modes_decl[] = {
MetaCrtc crtc; {
MetaOutput output; .width = 800,
.height = 600,
mode = (MetaCrtcMode) { .refresh_rate = 60.0
.mode_id = modes->len, },
{
.width = 1024, .width = 1024,
.height = 768, .height = 768,
.refresh_rate = 60.0 .refresh_rate = 60.0
}
}; };
g_array_append_val (modes, mode); MetaCrtc crtc;
MetaOutput output;
unsigned int i;
for (i = 0; i < G_N_ELEMENTS (modes_decl); i++)
modes_decl[i].mode_id = modes->len + i;
g_array_append_vals (modes, modes_decl, G_N_ELEMENTS (modes_decl));
crtc = (MetaCrtc) { crtc = (MetaCrtc) {
.crtc_id = crtcs->len + 1, .crtc_id = crtcs->len + 1,
@ -96,9 +104,11 @@ append_monitor (GArray *modes,
.scale = scale, .scale = scale,
}; };
output.modes = g_new0 (MetaCrtcMode *, 1); output.modes = g_new0 (MetaCrtcMode *, G_N_ELEMENTS (modes_decl));
output.modes[0] = &array_last (modes, MetaCrtcMode); for (i = 0; i < G_N_ELEMENTS (modes_decl); i++)
output.n_modes = 1; output.modes[i] = &g_array_index (modes, MetaCrtcMode,
modes->len - (i + 1));
output.n_modes = G_N_ELEMENTS (modes_decl);
output.possible_crtcs = g_new0 (MetaCrtc *, 1); output.possible_crtcs = g_new0 (MetaCrtc *, 1);
output.possible_crtcs[0] = &array_last (crtcs, MetaCrtc); output.possible_crtcs[0] = &array_last (crtcs, MetaCrtc);
output.n_possible_crtcs = 1; output.n_possible_crtcs = 1;