[gnome-calendar] event-widget: reposition drag source to initial position
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] event-widget: reposition drag source to initial position
- Date: Thu, 16 Nov 2017 20:36:52 +0000 (UTC)
commit 35c8d0d363d54770b280a80fde784f998e234756
Author: Günther Wutz <info gunibert de>
Date: Thu Nov 16 21:07:16 2017 +0100
event-widget: reposition drag source to initial position
src/gcal-event-widget.c | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/src/gcal-event-widget.c b/src/gcal-event-widget.c
index 5990199..22c30b8 100644
--- a/src/gcal-event-widget.c
+++ b/src/gcal-event-widget.c
@@ -608,8 +608,16 @@ static void
gcal_event_widget_drag_begin (GtkWidget *widget,
GdkDragContext *context)
{
- GcalEventWidget *self = GCAL_EVENT_WIDGET (widget);
+ GcalEventWidget *self;
cairo_surface_t *surface;
+ GdkWindow *window;
+ GdkDevice *device;
+ gint x, y;
+ GtkAllocation allocation;
+
+ self = GCAL_EVENT_WIDGET (widget);
+ window = gtk_widget_get_window (widget);
+ device = gdk_drag_context_get_device (context);
if (self->read_only)
{
@@ -622,6 +630,11 @@ gcal_event_widget_drag_begin (GtkWidget *widget,
gtk_drag_set_icon_surface (context, surface);
+ /* reposition drag surface to the point the GCalEvent was */
+ gtk_widget_get_allocation (widget, &allocation);
+ gdk_window_get_device_position (window, device, &x, &y, NULL);
+ gdk_drag_context_set_hotspot (context, x - allocation.x, y - allocation.y);
+
g_clear_pointer (&surface, cairo_surface_destroy);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]