mirror of
https://github.com/brl/mutter.git
synced 2024-11-09 23:46:33 -05:00
backend: Ensure the backend gets notified of monitor state having changed
Being a listener to a signal, it is inconvenient to enforce order of execution between different signal listeners. If there are things in the backend that should be updated before various other signal handlers, make sure so is done by emitting the signal after having explicitly notified the backend. https://bugzilla.gnome.org/show_bug.cgi?id=768976
This commit is contained in:
parent
28a898a22f
commit
d7b87799c8
@ -142,4 +142,6 @@ void meta_backend_set_client_pointer_constraint (MetaBackend *backend,
|
||||
|
||||
ClutterBackend * meta_backend_get_clutter_backend (MetaBackend *backend);
|
||||
|
||||
void meta_backend_monitors_changed (MetaBackend *backend);
|
||||
|
||||
#endif /* META_BACKEND_PRIVATE_H */
|
||||
|
@ -116,11 +116,11 @@ center_pointer (MetaBackend *backend)
|
||||
primary->rect.y + primary->rect.height / 2);
|
||||
}
|
||||
|
||||
static void
|
||||
on_monitors_changed (MetaMonitorManager *monitors,
|
||||
gpointer user_data)
|
||||
void
|
||||
meta_backend_monitors_changed (MetaBackend *backend)
|
||||
{
|
||||
MetaBackend *backend = META_BACKEND (user_data);
|
||||
MetaMonitorManager *monitor_manager =
|
||||
meta_backend_get_monitor_manager (backend);
|
||||
ClutterDeviceManager *manager = clutter_device_manager_get_default ();
|
||||
ClutterInputDevice *device = clutter_device_manager_get_core_device (manager, CLUTTER_POINTER_DEVICE);
|
||||
ClutterPoint point;
|
||||
@ -130,7 +130,8 @@ on_monitors_changed (MetaMonitorManager *monitors,
|
||||
if (clutter_input_device_get_coords (device, NULL, &point))
|
||||
{
|
||||
/* If we're outside all monitors, warp the pointer back inside */
|
||||
if (meta_monitor_manager_get_monitor_at_point (monitors, point.x, point.y) < 0)
|
||||
if (meta_monitor_manager_get_monitor_at_point (monitor_manager,
|
||||
point.x, point.y) < 0)
|
||||
center_pointer (backend);
|
||||
}
|
||||
}
|
||||
@ -278,8 +279,6 @@ meta_backend_real_post_init (MetaBackend *backend)
|
||||
|
||||
priv->monitor_manager = create_monitor_manager (backend);
|
||||
|
||||
g_signal_connect (priv->monitor_manager, "monitors-changed",
|
||||
G_CALLBACK (on_monitors_changed), backend);
|
||||
meta_backend_sync_screen_size (backend);
|
||||
|
||||
priv->cursor_renderer = META_BACKEND_GET_CLASS (backend)->create_cursor_renderer (backend);
|
||||
|
@ -1379,6 +1379,7 @@ meta_monitor_manager_read_current_config (MetaMonitorManager *manager)
|
||||
void
|
||||
meta_monitor_manager_rebuild_derived (MetaMonitorManager *manager)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaMonitorManagerClass *manager_class = META_MONITOR_MANAGER_GET_CLASS (manager);
|
||||
MetaMonitorInfo *old_monitor_infos;
|
||||
unsigned old_n_monitor_infos;
|
||||
@ -1408,6 +1409,13 @@ meta_monitor_manager_rebuild_derived (MetaMonitorManager *manager)
|
||||
manager_class->delete_monitor (manager, old_monitor_infos[i].monitor_winsys_xid);
|
||||
}
|
||||
}
|
||||
|
||||
/* Tell the backend about that the monitors changed before emitting the
|
||||
* signal, so that the backend can prepare itself before all the signal
|
||||
* consumers.
|
||||
*/
|
||||
meta_backend_monitors_changed (backend);
|
||||
|
||||
g_signal_emit_by_name (manager, "monitors-changed");
|
||||
|
||||
g_free (old_monitor_infos);
|
||||
|
Loading…
Reference in New Issue
Block a user