backends/x11: Fallback to the first logical monitor when out of focus

When running nested, the pointer can be outside of the stage, meaning
outside of any logical monitor. Handle this when getting the current
logical monitor by falling back to the first logical monitor when the
pointer coordinate is outside of any logical monitor.

https://bugzilla.gnome.org/show_bug.cgi?id=779001
This commit is contained in:
Jonas Ådahl 2017-03-06 16:26:50 +08:00
parent 542ed1d024
commit 4e4b24e7a8

View File

@ -535,6 +535,9 @@ meta_backend_x11_get_current_logical_monitor (MetaBackend *backend)
logical_monitor =
meta_monitor_manager_get_logical_monitor_at (monitor_manager, x, y);
if (!logical_monitor && monitor_manager->logical_monitors)
logical_monitor = monitor_manager->logical_monitors->data;
priv->cached_current_logical_monitor = logical_monitor;
return priv->cached_current_logical_monitor;
}