[mutter/wip/carlosg/input-thread: 62/96] clutter: Drop ClutterInputDevice::enabled and setter/getter




commit 24d840e60436f21f9e6c2fb7f7221fe836198e12
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Jul 16 12:13:04 2020 +0200

    clutter: Drop ClutterInputDevice::enabled and setter/getter
    
    This is unused now, and not something we generally allow.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403

 clutter/clutter/clutter-event.c                |  9 ---
 clutter/clutter/clutter-input-device.c         | 78 --------------------------
 clutter/clutter/clutter-input-device.h         |  5 --
 src/backends/native/meta-input-device-native.c |  2 -
 src/backends/x11/meta-seat-x11.c               | 10 +---
 src/tests/clutter/interactive/test-devices.c   |  4 --
 6 files changed, 1 insertion(+), 107 deletions(-)
---
diff --git a/clutter/clutter/clutter-event.c b/clutter/clutter/clutter-event.c
index 51bec88812..87788acad8 100644
--- a/clutter/clutter/clutter-event.c
+++ b/clutter/clutter/clutter-event.c
@@ -1566,21 +1566,12 @@ _clutter_event_push (const ClutterEvent *event,
                      gboolean            do_copy)
 {
   ClutterMainContext *context = _clutter_context_get_default ();
-  ClutterInputDevice *device;
 
   g_assert (context != NULL);
 
   if (context->events_queue == NULL)
     context->events_queue = g_queue_new ();
 
-  /* disabled devices don't propagate events */
-  device = clutter_event_get_device (event);
-  if (device != NULL)
-    {
-      if (!clutter_input_device_get_enabled (device))
-        return;
-    }
-
   if (do_copy)
     {
       ClutterEvent *copy;
diff --git a/clutter/clutter/clutter-input-device.c b/clutter/clutter/clutter-input-device.c
index e920552aed..651ed48362 100644
--- a/clutter/clutter/clutter-input-device.c
+++ b/clutter/clutter/clutter-input-device.c
@@ -61,7 +61,6 @@ enum
   PROP_DEVICE_MODE,
 
   PROP_HAS_CURSOR,
-  PROP_ENABLED,
 
   PROP_N_AXES,
 
@@ -189,10 +188,6 @@ clutter_input_device_set_property (GObject      *gobject,
       self->has_cursor = g_value_get_boolean (value);
       break;
 
-    case PROP_ENABLED:
-      clutter_input_device_set_enabled (self, g_value_get_boolean (value));
-      break;
-
     case PROP_VENDOR_ID:
       self->vendor_id = g_value_dup_string (value);
       break;
@@ -265,10 +260,6 @@ clutter_input_device_get_property (GObject    *gobject,
       g_value_set_uint (value, clutter_input_device_get_n_axes (self));
       break;
 
-    case PROP_ENABLED:
-      g_value_set_boolean (value, self->is_enabled);
-      break;
-
     case PROP_VENDOR_ID:
       g_value_set_string (value, self->vendor_id);
       break;
@@ -392,25 +383,6 @@ clutter_input_device_class_init (ClutterInputDeviceClass *klass)
                           FALSE,
                           CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
 
-  /**
-   * ClutterInputDevice:enabled:
-   *
-   * Whether the device is enabled.
-   *
-   * A device with the #ClutterInputDevice:device-mode property set
-   * to %CLUTTER_INPUT_MODE_LOGICAL cannot be disabled.
-   *
-   * A device must be enabled in order to receive events from it.
-   *
-   * Since: 1.6
-   */
-  obj_props[PROP_ENABLED] =
-    g_param_spec_boolean ("enabled",
-                          P_("Enabled"),
-                          P_("Whether the device is enabled"),
-                          FALSE,
-                          CLUTTER_PARAM_READWRITE);
-
   /**
    * ClutterInputDevice:n-axes:
    *
@@ -765,56 +737,6 @@ clutter_input_device_get_device_id (ClutterInputDevice *device)
   return device->id;
 }
 
-/**
- * clutter_input_device_set_enabled:
- * @device: a #ClutterInputDevice
- * @enabled: %TRUE to enable the @device
- *
- * Enables or disables a #ClutterInputDevice.
- *
- * Only devices with a #ClutterInputDevice:device-mode property set
- * to %CLUTTER_INPUT_MODE_PHYSICAL or %CLUTTER_INPUT_MODE_FLOATING can
- * be disabled.
- *
- * Since: 1.6
- */
-void
-clutter_input_device_set_enabled (ClutterInputDevice *device,
-                                  gboolean            enabled)
-{
-  g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
-
-  enabled = !!enabled;
-
-  if (!enabled && device->device_mode == CLUTTER_INPUT_MODE_LOGICAL)
-    return;
-
-  if (device->is_enabled == enabled)
-    return;
-
-  device->is_enabled = enabled;
-
-  g_object_notify_by_pspec (G_OBJECT (device), obj_props[PROP_ENABLED]);
-}
-
-/**
- * clutter_input_device_get_enabled:
- * @device: a #ClutterInputDevice
- *
- * Retrieves whether @device is enabled.
- *
- * Return value: %TRUE if the device is enabled
- *
- * Since: 1.6
- */
-gboolean
-clutter_input_device_get_enabled (ClutterInputDevice *device)
-{
-  g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE);
-
-  return device->is_enabled;
-}
-
 /**
  * clutter_input_device_get_coords:
  * @device: a #ClutterInputDevice
diff --git a/clutter/clutter/clutter-input-device.h b/clutter/clutter/clutter-input-device.h
index 536cf8c572..d849d7f8f6 100644
--- a/clutter/clutter/clutter-input-device.h
+++ b/clutter/clutter/clutter-input-device.h
@@ -100,11 +100,6 @@ CLUTTER_EXPORT
 ClutterInputMode        clutter_input_device_get_device_mode    (ClutterInputDevice  *device);
 CLUTTER_EXPORT
 gboolean                clutter_input_device_get_has_cursor     (ClutterInputDevice  *device);
-CLUTTER_EXPORT
-void                    clutter_input_device_set_enabled        (ClutterInputDevice  *device,
-                                                                 gboolean             enabled);
-CLUTTER_EXPORT
-gboolean                clutter_input_device_get_enabled        (ClutterInputDevice  *device);
 
 CLUTTER_EXPORT
 guint                   clutter_input_device_get_n_axes         (ClutterInputDevice  *device);
diff --git a/src/backends/native/meta-input-device-native.c b/src/backends/native/meta-input-device-native.c
index b6208ff1ac..4e3e9cd002 100644
--- a/src/backends/native/meta-input-device-native.c
+++ b/src/backends/native/meta-input-device-native.c
@@ -1304,7 +1304,6 @@ meta_input_device_native_new (MetaSeatNative         *seat,
                          "name", libinput_device_get_name (libinput_device),
                          "device-type", type,
                          "device-mode", CLUTTER_INPUT_MODE_PHYSICAL,
-                         "enabled", TRUE,
                          "vendor-id", vendor,
                          "product-id", product,
                          "n-rings", n_rings,
@@ -1367,7 +1366,6 @@ meta_input_device_native_new_virtual (MetaSeatNative         *seat,
                          "name", name,
                          "device-type", type,
                          "device-mode", mode,
-                         "enabled", TRUE,
                          "seat", seat,
                          NULL);
 
diff --git a/src/backends/x11/meta-seat-x11.c b/src/backends/x11/meta-seat-x11.c
index e1bef43dc9..8fc36052b6 100644
--- a/src/backends/x11/meta-seat-x11.c
+++ b/src/backends/x11/meta-seat-x11.c
@@ -473,7 +473,6 @@ create_device (MetaSeatX11    *seat_x11,
   ClutterInputDeviceType source, touch_source;
   ClutterInputDevice *retval;
   ClutterInputMode mode;
-  gboolean is_enabled;
   uint32_t num_touches = 0, num_rings = 0, num_strips = 0;
   char *vendor_id = NULL, *product_id = NULL, *node_path = NULL;
 
@@ -519,19 +518,16 @@ create_device (MetaSeatX11    *seat_x11,
     case XIMasterKeyboard:
     case XIMasterPointer:
       mode = CLUTTER_INPUT_MODE_LOGICAL;
-      is_enabled = TRUE;
       break;
 
     case XISlaveKeyboard:
     case XISlavePointer:
       mode = CLUTTER_INPUT_MODE_PHYSICAL;
-      is_enabled = FALSE;
       break;
 
     case XIFloatingSlave:
     default:
       mode = CLUTTER_INPUT_MODE_FLOATING;
-      is_enabled = FALSE;
       break;
     }
 
@@ -543,10 +539,7 @@ create_device (MetaSeatX11    *seat_x11,
     }
 
   if (source == CLUTTER_PAD_DEVICE)
-    {
-      is_enabled = TRUE;
-      get_pad_features (info, &num_rings, &num_strips);
-    }
+    get_pad_features (info, &num_rings, &num_strips);
 
   retval = g_object_new (META_TYPE_INPUT_DEVICE_X11,
                          "name", info->name,
@@ -555,7 +548,6 @@ create_device (MetaSeatX11    *seat_x11,
                          "device-type", source,
                          "device-mode", mode,
                          "backend", backend,
-                         "enabled", is_enabled,
                          "vendor-id", vendor_id,
                          "product-id", product_id,
                          "device-node", node_path,
diff --git a/src/tests/clutter/interactive/test-devices.c b/src/tests/clutter/interactive/test-devices.c
index 606babdf40..f6247e7851 100644
--- a/src/tests/clutter/interactive/test-devices.c
+++ b/src/tests/clutter/interactive/test-devices.c
@@ -173,8 +173,6 @@ seat_device_added_cb (ClutterSeat        *seat,
       g_print ("*** enabling device '%s' ***\n",
                clutter_input_device_get_device_name (device));
 
-      clutter_input_device_set_enabled (device, TRUE);
-
       hand = clutter_test_utils_create_texture_from_file (TESTS_DATADIR
                                                           G_DIR_SEPARATOR_S
                                                           "redhand.png",
@@ -272,8 +270,6 @@ test_devices_main (int argc, char **argv)
           g_print ("*** enabling device '%s' ***\n",
                    clutter_input_device_get_device_name (device));
 
-          clutter_input_device_set_enabled (device, TRUE);
-
           hand = clutter_test_utils_create_texture_from_file (TESTS_DATADIR
                                                               G_DIR_SEPARATOR_S
                                                               "redhand.png",


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