[mutter] wayland: Advertise MetaMonitor as wl_output
- From: Robert Mader <rmader src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] wayland: Advertise MetaMonitor as wl_output
- Date: Tue, 11 Feb 2020 19:44:15 +0000 (UTC)
commit 98d7a542b045027bb2f013a57ead967501f8568d
Author: Olivier Fourdan <ofourdan redhat com>
Date: Wed Sep 20 11:25:55 2017 +0200
wayland: Advertise MetaMonitor as wl_output
With the logical size of outputs being handled by xdg-output, we don't
need to "lie" to Wayland clients anymore about the output size, so
advertise the real mode size as wl_output regardless of the scale, as it
should be (and like other Wayland compositors do).
https://bugzilla.gnome.org/show_bug.cgi?id=787363
https://gitlab.gnome.org/GNOME/mutter/merge_requests/994
src/wayland/meta-wayland-outputs.c | 35 ++++++++++++++++++++++++++++++-----
src/wayland/meta-wayland-outputs.h | 2 ++
2 files changed, 32 insertions(+), 5 deletions(-)
---
diff --git a/src/wayland/meta-wayland-outputs.c b/src/wayland/meta-wayland-outputs.c
index f4709caef..64de5abc3 100644
--- a/src/wayland/meta-wayland-outputs.c
+++ b/src/wayland/meta-wayland-outputs.c
@@ -168,6 +168,21 @@ is_different_rotation (MetaLogicalMonitor *a,
meta_monitor_transform_is_rotated (b->transform));
}
+static void
+get_native_output_mode_resolution (MetaLogicalMonitor *logical_monitor,
+ MetaMonitorMode *mode,
+ int *mode_width,
+ int *mode_height)
+{
+ MetaMonitorTransform transform;
+
+ transform = meta_logical_monitor_get_transform (logical_monitor);
+ if (meta_monitor_transform_is_rotated (transform))
+ meta_monitor_mode_get_resolution (mode, mode_height, mode_width);
+ else
+ meta_monitor_mode_get_resolution (mode, mode_width, mode_height);
+}
+
static void
send_output_events (struct wl_resource *resource,
MetaWaylandOutput *wayland_output,
@@ -185,6 +200,7 @@ send_output_events (struct wl_resource *resource,
gint old_scale;
float old_refresh_rate;
float refresh_rate;
+ int new_width, new_height;
old_logical_monitor = wayland_output->logical_monitor;
old_mode_flags = wayland_output->mode_flags;
@@ -246,16 +262,20 @@ send_output_events (struct wl_resource *resource,
if (current_mode == preferred_mode)
mode_flags |= WL_OUTPUT_MODE_PREFERRED;
+ get_native_output_mode_resolution (logical_monitor,
+ current_mode,
+ &new_width,
+ &new_height);
if (need_all_events ||
- old_logical_monitor->rect.width != logical_monitor->rect.width ||
- old_logical_monitor->rect.height != logical_monitor->rect.height ||
+ wayland_output->mode_width != new_width ||
+ wayland_output->mode_height != new_height ||
old_refresh_rate != refresh_rate ||
old_mode_flags != mode_flags)
{
wl_output_send_mode (resource,
mode_flags,
- logical_monitor->rect.width,
- logical_monitor->rect.height,
+ new_width,
+ new_height,
(int32_t) (refresh_rate * 1000));
need_done = TRUE;
}
@@ -312,7 +332,8 @@ bind_output (struct wl_client *client,
logical_monitor,
meta_monitor_get_product (monitor),
logical_monitor->rect.x, logical_monitor->rect.y,
- logical_monitor->rect.width, logical_monitor->rect.height,
+ wayland_output->mode_width,
+ wayland_output->mode_height,
wayland_output->refresh_rate);
#endif
@@ -349,6 +370,10 @@ meta_wayland_output_set_logical_monitor (MetaWaylandOutput *wayland_output,
wayland_output->refresh_rate = meta_monitor_mode_get_refresh_rate (current_mode);
wayland_output->winsys_id = logical_monitor->winsys_id;
+ get_native_output_mode_resolution (logical_monitor,
+ current_mode,
+ &wayland_output->mode_width,
+ &wayland_output->mode_height);
}
static void
diff --git a/src/wayland/meta-wayland-outputs.h b/src/wayland/meta-wayland-outputs.h
index ff15a81bd..381febcdb 100644
--- a/src/wayland/meta-wayland-outputs.h
+++ b/src/wayland/meta-wayland-outputs.h
@@ -41,6 +41,8 @@ struct _MetaWaylandOutput
guint mode_flags;
float refresh_rate;
gint scale;
+ int mode_width;
+ int mode_height;
GList *resources;
GList *xdg_output_resources;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]