monitor: Allow monitor mode foreach crtc iterator failable
Allow the function used to iterate over the CRTC modes of a monitor mode to fail, causing the iteration to fail as well. https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
parent
81438eebef
commit
be13d0f8ee
@ -576,11 +576,12 @@ meta_monitor_mode_get_refresh_rate (MetaMonitorMode *monitor_mode)
|
|||||||
return monitor_mode->spec.refresh_rate;
|
return monitor_mode->spec.refresh_rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
gboolean
|
||||||
meta_monitor_mode_foreach_crtc (MetaMonitor *monitor,
|
meta_monitor_mode_foreach_crtc (MetaMonitor *monitor,
|
||||||
MetaMonitorMode *mode,
|
MetaMonitorMode *mode,
|
||||||
MetaMonitorModeFunc func,
|
MetaMonitorModeFunc func,
|
||||||
gpointer user_data)
|
gpointer user_data,
|
||||||
|
GError **error)
|
||||||
{
|
{
|
||||||
MetaMonitorPrivate *monitor_priv =
|
MetaMonitorPrivate *monitor_priv =
|
||||||
meta_monitor_get_instance_private (monitor);
|
meta_monitor_get_instance_private (monitor);
|
||||||
@ -591,6 +592,9 @@ meta_monitor_mode_foreach_crtc (MetaMonitor *monitor,
|
|||||||
{
|
{
|
||||||
MetaMonitorCrtcMode *monitor_crtc_mode = &mode->crtc_modes[i];
|
MetaMonitorCrtcMode *monitor_crtc_mode = &mode->crtc_modes[i];
|
||||||
|
|
||||||
func (monitor, mode, monitor_crtc_mode, user_data);
|
if (!func (monitor, mode, monitor_crtc_mode, user_data, error))
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -51,10 +51,11 @@ typedef struct _MetaMonitorCrtcMode
|
|||||||
MetaCrtcMode *crtc_mode;
|
MetaCrtcMode *crtc_mode;
|
||||||
} MetaMonitorCrtcMode;
|
} MetaMonitorCrtcMode;
|
||||||
|
|
||||||
typedef void (* MetaMonitorModeFunc) (MetaMonitor *monitor,
|
typedef gboolean (* MetaMonitorModeFunc) (MetaMonitor *monitor,
|
||||||
MetaMonitorMode *mode,
|
MetaMonitorMode *mode,
|
||||||
MetaMonitorCrtcMode *monitor_crtc_mode,
|
MetaMonitorCrtcMode *monitor_crtc_mode,
|
||||||
gpointer user_data);
|
gpointer user_data,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
#define META_TYPE_MONITOR (meta_monitor_get_type ())
|
#define META_TYPE_MONITOR (meta_monitor_get_type ())
|
||||||
G_DECLARE_DERIVABLE_TYPE (MetaMonitor, meta_monitor, META, MONITOR, GObject)
|
G_DECLARE_DERIVABLE_TYPE (MetaMonitor, meta_monitor, META, MONITOR, GObject)
|
||||||
@ -120,10 +121,11 @@ void meta_monitor_mode_get_resolution (MetaMonitorMode *monitor_mode,
|
|||||||
|
|
||||||
float meta_monitor_mode_get_refresh_rate (MetaMonitorMode *monitor_mode);
|
float meta_monitor_mode_get_refresh_rate (MetaMonitorMode *monitor_mode);
|
||||||
|
|
||||||
void meta_monitor_mode_foreach_crtc (MetaMonitor *monitor,
|
gboolean meta_monitor_mode_foreach_crtc (MetaMonitor *monitor,
|
||||||
MetaMonitorMode *mode,
|
MetaMonitorMode *mode,
|
||||||
MetaMonitorModeFunc func,
|
MetaMonitorModeFunc func,
|
||||||
gpointer user_data);
|
gpointer user_data,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
MetaMonitorSpec * meta_monitor_spec_clone (MetaMonitorSpec *monitor_id);
|
MetaMonitorSpec * meta_monitor_spec_clone (MetaMonitorSpec *monitor_id);
|
||||||
|
|
||||||
|
@ -288,11 +288,12 @@ typedef struct _CheckMonitorModeData
|
|||||||
MetaTestCaseMonitorCrtcMode *expect_crtc_mode_iter;
|
MetaTestCaseMonitorCrtcMode *expect_crtc_mode_iter;
|
||||||
} CheckMonitorModeData;
|
} CheckMonitorModeData;
|
||||||
|
|
||||||
static void
|
static gboolean
|
||||||
check_monitor_mode (MetaMonitor *monitor,
|
check_monitor_mode (MetaMonitor *monitor,
|
||||||
MetaMonitorMode *mode,
|
MetaMonitorMode *mode,
|
||||||
MetaMonitorCrtcMode *monitor_crtc_mode,
|
MetaMonitorCrtcMode *monitor_crtc_mode,
|
||||||
gpointer user_data)
|
gpointer user_data,
|
||||||
|
GError **error)
|
||||||
{
|
{
|
||||||
CheckMonitorModeData *data = user_data;
|
CheckMonitorModeData *data = user_data;
|
||||||
MetaMonitorManager *monitor_manager = data->monitor_manager;
|
MetaMonitorManager *monitor_manager = data->monitor_manager;
|
||||||
@ -307,6 +308,8 @@ check_monitor_mode (MetaMonitor *monitor,
|
|||||||
g_assert (monitor_crtc_mode->crtc_mode == crtc_mode);
|
g_assert (monitor_crtc_mode->crtc_mode == crtc_mode);
|
||||||
|
|
||||||
data->expect_crtc_mode_iter++;
|
data->expect_crtc_mode_iter++;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -383,7 +386,8 @@ check_monitor_configuration (MonitorTestCase *test_case)
|
|||||||
};
|
};
|
||||||
meta_monitor_mode_foreach_crtc (monitor, mode,
|
meta_monitor_mode_foreach_crtc (monitor, mode,
|
||||||
check_monitor_mode,
|
check_monitor_mode,
|
||||||
&data);
|
&data,
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user