Mercurial > emacs
diff src/xselect.c @ 83541:694bbb62a75d
Merged from emacs@sv.gnu.org
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-371
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-372
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-373
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-374
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-375
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-376
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-377
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-378
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-379
Merge from erc--emacs--21
* emacs@sv.gnu.org/emacs--devo--0--patch-380
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-381
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-382
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-383
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-384
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-385
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-386
Update from erc--emacs--22
* emacs@sv.gnu.org/emacs--devo--0--patch-387
Fix ERC bug introduced in last patch
* emacs@sv.gnu.org/emacs--devo--0--patch-388
Update from erc--emacs--22
* emacs@sv.gnu.org/emacs--devo--0--patch-389
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-390
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-391
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-392
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-393
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-394
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-395
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-396
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-397
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-398
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-399
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-400
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-401
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-402
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-403
Rcirc update from Ryan Yeske
* emacs@sv.gnu.org/emacs--devo--0--patch-404
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-405
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-406
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-407
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-408
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-409
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-410
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-411
Miscellaneous tq-related fixes.
* emacs@sv.gnu.org/emacs--devo--0--patch-412
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-121
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-122
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-123
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-124
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-125
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-126
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-127
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-581
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Sat, 14 Oct 2006 16:56:21 +0000 |
parents | 02e39decdc84 237fcefd8610 |
children | 034f67f59091 |
line wrap: on
line diff
--- a/src/xselect.c Sun Jul 30 10:19:46 2006 +0000 +++ b/src/xselect.c Sat Oct 14 16:56:21 2006 +0000 @@ -2709,8 +2709,48 @@ return ret; } -/* Convert an XClientMessageEvent to a Lisp event of type DRAG_N_DROP_EVENT. - TODO: Check if this client event really is a DND event? */ +DEFUN ("x-register-dnd-atom", Fx_register_dnd_atom, + Sx_register_dnd_atom, 1, 2, 0, + doc: /* Request that dnd events are made for ClientMessages with ATOM. +ATOM can be a symbol or a string. The ATOM is interned on the display that +FRAME is on. If FRAME is nil, the selected frame is used. */) + (atom, frame) + Lisp_Object atom, frame; +{ + Atom x_atom; + struct frame *f = check_x_frame (frame); + size_t i; + struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + + + if (SYMBOLP (atom)) + x_atom = symbol_to_x_atom (dpyinfo, FRAME_X_DISPLAY (f), atom); + else if (STRINGP (atom)) + { + BLOCK_INPUT; + x_atom = XInternAtom (FRAME_X_DISPLAY (f), (char *) SDATA (atom), False); + UNBLOCK_INPUT; + } + else + error ("ATOM must be a symbol or a string"); + + for (i = 0; i < dpyinfo->x_dnd_atoms_length; ++i) + if (dpyinfo->x_dnd_atoms[i] == x_atom) + return Qnil; + + if (dpyinfo->x_dnd_atoms_length == dpyinfo->x_dnd_atoms_size) + { + dpyinfo->x_dnd_atoms_size *= 2; + dpyinfo->x_dnd_atoms = xrealloc (dpyinfo->x_dnd_atoms, + sizeof (*dpyinfo->x_dnd_atoms) + * dpyinfo->x_dnd_atoms_size); + } + + dpyinfo->x_dnd_atoms[dpyinfo->x_dnd_atoms_length++] = x_atom; + return Qnil; +} + +/* Convert an XClientMessageEvent to a Lisp event of type DRAG_N_DROP_EVENT. */ int x_handle_dnd_message (f, event, dpyinfo, bufp) @@ -2726,6 +2766,12 @@ int x, y; unsigned char *data = (unsigned char *) event->data.b; int idata[5]; + size_t i; + + for (i = 0; i < dpyinfo->x_dnd_atoms_length; ++i) + if (dpyinfo->x_dnd_atoms[i] == event->message_type) break; + + if (i == dpyinfo->x_dnd_atoms_length) return 0; XSETFRAME (frame, f); @@ -2899,6 +2945,7 @@ defsubr (&Sx_get_atom_name); defsubr (&Sx_send_client_message); + defsubr (&Sx_register_dnd_atom); reading_selection_reply = Fcons (Qnil, Qnil); staticpro (&reading_selection_reply);