This replaces gdk_drag_context_get_dest_surface().
GdkDevice *device;
GdkDragContext *drag;
GdkContentFormats *formats;
+ GdkSurface *surface;
GdkDragAction actions;
};
PROP_DISPLAY,
PROP_DRAG,
PROP_FORMATS,
+ PROP_SURFACE,
N_PROPERTIES
};
case PROP_DEVICE:
priv->device = g_value_dup_object (value);
g_assert (priv->device != NULL);
+ if (priv->surface)
+ g_assert (gdk_surface_get_display (priv->surface) == gdk_device_get_display (priv->device));
break;
case PROP_DRAG:
#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:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
g_value_set_boxed (value, priv->formats);
break;
+ case PROP_SURFACE:
+ g_value_set_object (value, priv->surface);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY);
+
+ /**
+ * GdkDrop:surface:
+ *
+ * The #GdkSurface the drop happens on
+ */
+ properties[PROP_SURFACE] =
+ g_param_spec_object ("surface",
+ "Surface",
+ "The surface the drop is happening on",
+ GDK_TYPE_SURFACE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS |
+ G_PARAM_EXPLICIT_NOTIFY);
+
g_object_class_install_properties (object_class, N_PROPERTIES, properties);
}
return priv->formats;
}
+/**
+ * gdk_drop_get_surface:
+ * @self: a #GdkDrop
+ *
+ * Returns the #GdkSurface performing the drop.
+ *
+ * Returns: (transfer none): The #GdkSurface performing the drop.
+ **/
+GdkSurface *
+gdk_drop_get_surface (GdkDrop *self)
+{
+ GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
+
+ g_return_val_if_fail (GDK_IS_DROP (self), NULL);
+
+ return priv->surface;
+}
+
/**
* gdk_drop_get_actions:
* @self: a #GdkDrop
GDK_AVAILABLE_IN_ALL
GdkDevice * gdk_drop_get_device (GdkDrop *self);
GDK_AVAILABLE_IN_ALL
+GdkSurface * gdk_drop_get_surface (GdkDrop *self);
+GDK_AVAILABLE_IN_ALL
GdkContentFormats * gdk_drop_get_formats (GdkDrop *self);
GDK_AVAILABLE_IN_ALL
GdkDragAction gdk_drop_get_actions (GdkDrop *self);
seat->pending_builder = NULL;
seat->pending_offer = NULL;
- seat->drop_context = _gdk_wayland_drop_context_new (device, formats, offer);
+ seat->drop_context = _gdk_wayland_drop_context_new (device, formats, dest_surface, offer, serial);
dnd_owner = seat->foreign_dnd_surface;
_gdk_wayland_drag_context_set_source_surface (seat->drop_context, dnd_owner);
- _gdk_wayland_drag_context_set_dest_surface (seat->drop_context,
- dest_surface, serial);
_gdk_wayland_drag_context_set_coords (seat->drop_context,
wl_fixed_to_double (x),
wl_fixed_to_double (y));
_gdk_wayland_drag_context_set_coords (seat->drop_context, -1, -1);
_gdk_wayland_drag_context_emit_event (seat->drop_context, GDK_DRAG_LEAVE,
GDK_CURRENT_TIME);
- _gdk_wayland_drag_context_set_dest_surface (seat->drop_context, NULL, 0);
g_clear_object (&seat->drop_context);
}
if (context->is_source)
surface = gdk_drag_context_get_source_surface (context);
else
- surface = gdk_drag_context_get_dest_surface (context);
+ surface = gdk_drop_get_surface (GDK_DROP (context));
event = gdk_event_new (type);
event->any.surface = g_object_ref (surface);
GdkDragContext *
_gdk_wayland_drop_context_new (GdkDevice *device,
GdkContentFormats *formats,
- struct wl_data_offer *offer)
+ GdkSurface *surface,
+ struct wl_data_offer *offer,
+ uint32_t serial)
+
{
GdkWaylandDragContext *context_wayland;
GdkDragContext *context;
context_wayland = g_object_new (GDK_TYPE_WAYLAND_DRAG_CONTEXT,
"device", device,
"formats", formats,
+ "surface", surface,
NULL);
context = GDK_DRAG_CONTEXT (context_wayland);
context->is_source = FALSE;
context_wayland->offer = offer;
+ context_wayland->serial = serial;
return context;
}
context->source_surface = surface ? g_object_ref (surface) : NULL;
}
-void
-_gdk_wayland_drag_context_set_dest_surface (GdkDragContext *context,
- GdkSurface *dest_surface,
- uint32_t serial)
-{
- if (context->dest_surface)
- g_object_unref (context->dest_surface);
-
- context->dest_surface = dest_surface ? g_object_ref (dest_surface) : NULL;
- GDK_WAYLAND_DRAG_CONTEXT (context)->serial = serial;
-}
-
GdkDragContext *
gdk_wayland_drag_context_lookup_by_data_source (struct wl_data_source *source)
{
int y);
GdkDragContext * _gdk_wayland_drop_context_new (GdkDevice *device,
GdkContentFormats *formats,
- struct wl_data_offer *offer);
+ GdkSurface *surface,
+ struct wl_data_offer *offer,
+ uint32_t serial);
void _gdk_wayland_drag_context_set_source_surface (GdkDragContext *context,
GdkSurface *surface);
-void _gdk_wayland_drag_context_set_dest_surface (GdkDragContext *context,
- GdkSurface *dest_surface,
- uint32_t serial);
void _gdk_wayland_drag_context_emit_event (GdkDragContext *context,
GdkEventType type,
guint32 time_);
context_win32 = g_object_new (GDK_TYPE_WIN32_DROP_CONTEXT,
"device", gdk_seat_get_pointer (gdk_display_get_default_seat (display)),
"formats", formats,
+ "surface", dest_surface,
NULL);
context = GDK_DRAG_CONTEXT (context_win32);
context_x11 = g_object_new (GDK_TYPE_X11_DRAG_CONTEXT,
"device", gdk_seat_get_pointer (seat),
"formats", content_formats,
+ "surface", event->any.surface,
NULL);
context = (GdkDragContext *)context_x11;