Commit 21594a60 authored by Alberts Muktupāvels's avatar Alberts Muktupāvels

backends: use current monitor mode to check whether active

Based on mutter commit:
mutter@4d465eac
parent 07bc5f88
...@@ -89,6 +89,18 @@ static GParamSpec *monitor_properties[LAST_PROP] = { NULL }; ...@@ -89,6 +89,18 @@ static GParamSpec *monitor_properties[LAST_PROP] = { NULL };
G_DEFINE_TYPE_WITH_PRIVATE (GfMonitor, gf_monitor, G_TYPE_OBJECT) G_DEFINE_TYPE_WITH_PRIVATE (GfMonitor, gf_monitor, G_TYPE_OBJECT)
static gboolean
is_current_mode_known (GfMonitor *monitor)
{
GfOutput *output;
GfCrtc *crtc;
output = gf_monitor_get_main_output (monitor);
crtc = gf_output_get_assigned_crtc (output);
return gf_monitor_is_active (monitor) == (crtc && crtc->current_mode);
}
static gboolean static gboolean
gf_monitor_mode_spec_equals (GfMonitorModeSpec *spec, gf_monitor_mode_spec_equals (GfMonitorModeSpec *spec,
GfMonitorModeSpec *other_spec) GfMonitorModeSpec *other_spec)
...@@ -551,13 +563,11 @@ gf_monitor_get_spec (GfMonitor *monitor) ...@@ -551,13 +563,11 @@ gf_monitor_get_spec (GfMonitor *monitor)
gboolean gboolean
gf_monitor_is_active (GfMonitor *monitor) gf_monitor_is_active (GfMonitor *monitor)
{ {
GfOutput *output; GfMonitorPrivate *priv;
GfCrtc *crtc;
output = gf_monitor_get_main_output (monitor); priv = gf_monitor_get_instance_private (monitor);
crtc = gf_output_get_assigned_crtc (output);
return crtc && crtc->current_mode; return !!priv->current_mode;
} }
GfOutput * GfOutput *
...@@ -860,6 +870,8 @@ gf_monitor_derive_current_mode (GfMonitor *monitor) ...@@ -860,6 +870,8 @@ gf_monitor_derive_current_mode (GfMonitor *monitor)
} }
priv->current_mode = current_mode; priv->current_mode = current_mode;
g_warn_if_fail (is_current_mode_known (monitor));
} }
void void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment