[gcompris] Fixed the 2 click drag mode ( run it with gcompris -g 2clicks).



commit 83850c4d9e67603f2c7f0c6e9a2dfc88a1685198
Author: Mattias Lindblad <matlin gmail com>
Date:   Thu Jul 14 08:14:07 2011 +0200

    Fixed the 2 click drag mode ( run it with gcompris -g 2clicks).

 src/babymatch-activity/shapegame.c |    2 ++
 src/gcompris/drag.c                |   10 ++++++++++
 2 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/babymatch-activity/shapegame.c b/src/babymatch-activity/shapegame.c
index fff9f5d..2aeb887 100644
--- a/src/babymatch-activity/shapegame.c
+++ b/src/babymatch-activity/shapegame.c
@@ -992,6 +992,8 @@ item_event_drag(GooCanvasItem *item,
 					     NULL);
 	  g_object_set(shadow_item, "visibility",
 		       GOO_CANVAS_ITEM_INVISIBLE, NULL);
+	  g_object_set(shadow_item, "pointer-events",
+		       GOO_CANVAS_EVENTS_NONE, NULL);
 	  gdk_pixbuf_unref(dest);
 	}
       dragged = shape->item;
diff --git a/src/gcompris/drag.c b/src/gcompris/drag.c
index 5d27605..4003c20 100644
--- a/src/gcompris/drag.c
+++ b/src/gcompris/drag.c
@@ -150,6 +150,16 @@ gc_drag_event_root(GooCanvasItem * item,
 		   GdkEventMotion *event,
 		   gpointer data)
 {
+  if(gc_drag_mode & GC_DRAG_MODE_2CLICKS) {
+    gdouble new_x = event->x_root;
+    gdouble new_y = event->y_root;
+    goo_canvas_convert_to_item_space(goo_canvas_item_get_canvas(item),
+                                    gc_drag_item, &new_x, &new_y);
+    event->x = new_x;
+    event->y = new_y;
+    target = gc_drag_target;
+  }
+
   if(gc_drag_target != target)
     return FALSE;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]