[gtk/wip/otte/dnd: 18/30] gdk: Remove gdk_surface_register_dnd()



commit b0f6996892574358313d73661b75e4ab536c6183
Author: Benjamin Otte <otte redhat com>
Date:   Sat Feb 22 15:56:36 2020 +0100

    gdk: Remove gdk_surface_register_dnd()
    
    All surfaces are expected to be DND surfaces from creation.

 gdk/broadway/gdkdisplay-broadway.c |  2 --
 gdk/broadway/gdkdnd-broadway.c     | 10 --------
 gdk/broadway/gdkprivate-broadway.h |  2 --
 gdk/broadway/gdksurface-broadway.c |  1 -
 gdk/gdksurface.c                   | 12 ---------
 gdk/gdksurface.h                   |  2 --
 gdk/gdksurfaceprivate.h            |  1 -
 gdk/quartz/gdkdnd-quartz.c         |  6 -----
 gdk/quartz/gdkprivate-quartz.h     |  1 -
 gdk/quartz/gdksurface-quartz.c     |  1 -
 gdk/wayland/gdkdrag-wayland.c      |  5 ----
 gdk/wayland/gdkprivate-wayland.h   |  1 -
 gdk/wayland/gdksurface-wayland.c   |  1 -
 gdk/win32/gdksurface-win32.c       |  2 +-
 gdk/x11/gdksurface-x11.c           |  3 ++-
 gtk/gtkdragdest.c                  | 52 --------------------------------------
 16 files changed, 3 insertions(+), 99 deletions(-)
---
diff --git a/gdk/broadway/gdkdisplay-broadway.c b/gdk/broadway/gdkdisplay-broadway.c
index 69a2d1085e..ba6dc7a9a7 100644
--- a/gdk/broadway/gdkdisplay-broadway.c
+++ b/gdk/broadway/gdkdisplay-broadway.c
@@ -171,8 +171,6 @@ _gdk_broadway_display_open (const gchar *display_name)
 
   gdk_event_init (display);
 
-  _gdk_broadway_display_init_dnd (display);
-
   if (display_name == NULL)
     display_name = g_getenv ("BROADWAY_DISPLAY");
 
diff --git a/gdk/broadway/gdkdnd-broadway.c b/gdk/broadway/gdkdnd-broadway.c
index a001cc31ae..f672d26ed8 100644
--- a/gdk/broadway/gdkdnd-broadway.c
+++ b/gdk/broadway/gdkdnd-broadway.c
@@ -104,16 +104,6 @@ _gdk_broadway_surface_drag_begin (GdkSurface         *surface,
   return new_context;
 }
 
-void
-_gdk_broadway_surface_register_dnd (GdkSurface      *surface)
-{
-}
-
-void
-_gdk_broadway_display_init_dnd (GdkDisplay *display)
-{
-}
-
 static void
 gdk_broadway_drag_class_init (GdkBroadwayDragClass *klass)
 {
diff --git a/gdk/broadway/gdkprivate-broadway.h b/gdk/broadway/gdkprivate-broadway.h
index c001978fc0..f414d3d79c 100644
--- a/gdk/broadway/gdkprivate-broadway.h
+++ b/gdk/broadway/gdkprivate-broadway.h
@@ -47,7 +47,6 @@ void gdk_broadway_surface_set_nodes (GdkSurface *surface,
                                      GArray *nodes,
                                      GPtrArray *node_textures);
 
-void     _gdk_broadway_surface_register_dnd       (GdkSurface      *surface);
 GdkDrag * _gdk_broadway_surface_drag_begin        (GdkSurface          *surface,
                                                    GdkDevice          *device,
                                                    GdkContentProvider *content,
@@ -91,7 +90,6 @@ void _gdk_broadway_events_got_input      (GdkDisplay *display,
                                           BroadwayInputMsg *message);
 
 void _gdk_broadway_display_init_root_window (GdkDisplay *display);
-void _gdk_broadway_display_init_dnd (GdkDisplay *display);
 GdkDisplay * _gdk_broadway_display_open (const gchar *display_name);
 void _gdk_broadway_display_queue_events (GdkDisplay *display);
 GdkCursor*_gdk_broadway_display_get_cursor_for_name (GdkDisplay  *display,
diff --git a/gdk/broadway/gdksurface-broadway.c b/gdk/broadway/gdksurface-broadway.c
index af946eef71..b8a4a57019 100644
--- a/gdk/broadway/gdksurface-broadway.c
+++ b/gdk/broadway/gdksurface-broadway.c
@@ -1462,6 +1462,5 @@ gdk_broadway_surface_class_init (GdkBroadwaySurfaceClass *klass)
   impl_class->begin_move_drag = gdk_broadway_surface_begin_move_drag;
   impl_class->set_opacity = gdk_broadway_surface_set_opacity;
   impl_class->destroy_notify = gdk_broadway_surface_destroy_notify;
-  impl_class->register_dnd = _gdk_broadway_surface_register_dnd;
   impl_class->drag_begin = _gdk_broadway_surface_drag_begin;
 }
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index 13b0dec48d..0717106aee 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -3560,18 +3560,6 @@ gdk_surface_destroy_notify (GdkSurface *surface)
   GDK_SURFACE_GET_CLASS (surface)->destroy_notify (surface);
 }
 
-/**
- * gdk_surface_register_dnd:
- * @surface: a #GdkSurface.
- *
- * Registers a surface as a potential drop destination.
- */
-void
-gdk_surface_register_dnd (GdkSurface *surface)
-{
-  GDK_SURFACE_GET_CLASS (surface)->register_dnd (surface);
-}
-
 /**
  * gdk_drag_begin:
  * @surface: the source surface for this drag
diff --git a/gdk/gdksurface.h b/gdk/gdksurface.h
index 1bf8b24eca..52141b1c26 100644
--- a/gdk/gdksurface.h
+++ b/gdk/gdksurface.h
@@ -532,8 +532,6 @@ void          gdk_surface_set_keep_below  (GdkSurface       *surface,
 GDK_AVAILABLE_IN_ALL
 void          gdk_surface_set_opacity     (GdkSurface       *surface,
                                            gdouble          opacity);
-GDK_AVAILABLE_IN_ALL
-void          gdk_surface_register_dnd    (GdkSurface       *surface);
 
 GDK_AVAILABLE_IN_ALL
 void gdk_surface_begin_resize_drag            (GdkSurface     *surface,
diff --git a/gdk/gdksurfaceprivate.h b/gdk/gdksurfaceprivate.h
index fa9674451d..e1e1f3687c 100644
--- a/gdk/gdksurfaceprivate.h
+++ b/gdk/gdksurfaceprivate.h
@@ -225,7 +225,6 @@ struct _GdkSurfaceClass
   void         (* set_opacity)          (GdkSurface *surface,
                                          gdouble    opacity);
   void         (* destroy_notify)       (GdkSurface *surface);
-  void         (* register_dnd)         (GdkSurface *surface);
   GdkDrag * (*drag_begin)               (GdkSurface        *surface,
                                          GdkDevice        *device,
                                          GdkContentProvider*content,
diff --git a/gdk/quartz/gdkdnd-quartz.c b/gdk/quartz/gdkdnd-quartz.c
index 4dd9cb8916..20430a4fcf 100644
--- a/gdk/quartz/gdkdnd-quartz.c
+++ b/gdk/quartz/gdkdnd-quartz.c
@@ -69,12 +69,6 @@ gdk_quartz_drag_context_drag_abort (GdkDragContext *context,
   /* FIXME: Implement */
 }
 
-void
-_gdk_quartz_surface_register_dnd (GdkSurface *window)
-{
-  /* FIXME: Implement */
-}
-
 id
 gdk_quartz_drag_context_get_dragging_info_libgtk_only (GdkDragContext *context)
 {
diff --git a/gdk/quartz/gdkprivate-quartz.h b/gdk/quartz/gdkprivate-quartz.h
index 24b9db564d..08c86fd42e 100644
--- a/gdk/quartz/gdkprivate-quartz.h
+++ b/gdk/quartz/gdkprivate-quartz.h
@@ -76,7 +76,6 @@ gboolean     _gdk_quartz_keys_is_modifier (guint      keycode);
 void         _gdk_quartz_synthesize_null_key_event (GdkSurface *window);
 
 /* Drag and Drop */
-void        _gdk_quartz_surface_register_dnd      (GdkSurface   *window);
 GdkDragContext * _gdk_quartz_surface_drag_begin   (GdkSurface   *window,
                                                    GdkDevice   *device,
                                                    GList       *targets,
diff --git a/gdk/quartz/gdksurface-quartz.c b/gdk/quartz/gdksurface-quartz.c
index ae259e7d42..cc21dedf23 100644
--- a/gdk/quartz/gdksurface-quartz.c
+++ b/gdk/quartz/gdksurface-quartz.c
@@ -2747,7 +2747,6 @@ gdk_surface_impl_quartz_class_init (GdkSurfaceImplQuartzClass *klass)
   impl_class->set_opacity = gdk_quartz_surface_set_opacity;
   impl_class->set_shadow_width = gdk_quartz_surface_set_shadow_width;
   impl_class->destroy_notify = gdk_quartz_surface_destroy_notify;
-  impl_class->register_dnd = _gdk_quartz_surface_register_dnd;
   impl_class->drag_begin = _gdk_quartz_surface_drag_begin;
   impl_class->process_updates_recurse = _gdk_quartz_surface_process_updates_recurse;
 
diff --git a/gdk/wayland/gdkdrag-wayland.c b/gdk/wayland/gdkdrag-wayland.c
index f7c2925c60..833309048a 100644
--- a/gdk/wayland/gdkdrag-wayland.c
+++ b/gdk/wayland/gdkdrag-wayland.c
@@ -198,11 +198,6 @@ gdk_wayland_drag_class_init (GdkWaylandDragClass *klass)
   drag_class->cancel = gdk_wayland_drag_cancel;
 }
 
-void
-_gdk_wayland_surface_register_dnd (GdkSurface *surface)
-{
-}
-
 static GdkSurface *
 create_dnd_surface (GdkDisplay *display)
 {
diff --git a/gdk/wayland/gdkprivate-wayland.h b/gdk/wayland/gdkprivate-wayland.h
index 64d761dfd7..396fa15ad2 100644
--- a/gdk/wayland/gdkprivate-wayland.h
+++ b/gdk/wayland/gdkprivate-wayland.h
@@ -99,7 +99,6 @@ void            gdk_wayland_surface_attach_image           (GdkSurface
                                                             cairo_surface_t      *cairo_surface,
                                                             const cairo_region_t *damage);
 
-void            _gdk_wayland_surface_register_dnd          (GdkSurface *surface);
 GdkDrag        *_gdk_wayland_surface_drag_begin            (GdkSurface *surface,
                                                             GdkDevice *device,
                                                             GdkContentProvider *content,
diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c
index ca81ce2e50..6b59f43c9e 100644
--- a/gdk/wayland/gdksurface-wayland.c
+++ b/gdk/wayland/gdksurface-wayland.c
@@ -3933,7 +3933,6 @@ gdk_wayland_surface_class_init (GdkWaylandSurfaceClass *klass)
   impl_class->begin_move_drag = gdk_wayland_surface_begin_move_drag;
   impl_class->set_opacity = gdk_wayland_surface_set_opacity;
   impl_class->destroy_notify = gdk_wayland_surface_destroy_notify;
-  impl_class->register_dnd = _gdk_wayland_surface_register_dnd;
   impl_class->drag_begin = _gdk_wayland_surface_drag_begin;
   impl_class->get_scale_factor = gdk_wayland_surface_get_scale_factor;
   impl_class->set_opaque_region = gdk_wayland_surface_set_opaque_region;
diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c
index c69df8f7b5..8e877ed3d7 100644
--- a/gdk/win32/gdksurface-win32.c
+++ b/gdk/win32/gdksurface-win32.c
@@ -650,6 +650,7 @@ _gdk_win32_display_create_surface (GdkDisplay     *display,
     }
 
   _gdk_win32_surface_enable_transparency (surface);
+  _gdk_win32_surface_register_dnd (surface);
 
   g_signal_connect (frame_clock,
                     "after-paint",
@@ -5236,7 +5237,6 @@ gdk_win32_surface_class_init (GdkWin32SurfaceClass *klass)
   impl_class->begin_move_drag = gdk_win32_surface_begin_move_drag;
   impl_class->set_opacity = gdk_win32_surface_set_opacity;
   impl_class->destroy_notify = gdk_win32_surface_destroy_notify;
-  impl_class->register_dnd = _gdk_win32_surface_register_dnd;
   impl_class->drag_begin = _gdk_win32_surface_drag_begin;
   impl_class->create_gl_context = _gdk_win32_surface_create_gl_context;
   impl_class->get_scale_factor = _gdk_win32_surface_get_scale_factor;
diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c
index 8d052e9d3d..699bcf2864 100644
--- a/gdk/x11/gdksurface-x11.c
+++ b/gdk/x11/gdksurface-x11.c
@@ -923,6 +923,8 @@ _gdk_x11_display_create_surface (GdkDisplay     *display,
                                       GDK_SURFACE_XID (surface), GDK_ALL_EVENTS_MASK,
                                       StructureNotifyMask | PropertyChangeMask);
 
+  _gdk_x11_surface_register_dnd (surface);
+
   connect_frame_clock (surface);
 
   gdk_surface_freeze_updates (surface);
@@ -4730,7 +4732,6 @@ gdk_x11_surface_class_init (GdkX11SurfaceClass *klass)
   impl_class->begin_move_drag = gdk_x11_surface_begin_move_drag;
   impl_class->set_opacity = gdk_x11_surface_set_opacity;
   impl_class->destroy_notify = gdk_x11_surface_destroy_notify;
-  impl_class->register_dnd = _gdk_x11_surface_register_dnd;
   impl_class->drag_begin = _gdk_x11_surface_drag_begin;
   impl_class->get_scale_factor = gdk_x11_surface_get_scale_factor;
   impl_class->set_opaque_region = gdk_x11_surface_set_opaque_region;
diff --git a/gtk/gtkdragdest.c b/gtk/gtkdragdest.c
index 8742dc6e8a..dbbc03a8d0 100644
--- a/gtk/gtkdragdest.c
+++ b/gtk/gtkdragdest.c
@@ -122,9 +122,6 @@ static gboolean gtk_drop_target_handle_event (GtkEventController *controller,
                                               double              y);
 static gboolean gtk_drop_target_filter_event (GtkEventController *controller,
                                               GdkEvent           *event);
-static void     gtk_drop_target_set_widget   (GtkEventController *controller,
-                                              GtkWidget          *widget);
-static void     gtk_drop_target_unset_widget (GtkEventController *controller);
 
 static gboolean gtk_drop_target_get_contains (GtkDropTarget *dest);
 static void     gtk_drop_target_set_contains (GtkDropTarget *dest,
@@ -221,8 +218,6 @@ gtk_drop_target_class_init (GtkDropTargetClass *class)
 
   controller_class->handle_event = gtk_drop_target_handle_event;
   controller_class->filter_event = gtk_drop_target_filter_event;
-  controller_class->set_widget = gtk_drop_target_set_widget;
-  controller_class->unset_widget = gtk_drop_target_unset_widget;
 
   class->accept = gtk_drop_target_accept;
 
@@ -499,25 +494,6 @@ gtk_drop_target_get_actions (GtkDropTarget *dest)
   return dest->actions;
 }
 
-static void
-gtk_drag_dest_realized (GtkWidget *widget)
-{
-  GtkNative *native = gtk_widget_get_native (widget);
-
-  gdk_surface_register_dnd (gtk_native_get_surface (native));
-}
-
-static void
-gtk_drag_dest_hierarchy_changed (GtkWidget  *widget,
-                                 GParamSpec *pspec,
-                                 gpointer    data)
-{
-  GtkNative *native = gtk_widget_get_native (widget);
-
-  if (native && gtk_widget_get_realized (GTK_WIDGET (native)))
-    gdk_surface_register_dnd (gtk_native_get_surface (native));
-}
-
 /**
  * gtk_drop_target_get_drop:
  * @dest: a #GtkDropTarget
@@ -838,34 +814,6 @@ gtk_drag_dest_handle_event (GtkWidget *toplevel,
     }
 }
 
-static void
-gtk_drop_target_set_widget (GtkEventController *controller,
-                            GtkWidget          *widget)
-{
-  GtkDropTarget *dest = GTK_DROP_TARGET (controller);
-
-  GTK_EVENT_CONTROLLER_CLASS (gtk_drop_target_parent_class)->set_widget (controller, widget);
-
-  if (gtk_widget_get_realized (widget))
-    gtk_drag_dest_realized (widget);
-
-  g_signal_connect (widget, "realize", G_CALLBACK (gtk_drag_dest_realized), dest);
-  g_signal_connect (widget, "notify::root", G_CALLBACK (gtk_drag_dest_hierarchy_changed), dest);
-}
-
-static void
-gtk_drop_target_unset_widget (GtkEventController *controller)
-{
-  GtkWidget *widget;
-
-  widget = gtk_event_controller_get_widget (controller);
-
-  g_signal_handlers_disconnect_by_func (widget, gtk_drag_dest_realized, controller);
-  g_signal_handlers_disconnect_by_func (widget, gtk_drag_dest_hierarchy_changed, controller);
-
-  GTK_EVENT_CONTROLLER_CLASS (gtk_drop_target_parent_class)->unset_widget (controller);
-}
-
 static void
 gtk_drag_get_data_got_data (GObject      *source,
                             GAsyncResult *result,


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