[Vm-dev] [OpenSmalltalk/opensmalltalk-vm] sqUnixXdnd: Don't record SQDragLeave when XdndDrop is handled (#508)

Christoph Thiede notifications at github.com
Fri Jun 12 19:24:50 UTC 2020


A bit of context: For Squeak, I am currently implementing full-fledged handling of DND events sent by the host system. Actually, Squeak only handles `SQDragDrop` at the moment.

However, when logging all received DND events on the image side, I discovered that whenever a file is dropped into the VM, after the last `SQDragMove` an `SQDragLeave` is received before the eventual `SQDragDrop`. This looks very suspicious to me. Neither does the same happen on any other platform (tested on Win32, too), nor does it appear logical to me in any way. If I release the mouse button *over* the image, the drag did not leave, so a "drag leave" should not be recorded.

This MR makes sure that in `dndInDrop()`, an `SQDragLeave` event is only recorded if the drop was not successful. (Please note that the `SQDragDrop` event itself will be sent in a deferred manner; `dndInDrop()` itself only calls `XConvertSelection()` from the X-Server which then will send a `SelectionNotify` which will trigger `dndGetSelection()` and eventually have `generateSqueakDropEventIfDroppedFiles()` called.)

Please review carefully, as I am a bloody VM newbie and this is my very first commit to this repo! :-) Mentioning @eliotmiranda who appears to be the code owner of this plugin, according to the file's history.

Todos:
- [ ] Think about backward compatibility: Squeak did not respect any of the drag events but `SQDragDrop` until today, and I'm reworking that handling ATM, so there will be no problem. But are there other users of this plugin that could rely on the old behavior which I consider a bug? Or does the `sq` in the prefix unambiguously stand for `Squeak`?
- [ ] Are there any tests I could run to make sure that this change cannot break anything else?
You can view, comment on, or merge this pull request online at:

  https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/508

-- Commit Summary --

  * Fix a typo
  * Comment out suspicious line
  * Merge branch 'Cog' into sqUnixXdnd
  * Refactor changes
  * Don't skip SQDragLeave if XGetSelectionOwner failed

-- File Changes --

    M platforms/unix/vm-display-X11/sqUnixXdnd.c (11)

-- Patch Links --

https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/508.patch
https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/508.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/508
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20200612/24e0ff7e/attachment-0001.html>


More information about the Vm-dev mailing list