[gtk+] Drop support for setting event masks for floating devices



commit 480ea400f311620c69ff0e018b43393f4c1df0f0
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Nov 23 16:21:37 2017 -0500

    Drop support for setting event masks for floating devices
    
    These are very rarely needed, and are X11-specific.
    If it turns out that somebody needs this, it can come
    back as X11-specific functionality.

 docs/reference/gdk/gdk4-sections.txt |    2 -
 gdk/gdkinternals.h                   |    4 -
 gdk/gdkwindow.c                      |  144 ----------------------------------
 gdk/gdkwindow.h                      |    8 --
 4 files changed, 0 insertions(+), 158 deletions(-)
---
diff --git a/docs/reference/gdk/gdk4-sections.txt b/docs/reference/gdk/gdk4-sections.txt
index ef7b38c..a52b0ba 100644
--- a/docs/reference/gdk/gdk4-sections.txt
+++ b/docs/reference/gdk/gdk4-sections.txt
@@ -328,8 +328,6 @@ gdk_window_get_device_cursor
 gdk_window_set_device_cursor
 gdk_window_get_device_events
 gdk_window_set_device_events
-gdk_window_get_source_events
-gdk_window_set_source_events
 gdk_window_get_event_compression
 gdk_window_set_event_compression
 
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 6ea7132..15913d8 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -279,10 +279,6 @@ struct _GdkWindow
   GList *devices_inside;
   GHashTable *device_events;
 
-  GHashTable *source_event_masks;
-  gulong device_added_handler_id;
-  gulong device_changed_handler_id;
-
   GdkFrameClock *frame_clock; /* NULL to use from parent or default */
 
   GdkDrawingContext *drawing_context;
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index edb7d77..31ff1e4 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -381,9 +381,6 @@ gdk_window_finalize (GObject *object)
   if (window->device_events)
     g_hash_table_destroy (window->device_events);
 
-  if (window->source_event_masks)
-    g_hash_table_destroy (window->source_event_masks);
-
   if (window->devices_inside)
     g_list_free (window->devices_inside);
 
@@ -5546,147 +5543,6 @@ _gdk_display_set_window_under_pointer (GdkDisplay *display,
     }
 }
 
-static void
-source_events_device_added (GdkDeviceManager *device_manager,
-                            GdkDevice        *device,
-                            gpointer          user_data)
-{
-  GdkWindow *window;
-  GdkEventMask event_mask;
-  GdkInputSource source;
-
-  if (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_FLOATING)
-    return;
-
-  window = user_data;
-  source = gdk_device_get_source (device);
-
-  event_mask = GPOINTER_TO_INT (g_hash_table_lookup (window->source_event_masks,
-                                                     GINT_TO_POINTER (source)));
-  if (event_mask)
-    gdk_window_set_device_events (window, device, event_mask);
-}
-
-static void
-source_events_device_changed (GdkDeviceManager *device_manager,
-                              GdkDevice        *device,
-                              gpointer          user_data)
-{
-  GdkDeviceType type;
-  GdkInputSource source;
-  GdkEventMask event_mask;
-  GdkWindow *window;
-
-  window = user_data;
-  type = gdk_device_get_device_type (device);
-  source = gdk_device_get_source (device);
-
-  event_mask = GPOINTER_TO_INT (g_hash_table_lookup (window->source_event_masks,
-                                                     GINT_TO_POINTER (source)));
-
-  if (!event_mask)
-    return;
-
-  if (type == GDK_DEVICE_TYPE_FLOATING)
-    {
-      /* The device was just floated, enable its event mask */
-      gdk_window_set_device_events (window, device, event_mask);
-    }
-  else if (type == GDK_DEVICE_TYPE_SLAVE)
-    gdk_window_set_device_events (window, device, 0);
-}
-
-/**
- * gdk_window_set_source_events:
- * @window: a #GdkWindow
- * @source: a #GdkInputSource to define the source class.
- * @event_mask: event mask for @window
- *
- * Sets the event mask for any floating device (i.e. not attached to any
- * visible pointer) that has the source defined as @source. This event
- * mask will be applied both to currently existing, newly added devices
- * after this call, and devices being attached/detached.
- *
- * Since: 3.0
- **/
-void
-gdk_window_set_source_events (GdkWindow      *window,
-                              GdkInputSource  source,
-                              GdkEventMask    event_mask)
-{
-  GdkDeviceManager *device_manager;
-  GdkDisplay *display;
-  GList *devices, *d;
-  guint size;
-
-  g_return_if_fail (GDK_IS_WINDOW (window));
-
-  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-  display = gdk_window_get_display (window);
-  device_manager = gdk_display_get_device_manager (display);
-
-  devices = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_FLOATING);
-
-  /* Set event mask for existing devices */
-  for (d = devices; d; d = d->next)
-    {
-      GdkDevice *device = d->data;
-
-      if (source == gdk_device_get_source (device))
-        gdk_window_set_device_events (window, device, event_mask);
-    }
-
-  g_list_free (devices);
-  G_GNUC_END_IGNORE_DEPRECATIONS;
-
-  /* Update accounting */
-  if (G_UNLIKELY (!window->source_event_masks))
-    window->source_event_masks = g_hash_table_new (NULL, NULL);
-
-  if (event_mask)
-    g_hash_table_insert (window->source_event_masks,
-                         GUINT_TO_POINTER (source),
-                         GUINT_TO_POINTER (event_mask));
-  else
-    g_hash_table_remove (window->source_event_masks,
-                         GUINT_TO_POINTER (source));
-
-  size = g_hash_table_size (window->source_event_masks);
-
-  /* Update handler if needed */
-  if (!window->device_added_handler_id && size > 0)
-    {
-      window->device_added_handler_id =
-        g_signal_connect (device_manager, "device-added",
-                          G_CALLBACK (source_events_device_added), window);
-      window->device_changed_handler_id =
-        g_signal_connect (device_manager, "device-changed",
-                          G_CALLBACK (source_events_device_changed), window);
-    }
-  else if (window->device_added_handler_id && size == 0)
-    g_signal_handler_disconnect (device_manager, window->device_added_handler_id);
-}
-
-/**
- * gdk_window_get_source_events:
- * @window: a #GdkWindow
- * @source: a #GdkInputSource to define the source class.
- *
- * Returns the event mask for @window corresponding to the device class specified
- * by @source.
- *
- * Returns: source event mask for @window
- **/
-GdkEventMask
-gdk_window_get_source_events (GdkWindow      *window,
-                              GdkInputSource  source)
-{
-  g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
-
-  return GPOINTER_TO_UINT (g_hash_table_lookup (window->source_event_masks,
-                                                GUINT_TO_POINTER (source)));
-}
-
 #define GDK_ANY_BUTTON_MASK (GDK_BUTTON1_MASK | \
                             GDK_BUTTON2_MASK | \
                             GDK_BUTTON3_MASK | \
diff --git a/gdk/gdkwindow.h b/gdk/gdkwindow.h
index a9fbb67..a75d296 100644
--- a/gdk/gdkwindow.h
+++ b/gdk/gdkwindow.h
@@ -715,14 +715,6 @@ GdkEventMask  gdk_window_get_device_events (GdkWindow    *window,
                                             GdkDevice    *device);
 
 GDK_AVAILABLE_IN_ALL
-void          gdk_window_set_source_events (GdkWindow      *window,
-                                            GdkInputSource  source,
-                                            GdkEventMask    event_mask);
-GDK_AVAILABLE_IN_ALL
-GdkEventMask  gdk_window_get_source_events (GdkWindow      *window,
-                                            GdkInputSource  source);
-
-GDK_AVAILABLE_IN_ALL
 void          gdk_window_set_icon_list   (GdkWindow       *window,
                                          GList           *surfaces);
 GDK_AVAILABLE_IN_ALL


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