[gnome-flashback] output: tie the output to the monitor it's part of
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback] output: tie the output to the monitor it's part of
- Date: Sun, 14 Mar 2021 13:57:03 +0000 (UTC)
commit 67dfb91d2a9fb28ff90d987bc6a49b8deec4b78d
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sun Jan 31 18:28:32 2021 +0200
output: tie the output to the monitor it's part of
Outputs correspond to active connectors, that we translate into
monitors. Make this association more real by adding a pointer back
to the monitor from the output.
Based on mutter commit:
https://gitlab.gnome.org/GNOME/mutter/-/commit/7215b0d88c5d8cd974
backends/gf-monitor-normal.c | 2 ++
backends/gf-monitor-tiled.c | 1 +
backends/gf-output-private.h | 5 +++++
backends/gf-output.c | 27 +++++++++++++++++++++++++++
4 files changed, 35 insertions(+)
---
diff --git a/backends/gf-monitor-normal.c b/backends/gf-monitor-normal.c
index 3afcbd9..1256e44 100644
--- a/backends/gf-monitor-normal.c
+++ b/backends/gf-monitor-normal.c
@@ -195,6 +195,8 @@ gf_monitor_normal_new (GfGpu *gpu,
monitor = GF_MONITOR (normal);
gf_monitor_append_output (monitor, output);
+ gf_output_set_monitor (output, monitor);
+
gf_monitor_set_winsys_id (monitor, gf_output_get_id (output));
gf_monitor_generate_spec (monitor);
generate_modes (normal);
diff --git a/backends/gf-monitor-tiled.c b/backends/gf-monitor-tiled.c
index 8342dd0..a5fdb7c 100644
--- a/backends/gf-monitor-tiled.c
+++ b/backends/gf-monitor-tiled.c
@@ -549,6 +549,7 @@ add_tiled_monitor_outputs (GfGpu *gpu,
continue;
gf_monitor_append_output (monitor, output);
+ gf_output_set_monitor (output, GF_MONITOR (tiled));
}
}
diff --git a/backends/gf-output-private.h b/backends/gf-output-private.h
index 6879076..1ac0d24 100644
--- a/backends/gf-output-private.h
+++ b/backends/gf-output-private.h
@@ -55,6 +55,11 @@ GfGpu *gf_output_get_gpu (GfOutput
const GfOutputInfo *gf_output_get_info (GfOutput *self);
+GfMonitor *gf_output_get_monitor (GfOutput *self);
+
+void gf_output_set_monitor (GfOutput *self,
+ GfMonitor *monitor);
+
const char *gf_output_get_name (GfOutput *self);
void gf_output_assign_crtc (GfOutput *self,
diff --git a/backends/gf-output.c b/backends/gf-output.c
index b7bf09a..86097db 100644
--- a/backends/gf-output.c
+++ b/backends/gf-output.c
@@ -37,6 +37,8 @@ typedef struct
GfOutputInfo *info;
+ GfMonitor *monitor;
+
/* The CRTC driving this output, NULL if the output is not enabled */
GfCrtc *crtc;
@@ -240,6 +242,31 @@ gf_output_get_info (GfOutput *self)
return priv->info;
}
+GfMonitor *
+gf_output_get_monitor (GfOutput *self)
+{
+ GfOutputPrivate *priv;
+
+ priv = gf_output_get_instance_private (self);
+
+ g_warn_if_fail (priv->monitor);
+
+ return priv->monitor;
+}
+
+void
+gf_output_set_monitor (GfOutput *self,
+ GfMonitor *monitor)
+{
+ GfOutputPrivate *priv;
+
+ priv = gf_output_get_instance_private (self);
+
+ g_warn_if_fail (!priv->monitor);
+
+ priv->monitor = monitor;
+}
+
const char *
gf_output_get_name (GfOutput *self)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]