Commit 640391f9 authored by Guido Gunther's avatar Guido Gunther

monitor: Make done flag more specific

We're waiting for two done events in the future (wl_output and
xdg_output)
Signed-off-by: Guido Gunther's avatarGuido Günther <guido.gunther@puri.sm>
parent a83586dc
......@@ -58,7 +58,7 @@ phosh_monitor_manager_handle_get_resources (
PhoshMonitor *monitor = g_ptr_array_index (self->monitors, i);
GVariantBuilder transforms;
if (!monitor->done)
if (!phosh_monitor_is_configured(monitor))
continue;
/* TODO: add transforms */
......@@ -84,7 +84,7 @@ phosh_monitor_manager_handle_get_resources (
GVariantBuilder crtcs, modes, clones, properties;
g_autofree gchar *output_name = NULL;
if (!monitor->done)
if (!phosh_monitor_is_configured(monitor))
continue;
g_variant_builder_init (&crtcs, G_VARIANT_TYPE ("au"));
......@@ -120,7 +120,7 @@ phosh_monitor_manager_handle_get_resources (
PhoshMonitor *monitor = g_ptr_array_index (self->monitors, i);
GArray *modes = monitor->modes;
if (!monitor->done)
if (!phosh_monitor_is_configured(monitor))
continue;
for (int k = 0; k < modes->len; k++) {
......@@ -388,7 +388,7 @@ phosh_monitor_manager_handle_get_current_state (
g_autofree gchar *serial = NULL;
g_autofree gchar *connector = NULL;
if (!monitor->done)
if (!phosh_monitor_is_configured(monitor))
continue;
g_variant_builder_init (&modes_builder, G_VARIANT_TYPE (MODES_FORMAT));
......@@ -449,7 +449,7 @@ phosh_monitor_manager_handle_get_current_state (
g_autofree gchar *serial = NULL;
g_autofree gchar *connector = NULL;
if (!monitor->done)
if (!phosh_monitor_is_configured(monitor))
continue;
connector = g_strdup_printf ("DP%d", i);
......
......@@ -58,7 +58,7 @@ output_handle_done (void *data,
{
PhoshMonitor *self = PHOSH_MONITOR (data);
self->done = TRUE;
self->wl_output_done = TRUE;
}
......@@ -222,3 +222,14 @@ phosh_monitor_get_current_mode (PhoshMonitor *self)
g_return_val_if_fail (PHOSH_IS_MONITOR (self), NULL);
return &g_array_index (self->modes, PhoshMonitorMode, self->current_mode);
}
/** phosh_monitor_is_configured:
*
* Is the monitor fully configured (did we receive all data from the compositor)?
*/
gboolean
phosh_monitor_is_configured (PhoshMonitor *self)
{
g_return_val_if_fail (PHOSH_IS_MONITOR (self), NULL);
return self->wl_output_done;
}
......@@ -36,10 +36,12 @@ struct _PhoshMonitor {
guint current_mode;
guint preferred_mode;
gboolean done;
gboolean wl_output_done;
gboolean xdg_output_done;
};
G_DECLARE_FINAL_TYPE (PhoshMonitor, phosh_monitor, PHOSH, MONITOR, GObject)
PhoshMonitor * phosh_monitor_new_from_wl_output (gpointer wl_output);
PhoshMonitorMode * phosh_monitor_get_current_mode (PhoshMonitor *monitor);
gboolean phosh_monitor_is_configured (PhoshMonitor *monitor);
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