wayland: Use cursor position in logical monitor
authorOlivier Fourdan <ofourdan@redhat.com>
Fri, 23 Mar 2018 12:05:12 +0000 (13:05 +0100)
committerSimon McVittie <smcv@debian.org>
Sun, 20 May 2018 14:21:35 +0000 (15:21 +0100)
When using two monitors size by side with different scales, once the
cursor moves from one output to another one, its size changes based on
the scale of the given output.

Changing the size of the cursor can cause the cursor area to change
output again if the hotspot is not exactly at the top left corner of the
area, causing the texture of the cursor to change, which will trigger
another output change, so on and so forth causing continuous surface
enter/leave event which flood the clients and eventually kill them.

Change the logic to use only the actual cursor position to determine if
its on the given logical monitor, so that it remains immune to scale
changes induced by output scale differences.

(cherry picked from commit 67917db45f96befb777e5f331a775ea3c2b53012)

Bug: https://gitlab.gnome.org/GNOME/mutter/issues/83
Origin: upstream, 3.28.3, commit:7d52be02290bd92589fbea756ca3431af8e71a94

Gbp-Pq: Name wayland-Use-cursor-position-in-logical-monitor.patch

src/backends/meta-cursor-renderer.c
src/backends/meta-cursor-renderer.h
src/wayland/meta-wayland-surface-role-cursor.c

index 0bdc59c15d61f0e686522b7c29fbe2706e65a51a..f6470e66ae6dd7095d2b326e06e1fc17784bf737 100644 (file)
@@ -264,6 +264,18 @@ meta_cursor_renderer_set_position (MetaCursorRenderer *renderer,
   update_cursor (renderer, priv->displayed_cursor);
 }
 
+ClutterPoint
+meta_cursor_renderer_get_position (MetaCursorRenderer *renderer)
+{
+  MetaCursorRendererPrivate *priv =
+    meta_cursor_renderer_get_instance_private (renderer);
+
+  return (ClutterPoint) {
+    .x = priv->current_x,
+    .y = priv->current_y
+  };
+}
+
 MetaCursorSprite *
 meta_cursor_renderer_get_cursor (MetaCursorRenderer *renderer)
 {
index 8ac0fe79b2b67e6ec5b03fa37ad54e993da866b4..1691f4471c59dd3715d8d685e0d59c41f758757a 100644 (file)
@@ -62,6 +62,7 @@ void meta_cursor_renderer_set_cursor (MetaCursorRenderer *renderer,
 void meta_cursor_renderer_set_position (MetaCursorRenderer *renderer,
                                         float               x,
                                         float               y);
+ClutterPoint meta_cursor_renderer_get_position (MetaCursorRenderer *renderer);
 void meta_cursor_renderer_force_update (MetaCursorRenderer *renderer);
 
 MetaCursorSprite * meta_cursor_renderer_get_cursor (MetaCursorRenderer *renderer);
index 1c8ba94e5ccb1273a437e355eca601acb2ae31b9..d118a89170dc5922d4dc6853f0120a66d7f66e80 100644 (file)
@@ -195,14 +195,15 @@ cursor_surface_role_is_on_logical_monitor (MetaWaylandSurfaceRole *role,
     META_WAYLAND_SURFACE_ROLE_CURSOR (surface->role);
   MetaWaylandSurfaceRoleCursorPrivate *priv =
     meta_wayland_surface_role_cursor_get_instance_private (cursor_role);
-  ClutterRect rect;
+  ClutterPoint point;
   ClutterRect logical_monitor_rect;
 
-  rect = meta_cursor_renderer_calculate_rect (priv->cursor_renderer,
-                                              priv->cursor_sprite);
   logical_monitor_rect =
     meta_rectangle_to_clutter_rect (&logical_monitor->rect);
-  return clutter_rect_intersection (&rect, &logical_monitor_rect, NULL);
+
+  point = meta_cursor_renderer_get_position (priv->cursor_renderer);
+
+  return clutter_rect_contains_point (&logical_monitor_rect, &point);
 }
 
 static void