Enlightenment CVS committal

Author  : sebastid
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_apps.c e_apps.h e_dnd.c e_main.c 


Log Message:
Start xdnd integration.
shutdown dnd subsytem after modules.
Cleanup drop handlers on module shutdown.

===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_apps.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -3 -r1.46 -r1.47
--- e_apps.c    2 Jun 2005 09:49:07 -0000       1.46
+++ e_apps.c    10 Jun 2005 21:26:50 -0000      1.47
@@ -336,6 +336,26 @@
 }
 
 void
+e_app_files_prepend_relative(Evas_List *files, E_App *before)
+{
+   /* FIXME:
+    * Parse all files
+    * Put them in all
+    * Change the .order file for before->parent
+    */
+}
+
+void
+e_app_files_append(Evas_List *files, E_App *parent)
+{
+   /* FIXME:
+    * Parse all files
+    * Put them in all
+    * Change the .order file for before->parent
+    */
+}
+
+void
 e_app_remove(E_App *remove)
 {
    char buf[PATH_MAX];
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_apps.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- e_apps.h    2 Jun 2005 08:25:14 -0000       1.13
+++ e_apps.h    10 Jun 2005 21:26:50 -0000      1.14
@@ -67,6 +67,8 @@
 EAPI int    e_app_running_get(E_App *a);
 EAPI void   e_app_prepend_relative(E_App *add, E_App *before);
 EAPI void   e_app_append(E_App *add, E_App *parent);
+EAPI void   e_app_files_prepend_relative(Evas_List *files, E_App *before);
+EAPI void   e_app_files_append(Evas_List *files, E_App *parent);
 EAPI void   e_app_remove(E_App *remove);
     
 EAPI void   e_app_change_callback_add(void (*func) (void *data, E_App *a, 
E_App_Change ch), void *data);
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_dnd.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -3 -r1.24 -r1.25
--- e_dnd.c     15 May 2005 05:20:17 -0000      1.24
+++ e_dnd.c     10 Jun 2005 21:26:50 -0000      1.25
@@ -3,6 +3,11 @@
  */
 #include "e.h"
 
+/*
+ * TODO:
+ * Better system to let a drop target support several drop types
+ */
+
 /* local subsystem functions */
 
 static void _e_drag_free(E_Drag *drag);
@@ -18,6 +23,11 @@
 
 /* local subsystem globals */
 
+typedef struct _XDnd {
+     int x, y;
+     void *data;
+} XDnd;
+
 static Evas_List *_event_handlers = NULL;
 static Evas_List *_drop_handlers = NULL;
 
@@ -26,6 +36,8 @@
 static Evas_List *_drag_list = NULL;
 static E_Drag *_drag_current = NULL;
 
+static XDnd *_xdnd;
+
 /* externally accessible functions */
 
 int
@@ -285,8 +297,11 @@
    E_Event_Dnd_Move *move_ev;
    E_Event_Dnd_Leave *leave_ev;
 
-   e_drag_show(_drag_current);
-   e_drag_move(_drag_current, x, y);
+   if (_drag_current)
+     {
+       e_drag_show(_drag_current);
+       e_drag_move(_drag_current, x, y);
+     }
 
    enter_ev = E_NEW(E_Event_Dnd_Enter, 1);
    enter_ev->x = x;
@@ -314,18 +329,18 @@
             if (!h->entered)
               {
                  if (h->cb.enter)
-                   h->cb.enter(h->data, _drag_current->type, enter_ev);
+                   h->cb.enter(h->data, h->type, enter_ev);
                  h->entered = 1;
               }
             if (h->cb.move)
-              h->cb.move(h->data, _drag_current->type, move_ev);
+              h->cb.move(h->data, h->type, move_ev);
          }
        else
          {
             if (h->entered)
               {
                  if (h->cb.leave)
-                   h->cb.leave(h->data, _drag_current->type, leave_ev);
+                   h->cb.leave(h->data, h->type, leave_ev);
                  h->entered = 0;
               }
          }
@@ -343,15 +358,21 @@
    E_Event_Dnd_Drop *ev;
    int dropped;
 
-   e_drag_hide(_drag_current);
+   if (_drag_current)
+     {
+       e_drag_hide(_drag_current);
 
-   ecore_x_pointer_ungrab();
-   ecore_x_keyboard_ungrab();
-   ecore_x_window_del(_drag_win);
-   _drag_win = 0;
+       ecore_x_pointer_ungrab();
+       ecore_x_keyboard_ungrab();
+       ecore_x_window_del(_drag_win);
+       _drag_win = 0;
+     }
 
    ev = E_NEW(E_Event_Dnd_Drop, 1);
-   ev->data = _drag_current->data;
+   if (_drag_current)
+     ev->data = _drag_current->data;
+   else if (_xdnd)
+     ev->data = _xdnd->data;
    ev->x = x;
    ev->y = y;
 
@@ -368,14 +389,17 @@
        if ((h->cb.drop)
            && E_INSIDE(x, y, h->x, h->y, h->w, h->h))
          {
-            h->cb.drop(h->data, _drag_current->type, ev);
+            h->cb.drop(h->data, h->type, ev);
             dropped = 1;
          }
      }
-   if (_drag_current->cb.finished)
-     _drag_current->cb.finished(_drag_current, dropped);
-   e_object_del(E_OBJECT(_drag_current));
-   _drag_current = NULL;
+   if (_drag_current)
+     {
+       if (_drag_current->cb.finished)
+         _drag_current->cb.finished(_drag_current, dropped);
+       e_object_del(E_OBJECT(_drag_current));
+       _drag_current = NULL;
+     }
 
    free(ev);
 }
@@ -421,6 +445,7 @@
 void
 e_drop_handler_del(E_Drop_Handler *handler)
 {
+   _drop_handlers = evas_list_remove(_drop_handlers, handler);
    free(handler->type);
    free(handler);
 }
@@ -520,11 +545,29 @@
 {
    Ecore_X_Event_Xdnd_Enter *ev;
    E_Container *con;
+   Evas_List *l;
+   int i;
 
    ev = event;
    con = data;
    if (con->bg_win != ev->win) return 1;
    printf("Xdnd enter\n");
+   for (i = 0; i < ev->num_types; i++)
+     {
+       printf("type: %s\n", ev->types[i]);
+       /* FIXME: Maybe we want to get something else then files dropped? */
+       if (strcmp("text/uri-list", ev->types[i]))
+         continue;
+       for (l = _drop_handlers; l; l = l->next)
+         {
+            E_Drop_Handler *h;
+
+            h = l->data;
+
+            h->active = !strcmp(h->type, "enlightenment/x-file");
+            h->entered = 0;
+         }
+     }
    return 1;
 }
 
@@ -546,27 +589,38 @@
 {
    Ecore_X_Event_Xdnd_Position *ev;
    E_Container *con;
+   Ecore_X_Rectangle rect;
+   Evas_List *l;
+
+   int active;
 
    ev = event;
    con = data;
    if (con->bg_win != ev->win) return 1;
-   printf("Xdnd pos\n");
 
-#if 0
+   rect.x = 0;
+   rect.y = 0;
+   rect.width = 0;
+   rect.height = 0;
+
    for (l = _drop_handlers; l; l = l->next)
      {
        E_Drop_Handler *h;
 
        h = l->data;
-       
-       if ((x >= h->x) && (x < h->x + h->w) && (y >= h->y) && (y < h->y + h->h)
-           && (!strcmp(h->type, drag_type)))
-         {
-            h->func(h->data, drag_type, ev);
-         }
+       if (h->active)
+         active = 1;
+     }
+   if (!active)
+     {
+       ecore_x_dnd_send_status(0, 0, rect, ECORE_X_DND_ACTION_PRIVATE);
      }
-#endif
+   else
+     {
+       e_drag_update(ev->position.x, ev->position.y);
 
+       ecore_x_dnd_send_status(1, 0, rect, ECORE_X_DND_ACTION_PRIVATE);
+     }
    return 1;
 }
 
@@ -580,6 +634,12 @@
    con = data;
    if (con->bg_win != ev->win) return 1;
    printf("Xdnd drop\n");
+
+   ecore_x_selection_xdnd_request(ev->win, "text/uri-list");
+
+   _xdnd = E_NEW(XDnd, 1);
+   _xdnd->x = ev->position.x;
+   _xdnd->y = ev->position.y;
    return 1;
 }
 
@@ -587,11 +647,34 @@
 _e_dnd_cb_event_dnd_selection(void *data, int type, void *event)
 {
    Ecore_X_Event_Selection_Notify *ev;
+   Ecore_X_Selection_Data_Files   *files;
    E_Container *con;
+   Evas_List *l = NULL;
+   int i;
 
    ev = event;
    con = data;
-   if (con->bg_win != ev->win) return 1;
+   if ((con->bg_win != ev->win) ||
+       (ev->selection != ECORE_X_SELECTION_XDND)) return 1;
    printf("Xdnd selection\n");
+
+   files = ev->data;
+   for (i = 0; i < files->num_files; i++)
+     {
+       printf("files: %s\n", files->files[i]);
+       /* FIXME:
+        * Remove file:///
+        * If ftp:// or http:// use curl/wget
+        * else, drop it...
+       l = evas_list_append(l, files->files[i]);
+       */
+     }
+
+   _xdnd->data = l;
+   e_drag_end(_xdnd->x, _xdnd->y);
+   evas_list_free(l);
+   ecore_x_dnd_send_finished();
+   free(_xdnd);
+   _xdnd = NULL;
    return 1;
 }
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_main.c,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -3 -r1.94 -r1.95
--- e_main.c    7 Jun 2005 13:05:18 -0000       1.94
+++ e_main.c    10 Jun 2005 21:26:50 -0000      1.95
@@ -397,13 +397,6 @@
        _e_main_shutdown(-1);
      }
    _e_main_shutdown_push(e_msg_shutdown);
-   /* setup module loading etc */
-   if (!e_module_init())
-     {
-       e_error_message_show(_("Enlightenment cannot set up its module 
system."));
-       _e_main_shutdown(-1);
-     }
-   _e_main_shutdown_push(e_module_shutdown);
    /* setup dnd */
    if (!e_dnd_init())
      {
@@ -411,6 +404,13 @@
        _e_main_shutdown(-1);
      }
    _e_main_shutdown_push(e_dnd_shutdown);
+   /* setup module loading etc */
+   if (!e_module_init())
+     {
+       e_error_message_show(_("Enlightenment cannot set up its module 
system."));
+       _e_main_shutdown(-1);
+     }
+   _e_main_shutdown_push(e_module_shutdown);
    /* setup winlist */
    if (!e_winlist_init())
      {




-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to