[gtk+] dnd: Remove 2 vfuncs that aren't needed



commit 3e0fab6b9325160a8851173cc78b2bbd42fc5f65
Author: Benjamin Otte <otte redhat com>
Date:   Sun Dec 17 20:29:11 2017 +0100

    dnd: Remove 2 vfuncs that aren't needed
    
    They're only used inside the X11 backend, and the backend can just call
    its own function.

 gdk/broadway/gdkdnd-broadway.c |   29 ---------------
 gdk/gdkdnd.c                   |   74 ----------------------------------------
 gdk/gdkdndprivate.h            |   28 ---------------
 gdk/quartz/gdkdnd-quartz.c     |   27 --------------
 gdk/wayland/gdkdnd-wayland.c   |   46 -------------------------
 gdk/x11/gdkdnd-x11.c           |   16 ++++-----
 6 files changed, 7 insertions(+), 213 deletions(-)
---
diff --git a/gdk/broadway/gdkdnd-broadway.c b/gdk/broadway/gdkdnd-broadway.c
index 4c78b06..cbbd63a 100644
--- a/gdk/broadway/gdkdnd-broadway.c
+++ b/gdk/broadway/gdkdnd-broadway.c
@@ -104,33 +104,6 @@ _gdk_broadway_window_drag_begin (GdkWindow          *window,
   return new_context;
 }
 
-static GdkWindow *
-gdk_broadway_drag_context_find_window (GdkDragContext  *context,
-                                      GdkWindow       *drag_window,
-                                      gint             x_root,
-                                      gint             y_root,
-                                      GdkDragProtocol *protocol)
-{
-  g_return_val_if_fail (context != NULL, NULL);
-  return NULL;
-}
-
-static gboolean
-gdk_broadway_drag_context_drag_motion (GdkDragContext *context,
-                                      GdkWindow      *dest_window,
-                                      GdkDragProtocol protocol,
-                                      gint            x_root,
-                                      gint            y_root,
-                                      GdkDragAction   suggested_action,
-                                      GdkDragAction   possible_actions,
-                                      guint32         time)
-{
-  g_return_val_if_fail (context != NULL, FALSE);
-  g_return_val_if_fail (dest_window == NULL || GDK_WINDOW_IS_BROADWAY (dest_window), FALSE);
-
-  return FALSE;
-}
-
 static void
 gdk_broadway_drag_context_drag_drop (GdkDragContext *context,
                                     guint32         time)
@@ -197,9 +170,7 @@ gdk_broadway_drag_context_class_init (GdkBroadwayDragContextClass *klass)
 
   object_class->finalize = gdk_broadway_drag_context_finalize;
 
-  context_class->find_window = gdk_broadway_drag_context_find_window;
   context_class->drag_status = gdk_broadway_drag_context_drag_status;
-  context_class->drag_motion = gdk_broadway_drag_context_drag_motion;
   context_class->drag_abort = gdk_broadway_drag_context_drag_abort;
   context_class->drag_drop = gdk_broadway_drag_context_drag_drop;
   context_class->drop_reply = gdk_broadway_drag_context_drop_reply;
diff --git a/gdk/gdkdnd.c b/gdk/gdkdnd.c
index b88d83b..725d70d 100644
--- a/gdk/gdkdnd.c
+++ b/gdk/gdkdnd.c
@@ -506,38 +506,6 @@ gdk_drag_context_class_init (GdkDragContextClass *klass)
   g_object_class_install_properties (object_class, N_PROPERTIES, properties);
 }
 
-/*
- * gdk_drag_find_window:
- * @context: a #GdkDragContext
- * @drag_window: a window which may be at the pointer position, but
- *     should be ignored, since it is put up by the drag source as an icon
- * @x_root: the x position of the pointer in root coordinates
- * @y_root: the y position of the pointer in root coordinates
- * @dest_window: (out): location to store the destination window in
- * @protocol: (out): location to store the DND protocol in
- *
- * Finds the destination window and DND protocol to use at the
- * given pointer position.
- *
- * This function is called by the drag source to obtain the
- * @dest_window and @protocol parameters for gdk_drag_motion().
- *
- * Since: 2.2
- */
-void
-gdk_drag_find_window (GdkDragContext  *context,
-                      GdkWindow       *drag_window,
-                      gint             x_root,
-                      gint             y_root,
-                      GdkWindow      **dest_window,
-                      GdkDragProtocol *protocol)
-{
-  g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
-
-  *dest_window = GDK_DRAG_CONTEXT_GET_CLASS (context)
-      ->find_window (context, drag_window, x_root, y_root, protocol);
-}
-
 /**
  * gdk_drag_status:
  * @context: a #GdkDragContext
@@ -561,48 +529,6 @@ gdk_drag_status (GdkDragContext *context,
 }
 
 /*
- * gdk_drag_motion:
- * @context: a #GdkDragContext
- * @dest_window: the new destination window, obtained by
- *     gdk_drag_find_window()
- * @protocol: the DND protocol in use, obtained by gdk_drag_find_window()
- * @x_root: the x position of the pointer in root coordinates
- * @y_root: the y position of the pointer in root coordinates
- * @suggested_action: the suggested action
- * @possible_actions: the possible actions
- * @time_: the timestamp for this operation
- *
- * Updates the drag context when the pointer moves or the
- * set of actions changes.
- *
- * This function is called by the drag source.
- *
- * Returns:
- */
-gboolean
-gdk_drag_motion (GdkDragContext *context,
-                 GdkWindow      *dest_window,
-                 GdkDragProtocol protocol,
-                 gint            x_root,
-                 gint            y_root,
-                 GdkDragAction   suggested_action,
-                 GdkDragAction   possible_actions,
-                 guint32         time_)
-{
-  g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), FALSE);
-
-  return GDK_DRAG_CONTEXT_GET_CLASS (context)
-       ->drag_motion (context,
-                      dest_window,
-                      protocol,
-                      x_root,
-                      y_root,
-                      suggested_action,
-                      possible_actions,
-                      time_);
-}
-
-/*
  * gdk_drag_abort:
  * @context: a #GdkDragContext
  * @time_: the timestamp for this operation
diff --git a/gdk/gdkdndprivate.h b/gdk/gdkdndprivate.h
index 05f1043..fdf544a 100644
--- a/gdk/gdkdndprivate.h
+++ b/gdk/gdkdndprivate.h
@@ -60,19 +60,6 @@ typedef struct _GdkDragContextClass GdkDragContextClass;
 struct _GdkDragContextClass {
   GObjectClass parent_class;
 
-  GdkWindow * (*find_window)   (GdkDragContext  *context,
-                                GdkWindow       *drag_window,
-                                gint             x_root,
-                                gint             y_root,
-                                GdkDragProtocol *protocol);
-  gboolean    (*drag_motion)   (GdkDragContext  *context,
-                                GdkWindow       *dest_window,
-                                GdkDragProtocol  protocol,
-                                gint             root_x,
-                                gint             root_y,
-                                GdkDragAction    suggested_action,
-                                GdkDragAction    possible_actions,
-                                guint32          time_);
   void        (*drag_status)   (GdkDragContext  *context,
                                 GdkDragAction    action,
                                 guint32          time_);
@@ -157,26 +144,11 @@ gboolean gdk_drag_context_handle_dest_event   (GdkEvent *event);
 GdkCursor * gdk_drag_get_cursor               (GdkDragContext *context,
                                                GdkDragAction   action);
 
-gboolean gdk_drag_motion (GdkDragContext *context,
-                          GdkWindow      *dest_window,
-                          GdkDragProtocol protocol,
-                          gint            x_root,
-                          gint            y_root,
-                          GdkDragAction   suggested_action,
-                          GdkDragAction   possible_actions,
-                          guint32         time_);
 void     gdk_drag_abort  (GdkDragContext *context,
                           guint32         time_);
 void     gdk_drag_drop   (GdkDragContext *context,
                           guint32         time_);
 
-void     gdk_drag_find_window             (GdkDragContext   *context,
-                                           GdkWindow        *drag_window,
-                                           gint              x_root,
-                                           gint              y_root,
-                                           GdkWindow       **dest_window,
-                                           GdkDragProtocol  *protocol);
-
 void                    gdk_drag_context_write_async            (GdkDragContext         *context,
                                                                  const char             *mime_type,
                                                                  GOutputStream          *stream,
diff --git a/gdk/quartz/gdkdnd-quartz.c b/gdk/quartz/gdkdnd-quartz.c
index 65412b0..8d16219 100644
--- a/gdk/quartz/gdkdnd-quartz.c
+++ b/gdk/quartz/gdkdnd-quartz.c
@@ -57,31 +57,6 @@ _gdk_quartz_window_drag_begin (GdkWindow *window,
   return _gdk_quartz_drag_source_context;
 }
 
-static gboolean
-gdk_quartz_drag_context_drag_motion (GdkDragContext  *context,
-                                     GdkWindow       *dest_window,
-                                     GdkDragProtocol  protocol,
-                                     gint             x_root,
-                                     gint             y_root,
-                                     GdkDragAction    suggested_action,
-                                     GdkDragAction    possible_actions,
-                                     guint32          time)
-{
-  /* FIXME: Implement */
-  return FALSE;
-}
-
-static GdkWindow *
-gdk_quartz_drag_context_find_window (GdkDragContext  *context,
-                                     GdkWindow       *drag_window,
-                                     gint             x_root,
-                                     gint             y_root,
-                                     GdkDragProtocol *protocol)
-{
-  /* FIXME: Implement */
-  return NULL;
-}
-
 static void
 gdk_quartz_drag_context_drag_drop (GdkDragContext *context,
                                    guint32         time)
@@ -158,9 +133,7 @@ gdk_quartz_drag_context_class_init (GdkQuartzDragContextClass *klass)
 
   object_class->finalize = gdk_quartz_drag_context_finalize;
 
-  context_class->find_window = gdk_quartz_drag_context_find_window;
   context_class->drag_status = gdk_quartz_drag_context_drag_status;
-  context_class->drag_motion = gdk_quartz_drag_context_drag_motion;
   context_class->drag_abort = gdk_quartz_drag_context_drag_abort;
   context_class->drag_drop = gdk_quartz_drag_context_drag_drop;
   context_class->drop_reply = gdk_quartz_drag_context_drop_reply;
diff --git a/gdk/wayland/gdkdnd-wayland.c b/gdk/wayland/gdkdnd-wayland.c
index d692701..da90cbe 100644
--- a/gdk/wayland/gdkdnd-wayland.c
+++ b/gdk/wayland/gdkdnd-wayland.c
@@ -130,29 +130,6 @@ _gdk_wayland_drag_context_emit_event (GdkDragContext *context,
   g_object_unref (event);
 }
 
-static GdkWindow *
-gdk_wayland_drag_context_find_window (GdkDragContext  *context,
-                                     GdkWindow       *drag_window,
-                                     gint             x_root,
-                                     gint             y_root,
-                                     GdkDragProtocol *protocol)
-{
-  GdkDevice *device;
-  GdkWindow *window;
-
-  device = gdk_drag_context_get_device (context);
-  window = gdk_device_get_window_at_position (device, NULL, NULL);
-
-  if (window)
-    {
-      window = gdk_window_get_toplevel (window);
-      *protocol = GDK_DRAG_PROTO_WAYLAND;
-      return g_object_ref (window);
-    }
-
-  return NULL;
-}
-
 static inline uint32_t
 gdk_to_wl_actions (GdkDragAction action)
 {
@@ -175,27 +152,6 @@ gdk_wayland_drag_context_set_action (GdkDragContext *context,
   context->suggested_action = context->action = action;
 }
 
-static gboolean
-gdk_wayland_drag_context_drag_motion (GdkDragContext *context,
-                                     GdkWindow      *dest_window,
-                                     GdkDragProtocol protocol,
-                                     gint            x_root,
-                                     gint            y_root,
-                                     GdkDragAction   suggested_action,
-                                     GdkDragAction   possible_actions,
-                                     guint32         time)
-{
-  if (context->dest_window != dest_window)
-    {
-      context->dest_window = dest_window ? g_object_ref (dest_window) : NULL;
-      _gdk_wayland_drag_context_set_coords (context, x_root, y_root);
-    }
-
-  gdk_wayland_drag_context_set_action (context, suggested_action);
-
-  return context->dest_window != NULL;
-}
-
 static void
 gdk_wayland_drag_context_drag_abort (GdkDragContext *context,
                                     guint32         time)
@@ -485,9 +441,7 @@ gdk_wayland_drag_context_class_init (GdkWaylandDragContextClass *klass)
 
   object_class->finalize = gdk_wayland_drag_context_finalize;
 
-  context_class->find_window = gdk_wayland_drag_context_find_window;
   context_class->drag_status = gdk_wayland_drag_context_drag_status;
-  context_class->drag_motion = gdk_wayland_drag_context_drag_motion;
   context_class->drag_abort = gdk_wayland_drag_context_drag_abort;
   context_class->drag_drop = gdk_wayland_drag_context_drag_drop;
   context_class->drop_reply = gdk_wayland_drag_context_drop_reply;
diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c
index 86f9c85..32c3127 100644
--- a/gdk/x11/gdkdnd-x11.c
+++ b/gdk/x11/gdkdnd-x11.c
@@ -381,9 +381,7 @@ gdk_x11_drag_context_class_init (GdkX11DragContextClass *klass)
 
   object_class->finalize = gdk_x11_drag_context_finalize;
 
-  context_class->find_window = gdk_x11_drag_context_find_window;
   context_class->drag_status = gdk_x11_drag_context_drag_status;
-  context_class->drag_motion = gdk_x11_drag_context_drag_motion;
   context_class->drag_abort = gdk_x11_drag_context_drag_abort;
   context_class->drag_drop = gdk_x11_drag_context_drag_drop;
   context_class->drop_reply = gdk_x11_drag_context_drop_reply;
@@ -2231,7 +2229,7 @@ gdk_x11_drag_context_drag_motion (GdkDragContext *context,
        * the XDND protocol version, and in particular doesn't know
        * that gdk_drag_find_window() has the side-effect
        * of setting context_x11->version, and therefore sometimes call
-       * gdk_drag_motion() without a prior call to
+       * gdk_x11_drag_context_drag_motion() without a prior call to
        * gdk_drag_find_window(). This happens, e.g.
        * when GTK+ is proxying DND events to embedded windows.
        */
@@ -2370,7 +2368,7 @@ gdk_x11_drag_context_drag_motion (GdkDragContext *context,
             case GDK_DRAG_PROTO_LOCAL:
             case GDK_DRAG_PROTO_WAYLAND:
             case GDK_DRAG_PROTO_NONE:
-              g_warning ("Invalid drag protocol %u in gdk_drag_motion()", context->protocol);
+              g_warning ("Invalid drag protocol %u in gdk_x11_drag_context_drag_motion()", 
context->protocol);
               break;
             default:
               break;
@@ -3131,12 +3129,12 @@ gdk_drag_update (GdkDragContext  *context,
   gdk_drag_get_current_actions (mods, GDK_BUTTON_PRIMARY, x11_context->actions,
                                 &action, &possible_actions);
 
-  gdk_drag_find_window (context,
-                        x11_context->drag_window,
-                        x_root, y_root, &dest_window, &protocol);
+  dest_window = gdk_x11_drag_context_find_window (context,
+                                                  x11_context->drag_window,
+                                                  x_root, y_root, &protocol);
 
-  gdk_drag_motion (context, dest_window, protocol, x_root, y_root,
-                   action, possible_actions, evtime);
+  gdk_x11_drag_context_drag_motion (context, dest_window, protocol, x_root, y_root,
+                                    action, possible_actions, evtime);
 }
 
 static gboolean


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