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_dnd.c ecore_x_events.c ecore_x_private.h Log Message: Send and receive XdndStatus messages =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/Ecore_X.h,v retrieving revision 1.33 retrieving revision 1.34 diff -u -3 -r1.33 -r1.34 --- Ecore_X.h 7 Feb 2004 12:05:55 -0000 1.33 +++ Ecore_X.h 7 Feb 2004 19:37:47 -0000 1.34 @@ -416,7 +416,8 @@ struct _Ecore_X_Event_Xdnd_Status { Ecore_X_Window win, target; - int drop_accept; + int will_accept; + Ecore_X_Rectangle rectangle; Ecore_X_Atom action; }; =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_dnd.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- ecore_x_dnd.c 6 Feb 2004 05:32:50 -0000 1.2 +++ ecore_x_dnd.c 7 Feb 2004 19:37:47 -0000 1.3 @@ -82,3 +82,54 @@ return 1; } +void +ecore_x_dnd_send_status(int will_accept, int suppress, Ecore_X_Rectangle rectangle, Ecore_X_Atom action) +{ + XEvent xev; + + if (_xdnd->state == ECORE_X_DND_IDLE || + _xdnd->state == ECORE_X_DND_FINISHED) + return; + + memset(&xev, 0, sizeof(XEvent)); + + _xdnd->rectangle.x = rectangle.x; + _xdnd->rectangle.y = rectangle.y; + _xdnd->rectangle.width = rectangle.width; + _xdnd->rectangle.height = rectangle.height; + _xdnd->will_accept = will_accept; + _xdnd->suppress = suppress; + + xev.xclient.type = ClientMessage; + xev.xclient.display = _ecore_x_disp; + xev.xclient.message_type = _ecore_x_atom_xdnd_status; + xev.xclient.format = 32; + xev.xclient.window = _xdnd->source; + + xev.xclient.data.l[0] = _xdnd->dest; + if (will_accept) + xev.xclient.data.l[1] |= 0x1UL; + if (!suppress) + xev.xclient.data.l[1] |= 0x2UL; + + /* Set rectangle information */ + xev.xclient.data.l[2] = rectangle.x; + xev.xclient.data.l[2] <<= 16; + xev.xclient.data.l[2] |= rectangle.y; + xev.xclient.data.l[3] = rectangle.width; + xev.xclient.data.l[3] <<= 16; + xev.xclient.data.l[3] |= rectangle.height; + + if (will_accept) + { + xev.xclient.data.l[4] = action; + _xdnd->accepted_action = action; + } + else + { + xev.xclient.data.l[4] = None; + _xdnd->accepted_action = action; + } + + XSendEvent(_ecore_x_disp, _xdnd->source, False, 0, &xev); +} =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_events.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -3 -r1.22 -r1.23 --- ecore_x_events.c 6 Feb 2004 05:32:50 -0000 1.22 +++ ecore_x_events.c 7 Feb 2004 19:37:47 -0000 1.23 @@ -1106,10 +1106,13 @@ _xdnd->source = xevent->xclient.data.l[0]; _xdnd->dest = xevent->xclient.window; _xdnd->pos.x = xevent->xclient.data.l[2] >> 16; - _xdnd->pos.y = xevent->xclient.data.l[2] & 0x00FF; + _xdnd->pos.y = xevent->xclient.data.l[2] & 0xFFFFUL; _xdnd->action = xevent->xclient.data.l[4]; /* Version 2 */ /* TODO: Resolve a suitable method for enumerating Xdnd actions */ + /* Would it be feasible to handle the processing of this message + * within ecore? I think not, but someone might have an idea here. */ + e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Position)); if (!e) return; e->win = _xdnd->dest; @@ -1120,6 +1123,39 @@ e->action = _xdnd->action; ecore_event_add(ECORE_X_EVENT_XDND_POSITION, e, _ecore_x_event_free_generic, NULL); } + else if (xevent->xclient.message_type == _ecore_x_atom_xdnd_status) + { + Ecore_X_Event_Xdnd_Status *e; + Ecore_X_DND_Protocol *_xdnd; + + _xdnd = _ecore_x_dnd_protocol_get(); + /* Make sure source/target match */ + if (_xdnd->source != xevent->xclient.window + || _xdnd->dest != xevent->xclient.data.l[0]) + return; + _xdnd->will_accept = xevent->xclient.data.l[1] & 0x1UL; + _xdnd->suppress = (xevent->xclient.data.l[1] & 0x2UL) ? 0 : 1; + + _xdnd->rectangle.x = xevent->xclient.data.l[2] >> 16; + _xdnd->rectangle.y = xevent->xclient.data.l[2] & 0xFFFFUL; + _xdnd->rectangle.width = xevent->xclient.data.l[3] >> 16; + _xdnd->rectangle.height = xevent->xclient.data.l[3] & 0xFFFFUL; + + _xdnd->accepted_action = xevent->xclient.data.l[4]; + + e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Status)); + if (!e) return; + e->win = _xdnd->source; + e->target = _xdnd->dest; + e->will_accept = _xdnd->will_accept; + e->rectangle.x = _xdnd->rectangle.x; + e->rectangle.y = _xdnd->rectangle.y; + e->rectangle.width = _xdnd->rectangle.width; + e->rectangle.height = _xdnd->rectangle.height; + e->action = _xdnd->accepted_action; + + ecore_event_add(ECORE_X_EVENT_XDND_STATUS, 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.21 retrieving revision 1.22 diff -u -3 -r1.21 -r1.22 --- ecore_x_private.h 6 Feb 2004 05:32:51 -0000 1.21 +++ ecore_x_private.h 7 Feb 2004 19:37:47 -0000 1.22 @@ -79,9 +79,12 @@ } pos; Atom *types; - Atom action; + Atom action, accepted_action; int num_types; + int will_accept; + int suppress; + struct { Ecore_Event_Handler *mouse_move; Ecore_Event_Handler *mouse_up; ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ enlightenment-cvs mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs