[mutter] core: Handle special actions associated to pad buttons in generic code



commit 1831a1dd9b24327373aaafadddd70fa05117ea37
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Oct 25 17:01:37 2016 +0200

    core: Handle special actions associated to pad buttons in generic code
    
    And remove the wayland-specific handling. This works for both Wayland and
    X11 (provided the compositor receives pad events through a passive grab
    there).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=773779

 src/core/events.c                     |   16 ++++++++++++++++
 src/wayland/meta-wayland-tablet-pad.c |   32 --------------------------------
 2 files changed, 16 insertions(+), 32 deletions(-)
---
diff --git a/src/core/events.c b/src/core/events.c
index a6f4a50..1edff87 100644
--- a/src/core/events.c
+++ b/src/core/events.c
@@ -217,6 +217,22 @@ meta_display_handle_event (MetaDisplay        *display,
     }
 #endif
 
+  if (!display->current_pad_osd &&
+      (event->type == CLUTTER_PAD_BUTTON_PRESS ||
+       event->type == CLUTTER_PAD_BUTTON_RELEASE))
+    {
+      MetaBackend *backend = meta_get_backend ();
+
+      if (meta_input_settings_handle_pad_button (meta_backend_get_input_settings (backend),
+                                                 clutter_event_get_source_device (event),
+                                                 event->type == CLUTTER_PAD_BUTTON_PRESS,
+                                                 event->pad_button.button))
+        {
+          bypass_wayland = bypass_clutter = TRUE;
+          goto out;
+        }
+    }
+
   source = clutter_event_get_source_device (event);
 
   if (source)
diff --git a/src/wayland/meta-wayland-tablet-pad.c b/src/wayland/meta-wayland-tablet-pad.c
index 9995692..2184112 100644
--- a/src/wayland/meta-wayland-tablet-pad.c
+++ b/src/wayland/meta-wayland-tablet-pad.c
@@ -358,26 +358,6 @@ handle_pad_button_event (MetaWaylandTabletPad *pad,
   return TRUE;
 }
 
-static void
-meta_wayland_tablet_pad_update_action (MetaWaylandTabletPad *pad,
-                                       const ClutterEvent   *event)
-{
-  MetaInputSettings *input_settings;
-  ClutterInputDevice *device;
-  guint button;
-
-  button = event->pad_button.button;
-  device = clutter_event_get_source_device (event);
-  input_settings = meta_backend_get_input_settings (meta_get_backend ());
-
-  if (!input_settings)
-    return;
-
-  meta_input_settings_handle_pad_button (input_settings, device,
-                                         event->type == CLUTTER_PAD_BUTTON_PRESS,
-                                         button);
-}
-
 static gboolean
 meta_wayland_tablet_pad_handle_event_action (MetaWaylandTabletPad *pad,
                                              const ClutterEvent   *event)
@@ -566,18 +546,6 @@ meta_wayland_tablet_pad_update (MetaWaylandTabletPad *pad,
 
   if (group)
     meta_wayland_tablet_pad_group_update (group, event);
-
-  switch (event->type)
-    {
-    case CLUTTER_PAD_BUTTON_PRESS:
-    case CLUTTER_PAD_BUTTON_RELEASE:
-      meta_wayland_tablet_pad_update_action (pad, event);
-      break;
-    case CLUTTER_PAD_RING:
-    case CLUTTER_PAD_STRIP:
-    default:
-      break;
-    }
 }
 
 static gchar *


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