Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uakari.primate.wisc.edu!uflorida!mlb.semi.harris.com!trantor.harris-atd.com!trantor!chuck From: chuck@trantor.harris-atd.com (Chuck Musciano) Newsgroups: comp.windows.open-look Subject: Re: Initiating drag and drop Message-ID: <4869@trantor.harris-atd.com> Date: 14 Nov 90 16:26:59 GMT References: <4861@trantor.harris-atd.com> Sender: news@trantor.harris-atd.com Reply-To: chuck@trantor.harris-atd.com (Chuck Musciano) Organization: Advanced Technology Dept, Harris Corp, Melbourne, FL Lines: 53 In article <4861@trantor.harris-atd.com>, I write: > I am trying to initiate a drag and drop operation from an XView tool. > I successfully create a cursor and get a fullscreen, and drag the cursor > to another window. When I release the mouse button, my code sends a message > to the XV_POINTER_WINDOW under the mouse. > > Here's the problem. If the receiver is filemgr, the message is received, > and the file is copied. Any other tool, like textedit, ignores the message. > Even my tool, which can receive ACTION_DRAG_LOAD events, doesn't get the > message. Why is it that messages from filemgr are received, but messages > from me are not? Well, I have explored this problem a little further, with some help from Brent Browning from Sun. First, using XV_POINTER_WINDOW is unreliable. You need to derive the window under the mouse explicitly, using the undocumented routine: Window win_pointer_under(source_window, x, y) Window source_window; int x; int y; which returns the XID of the target window. Then, I discovered that there are two ways to send the dragged information to the recipient. The "X-ish" way is to place the data in a WindowProperty named "DRAG_DROP", and to place the handle of this property in the last (fifth) component of the message packet. X tools retrieve the data from the property. The "XView-ish" way is to set the fifth element to zero, and place the data in the primary selection. XView tools then get the data from the selection service. This requires that sending tools set up the X and XView techniques, since they have no idea who the receiver is going to be, and that receiving tools set up both receiving methods, since they have no idea who the sender is. An example of a dual receiver is in the XView 2 MIT distribution, in lib/libxvin/misc/drop.c. Thankfully, according to Brent, Sun is reworking this entire interface into something mere mortals can understand for OpenWindows 3.0. -- Chuck Musciano ARPA : chuck@trantor.harris-atd.com Harris Corporation Usenet: ...!uunet!x102a!trantor!chuck PO Box 37, MS 3A/1912 AT&T : (407) 727-6131 Melbourne, FL 32902 FAX : (407) 729-2537 A good newspaper is never good enough, but a lousy newspaper is a joy forever. -- Garrison Keillor