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




commit 766d5299d375850f0a8a83a8e82f3aec35ecc4ed
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
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1201

 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 8a9c2d72bb..0a0667688a 100644
--- a/src/backends/meta-input-settings.c
+++ b/src/backends/meta-input-settings.c
@@ -2246,6 +2246,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)
 {
@@ -2255,7 +2256,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_logical_monitor = NULL), only for
+   *   non-integrated devices.
    * - each monitor individually.
    */
 
@@ -2273,6 +2275,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;
     }
@@ -2288,6 +2292,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
@@ -2306,11 +2311,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
 
@@ -2318,6 +2321,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]