[haiku-development] Re: Handling drag'n'drop off files from Tracker

  • From: pete.goodeve@xxxxxxxxxxxx
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Wed, 9 Sep 2015 23:33:59 -0700

On Thu, Sep 10, 2015 at 07:04:43AM +0200, Adrien Destugues wrote:

On Wed, Sep 09, 2015 at 11:54:00AM -0700, pete.goodeve@xxxxxxxxxxxx wrote:
On Wed, Sep 09, 2015 at 12:26:05PM +0200, Marcus Overhagen wrote:
On Wed, Sep 9, 2015 at 9:30 AM, Jessica Hamilton
<jessica.l.hamilton@xxxxxxxxx> wrote:

I was just looking at code for Heidi, and noticed that it doesn't
handle dropping files on its window. But I see in the code that
MessageReceived() handles the case of B_REFS_RECEIVED
[....]
Also note the function 'msg->WasDropped()'. What I usually do is simply
change 'msg->what'
to B_REFS_RECEIVED if that returns true, and then pass it through the rest
of the usual
MessageReceived handling. (if the dropped item is from somewhere else than
the Tracker,
its contents wil just be ignored.)

In the case of Heidi, we will probably also want to accept other dropped
things, not just files. At least text clips come to mind, but also
possibly dragging stack trace entries or function names from Debugger or
ImageViewer and opening the matching source file at the correct
line/column.


Yeah, that does make things a little more complex. The DATA message will need
to be parsed
a bit to figure out what it represents. The WasDropped() call still comes in
useful, though.

-- Pete --

Other related posts: