mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 11:32:04 +00:00
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
This commit is contained in:
parent
be5643cee7
commit
4bebc5e5fa
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user