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.
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 -r1.204 Ecore_X.h
--- Ecore_X.h	25 Jul 2008 02:21:03 -0000	1.204
+++ Ecore_X.h	14 Aug 2008 19:41:05 -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 -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	14 Aug 2008 19:41:05 -0000
@@ -489,6 +489,9 @@
    /* Default Accepted Action: ask */
    _source->action = ECORE_X_ATOM_XDND_ACTION_COPY;
    _source->accepted_action = XCB_NONE;
+
+   _source->prev.initialized = 0;
+
    return 1;
 }
 
@@ -611,6 +614,20 @@
 }
 
 void
+ecore_x_dnd_source_action_set(Ecore_X_Atom action)
+{
+   _source->action = action;
+   if(_source->prev.initialized)
+     _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,11 @@
 	     xcb_send_event(_ecore_xcb_conn, 0, win, 0, (const char *)&ev);
 
 	     _source->await_status = 1;
+
+	     _source->prev.initialized = 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 -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	14 Aug 2008 19:41:06 -0000
@@ -107,6 +107,12 @@
       unsigned short width, height;
    } rectangle;
 
+   struct {
+        short initialized;
+        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 -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	14 Aug 2008 19:41:06 -0000
@@ -341,6 +341,8 @@
    _source->accepted_action = None;
    _source->dest = None;
 
+   _source->prev.initialized = 0;
+
    return 1;
 }
 
@@ -462,6 +464,20 @@
 }
 
 void
+ecore_x_dnd_source_action_set(Ecore_X_Atom action)
+{
+   _source->action = action;
+   if(_source->prev.initialized)
+     _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 +577,11 @@
 	     XSendEvent(_ecore_x_disp, win, False, 0, &xev);
 
 	     _source->await_status = 1;
+   
+	     _source->prev.initialized = 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 -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	14 Aug 2008 19:41:07 -0000
@@ -103,6 +103,12 @@
       unsigned short width, height;
    } rectangle;
 
+   struct {
+        short initialized;
+        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
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to