diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2020-06-11 18:18:37 +0200 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2020-09-05 07:25:02 +0000 |
commit | bbcd65ce389ded38e25c060d5cf27b226489d85f (patch) | |
tree | 7de8b0c7fa19900f14a3ed2724af8e5a7ee99d01 /src/backends/meta-monitor-manager.c | |
parent | bb0712077a384400f6940aa245848213c5e47eb7 (diff) | |
download | mutter-bbcd65ce389ded38e25c060d5cf27b226489d85f.tar.gz |
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
Diffstat (limited to 'src/backends/meta-monitor-manager.c')
-rw-r--r-- | src/backends/meta-monitor-manager.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c index 35d8e6087..1beb658bd 100644 --- a/src/backends/meta-monitor-manager.c +++ b/src/backends/meta-monitor-manager.c @@ -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); +} |