[mutter/wip/carlosg/centralized-panel-auto-orientation: 3/3] backends: Hook ClutterSeat::touch-mode to PanelOrientationManaged
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/centralized-panel-auto-orientation: 3/3] backends: Hook ClutterSeat::touch-mode to PanelOrientationManaged
- Date: Thu, 11 Jun 2020 17:34:05 +0000 (UTC)
commit e0a91edd79b2fbfee67375f645a887e444621699
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Jun 11 18:18:37 2020 +0200
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
src/backends/meta-backend.c | 2 ++
src/backends/meta-monitor-manager-private.h | 2 ++
src/backends/meta-monitor-manager.c | 22 +++++++++++++++++++++-
3 files changed, 25 insertions(+), 1 deletion(-)
---
diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c
index 39f2754896..57cb43e201 100644
--- a/src/backends/meta-backend.c
+++ b/src/backends/meta-backend.c
@@ -573,6 +573,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
diff --git a/src/backends/meta-monitor-manager-private.h b/src/backends/meta-monitor-manager-private.h
index 7df72f7162..ac3bc94d68 100644
--- a/src/backends/meta-monitor-manager-private.h
+++ b/src/backends/meta-monitor-manager-private.h
@@ -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 */
diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c
index ff545da788..6084e4c37c 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);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]