mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 03:22:04 +00:00
backends: Hook ClutterSeat::touch-mode to PanelOrientationManaged
We only want the panel autorotation to happen if the laptop has an accelerometer, and is in tablet mode. Regular laptop mode should lock the orientation, and let it be configured manually. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1311
This commit is contained in:
parent
bb0712077a
commit
bbcd65ce38
@ -560,6 +560,8 @@ meta_backend_real_post_init (MetaBackend *backend)
|
||||
reset_pointer_position (backend);
|
||||
priv->is_pointer_position_initialized = TRUE;
|
||||
}
|
||||
|
||||
meta_monitor_manager_post_init (priv->monitor_manager);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -407,4 +407,6 @@ meta_find_output_assignment (MetaOutputAssignment **outputs,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void meta_monitor_manager_post_init (MetaMonitorManager *manager);
|
||||
|
||||
#endif /* META_MONITOR_MANAGER_PRIVATE_H */
|
||||
|
@ -756,12 +756,18 @@ static void
|
||||
update_panel_orientation_managed (MetaMonitorManager *manager)
|
||||
{
|
||||
MetaOrientationManager *orientation_manager;
|
||||
ClutterBackend *clutter_backend;
|
||||
ClutterSeat *seat;
|
||||
gboolean panel_orientation_managed;
|
||||
|
||||
clutter_backend = meta_backend_get_clutter_backend (manager->backend);
|
||||
seat = clutter_backend_get_default_seat (clutter_backend);
|
||||
|
||||
orientation_manager = meta_backend_get_orientation_manager (manager->backend);
|
||||
|
||||
panel_orientation_managed =
|
||||
meta_orientation_manager_has_accelerometer (orientation_manager);
|
||||
(clutter_seat_get_touch_mode (seat) &&
|
||||
meta_orientation_manager_has_accelerometer (orientation_manager));
|
||||
|
||||
if (manager->panel_orientation_managed == panel_orientation_managed)
|
||||
return;
|
||||
@ -3227,3 +3233,17 @@ meta_monitor_manager_get_panel_orientation_managed (MetaMonitorManager *manager)
|
||||
|
||||
return manager->panel_orientation_managed;
|
||||
}
|
||||
|
||||
void
|
||||
meta_monitor_manager_post_init (MetaMonitorManager *manager)
|
||||
{
|
||||
ClutterBackend *clutter_backend;
|
||||
ClutterSeat *seat;
|
||||
|
||||
clutter_backend = meta_backend_get_clutter_backend (manager->backend);
|
||||
seat = clutter_backend_get_default_seat (clutter_backend);
|
||||
|
||||
g_signal_connect_object (seat, "notify::touch-mode",
|
||||
G_CALLBACK (update_panel_orientation_managed), manager,
|
||||
G_CONNECT_SWAPPED);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user