Changeset 50593 in vbox for trunk/src/VBox/Additions/x11
- Timestamp:
- Feb 26, 2014 8:44:58 AM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 92464
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/VBoxClient/draganddrop.cpp
r50561 r50593 1034 1034 } 1035 1035 1036 1037 1036 #ifdef VBOX_WITH_DRAG_AND_DROP_GH 1038 /*1039 * Guest -> Host1040 */1041 1042 1037 int DragInstance::ghIsDnDPending(void) 1043 1038 { … … 1084 1079 else 1085 1080 { 1086 xrc = XGetWindowProperty(m_pDisplay, wndOwner, xAtom(XA_XdndTypeList), 0, VBOX_MAX_XPROPERTIES, False, XA_ATOM, &type, &f, &n, &a, &ret); 1081 xrc = XGetWindowProperty(m_pDisplay, wndOwner, 1082 xAtom(XA_XdndTypeList), 1083 0, VBOX_MAX_XPROPERTIES, 1084 False, XA_ATOM, &type, &f, &n, &a, &ret); 1087 1085 if ( xrc == Success 1088 1086 && n > 0 … … 1098 1096 } 1099 1097 } 1098 1100 1099 /* Fetch the possible list of actions, if this property is set. */ 1101 xrc = XGetWindowProperty(m_pDisplay, wndOwner, xAtom(XA_XdndActionList), 0, VBOX_MAX_XPROPERTIES, False, XA_ATOM, &type, &f, &n, &a, &ret); 1100 xrc = XGetWindowProperty(m_pDisplay, wndOwner, 1101 xAtom(XA_XdndActionList), 1102 0, VBOX_MAX_XPROPERTIES, 1103 False, XA_ATOM, &type, &f, &n, &a, &ret); 1102 1104 if ( xrc == Success 1103 1105 && n > 0 … … 1110 1112 m_actions.append(data[i]); 1111 1113 } 1114 1112 1115 XFree(ret); 1113 1116 } … … 1115 1118 m_state = Dragging; 1116 1119 m_mode = GH; 1120 1117 1121 /* Acknowledge the event by sending a Status msg back to the 1118 1122 * window. */ … … 1152 1156 } 1153 1157 } 1158 1154 1159 hideProxyWin(); 1155 1160 1156 rc = VbglR3DnDGHAcknowledgePending( DND_COPY_ACTION, toHGCMActions(m_actions),1161 rc = VbglR3DnDGHAcknowledgePending(m_uClientID, DND_COPY_ACTION, toHGCMActions(m_actions), 1157 1162 gX11->xAtomListToString(m_formats).c_str()); 1158 1163 } … … 1162 1167 } 1163 1168 1164 int DragInstance::ghDropped(const RTCString &strFormat, uint32_t action) 1165 { 1166 LogFlowThisFunc(("format='%s' action=%d\n", strFormat.c_str(), action)); 1169 int DragInstance::ghDropped(const RTCString &strFormat, uint32_t uAction) 1170 { 1171 LogFlowThisFunc(("strFormat=%s, uAction=%RU32\n", 1172 strFormat.c_str(), uAction)); 1173 1167 1174 int rc = VINF_SUCCESS; 1168 1175 … … 1171 1178 showProxyWin(rx, ry); 1172 1179 XFlush(m_pDisplay); 1180 1173 1181 /* We send a fake release event to the current window, cause 1174 1182 * this should have the grab. */ 1175 1183 sendButtonEvent(m_wndCur, rx, ry, 1, false); 1184 1176 1185 /* The fake button release event, should lead to an XdndDrop event from the 1177 1186 * source. Because of the showing of the proxy window, sometimes other Xdnd … … 1181 1190 XClientMessageEvent *clme = 0; 1182 1191 RT_ZERO(e); 1183 int tries = 3; 1184 do 1192 1193 int cRetries = 3; 1194 for (int i = 0; i < cRetries; i++) 1185 1195 { 1186 1196 if (m_pParent->waitForXMsg(e, ClientMessage)) … … 1192 1202 } 1193 1203 } 1194 } while (tries--); 1204 } 1205 1195 1206 if (clme) 1196 1207 { … … 1202 1213 Window srcWin = m_wndCur;//clme->data.l[0]; 1203 1214 Atom aFormat = gX11->stringToxAtom(strFormat.c_str()); 1204 XConvertSelection(m_pDisplay, xAtom(XA_XdndSelection), aFormat, xAtom(XA_XdndSelection), m_wndProxy, clme->data.l[2]); 1215 1216 XConvertSelection(m_pDisplay, xAtom(XA_XdndSelection), 1217 aFormat, xAtom(XA_XdndSelection), 1218 m_wndProxy, clme->data.l[2]); 1219 1205 1220 /* Wait for the selection notify event. */ 1206 1221 RT_ZERO(e); … … 1215 1230 { 1216 1231 LogFlowThisFunc(("Selection notfiy (from: %x)\n", m_wndCur)); 1232 1217 1233 Atom type; 1218 1234 int format; … … 1242 1258 memcpy(ucData1, ucData, cbData); 1243 1259 ucData1[cbData++] = '\0'; 1260 1244 1261 /* Got the data and its fully transfered. */ 1245 rc = VbglR3DnDGHSendData(ucData1, cbData); 1262 rc = VbglR3DnDGHSendData(m_uClientID, strFormat.c_str(), 1263 ucData1, cbData); 1246 1264 RTMemFree(ucData1); 1247 1265 } … … 1250 1268 } 1251 1269 else 1270 { 1252 1271 /* Just send the data to the host. */ 1253 rc = VbglR3DnDGHSendData(ucData, cbData); 1272 rc = VbglR3DnDGHSendData(m_uClientID, strFormat.c_str(), 1273 ucData, cbData); 1274 } 1254 1275 1255 1276 LogFlowThisFunc(("send responce\n")); … … 1264 1285 m.data.l[0] = m_wndProxy; 1265 1286 m.data.l[1] = RT_SUCCESS(rc) ? 1 : 0; /* Confirm or deny success */ 1266 m.data.l[2] = RT_SUCCESS(rc) ? toX11Action( action) : None; /* Action used on success */1287 m.data.l[2] = RT_SUCCESS(rc) ? toX11Action(uAction) : None; /* Action used on success */ 1267 1288 1268 1289 int xrc = XSendEvent(m_pDisplay, srcWin, True, NoEventMask, reinterpret_cast<XEvent*>(&m)); … … 1274 1295 if (type == xAtom(XA_INCR)) 1275 1296 { 1276 /* Todo:*/1297 /** @todo Support incremental transfers. */ 1277 1298 AssertMsgFailed(("Incrementally transfers are not supported, yet\n")); 1278 1299 rc = VERR_NOT_IMPLEMENTED; … … 1283 1304 rc = VERR_INVALID_PARAMETER; 1284 1305 } 1306 1285 1307 /* Cancel this. */ 1286 1308 XClientMessageEvent m; … … 1294 1316 m.data.l[1] = 0; 1295 1317 m.data.l[2] = None; 1318 1296 1319 int xrc = XSendEvent(m_pDisplay, srcWin, False, NoEventMask, reinterpret_cast<XEvent*>(&m)); 1297 1320 if (RT_UNLIKELY(xrc == 0)) … … 1299 1322 m_wndCur = 0; 1300 1323 } 1324 1301 1325 /* Cleanup */ 1302 1326 if (ucData) … … 1315 1339 rc = VERR_TIMEOUT; 1316 1340 1317 /* Inform the host on error */1341 /* Inform the host on error. */ 1318 1342 if (RT_FAILURE(rc)) 1319 VbglR3DnDGHSendError( rc);1343 VbglR3DnDGHSendError(m_uClientID, rc); 1320 1344 1321 1345 /* At this point, we have either successfully transfered any data or not. … … 1326 1350 return rc; 1327 1351 } 1328 1329 1352 #endif /* VBOX_WITH_DRAG_AND_DROP_GH */ 1330 1353
Note:
See TracChangeset
for help on using the changeset viewer.