Using XDnD in extensions


Is there a way for extensions in GNOME Shell 3.6 to get information
about XDnD drops other than just mouse cursor positions? The following
code works fine for items from within GNOME Shell (such as application
icons), but I can't seem to get any useful information about files
dropped from Nautilus.

 * Drag and drop test.
const DndButton = new Lang.Class({
    Name: "DndButton",
    Extends: St.Button,

    _init: function() {

        this.set_label("[DROP STUFF HERE]");
        this.set_position(5, 30);
        this.set_background_color(new Clutter.Color({
            red: 0,
            blue: 0,
            green: 0,
            alpha: 150,

        this._delegate = this;


    handleDragOver: function(source, actor, x, y, time) {
        return DND.DragMotionResult.COPY_DROP;

    acceptDrop: function(source, actor, x, y, time) {
        this.set_label("[ACCEPTED " + time + "]");
        return true;

Also, although handleDragOver gets called for XDnD, returning
COPY_DROP seems to do nothing. The source parameter is assigned an
xdndHandler instance, but it doesn't seem to contain any useful

Joakim Söderlund

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