Re: DND on GTK - cancel attempt




The struct GtkDragSourceInfo seems to have the info I require about what actions are supported by the drag source but this method is not available externally.  Is there some way to access the possible_actions field of GtkDragSourceInfo?



"Veronika Irvine" <Veronika_Irvine oti com>
Sent by: gtk-list-admin gnome org

07/15/2002 05:48 PM

       
        To:        Havoc Pennington <hp redhat com>
        cc:        gtk-list gnome org
        Subject:        Re: DND on GTK - cancel attempt



Thank you.  I am now using gtk_drag_check_threshold() and gtk_drag_begin() which gives me the desired control over starting a drag operation.


I have another question for you though.  On Windows and Motif, in the Drop target I can differentiate between drag enter, drag move, and drag operation changed (change in the modifier keys).   Do I need to detect these state changes myself in GTK or is there a flag in "drag_motion" that will tell me?  


With Motif and Windows I can also get the set of operations supported by the source, the operation suggested by the keys pressed and the operation chosen by the drop target (which may be different from the keys pressed).  A posting by Owen for GdkDragContext says:


 GdkDragAction actions;          /* Actions source supports */
GdkDragAction suggested_action; /* Action source suggests */
GdkDragAction action;           /* Action destination has selected */


so it looks like the fields I want are there but , in the context passed in the drag_motion callback, only the actions field has a value and it changes with the keys selected (which is what I would have expected out of suggested_action not actions).  After I call gdk_drag_status, I would have expected the action field to be filled in but it is not.  What am I missing?


Thank you in advance,

Veronika




Havoc Pennington <hp redhat com>
Sent by: gtk-list-admin gnome org

07/14/2002 08:24 PM

       
       To:        "Veronika Irvine" <Veronika_Irvine oti com>
       cc:        gtk-list gnome org
       Subject:        Re: DND on GTK - cancel attempt




"Veronika Irvine" <Veronika_Irvine oti com> writes:
> To allow a widget to participate as a drag source I have two options 1) gtk_drag_source_set and 2) gtk_drag_begin.
>
> What I want to be able to do is when the conditions are right for a drag
> to begin, I want to check if I indeed want to perform a drag (e.g. do I
> have anything selected to drag).
> If I have nothing to drag, I do not want to proceed.
>
>  As far as I can gather, if I use gtk_drag_source_set I will be notified
> in my drag_begin callback that the conditions for a drag to start have
> been met.  But I can see no way in the drag_begin callback to abort the
> operation (in fact calling gdk_drag_abort does not work and there is no
> return value to indicate failure).
>
> Alternatively, I can detect that a DND operation may begin and then call
> gtk_drag_begin but since the user can possibly configure the timing,
> button used, distance moved etc I really can't do a good job of figuring
> out when the DND operation may begin.

I believe if you use drag_source_set you can't customize when the drag
begins. You need to begin the drag yourself in that
case. gtktreeview.c contains an example.

There's a gtk_drag_check_threshold() function you should use to be
sure you're using a consistent drag threshold.

Havoc

_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list





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