@@ -489,6 +489,7 @@ private void NoInliningConstructor()
489489 DragOver += OnDragOver ;
490490 DragLeave += OnDragLeave ;
491491 Drop += OnDrop ;
492+ GiveFeedback += OnGiveFeedback ;
492493
493494 IsVisibleChanged += OnIsVisibleChanged ;
494495
@@ -610,6 +611,7 @@ protected virtual void Dispose(bool isDisposing)
610611 DragOver -= OnDragOver ;
611612 DragLeave -= OnDragLeave ;
612613 Drop -= OnDrop ;
614+ GiveFeedback -= OnGiveFeedback ;
613615
614616 IsVisibleChanged -= OnIsVisibleChanged ;
615617
@@ -761,14 +763,14 @@ bool IRenderWebBrowser.StartDragging(IDragData dragData, DragOperationsMask allo
761763 if ( browser != null )
762764 {
763765 //DoDragDrop will fire DragEnter event
764- var result = DragDrop . DoDragDrop ( this , dataObject , GetDragEffects ( allowedOps ) ) ;
766+ var result = DragDrop . DoDragDrop ( this , dataObject , allowedOps . GetDragEffects ( ) ) ;
765767
766768 //DragData was stored so when DoDragDrop fires DragEnter we reuse a clone of the IDragData provided here
767769 currentDragData = null ;
768770
769771 //If result == DragDropEffects.None then we'll send DragOperationsMask.None
770772 //effectively cancelling the drag operation
771- browser . GetHost ( ) . DragSourceEndedAt ( x , y , GetDragOperationsMask ( result ) ) ;
773+ browser . GetHost ( ) . DragSourceEndedAt ( x , y , result . GetDragOperationsMask ( ) ) ;
772774 browser . GetHost ( ) . DragSourceSystemDragEnded ( ) ;
773775 }
774776 } ) ;
@@ -787,7 +789,8 @@ void IRenderWebBrowser.UpdateDragCursor(DragOperationsMask operation)
787789 /// <param name="operation">describes the allowed operation (none, move, copy, link). </param>
788790 protected virtual void UpdateDragCursor ( DragOperationsMask operation )
789791 {
790- //TODO: Someone should implement this
792+ var dragCursor = DragCursorProvider . GetCursor ( operation ) ;
793+ UiThreadRunAsync ( ( ) => Mouse . SetCursor ( dragCursor ) ) ;
791794 }
792795
793796 /// <summary>
@@ -1498,7 +1501,7 @@ private void OnDrop(object sender, DragEventArgs e)
14981501 if ( browser != null )
14991502 {
15001503 var mouseEvent = GetMouseEvent ( e ) ;
1501- var effect = GetDragOperationsMask ( e . AllowedEffects ) ;
1504+ var effect = e . AllowedEffects . GetDragOperationsMask ( ) ;
15021505
15031506 browser . GetHost ( ) . DragTargetDragOver ( mouseEvent , effect ) ;
15041507 browser . GetHost ( ) . DragTargetDragDrop ( mouseEvent ) ;
@@ -1527,10 +1530,21 @@ private void OnDragOver(object sender, DragEventArgs e)
15271530 {
15281531 if ( browser != null )
15291532 {
1530- browser . GetHost ( ) . DragTargetDragOver ( GetMouseEvent ( e ) , GetDragOperationsMask ( e . AllowedEffects ) ) ;
1533+ browser . GetHost ( ) . DragTargetDragOver ( GetMouseEvent ( e ) , e . AllowedEffects . GetDragOperationsMask ( ) ) ;
15311534 }
15321535 }
15331536
1537+ /// <summary>
1538+ /// Handles the <see cref="E:GiveFeedback" /> event.
1539+ /// </summary>
1540+ /// <param name="sender">The sender.</param>
1541+ /// <param name="e">The <see cref="GiveFeedbackEventArgs"/> instance containing the event data.</param>
1542+ private void OnGiveFeedback ( object sender , GiveFeedbackEventArgs e )
1543+ {
1544+ /// prevent showing default cursor, the appropriate cursor will be set by <see cref=UpdateDragCursor />
1545+ e . Handled = true ;
1546+ }
1547+
15341548 /// <summary>
15351549 /// Handles the <see cref="E:DragEnter" /> event.
15361550 /// </summary>
@@ -1541,7 +1555,7 @@ private void OnDragEnter(object sender, DragEventArgs e)
15411555 if ( browser != null )
15421556 {
15431557 var mouseEvent = GetMouseEvent ( e ) ;
1544- var effect = GetDragOperationsMask ( e . AllowedEffects ) ;
1558+ var effect = e . AllowedEffects . GetDragOperationsMask ( ) ;
15451559
15461560 //DoDragDrop will fire this handler for internally sourced Drag/Drop operations
15471561 //we use the existing IDragData (cloned copy)
@@ -1552,62 +1566,6 @@ private void OnDragEnter(object sender, DragEventArgs e)
15521566 }
15531567 }
15541568
1555- /// <summary>
1556- /// Converts .NET drag drop effects to CEF Drag Operations
1557- /// </summary>
1558- /// <param name="dragDropEffects">The drag drop effects.</param>
1559- /// <returns>DragOperationsMask.</returns>
1560- /// s
1561- private static DragOperationsMask GetDragOperationsMask ( DragDropEffects dragDropEffects )
1562- {
1563- var operations = DragOperationsMask . None ;
1564-
1565- if ( dragDropEffects . HasFlag ( DragDropEffects . All ) )
1566- {
1567- operations |= DragOperationsMask . Every ;
1568- }
1569- if ( dragDropEffects . HasFlag ( DragDropEffects . Copy ) )
1570- {
1571- operations |= DragOperationsMask . Copy ;
1572- }
1573- if ( dragDropEffects . HasFlag ( DragDropEffects . Move ) )
1574- {
1575- operations |= DragOperationsMask . Move ;
1576- }
1577- if ( dragDropEffects . HasFlag ( DragDropEffects . Link ) )
1578- {
1579- operations |= DragOperationsMask . Link ;
1580- }
1581-
1582- return operations ;
1583- }
1584-
1585- /// <summary>
1586- /// Gets the drag effects.
1587- /// </summary>
1588- /// <param name="mask">The mask.</param>
1589- /// <returns>DragDropEffects.</returns>
1590- private static DragDropEffects GetDragEffects ( DragOperationsMask mask )
1591- {
1592- if ( ( mask & DragOperationsMask . Every ) == DragOperationsMask . Every )
1593- {
1594- return DragDropEffects . All ;
1595- }
1596- if ( ( mask & DragOperationsMask . Copy ) == DragOperationsMask . Copy )
1597- {
1598- return DragDropEffects . Copy ;
1599- }
1600- if ( ( mask & DragOperationsMask . Move ) == DragOperationsMask . Move )
1601- {
1602- return DragDropEffects . Move ;
1603- }
1604- if ( ( mask & DragOperationsMask . Link ) == DragOperationsMask . Link )
1605- {
1606- return DragDropEffects . Link ;
1607- }
1608- return DragDropEffects . None ;
1609- }
1610-
16111569 /// <summary>
16121570 /// PresentationSource changed handler.
16131571 /// </summary>
0 commit comments