Mercurial > hg > xemacs-beta
comparison src/event-Xt.c @ 4790:bc4f2511bbea
Remove support for the OffiX drag-and-drop protocol. See xemacs-patches
message with ID <870180fe0912211421m3e3d7891pdadefef167b50cb4@mail.gmail.com>.
author | Jerry James <james@xemacs.org> |
---|---|
date | Tue, 22 Dec 2009 15:52:06 -0700 |
parents | 2fd201d73a92 |
children | 19a72041c5ed |
comparison
equal
deleted
inserted
replaced
4789:56049bea9231 | 4790:bc4f2511bbea |
---|---|
59 #include "xmotif.h" | 59 #include "xmotif.h" |
60 #endif | 60 #endif |
61 | 61 |
62 #ifdef HAVE_DRAGNDROP | 62 #ifdef HAVE_DRAGNDROP |
63 #include "dragdrop.h" | 63 #include "dragdrop.h" |
64 #endif | |
65 | |
66 #if defined (HAVE_OFFIX_DND) | |
67 #include "offix.h" | |
68 #endif | 64 #endif |
69 | 65 |
70 #ifdef WIN32_ANY | 66 #ifdef WIN32_ANY |
71 extern int mswindows_is_blocking; | 67 extern int mswindows_is_blocking; |
72 #endif | 68 #endif |
1315 { | 1311 { |
1316 /* Patch bogus TAKE_FOCUS messages from MWM; CurrentTime is | 1312 /* Patch bogus TAKE_FOCUS messages from MWM; CurrentTime is |
1317 passed as the timestamp of the TAKE_FOCUS, which the ICCCM | 1313 passed as the timestamp of the TAKE_FOCUS, which the ICCCM |
1318 explicitly prohibits. */ | 1314 explicitly prohibits. */ |
1319 XClientMessageEvent *ev = &x_event->xclient; | 1315 XClientMessageEvent *ev = &x_event->xclient; |
1320 #ifdef HAVE_OFFIX_DND | 1316 |
1321 if (DndIsDropMessage (x_event)) | |
1322 { | |
1323 unsigned int state; | |
1324 int modifiers = 0; | |
1325 int button = 0; | |
1326 struct frame *frame = x_any_window_to_frame (d, ev->window); | |
1327 Extbyte *data; | |
1328 unsigned long size, dtype; | |
1329 Lisp_Object l_type = Qnil, l_data = Qnil; | |
1330 Lisp_Object l_dndlist = Qnil, l_item = Qnil; | |
1331 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | |
1332 | |
1333 if (! frame) | |
1334 return 0; /* not for us */ | |
1335 | |
1336 GCPRO4 (l_type, l_data, l_dndlist, l_item); | |
1337 set_event_type (emacs_event, misc_user_event); | |
1338 SET_EVENT_CHANNEL (emacs_event, wrap_frame (frame)); | |
1339 SET_EVENT_TIMESTAMP (emacs_event, | |
1340 DEVICE_X_LAST_SERVER_TIMESTAMP (d)); | |
1341 state=DndDragButtons (x_event); | |
1342 | |
1343 if (state & ShiftMask) modifiers |= XEMACS_MOD_SHIFT; | |
1344 if (state & ControlMask) modifiers |= XEMACS_MOD_CONTROL; | |
1345 if (state & xd->MetaMask) modifiers |= XEMACS_MOD_META; | |
1346 if (state & xd->SuperMask) modifiers |= XEMACS_MOD_SUPER; | |
1347 if (state & xd->HyperMask) modifiers |= XEMACS_MOD_HYPER; | |
1348 if (state & xd->AltMask) modifiers |= XEMACS_MOD_ALT; | |
1349 if (state & Button1Mask) modifiers |= XEMACS_MOD_BUTTON1; | |
1350 if (state & Button2Mask) modifiers |= XEMACS_MOD_BUTTON2; | |
1351 if (state & Button3Mask) modifiers |= XEMACS_MOD_BUTTON3; | |
1352 if (state & Button4Mask) modifiers |= XEMACS_MOD_BUTTON4; | |
1353 if (state & Button5Mask) modifiers |= XEMACS_MOD_BUTTON5; | |
1354 | |
1355 if (state & Button5Mask) button = Button5; | |
1356 if (state & Button4Mask) button = Button4; | |
1357 if (state & Button3Mask) button = Button3; | |
1358 if (state & Button2Mask) button = Button2; | |
1359 if (state & Button1Mask) button = Button1; | |
1360 | |
1361 SET_EVENT_MISC_USER_MODIFIERS (emacs_event, modifiers); | |
1362 SET_EVENT_MISC_USER_BUTTON (emacs_event, button); | |
1363 | |
1364 DndDropCoordinates (FRAME_X_TEXT_WIDGET (frame), x_event, | |
1365 &(EVENT_MISC_USER_X (emacs_event)), | |
1366 &(EVENT_MISC_USER_Y (emacs_event))); | |
1367 DndGetData (x_event, &data, &size); | |
1368 | |
1369 dtype = DndDataType (x_event); | |
1370 switch (dtype) | |
1371 { | |
1372 case DndFiles: /* null terminated strings, end null */ | |
1373 { | |
1374 int len; | |
1375 Ibyte *hurl = NULL; | |
1376 | |
1377 while (*data) | |
1378 { | |
1379 Ibyte *dataint; | |
1380 len = strlen (data); | |
1381 EXTERNAL_TO_C_STRING (data, dataint, Qfile_name); | |
1382 hurl = dnd_url_hexify_string (dataint, | |
1383 (const Ibyte *) "file:"); | |
1384 l_item = build_intstring (hurl); | |
1385 l_dndlist = Fcons (l_item, l_dndlist); | |
1386 data += len + 1; | |
1387 xfree (hurl, Ibyte *); | |
1388 } | |
1389 l_type = Qdragdrop_URL; | |
1390 } | |
1391 break; | |
1392 case DndText: | |
1393 l_type = Qdragdrop_MIME; | |
1394 l_dndlist = list1 (list3 (list1 (build_string ("text/plain")), | |
1395 build_string ("8bit"), | |
1396 build_ext_string (data, | |
1397 Qctext))); | |
1398 break; | |
1399 case DndMIME: | |
1400 /* we have to parse this in some way to extract | |
1401 content-type and params (in the tm way) and | |
1402 content encoding. | |
1403 OR: if data is string, let tm do the job | |
1404 if data is list[2], give the first two | |
1405 to tm... | |
1406 */ | |
1407 l_type = Qdragdrop_MIME; | |
1408 l_dndlist = list1 (build_ext_string (data, Qbinary)); | |
1409 break; | |
1410 case DndFile: | |
1411 case DndDir: | |
1412 case DndLink: | |
1413 case DndExe: | |
1414 { | |
1415 Ibyte *dataint, *hurl; | |
1416 EXTERNAL_TO_C_STRING (data, dataint, Qfile_name); | |
1417 hurl = dnd_url_hexify_string (dataint, "file:"); | |
1418 l_dndlist = list1 (build_intstring (hurl)); | |
1419 xfree (hurl, Ibyte *); | |
1420 } | |
1421 break; | |
1422 case DndURL: | |
1423 /* as it is a real URL it should already be escaped | |
1424 and escaping again will break them (cause % is unsave) */ | |
1425 l_dndlist = list1 (build_ext_string (data, | |
1426 Qfile_name)); | |
1427 l_type = Qdragdrop_URL; | |
1428 break; | |
1429 default: /* Unknown, RawData and any other type */ | |
1430 l_dndlist = list1 (list3 (list1 (build_string | |
1431 ("application/octet-stream")), | |
1432 build_string ("8bit"), | |
1433 make_ext_string (data, size, | |
1434 Qbinary))); | |
1435 l_type = Qdragdrop_MIME; | |
1436 break; | |
1437 } | |
1438 | |
1439 SET_EVENT_MISC_USER_FUNCTION (emacs_event, | |
1440 Qdragdrop_drop_dispatch); | |
1441 SET_EVENT_MISC_USER_OBJECT (emacs_event, | |
1442 Fcons (l_type, l_dndlist)); | |
1443 | |
1444 UNGCPRO; | |
1445 | |
1446 break; | |
1447 } | |
1448 #endif /* HAVE_OFFIX_DND */ | |
1449 if (ev->message_type == DEVICE_XATOM_WM_PROTOCOLS (d) | 1317 if (ev->message_type == DEVICE_XATOM_WM_PROTOCOLS (d) |
1450 && (Atom) (ev->data.l[0]) == DEVICE_XATOM_WM_TAKE_FOCUS (d) | 1318 && (Atom) (ev->data.l[0]) == DEVICE_XATOM_WM_TAKE_FOCUS (d) |
1451 && (Atom) (ev->data.l[1]) == 0) | 1319 && (Atom) (ev->data.l[1]) == 0) |
1452 { | 1320 { |
1453 ev->data.l[1] = DEVICE_X_LAST_SERVER_TIMESTAMP (d); | 1321 ev->data.l[1] = DEVICE_X_LAST_SERVER_TIMESTAMP (d); |