🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.epoch.misc
Article #1452

Re: epoch cut and paste

#1452
From: Ken Laprade
Date: Tue, 12 May 1992 11:42
70 lines
3566 bytes
In <92May4.143134edt.133465@wotan.ai.toronto.edu> kramer@cs.toronto.edu ("Bryan M. Kramer") writes:
>...
>p.s. Is there a package that would pickup files dragged into epoch
>from the file manager?

Here is what I put together.  It handles drag-n-drop's from filemgr into
epoch for both OpenWindows 3.0 and 2.0.  It worked quite nicely under 2.0.
Unfortunately, the dnd interface got much more complicated in 3.0 and I
didn't want to bother figuring it out.  There is a 2.0 combatibility hook
built into Xview 3.0 dnd, but it does not kick in until after a five second
timeout (I cannot see why it should need a timeout).  So, if you use this
under 3.0, wait five seconds after dropping before you expect the file to
show up.

--------------------drag-drop.el--------------------
;;; Epoch drag-drop interface to OpenWindows 2.0.
;;; - Ken Laprade <laprade@trantor.harris-atd.com> -  3 Jan 92

;; Trick OpenWindows 3.0 into accepting us as a drop site.
(set-property (epoch::intern-atom "_XVIEW_V2_APP") 0)

(defvar drag-from-xview3 nil
  "Flag indicating drag-drop came from an xview 3.0 application.")

(defun drag-trigger-handler (type value screen)
  (setq drag-from-xview3 t))

(defun drag-drop-string (value)
  (if drag-from-xview3
      (get-property "DRAG_DROP" (set-resource-type (nth 5 value) (intern-atom "WINDOW")))
    (epoch::convert-selection "PRIMARY" "STRING" "PROPERTY")))

(defun drag-load-handler (type value screen)
  (select-screen screen)
  (let ((file (drag-drop-string value)))
    (and (stringp file)
	 (not (equal file ""))
	 (let* ((pointer (query-pointer))
		(coords (coords-to-point (car pointer) (nth 1 pointer) screen))
		(window (nth 2 coords)))
	   (and window
		(not (equal window (minibuffer-window)))
		(select-window window))
	   (find-file file)))))

(defun drag-copy-handler (type value screen)
  (select-screen screen)
  (let* ((pointer (query-pointer))
	 (coords (coords-to-point (car pointer) (nth 1 pointer) screen))
	 (window (nth 2 coords))
	 (pos (car coords)))
    (if window (select-window window))
    (if pos (goto-char pos)))
  (setq last-command 'drag-copy-handler)
  (barf-if-buffer-read-only)
  (undo-boundary)
  (push-mark (point))
  (insert (drag-drop-string value)))

(push-message (epoch::intern-atom "_SUN_DRAGDROP_TRIGGER") 'drag-trigger-handler)
(push-message (epoch::intern-atom "XV_DO_DRAG_LOAD") 'drag-load-handler)
(push-message (epoch::intern-atom "XV_DO_DRAG_COPY") 'drag-copy-handler)
(push-message (epoch::intern-atom "XV_DO_DRAG_MOVE") 'drag-copy-handler)

(provide 'drag-drop)
---
Ken Laprade			INTERNET: laprade@trantor.harris-atd.com
Harris Corporation 		Usenet:  ...!uunet!x102a!trantor!laprade
PO Box 37, MS 3A/1912		Voice: (407)727-4433
Melbourne, FL 32902		FAX: (407)729-3363
Technical Details
Message-ID: <laprade.705670975@ringworld>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!mips!darwin.sura.net!mlb.semi.harris.com!trantor.harris-atd.com!ringworld!laprade
References: <92May4.143134edt.133465@wotan.ai.toronto.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fc7ee,79a6c49b0e00e997
X-Google-Attributes: gidfc7ee,public
X-Google-ArrivalTime: 1992-05-12 01:00:20 PST
Newsgroups: gnu.epoch.misc
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!mips!darwin.sura.net!mlb.semi.harris.com!trantor.harris-atd.com!ringworld!laprade
From: laprade@ringworld.harris-atd.com (Ken Laprade)
Subject: Re: epoch cut and paste
Message-ID: <laprade.705670975@ringworld>
Sender: news@trantor.harris-atd.com (News stuff)
Reply-To: laprade@trantor.harris-atd.com
Organization: Advanced Technology Dept., Harris Corp., Melbourne, FL
References: <92May4.143134edt.133465@wotan.ai.toronto.edu>
Distribution: na
Date: Tue, 12 May 1992 11:42:55 GMT
Lines: 70