[mutter] cursor-renderer: do not update cursor if it is out of monitor



commit 4bebc5e5fa8aade8a96c769bf2365abe0948f6ce
Author: Marek Chalupa <mchqwerty gmail com>
Date:   Mon Nov 9 15:51:02 2015 +0100

    cursor-renderer: do not update cursor if it is out of monitor
    
    if the cursor coordinates are out of monitor, just don't render the
    cursor
    
    https://bugzilla.gnome.org/show_bug.cgi?id=756698

 src/backends/meta-cursor-renderer.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/backends/meta-cursor-renderer.c b/src/backends/meta-cursor-renderer.c
index 48cd239..a76241b 100644
--- a/src/backends/meta-cursor-renderer.c
+++ b/src/backends/meta-cursor-renderer.c
@@ -27,6 +27,8 @@
 #include "meta-cursor-renderer.h"
 
 #include <meta/meta-backend.h>
+#include <backends/meta-backend-private.h>
+#include <backends/meta-monitor-manager-private.h>
 #include <meta/util.h>
 
 #include <cogl/cogl.h>
@@ -116,6 +118,14 @@ meta_cursor_renderer_calculate_rect (MetaCursorRenderer *renderer,
   };
 }
 
+static gboolean
+is_cursor_in_monitors_area (int x, int y)
+{
+  MetaMonitorManager *monitor_manager = meta_backend_get_monitor_manager (meta_get_backend ());
+  return meta_monitor_manager_get_monitor_at_point (monitor_manager,
+                                                    (gfloat) x, (gfloat) y) >= 0;
+}
+
 static void
 update_cursor (MetaCursorRenderer *renderer,
                MetaCursorSprite   *cursor_sprite)
@@ -124,6 +134,11 @@ update_cursor (MetaCursorRenderer *renderer,
   gboolean handled_by_backend;
   gboolean should_redraw = FALSE;
 
+  /* do not render cursor if it is not on any monitor. Such situation
+   * can occur e. g. after monitor hot-plug */
+  if (!is_cursor_in_monitors_area (priv->current_x, priv->current_y))
+    return;
+
   if (cursor_sprite)
     meta_cursor_sprite_prepare_at (cursor_sprite,
                                    priv->current_x,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]