From xemacs-m  Wed Jul 30 19:33:11 1997
Received: from komtron.com (root@gatekeeper.komtron.com [194.77.5.33])
	by xemacs.org (8.8.5/8.8.5) with SMTP id TAA11811;
	Wed, 30 Jul 1997 19:33:05 -0500 (CDT)
Received: from slave1.komtron.com by komtron.com with SMTP id AA01202
  (5.67b/IDA-1.5); Thu, 31 Jul 1997 02:38:17 +0200
Received: (from Ufga@localhost) by slave1.komtron.com (8.7.5/8.7.3) with UUCP id CAA17562; Thu, 31 Jul 1997 02:37:22 +0200
X-Authentication-Warning: slave1.komtron.com: Ufga set sender to ograf@fga.de using -f
Received: by fga.de (8.8.5/8.8.5) id XAA05204
Received: by fga.de (8.8.5/8.8.5) id XAA20472
To: Michael Harnois <mharnois@sbt.net>
Cc: xemacs-beta@xemacs.org, SL Baur <steve@xemacs.org>
Subject: Re: [PATCH] OffiX DnD type support for XEmacs
References: <m3d8o4s8va.fsf@indie.fga-intern.de> <87bu3laokn.fsf@mharnois.workgroup.net>
X-Face: [8r}|"6`WFUT0kiC9dBT%edO~lI5Gwog0Z@Cl=Inx|2F=+DjY#0nGtclM)9lU
        c/8JJ%b&&^:&pWh&nYlQbGSk=WdL^%f!<6a:?n)V_snw7Zc+AW10az=||e8Kv
        1PV49Qe64*68G2`)M8O$mlLQ\!O}$d8]T\L?i@$;=WA~0B[k)O.^T'x?O^=EX
        %=gt6(:hG!-|%$EZGq-Dn6r%N6xqOC4voztttHxOMp!2$o+qPAcT2k&dgO~`%
        kVcW7C<3hK[g9vVpk'#B2(f"pN,jBh`
Mime-Version: 1.0 (generated by tm-edit 7.108)
Content-Type: multipart/mixed;
 boundary="Multipart_Wed_Jul_30_23:05:20_1997-1"
Content-Transfer-Encoding: 7bit
From: Oliver Graf <ograf@fga.de>
Date: 30 Jul 1997 23:05:20 +0200
Message-Id: <m3iuxsntdb.fsf@indie.fga-intern.de>
Lines: 95

--Multipart_Wed_Jul_30_23:05:20_1997-1
Content-Type: text/plain; charset=US-ASCII

Michael Harnois <mharnois@sbt.net> writes:

> This has done, er, an interesting thing for me; when I use C-space and 
> C-w to mark and delete a block of text, I get a message "Converting to
> hexl format discards undo info; ok?" and a buffer named DndRawData
> pops up.

Strange. It also happens if I mark a region with the mouse, move to some other 
point and left-click there to move the cursor.

[hexlify-buffer is called within the default-drag-and-drop-function
(lisp/prim/frame.el), which is called from the c-event handler for the drop
event (src/frame-x.c)]

I think that there is a problem with the Event translation. My patch made it
visible, because it handles all types of DnD-data (not only File, Files and
Exe as the original code). The Event translation seems to create a pseudo drop 
event but with a DnD Type -1. The former code ignored this, my code happily
takes the DnD data in the root buffer (DnD data is stored within a atom in
the root-window -- do a xprop on your root), if there is something left, and
displays it in the dummy DndRawData buffer to hexlify it (because it's raw).

Perhaps someone of the core-developers can enlighten me about the Event
handling in XEmacs? Perhaps the click into the frame or the C-w (kill-region)
creates some sort of pseudo-event which might be interpreted by Xt (the Dnd
library registers the handler via Xt) as a ClientMessage (this is the Event
Type of the Drop event)? The only place where the hook is called is within the 
CDE and the OffiX drop handlers...

The attached patch fixes this for now, but I have to look into the event stuff 
to see if there is not a better way (patch returns on Type -1 and does some
extra output on stderr -- by the way: is fprintf the 'correct' way to output
such warnings?)

Regards,
  Oliver.

P.S. [to SL]: There is also a patch for the WindowMaker stuff on the way to
you (making it on by default and renaming it to 'session'). Hope it arrives
soon enough for b16...


--Multipart_Wed_Jul_30_23:05:20_1997-1
Content-Type: application/octet-stream; type=patch
Content-Disposition: attachment; filename="xemacs-20.3-dnd-fix.patch"
Content-Transfer-Encoding: 8bit

*** xemacs-20.3-b15/src/frame-x.c.orig	Wed Jul 30 20:00:39 1997
--- xemacs-20.3-b15/src/frame-x.c	Wed Jul 30 20:37:29 1997
***************
*** 1184,1195 ****
--- 1184,1202 ----
    struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
  
    Type = DndDataType (event); 
+   if (Type < 0)  /* pseudo event produces -1 as type */
+     {
+       fprintf(stderr,"DndDropHandler: pseudo drop received\n");
+       return;
+     }
  
    DndGetData (&Data, &Size);
    
    GCPRO4 (path, frame, dnd_data, dnd_type);
  
    frame = make_frame ((struct frame *) data);
+ 
+   fprintf(stderr,"DndDropHandler: real drop received (T%d S%d)\n",Type,Size);
    
    switch (Type)
      {
*** xemacs-20.3-b15/lisp/prim/frame.el.orig	Wed Jul 30 14:43:35 1997
--- xemacs-20.3-b15/lisp/prim/frame.el	Wed Jul 30 20:32:14 1997
***************
*** 832,838 ****
  		  (hexlify-buffer)
  		  (make-frame-visible frame)))
  	       ((= type 5) (dired data))
! 	       ((= type 8) (w3-fetch data))
  	       ((= type 9)
  		(let ((buf (generate-new-buffer "DndMIME")))
  		  (set-buffer buf)
--- 832,838 ----
  		  (hexlify-buffer)
  		  (make-frame-visible frame)))
  	       ((= type 5) (dired data))
! 	       ((= type 8) (funcall browse-url-browser-function data))
  	       ((= type 9)
  		(let ((buf (generate-new-buffer "DndMIME")))
  		  (set-buffer buf)

--Multipart_Wed_Jul_30_23:05:20_1997-1--

