Elm photo stops scrolling events when dragging now.
authorBrett Nash <nash@nash.id.au>
Fri, 10 Sep 2010 08:24:29 +0000 (08:24 +0000)
committerBrett Nash <nash@nash.id.au>
Fri, 10 Sep 2010 08:24:29 +0000 (08:24 +0000)
SVN revision: 52129

src/bin/test_photo.c
src/lib/elm_photo.c

index 70ba2b4a6b43f35cca47a518b0fcc704f980a569..78acb813edc55e0a3285844ce842597d573707b2 100644 (file)
@@ -2,6 +2,8 @@
 #ifndef ELM_LIB_QUICKLAUNCH
 
 static void drop_cb(void *mydata, Evas_Object *obj, void *evdata);
+static void drag_stop_cb(void *mydata, Evas_Object *obj, void *evdata);
+static void drag_start_cb(void *mydata, Evas_Object *obj, void *evdata);
 
 void
 test_photo(void *data, Evas_Object *obj, void *event_info)
@@ -53,6 +55,11 @@ test_photo(void *data, Evas_Object *obj, void *event_info)
                                              EVAS_HINT_FILL);
             evas_object_smart_callback_add(ph, "drop",
                                             drop_cb, NULL);
+             evas_object_smart_callback_add(ph, "drag,start",
+                                            drag_start_cb, NULL);
+             evas_object_smart_callback_add(ph, "drag,stop",
+                                            drag_stop_cb, NULL);
+
              if(n == 2 || n == 3) {
                 elm_photo_fill_inside_set(ph, EINA_TRUE);
                 elm_widget_style_set(ph, "shadow");
@@ -79,5 +86,15 @@ drop_cb(void *mydata, Evas_Object *obj, void *evdata){
    printf("Drop on obj %p: Image: %s\n",obj,evdata);
 }
 
+static void
+drag_start_cb(void *mydata, Evas_Object *obj, void *evdata){
+   
+}
+
+static void
+drag_stop_cb(void *mydata, Evas_Object *obj, void *evdata){
+
+}
+
 /* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/
 #endif
index 0c708b795a8ef4d2f06616ef3c856641e2fd2ffb..3080313915f6c0bf6f3c6cc4a78e2515a879b34a 100644 (file)
@@ -24,9 +24,6 @@ struct _Widget_Data
    int size;
    Eina_Bool fill;
    Ecore_Timer *longtimer;
-   struct {
-        int x,y;
-   } press;
 };
 
 static const char *widtype = NULL;
@@ -97,6 +94,13 @@ _icon_move_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
 }
 
 
+static void
+_drag_done_cb(void *unused __UNUSED__, Evas_Object *obj)
+{
+   elm_object_scroll_freeze_pop(obj);
+   evas_object_smart_callback_call(obj, "drag,end", NULL);
+}
+
 static Eina_Bool
 _longpress(void *objv)
 {
@@ -104,7 +108,6 @@ _longpress(void *objv)
    Evas_Object *tmp;
    const char *file;
    char *buf;
-   int len;
 
    printf("Long press: start drag!\n");
    wd->longtimer = NULL; /* clear: must return NULL now */
@@ -118,9 +121,10 @@ _longpress(void *objv)
         /* FIXME: Deal with relative paths */
         buf = malloc(strlen(file) + strlen("file://") + 1);
         sprintf(buf, "%s%s","file://",file);
-        elm_drag_start(objv, ELM_SEL_FORMAT_IMAGE, buf);
+        elm_drag_start(objv, ELM_SEL_FORMAT_IMAGE, buf, _drag_done_cb, NULL);
         free(buf);
      }
+   elm_object_scroll_freeze_push(objv);
 
    evas_object_smart_callback_call(objv, "drag,start", NULL);