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;
|
||||
}
|
||||
|
||||
void
|
||||
gboolean
|
||||
meta_monitor_mode_foreach_crtc (MetaMonitor *monitor,
|
||||
MetaMonitorMode *mode,
|
||||
MetaMonitorModeFunc func,
|
||||
gpointer user_data)
|
||||
gpointer user_data,
|
||||
GError **error)
|
||||
{
|
||||
MetaMonitorPrivate *monitor_priv =
|
||||
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];
|
||||
|
||||
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;
|
||||
} MetaMonitorCrtcMode;
|
||||
|
||||
typedef void (* MetaMonitorModeFunc) (MetaMonitor *monitor,
|
||||
MetaMonitorMode *mode,
|
||||
MetaMonitorCrtcMode *monitor_crtc_mode,
|
||||
gpointer user_data);
|
||||
typedef gboolean (* MetaMonitorModeFunc) (MetaMonitor *monitor,
|
||||
MetaMonitorMode *mode,
|
||||
MetaMonitorCrtcMode *monitor_crtc_mode,
|
||||
gpointer user_data,
|
||||
GError **error);
|
||||
|
||||
#define META_TYPE_MONITOR (meta_monitor_get_type ())
|
||||
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);
|
||||
|
||||
void meta_monitor_mode_foreach_crtc (MetaMonitor *monitor,
|
||||
MetaMonitorMode *mode,
|
||||
MetaMonitorModeFunc func,
|
||||
gpointer user_data);
|
||||
gboolean meta_monitor_mode_foreach_crtc (MetaMonitor *monitor,
|
||||
MetaMonitorMode *mode,
|
||||
MetaMonitorModeFunc func,
|
||||
gpointer user_data,
|
||||
GError **error);
|
||||
|
||||
MetaMonitorSpec * meta_monitor_spec_clone (MetaMonitorSpec *monitor_id);
|
||||
|
||||
|
@ -288,11 +288,12 @@ typedef struct _CheckMonitorModeData
|
||||
MetaTestCaseMonitorCrtcMode *expect_crtc_mode_iter;
|
||||
} CheckMonitorModeData;
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
check_monitor_mode (MetaMonitor *monitor,
|
||||
MetaMonitorMode *mode,
|
||||
MetaMonitorCrtcMode *monitor_crtc_mode,
|
||||
gpointer user_data)
|
||||
gpointer user_data,
|
||||
GError **error)
|
||||
{
|
||||
CheckMonitorModeData *data = user_data;
|
||||
MetaMonitorManager *monitor_manager = data->monitor_manager;
|
||||
@ -307,6 +308,8 @@ check_monitor_mode (MetaMonitor *monitor,
|
||||
g_assert (monitor_crtc_mode->crtc_mode == crtc_mode);
|
||||
|
||||
data->expect_crtc_mode_iter++;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -383,7 +386,8 @@ check_monitor_configuration (MonitorTestCase *test_case)
|
||||
};
|
||||
meta_monitor_mode_foreach_crtc (monitor, mode,
|
||||
check_monitor_mode,
|
||||
&data);
|
||||
&data,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user