Xdnd: Handle drag motion events and check that status rectangle

SVN revision: 12002
This commit is contained in:
xcomputerman 2004-10-24 05:52:07 +00:00 committed by xcomputerman
parent 98d8bb8ede
commit ceb2210f85
3 changed files with 25 additions and 4 deletions

View File

@ -197,8 +197,8 @@ _ecore_x_dnd_drag(int x, int y)
}
/* FIXME: Handle box information */
if (!_xdnd->await_status)
{
/*if (!_xdnd->await_status)
{*/
xev.xclient.window = win;
xev.xclient.message_type = _ecore_x_atom_xdnd_position;
xev.xclient.data.l[0] = _xdnd->source;
@ -208,7 +208,7 @@ _ecore_x_dnd_drag(int x, int y)
xev.xclient.data.l[4] = _xdnd->action; /* Version 2, Needs to be pre-set */
XSendEvent(_ecore_x_disp, win, False, 0, &xev);
_xdnd->await_status = 1;
}
/*}*/
}
if (_xdnd->state == ECORE_X_DND_DROPPED)

View File

@ -419,7 +419,9 @@ _ecore_x_event_handle_button_release(XEvent *xevent)
void
_ecore_x_event_handle_motion_notify(XEvent *xevent)
{
Ecore_X_Event_Mouse_Move *e;
Ecore_X_Event_Mouse_Move *e;
int x1, x2, y1, y2;
Ecore_X_DND_Protocol *_xdnd;
e = calloc(1, sizeof(Ecore_X_Event_Mouse_Move));
if (!e) return;
@ -436,6 +438,23 @@ _ecore_x_event_handle_motion_notify(XEvent *xevent)
_ecore_x_event_last_win = e->win;
_ecore_x_event_last_root_x = e->root.x;
_ecore_x_event_last_root_y = e->root.y;
/* Xdnd handling */
_xdnd = _ecore_x_dnd_protocol_get();
if (_xdnd->state == ECORE_X_DND_DRAGGING)
{
/* Determine if we're still in the rectangle from the last status */
x1 = _xdnd->rectangle.x;
x2 = _xdnd->rectangle.x + _xdnd->rectangle.width;
y1 = _xdnd->rectangle.y;
y2 = _xdnd->rectangle.y + _xdnd->rectangle.height;
if (e->win != _xdnd->dest || e->root.x < x1 || e->root.x > x2
|| e->root.y < y1 || e->root.y > y2)
{
_ecore_x_dnd_drag(e->root.x, e->root.y);
}
}
ecore_event_add(ECORE_X_EVENT_MOUSE_MOVE, e, NULL, NULL);
}

View File

@ -277,4 +277,6 @@ int _ecore_x_selection_convert(Atom selection, Atom target, void **data_ret);
void _ecore_x_dnd_init(void);
Ecore_X_DND_Protocol * _ecore_x_dnd_protocol_get(void);
void _ecore_x_dnd_drag(int x, int y);
#endif