[gtk/matthiasc/for-master: 4/4] gtk-demo: Fix the dnd demo drop highlight
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master: 4/4] gtk-demo: Fix the dnd demo drop highlight
- Date: Fri, 22 May 2020 22:56:00 +0000 (UTC)
commit 5f6d07245905259eb8bf6d60e7314d5becb08e66
Author: Matthias Clasen <mclasen redhat com>
Date: Fri May 22 18:52:56 2020 -0400
gtk-demo: Fix the dnd demo drop highlight
We want the drop highlight to be around the label,
not around the item containing it, so move the drop
target gesture to the right widget.
demos/gtk-demo/dnd.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/demos/gtk-demo/dnd.c b/demos/gtk-demo/dnd.c
index b148b39d0b..c7db016b84 100644
--- a/demos/gtk-demo/dnd.c
+++ b/demos/gtk-demo/dnd.c
@@ -62,7 +62,8 @@ item_drag_drop (GtkDropTarget *dest,
double x,
double y)
{
- CanvasItem *item = CANVAS_ITEM (gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (dest)));
+ GtkWidget *label = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (dest));
+ CanvasItem *item = CANVAS_ITEM (gtk_widget_get_parent (gtk_widget_get_parent (label)));
set_color (item, g_value_get_boxed (value));
@@ -155,7 +156,7 @@ canvas_item_init (CanvasItem *item)
dest = gtk_drop_target_new (GDK_TYPE_RGBA, GDK_ACTION_COPY);
g_signal_connect (dest, "drop", G_CALLBACK (item_drag_drop), NULL);
- gtk_widget_add_controller (GTK_WIDGET (item), GTK_EVENT_CONTROLLER (dest));
+ gtk_widget_add_controller (GTK_WIDGET (item->label), GTK_EVENT_CONTROLLER (dest));
gesture = gtk_gesture_rotate_new ();
g_signal_connect (gesture, "angle-changed", G_CALLBACK (angle_changed), NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]