DragNDrop from an App to The Magic Desktop

DragNDrop from an App to The Magic Desktop

Post by Mark Burto » Wed, 03 May 1995 04:00:00



Goal:
I would like to implement DragNDrop from my application onto
Icons which exist on the desktop. This would allow my app to
drop a "PATH" on an icon and start the application appropriately,
just as if the FileManager had done it.

Actions:
So far I have implemented what I believe to be standard Motif
calls (borrowed from The Programming Manual), and I have gotten
the XmNconvertProc called. This routine stuffs the return values
as follows:

Boolean
convertProc( Widget w,
             Atom* selection, Atom* target, Atom* type,
             XtPointer* value, unsigned long* length, int* format)
{
    DragConvertPtr  conv;
    Boolean converted = False;
    Display  *display = XtDisplay(w);
    Atom     TARGETS = XmInternAtom( display, "TARGETS", False);
    Atom     SGI_ICON = XmInternAtom( display, "_SGI_ICON", False);
    Atom     MOTIF_DROP = XmInternAtom( display, "_MOTIF_DROP", False);

    /* get the widget that initiated the drag */
    XtVaGetValues( w, XmNclientData, &conv, NULL, 0);
    Widget widget = (Widget) conv->widget;

    /* Make sure we are doing a motif drag by checking if the widget that
     * is passed in is a drag context. Make sure the widget in the client
     * data is not NULL.
     */
    if( !widget || !XmIsDragContext( w) || *selection != MOTIF_DROP)
        return converted;

    if( *target == SGI_ICON) {

        const char* const name = "/usr/people/mark/string_test";
        char* m_name = XtMalloc( strlen( name) + 1);
        strcpy( m_name, name);
        *type = SGI_ICON;
        *value = (XtPointer)m_name;
        *length = strlen( m_name) + 1;
        *format = 8;
        converted = True;

    } else if (*target == TARGETS) {
        printf( "got here?");
    }

    return converted;

Quote:}

Problems:
1) The Drop looks correct in that the icon absorbes the drop, however,
the $SELECTED variable in the .ftr never seems to be set. I feel I
am missing something. Any ideas?

2) I would like this to be compliant over releases, so is the correct
behavior part of some standard, or is it going to be catch-is-catch-can
from release to release?

Thanks in advance for any insights,
mark

 
 
 

1. Magic Desktop Thumbnail View Question

Hello All,

I am currently working on some projects revolving around using my Indigo2
Impact Compression module to speed up JPEG display. I know that nobody can
really help me with that, but I do have question that someone might know
the answer to...

Is it possible to modify the code that handles thumbnail display in the
File Manager?

You probably see where I am going with this - I thought it might be cool
to accelerate the thumbnail generation of my JFIFs in FM. How is the
Thumbnail display handled? Is it possible to add support for different
file formats, such as Gimp XCF?

On a related note...

SGI has had the Adobe Photoshop Performance package available for a
while... is such a project possible for The GiMP? Is it necessary? Could
the SGI hardware accelerate certain GiMP functions? Just a random thought.

Thanks,
Nick

--
Nicholas Floersch
fnord.ubishops.ca/~zoontf
The more succinct your sig,
the more you grok the net

2. Conversion from gif/jpeg to Adobe Illustrator format

3. Info on 4Dwm and Indigo Magic Desktop

4. 3D Mouth Model

5. Making Pop-Up Menus in Indigo Magic Desktop and 4DWm

6. MS-Windows - device color capabilities

7. Need app to make images into desktop backgrounds.

8. IK

9. {HELP} Recommend a Desktop Pub. App

10. App changes Windows desktop image color

11. Studio Magic, REAL Magic, 928Movie (comments?)

12. Filling Desktop (preferably with default desktop image or color)

13. Mac apps v.s. 02 STUDIO bundle apps