Changeset 56617 in vbox for trunk/src/VBox
- Timestamp:
- Jun 24, 2015 9:59:31 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r56507 r56617 99 99 /* Other includes: */ 100 100 #include <math.h> 101 102 103 #ifdef DEBUG_andy 104 /* Macro for debugging drag and drop actions which usually would 105 * go to Main's logging group. */ 106 # define DNDDEBUG(x) LogRel(x) 107 #else 108 # define DNDDEBUG(x) 109 #endif 101 110 102 111 … … 1430 1439 #endif 1431 1440 && machine().GetDnDMode() != KDnDMode_Disabled; 1432 LogRelFunc(("fAccept=%RTbool\n", fAccept));1433 1441 return fAccept; 1434 1442 } … … 1444 1452 AssertPtrReturnVoid(pEvent); 1445 1453 1446 if (!dragAndDropCanAccept()) 1447 return; 1448 1449 /* Get mouse-pointer location. */ 1450 const QPoint &cpnt = viewportToContents(pEvent->pos()); 1451 1452 /* Ask the target for starting a DnD event. */ 1453 Qt::DropAction result = m_pDnDHandler->dragEnter(screenId(), 1454 frameBuffer()->convertHostXTo(cpnt.x()), 1455 frameBuffer()->convertHostYTo(cpnt.y()), 1456 pEvent->proposedAction(), 1457 pEvent->possibleActions(), 1458 pEvent->mimeData()); 1459 1460 /* Set the DnD action returned by the guest. */ 1461 pEvent->setDropAction(result); 1462 pEvent->accept(); 1454 int rc = dragAndDropCanAccept() ? VINF_SUCCESS : VERR_ACCESS_DENIED; 1455 if (RT_SUCCESS(rc)) 1456 { 1457 /* Get mouse-pointer location. */ 1458 const QPoint &cpnt = viewportToContents(pEvent->pos()); 1459 1460 /* Ask the target for starting a DnD event. */ 1461 Qt::DropAction result = m_pDnDHandler->dragEnter(screenId(), 1462 frameBuffer()->convertHostXTo(cpnt.x()), 1463 frameBuffer()->convertHostYTo(cpnt.y()), 1464 pEvent->proposedAction(), 1465 pEvent->possibleActions(), 1466 pEvent->mimeData()); 1467 1468 /* Set the DnD action returned by the guest. */ 1469 pEvent->setDropAction(result); 1470 pEvent->accept(); 1471 } 1472 1473 DNDDEBUG(("DnD: dragEnterEvent ended with rc=%Rrc\n", rc)); 1463 1474 } 1464 1475 … … 1467 1478 AssertPtrReturnVoid(pEvent); 1468 1479 1469 if (!dragAndDropCanAccept()) 1470 return; 1471 1472 /* Get mouse-pointer location. */ 1473 const QPoint &cpnt = viewportToContents(pEvent->pos()); 1474 1475 /* Ask the guest for moving the drop cursor. */ 1476 Qt::DropAction result = m_pDnDHandler->dragMove(screenId(), 1477 frameBuffer()->convertHostXTo(cpnt.x()), 1478 frameBuffer()->convertHostYTo(cpnt.y()), 1479 pEvent->proposedAction(), 1480 pEvent->possibleActions(), 1481 pEvent->mimeData()); 1482 1483 /* Set the DnD action returned by the guest. */ 1484 pEvent->setDropAction(result); 1485 pEvent->accept(); 1480 int rc = dragAndDropCanAccept() ? VINF_SUCCESS : VERR_ACCESS_DENIED; 1481 if (RT_SUCCESS(rc)) 1482 { 1483 /* Get mouse-pointer location. */ 1484 const QPoint &cpnt = viewportToContents(pEvent->pos()); 1485 1486 /* Ask the guest for moving the drop cursor. */ 1487 Qt::DropAction result = m_pDnDHandler->dragMove(screenId(), 1488 frameBuffer()->convertHostXTo(cpnt.x()), 1489 frameBuffer()->convertHostYTo(cpnt.y()), 1490 pEvent->proposedAction(), 1491 pEvent->possibleActions(), 1492 pEvent->mimeData()); 1493 1494 /* Set the DnD action returned by the guest. */ 1495 pEvent->setDropAction(result); 1496 pEvent->accept(); 1497 } 1498 1499 DNDDEBUG(("DnD: dragMoveEvent ended with rc=%Rrc\n", rc)); 1486 1500 } 1487 1501 … … 1490 1504 AssertPtrReturnVoid(pEvent); 1491 1505 1492 if (!dragAndDropCanAccept()) 1493 return; 1494 1495 m_pDnDHandler->dragLeave(screenId()); 1496 1497 pEvent->accept(); 1506 int rc = dragAndDropCanAccept() ? VINF_SUCCESS : VERR_ACCESS_DENIED; 1507 if (RT_SUCCESS(rc)) 1508 { 1509 m_pDnDHandler->dragLeave(screenId()); 1510 1511 pEvent->accept(); 1512 } 1513 1514 DNDDEBUG(("DnD: dragLeaveEvent ended with rc=%Rrc\n", rc)); 1498 1515 } 1499 1516 … … 1519 1536 #endif 1520 1537 1521 LogRel3(("DnD: dragCheckPending ended with rc=%Rrc\n", rc));1538 DNDDEBUG(("DnD: dragCheckPending ended with rc=%Rrc\n", rc)); 1522 1539 return rc; 1523 1540 } … … 1544 1561 #endif 1545 1562 1546 LogRel3(("DnD: dragStart ended with rc=%Rrc\n", rc));1563 DNDDEBUG(("DnD: dragStart ended with rc=%Rrc\n", rc)); 1547 1564 return rc; 1548 1565 } … … 1563 1580 #endif 1564 1581 1565 LogRel3(("DnD: dragStop ended with rc=%Rrc\n", rc));1582 DNDDEBUG(("DnD: dragStop ended with rc=%Rrc\n", rc)); 1566 1583 return rc; 1567 1584 } … … 1571 1588 AssertPtrReturnVoid(pEvent); 1572 1589 1573 if (!dragAndDropCanAccept()) 1574 return; 1575 1576 /* Get mouse-pointer location. */ 1577 const QPoint &cpnt = viewportToContents(pEvent->pos()); 1578 1579 /* Ask the guest for dropping data. */ 1580 Qt::DropAction result = m_pDnDHandler->dragDrop(screenId(), 1581 frameBuffer()->convertHostXTo(cpnt.x()), 1582 frameBuffer()->convertHostYTo(cpnt.y()), 1583 pEvent->proposedAction(), 1584 pEvent->possibleActions(), 1585 pEvent->mimeData()); 1586 1587 /* Set the DnD action returned by the guest. */ 1588 pEvent->setDropAction(result); 1589 pEvent->accept(); 1590 int rc = dragAndDropCanAccept() ? VINF_SUCCESS : VERR_ACCESS_DENIED; 1591 if (RT_SUCCESS(rc)) 1592 { 1593 /* Get mouse-pointer location. */ 1594 const QPoint &cpnt = viewportToContents(pEvent->pos()); 1595 1596 /* Ask the guest for dropping data. */ 1597 Qt::DropAction result = m_pDnDHandler->dragDrop(screenId(), 1598 frameBuffer()->convertHostXTo(cpnt.x()), 1599 frameBuffer()->convertHostYTo(cpnt.y()), 1600 pEvent->proposedAction(), 1601 pEvent->possibleActions(), 1602 pEvent->mimeData()); 1603 1604 /* Set the DnD action returned by the guest. */ 1605 pEvent->setDropAction(result); 1606 pEvent->accept(); 1607 } 1608 1609 DNDDEBUG(("DnD: dropEvent ended with rc=%Rrc\n", rc)); 1590 1610 } 1591 1611 #endif /* VBOX_WITH_DRAG_AND_DROP */
Note:
See TracChangeset
for help on using the changeset viewer.