Skip to content

Drag from panels without real names: archives, FTP, TmpPanel, Observer #4

Description

@refaim

Dragging works only from panels that report real file names (PFLAGS_REALNAMES): the plugin hands the drop target a list of paths on disk, and on an archive panel, an FTP panel, TmpPanel, Observer and the like there is nothing on disk to point at. Since 1.2.0 the gesture does not even arm on such panels, so Far's own panel-to-panel mouse drag keeps working there, but dragging from them into Explorer, Telegram or anything else does nothing.

It would be convenient to drag from those panels too.

What it takes

The items have to be materialised before the drop target gets them, the same way F5 from such a panel goes through the owning plugin's GetFilesW. Two ways to get there:

  1. Extract first, then drag. When the gesture crosses the threshold on a panel without real names, have Far copy the selection to a temporary folder, then start the OLE drag with the temp paths. There is no API for one plugin to call another plugin's GetFilesW, so this means driving Far itself (a posted macro that does F5 to the temp path, or the equivalent through MacroControl). Simple data object; the cost is that the extraction happens whether or not the drop completes, and Far's copy progress shows before the drag even starts.

  2. Delayed rendering. Offer CFSTR_FILEDESCRIPTOR / CFSTR_FILECONTENTS and materialise the files only when a target asks for them at drop time. Nothing is extracted on a cancelled drag, but the drop runs on the tool thread while Far's main thread owns the panels, so the extraction has to be marshalled back (ACTL_SYNCHRO) and waited for, and not every target takes file-contents formats: Explorer does, many chat apps only understand CF_HDROP.

Either way:

  • temp files need cleaning up, after the drop and leftovers on the next start;
  • DROPEFFECT_MOVE must never delete anything inside the archive or on the server;
  • the selection logic stays as it is: FCTL_GETSELECTEDPANELITEM already gives the item names on plugin panels, only the paths are missing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions