mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 14:00:09 +00:00
dnd: GdkDragContext is no longer a GdkDrop subclass
This includes a bunch of header cleanup
This commit is contained in:
parent
f982c9c8f8
commit
a960641ace
35
gdk/gdkdnd.c
35
gdk/gdkdnd.c
@ -35,16 +35,12 @@
|
||||
#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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
|
@ -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:
|
||||
|
@ -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"
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkdndprivate.h"
|
||||
#include "gdkdropprivate.h"
|
||||
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkproperty.h"
|
||||
|
@ -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"
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkx11dnd.h"
|
||||
#include "gdkdropprivate.h"
|
||||
|
||||
#include "gdk-private.h"
|
||||
#include "gdkasync.h"
|
||||
|
Loading…
Reference in New Issue
Block a user