Enlightenment CVS committal

Author  : ningerso
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_dnd.c ewl_dnd.h ewl_engines.c ewl_engines.h ewl_widget.c 


Log Message:
Additional DND drop infrastructure and engine hooks.

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_dnd.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -3 -r1.33 -r1.34
--- ewl_dnd.c   15 Nov 2006 16:24:14 -0000      1.33
+++ ewl_dnd.c   29 Nov 2006 15:52:19 -0000      1.34
@@ -313,6 +313,10 @@
 void
 ewl_dnd_drag_start(Ewl_Widget *w) 
 {
+       unsigned int i;
+       char **types;
+       Ewl_Embed *emb;
+
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("w", w);
        DCHECK_TYPE("w", w, EWL_WIDGET_TYPE);
@@ -320,16 +324,62 @@
        if (!ewl_dnd_status || ewl_dragging_current) 
                DRETURN(DLEVEL_STABLE);
 
+       emb = ewl_embed_widget_find(w);
+
        ewl_dragging_current = 1;
        ewl_dnd_widget = w;
        ewl_dnd_move_count = 0;
 
-       /* Start the drag operation */
+       types = ewl_dnd_provided_types_get(w);
+       /*
+        * Count the number of mime types set on the widget.
+        */
+       for (i = 0; types && types[i]; i++);
+
+       /*
+        * Flag the provided DND types on the embed and begin the DND process.
+        */
+       ewl_engine_embed_dnd_drag_types_set(emb, types, i);
+       ewl_engine_embed_dnd_drag_start(emb);
+
        /*
-       ecore_x_dnd_types_set(ewl_dnd_drag_win, ewl_dnd_provided_types_get(w),
-                       1);
-       ecore_x_dnd_begin(ewl_dnd_drag_win, NULL, 0);
-       */
+        * FIXME: Display the default cursor for now. Needs to check for a
+        * custom DND cursor from the widget.
+        */
+       ewl_attach_mouse_argb_cursor_set(emb, ewl_dnd_default_cursor);
+       ewl_embed_mouse_cursor_set(EWL_WIDGET(emb));
+
+       printf("Began drag process on %p\n", w);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param w: The widget to start dragging
+ * @return Returns no value
+ * @brief Tells the widget to start dragging
+ */
+void
+ewl_dnd_drag_drop(Ewl_Widget *w) 
+{
+       Ewl_Embed *emb;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("w", w);
+       DCHECK_TYPE("w", w, EWL_WIDGET_TYPE);
+
+       emb = ewl_embed_widget_find(w);
+
+       ewl_dragging_current = 0;
+       ewl_dnd_widget = NULL;
+       ewl_dnd_move_count = 0;
+
+       /*
+        * FIXME: Reset the cursor here.
+        */
+       // ewl_embed_mouse_cursor_set(EWL_WIDGET(emb));
+
+       printf("Finished drag process on %p\n", w);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_dnd.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- ewl_dnd.h   13 Oct 2006 01:50:44 -0000      1.17
+++ ewl_dnd.h   29 Nov 2006 15:52:19 -0000      1.18
@@ -17,6 +17,7 @@
 void            ewl_dnd_shutdown(void);
 
 void            ewl_dnd_drag_start(Ewl_Widget *w);
+void             ewl_dnd_drag_drop(Ewl_Widget *w);
 void            ewl_dnd_drag_widget_clear(void);
 Ewl_Widget     *ewl_dnd_drag_widget_get(void);
 
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_engines.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- ewl_engines.c       15 Nov 2006 16:21:07 -0000      1.23
+++ ewl_engines.c       29 Nov 2006 15:52:19 -0000      1.24
@@ -788,6 +788,84 @@
 
 /**
  * @param embed: the embed to work with
+ * @return Returns no value
+ * @brief Sets the dnd types provided by this embed.
+ */
+void
+ewl_engine_embed_dnd_drag_types_set(Ewl_Embed *embed, char **types, unsigned 
int num)
+{
+       Ewl_Engine_Cb_Window_Dnd_Drag_Types_Set embed_dnd_drag_types_set;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("embed", embed);
+       DCHECK_TYPE("embed", embed, EWL_EMBED_TYPE);
+
+       if (!(embed->evas_window))
+               DRETURN(DLEVEL_STABLE);
+
+       embed_dnd_drag_types_set = ewl_engine_hook_get(EWL_EMBED(embed),
+                                       EWL_ENGINE_HOOK_TYPE_WINDOW,
+                                       EWL_ENGINE_WINDOW_DND_DRAG_TYPES_SET);
+       if (embed_dnd_drag_types_set)
+               embed_dnd_drag_types_set(embed, types, num);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param embed: the embed to work with
+ * @return Returns no value
+ * @brief Starts the dnd process on an embed.
+ */
+void
+ewl_engine_embed_dnd_drag_start(Ewl_Embed *embed)
+{
+       Ewl_Engine_Cb_Window_Dnd_Drag_Start embed_dnd_drag_start;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("embed", embed);
+       DCHECK_TYPE("embed", embed, EWL_EMBED_TYPE);
+
+       if (!(embed->evas_window))
+               DRETURN(DLEVEL_STABLE);
+
+       embed_dnd_drag_start = ewl_engine_hook_get(EWL_EMBED(embed),
+                                       EWL_ENGINE_HOOK_TYPE_WINDOW,
+                                       EWL_ENGINE_WINDOW_DND_DRAG_START);
+       if (embed_dnd_drag_start)
+               embed_dnd_drag_start(embed);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param embed: the embed to work with
+ * @return Returns no value
+ * @brief Completes the dnd process on an embed.
+ */
+void
+ewl_engine_embed_dnd_drag_drop(Ewl_Embed *embed)
+{
+       Ewl_Engine_Cb_Window_Dnd_Drag_Drop embed_dnd_drag_drop;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("embed", embed);
+       DCHECK_TYPE("embed", embed, EWL_EMBED_TYPE);
+
+       if (!(embed->evas_window))
+               DRETURN(DLEVEL_STABLE);
+
+       embed_dnd_drag_drop = ewl_engine_hook_get(EWL_EMBED(embed),
+                                       EWL_ENGINE_HOOK_TYPE_WINDOW,
+                                       EWL_ENGINE_WINDOW_DND_DRAG_DROP);
+       if (embed_dnd_drag_drop)
+               embed_dnd_drag_drop(embed);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param embed: the embed to work with
  * @parm w: a pointer where the width of the desktop will be stored
  * @parm h: a pointer where the height pf the desktop will be stored
  * @return Returns no value
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_engines.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- ewl_engines.h       4 Nov 2006 16:58:05 -0000       1.15
+++ ewl_engines.h       29 Nov 2006 15:52:19 -0000      1.16
@@ -40,6 +40,11 @@
 
        EWL_ENGINE_WINDOW_DND_AWARE_SET,         /**< Set the window dnd aware 
*/
        EWL_ENGINE_WINDOW_DESKTOP_SIZE_GET, /**< Get the size of the desktop */
+
+       EWL_ENGINE_WINDOW_DND_DRAG_TYPES_SET, /**< Set window drag types */
+       EWL_ENGINE_WINDOW_DND_DRAG_START, /**< Begin DND drag process */
+       EWL_ENGINE_WINDOW_DND_DRAG_DROP, /**< Complete DND drag process */
+
        EWL_ENGINE_WINDOW_MAX
 };
 
@@ -174,6 +179,11 @@
 void            ewl_engine_window_geometry_get(Ewl_Window *win, int root,
                                                int *width, int *height);
 void            ewl_engine_embed_dnd_aware_set(Ewl_Embed *embed);
+void             ewl_engine_embed_dnd_drag_types_set(Ewl_Embed *embed,
+                                                    char **types,
+                                                    unsigned int num);
+void             ewl_engine_embed_dnd_drag_start(Ewl_Embed *embed);
+void             ewl_engine_embed_dnd_drag_drop(Ewl_Embed *embed);
 void            ewl_engine_desktop_size_get(Ewl_Embed *embed, int *w, int *h);
 
 void            ewl_engine_canvas_setup(Ewl_Window *win, int debug);
@@ -229,6 +239,9 @@
                                                                geometry */
 typedef void (*Ewl_Engine_Cb_Window_Dnd_Aware_Set)(Ewl_Embed *embed);   /**< 
Set the embed 
                                                                dnd aware */
+typedef void (*Ewl_Engine_Cb_Window_Dnd_Drag_Types_Set)(Ewl_Embed *embed, char 
**types, unsigned int num);      /**< Set the drag types */
+typedef void (*Ewl_Engine_Cb_Window_Dnd_Drag_Start)(Ewl_Embed *embed);  /**< 
Start the drag process */
+typedef void (*Ewl_Engine_Cb_Window_Dnd_Drag_Drop)(Ewl_Embed *embed);   /**< 
End the drag process with a drop event */
 typedef void (*Ewl_Engine_Cb_Window_Desktop_Size_Get)(Ewl_Embed *embed, 
                                                        int *w, int *h); /**< 
Get the desktop
                                                                size */
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_widget.c,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -3 -r1.107 -r1.108
--- ewl_widget.c        16 Nov 2006 16:43:29 -0000      1.107
+++ ewl_widget.c        29 Nov 2006 15:52:19 -0000      1.108
@@ -2890,6 +2890,7 @@
        if (ewl_object_state_has(EWL_OBJECT(w), EWL_FLAG_STATE_DND)) {
                ewl_object_state_remove(EWL_OBJECT(w), EWL_FLAG_STATE_DND);
                /* FIXME: Stop DND here */
+               ewl_dnd_drag_drop(w);
        }
 
        snprintf(state, 14, "mouse,up,%i", e->button);
@@ -2943,6 +2944,7 @@
                if (!ewl_object_state_has(o, EWL_FLAG_STATE_DND)) {
                        ewl_object_state_add(o, EWL_FLAG_STATE_DND);
                        /* FIXME: Start DND here. */
+                       ewl_dnd_drag_start(EWL_WIDGET(o));
                }
        }
 



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to