dnd: GdkDragContext is no longer a GdkDrop subclass
authorBenjamin Otte <otte@redhat.com>
Thu, 14 Jun 2018 02:58:50 +0000 (04:58 +0200)
committerBenjamin Otte <otte@redhat.com>
Mon, 18 Jun 2018 21:49:52 +0000 (23:49 +0200)
This includes a bunch of header cleanup

gdk/gdkdnd.c
gdk/gdkdndprivate.h
gdk/gdkdrop.c
gdk/wayland/gdkdevice-wayland.c
gdk/wayland/gdkdrop-wayland.c
gdk/win32/gdkdrop-win32.c
gdk/x11/gdkdrop-x11.c

index 8db911b7ba77eb77d9928fa32b9ae8cbea7434bf..d091c6c5605bde8d143a2d1f8aa135922017efba 100644 (file)
 #include "gdkenumtypes.h"
 #include "gdkeventsprivate.h"
 
-#define DROP_SUBCLASS 1
-
 typedef struct _GdkDragContextPrivate GdkDragContextPrivate;
 
 struct _GdkDragContextPrivate 
 {
-#ifndef DROP_SUBCLASS
   GdkDisplay *display;
   GdkDevice *device;
-#endif
   GdkContentFormats *formats;
   GdkDragAction actions;
   GdkDragAction suggested_action;
@@ -65,11 +61,9 @@ static struct {
 enum {
   PROP_0,
   PROP_CONTENT,
-#ifndef DROP_SUBCLASS
   PROP_DEVICE,
   PROP_DISPLAY,
   PROP_FORMATS,
-#endif
   N_PROPERTIES
 };
 
@@ -85,7 +79,7 @@ static GParamSpec *properties[N_PROPERTIES] = { NULL, };
 static guint signals[N_SIGNALS] = { 0 };
 static GList *contexts = NULL;
 
-G_DEFINE_TYPE_WITH_PRIVATE (GdkDragContext, gdk_drag_context, GDK_TYPE_DROP)
+G_DEFINE_TYPE_WITH_PRIVATE (GdkDragContext, gdk_drag_context, G_TYPE_OBJECT)
 
 /**
  * SECTION:dnd
@@ -121,15 +115,11 @@ G_DEFINE_TYPE_WITH_PRIVATE (GdkDragContext, gdk_drag_context, GDK_TYPE_DROP)
 GdkDisplay *
 gdk_drag_context_get_display (GdkDragContext *context)
 {
-#ifdef DROP_SUBCLASS
-  return gdk_drop_get_display (GDK_DROP (context));
-#else
   GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
 
   g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
 
   return priv->display;
-#endif
 }
 
 /**
@@ -147,12 +137,6 @@ gdk_drag_context_get_formats (GdkDragContext *context)
 
   g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
 
-#ifdef DROP_SUBCLASS
-  GdkContentFormats *formats = gdk_drop_get_formats (GDK_DROP (context));
-
-  if (formats)
-    return formats;
-#endif
   return priv->formats;
 }
 
@@ -220,15 +204,11 @@ gdk_drag_context_get_selected_action (GdkDragContext *context)
 GdkDevice *
 gdk_drag_context_get_device (GdkDragContext *context)
 {
-#ifdef DROP_SUBCLASS
-  return gdk_drop_get_device (GDK_DROP (context));
-#else
   GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
 
   g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
 
   return priv->device;
-#endif
 }
 
 static void
@@ -257,7 +237,6 @@ gdk_drag_context_set_property (GObject      *gobject,
         }
       break;
 
-#ifndef DROP_SUBCLASS
     case PROP_DEVICE:
       priv->device = g_value_dup_object (value);
       g_assert (priv->device != NULL);
@@ -280,7 +259,6 @@ gdk_drag_context_set_property (GObject      *gobject,
           g_assert (priv->formats != NULL);
         }
       break;
-#endif
 
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
@@ -295,9 +273,7 @@ gdk_drag_context_get_property (GObject    *gobject,
                                GParamSpec *pspec)
 {
   GdkDragContext *context = GDK_DRAG_CONTEXT (gobject);
-#ifndef DROP_SUBCLASS
   GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
-#endif
 
   switch (prop_id)
     {
@@ -305,7 +281,6 @@ gdk_drag_context_get_property (GObject    *gobject,
       g_value_set_object (value, context->content);
       break;
 
-#ifndef DROP_SUBCLASS
     case PROP_DEVICE:
       g_value_set_object (value, priv->device);
       break;
@@ -317,7 +292,6 @@ gdk_drag_context_get_property (GObject    *gobject,
     case PROP_FORMATS:
       g_value_set_boxed (value, priv->formats);
       break;
-#endif
 
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
@@ -370,7 +344,6 @@ gdk_drag_context_class_init (GdkDragContextClass *klass)
                          G_PARAM_STATIC_STRINGS |
                          G_PARAM_EXPLICIT_NOTIFY);
 
-#ifndef DROP_SUBCLASS
   /**
    * GdkDragContext:device:
    *
@@ -414,7 +387,6 @@ gdk_drag_context_class_init (GdkDragContextClass *klass)
                         G_PARAM_CONSTRUCT_ONLY |
                         G_PARAM_STATIC_STRINGS |
                         G_PARAM_EXPLICIT_NOTIFY);
-#endif
 
   /**
    * GdkDragContext::cancel:
@@ -648,11 +620,6 @@ gdk_drag_context_set_actions (GdkDragContext *context,
 
   priv->actions = actions;
   priv->suggested_action = suggested_action;
-
-  if (suggested_action & GDK_ACTION_ASK)
-    gdk_drop_set_actions (GDK_DROP (context), actions & GDK_ACTION_ALL);
-  else
-    gdk_drop_set_actions (GDK_DROP (context), suggested_action);
 }
 
 /**
index 923cef005e5c4c1fc0bd2cacd0184105cc294252..5f1871a3be6dbe66bfa51ddb4652970ea1cc07fa 100644 (file)
@@ -20,8 +20,6 @@
 
 #include "gdkdnd.h"
 
-#include "gdkdropprivate.h"
-
 G_BEGIN_DECLS
 
 
@@ -33,7 +31,7 @@ typedef struct _GdkDragContextClass GdkDragContextClass;
 
 
 struct _GdkDragContextClass {
-  GdkDropClass parent_class;
+  GObjectClass parent_class;
 
   void        (*drag_abort)    (GdkDragContext  *context,
                                 guint32          time_);
@@ -61,7 +59,7 @@ struct _GdkDragContextClass {
 };
 
 struct _GdkDragContext {
-  GdkDrop parent_instance;
+  GObject parent_instance;
 
   /*< private >*/
   gboolean is_source;
index 0873a2ee0d74004005b1aa5651edc7bd32d0b0ca..f17f709ea868654502be164247bfc5ea66c35b83 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "config.h"
 
-#include "gdkdndprivate.h"
+#include "gdkdropprivate.h"
 
 #include "gdkcontentdeserializer.h"
 #include "gdkcontentformats.h"
@@ -187,18 +187,14 @@ gdk_drop_set_property (GObject      *gobject,
 
     case PROP_FORMATS:
       priv->formats = g_value_dup_boxed (value);
-#ifdef DROP_SUBCLASS
       g_assert (priv->formats != NULL);
-#endif
       break;
 
     case PROP_SURFACE:
       priv->surface = g_value_dup_object (value);
-#ifdef DROP_SUBCLASS
       g_assert (priv->surface != NULL);
       if (priv->device)
         g_assert (gdk_surface_get_display (priv->surface) == gdk_device_get_display (priv->device));
-#endif
       break;
 
     default:
index 8ab8a07986f294c5cf00d784303fff480b321662..9c9b79b5635bd251282a797fd89610d44b9d752a 100644 (file)
@@ -34,6 +34,7 @@
 #include "gdkdeviceprivate.h"
 #include "gdkdevicepadprivate.h"
 #include "gdkdevicetoolprivate.h"
+#include "gdkdropprivate.h"
 #include "gdkprimary-wayland.h"
 #include "gdkseatprivate.h"
 #include "pointer-gestures-unstable-v1-client-protocol.h"
index 09d6de5b4804707cddeef4699c10df10b57c469b..d290c6229bdd106b6a7e9ceafc9b9ef2aec04f98 100644 (file)
@@ -17,7 +17,7 @@
 
 #include "config.h"
 
-#include "gdkdndprivate.h"
+#include "gdkdropprivate.h"
 
 #include "gdkinternals.h"
 #include "gdkproperty.h"
index 6d7ff78e7a73c25e919465a4e37a1140fba01523..71c47405fe9fc1296c13d5b7076b68840316be70 100644 (file)
@@ -39,6 +39,8 @@
 /* For C-style COM wrapper macros */
 #define COBJMACROS
 
+#include "gdkdropprivate.h"
+
 #include "gdkdnd.h"
 #include "gdkproperty.h"
 #include "gdkinternals.h"
@@ -46,7 +48,6 @@
 #include "gdkwin32.h"
 #include "gdkwin32dnd.h"
 #include "gdkdisplayprivate.h"
-#include "gdk/gdkdndprivate.h"
 #include "gdkwin32dnd-private.h"
 #include "gdkdisplay-win32.h"
 #include "gdkdeviceprivate.h"
index ddae88e13d0b612d7dd2a110c45da3f75a0ab2f7..1bd315efe52ce87336ba6d69083b92ce8a4c1392 100644 (file)
@@ -24,7 +24,7 @@
 
 #include "config.h"
 
-#include "gdkx11dnd.h"
+#include "gdkdropprivate.h"
 
 #include "gdk-private.h"
 #include "gdkasync.h"