[mutter/wip/carlosg/cycle-integrated-tablets] backends: Allow integrated tablet devices to cycle outputs



commit a96002717dfa34d2b72e801a97c3fed9ea8e6612
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Apr 16 12:59:12 2020 +0200

    backends: Allow integrated tablet devices to cycle outputs
    
    The work at https://gitlab.gnome.org/GNOME/gnome-control-center/issues/239
    intended to make integrated devices optionally mappable to other outputs
    (in order to allow fix mishandling from our heuristics, or to quickly reach
    things in other monitor without changing devices).
    
    This was missed in that plan, we do allow cycling outputs, but we still did
    prevent it from doing anything for integrated devices. Fix that, and change
    output cycling so we don't allow a "NULL" EDID for integrated devices, this
    makes those go through the MetaInputMapper (resulting in one output listed
    twice), instead of mapping to the full stage.
    
    Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1186

 src/backends/meta-input-settings.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c
index 5b2cee29f..9e526f53c 100644
--- a/src/backends/meta-input-settings.c
+++ b/src/backends/meta-input-settings.c
@@ -2179,6 +2179,7 @@ meta_input_settings_get_pad_button_action (MetaInputSettings   *input_settings,
 
 static gboolean
 cycle_logical_monitors (MetaInputSettings   *settings,
+                        gboolean             skip_all_monitors,
                         MetaLogicalMonitor  *current_logical_monitor,
                         MetaLogicalMonitor **next_logical_monitor)
 {
@@ -2188,7 +2189,8 @@ cycle_logical_monitors (MetaInputSettings   *settings,
   GList *logical_monitors;
 
   /* We cycle between:
-   * - the span of all monitors (current_output = NULL)
+   * - the span of all monitors (current_output = NULL), only for
+   *   non-integrated devices.
    * - each monitor individually.
    */
 
@@ -2206,6 +2208,8 @@ cycle_logical_monitors (MetaInputSettings   *settings,
       l = g_list_find (logical_monitors, current_logical_monitor);
       if (l->next)
         *next_logical_monitor = l->next->data;
+      else if (skip_all_monitors)
+        *next_logical_monitor = logical_monitors->data;
       else
         *next_logical_monitor = NULL;
     }
@@ -2221,6 +2225,7 @@ meta_input_settings_cycle_tablet_output (MetaInputSettings  *input_settings,
   DeviceMappingInfo *info;
   MetaLogicalMonitor *logical_monitor = NULL;
   const gchar *edid[4] = { 0 }, *pretty_name = NULL;
+  gboolean is_integrated_device = FALSE;
 #ifdef HAVE_LIBWACOM
   WacomDevice *wacom_device;
 #endif
@@ -2239,11 +2244,9 @@ meta_input_settings_cycle_tablet_output (MetaInputSettings  *input_settings,
 
   if (wacom_device)
     {
-      /* Output rotation only makes sense on external tablets */
-      if (libwacom_get_integration_flags (wacom_device) != WACOM_DEVICE_INTEGRATED_NONE)
-        return;
-
       pretty_name = libwacom_get_name (wacom_device);
+      is_integrated_device =
+        libwacom_get_integration_flags (wacom_device) != WACOM_DEVICE_INTEGRATED_NONE;
     }
 #endif
 
@@ -2251,6 +2254,7 @@ meta_input_settings_cycle_tablet_output (MetaInputSettings  *input_settings,
                                     NULL, &logical_monitor);
 
   if (!cycle_logical_monitors (input_settings,
+                               is_integrated_device,
                                logical_monitor,
                                &logical_monitor))
     return;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]