[mutter/wip/carlosg/touch-mode: 1/3] clutter: Add ClutterSeat::touch-mode boolean property



commit f0ed8a992102cc6acb367f3c6a93616e01685e44
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Feb 10 19:57:38 2020 +0100

    clutter: Add ClutterSeat::touch-mode boolean property
    
    And the corresponding getter. This property returns FALSE by default
    and must be overridden by subclasses. This will allow gnome-shell to
    hook up specific behavior that should not happen on mouse+keyboard
    setups.

 clutter/clutter/clutter-seat.c | 24 ++++++++++++++++++++++++
 clutter/clutter/clutter-seat.h |  2 ++
 2 files changed, 26 insertions(+)
---
diff --git a/clutter/clutter/clutter-seat.c b/clutter/clutter/clutter-seat.c
index 6ff1fffe9..9350bfd11 100644
--- a/clutter/clutter/clutter-seat.c
+++ b/clutter/clutter/clutter-seat.c
@@ -50,6 +50,7 @@ enum
 {
   PROP_0,
   PROP_BACKEND,
+  PROP_TOUCH_MODE,
   N_PROPS
 };
 
@@ -84,6 +85,7 @@ clutter_seat_set_property (GObject      *object,
     case PROP_BACKEND:
       priv->backend = g_value_get_object (value);
       break;
+    case PROP_TOUCH_MODE:
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
     }
@@ -103,6 +105,9 @@ clutter_seat_get_property (GObject    *object,
     case PROP_BACKEND:
       g_value_set_object (value, priv->backend);
       break;
+    case PROP_TOUCH_MODE:
+      g_value_set_boolean (value, FALSE);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
     }
@@ -277,6 +282,13 @@ clutter_seat_class_init (ClutterSeatClass *klass)
                          CLUTTER_TYPE_BACKEND,
                          CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
 
+  props[PROP_TOUCH_MODE] =
+    g_param_spec_boolean ("touch-mode",
+                          P_("Touch mode"),
+                          P_("Touch mode"),
+                          FALSE,
+                          CLUTTER_PARAM_READABLE);
+
   g_object_class_install_properties (object_class, N_PROPS, props);
 }
 
@@ -556,3 +568,15 @@ clutter_seat_warp_pointer (ClutterSeat *seat,
 
   CLUTTER_SEAT_GET_CLASS (seat)->warp_pointer (seat, x, y);
 }
+
+gboolean
+clutter_seat_get_touch_mode (ClutterSeat *seat)
+{
+  gboolean touch_mode;
+
+  g_return_val_if_fail (CLUTTER_IS_SEAT (seat), FALSE);
+
+  g_object_get (G_OBJECT (seat), "touch-mode", &touch_mode, NULL);
+
+  return touch_mode;
+}
diff --git a/clutter/clutter/clutter-seat.h b/clutter/clutter/clutter-seat.h
index f8754f647..f5f0127bb 100644
--- a/clutter/clutter/clutter-seat.h
+++ b/clutter/clutter/clutter-seat.h
@@ -174,5 +174,7 @@ CLUTTER_EXPORT
 void clutter_seat_warp_pointer (ClutterSeat *seat,
                                 int          x,
                                 int          y);
+CLUTTER_EXPORT
+gboolean clutter_seat_get_touch_mode (ClutterSeat *seat);
 
 #endif /* CLUTTER_SEAT_H */


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