capi drag and drop on linux/gtk?
Hi,Does drag-and-drop work on linux/gtk? I try the code below, which is from the capi documentation on two linux machines. Dropping strings into an emacs buffer works; dropping into the capi:list-panel of the demo code did not.
I tried:
openSUSE 12.3 (Dartmouth) (x86_64) and
Ubuntu 14.04 LTS (x86_64)
My lispworks is 6.1.1 32-bit linux
Perhaps the problem is that my linux is 64 bit and lispworks is 32 bit. Of course I'm using the 32-bit gtk libraries, and other capi things have been working OK.
Best regards,
Peter
(in-package :cl-user)
(defun list-drop-callback (pane drop-object stage)
(format t "list drop callback ~S ~S ~S" pane drop-object stage)
(case stage
(:formats
(set-drop-object-supported-formats drop-object (list :string)))
(:drag
(when (and (drop-object-provides-format drop-object :string)
(drop-object-allows-drop-effect-p drop-object :copy))
(setf (drop-object-drop-effect drop-object) :copy)))
(:drop
(when (and (drop-object-provides-format drop-object :string)
(drop-object-allows-drop-effect-p drop-object :copy))
(setf (drop-object-drop-effect drop-object) :copy)
(add-list-item pane drop-object)))))
(defun add-list-item (pane drop-object)
(append-items
pane
(list (string-capitalize
(drop-object-get-object drop-object
pane :string)))))
(defun demo-target ()
(contain
(make-instance 'list-panel
:title "Shopping list"
:items (list "Tea" "Bread")
:drop-callback 'list-drop-callback)))
(defun tree-drag-callback (pane indices)
(list :string
(string (elt (capi:collection-items pane)
(first indices)))))
(defun fruits (x)
(case x
(:fruits (list :apple :orange))
(:apple (list :cox :bramley))
(:orange (list :blood-orange :seville))
(t nil)))
(defun demo-source ()
(capi:contain
(make-instance 'capi:tree-view
:title "Fruit tree"
:roots '(:fruits)
:children-function 'fruits
:drag-callback 'tree-drag-callback)))