Changeset 55091 in vbox for trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDnD.cpp
- Timestamp:
- Apr 2, 2015 12:32:40 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDnD.cpp
r51924 r55091 78 78 RT_ZERO(startupInfo); 79 79 80 LogFlowFunc(("Supported formats:\n")); 80 81 const RTCString arrEntries[] = { VBOX_DND_FORMATS_DEFAULT }; 81 82 for (size_t i = 0; i < RT_ELEMENTS(arrEntries); i++) 83 { 84 LogFlowFunc(("\t%s\n", arrEntries[i].c_str())); 82 85 this->lstAllowedFormats.append(arrEntries[i]); 86 } 83 87 } 84 88 … … 755 759 for (size_t i = 0; i < lstFormats.size(); i++) 756 760 { 757 bool fSupported = this->lstAllowedFormats.contains(lstFormats.at(i)); 758 if (fSupported) 759 this->lstFormats.append(lstFormats.at(i)); 761 bool fSupported = false; 762 for (size_t a = 0; a < this->lstAllowedFormats.size(); a++) 763 { 764 LogFlowThisFunc(("\t\"%s\" <=> \"%s\"\n", this->lstAllowedFormats.at(a).c_str(), lstFormats.at(i).c_str())); 765 fSupported = RTStrICmp(this->lstAllowedFormats.at(a).c_str(), lstFormats.at(i).c_str()) == 0; 766 if (fSupported) 767 { 768 this->lstFormats.append(lstFormats.at(i)); 769 break; 770 } 771 } 772 760 773 LogFlowThisFunc(("\t%s: %RTbool\n", lstFormats.at(i).c_str(), fSupported)); 761 774 } 775 776 /* 777 * Warn in the log if this guest does not accept anything. 778 */ 779 if (!this->lstFormats.size()) 780 LogRel(("DnD: Warning: No supported drag'n drop formats on the guest found!\n")); 762 781 763 782 /* … … 767 786 try 768 787 { 769 /* Translate our drop actions into 770 * allowed Windows drop effects. */ 788 /* Translate our drop actions into allowed Windows drop effects. */ 771 789 startupInfo.dwOKEffects = DROPEFFECT_NONE; 772 790 if (uAllActions) … … 886 904 if (mState == Dragging) 887 905 { 888 Assert(lstFormats.size() >= 1); 889 890 /** @todo What to do when multiple formats are available? */ 891 mFormatRequested = lstFormats.at(0); 892 893 rc = RTCritSectEnter(&mCritSect); 894 if (RT_SUCCESS(rc)) 895 { 896 if (startupInfo.pDataObject) 897 startupInfo.pDataObject->SetStatus(VBoxDnDDataObject::Dropping); 898 else 899 rc = VERR_NOT_FOUND; 900 901 RTCritSectLeave(&mCritSect); 902 } 903 904 if (RT_SUCCESS(rc)) 905 { 906 LogRel(("DnD: Requesting data as '%s' ...\n", mFormatRequested.c_str())); 907 rc = VbglR3DnDHGRequestData(mClientID, mFormatRequested.c_str()); 908 if (RT_FAILURE(rc)) 909 LogFlowThisFunc(("Requesting data failed with rc=%Rrc\n", rc)); 910 } 906 if (lstFormats.size() >= 1) 907 { 908 /** @todo What to do when multiple formats are available? */ 909 mFormatRequested = lstFormats.at(0); 910 911 rc = RTCritSectEnter(&mCritSect); 912 if (RT_SUCCESS(rc)) 913 { 914 if (startupInfo.pDataObject) 915 startupInfo.pDataObject->SetStatus(VBoxDnDDataObject::Dropping); 916 else 917 rc = VERR_NOT_FOUND; 918 919 RTCritSectLeave(&mCritSect); 920 } 921 922 if (RT_SUCCESS(rc)) 923 { 924 LogRel(("DnD: Requesting data as '%s' ...\n", mFormatRequested.c_str())); 925 rc = VbglR3DnDHGRequestData(mClientID, mFormatRequested.c_str()); 926 if (RT_FAILURE(rc)) 927 LogFlowThisFunc(("Requesting data failed with rc=%Rrc\n", rc)); 928 } 929 } 930 else /* Should never happen. */ 931 LogRel(("DnD: Error: Host did not specify a data format for drop data\n")); 911 932 } 912 933 … … 1404 1425 mMode, mState)); 1405 1426 1406 lstAllowedFormats.clear(); 1407 lstFormats.clear(); 1408 uAllActions = DND_IGNORE_ACTION; 1427 /* 1428 * Note: Don't clear this->lstAllowedFormats at the moment, as this value is initialized 1429 * on class creation. We might later want to modify the allowed formats in runtime, 1430 * so keep this in mind when implementing this. 1431 */ 1432 1433 this->lstFormats.clear(); 1434 this->uAllActions = DND_IGNORE_ACTION; 1409 1435 1410 1436 int rc2 = setMode(Unknown);
Note:
See TracChangeset
for help on using the changeset viewer.