From 4c8dd08c775815ef6ebe3a54bcee64b95a92c807 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Fri, 9 Sep 2016 13:49:25 +0800 Subject: [PATCH] MetaWaylandOutput: Pretend outputs are always untransformed Since wl_surface.set_buffer_transform() is not supported, until it is added, pretend outputs are never transformed, so that clients are less likely to attach pre-transformed buffers. https://bugzilla.gnome.org/show_bug.cgi?id=770672 --- src/wayland/meta-wayland-outputs.c | 22 ++++++++-------------- src/wayland/meta-wayland-outputs.h | 1 - 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/wayland/meta-wayland-outputs.c b/src/wayland/meta-wayland-outputs.c index 70f47d9ac..ba1bc09a4 100644 --- a/src/wayland/meta-wayland-outputs.c +++ b/src/wayland/meta-wayland-outputs.c @@ -53,13 +53,6 @@ output_resource_destroy (struct wl_resource *res) wayland_output->resources = g_list_remove (wayland_output->resources, res); } -static inline enum wl_output_transform -wl_output_transform_from_meta_monitor_transform (MetaMonitorTransform transform) -{ - /* The enums are the same. */ - return (enum wl_output_transform) transform; -} - static void send_output_events (struct wl_resource *resource, MetaWaylandOutput *wayland_output, @@ -69,11 +62,9 @@ send_output_events (struct wl_resource *resource, int version = wl_resource_get_version (resource); MetaOutput *output = monitor_info->outputs[0]; - enum wl_output_transform transform = wl_output_transform_from_meta_monitor_transform (output->crtc->transform); guint mode_flags = WL_OUTPUT_MODE_CURRENT; MetaMonitorInfo *old_monitor_info = wayland_output->monitor_info; - enum wl_output_transform old_transform = wayland_output->transform; guint old_mode_flags = wayland_output->mode_flags; gint old_scale = wayland_output->scale; @@ -81,9 +72,14 @@ send_output_events (struct wl_resource *resource, if (need_all_events || old_monitor_info->rect.x != monitor_info->rect.x || - old_monitor_info->rect.y != monitor_info->rect.y || - old_transform != transform) + old_monitor_info->rect.y != monitor_info->rect.y) { + /* + * TODO: When we support wl_surface.set_buffer_transform, pass along + * the correct transform here instead of always pretending its 'normal'. + * The reason for this is to try stopping clients from setting any buffer + * transform other than 'normal'. + */ wl_output_send_geometry (resource, (int)monitor_info->rect.x, (int)monitor_info->rect.y, @@ -92,7 +88,7 @@ send_output_events (struct wl_resource *resource, output->subpixel_order, output->vendor, output->product, - transform); + WL_OUTPUT_TRANSFORM_NORMAL); need_done = TRUE; } @@ -167,10 +163,8 @@ wayland_output_set_monitor_info (MetaWaylandOutput *wayland_output, MetaMonitorInfo *monitor_info) { MetaOutput *output = monitor_info->outputs[0]; - enum wl_output_transform transform = wl_output_transform_from_meta_monitor_transform (output->crtc->transform); wayland_output->monitor_info = monitor_info; - wayland_output->transform = transform; wayland_output->mode_flags = WL_OUTPUT_MODE_CURRENT; if (output->crtc->current_mode == output->preferred_mode) wayland_output->mode_flags |= WL_OUTPUT_MODE_PREFERRED; diff --git a/src/wayland/meta-wayland-outputs.h b/src/wayland/meta-wayland-outputs.h index e22b541f6..a31774a7d 100644 --- a/src/wayland/meta-wayland-outputs.h +++ b/src/wayland/meta-wayland-outputs.h @@ -43,7 +43,6 @@ struct _MetaWaylandOutput struct wl_global *global; MetaMonitorInfo *monitor_info; - enum wl_output_transform transform; guint mode_flags; gint scale;