can't retrieve text/image added by gtk:clipboard-set-with-data
Chisheng Huang <[email protected]> Wed, 05 Dec 2007 10:52:08 -0800
| Newsgroups | gmane.lisp.clg.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I'd like to use GTK:CLIPBOARD-SET-WITH-DATA so that I can carry out some
clean up operations after the data posted to the clipboard is cleared.
But the problem is the text or pixbuf passed to GTK:CLIPBOARD-SET-WITH-DATA
can't be retrieved by gtk:clipboard-wait-for-{text or image} and
gtk:clipboard-request-{text or image}. The attached code demonstrates
the problem. Any help to get around this problem will be appreciated.
Best wishes,
-cph
;;------------------------------------------------------------------
;; you'll need this binding to run the test code.
(in-package :gtk)
(defbinding target-table-new-from-list () (vector (inlined target-entry) n-targets)
(target-list target-list)
(n-targets int :out))
;;------------------------------------------------------------------
(in-package :cl-user)
;; if we use GTK:CLIPBOARD-SET-TEXT, no problem to retrieve text
;; from the clipboard.
(gtk:clipboard-set-text (gtk:clipboard-get "CLIPBOARD") "text")
;; this returns "text"
(gtk:clipboard-wait-for-text (gtk:clipboard-get "CLIPBOARD"))
;; this prints out (:RECEIVED-TEXT "text")
(gtk:clipboard-request-text (gtk:clipboard-get "CLIPBOARD")
(lambda (text)
(print (list :received-text text))))
;;------------------------------------------------------------------
(let ((target-list (make-instance 'gtk:target-list)))
(gtk:target-list-add-text-targets target-list 0)
(gtk:clipboard-set-with-data (gtk:clipboard-get "CLIPBOARD")
(gtk::target-table-new-from-list target-list)
;; get-func
#'(lambda (sd info)
(print :get-func)
(gtk:selection-data-set-text sd
"with data")
(print (list :text-in-selection-data
(gtk:selection-data-get-text sd))))
;; clear-func
#'(lambda ()
(print :clear-func))))
;; GET-FUNC is called but this returns NIL.
(gtk:clipboard-wait-for-text (gtk:clipboard-get "CLIPBOARD"))
;; GET-FUNC is called but this prints out (:RECEIVED-TEXT NIL)
(gtk:clipboard-request-text (gtk:clipboard-get "CLIPBOARD")
(lambda (text)
(print (list :received-text text))))
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4