Enlightenment CVS committal

Author  : xcomputerman
Project : e17
Module  : libs/ecore

Dir     : e17/libs/ecore/src/lib/ecore_x


Modified Files:
        Ecore_X.h ecore_x.c ecore_x_dnd.c ecore_x_events.c 
        ecore_x_private.h 


Log Message:
Finish up client message handling for Xdnd. Still has a couple of 
unresolved cases that will be filled out when the actual dnd process loop
is written.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/Ecore_X.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -3 -r1.35 -r1.36
--- Ecore_X.h   15 Feb 2004 21:37:34 -0000      1.35
+++ Ecore_X.h   21 Feb 2004 08:58:20 -0000      1.36
@@ -125,7 +125,7 @@
 typedef struct _Ecore_X_Event_Xdnd_Position            Ecore_X_Event_Xdnd_Position;
 typedef struct _Ecore_X_Event_Xdnd_Status              Ecore_X_Event_Xdnd_Status;
 typedef struct _Ecore_X_Event_Xdnd_Leave               Ecore_X_Event_Xdnd_Leave;
-typedef struct _Ecore_X_Event_Xdnd_Drop                Ecore_X_Event_Xdnd_Stop;
+typedef struct _Ecore_X_Event_Xdnd_Drop                Ecore_X_Event_Xdnd_Drop;
 typedef struct _Ecore_X_Event_Xdnd_Finished            Ecore_X_Event_Xdnd_Finished;
 typedef struct _Ecore_X_Event_Client_Message           Ecore_X_Event_Client_Message;
 typedef struct _Ecore_X_Event_Window_Shape             Ecore_X_Event_Window_Shape;
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -3 -r1.29 -r1.30
--- ecore_x.c   20 Feb 2004 07:06:29 -0000      1.29
+++ ecore_x.c   21 Feb 2004 08:58:20 -0000      1.30
@@ -46,6 +46,7 @@
 Atom     _ecore_x_atom_selection_prop_clipboard = 0;
 
 Atom     _ecore_x_atom_selection_xdnd = 0;
+Atom     _ecore_x_atom_selection_prop_xdnd = 0;
 Atom     _ecore_x_atom_xdnd_aware = 0;
 Atom     _ecore_x_atom_xdnd_enter = 0;
 Atom     _ecore_x_atom_xdnd_type_list = 0;
@@ -369,6 +370,7 @@
    _ecore_x_atom_selection_prop_primary   = XInternAtom(_ecore_x_disp, 
"_ECORE_SELECTION_PRIMARY", False);
    _ecore_x_atom_selection_prop_secondary = XInternAtom(_ecore_x_disp, 
"_ECORE_SELECTION_SECONDARY", False);
    _ecore_x_atom_selection_prop_clipboard = XInternAtom(_ecore_x_disp, 
"_ECORE_SELECTION_CLIPBOARD", False);
+   _ecore_x_atom_selection_prop_xdnd      = XInternAtom(_ecore_x_disp, 
"_ECORE_SELECTION_XDND", False);
    _ecore_x_atom_selection_xdnd           = XInternAtom(_ecore_x_disp, 
"XdndSelection", False);
    _ecore_x_atom_xdnd_aware               = XInternAtom(_ecore_x_disp, "XdndAware", 
False);
    _ecore_x_atom_xdnd_type_list           = XInternAtom(_ecore_x_disp, 
"XdndTypeList", False);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_dnd.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- ecore_x_dnd.c       7 Feb 2004 19:37:47 -0000       1.3
+++ ecore_x_dnd.c       21 Feb 2004 08:58:20 -0000      1.4
@@ -78,6 +78,7 @@
 
    _xdnd->source = source;
    _xdnd->state = ECORE_X_DND_DRAGGING;
+   _xdnd->time = _ecore_x_event_last_time;
 
    return 1;
 }
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_events.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -3 -r1.24 -r1.25
--- ecore_x_events.c    8 Feb 2004 19:39:29 -0000       1.24
+++ ecore_x_events.c    21 Feb 2004 08:58:20 -0000      1.25
@@ -1038,7 +1038,9 @@
           e->time = _ecore_x_event_last_time;
        ecore_event_add(ECORE_X_EVENT_WINDOW_DELETE_REQUEST, e, 
_ecore_x_event_free_generic, NULL);
    }
-   /* Xdnd Client Message Handling */
+   
+   /* Xdnd Client Message Handling Begin */
+   /* Message Type: XdndEnter */
    else if (xevent->xclient.message_type == _ecore_x_atom_xdnd_enter)
    {
       Ecore_X_Event_Xdnd_Enter *e;
@@ -1095,9 +1097,11 @@
       e->win = _xdnd->dest;
       e->source = _xdnd->source;
       e->time = CurrentTime;
+      _ecore_x_event_last_time = e->time;
       ecore_event_add(ECORE_X_EVENT_XDND_ENTER, e, _ecore_x_event_free_generic, NULL);
    }
    
+   /* Message Type: XdndPosition */
    else if (xevent->xclient.message_type == _ecore_x_atom_xdnd_position)
    {
       Ecore_X_Event_Xdnd_Position *e;
@@ -1124,6 +1128,8 @@
       e->action = _xdnd->action;
       ecore_event_add(ECORE_X_EVENT_XDND_POSITION, e, _ecore_x_event_free_generic, 
NULL);
    }
+   
+   /* Message Type: XdndStatus */
    else if (xevent->xclient.message_type == _ecore_x_atom_xdnd_status)
    {
       Ecore_X_Event_Xdnd_Status *e;
@@ -1157,6 +1163,108 @@
 
       ecore_event_add(ECORE_X_EVENT_XDND_STATUS, e, _ecore_x_event_free_generic, 
NULL);
    }
+
+   /* Message Type: XdndLeave */
+   /* Pretend the whole thing never happened, sort of */
+   else if (xevent->xclient.message_type == _ecore_x_atom_xdnd_leave)
+   {
+      Ecore_X_Event_Xdnd_Leave *e;
+      Ecore_X_DND_Protocol *_xdnd;
+
+      _xdnd = _ecore_x_dnd_protocol_get();
+      /* Match source/target */
+      if (_xdnd->source != xevent->xclient.data.l[0]
+            || _xdnd->dest != xevent->xclient.window)
+         return;
+      if (_xdnd->types)
+         free(_xdnd->types);
+      _xdnd->num_types = 0;
+      /* XXX: May need to reset event handler callbacks as well */
+      _xdnd->state = ECORE_X_DND_IDLE;
+
+      e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Leave));
+      if (!e) return;
+      e->win = _xdnd->dest;
+      e->source = _xdnd->source;
+      ecore_event_add(ECORE_X_EVENT_XDND_ENTER, e, _ecore_x_event_free_generic, NULL);
+   }
+   else if (xevent->xclient.message_type == _ecore_x_atom_xdnd_drop)
+   {
+      Ecore_X_Event_Xdnd_Drop *e;
+      Ecore_X_DND_Protocol *_xdnd;
+      Ecore_X_Time timestamp;
+
+      _xdnd = _ecore_x_dnd_protocol_get();
+      /* Match source/target */
+      if (_xdnd->source != xevent->xclient.data.l[0]
+            || _xdnd->dest != xevent->xclient.window)
+         return;
+      
+      timestamp = (_xdnd->version >= 1) ? 
+                     xevent->xclient.data.l[2] : _ecore_x_event_last_time;
+      
+      XConvertSelection(_ecore_x_disp, _ecore_x_atom_selection_xdnd,
+            _xdnd->dest, _ecore_x_atom_selection_prop_xdnd, _xdnd->dest,
+            timestamp);
+
+      /* FIXME: Have to wait for SelectionNotify before we can send
+       * XdndFinished. Stupid, retarded protocols, gah! */
+
+      e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Drop));
+      if (!e) return;
+      e->win = _xdnd->dest;
+      e->source = _xdnd->source;
+      e->time = timestamp;
+      e->action = _xdnd->action;
+      e->position.x = _xdnd->pos.x;
+      e->position.y = _xdnd->pos.y;
+      ecore_event_add(ECORE_X_EVENT_XDND_DROP, e, _ecore_x_event_free_generic, NULL);
+   }
+
+   /* Message Type: XdndFinished */
+   else if (xevent->xclient.message_type == _ecore_x_atom_xdnd_finished)
+   {
+      Ecore_X_Event_Xdnd_Finished *e;
+      Ecore_X_DND_Protocol *_xdnd;
+      int completed = 1;
+
+      _xdnd = _ecore_x_dnd_protocol_get();
+      /* Match source/target */
+      if (_xdnd->source != xevent->xclient.window
+            || _xdnd->dest != xevent->xclient.data.l[0])
+         return;
+
+      if (_xdnd->version >= 5 && (xevent->xclient.data.l[1] & 0x1UL))
+      {
+         /* Target successfully performed drop action */
+         _xdnd->state = ECORE_X_DND_IDLE;
+      } else {
+         completed = 0;
+         _xdnd->state = ECORE_X_DND_TARGET_CONVERTING;
+         
+         /* FIXME: Probably need to add a timer to switch back to idle 
+          * and discard the selection data */
+      } 
+
+      e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Finished));
+      if (!e) return;
+      e->win = _xdnd->source;
+      e->target = _xdnd->dest;
+      e->completed = completed;
+      if (_xdnd->version >= 5)
+      {
+         _xdnd->accepted_action = xevent->xclient.data.l[2];
+         e->action = _xdnd->accepted_action;
+      }
+      else
+      {
+         _xdnd->accepted_action = 0;
+         e->action = _xdnd->action;
+      }
+
+      ecore_event_add(ECORE_X_EVENT_XDND_FINISHED, e, _ecore_x_event_free_generic, 
NULL);
+
+   }
    else
    {
        /* FIXME: handle this event type */
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_private.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- ecore_x_private.h   7 Feb 2004 19:37:47 -0000       1.22
+++ ecore_x_private.h   21 Feb 2004 08:58:20 -0000      1.23
@@ -78,6 +78,8 @@
       int x, y;
    } pos;
    
+   Time time;
+   
    Atom *types;
    Atom action, accepted_action;
    int num_types;
@@ -186,6 +188,7 @@
 extern Atom     _ecore_x_atom_selection_prop_clipboard;
 
 extern Atom     _ecore_x_atom_selection_xdnd;
+extern Atom     _ecore_x_atom_selection_prop_xdnd;
 extern Atom     _ecore_x_atom_xdnd_aware;
 extern Atom     _ecore_x_atom_xdnd_enter;
 extern Atom     _ecore_x_atom_xdnd_type_list;
@@ -196,6 +199,7 @@
 extern Atom     _ecore_x_atom_xdnd_action_list;
 extern Atom     _ecore_x_atom_xdnd_action_description;
 extern Atom     _ecore_x_atom_xdnd_status;
+extern Atom     _ecore_x_atom_xdnd_leave;
 extern Atom     _ecore_x_atom_xdnd_drop;
 extern Atom     _ecore_x_atom_xdnd_finished;
 




-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to