[PATCH 6/7] winex11.drv: improve XDND action negotiations

Damjan Jovanovic damjan.jov at gmail.com
Sun Apr 24 20:01:13 CDT 2016


Since XdndPosition can only carry 1 action, and in many cases drag sources
allow multiple actions, there's an extension to the XDND spec supported by at
least GTK+, Java, and Mono (discovered by a thorough audit of XDND
implementations in popular X11 frameworks) where the drag source exposes all
allowed actions in its XdndActionList window property, and the single action
in XdndPosition is just a suggested action, based on the key state (Ctrl for
copy, Shift for move, and both for link) or if nothing is pressed, chosen
arbitrarily among available actions (eg. GTK+ chooses copy then move then link,
Java move then copy then link).

Since Windows allows multiple actions, and vanilla XDND doesn't, let's
benefit from this extension when possible. We translate the XdndActionList
actions ORed with the XdndPosition action into the drop effects offered to the
drop target, but since Windows can only suggest actions through the key state,
and we cannot tell whether the drag source suggested an action because Ctrl
and Shift keys were pressed or because it was an arbitrary choice, we cannot
translate the ambiguously strong proposed action into key state. Rather,
obtain key state from GetKeyboardState(), which should be the same as what it
was on the drag source.

This is backward compatible, as drag sources without XdndActionList can still
send an action in XdndPosition, in which case that becomes the only allowed
action.

Signed-off-by: Damjan Jovanovic <damjan.jov at gmail.com>
---
 dlls/winex11.drv/x11drv.h      |  1 +
 dlls/winex11.drv/x11drv_main.c |  1 +
 dlls/winex11.drv/xdnd.c        | 81 ++++++++++++++++++++++++++++++++++--------
 3 files changed, 69 insertions(+), 14 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-winex11.drv-improve-XDND-action-negotiations.txt
Type: text/x-patch
Size: 6829 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20160425/59d25cbc/attachment.bin>


More information about the wine-patches mailing list