Very weird behavior of DoDragDrop function for touch event on Windows?

279 views
Skip to first unread message

Min, Hongbo

unread,
Apr 15, 2013, 8:57:24 AM4/15/13
to chromi...@chromium.org, b...@chromium.org

Hi,

 

I am trying to fix these 2 bugs to make the touch-initiated drag and drop work well on Win 8 tablet with touch screen support.

https://code.google.com/p/chromium/issues/detail?id=229322

http://code.google.com/p/chromium/issues/detail?id=229301

 

But I ran into a problem when facing DoDragDrop function. The DoDragDrop function is a COM API to carry out OLE drag-drop operation, see http://msdn.microsoft.com/en-us/library/windows/desktop/ms678486%28v=vs.85%29.aspx. According to its description, the DoDragDrop will enter its own loop and various method in IDropSource and IDropTarget interfaces. It works well with mouse event, but it is another thing to work with touch event.

 

* Problems in working with touch screen

 

If you try to play the drag-drop demo at http://html5demos.com/drag on a touch sensitive Win8 device with turning on “--enable-touch-drag-drop”, after a long press on a draggable element, it will become unresponsive to input event unless you unlock it with mouse click.  I tried to log the calling stack and event sequence, and found that DoDragDrop is blocked (since DragSourceWin::QueryContinueQuery method doesn’t get called) , and  right now the page is unresponsive.  With mouse down event,  DoDragDrop has a chance to run and the callback methods get running until a mouse up event happens, and meanwhile, the queued input events are fired, lots of WM_TOUCH message followed by WM_RBUTTONDOWN and WM_RBUTTONUP message (since press and hold will treated as right mouse button down event on Windows).

 

So the problem is, it seems the DoDragDrop cannot be driven by touch event. Consequently, all touch events are queued in system input event stream and get fired once a mouse down event feeds into the loop of DoDragDrop. As the touch events in event queue get fired one by one, the system also recognize them as mouse event on the fly according to the touch event sequence.

 

To fix this problem, we can programmatically send a right mouse button down event to drive DoDragDrop operation, if the finger is remove from screen, a right mouse button up event is fired and as a result, it leads to a drag-drop operation is finished. See the CL at https://codereview.chromium.org/14122008/.  The patch can make http://html5demos.com/drag work as normal, but still failed to get drag-out downloading works.

 

* Problems in drag-out to download file

 

The example page is http://www.thecssninja.com/demo/gmail_dragout/ . The page will also get unresponsive if trying to drag-out the link file on touch screen. For the case of drag-out to download file, the different thing is, a drag-drop thread is created for file downloading, and so DoDragDrop is called in drag-drop thread instead the UI main thread.  The approach in the above CL which programmatically sends right mouse button down event to drive DoDragDrop. But this time, DragSourceWin::QueryContinueQuery can get called, but meanwhile WebDragSourceWin::OnWaitForData get called quickly and then page become unresponsive.

 

Any hints for DoDragDrop usage on touch-enabled Windows? Thanks.

 

Hongbo

 

 

 

 

Daniel Cheng

unread,
Apr 15, 2013, 2:10:23 PM4/15/13
to hongb...@intel.com, chromi...@chromium.org, b...@chromium.org
Do you have a patch for the second problem you're encountering with dragging out files? I know of at least one deadlock related to the drag out code on Windows (http://crbug.com/163387), but from your description, that doesn't seem to be the issue you're encountering.

Daniel


--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
 
 
 

Min, Hongbo

unread,
Apr 16, 2013, 5:28:00 AM4/16/13
to Daniel Cheng, chromi...@chromium.org, b...@chromium.org
I uploaded the drag-out patch at https://codereview.chromium.org/14294003/. Please have a look. Thanks.
Reply all
Reply to author
Forward
0 new messages