Re: tooltips and DND



hi,

> > if i DND a file over this kind of button the tooltip
> > is not shown - in general it works but not in this case.
> > 
> > is that my fault, bug or feature?
> 
> It's a feature of the current tooltips implementation. :-(
> 
> When a thing is being dragged, the "enter" and "leave" events
> that would have arrived at the drop zone and triggered the
> tooltip are instead being redirected to the widget that you
> dragged from (more or less). Thus the tooltip never knows
> you're "there".
> 
> In the drag and drop protocol as I remember it, different
> events *are* still being sent to the "entered" widget,
> specifically ones that say "a droppable thing is over you".
> That's so the widget can change shape or otherwise indicate
> that it is a drop zone.
> 
> If that's how it still works, tooltips MAY be able to trap
> these as well, and treat them as enter and leave events,
> thus making the stuff "work right".
> 
> In any case, the events are being redirected, not lost, so
> it is POSSIBLE to implement tooltips (and dnd) such that
> this would work, if the time is put in to do it.

i continued to play around and the following seems to work:

/*
 * called on drag_motion event
 */
gboolean
button_drag_motion (GtkWidget *btn, GdkDragContext *context, gint x, gint y,
                    guint time, void *data)
{
    GdkEventCrossing ev;

    ev.type = GDK_ENTER_NOTIFY;
    ev.window = btn->window;
    ev.send_event = TRUE;
    ev.subwindow = 0;
    ev.time = gdk_time_get ();
    ev.mode = GDK_CROSSING_GRAB;

    gdk_event_put ((GdkEvent *)&ev);
    return (TRUE);
}

/*
 * called on drag_leave event
 */
void
button_drag_leave (GtkWidget *btn, GdkDragContext *cnt, guint time, void *data)
{
    GdkEventCrossing ev;

    ev.type = GDK_LEAVE_NOTIFY;
    ev.window = btn->window;
    ev.send_event = TRUE;
    ev.subwindow = 0;
    ev.time = gdk_time_get ();
    ev.mode = GDK_CROSSING_GRAB;
    gdk_event_put ((GdkEvent *)&ev);
}

thx for your mail
cu
 rasca
-- 
 /#- Internet eMail: thron@gmx.de, FidoNet: 2:2410/304.5@fido -#\
<-#- Internet WWWeb: http://home.pages.de/~rasca/ -------------#->
 \#- please do NOT quote these lines or other useless stuff! --#/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]