summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Fourdan <ofourdan@redhat.com>2018-03-26 15:56:04 +0200
committerOlivier Fourdan <ofourdan@redhat.com>2018-03-29 06:34:37 +0000
commitebff7fd7f4ee2c9636412fe661a1fbdf51f218a0 (patch)
treef7b6e9abc1c9ab55bcba594dd315a41f810cfafa
parent6e415353e311655be9936b9dfb9e23c80ef1eae6 (diff)
downloadmutter-ebff7fd7f4ee2c9636412fe661a1fbdf51f218a0.tar.gz
cursor-renderer-native: take rotation into account
Rotating an output would show duplicate cursors when the pointer is located over an area which would be within the output if not rotated. Make sure to swap the width/height of the output when rotated. Closes: https://gitlab.gnome.org/GNOME/mutter/issues/85
-rw-r--r--src/backends/native/meta-cursor-renderer-native.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/backends/native/meta-cursor-renderer-native.c b/src/backends/native/meta-cursor-renderer-native.c
index b28d26ca3..aea86dffd 100644
--- a/src/backends/native/meta-cursor-renderer-native.c
+++ b/src/backends/native/meta-cursor-renderer-native.c
@@ -291,9 +291,11 @@ update_monitor_crtc_cursor (MetaMonitor *monitor,
data->in_cursor_renderer_native;
MetaCursorRendererNativePrivate *priv =
meta_cursor_renderer_native_get_instance_private (cursor_renderer_native);
+ MetaMonitorTransform transform;
ClutterRect scaled_crtc_rect;
float scale;
int crtc_x, crtc_y;
+ int crtc_width, crtc_height;
if (meta_is_stage_views_scaled ())
scale = meta_logical_monitor_get_scale (data->in_logical_monitor);
@@ -305,14 +307,26 @@ update_monitor_crtc_cursor (MetaMonitor *monitor,
META_MONITOR_TRANSFORM_NORMAL,
&crtc_x, &crtc_y);
+ transform = meta_logical_monitor_get_transform (data->in_logical_monitor);
+ if (meta_monitor_transform_is_rotated (transform))
+ {
+ crtc_width = monitor_crtc_mode->crtc_mode->height;
+ crtc_height = monitor_crtc_mode->crtc_mode->width;
+ }
+ else
+ {
+ crtc_width = monitor_crtc_mode->crtc_mode->width;
+ crtc_height = monitor_crtc_mode->crtc_mode->height;
+ }
+
scaled_crtc_rect = (ClutterRect) {
.origin = {
.x = crtc_x / scale,
.y = crtc_y / scale
},
.size = {
- .width = monitor_crtc_mode->crtc_mode->width / scale,
- .height = monitor_crtc_mode->crtc_mode->height / scale
+ .width = crtc_width / scale,
+ .height = crtc_height / scale
},
};