On Fri, Aug 15, 2008 at 11:17:35PM +0400, Fedor Gusev wrote:
> Hello everyone!
> 
> Attached patched brings two new functions to Ecore_X:
> 
> EAPI void             ecore_x_dnd_source_action_set(Ecore_X_Atom action);
> EAPI Ecore_X_Atom     ecore_x_dnd_source_action_get(void);
> 
> The first one sets the action that would be sent in all subsequent
> XdndPosition messages. This action is reset to XdndActionMove in
> ecore_x_dnd_begin().
> The second function, obviously, gets the current action.
> 
> Apply from e17/libs/ecore/src/lib/ecore_x.
> -- 
> King regards,
> Fedor Gusev.

Updated version.

-- 
King regards,
Fedor Gusev.
Index: Ecore_X.h
===================================================================
RCS file: /var/cvs/e/e17/libs/ecore/src/lib/ecore_x/Ecore_X.h,v
retrieving revision 1.204
diff -u -u -r1.204 Ecore_X.h
--- Ecore_X.h	25 Jul 2008 02:21:03 -0000	1.204
+++ Ecore_X.h	15 Aug 2008 21:38:56 -0000
@@ -1078,6 +1078,8 @@
 EAPI int              ecore_x_dnd_drop(void);
 EAPI void             ecore_x_dnd_send_status(int will_accept, int suppress, Ecore_X_Rectangle rectangle, Ecore_X_Atom action);
 EAPI void             ecore_x_dnd_send_finished(void);
+EAPI void             ecore_x_dnd_source_action_set(Ecore_X_Atom action);
+EAPI Ecore_X_Atom     ecore_x_dnd_source_action_get(void);
 
 EAPI Ecore_X_Window   ecore_x_window_new(Ecore_X_Window parent, int x, int y, int w, int h);
 EAPI Ecore_X_Window   ecore_x_window_override_new(Ecore_X_Window parent, int x, int y, int w, int h);
Index: xcb/ecore_xcb_dnd.c
===================================================================
RCS file: /var/cvs/e/e17/libs/ecore/src/lib/ecore_x/xcb/ecore_xcb_dnd.c,v
retrieving revision 1.1
diff -u -u -r1.1 ecore_xcb_dnd.c
--- xcb/ecore_xcb_dnd.c	23 Jul 2008 10:00:01 -0000	1.1
+++ xcb/ecore_xcb_dnd.c	15 Aug 2008 21:38:58 -0000
@@ -30,6 +30,7 @@
 	_source->win = XCB_NONE;
 	_source->dest = XCB_NONE;
 	_source->state = ECORE_X_DND_SOURCE_IDLE;
+	_source->prev.window = 0;
 
 	_target = calloc(1, sizeof(Ecore_X_DND_Target));
 	_target->win = XCB_NONE;
@@ -485,6 +486,7 @@
    ecore_x_window_ignore_set(_source->win, 1);
    _source->state = ECORE_X_DND_SOURCE_DRAGGING;
    _source->time = _ecore_xcb_event_last_time;
+   _source->prev.window = 0;
 
    /* Default Accepted Action: ask */
    _source->action = ECORE_X_ATOM_XDND_ACTION_COPY;
@@ -532,6 +534,7 @@
      }
    ecore_x_window_ignore_set(_source->win, 0);
 
+   _source->prev.window = 0;
    _source->dest = XCB_NONE;
 
    return status;
@@ -611,6 +614,20 @@
 }
 
 void
+ecore_x_dnd_source_action_set(Ecore_X_Atom action)
+{
+   _source->action = action;
+   if (_source->prev.window)
+     _ecore_x_dnd_drag(_source->prev.window, _source->prev.x, _source->prev.y);
+}
+
+Ecore_X_Atom
+ecore_x_dnd_source_action_get(void)
+{
+   return _source->action;
+}
+
+void
 _ecore_x_dnd_drag(Ecore_X_Window root,
 		  int x,
                   int y)
@@ -744,6 +761,10 @@
 	     xcb_send_event(_ecore_xcb_conn, 0, win, 0, (const char *)&ev);
 
 	     _source->await_status = 1;
+
+	     _source->prev.x = x;
+	     _source->prev.y = y;
+	     _source->prev.window = root;
 	  }
      }
 
Index: xcb/ecore_xcb_private.h
===================================================================
RCS file: /var/cvs/e/e17/libs/ecore/src/lib/ecore_x/xcb/ecore_xcb_private.h,v
retrieving revision 1.1
diff -u -u -r1.1 ecore_xcb_private.h
--- xcb/ecore_xcb_private.h	23 Jul 2008 10:00:01 -0000	1.1
+++ xcb/ecore_xcb_private.h	15 Aug 2008 21:38:59 -0000
@@ -107,6 +107,11 @@
       unsigned short width, height;
    } rectangle;
 
+   struct {
+      Ecore_X_Window window;
+      int x, y;
+   } prev;
+   
    Ecore_X_Time time;
 
    Ecore_X_Atom action, accepted_action;
Index: xlib/ecore_x_dnd.c
===================================================================
RCS file: /var/cvs/e/e17/libs/ecore/src/lib/ecore_x/xlib/ecore_x_dnd.c,v
retrieving revision 1.1
diff -u -u -r1.1 ecore_x_dnd.c
--- xlib/ecore_x_dnd.c	23 Jul 2008 10:00:01 -0000	1.1
+++ xlib/ecore_x_dnd.c	15 Aug 2008 21:38:59 -0000
@@ -35,6 +35,7 @@
 	_source->win = None;
 	_source->dest = None;
 	_source->state = ECORE_X_DND_SOURCE_IDLE;
+	_source->prev.window = 0;
 
 	_target = calloc(1, sizeof(Ecore_X_DND_Target));
 	_target->win = None;
@@ -335,6 +336,7 @@
    ecore_x_window_ignore_set(_source->win, 1);
    _source->state = ECORE_X_DND_SOURCE_DRAGGING;
    _source->time = _ecore_x_event_last_time;
+   _source->prev.window = 0;
 
    /* Default Accepted Action: move */
    _source->action = ECORE_X_ATOM_XDND_ACTION_MOVE;
@@ -384,6 +386,8 @@
      }
    ecore_x_window_ignore_set(_source->win, 0);
 
+   _source->prev.window = 0;
+
    return status;
 }
 
@@ -462,6 +466,20 @@
 }
 
 void
+ecore_x_dnd_source_action_set(Ecore_X_Atom action)
+{
+   _source->action = action;
+   if (_source->prev.window)
+     _ecore_x_dnd_drag(_source->prev.window, _source->prev.x, _source->prev.y);
+}
+
+Ecore_X_Atom
+ecore_x_dnd_source_action_get(void)
+{
+   return _source->action;
+}
+
+void
 _ecore_x_dnd_drag(Ecore_X_Window root, int x, int y)
 {
    XEvent          xev;
@@ -561,6 +579,10 @@
 	     XSendEvent(_ecore_x_disp, win, False, 0, &xev);
 
 	     _source->await_status = 1;
+   
+	     _source->prev.x = x;
+	     _source->prev.y = y;
+	     _source->prev.window = root;
 	  }
      }
 
Index: xlib/ecore_x_private.h
===================================================================
RCS file: /var/cvs/e/e17/libs/ecore/src/lib/ecore_x/xlib/ecore_x_private.h,v
retrieving revision 1.1
diff -u -u -r1.1 ecore_x_private.h
--- xlib/ecore_x_private.h	23 Jul 2008 10:00:01 -0000	1.1
+++ xlib/ecore_x_private.h	15 Aug 2008 21:38:59 -0000
@@ -103,6 +103,11 @@
       unsigned short width, height;
    } rectangle;
 
+   struct {
+      Ecore_X_Window window;
+      int x, y;
+   } prev;
+
    Time time;
 
    Ecore_X_Atom action, accepted_action;
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to