wayland/surface-role: Keep track of the surface main monitor
Toplevels get the main monitor from their MetaWindow and have no main monitor when the toplevel is not mapped. Subsurfaces get the main monitor from their parent surface. DnD and cursors get the main monitor from the current cursor position no matter if the cursor is actually being shown or not. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3941>
This commit is contained in:
@ -92,18 +92,18 @@ cursor_sprite_prepare_at (MetaCursorSprite *cursor_sprite,
|
||||
{
|
||||
MetaWaylandSurfaceRole *role = META_WAYLAND_SURFACE_ROLE (cursor_surface);
|
||||
MetaWaylandSurface *surface = meta_wayland_surface_role_get_surface (role);
|
||||
MetaContext *context =
|
||||
meta_wayland_compositor_get_context (surface->compositor);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
MetaMonitorManager *monitor_manager =
|
||||
meta_backend_get_monitor_manager (backend);
|
||||
MetaLogicalMonitor *logical_monitor;
|
||||
|
||||
logical_monitor =
|
||||
meta_monitor_manager_get_logical_monitor_at (monitor_manager, x, y);
|
||||
|
||||
if (!meta_wayland_surface_is_xwayland (surface))
|
||||
{
|
||||
MetaContext *context =
|
||||
meta_wayland_compositor_get_context (surface->compositor);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
MetaMonitorManager *monitor_manager =
|
||||
meta_backend_get_monitor_manager (backend);
|
||||
MetaLogicalMonitor *logical_monitor;
|
||||
|
||||
logical_monitor =
|
||||
meta_monitor_manager_get_logical_monitor_at (monitor_manager, x, y);
|
||||
if (logical_monitor)
|
||||
{
|
||||
int surface_scale = surface->applied_state.scale;
|
||||
@ -121,6 +121,7 @@ cursor_sprite_prepare_at (MetaCursorSprite *cursor_sprite,
|
||||
}
|
||||
}
|
||||
|
||||
meta_wayland_surface_set_main_monitor (surface, logical_monitor);
|
||||
meta_wayland_surface_update_outputs (surface);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user