backends: Don't center the pointer on initialization

Centering the pointer at startup causes undesired behaviour if
it ends up hovering over reactive elements, that might react
to that positioning, causing confusion. This is the case of
the login dialog when a list of different users is shown, as
centering the pointer at startup in that case will get the
user in the center of the screen pre-selected, which is not
the expected behaviour (i.e. pre-selecting the first one).

Fix this by simply moving the pointer out of the way, close
to the bottom-right corner, during initialization.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/157
This commit is contained in:
Mario Sanchez Prada 2018-04-16 21:01:12 +01:00 committed by Ray Strode
parent 6df2b7af55
commit a95cbd0aca

View File

@ -479,7 +479,18 @@ meta_backend_real_post_init (MetaBackend *backend)
if (!meta_monitor_manager_is_headless (priv->monitor_manager))
{
center_pointer (backend);
MetaMonitorManager *monitor_manager = priv->monitor_manager;
MetaLogicalMonitor *primary;
primary =
meta_monitor_manager_get_primary_logical_monitor (monitor_manager);
/* Move the pointer out of the way to avoid hovering over reactive
* elements (e.g. users list at login) causing undesired behaviour. */
meta_backend_warp_pointer (backend,
primary->rect.x + primary->rect.width * 0.9,
primary->rect.y + primary->rect.height * 0.9);
priv->is_pointer_position_initialized = TRUE;
}
}