[mutter/gnome-3-24] monitor: Move get_suggested() behind behind vfunc
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gnome-3-24] monitor: Move get_suggested() behind behind vfunc
- Date: Fri, 12 May 2017 03:57:30 +0000 (UTC)
commit d8adfa9a3198ff5fd5664fbf4586b0f9504abdaf
Author: Jonas Ådahl <jadahl gmail com>
Date: Mon May 1 11:55:10 2017 +0800
monitor: Move get_suggested() behind behind vfunc
Only support suggested monitor positioning if the monitor is non-tiled.
Normally this functionality is used by virtual machines to provide a
hint of how to place the virtual monitors, and they don't tend to use
tiled monitors anyway.
https://bugzilla.gnome.org/show_bug.cgi?id=781723
src/backends/meta-monitor.c | 39 +++++++++++++++++++++++++++++----------
src/backends/meta-monitor.h | 3 +++
2 files changed, 32 insertions(+), 10 deletions(-)
---
diff --git a/src/backends/meta-monitor.c b/src/backends/meta-monitor.c
index 299fef6..279e5f3 100644
--- a/src/backends/meta-monitor.c
+++ b/src/backends/meta-monitor.c
@@ -384,6 +384,23 @@ meta_monitor_normal_derive_dimensions (MetaMonitor *monitor,
*height = output->crtc->rect.height;
}
+static gboolean
+meta_monitor_normal_get_suggested_position (MetaMonitor *monitor,
+ int *x,
+ int *y)
+{
+ MetaOutput *output;
+
+ output = meta_monitor_get_main_output (monitor);
+ if (output->suggested_x < 0 && output->suggested_y < 0)
+ return FALSE;
+
+ *x = output->suggested_x;
+ *y = output->suggested_y;
+
+ return TRUE;
+}
+
static void
meta_monitor_normal_init (MetaMonitorNormal *monitor)
{
@@ -396,6 +413,7 @@ meta_monitor_normal_class_init (MetaMonitorNormalClass *klass)
monitor_class->get_main_output = meta_monitor_normal_get_main_output;
monitor_class->derive_dimensions = meta_monitor_normal_derive_dimensions;
+ monitor_class->get_suggested_position = meta_monitor_normal_get_suggested_position;
}
uint32_t
@@ -409,16 +427,8 @@ meta_monitor_get_suggested_position (MetaMonitor *monitor,
int *x,
int *y)
{
- MetaOutput *main_output;
-
- main_output = meta_monitor_get_main_output (monitor);
- if (main_output->suggested_x < 0 && main_output->suggested_y < 0)
- return FALSE;
-
- *x = main_output->suggested_x;
- *y = main_output->suggested_y;
-
- return TRUE;
+ return META_MONITOR_GET_CLASS (monitor)->get_suggested_position (monitor,
+ x, y);
}
static void
@@ -729,6 +739,14 @@ meta_monitor_tiled_derive_dimensions (MetaMonitor *monitor,
*out_height = max_y - min_y;
}
+static gboolean
+meta_monitor_tiled_get_suggested_position (MetaMonitor *monitor,
+ int *x,
+ int *y)
+{
+ return FALSE;
+}
+
static void
meta_monitor_tiled_finalize (GObject *object)
{
@@ -756,6 +774,7 @@ meta_monitor_tiled_class_init (MetaMonitorTiledClass *klass)
monitor_class->get_main_output = meta_monitor_tiled_get_main_output;
monitor_class->derive_dimensions = meta_monitor_tiled_derive_dimensions;
+ monitor_class->get_suggested_position = meta_monitor_tiled_get_suggested_position;
}
static void
diff --git a/src/backends/meta-monitor.h b/src/backends/meta-monitor.h
index 46abe78..ec2b4cd 100644
--- a/src/backends/meta-monitor.h
+++ b/src/backends/meta-monitor.h
@@ -68,6 +68,9 @@ struct _MetaMonitorClass
void (* derive_dimensions) (MetaMonitor *monitor,
int *width,
int *height);
+ gboolean (* get_suggested_position) (MetaMonitor *monitor,
+ int *width,
+ int *height);
};
#define META_TYPE_MONITOR_NORMAL (meta_monitor_normal_get_type ())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]