You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/x11-wm/mutter/files/mutter-3.18.2-cursor-render...

57 lines
1.8 KiB

From 58d2bd05815a8917460ec7231a1e50ed8cedf19f Mon Sep 17 00:00:00 2001
From: Marek Chalupa <mchqwerty@gmail.com>
Date: Mon, 9 Nov 2015 15:51:02 +0100
Subject: 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 file changed, 15 insertions(+)
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,
--
cgit v0.11.2